Skip to content

Commit

Permalink
[chore](fe) Add some important information in fe log for debug
Browse files Browse the repository at this point in the history
* 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`
  • Loading branch information
SWJTU-ZhangLei committed May 6, 2024
1 parent 401d7dd commit 271f7df
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 22 deletions.
39 changes: 21 additions & 18 deletions fe/fe-core/src/main/java/org/apache/doris/DorisFE.java
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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();
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -416,7 +418,7 @@ private static void checkCommandLineOptions(CommandLineOptions cmdLineOpts) {
}
}
}

printVersion();
// go on
}

Expand Down Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 271f7df

Please sign in to comment.