RE: lots of ReadConflictErrors
"Boylan, Ross" <[email protected]>
| Newsgroups | gmane.comp.web.zope.zodb |
|---|---|
| Message-ID | <[email protected]> |
Short version: transaction retries seem to execute multiple times even if all executions succeed.
While trying to come up with a simpler example I had this code at the end:
aTM = transaction.TransactionManager()
conn = db.open(aTM)
for attempt in aTM.attempts(10):
with attempt:
aTree = conn.root.foo
print("Inserted {} objects from {} threads: {}".format(len(aTree), nThread, list(aTree.keys())))
I had the impression from http://www.zodb.org/en/latest/guide/transactions-and-threading.html
that this should have one successful execution (because the for attempt .. with attempt: is said to be equivalent to an earlier code block that had that semantics; also the example at http://zodb.readthedocs.io/en/latest/transactions.html#retrying-transactions is consistent with this interpretation). But it seems to execute 10 times, i.e., the print statement is executed 10 times. I'll add that at this point all the writer threads had completed, so I don't think an error should be possible. I was trying to use the retry formulation everywhere to avoid mixing different transaction idioms.
So, have I misunderstood? Coded it wrong? Found a bug?
Ross
P.S. If I've understood earlier advice I can do without the explicit transaction manager; I'm just trying not to change too much at once.
________________________________________
From: [email protected] [[email protected]] on behalf of Jim Fulton [[email protected]]
Sent: Thursday, October 06, 2016 3:13 PM
To: Boylan, Ross
Cc: Jim Fulton; zodb [[email protected]]
Subject: Re: [ZODB] lots of ReadConflictErrors
On Thu, Oct 6, 2016 at 5:40 PM, Boylan, Ross <[email protected]> wrote:
> "readCurrent" is not in my code or in the stack traces I sent in this email thread, and so I don't know why you say I'm calling it.
The stack trace ends in checkCurrentSerialInTransaction. This is a
storage method that's called during the commit process if something
has called readCurrent on the connection in the transaction being
committed.
So a mystery for you to solve is what in your application is calling
readCurrent.
Jim
--
Jim Fulton
http://jimfulton.info
--
You received this message because you are subscribed to the Google Groups "zodb" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.