Skip to content

Commit

Permalink
[main > release/client/rc]: RemoteDatastoreContext should handle snap…
Browse files Browse the repository at this point in the history
…shot with groupId with older loader (#21950)

## Description

RemoteDatastoreContext should handle snapshot with groupId with older
loader. So, in case where we fetch the snapshot using old loader and
does not have ISnapshot which contains blobContents, then that means we
must have fetched the full snapshot using older format, so there is no
need to evaluate in that case whether to fetch the snapshot or not.
  • Loading branch information
jatgarg authored Jul 24, 2024
1 parent a606ae0 commit bdbf2b5
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions packages/runtime/container-runtime/src/dataStoreContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1083,6 +1083,7 @@ export class RemoteFluidDataStoreContext extends FluidDataStoreContext {
private snapshotFetchRequired: boolean | undefined;
private readonly runtime: IContainerRuntimeBase;
private readonly blobContents: Map<string, ArrayBuffer> | undefined;
private readonly isSnapshotInISnapshotFormat: boolean | undefined;

constructor(props: IRemoteFluidDataStoreContextProps) {
super(props, true /* existing */, false /* isLocalDataStore */, () => {
Expand All @@ -1093,8 +1094,10 @@ export class RemoteFluidDataStoreContext extends FluidDataStoreContext {
if (isInstanceOfISnapshot(props.snapshot)) {
this.blobContents = props.snapshot.blobContents;
this._baseSnapshot = props.snapshot.snapshotTree;
this.isSnapshotInISnapshotFormat = true;
} else {
this._baseSnapshot = props.snapshot;
this.isSnapshotInISnapshotFormat = false;
}
if (this._baseSnapshot !== undefined) {
this.summarizerNode.updateBaseSummaryState(this._baseSnapshot);
Expand All @@ -1116,8 +1119,14 @@ export class RemoteFluidDataStoreContext extends FluidDataStoreContext {
private readonly initialSnapshotDetailsP = new LazyPromise<ISnapshotDetails>(async () => {
// Sequence number of the snapshot.
let sequenceNumber: number | undefined;
// Check whether we need to fetch the snapshot first to load.
if (this.snapshotFetchRequired === undefined && this._baseSnapshot?.groupId !== undefined) {
// Check whether we need to fetch the snapshot first to load. The snapshot should be in new format to see
// whether we want to evaluate to fetch snapshot or not for loadingGroupId. Otherwise, the snapshot
// will contain all the blobs.
if (
this.snapshotFetchRequired === undefined &&
this._baseSnapshot?.groupId !== undefined &&
this.isSnapshotInISnapshotFormat
) {
assert(
this.blobContents !== undefined,
0x97a /* Blob contents should be present to evaluate */,
Expand Down

0 comments on commit bdbf2b5

Please sign in to comment.