@fluidframework/container-runtime 2.0.0-internal.8.0.1 → 2.0.0-rc.1.0.1

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.
Files changed (447) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/README.md +1 -7
  3. package/api-extractor-esm.json +4 -0
  4. package/api-extractor-lint.json +1 -10
  5. package/api-extractor.json +1 -9
  6. package/api-report/container-runtime.api.md +18 -17
  7. package/dist/blobManager.d.ts +8 -3
  8. package/dist/blobManager.d.ts.map +1 -1
  9. package/dist/blobManager.js +15 -4
  10. package/dist/blobManager.js.map +1 -1
  11. package/dist/container-runtime-alpha.d.ts +265 -17
  12. package/dist/container-runtime-beta.d.ts +0 -42
  13. package/dist/container-runtime-public.d.ts +0 -42
  14. package/dist/container-runtime-untrimmed.d.ts +32 -17
  15. package/dist/containerRuntime.d.ts +8 -4
  16. package/dist/containerRuntime.d.ts.map +1 -1
  17. package/dist/containerRuntime.js +15 -29
  18. package/dist/containerRuntime.js.map +1 -1
  19. package/dist/dataStoreContext.d.ts +5 -2
  20. package/dist/dataStoreContext.d.ts.map +1 -1
  21. package/dist/dataStoreContext.js +10 -3
  22. package/dist/dataStoreContext.js.map +1 -1
  23. package/dist/dataStores.d.ts +10 -3
  24. package/dist/dataStores.d.ts.map +1 -1
  25. package/dist/dataStores.js +51 -8
  26. package/dist/dataStores.js.map +1 -1
  27. package/dist/gc/garbageCollection.d.ts.map +1 -1
  28. package/dist/gc/garbageCollection.js +15 -4
  29. package/dist/gc/garbageCollection.js.map +1 -1
  30. package/dist/gc/gcConfigs.d.ts.map +1 -1
  31. package/dist/gc/gcConfigs.js +26 -19
  32. package/dist/gc/gcConfigs.js.map +1 -1
  33. package/dist/gc/gcDefinitions.d.ts +29 -6
  34. package/dist/gc/gcDefinitions.d.ts.map +1 -1
  35. package/dist/gc/gcDefinitions.js +5 -3
  36. package/dist/gc/gcDefinitions.js.map +1 -1
  37. package/dist/gc/gcTelemetry.d.ts +13 -6
  38. package/dist/gc/gcTelemetry.d.ts.map +1 -1
  39. package/dist/gc/gcTelemetry.js +18 -9
  40. package/dist/gc/gcTelemetry.js.map +1 -1
  41. package/dist/gc/index.d.ts +1 -1
  42. package/dist/gc/index.d.ts.map +1 -1
  43. package/dist/gc/index.js +2 -1
  44. package/dist/gc/index.js.map +1 -1
  45. package/dist/messageTypes.d.ts +1 -1
  46. package/dist/messageTypes.js +1 -1
  47. package/dist/messageTypes.js.map +1 -1
  48. package/dist/opLifecycle/definitions.d.ts +1 -1
  49. package/dist/opLifecycle/definitions.d.ts.map +1 -1
  50. package/dist/opLifecycle/definitions.js.map +1 -1
  51. package/dist/opLifecycle/outbox.d.ts +4 -4
  52. package/dist/opLifecycle/outbox.d.ts.map +1 -1
  53. package/dist/opLifecycle/outbox.js +4 -1
  54. package/dist/opLifecycle/outbox.js.map +1 -1
  55. package/dist/packageVersion.d.ts +1 -1
  56. package/dist/packageVersion.d.ts.map +1 -1
  57. package/dist/packageVersion.js +1 -1
  58. package/dist/packageVersion.js.map +1 -1
  59. package/dist/summary/runWhileConnectedCoordinator.d.ts +1 -1
  60. package/dist/summary/runWhileConnectedCoordinator.js.map +1 -1
  61. package/dist/summary/runningSummarizer.d.ts +5 -0
  62. package/dist/summary/runningSummarizer.d.ts.map +1 -1
  63. package/dist/summary/runningSummarizer.js +46 -17
  64. package/dist/summary/runningSummarizer.js.map +1 -1
  65. package/dist/summary/summarizer.d.ts +1 -1
  66. package/dist/summary/summarizer.js +1 -1
  67. package/dist/summary/summarizer.js.map +1 -1
  68. package/dist/summary/summarizerTypes.d.ts +3 -1
  69. package/dist/summary/summarizerTypes.d.ts.map +1 -1
  70. package/dist/summary/summarizerTypes.js.map +1 -1
  71. package/dist/summary/summaryCollection.d.ts +7 -7
  72. package/dist/summary/summaryCollection.js +1 -1
  73. package/dist/summary/summaryCollection.js.map +1 -1
  74. package/lib/{batchTracker.d.ts → batchTracker.d.mts} +1 -1
  75. package/lib/batchTracker.d.mts.map +1 -0
  76. package/lib/{batchTracker.js → batchTracker.mjs} +1 -1
  77. package/lib/batchTracker.mjs.map +1 -0
  78. package/lib/{blobManager.d.ts → blobManager.d.mts} +9 -4
  79. package/lib/blobManager.d.mts.map +1 -0
  80. package/lib/{blobManager.js → blobManager.mjs} +17 -6
  81. package/lib/blobManager.mjs.map +1 -0
  82. package/lib/{connectionTelemetry.d.ts → connectionTelemetry.d.mts} +1 -1
  83. package/lib/connectionTelemetry.d.mts.map +1 -0
  84. package/lib/{connectionTelemetry.js → connectionTelemetry.mjs} +1 -1
  85. package/lib/connectionTelemetry.mjs.map +1 -0
  86. package/lib/{container-runtime-alpha.d.ts → container-runtime-alpha.d.mts} +265 -17
  87. package/lib/{container-runtime-beta.d.ts → container-runtime-beta.d.mts} +0 -42
  88. package/lib/{container-runtime-public.d.ts → container-runtime-public.d.mts} +0 -42
  89. package/lib/{container-runtime-untrimmed.d.ts → container-runtime-untrimmed.d.mts} +32 -17
  90. package/lib/{containerHandleContext.d.ts → containerHandleContext.d.mts} +2 -2
  91. package/lib/containerHandleContext.d.mts.map +1 -0
  92. package/lib/{containerHandleContext.js → containerHandleContext.mjs} +1 -1
  93. package/lib/containerHandleContext.mjs.map +1 -0
  94. package/lib/{containerRuntime.d.ts → containerRuntime.d.mts} +14 -14
  95. package/lib/containerRuntime.d.mts.map +1 -0
  96. package/lib/{containerRuntime.js → containerRuntime.mjs} +31 -22
  97. package/lib/containerRuntime.mjs.map +1 -0
  98. package/lib/{dataStore.d.ts → dataStore.d.mts} +3 -3
  99. package/lib/dataStore.d.mts.map +1 -0
  100. package/lib/{dataStore.js → dataStore.mjs} +1 -1
  101. package/lib/dataStore.mjs.map +1 -0
  102. package/lib/{dataStoreContext.d.ts → dataStoreContext.d.mts} +7 -4
  103. package/lib/dataStoreContext.d.mts.map +1 -0
  104. package/lib/{dataStoreContext.js → dataStoreContext.mjs} +13 -6
  105. package/lib/dataStoreContext.mjs.map +1 -0
  106. package/lib/{dataStoreContexts.d.ts → dataStoreContexts.d.mts} +2 -2
  107. package/lib/dataStoreContexts.d.mts.map +1 -0
  108. package/lib/{dataStoreContexts.js → dataStoreContexts.mjs} +1 -1
  109. package/lib/dataStoreContexts.mjs.map +1 -0
  110. package/lib/{dataStoreRegistry.d.ts → dataStoreRegistry.d.mts} +1 -1
  111. package/lib/dataStoreRegistry.d.mts.map +1 -0
  112. package/lib/{dataStoreRegistry.js → dataStoreRegistry.mjs} +1 -5
  113. package/lib/dataStoreRegistry.mjs.map +1 -0
  114. package/lib/{dataStores.d.ts → dataStores.d.mts} +17 -10
  115. package/lib/dataStores.d.mts.map +1 -0
  116. package/lib/{dataStores.js → dataStores.mjs} +58 -16
  117. package/lib/dataStores.mjs.map +1 -0
  118. package/lib/{deltaManagerProxyBase.d.ts → deltaManagerProxyBase.d.mts} +1 -1
  119. package/lib/deltaManagerProxyBase.d.mts.map +1 -0
  120. package/lib/{deltaManagerProxyBase.js → deltaManagerProxyBase.mjs} +1 -1
  121. package/lib/deltaManagerProxyBase.mjs.map +1 -0
  122. package/lib/{deltaManagerSummarizerProxy.d.ts → deltaManagerSummarizerProxy.d.mts} +2 -2
  123. package/lib/deltaManagerSummarizerProxy.d.mts.map +1 -0
  124. package/lib/{deltaManagerSummarizerProxy.js → deltaManagerSummarizerProxy.mjs} +3 -3
  125. package/lib/deltaManagerSummarizerProxy.mjs.map +1 -0
  126. package/lib/{deltaScheduler.d.ts → deltaScheduler.d.mts} +1 -1
  127. package/lib/deltaScheduler.d.mts.map +1 -0
  128. package/lib/{deltaScheduler.js → deltaScheduler.mjs} +1 -1
  129. package/lib/deltaScheduler.mjs.map +1 -0
  130. package/lib/{error.d.ts → error.d.mts} +1 -1
  131. package/lib/error.d.mts.map +1 -0
  132. package/lib/{error.js → error.mjs} +1 -1
  133. package/lib/error.mjs.map +1 -0
  134. package/lib/gc/{garbageCollection.d.ts → garbageCollection.d.mts} +5 -5
  135. package/lib/gc/garbageCollection.d.mts.map +1 -0
  136. package/lib/gc/{garbageCollection.js → garbageCollection.mjs} +28 -17
  137. package/lib/gc/garbageCollection.mjs.map +1 -0
  138. package/lib/gc/{gcConfigs.d.ts → gcConfigs.d.mts} +3 -3
  139. package/lib/gc/gcConfigs.d.mts.map +1 -0
  140. package/lib/gc/{gcConfigs.js → gcConfigs.mjs} +29 -22
  141. package/lib/gc/gcConfigs.mjs.map +1 -0
  142. package/lib/gc/{gcDefinitions.d.ts → gcDefinitions.d.mts} +33 -10
  143. package/lib/gc/gcDefinitions.d.mts.map +1 -0
  144. package/lib/gc/{gcDefinitions.js → gcDefinitions.mjs} +5 -3
  145. package/lib/gc/gcDefinitions.mjs.map +1 -0
  146. package/lib/gc/{gcHelpers.d.ts → gcHelpers.d.mts} +3 -3
  147. package/lib/gc/{gcHelpers.d.ts.map → gcHelpers.d.mts.map} +1 -1
  148. package/lib/gc/{gcHelpers.js → gcHelpers.mjs} +1 -1
  149. package/lib/gc/gcHelpers.mjs.map +1 -0
  150. package/lib/gc/{gcReferenceGraphAlgorithm.d.ts → gcReferenceGraphAlgorithm.d.mts} +2 -2
  151. package/lib/gc/gcReferenceGraphAlgorithm.d.mts.map +1 -0
  152. package/lib/gc/{gcReferenceGraphAlgorithm.js → gcReferenceGraphAlgorithm.mjs} +1 -1
  153. package/lib/gc/gcReferenceGraphAlgorithm.mjs.map +1 -0
  154. package/lib/gc/{gcSummaryDefinitions.d.ts → gcSummaryDefinitions.d.mts} +1 -1
  155. package/lib/gc/gcSummaryDefinitions.d.mts.map +1 -0
  156. package/lib/gc/{gcSummaryDefinitions.js → gcSummaryDefinitions.mjs} +1 -1
  157. package/lib/gc/gcSummaryDefinitions.mjs.map +1 -0
  158. package/lib/gc/{gcSummaryStateTracker.d.ts → gcSummaryStateTracker.d.mts} +4 -4
  159. package/lib/gc/gcSummaryStateTracker.d.mts.map +1 -0
  160. package/lib/gc/{gcSummaryStateTracker.js → gcSummaryStateTracker.mjs} +2 -2
  161. package/lib/gc/gcSummaryStateTracker.mjs.map +1 -0
  162. package/lib/gc/{gcTelemetry.d.ts → gcTelemetry.d.mts} +18 -11
  163. package/lib/gc/gcTelemetry.d.mts.map +1 -0
  164. package/lib/gc/{gcTelemetry.js → gcTelemetry.mjs} +20 -11
  165. package/lib/gc/gcTelemetry.mjs.map +1 -0
  166. package/lib/gc/{gcUnreferencedStateTracker.d.ts → gcUnreferencedStateTracker.d.mts} +2 -2
  167. package/lib/gc/gcUnreferencedStateTracker.d.mts.map +1 -0
  168. package/lib/gc/{gcUnreferencedStateTracker.js → gcUnreferencedStateTracker.mjs} +2 -2
  169. package/lib/gc/gcUnreferencedStateTracker.mjs.map +1 -0
  170. package/lib/gc/{index.d.ts → index.d.mts} +9 -9
  171. package/lib/gc/index.d.mts.map +1 -0
  172. package/lib/gc/{index.js → index.mjs} +8 -8
  173. package/lib/gc/index.mjs.map +1 -0
  174. package/lib/{index.d.ts → index.d.mts} +8 -8
  175. package/lib/index.d.mts.map +1 -0
  176. package/lib/{index.js → index.mjs} +7 -9
  177. package/lib/index.mjs.map +1 -0
  178. package/lib/{messageTypes.d.ts → messageTypes.d.mts} +5 -5
  179. package/lib/messageTypes.d.mts.map +1 -0
  180. package/lib/{messageTypes.js → messageTypes.mjs} +2 -2
  181. package/lib/messageTypes.mjs.map +1 -0
  182. package/lib/{metadata.d.ts → metadata.d.mts} +1 -1
  183. package/lib/metadata.d.mts.map +1 -0
  184. package/lib/{metadata.js → metadata.mjs} +1 -1
  185. package/lib/metadata.mjs.map +1 -0
  186. package/lib/opLifecycle/{batchManager.d.ts → batchManager.d.mts} +3 -3
  187. package/lib/opLifecycle/batchManager.d.mts.map +1 -0
  188. package/lib/opLifecycle/{batchManager.js → batchManager.mjs} +1 -1
  189. package/lib/opLifecycle/batchManager.mjs.map +1 -0
  190. package/lib/opLifecycle/{definitions.d.ts → definitions.d.mts} +3 -3
  191. package/lib/opLifecycle/definitions.d.mts.map +1 -0
  192. package/lib/opLifecycle/{definitions.js → definitions.mjs} +1 -1
  193. package/lib/opLifecycle/definitions.mjs.map +1 -0
  194. package/lib/opLifecycle/index.d.mts +13 -0
  195. package/lib/opLifecycle/index.d.mts.map +1 -0
  196. package/lib/opLifecycle/index.mjs +12 -0
  197. package/lib/opLifecycle/index.mjs.map +1 -0
  198. package/lib/opLifecycle/{opCompressor.d.ts → opCompressor.d.mts} +2 -2
  199. package/lib/opLifecycle/opCompressor.d.mts.map +1 -0
  200. package/lib/opLifecycle/{opCompressor.js → opCompressor.mjs} +3 -3
  201. package/lib/opLifecycle/opCompressor.mjs.map +1 -0
  202. package/lib/opLifecycle/{opDecompressor.d.ts → opDecompressor.d.mts} +2 -2
  203. package/lib/opLifecycle/opDecompressor.d.mts.map +1 -0
  204. package/lib/opLifecycle/{opDecompressor.js → opDecompressor.mjs} +2 -2
  205. package/lib/opLifecycle/opDecompressor.mjs.map +1 -0
  206. package/lib/opLifecycle/{opGroupingManager.d.ts → opGroupingManager.d.mts} +2 -2
  207. package/lib/opLifecycle/opGroupingManager.d.mts.map +1 -0
  208. package/lib/opLifecycle/{opGroupingManager.js → opGroupingManager.mjs} +1 -1
  209. package/lib/opLifecycle/opGroupingManager.mjs.map +1 -0
  210. package/lib/opLifecycle/{opSplitter.d.ts → opSplitter.d.mts} +2 -2
  211. package/lib/opLifecycle/opSplitter.d.mts.map +1 -0
  212. package/lib/opLifecycle/{opSplitter.js → opSplitter.mjs} +3 -3
  213. package/lib/opLifecycle/opSplitter.mjs.map +1 -0
  214. package/lib/opLifecycle/{outbox.d.ts → outbox.d.mts} +11 -11
  215. package/lib/opLifecycle/outbox.d.mts.map +1 -0
  216. package/lib/opLifecycle/{outbox.js → outbox.mjs} +6 -3
  217. package/lib/opLifecycle/outbox.mjs.map +1 -0
  218. package/lib/opLifecycle/{remoteMessageProcessor.d.ts → remoteMessageProcessor.d.mts} +5 -5
  219. package/lib/opLifecycle/remoteMessageProcessor.d.mts.map +1 -0
  220. package/lib/opLifecycle/{remoteMessageProcessor.js → remoteMessageProcessor.mjs} +2 -2
  221. package/lib/opLifecycle/remoteMessageProcessor.mjs.map +1 -0
  222. package/lib/{opProperties.d.ts → opProperties.d.mts} +1 -1
  223. package/lib/opProperties.d.mts.map +1 -0
  224. package/lib/{opProperties.js → opProperties.mjs} +1 -1
  225. package/lib/opProperties.mjs.map +1 -0
  226. package/lib/{packageVersion.d.ts → packageVersion.d.mts} +2 -2
  227. package/lib/packageVersion.d.mts.map +1 -0
  228. package/lib/{packageVersion.js → packageVersion.mjs} +2 -2
  229. package/lib/packageVersion.mjs.map +1 -0
  230. package/lib/{pendingStateManager.d.ts → pendingStateManager.d.mts} +2 -2
  231. package/lib/pendingStateManager.d.mts.map +1 -0
  232. package/lib/{pendingStateManager.js → pendingStateManager.mjs} +2 -2
  233. package/lib/pendingStateManager.mjs.map +1 -0
  234. package/lib/{scheduleManager.d.ts → scheduleManager.d.mts} +1 -5
  235. package/lib/scheduleManager.d.mts.map +1 -0
  236. package/lib/{scheduleManager.js → scheduleManager.mjs} +3 -3
  237. package/lib/scheduleManager.mjs.map +1 -0
  238. package/lib/{storageServiceWithAttachBlobs.d.ts → storageServiceWithAttachBlobs.d.mts} +1 -1
  239. package/lib/storageServiceWithAttachBlobs.d.mts.map +1 -0
  240. package/lib/{storageServiceWithAttachBlobs.js → storageServiceWithAttachBlobs.mjs} +1 -1
  241. package/lib/storageServiceWithAttachBlobs.mjs.map +1 -0
  242. package/lib/summary/{index.d.ts → index.d.mts} +13 -13
  243. package/lib/summary/index.d.mts.map +1 -0
  244. package/lib/summary/{index.js → index.mjs} +12 -12
  245. package/lib/summary/index.mjs.map +1 -0
  246. package/lib/summary/{orderedClientElection.d.ts → orderedClientElection.d.mts} +1 -5
  247. package/lib/summary/orderedClientElection.d.mts.map +1 -0
  248. package/lib/summary/{orderedClientElection.js → orderedClientElection.mjs} +2 -2
  249. package/lib/summary/orderedClientElection.mjs.map +1 -0
  250. package/lib/summary/{runWhileConnectedCoordinator.d.ts → runWhileConnectedCoordinator.d.mts} +3 -3
  251. package/lib/summary/runWhileConnectedCoordinator.d.mts.map +1 -0
  252. package/lib/summary/{runWhileConnectedCoordinator.js → runWhileConnectedCoordinator.mjs} +1 -1
  253. package/lib/summary/runWhileConnectedCoordinator.mjs.map +1 -0
  254. package/lib/summary/{runningSummarizer.d.ts → runningSummarizer.d.mts} +10 -5
  255. package/lib/summary/runningSummarizer.d.mts.map +1 -0
  256. package/lib/summary/{runningSummarizer.js → runningSummarizer.mjs} +50 -21
  257. package/lib/summary/runningSummarizer.mjs.map +1 -0
  258. package/lib/summary/{summarizer.d.ts → summarizer.d.mts} +6 -6
  259. package/lib/summary/summarizer.d.mts.map +1 -0
  260. package/lib/summary/{summarizer.js → summarizer.mjs} +5 -5
  261. package/lib/summary/summarizer.mjs.map +1 -0
  262. package/lib/summary/{summarizerClientElection.d.ts → summarizerClientElection.d.mts} +3 -3
  263. package/lib/summary/summarizerClientElection.d.mts.map +1 -0
  264. package/lib/summary/{summarizerClientElection.js → summarizerClientElection.mjs} +1 -1
  265. package/lib/summary/summarizerClientElection.mjs.map +1 -0
  266. package/lib/summary/{summarizerHeuristics.d.ts → summarizerHeuristics.d.mts} +4 -4
  267. package/lib/summary/summarizerHeuristics.d.mts.map +1 -0
  268. package/lib/summary/{summarizerHeuristics.js → summarizerHeuristics.mjs} +1 -1
  269. package/lib/summary/summarizerHeuristics.mjs.map +1 -0
  270. package/lib/summary/summarizerNode/{index.d.ts → index.d.mts} +4 -4
  271. package/lib/summary/summarizerNode/index.d.mts.map +1 -0
  272. package/lib/summary/summarizerNode/{index.js → index.mjs} +3 -3
  273. package/lib/summary/summarizerNode/index.mjs.map +1 -0
  274. package/lib/summary/summarizerNode/{summarizerNode.d.ts → summarizerNode.d.mts} +2 -2
  275. package/lib/summary/summarizerNode/summarizerNode.d.mts.map +1 -0
  276. package/lib/summary/summarizerNode/{summarizerNode.js → summarizerNode.mjs} +2 -2
  277. package/lib/summary/summarizerNode/summarizerNode.mjs.map +1 -0
  278. package/lib/summary/summarizerNode/{summarizerNodeUtils.d.ts → summarizerNodeUtils.d.mts} +1 -1
  279. package/lib/summary/summarizerNode/summarizerNodeUtils.d.mts.map +1 -0
  280. package/lib/summary/summarizerNode/{summarizerNodeUtils.js → summarizerNodeUtils.mjs} +1 -1
  281. package/lib/summary/summarizerNode/summarizerNodeUtils.mjs.map +1 -0
  282. package/lib/summary/summarizerNode/{summarizerNodeWithGc.d.ts → summarizerNodeWithGc.d.mts} +3 -3
  283. package/lib/summary/summarizerNode/summarizerNodeWithGc.d.mts.map +1 -0
  284. package/lib/summary/summarizerNode/{summarizerNodeWithGc.js → summarizerNodeWithGc.mjs} +4 -4
  285. package/lib/summary/summarizerNode/summarizerNodeWithGc.mjs.map +1 -0
  286. package/lib/summary/{summarizerTypes.d.ts → summarizerTypes.d.mts} +7 -5
  287. package/lib/summary/summarizerTypes.d.mts.map +1 -0
  288. package/lib/summary/{summarizerTypes.js → summarizerTypes.mjs} +1 -1
  289. package/lib/summary/summarizerTypes.mjs.map +1 -0
  290. package/lib/summary/{summaryCollection.d.ts → summaryCollection.d.mts} +8 -8
  291. package/lib/summary/summaryCollection.d.mts.map +1 -0
  292. package/lib/summary/{summaryCollection.js → summaryCollection.mjs} +2 -2
  293. package/lib/summary/summaryCollection.mjs.map +1 -0
  294. package/lib/summary/{summaryFormat.d.ts → summaryFormat.d.mts} +2 -2
  295. package/lib/summary/summaryFormat.d.mts.map +1 -0
  296. package/lib/summary/{summaryFormat.js → summaryFormat.mjs} +1 -1
  297. package/lib/summary/summaryFormat.mjs.map +1 -0
  298. package/lib/summary/{summaryGenerator.d.ts → summaryGenerator.d.mts} +3 -3
  299. package/lib/summary/summaryGenerator.d.mts.map +1 -0
  300. package/lib/summary/{summaryGenerator.js → summaryGenerator.mjs} +1 -1
  301. package/lib/summary/summaryGenerator.mjs.map +1 -0
  302. package/lib/summary/{summaryManager.d.ts → summaryManager.d.mts} +5 -5
  303. package/lib/summary/summaryManager.d.mts.map +1 -0
  304. package/lib/summary/{summaryManager.js → summaryManager.mjs} +2 -2
  305. package/lib/summary/summaryManager.mjs.map +1 -0
  306. package/lib/{throttler.d.ts → throttler.d.mts} +1 -1
  307. package/lib/throttler.d.mts.map +1 -0
  308. package/lib/{throttler.js → throttler.mjs} +1 -1
  309. package/lib/throttler.mjs.map +1 -0
  310. package/package.json +145 -39
  311. package/src/blobManager.ts +15 -4
  312. package/src/containerRuntime.ts +15 -4
  313. package/src/dataStoreContext.ts +11 -4
  314. package/src/dataStores.ts +61 -7
  315. package/src/gc/garbageCollection.ts +18 -4
  316. package/src/gc/gcConfigs.ts +28 -20
  317. package/src/gc/gcDefinitions.ts +30 -6
  318. package/src/gc/gcTelemetry.ts +19 -9
  319. package/src/gc/index.ts +3 -0
  320. package/src/messageTypes.ts +1 -1
  321. package/src/opLifecycle/definitions.ts +1 -1
  322. package/src/opLifecycle/outbox.ts +5 -2
  323. package/src/packageVersion.ts +1 -1
  324. package/src/summary/runWhileConnectedCoordinator.ts +1 -1
  325. package/src/summary/runningSummarizer.ts +58 -25
  326. package/src/summary/summarizer.ts +1 -1
  327. package/src/summary/summarizerTypes.ts +3 -1
  328. package/src/summary/summaryCollection.ts +7 -7
  329. package/tsconfig.json +6 -4
  330. package/lib/batchTracker.d.ts.map +0 -1
  331. package/lib/batchTracker.js.map +0 -1
  332. package/lib/blobManager.d.ts.map +0 -1
  333. package/lib/blobManager.js.map +0 -1
  334. package/lib/connectionTelemetry.d.ts.map +0 -1
  335. package/lib/connectionTelemetry.js.map +0 -1
  336. package/lib/containerHandleContext.d.ts.map +0 -1
  337. package/lib/containerHandleContext.js.map +0 -1
  338. package/lib/containerRuntime.d.ts.map +0 -1
  339. package/lib/containerRuntime.js.map +0 -1
  340. package/lib/dataStore.d.ts.map +0 -1
  341. package/lib/dataStore.js.map +0 -1
  342. package/lib/dataStoreContext.d.ts.map +0 -1
  343. package/lib/dataStoreContext.js.map +0 -1
  344. package/lib/dataStoreContexts.d.ts.map +0 -1
  345. package/lib/dataStoreContexts.js.map +0 -1
  346. package/lib/dataStoreRegistry.d.ts.map +0 -1
  347. package/lib/dataStoreRegistry.js.map +0 -1
  348. package/lib/dataStores.d.ts.map +0 -1
  349. package/lib/dataStores.js.map +0 -1
  350. package/lib/deltaManagerProxyBase.d.ts.map +0 -1
  351. package/lib/deltaManagerProxyBase.js.map +0 -1
  352. package/lib/deltaManagerSummarizerProxy.d.ts.map +0 -1
  353. package/lib/deltaManagerSummarizerProxy.js.map +0 -1
  354. package/lib/deltaScheduler.d.ts.map +0 -1
  355. package/lib/deltaScheduler.js.map +0 -1
  356. package/lib/error.d.ts.map +0 -1
  357. package/lib/error.js.map +0 -1
  358. package/lib/gc/garbageCollection.d.ts.map +0 -1
  359. package/lib/gc/garbageCollection.js.map +0 -1
  360. package/lib/gc/gcConfigs.d.ts.map +0 -1
  361. package/lib/gc/gcConfigs.js.map +0 -1
  362. package/lib/gc/gcDefinitions.d.ts.map +0 -1
  363. package/lib/gc/gcDefinitions.js.map +0 -1
  364. package/lib/gc/gcHelpers.js.map +0 -1
  365. package/lib/gc/gcReferenceGraphAlgorithm.d.ts.map +0 -1
  366. package/lib/gc/gcReferenceGraphAlgorithm.js.map +0 -1
  367. package/lib/gc/gcSummaryDefinitions.d.ts.map +0 -1
  368. package/lib/gc/gcSummaryDefinitions.js.map +0 -1
  369. package/lib/gc/gcSummaryStateTracker.d.ts.map +0 -1
  370. package/lib/gc/gcSummaryStateTracker.js.map +0 -1
  371. package/lib/gc/gcTelemetry.d.ts.map +0 -1
  372. package/lib/gc/gcTelemetry.js.map +0 -1
  373. package/lib/gc/gcUnreferencedStateTracker.d.ts.map +0 -1
  374. package/lib/gc/gcUnreferencedStateTracker.js.map +0 -1
  375. package/lib/gc/index.d.ts.map +0 -1
  376. package/lib/gc/index.js.map +0 -1
  377. package/lib/index.d.ts.map +0 -1
  378. package/lib/index.js.map +0 -1
  379. package/lib/messageTypes.d.ts.map +0 -1
  380. package/lib/messageTypes.js.map +0 -1
  381. package/lib/metadata.d.ts.map +0 -1
  382. package/lib/metadata.js.map +0 -1
  383. package/lib/opLifecycle/batchManager.d.ts.map +0 -1
  384. package/lib/opLifecycle/batchManager.js.map +0 -1
  385. package/lib/opLifecycle/definitions.d.ts.map +0 -1
  386. package/lib/opLifecycle/definitions.js.map +0 -1
  387. package/lib/opLifecycle/index.d.ts +0 -13
  388. package/lib/opLifecycle/index.d.ts.map +0 -1
  389. package/lib/opLifecycle/index.js +0 -12
  390. package/lib/opLifecycle/index.js.map +0 -1
  391. package/lib/opLifecycle/opCompressor.d.ts.map +0 -1
  392. package/lib/opLifecycle/opCompressor.js.map +0 -1
  393. package/lib/opLifecycle/opDecompressor.d.ts.map +0 -1
  394. package/lib/opLifecycle/opDecompressor.js.map +0 -1
  395. package/lib/opLifecycle/opGroupingManager.d.ts.map +0 -1
  396. package/lib/opLifecycle/opGroupingManager.js.map +0 -1
  397. package/lib/opLifecycle/opSplitter.d.ts.map +0 -1
  398. package/lib/opLifecycle/opSplitter.js.map +0 -1
  399. package/lib/opLifecycle/outbox.d.ts.map +0 -1
  400. package/lib/opLifecycle/outbox.js.map +0 -1
  401. package/lib/opLifecycle/remoteMessageProcessor.d.ts.map +0 -1
  402. package/lib/opLifecycle/remoteMessageProcessor.js.map +0 -1
  403. package/lib/opProperties.d.ts.map +0 -1
  404. package/lib/opProperties.js.map +0 -1
  405. package/lib/packageVersion.d.ts.map +0 -1
  406. package/lib/packageVersion.js.map +0 -1
  407. package/lib/pendingStateManager.d.ts.map +0 -1
  408. package/lib/pendingStateManager.js.map +0 -1
  409. package/lib/scheduleManager.d.ts.map +0 -1
  410. package/lib/scheduleManager.js.map +0 -1
  411. package/lib/storageServiceWithAttachBlobs.d.ts.map +0 -1
  412. package/lib/storageServiceWithAttachBlobs.js.map +0 -1
  413. package/lib/summary/index.d.ts.map +0 -1
  414. package/lib/summary/index.js.map +0 -1
  415. package/lib/summary/orderedClientElection.d.ts.map +0 -1
  416. package/lib/summary/orderedClientElection.js.map +0 -1
  417. package/lib/summary/runWhileConnectedCoordinator.d.ts.map +0 -1
  418. package/lib/summary/runWhileConnectedCoordinator.js.map +0 -1
  419. package/lib/summary/runningSummarizer.d.ts.map +0 -1
  420. package/lib/summary/runningSummarizer.js.map +0 -1
  421. package/lib/summary/summarizer.d.ts.map +0 -1
  422. package/lib/summary/summarizer.js.map +0 -1
  423. package/lib/summary/summarizerClientElection.d.ts.map +0 -1
  424. package/lib/summary/summarizerClientElection.js.map +0 -1
  425. package/lib/summary/summarizerHeuristics.d.ts.map +0 -1
  426. package/lib/summary/summarizerHeuristics.js.map +0 -1
  427. package/lib/summary/summarizerNode/index.d.ts.map +0 -1
  428. package/lib/summary/summarizerNode/index.js.map +0 -1
  429. package/lib/summary/summarizerNode/summarizerNode.d.ts.map +0 -1
  430. package/lib/summary/summarizerNode/summarizerNode.js.map +0 -1
  431. package/lib/summary/summarizerNode/summarizerNodeUtils.d.ts.map +0 -1
  432. package/lib/summary/summarizerNode/summarizerNodeUtils.js.map +0 -1
  433. package/lib/summary/summarizerNode/summarizerNodeWithGc.d.ts.map +0 -1
  434. package/lib/summary/summarizerNode/summarizerNodeWithGc.js.map +0 -1
  435. package/lib/summary/summarizerTypes.d.ts.map +0 -1
  436. package/lib/summary/summarizerTypes.js.map +0 -1
  437. package/lib/summary/summaryCollection.d.ts.map +0 -1
  438. package/lib/summary/summaryCollection.js.map +0 -1
  439. package/lib/summary/summaryFormat.d.ts.map +0 -1
  440. package/lib/summary/summaryFormat.js.map +0 -1
  441. package/lib/summary/summaryGenerator.d.ts.map +0 -1
  442. package/lib/summary/summaryGenerator.js.map +0 -1
  443. package/lib/summary/summaryManager.d.ts.map +0 -1
  444. package/lib/summary/summaryManager.js.map +0 -1
  445. package/lib/throttler.d.ts.map +0 -1
  446. package/lib/throttler.js.map +0 -1
  447. package/tsconfig.esnext.json +0 -7
