From 8249a2fd8e793c854134b129e6c5d9ffe2388c69 Mon Sep 17 00:00:00 2001 From: stephenkgu Date: Thu, 10 Dec 2020 15:34:46 +0800 Subject: [PATCH] taosd: allow -C option before -c --- src/dnode/src/dnodeSystem.c | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/src/dnode/src/dnodeSystem.c b/src/dnode/src/dnodeSystem.c index d3084653eb..36232893b5 100644 --- a/src/dnode/src/dnodeSystem.c +++ b/src/dnode/src/dnodeSystem.c @@ -23,6 +23,8 @@ static void signal_handler(int32_t signum, siginfo_t *sigInfo, void *context); static tsem_t exitSem; int32_t main(int32_t argc, char *argv[]) { + int dump_config = 0; + // Set global configuration file for (int32_t i = 1; i < argc; ++i) { if (strcmp(argv[i], "-c") == 0) { @@ -37,17 +39,7 @@ int32_t main(int32_t argc, char *argv[]) { exit(EXIT_FAILURE); } } else if (strcmp(argv[i], "-C") == 0) { - tscEmbedded = 1; - taosInitGlobalCfg(); - taosReadGlobalLogCfg(); - - if (!taosReadGlobalCfg()) { - printf("TDengine read global config failed"); - exit(EXIT_FAILURE); - } - - taosDumpGlobalCfg(); - exit(EXIT_SUCCESS); + dump_config = 1; } else if (strcmp(argv[i], "-V") == 0) { #ifdef _ACCT char *versionStr = "enterprise"; @@ -100,6 +92,20 @@ int32_t main(int32_t argc, char *argv[]) { #endif } + if (0 != dump_config) { + tscEmbedded = 1; + taosInitGlobalCfg(); + taosReadGlobalLogCfg(); + + if (!taosReadGlobalCfg()) { + printf("TDengine read global config failed"); + exit(EXIT_FAILURE); + } + + taosDumpGlobalCfg(); + exit(EXIT_SUCCESS); + } + if (tsem_init(&exitSem, 0, 0) != 0) { printf("failed to create exit semphore\n"); exit(EXIT_FAILURE);