fix: Incorrect commitId gets updated against commit entry when a batc… #1045
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
- What I did
In the uncommitted entries list, when preparing the Sync batch request, if there exist two entries of the same key where the initial commit entry is "update" and later is "delete", then the commit entry with "update" operation is skipped adding to the Batch Request. In this case, the size of the batch request is one less than the size of uncommitted entries.
On receiving the batch response, the uncommitted list is iterated and the commit id from the batch response is updated to its respective commit entry. Since an entry is skipped in the batch request (but the entry exists in the uncommitted entries list), the commit id gets updated to the skipped entry (here, the entry with CommitOp. update). The commit-id of the entry synced to the server will remain null (here, the entry with CommitOp.Delete will not be updated).
- How I did it
- How to verify it
Added a unit test that asserts the following:
Added a functional test that asserts the same as above.
- Description for the changelog