diff --git a/include/dnode/mnode/mnode.h b/include/dnode/mnode/mnode.h index b7b05f896f..725bdaec3c 100644 --- a/include/dnode/mnode/mnode.h +++ b/include/dnode/mnode/mnode.h @@ -24,10 +24,10 @@ extern "C" { typedef struct SDnode SDnode; typedef struct SMnode SMnode; typedef struct SMnodeMsg SMnodeMsg; -typedef void (*SendMsgToDnodeFp)(SDnode *pDnd, struct SEpSet *epSet, struct SRpcMsg *rpcMsg); -typedef void (*SendMsgToMnodeFp)(SDnode *pDnd, struct SRpcMsg *rpcMsg); -typedef void (*SendRedirectMsgFp)(SDnode *pDnd, struct SRpcMsg *rpcMsg); -typedef int32_t (*PutMsgToMnodeQFp)(SDnode *pDnd, SMnodeMsg *pMsg); +typedef void (*SendMsgToDnodeFp)(SDnode *pDnode, struct SEpSet *epSet, struct SRpcMsg *rpcMsg); +typedef void (*SendMsgToMnodeFp)(SDnode *pDnode, struct SRpcMsg *rpcMsg); +typedef void (*SendRedirectMsgFp)(SDnode *pDnode, struct SRpcMsg *rpcMsg); +typedef int32_t (*PutMsgToMnodeQFp)(SDnode *pDnode, SMnodeMsg *pMsg); typedef struct SMnodeLoad { int64_t numOfDnode; diff --git a/include/dnode/vnode/vnode.h b/include/dnode/vnode/vnode.h index 8dc01b2a8a..3f6705fac6 100644 --- a/include/dnode/vnode/vnode.h +++ b/include/dnode/vnode/vnode.h @@ -185,10 +185,10 @@ typedef struct { } SVnodeMsg; typedef struct SDnode SDnode; -typedef void (*SendMsgToDnodeFp)(SDnode *pDnd, struct SEpSet *epSet, struct SRpcMsg *rpcMsg); -typedef void (*SendMsgToMnodeFp)(SDnode *pDnd, struct SRpcMsg *rpcMsg); -typedef void (*SendRedirectMsgFp)(SDnode *pDnd, struct SRpcMsg *rpcMsg); -typedef int32_t (*PutMsgToVnodeQFp)(SDnode *pDnd, int32_t vgId, SVnodeMsg *pMsg); +typedef void (*SendMsgToDnodeFp)(SDnode *pDnode, struct SEpSet *epSet, struct SRpcMsg *rpcMsg); +typedef void (*SendMsgToMnodeFp)(SDnode *pDnode, struct SRpcMsg *rpcMsg); +typedef void (*SendRedirectMsgFp)(SDnode *pDnode, struct SRpcMsg *rpcMsg); +typedef int32_t (*PutMsgToVnodeQFp)(SDnode *pDnode, int32_t vgId, SVnodeMsg *pMsg); typedef struct { PutMsgToVnodeQFp putMsgToApplyQueueFp; diff --git a/source/dnode/mgmt/daemon/src/daemon.c b/source/dnode/mgmt/daemon/src/daemon.c index 4d1116466c..429b097fb8 100644 --- a/source/dnode/mgmt/daemon/src/daemon.c +++ b/source/dnode/mgmt/daemon/src/daemon.c @@ -141,13 +141,13 @@ void dmnInitOption(SDnodeOpt *pOption) { pOption->shellActivityTimer = tsShellActivityTimer; pOption->statusInterval = tsStatusInterval; pOption->serverPort = tsServerPort; - tstrncpy(pOption->dataDir, tsDataDir, TSDB_EP_LEN); + tstrncpy(pOption->dataDir, tsDataDir, PATH_MAX); 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); + tstrncpy(pOption->localFqdn, tsLocalFqdn, TSDB_FQDN_LEN); + tstrncpy(pOption->firstEp, tsFirst, TSDB_EP_LEN); + tstrncpy(pOption->timezone, tsTimezone, TSDB_TIMEZONE_LEN); + tstrncpy(pOption->locale, tsLocale, TSDB_LOCALE_LEN); + tstrncpy(pOption->charset, tsCharset, TSDB_LOCALE_LEN); } int dmnRunDnode() { diff --git a/source/dnode/mgmt/impl/inc/dndDnode.h b/source/dnode/mgmt/impl/inc/dndDnode.h index 590a9611e1..4bb4cad8cc 100644 --- a/source/dnode/mgmt/impl/inc/dndDnode.h +++ b/source/dnode/mgmt/impl/inc/dndDnode.h @@ -21,16 +21,16 @@ extern "C" { #endif #include "dndInt.h" -int32_t dndInitDnode(SDnode *pDnd); -void dndCleanupDnode(SDnode *pDnd); -void dndProcessDnodeReq(SDnode *pDnd, SRpcMsg *pMsg, SEpSet *pEpSet); -void dndProcessDnodeRsp(SDnode *pDnd, SRpcMsg *pMsg, SEpSet *pEpSet); +int32_t dndInitDnode(SDnode *pDnode); +void dndCleanupDnode(SDnode *pDnode); +void dndProcessDnodeReq(SDnode *pDnode, SRpcMsg *pMsg, SEpSet *pEpSet); +void dndProcessDnodeRsp(SDnode *pDnode, SRpcMsg *pMsg, SEpSet *pEpSet); -int32_t dndGetDnodeId(SDnode *pDnd); -int64_t dndGetClusterId(SDnode *pDnd); -void dndGetDnodeEp(SDnode *pDnd, int32_t dnodeId, char *pEp, char *pFqdn, uint16_t *pPort); -void dndGetMnodeEpSet(SDnode *pDnd, SEpSet *pEpSet); -void dndSendRedirectMsg(SDnode *pDnd, SRpcMsg *pMsg); +int32_t dndGetDnodeId(SDnode *pDnode); +int64_t dndGetClusterId(SDnode *pDnode); +void dndGetDnodeEp(SDnode *pDnode, int32_t dnodeId, char *pEp, char *pFqdn, uint16_t *pPort); +void dndGetMnodeEpSet(SDnode *pDnode, SEpSet *pEpSet); +void dndSendRedirectMsg(SDnode *pDnode, SRpcMsg *pMsg); #ifdef __cplusplus } diff --git a/source/dnode/mgmt/impl/src/dndDnode.c b/source/dnode/mgmt/impl/src/dndDnode.c index fcafaf828f..ef30503494 100644 --- a/source/dnode/mgmt/impl/src/dndDnode.c +++ b/source/dnode/mgmt/impl/src/dndDnode.c @@ -480,7 +480,7 @@ int32_t dndInitDnode(SDnode *pDnode) { return -1; } - pMgmt->dnodeHash = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), true, HASH_ENTRY_LOCK); + pMgmt->dnodeHash = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), true, HASH_NO_LOCK); if (pMgmt->dnodeHash == NULL) { dError("failed to init dnode hash"); terrno = TSDB_CODE_OUT_OF_MEMORY; diff --git a/source/dnode/mgmt/impl/src/dnode.c b/source/dnode/mgmt/impl/src/dnode.c index 1261136fd3..0bfcf5d721 100644 --- a/source/dnode/mgmt/impl/src/dnode.c +++ b/source/dnode/mgmt/impl/src/dnode.c @@ -84,13 +84,13 @@ static int32_t dndInitEnv(SDnode *pDnode, SDnodeOpt *pOptions) { char path[PATH_MAX + 100]; snprintf(path, sizeof(path), "%s%smnode", pOptions->dataDir, TD_DIRSEP); - pDnode->dir.mnode = strdup(path); + pDnode->dir.mnode = tstrdup(path); snprintf(path, sizeof(path), "%s%svnode", pOptions->dataDir, TD_DIRSEP); - pDnode->dir.vnodes = strdup(path); + pDnode->dir.vnodes = tstrdup(path); snprintf(path, sizeof(path), "%s%sdnode", pOptions->dataDir, TD_DIRSEP); - pDnode->dir.dnode = strdup(path); + pDnode->dir.dnode = tstrdup(path); if (pDnode->dir.mnode == NULL || pDnode->dir.vnodes == NULL || pDnode->dir.dnode == NULL) { dError("failed to malloc dir object"); @@ -140,7 +140,7 @@ SDnode *dndInit(SDnodeOpt *pOptions) { taosBlockSIGPIPE(); taosResolveCRC(); - SDnode *pDnode = calloc(1, sizeof(pDnode)); + SDnode *pDnode = calloc(1, sizeof(SDnode)); if (pDnode == NULL) { dError("failed to create dnode object"); terrno = TSDB_CODE_OUT_OF_MEMORY; diff --git a/source/dnode/mnode/impl/inc/mnodeDef.h b/source/dnode/mnode/impl/inc/mnodeDef.h index 4b4c4abdb3..ccdba13006 100644 --- a/source/dnode/mnode/impl/inc/mnodeDef.h +++ b/source/dnode/mnode/impl/inc/mnodeDef.h @@ -131,7 +131,7 @@ typedef struct SMnodeObj { int64_t roleTime; int64_t createdTime; int64_t updateTime; - SDnodeObj *pDnd; + SDnodeObj *pDnode; } SMnodeObj; typedef struct { @@ -215,7 +215,7 @@ typedef struct SDbObj { typedef struct { int32_t dnodeId; int8_t role; - SDnodeObj *pDnd; + SDnodeObj *pDnode; } SVnodeGid; typedef struct SVgObj {