Race in replset1.js from two-phase index build

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Major - P3
    • 4.2.6, 4.4.0-rc0, 4.7.0
    • Affects Version/s: None
    • Component/s: Replication
    • None
    • Fully Compatible
    • ALL
    • v4.4, v4.2
    • 17
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      In replsettest1.js we do:

          t.ensureIndex({a: 1});
      
          var result = db.runCommand({getLastError: 1, w: 3, wtimeout: 30000});
          printjson(result);
          var lastOp = result.lastOp;
          const oplogEntries = replTest.dumpOplog(master);
          const lastOplogOp = oplogEntries[0];
          assert.eq(lastOplogOp['ts'], lastOp['ts']);
          assert.eq(lastOplogOp['t'], lastOp['t']);
      

      Between the getLastError and the dumpOplog, one more oplog entry was written. The last two oplog entries are (newest first):

      {  "op" : "u",  "ns" : "config.system.indexBuilds",  "ui" : UUID("1d972c54-1ce0-4789-ab21-bcfdd02897ce"),  "o" : {  "$v" : 1,  "$set" : {  "commitReadyMembers" : [ "ip-10-122-74-53:21272", "ip-10-122-74-53:21270", "ip-10-122-74-53:21271" ] } },  "o2" : {  "_id" : UUID("0695d117-05b1-4883-a949-3950b0da1770") },  "ts" : Timestamp(1584664055, 6),  "t" : NumberLong(2),  "wall" : ISODate("2020-03-20T00:27:35.668Z"),  "v" : NumberLong(2) }
      {  "op" : "c",  "ns" : "foo.$cmd",  "ui" : UUID("943c7b6a-a1dd-48e0-aeb5-3c9a6142ddf6"),  "o" : {  "commitIndexBuild" : "foo",  "indexBuildUUID" : UUID("0695d117-05b1-4883-a949-3950b0da1770"),  "indexes" : [ { "v" : 2, "key" : { "a" : 1 }, "name" : "a_1" } ] },  "ts" : Timestamp(1584664055, 5),  "t" : NumberLong(2),  "wall" : ISODate("2020-03-20T00:27:35.660Z"),  "v" : NumberLong(2) }
      

      The test expects no new oplog entries between getLastError and dumpOplog, so it fails:

      assert: [Timestamp(1584664055, 6)] != [Timestamp(1584664055, 5)] are not equal
      doassert@src/mongo/shell/assert.js:20:14
      assert.eq@src/mongo/shell/assert.js:179:9
      doTest@jstests/replsets/replset1.js:133:5
      

      We probably need to wait for the last oplog entry resulting from the ensureIndex call before calling getLastError. Handing off to Execution since this appears to be an intermittent failure from "Simultaneous indexing on all nodes (two phase commit)".

              Assignee:
              A. Jesse Jiryu Davis
              Reporter:
              A. Jesse Jiryu Davis
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: