@fluidframework/container-runtime 2.0.0-internal.3.1.0 → 2.0.0-internal.3.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/blobManager.d.ts +6 -0
- package/dist/blobManager.d.ts.map +1 -1
- package/dist/blobManager.js +31 -6
- package/dist/blobManager.js.map +1 -1
- package/dist/containerRuntime.d.ts +17 -15
- package/dist/containerRuntime.d.ts.map +1 -1
- package/dist/containerRuntime.js +158 -121
- package/dist/containerRuntime.js.map +1 -1
- package/dist/dataStoreContext.d.ts +21 -12
- package/dist/dataStoreContext.d.ts.map +1 -1
- package/dist/dataStoreContext.js +76 -50
- package/dist/dataStoreContext.js.map +1 -1
- package/dist/dataStores.d.ts +9 -10
- package/dist/dataStores.d.ts.map +1 -1
- package/dist/dataStores.js +42 -49
- package/dist/dataStores.js.map +1 -1
- package/dist/{garbageCollection.d.ts → gc/garbageCollection.d.ts} +5 -200
- package/dist/gc/garbageCollection.d.ts.map +1 -0
- package/dist/{garbageCollection.js → gc/garbageCollection.js} +77 -353
- 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} +24 -2
- package/dist/gc/gcDefinitions.js.map +1 -0
- package/{lib/garbageCollectionHelpers.d.ts → dist/gc/gcHelpers.d.ts} +5 -1
- package/dist/gc/gcHelpers.d.ts.map +1 -0
- package/dist/{garbageCollectionHelpers.js → gc/gcHelpers.js} +27 -7
- 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/dist/gc/gcSweepReadyUsageDetection.d.ts.map +1 -0
- package/dist/{gcSweepReadyUsageDetection.js → gc/gcSweepReadyUsageDetection.js} +2 -2
- 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 +7 -36
- 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/opCompressor.d.ts.map +1 -1
- package/dist/opLifecycle/opCompressor.js +1 -0
- package/dist/opLifecycle/opCompressor.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 +20 -12
- 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 +59 -28
- package/dist/opLifecycle/outbox.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 +1 -2
- package/dist/pendingStateManager.d.ts.map +1 -1
- package/dist/pendingStateManager.js +14 -9
- package/dist/pendingStateManager.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/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} +158 -56
- package/dist/summary/runningSummarizer.js.map +1 -0
- package/dist/{summarizer.d.ts → summary/summarizer.d.ts} +2 -4
- package/dist/summary/summarizer.d.ts.map +1 -0
- package/dist/{summarizer.js → summary/summarizer.js} +1 -61
- 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/dist/{summarizerHeuristics.d.ts → summary/summarizerHeuristics.d.ts} +1 -1
- package/dist/summary/summarizerHeuristics.d.ts.map +1 -0
- package/dist/summary/summarizerHeuristics.js.map +1 -0
- package/{lib → dist/summary}/summarizerTypes.d.ts +1 -1
- 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/summary/summaryCollection.js.map +1 -0
- package/{lib → dist/summary}/summaryFormat.d.ts +1 -43
- package/dist/summary/summaryFormat.d.ts.map +1 -0
- package/dist/{summaryFormat.js → summary/summaryFormat.js} +1 -10
- package/dist/summary/summaryFormat.js.map +1 -0
- package/dist/summary/summaryGenerator.d.ts.map +1 -0
- package/dist/{summaryGenerator.js → summary/summaryGenerator.js} +1 -2
- 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/summary/summaryManager.js.map +1 -0
- package/lib/blobManager.d.ts +6 -0
- package/lib/blobManager.d.ts.map +1 -1
- package/lib/blobManager.js +28 -3
- package/lib/blobManager.js.map +1 -1
- package/lib/containerRuntime.d.ts +17 -15
- package/lib/containerRuntime.d.ts.map +1 -1
- package/lib/containerRuntime.js +127 -90
- package/lib/containerRuntime.js.map +1 -1
- package/lib/dataStoreContext.d.ts +21 -12
- package/lib/dataStoreContext.d.ts.map +1 -1
- package/lib/dataStoreContext.js +64 -38
- package/lib/dataStoreContext.js.map +1 -1
- package/lib/dataStores.d.ts +9 -10
- package/lib/dataStores.d.ts.map +1 -1
- package/lib/dataStores.js +33 -40
- package/lib/dataStores.js.map +1 -1
- package/lib/{garbageCollection.d.ts → gc/garbageCollection.d.ts} +5 -200
- package/lib/gc/garbageCollection.d.ts.map +1 -0
- package/lib/{garbageCollection.js → gc/garbageCollection.js} +44 -319
- 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} +23 -1
- package/lib/gc/gcDefinitions.js.map +1 -0
- package/{dist/garbageCollectionHelpers.d.ts → lib/gc/gcHelpers.d.ts} +5 -1
- package/lib/gc/gcHelpers.d.ts.map +1 -0
- package/lib/{garbageCollectionHelpers.js → gc/gcHelpers.js} +20 -2
- 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/lib/gc/gcSweepReadyUsageDetection.d.ts.map +1 -0
- package/lib/{gcSweepReadyUsageDetection.js → gc/gcSweepReadyUsageDetection.js} +1 -1
- 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 +7 -36
- 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/opCompressor.d.ts.map +1 -1
- package/lib/opLifecycle/opCompressor.js +1 -0
- package/lib/opLifecycle/opCompressor.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 +20 -12
- 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 +60 -29
- package/lib/opLifecycle/outbox.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 +1 -2
- package/lib/pendingStateManager.d.ts.map +1 -1
- package/lib/pendingStateManager.js +14 -9
- package/lib/pendingStateManager.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/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} +159 -57
- package/lib/summary/runningSummarizer.js.map +1 -0
- package/lib/{summarizer.d.ts → summary/summarizer.d.ts} +2 -4
- package/lib/summary/summarizer.d.ts.map +1 -0
- package/lib/{summarizer.js → summary/summarizer.js} +3 -63
- 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/lib/{summarizerHeuristics.d.ts → summary/summarizerHeuristics.d.ts} +1 -1
- package/lib/summary/summarizerHeuristics.d.ts.map +1 -0
- package/lib/summary/summarizerHeuristics.js.map +1 -0
- package/{dist → lib/summary}/summarizerTypes.d.ts +1 -1
- 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/summary/summaryCollection.js.map +1 -0
- package/{dist → lib/summary}/summaryFormat.d.ts +1 -43
- package/lib/summary/summaryFormat.d.ts.map +1 -0
- package/lib/{summaryFormat.js → summary/summaryFormat.js} +0 -8
- package/lib/summary/summaryFormat.js.map +1 -0
- package/lib/summary/summaryGenerator.d.ts.map +1 -0
- package/lib/{summaryGenerator.js → summary/summaryGenerator.js} +1 -2
- 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/summary/summaryManager.js.map +1 -0
- package/package.json +125 -122
- package/src/blobManager.ts +33 -3
- package/src/containerRuntime.ts +178 -106
- package/src/dataStoreContext.ts +90 -49
- package/src/dataStores.ts +44 -51
- package/{garbageCollection.md → src/gc/garbageCollection.md} +2 -2
- package/src/{garbageCollection.ts → gc/garbageCollection.ts} +90 -560
- package/src/gc/gcDefinitions.ts +244 -0
- package/src/{garbageCollectionHelpers.ts → gc/gcHelpers.ts} +26 -1
- package/src/gc/gcSummaryStateTracker.ts +339 -0
- package/src/{gcSweepReadyUsageDetection.ts → gc/gcSweepReadyUsageDetection.ts} +1 -1
- package/src/gc/gcUnreferencedStateTracker.ts +114 -0
- package/src/gc/index.ts +40 -0
- package/src/index.ts +10 -14
- package/src/opLifecycle/batchManager.ts +7 -54
- package/src/opLifecycle/definitions.ts +4 -0
- package/src/opLifecycle/opCompressor.ts +1 -0
- package/src/opLifecycle/opSplitter.ts +33 -14
- package/src/opLifecycle/outbox.ts +84 -38
- package/src/packageVersion.ts +1 -1
- package/src/pendingStateManager.ts +26 -14
- package/src/summary/index.ts +99 -0
- package/src/{runningSummarizer.ts → summary/runningSummarizer.ts} +279 -139
- package/src/{summarizer.ts → summary/summarizer.ts} +5 -76
- package/src/{summarizerHeuristics.ts → summary/summarizerHeuristics.ts} +1 -1
- package/src/{summarizerTypes.ts → summary/summarizerTypes.ts} +1 -1
- package/src/{summaryFormat.ts → summary/summaryFormat.ts} +1 -53
- package/src/{summaryGenerator.ts → summary/summaryGenerator.ts} +9 -9
- package/src/{summaryManager.ts → summary/summaryManager.ts} +1 -1
- package/dist/garbageCollection.d.ts.map +0 -1
- package/dist/garbageCollection.js.map +0 -1
- package/dist/garbageCollectionConstants.d.ts +0 -26
- package/dist/garbageCollectionConstants.d.ts.map +0 -1
- package/dist/garbageCollectionConstants.js.map +0 -1
- package/dist/garbageCollectionHelpers.d.ts.map +0 -1
- package/dist/garbageCollectionHelpers.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 -26
- package/lib/garbageCollectionConstants.d.ts.map +0 -1
- package/lib/garbageCollectionConstants.js.map +0 -1
- package/lib/garbageCollectionHelpers.d.ts.map +0 -1
- package/lib/garbageCollectionHelpers.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/garbageCollectionConstants.ts +0 -44
- /package/dist/{gcSweepReadyUsageDetection.d.ts → gc/gcSweepReadyUsageDetection.d.ts} +0 -0
- /package/dist/{orderedClientElection.d.ts → summary/orderedClientElection.d.ts} +0 -0
- /package/dist/{orderedClientElection.js → summary/orderedClientElection.js} +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/{summarizerHeuristics.js → summary/summarizerHeuristics.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/{summaryCollection.js → summary/summaryCollection.js} +0 -0
- /package/dist/{summaryGenerator.d.ts → summary/summaryGenerator.d.ts} +0 -0
- /package/dist/{summaryManager.js → summary/summaryManager.js} +0 -0
- /package/lib/{gcSweepReadyUsageDetection.d.ts → gc/gcSweepReadyUsageDetection.d.ts} +0 -0
- /package/lib/{orderedClientElection.d.ts → summary/orderedClientElection.d.ts} +0 -0
- /package/lib/{orderedClientElection.js → summary/orderedClientElection.js} +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/{summarizerHeuristics.js → summary/summarizerHeuristics.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/{summaryCollection.js → summary/summaryCollection.js} +0 -0
- /package/lib/{summaryGenerator.d.ts → summary/summaryGenerator.d.ts} +0 -0
- /package/lib/{summaryManager.js → summary/summaryManager.js} +0 -0
- /package/src/{orderedClientElection.ts → summary/orderedClientElection.ts} +0 -0
- /package/src/{runWhileConnectedCoordinator.ts → summary/runWhileConnectedCoordinator.ts} +0 -0
- /package/src/{summarizerClientElection.ts → summary/summarizerClientElection.ts} +0 -0
- /package/src/{summarizerHandle.ts → summary/summarizerHandle.ts} +0 -0
- /package/src/{summaryCollection.ts → summary/summaryCollection.ts} +0 -0
|
@@ -15,108 +15,21 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
15
15
|
return t;
|
|
16
16
|
};
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.GarbageCollector =
|
|
18
|
+
exports.GarbageCollector = void 0;
|
|
19
19
|
const common_utils_1 = require("@fluidframework/common-utils");
|
|
20
20
|
const container_utils_1 = require("@fluidframework/container-utils");
|
|
21
21
|
const garbage_collector_1 = require("@fluidframework/garbage-collector");
|
|
22
|
-
const protocol_definitions_1 = require("@fluidframework/protocol-definitions");
|
|
23
22
|
const runtime_definitions_1 = require("@fluidframework/runtime-definitions");
|
|
24
23
|
const runtime_utils_1 = require("@fluidframework/runtime-utils");
|
|
25
24
|
const telemetry_utils_1 = require("@fluidframework/telemetry-utils");
|
|
26
|
-
const containerRuntime_1 = require("
|
|
27
|
-
const dataStores_1 = require("
|
|
28
|
-
const
|
|
29
|
-
const
|
|
25
|
+
const containerRuntime_1 = require("../containerRuntime");
|
|
26
|
+
const dataStores_1 = require("../dataStores");
|
|
27
|
+
const summary_1 = require("../summary");
|
|
28
|
+
const gcDefinitions_1 = require("./gcDefinitions");
|
|
29
|
+
const gcHelpers_1 = require("./gcHelpers");
|
|
30
|
+
const gcSummaryStateTracker_1 = require("./gcSummaryStateTracker");
|
|
30
31
|
const gcSweepReadyUsageDetection_1 = require("./gcSweepReadyUsageDetection");
|
|
31
|
-
const
|
|
32
|
-
/** The types of GC nodes in the GC reference graph. */
|
|
33
|
-
exports.GCNodeType = {
|
|
34
|
-
// Nodes that are for data stores.
|
|
35
|
-
DataStore: "DataStore",
|
|
36
|
-
// Nodes that are within a data store. For example, DDS nodes.
|
|
37
|
-
SubDataStore: "SubDataStore",
|
|
38
|
-
// Nodes that are for attachment blobs, i.e., blobs uploaded via BlobManager.
|
|
39
|
-
Blob: "Blob",
|
|
40
|
-
// Nodes that are neither of the above. For example, root node.
|
|
41
|
-
Other: "Other",
|
|
42
|
-
};
|
|
43
|
-
/** The state of node that is unreferenced. */
|
|
44
|
-
exports.UnreferencedState = {
|
|
45
|
-
/** The node is active, i.e., it can become referenced again. */
|
|
46
|
-
Active: "Active",
|
|
47
|
-
/** The node is inactive, i.e., it should not become referenced. */
|
|
48
|
-
Inactive: "Inactive",
|
|
49
|
-
/** The node is ready to be deleted by the sweep phase. */
|
|
50
|
-
SweepReady: "SweepReady",
|
|
51
|
-
};
|
|
52
|
-
/**
|
|
53
|
-
* Helper class that tracks the state of an unreferenced node such as the time it was unreferenced and if it can
|
|
54
|
-
* be deleted by the sweep phase.
|
|
55
|
-
*/
|
|
56
|
-
class UnreferencedStateTracker {
|
|
57
|
-
constructor(unreferencedTimestampMs,
|
|
58
|
-
/** The time after which node transitions to Inactive state. */
|
|
59
|
-
inactiveTimeoutMs,
|
|
60
|
-
/** The current reference timestamp used to track how long this node has been unreferenced for. */
|
|
61
|
-
currentReferenceTimestampMs,
|
|
62
|
-
/** The time after which node transitions to SweepReady state; undefined if session expiry is disabled. */
|
|
63
|
-
sweepTimeoutMs) {
|
|
64
|
-
this.unreferencedTimestampMs = unreferencedTimestampMs;
|
|
65
|
-
this.inactiveTimeoutMs = inactiveTimeoutMs;
|
|
66
|
-
this.sweepTimeoutMs = sweepTimeoutMs;
|
|
67
|
-
this._state = exports.UnreferencedState.Active;
|
|
68
|
-
if (this.sweepTimeoutMs !== undefined) {
|
|
69
|
-
(0, common_utils_1.assert)(this.inactiveTimeoutMs <= this.sweepTimeoutMs, 0x3b0 /* inactive timeout must not be greater than the sweep timeout */);
|
|
70
|
-
}
|
|
71
|
-
this.sweepTimer = new TimerWithNoDefaultTimeout(() => {
|
|
72
|
-
this._state = exports.UnreferencedState.SweepReady;
|
|
73
|
-
(0, common_utils_1.assert)(!this.inactiveTimer.hasTimer, 0x3b1 /* inactiveTimer still running after sweepTimer fired! */);
|
|
74
|
-
});
|
|
75
|
-
this.inactiveTimer = new TimerWithNoDefaultTimeout(() => {
|
|
76
|
-
this._state = exports.UnreferencedState.Inactive;
|
|
77
|
-
// After the node becomes inactive, start the sweep timer after which the node will be ready for sweep.
|
|
78
|
-
if (this.sweepTimeoutMs !== undefined) {
|
|
79
|
-
this.sweepTimer.restart(this.sweepTimeoutMs - this.inactiveTimeoutMs);
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
this.updateTracking(currentReferenceTimestampMs);
|
|
83
|
-
}
|
|
84
|
-
get state() {
|
|
85
|
-
return this._state;
|
|
86
|
-
}
|
|
87
|
-
/* Updates the unreferenced state based on the provided timestamp. */
|
|
88
|
-
updateTracking(currentReferenceTimestampMs) {
|
|
89
|
-
const unreferencedDurationMs = currentReferenceTimestampMs - this.unreferencedTimestampMs;
|
|
90
|
-
// If the node has been unreferenced for sweep timeout amount of time, update the state to SweepReady.
|
|
91
|
-
if (this.sweepTimeoutMs !== undefined && unreferencedDurationMs >= this.sweepTimeoutMs) {
|
|
92
|
-
this._state = exports.UnreferencedState.SweepReady;
|
|
93
|
-
this.clearTimers();
|
|
94
|
-
return;
|
|
95
|
-
}
|
|
96
|
-
// If the node has been unreferenced for inactive timeoutMs amount of time, update the state to inactive.
|
|
97
|
-
// Also, start a timer for the sweep timeout.
|
|
98
|
-
if (unreferencedDurationMs >= this.inactiveTimeoutMs) {
|
|
99
|
-
this._state = exports.UnreferencedState.Inactive;
|
|
100
|
-
this.inactiveTimer.clear();
|
|
101
|
-
if (this.sweepTimeoutMs !== undefined) {
|
|
102
|
-
this.sweepTimer.restart(this.sweepTimeoutMs - unreferencedDurationMs);
|
|
103
|
-
}
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
// The node is still active. Ensure the inactive timer is running with the proper remaining duration.
|
|
107
|
-
this.inactiveTimer.restart(this.inactiveTimeoutMs - unreferencedDurationMs);
|
|
108
|
-
}
|
|
109
|
-
clearTimers() {
|
|
110
|
-
this.inactiveTimer.clear();
|
|
111
|
-
this.sweepTimer.clear();
|
|
112
|
-
}
|
|
113
|
-
/** Stop tracking this node. Reset the unreferenced timers and state, if any. */
|
|
114
|
-
stopTracking() {
|
|
115
|
-
this.clearTimers();
|
|
116
|
-
this._state = exports.UnreferencedState.Active;
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
exports.UnreferencedStateTracker = UnreferencedStateTracker;
|
|
32
|
+
const gcUnreferencedStateTracker_1 = require("./gcUnreferencedStateTracker");
|
|
120
33
|
/**
|
|
121
34
|
* The garbage collector for the container runtime. It consolidates the garbage collection functionality and maintains
|
|
122
35
|
* its state across summaries.
|
|
@@ -171,13 +84,8 @@ class GarbageCollector {
|
|
|
171
84
|
this.mc = (0, telemetry_utils_1.loggerToMonitoringContext)(telemetry_utils_1.ChildLogger.create(createParams.baseLogger, "GarbageCollector", {
|
|
172
85
|
all: { completedGCRuns: () => this.completedRuns },
|
|
173
86
|
}));
|
|
174
|
-
// If version upgrade is not enabled, fall back to the stable GC version.
|
|
175
|
-
this.currentGCVersion =
|
|
176
|
-
this.mc.config.getBoolean(garbageCollectionConstants_1.gcVersionUpgradeToV2Key) === true
|
|
177
|
-
? garbageCollectionConstants_1.currentGCVersion
|
|
178
|
-
: garbageCollectionConstants_1.stableGCVersion;
|
|
179
87
|
this.sweepReadyUsageHandler = new gcSweepReadyUsageDetection_1.SweepReadyUsageDetectionHandler(createParams.getContainerDiagnosticId(), this.mc, this.runtime.closeFn);
|
|
180
|
-
let
|
|
88
|
+
let gcVersionInBaseSnapshot;
|
|
181
89
|
/**
|
|
182
90
|
* Sweep timeout is the time after which unreferenced content can be swept.
|
|
183
91
|
* Sweep timeout = session expiry timeout + snapshot cache expiry timeout + one day buffer.
|
|
@@ -187,8 +95,8 @@ class GarbageCollector {
|
|
|
187
95
|
* We use server timestamps throughout so the skew should be minimal but make it 1 day to be safe.
|
|
188
96
|
*/
|
|
189
97
|
function computeSweepTimeout(sessionExpiryTimeoutMs) {
|
|
190
|
-
const maxSnapshotCacheExpiryMs = 5 *
|
|
191
|
-
const bufferMs =
|
|
98
|
+
const maxSnapshotCacheExpiryMs = 5 * gcDefinitions_1.oneDayMs;
|
|
99
|
+
const bufferMs = gcDefinitions_1.oneDayMs;
|
|
192
100
|
return (sessionExpiryTimeoutMs &&
|
|
193
101
|
sessionExpiryTimeoutMs + maxSnapshotCacheExpiryMs + bufferMs);
|
|
194
102
|
}
|
|
@@ -200,10 +108,10 @@ class GarbageCollector {
|
|
|
200
108
|
* For existing containers, we get this information from the metadata blob of its summary.
|
|
201
109
|
*/
|
|
202
110
|
if (createParams.existing) {
|
|
203
|
-
|
|
111
|
+
gcVersionInBaseSnapshot = (0, gcHelpers_1.getGCVersion)(metadata);
|
|
204
112
|
// Existing documents which did not have metadata blob or had GC disabled have version as 0. For all
|
|
205
113
|
// other existing documents, GC is enabled.
|
|
206
|
-
this.gcEnabled =
|
|
114
|
+
this.gcEnabled = gcVersionInBaseSnapshot > 0;
|
|
207
115
|
this.sweepEnabled = (_a = metadata === null || metadata === void 0 ? void 0 : metadata.sweepEnabled) !== null && _a !== void 0 ? _a : false;
|
|
208
116
|
this.sessionExpiryTimeoutMs = metadata === null || metadata === void 0 ? void 0 : metadata.sessionExpiryTimeoutMs;
|
|
209
117
|
this.sweepTimeoutMs =
|
|
@@ -224,15 +132,15 @@ class GarbageCollector {
|
|
|
224
132
|
// The sweep phase has to be explicitly enabled by setting the sweepAllowed flag in GC options to true.
|
|
225
133
|
this.sweepEnabled = this.gcOptions.sweepAllowed === true;
|
|
226
134
|
// Set the Session Expiry only if the flag is enabled and GC is enabled.
|
|
227
|
-
if (this.mc.config.getBoolean(
|
|
135
|
+
if (this.mc.config.getBoolean(gcDefinitions_1.runSessionExpiryKey) && this.gcEnabled) {
|
|
228
136
|
this.sessionExpiryTimeoutMs =
|
|
229
|
-
(_c = this.gcOptions.sessionExpiryTimeoutMs) !== null && _c !== void 0 ? _c :
|
|
137
|
+
(_c = this.gcOptions.sessionExpiryTimeoutMs) !== null && _c !== void 0 ? _c : gcDefinitions_1.defaultSessionExpiryDurationMs;
|
|
230
138
|
}
|
|
231
139
|
this.sweepTimeoutMs =
|
|
232
140
|
testOverrideSweepTimeoutMs !== null && testOverrideSweepTimeoutMs !== void 0 ? testOverrideSweepTimeoutMs : computeSweepTimeout(this.sessionExpiryTimeoutMs);
|
|
233
|
-
if (this.gcOptions[
|
|
141
|
+
if (this.gcOptions[gcDefinitions_1.gcTombstoneGenerationOptionName] !== undefined) {
|
|
234
142
|
this.persistedGcFeatureMatrix = {
|
|
235
|
-
tombstoneGeneration: this.gcOptions[
|
|
143
|
+
tombstoneGeneration: this.gcOptions[gcDefinitions_1.gcTombstoneGenerationOptionName],
|
|
236
144
|
};
|
|
237
145
|
}
|
|
238
146
|
}
|
|
@@ -246,9 +154,6 @@ class GarbageCollector {
|
|
|
246
154
|
});
|
|
247
155
|
this.sessionExpiryTimer.start();
|
|
248
156
|
}
|
|
249
|
-
// For existing document, the latest summary is the one that we loaded from. So, use its GC version as the
|
|
250
|
-
// latest tracked GC version. For new documents, we will be writing the first summary with the current version.
|
|
251
|
-
this.latestSummaryGCVersion = prevSummaryGCVersion !== null && prevSummaryGCVersion !== void 0 ? prevSummaryGCVersion : this.currentGCVersion;
|
|
252
157
|
/**
|
|
253
158
|
* Whether GC should run or not. The following conditions have to be met to run sweep:
|
|
254
159
|
*
|
|
@@ -259,7 +164,7 @@ class GarbageCollector {
|
|
|
259
164
|
* These conditions can be overridden via runGCKey feature flag.
|
|
260
165
|
*/
|
|
261
166
|
this.shouldRunGC =
|
|
262
|
-
(_d = this.mc.config.getBoolean(
|
|
167
|
+
(_d = this.mc.config.getBoolean(gcDefinitions_1.runGCKey)) !== null && _d !== void 0 ? _d :
|
|
263
168
|
// GC must be enabled for the document.
|
|
264
169
|
(this.gcEnabled &&
|
|
265
170
|
// GC must not be disabled via GC options.
|
|
@@ -277,24 +182,23 @@ class GarbageCollector {
|
|
|
277
182
|
this.shouldRunSweep =
|
|
278
183
|
this.shouldRunGC &&
|
|
279
184
|
this.sweepTimeoutMs !== undefined &&
|
|
280
|
-
((_e = this.mc.config.getBoolean(
|
|
281
|
-
this.trackGCState = this.mc.config.getBoolean(
|
|
185
|
+
((_e = this.mc.config.getBoolean(gcDefinitions_1.runSweepKey)) !== null && _e !== void 0 ? _e : this.sweepEnabled);
|
|
186
|
+
this.trackGCState = this.mc.config.getBoolean(gcDefinitions_1.trackGCStateKey) === true;
|
|
282
187
|
// Override inactive timeout if test config or gc options to override it is set.
|
|
283
188
|
this.inactiveTimeoutMs =
|
|
284
|
-
(_g = (_f = this.mc.config.getNumber("Fluid.GarbageCollection.TestOverride.InactiveTimeoutMs")) !== null && _f !== void 0 ? _f : this.gcOptions.inactiveTimeoutMs) !== null && _g !== void 0 ? _g :
|
|
189
|
+
(_g = (_f = this.mc.config.getNumber("Fluid.GarbageCollection.TestOverride.InactiveTimeoutMs")) !== null && _f !== void 0 ? _f : this.gcOptions.inactiveTimeoutMs) !== null && _g !== void 0 ? _g : gcDefinitions_1.defaultInactiveTimeoutMs;
|
|
285
190
|
// Inactive timeout must be greater than sweep timeout since a node goes from active -> inactive -> sweep ready.
|
|
286
191
|
if (this.sweepTimeoutMs !== undefined && this.inactiveTimeoutMs > this.sweepTimeoutMs) {
|
|
287
192
|
throw new container_utils_1.UsageError("inactive timeout should not be greater than the sweep timeout");
|
|
288
193
|
}
|
|
289
194
|
// Whether we are running in test mode. In this mode, unreferenced nodes are immediately deleted.
|
|
290
195
|
this.testMode =
|
|
291
|
-
(_h = this.mc.config.getBoolean(
|
|
196
|
+
(_h = this.mc.config.getBoolean(gcDefinitions_1.gcTestModeKey)) !== null && _h !== void 0 ? _h : this.gcOptions.runGCInTestMode === true;
|
|
292
197
|
// Whether we are running in tombstone mode. This is enabled by default if sweep won't run. It can be disabled
|
|
293
198
|
// via feature flags.
|
|
294
199
|
this.tombstoneMode =
|
|
295
|
-
!this.shouldRunSweep && this.mc.config.getBoolean(
|
|
296
|
-
|
|
297
|
-
this.wasGCRunInLatestSummary = (baseSnapshot === null || baseSnapshot === void 0 ? void 0 : baseSnapshot.trees[runtime_definitions_1.gcTreeKey]) !== undefined;
|
|
200
|
+
!this.shouldRunSweep && this.mc.config.getBoolean(gcDefinitions_1.disableTombstoneKey) !== true;
|
|
201
|
+
this.summaryStateTracker = new gcSummaryStateTracker_1.GCSummaryStateTracker(this.shouldRunGC, this.trackGCState, this.tombstoneMode, this.mc, (baseSnapshot === null || baseSnapshot === void 0 ? void 0 : baseSnapshot.trees[runtime_definitions_1.gcTreeKey]) !== undefined /* wasGCRunInBaseSnapshot */, gcVersionInBaseSnapshot);
|
|
298
202
|
// Get the GC data from the base snapshot. Use LazyPromise because we only want to do this once since it
|
|
299
203
|
// it involves fetching blobs from storage which is expensive.
|
|
300
204
|
this.baseSnapshotDataP = new common_utils_1.LazyPromise(async () => {
|
|
@@ -329,7 +233,7 @@ class GarbageCollector {
|
|
|
329
233
|
const dsRootId = `/${dsId}`;
|
|
330
234
|
// Since we used to write GC data at data store level, we won't have an entry for the root ("/").
|
|
331
235
|
// Construct that entry by adding root data store ids to its outbound routes.
|
|
332
|
-
const initialSnapshotDetails = await readAndParseBlob(dsSnapshotTree.blobs[
|
|
236
|
+
const initialSnapshotDetails = await readAndParseBlob(dsSnapshotTree.blobs[summary_1.dataStoreAttributesBlobName]);
|
|
333
237
|
if (initialSnapshotDetails.isRootDataStore) {
|
|
334
238
|
gcState.gcNodes["/"].outboundRoutes.push(dsRootId);
|
|
335
239
|
}
|
|
@@ -421,46 +325,13 @@ class GarbageCollector {
|
|
|
421
325
|
static create(createParams) {
|
|
422
326
|
return new GarbageCollector(createParams);
|
|
423
327
|
}
|
|
424
|
-
/**
|
|
425
|
-
* Tells whether the GC state needs to be reset in the next summary. We need to do this if:
|
|
426
|
-
*
|
|
427
|
-
* 1. GC was enabled and is now disabled. The GC state needs to be removed and everything becomes referenced.
|
|
428
|
-
*
|
|
429
|
-
* 2. GC was disabled and is now enabled. The GC state needs to be regenerated and added to summary.
|
|
430
|
-
*
|
|
431
|
-
* 3. GC is enabled and the latest summary state is refreshed from a snapshot that had GC disabled and vice-versa.
|
|
432
|
-
*
|
|
433
|
-
* 4. The GC version in the latest summary is different from the current GC version. This can happen if:
|
|
434
|
-
*
|
|
435
|
-
* 4.1. The summary this client loaded with has data from a different GC version.
|
|
436
|
-
*
|
|
437
|
-
* 4.2. This client's latest summary was updated from a snapshot that has a different GC version.
|
|
438
|
-
*/
|
|
439
|
-
get summaryStateNeedsReset() {
|
|
440
|
-
return (this.gcStateNeedsReset ||
|
|
441
|
-
(this.shouldRunGC && this.latestSummaryGCVersion !== this.currentGCVersion));
|
|
442
|
-
}
|
|
443
|
-
/**
|
|
444
|
-
* Tells whether the GC state needs to be reset. This can happen under 3 conditions:
|
|
445
|
-
*
|
|
446
|
-
* 1. The base snapshot contains GC state but GC is disabled. This will happen the first time GC is disabled after
|
|
447
|
-
* it was enabled before. GC state needs to be removed from summary and all nodes should be marked referenced.
|
|
448
|
-
*
|
|
449
|
-
* 2. The base snapshot does not have GC state but GC is enabled. This will happen the very first time GC runs on
|
|
450
|
-
* a document and the first time GC is enabled after is was disabled before.
|
|
451
|
-
*
|
|
452
|
-
* 3. GC is enabled and the latest summary state is refreshed from a snapshot that had GC disabled and vice-versa.
|
|
453
|
-
*
|
|
454
|
-
* Note that the state will be reset only once for the first summary generated after this returns true. After that,
|
|
455
|
-
* this will return false.
|
|
456
|
-
*/
|
|
457
|
-
get gcStateNeedsReset() {
|
|
458
|
-
return this.wasGCRunInLatestSummary !== this.shouldRunGC;
|
|
459
|
-
}
|
|
460
328
|
/** Returns a list of all the configurations for garbage collection. */
|
|
461
329
|
get configs() {
|
|
462
330
|
return Object.assign({ gcEnabled: this.gcEnabled, sweepEnabled: this.sweepEnabled, runGC: this.shouldRunGC, runSweep: this.shouldRunSweep, testMode: this.testMode, tombstoneMode: this.tombstoneMode, sessionExpiry: this.sessionExpiryTimeoutMs, sweepTimeout: this.sweepTimeoutMs, inactiveTimeout: this.inactiveTimeoutMs, trackGCState: this.trackGCState }, this.gcOptions);
|
|
463
331
|
}
|
|
332
|
+
get summaryStateNeedsReset() {
|
|
333
|
+
return this.summaryStateTracker.doesSummaryStateNeedReset();
|
|
334
|
+
}
|
|
464
335
|
/**
|
|
465
336
|
* Called during container initialization. Initialize from the tombstone state in the base snapshot. This is done
|
|
466
337
|
* during initialization so that deleted or tombstoned objects are marked as such before they are loaded or used.
|
|
@@ -542,10 +413,11 @@ class GarbageCollector {
|
|
|
542
413
|
this.tombstones = (snapshotData === null || snapshotData === void 0 ? void 0 : snapshotData.tombstones) ? Array.from(snapshotData.tombstones) : [];
|
|
543
414
|
this.runtime.updateTombstonedRoutes(this.tombstones);
|
|
544
415
|
}
|
|
416
|
+
// Update the summary state tracker's state from this snapshot.
|
|
417
|
+
this.summaryStateTracker.updateStateFromSnapshotData(snapshotData);
|
|
545
418
|
// If there is no snapshot data, it means this snapshot was generated with GC disabled. Unset all GC state.
|
|
546
419
|
if (snapshotData === undefined) {
|
|
547
420
|
this.gcDataFromLastRun = undefined;
|
|
548
|
-
this.latestSummaryData = undefined;
|
|
549
421
|
return;
|
|
550
422
|
}
|
|
551
423
|
// Update unreferenced state tracking as per the GC state in the snapshot data and update gcDataFromLastRun
|
|
@@ -553,19 +425,11 @@ class GarbageCollector {
|
|
|
553
425
|
const gcNodes = {};
|
|
554
426
|
for (const [nodeId, nodeData] of Object.entries(snapshotData.gcState.gcNodes)) {
|
|
555
427
|
if (nodeData.unreferencedTimestampMs !== undefined) {
|
|
556
|
-
this.unreferencedNodesState.set(nodeId, new UnreferencedStateTracker(nodeData.unreferencedTimestampMs, this.inactiveTimeoutMs, currentReferenceTimestampMs, this.sweepTimeoutMs));
|
|
428
|
+
this.unreferencedNodesState.set(nodeId, new gcUnreferencedStateTracker_1.UnreferencedStateTracker(nodeData.unreferencedTimestampMs, this.inactiveTimeoutMs, currentReferenceTimestampMs, this.sweepTimeoutMs));
|
|
557
429
|
}
|
|
558
430
|
gcNodes[nodeId] = Array.from(nodeData.outboundRoutes);
|
|
559
431
|
}
|
|
560
432
|
this.gcDataFromLastRun = { gcNodes };
|
|
561
|
-
// If tracking state across summaries, update latest summary data from the snapshot's GC data.
|
|
562
|
-
if (this.trackGCState) {
|
|
563
|
-
this.latestSummaryData = {
|
|
564
|
-
serializedGCState: JSON.stringify(generateSortedGCState(snapshotData.gcState)),
|
|
565
|
-
serializedTombstones: JSON.stringify(snapshotData.tombstones),
|
|
566
|
-
serializedDeletedNodes: JSON.stringify(snapshotData.deletedNodes),
|
|
567
|
-
};
|
|
568
|
-
}
|
|
569
433
|
}
|
|
570
434
|
/**
|
|
571
435
|
* Called when the connection state of the runtime changes, i.e., it connects or disconnects. GC subscribes to this
|
|
@@ -595,9 +459,10 @@ class GarbageCollector {
|
|
|
595
459
|
* Runs garbage collection and updates the reference / used state of the nodes in the container.
|
|
596
460
|
* @returns stats of the GC run or undefined if GC did not run.
|
|
597
461
|
*/
|
|
598
|
-
async collectGarbage(options) {
|
|
462
|
+
async collectGarbage(options, telemetryContext) {
|
|
599
463
|
var _a;
|
|
600
|
-
const fullGC = (_a = options.fullGC) !== null && _a !== void 0 ? _a : (this.gcOptions.runFullGC === true ||
|
|
464
|
+
const fullGC = (_a = options.fullGC) !== null && _a !== void 0 ? _a : (this.gcOptions.runFullGC === true ||
|
|
465
|
+
this.summaryStateTracker.doesSummaryStateNeedReset());
|
|
601
466
|
const logger = options.logger
|
|
602
467
|
? telemetry_utils_1.ChildLogger.create(options.logger, undefined, {
|
|
603
468
|
all: { completedGCRuns: () => this.completedRuns },
|
|
@@ -620,6 +485,11 @@ class GarbageCollector {
|
|
|
620
485
|
});
|
|
621
486
|
return undefined;
|
|
622
487
|
}
|
|
488
|
+
// Add the options that are used to run GC to the telemetry context.
|
|
489
|
+
telemetryContext === null || telemetryContext === void 0 ? void 0 : telemetryContext.setMultiple("fluid_GC", "Options", {
|
|
490
|
+
fullGC,
|
|
491
|
+
runSweep: options.runSweep,
|
|
492
|
+
});
|
|
623
493
|
return telemetry_utils_1.PerformanceEvent.timedExecAsync(logger, { eventName: "GarbageCollection" }, async (event) => {
|
|
624
494
|
await this.runPreGCSteps();
|
|
625
495
|
// Get the runtime's GC data and run GC on the reference graph in it.
|
|
@@ -687,97 +557,7 @@ class GarbageCollector {
|
|
|
687
557
|
unreferencedTimestampMs: (_a = this.unreferencedNodesState.get(nodeId)) === null || _a === void 0 ? void 0 : _a.unreferencedTimestampMs,
|
|
688
558
|
};
|
|
689
559
|
}
|
|
690
|
-
|
|
691
|
-
// Serialize and write deleted nodes, if any. This is done irrespective of whether sweep is enabled or not so
|
|
692
|
-
// to identify deleted nodes' usage.
|
|
693
|
-
const serializedDeletedNodes = this.deletedNodes.size > 0
|
|
694
|
-
? JSON.stringify(Array.from(this.deletedNodes).sort())
|
|
695
|
-
: undefined;
|
|
696
|
-
// If running in tombstone mode, serialize and write tombstones, if any.
|
|
697
|
-
const serializedTombstones = this.tombstoneMode
|
|
698
|
-
? this.tombstones.length > 0
|
|
699
|
-
? JSON.stringify(this.tombstones.sort())
|
|
700
|
-
: undefined
|
|
701
|
-
: undefined;
|
|
702
|
-
/**
|
|
703
|
-
* Incremental summary of GC data - If none of GC state, deleted nodes or tombstones changed since last summary,
|
|
704
|
-
* write summary handle instead of summary tree for GC.
|
|
705
|
-
* Otherwise, write the GC summary tree. In the tree, for each of these that changed, write a summary blob and
|
|
706
|
-
* for each of these that did not change, write a summary handle.
|
|
707
|
-
*/
|
|
708
|
-
if (this.trackGCState) {
|
|
709
|
-
this.pendingSummaryData = {
|
|
710
|
-
serializedGCState,
|
|
711
|
-
serializedTombstones,
|
|
712
|
-
serializedDeletedNodes,
|
|
713
|
-
};
|
|
714
|
-
if (trackState && !fullTree && this.latestSummaryData !== undefined) {
|
|
715
|
-
// If nothing changed since last summary, send a summary handle for the entire GC data.
|
|
716
|
-
if (this.latestSummaryData.serializedGCState === serializedGCState &&
|
|
717
|
-
this.latestSummaryData.serializedTombstones === serializedTombstones) {
|
|
718
|
-
const stats = (0, runtime_utils_1.mergeStats)();
|
|
719
|
-
stats.handleNodeCount++;
|
|
720
|
-
return {
|
|
721
|
-
summary: {
|
|
722
|
-
type: protocol_definitions_1.SummaryType.Handle,
|
|
723
|
-
handle: `/${runtime_definitions_1.gcTreeKey}`,
|
|
724
|
-
handleType: protocol_definitions_1.SummaryType.Tree,
|
|
725
|
-
},
|
|
726
|
-
stats,
|
|
727
|
-
};
|
|
728
|
-
}
|
|
729
|
-
// If some state changed, build a GC summary tree.
|
|
730
|
-
return this.buildGCSummaryTree(serializedGCState, serializedTombstones, serializedDeletedNodes, true /* trackState */);
|
|
731
|
-
}
|
|
732
|
-
}
|
|
733
|
-
// If not tracking GC state, build a GC summary tree without any summary handles.
|
|
734
|
-
return this.buildGCSummaryTree(serializedGCState, serializedTombstones, serializedDeletedNodes, false /* trackState */);
|
|
735
|
-
}
|
|
736
|
-
/**
|
|
737
|
-
* Builds the GC summary tree which contains GC state, deleted nodes and tombstones.
|
|
738
|
-
* If trackState is false, all of GC state, deleted nodes and tombstones are written as summary blobs.
|
|
739
|
-
* If trackState is true, only states that changed are written. Rest are written as handles.
|
|
740
|
-
* @param serializedGCState - The GC state serialized as string.
|
|
741
|
-
* @param serializedTombstones - The tombstone state serialized as string.
|
|
742
|
-
* @param serializedDeletedNodes - Deleted nodes serialized as string.
|
|
743
|
-
* @param trackState - Whether we are tracking GC state across summaries.
|
|
744
|
-
* @returns the GC summary tree.
|
|
745
|
-
*/
|
|
746
|
-
buildGCSummaryTree(serializedGCState, serializedTombstones, serializedDeletedNodes, trackState) {
|
|
747
|
-
var _a, _b, _c;
|
|
748
|
-
const gcStateBlobKey = `${runtime_definitions_1.gcBlobPrefix}_root`;
|
|
749
|
-
const builder = new runtime_utils_1.SummaryTreeBuilder();
|
|
750
|
-
// If the GC state hasn't changed, write a summary handle, else write a summary blob for it.
|
|
751
|
-
if (((_a = this.latestSummaryData) === null || _a === void 0 ? void 0 : _a.serializedGCState) === serializedGCState && trackState) {
|
|
752
|
-
builder.addHandle(gcStateBlobKey, protocol_definitions_1.SummaryType.Blob, `/${runtime_definitions_1.gcTreeKey}/${gcStateBlobKey}`);
|
|
753
|
-
}
|
|
754
|
-
else {
|
|
755
|
-
builder.addBlob(gcStateBlobKey, serializedGCState);
|
|
756
|
-
}
|
|
757
|
-
// If tombstones exist, write a summary handle if it hasn't changed. If it has changed, write a
|
|
758
|
-
// summary blob.
|
|
759
|
-
if (serializedTombstones !== undefined) {
|
|
760
|
-
if (((_b = this.latestSummaryData) === null || _b === void 0 ? void 0 : _b.serializedTombstones) === serializedTombstones &&
|
|
761
|
-
trackState) {
|
|
762
|
-
builder.addHandle(runtime_definitions_1.gcTombstoneBlobKey, protocol_definitions_1.SummaryType.Blob, `/${runtime_definitions_1.gcTreeKey}/${runtime_definitions_1.gcTombstoneBlobKey}`);
|
|
763
|
-
}
|
|
764
|
-
else {
|
|
765
|
-
builder.addBlob(runtime_definitions_1.gcTombstoneBlobKey, serializedTombstones);
|
|
766
|
-
}
|
|
767
|
-
}
|
|
768
|
-
// If there are no deleted nodes, return the summary tree.
|
|
769
|
-
if (serializedDeletedNodes === undefined) {
|
|
770
|
-
return builder.getSummaryTree();
|
|
771
|
-
}
|
|
772
|
-
// If the deleted nodes hasn't changed, write a summary handle, else write a summary blob for it.
|
|
773
|
-
if (((_c = this.latestSummaryData) === null || _c === void 0 ? void 0 : _c.serializedDeletedNodes) === serializedDeletedNodes &&
|
|
774
|
-
trackState) {
|
|
775
|
-
builder.addHandle(runtime_definitions_1.gcDeletedBlobKey, protocol_definitions_1.SummaryType.Blob, `/${runtime_definitions_1.gcTreeKey}/${runtime_definitions_1.gcDeletedBlobKey}`);
|
|
776
|
-
}
|
|
777
|
-
else {
|
|
778
|
-
builder.addBlob(runtime_definitions_1.gcDeletedBlobKey, serializedDeletedNodes);
|
|
779
|
-
}
|
|
780
|
-
return builder.getSummaryTree();
|
|
560
|
+
return this.summaryStateTracker.summarize(fullTree, trackState, gcState, this.deletedNodes, this.tombstones);
|
|
781
561
|
}
|
|
782
562
|
getMetadata() {
|
|
783
563
|
return {
|
|
@@ -785,7 +565,7 @@ class GarbageCollector {
|
|
|
785
565
|
* If GC is enabled, the GC data is written using the current GC version and that is the gcFeature that goes
|
|
786
566
|
* into the metadata blob. If GC is disabled, the gcFeature is 0.
|
|
787
567
|
*/
|
|
788
|
-
gcFeature: this.gcEnabled ? this.currentGCVersion : 0,
|
|
568
|
+
gcFeature: this.gcEnabled ? this.summaryStateTracker.currentGCVersion : 0,
|
|
789
569
|
gcFeatureMatrix: this.persistedGcFeatureMatrix,
|
|
790
570
|
sessionExpiryTimeoutMs: this.sessionExpiryTimeoutMs,
|
|
791
571
|
sweepEnabled: this.sweepEnabled,
|
|
@@ -804,52 +584,22 @@ class GarbageCollector {
|
|
|
804
584
|
* is downloaded and should be used to update the state.
|
|
805
585
|
*/
|
|
806
586
|
async refreshLatestSummary(proposalHandle, result, readAndParseBlob) {
|
|
807
|
-
|
|
808
|
-
// summary
|
|
809
|
-
//
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
this.latestSummaryGCVersion = this.currentGCVersion;
|
|
821
|
-
if (this.trackGCState) {
|
|
822
|
-
this.latestSummaryData = this.pendingSummaryData;
|
|
823
|
-
this.pendingSummaryData = undefined;
|
|
587
|
+
const latestSnapshotData = await this.summaryStateTracker.refreshLatestSummary(proposalHandle, result, readAndParseBlob);
|
|
588
|
+
// If the latest summary was updated but it was not tracked by this client, our state needs to be updated from
|
|
589
|
+
// this snapshot data.
|
|
590
|
+
if (this.shouldRunGC && result.latestSummaryUpdated && !result.wasSummaryTracked) {
|
|
591
|
+
// The current reference timestamp should be available if we are refreshing state from a snapshot. There has
|
|
592
|
+
// to be at least one op (summary op / ack, if nothing else) if a snapshot was taken.
|
|
593
|
+
const currentReferenceTimestampMs = this.runtime.getCurrentReferenceTimestampMs();
|
|
594
|
+
if (currentReferenceTimestampMs === undefined) {
|
|
595
|
+
throw container_utils_1.DataProcessingError.create("No reference timestamp when updating GC state from snapshot", "refreshLatestSummary", undefined, {
|
|
596
|
+
proposalHandle,
|
|
597
|
+
summaryRefSeq: result.summaryRefSeq,
|
|
598
|
+
details: JSON.stringify(this.configs),
|
|
599
|
+
});
|
|
824
600
|
}
|
|
825
|
-
|
|
826
|
-
}
|
|
827
|
-
// If the summary was not tracked by this client, the state should be updated from the downloaded snapshot.
|
|
828
|
-
const snapshotTree = result.snapshotTree;
|
|
829
|
-
const metadataBlobId = snapshotTree.blobs[summaryFormat_1.metadataBlobName];
|
|
830
|
-
if (metadataBlobId) {
|
|
831
|
-
const metadata = await readAndParseBlob(metadataBlobId);
|
|
832
|
-
this.latestSummaryGCVersion = (0, summaryFormat_1.getGCVersion)(metadata);
|
|
833
|
-
}
|
|
834
|
-
// The current reference timestamp should be available if we are refreshing state from a snapshot. There has
|
|
835
|
-
// to be at least one op (summary op / ack, if nothing else) if a snapshot was taken.
|
|
836
|
-
const currentReferenceTimestampMs = this.runtime.getCurrentReferenceTimestampMs();
|
|
837
|
-
if (currentReferenceTimestampMs === undefined) {
|
|
838
|
-
throw container_utils_1.DataProcessingError.create("No reference timestamp when updating GC state from snapshot", "refreshLatestSummary", undefined, {
|
|
839
|
-
proposalHandle,
|
|
840
|
-
summaryRefSeq: result.summaryRefSeq,
|
|
841
|
-
details: JSON.stringify(this.configs),
|
|
842
|
-
});
|
|
843
|
-
}
|
|
844
|
-
const gcSnapshotTree = snapshotTree.trees[runtime_definitions_1.gcTreeKey];
|
|
845
|
-
// If GC ran in the container that generated this snapshot, it will have a GC tree.
|
|
846
|
-
this.wasGCRunInLatestSummary = gcSnapshotTree !== undefined;
|
|
847
|
-
let latestGCData;
|
|
848
|
-
if (gcSnapshotTree !== undefined) {
|
|
849
|
-
latestGCData = await (0, garbage_collector_1.getGCDataFromSnapshot)(gcSnapshotTree, readAndParseBlob);
|
|
601
|
+
this.updateStateFromSnapshotData(latestSnapshotData, currentReferenceTimestampMs);
|
|
850
602
|
}
|
|
851
|
-
this.updateStateFromSnapshotData(latestGCData, currentReferenceTimestampMs);
|
|
852
|
-
this.pendingSummaryData = undefined;
|
|
853
603
|
}
|
|
854
604
|
/**
|
|
855
605
|
* Called when a node with the given id is updated. If the node is inactive, log an error.
|
|
@@ -864,7 +614,7 @@ class GarbageCollector {
|
|
|
864
614
|
return;
|
|
865
615
|
}
|
|
866
616
|
const nodeStateTracker = this.unreferencedNodesState.get(nodePath);
|
|
867
|
-
if (nodeStateTracker && nodeStateTracker.state !==
|
|
617
|
+
if (nodeStateTracker && nodeStateTracker.state !== gcDefinitions_1.UnreferencedState.Active) {
|
|
868
618
|
this.inactiveNodeUsed(reason, nodePath, nodeStateTracker, undefined /* fromNodeId */, packagePath, timestampMs, requestHeaders);
|
|
869
619
|
}
|
|
870
620
|
}
|
|
@@ -884,19 +634,19 @@ class GarbageCollector {
|
|
|
884
634
|
outboundRoutes.push(toNodePath);
|
|
885
635
|
this.newReferencesSinceLastRun.set(fromNodePath, outboundRoutes);
|
|
886
636
|
const nodeStateTracker = this.unreferencedNodesState.get(toNodePath);
|
|
887
|
-
if (nodeStateTracker && nodeStateTracker.state !==
|
|
637
|
+
if (nodeStateTracker && nodeStateTracker.state !== gcDefinitions_1.UnreferencedState.Active) {
|
|
888
638
|
this.inactiveNodeUsed("Revived", toNodePath, nodeStateTracker, fromNodePath);
|
|
889
639
|
}
|
|
890
640
|
if (this.tombstones.includes(toNodePath)) {
|
|
891
641
|
const nodeType = this.runtime.getNodeType(toNodePath);
|
|
892
642
|
let eventName = "GC_Tombstone_SubDatastore_Revived";
|
|
893
|
-
if (nodeType ===
|
|
643
|
+
if (nodeType === gcDefinitions_1.GCNodeType.DataStore) {
|
|
894
644
|
eventName = "GC_Tombstone_Datastore_Revived";
|
|
895
645
|
}
|
|
896
|
-
else if (nodeType ===
|
|
646
|
+
else if (nodeType === gcDefinitions_1.GCNodeType.Blob) {
|
|
897
647
|
eventName = "GC_Tombstone_Blob_Revived";
|
|
898
648
|
}
|
|
899
|
-
(0,
|
|
649
|
+
(0, gcHelpers_1.sendGCUnexpectedUsageEvent)(this.mc, {
|
|
900
650
|
eventName,
|
|
901
651
|
category: "generic",
|
|
902
652
|
url: (0, garbage_collector_1.trimLeadingSlashes)(toNodePath),
|
|
@@ -954,11 +704,11 @@ class GarbageCollector {
|
|
|
954
704
|
for (const nodeId of gcResult.deletedNodeIds) {
|
|
955
705
|
const nodeStateTracker = this.unreferencedNodesState.get(nodeId);
|
|
956
706
|
if (nodeStateTracker === undefined) {
|
|
957
|
-
this.unreferencedNodesState.set(nodeId, new UnreferencedStateTracker(currentReferenceTimestampMs, this.inactiveTimeoutMs, currentReferenceTimestampMs, this.sweepTimeoutMs));
|
|
707
|
+
this.unreferencedNodesState.set(nodeId, new gcUnreferencedStateTracker_1.UnreferencedStateTracker(currentReferenceTimestampMs, this.inactiveTimeoutMs, currentReferenceTimestampMs, this.sweepTimeoutMs));
|
|
958
708
|
}
|
|
959
709
|
else {
|
|
960
710
|
nodeStateTracker.updateTracking(currentReferenceTimestampMs);
|
|
961
|
-
if (nodeStateTracker.state ===
|
|
711
|
+
if (nodeStateTracker.state === gcDefinitions_1.UnreferencedState.SweepReady) {
|
|
962
712
|
sweepReadyNodes.push(nodeId);
|
|
963
713
|
}
|
|
964
714
|
}
|
|
@@ -972,7 +722,7 @@ class GarbageCollector {
|
|
|
972
722
|
runSweepPhase(sweepReadyNodes, gcData) {
|
|
973
723
|
// TODO: GC:Validation - validate that removed routes are not double deleted
|
|
974
724
|
// TODO: GC:Validation - validate that the child routes of removed routes are deleted as well
|
|
975
|
-
const sweptRoutes = this.runtime.
|
|
725
|
+
const sweptRoutes = this.runtime.deleteSweepReadyNodes(sweepReadyNodes);
|
|
976
726
|
const updatedGCData = this.deleteSweptRoutes(sweptRoutes, gcData);
|
|
977
727
|
for (const nodeId of sweptRoutes) {
|
|
978
728
|
const nodeStateTracker = this.unreferencedNodesState.get(nodeId);
|
|
@@ -1113,7 +863,7 @@ class GarbageCollector {
|
|
|
1113
863
|
*/
|
|
1114
864
|
currentOutboundRoutes.forEach((route) => {
|
|
1115
865
|
const nodeType = this.runtime.getNodeType(route);
|
|
1116
|
-
if ((nodeType ===
|
|
866
|
+
if ((nodeType === gcDefinitions_1.GCNodeType.DataStore || nodeType === gcDefinitions_1.GCNodeType.Blob) &&
|
|
1117
867
|
!nodeId.startsWith(route) &&
|
|
1118
868
|
!previousRoutes.includes(route) &&
|
|
1119
869
|
!explicitRoutes.includes(route)) {
|
|
@@ -1156,7 +906,7 @@ class GarbageCollector {
|
|
|
1156
906
|
if (!referenced) {
|
|
1157
907
|
gcStats.unrefNodeCount++;
|
|
1158
908
|
}
|
|
1159
|
-
if (this.runtime.getNodeType(nodeId) ===
|
|
909
|
+
if (this.runtime.getNodeType(nodeId) === gcDefinitions_1.GCNodeType.DataStore) {
|
|
1160
910
|
gcStats.dataStoreCount++;
|
|
1161
911
|
if (stateUpdated) {
|
|
1162
912
|
gcStats.updatedDataStoreCount++;
|
|
@@ -1165,7 +915,7 @@ class GarbageCollector {
|
|
|
1165
915
|
gcStats.unrefDataStoreCount++;
|
|
1166
916
|
}
|
|
1167
917
|
}
|
|
1168
|
-
if (this.runtime.getNodeType(nodeId) ===
|
|
918
|
+
if (this.runtime.getNodeType(nodeId) === gcDefinitions_1.GCNodeType.Blob) {
|
|
1169
919
|
gcStats.attachmentBlobCount++;
|
|
1170
920
|
if (stateUpdated) {
|
|
1171
921
|
gcStats.updatedAttachmentBlobCount++;
|
|
@@ -1188,16 +938,16 @@ class GarbageCollector {
|
|
|
1188
938
|
* this will give us a view into how much deleted content a container has.
|
|
1189
939
|
*/
|
|
1190
940
|
logSweepEvents(logger, currentReferenceTimestampMs) {
|
|
1191
|
-
if (this.mc.config.getBoolean(
|
|
941
|
+
if (this.mc.config.getBoolean(gcDefinitions_1.disableSweepLogKey) === true ||
|
|
1192
942
|
this.sweepTimeoutMs === undefined) {
|
|
1193
943
|
return;
|
|
1194
944
|
}
|
|
1195
945
|
this.unreferencedNodesState.forEach((nodeStateTracker, nodeId) => {
|
|
1196
|
-
if (nodeStateTracker.state !==
|
|
946
|
+
if (nodeStateTracker.state !== gcDefinitions_1.UnreferencedState.SweepReady) {
|
|
1197
947
|
return;
|
|
1198
948
|
}
|
|
1199
949
|
const nodeType = this.runtime.getNodeType(nodeId);
|
|
1200
|
-
if (nodeType !==
|
|
950
|
+
if (nodeType !== gcDefinitions_1.GCNodeType.DataStore && nodeType !== gcDefinitions_1.GCNodeType.Blob) {
|
|
1201
951
|
return;
|
|
1202
952
|
}
|
|
1203
953
|
// Log deleted event for each node only once to reduce noise in telemetry.
|
|
@@ -1225,13 +975,13 @@ class GarbageCollector {
|
|
|
1225
975
|
// logging as nothing interesting would have happened worth logging.
|
|
1226
976
|
// If the node is active, skip logging.
|
|
1227
977
|
if (currentReferenceTimestampMs === undefined ||
|
|
1228
|
-
nodeStateTracker.state ===
|
|
978
|
+
nodeStateTracker.state === gcDefinitions_1.UnreferencedState.Active) {
|
|
1229
979
|
return;
|
|
1230
980
|
}
|
|
1231
981
|
// We only care about data stores and attachment blobs for this telemetry since GC only marks these objects
|
|
1232
982
|
// as unreferenced. Also, if an inactive DDS is used, the corresponding data store store will also be used.
|
|
1233
983
|
const nodeType = this.runtime.getNodeType(nodeId);
|
|
1234
|
-
if (nodeType !==
|
|
984
|
+
if (nodeType !== gcDefinitions_1.GCNodeType.DataStore && nodeType !== gcDefinitions_1.GCNodeType.Blob) {
|
|
1235
985
|
return;
|
|
1236
986
|
}
|
|
1237
987
|
const state = nodeStateTracker.state;
|
|
@@ -1240,9 +990,9 @@ class GarbageCollector {
|
|
|
1240
990
|
return;
|
|
1241
991
|
}
|
|
1242
992
|
this.loggedUnreferencedEvents.add(uniqueEventId);
|
|
1243
|
-
const propsToLog = Object.assign(Object.assign({ id: nodeId, type: nodeType, unrefTime: nodeStateTracker.unreferencedTimestampMs, age: currentReferenceTimestampMs - nodeStateTracker.unreferencedTimestampMs, timeout: nodeStateTracker.state ===
|
|
993
|
+
const propsToLog = Object.assign(Object.assign({ id: nodeId, type: nodeType, unrefTime: nodeStateTracker.unreferencedTimestampMs, age: currentReferenceTimestampMs - nodeStateTracker.unreferencedTimestampMs, timeout: nodeStateTracker.state === gcDefinitions_1.UnreferencedState.Inactive
|
|
1244
994
|
? this.inactiveTimeoutMs
|
|
1245
|
-
: this.sweepTimeoutMs, completedGCRuns: this.completedRuns, lastSummaryTime: this.getLastSummaryTimestampMs() }, this.createContainerMetadata), {
|
|
995
|
+
: this.sweepTimeoutMs, completedGCRuns: this.completedRuns, lastSummaryTime: this.getLastSummaryTimestampMs() }, this.createContainerMetadata), { viaHandle: requestHeaders === null || requestHeaders === void 0 ? void 0 : requestHeaders[containerRuntime_1.RuntimeHeaders.viaHandle], fromId: fromNodeId });
|
|
1246
996
|
// For summarizer client, queue the event so it is logged the next time GC runs if the event is still valid.
|
|
1247
997
|
// For non-summarizer client, log the event now since GC won't run on it. This may result in false positives
|
|
1248
998
|
// but it's a good signal nonetheless and we can consume it with a grain of salt.
|
|
@@ -1260,7 +1010,7 @@ class GarbageCollector {
|
|
|
1260
1010
|
const event = Object.assign(Object.assign({}, propsToLog), { eventName: `${state}Object_${usageType}`, pkg: (0, runtime_utils_1.packagePathToTelemetryProperty)(packagePath), stack: (0, telemetry_utils_1.generateStack)() });
|
|
1261
1011
|
// Do not log the inactive object x events as error events as they are not the best signal for
|
|
1262
1012
|
// detecting something wrong with GC either from the partner or from the runtime itself.
|
|
1263
|
-
if (state ===
|
|
1013
|
+
if (state === gcDefinitions_1.UnreferencedState.Inactive) {
|
|
1264
1014
|
this.mc.logger.sendTelemetryEvent(event);
|
|
1265
1015
|
}
|
|
1266
1016
|
else {
|
|
@@ -1270,7 +1020,7 @@ class GarbageCollector {
|
|
|
1270
1020
|
// If SweepReady Usage Detection is enabled, the handler may close the interactive container.
|
|
1271
1021
|
// Once Sweep is fully implemented, this will be removed since the objects will be gone
|
|
1272
1022
|
// and errors will arise elsewhere in the runtime
|
|
1273
|
-
if (state ===
|
|
1023
|
+
if (state === gcDefinitions_1.UnreferencedState.SweepReady) {
|
|
1274
1024
|
this.sweepReadyUsageHandler.usageDetectedInInteractiveClient(Object.assign(Object.assign({}, propsToLog), { usageType }));
|
|
1275
1025
|
}
|
|
1276
1026
|
}
|
|
@@ -1291,7 +1041,7 @@ class GarbageCollector {
|
|
|
1291
1041
|
*/
|
|
1292
1042
|
const nodeStateTracker = this.unreferencedNodesState.get(eventProps.id);
|
|
1293
1043
|
const active = nodeStateTracker === undefined ||
|
|
1294
|
-
nodeStateTracker.state ===
|
|
1044
|
+
nodeStateTracker.state === gcDefinitions_1.UnreferencedState.Active;
|
|
1295
1045
|
if ((usageType === "Revived") === active) {
|
|
1296
1046
|
const pkg = await this.getNodePackagePath(eventProps.id);
|
|
1297
1047
|
const fromPkg = eventProps.fromId
|
|
@@ -1302,7 +1052,7 @@ class GarbageCollector {
|
|
|
1302
1052
|
: undefined, fromPkg: fromPkg
|
|
1303
1053
|
? { value: fromPkg.join("/"), tag: telemetry_utils_1.TelemetryDataTag.CodeArtifact }
|
|
1304
1054
|
: undefined });
|
|
1305
|
-
if (state ===
|
|
1055
|
+
if (state === gcDefinitions_1.UnreferencedState.Inactive) {
|
|
1306
1056
|
logger.sendTelemetryEvent(event);
|
|
1307
1057
|
}
|
|
1308
1058
|
else {
|
|
@@ -1314,30 +1064,4 @@ class GarbageCollector {
|
|
|
1314
1064
|
}
|
|
1315
1065
|
}
|
|
1316
1066
|
exports.GarbageCollector = GarbageCollector;
|
|
1317
|
-
function generateSortedGCState(gcState) {
|
|
1318
|
-
const sortableArray = Object.entries(gcState.gcNodes);
|
|
1319
|
-
sortableArray.sort(([a], [b]) => a.localeCompare(b));
|
|
1320
|
-
const sortedGCState = { gcNodes: {} };
|
|
1321
|
-
for (const [nodeId, nodeData] of sortableArray) {
|
|
1322
|
-
nodeData.outboundRoutes.sort();
|
|
1323
|
-
sortedGCState.gcNodes[nodeId] = nodeData;
|
|
1324
|
-
}
|
|
1325
|
-
return sortedGCState;
|
|
1326
|
-
}
|
|
1327
|
-
/** A wrapper around common-utils Timer that requires the timeout when calling start/restart */
|
|
1328
|
-
class TimerWithNoDefaultTimeout extends common_utils_1.Timer {
|
|
1329
|
-
constructor(callback) {
|
|
1330
|
-
// The default timeout/handlers will never be used since start/restart pass overrides below
|
|
1331
|
-
super(0, () => {
|
|
1332
|
-
throw new Error("DefaultHandler should not be used");
|
|
1333
|
-
});
|
|
1334
|
-
this.callback = callback;
|
|
1335
|
-
}
|
|
1336
|
-
start(timeoutMs) {
|
|
1337
|
-
super.start(timeoutMs, this.callback);
|
|
1338
|
-
}
|
|
1339
|
-
restart(timeoutMs) {
|
|
1340
|
-
super.restart(timeoutMs, this.callback);
|
|
1341
|
-
}
|
|
1342
|
-
}
|
|
1343
1067
|
//# sourceMappingURL=garbageCollection.js.map
|