@fluidframework/container-runtime 2.0.0-internal.2.4.0 → 2.0.0-internal.2.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,5 +5,5 @@
5
5
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
6
6
  */
7
7
  export const pkgName = "@fluidframework/container-runtime";
8
- export const pkgVersion = "2.0.0-internal.2.4.0";
8
+ export const pkgVersion = "2.0.0-internal.2.4.1";
9
9
  //# sourceMappingURL=packageVersion.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,mCAAmC,CAAC;AAC3D,MAAM,CAAC,MAAM,UAAU,GAAG,sBAAsB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/container-runtime\";\nexport const pkgVersion = \"2.0.0-internal.2.4.0\";\n"]}
1
+ {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,mCAAmC,CAAC;AAC3D,MAAM,CAAC,MAAM,UAAU,GAAG,sBAAsB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/container-runtime\";\nexport const pkgVersion = \"2.0.0-internal.2.4.1\";\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/container-runtime",
3
- "version": "2.0.0-internal.2.4.0",
3
+ "version": "2.0.0-internal.2.4.1",
4
4
  "description": "Fluid container runtime",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -65,19 +65,19 @@
65
65
  "dependencies": {
66
66
  "@fluidframework/common-definitions": "^0.20.1",
67
67
  "@fluidframework/common-utils": "^1.0.0",
68
- "@fluidframework/container-definitions": ">=2.0.0-internal.2.4.0 <2.0.0-internal.3.0.0",
69
- "@fluidframework/container-runtime-definitions": ">=2.0.0-internal.2.4.0 <2.0.0-internal.3.0.0",
70
- "@fluidframework/container-utils": ">=2.0.0-internal.2.4.0 <2.0.0-internal.3.0.0",
71
- "@fluidframework/core-interfaces": ">=2.0.0-internal.2.4.0 <2.0.0-internal.3.0.0",
72
- "@fluidframework/datastore": ">=2.0.0-internal.2.4.0 <2.0.0-internal.3.0.0",
73
- "@fluidframework/driver-definitions": ">=2.0.0-internal.2.4.0 <2.0.0-internal.3.0.0",
74
- "@fluidframework/driver-utils": ">=2.0.0-internal.2.4.0 <2.0.0-internal.3.0.0",
75
- "@fluidframework/garbage-collector": ">=2.0.0-internal.2.4.0 <2.0.0-internal.3.0.0",
68
+ "@fluidframework/container-definitions": ">=2.0.0-internal.2.4.1 <2.0.0-internal.3.0.0",
69
+ "@fluidframework/container-runtime-definitions": ">=2.0.0-internal.2.4.1 <2.0.0-internal.3.0.0",
70
+ "@fluidframework/container-utils": ">=2.0.0-internal.2.4.1 <2.0.0-internal.3.0.0",
71
+ "@fluidframework/core-interfaces": ">=2.0.0-internal.2.4.1 <2.0.0-internal.3.0.0",
72
+ "@fluidframework/datastore": ">=2.0.0-internal.2.4.1 <2.0.0-internal.3.0.0",
73
+ "@fluidframework/driver-definitions": ">=2.0.0-internal.2.4.1 <2.0.0-internal.3.0.0",
74
+ "@fluidframework/driver-utils": ">=2.0.0-internal.2.4.1 <2.0.0-internal.3.0.0",
75
+ "@fluidframework/garbage-collector": ">=2.0.0-internal.2.4.1 <2.0.0-internal.3.0.0",
76
76
  "@fluidframework/protocol-base": "^0.1038.2000",
77
77
  "@fluidframework/protocol-definitions": "^1.1.0",
78
- "@fluidframework/runtime-definitions": ">=2.0.0-internal.2.4.0 <2.0.0-internal.3.0.0",
79
- "@fluidframework/runtime-utils": ">=2.0.0-internal.2.4.0 <2.0.0-internal.3.0.0",
80
- "@fluidframework/telemetry-utils": ">=2.0.0-internal.2.4.0 <2.0.0-internal.3.0.0",
78
+ "@fluidframework/runtime-definitions": ">=2.0.0-internal.2.4.1 <2.0.0-internal.3.0.0",
79
+ "@fluidframework/runtime-utils": ">=2.0.0-internal.2.4.1 <2.0.0-internal.3.0.0",
80
+ "@fluidframework/telemetry-utils": ">=2.0.0-internal.2.4.1 <2.0.0-internal.3.0.0",
81
81
  "double-ended-queue": "^2.1.0-0",
82
82
  "events": "^3.1.0",
83
83
  "lz4js": "^0.2.0",
@@ -87,10 +87,10 @@
87
87
  "@fluid-tools/build-cli": "^0.8.0",
88
88
  "@fluidframework/build-common": "^1.1.0",
89
89
  "@fluidframework/build-tools": "^0.8.0",
90
- "@fluidframework/container-runtime-previous": "npm:@fluidframework/container-runtime@2.0.0-internal.2.2.0",
90
+ "@fluidframework/container-runtime-previous": "npm:@fluidframework/container-runtime@2.0.0-internal.2.4.0",
91
91
  "@fluidframework/eslint-config-fluid": "^2.0.0",
92
- "@fluidframework/mocha-test-setup": ">=2.0.0-internal.2.4.0 <2.0.0-internal.3.0.0",
93
- "@fluidframework/test-runtime-utils": ">=2.0.0-internal.2.4.0 <2.0.0-internal.3.0.0",
92
+ "@fluidframework/mocha-test-setup": ">=2.0.0-internal.2.4.1 <2.0.0-internal.3.0.0",
93
+ "@fluidframework/test-runtime-utils": ">=2.0.0-internal.2.4.1 <2.0.0-internal.3.0.0",
94
94
  "@microsoft/api-extractor": "^7.22.2",
95
95
  "@rushstack/eslint-config": "^2.5.1",
96
96
  "@types/double-ended-queue": "^2.1.0",
@@ -109,25 +109,9 @@
109
109
  "typescript": "~4.5.5"
110
110
  },
111
111
  "typeValidation": {
112
- "version": "2.0.0-internal.2.3.0",
113
- "baselineRange": ">=2.0.0-internal.2.2.0 <2.0.0-internal.2.3.0",
114
- "baselineVersion": "2.0.0-internal.2.2.0",
115
- "broken": {
116
- "RemovedVariableDeclaration_gcBlobPrefix": {
117
- "forwardCompat": false,
118
- "backCompat": false
119
- },
120
- "RemovedVariableDeclaration_gcTombstoneBlobKey": {
121
- "forwardCompat": false,
122
- "backCompat": false
123
- },
124
- "RemovedVariableDeclaration_gcTreeKey": {
125
- "forwardCompat": false,
126
- "backCompat": false
127
- },
128
- "ClassDeclaration_ContainerRuntime": {
129
- "forwardCompat": false
130
- }
131
- }
112
+ "version": "2.0.0-internal.2.4.0",
113
+ "previousVersionStyle": "previousPatch",
114
+ "baselineRange": "2.0.0-internal.2.4.0",
115
+ "broken": {}
132
116
  }
133
117
  }
@@ -94,6 +94,7 @@ import {
94
94
  addSummarizeResultToSummary,
95
95
  addTreeToSummary,
96
96
  createRootSummarizerNodeWithGC,
97
+ IFetchSnapshotResult,
97
98
  IRootSummarizerNodeWithGC,
98
99
  RequestParser,
99
100
  create404Response,
@@ -103,6 +104,7 @@ import {
103
104
  seqFromTree,
104
105
  calculateStats,
105
106
  TelemetryContext,
107
+ ReadAndParseBlob,
106
108
  } from "@fluidframework/runtime-utils";
107
109
  import { GCDataBuilder, trimLeadingAndTrailingSlashes } from "@fluidframework/garbage-collector";
108
110
  import { v4 as uuid } from "uuid";
@@ -2802,18 +2804,17 @@ export class ContainerRuntime extends TypedEventEmitter<IContainerRuntimeEvents>
2802
2804
  // The call to fetch the snapshot is very expensive and not always needed.
2803
2805
  // It should only be done by the summarizerNode, if required.
2804
2806
  // When fetching from storage we will always get the latest version and do not use the ackHandle.
2805
- const snapshotTreeFetcher = async () => {
2807
+ const fetchLatestSnapshot: () => Promise<IFetchSnapshotResult> = async () => {
2806
2808
  const fetchResult = await this.fetchLatestSnapshotFromStorage(
2807
2809
  summaryLogger,
2808
2810
  {
2809
- eventName: "RefreshLatestSummaryGetSnapshot",
2811
+ eventName: "RefreshLatestSummaryAckFetch",
2810
2812
  ackHandle,
2811
- summaryRefSeq,
2812
- fetchLatest: true,
2813
+ targetSequenceNumber: summaryRefSeq,
2813
2814
  },
2815
+ readAndParseBlob,
2814
2816
  );
2815
2817
 
2816
- const latestSnapshotRefSeq = await seqFromTree(fetchResult.snapshotTree, readAndParseBlob);
2817
2818
  /**
2818
2819
  * If the fetched snapshot is older than the one for which the ack was received, close the container.
2819
2820
  * This should never happen because an ack should be sent after the latest summary is updated in the server.
@@ -2824,7 +2825,7 @@ export class ContainerRuntime extends TypedEventEmitter<IContainerRuntimeEvents>
2824
2825
  * such cases, the file will be rolled back along with the ack and we will eventually reach a consistent
2825
2826
  * state.
2826
2827
  */
2827
- if (latestSnapshotRefSeq < summaryRefSeq) {
2828
+ if (fetchResult.latestSnapshotRefSeq < summaryRefSeq) {
2828
2829
  const error = DataProcessingError.create(
2829
2830
  "Fetched snapshot is older than the received ack",
2830
2831
  "RefreshLatestSummaryAck",
@@ -2832,44 +2833,36 @@ export class ContainerRuntime extends TypedEventEmitter<IContainerRuntimeEvents>
2832
2833
  {
2833
2834
  ackHandle,
2834
2835
  summaryRefSeq,
2835
- latestSnapshotRefSeq,
2836
+ latestSnapshotRefSeq: fetchResult.latestSnapshotRefSeq,
2836
2837
  },
2837
2838
  );
2838
2839
  this.closeFn(error);
2839
2840
  throw error;
2840
2841
  }
2841
2842
 
2842
- summaryLogger.sendTelemetryEvent(
2843
- {
2844
- eventName: "LatestSummaryRetrieved",
2845
- ackHandle,
2846
- lastSequenceNumber: latestSnapshotRefSeq,
2847
- targetSequenceNumber: summaryRefSeq,
2848
- });
2849
-
2850
2843
  // In case we had to retrieve the latest snapshot and it is different than summaryRefSeq,
2851
2844
  // wait for the delta manager to catch up before refreshing the latest Summary.
2852
- await this.waitForDeltaManagerToCatchup(latestSnapshotRefSeq,
2853
- summaryLogger);
2845
+ await this.waitForDeltaManagerToCatchup(
2846
+ fetchResult.latestSnapshotRefSeq,
2847
+ summaryLogger,
2848
+ );
2854
2849
 
2855
- return fetchResult.snapshotTree;
2850
+ return {
2851
+ snapshotTree: fetchResult.snapshotTree,
2852
+ snapshotRefSeq: fetchResult.latestSnapshotRefSeq,
2853
+ };
2856
2854
  };
2857
2855
 
2858
2856
  const result = await this.summarizerNode.refreshLatestSummary(
2859
2857
  proposalHandle,
2860
2858
  summaryRefSeq,
2861
- snapshotTreeFetcher,
2859
+ fetchLatestSnapshot,
2862
2860
  readAndParseBlob,
2863
2861
  summaryLogger,
2864
2862
  );
2865
2863
 
2866
2864
  // Notify the garbage collector so it can update its latest summary state.
2867
- await this.garbageCollector.refreshLatestSummary(
2868
- result,
2869
- proposalHandle,
2870
- summaryRefSeq,
2871
- readAndParseBlob,
2872
- );
2865
+ await this.garbageCollector.refreshLatestSummary(proposalHandle, result, readAndParseBlob);
2873
2866
  }
2874
2867
 
2875
2868
  /**
@@ -2881,30 +2874,31 @@ export class ContainerRuntime extends TypedEventEmitter<IContainerRuntimeEvents>
2881
2874
  private async refreshLatestSummaryAckFromServer(
2882
2875
  summaryLogger: ITelemetryLogger,
2883
2876
  ): Promise<{ latestSnapshotRefSeq: number; latestSnapshotVersionId: string | undefined; }> {
2884
- const { snapshotTree, versionId } = await this.fetchLatestSnapshotFromStorage(
2885
- summaryLogger,
2886
- {
2887
- eventName: "RefreshLatestSummaryGetSnapshot",
2888
- fetchLatest: true,
2889
- },
2890
- );
2891
-
2892
2877
  const readAndParseBlob = async <T>(id: string) => readAndParse<T>(this.storage, id);
2893
- const latestSnapshotRefSeq = await seqFromTree(snapshotTree, readAndParseBlob);
2894
-
2878
+ const { snapshotTree, versionId, latestSnapshotRefSeq } =
2879
+ await this.fetchLatestSnapshotFromStorage(
2880
+ summaryLogger,
2881
+ {
2882
+ eventName: "RefreshLatestSummaryFromServerFetch",
2883
+ },
2884
+ readAndParseBlob,
2885
+ );
2886
+ const fetchLatestSnapshot: IFetchSnapshotResult = {
2887
+ snapshotTree,
2888
+ snapshotRefSeq: latestSnapshotRefSeq,
2889
+ };
2895
2890
  const result = await this.summarizerNode.refreshLatestSummary(
2896
- undefined,
2891
+ undefined /* proposalHandle */,
2897
2892
  latestSnapshotRefSeq,
2898
- async () => snapshotTree,
2893
+ async () => fetchLatestSnapshot,
2899
2894
  readAndParseBlob,
2900
2895
  summaryLogger,
2901
2896
  );
2902
2897
 
2903
2898
  // Notify the garbage collector so it can update its latest summary state.
2904
2899
  await this.garbageCollector.refreshLatestSummary(
2900
+ undefined /* proposalHandle */,
2905
2901
  result,
2906
- undefined,
2907
- latestSnapshotRefSeq,
2908
2902
  readAndParseBlob,
2909
2903
  )
2910
2904
 
@@ -2914,29 +2908,54 @@ export class ContainerRuntime extends TypedEventEmitter<IContainerRuntimeEvents>
2914
2908
  private async fetchLatestSnapshotFromStorage(
2915
2909
  logger: ITelemetryLogger,
2916
2910
  event: ITelemetryGenericEvent,
2917
- ): Promise<{ snapshotTree: ISnapshotTree; versionId: string; }> {
2911
+ readAndParseBlob: ReadAndParseBlob,
2912
+ ): Promise<{ snapshotTree: ISnapshotTree; versionId: string; latestSnapshotRefSeq: number }> {
2918
2913
  return PerformanceEvent.timedExecAsync(
2919
- logger, event, async (perfEvent: {
2914
+ logger,
2915
+ event,
2916
+ async (perfEvent: {
2920
2917
  end: (arg0: {
2921
2918
  getVersionDuration?: number | undefined;
2922
2919
  getSnapshotDuration?: number | undefined;
2920
+ snapshotRefSeq?: number | undefined;
2921
+ snapshotVersion?: string | undefined;
2923
2922
  }) => void;
2924
2923
  }) => {
2925
- const stats: { getVersionDuration?: number; getSnapshotDuration?: number; } = {};
2924
+ const stats: {
2925
+ getVersionDuration?: number;
2926
+ getSnapshotDuration?: number;
2927
+ snapshotRefSeq?: number;
2928
+ snapshotVersion?: string;
2929
+ } = {};
2926
2930
  const trace = Trace.start();
2927
2931
 
2928
2932
  const versions = await this.storage.getVersions(
2929
- null, 1, "refreshLatestSummaryAckFromServer", FetchSource.noCache);
2930
- assert(!!versions && !!versions[0], 0x137 /* "Failed to get version from storage" */);
2933
+ null,
2934
+ 1,
2935
+ "refreshLatestSummaryAckFromServer",
2936
+ FetchSource.noCache,
2937
+ );
2938
+ assert(
2939
+ !!versions && !!versions[0],
2940
+ 0x137 /* "Failed to get version from storage" */,
2941
+ );
2931
2942
  stats.getVersionDuration = trace.trace().duration;
2932
2943
 
2933
2944
  const maybeSnapshot = await this.storage.getSnapshotTree(versions[0]);
2934
2945
  assert(!!maybeSnapshot, 0x138 /* "Failed to get snapshot from storage" */);
2935
2946
  stats.getSnapshotDuration = trace.trace().duration;
2947
+ const latestSnapshotRefSeq = await seqFromTree(maybeSnapshot, readAndParseBlob);
2948
+ stats.snapshotRefSeq = latestSnapshotRefSeq;
2949
+ stats.snapshotVersion = versions[0].id;
2936
2950
 
2937
2951
  perfEvent.end(stats);
2938
- return { snapshotTree: maybeSnapshot, versionId: versions[0].id };
2939
- });
2952
+ return {
2953
+ snapshotTree: maybeSnapshot,
2954
+ versionId: versions[0].id,
2955
+ latestSnapshotRefSeq,
2956
+ };
2957
+ },
2958
+ );
2940
2959
  }
