TD-10430 minor changes for daemon module

This commit is contained in:
Shengliang Guan 2021-11-23 20:01:05 +08:00
parent 94eac805b9
commit 68af0bf32a
5 changed files with 30 additions and 24 deletions

View File

@ -82,10 +82,10 @@ extern SGlobalCfg tsGlobalConfig[];
extern int32_t tsGlobalConfigNum;
extern char * tsCfgStatusStr[];
void taosReadGlobalLogCfg();
bool taosReadGlobalCfg();
void taosPrintGlobalCfg();
void taosDumpGlobalCfg();
void taosReadGlobalLogCfg();
int32_t taosReadGlobalCfg();
void taosPrintGlobalCfg();
void taosDumpGlobalCfg();
void taosInitConfigOption(SGlobalCfg cfg);
SGlobalCfg *taosGetConfigOption(const char *option);

View File

@ -132,24 +132,30 @@ void dmnWaitSignal() {
}
}
void dmnInitOption(SDnodeOpt *pOpt) {
pOpt->sver = tsVersion;
pOpt->numOfCores = tsNumOfCores;
pOpt->statusInterval = tsStatusInterval;
pOpt->serverPort = tsServerPort;
tstrncpy(pOpt->localEp, tsLocalEp, TSDB_EP_LEN);
tstrncpy(pOpt->localFqdn, tsLocalEp, TSDB_FQDN_LEN);
tstrncpy(pOpt->timezone, tsLocalEp, TSDB_TIMEZONE_LEN);
tstrncpy(pOpt->locale, tsLocalEp, TSDB_LOCALE_LEN);
tstrncpy(pOpt->charset, tsLocalEp, TSDB_LOCALE_LEN);
void dmnInitOption(SDnodeOpt *pOption) {
pOption->sver = tsVersion;
pOption->numOfCores = tsNumOfCores;
pOption->numOfThreadsPerCore = tsNumOfThreadsPerCore;
pOption->ratioOfQueryCores = tsRatioOfQueryCores;
pOption->maxShellConns = tsMaxShellConns;
pOption->shellActivityTimer = tsShellActivityTimer;
pOption->statusInterval = tsStatusInterval;
pOption->serverPort = tsServerPort;
tstrncpy(pOption->dataDir, tsDataDir, TSDB_EP_LEN);
tstrncpy(pOption->localEp, tsLocalEp, TSDB_EP_LEN);
tstrncpy(pOption->localFqdn, tsLocalEp, TSDB_FQDN_LEN);
tstrncpy(pOption->firstEp, tsFirst, TSDB_FQDN_LEN);
tstrncpy(pOption->timezone, tsLocalEp, TSDB_TIMEZONE_LEN);
tstrncpy(pOption->locale, tsLocalEp, TSDB_LOCALE_LEN);
tstrncpy(pOption->charset, tsLocalEp, TSDB_LOCALE_LEN);
}
int dmnRunDnode() {
SDnodeOpt opt = {0};
dmnInitOption(&opt);
SDnodeOpt option = {0};
dmnInitOption(&option);
SDnode *pDnd = dndInit(&opt);
if (pDnd == NULL) {
SDnode *pDnode = dndInit(&option);
if (pDnode == NULL) {
uInfo("Failed to start TDengine, please check the log at %s", tsLogDir);
return -1;
}
@ -158,7 +164,7 @@ int dmnRunDnode() {
dmnWaitSignal();
uInfo("TDengine is shut down!");
dndCleanup(pDnd);
dndCleanup(pDnode);
taosCloseLog();
return 0;
}

View File

@ -335,7 +335,7 @@ void taosReadGlobalLogCfg() {
fclose(fp);
}
bool taosReadGlobalCfg() {
int32_t taosReadGlobalCfg() {
char * line, *option, *value, *value2, *value3;
int olen, vlen, vlen2, vlen3;
char fileName[PATH_MAX] = {0};
@ -345,7 +345,7 @@ bool taosReadGlobalCfg() {
if (fp == NULL) {
fp = fopen(configDir, "r");
if (fp == NULL) {
return false;
return -1;
}
}
@ -393,7 +393,7 @@ bool taosReadGlobalCfg() {
// taosSetAllDebugFlag();
// }
return true;
return 0;
}
void taosPrintGlobalCfg() {

View File

@ -148,7 +148,7 @@ void taos_init_imp(void) {
}
taosReadGlobalCfg();
if (taosCheckGlobalCfg()) {
if (taosCheckGlobalCfg() != 0) {
tscInitRes = -1;
return;
}

View File

@ -106,7 +106,7 @@ int main(int argc, char* argv[]) {
taosInitGlobalCfg();
taosReadGlobalLogCfg();
if (!taosReadGlobalCfg()) {
if (taosReadGlobalCfg() ! =0) {
printf("TDengine read global config failed");
exit(EXIT_FAILURE);
}