@fluidframework/container-runtime 2.0.0-dev.4.4.0.162253 → 2.0.0-dev.5.2.0.169897
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 +45 -0
- package/dist/batchTracker.d.ts +4 -4
- package/dist/batchTracker.d.ts.map +1 -1
- package/dist/batchTracker.js +2 -2
- package/dist/batchTracker.js.map +1 -1
- package/dist/blobManager.js +2 -2
- package/dist/blobManager.js.map +1 -1
- package/dist/connectionTelemetry.d.ts +2 -2
- package/dist/connectionTelemetry.d.ts.map +1 -1
- package/dist/connectionTelemetry.js.map +1 -1
- package/dist/containerRuntime.d.ts +12 -11
- package/dist/containerRuntime.d.ts.map +1 -1
- package/dist/containerRuntime.js +42 -15
- package/dist/containerRuntime.js.map +1 -1
- package/dist/dataStore.d.ts +2 -2
- package/dist/dataStore.d.ts.map +1 -1
- package/dist/dataStore.js +1 -1
- package/dist/dataStore.js.map +1 -1
- package/dist/dataStoreContext.d.ts +3 -3
- package/dist/dataStoreContext.d.ts.map +1 -1
- package/dist/dataStoreContext.js +1 -2
- package/dist/dataStoreContext.js.map +1 -1
- package/dist/dataStoreContexts.d.ts.map +1 -1
- package/dist/dataStoreContexts.js.map +1 -1
- package/dist/deltaScheduler.d.ts +2 -2
- package/dist/deltaScheduler.d.ts.map +1 -1
- package/dist/deltaScheduler.js +1 -1
- package/dist/deltaScheduler.js.map +1 -1
- package/dist/gc/garbageCollection.d.ts +2 -2
- package/dist/gc/garbageCollection.d.ts.map +1 -1
- package/dist/gc/garbageCollection.js +3 -4
- package/dist/gc/garbageCollection.js.map +1 -1
- package/dist/gc/gcConfigs.d.ts.map +1 -1
- package/dist/gc/gcConfigs.js +8 -10
- package/dist/gc/gcConfigs.js.map +1 -1
- package/dist/gc/gcDefinitions.d.ts +3 -3
- package/dist/gc/gcDefinitions.d.ts.map +1 -1
- package/dist/gc/gcDefinitions.js.map +1 -1
- package/dist/gc/gcSummaryStateTracker.d.ts +1 -2
- package/dist/gc/gcSummaryStateTracker.d.ts.map +1 -1
- package/dist/gc/gcSummaryStateTracker.js +6 -6
- package/dist/gc/gcSummaryStateTracker.js.map +1 -1
- package/dist/gc/gcTelemetry.d.ts +5 -5
- package/dist/gc/gcTelemetry.d.ts.map +1 -1
- package/dist/gc/gcTelemetry.js.map +1 -1
- package/dist/id-compressor/idCompressor.d.ts +2 -2
- package/dist/id-compressor/idCompressor.d.ts.map +1 -1
- package/dist/id-compressor/idCompressor.js.map +1 -1
- package/dist/opLifecycle/definitions.d.ts +2 -2
- package/dist/opLifecycle/definitions.d.ts.map +1 -1
- package/dist/opLifecycle/definitions.js.map +1 -1
- package/dist/opLifecycle/opCompressor.d.ts +2 -2
- package/dist/opLifecycle/opCompressor.d.ts.map +1 -1
- package/dist/opLifecycle/opCompressor.js +3 -6
- package/dist/opLifecycle/opCompressor.js.map +1 -1
- package/dist/opLifecycle/opDecompressor.d.ts +2 -2
- package/dist/opLifecycle/opDecompressor.d.ts.map +1 -1
- package/dist/opLifecycle/opDecompressor.js.map +1 -1
- package/dist/opLifecycle/opGroupingManager.d.ts.map +1 -1
- package/dist/opLifecycle/opGroupingManager.js +5 -6
- package/dist/opLifecycle/opGroupingManager.js.map +1 -1
- package/dist/opLifecycle/opSplitter.d.ts +2 -2
- package/dist/opLifecycle/opSplitter.d.ts.map +1 -1
- package/dist/opLifecycle/opSplitter.js +3 -3
- package/dist/opLifecycle/opSplitter.js.map +1 -1
- package/dist/opLifecycle/outbox.d.ts +2 -2
- package/dist/opLifecycle/outbox.d.ts.map +1 -1
- package/dist/opLifecycle/outbox.js +7 -3
- 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 +18 -14
- package/dist/pendingStateManager.d.ts.map +1 -1
- package/dist/pendingStateManager.js +35 -55
- package/dist/pendingStateManager.js.map +1 -1
- package/dist/scheduleManager.d.ts +2 -2
- package/dist/scheduleManager.d.ts.map +1 -1
- package/dist/scheduleManager.js.map +1 -1
- package/dist/summary/orderedClientElection.d.ts +4 -3
- package/dist/summary/orderedClientElection.d.ts.map +1 -1
- package/dist/summary/orderedClientElection.js +3 -18
- package/dist/summary/orderedClientElection.js.map +1 -1
- package/dist/summary/runningSummarizer.d.ts +4 -3
- package/dist/summary/runningSummarizer.d.ts.map +1 -1
- package/dist/summary/runningSummarizer.js +5 -6
- package/dist/summary/runningSummarizer.js.map +1 -1
- package/dist/summary/summarizer.d.ts +2 -3
- package/dist/summary/summarizer.d.ts.map +1 -1
- package/dist/summary/summarizer.js +2 -3
- package/dist/summary/summarizer.js.map +1 -1
- package/dist/summary/summarizerClientElection.d.ts +3 -2
- package/dist/summary/summarizerClientElection.d.ts.map +1 -1
- package/dist/summary/summarizerClientElection.js.map +1 -1
- package/dist/summary/summarizerHeuristics.d.ts +2 -2
- package/dist/summary/summarizerHeuristics.d.ts.map +1 -1
- package/dist/summary/summarizerHeuristics.js.map +1 -1
- package/dist/summary/summarizerNode/summarizerNode.d.ts +10 -9
- package/dist/summary/summarizerNode/summarizerNode.d.ts.map +1 -1
- package/dist/summary/summarizerNode/summarizerNode.js +1 -1
- package/dist/summary/summarizerNode/summarizerNode.js.map +1 -1
- package/dist/summary/summarizerNode/summarizerNodeUtils.d.ts +3 -3
- package/dist/summary/summarizerNode/summarizerNodeUtils.d.ts.map +1 -1
- package/dist/summary/summarizerNode/summarizerNodeUtils.js.map +1 -1
- package/dist/summary/summarizerNode/summarizerNodeWithGc.d.ts +6 -6
- package/dist/summary/summarizerNode/summarizerNodeWithGc.d.ts.map +1 -1
- package/dist/summary/summarizerNode/summarizerNodeWithGc.js +1 -1
- package/dist/summary/summarizerNode/summarizerNodeWithGc.js.map +1 -1
- package/dist/summary/summarizerTypes.d.ts +8 -8
- package/dist/summary/summarizerTypes.d.ts.map +1 -1
- package/dist/summary/summarizerTypes.js.map +1 -1
- package/dist/summary/summaryCollection.d.ts +3 -2
- package/dist/summary/summaryCollection.d.ts.map +1 -1
- package/dist/summary/summaryCollection.js.map +1 -1
- package/dist/summary/summaryGenerator.d.ts +2 -2
- package/dist/summary/summaryGenerator.d.ts.map +1 -1
- package/dist/summary/summaryGenerator.js +1 -1
- package/dist/summary/summaryGenerator.js.map +1 -1
- package/dist/summary/summaryManager.d.ts +3 -2
- package/dist/summary/summaryManager.d.ts.map +1 -1
- package/dist/summary/summaryManager.js.map +1 -1
- package/dist/tsdoc-metadata.json +11 -0
- package/lib/batchTracker.d.ts +4 -4
- package/lib/batchTracker.d.ts.map +1 -1
- package/lib/batchTracker.js +2 -2
- package/lib/batchTracker.js.map +1 -1
- package/lib/blobManager.js +2 -2
- package/lib/blobManager.js.map +1 -1
- package/lib/connectionTelemetry.d.ts +2 -2
- package/lib/connectionTelemetry.d.ts.map +1 -1
- package/lib/connectionTelemetry.js.map +1 -1
- package/lib/containerRuntime.d.ts +12 -11
- package/lib/containerRuntime.d.ts.map +1 -1
- package/lib/containerRuntime.js +42 -15
- package/lib/containerRuntime.js.map +1 -1
- package/lib/dataStore.d.ts +2 -2
- package/lib/dataStore.d.ts.map +1 -1
- package/lib/dataStore.js +1 -1
- package/lib/dataStore.js.map +1 -1
- package/lib/dataStoreContext.d.ts +3 -3
- package/lib/dataStoreContext.d.ts.map +1 -1
- package/lib/dataStoreContext.js +1 -2
- package/lib/dataStoreContext.js.map +1 -1
- package/lib/dataStoreContexts.d.ts.map +1 -1
- package/lib/dataStoreContexts.js.map +1 -1
- package/lib/deltaScheduler.d.ts +2 -2
- package/lib/deltaScheduler.d.ts.map +1 -1
- package/lib/deltaScheduler.js +1 -1
- package/lib/deltaScheduler.js.map +1 -1
- package/lib/gc/garbageCollection.d.ts +2 -2
- package/lib/gc/garbageCollection.d.ts.map +1 -1
- package/lib/gc/garbageCollection.js +3 -4
- package/lib/gc/garbageCollection.js.map +1 -1
- package/lib/gc/gcConfigs.d.ts.map +1 -1
- package/lib/gc/gcConfigs.js +8 -10
- package/lib/gc/gcConfigs.js.map +1 -1
- package/lib/gc/gcDefinitions.d.ts +3 -3
- package/lib/gc/gcDefinitions.d.ts.map +1 -1
- package/lib/gc/gcDefinitions.js.map +1 -1
- package/lib/gc/gcSummaryStateTracker.d.ts +1 -2
- package/lib/gc/gcSummaryStateTracker.d.ts.map +1 -1
- package/lib/gc/gcSummaryStateTracker.js +6 -6
- package/lib/gc/gcSummaryStateTracker.js.map +1 -1
- package/lib/gc/gcTelemetry.d.ts +5 -5
- package/lib/gc/gcTelemetry.d.ts.map +1 -1
- package/lib/gc/gcTelemetry.js +1 -1
- package/lib/gc/gcTelemetry.js.map +1 -1
- package/lib/id-compressor/idCompressor.d.ts +2 -2
- package/lib/id-compressor/idCompressor.d.ts.map +1 -1
- package/lib/id-compressor/idCompressor.js.map +1 -1
- package/lib/opLifecycle/definitions.d.ts +2 -2
- package/lib/opLifecycle/definitions.d.ts.map +1 -1
- package/lib/opLifecycle/definitions.js.map +1 -1
- package/lib/opLifecycle/opCompressor.d.ts +2 -2
- package/lib/opLifecycle/opCompressor.d.ts.map +1 -1
- package/lib/opLifecycle/opCompressor.js +3 -6
- package/lib/opLifecycle/opCompressor.js.map +1 -1
- package/lib/opLifecycle/opDecompressor.d.ts +2 -2
- package/lib/opLifecycle/opDecompressor.d.ts.map +1 -1
- package/lib/opLifecycle/opDecompressor.js.map +1 -1
- package/lib/opLifecycle/opGroupingManager.d.ts.map +1 -1
- package/lib/opLifecycle/opGroupingManager.js +5 -6
- package/lib/opLifecycle/opGroupingManager.js.map +1 -1
- package/lib/opLifecycle/opSplitter.d.ts +2 -2
- package/lib/opLifecycle/opSplitter.d.ts.map +1 -1
- package/lib/opLifecycle/opSplitter.js +3 -3
- package/lib/opLifecycle/opSplitter.js.map +1 -1
- package/lib/opLifecycle/outbox.d.ts +2 -2
- package/lib/opLifecycle/outbox.d.ts.map +1 -1
- package/lib/opLifecycle/outbox.js +7 -3
- 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 +18 -14
- package/lib/pendingStateManager.d.ts.map +1 -1
- package/lib/pendingStateManager.js +35 -55
- package/lib/pendingStateManager.js.map +1 -1
- package/lib/scheduleManager.d.ts +2 -2
- package/lib/scheduleManager.d.ts.map +1 -1
- package/lib/scheduleManager.js.map +1 -1
- package/lib/summary/orderedClientElection.d.ts +4 -3
- package/lib/summary/orderedClientElection.d.ts.map +1 -1
- package/lib/summary/orderedClientElection.js +3 -18
- package/lib/summary/orderedClientElection.js.map +1 -1
- package/lib/summary/runningSummarizer.d.ts +4 -3
- package/lib/summary/runningSummarizer.d.ts.map +1 -1
- package/lib/summary/runningSummarizer.js +5 -6
- package/lib/summary/runningSummarizer.js.map +1 -1
- package/lib/summary/summarizer.d.ts +2 -3
- package/lib/summary/summarizer.d.ts.map +1 -1
- package/lib/summary/summarizer.js +2 -3
- package/lib/summary/summarizer.js.map +1 -1
- package/lib/summary/summarizerClientElection.d.ts +3 -2
- package/lib/summary/summarizerClientElection.d.ts.map +1 -1
- package/lib/summary/summarizerClientElection.js.map +1 -1
- package/lib/summary/summarizerHeuristics.d.ts +2 -2
- package/lib/summary/summarizerHeuristics.d.ts.map +1 -1
- package/lib/summary/summarizerHeuristics.js.map +1 -1
- package/lib/summary/summarizerNode/summarizerNode.d.ts +10 -9
- package/lib/summary/summarizerNode/summarizerNode.d.ts.map +1 -1
- package/lib/summary/summarizerNode/summarizerNode.js +1 -1
- package/lib/summary/summarizerNode/summarizerNode.js.map +1 -1
- package/lib/summary/summarizerNode/summarizerNodeUtils.d.ts +3 -3
- package/lib/summary/summarizerNode/summarizerNodeUtils.d.ts.map +1 -1
- package/lib/summary/summarizerNode/summarizerNodeUtils.js.map +1 -1
- package/lib/summary/summarizerNode/summarizerNodeWithGc.d.ts +6 -6
- package/lib/summary/summarizerNode/summarizerNodeWithGc.d.ts.map +1 -1
- package/lib/summary/summarizerNode/summarizerNodeWithGc.js +1 -1
- package/lib/summary/summarizerNode/summarizerNodeWithGc.js.map +1 -1
- package/lib/summary/summarizerTypes.d.ts +8 -8
- package/lib/summary/summarizerTypes.d.ts.map +1 -1
- package/lib/summary/summarizerTypes.js.map +1 -1
- package/lib/summary/summaryCollection.d.ts +3 -2
- package/lib/summary/summaryCollection.d.ts.map +1 -1
- package/lib/summary/summaryCollection.js.map +1 -1
- package/lib/summary/summaryGenerator.d.ts +2 -2
- package/lib/summary/summaryGenerator.d.ts.map +1 -1
- package/lib/summary/summaryGenerator.js +1 -1
- package/lib/summary/summaryGenerator.js.map +1 -1
- package/lib/summary/summaryManager.d.ts +3 -2
- package/lib/summary/summaryManager.d.ts.map +1 -1
- package/lib/summary/summaryManager.js +1 -1
- package/lib/summary/summaryManager.js.map +1 -1
- package/package.json +22 -39
- package/src/batchTracker.ts +5 -6
- package/src/blobManager.ts +2 -2
- package/src/connectionTelemetry.ts +4 -5
- package/src/containerRuntime.ts +60 -31
- package/src/dataStore.ts +3 -4
- package/src/dataStoreContext.ts +4 -8
- package/src/dataStoreContexts.ts +3 -7
- package/src/deltaScheduler.ts +2 -3
- package/src/gc/garbageCollection.ts +8 -11
- package/src/gc/gcConfigs.ts +12 -11
- package/src/gc/gcDefinitions.ts +3 -3
- package/src/gc/gcSummaryStateTracker.ts +6 -6
- package/src/gc/gcTelemetry.ts +9 -5
- package/src/id-compressor/idCompressor.ts +2 -2
- package/src/opLifecycle/definitions.ts +2 -2
- package/src/opLifecycle/opCompressor.ts +4 -8
- package/src/opLifecycle/opDecompressor.ts +2 -3
- package/src/opLifecycle/opGroupingManager.ts +6 -7
- package/src/opLifecycle/opSplitter.ts +4 -5
- package/src/opLifecycle/outbox.ts +10 -9
- package/src/packageVersion.ts +1 -1
- package/src/pendingStateManager.ts +60 -91
- package/src/scheduleManager.ts +3 -4
- package/src/summary/orderedClientElection.ts +7 -20
- package/src/summary/runningSummarizer.ts +11 -10
- package/src/summary/summarizer.ts +8 -8
- package/src/summary/summarizerClientElection.ts +3 -2
- package/src/summary/summarizerHeuristics.ts +2 -2
- package/src/summary/summarizerNode/summarizerNode.ts +15 -14
- package/src/summary/summarizerNode/summarizerNodeUtils.ts +3 -3
- package/src/summary/summarizerNode/summarizerNodeWithGc.ts +10 -7
- package/src/summary/summarizerTypes.ts +8 -13
- package/src/summary/summaryCollection.ts +3 -2
- package/src/summary/summaryGenerator.ts +7 -3
- package/src/summary/summaryManager.ts +8 -9
package/src/batchTracker.ts
CHANGED
|
@@ -4,20 +4,19 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { EventEmitter } from "events";
|
|
7
|
-
import {
|
|
7
|
+
import { ITelemetryLoggerExt, ChildLogger } from "@fluidframework/telemetry-utils";
|
|
8
8
|
import { assert, performance } from "@fluidframework/common-utils";
|
|
9
9
|
import { ISequencedDocumentMessage } from "@fluidframework/protocol-definitions";
|
|
10
|
-
import { ChildLogger } from "@fluidframework/telemetry-utils";
|
|
11
10
|
|
|
12
11
|
export class BatchTracker {
|
|
13
|
-
private readonly logger:
|
|
12
|
+
private readonly logger: ITelemetryLoggerExt;
|
|
14
13
|
private startBatchSequenceNumber: number | undefined;
|
|
15
14
|
private trackedBatchCount: number = 0;
|
|
16
15
|
private batchProcessingStartTimeStamp: number | undefined;
|
|
17
16
|
|
|
18
17
|
constructor(
|
|
19
18
|
private readonly batchEventEmitter: EventEmitter,
|
|
20
|
-
logger:
|
|
19
|
+
logger: ITelemetryLoggerExt,
|
|
21
20
|
batchLengthThreshold: number,
|
|
22
21
|
batchCountSamplingRate: number,
|
|
23
22
|
dateTimeProvider: () => number = () => performance.now(),
|
|
@@ -72,13 +71,13 @@ export class BatchTracker {
|
|
|
72
71
|
* Track batch sizes in terms of op counts and processing times
|
|
73
72
|
*
|
|
74
73
|
* @param batchEventEmitter - event emitter which tracks the lifecycle of batch operations
|
|
75
|
-
* @param logger - See {@link @fluidframework/common-definitions#
|
|
74
|
+
* @param logger - See {@link @fluidframework/common-definitions#ITelemetryLoggerExt}
|
|
76
75
|
* @param batchLengthThreshold - threshold for the length of a batch when to send an error event
|
|
77
76
|
* @param batchCountSamplingRate - rate for batches for which to send an event with its characteristics
|
|
78
77
|
*/
|
|
79
78
|
export const BindBatchTracker = (
|
|
80
79
|
batchEventEmitter: EventEmitter,
|
|
81
|
-
logger:
|
|
80
|
+
logger: ITelemetryLoggerExt,
|
|
82
81
|
batchLengthThreshold: number = 1000,
|
|
83
82
|
batchCountSamplingRate: number = 1000,
|
|
84
83
|
) => new BatchTracker(batchEventEmitter, logger, batchLengthThreshold, batchCountSamplingRate);
|
package/src/blobManager.ts
CHANGED
|
@@ -61,7 +61,7 @@ export class BlobHandle implements IFluidHandle<ArrayBufferLike> {
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
public get isAttached(): boolean {
|
|
64
|
-
return this.attached;
|
|
64
|
+
return this.routeContext.isAttached && this.attached;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
public readonly absolutePath: string;
|
|
@@ -470,7 +470,7 @@ export class BlobManager extends TypedEventEmitter<IBlobManagerEvents> {
|
|
|
470
470
|
|
|
471
471
|
private onUploadResolve(localId: string, response: ICreateBlobResponseWithTTL) {
|
|
472
472
|
const entry = this.pendingBlobs.get(localId);
|
|
473
|
-
assert(entry !== undefined,
|
|
473
|
+
assert(entry !== undefined, 0x6c8 /* pending blob entry not found for uploaded blob */);
|
|
474
474
|
assert(
|
|
475
475
|
entry.status === PendingBlobStatus.OnlinePendingUpload ||
|
|
476
476
|
entry.status === PendingBlobStatus.OfflinePendingUpload,
|
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
import { ChildLogger, TelemetryLogger } from "@fluidframework/telemetry-utils";
|
|
6
|
+
import { ITelemetryLoggerExt, ChildLogger, TelemetryLogger } from "@fluidframework/telemetry-utils";
|
|
8
7
|
import { IDeltaManager } from "@fluidframework/container-definitions";
|
|
9
8
|
import {
|
|
10
9
|
IDocumentMessage,
|
|
@@ -69,12 +68,12 @@ class OpPerfTelemetry {
|
|
|
69
68
|
private connectionStartTime = 0;
|
|
70
69
|
private gap = 0;
|
|
71
70
|
|
|
72
|
-
private readonly logger:
|
|
71
|
+
private readonly logger: ITelemetryLoggerExt;
|
|
73
72
|
|
|
74
73
|
public constructor(
|
|
75
74
|
private clientId: string | undefined,
|
|
76
75
|
private readonly deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>,
|
|
77
|
-
logger:
|
|
76
|
+
logger: ITelemetryLoggerExt,
|
|
78
77
|
) {
|
|
79
78
|
this.logger = ChildLogger.create(logger, "OpPerf");
|
|
80
79
|
|
|
@@ -314,7 +313,7 @@ export interface IPerfSignalReport {
|
|
|
314
313
|
export function ReportOpPerfTelemetry(
|
|
315
314
|
clientId: string | undefined,
|
|
316
315
|
deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>,
|
|
317
|
-
logger:
|
|
316
|
+
logger: ITelemetryLoggerExt,
|
|
318
317
|
) {
|
|
319
318
|
new OpPerfTelemetry(clientId, deltaManager, logger);
|
|
320
319
|
}
|
package/src/containerRuntime.ts
CHANGED
|
@@ -2,11 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
6
|
-
ITelemetryBaseLogger,
|
|
7
|
-
ITelemetryGenericEvent,
|
|
8
|
-
ITelemetryLogger,
|
|
9
|
-
} from "@fluidframework/common-definitions";
|
|
5
|
+
import { ITelemetryBaseLogger, ITelemetryGenericEvent } from "@fluidframework/common-definitions";
|
|
10
6
|
import {
|
|
11
7
|
FluidObject,
|
|
12
8
|
IFluidHandle,
|
|
@@ -45,6 +41,7 @@ import {
|
|
|
45
41
|
MonitoringContext,
|
|
46
42
|
loggerToMonitoringContext,
|
|
47
43
|
wrapError,
|
|
44
|
+
ITelemetryLoggerExt,
|
|
48
45
|
} from "@fluidframework/telemetry-utils";
|
|
49
46
|
import {
|
|
50
47
|
DriverHeader,
|
|
@@ -584,9 +581,6 @@ export class ContainerRuntime
|
|
|
584
581
|
extends TypedEventEmitter<IContainerRuntimeEvents>
|
|
585
582
|
implements IContainerRuntime, IRuntime, ISummarizerRuntime, ISummarizerInternalsProvider
|
|
586
583
|
{
|
|
587
|
-
public get IContainerRuntime() {
|
|
588
|
-
return this;
|
|
589
|
-
}
|
|
590
584
|
public get IFluidRouter() {
|
|
591
585
|
return this;
|
|
592
586
|
}
|
|
@@ -828,7 +822,7 @@ export class ContainerRuntime
|
|
|
828
822
|
opMetadata: Record<string, unknown> | undefined,
|
|
829
823
|
) => void {
|
|
830
824
|
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
831
|
-
return this.
|
|
825
|
+
return this.reSubmitCore;
|
|
832
826
|
}
|
|
833
827
|
|
|
834
828
|
public get disposeFn(): (error?: ICriticalContainerError) => void {
|
|
@@ -1054,7 +1048,7 @@ export class ContainerRuntime
|
|
|
1054
1048
|
dataStoreAliasMap: [string, string][],
|
|
1055
1049
|
private readonly runtimeOptions: Readonly<Required<IContainerRuntimeOptions>>,
|
|
1056
1050
|
private readonly containerScope: FluidObject,
|
|
1057
|
-
public readonly logger:
|
|
1051
|
+
public readonly logger: ITelemetryLoggerExt,
|
|
1058
1052
|
existing: boolean,
|
|
1059
1053
|
blobManagerSnapshot: IBlobManagerLoadInfo,
|
|
1060
1054
|
private readonly _storage: IDocumentStorageService,
|
|
@@ -1305,7 +1299,6 @@ export class ContainerRuntime
|
|
|
1305
1299
|
close: this.closeFn,
|
|
1306
1300
|
connected: () => this.connected,
|
|
1307
1301
|
reSubmit: this.reSubmit.bind(this),
|
|
1308
|
-
rollback: this.rollback.bind(this),
|
|
1309
1302
|
orderSequentially: this.orderSequentially.bind(this),
|
|
1310
1303
|
},
|
|
1311
1304
|
pendingRuntimeState?.pending,
|
|
@@ -1762,8 +1755,14 @@ export class ContainerRuntime
|
|
|
1762
1755
|
return this.consecutiveReconnects < this.maxConsecutiveReconnects;
|
|
1763
1756
|
}
|
|
1764
1757
|
|
|
1765
|
-
private resetReconnectCount() {
|
|
1766
|
-
|
|
1758
|
+
private resetReconnectCount(message?: ISequencedDocumentMessage) {
|
|
1759
|
+
// Chunked ops don't count towards making progress as they are sent
|
|
1760
|
+
// in their own batches before the originating batch is sent.
|
|
1761
|
+
// Therefore, receiving them while attempting to send the originating batch
|
|
1762
|
+
// does not mean that the container is making any progress.
|
|
1763
|
+
if (message?.type !== ContainerMessageType.ChunkedOp) {
|
|
1764
|
+
this.consecutiveReconnects = 0;
|
|
1765
|
+
}
|
|
1767
1766
|
}
|
|
1768
1767
|
|
|
1769
1768
|
private replayPendingStates() {
|
|
@@ -1812,7 +1811,23 @@ export class ContainerRuntime
|
|
|
1812
1811
|
this.idCompressor = IdCompressor.deserialize(op.stashedState);
|
|
1813
1812
|
}
|
|
1814
1813
|
|
|
1815
|
-
|
|
1814
|
+
/**
|
|
1815
|
+
* Parse an op's type and actual content from given serialized content
|
|
1816
|
+
* ! Note: this format needs to be in-line with what is set in the "ContainerRuntime.submit(...)" method
|
|
1817
|
+
*/
|
|
1818
|
+
private parseOpContent(serializedContent?: string): {
|
|
1819
|
+
type: ContainerMessageType;
|
|
1820
|
+
contents: unknown;
|
|
1821
|
+
} {
|
|
1822
|
+
assert(serializedContent !== undefined, 0x6d5 /* content must be defined */);
|
|
1823
|
+
const parsed = JSON.parse(serializedContent);
|
|
1824
|
+
assert(parsed.type !== undefined, 0x6d6 /* incorrect op content format */);
|
|
1825
|
+
return { type: parsed.type as ContainerMessageType, contents: parsed.contents };
|
|
1826
|
+
}
|
|
1827
|
+
|
|
1828
|
+
private async applyStashedOp(op: string): Promise<unknown> {
|
|
1829
|
+
// Need to parse from string for back-compat
|
|
1830
|
+
const { type, contents } = this.parseOpContent(op);
|
|
1816
1831
|
switch (type) {
|
|
1817
1832
|
case ContainerMessageType.FluidDataStoreOp:
|
|
1818
1833
|
return this.dataStores.applyStashedOp(contents as IEnvelope);
|
|
@@ -2028,7 +2043,7 @@ export class ContainerRuntime
|
|
|
2028
2043
|
// If we have processed a local op, this means that the container is
|
|
2029
2044
|
// making progress and we can reset the counter for how many times
|
|
2030
2045
|
// we have consecutively replayed the pending states
|
|
2031
|
-
this.resetReconnectCount();
|
|
2046
|
+
this.resetReconnectCount(message);
|
|
2032
2047
|
}
|
|
2033
2048
|
} catch (e) {
|
|
2034
2049
|
this.scheduleManager.afterOpProcessing(e, message);
|
|
@@ -2152,11 +2167,7 @@ export class ContainerRuntime
|
|
|
2152
2167
|
// This will throw and close the container if rollback fails
|
|
2153
2168
|
try {
|
|
2154
2169
|
checkpoint.rollback((message: BatchMessage) =>
|
|
2155
|
-
this.rollback(
|
|
2156
|
-
message.deserializedContent.type,
|
|
2157
|
-
message.deserializedContent.contents,
|
|
2158
|
-
message.localOpMetadata,
|
|
2159
|
-
),
|
|
2170
|
+
this.rollback(message.contents, message.localOpMetadata),
|
|
2160
2171
|
);
|
|
2161
2172
|
} catch (err) {
|
|
2162
2173
|
const error2 = wrapError(err, (message) => {
|
|
@@ -2409,7 +2420,7 @@ export class ContainerRuntime
|
|
|
2409
2420
|
/** True to track the state for this summary in the SummarizerNodes; defaults to true */
|
|
2410
2421
|
trackState?: boolean;
|
|
2411
2422
|
/** Logger to use for correlated summary events */
|
|
2412
|
-
summaryLogger?:
|
|
2423
|
+
summaryLogger?: ITelemetryLoggerExt;
|
|
2413
2424
|
/** True to run garbage collection before summarizing; defaults to true */
|
|
2414
2425
|
runGC?: boolean;
|
|
2415
2426
|
/** True to generate full GC data */
|
|
@@ -2626,7 +2637,7 @@ export class ContainerRuntime
|
|
|
2626
2637
|
public async collectGarbage(
|
|
2627
2638
|
options: {
|
|
2628
2639
|
/** Logger to use for logging GC events */
|
|
2629
|
-
logger?:
|
|
2640
|
+
logger?: ITelemetryLoggerExt;
|
|
2630
2641
|
/** True to run GC sweep phase after the mark phase */
|
|
2631
2642
|
runSweep?: boolean;
|
|
2632
2643
|
/** True to generate full GC data */
|
|
@@ -2973,10 +2984,10 @@ export class ContainerRuntime
|
|
|
2973
2984
|
};
|
|
2974
2985
|
idAllocationBatchMessage = {
|
|
2975
2986
|
contents: JSON.stringify(idAllocationMessage),
|
|
2976
|
-
deserializedContent: idAllocationMessage,
|
|
2977
2987
|
referenceSequenceNumber: this.deltaManager.lastSequenceNumber,
|
|
2978
2988
|
metadata: undefined,
|
|
2979
2989
|
localOpMetadata: this.idCompressor?.serialize(true),
|
|
2990
|
+
type: ContainerMessageType.IdAllocation,
|
|
2980
2991
|
};
|
|
2981
2992
|
}
|
|
2982
2993
|
|
|
@@ -3014,7 +3025,7 @@ export class ContainerRuntime
|
|
|
3014
3025
|
|
|
3015
3026
|
const message: BatchMessage = {
|
|
3016
3027
|
contents: serializedContent,
|
|
3017
|
-
|
|
3028
|
+
type,
|
|
3018
3029
|
metadata,
|
|
3019
3030
|
localOpMetadata,
|
|
3020
3031
|
referenceSequenceNumber: this.deltaManager.lastSequenceNumber,
|
|
@@ -3169,13 +3180,23 @@ export class ContainerRuntime
|
|
|
3169
3180
|
}
|
|
3170
3181
|
}
|
|
3171
3182
|
|
|
3183
|
+
private reSubmit(
|
|
3184
|
+
content: string,
|
|
3185
|
+
localOpMetadata: unknown,
|
|
3186
|
+
opMetadata: Record<string, unknown> | undefined,
|
|
3187
|
+
) {
|
|
3188
|
+
// Need to parse from string for back-compat
|
|
3189
|
+
const { contents, type } = this.parseOpContent(content);
|
|
3190
|
+
this.reSubmitCore(type, contents, localOpMetadata, opMetadata);
|
|
3191
|
+
}
|
|
3192
|
+
|
|
3172
3193
|
/**
|
|
3173
3194
|
* Finds the right store and asks it to resubmit the message. This typically happens when we
|
|
3174
3195
|
* reconnect and there are pending messages.
|
|
3175
3196
|
* @param content - The content of the original message.
|
|
3176
3197
|
* @param localOpMetadata - The local metadata associated with the original message.
|
|
3177
3198
|
*/
|
|
3178
|
-
private
|
|
3199
|
+
private reSubmitCore(
|
|
3179
3200
|
type: ContainerMessageType,
|
|
3180
3201
|
content: any,
|
|
3181
3202
|
localOpMetadata: unknown,
|
|
@@ -3189,7 +3210,13 @@ export class ContainerRuntime
|
|
|
3189
3210
|
break;
|
|
3190
3211
|
case ContainerMessageType.Attach:
|
|
3191
3212
|
case ContainerMessageType.Alias:
|
|
3213
|
+
this.submit(type, content, localOpMetadata);
|
|
3214
|
+
break;
|
|
3192
3215
|
case ContainerMessageType.IdAllocation:
|
|
3216
|
+
// Remove the stashedState from the op if it's a stashed op
|
|
3217
|
+
if (content.stashedState !== undefined) {
|
|
3218
|
+
delete content.stashedState;
|
|
3219
|
+
}
|
|
3193
3220
|
this.submit(type, content, localOpMetadata);
|
|
3194
3221
|
break;
|
|
3195
3222
|
case ContainerMessageType.ChunkedOp:
|
|
@@ -3205,12 +3232,14 @@ export class ContainerRuntime
|
|
|
3205
3232
|
}
|
|
3206
3233
|
}
|
|
3207
3234
|
|
|
3208
|
-
private rollback(
|
|
3235
|
+
private rollback(content: string | undefined, localOpMetadata: unknown) {
|
|
3236
|
+
// Need to parse from string for back-compat
|
|
3237
|
+
const { type, contents } = this.parseOpContent(content);
|
|
3209
3238
|
switch (type) {
|
|
3210
3239
|
case ContainerMessageType.FluidDataStoreOp:
|
|
3211
3240
|
// For operations, call rollbackDataStoreOp which will find the right store
|
|
3212
3241
|
// and trigger rollback on it.
|
|
3213
|
-
this.dataStores.rollbackDataStoreOp(
|
|
3242
|
+
this.dataStores.rollbackDataStoreOp(contents as IEnvelope, localOpMetadata);
|
|
3214
3243
|
break;
|
|
3215
3244
|
default:
|
|
3216
3245
|
throw new Error(`Can't rollback ${type}`);
|
|
@@ -3219,7 +3248,7 @@ export class ContainerRuntime
|
|
|
3219
3248
|
|
|
3220
3249
|
private async waitForDeltaManagerToCatchup(
|
|
3221
3250
|
latestSnapshotRefSeq: number,
|
|
3222
|
-
summaryLogger:
|
|
3251
|
+
summaryLogger: ITelemetryLoggerExt,
|
|
3223
3252
|
): Promise<void> {
|
|
3224
3253
|
if (latestSnapshotRefSeq > this.deltaManager.lastSequenceNumber) {
|
|
3225
3254
|
// We need to catch up to the latest summary's reference sequence number before proceeding.
|
|
@@ -3331,7 +3360,7 @@ export class ContainerRuntime
|
|
|
3331
3360
|
* @returns downloaded snapshot's reference sequence number
|
|
3332
3361
|
*/
|
|
3333
3362
|
private async refreshLatestSummaryAckFromServer(
|
|
3334
|
-
summaryLogger:
|
|
3363
|
+
summaryLogger: ITelemetryLoggerExt,
|
|
3335
3364
|
): Promise<{ latestSnapshotRefSeq: number; latestSnapshotVersionId: string | undefined }> {
|
|
3336
3365
|
const readAndParseBlob = async <T>(id: string) => readAndParse<T>(this.storage, id);
|
|
3337
3366
|
const { snapshotTree, versionId, latestSnapshotRefSeq } =
|
|
@@ -3365,7 +3394,7 @@ export class ContainerRuntime
|
|
|
3365
3394
|
}
|
|
3366
3395
|
|
|
3367
3396
|
private async fetchLatestSnapshotFromStorage(
|
|
3368
|
-
logger:
|
|
3397
|
+
logger: ITelemetryLoggerExt,
|
|
3369
3398
|
event: ITelemetryGenericEvent,
|
|
3370
3399
|
readAndParseBlob: ReadAndParseBlob,
|
|
3371
3400
|
): Promise<{ snapshotTree: ISnapshotTree; versionId: string; latestSnapshotRefSeq: number }> {
|
|
@@ -3373,7 +3402,7 @@ export class ContainerRuntime
|
|
|
3373
3402
|
}
|
|
3374
3403
|
|
|
3375
3404
|
private async fetchSnapshotFromStorage(
|
|
3376
|
-
logger:
|
|
3405
|
+
logger: ITelemetryLoggerExt,
|
|
3377
3406
|
event: ITelemetryGenericEvent,
|
|
3378
3407
|
readAndParseBlob: ReadAndParseBlob,
|
|
3379
3408
|
versionId: string | null,
|
package/src/dataStore.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import { ITelemetryLoggerExt, TelemetryDataTag } from "@fluidframework/telemetry-utils";
|
|
7
7
|
import { assert, unreachableCase } from "@fluidframework/common-utils";
|
|
8
8
|
import { AttachState } from "@fluidframework/container-definitions";
|
|
9
9
|
import { UsageError } from "@fluidframework/container-utils";
|
|
@@ -13,7 +13,6 @@ import {
|
|
|
13
13
|
IDataStore,
|
|
14
14
|
IFluidDataStoreChannel,
|
|
15
15
|
} from "@fluidframework/runtime-definitions";
|
|
16
|
-
import { TelemetryDataTag } from "@fluidframework/telemetry-utils";
|
|
17
16
|
import { ContainerRuntime } from "./containerRuntime";
|
|
18
17
|
import { DataStores } from "./dataStores";
|
|
19
18
|
|
|
@@ -48,7 +47,7 @@ export const channelToDataStore = (
|
|
|
48
47
|
internalId: string,
|
|
49
48
|
runtime: ContainerRuntime,
|
|
50
49
|
datastores: DataStores,
|
|
51
|
-
logger:
|
|
50
|
+
logger: ITelemetryLoggerExt,
|
|
52
51
|
): IDataStore => new DataStore(fluidDataStoreChannel, internalId, runtime, datastores, logger);
|
|
53
52
|
|
|
54
53
|
enum AliasState {
|
|
@@ -175,7 +174,7 @@ class DataStore implements IDataStore {
|
|
|
175
174
|
private readonly internalId: string,
|
|
176
175
|
private readonly runtime: ContainerRuntime,
|
|
177
176
|
private readonly datastores: DataStores,
|
|
178
|
-
private readonly logger:
|
|
177
|
+
private readonly logger: ITelemetryLoggerExt,
|
|
179
178
|
) {
|
|
180
179
|
this.pendingAliases = datastores.pendingAliases;
|
|
181
180
|
}
|
package/src/dataStoreContext.ts
CHANGED
|
@@ -3,11 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
IDisposable,
|
|
8
|
-
ITelemetryLogger,
|
|
9
|
-
ITelemetryProperties,
|
|
10
|
-
} from "@fluidframework/common-definitions";
|
|
6
|
+
import { IDisposable, ITelemetryProperties } from "@fluidframework/common-definitions";
|
|
11
7
|
import { FluidObject, IRequest, IResponse, IFluidHandle } from "@fluidframework/core-interfaces";
|
|
12
8
|
import {
|
|
13
9
|
IAudience,
|
|
@@ -17,8 +13,7 @@ import {
|
|
|
17
13
|
} from "@fluidframework/container-definitions";
|
|
18
14
|
import { assert, Deferred, LazyPromise, TypedEventEmitter } from "@fluidframework/common-utils";
|
|
19
15
|
import { IDocumentStorageService } from "@fluidframework/driver-definitions";
|
|
20
|
-
import { readAndParse } from "@fluidframework/driver-utils";
|
|
21
|
-
import { BlobTreeEntry } from "@fluidframework/protocol-base";
|
|
16
|
+
import { BlobTreeEntry, readAndParse } from "@fluidframework/driver-utils";
|
|
22
17
|
import {
|
|
23
18
|
IClientDetails,
|
|
24
19
|
IDocumentMessage,
|
|
@@ -60,6 +55,7 @@ import {
|
|
|
60
55
|
import {
|
|
61
56
|
ChildLogger,
|
|
62
57
|
generateStack,
|
|
58
|
+
ITelemetryLoggerExt,
|
|
63
59
|
loggerToMonitoringContext,
|
|
64
60
|
LoggingError,
|
|
65
61
|
MonitoringContext,
|
|
@@ -163,7 +159,7 @@ export abstract class FluidDataStoreContext
|
|
|
163
159
|
return this._containerRuntime.clientDetails;
|
|
164
160
|
}
|
|
165
161
|
|
|
166
|
-
public get logger():
|
|
162
|
+
public get logger(): ITelemetryLoggerExt {
|
|
167
163
|
return this._containerRuntime.logger;
|
|
168
164
|
}
|
|
169
165
|
|
package/src/dataStoreContexts.ts
CHANGED
|
@@ -3,13 +3,9 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
IDisposable,
|
|
8
|
-
ITelemetryBaseLogger,
|
|
9
|
-
ITelemetryLogger,
|
|
10
|
-
} from "@fluidframework/common-definitions";
|
|
6
|
+
import { IDisposable, ITelemetryBaseLogger } from "@fluidframework/common-definitions";
|
|
11
7
|
import { assert, Deferred, Lazy } from "@fluidframework/common-utils";
|
|
12
|
-
import { ChildLogger } from "@fluidframework/telemetry-utils";
|
|
8
|
+
import { ChildLogger, ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
|
|
13
9
|
import { FluidDataStoreContext, LocalFluidDataStoreContext } from "./dataStoreContext";
|
|
14
10
|
|
|
15
11
|
export class DataStoreContexts implements Iterable<[string, FluidDataStoreContext]>, IDisposable {
|
|
@@ -46,7 +42,7 @@ export class DataStoreContexts implements Iterable<[string, FluidDataStoreContex
|
|
|
46
42
|
}
|
|
47
43
|
});
|
|
48
44
|
|
|
49
|
-
private readonly _logger:
|
|
45
|
+
private readonly _logger: ITelemetryLoggerExt;
|
|
50
46
|
|
|
51
47
|
constructor(baseLogger: ITelemetryBaseLogger) {
|
|
52
48
|
this._logger = ChildLogger.create(baseLogger);
|
package/src/deltaScheduler.ts
CHANGED
|
@@ -3,12 +3,11 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import { ITelemetryLoggerExt, TelemetryLogger } from "@fluidframework/telemetry-utils";
|
|
7
7
|
import { performance } from "@fluidframework/common-utils";
|
|
8
8
|
import { IDeltaManager } from "@fluidframework/container-definitions";
|
|
9
9
|
import { IDocumentMessage, ISequencedDocumentMessage } from "@fluidframework/protocol-definitions";
|
|
10
10
|
|
|
11
|
-
import { TelemetryLogger } from "@fluidframework/telemetry-utils";
|
|
12
11
|
/**
|
|
13
12
|
* DeltaScheduler is responsible for the scheduling of inbound delta queue in cases where there
|
|
14
13
|
* is more than one op a particular run of the queue. It does not schedule if there is just one
|
|
@@ -52,7 +51,7 @@ export class DeltaScheduler {
|
|
|
52
51
|
|
|
53
52
|
constructor(
|
|
54
53
|
deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>,
|
|
55
|
-
private readonly logger:
|
|
54
|
+
private readonly logger: ITelemetryLoggerExt,
|
|
56
55
|
) {
|
|
57
56
|
this.deltaManager = deltaManager;
|
|
58
57
|
this.deltaManager.inbound.on("idle", () => {
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { ITelemetryLogger } from "@fluidframework/common-definitions";
|
|
7
6
|
import { LazyPromise, Timer } from "@fluidframework/common-utils";
|
|
8
7
|
import { ClientSessionExpiredError, DataProcessingError } from "@fluidframework/container-utils";
|
|
9
8
|
import { IRequestHeader } from "@fluidframework/core-interfaces";
|
|
@@ -17,6 +16,7 @@ import {
|
|
|
17
16
|
import { ReadAndParseBlob } from "@fluidframework/runtime-utils";
|
|
18
17
|
import {
|
|
19
18
|
ChildLogger,
|
|
19
|
+
ITelemetryLoggerExt,
|
|
20
20
|
loggerToMonitoringContext,
|
|
21
21
|
MonitoringContext,
|
|
22
22
|
PerformanceEvent,
|
|
@@ -202,10 +202,7 @@ export class GarbageCollector implements IGarbageCollector {
|
|
|
202
202
|
// in the snapshot cannot be interpreted correctly. Set everything to undefined except for
|
|
203
203
|
// deletedNodes because irrespective of GC versions, these nodes have been deleted and cannot be
|
|
204
204
|
// brought back. The deletedNodes info is needed to identify when these nodes are used.
|
|
205
|
-
if (
|
|
206
|
-
this.configs.gcVersionInBaseSnapshot !==
|
|
207
|
-
this.summaryStateTracker.currentGCVersion
|
|
208
|
-
) {
|
|
205
|
+
if (this.configs.gcVersionInEffect !== this.configs.gcVersionInBaseSnapshot) {
|
|
209
206
|
return {
|
|
210
207
|
gcState: undefined,
|
|
211
208
|
tombstones: undefined,
|
|
@@ -449,7 +446,7 @@ export class GarbageCollector implements IGarbageCollector {
|
|
|
449
446
|
public async collectGarbage(
|
|
450
447
|
options: {
|
|
451
448
|
/** Logger to use for logging GC events */
|
|
452
|
-
logger?:
|
|
449
|
+
logger?: ITelemetryLoggerExt;
|
|
453
450
|
/** True to run GC sweep phase after the mark phase */
|
|
454
451
|
runSweep?: boolean;
|
|
455
452
|
/** True to generate full GC data */
|
|
@@ -531,7 +528,7 @@ export class GarbageCollector implements IGarbageCollector {
|
|
|
531
528
|
private async runGC(
|
|
532
529
|
fullGC: boolean,
|
|
533
530
|
currentReferenceTimestampMs: number,
|
|
534
|
-
logger:
|
|
531
|
+
logger: ITelemetryLoggerExt,
|
|
535
532
|
): Promise<IGCStats> {
|
|
536
533
|
// 1. Generate / analyze the runtime's reference graph.
|
|
537
534
|
// Get the reference graph (gcData) and run GC algorithm to get referenced / unreferenced nodes.
|
|
@@ -644,7 +641,7 @@ export class GarbageCollector implements IGarbageCollector {
|
|
|
644
641
|
gcResult: IGCResult,
|
|
645
642
|
sweepReadyNodes: string[],
|
|
646
643
|
currentReferenceTimestampMs: number,
|
|
647
|
-
logger:
|
|
644
|
+
logger: ITelemetryLoggerExt,
|
|
648
645
|
): string[] {
|
|
649
646
|
// Log events for objects that are ready to be deleted by sweep. This will give us data on sweep when
|
|
650
647
|
// its not enabled.
|
|
@@ -722,7 +719,7 @@ export class GarbageCollector implements IGarbageCollector {
|
|
|
722
719
|
private findAllNodesReferencedBetweenGCs(
|
|
723
720
|
currentGCData: IGarbageCollectionData,
|
|
724
721
|
previousGCData: IGarbageCollectionData | undefined,
|
|
725
|
-
logger:
|
|
722
|
+
logger: ITelemetryLoggerExt,
|
|
726
723
|
): string[] | undefined {
|
|
727
724
|
// If we haven't run GC before there is nothing to do.
|
|
728
725
|
// No previousGCData, means nothing is unreferenced, and there are no reference state trackers to clear
|
|
@@ -823,10 +820,10 @@ export class GarbageCollector implements IGarbageCollector {
|
|
|
823
820
|
public getMetadata(): IGCMetadata {
|
|
824
821
|
return {
|
|
825
822
|
/**
|
|
826
|
-
* If GC is enabled, the GC data is written using the
|
|
823
|
+
* If GC is enabled, the GC data is written using the GC version in effect and that is the gcFeature that goes
|
|
827
824
|
* into the metadata blob. If GC is disabled, the gcFeature is 0.
|
|
828
825
|
*/
|
|
829
|
-
gcFeature: this.configs.gcEnabled ? this.
|
|
826
|
+
gcFeature: this.configs.gcEnabled ? this.configs.gcVersionInEffect : 0,
|
|
830
827
|
gcFeatureMatrix: this.configs.persistedGcFeatureMatrix,
|
|
831
828
|
sessionExpiryTimeoutMs: this.configs.sessionExpiryTimeoutMs,
|
|
832
829
|
sweepEnabled: false, // DEPRECATED - to be removed
|
package/src/gc/gcConfigs.ts
CHANGED
|
@@ -106,21 +106,26 @@ export function generateGCConfigs(
|
|
|
106
106
|
createParams.gcOptions[gcSweepGenerationOptionName] /* currentGeneration */,
|
|
107
107
|
);
|
|
108
108
|
|
|
109
|
+
// If version upgrade is not enabled, fall back to the stable GC version.
|
|
110
|
+
const gcVersionInEffect =
|
|
111
|
+
mc.config.getBoolean(gcVersionUpgradeToV3Key) === true ? currentGCVersion : stableGCVersion;
|
|
112
|
+
|
|
113
|
+
// The GC version is up-to-date if the GC version in effect is at least equal to the GC version in base snapshot.
|
|
114
|
+
// If it is not up-to-date, there is a newer version of GC out there which is more reliable than this. So, GC
|
|
115
|
+
// should not run as it may produce incorrect / unreliable state.
|
|
116
|
+
const isGCVersionUpToDate =
|
|
117
|
+
gcVersionInBaseSnapshot === undefined || gcVersionInEffect >= gcVersionInBaseSnapshot;
|
|
118
|
+
|
|
109
119
|
/**
|
|
110
120
|
* Whether GC should run or not. The following conditions have to be met to run sweep:
|
|
111
|
-
*
|
|
112
121
|
* 1. GC should be enabled for this container.
|
|
113
|
-
*
|
|
114
122
|
* 2. GC should not be disabled via disableGC GC option.
|
|
115
|
-
*
|
|
123
|
+
* 3. The current GC version should be greater of equal to the GC version in the base snapshot.
|
|
116
124
|
* These conditions can be overridden via runGCKey feature flag.
|
|
117
125
|
*/
|
|
118
126
|
const shouldRunGC =
|
|
119
127
|
mc.config.getBoolean(runGCKey) ??
|
|
120
|
-
|
|
121
|
-
(gcEnabled &&
|
|
122
|
-
// GC must not be disabled via GC options.
|
|
123
|
-
!createParams.gcOptions.disableGC);
|
|
128
|
+
(gcEnabled && !createParams.gcOptions.disableGC && isGCVersionUpToDate);
|
|
124
129
|
|
|
125
130
|
/**
|
|
126
131
|
* Whether sweep should run or not. The following conditions have to be met to run sweep:
|
|
@@ -156,10 +161,6 @@ export function generateGCConfigs(
|
|
|
156
161
|
const tombstoneMode = !shouldRunSweep && mc.config.getBoolean(disableTombstoneKey) !== true;
|
|
157
162
|
const runFullGC = createParams.gcOptions.runFullGC;
|
|
158
163
|
|
|
159
|
-
// If version upgrade is not enabled, fall back to the stable GC version.
|
|
160
|
-
const gcVersionInEffect =
|
|
161
|
-
mc.config.getBoolean(gcVersionUpgradeToV3Key) === true ? currentGCVersion : stableGCVersion;
|
|
162
|
-
|
|
163
164
|
return {
|
|
164
165
|
gcEnabled,
|
|
165
166
|
sweepEnabled,
|
package/src/gc/gcDefinitions.ts
CHANGED
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
ITelemetryContext,
|
|
14
14
|
} from "@fluidframework/runtime-definitions";
|
|
15
15
|
import { ReadAndParseBlob } from "@fluidframework/runtime-utils";
|
|
16
|
-
import {
|
|
16
|
+
import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
|
|
17
17
|
import {
|
|
18
18
|
IContainerRuntimeMetadata,
|
|
19
19
|
ICreateContainerMetadata,
|
|
@@ -211,7 +211,7 @@ export interface IGarbageCollector {
|
|
|
211
211
|
/** Run garbage collection and update the reference / used state of the system. */
|
|
212
212
|
collectGarbage(
|
|
213
213
|
options: {
|
|
214
|
-
logger?:
|
|
214
|
+
logger?: ITelemetryLoggerExt;
|
|
215
215
|
runSweep?: boolean;
|
|
216
216
|
fullGC?: boolean;
|
|
217
217
|
},
|
|
@@ -253,7 +253,7 @@ export interface IGarbageCollector {
|
|
|
253
253
|
export interface IGarbageCollectorCreateParams {
|
|
254
254
|
readonly runtime: IGarbageCollectionRuntime;
|
|
255
255
|
readonly gcOptions: IGCRuntimeOptions;
|
|
256
|
-
readonly baseLogger:
|
|
256
|
+
readonly baseLogger: ITelemetryLoggerExt;
|
|
257
257
|
readonly existing: boolean;
|
|
258
258
|
readonly metadata: IContainerRuntimeMetadata | undefined;
|
|
259
259
|
readonly createContainerMetadata: ICreateContainerMetadata;
|
|
@@ -37,8 +37,6 @@ export interface IGCSummaryTrackingData {
|
|
|
37
37
|
* On summarize, it decides whether to write new state or re-use previous summary's state.
|
|
38
38
|
*/
|
|
39
39
|
export class GCSummaryStateTracker {
|
|
40
|
-
// The current version of GC running.
|
|
41
|
-
public readonly currentGCVersion: GCVersion = this.configs.gcVersionInEffect;
|
|
42
40
|
// This is the version of GC data in the latest summary being tracked.
|
|
43
41
|
private latestSummaryGCVersion: GCVersion;
|
|
44
42
|
|
|
@@ -66,7 +64,8 @@ export class GCSummaryStateTracker {
|
|
|
66
64
|
this.wasGCRunInLatestSummary = wasGCRunInBaseSnapshot;
|
|
67
65
|
// For existing document, the latest summary is the one that we loaded from. So, use its GC version as the
|
|
68
66
|
// latest tracked GC version. For new documents, we will be writing the first summary with the current version.
|
|
69
|
-
this.latestSummaryGCVersion =
|
|
67
|
+
this.latestSummaryGCVersion =
|
|
68
|
+
this.configs.gcVersionInBaseSnapshot ?? this.configs.gcVersionInEffect;
|
|
70
69
|
}
|
|
71
70
|
|
|
72
71
|
/**
|
|
@@ -105,7 +104,8 @@ export class GCSummaryStateTracker {
|
|
|
105
104
|
public get doesSummaryStateNeedReset(): boolean {
|
|
106
105
|
return (
|
|
107
106
|
this.doesGCStateNeedReset ||
|
|
108
|
-
(this.configs.shouldRunGC &&
|
|
107
|
+
(this.configs.shouldRunGC &&
|
|
108
|
+
this.latestSummaryGCVersion !== this.configs.gcVersionInEffect)
|
|
109
109
|
);
|
|
110
110
|
}
|
|
111
111
|
|
|
@@ -287,7 +287,7 @@ export class GCSummaryStateTracker {
|
|
|
287
287
|
// If the summary was tracked by this client, it was the one that generated the summary in the first place.
|
|
288
288
|
// Update latest state from pending.
|
|
289
289
|
if (result.wasSummaryTracked) {
|
|
290
|
-
this.latestSummaryGCVersion = this.
|
|
290
|
+
this.latestSummaryGCVersion = this.configs.gcVersionInEffect;
|
|
291
291
|
this.latestSummaryData = this.pendingSummaryData;
|
|
292
292
|
this.pendingSummaryData = undefined;
|
|
293
293
|
this.updatedDSCountSinceLastSummary = 0;
|
|
@@ -316,7 +316,7 @@ export class GCSummaryStateTracker {
|
|
|
316
316
|
// in the snapshot cannot be interpreted correctly. Set everything to undefined except for deletedNodes
|
|
317
317
|
// because irrespective of GC versions, these nodes have been deleted and cannot be brought back. The
|
|
318
318
|
// deletedNodes info is needed to identify when these nodes are used.
|
|
319
|
-
if (getGCVersion(metadata) !== this.
|
|
319
|
+
if (getGCVersion(metadata) !== this.configs.gcVersionInEffect) {
|
|
320
320
|
snapshotData = {
|
|
321
321
|
gcState: undefined,
|
|
322
322
|
tombstones: undefined,
|