@fluidframework/container-runtime 2.0.0-internal.6.1.2 → 2.0.0-internal.6.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +35 -0
- package/README.md +4 -3
- package/dist/batchTracker.d.ts +1 -1
- package/dist/batchTracker.js +1 -1
- package/dist/batchTracker.js.map +1 -1
- package/dist/blobManager.d.ts +4 -20
- package/dist/blobManager.d.ts.map +1 -1
- package/dist/blobManager.js +47 -125
- package/dist/blobManager.js.map +1 -1
- package/dist/containerRuntime.d.ts +82 -14
- package/dist/containerRuntime.d.ts.map +1 -1
- package/dist/containerRuntime.js +236 -138
- package/dist/containerRuntime.js.map +1 -1
- package/dist/dataStore.d.ts.map +1 -1
- package/dist/dataStore.js +1 -2
- package/dist/dataStore.js.map +1 -1
- package/dist/dataStoreContext.d.ts.map +1 -1
- package/dist/dataStoreContext.js +4 -5
- package/dist/dataStoreContext.js.map +1 -1
- package/dist/dataStoreContexts.d.ts +1 -2
- package/dist/dataStoreContexts.d.ts.map +1 -1
- package/dist/dataStoreContexts.js.map +1 -1
- package/dist/dataStoreRegistry.js +2 -2
- package/dist/dataStoreRegistry.js.map +1 -1
- package/dist/dataStores.d.ts.map +1 -1
- package/dist/dataStores.js +4 -5
- package/dist/dataStores.js.map +1 -1
- package/dist/error.d.ts +14 -0
- package/dist/error.d.ts.map +1 -0
- package/dist/error.js +21 -0
- package/dist/error.js.map +1 -0
- package/dist/gc/garbageCollection.d.ts +1 -1
- package/dist/gc/garbageCollection.d.ts.map +1 -1
- package/dist/gc/garbageCollection.js +23 -5
- package/dist/gc/garbageCollection.js.map +1 -1
- package/dist/gc/gcConfigs.d.ts.map +1 -1
- package/dist/gc/gcConfigs.js +5 -3
- package/dist/gc/gcConfigs.js.map +1 -1
- package/dist/gc/gcDefinitions.d.ts +2 -0
- package/dist/gc/gcDefinitions.d.ts.map +1 -1
- package/dist/gc/gcDefinitions.js.map +1 -1
- package/dist/gc/gcTelemetry.d.ts.map +1 -1
- package/dist/gc/gcTelemetry.js +2 -0
- package/dist/gc/gcTelemetry.js.map +1 -1
- package/dist/id-compressor/appendOnlySortedMap.d.ts +8 -30
- package/dist/id-compressor/appendOnlySortedMap.d.ts.map +1 -1
- package/dist/id-compressor/appendOnlySortedMap.js +25 -67
- package/dist/id-compressor/appendOnlySortedMap.js.map +1 -1
- package/dist/id-compressor/finalSpace.d.ts +29 -0
- package/dist/id-compressor/finalSpace.d.ts.map +1 -0
- package/dist/id-compressor/finalSpace.js +62 -0
- package/dist/id-compressor/finalSpace.js.map +1 -0
- package/dist/id-compressor/idCompressor.d.ts +25 -250
- package/dist/id-compressor/idCompressor.d.ts.map +1 -1
- package/dist/id-compressor/idCompressor.js +385 -1149
- package/dist/id-compressor/idCompressor.js.map +1 -1
- package/dist/id-compressor/identifiers.d.ts +32 -0
- package/dist/id-compressor/identifiers.d.ts.map +1 -0
- package/dist/id-compressor/identifiers.js +15 -0
- package/dist/id-compressor/identifiers.js.map +1 -0
- package/dist/id-compressor/index.d.ts +5 -6
- package/dist/id-compressor/index.d.ts.map +1 -1
- package/dist/id-compressor/index.js +20 -26
- package/dist/id-compressor/index.js.map +1 -1
- package/dist/id-compressor/persistanceUtilities.d.ts +22 -0
- package/dist/id-compressor/persistanceUtilities.d.ts.map +1 -0
- package/dist/id-compressor/persistanceUtilities.js +43 -0
- package/dist/id-compressor/persistanceUtilities.js.map +1 -0
- package/dist/id-compressor/sessionSpaceNormalizer.d.ts +46 -0
- package/dist/id-compressor/sessionSpaceNormalizer.d.ts.map +1 -0
- package/dist/id-compressor/sessionSpaceNormalizer.js +80 -0
- package/dist/id-compressor/sessionSpaceNormalizer.js.map +1 -0
- package/dist/id-compressor/sessions.d.ts +115 -0
- package/dist/id-compressor/sessions.d.ts.map +1 -0
- package/dist/id-compressor/sessions.js +305 -0
- package/dist/id-compressor/sessions.js.map +1 -0
- package/dist/id-compressor/utilities.d.ts +49 -0
- package/dist/id-compressor/utilities.d.ts.map +1 -0
- package/dist/id-compressor/utilities.js +166 -0
- package/dist/id-compressor/utilities.js.map +1 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -4
- package/dist/index.js.map +1 -1
- package/dist/opLifecycle/opCompressor.d.ts.map +1 -1
- package/dist/opLifecycle/opCompressor.js +1 -2
- package/dist/opLifecycle/opCompressor.js.map +1 -1
- package/dist/opLifecycle/opSplitter.d.ts.map +1 -1
- package/dist/opLifecycle/opSplitter.js +2 -3
- package/dist/opLifecycle/opSplitter.js.map +1 -1
- package/dist/opLifecycle/outbox.d.ts +1 -0
- package/dist/opLifecycle/outbox.d.ts.map +1 -1
- package/dist/opLifecycle/outbox.js +10 -11
- package/dist/opLifecycle/outbox.js.map +1 -1
- package/dist/opLifecycle/remoteMessageProcessor.d.ts.map +1 -1
- package/dist/opLifecycle/remoteMessageProcessor.js +11 -5
- package/dist/opLifecycle/remoteMessageProcessor.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/pendingStateManager.d.ts +12 -5
- package/dist/pendingStateManager.d.ts.map +1 -1
- package/dist/pendingStateManager.js +24 -10
- package/dist/pendingStateManager.js.map +1 -1
- package/dist/scheduleManager.d.ts.map +1 -1
- package/dist/scheduleManager.js +4 -5
- package/dist/scheduleManager.js.map +1 -1
- package/dist/summary/index.d.ts +2 -2
- package/dist/summary/index.d.ts.map +1 -1
- package/dist/summary/index.js +2 -1
- package/dist/summary/index.js.map +1 -1
- package/dist/summary/orderedClientElection.d.ts +1 -2
- package/dist/summary/orderedClientElection.d.ts.map +1 -1
- package/dist/summary/orderedClientElection.js +2 -3
- package/dist/summary/orderedClientElection.js.map +1 -1
- package/dist/summary/runningSummarizer.d.ts +27 -4
- package/dist/summary/runningSummarizer.d.ts.map +1 -1
- package/dist/summary/runningSummarizer.js +237 -66
- package/dist/summary/runningSummarizer.js.map +1 -1
- package/dist/summary/summarizer.d.ts +6 -5
- package/dist/summary/summarizer.d.ts.map +1 -1
- package/dist/summary/summarizer.js +70 -67
- package/dist/summary/summarizer.js.map +1 -1
- package/dist/summary/summarizerClientElection.d.ts +1 -1
- package/dist/summary/summarizerClientElection.d.ts.map +1 -1
- package/dist/summary/summarizerClientElection.js.map +1 -1
- package/dist/summary/summarizerTypes.d.ts +38 -25
- package/dist/summary/summarizerTypes.d.ts.map +1 -1
- package/dist/summary/summarizerTypes.js.map +1 -1
- package/dist/summary/summaryCollection.d.ts +1 -2
- package/dist/summary/summaryCollection.d.ts.map +1 -1
- package/dist/summary/summaryCollection.js.map +1 -1
- package/dist/summary/summaryGenerator.d.ts +9 -3
- package/dist/summary/summaryGenerator.d.ts.map +1 -1
- package/dist/summary/summaryGenerator.js +42 -38
- package/dist/summary/summaryGenerator.js.map +1 -1
- package/dist/summary/summaryManager.d.ts +7 -6
- package/dist/summary/summaryManager.d.ts.map +1 -1
- package/dist/summary/summaryManager.js +22 -15
- package/dist/summary/summaryManager.js.map +1 -1
- package/lib/batchTracker.d.ts +1 -1
- package/lib/batchTracker.js +1 -1
- package/lib/batchTracker.js.map +1 -1
- package/lib/blobManager.d.ts +4 -20
- package/lib/blobManager.d.ts.map +1 -1
- package/lib/blobManager.js +46 -124
- package/lib/blobManager.js.map +1 -1
- package/lib/containerRuntime.d.ts +82 -14
- package/lib/containerRuntime.d.ts.map +1 -1
- package/lib/containerRuntime.js +223 -123
- package/lib/containerRuntime.js.map +1 -1
- package/lib/dataStore.d.ts.map +1 -1
- package/lib/dataStore.js +1 -2
- package/lib/dataStore.js.map +1 -1
- package/lib/dataStoreContext.d.ts.map +1 -1
- package/lib/dataStoreContext.js +1 -2
- package/lib/dataStoreContext.js.map +1 -1
- package/lib/dataStoreContexts.d.ts +1 -2
- package/lib/dataStoreContexts.d.ts.map +1 -1
- package/lib/dataStoreContexts.js.map +1 -1
- package/lib/dataStoreRegistry.js +1 -1
- package/lib/dataStoreRegistry.js.map +1 -1
- package/lib/dataStores.d.ts.map +1 -1
- package/lib/dataStores.js +1 -2
- package/lib/dataStores.js.map +1 -1
- package/lib/error.d.ts +14 -0
- package/lib/error.d.ts.map +1 -0
- package/lib/error.js +17 -0
- package/lib/error.js.map +1 -0
- package/lib/gc/garbageCollection.d.ts +1 -1
- package/lib/gc/garbageCollection.d.ts.map +1 -1
- package/lib/gc/garbageCollection.js +22 -4
- package/lib/gc/garbageCollection.js.map +1 -1
- package/lib/gc/gcConfigs.d.ts.map +1 -1
- package/lib/gc/gcConfigs.js +3 -1
- package/lib/gc/gcConfigs.js.map +1 -1
- package/lib/gc/gcDefinitions.d.ts +2 -0
- package/lib/gc/gcDefinitions.d.ts.map +1 -1
- package/lib/gc/gcDefinitions.js.map +1 -1
- package/lib/gc/gcTelemetry.d.ts.map +1 -1
- package/lib/gc/gcTelemetry.js +2 -0
- package/lib/gc/gcTelemetry.js.map +1 -1
- package/lib/id-compressor/appendOnlySortedMap.d.ts +8 -30
- package/lib/id-compressor/appendOnlySortedMap.d.ts.map +1 -1
- package/lib/id-compressor/appendOnlySortedMap.js +24 -65
- package/lib/id-compressor/appendOnlySortedMap.js.map +1 -1
- package/lib/id-compressor/finalSpace.d.ts +29 -0
- package/lib/id-compressor/finalSpace.d.ts.map +1 -0
- package/lib/id-compressor/finalSpace.js +58 -0
- package/lib/id-compressor/finalSpace.js.map +1 -0
- package/lib/id-compressor/idCompressor.d.ts +25 -250
- package/lib/id-compressor/idCompressor.d.ts.map +1 -1
- package/lib/id-compressor/idCompressor.js +381 -1139
- package/lib/id-compressor/idCompressor.js.map +1 -1
- package/lib/id-compressor/identifiers.d.ts +32 -0
- package/lib/id-compressor/identifiers.d.ts.map +1 -0
- package/lib/id-compressor/identifiers.js +11 -0
- package/lib/id-compressor/identifiers.js.map +1 -0
- package/lib/id-compressor/index.d.ts +5 -6
- package/lib/id-compressor/index.d.ts.map +1 -1
- package/lib/id-compressor/index.js +5 -6
- package/lib/id-compressor/index.js.map +1 -1
- package/lib/id-compressor/persistanceUtilities.d.ts +22 -0
- package/lib/id-compressor/persistanceUtilities.d.ts.map +1 -0
- package/lib/id-compressor/persistanceUtilities.js +34 -0
- package/lib/id-compressor/persistanceUtilities.js.map +1 -0
- package/lib/id-compressor/sessionSpaceNormalizer.d.ts +46 -0
- package/lib/id-compressor/sessionSpaceNormalizer.d.ts.map +1 -0
- package/lib/id-compressor/sessionSpaceNormalizer.js +76 -0
- package/lib/id-compressor/sessionSpaceNormalizer.js.map +1 -0
- package/lib/id-compressor/sessions.d.ts +115 -0
- package/lib/id-compressor/sessions.d.ts.map +1 -0
- package/lib/id-compressor/sessions.js +290 -0
- package/lib/id-compressor/sessions.js.map +1 -0
- package/lib/id-compressor/utilities.d.ts +49 -0
- package/lib/id-compressor/utilities.d.ts.map +1 -0
- package/lib/id-compressor/utilities.js +148 -0
- package/lib/id-compressor/utilities.js.map +1 -0
- package/lib/index.d.ts +3 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -2
- package/lib/index.js.map +1 -1
- package/lib/opLifecycle/opCompressor.d.ts.map +1 -1
- package/lib/opLifecycle/opCompressor.js +1 -2
- package/lib/opLifecycle/opCompressor.js.map +1 -1
- package/lib/opLifecycle/opSplitter.d.ts.map +1 -1
- package/lib/opLifecycle/opSplitter.js +1 -2
- package/lib/opLifecycle/opSplitter.js.map +1 -1
- package/lib/opLifecycle/outbox.d.ts +1 -0
- package/lib/opLifecycle/outbox.d.ts.map +1 -1
- package/lib/opLifecycle/outbox.js +6 -7
- package/lib/opLifecycle/outbox.js.map +1 -1
- package/lib/opLifecycle/remoteMessageProcessor.d.ts.map +1 -1
- package/lib/opLifecycle/remoteMessageProcessor.js +12 -6
- package/lib/opLifecycle/remoteMessageProcessor.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/pendingStateManager.d.ts +12 -5
- package/lib/pendingStateManager.d.ts.map +1 -1
- package/lib/pendingStateManager.js +21 -7
- package/lib/pendingStateManager.js.map +1 -1
- package/lib/scheduleManager.d.ts.map +1 -1
- package/lib/scheduleManager.js +1 -2
- package/lib/scheduleManager.js.map +1 -1
- package/lib/summary/index.d.ts +2 -2
- package/lib/summary/index.d.ts.map +1 -1
- package/lib/summary/index.js +1 -1
- package/lib/summary/index.js.map +1 -1
- package/lib/summary/orderedClientElection.d.ts +1 -2
- package/lib/summary/orderedClientElection.d.ts.map +1 -1
- package/lib/summary/orderedClientElection.js +1 -2
- package/lib/summary/orderedClientElection.js.map +1 -1
- package/lib/summary/runningSummarizer.d.ts +27 -4
- package/lib/summary/runningSummarizer.d.ts.map +1 -1
- package/lib/summary/runningSummarizer.js +237 -66
- package/lib/summary/runningSummarizer.js.map +1 -1
- package/lib/summary/summarizer.d.ts +6 -5
- package/lib/summary/summarizer.d.ts.map +1 -1
- package/lib/summary/summarizer.js +68 -65
- package/lib/summary/summarizer.js.map +1 -1
- package/lib/summary/summarizerClientElection.d.ts +1 -1
- package/lib/summary/summarizerClientElection.d.ts.map +1 -1
- package/lib/summary/summarizerClientElection.js.map +1 -1
- package/lib/summary/summarizerTypes.d.ts +38 -25
- package/lib/summary/summarizerTypes.d.ts.map +1 -1
- package/lib/summary/summarizerTypes.js.map +1 -1
- package/lib/summary/summaryCollection.d.ts +1 -2
- package/lib/summary/summaryCollection.d.ts.map +1 -1
- package/lib/summary/summaryCollection.js.map +1 -1
- package/lib/summary/summaryGenerator.d.ts +9 -3
- package/lib/summary/summaryGenerator.d.ts.map +1 -1
- package/lib/summary/summaryGenerator.js +43 -39
- package/lib/summary/summaryGenerator.js.map +1 -1
- package/lib/summary/summaryManager.d.ts +7 -6
- package/lib/summary/summaryManager.d.ts.map +1 -1
- package/lib/summary/summaryManager.js +23 -16
- package/lib/summary/summaryManager.js.map +1 -1
- package/package.json +26 -23
- package/src/batchTracker.ts +1 -1
- package/src/blobManager.ts +57 -146
- package/src/containerRuntime.ts +331 -158
- package/src/dataStore.ts +1 -2
- package/src/dataStoreContext.ts +3 -6
- package/src/dataStoreContexts.ts +1 -2
- package/src/dataStoreRegistry.ts +1 -1
- package/src/dataStores.ts +3 -5
- package/src/error.ts +18 -0
- package/src/gc/garbageCollection.ts +38 -5
- package/src/gc/gcConfigs.ts +4 -2
- package/src/gc/gcDefinitions.ts +2 -0
- package/src/gc/gcTelemetry.ts +2 -0
- package/src/id-compressor/appendOnlySortedMap.ts +25 -86
- package/src/id-compressor/finalSpace.ts +67 -0
- package/src/id-compressor/idCompressor.ts +455 -1681
- package/src/id-compressor/identifiers.ts +42 -0
- package/src/id-compressor/index.ts +11 -20
- package/src/id-compressor/persistanceUtilities.ts +58 -0
- package/src/id-compressor/sessionSpaceNormalizer.ts +83 -0
- package/src/id-compressor/sessions.ts +405 -0
- package/src/id-compressor/utilities.ts +187 -0
- package/src/index.ts +7 -1
- package/src/opLifecycle/opCompressor.ts +1 -2
- package/src/opLifecycle/opSplitter.ts +4 -4
- package/src/opLifecycle/outbox.ts +13 -10
- package/src/opLifecycle/remoteMessageProcessor.ts +19 -6
- package/src/packageVersion.ts +1 -1
- package/src/pendingStateManager.ts +49 -27
- package/src/scheduleManager.ts +5 -4
- package/src/summary/index.ts +3 -1
- package/src/summary/orderedClientElection.ts +6 -4
- package/src/summary/runningSummarizer.ts +276 -95
- package/src/summary/summarizer.ts +22 -12
- package/src/summary/summarizerClientElection.ts +1 -1
- package/src/summary/summarizerTypes.ts +40 -25
- package/src/summary/summaryCollection.ts +1 -2
- package/src/summary/summaryGenerator.ts +49 -52
- package/src/summary/summaryManager.ts +33 -11
- package/dist/id-compressor/idRange.d.ts +0 -11
- package/dist/id-compressor/idRange.d.ts.map +0 -1
- package/dist/id-compressor/idRange.js +0 -29
- package/dist/id-compressor/idRange.js.map +0 -1
- package/dist/id-compressor/numericUuid.d.ts +0 -59
- package/dist/id-compressor/numericUuid.d.ts.map +0 -1
- package/dist/id-compressor/numericUuid.js +0 -325
- package/dist/id-compressor/numericUuid.js.map +0 -1
- package/dist/id-compressor/sessionIdNormalizer.d.ts +0 -138
- package/dist/id-compressor/sessionIdNormalizer.d.ts.map +0 -1
- package/dist/id-compressor/sessionIdNormalizer.js +0 -483
- package/dist/id-compressor/sessionIdNormalizer.js.map +0 -1
- package/dist/id-compressor/utils.d.ts +0 -57
- package/dist/id-compressor/utils.d.ts.map +0 -1
- package/dist/id-compressor/utils.js +0 -90
- package/dist/id-compressor/utils.js.map +0 -1
- package/dist/id-compressor/uuidUtilities.d.ts +0 -28
- package/dist/id-compressor/uuidUtilities.d.ts.map +0 -1
- package/dist/id-compressor/uuidUtilities.js +0 -104
- package/dist/id-compressor/uuidUtilities.js.map +0 -1
- package/lib/id-compressor/idRange.d.ts +0 -11
- package/lib/id-compressor/idRange.d.ts.map +0 -1
- package/lib/id-compressor/idRange.js +0 -25
- package/lib/id-compressor/idRange.js.map +0 -1
- package/lib/id-compressor/numericUuid.d.ts +0 -59
- package/lib/id-compressor/numericUuid.d.ts.map +0 -1
- package/lib/id-compressor/numericUuid.js +0 -315
- package/lib/id-compressor/numericUuid.js.map +0 -1
- package/lib/id-compressor/sessionIdNormalizer.d.ts +0 -138
- package/lib/id-compressor/sessionIdNormalizer.d.ts.map +0 -1
- package/lib/id-compressor/sessionIdNormalizer.js +0 -479
- package/lib/id-compressor/sessionIdNormalizer.js.map +0 -1
- package/lib/id-compressor/utils.d.ts +0 -57
- package/lib/id-compressor/utils.d.ts.map +0 -1
- package/lib/id-compressor/utils.js +0 -79
- package/lib/id-compressor/utils.js.map +0 -1
- package/lib/id-compressor/uuidUtilities.d.ts +0 -28
- package/lib/id-compressor/uuidUtilities.d.ts.map +0 -1
- package/lib/id-compressor/uuidUtilities.js +0 -96
- package/lib/id-compressor/uuidUtilities.js.map +0 -1
- package/src/id-compressor/idRange.ts +0 -35
- package/src/id-compressor/numericUuid.ts +0 -383
- package/src/id-compressor/sessionIdNormalizer.ts +0 -609
- package/src/id-compressor/utils.ts +0 -114
- package/src/id-compressor/uuidUtilities.ts +0 -120
|
@@ -9,9 +9,15 @@ import {
|
|
|
9
9
|
MonitoringContext,
|
|
10
10
|
createChildMonitoringContext,
|
|
11
11
|
createChildLogger,
|
|
12
|
+
UsageError,
|
|
12
13
|
} from "@fluidframework/telemetry-utils";
|
|
13
|
-
import {
|
|
14
|
-
|
|
14
|
+
import {
|
|
15
|
+
assert,
|
|
16
|
+
delay,
|
|
17
|
+
Deferred,
|
|
18
|
+
PromiseTimer,
|
|
19
|
+
TypedEventEmitter,
|
|
20
|
+
} from "@fluidframework/common-utils";
|
|
15
21
|
import { DriverErrorType } from "@fluidframework/driver-definitions";
|
|
16
22
|
import { ISequencedDocumentMessage, MessageType } from "@fluidframework/protocol-definitions";
|
|
17
23
|
import { ISummaryConfiguration } from "../containerRuntime";
|
|
@@ -33,6 +39,8 @@ import {
|
|
|
33
39
|
ISummarizerRuntime,
|
|
34
40
|
ISummarizeRunnerTelemetry,
|
|
35
41
|
IRefreshSummaryAckOptions,
|
|
42
|
+
ISummarizerEvents,
|
|
43
|
+
ISummarizeEventProps,
|
|
36
44
|
} from "./summarizerTypes";
|
|
37
45
|
import { IAckedSummary, IClientSummaryWatcher, SummaryCollection } from "./summaryCollection";
|
|
38
46
|
import {
|
|
@@ -44,6 +52,17 @@ import {
|
|
|
44
52
|
|
|
45
53
|
const maxSummarizeAckWaitTime = 10 * 60 * 1000; // 10 minutes
|
|
46
54
|
|
|
55
|
+
/**
|
|
56
|
+
* The maximum number of summarization attempts that will be done by default in case of failures
|
|
57
|
+
* that can be retried.
|
|
58
|
+
*/
|
|
59
|
+
export const defaultMaxAttempts = 2;
|
|
60
|
+
/**
|
|
61
|
+
* The default value for maximum number of summarization attempts that will be done for summarization failures where
|
|
62
|
+
* submit fails and the failure can be retried.
|
|
63
|
+
*/
|
|
64
|
+
export const defaultMaxAttemptsForSubmitFailures = 5;
|
|
65
|
+
|
|
47
66
|
/**
|
|
48
67
|
* An instance of RunningSummarizer manages the heuristics for summarizing.
|
|
49
68
|
* Until disposed, the instance of RunningSummarizer can assume that it is
|
|
@@ -51,7 +70,7 @@ const maxSummarizeAckWaitTime = 10 * 60 * 1000; // 10 minutes
|
|
|
51
70
|
* track of summaries that it is generating as they are broadcast and acked/nacked.
|
|
52
71
|
* This object is created and controlled by Summarizer object.
|
|
53
72
|
*/
|
|
54
|
-
export class RunningSummarizer implements IDisposable {
|
|
73
|
+
export class RunningSummarizer extends TypedEventEmitter<ISummarizerEvents> implements IDisposable {
|
|
55
74
|
public static async start(
|
|
56
75
|
logger: ITelemetryBaseLogger,
|
|
57
76
|
summaryWatcher: IClientSummaryWatcher,
|
|
@@ -137,7 +156,7 @@ export class RunningSummarizer implements IDisposable {
|
|
|
137
156
|
| {
|
|
138
157
|
reason: SummarizeReason;
|
|
139
158
|
afterSequenceNumber: number;
|
|
140
|
-
|
|
159
|
+
summarizeOptions: ISummarizeOptions;
|
|
141
160
|
readonly resultsBuilder: SummarizeResultBuilder;
|
|
142
161
|
}
|
|
143
162
|
| undefined;
|
|
@@ -147,6 +166,9 @@ export class RunningSummarizer implements IDisposable {
|
|
|
147
166
|
|
|
148
167
|
private readonly runtimeListener;
|
|
149
168
|
|
|
169
|
+
/** The maximum number of summary attempts to do when submit summary fails. */
|
|
170
|
+
private readonly maxAttemptsForSubmitFailures: number;
|
|
171
|
+
|
|
150
172
|
private constructor(
|
|
151
173
|
baseLogger: ITelemetryBaseLogger,
|
|
152
174
|
private readonly summaryWatcher: IClientSummaryWatcher,
|
|
@@ -163,6 +185,8 @@ export class RunningSummarizer implements IDisposable {
|
|
|
163
185
|
private readonly stopSummarizerCallback: (reason: SummarizerStopReason) => void,
|
|
164
186
|
private readonly runtime: ISummarizerRuntime,
|
|
165
187
|
) {
|
|
188
|
+
super();
|
|
189
|
+
|
|
166
190
|
const telemetryProps: ISummarizeRunnerTelemetry = {
|
|
167
191
|
summarizeCount: () => this.summarizeCount,
|
|
168
192
|
summarizerSuccessfulAttempts: () => this.totalSuccessfulAttempts,
|
|
@@ -240,6 +264,17 @@ export class RunningSummarizer implements IDisposable {
|
|
|
240
264
|
this.handleOp(op, runtimeMessage === true);
|
|
241
265
|
};
|
|
242
266
|
this.runtime.on("op", this.runtimeListener);
|
|
267
|
+
|
|
268
|
+
// The max attempts for submit failures can be overridden via a feature flag. This allows us to
|
|
269
|
+
// tweak this as per telemetry data until we arrive at a stable number.
|
|
270
|
+
// If its set to a number higher than `defaultMaxAttemptsForSubmitFailures`, it will be ignored.
|
|
271
|
+
const overrideMaxAttempts = this.mc.config.getNumber(
|
|
272
|
+
"Fluid.Summarizer.AttemptsForSubmitFailures",
|
|
273
|
+
);
|
|
274
|
+
this.maxAttemptsForSubmitFailures =
|
|
275
|
+
overrideMaxAttempts && overrideMaxAttempts < defaultMaxAttemptsForSubmitFailures
|
|
276
|
+
? overrideMaxAttempts
|
|
277
|
+
: defaultMaxAttemptsForSubmitFailures;
|
|
243
278
|
}
|
|
244
279
|
|
|
245
280
|
private async handleSummaryAck(): Promise<number> {
|
|
@@ -429,7 +464,7 @@ export class RunningSummarizer implements IDisposable {
|
|
|
429
464
|
if (this.summarizingLock === undefined) {
|
|
430
465
|
this.trySummarizeOnce(
|
|
431
466
|
// summarizeProps
|
|
432
|
-
{
|
|
467
|
+
{ summarizeReason: "lastSummary" },
|
|
433
468
|
// ISummarizeOptions, using defaults: { refreshLatestAck: false, fullTree: false }
|
|
434
469
|
{},
|
|
435
470
|
);
|
|
@@ -524,7 +559,6 @@ export class RunningSummarizer implements IDisposable {
|
|
|
524
559
|
private trySummarizeOnce(
|
|
525
560
|
summarizeProps: ISummarizeTelemetryProperties,
|
|
526
561
|
options: ISummarizeOptions,
|
|
527
|
-
cancellationToken = this.cancellationToken,
|
|
528
562
|
resultsBuilder = new SummarizeResultBuilder(),
|
|
529
563
|
): ISummarizeResults {
|
|
530
564
|
this.lockedSummaryAction(
|
|
@@ -532,12 +566,16 @@ export class RunningSummarizer implements IDisposable {
|
|
|
532
566
|
this.beforeSummaryAction();
|
|
533
567
|
},
|
|
534
568
|
async () => {
|
|
535
|
-
const
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
569
|
+
const summaryLogger = createChildLogger({
|
|
570
|
+
logger: this.mc.logger,
|
|
571
|
+
properties: { all: summarizeProps },
|
|
572
|
+
});
|
|
573
|
+
const summaryOptions: ISubmitSummaryOptions = {
|
|
574
|
+
...options,
|
|
575
|
+
summaryLogger,
|
|
576
|
+
cancellationToken: this.cancellationToken,
|
|
577
|
+
};
|
|
578
|
+
const summarizeResult = this.generator.summarize(summaryOptions, resultsBuilder);
|
|
541
579
|
// ensure we wait till the end of the process
|
|
542
580
|
return summarizeResult.receivedSummaryAckOrNack;
|
|
543
581
|
},
|
|
@@ -555,10 +593,7 @@ export class RunningSummarizer implements IDisposable {
|
|
|
555
593
|
}
|
|
556
594
|
|
|
557
595
|
/** Heuristics summarize attempt. */
|
|
558
|
-
private trySummarize(
|
|
559
|
-
reason: SummarizeReason,
|
|
560
|
-
cancellationToken = this.cancellationToken,
|
|
561
|
-
): void {
|
|
596
|
+
private trySummarize(reason: SummarizeReason): void {
|
|
562
597
|
if (this.summarizingLock !== undefined) {
|
|
563
598
|
// lockedSummaryAction() will retry heuristic-based summary at the end of current attempt
|
|
564
599
|
// if it's still needed
|
|
@@ -571,68 +606,9 @@ export class RunningSummarizer implements IDisposable {
|
|
|
571
606
|
this.beforeSummaryAction();
|
|
572
607
|
},
|
|
573
608
|
async () => {
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
];
|
|
578
|
-
let overrideDelaySeconds: number | undefined;
|
|
579
|
-
let summaryAttempts = 0;
|
|
580
|
-
let summaryAttemptsPerPhase = 0;
|
|
581
|
-
let summaryAttemptPhase = 0;
|
|
582
|
-
while (summaryAttemptPhase < attempts.length) {
|
|
583
|
-
if (this.cancellationToken.cancelled) {
|
|
584
|
-
return;
|
|
585
|
-
}
|
|
586
|
-
|
|
587
|
-
// We only want to attempt 1 summary when reason is "lastSummary"
|
|
588
|
-
if (++summaryAttempts > 1 && reason === "lastSummary") {
|
|
589
|
-
return;
|
|
590
|
-
}
|
|
591
|
-
|
|
592
|
-
summaryAttemptsPerPhase++;
|
|
593
|
-
|
|
594
|
-
const summarizeOptions = attempts[summaryAttemptPhase];
|
|
595
|
-
const summarizeProps: ISummarizeTelemetryProperties = {
|
|
596
|
-
reason,
|
|
597
|
-
summaryAttempts,
|
|
598
|
-
summaryAttemptsPerPhase,
|
|
599
|
-
summaryAttemptPhase: summaryAttemptPhase + 1, // make everything 1-based
|
|
600
|
-
...summarizeOptions,
|
|
601
|
-
};
|
|
602
|
-
|
|
603
|
-
// Note: no need to account for cancellationToken.waitCancelled here, as
|
|
604
|
-
// this is accounted SummaryGenerator.summarizeCore that controls receivedSummaryAckOrNack.
|
|
605
|
-
const resultSummarize = this.generator.summarize(
|
|
606
|
-
summarizeProps,
|
|
607
|
-
summarizeOptions,
|
|
608
|
-
cancellationToken,
|
|
609
|
-
);
|
|
610
|
-
const result = await resultSummarize.receivedSummaryAckOrNack;
|
|
611
|
-
|
|
612
|
-
if (result.success) {
|
|
613
|
-
return;
|
|
614
|
-
}
|
|
615
|
-
|
|
616
|
-
// Check for retryDelay that can come from summaryNack or upload summary flow.
|
|
617
|
-
// Retry the same step only once per retryAfter response.
|
|
618
|
-
const delaySeconds = result.retryAfterSeconds;
|
|
619
|
-
if (delaySeconds === undefined || summaryAttemptsPerPhase > 1) {
|
|
620
|
-
summaryAttemptPhase++;
|
|
621
|
-
summaryAttemptsPerPhase = 0;
|
|
622
|
-
}
|
|
623
|
-
|
|
624
|
-
if (delaySeconds !== undefined) {
|
|
625
|
-
this.mc.logger.sendPerformanceEvent({
|
|
626
|
-
eventName: "SummarizeAttemptDelay",
|
|
627
|
-
duration: delaySeconds,
|
|
628
|
-
summaryNackDelay: overrideDelaySeconds !== undefined,
|
|
629
|
-
...summarizeProps,
|
|
630
|
-
});
|
|
631
|
-
await delay(delaySeconds * 1000);
|
|
632
|
-
}
|
|
633
|
-
}
|
|
634
|
-
|
|
635
|
-
this.stopSummarizerCallback("failToSummarize");
|
|
609
|
+
return this.mc.config.getBoolean("Fluid.Summarizer.TryDynamicRetries")
|
|
610
|
+
? this.trySummarizeWithRetries(reason)
|
|
611
|
+
: this.trySummarizeWithStaticAttempts(reason);
|
|
636
612
|
},
|
|
637
613
|
() => {
|
|
638
614
|
this.afterSummaryAction();
|
|
@@ -642,10 +618,220 @@ export class RunningSummarizer implements IDisposable {
|
|
|
642
618
|
});
|
|
643
619
|
}
|
|
644
620
|
|
|
621
|
+
/**
|
|
622
|
+
* Tries to summarize 2 times with pre-defined summary options. If an attempt fails with "retryAfterSeconds"
|
|
623
|
+
* param, that attempt is tried once more.
|
|
624
|
+
*/
|
|
625
|
+
private async trySummarizeWithStaticAttempts(reason: SummarizeReason) {
|
|
626
|
+
const attemptOptions: ISummarizeOptions[] = [
|
|
627
|
+
{ refreshLatestAck: false, fullTree: false },
|
|
628
|
+
{ refreshLatestAck: true, fullTree: false },
|
|
629
|
+
];
|
|
630
|
+
let summaryAttempts = 0;
|
|
631
|
+
let summaryAttemptsPerPhase = 0;
|
|
632
|
+
let summaryAttemptPhase = 0;
|
|
633
|
+
while (summaryAttemptPhase < attemptOptions.length) {
|
|
634
|
+
if (this.cancellationToken.cancelled) {
|
|
635
|
+
return;
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
// We only want to attempt 1 summary when reason is "lastSummary"
|
|
639
|
+
if (++summaryAttempts > 1 && reason === "lastSummary") {
|
|
640
|
+
return;
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
summaryAttemptsPerPhase++;
|
|
644
|
+
|
|
645
|
+
const summarizeOptions = attemptOptions[summaryAttemptPhase];
|
|
646
|
+
const summarizeProps: ISummarizeTelemetryProperties = {
|
|
647
|
+
summarizeReason: reason,
|
|
648
|
+
summaryAttempts,
|
|
649
|
+
summaryAttemptsPerPhase,
|
|
650
|
+
summaryAttemptPhase: summaryAttemptPhase + 1, // make everything 1-based
|
|
651
|
+
...summarizeOptions,
|
|
652
|
+
};
|
|
653
|
+
const summaryLogger = createChildLogger({
|
|
654
|
+
logger: this.mc.logger,
|
|
655
|
+
properties: { all: summarizeProps },
|
|
656
|
+
});
|
|
657
|
+
const summaryOptions: ISubmitSummaryOptions = {
|
|
658
|
+
...summarizeOptions,
|
|
659
|
+
summaryLogger,
|
|
660
|
+
cancellationToken: this.cancellationToken,
|
|
661
|
+
};
|
|
662
|
+
|
|
663
|
+
// Note: no need to account for cancellationToken.waitCancelled here, as
|
|
664
|
+
// this is accounted SummaryGenerator.summarizeCore that controls receivedSummaryAckOrNack.
|
|
665
|
+
const resultSummarize = this.generator.summarize(summaryOptions);
|
|
666
|
+
const ackNackResult = await resultSummarize.receivedSummaryAckOrNack;
|
|
667
|
+
if (ackNackResult.success) {
|
|
668
|
+
return;
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
// Check for retryDelay that can come from summaryNack, upload summary or submit summary flows.
|
|
672
|
+
// Retry the same step only once per retryAfter response.
|
|
673
|
+
const submitResult = await resultSummarize.summarySubmitted;
|
|
674
|
+
const delaySeconds = !submitResult.success
|
|
675
|
+
? submitResult.data?.retryAfterSeconds
|
|
676
|
+
: ackNackResult.data?.retryAfterSeconds;
|
|
677
|
+
if (delaySeconds === undefined || summaryAttemptsPerPhase > 1) {
|
|
678
|
+
summaryAttemptPhase++;
|
|
679
|
+
summaryAttemptsPerPhase = 0;
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
if (delaySeconds !== undefined) {
|
|
683
|
+
this.mc.logger.sendPerformanceEvent({
|
|
684
|
+
eventName: "SummarizeAttemptDelay",
|
|
685
|
+
duration: delaySeconds,
|
|
686
|
+
summaryNackDelay: ackNackResult.data?.retryAfterSeconds !== undefined,
|
|
687
|
+
...summarizeProps,
|
|
688
|
+
});
|
|
689
|
+
await delay(delaySeconds * 1000);
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
this.stopSummarizerCallback("failToSummarize");
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
/**
|
|
696
|
+
* Tries to summarize with retries where retry is based on the failure params.
|
|
697
|
+
* For example, summarization may be retried for failures with "retryAfterSeconds" param.
|
|
698
|
+
*/
|
|
699
|
+
private async trySummarizeWithRetries(reason: SummarizeReason) {
|
|
700
|
+
// Helper to set summarize options, telemetry properties and call summarize.
|
|
701
|
+
const attemptSummarize = (attemptNumber: number, finalAttempt: boolean) => {
|
|
702
|
+
const summarizeOptions: ISummarizeOptions = {
|
|
703
|
+
fullTree: false,
|
|
704
|
+
};
|
|
705
|
+
const summarizeProps: ISummarizeTelemetryProperties = {
|
|
706
|
+
summarizeReason: reason,
|
|
707
|
+
summaryAttempts: attemptNumber,
|
|
708
|
+
...summarizeOptions,
|
|
709
|
+
finalAttempt,
|
|
710
|
+
};
|
|
711
|
+
const summaryLogger = createChildLogger({
|
|
712
|
+
logger: this.mc.logger,
|
|
713
|
+
properties: { all: summarizeProps },
|
|
714
|
+
});
|
|
715
|
+
const summaryOptions: ISubmitSummaryOptions = {
|
|
716
|
+
...summarizeOptions,
|
|
717
|
+
summaryLogger,
|
|
718
|
+
cancellationToken: this.cancellationToken,
|
|
719
|
+
finalAttempt,
|
|
720
|
+
};
|
|
721
|
+
const summarizeResult = this.generator.summarize(summaryOptions);
|
|
722
|
+
return { summarizeProps, summarizeResult };
|
|
723
|
+
};
|
|
724
|
+
|
|
725
|
+
// The max number of attempts are based on the stage at which summarization failed. If it fails before it is
|
|
726
|
+
// submitted, a different value is used compared to if it fails after submission. Usually, in the former case,
|
|
727
|
+
// we would retry more often as its cheaper and retries are likely to succeed.
|
|
728
|
+
// This makes it harder to predict how many attempts would actually happen as that depends on how far an attempt
|
|
729
|
+
// made. To keep things simple, the max attempts is reset after every attempt based on where it failed. This may
|
|
730
|
+
// result in some failures not being retried depending on what happened before this attempt. That's fine because
|
|
731
|
+
// such scenarios are very unlikely and even if it happens, it would resolve when a new summarizer starts over.
|
|
732
|
+
// For example - When failure switches from one the submit failures to nack failure, only one more retry will
|
|
733
|
+
// happen irrespective of the value of `defaultMaxAttempts`.
|
|
734
|
+
let maxAttempts = defaultMaxAttempts;
|
|
735
|
+
let currentAttempt = 0;
|
|
736
|
+
let retryAfterSeconds: number | undefined;
|
|
737
|
+
let done = false;
|
|
738
|
+
let result: "success" | "failure" | "canceled" = "success";
|
|
739
|
+
do {
|
|
740
|
+
currentAttempt++;
|
|
741
|
+
if (this.cancellationToken.cancelled) {
|
|
742
|
+
result = "canceled";
|
|
743
|
+
done = true;
|
|
744
|
+
break;
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
const { summarizeProps, summarizeResult } = attemptSummarize(
|
|
748
|
+
currentAttempt,
|
|
749
|
+
false /* finalAttempt */,
|
|
750
|
+
);
|
|
751
|
+
|
|
752
|
+
// Ack / nack is the final step, so if it succeeds we're done.
|
|
753
|
+
const ackNackResult = await summarizeResult.receivedSummaryAckOrNack;
|
|
754
|
+
if (ackNackResult.success) {
|
|
755
|
+
result = "success";
|
|
756
|
+
done = true;
|
|
757
|
+
break;
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
// Update max attempts and retry params from the failure result.
|
|
761
|
+
// If submit summary failed, use the params from "summarySubmitted" result. Else, use the params
|
|
762
|
+
// from "receivedSummaryAckOrNack" result.
|
|
763
|
+
// Note: Check "summarySubmitted" result first because if it fails, ack nack would fail as well.
|
|
764
|
+
const submitSummaryResult = await summarizeResult.summarySubmitted;
|
|
765
|
+
if (!submitSummaryResult.success) {
|
|
766
|
+
maxAttempts = this.maxAttemptsForSubmitFailures;
|
|
767
|
+
retryAfterSeconds = submitSummaryResult.data?.retryAfterSeconds;
|
|
768
|
+
} else {
|
|
769
|
+
maxAttempts = defaultMaxAttempts;
|
|
770
|
+
retryAfterSeconds = ackNackResult.data?.retryAfterSeconds;
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
// Emit "summarize" event for this failed attempt.
|
|
774
|
+
result = "failure";
|
|
775
|
+
const eventProps: ISummarizeEventProps = {
|
|
776
|
+
result,
|
|
777
|
+
currentAttempt,
|
|
778
|
+
maxAttempts,
|
|
779
|
+
error: ackNackResult.error,
|
|
780
|
+
};
|
|
781
|
+
this.emit("summarize", eventProps);
|
|
782
|
+
|
|
783
|
+
// If the failure doesn't have "retryAfterSeconds" or the max number of attempts have been done, we're done.
|
|
784
|
+
if (retryAfterSeconds === undefined || currentAttempt >= maxAttempts - 1) {
|
|
785
|
+
done = true;
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
// If the failure has "retryAfterSeconds", add a delay of that time. In this case, a final attempt will
|
|
789
|
+
// take place and we need to wait for "retryAfterSeconds" before that.
|
|
790
|
+
if (retryAfterSeconds !== undefined) {
|
|
791
|
+
this.mc.logger.sendPerformanceEvent({
|
|
792
|
+
eventName: "SummarizeAttemptDelay",
|
|
793
|
+
duration: retryAfterSeconds,
|
|
794
|
+
summaryNackDelay: ackNackResult.data?.retryAfterSeconds !== undefined,
|
|
795
|
+
stage: submitSummaryResult.data?.stage,
|
|
796
|
+
dynamicRetries: true, // To differentiate this telemetry from regular retry logic
|
|
797
|
+
...summarizeProps,
|
|
798
|
+
});
|
|
799
|
+
await delay(retryAfterSeconds * 1000);
|
|
800
|
+
}
|
|
801
|
+
} while (!done);
|
|
802
|
+
|
|
803
|
+
// If summarize attempt did not fail, emit "summarize" event and return. A failed attempt may be retried below.
|
|
804
|
+
if (result !== "failure") {
|
|
805
|
+
this.emit("summarize", { result, currentAttempt, maxAttempts });
|
|
806
|
+
return;
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
// If summarization wasn't successful above and the failure contains "retryAfterSeconds", perform one last
|
|
810
|
+
// attempt. This gives a chance to the runtime to perform additional steps in the last attempt.
|
|
811
|
+
if (retryAfterSeconds !== undefined) {
|
|
812
|
+
const { summarizeResult } = attemptSummarize(++currentAttempt, true /* finalAttempt */);
|
|
813
|
+
// Ack / nack is the final step, so if it succeeds we're done.
|
|
814
|
+
const ackNackResult = await summarizeResult.receivedSummaryAckOrNack;
|
|
815
|
+
result = ackNackResult.success ? "success" : "failure";
|
|
816
|
+
const eventProps: ISummarizeEventProps = {
|
|
817
|
+
result,
|
|
818
|
+
currentAttempt,
|
|
819
|
+
maxAttempts,
|
|
820
|
+
error: ackNackResult.success ? undefined : ackNackResult.error,
|
|
821
|
+
};
|
|
822
|
+
this.emit("summarize", eventProps);
|
|
823
|
+
}
|
|
824
|
+
|
|
825
|
+
// If summarization is still unsuccessful, stop the summarizer.
|
|
826
|
+
if (result === "failure") {
|
|
827
|
+
this.stopSummarizerCallback("failToSummarize");
|
|
828
|
+
}
|
|
829
|
+
}
|
|
830
|
+
|
|
645
831
|
/** {@inheritdoc (ISummarizer:interface).summarizeOnDemand} */
|
|
646
832
|
public summarizeOnDemand(
|
|
833
|
+
options: IOnDemandSummarizeOptions,
|
|
647
834
|
resultsBuilder: SummarizeResultBuilder = new SummarizeResultBuilder(),
|
|
648
|
-
{ reason, ...options }: IOnDemandSummarizeOptions,
|
|
649
835
|
): ISummarizeResults {
|
|
650
836
|
if (this.stopping) {
|
|
651
837
|
resultsBuilder.fail("RunningSummarizer stopped or disposed", undefined);
|
|
@@ -658,23 +844,18 @@ export class RunningSummarizer implements IDisposable {
|
|
|
658
844
|
throw new UsageError("Attempted to run an already-running summarizer on demand");
|
|
659
845
|
}
|
|
660
846
|
|
|
847
|
+
const { reason, ...summarizeOptions } = options;
|
|
661
848
|
const result = this.trySummarizeOnce(
|
|
662
|
-
{
|
|
663
|
-
|
|
664
|
-
this.cancellationToken,
|
|
849
|
+
{ summarizeReason: `onDemand/${reason}` },
|
|
850
|
+
summarizeOptions,
|
|
665
851
|
resultsBuilder,
|
|
666
852
|
);
|
|
667
853
|
return result;
|
|
668
854
|
}
|
|
669
855
|
|
|
670
856
|
/** {@inheritdoc (ISummarizer:interface).enqueueSummarize} */
|
|
671
|
-
public enqueueSummarize({
|
|
672
|
-
reason,
|
|
673
|
-
afterSequenceNumber = 0,
|
|
674
|
-
override = false,
|
|
675
|
-
...options
|
|
676
|
-
}: IEnqueueSummarizeOptions): EnqueueSummarizeResult {
|
|
677
|
-
const onDemandReason = `enqueue;${reason}` as const;
|
|
857
|
+
public enqueueSummarize(options: IEnqueueSummarizeOptions): EnqueueSummarizeResult {
|
|
858
|
+
const { reason, afterSequenceNumber = 0, override = false, ...summarizeOptions } = options;
|
|
678
859
|
let overridden = false;
|
|
679
860
|
if (this.enqueuedSummary !== undefined) {
|
|
680
861
|
if (!override) {
|
|
@@ -688,10 +869,11 @@ export class RunningSummarizer implements IDisposable {
|
|
|
688
869
|
this.enqueuedSummary = undefined;
|
|
689
870
|
overridden = true;
|
|
690
871
|
}
|
|
872
|
+
|
|
691
873
|
this.enqueuedSummary = {
|
|
692
|
-
reason:
|
|
874
|
+
reason: `enqueue;${reason}`,
|
|
693
875
|
afterSequenceNumber,
|
|
694
|
-
|
|
876
|
+
summarizeOptions,
|
|
695
877
|
resultsBuilder: new SummarizeResultBuilder(),
|
|
696
878
|
};
|
|
697
879
|
const results = this.enqueuedSummary.resultsBuilder.build();
|
|
@@ -718,13 +900,12 @@ export class RunningSummarizer implements IDisposable {
|
|
|
718
900
|
// If no enqueued summary is ready or a summary is already in progress, take no action.
|
|
719
901
|
return false;
|
|
720
902
|
}
|
|
721
|
-
const { reason, resultsBuilder,
|
|
903
|
+
const { reason, resultsBuilder, summarizeOptions } = this.enqueuedSummary;
|
|
722
904
|
// Set to undefined first, so that subsequent enqueue attempt while summarize will occur later.
|
|
723
905
|
this.enqueuedSummary = undefined;
|
|
724
906
|
this.trySummarizeOnce(
|
|
725
|
-
{
|
|
726
|
-
|
|
727
|
-
this.cancellationToken,
|
|
907
|
+
{ summarizeReason: `enqueuedSummary/${reason}` },
|
|
908
|
+
summarizeOptions,
|
|
728
909
|
resultsBuilder,
|
|
729
910
|
);
|
|
730
911
|
return true;
|
|
@@ -3,17 +3,16 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
import { Deferred } from "@fluidframework/common-utils";
|
|
6
|
+
import { Deferred, TypedEventEmitter } from "@fluidframework/common-utils";
|
|
8
7
|
import {
|
|
9
8
|
ITelemetryLoggerExt,
|
|
10
9
|
createChildLogger,
|
|
11
10
|
IFluidErrorBase,
|
|
12
11
|
LoggingError,
|
|
12
|
+
UsageError,
|
|
13
13
|
wrapErrorAndLog,
|
|
14
14
|
} from "@fluidframework/telemetry-utils";
|
|
15
15
|
import { ILoader, LoaderHeader } from "@fluidframework/container-definitions";
|
|
16
|
-
import { UsageError } from "@fluidframework/container-utils";
|
|
17
16
|
import { DriverHeader } from "@fluidframework/driver-definitions";
|
|
18
17
|
import { requestFluidObject } from "@fluidframework/runtime-utils";
|
|
19
18
|
import { FluidObject, IFluidHandleContext, IRequest } from "@fluidframework/core-interfaces";
|
|
@@ -30,6 +29,12 @@ import {
|
|
|
30
29
|
ISummarizerRuntime,
|
|
31
30
|
ISummarizingWarning,
|
|
32
31
|
SummarizerStopReason,
|
|
32
|
+
IOnDemandSummarizeOptions,
|
|
33
|
+
ISummarizeResults,
|
|
34
|
+
IEnqueueSummarizeOptions,
|
|
35
|
+
EnqueueSummarizeResult,
|
|
36
|
+
ISummarizerEvents,
|
|
37
|
+
ISummarizeEventProps,
|
|
33
38
|
} from "./summarizerTypes";
|
|
34
39
|
import { SummarizeHeuristicData } from "./summarizerHeuristics";
|
|
35
40
|
import { SummarizeResultBuilder } from "./summaryGenerator";
|
|
@@ -61,7 +66,7 @@ export const createSummarizingWarning = (errorMessage: string, logged: boolean)
|
|
|
61
66
|
* It is the main entry point for summary work.
|
|
62
67
|
* It is created only by summarizing container (i.e. one with clientType === "summarizer")
|
|
63
68
|
*/
|
|
64
|
-
export class Summarizer extends
|
|
69
|
+
export class Summarizer extends TypedEventEmitter<ISummarizerEvents> implements ISummarizer {
|
|
65
70
|
public get ISummarizer() {
|
|
66
71
|
return this;
|
|
67
72
|
}
|
|
@@ -277,11 +282,15 @@ export class Summarizer extends EventEmitter implements ISummarizer {
|
|
|
277
282
|
this.runtime,
|
|
278
283
|
);
|
|
279
284
|
this.runningSummarizer = runningSummarizer;
|
|
285
|
+
this.runningSummarizer.on("summarize", this.handleSummarizeEvent);
|
|
280
286
|
this.starting = false;
|
|
281
|
-
|
|
282
287
|
return runningSummarizer;
|
|
283
288
|
}
|
|
284
289
|
|
|
290
|
+
private readonly handleSummarizeEvent = (eventProps: ISummarizeEventProps) => {
|
|
291
|
+
this.emit("summarize", eventProps);
|
|
292
|
+
};
|
|
293
|
+
|
|
285
294
|
/**
|
|
286
295
|
* Disposes of resources after running. This cleanup will
|
|
287
296
|
* clear any outstanding timers and reset some of the state
|
|
@@ -294,12 +303,13 @@ export class Summarizer extends EventEmitter implements ISummarizer {
|
|
|
294
303
|
|
|
295
304
|
this._disposed = true;
|
|
296
305
|
if (this.runningSummarizer) {
|
|
306
|
+
this.runningSummarizer.off("summarize", this.handleSummarizeEvent);
|
|
297
307
|
this.runningSummarizer.dispose();
|
|
298
308
|
this.runningSummarizer = undefined;
|
|
299
309
|
}
|
|
300
310
|
}
|
|
301
311
|
|
|
302
|
-
public
|
|
312
|
+
public summarizeOnDemand(options: IOnDemandSummarizeOptions): ISummarizeResults {
|
|
303
313
|
try {
|
|
304
314
|
if (this._disposed || this.runningSummarizer?.disposed) {
|
|
305
315
|
throw new UsageError("Summarizer is already disposed.");
|
|
@@ -318,7 +328,7 @@ export class Summarizer extends EventEmitter implements ISummarizer {
|
|
|
318
328
|
const builder = new SummarizeResultBuilder();
|
|
319
329
|
if (this.runningSummarizer) {
|
|
320
330
|
// Summarizer is already running. Go ahead and start.
|
|
321
|
-
return this.runningSummarizer.summarizeOnDemand(
|
|
331
|
+
return this.runningSummarizer.summarizeOnDemand(options, builder);
|
|
322
332
|
}
|
|
323
333
|
|
|
324
334
|
// Summarizer isn't running, so we need to start it, which is an async operation.
|
|
@@ -335,7 +345,7 @@ export class Summarizer extends EventEmitter implements ISummarizer {
|
|
|
335
345
|
startP
|
|
336
346
|
.then(async (runningSummarizer) => {
|
|
337
347
|
// Successfully started the summarizer. Run it.
|
|
338
|
-
runningSummarizer.summarizeOnDemand(
|
|
348
|
+
runningSummarizer.summarizeOnDemand(options, builder);
|
|
339
349
|
// Wait for a command to stop or loss of connectivity before tearing down the summarizer and client.
|
|
340
350
|
const stopReason = await Promise.race([
|
|
341
351
|
this.stopDeferred.promise,
|
|
@@ -357,9 +367,9 @@ export class Summarizer extends EventEmitter implements ISummarizer {
|
|
|
357
367
|
} catch (error) {
|
|
358
368
|
throw SummarizingWarning.wrap(error, false /* logged */, this.logger);
|
|
359
369
|
}
|
|
360
|
-
}
|
|
370
|
+
}
|
|
361
371
|
|
|
362
|
-
public
|
|
372
|
+
public enqueueSummarize(options: IEnqueueSummarizeOptions): EnqueueSummarizeResult {
|
|
363
373
|
if (
|
|
364
374
|
this._disposed ||
|
|
365
375
|
this.runningSummarizer === undefined ||
|
|
@@ -367,8 +377,8 @@ export class Summarizer extends EventEmitter implements ISummarizer {
|
|
|
367
377
|
) {
|
|
368
378
|
throw new UsageError("Summarizer is not running or already disposed.");
|
|
369
379
|
}
|
|
370
|
-
return this.runningSummarizer.enqueueSummarize(
|
|
371
|
-
}
|
|
380
|
+
return this.runningSummarizer.enqueueSummarize(options);
|
|
381
|
+
}
|
|
372
382
|
|
|
373
383
|
public recordSummaryAttempt?(summaryRefSeqNum?: number) {
|
|
374
384
|
this._heuristicData?.recordAttempt(summaryRefSeqNum);
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { IEvent, IEventProvider } from "@fluidframework/
|
|
6
|
+
import { IEvent, IEventProvider } from "@fluidframework/core-interfaces";
|
|
7
7
|
import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
|
|
8
8
|
import { TypedEventEmitter } from "@fluidframework/common-utils";
|
|
9
9
|
import { IClientDetails, MessageType } from "@fluidframework/protocol-definitions";
|