@fluidframework/container-runtime 2.0.0-internal.3.0.1 → 2.0.0-internal.3.0.2

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 (58) hide show
  1. package/dist/containerRuntime.d.ts +1 -1
  2. package/dist/containerRuntime.d.ts.map +1 -1
  3. package/dist/containerRuntime.js +43 -31
  4. package/dist/containerRuntime.js.map +1 -1
  5. package/dist/dataStoreContext.d.ts +12 -0
  6. package/dist/dataStoreContext.d.ts.map +1 -1
  7. package/dist/dataStoreContext.js +43 -5
  8. package/dist/dataStoreContext.js.map +1 -1
  9. package/dist/garbageCollection.d.ts +5 -4
  10. package/dist/garbageCollection.d.ts.map +1 -1
  11. package/dist/garbageCollection.js +15 -6
  12. package/dist/garbageCollection.js.map +1 -1
  13. package/dist/garbageCollectionConstants.d.ts +2 -0
  14. package/dist/garbageCollectionConstants.d.ts.map +1 -1
  15. package/dist/garbageCollectionConstants.js +3 -1
  16. package/dist/garbageCollectionConstants.js.map +1 -1
  17. package/dist/packageVersion.d.ts +1 -1
  18. package/dist/packageVersion.js +1 -1
  19. package/dist/packageVersion.js.map +1 -1
  20. package/dist/summaryFormat.d.ts +19 -0
  21. package/dist/summaryFormat.d.ts.map +1 -1
  22. package/dist/summaryFormat.js.map +1 -1
  23. package/dist/summaryGenerator.d.ts.map +1 -1
  24. package/dist/summaryGenerator.js +1 -1
  25. package/dist/summaryGenerator.js.map +1 -1
  26. package/lib/containerRuntime.d.ts +1 -1
  27. package/lib/containerRuntime.d.ts.map +1 -1
  28. package/lib/containerRuntime.js +43 -31
  29. package/lib/containerRuntime.js.map +1 -1
  30. package/lib/dataStoreContext.d.ts +12 -0
  31. package/lib/dataStoreContext.d.ts.map +1 -1
  32. package/lib/dataStoreContext.js +45 -7
  33. package/lib/dataStoreContext.js.map +1 -1
  34. package/lib/garbageCollection.d.ts +5 -4
  35. package/lib/garbageCollection.d.ts.map +1 -1
  36. package/lib/garbageCollection.js +16 -7
  37. package/lib/garbageCollection.js.map +1 -1
  38. package/lib/garbageCollectionConstants.d.ts +2 -0
  39. package/lib/garbageCollectionConstants.d.ts.map +1 -1
  40. package/lib/garbageCollectionConstants.js +2 -0
  41. package/lib/garbageCollectionConstants.js.map +1 -1
  42. package/lib/packageVersion.d.ts +1 -1
  43. package/lib/packageVersion.js +1 -1
  44. package/lib/packageVersion.js.map +1 -1
  45. package/lib/summaryFormat.d.ts +19 -0
  46. package/lib/summaryFormat.d.ts.map +1 -1
  47. package/lib/summaryFormat.js.map +1 -1
  48. package/lib/summaryGenerator.d.ts.map +1 -1
  49. package/lib/summaryGenerator.js +1 -1
  50. package/lib/summaryGenerator.js.map +1 -1
  51. package/package.json +19 -53
  52. package/src/containerRuntime.ts +78 -49
  53. package/src/dataStoreContext.ts +64 -5
  54. package/src/garbageCollection.ts +24 -9
  55. package/src/garbageCollectionConstants.ts +3 -0
  56. package/src/packageVersion.ts +1 -1
  57. package/src/summaryFormat.ts +22 -0
  58. package/src/summaryGenerator.ts +9 -5
@@ -22,7 +22,7 @@ import { mergeStats, packagePathToTelemetryProperty, SummaryTreeBuilder, } from
22
22
  import { ChildLogger, generateStack, loggerToMonitoringContext, PerformanceEvent, TelemetryDataTag, } from "@fluidframework/telemetry-utils";
23
23
  import { RuntimeHeaders } from "./containerRuntime";
24
24
  import { getSummaryForDatastores } from "./dataStores";
25
- import { currentGCVersion, defaultInactiveTimeoutMs, defaultSessionExpiryDurationMs, disableSweepLogKey, disableTombstoneKey, gcVersionUpgradeToV2Key, gcTestModeKey, oneDayMs, runGCKey, runSessionExpiryKey, runSweepKey, stableGCVersion, trackGCStateKey } from "./garbageCollectionConstants";
25
+ import { currentGCVersion, defaultInactiveTimeoutMs, defaultSessionExpiryDurationMs, disableSweepLogKey, disableTombstoneKey, gcVersionUpgradeToV2Key, gcTestModeKey, oneDayMs, runGCKey, runSessionExpiryKey, runSweepKey, stableGCVersion, trackGCStateKey, gcTombstoneGenerationOptionName } from "./garbageCollectionConstants";
26
26
  import { sendGCTombstoneEvent } from "./garbageCollectionTombstoneUtils";
27
27
  import { SweepReadyUsageDetectionHandler } from "./gcSweepReadyUsageDetection";
28
28
  import { getGCVersion, metadataBlobName, dataStoreAttributesBlobName, } from "./summaryFormat";
@@ -200,6 +200,7 @@ export class GarbageCollector {
200
200
  this.sessionExpiryTimeoutMs = metadata === null || metadata === void 0 ? void 0 : metadata.sessionExpiryTimeoutMs;
201
201
  this.sweepTimeoutMs =
202
202
  (_b = metadata === null || metadata === void 0 ? void 0 : metadata.sweepTimeoutMs) !== null && _b !== void 0 ? _b : computeSweepTimeout(this.sessionExpiryTimeoutMs); // Backfill old documents that didn't persist this
203
+ this.persistedGcFeatureMatrix = metadata === null || metadata === void 0 ? void 0 : metadata.gcFeatureMatrix;
203
204
  }
204
205
  else {
205
206
  // Sweep should not be enabled without enabling GC mark phase. We could silently disable sweep in this
@@ -220,6 +221,11 @@ export class GarbageCollector {
220
221
  }
221
222
  this.sweepTimeoutMs =
222
223
  testOverrideSweepTimeoutMs !== null && testOverrideSweepTimeoutMs !== void 0 ? testOverrideSweepTimeoutMs : computeSweepTimeout(this.sessionExpiryTimeoutMs);
224
+ if (this.gcOptions[gcTombstoneGenerationOptionName] !== undefined) {
225
+ this.persistedGcFeatureMatrix = {
226
+ tombstoneGeneration: this.gcOptions[gcTombstoneGenerationOptionName],
227
+ };
228
+ }
223
229
  }
224
230
  // If session expiry is enabled, we need to close the container when the session expiry timeout expires.
225
231
  if (this.sessionExpiryTimeoutMs !== undefined) {
@@ -567,7 +573,7 @@ export class GarbageCollector {
567
573
  * Runs garbage collection and updates the reference / used state of the nodes in the container.
568
574
  * @returns stats of the GC run or undefined if GC did not run.
569
575
  */
570
- async collectGarbage(options) {
576
+ async collectGarbage(options, telemetryContext) {
571
577
  var _a;
572
578
  const fullGC = (_a = options.fullGC) !== null && _a !== void 0 ? _a : (this.gcOptions.runFullGC === true || this.summaryStateNeedsReset);
573
579
  const logger = options.logger
@@ -590,6 +596,8 @@ export class GarbageCollector {
590
596
  });
591
597
  return undefined;
592
598
  }
599
+ // Add the options that are used to run GC to the telemetry context.
600
+ telemetryContext === null || telemetryContext === void 0 ? void 0 : telemetryContext.setAll("fluid_GC", "Options", { fullGC, runSweep: options.runSweep });
593
601
  return PerformanceEvent.timedExecAsync(logger, { eventName: "GarbageCollection" }, async (event) => {
594
602
  await this.runPreGCSteps();
595
603
  // Get the runtime's GC data and run GC on the reference graph in it.
@@ -745,6 +753,7 @@ export class GarbageCollector {
745
753
  * into the metadata blob. If GC is disabled, the gcFeature is 0.
746
754
  */
747
755
  gcFeature: this.gcEnabled ? this.currentGCVersion : 0,
756
+ gcFeatureMatrix: this.persistedGcFeatureMatrix,
748
757
  sessionExpiryTimeoutMs: this.sessionExpiryTimeoutMs,
749
758
  sweepEnabled: this.sweepEnabled,
750
759
  sweepTimeoutMs: this.sweepTimeoutMs,
@@ -761,7 +770,7 @@ export class GarbageCollector {
761
770
  * Called to refresh the latest summary state. This happens when either a pending summary is acked or a snapshot
762
771
  * is downloaded and should be used to update the state.
763
772
  */
764
- async refreshLatestSummary(result, proposalHandle, summaryRefSeq, readAndParseBlob) {
773
+ async refreshLatestSummary(proposalHandle, result, readAndParseBlob) {
765
774
  // If the latest summary was updated and the summary was tracked, this client is the one that generated this
766
775
  // summary. So, update wasGCRunInLatestSummary.
767
776
  // Note that this has to be updated if GC did not run too. Otherwise, `gcStateNeedsReset` will always return
@@ -783,8 +792,8 @@ export class GarbageCollector {
783
792
  return;
784
793
  }
785
794
  // If the summary was not tracked by this client, the state should be updated from the downloaded snapshot.
786
- const snapshot = result.snapshot;
787
- const metadataBlobId = snapshot.blobs[metadataBlobName];
795
+ const snapshotTree = result.snapshotTree;
796
+ const metadataBlobId = snapshotTree.blobs[metadataBlobName];
788
797
  if (metadataBlobId) {
789
798
  const metadata = await readAndParseBlob(metadataBlobId);
790
799
  this.latestSummaryGCVersion = getGCVersion(metadata);
@@ -793,9 +802,9 @@ export class GarbageCollector {
793
802
  // to be at least one op (summary op / ack, if nothing else) if a snapshot was taken.
794
803
  const currentReferenceTimestampMs = this.runtime.getCurrentReferenceTimestampMs();
795
804
  if (currentReferenceTimestampMs === undefined) {
796
- throw DataProcessingError.create("No reference timestamp when updating GC state from snapshot", "refreshLatestSummary", undefined, { proposalHandle, summaryRefSeq, details: JSON.stringify(this.configs) });
805
+ throw DataProcessingError.create("No reference timestamp when updating GC state from snapshot", "refreshLatestSummary", undefined, { proposalHandle, summaryRefSeq: result.summaryRefSeq, details: JSON.stringify(this.configs) });
797
806
  }
798
- const gcSnapshotTree = snapshot.trees[gcTreeKey];
807
+ const gcSnapshotTree = snapshotTree.trees[gcTreeKey];
799
808
  // If GC ran in the container that generated this snapshot, it will have a GC tree.
800
809
  this.wasGCRunInLatestSummary = gcSnapshotTree !== undefined;
801
810
  let latestGCData;