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

[Feature] Support Cluster Snapshot Backup: checkpoint and image backup (part3) #54695

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

srlch
Copy link
Contributor

@srlch srlch commented Jan 4, 2025

What I'm doing:

This is part3 for supporting cluster snapshot backport for share data mode.

In this pr, we introduce a new checkpoint controller to finish the image backup:

  1. Introduce ClusterSnapshotCheckpointController to control the creation of the imgae
    for FE and StarMgr in the same thread with consistent journal ids between two image.
  2. ClusterSnapshotCheckpointController should be exclusive with the normal checkpoint.
    This controller will responsible for create image in leader node and upload it into remote storage.

Fixes #53867
#53867

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.4
    • 3.3
    • 3.2
    • 3.1
    • 3.0

@srlch srlch requested review from a team as code owners January 4, 2025 08:45
@wanpengfei-git wanpengfei-git requested a review from a team January 4, 2025 08:46
@mergify mergify bot assigned srlch Jan 4, 2025
@srlch srlch changed the title [WIP] Support Cluster Snapshot Backup: checkpoint and image backup (part3) [Feature] Support Cluster Snapshot Backup: checkpoint and image backup (part3) Jan 5, 2025
@srlch srlch force-pushed the cluster_snapshot_part_3_new branch from 4d88ab3 to d723b6f Compare January 5, 2025 08:41
@srlch srlch requested a review from a team as a code owner January 5, 2025 08:41
@srlch srlch force-pushed the cluster_snapshot_part_3_new branch 2 times, most recently from 7ea70c7 to 5547bbd Compare January 6, 2025 06:30
@gengjun-git gengjun-git self-assigned this Jan 6, 2025
File srcFile = new File(srcPath);
FileUtil.copy(srcFile, fileSystem.getDFSFileSystem(), new Path(destPathUri.getPath()), false, new Configuration());
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It seems that copyFromLocalFile will failed if the src is not a file

Comment on lines 1226 to 1230
LOG.error("Interrupted while copy from local {} to {} ", srcPath, destPath + " " + e.getMessage());
throw new StarRocksException("Failed to copy " + destPath + " from local " + srcPath + " " + e.getMessage());
} catch (Exception e) {
LOG.error("Exception while copy from local {} to {} ", srcPath, destPath + " " + e.getMessage());
throw new StarRocksException("Failed to copy " + destPath + " from local " + srcPath + " " + e.getMessage());
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
LOG.error("Interrupted while copy from local {} to {} ", srcPath, destPath + " " + e.getMessage());
throw new StarRocksException("Failed to copy " + destPath + " from local " + srcPath + " " + e.getMessage());
} catch (Exception e) {
LOG.error("Exception while copy from local {} to {} ", srcPath, destPath + " " + e.getMessage());
throw new StarRocksException("Failed to copy " + destPath + " from local " + srcPath + " " + e.getMessage());
LOG.error("Interrupted while copy local {} to {} ", srcPath, destPath, e);
throw new StarRocksException("Failed to copy local " + srcPath + " to " + destPath, e);
} catch (Exception e) {
LOG.error("Exception while copy local {} to {} ", srcPath, destPath, e);
throw new StarRocksException("Failed to copy local " + srcPath + " to " + destPath, e);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated

@@ -59,6 +59,11 @@ public void copyToLocal(String srcPath, String destPath, Map<String, String> pro
LOG.info("Copied {} to local {}", srcPath, destPath);
}

public void copyFromLocal(String srcPath, String destPath, Map<String, String> properties) throws StarRocksException {
fileSystemManager.copyFromLocal(srcPath, destPath, properties);
LOG.info("Copied {} from local {}", destPath, srcPath);
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
LOG.info("Copied {} from local {}", destPath, srcPath);
LOG.info("Copied local {} to {}", srcPath, destPath);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated

Comment on lines 137 to 140
CheckpointController controller = getCheckpointController();
if (CheckpointController.clusterSnapshotCheckpointRunning()) {
controller = GlobalStateMgr.getServingState().getClusterSnapshotCheckpointController();
} else {
controller = getCheckpointController();
}
Copy link
Contributor

Choose a reason for hiding this comment

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

line 137 and 141 are duplicated ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated

Comment on lines 34 to 37
@SerializedName(value = "createTime")
private long createTime;
@SerializedName(value = "successTime")
private long successTime;
Copy link
Contributor

Choose a reason for hiding this comment

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

make the veriable name same to the corresponding colume name in system table ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated

Comment on lines 48 to 51
@SerializedName(value = "createTime")
private long createTime;
@SerializedName(value = "successTime")
private long successTime;
Copy link
Contributor

Choose a reason for hiding this comment

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

same to the above

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated

Copy link

sonarqubecloud bot commented Jan 6, 2025

Quality Gate Failed 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

changeRunningState(false);
}

private boolean selfIsRunning() {
Copy link
Contributor

@gengjun-git gengjun-git Jan 7, 2025

Choose a reason for hiding this comment

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

How about put the waiting code into subClass?

                    BaseController
                   /                         \
                  /                            \
      NormalController        SnapshotController

The logic will be more clear.
Self and peer is a little obscure. And it is not reasonable to let the base class perceive the subclass

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated, refactor code and introduce exclusive flag for checkpoint controller in base class

@srlch srlch force-pushed the cluster_snapshot_part_3_new branch from 9d7db2f to 049527d Compare January 7, 2025 08:18
Copy link

github-actions bot commented Jan 7, 2025

[Java-Extensions Incremental Coverage Report]

pass : 0 / 0 (0%)

Copy link

github-actions bot commented Jan 7, 2025

[FE Incremental Coverage Report]

fail : 16 / 38 (42.11%)

file detail

path covered_line new_line coverage not_covered_line_detail
🔵 com/starrocks/lake/StarOSAgent.java 0 3 00.00% [143, 144, 145]
🔵 com/starrocks/fs/hdfs/HdfsFsManager.java 0 12 00.00% [1217, 1218, 1219, 1220, 1221, 1222, 1223, 1227, 1228, 1229, 1231, 1232]
🔵 com/starrocks/fs/hdfs/HdfsService.java 0 4 00.00% [62, 63, 64, 66]
🔵 com/starrocks/fs/HdfsUtil.java 3 4 75.00% [78]
🔵 com/starrocks/server/GlobalStateMgr.java 8 10 80.00% [2231, 2232]
🔵 com/starrocks/server/NodeMgr.java 1 1 100.00% []
🔵 com/starrocks/storagevolume/StorageVolume.java 4 4 100.00% []

Copy link

github-actions bot commented Jan 7, 2025

[BE Incremental Coverage Report]

fail : 0 / 14 (00.00%)

file detail

path covered_line new_line coverage not_covered_line_detail
🔵 be/src/exec/schema_scanner/schema_cluster_snapshots_scanner.cpp 0 8 00.00% [57, 58, 60, 62, 64, 65, 66, 67]
🔵 be/src/exec/schema_scanner/schema_cluster_snapshot_jobs_scanner.cpp 0 6 00.00% [55, 56, 58, 60, 62, 63]

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.

shared-data mode support backup restore though automated snapshot
4 participants