[Enhancement] Do checkpoint on follower node to relieve memory pressure on leader
Why I'm doing:
What I'm doing:
The current Leader has a Checkpoint daemon thread that continuously checks for new journal dbs. If a new journal db is detected, the following steps are performed:
- Create a new GlobalStateMgr and load the local image into the new GlobalStateMgr.
- Replay the journal in the new GlobalStateMgr.
- Call saveImage to write the metadata in the GlobalStateMgr to disk. At this time, a new image will be generated.
- Push the newly generated image to other FE nodes.
- Delete the journal that has been replayed in step 2 from the bdb.
The main differences of the optimized process are as follows:
- The Leader node is changed from the previous Checkpoint daemon to the CheckpointController daemon, which is responsible for controlling the entire checkpoint process. The check of the new journal db and steps 4 and 5 in the current process need to be completed in the CheckpointController daemon.
- A new CheckpointWorker daemon is added to the Follower node, which is responsible for executing the checkpoint tasks sent by the leader, that is, 1, 2, and 3 in the current process.
What type of PR is this:
- [ ] BugFix
- [ ] Feature
- [x] Enhancement
- [ ] Refactor
- [ ] UT
- [ ] Doc
- [ ] Tool
Does this PR entail a change in behavior?
- [ ] Yes, this PR will result in a change in behavior.
- [x] No, this PR will not result in a change in behavior.
If yes, please specify the type of change:
- [ ] Interface/UI changes: syntax, type conversion, expression evaluation, display information
- [ ] Parameter changes: default values, similar parameters but with different default values
- [ ] Policy changes: use new policy to replace old one, functionality automatically enabled
- [ ] Feature removed
- [ ] Miscellaneous: upgrade & downgrade compatibility, etc.
Checklist:
- [ ] I have added test cases for my bug fix or my new feature
- [ ] This pr needs user documentation (for new or modified features or behaviors)
- [ ] I have added documentation for my new feature or new function
- [ ] This is a backport pr
Bugfix cherry-pick branch check:
- [x] I have checked the version labels which the pr will be auto-backported to the target branch
- [ ] 3.3
- [ ] 3.2
- [ ] 3.1
- [ ] 3.0
- [ ] 2.5
@mergifyio rebase
rebase
✅ Branch has been successfully rebased
Quality Gate failed
Failed conditions
C Reliability Rating on New Code (required ≥ A)
See analysis details on SonarQube Cloud
Catch issues before they fail your Quality Gate with our IDE extension
SonarQube for IDE
[Java-Extensions Incremental Coverage Report]
:white_check_mark: pass : 0 / 0 (0%)
[FE Incremental Coverage Report]
:x: fail : 250 / 499 (50.10%)
file detail
| path | covered_line | new_line | coverage | not_covered_line_detail | |
|---|---|---|---|---|---|
| :large_blue_circle: | com/starrocks/journal/CheckpointException.java | 0 | 2 | 00.00% | [19, 20] |
| :large_blue_circle: | com/starrocks/service/FrontendServiceImpl.java | 0 | 31 | 00.00% | [2960, 2961, 2963, 2966, 2968, 2969, 2970, 2971, 2972, 2973, 2974, 2975, 2976, 2982, 2983, 2984, 2985, 2986, 2987, 2991, 2992, 2994, 2998, 2999, 3000, 3001, 3002, 3003, 3004, 3005, 3006] |
| :large_blue_circle: | com/starrocks/leader/MetaHelper.java | 0 | 12 | 00.00% | [138, 148, 149, 152, 153, 154, 156, 157, 158, 161, 162, 165] |
| :large_blue_circle: | com/starrocks/http/meta/MetaService.java | 0 | 1 | 00.00% | [286] |
| :large_blue_circle: | com/starrocks/journal/StarMgrCheckpointWorker.java | 2 | 9 | 22.22% | [27, 28, 30, 33, 35, 39, 44] |
| :large_blue_circle: | com/starrocks/leader/CheckpointController.java | 81 | 214 | 37.85% | [124, 125, 126, 140, 141, 143, 150, 159, 172, 173, 180, 181, 187, 188, 191, 192, 198, 199, 200, 213, 214, 215, 216, 218, 220, 222, 223, 225, 228, 229, 230, 231, 232, 234, 235, 239, 242, 243, 244, 246, 247, 248, 253, 258, 259, 260, 261, 263, 280, 282, 293, 294, 295, 300, 301, 302, 303, 304, 306, 308, 309, 310, 311, 312, 313, 315, 316, 317, 319, 321, 322, 323, 332, 348, 349, 350, 351, 352, 354, 355, 356, 357, 360, 361, 362, 367, 369, 371, 372, 373, 375, 376, 377, 378, 379, 380, 381, 382, 384, 386, 387, 388, 391, 392, 394, 395, 397, 400, 402, 408, 409, 411, 419, 420, 421, 422, 423, 424, 425, 426, 428, 429, 430, 431, 434, 435, 438, 445, 449, 450, 456, 462, 463] |
| :large_blue_circle: | com/starrocks/system/FrontendHbResponse.java | 2 | 4 | 50.00% | [122, 123] |
| :large_blue_circle: | com/starrocks/staros/StarMgrServer.java | 14 | 26 | 53.85% | [88, 235, 236, 248, 249, 250, 251, 264, 267, 268, 288, 292] |
| :large_blue_circle: | com/starrocks/journal/CheckpointWorker.java | 51 | 89 | 57.30% | [61, 64, 65, 68, 69, 87, 101, 102, 103, 104, 121, 122, 129, 130, 139, 140, 143, 146, 147, 148, 149, 150, 151, 154, 156, 158, 159, 160, 161, 162, 163, 165, 167, 168, 169, 177, 178, 179] |
| :large_blue_circle: | com/starrocks/http/rest/BootstrapFinishAction.java | 7 | 11 | 63.64% | [94, 99, 179, 180] |
| :large_blue_circle: | com/starrocks/monitor/jvm/JvmStats.java | 3 | 4 | 75.00% | [137] |
| :large_blue_circle: | com/starrocks/server/NodeMgr.java | 6 | 7 | 85.71% | [869] |
| :large_blue_circle: | com/starrocks/system/Frontend.java | 27 | 31 | 87.10% | [202, 203, 224, 246] |
| :large_blue_circle: | com/starrocks/journal/GlobalStateCheckpointWorker.java | 25 | 26 | 96.15% | [71] |
| :large_blue_circle: | com/starrocks/common/Config.java | 2 | 2 | 100.00% | [] |
| :large_blue_circle: | com/starrocks/http/rest/RestBaseResult.java | 1 | 1 | 100.00% | [] |
| :large_blue_circle: | com/starrocks/server/GlobalStateMgr.java | 16 | 16 | 100.00% | [] |
| :large_blue_circle: | com/starrocks/ha/BDBHA.java | 2 | 2 | 100.00% | [] |
| :large_blue_circle: | com/starrocks/system/HeartbeatMgr.java | 9 | 9 | 100.00% | [] |
| :large_blue_circle: | com/starrocks/persist/MetaCleaner.java | 1 | 1 | 100.00% | [] |
| :large_blue_circle: | com/starrocks/journal/JournalEntity.java | 1 | 1 | 100.00% | [] |
[BE Incremental Coverage Report]
:white_check_mark: pass : 0 / 0 (0%)