avoid invalid read/write
This commit is contained in:
parent
e2465387c6
commit
8e08d8dcc0
|
@ -3224,9 +3224,11 @@ static int32_t optSysTabFilte(void* arg, SNode* cond, SArray* result) {
|
||||||
|
|
||||||
ret = optSysTabFilteImpl(arg, cell->pNode, aRslt);
|
ret = optSysTabFilteImpl(arg, cell->pNode, aRslt);
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
|
// has index
|
||||||
hasIdx = true;
|
hasIdx = true;
|
||||||
taosArrayPush(mRslt, &aRslt);
|
taosArrayPush(mRslt, &aRslt);
|
||||||
} else if (ret == -2) {
|
} else if (ret == -2) {
|
||||||
|
// current vg
|
||||||
hasIdx = true;
|
hasIdx = true;
|
||||||
hasRslt = false;
|
hasRslt = false;
|
||||||
taosArrayDestroy(aRslt);
|
taosArrayDestroy(aRslt);
|
||||||
|
@ -3634,6 +3636,7 @@ static SSDataBlock* sysTableScanUserTables(SOperatorInfo* pOperator) {
|
||||||
doSetOperatorCompleted(pOperator);
|
doSetOperatorCompleted(pOperator);
|
||||||
return (pInfo->pRes->info.rows == 0) ? NULL : pInfo->pRes;
|
return (pInfo->pRes->info.rows == 0) ? NULL : pInfo->pRes;
|
||||||
} else {
|
} else {
|
||||||
|
if (pInfo->showRewrite == false) {
|
||||||
if (pCondition != NULL && pInfo->pIdx == NULL) {
|
if (pCondition != NULL && pInfo->pIdx == NULL) {
|
||||||
SSTabFltArg arg = {.pMeta = pInfo->readHandle.meta, .pVnode = pInfo->readHandle.vnode};
|
SSTabFltArg arg = {.pMeta = pInfo->readHandle.meta, .pVnode = pInfo->readHandle.vnode};
|
||||||
|
|
||||||
|
@ -3641,24 +3644,26 @@ static SSDataBlock* sysTableScanUserTables(SOperatorInfo* pOperator) {
|
||||||
idx->init = 0;
|
idx->init = 0;
|
||||||
idx->uids = taosArrayInit(128, sizeof(int64_t));
|
idx->uids = taosArrayInit(128, sizeof(int64_t));
|
||||||
idx->lastIdx = 0;
|
idx->lastIdx = 0;
|
||||||
pInfo->pIdx = idx;
|
|
||||||
|
|
||||||
SArray* uids = idx->uids;
|
pInfo->pIdx = idx; // set idx arg
|
||||||
|
|
||||||
int flt = optSysTabFilte(&arg, pCondition, uids);
|
int flt = optSysTabFilte(&arg, pCondition, idx->uids);
|
||||||
if (flt == 0) {
|
if (flt == 0) {
|
||||||
|
pInfo->pIdx->init = 1;
|
||||||
SSDataBlock* blk = sysTableBuildUserTablesByUids(pOperator);
|
SSDataBlock* blk = sysTableBuildUserTablesByUids(pOperator);
|
||||||
return blk;
|
return blk;
|
||||||
} else if (flt == -2) {
|
} else if (flt == -2) {
|
||||||
qDebug("%s failed to get sys table info by idx, empty result", GET_TASKID(pTaskInfo));
|
qDebug("%s failed to get sys table info by idx, empty result", GET_TASKID(pTaskInfo));
|
||||||
return NULL;
|
return NULL;
|
||||||
} else if (flt == -1) {
|
} else if (flt == -1) {
|
||||||
|
// not idx
|
||||||
qDebug("%s failed to get sys table info by idx, scan sys table one by one", GET_TASKID(pTaskInfo));
|
qDebug("%s failed to get sys table info by idx, scan sys table one by one", GET_TASKID(pTaskInfo));
|
||||||
}
|
}
|
||||||
} else if (pCondition != NULL && pInfo->pIdx != NULL) {
|
} else if (pCondition != NULL && (pInfo->pIdx != NULL && pInfo->pIdx->init == 1)) {
|
||||||
SSDataBlock* blk = sysTableBuildUserTablesByUids(pOperator);
|
SSDataBlock* blk = sysTableBuildUserTablesByUids(pOperator);
|
||||||
return blk;
|
return blk;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return sysTableBuildUserTables(pOperator);
|
return sysTableBuildUserTables(pOperator);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue