[SERVER-47699] Change yield type used by range deleter from YIELD_MANUAL to YIELD_AUTO Created: 22/Apr/20  Updated: 29/Oct/23  Resolved: 27/Apr/21

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: None
Fix Version/s: 4.0.25, 4.2.15, 4.4.7, 5.0.0-rc0

Type: Improvement Priority: Major - P3
Reporter: Eric Sommer Assignee: Antonio Fuschetto
Resolution: Fixed Votes: 0
Labels: sharding-wfbf-day
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Depends
Related
is related to SERVER-53180 Log each operation that holds a lock ... Closed
Backwards Compatibility: Fully Compatible
Backport Requested:
v4.4, v4.2, v4.0
Sprint: Sharding 2021-04-05, Sharding EMEA 2021-05-03
Participants:
Case:
Linked BF Score: 154

 Description   

Currently, when deleting batches of documents (default 128) the range deleter only yields manually. This is different behavior than regular bulk deletes, which yield on time as well.

The range deleter should also yield on time, making it functionally equivalent to regular bulk deletes. Failing to do so could result in locks being held and blocking other operations longer than anticipated in a case where range deletion was unexpectedly slow (due to an i/o bottleneck, for example).



 Comments   
Comment by Githook User [ 11/May/21 ]

Author:

{'name': 'Antonio Fuschetto', 'email': 'antonio.fuschetto@mongodb.com', 'username': 'afuschetto'}

Message: SERVER-47699 Change yield type used by range deleter from YIELD_MANUAL to YIELD_AUTO
Branch: v4.4
https://github.com/mongodb/mongo/commit/540caebed8d24ef156f0222169e8328dcc9d5782

Comment by Githook User [ 05/May/21 ]

Author:

{'name': 'Antonio Fuschetto', 'email': 'antonio.fuschetto@mongodb.com', 'username': 'afuschetto'}

Message: SERVER-47699 Change yield type used by range deleter from YIELD_MANUAL to YIELD_AUTO
Branch: v4.2
https://github.com/mongodb/mongo/commit/8d734fcc69f110c062b94585a2c665206c2b3bbe

Comment by Githook User [ 05/May/21 ]

Author:

{'name': 'Antonio Fuschetto', 'email': 'antonio.fuschetto@mongodb.com', 'username': 'afuschetto'}

Message: SERVER-47699 Change yield type used by range deleter from YIELD_MANUAL to YIELD_AUTO
Branch: v4.0
https://github.com/mongodb/mongo/commit/778dcc77d9a5c3f2e8463c5b8f9ceafeeeb302b8

Comment by Kaloian Manassiev [ 29/Apr/21 ]

Approving backport down to versions 4.4 and 4.2 until we evaluate whether the same correctness reasoning applies for 4.0 as well (the range deleter changed in 4.2 and 4.4).

Comment by Githook User [ 27/Apr/21 ]

Author:

{'name': 'Antonio Fuschetto', 'email': 'antonio.fuschetto@mongodb.com', 'username': 'afuschetto'}

Message: SERVER-47699 Change yield type used by range deleter from YIELD_MANUAL to YIELD_AUTO
Branch: master
https://github.com/mongodb/mongo/commit/748b99b1fbbda8e332b6a54867a23361fb59dc67

Comment by Andy Schwerin [ 26/Apr/21 ]

Requesting consideration for backport to 4.4, 4.2 and 4.0, in case kaloian.manassiev was right that it should be safe to all those branches.

Comment by Githook User [ 23/Apr/21 ]

Author:

{'name': 'Antonio Fuschetto', 'email': 'antonio.fuschetto@mongodb.com', 'username': 'afuschetto'}

Message: SERVER-47699 Change yield type used by range deleter from YIELD_MANUAL to YIELD_AUTO
Branch: master
https://github.com/mongodb/mongo/commit/78fbc00b1b5fbb83f91d634c33f56d53231c13df

Comment by Kaloian Manassiev [ 23/Mar/21 ]

After discussion with schwerin, I believe that this work can actually be simpler that I thought, so I am bringing the ticket up to 'Needs Triage' on the EMEA backlog to be done on WFBF day.

Tl;dr:
Since we already have the tracking of the pending deletions and only the range deleter removes entries from there, we should be able to add the yielding, because that document is dropped at the end of the range deletion loop.

Because of this it is not possible for a chunk to be moved inside the range during yield. So in other words, we can actually just enable auto yielding in 4.4 and master and it will just work.

For 4.2 and 4.0, the range deleter does similar check against the in-memory metadata and so does chunk receive, so we should be able to backport that change there as well.

For both releases, the only thing that's a bit unclear to me is what happens if a drop happens during the yield. I imagine that the plan executor will get killed and that would cause the loop to retry and discover the drop, but whoever picks-up this work should confirm that.

Comment by Andrew Shuvalov (Inactive) [ 25/Feb/21 ]

I wonder if SERVER-53180 could not just log when the lock is held for too long, but collect the statistics on what % of time the lock was held for the last period of time, separately for high priority CRUD operations and low priority bulk operations? The next bulk batch should be delayed once the stat shows the allowance is exceeded.

As was explained in comment in the version 4.2 the range deletion was naively prorated by blocking operations. Making it more asynchronous in 4.4 created a problem. Doing this in async way is still correct, but the rate limiter should prevent the next batch, especially a batch from unrelated range delete, to start too early.

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