@@ -1 +1 @@
1
- {"version":3,"file":"garbageCollection.js","sourceRoot":"","sources":["../../src/gc/garbageCollection.ts"],"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AI,QAAQ,KAAK,0BAAU,CAAC,IAAI,EAAE;gBACxC,eAAe,CAAC,0BAA0B,EAAE,CAAC;aAC7C;SACD;QAED,gGAAgG;QAChG,gFAAgF;QAChF,eAAe,CAAC,iBAAiB,IAAI,eAAe,CAAC,gBAAgB,CAAC;QACtE,eAAe,CAAC,sBAAsB,IAAI,eAAe,CAAC,qBAAqB,CAAC;QAChF,eAAe,CAAC,2BAA2B,IAAI,eAAe,CAAC,0BAA0B,CAAC;QAE1F,IAAI,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE;YAChC,OAAO,eAAe,CAAC;SACvB;QAED,0GAA0G;QAC1G,0CAA0C;QAC1C,qFAAqF;QACrF,KAAK,MAAM,MAAM,IAAI,eAAe,EAAE;YACrC,eAAe,CAAC,gBAAgB,EAAE,CAAC;YACnC,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;YAClD,IAAI,QAAQ,KAAK,0BAAU,CAAC,SAAS,EAAE;gBACtC,eAAe,CAAC,qBAAqB,EAAE,CAAC;aACxC;iBAAM,IAAI,QAAQ,KAAK,0BAAU,CAAC,IAAI,EAAE;gBACxC,eAAe,CAAC,0BAA0B,EAAE,CAAC;aAC7C;SACD;QACD,OAAO,eAAe,CAAC;IACxB,CAAC;CACD;AAlkCD,4CAkkCC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, LazyPromise, Timer } from \"@fluidframework/core-utils\";\nimport { IRequest } from \"@fluidframework/core-interfaces\";\nimport {\n\tgcTreeKey,\n\tIGarbageCollectionData,\n\tIGarbageCollectionDetailsBase,\n\tISummarizeResult,\n\tITelemetryContext,\n} from \"@fluidframework/runtime-definitions\";\nimport { createResponseError, responseToException } from \"@fluidframework/runtime-utils\";\nimport {\n\tcreateChildLogger,\n\tcreateChildMonitoringContext,\n\tDataProcessingError,\n\tITelemetryLoggerExt,\n\tMonitoringContext,\n\tPerformanceEvent,\n} from \"@fluidframework/telemetry-utils\";\nimport { BlobManager } from \"../blobManager\";\nimport {\n\tInactiveResponseHeaderKey,\n\tRuntimeHeaderData,\n\tTombstoneResponseHeaderKey,\n} from \"../containerRuntime\";\nimport { ClientSessionExpiredError } from \"../error\";\nimport { ContainerMessageType, ContainerRuntimeGCMessage } from \"../messageTypes\";\nimport { IRefreshSummaryResult } from \"../summary\";\nimport { generateGCConfigs } from \"./gcConfigs\";\nimport {\n\tGCNodeType,\n\tIGarbageCollector,\n\tIGarbageCollectorCreateParams,\n\tIGarbageCollectionRuntime,\n\tIGCResult,\n\tIGCStats,\n\tUnreferencedState,\n\tIGCMetadata,\n\tIGarbageCollectorConfigs,\n\tIMarkPhaseStats,\n\tISweepPhaseStats,\n\tGarbageCollectionMessage,\n\tGarbageCollectionMessageType,\n} from \"./gcDefinitions\";\nimport {\n\tcloneGCData,\n\tcompatBehaviorAllowsGCMessageType,\n\tconcatGarbageCollectionData,\n\tgetGCDataFromSnapshot,\n} from \"./gcHelpers\";\nimport { runGarbageCollection } from \"./gcReferenceGraphAlgorithm\";\nimport { IGarbageCollectionSnapshotData, IGarbageCollectionState } from \"./gcSummaryDefinitions\";\nimport { GCSummaryStateTracker } from \"./gcSummaryStateTracker\";\nimport { UnreferencedStateTracker } from \"./gcUnreferencedStateTracker\";\nimport { GCTelemetryTracker } from \"./gcTelemetry\";\n\n/**\n * The garbage collector for the container runtime. It consolidates the garbage collection functionality and maintains\n * its state across summaries.\n *\n * Node - represented as nodeId, it's a node on the GC graph\n *\n * Outbound Route - a path from one node to another node, think `nodeA` -\\> `nodeB`\n *\n * Graph - all nodes with their respective routes\n *\n * ```\n *\t\t\t GC Graph\n *\n *\t\t\t Node\n *\t\tNodeId = \"datastore1\"\n *\t\t /\t\t\t \\\\\n *\tOutboundRoute OutboundRoute\n *\t\t /\t\t\t\t \\\\\n *\t Node\t\t\t Node\n * NodeId = \"dds1\"\t NodeId = \"dds2\"\n * ```\n */\nexport class GarbageCollector implements IGarbageCollector {\n\tpublic static create(createParams: IGarbageCollectorCreateParams): IGarbageCollector {\n\t\treturn new GarbageCollector(createParams);\n\t}\n\n\tprivate readonly mc: MonitoringContext;\n\n\tprivate readonly configs: IGarbageCollectorConfigs;\n\n\tpublic get shouldRunGC(): boolean {\n\t\treturn this.configs.shouldRunGC;\n\t}\n\n\t// Keeps track of the GC state from the last run.\n\tprivate gcDataFromLastRun: IGarbageCollectionData | undefined;\n\t// Keeps a list of references (edges in the GC graph) between GC runs. Each entry has a node id and a list of\n\t// outbound routes from that node.\n\tprivate readonly newReferencesSinceLastRun: Map<string, string[]> = new Map();\n\t// A list of nodes that have been tombstoned.\n\tprivate tombstones: string[] = [];\n\t// A list of nodes that have been deleted during sweep phase.\n\tprivate deletedNodes: Set<string> = new Set();\n\n\t// Promise when resolved returns the GC data data in the base snapshot.\n\tprivate readonly baseSnapshotDataP: Promise<IGarbageCollectionSnapshotData | undefined>;\n\t// Promise when resolved initializes the GC state from the data in the base snapshot.\n\tprivate readonly initializeGCStateFromBaseSnapshotP: Promise<void>;\n\t// The GC details generated from the base snapshot.\n\tprivate readonly baseGCDetailsP: Promise<IGarbageCollectionDetailsBase>;\n\t// Map of node ids to their unreferenced state tracker.\n\tprivate readonly unreferencedNodesState: Map<string, UnreferencedStateTracker> = new Map();\n\t// The Timer responsible for closing the container when the session has expired\n\tprivate sessionExpiryTimer: Timer | undefined;\n\n\t// The number of times GC has successfully completed on this instance of GarbageCollector.\n\tprivate completedRuns = 0;\n\n\tprivate readonly runtime: IGarbageCollectionRuntime;\n\tprivate readonly isSummarizerClient: boolean;\n\n\tprivate readonly summaryStateTracker: GCSummaryStateTracker;\n\tprivate readonly telemetryTracker: GCTelemetryTracker;\n\n\t/** If false, loading or using a Tombstoned object should merely log, not fail */\n\tpublic get tombstoneEnforcementAllowed(): boolean {\n\t\treturn this.configs.sweepEnabled;\n\t}\n\t/** If true, throw an error when a tombstone data store is retrieved */\n\tpublic get throwOnTombstoneLoad(): boolean {\n\t\treturn this.configs.throwOnTombstoneLoad;\n\t}\n\t/** If true, throw an error when a tombstone data store is used */\n\tpublic get throwOnTombstoneUsage(): boolean {\n\t\treturn this.configs.throwOnTombstoneUsage;\n\t}\n\n\t/** For a given node path, returns the node's package path. */\n\tprivate readonly getNodePackagePath: (\n\t\tnodePath: string,\n\t) => Promise<readonly string[] | undefined>;\n\t/** Returns the timestamp of the last summary generated for this container. */\n\tprivate readonly getLastSummaryTimestampMs: () => number | undefined;\n\n\tprivate readonly submitMessage: (message: ContainerRuntimeGCMessage) => void;\n\n\tpublic get summaryStateNeedsReset(): boolean {\n\t\treturn this.summaryStateTracker.doesSummaryStateNeedReset;\n\t}\n\n\t/** Returns the count of data stores whose GC state updated since the last summary. */\n\tpublic get updatedDSCountSinceLastSummary(): number {\n\t\treturn this.summaryStateTracker.updatedDSCountSinceLastSummary;\n\t}\n\n\tprotected constructor(createParams: IGarbageCollectorCreateParams) {\n\t\tthis.runtime = createParams.runtime;\n\t\tthis.isSummarizerClient = createParams.isSummarizerClient;\n\t\tthis.getNodePackagePath = createParams.getNodePackagePath;\n\t\tthis.getLastSummaryTimestampMs = createParams.getLastSummaryTimestampMs;\n\t\tthis.submitMessage = createParams.submitMessage;\n\n\t\tconst baseSnapshot = createParams.baseSnapshot;\n\t\tconst readAndParseBlob = createParams.readAndParseBlob;\n\n\t\tthis.mc = createChildMonitoringContext({\n\t\t\tlogger: createParams.baseLogger,\n\t\t\tnamespace: \"GarbageCollector\",\n\t\t\tproperties: {\n\t\t\t\tall: { completedGCRuns: () => this.completedRuns },\n\t\t\t},\n\t\t});\n\n\t\tthis.configs = generateGCConfigs(this.mc, createParams);\n\n\t\t// If session expiry is enabled, we need to close the container when the session expiry timeout expires.\n\t\tif (this.configs.sessionExpiryTimeoutMs !== undefined) {\n\t\t\t// If Test Override config is set, override Session Expiry timeout.\n\t\t\tconst overrideSessionExpiryTimeoutMs = this.mc.config.getNumber(\n\t\t\t\t\"Fluid.GarbageCollection.TestOverride.SessionExpiryMs\",\n\t\t\t);\n\t\t\tconst timeoutMs = overrideSessionExpiryTimeoutMs ?? this.configs.sessionExpiryTimeoutMs;\n\n\t\t\tthis.sessionExpiryTimer = new Timer(timeoutMs, () => {\n\t\t\t\tthis.runtime.closeFn(\n\t\t\t\t\tnew ClientSessionExpiredError(`Client session expired.`, timeoutMs),\n\t\t\t\t);\n\t\t\t});\n\t\t\tthis.sessionExpiryTimer.start();\n\t\t}\n\n\t\tthis.summaryStateTracker = new GCSummaryStateTracker(\n\t\t\tthis.configs,\n\t\t\tbaseSnapshot?.trees[gcTreeKey] !== undefined /* wasGCRunInBaseSnapshot */,\n\t\t);\n\n\t\tthis.telemetryTracker = new GCTelemetryTracker(\n\t\t\tthis.mc,\n\t\t\tthis.configs,\n\t\t\tthis.isSummarizerClient,\n\t\t\tcreateParams.createContainerMetadata,\n\t\t\t(nodeId: string) => this.runtime.getNodeType(nodeId),\n\t\t\t(nodeId: string) => this.unreferencedNodesState.get(nodeId),\n\t\t\tthis.getNodePackagePath,\n\t\t);\n\n\t\t// Get the GC data from the base snapshot. Use LazyPromise because we only want to do this once since it\n\t\t// it involves fetching blobs from storage which is expensive.\n\t\tthis.baseSnapshotDataP = new LazyPromise<IGarbageCollectionSnapshotData | undefined>(\n\t\t\tasync () => {\n\t\t\t\tif (baseSnapshot === undefined) {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\n\t\t\t\ttry {\n\t\t\t\t\t// For newer documents, GC data should be present in the GC tree in the root of the snapshot.\n\t\t\t\t\tconst gcSnapshotTree = baseSnapshot.trees[gcTreeKey];\n\t\t\t\t\tif (gcSnapshotTree === undefined) {\n\t\t\t\t\t\t// back-compat - Older documents get their gc data reset for simplicity as there are few of them\n\t\t\t\t\t\t// incremental gc summary will not work with older gc data as well\n\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst snapshotData = await getGCDataFromSnapshot(\n\t\t\t\t\t\tgcSnapshotTree,\n\t\t\t\t\t\treadAndParseBlob,\n\t\t\t\t\t);\n\n\t\t\t\t\t// If the GC version in base snapshot does not match the GC version currently in effect, the GC data\n\t\t\t\t\t// in the snapshot cannot be interpreted correctly. Set everything to undefined except for\n\t\t\t\t\t// deletedNodes because irrespective of GC versions, these nodes have been deleted and cannot be\n\t\t\t\t\t// brought back. The deletedNodes info is needed to identify when these nodes are used.\n\t\t\t\t\tif (this.configs.gcVersionInEffect !== this.configs.gcVersionInBaseSnapshot) {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tgcState: undefined,\n\t\t\t\t\t\t\ttombstones: undefined,\n\t\t\t\t\t\t\tdeletedNodes: snapshotData.deletedNodes,\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\treturn snapshotData;\n\t\t\t\t} catch (error) {\n\t\t\t\t\tconst dpe = DataProcessingError.wrapIfUnrecognized(\n\t\t\t\t\t\terror,\n\t\t\t\t\t\t\"FailedToInitializeGC\",\n\t\t\t\t\t);\n\t\t\t\t\tdpe.addTelemetryProperties({\n\t\t\t\t\t\tgcConfigs: JSON.stringify(this.configs),\n\t\t\t\t\t});\n\t\t\t\t\tthrow dpe;\n\t\t\t\t}\n\t\t\t},\n\t\t);\n\n\t\t/**\n\t\t * Set up the initializer which initializes the GC state from the data in base snapshot. It sets up GC data\n\t\t * from the base GC state and starts tracking the state of unreferenced nodes.\n\t\t *\n\t\t * Must only be called if there is a current reference timestamp.\n\t\t */\n\t\tthis.initializeGCStateFromBaseSnapshotP = new LazyPromise<void>(async () => {\n\t\t\tconst currentReferenceTimestampMs = this.runtime.getCurrentReferenceTimestampMs();\n\t\t\tassert(\n\t\t\t\tcurrentReferenceTimestampMs !== undefined,\n\t\t\t\t\"Trying to initialize GC state without current timestamp\",\n\t\t\t);\n\n\t\t\t/**\n\t\t\t * The base snapshot data will not be present if the container is loaded from:\n\t\t\t * 1. The first summary created by the detached container.\n\t\t\t * 2. A summary that was generated with GC disabled.\n\t\t\t * 3. A summary that was generated before GC even existed.\n\t\t\t */\n\t\t\tconst baseSnapshotData = await this.baseSnapshotDataP;\n\t\t\tthis.summaryStateTracker.initializeBaseState(baseSnapshotData);\n\n\t\t\tif (baseSnapshotData?.gcState === undefined) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Update unreferenced state tracking as per the GC state in the snapshot data and update gcDataFromLastRun\n\t\t\t// to the GC data from the snapshot data.\n\t\t\tconst gcNodes: { [id: string]: string[] } = {};\n\t\t\tfor (const [nodeId, nodeData] of Object.entries(baseSnapshotData.gcState.gcNodes)) {\n\t\t\t\tif (nodeData.unreferencedTimestampMs !== undefined) {\n\t\t\t\t\tthis.unreferencedNodesState.set(\n\t\t\t\t\t\tnodeId,\n\t\t\t\t\t\tnew UnreferencedStateTracker(\n\t\t\t\t\t\t\tnodeData.unreferencedTimestampMs,\n\t\t\t\t\t\t\tthis.configs.inactiveTimeoutMs,\n\t\t\t\t\t\t\tcurrentReferenceTimestampMs,\n\t\t\t\t\t\t\tthis.configs.sweepTimeoutMs,\n\t\t\t\t\t\t\tthis.configs.sweepGracePeriodMs,\n\t\t\t\t\t\t),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tgcNodes[nodeId] = Array.from(nodeData.outboundRoutes);\n\t\t\t}\n\t\t\tthis.gcDataFromLastRun = { gcNodes };\n\t\t});\n\n\t\t// Get the GC details from the GC state in the base summary. This is returned in getBaseGCDetails which is\n\t\t// used to initialize the GC state of all the nodes in the container.\n\t\tthis.baseGCDetailsP = new LazyPromise<IGarbageCollectionDetailsBase>(async () => {\n\t\t\tconst baseSnapshotData = await this.baseSnapshotDataP;\n\t\t\tif (baseSnapshotData?.gcState === undefined) {\n\t\t\t\treturn {};\n\t\t\t}\n\n\t\t\tconst gcNodes: { [id: string]: string[] } = {};\n\t\t\tfor (const [nodeId, nodeData] of Object.entries(baseSnapshotData.gcState.gcNodes)) {\n\t\t\t\tgcNodes[nodeId] = Array.from(nodeData.outboundRoutes);\n\t\t\t}\n\t\t\t// Run GC on the nodes in the base summary to get the routes used in each node in the container.\n\t\t\t// This is an optimization for space (vs performance) wherein we don't need to store the used routes of\n\t\t\t// each node in the summary.\n\t\t\tconst usedRoutes = runGarbageCollection(gcNodes, [\"/\"]).referencedNodeIds;\n\n\t\t\treturn { gcData: { gcNodes }, usedRoutes };\n\t\t});\n\n\t\t// Log all the GC options and the state determined by the garbage collector.\n\t\t// This is useful even for interactive clients since they track unreferenced nodes and log errors.\n\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\teventName: \"GarbageCollectorLoaded\",\n\t\t\tgcConfigs: JSON.stringify(this.configs),\n\t\t\tgcOptions: JSON.stringify(createParams.gcOptions),\n\t\t\t...createParams.createContainerMetadata,\n\t\t});\n\t}\n\n\t/**\n\t * Called during container initialization. Initializes the tombstone and deleted nodes state from the base snapshot.\n\t * Also, initializes the GC state including unreferenced nodes tracking if a current reference timestamp exists.\n\t * Note that if there is any GC state in the base snapshot, then there will definitely be a reference timestamp\n\t * to work with - The GC state would have been generated using a timestamp which is part of the snapshot.\n\t */\n\tpublic async initializeBaseState(): Promise<void> {\n\t\tconst baseSnapshotData = await this.baseSnapshotDataP;\n\t\t/**\n\t\t * The base snapshot data will not be present if the container is loaded from:\n\t\t * 1. The first summary created by the detached container.\n\t\t * 2. A summary that was generated with GC disabled.\n\t\t * 3. A summary that was generated before GC even existed.\n\t\t */\n\t\tif (baseSnapshotData === undefined) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Initialize the deleted nodes from the snapshot. This is done irrespective of whether sweep is enabled or not\n\t\t// to identify deleted nodes' usage.\n\t\tif (baseSnapshotData.deletedNodes !== undefined) {\n\t\t\tthis.deletedNodes = new Set(baseSnapshotData.deletedNodes);\n\t\t}\n\n\t\t// If running in tombstone mode, initialize the tombstone state from the snapshot. Also, notify the runtime of\n\t\t// tombstone routes.\n\t\tif (this.configs.tombstoneMode && baseSnapshotData.tombstones !== undefined) {\n\t\t\t// Create a copy since we are writing from a source we don't control\n\t\t\tthis.tombstones = Array.from(baseSnapshotData.tombstones);\n\t\t\tthis.runtime.updateTombstonedRoutes(this.tombstones);\n\t\t}\n\n\t\tawait this.initializeOrUpdateGCState();\n\t}\n\n\t/**\n\t * Initialize the GC state if not already initialized. If GC state is already initialized, update the unreferenced\n\t * state tracking as per the current reference timestamp.\n\t */\n\tprivate async initializeOrUpdateGCState() {\n\t\tconst currentReferenceTimestampMs = this.runtime.getCurrentReferenceTimestampMs();\n\t\tif (currentReferenceTimestampMs === undefined) {\n\t\t\treturn;\n\t\t}\n\n\t\t// If the GC state hasn't been initialized yet, initialize it and return.\n\t\tif (this.gcDataFromLastRun === undefined) {\n\t\t\tawait this.initializeGCStateFromBaseSnapshotP;\n\t\t\treturn;\n\t\t}\n\n\t\t// If the GC state has been initialized, update the tracking of unreferenced nodes as per the current\n\t\t// reference timestamp.\n\t\tfor (const [, nodeStateTracker] of this.unreferencedNodesState) {\n\t\t\tnodeStateTracker.updateTracking(currentReferenceTimestampMs);\n\t\t}\n\t}\n\n\t/**\n\t * Called when the connection state of the runtime changes, i.e., it connects or disconnects. GC subscribes to this\n\t * to initialize or update the unreference state tracking.\n\t * @param connected - Whether the runtime connected / disconnected.\n\t * @param clientId - The clientId of this runtime.\n\t */\n\tpublic setConnectionState(connected: boolean, clientId?: string | undefined): void {\n\t\t/**\n\t\t * When the client connects (or reconnects), attempt to initialize or update the GC state. This will keep\n\t\t * the unreferenced state tracking updated as per the reference timestamp at the time of connection.\n\t\t *\n\t\t * During GC initialization and during connections in read mode, it is possible that either no ops are\n\t\t * processed or only trailing ops are processed. This means that the GC state is not initialized or initialized\n\t\t * with an older reference timestamp. So, doing this on every connection will keep the unreferenced state\n\t\t * tracking up-to-date.\n\t\t */\n\t\tif (connected && this.configs.shouldRunGC) {\n\t\t\tthis.initializeOrUpdateGCState().catch((error) => {\n\t\t\t\tthis.mc.logger.sendErrorEvent(\n\t\t\t\t\t{\n\t\t\t\t\t\teventName: \"GCInitializationOrUpdateFailed\",\n\t\t\t\t\t\tgcConfigs: JSON.stringify(this.configs),\n\t\t\t\t\t},\n\t\t\t\t\terror,\n\t\t\t\t);\n\t\t\t});\n\t\t}\n\t}\n\n\t/**\n\t * Returns a the GC details generated from the base summary. This is used to initialize the GC state of the nodes\n\t * in the container.\n\t */\n\tpublic async getBaseGCDetails(): Promise<IGarbageCollectionDetailsBase> {\n\t\treturn this.baseGCDetailsP;\n\t}\n\n\t/**\n\t * Runs garbage collection and updates the reference / used state of the nodes in the container.\n\t * @returns stats of the GC run or undefined if GC did not run.\n\t */\n\tpublic async collectGarbage(\n\t\toptions: {\n\t\t\t/** Logger to use for logging GC events */\n\t\t\tlogger?: ITelemetryLoggerExt;\n\t\t\t/** True to run GC sweep phase after the mark phase */\n\t\t\trunSweep?: boolean;\n\t\t\t/** True to generate full GC data */\n\t\t\tfullGC?: boolean;\n\t\t},\n\t\ttelemetryContext?: ITelemetryContext,\n\t): Promise<IGCStats | undefined> {\n\t\tconst fullGC =\n\t\t\toptions.fullGC ??\n\t\t\t(this.configs.runFullGC === true || this.summaryStateTracker.doesSummaryStateNeedReset);\n\n\t\t// Add the options that are used to run GC to the telemetry context.\n\t\ttelemetryContext?.setMultiple(\"fluid_GC\", \"Options\", {\n\t\t\tfullGC,\n\t\t\trunSweep: options.runSweep,\n\t\t});\n\n\t\tconst logger = options.logger\n\t\t\t? createChildLogger({\n\t\t\t\t\tlogger: options.logger,\n\t\t\t\t\tproperties: {\n\t\t\t\t\t\tall: { completedGCRuns: () => this.completedRuns },\n\t\t\t\t\t},\n\t\t\t })\n\t\t\t: this.mc.logger;\n\n\t\t/**\n\t\t * If there is no current reference timestamp, skip running GC. We need the current timestamp to track\n\t\t * how long objects have been unreferenced and if they should be deleted.\n\t\t *\n\t\t * Note that the only scenario where GC is called and there is no reference timestamp is when no ops have ever\n\t\t * been processed for this container and it is in read mode. In this scenario, there is no point in running GC\n\t\t * anyway because references in the container do not change without any ops, i.e., there is nothing to collect.\n\t\t */\n\t\tconst currentReferenceTimestampMs = this.runtime.getCurrentReferenceTimestampMs();\n\t\tif (currentReferenceTimestampMs === undefined) {\n\t\t\t// Log an event so we can evaluate how often we run into this scenario.\n\t\t\tlogger.sendErrorEvent({\n\t\t\t\teventName: \"CollectGarbageCalledWithoutTimestamp\",\n\t\t\t\tgcConfigs: JSON.stringify(this.configs),\n\t\t\t});\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn PerformanceEvent.timedExecAsync(\n\t\t\tlogger,\n\t\t\t{ eventName: \"GarbageCollection\" },\n\t\t\tasync (event) => {\n\t\t\t\t/** Pre-GC steps */\n\t\t\t\t// Ensure that state has been initialized from the base snapshot data.\n\t\t\t\tawait this.initializeGCStateFromBaseSnapshotP;\n\t\t\t\t// Let the runtime update its pending state before GC runs.\n\t\t\t\tawait this.runtime.updateStateBeforeGC();\n\n\t\t\t\t/** GC step */\n\t\t\t\tconst gcStats = await this.runGC(fullGC, currentReferenceTimestampMs, logger);\n\t\t\t\tevent.end({\n\t\t\t\t\t...gcStats,\n\t\t\t\t\tdetails: {\n\t\t\t\t\t\ttimestamp: currentReferenceTimestampMs,\n\t\t\t\t\t\tsweep: this.configs.shouldRunSweep,\n\t\t\t\t\t\ttombstone: this.configs.throwOnTombstoneLoad,\n\t\t\t\t\t},\n\t\t\t\t});\n\n\t\t\t\t/** Post-GC steps */\n\t\t\t\t// Log pending unreferenced events such as a node being used after inactive. This is done after GC runs and\n\t\t\t\t// updates its state so that we don't send false positives based on intermediate state. For example, we may get\n\t\t\t\t// reference to an unreferenced node from another unreferenced node which means the node wasn't revived.\n\t\t\t\tawait this.telemetryTracker.logPendingEvents(logger);\n\t\t\t\t// Update the state of summary state tracker from this run's stats.\n\t\t\t\tthis.summaryStateTracker.updateStateFromGCRunStats(gcStats);\n\t\t\t\tthis.newReferencesSinceLastRun.clear();\n\t\t\t\tthis.completedRuns++;\n\n\t\t\t\treturn gcStats;\n\t\t\t},\n\t\t\t{ end: true, cancel: \"error\" },\n\t\t);\n\t}\n\n\t/**\n\t * Runs garbage collection. It does the following:\n\t *\n\t * 1. It generates / analyzes the runtime's reference graph.\n\t *\n\t * 2. Generates mark phase stats.\n\t *\n\t * 3. Runs Mark phase.\n\t *\n\t * 4. Runs Sweep phase.\n\t *\n\t * 5. Generates sweep phase stats.\n\t */\n\tprivate async runGC(\n\t\tfullGC: boolean,\n\t\tcurrentReferenceTimestampMs: number,\n\t\tlogger: ITelemetryLoggerExt,\n\t): Promise<IGCStats> {\n\t\t// 1. Generate / analyze the runtime's reference graph.\n\t\t// Get the reference graph (gcData) and run GC algorithm to get referenced / unreferenced nodes.\n\t\tconst gcData = await this.runtime.getGCData(fullGC);\n\t\tconst gcResult = runGarbageCollection(gcData.gcNodes, [\"/\"]);\n\t\t// Get all referenced nodes - References in this run + references between the previous and current runs.\n\t\tconst allReferencedNodeIds =\n\t\t\tthis.findAllNodesReferencedBetweenGCs(gcData, this.gcDataFromLastRun, logger) ??\n\t\t\tgcResult.referencedNodeIds;\n\n\t\t// 2. Get the mark phase stats based on the previous / current GC state.\n\t\t// This is done before running mark phase because we need the previous GC state before it is updated.\n\t\tconst markPhaseStats = this.getMarkPhaseStats(gcResult);\n\n\t\t// 3. Run the Mark phase.\n\t\t// It will mark nodes as referenced / unreferenced and return lists of tombstone-ready and sweep-ready nodes.\n\t\tconst { tombstoneReadyNodeIds, sweepReadyNodeIds } = this.runMarkPhase(\n\t\t\tgcResult,\n\t\t\tallReferencedNodeIds,\n\t\t\tcurrentReferenceTimestampMs,\n\t\t);\n\n\t\t// 4. Run the Sweep phase.\n\t\t// It will tombstone any tombstone-ready nodes, and initiate the deletion of sweep-ready nodes by sending a\n\t\t// sweep op. All clients, including this one, will delete these nodes once it processes the op.\n\t\tthis.runSweepPhase(gcResult, tombstoneReadyNodeIds, sweepReadyNodeIds);\n\n\t\tthis.gcDataFromLastRun = cloneGCData(gcData);\n\n\t\t// 5. Get the sweep phase stats.\n\t\tconst sweepPhaseStats = this.getSweepPhaseStats(\n\t\t\tthis.deletedNodes,\n\t\t\tsweepReadyNodeIds,\n\t\t\tmarkPhaseStats,\n\t\t);\n\n\t\treturn { ...markPhaseStats, ...sweepPhaseStats };\n\t}\n\n\t/**\n\t * Runs the GC Mark phase. It does the following:\n\t *\n\t * 1. Marks all referenced nodes in this run by clearing tracking for them.\n\t *\n\t * 2. Marks unreferenced nodes in this run by starting tracking for them.\n\t *\n\t * 3. Calls the runtime to update nodes that were marked referenced.\n\t *\n\t * @param gcResult - The result of the GC run on the gcData.\n\t * @param allReferencedNodeIds - Nodes referenced in this GC run + referenced between previous and current GC run.\n\t * @param currentReferenceTimestampMs - The timestamp to be used for unreferenced nodes' timestamp.\n\t * @returns The sets of tombstone-ready and sweep-ready nodes, i.e., nodes that ready to be tombstoned or deleted.\n\t */\n\tprivate runMarkPhase(\n\t\tgcResult: IGCResult,\n\t\tallReferencedNodeIds: string[],\n\t\tcurrentReferenceTimestampMs: number,\n\t): { tombstoneReadyNodeIds: Set<string>; sweepReadyNodeIds: Set<string> } {\n\t\t// 1. Marks all referenced nodes by clearing their unreferenced tracker, if any.\n\t\tfor (const nodeId of allReferencedNodeIds) {\n\t\t\tconst nodeStateTracker = this.unreferencedNodesState.get(nodeId);\n\t\t\tif (nodeStateTracker !== undefined) {\n\t\t\t\t// Stop tracking so as to clear out any running timers.\n\t\t\t\tnodeStateTracker.stopTracking();\n\t\t\t\t// Delete the node as we don't need to track it any more.\n\t\t\t\tthis.unreferencedNodesState.delete(nodeId);\n\t\t\t}\n\t\t}\n\n\t\t// 2. Mark unreferenced nodes in this run by starting unreferenced tracking for them.\n\t\tconst tombstoneReadyNodeIds: Set<string> = new Set();\n\t\tconst sweepReadyNodeIds: Set<string> = new Set();\n\t\tfor (const nodeId of gcResult.deletedNodeIds) {\n\t\t\tconst nodeStateTracker = this.unreferencedNodesState.get(nodeId);\n\t\t\tif (nodeStateTracker === undefined) {\n\t\t\t\tthis.unreferencedNodesState.set(\n\t\t\t\t\tnodeId,\n\t\t\t\t\tnew UnreferencedStateTracker(\n\t\t\t\t\t\tcurrentReferenceTimestampMs,\n\t\t\t\t\t\tthis.configs.inactiveTimeoutMs,\n\t\t\t\t\t\tcurrentReferenceTimestampMs,\n\t\t\t\t\t\tthis.configs.sweepTimeoutMs,\n\t\t\t\t\t\tthis.configs.sweepGracePeriodMs,\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\t// If a node was already unreferenced, update its tracking information. Since the current reference time\n\t\t\t\t// is from the ops seen, this will ensure that we keep updating unreferenced state as time moves forward.\n\t\t\t\tnodeStateTracker.updateTracking(currentReferenceTimestampMs);\n\n\t\t\t\t// If a node is tombstone or sweep-ready, store it so it can be returned.\n\t\t\t\tif (nodeStateTracker.state === UnreferencedState.TombstoneReady) {\n\t\t\t\t\ttombstoneReadyNodeIds.add(nodeId);\n\t\t\t\t}\n\t\t\t\tif (nodeStateTracker.state === UnreferencedState.SweepReady) {\n\t\t\t\t\tsweepReadyNodeIds.add(nodeId);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// 3. Call the runtime to update referenced nodes in this run.\n\t\tthis.runtime.updateUsedRoutes(gcResult.referencedNodeIds);\n\n\t\treturn { tombstoneReadyNodeIds, sweepReadyNodeIds };\n\t}\n\n\t/**\n\t * Runs the GC Sweep phase. It does the following:\n\t *\n\t * 1. Marks tombstone-ready nodes as tombstones.\n\t *\n\t * 2. Sends a sweep op to delete nodes that are sweep-ready. Once the op is ack'd, these nodes will be deleted.\n\t *\n\t * @param gcResult - The result of the GC run on the gcData.\n\t * @param tombstoneReadyNodes - List of nodes that are tombstone-ready.\n\t * @param sweepReadyNodes - List of nodes that are sweep-ready.\n\t */\n\tprivate runSweepPhase(\n\t\tgcResult: IGCResult,\n\t\ttombstoneReadyNodes: Set<string>,\n\t\tsweepReadyNodes: Set<string>,\n\t) {\n\t\t/**\n\t\t * Under \"Test Mode\", unreferenced nodes are immediately deleted without waiting for them to be sweep-ready.\n\t\t *\n\t\t * Otherwise, depending on how long it's been since the node was unreferenced, it will either be\n\t\t * marked as Tombstone, or deleted by Sweep.\n\t\t */\n\n\t\tif (this.configs.testMode) {\n\t\t\t// If we are running in GC test mode, unreferenced nodes (gcResult.deletedNodeIds) are deleted.\n\t\t\tthis.runtime.updateUnusedRoutes(gcResult.deletedNodeIds);\n\t\t\treturn;\n\t\t}\n\n\t\t// If sweep is disabled, we'll tombstone both tombstone-ready and sweep-ready nodes.\n\t\t// This is important because a container may never load during a node's Sweep Grace Period,\n\t\t// so that node would directly become sweep-ready skipping over tombstone-ready state,\n\t\t// but should be Tombstoned since Sweep is disabled.\n\t\tconst { nodesToTombstone, nodesToDelete } = this.configs.shouldRunSweep\n\t\t\t? {\n\t\t\t\t\tnodesToTombstone: [...tombstoneReadyNodes],\n\t\t\t\t\tnodesToDelete: [...sweepReadyNodes],\n\t\t\t }\n\t\t\t: {\n\t\t\t\t\tnodesToTombstone: [...tombstoneReadyNodes, ...sweepReadyNodes],\n\t\t\t\t\tnodesToDelete: [],\n\t\t\t };\n\n\t\tif (this.configs.tombstoneMode) {\n\t\t\tthis.tombstones = nodesToTombstone;\n\t\t\t// If we are running in GC tombstone mode, update tombstoned routes.\n\t\t\tthis.runtime.updateTombstonedRoutes(this.tombstones);\n\t\t}\n\n\t\tif (this.configs.shouldRunSweep && nodesToDelete.length > 0) {\n\t\t\t// Do not send DDS node ids in the GC op. This is an optimization to reduce its size. Since GC applies to\n\t\t\t// to data store only, all its DDSes are deleted along with it. The DDS ids will be retrieved from the\n\t\t\t// local state when processing the op.\n\t\t\tconst sweepReadyDSAndBlobs = nodesToDelete.filter((nodeId) => {\n\t\t\t\tconst nodeType = this.runtime.getNodeType(nodeId);\n\t\t\t\treturn nodeType === GCNodeType.DataStore || nodeType === GCNodeType.Blob;\n\t\t\t});\n\t\t\tconst contents: GarbageCollectionMessage = {\n\t\t\t\ttype: GarbageCollectionMessageType.Sweep,\n\t\t\t\tdeletedNodeIds: sweepReadyDSAndBlobs,\n\t\t\t};\n\n\t\t\t// Its fine for older clients to ignore this op because it doesn't have any functional impact. This op\n\t\t\t// is an optimization to ensure that all clients are in sync when it comes to deleted nodes to prevent their\n\t\t\t// accidental usage. The clients will sync without the delete op too but it may take longer.\n\t\t\tconst containerGCMessage: ContainerRuntimeGCMessage = {\n\t\t\t\ttype: ContainerMessageType.GC,\n\t\t\t\tcontents,\n\t\t\t\tcompatDetails: { behavior: \"Ignore\" },\n\t\t\t};\n\t\t\tthis.submitMessage(containerGCMessage);\n\t\t\treturn;\n\t\t}\n\t}\n\n\t/**\n\t * Since GC runs periodically, the GC data that is generated only tells us the state of the world at that point in\n\t * time. There can be nodes that were referenced in between two runs and their unreferenced state needs to be\n\t * updated. For example, in the following scenarios not updating the unreferenced timestamp can lead to deletion of\n\t * these objects while there can be in-memory referenced to it:\n\t * 1. A node transitions from `unreferenced -> referenced -> unreferenced` between two runs. When the reference is\n\t * added, the object may have been accessed and in-memory reference to it added.\n\t * 2. A reference is added from one unreferenced node to one or more unreferenced nodes. Even though the node[s] were\n\t * unreferenced, they could have been accessed and in-memory reference to them added.\n\t *\n\t * This function identifies nodes that were referenced since the last run.\n\t * If these nodes are currently unreferenced, they will be assigned new unreferenced state by the current run.\n\t *\n\t * @returns A list of all nodes referenced from the last local summary until now.\n\t */\n\tprivate findAllNodesReferencedBetweenGCs(\n\t\tcurrentGCData: IGarbageCollectionData,\n\t\tpreviousGCData: IGarbageCollectionData | undefined,\n\t\tlogger: ITelemetryLoggerExt,\n\t): string[] | undefined {\n\t\t// If we haven't run GC before there is nothing to do.\n\t\t// No previousGCData, means nothing is unreferenced, and there are no reference state trackers to clear\n\t\tif (previousGCData === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\t/**\n\t\t * If there are references that were not explicitly notified to GC, log an error because this should never happen.\n\t\t * If it does, this may result in the unreferenced timestamps of these nodes not updated when they were referenced.\n\t\t */\n\t\tthis.telemetryTracker.logIfMissingExplicitReferences(\n\t\t\tcurrentGCData,\n\t\t\tpreviousGCData,\n\t\t\tthis.newReferencesSinceLastRun,\n\t\t\tlogger,\n\t\t);\n\n\t\t// No references were added since the last run so we don't have to update reference states of any unreferenced\n\t\t// nodes. There is no in between state at this point.\n\t\tif (this.newReferencesSinceLastRun.size === 0) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\t/**\n\t\t * Generate a super set of the GC data that contains the nodes and edges from last run, plus any new node and\n\t\t * edges that have been added since then. To do this, combine the GC data from the last run and the current\n\t\t * run, and then add the references since last run.\n\t\t *\n\t\t * Note on why we need to combine the data from previous run, current run and all references in between -\n\t\t * 1. We need data from last run because some of its references may have been deleted since then. If those\n\t\t * references added new outbound references before they were deleted, we need to detect them.\n\t\t *\n\t\t * 2. We need new outbound references since last run because some of them may have been deleted later. If those\n\t\t * references added new outbound references before they were deleted, we need to detect them.\n\t\t *\n\t\t * 3. We need data from the current run because currently we may not detect when DDSes are referenced:\n\t\t * - We don't require DDSes handles to be stored in a referenced DDS.\n\t\t * - A new data store may have \"root\" DDSes already created and we don't detect them today.\n\t\t */\n\t\tconst gcDataSuperSet = concatGarbageCollectionData(previousGCData, currentGCData);\n\t\tconst newOutboundRoutesSinceLastRun: string[] = [];\n\t\tthis.newReferencesSinceLastRun.forEach((outboundRoutes: string[], sourceNodeId: string) => {\n\t\t\tif (gcDataSuperSet.gcNodes[sourceNodeId] === undefined) {\n\t\t\t\tgcDataSuperSet.gcNodes[sourceNodeId] = outboundRoutes;\n\t\t\t} else {\n\t\t\t\tgcDataSuperSet.gcNodes[sourceNodeId].push(...outboundRoutes);\n\t\t\t}\n\t\t\tnewOutboundRoutesSinceLastRun.push(...outboundRoutes);\n\t\t});\n\n\t\t/**\n\t\t * Run GC on the above reference graph starting with root and all new outbound routes. This will generate a\n\t\t * list of all nodes that could have been referenced since the last run. If any of these nodes are unreferenced,\n\t\t * unreferenced, stop tracking them and remove from unreferenced list.\n\t\t * Note that some of these nodes may be unreferenced now and if so, the current run will mark them as\n\t\t * unreferenced and add unreferenced state.\n\t\t */\n\t\tconst gcResult = runGarbageCollection(gcDataSuperSet.gcNodes, [\n\t\t\t\"/\",\n\t\t\t...newOutboundRoutesSinceLastRun,\n\t\t]);\n\t\treturn gcResult.referencedNodeIds;\n\t}\n\n\t/**\n\t * Summarizes the GC data and returns it as a summary tree.\n\t * We current write the entire GC state in a single blob. This can be modified later to write multiple\n\t * blobs. All the blob keys should start with `gcBlobPrefix`.\n\t */\n\tpublic summarize(\n\t\tfullTree: boolean,\n\t\ttrackState: boolean,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): ISummarizeResult | undefined {\n\t\tif (!this.configs.shouldRunGC || this.gcDataFromLastRun === undefined) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst gcState: IGarbageCollectionState = { gcNodes: {} };\n\t\tfor (const [nodeId, outboundRoutes] of Object.entries(this.gcDataFromLastRun.gcNodes)) {\n\t\t\tgcState.gcNodes[nodeId] = {\n\t\t\t\toutboundRoutes,\n\t\t\t\tunreferencedTimestampMs:\n\t\t\t\t\tthis.unreferencedNodesState.get(nodeId)?.unreferencedTimestampMs,\n\t\t\t};\n\t\t}\n\n\t\treturn this.summaryStateTracker.summarize(\n\t\t\tfullTree,\n\t\t\ttrackState,\n\t\t\tgcState,\n\t\t\tthis.deletedNodes,\n\t\t\tthis.tombstones,\n\t\t);\n\t}\n\n\tpublic getMetadata(): IGCMetadata {\n\t\treturn {\n\t\t\t/**\n\t\t\t * If GC is enabled, the GC data is written using the GC version in effect and that is the gcFeature that goes\n\t\t\t * into the metadata blob. If GC is disabled, the gcFeature is 0.\n\t\t\t */\n\t\t\tgcFeature: this.configs.gcEnabled ? this.configs.gcVersionInEffect : 0,\n\t\t\tgcFeatureMatrix: this.configs.persistedGcFeatureMatrix,\n\t\t\tsessionExpiryTimeoutMs: this.configs.sessionExpiryTimeoutMs,\n\t\t\tsweepEnabled: false, // DEPRECATED - to be removed\n\t\t\tsweepTimeoutMs: this.configs.sweepTimeoutMs,\n\t\t};\n\t}\n\n\t/**\n\t * Called to refresh the latest summary state. This happens when either a pending summary is acked.\n\t */\n\tpublic async refreshLatestSummary(result: IRefreshSummaryResult): Promise<void> {\n\t\treturn this.summaryStateTracker.refreshLatestSummary(result);\n\t}\n\n\t/**\n\t * Process a GC message.\n\t * @param message - The GC message from the container runtime.\n\t * @param local - Whether it was send by this client.\n\t */\n\tpublic processMessage(message: ContainerRuntimeGCMessage, local: boolean) {\n\t\tswitch (message.contents.type) {\n\t\t\tcase \"Sweep\": {\n\t\t\t\t// Delete the nodes whose ids are present in the contents.\n\t\t\t\tthis.deleteSweepReadyNodes(message.contents.deletedNodeIds);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tif (\n\t\t\t\t\t!compatBehaviorAllowsGCMessageType(\n\t\t\t\t\t\tmessage.contents.type,\n\t\t\t\t\t\tmessage.compatDetails?.behavior,\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\tconst error = DataProcessingError.create(\n\t\t\t\t\t\t`Garbage collection message of unknown type ${message.contents.type}`,\n\t\t\t\t\t\t\"processMessage\",\n\t\t\t\t\t);\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Delete nodes that are sweep-ready. Call the runtime to delete these nodes and clear the unreferenced state\n\t * tracking for nodes that are actually deleted by the runtime.\n\t * @param sweepReadyNodeIds - The ids of nodes that are ready to be deleted.\n\t */\n\tprivate deleteSweepReadyNodes(sweepReadyNodeIds: readonly string[]) {\n\t\t// Use a set for lookup because its much faster than array or map.\n\t\tconst sweepReadyNodesSet: Set<string> = new Set(sweepReadyNodeIds);\n\n\t\t// The ids in the sweep-ready nodes do not contain DDS node ids. This is an optimization to reduce the size\n\t\t// of the GC op. Since GC applies to data store only, all its DDSes are deleted along with it. So, get the\n\t\t// DDS nodes ID from the unreferenced nodes state.\n\t\tconst allSweepReadyNodeIds = Array.from(sweepReadyNodeIds);\n\t\tfor (const [id] of this.unreferencedNodesState) {\n\t\t\t// Ignore data store nodes since they would already be in the list.\n\t\t\tconst pathParts = id.split(\"/\");\n\t\t\tif (pathParts.length <= 2) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// Get the data store id part. Note that this may include blobs but that's okay since the part would just\n\t\t\t// be \"_blobs\" and it won't be found.\n\t\t\tconst dsId = `/${pathParts[1]}`;\n\t\t\tif (sweepReadyNodesSet.has(dsId)) {\n\t\t\t\tallSweepReadyNodeIds.push(id);\n\t\t\t}\n\t\t}\n\t\tconst deletedNodeIds = this.runtime.deleteSweepReadyNodes(allSweepReadyNodeIds);\n\n\t\t// Clear unreferenced state tracking for deleted nodes.\n\t\tfor (const nodeId of deletedNodeIds) {\n\t\t\tconst nodeStateTracker = this.unreferencedNodesState.get(nodeId);\n\t\t\tif (nodeStateTracker !== undefined) {\n\t\t\t\t// Stop tracking so as to clear out any running timers.\n\t\t\t\tnodeStateTracker.stopTracking();\n\t\t\t\t// Delete the node as we don't need to track it any more.\n\t\t\t\tthis.unreferencedNodesState.delete(nodeId);\n\t\t\t}\n\t\t\tthis.deletedNodes.add(nodeId);\n\t\t}\n\t}\n\n\t/**\n\t * Called when a node with the given id is updated. If the node is inactive or tombstoned, this will log an error\n\t * or throw an error if failing on incorrect usage is configured.\n\t * @param nodePath - The path of the node that changed.\n\t * @param reason - Whether the node was loaded or changed.\n\t * @param timestampMs - The timestamp when the node changed.\n\t * @param packagePath - The package path of the node. This may not be available if the node hasn't been loaded yet.\n\t * @param request - The original request for loads to preserve it in telemetry.\n\t * @param requestHeaders - If the node was loaded via request path, the headers in the request.\n\t */\n\tpublic nodeUpdated(\n\t\tnodePath: string,\n\t\treason: \"Loaded\" | \"Changed\",\n\t\ttimestampMs?: number,\n\t\tpackagePath?: readonly string[],\n\t\trequest?: IRequest,\n\t\theaderData?: RuntimeHeaderData,\n\t) {\n\t\tif (!this.configs.shouldRunGC) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst isTombstoned = this.tombstones.includes(nodePath);\n\n\t\t// This will log if appropriate\n\t\tthis.telemetryTracker.nodeUsed({\n\t\t\tid: nodePath,\n\t\t\tusageType: reason,\n\t\t\tcurrentReferenceTimestampMs:\n\t\t\t\ttimestampMs ?? this.runtime.getCurrentReferenceTimestampMs(),\n\t\t\tpackagePath,\n\t\t\tcompletedGCRuns: this.completedRuns,\n\t\t\tisTombstoned,\n\t\t\tlastSummaryTime: this.getLastSummaryTimestampMs(),\n\t\t\theaders: headerData,\n\t\t});\n\n\t\tconst nodeType = this.runtime.getNodeType(nodePath);\n\n\t\t// Unless this is a Loaded event for a Blob or DataStore, we're done after telemetry tracking\n\t\tif (reason !== \"Loaded\" || ![GCNodeType.Blob, GCNodeType.DataStore].includes(nodeType)) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst errorRequest: IRequest = request ?? { url: nodePath };\n\t\t// If the object is tombstoned and tombstone enforcement is configured, throw an error.\n\t\tif (isTombstoned && this.throwOnTombstoneLoad && headerData?.allowTombstone !== true) {\n\t\t\t// The requested data store is removed by gc. Create a 404 gc response exception.\n\t\t\tthrow responseToException(\n\t\t\t\tcreateResponseError(404, `${nodeType} was tombstoned`, errorRequest, {\n\t\t\t\t\t[TombstoneResponseHeaderKey]: true,\n\t\t\t\t}),\n\t\t\t\terrorRequest,\n\t\t\t);\n\t\t}\n\n\t\t// If the object is inactive and inactive enforcement is configured, throw an error.\n\t\tif (this.unreferencedNodesState.get(nodePath)?.state === \"Inactive\") {\n\t\t\tconst shouldThrowOnInactiveLoad =\n\t\t\t\t!this.isSummarizerClient &&\n\t\t\t\tthis.configs.throwOnInactiveLoad === true &&\n\t\t\t\theaderData?.allowInactive !== true;\n\t\t\tif (shouldThrowOnInactiveLoad) {\n\t\t\t\tthrow responseToException(\n\t\t\t\t\tcreateResponseError(404, `${nodeType} is inactive`, errorRequest, {\n\t\t\t\t\t\t[InactiveResponseHeaderKey]: true,\n\t\t\t\t\t}),\n\t\t\t\t\terrorRequest,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Called when an outbound reference is added to a node. This is used to identify all nodes that have been\n\t * referenced between summaries so that their unreferenced timestamp can be reset.\n\t *\n\t * @param fromNodePath - The node from which the reference is added.\n\t * @param toNodePath - The node to which the reference is added.\n\t */\n\tpublic addedOutboundReference(fromNodePath: string, toNodePath: string) {\n\t\tif (!this.configs.shouldRunGC) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst outboundRoutes = this.newReferencesSinceLastRun.get(fromNodePath) ?? [];\n\t\toutboundRoutes.push(toNodePath);\n\t\tthis.newReferencesSinceLastRun.set(fromNodePath, outboundRoutes);\n\n\t\tthis.telemetryTracker.nodeUsed({\n\t\t\tid: toNodePath,\n\t\t\tusageType: \"Revived\",\n\t\t\tcurrentReferenceTimestampMs: this.runtime.getCurrentReferenceTimestampMs(),\n\t\t\tpackagePath: undefined,\n\t\t\tcompletedGCRuns: this.completedRuns,\n\t\t\tisTombstoned: this.tombstones.includes(toNodePath),\n\t\t\tlastSummaryTime: this.getLastSummaryTimestampMs(),\n\t\t\tfromId: fromNodePath,\n\t\t});\n\t}\n\n\t/**\n\t * Returns whether a node with the given path has been deleted or not. This can be used by the runtime to identify\n\t * cases where objects are used after they are deleted and throw / log errors accordingly.\n\t */\n\tpublic isNodeDeleted(nodePath: string): boolean {\n\t\treturn this.deletedNodes.has(nodePath);\n\t}\n\n\tpublic dispose(): void {\n\t\tthis.sessionExpiryTimer?.clear();\n\t\tthis.sessionExpiryTimer = undefined;\n\t}\n\n\t/**\n\t * Generates the stats of a garbage collection mark phase run.\n\t * @param gcResult - The result of the current GC run.\n\t * @returns the stats of the mark phase run.\n\t */\n\tprivate getMarkPhaseStats(gcResult: IGCResult): IMarkPhaseStats {\n\t\tconst markPhaseStats: IMarkPhaseStats = {\n\t\t\tnodeCount: 0,\n\t\t\tdataStoreCount: 0,\n\t\t\tattachmentBlobCount: 0,\n\t\t\tunrefNodeCount: 0,\n\t\t\tunrefDataStoreCount: 0,\n\t\t\tunrefAttachmentBlobCount: 0,\n\t\t\tupdatedNodeCount: 0,\n\t\t\tupdatedDataStoreCount: 0,\n\t\t\tupdatedAttachmentBlobCount: 0,\n\t\t};\n\n\t\tconst updateNodeStats = (nodeId: string, referenced: boolean) => {\n\t\t\tmarkPhaseStats.nodeCount++;\n\t\t\t// If there is no previous GC data, every node's state is generated and is considered as updated.\n\t\t\t// Otherwise, find out if any node went from referenced to unreferenced or vice-versa.\n\t\t\tconst stateUpdated =\n\t\t\t\tthis.gcDataFromLastRun === undefined ||\n\t\t\t\tthis.unreferencedNodesState.has(nodeId) === referenced;\n\t\t\tif (stateUpdated) {\n\t\t\t\tmarkPhaseStats.updatedNodeCount++;\n\t\t\t}\n\t\t\tif (!referenced) {\n\t\t\t\tmarkPhaseStats.unrefNodeCount++;\n\t\t\t}\n\n\t\t\tif (this.runtime.getNodeType(nodeId) === GCNodeType.DataStore) {\n\t\t\t\tmarkPhaseStats.dataStoreCount++;\n\t\t\t\tif (stateUpdated) {\n\t\t\t\t\tmarkPhaseStats.updatedDataStoreCount++;\n\t\t\t\t}\n\t\t\t\tif (!referenced) {\n\t\t\t\t\tmarkPhaseStats.unrefDataStoreCount++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (this.runtime.getNodeType(nodeId) === GCNodeType.Blob) {\n\t\t\t\tmarkPhaseStats.attachmentBlobCount++;\n\t\t\t\tif (stateUpdated) {\n\t\t\t\t\tmarkPhaseStats.updatedAttachmentBlobCount++;\n\t\t\t\t}\n\t\t\t\tif (!referenced) {\n\t\t\t\t\tmarkPhaseStats.unrefAttachmentBlobCount++;\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tfor (const nodeId of gcResult.referencedNodeIds) {\n\t\t\tupdateNodeStats(nodeId, true /* referenced */);\n\t\t}\n\n\t\tfor (const nodeId of gcResult.deletedNodeIds) {\n\t\t\tupdateNodeStats(nodeId, false /* referenced */);\n\t\t}\n\n\t\treturn markPhaseStats;\n\t}\n\n\t/**\n\t * Generates the stats of a garbage collection sweep phase run.\n\t * @param deletedNodes - The nodes that have been deleted until this run.\n\t * @param sweepReadyNodes - The nodes that are sweep-ready in this GC run.\n\t * @param markPhaseStats - The stats of the mark phase run.\n\t * @returns the stats of the sweep phase run.\n\t */\n\tprivate getSweepPhaseStats(\n\t\tdeletedNodes: Set<string>,\n\t\tsweepReadyNodes: Set<string>,\n\t\tmarkPhaseStats: IMarkPhaseStats,\n\t): ISweepPhaseStats {\n\t\t// Initialize the life time node counts to the mark phase node counts. If sweep is not enabled,\n\t\t// these will be the life time node count for this container.\n\t\tconst sweepPhaseStats: ISweepPhaseStats = {\n\t\t\tlifetimeNodeCount: markPhaseStats.nodeCount,\n\t\t\tlifetimeDataStoreCount: markPhaseStats.dataStoreCount,\n\t\t\tlifetimeAttachmentBlobCount: markPhaseStats.attachmentBlobCount,\n\t\t\tdeletedNodeCount: 0,\n\t\t\tdeletedDataStoreCount: 0,\n\t\t\tdeletedAttachmentBlobCount: 0,\n\t\t};\n\n\t\t// The runtime can't reliably identify the type of deleted nodes. So, get the type here. This should\n\t\t// be good enough because the only types that participate in GC today are data stores, DDSes and blobs.\n\t\tconst getDeletedNodeType = (nodeId: string): GCNodeType => {\n\t\t\tconst pathParts = nodeId.split(\"/\");\n\t\t\tif (pathParts[1] === BlobManager.basePath) {\n\t\t\t\treturn GCNodeType.Blob;\n\t\t\t}\n\t\t\tif (pathParts.length === 2) {\n\t\t\t\treturn GCNodeType.DataStore;\n\t\t\t}\n\t\t\tif (pathParts.length === 3) {\n\t\t\t\treturn GCNodeType.SubDataStore;\n\t\t\t}\n\t\t\treturn GCNodeType.Other;\n\t\t};\n\n\t\tfor (const nodeId of deletedNodes) {\n\t\t\tsweepPhaseStats.deletedNodeCount++;\n\t\t\tconst nodeType = getDeletedNodeType(nodeId);\n\t\t\tif (nodeType === GCNodeType.DataStore) {\n\t\t\t\tsweepPhaseStats.deletedDataStoreCount++;\n\t\t\t} else if (nodeType === GCNodeType.Blob) {\n\t\t\t\tsweepPhaseStats.deletedAttachmentBlobCount++;\n\t\t\t}\n\t\t}\n\n\t\t// If sweep is enabled, the counts from the mark phase stats do not include nodes that have been\n\t\t// deleted in previous runs. So, add the deleted node counts to life time stats.\n\t\tsweepPhaseStats.lifetimeNodeCount += sweepPhaseStats.deletedNodeCount;\n\t\tsweepPhaseStats.lifetimeDataStoreCount += sweepPhaseStats.deletedDataStoreCount;\n\t\tsweepPhaseStats.lifetimeAttachmentBlobCount += sweepPhaseStats.deletedAttachmentBlobCount;\n\n\t\tif (this.configs.shouldRunSweep) {\n\t\t\treturn sweepPhaseStats;\n\t\t}\n\n\t\t// If sweep is not enabled, the current sweep-ready node stats should be added to deleted stats since this\n\t\t// is the final state the node will be in.\n\t\t// If sweep is enabled, this will happen in the run after the GC op round trips back.\n\t\tfor (const nodeId of sweepReadyNodes) {\n\t\t\tsweepPhaseStats.deletedNodeCount++;\n\t\t\tconst nodeType = this.runtime.getNodeType(nodeId);\n\t\t\tif (nodeType === GCNodeType.DataStore) {\n\t\t\t\tsweepPhaseStats.deletedDataStoreCount++;\n\t\t\t} else if (nodeType === GCNodeType.Blob) {\n\t\t\t\tsweepPhaseStats.deletedAttachmentBlobCount++;\n\t\t\t}\n\t\t}\n\t\treturn sweepPhaseStats;\n\t}\n}\n"]}
1
+ {"version":3,"file":"garbageCollection.js","sourceRoot":"","sources":["../../src/gc/garbageCollection.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2DAAwE;AAExE,6EAM6C;AAC7C,iEAAyF;AACzF,qEAQyC;AACzC,gDAA6C;AAC7C,0DAI6B;AAC7B,oCAAqD;AACrD,kDAAkF;AAElF,2CAAgD;AAChD,mDAcyB;AACzB,2CAKqB;AACrB,2EAAmE;AAEnE,mEAAgE;AAChE,6EAAwE;AACxE,+CAAmD;AAEnD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAa,gBAAgB;IACrB,MAAM,CAAC,MA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C5C,IAAI,QAAQ,KAAK,0BAAU,CAAC,SAAS,EAAE;gBACtC,eAAe,CAAC,qBAAqB,EAAE,CAAC;aACxC;iBAAM,IAAI,QAAQ,KAAK,0BAAU,CAAC,IAAI,EAAE;gBACxC,eAAe,CAAC,0BAA0B,EAAE,CAAC;aAC7C;SACD;QAED,gGAAgG;QAChG,gFAAgF;QAChF,eAAe,CAAC,iBAAiB,IAAI,eAAe,CAAC,gBAAgB,CAAC;QACtE,eAAe,CAAC,sBAAsB,IAAI,eAAe,CAAC,qBAAqB,CAAC;QAChF,eAAe,CAAC,2BAA2B,IAAI,eAAe,CAAC,0BAA0B,CAAC;QAE1F,IAAI,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE;YAChC,OAAO,eAAe,CAAC;SACvB;QAED,0GAA0G;QAC1G,0CAA0C;QAC1C,qFAAqF;QACrF,KAAK,MAAM,MAAM,IAAI,eAAe,EAAE;YACrC,eAAe,CAAC,gBAAgB,EAAE,CAAC;YACnC,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;YAClD,IAAI,QAAQ,KAAK,0BAAU,CAAC,SAAS,EAAE;gBACtC,eAAe,CAAC,qBAAqB,EAAE,CAAC;aACxC;iBAAM,IAAI,QAAQ,KAAK,0BAAU,CAAC,IAAI,EAAE;gBACxC,eAAe,CAAC,0BAA0B,EAAE,CAAC;aAC7C;SACD;QACD,OAAO,eAAe,CAAC;IACxB,CAAC;CACD;AA/kCD,4CA+kCC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, LazyPromise, Timer } from \"@fluidframework/core-utils\";\nimport { IRequest } from \"@fluidframework/core-interfaces\";\nimport {\n\tgcTreeKey,\n\tIGarbageCollectionData,\n\tIGarbageCollectionDetailsBase,\n\tISummarizeResult,\n\tITelemetryContext,\n} from \"@fluidframework/runtime-definitions\";\nimport { createResponseError, responseToException } from \"@fluidframework/runtime-utils\";\nimport {\n\tcreateChildLogger,\n\tcreateChildMonitoringContext,\n\tDataProcessingError,\n\tITelemetryLoggerExt,\n\tMonitoringContext,\n\tPerformanceEvent,\n\ttagCodeArtifacts,\n} from \"@fluidframework/telemetry-utils\";\nimport { BlobManager } from \"../blobManager\";\nimport {\n\tInactiveResponseHeaderKey,\n\tRuntimeHeaderData,\n\tTombstoneResponseHeaderKey,\n} from \"../containerRuntime\";\nimport { ClientSessionExpiredError } from \"../error\";\nimport { ContainerMessageType, ContainerRuntimeGCMessage } from \"../messageTypes\";\nimport { IRefreshSummaryResult } from \"../summary\";\nimport { generateGCConfigs } from \"./gcConfigs\";\nimport {\n\tGCNodeType,\n\tIGarbageCollector,\n\tIGarbageCollectorCreateParams,\n\tIGarbageCollectionRuntime,\n\tIGCResult,\n\tIGCStats,\n\tUnreferencedState,\n\tIGCMetadata,\n\tIGarbageCollectorConfigs,\n\tIMarkPhaseStats,\n\tISweepPhaseStats,\n\tGarbageCollectionMessage,\n\tGarbageCollectionMessageType,\n} from \"./gcDefinitions\";\nimport {\n\tcloneGCData,\n\tcompatBehaviorAllowsGCMessageType,\n\tconcatGarbageCollectionData,\n\tgetGCDataFromSnapshot,\n} from \"./gcHelpers\";\nimport { runGarbageCollection } from \"./gcReferenceGraphAlgorithm\";\nimport { IGarbageCollectionSnapshotData, IGarbageCollectionState } from \"./gcSummaryDefinitions\";\nimport { GCSummaryStateTracker } from \"./gcSummaryStateTracker\";\nimport { UnreferencedStateTracker } from \"./gcUnreferencedStateTracker\";\nimport { GCTelemetryTracker } from \"./gcTelemetry\";\n\n/**\n * The garbage collector for the container runtime. It consolidates the garbage collection functionality and maintains\n * its state across summaries.\n *\n * Node - represented as nodeId, it's a node on the GC graph\n *\n * Outbound Route - a path from one node to another node, think `nodeA` -\\> `nodeB`\n *\n * Graph - all nodes with their respective routes\n *\n * ```\n *\t\t\t GC Graph\n *\n *\t\t\t Node\n *\t\tNodeId = \"datastore1\"\n *\t\t /\t\t\t \\\\\n *\tOutboundRoute OutboundRoute\n *\t\t /\t\t\t\t \\\\\n *\t Node\t\t\t Node\n * NodeId = \"dds1\"\t NodeId = \"dds2\"\n * ```\n */\nexport class GarbageCollector implements IGarbageCollector {\n\tpublic static create(createParams: IGarbageCollectorCreateParams): IGarbageCollector {\n\t\treturn new GarbageCollector(createParams);\n\t}\n\n\tprivate readonly mc: MonitoringContext;\n\n\tprivate readonly configs: IGarbageCollectorConfigs;\n\n\tpublic get shouldRunGC(): boolean {\n\t\treturn this.configs.shouldRunGC;\n\t}\n\n\t// Keeps track of the GC state from the last run.\n\tprivate gcDataFromLastRun: IGarbageCollectionData | undefined;\n\t// Keeps a list of references (edges in the GC graph) between GC runs. Each entry has a node id and a list of\n\t// outbound routes from that node.\n\tprivate readonly newReferencesSinceLastRun: Map<string, string[]> = new Map();\n\t// A list of nodes that have been tombstoned.\n\tprivate tombstones: string[] = [];\n\t// A list of nodes that have been deleted during sweep phase.\n\tprivate deletedNodes: Set<string> = new Set();\n\n\t// Promise when resolved returns the GC data data in the base snapshot.\n\tprivate readonly baseSnapshotDataP: Promise<IGarbageCollectionSnapshotData | undefined>;\n\t// Promise when resolved initializes the GC state from the data in the base snapshot.\n\tprivate readonly initializeGCStateFromBaseSnapshotP: Promise<void>;\n\t// The GC details generated from the base snapshot.\n\tprivate readonly baseGCDetailsP: Promise<IGarbageCollectionDetailsBase>;\n\t// Map of node ids to their unreferenced state tracker.\n\tprivate readonly unreferencedNodesState: Map<string, UnreferencedStateTracker> = new Map();\n\t// The Timer responsible for closing the container when the session has expired\n\tprivate sessionExpiryTimer: Timer | undefined;\n\n\t// The number of times GC has successfully completed on this instance of GarbageCollector.\n\tprivate completedRuns = 0;\n\n\tprivate readonly runtime: IGarbageCollectionRuntime;\n\tprivate readonly isSummarizerClient: boolean;\n\n\tprivate readonly summaryStateTracker: GCSummaryStateTracker;\n\tprivate readonly telemetryTracker: GCTelemetryTracker;\n\n\t/** If false, loading or using a Tombstoned object should merely log, not fail */\n\tpublic get tombstoneEnforcementAllowed(): boolean {\n\t\treturn this.configs.sweepEnabled;\n\t}\n\t/** If true, throw an error when a tombstone data store is retrieved */\n\tpublic get throwOnTombstoneLoad(): boolean {\n\t\treturn this.configs.throwOnTombstoneLoad;\n\t}\n\t/** If true, throw an error when a tombstone data store is used */\n\tpublic get throwOnTombstoneUsage(): boolean {\n\t\treturn this.configs.throwOnTombstoneUsage;\n\t}\n\n\t/** For a given node path, returns the node's package path. */\n\tprivate readonly getNodePackagePath: (\n\t\tnodePath: string,\n\t) => Promise<readonly string[] | undefined>;\n\t/** Returns the timestamp of the last summary generated for this container. */\n\tprivate readonly getLastSummaryTimestampMs: () => number | undefined;\n\n\tprivate readonly submitMessage: (message: ContainerRuntimeGCMessage) => void;\n\n\tpublic get summaryStateNeedsReset(): boolean {\n\t\treturn this.summaryStateTracker.doesSummaryStateNeedReset;\n\t}\n\n\t/** Returns the count of data stores whose GC state updated since the last summary. */\n\tpublic get updatedDSCountSinceLastSummary(): number {\n\t\treturn this.summaryStateTracker.updatedDSCountSinceLastSummary;\n\t}\n\n\tprotected constructor(createParams: IGarbageCollectorCreateParams) {\n\t\tthis.runtime = createParams.runtime;\n\t\tthis.isSummarizerClient = createParams.isSummarizerClient;\n\t\tthis.getNodePackagePath = createParams.getNodePackagePath;\n\t\tthis.getLastSummaryTimestampMs = createParams.getLastSummaryTimestampMs;\n\t\tthis.submitMessage = createParams.submitMessage;\n\n\t\tconst baseSnapshot = createParams.baseSnapshot;\n\t\tconst readAndParseBlob = createParams.readAndParseBlob;\n\n\t\tthis.mc = createChildMonitoringContext({\n\t\t\tlogger: createParams.baseLogger,\n\t\t\tnamespace: \"GarbageCollector\",\n\t\t\tproperties: {\n\t\t\t\tall: { completedGCRuns: () => this.completedRuns },\n\t\t\t},\n\t\t});\n\n\t\tthis.configs = generateGCConfigs(this.mc, createParams);\n\n\t\t// If session expiry is enabled, we need to close the container when the session expiry timeout expires.\n\t\tif (this.configs.sessionExpiryTimeoutMs !== undefined) {\n\t\t\t// If Test Override config is set, override Session Expiry timeout.\n\t\t\tconst overrideSessionExpiryTimeoutMs = this.mc.config.getNumber(\n\t\t\t\t\"Fluid.GarbageCollection.TestOverride.SessionExpiryMs\",\n\t\t\t);\n\t\t\tconst timeoutMs = overrideSessionExpiryTimeoutMs ?? this.configs.sessionExpiryTimeoutMs;\n\n\t\t\tthis.sessionExpiryTimer = new Timer(timeoutMs, () => {\n\t\t\t\tthis.runtime.closeFn(\n\t\t\t\t\tnew ClientSessionExpiredError(`Client session expired.`, timeoutMs),\n\t\t\t\t);\n\t\t\t});\n\t\t\tthis.sessionExpiryTimer.start();\n\t\t}\n\n\t\tthis.summaryStateTracker = new GCSummaryStateTracker(\n\t\t\tthis.configs,\n\t\t\tbaseSnapshot?.trees[gcTreeKey] !== undefined /* wasGCRunInBaseSnapshot */,\n\t\t);\n\n\t\tthis.telemetryTracker = new GCTelemetryTracker(\n\t\t\tthis.mc,\n\t\t\tthis.configs,\n\t\t\tthis.isSummarizerClient,\n\t\t\tcreateParams.createContainerMetadata,\n\t\t\t(nodeId: string) => this.runtime.getNodeType(nodeId),\n\t\t\t(nodeId: string) => this.unreferencedNodesState.get(nodeId),\n\t\t\tthis.getNodePackagePath,\n\t\t);\n\n\t\t// Get the GC data from the base snapshot. Use LazyPromise because we only want to do this once since it\n\t\t// it involves fetching blobs from storage which is expensive.\n\t\tthis.baseSnapshotDataP = new LazyPromise<IGarbageCollectionSnapshotData | undefined>(\n\t\t\tasync () => {\n\t\t\t\tif (baseSnapshot === undefined) {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\n\t\t\t\ttry {\n\t\t\t\t\t// For newer documents, GC data should be present in the GC tree in the root of the snapshot.\n\t\t\t\t\tconst gcSnapshotTree = baseSnapshot.trees[gcTreeKey];\n\t\t\t\t\tif (gcSnapshotTree === undefined) {\n\t\t\t\t\t\t// back-compat - Older documents get their gc data reset for simplicity as there are few of them\n\t\t\t\t\t\t// incremental gc summary will not work with older gc data as well\n\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst snapshotData = await getGCDataFromSnapshot(\n\t\t\t\t\t\tgcSnapshotTree,\n\t\t\t\t\t\treadAndParseBlob,\n\t\t\t\t\t);\n\n\t\t\t\t\t// If the GC version in base snapshot does not match the GC version currently in effect, the GC data\n\t\t\t\t\t// in the snapshot cannot be interpreted correctly. Set everything to undefined except for\n\t\t\t\t\t// deletedNodes because irrespective of GC versions, these nodes have been deleted and cannot be\n\t\t\t\t\t// brought back. The deletedNodes info is needed to identify when these nodes are used.\n\t\t\t\t\tif (this.configs.gcVersionInEffect !== this.configs.gcVersionInBaseSnapshot) {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tgcState: undefined,\n\t\t\t\t\t\t\ttombstones: undefined,\n\t\t\t\t\t\t\tdeletedNodes: snapshotData.deletedNodes,\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\treturn snapshotData;\n\t\t\t\t} catch (error) {\n\t\t\t\t\tconst dpe = DataProcessingError.wrapIfUnrecognized(\n\t\t\t\t\t\terror,\n\t\t\t\t\t\t\"FailedToInitializeGC\",\n\t\t\t\t\t);\n\t\t\t\t\tdpe.addTelemetryProperties({\n\t\t\t\t\t\tgcConfigs: JSON.stringify(this.configs),\n\t\t\t\t\t});\n\t\t\t\t\tthrow dpe;\n\t\t\t\t}\n\t\t\t},\n\t\t);\n\n\t\t/**\n\t\t * Set up the initializer which initializes the GC state from the data in base snapshot. It sets up GC data\n\t\t * from the base GC state and starts tracking the state of unreferenced nodes.\n\t\t *\n\t\t * Must only be called if there is a current reference timestamp.\n\t\t */\n\t\tthis.initializeGCStateFromBaseSnapshotP = new LazyPromise<void>(async () => {\n\t\t\tconst currentReferenceTimestampMs = this.runtime.getCurrentReferenceTimestampMs();\n\t\t\tassert(\n\t\t\t\tcurrentReferenceTimestampMs !== undefined,\n\t\t\t\t0x8a4 /* Trying to initialize GC state without current timestamp */,\n\t\t\t);\n\n\t\t\t/**\n\t\t\t * The base snapshot data will not be present if the container is loaded from:\n\t\t\t * 1. The first summary created by the detached container.\n\t\t\t * 2. A summary that was generated with GC disabled.\n\t\t\t * 3. A summary that was generated before GC even existed.\n\t\t\t */\n\t\t\tconst baseSnapshotData = await this.baseSnapshotDataP;\n\t\t\tthis.summaryStateTracker.initializeBaseState(baseSnapshotData);\n\n\t\t\tif (baseSnapshotData?.gcState === undefined) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Update unreferenced state tracking as per the GC state in the snapshot data and update gcDataFromLastRun\n\t\t\t// to the GC data from the snapshot data.\n\t\t\tconst gcNodes: { [id: string]: string[] } = {};\n\t\t\tfor (const [nodeId, nodeData] of Object.entries(baseSnapshotData.gcState.gcNodes)) {\n\t\t\t\tif (nodeData.unreferencedTimestampMs !== undefined) {\n\t\t\t\t\tthis.unreferencedNodesState.set(\n\t\t\t\t\t\tnodeId,\n\t\t\t\t\t\tnew UnreferencedStateTracker(\n\t\t\t\t\t\t\tnodeData.unreferencedTimestampMs,\n\t\t\t\t\t\t\tthis.configs.inactiveTimeoutMs,\n\t\t\t\t\t\t\tcurrentReferenceTimestampMs,\n\t\t\t\t\t\t\tthis.configs.tombstoneTimeoutMs,\n\t\t\t\t\t\t\tthis.configs.sweepGracePeriodMs,\n\t\t\t\t\t\t),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tgcNodes[nodeId] = Array.from(nodeData.outboundRoutes);\n\t\t\t}\n\t\t\tthis.gcDataFromLastRun = { gcNodes };\n\t\t});\n\n\t\t// Get the GC details from the GC state in the base summary. This is returned in getBaseGCDetails which is\n\t\t// used to initialize the GC state of all the nodes in the container.\n\t\tthis.baseGCDetailsP = new LazyPromise<IGarbageCollectionDetailsBase>(async () => {\n\t\t\tconst baseSnapshotData = await this.baseSnapshotDataP;\n\t\t\tif (baseSnapshotData?.gcState === undefined) {\n\t\t\t\treturn {};\n\t\t\t}\n\n\t\t\tconst gcNodes: { [id: string]: string[] } = {};\n\t\t\tfor (const [nodeId, nodeData] of Object.entries(baseSnapshotData.gcState.gcNodes)) {\n\t\t\t\tgcNodes[nodeId] = Array.from(nodeData.outboundRoutes);\n\t\t\t}\n\t\t\t// Run GC on the nodes in the base summary to get the routes used in each node in the container.\n\t\t\t// This is an optimization for space (vs performance) wherein we don't need to store the used routes of\n\t\t\t// each node in the summary.\n\t\t\tconst usedRoutes = runGarbageCollection(gcNodes, [\"/\"]).referencedNodeIds;\n\n\t\t\treturn { gcData: { gcNodes }, usedRoutes };\n\t\t});\n\n\t\t// Log all the GC options and the state determined by the garbage collector.\n\t\t// This is useful even for interactive clients since they track unreferenced nodes and log errors.\n\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\teventName: \"GarbageCollectorLoaded\",\n\t\t\tgcConfigs: JSON.stringify(this.configs),\n\t\t\tgcOptions: JSON.stringify(createParams.gcOptions),\n\t\t\t...createParams.createContainerMetadata,\n\t\t});\n\t}\n\n\t/**\n\t * Called during container initialization. Initializes the tombstone and deleted nodes state from the base snapshot.\n\t * Also, initializes the GC state including unreferenced nodes tracking if a current reference timestamp exists.\n\t * Note that if there is any GC state in the base snapshot, then there will definitely be a reference timestamp\n\t * to work with - The GC state would have been generated using a timestamp which is part of the snapshot.\n\t */\n\tpublic async initializeBaseState(): Promise<void> {\n\t\tconst baseSnapshotData = await this.baseSnapshotDataP;\n\t\t/**\n\t\t * The base snapshot data will not be present if the container is loaded from:\n\t\t * 1. The first summary created by the detached container.\n\t\t * 2. A summary that was generated with GC disabled.\n\t\t * 3. A summary that was generated before GC even existed.\n\t\t */\n\t\tif (baseSnapshotData === undefined) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Initialize the deleted nodes from the snapshot. This is done irrespective of whether sweep is enabled or not\n\t\t// to identify deleted nodes' usage.\n\t\tif (baseSnapshotData.deletedNodes !== undefined) {\n\t\t\tthis.deletedNodes = new Set(baseSnapshotData.deletedNodes);\n\t\t}\n\n\t\t// If running in tombstone mode, initialize the tombstone state from the snapshot. Also, notify the runtime of\n\t\t// tombstone routes.\n\t\tif (this.configs.tombstoneMode && baseSnapshotData.tombstones !== undefined) {\n\t\t\t// Create a copy since we are writing from a source we don't control\n\t\t\tthis.tombstones = Array.from(baseSnapshotData.tombstones);\n\t\t\tthis.runtime.updateTombstonedRoutes(this.tombstones);\n\t\t}\n\n\t\tawait this.initializeOrUpdateGCState();\n\t}\n\n\t/**\n\t * Initialize the GC state if not already initialized. If GC state is already initialized, update the unreferenced\n\t * state tracking as per the current reference timestamp.\n\t */\n\tprivate async initializeOrUpdateGCState() {\n\t\tconst currentReferenceTimestampMs = this.runtime.getCurrentReferenceTimestampMs();\n\t\tif (currentReferenceTimestampMs === undefined) {\n\t\t\treturn;\n\t\t}\n\n\t\t// If the GC state hasn't been initialized yet, initialize it and return.\n\t\tif (this.gcDataFromLastRun === undefined) {\n\t\t\tawait this.initializeGCStateFromBaseSnapshotP;\n\t\t\treturn;\n\t\t}\n\n\t\t// If the GC state has been initialized, update the tracking of unreferenced nodes as per the current\n\t\t// reference timestamp.\n\t\tfor (const [, nodeStateTracker] of this.unreferencedNodesState) {\n\t\t\tnodeStateTracker.updateTracking(currentReferenceTimestampMs);\n\t\t}\n\t}\n\n\t/**\n\t * Called when the connection state of the runtime changes, i.e., it connects or disconnects. GC subscribes to this\n\t * to initialize or update the unreference state tracking.\n\t * @param connected - Whether the runtime connected / disconnected.\n\t * @param clientId - The clientId of this runtime.\n\t */\n\tpublic setConnectionState(connected: boolean, clientId?: string | undefined): void {\n\t\t/**\n\t\t * When the client connects (or reconnects), attempt to initialize or update the GC state. This will keep\n\t\t * the unreferenced state tracking updated as per the reference timestamp at the time of connection.\n\t\t *\n\t\t * During GC initialization and during connections in read mode, it is possible that either no ops are\n\t\t * processed or only trailing ops are processed. This means that the GC state is not initialized or initialized\n\t\t * with an older reference timestamp. So, doing this on every connection will keep the unreferenced state\n\t\t * tracking up-to-date.\n\t\t */\n\t\tif (connected && this.configs.shouldRunGC) {\n\t\t\tthis.initializeOrUpdateGCState().catch((error) => {\n\t\t\t\tthis.mc.logger.sendErrorEvent(\n\t\t\t\t\t{\n\t\t\t\t\t\teventName: \"GCInitializationOrUpdateFailed\",\n\t\t\t\t\t\tgcConfigs: JSON.stringify(this.configs),\n\t\t\t\t\t\tclientId,\n\t\t\t\t\t},\n\t\t\t\t\terror,\n\t\t\t\t);\n\t\t\t});\n\t\t}\n\t}\n\n\t/**\n\t * Returns a the GC details generated from the base summary. This is used to initialize the GC state of the nodes\n\t * in the container.\n\t */\n\tpublic async getBaseGCDetails(): Promise<IGarbageCollectionDetailsBase> {\n\t\treturn this.baseGCDetailsP;\n\t}\n\n\t/**\n\t * Runs garbage collection and updates the reference / used state of the nodes in the container.\n\t * @returns stats of the GC run or undefined if GC did not run.\n\t */\n\tpublic async collectGarbage(\n\t\toptions: {\n\t\t\t/** Logger to use for logging GC events */\n\t\t\tlogger?: ITelemetryLoggerExt;\n\t\t\t/** True to run GC sweep phase after the mark phase */\n\t\t\trunSweep?: boolean;\n\t\t\t/** True to generate full GC data */\n\t\t\tfullGC?: boolean;\n\t\t},\n\t\ttelemetryContext?: ITelemetryContext,\n\t): Promise<IGCStats | undefined> {\n\t\tconst fullGC =\n\t\t\toptions.fullGC ??\n\t\t\t(this.configs.runFullGC === true || this.summaryStateTracker.doesSummaryStateNeedReset);\n\n\t\t// Add the options that are used to run GC to the telemetry context.\n\t\ttelemetryContext?.setMultiple(\"fluid_GC\", \"Options\", {\n\t\t\tfullGC,\n\t\t\trunSweep: options.runSweep,\n\t\t});\n\n\t\tconst logger = options.logger\n\t\t\t? createChildLogger({\n\t\t\t\t\tlogger: options.logger,\n\t\t\t\t\tproperties: {\n\t\t\t\t\t\tall: { completedGCRuns: () => this.completedRuns },\n\t\t\t\t\t},\n\t\t\t })\n\t\t\t: this.mc.logger;\n\n\t\t/**\n\t\t * If there is no current reference timestamp, skip running GC. We need the current timestamp to track\n\t\t * how long objects have been unreferenced and if they should be deleted.\n\t\t *\n\t\t * Note that the only scenario where GC is called and there is no reference timestamp is when no ops have ever\n\t\t * been processed for this container and it is in read mode. In this scenario, there is no point in running GC\n\t\t * anyway because references in the container do not change without any ops, i.e., there is nothing to collect.\n\t\t */\n\t\tconst currentReferenceTimestampMs = this.runtime.getCurrentReferenceTimestampMs();\n\t\tif (currentReferenceTimestampMs === undefined) {\n\t\t\t// Log an event so we can evaluate how often we run into this scenario.\n\t\t\tlogger.sendErrorEvent({\n\t\t\t\teventName: \"CollectGarbageCalledWithoutTimestamp\",\n\t\t\t\tgcConfigs: JSON.stringify(this.configs),\n\t\t\t});\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn PerformanceEvent.timedExecAsync(\n\t\t\tlogger,\n\t\t\t{ eventName: \"GarbageCollection\" },\n\t\t\tasync (event) => {\n\t\t\t\t/** Pre-GC steps */\n\t\t\t\t// Ensure that state has been initialized from the base snapshot data.\n\t\t\t\tawait this.initializeGCStateFromBaseSnapshotP;\n\t\t\t\t// Let the runtime update its pending state before GC runs.\n\t\t\t\tawait this.runtime.updateStateBeforeGC();\n\n\t\t\t\t/** GC step */\n\t\t\t\tconst gcStats = await this.runGC(fullGC, currentReferenceTimestampMs, logger);\n\t\t\t\tevent.end({\n\t\t\t\t\t...gcStats,\n\t\t\t\t\tdetails: {\n\t\t\t\t\t\ttimestamp: currentReferenceTimestampMs,\n\t\t\t\t\t\tsweep: this.configs.shouldRunSweep,\n\t\t\t\t\t\ttombstone: this.configs.throwOnTombstoneLoad,\n\t\t\t\t\t},\n\t\t\t\t});\n\n\t\t\t\t/** Post-GC steps */\n\t\t\t\t// Log pending unreferenced events such as a node being used after inactive. This is done after GC runs and\n\t\t\t\t// updates its state so that we don't send false positives based on intermediate state. For example, we may get\n\t\t\t\t// reference to an unreferenced node from another unreferenced node which means the node wasn't revived.\n\t\t\t\tawait this.telemetryTracker.logPendingEvents(logger);\n\t\t\t\t// Update the state of summary state tracker from this run's stats.\n\t\t\t\tthis.summaryStateTracker.updateStateFromGCRunStats(gcStats);\n\t\t\t\tthis.newReferencesSinceLastRun.clear();\n\t\t\t\tthis.completedRuns++;\n\n\t\t\t\treturn gcStats;\n\t\t\t},\n\t\t\t{ end: true, cancel: \"error\" },\n\t\t);\n\t}\n\n\t/**\n\t * Runs garbage collection. It does the following:\n\t *\n\t * 1. It generates / analyzes the runtime's reference graph.\n\t *\n\t * 2. Generates mark phase stats.\n\t *\n\t * 3. Runs Mark phase.\n\t *\n\t * 4. Runs Sweep phase.\n\t *\n\t * 5. Generates sweep phase stats.\n\t */\n\tprivate async runGC(\n\t\tfullGC: boolean,\n\t\tcurrentReferenceTimestampMs: number,\n\t\tlogger: ITelemetryLoggerExt,\n\t): Promise<IGCStats> {\n\t\t// 1. Generate / analyze the runtime's reference graph.\n\t\t// Get the reference graph (gcData) and run GC algorithm to get referenced / unreferenced nodes.\n\t\tconst gcData = await this.runtime.getGCData(fullGC);\n\t\tconst gcResult = runGarbageCollection(gcData.gcNodes, [\"/\"]);\n\t\t// Get all referenced nodes - References in this run + references between the previous and current runs.\n\t\tconst allReferencedNodeIds =\n\t\t\tthis.findAllNodesReferencedBetweenGCs(gcData, this.gcDataFromLastRun, logger) ??\n\t\t\tgcResult.referencedNodeIds;\n\n\t\t// 2. Get the mark phase stats based on the previous / current GC state.\n\t\t// This is done before running mark phase because we need the previous GC state before it is updated.\n\t\tconst markPhaseStats = this.getMarkPhaseStats(gcResult);\n\n\t\t// 3. Run the Mark phase.\n\t\t// It will mark nodes as referenced / unreferenced and return lists of tombstone-ready and sweep-ready nodes.\n\t\tconst { tombstoneReadyNodeIds, sweepReadyNodeIds } = this.runMarkPhase(\n\t\t\tgcResult,\n\t\t\tallReferencedNodeIds,\n\t\t\tcurrentReferenceTimestampMs,\n\t\t);\n\n\t\t// 4. Run the Sweep phase.\n\t\t// It will tombstone any tombstone-ready nodes, and initiate the deletion of sweep-ready nodes by sending a\n\t\t// sweep op. All clients, including this one, will delete these nodes once it processes the op.\n\t\tthis.runSweepPhase(gcResult, tombstoneReadyNodeIds, sweepReadyNodeIds);\n\n\t\tthis.gcDataFromLastRun = cloneGCData(gcData);\n\n\t\t// 5. Get the sweep phase stats.\n\t\tconst sweepPhaseStats = this.getSweepPhaseStats(\n\t\t\tthis.deletedNodes,\n\t\t\tsweepReadyNodeIds,\n\t\t\tmarkPhaseStats,\n\t\t);\n\n\t\treturn { ...markPhaseStats, ...sweepPhaseStats };\n\t}\n\n\t/**\n\t * Runs the GC Mark phase. It does the following:\n\t *\n\t * 1. Marks all referenced nodes in this run by clearing tracking for them.\n\t *\n\t * 2. Marks unreferenced nodes in this run by starting tracking for them.\n\t *\n\t * 3. Calls the runtime to update nodes that were marked referenced.\n\t *\n\t * @param gcResult - The result of the GC run on the gcData.\n\t * @param allReferencedNodeIds - Nodes referenced in this GC run + referenced between previous and current GC run.\n\t * @param currentReferenceTimestampMs - The timestamp to be used for unreferenced nodes' timestamp.\n\t * @returns The sets of tombstone-ready and sweep-ready nodes, i.e., nodes that ready to be tombstoned or deleted.\n\t */\n\tprivate runMarkPhase(\n\t\tgcResult: IGCResult,\n\t\tallReferencedNodeIds: string[],\n\t\tcurrentReferenceTimestampMs: number,\n\t): { tombstoneReadyNodeIds: Set<string>; sweepReadyNodeIds: Set<string> } {\n\t\t// 1. Marks all referenced nodes by clearing their unreferenced tracker, if any.\n\t\tfor (const nodeId of allReferencedNodeIds) {\n\t\t\tconst nodeStateTracker = this.unreferencedNodesState.get(nodeId);\n\t\t\tif (nodeStateTracker !== undefined) {\n\t\t\t\t// Stop tracking so as to clear out any running timers.\n\t\t\t\tnodeStateTracker.stopTracking();\n\t\t\t\t// Delete the node as we don't need to track it any more.\n\t\t\t\tthis.unreferencedNodesState.delete(nodeId);\n\t\t\t}\n\t\t}\n\n\t\t// 2. Mark unreferenced nodes in this run by starting unreferenced tracking for them.\n\t\tconst tombstoneReadyNodeIds: Set<string> = new Set();\n\t\tconst sweepReadyNodeIds: Set<string> = new Set();\n\t\tfor (const nodeId of gcResult.deletedNodeIds) {\n\t\t\tconst nodeStateTracker = this.unreferencedNodesState.get(nodeId);\n\t\t\tif (nodeStateTracker === undefined) {\n\t\t\t\tthis.unreferencedNodesState.set(\n\t\t\t\t\tnodeId,\n\t\t\t\t\tnew UnreferencedStateTracker(\n\t\t\t\t\t\tcurrentReferenceTimestampMs,\n\t\t\t\t\t\tthis.configs.inactiveTimeoutMs,\n\t\t\t\t\t\tcurrentReferenceTimestampMs,\n\t\t\t\t\t\tthis.configs.tombstoneTimeoutMs,\n\t\t\t\t\t\tthis.configs.sweepGracePeriodMs,\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\t// If a node was already unreferenced, update its tracking information. Since the current reference time\n\t\t\t\t// is from the ops seen, this will ensure that we keep updating unreferenced state as time moves forward.\n\t\t\t\tnodeStateTracker.updateTracking(currentReferenceTimestampMs);\n\n\t\t\t\t// If a node is tombstone or sweep-ready, store it so it can be returned.\n\t\t\t\tif (nodeStateTracker.state === UnreferencedState.TombstoneReady) {\n\t\t\t\t\ttombstoneReadyNodeIds.add(nodeId);\n\t\t\t\t}\n\t\t\t\tif (nodeStateTracker.state === UnreferencedState.SweepReady) {\n\t\t\t\t\tsweepReadyNodeIds.add(nodeId);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// 3. Call the runtime to update referenced nodes in this run.\n\t\tthis.runtime.updateUsedRoutes(gcResult.referencedNodeIds);\n\n\t\treturn { tombstoneReadyNodeIds, sweepReadyNodeIds };\n\t}\n\n\t/**\n\t * Runs the GC Sweep phase. It does the following:\n\t *\n\t * 1. Marks tombstone-ready nodes as tombstones.\n\t *\n\t * 2. Sends a sweep op to delete nodes that are sweep-ready. Once the op is ack'd, these nodes will be deleted.\n\t *\n\t * @param gcResult - The result of the GC run on the gcData.\n\t * @param tombstoneReadyNodes - List of nodes that are tombstone-ready.\n\t * @param sweepReadyNodes - List of nodes that are sweep-ready.\n\t */\n\tprivate runSweepPhase(\n\t\tgcResult: IGCResult,\n\t\ttombstoneReadyNodes: Set<string>,\n\t\tsweepReadyNodes: Set<string>,\n\t) {\n\t\t/**\n\t\t * Under \"Test Mode\", unreferenced nodes are immediately deleted without waiting for them to be sweep-ready.\n\t\t *\n\t\t * Otherwise, depending on how long it's been since the node was unreferenced, it will either be\n\t\t * marked as Tombstone, or deleted by Sweep.\n\t\t */\n\n\t\tif (this.configs.testMode) {\n\t\t\t// If we are running in GC test mode, unreferenced nodes (gcResult.deletedNodeIds) are deleted.\n\t\t\tthis.runtime.updateUnusedRoutes(gcResult.deletedNodeIds);\n\t\t\treturn;\n\t\t}\n\n\t\t// If sweep is disabled, we'll tombstone both tombstone-ready and sweep-ready nodes.\n\t\t// This is important because a container may never load during a node's Sweep Grace Period,\n\t\t// so that node would directly become sweep-ready skipping over tombstone-ready state,\n\t\t// but should be Tombstoned since Sweep is disabled.\n\t\tconst { nodesToTombstone, nodesToDelete } = this.configs.shouldRunSweep\n\t\t\t? {\n\t\t\t\t\tnodesToTombstone: [...tombstoneReadyNodes],\n\t\t\t\t\tnodesToDelete: [...sweepReadyNodes],\n\t\t\t }\n\t\t\t: {\n\t\t\t\t\tnodesToTombstone: [...tombstoneReadyNodes, ...sweepReadyNodes],\n\t\t\t\t\tnodesToDelete: [],\n\t\t\t };\n\n\t\tif (this.configs.tombstoneMode) {\n\t\t\tthis.tombstones = nodesToTombstone;\n\t\t\t// If we are running in GC tombstone mode, update tombstoned routes.\n\t\t\tthis.runtime.updateTombstonedRoutes(this.tombstones);\n\t\t}\n\n\t\tif (this.configs.shouldRunSweep && nodesToDelete.length > 0) {\n\t\t\t// Do not send DDS node ids in the GC op. This is an optimization to reduce its size. Since GC applies to\n\t\t\t// to data store only, all its DDSes are deleted along with it. The DDS ids will be retrieved from the\n\t\t\t// local state when processing the op.\n\t\t\tconst sweepReadyDSAndBlobs = nodesToDelete.filter((nodeId) => {\n\t\t\t\tconst nodeType = this.runtime.getNodeType(nodeId);\n\t\t\t\treturn nodeType === GCNodeType.DataStore || nodeType === GCNodeType.Blob;\n\t\t\t});\n\t\t\tconst contents: GarbageCollectionMessage = {\n\t\t\t\ttype: GarbageCollectionMessageType.Sweep,\n\t\t\t\tdeletedNodeIds: sweepReadyDSAndBlobs,\n\t\t\t};\n\n\t\t\t// Its fine for older clients to ignore this op because it doesn't have any functional impact. This op\n\t\t\t// is an optimization to ensure that all clients are in sync when it comes to deleted nodes to prevent their\n\t\t\t// accidental usage. The clients will sync without the delete op too but it may take longer.\n\t\t\tconst containerGCMessage: ContainerRuntimeGCMessage = {\n\t\t\t\ttype: ContainerMessageType.GC,\n\t\t\t\tcontents,\n\t\t\t\tcompatDetails: { behavior: \"Ignore\" },\n\t\t\t};\n\t\t\tthis.submitMessage(containerGCMessage);\n\t\t\treturn;\n\t\t}\n\t}\n\n\t/**\n\t * Since GC runs periodically, the GC data that is generated only tells us the state of the world at that point in\n\t * time. There can be nodes that were referenced in between two runs and their unreferenced state needs to be\n\t * updated. For example, in the following scenarios not updating the unreferenced timestamp can lead to deletion of\n\t * these objects while there can be in-memory referenced to it:\n\t * 1. A node transitions from `unreferenced -> referenced -> unreferenced` between two runs. When the reference is\n\t * added, the object may have been accessed and in-memory reference to it added.\n\t * 2. A reference is added from one unreferenced node to one or more unreferenced nodes. Even though the node[s] were\n\t * unreferenced, they could have been accessed and in-memory reference to them added.\n\t *\n\t * This function identifies nodes that were referenced since the last run.\n\t * If these nodes are currently unreferenced, they will be assigned new unreferenced state by the current run.\n\t *\n\t * @returns A list of all nodes referenced from the last local summary until now.\n\t */\n\tprivate findAllNodesReferencedBetweenGCs(\n\t\tcurrentGCData: IGarbageCollectionData,\n\t\tpreviousGCData: IGarbageCollectionData | undefined,\n\t\tlogger: ITelemetryLoggerExt,\n\t): string[] | undefined {\n\t\t// If we haven't run GC before there is nothing to do.\n\t\t// No previousGCData, means nothing is unreferenced, and there are no reference state trackers to clear\n\t\tif (previousGCData === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\t/**\n\t\t * If there are references that were not explicitly notified to GC, log an error because this should never happen.\n\t\t * If it does, this may result in the unreferenced timestamps of these nodes not updated when they were referenced.\n\t\t */\n\t\tthis.telemetryTracker.logIfMissingExplicitReferences(\n\t\t\tcurrentGCData,\n\t\t\tpreviousGCData,\n\t\t\tthis.newReferencesSinceLastRun,\n\t\t\tlogger,\n\t\t);\n\n\t\t// No references were added since the last run so we don't have to update reference states of any unreferenced\n\t\t// nodes. There is no in between state at this point.\n\t\tif (this.newReferencesSinceLastRun.size === 0) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\t/**\n\t\t * Generate a super set of the GC data that contains the nodes and edges from last run, plus any new node and\n\t\t * edges that have been added since then. To do this, combine the GC data from the last run and the current\n\t\t * run, and then add the references since last run.\n\t\t *\n\t\t * Note on why we need to combine the data from previous run, current run and all references in between -\n\t\t * 1. We need data from last run because some of its references may have been deleted since then. If those\n\t\t * references added new outbound references before they were deleted, we need to detect them.\n\t\t *\n\t\t * 2. We need new outbound references since last run because some of them may have been deleted later. If those\n\t\t * references added new outbound references before they were deleted, we need to detect them.\n\t\t *\n\t\t * 3. We need data from the current run because currently we may not detect when DDSes are referenced:\n\t\t * - We don't require DDSes handles to be stored in a referenced DDS.\n\t\t * - A new data store may have \"root\" DDSes already created and we don't detect them today.\n\t\t */\n\t\tconst gcDataSuperSet = concatGarbageCollectionData(previousGCData, currentGCData);\n\t\tconst newOutboundRoutesSinceLastRun: string[] = [];\n\t\tthis.newReferencesSinceLastRun.forEach((outboundRoutes: string[], sourceNodeId: string) => {\n\t\t\tif (gcDataSuperSet.gcNodes[sourceNodeId] === undefined) {\n\t\t\t\tgcDataSuperSet.gcNodes[sourceNodeId] = outboundRoutes;\n\t\t\t} else {\n\t\t\t\tgcDataSuperSet.gcNodes[sourceNodeId].push(...outboundRoutes);\n\t\t\t}\n\t\t\tnewOutboundRoutesSinceLastRun.push(...outboundRoutes);\n\t\t});\n\n\t\t/**\n\t\t * Run GC on the above reference graph starting with root and all new outbound routes. This will generate a\n\t\t * list of all nodes that could have been referenced since the last run. If any of these nodes are unreferenced,\n\t\t * unreferenced, stop tracking them and remove from unreferenced list.\n\t\t * Note that some of these nodes may be unreferenced now and if so, the current run will mark them as\n\t\t * unreferenced and add unreferenced state.\n\t\t */\n\t\tconst gcResult = runGarbageCollection(gcDataSuperSet.gcNodes, [\n\t\t\t\"/\",\n\t\t\t...newOutboundRoutesSinceLastRun,\n\t\t]);\n\t\treturn gcResult.referencedNodeIds;\n\t}\n\n\t/**\n\t * Summarizes the GC data and returns it as a summary tree.\n\t * We current write the entire GC state in a single blob. This can be modified later to write multiple\n\t * blobs. All the blob keys should start with `gcBlobPrefix`.\n\t */\n\tpublic summarize(\n\t\tfullTree: boolean,\n\t\ttrackState: boolean,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): ISummarizeResult | undefined {\n\t\tif (!this.configs.shouldRunGC || this.gcDataFromLastRun === undefined) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst gcState: IGarbageCollectionState = { gcNodes: {} };\n\t\tfor (const [nodeId, outboundRoutes] of Object.entries(this.gcDataFromLastRun.gcNodes)) {\n\t\t\tgcState.gcNodes[nodeId] = {\n\t\t\t\toutboundRoutes,\n\t\t\t\tunreferencedTimestampMs:\n\t\t\t\t\tthis.unreferencedNodesState.get(nodeId)?.unreferencedTimestampMs,\n\t\t\t};\n\t\t}\n\n\t\treturn this.summaryStateTracker.summarize(\n\t\t\tfullTree,\n\t\t\ttrackState,\n\t\t\tgcState,\n\t\t\tthis.deletedNodes,\n\t\t\tthis.tombstones,\n\t\t);\n\t}\n\n\tpublic getMetadata(): IGCMetadata {\n\t\treturn {\n\t\t\t/**\n\t\t\t * If GC is enabled, the GC data is written using the GC version in effect and that is the gcFeature that goes\n\t\t\t * into the metadata blob. If GC is disabled, the gcFeature is 0.\n\t\t\t */\n\t\t\tgcFeature: this.configs.gcEnabled ? this.configs.gcVersionInEffect : 0,\n\t\t\tgcFeatureMatrix: this.configs.persistedGcFeatureMatrix,\n\t\t\tsessionExpiryTimeoutMs: this.configs.sessionExpiryTimeoutMs,\n\t\t\tsweepEnabled: false, // DEPRECATED - to be removed\n\t\t\ttombstoneTimeoutMs: this.configs.tombstoneTimeoutMs,\n\t\t};\n\t}\n\n\t/**\n\t * Called to refresh the latest summary state. This happens when either a pending summary is acked.\n\t */\n\tpublic async refreshLatestSummary(result: IRefreshSummaryResult): Promise<void> {\n\t\treturn this.summaryStateTracker.refreshLatestSummary(result);\n\t}\n\n\t/**\n\t * Process a GC message.\n\t * @param message - The GC message from the container runtime.\n\t * @param local - Whether it was send by this client.\n\t */\n\tpublic processMessage(message: ContainerRuntimeGCMessage, local: boolean) {\n\t\tswitch (message.contents.type) {\n\t\t\tcase \"Sweep\": {\n\t\t\t\t// Delete the nodes whose ids are present in the contents.\n\t\t\t\tthis.deleteSweepReadyNodes(message.contents.deletedNodeIds);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tif (\n\t\t\t\t\t!compatBehaviorAllowsGCMessageType(\n\t\t\t\t\t\tmessage.contents.type,\n\t\t\t\t\t\tmessage.compatDetails?.behavior,\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\tconst error = DataProcessingError.create(\n\t\t\t\t\t\t`Garbage collection message of unknown type ${message.contents.type}`,\n\t\t\t\t\t\t\"processMessage\",\n\t\t\t\t\t);\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Delete nodes that are sweep-ready. Call the runtime to delete these nodes and clear the unreferenced state\n\t * tracking for nodes that are actually deleted by the runtime.\n\t * @param sweepReadyNodeIds - The ids of nodes that are ready to be deleted.\n\t */\n\tprivate deleteSweepReadyNodes(sweepReadyNodeIds: readonly string[]) {\n\t\t// Use a set for lookup because its much faster than array or map.\n\t\tconst sweepReadyNodesSet: Set<string> = new Set(sweepReadyNodeIds);\n\n\t\t// The ids in the sweep-ready nodes do not contain DDS node ids. This is an optimization to reduce the size\n\t\t// of the GC op. Since GC applies to data store only, all its DDSes are deleted along with it. So, get the\n\t\t// DDS nodes ID from the unreferenced nodes state.\n\t\tconst allSweepReadyNodeIds = Array.from(sweepReadyNodeIds);\n\t\tfor (const [id] of this.unreferencedNodesState) {\n\t\t\t// Ignore data store nodes since they would already be in the list.\n\t\t\tconst pathParts = id.split(\"/\");\n\t\t\tif (pathParts.length <= 2) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// Get the data store id part. Note that this may include blobs but that's okay since the part would just\n\t\t\t// be \"_blobs\" and it won't be found.\n\t\t\tconst dsId = `/${pathParts[1]}`;\n\t\t\tif (sweepReadyNodesSet.has(dsId)) {\n\t\t\t\tallSweepReadyNodeIds.push(id);\n\t\t\t}\n\t\t}\n\t\tconst deletedNodeIds = this.runtime.deleteSweepReadyNodes(allSweepReadyNodeIds);\n\n\t\t// Clear unreferenced state tracking for deleted nodes.\n\t\tfor (const nodeId of deletedNodeIds) {\n\t\t\tconst nodeStateTracker = this.unreferencedNodesState.get(nodeId);\n\t\t\tif (nodeStateTracker !== undefined) {\n\t\t\t\t// Stop tracking so as to clear out any running timers.\n\t\t\t\tnodeStateTracker.stopTracking();\n\t\t\t\t// Delete the node as we don't need to track it any more.\n\t\t\t\tthis.unreferencedNodesState.delete(nodeId);\n\t\t\t}\n\t\t\tthis.deletedNodes.add(nodeId);\n\t\t}\n\t}\n\n\t/**\n\t * Called when a node with the given id is updated. If the node is inactive or tombstoned, this will log an error\n\t * or throw an error if failing on incorrect usage is configured.\n\t * @param nodePath - The path of the node that changed.\n\t * @param reason - Whether the node was loaded or changed.\n\t * @param timestampMs - The timestamp when the node changed.\n\t * @param packagePath - The package path of the node. This may not be available if the node hasn't been loaded yet.\n\t * @param request - The original request for loads to preserve it in telemetry.\n\t * @param requestHeaders - If the node was loaded via request path, the headers in the request.\n\t */\n\tpublic nodeUpdated(\n\t\tnodePath: string,\n\t\treason: \"Loaded\" | \"Changed\",\n\t\ttimestampMs?: number,\n\t\tpackagePath?: readonly string[],\n\t\trequest?: IRequest,\n\t\theaderData?: RuntimeHeaderData,\n\t) {\n\t\tif (!this.configs.shouldRunGC) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst isTombstoned = this.tombstones.includes(nodePath);\n\n\t\t// This will log if appropriate\n\t\tthis.telemetryTracker.nodeUsed({\n\t\t\tid: nodePath,\n\t\t\tusageType: reason,\n\t\t\tcurrentReferenceTimestampMs:\n\t\t\t\ttimestampMs ?? this.runtime.getCurrentReferenceTimestampMs(),\n\t\t\tpackagePath,\n\t\t\tcompletedGCRuns: this.completedRuns,\n\t\t\tisTombstoned,\n\t\t\tlastSummaryTime: this.getLastSummaryTimestampMs(),\n\t\t\theaders: headerData,\n\t\t});\n\n\t\tconst nodeType = this.runtime.getNodeType(nodePath);\n\n\t\t// Unless this is a Loaded event for a Blob or DataStore, we're done after telemetry tracking\n\t\tif (reason !== \"Loaded\" || ![GCNodeType.Blob, GCNodeType.DataStore].includes(nodeType)) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst errorRequest: IRequest = request ?? { url: nodePath };\n\t\t// If the object is tombstoned and tombstone enforcement is configured, throw an error.\n\t\tif (isTombstoned && this.throwOnTombstoneLoad && headerData?.allowTombstone !== true) {\n\t\t\t// The requested data store is removed by gc. Create a 404 gc response exception.\n\t\t\tthrow responseToException(\n\t\t\t\tcreateResponseError(404, `${nodeType} was tombstoned`, errorRequest, {\n\t\t\t\t\t[TombstoneResponseHeaderKey]: true,\n\t\t\t\t}),\n\t\t\t\terrorRequest,\n\t\t\t);\n\t\t}\n\n\t\t// If the object is inactive and inactive enforcement is configured, throw an error.\n\t\tif (this.unreferencedNodesState.get(nodePath)?.state === \"Inactive\") {\n\t\t\tconst shouldThrowOnInactiveLoad =\n\t\t\t\t!this.isSummarizerClient &&\n\t\t\t\tthis.configs.throwOnInactiveLoad === true &&\n\t\t\t\theaderData?.allowInactive !== true;\n\t\t\tif (shouldThrowOnInactiveLoad) {\n\t\t\t\tthrow responseToException(\n\t\t\t\t\tcreateResponseError(404, `${nodeType} is inactive`, errorRequest, {\n\t\t\t\t\t\t[InactiveResponseHeaderKey]: true,\n\t\t\t\t\t}),\n\t\t\t\t\terrorRequest,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Called when an outbound reference is added to a node. This is used to identify all nodes that have been\n\t * referenced between summaries so that their unreferenced timestamp can be reset.\n\t *\n\t * @param fromNodePath - The node from which the reference is added.\n\t * @param toNodePath - The node to which the reference is added.\n\t */\n\tpublic addedOutboundReference(fromNodePath: string, toNodePath: string) {\n\t\tif (!this.configs.shouldRunGC) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (!toNodePath.startsWith(\"/\")) {\n\t\t\t// A long time ago we stored handles with relatives paths. We don't expect to see these cases though\n\t\t\t// because GC was enabled only after we made the switch to always using absolute paths.\n\t\t\tthis.mc.logger.sendErrorEvent({\n\t\t\t\teventName: \"InvalidRelativeOutboundRoute\",\n\t\t\t\t...tagCodeArtifacts({ fromId: fromNodePath, id: toNodePath }),\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\tassert(fromNodePath.startsWith(\"/\"), 0x8a5 /* fromNodePath must be an absolute path */);\n\n\t\tconst outboundRoutes = this.newReferencesSinceLastRun.get(fromNodePath) ?? [];\n\t\toutboundRoutes.push(toNodePath);\n\t\tthis.newReferencesSinceLastRun.set(fromNodePath, outboundRoutes);\n\n\t\tthis.telemetryTracker.nodeUsed({\n\t\t\tid: toNodePath,\n\t\t\tusageType: \"Revived\",\n\t\t\tcurrentReferenceTimestampMs: this.runtime.getCurrentReferenceTimestampMs(),\n\t\t\tpackagePath: undefined,\n\t\t\tcompletedGCRuns: this.completedRuns,\n\t\t\tisTombstoned: this.tombstones.includes(toNodePath),\n\t\t\tlastSummaryTime: this.getLastSummaryTimestampMs(),\n\t\t\tfromId: fromNodePath,\n\t\t});\n\t}\n\n\t/**\n\t * Returns whether a node with the given path has been deleted or not. This can be used by the runtime to identify\n\t * cases where objects are used after they are deleted and throw / log errors accordingly.\n\t */\n\tpublic isNodeDeleted(nodePath: string): boolean {\n\t\treturn this.deletedNodes.has(nodePath);\n\t}\n\n\tpublic dispose(): void {\n\t\tthis.sessionExpiryTimer?.clear();\n\t\tthis.sessionExpiryTimer = undefined;\n\t}\n\n\t/**\n\t * Generates the stats of a garbage collection mark phase run.\n\t * @param gcResult - The result of the current GC run.\n\t * @returns the stats of the mark phase run.\n\t */\n\tprivate getMarkPhaseStats(gcResult: IGCResult): IMarkPhaseStats {\n\t\tconst markPhaseStats: IMarkPhaseStats = {\n\t\t\tnodeCount: 0,\n\t\t\tdataStoreCount: 0,\n\t\t\tattachmentBlobCount: 0,\n\t\t\tunrefNodeCount: 0,\n\t\t\tunrefDataStoreCount: 0,\n\t\t\tunrefAttachmentBlobCount: 0,\n\t\t\tupdatedNodeCount: 0,\n\t\t\tupdatedDataStoreCount: 0,\n\t\t\tupdatedAttachmentBlobCount: 0,\n\t\t};\n\n\t\tconst updateNodeStats = (nodeId: string, referenced: boolean) => {\n\t\t\tmarkPhaseStats.nodeCount++;\n\t\t\t// If there is no previous GC data, every node's state is generated and is considered as updated.\n\t\t\t// Otherwise, find out if any node went from referenced to unreferenced or vice-versa.\n\t\t\tconst stateUpdated =\n\t\t\t\tthis.gcDataFromLastRun === undefined ||\n\t\t\t\tthis.unreferencedNodesState.has(nodeId) === referenced;\n\t\t\tif (stateUpdated) {\n\t\t\t\tmarkPhaseStats.updatedNodeCount++;\n\t\t\t}\n\t\t\tif (!referenced) {\n\t\t\t\tmarkPhaseStats.unrefNodeCount++;\n\t\t\t}\n\n\t\t\tif (this.runtime.getNodeType(nodeId) === GCNodeType.DataStore) {\n\t\t\t\tmarkPhaseStats.dataStoreCount++;\n\t\t\t\tif (stateUpdated) {\n\t\t\t\t\tmarkPhaseStats.updatedDataStoreCount++;\n\t\t\t\t}\n\t\t\t\tif (!referenced) {\n\t\t\t\t\tmarkPhaseStats.unrefDataStoreCount++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (this.runtime.getNodeType(nodeId) === GCNodeType.Blob) {\n\t\t\t\tmarkPhaseStats.attachmentBlobCount++;\n\t\t\t\tif (stateUpdated) {\n\t\t\t\t\tmarkPhaseStats.updatedAttachmentBlobCount++;\n\t\t\t\t}\n\t\t\t\tif (!referenced) {\n\t\t\t\t\tmarkPhaseStats.unrefAttachmentBlobCount++;\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tfor (const nodeId of gcResult.referencedNodeIds) {\n\t\t\tupdateNodeStats(nodeId, true /* referenced */);\n\t\t}\n\n\t\tfor (const nodeId of gcResult.deletedNodeIds) {\n\t\t\tupdateNodeStats(nodeId, false /* referenced */);\n\t\t}\n\n\t\treturn markPhaseStats;\n\t}\n\n\t/**\n\t * Generates the stats of a garbage collection sweep phase run.\n\t * @param deletedNodes - The nodes that have been deleted until this run.\n\t * @param sweepReadyNodes - The nodes that are sweep-ready in this GC run.\n\t * @param markPhaseStats - The stats of the mark phase run.\n\t * @returns the stats of the sweep phase run.\n\t */\n\tprivate getSweepPhaseStats(\n\t\tdeletedNodes: Set<string>,\n\t\tsweepReadyNodes: Set<string>,\n\t\tmarkPhaseStats: IMarkPhaseStats,\n\t): ISweepPhaseStats {\n\t\t// Initialize the life time node counts to the mark phase node counts. If sweep is not enabled,\n\t\t// these will be the life time node count for this container.\n\t\tconst sweepPhaseStats: ISweepPhaseStats = {\n\t\t\tlifetimeNodeCount: markPhaseStats.nodeCount,\n\t\t\tlifetimeDataStoreCount: markPhaseStats.dataStoreCount,\n\t\t\tlifetimeAttachmentBlobCount: markPhaseStats.attachmentBlobCount,\n\t\t\tdeletedNodeCount: 0,\n\t\t\tdeletedDataStoreCount: 0,\n\t\t\tdeletedAttachmentBlobCount: 0,\n\t\t};\n\n\t\t// The runtime can't reliably identify the type of deleted nodes. So, get the type here. This should\n\t\t// be good enough because the only types that participate in GC today are data stores, DDSes and blobs.\n\t\tconst getDeletedNodeType = (nodeId: string): GCNodeType => {\n\t\t\tconst pathParts = nodeId.split(\"/\");\n\t\t\tif (pathParts[1] === BlobManager.basePath) {\n\t\t\t\treturn GCNodeType.Blob;\n\t\t\t}\n\t\t\tif (pathParts.length === 2) {\n\t\t\t\treturn GCNodeType.DataStore;\n\t\t\t}\n\t\t\tif (pathParts.length === 3) {\n\t\t\t\treturn GCNodeType.SubDataStore;\n\t\t\t}\n\t\t\treturn GCNodeType.Other;\n\t\t};\n\n\t\tfor (const nodeId of deletedNodes) {\n\t\t\tsweepPhaseStats.deletedNodeCount++;\n\t\t\tconst nodeType = getDeletedNodeType(nodeId);\n\t\t\tif (nodeType === GCNodeType.DataStore) {\n\t\t\t\tsweepPhaseStats.deletedDataStoreCount++;\n\t\t\t} else if (nodeType === GCNodeType.Blob) {\n\t\t\t\tsweepPhaseStats.deletedAttachmentBlobCount++;\n\t\t\t}\n\t\t}\n\n\t\t// If sweep is enabled, the counts from the mark phase stats do not include nodes that have been\n\t\t// deleted in previous runs. So, add the deleted node counts to life time stats.\n\t\tsweepPhaseStats.lifetimeNodeCount += sweepPhaseStats.deletedNodeCount;\n\t\tsweepPhaseStats.lifetimeDataStoreCount += sweepPhaseStats.deletedDataStoreCount;\n\t\tsweepPhaseStats.lifetimeAttachmentBlobCount += sweepPhaseStats.deletedAttachmentBlobCount;\n\n\t\tif (this.configs.shouldRunSweep) {\n\t\t\treturn sweepPhaseStats;\n\t\t}\n\n\t\t// If sweep is not enabled, the current sweep-ready node stats should be added to deleted stats since this\n\t\t// is the final state the node will be in.\n\t\t// If sweep is enabled, this will happen in the run after the GC op round trips back.\n\t\tfor (const nodeId of sweepReadyNodes) {\n\t\t\tsweepPhaseStats.deletedNodeCount++;\n\t\t\tconst nodeType = this.runtime.getNodeType(nodeId);\n\t\t\tif (nodeType === GCNodeType.DataStore) {\n\t\t\t\tsweepPhaseStats.deletedDataStoreCount++;\n\t\t\t} else if (nodeType === GCNodeType.Blob) {\n\t\t\t\tsweepPhaseStats.deletedAttachmentBlobCount++;\n\t\t\t}\n\t\t}\n\t\treturn sweepPhaseStats;\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"gcConfigs.d.ts","sourceRoot":"","sources":["../../src/gc/gcConfigs.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,iBAAiB,EAGjB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AACvD,OAAO,EASN,wBAAwB,EACxB,iBAAiB,EAYjB,MAAM,iBAAiB,CAAC;AAGzB;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAChC,EAAE,EAAE,iBAAiB,EACrB,YAAY,EAAE;IACb,SAAS,EAAE,iBAAiB,CAAC;IAC7B,QAAQ,EAAE,yBAAyB,GAAG,SAAS,CAAC;IAChD,QAAQ,EAAE,OAAO,CAAC;IAClB,kBAAkB,EAAE,OAAO,CAAC;CAC5B,GACC,wBAAwB,CAqJ1B"}
1
+ {"version":3,"file":"gcConfigs.d.ts","sourceRoot":"","sources":["../../src/gc/gcConfigs.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,iBAAiB,EAGjB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AACvD,OAAO,EASN,wBAAwB,EACxB,iBAAiB,EAajB,MAAM,iBAAiB,CAAC;AAGzB;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAChC,EAAE,EAAE,iBAAiB,EACrB,YAAY,EAAE;IACb,SAAS,EAAE,iBAAiB,CAAC;IAC7B,QAAQ,EAAE,yBAAyB,GAAG,SAAS,CAAC;IAChD,QAAQ,EAAE,OAAO,CAAC;IAClB,kBAAkB,EAAE,OAAO,CAAC;CAC5B,GACC,wBAAwB,CA0J1B"}
@@ -20,7 +20,7 @@ const gcHelpers_1 = require("./gcHelpers");
20
20
  function generateGCConfigs(mc, createParams) {
21
21
  let gcEnabled;
22
22
  let sessionExpiryTimeoutMs;
23
- let sweepTimeoutMs;
23
+ let tombstoneTimeoutMs;
24
24
  let persistedGcFeatureMatrix;
25
25
  let gcVersionInBaseSnapshot;
26
26
  /**
@@ -28,21 +28,25 @@ function generateGCConfigs(mc, createParams) {
28
28
  * 1. Whether running GC mark phase is allowed or not.
29
29
  * 2. Whether running GC sweep phase is allowed or not.
30
30
  * 3. Whether GC session expiry is enabled or not.
31
- * For existing containers, we get this information from the createParams.metadata blob of its summary.
31
+ * For existing containers, we get this information from the metadata blob of its summary.
32
32
  */
33
33
  if (createParams.existing) {
34
- gcVersionInBaseSnapshot = (0, gcHelpers_1.getGCVersion)(createParams.metadata);
35
- // Existing documents which did not have createParams.metadata blob or had GC disabled have version as 0. For all
34
+ const metadata = createParams.metadata;
35
+ gcVersionInBaseSnapshot = (0, gcHelpers_1.getGCVersion)(metadata);
36
+ // Existing documents which did not have metadata blob or had GC disabled have version as 0. For all
36
37
  // other existing documents, GC is enabled.
37
38
  gcEnabled = gcVersionInBaseSnapshot > 0;
38
- sessionExpiryTimeoutMs = createParams.metadata?.sessionExpiryTimeoutMs;
39
- sweepTimeoutMs =
40
- createParams.metadata?.sweepTimeoutMs ?? computeSweepTimeout(sessionExpiryTimeoutMs); // Backfill old documents that didn't persist this
41
- persistedGcFeatureMatrix = createParams.metadata?.gcFeatureMatrix;
39
+ sessionExpiryTimeoutMs = metadata?.sessionExpiryTimeoutMs;
40
+ const legacyPersistedSweepTimeoutMs = metadata?.sweepTimeoutMs;
41
+ tombstoneTimeoutMs =
42
+ metadata?.tombstoneTimeoutMs ??
43
+ legacyPersistedSweepTimeoutMs ?? // Backfill old documents that have sweepTimeoutMs instead of tombstoneTimeoutMs
44
+ computeTombstoneTimeout(sessionExpiryTimeoutMs); // Backfill old documents that didn't persist either value
45
+ persistedGcFeatureMatrix = metadata?.gcFeatureMatrix;
42
46
  }
43
47
  else {
44
48
  // This Test Override only applies for new containers
45
- const testOverrideSweepTimeoutMs = mc.config.getNumber("Fluid.GarbageCollection.TestOverride.SweepTimeoutMs");
49
+ const testOverrideTombstoneTimeoutMs = mc.config.getNumber("Fluid.GarbageCollection.TestOverride.TombstoneTimeoutMs");
46
50
  // For new documents, GC is enabled by default. It can be explicitly disabled by setting the gcAllowed
47
51
  // flag in GC options to false.
48
52
  gcEnabled = createParams.gcOptions.gcAllowed !== false;
@@ -51,7 +55,8 @@ function generateGCConfigs(mc, createParams) {
51
55
  sessionExpiryTimeoutMs =
52
56
  createParams.gcOptions.sessionExpiryTimeoutMs ?? gcDefinitions_1.defaultSessionExpiryDurationMs;
53
57
  }
54
- sweepTimeoutMs = testOverrideSweepTimeoutMs ?? computeSweepTimeout(sessionExpiryTimeoutMs);
58
+ tombstoneTimeoutMs =
59
+ testOverrideTombstoneTimeoutMs ?? computeTombstoneTimeout(sessionExpiryTimeoutMs);
55
60
  const gcGeneration = createParams.gcOptions[gcDefinitions_1.gcGenerationOptionName];
56
61
  if (gcGeneration !== undefined) {
57
62
  persistedGcFeatureMatrix = { gcGeneration };
@@ -81,14 +86,14 @@ function generateGCConfigs(mc, createParams) {
81
86
  * Whether sweep should run or not. This refers to whether Tombstones should fail on load and whether
82
87
  * sweep-ready nodes should be deleted.
83
88
  *
84
- * Assuming overall GC is enabled and sweepTimeout is provided, the following conditions have to be met to run sweep:
89
+ * Assuming overall GC is enabled and Tombstone timeout is present, the following conditions have to be met to run sweep:
85
90
  *
86
91
  * 1. Sweep should be enabled for this container.
87
92
  * 2. Sweep should be enabled for this session.
88
93
  *
89
94
  * These conditions can be overridden via the RunSweep feature flag.
90
95
  */
91
- const shouldRunSweep = !shouldRunGC || sweepTimeoutMs === undefined
96
+ const shouldRunSweep = !shouldRunGC || tombstoneTimeoutMs === undefined
92
97
  ? false
93
98
  : mc.config.getBoolean(gcDefinitions_1.runSweepKey) ??
94
99
  (sweepAllowed && createParams.gcOptions.enableGCSweep === true);
@@ -96,9 +101,9 @@ function generateGCConfigs(mc, createParams) {
96
101
  const inactiveTimeoutMs = mc.config.getNumber("Fluid.GarbageCollection.TestOverride.InactiveTimeoutMs") ??
97
102
  createParams.gcOptions.inactiveTimeoutMs ??
98
103
  gcDefinitions_1.defaultInactiveTimeoutMs;
99
- // Inactive timeout must be greater than sweep timeout since a node goes from active -> inactive -> sweep ready.
100
- if (sweepTimeoutMs !== undefined && inactiveTimeoutMs > sweepTimeoutMs) {
101
- throw new telemetry_utils_1.UsageError("inactive timeout should not be greater than the sweep timeout");
104
+ // Inactive timeout must be greater than tombstone timeout since a node goes from active -> inactive -> sweep ready.
105
+ if (tombstoneTimeoutMs !== undefined && inactiveTimeoutMs > tombstoneTimeoutMs) {
106
+ throw new telemetry_utils_1.UsageError("inactive timeout should not be greater than the tombstone timeout");
102
107
  }
103
108
  // Whether we are running in test mode. In this mode, unreferenced nodes are immediately deleted.
104
109
  const testMode = mc.config.getBoolean(gcDefinitions_1.gcTestModeKey) ?? createParams.gcOptions.runGCInTestMode === true;
@@ -126,7 +131,7 @@ function generateGCConfigs(mc, createParams) {
126
131
  testMode,
127
132
  tombstoneMode,
128
133
  sessionExpiryTimeoutMs,
129
- sweepTimeoutMs,
134
+ tombstoneTimeoutMs,
130
135
  sweepGracePeriodMs,
131
136
  inactiveTimeoutMs,
132
137
  persistedGcFeatureMatrix,
@@ -139,14 +144,16 @@ function generateGCConfigs(mc, createParams) {
139
144
  }
140
145
  exports.generateGCConfigs = generateGCConfigs;
141
146
  /**
142
- * Sweep timeout is the time after which unreferenced content can be swept.
143
- * Sweep timeout = session expiry timeout + snapshot cache expiry timeout + one day buffer.
147
+ * Tombstone timeout is the time after which unreferenced content is guaranteed not to be revived (re-referenced).
148
+ * Tombstone timeout = session expiry timeout + snapshot cache expiry timeout + one day buffer.
144
149
  *
145
150
  * The snapshot cache expiry timeout cannot be known precisely but the upper bound is 5 days.
146
151
  * The buffer is added to account for any clock skew or other edge cases.
147
152
  * We use server timestamps throughout so the skew should be minimal but make it 1 day to be safe.
153
+ *
154
+ * If there is no Session Expiry timeout, GC can never guarantee an object won't be revived, so return undefined.
148
155
  */
149
- function computeSweepTimeout(sessionExpiryTimeoutMs) {
156
+ function computeTombstoneTimeout(sessionExpiryTimeoutMs) {
150
157
  const bufferMs = gcDefinitions_1.oneDayMs;
151
158
  return sessionExpiryTimeoutMs && sessionExpiryTimeoutMs + gcDefinitions_1.maxSnapshotCacheExpiryMs + bufferMs;
152
159
  }
@@ -1 +1 @@
1
- {"version":3,"file":"gcConfigs.js","sourceRoot":"","sources":["../../src/gc/gcConfigs.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,qEAIyC;AAEzC,mDAsByB;AACzB,2CAA+D;AAE/D;;;;;;;;GAQG;AACH,SAAgB,iBAAiB,CAChC,EAAqB,EACrB,YAKC;IAED,IAAI,SAAkB,CAAC;IACvB,IAAI,sBAA0C,CAAC;IAC/C,IAAI,cAAkC,CAAC;IACvC,IAAI,wBAAqD,CAAC;IAC1D,IAAI,uBAA8C,CAAC;IAEnD;;;;;;OAMG;IACH,IAAI,YAAY,CAAC,QAAQ,EAAE;QAC1B,uBAAuB,GAAG,IAAA,wBAAY,EAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;QAC9D,iHAAiH;QACjH,2CAA2C;QAC3C,SAAS,GAAG,uBAAuB,GAAG,CAAC,CAAC;QACxC,sBAAsB,GAAG,YAAY,CAAC,QAAQ,EAAE,sBAAsB,CAAC;QACvE,cAAc;YACb,YAAY,CAAC,QAAQ,EAAE,cAAc,IAAI,mBAAmB,CAAC,sBAAsB,CAAC,CAAC,CAAC,kDAAkD;QACzI,wBAAwB,GAAG,YAAY,CAAC,QAAQ,EAAE,eAAe,CAAC;KAClE;SAAM;QACN,qDAAqD;QACrD,MAAM,0BAA0B,GAAG,EAAE,CAAC,MAAM,CAAC,SAAS,CACrD,qDAAqD,CACrD,CAAC;QAEF,sGAAsG;QACtG,+BAA+B;QAC/B,SAAS,GAAG,YAAY,CAAC,SAA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,qBAAqB,GAC1B,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,wCAAwB,CAAC,KAAK,IAAI;QACvD,YAAY;QACZ,CAAC,YAAY,CAAC,kBAAkB,CAAC;IAElC,OAAO;QACN,SAAS;QACT,YAAY,EAAE,YAAY;QAC1B,WAAW;QACX,cAAc;QACd,SAAS;QACT,QAAQ;QACR,aAAa;QACb,sBAAsB;QACtB,cAAc;QACd,kBAAkB;QAClB,iBAAiB;QACjB,wBAAwB;QACxB,uBAAuB;QACvB,iBAAiB;QACjB,mBAAmB;QACnB,oBAAoB;QACpB,qBAAqB;KACrB,CAAC;AACH,CAAC;AA7JD,8CA6JC;AAED;;;;;;;GAOG;AACH,SAAS,mBAAmB,CAAC,sBAA0C;IACtE,MAAM,QAAQ,GAAG,wBAAQ,CAAC;IAC1B,OAAO,sBAAsB,IAAI,sBAAsB,GAAG,wCAAwB,GAAG,QAAQ,CAAC;AAC/F,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tMonitoringContext,\n\tUsageError,\n\tvalidatePrecondition,\n} from \"@fluidframework/telemetry-utils\";\nimport { IContainerRuntimeMetadata } from \"../summary\";\nimport {\n\tnextGCVersion,\n\tdefaultInactiveTimeoutMs,\n\tdefaultSessionExpiryDurationMs,\n\tdisableTombstoneKey,\n\tGCFeatureMatrix,\n\tgcTestModeKey,\n\tGCVersion,\n\tgcVersionUpgradeToV4Key,\n\tIGarbageCollectorConfigs,\n\tIGCRuntimeOptions,\n\tmaxSnapshotCacheExpiryMs,\n\toneDayMs,\n\trunGCKey,\n\trunSessionExpiryKey,\n\trunSweepKey,\n\tstableGCVersion,\n\tthrowOnTombstoneLoadOverrideKey,\n\tthrowOnTombstoneUsageKey,\n\tgcDisableThrowOnTombstoneLoadOptionName,\n\tdefaultSweepGracePeriodMs,\n\tgcGenerationOptionName,\n} from \"./gcDefinitions\";\nimport { getGCVersion, shouldAllowGcSweep } from \"./gcHelpers\";\n\n/**\n * Generates configurations for the Garbage Collector that it uses to determine what to run and how.\n * @param mc - The monitoring context for reading configs from the config provider.\n * @param createParams - The creation params:\n * gcOptions - The garbage collector runtime options.\n * metadata - The container runtime's createParams.metadata.\n * existing - Whether the container is new or an existing one.\n * @returns The garbage collector configurations.\n */\nexport function generateGCConfigs(\n\tmc: MonitoringContext,\n\tcreateParams: {\n\t\tgcOptions: IGCRuntimeOptions;\n\t\tmetadata: IContainerRuntimeMetadata | undefined;\n\t\texisting: boolean;\n\t\tisSummarizerClient: boolean;\n\t},\n): IGarbageCollectorConfigs {\n\tlet gcEnabled: boolean;\n\tlet sessionExpiryTimeoutMs: number | undefined;\n\tlet sweepTimeoutMs: number | undefined;\n\tlet persistedGcFeatureMatrix: GCFeatureMatrix | undefined;\n\tlet gcVersionInBaseSnapshot: GCVersion | undefined;\n\n\t/**\n\t * The following GC state is enabled during container creation and cannot be changed throughout its lifetime:\n\t * 1. Whether running GC mark phase is allowed or not.\n\t * 2. Whether running GC sweep phase is allowed or not.\n\t * 3. Whether GC session expiry is enabled or not.\n\t * For existing containers, we get this information from the createParams.metadata blob of its summary.\n\t */\n\tif (createParams.existing) {\n\t\tgcVersionInBaseSnapshot = getGCVersion(createParams.metadata);\n\t\t// Existing documents which did not have createParams.metadata blob or had GC disabled have version as 0. For all\n\t\t// other existing documents, GC is enabled.\n\t\tgcEnabled = gcVersionInBaseSnapshot > 0;\n\t\tsessionExpiryTimeoutMs = createParams.metadata?.sessionExpiryTimeoutMs;\n\t\tsweepTimeoutMs =\n\t\t\tcreateParams.metadata?.sweepTimeoutMs ?? computeSweepTimeout(sessionExpiryTimeoutMs); // Backfill old documents that didn't persist this\n\t\tpersistedGcFeatureMatrix = createParams.metadata?.gcFeatureMatrix;\n\t} else {\n\t\t// This Test Override only applies for new containers\n\t\tconst testOverrideSweepTimeoutMs = mc.config.getNumber(\n\t\t\t\"Fluid.GarbageCollection.TestOverride.SweepTimeoutMs\",\n\t\t);\n\n\t\t// For new documents, GC is enabled by default. It can be explicitly disabled by setting the gcAllowed\n\t\t// flag in GC options to false.\n\t\tgcEnabled = createParams.gcOptions.gcAllowed !== false;\n\n\t\t// Set the Session Expiry if GC is enabled and session expiry flag isn't explicitly set to false.\n\t\tif (gcEnabled && mc.config.getBoolean(runSessionExpiryKey) !== false) {\n\t\t\tsessionExpiryTimeoutMs =\n\t\t\t\tcreateParams.gcOptions.sessionExpiryTimeoutMs ?? defaultSessionExpiryDurationMs;\n\t\t}\n\t\tsweepTimeoutMs = testOverrideSweepTimeoutMs ?? computeSweepTimeout(sessionExpiryTimeoutMs);\n\n\t\tconst gcGeneration = createParams.gcOptions[gcGenerationOptionName];\n\t\tif (gcGeneration !== undefined) {\n\t\t\tpersistedGcFeatureMatrix = { gcGeneration };\n\t\t}\n\t}\n\n\t// The persisted GC generation must indicate Sweep is allowed for this document,\n\t// according to the GC Generation option provided this session.\n\t// Note that if no generation option is provided, Sweep is allowed for any document.\n\tconst sweepAllowed = shouldAllowGcSweep(\n\t\tpersistedGcFeatureMatrix ?? {} /* featureMatrix */,\n\t\tcreateParams.gcOptions[gcGenerationOptionName] /* currentGeneration */,\n\t);\n\n\t// If version upgrade is not enabled, fall back to the stable GC version.\n\tconst gcVersionInEffect =\n\t\tmc.config.getBoolean(gcVersionUpgradeToV4Key) === true ? nextGCVersion : stableGCVersion;\n\n\t// The GC version is up-to-date if the GC version in effect is at least equal to the GC version in base snapshot.\n\t// If it is not up-to-date, there is a newer version of GC out there which is more reliable than this. So, GC\n\t// should not run as it may produce incorrect / unreliable state.\n\tconst isGCVersionUpToDate =\n\t\tgcVersionInBaseSnapshot === undefined || gcVersionInEffect >= gcVersionInBaseSnapshot;\n\n\t/**\n\t * Whether GC should run or not. The following conditions have to be met to run sweep:\n\t * 1. GC should be enabled for this container.\n\t * 2. GC should not be disabled via disableGC GC option.\n\t * 3. The current GC version should be greater or equal to the GC version in the base snapshot.\n\t *\n\t * These conditions can be overridden via the RunGC feature flag.\n\t */\n\tconst shouldRunGC =\n\t\tmc.config.getBoolean(runGCKey) ??\n\t\t(gcEnabled && !createParams.gcOptions.disableGC && isGCVersionUpToDate);\n\n\t/**\n\t * Whether sweep should run or not. This refers to whether Tombstones should fail on load and whether\n\t * sweep-ready nodes should be deleted.\n\t *\n\t * Assuming overall GC is enabled and sweepTimeout is provided, the following conditions have to be met to run sweep:\n\t *\n\t * 1. Sweep should be enabled for this container.\n\t * 2. Sweep should be enabled for this session.\n\t *\n\t * These conditions can be overridden via the RunSweep feature flag.\n\t */\n\tconst shouldRunSweep =\n\t\t!shouldRunGC || sweepTimeoutMs === undefined\n\t\t\t? false\n\t\t\t: mc.config.getBoolean(runSweepKey) ??\n\t\t\t (sweepAllowed && createParams.gcOptions.enableGCSweep === true);\n\n\t// Override inactive timeout if test config or gc options to override it is set.\n\tconst inactiveTimeoutMs =\n\t\tmc.config.getNumber(\"Fluid.GarbageCollection.TestOverride.InactiveTimeoutMs\") ??\n\t\tcreateParams.gcOptions.inactiveTimeoutMs ??\n\t\tdefaultInactiveTimeoutMs;\n\n\t// Inactive timeout must be greater than sweep timeout since a node goes from active -> inactive -> sweep ready.\n\tif (sweepTimeoutMs !== undefined && inactiveTimeoutMs > sweepTimeoutMs) {\n\t\tthrow new UsageError(\"inactive timeout should not be greater than the sweep timeout\");\n\t}\n\n\t// Whether we are running in test mode. In this mode, unreferenced nodes are immediately deleted.\n\tconst testMode =\n\t\tmc.config.getBoolean(gcTestModeKey) ?? createParams.gcOptions.runGCInTestMode === true;\n\t// Whether we are running in tombstone mode. If disabled, tombstone data will not be written to or read from snapshots,\n\t// and objects will not be marked as tombstoned even if they pass to the \"TombstoneReady\" state during the session.\n\tconst tombstoneMode = mc.config.getBoolean(disableTombstoneKey) !== true;\n\tconst runFullGC = createParams.gcOptions.runFullGC;\n\n\tconst sweepGracePeriodMs =\n\t\tcreateParams.gcOptions.sweepGracePeriodMs ?? defaultSweepGracePeriodMs;\n\tvalidatePrecondition(sweepGracePeriodMs >= 0, \"sweepGracePeriodMs must be non-negative\", {\n\t\tsweepGracePeriodMs,\n\t});\n\n\tconst throwOnInactiveLoad: boolean | undefined = createParams.gcOptions.throwOnInactiveLoad;\n\n\tconst throwOnTombstoneLoadConfig =\n\t\tmc.config.getBoolean(throwOnTombstoneLoadOverrideKey) ??\n\t\tcreateParams.gcOptions[gcDisableThrowOnTombstoneLoadOptionName] !== true;\n\tconst throwOnTombstoneLoad =\n\t\tthrowOnTombstoneLoadConfig && sweepAllowed && !createParams.isSummarizerClient;\n\tconst throwOnTombstoneUsage =\n\t\tmc.config.getBoolean(throwOnTombstoneUsageKey) === true &&\n\t\tsweepAllowed &&\n\t\t!createParams.isSummarizerClient;\n\n\treturn {\n\t\tgcEnabled, // For this document\n\t\tsweepEnabled: sweepAllowed, // For this document (based on current GC Generation option)\n\t\tshouldRunGC, // For this session\n\t\tshouldRunSweep, // For this session\n\t\trunFullGC,\n\t\ttestMode,\n\t\ttombstoneMode,\n\t\tsessionExpiryTimeoutMs,\n\t\tsweepTimeoutMs,\n\t\tsweepGracePeriodMs,\n\t\tinactiveTimeoutMs,\n\t\tpersistedGcFeatureMatrix,\n\t\tgcVersionInBaseSnapshot,\n\t\tgcVersionInEffect,\n\t\tthrowOnInactiveLoad,\n\t\tthrowOnTombstoneLoad,\n\t\tthrowOnTombstoneUsage,\n\t};\n}\n\n/**\n * Sweep timeout is the time after which unreferenced content can be swept.\n * Sweep timeout = session expiry timeout + snapshot cache expiry timeout + one day buffer.\n *\n * The snapshot cache expiry timeout cannot be known precisely but the upper bound is 5 days.\n * The buffer is added to account for any clock skew or other edge cases.\n * We use server timestamps throughout so the skew should be minimal but make it 1 day to be safe.\n */\nfunction computeSweepTimeout(sessionExpiryTimeoutMs: number | undefined): number | undefined {\n\tconst bufferMs = oneDayMs;\n\treturn sessionExpiryTimeoutMs && sessionExpiryTimeoutMs + maxSnapshotCacheExpiryMs + bufferMs;\n}\n"]}
1
+ {"version":3,"file":"gcConf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;QACT,QAAQ;QACR,aAAa;QACb,sBAAsB;QACtB,kBAAkB;QAClB,kBAAkB;QAClB,iBAAiB;QACjB,wBAAwB;QACxB,uBAAuB;QACvB,iBAAiB;QACjB,mBAAmB;QACnB,oBAAoB;QACpB,qBAAqB;KACrB,CAAC;AACH,CAAC;AAlKD,8CAkKC;AAED;;;;;;;;;GASG;AACH,SAAS,uBAAuB,CAAC,sBAA0C;IAC1E,MAAM,QAAQ,GAAG,wBAAQ,CAAC;IAC1B,OAAO,sBAAsB,IAAI,sBAAsB,GAAG,wCAAwB,GAAG,QAAQ,CAAC;AAC/F,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tMonitoringContext,\n\tUsageError,\n\tvalidatePrecondition,\n} from \"@fluidframework/telemetry-utils\";\nimport { IContainerRuntimeMetadata } from \"../summary\";\nimport {\n\tnextGCVersion,\n\tdefaultInactiveTimeoutMs,\n\tdefaultSessionExpiryDurationMs,\n\tdisableTombstoneKey,\n\tGCFeatureMatrix,\n\tgcTestModeKey,\n\tGCVersion,\n\tgcVersionUpgradeToV4Key,\n\tIGarbageCollectorConfigs,\n\tIGCRuntimeOptions,\n\tmaxSnapshotCacheExpiryMs,\n\toneDayMs,\n\trunGCKey,\n\trunSessionExpiryKey,\n\trunSweepKey,\n\tstableGCVersion,\n\tthrowOnTombstoneLoadOverrideKey,\n\tthrowOnTombstoneUsageKey,\n\tgcDisableThrowOnTombstoneLoadOptionName,\n\tdefaultSweepGracePeriodMs,\n\tgcGenerationOptionName,\n\tIGCMetadata_Deprecated,\n} from \"./gcDefinitions\";\nimport { getGCVersion, shouldAllowGcSweep } from \"./gcHelpers\";\n\n/**\n * Generates configurations for the Garbage Collector that it uses to determine what to run and how.\n * @param mc - The monitoring context for reading configs from the config provider.\n * @param createParams - The creation params:\n * gcOptions - The garbage collector runtime options.\n * metadata - The container runtime's createParams.metadata.\n * existing - Whether the container is new or an existing one.\n * @returns The garbage collector configurations.\n */\nexport function generateGCConfigs(\n\tmc: MonitoringContext,\n\tcreateParams: {\n\t\tgcOptions: IGCRuntimeOptions;\n\t\tmetadata: IContainerRuntimeMetadata | undefined;\n\t\texisting: boolean;\n\t\tisSummarizerClient: boolean;\n\t},\n): IGarbageCollectorConfigs {\n\tlet gcEnabled: boolean;\n\tlet sessionExpiryTimeoutMs: number | undefined;\n\tlet tombstoneTimeoutMs: number | undefined;\n\tlet persistedGcFeatureMatrix: GCFeatureMatrix | undefined;\n\tlet gcVersionInBaseSnapshot: GCVersion | undefined;\n\n\t/**\n\t * The following GC state is enabled during container creation and cannot be changed throughout its lifetime:\n\t * 1. Whether running GC mark phase is allowed or not.\n\t * 2. Whether running GC sweep phase is allowed or not.\n\t * 3. Whether GC session expiry is enabled or not.\n\t * For existing containers, we get this information from the metadata blob of its summary.\n\t */\n\tif (createParams.existing) {\n\t\tconst metadata = createParams.metadata;\n\t\tgcVersionInBaseSnapshot = getGCVersion(metadata);\n\t\t// Existing documents which did not have metadata blob or had GC disabled have version as 0. For all\n\t\t// other existing documents, GC is enabled.\n\t\tgcEnabled = gcVersionInBaseSnapshot > 0;\n\t\tsessionExpiryTimeoutMs = metadata?.sessionExpiryTimeoutMs;\n\t\tconst legacyPersistedSweepTimeoutMs = (metadata as IGCMetadata_Deprecated)?.sweepTimeoutMs;\n\t\ttombstoneTimeoutMs =\n\t\t\tmetadata?.tombstoneTimeoutMs ??\n\t\t\tlegacyPersistedSweepTimeoutMs ?? // Backfill old documents that have sweepTimeoutMs instead of tombstoneTimeoutMs\n\t\t\tcomputeTombstoneTimeout(sessionExpiryTimeoutMs); // Backfill old documents that didn't persist either value\n\t\tpersistedGcFeatureMatrix = metadata?.gcFeatureMatrix;\n\t} else {\n\t\t// This Test Override only applies for new containers\n\t\tconst testOverrideTombstoneTimeoutMs = mc.config.getNumber(\n\t\t\t\"Fluid.GarbageCollection.TestOverride.TombstoneTimeoutMs\",\n\t\t);\n\n\t\t// For new documents, GC is enabled by default. It can be explicitly disabled by setting the gcAllowed\n\t\t// flag in GC options to false.\n\t\tgcEnabled = createParams.gcOptions.gcAllowed !== false;\n\n\t\t// Set the Session Expiry if GC is enabled and session expiry flag isn't explicitly set to false.\n\t\tif (gcEnabled && mc.config.getBoolean(runSessionExpiryKey) !== false) {\n\t\t\tsessionExpiryTimeoutMs =\n\t\t\t\tcreateParams.gcOptions.sessionExpiryTimeoutMs ?? defaultSessionExpiryDurationMs;\n\t\t}\n\t\ttombstoneTimeoutMs =\n\t\t\ttestOverrideTombstoneTimeoutMs ?? computeTombstoneTimeout(sessionExpiryTimeoutMs);\n\n\t\tconst gcGeneration = createParams.gcOptions[gcGenerationOptionName];\n\t\tif (gcGeneration !== undefined) {\n\t\t\tpersistedGcFeatureMatrix = { gcGeneration };\n\t\t}\n\t}\n\n\t// The persisted GC generation must indicate Sweep is allowed for this document,\n\t// according to the GC Generation option provided this session.\n\t// Note that if no generation option is provided, Sweep is allowed for any document.\n\tconst sweepAllowed = shouldAllowGcSweep(\n\t\tpersistedGcFeatureMatrix ?? {} /* featureMatrix */,\n\t\tcreateParams.gcOptions[gcGenerationOptionName] /* currentGeneration */,\n\t);\n\n\t// If version upgrade is not enabled, fall back to the stable GC version.\n\tconst gcVersionInEffect =\n\t\tmc.config.getBoolean(gcVersionUpgradeToV4Key) === true ? nextGCVersion : stableGCVersion;\n\n\t// The GC version is up-to-date if the GC version in effect is at least equal to the GC version in base snapshot.\n\t// If it is not up-to-date, there is a newer version of GC out there which is more reliable than this. So, GC\n\t// should not run as it may produce incorrect / unreliable state.\n\tconst isGCVersionUpToDate =\n\t\tgcVersionInBaseSnapshot === undefined || gcVersionInEffect >= gcVersionInBaseSnapshot;\n\n\t/**\n\t * Whether GC should run or not. The following conditions have to be met to run sweep:\n\t * 1. GC should be enabled for this container.\n\t * 2. GC should not be disabled via disableGC GC option.\n\t * 3. The current GC version should be greater or equal to the GC version in the base snapshot.\n\t *\n\t * These conditions can be overridden via the RunGC feature flag.\n\t */\n\tconst shouldRunGC =\n\t\tmc.config.getBoolean(runGCKey) ??\n\t\t(gcEnabled && !createParams.gcOptions.disableGC && isGCVersionUpToDate);\n\n\t/**\n\t * Whether sweep should run or not. This refers to whether Tombstones should fail on load and whether\n\t * sweep-ready nodes should be deleted.\n\t *\n\t * Assuming overall GC is enabled and Tombstone timeout is present, the following conditions have to be met to run sweep:\n\t *\n\t * 1. Sweep should be enabled for this container.\n\t * 2. Sweep should be enabled for this session.\n\t *\n\t * These conditions can be overridden via the RunSweep feature flag.\n\t */\n\tconst shouldRunSweep =\n\t\t!shouldRunGC || tombstoneTimeoutMs === undefined\n\t\t\t? false\n\t\t\t: mc.config.getBoolean(runSweepKey) ??\n\t\t\t (sweepAllowed && createParams.gcOptions.enableGCSweep === true);\n\n\t// Override inactive timeout if test config or gc options to override it is set.\n\tconst inactiveTimeoutMs =\n\t\tmc.config.getNumber(\"Fluid.GarbageCollection.TestOverride.InactiveTimeoutMs\") ??\n\t\tcreateParams.gcOptions.inactiveTimeoutMs ??\n\t\tdefaultInactiveTimeoutMs;\n\n\t// Inactive timeout must be greater than tombstone timeout since a node goes from active -> inactive -> sweep ready.\n\tif (tombstoneTimeoutMs !== undefined && inactiveTimeoutMs > tombstoneTimeoutMs) {\n\t\tthrow new UsageError(\"inactive timeout should not be greater than the tombstone timeout\");\n\t}\n\n\t// Whether we are running in test mode. In this mode, unreferenced nodes are immediately deleted.\n\tconst testMode =\n\t\tmc.config.getBoolean(gcTestModeKey) ?? createParams.gcOptions.runGCInTestMode === true;\n\t// Whether we are running in tombstone mode. If disabled, tombstone data will not be written to or read from snapshots,\n\t// and objects will not be marked as tombstoned even if they pass to the \"TombstoneReady\" state during the session.\n\tconst tombstoneMode = mc.config.getBoolean(disableTombstoneKey) !== true;\n\tconst runFullGC = createParams.gcOptions.runFullGC;\n\n\tconst sweepGracePeriodMs =\n\t\tcreateParams.gcOptions.sweepGracePeriodMs ?? defaultSweepGracePeriodMs;\n\tvalidatePrecondition(sweepGracePeriodMs >= 0, \"sweepGracePeriodMs must be non-negative\", {\n\t\tsweepGracePeriodMs,\n\t});\n\n\tconst throwOnInactiveLoad: boolean | undefined = createParams.gcOptions.throwOnInactiveLoad;\n\n\tconst throwOnTombstoneLoadConfig =\n\t\tmc.config.getBoolean(throwOnTombstoneLoadOverrideKey) ??\n\t\tcreateParams.gcOptions[gcDisableThrowOnTombstoneLoadOptionName] !== true;\n\tconst throwOnTombstoneLoad =\n\t\tthrowOnTombstoneLoadConfig && sweepAllowed && !createParams.isSummarizerClient;\n\tconst throwOnTombstoneUsage =\n\t\tmc.config.getBoolean(throwOnTombstoneUsageKey) === true &&\n\t\tsweepAllowed &&\n\t\t!createParams.isSummarizerClient;\n\n\treturn {\n\t\tgcEnabled, // For this document\n\t\tsweepEnabled: sweepAllowed, // For this document (based on current GC Generation option)\n\t\tshouldRunGC, // For this session\n\t\tshouldRunSweep, // For this session\n\t\trunFullGC,\n\t\ttestMode,\n\t\ttombstoneMode,\n\t\tsessionExpiryTimeoutMs,\n\t\ttombstoneTimeoutMs,\n\t\tsweepGracePeriodMs,\n\t\tinactiveTimeoutMs,\n\t\tpersistedGcFeatureMatrix,\n\t\tgcVersionInBaseSnapshot,\n\t\tgcVersionInEffect,\n\t\tthrowOnInactiveLoad,\n\t\tthrowOnTombstoneLoad,\n\t\tthrowOnTombstoneUsage,\n\t};\n}\n\n/**\n * Tombstone timeout is the time after which unreferenced content is guaranteed not to be revived (re-referenced).\n * Tombstone timeout = session expiry timeout + snapshot cache expiry timeout + one day buffer.\n *\n * The snapshot cache expiry timeout cannot be known precisely but the upper bound is 5 days.\n * The buffer is added to account for any clock skew or other edge cases.\n * We use server timestamps throughout so the skew should be minimal but make it 1 day to be safe.\n *\n * If there is no Session Expiry timeout, GC can never guarantee an object won't be revived, so return undefined.\n */\nfunction computeTombstoneTimeout(sessionExpiryTimeoutMs: number | undefined): number | undefined {\n\tconst bufferMs = oneDayMs;\n\treturn sessionExpiryTimeoutMs && sessionExpiryTimeoutMs + maxSnapshotCacheExpiryMs + bufferMs;\n}\n"]}
@@ -58,10 +58,12 @@ export declare const gcVersionUpgradeToV4Key = "Fluid.GarbageCollection.GCVersio
58
58
  export declare const disableDatastoreSweepKey = "Fluid.GarbageCollection.DisableDataStoreSweep";
59
59
  /** Config key to disable GC sweep for attachment blobs. */
60
60
  export declare const disableAttachmentBlobSweepKey = "Fluid.GarbageCollection.DisableAttachmentBlobSweep";
61
+ /** Config key to revert new paradigm of detecting outbound routes in ContainerRuntime layer (use true) */
62
+ export declare const detectOutboundRoutesViaDDSKey = "Fluid.GarbageCollection.DetectOutboundRoutesViaDDS";
61
63
  export declare const oneDayMs: number;
62
64
  /**
63
- * The maximum snapshot cache expiry in the driver. This is used to calculate the sweep timeout.
64
- * Sweep timeout = session expiry timeout + snapshot cache expiry timeout + a buffer.
65
+ * The maximum snapshot cache expiry in the driver. This is used to calculate the tombstone timeout.
66
+ * Tombstone timeout = session expiry timeout + snapshot cache expiry timeout + a buffer.
65
67
  * The snapshot cache expiry timeout cannot be known precisely but the upper bound is 5 days, i.e., any snapshot
66
68
  * in cache will be invalidated before 5 days.
67
69
  */
@@ -90,6 +92,20 @@ export type GCFeatureMatrix = {
90
92
  tombstoneGeneration: number;
91
93
  };
92
94
  /**
95
+ * Deprecated properties formerly included in @see IGCMetadata.
96
+ * These may be found in old snapshots, so we need to support them for backwards compatibility.
97
+ */
98
+ export interface IGCMetadata_Deprecated {
99
+ /**
100
+ * How long to wait after an object is unreferenced before deleting it via GC Sweep
101
+ *
102
+ * @deprecated Replaced by @see IGCMetadata.tombstoneTimeoutMs
103
+ */
104
+ readonly sweepTimeoutMs?: number;
105
+ }
106
+ /**
107
+ * GC-specific metadata to be written into the summary.
108
+ *
93
109
  * @alpha
94
110
  */
95
111
  export interface IGCMetadata {
@@ -123,8 +139,15 @@ export interface IGCMetadata {
123
139
  readonly sweepEnabled?: boolean;
124
140
  /** If this is present, the session for this container will expire after this time and the container will close */
125
141
  readonly sessionExpiryTimeoutMs?: number;
126
- /** How long to wait after an object is unreferenced before deleting it via GC Sweep */
127
- readonly sweepTimeoutMs?: number;
142
+ /**
143
+ * How long to wait after an object is unreferenced before it becomes a Tombstone.
144
+ *
145
+ * After this point, there's a grace period before the object is deleted.
146
+ * @see IGCRuntimeOptions.sweepGracePeriodMs
147
+ *
148
+ * So the full sweep timeout in a session is tombstoneTimeoutMs + sweepGracePeriodMs.
149
+ */
150
+ readonly tombstoneTimeoutMs?: number;
128
151
  }
129
152
  /**
130
153
  * The statistics of the system state after a garbage collection mark phase run.
@@ -381,8 +404,8 @@ export interface IGarbageCollectorConfigs {
381
404
  readonly runFullGC: boolean | undefined;
382
405
  /** The time in ms to expire a session for a client for gc. */
383
406
  readonly sessionExpiryTimeoutMs: number | undefined;
384
- /** The time after which an unreferenced node is ready to be swept. */
385
- readonly sweepTimeoutMs: number | undefined;
407
+ /** The time after which an unreferenced node can be Tombstoned - i.e. GC knows it can't be referenced again (revived). */
408
+ readonly tombstoneTimeoutMs: number | undefined;
386
409
  /**
387
410
  * The delay between tombstone and sweep. Not persisted, so concurrent sessions may use different values.
388
411
  * Sweep is implemented in an eventually-consistent way so this is acceptable.