Skip to content

Commit called if rollback fails #237

Closed
@pcostell

Description

@pcostell

I believe I am reading the code correctly (please close this if I'm not!) -- based on the docs for transactions I should do something like this:

ds.runInTransaction(function(txn, done) {
  txn.get(key, function(err, entity) {
    if (err) {
      txn.rollback(done);
    }
  });
}, function(err) {});

However if the rollback fails, we'll call done without ever setting isFinalized = true. I believe this means we'll then try to commit the transaction, which doesn't seem like the desired outcome. It's ok to just not rollback the transaction, eventually it will expire, so rollback should always immediately set isFinalized = true.

Also I'm not sure if this gets fixed at all by the refactor that's currently happening with Transaction.

Metadata

Metadata

Labels

🚨This issue needs some love.api: datastoreIssues related to the Datastore API.triage meI really want to be triaged.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions