Skip to content

Commit

Permalink
fix commit
Browse files Browse the repository at this point in the history
Signed-off-by: xiangguangyxg <[email protected]>
  • Loading branch information
xiangguangyxg committed Jan 6, 2025
1 parent dcbf174 commit 97f4391
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 20 deletions.
2 changes: 1 addition & 1 deletion fe/fe-core/src/main/java/com/starrocks/fs/HdfsUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public static void getTProperties(String path, BrokerDesc brokerDesc, THdfsProp
}

public static void copyToLocal(String srcPath, String destPath, Map<String, String> properties)
throws StarRocksException {
throws UserException {
hdfsService.copyToLocal(srcPath, destPath, properties);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1197,26 +1197,22 @@ public void getTProperties(String path, Map<String, String> loadProperties, THdf
getFileSystem(path, loadProperties, tProperties);
}

<<<<<<< HEAD
public List<FileStatus> listFileMeta(String path, Map<String, String> properties) throws UserException {
=======
public void copyToLocal(String srcPath, String destPath, Map<String, String> properties) throws StarRocksException {
public void copyToLocal(String srcPath, String destPath, Map<String, String> properties) throws UserException {
HdfsFs fileSystem = getFileSystem(srcPath, properties, null);
try {
fileSystem.getDFSFileSystem().copyToLocalFile(false, new Path(new WildcardURI(srcPath).getPath()),
new Path(destPath), true);
} catch (InterruptedIOException e) {
Thread.interrupted(); // clear interrupted flag
LOG.error("Interrupted while copy {} to local {} ", srcPath, destPath, e);
throw new StarRocksException("Failed to copy " + srcPath + "to local " + destPath, e);
throw new UserException("Failed to copy " + srcPath + "to local " + destPath, e);
} catch (Exception e) {
LOG.error("Exception while copy {} to local {} ", srcPath, destPath, e);
throw new StarRocksException("Failed to copy " + srcPath + "to local " + destPath, e);
throw new UserException("Failed to copy " + srcPath + "to local " + destPath, e);
}
}

public List<FileStatus> listFileMeta(String path, Map<String, String> properties) throws StarRocksException {
>>>>>>> 9bf575030 ([Feature] Support restoring from a cluster snapshot for shared-data mode (part 5, support downloading image) (#54651))
public List<FileStatus> listFileMeta(String path, Map<String, String> properties) throws UserException {
WildcardURI pathUri = new WildcardURI(path);
HdfsFs fileSystem = getFileSystem(path, properties, null);
Path pathPattern = new Path(pathUri.getPath());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public void getTProperties(String path, Map<String, String> loadProperties, THdf
fileSystemManager.getTProperties(path, loadProperties, tProperties);
}

public void copyToLocal(String srcPath, String destPath, Map<String, String> properties) throws StarRocksException {
public void copyToLocal(String srcPath, String destPath, Map<String, String> properties) throws UserException {
fileSystemManager.copyToLocal(srcPath, destPath, properties);
LOG.info("Copied {} to local {}", srcPath, destPath);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
package com.starrocks.lake.snapshot;

import com.starrocks.common.Config;
import com.starrocks.common.StarRocksException;
import com.starrocks.common.UserException;
import com.starrocks.fs.HdfsUtil;
import com.starrocks.ha.FrontendNodeType;
import com.starrocks.journal.bdbje.BDBEnvironment;
Expand Down Expand Up @@ -45,13 +45,13 @@ public class RestoreClusterSnapshotMgr {
private boolean oldStartWithIncompleteMeta;
private boolean oldResetElectionGroup;

private RestoreClusterSnapshotMgr(String clusterSnapshotYamlFile) throws StarRocksException {
private RestoreClusterSnapshotMgr(String clusterSnapshotYamlFile) throws UserException {
config = ClusterSnapshotConfig.load(clusterSnapshotYamlFile);
downloadSnapshot();
updateConfig();
}

public static void init(String clusterSnapshotYamlFile, String[] args) throws StarRocksException {
public static void init(String clusterSnapshotYamlFile, String[] args) throws UserException {
for (String arg : args) {
if (arg.equalsIgnoreCase("-cluster_snapshot")) {
LOG.info("FE start to restore from a cluster snapshot");
Expand All @@ -73,7 +73,7 @@ public static ClusterSnapshotConfig getConfig() {
return self.config;
}

public static void finishRestoring() throws StarRocksException {
public static void finishRestoring() throws UserException {
RestoreClusterSnapshotMgr self = instance;
if (self == null) {
return;
Expand Down Expand Up @@ -105,7 +105,7 @@ private void rollbackConfig() {
Config.bdbje_reset_election_group = oldResetElectionGroup;
}

private void downloadSnapshot() throws StarRocksException {
private void downloadSnapshot() throws UserException {
ClusterSnapshotConfig.ClusterSnapshot clusterSnapshot = config.getClusterSnapshot();
if (clusterSnapshot == null) {
return;
Expand All @@ -131,7 +131,7 @@ private void downloadSnapshot() throws StarRocksException {
HdfsUtil.copyToLocal(snapshotImagePath, localImagePath, properties);
}

private void updateFrontends() throws StarRocksException {
private void updateFrontends() throws UserException {
List<ClusterSnapshotConfig.Frontend> frontends = config.getFrontends();
if (frontends == null) {
return;
Expand All @@ -152,7 +152,7 @@ private void updateFrontends() throws StarRocksException {
}
}

private void updateComputeNodes() throws StarRocksException {
private void updateComputeNodes() throws UserException {
List<ClusterSnapshotConfig.ComputeNode> computeNodes = config.getComputeNodes();
if (computeNodes == null) {
return;
Expand Down Expand Up @@ -180,7 +180,7 @@ private void updateComputeNodes() throws StarRocksException {
}
}

private void updateStorageVolumes() throws StarRocksException {
private void updateStorageVolumes() throws UserException {
List<ClusterSnapshotConfig.StorageVolume> storageVolumes = config.getStorageVolumes();
if (storageVolumes == null) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

package com.starrocks.lake.snapshot;

import com.starrocks.common.StarRocksException;
import com.starrocks.common.UserException;
import com.starrocks.server.GlobalStateMgr;
import com.starrocks.utframe.UtFrameUtils;
import org.junit.Assert;
Expand All @@ -32,7 +32,7 @@ public static void beforeClass() throws Exception {

@Test
public void testDownloadSnapshotFaied() throws Exception {
Assert.assertThrows(StarRocksException.class, () -> {
Assert.assertThrows(UserException.class, () -> {
RestoreClusterSnapshotMgr.init("src/test/resources/conf/cluster_snapshot.yaml",
new String[] { "-cluster_snapshot" });
});
Expand Down

0 comments on commit 97f4391

Please sign in to comment.