[SERVER-64517] RecoverableCriticalSection is not properly recovered on startup Created: 15/Mar/22  Updated: 29/Oct/23  Resolved: 16/Mar/22

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: 5.0.0
Fix Version/s: 6.0.0-rc0, 5.0.7, 5.3.0-rc4, 5.2.2

Type: Bug Priority: Critical - P2
Reporter: Jordi Serra Torrens Assignee: Jordi Serra Torrens
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Depends
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v5.3, v5.2, v5.0
Sprint: Sharding EMEA 2022-03-21
Participants:

 Description   

RecoverableCriticalSectionService intends to keep an in-memory state whose state mirrors the critical sections that are durably persisted on a collection. Currently, on startup, we initialize this in-memory state by hooking into ReplicaSetAwareService's onStartup method and then reading from the collection. On steady state replication an opObserver keeps it in sync.

However, ReplicaSetAwareService::onStartup is not the correct place to do such initialization, because by the time it gets called initialSync and startupRecovery have not run yet. This can cause a freshly started up shard to miss an in-memory critical section.

To address it, we should follow the same approach taken by 'recoverTenantMigrationAccessBlockers': It recovers its state (1) after initialSync, (2) after startup recovery, (3) after a rollback



 Comments   
Comment by Githook User [ 18/Mar/22 ]

Author:

{'name': 'Jordi Serra Torrens', 'email': 'jordi.serra-torrens@mongodb.com', 'username': 'jordist'}

Message: SERVER-64517 Recover RecoverableCriticalSection after initialSync and startupRecovery have completed

(cherry picked from commit ce0bbc5ec1728e443c5ff893a78693b24570b80d)
(cherry picked from commit 681216ac79a5768e8660c96ad9e5833abc6659d1)
Branch: v5.2
https://github.com/mongodb/mongo/commit/d1429304cc3c6c42ea7e2c581487b7f528fb4b76

Comment by Githook User [ 18/Mar/22 ]

Author:

{'name': 'Jordi Serra Torrens', 'email': 'jordi.serra-torrens@mongodb.com', 'username': 'jordist'}

Message: SERVER-64517 Recover RecoverableCriticalSection after initialSync and startupRecovery have completed

(cherry picked from commit ce0bbc5ec1728e443c5ff893a78693b24570b80d)
Branch: v5.0
https://github.com/mongodb/mongo/commit/a30b567ecb69c80a1b69ebe6897dc3ab3905f25f

Comment by Githook User [ 17/Mar/22 ]

Author:

{'name': 'Jordi Serra Torrens', 'email': 'jordi.serra-torrens@mongodb.com', 'username': 'jordist'}

Message: SERVER-64517 Recover RecoverableCriticalSection after initialSync and startupRecovery have completed

(cherry picked from commit ce0bbc5ec1728e443c5ff893a78693b24570b80d)
Branch: v5.3
https://github.com/mongodb/mongo/commit/681216ac79a5768e8660c96ad9e5833abc6659d1

Comment by Githook User [ 16/Mar/22 ]

Author:

{'name': 'Jordi Serra Torrens', 'email': 'jordi.serra-torrens@mongodb.com', 'username': 'jordist'}

Message: SERVER-64517 Recover RecoverableCriticalSection after initialSync and startupRecovery have completed
Branch: master
https://github.com/mongodb/mongo/commit/ce0bbc5ec1728e443c5ff893a78693b24570b80d

Generated at Thu Feb 08 06:00:31 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.