2941
2960
 
2942
2961
  public notifyAttaching(snapshot: ISnapshotTreeWithBlobContents) {
@@ -158,9 +158,8 @@ export interface IGarbageCollector {
158
158
  getBaseGCDetails(): Promise<IGarbageCollectionDetailsBase>;
159
159
  /** Called when the latest summary of the system has been refreshed. */
160
160
  refreshLatestSummary(
161
- result: RefreshSummaryResult,
162
161
  proposalHandle: string | undefined,
163
- summaryRefSeq: number,
162
+ result: RefreshSummaryResult,
164
163
  readAndParseBlob: ReadAndParseBlob,
165
164
  ): Promise<void>;
166
165
  /** Called when a node is updated. Used to detect and log when an inactive node is changed or loaded. */
@@ -1179,9 +1178,8 @@ export class GarbageCollector implements IGarbageCollector {
1179
1178
  * is downloaded and should be used to update the state.
1180
1179
  */
1181
1180
  public async refreshLatestSummary(
1182
- result: RefreshSummaryResult,
1183
1181
  proposalHandle: string | undefined,
1184
- summaryRefSeq: number,
1182
+ result: RefreshSummaryResult,
1185
1183
  readAndParseBlob: ReadAndParseBlob,
1186
1184
  ): Promise<void> {
1187
1185
  // If the latest summary was updated and the summary was tracked, this client is the one that generated this
@@ -1208,8 +1206,8 @@ export class GarbageCollector implements IGarbageCollector {
1208
1206
  }
1209
1207
 
1210
1208
  // If the summary was not tracked by this client, the state should be updated from the downloaded snapshot.
1211
- const snapshot = result.snapshot;
1212
- const metadataBlobId = snapshot.blobs[metadataBlobName];
1209
+ const snapshotTree = result.snapshotTree;
1210
+ const metadataBlobId = snapshotTree.blobs[metadataBlobName];
1213
1211
  if (metadataBlobId) {
1214
1212
  const metadata = await readAndParseBlob<IContainerRuntimeMetadata>(metadataBlobId);
1215
1213
  this.latestSummaryGCVersion = getGCVersion(metadata);
@@ -1223,10 +1221,10 @@ export class GarbageCollector implements IGarbageCollector {
1223
1221
  "No reference timestamp when updating GC state from snapshot",
1224
1222
  "refreshLatestSummary",
1225
1223
  undefined,
1226
- { proposalHandle, summaryRefSeq, details: JSON.stringify(this.configs) },
1224
+ { proposalHandle, summaryRefSeq: result.summaryRefSeq, details: JSON.stringify(this.configs) },
1227
1225
  );
1228
1226
  }
1229
- const gcSnapshotTree = snapshot.trees[gcTreeKey];
1227
+ const gcSnapshotTree = snapshotTree.trees[gcTreeKey];
1230
1228
  // If GC ran in the container that generated this snapshot, it will have a GC tree.
1231
1229
  this.wasGCRunInLatestSummary = gcSnapshotTree !== undefined;
1232
1230
  let latestGCData: IGarbageCollectionSnapshotData | undefined;
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/container-runtime";
9
- export const pkgVersion = "2.0.0-internal.2.4.0";
9
+ export const pkgVersion = "2.0.0-internal.2.4.1";