From 271f7dfbe18c2661be441d39a1957bce55584e94 Mon Sep 17 00:00:00 2001 From: Lei Zhang <27994433+SWJTU-ZhangLei@users.noreply.github.com> Date: Tue, 30 Apr 2024 14:18:27 +0800 Subject: [PATCH] [chore](fe) Add some important information in fe log for debug * Add git commit info in fe.log/fe.out when fe start * Add `metadata recovery mode` log in fe.log/fe.out * Add bdb journal info in fe.log when size over `1M` --- .../main/java/org/apache/doris/DorisFE.java | 39 ++++++++++--------- .../doris/journal/bdbje/BDBEnvironment.java | 5 ++- .../doris/journal/bdbje/BDBJEJournal.java | 4 +- 3 files changed, 26 insertions(+), 22 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/DorisFE.java b/fe/fe-core/src/main/java/org/apache/doris/DorisFE.java index 696634fed342d6..816106edf9b1e7 100755 --- a/fe/fe-core/src/main/java/org/apache/doris/DorisFE.java +++ b/fe/fe-core/src/main/java/org/apache/doris/DorisFE.java @@ -101,29 +101,13 @@ public static void start(String dorisHomeDir, String pidDir, String[] args, Star CommandLineOptions cmdLineOpts = parseArgs(args); try { - if (cmdLineOpts.isVersion()) { - printVersion(); - System.exit(0); - } - - // pid file - if (!createAndLockPidFile(pidDir + "/fe.pid")) { - throw new IOException("pid file is already locked."); - } - // init config Config config = new Config(); config.init(dorisHomeDir + "/conf/fe.conf"); // Must init custom config after init config, separately. // Because the path of custom config file is defined in fe.conf config.initCustom(Config.custom_config_dir + "/fe_custom.conf"); - LOCK_FILE_PATH = Config.meta_dir + "/" + LOCK_FILE_NAME; - try { - tryLockProcess(); - } catch (Exception e) { - LOG.error("start doris failed.", e); - System.exit(-1); - } + LdapConfig ldapConfig = new LdapConfig(); if (new File(dorisHomeDir + "/conf/ldap.conf").exists()) { ldapConfig.init(dorisHomeDir + "/conf/ldap.conf"); @@ -142,9 +126,21 @@ public static void start(String dorisHomeDir, String pidDir, String[] args, Star // set dns cache ttl java.security.Security.setProperty("networkaddress.cache.ttl", "60"); + // pid file + if (!cmdLineOpts.isVersion() && !createAndLockPidFile(pidDir + "/fe.pid")) { + throw new IOException("pid file is already locked."); + } + // check command line options checkCommandLineOptions(cmdLineOpts); + try { + tryLockProcess(); + } catch (Exception e) { + LOG.error("start doris failed.", e); + System.exit(-1); + } + LOG.info("Doris FE starting..."); FrontendOptions.init(); @@ -384,6 +380,12 @@ private static void printVersion() { System.out.println("Build info: " + Version.DORIS_BUILD_INFO); System.out.println("Build hash: " + Version.DORIS_BUILD_HASH); System.out.println("Java compile version: " + Version.DORIS_JAVA_COMPILE_VERSION); + + LOG.info("Build version: {}", Version.DORIS_BUILD_VERSION); + LOG.info("Build time: {}", Version.DORIS_BUILD_TIME); + LOG.info("Build info: {}", Version.DORIS_BUILD_INFO); + LOG.info("Build hash: {}", Version.DORIS_BUILD_HASH); + LOG.info("Java compile version: {}", Version.DORIS_JAVA_COMPILE_VERSION); } private static void checkCommandLineOptions(CommandLineOptions cmdLineOpts) { @@ -416,7 +418,7 @@ private static void checkCommandLineOptions(CommandLineOptions cmdLineOpts) { } } } - + printVersion(); // go on } @@ -450,6 +452,7 @@ private static boolean createAndLockPidFile(String pidFilePath) throws IOExcepti */ private static void tryLockProcess() { try { + LOCK_FILE_PATH = Config.meta_dir + "/" + LOCK_FILE_NAME; processLockFileChannel = FileChannel.open(new File(LOCK_FILE_PATH).toPath(), StandardOpenOption.WRITE, StandardOpenOption.CREATE); processFileLock = processLockFileChannel.tryLock(); diff --git a/fe/fe-core/src/main/java/org/apache/doris/journal/bdbje/BDBEnvironment.java b/fe/fe-core/src/main/java/org/apache/doris/journal/bdbje/BDBEnvironment.java index f80f5e7dd20f15..47a41b8226ad01 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/journal/bdbje/BDBEnvironment.java +++ b/fe/fe-core/src/main/java/org/apache/doris/journal/bdbje/BDBEnvironment.java @@ -101,11 +101,12 @@ public void setup(File envHome, String selfNodeName, String selfNodeHostPort, LOG.error("Current node is not in the electable_nodes list. will exit"); System.exit(-1); } - LOG.info("start group reset"); + LOG.warn("start group reset"); DbResetRepGroup resetUtility = new DbResetRepGroup( envHome, PALO_JOURNAL_GROUP, selfNodeName, selfNodeHostPort); resetUtility.reset(); - LOG.info("group has been reset."); + LOG.warn("WARNING: metadata recovery mode, group has been reset."); + System.out.println("WARNING: metadata recovery mode, group has been reset."); } // set replication config 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 4fec54786d2065..0d342a986cd40f 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 @@ -242,8 +242,8 @@ public synchronized long write(short op, Writable writable) throws IOException { MetricRepo.COUNTER_EDIT_LOG_SIZE_BYTES.increase((long) theData.getSize()); MetricRepo.COUNTER_CURRENT_EDIT_LOG_SIZE_BYTES.increase((long) theData.getSize()); } - if (LOG.isDebugEnabled()) { - LOG.debug("opCode = {}, journal size = {}", op, theData.getSize()); + if (LOG.isDebugEnabled() || theData.getSize() > (1 << 20)) { + LOG.info("opCode = {}, journal size = {}", op, theData.getSize()); } // Write the key value pair to bdb.