@fluidframework/container-runtime 2.0.0-dev-rc.5.0.0.271717 → 2.0.0-dev-rc.5.0.0.272889
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/api-extractor/api-extractor-lint-bundle.json +5 -0
- package/api-extractor/api-extractor-lint-legacy.cjs.json +5 -0
- package/api-extractor/api-extractor-lint-legacy.esm.json +5 -0
- package/api-extractor/api-extractor-lint-public.cjs.json +5 -0
- package/api-extractor/api-extractor-lint-public.esm.json +5 -0
- package/api-extractor.json +1 -1
- package/api-report/container-runtime.alpha.api.md +1 -1
- package/container-runtime.test-files.tar +0 -0
- package/dist/batchTracker.d.ts.map +1 -1
- package/dist/batchTracker.js.map +1 -1
- package/dist/blobManager.d.ts.map +1 -1
- package/dist/blobManager.js.map +1 -1
- package/dist/channelCollection.d.ts +12 -2
- package/dist/channelCollection.d.ts.map +1 -1
- package/dist/channelCollection.js +86 -90
- package/dist/channelCollection.js.map +1 -1
- package/dist/connectionTelemetry.d.ts.map +1 -1
- package/dist/connectionTelemetry.js.map +1 -1
- package/dist/containerRuntime.d.ts +2 -1
- package/dist/containerRuntime.d.ts.map +1 -1
- package/dist/containerRuntime.js +29 -9
- package/dist/containerRuntime.js.map +1 -1
- package/dist/dataStoreContext.d.ts +2 -1
- package/dist/dataStoreContext.d.ts.map +1 -1
- package/dist/dataStoreContext.js +5 -3
- package/dist/dataStoreContext.js.map +1 -1
- package/dist/dataStoreContexts.d.ts.map +1 -1
- package/dist/dataStoreContexts.js.map +1 -1
- package/dist/deltaManagerProxies.d.ts.map +1 -1
- package/dist/deltaManagerProxies.js.map +1 -1
- package/dist/deltaScheduler.d.ts.map +1 -1
- package/dist/deltaScheduler.js +1 -3
- package/dist/deltaScheduler.js.map +1 -1
- package/dist/gc/garbageCollection.d.ts +4 -2
- package/dist/gc/garbageCollection.d.ts.map +1 -1
- package/dist/gc/garbageCollection.js +12 -8
- package/dist/gc/garbageCollection.js.map +1 -1
- package/dist/gc/gcConfigs.js +1 -1
- package/dist/gc/gcConfigs.js.map +1 -1
- package/dist/gc/gcDefinitions.d.ts +7 -4
- package/dist/gc/gcDefinitions.d.ts.map +1 -1
- package/dist/gc/gcDefinitions.js.map +1 -1
- package/dist/gc/gcHelpers.d.ts.map +1 -1
- package/dist/gc/gcHelpers.js.map +1 -1
- package/dist/gc/gcSummaryStateTracker.d.ts.map +1 -1
- package/dist/gc/gcSummaryStateTracker.js.map +1 -1
- package/dist/gc/gcTelemetry.d.ts +1 -1
- package/dist/gc/gcTelemetry.d.ts.map +1 -1
- package/dist/gc/gcTelemetry.js +1 -7
- package/dist/gc/gcTelemetry.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/messageTypes.d.ts +5 -21
- package/dist/messageTypes.d.ts.map +1 -1
- package/dist/messageTypes.js.map +1 -1
- package/dist/opLifecycle/index.d.ts +1 -1
- package/dist/opLifecycle/index.d.ts.map +1 -1
- package/dist/opLifecycle/index.js.map +1 -1
- package/dist/opLifecycle/opDecompressor.d.ts.map +1 -1
- package/dist/opLifecycle/opDecompressor.js +1 -2
- package/dist/opLifecycle/opDecompressor.js.map +1 -1
- package/dist/opLifecycle/opGroupingManager.d.ts.map +1 -1
- package/dist/opLifecycle/opGroupingManager.js.map +1 -1
- 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.map +1 -1
- package/dist/opLifecycle/outbox.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/pendingStateManager.d.ts.map +1 -1
- package/dist/pendingStateManager.js +1 -1
- package/dist/pendingStateManager.js.map +1 -1
- package/dist/summary/documentSchema.d.ts.map +1 -1
- package/dist/summary/documentSchema.js +1 -2
- package/dist/summary/documentSchema.js.map +1 -1
- package/dist/summary/index.d.ts +1 -1
- package/dist/summary/index.d.ts.map +1 -1
- package/dist/summary/index.js.map +1 -1
- package/dist/summary/orderedClientElection.d.ts.map +1 -1
- package/dist/summary/orderedClientElection.js.map +1 -1
- package/dist/summary/runningSummarizer.d.ts.map +1 -1
- package/dist/summary/runningSummarizer.js +1 -2
- package/dist/summary/runningSummarizer.js.map +1 -1
- package/dist/summary/summarizerClientElection.d.ts.map +1 -1
- package/dist/summary/summarizerClientElection.js.map +1 -1
- package/dist/summary/summarizerNode/summarizerNode.d.ts.map +1 -1
- package/dist/summary/summarizerNode/summarizerNode.js.map +1 -1
- package/dist/summary/summarizerNode/summarizerNodeUtils.d.ts.map +1 -1
- package/dist/summary/summarizerNode/summarizerNodeUtils.js.map +1 -1
- package/dist/summary/summarizerNode/summarizerNodeWithGc.d.ts.map +1 -1
- package/dist/summary/summarizerNode/summarizerNodeWithGc.js +4 -1
- package/dist/summary/summarizerNode/summarizerNodeWithGc.js.map +1 -1
- package/dist/summary/summarizerTypes.d.ts.map +1 -1
- package/dist/summary/summarizerTypes.js.map +1 -1
- package/dist/summary/summaryCollection.d.ts.map +1 -1
- package/dist/summary/summaryCollection.js.map +1 -1
- package/dist/summary/summaryFormat.d.ts.map +1 -1
- package/dist/summary/summaryFormat.js.map +1 -1
- package/dist/summary/summaryGenerator.d.ts.map +1 -1
- package/dist/summary/summaryGenerator.js +1 -2
- package/dist/summary/summaryGenerator.js.map +1 -1
- package/dist/summary/summaryManager.d.ts.map +1 -1
- package/dist/summary/summaryManager.js +1 -2
- package/dist/summary/summaryManager.js.map +1 -1
- package/dist/throttler.d.ts.map +1 -1
- package/dist/throttler.js +3 -1
- package/dist/throttler.js.map +1 -1
- package/lib/batchTracker.d.ts.map +1 -1
- package/lib/batchTracker.js +1 -1
- package/lib/batchTracker.js.map +1 -1
- package/lib/blobManager.d.ts.map +1 -1
- package/lib/blobManager.js +1 -1
- package/lib/blobManager.js.map +1 -1
- package/lib/channelCollection.d.ts +12 -2
- package/lib/channelCollection.d.ts.map +1 -1
- package/lib/channelCollection.js +86 -90
- package/lib/channelCollection.js.map +1 -1
- package/lib/connectionTelemetry.d.ts.map +1 -1
- package/lib/connectionTelemetry.js.map +1 -1
- package/lib/containerRuntime.d.ts +2 -1
- package/lib/containerRuntime.d.ts.map +1 -1
- package/lib/containerRuntime.js +32 -12
- package/lib/containerRuntime.js.map +1 -1
- package/lib/dataStoreContext.d.ts +2 -1
- package/lib/dataStoreContext.d.ts.map +1 -1
- package/lib/dataStoreContext.js +5 -3
- package/lib/dataStoreContext.js.map +1 -1
- package/lib/dataStoreContexts.d.ts.map +1 -1
- package/lib/dataStoreContexts.js +1 -1
- package/lib/dataStoreContexts.js.map +1 -1
- package/lib/deltaManagerProxies.d.ts.map +1 -1
- package/lib/deltaManagerProxies.js.map +1 -1
- package/lib/deltaScheduler.d.ts.map +1 -1
- package/lib/deltaScheduler.js +1 -3
- package/lib/deltaScheduler.js.map +1 -1
- package/lib/gc/garbageCollection.d.ts +4 -2
- package/lib/gc/garbageCollection.d.ts.map +1 -1
- package/lib/gc/garbageCollection.js +13 -9
- package/lib/gc/garbageCollection.js.map +1 -1
- package/lib/gc/gcConfigs.js +1 -1
- package/lib/gc/gcConfigs.js.map +1 -1
- package/lib/gc/gcDefinitions.d.ts +7 -4
- package/lib/gc/gcDefinitions.d.ts.map +1 -1
- package/lib/gc/gcDefinitions.js.map +1 -1
- package/lib/gc/gcHelpers.d.ts.map +1 -1
- package/lib/gc/gcHelpers.js.map +1 -1
- package/lib/gc/gcSummaryStateTracker.d.ts.map +1 -1
- package/lib/gc/gcSummaryStateTracker.js.map +1 -1
- package/lib/gc/gcTelemetry.d.ts +1 -1
- package/lib/gc/gcTelemetry.d.ts.map +1 -1
- package/lib/gc/gcTelemetry.js +1 -7
- package/lib/gc/gcTelemetry.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/messageTypes.d.ts +5 -21
- package/lib/messageTypes.d.ts.map +1 -1
- package/lib/messageTypes.js.map +1 -1
- package/lib/opLifecycle/index.d.ts +1 -1
- package/lib/opLifecycle/index.d.ts.map +1 -1
- package/lib/opLifecycle/index.js +1 -1
- package/lib/opLifecycle/index.js.map +1 -1
- package/lib/opLifecycle/opDecompressor.d.ts.map +1 -1
- package/lib/opLifecycle/opDecompressor.js +1 -2
- package/lib/opLifecycle/opDecompressor.js.map +1 -1
- package/lib/opLifecycle/opGroupingManager.d.ts.map +1 -1
- package/lib/opLifecycle/opGroupingManager.js.map +1 -1
- package/lib/opLifecycle/opSplitter.d.ts.map +1 -1
- package/lib/opLifecycle/opSplitter.js +1 -1
- package/lib/opLifecycle/opSplitter.js.map +1 -1
- package/lib/opLifecycle/outbox.d.ts.map +1 -1
- package/lib/opLifecycle/outbox.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/pendingStateManager.d.ts.map +1 -1
- package/lib/pendingStateManager.js +1 -1
- package/lib/pendingStateManager.js.map +1 -1
- package/lib/summary/documentSchema.d.ts.map +1 -1
- package/lib/summary/documentSchema.js +1 -2
- package/lib/summary/documentSchema.js.map +1 -1
- package/lib/summary/index.d.ts +1 -1
- package/lib/summary/index.d.ts.map +1 -1
- package/lib/summary/index.js +1 -1
- package/lib/summary/index.js.map +1 -1
- package/lib/summary/orderedClientElection.d.ts.map +1 -1
- package/lib/summary/orderedClientElection.js.map +1 -1
- package/lib/summary/runningSummarizer.d.ts.map +1 -1
- package/lib/summary/runningSummarizer.js +1 -2
- package/lib/summary/runningSummarizer.js.map +1 -1
- package/lib/summary/summarizerClientElection.d.ts.map +1 -1
- package/lib/summary/summarizerClientElection.js.map +1 -1
- package/lib/summary/summarizerNode/summarizerNode.d.ts.map +1 -1
- package/lib/summary/summarizerNode/summarizerNode.js.map +1 -1
- package/lib/summary/summarizerNode/summarizerNodeUtils.d.ts.map +1 -1
- package/lib/summary/summarizerNode/summarizerNodeUtils.js.map +1 -1
- package/lib/summary/summarizerNode/summarizerNodeWithGc.d.ts.map +1 -1
- package/lib/summary/summarizerNode/summarizerNodeWithGc.js +4 -1
- package/lib/summary/summarizerNode/summarizerNodeWithGc.js.map +1 -1
- package/lib/summary/summarizerTypes.d.ts.map +1 -1
- package/lib/summary/summarizerTypes.js.map +1 -1
- package/lib/summary/summaryCollection.d.ts.map +1 -1
- package/lib/summary/summaryCollection.js.map +1 -1
- package/lib/summary/summaryFormat.d.ts.map +1 -1
- package/lib/summary/summaryFormat.js.map +1 -1
- package/lib/summary/summaryGenerator.d.ts.map +1 -1
- package/lib/summary/summaryGenerator.js +1 -2
- package/lib/summary/summaryGenerator.js.map +1 -1
- package/lib/summary/summaryManager.d.ts.map +1 -1
- package/lib/summary/summaryManager.js +1 -2
- package/lib/summary/summaryManager.js.map +1 -1
- package/lib/throttler.d.ts.map +1 -1
- package/lib/throttler.js +3 -1
- package/lib/throttler.js.map +1 -1
- package/package.json +33 -20
- package/src/batchTracker.ts +4 -1
- package/src/blobManager.ts +14 -16
- package/src/channelCollection.ts +139 -132
- package/src/connectionTelemetry.ts +3 -8
- package/src/containerRuntime.ts +72 -44
- package/src/dataStoreContext.ts +34 -11
- package/src/dataStoreContexts.ts +7 -2
- package/src/deltaManagerProxies.ts +12 -3
- package/src/deltaScheduler.ts +1 -3
- package/src/gc/garbageCollection.ts +47 -31
- package/src/gc/gcConfigs.ts +7 -3
- package/src/gc/gcDefinitions.ts +16 -4
- package/src/gc/gcHelpers.ts +6 -2
- package/src/gc/gcSummaryStateTracker.ts +4 -1
- package/src/gc/gcTelemetry.ts +2 -9
- package/src/index.ts +0 -1
- package/src/messageTypes.ts +7 -23
- package/src/opLifecycle/index.ts +5 -1
- package/src/opLifecycle/opDecompressor.ts +2 -6
- package/src/opLifecycle/opGroupingManager.ts +1 -4
- package/src/opLifecycle/opSplitter.ts +9 -3
- package/src/opLifecycle/outbox.ts +1 -4
- package/src/packageVersion.ts +1 -1
- package/src/pendingStateManager.ts +4 -2
- package/src/summary/documentSchema.ts +4 -7
- package/src/summary/index.ts +4 -1
- package/src/summary/orderedClientElection.ts +17 -10
- package/src/summary/runningSummarizer.ts +20 -9
- package/src/summary/summarizerClientElection.ts +2 -1
- package/src/summary/summarizerNode/summarizerNode.ts +6 -4
- package/src/summary/summarizerNode/summarizerNodeUtils.ts +7 -2
- package/src/summary/summarizerNode/summarizerNodeWithGc.ts +10 -6
- package/src/summary/summarizerTypes.ts +9 -2
- package/src/summary/summaryCollection.ts +4 -1
- package/src/summary/summaryFormat.ts +8 -3
- package/src/summary/summaryGenerator.ts +4 -9
- package/src/summary/summaryManager.ts +6 -9
- package/src/throttler.ts +3 -1
- package/tsdoc.json +4 -0
|
@@ -266,7 +266,7 @@ class ChannelCollection {
|
|
|
266
266
|
const foundGCData = (0, internal_5.processAttachMessageGCData)(attachMessage.snapshot, (nodeId, toPath) => {
|
|
267
267
|
// nodeId is the relative path under the node being attached. Always starts with "/", but no trailing "/" after an id
|
|
268
268
|
const fromPath = `/${attachMessage.id}${nodeId === "/" ? "" : nodeId}`;
|
|
269
|
-
this.parentContext.addedGCOutboundRoute(fromPath, toPath);
|
|
269
|
+
this.parentContext.addedGCOutboundRoute(fromPath, toPath, message.timestamp);
|
|
270
270
|
});
|
|
271
271
|
// Only log once per container to avoid noise/cost.
|
|
272
272
|
// Allows longitudinal tracking of various state (e.g. foundGCData), and some sampled details
|
|
@@ -338,12 +338,12 @@ class ChannelCollection {
|
|
|
338
338
|
});
|
|
339
339
|
}
|
|
340
340
|
const resolve = localOpMetadata;
|
|
341
|
-
const aliasResult = this.processAliasMessageCore(aliasMessage.internalId, aliasMessage.alias);
|
|
341
|
+
const aliasResult = this.processAliasMessageCore(aliasMessage.internalId, aliasMessage.alias, message.timestamp);
|
|
342
342
|
if (local) {
|
|
343
343
|
resolve(aliasResult);
|
|
344
344
|
}
|
|
345
345
|
}
|
|
346
|
-
processAliasMessageCore(internalId, alias) {
|
|
346
|
+
processAliasMessageCore(internalId, alias, messageTimestampMs) {
|
|
347
347
|
if (this.alreadyProcessed(alias)) {
|
|
348
348
|
return false;
|
|
349
349
|
}
|
|
@@ -360,7 +360,11 @@ class ChannelCollection {
|
|
|
360
360
|
});
|
|
361
361
|
return false;
|
|
362
362
|
}
|
|
363
|
-
this.
|
|
363
|
+
// If message timestamp doesn't exist, this is called in a detached container. Don't notify GC in that case
|
|
364
|
+
// because it doesn't run in detached container and doesn't need to know about this route.
|
|
365
|
+
if (messageTimestampMs) {
|
|
366
|
+
this.parentContext.addedGCOutboundRoute("/", `/${internalId}`, messageTimestampMs);
|
|
367
|
+
}
|
|
364
368
|
this.aliasMap.set(alias, context.id);
|
|
365
369
|
this.aliasedDataStores.add(context.id);
|
|
366
370
|
context.setInMemoryRoot();
|
|
@@ -593,7 +597,7 @@ class ChannelCollection {
|
|
|
593
597
|
};
|
|
594
598
|
this.processChannelOp(envelope.address, transformed, local, localMessageMetadata);
|
|
595
599
|
// Notify GC of any outbound references that were added by this op.
|
|
596
|
-
detectOutboundReferences(envelope.address, transformed.contents, (fromPath, toPath) => this.parentContext.addedGCOutboundRoute(fromPath, toPath));
|
|
600
|
+
detectOutboundReferences(envelope.address, transformed.contents, (fromPath, toPath) => this.parentContext.addedGCOutboundRoute(fromPath, toPath, message.timestamp));
|
|
597
601
|
break;
|
|
598
602
|
}
|
|
599
603
|
default:
|
|
@@ -674,9 +678,7 @@ class ChannelCollection {
|
|
|
674
678
|
if (!this.isDataStoreDeleted(dataStoreNodePath)) {
|
|
675
679
|
return false;
|
|
676
680
|
}
|
|
677
|
-
const idToLog = originalRequest !== undefined
|
|
678
|
-
? (0, index_js_1.urlToGCNodePath)(originalRequest.url)
|
|
679
|
-
: dataStoreNodePath;
|
|
681
|
+
const idToLog = originalRequest !== undefined ? (0, index_js_1.urlToGCNodePath)(originalRequest.url) : dataStoreNodePath;
|
|
680
682
|
// Log the package details asynchronously since getInitialSnapshotDetails is async
|
|
681
683
|
const recentlyDeletedContext = this.contexts.getRecentlyDeletedContext(id);
|
|
682
684
|
if (recentlyDeletedContext !== undefined) {
|
|
@@ -766,61 +768,24 @@ class ChannelCollection {
|
|
|
766
768
|
get size() {
|
|
767
769
|
return this.contexts.size;
|
|
768
770
|
}
|
|
769
|
-
async summarize(fullTree, trackState, telemetryContext) {
|
|
770
|
-
const summaryBuilder = new internal_5.SummaryTreeBuilder();
|
|
771
|
-
// Iterate over each store and ask it to snapshot
|
|
772
|
-
await Promise.all(Array.from(this.contexts)
|
|
773
|
-
.filter(([_, context]) => {
|
|
774
|
-
// Summarizer works only with clients with no local changes. A data store in attaching
|
|
775
|
-
// state indicates an op was sent to attach a local data store, and the the attach op
|
|
776
|
-
// had not yet round tripped back to the client.
|
|
777
|
-
if (context.attachState === container_definitions_1.AttachState.Attaching) {
|
|
778
|
-
// Formerly assert 0x588
|
|
779
|
-
const error = internal_6.DataProcessingError.create("Local data store detected in attaching state during summarize", "summarize");
|
|
780
|
-
throw error;
|
|
781
|
-
}
|
|
782
|
-
return context.attachState === container_definitions_1.AttachState.Attached;
|
|
783
|
-
})
|
|
784
|
-
.map(async ([contextId, context]) => {
|
|
785
|
-
const contextSummary = await context.summarize(fullTree, trackState, telemetryContext);
|
|
786
|
-
summaryBuilder.addWithStats(contextId, contextSummary);
|
|
787
|
-
}));
|
|
788
|
-
return summaryBuilder.getSummaryTree();
|
|
789
|
-
}
|
|
790
771
|
/**
|
|
791
772
|
* Create a summary. Used when attaching or serializing a detached container.
|
|
792
773
|
*/
|
|
793
774
|
getAttachSummary(telemetryContext) {
|
|
794
775
|
const builder = new internal_5.SummaryTreeBuilder();
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
builderTree[key] ||
|
|
809
|
-
this.attachOpFiredForDataStore.has(key)))
|
|
810
|
-
.map(([key, value]) => {
|
|
811
|
-
let dataStoreSummary;
|
|
812
|
-
if (value.isLoaded) {
|
|
813
|
-
dataStoreSummary = value.getAttachSummary(telemetryContext);
|
|
814
|
-
}
|
|
815
|
-
else {
|
|
816
|
-
// If this data store is not yet loaded, then there should be no changes in the snapshot from
|
|
817
|
-
// which it was created as it is detached container. So just use the previous snapshot.
|
|
818
|
-
(0, internal_1.assert)(!!this.baseSnapshot, 0x166 /* "BaseSnapshot should be there as detached container loaded from snapshot" */);
|
|
819
|
-
dataStoreSummary = (0, internal_5.convertSnapshotTreeToSummaryTree)((0, internal_3.getSnapshotTree)(this.baseSnapshot).trees[key]);
|
|
820
|
-
}
|
|
821
|
-
builder.addWithStats(key, dataStoreSummary);
|
|
822
|
-
});
|
|
823
|
-
} while (notBoundContextsLength !== this.contexts.notBoundLength());
|
|
776
|
+
this.visitLocalBoundContextsDuringAttach((contextId, context) => {
|
|
777
|
+
let dataStoreSummary;
|
|
778
|
+
if (context.isLoaded) {
|
|
779
|
+
dataStoreSummary = context.getAttachSummary(telemetryContext);
|
|
780
|
+
}
|
|
781
|
+
else {
|
|
782
|
+
// If this data store is not yet loaded, then there should be no changes in the snapshot from
|
|
783
|
+
// which it was created as it is detached container. So just use the previous snapshot.
|
|
784
|
+
(0, internal_1.assert)(!!this.baseSnapshot, 0x166 /* "BaseSnapshot should be there as detached container loaded from snapshot" */);
|
|
785
|
+
dataStoreSummary = (0, internal_5.convertSnapshotTreeToSummaryTree)((0, internal_3.getSnapshotTree)(this.baseSnapshot).trees[contextId]);
|
|
786
|
+
}
|
|
787
|
+
builder.addWithStats(contextId, dataStoreSummary);
|
|
788
|
+
});
|
|
824
789
|
return builder.getSummaryTree();
|
|
825
790
|
}
|
|
826
791
|
/**
|
|
@@ -828,27 +793,70 @@ class ChannelCollection {
|
|
|
828
793
|
*/
|
|
829
794
|
getAttachGCData(telemetryContext) {
|
|
830
795
|
const builder = new internal_5.GCDataBuilder();
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
Array.from(this.contexts)
|
|
838
|
-
.filter(([key, _]) =>
|
|
839
|
-
// Take GC data of bounded data stores only.
|
|
840
|
-
!this.contexts.isNotBound(key))
|
|
841
|
-
.map(([key, value]) => {
|
|
842
|
-
const contextGCData = value.getAttachGCData(telemetryContext);
|
|
843
|
-
// Prefix the child's id to the ids of its GC nodes so they can be identified as belonging to the child.
|
|
844
|
-
// This also gradually builds the id of each node to be a path from the root.
|
|
845
|
-
builder.prefixAndAddNodes(key, contextGCData.gcNodes);
|
|
846
|
-
});
|
|
847
|
-
} while (notBoundContextsLength !== this.contexts.notBoundLength());
|
|
796
|
+
this.visitLocalBoundContextsDuringAttach((contextId, context) => {
|
|
797
|
+
const contextGCData = context.getAttachGCData(telemetryContext);
|
|
798
|
+
// Prefix the child's id to the ids of its GC nodes so they can be identified as belonging to the child.
|
|
799
|
+
// This also gradually builds the id of each node to be a path from the root.
|
|
800
|
+
builder.prefixAndAddNodes(contextId, contextGCData.gcNodes);
|
|
801
|
+
});
|
|
848
802
|
// Get the outbound routes (aliased data stores) and add a GC node for this channel.
|
|
849
803
|
builder.addNode("/", Array.from(this.aliasedDataStores));
|
|
850
804
|
return builder.getGCData();
|
|
851
805
|
}
|
|
806
|
+
/**
|
|
807
|
+
* Helper method for preparing to attach this channel.
|
|
808
|
+
* Runs the callback for each bound context to incorporate its data however the caller specifies
|
|
809
|
+
*/
|
|
810
|
+
visitLocalBoundContextsDuringAttach(visitor) {
|
|
811
|
+
const visitedContexts = new Set();
|
|
812
|
+
let visitedLength = -1;
|
|
813
|
+
let notBoundContextsLength = -1;
|
|
814
|
+
while (visitedLength !== visitedContexts.size &&
|
|
815
|
+
notBoundContextsLength !== this.contexts.notBoundLength()) {
|
|
816
|
+
// detect changes in the visitedContexts set, as on visiting a context
|
|
817
|
+
// it could could make contexts available by removing other contexts
|
|
818
|
+
// from the not bound context list, so we need to ensure those get processed as well.
|
|
819
|
+
// only once the loop can run with no new contexts added to the visitedContexts set do we
|
|
820
|
+
// know for sure all possible contexts have been visited.
|
|
821
|
+
visitedLength = visitedContexts.size;
|
|
822
|
+
notBoundContextsLength = this.contexts.notBoundLength();
|
|
823
|
+
for (const [contextId, context] of this.contexts) {
|
|
824
|
+
if (!(visitedContexts.has(contextId) ||
|
|
825
|
+
this.contexts.isNotBound(contextId) ||
|
|
826
|
+
this.attachOpFiredForDataStore.has(contextId))) {
|
|
827
|
+
visitor(contextId, context);
|
|
828
|
+
visitedContexts.add(contextId);
|
|
829
|
+
}
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
}
|
|
833
|
+
/**
|
|
834
|
+
* Helper method for preparing to summarize this channel.
|
|
835
|
+
* Runs the callback for each bound context to incorporate its data however the caller specifies
|
|
836
|
+
*/
|
|
837
|
+
async visitContextsDuringSummary(visitor) {
|
|
838
|
+
for (const [contextId, context] of this.contexts) {
|
|
839
|
+
// Summarizer client and hence GC works only with clients with no local changes. A data store in
|
|
840
|
+
// attaching state indicates an op was sent to attach a local data store, and the the attach op
|
|
841
|
+
// had not yet round tripped back to the client.
|
|
842
|
+
// Formerly assert 0x589
|
|
843
|
+
if (context.attachState === container_definitions_1.AttachState.Attaching) {
|
|
844
|
+
const error = internal_6.DataProcessingError.create("Local data store detected in attaching state", "summarize/getGCData");
|
|
845
|
+
throw error;
|
|
846
|
+
}
|
|
847
|
+
if (context.attachState === container_definitions_1.AttachState.Attached) {
|
|
848
|
+
await visitor(contextId, context);
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
async summarize(fullTree, trackState, telemetryContext) {
|
|
853
|
+
const summaryBuilder = new internal_5.SummaryTreeBuilder();
|
|
854
|
+
await this.visitContextsDuringSummary(async (contextId, context) => {
|
|
855
|
+
const contextSummary = await context.summarize(fullTree, trackState, telemetryContext);
|
|
856
|
+
summaryBuilder.addWithStats(contextId, contextSummary);
|
|
857
|
+
});
|
|
858
|
+
return summaryBuilder.getSummaryTree();
|
|
859
|
+
}
|
|
852
860
|
/**
|
|
853
861
|
* Generates data used for garbage collection. It does the following:
|
|
854
862
|
*
|
|
@@ -864,25 +872,12 @@ class ChannelCollection {
|
|
|
864
872
|
*/
|
|
865
873
|
async getGCData(fullGC = false) {
|
|
866
874
|
const builder = new internal_5.GCDataBuilder();
|
|
867
|
-
|
|
868
|
-
await Promise.all(Array.from(this.contexts)
|
|
869
|
-
.filter(([_, context]) => {
|
|
870
|
-
// Summarizer client and hence GC works only with clients with no local changes. A data store in
|
|
871
|
-
// attaching state indicates an op was sent to attach a local data store, and the the attach op
|
|
872
|
-
// had not yet round tripped back to the client.
|
|
873
|
-
// Formerly assert 0x589
|
|
874
|
-
if (context.attachState === container_definitions_1.AttachState.Attaching) {
|
|
875
|
-
const error = internal_6.DataProcessingError.create("Local data store detected in attaching state while running GC", "getGCData");
|
|
876
|
-
throw error;
|
|
877
|
-
}
|
|
878
|
-
return context.attachState === container_definitions_1.AttachState.Attached;
|
|
879
|
-
})
|
|
880
|
-
.map(async ([contextId, context]) => {
|
|
875
|
+
await this.visitContextsDuringSummary(async (contextId, context) => {
|
|
881
876
|
const contextGCData = await context.getGCData(fullGC);
|
|
882
877
|
// Prefix the child's id to the ids of its GC nodes so they can be identified as belonging to the child.
|
|
883
878
|
// This also gradually builds the id of each node to be a path from the root.
|
|
884
879
|
builder.prefixAndAddNodes(contextId, contextGCData.gcNodes);
|
|
885
|
-
})
|
|
880
|
+
});
|
|
886
881
|
// Get the outbound routes and add a GC node for this channel.
|
|
887
882
|
builder.addNode("/", await this.getOutboundRoutes());
|
|
888
883
|
return builder.getGCData();
|
|
@@ -1059,6 +1054,7 @@ class ChannelCollection {
|
|
|
1059
1054
|
packagePath: details.pkg,
|
|
1060
1055
|
request,
|
|
1061
1056
|
headerData,
|
|
1057
|
+
timestampMs: undefined, // This will be added by the parent context if needed.
|
|
1062
1058
|
});
|
|
1063
1059
|
const dataStore = await dataStoreContext.realize();
|
|
1064
1060
|
const subRequest = requestParser.createSubRequest(1);
|