Skip to content

[PoC] On op submission, wait to stringify until virtualization step#24281

Closed
markfields wants to merge 2 commits intomicrosoft:mainfrom
markfields:cr/wait-to-stringify
Closed

[PoC] On op submission, wait to stringify until virtualization step#24281
markfields wants to merge 2 commits intomicrosoft:mainfrom
markfields:cr/wait-to-stringify

Conversation

@markfields
Copy link
Copy Markdown
Member

@markfields markfields commented Apr 8, 2025

Reviewer Guidance

Proof of concept, will close

This will be split into 2-3 PRs:

  1. Move the large batch checks from submit to flush (this is a small loss in utility) -- [take 2] refactor(container-runtime): Stop estimating batch size when accumulating a local batch #24363
  2. Split the BatchMessage type into LocalBatchMessage and OutboundBatchMessage -- refactor(container-runtime): Separate types LocalBatchMessage v. OutboundBatchMessage in Outbox and related code #24287
  3. Update LocalBatchMessage to retain the original runtime op -- feat(container-runtime): Retain original runtime op in pending local state, as opposed to the serialized op #24364

Description

Today we stringify before putting the op into the Outbox and the PendingStateManager. This means that flows like Resubmit and Rollback don't get the original op, but rather a lossy string-roundtripped copy.

Instead, we can use the original op throughout the ContainerRuntime, and wait to stringify until virtualizing the batch of ops (grouping, compressing, chunking) on the way out of the outbox to the ordering service.

@github-actions github-actions Bot added area: runtime Runtime related issues base: main PRs targeted against main branch labels Apr 8, 2025
markfields added a commit that referenced this pull request Apr 9, 2025
…oundBatchMessage in Outbox and related code (#24287)

This is a glorified "rename", splitting the type
`BatchMessage` into two cases: `LocalBatchMessage` and
`OutboundBatchMessage`, converting between the two when necessary.

The intention is to change no behavior with this change. Here are the
non-typing changes (that affect runtime code):

* Renaming the property `contents` to `serializedOp` for the Local batch
case
* Shallow-copy the whole batch and each message in
`Outbox.virtualizeBatch` to convert from `LocalBatch` to
`OutboundBatch`.
* This is where we copy `serializedOp` over to `contents`, which paves
the way for `serializedOp` to stop being serialized in the next PR,
which is the end goal here
* Minor refactoring of `createEmptyGroupedBatch` to support both
Local/Outbound forms

### Context

As ops are accumulated into a batch in the ContainerRuntime, they're
currently serialized immediately. However, we plan to keep those
unserialized, and only stringify when virtualizing (grouping,
compressing) in preparation to send to the server. See #24281.

This is the first step there. We should model pre/post virtualized
batches differently because they are different. pre-virtualization batch
messages are called `LocalBatchMessage` and post-virtualization are
called `OutboundBatchMessage`.
@markfields
Copy link
Copy Markdown
Member Author

Final PR is here, closing this POC branch.

#24364

@markfields markfields closed this Apr 15, 2025
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.

1 participant