return errno when table not exits
This commit is contained in:
parent
4505fa3351
commit
62b2ccedf1
|
@ -252,6 +252,7 @@ STSRow* tGetSubmitBlkNext(SSubmitBlkIter* pIter);
|
||||||
int32_t tPrintFixedSchemaSubmitReq(const SSubmitReq* pReq, STSchema* pSchema);
|
int32_t tPrintFixedSchemaSubmitReq(const SSubmitReq* pReq, STSchema* pSchema);
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
int32_t code;
|
||||||
int8_t hashMeta;
|
int8_t hashMeta;
|
||||||
int64_t uid;
|
int64_t uid;
|
||||||
char* tblFName;
|
char* tblFName;
|
||||||
|
|
|
@ -4032,6 +4032,7 @@ int32_t tDecodeSVSubmitReq(SDecoder *pCoder, SVSubmitReq *pReq) {
|
||||||
static int32_t tEncodeSSubmitBlkRsp(SEncoder *pEncoder, const SSubmitBlkRsp *pBlock) {
|
static int32_t tEncodeSSubmitBlkRsp(SEncoder *pEncoder, const SSubmitBlkRsp *pBlock) {
|
||||||
if (tStartEncode(pEncoder) < 0) return -1;
|
if (tStartEncode(pEncoder) < 0) return -1;
|
||||||
|
|
||||||
|
if (tEncodeI32(pEncoder, pBlock->code) < 0) return -1;
|
||||||
if (tEncodeI8(pEncoder, pBlock->hashMeta) < 0) return -1;
|
if (tEncodeI8(pEncoder, pBlock->hashMeta) < 0) return -1;
|
||||||
if (pBlock->hashMeta) {
|
if (pBlock->hashMeta) {
|
||||||
if (tEncodeI64(pEncoder, pBlock->uid) < 0) return -1;
|
if (tEncodeI64(pEncoder, pBlock->uid) < 0) return -1;
|
||||||
|
@ -4047,6 +4048,7 @@ static int32_t tEncodeSSubmitBlkRsp(SEncoder *pEncoder, const SSubmitBlkRsp *pBl
|
||||||
static int32_t tDecodeSSubmitBlkRsp(SDecoder *pDecoder, SSubmitBlkRsp *pBlock) {
|
static int32_t tDecodeSSubmitBlkRsp(SDecoder *pDecoder, SSubmitBlkRsp *pBlock) {
|
||||||
if (tStartDecode(pDecoder) < 0) return -1;
|
if (tStartDecode(pDecoder) < 0) return -1;
|
||||||
|
|
||||||
|
if (tDecodeI32(pDecoder, &pBlock->code) < 0) return -1;
|
||||||
if (tDecodeI8(pDecoder, &pBlock->hashMeta) < 0) return -1;
|
if (tDecodeI8(pDecoder, &pBlock->hashMeta) < 0) return -1;
|
||||||
if (pBlock->hashMeta) {
|
if (pBlock->hashMeta) {
|
||||||
if (tDecodeI64(pDecoder, &pBlock->uid) < 0) return -1;
|
if (tDecodeI64(pDecoder, &pBlock->uid) < 0) return -1;
|
||||||
|
@ -4108,4 +4110,3 @@ void tFreeSSubmitRsp(SSubmitRsp *pRsp) {
|
||||||
|
|
||||||
taosMemoryFree(pRsp);
|
taosMemoryFree(pRsp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -310,6 +310,17 @@ int tsdbInsertTableData(STsdb *pTsdb, SSubmitMsgIter *pMsgIter, SSubmitBlk *pBlo
|
||||||
TSKEY keyMax;
|
TSKEY keyMax;
|
||||||
SSubmitBlk *pBlkCopy;
|
SSubmitBlk *pBlkCopy;
|
||||||
|
|
||||||
|
// check if table exists
|
||||||
|
SMetaReader mr = {0};
|
||||||
|
SMetaEntry me = {0};
|
||||||
|
metaReaderInit(&mr, pTsdb->pVnode->pMeta, 0);
|
||||||
|
if (metaGetTableEntryByUid(&mr, pMsgIter->uid) < 0) {
|
||||||
|
metaReaderClear(&mr);
|
||||||
|
terrno = TSDB_CODE_PAR_TABLE_NOT_EXIST;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
metaReaderClear(&mr);
|
||||||
|
|
||||||
// create container is nedd
|
// create container is nedd
|
||||||
tptr = taosHashGet(pMemTable->pHashIdx, &(pMsgIter->uid), sizeof(pMsgIter->uid));
|
tptr = taosHashGet(pMemTable->pHashIdx, &(pMsgIter->uid), sizeof(pMsgIter->uid));
|
||||||
if (tptr == NULL) {
|
if (tptr == NULL) {
|
||||||
|
|
|
@ -595,7 +595,7 @@ static int vnodeProcessSubmitReq(SVnode *pVnode, int64_t version, void *pReq, in
|
||||||
|
|
||||||
if (metaCreateTable(pVnode->pMeta, version, &createTbReq) < 0) {
|
if (metaCreateTable(pVnode->pMeta, version, &createTbReq) < 0) {
|
||||||
if (terrno != TSDB_CODE_TDB_TABLE_ALREADY_EXIST) {
|
if (terrno != TSDB_CODE_TDB_TABLE_ALREADY_EXIST) {
|
||||||
pRsp->code = terrno;
|
submitBlkRsp.code = terrno;
|
||||||
tDecoderClear(&decoder);
|
tDecoderClear(&decoder);
|
||||||
goto _exit;
|
goto _exit;
|
||||||
}
|
}
|
||||||
|
@ -617,8 +617,7 @@ static int vnodeProcessSubmitReq(SVnode *pVnode, int64_t version, void *pReq, in
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tsdbInsertTableData(pVnode->pTsdb, &msgIter, pBlock, &submitBlkRsp) < 0) {
|
if (tsdbInsertTableData(pVnode->pTsdb, &msgIter, pBlock, &submitBlkRsp) < 0) {
|
||||||
pRsp->code = terrno;
|
submitBlkRsp.code = terrno;
|
||||||
goto _exit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
submitRsp.numOfRows += submitBlkRsp.numOfRows;
|
submitRsp.numOfRows += submitBlkRsp.numOfRows;
|
||||||
|
|
Loading…
Reference in New Issue