[SERVER-54509] TenantOplogBatcher should transition to complete when it fails to schedule the next batch and is shutting down Created: 12/Feb/21  Updated: 29/Oct/23  Resolved: 12/Feb/21

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

Type: Bug Priority: Major - P3
Reporter: Lingzhi Deng Assignee: Lingzhi Deng
Resolution: Fixed Votes: 0
Labels: pm-1791_non-cloud-blocking, pm-1791_other_required
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Related
is related to SERVER-58142 TenantOplogBatcher should transition ... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Repl 2021-02-22
Participants:
Linked BF Score: 0

 Description   

In TenantOplogApplierTest, when the destructor of the TenantOplogBatcher runs, it will join the underlying TenantOplogBatcher in the TenantOplogApplier. The TenantOplogBatcher _scheduleNextBatch with self = shared_from_this() and so the TenantOplogBatcher destruction may run after the test tearDown() where we also shut down the _executor. Therefore, this job could fail to schedule because the executor has been shut down. When shutting down a TenantOplogBatcher, we assume that "if _batchRequested was true, we handle the _transitionToComplete when it becomes false". We do so when the next batch is scheduled successfully, but we break that assumption if we fail to schedule the next batch. So I think we should also call _transitionToComplete if the TenantOplogBatcher is shutting down on job schedule failures.

I believe this can happen in production code as well because on recipient, the TenantOplogBatcher could also schedule jobs after the TenantMigrationRecipientService's _scopedExecutor has been shut down (e.g. on stepDown). So we would still like to transition the TenantOplogBatcher to complete on job schedule failures if the TenantOplogBatcher is shutting down.



 Comments   
Comment by Githook User [ 12/Feb/21 ]

Author:

{'name': 'Lingzhi Deng', 'email': 'lingzhi.deng@mongodb.com', 'username': 'ldennis'}

Message: SERVER-54509: TenantOplogBatcher should transition to complete when it fails to schedule the next batch and is shutting down
Branch: master
https://github.com/mongodb/mongo/commit/28ff000bbd83e9856e4b470554a98c36eabf4ce9

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