提交 c37671f3 编写于 作者: 陶建辉(Jeff)'s avatar 陶建辉(Jeff)

renanme function

上级 a58e2164
...@@ -416,7 +416,7 @@ static void* dnodeParseVnodeMsg(SRpcMsg *rpcMsg) { ...@@ -416,7 +416,7 @@ static void* dnodeParseVnodeMsg(SRpcMsg *rpcMsg) {
static int32_t dnodeProcessCreateVnodeMsg(SRpcMsg *rpcMsg) { static int32_t dnodeProcessCreateVnodeMsg(SRpcMsg *rpcMsg) {
SMDCreateVnodeMsg *pCreate = dnodeParseVnodeMsg(rpcMsg); SMDCreateVnodeMsg *pCreate = dnodeParseVnodeMsg(rpcMsg);
void *pVnode = vnodeAcquireVnode(pCreate->cfg.vgId); void *pVnode = vnodeAcquire(pCreate->cfg.vgId);
if (pVnode != NULL) { if (pVnode != NULL) {
dDebug("vgId:%d, already exist, return success", pCreate->cfg.vgId); dDebug("vgId:%d, already exist, return success", pCreate->cfg.vgId);
vnodeRelease(pVnode); vnodeRelease(pVnode);
...@@ -430,7 +430,7 @@ static int32_t dnodeProcessCreateVnodeMsg(SRpcMsg *rpcMsg) { ...@@ -430,7 +430,7 @@ static int32_t dnodeProcessCreateVnodeMsg(SRpcMsg *rpcMsg) {
static int32_t dnodeProcessAlterVnodeMsg(SRpcMsg *rpcMsg) { static int32_t dnodeProcessAlterVnodeMsg(SRpcMsg *rpcMsg) {
SMDAlterVnodeMsg *pAlter = dnodeParseVnodeMsg(rpcMsg); SMDAlterVnodeMsg *pAlter = dnodeParseVnodeMsg(rpcMsg);
void *pVnode = vnodeAcquireVnode(pAlter->cfg.vgId); void *pVnode = vnodeAcquire(pAlter->cfg.vgId);
if (pVnode != NULL) { if (pVnode != NULL) {
dDebug("vgId:%d, alter vnode msg is received", pAlter->cfg.vgId); dDebug("vgId:%d, alter vnode msg is received", pAlter->cfg.vgId);
int32_t code = vnodeAlter(pVnode, pAlter); int32_t code = vnodeAlter(pVnode, pAlter);
......
...@@ -48,11 +48,10 @@ int32_t vnodeStartStream(int32_t vgId); ...@@ -48,11 +48,10 @@ int32_t vnodeStartStream(int32_t vgId);
int32_t vnodeAlter(void *pVnode, SMDCreateVnodeMsg *pVnodeCfg); int32_t vnodeAlter(void *pVnode, SMDCreateVnodeMsg *pVnodeCfg);
int32_t vnodeClose(int32_t vgId); int32_t vnodeClose(int32_t vgId);
void* vnodeAcquireVnode(int32_t vgId); // add refcount void* vnodeAcquire(int32_t vgId); // add refcount
void vnodeRelease(void *pVnode); void* vnodeAcquireRqueue(int32_t vgId); // add refCount, get read queue
void* vnodeAcquireWqueue(int32_t vgId); // add recCount, get write queue
void* vnodeAcquireRqueue(int32_t vgId); void vnodeRelease(void *pVnode); // dec refCount
void* vnodeAcquireWqueue(int32_t vgId);
void* vnodeGetWal(void *pVnode); void* vnodeGetWal(void *pVnode);
int32_t vnodeProcessWrite(void *pVnode, int qtype, void *pHead, void *item); int32_t vnodeProcessWrite(void *pVnode, int qtype, void *pHead, void *item);
......
...@@ -314,7 +314,7 @@ int32_t vnodeOpen(int32_t vnode, char *rootDir) { ...@@ -314,7 +314,7 @@ int32_t vnodeOpen(int32_t vnode, char *rootDir) {
} }
int32_t vnodeStartStream(int32_t vnode) { int32_t vnodeStartStream(int32_t vnode) {
SVnodeObj* pVnode = vnodeAcquireVnode(vnode); SVnodeObj* pVnode = vnodeAcquire(vnode);
if (pVnode != NULL) { if (pVnode != NULL) {
tsdbStartStream(pVnode->tsdb); tsdbStartStream(pVnode->tsdb);
vnodeRelease(pVnode); vnodeRelease(pVnode);
...@@ -387,7 +387,7 @@ void vnodeRelease(void *pVnodeRaw) { ...@@ -387,7 +387,7 @@ void vnodeRelease(void *pVnodeRaw) {
vDebug("vgId:%d, vnode is released, vnodes:%d", vgId, count); vDebug("vgId:%d, vnode is released, vnodes:%d", vgId, count);
} }
void *vnodeAcquireVnode(int32_t vgId) { void *vnodeAcquire(int32_t vgId) {
SVnodeObj **ppVnode = (SVnodeObj **)taosHashGet(tsDnodeVnodesHash, (const char *)&vgId, sizeof(int32_t)); SVnodeObj **ppVnode = (SVnodeObj **)taosHashGet(tsDnodeVnodesHash, (const char *)&vgId, sizeof(int32_t));
if (ppVnode == NULL || *ppVnode == NULL) { if (ppVnode == NULL || *ppVnode == NULL) {
terrno = TSDB_CODE_VND_INVALID_VGROUP_ID; terrno = TSDB_CODE_VND_INVALID_VGROUP_ID;
...@@ -403,7 +403,7 @@ void *vnodeAcquireVnode(int32_t vgId) { ...@@ -403,7 +403,7 @@ void *vnodeAcquireVnode(int32_t vgId) {
} }
void *vnodeAcquireRqueue(int32_t vgId) { void *vnodeAcquireRqueue(int32_t vgId) {
SVnodeObj *pVnode = vnodeAcquireVnode(vgId); SVnodeObj *pVnode = vnodeAcquire(vgId);
if (pVnode == NULL) return NULL; if (pVnode == NULL) return NULL;
if (pVnode->status == TAOS_VN_STATUS_RESET) { if (pVnode->status == TAOS_VN_STATUS_RESET) {
...@@ -417,7 +417,7 @@ void *vnodeAcquireRqueue(int32_t vgId) { ...@@ -417,7 +417,7 @@ void *vnodeAcquireRqueue(int32_t vgId) {
} }
void *vnodeAcquireWqueue(int32_t vgId) { void *vnodeAcquireWqueue(int32_t vgId) {
SVnodeObj *pVnode = vnodeAcquireVnode(vgId); SVnodeObj *pVnode = vnodeAcquire(vgId);
if (pVnode == NULL) return NULL; if (pVnode == NULL) return NULL;
if (pVnode->status == TAOS_VN_STATUS_RESET) { if (pVnode->status == TAOS_VN_STATUS_RESET) {
...@@ -498,7 +498,7 @@ void vnodeBuildStatusMsg(void *param) { ...@@ -498,7 +498,7 @@ void vnodeBuildStatusMsg(void *param) {
void vnodeSetAccess(SDMVgroupAccess *pAccess, int32_t numOfVnodes) { void vnodeSetAccess(SDMVgroupAccess *pAccess, int32_t numOfVnodes) {
for (int32_t i = 0; i < numOfVnodes; ++i) { for (int32_t i = 0; i < numOfVnodes; ++i) {
pAccess[i].vgId = htonl(pAccess[i].vgId); pAccess[i].vgId = htonl(pAccess[i].vgId);
SVnodeObj *pVnode = vnodeAcquireVnode(pAccess[i].vgId); SVnodeObj *pVnode = vnodeAcquire(pAccess[i].vgId);
if (pVnode != NULL) { if (pVnode != NULL) {
pVnode->accessState = pAccess[i].accessState; pVnode->accessState = pAccess[i].accessState;
if (pVnode->accessState != TSDB_VN_ALL_ACCCESS) { if (pVnode->accessState != TSDB_VN_ALL_ACCCESS) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册