Skip to content

Commit

Permalink
Rename Feature gate for Data Virtualization and enable tests for odsp…
Browse files Browse the repository at this point in the history
… prod (#21361)

## Description

1.) Enable E2E test for Data Virtualization for ODSP Prod.
2.) Rename feature gate for Data Virtualization, so that we can enable
the version of code which works.

---------

Co-authored-by: Jatin Garg <[email protected]>
  • Loading branch information
jatgarg and Jatin Garg authored Jun 11, 2024
1 parent 3d83ec9 commit eb5c0b0
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 38 deletions.
2 changes: 1 addition & 1 deletion packages/drivers/odsp-driver/src/prefetchLatestSnapshot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export async function prefetchLatestSnapshot(
const mc = createChildMonitoringContext({ logger, namespace: "PrefetchSnapshot" });
const odspLogger = createOdspLogger(mc.logger);
const useGroupIdsForSnapshotFetch = mc.config.getBoolean(
"Fluid.Container.UseLoadingGroupIdForSnapshotFetch",
"Fluid.Container.UseLoadingGroupIdForSnapshotFetch2",
);
// For prefetch, we just want to fetch the ungrouped data and want to use the new API if the
// feature gate is set, so provide an empty array.
Expand Down
2 changes: 1 addition & 1 deletion packages/loader/container-loader/src/container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,7 @@ export class Container

private get supportGetSnapshotApi(): boolean {
const supportGetSnapshotApi: boolean =
this.mc.config.getBoolean("Fluid.Container.UseLoadingGroupIdForSnapshotFetch") ===
this.mc.config.getBoolean("Fluid.Container.UseLoadingGroupIdForSnapshotFetch2") ===
true && this.service?.policies?.supportGetSnapshotApi === true;
return supportGetSnapshotApi;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import {

import { TestSnapshotCache } from "../../testSnapshotCache.js";

import { supportsDataVirtualization } from "./utils.js";
import { clearCacheIfOdsp, supportsDataVirtualization } from "./utils.js";

const interceptResult = <T>(
parent: any,
Expand Down Expand Up @@ -243,7 +243,7 @@ describeCompat("Create data store with group id", "NoCompat", (getTestObjectProv
undefined,
undefined,
configProvider({
"Fluid.Container.UseLoadingGroupIdForSnapshotFetch": true,
"Fluid.Container.UseLoadingGroupIdForSnapshotFetch2": true,
}),
);
await provider.ensureSynchronized();
Expand All @@ -259,15 +259,12 @@ describeCompat("Create data store with group id", "NoCompat", (getTestObjectProv
assert(dataObjectTreeB.type === SummaryType.Tree, "dataObjectTree should be a tree");
assert(dataObjectTreeB.groupId === loadingGroupId, "GroupId missing from B summary tree");

// TODO enable for prod odsp
if (provider.driver.endpointName === "odsp-df") {
persistedCache.clearCache();
}
clearCacheIfOdsp(provider, persistedCache);
const container2 = await provider.loadContainer(
runtimeFactory,
{
configProvider: configProvider({
"Fluid.Container.UseLoadingGroupIdForSnapshotFetch": true,
"Fluid.Container.UseLoadingGroupIdForSnapshotFetch2": true,
}),
},
{
Expand Down Expand Up @@ -313,7 +310,7 @@ describeCompat("Create data store with group id", "NoCompat", (getTestObjectProv
if (supportsDataVirtualization(provider)) {
const container2 = await provider.loadContainer(runtimeFactory, {
configProvider: configProvider({
"Fluid.Container.UseLoadingGroupIdForSnapshotFetch": true,
"Fluid.Container.UseLoadingGroupIdForSnapshotFetch2": true,
}),
});
await provider.ensureSynchronized();
Expand Down Expand Up @@ -365,7 +362,7 @@ describeCompat("Create data store with group id", "NoCompat", (getTestObjectProv
undefined,
undefined,
configProvider({
"Fluid.Container.UseLoadingGroupIdForSnapshotFetch": true,
"Fluid.Container.UseLoadingGroupIdForSnapshotFetch2": true,
}),
);
const { summaryVersion, summaryRefSeq } = await summarizeNow(summarizer);
Expand All @@ -388,17 +385,14 @@ describeCompat("Create data store with group id", "NoCompat", (getTestObjectProv
},
);

// TODO enable for prod odsp
if (provider.driver.endpointName === "odsp-df") {
persistedCache.clearCache();
}
clearCacheIfOdsp(provider, persistedCache);

// Load from the summary
const container2 = await provider.loadContainer(
runtimeFactory,
{
configProvider: configProvider({
"Fluid.Container.UseLoadingGroupIdForSnapshotFetch": true,
"Fluid.Container.UseLoadingGroupIdForSnapshotFetch2": true,
}),
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ describeCompat("GroupId offline", "NoCompat", (getTestObjectProvider, apis) => {
},
};
const configProvider = createTestConfigProvider();
configProvider.set("Fluid.Container.UseLoadingGroupIdForSnapshotFetch", true);
configProvider.set("Fluid.Container.UseLoadingGroupIdForSnapshotFetch2", true);
configProvider.set("Fluid.Container.enableOfflineLoad", true);

const testDataObjectType = "TestDataObject";
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/*!
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
* Licensed under the MIT License.
*/

export { supportsDataVirtualization, clearCacheIfOdsp } from "./utils.js";
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ describeCompat("Create data store with group id", "NoCompat", (getTestObjectProv
// Load basic container stuff
const container = await provider.createContainer(runtimeFactory, {
configProvider: configProvider({
"Fluid.Container.UseLoadingGroupIdForSnapshotFetch": true,
"Fluid.Container.UseLoadingGroupIdForSnapshotFetch2": true,
}),
});
const mainObject = (await container.getEntryPoint()) as TestDataObject;
Expand Down Expand Up @@ -163,7 +163,7 @@ describeCompat("Create data store with group id", "NoCompat", (getTestObjectProv
undefined,
undefined,
configProvider({
"Fluid.Container.UseLoadingGroupIdForSnapshotFetch": true,
"Fluid.Container.UseLoadingGroupIdForSnapshotFetch2": true,
}),
);
const { summaryVersion } = await summarizeNow(summarizer);
Expand All @@ -172,7 +172,7 @@ describeCompat("Create data store with group id", "NoCompat", (getTestObjectProv
runtimeFactory,
{
configProvider: configProvider({
"Fluid.Container.UseLoadingGroupIdForSnapshotFetch": true,
"Fluid.Container.UseLoadingGroupIdForSnapshotFetch2": true,
}),
},
{ [LoaderHeader.version]: summaryVersion },
Expand Down Expand Up @@ -219,7 +219,7 @@ describeCompat("Create data store with group id", "NoCompat", (getTestObjectProv
// Load basic container stuff
const container = await provider.createContainer(runtimeFactory, {
configProvider: configProvider({
"Fluid.Container.UseLoadingGroupIdForSnapshotFetch": true,
"Fluid.Container.UseLoadingGroupIdForSnapshotFetch2": true,
}),
});
const mainObject = (await container.getEntryPoint()) as TestDataObject;
Expand Down Expand Up @@ -247,7 +247,7 @@ describeCompat("Create data store with group id", "NoCompat", (getTestObjectProv
undefined,
undefined,
configProvider({
"Fluid.Container.UseLoadingGroupIdForSnapshotFetch": true,
"Fluid.Container.UseLoadingGroupIdForSnapshotFetch2": true,
}),
);
const { summaryVersion } = await summarizeNow(summarizer);
Expand All @@ -268,7 +268,7 @@ describeCompat("Create data store with group id", "NoCompat", (getTestObjectProv
runtimeFactory,
{
configProvider: configProvider({
"Fluid.Container.UseLoadingGroupIdForSnapshotFetch": true,
"Fluid.Container.UseLoadingGroupIdForSnapshotFetch2": true,
}),
},
{ [LoaderHeader.version]: summaryVersion },
Expand Down Expand Up @@ -327,7 +327,7 @@ describeCompat("Create data store with group id", "NoCompat", (getTestObjectProv
// Load basic container stuff
const container = await provider.createContainer(runtimeFactory, {
configProvider: configProvider({
"Fluid.Container.UseLoadingGroupIdForSnapshotFetch": true,
"Fluid.Container.UseLoadingGroupIdForSnapshotFetch2": true,
}),
});
const mainObject = (await container.getEntryPoint()) as TestDataObject;
Expand All @@ -353,7 +353,7 @@ describeCompat("Create data store with group id", "NoCompat", (getTestObjectProv
undefined,
undefined,
configProvider({
"Fluid.Container.UseLoadingGroupIdForSnapshotFetch": true,
"Fluid.Container.UseLoadingGroupIdForSnapshotFetch2": true,
}),
);

Expand All @@ -372,7 +372,7 @@ describeCompat("Create data store with group id", "NoCompat", (getTestObjectProv
undefined,
undefined,
configProvider({
"Fluid.Container.UseLoadingGroupIdForSnapshotFetch": true,
"Fluid.Container.UseLoadingGroupIdForSnapshotFetch2": true,
}),
);

Expand All @@ -386,7 +386,7 @@ describeCompat("Create data store with group id", "NoCompat", (getTestObjectProv
undefined,
undefined,
configProvider({
"Fluid.Container.UseLoadingGroupIdForSnapshotFetch": true,
"Fluid.Container.UseLoadingGroupIdForSnapshotFetch2": true,
}),
);
await provider.ensureSynchronized();
Expand Down Expand Up @@ -447,7 +447,7 @@ describeCompat("Create data store with group id", "NoCompat", (getTestObjectProv
// Load basic container stuff
const container = await provider.createContainer(runtimeFactory, {
configProvider: configProvider({
"Fluid.Container.UseLoadingGroupIdForSnapshotFetch": true,
"Fluid.Container.UseLoadingGroupIdForSnapshotFetch2": true,
}),
});
const mainObject = (await container.getEntryPoint()) as TestDataObject;
Expand All @@ -473,7 +473,7 @@ describeCompat("Create data store with group id", "NoCompat", (getTestObjectProv
undefined,
undefined,
configProvider({
"Fluid.Container.UseLoadingGroupIdForSnapshotFetch": true,
"Fluid.Container.UseLoadingGroupIdForSnapshotFetch2": true,
}),
);

Expand All @@ -496,7 +496,7 @@ describeCompat("Create data store with group id", "NoCompat", (getTestObjectProv
runtimeFactory,
{
configProvider: configProvider({
"Fluid.Container.UseLoadingGroupIdForSnapshotFetch": true,
"Fluid.Container.UseLoadingGroupIdForSnapshotFetch2": true,
}),
},
{ [LoaderHeader.version]: summaryVersion2 },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@ import type { ITestObjectProvider } from "@fluidframework/test-utils/internal";
import type { TestSnapshotCache } from "../../testSnapshotCache.js";

export function supportsDataVirtualization(provider: ITestObjectProvider) {
return provider.driver.type === "local" || provider.driver.endpointName === "odsp-df";
return provider.driver.type === "local" || provider.driver.type === "odsp";
}

// TODO: enable for Odsp Prod endpoint
export function clearCacheIfOdsp(provider: ITestObjectProvider, persistedCache: TestSnapshotCache) {
if (provider.driver.endpointName === "odsp-df") {
if (provider.driver.type === "odsp") {
persistedCache.clearCache();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ import {
waitForContainerConnection,
} from "@fluidframework/test-utils/internal";

import { TestSnapshotCache } from "../../testSnapshotCache.js";
import { supportsDataVirtualization, clearCacheIfOdsp } from "../data-virtualization/index.js";

import { getGCStateFromSummary } from "./gcTestSummaryUtils.js";

const interceptResult = <T>(
Expand All @@ -48,7 +51,7 @@ const configProvider = (settings: Record<string, ConfigTypes>): IConfigProviderB
*/
describeCompat("GC & Data Virtualization", "NoCompat", (getTestObjectProvider) => {
const configProviderObject = configProvider({
"Fluid.Container.UseLoadingGroupIdForSnapshotFetch": true,
"Fluid.Container.UseLoadingGroupIdForSnapshotFetch2": true,
});
const testContainerConfig: ITestContainerConfig = {
runtimeOptions: {
Expand All @@ -64,6 +67,7 @@ describeCompat("GC & Data Virtualization", "NoCompat", (getTestObjectProvider) =
};

let provider: ITestObjectProvider;
const persistedCache = new TestSnapshotCache();

const loadSummarizer = async (container: IContainer, summaryVersion?: string) => {
return createSummarizer(
Expand All @@ -90,15 +94,17 @@ describeCompat("GC & Data Virtualization", "NoCompat", (getTestObjectProvider) =
}

beforeEach("setup", async function () {
provider = getTestObjectProvider({ syncSummarizer: true });
provider = getTestObjectProvider({ syncSummarizer: true, persistedCache });

// Data virtualization only works with local
// TODO: enable for ODSP, AB#7508
if (provider.driver.type !== "local") {
if (!supportsDataVirtualization(provider)) {
this.skip();
}
});

afterEach(async () => {
persistedCache.reset();
});

it("Virtualized datastore has same gc state even when not downloaded", async () => {
// Intercept snapshot call so we can get call count and the snapshot
let snapshotCaptured: ISnapshot | undefined;
Expand Down Expand Up @@ -151,6 +157,7 @@ describeCompat("GC & Data Virtualization", "NoCompat", (getTestObjectProvider) =
// Summarize and verify datastore A is unreferenced
await provider.ensureSynchronized();
callCount = 0;
clearCacheIfOdsp(provider, persistedCache);
const { summaryTree, summaryVersion } = await summarizeNow(summarizer);

// Validate GC state datastoreA should be unreferenced
Expand All @@ -168,6 +175,7 @@ describeCompat("GC & Data Virtualization", "NoCompat", (getTestObjectProvider) =
);

// Load new container
clearCacheIfOdsp(provider, persistedCache);
const mainContainer2 = await provider.loadTestContainer(testContainerConfig, {
[LoaderHeader.version]: summaryVersion,
});
Expand Down

0 comments on commit eb5c0b0

Please sign in to comment.