[SERVER-69826] implement js/c++ unit test for WT-9870 Created: 20/Sep/22  Updated: 29/Oct/23  Resolved: 14/Oct/22

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

Type: Task Priority: Major - P3
Reporter: Benety Goh Assignee: Benety Goh
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: File draft_repro.cpp     File reproducer.cpp    
Issue Links:
Related
related to SERVER-70896 fix missing replacement string in fmt... Closed
related to SERVER-72907 Complete C++ unit test for WT-9870 us... Backlog
related to SERVER-70539 implement C++ unit test for WT-9870 u... Closed
related to SERVER-71925 move MONGO_LOGV2_DEFAULT_COMPONENT be... Closed
is related to WT-9870 Fix updating pinned timestamp wheneve... Closed
Backwards Compatibility: Fully Compatible
Sprint: Execution Team 2022-10-17, Execution Team 2022-10-31
Participants:

 Description   

Provides coverage at in the Mongo codebase for a recently resolved WiredTiger issue relating to the recovery process. There is an existing unit test added in WT-9870 that can be adapted to use the MongoDB catalog and storage engine interface.



 Comments   
Comment by Githook User [ 14/Oct/22 ]

Author:

{'name': 'Benety Goh', 'email': 'benety@mongodb.com', 'username': 'benety'}

Message: SERVER-69826 convert WiredTiger Python rollback test to db/storage/wiredtiger C++ test

This is the C++ version of the python test test_rollback_to_stable40.py
modified to use mongo/unittest assertions.

Co-authored-by: Etienne Petrel <etienne.petrel@mongodb.com>
Branch: master
https://github.com/mongodb/mongo/commit/02932c9f9ccef9f27a9975197e8cccf52879c463

Comment by Benety Goh [ 13/Oct/22 ]

We will lock in the changes in the ticket and continue working at a higher level in SERVER-70539.

Comment by Etienne Petrel [ 04/Oct/22 ]

I am attaching the C++ reproducer (reproducer.cpp).

To reproduce the failure, apply the following patch:

diff --git a/src/mongo/db/storage/wiredtiger/SConscript b/src/mongo/db/storage/wiredtiger/SConscript
index 9d9f5ca18f4..b7f266d2762 100644
--- a/src/mongo/db/storage/wiredtiger/SConscript
+++ b/src/mongo/db/storage/wiredtiger/SConscript
@@ -242,3 +242,14 @@ wtEnv.Benchmark(
         'storage_wiredtiger_core',
     ],
 )
+
+wtEnv.CppUnitTest(
+    target='storage_wiredtiger_rollback_to_stable40_test',
+    source=[
+        'wiredtiger_rollback_to_stable40_test.cpp',
+    ],
+    LIBDEPS=[
+        # 'storage_wiredtiger_core',
+        '$BUILD_DIR/third_party/shim_wiredtiger',
+    ],
+)

Then check out a commit that does not have WT-9334 nor WT-9870, the following commit ID on v6.0 is a good candidate:

git reset --hard 52940805f01b2599ed6ed3221094716766e347ac

Compile MongoDB and execute the test:

# Your favourite compilation commands or... this one:./buildscripts/scons.py --variables-files=etc/scons/mongodbtoolchain_stable_clang.vars --link-model=dynamic --ninja ICECC=icecc CCACHE=ccache# Build all of core plus all the unittest binaries.ninja install-all# Execute the test
build/install/bin/storage_wiredtiger_rollback_to_stable40_test

You should observe the following log indicating the failure:

{"t":{"$date":"2022-10-04T03:20:44.203Z"},"s":"F",  "c":"ASSERT",   "id":23079,   "ctx":"main","msg":"Invariant failure","attr":{"expr":"ret == 0","file":"src/mongo/db/storage/wiredtiger/wiredtiger_rollback_to_stable40_test.cpp","line":369}}
{"t":{"$date":"2022-10-04T03:20:44.203Z"},"s":"F",  "c":"ASSERT",   "id":23080,   "ctx":"main","msg":"\n\n***aborting after invariant() failure\n\n"}
{"t":{"$date":"2022-10-04T03:20:44.203Z"},"s":"F",  "c":"CONTROL",  "id":6384300, "ctx":"main","msg":"Writing fatal message","attr":{"message":"Got signal: 6 (Aborted).\n"}}

Indeed, after the restart, the record is not found. On the latest commit of the v6.0 branch c172ccd37516f3c2118f349817cdb1841a2486b9, the issue does not reproduce as expected.

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