enh: error code when build delete req
This commit is contained in:
parent
2a14a10d0d
commit
5fae10bc76
|
@ -2121,6 +2121,7 @@ _end:
|
||||||
char* buildCtbNameByGroupId(const char* stbFullName, uint64_t groupId) {
|
char* buildCtbNameByGroupId(const char* stbFullName, uint64_t groupId) {
|
||||||
char* pBuf = taosMemoryCalloc(1, TSDB_TABLE_NAME_LEN + 1);
|
char* pBuf = taosMemoryCalloc(1, TSDB_TABLE_NAME_LEN + 1);
|
||||||
if (!pBuf) {
|
if (!pBuf) {
|
||||||
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
int32_t code = buildCtbNameByGroupIdImpl(stbFullName, groupId, pBuf);
|
int32_t code = buildCtbNameByGroupIdImpl(stbFullName, groupId, pBuf);
|
||||||
|
@ -2133,6 +2134,7 @@ char* buildCtbNameByGroupId(const char* stbFullName, uint64_t groupId) {
|
||||||
|
|
||||||
int32_t buildCtbNameByGroupIdImpl(const char* stbFullName, uint64_t groupId, char* cname) {
|
int32_t buildCtbNameByGroupIdImpl(const char* stbFullName, uint64_t groupId, char* cname) {
|
||||||
if (stbFullName[0] == 0) {
|
if (stbFullName[0] == 0) {
|
||||||
|
terrno = TSDB_CODE_INVALID_PARA;
|
||||||
return TSDB_CODE_FAILED;
|
return TSDB_CODE_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2142,6 +2144,7 @@ int32_t buildCtbNameByGroupIdImpl(const char* stbFullName, uint64_t groupId, cha
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cname == NULL) {
|
if (cname == NULL) {
|
||||||
|
terrno = TSDB_CODE_INVALID_PARA;
|
||||||
taosArrayDestroy(tags);
|
taosArrayDestroy(tags);
|
||||||
return TSDB_CODE_FAILED;
|
return TSDB_CODE_FAILED;
|
||||||
}
|
}
|
||||||
|
|
|
@ -296,7 +296,10 @@ static int compareKv(const void* p1, const void* p2) {
|
||||||
void buildChildTableName(RandTableName* rName) {
|
void buildChildTableName(RandTableName* rName) {
|
||||||
SStringBuilder sb = {0};
|
SStringBuilder sb = {0};
|
||||||
taosStringBuilderAppendStringLen(&sb, rName->stbFullName, rName->stbFullNameLen);
|
taosStringBuilderAppendStringLen(&sb, rName->stbFullName, rName->stbFullNameLen);
|
||||||
if (sb.buf == NULL) return;
|
if (sb.buf == NULL) {
|
||||||
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
return;
|
||||||
|
}
|
||||||
taosArraySort(rName->tags, compareKv);
|
taosArraySort(rName->tags, compareKv);
|
||||||
for (int j = 0; j < taosArrayGetSize(rName->tags); ++j) {
|
for (int j = 0; j < taosArrayGetSize(rName->tags); ++j) {
|
||||||
taosStringBuilderAppendChar(&sb, ',');
|
taosStringBuilderAppendChar(&sb, ',');
|
||||||
|
|
|
@ -188,7 +188,8 @@ int32_t smaBlockToSubmit(SVnode *pVnode, const SArray *pBlocks, const STSchema *
|
||||||
if (pDataBlock->info.type == STREAM_DELETE_RESULT) {
|
if (pDataBlock->info.type == STREAM_DELETE_RESULT) {
|
||||||
pDeleteReq->suid = suid;
|
pDeleteReq->suid = suid;
|
||||||
pDeleteReq->deleteReqs = taosArrayInit(0, sizeof(SSingleDeleteReq));
|
pDeleteReq->deleteReqs = taosArrayInit(0, sizeof(SSingleDeleteReq));
|
||||||
tqBuildDeleteReq(pVnode->pTq, stbFullName, pDataBlock, pDeleteReq, "");
|
code = tqBuildDeleteReq(pVnode->pTq, stbFullName, pDataBlock, pDeleteReq, "");
|
||||||
|
TSDB_CHECK_CODE(code, lino, _exit);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,7 @@ static void setCreateTableMsgTableName(SVCreateTbReq* pCreateTableReq, SSData
|
||||||
|
|
||||||
int32_t tqBuildDeleteReq(STQ* pTq, const char* stbFullName, const SSDataBlock* pDataBlock, SBatchDeleteReq* deleteReq,
|
int32_t tqBuildDeleteReq(STQ* pTq, const char* stbFullName, const SSDataBlock* pDataBlock, SBatchDeleteReq* deleteReq,
|
||||||
const char* pIdStr) {
|
const char* pIdStr) {
|
||||||
|
int32_t code = 0;
|
||||||
int32_t totalRows = pDataBlock->info.rows;
|
int32_t totalRows = pDataBlock->info.rows;
|
||||||
SColumnInfoData* pStartTsCol = taosArrayGet(pDataBlock->pDataBlock, START_TS_COLUMN_INDEX);
|
SColumnInfoData* pStartTsCol = taosArrayGet(pDataBlock->pDataBlock, START_TS_COLUMN_INDEX);
|
||||||
SColumnInfoData* pEndTsCol = taosArrayGet(pDataBlock->pDataBlock, END_TS_COLUMN_INDEX);
|
SColumnInfoData* pEndTsCol = taosArrayGet(pDataBlock->pDataBlock, END_TS_COLUMN_INDEX);
|
||||||
|
@ -73,16 +74,20 @@ int32_t tqBuildDeleteReq(STQ* pTq, const char* stbFullName, const SSDataBlock* p
|
||||||
pName = buildCtbNameByGroupId(stbFullName, groupId);
|
pName = buildCtbNameByGroupId(stbFullName, groupId);
|
||||||
name = pName;
|
name = pName;
|
||||||
} else {
|
} else {
|
||||||
metaGetTableNameByUid(pTq->pVnode, groupId, tbName);
|
if (metaGetTableNameByUid(pTq->pVnode, groupId, tbName) == 0) {
|
||||||
name = varDataVal(tbName);
|
name = varDataVal(tbName);
|
||||||
|
} else {
|
||||||
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!name || *name == '\0') {
|
if (!name || *name == '\0') {
|
||||||
tqError("s-task:%s build delete msg groupId:%" PRId64 ", skey:%" PRId64 " ekey:%" PRId64
|
tqError("s-task:%s build delete msg groupId:%" PRId64 ", skey:%" PRId64 " ekey:%" PRId64
|
||||||
" failed since invalid tbname:%s",
|
" failed since invalid tbname:%s",
|
||||||
pIdStr, groupId, name, skey, ekey, name ? name : "NULL");
|
pIdStr, groupId, skey, ekey, name ? name : "NULL");
|
||||||
taosArrayDestroy(deleteReq->deleteReqs);
|
taosArrayDestroy(deleteReq->deleteReqs);
|
||||||
return -1;
|
code = terrno ? terrno : TSDB_CODE_APP_ERROR;
|
||||||
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
tqDebug("s-task:%s build delete msg groupId:%" PRId64 ", name:%s, skey:%" PRId64 " ekey:%" PRId64, pIdStr, groupId,
|
tqDebug("s-task:%s build delete msg groupId:%" PRId64 ", name:%s, skey:%" PRId64 " ekey:%" PRId64, pIdStr, groupId,
|
||||||
|
@ -95,7 +100,7 @@ int32_t tqBuildDeleteReq(STQ* pTq, const char* stbFullName, const SSDataBlock* p
|
||||||
taosArrayPush(deleteReq->deleteReqs, &req);
|
taosArrayPush(deleteReq->deleteReqs, &req);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t encodeCreateChildTableForRPC(SVCreateTbBatchReq* pReqs, int32_t vgId, void** pBuf, int32_t* contLen) {
|
static int32_t encodeCreateChildTableForRPC(SVCreateTbBatchReq* pReqs, int32_t vgId, void** pBuf, int32_t* contLen) {
|
||||||
|
|
Loading…
Reference in New Issue