[SERVER-25062] Implement interruptible sleep and condition variable waitFor methods on OperationContext Created: 14/Jul/16  Updated: 08/Oct/18  Resolved: 15/Mar/17

Status: Closed
Project: Core Server
Component/s: Internal Code
Affects Version/s: None
Fix Version/s: 3.5.5

Type: Improvement Priority: Major - P3
Reporter: Andy Schwerin Assignee: Andy Schwerin
Resolution: Done Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
backported by SERVER-37367 Notification::waitFor is not interrup... Closed
Depends
Related
related to SERVER-21004 Implement wait objects that support o... Closed
Backwards Compatibility: Fully Compatible
Participants:
Linked BF Score: 0

 Description   

SERVER-21004 introduced interruptible condition variable wait functions using OperationContext. This task is to also implement interruptible unconditional sleep methods and to round out the set of interruptible condition variable waits available, to more closely match those available on std::condition_variable.

To be implemented, at least:

OperationContext::sleepUntil()
OperationContext::sleepFor()
Various forms of OperationContext::waitForConditionOrInterruptFor.



 Comments   
Comment by Githook User [ 15/Mar/17 ]

Author:

{u'name': u'Andy Schwerin', u'email': u'Andy Schwerin schwerin@mongodb.com'}

Message: SERVER-25062 Fix MetadataManagerTest.NotificationBlocksUntilDeletion.

Its prior implementation kept a pointer to a dead OperationContext. Before prior
work on this ticket, the pointer was never dereferenced, so no errors surfaced.
Only debug builds surfaced this error, because only they overwrite freed memory.
Branch: master
https://github.com/mongodb/mongo/commit/9911c1a17c7ea34be64b3869867dc26c4b0942d6

Comment by Andy Schwerin [ 15/Mar/17 ]

Broken test on Windows. Reopening.

Comment by Githook User [ 15/Mar/17 ]

Author:

{u'name': u'Andy Schwerin', u'email': u'Andy Schwerin schwerin@mongodb.com'}

Message: SERVER-25062 Remove racy, redundant SleepForExpires test from operation_context_test.

Since OperationContext::sleepFor is a thin wrapper around the predicate form of
OperationContext::waitForConditionOrInterrupt, the SleepForExpires test duplicates
coverage from the SleepUntilExpires and ForExpiresWhileWaiting tests. It is also
racy, because it must sleep on a different condition variable from the one supplied
in the WaitTestState.
Branch: master
https://github.com/mongodb/mongo/commit/b9827dcc65c15eae2b863b9a0a60a9864ba3f98b

Comment by Githook User [ 15/Mar/17 ]

Author:

{u'name': u'Andy Schwerin', u'email': u'Andy Schwerin schwerin@mongodb.com'}

Message: SERVER-25062 Fix return types of predicated waits and notification waitFor.

This patch makes the return types of predicated waits on condition variables
and Notification::waitFor look more like the corresponding functions in C++
standard types.
Branch: master
https://github.com/mongodb/mongo/commit/1515d4e4e2613e79b2c1761b7505cfaa9c31f0a9

Comment by Andy Schwerin [ 09/Mar/17 ]

Forgot about a minor return type mistake in my implementations; will fix before re-resolving.

Comment by Githook User [ 09/Mar/17 ]

Author:

{u'name': u'Andy Schwerin', u'email': u'Andy Schwerin schwerin@mongodb.com'}

Message: SERVER-25062 Implement interruptible sleep and waitFor methods on OperationContext.
Branch: master
https://github.com/mongodb/mongo/commit/9352a9eb96a350b9fedeb2ff2984ef40fe80c894

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