make compile
This commit is contained in:
parent
ba924223ed
commit
9ae3031898
|
@ -22,7 +22,7 @@ typedef struct {
|
||||||
int32_t refCount;
|
int32_t refCount;
|
||||||
int8_t dropped;
|
int8_t dropped;
|
||||||
int8_t accessState;
|
int8_t accessState;
|
||||||
SVnode *pImpl;
|
SVnode * pImpl;
|
||||||
taos_queue pWriteQ;
|
taos_queue pWriteQ;
|
||||||
taos_queue pSyncQ;
|
taos_queue pSyncQ;
|
||||||
taos_queue pApplyQ;
|
taos_queue pApplyQ;
|
||||||
|
@ -37,7 +37,7 @@ typedef struct {
|
||||||
int32_t threadIndex;
|
int32_t threadIndex;
|
||||||
pthread_t *pThreadId;
|
pthread_t *pThreadId;
|
||||||
SVnodeObj *pVnodes;
|
SVnodeObj *pVnodes;
|
||||||
SDnode *pDnode;
|
SDnode * pDnode;
|
||||||
} SVnodeThread;
|
} SVnodeThread;
|
||||||
|
|
||||||
static int32_t dndInitVnodeReadWorker(SDnode *pDnode);
|
static int32_t dndInitVnodeReadWorker(SDnode *pDnode);
|
||||||
|
@ -72,7 +72,7 @@ void dndProcessVnodeSyncMsg(SDnode *pDnode, SRpcMsg *pMsg, SEpSet *pEp
|
||||||
void dndProcessVnodeMgmtMsg(SDnode *pDnode, SRpcMsg *pMsg, SEpSet *pEpSet);
|
void dndProcessVnodeMgmtMsg(SDnode *pDnode, SRpcMsg *pMsg, SEpSet *pEpSet);
|
||||||
static int32_t dndPutMsgIntoVnodeApplyQueue(SDnode *pDnode, int32_t vgId, SVnodeMsg *pMsg);
|
static int32_t dndPutMsgIntoVnodeApplyQueue(SDnode *pDnode, int32_t vgId, SVnodeMsg *pMsg);
|
||||||
|
|
||||||
static SVnodeObj *dndAcquireVnode(SDnode *pDnode, int32_t vgId);
|
static SVnodeObj * dndAcquireVnode(SDnode *pDnode, int32_t vgId);
|
||||||
static void dndReleaseVnode(SDnode *pDnode, SVnodeObj *pVnode);
|
static void dndReleaseVnode(SDnode *pDnode, SVnodeObj *pVnode);
|
||||||
static int32_t dndCreateVnodeWrapper(SDnode *pDnode, int32_t vgId, SVnode *pImpl);
|
static int32_t dndCreateVnodeWrapper(SDnode *pDnode, int32_t vgId, SVnode *pImpl);
|
||||||
static void dndDropVnodeWrapper(SDnode *pDnode, SVnodeObj *pVnode);
|
static void dndDropVnodeWrapper(SDnode *pDnode, SVnodeObj *pVnode);
|
||||||
|
@ -94,7 +94,7 @@ static int32_t dndProcessCompactVnodeReq(SDnode *pDnode, SRpcMsg *rpcMsg);
|
||||||
|
|
||||||
static SVnodeObj *dndAcquireVnode(SDnode *pDnode, int32_t vgId) {
|
static SVnodeObj *dndAcquireVnode(SDnode *pDnode, int32_t vgId) {
|
||||||
SVnodesMgmt *pMgmt = &pDnode->vmgmt;
|
SVnodesMgmt *pMgmt = &pDnode->vmgmt;
|
||||||
SVnodeObj *pVnode = NULL;
|
SVnodeObj * pVnode = NULL;
|
||||||
int32_t refCount = 0;
|
int32_t refCount = 0;
|
||||||
|
|
||||||
taosRLockLatch(&pMgmt->latch);
|
taosRLockLatch(&pMgmt->latch);
|
||||||
|
@ -127,7 +127,7 @@ static void dndReleaseVnode(SDnode *pDnode, SVnodeObj *pVnode) {
|
||||||
|
|
||||||
static int32_t dndCreateVnodeWrapper(SDnode *pDnode, int32_t vgId, SVnode *pImpl) {
|
static int32_t dndCreateVnodeWrapper(SDnode *pDnode, int32_t vgId, SVnode *pImpl) {
|
||||||
SVnodesMgmt *pMgmt = &pDnode->vmgmt;
|
SVnodesMgmt *pMgmt = &pDnode->vmgmt;
|
||||||
SVnodeObj *pVnode = calloc(1, sizeof(SVnodeObj));
|
SVnodeObj * pVnode = calloc(1, sizeof(SVnodeObj));
|
||||||
if (pVnode == NULL) {
|
if (pVnode == NULL) {
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -201,7 +201,7 @@ static SVnodeObj **dndGetVnodesFromHash(SDnode *pDnode, int32_t *numOfVnodes) {
|
||||||
void *pIter = taosHashIterate(pMgmt->hash, NULL);
|
void *pIter = taosHashIterate(pMgmt->hash, NULL);
|
||||||
while (pIter) {
|
while (pIter) {
|
||||||
SVnodeObj **ppVnode = pIter;
|
SVnodeObj **ppVnode = pIter;
|
||||||
SVnodeObj *pVnode = *ppVnode;
|
SVnodeObj * pVnode = *ppVnode;
|
||||||
if (pVnode) {
|
if (pVnode) {
|
||||||
num++;
|
num++;
|
||||||
if (num < size) {
|
if (num < size) {
|
||||||
|
@ -223,9 +223,9 @@ static int32_t dndGetVnodesFromFile(SDnode *pDnode, SVnodeObj **ppVnodes, int32_
|
||||||
int32_t code = TSDB_CODE_DND_VNODE_READ_FILE_ERROR;
|
int32_t code = TSDB_CODE_DND_VNODE_READ_FILE_ERROR;
|
||||||
int32_t len = 0;
|
int32_t len = 0;
|
||||||
int32_t maxLen = 30000;
|
int32_t maxLen = 30000;
|
||||||
char *content = calloc(1, maxLen + 1);
|
char * content = calloc(1, maxLen + 1);
|
||||||
cJSON *root = NULL;
|
cJSON * root = NULL;
|
||||||
FILE *fp = NULL;
|
FILE * fp = NULL;
|
||||||
char file[PATH_MAX + 20] = {0};
|
char file[PATH_MAX + 20] = {0};
|
||||||
SVnodeObj *pVnodes = NULL;
|
SVnodeObj *pVnodes = NULL;
|
||||||
|
|
||||||
|
@ -270,7 +270,7 @@ static int32_t dndGetVnodesFromFile(SDnode *pDnode, SVnodeObj **ppVnodes, int32_
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int32_t i = 0; i < vnodesNum; ++i) {
|
for (int32_t i = 0; i < vnodesNum; ++i) {
|
||||||
cJSON *vnode = cJSON_GetArrayItem(vnodes, i);
|
cJSON * vnode = cJSON_GetArrayItem(vnodes, i);
|
||||||
SVnodeObj *pVnode = &pVnodes[i];
|
SVnodeObj *pVnode = &pVnodes[i];
|
||||||
|
|
||||||
cJSON *vgId = cJSON_GetObjectItem(vnode, "vgId");
|
cJSON *vgId = cJSON_GetObjectItem(vnode, "vgId");
|
||||||
|
@ -314,7 +314,7 @@ static int32_t dndWriteVnodesToFile(SDnode *pDnode) {
|
||||||
|
|
||||||
int32_t len = 0;
|
int32_t len = 0;
|
||||||
int32_t maxLen = 30000;
|
int32_t maxLen = 30000;
|
||||||
char *content = calloc(1, maxLen + 1);
|
char * content = calloc(1, maxLen + 1);
|
||||||
int32_t numOfVnodes = 0;
|
int32_t numOfVnodes = 0;
|
||||||
SVnodeObj **pVnodes = dndGetVnodesFromHash(pDnode, &numOfVnodes);
|
SVnodeObj **pVnodes = dndGetVnodesFromHash(pDnode, &numOfVnodes);
|
||||||
|
|
||||||
|
@ -392,8 +392,8 @@ static int32_t dndDropVnode(SDnode *pDnode, SVnodeObj *pVnode) {
|
||||||
|
|
||||||
static void *dnodeOpenVnodeFunc(void *param) {
|
static void *dnodeOpenVnodeFunc(void *param) {
|
||||||
SVnodeThread *pThread = param;
|
SVnodeThread *pThread = param;
|
||||||
SDnode *pDnode = pThread->pDnode;
|
SDnode * pDnode = pThread->pDnode;
|
||||||
SVnodesMgmt *pMgmt = &pDnode->vmgmt;
|
SVnodesMgmt * pMgmt = &pDnode->vmgmt;
|
||||||
|
|
||||||
dDebug("thread:%d, start to open %d vnodes", pThread->threadIndex, pThread->vnodeNum);
|
dDebug("thread:%d, start to open %d vnodes", pThread->threadIndex, pThread->vnodeNum);
|
||||||
setThreadName("open-vnodes");
|
setThreadName("open-vnodes");
|
||||||
|
@ -516,6 +516,7 @@ static int32_t dndParseCreateVnodeReq(SRpcMsg *rpcMsg, int32_t *vgId, SVnodeCfg
|
||||||
SCreateVnodeMsg *pCreate = rpcMsg->pCont;
|
SCreateVnodeMsg *pCreate = rpcMsg->pCont;
|
||||||
*vgId = htonl(pCreate->vgId);
|
*vgId = htonl(pCreate->vgId);
|
||||||
|
|
||||||
|
#if 0
|
||||||
tstrncpy(pCfg->db, pCreate->db, TSDB_FULL_DB_NAME_LEN);
|
tstrncpy(pCfg->db, pCreate->db, TSDB_FULL_DB_NAME_LEN);
|
||||||
pCfg->cacheBlockSize = htonl(pCreate->cacheBlockSize);
|
pCfg->cacheBlockSize = htonl(pCreate->cacheBlockSize);
|
||||||
pCfg->totalBlocks = htonl(pCreate->totalBlocks);
|
pCfg->totalBlocks = htonl(pCreate->totalBlocks);
|
||||||
|
@ -538,6 +539,7 @@ static int32_t dndParseCreateVnodeReq(SRpcMsg *rpcMsg, int32_t *vgId, SVnodeCfg
|
||||||
pCfg->replicas[i].port = htons(pCreate->replicas[i].port);
|
pCfg->replicas[i].port = htons(pCreate->replicas[i].port);
|
||||||
tstrncpy(pCfg->replicas[i].fqdn, pCreate->replicas[i].fqdn, TSDB_FQDN_LEN);
|
tstrncpy(pCfg->replicas[i].fqdn, pCreate->replicas[i].fqdn, TSDB_FQDN_LEN);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -727,7 +729,7 @@ static void dndProcessVnodeFetchQueue(SVnodeObj *pVnode, SVnodeMsg *pMsg) {
|
||||||
|
|
||||||
static void dndProcessVnodeWriteQueue(SVnodeObj *pVnode, taos_qall qall, int32_t numOfMsgs) {
|
static void dndProcessVnodeWriteQueue(SVnodeObj *pVnode, taos_qall qall, int32_t numOfMsgs) {
|
||||||
SVnodeMsg *pMsg = vnodeInitMsg(numOfMsgs);
|
SVnodeMsg *pMsg = vnodeInitMsg(numOfMsgs);
|
||||||
SRpcMsg *pRpcMsg = NULL;
|
SRpcMsg * pRpcMsg = NULL;
|
||||||
|
|
||||||
for (int32_t i = 0; i < numOfMsgs; ++i) {
|
for (int32_t i = 0; i < numOfMsgs; ++i) {
|
||||||
taosGetQitem(qall, (void **)&pRpcMsg);
|
taosGetQitem(qall, (void **)&pRpcMsg);
|
||||||
|
@ -993,7 +995,7 @@ static void dndFreeVnodeApplyQueue(SDnode *pDnode, SVnodeObj *pVnode) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t dndInitVnodeWriteWorker(SDnode *pDnode) {
|
static int32_t dndInitVnodeWriteWorker(SDnode *pDnode) {
|
||||||
SVnodesMgmt *pMgmt = &pDnode->vmgmt;
|
SVnodesMgmt * pMgmt = &pDnode->vmgmt;
|
||||||
SMWorkerPool *pPool = &pMgmt->writePool;
|
SMWorkerPool *pPool = &pMgmt->writePool;
|
||||||
pPool->name = "vnode-write";
|
pPool->name = "vnode-write";
|
||||||
pPool->max = tsNumOfCores;
|
pPool->max = tsNumOfCores;
|
||||||
|
@ -1031,7 +1033,7 @@ static int32_t dndInitVnodeSyncWorker(SDnode *pDnode) {
|
||||||
int32_t maxThreads = tsNumOfCores / 2;
|
int32_t maxThreads = tsNumOfCores / 2;
|
||||||
if (maxThreads < 1) maxThreads = 1;
|
if (maxThreads < 1) maxThreads = 1;
|
||||||
|
|
||||||
SVnodesMgmt *pMgmt = &pDnode->vmgmt;
|
SVnodesMgmt * pMgmt = &pDnode->vmgmt;
|
||||||
SMWorkerPool *pPool = &pMgmt->writePool;
|
SMWorkerPool *pPool = &pMgmt->writePool;
|
||||||
pPool->name = "vnode-sync";
|
pPool->name = "vnode-sync";
|
||||||
pPool->max = maxThreads;
|
pPool->max = maxThreads;
|
||||||
|
@ -1097,12 +1099,12 @@ void dndGetVnodeLoads(SDnode *pDnode, SVnodeLoads *pLoads) {
|
||||||
pLoads->num = taosHashGetSize(pMgmt->hash);
|
pLoads->num = taosHashGetSize(pMgmt->hash);
|
||||||
|
|
||||||
int32_t v = 0;
|
int32_t v = 0;
|
||||||
void *pIter = taosHashIterate(pMgmt->hash, NULL);
|
void * pIter = taosHashIterate(pMgmt->hash, NULL);
|
||||||
while (pIter) {
|
while (pIter) {
|
||||||
SVnodeObj **ppVnode = pIter;
|
SVnodeObj **ppVnode = pIter;
|
||||||
if (ppVnode == NULL || *ppVnode == NULL) continue;
|
if (ppVnode == NULL || *ppVnode == NULL) continue;
|
||||||
|
|
||||||
SVnodeObj *pVnode = *ppVnode;
|
SVnodeObj * pVnode = *ppVnode;
|
||||||
SVnodeLoad *pLoad = &pLoads->data[v++];
|
SVnodeLoad *pLoad = &pLoads->data[v++];
|
||||||
|
|
||||||
vnodeGetLoad(pVnode->pImpl, pLoad);
|
vnodeGetLoad(pVnode->pImpl, pLoad);
|
||||||
|
|
Loading…
Reference in New Issue