Closed
Labels
🚨This issue needs some love.This issue needs some love.api: datastoreIssues related to the Datastore API.Issues related to the Datastore API.triage meI really want to be triaged.I really want to be triaged.
Description
For example:
# >>> entity.kind()
# 'Knd'
with datastore.transaction.Transaction():
# entity1 has an incomplete key, hence the delete fails
entity1.delete()
# Exception: Request failed. Error was: Key path element must not be incomplete: [Knd: ]
with datastore.transaction.Transaction():
entity2.save()
# ValueError: Cannot start a transaction with another already in progress.
Maybe this isn't such a big deal since most code will stop working after the first uncaught exception? The only reason I noticed is because using a test-runner, the exception is caught and printed, but the process just moves on to the next.
Metadata
Metadata
Assignees
Labels
🚨This issue needs some love.This issue needs some love.api: datastoreIssues related to the Datastore API.Issues related to the Datastore API.triage meI really want to be triaged.I really want to be triaged.
Activity
[-]Transaction does not complete if exception happens during transaction commit.[/-][+]Transaction does not get rolled back if exception happens during commit.[/+]tseaver commentedon Jan 6, 2015
Hmm,
list(query.fetch())is returning empty, whilelist(query.fetch(limit=100))is returning 3 posts.DJH NOTE: This was in reference to #488
dhermes commentedon Jan 6, 2015
I think
0is different than not setting indatastore_pb.Query.DJH NOTE: This was in reference to #488
dhermes commentedon Jan 7, 2015
I just realized this was filed and closed as #136. However, I think it should be addressed as discussed by Tres.
dhermes commentedon Jan 9, 2015
@tseaver This will probably be fixed as part of #514. This only causes failure of future code because the cleanup
doesn't get a chance to occur either in
Transaction.commit()orTransaction.rollback().Once we rely on
Batch.__exit__to pop the currentTransactionoff the stack infinally:, this bug should go away.However, it's unclear to me if we need to
rollback()a transaction which fails oncommit(). It seems like we should, but maybe it doesn't matter.Working code to re-create this bug (as of 0525530):
tseaver commentedon Jan 12, 2015
If the back-end returns an error in our call to its
commit, I don't think we should be rolling anything back: the "token" for the transaction is already known to be invalid on their side, which is the only reason to call theirrollback.dhermes commentedon Jan 12, 2015
I'm not clear why the "token" for the transaction is known to be valid. I'd like to get input from someone on the datastore team to see if
rollbackis necessary / a "best practice" in those cases.tseaver commentedon Jan 12, 2015
rollbackexists to allow the application to signal the back-end that it will never callcommit, and therefore that the back-end can release any resources for that transaction.I cannot see any possible way to reuse the opaque
transactionfield (returned inbeginTransaction) aftercommitAPI using it fails. The back-end folks will have torn down / released anything they allocated inbeginTransactionwhen the failed thecommit, and don't need us to tell them to do so by callingrollback(in fact, I would bet thatrollbackafter a failedcommitwould error out).dhermes commentedon Jan 12, 2015
I wasn't sure that
is actually true. I just tried to commit twice and it clearly fails.
I was "distracted" by the fact that a transaction can have multiple
runQuerycalls (i.e. read options are set in a query).dhermes commentedon Jan 12, 2015
To summarize all that just happened, the only thing left to fix this bug is the removal of
which will happen by the end of #514.
dhermes commentedon Jan 15, 2015
Fixed as of #550
17 remaining items
docs: fix changelog header to consistent size (#457)
docs: fix changelog header to consistent size (#457)
chore: use python-samples-reviewers (#457)
chore: release 0.24.2 (#457)
fix(deps): allow protobuf 5.x (#457)
chore: update docfx minimum Python version (#457)
chore: use gapic-generator-python 0.51.2 (#457)
chore: update .repo-metadata.json (#457)
feat: convert grpc errors to api core exceptions (#457)
chore: update .repo-metadata.json (#457)
feat: add mTLS ADC support for HTTP (#457)
chore: release 1.12.0 (#463)
chore: update staging bucket to dev (#457)
chore(deps): update dependency typing-extensions to v4.12.2 (#457)
build(deps): Bump django from 4.2.25 to 4.2.29 in /.kokoro (#457)