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

big_object1.js is not resilient to unexpected stepdowns

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 3.6.6, 4.0.1, 4.1.1
    • Affects Version/s: None
    • Component/s: None
    • Labels:
    • Fully Compatible
    • v4.0, v3.6
    • Query 2018-07-02
    • 16

      In one instance when this test was run in the retryable_writes_jscore_stepdown_passthrough, the primary receives a replSetStepDown command while the test's main insert loop is executing.

      [ReplicaSetFixture:job3:node2] 2018-05-01T18:15:45.659+0000 I COMMAND  [conn149] Attempting to step down in response to replSetStepDown command
      [ReplicaSetFixture:job3:node2] 2018-05-01T18:15:45.659+0000 I REPL     [conn149] transition to SECONDARY from PRIMARY

      Reading the code for this test, it looks like any sort of error is going to cause the while-loop to break prematurely.

          while (true) {
              var result;
              n = {_id: x, a: []};
              for (i = 0; i < 14 + x; i++)
              try {
                  result = t.insert(n);
                  o = n;
              } catch (e) {
              if (result.hasWriteError())
          printjson(t.stats(1024 * 1024));
          assert.lt(15 * 1024 * 1024, Object.bsonsize(o), "A1");
          assert.gt(17 * 1024 * 1024, Object.bsonsize(o), "A2");

      Having exited the loop without performing the needed inserts, the assertion fails.

      [js_test:big_object1] 2018-05-01T17:55:36.315+0000 2018-05-01T17:55:35.871+0000 E QUERY    [js] Error: 15728640 is not less than 13926560 : A1 :
      [js_test:big_object1] 2018-05-01T17:55:36.316+0000 doassert@src/mongo/shell/assert.js:18:14
      [js_test:big_object1] 2018-05-01T17:55:36.316+0000 _assertCompare@src/mongo/shell/assert.js:756:9
      [js_test:big_object1] 2018-05-01T17:55:36.317+0000 assert.lt@src/mongo/shell/assert.js:760:1
      [js_test:big_object1] 2018-05-01T17:55:36.317+0000 @jstests/core/big_object1.js:32:1
      [js_test:big_object1] 2018-05-01T17:55:36.320+0000 failed to load: jstests/core/big_object1.js

      If it were important for this test to be resilient in the face of unexpected stepdowns, we should rewrite the main insert loop, as it seems to be expecting to exit the loop for a particular reason (and not necessarily because a write failed due to a state change).

      However, I think that it would be easier to simply blacklist the test from the retryable_writes_jscore_stepdown_passthrough suite, as I can't really imagine how the coverage in the passthrough provides anything more than what is already achieved by running this test in jscore.

            james.wahlin@mongodb.com James Wahlin
            kyle.suarez@mongodb.com Kyle Suarez
            0 Vote for this issue
            3 Start watching this issue