@fluidframework/container-runtime 2.0.0-internal.5.3.4 → 2.0.0-internal.5.4.2
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 +9 -0
- package/dist/batchTracker.d.ts.map +1 -1
- package/dist/batchTracker.js +1 -1
- package/dist/batchTracker.js.map +1 -1
- package/dist/blobManager.d.ts +9 -1
- package/dist/blobManager.d.ts.map +1 -1
- package/dist/blobManager.js +55 -12
- package/dist/blobManager.js.map +1 -1
- package/dist/connectionTelemetry.d.ts.map +1 -1
- package/dist/connectionTelemetry.js +2 -2
- package/dist/connectionTelemetry.js.map +1 -1
- package/dist/containerRuntime.d.ts +43 -11
- package/dist/containerRuntime.d.ts.map +1 -1
- package/dist/containerRuntime.js +189 -137
- package/dist/containerRuntime.js.map +1 -1
- package/dist/dataStore.js +3 -0
- package/dist/dataStore.js.map +1 -1
- package/dist/dataStoreContext.d.ts +1 -1
- package/dist/dataStoreContext.d.ts.map +1 -1
- package/dist/dataStoreContext.js +24 -27
- package/dist/dataStoreContext.js.map +1 -1
- package/dist/dataStoreContexts.js +1 -1
- package/dist/dataStoreContexts.js.map +1 -1
- package/dist/dataStores.d.ts +1 -1
- package/dist/dataStores.d.ts.map +1 -1
- package/dist/dataStores.js +14 -24
- package/dist/dataStores.js.map +1 -1
- package/dist/deltaManagerSummarizerProxy.d.ts.map +1 -1
- package/dist/deltaManagerSummarizerProxy.js +2 -0
- package/dist/deltaManagerSummarizerProxy.js.map +1 -1
- package/dist/deltaScheduler.d.ts.map +1 -1
- package/dist/deltaScheduler.js +5 -5
- package/dist/deltaScheduler.js.map +1 -1
- package/dist/gc/garbageCollection.d.ts.map +1 -1
- package/dist/gc/garbageCollection.js +12 -5
- package/dist/gc/garbageCollection.js.map +1 -1
- package/dist/gc/gcHelpers.d.ts +1 -0
- package/dist/gc/gcHelpers.d.ts.map +1 -1
- package/dist/gc/gcHelpers.js +1 -0
- package/dist/gc/gcHelpers.js.map +1 -1
- package/dist/gc/gcTelemetry.d.ts.map +1 -1
- package/dist/gc/gcTelemetry.js +15 -22
- package/dist/gc/gcTelemetry.js.map +1 -1
- package/dist/id-compressor/idCompressor.d.ts +3 -3
- package/dist/id-compressor/idCompressor.d.ts.map +1 -1
- package/dist/id-compressor/idCompressor.js +3 -1
- package/dist/id-compressor/idCompressor.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 +1 -1
- 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 +1 -1
- package/dist/opLifecycle/opDecompressor.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 +1 -1
- package/dist/opLifecycle/opSplitter.js.map +1 -1
- package/dist/opLifecycle/outbox.d.ts +6 -5
- package/dist/opLifecycle/outbox.d.ts.map +1 -1
- package/dist/opLifecycle/outbox.js +5 -12
- package/dist/opLifecycle/outbox.js.map +1 -1
- package/dist/opLifecycle/remoteMessageProcessor.d.ts +6 -1
- package/dist/opLifecycle/remoteMessageProcessor.d.ts.map +1 -1
- package/dist/opLifecycle/remoteMessageProcessor.js +7 -1
- package/dist/opLifecycle/remoteMessageProcessor.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 +4 -1
- package/dist/pendingStateManager.d.ts.map +1 -1
- package/dist/pendingStateManager.js +21 -12
- package/dist/pendingStateManager.js.map +1 -1
- package/dist/scheduleManager.d.ts.map +1 -1
- package/dist/scheduleManager.js +1 -1
- package/dist/scheduleManager.js.map +1 -1
- package/dist/summary/orderedClientElection.d.ts.map +1 -1
- package/dist/summary/orderedClientElection.js +1 -1
- package/dist/summary/orderedClientElection.js.map +1 -1
- package/dist/summary/runningSummarizer.d.ts +3 -5
- package/dist/summary/runningSummarizer.d.ts.map +1 -1
- package/dist/summary/runningSummarizer.js +10 -28
- package/dist/summary/runningSummarizer.js.map +1 -1
- package/dist/summary/summarizer.js +1 -1
- package/dist/summary/summarizer.js.map +1 -1
- package/dist/summary/summarizerNode/summarizerNode.d.ts +5 -5
- package/dist/summary/summarizerNode/summarizerNode.d.ts.map +1 -1
- package/dist/summary/summarizerNode/summarizerNode.js +7 -10
- package/dist/summary/summarizerNode/summarizerNode.js.map +1 -1
- package/dist/summary/summarizerNode/summarizerNodeWithGc.d.ts +4 -3
- package/dist/summary/summarizerNode/summarizerNodeWithGc.d.ts.map +1 -1
- package/dist/summary/summarizerNode/summarizerNodeWithGc.js +4 -8
- package/dist/summary/summarizerNode/summarizerNodeWithGc.js.map +1 -1
- package/dist/summary/summaryGenerator.d.ts.map +1 -1
- package/dist/summary/summaryGenerator.js +5 -1
- package/dist/summary/summaryGenerator.js.map +1 -1
- package/dist/summary/summaryManager.d.ts +2 -3
- package/dist/summary/summaryManager.d.ts.map +1 -1
- package/dist/summary/summaryManager.js +6 -2
- package/dist/summary/summaryManager.js.map +1 -1
- package/lib/batchTracker.d.ts.map +1 -1
- package/lib/batchTracker.js +2 -2
- package/lib/batchTracker.js.map +1 -1
- package/lib/blobManager.d.ts +9 -1
- package/lib/blobManager.d.ts.map +1 -1
- package/lib/blobManager.js +55 -12
- package/lib/blobManager.js.map +1 -1
- package/lib/connectionTelemetry.d.ts.map +1 -1
- package/lib/connectionTelemetry.js +3 -3
- package/lib/connectionTelemetry.js.map +1 -1
- package/lib/containerRuntime.d.ts +43 -11
- package/lib/containerRuntime.d.ts.map +1 -1
- package/lib/containerRuntime.js +188 -137
- package/lib/containerRuntime.js.map +1 -1
- package/lib/dataStore.js +3 -0
- package/lib/dataStore.js.map +1 -1
- package/lib/dataStoreContext.d.ts +1 -1
- package/lib/dataStoreContext.d.ts.map +1 -1
- package/lib/dataStoreContext.js +26 -29
- package/lib/dataStoreContext.js.map +1 -1
- package/lib/dataStoreContexts.js +2 -2
- package/lib/dataStoreContexts.js.map +1 -1
- package/lib/dataStores.d.ts +1 -1
- package/lib/dataStores.d.ts.map +1 -1
- package/lib/dataStores.js +15 -25
- package/lib/dataStores.js.map +1 -1
- package/lib/deltaManagerSummarizerProxy.d.ts.map +1 -1
- package/lib/deltaManagerSummarizerProxy.js +2 -0
- package/lib/deltaManagerSummarizerProxy.js.map +1 -1
- package/lib/deltaScheduler.d.ts.map +1 -1
- package/lib/deltaScheduler.js +6 -6
- package/lib/deltaScheduler.js.map +1 -1
- package/lib/gc/garbageCollection.d.ts.map +1 -1
- package/lib/gc/garbageCollection.js +13 -6
- package/lib/gc/garbageCollection.js.map +1 -1
- package/lib/gc/gcHelpers.d.ts +1 -0
- package/lib/gc/gcHelpers.d.ts.map +1 -1
- package/lib/gc/gcHelpers.js +1 -0
- package/lib/gc/gcHelpers.js.map +1 -1
- package/lib/gc/gcTelemetry.d.ts.map +1 -1
- package/lib/gc/gcTelemetry.js +16 -23
- package/lib/gc/gcTelemetry.js.map +1 -1
- package/lib/id-compressor/idCompressor.d.ts +3 -3
- package/lib/id-compressor/idCompressor.d.ts.map +1 -1
- package/lib/id-compressor/idCompressor.js +3 -1
- package/lib/id-compressor/idCompressor.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 +2 -2
- 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 +2 -2
- package/lib/opLifecycle/opDecompressor.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 +2 -2
- package/lib/opLifecycle/opSplitter.js.map +1 -1
- package/lib/opLifecycle/outbox.d.ts +6 -5
- package/lib/opLifecycle/outbox.d.ts.map +1 -1
- package/lib/opLifecycle/outbox.js +6 -13
- package/lib/opLifecycle/outbox.js.map +1 -1
- package/lib/opLifecycle/remoteMessageProcessor.d.ts +6 -1
- package/lib/opLifecycle/remoteMessageProcessor.d.ts.map +1 -1
- package/lib/opLifecycle/remoteMessageProcessor.js +7 -1
- package/lib/opLifecycle/remoteMessageProcessor.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 +4 -1
- package/lib/pendingStateManager.d.ts.map +1 -1
- package/lib/pendingStateManager.js +21 -12
- package/lib/pendingStateManager.js.map +1 -1
- package/lib/scheduleManager.d.ts.map +1 -1
- package/lib/scheduleManager.js +2 -2
- package/lib/scheduleManager.js.map +1 -1
- package/lib/summary/orderedClientElection.d.ts.map +1 -1
- package/lib/summary/orderedClientElection.js +2 -2
- package/lib/summary/orderedClientElection.js.map +1 -1
- package/lib/summary/runningSummarizer.d.ts +3 -5
- package/lib/summary/runningSummarizer.d.ts.map +1 -1
- package/lib/summary/runningSummarizer.js +11 -29
- package/lib/summary/runningSummarizer.js.map +1 -1
- package/lib/summary/summarizer.js +2 -2
- package/lib/summary/summarizer.js.map +1 -1
- package/lib/summary/summarizerNode/summarizerNode.d.ts +5 -5
- package/lib/summary/summarizerNode/summarizerNode.d.ts.map +1 -1
- package/lib/summary/summarizerNode/summarizerNode.js +8 -11
- package/lib/summary/summarizerNode/summarizerNode.js.map +1 -1
- package/lib/summary/summarizerNode/summarizerNodeWithGc.d.ts +4 -3
- package/lib/summary/summarizerNode/summarizerNodeWithGc.d.ts.map +1 -1
- package/lib/summary/summarizerNode/summarizerNodeWithGc.js +5 -9
- package/lib/summary/summarizerNode/summarizerNodeWithGc.js.map +1 -1
- package/lib/summary/summaryGenerator.d.ts.map +1 -1
- package/lib/summary/summaryGenerator.js +6 -2
- package/lib/summary/summaryGenerator.js.map +1 -1
- package/lib/summary/summaryManager.d.ts +2 -3
- package/lib/summary/summaryManager.d.ts.map +1 -1
- package/lib/summary/summaryManager.js +7 -3
- package/lib/summary/summaryManager.js.map +1 -1
- package/package.json +16 -16
- package/src/batchTracker.ts +2 -2
- package/src/blobManager.ts +70 -13
- package/src/connectionTelemetry.ts +7 -3
- package/src/containerRuntime.ts +287 -150
- package/src/dataStore.ts +3 -0
- package/src/dataStoreContext.ts +31 -33
- package/src/dataStoreContexts.ts +2 -2
- package/src/dataStores.ts +15 -18
- package/src/deltaManagerSummarizerProxy.ts +2 -0
- package/src/deltaScheduler.ts +6 -10
- package/src/gc/garbageCollection.ts +13 -8
- package/src/gc/gcHelpers.ts +1 -0
- package/src/gc/gcTelemetry.ts +12 -8
- package/src/id-compressor/idCompressor.ts +6 -5
- package/src/opLifecycle/opCompressor.ts +4 -3
- package/src/opLifecycle/opDecompressor.ts +4 -3
- package/src/opLifecycle/opSplitter.ts +4 -3
- package/src/opLifecycle/outbox.ts +13 -25
- package/src/opLifecycle/remoteMessageProcessor.ts +8 -2
- package/src/packageVersion.ts +1 -1
- package/src/pendingStateManager.ts +22 -10
- package/src/scheduleManager.ts +2 -2
- package/src/summary/orderedClientElection.ts +2 -2
- package/src/summary/runningSummarizer.ts +18 -44
- package/src/summary/summarizer.ts +2 -2
- package/src/summary/summarizerNode/summarizerNode.ts +13 -15
- package/src/summary/summarizerNode/summarizerNodeWithGc.ts +8 -7
- package/src/summary/summaryGenerator.ts +6 -2
- package/src/summary/summaryManager.ts +9 -5
package/dist/containerRuntime.js
CHANGED
|
@@ -30,7 +30,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
30
30
|
return t;
|
|
31
31
|
};
|
|
32
32
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
33
|
-
exports.ContainerRuntime = exports.getDeviceSpec = exports.agentSchedulerId = exports.isRuntimeMessage = exports.RuntimeMessage = exports.CompressionAlgorithms = exports.defaultRuntimeHeaderData = exports.TombstoneResponseHeaderKey = exports.AllowTombstoneRequestHeaderKey = exports.RuntimeHeaders = exports.DefaultSummaryConfiguration = exports.ContainerMessageType = void 0;
|
|
33
|
+
exports.ContainerRuntime = exports.makeLegacySendBatchFn = exports.getDeviceSpec = exports.agentSchedulerId = exports.isRuntimeMessage = exports.RuntimeMessage = exports.CompressionAlgorithms = exports.defaultRuntimeHeaderData = exports.TombstoneResponseHeaderKey = exports.AllowTombstoneRequestHeaderKey = exports.RuntimeHeaders = exports.DefaultSummaryConfiguration = exports.ContainerMessageType = void 0;
|
|
34
34
|
const container_definitions_1 = require("@fluidframework/container-definitions");
|
|
35
35
|
const common_utils_1 = require("@fluidframework/common-utils");
|
|
36
36
|
const core_utils_1 = require("@fluidframework/core-utils");
|
|
@@ -137,7 +137,7 @@ const defaultChunkSizeInBytes = 204800;
|
|
|
137
137
|
* of the current system, we should close the summarizer and let it recover.
|
|
138
138
|
* This delay's goal is to prevent tight restart loops
|
|
139
139
|
*/
|
|
140
|
-
const defaultCloseSummarizerDelayMs =
|
|
140
|
+
const defaultCloseSummarizerDelayMs = 5000; // 5 seconds
|
|
141
141
|
/**
|
|
142
142
|
* @deprecated - use ContainerRuntimeMessage instead
|
|
143
143
|
*/
|
|
@@ -178,6 +178,21 @@ function getDeviceSpec() {
|
|
|
178
178
|
return {};
|
|
179
179
|
}
|
|
180
180
|
exports.getDeviceSpec = getDeviceSpec;
|
|
181
|
+
/**
|
|
182
|
+
* Older loader doesn't have a submitBatchFn member, this is the older way of submitting a batch.
|
|
183
|
+
* Rather than exposing the submitFn (now deprecated) and IDeltaManager (dangerous to hand out) to the Outbox,
|
|
184
|
+
* we can provide a partially-applied function to keep those items private to the ContainerRuntime.
|
|
185
|
+
*/
|
|
186
|
+
const makeLegacySendBatchFn = (submitFn, deltaManager) => (batch) => {
|
|
187
|
+
for (const message of batch.content) {
|
|
188
|
+
submitFn(protocol_definitions_1.MessageType.Operation,
|
|
189
|
+
// For back-compat (submitFn only works on deserialized content)
|
|
190
|
+
message.contents === undefined ? undefined : JSON.parse(message.contents), true, // batch
|
|
191
|
+
message.metadata);
|
|
192
|
+
}
|
|
193
|
+
deltaManager.flush();
|
|
194
|
+
};
|
|
195
|
+
exports.makeLegacySendBatchFn = makeLegacySendBatchFn;
|
|
181
196
|
/**
|
|
182
197
|
* Represents the runtime of the container. Contains helper functions/state of the container.
|
|
183
198
|
* It will define the store level mappings.
|
|
@@ -190,7 +205,6 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
190
205
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
191
206
|
if (summaryConfiguration === void 0) { summaryConfiguration = Object.assign(Object.assign({}, exports.DefaultSummaryConfiguration), (_a = runtimeOptions.summaryOptions) === null || _a === void 0 ? void 0 : _a.summaryConfigOverrides); }
|
|
192
207
|
super();
|
|
193
|
-
this.context = context;
|
|
194
208
|
this.registry = registry;
|
|
195
209
|
this.runtimeOptions = runtimeOptions;
|
|
196
210
|
this.containerScope = containerScope;
|
|
@@ -220,7 +234,7 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
220
234
|
trackingSignalSequenceNumber: undefined,
|
|
221
235
|
};
|
|
222
236
|
this.summarizeOnDemand = (...args) => {
|
|
223
|
-
if (this.
|
|
237
|
+
if (this.isSummarizerClient) {
|
|
224
238
|
return this.summarizer.summarizeOnDemand(...args);
|
|
225
239
|
}
|
|
226
240
|
else if (this.summaryManager !== undefined) {
|
|
@@ -234,7 +248,7 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
234
248
|
}
|
|
235
249
|
};
|
|
236
250
|
this.enqueueSummarize = (...args) => {
|
|
237
|
-
if (this.
|
|
251
|
+
if (this.isSummarizerClient) {
|
|
238
252
|
return this.summarizer.enqueueSummarize(...args);
|
|
239
253
|
}
|
|
240
254
|
else if (this.summaryManager !== undefined) {
|
|
@@ -247,9 +261,48 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
247
261
|
throw new container_utils_1.UsageError(`Can't summarize, disableSummaries: ${this.summariesDisabled}`);
|
|
248
262
|
}
|
|
249
263
|
};
|
|
250
|
-
|
|
251
|
-
this.
|
|
252
|
-
this.
|
|
264
|
+
const { options, clientDetails, connected, baseSnapshot, submitFn, submitBatchFn, submitSummaryFn, submitSignalFn, disposeFn, closeFn, deltaManager, quorum, audience, loader, pendingLocalState, supportedFeatures, } = context;
|
|
265
|
+
this.innerDeltaManager = deltaManager;
|
|
266
|
+
this.deltaManager = new deltaManagerSummarizerProxy_1.DeltaManagerSummarizerProxy(this.innerDeltaManager);
|
|
267
|
+
// Here we could wrap/intercept on these functions to block/modify outgoing messages if needed.
|
|
268
|
+
// This makes ContainerRuntime the final gatekeeper for outgoing messages.
|
|
269
|
+
this.submitFn = submitFn;
|
|
270
|
+
this.submitBatchFn = submitBatchFn;
|
|
271
|
+
this.submitSummaryFn = submitSummaryFn;
|
|
272
|
+
this.submitSignalFn = submitSignalFn;
|
|
273
|
+
this.options = options;
|
|
274
|
+
this.clientDetails = clientDetails;
|
|
275
|
+
this.isSummarizerClient = this.clientDetails.type === summary_1.summarizerClientType;
|
|
276
|
+
this.loadedFromVersionId = (_b = context.getLoadedFromVersion()) === null || _b === void 0 ? void 0 : _b.id;
|
|
277
|
+
this._getClientId = () => context.clientId;
|
|
278
|
+
this._getAttachState = () => context.attachState;
|
|
279
|
+
this.getAbsoluteUrl = async (relativeUrl) => {
|
|
280
|
+
if (context.getAbsoluteUrl === undefined) {
|
|
281
|
+
throw new Error("Driver does not implement getAbsoluteUrl");
|
|
282
|
+
}
|
|
283
|
+
if (this.attachState !== container_definitions_1.AttachState.Attached) {
|
|
284
|
+
return undefined;
|
|
285
|
+
}
|
|
286
|
+
return context.getAbsoluteUrl(relativeUrl);
|
|
287
|
+
};
|
|
288
|
+
// TODO: Consider that the Container could just listen to these events itself, or even more appropriately maybe the
|
|
289
|
+
// customer should observe dirty state on the runtime (the owner of dirty state) directly, rather than on the IContainer.
|
|
290
|
+
this.on("dirty", () => context.updateDirtyContainerState(true));
|
|
291
|
+
this.on("saved", () => context.updateDirtyContainerState(false));
|
|
292
|
+
// In old loaders without dispose functionality, closeFn is equivalent but will also switch container to readonly mode
|
|
293
|
+
this.disposeFn = disposeFn !== null && disposeFn !== void 0 ? disposeFn : closeFn;
|
|
294
|
+
// In cases of summarizer, we want to dispose instead since consumer doesn't interact with this container
|
|
295
|
+
this.closeFn = this.isSummarizerClient
|
|
296
|
+
? this.disposeFn
|
|
297
|
+
: (error) => {
|
|
298
|
+
closeFn(error);
|
|
299
|
+
// Also call disposeFn to retain functionality of runtime being disposed on close
|
|
300
|
+
disposeFn === null || disposeFn === void 0 ? void 0 : disposeFn(error);
|
|
301
|
+
};
|
|
302
|
+
this.mc = (0, telemetry_utils_1.createChildMonitoringContext)({
|
|
303
|
+
logger: this.logger,
|
|
304
|
+
namespace: "ContainerRuntime",
|
|
305
|
+
});
|
|
253
306
|
let loadSummaryNumber;
|
|
254
307
|
// Get the container creation metadata. For new container, we initialize these. For existing containers,
|
|
255
308
|
// get the values from the metadata blob.
|
|
@@ -260,10 +313,10 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
260
313
|
};
|
|
261
314
|
// summaryNumber was renamed from summaryCount. For older docs that haven't been opened for a long time,
|
|
262
315
|
// the count is reset to 0.
|
|
263
|
-
loadSummaryNumber = (
|
|
316
|
+
loadSummaryNumber = (_c = metadata === null || metadata === void 0 ? void 0 : metadata.summaryNumber) !== null && _c !== void 0 ? _c : 0;
|
|
264
317
|
// Enabling the IdCompressor is a one-way operation and we only want to
|
|
265
318
|
// allow new containers to turn it on
|
|
266
|
-
this.idCompressorEnabled = (
|
|
319
|
+
this.idCompressorEnabled = (_d = metadata === null || metadata === void 0 ? void 0 : metadata.idCompressorEnabled) !== null && _d !== void 0 ? _d : false;
|
|
267
320
|
}
|
|
268
321
|
else {
|
|
269
322
|
this.createContainerMetadata = {
|
|
@@ -272,12 +325,14 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
272
325
|
};
|
|
273
326
|
loadSummaryNumber = 0;
|
|
274
327
|
this.idCompressorEnabled =
|
|
275
|
-
(
|
|
328
|
+
(_e = this.mc.config.getBoolean("Fluid.ContainerRuntime.IdCompressorEnabled")) !== null && _e !== void 0 ? _e : idCompressor !== undefined;
|
|
276
329
|
}
|
|
277
330
|
this.nextSummaryNumber = loadSummaryNumber + 1;
|
|
278
331
|
this.messageAtLastSummary = metadata === null || metadata === void 0 ? void 0 : metadata.message;
|
|
279
|
-
|
|
280
|
-
|
|
332
|
+
// Note that we only need to pull the *initial* connected state from the context.
|
|
333
|
+
// Later updates come through calls to setConnectionState.
|
|
334
|
+
this._connected = connected;
|
|
335
|
+
this.gcTombstoneEnforcementAllowed = (0, gc_1.shouldAllowGcTombstoneEnforcement)((_f = metadata === null || metadata === void 0 ? void 0 : metadata.gcFeatureMatrix) === null || _f === void 0 ? void 0 : _f.tombstoneGeneration /* persisted */, this.runtimeOptions.gcOptions[gc_1.gcTombstoneGenerationOptionName] /* current */);
|
|
281
336
|
this.mc.logger.sendTelemetryEvent({
|
|
282
337
|
eventName: "GCFeatureMatrix",
|
|
283
338
|
metadataValue: JSON.stringify(metadata === null || metadata === void 0 ? void 0 : metadata.gcFeatureMatrix),
|
|
@@ -285,11 +340,11 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
285
340
|
gcOptions_gcTombstoneGeneration: this.runtimeOptions.gcOptions[gc_1.gcTombstoneGenerationOptionName],
|
|
286
341
|
}),
|
|
287
342
|
});
|
|
288
|
-
this.telemetryDocumentId = (
|
|
343
|
+
this.telemetryDocumentId = (_g = metadata === null || metadata === void 0 ? void 0 : metadata.telemetryDocumentId) !== null && _g !== void 0 ? _g : (0, uuid_1.v4)();
|
|
289
344
|
this.disableAttachReorder = this.mc.config.getBoolean("Fluid.ContainerRuntime.disableAttachOpReorder");
|
|
290
345
|
const disableChunking = this.mc.config.getBoolean("Fluid.ContainerRuntime.CompressionChunkingDisabled");
|
|
291
346
|
const opGroupingManager = new opLifecycle_1.OpGroupingManager(this.groupedBatchingEnabled);
|
|
292
|
-
const opSplitter = new opLifecycle_1.OpSplitter(chunks, this.
|
|
347
|
+
const opSplitter = new opLifecycle_1.OpSplitter(chunks, this.submitBatchFn, disableChunking === true ? Number.POSITIVE_INFINITY : runtimeOptions.chunkSizeInBytes, runtimeOptions.maxBatchSizeInBytes, this.mc.logger);
|
|
293
348
|
this.remoteMessageProcessor = new opLifecycle_1.RemoteMessageProcessor(opSplitter, new opLifecycle_1.OpDecompressor(this.mc.logger), opGroupingManager);
|
|
294
349
|
this.handleContext = new containerHandleContext_1.ContainerFluidHandleContext("", this);
|
|
295
350
|
if (this.summaryConfiguration.state === "enabled") {
|
|
@@ -308,9 +363,9 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
308
363
|
this.idCompressor = idCompressor;
|
|
309
364
|
}
|
|
310
365
|
this.maxConsecutiveReconnects =
|
|
311
|
-
(
|
|
366
|
+
(_h = this.mc.config.getNumber(maxConsecutiveReconnectsKey)) !== null && _h !== void 0 ? _h : this.defaultMaxConsecutiveReconnects;
|
|
312
367
|
if (runtimeOptions.flushMode === runtime_definitions_1.FlushModeExperimental.Async &&
|
|
313
|
-
(
|
|
368
|
+
(supportedFeatures === null || supportedFeatures === void 0 ? void 0 : supportedFeatures.get("referenceSequenceNumbers")) !== true) {
|
|
314
369
|
// The loader does not support reference sequence numbers, falling back on FlushMode.TurnBased
|
|
315
370
|
this.mc.logger.sendErrorEvent({ eventName: "FlushModeFallback" });
|
|
316
371
|
this._flushMode = runtime_definitions_1.FlushMode.TurnBased;
|
|
@@ -318,7 +373,7 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
318
373
|
else {
|
|
319
374
|
this._flushMode = runtimeOptions.flushMode;
|
|
320
375
|
}
|
|
321
|
-
const pendingRuntimeState =
|
|
376
|
+
const pendingRuntimeState = pendingLocalState;
|
|
322
377
|
const maxSnapshotCacheDurationMs = (_k = (_j = this._storage) === null || _j === void 0 ? void 0 : _j.policies) === null || _k === void 0 ? void 0 : _k.maximumCacheDurationMs;
|
|
323
378
|
if (maxSnapshotCacheDurationMs !== undefined &&
|
|
324
379
|
maxSnapshotCacheDurationMs > 5 * 24 * 60 * 60 * 1000) {
|
|
@@ -330,12 +385,12 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
330
385
|
this.garbageCollector = gc_1.GarbageCollector.create({
|
|
331
386
|
runtime: this,
|
|
332
387
|
gcOptions: this.runtimeOptions.gcOptions,
|
|
333
|
-
baseSnapshot
|
|
388
|
+
baseSnapshot,
|
|
334
389
|
baseLogger: this.mc.logger,
|
|
335
390
|
existing,
|
|
336
391
|
metadata,
|
|
337
392
|
createContainerMetadata: this.createContainerMetadata,
|
|
338
|
-
isSummarizerClient: this.
|
|
393
|
+
isSummarizerClient: this.isSummarizerClient,
|
|
339
394
|
getNodePackagePath: async (nodePath) => this.getGCNodePackagePath(nodePath),
|
|
340
395
|
getLastSummaryTimestampMs: () => { var _a; return (_a = this.messageAtLastSummary) === null || _a === void 0 ? void 0 : _a.timestamp; },
|
|
341
396
|
readAndParseBlob: async (id) => (0, driver_utils_1.readAndParse)(this.storage, id),
|
|
@@ -344,13 +399,13 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
344
399
|
activeConnection: () => this.innerDeltaManager.active,
|
|
345
400
|
});
|
|
346
401
|
const loadedFromSequenceNumber = this.deltaManager.initialSequenceNumber;
|
|
347
|
-
this.summarizerNode = (0, summary_1.createRootSummarizerNodeWithGC)(telemetry_utils_1.
|
|
402
|
+
this.summarizerNode = (0, summary_1.createRootSummarizerNodeWithGC)((0, telemetry_utils_1.createChildLogger)({ logger: this.logger, namespace: "SummarizerNode" }),
|
|
348
403
|
// Summarize function to call when summarize is called. Summarizer node always tracks summary state.
|
|
349
404
|
async (fullTree, trackState, telemetryContext) => this.summarizeInternal(fullTree, trackState, telemetryContext),
|
|
350
405
|
// Latest change sequence number, no changes since summary applied yet
|
|
351
406
|
loadedFromSequenceNumber,
|
|
352
407
|
// Summary reference sequence number, undefined if no summary yet
|
|
353
|
-
|
|
408
|
+
baseSnapshot !== undefined ? loadedFromSequenceNumber : undefined, {
|
|
354
409
|
// Must set to false to prevent sending summary handle which would be pointing to
|
|
355
410
|
// a summary with an older protocol state.
|
|
356
411
|
canReuseHandle: false,
|
|
@@ -364,19 +419,19 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
364
419
|
async (fullGC) => this.getGCDataInternal(fullGC),
|
|
365
420
|
// Function to get the GC details from the base snapshot we loaded from.
|
|
366
421
|
async () => this.garbageCollector.getBaseGCDetails());
|
|
367
|
-
if (
|
|
368
|
-
this.summarizerNode.updateBaseSummaryState(
|
|
422
|
+
if (baseSnapshot) {
|
|
423
|
+
this.summarizerNode.updateBaseSummaryState(baseSnapshot);
|
|
369
424
|
}
|
|
370
|
-
this.dataStores = new dataStores_1.DataStores((0, dataStores_1.getSummaryForDatastores)(
|
|
425
|
+
this.dataStores = new dataStores_1.DataStores((0, dataStores_1.getSummaryForDatastores)(baseSnapshot, metadata), this, (attachMsg) => this.submit({ type: ContainerMessageType.Attach, contents: attachMsg }), (id, createParam) => (summarizeInternal, getGCDataFn) => this.summarizerNode.createChild(summarizeInternal, id, createParam, undefined, getGCDataFn), (id) => this.summarizerNode.deleteChild(id), this.mc.logger, (path, timestampMs, packagePath) => this.garbageCollector.nodeUpdated(path, "Changed", timestampMs, packagePath), (path) => this.garbageCollector.isNodeDeleted(path), new Map(dataStoreAliasMap));
|
|
371
426
|
this.blobManager = new blobManager_1.BlobManager(this.handleContext, blobManagerSnapshot, () => this.storage, (localId, blobId) => {
|
|
372
427
|
if (!this.disposed) {
|
|
373
|
-
this.submit(ContainerMessageType.BlobAttach, undefined, undefined, {
|
|
428
|
+
this.submit({ type: ContainerMessageType.BlobAttach, contents: undefined }, undefined, {
|
|
374
429
|
localId,
|
|
375
430
|
blobId,
|
|
376
431
|
});
|
|
377
432
|
}
|
|
378
433
|
}, (blobPath) => this.garbageCollector.nodeUpdated(blobPath, "Loaded"), (blobPath) => this.garbageCollector.isNodeDeleted(blobPath), this, pendingRuntimeState === null || pendingRuntimeState === void 0 ? void 0 : pendingRuntimeState.pendingAttachmentBlobs, (error) => this.closeFn(error));
|
|
379
|
-
this.scheduleManager = new scheduleManager_1.ScheduleManager(
|
|
434
|
+
this.scheduleManager = new scheduleManager_1.ScheduleManager(this.innerDeltaManager, this, () => this.clientId, (0, telemetry_utils_1.createChildLogger)({ logger: this.logger, namespace: "ScheduleManager" }));
|
|
380
435
|
this.pendingStateManager = new pendingStateManager_1.PendingStateManager({
|
|
381
436
|
applyStashedOp: this.applyStashedOp.bind(this),
|
|
382
437
|
clientId: () => this.clientId,
|
|
@@ -384,7 +439,8 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
384
439
|
connected: () => this.connected,
|
|
385
440
|
reSubmit: this.reSubmit.bind(this),
|
|
386
441
|
reSubmitBatch: this.reSubmitBatch.bind(this),
|
|
387
|
-
|
|
442
|
+
isActiveConnection: () => this.innerDeltaManager.active,
|
|
443
|
+
}, pendingRuntimeState === null || pendingRuntimeState === void 0 ? void 0 : pendingRuntimeState.pending, this.logger);
|
|
388
444
|
const disableCompression = this.mc.config.getBoolean("Fluid.ContainerRuntime.CompressionDisabled");
|
|
389
445
|
const compressionOptions = disableCompression === true
|
|
390
446
|
? {
|
|
@@ -393,10 +449,12 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
393
449
|
}
|
|
394
450
|
: runtimeOptions.compressionOptions;
|
|
395
451
|
const disablePartialFlush = this.mc.config.getBoolean("Fluid.ContainerRuntime.DisablePartialFlush");
|
|
452
|
+
const legacySendBatchFn = (0, exports.makeLegacySendBatchFn)(this.submitFn, this.innerDeltaManager);
|
|
396
453
|
this.outbox = new opLifecycle_1.Outbox({
|
|
397
454
|
shouldSend: () => this.canSendOps(),
|
|
398
455
|
pendingStateManager: this.pendingStateManager,
|
|
399
|
-
|
|
456
|
+
submitBatchFn: this.submitBatchFn,
|
|
457
|
+
legacySendBatchFn,
|
|
400
458
|
compressor: new opLifecycle_1.OpCompressor(this.mc.logger),
|
|
401
459
|
splitter: opSplitter,
|
|
402
460
|
config: {
|
|
@@ -415,9 +473,12 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
415
473
|
opReentrancy: () => this.ensureNoDataModelChangesCalls > 0,
|
|
416
474
|
closeContainer: this.closeFn,
|
|
417
475
|
});
|
|
418
|
-
this.
|
|
476
|
+
this._quorum = quorum;
|
|
477
|
+
this._quorum.on("removeMember", (clientId) => {
|
|
419
478
|
this.remoteMessageProcessor.clearPartialMessagesFor(clientId);
|
|
420
479
|
});
|
|
480
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
481
|
+
this._audience = audience;
|
|
421
482
|
this.summaryStateUpdateMethod = this.mc.config.getString("Fluid.ContainerRuntime.Test.SummaryStateUpdateMethodV2");
|
|
422
483
|
const closeSummarizerDelayOverride = this.mc.config.getNumber("Fluid.ContainerRuntime.Test.CloseSummarizerDelayOverrideMs");
|
|
423
484
|
this.closeSummarizerDelayMs = closeSummarizerDelayOverride !== null && closeSummarizerDelayOverride !== void 0 ? closeSummarizerDelayOverride : defaultCloseSummarizerDelayMs;
|
|
@@ -425,34 +486,39 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
425
486
|
(_l = this.mc.config.getBoolean("Fluid.ContainerRuntime.Test.ValidateSummaryBeforeUpload")) !== null && _l !== void 0 ? _l : false;
|
|
426
487
|
this.summaryCollection = new summary_1.SummaryCollection(this.deltaManager, this.logger);
|
|
427
488
|
this.dirtyContainer =
|
|
428
|
-
this.
|
|
489
|
+
this.attachState !== container_definitions_1.AttachState.Attached ||
|
|
429
490
|
this.pendingStateManager.hasPendingMessages();
|
|
430
|
-
|
|
491
|
+
context.updateDirtyContainerState(this.dirtyContainer);
|
|
431
492
|
if (this.summariesDisabled) {
|
|
432
493
|
this.mc.logger.sendTelemetryEvent({ eventName: "SummariesDisabled" });
|
|
433
494
|
}
|
|
434
495
|
else {
|
|
435
|
-
const orderedClientLogger =
|
|
436
|
-
|
|
437
|
-
|
|
496
|
+
const orderedClientLogger = (0, telemetry_utils_1.createChildLogger)({
|
|
497
|
+
logger: this.logger,
|
|
498
|
+
namespace: "OrderedClientElection",
|
|
499
|
+
});
|
|
500
|
+
const orderedClientCollection = new summary_1.OrderedClientCollection(orderedClientLogger, this.innerDeltaManager, this._quorum);
|
|
501
|
+
const orderedClientElectionForSummarizer = new summary_1.OrderedClientElection(orderedClientLogger, orderedClientCollection, electedSummarizerData !== null && electedSummarizerData !== void 0 ? electedSummarizerData : this.innerDeltaManager.lastSequenceNumber, summary_1.SummarizerClientElection.isClientEligible);
|
|
438
502
|
this.summarizerClientElection = new summary_1.SummarizerClientElection(orderedClientLogger, this.summaryCollection, orderedClientElectionForSummarizer, this.maxOpsSinceLastSummary);
|
|
439
|
-
if (this.
|
|
503
|
+
if (this.isSummarizerClient) {
|
|
440
504
|
this._summarizer = new summary_1.Summarizer(this /* ISummarizerRuntime */, () => this.summaryConfiguration, this /* ISummarizerInternalsProvider */, this.handleContext, this.summaryCollection, async (runtime) => summary_1.RunWhileConnectedCoordinator.create(runtime,
|
|
441
505
|
// Summarization runs in summarizer client and needs access to the real (non-proxy) active
|
|
442
506
|
// information. The proxy delta manager would always return false for summarizer client.
|
|
443
507
|
() => this.innerDeltaManager.active));
|
|
444
508
|
}
|
|
445
|
-
else if (summary_1.SummarizerClientElection.clientDetailsPermitElection(this.
|
|
509
|
+
else if (summary_1.SummarizerClientElection.clientDetailsPermitElection(this.clientDetails)) {
|
|
446
510
|
// Only create a SummaryManager and SummarizerClientElection
|
|
447
511
|
// if summaries are enabled and we are not the summarizer client.
|
|
448
512
|
const defaultAction = () => {
|
|
449
513
|
if (this.summaryCollection.opsSinceLastAck > this.maxOpsSinceLastSummary) {
|
|
450
|
-
this.logger.sendTelemetryEvent({ eventName: "SummaryStatus:Behind" });
|
|
514
|
+
this.mc.logger.sendTelemetryEvent({ eventName: "SummaryStatus:Behind" });
|
|
451
515
|
// unregister default to no log on every op after falling behind
|
|
452
516
|
// and register summary ack handler to re-register this handler
|
|
453
517
|
// after successful summary
|
|
454
518
|
this.summaryCollection.once(protocol_definitions_1.MessageType.SummaryAck, () => {
|
|
455
|
-
this.logger.sendTelemetryEvent({
|
|
519
|
+
this.mc.logger.sendTelemetryEvent({
|
|
520
|
+
eventName: "SummaryStatus:CaughtUp",
|
|
521
|
+
});
|
|
456
522
|
// we've caught up, so re-register the default action to monitor for
|
|
457
523
|
// falling behind, and unregister ourself
|
|
458
524
|
this.summaryCollection.on("default", defaultAction);
|
|
@@ -463,7 +529,7 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
463
529
|
this.summaryCollection.on("default", defaultAction);
|
|
464
530
|
// Create the SummaryManager and mark the initial state
|
|
465
531
|
this.summaryManager = new summary_1.SummaryManager(this.summarizerClientElection, this, // IConnectedState
|
|
466
|
-
this.summaryCollection, this.logger, this.formRequestSummarizerFn(
|
|
532
|
+
this.summaryCollection, this.logger, this.formRequestSummarizerFn(loader), new throttler_1.Throttler(60 * 1000, // 60 sec delay window
|
|
467
533
|
30 * 1000, // 30 sec max delay
|
|
468
534
|
// throttling function increases exponentially (0ms, 40ms, 80ms, 160ms, etc)
|
|
469
535
|
(0, throttler_1.formExponentialFn)({ coefficient: 20, initialDelay: 0 })), {
|
|
@@ -494,7 +560,7 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
494
560
|
});
|
|
495
561
|
// logging hardware telemetry
|
|
496
562
|
logger.sendTelemetryEvent(Object.assign({ eventName: "DeviceSpec" }, getDeviceSpec()));
|
|
497
|
-
this.logger.sendTelemetryEvent(Object.assign(Object.assign(Object.assign({ eventName: "ContainerLoadStats" }, this.createContainerMetadata), this.dataStores.containerLoadStats), { summaryNumber: loadSummaryNumber, summaryFormatVersion: metadata === null || metadata === void 0 ? void 0 : metadata.summaryFormatVersion, disableIsolatedChannels: metadata === null || metadata === void 0 ? void 0 : metadata.disableIsolatedChannels, gcVersion: metadata === null || metadata === void 0 ? void 0 : metadata.gcFeature, options: JSON.stringify(runtimeOptions), featureGates: JSON.stringify({
|
|
563
|
+
this.mc.logger.sendTelemetryEvent(Object.assign(Object.assign(Object.assign({ eventName: "ContainerLoadStats" }, this.createContainerMetadata), this.dataStores.containerLoadStats), { summaryNumber: loadSummaryNumber, summaryFormatVersion: metadata === null || metadata === void 0 ? void 0 : metadata.summaryFormatVersion, disableIsolatedChannels: metadata === null || metadata === void 0 ? void 0 : metadata.disableIsolatedChannels, gcVersion: metadata === null || metadata === void 0 ? void 0 : metadata.gcFeature, options: JSON.stringify(runtimeOptions), featureGates: JSON.stringify({
|
|
498
564
|
disableCompression,
|
|
499
565
|
disableOpReentryCheck,
|
|
500
566
|
disableChunking,
|
|
@@ -504,10 +570,10 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
504
570
|
summaryStateUpdateMethod: this.summaryStateUpdateMethod,
|
|
505
571
|
closeSummarizerDelayOverride,
|
|
506
572
|
}), telemetryDocumentId: this.telemetryDocumentId, groupedBatchingEnabled: this.groupedBatchingEnabled }));
|
|
507
|
-
(0, connectionTelemetry_1.ReportOpPerfTelemetry)(this.
|
|
573
|
+
(0, connectionTelemetry_1.ReportOpPerfTelemetry)(this.clientId, this.deltaManager, this.logger);
|
|
508
574
|
(0, batchTracker_1.BindBatchTracker)(this, this.logger);
|
|
509
575
|
this.entryPoint = new core_utils_1.LazyPromise(async () => {
|
|
510
|
-
if (this.
|
|
576
|
+
if (this.isSummarizerClient) {
|
|
511
577
|
(0, common_utils_1.assert)(this._summarizer !== undefined, 0x5bf /* Summarizer object is undefined in a summarizer client */);
|
|
512
578
|
return this._summarizer;
|
|
513
579
|
}
|
|
@@ -565,9 +631,12 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
565
631
|
// back-compat: Remove the TaggedLoggerAdapter fallback once all the host are using loader > 0.45
|
|
566
632
|
const backCompatContext = context;
|
|
567
633
|
const passLogger = (_a = backCompatContext.taggedLogger) !== null && _a !== void 0 ? _a : new telemetry_utils_1.TaggedLoggerAdapter(backCompatContext.logger);
|
|
568
|
-
const logger = telemetry_utils_1.
|
|
569
|
-
|
|
570
|
-
|
|
634
|
+
const logger = (0, telemetry_utils_1.createChildLogger)({
|
|
635
|
+
logger: passLogger,
|
|
636
|
+
properties: {
|
|
637
|
+
all: {
|
|
638
|
+
runtimeVersion: packageVersion_1.pkgVersion,
|
|
639
|
+
},
|
|
571
640
|
},
|
|
572
641
|
});
|
|
573
642
|
const { summaryOptions = {}, gcOptions = {}, loadSequenceNumberVerification = "close", flushMode = defaultFlushMode, compressionOptions = defaultCompressionConfig, maxBatchSizeInBytes = defaultMaxBatchSizeInBytes, enableRuntimeIdCompressor = false, chunkSizeInBytes = defaultChunkSizeInBytes, enableOpReentryCheck = false, enableGroupedBatching = false, } = runtimeOptions;
|
|
@@ -648,38 +717,15 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
648
717
|
await runtime.initializeBaseState();
|
|
649
718
|
return runtime;
|
|
650
719
|
}
|
|
651
|
-
get options() {
|
|
652
|
-
return this.context.options;
|
|
653
|
-
}
|
|
654
720
|
get clientId() {
|
|
655
|
-
return this.
|
|
656
|
-
}
|
|
657
|
-
get clientDetails() {
|
|
658
|
-
return this.context.clientDetails;
|
|
721
|
+
return this._getClientId();
|
|
659
722
|
}
|
|
660
723
|
get storage() {
|
|
661
724
|
return this._storage;
|
|
662
725
|
}
|
|
726
|
+
/** @deprecated - The functionality is no longer exposed publicly */
|
|
663
727
|
get reSubmitFn() {
|
|
664
|
-
|
|
665
|
-
return this.reSubmitCore;
|
|
666
|
-
}
|
|
667
|
-
get disposeFn() {
|
|
668
|
-
var _a;
|
|
669
|
-
// In old loaders without dispose functionality, closeFn is equivalent but will also switch container to readonly mode
|
|
670
|
-
return (_a = this.context.disposeFn) !== null && _a !== void 0 ? _a : this.context.closeFn;
|
|
671
|
-
}
|
|
672
|
-
get closeFn() {
|
|
673
|
-
if (this._summarizer !== undefined) {
|
|
674
|
-
// In cases of summarizer, we want to dispose instead since consumer doesn't interact with this container
|
|
675
|
-
return this.disposeFn;
|
|
676
|
-
}
|
|
677
|
-
// Also call disposeFn to retain functionality of runtime being disposed on close
|
|
678
|
-
return (error) => {
|
|
679
|
-
var _a, _b;
|
|
680
|
-
this.context.closeFn(error);
|
|
681
|
-
(_b = (_a = this.context).disposeFn) === null || _b === void 0 ? void 0 : _b.call(_a, error);
|
|
682
|
-
};
|
|
728
|
+
return (type, contents, localOpMetadata, opMetadata) => this.reSubmitCore({ type, contents }, localOpMetadata, opMetadata);
|
|
683
729
|
}
|
|
684
730
|
get flushMode() {
|
|
685
731
|
return this._flushMode;
|
|
@@ -691,7 +737,7 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
691
737
|
return this.registry;
|
|
692
738
|
}
|
|
693
739
|
get attachState() {
|
|
694
|
-
return this.
|
|
740
|
+
return this._getAttachState();
|
|
695
741
|
}
|
|
696
742
|
get IFluidHandleContext() {
|
|
697
743
|
return this.handleContext;
|
|
@@ -761,7 +807,7 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
761
807
|
return;
|
|
762
808
|
}
|
|
763
809
|
this._disposed = true;
|
|
764
|
-
this.logger.sendTelemetryEvent({
|
|
810
|
+
this.mc.logger.sendTelemetryEvent({
|
|
765
811
|
eventName: "ContainerRuntimeDisposed",
|
|
766
812
|
isDirty: this.isDirty,
|
|
767
813
|
lastSequenceNumber: this.deltaManager.lastSequenceNumber,
|
|
@@ -996,9 +1042,9 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
996
1042
|
*/
|
|
997
1043
|
parseOpContent(serializedContent) {
|
|
998
1044
|
(0, common_utils_1.assert)(serializedContent !== undefined, 0x6d5 /* content must be defined */);
|
|
999
|
-
const
|
|
1000
|
-
(0, common_utils_1.assert)(
|
|
1001
|
-
return { type
|
|
1045
|
+
const { type, contents } = JSON.parse(serializedContent);
|
|
1046
|
+
(0, common_utils_1.assert)(type !== undefined, 0x6d6 /* incorrect op content format */);
|
|
1047
|
+
return { type, contents };
|
|
1002
1048
|
}
|
|
1003
1049
|
async applyStashedOp(op) {
|
|
1004
1050
|
// Need to parse from string for back-compat
|
|
@@ -1057,6 +1103,12 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1057
1103
|
// There might be no change of state due to Container calling this API after loading runtime.
|
|
1058
1104
|
const changeOfState = this._connected !== connected;
|
|
1059
1105
|
const reconnection = changeOfState && !connected;
|
|
1106
|
+
// We need to flush the ops currently collected by Outbox to preserve original order.
|
|
1107
|
+
// This flush NEEDS to happen before we set the ContainerRuntime to "connected".
|
|
1108
|
+
// We want these ops to get to the PendingStateManager without sending to service and have them return to the Outbox upon calling "replayPendingStates".
|
|
1109
|
+
if (changeOfState && connected) {
|
|
1110
|
+
this.flush();
|
|
1111
|
+
}
|
|
1060
1112
|
this._connected = connected;
|
|
1061
1113
|
if (!connected) {
|
|
1062
1114
|
this._perfSignalData.signalsLost = 0;
|
|
@@ -1100,6 +1152,12 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1100
1152
|
this.processCore(message, local, runtimeMessage);
|
|
1101
1153
|
}
|
|
1102
1154
|
}
|
|
1155
|
+
/**
|
|
1156
|
+
* Direct the message to the correct subsystem for processing, and implement other side effects
|
|
1157
|
+
* @param message - The unpacked message. Likely a ContainerRuntimeMessage, but could also be a system op
|
|
1158
|
+
* @param local - Did this client send the op?
|
|
1159
|
+
* @param runtimeMessage - Does this appear like a current ContainerRuntimeMessage? If true, certain validation will occur.
|
|
1160
|
+
*/
|
|
1103
1161
|
processCore(message, local, runtimeMessage) {
|
|
1104
1162
|
var _a;
|
|
1105
1163
|
// Surround the actual processing of the operation with messages to the schedule manager indicating
|
|
@@ -1153,9 +1211,7 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1153
1211
|
throw error;
|
|
1154
1212
|
}
|
|
1155
1213
|
}
|
|
1156
|
-
|
|
1157
|
-
this.emit("op", message, runtimeMessage);
|
|
1158
|
-
}
|
|
1214
|
+
this.emit("op", message, runtimeMessage);
|
|
1159
1215
|
this.scheduleManager.afterOpProcessing(undefined, message);
|
|
1160
1216
|
if (local) {
|
|
1161
1217
|
// If we have processed a local op, this means that the container is
|
|
@@ -1178,7 +1234,7 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1178
1234
|
*/
|
|
1179
1235
|
sendSignalTelemetryEvent(clientSignalSequenceNumber) {
|
|
1180
1236
|
const duration = Date.now() - this._perfSignalData.signalTimestamp;
|
|
1181
|
-
this.logger.sendPerformanceEvent({
|
|
1237
|
+
this.mc.logger.sendPerformanceEvent({
|
|
1182
1238
|
eventName: "SignalLatency",
|
|
1183
1239
|
duration,
|
|
1184
1240
|
signalsLost: this._perfSignalData.signalsLost,
|
|
@@ -1201,7 +1257,7 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1201
1257
|
this._perfSignalData.trackingSignalSequenceNumber) {
|
|
1202
1258
|
this._perfSignalData.signalsLost++;
|
|
1203
1259
|
this._perfSignalData.trackingSignalSequenceNumber = undefined;
|
|
1204
|
-
this.logger.sendErrorEvent({
|
|
1260
|
+
this.mc.logger.sendErrorEvent({
|
|
1205
1261
|
eventName: "SignalLost",
|
|
1206
1262
|
type: envelope.contents.type,
|
|
1207
1263
|
signalsLost: this._perfSignalData.signalsLost,
|
|
@@ -1322,11 +1378,10 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1322
1378
|
return this.flushMode !== runtime_definitions_1.FlushMode.Immediate || this._orderSequentiallyCalls !== 0;
|
|
1323
1379
|
}
|
|
1324
1380
|
getQuorum() {
|
|
1325
|
-
return this.
|
|
1381
|
+
return this._quorum;
|
|
1326
1382
|
}
|
|
1327
1383
|
getAudience() {
|
|
1328
|
-
|
|
1329
|
-
return this.context.audience;
|
|
1384
|
+
return this._audience;
|
|
1330
1385
|
}
|
|
1331
1386
|
/**
|
|
1332
1387
|
* Returns true of container is dirty, i.e. there are some pending local changes that
|
|
@@ -1335,7 +1390,7 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1335
1390
|
get isDirty() {
|
|
1336
1391
|
return this.dirtyContainer;
|
|
1337
1392
|
}
|
|
1338
|
-
isContainerMessageDirtyable(type, contents) {
|
|
1393
|
+
isContainerMessageDirtyable({ type, contents }) {
|
|
1339
1394
|
// For legacy purposes, exclude the old built-in AgentScheduler from dirty consideration as a special-case.
|
|
1340
1395
|
// Ultimately we should have no special-cases from the ContainerRuntime's perspective.
|
|
1341
1396
|
if (type === ContainerMessageType.Attach) {
|
|
@@ -1375,11 +1430,11 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1375
1430
|
submitSignal(type, content) {
|
|
1376
1431
|
this.verifyNotClosed();
|
|
1377
1432
|
const envelope = this.createNewSignalEnvelope(undefined /* address */, type, content);
|
|
1378
|
-
return this.
|
|
1433
|
+
return this.submitSignalFn(envelope);
|
|
1379
1434
|
}
|
|
1380
1435
|
submitDataStoreSignal(address, type, content) {
|
|
1381
1436
|
const envelope = this.createNewSignalEnvelope(address, type, content);
|
|
1382
|
-
return this.
|
|
1437
|
+
return this.submitSignalFn(envelope);
|
|
1383
1438
|
}
|
|
1384
1439
|
setAttachState(attachState) {
|
|
1385
1440
|
if (attachState === container_definitions_1.AttachState.Attaching) {
|
|
@@ -1412,15 +1467,6 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1412
1467
|
this.addContainerStateToSummary(summarizeResult, true /* fullTree */, false /* trackState */, telemetryContext);
|
|
1413
1468
|
return summarizeResult.summary;
|
|
1414
1469
|
}
|
|
1415
|
-
async getAbsoluteUrl(relativeUrl) {
|
|
1416
|
-
if (this.context.getAbsoluteUrl === undefined) {
|
|
1417
|
-
throw new Error("Driver does not implement getAbsoluteUrl");
|
|
1418
|
-
}
|
|
1419
|
-
if (this.attachState !== container_definitions_1.AttachState.Attached) {
|
|
1420
|
-
return undefined;
|
|
1421
|
-
}
|
|
1422
|
-
return this.context.getAbsoluteUrl(relativeUrl);
|
|
1423
|
-
}
|
|
1424
1470
|
async summarizeInternal(fullTree, trackState, telemetryContext) {
|
|
1425
1471
|
const summarizeResult = await this.dataStores.summarize(fullTree, trackState, telemetryContext);
|
|
1426
1472
|
// Wrap data store summaries in .channels subtree.
|
|
@@ -1454,7 +1500,7 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1454
1500
|
return { stats, summary, gcStats };
|
|
1455
1501
|
}
|
|
1456
1502
|
finally {
|
|
1457
|
-
this.logger.sendTelemetryEvent({
|
|
1503
|
+
this.mc.logger.sendTelemetryEvent({
|
|
1458
1504
|
eventName: "SummarizeTelemetry",
|
|
1459
1505
|
details: telemetryContext.serialize(),
|
|
1460
1506
|
});
|
|
@@ -1621,18 +1667,25 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1621
1667
|
* @param options - options controlling how the summary is generated or submitted
|
|
1622
1668
|
*/
|
|
1623
1669
|
async submitSummary(options) {
|
|
1624
|
-
var _a, _b
|
|
1670
|
+
var _a, _b;
|
|
1625
1671
|
const { fullTree = false, refreshLatestAck, summaryLogger } = options;
|
|
1626
1672
|
// The summary number for this summary. This will be updated during the summary process, so get it now and
|
|
1627
1673
|
// use it for all events logged during this summary.
|
|
1628
1674
|
const summaryNumber = this.nextSummaryNumber;
|
|
1629
|
-
const summaryNumberLogger = telemetry_utils_1.
|
|
1630
|
-
|
|
1675
|
+
const summaryNumberLogger = (0, telemetry_utils_1.createChildLogger)({
|
|
1676
|
+
logger: summaryLogger,
|
|
1677
|
+
properties: {
|
|
1678
|
+
all: { summaryNumber },
|
|
1679
|
+
},
|
|
1631
1680
|
});
|
|
1632
1681
|
(0, common_utils_1.assert)(this.outbox.isEmpty, 0x3d1 /* Can't trigger summary in the middle of a batch */);
|
|
1633
1682
|
let latestSnapshotVersionId;
|
|
1634
1683
|
if (refreshLatestAck) {
|
|
1635
|
-
const latestSnapshotInfo = await this.refreshLatestSummaryAckFromServer(telemetry_utils_1.
|
|
1684
|
+
const latestSnapshotInfo = await this.refreshLatestSummaryAckFromServer((0, telemetry_utils_1.createChildLogger)({
|
|
1685
|
+
logger: summaryNumberLogger,
|
|
1686
|
+
namespace: undefined,
|
|
1687
|
+
properties: { all: { safeSummary: true } },
|
|
1688
|
+
}));
|
|
1636
1689
|
const latestSnapshotRefSeq = latestSnapshotInfo.latestSnapshotRefSeq;
|
|
1637
1690
|
latestSnapshotVersionId = latestSnapshotInfo.latestSnapshotVersionId;
|
|
1638
1691
|
// We might need to catch up to the latest summary's reference sequence number before pausing.
|
|
@@ -1766,7 +1819,7 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1766
1819
|
else if (lastAck === undefined) {
|
|
1767
1820
|
summaryContext = {
|
|
1768
1821
|
proposalHandle: undefined,
|
|
1769
|
-
ackHandle:
|
|
1822
|
+
ackHandle: this.loadedFromVersionId,
|
|
1770
1823
|
referenceSequenceNumber: summaryRefSeqNum,
|
|
1771
1824
|
};
|
|
1772
1825
|
}
|
|
@@ -1818,7 +1871,7 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1818
1871
|
// Cleanup wip summary in case of failure
|
|
1819
1872
|
this.summarizerNode.clearSummary();
|
|
1820
1873
|
// ! This needs to happen before we resume inbound queues to ensure heuristics are tracked correctly
|
|
1821
|
-
(
|
|
1874
|
+
(_b = (_a = this._summarizer) === null || _a === void 0 ? void 0 : _a.recordSummaryAttempt) === null || _b === void 0 ? void 0 : _b.call(_a, summaryRefSeqNum);
|
|
1822
1875
|
// Restart the delta manager
|
|
1823
1876
|
this.deltaManager.inbound.resume();
|
|
1824
1877
|
if (shouldPauseInboundSignal) {
|
|
@@ -1843,7 +1896,6 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1843
1896
|
this.dirtyContainer = dirty;
|
|
1844
1897
|
if (this.emitDirtyDocumentEvent) {
|
|
1845
1898
|
this.emit(dirty ? "dirty" : "saved");
|
|
1846
|
-
this.context.updateDirtyContainerState(dirty);
|
|
1847
1899
|
}
|
|
1848
1900
|
}
|
|
1849
1901
|
submitDataStoreOp(id, contents, localOpMetadata = undefined) {
|
|
@@ -1851,18 +1903,18 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1851
1903
|
address: id,
|
|
1852
1904
|
contents,
|
|
1853
1905
|
};
|
|
1854
|
-
this.submit(ContainerMessageType.FluidDataStoreOp, envelope, localOpMetadata);
|
|
1906
|
+
this.submit({ type: ContainerMessageType.FluidDataStoreOp, contents: envelope }, localOpMetadata);
|
|
1855
1907
|
}
|
|
1856
1908
|
submitDataStoreAliasOp(contents, localOpMetadata) {
|
|
1857
1909
|
const aliasMessage = contents;
|
|
1858
1910
|
if (!(0, dataStore_1.isDataStoreAliasMessage)(aliasMessage)) {
|
|
1859
1911
|
throw new container_utils_1.UsageError("malformedDataStoreAliasMessage");
|
|
1860
1912
|
}
|
|
1861
|
-
this.submit(ContainerMessageType.Alias, contents, localOpMetadata);
|
|
1913
|
+
this.submit({ type: ContainerMessageType.Alias, contents }, localOpMetadata);
|
|
1862
1914
|
}
|
|
1863
|
-
async uploadBlob(blob) {
|
|
1915
|
+
async uploadBlob(blob, signal) {
|
|
1864
1916
|
this.verifyNotClosed();
|
|
1865
|
-
return this.blobManager.createBlob(blob);
|
|
1917
|
+
return this.blobManager.createBlob(blob, signal);
|
|
1866
1918
|
}
|
|
1867
1919
|
maybeSubmitIdAllocationOp(type) {
|
|
1868
1920
|
var _a, _b;
|
|
@@ -1893,20 +1945,21 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1893
1945
|
}
|
|
1894
1946
|
}
|
|
1895
1947
|
}
|
|
1896
|
-
submit(
|
|
1948
|
+
submit(containerRuntimeMessage, localOpMetadata = undefined, metadata = undefined) {
|
|
1897
1949
|
this.verifyNotClosed();
|
|
1898
1950
|
this.verifyCanSubmitOps();
|
|
1899
1951
|
// There should be no ops in detached container state!
|
|
1900
1952
|
(0, common_utils_1.assert)(this.attachState !== container_definitions_1.AttachState.Detached, 0x132 /* "sending ops in detached container" */);
|
|
1901
|
-
const serializedContent = JSON.stringify(
|
|
1953
|
+
const serializedContent = JSON.stringify(containerRuntimeMessage);
|
|
1902
1954
|
// Note that the real (non-proxy) delta manager is used here to get the readonly info. This is because
|
|
1903
1955
|
// container runtime's ability to submit ops depend on the actual readonly state of the delta manager.
|
|
1904
1956
|
if (this.innerDeltaManager.readOnlyInfo.readonly) {
|
|
1905
|
-
this.logger.sendTelemetryEvent({
|
|
1957
|
+
this.mc.logger.sendTelemetryEvent({
|
|
1906
1958
|
eventName: "SubmitOpInReadonly",
|
|
1907
1959
|
connected: this.connected,
|
|
1908
1960
|
});
|
|
1909
1961
|
}
|
|
1962
|
+
const type = containerRuntimeMessage.type;
|
|
1910
1963
|
const message = {
|
|
1911
1964
|
contents: serializedContent,
|
|
1912
1965
|
type,
|
|
@@ -1963,7 +2016,7 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1963
2016
|
this.closeFn(error);
|
|
1964
2017
|
throw error;
|
|
1965
2018
|
}
|
|
1966
|
-
if (this.isContainerMessageDirtyable(
|
|
2019
|
+
if (this.isContainerMessageDirtyable(containerRuntimeMessage)) {
|
|
1967
2020
|
this.updateDocumentDirtyState(true);
|
|
1968
2021
|
}
|
|
1969
2022
|
}
|
|
@@ -2006,9 +2059,9 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
2006
2059
|
// System message should not be sent in the middle of the batch.
|
|
2007
2060
|
(0, common_utils_1.assert)(this.outbox.isEmpty, 0x3d4 /* System op in the middle of a batch */);
|
|
2008
2061
|
// back-compat: ADO #1385: Make this call unconditional in the future
|
|
2009
|
-
return this.
|
|
2010
|
-
? this.
|
|
2011
|
-
: this.
|
|
2062
|
+
return this.submitSummaryFn !== undefined
|
|
2063
|
+
? this.submitSummaryFn(contents, referenceSequenceNumber)
|
|
2064
|
+
: this.submitFn(protocol_definitions_1.MessageType.Summarize, contents, false);
|
|
2012
2065
|
}
|
|
2013
2066
|
/**
|
|
2014
2067
|
* Throw an error if the runtime is closed. Methods that are expected to potentially
|
|
@@ -2055,32 +2108,33 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
2055
2108
|
}
|
|
2056
2109
|
reSubmit(message) {
|
|
2057
2110
|
// Need to parse from string for back-compat
|
|
2058
|
-
const
|
|
2059
|
-
this.reSubmitCore(
|
|
2111
|
+
const containerRuntimeMessage = this.parseOpContent(message.content);
|
|
2112
|
+
this.reSubmitCore(containerRuntimeMessage, message.localOpMetadata, message.opMetadata);
|
|
2060
2113
|
}
|
|
2061
2114
|
/**
|
|
2062
2115
|
* Finds the right store and asks it to resubmit the message. This typically happens when we
|
|
2063
2116
|
* reconnect and there are pending messages.
|
|
2064
|
-
* @param
|
|
2117
|
+
* @param message - The original ContainerRuntimeMessage.
|
|
2065
2118
|
* @param localOpMetadata - The local metadata associated with the original message.
|
|
2066
2119
|
*/
|
|
2067
|
-
reSubmitCore(
|
|
2068
|
-
|
|
2120
|
+
reSubmitCore(message, localOpMetadata, opMetadata) {
|
|
2121
|
+
const contents = message.contents;
|
|
2122
|
+
switch (message.type) {
|
|
2069
2123
|
case ContainerMessageType.FluidDataStoreOp:
|
|
2070
2124
|
// For Operations, call resubmitDataStoreOp which will find the right store
|
|
2071
2125
|
// and trigger resubmission on it.
|
|
2072
|
-
this.dataStores.resubmitDataStoreOp(
|
|
2126
|
+
this.dataStores.resubmitDataStoreOp(contents, localOpMetadata);
|
|
2073
2127
|
break;
|
|
2074
2128
|
case ContainerMessageType.Attach:
|
|
2075
2129
|
case ContainerMessageType.Alias:
|
|
2076
|
-
this.submit(
|
|
2130
|
+
this.submit(message, localOpMetadata);
|
|
2077
2131
|
break;
|
|
2078
2132
|
case ContainerMessageType.IdAllocation:
|
|
2079
2133
|
// Remove the stashedState from the op if it's a stashed op
|
|
2080
|
-
if (
|
|
2081
|
-
delete
|
|
2134
|
+
if (contents.stashedState !== undefined) {
|
|
2135
|
+
delete contents.stashedState;
|
|
2082
2136
|
}
|
|
2083
|
-
this.submit(
|
|
2137
|
+
this.submit(message, localOpMetadata);
|
|
2084
2138
|
break;
|
|
2085
2139
|
case ContainerMessageType.ChunkedOp:
|
|
2086
2140
|
throw new Error(`chunkedOp not expected here`);
|
|
@@ -2088,10 +2142,10 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
2088
2142
|
this.blobManager.reSubmit(opMetadata);
|
|
2089
2143
|
break;
|
|
2090
2144
|
case ContainerMessageType.Rejoin:
|
|
2091
|
-
this.submit(
|
|
2145
|
+
this.submit(message);
|
|
2092
2146
|
break;
|
|
2093
2147
|
default:
|
|
2094
|
-
(0, common_utils_1.unreachableCase)(type, `Unknown ContainerMessageType: ${type}`);
|
|
2148
|
+
(0, common_utils_1.unreachableCase)(message.type, `Unknown ContainerMessageType [type: ${message.type}]`);
|
|
2095
2149
|
}
|
|
2096
2150
|
}
|
|
2097
2151
|
rollback(content, localOpMetadata) {
|
|
@@ -2138,7 +2192,7 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
2138
2192
|
* change that started fetching latest snapshot always.
|
|
2139
2193
|
*/
|
|
2140
2194
|
if (fetchResult.latestSnapshotRefSeq < summaryRefSeq) {
|
|
2141
|
-
fetchResult = await this.
|
|
2195
|
+
fetchResult = await this.fetchSnapshotFromStorageAndClose(summaryLogger, {
|
|
2142
2196
|
eventName: "RefreshLatestSummaryAckFetchBackCompat",
|
|
2143
2197
|
ackHandle,
|
|
2144
2198
|
targetSequenceNumber: summaryRefSeq,
|
|
@@ -2196,9 +2250,9 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
2196
2250
|
return { latestSnapshotRefSeq, latestSnapshotVersionId: versionId };
|
|
2197
2251
|
}
|
|
2198
2252
|
async fetchLatestSnapshotFromStorage(logger, event, readAndParseBlob) {
|
|
2199
|
-
return this.
|
|
2253
|
+
return this.fetchSnapshotFromStorageAndClose(logger, event, readAndParseBlob, null /* latest */);
|
|
2200
2254
|
}
|
|
2201
|
-
async
|
|
2255
|
+
async fetchSnapshotFromStorageAndClose(logger, event, readAndParseBlob, versionId) {
|
|
2202
2256
|
var _a;
|
|
2203
2257
|
const snapshotResults = await telemetry_utils_1.PerformanceEvent.timedExecAsync(logger, event, async (perfEvent) => {
|
|
2204
2258
|
const stats = {};
|
|
@@ -2222,14 +2276,12 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
2222
2276
|
// We choose to close the summarizer after the snapshot cache is updated to avoid
|
|
2223
2277
|
// situations which the main client (which is likely to be re-elected as the leader again)
|
|
2224
2278
|
// loads the summarizer from cache.
|
|
2225
|
-
if (this.summaryStateUpdateMethod
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
// Delay 10 seconds before restarting summarizer to prevent the summarizer from restarting too frequently.
|
|
2279
|
+
if (this.summaryStateUpdateMethod !== "refreshFromSnapshot") {
|
|
2280
|
+
this.mc.logger.sendTelemetryEvent(Object.assign(Object.assign({}, event), { eventName: "ClosingSummarizerOnSummaryStale", codePath: event.eventName, message: "Stopping fetch from storage", versionId: versionId != null ? versionId : undefined, closeSummarizerDelayMs: this.closeSummarizerDelayMs }), new container_utils_1.GenericError("Restarting summarizer instead of refreshing"));
|
|
2281
|
+
// Delay before restarting summarizer to prevent the summarizer from restarting too frequently.
|
|
2229
2282
|
await (0, common_utils_1.delay)(this.closeSummarizerDelayMs);
|
|
2230
2283
|
(_a = this._summarizer) === null || _a === void 0 ? void 0 : _a.stop("latestSummaryStateStale");
|
|
2231
|
-
this.
|
|
2232
|
-
throw error;
|
|
2284
|
+
this.disposeFn();
|
|
2233
2285
|
}
|
|
2234
2286
|
return snapshotResults;
|
|
2235
2287
|
}
|