@fluidframework/container-runtime 2.0.0-internal.5.1.1 → 2.0.0-internal.5.3.0

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 (248) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/blobManager.d.ts +5 -2
  3. package/dist/blobManager.d.ts.map +1 -1
  4. package/dist/blobManager.js +51 -22
  5. package/dist/blobManager.js.map +1 -1
  6. package/dist/connectionTelemetry.d.ts.map +1 -1
  7. package/dist/connectionTelemetry.js +8 -1
  8. package/dist/connectionTelemetry.js.map +1 -1
  9. package/dist/containerRuntime.d.ts +5 -0
  10. package/dist/containerRuntime.d.ts.map +1 -1
  11. package/dist/containerRuntime.js +27 -7
  12. package/dist/containerRuntime.js.map +1 -1
  13. package/dist/dataStoreContext.d.ts +1 -2
  14. package/dist/dataStoreContext.d.ts.map +1 -1
  15. package/dist/dataStoreContext.js +4 -3
  16. package/dist/dataStoreContext.js.map +1 -1
  17. package/dist/dataStoreContexts.d.ts +2 -1
  18. package/dist/dataStoreContexts.d.ts.map +1 -1
  19. package/dist/dataStoreContexts.js +2 -1
  20. package/dist/dataStoreContexts.js.map +1 -1
  21. package/dist/dataStores.d.ts +1 -1
  22. package/dist/dataStores.d.ts.map +1 -1
  23. package/dist/dataStores.js +2 -1
  24. package/dist/dataStores.js.map +1 -1
  25. package/dist/gc/garbageCollection.d.ts.map +1 -1
  26. package/dist/gc/garbageCollection.js +4 -3
  27. package/dist/gc/garbageCollection.js.map +1 -1
  28. package/dist/gc/gcDefinitions.d.ts +0 -1
  29. package/dist/gc/gcDefinitions.d.ts.map +1 -1
  30. package/dist/gc/gcDefinitions.js.map +1 -1
  31. package/dist/gc/gcTelemetry.d.ts +1 -1
  32. package/dist/gc/gcTelemetry.d.ts.map +1 -1
  33. package/dist/gc/gcTelemetry.js.map +1 -1
  34. package/dist/index.d.ts +1 -1
  35. package/dist/index.d.ts.map +1 -1
  36. package/dist/index.js.map +1 -1
  37. package/dist/metadata.d.ts +18 -0
  38. package/dist/metadata.d.ts.map +1 -0
  39. package/dist/metadata.js +7 -0
  40. package/dist/metadata.js.map +1 -0
  41. package/dist/opLifecycle/batchManager.d.ts +2 -1
  42. package/dist/opLifecycle/batchManager.d.ts.map +1 -1
  43. package/dist/opLifecycle/batchManager.js +5 -1
  44. package/dist/opLifecycle/batchManager.js.map +1 -1
  45. package/dist/opLifecycle/definitions.d.ts +11 -0
  46. package/dist/opLifecycle/definitions.d.ts.map +1 -1
  47. package/dist/opLifecycle/definitions.js.map +1 -1
  48. package/dist/opLifecycle/index.d.ts +1 -1
  49. package/dist/opLifecycle/index.d.ts.map +1 -1
  50. package/dist/opLifecycle/index.js +2 -1
  51. package/dist/opLifecycle/index.js.map +1 -1
  52. package/dist/opLifecycle/opDecompressor.d.ts.map +1 -1
  53. package/dist/opLifecycle/opDecompressor.js +14 -8
  54. package/dist/opLifecycle/opDecompressor.js.map +1 -1
  55. package/dist/opLifecycle/opGroupingManager.d.ts +1 -1
  56. package/dist/opLifecycle/opGroupingManager.d.ts.map +1 -1
  57. package/dist/opLifecycle/opGroupingManager.js +2 -6
  58. package/dist/opLifecycle/opGroupingManager.js.map +1 -1
  59. package/dist/opLifecycle/opSplitter.d.ts.map +1 -1
  60. package/dist/opLifecycle/opSplitter.js +2 -0
  61. package/dist/opLifecycle/opSplitter.js.map +1 -1
  62. package/dist/opLifecycle/outbox.d.ts +33 -2
  63. package/dist/opLifecycle/outbox.d.ts.map +1 -1
  64. package/dist/opLifecycle/outbox.js +128 -42
  65. package/dist/opLifecycle/outbox.js.map +1 -1
  66. package/dist/opLifecycle/remoteMessageProcessor.d.ts.map +1 -1
  67. package/dist/opLifecycle/remoteMessageProcessor.js +3 -1
  68. package/dist/opLifecycle/remoteMessageProcessor.js.map +1 -1
  69. package/dist/packageVersion.d.ts +1 -1
  70. package/dist/packageVersion.js +1 -1
  71. package/dist/packageVersion.js.map +1 -1
  72. package/dist/pendingStateManager.d.ts +7 -2
  73. package/dist/pendingStateManager.d.ts.map +1 -1
  74. package/dist/pendingStateManager.js +36 -21
  75. package/dist/pendingStateManager.js.map +1 -1
  76. package/dist/scheduleManager.d.ts.map +1 -1
  77. package/dist/scheduleManager.js +8 -2
  78. package/dist/scheduleManager.js.map +1 -1
  79. package/dist/summary/index.d.ts +1 -1
  80. package/dist/summary/index.d.ts.map +1 -1
  81. package/dist/summary/index.js.map +1 -1
  82. package/dist/summary/runningSummarizer.d.ts +1 -1
  83. package/dist/summary/runningSummarizer.d.ts.map +1 -1
  84. package/dist/summary/runningSummarizer.js.map +1 -1
  85. package/dist/summary/summarizerNode/summarizerNode.d.ts +1 -1
  86. package/dist/summary/summarizerNode/summarizerNode.d.ts.map +1 -1
  87. package/dist/summary/summarizerNode/summarizerNode.js +3 -3
  88. package/dist/summary/summarizerNode/summarizerNode.js.map +1 -1
  89. package/dist/summary/summarizerNode/summarizerNodeWithGc.d.ts.map +1 -1
  90. package/dist/summary/summarizerNode/summarizerNodeWithGc.js +3 -2
  91. package/dist/summary/summarizerNode/summarizerNodeWithGc.js.map +1 -1
  92. package/dist/summary/summarizerTypes.d.ts +2 -1
  93. package/dist/summary/summarizerTypes.d.ts.map +1 -1
  94. package/dist/summary/summarizerTypes.js.map +1 -1
  95. package/dist/summary/summaryCollection.d.ts +2 -1
  96. package/dist/summary/summaryCollection.d.ts.map +1 -1
  97. package/dist/summary/summaryCollection.js +4 -0
  98. package/dist/summary/summaryCollection.js.map +1 -1
  99. package/dist/summary/summaryFormat.d.ts +1 -0
  100. package/dist/summary/summaryFormat.d.ts.map +1 -1
  101. package/dist/summary/summaryFormat.js +2 -1
  102. package/dist/summary/summaryFormat.js.map +1 -1
  103. package/dist/summary/summaryGenerator.d.ts +1 -1
  104. package/dist/summary/summaryGenerator.d.ts.map +1 -1
  105. package/dist/summary/summaryGenerator.js.map +1 -1
  106. package/dist/summary/summaryManager.d.ts +2 -1
  107. package/dist/summary/summaryManager.d.ts.map +1 -1
  108. package/dist/summary/summaryManager.js.map +1 -1
  109. package/lib/blobManager.d.ts +5 -2
  110. package/lib/blobManager.d.ts.map +1 -1
  111. package/lib/blobManager.js +51 -22
  112. package/lib/blobManager.js.map +1 -1
  113. package/lib/connectionTelemetry.d.ts.map +1 -1
  114. package/lib/connectionTelemetry.js +8 -1
  115. package/lib/connectionTelemetry.js.map +1 -1
  116. package/lib/containerRuntime.d.ts +5 -0
  117. package/lib/containerRuntime.d.ts.map +1 -1
  118. package/lib/containerRuntime.js +29 -9
  119. package/lib/containerRuntime.js.map +1 -1
  120. package/lib/dataStoreContext.d.ts +1 -2
  121. package/lib/dataStoreContext.d.ts.map +1 -1
  122. package/lib/dataStoreContext.js +4 -3
  123. package/lib/dataStoreContext.js.map +1 -1
  124. package/lib/dataStoreContexts.d.ts +2 -1
  125. package/lib/dataStoreContexts.d.ts.map +1 -1
  126. package/lib/dataStoreContexts.js +2 -1
  127. package/lib/dataStoreContexts.js.map +1 -1
  128. package/lib/dataStores.d.ts +1 -1
  129. package/lib/dataStores.d.ts.map +1 -1
  130. package/lib/dataStores.js +2 -1
  131. package/lib/dataStores.js.map +1 -1
  132. package/lib/gc/garbageCollection.d.ts.map +1 -1
  133. package/lib/gc/garbageCollection.js +2 -1
  134. package/lib/gc/garbageCollection.js.map +1 -1
  135. package/lib/gc/gcDefinitions.d.ts +0 -1
  136. package/lib/gc/gcDefinitions.d.ts.map +1 -1
  137. package/lib/gc/gcDefinitions.js.map +1 -1
  138. package/lib/gc/gcTelemetry.d.ts +1 -1
  139. package/lib/gc/gcTelemetry.d.ts.map +1 -1
  140. package/lib/gc/gcTelemetry.js.map +1 -1
  141. package/lib/index.d.ts +1 -1
  142. package/lib/index.d.ts.map +1 -1
  143. package/lib/index.js.map +1 -1
  144. package/lib/metadata.d.ts +18 -0
  145. package/lib/metadata.d.ts.map +1 -0
  146. package/lib/metadata.js +6 -0
  147. package/lib/metadata.js.map +1 -0
  148. package/lib/opLifecycle/batchManager.d.ts +2 -1
  149. package/lib/opLifecycle/batchManager.d.ts.map +1 -1
  150. package/lib/opLifecycle/batchManager.js +5 -1
  151. package/lib/opLifecycle/batchManager.js.map +1 -1
  152. package/lib/opLifecycle/definitions.d.ts +11 -0
  153. package/lib/opLifecycle/definitions.d.ts.map +1 -1
  154. package/lib/opLifecycle/definitions.js.map +1 -1
  155. package/lib/opLifecycle/index.d.ts +1 -1
  156. package/lib/opLifecycle/index.d.ts.map +1 -1
  157. package/lib/opLifecycle/index.js +1 -1
  158. package/lib/opLifecycle/index.js.map +1 -1
  159. package/lib/opLifecycle/opDecompressor.d.ts.map +1 -1
  160. package/lib/opLifecycle/opDecompressor.js +14 -8
  161. package/lib/opLifecycle/opDecompressor.js.map +1 -1
  162. package/lib/opLifecycle/opGroupingManager.d.ts +1 -1
  163. package/lib/opLifecycle/opGroupingManager.d.ts.map +1 -1
  164. package/lib/opLifecycle/opGroupingManager.js +2 -6
  165. package/lib/opLifecycle/opGroupingManager.js.map +1 -1
  166. package/lib/opLifecycle/opSplitter.d.ts.map +1 -1
  167. package/lib/opLifecycle/opSplitter.js +2 -0
  168. package/lib/opLifecycle/opSplitter.js.map +1 -1
  169. package/lib/opLifecycle/outbox.d.ts +33 -2
  170. package/lib/opLifecycle/outbox.d.ts.map +1 -1
  171. package/lib/opLifecycle/outbox.js +126 -41
  172. package/lib/opLifecycle/outbox.js.map +1 -1
  173. package/lib/opLifecycle/remoteMessageProcessor.d.ts.map +1 -1
  174. package/lib/opLifecycle/remoteMessageProcessor.js +3 -1
  175. package/lib/opLifecycle/remoteMessageProcessor.js.map +1 -1
  176. package/lib/packageVersion.d.ts +1 -1
  177. package/lib/packageVersion.js +1 -1
  178. package/lib/packageVersion.js.map +1 -1
  179. package/lib/pendingStateManager.d.ts +7 -2
  180. package/lib/pendingStateManager.d.ts.map +1 -1
  181. package/lib/pendingStateManager.js +36 -21
  182. package/lib/pendingStateManager.js.map +1 -1
  183. package/lib/scheduleManager.d.ts.map +1 -1
  184. package/lib/scheduleManager.js +8 -2
  185. package/lib/scheduleManager.js.map +1 -1
  186. package/lib/summary/index.d.ts +1 -1
  187. package/lib/summary/index.d.ts.map +1 -1
  188. package/lib/summary/index.js.map +1 -1
  189. package/lib/summary/runningSummarizer.d.ts +1 -1
  190. package/lib/summary/runningSummarizer.d.ts.map +1 -1
  191. package/lib/summary/runningSummarizer.js.map +1 -1
  192. package/lib/summary/summarizerNode/summarizerNode.d.ts +1 -1
  193. package/lib/summary/summarizerNode/summarizerNode.d.ts.map +1 -1
  194. package/lib/summary/summarizerNode/summarizerNode.js +3 -3
  195. package/lib/summary/summarizerNode/summarizerNode.js.map +1 -1
  196. package/lib/summary/summarizerNode/summarizerNodeWithGc.d.ts.map +1 -1
  197. package/lib/summary/summarizerNode/summarizerNodeWithGc.js +2 -1
  198. package/lib/summary/summarizerNode/summarizerNodeWithGc.js.map +1 -1
  199. package/lib/summary/summarizerTypes.d.ts +2 -1
  200. package/lib/summary/summarizerTypes.d.ts.map +1 -1
  201. package/lib/summary/summarizerTypes.js.map +1 -1
  202. package/lib/summary/summaryCollection.d.ts +2 -1
  203. package/lib/summary/summaryCollection.d.ts.map +1 -1
  204. package/lib/summary/summaryCollection.js +4 -0
  205. package/lib/summary/summaryCollection.js.map +1 -1
  206. package/lib/summary/summaryFormat.d.ts +1 -0
  207. package/lib/summary/summaryFormat.d.ts.map +1 -1
  208. package/lib/summary/summaryFormat.js +2 -1
  209. package/lib/summary/summaryFormat.js.map +1 -1
  210. package/lib/summary/summaryGenerator.d.ts +1 -1
  211. package/lib/summary/summaryGenerator.d.ts.map +1 -1
  212. package/lib/summary/summaryGenerator.js.map +1 -1
  213. package/lib/summary/summaryManager.d.ts +2 -1
  214. package/lib/summary/summaryManager.d.ts.map +1 -1
  215. package/lib/summary/summaryManager.js.map +1 -1
  216. package/package.json +20 -19
  217. package/src/blobManager.ts +68 -27
  218. package/src/connectionTelemetry.ts +10 -1
  219. package/src/containerRuntime.ts +37 -14
  220. package/src/dataStoreContext.ts +12 -5
  221. package/src/dataStoreContexts.ts +4 -2
  222. package/src/dataStores.ts +8 -3
  223. package/src/gc/garbageCollection.ts +2 -1
  224. package/src/gc/gcDefinitions.ts +0 -1
  225. package/src/gc/gcTelemetry.ts +1 -1
  226. package/src/index.ts +1 -0
  227. package/src/metadata.ts +19 -0
  228. package/src/opLifecycle/README.md +20 -0
  229. package/src/opLifecycle/batchManager.ts +9 -1
  230. package/src/opLifecycle/definitions.ts +11 -0
  231. package/src/opLifecycle/index.ts +1 -1
  232. package/src/opLifecycle/opDecompressor.ts +41 -13
  233. package/src/opLifecycle/opGroupingManager.ts +14 -7
  234. package/src/opLifecycle/opSplitter.ts +3 -1
  235. package/src/opLifecycle/outbox.ts +163 -49
  236. package/src/opLifecycle/remoteMessageProcessor.ts +5 -1
  237. package/src/packageVersion.ts +1 -1
  238. package/src/pendingStateManager.ts +56 -41
  239. package/src/scheduleManager.ts +15 -6
  240. package/src/summary/index.ts +1 -0
  241. package/src/summary/runningSummarizer.ts +1 -1
  242. package/src/summary/summarizerNode/summarizerNode.ts +4 -4
  243. package/src/summary/summarizerNode/summarizerNodeWithGc.ts +2 -1
  244. package/src/summary/summarizerTypes.ts +2 -1
  245. package/src/summary/summaryCollection.ts +8 -3
  246. package/src/summary/summaryFormat.ts +5 -1
  247. package/src/summary/summaryGenerator.ts +1 -1
  248. package/src/summary/summaryManager.ts +2 -1
