@fluidframework/container-runtime 0.59.4001 → 1.1.0-75972

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.
Files changed (157) hide show
  1. package/.eslintrc.js +1 -1
  2. package/dist/blobManager.d.ts +2 -2
  3. package/dist/blobManager.d.ts.map +1 -1
  4. package/dist/blobManager.js +12 -11
  5. package/dist/blobManager.js.map +1 -1
  6. package/dist/connectionTelemetry.d.ts +19 -0
  7. package/dist/connectionTelemetry.d.ts.map +1 -1
  8. package/dist/connectionTelemetry.js +23 -23
  9. package/dist/connectionTelemetry.js.map +1 -1
  10. package/dist/containerRuntime.d.ts +137 -29
  11. package/dist/containerRuntime.d.ts.map +1 -1
  12. package/dist/containerRuntime.js +338 -118
  13. package/dist/containerRuntime.js.map +1 -1
  14. package/dist/dataStore.d.ts.map +1 -1
  15. package/dist/dataStore.js +14 -3
  16. package/dist/dataStore.js.map +1 -1
  17. package/dist/dataStoreContext.d.ts +4 -2
  18. package/dist/dataStoreContext.d.ts.map +1 -1
  19. package/dist/dataStoreContext.js +16 -5
  20. package/dist/dataStoreContext.js.map +1 -1
  21. package/dist/dataStoreRegistry.d.ts +0 -4
  22. package/dist/dataStoreRegistry.d.ts.map +1 -1
  23. package/dist/dataStoreRegistry.js +12 -1
  24. package/dist/dataStoreRegistry.js.map +1 -1
  25. package/dist/dataStores.d.ts +4 -3
  26. package/dist/dataStores.d.ts.map +1 -1
  27. package/dist/dataStores.js +13 -7
  28. package/dist/dataStores.js.map +1 -1
  29. package/dist/garbageCollection.d.ts +23 -27
  30. package/dist/garbageCollection.d.ts.map +1 -1
  31. package/dist/garbageCollection.js +44 -119
  32. package/dist/garbageCollection.js.map +1 -1
  33. package/dist/index.d.ts +2 -2
  34. package/dist/index.d.ts.map +1 -1
  35. package/dist/index.js +2 -1
  36. package/dist/index.js.map +1 -1
  37. package/dist/orderedClientElection.js +0 -4
  38. package/dist/orderedClientElection.js.map +1 -1
  39. package/dist/packageVersion.d.ts +1 -1
  40. package/dist/packageVersion.d.ts.map +1 -1
  41. package/dist/packageVersion.js +1 -1
  42. package/dist/packageVersion.js.map +1 -1
  43. package/dist/pendingStateManager.d.ts +30 -29
  44. package/dist/pendingStateManager.d.ts.map +1 -1
  45. package/dist/pendingStateManager.js +72 -109
  46. package/dist/pendingStateManager.js.map +1 -1
  47. package/dist/runningSummarizer.d.ts +4 -3
  48. package/dist/runningSummarizer.d.ts.map +1 -1
  49. package/dist/runningSummarizer.js +11 -6
  50. package/dist/runningSummarizer.js.map +1 -1
  51. package/dist/serializedSnapshotStorage.d.ts +58 -0
  52. package/dist/serializedSnapshotStorage.d.ts.map +1 -0
  53. package/dist/serializedSnapshotStorage.js +108 -0
  54. package/dist/serializedSnapshotStorage.js.map +1 -0
  55. package/dist/summarizer.d.ts +11 -4
  56. package/dist/summarizer.d.ts.map +1 -1
  57. package/dist/summarizer.js +18 -9
  58. package/dist/summarizer.js.map +1 -1
  59. package/dist/summarizerHeuristics.d.ts +5 -3
  60. package/dist/summarizerHeuristics.d.ts.map +1 -1
  61. package/dist/summarizerHeuristics.js +10 -3
  62. package/dist/summarizerHeuristics.js.map +1 -1
  63. package/dist/summarizerTypes.d.ts +4 -2
  64. package/dist/summarizerTypes.d.ts.map +1 -1
  65. package/dist/summarizerTypes.js.map +1 -1
  66. package/dist/summaryManager.d.ts +3 -3
  67. package/dist/summaryManager.d.ts.map +1 -1
  68. package/dist/summaryManager.js +7 -7
  69. package/dist/summaryManager.js.map +1 -1
  70. package/garbageCollection.md +9 -1
  71. package/lib/blobManager.d.ts +2 -2
  72. package/lib/blobManager.d.ts.map +1 -1
  73. package/lib/blobManager.js +12 -11
  74. package/lib/blobManager.js.map +1 -1
  75. package/lib/connectionTelemetry.d.ts +19 -0
  76. package/lib/connectionTelemetry.d.ts.map +1 -1
  77. package/lib/connectionTelemetry.js +23 -23
  78. package/lib/connectionTelemetry.js.map +1 -1
  79. package/lib/containerRuntime.d.ts +137 -29
  80. package/lib/containerRuntime.d.ts.map +1 -1
  81. package/lib/containerRuntime.js +341 -121
  82. package/lib/containerRuntime.js.map +1 -1
  83. package/lib/dataStore.d.ts.map +1 -1
  84. package/lib/dataStore.js +15 -4
  85. package/lib/dataStore.js.map +1 -1
  86. package/lib/dataStoreContext.d.ts +4 -2
  87. package/lib/dataStoreContext.d.ts.map +1 -1
  88. package/lib/dataStoreContext.js +16 -5
  89. package/lib/dataStoreContext.js.map +1 -1
  90. package/lib/dataStoreRegistry.d.ts +0 -4
  91. package/lib/dataStoreRegistry.d.ts.map +1 -1
  92. package/lib/dataStoreRegistry.js +12 -1
  93. package/lib/dataStoreRegistry.js.map +1 -1
  94. package/lib/dataStores.d.ts +4 -3
  95. package/lib/dataStores.d.ts.map +1 -1
  96. package/lib/dataStores.js +14 -8
  97. package/lib/dataStores.js.map +1 -1
  98. package/lib/garbageCollection.d.ts +23 -27
  99. package/lib/garbageCollection.d.ts.map +1 -1
  100. package/lib/garbageCollection.js +43 -117
  101. package/lib/garbageCollection.js.map +1 -1
  102. package/lib/index.d.ts +2 -2
  103. package/lib/index.d.ts.map +1 -1
  104. package/lib/index.js +1 -1
  105. package/lib/index.js.map +1 -1
  106. package/lib/orderedClientElection.js +0 -4
  107. package/lib/orderedClientElection.js.map +1 -1
  108. package/lib/packageVersion.d.ts +1 -1
  109. package/lib/packageVersion.d.ts.map +1 -1
  110. package/lib/packageVersion.js +1 -1
  111. package/lib/packageVersion.js.map +1 -1
  112. package/lib/pendingStateManager.d.ts +30 -29
  113. package/lib/pendingStateManager.d.ts.map +1 -1
  114. package/lib/pendingStateManager.js +72 -109
  115. package/lib/pendingStateManager.js.map +1 -1
  116. package/lib/runningSummarizer.d.ts +4 -3
  117. package/lib/runningSummarizer.d.ts.map +1 -1
  118. package/lib/runningSummarizer.js +11 -6
  119. package/lib/runningSummarizer.js.map +1 -1
  120. package/lib/serializedSnapshotStorage.d.ts +58 -0
  121. package/lib/serializedSnapshotStorage.d.ts.map +1 -0
  122. package/lib/serializedSnapshotStorage.js +104 -0
  123. package/lib/serializedSnapshotStorage.js.map +1 -0
  124. package/lib/summarizer.d.ts +11 -4
  125. package/lib/summarizer.d.ts.map +1 -1
  126. package/lib/summarizer.js +18 -9
  127. package/lib/summarizer.js.map +1 -1
  128. package/lib/summarizerHeuristics.d.ts +5 -3
  129. package/lib/summarizerHeuristics.d.ts.map +1 -1
  130. package/lib/summarizerHeuristics.js +10 -3
  131. package/lib/summarizerHeuristics.js.map +1 -1
  132. package/lib/summarizerTypes.d.ts +4 -2
  133. package/lib/summarizerTypes.d.ts.map +1 -1
  134. package/lib/summarizerTypes.js.map +1 -1
  135. package/lib/summaryManager.d.ts +3 -3
  136. package/lib/summaryManager.d.ts.map +1 -1
  137. package/lib/summaryManager.js +7 -7
  138. package/lib/summaryManager.js.map +1 -1
  139. package/package.json +19 -32
  140. package/src/blobManager.ts +29 -15
  141. package/src/connectionTelemetry.ts +60 -39
  142. package/src/containerRuntime.ts +502 -156
  143. package/src/dataStore.ts +21 -4
  144. package/src/dataStoreContext.ts +27 -5
  145. package/src/dataStoreRegistry.ts +8 -1
  146. package/src/dataStores.ts +21 -8
  147. package/src/garbageCollection.ts +81 -166
  148. package/src/index.ts +7 -1
  149. package/src/orderedClientElection.ts +1 -1
  150. package/src/packageVersion.ts +1 -1
  151. package/src/pendingStateManager.ts +104 -123
  152. package/src/runningSummarizer.ts +20 -10
  153. package/src/serializedSnapshotStorage.ts +146 -0
  154. package/src/summarizer.ts +20 -16
  155. package/src/summarizerHeuristics.ts +21 -5
  156. package/src/summarizerTypes.ts +4 -2
  157. package/src/summaryManager.ts +5 -6
