Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-69492

check_orphans_are_deleted_helpers.js can safely assume the shard key index cannot be dropped

    • Fully Compatible
    • Sharding EMEA 2022-11-28, Sharding EMEA 2022-12-12, Sharding EMEA 2022-12-26, Sharding EMEA 2023-01-09, Sharding EMEA 2023-01-23, Sharding EMEA 2023-02-06, Sharding EMEA 2023-02-20

      These lines can be removed from jstests/libs/check_orphans_are_deleted_helpers.js after the changes from SERVER-6491. Removing this escape hatch will increase our confidence the sharding consistency checks are truly running and not being inadvertently skipped.

      // It is possible for a test to drop the shard key index. We skip running the check for
      // orphan documents being deleted from that collection if it doesn't have a shard key
      // index.
      const hintRes = shardConn.getDB(dbName).runCommand({
          find: collName,
          hint: collDoc.key,
          limit: 1,
          singleBatch: true,
      });
      
      if (hintRes.ok !== 1) {
          assert(
              /hint provided does not correspond to an existing index/.test(hintRes.errmsg),
              () => {
                  return 'expected query failure due to bad hint: ' + tojson(hintRes);
              });
          print('Failed to find shard key index on ' + ns +
                ' so skipping check for orphan documents being deleted');
          return;
      }
      

            Assignee:
            pol.pinol@mongodb.com Pol Pinol
            Reporter:
            max.hirschhorn@mongodb.com Max Hirschhorn
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: