[SERVER-21480] Race condition in ttl1.js Created: 03/Nov/15  Updated: 01/Mar/17  Resolved: 23/Nov/15

Status: Closed
Project: Core Server
Component/s: Storage
Affects Version/s: None
Fix Version/s: 3.0.15, 3.2.0-rc4

Type: Bug Priority: Major - P3
Reporter: Geert Bosch Assignee: Geert Bosch
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Related
related to SERVER-28154 Race condition in ttl_sharded.js Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v3.0
Steps To Reproduce:

Apply the following patch and run the jstests/noPassthroughWithMongod/ttl1.js test:

diff --git a/src/mongo/db/exec/delete.cpp b/src/mongo/db/exec/delete.cpp
index dfb9c9b..7cdb514 100644
--- a/src/mongo/db/exec/delete.cpp
+++ b/src/mongo/db/exec/delete.cpp
@@ -212,6 +212,7 @@ PlanStage::StageState DeleteStage::work(WorkingSetID* out) {
         if (!_params.isExplain) {
             WriteUnitOfWork wunit(getOpCtx());
             _collection->deleteDocument(getOpCtx(), rloc);
+            sleepmillis(50);
             wunit.commit();
         }
 

Sprint: QuInt C (11/23/15)
Participants:

 Description   

The test waits until the TTL monitor starts deleting documents, and then right away checks that all documents have been deleted. Usually it will, because deleting a handful of documents takes so little time. Additionally, on MMAPv1 the exclusive lock will typically avoid access before the TTL thread completes. However a race exists. After talking with Kamran, the best solution seems to add another assert.soon.

https://evergreen.mongodb.com/task/mongodb_mongo_master_windows_64_2k8_noPassthroughWithMongod_WT_8a3acb42742182c5e314636041c2df368232bbc5_15_11_03_15_56_46



 Comments   
Comment by Githook User [ 26/Jan/17 ]

Author:

{u'username': u'GeertBosch', u'name': u'Geert Bosch', u'email': u'geert@mongodb.com'}

Message: SERVER-21480: remove race condition in ttl1.js

(cherry picked from commit 56943a545ab503b11b747bb40779ab01be58766b)
Branch: v3.0
https://github.com/mongodb/mongo/commit/36d0d2daf79b3b62852ae795e104a74f93e8a9b7

Comment by Githook User [ 23/Nov/15 ]

Author:

{u'username': u'GeertBosch', u'name': u'Geert Bosch', u'email': u'geert@mongodb.com'}

Message: SERVER-21480: remove race condition in ttl1.js
Branch: master
https://github.com/mongodb/mongo/commit/56943a545ab503b11b747bb40779ab01be58766b

Generated at Thu Feb 08 03:57:29 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.