@@ -4,7 +4,7 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.semverCompare = exports.GarbageCollector = exports.GCNodeType = exports.defaultSessionExpiryDurationMs = exports.trackGCStateMinimumVersionKey = exports.trackGCStateKey = exports.logUnknownOutboundReferencesKey = exports.disableSessionExpiryKey = exports.runSessionExpiryKey = exports.gcBlobPrefix = exports.gcTreeKey = void 0;
7
+ exports.GarbageCollector = exports.GCNodeType = exports.defaultSessionExpiryDurationMs = exports.trackGCStateKey = exports.disableSessionExpiryKey = exports.runSessionExpiryKey = exports.gcBlobPrefix = exports.gcTreeKey = void 0;
8
8
  const common_utils_1 = require("@fluidframework/common-utils");
9
9
  const container_utils_1 = require("@fluidframework/container-utils");
10
10
  const garbage_collector_1 = require("@fluidframework/garbage-collector");
@@ -14,7 +14,6 @@ const runtime_utils_1 = require("@fluidframework/runtime-utils");
14
14
  const telemetry_utils_1 = require("@fluidframework/telemetry-utils");
15
15
  const containerRuntime_1 = require("./containerRuntime");
16
16
  const dataStores_1 = require("./dataStores");
17
- const packageVersion_1 = require("./packageVersion");
18
17
  const summaryFormat_1 = require("./summaryFormat");
