diff --git a/include/common/tmsg.h b/include/common/tmsg.h index 6af43253715d648ca5e27d2577feea86d7ef06f7..3ff566afe2cd6e31f88293a83a160815c9d0c4b8 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -258,6 +258,7 @@ typedef struct { char* tblFName; int32_t numOfRows; int32_t affectedRows; + int64_t sver; } SSubmitBlkRsp; typedef struct { diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index d180c2ff6e17a9cce4a2da730f256f629f2c0986..4e97ebbe47e3179b1e698837ff8095e28ad40cbb 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -4093,6 +4093,7 @@ static int32_t tEncodeSSubmitBlkRsp(SEncoder *pEncoder, const SSubmitBlkRsp *pBl } if (tEncodeI32v(pEncoder, pBlock->numOfRows) < 0) return -1; if (tEncodeI32v(pEncoder, pBlock->affectedRows) < 0) return -1; + if (tEncodeI64v(pEncoder, pBlock->sver) < 0) return -1; tEndEncode(pEncoder); return 0; @@ -4111,6 +4112,7 @@ static int32_t tDecodeSSubmitBlkRsp(SDecoder *pDecoder, SSubmitBlkRsp *pBlock) { } if (tDecodeI32v(pDecoder, &pBlock->numOfRows) < 0) return -1; if (tDecodeI32v(pDecoder, &pBlock->affectedRows) < 0) return -1; + if (tDecodeI64v(pDecoder, &pBlock->sver) < 0) return -1; tEndDecode(pDecoder); return 0; diff --git a/source/dnode/vnode/src/tsdb/tsdbMemTable.c b/source/dnode/vnode/src/tsdb/tsdbMemTable.c index 037b099345b91f680b27a0ae251a9bb8299236b3..2fdbfdd2064dbc78c713df891433e02c7aba57cd 100644 --- a/source/dnode/vnode/src/tsdb/tsdbMemTable.c +++ b/source/dnode/vnode/src/tsdb/tsdbMemTable.c @@ -309,6 +309,7 @@ int tsdbInsertTableData(STsdb *pTsdb, SSubmitMsgIter *pMsgIter, SSubmitBlk *pBlo TSKEY keyMin; TSKEY keyMax; SSubmitBlk *pBlkCopy; + int64_t sverNew; // check if table exists SMetaReader mr = {0}; @@ -319,6 +320,12 @@ int tsdbInsertTableData(STsdb *pTsdb, SSubmitMsgIter *pMsgIter, SSubmitBlk *pBlo terrno = TSDB_CODE_PAR_TABLE_NOT_EXIST; return -1; } + if (mr.me.type == TSDB_NORMAL_TABLE) { + sverNew = mr.me.ntbEntry.schema.sver; + } else { + metaGetTableEntryByUid(&mr, mr.me.ctbEntry.suid); + sverNew = mr.me.stbEntry.schema.sver; + } metaReaderClear(&mr); // create container is nedd @@ -367,6 +374,7 @@ int tsdbInsertTableData(STsdb *pTsdb, SSubmitMsgIter *pMsgIter, SSubmitBlk *pBlo pRsp->numOfRows = pMsgIter->numOfRows; pRsp->affectedRows = pMsgIter->numOfRows; + pRsp->sver = sverNew; return 0; }