fix(query): return correct suid to delete sink.

This commit is contained in:
Haojun Liao 2023-04-17 10:59:24 +08:00
parent ac137b4b33
commit eb7f510ccb
4 changed files with 18 additions and 12 deletions

View File

@ -29,7 +29,6 @@ extern "C" {
#define DS_BUF_FULL 2 #define DS_BUF_FULL 2
#define DS_BUF_EMPTY 3 #define DS_BUF_EMPTY 3
struct SDataSink;
struct SSDataBlock; struct SSDataBlock;
typedef struct SDeleterRes { typedef struct SDeleterRes {

View File

@ -35,8 +35,11 @@ struct STableListInfo {
int32_t* groupOffset; // keep the offset value for each group in the tableList int32_t* groupOffset; // keep the offset value for each group in the tableList
SArray* pTableList; SArray* pTableList;
SHashObj* map; // speedup acquire the tableQueryInfo by table uid SHashObj* map; // speedup acquire the tableQueryInfo by table uid
uint64_t suid; union {
int32_t tableType; // queried table type uint64_t suid;
uint64_t uid;
}; // this maybe the super table or ordinary table
int32_t tableType; // queried table type
}; };
typedef struct tagFilterAssist { typedef struct tagFilterAssist {
@ -1033,8 +1036,7 @@ int32_t getTableList(void* metaHandle, void* pVnode, SScanPhysiNode* pScanNode,
SIdxFltStatus status = SFLT_NOT_INDEX; SIdxFltStatus status = SFLT_NOT_INDEX;
if (pScanNode->tableType != TSDB_SUPER_TABLE) { if (pScanNode->tableType != TSDB_SUPER_TABLE) {
pListInfo->suid = pScanNode->uid; pListInfo->uid = pScanNode->uid;
if (metaIsTableExist(metaHandle, pScanNode->uid)) { if (metaIsTableExist(metaHandle, pScanNode->uid)) {
taosArrayPush(pUidList, &pScanNode->uid); taosArrayPush(pUidList, &pScanNode->uid);
} }
@ -1798,7 +1800,13 @@ uint64_t tableListGetSize(const STableListInfo* pTableList) {
return taosArrayGetSize(pTableList->pTableList); return taosArrayGetSize(pTableList->pTableList);
} }
uint64_t tableListGetSuid(const STableListInfo* pTableList) { return pTableList->suid; } uint64_t tableListGetSuid(const STableListInfo* pTableList) {
if (pTableList->tableType == TSDB_SUPER_TABLE) {
return pTableList->suid;
} else { // query normal table, no suid exists.
return 0;
}
}
STableKeyInfo* tableListGetInfo(const STableListInfo* pTableList, int32_t index) { STableKeyInfo* tableListGetInfo(const STableListInfo* pTableList, int32_t index) {
if (taosArrayGetSize(pTableList->pTableList) == 0) { if (taosArrayGetSize(pTableList->pTableList) == 0) {

View File

@ -330,10 +330,9 @@ static SArray* filterUnqualifiedTables(const SStreamScanInfo* pScanInfo, const S
STableScanInfo* pTableScanInfo = pScanInfo->pTableScanOp->info; STableScanInfo* pTableScanInfo = pScanInfo->pTableScanOp->info;
uint64_t suid = 0; uint64_t uid = 0;
int32_t type = 0; int32_t type = 0;
tableListGetSourceTableInfo(pTableScanInfo->base.pTableListInfo, &suid, &type); tableListGetSourceTableInfo(pTableScanInfo->base.pTableListInfo, &uid, &type);
int32_t numOfExisted = tableListGetSize(pTableScanInfo->base.pTableListInfo);
// let's discard the tables those are not created according to the queried super table. // let's discard the tables those are not created according to the queried super table.
SMetaReader mr = {0}; SMetaReader mr = {0};
@ -354,13 +353,13 @@ static SArray* filterUnqualifiedTables(const SStreamScanInfo* pScanInfo, const S
} else { } else {
if (type == TSDB_SUPER_TABLE) { if (type == TSDB_SUPER_TABLE) {
// this new created child table does not belong to the scanned super table. // this new created child table does not belong to the scanned super table.
if (mr.me.type != TSDB_CHILD_TABLE || mr.me.ctbEntry.suid != suid) { if (mr.me.type != TSDB_CHILD_TABLE || mr.me.ctbEntry.suid != uid) {
continue; continue;
} }
} else { // ordinary table } else { // ordinary table
// In case that the scanned target table is an ordinary table. When replay the WAL during restore the vnode, we // In case that the scanned target table is an ordinary table. When replay the WAL during restore the vnode, we
// should check all newly created ordinary table to make sure that this table isn't the destination table. // should check all newly created ordinary table to make sure that this table isn't the destination table.
if (mr.me.uid != suid) { if (mr.me.uid != uid) {
continue; continue;
} }
} }

View File

@ -690,7 +690,7 @@ static SSDataBlock* doTableScanImpl(SOperatorInfo* pOperator) {
} }
uint32_t status = 0; uint32_t status = 0;
int32_t code = loadDataBlock(pOperator, &pTableScanInfo->base, pBlock, &status); code = loadDataBlock(pOperator, &pTableScanInfo->base, pBlock, &status);
if (code != TSDB_CODE_SUCCESS) { if (code != TSDB_CODE_SUCCESS) {
T_LONG_JMP(pTaskInfo->env, code); T_LONG_JMP(pTaskInfo->env, code);
} }