@fluidframework/container-runtime 2.0.0-dev.7.4.0.217212 → 2.0.0-dev.7.4.0.221926
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 +18 -0
- package/api-extractor.json +0 -3
- package/api-report/container-runtime.api.md +77 -73
- package/dist/blobManager.d.ts +4 -4
- package/dist/blobManager.d.ts.map +1 -1
- package/dist/blobManager.js.map +1 -1
- package/dist/container-runtime-alpha.d.ts +1361 -132
- package/dist/container-runtime-beta.d.ts +40 -2
- package/dist/container-runtime-public.d.ts +40 -2
- package/dist/container-runtime-untrimmed.d.ts +106 -93
- package/dist/containerRuntime.d.ts +19 -17
- package/dist/containerRuntime.d.ts.map +1 -1
- package/dist/containerRuntime.js +44 -24
- package/dist/containerRuntime.js.map +1 -1
- package/dist/dataStores.d.ts +10 -15
- package/dist/dataStores.d.ts.map +1 -1
- package/dist/dataStores.js +63 -36
- package/dist/dataStores.js.map +1 -1
- package/dist/gc/garbageCollection.d.ts +29 -10
- package/dist/gc/garbageCollection.d.ts.map +1 -1
- package/dist/gc/garbageCollection.js +149 -67
- package/dist/gc/garbageCollection.js.map +1 -1
- package/dist/gc/gcConfigs.d.ts.map +1 -1
- package/dist/gc/gcConfigs.js +34 -37
- package/dist/gc/gcConfigs.js.map +1 -1
- package/dist/gc/gcDefinitions.d.ts +97 -44
- package/dist/gc/gcDefinitions.d.ts.map +1 -1
- package/dist/gc/gcDefinitions.js +26 -16
- package/dist/gc/gcDefinitions.js.map +1 -1
- package/dist/gc/gcHelpers.d.ts +18 -25
- package/dist/gc/gcHelpers.d.ts.map +1 -1
- package/dist/gc/gcHelpers.js +29 -45
- package/dist/gc/gcHelpers.js.map +1 -1
- package/dist/gc/gcTelemetry.d.ts.map +1 -1
- package/dist/gc/gcTelemetry.js +14 -3
- package/dist/gc/gcTelemetry.js.map +1 -1
- package/dist/gc/gcUnreferencedStateTracker.d.ts +11 -5
- package/dist/gc/gcUnreferencedStateTracker.d.ts.map +1 -1
- package/dist/gc/gcUnreferencedStateTracker.js +43 -19
- package/dist/gc/gcUnreferencedStateTracker.js.map +1 -1
- package/dist/gc/index.d.ts +1 -1
- package/dist/gc/index.d.ts.map +1 -1
- package/dist/gc/index.js +4 -4
- package/dist/gc/index.js.map +1 -1
- package/dist/index.d.ts +13 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16 -5
- package/dist/index.js.map +1 -1
- package/dist/messageTypes.d.ts +13 -5
- package/dist/messageTypes.d.ts.map +1 -1
- package/dist/messageTypes.js +5 -0
- package/dist/messageTypes.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 +1 -0
- package/dist/pendingStateManager.d.ts.map +1 -1
- package/dist/pendingStateManager.js +1 -0
- package/dist/pendingStateManager.js.map +1 -1
- package/dist/summary/orderedClientElection.d.ts +1 -1
- package/dist/summary/orderedClientElection.js.map +1 -1
- package/dist/summary/summarizerTypes.d.ts +28 -28
- package/dist/summary/summarizerTypes.js.map +1 -1
- package/dist/summary/summaryCollection.d.ts +3 -3
- package/dist/summary/summaryCollection.js.map +1 -1
- package/dist/summary/summaryFormat.d.ts +3 -3
- package/dist/summary/summaryFormat.js.map +1 -1
- package/lib/blobManager.d.ts +4 -4
- package/lib/blobManager.d.ts.map +1 -1
- package/lib/blobManager.js.map +1 -1
- package/lib/container-runtime-alpha.d.ts +1361 -132
- package/lib/container-runtime-beta.d.ts +40 -2
- package/lib/container-runtime-public.d.ts +40 -2
- package/lib/container-runtime-untrimmed.d.ts +106 -93
- package/lib/containerRuntime.d.ts +19 -17
- package/lib/containerRuntime.d.ts.map +1 -1
- package/lib/containerRuntime.js +46 -26
- package/lib/containerRuntime.js.map +1 -1
- package/lib/dataStores.d.ts +10 -15
- package/lib/dataStores.d.ts.map +1 -1
- package/lib/dataStores.js +65 -38
- package/lib/dataStores.js.map +1 -1
- package/lib/gc/garbageCollection.d.ts +29 -10
- package/lib/gc/garbageCollection.d.ts.map +1 -1
- package/lib/gc/garbageCollection.js +151 -69
- package/lib/gc/garbageCollection.js.map +1 -1
- package/lib/gc/gcConfigs.d.ts.map +1 -1
- package/lib/gc/gcConfigs.js +37 -40
- package/lib/gc/gcConfigs.js.map +1 -1
- package/lib/gc/gcDefinitions.d.ts +97 -44
- package/lib/gc/gcDefinitions.d.ts.map +1 -1
- package/lib/gc/gcDefinitions.js +25 -15
- package/lib/gc/gcDefinitions.js.map +1 -1
- package/lib/gc/gcHelpers.d.ts +18 -25
- package/lib/gc/gcHelpers.d.ts.map +1 -1
- package/lib/gc/gcHelpers.js +27 -43
- package/lib/gc/gcHelpers.js.map +1 -1
- package/lib/gc/gcTelemetry.d.ts.map +1 -1
- package/lib/gc/gcTelemetry.js +14 -3
- package/lib/gc/gcTelemetry.js.map +1 -1
- package/lib/gc/gcUnreferencedStateTracker.d.ts +11 -5
- package/lib/gc/gcUnreferencedStateTracker.d.ts.map +1 -1
- package/lib/gc/gcUnreferencedStateTracker.js +43 -19
- package/lib/gc/gcUnreferencedStateTracker.js.map +1 -1
- package/lib/gc/index.d.ts +1 -1
- package/lib/gc/index.d.ts.map +1 -1
- package/lib/gc/index.js +1 -1
- package/lib/gc/index.js.map +1 -1
- package/lib/index.d.ts +13 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +15 -1
- package/lib/index.js.map +1 -1
- package/lib/messageTypes.d.ts +13 -5
- package/lib/messageTypes.d.ts.map +1 -1
- package/lib/messageTypes.js +5 -0
- package/lib/messageTypes.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 +1 -0
- package/lib/pendingStateManager.d.ts.map +1 -1
- package/lib/pendingStateManager.js +1 -0
- package/lib/pendingStateManager.js.map +1 -1
- package/lib/summary/orderedClientElection.d.ts +1 -1
- package/lib/summary/orderedClientElection.js.map +1 -1
- package/lib/summary/summarizerTypes.d.ts +28 -28
- package/lib/summary/summarizerTypes.js.map +1 -1
- package/lib/summary/summaryCollection.d.ts +3 -3
- package/lib/summary/summaryCollection.js.map +1 -1
- package/lib/summary/summaryFormat.d.ts +3 -3
- package/lib/summary/summaryFormat.js.map +1 -1
- package/package.json +18 -15
- package/src/blobManager.ts +5 -5
- package/src/containerRuntime.ts +66 -40
- package/src/dataStores.ts +118 -59
- package/src/gc/garbageCollection.md +14 -15
- package/src/gc/garbageCollection.ts +182 -75
- package/src/gc/gcConfigs.ts +50 -52
- package/src/gc/gcDefinitions.ts +112 -50
- package/src/gc/gcHelpers.ts +31 -52
- package/src/gc/gcTelemetry.ts +16 -4
- package/src/gc/gcUnreferencedStateTracker.ts +61 -22
- package/src/gc/index.ts +4 -3
- package/src/index.ts +17 -1
- package/src/messageTypes.ts +16 -2
- package/src/packageVersion.ts +1 -1
- package/src/pendingStateManager.ts +1 -0
- package/src/summary/orderedClientElection.ts +1 -1
- package/src/summary/summarizerTypes.ts +28 -28
- package/src/summary/summaryCollection.ts +3 -3
- package/src/summary/summaryFormat.ts +3 -3
- package/dist/id-compressor/appendOnlySortedMap.d.ts +0 -124
- package/dist/id-compressor/appendOnlySortedMap.d.ts.map +0 -1
- package/dist/id-compressor/appendOnlySortedMap.js +0 -318
- package/dist/id-compressor/appendOnlySortedMap.js.map +0 -1
- package/dist/id-compressor/finalSpace.d.ts +0 -29
- package/dist/id-compressor/finalSpace.d.ts.map +0 -1
- package/dist/id-compressor/finalSpace.js +0 -62
- package/dist/id-compressor/finalSpace.js.map +0 -1
- package/dist/id-compressor/idCompressor.d.ts +0 -54
- package/dist/id-compressor/idCompressor.d.ts.map +0 -1
- package/dist/id-compressor/idCompressor.js +0 -495
- package/dist/id-compressor/idCompressor.js.map +0 -1
- package/dist/id-compressor/identifiers.d.ts +0 -32
- package/dist/id-compressor/identifiers.d.ts.map +0 -1
- package/dist/id-compressor/identifiers.js +0 -15
- package/dist/id-compressor/identifiers.js.map +0 -1
- package/dist/id-compressor/index.d.ts +0 -13
- package/dist/id-compressor/index.d.ts.map +0 -1
- package/dist/id-compressor/index.js +0 -32
- package/dist/id-compressor/index.js.map +0 -1
- package/dist/id-compressor/persistanceUtilities.d.ts +0 -22
- package/dist/id-compressor/persistanceUtilities.d.ts.map +0 -1
- package/dist/id-compressor/persistanceUtilities.js +0 -43
- package/dist/id-compressor/persistanceUtilities.js.map +0 -1
- package/dist/id-compressor/sessionSpaceNormalizer.d.ts +0 -46
- package/dist/id-compressor/sessionSpaceNormalizer.d.ts.map +0 -1
- package/dist/id-compressor/sessionSpaceNormalizer.js +0 -80
- package/dist/id-compressor/sessionSpaceNormalizer.js.map +0 -1
- package/dist/id-compressor/sessions.d.ts +0 -115
- package/dist/id-compressor/sessions.d.ts.map +0 -1
- package/dist/id-compressor/sessions.js +0 -305
- package/dist/id-compressor/sessions.js.map +0 -1
- package/dist/id-compressor/utilities.d.ts +0 -52
- package/dist/id-compressor/utilities.d.ts.map +0 -1
- package/dist/id-compressor/utilities.js +0 -169
- package/dist/id-compressor/utilities.js.map +0 -1
- package/lib/id-compressor/appendOnlySortedMap.d.ts +0 -124
- package/lib/id-compressor/appendOnlySortedMap.d.ts.map +0 -1
- package/lib/id-compressor/appendOnlySortedMap.js +0 -314
- package/lib/id-compressor/appendOnlySortedMap.js.map +0 -1
- package/lib/id-compressor/finalSpace.d.ts +0 -29
- package/lib/id-compressor/finalSpace.d.ts.map +0 -1
- package/lib/id-compressor/finalSpace.js +0 -58
- package/lib/id-compressor/finalSpace.js.map +0 -1
- package/lib/id-compressor/idCompressor.d.ts +0 -54
- package/lib/id-compressor/idCompressor.d.ts.map +0 -1
- package/lib/id-compressor/idCompressor.js +0 -491
- package/lib/id-compressor/idCompressor.js.map +0 -1
- package/lib/id-compressor/identifiers.d.ts +0 -32
- package/lib/id-compressor/identifiers.d.ts.map +0 -1
- package/lib/id-compressor/identifiers.js +0 -11
- package/lib/id-compressor/identifiers.js.map +0 -1
- package/lib/id-compressor/index.d.ts +0 -13
- package/lib/id-compressor/index.d.ts.map +0 -1
- package/lib/id-compressor/index.js +0 -13
- package/lib/id-compressor/index.js.map +0 -1
- package/lib/id-compressor/persistanceUtilities.d.ts +0 -22
- package/lib/id-compressor/persistanceUtilities.d.ts.map +0 -1
- package/lib/id-compressor/persistanceUtilities.js +0 -34
- package/lib/id-compressor/persistanceUtilities.js.map +0 -1
- package/lib/id-compressor/sessionSpaceNormalizer.d.ts +0 -46
- package/lib/id-compressor/sessionSpaceNormalizer.d.ts.map +0 -1
- package/lib/id-compressor/sessionSpaceNormalizer.js +0 -76
- package/lib/id-compressor/sessionSpaceNormalizer.js.map +0 -1
- package/lib/id-compressor/sessions.d.ts +0 -115
- package/lib/id-compressor/sessions.d.ts.map +0 -1
- package/lib/id-compressor/sessions.js +0 -290
- package/lib/id-compressor/sessions.js.map +0 -1
- package/lib/id-compressor/utilities.d.ts +0 -52
- package/lib/id-compressor/utilities.d.ts.map +0 -1
- package/lib/id-compressor/utilities.js +0 -151
- package/lib/id-compressor/utilities.js.map +0 -1
- package/src/id-compressor/README.md +0 -69
- package/src/id-compressor/appendOnlySortedMap.ts +0 -366
- package/src/id-compressor/finalSpace.ts +0 -67
- package/src/id-compressor/idCompressor.ts +0 -630
- package/src/id-compressor/identifiers.ts +0 -42
- package/src/id-compressor/index.ts +0 -26
- package/src/id-compressor/persistanceUtilities.ts +0 -58
- package/src/id-compressor/sessionSpaceNormalizer.ts +0 -83
- package/src/id-compressor/sessions.ts +0 -405
- package/src/id-compressor/utilities.ts +0 -190
package/src/dataStores.ts
CHANGED
|
@@ -61,13 +61,8 @@ import {
|
|
|
61
61
|
} from "./dataStoreContext";
|
|
62
62
|
import { StorageServiceWithAttachBlobs } from "./storageServiceWithAttachBlobs";
|
|
63
63
|
import { IDataStoreAliasMessage, isDataStoreAliasMessage } from "./dataStore";
|
|
64
|
-
import { GCNodeType, disableDatastoreSweepKey
|
|
65
|
-
import {
|
|
66
|
-
summarizerClientType,
|
|
67
|
-
IContainerRuntimeMetadata,
|
|
68
|
-
nonDataStorePaths,
|
|
69
|
-
rootHasIsolatedChannels,
|
|
70
|
-
} from "./summary";
|
|
64
|
+
import { GCNodeType, disableDatastoreSweepKey } from "./gc";
|
|
65
|
+
import { IContainerRuntimeMetadata, nonDataStorePaths, rootHasIsolatedChannels } from "./summary";
|
|
71
66
|
|
|
72
67
|
type PendingAliasResolve = (success: boolean) => void;
|
|
73
68
|
|
|
@@ -281,6 +276,19 @@ export class DataStores implements IDisposable {
|
|
|
281
276
|
}
|
|
282
277
|
|
|
283
278
|
const context = this.contexts.get(aliasMessage.internalId);
|
|
279
|
+
// If the data store has been deleted, log an error and ignore this message. This helps prevent document
|
|
280
|
+
// corruption in case a deleted data store accidentally submitted a signal.
|
|
281
|
+
if (
|
|
282
|
+
this.checkAndLogIfDeleted(
|
|
283
|
+
aliasMessage.internalId,
|
|
284
|
+
context,
|
|
285
|
+
"Changed",
|
|
286
|
+
"processAliasMessageCore",
|
|
287
|
+
)
|
|
288
|
+
) {
|
|
289
|
+
return false;
|
|
290
|
+
}
|
|
291
|
+
|
|
284
292
|
if (context === undefined) {
|
|
285
293
|
this.mc.logger.sendErrorEvent({
|
|
286
294
|
eventName: "AliasFluidDataStoreNotFound",
|
|
@@ -382,18 +390,43 @@ export class DataStores implements IDisposable {
|
|
|
382
390
|
|
|
383
391
|
public resubmitDataStoreOp(envelope: IEnvelope, localOpMetadata: unknown) {
|
|
384
392
|
const context = this.contexts.get(envelope.address);
|
|
393
|
+
// If the data store has been deleted, log an error and throw an error. If there are local changes for a
|
|
394
|
+
// deleted data store, it can otherwise lead to inconsistent state when compared to other clients.
|
|
395
|
+
if (
|
|
396
|
+
this.checkAndLogIfDeleted(envelope.address, context, "Changed", "resubmitDataStoreOp")
|
|
397
|
+
) {
|
|
398
|
+
throw new DataCorruptionError("Context is deleted!", {
|
|
399
|
+
callSite: "resubmitDataStoreOp",
|
|
400
|
+
...tagCodeArtifacts({ id: envelope.address }),
|
|
401
|
+
});
|
|
402
|
+
}
|
|
385
403
|
assert(!!context, 0x160 /* "There should be a store context for the op" */);
|
|
386
404
|
context.reSubmit(envelope.contents, localOpMetadata);
|
|
387
405
|
}
|
|
388
406
|
|
|
389
407
|
public rollbackDataStoreOp(envelope: IEnvelope, localOpMetadata: unknown) {
|
|
390
408
|
const context = this.contexts.get(envelope.address);
|
|
409
|
+
// If the data store has been deleted, log an error and throw an error. If there are local changes for a
|
|
410
|
+
// deleted data store, it can otherwise lead to inconsistent state when compared to other clients.
|
|
411
|
+
if (
|
|
412
|
+
this.checkAndLogIfDeleted(envelope.address, context, "Changed", "rollbackDataStoreOp")
|
|
413
|
+
) {
|
|
414
|
+
throw new DataCorruptionError("Context is deleted!", {
|
|
415
|
+
callSite: "rollbackDataStoreOp",
|
|
416
|
+
...tagCodeArtifacts({ id: envelope.address }),
|
|
417
|
+
});
|
|
418
|
+
}
|
|
391
419
|
assert(!!context, 0x2e8 /* "There should be a store context for the op" */);
|
|
392
420
|
context.rollback(envelope.contents, localOpMetadata);
|
|
393
421
|
}
|
|
394
422
|
|
|
395
423
|
public async applyStashedOp(envelope: IEnvelope): Promise<unknown> {
|
|
396
424
|
const context = this.contexts.get(envelope.address);
|
|
425
|
+
// If the data store has been deleted, log an error and ignore this message. This helps prevent document
|
|
426
|
+
// corruption in case the data store that stashed the op is deleted.
|
|
427
|
+
if (this.checkAndLogIfDeleted(envelope.address, context, "Changed", "applyStashedOp")) {
|
|
428
|
+
return undefined;
|
|
429
|
+
}
|
|
397
430
|
assert(!!context, 0x161 /* "There should be a store context for the op" */);
|
|
398
431
|
return context.applyStashedOp(envelope.contents);
|
|
399
432
|
}
|
|
@@ -411,8 +444,21 @@ export class DataStores implements IDisposable {
|
|
|
411
444
|
) {
|
|
412
445
|
const envelope = message.contents as IEnvelope;
|
|
413
446
|
const transformed = { ...message, contents: envelope.contents };
|
|
414
|
-
this.validateNotDeleted(envelope.address);
|
|
415
447
|
const context = this.contexts.get(envelope.address);
|
|
448
|
+
|
|
449
|
+
// If the data store has been deleted, log an error and ignore this message. This helps prevent document
|
|
450
|
+
// corruption in case a deleted data store accidentally submitted an op.
|
|
451
|
+
if (
|
|
452
|
+
this.checkAndLogIfDeleted(
|
|
453
|
+
envelope.address,
|
|
454
|
+
context,
|
|
455
|
+
"Changed",
|
|
456
|
+
"processFluidDataStoreOp",
|
|
457
|
+
)
|
|
458
|
+
) {
|
|
459
|
+
return;
|
|
460
|
+
}
|
|
461
|
+
|
|
416
462
|
assert(!!context, 0x162 /* "There should be a store context for the op" */);
|
|
417
463
|
context.process(transformed, local, localMessageMetadata);
|
|
418
464
|
|
|
@@ -430,7 +476,22 @@ export class DataStores implements IDisposable {
|
|
|
430
476
|
requestHeaderData: RuntimeHeaderData,
|
|
431
477
|
): Promise<FluidDataStoreContext> {
|
|
432
478
|
const headerData = { ...defaultRuntimeHeaderData, ...requestHeaderData };
|
|
433
|
-
|
|
479
|
+
if (
|
|
480
|
+
this.checkAndLogIfDeleted(
|
|
481
|
+
id,
|
|
482
|
+
this.contexts.get(id),
|
|
483
|
+
"Requested",
|
|
484
|
+
"getDataStore",
|
|
485
|
+
requestHeaderData,
|
|
486
|
+
)
|
|
487
|
+
) {
|
|
488
|
+
// The requested data store has been deleted by gc. Create a 404 response exception.
|
|
489
|
+
const request: IRequest = { url: id };
|
|
490
|
+
throw responseToException(
|
|
491
|
+
createResponseError(404, "DataStore was deleted", request),
|
|
492
|
+
request,
|
|
493
|
+
);
|
|
494
|
+
}
|
|
434
495
|
|
|
435
496
|
const context = await this.contexts.getBoundOrRemoted(id, headerData.wait);
|
|
436
497
|
if (context === undefined) {
|
|
@@ -448,8 +509,16 @@ export class DataStores implements IDisposable {
|
|
|
448
509
|
id: string,
|
|
449
510
|
requestHeaderData: RuntimeHeaderData,
|
|
450
511
|
): Promise<FluidDataStoreContext | undefined> {
|
|
451
|
-
// If the data store has been deleted, return undefined.
|
|
452
|
-
if (
|
|
512
|
+
// If the data store has been deleted, log an error and return undefined.
|
|
513
|
+
if (
|
|
514
|
+
this.checkAndLogIfDeleted(
|
|
515
|
+
id,
|
|
516
|
+
this.contexts.get(id),
|
|
517
|
+
"Requested",
|
|
518
|
+
"getDataStoreIfAvailable",
|
|
519
|
+
requestHeaderData,
|
|
520
|
+
)
|
|
521
|
+
) {
|
|
453
522
|
return undefined;
|
|
454
523
|
}
|
|
455
524
|
const headerData = { ...defaultRuntimeHeaderData, ...requestHeaderData };
|
|
@@ -461,55 +530,43 @@ export class DataStores implements IDisposable {
|
|
|
461
530
|
}
|
|
462
531
|
|
|
463
532
|
/**
|
|
464
|
-
* Checks if the data store has been deleted by GC.
|
|
465
|
-
* @param id - data store id
|
|
466
|
-
* @param
|
|
467
|
-
* @param
|
|
533
|
+
* Checks if the data store has been deleted by GC. If so, log an error.
|
|
534
|
+
* @param id - The data store's id.
|
|
535
|
+
* @param context - The data store context.
|
|
536
|
+
* @param callSite - The function name this is called from.
|
|
537
|
+
* @param requestHeaderData - The request header information to log if the data store is deleted.
|
|
468
538
|
* @returns true if the data store is deleted. Otherwise, returns false.
|
|
469
539
|
*/
|
|
470
|
-
private
|
|
540
|
+
private checkAndLogIfDeleted(
|
|
541
|
+
id: string,
|
|
542
|
+
context: FluidDataStoreContext | undefined,
|
|
543
|
+
deletedLogSuffix: string,
|
|
544
|
+
callSite: string,
|
|
545
|
+
requestHeaderData?: RuntimeHeaderData,
|
|
546
|
+
) {
|
|
471
547
|
const dataStoreNodePath = `/${id}`;
|
|
472
548
|
if (!this.isDataStoreDeleted(dataStoreNodePath)) {
|
|
473
549
|
return false;
|
|
474
550
|
}
|
|
475
|
-
assert(
|
|
476
|
-
!this.contexts.has(id),
|
|
477
|
-
0x570 /* Inconsistent state! GC says the data store is deleted, but the data store is not deleted from the runtime. */,
|
|
478
|
-
);
|
|
479
|
-
sendGCUnexpectedUsageEvent(
|
|
480
|
-
this.mc,
|
|
481
|
-
{
|
|
482
|
-
eventName: "GC_Deleted_DataStore_Requested",
|
|
483
|
-
category: "error",
|
|
484
|
-
isSummarizerClient: this.runtime.clientDetails.type === summarizerClientType,
|
|
485
|
-
id,
|
|
486
|
-
headers: JSON.stringify(requestHeaderData),
|
|
487
|
-
gcTombstoneEnforcementAllowed: this.runtime.gcTombstoneEnforcementAllowed,
|
|
488
|
-
},
|
|
489
|
-
undefined /* packagePath */,
|
|
490
|
-
);
|
|
491
|
-
return true;
|
|
492
|
-
}
|
|
493
551
|
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
const request: IRequest = { url: id };
|
|
503
|
-
throw responseToException(
|
|
504
|
-
createResponseError(404, "DataStore was deleted", request),
|
|
505
|
-
request,
|
|
506
|
-
);
|
|
507
|
-
}
|
|
552
|
+
this.mc.logger.sendErrorEvent({
|
|
553
|
+
eventName: `GC_Deleted_DataStore_${deletedLogSuffix}`,
|
|
554
|
+
...tagCodeArtifacts({ id }),
|
|
555
|
+
callSite,
|
|
556
|
+
headers: JSON.stringify(requestHeaderData),
|
|
557
|
+
exists: context !== undefined,
|
|
558
|
+
});
|
|
559
|
+
return true;
|
|
508
560
|
}
|
|
509
561
|
|
|
510
562
|
public processSignal(fluidDataStoreId: string, message: IInboundSignalMessage, local: boolean) {
|
|
511
|
-
this.validateNotDeleted(fluidDataStoreId);
|
|
512
563
|
const context = this.contexts.get(fluidDataStoreId);
|
|
564
|
+
// If the data store has been deleted, log an error and ignore this message. This helps prevent document
|
|
565
|
+
// corruption in case a deleted data store accidentally submitted a signal.
|
|
566
|
+
if (this.checkAndLogIfDeleted(fluidDataStoreId, context, "Changed", "processSignal")) {
|
|
567
|
+
return;
|
|
568
|
+
}
|
|
569
|
+
|
|
513
570
|
if (!context) {
|
|
514
571
|
// Attach message may not have been processed yet
|
|
515
572
|
assert(!local, 0x163 /* "Missing datastore for local signal" */);
|
|
@@ -711,7 +768,7 @@ export class DataStores implements IDisposable {
|
|
|
711
768
|
* After GC has run, called to notify this Container's data stores of routes that are used in it.
|
|
712
769
|
* @param usedRoutes - The routes that are used in all data stores in this Container.
|
|
713
770
|
*/
|
|
714
|
-
public updateUsedRoutes(usedRoutes: string[]) {
|
|
771
|
+
public updateUsedRoutes(usedRoutes: readonly string[]) {
|
|
715
772
|
// Get a map of data store ids to routes used in it.
|
|
716
773
|
const usedDataStoreRoutes = unpackChildNodesUsedRoutes(usedRoutes);
|
|
717
774
|
|
|
@@ -733,7 +790,7 @@ export class DataStores implements IDisposable {
|
|
|
733
790
|
* This is called to update objects whose routes are unused. The unused objects are deleted.
|
|
734
791
|
* @param unusedRoutes - The routes that are unused in all data stores in this Container.
|
|
735
792
|
*/
|
|
736
|
-
public updateUnusedRoutes(unusedRoutes: string[]) {
|
|
793
|
+
public updateUnusedRoutes(unusedRoutes: readonly string[]) {
|
|
737
794
|
for (const route of unusedRoutes) {
|
|
738
795
|
const pathParts = route.split("/");
|
|
739
796
|
// Delete data store only if its route (/datastoreId) is in unusedRoutes. We don't want to delete a data
|
|
@@ -756,7 +813,7 @@ export class DataStores implements IDisposable {
|
|
|
756
813
|
* be deleted.
|
|
757
814
|
* @returns The routes of data stores and its objects that were deleted.
|
|
758
815
|
*/
|
|
759
|
-
public deleteSweepReadyNodes(sweepReadyDataStoreRoutes: string[]): string[] {
|
|
816
|
+
public deleteSweepReadyNodes(sweepReadyDataStoreRoutes: readonly string[]): readonly string[] {
|
|
760
817
|
// If sweep for data stores is not enabled, return empty list indicating nothing is deleted.
|
|
761
818
|
if (this.mc.config.getBoolean(disableDatastoreSweepKey) === true) {
|
|
762
819
|
return [];
|
|
@@ -765,23 +822,25 @@ export class DataStores implements IDisposable {
|
|
|
765
822
|
const pathParts = route.split("/");
|
|
766
823
|
const dataStoreId = pathParts[1];
|
|
767
824
|
|
|
768
|
-
// TODO: GC:Validation - Skip any routes already deleted
|
|
769
825
|
// Ignore sub-data store routes because a data store and its sub-routes are deleted together, so, we only
|
|
770
826
|
// need to delete the data store.
|
|
771
827
|
if (pathParts.length > 2) {
|
|
772
828
|
continue;
|
|
773
829
|
}
|
|
774
830
|
|
|
775
|
-
|
|
831
|
+
const dataStoreContext = this.contexts.get(dataStoreId);
|
|
832
|
+
if (dataStoreContext === undefined) {
|
|
776
833
|
this.mc.logger.sendErrorEvent({
|
|
777
834
|
eventName: "DeletedDataStoreNotFound",
|
|
778
|
-
dataStoreId,
|
|
835
|
+
...tagCodeArtifacts({ id: dataStoreId }),
|
|
836
|
+
details: {
|
|
837
|
+
alreadyDeleted: this.isDataStoreDeleted(dataStoreId),
|
|
838
|
+
},
|
|
779
839
|
});
|
|
840
|
+
continue;
|
|
780
841
|
}
|
|
781
842
|
|
|
782
|
-
|
|
783
|
-
assert(dataStore !== undefined, 0x571 /* Attempting to delete unknown dataStore */);
|
|
784
|
-
dataStore.delete();
|
|
843
|
+
dataStoreContext.delete();
|
|
785
844
|
|
|
786
845
|
// Delete the contexts of sweep ready data stores.
|
|
787
846
|
this.contexts.delete(dataStoreId);
|
|
@@ -796,7 +855,7 @@ export class DataStores implements IDisposable {
|
|
|
796
855
|
* scenarios with accessing deleted content without actually deleting content from summaries.
|
|
797
856
|
* @param tombstonedRoutes - The routes that are tombstones in all data stores in this Container.
|
|
798
857
|
*/
|
|
799
|
-
public updateTombstonedRoutes(tombstonedRoutes: string[]) {
|
|
858
|
+
public updateTombstonedRoutes(tombstonedRoutes: readonly string[]) {
|
|
800
859
|
const tombstonedDataStoresSet: Set<string> = new Set();
|
|
801
860
|
for (const route of tombstonedRoutes) {
|
|
802
861
|
const pathParts = route.split("/");
|
|
@@ -50,16 +50,19 @@ Mark phase is enabled by default for a container. It is enabled during creation
|
|
|
50
50
|
|
|
51
51
|
### Sweep phase
|
|
52
52
|
|
|
53
|
-
In this phase, the GC algorithm
|
|
54
|
-
|
|
55
|
-
The Fluid Runtime enforces a maximum session length (configurable) in order to guarantee
|
|
53
|
+
In this phase, the GC algorithm deletes any Fluid object that has been unreferenced for a sufficient time to guarantee
|
|
54
|
+
they could never be referenced again by any active clients, i.e., clients that have the object in memory and could reference it again.
|
|
55
|
+
The Fluid Runtime enforces a maximum session length (configurable) in order to guarantee all in-memory objects are cleared before
|
|
56
|
+
it concludes an object is safe to delete.
|
|
56
57
|
|
|
57
|
-
GC sweep phase
|
|
58
|
-
as part of the Mark Phase when Sweep is disabled. In this mode, any object that GC determines is ready to be deleted is
|
|
59
|
-
marked as a "Tombstone", which triggers certain logging events and/or behavior changes if/when that Tombstoned object is
|
|
60
|
-
accessed by the application.
|
|
58
|
+
GC sweep phase runs in two stages:
|
|
61
59
|
|
|
62
|
-
|
|
60
|
+
- The first stage is the "Tombstone" stage, where objects are marked as Tombstones, meaning GC believes they will
|
|
61
|
+
never be referenced again and are safe to delete. They are not yet deleted at this point, but any attempt to
|
|
62
|
+
load them will fail. This way, there's a chance to recover a Tombstoned object in case we detect it's still being used.
|
|
63
|
+
- The second stage is the "Sweep" or "Delete" stage, where the objects are fully deleted.
|
|
64
|
+
This occurs after a configurable delay called the "Sweep Grace Period", to give time for application teams
|
|
65
|
+
to monitor for Tombstone-related errors and react before delete occurs.
|
|
63
66
|
|
|
64
67
|
## GC Configuration
|
|
65
68
|
|
|
@@ -67,7 +70,8 @@ The default configuration for GC today is:
|
|
|
67
70
|
|
|
68
71
|
- GC Mark Phase is **enabled**, including Tombstone Mode
|
|
69
72
|
- Session Expiry is **enabled**
|
|
70
|
-
-
|
|
73
|
+
- The "Tombstone" stage of Sweep Phase is **enabled** (attempting to load a tombstoned object will fail)
|
|
74
|
+
- The "Delete" stage of Sweep Phase is **disabled**
|
|
71
75
|
- Note: Once enabled, Sweep will only run for documents created from that point forward
|
|
72
76
|
|
|
73
77
|
### Techniques used for configuration
|
|
@@ -94,12 +98,7 @@ covered in the [Advanced Configuration](./gcEarlyAdoption.md#more-advanced-confi
|
|
|
94
98
|
|
|
95
99
|
### Enabling Sweep Phase
|
|
96
100
|
|
|
97
|
-
To enable Sweep Phase for new documents, you must set the `
|
|
98
|
-
The full semantics of this GC Option are discussed [here](./gcEarlyAdoption.md#more-about-gcsweepgeneration-and-gctombstonegeneration).
|
|
99
|
-
Note that this will disabled Tombstone Mode.
|
|
100
|
-
|
|
101
|
-
A full treatment of Tombstone and Sweep configuration can be found in
|
|
102
|
-
[this companion document geared towards early adopters of GC](./gcEarlyAdoption.md).
|
|
101
|
+
To enable the Sweep Phase for new documents, you must set the `enableGCSweep` GC Option to true.
|
|
103
102
|
|
|
104
103
|
### More Advanced Configuration
|
|
105
104
|
|