diff --git a/include/common/tglobal.h b/include/common/tglobal.h index 7c2d63e025b..17ed732af86 100644 --- a/include/common/tglobal.h +++ b/include/common/tglobal.h @@ -258,7 +258,7 @@ extern bool tsExperimental; int32_t taosCreateLog(const char *logname, int32_t logFileNum, const char *cfgDir, const char **envCmd, const char *envFile, char *apolloUrl, SArray *pArgs, bool tsc); int32_t taosInitCfg(const char *cfgDir, const char **envCmd, const char *envFile, char *apolloUrl, SArray *pArgs, - bool tsc); + bool tsc, bool isDumpCfg); void taosCleanupCfg(); int32_t taosCfgDynamicOptions(SConfig *pCfg, const char *name, bool forServer); diff --git a/source/client/src/clientEnv.c b/source/client/src/clientEnv.c index 439103e5c41..036cf0420af 100644 --- a/source/client/src/clientEnv.c +++ b/source/client/src/clientEnv.c @@ -725,7 +725,7 @@ void taos_init_imp(void) { return; } - if (taosInitCfg(configDir, NULL, NULL, NULL, NULL, 1) != 0) { + if (taosInitCfg(configDir, NULL, NULL, NULL, NULL, 1, true) != 0) { tscInitRes = -1; return; } diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index 35e793d562d..78e69858715 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -1388,7 +1388,7 @@ static int32_t taosCheckGlobalCfg() { } int32_t taosInitCfg(const char *cfgDir, const char **envCmd, const char *envFile, char *apolloUrl, SArray *pArgs, - bool tsc) { + bool tsc, bool isDumpCfg) { if (tsCfg != NULL) return 0; tsCfg = cfgInit(); @@ -1435,7 +1435,7 @@ int32_t taosInitCfg(const char *cfgDir, const char **envCmd, const char *envFile taosSetAllDebugFlag(tsCfg, cfgGetItem(tsCfg, "debugFlag")->i32); - cfgDumpCfg(tsCfg, tsc, false); + if(isDumpCfg) cfgDumpCfg(tsCfg, tsc, false); if (taosCheckGlobalCfg() != 0) { return -1; diff --git a/source/dnode/mgmt/exe/dmMain.c b/source/dnode/mgmt/exe/dmMain.c index 98459512f37..f7fcd7697f5 100644 --- a/source/dnode/mgmt/exe/dmMain.c +++ b/source/dnode/mgmt/exe/dmMain.c @@ -205,11 +205,11 @@ static int32_t dmParseArgs(int32_t argc, char const *argv[]) { if(i < argc - 1) { int32_t len = strlen(argv[++i]); if (len < ENCRYPT_KEY_LEN_MIN) { - printf("encrypt key is too short, it should be great or equal to %d\n", ENCRYPT_KEY_LEN_MIN); + printf("Error: Encrypt key should be at least %d characters\n", ENCRYPT_KEY_LEN_MIN); return -1; } if (len > ENCRYPT_KEY_LEN) { - printf("encrypt key overflow, it should be less or equal to %d\n", ENCRYPT_KEY_LEN); + printf("Error: Encrypt key overflow, it should be at most %d characters\n", ENCRYPT_KEY_LEN); return -1; } tstrncpy(global.encryptKey, argv[i], ENCRYPT_KEY_LEN); @@ -325,7 +325,7 @@ int main(int argc, char const *argv[]) { } if (dmParseArgs(argc, argv) != 0) { - printf("failed to start since parse args error\n"); + //printf("failed to start since parse args error\n"); taosCleanupArgs(); return -1; } @@ -380,7 +380,11 @@ int mainWindows(int argc, char **argv) { dmPrintArgs(argc, argv); - if (taosInitCfg(configDir, global.envCmd, global.envFile, global.apolloUrl, global.pArgs, 0) != 0) { + bool isDumpCfg = true; + if(global.generateCode) { + isDumpCfg = false; + } + if (taosInitCfg(configDir, global.envCmd, global.envFile, global.apolloUrl, global.pArgs, 0, isDumpCfg) != 0) { dError("failed to start since read config error"); taosCloseLog(); taosCleanupArgs(); diff --git a/source/libs/function/src/udfd.c b/source/libs/function/src/udfd.c index 2a5e594ba35..e2ea6c13741 100644 --- a/source/libs/function/src/udfd.c +++ b/source/libs/function/src/udfd.c @@ -1424,7 +1424,7 @@ int main(int argc, char *argv[]) { printf("failed to start since init log error\n"); } - if (taosInitCfg(configDir, NULL, NULL, NULL, NULL, 0) != 0) { + if (taosInitCfg(configDir, NULL, NULL, NULL, NULL, 0, true) != 0) { fnError("failed to start since read config error"); return -2; } diff --git a/source/libs/function/test/runUdf.c b/source/libs/function/test/runUdf.c index aa8b88b7384..eef6cdc3d38 100644 --- a/source/libs/function/test/runUdf.c +++ b/source/libs/function/test/runUdf.c @@ -127,7 +127,7 @@ int aggregateFuncTest() { int main(int argc, char *argv[]) { parseArgs(argc, argv); initLog(); - if (taosInitCfg(configDir, NULL, NULL, NULL, NULL, 0) != 0) { + if (taosInitCfg(configDir, NULL, NULL, NULL, NULL, 0, true) != 0) { fnError("failed to start since read config error"); return -1; } diff --git a/utils/tsim/src/simSystem.c b/utils/tsim/src/simSystem.c index dcf5d6ab123..645cf0e6fe7 100644 --- a/utils/tsim/src/simSystem.c +++ b/utils/tsim/src/simSystem.c @@ -28,7 +28,7 @@ extern bool simExecSuccess; int32_t simInitCfg() { taosCreateLog("simlog", 1, configDir, NULL, NULL, NULL, NULL, 1); - taosInitCfg(configDir, NULL, NULL, NULL, NULL, 1); + taosInitCfg(configDir, NULL, NULL, NULL, NULL, 1, true); SConfig *pCfg = taosGetCfg(); tstrncpy(simScriptDir, cfgGetItem(pCfg, "scriptDir")->str, PATH_MAX);