@fluidframework/container-runtime 2.0.0-dev.7.4.0.215747 → 2.0.0-dev.7.4.0.215930
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-report/container-runtime.api.md +24 -10
- package/dist/container-runtime-alpha.d.ts +45 -19
- package/dist/container-runtime-beta.d.ts +45 -19
- package/dist/container-runtime-public.d.ts +45 -19
- package/dist/container-runtime-untrimmed.d.ts +45 -19
- package/dist/gc/garbageCollection.d.ts +14 -5
- package/dist/gc/garbageCollection.d.ts.map +1 -1
- package/dist/gc/garbageCollection.js +85 -30
- package/dist/gc/garbageCollection.js.map +1 -1
- package/dist/gc/gcDefinitions.d.ts +26 -4
- package/dist/gc/gcDefinitions.d.ts.map +1 -1
- package/dist/gc/gcDefinitions.js +1 -3
- package/dist/gc/gcDefinitions.js.map +1 -1
- package/dist/gc/gcTelemetry.d.ts +0 -5
- package/dist/gc/gcTelemetry.d.ts.map +1 -1
- package/dist/gc/gcTelemetry.js +0 -39
- package/dist/gc/gcTelemetry.js.map +1 -1
- package/dist/gc/index.d.ts +1 -1
- package/dist/gc/index.d.ts.map +1 -1
- package/dist/gc/index.js +1 -2
- package/dist/gc/index.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/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/lib/container-runtime-alpha.d.ts +45 -19
- package/lib/container-runtime-beta.d.ts +45 -19
- package/lib/container-runtime-public.d.ts +45 -19
- package/lib/container-runtime-untrimmed.d.ts +45 -19
- package/lib/gc/garbageCollection.d.ts +14 -5
- package/lib/gc/garbageCollection.d.ts.map +1 -1
- package/lib/gc/garbageCollection.js +85 -30
- package/lib/gc/garbageCollection.js.map +1 -1
- package/lib/gc/gcDefinitions.d.ts +26 -4
- package/lib/gc/gcDefinitions.d.ts.map +1 -1
- package/lib/gc/gcDefinitions.js +0 -2
- package/lib/gc/gcDefinitions.js.map +1 -1
- package/lib/gc/gcTelemetry.d.ts +0 -5
- package/lib/gc/gcTelemetry.d.ts.map +1 -1
- package/lib/gc/gcTelemetry.js +1 -40
- package/lib/gc/gcTelemetry.js.map +1 -1
- package/lib/gc/index.d.ts +1 -1
- package/lib/gc/index.d.ts.map +1 -1
- package/lib/gc/index.js +1 -1
- package/lib/gc/index.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/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/package.json +18 -15
- package/src/gc/garbageCollection.ts +101 -48
- package/src/gc/gcDefinitions.ts +27 -4
- package/src/gc/gcTelemetry.ts +0 -53
- package/src/gc/index.ts +2 -1
- package/src/index.ts +2 -0
- package/src/packageVersion.ts +1 -1
|
@@ -40,6 +40,8 @@ import {
|
|
|
40
40
|
UnreferencedState,
|
|
41
41
|
IGCMetadata,
|
|
42
42
|
IGarbageCollectorConfigs,
|
|
43
|
+
IMarkPhaseStats,
|
|
44
|
+
ISweepPhaseStats,
|
|
43
45
|
} from "./gcDefinitions";
|
|
44
46
|
import { cloneGCData, concatGarbageCollectionData, getGCDataFromSnapshot } from "./gcHelpers";
|
|
45
47
|
import { runGarbageCollection } from "./gcReferenceGraphAlgorithm";
|
|
@@ -305,6 +307,7 @@ export class GarbageCollector implements IGarbageCollector {
|
|
|
305
307
|
eventName: "GarbageCollectorLoaded",
|
|
306
308
|
gcConfigs: JSON.stringify(this.configs),
|
|
307
309
|
gcOptions: JSON.stringify(createParams.gcOptions),
|
|
310
|
+
...createParams.createContainerMetadata,
|
|
308
311
|
});
|
|
309
312
|
}
|
|
310
313
|
|
|
@@ -520,7 +523,11 @@ export class GarbageCollector implements IGarbageCollector {
|
|
|
520
523
|
|
|
521
524
|
/** GC step */
|
|
522
525
|
const gcStats = await this.runGC(fullGC, currentReferenceTimestampMs, logger);
|
|
523
|
-
event.end({
|
|
526
|
+
event.end({
|
|
527
|
+
...gcStats,
|
|
528
|
+
timestamp: currentReferenceTimestampMs,
|
|
529
|
+
sweep: this.configs.shouldRunSweep,
|
|
530
|
+
});
|
|
524
531
|
|
|
525
532
|
/** Post-GC steps */
|
|
526
533
|
// Log pending unreferenced events such as a node being used after inactive. This is done after GC runs and
|
|
@@ -541,9 +548,10 @@ export class GarbageCollector implements IGarbageCollector {
|
|
|
541
548
|
/**
|
|
542
549
|
* Runs garbage collection. It does the following:
|
|
543
550
|
* 1. It generates / analyzes the runtime's reference graph.
|
|
544
|
-
* 2. Generates
|
|
551
|
+
* 2. Generates mark phase stats.
|
|
545
552
|
* 3. Runs Mark phase.
|
|
546
553
|
* 4. Runs Sweep phase.
|
|
554
|
+
* 5. Generates sweep phase stats.
|
|
547
555
|
*/
|
|
548
556
|
private async runGC(
|
|
549
557
|
fullGC: boolean,
|
|
@@ -559,9 +567,9 @@ export class GarbageCollector implements IGarbageCollector {
|
|
|
559
567
|
this.findAllNodesReferencedBetweenGCs(gcData, this.gcDataFromLastRun, logger) ??
|
|
560
568
|
gcResult.referencedNodeIds;
|
|
561
569
|
|
|
562
|
-
// 2.
|
|
563
|
-
//
|
|
564
|
-
const
|
|
570
|
+
// 2. Get the mark phase stats based on the previous / current GC state.
|
|
571
|
+
// This is done before running mark phase because we need the previous GC state before it is updated.
|
|
572
|
+
const markPhaseStats = this.getMarkPhaseStats(gcResult);
|
|
565
573
|
|
|
566
574
|
// 3. Run the Mark phase.
|
|
567
575
|
// It will mark nodes as referenced / unreferenced and return a list of node ids that are ready to be swept.
|
|
@@ -573,18 +581,21 @@ export class GarbageCollector implements IGarbageCollector {
|
|
|
573
581
|
|
|
574
582
|
// 4. Run the Sweep phase.
|
|
575
583
|
// It will delete sweep ready nodes and return a list of deleted node ids.
|
|
576
|
-
const deletedNodeIds = this.runSweepPhase(
|
|
577
|
-
gcResult,
|
|
578
|
-
sweepReadyNodeIds,
|
|
579
|
-
currentReferenceTimestampMs,
|
|
580
|
-
logger,
|
|
581
|
-
);
|
|
584
|
+
const deletedNodeIds = this.runSweepPhase(gcResult, sweepReadyNodeIds);
|
|
582
585
|
|
|
583
586
|
this.gcDataFromLastRun = cloneGCData(
|
|
584
587
|
gcData,
|
|
585
588
|
(id: string) => deletedNodeIds.includes(id) /* filter out deleted nodes */,
|
|
586
589
|
);
|
|
587
|
-
|
|
590
|
+
|
|
591
|
+
// 5. Get the sweep phase stats.
|
|
592
|
+
const sweepPhaseStats = this.getSweepPhaseStats(
|
|
593
|
+
this.configs.shouldRunSweep ? this.deletedNodes : sweepReadyNodeIds,
|
|
594
|
+
new Set(deletedNodeIds),
|
|
595
|
+
markPhaseStats,
|
|
596
|
+
);
|
|
597
|
+
|
|
598
|
+
return { ...markPhaseStats, ...sweepPhaseStats };
|
|
588
599
|
}
|
|
589
600
|
|
|
590
601
|
/**
|
|
@@ -605,7 +616,7 @@ export class GarbageCollector implements IGarbageCollector {
|
|
|
605
616
|
gcResult: IGCResult,
|
|
606
617
|
allReferencedNodeIds: string[],
|
|
607
618
|
currentReferenceTimestampMs: number,
|
|
608
|
-
): string
|
|
619
|
+
): Set<string> {
|
|
609
620
|
// 1. Marks all referenced nodes by clearing their unreferenced tracker, if any.
|
|
610
621
|
for (const nodeId of allReferencedNodeIds) {
|
|
611
622
|
const nodeStateTracker = this.unreferencedNodesState.get(nodeId);
|
|
@@ -618,7 +629,7 @@ export class GarbageCollector implements IGarbageCollector {
|
|
|
618
629
|
}
|
|
619
630
|
|
|
620
631
|
// 2. Mark unreferenced nodes in this run by starting unreferenced tracking for them.
|
|
621
|
-
const sweepReadyNodeIds: string
|
|
632
|
+
const sweepReadyNodeIds: Set<string> = new Set();
|
|
622
633
|
for (const nodeId of gcResult.deletedNodeIds) {
|
|
623
634
|
const nodeStateTracker = this.unreferencedNodesState.get(nodeId);
|
|
624
635
|
if (nodeStateTracker === undefined) {
|
|
@@ -638,7 +649,7 @@ export class GarbageCollector implements IGarbageCollector {
|
|
|
638
649
|
|
|
639
650
|
// If a node is sweep ready, store it so it can be returned.
|
|
640
651
|
if (nodeStateTracker.state === UnreferencedState.SweepReady) {
|
|
641
|
-
sweepReadyNodeIds.
|
|
652
|
+
sweepReadyNodeIds.add(nodeId);
|
|
642
653
|
}
|
|
643
654
|
}
|
|
644
655
|
}
|
|
@@ -660,22 +671,7 @@ export class GarbageCollector implements IGarbageCollector {
|
|
|
660
671
|
* @param logger - The logger to be used to log any telemetry.
|
|
661
672
|
* @returns A list of nodes that have been deleted.
|
|
662
673
|
*/
|
|
663
|
-
private runSweepPhase(
|
|
664
|
-
gcResult: IGCResult,
|
|
665
|
-
sweepReadyNodes: string[],
|
|
666
|
-
currentReferenceTimestampMs: number,
|
|
667
|
-
logger: ITelemetryLoggerExt,
|
|
668
|
-
): string[] {
|
|
669
|
-
// Log events for objects that are ready to be deleted by sweep. This will give us data on sweep when
|
|
670
|
-
// its not enabled.
|
|
671
|
-
this.telemetryTracker.logSweepEvents(
|
|
672
|
-
logger,
|
|
673
|
-
currentReferenceTimestampMs,
|
|
674
|
-
this.unreferencedNodesState,
|
|
675
|
-
this.completedRuns,
|
|
676
|
-
this.getLastSummaryTimestampMs(),
|
|
677
|
-
);
|
|
678
|
-
|
|
674
|
+
private runSweepPhase(gcResult: IGCResult, sweepReadyNodes: Set<string>): string[] {
|
|
679
675
|
/**
|
|
680
676
|
* Currently, there are 3 modes for sweep:
|
|
681
677
|
* Test mode - Unreferenced nodes are immediately deleted without waiting for them to be sweep ready.
|
|
@@ -692,7 +688,7 @@ export class GarbageCollector implements IGarbageCollector {
|
|
|
692
688
|
}
|
|
693
689
|
|
|
694
690
|
if (this.configs.tombstoneMode) {
|
|
695
|
-
this.tombstones = sweepReadyNodes;
|
|
691
|
+
this.tombstones = Array.from(sweepReadyNodes);
|
|
696
692
|
// If we are running in GC tombstone mode, update tombstoned routes. This enables testing scenarios
|
|
697
693
|
// involving access to "deleted" data without actually deleting the data from summaries.
|
|
698
694
|
this.runtime.updateTombstonedRoutes(this.tombstones);
|
|
@@ -706,7 +702,7 @@ export class GarbageCollector implements IGarbageCollector {
|
|
|
706
702
|
// 1. Call the runtime to delete sweep ready nodes. The runtime returns a list of nodes it deleted.
|
|
707
703
|
// TODO: GC:Validation - validate that removed routes are not double delete and that the child routes of
|
|
708
704
|
// removed routes are deleted as well.
|
|
709
|
-
const deletedNodeIds = this.runtime.deleteSweepReadyNodes(sweepReadyNodes);
|
|
705
|
+
const deletedNodeIds = this.runtime.deleteSweepReadyNodes(Array.from(sweepReadyNodes));
|
|
710
706
|
|
|
711
707
|
// 2. Clear unreferenced state tracking for deleted nodes.
|
|
712
708
|
for (const nodeId of deletedNodeIds) {
|
|
@@ -976,12 +972,12 @@ export class GarbageCollector implements IGarbageCollector {
|
|
|
976
972
|
}
|
|
977
973
|
|
|
978
974
|
/**
|
|
979
|
-
* Generates the stats of a garbage collection
|
|
980
|
-
* @param gcResult - The result of
|
|
981
|
-
* @returns the
|
|
975
|
+
* Generates the stats of a garbage collection mark phase run.
|
|
976
|
+
* @param gcResult - The result of the current GC run.
|
|
977
|
+
* @returns the stats of the mark phase run.
|
|
982
978
|
*/
|
|
983
|
-
private
|
|
984
|
-
const
|
|
979
|
+
private getMarkPhaseStats(gcResult: IGCResult): IMarkPhaseStats {
|
|
980
|
+
const markPhaseStats: IMarkPhaseStats = {
|
|
985
981
|
nodeCount: 0,
|
|
986
982
|
dataStoreCount: 0,
|
|
987
983
|
attachmentBlobCount: 0,
|
|
@@ -994,35 +990,35 @@ export class GarbageCollector implements IGarbageCollector {
|
|
|
994
990
|
};
|
|
995
991
|
|
|
996
992
|
const updateNodeStats = (nodeId: string, referenced: boolean) => {
|
|
997
|
-
|
|
993
|
+
markPhaseStats.nodeCount++;
|
|
998
994
|
// If there is no previous GC data, every node's state is generated and is considered as updated.
|
|
999
995
|
// Otherwise, find out if any node went from referenced to unreferenced or vice-versa.
|
|
1000
996
|
const stateUpdated =
|
|
1001
997
|
this.gcDataFromLastRun === undefined ||
|
|
1002
998
|
this.unreferencedNodesState.has(nodeId) === referenced;
|
|
1003
999
|
if (stateUpdated) {
|
|
1004
|
-
|
|
1000
|
+
markPhaseStats.updatedNodeCount++;
|
|
1005
1001
|
}
|
|
1006
1002
|
if (!referenced) {
|
|
1007
|
-
|
|
1003
|
+
markPhaseStats.unrefNodeCount++;
|
|
1008
1004
|
}
|
|
1009
1005
|
|
|
1010
1006
|
if (this.runtime.getNodeType(nodeId) === GCNodeType.DataStore) {
|
|
1011
|
-
|
|
1007
|
+
markPhaseStats.dataStoreCount++;
|
|
1012
1008
|
if (stateUpdated) {
|
|
1013
|
-
|
|
1009
|
+
markPhaseStats.updatedDataStoreCount++;
|
|
1014
1010
|
}
|
|
1015
1011
|
if (!referenced) {
|
|
1016
|
-
|
|
1012
|
+
markPhaseStats.unrefDataStoreCount++;
|
|
1017
1013
|
}
|
|
1018
1014
|
}
|
|
1019
1015
|
if (this.runtime.getNodeType(nodeId) === GCNodeType.Blob) {
|
|
1020
|
-
|
|
1016
|
+
markPhaseStats.attachmentBlobCount++;
|
|
1021
1017
|
if (stateUpdated) {
|
|
1022
|
-
|
|
1018
|
+
markPhaseStats.updatedAttachmentBlobCount++;
|
|
1023
1019
|
}
|
|
1024
1020
|
if (!referenced) {
|
|
1025
|
-
|
|
1021
|
+
markPhaseStats.unrefAttachmentBlobCount++;
|
|
1026
1022
|
}
|
|
1027
1023
|
}
|
|
1028
1024
|
};
|
|
@@ -1035,6 +1031,63 @@ export class GarbageCollector implements IGarbageCollector {
|
|
|
1035
1031
|
updateNodeStats(nodeId, false /* referenced */);
|
|
1036
1032
|
}
|
|
1037
1033
|
|
|
1038
|
-
return
|
|
1034
|
+
return markPhaseStats;
|
|
1035
|
+
}
|
|
1036
|
+
|
|
1037
|
+
/**
|
|
1038
|
+
* Generates the stats of a garbage collection sweep phase run.
|
|
1039
|
+
* @param allDeletedNodes - All the nodes that have been deleted across all GC runs.
|
|
1040
|
+
* @param currentDeletedNodes - The nodes that have been deleted in this GC run.
|
|
1041
|
+
* @param markPhaseStats - The stats of the mark phase run.
|
|
1042
|
+
* @returns the stats of the sweep phase run.
|
|
1043
|
+
*/
|
|
1044
|
+
private getSweepPhaseStats(
|
|
1045
|
+
allDeletedNodes: Set<string>,
|
|
1046
|
+
currentDeletedNodes: Set<string>,
|
|
1047
|
+
markPhaseStats: IMarkPhaseStats,
|
|
1048
|
+
): ISweepPhaseStats {
|
|
1049
|
+
// Initialize the life time node counts to the mark phase node counts. If sweep is not enabled,
|
|
1050
|
+
// these will be the life time node count for this container.
|
|
1051
|
+
const sweepPhaseStats: ISweepPhaseStats = {
|
|
1052
|
+
lifetimeNodeCount: markPhaseStats.nodeCount,
|
|
1053
|
+
lifetimeDataStoreCount: markPhaseStats.dataStoreCount,
|
|
1054
|
+
lifetimeAttachmentBlobCount: markPhaseStats.attachmentBlobCount,
|
|
1055
|
+
deletedNodeCount: 0,
|
|
1056
|
+
deletedDataStoreCount: 0,
|
|
1057
|
+
deletedAttachmentBlobCount: 0,
|
|
1058
|
+
};
|
|
1059
|
+
|
|
1060
|
+
for (const nodeId of allDeletedNodes) {
|
|
1061
|
+
sweepPhaseStats.deletedNodeCount++;
|
|
1062
|
+
const nodeType = this.runtime.getNodeType(nodeId);
|
|
1063
|
+
if (nodeType === GCNodeType.DataStore) {
|
|
1064
|
+
sweepPhaseStats.deletedDataStoreCount++;
|
|
1065
|
+
} else if (nodeType === GCNodeType.Blob) {
|
|
1066
|
+
sweepPhaseStats.deletedAttachmentBlobCount++;
|
|
1067
|
+
}
|
|
1068
|
+
}
|
|
1069
|
+
|
|
1070
|
+
if (!this.configs.shouldRunSweep) {
|
|
1071
|
+
return sweepPhaseStats;
|
|
1072
|
+
}
|
|
1073
|
+
|
|
1074
|
+
// If sweep is enabled, the counts from the mark phase stats do not include nodes that have been
|
|
1075
|
+
// deleted in previous runs. Add the deleted node counts to life time stats.
|
|
1076
|
+
sweepPhaseStats.lifetimeNodeCount += sweepPhaseStats.deletedNodeCount;
|
|
1077
|
+
sweepPhaseStats.lifetimeDataStoreCount += sweepPhaseStats.deletedDataStoreCount;
|
|
1078
|
+
sweepPhaseStats.lifetimeAttachmentBlobCount += sweepPhaseStats.deletedAttachmentBlobCount;
|
|
1079
|
+
|
|
1080
|
+
// The node deleted in current run are counted twice - once in allDeletedNodes and again in
|
|
1081
|
+
// markPhaseStats. So, remove them from the life time stats.
|
|
1082
|
+
for (const nodeId of currentDeletedNodes) {
|
|
1083
|
+
sweepPhaseStats.lifetimeNodeCount--;
|
|
1084
|
+
const nodeType = this.runtime.getNodeType(nodeId);
|
|
1085
|
+
if (nodeType === GCNodeType.DataStore) {
|
|
1086
|
+
sweepPhaseStats.lifetimeDataStoreCount--;
|
|
1087
|
+
} else if (nodeType === GCNodeType.Blob) {
|
|
1088
|
+
sweepPhaseStats.lifetimeAttachmentBlobCount--;
|
|
1089
|
+
}
|
|
1090
|
+
}
|
|
1091
|
+
return sweepPhaseStats;
|
|
1039
1092
|
}
|
|
1040
1093
|
}
|
package/src/gc/gcDefinitions.ts
CHANGED
|
@@ -62,8 +62,6 @@ export const runSweepKey = "Fluid.GarbageCollection.RunSweep";
|
|
|
62
62
|
export const gcTestModeKey = "Fluid.GarbageCollection.GCTestMode";
|
|
63
63
|
/** Config key to expire a session after a set period of time. Defaults to true. */
|
|
64
64
|
export const runSessionExpiryKey = "Fluid.GarbageCollection.RunSessionExpiry";
|
|
65
|
-
/** Config key to turn GC sweep log off. */
|
|
66
|
-
export const disableSweepLogKey = "Fluid.GarbageCollection.DisableSweepLog";
|
|
67
65
|
/** Config key to disable the tombstone feature, i.e., tombstone information is not read / written into summary. */
|
|
68
66
|
export const disableTombstoneKey = "Fluid.GarbageCollection.DisableTombstone";
|
|
69
67
|
/** Config key to override throwing an error when tombstone object is loaded (requested). */
|
|
@@ -151,10 +149,10 @@ export interface IGCMetadata {
|
|
|
151
149
|
}
|
|
152
150
|
|
|
153
151
|
/**
|
|
154
|
-
* The statistics of the system state after a garbage collection run.
|
|
152
|
+
* The statistics of the system state after a garbage collection mark phase run.
|
|
155
153
|
* @public
|
|
156
154
|
*/
|
|
157
|
-
export interface
|
|
155
|
+
export interface IMarkPhaseStats {
|
|
158
156
|
/** The number of nodes in the container. */
|
|
159
157
|
nodeCount: number;
|
|
160
158
|
/** The number of data stores in the container. */
|
|
@@ -175,6 +173,31 @@ export interface IGCStats {
|
|
|
175
173
|
updatedAttachmentBlobCount: number;
|
|
176
174
|
}
|
|
177
175
|
|
|
176
|
+
/**
|
|
177
|
+
* The statistics of the system state after a garbage collection sweep phase run.
|
|
178
|
+
* @public
|
|
179
|
+
*/
|
|
180
|
+
export interface ISweepPhaseStats {
|
|
181
|
+
/** The number of nodes in the lifetime of the container. */
|
|
182
|
+
lifetimeNodeCount: number;
|
|
183
|
+
/** The number of data stores in the lifetime of the container. */
|
|
184
|
+
lifetimeDataStoreCount: number;
|
|
185
|
+
/** The number of attachment blobs in the lifetime of the container. */
|
|
186
|
+
lifetimeAttachmentBlobCount: number;
|
|
187
|
+
/** The number of deleted nodes in the container. */
|
|
188
|
+
deletedNodeCount: number;
|
|
189
|
+
/** The number of deleted data stores in the container. */
|
|
190
|
+
deletedDataStoreCount: number;
|
|
191
|
+
/** The number of deleted attachment blobs in the container. */
|
|
192
|
+
deletedAttachmentBlobCount: number;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* The statistics of the system state after a garbage collection run.
|
|
197
|
+
* @public
|
|
198
|
+
*/
|
|
199
|
+
export interface IGCStats extends IMarkPhaseStats, ISweepPhaseStats {}
|
|
200
|
+
|
|
178
201
|
/**
|
|
179
202
|
* The types of GC nodes in the GC reference graph.
|
|
180
203
|
* @public
|
package/src/gc/gcTelemetry.ts
CHANGED
|
@@ -14,7 +14,6 @@ import {
|
|
|
14
14
|
import { RuntimeHeaderData } from "../containerRuntime";
|
|
15
15
|
import { ICreateContainerMetadata } from "../summary";
|
|
16
16
|
import {
|
|
17
|
-
disableSweepLogKey,
|
|
18
17
|
GCNodeType,
|
|
19
18
|
UnreferencedState,
|
|
20
19
|
IGarbageCollectorConfigs,
|
|
@@ -392,58 +391,6 @@ export class GCTelemetryTracker {
|
|
|
392
391
|
}
|
|
393
392
|
this.pendingEventsQueue = [];
|
|
394
393
|
}
|
|
395
|
-
|
|
396
|
-
/**
|
|
397
|
-
* For nodes that are ready to sweep, log an event for now. Until we start running sweep which deletes objects,
|
|
398
|
-
* this will give us a view into how much deleted content a container has.
|
|
399
|
-
*/
|
|
400
|
-
public logSweepEvents(
|
|
401
|
-
logger: ITelemetryLoggerExt,
|
|
402
|
-
currentReferenceTimestampMs: number,
|
|
403
|
-
unreferencedNodesState: Map<string, UnreferencedStateTracker>,
|
|
404
|
-
completedGCRuns: number,
|
|
405
|
-
lastSummaryTime?: number,
|
|
406
|
-
) {
|
|
407
|
-
if (
|
|
408
|
-
this.mc.config.getBoolean(disableSweepLogKey) === true ||
|
|
409
|
-
this.configs.sweepTimeoutMs === undefined
|
|
410
|
-
) {
|
|
411
|
-
return;
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
const deletedNodeIds: string[] = [];
|
|
415
|
-
for (const [nodeId, nodeStateTracker] of unreferencedNodesState) {
|
|
416
|
-
if (nodeStateTracker.state !== UnreferencedState.SweepReady) {
|
|
417
|
-
return;
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
const nodeType = this.getNodeType(nodeId);
|
|
421
|
-
if (nodeType !== GCNodeType.DataStore && nodeType !== GCNodeType.Blob) {
|
|
422
|
-
return;
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
// Log deleted event for each node only once to reduce noise in telemetry.
|
|
426
|
-
const uniqueEventId = `Deleted-${nodeId}`;
|
|
427
|
-
if (this.loggedUnreferencedEvents.has(uniqueEventId)) {
|
|
428
|
-
return;
|
|
429
|
-
}
|
|
430
|
-
this.loggedUnreferencedEvents.add(uniqueEventId);
|
|
431
|
-
deletedNodeIds.push(nodeId);
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
if (deletedNodeIds.length > 0) {
|
|
435
|
-
logger.sendTelemetryEvent({
|
|
436
|
-
eventName: "GC_SweepReadyObjects_Delete",
|
|
437
|
-
details: JSON.stringify({
|
|
438
|
-
timeout: this.configs.sweepTimeoutMs,
|
|
439
|
-
completedGCRuns,
|
|
440
|
-
lastSummaryTime,
|
|
441
|
-
...this.createContainerMetadata,
|
|
442
|
-
}),
|
|
443
|
-
...tagCodeArtifacts({ id: JSON.stringify(deletedNodeIds) }),
|
|
444
|
-
});
|
|
445
|
-
}
|
|
446
|
-
}
|
|
447
394
|
}
|
|
448
395
|
|
|
449
396
|
/**
|
package/src/gc/index.ts
CHANGED
|
@@ -8,7 +8,6 @@ export {
|
|
|
8
8
|
nextGCVersion,
|
|
9
9
|
defaultInactiveTimeoutMs,
|
|
10
10
|
defaultSessionExpiryDurationMs,
|
|
11
|
-
disableSweepLogKey,
|
|
12
11
|
GCNodeType,
|
|
13
12
|
gcTestModeKey,
|
|
14
13
|
gcTombstoneGenerationOptionName,
|
|
@@ -24,6 +23,8 @@ export {
|
|
|
24
23
|
IGCMetadata,
|
|
25
24
|
IGCResult,
|
|
26
25
|
IGCRuntimeOptions,
|
|
26
|
+
IMarkPhaseStats,
|
|
27
|
+
ISweepPhaseStats,
|
|
27
28
|
IGCStats,
|
|
28
29
|
oneDayMs,
|
|
29
30
|
runGCKey,
|
package/src/index.ts
CHANGED
package/src/packageVersion.ts
CHANGED