diff --git a/fe/src/main/java/org/apache/doris/catalog/Catalog.java b/fe/src/main/java/org/apache/doris/catalog/Catalog.java index df5abde7d0..5f55be4e3b 100644 --- a/fe/src/main/java/org/apache/doris/catalog/Catalog.java +++ b/fe/src/main/java/org/apache/doris/catalog/Catalog.java @@ -687,10 +687,15 @@ public class Catalog { File roleFile = new File(IMAGE_DIR, Storage.ROLE_FILE); File versionFile = new File(IMAGE_DIR, Storage.VERSION_FILE); - // helper node is the local node. This usually happens when the very - // first node to start, - // or when one node to restart. - if (isMyself()) { + // if helper node is point to self, or there is ROLE and VERSION file in local. + // get the node type from local + if (isMyself() || (roleFile.exists() && versionFile.exists())) { + + if (!isMyself()) { + LOG.info("find ROLE and VERSION file in local, ignore helper nodes: {}", helperNodes); + } + + // check file integrity, if has. if ((roleFile.exists() && !versionFile.exists()) || (!roleFile.exists() && versionFile.exists())) { LOG.error("role file and version file must both exist or both not exist. " diff --git a/fe/src/main/java/org/apache/doris/master/Checkpoint.java b/fe/src/main/java/org/apache/doris/master/Checkpoint.java index f87660d838..6802a86678 100644 --- a/fe/src/main/java/org/apache/doris/master/Checkpoint.java +++ b/fe/src/main/java/org/apache/doris/master/Checkpoint.java @@ -69,6 +69,13 @@ public class Checkpoint extends Daemon { @Override protected void runOneCycle() { + if (!Catalog.getInstance().isReady()) { + // here we use getInstance(), not getCurrentCatalog() because we truly want the Catalog instance, + // not the Checkpoint catalog instance. + // and if catalog is not ready, do not doing checkpoint. + return; + } + long imageVersion = 0; long checkPointVersion = 0; Storage storage = null; diff --git a/fe/src/test/java/org/apache/doris/alter/RollupJobV2Test.java b/fe/src/test/java/org/apache/doris/alter/RollupJobV2Test.java index e8373d5253..2849e4f66a 100644 --- a/fe/src/test/java/org/apache/doris/alter/RollupJobV2Test.java +++ b/fe/src/test/java/org/apache/doris/alter/RollupJobV2Test.java @@ -94,6 +94,7 @@ public class RollupJobV2Test { clause.analyze(analyzer); FeConstants.runningUnitTest = true; + AgentTaskQueue.clearAllTasks(); } @Test