@@ -1 +1 @@
1
- {"version":3,"file":"summaryManager.js","sourceRoot":"","sources":["../../src/summary/summaryManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AACtD,OAAO,EACN,WAAW,EAEX,gBAAgB,GAChB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAKrE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,MAAM,qBAAqB,GAAG,IAAI,CAAC;AACnC,MAAM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AAG,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE;gBAClD,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,EAAE,OAAO,CAAC,CAAC;YAC9C,CAAC,CAAC,CAAC;YACH,4EAA4E;YAC5E,MAAM,SAAS,GAAG,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE;gBAC/C,kBAAkB,GAAG,OAAO,CAAC;YAC9B,CAAC,CAAC,CAAC;YACH,IAAI,CAAC,iBAAiB,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC;YACpD,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC,CAAC;YAC9C,IAAI,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,aAAa,CAAC,CAAC;SACvD;QACD,OAAO,qBAAqB,CAAC;IAC9B,CAAC;IAkBM,OAAO;QACb,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,0BAA0B,EAAE,IAAI,CAAC,iBAAiB,CAAC,CAAC;QAC5E,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,WAAW,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;QAC3D,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,cAAc,EAAE,IAAI,CAAC,kBAAkB,CAAC,CAAC;QACjE,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;IACvB,CAAC;;AAxRuB,kCAAmB,GAAG,CAAC,KAA0B,EAAE,EAAE,CAC5E,KAAK,KAAK,mBAAmB,CAAC,QAAQ,IAAI,KAAK,KAAK,mBAAmB,CAAC,OAAO,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IDisposable, IEvent, IEventProvider } from \"@fluidframework/common-definitions\";\nimport { assert } from \"@fluidframework/common-utils\";\nimport {\n\tChildLogger,\n\tITelemetryLoggerExt,\n\tPerformanceEvent,\n} from \"@fluidframework/telemetry-utils\";\nimport { DriverErrorType } from \"@fluidframework/driver-definitions\";\nimport { IThrottler } from \"../throttler\";\nimport { ISummarizerClientElection } from \"./summarizerClientElection\";\nimport { ISummarizer, SummarizerStopReason } from \"./summarizerTypes\";\nimport { SummaryCollection } from \"./summaryCollection\";\nimport { Summarizer } from \"./summarizer\";\n\nconst defaultInitialDelayMs = 5000;\nconst defaultOpsToBypassInitialDelay = 4000;\n\nexport enum SummaryManagerState {\n\tOff = 0,\n\tStarting = 1,\n\tRunning = 2,\n\tStopping = 3,\n}\n\n// Please note that all reasons in this list are not errors,\n// and thus they are not raised today to parent container as error.\n// If this needs to be changed in future, we should re-evaluate what and how we raise to summarizer\ntype StopReason = Extract<\n\tSummarizerStopReason,\n\t\"parentNotConnected\" | \"notElectedParent\" | \"notElectedClient\"\n>;\ntype ShouldSummarizeState =\n\t| { shouldSummarize: true }\n\t| { shouldSummarize: false; stopReason: StopReason };\n\nexport interface IConnectedEvents extends IEvent {\n\t(event: \"connected\", listener: (clientId: string) => void);\n\t(event: \"disconnected\", listener: () => void);\n}\n\n/**\n * IConnectedState describes an object that SummaryManager can watch to observe connection/disconnection.\n *\n * Under current implementation, its role will be fulfilled by the ContainerRuntime, but this could be replaced\n * with anything else that fulfills the contract if we want to shift the layer that the SummaryManager lives at.\n */\nexport interface IConnectedState extends IEventProvider<IConnectedEvents> {\n\treadonly connected: boolean;\n\n\t/**\n\t * Under current implementation this is undefined if we've never connected, otherwise it's the clientId from our\n\t * latest connection (even if we've since disconnected!). Although this happens to be the behavior we want in\n\t * SummaryManager, I suspect that globally we may eventually want to modify this behavior (e.g. make clientId\n\t * undefined while disconnected). To protect against this, let's assume this field can't be trusted while\n\t * disconnected and instead separately track \"latest clientId\" in SummaryManager.\n\t */\n\treadonly clientId: string | undefined;\n}\n\nexport interface ISummaryManagerConfig {\n\tinitialDelayMs: number;\n\topsToBypassInitialDelay: number;\n}\n\n/**\n * SummaryManager is created by parent container (i.e. interactive container with clientType !== \"summarizer\") only.\n * It observes changes in calculated summarizer and reacts to changes by either creating summarizer client or\n * stopping existing summarizer client.\n */\nexport class SummaryManager implements IDisposable {\n\tprivate readonly logger: ITelemetryLoggerExt;\n\tprivate readonly opsToBypassInitialDelay: number;\n\tprivate readonly initialDelayMs: number;\n\tprivate latestClientId: string | undefined;\n\tprivate state = SummaryManagerState.Off;\n\tprivate summarizer?: ISummarizer;\n\tprivate _disposed = false;\n\n\tpublic get disposed() {\n\t\treturn this._disposed;\n\t}\n\n\tpublic get currentState() {\n\t\treturn this.state;\n\t}\n\n\tconstructor(\n\t\tprivate readonly clientElection: ISummarizerClientElection,\n\t\tprivate readonly connectedState: IConnectedState,\n\t\tprivate readonly summaryCollection: Pick<\n\t\t\tSummaryCollection,\n\t\t\t\"opsSinceLastAck\" | \"addOpListener\" | \"removeOpListener\"\n\t\t>,\n\t\tparentLogger: ITelemetryLoggerExt,\n\t\t/** Creates summarizer by asking interactive container to spawn summarizing container and\n\t\t * get back its Summarizer instance. */\n\t\tprivate readonly requestSummarizerFn: () => Promise<ISummarizer>,\n\t\tprivate readonly startThrottler: IThrottler,\n\t\t{\n\t\t\tinitialDelayMs = defaultInitialDelayMs,\n\t\t\topsToBypassInitialDelay = defaultOpsToBypassInitialDelay,\n\t\t}: Readonly<Partial<ISummaryManagerConfig>> = {},\n\t\tprivate readonly disableHeuristics?: boolean,\n\t) {\n\t\tthis.logger = ChildLogger.create(parentLogger, \"SummaryManager\", {\n\t\t\tall: { clientId: () => this.latestClientId },\n\t\t});\n\n\t\tthis.connectedState.on(\"connected\", this.handleConnected);\n\t\tthis.connectedState.on(\"disconnected\", this.handleDisconnected);\n\t\tthis.latestClientId = this.connectedState.clientId;\n\n\t\tthis.opsToBypassInitialDelay = opsToBypassInitialDelay;\n\t\tthis.initialDelayMs = initialDelayMs;\n\t}\n\n\t/**\n\t * Until start is called, the SummaryManager won't begin attempting to start summarization. This ensures there's\n\t * a window between construction and starting where the caller can attach listeners.\n\t */\n\tpublic start(): void {\n\t\tthis.clientElection.on(\"electedSummarizerChanged\", this.refreshSummarizer);\n\t\tthis.refreshSummarizer();\n\t}\n\n\tprivate readonly handleConnected = (clientId: string) => {\n\t\tthis.latestClientId = clientId;\n\t\t// If we have a summarizer, it should have been either cancelled on disconnected by now.\n\t\t// But because of lastSummary process, it can still hang around, so there is not much we can\n\t\t// check or assert.\n\t\tthis.refreshSummarizer();\n\t};\n\n\tprivate readonly handleDisconnected = () => {\n\t\tthis.refreshSummarizer();\n\t};\n\n\tprivate static readonly isStartingOrRunning = (state: SummaryManagerState) =>\n\t\tstate === SummaryManagerState.Starting || state === SummaryManagerState.Running;\n\n\tprivate getShouldSummarizeState(): ShouldSummarizeState {\n\t\t// Note that if we're in the Running state, the electedClient may be a summarizer client, so we can't\n\t\t// enforce connectedState.clientId === clientElection.electedClientId. But once we're Running, we should\n\t\t// only transition to Stopping when the electedParentId changes. Stopping the summarizer without\n\t\t// changing the electedParent will just cause us to transition to Starting again.\n\n\t\t// New Parent has been elected and it is not the current client, or\n\t\tif (this.connectedState.clientId !== this.clientElection.electedParentId) {\n\t\t\treturn { shouldSummarize: false, stopReason: \"notElectedParent\" };\n\t\t}\n\n\t\t// We are not already running the summarizer and we are not the current elected client id.\n\t\tif (\n\t\t\tthis.state !== SummaryManagerState.Running &&\n\t\t\tthis.connectedState.clientId !== this.clientElection.electedClientId\n\t\t) {\n\t\t\treturn { shouldSummarize: false, stopReason: \"notElectedClient\" };\n\t\t}\n\n\t\tif (!this.connectedState.connected) {\n\t\t\treturn { shouldSummarize: false, stopReason: \"parentNotConnected\" };\n\t\t}\n\n\t\tif (this.disposed) {\n\t\t\tassert(false, 0x260 /* \"Disposed should mean disconnected!\" */);\n\t\t} else {\n\t\t\treturn { shouldSummarize: true };\n\t\t}\n\t}\n\n\tprivate readonly refreshSummarizer = () => {\n\t\t// Transition states depending on shouldSummarize, which is a calculated property\n\t\t// that is only true if this client is connected and is the elected summarizer.\n\t\tconst shouldSummarizeState = this.getShouldSummarizeState();\n\t\tswitch (this.state) {\n\t\t\tcase SummaryManagerState.Off: {\n\t\t\t\tif (shouldSummarizeState.shouldSummarize) {\n\t\t\t\t\tthis.startSummarization();\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tcase SummaryManagerState.Starting: {\n\t\t\t\t// Cannot take any action until summarizer is created\n\t\t\t\t// state transition will occur after creation\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tcase SummaryManagerState.Running: {\n\t\t\t\tif (shouldSummarizeState.shouldSummarize === false) {\n\t\t\t\t\tthis.stop(shouldSummarizeState.stopReason);\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tcase SummaryManagerState.Stopping: {\n\t\t\t\t// Cannot take any action until running summarizer finishes\n\t\t\t\t// state transition will occur after it stops\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t};\n\n\tprivate startSummarization() {\n\t\tassert(this.state === SummaryManagerState.Off, 0x261 /* \"Expected: off\" */);\n\t\tthis.state = SummaryManagerState.Starting;\n\n\t\tassert(this.summarizer === undefined, 0x262 /* \"Old summarizer is still working!\" */);\n\n\t\tthis.delayBeforeCreatingSummarizer()\n\t\t\t.then(async (startWithInitialDelay: boolean) => {\n\t\t\t\t// Re-validate that it need to be running. Due to asynchrony, it may be not the case anymore\n\t\t\t\t// but only if creation was delayed. If it was not, then we want to ensure we always create\n\t\t\t\t// a summarizer to kick off lastSummary. Without that, we would not be able to summarize and get\n\t\t\t\t// document out of broken state if it has too many ops and ordering service keeps nacking main\n\t\t\t\t// container (and thus it goes into cycle of reconnects)\n\t\t\t\t// If we can't run the LastSummary, simply return as to avoid paying the cost of launching\n\t\t\t\t// the summarizer at all.\n\t\t\t\tconst shouldSummarizeStateEarlyStage = this.getShouldSummarizeState();\n\t\t\t\tif (\n\t\t\t\t\tstartWithInitialDelay &&\n\t\t\t\t\tshouldSummarizeStateEarlyStage.shouldSummarize === false\n\t\t\t\t) {\n\t\t\t\t\treturn `early exit ${shouldSummarizeStateEarlyStage.stopReason}`;\n\t\t\t\t}\n\n\t\t\t\t// We transition to Running before requesting the summarizer, because after requesting we can't predict\n\t\t\t\t// when the electedClient will be replaced with the new summarizer client.\n\t\t\t\t// The alternative would be to let connectedState.clientId !== clientElection.electedClientId when\n\t\t\t\t// state === Starting || state === Running.\n\t\t\t\tassert(\n\t\t\t\t\tthis.state === SummaryManagerState.Starting,\n\t\t\t\t\t0x263 /* \"Expected: starting\" */,\n\t\t\t\t);\n\t\t\t\tthis.state = SummaryManagerState.Running;\n\n\t\t\t\tconst summarizer = await this.requestSummarizerFn();\n\t\t\t\tthis.summarizer = summarizer;\n\n\t\t\t\t// Re-validate that it need to be running. Due to asynchrony, it may be not the case anymore\n\t\t\t\t// If we can't run the LastSummary, simply return as to avoid paying the cost of launching\n\t\t\t\t// the summarizer at all.\n\t\t\t\tconst shouldSummarizeState = this.getShouldSummarizeState();\n\t\t\t\tif (shouldSummarizeState.shouldSummarize === false) {\n\t\t\t\t\t// In order to allow the last summary to run, we not only need a stop reason that would\n\t\t\t\t\t// allow it but also, startWithInitialDelay to be false (start the summarization immediately),\n\t\t\t\t\t// which would happen when we have a high enough number of unsummarized ops.\n\t\t\t\t\tif (\n\t\t\t\t\t\tstartWithInitialDelay ||\n\t\t\t\t\t\t!Summarizer.stopReasonCanRunLastSummary(shouldSummarizeState.stopReason)\n\t\t\t\t\t) {\n\t\t\t\t\t\tthis.state = SummaryManagerState.Starting;\n\t\t\t\t\t\tsummarizer.stop(shouldSummarizeState.stopReason);\n\t\t\t\t\t\treturn `early exit after starting summarizer ${shouldSummarizeState.stopReason}`;\n\t\t\t\t\t}\n\t\t\t\t\tthis.logger.sendTelemetryEvent({\n\t\t\t\t\t\teventName: \"LastAttemptToSummarize\",\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\tconst clientId = this.latestClientId!;\n\n\t\t\t\treturn PerformanceEvent.timedExecAsync(\n\t\t\t\t\tthis.logger,\n\t\t\t\t\t{ eventName: \"RunningSummarizer\", attempt: this.startThrottler.numAttempts },\n\t\t\t\t\tasync () => summarizer.run(clientId, this.disableHeuristics),\n\t\t\t\t);\n\t\t\t})\n\t\t\t.then((reason: string) => {\n\t\t\t\tthis.logger.sendTelemetryEvent({\n\t\t\t\t\teventName: \"EndingSummarizer\",\n\t\t\t\t\treason,\n\t\t\t\t});\n\t\t\t})\n\t\t\t.catch((error) => {\n\t\t\t\tthis.logger.sendTelemetryEvent(\n\t\t\t\t\t{\n\t\t\t\t\t\teventName: \"EndingSummarizer\",\n\t\t\t\t\t\treason: \"exception\",\n\t\t\t\t\t},\n\t\t\t\t\terror,\n\t\t\t\t);\n\n\t\t\t\t// Most of exceptions happen due to container being closed while loading it, due to\n\t\t\t\t// summarizer container loosing connection while load.\n\t\t\t\t// Not worth reporting such errors as errors. That said, we might miss some real errors if\n\t\t\t\t// we ignore blindly, so try to narrow signature we are looking for - skip logging\n\t\t\t\t// error only if this client should no longer be a summarizer (which in practice\n\t\t\t\t// means it also lost connection), and error happened on load (we do not have summarizer).\n\t\t\t\t// We could annotate the error raised in Container.load where the container closed during load with no error\n\t\t\t\t// and check for that case here, but that does not seem to be necessary.\n\t\t\t\tif (\n\t\t\t\t\tthis.getShouldSummarizeState().shouldSummarize ||\n\t\t\t\t\tthis.summarizer !== undefined\n\t\t\t\t) {\n\t\t\t\t\t// Report any failure as an error unless it was due to cancellation (like \"disconnected\" error)\n\t\t\t\t\t// If failure happened on container load, we may not yet realized that socket disconnected, so check\n\t\t\t\t\t// offlineError.\n\t\t\t\t\tconst category =\n\t\t\t\t\t\terror?.errorType === DriverErrorType.offlineError ? \"generic\" : \"error\";\n\t\t\t\t\tthis.logger.sendTelemetryEvent(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\teventName: \"SummarizerException\",\n\t\t\t\t\t\t\tcategory,\n\t\t\t\t\t\t},\n\t\t\t\t\t\terror,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t})\n\t\t\t.finally(() => {\n\t\t\t\tassert(this.state !== SummaryManagerState.Off, 0x264 /* \"Expected: Not Off\" */);\n\t\t\t\tthis.state = SummaryManagerState.Off;\n\n\t\t\t\tthis.summarizer?.close();\n\t\t\t\tthis.summarizer = undefined;\n\n\t\t\t\tif (this.getShouldSummarizeState().shouldSummarize) {\n\t\t\t\t\tthis.startSummarization();\n\t\t\t\t}\n\t\t\t});\n\t}\n\n\tprivate stop(reason: SummarizerStopReason) {\n\t\tif (!SummaryManager.isStartingOrRunning(this.state)) {\n\t\t\treturn;\n\t\t}\n\t\tthis.state = SummaryManagerState.Stopping;\n\n\t\t// Stopping the running summarizer client should trigger a change\n\t\t// in states when the running summarizer closes\n\t\tthis.summarizer?.stop(reason);\n\t}\n\n\t/**\n\t * Implements initial delay before creating summarizer\n\t * @returns `true`, if creation is delayed due to heuristics (not many ops to summarize).\n\t * `false` if summarizer should start immediately due to too many unsummarized ops.\n\t */\n\tprivate async delayBeforeCreatingSummarizer(): Promise<boolean> {\n\t\t// throttle creation of new summarizer containers to prevent spamming the server with websocket connections\n\t\tlet delayMs = this.startThrottler.getDelay();\n\n\t\t// We have been elected the summarizer. Some day we may be able to summarize with a live document but for\n\t\t// now we play it safe and launch a second copy.\n\t\tthis.logger.sendTelemetryEvent({\n\t\t\teventName: \"CreatingSummarizer\",\n\t\t\tthrottlerDelay: delayMs,\n\t\t\tinitialDelay: this.initialDelayMs,\n\t\t\tstartThrottlerMaxDelayMs: this.startThrottler.maxDelayMs,\n\t\t\topsSinceLastAck: this.summaryCollection.opsSinceLastAck,\n\t\t\topsToBypassInitialDelay: this.opsToBypassInitialDelay,\n\t\t\telectedParentId: this.clientElection.electedParentId,\n\t\t\telectedClientId: this.clientElection.electedClientId,\n\t\t});\n\n\t\t// This delay helps ensure that last summarizer that might be left from previous client\n\t\t// has enough time to complete its last summary and thus new summarizer not conflict with previous one.\n\t\t// If, however, there are too many unsummarized ops, try to resolve it as quickly as possible, with\n\t\t// understanding that we may see nacks because of such quick action.\n\t\t// A better design would be for summarizer election logic to always select current summarizer as\n\t\t// summarizing client (i.e. clientType === \"summarizer\" can be elected) to ensure that nobody else can\n\t\t// summarizer while it finishes its work and moves to exit.\n\t\t// It also helps with pure boot scenario (single client) to offset expensive work a bit out from\n\t\t// critical boot sequence.\n\t\tlet startWithInitialDelay = false;\n\t\tif (this.summaryCollection.opsSinceLastAck < this.opsToBypassInitialDelay) {\n\t\t\tstartWithInitialDelay = true;\n\t\t\tdelayMs = Math.max(delayMs, this.initialDelayMs);\n\t\t}\n\n\t\tif (delayMs > 0) {\n\t\t\tlet timer;\n\t\t\tlet resolveOpPromiseFn;\n\t\t\t// Create a listener that will break the delay if we've exceeded the initial delay ops count.\n\t\t\tconst opsListenerFn = () => {\n\t\t\t\tif (this.summaryCollection.opsSinceLastAck >= this.opsToBypassInitialDelay) {\n\t\t\t\t\tclearTimeout(timer);\n\t\t\t\t\tresolveOpPromiseFn();\n\t\t\t\t}\n\t\t\t};\n\t\t\t// Create a Promise that will resolve when the delay expires.\n\t\t\tconst delayPromise = new Promise<void>((resolve) => {\n\t\t\t\ttimer = setTimeout(() => resolve(), delayMs);\n\t\t\t});\n\t\t\t// Create a Promise that will resolve if the ops count passes the threshold.\n\t\t\tconst opPromise = new Promise<void>((resolve) => {\n\t\t\t\tresolveOpPromiseFn = resolve;\n\t\t\t});\n\t\t\tthis.summaryCollection.addOpListener(opsListenerFn);\n\t\t\tawait Promise.race([delayPromise, opPromise]);\n\t\t\tthis.summaryCollection.removeOpListener(opsListenerFn);\n\t\t}\n\t\treturn startWithInitialDelay;\n\t}\n\n\tpublic readonly summarizeOnDemand: ISummarizer[\"summarizeOnDemand\"] = (...args) => {\n\t\tif (this.summarizer === undefined) {\n\t\t\tthrow Error(\"No running summarizer client\");\n\t\t\t// TODO: could spawn a summarizer client temporarily.\n\t\t}\n\t\treturn this.summarizer.summarizeOnDemand(...args);\n\t};\n\n\tpublic readonly enqueueSummarize: ISummarizer[\"enqueueSummarize\"] = (...args) => {\n\t\tif (this.summarizer === undefined) {\n\t\t\tthrow Error(\"No running summarizer client\");\n\t\t\t// TODO: could spawn a summarizer client temporarily.\n\t\t}\n\t\treturn this.summarizer.enqueueSummarize(...args);\n\t};\n\n\tpublic dispose() {\n\t\tthis.clientElection.off(\"electedSummarizerChanged\", this.refreshSummarizer);\n\t\tthis.connectedState.off(\"connected\", this.handleConnected);\n\t\tthis.connectedState.off(\"disconnected\", this.handleDisconnected);\n\t\tthis._disposed = true;\n\t}\n}\n"]}
1
+ {"version":3,"file":"summaryManager.js","sourceRoot":"","sources":["../../src/summary/summaryManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AACtD,OAAO,EACN,WAAW,EAEX,gBAAgB,GAChB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAKrE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,MAAM,qBAAqB,GAAG,IAAI,CAAC;AACnC,MAAM,8BAA8B,GAAG,IAAI,CAAC;AAE5C,MAAM,CAAN,IAAY,mBAKX;AALD,WAAY,mBAAmB;IAC9B,2DAAO,CAAA;IACP,qEAAY,CAAA;IACZ,mEAAW,CAAA;IACX,qEAAY,CAAA;AACb,CAAC,EALW,mBAAmB,KAAnB,mBAAmB,QAK9B;AA0CD;;;;GAIG;AACH,MAAM,OAAO,cAAc;IAiB1B,YACkB,cAAyC,EACzC,cAA+B,EAC/B,iBAGhB,EACD,YAAiC;IACjC;2CACuC;IACtB,mBAA+C,EAC/C,cAA0B,EAC3C,EACC,cAAc,GAAG,qBAAqB,EACtC,uBAAuB,GAAG,8BAA8B,MACX,EAAE,EAC/B,iBAA2B;QAf3B,mBAAc,GAAd,cAAc,CAA2B;QACzC,mBAAc,GAAd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aAAa,CAAC,CAAC;SACvD;QACD,OAAO,qBAAqB,CAAC;IAC9B,CAAC;IAkBM,OAAO;QACb,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,0BAA0B,EAAE,IAAI,CAAC,iBAAiB,CAAC,CAAC;QAC5E,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,WAAW,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;QAC3D,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,cAAc,EAAE,IAAI,CAAC,kBAAkB,CAAC,CAAC;QACjE,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;IACvB,CAAC;;AAxRuB,kCAAmB,GAAG,CAAC,KAA0B,EAAE,EAAE,CAC5E,KAAK,KAAK,mBAAmB,CAAC,QAAQ,IAAI,KAAK,KAAK,mBAAmB,CAAC,OAAO,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IEvent, IEventProvider } from \"@fluidframework/common-definitions\";\nimport { IDisposable } from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/common-utils\";\nimport {\n\tChildLogger,\n\tITelemetryLoggerExt,\n\tPerformanceEvent,\n} from \"@fluidframework/telemetry-utils\";\nimport { DriverErrorType } from \"@fluidframework/driver-definitions\";\nimport { IThrottler } from \"../throttler\";\nimport { ISummarizerClientElection } from \"./summarizerClientElection\";\nimport { ISummarizer, SummarizerStopReason } from \"./summarizerTypes\";\nimport { SummaryCollection } from \"./summaryCollection\";\nimport { Summarizer } from \"./summarizer\";\n\nconst defaultInitialDelayMs = 5000;\nconst defaultOpsToBypassInitialDelay = 4000;\n\nexport enum SummaryManagerState {\n\tOff = 0,\n\tStarting = 1,\n\tRunning = 2,\n\tStopping = 3,\n}\n\n// Please note that all reasons in this list are not errors,\n// and thus they are not raised today to parent container as error.\n// If this needs to be changed in future, we should re-evaluate what and how we raise to summarizer\ntype StopReason = Extract<\n\tSummarizerStopReason,\n\t\"parentNotConnected\" | \"notElectedParent\" | \"notElectedClient\"\n>;\ntype ShouldSummarizeState =\n\t| { shouldSummarize: true }\n\t| { shouldSummarize: false; stopReason: StopReason };\n\nexport interface IConnectedEvents extends IEvent {\n\t(event: \"connected\", listener: (clientId: string) => void);\n\t(event: \"disconnected\", listener: () => void);\n}\n\n/**\n * IConnectedState describes an object that SummaryManager can watch to observe connection/disconnection.\n *\n * Under current implementation, its role will be fulfilled by the ContainerRuntime, but this could be replaced\n * with anything else that fulfills the contract if we want to shift the layer that the SummaryManager lives at.\n */\nexport interface IConnectedState extends IEventProvider<IConnectedEvents> {\n\treadonly connected: boolean;\n\n\t/**\n\t * Under current implementation this is undefined if we've never connected, otherwise it's the clientId from our\n\t * latest connection (even if we've since disconnected!). Although this happens to be the behavior we want in\n\t * SummaryManager, I suspect that globally we may eventually want to modify this behavior (e.g. make clientId\n\t * undefined while disconnected). To protect against this, let's assume this field can't be trusted while\n\t * disconnected and instead separately track \"latest clientId\" in SummaryManager.\n\t */\n\treadonly clientId: string | undefined;\n}\n\nexport interface ISummaryManagerConfig {\n\tinitialDelayMs: number;\n\topsToBypassInitialDelay: number;\n}\n\n/**\n * SummaryManager is created by parent container (i.e. interactive container with clientType !== \"summarizer\") only.\n * It observes changes in calculated summarizer and reacts to changes by either creating summarizer client or\n * stopping existing summarizer client.\n */\nexport class SummaryManager implements IDisposable {\n\tprivate readonly logger: ITelemetryLoggerExt;\n\tprivate readonly opsToBypassInitialDelay: number;\n\tprivate readonly initialDelayMs: number;\n\tprivate latestClientId: string | undefined;\n\tprivate state = SummaryManagerState.Off;\n\tprivate summarizer?: ISummarizer;\n\tprivate _disposed = false;\n\n\tpublic get disposed() {\n\t\treturn this._disposed;\n\t}\n\n\tpublic get currentState() {\n\t\treturn this.state;\n\t}\n\n\tconstructor(\n\t\tprivate readonly clientElection: ISummarizerClientElection,\n\t\tprivate readonly connectedState: IConnectedState,\n\t\tprivate readonly summaryCollection: Pick<\n\t\t\tSummaryCollection,\n\t\t\t\"opsSinceLastAck\" | \"addOpListener\" | \"removeOpListener\"\n\t\t>,\n\t\tparentLogger: ITelemetryLoggerExt,\n\t\t/** Creates summarizer by asking interactive container to spawn summarizing container and\n\t\t * get back its Summarizer instance. */\n\t\tprivate readonly requestSummarizerFn: () => Promise<ISummarizer>,\n\t\tprivate readonly startThrottler: IThrottler,\n\t\t{\n\t\t\tinitialDelayMs = defaultInitialDelayMs,\n\t\t\topsToBypassInitialDelay = defaultOpsToBypassInitialDelay,\n\t\t}: Readonly<Partial<ISummaryManagerConfig>> = {},\n\t\tprivate readonly disableHeuristics?: boolean,\n\t) {\n\t\tthis.logger = ChildLogger.create(parentLogger, \"SummaryManager\", {\n\t\t\tall: { clientId: () => this.latestClientId },\n\t\t});\n\n\t\tthis.connectedState.on(\"connected\", this.handleConnected);\n\t\tthis.connectedState.on(\"disconnected\", this.handleDisconnected);\n\t\tthis.latestClientId = this.connectedState.clientId;\n\n\t\tthis.opsToBypassInitialDelay = opsToBypassInitialDelay;\n\t\tthis.initialDelayMs = initialDelayMs;\n\t}\n\n\t/**\n\t * Until start is called, the SummaryManager won't begin attempting to start summarization. This ensures there's\n\t * a window between construction and starting where the caller can attach listeners.\n\t */\n\tpublic start(): void {\n\t\tthis.clientElection.on(\"electedSummarizerChanged\", this.refreshSummarizer);\n\t\tthis.refreshSummarizer();\n\t}\n\n\tprivate readonly handleConnected = (clientId: string) => {\n\t\tthis.latestClientId = clientId;\n\t\t// If we have a summarizer, it should have been either cancelled on disconnected by now.\n\t\t// But because of lastSummary process, it can still hang around, so there is not much we can\n\t\t// check or assert.\n\t\tthis.refreshSummarizer();\n\t};\n\n\tprivate readonly handleDisconnected = () => {\n\t\tthis.refreshSummarizer();\n\t};\n\n\tprivate static readonly isStartingOrRunning = (state: SummaryManagerState) =>\n\t\tstate === SummaryManagerState.Starting || state === SummaryManagerState.Running;\n\n\tprivate getShouldSummarizeState(): ShouldSummarizeState {\n\t\t// Note that if we're in the Running state, the electedClient may be a summarizer client, so we can't\n\t\t// enforce connectedState.clientId === clientElection.electedClientId. But once we're Running, we should\n\t\t// only transition to Stopping when the electedParentId changes. Stopping the summarizer without\n\t\t// changing the electedParent will just cause us to transition to Starting again.\n\n\t\t// New Parent has been elected and it is not the current client, or\n\t\tif (this.connectedState.clientId !== this.clientElection.electedParentId) {\n\t\t\treturn { shouldSummarize: false, stopReason: \"notElectedParent\" };\n\t\t}\n\n\t\t// We are not already running the summarizer and we are not the current elected client id.\n\t\tif (\n\t\t\tthis.state !== SummaryManagerState.Running &&\n\t\t\tthis.connectedState.clientId !== this.clientElection.electedClientId\n\t\t) {\n\t\t\treturn { shouldSummarize: false, stopReason: \"notElectedClient\" };\n\t\t}\n\n\t\tif (!this.connectedState.connected) {\n\t\t\treturn { shouldSummarize: false, stopReason: \"parentNotConnected\" };\n\t\t}\n\n\t\tif (this.disposed) {\n\t\t\tassert(false, 0x260 /* \"Disposed should mean disconnected!\" */);\n\t\t} else {\n\t\t\treturn { shouldSummarize: true };\n\t\t}\n\t}\n\n\tprivate readonly refreshSummarizer = () => {\n\t\t// Transition states depending on shouldSummarize, which is a calculated property\n\t\t// that is only true if this client is connected and is the elected summarizer.\n\t\tconst shouldSummarizeState = this.getShouldSummarizeState();\n\t\tswitch (this.state) {\n\t\t\tcase SummaryManagerState.Off: {\n\t\t\t\tif (shouldSummarizeState.shouldSummarize) {\n\t\t\t\t\tthis.startSummarization();\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tcase SummaryManagerState.Starting: {\n\t\t\t\t// Cannot take any action until summarizer is created\n\t\t\t\t// state transition will occur after creation\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tcase SummaryManagerState.Running: {\n\t\t\t\tif (shouldSummarizeState.shouldSummarize === false) {\n\t\t\t\t\tthis.stop(shouldSummarizeState.stopReason);\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tcase SummaryManagerState.Stopping: {\n\t\t\t\t// Cannot take any action until running summarizer finishes\n\t\t\t\t// state transition will occur after it stops\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t};\n\n\tprivate startSummarization() {\n\t\tassert(this.state === SummaryManagerState.Off, 0x261 /* \"Expected: off\" */);\n\t\tthis.state = SummaryManagerState.Starting;\n\n\t\tassert(this.summarizer === undefined, 0x262 /* \"Old summarizer is still working!\" */);\n\n\t\tthis.delayBeforeCreatingSummarizer()\n\t\t\t.then(async (startWithInitialDelay: boolean) => {\n\t\t\t\t// Re-validate that it need to be running. Due to asynchrony, it may be not the case anymore\n\t\t\t\t// but only if creation was delayed. If it was not, then we want to ensure we always create\n\t\t\t\t// a summarizer to kick off lastSummary. Without that, we would not be able to summarize and get\n\t\t\t\t// document out of broken state if it has too many ops and ordering service keeps nacking main\n\t\t\t\t// container (and thus it goes into cycle of reconnects)\n\t\t\t\t// If we can't run the LastSummary, simply return as to avoid paying the cost of launching\n\t\t\t\t// the summarizer at all.\n\t\t\t\tconst shouldSummarizeStateEarlyStage = this.getShouldSummarizeState();\n\t\t\t\tif (\n\t\t\t\t\tstartWithInitialDelay &&\n\t\t\t\t\tshouldSummarizeStateEarlyStage.shouldSummarize === false\n\t\t\t\t) {\n\t\t\t\t\treturn `early exit ${shouldSummarizeStateEarlyStage.stopReason}`;\n\t\t\t\t}\n\n\t\t\t\t// We transition to Running before requesting the summarizer, because after requesting we can't predict\n\t\t\t\t// when the electedClient will be replaced with the new summarizer client.\n\t\t\t\t// The alternative would be to let connectedState.clientId !== clientElection.electedClientId when\n\t\t\t\t// state === Starting || state === Running.\n\t\t\t\tassert(\n\t\t\t\t\tthis.state === SummaryManagerState.Starting,\n\t\t\t\t\t0x263 /* \"Expected: starting\" */,\n\t\t\t\t);\n\t\t\t\tthis.state = SummaryManagerState.Running;\n\n\t\t\t\tconst summarizer = await this.requestSummarizerFn();\n\t\t\t\tthis.summarizer = summarizer;\n\n\t\t\t\t// Re-validate that it need to be running. Due to asynchrony, it may be not the case anymore\n\t\t\t\t// If we can't run the LastSummary, simply return as to avoid paying the cost of launching\n\t\t\t\t// the summarizer at all.\n\t\t\t\tconst shouldSummarizeState = this.getShouldSummarizeState();\n\t\t\t\tif (shouldSummarizeState.shouldSummarize === false) {\n\t\t\t\t\t// In order to allow the last summary to run, we not only need a stop reason that would\n\t\t\t\t\t// allow it but also, startWithInitialDelay to be false (start the summarization immediately),\n\t\t\t\t\t// which would happen when we have a high enough number of unsummarized ops.\n\t\t\t\t\tif (\n\t\t\t\t\t\tstartWithInitialDelay ||\n\t\t\t\t\t\t!Summarizer.stopReasonCanRunLastSummary(shouldSummarizeState.stopReason)\n\t\t\t\t\t) {\n\t\t\t\t\t\tthis.state = SummaryManagerState.Starting;\n\t\t\t\t\t\tsummarizer.stop(shouldSummarizeState.stopReason);\n\t\t\t\t\t\treturn `early exit after starting summarizer ${shouldSummarizeState.stopReason}`;\n\t\t\t\t\t}\n\t\t\t\t\tthis.logger.sendTelemetryEvent({\n\t\t\t\t\t\teventName: \"LastAttemptToSummarize\",\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\tconst clientId = this.latestClientId!;\n\n\t\t\t\treturn PerformanceEvent.timedExecAsync(\n\t\t\t\t\tthis.logger,\n\t\t\t\t\t{ eventName: \"RunningSummarizer\", attempt: this.startThrottler.numAttempts },\n\t\t\t\t\tasync () => summarizer.run(clientId, this.disableHeuristics),\n\t\t\t\t);\n\t\t\t})\n\t\t\t.then((reason: string) => {\n\t\t\t\tthis.logger.sendTelemetryEvent({\n\t\t\t\t\teventName: \"EndingSummarizer\",\n\t\t\t\t\treason,\n\t\t\t\t});\n\t\t\t})\n\t\t\t.catch((error) => {\n\t\t\t\tthis.logger.sendTelemetryEvent(\n\t\t\t\t\t{\n\t\t\t\t\t\teventName: \"EndingSummarizer\",\n\t\t\t\t\t\treason: \"exception\",\n\t\t\t\t\t},\n\t\t\t\t\terror,\n\t\t\t\t);\n\n\t\t\t\t// Most of exceptions happen due to container being closed while loading it, due to\n\t\t\t\t// summarizer container loosing connection while load.\n\t\t\t\t// Not worth reporting such errors as errors. That said, we might miss some real errors if\n\t\t\t\t// we ignore blindly, so try to narrow signature we are looking for - skip logging\n\t\t\t\t// error only if this client should no longer be a summarizer (which in practice\n\t\t\t\t// means it also lost connection), and error happened on load (we do not have summarizer).\n\t\t\t\t// We could annotate the error raised in Container.load where the container closed during load with no error\n\t\t\t\t// and check for that case here, but that does not seem to be necessary.\n\t\t\t\tif (\n\t\t\t\t\tthis.getShouldSummarizeState().shouldSummarize ||\n\t\t\t\t\tthis.summarizer !== undefined\n\t\t\t\t) {\n\t\t\t\t\t// Report any failure as an error unless it was due to cancellation (like \"disconnected\" error)\n\t\t\t\t\t// If failure happened on container load, we may not yet realized that socket disconnected, so check\n\t\t\t\t\t// offlineError.\n\t\t\t\t\tconst category =\n\t\t\t\t\t\terror?.errorType === DriverErrorType.offlineError ? \"generic\" : \"error\";\n\t\t\t\t\tthis.logger.sendTelemetryEvent(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\teventName: \"SummarizerException\",\n\t\t\t\t\t\t\tcategory,\n\t\t\t\t\t\t},\n\t\t\t\t\t\terror,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t})\n\t\t\t.finally(() => {\n\t\t\t\tassert(this.state !== SummaryManagerState.Off, 0x264 /* \"Expected: Not Off\" */);\n\t\t\t\tthis.state = SummaryManagerState.Off;\n\n\t\t\t\tthis.summarizer?.close();\n\t\t\t\tthis.summarizer = undefined;\n\n\t\t\t\tif (this.getShouldSummarizeState().shouldSummarize) {\n\t\t\t\t\tthis.startSummarization();\n\t\t\t\t}\n\t\t\t});\n\t}\n\n\tprivate stop(reason: SummarizerStopReason) {\n\t\tif (!SummaryManager.isStartingOrRunning(this.state)) {\n\t\t\treturn;\n\t\t}\n\t\tthis.state = SummaryManagerState.Stopping;\n\n\t\t// Stopping the running summarizer client should trigger a change\n\t\t// in states when the running summarizer closes\n\t\tthis.summarizer?.stop(reason);\n\t}\n\n\t/**\n\t * Implements initial delay before creating summarizer\n\t * @returns `true`, if creation is delayed due to heuristics (not many ops to summarize).\n\t * `false` if summarizer should start immediately due to too many unsummarized ops.\n\t */\n\tprivate async delayBeforeCreatingSummarizer(): Promise<boolean> {\n\t\t// throttle creation of new summarizer containers to prevent spamming the server with websocket connections\n\t\tlet delayMs = this.startThrottler.getDelay();\n\n\t\t// We have been elected the summarizer. Some day we may be able to summarize with a live document but for\n\t\t// now we play it safe and launch a second copy.\n\t\tthis.logger.sendTelemetryEvent({\n\t\t\teventName: \"CreatingSummarizer\",\n\t\t\tthrottlerDelay: delayMs,\n\t\t\tinitialDelay: this.initialDelayMs,\n\t\t\tstartThrottlerMaxDelayMs: this.startThrottler.maxDelayMs,\n\t\t\topsSinceLastAck: this.summaryCollection.opsSinceLastAck,\n\t\t\topsToBypassInitialDelay: this.opsToBypassInitialDelay,\n\t\t\telectedParentId: this.clientElection.electedParentId,\n\t\t\telectedClientId: this.clientElection.electedClientId,\n\t\t});\n\n\t\t// This delay helps ensure that last summarizer that might be left from previous client\n\t\t// has enough time to complete its last summary and thus new summarizer not conflict with previous one.\n\t\t// If, however, there are too many unsummarized ops, try to resolve it as quickly as possible, with\n\t\t// understanding that we may see nacks because of such quick action.\n\t\t// A better design would be for summarizer election logic to always select current summarizer as\n\t\t// summarizing client (i.e. clientType === \"summarizer\" can be elected) to ensure that nobody else can\n\t\t// summarizer while it finishes its work and moves to exit.\n\t\t// It also helps with pure boot scenario (single client) to offset expensive work a bit out from\n\t\t// critical boot sequence.\n\t\tlet startWithInitialDelay = false;\n\t\tif (this.summaryCollection.opsSinceLastAck < this.opsToBypassInitialDelay) {\n\t\t\tstartWithInitialDelay = true;\n\t\t\tdelayMs = Math.max(delayMs, this.initialDelayMs);\n\t\t}\n\n\t\tif (delayMs > 0) {\n\t\t\tlet timer;\n\t\t\tlet resolveOpPromiseFn;\n\t\t\t// Create a listener that will break the delay if we've exceeded the initial delay ops count.\n\t\t\tconst opsListenerFn = () => {\n\t\t\t\tif (this.summaryCollection.opsSinceLastAck >= this.opsToBypassInitialDelay) {\n\t\t\t\t\tclearTimeout(timer);\n\t\t\t\t\tresolveOpPromiseFn();\n\t\t\t\t}\n\t\t\t};\n\t\t\t// Create a Promise that will resolve when the delay expires.\n\t\t\tconst delayPromise = new Promise<void>((resolve) => {\n\t\t\t\ttimer = setTimeout(() => resolve(), delayMs);\n\t\t\t});\n\t\t\t// Create a Promise that will resolve if the ops count passes the threshold.\n\t\t\tconst opPromise = new Promise<void>((resolve) => {\n\t\t\t\tresolveOpPromiseFn = resolve;\n\t\t\t});\n\t\t\tthis.summaryCollection.addOpListener(opsListenerFn);\n\t\t\tawait Promise.race([delayPromise, opPromise]);\n\t\t\tthis.summaryCollection.removeOpListener(opsListenerFn);\n\t\t}\n\t\treturn startWithInitialDelay;\n\t}\n\n\tpublic readonly summarizeOnDemand: ISummarizer[\"summarizeOnDemand\"] = (...args) => {\n\t\tif (this.summarizer === undefined) {\n\t\t\tthrow Error(\"No running summarizer client\");\n\t\t\t// TODO: could spawn a summarizer client temporarily.\n\t\t}\n\t\treturn this.summarizer.summarizeOnDemand(...args);\n\t};\n\n\tpublic readonly enqueueSummarize: ISummarizer[\"enqueueSummarize\"] = (...args) => {\n\t\tif (this.summarizer === undefined) {\n\t\t\tthrow Error(\"No running summarizer client\");\n\t\t\t// TODO: could spawn a summarizer client temporarily.\n\t\t}\n\t\treturn this.summarizer.enqueueSummarize(...args);\n\t};\n\n\tpublic dispose() {\n\t\tthis.clientElection.off(\"electedSummarizerChanged\", this.refreshSummarizer);\n\t\tthis.connectedState.off(\"connected\", this.handleConnected);\n\t\tthis.connectedState.off(\"disconnected\", this.handleDisconnected);\n\t\tthis._disposed = true;\n\t}\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/container-runtime",
3
- "version": "2.0.0-internal.5.1.1",
3
+ "version": "2.0.0-internal.5.3.0",
4
4
  "description": "Fluid container runtime",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -37,17 +37,18 @@
37
37
  "dependencies": {
38
38
  "@fluidframework/common-definitions": "^0.20.1",
39
39
  "@fluidframework/common-utils": "^1.1.1",
40
- "@fluidframework/container-definitions": ">=2.0.0-internal.5.1.1 <2.0.0-internal.5.2.0",
41
- "@fluidframework/container-runtime-definitions": ">=2.0.0-internal.5.1.1 <2.0.0-internal.5.2.0",
42
- "@fluidframework/container-utils": ">=2.0.0-internal.5.1.1 <2.0.0-internal.5.2.0",
43
- "@fluidframework/core-interfaces": ">=2.0.0-internal.5.1.1 <2.0.0-internal.5.2.0",
44
- "@fluidframework/datastore": ">=2.0.0-internal.5.1.1 <2.0.0-internal.5.2.0",
45
- "@fluidframework/driver-definitions": ">=2.0.0-internal.5.1.1 <2.0.0-internal.5.2.0",
46
- "@fluidframework/driver-utils": ">=2.0.0-internal.5.1.1 <2.0.0-internal.5.2.0",
40
+ "@fluidframework/container-definitions": ">=2.0.0-internal.5.3.0 <2.0.0-internal.5.4.0",
41
+ "@fluidframework/container-runtime-definitions": ">=2.0.0-internal.5.3.0 <2.0.0-internal.5.4.0",
42
+ "@fluidframework/container-utils": ">=2.0.0-internal.5.3.0 <2.0.0-internal.5.4.0",
43
+ "@fluidframework/core-interfaces": ">=2.0.0-internal.5.3.0 <2.0.0-internal.5.4.0",
44
+ "@fluidframework/core-utils": ">=2.0.0-internal.5.3.0 <2.0.0-internal.5.4.0",
45
+ "@fluidframework/datastore": ">=2.0.0-internal.5.3.0 <2.0.0-internal.5.4.0",
46
+ "@fluidframework/driver-definitions": ">=2.0.0-internal.5.3.0 <2.0.0-internal.5.4.0",
47
+ "@fluidframework/driver-utils": ">=2.0.0-internal.5.3.0 <2.0.0-internal.5.4.0",
47
48
  "@fluidframework/protocol-definitions": "^1.1.0",
48
- "@fluidframework/runtime-definitions": ">=2.0.0-internal.5.1.1 <2.0.0-internal.5.2.0",
49
- "@fluidframework/runtime-utils": ">=2.0.0-internal.5.1.1 <2.0.0-internal.5.2.0",
50
- "@fluidframework/telemetry-utils": ">=2.0.0-internal.5.1.1 <2.0.0-internal.5.2.0",
49
+ "@fluidframework/runtime-definitions": ">=2.0.0-internal.5.3.0 <2.0.0-internal.5.4.0",
50
+ "@fluidframework/runtime-utils": ">=2.0.0-internal.5.3.0 <2.0.0-internal.5.4.0",
51
+ "@fluidframework/telemetry-utils": ">=2.0.0-internal.5.3.0 <2.0.0-internal.5.4.0",
51
52
  "double-ended-queue": "^2.1.0-0",
52
53
  "events": "^3.1.0",
53
54
  "lz4js": "^0.2.0",
@@ -55,15 +56,15 @@
55
56
  "uuid": "^8.3.1"
56
57
  },
57
58
  "devDependencies": {
58
- "@fluid-internal/stochastic-test-utils": ">=2.0.0-internal.5.1.1 <2.0.0-internal.5.2.0",
59
- "@fluid-tools/benchmark": "^0.46.0",
60
- "@fluid-tools/build-cli": "^0.19.0",
59
+ "@fluid-internal/stochastic-test-utils": ">=2.0.0-internal.5.3.0 <2.0.0-internal.5.4.0",
60
+ "@fluid-tools/benchmark": "^0.48.0",
61
+ "@fluid-tools/build-cli": "^0.21.0",
61
62
  "@fluidframework/build-common": "^1.2.0",
62
- "@fluidframework/build-tools": "^0.19.0",
63
- "@fluidframework/container-runtime-previous": "npm:@fluidframework/container-runtime@2.0.0-internal.5.0.0",
63
+ "@fluidframework/build-tools": "^0.21.0",
64
+ "@fluidframework/container-runtime-previous": "npm:@fluidframework/container-runtime@2.0.0-internal.5.2.0",
64
65
  "@fluidframework/eslint-config-fluid": "^2.0.0",
65
- "@fluidframework/mocha-test-setup": ">=2.0.0-internal.5.1.1 <2.0.0-internal.5.2.0",
66
- "@fluidframework/test-runtime-utils": ">=2.0.0-internal.5.1.1 <2.0.0-internal.5.2.0",
66
+ "@fluidframework/mocha-test-setup": ">=2.0.0-internal.5.3.0 <2.0.0-internal.5.4.0",
67
+ "@fluidframework/test-runtime-utils": ">=2.0.0-internal.5.3.0 <2.0.0-internal.5.4.0",
67
68
  "@microsoft/api-extractor": "^7.34.4",
68
69
  "@types/double-ended-queue": "^2.1.0",
69
70
  "@types/events": "^3.0.0",
@@ -112,6 +113,6 @@
112
113
  "tsc": "tsc",
113
114
  "tsc:watch": "tsc --watch",
114
115
  "typetests:gen": "fluid-type-test-generator",
115
- "typetests:prepare": "flub generate typetests --prepare --dir . --pin"
116
+ "typetests:prepare": "flub typetests --dir . --reset --previous --normalize"
116
117
  }
117
118
  }
@@ -45,6 +45,7 @@ import { ContainerRuntime, TombstoneResponseHeaderKey } from "./containerRuntime
45
45
  import { sendGCUnexpectedUsageEvent, sweepAttachmentBlobsKey, throwOnTombstoneLoadKey } from "./gc";
46
46
  import { Throttler, formExponentialFn, IThrottler } from "./throttler";
47
47
  import { summarizerClientType } from "./summary";
48
+ import { IBlobMetadata } from "./metadata";
48
49
 
49
50
  /**
50
51
  * This class represents blob (long string)
@@ -70,12 +71,16 @@ export class BlobHandle implements IFluidHandle<ArrayBufferLike> {
70
71
  public readonly path: string,
71
72
  public readonly routeContext: IFluidHandleContext,
72
73
  public get: () => Promise<any>,
74
+ private readonly onAttachGraph?: () => void,
73
75
  ) {
74
76
  this.absolutePath = generateHandleContextPath(path, this.routeContext);
75
77
  }
76
78
 
77
79
  public attachGraph() {
78
- this.attached = true;
80
+ if (!this.attached) {
81
+ this.attached = true;
82
+ this.onAttachGraph?.();
83
+ }
79
84
  }
80
85
 
81
86
  public bind(handle: IFluidHandle) {
@@ -132,14 +137,22 @@ interface PendingBlob {
132
137
  blob: ArrayBufferLike;
133
138
  status: PendingBlobStatus;
134
139
  storageId?: string;
135
- handleP: Deferred<IFluidHandle<ArrayBufferLike>>;
140
+ handleP: Deferred<BlobHandle>;
136
141
  uploadP?: Promise<ICreateBlobResponse>;
137
142
  uploadTime?: number;
138
143
  minTTLInSeconds?: number;
144
+ attached?: boolean;
145
+ acked?: boolean;
139
146
  }
140
147
 
141
148
  export interface IPendingBlobs {
142
- [id: string]: { blob: string; uploadTime?: number; minTTLInSeconds?: number };
149
+ [id: string]: {
150
+ blob: string;
151
+ uploadTime?: number;
152
+ minTTLInSeconds?: number;
153
+ attached?: boolean;
154
+ acked?: boolean;
155
+ };
143
156
  }
144
157
 
145
158
  export interface IBlobManagerEvents {
@@ -227,11 +240,14 @@ export class BlobManager extends TypedEventEmitter<IBlobManagerEvents> {
227
240
  this.runtime.clientDetails.type !== summarizerClientType;
228
241
 
229
242
  this.runtime.on("disconnected", () => this.onDisconnected());
243
+
230
244
  this.redirectTable = this.load(snapshot);
231
245
 
232
246
  // Begin uploading stashed blobs from previous container instance
233
247
  Object.entries(stashedBlobs).forEach(([localId, entry]) => {
234
248
  const blob = stringToBuffer(entry.blob, "base64");
249
+ const attached = entry.attached;
250
+ const acked = entry.acked;
235
251
  if (entry.minTTLInSeconds && entry.uploadTime) {
236
252
  const timeLapseSinceLocalUpload = (Date.now() - entry.uploadTime) / 1000;
237
253
  // stashed entries with more than half-life in storage will not be reuploaded
@@ -243,6 +259,8 @@ export class BlobManager extends TypedEventEmitter<IBlobManagerEvents> {
243
259
  uploadP: undefined,
244
260
  uploadTime: entry.uploadTime,
245
261
  minTTLInSeconds: entry.minTTLInSeconds,
262
+ attached,
263
+ acked,
246
264
  });
247
265
  return;
248
266
  }
@@ -252,6 +270,8 @@ export class BlobManager extends TypedEventEmitter<IBlobManagerEvents> {
252
270
  status: PendingBlobStatus.OfflinePendingUpload,
253
271
  handleP: new Deferred(),
254
272
  uploadP: this.uploadBlob(localId, blob),
273
+ attached,
274
+ acked,
255
275
  });
256
276
  });
257
277
 
@@ -391,13 +411,23 @@ export class BlobManager extends TypedEventEmitter<IBlobManagerEvents> {
391
411
  );
392
412
  }
393
413
 
394
- private getBlobHandle(id: string): IFluidHandle<ArrayBufferLike> {
414
+ private getBlobHandle(id: string): BlobHandle {
395
415
  assert(
396
416
  this.redirectTable.has(id) || this.pendingBlobs.has(id),
397
417
  0x384 /* requesting handle for unknown blob */,
398
418
  );
