-
Notifications
You must be signed in to change notification settings - Fork 112
feat(spanner): support for Multiplexed Session Partitioned Ops #2252
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
6d5da0b to
f163bb1
Compare
This PR contains code changes to add support for option IsolationLevel at the client level and at the transaction level. supported methods are(RW and Blind Write): ``` - writeAtLeastOnce - runTransactionAsync - runTransaction - getTransaction - async getTransaction(from transaction runner class) ```
d16e367 to
433a20a
Compare
4803966 to
32ccb88
Compare
32ccb88 to
0176e8f
Compare
a0e46ff to
0683469
Compare
src/session-factory.ts
Outdated
| ? (this.isMultiplexed = true) | ||
| : (this.isMultiplexed = false); | ||
| // set the isMultiplexedPartitionedOps property to true if multiplexed session is enabled for paritioned ops, otherwise set the property to false | ||
| process.env.GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSIONS === 'true' && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isMultiplexedPartitionOps = process.env.GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSIONS === 'true' && process.env.GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSIONS_PARTITIONED_OPS === 'true'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
0683469 to
312504c
Compare
src/session-factory.ts
Outdated
| * If multiplexed sessions are enabled for partitioned ops this methods delegates the request to `getSession()`, which will return | ||
| * either a multiplexed session or a regular session based on the configuration. | ||
| * | ||
| * If the multiplexed sessions are not enabled, a session is retrieved from the regular session pool. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| * If the multiplexed sessions are not enabled, a session is retrieved from the regular session pool. | |
| * If the multiplexed sessions are disabled, a session is retrieved from the regular session pool. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
src/session-factory.ts
Outdated
|
|
||
| /** | ||
| * Retrieves a session for partitioned operations, selecting the appropriate session type | ||
| * based on whether multiplexed sessions are enabled for partitioned operations. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| * based on whether multiplexed sessions are enabled for partitioned operations. | |
| * based on whether multiplexed sessions are enabled. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
src/session-factory.ts
Outdated
| * Retrieves a session for partitioned operations, selecting the appropriate session type | ||
| * based on whether multiplexed sessions are enabled for partitioned operations. | ||
| * | ||
| * If multiplexed sessions are enabled for partitioned ops this methods delegates the request to `getSession()`, which will return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| * If multiplexed sessions are enabled for partitioned ops this methods delegates the request to `getSession()`, which will return | |
| * If multiplexed sessions are enabled for partitioned ops this methods delegates the request to `getSession()`, which returns |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
src/session-factory.ts
Outdated
| */ | ||
| release(session: Session): void { | ||
| if (!this.isMultiplexed) { | ||
| if (!session.metadata.multiplexed) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need optional check for "metadata" here ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
made it optional
| }); | ||
| muxEnabled.forEach(isMuxEnabled => { | ||
| describe( | ||
| 'when GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSIONS is ' + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 'when GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSIONS is ' + | |
| 'when GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSIONS_PARTITIONED_OPS is ' + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
test/mockserver/mockspanner.ts
Outdated
| * @param database The database to create the session for. | ||
| */ | ||
| private newSession(database: string): protobuf.Session { | ||
| private newSession(multiplexed: boolean, database: string): protobuf.Session { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add multiplexed: boolean as an optional parameter, with default value as false
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
test/mockserver/mockspanner.ts
Outdated
| this.simulateExecutionTime(this.batchCreateSessions.name) | ||
| .then(() => { | ||
| const sessions = new Array<protobuf.Session>(); | ||
| const multiplexed = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change should not be required once you make multiplexed as optional
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, updated. thanks for the suggestion!
312504c to
1014985
Compare
1014985 to
d26c69a
Compare
* feat(spanner): support for Multiplexed Session Partitioned Ops * feat(spanner): add support for snapshot isolation (#2245) This PR contains code changes to add support for option IsolationLevel at the client level and at the transaction level. supported methods are(RW and Blind Write): ``` - writeAtLeastOnce - runTransactionAsync - runTransaction - getTransaction - async getTransaction(from transaction runner class) ``` * refactor * refactor
This PR contains code changes to add support for multiplexed session support in Partitioned DML transactions.