[v7.0] Wait for secondary to reach SECONDARY after restart in index_build_blocking_commit_duration_metrics.js

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Storage Execution
    • v7.0
    • Storage Execution 2026-08-17
    • 0
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      jstests/noPassthrough/index_build_blocking_commit_duration_metrics.js fails intermittently on v7.0 in testReceivingCommitIndexBuildEntryDuringStartupRecovery. The test restarts a secondary and immediately runs $currentOp against it without waiting for it to reach SECONDARY, so the command can fail with 13436 NotPrimaryOrSecondary.

      Why v7.0 only

      The test was introduced on v7.0 by 2d98b6180a6 (PR #46483), the v7.0 backport squashing SERVER-110442, SERVER-114337, SERVER-114363 and SERVER-115398. It is the only commit in v7.0's history for that path.

      TheĀ  waitForIndexBuildToStop(secondaryDBAfterRestart) call exists in none of the four upstream commits and in neither of the other branches' backports. It was added during the v7.0 adaptation:

             secondary = rst.getSecondary();
             const secondaryDBAfterRestart = secondary.getDB(dbName);
      
        +    IndexBuildTest.waitForIndexBuildToStop(secondaryDBAfterRestart);
        +
             awaitCreateIndex();
        

      v8.0 and master are not affected: they touch the restarted node only through
      getIndexBuildServerStatusMetric -> conn.serverStatus(), which is legal in RECOVERING, and only after awaitCreateIndex() has blocked on the primary's build completing.

      The proposed fix is to add the missing state barrier before the poll:

            secondary = rst.getSecondary();
            rst.awaitSecondaryNodes(null, [secondary]);
            const secondaryDBAfterRestart = secondary.getDB(dbName);
      
            IndexBuildTest.waitForIndexBuildToStop(secondaryDBAfterRestart);
        

            Assignee:
            Stephanie Eristoff
            Reporter:
            Stephanie Eristoff
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: