@fluidframework/container-runtime 0.58.3000-61081 → 0.59.1000-61898
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 +13 -1
- package/dist/blobManager.d.ts.map +1 -1
- package/dist/blobManager.js +52 -0
- package/dist/blobManager.js.map +1 -1
- package/dist/connectionTelemetry.js +7 -7
- package/dist/connectionTelemetry.js.map +1 -1
- package/dist/containerRuntime.d.ts +27 -3
- package/dist/containerRuntime.d.ts.map +1 -1
- package/dist/containerRuntime.js +100 -14
- package/dist/containerRuntime.js.map +1 -1
- package/dist/dataStore.js +8 -1
- package/dist/dataStore.js.map +1 -1
- package/dist/dataStoreContext.d.ts +9 -3
- package/dist/dataStoreContext.d.ts.map +1 -1
- package/dist/dataStoreContext.js +22 -6
- package/dist/dataStoreContext.js.map +1 -1
- package/dist/dataStores.d.ts +13 -5
- package/dist/dataStores.d.ts.map +1 -1
- package/dist/dataStores.js +39 -18
- package/dist/dataStores.js.map +1 -1
- package/dist/deltaScheduler.d.ts +4 -5
- package/dist/deltaScheduler.d.ts.map +1 -1
- package/dist/deltaScheduler.js +54 -35
- package/dist/deltaScheduler.js.map +1 -1
- package/dist/garbageCollection.d.ts +31 -27
- package/dist/garbageCollection.d.ts.map +1 -1
- package/dist/garbageCollection.js +76 -75
- package/dist/garbageCollection.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/lib/blobManager.d.ts +13 -1
- package/lib/blobManager.d.ts.map +1 -1
- package/lib/blobManager.js +52 -0
- package/lib/blobManager.js.map +1 -1
- package/lib/connectionTelemetry.js +7 -7
- package/lib/connectionTelemetry.js.map +1 -1
- package/lib/containerRuntime.d.ts +27 -3
- package/lib/containerRuntime.d.ts.map +1 -1
- package/lib/containerRuntime.js +101 -15
- package/lib/containerRuntime.js.map +1 -1
- package/lib/dataStore.js +8 -1
- package/lib/dataStore.js.map +1 -1
- package/lib/dataStoreContext.d.ts +9 -3
- package/lib/dataStoreContext.d.ts.map +1 -1
- package/lib/dataStoreContext.js +22 -6
- package/lib/dataStoreContext.js.map +1 -1
- package/lib/dataStores.d.ts +13 -5
- package/lib/dataStores.d.ts.map +1 -1
- package/lib/dataStores.js +39 -18
- package/lib/dataStores.js.map +1 -1
- package/lib/deltaScheduler.d.ts +4 -5
- package/lib/deltaScheduler.d.ts.map +1 -1
- package/lib/deltaScheduler.js +54 -35
- package/lib/deltaScheduler.js.map +1 -1
- package/lib/garbageCollection.d.ts +31 -27
- package/lib/garbageCollection.d.ts.map +1 -1
- package/lib/garbageCollection.js +75 -74
- package/lib/garbageCollection.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/package.json +33 -21
- package/src/blobManager.ts +60 -1
- package/src/connectionTelemetry.ts +7 -7
- package/src/containerRuntime.ts +106 -17
- package/src/dataStore.ts +7 -1
- package/src/dataStoreContext.ts +22 -7
- package/src/dataStores.ts +40 -19
- package/src/deltaScheduler.ts +65 -39
- package/src/garbageCollection.ts +92 -78
- package/src/packageVersion.ts +1 -1
|
@@ -50,11 +50,11 @@ class OpPerfTelemetry {
|
|
|
50
50
|
for (const msg of messages) {
|
|
51
51
|
if (msg.type === MessageType.Operation &&
|
|
52
52
|
this.clientSequenceNumberForLatencyStatistics === msg.clientSequenceNumber) {
|
|
53
|
-
assert(this.opProcessingTimes.opStartTimeSittingInboundQueue === undefined, "opStartTimeSittingInboundQueue should be undefined");
|
|
54
|
-
assert(this.opPerfData.durationInboundQueue === undefined, "durationInboundQueue should be undefined");
|
|
53
|
+
assert(this.opProcessingTimes.opStartTimeSittingInboundQueue === undefined, 0x2c8 /* "opStartTimeSittingInboundQueue should be undefined" */);
|
|
54
|
+
assert(this.opPerfData.durationInboundQueue === undefined, 0x2c9 /* "durationInboundQueue should be undefined" */);
|
|
55
55
|
this.opProcessingTimes.opStartTimeSittingInboundQueue = Date.now();
|
|
56
|
-
assert(this.opPerfData.durationOutboundQueue === undefined, "durationOutboundQueue should be undefined");
|
|
57
|
-
assert(this.opProcessingTimes.opStartTimeForLatencyStatistics !== undefined, "opStartTimeForLatencyStatistics should be undefined");
|
|
56
|
+
assert(this.opPerfData.durationOutboundQueue === undefined, 0x2ca /* "durationOutboundQueue should be undefined" */);
|
|
57
|
+
assert(this.opProcessingTimes.opStartTimeForLatencyStatistics !== undefined, 0x2cb /* "opStartTimeForLatencyStatistics should be undefined" */);
|
|
58
58
|
this.opPerfData.durationOutboundQueue = this.opProcessingTimes.opStartTimeSittingInboundQueue
|
|
59
59
|
- this.opProcessingTimes.opStartTimeForLatencyStatistics;
|
|
60
60
|
}
|
|
@@ -117,8 +117,8 @@ class OpPerfTelemetry {
|
|
|
117
117
|
// start with first client op and measure latency every 500 client ops
|
|
118
118
|
if (this.clientSequenceNumberForLatencyStatistics === undefined &&
|
|
119
119
|
message.clientSequenceNumber % 500 === 1) {
|
|
120
|
-
assert(this.opProcessingTimes.opStartTimeSittingInboundQueue === undefined, "OpTimeSittingInboundQueue should be undefined");
|
|
121
|
-
assert(this.opPerfData.durationInboundQueue === undefined, "durationInboundQueue should be undefined");
|
|
120
|
+
assert(this.opProcessingTimes.opStartTimeSittingInboundQueue === undefined, 0x2cc /* "OpTimeSittingInboundQueue should be undefined" */);
|
|
121
|
+
assert(this.opPerfData.durationInboundQueue === undefined, 0x2cd /* "durationInboundQueue should be undefined" */);
|
|
122
122
|
this.opProcessingTimes.opStartTimeForLatencyStatistics = Date.now();
|
|
123
123
|
this.clientSequenceNumberForLatencyStatistics = message.clientSequenceNumber;
|
|
124
124
|
}
|
|
@@ -135,7 +135,7 @@ class OpPerfTelemetry {
|
|
|
135
135
|
}
|
|
136
136
|
if (this.sequenceNumberForMsnTracking !== undefined &&
|
|
137
137
|
message.minimumSequenceNumber >= this.sequenceNumberForMsnTracking) {
|
|
138
|
-
assert(this.msnTrackingTimestamp !== undefined, "msnTrackingTimestamp should not be undefined");
|
|
138
|
+
assert(this.msnTrackingTimestamp !== undefined, 0x2ce /* "msnTrackingTimestamp should not be undefined" */);
|
|
139
139
|
this.logger.sendPerformanceEvent({
|
|
140
140
|
eventName: "MsnStatistics",
|
|
141
141
|
sequenceNumber,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connectionTelemetry.js","sourceRoot":"","sources":["../src/connectionTelemetry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAE/E,OAAO,EAGH,WAAW,GACd,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAEnE;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,CAAC;AAgCrC,MAAM,eAAe;IAuBjB,YACY,QAA4B,EACnB,YAAwE,EACzF,MAAwB;QAFhB,aAAQ,GAAR,QAAQ,CAAoB;QACnB,iBAAY,GAAZ,YAAY,CAA4D;QAxBrF,cAAS,GAAW,CAAC,CAAC;QAKtB,yBAAoB,GAAW,CAAC,CAAC;QAIjC,sBAAiB,GAA4B,EAAE,CAAC;QAExD,sEAAsE;QAC9D,eAAU,GAAwC,EAAE,CAAC;QAErD,oBAAe,GAAG,IAAI,CAAC;QAEd,aAAQ,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC;QACtC,wBAAmB,GAAG,CAAC,CAAC;QACxB,QAAG,GAAG,CAAC,CAAC;QAQZ,IAAI,CAAC,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QAEnD,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;QACxE,IAAI,CAAC,YAAY,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AY,CAAC,kBAAkB,GAAG,IAAI,CAAC,YAAY,CAAC,qBAAqB,IACxF,IAAI,CAAC,UAAU,EACpB,CAAC;YACH,IAAI,CAAC,wCAAwC,GAAG,SAAS,CAAC;YAC1D,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;SACxB;IACL,CAAC;CACJ;AAED,MAAM,UAAU,qBAAqB,CACjC,QAA4B,EAC5B,YAAwE,EACxE,MAAwB;IACxB,IAAI,eAAe,CAAC,QAAQ,EAAE,YAAY,EAAE,MAAM,CAAC,CAAC;AACxD,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport { ChildLogger, TelemetryLogger } from \"@fluidframework/telemetry-utils\";\nimport { IDeltaManager } from \"@fluidframework/container-definitions\";\nimport {\n IDocumentMessage,\n ISequencedDocumentMessage,\n MessageType,\n} from \"@fluidframework/protocol-definitions\";\nimport { assert, performance } from \"@fluidframework/common-utils\";\n\n/**\n * We report various latency-related errors when waiting for op roundtrip takes longer than that amout of time.\n */\nexport const latencyThreshold = 5000;\n\n// Phases in OpPerfTelemetry:\n// 1.\tOp sits in a buffer in DeltaManager (DM) queue, then in outbound queue for some time.\n// \t - Note: We do not differentiate these two today in telemetry, but first one is due to batches,\n// second one might happen due to outbound queue being paused.\n// 2.\tOp is sent to service and back.\n// 3.\tOp sits in inbound queue.\n// 4.\tOp is processed.\ninterface IOpPerfTelemetryProperties {\n /** Measure time between (1) and (2) - Measure time outbound op is sitting in queue due to active batch */\n durationOutboundQueue: number;\n /** Measure time between (2) and (3) - Track how long op is sitting in inbound queue until it is processed */\n durationInboundQueue: number;\n /** Measure time between (3) and (4) - Time between DM's inbound \"push\" event until DM's \"op\" event */\n durationInboundToProcessing: number;\n /** Length of the DeltaManager's inbound queue at the time of the DM's inbound \"push\" event (3) */\n lenghtInboundQueue: number;\n}\n\n/**\n * Timings collected at various moments during the op processing.\n */\n interface IOpPerfTimings {\n /** Starting time for (1) */\n opStartTimeForLatencyStatistics: number;\n /** Starting time for (2) */\n opStartTimeSittingInboundQueue: number;\n /** Starting time for (3) */\n opStartTimeInboundPushEvent: number;\n}\n\nclass OpPerfTelemetry {\n private pongCount: number = 0;\n private pingLatency: number | undefined;\n\n // Collab window tracking. This is timestamp of %1000 message.\n private sequenceNumberForMsnTracking: number | undefined;\n private msnTrackingTimestamp: number = 0;\n // To track round trip time for every %500 client message.\n private clientSequenceNumberForLatencyStatistics: number | undefined;\n\n private opProcessingTimes: Partial<IOpPerfTimings> = {};\n\n // Performance Data to be reported for ops round trips and processing.\n private opPerfData: Partial<IOpPerfTelemetryProperties> = {};\n\n private firstConnection = true;\n private connectionOpSeqNumber: number | undefined;\n private readonly bootTime = performance.now();\n private connectionStartTime = 0;\n private gap = 0;\n\n private readonly logger: ITelemetryLogger;\n\n public constructor(\n private clientId: string | undefined,\n private readonly deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>,\n logger: ITelemetryLogger) {\n this.logger = ChildLogger.create(logger, \"OpPerf\");\n\n this.deltaManager.on(\"pong\", (latency) => this.recordPingTime(latency));\n this.deltaManager.on(\"submitOp\", (message) => this.beforeOpSubmit(message));\n\n this.deltaManager.on(\"op\", (message) => this.afterProcessingOp(message));\n\n this.deltaManager.on(\"connect\", (details, opsBehind) => {\n this.clientId = details.clientId;\n if (opsBehind !== undefined) {\n this.connectionOpSeqNumber = this.deltaManager.lastKnownSeqNumber;\n this.gap = opsBehind;\n this.connectionStartTime = performance.now();\n\n // We might be already up-today. If so, report it right away.\n if (this.gap <= 0) {\n this.reportGettingUpToDate();\n }\n }\n });\n this.deltaManager.on(\"disconnect\", () => {\n this.sequenceNumberForMsnTracking = undefined;\n this.clientSequenceNumberForLatencyStatistics = undefined;\n this.opProcessingTimes = {};\n this.opPerfData = {};\n this.connectionOpSeqNumber = undefined;\n this.firstConnection = false;\n });\n\n this.deltaManager.outbound.on(\"push\", (messages) => {\n for (const msg of messages) {\n if (msg.type === MessageType.Operation &&\n this.clientSequenceNumberForLatencyStatistics === msg.clientSequenceNumber) {\n assert(this.opProcessingTimes.opStartTimeSittingInboundQueue === undefined,\n \"opStartTimeSittingInboundQueue should be undefined\");\n assert(this.opPerfData.durationInboundQueue === undefined,\n \"durationInboundQueue should be undefined\");\n this.opProcessingTimes.opStartTimeSittingInboundQueue = Date.now();\n\n assert(this.opPerfData.durationOutboundQueue === undefined,\n \"durationOutboundQueue should be undefined\");\n\n assert(this.opProcessingTimes.opStartTimeForLatencyStatistics !== undefined,\n \"opStartTimeForLatencyStatistics should be undefined\");\n\n this.opPerfData.durationOutboundQueue = this.opProcessingTimes.opStartTimeSittingInboundQueue\n - this.opProcessingTimes.opStartTimeForLatencyStatistics;\n }\n }\n });\n\n this.deltaManager.inbound.on(\"push\", (message: ISequencedDocumentMessage) => {\n if (this.clientId === message.clientId &&\n message.type === MessageType.Operation &&\n this.clientSequenceNumberForLatencyStatistics === message.clientSequenceNumber &&\n this.opProcessingTimes.opStartTimeSittingInboundQueue !== undefined) {\n this.opProcessingTimes.opStartTimeInboundPushEvent = Date.now();\n this.opPerfData.durationInboundQueue = this.opProcessingTimes.opStartTimeInboundPushEvent\n - this.opProcessingTimes.opStartTimeSittingInboundQueue;\n this.opProcessingTimes.opStartTimeSittingInboundQueue = undefined;\n this.opPerfData.lenghtInboundQueue = this.deltaManager.inbound.length;\n }\n });\n\n this.deltaManager.inbound.on(\"idle\", (count: number, duration: number) => {\n // Do not want to log zero for sure.\n // We are more interested in aggregates, so logging only if we are processing some number of ops\n // Cut-off is arbitrary - can be increased or decreased based on amount of data collected and questions we\n // want to get answered\n // back-compat: Once 0.36 loader version saturates (count & duration args were added there),\n // we can remove typeof check.\n if (typeof count === \"number\" && count >= 100) {\n this.logger.sendPerformanceEvent({\n eventName: \"GetDeltas_OpProcessing\",\n count,\n duration,\n });\n }\n });\n }\n\n private reportGettingUpToDate() {\n this.connectionOpSeqNumber = undefined;\n this.logger.sendPerformanceEvent({\n eventName: \"ConnectionSpeed\",\n duration: performance.now() - this.connectionStartTime,\n ops: this.gap,\n // track time to connect only for first connection.\n timeToConnect: this.firstConnection ?\n TelemetryLogger.formatTick(this.connectionStartTime - this.bootTime) :\n undefined,\n firstConnection: this.firstConnection,\n });\n }\n\n private recordPingTime(latency: number) {\n this.pongCount++;\n this.pingLatency = latency;\n // logging one in every 100 pongs\n if (this.pongCount === 100) {\n this.logger.sendPerformanceEvent({\n eventName: \"DeltaLatency\",\n duration: latency,\n });\n this.pongCount = 0;\n }\n }\n\n private beforeOpSubmit(message: IDocumentMessage) {\n // start with first client op and measure latency every 500 client ops\n if (this.clientSequenceNumberForLatencyStatistics === undefined &&\n message.clientSequenceNumber % 500 === 1) {\n assert(this.opProcessingTimes.opStartTimeSittingInboundQueue === undefined,\n \"OpTimeSittingInboundQueue should be undefined\");\n assert(this.opPerfData.durationInboundQueue === undefined,\n \"durationInboundQueue should be undefined\");\n this.opProcessingTimes.opStartTimeForLatencyStatistics = Date.now();\n this.clientSequenceNumberForLatencyStatistics = message.clientSequenceNumber;\n }\n }\n\n private afterProcessingOp(message: ISequencedDocumentMessage) {\n const sequenceNumber = message.sequenceNumber;\n\n if (sequenceNumber === this.connectionOpSeqNumber) {\n this.reportGettingUpToDate();\n }\n\n // Record collab window max size after every 1000th op.\n if (this.sequenceNumberForMsnTracking === undefined && sequenceNumber % 1000 === 0) {\n this.sequenceNumberForMsnTracking = sequenceNumber;\n this.msnTrackingTimestamp = message.timestamp;\n }\n if (this.sequenceNumberForMsnTracking !== undefined &&\n message.minimumSequenceNumber >= this.sequenceNumberForMsnTracking) {\n assert(this.msnTrackingTimestamp !== undefined,\n \"msnTrackingTimestamp should not be undefined\");\n this.logger.sendPerformanceEvent({\n eventName: \"MsnStatistics\",\n sequenceNumber,\n msnDistance: sequenceNumber - this.sequenceNumberForMsnTracking,\n duration: message.timestamp - this.msnTrackingTimestamp,\n });\n this.sequenceNumberForMsnTracking = undefined;\n }\n\n if (this.clientId === message.clientId &&\n this.clientSequenceNumberForLatencyStatistics === message.clientSequenceNumber) {\n assert(this.opProcessingTimes.opStartTimeForLatencyStatistics !== undefined,\n 0x120 /* \"Undefined latency statistics (op send time)\" */);\n const currentTime = Date.now();\n\n if (this.opProcessingTimes.opStartTimeInboundPushEvent !== undefined) {\n this.opPerfData.durationInboundToProcessing = currentTime\n - this.opProcessingTimes.opStartTimeInboundPushEvent;\n }\n\n const duration = currentTime - this.opProcessingTimes.opStartTimeForLatencyStatistics;\n\n // One of the core expectations for Fluid service is to be fast.\n // When it's not the case, we want to learn about it and be able to investigate, so\n // raise awareness.\n // This also helps identify cases where it's due to client behavior (sending too many ops)\n // that results in overwhelming ordering service and thus starting to see long latencies.\n // The threshold could be adjusted, but ideally it stays workload-agnostic, as service\n // performance impacts all workloads relying on service.\n const category = duration > latencyThreshold ? \"error\" : \"performance\";\n\n this.logger.sendPerformanceEvent({\n eventName: \"OpRoundtripTime\",\n sequenceNumber,\n referenceSequenceNumber: message.referenceSequenceNumber,\n duration,\n category,\n pingLatency: this.pingLatency,\n msnDistance: this.deltaManager.lastSequenceNumber - this.deltaManager.minimumSequenceNumber,\n ...this.opPerfData,\n });\n this.clientSequenceNumberForLatencyStatistics = undefined;\n this.opPerfData = {};\n }\n }\n}\n\nexport function ReportOpPerfTelemetry(\n clientId: string | undefined,\n deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>,\n logger: ITelemetryLogger) {\n new OpPerfTelemetry(clientId, deltaManager, logger);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"connectionTelemetry.js","sourceRoot":"","sources":["../src/connectionTelemetry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAE/E,OAAO,EAGH,WAAW,GACd,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,8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\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport { ChildLogger, TelemetryLogger } from \"@fluidframework/telemetry-utils\";\nimport { IDeltaManager } from \"@fluidframework/container-definitions\";\nimport {\n IDocumentMessage,\n ISequencedDocumentMessage,\n MessageType,\n} from \"@fluidframework/protocol-definitions\";\nimport { assert, performance } from \"@fluidframework/common-utils\";\n\n/**\n * We report various latency-related errors when waiting for op roundtrip takes longer than that amout of time.\n */\nexport const latencyThreshold = 5000;\n\n// Phases in OpPerfTelemetry:\n// 1.\tOp sits in a buffer in DeltaManager (DM) queue, then in outbound queue for some time.\n// \t - Note: We do not differentiate these two today in telemetry, but first one is due to batches,\n// second one might happen due to outbound queue being paused.\n// 2.\tOp is sent to service and back.\n// 3.\tOp sits in inbound queue.\n// 4.\tOp is processed.\ninterface IOpPerfTelemetryProperties {\n /** Measure time between (1) and (2) - Measure time outbound op is sitting in queue due to active batch */\n durationOutboundQueue: number;\n /** Measure time between (2) and (3) - Track how long op is sitting in inbound queue until it is processed */\n durationInboundQueue: number;\n /** Measure time between (3) and (4) - Time between DM's inbound \"push\" event until DM's \"op\" event */\n durationInboundToProcessing: number;\n /** Length of the DeltaManager's inbound queue at the time of the DM's inbound \"push\" event (3) */\n lenghtInboundQueue: number;\n}\n\n/**\n * Timings collected at various moments during the op processing.\n */\n interface IOpPerfTimings {\n /** Starting time for (1) */\n opStartTimeForLatencyStatistics: number;\n /** Starting time for (2) */\n opStartTimeSittingInboundQueue: number;\n /** Starting time for (3) */\n opStartTimeInboundPushEvent: number;\n}\n\nclass OpPerfTelemetry {\n private pongCount: number = 0;\n private pingLatency: number | undefined;\n\n // Collab window tracking. This is timestamp of %1000 message.\n private sequenceNumberForMsnTracking: number | undefined;\n private msnTrackingTimestamp: number = 0;\n // To track round trip time for every %500 client message.\n private clientSequenceNumberForLatencyStatistics: number | undefined;\n\n private opProcessingTimes: Partial<IOpPerfTimings> = {};\n\n // Performance Data to be reported for ops round trips and processing.\n private opPerfData: Partial<IOpPerfTelemetryProperties> = {};\n\n private firstConnection = true;\n private connectionOpSeqNumber: number | undefined;\n private readonly bootTime = performance.now();\n private connectionStartTime = 0;\n private gap = 0;\n\n private readonly logger: ITelemetryLogger;\n\n public constructor(\n private clientId: string | undefined,\n private readonly deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>,\n logger: ITelemetryLogger) {\n this.logger = ChildLogger.create(logger, \"OpPerf\");\n\n this.deltaManager.on(\"pong\", (latency) => this.recordPingTime(latency));\n this.deltaManager.on(\"submitOp\", (message) => this.beforeOpSubmit(message));\n\n this.deltaManager.on(\"op\", (message) => this.afterProcessingOp(message));\n\n this.deltaManager.on(\"connect\", (details, opsBehind) => {\n this.clientId = details.clientId;\n if (opsBehind !== undefined) {\n this.connectionOpSeqNumber = this.deltaManager.lastKnownSeqNumber;\n this.gap = opsBehind;\n this.connectionStartTime = performance.now();\n\n // We might be already up-today. If so, report it right away.\n if (this.gap <= 0) {\n this.reportGettingUpToDate();\n }\n }\n });\n this.deltaManager.on(\"disconnect\", () => {\n this.sequenceNumberForMsnTracking = undefined;\n this.clientSequenceNumberForLatencyStatistics = undefined;\n this.opProcessingTimes = {};\n this.opPerfData = {};\n this.connectionOpSeqNumber = undefined;\n this.firstConnection = false;\n });\n\n this.deltaManager.outbound.on(\"push\", (messages) => {\n for (const msg of messages) {\n if (msg.type === MessageType.Operation &&\n this.clientSequenceNumberForLatencyStatistics === msg.clientSequenceNumber) {\n assert(this.opProcessingTimes.opStartTimeSittingInboundQueue === undefined,\n 0x2c8 /* \"opStartTimeSittingInboundQueue should be undefined\" */);\n assert(this.opPerfData.durationInboundQueue === undefined,\n 0x2c9 /* \"durationInboundQueue should be undefined\" */);\n this.opProcessingTimes.opStartTimeSittingInboundQueue = Date.now();\n\n assert(this.opPerfData.durationOutboundQueue === undefined,\n 0x2ca /* \"durationOutboundQueue should be undefined\" */);\n\n assert(this.opProcessingTimes.opStartTimeForLatencyStatistics !== undefined,\n 0x2cb /* \"opStartTimeForLatencyStatistics should be undefined\" */);\n\n this.opPerfData.durationOutboundQueue = this.opProcessingTimes.opStartTimeSittingInboundQueue\n - this.opProcessingTimes.opStartTimeForLatencyStatistics;\n }\n }\n });\n\n this.deltaManager.inbound.on(\"push\", (message: ISequencedDocumentMessage) => {\n if (this.clientId === message.clientId &&\n message.type === MessageType.Operation &&\n this.clientSequenceNumberForLatencyStatistics === message.clientSequenceNumber &&\n this.opProcessingTimes.opStartTimeSittingInboundQueue !== undefined) {\n this.opProcessingTimes.opStartTimeInboundPushEvent = Date.now();\n this.opPerfData.durationInboundQueue = this.opProcessingTimes.opStartTimeInboundPushEvent\n - this.opProcessingTimes.opStartTimeSittingInboundQueue;\n this.opProcessingTimes.opStartTimeSittingInboundQueue = undefined;\n this.opPerfData.lenghtInboundQueue = this.deltaManager.inbound.length;\n }\n });\n\n this.deltaManager.inbound.on(\"idle\", (count: number, duration: number) => {\n // Do not want to log zero for sure.\n // We are more interested in aggregates, so logging only if we are processing some number of ops\n // Cut-off is arbitrary - can be increased or decreased based on amount of data collected and questions we\n // want to get answered\n // back-compat: Once 0.36 loader version saturates (count & duration args were added there),\n // we can remove typeof check.\n if (typeof count === \"number\" && count >= 100) {\n this.logger.sendPerformanceEvent({\n eventName: \"GetDeltas_OpProcessing\",\n count,\n duration,\n });\n }\n });\n }\n\n private reportGettingUpToDate() {\n this.connectionOpSeqNumber = undefined;\n this.logger.sendPerformanceEvent({\n eventName: \"ConnectionSpeed\",\n duration: performance.now() - this.connectionStartTime,\n ops: this.gap,\n // track time to connect only for first connection.\n timeToConnect: this.firstConnection ?\n TelemetryLogger.formatTick(this.connectionStartTime - this.bootTime) :\n undefined,\n firstConnection: this.firstConnection,\n });\n }\n\n private recordPingTime(latency: number) {\n this.pongCount++;\n this.pingLatency = latency;\n // logging one in every 100 pongs\n if (this.pongCount === 100) {\n this.logger.sendPerformanceEvent({\n eventName: \"DeltaLatency\",\n duration: latency,\n });\n this.pongCount = 0;\n }\n }\n\n private beforeOpSubmit(message: IDocumentMessage) {\n // start with first client op and measure latency every 500 client ops\n if (this.clientSequenceNumberForLatencyStatistics === undefined &&\n message.clientSequenceNumber % 500 === 1) {\n assert(this.opProcessingTimes.opStartTimeSittingInboundQueue === undefined,\n 0x2cc /* \"OpTimeSittingInboundQueue should be undefined\" */);\n assert(this.opPerfData.durationInboundQueue === undefined,\n 0x2cd /* \"durationInboundQueue should be undefined\" */);\n this.opProcessingTimes.opStartTimeForLatencyStatistics = Date.now();\n this.clientSequenceNumberForLatencyStatistics = message.clientSequenceNumber;\n }\n }\n\n private afterProcessingOp(message: ISequencedDocumentMessage) {\n const sequenceNumber = message.sequenceNumber;\n\n if (sequenceNumber === this.connectionOpSeqNumber) {\n this.reportGettingUpToDate();\n }\n\n // Record collab window max size after every 1000th op.\n if (this.sequenceNumberForMsnTracking === undefined && sequenceNumber % 1000 === 0) {\n this.sequenceNumberForMsnTracking = sequenceNumber;\n this.msnTrackingTimestamp = message.timestamp;\n }\n if (this.sequenceNumberForMsnTracking !== undefined &&\n message.minimumSequenceNumber >= this.sequenceNumberForMsnTracking) {\n assert(this.msnTrackingTimestamp !== undefined,\n 0x2ce /* \"msnTrackingTimestamp should not be undefined\" */);\n this.logger.sendPerformanceEvent({\n eventName: \"MsnStatistics\",\n sequenceNumber,\n msnDistance: sequenceNumber - this.sequenceNumberForMsnTracking,\n duration: message.timestamp - this.msnTrackingTimestamp,\n });\n this.sequenceNumberForMsnTracking = undefined;\n }\n\n if (this.clientId === message.clientId &&\n this.clientSequenceNumberForLatencyStatistics === message.clientSequenceNumber) {\n assert(this.opProcessingTimes.opStartTimeForLatencyStatistics !== undefined,\n 0x120 /* \"Undefined latency statistics (op send time)\" */);\n const currentTime = Date.now();\n\n if (this.opProcessingTimes.opStartTimeInboundPushEvent !== undefined) {\n this.opPerfData.durationInboundToProcessing = currentTime\n - this.opProcessingTimes.opStartTimeInboundPushEvent;\n }\n\n const duration = currentTime - this.opProcessingTimes.opStartTimeForLatencyStatistics;\n\n // One of the core expectations for Fluid service is to be fast.\n // When it's not the case, we want to learn about it and be able to investigate, so\n // raise awareness.\n // This also helps identify cases where it's due to client behavior (sending too many ops)\n // that results in overwhelming ordering service and thus starting to see long latencies.\n // The threshold could be adjusted, but ideally it stays workload-agnostic, as service\n // performance impacts all workloads relying on service.\n const category = duration > latencyThreshold ? \"error\" : \"performance\";\n\n this.logger.sendPerformanceEvent({\n eventName: \"OpRoundtripTime\",\n sequenceNumber,\n referenceSequenceNumber: message.referenceSequenceNumber,\n duration,\n category,\n pingLatency: this.pingLatency,\n msnDistance: this.deltaManager.lastSequenceNumber - this.deltaManager.minimumSequenceNumber,\n ...this.opPerfData,\n });\n this.clientSequenceNumberForLatencyStatistics = undefined;\n this.opPerfData = {};\n }\n }\n}\n\nexport function ReportOpPerfTelemetry(\n clientId: string | undefined,\n deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>,\n logger: ITelemetryLogger) {\n new OpPerfTelemetry(clientId, deltaManager, logger);\n}\n"]}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { EventEmitter } from "events";
|
|
7
7
|
import { ITelemetryLogger } from "@fluidframework/common-definitions";
|
|
8
|
-
import { FluidObject, IFluidHandle, IFluidHandleContext,
|
|
8
|
+
import { FluidObject, IFluidHandle, IFluidHandleContext, IFluidRouter, IRequest, IResponse } from "@fluidframework/core-interfaces";
|
|
9
9
|
import { IAudience, IFluidTokenProvider, IContainerContext, IDeltaManager, IRuntime, ICriticalContainerError, AttachState, ILoaderOptions } from "@fluidframework/container-definitions";
|
|
10
10
|
import { IContainerRuntime, IContainerRuntimeEvents } from "@fluidframework/container-runtime-definitions";
|
|
11
11
|
import { TypedEventEmitter } from "@fluidframework/common-utils";
|
|
@@ -14,7 +14,7 @@ import { IClientDetails, IDocumentMessage, IQuorumClients, ISequencedDocumentMes
|
|
|
14
14
|
import { FlushMode, IFluidDataStoreContextDetached, IFluidDataStoreRegistry, IGarbageCollectionData, NamedFluidDataStoreRegistryEntries, ISummaryTreeWithStats, IDataStore } from "@fluidframework/runtime-definitions";
|
|
15
15
|
import { IPendingLocalState } from "./pendingStateManager";
|
|
16
16
|
import { SubmitSummaryResult, ISubmitSummaryOptions, ISummarizer, ISummarizerInternalsProvider, ISummarizerOptions, ISummarizerRuntime } from "./summarizerTypes";
|
|
17
|
-
import { IGarbageCollectionRuntime, IGCStats } from "./garbageCollection";
|
|
17
|
+
import { GCNodeType, IGarbageCollectionRuntime, IGCStats } from "./garbageCollection";
|
|
18
18
|
export declare enum ContainerMessageType {
|
|
19
19
|
FluidDataStoreOp = "component",
|
|
20
20
|
Attach = "attach",
|
|
@@ -205,7 +205,7 @@ export declare class ContainerRuntime extends TypedEventEmitter<IContainerRuntim
|
|
|
205
205
|
get reSubmitFn(): (type: ContainerMessageType, content: any, localOpMetadata: unknown, opMetadata: Record<string, unknown> | undefined) => void;
|
|
206
206
|
get closeFn(): (error?: ICriticalContainerError) => void;
|
|
207
207
|
get flushMode(): FlushMode;
|
|
208
|
-
get scope():
|
|
208
|
+
get scope(): FluidObject;
|
|
209
209
|
get IFluidDataStoreRegistry(): IFluidDataStoreRegistry;
|
|
210
210
|
get attachState(): AttachState;
|
|
211
211
|
get IFluidHandleContext(): IFluidHandleContext;
|
|
@@ -400,6 +400,30 @@ export declare class ContainerRuntime extends TypedEventEmitter<IContainerRuntim
|
|
|
400
400
|
* unreferenced as part of this GC run, this should be used to update the time when it happens.
|
|
401
401
|
*/
|
|
402
402
|
updateUsedRoutes(usedRoutes: string[], gcTimestamp?: number): void;
|
|
403
|
+
/**
|
|
404
|
+
* When running GC in test mode, this is called to delete objects whose routes are unused. This enables testing
|
|
405
|
+
* scenarios with accessing deleted content.
|
|
406
|
+
* @param unusedRoutes - The routes that are unused in all data stores in this Container.
|
|
407
|
+
*/
|
|
408
|
+
deleteUnusedRoutes(unusedRoutes: string[]): void;
|
|
409
|
+
/**
|
|
410
|
+
* Returns a server generated referenced timestamp to be used to track unreferenced nodes by GC.
|
|
411
|
+
*/
|
|
412
|
+
getCurrentReferenceTimestampMs(): number | undefined;
|
|
413
|
+
/**
|
|
414
|
+
* Returns the type of the GC node. Currently, there are nodes that belong to data store and nodes that belong
|
|
415
|
+
* to the blob manager.
|
|
416
|
+
*/
|
|
417
|
+
getNodeType(nodePath: string): GCNodeType;
|
|
418
|
+
/**
|
|
419
|
+
* Called by GC to retrieve the package path of the node with the given path. The node should belong to a
|
|
420
|
+
* data store or an attachment blob.
|
|
421
|
+
*/
|
|
422
|
+
getGCNodePackagePath(nodePath: string): readonly string[] | undefined;
|
|
423
|
+
/**
|
|
424
|
+
* Returns whether a given path is for attachment blobs that are in the format - "/BlobManager.basePath/...".
|
|
425
|
+
*/
|
|
426
|
+
private isBlobPath;
|
|
403
427
|
/**
|
|
404
428
|
* Runs garbage collection and updates the reference / used state of the nodes in the container.
|
|
405
429
|
* @returns the statistics of the garbage collection run.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"containerRuntime.d.ts","sourceRoot":"","sources":["../src/containerRuntime.ts"],"names":[],"mappings":";AAAA;;;GAGG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAgD,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACpH,OAAO,EACH,WAAW,EACX,YAAY,EACZ,mBAAmB,EACnB,YAAY,EACZ,
|
|
1
|
+
{"version":3,"file":"containerRuntime.d.ts","sourceRoot":"","sources":["../src/containerRuntime.ts"],"names":[],"mappings":";AAAA;;;GAGG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAgD,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACpH,OAAO,EACH,WAAW,EACX,YAAY,EACZ,mBAAmB,EACnB,YAAY,EACZ,QAAQ,EACR,SAAS,EACZ,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACH,SAAS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AC,uBAAuB;CAyBlC"}
|
package/lib/containerRuntime.js
CHANGED
|
@@ -7,6 +7,7 @@ import { DataCorruptionError, GenericError, UsageError, extractSafePropertiesFro
|
|
|
7
7
|
import { MessageType, SummaryType, } from "@fluidframework/protocol-definitions";
|
|
8
8
|
import { FlushMode, channelsTreeName, } from "@fluidframework/runtime-definitions";
|
|
9
9
|
import { addBlobToSummary, addTreeToSummary, createRootSummarizerNodeWithGC, RequestParser, create404Response, exceptionToResponse, requestFluidObject, responseToException, seqFromTree, calculateStats, } from "@fluidframework/runtime-utils";
|
|
10
|
+
import { GCDataBuilder } from "@fluidframework/garbage-collector";
|
|
10
11
|
import { v4 as uuid } from "uuid";
|
|
11
12
|
import { ContainerFluidHandleContext } from "./containerHandleContext";
|
|
12
13
|
import { FluidDataStoreRegistry } from "./dataStoreRegistry";
|
|
@@ -24,7 +25,7 @@ import { OrderedClientCollection, OrderedClientElection } from "./orderedClientE
|
|
|
24
25
|
import { SummarizerClientElection, summarizerClientType } from "./summarizerClientElection";
|
|
25
26
|
import { formExponentialFn, Throttler } from "./throttler";
|
|
26
27
|
import { RunWhileConnectedCoordinator } from "./runWhileConnectedCoordinator";
|
|
27
|
-
import { GarbageCollector, gcTreeKey, } from "./garbageCollection";
|
|
28
|
+
import { GarbageCollector, GCNodeType, gcTreeKey, } from "./garbageCollection";
|
|
28
29
|
import { channelToDataStore, isDataStoreAliasMessage, } from "./dataStore";
|
|
29
30
|
import { BindBatchTracker } from "./batchTracker";
|
|
30
31
|
import { OpTracker } from "./opTelemetry";
|
|
@@ -312,7 +313,7 @@ export class ScheduleManager {
|
|
|
312
313
|
assert(this.batchClientId === undefined, 0x2a2 /* "Batch is interrupted by other client op. Should be caught by trackPending()" */);
|
|
313
314
|
// This could be the beginning of a new batch or an individual message.
|
|
314
315
|
this.emitter.emit("batchBegin", message);
|
|
315
|
-
this.deltaScheduler.batchBegin();
|
|
316
|
+
this.deltaScheduler.batchBegin(message);
|
|
316
317
|
const batch = (_a = message === null || message === void 0 ? void 0 : message.metadata) === null || _a === void 0 ? void 0 : _a.batch;
|
|
317
318
|
if (batch) {
|
|
318
319
|
this.batchClientId = message.clientId;
|
|
@@ -332,7 +333,7 @@ export class ScheduleManager {
|
|
|
332
333
|
this.hitError = true;
|
|
333
334
|
this.batchClientId = undefined;
|
|
334
335
|
this.emitter.emit("batchEnd", error, message);
|
|
335
|
-
this.deltaScheduler.batchEnd();
|
|
336
|
+
this.deltaScheduler.batchEnd(message);
|
|
336
337
|
return;
|
|
337
338
|
}
|
|
338
339
|
const batch = (_a = message === null || message === void 0 ? void 0 : message.metadata) === null || _a === void 0 ? void 0 : _a.batch;
|
|
@@ -341,7 +342,7 @@ export class ScheduleManager {
|
|
|
341
342
|
if (this.batchClientId === undefined || batch === false) {
|
|
342
343
|
this.batchClientId = undefined;
|
|
343
344
|
this.emitter.emit("batchEnd", undefined, message);
|
|
344
|
-
this.deltaScheduler.batchEnd();
|
|
345
|
+
this.deltaScheduler.batchEnd(message);
|
|
345
346
|
return;
|
|
346
347
|
}
|
|
347
348
|
}
|
|
@@ -466,12 +467,7 @@ export class ContainerRuntime extends TypedEventEmitter {
|
|
|
466
467
|
this._maxOpSizeInBytes = ((_d = this.mc.config.getNumber(maxOpSizeInBytesKey)) !== null && _d !== void 0 ? _d : defaultMaxOpSizeInBytes);
|
|
467
468
|
this.maxConsecutiveReconnects = (_e = this.mc.config.getNumber(maxConsecutiveReconnectsKey)) !== null && _e !== void 0 ? _e : this.defaultMaxConsecutiveReconnects;
|
|
468
469
|
this._flushMode = runtimeOptions.flushMode;
|
|
469
|
-
this.garbageCollector = GarbageCollector.create(this, this.runtimeOptions.gcOptions, (
|
|
470
|
-
/**
|
|
471
|
-
* Returns the timestamp of the last message seen by this client. This is used by garbage collector as
|
|
472
|
-
* the current reference timestamp for tracking unreferenced objects.
|
|
473
|
-
*/
|
|
474
|
-
() => { var _a, _b, _c; return (_b = (_a = this.deltaManager.lastMessage) === null || _a === void 0 ? void 0 : _a.timestamp) !== null && _b !== void 0 ? _b : (_c = this.messageAtLastSummary) === null || _c === void 0 ? void 0 : _c.timestamp; }, () => { var _a; return (_a = this.messageAtLastSummary) === null || _a === void 0 ? void 0 : _a.timestamp; }, context.baseSnapshot, async (id) => readAndParse(this.storage, id), this.mc.logger, existing, metadata);
|
|
470
|
+
this.garbageCollector = GarbageCollector.create(this, this.runtimeOptions.gcOptions, (nodePath) => this.getGCNodePackagePath(nodePath), () => { var _a; return (_a = this.messageAtLastSummary) === null || _a === void 0 ? void 0 : _a.timestamp; }, context.baseSnapshot, async (id) => readAndParse(this.storage, id), this.mc.logger, existing, metadata);
|
|
475
471
|
const loadedFromSequenceNumber = this.deltaManager.initialSequenceNumber;
|
|
476
472
|
this.summarizerNode = createRootSummarizerNodeWithGC(ChildLogger.create(this.logger, "SummarizerNode"),
|
|
477
473
|
// Summarize function to call when summarize is called. Summarizer node always tracks summary state.
|
|
@@ -492,7 +488,7 @@ export class ContainerRuntime extends TypedEventEmitter {
|
|
|
492
488
|
if (this.context.baseSnapshot) {
|
|
493
489
|
this.summarizerNode.loadBaseSummaryWithoutDifferential(this.context.baseSnapshot);
|
|
494
490
|
}
|
|
495
|
-
this.dataStores = new DataStores(getSummaryForDatastores(context.baseSnapshot, metadata), this, (attachMsg) => this.submit(ContainerMessageType.Attach, attachMsg), (id, createParam) => (summarizeInternal, getGCDataFn, getBaseGCDetailsFn) => this.summarizerNode.createChild(summarizeInternal, id, createParam, undefined, getGCDataFn, getBaseGCDetailsFn), (id) => this.summarizerNode.deleteChild(id), this.mc.logger, async () => this.garbageCollector.
|
|
491
|
+
this.dataStores = new DataStores(getSummaryForDatastores(context.baseSnapshot, metadata), this, (attachMsg) => this.submit(ContainerMessageType.Attach, attachMsg), (id, createParam) => (summarizeInternal, getGCDataFn, getBaseGCDetailsFn) => this.summarizerNode.createChild(summarizeInternal, id, createParam, undefined, getGCDataFn, getBaseGCDetailsFn), (id) => this.summarizerNode.deleteChild(id), this.mc.logger, async () => this.garbageCollector.getBaseGCDetails(), (path, timestampMs, packagePath) => this.garbageCollector.nodeUpdated(path, "Changed", timestampMs, packagePath), new Map(dataStoreAliasMap), this.garbageCollector.writeDataAtRoot);
|
|
496
492
|
this.blobManager = new BlobManager(this.handleContext, blobManagerSnapshot, () => this.storage, (blobId) => this.submit(ContainerMessageType.BlobAttach, undefined, undefined, { blobId }), this, this.logger);
|
|
497
493
|
this.scheduleManager = new ScheduleManager(context.deltaManager, this, ChildLogger.create(this.logger, "ScheduleManager"));
|
|
498
494
|
this.deltaSender = this.deltaManager;
|
|
@@ -1163,7 +1159,14 @@ export class ContainerRuntime extends TypedEventEmitter {
|
|
|
1163
1159
|
*/
|
|
1164
1160
|
async createRootDataStoreLegacy(pkg, rootDataStoreId) {
|
|
1165
1161
|
const fluidDataStore = await this._createDataStore(pkg, true /* isRoot */, rootDataStoreId);
|
|
1166
|
-
|
|
1162
|
+
// back-compat 0.59.1000 - makeVisibleAndAttachGraph was added in this version to IFluidDataStoreChannel. For
|
|
1163
|
+
// older versions, we still have to call bindToContext.
|
|
1164
|
+
if (fluidDataStore.makeVisibleAndAttachGraph !== undefined) {
|
|
1165
|
+
fluidDataStore.makeVisibleAndAttachGraph();
|
|
1166
|
+
}
|
|
1167
|
+
else {
|
|
1168
|
+
fluidDataStore.bindToContext();
|
|
1169
|
+
}
|
|
1167
1170
|
return fluidDataStore;
|
|
1168
1171
|
}
|
|
1169
1172
|
async createRootDataStore(pkg, rootDataStoreId) {
|
|
@@ -1217,7 +1220,14 @@ export class ContainerRuntime extends TypedEventEmitter {
|
|
|
1217
1220
|
async _createDataStoreWithPropsLegacy(pkg, props, id = uuid(), isRoot = false) {
|
|
1218
1221
|
const fluidDataStore = await this.dataStores._createFluidDataStoreContext(Array.isArray(pkg) ? pkg : [pkg], id, isRoot, props).realize();
|
|
1219
1222
|
if (isRoot) {
|
|
1220
|
-
|
|
1223
|
+
// back-compat 0.59.1000 - makeVisibleAndAttachGraph was added in this version to IFluidDataStoreChannel.
|
|
1224
|
+
// For older versions, we still have to call bindToContext.
|
|
1225
|
+
if (fluidDataStore.makeVisibleAndAttachGraph !== undefined) {
|
|
1226
|
+
fluidDataStore.makeVisibleAndAttachGraph();
|
|
1227
|
+
}
|
|
1228
|
+
else {
|
|
1229
|
+
fluidDataStore.bindToContext();
|
|
1230
|
+
}
|
|
1221
1231
|
this.logger.sendTelemetryEvent({
|
|
1222
1232
|
eventName: "Root datastore with props",
|
|
1223
1233
|
hasProps: props !== undefined,
|
|
@@ -1364,7 +1374,12 @@ export class ContainerRuntime extends TypedEventEmitter {
|
|
|
1364
1374
|
* @param fullGC - true to bypass optimizations and force full generation of GC data.
|
|
1365
1375
|
*/
|
|
1366
1376
|
async getGCData(fullGC) {
|
|
1367
|
-
|
|
1377
|
+
const builder = new GCDataBuilder();
|
|
1378
|
+
const dsGCData = await this.dataStores.getGCData(fullGC);
|
|
1379
|
+
builder.addNodes(dsGCData.gcNodes);
|
|
1380
|
+
const blobsGCData = this.blobManager.getGCData(fullGC);
|
|
1381
|
+
builder.addNodes(blobsGCData.gcNodes);
|
|
1382
|
+
return builder.getGCData();
|
|
1368
1383
|
}
|
|
1369
1384
|
/**
|
|
1370
1385
|
* Implementation of IGarbageCollectionRuntime::updateUsedRoutes.
|
|
@@ -1378,7 +1393,78 @@ export class ContainerRuntime extends TypedEventEmitter {
|
|
|
1378
1393
|
// summarizing is required and asserted by the the summarizer node. We are the root and are
|
|
1379
1394
|
// always referenced, so the used routes is only self-route (empty string).
|
|
1380
1395
|
this.summarizerNode.updateUsedRoutes([""]);
|
|
1381
|
-
|
|
1396
|
+
const dataStoreUsedRoutes = [];
|
|
1397
|
+
for (const route of usedRoutes) {
|
|
1398
|
+
if (route.split("/")[1] !== BlobManager.basePath) {
|
|
1399
|
+
dataStoreUsedRoutes.push(route);
|
|
1400
|
+
}
|
|
1401
|
+
}
|
|
1402
|
+
return this.dataStores.updateUsedRoutes(dataStoreUsedRoutes, gcTimestamp);
|
|
1403
|
+
}
|
|
1404
|
+
/**
|
|
1405
|
+
* When running GC in test mode, this is called to delete objects whose routes are unused. This enables testing
|
|
1406
|
+
* scenarios with accessing deleted content.
|
|
1407
|
+
* @param unusedRoutes - The routes that are unused in all data stores in this Container.
|
|
1408
|
+
*/
|
|
1409
|
+
deleteUnusedRoutes(unusedRoutes) {
|
|
1410
|
+
const blobManagerUnusedRoutes = [];
|
|
1411
|
+
const dataStoreUnusedRoutes = [];
|
|
1412
|
+
for (const route of unusedRoutes) {
|
|
1413
|
+
if (this.isBlobPath(route)) {
|
|
1414
|
+
blobManagerUnusedRoutes.push(route);
|
|
1415
|
+
}
|
|
1416
|
+
else {
|
|
1417
|
+
dataStoreUnusedRoutes.push(route);
|
|
1418
|
+
}
|
|
1419
|
+
}
|
|
1420
|
+
this.blobManager.deleteUnusedRoutes(blobManagerUnusedRoutes);
|
|
1421
|
+
this.dataStores.deleteUnusedRoutes(dataStoreUnusedRoutes);
|
|
1422
|
+
}
|
|
1423
|
+
/**
|
|
1424
|
+
* Returns a server generated referenced timestamp to be used to track unreferenced nodes by GC.
|
|
1425
|
+
*/
|
|
1426
|
+
getCurrentReferenceTimestampMs() {
|
|
1427
|
+
var _a, _b, _c;
|
|
1428
|
+
// Use the timestamp of the last message seen by this client as that is server generated. If no messages have
|
|
1429
|
+
// been processed, use the timestamp of the message from the last summary.
|
|
1430
|
+
return (_b = (_a = this.deltaManager.lastMessage) === null || _a === void 0 ? void 0 : _a.timestamp) !== null && _b !== void 0 ? _b : (_c = this.messageAtLastSummary) === null || _c === void 0 ? void 0 : _c.timestamp;
|
|
1431
|
+
}
|
|
1432
|
+
/**
|
|
1433
|
+
* Returns the type of the GC node. Currently, there are nodes that belong to data store and nodes that belong
|
|
1434
|
+
* to the blob manager.
|
|
1435
|
+
*/
|
|
1436
|
+
getNodeType(nodePath) {
|
|
1437
|
+
if (this.isBlobPath(nodePath)) {
|
|
1438
|
+
return GCNodeType.Blob;
|
|
1439
|
+
}
|
|
1440
|
+
if (this.dataStores.isDataStoreNode(nodePath)) {
|
|
1441
|
+
return GCNodeType.DataStore;
|
|
1442
|
+
}
|
|
1443
|
+
// Root node ("/") and DDS nodes belong to "Other" node types.
|
|
1444
|
+
return GCNodeType.Other;
|
|
1445
|
+
}
|
|
1446
|
+
/**
|
|
1447
|
+
* Called by GC to retrieve the package path of the node with the given path. The node should belong to a
|
|
1448
|
+
* data store or an attachment blob.
|
|
1449
|
+
*/
|
|
1450
|
+
getGCNodePackagePath(nodePath) {
|
|
1451
|
+
// If the node is a blob, return "_blobs" as the package path.
|
|
1452
|
+
if (this.isBlobPath(nodePath)) {
|
|
1453
|
+
return ["_blobs"];
|
|
1454
|
+
}
|
|
1455
|
+
const dataStorePkgPath = this.dataStores.getDataStorePackagePath(nodePath);
|
|
1456
|
+
assert(dataStorePkgPath !== undefined, 0x2d6 /* "Package path requested for unknown node type." */);
|
|
1457
|
+
return dataStorePkgPath;
|
|
1458
|
+
}
|
|
1459
|
+
/**
|
|
1460
|
+
* Returns whether a given path is for attachment blobs that are in the format - "/BlobManager.basePath/...".
|
|
1461
|
+
*/
|
|
1462
|
+
isBlobPath(path) {
|
|
1463
|
+
const pathParts = path.split("/");
|
|
1464
|
+
if (pathParts.length < 2 || pathParts[1] !== BlobManager.basePath) {
|
|
1465
|
+
return false;
|
|
1466
|
+
}
|
|
1467
|
+
return true;
|
|
1382
1468
|
}
|
|
1383
1469
|
/**
|
|
1384
1470
|
* Runs garbage collection and updates the reference / used state of the nodes in the container.
|