Skip to content

Conversation

nginsberg-google
Copy link
Contributor

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.

@nginsberg-google nginsberg-google requested review from a team as code owners July 31, 2023 22:25
@product-auto-label product-auto-label bot added size: s Pull request size is small. api: spanner Issues related to the googleapis/python-spanner API. labels Jul 31, 2023
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):
Copy link
Contributor

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?

Suggested change
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?


Duration max_batching_delay = None
if max_batching_delay_ms is not None:
max_batching_delay.nanos = 1000000 * [max_batching_delay_ms]
Copy link
Contributor

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?

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):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above comment

@harshachinta
Copy link
Contributor

harshachinta commented Feb 2, 2024

@nginsberg-google Do we need this PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: spanner Issues related to the googleapis/python-spanner API. size: s Pull request size is small.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants