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

run_check_repl_dbhash.js hook exits without actually running dbhash on a replica set

    • Fully Compatible
    • ALL
    • v3.6, v3.4
    • TIG 2018-02-12

      The changes from b9decc4 as part of SERVER-21630 introduced a bug that causes the dbhash check to always be skipped on a replica set no matter how many voting secondaries it has.

      Inside the isMultiNodeReplSet() function, the handling for when the isMaster response indicates the server is part of replica set shadows the outer hosts variable with another let declaration, thereby causing the array of connection strings to always be empty.

      function isMultiNodeReplSet(uri) {
          const mongo = new Mongo(uri);
          let hosts = [];
          const isMaster = mongo.adminCommand({isMaster: 1});
          if (isMaster.hasOwnProperty('setName')) {
              let hosts = isMaster.hosts;
              if (isMaster.hasOwnProperty('passives')) {
                  hosts = hosts.concat(isMaster.passives);
              }
          }
          return hosts.length > 1;
      }
      

      Note: JavaScripts that call ReplSetTest#checkReplicatedDataHashes() (e.g. from the work in SERVER-25640) aren't affected by this issue.

            Assignee:
            max.hirschhorn@mongodb.com Max Hirschhorn
            Reporter:
            max.hirschhorn@mongodb.com Max Hirschhorn
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: