@fluidframework/container-runtime 0.59.2000-61729 → 0.59.2001
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/containerRuntime.d.ts.map +1 -1
- package/dist/containerRuntime.js +6 -6
- package/dist/containerRuntime.js.map +1 -1
- package/dist/garbageCollection.d.ts +26 -8
- package/dist/garbageCollection.d.ts.map +1 -1
- package/dist/garbageCollection.js +81 -57
- package/dist/garbageCollection.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.d.ts.map +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/runningSummarizer.d.ts.map +1 -1
- package/dist/runningSummarizer.js +11 -10
- package/dist/runningSummarizer.js.map +1 -1
- package/dist/summarizer.d.ts +1 -0
- package/dist/summarizer.d.ts.map +1 -1
- package/dist/summarizer.js +8 -4
- package/dist/summarizer.js.map +1 -1
- package/dist/summarizerTypes.d.ts +47 -1
- package/dist/summarizerTypes.d.ts.map +1 -1
- package/dist/summarizerTypes.js.map +1 -1
- package/dist/summaryGenerator.d.ts +0 -2
- package/dist/summaryGenerator.d.ts.map +1 -1
- package/dist/summaryGenerator.js.map +1 -1
- package/dist/summaryManager.d.ts.map +1 -1
- package/dist/summaryManager.js +15 -15
- package/dist/summaryManager.js.map +1 -1
- package/lib/containerRuntime.d.ts.map +1 -1
- package/lib/containerRuntime.js +6 -6
- package/lib/containerRuntime.js.map +1 -1
- package/lib/garbageCollection.d.ts +26 -8
- package/lib/garbageCollection.d.ts.map +1 -1
- package/lib/garbageCollection.js +81 -57
- package/lib/garbageCollection.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.d.ts.map +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/runningSummarizer.d.ts.map +1 -1
- package/lib/runningSummarizer.js +11 -10
- package/lib/runningSummarizer.js.map +1 -1
- package/lib/summarizer.d.ts +1 -0
- package/lib/summarizer.d.ts.map +1 -1
- package/lib/summarizer.js +8 -4
- package/lib/summarizer.js.map +1 -1
- package/lib/summarizerTypes.d.ts +47 -1
- package/lib/summarizerTypes.d.ts.map +1 -1
- package/lib/summarizerTypes.js.map +1 -1
- package/lib/summaryGenerator.d.ts +0 -2
- package/lib/summaryGenerator.d.ts.map +1 -1
- package/lib/summaryGenerator.js.map +1 -1
- package/lib/summaryManager.d.ts.map +1 -1
- package/lib/summaryManager.js +15 -15
- package/lib/summaryManager.js.map +1 -1
- package/package.json +35 -59
- package/src/containerRuntime.ts +4 -6
- package/src/garbageCollection.ts +96 -61
- package/src/packageVersion.ts +1 -1
- package/src/runningSummarizer.ts +13 -10
- package/src/summarizer.ts +9 -4
- package/src/summarizerTypes.ts +60 -1
- package/src/summaryGenerator.ts +2 -44
- package/src/summaryManager.ts +17 -19
|
@@ -96,6 +96,19 @@ export interface IGarbageCollector {
|
|
|
96
96
|
/**
|
|
97
97
|
* The garbage collector for the container runtime. It consolidates the garbage collection functionality and maintains
|
|
98
98
|
* its state across summaries.
|
|
99
|
+
*
|
|
100
|
+
* Node - represented as nodeId, it's a node on the GC graph
|
|
101
|
+
* Outbound Route - a path from one node to another node, think `nodeA` -> `nodeB`
|
|
102
|
+
* Graph - all nodes with their respective routes
|
|
103
|
+
* GC Graph
|
|
104
|
+
*
|
|
105
|
+
* Node
|
|
106
|
+
* NodeId = "datastore1"
|
|
107
|
+
* / \
|
|
108
|
+
* OutboundRoute OutboundRoute
|
|
109
|
+
* / \
|
|
110
|
+
* Node Node
|
|
111
|
+
* NodeId = "dds1" NodeId = "dds2"
|
|
99
112
|
*/
|
|
100
113
|
export declare class GarbageCollector implements IGarbageCollector {
|
|
101
114
|
private readonly runtime;
|
|
@@ -154,8 +167,8 @@ export declare class GarbageCollector implements IGarbageCollector {
|
|
|
154
167
|
private initialStateNeedsReset;
|
|
155
168
|
private readonly currentGCVersion;
|
|
156
169
|
private latestSummaryGCVersion;
|
|
157
|
-
private
|
|
158
|
-
private readonly
|
|
170
|
+
private previousGCDataFromLastRun;
|
|
171
|
+
private readonly newReferencesSinceLastRun;
|
|
159
172
|
private readonly initializeBaseStateP;
|
|
160
173
|
private readonly baseGCDetailsP;
|
|
161
174
|
private readonly deleteTimeoutMs;
|
|
@@ -238,14 +251,19 @@ export declare class GarbageCollector implements IGarbageCollector {
|
|
|
238
251
|
*/
|
|
239
252
|
private updateStateSinceLastRun;
|
|
240
253
|
/**
|
|
241
|
-
*
|
|
242
|
-
*
|
|
243
|
-
*
|
|
244
|
-
*
|
|
245
|
-
*
|
|
254
|
+
* Finds all new references or outbound routes in the current graph that haven't been explicitly notified to GC.
|
|
255
|
+
* The principle is that every new reference or outbound route must be notified to GC via the
|
|
256
|
+
* addedOutboundReference method. It it hasn't, its a bug and we want to identify these scenarios.
|
|
257
|
+
*
|
|
258
|
+
* In more simple terms:
|
|
259
|
+
* Missing Explicit References = Current References - Previous References - Explicitly Added References;
|
|
260
|
+
*
|
|
246
261
|
* @param currentGCData - The GC data (reference graph) from the current GC run.
|
|
262
|
+
* @param previousGCData - The GC data (reference graph) from the previous GC run.
|
|
263
|
+
* @param explicitReferences - New references added explicity between the previous and the current run.
|
|
264
|
+
* @returns - a list of missing explicit references
|
|
247
265
|
*/
|
|
248
|
-
private
|
|
266
|
+
private findMissingExplicitReferences;
|
|
249
267
|
/**
|
|
250
268
|
* Generates the stats of a garbage collection run from the given results of the run. Also, logs any pending events
|
|
251
269
|
* in the pendingEventsQueue. This should be called before updating the current state because it generates stats
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"garbageCollection.d.ts","sourceRoot":"","sources":["../src/garbageCollection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,
|
|
1
|
+
{"version":3,"file":"garbageCollection.d.ts","sourceRoot":"","sources":["../src/garbageCollection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gB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weep";
|
|
|
27
27
|
const writeAtRootKey = "Fluid.GarbageCollection.WriteDataAtRoot";
|
|
28
28
|
// Feature gate key to expire a session after a set period of time.
|
|
29
29
|
const runSessionExpiry = "Fluid.GarbageCollection.RunSessionExpiry";
|
|
30
|
+
// Feature gate key to log error messages if GC reference validation fails.
|
|
31
|
+
const logUnknownOutboundReferencesKey = "Fluid.GarbageCollection.LogUnknownOutboundReferences";
|
|
30
32
|
const defaultDeleteTimeoutMs = 7 * 24 * 60 * 60 * 1000; // 7 days
|
|
31
33
|
export const defaultSessionExpiryDurationMs = 30 * 24 * 60 * 60 * 1000; // 30 days
|
|
32
34
|
/** The types of GC nodes in the GC reference graph. */
|
|
@@ -87,6 +89,19 @@ class UnreferencedStateTracker {
|
|
|
87
89
|
/**
|
|
88
90
|
* The garbage collector for the container runtime. It consolidates the garbage collection functionality and maintains
|
|
89
91
|
* its state across summaries.
|
|
92
|
+
*
|
|
93
|
+
* Node - represented as nodeId, it's a node on the GC graph
|
|
94
|
+
* Outbound Route - a path from one node to another node, think `nodeA` -> `nodeB`
|
|
95
|
+
* Graph - all nodes with their respective routes
|
|
96
|
+
* GC Graph
|
|
97
|
+
*
|
|
98
|
+
* Node
|
|
99
|
+
* NodeId = "datastore1"
|
|
100
|
+
* / \
|
|
101
|
+
* OutboundRoute OutboundRoute
|
|
102
|
+
* / \
|
|
103
|
+
* Node Node
|
|
104
|
+
* NodeId = "dds1" NodeId = "dds2"
|
|
90
105
|
*/
|
|
91
106
|
export class GarbageCollector {
|
|
92
107
|
constructor(runtime, gcOptions,
|
|
@@ -118,7 +133,7 @@ export class GarbageCollector {
|
|
|
118
133
|
this.currentGCVersion = GCVersion;
|
|
119
134
|
// Keeps a list of references (edges in the GC graph) between GC runs. Each entry has a node id and a list of
|
|
120
135
|
// outbound routes from that node.
|
|
121
|
-
this.
|
|
136
|
+
this.newReferencesSinceLastRun = new Map();
|
|
122
137
|
// Map of node ids to their unreferenced state tracker.
|
|
123
138
|
this.unreferencedNodesState = new Map();
|
|
124
139
|
// Keeps track of unreferenced events that are logged for a node. This is used to limit the log generation to one
|
|
@@ -252,7 +267,7 @@ export class GarbageCollector {
|
|
|
252
267
|
}
|
|
253
268
|
gcNodes[nodeId] = Array.from(nodeData.outboundRoutes);
|
|
254
269
|
}
|
|
255
|
-
this.
|
|
270
|
+
this.previousGCDataFromLastRun = { gcNodes };
|
|
256
271
|
});
|
|
257
272
|
// Get the GC details for each node from the GC state in the base summary. This is returned in getBaseGCDetails
|
|
258
273
|
// which the caller uses to initialize each node's GC state.
|
|
@@ -364,11 +379,11 @@ export class GarbageCollector {
|
|
|
364
379
|
*/
|
|
365
380
|
summarize() {
|
|
366
381
|
var _a;
|
|
367
|
-
if (!this.shouldRunGC || this.
|
|
382
|
+
if (!this.shouldRunGC || this.previousGCDataFromLastRun === undefined) {
|
|
368
383
|
return;
|
|
369
384
|
}
|
|
370
385
|
const gcState = { gcNodes: {} };
|
|
371
|
-
for (const [nodeId, outboundRoutes] of Object.entries(this.
|
|
386
|
+
for (const [nodeId, outboundRoutes] of Object.entries(this.previousGCDataFromLastRun.gcNodes)) {
|
|
372
387
|
gcState.gcNodes[nodeId] = {
|
|
373
388
|
outboundRoutes,
|
|
374
389
|
unreferencedTimestampMs: (_a = this.unreferencedNodesState.get(nodeId)) === null || _a === void 0 ? void 0 : _a.unreferencedTimestampMs,
|
|
@@ -432,9 +447,9 @@ export class GarbageCollector {
|
|
|
432
447
|
if (!this.shouldRunGC) {
|
|
433
448
|
return;
|
|
434
449
|
}
|
|
435
|
-
const outboundRoutes = (_a = this.
|
|
450
|
+
const outboundRoutes = (_a = this.newReferencesSinceLastRun.get(fromNodePath)) !== null && _a !== void 0 ? _a : [];
|
|
436
451
|
outboundRoutes.push(toNodePath);
|
|
437
|
-
this.
|
|
452
|
+
this.newReferencesSinceLastRun.set(fromNodePath, outboundRoutes);
|
|
438
453
|
// If the node that got referenced is inactive, log an event as that may indicate use-after-delete.
|
|
439
454
|
this.logIfInactive("Revived", toNodePath);
|
|
440
455
|
}
|
|
@@ -464,8 +479,8 @@ export class GarbageCollector {
|
|
|
464
479
|
* @param currentReferenceTimestampMs - The timestamp to be used for unreferenced nodes' timestamp.
|
|
465
480
|
*/
|
|
466
481
|
updateCurrentState(gcData, gcResult, currentReferenceTimestampMs) {
|
|
467
|
-
this.
|
|
468
|
-
this.
|
|
482
|
+
this.previousGCDataFromLastRun = cloneGCData(gcData);
|
|
483
|
+
this.newReferencesSinceLastRun.clear();
|
|
469
484
|
// Iterate through the referenced nodes and stop tracking if they were unreferenced before.
|
|
470
485
|
for (const nodeId of gcResult.referencedNodeIds) {
|
|
471
486
|
const nodeStateTracker = this.unreferencedNodesState.get(nodeId);
|
|
@@ -508,12 +523,30 @@ export class GarbageCollector {
|
|
|
508
523
|
* If these nodes are currently unreferenced, they will be assigned new unreferenced state by the current run.
|
|
509
524
|
*/
|
|
510
525
|
updateStateSinceLastRun(currentGCData) {
|
|
511
|
-
// If we haven't run GC before
|
|
512
|
-
if (this.
|
|
526
|
+
// If we haven't run GC before there is nothing to do.
|
|
527
|
+
if (this.previousGCDataFromLastRun === undefined) {
|
|
528
|
+
return;
|
|
529
|
+
}
|
|
530
|
+
// Find any references that haven't been identified correctly.
|
|
531
|
+
const missingExplicitReferences = this.findMissingExplicitReferences(currentGCData, this.previousGCDataFromLastRun, this.newReferencesSinceLastRun);
|
|
532
|
+
// The following log will be enabled once this issue is resolved:
|
|
533
|
+
// https://github.com/microsoft/FluidFramework/issues/8878.
|
|
534
|
+
if (this.mc.config.getBoolean(logUnknownOutboundReferencesKey) === true
|
|
535
|
+
&& missingExplicitReferences.length > 0) {
|
|
536
|
+
missingExplicitReferences.forEach((missingExplicitReference) => {
|
|
537
|
+
const event = {
|
|
538
|
+
eventName: "gcUnknownOutboundReferences",
|
|
539
|
+
gcNodeId: missingExplicitReference[0],
|
|
540
|
+
gcRoutes: JSON.stringify(missingExplicitReference[1]),
|
|
541
|
+
};
|
|
542
|
+
this.mc.logger.sendPerformanceEvent(event);
|
|
543
|
+
});
|
|
544
|
+
}
|
|
545
|
+
// No references were added since the last run so we don't have to update reference states of any unreferenced
|
|
546
|
+
// nodes
|
|
547
|
+
if (this.newReferencesSinceLastRun.size === 0) {
|
|
513
548
|
return;
|
|
514
549
|
}
|
|
515
|
-
// Validate that we have identified all references correctly.
|
|
516
|
-
this.validateReferenceCorrectness(currentGCData);
|
|
517
550
|
/**
|
|
518
551
|
* Generate a super set of the GC data that contains the nodes and edges from last run, plus any new node and
|
|
519
552
|
* edges that have been added since then. To do this, combine the GC data from the last run and the current
|
|
@@ -529,8 +562,8 @@ export class GarbageCollector {
|
|
|
529
562
|
* which is tracked by https://github.com/microsoft/FluidFramework/issues/8470.
|
|
530
563
|
* - A new data store may have "root" DDSs already created and we don't detect them today.
|
|
531
564
|
*/
|
|
532
|
-
const gcDataSuperSet = concatGarbageCollectionData(this.
|
|
533
|
-
this.
|
|
565
|
+
const gcDataSuperSet = concatGarbageCollectionData(this.previousGCDataFromLastRun, currentGCData);
|
|
566
|
+
this.newReferencesSinceLastRun.forEach((outboundRoutes, sourceNodeId) => {
|
|
534
567
|
if (gcDataSuperSet.gcNodes[sourceNodeId] === undefined) {
|
|
535
568
|
gcDataSuperSet.gcNodes[sourceNodeId] = outboundRoutes;
|
|
536
569
|
}
|
|
@@ -555,53 +588,44 @@ export class GarbageCollector {
|
|
|
555
588
|
}
|
|
556
589
|
}
|
|
557
590
|
/**
|
|
558
|
-
*
|
|
559
|
-
*
|
|
560
|
-
*
|
|
561
|
-
*
|
|
562
|
-
*
|
|
591
|
+
* Finds all new references or outbound routes in the current graph that haven't been explicitly notified to GC.
|
|
592
|
+
* The principle is that every new reference or outbound route must be notified to GC via the
|
|
593
|
+
* addedOutboundReference method. It it hasn't, its a bug and we want to identify these scenarios.
|
|
594
|
+
*
|
|
595
|
+
* In more simple terms:
|
|
596
|
+
* Missing Explicit References = Current References - Previous References - Explicitly Added References;
|
|
597
|
+
*
|
|
563
598
|
* @param currentGCData - The GC data (reference graph) from the current GC run.
|
|
599
|
+
* @param previousGCData - The GC data (reference graph) from the previous GC run.
|
|
600
|
+
* @param explicitReferences - New references added explicity between the previous and the current run.
|
|
601
|
+
* @returns - a list of missing explicit references
|
|
564
602
|
*/
|
|
565
|
-
|
|
566
|
-
assert(
|
|
567
|
-
|
|
568
|
-
const
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
// Validate that the current reference graph doesn't have references that we are not already aware of. If this
|
|
588
|
-
// happens, it might indicate data corruption since we may delete objects prematurely.
|
|
589
|
-
currentReferences.forEach((route) => {
|
|
590
|
-
// Validate references for data stores only. Currently, layers below data stores don't have GC implemented
|
|
591
|
-
// so there is no guarantee their references will be notified.
|
|
592
|
-
if (this.runtime.getNodeType(route) === GCNodeType.DataStore && !explicitReferences.includes(route)) {
|
|
593
|
-
/**
|
|
594
|
-
* The following log will be enabled once this issue is resolved:
|
|
595
|
-
* https://github.com/microsoft/FluidFramework/issues/8878.
|
|
596
|
-
*/
|
|
597
|
-
// We should ideally throw a data corruption error here. However, send an error for now until we have
|
|
598
|
-
// implemented sweep and have reasonable confidence in the sweep process.
|
|
599
|
-
// this.mc.logger.sendErrorEvent({
|
|
600
|
-
// eventName: "gcUnknownOutboundRoute",
|
|
601
|
-
// route,
|
|
602
|
-
// });
|
|
603
|
+
findMissingExplicitReferences(currentGCData, previousGCData, explicitReferences) {
|
|
604
|
+
assert(previousGCData !== undefined, 0x2b7);
|
|
605
|
+
const currentGraph = Object.entries(currentGCData.gcNodes);
|
|
606
|
+
const missingExplicitReferences = [];
|
|
607
|
+
currentGraph.forEach(([nodeId, currentOutboundRoutes]) => {
|
|
608
|
+
var _a, _b;
|
|
609
|
+
const previousRoutes = (_a = previousGCData.gcNodes[nodeId]) !== null && _a !== void 0 ? _a : [];
|
|
610
|
+
const explicitRoutes = (_b = explicitReferences.get(nodeId)) !== null && _b !== void 0 ? _b : [];
|
|
611
|
+
const missingExplicitRoutes = [];
|
|
612
|
+
currentOutboundRoutes.forEach((route) => {
|
|
613
|
+
const isBlobOrDataStoreRoute = this.runtime.getNodeType(route) === GCNodeType.Blob ||
|
|
614
|
+
this.runtime.getNodeType(route) === GCNodeType.DataStore;
|
|
615
|
+
// Ignore implicitly added DDS routes to their parent datastores
|
|
616
|
+
const notRouteFromDDSToParentDataStore = !nodeId.startsWith(route);
|
|
617
|
+
if (isBlobOrDataStoreRoute &&
|
|
618
|
+
notRouteFromDDSToParentDataStore &&
|
|
619
|
+
(!previousRoutes.includes(route) && !explicitRoutes.includes(route))) {
|
|
620
|
+
missingExplicitRoutes.push(route);
|
|
621
|
+
}
|
|
622
|
+
});
|
|
623
|
+
if (missingExplicitRoutes.length > 0) {
|
|
624
|
+
missingExplicitReferences.push([nodeId, missingExplicitRoutes]);
|
|
603
625
|
}
|
|
604
626
|
});
|
|
627
|
+
// Ideally missingExplicitReferences should always have a size 0
|
|
628
|
+
return missingExplicitReferences;
|
|
605
629
|
}
|
|
606
630
|
/**
|
|
607
631
|
* Generates the stats of a garbage collection run from the given results of the run. Also, logs any pending events
|