validateShowRecordIdReplicatesAcrossNodes() incorrectly reuses cursor

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Minor - P4
    • 8.2.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Storage Execution
    • Fully Compatible
    • ALL
    • Hide
      import {
          validateShowRecordIdReplicatesAcrossNodes
      } from "jstests/libs/collection_write_path/replicated_record_ids_utils.js";
      import {ReplSetTest} from "jstests/libs/replsettest.js";
      
      const dbName = 'test';
      const replRidCollName = 'replRecIdColl';
      const rst = new ReplSetTest({
          // nodes: 1,
          nodes: [{}, {rsConfig: {priority: 0}}, {rsConfig: {priority: 0}}],
      });
      rst.startSet();
      rst.initiate();
      let primary = rst.getPrimary();
      let primDB = primary.getDB(dbName);
      
      // Create a collection with the param `recordsIdsReplicated` param set.
      primDB.runCommand({create: replRidCollName, recordIdsReplicated: true});
      assert.commandWorked(primDB.runCommand(
          {insert: replRidCollName, documents: [{"_id": 1}, {"_id": 2}]}));
      validateShowRecordIdReplicatesAcrossNodes(rst.nodes, dbName, replRidCollName);
      
      rst.stopSet();
      
      Show
      import { validateShowRecordIdReplicatesAcrossNodes } from "jstests/libs/collection_write_path/replicated_record_ids_utils.js" ; import {ReplSetTest} from "jstests/libs/replsettest.js" ; const dbName = 'test' ; const replRidCollName = 'replRecIdColl' ; const rst = new ReplSetTest({ // nodes: 1, nodes: [{}, {rsConfig: {priority: 0}}, {rsConfig: {priority: 0}}], }); rst.startSet(); rst.initiate(); let primary = rst.getPrimary(); let primDB = primary.getDB(dbName); // Create a collection with the param `recordsIdsReplicated` param set. primDB.runCommand({create: replRidCollName, recordIdsReplicated: true }); assert .commandWorked(primDB.runCommand( {insert: replRidCollName, documents: [{ "_id" : 1}, { "_id" : 2}]})); validateShowRecordIdReplicatesAcrossNodes(rst.nodes, dbName, replRidCollName); rst.stopSet();
    • Storage Execution 2025-07-21
    • None
    • 3
    • TBD
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      validateShowRecordIdReplicatesAcrossNodes() correctly validates recordIds are replicated in a 2 node replica set, but deterministically fails with a 3+ node replica set. 

      Thus, if there are 3+ nodes to compare, node0Cursor is exhausted after comparing results with node1, and will always report it is missing documents if compared against other nodes.

      If node0Cursor is created inside the for-loop, there's no issue.

              Assignee:
              Haley Connelly
              Reporter:
              Haley Connelly
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: