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

minor changes

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