-
Type:
Task
-
Resolution: Won't Fix
-
Priority:
Minor - P4
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Server Programmability
-
None
-
3
-
None
-
None
-
None
-
None
-
None
-
None
Description
We were considering adding a functionality in failCommand that would wait until a certain amount of threads have reached failCommand, wait for each other and start at executing at the same time.
This is useful to test queues and also test cases that only happen when a large amount of threads are executing at once.
Design
Here's the interface we were considering:
db.adminCommand({ configureFailPoint: "failCommand", mode: "alwaysOn", data: { blockUntilBarrier: true, barrierSize: 10, } });
In this instance, the fail command would make all threads waiting until there's 10 commands waiting at the failCommand fail point.
Alternatives Considered
We also considered pauseWhileSet, but it uses a spin wait. For our current use case, this wouldn't work as the threads won't wake up as fast as possible when we unset the fail point as it introduce jitter. We would need a similar machinery but implemented using condition variables so that all threads are notified at once.