feat: Add support for multiplexed sessions#1383
Merged
rahul2393 merged 41 commits intogoogleapis:mainfrom Jun 10, 2025
Merged
Conversation
57902b4 to
c8e7a1c
Compare
rahul2393
reviewed
May 30, 2025
| environ[SessionOptions.ENV_VAR_ENABLE_MULTIPLEXED] = "true" | ||
| environ[SessionOptions.ENV_VAR_ENABLE_MULTIPLEXED_FOR_PARTITIONED] = "true" | ||
| environ[SessionOptions.ENV_VAR_ENABLE_MULTIPLEXED_FOR_READ_WRITE] = "true" | ||
| environ[SessionOptions.ENV_VAR_FORCE_DISABLE_MULTIPLEXED] = "false" |
Contributor
There was a problem hiding this comment.
We don't need to force disable multiplexed
Contributor
Author
There was a problem hiding this comment.
We don't need it at all? Is this environment variable is being completely removed from the scope of the project?
0bd4e7b to
98e6b13
Compare
…E_MULTIPLEXED_SESSIONS` and add unit tests. Signed-off-by: Taylor Curran <taylor.curran@improving.com>
…` exception from `DatabaseSessionManager` and add unit tests. Signed-off-by: Taylor Curran <taylor.curran@improving.com>
…essions, add unit tests. Signed-off-by: Taylor Curran <taylor.curran@improving.com>
Signed-off-by: Taylor Curran <taylor.curran@improving.com>
Signed-off-by: Taylor Curran <taylor.curran@improving.com>
…shotBase` and update attributes and tests. Signed-off-by: Taylor Curran <taylor.curran@improving.com>
…edundant as transaction ID is set via `_restart_on_unavailable`) Signed-off-by: Taylor Curran <taylor.curran@improving.com>
…to `Client` so that multiplexed are disabled for _all_ databases. Signed-off-by: Taylor Curran <taylor.curran@improving.com>
…Database.run_in_transaction` to not use it. Signed-off-by: Taylor Curran <taylor.curran@improving.com>
… cleanup. Signed-off-by: Taylor Curran <taylor.curran@improving.com>
…ession manager. Signed-off-by: Taylor Curran <taylor.curran@improving.com>
…s from class attributes to instance attributes. Signed-off-by: Taylor Curran <taylor.curran@improving.com>
…d `database.session()` Signed-off-by: Taylor Curran <taylor.curran@improving.com>
…s, add TODOs, and make `Session._transaction` default to None. Plus add some `Optional` typing hints. Signed-off-by: Taylor Curran <taylor.curran@improving.com>
…hot` to `_SnapshotBase` and update unit tests. Signed-off-by: Taylor Curran <taylor.curran@improving.com>
…nsaction`, move to base class, update tests. Signed-off-by: Taylor Curran <taylor.curran@improving.com>
…ransactions. Signed-off-by: Taylor Curran <taylor.curran@improving.com>
… checks, add `raises` documentation. Signed-off-by: Taylor Curran <taylor.curran@improving.com>
…for testing. Signed-off-by: Taylor Curran <taylor.curran@improving.com>
Signed-off-by: Taylor Curran <taylor.curran@improving.com>
…nsert_then_rollback`. Signed-off-by: Taylor Curran <taylor.curran@improving.com>
Signed-off-by: Taylor Curran <taylor.curran@improving.com>
…e class, simplify `_SnapshotBase` tests, remove redundant tests. Signed-off-by: Taylor Curran <taylor.curran@improving.com>
2e8ccf8 to
72574d4
Compare
…d_insert_then_rollback` and add `build_request_id` helper method, fix `test_snapshot` and `test_transaction` failures. Signed-off-by: Taylor Curran <taylor.curran@improving.com>
9c6574b to
418edda
Compare
…d by maintenance thread. Signed-off-by: Taylor Curran <taylor.curran@improving.com>
…r `_SnapshotBase`. Signed-off-by: Taylor Curran <taylor.curran@improving.com>
… constants for next step. Signed-off-by: Taylor Curran <taylor.curran@improving.com>
…ew multiplexed behaviour. Signed-off-by: Taylor Curran <taylor.curran@improving.com>
Signed-off-by: Taylor Curran <taylor.curran@improving.com>
currantw
commented
Jun 5, 2025
| return all_metadata | ||
|
|
||
|
|
||
| def build_request_id(client_id, channel_id, nth_request, attempt): |
Contributor
Author
There was a problem hiding this comment.
Added helper method to reduce duplication in tests.
Signed-off-by: Taylor Curran <taylor.curran@improving.com>
currantw
commented
Jun 5, 2025
Comment on lines
88
to
93
| elif transaction_type is TransactionType.READ_WRITE: | ||
| return False | ||
| return ( | ||
| self._getenv(self.ENV_VAR_ENABLE_MULTIPLEXED) | ||
| and self._getenv(self.ENV_VAR_ENABLE_MULTIPLEXED_FOR_READ_WRITE) | ||
| and self._is_multiplexed_enabled[transaction_type] | ||
| ) |
Contributor
Author
There was a problem hiding this comment.
Read/write transaction are supported here, but are disabled in DatabaseSessionManager. Will be turning that on in the next PR.
currantw
commented
Jun 5, 2025
Contributor
Author
There was a problem hiding this comment.
Helpers methods. Added to help simply unit tests.
Signed-off-by: Taylor Curran <taylor.curran@improving.com>
…multiplexed sessions due to runtime failures. Signed-off-by: Taylor Curran <taylor.curran@improving.com>
Signed-off-by: Taylor Curran <taylor.curran@improving.com>
Signed-off-by: Taylor Curran <taylor.curran@improving.com>
rahul2393
approved these changes
Jun 10, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
feat: Add support for multiplexed sessions: