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

NoOverlapReadSource test not always timestamping writes

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 6.3.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Fully Compatible
    • ALL
    • Execution Team 2022-12-12

      The NoOverlapReadSource unit test can fail due to finding a record which should not be visible at the kNoOverlap timestamp.

      {"t":{"$date":"2022-11-09T16:52:10.495Z"},"s":"I",  "c":"TEST",     "id":4680100, "ctx":"main","msg":"FAIL","attr":{"test":"NoOverlapReadSource","type":"TestAssertionFailureException","error":"Expected: !(rs->findRecord(opCtx1, rid3, &unused)) @src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit_test.cpp:265", ...}
      

      This appears to be because in some cases when the test is run, it is not properly configured to timestamp its writes.

      Potential fix:

      diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit_test.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit_test.cpp
      index 35e6b0a4302..d6169a6f3a0 100644
      --- a/src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit_test.cpp
      +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit_test.cpp
      @@ -30,6 +30,7 @@
       #include "mongo/db/storage/wiredtiger/wiredtiger_recovery_unit.h"
      
       #include "mongo/base/checked_cast.h"
      +#include "mongo/db/global_settings.h"
       #include "mongo/db/repl/repl_settings.h"
       #include "mongo/db/repl/replication_coordinator_mock.h"
       #include "mongo/db/service_context.h"
      @@ -62,10 +63,15 @@ public:
                         false,                  // .ephemeral
                         false                   // .repair
                 ) {
      +        // We need to use a replica set so that writes to replicated collections are not journaled
      +        // and thus are also timestamped.
      +        repl::ReplSettings replSettings;
      +        replSettings.setReplSetString("rs");
      +        setGlobalReplSettings(replSettings);
               repl::ReplicationCoordinator::set(
                   getGlobalServiceContext(),
      -            std::unique_ptr<repl::ReplicationCoordinator>(new repl::ReplicationCoordinatorMock(
      -                getGlobalServiceContext(), repl::ReplSettings())));
      +            std::unique_ptr<repl::ReplicationCoordinator>(
      +                new repl::ReplicationCoordinatorMock(getGlobalServiceContext(), replSettings)));
               _engine.notifyStartupComplete();
           }
      

            Assignee:
            gregory.noma@mongodb.com Gregory Noma
            Reporter:
            gregory.noma@mongodb.com Gregory Noma
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: