This is an automated email from the ASF dual-hosted git repository.
dataroaring pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new f82eb9e73a0 [feature](merge-cloud) Support check compatibility mode
for FE (#32509)
f82eb9e73a0 is described below
commit f82eb9e73a04640f16c19dc65fea38900fed01e6
Author: walter <[email protected]>
AuthorDate: Mon Mar 25 23:06:15 2024 +0800
[feature](merge-cloud) Support check compatibility mode for FE (#32509)
---
.../main/java/org/apache/doris/common/Config.java | 7 ++++
.../main/java/org/apache/doris/catalog/Env.java | 38 +++++++++++++++++++++-
.../apache/doris/journal/bdbje/BDBJEJournal.java | 4 +++
3 files changed, 48 insertions(+), 1 deletion(-)
diff --git a/fe/fe-common/src/main/java/org/apache/doris/common/Config.java
b/fe/fe-common/src/main/java/org/apache/doris/common/Config.java
index f6af3a044aa..848a22d1012 100644
--- a/fe/fe-common/src/main/java/org/apache/doris/common/Config.java
+++ b/fe/fe-common/src/main/java/org/apache/doris/common/Config.java
@@ -2530,6 +2530,13 @@ public class Config extends ConfigBase {
})
public static boolean enable_proxy_protocol = false;
+ // Used to check compatibility when upgrading.
+ @ConfField
+ public static boolean enable_check_compatibility_mode = false;
+
+ // Do checkpoint after replaying edit logs.
+ @ConfField
+ public static boolean checkpoint_after_check_compatibility = false;
//==========================================================================
// begin of cloud config
diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java
b/fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java
index e91ff7febe7..10592282155 100755
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java
@@ -313,6 +313,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicLong;
import java.util.stream.Collectors;
+
/**
* A singleton class can also be seen as an entry point of Doris.
* All manager classes can be obtained through this class.
@@ -1000,7 +1001,13 @@ public class Env {
auditEventProcessor.start();
// 2. get cluster id and role (Observer or Follower)
- getClusterIdAndRole();
+ if (!Config.enable_check_compatibility_mode) {
+ getClusterIdAndRole();
+ } else {
+ role = FrontendNodeType.FOLLOWER;
+ nodeName = genFeNodeName(selfNode.getHost(),
+ selfNode.getPort(), false /* new style */);
+ }
// 3. Load image first and replay edits
this.editLog = new EditLog(nodeName);
@@ -1009,6 +1016,10 @@ public class Env {
this.globalTransactionMgr.setEditLog(editLog);
this.idGenerator.setEditLog(editLog);
+ if (Config.enable_check_compatibility_mode) {
+ replayJournalsAndExit();
+ }
+
// 4. create load and export job label cleaner thread
createLabelCleaner();
@@ -1467,6 +1478,13 @@ public class Env {
long replayEndTime = System.currentTimeMillis();
LOG.info("finish replay in " + (replayEndTime - replayStartTime) + "
msec");
+ if (Config.enable_check_compatibility_mode) {
+ String msg = "check metadata compatibility successfully";
+ LOG.info(msg);
+ System.out.println(msg);
+ System.exit(0);
+ }
+
checkCurrentNodeExist();
checkBeExecVersion();
@@ -5250,6 +5268,9 @@ public class Env {
LOG.info("acquired all jobs' read lock.");
long journalId = getMaxJournalId();
File dumpFile = new File(Config.meta_dir, "image." + journalId);
+ if (Config.enable_check_compatibility_mode) {
+ dumpFile = new File(imageDir, "image." + journalId);
+ }
dumpFilePath = dumpFile.getAbsolutePath();
try {
LOG.info("begin to dump {}", dumpFilePath);
@@ -6107,4 +6128,19 @@ public class Env {
throw new TException(e);
}
}
+
+ private void replayJournalsAndExit() {
+ replayJournal(-1);
+ LOG.info("check metadata compatibility successfully");
+ System.out.println("check metadata compatibility successfully");
+
+ if (Config.checkpoint_after_check_compatibility) {
+ String imagePath = dumpImage();
+ String msg = "the new image file path is: " + imagePath;
+ LOG.info(msg);
+ System.out.println(msg);
+ }
+
+ System.exit(0);
+ }
}
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/journal/bdbje/BDBJEJournal.java
b/fe/fe-core/src/main/java/org/apache/doris/journal/bdbje/BDBJEJournal.java
index 13fa926c06d..a675257fea9 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/journal/bdbje/BDBJEJournal.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/journal/bdbje/BDBJEJournal.java
@@ -18,6 +18,7 @@
package org.apache.doris.journal.bdbje;
import org.apache.doris.catalog.Env;
+import org.apache.doris.common.Config;
import org.apache.doris.common.FeConstants;
import org.apache.doris.common.io.DataOutputBuffer;
import org.apache.doris.common.io.Writable;
@@ -374,6 +375,9 @@ public class BDBJEJournal implements Journal { //
CHECKSTYLE IGNORE THIS LINE: B
@Override
public long getMaxJournalId() {
+ if (Config.enable_check_compatibility_mode) {
+ return getMaxJournalIdWithoutCheck();
+ }
return getMaxJournalIdInternal(true);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]