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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add flush check in BulkWriter.sendBatchLocked() callback #631

Merged
merged 2 commits into from May 14, 2021

Conversation

thebrianchen
Copy link

@thebrianchen thebrianchen commented May 14, 2021

Found this bug while adding recursive delete tests. I tried to think of a way to add a unit test to check for this, but I couldn't think of an easy test since scheduleCurrentBatchLocked() automatically returns if there are no mutations.

However, not having this check was causing the startAfter() recursive delete test to flake, so that's some indirect coverage 馃槰

@thebrianchen thebrianchen self-assigned this May 14, 2021
@thebrianchen thebrianchen requested a review from a team as a code owner May 14, 2021 15:46
@thebrianchen thebrianchen requested a review from a team May 14, 2021 15:46
@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label May 14, 2021
@product-auto-label product-auto-label bot added the api: firestore Issues related to the googleapis/java-firestore API. label May 14, 2021
@@ -989,7 +989,9 @@ private void sendBatchLocked(final BulkCommitBatch batch, final boolean flush) {
@Override
public void run() {
synchronized (lock) {
scheduleCurrentBatchLocked(flush);
if (flush) {
Copy link
Contributor

Choose a reason for hiding this comment

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

The if-check can happen outside the synchronized block.

Copy link
Author

Choose a reason for hiding this comment

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

done.

@thebrianchen thebrianchen merged commit ac3db81 into master May 14, 2021
@thebrianchen thebrianchen deleted the bc/bulk-flush branch May 14, 2021 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: firestore Issues related to the googleapis/java-firestore API. cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants