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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ContaineRuntime: Refactor batch processing code to support either op-by-op or batch-all-at-once semantics #22501

Merged
merged 14 commits into from
Sep 13, 2024

Conversation

markfields
Copy link
Member

@markfields markfields commented Sep 13, 2024

Description

Step one of AB#15221

No behavior change here, just refactoring to be able to express the result of RemoteMessageProcessor in terms of ops or batches.

Follow-up change to adjust the logic will be much more scoped then.

Reviewer Guidance

No behavior change. Notice that even in test files, the change is strictly refactoring, test results/asserts are unchanged.

@markfields markfields changed the title ContaineRuntime: Restore behavior of processing incoming batches op-by-op ContaineRuntime: Refactor batch processing code to support either op-by-op or batch-all-at-once semantics Sep 13, 2024
@msfluid-bot
Copy link
Collaborator

msfluid-bot commented Sep 13, 2024

@fluid-example/bundle-size-tests: +1.66 KB
Metric NameBaseline SizeCompare SizeSize Diff
aqueduct.js 459.95 KB 460.34 KB +398 Bytes
azureClient.js 557.88 KB 558.29 KB +412 Bytes
connectionState.js 680 Bytes 680 Bytes No change
containerRuntime.js 260.71 KB 261.08 KB +377 Bytes
fluidFramework.js 401.54 KB 401.55 KB +14 Bytes
loader.js 134.19 KB 134.2 KB +14 Bytes
map.js 42.43 KB 42.44 KB +7 Bytes
matrix.js 146.58 KB 146.58 KB +7 Bytes
odspClient.js 525.23 KB 525.64 KB +412 Bytes
odspDriver.js 97.8 KB 97.82 KB +21 Bytes
odspPrefetchSnapshot.js 42.76 KB 42.78 KB +14 Bytes
sharedString.js 163.3 KB 163.31 KB +7 Bytes
sharedTree.js 392 KB 392.01 KB +7 Bytes
Total Size 3.3 MB 3.3 MB +1.66 KB

Baseline commit: de91c3a

Generated by 🚫 dangerJS against 32728d4

@markfields markfields enabled auto-merge (squash) September 13, 2024 22:39
@markfields markfields merged commit e024b86 into microsoft:main Sep 13, 2024
30 checks passed
@markfields markfields deleted the o3/op-by-op branch September 13, 2024 23:18
markfields added a commit that referenced this pull request Sep 16, 2024
…g for the whole batch (#22508)

We are concerned that holding batch messages in ContainerRuntime even
while DeltaManager advances its tracked sequence numbers through the
batch could have unintended consequences. So this PR restores the old
behavior of processing each message in a batch one-by-one, rather than
holding until the whole batch arrives.

Note that there's no change in behavior here for Grouped Batches.

### How the change works

PR #21785 switched the RemoteMessageProcessor from returning ungrouped
batch ops as they arrived, to holding them and finally returning the
whole batch once the last arrived. The downstream code was also updated
to take whole batches, whereas before it would take individual messages
and use the batch metadata to detect batch start/end.

Too many other changes were made after that PR to straight revert it.
Logic was added throughout CR and PSM that looks at info about that
batch which is found on the first message in the batch. So we can
reverse the change and process one-at-a-time, but we need a way to carry
around that "batch start info" with the first message in the batch.

So we are now modeling the result that RMP yields as one of three cases:

- A full batch of messages (could be from a single-message batch or a
Grouped Batch)
- The first message of a multi-message batch
- The next message in a multi-message batch

The first two cases include the "batch start info" needed for the recent
Offline work. The third case just indicates whether it's the last
message or not.

#22501 added some of the necessary structure, introducing the type for
"batch start info" and updating the downstream code to use that instead
of reading it off the old "Inbound Batch" type. This PR now adds those
other two cases to the RMP return type and handles processing them
throughout CR and PSM.
markfields added a commit to markfields/FluidFramework that referenced this pull request Sep 26, 2024
ContaineRuntime: Refactor batch processing code to support either op-by-op or batch-all-at-once semantics (microsoft#22501)

No behavior change here, just refactoring to be able to express the
result of RemoteMessageProcessor in terms of ops or batches.

Follow-up change to adjust the logic will be much more scoped then.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: runtime Runtime related issues base: main PRs targeted against main branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants