Skip to content

Commit

Permalink
Add odsp driver support to upload container type summary (#9671)
Browse files Browse the repository at this point in the history
  • Loading branch information
jatgarg authored Mar 31, 2022
1 parent 5681a58 commit f514de2
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
13 changes: 7 additions & 6 deletions packages/drivers/odsp-driver/src/odspSummaryUploadManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,19 +69,21 @@ export class OdspSummaryUploadManager {
referenceSequenceNumber: number,
tree: api.ISummaryTree,
): Promise<IWriteSummaryResponse> {
const enableContainerTypeSummaryUpload = this.mc.config.getBoolean("Fluid.Driver.Odsp.EnableContainerTypeSummaryUpload");
const containsProtocolTree = enableContainerTypeSummaryUpload &&
Object.keys(tree.tree).includes(".protocol");
const { snapshotTree, blobs } = await this.convertSummaryToSnapshotTree(
parentHandle,
tree,
".app",
"",
);
const snapshot: IOdspSummaryPayload = {
entries: snapshotTree.entries!,
message: "app",
sequenceNumber: referenceSequenceNumber,
// no ack handle implies this is initial summary after empty file creation.
// send container payload so server will use it without a summary op
type: parentHandle === undefined ? "container" : "channel",
type: containsProtocolTree || parentHandle === undefined ? "container" : "channel",
};

return getWithRetryForTokenRefresh(async (options) => {
Expand Down Expand Up @@ -109,6 +111,8 @@ export class OdspSummaryUploadManager {
blobs,
size: postBody.length,
referenceSequenceNumber,
type: snapshot.type,
enableContainerTypeSummaryUpload,
},
async () => {
const response = await this.epochTracker.fetchAndParseAsJSON<IWriteSummaryResponse>(
Expand Down Expand Up @@ -137,7 +141,6 @@ export class OdspSummaryUploadManager {
parentHandle: string | undefined,
tree: api.ISummaryTree,
rootNodeName: string,
path: string = "",
markUnreferencedNodes: boolean = this.mc.config.getBoolean("Fluid.Driver.Odsp.MarkUnreferencedNodes") ?? true,
) {
const snapshotTree: IOdspSummaryTree = {
Expand All @@ -157,14 +160,12 @@ export class OdspSummaryUploadManager {
// property is not present, the tree entry is considered referenced. If the property is present and is
// true (which is the only value it can have), the tree entry is considered unreferenced.
let unreferenced: true | undefined;
const currentPath = path === "" ? `${rootNodeName}/${key}` : `${path}/${key}`;
switch (summaryObject.type) {
case api.SummaryType.Tree: {
const result = await this.convertSummaryToSnapshotTree(
parentHandle,
summaryObject,
rootNodeName,
currentPath);
rootNodeName);
value = result.snapshotTree;
unreferenced = markUnreferencedNodes ? summaryObject.unreferenced : undefined;
blobs += result.blobs;
Expand Down
17 changes: 17 additions & 0 deletions packages/test/test-service-load/testConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,23 @@
}
}
}
},
"odspContainerTypeSummaryUpload": {
"opRatePerMin": 60,
"progressIntervalMs": 5000,
"numClients": 4,
"totalSendCount": 150,
"readWriteCycleMs": 10000,
"optionOverrides":{
"odsp":{
"configurations":{
"Fluid.Driver.Odsp.EnableContainerTypeSummaryUpload": [true]
},
"loader":{
"summarizeProtocolTree": [true]
}
}
}
}
}
}

0 comments on commit f514de2

Please sign in to comment.