@fluidframework/map 2.0.0-rc.1.0.1 → 2.0.0-rc.1.0.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.
@@ -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/map";
8
- export declare const pkgVersion = "2.0.0-rc.1.0.1";
8
+ export declare const pkgVersion = "2.0.0-rc.1.0.2";
9
9
  //# sourceMappingURL=packageVersion.d.mts.map
@@ -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/map";
8
- export const pkgVersion = "2.0.0-rc.1.0.1";
8
+ export const pkgVersion = "2.0.0-rc.1.0.2";
9
9
  //# sourceMappingURL=packageVersion.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"packageVersion.mjs","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,qBAAqB,CAAC;AAC7C,MAAM,CAAC,MAAM,UAAU,GAAG,gBAAgB,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/map\";\nexport const pkgVersion = \"2.0.0-rc.1.0.1\";\n"]}
1
+ {"version":3,"file":"packageVersion.mjs","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,qBAAqB,CAAC;AAC7C,MAAM,CAAC,MAAM,UAAU,GAAG,gBAAgB,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/map\";\nexport const pkgVersion = \"2.0.0-rc.1.0.2\";\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/map",
3
- "version": "2.0.0-rc.1.0.1",
3
+ "version": "2.0.0-rc.1.0.2",
4
4
  "description": "Distributed map",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -87,31 +87,31 @@
87
87
  "temp-directory": "nyc/.nyc_output"
88
88
  },
89
89
  "dependencies": {
90
- "@fluid-internal/client-utils": ">=2.0.0-rc.1.0.1 <2.0.0-rc.1.1.0",
91
- "@fluidframework/core-interfaces": ">=2.0.0-rc.1.0.1 <2.0.0-rc.1.1.0",
92
- "@fluidframework/core-utils": ">=2.0.0-rc.1.0.1 <2.0.0-rc.1.1.0",
93
- "@fluidframework/datastore-definitions": ">=2.0.0-rc.1.0.1 <2.0.0-rc.1.1.0",
94
- "@fluidframework/driver-utils": ">=2.0.0-rc.1.0.1 <2.0.0-rc.1.1.0",
95
- "@fluidframework/merge-tree": ">=2.0.0-rc.1.0.1 <2.0.0-rc.1.1.0",
90
+ "@fluid-internal/client-utils": ">=2.0.0-rc.1.0.2 <2.0.0-rc.1.1.0",
91
+ "@fluidframework/core-interfaces": ">=2.0.0-rc.1.0.2 <2.0.0-rc.1.1.0",
92
+ "@fluidframework/core-utils": ">=2.0.0-rc.1.0.2 <2.0.0-rc.1.1.0",
93
+ "@fluidframework/datastore-definitions": ">=2.0.0-rc.1.0.2 <2.0.0-rc.1.1.0",
94
+ "@fluidframework/driver-utils": ">=2.0.0-rc.1.0.2 <2.0.0-rc.1.1.0",
95
+ "@fluidframework/merge-tree": ">=2.0.0-rc.1.0.2 <2.0.0-rc.1.1.0",
96
96
  "@fluidframework/protocol-definitions": "^3.1.0",
97
- "@fluidframework/runtime-definitions": ">=2.0.0-rc.1.0.1 <2.0.0-rc.1.1.0",
98
- "@fluidframework/runtime-utils": ">=2.0.0-rc.1.0.1 <2.0.0-rc.1.1.0",
99
- "@fluidframework/shared-object-base": ">=2.0.0-rc.1.0.1 <2.0.0-rc.1.1.0",
100
- "@fluidframework/telemetry-utils": ">=2.0.0-rc.1.0.1 <2.0.0-rc.1.1.0",
97
+ "@fluidframework/runtime-definitions": ">=2.0.0-rc.1.0.2 <2.0.0-rc.1.1.0",
98
+ "@fluidframework/runtime-utils": ">=2.0.0-rc.1.0.2 <2.0.0-rc.1.1.0",
99
+ "@fluidframework/shared-object-base": ">=2.0.0-rc.1.0.2 <2.0.0-rc.1.1.0",
100
+ "@fluidframework/telemetry-utils": ">=2.0.0-rc.1.0.2 <2.0.0-rc.1.1.0",
101
101
  "path-browserify": "^1.0.1"
102
102
  },
103
103
  "devDependencies": {
104
104
  "@arethetypeswrong/cli": "^0.13.3",
105
- "@fluid-private/stochastic-test-utils": ">=2.0.0-rc.1.0.1 <2.0.0-rc.1.1.0",
106
- "@fluid-private/test-dds-utils": ">=2.0.0-rc.1.0.1 <2.0.0-rc.1.1.0",
105
+ "@fluid-private/stochastic-test-utils": ">=2.0.0-rc.1.0.2 <2.0.0-rc.1.1.0",
106
+ "@fluid-private/test-dds-utils": ">=2.0.0-rc.1.0.2 <2.0.0-rc.1.1.0",
107
107
  "@fluid-tools/benchmark": "^0.48.0",
108
108
  "@fluid-tools/build-cli": "^0.29.0",
109
109
  "@fluidframework/build-common": "^2.0.3",
110
110
  "@fluidframework/build-tools": "^0.29.0",
111
111
  "@fluidframework/eslint-config-fluid": "^3.2.0",
112
112
  "@fluidframework/map-previous": "npm:@fluidframework/map@2.0.0-internal.8.0.0",
113
- "@fluidframework/mocha-test-setup": ">=2.0.0-rc.1.0.1 <2.0.0-rc.1.1.0",
114
- "@fluidframework/test-runtime-utils": ">=2.0.0-rc.1.0.1 <2.0.0-rc.1.1.0",
113
+ "@fluidframework/mocha-test-setup": ">=2.0.0-rc.1.0.2 <2.0.0-rc.1.1.0",
114
+ "@fluidframework/test-runtime-utils": ">=2.0.0-rc.1.0.2 <2.0.0-rc.1.1.0",
115
115
  "@microsoft/api-extractor": "^7.38.3",
116
116
  "@types/mocha": "^9.1.1",
117
117
  "@types/node": "^18.19.0",
package/src/directory.ts CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  import { assert } from "@fluidframework/core-utils";
7
7
  import { TypedEventEmitter } from "@fluid-internal/client-utils";
8
- import { UsageError } from "@fluidframework/telemetry-utils";
8
+ import { ITelemetryLoggerExt, UsageError } from "@fluidframework/telemetry-utils";
9
9
  import { readAndParse } from "@fluidframework/driver-utils";
10
10
  import { ISequencedDocumentMessage, MessageType } from "@fluidframework/protocol-definitions";
11
11
  import {
@@ -433,6 +433,10 @@ class DirectoryCreationTracker {
433
433
  }, keys);
434
434
  return keys;
435
435
  }
436
+
437
+ public get size(): number {
438
+ return this.keyToIndex.size;
439
+ }
436
440
  }
437
441
 
438
442
  /**
@@ -498,6 +502,7 @@ export class SharedDirectory
498
502
  this.runtime,
499
503
  this.serializer,
500
504
  posix.sep,
505
+ this.logger,
501
506
  );
502
507
 
503
508
  /**
@@ -781,10 +786,7 @@ export class SharedDirectory
781
786
  // guaranteed during the serialization process. As a result, it is only essential to utilize the
782
787
  // "fake" client sequence number to signify the loading order, and there is no need to retain
783
788
  // the actual client sequence number at this point.
784
- if (createInfo !== undefined && createInfo.csn > -1) {
785
- // If csn is -1, then initialize it with 0, otherwise we will never process ops for this
786
- // sub directory. This could be done at serialization time too, but we need to maintain
787
- // back compat too and also we will actually know the state when it was serialized.
789
+ if (createInfo !== undefined && createInfo.csn > 0) {
788
790
  if (!tempSeqNums.has(createInfo.csn)) {
789
791
  tempSeqNums.set(createInfo.csn, 0);
790
792
  }
@@ -792,6 +794,13 @@ export class SharedDirectory
792
794
  seqData = { seq: createInfo.csn, clientSeq: fakeClientSeq };
793
795
  tempSeqNums.set(createInfo.csn, ++fakeClientSeq);
794
796
  } else {
797
+ /**
798
+ * 1. If csn is -1, then initialize it with 0, otherwise we will never process ops for this
799
+ * sub directory. This could be done at serialization time too, but we need to maintain
800
+ * back compat too and also we will actually know the state when it was serialized.
801
+ * 2. We need to make the csn = -1 and csn = 0 share the same counter, there are cases
802
+ * where both -1 and 0 coexist within a single document.
803
+ */
795
804
  seqData = {
796
805
  seq: 0,
797
806
  clientSeq: ++currentSubDir.localCreationSeq,
@@ -806,6 +815,7 @@ export class SharedDirectory
806
815
  this.runtime,
807
816
  this.serializer,
808
817
  posix.join(currentSubDir.absolutePath, subdirName),
818
+ this.logger,
809
819
  );
810
820
  currentSubDir.populateSubDirectory(subdirName, newSubDir);
811
821
  // Record the newly inserted subdirectory to the creation tracker
@@ -1215,6 +1225,8 @@ function assertNonNullClientId(clientId: string | null): asserts clientId is str
1215
1225
  assert(clientId !== null, 0x6af /* client id should never be null */);
1216
1226
  }
1217
1227
 
1228
+ let hasLoggedDirectoryInconsistency = false;
1229
+
1218
1230
  /**
1219
1231
  * Node of the directory tree.
1220
1232
  * @sealed
@@ -1305,6 +1317,7 @@ class SubDirectory extends TypedEventEmitter<IDirectoryEvents> implements IDirec
1305
1317
  private readonly runtime: IFluidDataStoreRuntime,
1306
1318
  private readonly serializer: IFluidSerializer,
1307
1319
  public readonly absolutePath: string,
1320
+ private readonly logger: ITelemetryLoggerExt,
1308
1321
  ) {
1309
1322
  super();
1310
1323
  this.localCreationSeqTracker = new DirectoryCreationTracker();
@@ -1506,10 +1519,24 @@ class SubDirectory extends TypedEventEmitter<IDirectoryEvents> implements IDirec
1506
1519
 
1507
1520
  const subdirNames = [...ackedSubdirsInOrder, ...localSubdirsInOrder];
1508
1521
 
1509
- assert(
1510
- subdirNames.length === this._subdirectories.size,
1511
- 0x85c /* The count of keys for iteration should be consistent with the size of actual data */,
1512
- );
1522
+ if (subdirNames.length !== this._subdirectories.size) {
1523
+ // TODO: AB#7022: Hitting this block indicates that the eventual consistency scheme for ordering subdirectories
1524
+ // has failed. Fall back to previous directory behavior, which didn't guarantee ordering.
1525
+ // It's not currently clear how to reach this state, so log some diagnostics to help understand the issue.
1526
+ // This whole block should eventually be replaced by an assert that the two sizes align.
1527
+ if (!hasLoggedDirectoryInconsistency) {
1528
+ this.logger.sendTelemetryEvent({
1529
+ eventName: "inconsistentSubdirectoryOrdering",
1530
+ localKeyCount: this.localCreationSeqTracker.size,
1531
+ ackedKeyCount: this.ackedCreationSeqTracker.size,
1532
+ subdirNamesLength: subdirNames.length,
1533
+ subdirectoriesSize: this._subdirectories.size,
1534
+ });
1535
+ hasLoggedDirectoryInconsistency = true;
1536
+ }
1537
+
1538
+ return this._subdirectories.entries();
1539
+ }
1513
1540
 
1514
1541
  const entriesIterator = {
1515
1542
  index: 0,
@@ -2592,6 +2619,7 @@ class SubDirectory extends TypedEventEmitter<IDirectoryEvents> implements IDirec
2592
2619
  this.runtime,
2593
2620
  this.serializer,
2594
2621
  absolutePath,
2622
+ this.logger,
2595
2623
  );
2596
2624
  /**
2597
2625
  * Store the sequnce numbers of newly created subdirectory to the proper creation tracker, based
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/map";
9
- export const pkgVersion = "2.0.0-rc.1.0.1";
9
+ export const pkgVersion = "2.0.0-rc.1.0.2";