@fluidframework/container-runtime 2.0.0-internal.7.3.0 → 2.0.0-internal.7.4.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/CHANGELOG.md +18 -0
- package/api-extractor-lint.json +13 -0
- package/api-extractor.json +9 -1
- package/api-report/container-runtime.api.md +124 -107
- package/dist/blobManager.d.ts +4 -4
- package/dist/blobManager.d.ts.map +1 -1
- package/dist/blobManager.js.map +1 -1
- package/dist/container-runtime-alpha.d.ts +1473 -0
- package/dist/container-runtime-beta.d.ts +300 -0
- package/dist/container-runtime-public.d.ts +300 -0
- package/dist/container-runtime-untrimmed.d.ts +1836 -0
- package/dist/containerRuntime.d.ts +30 -30
- package/dist/containerRuntime.d.ts.map +1 -1
- package/dist/containerRuntime.js +62 -40
- package/dist/containerRuntime.js.map +1 -1
- package/dist/dataStoreRegistry.d.ts +1 -1
- package/dist/dataStoreRegistry.js +1 -1
- package/dist/dataStoreRegistry.js.map +1 -1
- package/dist/dataStores.d.ts +10 -15
- package/dist/dataStores.d.ts.map +1 -1
- package/dist/dataStores.js +77 -40
- package/dist/dataStores.js.map +1 -1
- package/dist/gc/garbageCollection.d.ts +41 -13
- package/dist/gc/garbageCollection.d.ts.map +1 -1
- package/dist/gc/garbageCollection.js +215 -78
- package/dist/gc/garbageCollection.js.map +1 -1
- package/dist/gc/gcConfigs.d.ts.map +1 -1
- package/dist/gc/gcConfigs.js +34 -37
- package/dist/gc/gcConfigs.js.map +1 -1
- package/dist/gc/gcDefinitions.d.ts +121 -46
- package/dist/gc/gcDefinitions.d.ts.map +1 -1
- package/dist/gc/gcDefinitions.js +26 -18
- package/dist/gc/gcDefinitions.js.map +1 -1
- package/dist/gc/gcHelpers.d.ts +18 -25
- package/dist/gc/gcHelpers.d.ts.map +1 -1
- package/dist/gc/gcHelpers.js +29 -45
- package/dist/gc/gcHelpers.js.map +1 -1
- package/dist/gc/gcTelemetry.d.ts +0 -5
- package/dist/gc/gcTelemetry.d.ts.map +1 -1
- package/dist/gc/gcTelemetry.js +14 -42
- package/dist/gc/gcTelemetry.js.map +1 -1
- package/dist/gc/gcUnreferencedStateTracker.d.ts +11 -5
- package/dist/gc/gcUnreferencedStateTracker.d.ts.map +1 -1
- package/dist/gc/gcUnreferencedStateTracker.js +43 -19
- package/dist/gc/gcUnreferencedStateTracker.js.map +1 -1
- package/dist/gc/index.d.ts +1 -1
- package/dist/gc/index.d.ts.map +1 -1
- package/dist/gc/index.js +4 -5
- package/dist/gc/index.js.map +1 -1
- package/dist/index.d.ts +14 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16 -5
- package/dist/index.js.map +1 -1
- package/dist/messageTypes.d.ts +15 -7
- package/dist/messageTypes.d.ts.map +1 -1
- package/dist/messageTypes.js +6 -1
- package/dist/messageTypes.js.map +1 -1
- package/dist/opLifecycle/definitions.d.ts +1 -1
- package/dist/opLifecycle/definitions.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 -0
- package/dist/pendingStateManager.d.ts.map +1 -1
- package/dist/pendingStateManager.js +1 -0
- package/dist/pendingStateManager.js.map +1 -1
- package/dist/summary/orderedClientElection.d.ts +1 -1
- package/dist/summary/orderedClientElection.js.map +1 -1
- package/dist/summary/runWhileConnectedCoordinator.d.ts +2 -2
- package/dist/summary/runWhileConnectedCoordinator.js +1 -1
- package/dist/summary/runWhileConnectedCoordinator.js.map +1 -1
- package/dist/summary/summarizer.d.ts +1 -1
- package/dist/summary/summarizer.js +1 -1
- package/dist/summary/summarizer.js.map +1 -1
- package/dist/summary/summarizerTypes.d.ts +30 -30
- package/dist/summary/summarizerTypes.js.map +1 -1
- package/dist/summary/summaryCollection.d.ts +10 -10
- package/dist/summary/summaryCollection.js +1 -1
- package/dist/summary/summaryCollection.js.map +1 -1
- package/dist/summary/summaryFormat.d.ts +3 -3
- package/dist/summary/summaryFormat.js.map +1 -1
- package/lib/blobManager.d.ts +4 -4
- package/lib/blobManager.d.ts.map +1 -1
- package/lib/blobManager.js.map +1 -1
- package/lib/container-runtime-alpha.d.ts +1473 -0
- package/lib/container-runtime-beta.d.ts +300 -0
- package/lib/container-runtime-public.d.ts +300 -0
- package/lib/container-runtime-untrimmed.d.ts +1836 -0
- package/lib/containerRuntime.d.ts +30 -30
- package/lib/containerRuntime.d.ts.map +1 -1
- package/lib/containerRuntime.js +64 -42
- package/lib/containerRuntime.js.map +1 -1
- package/lib/dataStoreRegistry.d.ts +1 -1
- package/lib/dataStoreRegistry.js +1 -1
- package/lib/dataStoreRegistry.js.map +1 -1
- package/lib/dataStores.d.ts +10 -15
- package/lib/dataStores.d.ts.map +1 -1
- package/lib/dataStores.js +80 -43
- package/lib/dataStores.js.map +1 -1
- package/lib/gc/garbageCollection.d.ts +41 -13
- package/lib/gc/garbageCollection.d.ts.map +1 -1
- package/lib/gc/garbageCollection.js +217 -80
- package/lib/gc/garbageCollection.js.map +1 -1
- package/lib/gc/gcConfigs.d.ts.map +1 -1
- package/lib/gc/gcConfigs.js +37 -40
- package/lib/gc/gcConfigs.js.map +1 -1
- package/lib/gc/gcDefinitions.d.ts +121 -46
- package/lib/gc/gcDefinitions.d.ts.map +1 -1
- package/lib/gc/gcDefinitions.js +25 -17
- package/lib/gc/gcDefinitions.js.map +1 -1
- package/lib/gc/gcHelpers.d.ts +18 -25
- package/lib/gc/gcHelpers.d.ts.map +1 -1
- package/lib/gc/gcHelpers.js +27 -43
- package/lib/gc/gcHelpers.js.map +1 -1
- package/lib/gc/gcTelemetry.d.ts +0 -5
- package/lib/gc/gcTelemetry.d.ts.map +1 -1
- package/lib/gc/gcTelemetry.js +15 -43
- package/lib/gc/gcTelemetry.js.map +1 -1
- package/lib/gc/gcUnreferencedStateTracker.d.ts +11 -5
- package/lib/gc/gcUnreferencedStateTracker.d.ts.map +1 -1
- package/lib/gc/gcUnreferencedStateTracker.js +43 -19
- package/lib/gc/gcUnreferencedStateTracker.js.map +1 -1
- package/lib/gc/index.d.ts +1 -1
- package/lib/gc/index.d.ts.map +1 -1
- package/lib/gc/index.js +1 -1
- package/lib/gc/index.js.map +1 -1
- package/lib/index.d.ts +14 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +15 -1
- package/lib/index.js.map +1 -1
- package/lib/messageTypes.d.ts +15 -7
- package/lib/messageTypes.d.ts.map +1 -1
- package/lib/messageTypes.js +6 -1
- package/lib/messageTypes.js.map +1 -1
- package/lib/opLifecycle/definitions.d.ts +1 -1
- package/lib/opLifecycle/definitions.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 -0
- package/lib/pendingStateManager.d.ts.map +1 -1
- package/lib/pendingStateManager.js +1 -0
- package/lib/pendingStateManager.js.map +1 -1
- package/lib/summary/orderedClientElection.d.ts +1 -1
- package/lib/summary/orderedClientElection.js.map +1 -1
- package/lib/summary/runWhileConnectedCoordinator.d.ts +2 -2
- package/lib/summary/runWhileConnectedCoordinator.js +1 -1
- package/lib/summary/runWhileConnectedCoordinator.js.map +1 -1
- package/lib/summary/summarizer.d.ts +1 -1
- package/lib/summary/summarizer.js +1 -1
- package/lib/summary/summarizer.js.map +1 -1
- package/lib/summary/summarizerTypes.d.ts +30 -30
- package/lib/summary/summarizerTypes.js.map +1 -1
- package/lib/summary/summaryCollection.d.ts +10 -10
- package/lib/summary/summaryCollection.js +1 -1
- package/lib/summary/summaryCollection.js.map +1 -1
- package/lib/summary/summaryFormat.d.ts +3 -3
- package/lib/summary/summaryFormat.js.map +1 -1
- package/package.json +42 -19
- package/src/blobManager.ts +5 -5
- package/src/containerRuntime.ts +86 -56
- package/src/dataStoreRegistry.ts +1 -1
- package/src/dataStores.ts +140 -69
- package/src/gc/garbageCollection.md +14 -15
- package/src/gc/garbageCollection.ts +256 -96
- package/src/gc/gcConfigs.ts +50 -52
- package/src/gc/gcDefinitions.ts +137 -52
- package/src/gc/gcHelpers.ts +31 -52
- package/src/gc/gcTelemetry.ts +16 -57
- package/src/gc/gcUnreferencedStateTracker.ts +61 -22
- package/src/gc/index.ts +6 -4
- package/src/index.ts +19 -1
- package/src/messageTypes.ts +19 -4
- package/src/opLifecycle/definitions.ts +1 -1
- package/src/packageVersion.ts +1 -1
- package/src/pendingStateManager.ts +1 -0
- package/src/summary/orderedClientElection.ts +1 -1
- package/src/summary/runWhileConnectedCoordinator.ts +2 -2
- package/src/summary/summarizer.ts +1 -1
- package/src/summary/summarizerTypes.ts +30 -30
- package/src/summary/summaryCollection.ts +10 -10
- package/src/summary/summaryFormat.ts +3 -3
- package/dist/id-compressor/appendOnlySortedMap.d.ts +0 -124
- package/dist/id-compressor/appendOnlySortedMap.d.ts.map +0 -1
- package/dist/id-compressor/appendOnlySortedMap.js +0 -318
- package/dist/id-compressor/appendOnlySortedMap.js.map +0 -1
- package/dist/id-compressor/finalSpace.d.ts +0 -29
- package/dist/id-compressor/finalSpace.d.ts.map +0 -1
- package/dist/id-compressor/finalSpace.js +0 -62
- package/dist/id-compressor/finalSpace.js.map +0 -1
- package/dist/id-compressor/idCompressor.d.ts +0 -54
- package/dist/id-compressor/idCompressor.d.ts.map +0 -1
- package/dist/id-compressor/idCompressor.js +0 -495
- package/dist/id-compressor/idCompressor.js.map +0 -1
- package/dist/id-compressor/identifiers.d.ts +0 -32
- package/dist/id-compressor/identifiers.d.ts.map +0 -1
- package/dist/id-compressor/identifiers.js +0 -15
- package/dist/id-compressor/identifiers.js.map +0 -1
- package/dist/id-compressor/index.d.ts +0 -13
- package/dist/id-compressor/index.d.ts.map +0 -1
- package/dist/id-compressor/index.js +0 -32
- package/dist/id-compressor/index.js.map +0 -1
- package/dist/id-compressor/persistanceUtilities.d.ts +0 -22
- package/dist/id-compressor/persistanceUtilities.d.ts.map +0 -1
- package/dist/id-compressor/persistanceUtilities.js +0 -43
- package/dist/id-compressor/persistanceUtilities.js.map +0 -1
- package/dist/id-compressor/sessionSpaceNormalizer.d.ts +0 -46
- package/dist/id-compressor/sessionSpaceNormalizer.d.ts.map +0 -1
- package/dist/id-compressor/sessionSpaceNormalizer.js +0 -80
- package/dist/id-compressor/sessionSpaceNormalizer.js.map +0 -1
- package/dist/id-compressor/sessions.d.ts +0 -115
- package/dist/id-compressor/sessions.d.ts.map +0 -1
- package/dist/id-compressor/sessions.js +0 -305
- package/dist/id-compressor/sessions.js.map +0 -1
- package/dist/id-compressor/utilities.d.ts +0 -52
- package/dist/id-compressor/utilities.d.ts.map +0 -1
- package/dist/id-compressor/utilities.js +0 -169
- package/dist/id-compressor/utilities.js.map +0 -1
- package/lib/id-compressor/appendOnlySortedMap.d.ts +0 -124
- package/lib/id-compressor/appendOnlySortedMap.d.ts.map +0 -1
- package/lib/id-compressor/appendOnlySortedMap.js +0 -314
- package/lib/id-compressor/appendOnlySortedMap.js.map +0 -1
- package/lib/id-compressor/finalSpace.d.ts +0 -29
- package/lib/id-compressor/finalSpace.d.ts.map +0 -1
- package/lib/id-compressor/finalSpace.js +0 -58
- package/lib/id-compressor/finalSpace.js.map +0 -1
- package/lib/id-compressor/idCompressor.d.ts +0 -54
- package/lib/id-compressor/idCompressor.d.ts.map +0 -1
- package/lib/id-compressor/idCompressor.js +0 -491
- package/lib/id-compressor/idCompressor.js.map +0 -1
- package/lib/id-compressor/identifiers.d.ts +0 -32
- package/lib/id-compressor/identifiers.d.ts.map +0 -1
- package/lib/id-compressor/identifiers.js +0 -11
- package/lib/id-compressor/identifiers.js.map +0 -1
- package/lib/id-compressor/index.d.ts +0 -13
- package/lib/id-compressor/index.d.ts.map +0 -1
- package/lib/id-compressor/index.js +0 -13
- package/lib/id-compressor/index.js.map +0 -1
- package/lib/id-compressor/persistanceUtilities.d.ts +0 -22
- package/lib/id-compressor/persistanceUtilities.d.ts.map +0 -1
- package/lib/id-compressor/persistanceUtilities.js +0 -34
- package/lib/id-compressor/persistanceUtilities.js.map +0 -1
- package/lib/id-compressor/sessionSpaceNormalizer.d.ts +0 -46
- package/lib/id-compressor/sessionSpaceNormalizer.d.ts.map +0 -1
- package/lib/id-compressor/sessionSpaceNormalizer.js +0 -76
- package/lib/id-compressor/sessionSpaceNormalizer.js.map +0 -1
- package/lib/id-compressor/sessions.d.ts +0 -115
- package/lib/id-compressor/sessions.d.ts.map +0 -1
- package/lib/id-compressor/sessions.js +0 -290
- package/lib/id-compressor/sessions.js.map +0 -1
- package/lib/id-compressor/utilities.d.ts +0 -52
- package/lib/id-compressor/utilities.d.ts.map +0 -1
- package/lib/id-compressor/utilities.js +0 -151
- package/lib/id-compressor/utilities.js.map +0 -1
- package/src/id-compressor/README.md +0 -3
- package/src/id-compressor/appendOnlySortedMap.ts +0 -366
- package/src/id-compressor/finalSpace.ts +0 -67
- package/src/id-compressor/idCompressor.ts +0 -630
- package/src/id-compressor/identifiers.ts +0 -42
- package/src/id-compressor/index.ts +0 -26
- package/src/id-compressor/persistanceUtilities.ts +0 -58
- package/src/id-compressor/sessionSpaceNormalizer.ts +0 -83
- package/src/id-compressor/sessions.ts +0 -405
- package/src/id-compressor/utilities.ts +0 -190
package/src/gc/gcTelemetry.ts
CHANGED
|
@@ -14,7 +14,6 @@ import {
|
|
|
14
14
|
import { RuntimeHeaderData } from "../containerRuntime";
|
|
15
15
|
import { ICreateContainerMetadata } from "../summary";
|
|
16
16
|
import {
|
|
17
|
-
disableSweepLogKey,
|
|
18
17
|
GCNodeType,
|
|
19
18
|
UnreferencedState,
|
|
20
19
|
IGarbageCollectorConfigs,
|
|
@@ -143,6 +142,21 @@ export class GCTelemetryTracker {
|
|
|
143
142
|
|
|
144
143
|
const nodeStateTracker = this.getNodeStateTracker(nodeUsageProps.id);
|
|
145
144
|
const nodeType = this.getNodeType(nodeUsageProps.id);
|
|
145
|
+
const timeout = (() => {
|
|
146
|
+
switch (nodeStateTracker?.state) {
|
|
147
|
+
case UnreferencedState.Inactive:
|
|
148
|
+
return this.configs.inactiveTimeoutMs;
|
|
149
|
+
case UnreferencedState.TombstoneReady:
|
|
150
|
+
return this.configs.sweepTimeoutMs;
|
|
151
|
+
case UnreferencedState.SweepReady:
|
|
152
|
+
return (
|
|
153
|
+
this.configs.sweepTimeoutMs &&
|
|
154
|
+
this.configs.sweepTimeoutMs + this.configs.sweepGracePeriodMs
|
|
155
|
+
);
|
|
156
|
+
default:
|
|
157
|
+
return undefined;
|
|
158
|
+
}
|
|
159
|
+
})();
|
|
146
160
|
const {
|
|
147
161
|
usageType,
|
|
148
162
|
currentReferenceTimestampMs,
|
|
@@ -160,10 +174,7 @@ export class GCTelemetryTracker {
|
|
|
160
174
|
? nodeUsageProps.currentReferenceTimestampMs -
|
|
161
175
|
nodeStateTracker.unreferencedTimestampMs
|
|
162
176
|
: -1,
|
|
163
|
-
timeout
|
|
164
|
-
nodeStateTracker?.state === UnreferencedState.Inactive
|
|
165
|
-
? this.configs.inactiveTimeoutMs
|
|
166
|
-
: this.configs.sweepTimeoutMs,
|
|
177
|
+
timeout,
|
|
167
178
|
...tagCodeArtifacts({ id: untaggedId, fromId: untaggedFromId }),
|
|
168
179
|
...propsToLog,
|
|
169
180
|
...this.createContainerMetadata,
|
|
@@ -392,58 +403,6 @@ export class GCTelemetryTracker {
|
|
|
392
403
|
}
|
|
393
404
|
this.pendingEventsQueue = [];
|
|
394
405
|
}
|
|
395
|
-
|
|
396
|
-
/**
|
|
397
|
-
* For nodes that are ready to sweep, log an event for now. Until we start running sweep which deletes objects,
|
|
398
|
-
* this will give us a view into how much deleted content a container has.
|
|
399
|
-
*/
|
|
400
|
-
public logSweepEvents(
|
|
401
|
-
logger: ITelemetryLoggerExt,
|
|
402
|
-
currentReferenceTimestampMs: number,
|
|
403
|
-
unreferencedNodesState: Map<string, UnreferencedStateTracker>,
|
|
404
|
-
completedGCRuns: number,
|
|
405
|
-
lastSummaryTime?: number,
|
|
406
|
-
) {
|
|
407
|
-
if (
|
|
408
|
-
this.mc.config.getBoolean(disableSweepLogKey) === true ||
|
|
409
|
-
this.configs.sweepTimeoutMs === undefined
|
|
410
|
-
) {
|
|
411
|
-
return;
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
const deletedNodeIds: string[] = [];
|
|
415
|
-
for (const [nodeId, nodeStateTracker] of unreferencedNodesState) {
|
|
416
|
-
if (nodeStateTracker.state !== UnreferencedState.SweepReady) {
|
|
417
|
-
return;
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
const nodeType = this.getNodeType(nodeId);
|
|
421
|
-
if (nodeType !== GCNodeType.DataStore && nodeType !== GCNodeType.Blob) {
|
|
422
|
-
return;
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
// Log deleted event for each node only once to reduce noise in telemetry.
|
|
426
|
-
const uniqueEventId = `Deleted-${nodeId}`;
|
|
427
|
-
if (this.loggedUnreferencedEvents.has(uniqueEventId)) {
|
|
428
|
-
return;
|
|
429
|
-
}
|
|
430
|
-
this.loggedUnreferencedEvents.add(uniqueEventId);
|
|
431
|
-
deletedNodeIds.push(nodeId);
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
if (deletedNodeIds.length > 0) {
|
|
435
|
-
logger.sendTelemetryEvent({
|
|
436
|
-
eventName: "GC_SweepReadyObjects_Delete",
|
|
437
|
-
details: JSON.stringify({
|
|
438
|
-
timeout: this.configs.sweepTimeoutMs,
|
|
439
|
-
completedGCRuns,
|
|
440
|
-
lastSummaryTime,
|
|
441
|
-
...this.createContainerMetadata,
|
|
442
|
-
}),
|
|
443
|
-
...tagCodeArtifacts({ id: JSON.stringify(deletedNodeIds) }),
|
|
444
|
-
});
|
|
445
|
-
}
|
|
446
|
-
}
|
|
447
406
|
}
|
|
448
407
|
|
|
449
408
|
/**
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { assert, Timer } from "@fluidframework/core-utils";
|
|
7
|
+
import { validatePrecondition } from "@fluidframework/telemetry-utils";
|
|
7
8
|
import { UnreferencedState } from "./gcDefinitions";
|
|
8
9
|
|
|
9
10
|
/** A wrapper around common-utils Timer that requires the timeout when calling start/restart */
|
|
@@ -26,7 +27,7 @@ class TimerWithNoDefaultTimeout extends Timer {
|
|
|
26
27
|
|
|
27
28
|
/**
|
|
28
29
|
* Helper class that tracks the state of an unreferenced node such as the time it was unreferenced and if it can
|
|
29
|
-
* be deleted by the sweep phase.
|
|
30
|
+
* be tombstoned or deleted by the sweep phase.
|
|
30
31
|
*/
|
|
31
32
|
export class UnreferencedStateTracker {
|
|
32
33
|
private _state: UnreferencedState = UnreferencedState.Active;
|
|
@@ -36,6 +37,8 @@ export class UnreferencedStateTracker {
|
|
|
36
37
|
|
|
37
38
|
/** Timer to indicate when an unreferenced object is considered Inactive */
|
|
38
39
|
private readonly inactiveTimer: TimerWithNoDefaultTimeout;
|
|
40
|
+
/** Timer to indicate when an unreferenced object is Tombstone-Ready */
|
|
41
|
+
private readonly tombstoneTimer: TimerWithNoDefaultTimeout;
|
|
39
42
|
/** Timer to indicate when an unreferenced object is Sweep-Ready */
|
|
40
43
|
private readonly sweepTimer: TimerWithNoDefaultTimeout;
|
|
41
44
|
|
|
@@ -45,32 +48,49 @@ export class UnreferencedStateTracker {
|
|
|
45
48
|
private readonly inactiveTimeoutMs: number,
|
|
46
49
|
/** The current reference timestamp used to track how long this node has been unreferenced for. */
|
|
47
50
|
currentReferenceTimestampMs: number,
|
|
48
|
-
/** The time after which node transitions to
|
|
49
|
-
private readonly
|
|
51
|
+
/** The time after which node transitions to TombstoneReady state; undefined if session expiry is disabled. */
|
|
52
|
+
private readonly tombstoneTimeoutMs: number | undefined,
|
|
53
|
+
/** The delay from TombstoneReady to SweepReady (only applies if tombstoneTimeoutMs is defined) */
|
|
54
|
+
private readonly sweepGracePeriodMs: number,
|
|
50
55
|
) {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
this.
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
56
|
+
validatePrecondition(
|
|
57
|
+
this.tombstoneTimeoutMs === undefined ||
|
|
58
|
+
this.tombstoneTimeoutMs >= this.inactiveTimeoutMs,
|
|
59
|
+
"inactiveTimeoutMs must not be greater than the tombstoneTimeoutMs",
|
|
60
|
+
);
|
|
57
61
|
|
|
58
62
|
this.sweepTimer = new TimerWithNoDefaultTimeout(() => {
|
|
59
63
|
this._state = UnreferencedState.SweepReady;
|
|
60
64
|
assert(
|
|
61
|
-
!this.inactiveTimer.hasTimer,
|
|
62
|
-
|
|
65
|
+
!this.inactiveTimer.hasTimer && !this.tombstoneTimer.hasTimer,
|
|
66
|
+
0x863 /* inactiveTimer or tombstoneTimer still running after sweepTimer fired! */,
|
|
63
67
|
);
|
|
64
68
|
});
|
|
65
69
|
|
|
70
|
+
this.tombstoneTimer = new TimerWithNoDefaultTimeout(() => {
|
|
71
|
+
this._state = UnreferencedState.TombstoneReady;
|
|
72
|
+
assert(
|
|
73
|
+
!this.inactiveTimer.hasTimer,
|
|
74
|
+
0x864 /* inactiveTimer still running after tombstoneTimer fired! */,
|
|
75
|
+
); // aka 0x3b1
|
|
76
|
+
|
|
77
|
+
if (this.sweepGracePeriodMs > 0) {
|
|
78
|
+
// After the node becomes tombstone ready, start the sweep timer after which the node will be ready for sweep.
|
|
79
|
+
this.sweepTimer.restart(this.sweepGracePeriodMs);
|
|
80
|
+
} else {
|
|
81
|
+
this._state = UnreferencedState.SweepReady;
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
|
|
66
85
|
this.inactiveTimer = new TimerWithNoDefaultTimeout(() => {
|
|
67
86
|
this._state = UnreferencedState.Inactive;
|
|
68
87
|
|
|
69
|
-
// After the node becomes inactive, start the
|
|
70
|
-
if (this.
|
|
71
|
-
this.
|
|
88
|
+
// After the node becomes inactive, start the tombstone timer after which the node will be ready for tombstone.
|
|
89
|
+
if (this.tombstoneTimeoutMs !== undefined) {
|
|
90
|
+
this.tombstoneTimer.restart(this.tombstoneTimeoutMs - this.inactiveTimeoutMs);
|
|
72
91
|
}
|
|
73
92
|
});
|
|
93
|
+
|
|
74
94
|
this.updateTracking(currentReferenceTimestampMs);
|
|
75
95
|
}
|
|
76
96
|
|
|
@@ -78,21 +98,39 @@ export class UnreferencedStateTracker {
|
|
|
78
98
|
public updateTracking(currentReferenceTimestampMs: number) {
|
|
79
99
|
const unreferencedDurationMs = currentReferenceTimestampMs - this.unreferencedTimestampMs;
|
|
80
100
|
|
|
81
|
-
//
|
|
82
|
-
|
|
101
|
+
// Below we will set the appropriate timer (or none). Any running timers are superceded by the new currentReferenceTimestampMs
|
|
102
|
+
this.clearTimers();
|
|
103
|
+
|
|
104
|
+
// If the node has been unreferenced long enough, update the state to SweepReady.
|
|
105
|
+
if (
|
|
106
|
+
this.tombstoneTimeoutMs !== undefined &&
|
|
107
|
+
unreferencedDurationMs >= this.tombstoneTimeoutMs + this.sweepGracePeriodMs
|
|
108
|
+
) {
|
|
83
109
|
this._state = UnreferencedState.SweepReady;
|
|
84
|
-
this.clearTimers();
|
|
85
110
|
return;
|
|
86
111
|
}
|
|
87
112
|
|
|
88
|
-
// If the node has been unreferenced
|
|
89
|
-
// Also, start a timer for the sweep
|
|
113
|
+
// If the node has been unreferenced long enough, update the state to TombstoneReady.
|
|
114
|
+
// Also, start a timer for the remainder of the sweep delay.
|
|
115
|
+
if (
|
|
116
|
+
this.tombstoneTimeoutMs !== undefined &&
|
|
117
|
+
unreferencedDurationMs >= this.tombstoneTimeoutMs
|
|
118
|
+
) {
|
|
119
|
+
this._state = UnreferencedState.TombstoneReady;
|
|
120
|
+
|
|
121
|
+
this.sweepTimer.restart(
|
|
122
|
+
this.tombstoneTimeoutMs + this.sweepGracePeriodMs - unreferencedDurationMs,
|
|
123
|
+
);
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// If the node has been unreferenced for long enough, update the state to inactive.
|
|
128
|
+
// Also, start a timer for the remainder of the tombstone timeout.
|
|
90
129
|
if (unreferencedDurationMs >= this.inactiveTimeoutMs) {
|
|
91
130
|
this._state = UnreferencedState.Inactive;
|
|
92
|
-
this.inactiveTimer.clear();
|
|
93
131
|
|
|
94
|
-
if (this.
|
|
95
|
-
this.
|
|
132
|
+
if (this.tombstoneTimeoutMs !== undefined) {
|
|
133
|
+
this.tombstoneTimer.restart(this.tombstoneTimeoutMs - unreferencedDurationMs);
|
|
96
134
|
}
|
|
97
135
|
return;
|
|
98
136
|
}
|
|
@@ -103,6 +141,7 @@ export class UnreferencedStateTracker {
|
|
|
103
141
|
|
|
104
142
|
private clearTimers() {
|
|
105
143
|
this.inactiveTimer.clear();
|
|
144
|
+
this.tombstoneTimer.clear();
|
|
106
145
|
this.sweepTimer.clear();
|
|
107
146
|
}
|
|
108
147
|
|
package/src/gc/index.ts
CHANGED
|
@@ -7,13 +7,12 @@ export { GarbageCollector } from "./garbageCollection";
|
|
|
7
7
|
export {
|
|
8
8
|
nextGCVersion,
|
|
9
9
|
defaultInactiveTimeoutMs,
|
|
10
|
+
defaultSweepGracePeriodMs,
|
|
10
11
|
defaultSessionExpiryDurationMs,
|
|
11
|
-
disableSweepLogKey,
|
|
12
12
|
GCNodeType,
|
|
13
13
|
gcTestModeKey,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
gcSweepGenerationOptionName,
|
|
14
|
+
gcDisableThrowOnTombstoneLoadOptionName,
|
|
15
|
+
gcGenerationOptionName,
|
|
17
16
|
GCFeatureMatrix,
|
|
18
17
|
GCVersion,
|
|
19
18
|
gcVersionUpgradeToV4Key,
|
|
@@ -24,6 +23,8 @@ export {
|
|
|
24
23
|
IGCMetadata,
|
|
25
24
|
IGCResult,
|
|
26
25
|
IGCRuntimeOptions,
|
|
26
|
+
IMarkPhaseStats,
|
|
27
|
+
ISweepPhaseStats,
|
|
27
28
|
IGCStats,
|
|
28
29
|
oneDayMs,
|
|
29
30
|
runGCKey,
|
|
@@ -34,6 +35,7 @@ export {
|
|
|
34
35
|
disableDatastoreSweepKey,
|
|
35
36
|
UnreferencedState,
|
|
36
37
|
throwOnTombstoneLoadOverrideKey,
|
|
38
|
+
GarbageCollectionMessage,
|
|
37
39
|
} from "./gcDefinitions";
|
|
38
40
|
export {
|
|
39
41
|
cloneGCData,
|
package/src/index.ts
CHANGED
|
@@ -40,6 +40,8 @@ export {
|
|
|
40
40
|
GCFeatureMatrix,
|
|
41
41
|
GCVersion,
|
|
42
42
|
IGCRuntimeOptions,
|
|
43
|
+
IMarkPhaseStats,
|
|
44
|
+
ISweepPhaseStats,
|
|
43
45
|
IGCStats,
|
|
44
46
|
} from "./gc";
|
|
45
47
|
export {
|
|
@@ -91,5 +93,21 @@ export {
|
|
|
91
93
|
IRetriableFailureResult,
|
|
92
94
|
ISummarizeEventProps,
|
|
93
95
|
} from "./summary";
|
|
94
|
-
export { isStableId, generateStableId, assertIsStableId } from "./id-compressor";
|
|
95
96
|
export { IChunkedOp, unpackRuntimeMessage } from "./opLifecycle";
|
|
97
|
+
|
|
98
|
+
// Re-exports for backwards compatibility.
|
|
99
|
+
// Will be removed in the future.
|
|
100
|
+
export {
|
|
101
|
+
/**
|
|
102
|
+
* @deprecated Import from `@fluidframework/id-compressor` instead.
|
|
103
|
+
*/
|
|
104
|
+
assertIsStableId,
|
|
105
|
+
/**
|
|
106
|
+
* @deprecated Import from `@fluidframework/id-compressor` instead.
|
|
107
|
+
*/
|
|
108
|
+
generateStableId,
|
|
109
|
+
/**
|
|
110
|
+
* @deprecated Import from `@fluidframework/id-compressor` instead.
|
|
111
|
+
*/
|
|
112
|
+
isStableId,
|
|
113
|
+
} from "@fluidframework/id-compressor";
|
package/src/messageTypes.ts
CHANGED
|
@@ -8,13 +8,14 @@ import {
|
|
|
8
8
|
IEnvelope,
|
|
9
9
|
InboundAttachMessage,
|
|
10
10
|
IAttachMessage,
|
|
11
|
-
IdCreationRange,
|
|
12
11
|
} from "@fluidframework/runtime-definitions";
|
|
12
|
+
import type { IdCreationRange } from "@fluidframework/id-compressor";
|
|
13
13
|
import { IDataStoreAliasMessage } from "./dataStore";
|
|
14
|
+
import { GarbageCollectionMessage } from "./gc";
|
|
14
15
|
import { IChunkedOp } from "./opLifecycle";
|
|
15
16
|
|
|
16
17
|
/**
|
|
17
|
-
* @
|
|
18
|
+
* @internal
|
|
18
19
|
*/
|
|
19
20
|
export enum ContainerMessageType {
|
|
20
21
|
// An op to be delivered to store
|
|
@@ -41,6 +42,12 @@ export enum ContainerMessageType {
|
|
|
41
42
|
* See the [IdCompressor README](./id-compressor/README.md) for more details.
|
|
42
43
|
*/
|
|
43
44
|
IdAllocation = "idAllocation",
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Garbage collection specific op. This is sent by the summarizer client when GC runs. It's used to synchronize GC
|
|
48
|
+
* state across all clients.
|
|
49
|
+
*/
|
|
50
|
+
GC = "GC",
|
|
44
51
|
}
|
|
45
52
|
|
|
46
53
|
/**
|
|
@@ -71,7 +78,8 @@ export interface IContainerRuntimeMessageCompatDetails {
|
|
|
71
78
|
* IMPORTANT: when creating one to be serialized, set the properties in the order they appear here.
|
|
72
79
|
* This way stringified values can be compared.
|
|
73
80
|
*/
|
|
74
|
-
interface TypedContainerRuntimeMessage<TType extends ContainerMessageType, TContents>
|
|
81
|
+
interface TypedContainerRuntimeMessage<TType extends ContainerMessageType, TContents>
|
|
82
|
+
extends Partial<RecentlyAddedContainerRuntimeMessageDetails> {
|
|
75
83
|
/** Type of the op, within the ContainerRuntime's domain */
|
|
76
84
|
type: TType;
|
|
77
85
|
/** Domain-specific contents, interpreted according to the type */
|
|
@@ -119,6 +127,10 @@ export type ContainerRuntimeIdAllocationMessage = TypedContainerRuntimeMessage<
|
|
|
119
127
|
ContainerMessageType.IdAllocation,
|
|
120
128
|
IdCreationRange
|
|
121
129
|
>;
|
|
130
|
+
export type ContainerRuntimeGCMessage = TypedContainerRuntimeMessage<
|
|
131
|
+
ContainerMessageType.GC,
|
|
132
|
+
GarbageCollectionMessage
|
|
133
|
+
>;
|
|
122
134
|
|
|
123
135
|
/**
|
|
124
136
|
* Represents an unrecognized {@link TypedContainerRuntimeMessage}, e.g. a message from a future version of the container runtime.
|
|
@@ -147,6 +159,7 @@ export type InboundContainerRuntimeMessage =
|
|
|
147
159
|
| ContainerRuntimeRejoinMessage
|
|
148
160
|
| ContainerRuntimeAliasMessage
|
|
149
161
|
| ContainerRuntimeIdAllocationMessage
|
|
162
|
+
| ContainerRuntimeGCMessage
|
|
150
163
|
// Inbound messages may include unknown types from other clients, so we include that as a special case here
|
|
151
164
|
| UnknownContainerRuntimeMessage;
|
|
152
165
|
|
|
@@ -159,6 +172,7 @@ export type LocalContainerRuntimeMessage =
|
|
|
159
172
|
| ContainerRuntimeRejoinMessage
|
|
160
173
|
| ContainerRuntimeAliasMessage
|
|
161
174
|
| ContainerRuntimeIdAllocationMessage
|
|
175
|
+
| ContainerRuntimeGCMessage
|
|
162
176
|
// In rare cases (e.g. related to stashed ops) we could have a local message of an unknown type
|
|
163
177
|
| UnknownContainerRuntimeMessage;
|
|
164
178
|
|
|
@@ -170,7 +184,8 @@ export type OutboundContainerRuntimeMessage =
|
|
|
170
184
|
| ContainerRuntimeBlobAttachMessage
|
|
171
185
|
| ContainerRuntimeRejoinMessage
|
|
172
186
|
| ContainerRuntimeAliasMessage
|
|
173
|
-
| ContainerRuntimeIdAllocationMessage
|
|
187
|
+
| ContainerRuntimeIdAllocationMessage
|
|
188
|
+
| ContainerRuntimeGCMessage;
|
|
174
189
|
|
|
175
190
|
/**
|
|
176
191
|
* An unpacked ISequencedDocumentMessage with the inner TypedContainerRuntimeMessage type/contents/etc
|
package/src/packageVersion.ts
CHANGED
|
@@ -331,6 +331,7 @@ export class PendingStateManager implements IDisposable {
|
|
|
331
331
|
/**
|
|
332
332
|
* Called when the Container's connection state changes. If the Container gets connected, it replays all the pending
|
|
333
333
|
* states in its queue. This includes triggering resubmission of unacked ops.
|
|
334
|
+
* ! Note: successfully resubmitting an op that has been successfully sequenced is not possible due to checks in the ConnectionStateHandler (Loader layer)
|
|
334
335
|
*/
|
|
335
336
|
public replayPendingStates() {
|
|
336
337
|
assert(
|
|
@@ -227,7 +227,7 @@ export interface IOrderedClientElectionEvents extends IEvent {
|
|
|
227
227
|
|
|
228
228
|
/**
|
|
229
229
|
* Serialized state of IOrderedClientElection.
|
|
230
|
-
* @
|
|
230
|
+
* @alpha
|
|
231
231
|
*/
|
|
232
232
|
export interface ISerializedElection {
|
|
233
233
|
/** Sequence number at the time of the latest election. */
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Similar to AbortController, but using promise instead of events
|
|
15
|
-
* @
|
|
15
|
+
* @internal
|
|
16
16
|
*/
|
|
17
17
|
export interface ICancellableSummarizerController extends ISummaryCancellationToken {
|
|
18
18
|
stop(reason: SummarizerStopReason): void;
|
|
@@ -21,7 +21,7 @@ export interface ICancellableSummarizerController extends ISummaryCancellationTo
|
|
|
21
21
|
/**
|
|
22
22
|
* Can be useful in testing as well as in places where caller does not use cancellation.
|
|
23
23
|
* This object implements ISummaryCancellationToken interface but cancellation is never leveraged.
|
|
24
|
-
* @
|
|
24
|
+
* @internal
|
|
25
25
|
*/
|
|
26
26
|
export const neverCancelledSummaryToken: ISummaryCancellationToken = {
|
|
27
27
|
cancelled: false,
|
|
@@ -69,7 +69,7 @@ export const createSummarizingWarning = (errorMessage: string, logged: boolean)
|
|
|
69
69
|
* Summarizer is responsible for coordinating when to generate and send summaries.
|
|
70
70
|
* It is the main entry point for summary work.
|
|
71
71
|
* It is created only by summarizing container (i.e. one with clientType === "summarizer")
|
|
72
|
-
* @
|
|
72
|
+
* @internal
|
|
73
73
|
*/
|
|
74
74
|
export class Summarizer extends TypedEventEmitter<ISummarizerEvents> implements ISummarizer {
|
|
75
75
|
public get ISummarizer() {
|