Skip to content
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(x-goog-spanner-request-id): introduce AtomicCounter #1275

Merged

Conversation

odeke-em
Copy link
Contributor

This change introduces AtomicCounter, a concurrency/thread-safe counter do deal with the multi-threaded nature of variables. It permits operations:

  • atomic_counter += 1
  • value = atomic_counter + 1
  • atomic_counter.value

that'll be paramount to bringing in the logic for
x-goog-spanner-request-id in much reduced changelists.

Updates #1261
Carved out from PR #1264

This change introduces AtomicCounter, a concurrency/thread-safe
counter do deal with the multi-threaded nature of variables.
It permits operations:
* atomic_counter += 1
* value = atomic_counter + 1
* atomic_counter.value

that'll be paramount to bringing in the logic for
x-goog-spanner-request-id in much reduced changelists.

Updates googleapis#1261
Carved out from PR googleapis#1264
@odeke-em odeke-em requested review from a team as code owners December 18, 2024 14:23
@product-auto-label product-auto-label bot added the size: m Pull request size is medium. label Dec 18, 2024
@product-auto-label product-auto-label bot added the api: spanner Issues related to the googleapis/python-spanner API. label Dec 18, 2024
tests/unit/test_atomic_counter.py Outdated Show resolved Hide resolved
tests/unit/test_atomic_counter.py Show resolved Hide resolved
google/cloud/spanner_v1/request_id_header.py Show resolved Hide resolved
@olavloite olavloite added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Dec 19, 2024
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Dec 19, 2024
@odeke-em
Copy link
Contributor Author

Thank you for the reivew and approval @olavloite! I've updated the tests too. Kindly please help me run the bots too.

@olavloite olavloite added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Dec 19, 2024
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Dec 19, 2024
@olavloite olavloite added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Dec 19, 2024
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Dec 19, 2024
@olavloite olavloite enabled auto-merge (squash) December 19, 2024 19:18
@olavloite olavloite added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Dec 19, 2024
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Dec 19, 2024
@olavloite olavloite merged commit f2483e1 into googleapis:main Dec 19, 2024
10 of 12 checks passed
@odeke-em odeke-em deleted the x-goog-spanner-request-id-AtomicCounter branch December 19, 2024 20:38
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: m Pull request size is medium.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants