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

Investigate if hedge reads reissued after StaleConfig retry expire immediately

    • Type: Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Internal Code
    • Labels:
      None
    • ALL
    • Hide
      const st = new ShardingTest({
          mongos: [{
              setParameter: {
                  logComponentVerbosity: tojson({network: {verbosity: 2}, executor: {verbosity:2}}),
                  // Force the mongos's replica set monitors to always include all the eligible nodes.
                  "failpoint.scanningServerSelectorIgnoreLatencyWindow": tojson({mode: "alwaysOn"}),
                  "failpoint.sdamServerSelectorIgnoreLatencyWindow": tojson({mode: "alwaysOn"}),
                  // Force the mongos to send requests to hosts in alphabetical order of host names.
                  "failpoint.networkInterfaceSendRequestsToTargetHostsInAlphabeticalOrder":
                      tojson({mode: "alwaysOn"})
              }
          }],
          shards: 1,
          rs: {nodes: 2, setParameter: {logComponentVerbosity: tojson({command: {verbosity: 2}})}}
      });
      const dbName = "hedged_reads";
      const collName = "test";
      const ns = dbName + "." + collName;
      const testDB = st.s.getDB(dbName);
      
      const numDocs = 10;
      
      assert.commandWorked(st.s.adminCommand({enableSharding: dbName}));
      st.ensurePrimaryShard(dbName, st.shard0.shardName);
      
      let bulk = testDB[collName].initializeUnorderedBulkOp();
      for (let i = 0; i < numDocs; i++) {
          bulk.insert({x: i});
      }
      assert.commandWorked(bulk.execute());
      
      assert.commandWorked(st.s.adminCommand({setParameter: 1, maxTimeMSForHedgedReads: 1000}));
      jsTest.log(
          "Start test");
      assert.commandWorked(testDB.runCommand({
          count: collName,
          query: {$where: "sleep(100); return true;", x: {$gte: 0}},
          $readPreference: {mode: "nearest"}
      }));
      st.stop();
      }());
      

      Logs will show the retry and immediate expiration of hedge read.
      resmoke.py --suites sharding_auth ./test.js

      Show
      const st = new ShardingTest({ mongos: [{ setParameter: { logComponentVerbosity: tojson({network: {verbosity: 2}, executor: {verbosity:2}}), // Force the mongos's replica set monitors to always include all the eligible nodes. "failpoint.scanningServerSelectorIgnoreLatencyWindow" : tojson({mode: "alwaysOn" }), "failpoint.sdamServerSelectorIgnoreLatencyWindow" : tojson({mode: "alwaysOn" }), // Force the mongos to send requests to hosts in alphabetical order of host names. "failpoint.networkInterfaceSendRequestsToTargetHostsInAlphabeticalOrder" : tojson({mode: "alwaysOn" }) } }], shards: 1, rs: {nodes: 2, setParameter: {logComponentVerbosity: tojson({command: {verbosity: 2}})}} }); const dbName = "hedged_reads" ; const collName = "test" ; const ns = dbName + "." + collName; const testDB = st.s.getDB(dbName); const numDocs = 10; assert .commandWorked(st.s.adminCommand({enableSharding: dbName})); st.ensurePrimaryShard(dbName, st.shard0.shardName); let bulk = testDB[collName].initializeUnorderedBulkOp(); for (let i = 0; i < numDocs; i++) { bulk.insert({x: i}); } assert .commandWorked(bulk.execute()); assert .commandWorked(st.s.adminCommand({setParameter: 1, maxTimeMSForHedgedReads: 1000})); jsTest.log( "Start test" ); assert .commandWorked(testDB.runCommand({ count: collName, query: {$where: "sleep(100); return true ;" , x: {$gte: 0}}, $readPreference: {mode: "nearest" } })); st.stop(); }()); Logs will show the retry and immediate expiration of hedge read. resmoke.py --suites sharding_auth ./test.js
    • Service arch 2020-05-18

      Investigate if hedge reads reissued after StaleConfig refresh expires immediately with MaxTimeMSExpired error.
      The following testcase shows that HedgeRead after retry expires immediately - instead of waiting for MaxTimeMSOpOnly.
      It sounds possible that OperationContext in the retried request keeps the previous deadline.

            Assignee:
            misha.tyulenev@mongodb.com Misha Tyulenev (Inactive)
            Reporter:
            misha.tyulenev@mongodb.com Misha Tyulenev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: