[SERVER-51330] StorageTimestampTests depends on oplog batch writer thread scheduling Created: 02/Oct/20  Updated: 29/Oct/23  Resolved: 05/Oct/20

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 4.9.0, 4.4.5

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

Issue Links:
Backports
Depends
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v4.4
Sprint: Execution Team 2020-10-19
Participants:
Linked BF Score: 16

 Description   

The SecondarySetWildcardIndexMultikeyOnInsert test case tries to "coerce" the oplog batch writer into interleaving operations in a certain way:

// Coerce oplog application to apply op2 before op1.
        std::vector<repl::OplogEntry> ops = {op0, op2, op1};

Unfortunately, the batch applier splits up operations across many threads based on a hash of _id and a runtime-randomized seed, so this coercion is fruitless. If op1 and op2 end up in the same batch, they will be inserted in the same transaction, which will return this error from WiredTiger: "commit timestamp <op1> older than the first commit timestamp <op2>", and trigger this fatal assertion in MongoDB.

This test needs to be rewritten so that it does not batch out-of-order operations together or depend on thread synchronization.

Bonus! Because of the way the hash seed is randomized to split up operations to 16 different threads, the probability of this test putting op2 and op1 in the same batch is 1/16. So theoretically this test will fail 6.25% of the time it is run.



 Comments   
Comment by Githook User [ 18/Mar/21 ]

Author:

{'name': 'Louis Williams', 'email': 'louis.williams@mongodb.com', 'username': 'louiswilliams'}

Message: SERVER-51330 SecondarySetWildcardIndexMultikeyOnInsert should prevent insert operations from being grouped together in the same WriteUnitOfWork

(cherry picked from commit a589011c8a802cad912d33b125bc9028fd23acad)
Branch: v4.4
https://github.com/mongodb/mongo/commit/927b3a649c421bac2f58f617702c138a13dff85c

Comment by Githook User [ 05/Oct/20 ]

Author:

{'name': 'Louis Williams', 'email': 'louis.williams@mongodb.com', 'username': 'louiswilliams'}

Message: SERVER-51330 SecondarySetWildcardIndexMultikeyOnInsert should prevent insert operations from being grouped together in the same WriteUnitOfWork
Branch: master
https://github.com/mongodb/mongo/commit/a589011c8a802cad912d33b125bc9028fd23acad

Comment by Louis Williams [ 02/Oct/20 ]

daniel.gottlieb suggested modifying the test to use updates instead of inserts. This would guarantee that the writes are not batched together in the same WUOW.

Additionally, "The test was designed to allow for false negatives (didn't catch the bug when it should have) but not false positives"

Generated at Thu Feb 08 05:25:10 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.