avoid sma and tag index name conflict
This commit is contained in:
parent
55a93c9649
commit
b3167ae6a3
|
@ -28,7 +28,7 @@ typedef struct SSIdx {
|
|||
void *pIdx;
|
||||
} SSIdx;
|
||||
|
||||
int32_t mndCheckIdxExist(SMnode *pMnode, char *name, int type, SSIdx *idx);
|
||||
int32_t mndAcquireGlobalIdx(SMnode *pMnode, char *name, int type, SSIdx *idx);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -417,7 +417,7 @@ static int32_t mndProcessCreateIdxReq(SRpcMsg *pReq) {
|
|||
goto _OVER;
|
||||
}
|
||||
SSIdx idx = {0};
|
||||
if (mndCheckIdxExist(pMnode, createReq.idxName, SDB_IDX, &idx) == 0) {
|
||||
if (mndAcquireGlobalIdx(pMnode, createReq.idxName, SDB_IDX, &idx) == 0) {
|
||||
pIdx = idx.pIdx;
|
||||
}
|
||||
if (pIdx != NULL) {
|
||||
|
@ -884,7 +884,7 @@ int32_t mndProcessDropTagIdxReq(SRpcMsg *pReq) {
|
|||
}
|
||||
mInfo("idx:%s, start to drop", req.name);
|
||||
SSIdx idx = {0};
|
||||
if (mndCheckIdxExist(pMnode, req.name, SDB_IDX, &idx) == 0) {
|
||||
if (mndAcquireGlobalIdx(pMnode, req.name, SDB_IDX, &idx) == 0) {
|
||||
pIdx = idx.pIdx;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,10 +26,12 @@ static void *mndGetIdx(SMnode *pMnode, char *name, int type) {
|
|||
return pIdx;
|
||||
}
|
||||
|
||||
int mndCheckIdxExist(SMnode *pMnode, char *name, int type, SSIdx *idx) {
|
||||
int mndAcquireGlobalIdx(SMnode *pMnode, char *name, int type, SSIdx *idx) {
|
||||
SSmaObj *pSma = mndGetIdx(pMnode, name, SDB_SMA);
|
||||
SIdxObj *pIdx = mndGetIdx(pMnode, name, SDB_IDX);
|
||||
|
||||
terrno = 0;
|
||||
|
||||
if (pSma == NULL && pIdx == NULL) return 0;
|
||||
|
||||
if (pSma != NULL) {
|
||||
|
@ -40,11 +42,11 @@ int mndCheckIdxExist(SMnode *pMnode, char *name, int type, SSIdx *idx) {
|
|||
mndReleaseSma(pMnode, pSma);
|
||||
}
|
||||
} else {
|
||||
if (type == SDB_SMA) {
|
||||
mndReleaseIdx(pMnode, pIdx);
|
||||
} else {
|
||||
if (type == SDB_IDX) {
|
||||
idx->type = SDB_IDX;
|
||||
idx->pIdx = pIdx;
|
||||
} else {
|
||||
mndReleaseIdx(pMnode, pIdx);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
|
|
@ -737,7 +737,7 @@ static int32_t mndProcessCreateSmaReq(SRpcMsg *pReq) {
|
|||
goto _OVER;
|
||||
}
|
||||
SSIdx idx = {0};
|
||||
if (mndCheckIdxExist(pMnode, createReq.name, SDB_SMA, &idx) == 0) {
|
||||
if (mndAcquireGlobalIdx(pMnode, createReq.name, SDB_SMA, &idx) == 0) {
|
||||
pSma = idx.pIdx;
|
||||
}
|
||||
|
||||
|
@ -987,7 +987,7 @@ static int32_t mndProcessDropSmaReq(SRpcMsg *pReq) {
|
|||
mInfo("sma:%s, start to drop", dropReq.name);
|
||||
|
||||
SSIdx idx = {0};
|
||||
if (mndCheckIdxExist(pMnode, dropReq.name, SDB_SMA, &idx) == 0) {
|
||||
if (mndAcquireGlobalIdx(pMnode, dropReq.name, SDB_SMA, &idx) == 0) {
|
||||
pSma = idx.pIdx;
|
||||
}
|
||||
if (pSma == NULL) {
|
||||
|
@ -1028,7 +1028,11 @@ static int32_t mndGetSma(SMnode *pMnode, SUserIndexReq *indexReq, SUserIndexRsp
|
|||
int32_t code = -1;
|
||||
SSmaObj *pSma = NULL;
|
||||
|
||||
pSma = mndAcquireSma(pMnode, indexReq->indexFName);
|
||||
SSIdx idx = {0};
|
||||
if (0 == mndAcquireGlobalIdx(pMnode, indexReq->indexFName, SDB_SMA, &idx)) {
|
||||
pSma = idx.pIdx;
|
||||
}
|
||||
|
||||
if (pSma == NULL) {
|
||||
*exist = false;
|
||||
return 0;
|
||||
|
|
Loading…
Reference in New Issue