@fluidframework/container-runtime 2.62.0-356644 → 2.63.0-358419
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.
- package/.eslintrc.cjs +4 -72
- package/CHANGELOG.md +4 -0
- package/container-runtime.test-files.tar +0 -0
- package/dist/blobManager/blobManager.d.ts.map +1 -1
- package/dist/blobManager/blobManager.js +10 -7
- package/dist/blobManager/blobManager.js.map +1 -1
- package/dist/blobManager/blobManagerSnapSum.js.map +1 -1
- package/dist/channelCollection.js +2 -2
- package/dist/channelCollection.js.map +1 -1
- package/dist/containerRuntime.d.ts +1 -2
- package/dist/containerRuntime.d.ts.map +1 -1
- package/dist/containerRuntime.js +93 -96
- package/dist/containerRuntime.js.map +1 -1
- package/dist/dataStoreContext.d.ts.map +1 -1
- package/dist/dataStoreContext.js +2 -2
- package/dist/dataStoreContext.js.map +1 -1
- package/dist/deltaScheduler.js +1 -1
- package/dist/deltaScheduler.js.map +1 -1
- package/dist/gc/garbageCollection.d.ts.map +1 -1
- package/dist/gc/garbageCollection.js +3 -1
- package/dist/gc/garbageCollection.js.map +1 -1
- package/dist/gc/gcConfigs.js +3 -1
- package/dist/gc/gcConfigs.js.map +1 -1
- package/dist/gc/gcReferenceGraphAlgorithm.js.map +1 -1
- package/dist/gc/gcTelemetry.d.ts.map +1 -1
- package/dist/gc/gcTelemetry.js +4 -3
- package/dist/gc/gcTelemetry.js.map +1 -1
- package/dist/inboundBatchAggregator.js +1 -1
- package/dist/inboundBatchAggregator.js.map +1 -1
- package/dist/metadata.d.ts.map +1 -1
- package/dist/metadata.js +2 -1
- package/dist/metadata.js.map +1 -1
- package/dist/opLifecycle/opGroupingManager.js +2 -2
- package/dist/opLifecycle/opGroupingManager.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/pendingStateManager.d.ts.map +1 -1
- package/dist/pendingStateManager.js +8 -3
- package/dist/pendingStateManager.js.map +1 -1
- package/dist/summary/summaryDelayLoadedModule/runningSummarizer.d.ts.map +1 -1
- package/dist/summary/summaryDelayLoadedModule/runningSummarizer.js +3 -2
- package/dist/summary/summaryDelayLoadedModule/runningSummarizer.js.map +1 -1
- package/dist/summary/summaryDelayLoadedModule/summarizer.js +1 -1
- package/dist/summary/summaryDelayLoadedModule/summarizer.js.map +1 -1
- package/dist/summary/summaryDelayLoadedModule/summaryGenerator.js +1 -1
- package/dist/summary/summaryDelayLoadedModule/summaryGenerator.js.map +1 -1
- package/lib/blobManager/blobManager.d.ts.map +1 -1
- package/lib/blobManager/blobManager.js +10 -7
- package/lib/blobManager/blobManager.js.map +1 -1
- package/lib/blobManager/blobManagerSnapSum.js.map +1 -1
- package/lib/channelCollection.js +2 -2
- package/lib/channelCollection.js.map +1 -1
- package/lib/containerRuntime.d.ts +1 -2
- package/lib/containerRuntime.d.ts.map +1 -1
- package/lib/containerRuntime.js +22 -25
- package/lib/containerRuntime.js.map +1 -1
- package/lib/dataStoreContext.d.ts.map +1 -1
- package/lib/dataStoreContext.js +2 -2
- package/lib/dataStoreContext.js.map +1 -1
- package/lib/deltaScheduler.js +1 -1
- package/lib/deltaScheduler.js.map +1 -1
- package/lib/gc/garbageCollection.d.ts.map +1 -1
- package/lib/gc/garbageCollection.js +3 -1
- package/lib/gc/garbageCollection.js.map +1 -1
- package/lib/gc/gcConfigs.js +3 -1
- package/lib/gc/gcConfigs.js.map +1 -1
- package/lib/gc/gcReferenceGraphAlgorithm.js.map +1 -1
- package/lib/gc/gcTelemetry.d.ts.map +1 -1
- package/lib/gc/gcTelemetry.js +4 -3
- package/lib/gc/gcTelemetry.js.map +1 -1
- package/lib/inboundBatchAggregator.js +1 -1
- package/lib/inboundBatchAggregator.js.map +1 -1
- package/lib/metadata.d.ts.map +1 -1
- package/lib/metadata.js +2 -1
- package/lib/metadata.js.map +1 -1
- package/lib/opLifecycle/opGroupingManager.js +2 -2
- package/lib/opLifecycle/opGroupingManager.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/pendingStateManager.d.ts.map +1 -1
- package/lib/pendingStateManager.js +8 -3
- package/lib/pendingStateManager.js.map +1 -1
- package/lib/summary/summaryDelayLoadedModule/runningSummarizer.d.ts.map +1 -1
- package/lib/summary/summaryDelayLoadedModule/runningSummarizer.js +3 -2
- package/lib/summary/summaryDelayLoadedModule/runningSummarizer.js.map +1 -1
- package/lib/summary/summaryDelayLoadedModule/summarizer.js +1 -1
- package/lib/summary/summaryDelayLoadedModule/summarizer.js.map +1 -1
- package/lib/summary/summaryDelayLoadedModule/summaryGenerator.js +1 -1
- package/lib/summary/summaryDelayLoadedModule/summaryGenerator.js.map +1 -1
- package/package.json +18 -18
- package/src/blobManager/blobManager.ts +12 -7
- package/src/blobManager/blobManagerSnapSum.ts +1 -1
- package/src/channelCollection.ts +3 -3
- package/src/containerRuntime.ts +58 -65
- package/src/dataStoreContext.ts +3 -3
- package/src/deltaScheduler.ts +1 -1
- package/src/gc/garbageCollection.ts +5 -2
- package/src/gc/gcConfigs.ts +3 -3
- package/src/gc/gcReferenceGraphAlgorithm.ts +1 -1
- package/src/gc/gcTelemetry.ts +4 -5
- package/src/inboundBatchAggregator.ts +1 -1
- package/src/metadata.ts +2 -1
- package/src/opLifecycle/opGroupingManager.ts +2 -2
- package/src/packageVersion.ts +1 -1
- package/src/pendingStateManager.ts +11 -5
- package/src/summary/summaryDelayLoadedModule/runningSummarizer.ts +3 -2
- package/src/summary/summaryDelayLoadedModule/summarizer.ts +1 -1
- package/src/summary/summaryDelayLoadedModule/summaryGenerator.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"garbageCollection.js","sourceRoot":"","sources":["../../src/gc/garbageCollection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM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AC;YAC9C,CAAC;QACF,CAAC;QAED,sEAAsE;QACtE,gFAAgF;QAChF,eAAe,CAAC,iBAAiB,IAAI,eAAe,CAAC,gBAAgB,CAAC;QACtE,eAAe,CAAC,sBAAsB,IAAI,eAAe,CAAC,qBAAqB,CAAC;QAChF,eAAe,CAAC,2BAA2B,IAAI,eAAe,CAAC,0BAA0B,CAAC;QAE1F,wGAAwG;QACxG,iGAAiG;QACjG,sFAAsF;QACtF,4CAA4C;QAC5C,6EAA6E;QAC7E,0CAA0C;QAC1C,KAAK,MAAM,MAAM,IAAI,eAAe,EAAE,CAAC;YACtC,eAAe,CAAC,gBAAgB,EAAE,CAAC;YACnC,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;YAElD,IAAI,QAAQ,KAAK,UAAU,CAAC,SAAS,EAAE,CAAC;gBACvC,eAAe,CAAC,qBAAqB,EAAE,CAAC;YACzC,CAAC;iBAAM,IAAI,QAAQ,KAAK,UAAU,CAAC,IAAI,EAAE,CAAC;gBACzC,eAAe,CAAC,0BAA0B,EAAE,CAAC;YAC9C,CAAC;QACF,CAAC;QAED,OAAO,eAAe,CAAC;IACxB,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IRequest } from \"@fluidframework/core-interfaces\";\nimport { assert, LazyPromise, Timer } from \"@fluidframework/core-utils/internal\";\nimport {\n\ttype IGarbageCollectionDetailsBase,\n\ttype ISummarizeResult,\n\tgcTreeKey,\n\ttype IGarbageCollectionData,\n\ttype ITelemetryContext,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport {\n\tcreateResponseError,\n\tresponseToException,\n} from \"@fluidframework/runtime-utils/internal\";\nimport {\n\ttype ITelemetryLoggerExt,\n\tDataProcessingError,\n\ttype MonitoringContext,\n\tPerformanceEvent,\n\tcreateChildLogger,\n\tcreateChildMonitoringContext,\n\ttagCodeArtifacts,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport { blobManagerBasePath } from \"../blobManager/index.js\";\nimport { TombstoneResponseHeaderKey } from \"../containerRuntime.js\";\nimport { ClientSessionExpiredError } from \"../error.js\";\nimport { ContainerMessageType, type ContainerRuntimeGCMessage } from \"../messageTypes.js\";\nimport type { IRefreshSummaryResult } from \"../summary/index.js\";\n\nimport { generateGCConfigs } from \"./gcConfigs.js\";\nimport {\n\tGCNodeType,\n\ttype GarbageCollectionMessage,\n\tGarbageCollectionMessageType,\n\ttype IGCMetadata,\n\ttype IGCResult,\n\ttype IGCStats,\n\ttype IGarbageCollectionRuntime,\n\ttype IGarbageCollector,\n\ttype IGarbageCollectorConfigs,\n\ttype IGarbageCollectorCreateParams,\n\ttype IMarkPhaseStats,\n\ttype ISweepPhaseStats,\n\tUnreferencedState,\n\ttype IGCNodeUpdatedProps,\n} from \"./gcDefinitions.js\";\nimport {\n\tcloneGCData,\n\tconcatGarbageCollectionData,\n\tdataStoreNodePathOnly,\n\tgetGCDataFromSnapshot,\n\turlToGCNodePath,\n} from \"./gcHelpers.js\";\nimport { runGarbageCollection } from \"./gcReferenceGraphAlgorithm.js\";\nimport type {\n\tIGarbageCollectionSnapshotData,\n\tIGarbageCollectionState,\n} from \"./gcSummaryDefinitions.js\";\nimport { GCSummaryStateTracker } from \"./gcSummaryStateTracker.js\";\nimport { GCTelemetryTracker } from \"./gcTelemetry.js\";\nimport {\n\tUnreferencedStateTracker,\n\tUnreferencedStateTrackerMap,\n} from \"./gcUnreferencedStateTracker.js\";\n\n/**\n * The garbage collector for the container runtime. It consolidates the garbage collection functionality and maintains\n * its state across summaries.\n *\n * Node - represented as nodeId, it's a node on the GC graph\n *\n * Outbound Route - a path from one node to another node, think `nodeA` -\\> `nodeB`\n *\n * Graph - all nodes with their respective routes\n *\n * ```\n *\t\t\t GC Graph\n *\n *\t\t\t Node\n *\t\tNodeId = \"datastore1\"\n *\t\t /\t\t\t \\\\\n *\tOutboundRoute OutboundRoute\n *\t\t /\t\t\t\t \\\\\n *\t Node\t\t\t Node\n * NodeId = \"dds1\"\t NodeId = \"dds2\"\n * ```\n */\nexport class GarbageCollector implements IGarbageCollector {\n\tpublic static create(createParams: IGarbageCollectorCreateParams): IGarbageCollector {\n\t\treturn new GarbageCollector(createParams);\n\t}\n\n\tprivate readonly mc: MonitoringContext;\n\n\tprivate readonly configs: IGarbageCollectorConfigs;\n\n\tpublic get shouldRunGC(): boolean {\n\t\treturn this.configs.gcAllowed;\n\t}\n\n\tpublic readonly sessionExpiryTimerStarted: number | undefined;\n\t// Keeps track of the GC state from the last run.\n\tprivate gcDataFromLastRun: IGarbageCollectionData | undefined;\n\t// Keeps a list of references (edges in the GC graph) between GC runs. Each entry has a node id and a list of\n\t// outbound routes from that node.\n\tprivate readonly newReferencesSinceLastRun: Map<string, string[]> = new Map();\n\t// A list of nodes that have been tombstoned.\n\tprivate tombstones: string[] = [];\n\t// A list of nodes that have been deleted during sweep phase.\n\tprivate deletedNodes: Set<string> = new Set();\n\n\t// Promise when resolved returns the GC data data in the base snapshot.\n\tprivate readonly baseSnapshotDataP: Promise<IGarbageCollectionSnapshotData | undefined>;\n\t// Promise when resolved initializes the GC state from the data in the base snapshot.\n\tprivate readonly initializeGCStateFromBaseSnapshotP: Promise<void>;\n\t// The GC details generated from the base snapshot.\n\tprivate readonly baseGCDetailsP: Promise<IGarbageCollectionDetailsBase>;\n\n\t/**\n\t * Map of node ids to their unreferenced state tracker\n\t * NOTE: The set of keys in this map is considered as the set of unreferenced nodes\n\t * as of the last GC run. So in between runs, nothing should be added or removed.\n\t */\n\tprivate readonly unreferencedNodesState: UnreferencedStateTrackerMap =\n\t\tnew UnreferencedStateTrackerMap();\n\n\t// The Timer responsible for closing the container when the session has expired\n\tprivate sessionExpiryTimer: Timer | undefined;\n\n\t// The number of times GC has successfully completed on this instance of GarbageCollector.\n\tprivate completedRuns = 0;\n\n\tprivate readonly runtime: IGarbageCollectionRuntime;\n\tprivate readonly isSummarizerClient: boolean;\n\n\tprivate readonly summaryStateTracker: GCSummaryStateTracker;\n\tprivate readonly telemetryTracker: GCTelemetryTracker;\n\n\t/**\n\t * For a given node path, returns the node's package path.\n\t */\n\tprivate readonly getNodePackagePath: (\n\t\tnodePath: string,\n\t) => Promise<readonly string[] | undefined>;\n\t/**\n\t * Returns the timestamp of the last summary generated for this container.\n\t */\n\tprivate readonly getLastSummaryTimestampMs: () => number | undefined;\n\n\tprivate readonly submitMessage: (message: ContainerRuntimeGCMessage) => void;\n\n\t/**\n\t * Returns the count of data stores whose GC state updated since the last summary.\n\t */\n\tpublic get updatedDSCountSinceLastSummary(): number {\n\t\treturn this.summaryStateTracker.updatedDSCountSinceLastSummary;\n\t}\n\n\tprotected constructor(createParams: IGarbageCollectorCreateParams) {\n\t\tthis.runtime = createParams.runtime;\n\t\tthis.isSummarizerClient = createParams.isSummarizerClient;\n\t\tthis.getNodePackagePath = createParams.getNodePackagePath;\n\t\tthis.getLastSummaryTimestampMs = createParams.getLastSummaryTimestampMs;\n\t\tthis.submitMessage = createParams.submitMessage;\n\n\t\tconst baseSnapshot = createParams.baseSnapshot;\n\t\tconst readAndParseBlob = createParams.readAndParseBlob;\n\t\tconst pendingSessionExpiryTimerStarted = createParams.sessionExpiryTimerStarted;\n\n\t\tthis.mc = createChildMonitoringContext({\n\t\t\tlogger: createParams.baseLogger,\n\t\t\tnamespace: \"GarbageCollector\",\n\t\t\tproperties: {\n\t\t\t\tall: { completedGCRuns: () => this.completedRuns },\n\t\t\t},\n\t\t});\n\n\t\tthis.configs = generateGCConfigs(this.mc, createParams);\n\n\t\t// If session expiry is enabled, we need to close the container when the session expiry timeout expires.\n\t\tif (this.configs.sessionExpiryTimeoutMs !== undefined) {\n\t\t\t// If Test Override config is set, override Session Expiry timeout.\n\t\t\tconst overrideSessionExpiryTimeoutMs = this.mc.config.getNumber(\n\t\t\t\t\"Fluid.GarbageCollection.TestOverride.SessionExpiryMs\",\n\t\t\t);\n\t\t\tlet timeoutMs = this.configs.sessionExpiryTimeoutMs;\n\n\t\t\tif (pendingSessionExpiryTimerStarted) {\n\t\t\t\t// NOTE: This assumes the client clock hasn't been tampered with since the original session\n\t\t\t\tconst timeLapsedSincePendingTimer = Date.now() - pendingSessionExpiryTimerStarted;\n\t\t\t\ttimeoutMs -= timeLapsedSincePendingTimer;\n\t\t\t}\n\t\t\ttimeoutMs = overrideSessionExpiryTimeoutMs ?? timeoutMs;\n\t\t\tif (timeoutMs <= 0) {\n\t\t\t\tthis.runtime.closeFn(\n\t\t\t\t\tnew ClientSessionExpiredError(`Client session expired.`, timeoutMs),\n\t\t\t\t);\n\t\t\t}\n\t\t\tthis.sessionExpiryTimer = new Timer(timeoutMs, () => {\n\t\t\t\tthis.runtime.closeFn(\n\t\t\t\t\tnew ClientSessionExpiredError(`Client session expired.`, timeoutMs),\n\t\t\t\t);\n\t\t\t});\n\t\t\tthis.sessionExpiryTimer.start();\n\t\t\tthis.sessionExpiryTimerStarted = Date.now();\n\t\t}\n\n\t\tthis.summaryStateTracker = new GCSummaryStateTracker(this.configs);\n\n\t\tthis.telemetryTracker = new GCTelemetryTracker(\n\t\t\tthis.mc,\n\t\t\tthis.configs,\n\t\t\tthis.isSummarizerClient,\n\t\t\tcreateParams.createContainerMetadata,\n\t\t\t(nodeId: string) => this.runtime.getNodeType(nodeId),\n\t\t\t(nodeId: string) => this.unreferencedNodesState.get(nodeId),\n\t\t\tthis.getNodePackagePath,\n\t\t);\n\n\t\t// Get the GC data from the base snapshot. Use LazyPromise because we only want to do this once since it\n\t\t// it involves fetching blobs from storage which is expensive.\n\t\tthis.baseSnapshotDataP = new LazyPromise<IGarbageCollectionSnapshotData | undefined>(\n\t\t\tasync () => {\n\t\t\t\tif (baseSnapshot === undefined) {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\n\t\t\t\ttry {\n\t\t\t\t\t// For newer documents, GC data should be present in the GC tree in the root of the snapshot.\n\t\t\t\t\tconst gcSnapshotTree = baseSnapshot.trees[gcTreeKey];\n\t\t\t\t\tif (gcSnapshotTree === undefined) {\n\t\t\t\t\t\t// back-compat - Older documents get their gc data reset for simplicity as there are few of them\n\t\t\t\t\t\t// incremental gc summary will not work with older gc data as well\n\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst snapshotData = await getGCDataFromSnapshot(gcSnapshotTree, readAndParseBlob);\n\n\t\t\t\t\t// If the GC version in base snapshot does not match the GC version currently in effect, the GC data\n\t\t\t\t\t// in the snapshot cannot be interpreted correctly. Set everything to undefined except for\n\t\t\t\t\t// deletedNodes because irrespective of GC versions, these nodes have been deleted and cannot be\n\t\t\t\t\t// brought back. The deletedNodes info is needed to identify when these nodes are used.\n\t\t\t\t\tif (this.configs.gcVersionInEffect !== this.configs.gcVersionInBaseSnapshot) {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tgcState: undefined,\n\t\t\t\t\t\t\ttombstones: undefined,\n\t\t\t\t\t\t\tdeletedNodes: snapshotData.deletedNodes,\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\treturn snapshotData;\n\t\t\t\t} catch (error) {\n\t\t\t\t\tconst dpe = DataProcessingError.wrapIfUnrecognized(error, \"FailedToInitializeGC\");\n\t\t\t\t\tdpe.addTelemetryProperties({\n\t\t\t\t\t\tgcConfigs: JSON.stringify(this.configs),\n\t\t\t\t\t});\n\t\t\t\t\tthrow dpe;\n\t\t\t\t}\n\t\t\t},\n\t\t);\n\n\t\t/**\n\t\t * Set up the initializer which initializes the GC state from the data in base snapshot. It sets up GC data\n\t\t * from the base GC state and starts tracking the state of unreferenced nodes.\n\t\t *\n\t\t * Must only be called if there is a current reference timestamp.\n\t\t */\n\t\tthis.initializeGCStateFromBaseSnapshotP = new LazyPromise<void>(async () => {\n\t\t\tconst currentReferenceTimestampMs = this.runtime.getCurrentReferenceTimestampMs();\n\t\t\tassert(\n\t\t\t\tcurrentReferenceTimestampMs !== undefined,\n\t\t\t\t0x8a4 /* Trying to initialize GC state without current timestamp */,\n\t\t\t);\n\n\t\t\t/**\n\t\t\t * The base snapshot data will not be present if the container is loaded from:\n\t\t\t * 1. The first summary created by the detached container.\n\t\t\t * 2. A summary that was generated with GC disabled.\n\t\t\t * 3. A summary that was generated before GC even existed.\n\t\t\t */\n\t\t\tconst baseSnapshotData = await this.baseSnapshotDataP;\n\t\t\tthis.summaryStateTracker.initializeBaseState(baseSnapshotData);\n\n\t\t\tif (baseSnapshotData?.gcState === undefined) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Update unreferenced state tracking as per the GC state in the snapshot data and update gcDataFromLastRun\n\t\t\t// to the GC data from the snapshot data.\n\t\t\tconst gcNodes: { [id: string]: string[] } = {};\n\t\t\tfor (const [nodeId, nodeData] of Object.entries(baseSnapshotData.gcState.gcNodes)) {\n\t\t\t\tif (nodeData.unreferencedTimestampMs !== undefined) {\n\t\t\t\t\tthis.unreferencedNodesState.set(\n\t\t\t\t\t\tnodeId,\n\t\t\t\t\t\tnew UnreferencedStateTracker(\n\t\t\t\t\t\t\tnodeData.unreferencedTimestampMs,\n\t\t\t\t\t\t\tthis.configs.inactiveTimeoutMs,\n\t\t\t\t\t\t\tcurrentReferenceTimestampMs,\n\t\t\t\t\t\t\tthis.configs.tombstoneTimeoutMs,\n\t\t\t\t\t\t\tthis.configs.sweepGracePeriodMs,\n\t\t\t\t\t\t),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tgcNodes[nodeId] = [...nodeData.outboundRoutes];\n\t\t\t}\n\t\t\tthis.gcDataFromLastRun = { gcNodes };\n\t\t});\n\n\t\t// Get the GC details from the GC state in the base summary. This is returned in getBaseGCDetails which is\n\t\t// used to initialize the GC state of all the nodes in the container.\n\t\tthis.baseGCDetailsP = new LazyPromise<IGarbageCollectionDetailsBase>(async () => {\n\t\t\tconst baseSnapshotData = await this.baseSnapshotDataP;\n\t\t\tif (baseSnapshotData?.gcState === undefined) {\n\t\t\t\treturn {};\n\t\t\t}\n\n\t\t\t// Note that the base GC details are returned even if GC is disabled. This is to handle the special scenario\n\t\t\t// where GC is disabled but GC state exists in base snapshot. In this scenario, the nodes which get the GC\n\t\t\t// state will re-summarize to reset any GC specific state in their summaries (like unreferenced flag).\n\n\t\t\tconst gcNodes: { [id: string]: string[] } = {};\n\t\t\tfor (const [nodeId, nodeData] of Object.entries(baseSnapshotData.gcState.gcNodes)) {\n\t\t\t\tgcNodes[nodeId] = [...nodeData.outboundRoutes];\n\t\t\t}\n\t\t\t// Run GC on the nodes in the base summary to get the routes used in each node in the container.\n\t\t\t// This is an optimization for space (vs performance) wherein we don't need to store the used routes of\n\t\t\t// each node in the summary.\n\t\t\tconst usedRoutes = runGarbageCollection(gcNodes, [\"/\"]).referencedNodeIds;\n\n\t\t\treturn { gcData: { gcNodes }, usedRoutes };\n\t\t});\n\n\t\t// Log all the GC options and the state determined by the garbage collector.\n\t\t// This is useful even for interactive clients since they track unreferenced nodes and log errors.\n\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\teventName: \"GarbageCollectorLoaded\",\n\t\t\tgcConfigs: JSON.stringify(this.configs),\n\t\t\tgcOptions: JSON.stringify(createParams.gcOptions),\n\t\t\t...createParams.createContainerMetadata,\n\t\t});\n\t}\n\n\t/**\n\t * API for ensuring the correct auto-recovery mitigations\n\t */\n\t// TODO: consider hoisting this to an outer scope as an optimization\n\t// eslint-disable-next-line unicorn/consistent-function-scoping\n\tprivate readonly autoRecovery = (() => {\n\t\t// This uses a hidden state machine for forcing fullGC as part of auto-recovery,\n\t\t// to regenerate the GC data for each node.\n\t\t//\n\t\t// Once fullGC has been requested, we need to wait until GC has run and the summary has been acked before clearing the state.\n\t\t//\n\t\t// States:\n\t\t// - undefined: No need to run fullGC now.\n\t\t// - \"requested\": FullGC requested, but GC has not yet run. Keep using fullGC until back to undefined.\n\t\t// - \"ran\": FullGC ran, but the following summary has not yet been acked. Keep using fullGC until back to undefined.\n\t\t//\n\t\t// Transitions:\n\t\t// - autoRecovery.requestFullGCOnNextRun :: [anything] --> \"requested\"\n\t\t// - autoRecovery.onCompletedGCRun :: \"requested\" --> \"ran\"\n\t\t// - autoRecovery.onSummaryAck :: \"ran\" --> undefined\n\t\tlet state: \"requested\" | \"ran\" | undefined;\n\t\treturn {\n\t\t\trequestFullGCOnNextRun: () => {\n\t\t\t\tstate = \"requested\";\n\t\t\t},\n\t\t\tonCompletedGCRun: () => {\n\t\t\t\tif (state === \"requested\") {\n\t\t\t\t\tstate = \"ran\";\n\t\t\t\t}\n\t\t\t},\n\t\t\tonSummaryAck: () => {\n\t\t\t\tif (state === \"ran\") {\n\t\t\t\t\tstate = undefined;\n\t\t\t\t}\n\t\t\t},\n\t\t\tuseFullGC: () => {\n\t\t\t\treturn state !== undefined;\n\t\t\t},\n\t\t};\n\t})();\n\n\t/**\n\t * Called during container initialization. Initializes the tombstone and deleted nodes state from the base snapshot.\n\t * Also, initializes the GC state including unreferenced nodes tracking if a current reference timestamp exists.\n\t * Note that if there is any GC state in the base snapshot, then there will definitely be a reference timestamp\n\t * to work with - The GC state would have been generated using a timestamp which is part of the snapshot.\n\t */\n\tpublic async initializeBaseState(): Promise<void> {\n\t\tconst baseSnapshotData = await this.baseSnapshotDataP;\n\t\t/**\n\t\t * The base snapshot data will not be present if the container is loaded from:\n\t\t * 1. The first summary created by the detached container.\n\t\t * 2. A summary that was generated with GC disabled.\n\t\t * 3. A summary that was generated before GC even existed.\n\t\t */\n\t\tif (baseSnapshotData === undefined) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Initialize the deleted nodes from the snapshot. This is done irrespective of whether GC / sweep is enabled\n\t\t// to identify deleted nodes' usage.\n\t\tif (baseSnapshotData.deletedNodes !== undefined) {\n\t\t\tthis.deletedNodes = new Set(baseSnapshotData.deletedNodes);\n\t\t}\n\n\t\t// Initialize the tombstone state from the snapshot. Also, notify the runtime of tombstone routes.\n\t\tif (baseSnapshotData.tombstones !== undefined) {\n\t\t\t// Create a copy since we are writing from a source we don't control\n\t\t\tthis.tombstones = [...baseSnapshotData.tombstones];\n\t\t\tthis.runtime.updateTombstonedRoutes(this.tombstones);\n\t\t}\n\n\t\tawait this.initializeOrUpdateGCState();\n\t}\n\n\t/**\n\t * Initialize the GC state if not already initialized. If GC state is already initialized, update the unreferenced\n\t * state tracking as per the current reference timestamp.\n\t */\n\tprivate async initializeOrUpdateGCState(): Promise<void> {\n\t\tconst currentReferenceTimestampMs = this.runtime.getCurrentReferenceTimestampMs();\n\t\tif (currentReferenceTimestampMs === undefined) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst initialized = this.gcDataFromLastRun !== undefined;\n\t\tawait PerformanceEvent.timedExecAsync(\n\t\t\tthis.mc.logger,\n\t\t\t{\n\t\t\t\teventName: \"InitializeOrUpdateGCState\",\n\t\t\t},\n\t\t\tasync (event) => {\n\t\t\t\t// If the GC state hasn't been initialized yet, initialize it and return.\n\t\t\t\tif (initialized) {\n\t\t\t\t\t// If the GC state has been initialized, update the tracking of unreferenced nodes as per the current\n\t\t\t\t\t// reference timestamp.\n\t\t\t\t\tfor (const [, nodeStateTracker] of this.unreferencedNodesState) {\n\t\t\t\t\t\tnodeStateTracker.updateTracking(currentReferenceTimestampMs);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tawait this.initializeGCStateFromBaseSnapshotP;\n\t\t\t\t}\n\t\t\t\tevent.end({\n\t\t\t\t\tdetails: { initialized, unrefNodeCount: this.unreferencedNodesState.size },\n\t\t\t\t});\n\t\t\t},\n\t\t);\n\t}\n\n\t/**\n\t * Called when the connection state of the runtime changes, i.e., it connects or disconnects. GC subscribes to this\n\t * to initialize or update the unreference state tracking.\n\t * @param connected - Whether the runtime connected / disconnected.\n\t * @param clientId - The clientId of this runtime.\n\t */\n\tpublic setConnectionState(connected: boolean, clientId?: string | undefined): void {\n\t\t/**\n\t\t * When the client connects (or reconnects), attempt to initialize or update the GC state. This will keep\n\t\t * the unreferenced state tracking updated as per the reference timestamp at the time of connection.\n\t\t *\n\t\t * During GC initialization and during connections in read mode, it is possible that either no ops are\n\t\t * processed or only trailing ops are processed. This means that the GC state is not initialized or initialized\n\t\t * with an older reference timestamp. So, doing this on every connection will keep the unreferenced state\n\t\t * tracking up-to-date.\n\t\t */\n\t\tif (connected && this.shouldRunGC) {\n\t\t\tthis.initializeOrUpdateGCState().catch((error) => {\n\t\t\t\tthis.mc.logger.sendErrorEvent(\n\t\t\t\t\t{\n\t\t\t\t\t\teventName: \"GCInitializationOrUpdateFailed\",\n\t\t\t\t\t\tgcConfigs: JSON.stringify(this.configs),\n\t\t\t\t\t\tclientId,\n\t\t\t\t\t},\n\t\t\t\t\terror,\n\t\t\t\t);\n\t\t\t});\n\t\t}\n\t}\n\n\t/**\n\t * Returns a the GC details generated from the base summary. This is used to initialize the GC state of the nodes\n\t * in the container.\n\t */\n\tpublic async getBaseGCDetails(): Promise<IGarbageCollectionDetailsBase> {\n\t\treturn this.baseGCDetailsP;\n\t}\n\n\t/**\n\t * Runs garbage collection and updates the reference / used state of the nodes in the container.\n\t * @returns stats of the GC run or undefined if GC did not run.\n\t */\n\tpublic async collectGarbage(\n\t\toptions: {\n\t\t\t/**\n\t\t\t * Logger to use for logging GC events\n\t\t\t */\n\t\t\tlogger?: ITelemetryLoggerExt;\n\t\t\t/**\n\t\t\t * True to run GC sweep phase after the mark phase\n\t\t\t */\n\t\t\trunSweep?: boolean;\n\t\t\t/**\n\t\t\t * True to generate full GC data\n\t\t\t */\n\t\t\tfullGC?: boolean;\n\t\t},\n\t\ttelemetryContext?: ITelemetryContext,\n\t): Promise<IGCStats | undefined> {\n\t\tconst fullGC =\n\t\t\toptions.fullGC ?? (this.configs.runFullGC === true || this.autoRecovery.useFullGC());\n\n\t\t// Add the options that are used to run GC to the telemetry context.\n\t\ttelemetryContext?.setMultiple(\"fluid_GC\", \"Options\", {\n\t\t\tfullGC,\n\t\t\trunSweep: options.runSweep,\n\t\t});\n\n\t\tconst logger = createChildLogger({\n\t\t\tlogger: options.logger ?? this.mc.logger,\n\t\t\tproperties: {\n\t\t\t\tall: { completedGCRuns: this.completedRuns, fullGC },\n\t\t\t},\n\t\t});\n\n\t\t/**\n\t\t * If there is no current reference timestamp, skip running GC. We need the current timestamp to track\n\t\t * how long objects have been unreferenced and if they should be deleted.\n\t\t *\n\t\t * Note that the only scenario where GC is called and there is no reference timestamp is when no ops have ever\n\t\t * been processed for this container and it is in read mode. In this scenario, there is no point in running GC\n\t\t * anyway because references in the container do not change without any ops, i.e., there is nothing to collect.\n\t\t */\n\t\tconst currentReferenceTimestampMs = this.runtime.getCurrentReferenceTimestampMs();\n\t\tif (currentReferenceTimestampMs === undefined) {\n\t\t\t// Log an event so we can evaluate how often we run into this scenario.\n\t\t\tlogger.sendErrorEvent({\n\t\t\t\teventName: \"CollectGarbageCalledWithoutTimestamp\",\n\t\t\t\tgcConfigs: JSON.stringify(this.configs),\n\t\t\t});\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn PerformanceEvent.timedExecAsync(\n\t\t\tlogger,\n\t\t\t{ eventName: \"GarbageCollection\" },\n\t\t\tasync (event) => {\n\t\t\t\t// #region Pre-GC steps\n\n\t\t\t\t// Ensure that state has been initialized from the base snapshot data.\n\t\t\t\tawait this.initializeGCStateFromBaseSnapshotP;\n\n\t\t\t\t// #endregion\n\n\t\t\t\t// #region GC step\n\n\t\t\t\tconst gcStats = await this.runGC(fullGC, currentReferenceTimestampMs, logger);\n\t\t\t\tevent.end({\n\t\t\t\t\t...gcStats,\n\t\t\t\t\tdetails: {\n\t\t\t\t\t\ttimestamp: currentReferenceTimestampMs,\n\t\t\t\t\t\tsweep: this.configs.sweepEnabled,\n\t\t\t\t\t\ttombstone: this.configs.throwOnTombstoneLoad,\n\t\t\t\t\t},\n\t\t\t\t});\n\n\t\t\t\t// #endregion\n\n\t\t\t\t// #region Post-GC steps\n\n\t\t\t\t// Log pending unreferenced events such as a node being used after inactive. This is done after GC runs and\n\t\t\t\t// updates its state so that we don't send false positives based on intermediate state. For example, we may get\n\t\t\t\t// reference to an unreferenced node from another unreferenced node which means the node wasn't revived.\n\t\t\t\tawait this.telemetryTracker.logPendingEvents(logger);\n\t\t\t\t// Update the state of summary state tracker from this run's stats.\n\t\t\t\tthis.summaryStateTracker.updateStateFromGCRunStats(gcStats);\n\t\t\t\tthis.autoRecovery.onCompletedGCRun();\n\t\t\t\tthis.newReferencesSinceLastRun.clear();\n\t\t\t\tthis.completedRuns++;\n\n\t\t\t\t// #endregion\n\n\t\t\t\treturn gcStats;\n\t\t\t},\n\t\t\t{ end: true, cancel: \"error\" },\n\t\t);\n\t}\n\n\t/**\n\t * Runs garbage collection. It does the following:\n\t *\n\t * 1. It generates / analyzes the runtime's reference graph.\n\t *\n\t * 2. Generates mark phase stats.\n\t *\n\t * 3. Runs Mark phase.\n\t *\n\t * 4. Runs Sweep phase.\n\t *\n\t * 5. Generates sweep phase stats.\n\t */\n\tprivate async runGC(\n\t\tfullGC: boolean,\n\t\tcurrentReferenceTimestampMs: number,\n\t\tlogger: ITelemetryLoggerExt,\n\t): Promise<IGCStats> {\n\t\t// 1. Generate / analyze the runtime's reference graph.\n\t\t// Get the reference graph (gcData) and run GC algorithm to get referenced / unreferenced nodes.\n\t\tconst gcData = await this.runtime.getGCData(fullGC);\n\t\tconst gcResult = runGarbageCollection(gcData.gcNodes, [\"/\"]);\n\t\t// Get all referenced nodes - References in this run + references between the previous and current runs.\n\t\tconst allReferencedNodeIds =\n\t\t\tthis.findAllNodesReferencedBetweenGCs(gcData, this.gcDataFromLastRun, logger) ??\n\t\t\tgcResult.referencedNodeIds;\n\n\t\t// 2. Get the mark phase stats based on the previous / current GC state.\n\t\t// This is done before running mark phase because we need the previous GC state before it is updated.\n\t\tconst markPhaseStats = this.getMarkPhaseStats(gcResult);\n\n\t\t// 3. Run the Mark phase.\n\t\t// It will mark nodes as referenced / unreferenced and return lists of tombstone-ready and sweep-ready nodes.\n\t\tconst { tombstoneReadyNodeIds, sweepReadyNodeIds } = this.runMarkPhase(\n\t\t\tgcResult,\n\t\t\tallReferencedNodeIds,\n\t\t\tcurrentReferenceTimestampMs,\n\t\t);\n\n\t\t// 4. Run the Sweep phase.\n\t\t// It will initiate the deletion (sending the GC Sweep op) of any sweep-ready nodes that are\n\t\t// allowed to be deleted per config, and tombstone the rest along with the tombstone-ready nodes.\n\t\t// Note that no nodes will be deleted until the GC Sweep op is processed.\n\t\tthis.runSweepPhase(gcResult, tombstoneReadyNodeIds, sweepReadyNodeIds);\n\n\t\tthis.gcDataFromLastRun = cloneGCData(gcData);\n\n\t\t// 5. Get the sweep phase stats.\n\t\tconst sweepPhaseStats = this.getSweepPhaseStats(\n\t\t\tthis.deletedNodes,\n\t\t\tsweepReadyNodeIds,\n\t\t\tmarkPhaseStats,\n\t\t);\n\n\t\treturn { ...markPhaseStats, ...sweepPhaseStats };\n\t}\n\n\t/**\n\t * Runs the GC Mark phase. It does the following:\n\t *\n\t * 1. Marks all referenced nodes in this run by clearing tracking for them.\n\t *\n\t * 2. Marks unreferenced nodes in this run by starting tracking for them.\n\t *\n\t * 3. Calls the runtime to update nodes that were marked referenced.\n\t *\n\t * @param gcResult - The result of the GC run on the gcData.\n\t * @param allReferencedNodeIds - Nodes referenced in this GC run + referenced between previous and current GC run.\n\t * @param currentReferenceTimestampMs - The timestamp to be used for unreferenced nodes' timestamp.\n\t * @returns The sets of tombstone-ready and sweep-ready nodes, i.e., nodes that ready to be tombstoned or deleted.\n\t */\n\tprivate runMarkPhase(\n\t\tgcResult: IGCResult,\n\t\tallReferencedNodeIds: string[],\n\t\tcurrentReferenceTimestampMs: number,\n\t): { tombstoneReadyNodeIds: Set<string>; sweepReadyNodeIds: Set<string> } {\n\t\t// 1. Marks all referenced nodes by clearing their unreferenced tracker, if any.\n\t\tfor (const nodeId of allReferencedNodeIds) {\n\t\t\tthis.unreferencedNodesState.delete(nodeId);\n\t\t}\n\n\t\t// 2. Mark unreferenced nodes in this run by starting or updating unreferenced tracking for them.\n\t\tconst tombstoneReadyNodeIds: Set<string> = new Set();\n\t\tconst sweepReadyNodeIds: Set<string> = new Set();\n\t\tfor (const nodeId of gcResult.deletedNodeIds) {\n\t\t\tconst nodeStateTracker = this.unreferencedNodesState.get(nodeId);\n\t\t\tif (nodeStateTracker === undefined) {\n\t\t\t\tthis.unreferencedNodesState.set(\n\t\t\t\t\tnodeId,\n\t\t\t\t\tnew UnreferencedStateTracker(\n\t\t\t\t\t\tcurrentReferenceTimestampMs,\n\t\t\t\t\t\tthis.configs.inactiveTimeoutMs,\n\t\t\t\t\t\tcurrentReferenceTimestampMs,\n\t\t\t\t\t\tthis.configs.tombstoneTimeoutMs,\n\t\t\t\t\t\tthis.configs.sweepGracePeriodMs,\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\t// If a node was already unreferenced, update its tracking information. Since the current reference time\n\t\t\t\t// is from the ops seen, this will ensure that we keep updating unreferenced state as time moves forward.\n\t\t\t\tnodeStateTracker.updateTracking(currentReferenceTimestampMs);\n\n\t\t\t\t// If a node is tombstone or sweep-ready, store it so it can be returned.\n\t\t\t\tif (nodeStateTracker.state === UnreferencedState.TombstoneReady) {\n\t\t\t\t\ttombstoneReadyNodeIds.add(nodeId);\n\t\t\t\t}\n\t\t\t\tif (nodeStateTracker.state === UnreferencedState.SweepReady) {\n\t\t\t\t\tsweepReadyNodeIds.add(nodeId);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// 3. Call the runtime to update referenced nodes in this run.\n\t\tthis.runtime.updateUsedRoutes(gcResult.referencedNodeIds);\n\n\t\treturn { tombstoneReadyNodeIds, sweepReadyNodeIds };\n\t}\n\n\t/**\n\t * Runs the GC Sweep phase. It does the following:\n\t *\n\t * 1. Marks tombstone-ready nodes as tombstones.\n\t *\n\t * 2. Sends a sweep op to delete nodes that are sweep-ready. Once the op is ack'd, these nodes will be deleted.\n\t *\n\t * @param gcResult - The result of the GC run on the gcData.\n\t * @param tombstoneReadyNodes - List of nodes that are tombstone-ready.\n\t * @param sweepReadyNodes - List of nodes that are sweep-ready.\n\t */\n\tprivate runSweepPhase(\n\t\tgcResult: IGCResult,\n\t\ttombstoneReadyNodes: Set<string>,\n\t\tsweepReadyNodes: Set<string>,\n\t): void {\n\t\t/**\n\t\t * Under \"Test Mode\", unreferenced nodes are immediately deleted without waiting for them to be sweep-ready.\n\t\t *\n\t\t * Otherwise, depending on how long it's been since the node was unreferenced, it will either be\n\t\t * marked as Tombstone, or deleted by Sweep.\n\t\t */\n\n\t\tif (this.configs.testMode) {\n\t\t\t// If we are running in GC test mode, unreferenced nodes (gcResult.deletedNodeIds) are deleted immediately.\n\t\t\tthis.runtime.deleteSweepReadyNodes(gcResult.deletedNodeIds);\n\t\t\treturn;\n\t\t}\n\n\t\t// We'll build up the lists of nodes to be either Tombstoned or Deleted\n\t\t// based on the configuration and the nodes' current state.\n\t\t// We must Tombstone any sweep-ready node that Sweep won't run for.\n\t\t// This is important because a container may never load during a node's Sweep Grace Period,\n\t\t// so that node would directly become sweep-ready skipping over tombstone-ready state,\n\t\t// but should be Tombstoned since Sweep is disabled.\n\t\tconst { nodesToTombstone, nodesToDelete } = this.configs.sweepEnabled\n\t\t\t? {\n\t\t\t\t\tnodesToDelete: [...sweepReadyNodes],\n\t\t\t\t\tnodesToTombstone: [...tombstoneReadyNodes],\n\t\t\t\t}\n\t\t\t: {\n\t\t\t\t\tnodesToDelete: [],\n\t\t\t\t\tnodesToTombstone: [...tombstoneReadyNodes, ...sweepReadyNodes],\n\t\t\t\t};\n\n\t\tthis.tombstones = nodesToTombstone;\n\t\tthis.runtime.updateTombstonedRoutes(this.tombstones);\n\n\t\tif (nodesToDelete.length > 0) {\n\t\t\t// Do not send DDS node ids in the GC op. This is an optimization to reduce its size. Since GC applies to\n\t\t\t// to data store only, all its DDSes are deleted along with it. The DDS ids will be retrieved from the\n\t\t\t// local state when processing the op.\n\t\t\tconst sweepReadyDSAndBlobs = nodesToDelete.filter((nodeId) => {\n\t\t\t\tconst nodeType = this.runtime.getNodeType(nodeId);\n\n\t\t\t\treturn nodeType === GCNodeType.DataStore || nodeType === GCNodeType.Blob;\n\t\t\t});\n\t\t\tconst contents: GarbageCollectionMessage = {\n\t\t\t\ttype: GarbageCollectionMessageType.Sweep,\n\t\t\t\tdeletedNodeIds: sweepReadyDSAndBlobs,\n\t\t\t};\n\n\t\t\tconst containerGCMessage: ContainerRuntimeGCMessage = {\n\t\t\t\ttype: ContainerMessageType.GC,\n\t\t\t\tcontents,\n\t\t\t};\n\t\t\tthis.submitMessage(containerGCMessage);\n\t\t\treturn;\n\t\t}\n\t}\n\n\t/**\n\t * Since GC runs periodically, the GC data that is generated only tells us the state of the world at that point in\n\t * time. There can be nodes that were referenced in between two runs and their unreferenced state needs to be\n\t * updated. For example, in the following scenarios not updating the unreferenced timestamp can lead to deletion of\n\t * these objects while there can be in-memory referenced to it:\n\t * 1. A node transitions from `unreferenced -> referenced -> unreferenced` between two runs. When the reference is\n\t * added, the object may have been accessed and in-memory reference to it added.\n\t * 2. A reference is added from one unreferenced node to one or more unreferenced nodes. Even though the node[s] were\n\t * unreferenced, they could have been accessed and in-memory reference to them added.\n\t *\n\t * This function identifies nodes that were referenced since the last run.\n\t * If these nodes are currently unreferenced, they will be assigned new unreferenced state by the current run.\n\t *\n\t * @returns A list of all nodes referenced from the last local summary until now.\n\t */\n\tprivate findAllNodesReferencedBetweenGCs(\n\t\tcurrentGCData: IGarbageCollectionData,\n\t\tpreviousGCData: IGarbageCollectionData | undefined,\n\t\tlogger: ITelemetryLoggerExt,\n\t): string[] | undefined {\n\t\t// If we haven't run GC before there is nothing to do.\n\t\t// No previousGCData, means nothing is unreferenced, and there are no reference state trackers to clear\n\t\tif (previousGCData === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\t/**\n\t\t * If there are references that were not explicitly notified to GC, log an error because this should never happen.\n\t\t * If it does, this may result in the unreferenced timestamps of these nodes not updated when they were referenced.\n\t\t */\n\t\tthis.telemetryTracker.logIfMissingExplicitReferences(\n\t\t\tcurrentGCData,\n\t\t\tpreviousGCData,\n\t\t\tthis.newReferencesSinceLastRun,\n\t\t\tlogger,\n\t\t);\n\n\t\t// No references were added since the last run so we don't have to update reference states of any unreferenced\n\t\t// nodes. There is no in between state at this point.\n\t\tif (this.newReferencesSinceLastRun.size === 0) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\t/**\n\t\t * Generate a super set of the GC data that contains the nodes and edges from last run, plus any new node and\n\t\t * edges that have been added since then. To do this, combine the GC data from the last run and the current\n\t\t * run, and then add the references since last run.\n\t\t *\n\t\t * Note on why we need to combine the data from previous run, current run and all references in between -\n\t\t * 1. We need data from last run because some of its references may have been deleted since then. If those\n\t\t * references added new outbound references before they were deleted, we need to detect them.\n\t\t *\n\t\t * 2. We need new outbound references since last run because some of them may have been deleted later. If those\n\t\t * references added new outbound references before they were deleted, we need to detect them.\n\t\t *\n\t\t * 3. We need data from the current run because currently we may not detect when DDSes are referenced:\n\t\t * - We don't require DDSes handles to be stored in a referenced DDS.\n\t\t * - A new data store may have \"root\" DDSes already created and we don't detect them today.\n\t\t */\n\t\tconst gcDataSuperSet = concatGarbageCollectionData(previousGCData, currentGCData);\n\t\tconst newOutboundRoutesSinceLastRun: string[] = [];\n\t\tfor (const [sourceNodeId, outboundRoutes] of this.newReferencesSinceLastRun) {\n\t\t\tif (gcDataSuperSet.gcNodes[sourceNodeId] === undefined) {\n\t\t\t\tgcDataSuperSet.gcNodes[sourceNodeId] = outboundRoutes;\n\t\t\t} else {\n\t\t\t\tgcDataSuperSet.gcNodes[sourceNodeId].push(...outboundRoutes);\n\t\t\t}\n\t\t\tnewOutboundRoutesSinceLastRun.push(...outboundRoutes);\n\t\t}\n\n\t\t/**\n\t\t * Run GC on the above reference graph starting with root and all new outbound routes. This will generate a\n\t\t * list of all nodes that could have been referenced since the last run. If any of these nodes are unreferenced,\n\t\t * unreferenced, stop tracking them and remove from unreferenced list.\n\t\t * Note that some of these nodes may be unreferenced now and if so, the current run will mark them as\n\t\t * unreferenced and add unreferenced state.\n\t\t */\n\t\tconst gcResult = runGarbageCollection(gcDataSuperSet.gcNodes, [\n\t\t\t\"/\",\n\t\t\t...newOutboundRoutesSinceLastRun,\n\t\t]);\n\t\treturn gcResult.referencedNodeIds;\n\t}\n\n\t/**\n\t * Summarizes the GC data and returns it as a summary tree.\n\t * We current write the entire GC state in a single blob. This can be modified later to write multiple\n\t * blobs. All the blob keys should start with `gcBlobPrefix`.\n\t */\n\tpublic summarize(\n\t\tfullTree: boolean,\n\t\ttrackState: boolean,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): ISummarizeResult | undefined {\n\t\tif (!this.shouldRunGC || this.gcDataFromLastRun === undefined) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst gcState: IGarbageCollectionState = { gcNodes: {} };\n\t\tfor (const [nodeId, outboundRoutes] of Object.entries(this.gcDataFromLastRun.gcNodes)) {\n\t\t\tgcState.gcNodes[nodeId] = {\n\t\t\t\toutboundRoutes,\n\t\t\t\tunreferencedTimestampMs:\n\t\t\t\t\tthis.unreferencedNodesState.get(nodeId)?.unreferencedTimestampMs,\n\t\t\t};\n\t\t}\n\n\t\treturn this.summaryStateTracker.summarize(\n\t\t\ttrackState && !fullTree,\n\t\t\tgcState,\n\t\t\tthis.deletedNodes,\n\t\t\tthis.tombstones,\n\t\t);\n\t}\n\n\tpublic getMetadata(): IGCMetadata {\n\t\treturn {\n\t\t\t/**\n\t\t\t * If GC is allowed, the GC data is written using the GC version in effect and that is the gcFeature that goes\n\t\t\t * into the metadata blob. If GC is disabled, the gcFeature is 0.\n\t\t\t */\n\t\t\tgcFeature: this.configs.gcAllowed ? this.configs.gcVersionInEffect : 0,\n\t\t\tgcFeatureMatrix: this.configs.persistedGcFeatureMatrix,\n\t\t\tsessionExpiryTimeoutMs: this.configs.sessionExpiryTimeoutMs,\n\t\t\tsweepEnabled: false, // DEPRECATED - to be removed\n\t\t\ttombstoneTimeoutMs: this.configs.tombstoneTimeoutMs,\n\t\t};\n\t}\n\n\t/**\n\t * Called to refresh the latest summary state. This happens when either a pending summary is acked.\n\t */\n\tpublic async refreshLatestSummary(result: IRefreshSummaryResult): Promise<void> {\n\t\tthis.autoRecovery.onSummaryAck();\n\t\treturn this.summaryStateTracker.refreshLatestSummary(result);\n\t}\n\n\t/**\n\t * Process GC messages.\n\t * @param messageContents - The contents of the messages.\n\t * @param messageTimestampMs - The timestamp of the messages.\n\t * @param local - Whether it was send by this client.\n\t */\n\tpublic processMessages(\n\t\tmessageContents: GarbageCollectionMessage[],\n\t\tmessageTimestampMs: number,\n\t\tlocal: boolean,\n\t): void {\n\t\tfor (const gcMessage of messageContents) {\n\t\t\tconst gcMessageType = gcMessage.type;\n\t\t\tswitch (gcMessageType) {\n\t\t\t\tcase GarbageCollectionMessageType.Sweep: {\n\t\t\t\t\t// Delete the nodes whose ids are present in the contents.\n\t\t\t\t\tthis.deleteSweepReadyNodes(gcMessage.deletedNodeIds);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase GarbageCollectionMessageType.TombstoneLoaded: {\n\t\t\t\t\t// Mark the node as referenced to ensure it isn't Swept\n\t\t\t\t\tconst tombstonedNodePath = gcMessage.nodePath;\n\t\t\t\t\tthis.addedOutboundReference(\n\t\t\t\t\t\t\"/\",\n\t\t\t\t\t\ttombstonedNodePath,\n\t\t\t\t\t\tmessageTimestampMs,\n\t\t\t\t\t\ttrue /* autorecovery */,\n\t\t\t\t\t);\n\n\t\t\t\t\t// In case the cause of the TombstoneLoaded event is incorrect GC Data (i.e. the object is actually reachable),\n\t\t\t\t\t// do fullGC on the next run to get a chance to repair (in the likely case the bug is not deterministic)\n\t\t\t\t\tthis.autoRecovery.requestFullGCOnNextRun();\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tdefault: {\n\t\t\t\t\tthrow DataProcessingError.create(\n\t\t\t\t\t\t`Garbage collection message of unknown type ${gcMessageType}`,\n\t\t\t\t\t\t\"processMessage\",\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Delete nodes that are sweep-ready. Call the runtime to delete these nodes and clear the unreferenced state\n\t * tracking for nodes that are actually deleted by the runtime.\n\t *\n\t * Note that this doesn't check any configuration around whether Sweep is enabled.\n\t * That happens before the op is submitted, and from that point, any client should execute the delete.\n\t *\n\t * @param sweepReadyNodeIds - The ids of nodes that are ready to be deleted.\n\t */\n\tprivate deleteSweepReadyNodes(sweepReadyNodeIds: readonly string[]): void {\n\t\t// Use a set for lookup because its much faster than array or map.\n\t\tconst sweepReadyNodesSet: Set<string> = new Set(sweepReadyNodeIds);\n\n\t\t// The ids in the sweep-ready nodes do not contain DDS node ids. This is an optimization to reduce the size\n\t\t// of the GC op. Since GC applies to data store only, all its DDSes are deleted along with it. So, get the\n\t\t// DDS nodes ID from the unreferenced nodes state.\n\t\tconst allSweepReadyNodeIds = [...sweepReadyNodeIds];\n\t\tfor (const [id] of this.unreferencedNodesState) {\n\t\t\t// Ignore data store nodes since they would already be in the list.\n\t\t\tconst pathParts = id.split(\"/\");\n\t\t\tif (pathParts.length <= 2) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// Get the data store id part. Note that this may include blobs but that's okay since the part would just\n\t\t\t// be \"_blobs\" and it won't be found.\n\t\t\tconst dsId = `/${pathParts[1]}`;\n\t\t\tif (sweepReadyNodesSet.has(dsId)) {\n\t\t\t\tallSweepReadyNodeIds.push(id);\n\t\t\t}\n\t\t}\n\t\tconst deletedNodeIds = this.runtime.deleteSweepReadyNodes(allSweepReadyNodeIds);\n\n\t\t// Clear unreferenced state tracking for deleted nodes.\n\t\tfor (const nodeId of deletedNodeIds) {\n\t\t\t// Usually we avoid modifying the set of unreferencedNodesState keys in between GC runs,\n\t\t\t// but this is ok since this node won't exist at all in the next GC run.\n\t\t\tthis.unreferencedNodesState.delete(nodeId);\n\t\t\tthis.deletedNodes.add(nodeId);\n\t\t}\n\t}\n\n\t/**\n\t * Called when a node with the given id is updated. If the node is inactive or tombstoned, this will log an error\n\t * or throw an error if failing on incorrect usage is configured.\n\t * @param IGCNodeUpdatedProps - Details about the node and how it was updated\n\t */\n\tpublic nodeUpdated({\n\t\tnode,\n\t\treason,\n\t\ttimestampMs,\n\t\tpackagePath,\n\t\trequest,\n\t\theaderData,\n\t\tadditionalProps,\n\t}: IGCNodeUpdatedProps): void {\n\t\t// If there is no reference timestamp to work with, no ops have been processed after creation. If so, skip\n\t\t// logging as nothing interesting would have happened worth logging.\n\t\tif (!this.shouldRunGC || timestampMs === undefined) {\n\t\t\treturn;\n\t\t}\n\n\t\t// trackedId will be either DataStore or Blob ID (not sub-DataStore ID, since some of those are unrecognized by GC)\n\t\tconst trackedId = node.path;\n\t\tconst isTombstoned = this.tombstones.includes(trackedId);\n\t\tconst fullPath = request === undefined ? trackedId : urlToGCNodePath(request.url);\n\n\t\t// This will log if appropriate\n\t\tthis.telemetryTracker.nodeUsed(trackedId, {\n\t\t\tid: fullPath,\n\t\t\tusageType: reason,\n\t\t\tcurrentReferenceTimestampMs: timestampMs,\n\t\t\tpackagePath,\n\t\t\tcompletedGCRuns: this.completedRuns,\n\t\t\tisTombstoned,\n\t\t\tlastSummaryTime: this.getLastSummaryTimestampMs(),\n\t\t\theaders: headerData,\n\t\t\trequestUrl: request?.url,\n\t\t\trequestHeaders: JSON.stringify(request?.headers),\n\t\t\tadditionalProps,\n\t\t});\n\n\t\t// Any time we log a Tombstone Loaded error (via Telemetry Tracker),\n\t\t// we want to also trigger autorecovery to avoid the object being deleted\n\t\t// i.e. this will be preceded by one of these telemetry events;\n\t\t// GC_Tombstone_DataStore_Requested, GC_Tombstone_SubDataStore_Requested, GC_Tombstone_Blob_Requested\n\t\t// Note: We don't need to trigger on \"Changed\" because any change will cause the object\n\t\t// to be loaded by the Summarizer, and auto-recovery will be triggered then.\n\t\tif (isTombstoned && reason === \"Loaded\") {\n\t\t\t// Note that when a DataStore and its DDS are all loaded, each will trigger AutoRecovery for itself.\n\t\t\tthis.triggerAutoRecovery(fullPath);\n\t\t}\n\n\t\tconst nodeType = this.runtime.getNodeType(fullPath);\n\n\t\t// Unless this is a Loaded event for a Blob or DataStore, we're done after telemetry tracking\n\t\tconst loadedBlobOrDataStore =\n\t\t\treason === \"Loaded\" &&\n\t\t\t(nodeType === GCNodeType.Blob || nodeType === GCNodeType.DataStore);\n\t\tif (!loadedBlobOrDataStore) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst errorRequest: IRequest = request ?? { url: fullPath };\n\t\tif (\n\t\t\tisTombstoned &&\n\t\t\tthis.configs.throwOnTombstoneLoad &&\n\t\t\theaderData?.allowTombstone !== true\n\t\t) {\n\t\t\t// The requested data store is removed by gc. Create a 404 gc response exception.\n\t\t\tthrow responseToException(\n\t\t\t\tcreateResponseError(404, `${nodeType} was tombstoned`, errorRequest, {\n\t\t\t\t\t[TombstoneResponseHeaderKey]: true,\n\t\t\t\t}),\n\t\t\t\terrorRequest,\n\t\t\t);\n\t\t}\n\t}\n\n\t/**\n\t * The given node should have its unreferenced state reset in the next GC,\n\t * even if the true GC graph shows it is unreferenced. This will\n\t * prevent it from being deleted by Sweep (after the Grace Period).\n\t *\n\t * Submit a GC op indicating that the Tombstone with the given path has been loaded.\n\t * Broadcasting this information in the op stream allows the Summarizer to reset unreferenced state\n\t * before running GC next.\n\t */\n\tprivate triggerAutoRecovery(nodePath: string): void {\n\t\t// If sweep isn't enabled, auto-recovery isn't needed since its purpose is to prevent this object from being\n\t\t// deleted. It also would end up sending a GC op which can break clients running FF version 1.x.\n\t\tif (!this.configs.sweepEnabled) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst containerGCMessage: ContainerRuntimeGCMessage = {\n\t\t\ttype: ContainerMessageType.GC,\n\t\t\tcontents: {\n\t\t\t\ttype: GarbageCollectionMessageType.TombstoneLoaded,\n\t\t\t\tnodePath,\n\t\t\t},\n\t\t};\n\t\tthis.submitMessage(containerGCMessage);\n\t}\n\n\t/**\n\t * Called when an outbound reference is added to a node. This is used to identify all nodes that have been\n\t * referenced between summaries so that their unreferenced timestamp can be reset.\n\t *\n\t * @param fromNodePath - The node from which the reference is added.\n\t * @param toNodePath - The node to which the reference is added.\n\t * @param timestampMs - The timestamp of the message that added the reference.\n\t * @param autorecovery - This reference is added artificially, for autorecovery. Used for logging.\n\t */\n\tpublic addedOutboundReference(\n\t\tfromNodePath: string,\n\t\ttoNodePath: string,\n\t\ttimestampMs: number,\n\t\tautorecovery?: true,\n\t): void {\n\t\tif (!this.shouldRunGC) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (!toNodePath.startsWith(\"/\")) {\n\t\t\t// A long time ago we stored handles with relatives paths. We don't expect to see these cases though\n\t\t\t// because GC was enabled only after we made the switch to always using absolute paths.\n\t\t\tthis.mc.logger.sendErrorEvent({\n\t\t\t\teventName: \"InvalidRelativeOutboundRoute\",\n\t\t\t\t...tagCodeArtifacts({ fromId: fromNodePath, id: toNodePath }),\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\tassert(fromNodePath.startsWith(\"/\"), 0x8a5 /* fromNodePath must be an absolute path */);\n\n\t\tconst outboundRoutes = this.newReferencesSinceLastRun.get(fromNodePath) ?? [];\n\t\toutboundRoutes.push(toNodePath);\n\t\tthis.newReferencesSinceLastRun.set(fromNodePath, outboundRoutes);\n\n\t\t// GC won't recognize some subDataStore paths that we encounter (e.g. a path suited for a custom request handler)\n\t\t// So for subDataStore paths we need to check the parent dataStore for current tombstone/inactive status.\n\t\tconst trackedId =\n\t\t\tthis.runtime.getNodeType(toNodePath) === \"SubDataStore\"\n\t\t\t\t? dataStoreNodePathOnly(toNodePath)\n\t\t\t\t: toNodePath;\n\t\tthis.telemetryTracker.nodeUsed(trackedId, {\n\t\t\tid: toNodePath,\n\t\t\tfromId: fromNodePath,\n\t\t\tusageType: \"Revived\",\n\t\t\tcurrentReferenceTimestampMs: timestampMs,\n\t\t\tpackagePath: undefined,\n\t\t\tcompletedGCRuns: this.completedRuns,\n\t\t\tisTombstoned: this.tombstones.includes(trackedId),\n\t\t\tlastSummaryTime: this.getLastSummaryTimestampMs(),\n\t\t\tautorecovery,\n\t\t});\n\n\t\t// This node is referenced - Clear its unreferenced state if present\n\t\t// But don't delete the node id from the map yet.\n\t\t// When generating GC stats, the set of nodes in here is used as the baseline for\n\t\t// what was unreferenced in the last GC run.\n\t\t// NOTE: We use toNodePath not trackedId even though it may be an unrecognized subDataStore route (hence no-op),\n\t\t// because a reference to such a path is not sufficient to consider the DataStore referenced.\n\t\tthis.unreferencedNodesState.get(toNodePath)?.stopTracking();\n\t}\n\n\t/**\n\t * Returns whether a node with the given path has been deleted or not. This can be used by the runtime to identify\n\t * cases where objects are used after they are deleted and throw / log errors accordingly.\n\t */\n\tpublic isNodeDeleted(nodePath: string): boolean {\n\t\treturn this.deletedNodes.has(nodePath);\n\t}\n\n\tpublic dispose(): void {\n\t\tthis.sessionExpiryTimer?.clear();\n\t\tthis.sessionExpiryTimer = undefined;\n\n\t\t// Clear all unreferenced node timers to prevent process hanging\n\t\tfor (const tracker of this.unreferencedNodesState.values()) {\n\t\t\ttracker.stopTracking();\n\t\t}\n\t\tthis.unreferencedNodesState.clear();\n\t}\n\n\t/**\n\t * Generates the stats of a garbage collection mark phase run.\n\t * @param gcResult - The result of the current GC run.\n\t * @returns the stats of the mark phase run.\n\t */\n\n\tprivate getMarkPhaseStats(gcResult: IGCResult): IMarkPhaseStats {\n\t\tconst markPhaseStats: IMarkPhaseStats = {\n\t\t\tnodeCount: 0,\n\t\t\tdataStoreCount: 0,\n\t\t\tattachmentBlobCount: 0,\n\t\t\tunrefNodeCount: 0,\n\t\t\tunrefDataStoreCount: 0,\n\t\t\tunrefAttachmentBlobCount: 0,\n\t\t\tupdatedNodeCount: 0,\n\t\t\tupdatedDataStoreCount: 0,\n\t\t\tupdatedAttachmentBlobCount: 0,\n\t\t};\n\n\t\tconst updateNodeStats = (nodeId: string, isReferenced: boolean): void => {\n\t\t\tmarkPhaseStats.nodeCount++;\n\t\t\t// If there is no previous GC data, every node's state is generated and is considered as updated.\n\t\t\t// Otherwise, find out if any node went from referenced to unreferenced or vice-versa.\n\t\t\tconst wasNotReferenced = this.unreferencedNodesState.has(nodeId);\n\t\t\tconst stateUpdated =\n\t\t\t\tthis.gcDataFromLastRun === undefined || wasNotReferenced === isReferenced;\n\t\t\tif (stateUpdated) {\n\t\t\t\tmarkPhaseStats.updatedNodeCount++;\n\t\t\t}\n\t\t\tif (!isReferenced) {\n\t\t\t\tmarkPhaseStats.unrefNodeCount++;\n\t\t\t}\n\n\t\t\tif (this.runtime.getNodeType(nodeId) === GCNodeType.DataStore) {\n\t\t\t\tmarkPhaseStats.dataStoreCount++;\n\t\t\t\tif (stateUpdated) {\n\t\t\t\t\tmarkPhaseStats.updatedDataStoreCount++;\n\t\t\t\t}\n\t\t\t\tif (!isReferenced) {\n\t\t\t\t\tmarkPhaseStats.unrefDataStoreCount++;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (this.runtime.getNodeType(nodeId) === GCNodeType.Blob) {\n\t\t\t\tmarkPhaseStats.attachmentBlobCount++;\n\t\t\t\tif (stateUpdated) {\n\t\t\t\t\tmarkPhaseStats.updatedAttachmentBlobCount++;\n\t\t\t\t}\n\t\t\t\tif (!isReferenced) {\n\t\t\t\t\tmarkPhaseStats.unrefAttachmentBlobCount++;\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tfor (const nodeId of gcResult.referencedNodeIds) {\n\t\t\tupdateNodeStats(nodeId, true /* referenced */);\n\t\t}\n\n\t\tfor (const nodeId of gcResult.deletedNodeIds) {\n\t\t\tupdateNodeStats(nodeId, false /* referenced */);\n\t\t}\n\n\t\treturn markPhaseStats;\n\t}\n\n\t/**\n\t * Generates the stats of a garbage collection sweep phase run.\n\t * @param deletedNodes - The nodes that have already been deleted even before this run.\n\t * @param sweepReadyNodes - The nodes that are sweep-ready in this GC run. These will be deleted but are not deleted yet,\n\t * due to either sweep not being enabled or the Sweep Op needing to roundtrip before the delete is executed.\n\t * @param markPhaseStats - The stats of the mark phase run.\n\t * @returns the stats of the sweep phase run.\n\t */\n\tprivate getSweepPhaseStats(\n\t\tdeletedNodes: Set<string>,\n\t\tsweepReadyNodes: Set<string>,\n\n\t\tmarkPhaseStats: IMarkPhaseStats,\n\t): ISweepPhaseStats {\n\t\t// Initialize the life time node counts to the mark phase node counts. If sweep is not enabled,\n\t\t// these will be the life time node count for this container.\n\n\t\tconst sweepPhaseStats: ISweepPhaseStats = {\n\t\t\tlifetimeNodeCount: markPhaseStats.nodeCount,\n\t\t\tlifetimeDataStoreCount: markPhaseStats.dataStoreCount,\n\t\t\tlifetimeAttachmentBlobCount: markPhaseStats.attachmentBlobCount,\n\t\t\tdeletedNodeCount: 0,\n\t\t\tdeletedDataStoreCount: 0,\n\t\t\tdeletedAttachmentBlobCount: 0,\n\t\t};\n\n\t\t// The runtime can't reliably identify the type of deleted nodes. So, get the type here. This should\n\t\t// be good enough because the only types that participate in GC today are data stores, DDSes and blobs.\n\t\t// eslint-disable-next-line unicorn/consistent-function-scoping\n\t\tconst getDeletedNodeType = (nodeId: string): GCNodeType => {\n\t\t\tconst pathParts = nodeId.split(\"/\");\n\t\t\tif (pathParts[1] === blobManagerBasePath) {\n\t\t\t\treturn GCNodeType.Blob;\n\t\t\t}\n\t\t\tif (pathParts.length === 2) {\n\t\t\t\treturn GCNodeType.DataStore;\n\t\t\t}\n\t\t\tif (pathParts.length === 3) {\n\t\t\t\treturn GCNodeType.SubDataStore;\n\t\t\t}\n\n\t\t\treturn GCNodeType.Other;\n\t\t};\n\n\t\tfor (const nodeId of deletedNodes) {\n\t\t\tsweepPhaseStats.deletedNodeCount++;\n\t\t\tconst nodeType = getDeletedNodeType(nodeId);\n\n\t\t\tif (nodeType === GCNodeType.DataStore) {\n\t\t\t\tsweepPhaseStats.deletedDataStoreCount++;\n\t\t\t} else if (nodeType === GCNodeType.Blob) {\n\t\t\t\tsweepPhaseStats.deletedAttachmentBlobCount++;\n\t\t\t}\n\t\t}\n\n\t\t// The counts from the mark phase stats do not include nodes that were\n\t\t// deleted in previous runs. So, add the deleted node counts to life time stats.\n\t\tsweepPhaseStats.lifetimeNodeCount += sweepPhaseStats.deletedNodeCount;\n\t\tsweepPhaseStats.lifetimeDataStoreCount += sweepPhaseStats.deletedDataStoreCount;\n\t\tsweepPhaseStats.lifetimeAttachmentBlobCount += sweepPhaseStats.deletedAttachmentBlobCount;\n\n\t\t// These stats are used to estimate the impact of GC in terms of how much garbage is/will be cleaned up.\n\t\t// So we include the current sweep-ready node stats since these nodes will be deleted eventually.\n\t\t// - If sweep is enabled, this will happen in the run after the GC op round trips back\n\t\t// (they'll be in deletedNodes that time).\n\t\t// - If sweep is not enabled, we still want to include these nodes since they\n\t\t// _will be_ deleted once it is enabled.\n\t\tfor (const nodeId of sweepReadyNodes) {\n\t\t\tsweepPhaseStats.deletedNodeCount++;\n\t\t\tconst nodeType = this.runtime.getNodeType(nodeId);\n\n\t\t\tif (nodeType === GCNodeType.DataStore) {\n\t\t\t\tsweepPhaseStats.deletedDataStoreCount++;\n\t\t\t} else if (nodeType === GCNodeType.Blob) {\n\t\t\t\tsweepPhaseStats.deletedAttachmentBlobCount++;\n\t\t\t}\n\t\t}\n\n\t\treturn sweepPhaseStats;\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"garbageCollection.js","sourceRoot":"","sources":["../../src/gc/garbageCollection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,qCAAqC,CAAC;AAEjF,OAAO,EAGN,SAAS,GAGT,MAAM,8CAA8C,CAAC;AACtD,OAAO,EACN,mBAAmB,EACnB,mBAAmB,GACnB,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAEN,mBAAmB,EAEnB,gBAAgB,EAChB,iBAAiB,EACjB,4BAA4B,EAC5B,gBAAgB,GAChB,MAAM,0CAA0C,CAAC;AAElD,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBA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AAwG;QACxG,iGAAiG;QACjG,sFAAsF;QACtF,4CAA4C;QAC5C,6EAA6E;QAC7E,0CAA0C;QAC1C,KAAK,MAAM,MAAM,IAAI,eAAe,EAAE,CAAC;YACtC,eAAe,CAAC,gBAAgB,EAAE,CAAC;YACnC,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;YAElD,IAAI,QAAQ,KAAK,UAAU,CAAC,SAAS,EAAE,CAAC;gBACvC,eAAe,CAAC,qBAAqB,EAAE,CAAC;YACzC,CAAC;iBAAM,IAAI,QAAQ,KAAK,UAAU,CAAC,IAAI,EAAE,CAAC;gBACzC,eAAe,CAAC,0BAA0B,EAAE,CAAC;YAC9C,CAAC;QACF,CAAC;QAED,OAAO,eAAe,CAAC;IACxB,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IRequest } from \"@fluidframework/core-interfaces\";\nimport { assert, LazyPromise, Timer } from \"@fluidframework/core-utils/internal\";\nimport type { ISnapshotTree } from \"@fluidframework/driver-definitions/internal\";\nimport {\n\ttype IGarbageCollectionDetailsBase,\n\ttype ISummarizeResult,\n\tgcTreeKey,\n\ttype IGarbageCollectionData,\n\ttype ITelemetryContext,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport {\n\tcreateResponseError,\n\tresponseToException,\n} from \"@fluidframework/runtime-utils/internal\";\nimport {\n\ttype ITelemetryLoggerExt,\n\tDataProcessingError,\n\ttype MonitoringContext,\n\tPerformanceEvent,\n\tcreateChildLogger,\n\tcreateChildMonitoringContext,\n\ttagCodeArtifacts,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport { blobManagerBasePath } from \"../blobManager/index.js\";\nimport { TombstoneResponseHeaderKey } from \"../containerRuntime.js\";\nimport { ClientSessionExpiredError } from \"../error.js\";\nimport { ContainerMessageType, type ContainerRuntimeGCMessage } from \"../messageTypes.js\";\nimport type { IRefreshSummaryResult } from \"../summary/index.js\";\n\nimport { generateGCConfigs } from \"./gcConfigs.js\";\nimport {\n\tGCNodeType,\n\ttype GarbageCollectionMessage,\n\tGarbageCollectionMessageType,\n\ttype IGCMetadata,\n\ttype IGCResult,\n\ttype IGCStats,\n\ttype IGarbageCollectionRuntime,\n\ttype IGarbageCollector,\n\ttype IGarbageCollectorConfigs,\n\ttype IGarbageCollectorCreateParams,\n\ttype IMarkPhaseStats,\n\ttype ISweepPhaseStats,\n\tUnreferencedState,\n\ttype IGCNodeUpdatedProps,\n} from \"./gcDefinitions.js\";\nimport {\n\tcloneGCData,\n\tconcatGarbageCollectionData,\n\tdataStoreNodePathOnly,\n\tgetGCDataFromSnapshot,\n\turlToGCNodePath,\n} from \"./gcHelpers.js\";\nimport { runGarbageCollection } from \"./gcReferenceGraphAlgorithm.js\";\nimport type {\n\tIGarbageCollectionSnapshotData,\n\tIGarbageCollectionState,\n} from \"./gcSummaryDefinitions.js\";\nimport { GCSummaryStateTracker } from \"./gcSummaryStateTracker.js\";\nimport { GCTelemetryTracker } from \"./gcTelemetry.js\";\nimport {\n\tUnreferencedStateTracker,\n\tUnreferencedStateTrackerMap,\n} from \"./gcUnreferencedStateTracker.js\";\n\n/**\n * The garbage collector for the container runtime. It consolidates the garbage collection functionality and maintains\n * its state across summaries.\n *\n * Node - represented as nodeId, it's a node on the GC graph\n *\n * Outbound Route - a path from one node to another node, think `nodeA` -\\> `nodeB`\n *\n * Graph - all nodes with their respective routes\n *\n * ```\n *\t\t\t GC Graph\n *\n *\t\t\t Node\n *\t\tNodeId = \"datastore1\"\n *\t\t /\t\t\t \\\\\n *\tOutboundRoute OutboundRoute\n *\t\t /\t\t\t\t \\\\\n *\t Node\t\t\t Node\n * NodeId = \"dds1\"\t NodeId = \"dds2\"\n * ```\n */\nexport class GarbageCollector implements IGarbageCollector {\n\tpublic static create(createParams: IGarbageCollectorCreateParams): IGarbageCollector {\n\t\treturn new GarbageCollector(createParams);\n\t}\n\n\tprivate readonly mc: MonitoringContext;\n\n\tprivate readonly configs: IGarbageCollectorConfigs;\n\n\tpublic get shouldRunGC(): boolean {\n\t\treturn this.configs.gcAllowed;\n\t}\n\n\tpublic readonly sessionExpiryTimerStarted: number | undefined;\n\t// Keeps track of the GC state from the last run.\n\tprivate gcDataFromLastRun: IGarbageCollectionData | undefined;\n\t// Keeps a list of references (edges in the GC graph) between GC runs. Each entry has a node id and a list of\n\t// outbound routes from that node.\n\tprivate readonly newReferencesSinceLastRun: Map<string, string[]> = new Map();\n\t// A list of nodes that have been tombstoned.\n\tprivate tombstones: string[] = [];\n\t// A list of nodes that have been deleted during sweep phase.\n\tprivate deletedNodes: Set<string> = new Set();\n\n\t// Promise when resolved returns the GC data data in the base snapshot.\n\tprivate readonly baseSnapshotDataP: Promise<IGarbageCollectionSnapshotData | undefined>;\n\t// Promise when resolved initializes the GC state from the data in the base snapshot.\n\tprivate readonly initializeGCStateFromBaseSnapshotP: Promise<void>;\n\t// The GC details generated from the base snapshot.\n\tprivate readonly baseGCDetailsP: Promise<IGarbageCollectionDetailsBase>;\n\n\t/**\n\t * Map of node ids to their unreferenced state tracker\n\t * NOTE: The set of keys in this map is considered as the set of unreferenced nodes\n\t * as of the last GC run. So in between runs, nothing should be added or removed.\n\t */\n\tprivate readonly unreferencedNodesState: UnreferencedStateTrackerMap =\n\t\tnew UnreferencedStateTrackerMap();\n\n\t// The Timer responsible for closing the container when the session has expired\n\tprivate sessionExpiryTimer: Timer | undefined;\n\n\t// The number of times GC has successfully completed on this instance of GarbageCollector.\n\tprivate completedRuns = 0;\n\n\tprivate readonly runtime: IGarbageCollectionRuntime;\n\tprivate readonly isSummarizerClient: boolean;\n\n\tprivate readonly summaryStateTracker: GCSummaryStateTracker;\n\tprivate readonly telemetryTracker: GCTelemetryTracker;\n\n\t/**\n\t * For a given node path, returns the node's package path.\n\t */\n\tprivate readonly getNodePackagePath: (\n\t\tnodePath: string,\n\t) => Promise<readonly string[] | undefined>;\n\t/**\n\t * Returns the timestamp of the last summary generated for this container.\n\t */\n\tprivate readonly getLastSummaryTimestampMs: () => number | undefined;\n\n\tprivate readonly submitMessage: (message: ContainerRuntimeGCMessage) => void;\n\n\t/**\n\t * Returns the count of data stores whose GC state updated since the last summary.\n\t */\n\tpublic get updatedDSCountSinceLastSummary(): number {\n\t\treturn this.summaryStateTracker.updatedDSCountSinceLastSummary;\n\t}\n\n\tprotected constructor(createParams: IGarbageCollectorCreateParams) {\n\t\tthis.runtime = createParams.runtime;\n\t\tthis.isSummarizerClient = createParams.isSummarizerClient;\n\t\tthis.getNodePackagePath = createParams.getNodePackagePath;\n\t\tthis.getLastSummaryTimestampMs = createParams.getLastSummaryTimestampMs;\n\t\tthis.submitMessage = createParams.submitMessage;\n\n\t\tconst baseSnapshot = createParams.baseSnapshot;\n\t\tconst readAndParseBlob = createParams.readAndParseBlob;\n\t\tconst pendingSessionExpiryTimerStarted = createParams.sessionExpiryTimerStarted;\n\n\t\tthis.mc = createChildMonitoringContext({\n\t\t\tlogger: createParams.baseLogger,\n\t\t\tnamespace: \"GarbageCollector\",\n\t\t\tproperties: {\n\t\t\t\tall: { completedGCRuns: () => this.completedRuns },\n\t\t\t},\n\t\t});\n\n\t\tthis.configs = generateGCConfigs(this.mc, createParams);\n\n\t\t// If session expiry is enabled, we need to close the container when the session expiry timeout expires.\n\t\tif (this.configs.sessionExpiryTimeoutMs !== undefined) {\n\t\t\t// If Test Override config is set, override Session Expiry timeout.\n\t\t\tconst overrideSessionExpiryTimeoutMs = this.mc.config.getNumber(\n\t\t\t\t\"Fluid.GarbageCollection.TestOverride.SessionExpiryMs\",\n\t\t\t);\n\t\t\tlet timeoutMs = this.configs.sessionExpiryTimeoutMs;\n\n\t\t\tif (pendingSessionExpiryTimerStarted !== undefined) {\n\t\t\t\t// NOTE: This assumes the client clock hasn't been tampered with since the original session\n\t\t\t\tconst timeLapsedSincePendingTimer = Date.now() - pendingSessionExpiryTimerStarted;\n\t\t\t\ttimeoutMs -= timeLapsedSincePendingTimer;\n\t\t\t}\n\t\t\ttimeoutMs = overrideSessionExpiryTimeoutMs ?? timeoutMs;\n\t\t\tif (timeoutMs <= 0) {\n\t\t\t\tthis.runtime.closeFn(\n\t\t\t\t\tnew ClientSessionExpiredError(`Client session expired.`, timeoutMs),\n\t\t\t\t);\n\t\t\t}\n\t\t\tthis.sessionExpiryTimer = new Timer(timeoutMs, () => {\n\t\t\t\tthis.runtime.closeFn(\n\t\t\t\t\tnew ClientSessionExpiredError(`Client session expired.`, timeoutMs),\n\t\t\t\t);\n\t\t\t});\n\t\t\tthis.sessionExpiryTimer.start();\n\t\t\tthis.sessionExpiryTimerStarted = Date.now();\n\t\t}\n\n\t\tthis.summaryStateTracker = new GCSummaryStateTracker(this.configs);\n\n\t\tthis.telemetryTracker = new GCTelemetryTracker(\n\t\t\tthis.mc,\n\t\t\tthis.configs,\n\t\t\tthis.isSummarizerClient,\n\t\t\tcreateParams.createContainerMetadata,\n\t\t\t(nodeId: string) => this.runtime.getNodeType(nodeId),\n\t\t\t(nodeId: string) => this.unreferencedNodesState.get(nodeId),\n\t\t\tthis.getNodePackagePath,\n\t\t);\n\n\t\t// Get the GC data from the base snapshot. Use LazyPromise because we only want to do this once since it\n\t\t// it involves fetching blobs from storage which is expensive.\n\t\tthis.baseSnapshotDataP = new LazyPromise<IGarbageCollectionSnapshotData | undefined>(\n\t\t\tasync () => {\n\t\t\t\tif (baseSnapshot === undefined) {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\n\t\t\t\ttry {\n\t\t\t\t\t// For newer documents, GC data should be present in the GC tree in the root of the snapshot.\n\t\t\t\t\tconst gcSnapshotTree: ISnapshotTree | undefined = baseSnapshot.trees[gcTreeKey];\n\t\t\t\t\tif (gcSnapshotTree === undefined) {\n\t\t\t\t\t\t// back-compat - Older documents get their gc data reset for simplicity as there are few of them\n\t\t\t\t\t\t// incremental gc summary will not work with older gc data as well\n\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst snapshotData = await getGCDataFromSnapshot(gcSnapshotTree, readAndParseBlob);\n\n\t\t\t\t\t// If the GC version in base snapshot does not match the GC version currently in effect, the GC data\n\t\t\t\t\t// in the snapshot cannot be interpreted correctly. Set everything to undefined except for\n\t\t\t\t\t// deletedNodes because irrespective of GC versions, these nodes have been deleted and cannot be\n\t\t\t\t\t// brought back. The deletedNodes info is needed to identify when these nodes are used.\n\t\t\t\t\tif (this.configs.gcVersionInEffect !== this.configs.gcVersionInBaseSnapshot) {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tgcState: undefined,\n\t\t\t\t\t\t\ttombstones: undefined,\n\t\t\t\t\t\t\tdeletedNodes: snapshotData.deletedNodes,\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\treturn snapshotData;\n\t\t\t\t} catch (error) {\n\t\t\t\t\tconst dpe = DataProcessingError.wrapIfUnrecognized(error, \"FailedToInitializeGC\");\n\t\t\t\t\tdpe.addTelemetryProperties({\n\t\t\t\t\t\tgcConfigs: JSON.stringify(this.configs),\n\t\t\t\t\t});\n\t\t\t\t\tthrow dpe;\n\t\t\t\t}\n\t\t\t},\n\t\t);\n\n\t\t/**\n\t\t * Set up the initializer which initializes the GC state from the data in base snapshot. It sets up GC data\n\t\t * from the base GC state and starts tracking the state of unreferenced nodes.\n\t\t *\n\t\t * Must only be called if there is a current reference timestamp.\n\t\t */\n\t\tthis.initializeGCStateFromBaseSnapshotP = new LazyPromise<void>(async () => {\n\t\t\tconst currentReferenceTimestampMs = this.runtime.getCurrentReferenceTimestampMs();\n\t\t\tassert(\n\t\t\t\tcurrentReferenceTimestampMs !== undefined,\n\t\t\t\t0x8a4 /* Trying to initialize GC state without current timestamp */,\n\t\t\t);\n\n\t\t\t/**\n\t\t\t * The base snapshot data will not be present if the container is loaded from:\n\t\t\t * 1. The first summary created by the detached container.\n\t\t\t * 2. A summary that was generated with GC disabled.\n\t\t\t * 3. A summary that was generated before GC even existed.\n\t\t\t */\n\t\t\tconst baseSnapshotData = await this.baseSnapshotDataP;\n\t\t\tthis.summaryStateTracker.initializeBaseState(baseSnapshotData);\n\n\t\t\tif (baseSnapshotData?.gcState === undefined) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Update unreferenced state tracking as per the GC state in the snapshot data and update gcDataFromLastRun\n\t\t\t// to the GC data from the snapshot data.\n\t\t\tconst gcNodes: { [id: string]: string[] } = {};\n\t\t\tfor (const [nodeId, nodeData] of Object.entries(baseSnapshotData.gcState.gcNodes)) {\n\t\t\t\tif (nodeData.unreferencedTimestampMs !== undefined) {\n\t\t\t\t\tthis.unreferencedNodesState.set(\n\t\t\t\t\t\tnodeId,\n\t\t\t\t\t\tnew UnreferencedStateTracker(\n\t\t\t\t\t\t\tnodeData.unreferencedTimestampMs,\n\t\t\t\t\t\t\tthis.configs.inactiveTimeoutMs,\n\t\t\t\t\t\t\tcurrentReferenceTimestampMs,\n\t\t\t\t\t\t\tthis.configs.tombstoneTimeoutMs,\n\t\t\t\t\t\t\tthis.configs.sweepGracePeriodMs,\n\t\t\t\t\t\t),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tgcNodes[nodeId] = [...nodeData.outboundRoutes];\n\t\t\t}\n\t\t\tthis.gcDataFromLastRun = { gcNodes };\n\t\t});\n\n\t\t// Get the GC details from the GC state in the base summary. This is returned in getBaseGCDetails which is\n\t\t// used to initialize the GC state of all the nodes in the container.\n\t\tthis.baseGCDetailsP = new LazyPromise<IGarbageCollectionDetailsBase>(async () => {\n\t\t\tconst baseSnapshotData = await this.baseSnapshotDataP;\n\t\t\tif (baseSnapshotData?.gcState === undefined) {\n\t\t\t\treturn {};\n\t\t\t}\n\n\t\t\t// Note that the base GC details are returned even if GC is disabled. This is to handle the special scenario\n\t\t\t// where GC is disabled but GC state exists in base snapshot. In this scenario, the nodes which get the GC\n\t\t\t// state will re-summarize to reset any GC specific state in their summaries (like unreferenced flag).\n\n\t\t\tconst gcNodes: { [id: string]: string[] } = {};\n\t\t\tfor (const [nodeId, nodeData] of Object.entries(baseSnapshotData.gcState.gcNodes)) {\n\t\t\t\tgcNodes[nodeId] = [...nodeData.outboundRoutes];\n\t\t\t}\n\t\t\t// Run GC on the nodes in the base summary to get the routes used in each node in the container.\n\t\t\t// This is an optimization for space (vs performance) wherein we don't need to store the used routes of\n\t\t\t// each node in the summary.\n\t\t\tconst usedRoutes = runGarbageCollection(gcNodes, [\"/\"]).referencedNodeIds;\n\n\t\t\treturn { gcData: { gcNodes }, usedRoutes };\n\t\t});\n\n\t\t// Log all the GC options and the state determined by the garbage collector.\n\t\t// This is useful even for interactive clients since they track unreferenced nodes and log errors.\n\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\teventName: \"GarbageCollectorLoaded\",\n\t\t\tgcConfigs: JSON.stringify(this.configs),\n\t\t\tgcOptions: JSON.stringify(createParams.gcOptions),\n\t\t\t...createParams.createContainerMetadata,\n\t\t});\n\t}\n\n\t/**\n\t * API for ensuring the correct auto-recovery mitigations\n\t */\n\t// TODO: consider hoisting this to an outer scope as an optimization\n\t// eslint-disable-next-line unicorn/consistent-function-scoping\n\tprivate readonly autoRecovery = (() => {\n\t\t// This uses a hidden state machine for forcing fullGC as part of auto-recovery,\n\t\t// to regenerate the GC data for each node.\n\t\t//\n\t\t// Once fullGC has been requested, we need to wait until GC has run and the summary has been acked before clearing the state.\n\t\t//\n\t\t// States:\n\t\t// - undefined: No need to run fullGC now.\n\t\t// - \"requested\": FullGC requested, but GC has not yet run. Keep using fullGC until back to undefined.\n\t\t// - \"ran\": FullGC ran, but the following summary has not yet been acked. Keep using fullGC until back to undefined.\n\t\t//\n\t\t// Transitions:\n\t\t// - autoRecovery.requestFullGCOnNextRun :: [anything] --> \"requested\"\n\t\t// - autoRecovery.onCompletedGCRun :: \"requested\" --> \"ran\"\n\t\t// - autoRecovery.onSummaryAck :: \"ran\" --> undefined\n\t\tlet state: \"requested\" | \"ran\" | undefined;\n\t\treturn {\n\t\t\trequestFullGCOnNextRun: () => {\n\t\t\t\tstate = \"requested\";\n\t\t\t},\n\t\t\tonCompletedGCRun: () => {\n\t\t\t\tif (state === \"requested\") {\n\t\t\t\t\tstate = \"ran\";\n\t\t\t\t}\n\t\t\t},\n\t\t\tonSummaryAck: () => {\n\t\t\t\tif (state === \"ran\") {\n\t\t\t\t\tstate = undefined;\n\t\t\t\t}\n\t\t\t},\n\t\t\tuseFullGC: () => {\n\t\t\t\treturn state !== undefined;\n\t\t\t},\n\t\t};\n\t})();\n\n\t/**\n\t * Called during container initialization. Initializes the tombstone and deleted nodes state from the base snapshot.\n\t * Also, initializes the GC state including unreferenced nodes tracking if a current reference timestamp exists.\n\t * Note that if there is any GC state in the base snapshot, then there will definitely be a reference timestamp\n\t * to work with - The GC state would have been generated using a timestamp which is part of the snapshot.\n\t */\n\tpublic async initializeBaseState(): Promise<void> {\n\t\tconst baseSnapshotData = await this.baseSnapshotDataP;\n\t\t/**\n\t\t * The base snapshot data will not be present if the container is loaded from:\n\t\t * 1. The first summary created by the detached container.\n\t\t * 2. A summary that was generated with GC disabled.\n\t\t * 3. A summary that was generated before GC even existed.\n\t\t */\n\t\tif (baseSnapshotData === undefined) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Initialize the deleted nodes from the snapshot. This is done irrespective of whether GC / sweep is enabled\n\t\t// to identify deleted nodes' usage.\n\t\tif (baseSnapshotData.deletedNodes !== undefined) {\n\t\t\tthis.deletedNodes = new Set(baseSnapshotData.deletedNodes);\n\t\t}\n\n\t\t// Initialize the tombstone state from the snapshot. Also, notify the runtime of tombstone routes.\n\t\tif (baseSnapshotData.tombstones !== undefined) {\n\t\t\t// Create a copy since we are writing from a source we don't control\n\t\t\tthis.tombstones = [...baseSnapshotData.tombstones];\n\t\t\tthis.runtime.updateTombstonedRoutes(this.tombstones);\n\t\t}\n\n\t\tawait this.initializeOrUpdateGCState();\n\t}\n\n\t/**\n\t * Initialize the GC state if not already initialized. If GC state is already initialized, update the unreferenced\n\t * state tracking as per the current reference timestamp.\n\t */\n\tprivate async initializeOrUpdateGCState(): Promise<void> {\n\t\tconst currentReferenceTimestampMs = this.runtime.getCurrentReferenceTimestampMs();\n\t\tif (currentReferenceTimestampMs === undefined) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst initialized = this.gcDataFromLastRun !== undefined;\n\t\tawait PerformanceEvent.timedExecAsync(\n\t\t\tthis.mc.logger,\n\t\t\t{\n\t\t\t\teventName: \"InitializeOrUpdateGCState\",\n\t\t\t},\n\t\t\tasync (event) => {\n\t\t\t\t// If the GC state hasn't been initialized yet, initialize it and return.\n\t\t\t\tif (initialized) {\n\t\t\t\t\t// If the GC state has been initialized, update the tracking of unreferenced nodes as per the current\n\t\t\t\t\t// reference timestamp.\n\t\t\t\t\tfor (const [, nodeStateTracker] of this.unreferencedNodesState) {\n\t\t\t\t\t\tnodeStateTracker.updateTracking(currentReferenceTimestampMs);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tawait this.initializeGCStateFromBaseSnapshotP;\n\t\t\t\t}\n\t\t\t\tevent.end({\n\t\t\t\t\tdetails: { initialized, unrefNodeCount: this.unreferencedNodesState.size },\n\t\t\t\t});\n\t\t\t},\n\t\t);\n\t}\n\n\t/**\n\t * Called when the connection state of the runtime changes, i.e., it connects or disconnects. GC subscribes to this\n\t * to initialize or update the unreference state tracking.\n\t * @param connected - Whether the runtime connected / disconnected.\n\t * @param clientId - The clientId of this runtime.\n\t */\n\tpublic setConnectionState(connected: boolean, clientId?: string | undefined): void {\n\t\t/**\n\t\t * When the client connects (or reconnects), attempt to initialize or update the GC state. This will keep\n\t\t * the unreferenced state tracking updated as per the reference timestamp at the time of connection.\n\t\t *\n\t\t * During GC initialization and during connections in read mode, it is possible that either no ops are\n\t\t * processed or only trailing ops are processed. This means that the GC state is not initialized or initialized\n\t\t * with an older reference timestamp. So, doing this on every connection will keep the unreferenced state\n\t\t * tracking up-to-date.\n\t\t */\n\t\tif (connected && this.shouldRunGC) {\n\t\t\tthis.initializeOrUpdateGCState().catch((error) => {\n\t\t\t\tthis.mc.logger.sendErrorEvent(\n\t\t\t\t\t{\n\t\t\t\t\t\teventName: \"GCInitializationOrUpdateFailed\",\n\t\t\t\t\t\tgcConfigs: JSON.stringify(this.configs),\n\t\t\t\t\t\tclientId,\n\t\t\t\t\t},\n\t\t\t\t\terror,\n\t\t\t\t);\n\t\t\t});\n\t\t}\n\t}\n\n\t/**\n\t * Returns a the GC details generated from the base summary. This is used to initialize the GC state of the nodes\n\t * in the container.\n\t */\n\tpublic async getBaseGCDetails(): Promise<IGarbageCollectionDetailsBase> {\n\t\treturn this.baseGCDetailsP;\n\t}\n\n\t/**\n\t * Runs garbage collection and updates the reference / used state of the nodes in the container.\n\t * @returns stats of the GC run or undefined if GC did not run.\n\t */\n\tpublic async collectGarbage(\n\t\toptions: {\n\t\t\t/**\n\t\t\t * Logger to use for logging GC events\n\t\t\t */\n\t\t\tlogger?: ITelemetryLoggerExt;\n\t\t\t/**\n\t\t\t * True to run GC sweep phase after the mark phase\n\t\t\t */\n\t\t\trunSweep?: boolean;\n\t\t\t/**\n\t\t\t * True to generate full GC data\n\t\t\t */\n\t\t\tfullGC?: boolean;\n\t\t},\n\t\ttelemetryContext?: ITelemetryContext,\n\t): Promise<IGCStats | undefined> {\n\t\tconst fullGC =\n\t\t\toptions.fullGC ?? (this.configs.runFullGC === true || this.autoRecovery.useFullGC());\n\n\t\t// Add the options that are used to run GC to the telemetry context.\n\t\ttelemetryContext?.setMultiple(\"fluid_GC\", \"Options\", {\n\t\t\tfullGC,\n\t\t\trunSweep: options.runSweep,\n\t\t});\n\n\t\tconst logger = createChildLogger({\n\t\t\tlogger: options.logger ?? this.mc.logger,\n\t\t\tproperties: {\n\t\t\t\tall: { completedGCRuns: this.completedRuns, fullGC },\n\t\t\t},\n\t\t});\n\n\t\t/**\n\t\t * If there is no current reference timestamp, skip running GC. We need the current timestamp to track\n\t\t * how long objects have been unreferenced and if they should be deleted.\n\t\t *\n\t\t * Note that the only scenario where GC is called and there is no reference timestamp is when no ops have ever\n\t\t * been processed for this container and it is in read mode. In this scenario, there is no point in running GC\n\t\t * anyway because references in the container do not change without any ops, i.e., there is nothing to collect.\n\t\t */\n\t\tconst currentReferenceTimestampMs = this.runtime.getCurrentReferenceTimestampMs();\n\t\tif (currentReferenceTimestampMs === undefined) {\n\t\t\t// Log an event so we can evaluate how often we run into this scenario.\n\t\t\tlogger.sendErrorEvent({\n\t\t\t\teventName: \"CollectGarbageCalledWithoutTimestamp\",\n\t\t\t\tgcConfigs: JSON.stringify(this.configs),\n\t\t\t});\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn PerformanceEvent.timedExecAsync(\n\t\t\tlogger,\n\t\t\t{ eventName: \"GarbageCollection\" },\n\t\t\tasync (event) => {\n\t\t\t\t// #region Pre-GC steps\n\n\t\t\t\t// Ensure that state has been initialized from the base snapshot data.\n\t\t\t\tawait this.initializeGCStateFromBaseSnapshotP;\n\n\t\t\t\t// #endregion\n\n\t\t\t\t// #region GC step\n\n\t\t\t\tconst gcStats = await this.runGC(fullGC, currentReferenceTimestampMs, logger);\n\t\t\t\tevent.end({\n\t\t\t\t\t...gcStats,\n\t\t\t\t\tdetails: {\n\t\t\t\t\t\ttimestamp: currentReferenceTimestampMs,\n\t\t\t\t\t\tsweep: this.configs.sweepEnabled,\n\t\t\t\t\t\ttombstone: this.configs.throwOnTombstoneLoad,\n\t\t\t\t\t},\n\t\t\t\t});\n\n\t\t\t\t// #endregion\n\n\t\t\t\t// #region Post-GC steps\n\n\t\t\t\t// Log pending unreferenced events such as a node being used after inactive. This is done after GC runs and\n\t\t\t\t// updates its state so that we don't send false positives based on intermediate state. For example, we may get\n\t\t\t\t// reference to an unreferenced node from another unreferenced node which means the node wasn't revived.\n\t\t\t\tawait this.telemetryTracker.logPendingEvents(logger);\n\t\t\t\t// Update the state of summary state tracker from this run's stats.\n\t\t\t\tthis.summaryStateTracker.updateStateFromGCRunStats(gcStats);\n\t\t\t\tthis.autoRecovery.onCompletedGCRun();\n\t\t\t\tthis.newReferencesSinceLastRun.clear();\n\t\t\t\tthis.completedRuns++;\n\n\t\t\t\t// #endregion\n\n\t\t\t\treturn gcStats;\n\t\t\t},\n\t\t\t{ end: true, cancel: \"error\" },\n\t\t);\n\t}\n\n\t/**\n\t * Runs garbage collection. It does the following:\n\t *\n\t * 1. It generates / analyzes the runtime's reference graph.\n\t *\n\t * 2. Generates mark phase stats.\n\t *\n\t * 3. Runs Mark phase.\n\t *\n\t * 4. Runs Sweep phase.\n\t *\n\t * 5. Generates sweep phase stats.\n\t */\n\tprivate async runGC(\n\t\tfullGC: boolean,\n\t\tcurrentReferenceTimestampMs: number,\n\t\tlogger: ITelemetryLoggerExt,\n\t): Promise<IGCStats> {\n\t\t// 1. Generate / analyze the runtime's reference graph.\n\t\t// Get the reference graph (gcData) and run GC algorithm to get referenced / unreferenced nodes.\n\t\tconst gcData = await this.runtime.getGCData(fullGC);\n\t\tconst gcResult = runGarbageCollection(gcData.gcNodes, [\"/\"]);\n\t\t// Get all referenced nodes - References in this run + references between the previous and current runs.\n\t\tconst allReferencedNodeIds =\n\t\t\tthis.findAllNodesReferencedBetweenGCs(gcData, this.gcDataFromLastRun, logger) ??\n\t\t\tgcResult.referencedNodeIds;\n\n\t\t// 2. Get the mark phase stats based on the previous / current GC state.\n\t\t// This is done before running mark phase because we need the previous GC state before it is updated.\n\t\tconst markPhaseStats = this.getMarkPhaseStats(gcResult);\n\n\t\t// 3. Run the Mark phase.\n\t\t// It will mark nodes as referenced / unreferenced and return lists of tombstone-ready and sweep-ready nodes.\n\t\tconst { tombstoneReadyNodeIds, sweepReadyNodeIds } = this.runMarkPhase(\n\t\t\tgcResult,\n\t\t\tallReferencedNodeIds,\n\t\t\tcurrentReferenceTimestampMs,\n\t\t);\n\n\t\t// 4. Run the Sweep phase.\n\t\t// It will initiate the deletion (sending the GC Sweep op) of any sweep-ready nodes that are\n\t\t// allowed to be deleted per config, and tombstone the rest along with the tombstone-ready nodes.\n\t\t// Note that no nodes will be deleted until the GC Sweep op is processed.\n\t\tthis.runSweepPhase(gcResult, tombstoneReadyNodeIds, sweepReadyNodeIds);\n\n\t\tthis.gcDataFromLastRun = cloneGCData(gcData);\n\n\t\t// 5. Get the sweep phase stats.\n\t\tconst sweepPhaseStats = this.getSweepPhaseStats(\n\t\t\tthis.deletedNodes,\n\t\t\tsweepReadyNodeIds,\n\t\t\tmarkPhaseStats,\n\t\t);\n\n\t\treturn { ...markPhaseStats, ...sweepPhaseStats };\n\t}\n\n\t/**\n\t * Runs the GC Mark phase. It does the following:\n\t *\n\t * 1. Marks all referenced nodes in this run by clearing tracking for them.\n\t *\n\t * 2. Marks unreferenced nodes in this run by starting tracking for them.\n\t *\n\t * 3. Calls the runtime to update nodes that were marked referenced.\n\t *\n\t * @param gcResult - The result of the GC run on the gcData.\n\t * @param allReferencedNodeIds - Nodes referenced in this GC run + referenced between previous and current GC run.\n\t * @param currentReferenceTimestampMs - The timestamp to be used for unreferenced nodes' timestamp.\n\t * @returns The sets of tombstone-ready and sweep-ready nodes, i.e., nodes that ready to be tombstoned or deleted.\n\t */\n\tprivate runMarkPhase(\n\t\tgcResult: IGCResult,\n\t\tallReferencedNodeIds: string[],\n\t\tcurrentReferenceTimestampMs: number,\n\t): { tombstoneReadyNodeIds: Set<string>; sweepReadyNodeIds: Set<string> } {\n\t\t// 1. Marks all referenced nodes by clearing their unreferenced tracker, if any.\n\t\tfor (const nodeId of allReferencedNodeIds) {\n\t\t\tthis.unreferencedNodesState.delete(nodeId);\n\t\t}\n\n\t\t// 2. Mark unreferenced nodes in this run by starting or updating unreferenced tracking for them.\n\t\tconst tombstoneReadyNodeIds: Set<string> = new Set();\n\t\tconst sweepReadyNodeIds: Set<string> = new Set();\n\t\tfor (const nodeId of gcResult.deletedNodeIds) {\n\t\t\tconst nodeStateTracker = this.unreferencedNodesState.get(nodeId);\n\t\t\tif (nodeStateTracker === undefined) {\n\t\t\t\tthis.unreferencedNodesState.set(\n\t\t\t\t\tnodeId,\n\t\t\t\t\tnew UnreferencedStateTracker(\n\t\t\t\t\t\tcurrentReferenceTimestampMs,\n\t\t\t\t\t\tthis.configs.inactiveTimeoutMs,\n\t\t\t\t\t\tcurrentReferenceTimestampMs,\n\t\t\t\t\t\tthis.configs.tombstoneTimeoutMs,\n\t\t\t\t\t\tthis.configs.sweepGracePeriodMs,\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\t// If a node was already unreferenced, update its tracking information. Since the current reference time\n\t\t\t\t// is from the ops seen, this will ensure that we keep updating unreferenced state as time moves forward.\n\t\t\t\tnodeStateTracker.updateTracking(currentReferenceTimestampMs);\n\n\t\t\t\t// If a node is tombstone or sweep-ready, store it so it can be returned.\n\t\t\t\tif (nodeStateTracker.state === UnreferencedState.TombstoneReady) {\n\t\t\t\t\ttombstoneReadyNodeIds.add(nodeId);\n\t\t\t\t}\n\t\t\t\tif (nodeStateTracker.state === UnreferencedState.SweepReady) {\n\t\t\t\t\tsweepReadyNodeIds.add(nodeId);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// 3. Call the runtime to update referenced nodes in this run.\n\t\tthis.runtime.updateUsedRoutes(gcResult.referencedNodeIds);\n\n\t\treturn { tombstoneReadyNodeIds, sweepReadyNodeIds };\n\t}\n\n\t/**\n\t * Runs the GC Sweep phase. It does the following:\n\t *\n\t * 1. Marks tombstone-ready nodes as tombstones.\n\t *\n\t * 2. Sends a sweep op to delete nodes that are sweep-ready. Once the op is ack'd, these nodes will be deleted.\n\t *\n\t * @param gcResult - The result of the GC run on the gcData.\n\t * @param tombstoneReadyNodes - List of nodes that are tombstone-ready.\n\t * @param sweepReadyNodes - List of nodes that are sweep-ready.\n\t */\n\tprivate runSweepPhase(\n\t\tgcResult: IGCResult,\n\t\ttombstoneReadyNodes: Set<string>,\n\t\tsweepReadyNodes: Set<string>,\n\t): void {\n\t\t/**\n\t\t * Under \"Test Mode\", unreferenced nodes are immediately deleted without waiting for them to be sweep-ready.\n\t\t *\n\t\t * Otherwise, depending on how long it's been since the node was unreferenced, it will either be\n\t\t * marked as Tombstone, or deleted by Sweep.\n\t\t */\n\n\t\tif (this.configs.testMode) {\n\t\t\t// If we are running in GC test mode, unreferenced nodes (gcResult.deletedNodeIds) are deleted immediately.\n\t\t\tthis.runtime.deleteSweepReadyNodes(gcResult.deletedNodeIds);\n\t\t\treturn;\n\t\t}\n\n\t\t// We'll build up the lists of nodes to be either Tombstoned or Deleted\n\t\t// based on the configuration and the nodes' current state.\n\t\t// We must Tombstone any sweep-ready node that Sweep won't run for.\n\t\t// This is important because a container may never load during a node's Sweep Grace Period,\n\t\t// so that node would directly become sweep-ready skipping over tombstone-ready state,\n\t\t// but should be Tombstoned since Sweep is disabled.\n\t\tconst { nodesToTombstone, nodesToDelete } = this.configs.sweepEnabled\n\t\t\t? {\n\t\t\t\t\tnodesToDelete: [...sweepReadyNodes],\n\t\t\t\t\tnodesToTombstone: [...tombstoneReadyNodes],\n\t\t\t\t}\n\t\t\t: {\n\t\t\t\t\tnodesToDelete: [],\n\t\t\t\t\tnodesToTombstone: [...tombstoneReadyNodes, ...sweepReadyNodes],\n\t\t\t\t};\n\n\t\tthis.tombstones = nodesToTombstone;\n\t\tthis.runtime.updateTombstonedRoutes(this.tombstones);\n\n\t\tif (nodesToDelete.length > 0) {\n\t\t\t// Do not send DDS node ids in the GC op. This is an optimization to reduce its size. Since GC applies to\n\t\t\t// to data store only, all its DDSes are deleted along with it. The DDS ids will be retrieved from the\n\t\t\t// local state when processing the op.\n\t\t\tconst sweepReadyDSAndBlobs = nodesToDelete.filter((nodeId) => {\n\t\t\t\tconst nodeType = this.runtime.getNodeType(nodeId);\n\n\t\t\t\treturn nodeType === GCNodeType.DataStore || nodeType === GCNodeType.Blob;\n\t\t\t});\n\t\t\tconst contents: GarbageCollectionMessage = {\n\t\t\t\ttype: GarbageCollectionMessageType.Sweep,\n\t\t\t\tdeletedNodeIds: sweepReadyDSAndBlobs,\n\t\t\t};\n\n\t\t\tconst containerGCMessage: ContainerRuntimeGCMessage = {\n\t\t\t\ttype: ContainerMessageType.GC,\n\t\t\t\tcontents,\n\t\t\t};\n\t\t\tthis.submitMessage(containerGCMessage);\n\t\t\treturn;\n\t\t}\n\t}\n\n\t/**\n\t * Since GC runs periodically, the GC data that is generated only tells us the state of the world at that point in\n\t * time. There can be nodes that were referenced in between two runs and their unreferenced state needs to be\n\t * updated. For example, in the following scenarios not updating the unreferenced timestamp can lead to deletion of\n\t * these objects while there can be in-memory referenced to it:\n\t * 1. A node transitions from `unreferenced -> referenced -> unreferenced` between two runs. When the reference is\n\t * added, the object may have been accessed and in-memory reference to it added.\n\t * 2. A reference is added from one unreferenced node to one or more unreferenced nodes. Even though the node[s] were\n\t * unreferenced, they could have been accessed and in-memory reference to them added.\n\t *\n\t * This function identifies nodes that were referenced since the last run.\n\t * If these nodes are currently unreferenced, they will be assigned new unreferenced state by the current run.\n\t *\n\t * @returns A list of all nodes referenced from the last local summary until now.\n\t */\n\tprivate findAllNodesReferencedBetweenGCs(\n\t\tcurrentGCData: IGarbageCollectionData,\n\t\tpreviousGCData: IGarbageCollectionData | undefined,\n\t\tlogger: ITelemetryLoggerExt,\n\t): string[] | undefined {\n\t\t// If we haven't run GC before there is nothing to do.\n\t\t// No previousGCData, means nothing is unreferenced, and there are no reference state trackers to clear\n\t\tif (previousGCData === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\t/**\n\t\t * If there are references that were not explicitly notified to GC, log an error because this should never happen.\n\t\t * If it does, this may result in the unreferenced timestamps of these nodes not updated when they were referenced.\n\t\t */\n\t\tthis.telemetryTracker.logIfMissingExplicitReferences(\n\t\t\tcurrentGCData,\n\t\t\tpreviousGCData,\n\t\t\tthis.newReferencesSinceLastRun,\n\t\t\tlogger,\n\t\t);\n\n\t\t// No references were added since the last run so we don't have to update reference states of any unreferenced\n\t\t// nodes. There is no in between state at this point.\n\t\tif (this.newReferencesSinceLastRun.size === 0) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\t/**\n\t\t * Generate a super set of the GC data that contains the nodes and edges from last run, plus any new node and\n\t\t * edges that have been added since then. To do this, combine the GC data from the last run and the current\n\t\t * run, and then add the references since last run.\n\t\t *\n\t\t * Note on why we need to combine the data from previous run, current run and all references in between -\n\t\t * 1. We need data from last run because some of its references may have been deleted since then. If those\n\t\t * references added new outbound references before they were deleted, we need to detect them.\n\t\t *\n\t\t * 2. We need new outbound references since last run because some of them may have been deleted later. If those\n\t\t * references added new outbound references before they were deleted, we need to detect them.\n\t\t *\n\t\t * 3. We need data from the current run because currently we may not detect when DDSes are referenced:\n\t\t * - We don't require DDSes handles to be stored in a referenced DDS.\n\t\t * - A new data store may have \"root\" DDSes already created and we don't detect them today.\n\t\t */\n\t\tconst gcDataSuperSet = concatGarbageCollectionData(previousGCData, currentGCData);\n\t\tconst newOutboundRoutesSinceLastRun: string[] = [];\n\t\tfor (const [sourceNodeId, outboundRoutes] of this.newReferencesSinceLastRun) {\n\t\t\tif (gcDataSuperSet.gcNodes[sourceNodeId] === undefined) {\n\t\t\t\tgcDataSuperSet.gcNodes[sourceNodeId] = outboundRoutes;\n\t\t\t} else {\n\t\t\t\t// TODO: Fix this violation and remove the disable\n\t\t\t\t// eslint-disable-next-line @fluid-internal/fluid/no-unchecked-record-access\n\t\t\t\tgcDataSuperSet.gcNodes[sourceNodeId].push(...outboundRoutes);\n\t\t\t}\n\t\t\tnewOutboundRoutesSinceLastRun.push(...outboundRoutes);\n\t\t}\n\n\t\t/**\n\t\t * Run GC on the above reference graph starting with root and all new outbound routes. This will generate a\n\t\t * list of all nodes that could have been referenced since the last run. If any of these nodes are unreferenced,\n\t\t * unreferenced, stop tracking them and remove from unreferenced list.\n\t\t * Note that some of these nodes may be unreferenced now and if so, the current run will mark them as\n\t\t * unreferenced and add unreferenced state.\n\t\t */\n\t\tconst gcResult = runGarbageCollection(gcDataSuperSet.gcNodes, [\n\t\t\t\"/\",\n\t\t\t...newOutboundRoutesSinceLastRun,\n\t\t]);\n\t\treturn gcResult.referencedNodeIds;\n\t}\n\n\t/**\n\t * Summarizes the GC data and returns it as a summary tree.\n\t * We current write the entire GC state in a single blob. This can be modified later to write multiple\n\t * blobs. All the blob keys should start with `gcBlobPrefix`.\n\t */\n\tpublic summarize(\n\t\tfullTree: boolean,\n\t\ttrackState: boolean,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): ISummarizeResult | undefined {\n\t\tif (!this.shouldRunGC || this.gcDataFromLastRun === undefined) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst gcState: IGarbageCollectionState = { gcNodes: {} };\n\t\tfor (const [nodeId, outboundRoutes] of Object.entries(this.gcDataFromLastRun.gcNodes)) {\n\t\t\tgcState.gcNodes[nodeId] = {\n\t\t\t\toutboundRoutes,\n\t\t\t\tunreferencedTimestampMs:\n\t\t\t\t\tthis.unreferencedNodesState.get(nodeId)?.unreferencedTimestampMs,\n\t\t\t};\n\t\t}\n\n\t\treturn this.summaryStateTracker.summarize(\n\t\t\ttrackState && !fullTree,\n\t\t\tgcState,\n\t\t\tthis.deletedNodes,\n\t\t\tthis.tombstones,\n\t\t);\n\t}\n\n\tpublic getMetadata(): IGCMetadata {\n\t\treturn {\n\t\t\t/**\n\t\t\t * If GC is allowed, the GC data is written using the GC version in effect and that is the gcFeature that goes\n\t\t\t * into the metadata blob. If GC is disabled, the gcFeature is 0.\n\t\t\t */\n\t\t\tgcFeature: this.configs.gcAllowed ? this.configs.gcVersionInEffect : 0,\n\t\t\tgcFeatureMatrix: this.configs.persistedGcFeatureMatrix,\n\t\t\tsessionExpiryTimeoutMs: this.configs.sessionExpiryTimeoutMs,\n\t\t\tsweepEnabled: false, // DEPRECATED - to be removed\n\t\t\ttombstoneTimeoutMs: this.configs.tombstoneTimeoutMs,\n\t\t};\n\t}\n\n\t/**\n\t * Called to refresh the latest summary state. This happens when either a pending summary is acked.\n\t */\n\tpublic async refreshLatestSummary(result: IRefreshSummaryResult): Promise<void> {\n\t\tthis.autoRecovery.onSummaryAck();\n\t\treturn this.summaryStateTracker.refreshLatestSummary(result);\n\t}\n\n\t/**\n\t * Process GC messages.\n\t * @param messageContents - The contents of the messages.\n\t * @param messageTimestampMs - The timestamp of the messages.\n\t * @param local - Whether it was send by this client.\n\t */\n\tpublic processMessages(\n\t\tmessageContents: GarbageCollectionMessage[],\n\t\tmessageTimestampMs: number,\n\t\tlocal: boolean,\n\t): void {\n\t\tfor (const gcMessage of messageContents) {\n\t\t\tconst gcMessageType = gcMessage.type;\n\t\t\tswitch (gcMessageType) {\n\t\t\t\tcase GarbageCollectionMessageType.Sweep: {\n\t\t\t\t\t// Delete the nodes whose ids are present in the contents.\n\t\t\t\t\tthis.deleteSweepReadyNodes(gcMessage.deletedNodeIds);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase GarbageCollectionMessageType.TombstoneLoaded: {\n\t\t\t\t\t// Mark the node as referenced to ensure it isn't Swept\n\t\t\t\t\tconst tombstonedNodePath = gcMessage.nodePath;\n\t\t\t\t\tthis.addedOutboundReference(\n\t\t\t\t\t\t\"/\",\n\t\t\t\t\t\ttombstonedNodePath,\n\t\t\t\t\t\tmessageTimestampMs,\n\t\t\t\t\t\ttrue /* autorecovery */,\n\t\t\t\t\t);\n\n\t\t\t\t\t// In case the cause of the TombstoneLoaded event is incorrect GC Data (i.e. the object is actually reachable),\n\t\t\t\t\t// do fullGC on the next run to get a chance to repair (in the likely case the bug is not deterministic)\n\t\t\t\t\tthis.autoRecovery.requestFullGCOnNextRun();\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tdefault: {\n\t\t\t\t\tthrow DataProcessingError.create(\n\t\t\t\t\t\t`Garbage collection message of unknown type ${gcMessageType}`,\n\t\t\t\t\t\t\"processMessage\",\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Delete nodes that are sweep-ready. Call the runtime to delete these nodes and clear the unreferenced state\n\t * tracking for nodes that are actually deleted by the runtime.\n\t *\n\t * Note that this doesn't check any configuration around whether Sweep is enabled.\n\t * That happens before the op is submitted, and from that point, any client should execute the delete.\n\t *\n\t * @param sweepReadyNodeIds - The ids of nodes that are ready to be deleted.\n\t */\n\tprivate deleteSweepReadyNodes(sweepReadyNodeIds: readonly string[]): void {\n\t\t// Use a set for lookup because its much faster than array or map.\n\t\tconst sweepReadyNodesSet: Set<string> = new Set(sweepReadyNodeIds);\n\n\t\t// The ids in the sweep-ready nodes do not contain DDS node ids. This is an optimization to reduce the size\n\t\t// of the GC op. Since GC applies to data store only, all its DDSes are deleted along with it. So, get the\n\t\t// DDS nodes ID from the unreferenced nodes state.\n\t\tconst allSweepReadyNodeIds = [...sweepReadyNodeIds];\n\t\tfor (const [id] of this.unreferencedNodesState) {\n\t\t\t// Ignore data store nodes since they would already be in the list.\n\t\t\tconst pathParts = id.split(\"/\");\n\t\t\tif (pathParts.length <= 2) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// Get the data store id part. Note that this may include blobs but that's okay since the part would just\n\t\t\t// be \"_blobs\" and it won't be found.\n\t\t\tconst dsId = `/${pathParts[1]}`;\n\t\t\tif (sweepReadyNodesSet.has(dsId)) {\n\t\t\t\tallSweepReadyNodeIds.push(id);\n\t\t\t}\n\t\t}\n\t\tconst deletedNodeIds = this.runtime.deleteSweepReadyNodes(allSweepReadyNodeIds);\n\n\t\t// Clear unreferenced state tracking for deleted nodes.\n\t\tfor (const nodeId of deletedNodeIds) {\n\t\t\t// Usually we avoid modifying the set of unreferencedNodesState keys in between GC runs,\n\t\t\t// but this is ok since this node won't exist at all in the next GC run.\n\t\t\tthis.unreferencedNodesState.delete(nodeId);\n\t\t\tthis.deletedNodes.add(nodeId);\n\t\t}\n\t}\n\n\t/**\n\t * Called when a node with the given id is updated. If the node is inactive or tombstoned, this will log an error\n\t * or throw an error if failing on incorrect usage is configured.\n\t * @param IGCNodeUpdatedProps - Details about the node and how it was updated\n\t */\n\tpublic nodeUpdated({\n\t\tnode,\n\t\treason,\n\t\ttimestampMs,\n\t\tpackagePath,\n\t\trequest,\n\t\theaderData,\n\t\tadditionalProps,\n\t}: IGCNodeUpdatedProps): void {\n\t\t// If there is no reference timestamp to work with, no ops have been processed after creation. If so, skip\n\t\t// logging as nothing interesting would have happened worth logging.\n\t\tif (!this.shouldRunGC || timestampMs === undefined) {\n\t\t\treturn;\n\t\t}\n\n\t\t// trackedId will be either DataStore or Blob ID (not sub-DataStore ID, since some of those are unrecognized by GC)\n\t\tconst trackedId = node.path;\n\t\tconst isTombstoned = this.tombstones.includes(trackedId);\n\t\tconst fullPath = request === undefined ? trackedId : urlToGCNodePath(request.url);\n\n\t\t// This will log if appropriate\n\t\tthis.telemetryTracker.nodeUsed(trackedId, {\n\t\t\tid: fullPath,\n\t\t\tusageType: reason,\n\t\t\tcurrentReferenceTimestampMs: timestampMs,\n\t\t\tpackagePath,\n\t\t\tcompletedGCRuns: this.completedRuns,\n\t\t\tisTombstoned,\n\t\t\tlastSummaryTime: this.getLastSummaryTimestampMs(),\n\t\t\theaders: headerData,\n\t\t\trequestUrl: request?.url,\n\t\t\trequestHeaders: JSON.stringify(request?.headers),\n\t\t\tadditionalProps,\n\t\t});\n\n\t\t// Any time we log a Tombstone Loaded error (via Telemetry Tracker),\n\t\t// we want to also trigger autorecovery to avoid the object being deleted\n\t\t// i.e. this will be preceded by one of these telemetry events;\n\t\t// GC_Tombstone_DataStore_Requested, GC_Tombstone_SubDataStore_Requested, GC_Tombstone_Blob_Requested\n\t\t// Note: We don't need to trigger on \"Changed\" because any change will cause the object\n\t\t// to be loaded by the Summarizer, and auto-recovery will be triggered then.\n\t\tif (isTombstoned && reason === \"Loaded\") {\n\t\t\t// Note that when a DataStore and its DDS are all loaded, each will trigger AutoRecovery for itself.\n\t\t\tthis.triggerAutoRecovery(fullPath);\n\t\t}\n\n\t\tconst nodeType = this.runtime.getNodeType(fullPath);\n\n\t\t// Unless this is a Loaded event for a Blob or DataStore, we're done after telemetry tracking\n\t\tconst loadedBlobOrDataStore =\n\t\t\treason === \"Loaded\" &&\n\t\t\t(nodeType === GCNodeType.Blob || nodeType === GCNodeType.DataStore);\n\t\tif (!loadedBlobOrDataStore) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst errorRequest: IRequest = request ?? { url: fullPath };\n\t\tif (\n\t\t\tisTombstoned &&\n\t\t\tthis.configs.throwOnTombstoneLoad &&\n\t\t\theaderData?.allowTombstone !== true\n\t\t) {\n\t\t\t// The requested data store is removed by gc. Create a 404 gc response exception.\n\t\t\tthrow responseToException(\n\t\t\t\tcreateResponseError(404, `${nodeType} was tombstoned`, errorRequest, {\n\t\t\t\t\t[TombstoneResponseHeaderKey]: true,\n\t\t\t\t}),\n\t\t\t\terrorRequest,\n\t\t\t);\n\t\t}\n\t}\n\n\t/**\n\t * The given node should have its unreferenced state reset in the next GC,\n\t * even if the true GC graph shows it is unreferenced. This will\n\t * prevent it from being deleted by Sweep (after the Grace Period).\n\t *\n\t * Submit a GC op indicating that the Tombstone with the given path has been loaded.\n\t * Broadcasting this information in the op stream allows the Summarizer to reset unreferenced state\n\t * before running GC next.\n\t */\n\tprivate triggerAutoRecovery(nodePath: string): void {\n\t\t// If sweep isn't enabled, auto-recovery isn't needed since its purpose is to prevent this object from being\n\t\t// deleted. It also would end up sending a GC op which can break clients running FF version 1.x.\n\t\tif (!this.configs.sweepEnabled) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst containerGCMessage: ContainerRuntimeGCMessage = {\n\t\t\ttype: ContainerMessageType.GC,\n\t\t\tcontents: {\n\t\t\t\ttype: GarbageCollectionMessageType.TombstoneLoaded,\n\t\t\t\tnodePath,\n\t\t\t},\n\t\t};\n\t\tthis.submitMessage(containerGCMessage);\n\t}\n\n\t/**\n\t * Called when an outbound reference is added to a node. This is used to identify all nodes that have been\n\t * referenced between summaries so that their unreferenced timestamp can be reset.\n\t *\n\t * @param fromNodePath - The node from which the reference is added.\n\t * @param toNodePath - The node to which the reference is added.\n\t * @param timestampMs - The timestamp of the message that added the reference.\n\t * @param autorecovery - This reference is added artificially, for autorecovery. Used for logging.\n\t */\n\tpublic addedOutboundReference(\n\t\tfromNodePath: string,\n\t\ttoNodePath: string,\n\t\ttimestampMs: number,\n\t\tautorecovery?: true,\n\t): void {\n\t\tif (!this.shouldRunGC) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (!toNodePath.startsWith(\"/\")) {\n\t\t\t// A long time ago we stored handles with relatives paths. We don't expect to see these cases though\n\t\t\t// because GC was enabled only after we made the switch to always using absolute paths.\n\t\t\tthis.mc.logger.sendErrorEvent({\n\t\t\t\teventName: \"InvalidRelativeOutboundRoute\",\n\t\t\t\t...tagCodeArtifacts({ fromId: fromNodePath, id: toNodePath }),\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\tassert(fromNodePath.startsWith(\"/\"), 0x8a5 /* fromNodePath must be an absolute path */);\n\n\t\tconst outboundRoutes = this.newReferencesSinceLastRun.get(fromNodePath) ?? [];\n\t\toutboundRoutes.push(toNodePath);\n\t\tthis.newReferencesSinceLastRun.set(fromNodePath, outboundRoutes);\n\n\t\t// GC won't recognize some subDataStore paths that we encounter (e.g. a path suited for a custom request handler)\n\t\t// So for subDataStore paths we need to check the parent dataStore for current tombstone/inactive status.\n\t\tconst trackedId =\n\t\t\tthis.runtime.getNodeType(toNodePath) === \"SubDataStore\"\n\t\t\t\t? dataStoreNodePathOnly(toNodePath)\n\t\t\t\t: toNodePath;\n\t\tthis.telemetryTracker.nodeUsed(trackedId, {\n\t\t\tid: toNodePath,\n\t\t\tfromId: fromNodePath,\n\t\t\tusageType: \"Revived\",\n\t\t\tcurrentReferenceTimestampMs: timestampMs,\n\t\t\tpackagePath: undefined,\n\t\t\tcompletedGCRuns: this.completedRuns,\n\t\t\tisTombstoned: this.tombstones.includes(trackedId),\n\t\t\tlastSummaryTime: this.getLastSummaryTimestampMs(),\n\t\t\tautorecovery,\n\t\t});\n\n\t\t// This node is referenced - Clear its unreferenced state if present\n\t\t// But don't delete the node id from the map yet.\n\t\t// When generating GC stats, the set of nodes in here is used as the baseline for\n\t\t// what was unreferenced in the last GC run.\n\t\t// NOTE: We use toNodePath not trackedId even though it may be an unrecognized subDataStore route (hence no-op),\n\t\t// because a reference to such a path is not sufficient to consider the DataStore referenced.\n\t\tthis.unreferencedNodesState.get(toNodePath)?.stopTracking();\n\t}\n\n\t/**\n\t * Returns whether a node with the given path has been deleted or not. This can be used by the runtime to identify\n\t * cases where objects are used after they are deleted and throw / log errors accordingly.\n\t */\n\tpublic isNodeDeleted(nodePath: string): boolean {\n\t\treturn this.deletedNodes.has(nodePath);\n\t}\n\n\tpublic dispose(): void {\n\t\tthis.sessionExpiryTimer?.clear();\n\t\tthis.sessionExpiryTimer = undefined;\n\n\t\t// Clear all unreferenced node timers to prevent process hanging\n\t\tfor (const tracker of this.unreferencedNodesState.values()) {\n\t\t\ttracker.stopTracking();\n\t\t}\n\t\tthis.unreferencedNodesState.clear();\n\t}\n\n\t/**\n\t * Generates the stats of a garbage collection mark phase run.\n\t * @param gcResult - The result of the current GC run.\n\t * @returns the stats of the mark phase run.\n\t */\n\n\tprivate getMarkPhaseStats(gcResult: IGCResult): IMarkPhaseStats {\n\t\tconst markPhaseStats: IMarkPhaseStats = {\n\t\t\tnodeCount: 0,\n\t\t\tdataStoreCount: 0,\n\t\t\tattachmentBlobCount: 0,\n\t\t\tunrefNodeCount: 0,\n\t\t\tunrefDataStoreCount: 0,\n\t\t\tunrefAttachmentBlobCount: 0,\n\t\t\tupdatedNodeCount: 0,\n\t\t\tupdatedDataStoreCount: 0,\n\t\t\tupdatedAttachmentBlobCount: 0,\n\t\t};\n\n\t\tconst updateNodeStats = (nodeId: string, isReferenced: boolean): void => {\n\t\t\tmarkPhaseStats.nodeCount++;\n\t\t\t// If there is no previous GC data, every node's state is generated and is considered as updated.\n\t\t\t// Otherwise, find out if any node went from referenced to unreferenced or vice-versa.\n\t\t\tconst wasNotReferenced = this.unreferencedNodesState.has(nodeId);\n\t\t\tconst stateUpdated =\n\t\t\t\tthis.gcDataFromLastRun === undefined || wasNotReferenced === isReferenced;\n\t\t\tif (stateUpdated) {\n\t\t\t\tmarkPhaseStats.updatedNodeCount++;\n\t\t\t}\n\t\t\tif (!isReferenced) {\n\t\t\t\tmarkPhaseStats.unrefNodeCount++;\n\t\t\t}\n\n\t\t\tif (this.runtime.getNodeType(nodeId) === GCNodeType.DataStore) {\n\t\t\t\tmarkPhaseStats.dataStoreCount++;\n\t\t\t\tif (stateUpdated) {\n\t\t\t\t\tmarkPhaseStats.updatedDataStoreCount++;\n\t\t\t\t}\n\t\t\t\tif (!isReferenced) {\n\t\t\t\t\tmarkPhaseStats.unrefDataStoreCount++;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (this.runtime.getNodeType(nodeId) === GCNodeType.Blob) {\n\t\t\t\tmarkPhaseStats.attachmentBlobCount++;\n\t\t\t\tif (stateUpdated) {\n\t\t\t\t\tmarkPhaseStats.updatedAttachmentBlobCount++;\n\t\t\t\t}\n\t\t\t\tif (!isReferenced) {\n\t\t\t\t\tmarkPhaseStats.unrefAttachmentBlobCount++;\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tfor (const nodeId of gcResult.referencedNodeIds) {\n\t\t\tupdateNodeStats(nodeId, true /* referenced */);\n\t\t}\n\n\t\tfor (const nodeId of gcResult.deletedNodeIds) {\n\t\t\tupdateNodeStats(nodeId, false /* referenced */);\n\t\t}\n\n\t\treturn markPhaseStats;\n\t}\n\n\t/**\n\t * Generates the stats of a garbage collection sweep phase run.\n\t * @param deletedNodes - The nodes that have already been deleted even before this run.\n\t * @param sweepReadyNodes - The nodes that are sweep-ready in this GC run. These will be deleted but are not deleted yet,\n\t * due to either sweep not being enabled or the Sweep Op needing to roundtrip before the delete is executed.\n\t * @param markPhaseStats - The stats of the mark phase run.\n\t * @returns the stats of the sweep phase run.\n\t */\n\tprivate getSweepPhaseStats(\n\t\tdeletedNodes: Set<string>,\n\t\tsweepReadyNodes: Set<string>,\n\n\t\tmarkPhaseStats: IMarkPhaseStats,\n\t): ISweepPhaseStats {\n\t\t// Initialize the life time node counts to the mark phase node counts. If sweep is not enabled,\n\t\t// these will be the life time node count for this container.\n\n\t\tconst sweepPhaseStats: ISweepPhaseStats = {\n\t\t\tlifetimeNodeCount: markPhaseStats.nodeCount,\n\t\t\tlifetimeDataStoreCount: markPhaseStats.dataStoreCount,\n\t\t\tlifetimeAttachmentBlobCount: markPhaseStats.attachmentBlobCount,\n\t\t\tdeletedNodeCount: 0,\n\t\t\tdeletedDataStoreCount: 0,\n\t\t\tdeletedAttachmentBlobCount: 0,\n\t\t};\n\n\t\t// The runtime can't reliably identify the type of deleted nodes. So, get the type here. This should\n\t\t// be good enough because the only types that participate in GC today are data stores, DDSes and blobs.\n\t\t// eslint-disable-next-line unicorn/consistent-function-scoping\n\t\tconst getDeletedNodeType = (nodeId: string): GCNodeType => {\n\t\t\tconst pathParts = nodeId.split(\"/\");\n\t\t\tif (pathParts[1] === blobManagerBasePath) {\n\t\t\t\treturn GCNodeType.Blob;\n\t\t\t}\n\t\t\tif (pathParts.length === 2) {\n\t\t\t\treturn GCNodeType.DataStore;\n\t\t\t}\n\t\t\tif (pathParts.length === 3) {\n\t\t\t\treturn GCNodeType.SubDataStore;\n\t\t\t}\n\n\t\t\treturn GCNodeType.Other;\n\t\t};\n\n\t\tfor (const nodeId of deletedNodes) {\n\t\t\tsweepPhaseStats.deletedNodeCount++;\n\t\t\tconst nodeType = getDeletedNodeType(nodeId);\n\n\t\t\tif (nodeType === GCNodeType.DataStore) {\n\t\t\t\tsweepPhaseStats.deletedDataStoreCount++;\n\t\t\t} else if (nodeType === GCNodeType.Blob) {\n\t\t\t\tsweepPhaseStats.deletedAttachmentBlobCount++;\n\t\t\t}\n\t\t}\n\n\t\t// The counts from the mark phase stats do not include nodes that were\n\t\t// deleted in previous runs. So, add the deleted node counts to life time stats.\n\t\tsweepPhaseStats.lifetimeNodeCount += sweepPhaseStats.deletedNodeCount;\n\t\tsweepPhaseStats.lifetimeDataStoreCount += sweepPhaseStats.deletedDataStoreCount;\n\t\tsweepPhaseStats.lifetimeAttachmentBlobCount += sweepPhaseStats.deletedAttachmentBlobCount;\n\n\t\t// These stats are used to estimate the impact of GC in terms of how much garbage is/will be cleaned up.\n\t\t// So we include the current sweep-ready node stats since these nodes will be deleted eventually.\n\t\t// - If sweep is enabled, this will happen in the run after the GC op round trips back\n\t\t// (they'll be in deletedNodes that time).\n\t\t// - If sweep is not enabled, we still want to include these nodes since they\n\t\t// _will be_ deleted once it is enabled.\n\t\tfor (const nodeId of sweepReadyNodes) {\n\t\t\tsweepPhaseStats.deletedNodeCount++;\n\t\t\tconst nodeType = this.runtime.getNodeType(nodeId);\n\n\t\t\tif (nodeType === GCNodeType.DataStore) {\n\t\t\t\tsweepPhaseStats.deletedDataStoreCount++;\n\t\t\t} else if (nodeType === GCNodeType.Blob) {\n\t\t\t\tsweepPhaseStats.deletedAttachmentBlobCount++;\n\t\t\t}\n\t\t}\n\n\t\treturn sweepPhaseStats;\n\t}\n}\n"]}
|
package/lib/gc/gcConfigs.js
CHANGED
|
@@ -118,6 +118,8 @@ export function generateGCConfigs(mc, createParams) {
|
|
|
118
118
|
*/
|
|
119
119
|
export function computeTombstoneTimeout(sessionExpiryTimeoutMs) {
|
|
120
120
|
const bufferMs = oneDayMs;
|
|
121
|
-
return
|
|
121
|
+
return sessionExpiryTimeoutMs === undefined
|
|
122
|
+
? undefined
|
|
123
|
+
: sessionExpiryTimeoutMs + maxSnapshotCacheExpiryMs + bufferMs;
|
|
122
124
|
}
|
|
123
125
|
//# sourceMappingURL=gcConfigs.js.map
|
package/lib/gc/gcConfigs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gcConfigs.js","sourceRoot":"","sources":["../../src/gc/gcConfigs.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAEN,UAAU,EACV,oBAA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BAAkB,GACvB,YAAY,CAAC,SAAS,CAAC,kBAAkB,IAAI,yBAAyB,CAAC;IACxE,oBAAoB,CAAC,kBAAkB,IAAI,CAAC,EAAE,yCAAyC,EAAE;QACxF,kBAAkB;KAClB,CAAC,CAAC;IAEH,MAAM,oBAAoB,GACzB,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,8BAA8B,CAAC,KAAK,IAAI;QAC7D,YAAY;QACZ,CAAC,YAAY,CAAC,kBAAkB,CAAC;IAElC,OAAO;QACN,SAAS,EAAE,oBAAoB;QAC/B,YAAY,EAAE,oBAAoB;QAClC,YAAY,EAAE,mBAAmB;QACjC,SAAS;QACT,QAAQ;QACR,sBAAsB;QACtB,kBAAkB;QAClB,kBAAkB;QAClB,iBAAiB;QACjB,wBAAwB;QACxB,uBAAuB;QACvB,iBAAiB,EAAE,oBAAoB,CAAC,EAAE,CAAC,MAAM,CAAC;QAClD,oBAAoB;KACpB,CAAC;AACH,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,uBAAuB,CACtC,sBAA0C;IAE1C,MAAM,QAAQ,GAAG,QAAQ,CAAC;IAC1B,OAAO,CACN,sBAAsB,IAAI,sBAAsB,GAAG,wBAAwB,GAAG,QAAQ,CACtF,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\ttype MonitoringContext,\n\tUsageError,\n\tvalidatePrecondition,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport type { IContainerRuntimeMetadata } from \"../summary/index.js\";\n\nimport {\n\ttype GCFeatureMatrix,\n\ttype GCVersion,\n\ttype IGCMetadata_Deprecated,\n\ttype IGCRuntimeOptions,\n\ttype IGarbageCollectorConfigs,\n\tdefaultInactiveTimeoutMs,\n\tdefaultSessionExpiryDurationMs,\n\tdefaultSweepGracePeriodMs,\n\tgcGenerationOptionName,\n\tgcTestModeKey,\n\tmaxSnapshotCacheExpiryMs,\n\toneDayMs,\n\trunSessionExpiryKey,\n\tdisableThrowOnTombstoneLoadKey,\n} from \"./gcDefinitions.js\";\nimport { getGCVersion, getGCVersionInEffect, shouldAllowGcSweep } from \"./gcHelpers.js\";\n\n/**\n * Generates configurations for the Garbage Collector that it uses to determine what to run and how.\n * @param mc - The monitoring context for reading configs from the config provider.\n * @param createParams - The creation params:\n * gcOptions - The garbage collector runtime options.\n * metadata - The container runtime's createParams.metadata.\n * existing - Whether the container is new or an existing one.\n * @returns The garbage collector configurations.\n */\nexport function generateGCConfigs(\n\tmc: MonitoringContext,\n\tcreateParams: {\n\t\tgcOptions: IGCRuntimeOptions;\n\n\t\tmetadata: IContainerRuntimeMetadata | undefined;\n\t\texisting: boolean;\n\t\tisSummarizerClient: boolean;\n\t},\n): IGarbageCollectorConfigs {\n\tlet gcAllowed: boolean = true;\n\tlet sessionExpiryTimeoutMs: number | undefined;\n\tlet tombstoneTimeoutMs: number | undefined;\n\n\tlet persistedGcFeatureMatrix: GCFeatureMatrix | undefined;\n\n\tlet gcVersionInBaseSnapshot: GCVersion | undefined;\n\n\t/**\n\t * The following GC state is enabled during container creation and cannot be changed throughout its lifetime:\n\t * 1. Whether running GC mark phase is allowed or not.\n\t * 2. Whether running GC sweep phase is allowed or not.\n\t * 3. Whether GC session expiry is enabled or not.\n\t * For existing containers, we get this information from the metadata blob of its summary.\n\t */\n\tif (createParams.existing) {\n\t\tconst metadata = createParams.metadata;\n\t\tgcVersionInBaseSnapshot = getGCVersion(metadata);\n\t\t// Existing documents which did not have metadata blob or had GC disabled have GC version as 0. GC will be\n\t\t// disabled for these documents.\n\t\tgcAllowed = gcVersionInBaseSnapshot !== 0;\n\t\tsessionExpiryTimeoutMs = metadata?.sessionExpiryTimeoutMs;\n\t\tconst legacyPersistedSweepTimeoutMs = (metadata as IGCMetadata_Deprecated)?.sweepTimeoutMs;\n\t\ttombstoneTimeoutMs =\n\t\t\tmetadata?.tombstoneTimeoutMs ??\n\t\t\tlegacyPersistedSweepTimeoutMs ?? // Backfill old documents that have sweepTimeoutMs instead of tombstoneTimeoutMs\n\t\t\tcomputeTombstoneTimeout(sessionExpiryTimeoutMs); // Backfill old documents that didn't persist either value\n\t\tpersistedGcFeatureMatrix = metadata?.gcFeatureMatrix;\n\t} else {\n\t\t// This Test Override only applies for new containers\n\t\tconst testOverrideTombstoneTimeoutMs = mc.config.getNumber(\n\t\t\t\"Fluid.GarbageCollection.TestOverride.TombstoneTimeoutMs\",\n\t\t);\n\n\t\t// Set the Session Expiry if session expiry flag isn't explicitly set to false.\n\t\tif (mc.config.getBoolean(runSessionExpiryKey) !== false) {\n\t\t\tsessionExpiryTimeoutMs =\n\t\t\t\tcreateParams.gcOptions.sessionExpiryTimeoutMs ?? defaultSessionExpiryDurationMs;\n\t\t}\n\t\ttombstoneTimeoutMs =\n\t\t\ttestOverrideTombstoneTimeoutMs ?? computeTombstoneTimeout(sessionExpiryTimeoutMs);\n\n\t\tconst gcGeneration = createParams.gcOptions[gcGenerationOptionName] as number;\n\t\tif (gcGeneration !== undefined) {\n\t\t\tpersistedGcFeatureMatrix = { gcGeneration };\n\t\t}\n\t}\n\n\t// The persisted GC generation must indicate Sweep is allowed for this document,\n\t// according to the GC Generation option provided this session.\n\t// Note that if no generation option is provided, Sweep is allowed for any document.\n\tconst sweepAllowed = shouldAllowGcSweep(\n\t\tpersistedGcFeatureMatrix ?? {} /* featureMatrix */,\n\t\tcreateParams.gcOptions[gcGenerationOptionName] as\n\t\t\t| number\n\t\t\t| undefined /* currentGeneration */,\n\t);\n\n\t/**\n\t * Whether sweep is enabled for this session or not. If sweep is enabled, Tombstones should fail on load and\n\t * sweep-ready nodes should be deleted.\n\t *\n\t * Assuming overall GC is allowed and tombstoneTimeout is provided, the following conditions have to be met to run sweep:\n\t *\n\t * 1. Sweep should be allowed in this container.\n\t * 2. Sweep should be enabled for this session.\n\t */\n\tconst sweepEnabled: boolean =\n\t\t!gcAllowed || tombstoneTimeoutMs === undefined\n\t\t\t? false\n\t\t\t: sweepAllowed && createParams.gcOptions.enableGCSweep === true;\n\n\t// Override inactive timeout if test config or gc options to override it is set.\n\tconst inactiveTimeoutMs: number =\n\t\tmc.config.getNumber(\"Fluid.GarbageCollection.TestOverride.InactiveTimeoutMs\") ??\n\t\t(createParams.gcOptions.inactiveTimeoutMs as number) ??\n\t\tdefaultInactiveTimeoutMs;\n\n\t// Inactive timeout must be greater than tombstone timeout since a node goes from active -> inactive -> sweep ready.\n\tif (tombstoneTimeoutMs !== undefined && inactiveTimeoutMs > tombstoneTimeoutMs) {\n\t\tthrow new UsageError(\"inactive timeout should not be greater than the tombstone timeout\");\n\t}\n\n\t// Whether we are running in test mode. In this mode, unreferenced nodes are immediately deleted.\n\tconst testMode =\n\t\tmc.config.getBoolean(gcTestModeKey) ?? createParams.gcOptions.runGCInTestMode === true;\n\tconst runFullGC = createParams.gcOptions.runFullGC;\n\n\tconst sweepGracePeriodMs =\n\t\tcreateParams.gcOptions.sweepGracePeriodMs ?? defaultSweepGracePeriodMs;\n\tvalidatePrecondition(sweepGracePeriodMs >= 0, \"sweepGracePeriodMs must be non-negative\", {\n\t\tsweepGracePeriodMs,\n\t});\n\n\tconst throwOnTombstoneLoad =\n\t\tmc.config.getBoolean(disableThrowOnTombstoneLoadKey) !== true &&\n\t\tsweepEnabled &&\n\t\t!createParams.isSummarizerClient;\n\n\treturn {\n\t\tgcAllowed, // For this document\n\t\tsweepAllowed, // For this document\n\t\tsweepEnabled, // For this session\n\t\trunFullGC,\n\t\ttestMode,\n\t\tsessionExpiryTimeoutMs,\n\t\ttombstoneTimeoutMs,\n\t\tsweepGracePeriodMs,\n\t\tinactiveTimeoutMs,\n\t\tpersistedGcFeatureMatrix,\n\t\tgcVersionInBaseSnapshot,\n\t\tgcVersionInEffect: getGCVersionInEffect(mc.config),\n\t\tthrowOnTombstoneLoad,\n\t};\n}\n\n/**\n * Tombstone timeout is the time after which unreferenced content is guaranteed not to be revived (re-referenced).\n * Tombstone timeout = session expiry timeout + snapshot cache expiry timeout + one day buffer.\n *\n * The snapshot cache expiry timeout cannot be known precisely but the upper bound is 5 days.\n * The buffer is added to account for any clock skew or other edge cases.\n * We use server timestamps throughout so the skew should be minimal but make it 1 day to be safe.\n *\n * If there is no Session Expiry timeout, GC can never guarantee an object won't be revived, so return undefined.\n */\nexport function computeTombstoneTimeout(\n\tsessionExpiryTimeoutMs: number | undefined,\n): number | undefined {\n\tconst bufferMs = oneDayMs;\n\treturn (\n\t\tsessionExpiryTimeoutMs && sessionExpiryTimeoutMs + maxSnapshotCacheExpiryMs + bufferMs\n\t);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"gcConfigs.js","sourceRoot":"","sources":["../../src/gc/gcConfigs.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAEN,UAAU,EACV,oBAAoB,GACpB,MAAM,0CAA0C,CAAC;AAIlD,OAAO,EAMN,wBAAwB,EACxB,8BAA8B,EAC9B,yBAAyB,EACzB,sBAAsB,EACtB,aAAa,EACb,wBAAwB,EACxB,QAAQ,EACR,mBAAmB,EACnB,8BAA8B,GAC9B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAExF;;;;;;;;GAQG;AACH,MAAM,UAAU,iBAAiB,CAChC,EAAqB,EACrB,YAMC;IAED,IAAI,SAAS,GAAY,IAAI,CAAC;IAC9B,IAAI,sBAA0C,CAAC;IAC/C,IAAI,kBAAsC,CAAC;IAE3C,IAAI,wBAAqD,CAAC;IAE1D,IAAI,uBAA8C,CAAC;IAEnD;;;;;;OAMG;IACH,IAAI,YAAY,CAAC,QAAQ,EAAE,CAAC;QAC3B,MAAM,QAAQ,GAAG,YAAY,CAAC,QAAQ,CAAC;QACvC,uBAAuB,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC;QACjD,0GAA0G;QAC1G,gCAAgC;QAChC,SAAS,GAAG,uBAAuB,KAAK,CAAC,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AS;QAC1C,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,sBAAsB,GAAG,wBAAwB,GAAG,QAAQ,CAAC;AACjE,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\ttype MonitoringContext,\n\tUsageError,\n\tvalidatePrecondition,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport type { IContainerRuntimeMetadata } from \"../summary/index.js\";\n\nimport {\n\ttype GCFeatureMatrix,\n\ttype GCVersion,\n\ttype IGCMetadata_Deprecated,\n\ttype IGCRuntimeOptions,\n\ttype IGarbageCollectorConfigs,\n\tdefaultInactiveTimeoutMs,\n\tdefaultSessionExpiryDurationMs,\n\tdefaultSweepGracePeriodMs,\n\tgcGenerationOptionName,\n\tgcTestModeKey,\n\tmaxSnapshotCacheExpiryMs,\n\toneDayMs,\n\trunSessionExpiryKey,\n\tdisableThrowOnTombstoneLoadKey,\n} from \"./gcDefinitions.js\";\nimport { getGCVersion, getGCVersionInEffect, shouldAllowGcSweep } from \"./gcHelpers.js\";\n\n/**\n * Generates configurations for the Garbage Collector that it uses to determine what to run and how.\n * @param mc - The monitoring context for reading configs from the config provider.\n * @param createParams - The creation params:\n * gcOptions - The garbage collector runtime options.\n * metadata - The container runtime's createParams.metadata.\n * existing - Whether the container is new or an existing one.\n * @returns The garbage collector configurations.\n */\nexport function generateGCConfigs(\n\tmc: MonitoringContext,\n\tcreateParams: {\n\t\tgcOptions: IGCRuntimeOptions;\n\n\t\tmetadata: IContainerRuntimeMetadata | undefined;\n\t\texisting: boolean;\n\t\tisSummarizerClient: boolean;\n\t},\n): IGarbageCollectorConfigs {\n\tlet gcAllowed: boolean = true;\n\tlet sessionExpiryTimeoutMs: number | undefined;\n\tlet tombstoneTimeoutMs: number | undefined;\n\n\tlet persistedGcFeatureMatrix: GCFeatureMatrix | undefined;\n\n\tlet gcVersionInBaseSnapshot: GCVersion | undefined;\n\n\t/**\n\t * The following GC state is enabled during container creation and cannot be changed throughout its lifetime:\n\t * 1. Whether running GC mark phase is allowed or not.\n\t * 2. Whether running GC sweep phase is allowed or not.\n\t * 3. Whether GC session expiry is enabled or not.\n\t * For existing containers, we get this information from the metadata blob of its summary.\n\t */\n\tif (createParams.existing) {\n\t\tconst metadata = createParams.metadata;\n\t\tgcVersionInBaseSnapshot = getGCVersion(metadata);\n\t\t// Existing documents which did not have metadata blob or had GC disabled have GC version as 0. GC will be\n\t\t// disabled for these documents.\n\t\tgcAllowed = gcVersionInBaseSnapshot !== 0;\n\t\tsessionExpiryTimeoutMs = metadata?.sessionExpiryTimeoutMs;\n\t\tconst legacyPersistedSweepTimeoutMs = (metadata as IGCMetadata_Deprecated)?.sweepTimeoutMs;\n\t\ttombstoneTimeoutMs =\n\t\t\tmetadata?.tombstoneTimeoutMs ??\n\t\t\tlegacyPersistedSweepTimeoutMs ?? // Backfill old documents that have sweepTimeoutMs instead of tombstoneTimeoutMs\n\t\t\tcomputeTombstoneTimeout(sessionExpiryTimeoutMs); // Backfill old documents that didn't persist either value\n\t\tpersistedGcFeatureMatrix = metadata?.gcFeatureMatrix;\n\t} else {\n\t\t// This Test Override only applies for new containers\n\t\tconst testOverrideTombstoneTimeoutMs = mc.config.getNumber(\n\t\t\t\"Fluid.GarbageCollection.TestOverride.TombstoneTimeoutMs\",\n\t\t);\n\n\t\t// Set the Session Expiry if session expiry flag isn't explicitly set to false.\n\t\tif (mc.config.getBoolean(runSessionExpiryKey) !== false) {\n\t\t\tsessionExpiryTimeoutMs =\n\t\t\t\tcreateParams.gcOptions.sessionExpiryTimeoutMs ?? defaultSessionExpiryDurationMs;\n\t\t}\n\t\ttombstoneTimeoutMs =\n\t\t\ttestOverrideTombstoneTimeoutMs ?? computeTombstoneTimeout(sessionExpiryTimeoutMs);\n\n\t\tconst gcGeneration = createParams.gcOptions[gcGenerationOptionName] as number;\n\t\tif (gcGeneration !== undefined) {\n\t\t\tpersistedGcFeatureMatrix = { gcGeneration };\n\t\t}\n\t}\n\n\t// The persisted GC generation must indicate Sweep is allowed for this document,\n\t// according to the GC Generation option provided this session.\n\t// Note that if no generation option is provided, Sweep is allowed for any document.\n\tconst sweepAllowed = shouldAllowGcSweep(\n\t\tpersistedGcFeatureMatrix ?? {} /* featureMatrix */,\n\t\tcreateParams.gcOptions[gcGenerationOptionName] as\n\t\t\t| number\n\t\t\t| undefined /* currentGeneration */,\n\t);\n\n\t/**\n\t * Whether sweep is enabled for this session or not. If sweep is enabled, Tombstones should fail on load and\n\t * sweep-ready nodes should be deleted.\n\t *\n\t * Assuming overall GC is allowed and tombstoneTimeout is provided, the following conditions have to be met to run sweep:\n\t *\n\t * 1. Sweep should be allowed in this container.\n\t * 2. Sweep should be enabled for this session.\n\t */\n\tconst sweepEnabled: boolean =\n\t\t!gcAllowed || tombstoneTimeoutMs === undefined\n\t\t\t? false\n\t\t\t: sweepAllowed && createParams.gcOptions.enableGCSweep === true;\n\n\t// Override inactive timeout if test config or gc options to override it is set.\n\tconst inactiveTimeoutMs: number =\n\t\tmc.config.getNumber(\"Fluid.GarbageCollection.TestOverride.InactiveTimeoutMs\") ??\n\t\t(createParams.gcOptions.inactiveTimeoutMs as number) ??\n\t\tdefaultInactiveTimeoutMs;\n\n\t// Inactive timeout must be greater than tombstone timeout since a node goes from active -> inactive -> sweep ready.\n\tif (tombstoneTimeoutMs !== undefined && inactiveTimeoutMs > tombstoneTimeoutMs) {\n\t\tthrow new UsageError(\"inactive timeout should not be greater than the tombstone timeout\");\n\t}\n\n\t// Whether we are running in test mode. In this mode, unreferenced nodes are immediately deleted.\n\tconst testMode =\n\t\tmc.config.getBoolean(gcTestModeKey) ?? createParams.gcOptions.runGCInTestMode === true;\n\tconst runFullGC = createParams.gcOptions.runFullGC;\n\n\tconst sweepGracePeriodMs =\n\t\tcreateParams.gcOptions.sweepGracePeriodMs ?? defaultSweepGracePeriodMs;\n\tvalidatePrecondition(sweepGracePeriodMs >= 0, \"sweepGracePeriodMs must be non-negative\", {\n\t\tsweepGracePeriodMs,\n\t});\n\n\tconst throwOnTombstoneLoad =\n\t\tmc.config.getBoolean(disableThrowOnTombstoneLoadKey) !== true &&\n\t\tsweepEnabled &&\n\t\t!createParams.isSummarizerClient;\n\n\treturn {\n\t\tgcAllowed, // For this document\n\t\tsweepAllowed, // For this document\n\t\tsweepEnabled, // For this session\n\t\trunFullGC,\n\t\ttestMode,\n\t\tsessionExpiryTimeoutMs,\n\t\ttombstoneTimeoutMs,\n\t\tsweepGracePeriodMs,\n\t\tinactiveTimeoutMs,\n\t\tpersistedGcFeatureMatrix,\n\t\tgcVersionInBaseSnapshot,\n\t\tgcVersionInEffect: getGCVersionInEffect(mc.config),\n\t\tthrowOnTombstoneLoad,\n\t};\n}\n\n/**\n * Tombstone timeout is the time after which unreferenced content is guaranteed not to be revived (re-referenced).\n * Tombstone timeout = session expiry timeout + snapshot cache expiry timeout + one day buffer.\n *\n * The snapshot cache expiry timeout cannot be known precisely but the upper bound is 5 days.\n * The buffer is added to account for any clock skew or other edge cases.\n * We use server timestamps throughout so the skew should be minimal but make it 1 day to be safe.\n *\n * If there is no Session Expiry timeout, GC can never guarantee an object won't be revived, so return undefined.\n */\nexport function computeTombstoneTimeout(\n\tsessionExpiryTimeoutMs: number | undefined,\n): number | undefined {\n\tconst bufferMs = oneDayMs;\n\treturn sessionExpiryTimeoutMs === undefined\n\t\t? undefined\n\t\t: sessionExpiryTimeoutMs + maxSnapshotCacheExpiryMs + bufferMs;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gcReferenceGraphAlgorithm.js","sourceRoot":"","sources":["../../src/gc/gcReferenceGraphAlgorithm.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB,CACnC,cAA0C,EAC1C,OAAiB;IAEjB,gGAAgG;IAChG,MAAM,OAAO,GAAgB,IAAI,GAAG,EAAE,CAAC;IAEvC,oGAAoG;IACpG,qCAA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AAI,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC;YACrB,iBAAiB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC5B,CAAC;aAAM,CAAC;YACP,cAAc,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACzB,CAAC;IACF,CAAC;IACD,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,CAAC;AAC9C,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IGCResult } from \"./gcDefinitions.js\";\n\n/**\n * Runs garbage collection on the given reference graph.\n * @param referenceGraph - The reference graph to run GC on. It's a list of nodes where each node has an id and set of\n * routes to other nodes in the graph.\n * @param rootIds - The ids of root nodes that are considered referenced.\n * @returns the ids of referenced nodes and the ids of deleted nodes in the referenced graph.\n */\nexport function runGarbageCollection(\n\treferenceGraph: { [id: string]: string[] },\n\trootIds: string[],\n): IGCResult {\n\t// This set keeps track of nodes that we have visited. It is used to detect cycles in the graph.\n\tconst visited: Set<string> = new Set();\n\n\t// This tracks the ids of referenced nodes. The nodes corresponding to rootIds are always considered\n\t// referenced so we start with those.\n\tconst referencedIds: string[] = [...rootIds];\n\tfor (const id of referencedIds) {\n\t\t// If we have already seen this node, ignore and continue. Else, add it to visited list.\n\t\tif (visited.has(id)) {\n\t\t\tcontinue;\n\t\t}\n\t\tvisited.add(id);\n\n\t\t// Get the node for the referenced id and add its outbound routes to referencedIds since they are\n\t\t// also referenced.\n\t\tconst routes: string[] | undefined = referenceGraph[id];\n\t\tif (routes !== undefined) {\n\t\t\treferencedIds.push(...routes);\n\t\t}\n\t}\n\n\tconst referencedNodeIds: string[] = [];\n\tconst deletedNodeIds: string[] = [];\n\tfor (const id of Object.keys(referenceGraph)) {\n\t\t// The nodes from the reference graph whose ids are in the visited list are referenced.\n\t\t// The rest of the nodes are deleted.\n\t\tif (visited.has(id)) {\n\t\t\treferencedNodeIds.push(id);\n\t\t} else {\n\t\t\tdeletedNodeIds.push(id);\n\t\t}\n\t}\n\treturn { referencedNodeIds, deletedNodeIds };\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gcTelemetry.d.ts","sourceRoot":"","sources":["../../src/gc/gcTelemetry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AAC3F,OAAO,EACN,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EAGtB,KAAK,uBAAuB,EAC5B,MAAM,0CAA0C,CAAC;AAElD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAEpE,OAAO,EAEN,UAAU,EACV,KAAK,wBAAwB,EAE7B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAEhF,KAAK,aAAa,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,GAAG,UAAU,CAAC;AAEnE;;GAEG;AACH,UAAU,YAAY;IACrB,SAAS,EAAE,aAAa,CAAC;IACzB,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,OAAO,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAC5B,eAAe,CAAC,EAAE,uBAAuB,CAAC;CAC1C;AA4BD;;GAEG;AACH,UAAU,eAAgB,SAAQ,YAAY;IAC7C;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,2BAA2B,EAAE,MAAM,CAAC;IACpC;;;;OAIG;IACH,WAAW,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAAC;IAC3C;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,YAAY,CAAC,EAAE,I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.js
CHANGED
|
@@ -84,8 +84,9 @@ export class GCTelemetryTracker {
|
|
|
84
84
|
return this.configs.tombstoneTimeoutMs;
|
|
85
85
|
}
|
|
86
86
|
case UnreferencedState.SweepReady: {
|
|
87
|
-
return
|
|
88
|
-
|
|
87
|
+
return this.configs.tombstoneTimeoutMs === undefined
|
|
88
|
+
? undefined
|
|
89
|
+
: this.configs.tombstoneTimeoutMs + this.configs.sweepGracePeriodMs;
|
|
89
90
|
}
|
|
90
91
|
default: {
|
|
91
92
|
return undefined;
|
|
@@ -180,7 +181,7 @@ export class GCTelemetryTracker {
|
|
|
180
181
|
};
|
|
181
182
|
if (usageType === "Loaded" &&
|
|
182
183
|
this.configs.throwOnTombstoneLoad &&
|
|
183
|
-
|
|
184
|
+
headers?.allowTombstone !== true) {
|
|
184
185
|
this.mc.logger.sendErrorEvent(event);
|
|
185
186
|
}
|
|
186
187
|
else {
|