Skip to content

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
@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
aakashanandg pushed a commit to aakashanandg/python-spanner that referenced this pull request Jan 2, 2025
…1275)

* feat(x-goog-spanner-request-id): introduce AtomicCounter

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

* Tests for with_request_id

* chore: remove sleep

* chore: remove unused import

---------

Co-authored-by: Knut Olav Løite <[email protected]>
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