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

TD-10430 minor changes for daemon module

上级 94eac805
...@@ -82,10 +82,10 @@ extern SGlobalCfg tsGlobalConfig[]; ...@@ -82,10 +82,10 @@ extern SGlobalCfg tsGlobalConfig[];
extern int32_t tsGlobalConfigNum; extern int32_t tsGlobalConfigNum;
extern char * tsCfgStatusStr[]; extern char * tsCfgStatusStr[];
void taosReadGlobalLogCfg(); void taosReadGlobalLogCfg();
bool taosReadGlobalCfg(); int32_t taosReadGlobalCfg();
void taosPrintGlobalCfg(); void taosPrintGlobalCfg();
void taosDumpGlobalCfg(); void taosDumpGlobalCfg();
void taosInitConfigOption(SGlobalCfg cfg); void taosInitConfigOption(SGlobalCfg cfg);
SGlobalCfg *taosGetConfigOption(const char *option); SGlobalCfg *taosGetConfigOption(const char *option);
......
...@@ -132,24 +132,30 @@ void dmnWaitSignal() { ...@@ -132,24 +132,30 @@ void dmnWaitSignal() {
} }
} }
void dmnInitOption(SDnodeOpt *pOpt) { void dmnInitOption(SDnodeOpt *pOption) {
pOpt->sver = tsVersion; pOption->sver = tsVersion;
pOpt->numOfCores = tsNumOfCores; pOption->numOfCores = tsNumOfCores;
pOpt->statusInterval = tsStatusInterval; pOption->numOfThreadsPerCore = tsNumOfThreadsPerCore;
pOpt->serverPort = tsServerPort; pOption->ratioOfQueryCores = tsRatioOfQueryCores;
tstrncpy(pOpt->localEp, tsLocalEp, TSDB_EP_LEN); pOption->maxShellConns = tsMaxShellConns;
tstrncpy(pOpt->localFqdn, tsLocalEp, TSDB_FQDN_LEN); pOption->shellActivityTimer = tsShellActivityTimer;
tstrncpy(pOpt->timezone, tsLocalEp, TSDB_TIMEZONE_LEN); pOption->statusInterval = tsStatusInterval;
tstrncpy(pOpt->locale, tsLocalEp, TSDB_LOCALE_LEN); pOption->serverPort = tsServerPort;
tstrncpy(pOpt->charset, tsLocalEp, TSDB_LOCALE_LEN); 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() { int dmnRunDnode() {
SDnodeOpt opt = {0}; SDnodeOpt option = {0};
dmnInitOption(&opt); dmnInitOption(&option);
SDnode *pDnd = dndInit(&opt); SDnode *pDnode = dndInit(&option);
if (pDnd == NULL) { if (pDnode == NULL) {
uInfo("Failed to start TDengine, please check the log at %s", tsLogDir); uInfo("Failed to start TDengine, please check the log at %s", tsLogDir);
return -1; return -1;
} }
...@@ -158,7 +164,7 @@ int dmnRunDnode() { ...@@ -158,7 +164,7 @@ int dmnRunDnode() {
dmnWaitSignal(); dmnWaitSignal();
uInfo("TDengine is shut down!"); uInfo("TDengine is shut down!");
dndCleanup(pDnd); dndCleanup(pDnode);
taosCloseLog(); taosCloseLog();
return 0; return 0;
} }
......
...@@ -335,7 +335,7 @@ void taosReadGlobalLogCfg() { ...@@ -335,7 +335,7 @@ void taosReadGlobalLogCfg() {
fclose(fp); fclose(fp);
} }
bool taosReadGlobalCfg() { int32_t taosReadGlobalCfg() {
char * line, *option, *value, *value2, *value3; char * line, *option, *value, *value2, *value3;
int olen, vlen, vlen2, vlen3; int olen, vlen, vlen2, vlen3;
char fileName[PATH_MAX] = {0}; char fileName[PATH_MAX] = {0};
...@@ -345,7 +345,7 @@ bool taosReadGlobalCfg() { ...@@ -345,7 +345,7 @@ bool taosReadGlobalCfg() {
if (fp == NULL) { if (fp == NULL) {
fp = fopen(configDir, "r"); fp = fopen(configDir, "r");
if (fp == NULL) { if (fp == NULL) {
return false; return -1;
} }
} }
...@@ -393,7 +393,7 @@ bool taosReadGlobalCfg() { ...@@ -393,7 +393,7 @@ bool taosReadGlobalCfg() {
// taosSetAllDebugFlag(); // taosSetAllDebugFlag();
// } // }
return true; return 0;
} }
void taosPrintGlobalCfg() { void taosPrintGlobalCfg() {
......
...@@ -148,7 +148,7 @@ void taos_init_imp(void) { ...@@ -148,7 +148,7 @@ void taos_init_imp(void) {
} }
taosReadGlobalCfg(); taosReadGlobalCfg();
if (taosCheckGlobalCfg()) { if (taosCheckGlobalCfg() != 0) {
tscInitRes = -1; tscInitRes = -1;
return; return;
} }
......
...@@ -106,7 +106,7 @@ int main(int argc, char* argv[]) { ...@@ -106,7 +106,7 @@ int main(int argc, char* argv[]) {
taosInitGlobalCfg(); taosInitGlobalCfg();
taosReadGlobalLogCfg(); taosReadGlobalLogCfg();
if (!taosReadGlobalCfg()) { if (taosReadGlobalCfg() ! =0) {
printf("TDengine read global config failed"); printf("TDengine read global config failed");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册