提交 6ed3c249 编写于 作者: S Shengliang Guan

minor changes

上级 587723c4
...@@ -46,7 +46,7 @@ typedef struct { ...@@ -46,7 +46,7 @@ typedef struct {
char localFqdn[TSDB_FQDN_LEN]; char localFqdn[TSDB_FQDN_LEN];
char firstEp[TSDB_EP_LEN]; char firstEp[TSDB_EP_LEN];
char secondEp[TSDB_EP_LEN]; char secondEp[TSDB_EP_LEN];
SDiskCfg *pDisks; SDiskCfg *disks;
int32_t numOfDisks; int32_t numOfDisks;
int8_t ntype; int8_t ntype;
} SDnodeOpt; } SDnodeOpt;
......
...@@ -126,7 +126,7 @@ static SDnodeOpt dndGetOpt() { ...@@ -126,7 +126,7 @@ static SDnodeOpt dndGetOpt() {
option.serverPort = tsServerPort; option.serverPort = tsServerPort;
tstrncpy(option.localFqdn, tsLocalFqdn, sizeof(option.localFqdn)); tstrncpy(option.localFqdn, tsLocalFqdn, sizeof(option.localFqdn));
snprintf(option.localEp, sizeof(option.localEp), "%s:%u", option.localFqdn, option.serverPort); snprintf(option.localEp, sizeof(option.localEp), "%s:%u", option.localFqdn, option.serverPort);
option.pDisks = tsDiskCfg; option.disks = tsDiskCfg;
option.numOfDisks = tsDiskCfgNum; option.numOfDisks = tsDiskCfgNum;
option.ntype = global.ntype; option.ntype = global.ntype;
return option; return option;
......
...@@ -99,7 +99,7 @@ typedef struct SMgmtWrapper { ...@@ -99,7 +99,7 @@ typedef struct SMgmtWrapper {
void *pMgmt; void *pMgmt;
SDnode *pDnode; SDnode *pDnode;
NodeMsgFp msgFps[TDMT_MAX]; NodeMsgFp msgFps[TDMT_MAX];
int32_t msgVgIds[TDMT_MAX]; // Handle the case where the same message type is distributed to qnode or vnode int8_t msgVgIds[TDMT_MAX]; // Handle the case where the same message type is distributed to qnode or vnode
SMgmtFp fp; SMgmtFp fp;
} SMgmtWrapper; } SMgmtWrapper;
...@@ -119,7 +119,7 @@ typedef struct SDnode { ...@@ -119,7 +119,7 @@ typedef struct SDnode {
char *firstEp; char *firstEp;
char *secondEp; char *secondEp;
char *dataDir; char *dataDir;
SDiskCfg *pDisks; SDiskCfg *disks;
int32_t numOfDisks; int32_t numOfDisks;
uint16_t serverPort; uint16_t serverPort;
bool dropped; bool dropped;
...@@ -127,7 +127,7 @@ typedef struct SDnode { ...@@ -127,7 +127,7 @@ typedef struct SDnode {
EDndStatus status; EDndStatus status;
EDndEvent event; EDndEvent event;
SStartupReq startup; SStartupReq startup;
TdFilePtr pLockFile; TdFilePtr lockfile;
STransMgmt trans; STransMgmt trans;
SMgmtWrapper wrappers[NODE_MAX]; SMgmtWrapper wrappers[NODE_MAX];
} SDnode; } SDnode;
...@@ -136,7 +136,7 @@ const char *dndNodeLogStr(ENodeType ntype); ...@@ -136,7 +136,7 @@ const char *dndNodeLogStr(ENodeType ntype);
const char *dndNodeProcStr(ENodeType ntype); const char *dndNodeProcStr(ENodeType ntype);
EDndStatus dndGetStatus(SDnode *pDnode); EDndStatus dndGetStatus(SDnode *pDnode);
void dndSetStatus(SDnode *pDnode, EDndStatus stat); void dndSetStatus(SDnode *pDnode, EDndStatus stat);
void dndSetMsgHandle(SMgmtWrapper *pWrapper, int32_t msgType, NodeMsgFp nodeMsgFp, int32_t vgId); void dndSetMsgHandle(SMgmtWrapper *pWrapper, tmsg_t msgType, NodeMsgFp nodeMsgFp, int8_t vgId);
void dndReportStartup(SDnode *pDnode, const char *pName, const char *pDesc); void dndReportStartup(SDnode *pDnode, const char *pName, const char *pDesc);
void dndSendMonitorReport(SDnode *pDnode); void dndSendMonitorReport(SDnode *pDnode);
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
static int8_t once = DND_ENV_INIT; static int8_t once = DND_ENV_INIT;
int32_t dndInit() { int32_t dndInit() {
dInfo("start to init dnode env"); dDebug("start to init dnode env");
if (atomic_val_compare_exchange_8(&once, DND_ENV_INIT, DND_ENV_READY) != DND_ENV_INIT) { if (atomic_val_compare_exchange_8(&once, DND_ENV_INIT, DND_ENV_READY) != DND_ENV_INIT) {
terrno = TSDB_CODE_REPEAT_INIT; terrno = TSDB_CODE_REPEAT_INIT;
dError("failed to init dnode env since %s", terrstr()); dError("failed to init dnode env since %s", terrstr());
...@@ -31,12 +31,6 @@ int32_t dndInit() { ...@@ -31,12 +31,6 @@ int32_t dndInit() {
taosBlockSIGPIPE(); taosBlockSIGPIPE();
taosResolveCRC(); taosResolveCRC();
if (rpcInit() != 0) {
dError("failed to init rpc since %s", terrstr());
dndCleanup();
return -1;
}
SMonCfg monCfg = {0}; SMonCfg monCfg = {0};
monCfg.maxLogs = tsMonitorMaxLogs; monCfg.maxLogs = tsMonitorMaxLogs;
monCfg.port = tsMonitorPort; monCfg.port = tsMonitorPort;
...@@ -44,29 +38,27 @@ int32_t dndInit() { ...@@ -44,29 +38,27 @@ int32_t dndInit() {
monCfg.comp = tsMonitorComp; monCfg.comp = tsMonitorComp;
if (monInit(&monCfg) != 0) { if (monInit(&monCfg) != 0) {
dError("failed to init monitor since %s", terrstr()); dError("failed to init monitor since %s", terrstr());
dndCleanup();
return -1; return -1;
} }
dInfo("dnode env is initialized"); dDebug("dnode env is initialized");
return 0; return 0;
} }
void dndCleanup() { void dndCleanup() {
dInfo("start to cleanup dnode env"); dDebug("start to cleanup dnode env");
if (atomic_val_compare_exchange_8(&once, DND_ENV_READY, DND_ENV_CLEANUP) != DND_ENV_READY) { if (atomic_val_compare_exchange_8(&once, DND_ENV_READY, DND_ENV_CLEANUP) != DND_ENV_READY) {
dError("dnode env is already cleaned up"); dError("dnode env is already cleaned up");
return; return;
} }
monCleanup(); monCleanup();
rpcCleanup();
walCleanUp(); walCleanUp();
taosStopCacheRefreshWorker(); taosStopCacheRefreshWorker();
dInfo("dnode env is cleaned up"); dDebug("dnode env is cleaned up");
} }
void dndSetMsgHandle(SMgmtWrapper *pWrapper, int32_t msgType, NodeMsgFp nodeMsgFp, int32_t vgId) { void dndSetMsgHandle(SMgmtWrapper *pWrapper, tmsg_t msgType, NodeMsgFp nodeMsgFp, int8_t vgId) {
pWrapper->msgFps[TMSG_INDEX(msgType)] = nodeMsgFp; pWrapper->msgFps[TMSG_INDEX(msgType)] = nodeMsgFp;
pWrapper->msgVgIds[TMSG_INDEX(msgType)] = vgId; pWrapper->msgVgIds[TMSG_INDEX(msgType)] = vgId;
} }
......
...@@ -24,7 +24,7 @@ static int32_t dndInitMemory(SDnode *pDnode, const SDnodeOpt *pOption) { ...@@ -24,7 +24,7 @@ static int32_t dndInitMemory(SDnode *pDnode, const SDnodeOpt *pOption) {
pDnode->localFqdn = strdup(pOption->localFqdn); pDnode->localFqdn = strdup(pOption->localFqdn);
pDnode->firstEp = strdup(pOption->firstEp); pDnode->firstEp = strdup(pOption->firstEp);
pDnode->secondEp = strdup(pOption->secondEp); pDnode->secondEp = strdup(pOption->secondEp);
pDnode->pDisks = pOption->pDisks; pDnode->disks = pOption->disks;
pDnode->numOfDisks = pOption->numOfDisks; pDnode->numOfDisks = pOption->numOfDisks;
pDnode->ntype = pOption->ntype; pDnode->ntype = pOption->ntype;
pDnode->rebootTime = taosGetTimestampMs(); pDnode->rebootTime = taosGetTimestampMs();
...@@ -42,10 +42,10 @@ static void dndClearMemory(SDnode *pDnode) { ...@@ -42,10 +42,10 @@ static void dndClearMemory(SDnode *pDnode) {
SMgmtWrapper *pMgmt = &pDnode->wrappers[n]; SMgmtWrapper *pMgmt = &pDnode->wrappers[n];
taosMemoryFreeClear(pMgmt->path); taosMemoryFreeClear(pMgmt->path);
} }
if (pDnode->pLockFile != NULL) { if (pDnode->lockfile != NULL) {
taosUnLockFile(pDnode->pLockFile); taosUnLockFile(pDnode->lockfile);
taosCloseFile(&pDnode->pLockFile); taosCloseFile(&pDnode->lockfile);
pDnode->pLockFile = NULL; pDnode->lockfile = NULL;
} }
taosMemoryFreeClear(pDnode->localEp); taosMemoryFreeClear(pDnode->localEp);
taosMemoryFreeClear(pDnode->localFqdn); taosMemoryFreeClear(pDnode->localFqdn);
...@@ -73,8 +73,8 @@ SDnode *dndCreate(const SDnodeOpt *pOption) { ...@@ -73,8 +73,8 @@ SDnode *dndCreate(const SDnodeOpt *pOption) {
} }
dndSetStatus(pDnode, DND_STAT_INIT); dndSetStatus(pDnode, DND_STAT_INIT);
pDnode->pLockFile = dndCheckRunning(pDnode->dataDir); pDnode->lockfile = dndCheckRunning(pDnode->dataDir);
if (pDnode->pLockFile == NULL) { if (pDnode->lockfile == NULL) {
goto _OVER; goto _OVER;
} }
......
...@@ -285,7 +285,7 @@ static int32_t vmInit(SMgmtWrapper *pWrapper) { ...@@ -285,7 +285,7 @@ static int32_t vmInit(SMgmtWrapper *pWrapper) {
tstrncpy(dCfg.dir, pDnode->dataDir, TSDB_FILENAME_LEN); tstrncpy(dCfg.dir, pDnode->dataDir, TSDB_FILENAME_LEN);
dCfg.level = 0; dCfg.level = 0;
dCfg.primary = 1; dCfg.primary = 1;
SDiskCfg *pDisks = pDnode->pDisks; SDiskCfg *pDisks = pDnode->disks;
int32_t numOfDisks = pDnode->numOfDisks; int32_t numOfDisks = pDnode->numOfDisks;
if (numOfDisks <= 0 || pDisks == NULL) { if (numOfDisks <= 0 || pDisks == NULL) {
pDisks = &dCfg; pDisks = &dCfg;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册