fix compile errors
This commit is contained in:
parent
cb7322de11
commit
82a72bf2be
|
@ -395,7 +395,7 @@ int32_t tscToSQLCmd(SSqlObj* pSql, struct SSqlInfo* pInfo) {
|
|||
char* pMsg = pCmd->payload + tsRpcHeadSize;
|
||||
pMsg += sizeof(SMgmtHead);
|
||||
|
||||
SCfgDnodeMsg* pCfg = (SCfgDnodeMsg*)pMsg;
|
||||
SCMCfgDnodeMsg* pCfg = (SCMCfgDnodeMsg*)pMsg;
|
||||
strncpy(pCfg->ip, pDCL->a[0].z, pDCL->a[0].n);
|
||||
|
||||
strncpy(pCfg->config, pDCL->a[1].z, pDCL->a[1].n);
|
||||
|
|
|
@ -1795,7 +1795,7 @@ int32_t tscBuildUserMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
|
|||
|
||||
int32_t tscBuildCfgDnodeMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
|
||||
SSqlCmd *pCmd = &pSql->cmd;
|
||||
pCmd->payloadLen = sizeof(SCfgDnodeMsg);
|
||||
pCmd->payloadLen = sizeof(SCMCfgDnodeMsg);
|
||||
|
||||
if (TSDB_CODE_SUCCESS != tscAllocPayload(pCmd, pCmd->payloadLen)) {
|
||||
tscError("%p failed to malloc for query msg", pSql);
|
||||
|
|
|
@ -7,7 +7,7 @@ IF ((TD_LINUX_64) OR (TD_LINUX_32 AND TD_ARM))
|
|||
INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/util/inc)
|
||||
INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/query/inc)
|
||||
INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/vnode/tsdb/inc)
|
||||
INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/vnode/common/inc)
|
||||
INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/common/inc)
|
||||
INCLUDE_DIRECTORIES(${TD_ENTERPRISE_DIR}/src/inc)
|
||||
INCLUDE_DIRECTORIES(inc)
|
||||
AUX_SOURCE_DIRECTORY(src SRC)
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include "tlog.h"
|
||||
#include "trpc.h"
|
||||
#include "tstatus.h"
|
||||
//#include "tsdb.h"
|
||||
#include "tsdb.h"
|
||||
#include "dnodeMgmt.h"
|
||||
#include "dnodeRead.h"
|
||||
#include "dnodeWrite.h"
|
||||
|
@ -139,111 +139,111 @@ static void dnodeCleanupVnodes() {
|
|||
}
|
||||
|
||||
static int32_t dnodeOpenVnode(int32_t vgId) {
|
||||
// char rootDir[TSDB_FILENAME_LEN] = {0};
|
||||
// sprintf(rootDir, "%s/vnode%d", tsDirectory, vgId);
|
||||
//
|
||||
// void *pTsdb = tsdbOpenRepo(rootDir);
|
||||
// if (pTsdb != NULL) {
|
||||
// return terrno;
|
||||
// }
|
||||
//
|
||||
// SVnodeObj vnodeObj;
|
||||
// vnodeObj.vgId = vgId;
|
||||
// vnodeObj.status = TSDB_VN_STATUS_NOT_READY;
|
||||
// vnodeObj.refCount = 1;
|
||||
// vnodeObj.version = 0;
|
||||
// vnodeObj.wworker = dnodeAllocateWriteWorker();
|
||||
// vnodeObj.rworker = dnodeAllocateReadWorker();
|
||||
// vnodeObj.wal = NULL;
|
||||
// vnodeObj.tsdb = pTsdb;
|
||||
// vnodeObj.replica = NULL;
|
||||
// vnodeObj.events = NULL;
|
||||
// vnodeObj.cq = NULL;
|
||||
//
|
||||
// taosAddIntHash(tsDnodeVnodesHash, vnodeObj.vgId, &vnodeObj);
|
||||
char rootDir[TSDB_FILENAME_LEN] = {0};
|
||||
sprintf(rootDir, "%s/vnode%d", tsDirectory, vgId);
|
||||
|
||||
void *pTsdb = tsdbOpenRepo(rootDir);
|
||||
if (pTsdb != NULL) {
|
||||
return terrno;
|
||||
}
|
||||
|
||||
SVnodeObj vnodeObj;
|
||||
vnodeObj.vgId = vgId;
|
||||
vnodeObj.status = TSDB_VN_STATUS_NOT_READY;
|
||||
vnodeObj.refCount = 1;
|
||||
vnodeObj.version = 0;
|
||||
vnodeObj.wworker = dnodeAllocateWriteWorker();
|
||||
vnodeObj.rworker = dnodeAllocateReadWorker();
|
||||
vnodeObj.wal = NULL;
|
||||
vnodeObj.tsdb = pTsdb;
|
||||
vnodeObj.replica = NULL;
|
||||
vnodeObj.events = NULL;
|
||||
vnodeObj.cq = NULL;
|
||||
|
||||
taosAddIntHash(tsDnodeVnodesHash, vnodeObj.vgId, &vnodeObj);
|
||||
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
static void dnodeCleanupVnode(SVnodeObj *pVnode) {
|
||||
// pVnode->status = TSDB_VN_STATUS_NOT_READY;
|
||||
// int32_t count = atomic_sub_fetch_32(&pVnode->refCount, 1);
|
||||
// if (count > 0) {
|
||||
// // wait refcount
|
||||
// }
|
||||
//
|
||||
// // remove replica
|
||||
//
|
||||
// // remove read queue
|
||||
// dnodeFreeReadWorker(pVnode->rworker);
|
||||
// pVnode->rworker = NULL;
|
||||
//
|
||||
// // remove write queue
|
||||
// dnodeFreeWriteWorker(pVnode->wworker);
|
||||
// pVnode->wworker = NULL;
|
||||
//
|
||||
// // remove wal
|
||||
//
|
||||
// // remove tsdb
|
||||
// if (pVnode->tsdb) {
|
||||
// tsdbCloseRepo(pVnode->tsdb);
|
||||
// pVnode->tsdb = NULL;
|
||||
// }
|
||||
//
|
||||
// taosDeleteIntHash(tsDnodeVnodesHash, pVnode->vgId);
|
||||
pVnode->status = TSDB_VN_STATUS_NOT_READY;
|
||||
int32_t count = atomic_sub_fetch_32(&pVnode->refCount, 1);
|
||||
if (count > 0) {
|
||||
// wait refcount
|
||||
}
|
||||
|
||||
// remove replica
|
||||
|
||||
// remove read queue
|
||||
dnodeFreeReadWorker(pVnode->rworker);
|
||||
pVnode->rworker = NULL;
|
||||
|
||||
// remove write queue
|
||||
dnodeFreeWriteWorker(pVnode->wworker);
|
||||
pVnode->wworker = NULL;
|
||||
|
||||
// remove wal
|
||||
|
||||
// remove tsdb
|
||||
if (pVnode->tsdb) {
|
||||
tsdbCloseRepo(pVnode->tsdb);
|
||||
pVnode->tsdb = NULL;
|
||||
}
|
||||
|
||||
taosDeleteIntHash(tsDnodeVnodesHash, pVnode->vgId);
|
||||
}
|
||||
|
||||
static int32_t dnodeCreateVnode(SMDCreateVnodeMsg *pVnodeCfg) {
|
||||
// STsdbCfg tsdbCfg;
|
||||
// tsdbCfg.precision = pVnodeCfg->cfg.precision;
|
||||
// tsdbCfg.tsdbId = pVnodeCfg->vnode;
|
||||
// tsdbCfg.maxTables = pVnodeCfg->cfg.maxSessions;
|
||||
// tsdbCfg.daysPerFile = pVnodeCfg->cfg.daysPerFile;
|
||||
// tsdbCfg.minRowsPerFileBlock = -1;
|
||||
// tsdbCfg.maxRowsPerFileBlock = -1;
|
||||
// tsdbCfg.keep = -1;
|
||||
// tsdbCfg.maxCacheSize = -1;
|
||||
STsdbCfg tsdbCfg;
|
||||
tsdbCfg.precision = pVnodeCfg->cfg.precision;
|
||||
tsdbCfg.tsdbId = pVnodeCfg->vnode;
|
||||
tsdbCfg.maxTables = pVnodeCfg->cfg.maxSessions;
|
||||
tsdbCfg.daysPerFile = pVnodeCfg->cfg.daysPerFile;
|
||||
tsdbCfg.minRowsPerFileBlock = -1;
|
||||
tsdbCfg.maxRowsPerFileBlock = -1;
|
||||
tsdbCfg.keep = -1;
|
||||
tsdbCfg.maxCacheSize = -1;
|
||||
|
||||
// char rootDir[TSDB_FILENAME_LEN] = {0};
|
||||
// sprintf(rootDir, "%s/vnode%d", tsDirectory, pVnodeCfg->cfg.vgId);
|
||||
//
|
||||
// void *pTsdb = tsdbCreateRepo(rootDir, &tsdbCfg, NULL);
|
||||
// if (pTsdb != NULL) {
|
||||
// return terrno;
|
||||
// }
|
||||
//
|
||||
// SVnodeObj vnodeObj;
|
||||
// vnodeObj.vgId = pVnodeCfg->cfg.vgId;
|
||||
// vnodeObj.status = TSDB_VN_STATUS_NOT_READY;
|
||||
// vnodeObj.refCount = 1;
|
||||
// vnodeObj.version = 0;
|
||||
// vnodeObj.wworker = dnodeAllocateWriteWorker();
|
||||
// vnodeObj.rworker = dnodeAllocateReadWorker();
|
||||
// vnodeObj.wal = NULL;
|
||||
// vnodeObj.tsdb = pTsdb;
|
||||
// vnodeObj.replica = NULL;
|
||||
// vnodeObj.events = NULL;
|
||||
// vnodeObj.cq = NULL;
|
||||
//
|
||||
// taosAddIntHash(tsDnodeVnodesHash, vnodeObj.vgId, &vnodeObj);
|
||||
char rootDir[TSDB_FILENAME_LEN] = {0};
|
||||
sprintf(rootDir, "%s/vnode%d", tsDirectory, pVnodeCfg->cfg.vgId);
|
||||
|
||||
void *pTsdb = tsdbCreateRepo(rootDir, &tsdbCfg, NULL);
|
||||
if (pTsdb != NULL) {
|
||||
return terrno;
|
||||
}
|
||||
|
||||
SVnodeObj vnodeObj;
|
||||
vnodeObj.vgId = pVnodeCfg->cfg.vgId;
|
||||
vnodeObj.status = TSDB_VN_STATUS_NOT_READY;
|
||||
vnodeObj.refCount = 1;
|
||||
vnodeObj.version = 0;
|
||||
vnodeObj.wworker = dnodeAllocateWriteWorker();
|
||||
vnodeObj.rworker = dnodeAllocateReadWorker();
|
||||
vnodeObj.wal = NULL;
|
||||
vnodeObj.tsdb = pTsdb;
|
||||
vnodeObj.replica = NULL;
|
||||
vnodeObj.events = NULL;
|
||||
vnodeObj.cq = NULL;
|
||||
|
||||
taosAddIntHash(tsDnodeVnodesHash, vnodeObj.vgId, &vnodeObj);
|
||||
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
static void dnodeDropVnode(SVnodeObj *pVnode) {
|
||||
// pVnode->status = TSDB_VN_STATUS_NOT_READY;
|
||||
//
|
||||
// int32_t count = atomic_sub_fetch_32(&pVnode->refCount, 1);
|
||||
// if (count > 0) {
|
||||
// // wait refcount
|
||||
// }
|
||||
//
|
||||
// if (pVnode->tsdb) {
|
||||
// tsdbDropRepo(pVnode->tsdb);
|
||||
// pVnode->tsdb = NULL;
|
||||
// }
|
||||
//
|
||||
// dnodeCleanupVnode(pVnode);
|
||||
pVnode->status = TSDB_VN_STATUS_NOT_READY;
|
||||
|
||||
int32_t count = atomic_sub_fetch_32(&pVnode->refCount, 1);
|
||||
if (count > 0) {
|
||||
// wait refcount
|
||||
}
|
||||
|
||||
if (pVnode->tsdb) {
|
||||
tsdbDropRepo(pVnode->tsdb);
|
||||
pVnode->tsdb = NULL;
|
||||
}
|
||||
|
||||
dnodeCleanupVnode(pVnode);
|
||||
}
|
||||
|
||||
static void dnodeProcesSMDCreateVnodeMsg(SRpcMsg *rpcMsg) {
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
*/
|
||||
|
||||
#define _DEFAULT_SOURCE
|
||||
#include "os.h"
|
||||
#include "mgmtMnode.h"
|
||||
|
||||
bool mgmtCheckRedirect(void *handle) {
|
||||
|
|
|
@ -96,7 +96,7 @@ void mgmtCleanUpShell() {
|
|||
}
|
||||
}
|
||||
|
||||
void mgmtAddShellHandle(uint8_t showType, void (*fp)(SRpcMsg *rpcMsg)) {
|
||||
void mgmtAddShellMsgHandle(uint8_t showType, void (*fp)(SRpcMsg *rpcMsg)) {
|
||||
tsMgmtProcessShellMsgFp[showType] = fp;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue