提交 68af0bf3 编写于 作者: S Shengliang Guan

TD-10430 minor changes for daemon module

上级 94eac805
......@@ -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);
......
......@@ -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;
}
......
......@@ -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() {
......
......@@ -148,7 +148,7 @@ void taos_init_imp(void) {
}
taosReadGlobalCfg();
if (taosCheckGlobalCfg()) {
if (taosCheckGlobalCfg() != 0) {
tscInitRes = -1;
return;
}
......
......@@ -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);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册