@fluidframework/container-runtime 2.0.0-internal.2.1.0 → 2.0.0-internal.2.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/containerRuntime.d.ts +10 -0
- package/dist/containerRuntime.d.ts.map +1 -1
- package/dist/containerRuntime.js +1 -0
- package/dist/containerRuntime.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/runningSummarizer.d.ts +3 -2
- package/dist/runningSummarizer.d.ts.map +1 -1
- package/dist/runningSummarizer.js +10 -3
- package/dist/runningSummarizer.js.map +1 -1
- package/lib/containerRuntime.d.ts +10 -0
- package/lib/containerRuntime.d.ts.map +1 -1
- package/lib/containerRuntime.js +1 -0
- package/lib/containerRuntime.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/runningSummarizer.d.ts +3 -2
- package/lib/runningSummarizer.d.ts.map +1 -1
- package/lib/runningSummarizer.js +10 -3
- package/lib/runningSummarizer.js.map +1 -1
- package/package.json +23 -26
- package/src/containerRuntime.ts +13 -0
- package/src/packageVersion.ts +1 -1
- package/src/runningSummarizer.ts +11 -3
package/lib/packageVersion.d.ts
CHANGED
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
|
|
6
6
|
*/
|
|
7
7
|
export declare const pkgName = "@fluidframework/container-runtime";
|
|
8
|
-
export declare const pkgVersion = "2.0.0-internal.2.1.
|
|
8
|
+
export declare const pkgVersion = "2.0.0-internal.2.1.2";
|
|
9
9
|
//# sourceMappingURL=packageVersion.d.ts.map
|
package/lib/packageVersion.js
CHANGED
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
|
|
6
6
|
*/
|
|
7
7
|
export const pkgName = "@fluidframework/container-runtime";
|
|
8
|
-
export const pkgVersion = "2.0.0-internal.2.1.
|
|
8
|
+
export const pkgVersion = "2.0.0-internal.2.1.2";
|
|
9
9
|
//# sourceMappingURL=packageVersion.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,mCAAmC,CAAC;AAC3D,MAAM,CAAC,MAAM,UAAU,GAAG,sBAAsB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/container-runtime\";\nexport const pkgVersion = \"2.0.0-internal.2.1.
|
|
1
|
+
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,mCAAmC,CAAC;AAC3D,MAAM,CAAC,MAAM,UAAU,GAAG,sBAAsB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/container-runtime\";\nexport const pkgVersion = \"2.0.0-internal.2.1.2\";\n"]}
|
|
@@ -54,11 +54,12 @@ export declare class RunningSummarizer implements IDisposable {
|
|
|
54
54
|
handleOp(op: ISequencedDocumentMessage): void;
|
|
55
55
|
/**
|
|
56
56
|
* Can the given op trigger a summary?
|
|
57
|
-
* # Currently
|
|
57
|
+
* # Currently always prevents summaries for Summarize and SummaryAck/Nack ops
|
|
58
58
|
* @param op - op to check
|
|
59
|
-
* @returns true if this
|
|
59
|
+
* @returns true if this op can trigger a summary
|
|
60
60
|
*/
|
|
61
61
|
private opCanTriggerSummary;
|
|
62
|
+
private nonRuntimeOpCanTriggerSummary;
|
|
62
63
|
waitStop(allowLastSummary: boolean): Promise<void>;
|
|
63
64
|
private waitStart;
|
|
64
65
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runningSummarizer.d.ts","sourceRoot":"","sources":["../src/runningSummarizer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAInF,OAAO,EACH,yBAAyB,EAE5B,MAAM,sCAAsC,CAAC;AAE9C,OAAO,EACH,qBAAqB,EACxB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EACH,wBAAwB,EAExB,uBAAuB,EAEvB,yBAAyB,EACzB,sBAAsB,EACtB,oBAAoB,EACpB,qBAAqB,EACrB,mBAAmB,EACnB,yBAAyB,EACzB,iBAAiB,EAEjB,kBAAkB,EAErB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC/E,OAAO,EAGH,sBAAsB,EAEzB,MAAM,oBAAoB,CAAC;AAI5B;;;;;;GAMG;AACH,qBAAa,iBAAkB,YAAW,WAAW;IA6E7C,OAAO,CAAC,QAAQ,CAAC,cAAc;IAC/B,OAAO,CAAC,QAAQ,CAAC,aAAa;IAC9B,OAAO,CAAC,QAAQ,CAAC,qBAAqB;IACtC,OAAO,CAAC,QAAQ,CAAC,aAAa;IAC9B,OAAO,CAAC,QAAQ,CAAC,qBAAqB;IACtC,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAClC,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAClC,OAAO,CAAC,QAAQ,CAAC,sBAAsB;IACvC,OAAO,CAAC,QAAQ,CAAC,OAAO;WApFR,KAAK,CACrB,MAAM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AAgB,CAAC,EACpB,MAAM,EACN,mBAAuB,EACvB,QAAgB,EAChB,GAAG,OAAO,EACb,EAAE,wBAAwB,GAAG,sBAAsB;IA8BpD,OAAO,CAAC,qBAAqB;IAwB7B,OAAO,CAAC,sBAAsB;CAMjC"}
|
package/lib/runningSummarizer.js
CHANGED
|
@@ -165,9 +165,9 @@ export class RunningSummarizer {
|
|
|
165
165
|
}
|
|
166
166
|
/**
|
|
167
167
|
* Can the given op trigger a summary?
|
|
168
|
-
* # Currently
|
|
168
|
+
* # Currently always prevents summaries for Summarize and SummaryAck/Nack ops
|
|
169
169
|
* @param op - op to check
|
|
170
|
-
* @returns true if this
|
|
170
|
+
* @returns true if this op can trigger a summary
|
|
171
171
|
*/
|
|
172
172
|
opCanTriggerSummary(op) {
|
|
173
173
|
switch (op.type) {
|
|
@@ -176,9 +176,16 @@ export class RunningSummarizer {
|
|
|
176
176
|
case MessageType.SummaryNack:
|
|
177
177
|
return false;
|
|
178
178
|
default:
|
|
179
|
-
return
|
|
179
|
+
return isRuntimeMessage(op) || this.nonRuntimeOpCanTriggerSummary();
|
|
180
180
|
}
|
|
181
181
|
}
|
|
182
|
+
nonRuntimeOpCanTriggerSummary() {
|
|
183
|
+
// eslint-disable-next-line max-len
|
|
184
|
+
const opsSinceLastAck = this.heuristicData.lastOpSequenceNumber - this.heuristicData.lastSuccessfulSummary.refSequenceNumber;
|
|
185
|
+
return this.configuration.state === "enabled"
|
|
186
|
+
&& (this.configuration.nonRuntimeHeuristicThreshold === undefined
|
|
187
|
+
|| this.configuration.nonRuntimeHeuristicThreshold <= opsSinceLastAck);
|
|
188
|
+
}
|
|
182
189
|
async waitStop(allowLastSummary) {
|
|
183
190
|
var _a;
|
|
184
191
|
if (this.stopping) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runningSummarizer.js","sourceRoot":"","sources":["../src/runningSummarizer.ts"],"names":[],"mappings":"AAAA;;;GAGG;;;;;;;;;;;;AAGH,OAAO,EAA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AAC;CACJ","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IDisposable, ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport { assert, delay, Deferred, PromiseTimer } from \"@fluidframework/common-utils\";\nimport { UsageError } from \"@fluidframework/container-utils\";\nimport { isRuntimeMessage } from \"@fluidframework/driver-utils\";\nimport {\n ISequencedDocumentMessage,\n MessageType,\n} from \"@fluidframework/protocol-definitions\";\nimport { ChildLogger } from \"@fluidframework/telemetry-utils\";\nimport {\n ISummaryConfiguration,\n} from \"./containerRuntime\";\nimport { opSize } from \"./opProperties\";\nimport { SummarizeHeuristicRunner } from \"./summarizerHeuristics\";\nimport {\n IEnqueueSummarizeOptions,\n ISummarizeOptions,\n ISummarizeHeuristicData,\n ISummarizeHeuristicRunner,\n IOnDemandSummarizeOptions,\n EnqueueSummarizeResult,\n SummarizerStopReason,\n ISubmitSummaryOptions,\n SubmitSummaryResult,\n ISummaryCancellationToken,\n ISummarizeResults,\n ISummarizeTelemetryProperties,\n ISummarizerRuntime,\n ISummarizeRunnerTelemetry,\n} from \"./summarizerTypes\";\nimport { IClientSummaryWatcher, SummaryCollection } from \"./summaryCollection\";\nimport {\n raceTimer,\n SummarizeReason,\n SummarizeResultBuilder,\n SummaryGenerator,\n} from \"./summaryGenerator\";\n\nconst maxSummarizeAckWaitTime = 10 * 60 * 1000; // 10 minutes\n\n/**\n * An instance of RunningSummarizer manages the heuristics for summarizing.\n * Until disposed, the instance of RunningSummarizer can assume that it is\n * in a state of running, meaning it is connected and initialized. It keeps\n * track of summaries that it is generating as they are broadcast and acked/nacked.\n * This object is created and controlled by Summarizer object.\n */\nexport class RunningSummarizer implements IDisposable {\n public static async start(\n logger: ITelemetryLogger,\n summaryWatcher: IClientSummaryWatcher,\n configuration: ISummaryConfiguration,\n submitSummaryCallback: (options: ISubmitSummaryOptions) => Promise<SubmitSummaryResult>,\n heuristicData: ISummarizeHeuristicData,\n raiseSummarizingError: (errorMessage: string) => void,\n summaryCollection: SummaryCollection,\n cancellationToken: ISummaryCancellationToken,\n stopSummarizerCallback: (reason: SummarizerStopReason) => void,\n runtime: ISummarizerRuntime,\n ): Promise<RunningSummarizer> {\n const summarizer = new RunningSummarizer(\n logger,\n summaryWatcher,\n configuration,\n submitSummaryCallback,\n heuristicData,\n raiseSummarizingError,\n summaryCollection,\n cancellationToken,\n stopSummarizerCallback,\n runtime);\n\n await summarizer.waitStart();\n\n // Update heuristic counts\n // By the time we get here, there are potentially ops missing from the heuristic summary counts\n // Examples of where this could happen:\n // 1. Op is processed during the time that we are initiating the RunningSummarizer instance but before we\n // listen for the op events (will get missed by the handlers in the current workflow)\n // 2. Op was sequenced after the last time we summarized (op sequence number > summarize ref sequence number)\n const diff = runtime.deltaManager.lastSequenceNumber - (\n heuristicData.lastSuccessfulSummary.refSequenceNumber\n + heuristicData.numNonRuntimeOps\n + heuristicData.numRuntimeOps);\n heuristicData.hasMissingOpData = diff > 0;\n\n if (heuristicData.hasMissingOpData) {\n // Split the diff 50-50 and increment the counts appropriately\n heuristicData.numNonRuntimeOps += Math.ceil(diff / 2);\n heuristicData.numRuntimeOps += Math.floor(diff / 2);\n }\n\n // Update last seq number (in case the handlers haven't processed anything yet)\n heuristicData.lastOpSequenceNumber = runtime.deltaManager.lastSequenceNumber;\n\n // Start heuristics\n summarizer.heuristicRunner?.start();\n summarizer.heuristicRunner?.run();\n\n return summarizer;\n }\n\n public get disposed() { return this._disposed; }\n private stopping = false;\n private _disposed = false;\n private summarizingLock: Promise<void> | undefined;\n private refreshSummaryAckLock: Promise<void> | undefined;\n private tryWhileSummarizing = false;\n private readonly pendingAckTimer: PromiseTimer;\n private heuristicRunner?: ISummarizeHeuristicRunner;\n private readonly generator: SummaryGenerator;\n private readonly logger: ITelemetryLogger;\n private enqueuedSummary: {\n reason: SummarizeReason;\n afterSequenceNumber: number;\n options: ISummarizeOptions;\n readonly resultsBuilder: SummarizeResultBuilder;\n } | undefined;\n private summarizeCount = 0;\n private totalSuccessfulAttempts = 0;\n private initialized = false;\n\n private constructor(\n baseLogger: ITelemetryLogger,\n private readonly summaryWatcher: IClientSummaryWatcher,\n private readonly configuration: ISummaryConfiguration,\n private readonly submitSummaryCallback: (options: ISubmitSummaryOptions) => Promise<SubmitSummaryResult>,\n private readonly heuristicData: ISummarizeHeuristicData,\n private readonly raiseSummarizingError: (errorMessage: string) => void,\n private readonly summaryCollection: SummaryCollection,\n private readonly cancellationToken: ISummaryCancellationToken,\n private readonly stopSummarizerCallback: (reason: SummarizerStopReason) => void,\n private readonly runtime: ISummarizerRuntime,\n ) {\n const telemetryProps: ISummarizeRunnerTelemetry = {\n summarizeCount: () => this.summarizeCount,\n summarizerSuccessfulAttempts: () => this.totalSuccessfulAttempts,\n };\n\n this.logger = ChildLogger.create(\n baseLogger, \"Running\",\n {\n all: telemetryProps,\n },\n );\n\n if (configuration.state !== \"disableHeuristics\") {\n assert(this.configuration.state === \"enabled\", 0x2ea /* \"Configuration state should be enabled\" */);\n this.heuristicRunner = new SummarizeHeuristicRunner(\n heuristicData,\n this.configuration,\n (reason) => this.trySummarize(reason),\n this.logger);\n }\n\n assert(\n this.configuration.state !== \"disabled\",\n 0x2eb /* \"Summary not supported with configuration disabled\" */,\n );\n\n // Cap the maximum amount of time client will wait for a summarize op ack to maxSummarizeAckWaitTime\n // configuration.maxAckWaitTime is composed from defaults, server values, and runtime overrides\n\n const maxAckWaitTime = Math.min(this.configuration.maxAckWaitTime, maxSummarizeAckWaitTime);\n\n this.pendingAckTimer = new PromiseTimer(\n maxAckWaitTime,\n () => {\n // pre-0.58 error message: summaryAckWaitTimeout\n this.raiseSummarizingError(\"Pending summary ack not received in time\");\n // Note: summarizeCount (from ChildLogger definition) may be 0,\n // since this code path is hit when RunningSummarizer first starts up,\n // before this instance has kicked off a new summarize run.\n this.logger.sendErrorEvent({\n eventName: \"SummaryAckWaitTimeout\",\n maxAckWaitTime,\n referenceSequenceNumber: this.heuristicData.lastAttempt.refSequenceNumber,\n summarySequenceNumber: this.heuristicData.lastAttempt.summarySequenceNumber,\n timePending: Date.now() - this.heuristicData.lastAttempt.summaryTime,\n });\n });\n // Set up pending ack timeout by op timestamp differences for previous summaries.\n summaryCollection.setPendingAckTimerTimeoutCallback(maxAckWaitTime, () => {\n if (this.pendingAckTimer.hasTimer) {\n this.logger.sendTelemetryEvent({\n eventName: \"MissingSummaryAckFoundByOps\",\n referenceSequenceNumber: this.heuristicData.lastAttempt.refSequenceNumber,\n summarySequenceNumber: this.heuristicData.lastAttempt.summarySequenceNumber,\n });\n this.pendingAckTimer.clear();\n }\n });\n\n this.generator = new SummaryGenerator(\n this.pendingAckTimer,\n this.heuristicData,\n this.submitSummaryCallback,\n this.raiseSummarizingError,\n () => { this.totalSuccessfulAttempts++; },\n this.summaryWatcher,\n this.logger,\n );\n\n // Listen for ops\n this.runtime.deltaManager.on(\"op\", (op) => { this.handleOp(op); });\n }\n\n public dispose(): void {\n this.runtime.deltaManager.off(\"op\", (op) => { this.handleOp(op); });\n this.summaryWatcher.dispose();\n this.heuristicRunner?.dispose();\n this.heuristicRunner = undefined;\n this.generator.dispose();\n this.pendingAckTimer.clear();\n this.disposeEnqueuedSummary();\n this._disposed = true;\n this.stopping = true;\n }\n\n /**\n * RunningSummarizer's logger includes the sequenced index of the current summary on each event.\n * If some other Summarizer code wants that event on their logs they can get it here,\n * but only if they're logging about that same summary.\n * @param summaryOpRefSeq - RefSeq number of the summary op, to ensure the log correlation will be correct\n */\n public tryGetCorrelatedLogger = (summaryOpRefSeq) =>\n this.heuristicData.lastAttempt.refSequenceNumber === summaryOpRefSeq\n ? this.logger\n : undefined;\n\n /** We only want a single heuristic runner micro-task (will provide better optimized grouping of ops) */\n private heuristicRunnerMicroTaskExists = false;\n\n public handleOp(op: ISequencedDocumentMessage) {\n this.heuristicData.lastOpSequenceNumber = op.sequenceNumber;\n\n if (isRuntimeMessage(op)) {\n this.heuristicData.numRuntimeOps++;\n } else {\n this.heuristicData.numNonRuntimeOps++;\n }\n\n this.heuristicData.totalOpsSize += opSize(op);\n\n // Check for enqueued on-demand summaries; Intentionally do nothing otherwise\n if (this.initialized\n && this.opCanTriggerSummary(op)\n && !this.tryRunEnqueuedSummary()\n && !this.heuristicRunnerMicroTaskExists) {\n this.heuristicRunnerMicroTaskExists = true;\n Promise.resolve().then(() => {\n this.heuristicRunner?.run();\n }).finally(() => {\n this.heuristicRunnerMicroTaskExists = false;\n });\n }\n }\n\n /**\n * Can the given op trigger a summary?\n * # Currently only prevents summaries for Summarize and SummaryAck ops\n * @param op - op to check\n * @returns true if this type of op can trigger a summary\n */\n private opCanTriggerSummary(op: ISequencedDocumentMessage): boolean {\n switch (op.type) {\n case MessageType.Summarize:\n case MessageType.SummaryAck:\n case MessageType.SummaryNack:\n return false;\n default:\n return true;\n }\n }\n\n public async waitStop(allowLastSummary: boolean): Promise<void> {\n if (this.stopping) {\n return;\n }\n\n this.stopping = true;\n\n this.disposeEnqueuedSummary();\n\n // This will try to run lastSummary if needed.\n if (allowLastSummary && this.heuristicRunner?.shouldRunLastSummary()) {\n if (this.summarizingLock === undefined) {\n this.trySummarizeOnce(\n // summarizeProps\n { reason: \"lastSummary\" },\n // ISummarizeOptions, using defaults: { refreshLatestAck: false, fullTree: false }\n {});\n }\n }\n\n // Note that trySummarizeOnce() call above returns right away, without waiting.\n // So we need to wait for its completion, otherwise it would be destroyed right away.\n // That said, if summary lock was taken upfront, this wait might wait on multiple retries to\n // submit summary. We should reconsider this flow and make summarizer move to exit faster.\n // This resolves when the current pending summary gets an ack or fails.\n await this.summarizingLock;\n }\n\n private async waitStart() {\n // Wait no longer than ack timeout for all pending\n const waitStartResult = await raceTimer(\n this.summaryWatcher.waitFlushed(),\n this.pendingAckTimer.start(),\n );\n this.pendingAckTimer.clear();\n\n // Remove pending ack wait timeout by op timestamp comparison, because\n // it has race conditions with summaries submitted by this same client.\n this.summaryCollection.unsetPendingAckTimerTimeoutCallback();\n\n if (waitStartResult.result === \"done\" && waitStartResult.value !== undefined) {\n this.heuristicData.updateWithLastSummaryAckInfo({\n refSequenceNumber: waitStartResult.value.summaryOp.referenceSequenceNumber,\n // This will be the Summarizer starting point so only use timestamps from client's machine.\n summaryTime: Date.now(),\n summarySequenceNumber: waitStartResult.value.summaryOp.sequenceNumber,\n });\n }\n this.initialized = true;\n }\n\n /**\n * Blocks a new summarizer from running in case RefreshSummaryAck is being processed.\n * Assumes that caller checked upfront for lack of concurrent action (this.refreshSummaryAckLock)\n * before calling this API. I.e. caller is responsible for either erroring out or waiting on this promise.\n * Note: The refreshSummaryAckLock makes sure no summarizer gets enqueued or processed\n * until the refresh has completed. One can't rely uniquely on the summarizingLock as the\n * refreshLatestSummaryAck also happens during the time summarizingLock !== undefined.\n * Ex. Summarizer submits a summay + op and then waits for the Summary Ack to proceed\n * with the refreshLatestSummaryAck and complete the summary.\n * @param action - action to perform.\n * @returns - result of action.\n */\n public async lockedRefreshSummaryAckAction<T>(action: () => Promise<T>) {\n assert(this.refreshSummaryAckLock === undefined,\n 0x396 /* Refresh Summary Ack - Caller is responsible for checking lock */);\n\n const refreshSummaryAckLock = new Deferred<void>();\n this.refreshSummaryAckLock = refreshSummaryAckLock.promise;\n\n return action().finally(() => {\n refreshSummaryAckLock.resolve();\n this.refreshSummaryAckLock = undefined;\n });\n }\n\n /**\n * Runs single summary action that prevents any other concurrent actions.\n * Assumes that caller checked upfront for lack of concurrent action (this.summarizingLock)\n * before calling this API. I.e. caller is responsible for either erroring out or waiting on this promise.\n * @param action - action to perform.\n * @returns - result of action.\n */\n private async lockedSummaryAction<T>(action: () => Promise<T>) {\n assert(this.summarizingLock === undefined, 0x25b /* \"Caller is responsible for checking lock\" */);\n\n const summarizingLock = new Deferred<void>();\n this.summarizingLock = summarizingLock.promise;\n\n this.summarizeCount++;\n // Make sure the RefreshLatestSummaryAck is not being executed.\n await this.refreshSummaryAckLock;\n\n return action().finally(() => {\n summarizingLock.resolve();\n this.summarizingLock = undefined;\n\n const retry = this.tryWhileSummarizing;\n this.tryWhileSummarizing = false;\n\n // After summarizing, we should check to see if we need to summarize again.\n // Rerun the heuristics and check for enqueued summaries.\n if (!this.stopping && !this.tryRunEnqueuedSummary() && retry) {\n this.heuristicRunner?.run();\n }\n });\n }\n\n /**\n * Runs single summarize attempt\n * @param summarizeProps - props to log with each telemetry event associated with this attempt\n * @param options - summary options\n * @param cancellationToken - cancellation token to use to be able to cancel this summary, if needed\n * @param resultsBuilder - optional, result builder to use.\n * @returns ISummarizeResult - result of running a summary.\n */\n private trySummarizeOnce(\n summarizeProps: ISummarizeTelemetryProperties,\n options: ISummarizeOptions,\n cancellationToken = this.cancellationToken,\n resultsBuilder = new SummarizeResultBuilder()): ISummarizeResults {\n this.lockedSummaryAction(async () => {\n const summarizeResult = this.generator.summarize(\n summarizeProps,\n options,\n cancellationToken,\n resultsBuilder);\n // ensure we wait till the end of the process\n return summarizeResult.receivedSummaryAckOrNack;\n }).catch((error) => {\n // SummaryGenerator.summarize() does not throw exceptions - it converts them to failed result\n // on resultsBuilder\n // We do not care about exceptions on receivedSummaryAckOrNack - caller should check results\n // and take a appropriate action.\n });\n\n return resultsBuilder.build();\n }\n\n /** Heuristics summarize attempt. */\n private trySummarize(\n reason: SummarizeReason,\n cancellationToken = this.cancellationToken): void {\n if (this.summarizingLock !== undefined) {\n // lockedSummaryAction() will retry heuristic-based summary at the end of current attempt\n // if it's still needed\n this.tryWhileSummarizing = true;\n return;\n }\n\n this.lockedSummaryAction(async () => {\n const attempts: (ISummarizeOptions & { delaySeconds?: number; })[] = [\n { refreshLatestAck: false, fullTree: false },\n { refreshLatestAck: true, fullTree: false },\n { refreshLatestAck: true, fullTree: false, delaySeconds: 2 * 60 },\n { refreshLatestAck: true, fullTree: true, delaySeconds: 10 * 60 },\n ];\n let overrideDelaySeconds: number | undefined;\n let summaryAttempts = 0;\n let summaryAttemptsPerPhase = 0;\n\n let lastResult: { message: string; error: any; } | undefined;\n\n for (let summaryAttemptPhase = 0; summaryAttemptPhase < attempts.length;) {\n if (this.cancellationToken.cancelled) {\n return;\n }\n\n // We only want to attempt 1 summary when reason is \"lastSummary\"\n if (++summaryAttempts > 1 && reason === \"lastSummary\") {\n return;\n }\n\n summaryAttemptsPerPhase++;\n\n const { delaySeconds: regularDelaySeconds = 0, ...options } = attempts[summaryAttemptPhase];\n const delaySeconds = overrideDelaySeconds ?? regularDelaySeconds;\n\n const summarizeProps: ISummarizeTelemetryProperties = {\n reason,\n summaryAttempts,\n summaryAttemptsPerPhase,\n summaryAttemptPhase: summaryAttemptPhase + 1, // make everything 1-based\n ...options,\n };\n\n if (delaySeconds > 0) {\n this.logger.sendPerformanceEvent({\n eventName: \"SummarizeAttemptDelay\",\n duration: delaySeconds,\n summaryNackDelay: overrideDelaySeconds !== undefined,\n ...summarizeProps,\n });\n await delay(delaySeconds * 1000);\n }\n\n // Make sure the refresh Summary Ack is not being executed.\n await this.refreshSummaryAckLock;\n\n // Note: no need to account for cancellationToken.waitCancelled here, as\n // this is accounted SummaryGenerator.summarizeCore that controls receivedSummaryAckOrNack.\n const resultSummarize = this.generator.summarize(summarizeProps, options, cancellationToken);\n const result = await resultSummarize.receivedSummaryAckOrNack;\n\n if (result.success) {\n return;\n }\n // Check for retryDelay that can come from summaryNack or upload summary flow.\n // Retry the same step only once per retryAfter response.\n overrideDelaySeconds = result.retryAfterSeconds;\n if (overrideDelaySeconds === undefined || summaryAttemptsPerPhase > 1) {\n summaryAttemptPhase++;\n summaryAttemptsPerPhase = 0;\n }\n lastResult = result;\n }\n\n // If all attempts failed, log error (with last attempt info) and close the summarizer container\n this.logger.sendErrorEvent({\n eventName: \"FailToSummarize\",\n reason,\n message: lastResult?.message,\n }, lastResult?.error);\n\n this.stopSummarizerCallback(\"failToSummarize\");\n }).catch((error) => {\n this.logger.sendErrorEvent({ eventName: \"UnexpectedSummarizeError\" }, error);\n });\n }\n\n /** {@inheritdoc (ISummarizer:interface).summarizeOnDemand} */\n public summarizeOnDemand(\n resultsBuilder: SummarizeResultBuilder = new SummarizeResultBuilder(),\n {\n reason,\n ...options\n }: IOnDemandSummarizeOptions): ISummarizeResults {\n if (this.stopping) {\n resultsBuilder.fail(\"RunningSummarizer stopped or disposed\", undefined);\n return resultsBuilder.build();\n }\n // Check for concurrent summary attempts. If one is found,\n // return a promise that caller can await before trying again.\n if (this.summarizingLock !== undefined) {\n // The heuristics are blocking concurrent summarize attempts.\n throw new UsageError(\"Attempted to run an already-running summarizer on demand\");\n }\n\n const result = this.trySummarizeOnce(\n { reason: `onDemand/${reason}` },\n options,\n this.cancellationToken,\n resultsBuilder);\n return result;\n }\n\n /** {@inheritdoc (ISummarizer:interface).enqueueSummarize} */\n public enqueueSummarize({\n reason,\n afterSequenceNumber = 0,\n override = false,\n ...options\n }: IEnqueueSummarizeOptions): EnqueueSummarizeResult {\n const onDemandReason = `enqueue;${reason}` as const;\n let overridden = false;\n if (this.enqueuedSummary !== undefined) {\n if (!override) {\n return { alreadyEnqueued: true };\n }\n // Override existing enqueued summarize attempt.\n this.enqueuedSummary.resultsBuilder.fail(\n \"Aborted; overridden by another enqueue summarize attempt\",\n undefined,\n );\n this.enqueuedSummary = undefined;\n overridden = true;\n }\n this.enqueuedSummary = {\n reason: onDemandReason,\n afterSequenceNumber,\n options,\n resultsBuilder: new SummarizeResultBuilder(),\n };\n const results = this.enqueuedSummary.resultsBuilder.build();\n this.tryRunEnqueuedSummary();\n return overridden ? {\n ...results,\n alreadyEnqueued: true,\n overridden: true,\n } : results;\n }\n\n private tryRunEnqueuedSummary() {\n if (this.stopping) {\n this.disposeEnqueuedSummary();\n return false;\n }\n if (\n this.enqueuedSummary === undefined\n || this.heuristicData.lastOpSequenceNumber < this.enqueuedSummary.afterSequenceNumber\n || this.summarizingLock !== undefined\n ) {\n // If no enqueued summary is ready or a summary is already in progress, take no action.\n return false;\n }\n const { reason, resultsBuilder, options } = this.enqueuedSummary;\n // Set to undefined first, so that subsequent enqueue attempt while summarize will occur later.\n this.enqueuedSummary = undefined;\n this.trySummarizeOnce(\n { reason: `enqueuedSummary/${reason}` },\n options,\n this.cancellationToken,\n resultsBuilder);\n return true;\n }\n\n private disposeEnqueuedSummary() {\n if (this.enqueuedSummary !== undefined) {\n this.enqueuedSummary.resultsBuilder.fail(\"RunningSummarizer stopped or disposed\", undefined);\n this.enqueuedSummary = undefined;\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"runningSummarizer.js","sourceRoot":"","sources":["../src/runningSummarizer.ts"],"names":[],"mappings":"AAAA;;;GAGG;;;;;;;;;;;;AAGH,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AACrF,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAEH,WAAW,GACd,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAI9D,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAkBlE,OAAO,EACH,SAAS,EAET,sBAAsB,EACtB,gBAAgB,GACnB,MAAM,oBAAoB,CAAC;AAE5B,MAAM,uBAAuB,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,aAAa;AAE7D;;;;;;GAMG;AACH,MAAM,OAAO,iBAAiB;IA2E1B,YACI,UAA4B,EACX,cAAqC,EACrC,aAAoC,EACpC,qBAAuF,EACvF,aAAsC,EACtC,qBAAqD,EACrD,iBAAoC,EACpC,iBAA4C,EAC5C,sBAA8D,EAC9D,OAA2B;QAR3B,mBAAc,GAAd,cAAc,CAAuB;QACrC,kBAAa,GAAb,aAAa,CAAuB;QACpC,0BAAqB,GAArB,qBAAqB,CAAkE;QACvF,kBAAa,GAAb,aAAa,CAAyB;QACtC,0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OAAO,KAAK,CAAC;SAChB;QACD,IACI,IAAI,CAAC,eAAe,KAAK,SAAS;eAC/B,IAAI,CAAC,aAAa,CAAC,oBAAoB,GAAG,IAAI,CAAC,eAAe,CAAC,mBAAmB;eAClF,IAAI,CAAC,eAAe,KAAK,SAAS,EACvC;YACE,uFAAuF;YACvF,OAAO,KAAK,CAAC;SAChB;QACD,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,eAAe,CAAC;QACjE,+FAA+F;QAC/F,IAAI,CAAC,eAAe,GAAG,SAAS,CAAC;QACjC,IAAI,CAAC,gBAAgB,CACjB,EAAE,MAAM,EAAE,mBAAmB,MAAM,EAAE,EAAE,EACvC,OAAO,EACP,IAAI,CAAC,iBAAiB,EACtB,cAAc,CAAC,CAAC;QACpB,OAAO,IAAI,CAAC;IAChB,CAAC;IAEO,sBAAsB;QAC1B,IAAI,IAAI,CAAC,eAAe,KAAK,SAAS,EAAE;YACpC,IAAI,CAAC,eAAe,CAAC,cAAc,CAAC,IAAI,CAAC,uCAAuC,EAAE,SAAS,CAAC,CAAC;YAC7F,IAAI,CAAC,eAAe,GAAG,SAAS,CAAC;SACpC;IACL,CAAC;CACJ","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IDisposable, ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport { assert, delay, Deferred, PromiseTimer } from \"@fluidframework/common-utils\";\nimport { UsageError } from \"@fluidframework/container-utils\";\nimport { isRuntimeMessage } from \"@fluidframework/driver-utils\";\nimport {\n ISequencedDocumentMessage,\n MessageType,\n} from \"@fluidframework/protocol-definitions\";\nimport { ChildLogger } from \"@fluidframework/telemetry-utils\";\nimport {\n ISummaryConfiguration,\n} from \"./containerRuntime\";\nimport { opSize } from \"./opProperties\";\nimport { SummarizeHeuristicRunner } from \"./summarizerHeuristics\";\nimport {\n IEnqueueSummarizeOptions,\n ISummarizeOptions,\n ISummarizeHeuristicData,\n ISummarizeHeuristicRunner,\n IOnDemandSummarizeOptions,\n EnqueueSummarizeResult,\n SummarizerStopReason,\n ISubmitSummaryOptions,\n SubmitSummaryResult,\n ISummaryCancellationToken,\n ISummarizeResults,\n ISummarizeTelemetryProperties,\n ISummarizerRuntime,\n ISummarizeRunnerTelemetry,\n} from \"./summarizerTypes\";\nimport { IClientSummaryWatcher, SummaryCollection } from \"./summaryCollection\";\nimport {\n raceTimer,\n SummarizeReason,\n SummarizeResultBuilder,\n SummaryGenerator,\n} from \"./summaryGenerator\";\n\nconst maxSummarizeAckWaitTime = 10 * 60 * 1000; // 10 minutes\n\n/**\n * An instance of RunningSummarizer manages the heuristics for summarizing.\n * Until disposed, the instance of RunningSummarizer can assume that it is\n * in a state of running, meaning it is connected and initialized. It keeps\n * track of summaries that it is generating as they are broadcast and acked/nacked.\n * This object is created and controlled by Summarizer object.\n */\nexport class RunningSummarizer implements IDisposable {\n public static async start(\n logger: ITelemetryLogger,\n summaryWatcher: IClientSummaryWatcher,\n configuration: ISummaryConfiguration,\n submitSummaryCallback: (options: ISubmitSummaryOptions) => Promise<SubmitSummaryResult>,\n heuristicData: ISummarizeHeuristicData,\n raiseSummarizingError: (errorMessage: string) => void,\n summaryCollection: SummaryCollection,\n cancellationToken: ISummaryCancellationToken,\n stopSummarizerCallback: (reason: SummarizerStopReason) => void,\n runtime: ISummarizerRuntime,\n ): Promise<RunningSummarizer> {\n const summarizer = new RunningSummarizer(\n logger,\n summaryWatcher,\n configuration,\n submitSummaryCallback,\n heuristicData,\n raiseSummarizingError,\n summaryCollection,\n cancellationToken,\n stopSummarizerCallback,\n runtime);\n\n await summarizer.waitStart();\n\n // Update heuristic counts\n // By the time we get here, there are potentially ops missing from the heuristic summary counts\n // Examples of where this could happen:\n // 1. Op is processed during the time that we are initiating the RunningSummarizer instance but before we\n // listen for the op events (will get missed by the handlers in the current workflow)\n // 2. Op was sequenced after the last time we summarized (op sequence number > summarize ref sequence number)\n const diff = runtime.deltaManager.lastSequenceNumber - (\n heuristicData.lastSuccessfulSummary.refSequenceNumber\n + heuristicData.numNonRuntimeOps\n + heuristicData.numRuntimeOps);\n heuristicData.hasMissingOpData = diff > 0;\n\n if (heuristicData.hasMissingOpData) {\n // Split the diff 50-50 and increment the counts appropriately\n heuristicData.numNonRuntimeOps += Math.ceil(diff / 2);\n heuristicData.numRuntimeOps += Math.floor(diff / 2);\n }\n\n // Update last seq number (in case the handlers haven't processed anything yet)\n heuristicData.lastOpSequenceNumber = runtime.deltaManager.lastSequenceNumber;\n\n // Start heuristics\n summarizer.heuristicRunner?.start();\n summarizer.heuristicRunner?.run();\n\n return summarizer;\n }\n\n public get disposed() { return this._disposed; }\n private stopping = false;\n private _disposed = false;\n private summarizingLock: Promise<void> | undefined;\n private refreshSummaryAckLock: Promise<void> | undefined;\n private tryWhileSummarizing = false;\n private readonly pendingAckTimer: PromiseTimer;\n private heuristicRunner?: ISummarizeHeuristicRunner;\n private readonly generator: SummaryGenerator;\n private readonly logger: ITelemetryLogger;\n private enqueuedSummary: {\n reason: SummarizeReason;\n afterSequenceNumber: number;\n options: ISummarizeOptions;\n readonly resultsBuilder: SummarizeResultBuilder;\n } | undefined;\n private summarizeCount = 0;\n private totalSuccessfulAttempts = 0;\n private initialized = false;\n\n private constructor(\n baseLogger: ITelemetryLogger,\n private readonly summaryWatcher: IClientSummaryWatcher,\n private readonly configuration: ISummaryConfiguration,\n private readonly submitSummaryCallback: (options: ISubmitSummaryOptions) => Promise<SubmitSummaryResult>,\n private readonly heuristicData: ISummarizeHeuristicData,\n private readonly raiseSummarizingError: (errorMessage: string) => void,\n private readonly summaryCollection: SummaryCollection,\n private readonly cancellationToken: ISummaryCancellationToken,\n private readonly stopSummarizerCallback: (reason: SummarizerStopReason) => void,\n private readonly runtime: ISummarizerRuntime,\n ) {\n const telemetryProps: ISummarizeRunnerTelemetry = {\n summarizeCount: () => this.summarizeCount,\n summarizerSuccessfulAttempts: () => this.totalSuccessfulAttempts,\n };\n\n this.logger = ChildLogger.create(\n baseLogger, \"Running\",\n {\n all: telemetryProps,\n },\n );\n\n if (configuration.state !== \"disableHeuristics\") {\n assert(this.configuration.state === \"enabled\", 0x2ea /* \"Configuration state should be enabled\" */);\n this.heuristicRunner = new SummarizeHeuristicRunner(\n heuristicData,\n this.configuration,\n (reason) => this.trySummarize(reason),\n this.logger);\n }\n\n assert(\n this.configuration.state !== \"disabled\",\n 0x2eb /* \"Summary not supported with configuration disabled\" */,\n );\n\n // Cap the maximum amount of time client will wait for a summarize op ack to maxSummarizeAckWaitTime\n // configuration.maxAckWaitTime is composed from defaults, server values, and runtime overrides\n\n const maxAckWaitTime = Math.min(this.configuration.maxAckWaitTime, maxSummarizeAckWaitTime);\n\n this.pendingAckTimer = new PromiseTimer(\n maxAckWaitTime,\n () => {\n // pre-0.58 error message: summaryAckWaitTimeout\n this.raiseSummarizingError(\"Pending summary ack not received in time\");\n // Note: summarizeCount (from ChildLogger definition) may be 0,\n // since this code path is hit when RunningSummarizer first starts up,\n // before this instance has kicked off a new summarize run.\n this.logger.sendErrorEvent({\n eventName: \"SummaryAckWaitTimeout\",\n maxAckWaitTime,\n referenceSequenceNumber: this.heuristicData.lastAttempt.refSequenceNumber,\n summarySequenceNumber: this.heuristicData.lastAttempt.summarySequenceNumber,\n timePending: Date.now() - this.heuristicData.lastAttempt.summaryTime,\n });\n });\n // Set up pending ack timeout by op timestamp differences for previous summaries.\n summaryCollection.setPendingAckTimerTimeoutCallback(maxAckWaitTime, () => {\n if (this.pendingAckTimer.hasTimer) {\n this.logger.sendTelemetryEvent({\n eventName: \"MissingSummaryAckFoundByOps\",\n referenceSequenceNumber: this.heuristicData.lastAttempt.refSequenceNumber,\n summarySequenceNumber: this.heuristicData.lastAttempt.summarySequenceNumber,\n });\n this.pendingAckTimer.clear();\n }\n });\n\n this.generator = new SummaryGenerator(\n this.pendingAckTimer,\n this.heuristicData,\n this.submitSummaryCallback,\n this.raiseSummarizingError,\n () => { this.totalSuccessfulAttempts++; },\n this.summaryWatcher,\n this.logger,\n );\n\n // Listen for ops\n this.runtime.deltaManager.on(\"op\", (op) => { this.handleOp(op); });\n }\n\n public dispose(): void {\n this.runtime.deltaManager.off(\"op\", (op) => { this.handleOp(op); });\n this.summaryWatcher.dispose();\n this.heuristicRunner?.dispose();\n this.heuristicRunner = undefined;\n this.generator.dispose();\n this.pendingAckTimer.clear();\n this.disposeEnqueuedSummary();\n this._disposed = true;\n this.stopping = true;\n }\n\n /**\n * RunningSummarizer's logger includes the sequenced index of the current summary on each event.\n * If some other Summarizer code wants that event on their logs they can get it here,\n * but only if they're logging about that same summary.\n * @param summaryOpRefSeq - RefSeq number of the summary op, to ensure the log correlation will be correct\n */\n public tryGetCorrelatedLogger = (summaryOpRefSeq) =>\n this.heuristicData.lastAttempt.refSequenceNumber === summaryOpRefSeq\n ? this.logger\n : undefined;\n\n /** We only want a single heuristic runner micro-task (will provide better optimized grouping of ops) */\n private heuristicRunnerMicroTaskExists = false;\n\n public handleOp(op: ISequencedDocumentMessage) {\n this.heuristicData.lastOpSequenceNumber = op.sequenceNumber;\n\n if (isRuntimeMessage(op)) {\n this.heuristicData.numRuntimeOps++;\n } else {\n this.heuristicData.numNonRuntimeOps++;\n }\n\n this.heuristicData.totalOpsSize += opSize(op);\n\n // Check for enqueued on-demand summaries; Intentionally do nothing otherwise\n if (this.initialized\n && this.opCanTriggerSummary(op)\n && !this.tryRunEnqueuedSummary()\n && !this.heuristicRunnerMicroTaskExists) {\n this.heuristicRunnerMicroTaskExists = true;\n Promise.resolve().then(() => {\n this.heuristicRunner?.run();\n }).finally(() => {\n this.heuristicRunnerMicroTaskExists = false;\n });\n }\n }\n\n /**\n * Can the given op trigger a summary?\n * # Currently always prevents summaries for Summarize and SummaryAck/Nack ops\n * @param op - op to check\n * @returns true if this op can trigger a summary\n */\n private opCanTriggerSummary(op: ISequencedDocumentMessage): boolean {\n switch (op.type) {\n case MessageType.Summarize:\n case MessageType.SummaryAck:\n case MessageType.SummaryNack:\n return false;\n default:\n return isRuntimeMessage(op) || this.nonRuntimeOpCanTriggerSummary();\n }\n }\n\n private nonRuntimeOpCanTriggerSummary(): boolean {\n // eslint-disable-next-line max-len\n const opsSinceLastAck = this.heuristicData.lastOpSequenceNumber - this.heuristicData.lastSuccessfulSummary.refSequenceNumber;\n return this.configuration.state === \"enabled\"\n && (this.configuration.nonRuntimeHeuristicThreshold === undefined\n || this.configuration.nonRuntimeHeuristicThreshold <= opsSinceLastAck);\n }\n\n public async waitStop(allowLastSummary: boolean): Promise<void> {\n if (this.stopping) {\n return;\n }\n\n this.stopping = true;\n\n this.disposeEnqueuedSummary();\n\n // This will try to run lastSummary if needed.\n if (allowLastSummary && this.heuristicRunner?.shouldRunLastSummary()) {\n if (this.summarizingLock === undefined) {\n this.trySummarizeOnce(\n // summarizeProps\n { reason: \"lastSummary\" },\n // ISummarizeOptions, using defaults: { refreshLatestAck: false, fullTree: false }\n {});\n }\n }\n\n // Note that trySummarizeOnce() call above returns right away, without waiting.\n // So we need to wait for its completion, otherwise it would be destroyed right away.\n // That said, if summary lock was taken upfront, this wait might wait on multiple retries to\n // submit summary. We should reconsider this flow and make summarizer move to exit faster.\n // This resolves when the current pending summary gets an ack or fails.\n await this.summarizingLock;\n }\n\n private async waitStart() {\n // Wait no longer than ack timeout for all pending\n const waitStartResult = await raceTimer(\n this.summaryWatcher.waitFlushed(),\n this.pendingAckTimer.start(),\n );\n this.pendingAckTimer.clear();\n\n // Remove pending ack wait timeout by op timestamp comparison, because\n // it has race conditions with summaries submitted by this same client.\n this.summaryCollection.unsetPendingAckTimerTimeoutCallback();\n\n if (waitStartResult.result === \"done\" && waitStartResult.value !== undefined) {\n this.heuristicData.updateWithLastSummaryAckInfo({\n refSequenceNumber: waitStartResult.value.summaryOp.referenceSequenceNumber,\n // This will be the Summarizer starting point so only use timestamps from client's machine.\n summaryTime: Date.now(),\n summarySequenceNumber: waitStartResult.value.summaryOp.sequenceNumber,\n });\n }\n this.initialized = true;\n }\n\n /**\n * Blocks a new summarizer from running in case RefreshSummaryAck is being processed.\n * Assumes that caller checked upfront for lack of concurrent action (this.refreshSummaryAckLock)\n * before calling this API. I.e. caller is responsible for either erroring out or waiting on this promise.\n * Note: The refreshSummaryAckLock makes sure no summarizer gets enqueued or processed\n * until the refresh has completed. One can't rely uniquely on the summarizingLock as the\n * refreshLatestSummaryAck also happens during the time summarizingLock !== undefined.\n * Ex. Summarizer submits a summay + op and then waits for the Summary Ack to proceed\n * with the refreshLatestSummaryAck and complete the summary.\n * @param action - action to perform.\n * @returns - result of action.\n */\n public async lockedRefreshSummaryAckAction<T>(action: () => Promise<T>) {\n assert(this.refreshSummaryAckLock === undefined,\n 0x396 /* Refresh Summary Ack - Caller is responsible for checking lock */);\n\n const refreshSummaryAckLock = new Deferred<void>();\n this.refreshSummaryAckLock = refreshSummaryAckLock.promise;\n\n return action().finally(() => {\n refreshSummaryAckLock.resolve();\n this.refreshSummaryAckLock = undefined;\n });\n }\n\n /**\n * Runs single summary action that prevents any other concurrent actions.\n * Assumes that caller checked upfront for lack of concurrent action (this.summarizingLock)\n * before calling this API. I.e. caller is responsible for either erroring out or waiting on this promise.\n * @param action - action to perform.\n * @returns - result of action.\n */\n private async lockedSummaryAction<T>(action: () => Promise<T>) {\n assert(this.summarizingLock === undefined, 0x25b /* \"Caller is responsible for checking lock\" */);\n\n const summarizingLock = new Deferred<void>();\n this.summarizingLock = summarizingLock.promise;\n\n this.summarizeCount++;\n // Make sure the RefreshLatestSummaryAck is not being executed.\n await this.refreshSummaryAckLock;\n\n return action().finally(() => {\n summarizingLock.resolve();\n this.summarizingLock = undefined;\n\n const retry = this.tryWhileSummarizing;\n this.tryWhileSummarizing = false;\n\n // After summarizing, we should check to see if we need to summarize again.\n // Rerun the heuristics and check for enqueued summaries.\n if (!this.stopping && !this.tryRunEnqueuedSummary() && retry) {\n this.heuristicRunner?.run();\n }\n });\n }\n\n /**\n * Runs single summarize attempt\n * @param summarizeProps - props to log with each telemetry event associated with this attempt\n * @param options - summary options\n * @param cancellationToken - cancellation token to use to be able to cancel this summary, if needed\n * @param resultsBuilder - optional, result builder to use.\n * @returns ISummarizeResult - result of running a summary.\n */\n private trySummarizeOnce(\n summarizeProps: ISummarizeTelemetryProperties,\n options: ISummarizeOptions,\n cancellationToken = this.cancellationToken,\n resultsBuilder = new SummarizeResultBuilder()): ISummarizeResults {\n this.lockedSummaryAction(async () => {\n const summarizeResult = this.generator.summarize(\n summarizeProps,\n options,\n cancellationToken,\n resultsBuilder);\n // ensure we wait till the end of the process\n return summarizeResult.receivedSummaryAckOrNack;\n }).catch((error) => {\n // SummaryGenerator.summarize() does not throw exceptions - it converts them to failed result\n // on resultsBuilder\n // We do not care about exceptions on receivedSummaryAckOrNack - caller should check results\n // and take a appropriate action.\n });\n\n return resultsBuilder.build();\n }\n\n /** Heuristics summarize attempt. */\n private trySummarize(\n reason: SummarizeReason,\n cancellationToken = this.cancellationToken): void {\n if (this.summarizingLock !== undefined) {\n // lockedSummaryAction() will retry heuristic-based summary at the end of current attempt\n // if it's still needed\n this.tryWhileSummarizing = true;\n return;\n }\n\n this.lockedSummaryAction(async () => {\n const attempts: (ISummarizeOptions & { delaySeconds?: number; })[] = [\n { refreshLatestAck: false, fullTree: false },\n { refreshLatestAck: true, fullTree: false },\n { refreshLatestAck: true, fullTree: false, delaySeconds: 2 * 60 },\n { refreshLatestAck: true, fullTree: true, delaySeconds: 10 * 60 },\n ];\n let overrideDelaySeconds: number | undefined;\n let summaryAttempts = 0;\n let summaryAttemptsPerPhase = 0;\n\n let lastResult: { message: string; error: any; } | undefined;\n\n for (let summaryAttemptPhase = 0; summaryAttemptPhase < attempts.length;) {\n if (this.cancellationToken.cancelled) {\n return;\n }\n\n // We only want to attempt 1 summary when reason is \"lastSummary\"\n if (++summaryAttempts > 1 && reason === \"lastSummary\") {\n return;\n }\n\n summaryAttemptsPerPhase++;\n\n const { delaySeconds: regularDelaySeconds = 0, ...options } = attempts[summaryAttemptPhase];\n const delaySeconds = overrideDelaySeconds ?? regularDelaySeconds;\n\n const summarizeProps: ISummarizeTelemetryProperties = {\n reason,\n summaryAttempts,\n summaryAttemptsPerPhase,\n summaryAttemptPhase: summaryAttemptPhase + 1, // make everything 1-based\n ...options,\n };\n\n if (delaySeconds > 0) {\n this.logger.sendPerformanceEvent({\n eventName: \"SummarizeAttemptDelay\",\n duration: delaySeconds,\n summaryNackDelay: overrideDelaySeconds !== undefined,\n ...summarizeProps,\n });\n await delay(delaySeconds * 1000);\n }\n\n // Make sure the refresh Summary Ack is not being executed.\n await this.refreshSummaryAckLock;\n\n // Note: no need to account for cancellationToken.waitCancelled here, as\n // this is accounted SummaryGenerator.summarizeCore that controls receivedSummaryAckOrNack.\n const resultSummarize = this.generator.summarize(summarizeProps, options, cancellationToken);\n const result = await resultSummarize.receivedSummaryAckOrNack;\n\n if (result.success) {\n return;\n }\n // Check for retryDelay that can come from summaryNack or upload summary flow.\n // Retry the same step only once per retryAfter response.\n overrideDelaySeconds = result.retryAfterSeconds;\n if (overrideDelaySeconds === undefined || summaryAttemptsPerPhase > 1) {\n summaryAttemptPhase++;\n summaryAttemptsPerPhase = 0;\n }\n lastResult = result;\n }\n\n // If all attempts failed, log error (with last attempt info) and close the summarizer container\n this.logger.sendErrorEvent({\n eventName: \"FailToSummarize\",\n reason,\n message: lastResult?.message,\n }, lastResult?.error);\n\n this.stopSummarizerCallback(\"failToSummarize\");\n }).catch((error) => {\n this.logger.sendErrorEvent({ eventName: \"UnexpectedSummarizeError\" }, error);\n });\n }\n\n /** {@inheritdoc (ISummarizer:interface).summarizeOnDemand} */\n public summarizeOnDemand(\n resultsBuilder: SummarizeResultBuilder = new SummarizeResultBuilder(),\n {\n reason,\n ...options\n }: IOnDemandSummarizeOptions): ISummarizeResults {\n if (this.stopping) {\n resultsBuilder.fail(\"RunningSummarizer stopped or disposed\", undefined);\n return resultsBuilder.build();\n }\n // Check for concurrent summary attempts. If one is found,\n // return a promise that caller can await before trying again.\n if (this.summarizingLock !== undefined) {\n // The heuristics are blocking concurrent summarize attempts.\n throw new UsageError(\"Attempted to run an already-running summarizer on demand\");\n }\n\n const result = this.trySummarizeOnce(\n { reason: `onDemand/${reason}` },\n options,\n this.cancellationToken,\n resultsBuilder);\n return result;\n }\n\n /** {@inheritdoc (ISummarizer:interface).enqueueSummarize} */\n public enqueueSummarize({\n reason,\n afterSequenceNumber = 0,\n override = false,\n ...options\n }: IEnqueueSummarizeOptions): EnqueueSummarizeResult {\n const onDemandReason = `enqueue;${reason}` as const;\n let overridden = false;\n if (this.enqueuedSummary !== undefined) {\n if (!override) {\n return { alreadyEnqueued: true };\n }\n // Override existing enqueued summarize attempt.\n this.enqueuedSummary.resultsBuilder.fail(\n \"Aborted; overridden by another enqueue summarize attempt\",\n undefined,\n );\n this.enqueuedSummary = undefined;\n overridden = true;\n }\n this.enqueuedSummary = {\n reason: onDemandReason,\n afterSequenceNumber,\n options,\n resultsBuilder: new SummarizeResultBuilder(),\n };\n const results = this.enqueuedSummary.resultsBuilder.build();\n this.tryRunEnqueuedSummary();\n return overridden ? {\n ...results,\n alreadyEnqueued: true,\n overridden: true,\n } : results;\n }\n\n private tryRunEnqueuedSummary() {\n if (this.stopping) {\n this.disposeEnqueuedSummary();\n return false;\n }\n if (\n this.enqueuedSummary === undefined\n || this.heuristicData.lastOpSequenceNumber < this.enqueuedSummary.afterSequenceNumber\n || this.summarizingLock !== undefined\n ) {\n // If no enqueued summary is ready or a summary is already in progress, take no action.\n return false;\n }\n const { reason, resultsBuilder, options } = this.enqueuedSummary;\n // Set to undefined first, so that subsequent enqueue attempt while summarize will occur later.\n this.enqueuedSummary = undefined;\n this.trySummarizeOnce(\n { reason: `enqueuedSummary/${reason}` },\n options,\n this.cancellationToken,\n resultsBuilder);\n return true;\n }\n\n private disposeEnqueuedSummary() {\n if (this.enqueuedSummary !== undefined) {\n this.enqueuedSummary.resultsBuilder.fail(\"RunningSummarizer stopped or disposed\", undefined);\n this.enqueuedSummary = undefined;\n }\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/container-runtime",
|
|
3
|
-
"version": "2.0.0-internal.2.1.
|
|
3
|
+
"version": "2.0.0-internal.2.1.2",
|
|
4
4
|
"description": "Fluid container runtime",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -36,7 +36,8 @@
|
|
|
36
36
|
"test:mocha:verbose": "cross-env FLUID_TEST_VERBOSE=1 npm run test:mocha",
|
|
37
37
|
"tsc": "tsc",
|
|
38
38
|
"tsc:watch": "tsc --watch",
|
|
39
|
-
"typetests:gen": "
|
|
39
|
+
"typetests:gen": "flub generate typetests --generate --dir .",
|
|
40
|
+
"typetests:prepare": "flub generate typetests --prepare --dir . --pin"
|
|
40
41
|
},
|
|
41
42
|
"nyc": {
|
|
42
43
|
"all": true,
|
|
@@ -61,31 +62,31 @@
|
|
|
61
62
|
"dependencies": {
|
|
62
63
|
"@fluidframework/common-definitions": "^0.20.1",
|
|
63
64
|
"@fluidframework/common-utils": "^1.0.0",
|
|
64
|
-
"@fluidframework/container-definitions": ">=2.0.0-internal.2.1.
|
|
65
|
-
"@fluidframework/container-runtime-definitions": ">=2.0.0-internal.2.1.
|
|
66
|
-
"@fluidframework/container-utils": ">=2.0.0-internal.2.1.
|
|
67
|
-
"@fluidframework/core-interfaces": ">=2.0.0-internal.2.1.
|
|
68
|
-
"@fluidframework/datastore": ">=2.0.0-internal.2.1.
|
|
69
|
-
"@fluidframework/driver-definitions": ">=2.0.0-internal.2.1.
|
|
70
|
-
"@fluidframework/driver-utils": ">=2.0.0-internal.2.1.
|
|
71
|
-
"@fluidframework/garbage-collector": ">=2.0.0-internal.2.1.
|
|
65
|
+
"@fluidframework/container-definitions": ">=2.0.0-internal.2.1.2 <2.0.0-internal.3.0.0",
|
|
66
|
+
"@fluidframework/container-runtime-definitions": ">=2.0.0-internal.2.1.2 <2.0.0-internal.3.0.0",
|
|
67
|
+
"@fluidframework/container-utils": ">=2.0.0-internal.2.1.2 <2.0.0-internal.3.0.0",
|
|
68
|
+
"@fluidframework/core-interfaces": ">=2.0.0-internal.2.1.2 <2.0.0-internal.3.0.0",
|
|
69
|
+
"@fluidframework/datastore": ">=2.0.0-internal.2.1.2 <2.0.0-internal.3.0.0",
|
|
70
|
+
"@fluidframework/driver-definitions": ">=2.0.0-internal.2.1.2 <2.0.0-internal.3.0.0",
|
|
71
|
+
"@fluidframework/driver-utils": ">=2.0.0-internal.2.1.2 <2.0.0-internal.3.0.0",
|
|
72
|
+
"@fluidframework/garbage-collector": ">=2.0.0-internal.2.1.2 <2.0.0-internal.3.0.0",
|
|
72
73
|
"@fluidframework/protocol-base": "^0.1038.2000",
|
|
73
74
|
"@fluidframework/protocol-definitions": "^1.1.0",
|
|
74
|
-
"@fluidframework/runtime-definitions": ">=2.0.0-internal.2.1.
|
|
75
|
-
"@fluidframework/runtime-utils": ">=2.0.0-internal.2.1.
|
|
76
|
-
"@fluidframework/telemetry-utils": ">=2.0.0-internal.2.1.
|
|
75
|
+
"@fluidframework/runtime-definitions": ">=2.0.0-internal.2.1.2 <2.0.0-internal.3.0.0",
|
|
76
|
+
"@fluidframework/runtime-utils": ">=2.0.0-internal.2.1.2 <2.0.0-internal.3.0.0",
|
|
77
|
+
"@fluidframework/telemetry-utils": ">=2.0.0-internal.2.1.2 <2.0.0-internal.3.0.0",
|
|
77
78
|
"double-ended-queue": "^2.1.0-0",
|
|
78
79
|
"lz4js": "^0.2.0",
|
|
79
80
|
"uuid": "^8.3.1"
|
|
80
81
|
},
|
|
81
82
|
"devDependencies": {
|
|
82
|
-
"@fluid-tools/build-cli": "^0.
|
|
83
|
+
"@fluid-tools/build-cli": "^0.6.0",
|
|
83
84
|
"@fluidframework/build-common": "^1.1.0",
|
|
84
|
-
"@fluidframework/build-tools": "^0.
|
|
85
|
-
"@fluidframework/container-runtime-previous": "npm:@fluidframework/container-runtime@2.0.0-internal.2.
|
|
86
|
-
"@fluidframework/eslint-config-fluid": "^1.
|
|
87
|
-
"@fluidframework/mocha-test-setup": ">=2.0.0-internal.2.1.
|
|
88
|
-
"@fluidframework/test-runtime-utils": ">=2.0.0-internal.2.1.
|
|
85
|
+
"@fluidframework/build-tools": "^0.6.0",
|
|
86
|
+
"@fluidframework/container-runtime-previous": "npm:@fluidframework/container-runtime@2.0.0-internal.2.1.1",
|
|
87
|
+
"@fluidframework/eslint-config-fluid": "^1.2.0",
|
|
88
|
+
"@fluidframework/mocha-test-setup": ">=2.0.0-internal.2.1.2 <2.0.0-internal.3.0.0",
|
|
89
|
+
"@fluidframework/test-runtime-utils": ">=2.0.0-internal.2.1.2 <2.0.0-internal.3.0.0",
|
|
89
90
|
"@microsoft/api-extractor": "^7.22.2",
|
|
90
91
|
"@rushstack/eslint-config": "^2.5.1",
|
|
91
92
|
"@types/double-ended-queue": "^2.1.0",
|
|
@@ -104,12 +105,8 @@
|
|
|
104
105
|
"typescript": "~4.5.5"
|
|
105
106
|
},
|
|
106
107
|
"typeValidation": {
|
|
107
|
-
"version": "2.0.0-internal.2.1.
|
|
108
|
-
"
|
|
109
|
-
|
|
110
|
-
"forwardCompat": false,
|
|
111
|
-
"backCompat": false
|
|
112
|
-
}
|
|
113
|
-
}
|
|
108
|
+
"version": "2.0.0-internal.2.1.2",
|
|
109
|
+
"baselineRange": "2.0.0-internal.2.1.1",
|
|
110
|
+
"broken": {}
|
|
114
111
|
}
|
|
115
112
|
}
|
package/src/containerRuntime.ts
CHANGED
|
@@ -278,6 +278,17 @@ export interface ISummaryConfigurationHeuristics extends ISummaryBaseConfigurati
|
|
|
278
278
|
* For example: (multiplier) * (number of non-runtime ops) = weighted number of non-runtime ops
|
|
279
279
|
*/
|
|
280
280
|
nonRuntimeOpWeight: number;
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* Number of ops since last summary needed before a non-runtime op can trigger running summary heuristics.
|
|
284
|
+
*
|
|
285
|
+
* Note: Any runtime ops sent before the threshold is reached will trigger heuristics normally.
|
|
286
|
+
* This threshold ONLY applies to non-runtime ops triggering summaries.
|
|
287
|
+
*
|
|
288
|
+
* For example: Say the threshold is 20. Sending 19 non-runtime ops will not trigger any heuristic checks.
|
|
289
|
+
* Sending the 20th non-runtime op will trigger the heuristic checks for summarizing.
|
|
290
|
+
*/
|
|
291
|
+
nonRuntimeHeuristicThreshold?: number;
|
|
281
292
|
}
|
|
282
293
|
|
|
283
294
|
export interface ISummaryConfigurationDisableSummarizer {
|
|
@@ -317,6 +328,8 @@ export const DefaultSummaryConfiguration: ISummaryConfiguration = {
|
|
|
317
328
|
nonRuntimeOpWeight: 0.1,
|
|
318
329
|
|
|
319
330
|
runtimeOpWeight: 1.0,
|
|
331
|
+
|
|
332
|
+
nonRuntimeHeuristicThreshold: 20,
|
|
320
333
|
};
|
|
321
334
|
|
|
322
335
|
export interface IGCRuntimeOptions {
|
package/src/packageVersion.ts
CHANGED
package/src/runningSummarizer.ts
CHANGED
|
@@ -263,9 +263,9 @@ export class RunningSummarizer implements IDisposable {
|
|
|
263
263
|
|
|
264
264
|
/**
|
|
265
265
|
* Can the given op trigger a summary?
|
|
266
|
-
* # Currently
|
|
266
|
+
* # Currently always prevents summaries for Summarize and SummaryAck/Nack ops
|
|
267
267
|
* @param op - op to check
|
|
268
|
-
* @returns true if this
|
|
268
|
+
* @returns true if this op can trigger a summary
|
|
269
269
|
*/
|
|
270
270
|
private opCanTriggerSummary(op: ISequencedDocumentMessage): boolean {
|
|
271
271
|
switch (op.type) {
|
|
@@ -274,10 +274,18 @@ export class RunningSummarizer implements IDisposable {
|
|
|
274
274
|
case MessageType.SummaryNack:
|
|
275
275
|
return false;
|
|
276
276
|
default:
|
|
277
|
-
return
|
|
277
|
+
return isRuntimeMessage(op) || this.nonRuntimeOpCanTriggerSummary();
|
|
278
278
|
}
|
|
279
279
|
}
|
|
280
280
|
|
|
281
|
+
private nonRuntimeOpCanTriggerSummary(): boolean {
|
|
282
|
+
// eslint-disable-next-line max-len
|
|
283
|
+
const opsSinceLastAck = this.heuristicData.lastOpSequenceNumber - this.heuristicData.lastSuccessfulSummary.refSequenceNumber;
|
|
284
|
+
return this.configuration.state === "enabled"
|
|
285
|
+
&& (this.configuration.nonRuntimeHeuristicThreshold === undefined
|
|
286
|
+
|| this.configuration.nonRuntimeHeuristicThreshold <= opsSinceLastAck);
|
|
287
|
+
}
|
|
288
|
+
|
|
281
289
|
public async waitStop(allowLastSummary: boolean): Promise<void> {
|
|
282
290
|
if (this.stopping) {
|
|
283
291
|
return;
|