Skip to content

Conversation

anthony-murphy
Copy link
Contributor

@anthony-murphy anthony-murphy commented Oct 6, 2025

The PR enables calling getPendingLocalState by default, and ensures the overhead of capturing the pending state is minimized and/or deferred to the getPendingLocalState call itself. The primary means by which we reduce the overhead is my switching the in-memory representation of the snapshot from SnapshotWithBlobs to ISnapshot.

ISnapshot has a number of advantages as an in-memory format, primarily it matches the native format returned by modern drivers, and includes both the snapshot tree, as well as the snapshot blobs as ArrayBuffers. Since this format matches the driver's format, which eventually gets passed down into the runtime, we ensure we are not storing a duplicate copy, which could have significant memory overhead for large documents. SnapshotWithBlobs on the other had stores blobs as strings, which is great for serialization, but is redundant with the ArrayBuffers the rest of fluid operates over. In getPendingLocalState we still need to convert to SnapshotWithBlobs as the result is the serializable, but this is deferred until it is needed.

For compatibly with older drivers, we still maintain support for driver that do not return ISnapshot, but now we defer blob retrieval until getPendingLocalState is called. This ensures the load path doesn't need to retrieve any additional data than what is required by the load flow.

Outside of the container-loader package, all updates are just to test to remove the old config, as it is no longer necessary to explicitly enable the feature.

@github-actions github-actions bot added area: dds Issues related to distributed data structures area: dds: tree area: loader Loader related issues area: runtime Runtime related issues area: tests Tests to add, test infrastructure improvements, etc base: main PRs targeted against main branch labels Oct 6, 2025
@github-actions github-actions bot removed the area: runtime Runtime related issues label Oct 7, 2025
@anthony-murphy anthony-murphy changed the title Offline unify on isnapshot Container: Enable getPendingLocalState by default Oct 8, 2025
@anthony-murphy anthony-murphy marked this pull request as ready for review October 8, 2025 22:51
@anthony-murphy anthony-murphy requested a review from a team as a code owner October 8, 2025 22:51
@Copilot Copilot AI review requested due to automatic review settings October 8, 2025 22:51
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enables the getPendingLocalState functionality by default for containers, while optimizing the memory overhead by switching the in-memory snapshot representation from SnapshotWithBlobs to ISnapshot. The change eliminates the need for the "Fluid.Container.enableOfflineLoad" configuration flag across test files.

Key changes:

  • Default enables offline load capability (enableOfflineLoad !== false instead of explicit opt-in)
  • Optimizes snapshot memory usage by using ISnapshot format internally and deferring conversion to SnapshotWithBlobs until needed
  • Removes test configuration dependencies on the now-unnecessary feature flag

Reviewed Changes

Copilot reviewed 24 out of 24 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/loader/container-loader/src/serializedStateManager.ts Core implementation changes for snapshot handling and default offline load enabling
packages/loader/container-loader/src/container.ts Updates container initialization to enable offline load by default
packages/loader/container-loader/src/utils.ts Updates utility functions for snapshot conversion
packages/loader/container-loader/src/containerStorageAdapter.ts Updates type references and snapshot conversion calls
Multiple test files Removes "Fluid.Container.enableOfflineLoad": true configuration from test setups

@anthony-murphy anthony-murphy enabled auto-merge (squash) October 9, 2025 18:25
@anthony-murphy anthony-murphy merged commit 6d27e86 into microsoft:main Oct 9, 2025
33 checks passed
@anthony-murphy anthony-murphy deleted the offline-unify-on-isnapshot branch October 9, 2025 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: dds: tree area: dds Issues related to distributed data structures area: loader Loader related issues area: tests Tests to add, test infrastructure improvements, etc base: main PRs targeted against main branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants