[SERVER-71221] NoOverlapReadSource test not always timestamping writes Created: 09/Nov/22  Updated: 29/Oct/23  Resolved: 28/Nov/22

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 6.3.0-rc0

Type: Bug Priority: Major - P3
Reporter: Gregory Noma Assignee: Gregory Noma
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Execution Team 2022-12-12
Participants:

 Description   

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();
     }



 Comments   
Comment by Githook User [ 28/Nov/22 ]

Author:

{'name': 'Gregory Noma', 'email': 'gregory.noma@gmail.com', 'username': 'gregorynoma'}

Message: SERVER-71221 Timestamp writes in WT recovery unit tests
Branch: master
https://github.com/mongodb/mongo/commit/804a503820b0bd377bd50885fdd4c4a9201abeff

Generated at Thu Feb 08 06:18:23 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.