-
Notifications
You must be signed in to change notification settings - Fork 113
feat(spanner): support setting read lock mode #2388
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,6 +27,7 @@ import {Database} from './database'; | |
| import {google} from '../protos/protos'; | ||
| import IRequestOptions = google.spanner.v1.IRequestOptions; | ||
| import IsolationLevel = google.spanner.v1.TransactionOptions.IsolationLevel; | ||
| import ReadLockMode = google.spanner.v1.TransactionOptions.ReadWrite.ReadLockMode; | ||
|
|
||
| // eslint-disable-next-line @typescript-eslint/no-var-requires | ||
| const jsonProtos = require('../protos/protos.json'); | ||
|
|
@@ -45,9 +46,13 @@ const RetryInfo = Root.fromJSON(jsonProtos).lookup('google.rpc.RetryInfo'); | |
| export interface RunTransactionOptions { | ||
| timeout?: number; | ||
| requestOptions?: Pick<IRequestOptions, 'transactionTag'>; | ||
| /** | ||
| * @deprecated Use readLockMode instead. | ||
| */ | ||
| optimisticLock?: boolean; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removing this is. breaking change, even though this property might not be used. We can mark this deprecated instead.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's a good idea. I added it back with a deprecated annotation. But should I also be adding back the logic in src/transaction.ts to actually set the read lock mode based on this? Or just leave it as a no-op if someone sets it?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Leaving no-op should be fine, we already verified that there are no users for this feature. Just in-case if someone is using , maybe in their testing etc, in that case it should not break their application. WDYT ?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah I think that should be fine. Given that this was something prepared for preview years ago and never released, it should be safe. |
||
| excludeTxnFromChangeStreams?: boolean; | ||
| isolationLevel?: IsolationLevel; | ||
| readLockMode?: ReadLockMode; | ||
| } | ||
|
|
||
| /** | ||
|
|
@@ -130,6 +135,7 @@ export abstract class Runner<T> { | |
| const defaults = { | ||
| timeout: 3600000, | ||
| isolationLevel: IsolationLevel.ISOLATION_LEVEL_UNSPECIFIED, | ||
| readLockMode: ReadLockMode.READ_LOCK_MODE_UNSPECIFIED, | ||
| }; | ||
|
|
||
| this.options = Object.assign(defaults, options); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.