commit
4b03430712
|
@ -275,12 +275,14 @@ void metaPauseTbCursor(SMTbCursor *pTbCur) {
|
||||||
int32_t metaResumeTbCursor(SMTbCursor *pTbCur, int8_t first, int8_t move) {
|
int32_t metaResumeTbCursor(SMTbCursor *pTbCur, int8_t first, int8_t move) {
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
int32_t lino;
|
int32_t lino;
|
||||||
|
int8_t locked = 0;
|
||||||
if (pTbCur->paused) {
|
if (pTbCur->paused) {
|
||||||
metaReaderDoInit(&pTbCur->mr, pTbCur->pMeta, META_READER_LOCK);
|
metaReaderDoInit(&pTbCur->mr, pTbCur->pMeta, META_READER_LOCK);
|
||||||
|
locked = 1;
|
||||||
code = tdbTbcOpen(((SMeta *)pTbCur->pMeta)->pUidIdx, (TBC **)&pTbCur->pDbc, NULL);
|
code = tdbTbcOpen(((SMeta *)pTbCur->pMeta)->pUidIdx, (TBC **)&pTbCur->pDbc, NULL);
|
||||||
|
if (code != 0) {
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
TSDB_CHECK_CODE(code, lino, _exit);
|
||||||
|
}
|
||||||
|
|
||||||
if (first) {
|
if (first) {
|
||||||
code = tdbTbcMoveToFirst((TBC *)pTbCur->pDbc);
|
code = tdbTbcMoveToFirst((TBC *)pTbCur->pDbc);
|
||||||
|
@ -304,6 +306,9 @@ int32_t metaResumeTbCursor(SMTbCursor *pTbCur, int8_t first, int8_t move) {
|
||||||
}
|
}
|
||||||
|
|
||||||
_exit:
|
_exit:
|
||||||
|
if (code != 0 && locked) {
|
||||||
|
metaReaderReleaseLock(&pTbCur->mr);
|
||||||
|
}
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -791,6 +796,7 @@ void metaCloseSmaCursor(SMSmaCursor *pSmaCur) {
|
||||||
if (pSmaCur->pMeta) metaULock(pSmaCur->pMeta);
|
if (pSmaCur->pMeta) metaULock(pSmaCur->pMeta);
|
||||||
if (pSmaCur->pCur) {
|
if (pSmaCur->pCur) {
|
||||||
(void)tdbTbcClose(pSmaCur->pCur);
|
(void)tdbTbcClose(pSmaCur->pCur);
|
||||||
|
pSmaCur->pCur = NULL;
|
||||||
|
|
||||||
tdbFree(pSmaCur->pKey);
|
tdbFree(pSmaCur->pKey);
|
||||||
tdbFree(pSmaCur->pVal);
|
tdbFree(pSmaCur->pVal);
|
||||||
|
@ -1307,7 +1313,8 @@ int32_t metaFilterTableIds(void *pVnode, SMetaFltParam *arg, SArray *pUids) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TAOS_CHECK_GOTO(metaCreateTagIdxKey(pCursor->suid, pCursor->cid, tagData, nTagData, pCursor->type,
|
TAOS_CHECK_GOTO(metaCreateTagIdxKey(pCursor->suid, pCursor->cid, tagData, nTagData, pCursor->type,
|
||||||
param->reverse ? INT64_MAX : INT64_MIN, &pKey, &nKey), NULL, END);
|
param->reverse ? INT64_MAX : INT64_MIN, &pKey, &nKey),
|
||||||
|
NULL, END);
|
||||||
|
|
||||||
int cmp = 0;
|
int cmp = 0;
|
||||||
TAOS_CHECK_GOTO(tdbTbcMoveTo(pCursor->pCur, pKey, nKey, &cmp), 0, END);
|
TAOS_CHECK_GOTO(tdbTbcMoveTo(pCursor->pCur, pKey, nKey, &cmp), 0, END);
|
||||||
|
|
|
@ -570,7 +570,12 @@ static SSDataBlock* sysTableScanUserCols(SOperatorInfo* pOperator) {
|
||||||
if (pInfo->pCur == NULL) {
|
if (pInfo->pCur == NULL) {
|
||||||
pInfo->pCur = pAPI->metaFn.openTableMetaCursor(pInfo->readHandle.vnode);
|
pInfo->pCur = pAPI->metaFn.openTableMetaCursor(pInfo->readHandle.vnode);
|
||||||
} else {
|
} else {
|
||||||
(void)pAPI->metaFn.resumeTableMetaCursor(pInfo->pCur, 0, 0);
|
code = pAPI->metaFn.resumeTableMetaCursor(pInfo->pCur, 0, 0);
|
||||||
|
if (code != 0) {
|
||||||
|
pAPI->metaFn.closeTableMetaCursor(pInfo->pCur);
|
||||||
|
pInfo->pCur = NULL;
|
||||||
|
QUERY_CHECK_CODE(code, lino, _end);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pInfo->pSchema == NULL) {
|
if (pInfo->pSchema == NULL) {
|
||||||
|
@ -786,7 +791,8 @@ static SSDataBlock* sysTableScanUserTags(SOperatorInfo* pOperator) {
|
||||||
pInfo->pCur = pAPI->metaFn.openTableMetaCursor(pInfo->readHandle.vnode);
|
pInfo->pCur = pAPI->metaFn.openTableMetaCursor(pInfo->readHandle.vnode);
|
||||||
QUERY_CHECK_NULL(pInfo->pCur, code, lino, _end, terrno);
|
QUERY_CHECK_NULL(pInfo->pCur, code, lino, _end, terrno);
|
||||||
} else {
|
} else {
|
||||||
(void)pAPI->metaFn.resumeTableMetaCursor(pInfo->pCur, 0, 0);
|
code = pAPI->metaFn.resumeTableMetaCursor(pInfo->pCur, 0, 0);
|
||||||
|
QUERY_CHECK_CODE(code, lino, _end);
|
||||||
}
|
}
|
||||||
|
|
||||||
while ((ret = pAPI->metaFn.cursorNext(pInfo->pCur, TSDB_SUPER_TABLE)) == 0) {
|
while ((ret = pAPI->metaFn.cursorNext(pInfo->pCur, TSDB_SUPER_TABLE)) == 0) {
|
||||||
|
@ -1589,7 +1595,12 @@ static SSDataBlock* sysTableBuildUserTables(SOperatorInfo* pOperator) {
|
||||||
firstMetaCursor = 1;
|
firstMetaCursor = 1;
|
||||||
}
|
}
|
||||||
if (!firstMetaCursor) {
|
if (!firstMetaCursor) {
|
||||||
(void)pAPI->metaFn.resumeTableMetaCursor(pInfo->pCur, 0, 1);
|
code = pAPI->metaFn.resumeTableMetaCursor(pInfo->pCur, 0, 1);
|
||||||
|
if (code != 0) {
|
||||||
|
pAPI->metaFn.closeTableMetaCursor(pInfo->pCur);
|
||||||
|
pInfo->pCur = NULL;
|
||||||
|
QUERY_CHECK_CODE(code, lino, _end);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
blockDataCleanup(pInfo->pRes);
|
blockDataCleanup(pInfo->pRes);
|
||||||
|
|
Loading…
Reference in New Issue