-
Notifications
You must be signed in to change notification settings - Fork 113
seqno parameter is ignored on transaction.run() requests #1940
Description
Environment details
- OS: Linux
- Node.js version: 20.2
- npm version:
@google-cloud/spannerversion: 6.9.0
Steps to reproduce
We were investigating whether it's possible to do parallel reads inside a read-write transaction, by sending a set of reads all with the same sequence number (we have since realised this is impossible, per the documentation: "A per-transaction sequence number used to identify this request. This field makes each request idempotent such that if the request is received multiple times, at most one will succeed.")
Anyway, the transaction.run() interface will ignore any given seqno parameter, e.g.:
transaction.run({query: "SELECT * FROM table", seqno: 42})
// But it uses the `transaction._seqno` property insteadBecause of this code:
nodejs-spanner/src/transaction.ts
Lines 1089 to 1092 in cb66474
| reqOpts = Object.assign(query, { | |
| session: this.session.formattedName_!, | |
| seqno: this._seqno++, | |
| requestOptions: this.configureTagOptions( |
It might be worth updating the types to make it clear that the user is unable to specify this - I wouldn't have spent 30 minutes scratching my head :)