19
18
  /** This is the current version of garbage collection. */
20
19
  const GCVersion = 1;
@@ -34,12 +33,8 @@ const writeAtRootKey = "Fluid.GarbageCollection.WriteDataAtRoot";
34
33
  exports.runSessionExpiryKey = "Fluid.GarbageCollection.RunSessionExpiry";
35
34
  // Feature gate key to disable expiring session after a set period of time, even if expiry value is present
36
35
  exports.disableSessionExpiryKey = "Fluid.GarbageCollection.DisableSessionExpiry";
37
- // Feature gate key to log error messages if GC reference validation fails.
38
- exports.logUnknownOutboundReferencesKey = "Fluid.GarbageCollection.LogUnknownOutboundReferences";
39
36
  // Feature gate key to write the gc blob as a handle if the data is the same.
40
37
  exports.trackGCStateKey = "Fluid.GarbageCollection.TrackGCState";
41
- // Feature gate key to limit which versions can write the gc blob as a handle if the data is the same.
42
- exports.trackGCStateMinimumVersionKey = "Fluid.GarbageCollection.TrackGCState.MinVersion";
43
38
  const defaultInactiveTimeoutMs = 7 * 24 * 60 * 60 * 1000; // 7 days
44
39
  exports.defaultSessionExpiryDurationMs = 30 * 24 * 60 * 60 * 1000; // 30 days
