-
Notifications
You must be signed in to change notification settings - Fork 88
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
feat: Add maxBatchingDelayMs Option. #987
base: main
Are you sure you want to change the base?
Conversation
@@ -145,9 +146,14 @@ def _check_state(self): | |||
if self.committed is not None: | |||
raise ValueError("Batch already committed") | |||
|
|||
def commit(self, return_commit_stats=False, request_options=None): | |||
def commit(self, max_batching_delay_ms=None, return_commit_stats=False, request_options=None): |
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.
Adding new argument max_batching_delay_ms
as second parameter might break any existing applications that have not used key explicitly while calling commit
.
Can we move this to end?
def commit(self, max_batching_delay_ms=None, return_commit_stats=False, request_options=None): | |
def commit(self, return_commit_stats=False, request_options=None, max_batching_delay_ms=None): |
@surbhigarg92 Can you please correct me this is incorrect?
@@ -182,11 +188,16 @@ def commit(self, return_commit_stats=False, request_options=None): | |||
# Request tags are not supported for commit requests. | |||
request_options.request_tag = None | |||
|
|||
Duration max_batching_delay = None | |||
if max_batching_delay_ms is not None: | |||
max_batching_delay.nanos = 1000000 * [max_batching_delay_ms] |
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.
How is this default decided?
@@ -180,9 +181,14 @@ def rollback(self): | |||
self.rolled_back = True | |||
del self._session._transaction | |||
|
|||
def commit(self, return_commit_stats=False, request_options=None): | |||
def commit(self, max_batching_delay_ms=None, return_commit_stats=False, request_options=None): |
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.
Same as above comment
@nginsberg-google Do we need this PR? |
Adds support for max batching delay option in Commit requests.
This feature allows users to express how much latency they are willing for spanner to add to attempt to batch their writes. Generally speaking, the more latency they are willing to tolerate, the more efficiently Spanner can serve the writes.