FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix: mutations batcher race condition by daniel-sanche · Pull Request #896 · googleapis/python-bigtable · GitHub

This repository was archived by the owner on Apr 1, 2026. It is now read-only.
/ python-bigtable Public archive

fix: mutations batcher race condition - #896

Merged
daniel-sanche merged 15 commits into
mainfrom
fix_batcher_threads
Dec 12, 2023
Merged

fix: mutations batcher race condition#896
daniel-sanche merged 15 commits into
mainfrom
fix_batcher_threads

Conversation

daniel-sanche commented Dec 11, 2023
edited
Loading

Copy link
Copy Markdown
Contributor

There was a race condition found in the threaded mutations batcher. The batcher would check the state of the queue, and then read from the queue as separate steps, which left room for other threads to change the state in between

This PR addresses the problem with the following changes:

  • queue.get will now return None if the queue is empty. This allows us to check the state and get the next items in an atomic operation, replacing the need for queue.empty
  • rewrote the _flush_async implementation, to simplify it and make it more thread-safe

daniel-sanche requested review from a team December 11, 2023 19:38
product-auto-label Bot added size: m Pull request size is medium. api: bigtable Issues related to the googleapis/python-bigtable API. labels Dec 11, 2023
Comment thread google/cloud/bigtable/batcher.py Outdated
Comment thread google/cloud/bigtable/batcher.py Outdated
Comment thread google/cloud/bigtable/batcher.py Outdated
daniel-sanche added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Dec 12, 2023
yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Dec 12, 2023

igorbernstein2 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

lgtm

daniel-sanche added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Dec 12, 2023
yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Dec 12, 2023
daniel-sanche merged commit fe58f61 into main Dec 12, 2023
daniel-sanche deleted the fix_batcher_threads branch December 12, 2023 21:58
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 subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

api: bigtable Issues related to the googleapis/python-bigtable API. size: m Pull request size is medium.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants


Back | FazBrowse Home | New Git URL