FluidFramework icon indicating copy to clipboard operation
FluidFramework copied to clipboard

[Prototype] Offline: Add batchId to batch metadata to detect forked containers

Open markfields opened this issue 1 year ago • 1 comments

Description

This is a quick and dirty prototype looking at how we can use stable batchId on each submitted batch to detect forked containers, in the case where a user allows two forks (from the serialization point) to both connect after that point. In these cases, the second container closes as soon as it sees a matching op (batch) from another client come in.

The format of the batch ID is [original client ID, original CSN]. This ID is only assigned on resubmit, since if we find a collision with the original connection/submission, we can compute that ID on the fly.

This also covers the race condition where two forks connect and submit corresponding batches in parallel. The "loser" between the two will close, and all containers processing that range where duplicate ops were submitted will realize it and no-op on the second op. This window closes when the MSN moves past the sequenceNumber of the winner - any client with a duplicate op locally that had RefSeq past that point will never submit the duplicate op.

Reviewer Guidance

Note the changes at the bottom of stashedOps.spec.ts (the "Prototype tests for Offline Phase 3 - serializing without closing" describe block), which demonstrate this is working as expected/required.

markfields avatar May 31 '24 20:05 markfields

Aww way to steal my thunder, microsoft-github-policy-service!! This prototype PR is defunct now, all the behavior has been implemented properly in main 💪

markfields avatar Sep 13 '24 20:09 markfields