fix:<TD-18803> taosX core dump if schema is null
This commit is contained in:
parent
713488098d
commit
796342dabb
|
@ -184,7 +184,6 @@ typedef struct SQueryTableDataCond {
|
|||
STimeWindow twindows;
|
||||
int64_t startVersion;
|
||||
int64_t endVersion;
|
||||
int64_t schemaVersion;
|
||||
} SQueryTableDataCond;
|
||||
|
||||
int32_t tEncodeDataBlock(void** buf, const SSDataBlock* pBlock);
|
||||
|
|
|
@ -765,6 +765,7 @@ static int32_t taosCreateTable(TAOS* taos, void* meta, int32_t metaLen) {
|
|||
}
|
||||
taosArrayPush(pRequest->tableList, &pName);
|
||||
|
||||
pCreateReq->flags |= TD_CREATE_IF_NOT_EXISTS;
|
||||
// change tag cid to new cid
|
||||
if(pCreateReq->type == TSDB_CHILD_TABLE){
|
||||
STableMeta* pTableMeta = NULL;
|
||||
|
|
|
@ -280,6 +280,38 @@ _query:
|
|||
tDecoderClear(&dc);
|
||||
goto _exit;
|
||||
}
|
||||
{ // Traverse to find the previous qualified data
|
||||
TBC *pCur;
|
||||
tdbTbcOpen(pMeta->pTbDb, &pCur, NULL);
|
||||
STbDbKey key = {.version = sver, .uid = INT64_MAX};
|
||||
int c = 0;
|
||||
tdbTbcMoveTo(pCur, &key, sizeof(key), &c);
|
||||
if(c < 0){
|
||||
tdbTbcMoveToPrev(pCur);
|
||||
}
|
||||
|
||||
void *pKey = NULL;
|
||||
void *pVal = NULL;
|
||||
int vLen = 0, kLen = 0;
|
||||
while(1){
|
||||
int32_t ret = tdbTbcPrev(pCur, &pKey, &kLen, &pVal, &vLen);
|
||||
if (ret < 0) break;
|
||||
|
||||
STbDbKey *tmp = (STbDbKey*)pKey;
|
||||
if(tmp->uid != uid){
|
||||
continue;
|
||||
}
|
||||
SDecoder dcNew = {0};
|
||||
SMetaEntry meNew = {0};
|
||||
tDecoderInit(&dcNew, pVal, vLen);
|
||||
metaDecodeEntry(&dcNew, &meNew);
|
||||
pSchema = tCloneSSchemaWrapper(&meNew.stbEntry.schemaRow);
|
||||
tDecoderClear(&dcNew);
|
||||
tdbTbcClose(pCur);
|
||||
goto _exit;
|
||||
}
|
||||
tdbTbcClose(pCur);
|
||||
}
|
||||
} else if (me.type == TSDB_CHILD_TABLE) {
|
||||
uid = me.ctbEntry.suid;
|
||||
tDecoderClear(&dc);
|
||||
|
|
|
@ -3349,10 +3349,10 @@ int32_t tsdbReaderOpen(SVnode* pVnode, SQueryTableDataCond* pCond, SArray* pTabl
|
|||
}
|
||||
|
||||
if (pCond->suid != 0) {
|
||||
pReader->pSchema = metaGetTbTSchema(pReader->pTsdb->pVnode->pMeta, pReader->suid, pCond->schemaVersion);
|
||||
pReader->pSchema = metaGetTbTSchema(pReader->pTsdb->pVnode->pMeta, pReader->suid, pCond->endVersion);
|
||||
} else if (taosArrayGetSize(pTableList) > 0) {
|
||||
STableKeyInfo* pKey = taosArrayGet(pTableList, 0);
|
||||
pReader->pSchema = metaGetTbTSchema(pReader->pTsdb->pVnode->pMeta, pKey->uid, pCond->schemaVersion);
|
||||
pReader->pSchema = metaGetTbTSchema(pReader->pTsdb->pVnode->pMeta, pKey->uid, pCond->endVersion);
|
||||
}
|
||||
|
||||
int32_t numOfTables = taosArrayGetSize(pTableList);
|
||||
|
|
|
@ -1300,7 +1300,6 @@ int32_t initQueryTableDataCond(SQueryTableDataCond* pCond, const STableScanPhysi
|
|||
pCond->type = TIMEWINDOW_RANGE_CONTAINED;
|
||||
pCond->startVersion = -1;
|
||||
pCond->endVersion = -1;
|
||||
pCond->schemaVersion = -1;
|
||||
// pCond->type = pTableScanNode->scanFlag;
|
||||
|
||||
int32_t j = 0;
|
||||
|
|
|
@ -729,7 +729,6 @@ int32_t initQueryTableDataCondForTmq(SQueryTableDataCond* pCond, SSnapContext* s
|
|||
pCond->type = TIMEWINDOW_RANGE_CONTAINED;
|
||||
pCond->startVersion = -1;
|
||||
pCond->endVersion = sContext->snapVersion;
|
||||
pCond->schemaVersion = sContext->snapVersion;
|
||||
|
||||
for (int32_t i = 0; i < pCond->numOfCols; ++i) {
|
||||
pCond->colList[i].type = mtInfo.schema->pSchema[i].type;
|
||||
|
|
|
@ -3908,7 +3908,6 @@ static int32_t initTableblockDistQueryCond(uint64_t uid, SQueryTableDataCond* pC
|
|||
pCond->type = TIMEWINDOW_RANGE_CONTAINED;
|
||||
pCond->startVersion = -1;
|
||||
pCond->endVersion = -1;
|
||||
pCond->schemaVersion = -1;
|
||||
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue