Skip to content

Fix MutationQueue issue resulting in re-sending acknowledged writes. #559

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

Merged
merged 3 commits into from
Mar 12, 2018

Conversation

mikelehen
Copy link
Contributor

getNextMutationBatchAfterBatchId() was not respecting highestAcknowledgedBatchId and therefore we were resending writes if they had been acknowledged but not removed (aka the held write acks case). This showed up when a user enabled / disabled the network as reported here and I've included a spec test to emulate that case: firebase/firebase-ios-sdk#772 (cc/ @gsoltis FYI).

This is the JS port which I'll port to iOS (where the issue was reported) once we're happy with the fix here.

getNextMutationBatchAfterBatchId() was not respecting
highestAcknowledgedBatchId and therefore we were resending writes after the
network was disabled / re-enabled as reported here:
firebase/firebase-ios-sdk#772
Copy link
Contributor

@wilhuff wilhuff left a comment

Choose a reason for hiding this comment

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

LGTM with a question

fromCache: true
})

// handshake + write + close = 3 requests
Copy link
Contributor

Choose a reason for hiding this comment

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

This comment is a bit too terse. Is this happening as a result of disabling the network or something else?

If so it's weird because I would have thought when we disable the network nothing happens.

This could be a little clearer if you expected the write stream request count was 2 above and then this would show that all we did after that was close.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point. Added the requestCount==2 expectation prior to close. FWIW, disabling the network sends an additional no-op write (

). I don't know the full context of that, but I assume it's intentional (so the backend knows we got all the acks and can GC state probably).

mikelehen pushed a commit to firebase/firebase-ios-sdk that referenced this pull request Mar 12, 2018
Port of: firebase/firebase-js-sdk#559
Fixes #772

getNextMutationBatchAfterBatchId() was not respecting
highestAcknowledgedBatchId and therefore we were resending writes after the
network was disabled / re-enabled.
mikelehen pushed a commit to firebase/firebase-ios-sdk that referenced this pull request Mar 12, 2018
Port of: firebase/firebase-js-sdk#559
Fixes #772

getNextMutationBatchAfterBatchId() was not respecting
highestAcknowledgedBatchId and therefore we were resending writes after the
network was disabled / re-enabled.
mikelehen pushed a commit to firebase/firebase-ios-sdk that referenced this pull request Mar 12, 2018
Port of: firebase/firebase-js-sdk#559
Fixes #772

getNextMutationBatchAfterBatchId() was not respecting
highestAcknowledgedBatchId and therefore we were resending writes after the
network was disabled / re-enabled.
@wilhuff
Copy link
Contributor

wilhuff commented Mar 12, 2018

Changes LGTM too. Thanks for the changelog entry.

@wilhuff wilhuff assigned mikelehen and unassigned wilhuff Mar 12, 2018
@mikelehen mikelehen merged commit 786082d into master Mar 12, 2018
@mikelehen mikelehen deleted the mikelehen/enableNetwork-resendWrites branch March 12, 2018 18:30
mikelehen added a commit to firebase/firebase-ios-sdk that referenced this pull request Mar 12, 2018
…909)

Port of: firebase/firebase-js-sdk#559
Should address #772 once released.

getNextMutationBatchAfterBatchId() was not respecting
highestAcknowledgedBatchId and therefore we were resending writes after the
network was disabled / re-enabled.
minafarid pushed a commit to minafarid/firebase-ios-sdk that referenced this pull request Jun 6, 2018
…irebase#909)

Port of: firebase/firebase-js-sdk#559
Should address firebase#772 once released.

getNextMutationBatchAfterBatchId() was not respecting
highestAcknowledgedBatchId and therefore we were resending writes after the
network was disabled / re-enabled.
@firebase firebase locked and limited conversation to collaborators Oct 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants