Skip to content

Commit

Permalink
[chore](fe) Add some important information in fe log for debug (#34352)…
Browse files Browse the repository at this point in the history
… (#37627)

* 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`

## Proposed changes

Issue Number: close #xxx

<!--Describe your changes.-->
  • Loading branch information
SWJTU-ZhangLei authored Jul 11, 2024
1 parent dfadf61 commit 47a865b
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 17 deletions.
42 changes: 29 additions & 13 deletions fe/fe-core/src/main/java/org/apache/doris/DorisFE.java
Original file line number Diff line number Diff line change
Expand Up @@ -102,24 +102,13 @@ public static void start(String dorisHomeDir, String pidDir, String[] args, Star
CommandLineOptions cmdLineOpts = parseArgs(args);

try {
// 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 @@ -136,9 +125,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 @@ -368,6 +369,20 @@ private static CommandLineOptions parseArgs(String[] args) {
return new CommandLineOptions(false, null, null, "");
}

private static void printVersion() {
System.out.println("Build version: " + Version.DORIS_BUILD_VERSION);
System.out.println("Build time: " + Version.DORIS_BUILD_TIME);
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) {
if (cmdLineOpts.isVersion()) {
System.out.println("Build version: " + Version.DORIS_BUILD_VERSION);
Expand Down Expand Up @@ -402,7 +417,7 @@ private static void checkCommandLineOptions(CommandLineOptions cmdLineOpts) {
}
}
}

printVersion();
// go on
}

Expand Down Expand Up @@ -438,6 +453,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 @@ -100,11 +100,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 @@ -145,8 +145,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 47a865b

Please sign in to comment.