TD-11265 invalid write in dnode.c
This commit is contained in:
parent
b6c28a4914
commit
0d57a4beb7
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue