@fluidframework/container-runtime 2.0.0-internal.3.0.2 → 2.0.0-internal.3.2.0
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.js +19 -19
- package/.mocharc.js +2 -2
- package/api-extractor.json +2 -2
- package/dist/batchTracker.d.ts.map +1 -1
- package/dist/batchTracker.js +2 -1
- package/dist/batchTracker.js.map +1 -1
- package/dist/blobManager.d.ts +15 -2
- package/dist/blobManager.d.ts.map +1 -1
- package/dist/blobManager.js +109 -37
- package/dist/blobManager.js.map +1 -1
- package/dist/connectionTelemetry.d.ts.map +1 -1
- package/dist/connectionTelemetry.js +11 -9
- package/dist/connectionTelemetry.js.map +1 -1
- package/dist/containerHandleContext.d.ts.map +1 -1
- package/dist/containerHandleContext.js +3 -1
- package/dist/containerHandleContext.js.map +1 -1
- package/dist/containerRuntime.d.ts +23 -11
- package/dist/containerRuntime.d.ts.map +1 -1
- package/dist/containerRuntime.js +225 -132
- package/dist/containerRuntime.js.map +1 -1
- package/dist/dataStore.d.ts.map +1 -1
- package/dist/dataStore.js +11 -9
- package/dist/dataStore.js.map +1 -1
- package/dist/dataStoreContext.d.ts +27 -13
- package/dist/dataStoreContext.d.ts.map +1 -1
- package/dist/dataStoreContext.js +95 -56
- package/dist/dataStoreContext.js.map +1 -1
- package/dist/dataStoreContexts.d.ts.map +1 -1
- package/dist/dataStoreContexts.js +7 -3
- package/dist/dataStoreContexts.js.map +1 -1
- package/dist/dataStoreRegistry.d.ts.map +1 -1
- package/dist/dataStoreRegistry.js +3 -1
- package/dist/dataStoreRegistry.js.map +1 -1
- package/dist/dataStores.d.ts +28 -4
- package/dist/dataStores.d.ts.map +1 -1
- package/dist/dataStores.js +122 -44
- package/dist/dataStores.js.map +1 -1
- package/dist/deltaScheduler.d.ts.map +1 -1
- package/dist/deltaScheduler.js +8 -3
- package/dist/deltaScheduler.js.map +1 -1
- package/dist/{garbageCollection.d.ts → gc/garbageCollection.d.ts} +27 -203
- package/dist/gc/garbageCollection.d.ts.map +1 -0
- package/dist/{garbageCollection.js → gc/garbageCollection.js} +210 -400
- package/dist/gc/garbageCollection.js.map +1 -0
- package/dist/gc/gcDefinitions.d.ts +189 -0
- package/dist/gc/gcDefinitions.d.ts.map +1 -0
- package/dist/{garbageCollectionConstants.js → gc/gcDefinitions.js} +27 -2
- package/dist/gc/gcDefinitions.js.map +1 -0
- package/dist/gc/gcHelpers.d.ts +30 -0
- package/dist/gc/gcHelpers.d.ts.map +1 -0
- package/dist/gc/gcHelpers.js +65 -0
- package/dist/gc/gcHelpers.js.map +1 -0
- package/dist/gc/gcSummaryStateTracker.d.ts +86 -0
- package/dist/gc/gcSummaryStateTracker.d.ts.map +1 -0
- package/dist/gc/gcSummaryStateTracker.js +246 -0
- package/dist/gc/gcSummaryStateTracker.js.map +1 -0
- package/{lib → dist/gc}/gcSweepReadyUsageDetection.d.ts +5 -5
- package/dist/gc/gcSweepReadyUsageDetection.d.ts.map +1 -0
- package/dist/{gcSweepReadyUsageDetection.js → gc/gcSweepReadyUsageDetection.js} +15 -11
- package/dist/gc/gcSweepReadyUsageDetection.js.map +1 -0
- package/dist/gc/gcUnreferencedStateTracker.d.ts +34 -0
- package/dist/gc/gcUnreferencedStateTracker.d.ts.map +1 -0
- package/dist/gc/gcUnreferencedStateTracker.js +94 -0
- package/dist/gc/gcUnreferencedStateTracker.js.map +1 -0
- package/dist/gc/index.d.ts +11 -0
- package/dist/gc/index.d.ts.map +1 -0
- package/dist/gc/index.js +40 -0
- package/dist/gc/index.js.map +1 -0
- package/dist/index.d.ts +2 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -9
- package/dist/index.js.map +1 -1
- package/dist/opLifecycle/batchManager.d.ts +2 -13
- package/dist/opLifecycle/batchManager.d.ts.map +1 -1
- package/dist/opLifecycle/batchManager.js +19 -41
- package/dist/opLifecycle/batchManager.js.map +1 -1
- package/dist/opLifecycle/definitions.d.ts +4 -0
- package/dist/opLifecycle/definitions.d.ts.map +1 -1
- package/dist/opLifecycle/definitions.js.map +1 -1
- package/dist/opLifecycle/index.d.ts.map +1 -1
- package/dist/opLifecycle/index.js.map +1 -1
- package/dist/opLifecycle/opCompressor.d.ts.map +1 -1
- package/dist/opLifecycle/opCompressor.js +1 -0
- package/dist/opLifecycle/opCompressor.js.map +1 -1
- package/dist/opLifecycle/opDecompressor.d.ts.map +1 -1
- package/dist/opLifecycle/opDecompressor.js +5 -2
- package/dist/opLifecycle/opDecompressor.js.map +1 -1
- package/dist/opLifecycle/opSplitter.d.ts +1 -1
- package/dist/opLifecycle/opSplitter.d.ts.map +1 -1
- package/dist/opLifecycle/opSplitter.js +24 -13
- package/dist/opLifecycle/opSplitter.js.map +1 -1
- package/dist/opLifecycle/outbox.d.ts +19 -3
- package/dist/opLifecycle/outbox.d.ts.map +1 -1
- package/dist/opLifecycle/outbox.js +78 -45
- package/dist/opLifecycle/outbox.js.map +1 -1
- package/dist/opLifecycle/remoteMessageProcessor.d.ts.map +1 -1
- package/dist/opLifecycle/remoteMessageProcessor.js.map +1 -1
- package/dist/opProperties.d.ts.map +1 -1
- package/dist/opProperties.js +1 -3
- package/dist/opProperties.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 +8 -2
- package/dist/pendingStateManager.d.ts.map +1 -1
- package/dist/pendingStateManager.js +21 -13
- package/dist/pendingStateManager.js.map +1 -1
- package/dist/scheduleManager.d.ts.map +1 -1
- package/dist/scheduleManager.js +3 -2
- package/dist/scheduleManager.js.map +1 -1
- package/dist/serializedSnapshotStorage.d.ts +2 -2
- package/dist/serializedSnapshotStorage.d.ts.map +1 -1
- package/dist/serializedSnapshotStorage.js +5 -3
- package/dist/serializedSnapshotStorage.js.map +1 -1
- package/dist/summary/index.d.ts +17 -0
- package/dist/summary/index.d.ts.map +1 -0
- package/dist/summary/index.js +47 -0
- package/dist/summary/index.js.map +1 -0
- package/dist/summary/orderedClientElection.d.ts.map +1 -0
- package/dist/{orderedClientElection.js → summary/orderedClientElection.js} +10 -4
- package/dist/summary/orderedClientElection.js.map +1 -0
- package/dist/summary/runWhileConnectedCoordinator.d.ts.map +1 -0
- package/dist/summary/runWhileConnectedCoordinator.js.map +1 -0
- package/{lib → dist/summary}/runningSummarizer.d.ts +19 -18
- package/dist/summary/runningSummarizer.d.ts.map +1 -0
- package/dist/{runningSummarizer.js → summary/runningSummarizer.js} +191 -76
- package/dist/summary/runningSummarizer.js.map +1 -0
- package/dist/{summarizer.d.ts → summary/summarizer.d.ts} +4 -6
- package/dist/summary/summarizer.d.ts.map +1 -0
- package/dist/{summarizer.js → summary/summarizer.js} +31 -71
- package/dist/summary/summarizer.js.map +1 -0
- package/dist/summary/summarizerClientElection.d.ts.map +1 -0
- package/dist/summary/summarizerClientElection.js.map +1 -0
- package/dist/summary/summarizerHandle.d.ts.map +1 -0
- package/dist/summary/summarizerHandle.js.map +1 -0
- package/{lib → dist/summary}/summarizerHeuristics.d.ts +1 -1
- package/dist/summary/summarizerHeuristics.d.ts.map +1 -0
- package/dist/{summarizerHeuristics.js → summary/summarizerHeuristics.js} +6 -9
- package/dist/summary/summarizerHeuristics.js.map +1 -0
- package/{lib → dist/summary}/summarizerTypes.d.ts +22 -22
- package/dist/summary/summarizerTypes.d.ts.map +1 -0
- package/dist/summary/summarizerTypes.js.map +1 -0
- package/dist/summary/summaryCollection.d.ts.map +1 -0
- package/dist/{summaryCollection.js → summary/summaryCollection.js} +18 -8
- package/dist/summary/summaryCollection.js.map +1 -0
- package/{lib → dist/summary}/summaryFormat.d.ts +1 -40
- package/dist/summary/summaryFormat.d.ts.map +1 -0
- package/dist/{summaryFormat.js → summary/summaryFormat.js} +19 -20
- package/dist/summary/summaryFormat.js.map +1 -0
- package/dist/summary/summaryGenerator.d.ts.map +1 -0
- package/dist/{summaryGenerator.js → summary/summaryGenerator.js} +33 -15
- package/dist/summary/summaryGenerator.js.map +1 -0
- package/dist/{summaryManager.d.ts → summary/summaryManager.d.ts} +1 -1
- package/dist/summary/summaryManager.d.ts.map +1 -0
- package/dist/{summaryManager.js → summary/summaryManager.js} +21 -9
- package/dist/summary/summaryManager.js.map +1 -0
- package/dist/throttler.d.ts +2 -2
- package/dist/throttler.d.ts.map +1 -1
- package/dist/throttler.js +4 -4
- package/dist/throttler.js.map +1 -1
- package/lib/batchTracker.d.ts.map +1 -1
- package/lib/batchTracker.js +2 -1
- package/lib/batchTracker.js.map +1 -1
- package/lib/blobManager.d.ts +15 -2
- package/lib/blobManager.d.ts.map +1 -1
- package/lib/blobManager.js +109 -37
- package/lib/blobManager.js.map +1 -1
- package/lib/connectionTelemetry.d.ts.map +1 -1
- package/lib/connectionTelemetry.js +11 -9
- package/lib/connectionTelemetry.js.map +1 -1
- package/lib/containerHandleContext.d.ts.map +1 -1
- package/lib/containerHandleContext.js +3 -1
- package/lib/containerHandleContext.js.map +1 -1
- package/lib/containerRuntime.d.ts +23 -11
- package/lib/containerRuntime.d.ts.map +1 -1
- package/lib/containerRuntime.js +201 -108
- package/lib/containerRuntime.js.map +1 -1
- package/lib/dataStore.d.ts.map +1 -1
- package/lib/dataStore.js +11 -9
- package/lib/dataStore.js.map +1 -1
- package/lib/dataStoreContext.d.ts +27 -13
- package/lib/dataStoreContext.d.ts.map +1 -1
- package/lib/dataStoreContext.js +84 -45
- package/lib/dataStoreContext.js.map +1 -1
- package/lib/dataStoreContexts.d.ts.map +1 -1
- package/lib/dataStoreContexts.js +7 -3
- package/lib/dataStoreContexts.js.map +1 -1
- package/lib/dataStoreRegistry.d.ts.map +1 -1
- package/lib/dataStoreRegistry.js +3 -1
- package/lib/dataStoreRegistry.js.map +1 -1
- package/lib/dataStores.d.ts +28 -4
- package/lib/dataStores.d.ts.map +1 -1
- package/lib/dataStores.js +120 -42
- package/lib/dataStores.js.map +1 -1
- package/lib/deltaScheduler.d.ts.map +1 -1
- package/lib/deltaScheduler.js +9 -4
- package/lib/deltaScheduler.js.map +1 -1
- package/lib/{garbageCollection.d.ts → gc/garbageCollection.d.ts} +27 -203
- package/lib/gc/garbageCollection.d.ts.map +1 -0
- package/lib/{garbageCollection.js → gc/garbageCollection.js} +190 -379
- package/lib/gc/garbageCollection.js.map +1 -0
- package/lib/gc/gcDefinitions.d.ts +189 -0
- package/lib/gc/gcDefinitions.d.ts.map +1 -0
- package/lib/{garbageCollectionConstants.js → gc/gcDefinitions.js} +26 -1
- package/lib/gc/gcDefinitions.js.map +1 -0
- package/lib/gc/gcHelpers.d.ts +30 -0
- package/lib/gc/gcHelpers.d.ts.map +1 -0
- package/lib/gc/gcHelpers.js +58 -0
- package/lib/gc/gcHelpers.js.map +1 -0
- package/lib/gc/gcSummaryStateTracker.d.ts +86 -0
- package/lib/gc/gcSummaryStateTracker.d.ts.map +1 -0
- package/lib/gc/gcSummaryStateTracker.js +242 -0
- package/lib/gc/gcSummaryStateTracker.js.map +1 -0
- package/{dist → lib/gc}/gcSweepReadyUsageDetection.d.ts +5 -5
- package/lib/gc/gcSweepReadyUsageDetection.d.ts.map +1 -0
- package/lib/{gcSweepReadyUsageDetection.js → gc/gcSweepReadyUsageDetection.js} +15 -11
- package/lib/gc/gcSweepReadyUsageDetection.js.map +1 -0
- package/lib/gc/gcUnreferencedStateTracker.d.ts +34 -0
- package/lib/gc/gcUnreferencedStateTracker.d.ts.map +1 -0
- package/lib/gc/gcUnreferencedStateTracker.js +90 -0
- package/lib/gc/gcUnreferencedStateTracker.js.map +1 -0
- package/lib/gc/index.d.ts +11 -0
- package/lib/gc/index.d.ts.map +1 -0
- package/lib/gc/index.js +11 -0
- package/lib/gc/index.js.map +1 -0
- package/lib/index.d.ts +2 -5
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -4
- package/lib/index.js.map +1 -1
- package/lib/opLifecycle/batchManager.d.ts +2 -13
- package/lib/opLifecycle/batchManager.d.ts.map +1 -1
- package/lib/opLifecycle/batchManager.js +19 -41
- package/lib/opLifecycle/batchManager.js.map +1 -1
- package/lib/opLifecycle/definitions.d.ts +4 -0
- package/lib/opLifecycle/definitions.d.ts.map +1 -1
- package/lib/opLifecycle/definitions.js.map +1 -1
- package/lib/opLifecycle/index.d.ts.map +1 -1
- package/lib/opLifecycle/index.js.map +1 -1
- package/lib/opLifecycle/opCompressor.d.ts.map +1 -1
- package/lib/opLifecycle/opCompressor.js +1 -0
- package/lib/opLifecycle/opCompressor.js.map +1 -1
- package/lib/opLifecycle/opDecompressor.d.ts.map +1 -1
- package/lib/opLifecycle/opDecompressor.js +5 -2
- package/lib/opLifecycle/opDecompressor.js.map +1 -1
- package/lib/opLifecycle/opSplitter.d.ts +1 -1
- package/lib/opLifecycle/opSplitter.d.ts.map +1 -1
- package/lib/opLifecycle/opSplitter.js +25 -14
- package/lib/opLifecycle/opSplitter.js.map +1 -1
- package/lib/opLifecycle/outbox.d.ts +19 -3
- package/lib/opLifecycle/outbox.d.ts.map +1 -1
- package/lib/opLifecycle/outbox.js +79 -46
- package/lib/opLifecycle/outbox.js.map +1 -1
- package/lib/opLifecycle/remoteMessageProcessor.d.ts.map +1 -1
- package/lib/opLifecycle/remoteMessageProcessor.js.map +1 -1
- package/lib/opProperties.d.ts.map +1 -1
- package/lib/opProperties.js +1 -3
- package/lib/opProperties.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 +8 -2
- package/lib/pendingStateManager.d.ts.map +1 -1
- package/lib/pendingStateManager.js +21 -13
- package/lib/pendingStateManager.js.map +1 -1
- package/lib/scheduleManager.d.ts.map +1 -1
- package/lib/scheduleManager.js +3 -2
- package/lib/scheduleManager.js.map +1 -1
- package/lib/serializedSnapshotStorage.d.ts +2 -2
- package/lib/serializedSnapshotStorage.d.ts.map +1 -1
- package/lib/serializedSnapshotStorage.js +5 -3
- package/lib/serializedSnapshotStorage.js.map +1 -1
- package/lib/summary/index.d.ts +17 -0
- package/lib/summary/index.d.ts.map +1 -0
- package/lib/summary/index.js +16 -0
- package/lib/summary/index.js.map +1 -0
- package/lib/summary/orderedClientElection.d.ts.map +1 -0
- package/lib/{orderedClientElection.js → summary/orderedClientElection.js} +10 -4
- package/lib/summary/orderedClientElection.js.map +1 -0
- package/lib/summary/runWhileConnectedCoordinator.d.ts.map +1 -0
- package/lib/summary/runWhileConnectedCoordinator.js.map +1 -0
- package/{dist → lib/summary}/runningSummarizer.d.ts +19 -18
- package/lib/summary/runningSummarizer.d.ts.map +1 -0
- package/lib/{runningSummarizer.js → summary/runningSummarizer.js} +193 -78
- package/lib/summary/runningSummarizer.js.map +1 -0
- package/lib/{summarizer.d.ts → summary/summarizer.d.ts} +4 -6
- package/lib/summary/summarizer.d.ts.map +1 -0
- package/lib/{summarizer.js → summary/summarizer.js} +33 -73
- package/lib/summary/summarizer.js.map +1 -0
- package/lib/summary/summarizerClientElection.d.ts.map +1 -0
- package/lib/summary/summarizerClientElection.js.map +1 -0
- package/lib/summary/summarizerHandle.d.ts.map +1 -0
- package/lib/summary/summarizerHandle.js.map +1 -0
- package/{dist → lib/summary}/summarizerHeuristics.d.ts +1 -1
- package/lib/summary/summarizerHeuristics.d.ts.map +1 -0
- package/lib/{summarizerHeuristics.js → summary/summarizerHeuristics.js} +6 -9
- package/lib/summary/summarizerHeuristics.js.map +1 -0
- package/{dist → lib/summary}/summarizerTypes.d.ts +22 -22
- package/lib/summary/summarizerTypes.d.ts.map +1 -0
- package/lib/summary/summarizerTypes.js.map +1 -0
- package/lib/summary/summaryCollection.d.ts.map +1 -0
- package/lib/{summaryCollection.js → summary/summaryCollection.js} +18 -8
- package/lib/summary/summaryCollection.js.map +1 -0
- package/{dist → lib/summary}/summaryFormat.d.ts +1 -40
- package/lib/summary/summaryFormat.d.ts.map +1 -0
- package/lib/{summaryFormat.js → summary/summaryFormat.js} +20 -20
- package/lib/summary/summaryFormat.js.map +1 -0
- package/lib/summary/summaryGenerator.d.ts.map +1 -0
- package/lib/{summaryGenerator.js → summary/summaryGenerator.js} +33 -15
- package/lib/summary/summaryGenerator.js.map +1 -0
- package/lib/{summaryManager.d.ts → summary/summaryManager.d.ts} +1 -1
- package/lib/summary/summaryManager.d.ts.map +1 -0
- package/lib/{summaryManager.js → summary/summaryManager.js} +21 -9
- package/lib/summary/summaryManager.js.map +1 -0
- package/lib/throttler.d.ts +2 -2
- package/lib/throttler.d.ts.map +1 -1
- package/lib/throttler.js +4 -4
- package/lib/throttler.js.map +1 -1
- package/package.json +60 -51
- package/prettier.config.cjs +1 -1
- package/src/batchTracker.ts +54 -49
- package/src/blobManager.ts +825 -674
- package/src/connectionTelemetry.ts +280 -249
- package/src/containerHandleContext.ts +27 -29
- package/src/containerRuntime.ts +3249 -2978
- package/src/dataStore.ts +172 -159
- package/src/dataStoreContext.ts +1141 -1057
- package/src/dataStoreContexts.ts +178 -161
- package/src/dataStoreRegistry.ts +25 -20
- package/src/dataStores.ts +880 -731
- package/src/deltaScheduler.ts +158 -150
- package/{garbageCollection.md → src/gc/garbageCollection.md} +16 -3
- package/src/gc/garbageCollection.ts +1506 -0
- package/src/gc/gcDefinitions.ts +244 -0
- package/src/gc/gcHelpers.ts +86 -0
- package/src/gc/gcSummaryStateTracker.ts +339 -0
- package/src/gc/gcSweepReadyUsageDetection.ts +145 -0
- package/src/gc/gcUnreferencedStateTracker.ts +114 -0
- package/src/gc/index.ts +40 -0
- package/src/index.ts +67 -70
- package/src/opLifecycle/README.md +152 -0
- package/src/opLifecycle/batchManager.ts +101 -144
- package/src/opLifecycle/definitions.ts +33 -29
- package/src/opLifecycle/index.ts +5 -5
- package/src/opLifecycle/opCompressor.ts +55 -53
- package/src/opLifecycle/opDecompressor.ts +100 -81
- package/src/opLifecycle/opSplitter.ts +233 -188
- package/src/opLifecycle/outbox.ts +251 -195
- package/src/opLifecycle/remoteMessageProcessor.ts +62 -62
- package/src/opProperties.ts +11 -9
- package/src/packageVersion.ts +1 -1
- package/src/pendingStateManager.ts +396 -338
- package/src/scheduleManager.ts +299 -269
- package/src/serializedSnapshotStorage.ts +126 -112
- package/src/summary/index.ts +99 -0
- package/src/summary/orderedClientElection.ts +564 -0
- package/src/summary/runWhileConnectedCoordinator.ts +113 -0
- package/src/summary/runningSummarizer.ts +788 -0
- package/src/summary/summarizer.ts +386 -0
- package/src/summary/summarizerClientElection.ts +139 -0
- package/src/{summarizerHandle.ts → summary/summarizerHandle.ts} +11 -9
- package/src/summary/summarizerHeuristics.ts +219 -0
- package/src/summary/summarizerTypes.ts +521 -0
- package/src/summary/summaryCollection.ts +450 -0
- package/src/summary/summaryFormat.ts +226 -0
- package/src/summary/summaryGenerator.ts +505 -0
- package/src/summary/summaryManager.ts +423 -0
- package/src/throttler.ts +131 -122
- package/tsconfig.esnext.json +6 -6
- package/tsconfig.json +9 -13
- package/dist/garbageCollection.d.ts.map +0 -1
- package/dist/garbageCollection.js.map +0 -1
- package/dist/garbageCollectionConstants.d.ts +0 -25
- package/dist/garbageCollectionConstants.d.ts.map +0 -1
- package/dist/garbageCollectionConstants.js.map +0 -1
- package/dist/garbageCollectionTombstoneUtils.d.ts +0 -14
- package/dist/garbageCollectionTombstoneUtils.d.ts.map +0 -1
- package/dist/garbageCollectionTombstoneUtils.js +0 -23
- package/dist/garbageCollectionTombstoneUtils.js.map +0 -1
- package/dist/gcSweepReadyUsageDetection.d.ts.map +0 -1
- package/dist/gcSweepReadyUsageDetection.js.map +0 -1
- package/dist/orderedClientElection.d.ts.map +0 -1
- package/dist/orderedClientElection.js.map +0 -1
- package/dist/runWhileConnectedCoordinator.d.ts.map +0 -1
- package/dist/runWhileConnectedCoordinator.js.map +0 -1
- package/dist/runningSummarizer.d.ts.map +0 -1
- package/dist/runningSummarizer.js.map +0 -1
- package/dist/summarizer.d.ts.map +0 -1
- package/dist/summarizer.js.map +0 -1
- package/dist/summarizerClientElection.d.ts.map +0 -1
- package/dist/summarizerClientElection.js.map +0 -1
- package/dist/summarizerHandle.d.ts.map +0 -1
- package/dist/summarizerHandle.js.map +0 -1
- package/dist/summarizerHeuristics.d.ts.map +0 -1
- package/dist/summarizerHeuristics.js.map +0 -1
- package/dist/summarizerTypes.d.ts.map +0 -1
- package/dist/summarizerTypes.js.map +0 -1
- package/dist/summaryCollection.d.ts.map +0 -1
- package/dist/summaryCollection.js.map +0 -1
- package/dist/summaryFormat.d.ts.map +0 -1
- package/dist/summaryFormat.js.map +0 -1
- package/dist/summaryGenerator.d.ts.map +0 -1
- package/dist/summaryGenerator.js.map +0 -1
- package/dist/summaryManager.d.ts.map +0 -1
- package/dist/summaryManager.js.map +0 -1
- package/lib/garbageCollection.d.ts.map +0 -1
- package/lib/garbageCollection.js.map +0 -1
- package/lib/garbageCollectionConstants.d.ts +0 -25
- package/lib/garbageCollectionConstants.d.ts.map +0 -1
- package/lib/garbageCollectionConstants.js.map +0 -1
- package/lib/garbageCollectionTombstoneUtils.d.ts +0 -14
- package/lib/garbageCollectionTombstoneUtils.d.ts.map +0 -1
- package/lib/garbageCollectionTombstoneUtils.js +0 -19
- package/lib/garbageCollectionTombstoneUtils.js.map +0 -1
- package/lib/gcSweepReadyUsageDetection.d.ts.map +0 -1
- package/lib/gcSweepReadyUsageDetection.js.map +0 -1
- package/lib/orderedClientElection.d.ts.map +0 -1
- package/lib/orderedClientElection.js.map +0 -1
- package/lib/runWhileConnectedCoordinator.d.ts.map +0 -1
- package/lib/runWhileConnectedCoordinator.js.map +0 -1
- package/lib/runningSummarizer.d.ts.map +0 -1
- package/lib/runningSummarizer.js.map +0 -1
- package/lib/summarizer.d.ts.map +0 -1
- package/lib/summarizer.js.map +0 -1
- package/lib/summarizerClientElection.d.ts.map +0 -1
- package/lib/summarizerClientElection.js.map +0 -1
- package/lib/summarizerHandle.d.ts.map +0 -1
- package/lib/summarizerHandle.js.map +0 -1
- package/lib/summarizerHeuristics.d.ts.map +0 -1
- package/lib/summarizerHeuristics.js.map +0 -1
- package/lib/summarizerTypes.d.ts.map +0 -1
- package/lib/summarizerTypes.js.map +0 -1
- package/lib/summaryCollection.d.ts.map +0 -1
- package/lib/summaryCollection.js.map +0 -1
- package/lib/summaryFormat.d.ts.map +0 -1
- package/lib/summaryFormat.js.map +0 -1
- package/lib/summaryGenerator.d.ts.map +0 -1
- package/lib/summaryGenerator.js.map +0 -1
- package/lib/summaryManager.d.ts.map +0 -1
- package/lib/summaryManager.js.map +0 -1
- package/src/garbageCollection.ts +0 -1800
- package/src/garbageCollectionConstants.ts +0 -41
- package/src/garbageCollectionTombstoneUtils.ts +0 -28
- package/src/gcSweepReadyUsageDetection.ts +0 -139
- package/src/orderedClientElection.ts +0 -532
- package/src/runWhileConnectedCoordinator.ts +0 -106
- package/src/runningSummarizer.ts +0 -610
- package/src/summarizer.ts +0 -421
- package/src/summarizerClientElection.ts +0 -132
- package/src/summarizerHeuristics.ts +0 -222
- package/src/summarizerTypes.ts +0 -507
- package/src/summaryCollection.ts +0 -421
- package/src/summaryFormat.ts +0 -256
- package/src/summaryGenerator.ts +0 -450
- package/src/summaryManager.ts +0 -394
- /package/dist/{orderedClientElection.d.ts → summary/orderedClientElection.d.ts} +0 -0
- /package/dist/{runWhileConnectedCoordinator.d.ts → summary/runWhileConnectedCoordinator.d.ts} +0 -0
- /package/dist/{runWhileConnectedCoordinator.js → summary/runWhileConnectedCoordinator.js} +0 -0
- /package/dist/{summarizerClientElection.d.ts → summary/summarizerClientElection.d.ts} +0 -0
- /package/dist/{summarizerClientElection.js → summary/summarizerClientElection.js} +0 -0
- /package/dist/{summarizerHandle.d.ts → summary/summarizerHandle.d.ts} +0 -0
- /package/dist/{summarizerHandle.js → summary/summarizerHandle.js} +0 -0
- /package/dist/{summarizerTypes.js → summary/summarizerTypes.js} +0 -0
- /package/dist/{summaryCollection.d.ts → summary/summaryCollection.d.ts} +0 -0
- /package/dist/{summaryGenerator.d.ts → summary/summaryGenerator.d.ts} +0 -0
- /package/lib/{orderedClientElection.d.ts → summary/orderedClientElection.d.ts} +0 -0
- /package/lib/{runWhileConnectedCoordinator.d.ts → summary/runWhileConnectedCoordinator.d.ts} +0 -0
- /package/lib/{runWhileConnectedCoordinator.js → summary/runWhileConnectedCoordinator.js} +0 -0
- /package/lib/{summarizerClientElection.d.ts → summary/summarizerClientElection.d.ts} +0 -0
- /package/lib/{summarizerClientElection.js → summary/summarizerClientElection.js} +0 -0
- /package/lib/{summarizerHandle.d.ts → summary/summarizerHandle.d.ts} +0 -0
- /package/lib/{summarizerHandle.js → summary/summarizerHandle.js} +0 -0
- /package/lib/{summarizerTypes.js → summary/summarizerTypes.js} +0 -0
- /package/lib/{summaryCollection.d.ts → summary/summaryCollection.d.ts} +0 -0
- /package/lib/{summaryGenerator.d.ts → summary/summaryGenerator.d.ts} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"garbageCollection.js","sourceRoot":"","sources":["../src/garbageCollection.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;AAGH,+DAA0E;AAE1E,qEAA6G;AAE7G,yEAO2C;AAC3C,+EAAkF;AAClF,6EAc6C;AAC7C,iEAMuC;AACvC,qEAOyC;AAEzC,yDAAuE;AACvE,6CAAuD;AACvD,6EAesC;AACtC,uFAAyE;AACzE,6EAA+E;AAC/E,mDAUyB;AAwBzB,uDAAuD;AAC1C,QAAA,UAAU,GAAG;IACtB,kCAAkC;IAClC,SAAS,EAAE,WAAW;IACtB,8DAA8D;IAC9D,YAAY,EAAE,cAAc;IAC5B,6EAA6E;IAC7E,IAAI,EAAE,MAAM;IACZ,+DAA+D;IAC/D,KAAK,EAAE,OAAO;CACjB,CAAC;AAsFF,8CAA8C;AACjC,QAAA,iBAAiB,GAAG;IAC7B,gEAAgE;IAChE,MAAM,EAAE,QAAQ;IAChB,mEAAmE;IACnE,QAAQ,EAAE,UAAU;IACpB,0DAA0D;IAC1D,UAAU,EAAE,YAAY;CAClB,CAAC;AA4BX;;;GAGG;AACH,MAAa,wBAAwB;IAWjC,YACoB,uBAA+B;IA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AC;IAC5C,CAAC;CACJ","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport { assert, LazyPromise, Timer } from \"@fluidframework/common-utils\";\nimport { ICriticalContainerError } from \"@fluidframework/container-definitions\";\nimport { ClientSessionExpiredError, DataProcessingError, UsageError } from \"@fluidframework/container-utils\";\nimport { IRequestHeader } from \"@fluidframework/core-interfaces\";\nimport {\n cloneGCData,\n concatGarbageCollectionData,\n getGCDataFromSnapshot,\n IGCResult,\n runGarbageCollection,\n trimLeadingSlashes,\n} from \"@fluidframework/garbage-collector\";\nimport { ISnapshotTree, SummaryType } from \"@fluidframework/protocol-definitions\";\nimport {\n gcTreeKey,\n gcBlobPrefix,\n gcTombstoneBlobKey,\n IGarbageCollectionData,\n IGarbageCollectionDetailsBase,\n IGarbageCollectionSnapshotData,\n IGarbageCollectionState,\n ISummarizeResult,\n ITelemetryContext,\n IGarbageCollectionNodeData,\n IGarbageCollectionSummaryDetailsLegacy,\n ISummaryTreeWithStats,\n gcDeletedBlobKey,\n} from \"@fluidframework/runtime-definitions\";\nimport {\n mergeStats,\n packagePathToTelemetryProperty,\n ReadAndParseBlob,\n RefreshSummaryResult,\n SummaryTreeBuilder,\n} from \"@fluidframework/runtime-utils\";\nimport {\n ChildLogger,\n generateStack,\n loggerToMonitoringContext,\n MonitoringContext,\n PerformanceEvent,\n TelemetryDataTag,\n} from \"@fluidframework/telemetry-utils\";\n\nimport { IGCRuntimeOptions, RuntimeHeaders } from \"./containerRuntime\";\nimport { getSummaryForDatastores } from \"./dataStores\";\nimport {\n currentGCVersion,\n defaultInactiveTimeoutMs,\n defaultSessionExpiryDurationMs,\n disableSweepLogKey,\n disableTombstoneKey,\n gcVersionUpgradeToV2Key,\n gcTestModeKey,\n oneDayMs,\n runGCKey,\n runSessionExpiryKey,\n runSweepKey,\n stableGCVersion,\n trackGCStateKey,\n gcTombstoneGenerationOptionName\n} from \"./garbageCollectionConstants\";\nimport { sendGCTombstoneEvent } from \"./garbageCollectionTombstoneUtils\";\nimport { SweepReadyUsageDetectionHandler } from \"./gcSweepReadyUsageDetection\";\nimport {\n getGCVersion,\n GCVersion,\n IContainerRuntimeMetadata,\n metadataBlobName,\n ReadFluidDataStoreAttributes,\n dataStoreAttributesBlobName,\n IGCMetadata,\n ICreateContainerMetadata,\n GCFeatureMatrix,\n} from \"./summaryFormat\";\n\n/** The statistics of the system state after a garbage collection run. */\nexport interface IGCStats {\n /** The number of nodes in the container. */\n nodeCount: number;\n /** The number of data stores in the container. */\n dataStoreCount: number;\n /** The number of attachment blobs in the container. */\n attachmentBlobCount: number;\n /** The number of unreferenced nodes in the container. */\n unrefNodeCount: number;\n /** The number of unreferenced data stores in the container. */\n unrefDataStoreCount: number;\n /** The number of unreferenced attachment blobs in the container. */\n unrefAttachmentBlobCount: number;\n /** The number of nodes whose reference state updated since last GC run. */\n updatedNodeCount: number;\n /** The number of data stores whose reference state updated since last GC run. */\n updatedDataStoreCount: number;\n /** The number of attachment blobs whose reference state updated since last GC run. */\n updatedAttachmentBlobCount: number;\n}\n\n/** The types of GC nodes in the GC reference graph. */\nexport const GCNodeType = {\n // Nodes that are for data stores.\n DataStore: \"DataStore\",\n // Nodes that are within a data store. For example, DDS nodes.\n SubDataStore: \"SubDataStore\",\n // Nodes that are for attachment blobs, i.e., blobs uploaded via BlobManager.\n Blob: \"Blob\",\n // Nodes that are neither of the above. For example, root node.\n Other: \"Other\",\n};\nexport type GCNodeType = typeof GCNodeType[keyof typeof GCNodeType];\n\n/** Defines the APIs for the runtime object to be passed to the garbage collector. */\nexport interface IGarbageCollectionRuntime {\n /** Before GC runs, called to notify the runtime to update any pending GC state. */\n updateStateBeforeGC(): Promise<void>;\n /** Returns the garbage collection data of the runtime. */\n getGCData(fullGC?: boolean): Promise<IGarbageCollectionData>;\n /** After GC has run, called to notify the runtime of routes that are used in it. */\n updateUsedRoutes(usedRoutes: string[]): void;\n /** After GC has run, called to notify the runtime of routes that are unused in it. */\n updateUnusedRoutes(unusedRoutes: string[]): void;\n /** Called to notify the runtime of routes that are tombstones. */\n updateTombstonedRoutes(tombstoneRoutes: string[]): void;\n /** Returns a referenced timestamp to be used to track unreferenced nodes. */\n getCurrentReferenceTimestampMs(): number | undefined;\n /** Returns the type of the GC node. */\n getNodeType(nodePath: string): GCNodeType;\n /** Called when the runtime should close because of an error. */\n closeFn: (error?: ICriticalContainerError) => void;\n}\n\n/** Defines the contract for the garbage collector. */\nexport interface IGarbageCollector {\n /** Tells whether GC should run or not. */\n readonly shouldRunGC: boolean;\n /** Tells whether the GC state in summary needs to be reset in the next summary. */\n readonly summaryStateNeedsReset: boolean;\n readonly trackGCState: boolean;\n /** Initialize the state from the base snapshot after its creation. */\n initializeBaseState(): Promise<void>;\n /** Run garbage collection and update the reference / used state of the system. */\n collectGarbage(\n options: { logger?: ITelemetryLogger; runSweep?: boolean; fullGC?: boolean; },\n telemetryContext?: ITelemetryContext,\n ): Promise<IGCStats | undefined>;\n /** Summarizes the GC data and returns it as a summary tree. */\n summarize(\n fullTree: boolean,\n trackState: boolean,\n telemetryContext?: ITelemetryContext,\n ): ISummarizeResult | undefined;\n /** Returns the garbage collector specific metadata to be written into the summary. */\n getMetadata(): IGCMetadata;\n /** Returns the GC details generated from the base snapshot. */\n getBaseGCDetails(): Promise<IGarbageCollectionDetailsBase>;\n /** Called when the latest summary of the system has been refreshed. */\n refreshLatestSummary(\n proposalHandle: string | undefined,\n result: RefreshSummaryResult,\n readAndParseBlob: ReadAndParseBlob,\n ): Promise<void>;\n /** Called when a node is updated. Used to detect and log when an inactive node is changed or loaded. */\n nodeUpdated(\n nodePath: string,\n reason: \"Loaded\" | \"Changed\",\n timestampMs?: number,\n packagePath?: readonly string[],\n requestHeaders?: IRequestHeader,\n ): void;\n /** Called when a reference is added to a node. Used to identify nodes that were referenced between summaries. */\n addedOutboundReference(fromNodePath: string, toNodePath: string): void;\n /** Returns true if this node has been deleted by GC during sweep phase. */\n isNodeDeleted(nodePath: string): boolean;\n setConnectionState(connected: boolean, clientId?: string): void;\n dispose(): void;\n}\n\n/** Parameters necessary for creating a GarbageCollector. */\nexport interface IGarbageCollectorCreateParams {\n readonly runtime: IGarbageCollectionRuntime;\n readonly gcOptions: IGCRuntimeOptions;\n readonly baseLogger: ITelemetryLogger;\n readonly existing: boolean;\n readonly metadata: IContainerRuntimeMetadata | undefined;\n readonly createContainerMetadata: ICreateContainerMetadata;\n readonly baseSnapshot: ISnapshotTree | undefined;\n readonly isSummarizerClient: boolean;\n readonly getNodePackagePath: (nodePath: string) => Promise<readonly string[] | undefined>;\n readonly getLastSummaryTimestampMs: () => number | undefined;\n readonly readAndParseBlob: ReadAndParseBlob;\n readonly activeConnection: () => boolean;\n readonly getContainerDiagnosticId: () => string;\n}\n\n/** The state of node that is unreferenced. */\nexport const UnreferencedState = {\n /** The node is active, i.e., it can become referenced again. */\n Active: \"Active\",\n /** The node is inactive, i.e., it should not become referenced. */\n Inactive: \"Inactive\",\n /** The node is ready to be deleted by the sweep phase. */\n SweepReady: \"SweepReady\",\n} as const;\nexport type UnreferencedState = typeof UnreferencedState[keyof typeof UnreferencedState];\n\n/** The event that is logged when unreferenced node is used after a certain time. */\ninterface IUnreferencedEventProps {\n usageType: \"Changed\" | \"Loaded\" | \"Revived\";\n state: UnreferencedState;\n id: string;\n type: GCNodeType;\n unrefTime: number;\n age: number;\n completedGCRuns: number;\n fromId?: string;\n timeout?: number;\n lastSummaryTime?: number;\n externalRequest?: boolean;\n viaHandle?: boolean;\n}\n\n/**\n * The GC data that is tracked for a summary that is submitted.\n */\ninterface IGCSummaryTrackingData {\n serializedGCState: string | undefined;\n serializedTombstones: string | undefined;\n serializedDeletedNodes: string | undefined;\n}\n\n/**\n * Helper class that tracks the state of an unreferenced node such as the time it was unreferenced and if it can\n * be deleted by the sweep phase.\n */\nexport class UnreferencedStateTracker {\n private _state: UnreferencedState = UnreferencedState.Active;\n public get state(): UnreferencedState {\n return this._state;\n }\n\n /** Timer to indicate when an unreferenced object is considered Inactive */\n private readonly inactiveTimer: TimerWithNoDefaultTimeout;\n /** Timer to indicate when an unreferenced object is Sweep-Ready */\n private readonly sweepTimer: TimerWithNoDefaultTimeout;\n\n constructor(\n public readonly unreferencedTimestampMs: number,\n /** The time after which node transitions to Inactive state. */\n private readonly inactiveTimeoutMs: number,\n /** The current reference timestamp used to track how long this node has been unreferenced for. */\n currentReferenceTimestampMs: number,\n /** The time after which node transitions to SweepReady state; undefined if session expiry is disabled. */\n private readonly sweepTimeoutMs: number | undefined,\n ) {\n if (this.sweepTimeoutMs !== undefined) {\n assert(this.inactiveTimeoutMs <= this.sweepTimeoutMs,\n 0x3b0 /* inactive timeout must not be greater than the sweep timeout */);\n }\n\n this.sweepTimer = new TimerWithNoDefaultTimeout(\n () => {\n this._state = UnreferencedState.SweepReady;\n assert(!this.inactiveTimer.hasTimer, 0x3b1 /* inactiveTimer still running after sweepTimer fired! */);\n },\n );\n\n this.inactiveTimer = new TimerWithNoDefaultTimeout(() => {\n this._state = UnreferencedState.Inactive;\n\n // After the node becomes inactive, start the sweep timer after which the node will be ready for sweep.\n if (this.sweepTimeoutMs !== undefined) {\n this.sweepTimer.restart(this.sweepTimeoutMs - this.inactiveTimeoutMs);\n }\n });\n this.updateTracking(currentReferenceTimestampMs);\n }\n\n /* Updates the unreferenced state based on the provided timestamp. */\n public updateTracking(currentReferenceTimestampMs: number) {\n const unreferencedDurationMs = currentReferenceTimestampMs - this.unreferencedTimestampMs;\n\n // If the node has been unreferenced for sweep timeout amount of time, update the state to SweepReady.\n if (this.sweepTimeoutMs !== undefined && unreferencedDurationMs >= this.sweepTimeoutMs) {\n this._state = UnreferencedState.SweepReady;\n this.clearTimers();\n return;\n }\n\n // If the node has been unreferenced for inactive timeoutMs amount of time, update the state to inactive.\n // Also, start a timer for the sweep timeout.\n if (unreferencedDurationMs >= this.inactiveTimeoutMs) {\n this._state = UnreferencedState.Inactive;\n this.inactiveTimer.clear();\n\n if (this.sweepTimeoutMs !== undefined) {\n this.sweepTimer.restart(this.sweepTimeoutMs - unreferencedDurationMs);\n }\n return;\n }\n\n // The node is still active. Ensure the inactive timer is running with the proper remaining duration.\n this.inactiveTimer.restart(this.inactiveTimeoutMs - unreferencedDurationMs);\n }\n\n private clearTimers() {\n this.inactiveTimer.clear();\n this.sweepTimer.clear();\n }\n\n /** Stop tracking this node. Reset the unreferenced timers and state, if any. */\n public stopTracking() {\n this.clearTimers();\n this._state = UnreferencedState.Active;\n }\n}\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 * GC Graph\n *\n * Node\n * NodeId = \"datastore1\"\n * / \\\\\n * OutboundRoute OutboundRoute\n * / \\\\\n * Node Node\n * NodeId = \"dds1\" NodeId = \"dds2\"\n * ```\n */\nexport class GarbageCollector implements IGarbageCollector {\n public static create(createParams: IGarbageCollectorCreateParams): IGarbageCollector {\n return new GarbageCollector(createParams);\n }\n\n /**\n * Tells whether the GC state needs to be reset in the next summary. We need to do this if:\n *\n * 1. GC was enabled and is now disabled. The GC state needs to be removed and everything becomes referenced.\n *\n * 2. GC was disabled and is now enabled. The GC state needs to be regenerated and added to summary.\n *\n * 3. GC is enabled and the latest summary state is refreshed from a snapshot that had GC disabled and vice-versa.\n *\n * 4. The GC version in the latest summary is different from the current GC version. This can happen if:\n *\n * 4.1. The summary this client loaded with has data from a different GC version.\n *\n * 4.2. This client's latest summary was updated from a snapshot that has a different GC version.\n */\n public get summaryStateNeedsReset(): boolean {\n return this.gcStateNeedsReset ||\n (this.shouldRunGC && this.latestSummaryGCVersion !== this.currentGCVersion);\n }\n\n /**\n * Tracks if GC is enabled for this document. This is specified during document creation and doesn't change\n * throughout its lifetime.\n */\n private readonly gcEnabled: boolean;\n /**\n * Tracks if sweep phase is enabled for this document. This is specified during document creation and doesn't change\n * throughout its lifetime.\n */\n private readonly sweepEnabled: boolean;\n\n /**\n * Tracks if GC should run or not. Even if GC is enabled for a document (see gcEnabled), it can be explicitly\n * disabled via runtime options or feature flags.\n */\n public readonly shouldRunGC: boolean;\n /**\n * Tracks if sweep phase should run or not. Even if the sweep phase is enabled for a document (see sweepEnabled), it\n * can be explicitly disabled via feature flags. It also won't run if session expiry is not enabled.\n */\n private readonly shouldRunSweep: boolean;\n\n public readonly trackGCState: boolean;\n\n private readonly testMode: boolean;\n private readonly tombstoneMode: boolean;\n private readonly mc: MonitoringContext;\n\n /**\n * Tells whether the GC state needs to be reset. This can happen under 3 conditions:\n *\n * 1. The base snapshot contains GC state but GC is disabled. This will happen the first time GC is disabled after\n * it was enabled before. GC state needs to be removed from summary and all nodes should be marked referenced.\n *\n * 2. The base snapshot does not have GC state but GC is enabled. This will happen the very first time GC runs on\n * a document and the first time GC is enabled after is was disabled before.\n *\n * 3. GC is enabled and the latest summary state is refreshed from a snapshot that had GC disabled and vice-versa.\n *\n * Note that the state will be reset only once for the first summary generated after this returns true. After that,\n * this will return false.\n */\n private get gcStateNeedsReset(): boolean {\n return this.wasGCRunInLatestSummary !== this.shouldRunGC;\n }\n // Tracks whether there was GC was run in latest summary being tracked.\n private wasGCRunInLatestSummary: boolean;\n\n // The current GC version that this container is running.\n private readonly currentGCVersion: GCVersion;\n // This is the version of GC data in the latest summary being tracked.\n private latestSummaryGCVersion: GCVersion;\n\n\t// Feature Support info persisted to this container's summary\n\tprivate readonly persistedGcFeatureMatrix: GCFeatureMatrix | undefined;\n\n // Keeps track of the GC state from the last run.\n private gcDataFromLastRun: IGarbageCollectionData | undefined;\n // Keeps a list of references (edges in the GC graph) between GC runs. Each entry has a node id and a list of\n // outbound routes from that node.\n private readonly newReferencesSinceLastRun: Map<string, string[]> = new Map();\n // A list of nodes that have been tombstoned.\n private tombstones: string[] = [];\n // A list of nodes that have been deleted during sweep phase.\n private deletedNodes: Set<string> = new Set();\n\n /**\n * Keeps track of the GC data from the latest summary successfully submitted to and acked from the server.\n */\n private latestSummaryData: IGCSummaryTrackingData | undefined;\n /**\n * Keeps track of the GC data from the last summary submitted to the server but not yet acked.\n */\n private pendingSummaryData: IGCSummaryTrackingData | undefined;\n\n // Promise when resolved returns the GC data data in the base snapshot.\n private readonly baseSnapshotDataP: Promise<IGarbageCollectionSnapshotData | undefined>;\n // Promise when resolved initializes the GC state from the data in the base snapshot.\n private readonly initializeGCStateFromBaseSnapshotP: Promise<void>;\n // The GC details generated from the base snapshot.\n private readonly baseGCDetailsP: Promise<IGarbageCollectionDetailsBase>;\n // Map of node ids to their unreferenced state tracker.\n private readonly unreferencedNodesState: Map<string, UnreferencedStateTracker> = new Map();\n // The Timer responsible for closing the container when the session has expired\n private sessionExpiryTimer: Timer | undefined;\n\n // Keeps track of unreferenced events that are logged for a node. This is used to limit the log generation to one\n // per event per node.\n private readonly loggedUnreferencedEvents: Set<string> = new Set();\n // Queue for unreferenced events that should be logged the next time GC runs.\n private pendingEventsQueue: IUnreferencedEventProps[] = [];\n\n // The number of times GC has successfully completed on this instance of GarbageCollector.\n private completedRuns = 0;\n\n private readonly runtime: IGarbageCollectionRuntime;\n private readonly createContainerMetadata: ICreateContainerMetadata;\n private readonly gcOptions: IGCRuntimeOptions;\n private readonly isSummarizerClient: boolean;\n\n /** The time in ms to expire a session for a client for gc. */\n private readonly sessionExpiryTimeoutMs: number | undefined;\n /** The time after which an unreferenced node is inactive. */\n private readonly inactiveTimeoutMs: number;\n /** The time after which an unreferenced node is ready to be swept. */\n private readonly sweepTimeoutMs: number | undefined;\n\n /** For a given node path, returns the node's package path. */\n private readonly getNodePackagePath: (nodePath: string) => Promise<readonly string[] | undefined>;\n /** Returns the timestamp of the last summary generated for this container. */\n private readonly getLastSummaryTimestampMs: () => number | undefined;\n /** Returns true if connection is active, i.e. it's \"write\" connection and the runtime is connected. */\n private readonly activeConnection: () => boolean;\n\n /** Returns a list of all the configurations for garbage collection. */\n private get configs() {\n return {\n gcEnabled: this.gcEnabled,\n sweepEnabled: this.sweepEnabled,\n runGC: this.shouldRunGC,\n runSweep: this.shouldRunSweep,\n testMode: this.testMode,\n tombstoneMode: this.tombstoneMode,\n sessionExpiry: this.sessionExpiryTimeoutMs,\n sweepTimeout: this.sweepTimeoutMs,\n inactiveTimeout: this.inactiveTimeoutMs,\n trackGCState: this.trackGCState,\n ...this.gcOptions,\n };\n }\n\n /** Handler to respond to when a SweepReady object is used */\n private readonly sweepReadyUsageHandler: SweepReadyUsageDetectionHandler;\n\n protected constructor(createParams: IGarbageCollectorCreateParams) {\n this.runtime = createParams.runtime;\n this.isSummarizerClient = createParams.isSummarizerClient;\n this.gcOptions = createParams.gcOptions;\n this.createContainerMetadata = createParams.createContainerMetadata;\n this.getNodePackagePath = createParams.getNodePackagePath;\n this.getLastSummaryTimestampMs = createParams.getLastSummaryTimestampMs;\n this.activeConnection = createParams.activeConnection;\n\n const baseSnapshot = createParams.baseSnapshot;\n const metadata = createParams.metadata;\n const readAndParseBlob = createParams.readAndParseBlob;\n\n this.mc = loggerToMonitoringContext(ChildLogger.create(\n createParams.baseLogger, \"GarbageCollector\", { all: { completedGCRuns: () => this.completedRuns } },\n ));\n\n // If version upgrade is not enabled, fall back to the stable GC version.\n this.currentGCVersion =\n this.mc.config.getBoolean(gcVersionUpgradeToV2Key) === true ? currentGCVersion : stableGCVersion;\n\n this.sweepReadyUsageHandler = new SweepReadyUsageDetectionHandler(\n createParams.getContainerDiagnosticId(),\n this.mc,\n this.runtime.closeFn,\n );\n\n let prevSummaryGCVersion: number | undefined;\n\n /**\n * Sweep timeout is the time after which unreferenced content can be swept.\n * Sweep 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 function computeSweepTimeout(sessionExpiryTimeoutMs: number | undefined) {\n const maxSnapshotCacheExpiryMs = 5 * oneDayMs;\n const bufferMs = oneDayMs;\n return sessionExpiryTimeoutMs &&\n (sessionExpiryTimeoutMs + maxSnapshotCacheExpiryMs + bufferMs);\n }\n\n /**\n * The following GC state is enabled during container creation and cannot be changed throughout its lifetime:\n * 1. Whether running GC mark phase is allowed or not.\n * 2. Whether running GC sweep phase is allowed or not.\n * 3. Whether GC session expiry is enabled or not.\n * For existing containers, we get this information from the metadata blob of its summary.\n */\n if (createParams.existing) {\n prevSummaryGCVersion = getGCVersion(metadata);\n // Existing documents which did not have metadata blob or had GC disabled have version as 0. For all\n // other existing documents, GC is enabled.\n this.gcEnabled = prevSummaryGCVersion > 0;\n this.sweepEnabled = metadata?.sweepEnabled ?? false;\n this.sessionExpiryTimeoutMs = metadata?.sessionExpiryTimeoutMs;\n this.sweepTimeoutMs =\n metadata?.sweepTimeoutMs\n ?? computeSweepTimeout(this.sessionExpiryTimeoutMs); // Backfill old documents that didn't persist this\n this.persistedGcFeatureMatrix = metadata?.gcFeatureMatrix;\n } else {\n // Sweep should not be enabled without enabling GC mark phase. We could silently disable sweep in this\n // scenario but explicitly failing makes it clearer and promotes correct usage.\n if (this.gcOptions.sweepAllowed && this.gcOptions.gcAllowed === false) {\n throw new UsageError(\"GC sweep phase cannot be enabled without enabling GC mark phase\");\n }\n\n // This Test Override only applies for new containers\n const testOverrideSweepTimeoutMs =\n this.mc.config.getNumber(\"Fluid.GarbageCollection.TestOverride.SweepTimeoutMs\");\n\n // For new documents, GC is enabled by default. It can be explicitly disabled by setting the gcAllowed\n // flag in GC options to false.\n this.gcEnabled = this.gcOptions.gcAllowed !== false;\n // The sweep phase has to be explicitly enabled by setting the sweepAllowed flag in GC options to true.\n this.sweepEnabled = this.gcOptions.sweepAllowed === true;\n\n // Set the Session Expiry only if the flag is enabled and GC is enabled.\n if (this.mc.config.getBoolean(runSessionExpiryKey) && this.gcEnabled) {\n this.sessionExpiryTimeoutMs = this.gcOptions.sessionExpiryTimeoutMs ?? defaultSessionExpiryDurationMs;\n }\n this.sweepTimeoutMs =\n testOverrideSweepTimeoutMs\n ?? computeSweepTimeout(this.sessionExpiryTimeoutMs);\n if (this.gcOptions[gcTombstoneGenerationOptionName] !== undefined) {\n this.persistedGcFeatureMatrix = {\n tombstoneGeneration: this.gcOptions[gcTombstoneGenerationOptionName],\n };\n }\n }\n\n // If session expiry is enabled, we need to close the container when the session expiry timeout expires.\n if (this.sessionExpiryTimeoutMs !== undefined) {\n // If Test Override config is set, override Session Expiry timeout.\n const overrideSessionExpiryTimeoutMs =\n this.mc.config.getNumber(\"Fluid.GarbageCollection.TestOverride.SessionExpiryMs\");\n const timeoutMs = overrideSessionExpiryTimeoutMs ?? this.sessionExpiryTimeoutMs;\n\n this.sessionExpiryTimer = new Timer(\n timeoutMs,\n () => { this.runtime.closeFn(new ClientSessionExpiredError(`Client session expired.`, timeoutMs)); },\n );\n this.sessionExpiryTimer.start();\n }\n\n // For existing document, the latest summary is the one that we loaded from. So, use its GC version as the\n // latest tracked GC version. For new documents, we will be writing the first summary with the current version.\n this.latestSummaryGCVersion = prevSummaryGCVersion ?? this.currentGCVersion;\n\n /**\n * Whether GC should run or not. The following conditions have to be met to run sweep:\n *\n * 1. GC should be enabled for this container.\n *\n * 2. GC should not be disabled via disableGC GC option.\n *\n * These conditions can be overridden via runGCKey feature flag.\n */\n this.shouldRunGC = this.mc.config.getBoolean(runGCKey) ?? (\n // GC must be enabled for the document.\n this.gcEnabled\n // GC must not be disabled via GC options.\n && !this.gcOptions.disableGC\n );\n\n /**\n * Whether sweep should run or not. The following conditions have to be met to run sweep:\n *\n * 1. Overall GC or mark phase must be enabled (this.shouldRunGC).\n * 2. Sweep timeout should be available. Without this, we wouldn't know when an object should be deleted.\n * 3. The driver must implement the policy limiting the age of snapshots used for loading. Otherwise\n * the Sweep Timeout calculation is not valid. We use the persisted value to ensure consistency over time.\n * 4. Sweep should be enabled for this container (this.sweepEnabled). This can be overridden via runSweep\n * feature flag.\n */\n this.shouldRunSweep =\n this.shouldRunGC\n && this.sweepTimeoutMs !== undefined\n && (this.mc.config.getBoolean(runSweepKey) ?? this.sweepEnabled);\n\n this.trackGCState = this.mc.config.getBoolean(trackGCStateKey) === true;\n\n // Override inactive timeout if test config or gc options to override it is set.\n this.inactiveTimeoutMs = this.mc.config.getNumber(\"Fluid.GarbageCollection.TestOverride.InactiveTimeoutMs\") ??\n this.gcOptions.inactiveTimeoutMs ??\n defaultInactiveTimeoutMs;\n\n // Inactive timeout must be greater than sweep timeout since a node goes from active -> inactive -> sweep ready.\n if (this.sweepTimeoutMs !== undefined && this.inactiveTimeoutMs > this.sweepTimeoutMs) {\n throw new UsageError(\"inactive timeout should not be greater than the sweep timeout\");\n }\n\n // Whether we are running in test mode. In this mode, unreferenced nodes are immediately deleted.\n this.testMode = this.mc.config.getBoolean(gcTestModeKey) ?? this.gcOptions.runGCInTestMode === true;\n // Whether we are running in tombstone mode. This is enabled by default if sweep won't run. It can be disabled\n // via feature flags.\n this.tombstoneMode = !this.shouldRunSweep && this.mc.config.getBoolean(disableTombstoneKey) !== true;\n\n // If GC ran in the container that generated the base snapshot, it will have a GC tree.\n this.wasGCRunInLatestSummary = baseSnapshot?.trees[gcTreeKey] !== undefined;\n\n // Get the GC data from the base snapshot. Use LazyPromise because we only want to do this once since it\n // it involves fetching blobs from storage which is expensive.\n this.baseSnapshotDataP = new LazyPromise<IGarbageCollectionSnapshotData | undefined>(async () => {\n if (baseSnapshot === undefined) {\n return undefined;\n }\n\n try {\n // For newer documents, GC data should be present in the GC tree in the root of the snapshot.\n const gcSnapshotTree = baseSnapshot.trees[gcTreeKey];\n if (gcSnapshotTree !== undefined) {\n return getGCDataFromSnapshot(\n gcSnapshotTree,\n readAndParseBlob,\n );\n }\n\n // back-compat - Older documents will have the GC blobs in each data store's summary tree. Get them and\n // consolidate into IGarbageCollectionState format.\n // Add a node for the root node that is not present in older snapshot format.\n const gcState: IGarbageCollectionState = { gcNodes: { \"/\": { outboundRoutes: [] } } };\n const dataStoreSnapshotTree = getSummaryForDatastores(baseSnapshot, metadata);\n assert(dataStoreSnapshotTree !== undefined,\n 0x2a8 /* \"Expected data store snapshot tree in base snapshot\" */);\n for (const [dsId, dsSnapshotTree] of Object.entries(dataStoreSnapshotTree.trees)) {\n const blobId = dsSnapshotTree.blobs[gcTreeKey];\n if (blobId === undefined) {\n continue;\n }\n\n const gcSummaryDetails = await readAndParseBlob<IGarbageCollectionSummaryDetailsLegacy>(blobId);\n // If there are no nodes for this data store, skip it.\n if (gcSummaryDetails.gcData?.gcNodes === undefined) {\n continue;\n }\n\n const dsRootId = `/${dsId}`;\n // Since we used to write GC data at data store level, we won't have an entry for the root (\"/\").\n // Construct that entry by adding root data store ids to its outbound routes.\n const initialSnapshotDetails = await readAndParseBlob<ReadFluidDataStoreAttributes>(\n dsSnapshotTree.blobs[dataStoreAttributesBlobName],\n );\n if (initialSnapshotDetails.isRootDataStore) {\n gcState.gcNodes[\"/\"].outboundRoutes.push(dsRootId);\n }\n\n for (const [id, outboundRoutes] of Object.entries(gcSummaryDetails.gcData.gcNodes)) {\n // Prefix the data store id to the GC node ids to make them relative to the root from being\n // relative to the data store. Similar to how its done in DataStore::getGCData.\n const rootId = id === \"/\" ? dsRootId : `${dsRootId}${id}`;\n gcState.gcNodes[rootId] = { outboundRoutes: Array.from(outboundRoutes) };\n }\n assert(gcState.gcNodes[dsRootId] !== undefined,\n 0x2a9 /* GC nodes for data store not in GC blob */);\n gcState.gcNodes[dsRootId].unreferencedTimestampMs = gcSummaryDetails.unrefTimestamp;\n }\n // If there is only one node (root node just added above), either GC is disabled or we are loading from\n // the first summary generated by detached container. In both cases, GC was not run - return undefined.\n return Object.keys(gcState.gcNodes).length === 1\n ? undefined\n : { gcState, tombstones: undefined, deletedNodes: undefined };\n } catch (error) {\n const dpe = DataProcessingError.wrapIfUnrecognized(\n error,\n \"FailedToInitializeGC\",\n );\n dpe.addTelemetryProperties({ gcConfigs: JSON.stringify(this.configs) });\n throw dpe;\n }\n });\n\n /**\n * Set up the initializer which initializes the GC state from the data in base snapshot. This is done when\n * connected in write mode or when GC runs the first time. It sets up all unreferenced nodes from the base\n * GC state and updates their inactive or sweep ready state.\n */\n this.initializeGCStateFromBaseSnapshotP = new LazyPromise<void>(async () => {\n /**\n * If there is no current reference timestamp, skip initialization. We need the current timestamp to track\n * how long objects have been unreferenced and if they can be deleted.\n *\n * Note that the only scenario where there is no reference timestamp is when no ops have ever been processed\n * for this container and it is in read mode. In this scenario, there is no point in running GC anyway\n * because references in the container do not change without any ops, i.e., there is nothing to collect.\n */\n const currentReferenceTimestampMs = this.runtime.getCurrentReferenceTimestampMs();\n if (currentReferenceTimestampMs === undefined) {\n // Log an event so we can evaluate how often we run into this scenario.\n this.mc.logger.sendErrorEvent({\n eventName: \"GarbageCollectorInitializedWithoutTimestamp\",\n gcConfigs: JSON.stringify(this.configs),\n });\n return;\n }\n /**\n * The base snapshot data will not be present if the container is loaded from:\n * 1. The first summary created by the detached container.\n * 2. A summary that was generated with GC disabled.\n * 3. A summary that was generated before GC even existed.\n */\n const baseSnapshotData = await this.baseSnapshotDataP;\n if (baseSnapshotData === undefined) {\n return;\n }\n this.updateStateFromSnapshotData(baseSnapshotData, currentReferenceTimestampMs);\n });\n\n // Get the GC details from the GC state in the base summary. This is returned in getBaseGCDetails which is\n // used to initialize the GC state of all the nodes in the container.\n this.baseGCDetailsP = new LazyPromise<IGarbageCollectionDetailsBase>(async () => {\n const baseSnapshotData = await this.baseSnapshotDataP;\n if (baseSnapshotData === undefined) {\n return {};\n }\n\n const gcNodes: { [id: string]: string[]; } = {};\n for (const [nodeId, nodeData] of Object.entries(baseSnapshotData.gcState.gcNodes)) {\n gcNodes[nodeId] = Array.from(nodeData.outboundRoutes);\n }\n // Run GC on the nodes in the base summary to get the routes used in each node in the container.\n // This is an optimization for space (vs performance) wherein we don't need to store the used routes of\n // each node in the summary.\n const usedRoutes = runGarbageCollection(gcNodes, [\"/\"]).referencedNodeIds;\n\n return { gcData: { gcNodes }, usedRoutes };\n });\n\n // Log all the GC options and the state determined by the garbage collector. This is interesting only for the\n // summarizer client since it is the only one that runs GC. It also helps keep the telemetry less noisy.\n if (this.isSummarizerClient) {\n this.mc.logger.sendTelemetryEvent({\n eventName: \"GarbageCollectorLoaded\",\n gcConfigs: JSON.stringify(this.configs),\n });\n }\n }\n\n /**\n * Called during container initialization. Initialize from the tombstone state in the base snapshot. This is done\n * during initialization so that deleted or tombstoned objects are marked as such before they are loaded or used.\n */\n public async initializeBaseState(): Promise<void> {\n const baseSnapshotData = await this.baseSnapshotDataP;\n /**\n * The base snapshot data will not be present if the container is loaded from:\n * 1. The first summary created by the detached container.\n * 2. A summary that was generated with GC disabled.\n * 3. A summary that was generated before GC even existed.\n */\n if (baseSnapshotData === undefined) {\n return;\n }\n\n // Initialize the deleted nodes from the snapshot. This is done irrespective of whether sweep is enabled or not\n // to identify deleted nodes' usage.\n if (baseSnapshotData.deletedNodes !== undefined) {\n this.deletedNodes = new Set(baseSnapshotData.deletedNodes);\n }\n\n // If running in tombstone mode, initialize the tombstone state from the snapshot. Also, notify the runtime of\n // tombstone routes.\n if (this.tombstoneMode && baseSnapshotData.tombstones !== undefined) {\n this.tombstones = Array.from(baseSnapshotData.tombstones);\n this.runtime.updateTombstonedRoutes(this.tombstones);\n }\n }\n\n /**\n * Update state from the given snapshot data. This is done during load and during refreshing state from a snapshot.\n * All current tracking is reset and updated from the data in the snapshot.\n * @param snapshotData - The snapshot data to update state from. If this is undefined, all GC state and tracking\n * is reset.\n * @param currentReferenceTimestampMs - The current reference timestamp for marking unreferenced nodes' unreferenced\n * timestamp.\n */\n private updateStateFromSnapshotData(\n snapshotData: IGarbageCollectionSnapshotData | undefined,\n currentReferenceTimestampMs: number,\n ) {\n /**\n * Note: \"newReferencesSinceLastRun\" is not reset here. This is done because there may be references since the\n * snapshot that we are updating state from. For example, this client may have processed ops till seq#1000 and\n * its refreshing state from a summary that happened at seq#900. In this case, there may be references between\n * seq#901 and seq#1000 that we don't want to reset.\n * Unfortunately, there is no way to track the seq# of ops that add references, so we choose to not reset any\n * references here. This should be fine because, in the worst case, we may end up updating the unreferenced\n * timestamp of a node which will delay its deletion. Although not ideal, this will only happen in rare\n * scenarios, so it should be okay.\n */\n\n // Clear all existing unreferenced state tracking.\n for (const [, nodeStateTracker] of this.unreferencedNodesState) {\n nodeStateTracker.stopTracking();\n };\n this.unreferencedNodesState.clear();\n\n // If running sweep, the tombstone state represents the list of nodes that have been deleted during sweep.\n // If running in tombstone mode, the tombstone state represents the list of nodes that have been marked as\n // tombstones.\n // If this call is because we are refreshing from a snapshot due to an ack, it is likely that the GC state\n // in the snapshot is newer than this client's. And so, the deleted / tombstone nodes need to be updated.\n if (this.shouldRunSweep) {\n const snapshotDeletedNodes = snapshotData?.tombstones ? new Set(snapshotData.tombstones) : undefined;\n // If the snapshot contains deleted nodes that are not yet deleted by this client, ask the runtime to\n // delete them.\n if (snapshotDeletedNodes !== undefined) {\n const newDeletedNodes: string[] = [];\n for (const nodeId of snapshotDeletedNodes) {\n if (!this.deletedNodes.has(nodeId)) {\n newDeletedNodes.push(nodeId);\n }\n }\n if (newDeletedNodes.length > 0) {\n // Call container runtime to delete these nodes and add deleted nodes to this.deletedNodes.\n }\n }\n } else if (this.tombstoneMode) {\n // The snapshot may contain more or fewer tombstone nodes than this client. Update tombstone state and\n // notify the runtime to update its state as well.\n this.tombstones = snapshotData?.tombstones ? Array.from(snapshotData.tombstones) : [];\n this.runtime.updateTombstonedRoutes(this.tombstones);\n }\n\n // If there is no snapshot data, it means this snapshot was generated with GC disabled. Unset all GC state.\n if (snapshotData === undefined) {\n this.gcDataFromLastRun = undefined;\n this.latestSummaryData = undefined;\n return;\n }\n\n // Update unreferenced state tracking as per the GC state in the snapshot data and update gcDataFromLastRun\n // to the GC data from the snapshot data.\n const gcNodes: { [id: string]: string[]; } = {};\n for (const [nodeId, nodeData] of Object.entries(snapshotData.gcState.gcNodes)) {\n if (nodeData.unreferencedTimestampMs !== undefined) {\n this.unreferencedNodesState.set(\n nodeId,\n new UnreferencedStateTracker(\n nodeData.unreferencedTimestampMs,\n this.inactiveTimeoutMs,\n currentReferenceTimestampMs,\n this.sweepTimeoutMs,\n ),\n );\n }\n gcNodes[nodeId] = Array.from(nodeData.outboundRoutes);\n }\n this.gcDataFromLastRun = { gcNodes };\n\n // If tracking state across summaries, update latest summary data from the snapshot's GC data.\n if (this.trackGCState) {\n this.latestSummaryData = {\n serializedGCState: JSON.stringify(generateSortedGCState(snapshotData.gcState)),\n serializedTombstones: JSON.stringify(snapshotData.tombstones),\n serializedDeletedNodes: JSON.stringify(snapshotData.deletedNodes),\n };\n }\n }\n\n /**\n * Called when the connection state of the runtime changes, i.e., it connects or disconnects. GC subscribes to this\n * to initialize the base state for non-summarizer clients so that they can track inactive / sweep ready nodes.\n * @param connected - Whether the runtime connected / disconnected.\n * @param clientId - The clientId of this runtime.\n */\n public setConnectionState(connected: boolean, clientId?: string | undefined): void {\n /**\n * For all clients, initialize the base state when the container becomes active, i.e., it transitions\n * to \"write\" mode. This will ensure that the container's own join op is processed and there is a recent\n * reference timestamp that will be used to update the state of unreferenced nodes. Also, all trailing ops which\n * could affect the GC state will have been processed.\n *\n * If GC is up-to-date for the client and the summarizing client, there will be an doubling of both\n * InactiveObject_Loaded and SweepReady_Loaded errors, as there will be one from the sending client and one from\n * the receiving summarizer client.\n *\n * Ideally, this initialization should only be done for summarizer client. However, we are currently rolling out\n * sweep in phases and we want to track when inactive and sweep ready objects are used in any client.\n */\n if (this.activeConnection() && this.shouldRunGC) {\n this.initializeGCStateFromBaseSnapshotP.catch((error) => {});\n }\n }\n\n /**\n * Runs garbage collection and updates the reference / used state of the nodes in the container.\n * @returns stats of the GC run or undefined if GC did not run.\n */\n public async collectGarbage(\n options: {\n /** Logger to use for logging GC events */\n logger?: ITelemetryLogger;\n /** True to run GC sweep phase after the mark phase */\n runSweep?: boolean;\n /** True to generate full GC data */\n fullGC?: boolean;\n },\n telemetryContext?: ITelemetryContext,\n ): Promise<IGCStats | undefined> {\n const fullGC = options.fullGC ?? (this.gcOptions.runFullGC === true || this.summaryStateNeedsReset);\n const logger = options.logger\n ? ChildLogger.create(options.logger, undefined, { all: { completedGCRuns: () => this.completedRuns } })\n : this.mc.logger;\n\n /**\n * If there is no current reference timestamp, skip running GC. We need the current timestamp to track\n * how long objects have been unreferenced and if they should be deleted.\n *\n * Note that the only scenario where GC is called and there is no reference timestamp is when no ops have ever\n * been processed for this container and it is in read mode. In this scenario, there is no point in running GC\n * anyway because references in the container do not change without any ops, i.e., there is nothing to collect.\n */\n const currentReferenceTimestampMs = this.runtime.getCurrentReferenceTimestampMs();\n if (currentReferenceTimestampMs === undefined) {\n // Log an event so we can evaluate how often we run into this scenario.\n logger.sendErrorEvent({\n eventName: \"CollectGarbageCalledWithoutTimestamp\",\n gcConfigs: JSON.stringify(this.configs),\n });\n return undefined;\n }\n\n // Add the options that are used to run GC to the telemetry context.\n telemetryContext?.setAll(\"fluid_GC\", \"Options\", { fullGC, runSweep: options.runSweep });\n\n return PerformanceEvent.timedExecAsync(logger, { eventName: \"GarbageCollection\" }, async (event) => {\n await this.runPreGCSteps();\n\n // Get the runtime's GC data and run GC on the reference graph in it.\n const gcData = await this.runtime.getGCData(fullGC);\n const gcResult = runGarbageCollection(gcData.gcNodes, [\"/\"]);\n\n const gcStats = await this.runPostGCSteps(gcData, gcResult, logger, currentReferenceTimestampMs);\n event.end({ ...gcStats, timestamp: currentReferenceTimestampMs });\n this.completedRuns++;\n return gcStats;\n }, { end: true, cancel: \"error\" });\n }\n\n private async runPreGCSteps() {\n // Ensure that state has been initialized from the base snapshot data.\n await this.initializeGCStateFromBaseSnapshotP;\n // Let the runtime update its pending state before GC runs.\n await this.runtime.updateStateBeforeGC();\n }\n\n private async runPostGCSteps(\n gcData: IGarbageCollectionData,\n gcResult: IGCResult,\n logger: ITelemetryLogger,\n currentReferenceTimestampMs: number,\n ): Promise<IGCStats> {\n // Generate statistics from the current run. This is done before updating the current state because it\n // generates some of its data based on previous state of the system.\n const gcStats = this.generateStats(gcResult);\n\n // Update the state since the last GC run. There can be nodes that were referenced between the last and\n // the current run. We need to identify than and update their unreferenced state if needed.\n this.updateStateSinceLastRun(gcData, logger);\n\n // Update the current state and update the runtime of all routes or ids that used as per the GC run.\n this.updateCurrentState(gcData, gcResult, currentReferenceTimestampMs);\n this.runtime.updateUsedRoutes(gcResult.referencedNodeIds);\n\n // Log events for objects that are ready to be deleted by sweep. When we have sweep enabled, we will\n // delete these objects here instead.\n this.logSweepEvents(logger, currentReferenceTimestampMs);\n\n // If we are running in GC test mode, delete objects for unused routes. This enables testing scenarios\n // involving access to deleted data.\n if (this.testMode) {\n this.runtime.updateUnusedRoutes(gcResult.deletedNodeIds);\n } else if (this.tombstoneMode) {\n // If we are running in GC tombstone mode, update tombstoned routes. This enables testing scenarios\n // involving access to \"deleted\" data without actually deleting the data from summaries.\n // Note: we will not tombstone in test mode.\n this.runtime.updateTombstonedRoutes(this.tombstones);\n }\n\n // Log pending unreferenced events such as a node being used after inactive. This is done after GC runs and\n // updates its state so that we don't send false positives based on intermediate state. For example, we may get\n // reference to an unreferenced node from another unreferenced node which means the node wasn't revived.\n await this.logUnreferencedEvents(logger);\n\n return gcStats;\n }\n\n /**\n * Summarizes the GC data and returns it as a summary tree.\n * We current write the entire GC state in a single blob. This can be modified later to write multiple\n * blobs. All the blob keys should start with `gcBlobPrefix`.\n */\n public summarize(\n fullTree: boolean,\n trackState: boolean,\n telemetryContext?: ITelemetryContext,\n ): ISummarizeResult | undefined {\n if (!this.shouldRunGC || this.gcDataFromLastRun === undefined) {\n return;\n }\n\n const gcState: IGarbageCollectionState = { gcNodes: {} };\n for (const [nodeId, outboundRoutes] of Object.entries(this.gcDataFromLastRun.gcNodes)) {\n gcState.gcNodes[nodeId] = {\n outboundRoutes,\n unreferencedTimestampMs: this.unreferencedNodesState.get(nodeId)?.unreferencedTimestampMs,\n };\n }\n\n const serializedGCState = JSON.stringify(generateSortedGCState(gcState));\n // Serialize and write deleted nodes, if any. This is done irrespective of whether sweep is enabled or not so\n // to identify deleted nodes' usage.\n const serializedDeletedNodes = this.deletedNodes.size > 0\n ? JSON.stringify(Array.from(this.deletedNodes).sort())\n : undefined;\n // If running in tombstone mode, serialize and write tombstones, if any.\n const serializedTombstones = this.tombstoneMode\n ? (this.tombstones.length > 0 ? JSON.stringify(this.tombstones.sort()) : undefined)\n : undefined;\n\n /**\n * Incremental summary of GC data - If none of GC state, deleted nodes or tombstones changed since last summary,\n * write summary handle instead of summary tree for GC.\n * Otherwise, write the GC summary tree. In the tree, for each of these that changed, write a summary blob and\n * for each of these that did not change, write a summary handle.\n */\n if (this.trackGCState) {\n this.pendingSummaryData = { serializedGCState, serializedTombstones, serializedDeletedNodes };\n if (trackState && !fullTree && this.latestSummaryData !== undefined) {\n // If nothing changed since last summary, send a summary handle for the entire GC data.\n if (this.latestSummaryData.serializedGCState === serializedGCState\n && this.latestSummaryData.serializedTombstones === serializedTombstones) {\n const stats = mergeStats();\n stats.handleNodeCount++;\n return {\n summary: {\n type: SummaryType.Handle,\n handle: `/${gcTreeKey}`,\n handleType: SummaryType.Tree,\n },\n stats,\n };\n }\n\n // If some state changed, build a GC summary tree.\n return this.buildGCSummaryTree(\n serializedGCState, serializedTombstones, serializedDeletedNodes, true /* trackState */);\n }\n }\n // If not tracking GC state, build a GC summary tree without any summary handles.\n return this.buildGCSummaryTree(\n serializedGCState, serializedTombstones, serializedDeletedNodes, false /* trackState */);\n }\n\n /**\n * Builds the GC summary tree which contains GC state, deleted nodes and tombstones.\n * If trackState is false, all of GC state, deleted nodes and tombstones are written as summary blobs.\n * If trackState is true, only states that changed are written. Rest are written as handles.\n * @param serializedGCState - The GC state serialized as string.\n * @param serializedTombstones - The tombstone state serialized as string.\n * @param serializedDeletedNodes - Deleted nodes serialized as string.\n * @param trackState - Whether we are tracking GC state across summaries.\n * @returns the GC summary tree.\n */\n private buildGCSummaryTree(\n serializedGCState: string,\n serializedTombstones: string | undefined,\n serializedDeletedNodes: string | undefined,\n trackState: boolean,\n ): ISummaryTreeWithStats {\n const gcStateBlobKey = `${gcBlobPrefix}_root`;\n const builder = new SummaryTreeBuilder();\n\n // If the GC state hasn't changed, write a summary handle, else write a summary blob for it.\n if (this.latestSummaryData?.serializedGCState === serializedGCState && trackState) {\n builder.addHandle(gcStateBlobKey, SummaryType.Blob, `/${gcTreeKey}/${gcStateBlobKey}`);\n } else {\n builder.addBlob(gcStateBlobKey, serializedGCState);\n }\n\n // If tombstones exist, write a summary handle if it hasn't changed. If it has changed, write a\n // summary blob.\n if (serializedTombstones !== undefined) {\n if (this.latestSummaryData?.serializedTombstones === serializedTombstones && trackState) {\n builder.addHandle(gcTombstoneBlobKey, SummaryType.Blob, `/${gcTreeKey}/${gcTombstoneBlobKey}`);\n } else {\n builder.addBlob(gcTombstoneBlobKey, serializedTombstones);\n }\n }\n\n // If there are no deleted nodes, return the summary tree.\n if (serializedDeletedNodes === undefined) {\n return builder.getSummaryTree();\n }\n\n // If the deleted nodes hasn't changed, write a summary handle, else write a summary blob for it.\n if (this.latestSummaryData?.serializedDeletedNodes === serializedDeletedNodes && trackState) {\n builder.addHandle(gcDeletedBlobKey, SummaryType.Blob, `/${gcTreeKey}/${gcDeletedBlobKey}`);\n } else {\n builder.addBlob(gcDeletedBlobKey, serializedDeletedNodes);\n }\n return builder.getSummaryTree();\n }\n\n public getMetadata(): IGCMetadata {\n return {\n /**\n * If GC is enabled, the GC data is written using the current GC version and that is the gcFeature that goes\n * into the metadata blob. If GC is disabled, the gcFeature is 0.\n */\n gcFeature: this.gcEnabled ? this.currentGCVersion : 0,\n gcFeatureMatrix: this.persistedGcFeatureMatrix,\n sessionExpiryTimeoutMs: this.sessionExpiryTimeoutMs,\n sweepEnabled: this.sweepEnabled,\n sweepTimeoutMs: this.sweepTimeoutMs,\n };\n }\n\n /**\n * Returns a the GC details generated from the base summary. This is used to initialize the GC state of the nodes\n * in the container.\n */\n public async getBaseGCDetails(): Promise<IGarbageCollectionDetailsBase> {\n return this.baseGCDetailsP;\n }\n\n /**\n * Called to refresh the latest summary state. This happens when either a pending summary is acked or a snapshot\n * is downloaded and should be used to update the state.\n */\n public async refreshLatestSummary(\n proposalHandle: string | undefined,\n result: RefreshSummaryResult,\n readAndParseBlob: ReadAndParseBlob,\n ): Promise<void> {\n // If the latest summary was updated and the summary was tracked, this client is the one that generated this\n // summary. So, update wasGCRunInLatestSummary.\n // Note that this has to be updated if GC did not run too. Otherwise, `gcStateNeedsReset` will always return\n // true in scenarios where GC is disabled but enabled in the snapshot we loaded from.\n if (result.latestSummaryUpdated && result.wasSummaryTracked) {\n this.wasGCRunInLatestSummary = this.shouldRunGC;\n }\n\n if (!result.latestSummaryUpdated || !this.shouldRunGC) {\n return;\n }\n\n // If the summary was tracked by this client, it was the one that generated the summary in the first place.\n // Update latest state from pending.\n if (result.wasSummaryTracked) {\n this.latestSummaryGCVersion = this.currentGCVersion;\n if (this.trackGCState) {\n this.latestSummaryData = this.pendingSummaryData;\n this.pendingSummaryData = undefined;\n }\n return;\n }\n\n // If the summary was not tracked by this client, the state should be updated from the downloaded snapshot.\n const snapshotTree = result.snapshotTree;\n const metadataBlobId = snapshotTree.blobs[metadataBlobName];\n if (metadataBlobId) {\n const metadata = await readAndParseBlob<IContainerRuntimeMetadata>(metadataBlobId);\n this.latestSummaryGCVersion = getGCVersion(metadata);\n }\n\n // The current reference timestamp should be available if we are refreshing state from a snapshot. There has\n // to be at least one op (summary op / ack, if nothing else) if a snapshot was taken.\n const currentReferenceTimestampMs = this.runtime.getCurrentReferenceTimestampMs();\n if (currentReferenceTimestampMs === undefined) {\n throw DataProcessingError.create(\n \"No reference timestamp when updating GC state from snapshot\",\n \"refreshLatestSummary\",\n undefined,\n { proposalHandle, summaryRefSeq: result.summaryRefSeq, details: JSON.stringify(this.configs) },\n );\n }\n const gcSnapshotTree = snapshotTree.trees[gcTreeKey];\n // If GC ran in the container that generated this snapshot, it will have a GC tree.\n this.wasGCRunInLatestSummary = gcSnapshotTree !== undefined;\n let latestGCData: IGarbageCollectionSnapshotData | undefined;\n if (gcSnapshotTree !== undefined) {\n latestGCData = await getGCDataFromSnapshot(\n gcSnapshotTree,\n readAndParseBlob,\n );\n }\n this.updateStateFromSnapshotData(latestGCData, currentReferenceTimestampMs);\n this.pendingSummaryData = undefined;\n }\n\n /**\n * Called when a node with the given id is updated. If the node is inactive, log an error.\n * @param nodePath - The id of the node that changed.\n * @param reason - Whether the node was loaded or changed.\n * @param timestampMs - The timestamp when the node changed.\n * @param packagePath - The package path of the node. This may not be available if the node hasn't been loaded yet.\n * @param requestHeaders - If the node was loaded via request path, the headers in the request.\n */\n public nodeUpdated(\n nodePath: string,\n reason: \"Loaded\" | \"Changed\",\n timestampMs?: number,\n packagePath?: readonly string[],\n requestHeaders?: IRequestHeader,\n ) {\n if (!this.shouldRunGC) {\n return;\n }\n\n const nodeStateTracker = this.unreferencedNodesState.get(nodePath);\n if (nodeStateTracker && nodeStateTracker.state !== UnreferencedState.Active) {\n this.inactiveNodeUsed(\n reason,\n nodePath,\n nodeStateTracker,\n undefined /* fromNodeId */,\n packagePath,\n timestampMs,\n requestHeaders,\n );\n }\n }\n\n /**\n * Called when an outbound reference is added to a node. This is used to identify all nodes that have been\n * referenced between summaries so that their unreferenced timestamp can be reset.\n *\n * @param fromNodePath - The node from which the reference is added.\n * @param toNodePath - The node to which the reference is added.\n */\n public addedOutboundReference(fromNodePath: string, toNodePath: string) {\n if (!this.shouldRunGC) {\n return;\n }\n\n const outboundRoutes = this.newReferencesSinceLastRun.get(fromNodePath) ?? [];\n outboundRoutes.push(toNodePath);\n this.newReferencesSinceLastRun.set(fromNodePath, outboundRoutes);\n\n const nodeStateTracker = this.unreferencedNodesState.get(toNodePath);\n if (nodeStateTracker && nodeStateTracker.state !== UnreferencedState.Active) {\n this.inactiveNodeUsed(\"Revived\", toNodePath, nodeStateTracker, fromNodePath);\n }\n\n if (this.tombstones.includes(toNodePath)) {\n const nodeType = this.runtime.getNodeType(toNodePath)\n\n let eventName = \"GC_Tombstone_SubDatastore_Revived\";\n if (nodeType === GCNodeType.DataStore) {\n eventName = \"GC_Tombstone_Datastore_Revived\";\n } else if (nodeType === GCNodeType.Blob) {\n eventName = \"GC_Tombstone_Blob_Revived\";\n }\n\n sendGCTombstoneEvent(\n this.mc,\n {\n eventName,\n category: \"generic\",\n isSummarizerClient: this.isSummarizerClient,\n url: trimLeadingSlashes(toNodePath),\n nodeType,\n },\n undefined /* packagePath */,\n );\n }\n }\n\n /**\n * Returns whether a node with the given path has been deleted or not. This can be used by the runtime to identify\n * cases where objects are used after they are deleted and throw / log errors accordingly.\n */\n public isNodeDeleted(nodePath: string): boolean {\n return this.deletedNodes.has(nodePath);\n }\n\n public dispose(): void {\n this.sessionExpiryTimer?.clear();\n this.sessionExpiryTimer = undefined;\n }\n\n /**\n * Updates the state of the system as per the current GC run. It does the following:\n * 1. Sets up the current GC state as per the gcData.\n * 2. Starts tracking for nodes that have become unreferenced in this run.\n * 3. Clears tracking for nodes that were unreferenced but became referenced in this run.\n * @param gcData - The data representing the reference graph on which GC is run.\n * @param gcResult - The result of the GC run on the gcData.\n * @param currentReferenceTimestampMs - The timestamp to be used for unreferenced nodes' timestamp.\n */\n private updateCurrentState(\n gcData: IGarbageCollectionData,\n gcResult: IGCResult,\n currentReferenceTimestampMs: number,\n ) {\n this.gcDataFromLastRun = cloneGCData(gcData);\n this.tombstones = [];\n this.newReferencesSinceLastRun.clear();\n\n // Iterate through the referenced nodes and stop tracking if they were unreferenced before.\n for (const nodeId of gcResult.referencedNodeIds) {\n const nodeStateTracker = this.unreferencedNodesState.get(nodeId);\n if (nodeStateTracker !== undefined) {\n // Stop tracking so as to clear out any running timers.\n nodeStateTracker.stopTracking();\n // Delete the node as we don't need to track it any more.\n this.unreferencedNodesState.delete(nodeId);\n }\n }\n\n /**\n * If a node became unreferenced in this run, start tracking it.\n * If a node was already unreferenced, update its tracking information. Since the current reference time is\n * from the ops seen, this will ensure that we keep updating the unreferenced state as time moves forward.\n */\n for (const nodeId of gcResult.deletedNodeIds) {\n const nodeStateTracker = this.unreferencedNodesState.get(nodeId);\n if (nodeStateTracker === undefined) {\n this.unreferencedNodesState.set(\n nodeId,\n new UnreferencedStateTracker(\n currentReferenceTimestampMs,\n this.inactiveTimeoutMs,\n currentReferenceTimestampMs,\n this.sweepTimeoutMs,\n ),\n );\n } else {\n nodeStateTracker.updateTracking(currentReferenceTimestampMs);\n if (this.tombstoneMode && nodeStateTracker.state === UnreferencedState.SweepReady) {\n const nodeType = this.runtime.getNodeType(nodeId);\n if (nodeType === GCNodeType.DataStore || nodeType === GCNodeType.Blob) {\n this.tombstones.push(nodeId);\n }\n }\n }\n }\n }\n\n /**\n * Since GC runs periodically, the GC data that is generated only tells us the state of the world at that point in\n * time. There can be nodes that were referenced in between two runs and their unreferenced state needs to be\n * updated. For example, in the following scenarios not updating the unreferenced timestamp can lead to deletion of\n * these objects while there can be in-memory referenced to it:\n * 1. A node transitions from `unreferenced -> referenced -> unreferenced` between two runs. When the reference is\n * added, the object may have been accessed and in-memory reference to it added.\n * 2. A reference is added from one unreferenced node to one or more unreferenced nodes. Even though the node[s] were\n * unreferenced, they could have been accessed and in-memory reference to them added.\n *\n * This function identifies nodes that were referenced since last run and removes their unreferenced state, if any.\n * If these nodes are currently unreferenced, they will be assigned new unreferenced state by the current run.\n */\n private updateStateSinceLastRun(currentGCData: IGarbageCollectionData, logger: ITelemetryLogger) {\n // If we haven't run GC before there is nothing to do.\n if (this.gcDataFromLastRun === undefined) {\n return;\n }\n\n // Find any references that haven't been identified correctly.\n const missingExplicitReferences = this.findMissingExplicitReferences(\n currentGCData,\n this.gcDataFromLastRun,\n this.newReferencesSinceLastRun,\n );\n\n if (missingExplicitReferences.length > 0) {\n missingExplicitReferences.forEach((missingExplicitReference) => {\n logger.sendErrorEvent({\n eventName: \"gcUnknownOutboundReferences\",\n gcNodeId: missingExplicitReference[0],\n gcRoutes: JSON.stringify(missingExplicitReference[1]),\n });\n });\n }\n\n // No references were added since the last run so we don't have to update reference states of any unreferenced\n // nodes\n if (this.newReferencesSinceLastRun.size === 0) {\n return;\n }\n\n /**\n * Generate a super set of the GC data that contains the nodes and edges from last run, plus any new node and\n * edges that have been added since then. To do this, combine the GC data from the last run and the current\n * run, and then add the references since last run.\n *\n * Note on why we need to combine the data from previous run, current run and all references in between -\n * 1. We need data from last run because some of its references may have been deleted since then. If those\n * references added new outbound references before they were deleted, we need to detect them.\n *\n * 2. We need new outbound references since last run because some of them may have been deleted later. If those\n * references added new outbound references before they were deleted, we need to detect them.\n *\n * 3. We need data from the current run because currently we may not detect when DDSes are referenced:\n * - We don't require DDSes handles to be stored in a referenced DDS.\n * - A new data store may have \"root\" DDSes already created and we don't detect them today.\n */\n const gcDataSuperSet = concatGarbageCollectionData(this.gcDataFromLastRun, currentGCData);\n const newOutboundRoutesSinceLastRun: string[] = [];\n this.newReferencesSinceLastRun.forEach((outboundRoutes: string[], sourceNodeId: string) => {\n if (gcDataSuperSet.gcNodes[sourceNodeId] === undefined) {\n gcDataSuperSet.gcNodes[sourceNodeId] = outboundRoutes;\n } else {\n gcDataSuperSet.gcNodes[sourceNodeId].push(...outboundRoutes);\n }\n newOutboundRoutesSinceLastRun.push(...outboundRoutes);\n });\n\n /**\n * Run GC on the above reference graph starting with root and all new outbound routes. This will generate a\n * list of all nodes that could have been referenced since the last run. If any of these nodes are unreferenced,\n * unreferenced, stop tracking them and remove from unreferenced list.\n * Note that some of these nodes may be unreferenced now and if so, the current run will mark them as\n * unreferenced and add unreferenced state.\n */\n const gcResult = runGarbageCollection(gcDataSuperSet.gcNodes, [\"/\", ...newOutboundRoutesSinceLastRun]);\n for (const nodeId of gcResult.referencedNodeIds) {\n const nodeStateTracker = this.unreferencedNodesState.get(nodeId);\n if (nodeStateTracker !== undefined) {\n // Stop tracking so as to clear out any running timers.\n nodeStateTracker.stopTracking();\n // Delete the unreferenced state as we don't need to track it any more.\n this.unreferencedNodesState.delete(nodeId);\n }\n }\n }\n\n /**\n * Finds all new references or outbound routes in the current graph that haven't been explicitly notified to GC.\n * The principle is that every new reference or outbound route must be notified to GC via the\n * addedOutboundReference method. It it hasn't, its a bug and we want to identify these scenarios.\n *\n * In more simple terms:\n * Missing Explicit References = Current References - Previous References - Explicitly Added References;\n *\n * @param currentGCData - The GC data (reference graph) from the current GC run.\n * @param previousGCData - The GC data (reference graph) from the previous GC run.\n * @param explicitReferences - New references added explicity between the previous and the current run.\n * @returns - a list of missing explicit references\n */\n private findMissingExplicitReferences(\n currentGCData: IGarbageCollectionData,\n previousGCData: IGarbageCollectionData,\n explicitReferences: Map<string, string[]>,\n ): [string, string[]][] {\n assert(\n previousGCData !== undefined,\n 0x2b7, /* \"Can't validate correctness without GC data from last run\" */\n );\n\n const currentGraph = Object.entries(currentGCData.gcNodes);\n const missingExplicitReferences: [string, string[]][] = [];\n currentGraph.forEach(([nodeId, currentOutboundRoutes]) => {\n const previousRoutes = previousGCData.gcNodes[nodeId] ?? [];\n const explicitRoutes = explicitReferences.get(nodeId) ?? [];\n const missingExplicitRoutes: string[] = [];\n\n /**\n * 1. For routes in the current GC data, routes that were not present in previous GC data and did not have\n * explicit references should be added to missing explicit routes list.\n * 2. Only include data store and blob routes since GC only works for these two.\n * Note: Due to a bug with de-duped blobs, only adding data store routes for now.\n * 3. Ignore DDS routes to their parent datastores since those were added implicitly. So, there won't be\n * explicit routes to them.\n */\n currentOutboundRoutes.forEach((route) => {\n const nodeType = this.runtime.getNodeType(route);\n if ((nodeType === GCNodeType.DataStore || nodeType === GCNodeType.Blob)\n && !nodeId.startsWith(route)\n && (!previousRoutes.includes(route) && !explicitRoutes.includes(route))) {\n missingExplicitRoutes.push(route);\n }\n });\n if (missingExplicitRoutes.length > 0) {\n missingExplicitReferences.push([nodeId, missingExplicitRoutes]);\n }\n });\n\n // Ideally missingExplicitReferences should always have a size 0\n return missingExplicitReferences;\n }\n\n /**\n * Generates the stats of a garbage collection run from the given results of the run.\n * @param gcResult - The result of a GC run.\n * @returns the GC stats of the GC run.\n */\n private generateStats(gcResult: IGCResult): IGCStats {\n const gcStats: IGCStats = {\n nodeCount: 0,\n dataStoreCount: 0,\n attachmentBlobCount: 0,\n unrefNodeCount: 0,\n unrefDataStoreCount: 0,\n unrefAttachmentBlobCount: 0,\n updatedNodeCount: 0,\n updatedDataStoreCount: 0,\n updatedAttachmentBlobCount: 0,\n };\n\n const updateNodeStats = (nodeId: string, referenced: boolean) => {\n gcStats.nodeCount++;\n // If there is no previous GC data, every node's state is generated and is considered as updated.\n // Otherwise, find out if any node went from referenced to unreferenced or vice-versa.\n const stateUpdated = this.gcDataFromLastRun === undefined ||\n this.unreferencedNodesState.has(nodeId) === referenced;\n if (stateUpdated) {\n gcStats.updatedNodeCount++;\n }\n if (!referenced) {\n gcStats.unrefNodeCount++;\n }\n\n if (this.runtime.getNodeType(nodeId) === GCNodeType.DataStore) {\n gcStats.dataStoreCount++;\n if (stateUpdated) {\n gcStats.updatedDataStoreCount++;\n }\n if (!referenced) {\n gcStats.unrefDataStoreCount++;\n }\n }\n if (this.runtime.getNodeType(nodeId) === GCNodeType.Blob) {\n gcStats.attachmentBlobCount++;\n if (stateUpdated) {\n gcStats.updatedAttachmentBlobCount++;\n }\n if (!referenced) {\n gcStats.unrefAttachmentBlobCount++;\n }\n }\n };\n\n for (const nodeId of gcResult.referencedNodeIds) {\n updateNodeStats(nodeId, true /* referenced */);\n }\n\n for (const nodeId of gcResult.deletedNodeIds) {\n updateNodeStats(nodeId, false /* referenced */);\n }\n\n return gcStats;\n }\n\n /**\n * For nodes that are ready to sweep, log an event for now. Until we start running sweep which deletes objects,\n * this will give us a view into how much deleted content a container has.\n */\n private logSweepEvents(logger: ITelemetryLogger, currentReferenceTimestampMs: number) {\n if (this.mc.config.getBoolean(disableSweepLogKey) === true || this.sweepTimeoutMs === undefined) {\n return;\n }\n\n this.unreferencedNodesState.forEach((nodeStateTracker, nodeId) => {\n if (nodeStateTracker.state !== UnreferencedState.SweepReady) {\n return;\n }\n\n const nodeType = this.runtime.getNodeType(nodeId);\n if (nodeType !== GCNodeType.DataStore && nodeType !== GCNodeType.Blob) {\n return;\n }\n\n // Log deleted event for each node only once to reduce noise in telemetry.\n const uniqueEventId = `Deleted-${nodeId}`;\n if (this.loggedUnreferencedEvents.has(uniqueEventId)) {\n return;\n }\n this.loggedUnreferencedEvents.add(uniqueEventId);\n logger.sendTelemetryEvent({\n eventName: \"GCObjectDeleted\",\n id: nodeId,\n type: nodeType,\n age: currentReferenceTimestampMs - nodeStateTracker.unreferencedTimestampMs,\n timeout: this.sweepTimeoutMs,\n completedGCRuns: this.completedRuns,\n lastSummaryTime: this.getLastSummaryTimestampMs(),\n });\n });\n }\n\n /**\n * Called when an inactive node is used after. Queue up an event that will be logged next time GC runs.\n */\n private inactiveNodeUsed(\n usageType: \"Changed\" | \"Loaded\" | \"Revived\",\n nodeId: string,\n nodeStateTracker: UnreferencedStateTracker,\n fromNodeId?: string,\n packagePath?: readonly string[],\n currentReferenceTimestampMs = this.runtime.getCurrentReferenceTimestampMs(),\n requestHeaders?: IRequestHeader,\n ) {\n // If there is no reference timestamp to work with, no ops have been processed after creation. If so, skip\n // logging as nothing interesting would have happened worth logging.\n // If the node is active, skip logging.\n if (currentReferenceTimestampMs === undefined || nodeStateTracker.state === UnreferencedState.Active) {\n return;\n }\n\n // We only care about data stores and attachment blobs for this telemetry since GC only marks these objects\n // as unreferenced. Also, if an inactive DDS is used, the corresponding data store store will also be used.\n const nodeType = this.runtime.getNodeType(nodeId);\n if (nodeType !== GCNodeType.DataStore && nodeType !== GCNodeType.Blob) {\n return;\n }\n\n const state = nodeStateTracker.state;\n const uniqueEventId = `${state}-${nodeId}-${usageType}`;\n if (this.loggedUnreferencedEvents.has(uniqueEventId)) {\n return;\n }\n this.loggedUnreferencedEvents.add(uniqueEventId);\n\n const propsToLog = {\n id: nodeId,\n type: nodeType,\n unrefTime: nodeStateTracker.unreferencedTimestampMs,\n age: currentReferenceTimestampMs - nodeStateTracker.unreferencedTimestampMs,\n timeout: nodeStateTracker.state === UnreferencedState.Inactive\n ? this.inactiveTimeoutMs\n : this.sweepTimeoutMs,\n completedGCRuns: this.completedRuns,\n lastSummaryTime: this.getLastSummaryTimestampMs(),\n ...this.createContainerMetadata,\n externalRequest: requestHeaders?.[RuntimeHeaders.externalRequest],\n viaHandle: requestHeaders?.[RuntimeHeaders.viaHandle],\n fromId: fromNodeId,\n };\n\n // For summarizer client, queue the event so it is logged the next time GC runs if the event is still valid.\n // For non-summarizer client, log the event now since GC won't run on it. This may result in false positives\n // but it's a good signal nonetheless and we can consume it with a grain of salt.\n // Inactive errors are usages of Objects that are unreferenced for at least a period of 7 days.\n // SweepReady errors are usages of Objects that will be deleted by GC Sweep!\n if (this.isSummarizerClient) {\n this.pendingEventsQueue.push({ ...propsToLog, usageType, state });\n } else {\n // For non-summarizer clients, only log \"Loaded\" type events since these objects may not be loaded in the\n // summarizer clients if they are based off of user actions (such as scrolling to content for these objects)\n // Events generated:\n // InactiveObject_Loaded, SweepReadyObject_Loaded\n if (usageType === \"Loaded\") {\n const event = {\n ...propsToLog,\n eventName: `${state}Object_${usageType}`,\n pkg: packagePathToTelemetryProperty(packagePath),\n stack: generateStack(),\n };\n\n // Do not log the inactive object x events as error events as they are not the best signal for\n // detecting something wrong with GC either from the partner or from the runtime itself.\n if (state === UnreferencedState.Inactive) {\n this.mc.logger.sendTelemetryEvent(event);\n } else {\n this.mc.logger.sendErrorEvent(event);\n }\n }\n\n // If SweepReady Usage Detection is enabled, the handler may close the interactive container.\n // Once Sweep is fully implemented, this will be removed since the objects will be gone\n // and errors will arise elsewhere in the runtime\n if (state === UnreferencedState.SweepReady) {\n this.sweepReadyUsageHandler.usageDetectedInInteractiveClient({ ...propsToLog, usageType });\n }\n }\n }\n\n private async logUnreferencedEvents(logger: ITelemetryLogger) {\n // Events sent come only from the summarizer client. In between summaries, events are pushed to a queue and at\n // summary time they are then logged.\n // Events generated:\n // InactiveObject_Loaded, InactiveObject_Changed, InactiveObject_Revived\n // SweepReadyObject_Loaded, SweepReadyObject_Changed, SweepReadyObject_Revived\n for (const eventProps of this.pendingEventsQueue) {\n const { usageType, state, ...propsToLog } = eventProps;\n /**\n * Revived event is logged only if the node is active. If the node is not active, the reference to it was\n * from another unreferenced node and this scenario is not interesting to log.\n * Loaded and Changed events are logged only if the node is not active. If the node is active, it was\n * revived and a Revived event will be logged for it.\n */\n const nodeStateTracker = this.unreferencedNodesState.get(eventProps.id);\n const active = nodeStateTracker === undefined || nodeStateTracker.state === UnreferencedState.Active;\n if ((usageType === \"Revived\") === active) {\n const pkg = await this.getNodePackagePath(eventProps.id);\n const fromPkg = eventProps.fromId ? await this.getNodePackagePath(eventProps.fromId) : undefined;\n const event = {\n ...propsToLog,\n eventName: `${state}Object_${usageType}`,\n pkg: pkg ? { value: pkg.join(\"/\"), tag: TelemetryDataTag.CodeArtifact } : undefined,\n fromPkg: fromPkg ? { value: fromPkg.join(\"/\"), tag: TelemetryDataTag.CodeArtifact } : undefined,\n }\n\n if (state === UnreferencedState.Inactive) {\n logger.sendTelemetryEvent(event);\n } else {\n logger.sendErrorEvent(event);\n }\n }\n }\n this.pendingEventsQueue = [];\n }\n}\n\nfunction generateSortedGCState(gcState: IGarbageCollectionState): IGarbageCollectionState {\n const sortableArray: [string, IGarbageCollectionNodeData][] = Object.entries(gcState.gcNodes);\n sortableArray.sort(([a], [b]) => a.localeCompare(b));\n const sortedGCState: IGarbageCollectionState = { gcNodes: {} };\n for (const [nodeId, nodeData] of sortableArray) {\n nodeData.outboundRoutes.sort();\n sortedGCState.gcNodes[nodeId] = nodeData;\n }\n return sortedGCState;\n}\n\n/** A wrapper around common-utils Timer that requires the timeout when calling start/restart */\nclass TimerWithNoDefaultTimeout extends Timer {\n constructor(\n private readonly callback: () => void,\n ) {\n // The default timeout/handlers will never be used since start/restart pass overrides below\n super(0, () => { throw new Error(\"DefaultHandler should not be used\"); });\n }\n\n start(timeoutMs: number) {\n super.start(timeoutMs, this.callback);\n }\n\n restart(timeoutMs: number): void {\n super.restart(timeoutMs, this.callback);\n }\n}\n"]}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
import { GCVersion } from "./summaryFormat";
|
|
6
|
-
/** The stable version of garbage collection in production. */
|
|
7
|
-
export declare const stableGCVersion: GCVersion;
|
|
8
|
-
/** The current version of garbage collection. */
|
|
9
|
-
export declare const currentGCVersion: GCVersion;
|
|
10
|
-
/** This undocumented GC Option (on ContainerRuntime Options) allows an app to disable enforcing GC on old documents by incrementing this value */
|
|
11
|
-
export declare const gcTombstoneGenerationOptionName = "gcTombstoneGeneration";
|
|
12
|
-
export declare const runGCKey = "Fluid.GarbageCollection.RunGC";
|
|
13
|
-
export declare const runSweepKey = "Fluid.GarbageCollection.RunSweep";
|
|
14
|
-
export declare const gcTestModeKey = "Fluid.GarbageCollection.GCTestMode";
|
|
15
|
-
export declare const runSessionExpiryKey = "Fluid.GarbageCollection.RunSessionExpiry";
|
|
16
|
-
export declare const trackGCStateKey = "Fluid.GarbageCollection.TrackGCState";
|
|
17
|
-
export declare const disableSweepLogKey = "Fluid.GarbageCollection.DisableSweepLog";
|
|
18
|
-
export declare const disableTombstoneKey = "Fluid.GarbageCollection.DisableTombstone";
|
|
19
|
-
export declare const throwOnTombstoneLoadKey = "Fluid.GarbageCollection.ThrowOnTombstoneLoad";
|
|
20
|
-
export declare const throwOnTombstoneUsageKey = "Fluid.GarbageCollection.ThrowOnTombstoneUsage";
|
|
21
|
-
export declare const gcVersionUpgradeToV2Key = "Fluid.GarbageCollection.GCVersionUpgradeToV2";
|
|
22
|
-
export declare const oneDayMs: number;
|
|
23
|
-
export declare const defaultInactiveTimeoutMs: number;
|
|
24
|
-
export declare const defaultSessionExpiryDurationMs: number;
|
|
25
|
-
//# sourceMappingURL=garbageCollectionConstants.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"garbageCollectionConstants.d.ts","sourceRoot":"","sources":["../src/garbageCollectionConstants.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,8DAA8D;AAC9D,eAAO,MAAM,eAAe,EAAE,SAAa,CAAC;AAC5C,iDAAiD;AACjD,eAAO,MAAM,gBAAgB,EAAE,SAAa,CAAC;AAE7C,kJAAkJ;AAClJ,eAAO,MAAM,+BAA+B,0BAA0B,CAAC;AAGvE,eAAO,MAAM,QAAQ,kCAAkC,CAAC;AAExD,eAAO,MAAM,WAAW,qCAAqC,CAAC;AAE9D,eAAO,MAAM,aAAa,uCAAuC,CAAC;AAElE,eAAO,MAAM,mBAAmB,6CAA6C,CAAC;AAE9E,eAAO,MAAM,eAAe,yCAAyC,CAAC;AAEtE,eAAO,MAAM,kBAAkB,4CAA4C,CAAC;AAE5E,eAAO,MAAM,mBAAmB,6CAA6C,CAAC;AAE9E,eAAO,MAAM,uBAAuB,iDAAiD,CAAC;AAEtF,eAAO,MAAM,wBAAwB,kDAAkD,CAAC;AAExF,eAAO,MAAM,uBAAuB,iDAAiD,CAAC;AAGtF,eAAO,MAAM,QAAQ,QAA0B,CAAC;AAEhD,eAAO,MAAM,wBAAwB,QAAe,CAAC;AACrD,eAAO,MAAM,8BAA8B,QAAgB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"garbageCollectionConstants.js","sourceRoot":"","sources":["../src/garbageCollectionConstants.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,8DAA8D;AACjD,QAAA,eAAe,GAAc,CAAC,CAAC;AAC5C,iDAAiD;AACpC,QAAA,gBAAgB,GAAc,CAAC,CAAC;AAE7C,kJAAkJ;AACrI,QAAA,+BAA+B,GAAG,uBAAuB,CAAC;AAEvE,wCAAwC;AAC3B,QAAA,QAAQ,GAAG,+BAA+B,CAAC;AACxD,8CAA8C;AACjC,QAAA,WAAW,GAAG,kCAAkC,CAAC;AAC9D,kDAAkD;AACrC,QAAA,aAAa,GAAG,oCAAoC,CAAC;AAClE,mEAAmE;AACtD,QAAA,mBAAmB,GAAG,0CAA0C,CAAC;AAC9E,6EAA6E;AAChE,QAAA,eAAe,GAAG,sCAAsC,CAAC;AACtE,6CAA6C;AAChC,QAAA,kBAAkB,GAAG,yCAAyC,CAAC;AAC5E,qHAAqH;AACxG,QAAA,mBAAmB,GAAG,0CAA0C,CAAC;AAC9E,wFAAwF;AAC3E,QAAA,uBAAuB,GAAG,8CAA8C,CAAC;AACtF,0GAA0G;AAC7F,QAAA,wBAAwB,GAAG,+CAA+C,CAAC;AACxF,6CAA6C;AAChC,QAAA,uBAAuB,GAAG,8CAA8C,CAAC;AAEtF,2BAA2B;AACd,QAAA,QAAQ,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAEnC,QAAA,wBAAwB,GAAG,CAAC,GAAG,gBAAQ,CAAC,CAAC,SAAS;AAClD,QAAA,8BAA8B,GAAG,EAAE,GAAG,gBAAQ,CAAC,CAAC,UAAU","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { GCVersion } from \"./summaryFormat\";\n\n/** The stable version of garbage collection in production. */\nexport const stableGCVersion: GCVersion = 1;\n/** The current version of garbage collection. */\nexport const currentGCVersion: GCVersion = 2;\n\n/** This undocumented GC Option (on ContainerRuntime Options) allows an app to disable enforcing GC on old documents by incrementing this value */\nexport const gcTombstoneGenerationOptionName = \"gcTombstoneGeneration\";\n\n// Feature gate key to turn GC on / off.\nexport const runGCKey = \"Fluid.GarbageCollection.RunGC\";\n// Feature gate key to turn GC sweep on / off.\nexport const runSweepKey = \"Fluid.GarbageCollection.RunSweep\";\n// Feature gate key to turn GC test mode on / off.\nexport const gcTestModeKey = \"Fluid.GarbageCollection.GCTestMode\";\n// Feature gate key to expire a session after a set period of time.\nexport const runSessionExpiryKey = \"Fluid.GarbageCollection.RunSessionExpiry\";\n// Feature gate key to write the gc blob as a handle if the data is the same.\nexport const trackGCStateKey = \"Fluid.GarbageCollection.TrackGCState\";\n// Feature gate key to turn GC sweep log off.\nexport const disableSweepLogKey = \"Fluid.GarbageCollection.DisableSweepLog\";\n// Feature gate key to disable the tombstone feature, i.e., tombstone information is not read / written into summary.\nexport const disableTombstoneKey = \"Fluid.GarbageCollection.DisableTombstone\";\n// Feature gate to enable throwing an error when tombstone object is loaded (requested).\nexport const throwOnTombstoneLoadKey = \"Fluid.GarbageCollection.ThrowOnTombstoneLoad\";\n// Feature gate to enable throwing an error when tombstone object is used (e.g. outgoing or incoming ops).\nexport const throwOnTombstoneUsageKey = \"Fluid.GarbageCollection.ThrowOnTombstoneUsage\";\n// Feature gate to enable GC version upgrade.\nexport const gcVersionUpgradeToV2Key = \"Fluid.GarbageCollection.GCVersionUpgradeToV2\";\n\n// One day in milliseconds.\nexport const oneDayMs = 1 * 24 * 60 * 60 * 1000;\n\nexport const defaultInactiveTimeoutMs = 7 * oneDayMs; // 7 days\nexport const defaultSessionExpiryDurationMs = 30 * oneDayMs; // 30 days\n"]}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
import { ITelemetryGenericEvent } from "@fluidframework/common-definitions";
|
|
6
|
-
import { MonitoringContext } from "@fluidframework/telemetry-utils";
|
|
7
|
-
/**
|
|
8
|
-
* Consolidates info / logic for logging when we encounter a Tombstone
|
|
9
|
-
*/
|
|
10
|
-
export declare function sendGCTombstoneEvent(mc: MonitoringContext, event: ITelemetryGenericEvent & {
|
|
11
|
-
category: "error" | "generic";
|
|
12
|
-
isSummarizerClient: boolean;
|
|
13
|
-
}, packagePath: readonly string[] | undefined, error?: unknown): void;
|
|
14
|
-
//# sourceMappingURL=garbageCollectionTombstoneUtils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"garbageCollectionTombstoneUtils.d.ts","sourceRoot":"","sources":["../src/garbageCollectionTombstoneUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAE5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAGpE;;GAEG;AACH,wBAAgB,oBAAoB,CAChC,EAAE,EAAE,iBAAiB,EACrB,KAAK,EAAE,sBAAsB,GAAG;IAAE,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAC;IAAC,kBAAkB,EAAE,OAAO,CAAA;CAAE,EAC9F,WAAW,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,EAC1C,KAAK,CAAC,EAAE,OAAO,QAUlB"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*!
|
|
3
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
|
-
* Licensed under the MIT License.
|
|
5
|
-
*/
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.sendGCTombstoneEvent = void 0;
|
|
8
|
-
const runtime_utils_1 = require("@fluidframework/runtime-utils");
|
|
9
|
-
const garbageCollectionConstants_1 = require("./garbageCollectionConstants");
|
|
10
|
-
/**
|
|
11
|
-
* Consolidates info / logic for logging when we encounter a Tombstone
|
|
12
|
-
*/
|
|
13
|
-
function sendGCTombstoneEvent(mc, event, packagePath, error) {
|
|
14
|
-
event.pkg = (0, runtime_utils_1.packagePathToTelemetryProperty)(packagePath);
|
|
15
|
-
event.tombstoneFlags = JSON.stringify({
|
|
16
|
-
DisableTombstone: mc.config.getBoolean(garbageCollectionConstants_1.disableTombstoneKey),
|
|
17
|
-
ThrowOnTombstoneUsage: mc.config.getBoolean(garbageCollectionConstants_1.throwOnTombstoneUsageKey),
|
|
18
|
-
ThrowOnTombstoneLoad: mc.config.getBoolean(garbageCollectionConstants_1.throwOnTombstoneLoadKey),
|
|
19
|
-
});
|
|
20
|
-
mc.logger.sendTelemetryEvent(event, error);
|
|
21
|
-
}
|
|
22
|
-
exports.sendGCTombstoneEvent = sendGCTombstoneEvent;
|
|
23
|
-
//# sourceMappingURL=garbageCollectionTombstoneUtils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"garbageCollectionTombstoneUtils.js","sourceRoot":"","sources":["../src/garbageCollectionTombstoneUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,iEAA+E;AAE/E,6EAAsH;AAEtH;;GAEG;AACH,SAAgB,oBAAoB,CAChC,EAAqB,EACrB,KAA8F,EAC9F,WAA0C,EAC1C,KAAe;IAEf,KAAK,CAAC,GAAG,GAAG,IAAA,8CAA8B,EAAC,WAAW,CAAC,CAAC;IACxD,KAAK,CAAC,cAAc,GAAG,IAAI,CAAC,SAAS,CAAC;QAClC,gBAAgB,EAAE,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,gDAAmB,CAAC;QAC3D,qBAAqB,EAAE,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,qDAAwB,CAAC;QACrE,oBAAoB,EAAE,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,oDAAuB,CAAC;KACtE,CAAC,CAAC;IAEH,EAAE,CAAC,MAAM,CAAC,kBAAkB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AAC/C,CAAC;AAdD,oDAcC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryGenericEvent } from \"@fluidframework/common-definitions\";\nimport { packagePathToTelemetryProperty } from \"@fluidframework/runtime-utils\";\nimport { MonitoringContext } from \"@fluidframework/telemetry-utils\";\nimport { disableTombstoneKey, throwOnTombstoneLoadKey, throwOnTombstoneUsageKey } from \"./garbageCollectionConstants\";\n\n/**\n * Consolidates info / logic for logging when we encounter a Tombstone\n */\nexport function sendGCTombstoneEvent(\n mc: MonitoringContext,\n event: ITelemetryGenericEvent & { category: \"error\" | \"generic\", isSummarizerClient: boolean },\n packagePath: readonly string[] | undefined,\n error?: unknown,\n) {\n event.pkg = packagePathToTelemetryProperty(packagePath);\n event.tombstoneFlags = JSON.stringify({\n DisableTombstone: mc.config.getBoolean(disableTombstoneKey),\n ThrowOnTombstoneUsage: mc.config.getBoolean(throwOnTombstoneUsageKey),\n ThrowOnTombstoneLoad: mc.config.getBoolean(throwOnTombstoneLoadKey),\n });\n\n mc.logger.sendTelemetryEvent(event, error);\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"gcSweepReadyUsageDetection.d.ts","sourceRoot":"","sources":["../src/gcSweepReadyUsageDetection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAChF,OAAO,EAEH,eAAe,EACf,YAAY,EACZ,iBAAiB,EACpB,MAAM,iCAAiC,CAAC;AAGzC;;;GAGG;AACH,eAAO,MAAM,sBAAsB,iFAAiF,CAAC;AAErH;;;GAGG;AACH,eAAO,MAAM,0BAA0B,sEAAsE,CAAC;AAoB9G;;;;;;;GAOG;AACH,qBAAa,oBAAqB,SAAQ,YAAa,YAAW,eAAe;IAC7E,oHAAoH;IAC7G,SAAS,EAAE,MAAM,CAAiD;CAC5E;AAED;;;;;;;GAOG;AACH,qBAAa,+BAA+B;IAIpC,OAAO,CAAC,QAAQ,CAAC,kBAAkB;IACnC,OAAO,CAAC,QAAQ,CAAC,EAAE;IACnB,OAAO,CAAC,QAAQ,CAAC,OAAO;IAL5B,O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KAAK,CAAC,QAAQ,CAAC,CAAC;gBAClE,IAAI,OAAO,WAAW,KAAK,QAAQ,EAAE;oBACjC,eAAe,GAAG,WAAW,CAAC;iBACjC;aACJ;YAAC,OAAO,CAAC,EAAE;aACX;YACD,aAAa,GAAG,MAAA,eAAe,CAAC,IAAI,CAAC,kBAAkB,CAAC,0CAAE,aAAa,CAAC;YAExE,+DAA+D;YAC/D,IAAI,aAAa,KAAK,SAAS,IAAI,IAAI,CAAC,GAAG,EAAE,GAAG,aAAa,GAAG,mBAAmB,GAAG,qCAAQ,EAAE;gBAC5F,WAAW,GAAG,KAAK,CAAC;aACvB;SACJ;QAED,MAAM,KAAK,GAAG,IAAI,oBAAoB,CAClC,iDAAiD,EACjD,EAAE,YAAY,EAAE,IAAI,CAAC,SAAS,iCAAM,UAAU,KAAE,aAAa,EAAE,mBAAmB,IAAG,EAAE,CAC1F,CAAC;QACF,IAAI,WAAW,EAAE;YACb,qDAAqD;YACrD,8FAA8F;YAC9F,mGAAmG;YACnG,eAAe,CAAC,IAAI,CAAC,kBAAkB,CAAC,GAAG,EAAE,aAAa,EAAE,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC;YACzE,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,kCAA0B,EAAE,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC,CAAC;YAEvF,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;SACvB;aAAM;YACH,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,cAAc,CAAC,EAAE,SAAS,EAAE,+BAA+B,EAAE,EAAE,KAAK,CAAC,CAAC;SACxF;IACL,CAAC;CACJ;AAxED,0EAwEC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryProperties } from \"@fluidframework/common-definitions\";\nimport { ICriticalContainerError } from \"@fluidframework/container-definitions\";\nimport {\n IConfigProvider,\n IFluidErrorBase,\n LoggingError,\n MonitoringContext,\n} from \"@fluidframework/telemetry-utils\";\nimport { oneDayMs } from \"./garbageCollectionConstants\";\n\n/**\n * Feature Gate Key -\n * How many days between closing the container from this error (avoids locking user out of their file altogether)\n */\nexport const skipClosureForXDaysKey = \"Fluid.GarbageCollection.Dogfood.SweepReadyUsageDetection.SkipClosureForXDays\";\n\n/**\n * LocalStorage key (NOT via feature gate / monitoring context)\n * A map from docId to info about the last time we closed due to this error\n */\nexport const closuresMapLocalStorageKey = \"Fluid.GarbageCollection.Dogfood.SweepReadyUsageDetection.Closures\";\n\n/**\n * Feature gate key to enable closing the container if SweepReady objects are used.\n * Value should contain keywords \"interactiveClient\" and/or \"summarizer\" to enable detection in each container type\n */\nconst sweepReadyUsageDetectionSetting = {\n read(config: IConfigProvider) {\n const sweepReadyUsageDetectionKey = \"Fluid.GarbageCollection.Dogfood.SweepReadyUsageDetection\";\n const value = config.getString(sweepReadyUsageDetectionKey);\n if (value === undefined) {\n return { interactiveClient: false, summarizer: false };\n }\n return {\n interactiveClient: value.includes(\"interactiveClient\"),\n summarizer: value.includes(\"summarizer\"),\n };\n },\n};\n\n/**\n * Error class raised when a SweepReady object is used, indicating a bug in how\n * references are managed in the container by the application, or a bug in how\n * GC tracks those references.\n *\n * There's a chance for false positives when this error is raised by an Interactive Container,\n * since only the Summarizer has the latest truth about unreferenced node tracking\n */\nexport class SweepReadyUsageError extends LoggingError implements IFluidErrorBase {\n /** This errorType will be in temporary use (until Sweep is fully implemented) so don't add to any errorType type */\n public errorType: string = \"unreferencedObjectUsedAfterGarbageCollected\";\n}\n\n/**\n * This class encapsulates the logic around what to do when a SweepReady object is used.\n * There are several tactics we plan to use in Dogfood environments to aid diagnosis of these cases:\n * - Closing the interactive container when either the interactive or summarizer client detects this kind of violation\n * (via sweepReadyUsageDetectionSetting above)\n * - Throttling the frequency of these crashes via a \"Skip Closure Period\" per container per device\n * (via skipClosureForXDaysKey above. Uses localStorage and closuresMapLocalStorageKey to implement this behavior)\n */\nexport class SweepReadyUsageDetectionHandler {\n private readonly localStorage: Pick<Storage, \"getItem\" | \"setItem\">;\n\n constructor(\n private readonly uniqueContainerKey: string,\n private readonly mc: MonitoringContext,\n private readonly closeFn: (error?: ICriticalContainerError) => void,\n localStorageOverride?: Pick<Storage, \"getItem\" | \"setItem\">,\n ) {\n const noopStorage = { getItem: () => null, setItem: () => {} };\n // localStorage is not defined in Node environment, so fall back to noopStorage if needed.\n this.localStorage = localStorageOverride ?? globalThis.localStorage ?? noopStorage;\n\n if (this.localStorage === noopStorage) {\n // This means the Skip Closure Period logic will not work.\n this.mc.logger.sendTelemetryEvent({ eventName: \"SweepReadyUsageDetectionHandlerNoopStorage\" });\n }\n }\n\n /**\n * If SweepReady Usage Detection is enabled, close the interactive container.\n * If the SkipClosureForXDays setting is set, don't close the container more than once in that period.\n *\n * Once Sweep is fully implemented, this will be removed since the objects will be gone\n * and errors will arise elsewhere in the runtime\n */\n public usageDetectedInInteractiveClient(errorProps: ITelemetryProperties) {\n if (!sweepReadyUsageDetectionSetting.read(this.mc.config).interactiveClient) {\n return;\n }\n\n // Default stance is we close every time - this reflects the severity of SweepReady Object Usage.\n // However, we may choose to \"throttle\" the closures by setting the SkipClosureForXDays setting,\n // which will only allow the container to close once during that period, to avoid locking users out.\n let shouldClose: boolean = true;\n let pastClosuresMap: Record<string, { lastCloseTime: number; } | undefined> = {};\n let lastCloseTime: number | undefined;\n const skipClosureForXDays = this.mc.config.getNumber(skipClosureForXDaysKey);\n if (skipClosureForXDays !== undefined) {\n // Read pastClosuresMap from localStorage then extract the lastCloseTime from the map\n try {\n const rawValue = this.localStorage.getItem(closuresMapLocalStorageKey);\n const parsedValue = rawValue === null ? {} : JSON.parse(rawValue);\n if (typeof parsedValue === \"object\") {\n pastClosuresMap = parsedValue;\n }\n } catch (e) {\n }\n lastCloseTime = pastClosuresMap[this.uniqueContainerKey]?.lastCloseTime;\n\n // Don't close if we did already within the Skip Closure Period\n if (lastCloseTime !== undefined && Date.now() < lastCloseTime + skipClosureForXDays * oneDayMs) {\n shouldClose = false;\n }\n }\n\n const error = new SweepReadyUsageError(\n \"SweepReady object used in Non-Summarizer Client\",\n { errorDetails: JSON.stringify({ ...errorProps, lastCloseTime, skipClosureForXDays }) },\n );\n if (shouldClose) {\n // Update closures map in localStorage before closing\n // Note there is a race condition between different tabs updating localStorage and overwriting\n // each others' updates. If so, some tab will crash again. Just reload one at a time to get unstuck\n pastClosuresMap[this.uniqueContainerKey] = { lastCloseTime: Date.now() };\n this.localStorage.setItem(closuresMapLocalStorageKey, JSON.stringify(pastClosuresMap));\n\n this.closeFn(error);\n } else {\n this.mc.logger.sendErrorEvent({ eventName: \"SweepReadyObject_UsageAllowed\" }, error);\n }\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"orderedClientElection.d.ts","sourceRoot":"","sources":["../src/orderedClientElection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAC9F,OAAO,EAAU,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AAEtE,OAAO,EAAE,OAAO,EAAE,cAAc,EAAoB,MAAM,sCAAsC,CAAC;AAMjG,oBAAY,mBAAmB,GAAG,SAAS,GAAG,IAAI,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,QAAQ,CAAC;AAC1F,oBAAY,SAAS,CAAC,CAAC,IAAI,CAAC,SAAS,mBAAmB,GAClD,CAAC,GACD,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,GACrB,SAAS,SAAS,CAAC,CAAC,CAAC,EAAE,GACvB,CAAC,SAAS,GAAG,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,GAC/B,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,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C,uBAAuB,CAAC,MAAA,IAAI,CAAC,cAAc,0CAAE,aAAa,CAAC,mCACnE,IAAI,CAAC,uBAAuB,CAAC,IAAI,CAAC,uBAAuB,CAAC,YAAY,CAAC,CAAC;IAChF,CAAC;IAEM,SAAS;;QACZ,OAAO;YACH,sBAAsB,EAAE,IAAI,CAAC,sBAAsB;YACnD,eAAe,EAAE,MAAA,IAAI,CAAC,aAAa,0CAAE,QAAQ;YAC7C,eAAe,EAAE,MAAA,IAAI,CAAC,aAAa,0CAAE,QAAQ;SAChD,CAAC;IACN,CAAC;CACJ;AA9QD,sDA8QC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n/* eslint-disable @rushstack/no-new-null */\nimport { IEvent, IEventProvider, ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport { assert, TypedEventEmitter } from \"@fluidframework/common-utils\";\nimport { IDeltaManager } from \"@fluidframework/container-definitions\";\nimport { UsageError } from \"@fluidframework/container-utils\";\nimport { IClient, IQuorumClients, ISequencedClient } from \"@fluidframework/protocol-definitions\";\nimport { ChildLogger } from \"@fluidframework/telemetry-utils\";\nimport { summarizerClientType } from \"./summarizerClientElection\";\n\n// helper types for recursive readonly.\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport type ImmutablePrimitives = undefined | null | boolean | string | number | Function;\nexport type Immutable<T> = T extends ImmutablePrimitives\n ? T\n : T extends (infer A)[]\n ? readonly Immutable<A>[]\n : T extends Map<infer K, infer V>\n ? ReadonlyMap<Immutable<K>, Immutable<V>>\n : T extends Set<infer V>\n ? ReadonlySet<Immutable<V>>\n : { readonly [K in keyof T]: Immutable<T[K]> };\n\n/** Minimum information for a client tracked for election consideration. */\nexport interface ITrackedClient {\n readonly clientId: string;\n readonly sequenceNumber: number;\n readonly client: Immutable<IClient>;\n}\n\n/** Common contract for link nodes within an OrderedClientCollection. */\nexport interface ILinkNode {\n readonly sequenceNumber: number;\n youngerClient: ILinkedClient | undefined;\n}\n\n/** Placeholder root node within an OrderedClientCollection; does not represent a client. */\nexport interface IRootLinkNode extends ILinkNode {\n readonly sequenceNumber: -1;\n readonly olderClient: undefined;\n}\n\n/** Additional information required to keep track of the client within the doubly-linked list. */\nexport interface ILinkedClient extends ILinkNode, ITrackedClient {\n olderClient: LinkNode;\n}\n\n/** Any link node within OrderedClientCollection including the placeholder root node. */\nexport type LinkNode = IRootLinkNode | ILinkedClient;\n\n/** Events raised by an OrderedClientCollection. */\nexport interface IOrderedClientCollectionEvents extends IEvent {\n /** Event fires when client is being added. */\n (event: \"addClient\" | \"removeClient\", listener: (client: ILinkedClient, sequenceNumber: number) => void);\n}\n\n/** Contract for a sorted collection of all clients in the quorum. */\nexport interface IOrderedClientCollection extends IEventProvider<IOrderedClientCollectionEvents> {\n /** Count of clients in the collection. */\n readonly count: number;\n /** Pointer to the oldest client in the collection. */\n readonly oldestClient: ILinkedClient | undefined;\n /** Returns a sorted array of all the clients in the collection. */\n getAllClients(): ILinkedClient[];\n}\n\n/**\n * Tracks clients in the Quorum. It maintains their order using their join op\n * sequence numbers.\n * Internally, the collection of clients is maintained in a doubly-linked list,\n * with pointers to both the first and last nodes.\n * The first (root) node is a placeholder to simplify logic and reduce null checking.\n */\nexport class OrderedClientCollection\n extends TypedEventEmitter<IOrderedClientCollectionEvents>\n implements IOrderedClientCollection {\n /** Collection of ALL clients currently in the quorum, with client ids as keys. */\n private readonly clientMap = new Map<string, ILinkedClient>();\n /** Placeholder head node of linked list, for simplified null checking. */\n private readonly rootNode: IRootLinkNode = {\n sequenceNumber: -1,\n olderClient: undefined,\n youngerClient: undefined,\n };\n /** Pointer to end of linked list, for optimized client adds. */\n private _youngestClient: LinkNode = this.rootNode;\n private readonly logger: ITelemetryLogger;\n\n public get count() {\n return this.clientMap.size;\n }\n public get oldestClient() {\n return this.rootNode.youngerClient;\n }\n\n constructor(\n logger: ITelemetryLogger,\n deltaManager: Pick<IDeltaManager<unknown, unknown>, \"lastSequenceNumber\">,\n quorum: Pick<IQuorumClients, \"getMembers\" | \"on\">,\n ) {\n super();\n this.logger = ChildLogger.create(logger, \"OrderedClientCollection\");\n const members = quorum.getMembers();\n for (const [clientId, client] of members) {\n this.addClient(clientId, client);\n }\n\n quorum.on(\"addMember\", (clientId, client) => {\n const newClient = this.addClient(clientId, client);\n this.emit(\"addClient\", newClient, deltaManager.lastSequenceNumber);\n });\n quorum.on(\"removeMember\", (clientId) => {\n const sequenceNumber = deltaManager.lastSequenceNumber;\n const removeClient = this.removeClient(clientId);\n if (removeClient === undefined) {\n this.logger.sendErrorEvent({ eventName: \"ClientNotFound\", clientId, sequenceNumber });\n } else {\n this.emit(\"removeClient\", removeClient, sequenceNumber);\n }\n });\n }\n\n private addClient(clientId: string, client: ISequencedClient): ITrackedClient {\n // Normal case is adding the latest client, which will bypass loop.\n // Find where it belongs otherwise (maybe possible during initial load?).\n assert(client.sequenceNumber > -1, 0x1f6 /* \"Negative client sequence number not allowed\" */);\n let currClient = this._youngestClient;\n while (currClient.sequenceNumber > client.sequenceNumber) {\n assert(currClient.olderClient !== undefined, 0x1f7 /* \"Previous client should always be defined\" */);\n // Note: If adding a client older than the elected client, it will not be automatically elected.\n currClient = currClient.olderClient;\n }\n\n // Now currClient is the node right before where the new client node should be.\n const newClient: ILinkedClient = {\n clientId,\n sequenceNumber: client.sequenceNumber,\n client: { ...client.client }, // shallow clone\n olderClient: currClient,\n youngerClient: currClient.youngerClient,\n };\n\n // Update prev node to point to this new node.\n newClient.olderClient.youngerClient = newClient;\n\n if (newClient.youngerClient === undefined) {\n // Update linked list end pointer to youngest client.\n this._youngestClient = newClient;\n } else {\n // Update next node to point back to this new node.\n newClient.youngerClient.olderClient = newClient;\n }\n\n this.clientMap.set(clientId, newClient);\n return newClient;\n }\n\n private removeClient(clientId: string): ITrackedClient | undefined {\n const removeClient = this.clientMap.get(clientId);\n if (removeClient === undefined) {\n return;\n }\n\n // Update prev node to point to next node.\n removeClient.olderClient.youngerClient = removeClient.youngerClient;\n\n if (removeClient.youngerClient === undefined) {\n // Update linked list end pointer to youngest client.\n this._youngestClient = removeClient.olderClient;\n } else {\n // Update next node to point back to previous node.\n removeClient.youngerClient.olderClient = removeClient.olderClient;\n }\n\n this.clientMap.delete(clientId);\n return removeClient;\n }\n\n /** Returns an array of all clients being tracked in order from oldest to newest. */\n public getAllClients(): ILinkedClient[] {\n const result: ILinkedClient[] = [];\n let currClient: LinkNode = this.rootNode;\n while (currClient.youngerClient !== undefined) {\n result.push(currClient.youngerClient);\n currClient = currClient.youngerClient;\n }\n return result;\n }\n}\n\n/** Events raised by an OrderedClientElection. */\nexport interface IOrderedClientElectionEvents extends IEvent {\n /** Event fires when the currently elected client changes. */\n (event: \"election\", listener: (\n /** Newly elected client. */\n client: ITrackedClient | undefined,\n /** Sequence number where election took place. */\n sequenceNumber: number,\n /** Previously elected client. */\n prevClient: ITrackedClient | undefined,\n ) => void);\n}\n\n/** Serialized state of IOrderedClientElection. */\nexport interface ISerializedElection {\n /** Sequence number at the time of the latest election. */\n readonly electionSequenceNumber: number;\n\n /**\n * Most recently elected client id. This is either:\n *\n * 1. the interactive elected parent client, in which case electedClientId === electedParentId,\n * and the SummaryManager on the elected client will spawn a summarizer client, or\n *\n * 2. the non-interactive summarizer client itself.\n */\n readonly electedClientId: string | undefined;\n\n /** Most recently elected parent client id. This is always an interactive client. */\n readonly electedParentId: string | undefined;\n}\n\n/** Contract for maintaining a deterministic client election based on eligibility. */\nexport interface IOrderedClientElection extends IEventProvider<IOrderedClientElectionEvents> {\n /** Count of eligible clients in the collection. */\n readonly eligibleCount: number;\n\n /**\n * Currently elected client. This is either:\n *\n * 1. the interactive elected parent client, in which case electedClientId === electedParentId,\n * and the SummaryManager on the elected client will spawn a summarizer client, or\n *\n * 2. the non-interactive summarizer client itself.\n */\n readonly electedClient: ITrackedClient | undefined;\n /** Currently elected parent client. This is always an interactive client. */\n readonly electedParent: ITrackedClient | undefined;\n /** Sequence number of most recent election. */\n readonly electionSequenceNumber: number;\n /** Marks the currently elected client as invalid, and elects the next eligible client. */\n incrementElectedClient(sequenceNumber: number): void;\n /** Resets the currently elected client back to the oldest eligible client. */\n resetElectedClient(sequenceNumber: number): void;\n /** Peeks at what the next elected client would be if incrementElectedClient were called. */\n peekNextElectedClient(): ITrackedClient | undefined;\n /** Returns a sorted array of all the eligible clients in the collection. */\n getAllEligibleClients(): ITrackedClient[];\n /** Serialize election data */\n serialize(): ISerializedElection;\n}\n\n/**\n * Adapter for OrderedClientCollection, with the purpose of deterministically maintaining\n * a currently elected client, excluding ineligible clients, in a distributed fashion.\n * This can be true as long as incrementElectedClient and resetElectedClient calls\n * are called under the same conditions for all clients.\n */\nexport class OrderedClientElection\n extends TypedEventEmitter<IOrderedClientElectionEvents>\n implements IOrderedClientElection {\n private _eligibleCount: number = 0;\n private _electedClient: ILinkedClient | undefined;\n private _electedParent: ILinkedClient | undefined;\n private _electionSequenceNumber: number;\n\n public get eligibleCount() {\n return this._eligibleCount;\n }\n public get electionSequenceNumber() {\n return this._electionSequenceNumber;\n }\n\n /**\n * OrderedClientCollection tracks electedClient and electedParent separately. This allows us to handle the case\n * where a new interactive parent client has been elected, but the summarizer is still doing work, so\n * a new summarizer should not yet be spawned. In this case, changing electedParent will cause SummaryManager\n * to stop the current summarizer, but a new summarizer will not be spawned until the old summarizer client has\n * left the quorum.\n *\n * Details:\n *\n * electedParent is the interactive client that has been elected to spawn a summarizer. It is typically the oldest\n * eligible interactive client in the quorum. Only the electedParent is permitted to spawn a summarizer.\n * Once elected, this client will remain the electedParent until it leaves the quorum or the summarizer that\n * it spawned stops producing summaries, at which point a new electedParent will be chosen.\n *\n * electedClient is the non-interactive summarizer client if one exists. If not, then electedClient is equal to\n * electedParent. If electedParent === electedClient, this is the signal for electedParent to spawn a new\n * electedClient. Once a summarizer client becomes electedClient, a new summarizer will not be spawned until\n * electedClient leaves the quorum.\n *\n * A typical sequence looks like this:\n *\n * i. Begin by electing A. electedParent === A, electedClient === A.\n *\n * ii. SummaryManager running on A spawns a summarizer client, A'. electedParent === A, electedClient === A'\n *\n * iii. A' stops producing summaries. A new parent client, B, is elected. electedParent === B, electedClient === A'\n *\n * iv. SummaryManager running on A detects the change to electedParent and tells the summarizer to stop, but A'\n * is in mid-summarization. No new summarizer is spawned, as electedParent !== electedClient.\n *\n * v. A' completes its summary, and the summarizer and backing client are torn down.\n *\n * vi. A' leaves the quorum, and B takes its place as electedClient. electedParent === B, electedClient === B\n *\n * vii. SummaryManager running on B spawns a summarizer client, B'. electedParent === B, electedClient === B'\n */\n public get electedClient() {\n return this._electedClient;\n }\n public get electedParent() {\n return this._electedParent;\n }\n\n constructor(\n logger: ITelemetryLogger,\n private readonly orderedClientCollection: IOrderedClientCollection,\n /** Serialized state from summary or current sequence number at time of load if new. */\n initialState: ISerializedElection | number,\n private readonly isEligibleFn: (c: ITrackedClient) => boolean,\n ) {\n super();\n let initialClient: ILinkedClient | undefined;\n let initialParent: ILinkedClient | undefined;\n for (const client of orderedClientCollection.getAllClients()) {\n this.addClient(client, 0);\n if (typeof initialState !== \"number\") {\n if (client.clientId === initialState.electedClientId) {\n initialClient = client;\n if (initialState.electedParentId === undefined &&\n client.client.details.type !== summarizerClientType) {\n // If there was no elected parent in the serialized data, use this one.\n initialParent = client;\n }\n }\n if (client.clientId === initialState.electedParentId) {\n initialParent = client;\n }\n }\n }\n orderedClientCollection.on(\"addClient\", (client, seq) => this.addClient(client, seq));\n orderedClientCollection.on(\"removeClient\", (client, seq) => this.removeClient(client, seq));\n\n if (typeof initialState === \"number\") {\n this._electionSequenceNumber = initialState;\n } else {\n // Override the initially elected client with the initial state.\n if (initialClient?.clientId !== initialState.electedClientId) {\n // Cannot find initially elected client, so elect undefined.\n logger.sendErrorEvent({\n eventName: \"InitialElectedClientNotFound\",\n electionSequenceNumber: initialState.electionSequenceNumber,\n expectedClientId: initialState.electedClientId,\n electedClientId: initialClient?.clientId,\n clientCount: orderedClientCollection.count,\n });\n } else if (initialClient !== undefined && !isEligibleFn(initialClient)) {\n // Initially elected client is ineligible, so elect next eligible client.\n initialClient = initialParent = this.findFirstEligibleParent(initialParent);\n logger.sendErrorEvent({\n eventName: \"InitialElectedClientIneligible\",\n electionSequenceNumber: initialState.electionSequenceNumber,\n expectedClientId: initialState.electedClientId,\n electedClientId: initialClient?.clientId,\n });\n }\n this._electedParent = initialParent;\n this._electedClient = initialClient;\n this._electionSequenceNumber = initialState.electionSequenceNumber;\n }\n }\n\n /**\n * Tries changing the elected client, raising an event if it is different.\n * Note that this function does no eligibility or suitability checks. If we get here, then\n * we will set _electedClient, and we will set _electedParent if this is an interactive client.\n */\n private tryElectingClient(client: ILinkedClient | undefined, sequenceNumber: number): void {\n let change = false;\n const isSummarizerClient = client?.client.details.type === summarizerClientType;\n const prevClient = this._electedClient;\n if (this._electedClient !== client) {\n // Changing the elected client. Record the sequence number and note that we have to fire an event.\n this._electionSequenceNumber = sequenceNumber;\n this._electedClient = client;\n change = true;\n }\n if (this._electedParent !== client && !isSummarizerClient) {\n // Changing the elected parent as well.\n this._electedParent = client;\n change = true;\n }\n if (change) {\n this.emit(\"election\", client, sequenceNumber, prevClient);\n }\n }\n\n private tryElectingParent(client: ILinkedClient | undefined, sequenceNumber: number): void {\n if (this._electedParent !== client) {\n this._electedParent = client;\n this.emit(\"election\", this._electedClient, sequenceNumber, this._electedClient);\n }\n }\n\n /**\n * Helper function to find the first eligible parent client starting with the passed in client,\n * or undefined if none are eligible.\n * @param client - client to start checking\n * @returns oldest eligible client starting with passed in client or undefined if none.\n */\n private findFirstEligibleParent(client: ILinkedClient | undefined): ILinkedClient | undefined {\n let candidateClient = client;\n while (candidateClient !== undefined &&\n (!this.isEligibleFn(candidateClient) || candidateClient.client.details.type === summarizerClientType)) {\n candidateClient = candidateClient.youngerClient;\n }\n return candidateClient;\n }\n\n /**\n * Updates tracking for when a new client is added to the collection.\n * Will automatically elect that new client if none is elected currently.\n * @param client - client added to the collection\n * @param sequenceNumber - sequence number when client was added\n */\n private addClient(client: ILinkedClient, sequenceNumber: number): void {\n if (this.isEligibleFn(client)) {\n this._eligibleCount++;\n const newClientIsSummarizer = client.client.details.type === summarizerClientType;\n const electedClientIsSummarizer = this._electedClient?.client.details.type === summarizerClientType;\n // Note that we allow a summarizer client to supercede an interactive client as elected client.\n if (this._electedClient === undefined || (!electedClientIsSummarizer && newClientIsSummarizer)) {\n this.tryElectingClient(client, sequenceNumber);\n } else if (this._electedParent === undefined && !newClientIsSummarizer) {\n // This is an odd case. If the _electedClient is set, the _electedParent should be as well.\n this.tryElectingParent(client, sequenceNumber);\n }\n }\n }\n\n /**\n * Updates tracking for when an existing client is removed from the collection.\n * Will automatically elect next oldest client if currently elected is removed.\n * @param client - client removed from the collection\n * @param sequenceNumber - sequence number when client was removed\n */\n private removeClient(client: ILinkedClient, sequenceNumber: number): void {\n if (this.isEligibleFn(client)) {\n this._eligibleCount--;\n if (this._electedClient === client) {\n // Removing the _electedClient. There are 2 possible cases:\n if (this._electedParent !== client) {\n // 1. The _electedClient is a summarizer that we've been allowing to finish its work.\n // Let the _electedParent become the _electedClient so that it can start its own summarizer.\n if (this._electedClient.client.details.type !== summarizerClientType) {\n throw new UsageError(\"Elected client should be a summarizer client 1\");\n }\n this.tryElectingClient(this._electedParent, sequenceNumber);\n } else {\n // 2. The _electedClient is an interactive client that has left the quorum.\n // Automatically shift to next oldest client.\n const nextClient = this.findFirstEligibleParent(this._electedParent?.youngerClient) ??\n this.findFirstEligibleParent(this.orderedClientCollection.oldestClient);\n this.tryElectingClient(nextClient, sequenceNumber);\n }\n } else if (this._electedParent === client) {\n // Removing the _electedParent (but not _electedClient).\n // Shift to the next oldest parent, but do not replace the _electedClient,\n // which is a summarizer that is still doing work.\n if (this._electedClient?.client.details.type !== summarizerClientType) {\n throw new UsageError(\"Elected client should be a summarizer client 2\");\n }\n const nextParent = this.findFirstEligibleParent(this._electedParent?.youngerClient) ??\n this.findFirstEligibleParent(this.orderedClientCollection.oldestClient);\n this.tryElectingParent(nextParent, sequenceNumber);\n }\n }\n }\n\n public getAllEligibleClients(): ITrackedClient[] {\n return this.orderedClientCollection.getAllClients().filter(this.isEligibleFn);\n }\n\n /**\n * Advance election to the next-oldest client. This is called if the current parent is leaving the quorum,\n * or if the current summarizer is not responsive and we want to stop it and spawn a new one.\n */\n public incrementElectedClient(sequenceNumber: number): void {\n const nextClient = this.findFirstEligibleParent(this._electedParent?.youngerClient) ??\n this.findFirstEligibleParent(this.orderedClientCollection.oldestClient);\n if (this._electedClient === undefined || this._electedClient === this._electedParent) {\n this.tryElectingClient(nextClient, sequenceNumber);\n } else {\n // The _electedClient is a summarizer and should not be replaced until it leaves the quorum.\n // Changing the _electedParent will stop the summarizer.\n this.tryElectingParent(nextClient, sequenceNumber);\n }\n }\n\n /**\n * (Re-)start election with the oldest client in the quorum. This is called if we need to summarize\n * and no client has been elected.\n */\n public resetElectedClient(sequenceNumber: number): void {\n const firstClient = this.findFirstEligibleParent(this.orderedClientCollection.oldestClient);\n if (this._electedClient === undefined || this._electedClient === this._electedParent) {\n this.tryElectingClient(firstClient, sequenceNumber);\n } else {\n // The _electedClient is a summarizer and should not be replaced until it leaves the quorum.\n // Changing the _electedParent will stop the summarizer.\n this.tryElectingParent(firstClient, sequenceNumber);\n }\n }\n\n public peekNextElectedClient(): ITrackedClient | undefined {\n return this.findFirstEligibleParent(this._electedParent?.youngerClient) ??\n this.findFirstEligibleParent(this.orderedClientCollection.oldestClient);\n }\n\n public serialize(): ISerializedElection {\n return {\n electionSequenceNumber: this.electionSequenceNumber,\n electedClientId: this.electedClient?.clientId,\n electedParentId: this.electedParent?.clientId,\n };\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"runWhileConnectedCoordinator.d.ts","sourceRoot":"","sources":["../src/runWhileConnectedCoordinator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAA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,CAAC;IACvF,CAAC;IAED;;OAEG;IACI,IAAI,CAAC,MAA4B;QACpC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE;YAClB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;YACvB,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;SACrC;IACL,CAAC;CACJ;AA9ED,oEA8EC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, Deferred } from \"@fluidframework/common-utils\";\nimport { SummarizerStopReason, IConnectableRuntime, ISummaryCancellationToken } from \"./summarizerTypes\";\n\n/* Similar to AbortController, but using promise instead of events */\nexport interface ICancellableSummarizerController extends ISummaryCancellationToken {\n stop(reason: SummarizerStopReason): void;\n}\n\n/**\n * Can be useful in testing as well as in places where caller does not use cancellation.\n * This object implements ISummaryCancellationToken interface but cancellation is never leveraged.\n */\nexport const neverCancelledSummaryToken: ISummaryCancellationToken = {\n cancelled: false,\n waitCancelled: new Promise(() => {}),\n};\n\n/**\n * Helper class to coordinate something that needs to run only while connected.\n * This provides promises that resolve as it starts or stops. Stopping happens\n * when disconnected or if stop() is called.\n */\nexport class RunWhileConnectedCoordinator implements ICancellableSummarizerController {\n private _cancelled = false;\n private readonly stopDeferred = new Deferred<SummarizerStopReason>();\n\n public get cancelled() {\n if (!this._cancelled) {\n assert(this.runtime.deltaManager.active, 0x25d /* \"We should never connect as 'read'\" */);\n\n // This check can't be enabled in current design due to lastSummary flow, where\n // summarizer for closed container stays around and can produce one more summary.\n // Currently we solve the problem of overlapping summarizer by doing wait in\n // SummaryManager.createSummarizer()\n // Better solution would involve these steps:\n // 1. Summarizer selection logic should chose summarizing client (with clientType === \"summarizer\")\n // if such client exists.\n // 2. Summarizer should be updated about such changes (to update onBehalfOfClientId)\n //\n // assert(this.runtime.summarizerClientId === this.onBehalfOfClientId ||\n // this.runtime.summarizerClientId === this.runtime.clientId, \"onBehalfOfClientId\");\n }\n\n return this._cancelled;\n }\n\n /**\n * Returns a promise that resolves once stopped either externally or by disconnect.\n */\n public get waitCancelled(): Promise<SummarizerStopReason> {\n return this.stopDeferred.promise;\n }\n\n public static async create(runtime: IConnectableRuntime) {\n const obj = new RunWhileConnectedCoordinator(runtime);\n await obj.waitStart();\n return obj;\n }\n\n protected constructor(private readonly runtime: IConnectableRuntime) {\n }\n\n /**\n * Starts and waits for a promise which resolves when connected.\n * The promise will also resolve if stopped either externally or by disconnect.\n *\n * We only listen on disconnected event for clientType === \"summarizer\" container!\n * And only do it here - no other place should check it! That way we have only one place\n * that controls policy and it's easy to change policy in the future if we want to!\n * We do not listen for \"main\" (aka interactive) container disconnect here, as it's\n * responsibility of SummaryManager to decide if that's material or not. There are cases\n * like \"lastSummary\", or main client experiencing nacks / disconnects due to hitting limit\n * of non-summarized ops, where can make determination to continue with summary even if main\n * client is disconnected.\n */\n protected async waitStart() {\n if (this.runtime.disposed) {\n this.stop(\"summarizerClientDisconnected\");\n return;\n }\n\n this.runtime.once(\"dispose\", () => this.stop(\"summarizerClientDisconnected\"));\n\n if (!this.runtime.connected) {\n const waitConnected = new Promise<void>((resolve) =>\n this.runtime.once(\"connected\", resolve));\n await Promise.race([waitConnected, this.waitCancelled]);\n }\n this.runtime.once(\"disconnected\", () => this.stop(\"summarizerClientDisconnected\"));\n }\n\n /**\n * Stops running.\n */\n public stop(reason: SummarizerStopReason): void {\n if (!this._cancelled) {\n this._cancelled = true;\n this.stopDeferred.resolve(reason);\n }\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"runningSummarizer.d.ts","sourceRoot":"","sources":["../src/runningSummarizer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAInF,OAAO,EACH,yBAAyB,EAE5B,MAAM,sCAAsC,CAAC;AAE9C,OAAO,EACH,qBAAqB,EACxB,MAAM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