399
- return new BlobHandle(`${BlobManager.basePath}/${id}`, this.routeContext, async () =>
400
- this.getBlob(id),
419
+ const pending = this.pendingBlobs.get(id);
420
+ const callback = pending
421
+ ? () => {
422
+ pending.attached = true;
423
+ this.deletePendingBlobMaybe(id);
424
+ }
425
+ : undefined;
426
+ return new BlobHandle(
427
+ `${BlobManager.basePath}/${id}`,
428
+ this.routeContext,
429
+ async () => this.getBlob(id),
430
+ callback,
401
431
  );
402
432
  }
403
433
 
@@ -433,6 +463,8 @@ export class BlobManager extends TypedEventEmitter<IBlobManagerEvents> {
433
463
  status: PendingBlobStatus.OnlinePendingUpload,
434
464
  handleP: new Deferred(),
435
465
  uploadP: this.uploadBlob(localId, blob),
466
+ attached: false,
467
+ acked: false,
436
468
  };
437
469
  this.pendingBlobs.set(localId, pendingEntry);
438
470
 
@@ -459,11 +491,14 @@ export class BlobManager extends TypedEventEmitter<IBlobManagerEvents> {
459
491
  this.redirectTable.set(fromId, toId);
460
492
  }
461
493
 
462
- private deleteAndEmitsIfEmpty(id: string) {
494
+ private deletePendingBlobMaybe(id: string) {
463
495
  if (this.pendingBlobs.has(id)) {
464
- this.pendingBlobs.delete(id);
465
- if (!this.hasPendingBlobs) {
466
- this.emit("noPendingBlobs");
496
+ const entry = this.pendingBlobs.get(id);
497
+ if (entry?.attached && entry?.acked) {
498
+ this.pendingBlobs.delete(id);
499
+ if (!this.hasPendingBlobs) {
500
+ this.emit("noPendingBlobs");
501
+ }
467
502
  }
468
503
  }
469
504
  }
@@ -493,7 +528,7 @@ export class BlobManager extends TypedEventEmitter<IBlobManagerEvents> {
493
528
  // happened before and so, the server won't delete it.
494
529
  this.setRedirection(localId, response.id);
495
530
  entry.handleP.resolve(this.getBlobHandle(localId));
496
- this.deleteAndEmitsIfEmpty(localId);
531
+ this.deletePendingBlobMaybe(localId);
497
532
  } else {
498
533
  // If there is already an op for this storage ID, append the local ID to the list. Once any op for
499
534
  // this storage ID is ack'd, all pending blobs for it can be resolved since the op will keep the
@@ -594,8 +629,8 @@ export class BlobManager extends TypedEventEmitter<IBlobManagerEvents> {
594
629
  }
595
630
 
596
631
  public processBlobAttachOp(message: ISequencedDocumentMessage, local: boolean) {
597
- const localId = message.metadata?.localId;
598
- const blobId = message.metadata?.blobId;
632
+ const localId = (message.metadata as IBlobMetadata | undefined)?.localId;
633
+ const blobId = (message.metadata as IBlobMetadata | undefined)?.blobId;
599
634
  assert(blobId !== undefined, 0x12a /* "Missing blob id on metadata" */);
600
635
 
601
636
  // Set up a mapping from local ID to storage ID. This is crucial since without this the blob cannot be
@@ -616,23 +651,29 @@ export class BlobManager extends TypedEventEmitter<IBlobManagerEvents> {
616
651
  // This is safe because the server will keep the blob alive and the op containing the local ID to
617
652
  // storage ID is already in flight and any op containing this local ID will be sequenced after that.
618
653
  waitingBlobs.forEach((pendingLocalId) => {
619
- const pendingBlobEntry = this.pendingBlobs.get(pendingLocalId);
654
+ const entry = this.pendingBlobs.get(pendingLocalId);
620
655
  assert(
621
- pendingBlobEntry !== undefined,
656
+ entry !== undefined,
622
657
  0x38f /* local online BlobAttach op with no pending blob entry */,
623
658
  );
624
659
 
625
660
  // It's possible we transitioned to offline flow while waiting for this op.
626
- if (pendingBlobEntry.status === PendingBlobStatus.OnlinePendingOp) {
661
+ if (entry.status === PendingBlobStatus.OnlinePendingOp) {
627
662
  this.setRedirection(pendingLocalId, blobId);
628
- pendingBlobEntry.handleP.resolve(this.getBlobHandle(pendingLocalId));
629
- this.deleteAndEmitsIfEmpty(pendingLocalId);
663
+ entry.acked = true;
664
+ entry.handleP.resolve(this.getBlobHandle(pendingLocalId));
665
+ this.deletePendingBlobMaybe(pendingLocalId);
630
666
  }
631
667
  });
632
668
  this.opsInFlight.delete(blobId);
633
669
  }
634
- // For blobs that were transitioned to offline flow while waiting for this op, the entry should be deleted.
635
- this.deleteAndEmitsIfEmpty(localId);
670
+ // offline flow does not resolve the handle (since it was already resolved)
671
+ // but we still need to delete the entry in case is acked and attached.
672
+ const localEntry = this.pendingBlobs.get(localId);
673
+ if (localEntry) {
674
+ localEntry.acked = true;
675
+ this.deletePendingBlobMaybe(localId);
676
+ }
636
677
  }
637
678
  }
638
679
 
@@ -905,13 +946,13 @@ export class BlobManager extends TypedEventEmitter<IBlobManagerEvents> {
905
946
  public getPendingBlobs(): IPendingBlobs {
906
947
  const blobs = {};
907
948
  for (const [key, entry] of this.pendingBlobs) {
908
- blobs[key] = entry.minTTLInSeconds
909
- ? {
910
- blob: bufferToString(entry.blob, "base64"),
911
- uploadTime: entry.uploadTime,
912
- minTTLInSeconds: entry.minTTLInSeconds,
913
- }
914
- : { blob: bufferToString(entry.blob, "base64") };
949
+ blobs[key] = {
950
+ blob: bufferToString(entry.blob, "base64"),
951
+ attached: entry.attached,
952
+ acked: entry.acked,
953
+ minTTLInSeconds: entry.minTTLInSeconds,
954
+ uploadTime: entry.uploadTime,
955
+ };
915
956
  }
916
957
  return blobs;
917
958
  }
@@ -187,7 +187,16 @@ class OpPerfTelemetry {
187
187
 
188
188
  private recordPingTime(latency: number) {
189
189
  this.pingLatency = latency;
190
- // logging one in every 1000 pongs, including the first time, if it is a "write" client.
190
+
191
+ // Log if latency is longer than 1 min
192
+ if (latency > 1000 * 60) {
193
+ this.logger.sendErrorEvent({
194
+ eventName: "LatencyTooLong",
195
+ duration: latency,
196
+ });
197
+ }
198
+
199
+ // logging one in every 100 pongs, including the first time, if it is a "write" client.
191
200
  if (this.pongCount % 100 === 0 && this.deltaManager.active) {
192
201
  this.logger.sendPerformanceEvent({
193
202
  eventName: "DeltaLatency",
@@ -2,8 +2,9 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { ITelemetryBaseLogger, ITelemetryGenericEvent } from "@fluidframework/common-definitions";
6
5
  import {
6
+ ITelemetryBaseLogger,
7
+ ITelemetryGenericEvent,
7
8
  FluidObject,
8
9
  IFluidHandle,
9
10
  IFluidHandleContext,
@@ -28,11 +29,11 @@ import {
28
29
  import {
29
30
  assert,
30
31
  delay,
31
- LazyPromise,
32
32
  Trace,
33
33
  TypedEventEmitter,
34
34
  unreachableCase,
35
35
  } from "@fluidframework/common-utils";
36
+ import { LazyPromise } from "@fluidframework/core-utils";
36
37
  import {
37
38
  ChildLogger,
38
39
  raiseConnectedEvent,
@@ -113,7 +114,11 @@ import { v4 as uuid } from "uuid";
113
114
  import { ContainerFluidHandleContext } from "./containerHandleContext";
114
115
  import { FluidDataStoreRegistry } from "./dataStoreRegistry";
115
116
  import { ReportOpPerfTelemetry, IPerfSignalReport } from "./connectionTelemetry";
116
- import { IPendingLocalState, PendingStateManager } from "./pendingStateManager";
117
+ import {
118
+ IPendingBatchMessage,
119
+ IPendingLocalState,
120
+ PendingStateManager,
121
+ } from "./pendingStateManager";
117
122
  import { pkgVersion } from "./packageVersion";
118
123
  import { BlobManager, IBlobManagerLoadInfo, IPendingBlobs } from "./blobManager";
119
124
  import { DataStores, getSummaryForDatastores } from "./dataStores";
@@ -175,8 +180,10 @@ import {
175
180
  OpSplitter,
176
181
  RemoteMessageProcessor,
177
182
  OpGroupingManager,
183
+ getLongStack,
178
184
  } from "./opLifecycle";
179
185
  import { DeltaManagerSummarizerProxy } from "./deltaManagerSummarizerProxy";
186
+ import { IBatchMetadata } from "./metadata";
180
187
 
181
188
  export enum ContainerMessageType {
182
189
  // An op to be delivered to store
@@ -833,6 +840,11 @@ export class ContainerRuntime
833
840
  }
834
841
 
835
842
  public get closeFn(): (error?: ICriticalContainerError) => void {
843
+ if (this._summarizer !== undefined) {
844
+ // In cases of summarizer, we want to dispose instead since consumer doesn't interact with this container
845
+ return this.disposeFn;
846
+ }
847
+
836
848
  // Also call disposeFn to retain functionality of runtime being disposed on close
837
849
  return (error?: ICriticalContainerError) => {
838
850
  this.context.closeFn(error);
@@ -1214,7 +1226,6 @@ export class ContainerRuntime
1214
1226
  getNodePackagePath: async (nodePath: string) => this.getGCNodePackagePath(nodePath),
1215
1227
  getLastSummaryTimestampMs: () => this.messageAtLastSummary?.timestamp,
1216
1228
  readAndParseBlob: async <T>(id: string) => readAndParse<T>(this.storage, id),
1217
- getContainerDiagnosticId: () => this.context.id,
1218
1229
  // GC runs in summarizer client and needs access to the real (non-proxy) active information. The proxy
1219
1230
  // delta manager would always return false for summarizer client.
1220
1231
  activeConnection: () => this.innerDeltaManager.active,
@@ -1307,7 +1318,7 @@ export class ContainerRuntime
1307
1318
  close: this.closeFn,
1308
1319
  connected: () => this.connected,
1309
1320
  reSubmit: this.reSubmit.bind(this),
1310
- orderSequentially: this.orderSequentially.bind(this),
1321
+ reSubmitBatch: this.reSubmitBatch.bind(this),
1311
1322
  },
1312
1323
  pendingRuntimeState?.pending,
1313
1324
  );
@@ -1336,6 +1347,7 @@ export class ContainerRuntime
1336
1347
  compressionOptions,
1337
1348
  maxBatchSizeInBytes: runtimeOptions.maxBatchSizeInBytes,
1338
1349
  disablePartialFlush: disablePartialFlush === true,
1350
+ enableGroupedBatching: this.groupedBatchingEnabled,
1339
1351
  },
1340
1352
  logger: this.mc.logger,
1341
1353
  groupingManager: opGroupingManager,
@@ -1343,6 +1355,9 @@ export class ContainerRuntime
1343
1355
  referenceSequenceNumber: this.deltaManager.lastSequenceNumber,
1344
1356
  clientSequenceNumber: this._processedClientSequenceNumber,
1345
1357
  }),
1358
+ reSubmit: this.reSubmit.bind(this),
1359
+ opReentrancy: () => this.ensureNoDataModelChangesCalls > 0,
1360
+ closeContainer: this.closeFn,
1346
1361
  });
1347
1362
 
1348
1363
  this.context.quorum.on("removeMember", (clientId: string) => {
@@ -2035,7 +2050,7 @@ export class ContainerRuntime
2035
2050
  local,
2036
2051
  type: message.type,
2037
2052
  contentType: typeof message.contents,
2038
- batch: message.metadata?.batch,
2053
+ batch: (message.metadata as IBatchMetadata | undefined)?.batch,
2039
2054
  compression: message.compression,
2040
2055
  },
2041
2056
  );
@@ -3098,6 +3113,9 @@ export class ContainerRuntime
3098
3113
  this.disableAttachReorder !== true
3099
3114
  ) {
3100
3115
  this.outbox.submitAttach(message);
3116
+ } else if (type === ContainerMessageType.BlobAttach) {
3117
+ // BlobAttach ops must have their metadata visible and cannot be grouped (see opGroupingManager.ts)
3118
+ this.outbox.submitBlobAttach(message);
3101
3119
  } else {
3102
3120
  this.outbox.submit(message);
3103
3121
  }
@@ -3191,7 +3209,7 @@ export class ContainerRuntime
3191
3209
  this.mc.logger.sendTelemetryEvent(
3192
3210
  { eventName: "OpReentry" },
3193
3211
  // We need to capture the call stack in order to inspect the source of this usage pattern
3194
- new UsageError(errorMessage),
3212
+ getLongStack(() => new UsageError(errorMessage)),
3195
3213
  );
3196
3214
  this.opReentryCallsToReport--;
3197
3215
  }
@@ -3214,14 +3232,19 @@ export class ContainerRuntime
3214
3232
  }
3215
3233
  }
3216
3234
 
3217
- private reSubmit(
3218
- content: string,
3219
- localOpMetadata: unknown,
3220
- opMetadata: Record<string, unknown> | undefined,
3221
- ) {
3235
+ private reSubmitBatch(batch: IPendingBatchMessage[]) {
3236
+ this.orderSequentially(() => {
3237
+ for (const message of batch) {
3238
+ this.reSubmit(message);
3239
+ }
3240
+ });
3241
+ this.flush();
3242
+ }
3243
+
3244
+ private reSubmit(message: IPendingBatchMessage) {
3222
3245
  // Need to parse from string for back-compat
3223
- const { contents, type } = this.parseOpContent(content);
3224
- this.reSubmitCore(type, contents, localOpMetadata, opMetadata);
3246
+ const { contents, type } = this.parseOpContent(message.content);
3247
+ this.reSubmitCore(type, contents, message.localOpMetadata, message.opMetadata);
3225
3248
  }
3226
3249
 
3227
3250
  /**
@@ -3,15 +3,22 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import { IDisposable, ITelemetryProperties } from "@fluidframework/common-definitions";
7
- import { FluidObject, IRequest, IResponse, IFluidHandle } from "@fluidframework/core-interfaces";
6
+ import {
7
+ IDisposable,
8
+ FluidObject,
9
+ IRequest,
10
+ IResponse,
11
+ IFluidHandle,
12
+ ITelemetryProperties,
13
+ } from "@fluidframework/core-interfaces";
8
14
  import {
9
15
  IAudience,
10
16
  IDeltaManager,
11
17
  AttachState,
12
18
  ILoaderOptions,
13
19
  } from "@fluidframework/container-definitions";
14
- import { assert, Deferred, LazyPromise, TypedEventEmitter } from "@fluidframework/common-utils";
20
+ import { assert, Deferred, TypedEventEmitter } from "@fluidframework/common-utils";
21
+ import { LazyPromise } from "@fluidframework/core-utils";
15
22
  import { IDocumentStorageService } from "@fluidframework/driver-definitions";
16
23
  import { BlobTreeEntry, readAndParse } from "@fluidframework/driver-utils";
17
24
  import {
@@ -390,7 +397,7 @@ export abstract class FluidDataStoreContext
390
397
  packageName: packagePathToTelemetryProperty(this.pkg),
391
398
  });
392
399
  this.channelDeferred?.reject(errorWrapped);
393
- this.logger.sendErrorEvent({ eventName: "RealizeError" }, errorWrapped);
400
+ this.mc.logger.sendErrorEvent({ eventName: "RealizeError" }, errorWrapped);
394
401
  });
395
402
  }
396
403
  return this.channelDeferred.promise;
@@ -780,7 +787,7 @@ export abstract class FluidDataStoreContext
780
787
  this.channelDeferred.resolve(this.channel);
781
788
  } catch (error) {
782
789
  this.channelDeferred?.reject(error);
783
- this.logger.sendErrorEvent(
790
+ this.mc.logger.sendErrorEvent(
784
791
  {
785
792
  eventName: "BindRuntimeError",
786
793
  fluidDataStoreId: {
@@ -3,8 +3,10 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import { IDisposable, ITelemetryBaseLogger } from "@fluidframework/common-definitions";
7
- import { assert, Deferred, Lazy } from "@fluidframework/common-utils";
6
+ import { ITelemetryBaseLogger } from "@fluidframework/common-definitions";
7
+ import { assert, Deferred } from "@fluidframework/common-utils";
8
+ import { Lazy } from "@fluidframework/core-utils";
9
+ import { IDisposable } from "@fluidframework/core-interfaces";
8
10
  import { ChildLogger, ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
9
11
  import { FluidDataStoreContext, LocalFluidDataStoreContext } from "./dataStoreContext";
10
12