Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix/TD-29772 #25739

Merged
merged 1 commit into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/common/tglobal.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion source/client/src/clientEnv.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions source/common/src/tglobal.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -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;
Expand Down
12 changes: 8 additions & 4 deletions source/dnode/mgmt/exe/dmMain.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion source/libs/function/src/udfd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion source/libs/function/test/runUdf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion utils/tsim/src/simSystem.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down