-
Notifications
You must be signed in to change notification settings - Fork 532
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[main > release/client/2.0]: Extract serialized blobs from the ISnaps…
…hot instead of fetching from driver which could make network calls #21908 (#21924) ## Description Extract serialized blobs from the ISnapshot which contains blob contents instead of fetching from driver which could make network calls. This affects the cases in Data virtualization where initial blob contents for some trees are missing in the snapshot and therefore driver does not have the contents cached, so it ends up making a bunch of network calls. --------- Co-authored-by: tyler-cai-microsoft <[email protected]> Co-authored-by: Jatin Garg <[email protected]>
- Loading branch information
1 parent
7802e98
commit efab53e
Showing
3 changed files
with
115 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
97 changes: 97 additions & 0 deletions
97
packages/test/test-end-to-end-tests/src/test/data-virtualization/groupIdBlobReads.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
/*! | ||
* Copyright (c) Microsoft Corporation and contributors. All rights reserved. | ||
* Licensed under the MIT License. | ||
*/ | ||
|
||
import { | ||
describeCompat, | ||
TestDataObjectType, | ||
type ITestDataObject, | ||
} from "@fluid-private/test-version-utils"; | ||
import { type IContainerRuntimeOptions } from "@fluidframework/container-runtime/internal"; | ||
import type { IContainerRuntimeBase } from "@fluidframework/runtime-definitions/internal"; | ||
import { MockLogger } from "@fluidframework/telemetry-utils/internal"; | ||
import { | ||
type ITestObjectProvider, | ||
createSummarizer, | ||
createTestConfigProvider, | ||
summarizeNow, | ||
} from "@fluidframework/test-utils/internal"; | ||
|
||
import { TestSnapshotCache } from "../../testSnapshotCache.js"; | ||
|
||
describeCompat("Odsp Network calls", "NoCompat", (getTestObjectProvider) => { | ||
// Allow us to control summaries | ||
const runtimeOptions: IContainerRuntimeOptions = { | ||
summaryOptions: { | ||
summaryConfigOverrides: { | ||
state: "disabled", | ||
}, | ||
}, | ||
}; | ||
const configProvider = createTestConfigProvider({ | ||
"Fluid.Container.UseLoadingGroupIdForSnapshotFetch2": true, | ||
"Fluid.Container.enableOfflineLoad": true, | ||
}); | ||
|
||
let provider: ITestObjectProvider; | ||
const testSnapshotCache = new TestSnapshotCache(); | ||
|
||
beforeEach("setup", async function () { | ||
provider = getTestObjectProvider({ persistedCache: testSnapshotCache }); | ||
if (provider.driver.type !== "odsp") { | ||
this.skip(); | ||
} | ||
}); | ||
|
||
const loadingGroupId = "loadingGroupId"; | ||
const createDataObjectsWithGroupIds = async ( | ||
mainObject: ITestDataObject, | ||
containerRuntime: IContainerRuntimeBase, | ||
) => { | ||
const dataStoreA = await containerRuntime.createDataStore( | ||
TestDataObjectType, | ||
loadingGroupId, | ||
); | ||
const dataStoreB = await containerRuntime.createDataStore( | ||
TestDataObjectType, | ||
loadingGroupId, | ||
); | ||
|
||
mainObject._root.set("dataObjectA", dataStoreA.entryPoint); | ||
mainObject._root.set("dataObjectB", dataStoreB.entryPoint); | ||
}; | ||
|
||
it("Should not make odsp network calls", async () => { | ||
const container = await provider.makeTestContainer({ | ||
runtimeOptions, | ||
loaderProps: { configProvider }, | ||
}); | ||
const mainObject = (await container.getEntryPoint()) as ITestDataObject; | ||
const containerRuntime = mainObject._context.containerRuntime; | ||
|
||
// Testing all apis for creating a data store with a loadingGroupId | ||
await createDataObjectsWithGroupIds(mainObject, containerRuntime); | ||
const { summarizer } = await createSummarizer(provider, container, { | ||
loaderProps: { configProvider }, | ||
}); | ||
await provider.ensureSynchronized(); | ||
await summarizeNow(summarizer); | ||
|
||
testSnapshotCache.clearCache(); | ||
const logger = new MockLogger(); | ||
await provider.loadTestContainer({ | ||
loaderProps: { configProvider, logger }, | ||
}); | ||
if (provider.driver.type === "odsp") { | ||
logger.assertMatchNone( | ||
[ | ||
{ | ||
eventName: "fluid:telemetry:OdspDriver:readDataBlob_end", | ||
}, | ||
], | ||
"Should not have any odps network calls", | ||
); | ||
} | ||
}); | ||
}); |