refactor:fix schemaless error in table name,vgId,uid
This commit is contained in:
parent
3d08e526cf
commit
b744c0f524
|
@ -105,7 +105,7 @@ int32_t qCreateSName(SName* pName, const char* pTableName, int32_t acctId, char*
|
||||||
|
|
||||||
void* smlInitHandle(SQuery *pQuery);
|
void* smlInitHandle(SQuery *pQuery);
|
||||||
void smlDestroyHandle(void *pHandle);
|
void smlDestroyHandle(void *pHandle);
|
||||||
int32_t smlBindData(void *handle, SArray *tags, SArray *colsFormat, SHashObj *colsHash, SArray *cols, bool format, STableMeta *pTableMeta, char *msgBuf, int16_t msgBufLen);
|
int32_t smlBindData(void *handle, SArray *tags, SArray *colsFormat, SHashObj *colsHash, SArray *cols, bool format, STableMeta *pTableMeta, char *tableName, char *msgBuf, int16_t msgBufLen);
|
||||||
int32_t smlBuildOutput(void* handle, SHashObj* pVgHash);
|
int32_t smlBuildOutput(void* handle, SHashObj* pVgHash);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -143,7 +143,7 @@ static int32_t smlBuildInvalidDataMsg(SSmlMsgBuf* pBuf, const char *msg1, const
|
||||||
}
|
}
|
||||||
|
|
||||||
static int smlCompareKv(const void* p1, const void* p2) {
|
static int smlCompareKv(const void* p1, const void* p2) {
|
||||||
SSmlKv* kv1 = (SSmlKv *)p1;
|
SSmlKv* kv1 = (SSmlKv*)p1;
|
||||||
SSmlKv* kv2 = (SSmlKv*)p2;
|
SSmlKv* kv2 = (SSmlKv*)p2;
|
||||||
int32_t kvLen1 = kv1->keyLen;
|
int32_t kvLen1 = kv1->keyLen;
|
||||||
int32_t kvLen2 = kv2->keyLen;
|
int32_t kvLen2 = kv2->keyLen;
|
||||||
|
@ -1647,11 +1647,12 @@ static int32_t smlInsertData(SSmlHandle* info) {
|
||||||
SSmlSTableMeta** pMeta = taosHashGet(info->superTables, tableData->sTableName, tableData->sTableNameLen);
|
SSmlSTableMeta** pMeta = taosHashGet(info->superTables, tableData->sTableName, tableData->sTableNameLen);
|
||||||
ASSERT (NULL != pMeta && NULL != *pMeta);
|
ASSERT (NULL != pMeta && NULL != *pMeta);
|
||||||
|
|
||||||
|
// use tablemeta of stable to save vgid and uid of child table
|
||||||
(*pMeta)->tableMeta->vgId = vg.vgId;
|
(*pMeta)->tableMeta->vgId = vg.vgId;
|
||||||
(*pMeta)->tableMeta->uid = tableData->uid; // one table merge data block together according uid
|
(*pMeta)->tableMeta->uid = tableData->uid; // one table merge data block together according uid
|
||||||
|
|
||||||
code = smlBindData(info->exec, tableData->tags, tableData->colsFormat, tableData->columnsHash,
|
code = smlBindData(info->exec, tableData->tags, tableData->colsFormat, tableData->columnsHash,
|
||||||
tableData->cols, info->dataFormat, (*pMeta)->tableMeta, info->msgBuf.buf, info->msgBuf.len);
|
tableData->cols, info->dataFormat, (*pMeta)->tableMeta, tableData->childTableName, info->msgBuf.buf, info->msgBuf.len);
|
||||||
if(code != TSDB_CODE_SUCCESS){
|
if(code != TSDB_CODE_SUCCESS){
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
|
@ -279,6 +279,7 @@ static void buildMsgHeader(STableDataBlocks* src, SVgDataBlocks* blocks) {
|
||||||
int32_t numOfBlocks = blocks->numOfTables;
|
int32_t numOfBlocks = blocks->numOfTables;
|
||||||
while (numOfBlocks--) {
|
while (numOfBlocks--) {
|
||||||
int32_t dataLen = blk->dataLen;
|
int32_t dataLen = blk->dataLen;
|
||||||
|
int32_t schemaLen = blk->schemaLen;
|
||||||
blk->uid = htobe64(blk->uid);
|
blk->uid = htobe64(blk->uid);
|
||||||
blk->suid = htobe64(blk->suid);
|
blk->suid = htobe64(blk->suid);
|
||||||
blk->padding = htonl(blk->padding);
|
blk->padding = htonl(blk->padding);
|
||||||
|
@ -286,7 +287,7 @@ static void buildMsgHeader(STableDataBlocks* src, SVgDataBlocks* blocks) {
|
||||||
blk->dataLen = htonl(blk->dataLen);
|
blk->dataLen = htonl(blk->dataLen);
|
||||||
blk->schemaLen = htonl(blk->schemaLen);
|
blk->schemaLen = htonl(blk->schemaLen);
|
||||||
blk->numOfRows = htons(blk->numOfRows);
|
blk->numOfRows = htons(blk->numOfRows);
|
||||||
blk = (SSubmitBlk*)(blk->data + dataLen);
|
blk = (SSubmitBlk*)(blk->data + schemaLen + dataLen);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1642,7 +1643,7 @@ static int32_t smlBoundTags(SArray *cols, SKVRowBuilder *tagsBuilder, SParsedDat
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t smlBindData(void *handle, SArray *tags, SArray *colsFormat, SHashObj *colsHash, SArray *cols, bool format,
|
int32_t smlBindData(void *handle, SArray *tags, SArray *colsFormat, SHashObj *colsHash, SArray *cols, bool format,
|
||||||
STableMeta *pTableMeta, char *msgBuf, int16_t msgBufLen) {
|
STableMeta *pTableMeta, char *tableName, char *msgBuf, int16_t msgBufLen) {
|
||||||
SMsgBuf pBuf = {.buf = msgBuf, .len = msgBufLen};
|
SMsgBuf pBuf = {.buf = msgBuf, .len = msgBufLen};
|
||||||
|
|
||||||
SSmlExecHandle *smlHandle = (SSmlExecHandle *)handle;
|
SSmlExecHandle *smlHandle = (SSmlExecHandle *)handle;
|
||||||
|
@ -1659,7 +1660,7 @@ int32_t smlBindData(void *handle, SArray *tags, SArray *colsFormat, SHashObj *co
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
buildCreateTbReq(&smlHandle->createTblReq, pTableMeta->schema->name, row, pTableMeta->suid);
|
buildCreateTbReq(&smlHandle->createTblReq, tableName, row, pTableMeta->suid);
|
||||||
|
|
||||||
STableDataBlocks* pDataBlock = NULL;
|
STableDataBlocks* pDataBlock = NULL;
|
||||||
ret = getDataBlockFromList(smlHandle->pBlockHash, pTableMeta->uid, TSDB_DEFAULT_PAYLOAD_SIZE,
|
ret = getDataBlockFromList(smlHandle->pBlockHash, pTableMeta->uid, TSDB_DEFAULT_PAYLOAD_SIZE,
|
||||||
|
|
|
@ -455,6 +455,7 @@ int32_t mergeTableDataBlocks(SHashObj* pHashObj, uint8_t payloadType, SArray** p
|
||||||
SSubmitBlk* pBlocks = (SSubmitBlk*)pOneTableBlock->pData;
|
SSubmitBlk* pBlocks = (SSubmitBlk*)pOneTableBlock->pData;
|
||||||
if (pBlocks->numOfRows > 0) {
|
if (pBlocks->numOfRows > 0) {
|
||||||
STableDataBlocks* dataBuf = NULL;
|
STableDataBlocks* dataBuf = NULL;
|
||||||
|
pOneTableBlock->pTableMeta->vgId = pOneTableBlock->vgId; // for schemaless, restore origin vgId
|
||||||
int32_t ret =
|
int32_t ret =
|
||||||
getDataBlockFromList(pVnodeDataBlockHashList, pOneTableBlock->vgId, TSDB_PAYLOAD_SIZE, INSERT_HEAD_SIZE, 0,
|
getDataBlockFromList(pVnodeDataBlockHashList, pOneTableBlock->vgId, TSDB_PAYLOAD_SIZE, INSERT_HEAD_SIZE, 0,
|
||||||
pOneTableBlock->pTableMeta, &dataBuf, pVnodeDataBlockList, NULL);
|
pOneTableBlock->pTableMeta, &dataBuf, pVnodeDataBlockList, NULL);
|
||||||
|
|
Loading…
Reference in New Issue