Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Enhancement] Do checkpoint on follower node to relieve memory pressure on leader #52103

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

gengjun-git
Copy link
Contributor

@gengjun-git gengjun-git commented Oct 18, 2024

Why I'm doing:

What I'm doing:

whiteboard_exported_image (1)

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:

  1. Create a new GlobalStateMgr and load the local image into the new GlobalStateMgr.
  2. Replay the journal in the new GlobalStateMgr.
  3. Call saveImage to write the metadata in the GlobalStateMgr to disk. At this time, a new image will be generated.
  4. Push the newly generated image to other FE nodes.
  5. Delete the journal that has been replayed in step 2 from the bdb.

The main differences of the optimized process are as follows:

  1. 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.
  2. 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
  • Enhancement
  • Refactor
  • UT
  • Doc
  • Tool

Does this PR entail a change in behavior?

  • Yes, this PR will result in a change in behavior.
  • 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:

  • 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

Signed-off-by: gengjun-git <[email protected]>
Signed-off-by: gengjun-git <[email protected]>
Copy link

[FE Incremental Coverage Report]

fail : 40 / 86 (46.51%)

file detail

path covered_line new_line coverage not_covered_line_detail
🔵 com/starrocks/http/rest/ShowMetaInfoAction.java 0 1 00.00% [133]
🔵 com/starrocks/monitor/jvm/JvmStats.java 0 1 00.00% [142]
🔵 com/starrocks/http/meta/MetaService.java 0 1 00.00% [286]
🔵 com/starrocks/http/rest/BootstrapFinishAction.java 0 9 00.00% [94, 113, 115, 119, 123, 124, 176, 180, 181]
🔵 com/starrocks/server/GlobalStateMgr.java 1 9 11.11% [1412, 1414, 1415, 2180, 2181, 2184, 2185, 2187]
🔵 com/starrocks/ha/LeaderInfo.java 2 6 33.33% [37, 50, 77, 78]
🔵 com/starrocks/server/NodeMgr.java 1 3 33.33% [864, 865]
🔵 com/starrocks/system/Frontend.java 9 21 42.86% [193, 194, 195, 196, 197, 200, 201, 202, 203, 204, 208, 209]
🔵 com/starrocks/leader/MetaHelper.java 6 10 60.00% [154, 155, 162, 163]
🔵 com/starrocks/staros/StarMgrServer.java 8 12 66.67% [87, 88, 197, 224]
🔵 com/starrocks/common/Config.java 1 1 100.00% []
🔵 com/starrocks/system/FrontendHbResponse.java 2 2 100.00% []
🔵 com/starrocks/system/HeartbeatMgr.java 10 10 100.00% []

@gengjun-git gengjun-git marked this pull request as ready for review October 18, 2024 10:00
@gengjun-git gengjun-git requested review from a team as code owners October 18, 2024 10:00
Signed-off-by: gengjun-git <[email protected]>
Copy link

sonarcloud bot commented Oct 18, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarCloud

Catch issues before they fail your Quality Gate with our IDE extension SonarLint

Copy link

[Java-Extensions Incremental Coverage Report]

pass : 0 / 0 (0%)

Copy link

[BE Incremental Coverage Report]

pass : 0 / 0 (0%)

@@ -582,6 +582,9 @@ public class Config extends ConfigBase {
@ConfField
public static long bdbje_reserved_disk_size = 512L * 1024 * 1024;

@ConfField
public static long checkpoint_timeout_s = 24 * 3600;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public static long checkpoint_timeout_s = 24 * 3600;
public static long checkpoint_timeout_seconds = 24 * 3600;

@@ -1847,6 +1847,28 @@ struct TGetKeysResponse {
1: optional list<binary> key_metas;
}

struct TDoCheckpointRequest {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

name it as TStartCheckpointRequest?

@@ -179,12 +176,6 @@ protected void runAfterCatalogReady() {
}
} // end for all results

// we also add a 'mocked' master Frontend heartbeat response to synchronize master info to other Frontends.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why removed?

@@ -178,56 +187,6 @@ public Classes getClasses() {
return classes;
}

static final class Fields {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like a non-related code clean-up, can submit a separate PR to remove these lines through a fast-track code review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants