Skip to content

Commit

Permalink
[Enhancement] Support empty cluster_snapshot.yaml config file (backport
Browse files Browse the repository at this point in the history
#54416) (#54444)

Co-authored-by: xiangguangyxg <[email protected]>
  • Loading branch information
mergify[bot] and xiangguangyxg authored Dec 27, 2024
1 parent 6e830b4 commit 2ee6ed9
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
2 changes: 2 additions & 0 deletions conf/cluster_snapshot.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
--- # cluster_snapshot.yaml

# do not include leader fe
#frontends:
# - host: 172.26.92.1
Expand Down
4 changes: 2 additions & 2 deletions fe/fe-core/src/main/java/com/starrocks/StarRocksFE.java
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,10 @@ public static void start(String starRocksDir, String pidDir, String[] args) {

addShutdownHook();

LOG.info("FE started successfully");

RestoreClusterSnapshotMgr.finishRestoring();

LOG.info("FE started successfully");

while (!stopped) {
Thread.sleep(2000);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,10 @@ public static ClusterSnapshotConfig load(String clusterSnapshotYamlFile) {
ObjectMapper objectMapper = new ObjectMapper(new YAMLFactory());
ClusterSnapshotConfig config = objectMapper.readValue(new File(clusterSnapshotYamlFile),
ClusterSnapshotConfig.class);
if (config == null) {
// Empty config file
config = new ClusterSnapshotConfig();
}
return config;
} catch (Exception e) {
LOG.warn("Failed to load cluster snapshot config {} ", clusterSnapshotYamlFile, e);
Expand Down
2 changes: 2 additions & 0 deletions fe/fe-core/src/test/resources/conf/cluster_snapshot.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
--- # cluster_snapshot.yaml

# do not include leader fe
frontends:
- host: 172.26.92.1
Expand Down

0 comments on commit 2ee6ed9

Please sign in to comment.