45
40
  /** The types of GC nodes in the GC reference graph. */
@@ -117,21 +112,12 @@ class UnreferencedStateTracker {
117
112
  * NodeId = "dds1" NodeId = "dds2"
118
113
  */
119
114
  class GarbageCollector {
120
- constructor(runtime, gcOptions,
121
- /** For a given node path, returns the node's package path. */
122
- getNodePackagePath,
123
- /** Returns the timestamp of the last summary generated for this container. */
124
- getLastSummaryTimestampMs, baseSnapshot, readAndParseBlob, baseLogger, existing, metadata, isSummarizerClient = true) {
115
+ constructor(createParams) {
125
116
  var _a, _b, _c, _d, _e, _f, _g;
126
- this.runtime = runtime;
127
- this.gcOptions = gcOptions;
128
- this.getNodePackagePath = getNodePackagePath;
129
- this.getLastSummaryTimestampMs = getLastSummaryTimestampMs;
130
- this.isSummarizerClient = isSummarizerClient;
131
117
  /**
132
118
  * Tells whether the GC data should be written to the root of the summary tree.
133
119
  */
134
- this._writeDataAtRoot = false;
120
+ this._writeDataAtRoot = true;
135
121
  /**
136
122
  * Tells whether the initial GC state needs to be reset. This can happen under 2 conditions:
137
123
  * 1. The base snapshot contains GC state but GC is disabled. This will happen the first time GC is disabled after
@@ -157,7 +143,15 @@ class GarbageCollector {
157
143
  this.pendingEventsQueue = [];
158
144
  // The number of times GC has successfully completed on this instance of GarbageCollector.
159
145
  this.completedRuns = 0;
160
- this.mc = (0, telemetry_utils_1.loggerToMonitoringContext)(telemetry_utils_1.ChildLogger.create(baseLogger, "GarbageCollector", { all: { completedGCRuns: () => this.completedRuns } }));
146
+ this.runtime = createParams.runtime;
147
+ this.isSummarizerClient = createParams.isSummarizerClient;
148
+ this.gcOptions = createParams.gcOptions;
149
+ this.getNodePackagePath = createParams.getNodePackagePath;
150
+ this.getLastSummaryTimestampMs = createParams.getLastSummaryTimestampMs;
151
+ const baseSnapshot = createParams.baseSnapshot;
152
+ const metadata = createParams.metadata;
153
+ const readAndParseBlob = createParams.readAndParseBlob;
154
+ this.mc = (0, telemetry_utils_1.loggerToMonitoringContext)(telemetry_utils_1.ChildLogger.create(createParams.baseLogger, "GarbageCollector", { all: { completedGCRuns: () => this.completedRuns } }));
161
155
  let prevSummaryGCVersion;
162
156
  /**
163
157
  * The following GC state is enabled during container creation and cannot be changed throughout its lifetime:
@@ -166,7 +160,7 @@ class GarbageCollector {
166
160
  * 3. Whether GC session expiry is enabled or not.
167
161
  * For existing containers, we get this information from the metadata blob of its summary.
168
162
  */
169
- if (existing) {
163
+ if (createParams.existing) {
170
164
  prevSummaryGCVersion = (0, summaryFormat_1.getGCVersion)(metadata);
171
165
  // Existing documents which did not have metadata blob or had GC disabled have version as 0. For all
172
166
  // other existing documents, GC is enabled.
@@ -177,12 +171,14 @@ class GarbageCollector {
177
171
  else {
178
172
  // Sweep should not be enabled without enabling GC mark phase. We could silently disable sweep in this
179
173
  // scenario but explicitly failing makes it clearer and promotes correct usage.
180
- if (gcOptions.sweepAllowed && !gcOptions.gcAllowed) {
174
+ if (this.gcOptions.sweepAllowed && this.gcOptions.gcAllowed === false) {
181
175
  throw new container_utils_1.UsageError("GC sweep phase cannot be enabled without enabling GC mark phase");
182
176
  }
183
- // For new documents, GC has to be explicitly enabled via the flags in GC options.
184
- this.gcEnabled = gcOptions.gcAllowed === true;
185
- this.sweepEnabled = gcOptions.sweepAllowed === true;
177
+ // For new documents, GC is enabled by default. It can be explicitly disabled by setting the gcAllowed
178
+ // flag in GC options to false.
179
+ this.gcEnabled = this.gcOptions.gcAllowed !== false;
180
+ // The sweep phase has to be explicitly enabled by setting the sweepAllowed flag in GC options to true.
181
+ this.sweepEnabled = this.gcOptions.sweepAllowed === true;
186
182
  // Set the Session Expiry only if the flag is enabled or the test option is set.
187
183
  if (this.mc.config.getBoolean(exports.runSessionExpiryKey) && this.gcEnabled) {
188
184
  this.sessionExpiryTimeoutMs = exports.defaultSessionExpiryDurationMs;
@@ -216,10 +212,8 @@ class GarbageCollector {
216
212
  // GC must be enabled for the document.
217
213
  this.gcEnabled
218
214
  // GC must not be disabled via GC options.
219
- && !gcOptions.disableGC);
220
- const minimumVersion = this.mc.config.getString(exports.trackGCStateMinimumVersionKey);
221
- const shouldTrackStateForVersion = meetsMinimumVersionRequirement(packageVersion_1.pkgVersion, minimumVersion);
222
- this.trackGCState = this.mc.config.getBoolean(exports.trackGCStateKey) === true && shouldTrackStateForVersion;
215
+ && !this.gcOptions.disableGC);
216
+ this.trackGCState = this.mc.config.getBoolean(exports.trackGCStateKey) === true;
223
217
  /**
224
218
  * Whether sweep should run or not. The following conditions have to be met to run sweep:
225
219
  * 1. Overall GC or mark phase must be enabled (this.shouldRunGC).
@@ -231,19 +225,15 @@ class GarbageCollector {
231
225
  this.inactiveTimeoutMs =
232
226
  (_e = (_d = this.mc.config.getNumber("Fluid.GarbageCollection.TestOverride.InactiveTimeoutMs")) !== null && _d !== void 0 ? _d : this.gcOptions.inactiveTimeoutMs) !== null && _e !== void 0 ? _e : defaultInactiveTimeoutMs;
233
227
  // Whether we are running in test mode. In this mode, unreferenced nodes are immediately deleted.
234
- this.testMode = (_f = this.mc.config.getBoolean(gcTestModeKey)) !== null && _f !== void 0 ? _f : gcOptions.runGCInTestMode === true;
235
- /**
236
- * Enable resetting initial state once the following issue is resolved:
237
- * https://github.com/microsoft/FluidFramework/issues/8878.
238
- * Currently, the GC tree is not written at root, so we don't know if the base snapshot contains GC tree or not.
239
- */
240
- // The GC state needs to be reset if the base snapshot contains GC tree and GC is disabled or it doesn't contain
241
- // GC tree and GC is enabled.
242
- // const gcTreePresent = baseSnapshot?.trees[gcTreeKey] !== undefined;
243
- // this.initialStateNeedsReset = gcTreePresent ? !this.shouldRunGC : this.shouldRunGC;
244
- // If `writeDataAtRoot` setting is true, write the GC data into the root of the summary tree. We do this so that
245
- // the roll out can be staged. Once its rolled out everywhere, we will start writing at root by default.
246
- this._writeDataAtRoot = (_g = this.mc.config.getBoolean(writeAtRootKey)) !== null && _g !== void 0 ? _g : this.gcOptions.writeDataAtRoot === true;
228
+ this.testMode = (_f = this.mc.config.getBoolean(gcTestModeKey)) !== null && _f !== void 0 ? _f : this.gcOptions.runGCInTestMode === true;
229
+ // GC state is written into root of the summary tree by default. Can be overridden via feature flag for now.
230
+ this._writeDataAtRoot = (_g = this.mc.config.getBoolean(writeAtRootKey)) !== null && _g !== void 0 ? _g : true;
231
+ if (this._writeDataAtRoot) {
232
+ // The GC state needs to be reset if the base snapshot contains GC tree and GC is disabled or it doesn't
233
+ // contain GC tree and GC is enabled.
234
+ const gcTreePresent = (baseSnapshot === null || baseSnapshot === void 0 ? void 0 : baseSnapshot.trees[exports.gcTreeKey]) !== undefined;
235
+ this.initialStateNeedsReset = gcTreePresent !== this.shouldRunGC;
236
+ }
247
237
  // Get the GC state from the GC blob in the base snapshot. Use LazyPromise because we only want to do
248
238
  // this once since it involves fetching blobs from storage which is expensive.
249
239
  const baseSummaryStateP = new common_utils_1.LazyPromise(async () => {
@@ -332,7 +322,7 @@ class GarbageCollector {
332
322
  // Run GC on the nodes in the base summary to get the routes used in each node in the container.
333
323
  // This is an optimization for space (vs performance) wherein we don't need to store the used routes of
334
324
  // each node in the summary.
335
- const usedRoutes = (0, garbage_collector_1.runGarbageCollection)(gcNodes, ["/"], this.mc.logger).referencedNodeIds;
325
+ const usedRoutes = (0, garbage_collector_1.runGarbageCollection)(gcNodes, ["/"]).referencedNodeIds;
336
326
  const baseGCDetailsMap = (0, garbage_collector_1.unpackChildNodesGCDetails)({ gcData: { gcNodes }, usedRoutes });
337
327
  // Currently, the nodes may write the GC data. So, we need to update it's base GC details with the
338
328
  // unreferenced timestamp. Once we start writing the GC data here, we won't need to do this anymore.
@@ -348,7 +338,7 @@ class GarbageCollector {
348
338
  });
349
339
  // Log all the GC options and the state determined by the garbage collector. This is interesting only for the
350
340
  // summarizer client since it is the only one that runs GC. It also helps keep the telemetry less noisy.
351
- const gcConfigProps = JSON.stringify(Object.assign({ gcEnabled: this.gcEnabled, sweepEnabled: this.sweepEnabled, runGC: this.shouldRunGC, runSweep: this.shouldRunSweep, writeAtRoot: this._writeDataAtRoot, testMode: this.testMode, sessionExpiry: this.sessionExpiryTimeoutMs, inactiveTimeout: this.inactiveTimeoutMs, existing }, this.gcOptions));
341
+ const gcConfigProps = JSON.stringify(Object.assign({ gcEnabled: this.gcEnabled, sweepEnabled: this.sweepEnabled, runGC: this.shouldRunGC, runSweep: this.shouldRunSweep, writeAtRoot: this._writeDataAtRoot, testMode: this.testMode, sessionExpiry: this.sessionExpiryTimeoutMs, inactiveTimeout: this.inactiveTimeoutMs, existing: createParams.existing }, this.gcOptions));
352
342
  if (this.isSummarizerClient) {
353
343
  this.mc.logger.sendTelemetryEvent({
354
344
  eventName: "GarbageCollectorLoaded",
@@ -364,8 +354,8 @@ class GarbageCollector {
364
354
  });
365
355
  }
366
356
  }
367
- static create(provider, gcOptions, getNodePackagePath, getLastSummaryTimestampMs, baseSnapshot, readAndParseBlob, baseLogger, existing, metadata, isSummarizerClient) {
368
- return new GarbageCollector(provider, gcOptions, getNodePackagePath, getLastSummaryTimestampMs, baseSnapshot, readAndParseBlob, baseLogger, existing, metadata, isSummarizerClient);
357
+ static create(createParams) {
358
+ return new GarbageCollector(createParams);
369
359
  }
370
360
  /**
371
361
  * Tells whether the GC state needs to be reset in the next summary. We need to do this if:
@@ -397,7 +387,7 @@ class GarbageCollector {
397
387
  await this.runtime.updateStateBeforeGC();
398
388
  // Get the runtime's GC data and run GC on the reference graph in it.
399
389
  const gcData = await this.runtime.getGCData(fullGC);
400
- const gcResult = (0, garbage_collector_1.runGarbageCollection)(gcData.gcNodes, ["/"], logger);
390
+ const gcResult = (0, garbage_collector_1.runGarbageCollection)(gcData.gcNodes, ["/"]);
401
391
  const gcStats = this.generateStatsAndLogEvents(gcResult, logger);
402
392
  // Update the state since the last GC run. There can be nodes that were referenced between the last and
403
393
  // the current run. We need to identify than and update their unreferenced state if needed.
@@ -424,7 +414,7 @@ class GarbageCollector {
424
414
  * We current write the entire GC state in a single blob. This can be modified later to write multiple
425
415
  * blobs. All the blob keys should start with `gcBlobPrefix`.
426
416
  */
427
- summarize(fullTree, trackState) {
417
+ summarize(fullTree, trackState, telemetryContext) {
428
418
  var _a;
429
419
  if (!this.shouldRunGC || this.previousGCDataFromLastRun === undefined) {
430
420
  return;
@@ -486,9 +476,6 @@ class GarbageCollector {
486
476
  * latest summary tracked.
487
477
  */
488
478
  async latestSummaryStateRefreshed(result, readAndParseBlob) {
489
- // After a summary is successfully submitted and ack'd by this client, the GC state should have been reset in
490
- // the summary and doesn't need to be reset anymore.
491
- this.initialStateNeedsReset = false;
492
479
  if (!this.shouldRunGC || !result.latestSummaryUpdated) {
493
480
  return;
494
481
  }
@@ -496,6 +483,7 @@ class GarbageCollector {
496
483
  // Basically, it was written in the current GC version.
497
484
  if (result.wasSummaryTracked) {
498
485
  this.latestSummaryGCVersion = this.currentGCVersion;
486
+ this.initialStateNeedsReset = false;
499
487
  if (this.trackGCState) {
500
488
  this.latestSerializedSummaryState = this.pendingSerializedSummaryState;
501
489
  this.pendingSerializedSummaryState = undefined;
@@ -618,10 +606,7 @@ class GarbageCollector {
618
606
  }
619
607
  // Find any references that haven't been identified correctly.
620
608
  const missingExplicitReferences = this.findMissingExplicitReferences(currentGCData, this.previousGCDataFromLastRun, this.newReferencesSinceLastRun);
621
- // The following log will be enabled once this issue is resolved:
622
- // https://github.com/microsoft/FluidFramework/issues/8878.
623
- if (this.mc.config.getBoolean(exports.logUnknownOutboundReferencesKey) === true
624
- && missingExplicitReferences.length > 0) {
609
+ if (this.writeDataAtRoot && missingExplicitReferences.length > 0) {
625
610
  missingExplicitReferences.forEach((missingExplicitReference) => {
626
611
  const event = {
627
612
  eventName: "gcUnknownOutboundReferences",
@@ -665,7 +650,7 @@ class GarbageCollector {
665
650
  * unreferenced, stop tracking them and remove from unreferenced list.
666
651
  * Some of these nodes may be unreferenced now and if so, the current run will add unreferenced state for them.
667
652
  */
668
- const gcResult = (0, garbage_collector_1.runGarbageCollection)(gcDataSuperSet.gcNodes, ["/"], logger);
653
+ const gcResult = (0, garbage_collector_1.runGarbageCollection)(gcDataSuperSet.gcNodes, ["/"]);
669
654
  for (const nodeId of gcResult.referencedNodeIds) {
670
655
  const nodeStateTracker = this.unreferencedNodesState.get(nodeId);
671
656
  if (nodeStateTracker !== undefined) {
@@ -745,11 +730,10 @@ class GarbageCollector {
745
730
  };
746
731
  const updateNodeStats = (nodeId, referenced) => {
747
732
  gcStats.nodeCount++;
748
- /**
749
- * `this.unreferencedNodesState` has the previous unreferenced state of all nodes. `referenced` flag passed
750
- * here is current state of the give node. Check if the reference state of the changed.
751
- */
752
- const stateUpdated = this.unreferencedNodesState.has(nodeId) ? referenced : !referenced;
733
+ // If there is no previous GC data, every node's state is generated and is considered as updated.
734
+ // Otherwise, find out if any node went from referenced to unreferenced or vice-versa.
735
+ const stateUpdated = this.previousGCDataFromLastRun === undefined ||
736
+ this.unreferencedNodesState.has(nodeId) === referenced;
753
737
  if (stateUpdated) {
754
738
  gcStats.updatedNodeCount++;
755
739
  }
@@ -825,7 +809,7 @@ class GarbageCollector {
825
809
  // next time GC runs as the package data should be available then.
826
810
  const pkg = packagePath !== null && packagePath !== void 0 ? packagePath : this.getNodePackagePath(nodeId);
827
811
  if (pkg !== undefined) {
828
- this.mc.logger.sendErrorEvent(Object.assign(Object.assign({}, event), { pkg: { value: `/${pkg.join("/")}`, tag: telemetry_utils_1.TelemetryDataTag.PackageData } }));
812
+ this.mc.logger.sendErrorEvent(Object.assign(Object.assign({}, event), { pkg: { value: pkg.join("/"), tag: telemetry_utils_1.TelemetryDataTag.PackageData } }));
829
813
  }
830
814
  else {
831
815
  this.pendingEventsQueue.push(event);
@@ -885,63 +869,4 @@ function setLongTimeout(timeoutMs, timeoutFn, setTimerFn) {
885
869
  }
886
870
  setTimerFn(timer);
887
871
  }
888
- /**
889
- * meetsMinimumVersionRequirement is used determining if a feature version should be run. This is similar to feature
890
- * flags. The advantage of this is that if we ship a bug in version 0.1.1 and fix it in version 0.2.1. We can keep this
891
- * feature disabled for version 0.1.1 and enabled for 0.2.1. Older versions will run without the feature and new
892
- * versions will run with the feature.
893
- * @param currentVersion - the total time the timeout needs to last in ms
894
- * @param minimumVersion - the function to execute when the timer ends
895
- */
896
- function meetsMinimumVersionRequirement(currentVersion, minimumVersion) {
897
- return minimumVersion === undefined || semverCompare(currentVersion, minimumVersion) >= 0;
898
- }
899
- /**
900
- * Compare semver versions.
901
- * @param currentVersion - assumed to be any valid semver version
902
- * @param minimumVersion - must be [major].[minor].[patch], where major, minor, and patch are all numbers
903
- * as it complicates the algorithm if we allow comparisons against minimum pre-release versions.
904
- * @returns
905
- * 0 if the currentVersion equals the minimumVersion
906
- * 1 if the currentVersion is greater than the minimumVersion
907
- * -1 if the minimumVersion is greater than the currentVersion
908
- */
909
- function semverCompare(currentVersion, minimumVersion) {
910
- const minimumValues = minimumVersion.split(".").map((value) => {
911
- (0, common_utils_1.assert)(isNaN(+value) === false, 0x2fa /* Expected real numbers in minimum version! */);
912
- return Number.parseInt(value, 10);
913
- });
914
- (0, common_utils_1.assert)(minimumValues.length === 3, 0x2fb /* Expected minimumVersion to be [major].[minor].[patch] */);
915
- const [minMajor, minMinor, minPatch] = minimumValues;
916
- const currentValuesString = currentVersion.split(/\W/);
917
- (0, common_utils_1.assert)(currentValuesString.length >= 3, 0x2fc /* Expected version to match semver rules! */);
918
- const currentValues = currentValuesString.slice(0, 3).map((value) => {
919
- (0, common_utils_1.assert)(isNaN(+value) === false, 0x2fd /* Expected real numbers in minimum version! */);
920
- return Number.parseInt(value, 10);
921
- });
922
- const [cMajor, cMinor, cPatch] = currentValues;
923
- if (cMajor > minMajor) {
924
- return 1;
925
- }
926
- else if (minMajor > cMajor) {
927
- return -1;
928
- }
929
- if (cMinor > minMinor) {
930
- return 1;
931
- }
932
- else if (minMinor > cMinor) {
933
- return -1;
934
- }
935
- if (cPatch > minPatch) {
936
- return 1;
937
- }
938
- else if (minPatch > cPatch) {
939
- return -1;
940
- }
941
- if (currentValuesString.length === 3) {
942
- return 0;
943
- }
944
- return -1;
945
- }
946
- exports.semverCompare = semverCompare;
947
872
  //# sourceMappingURL=garbageCollection.js.map