adjust more code

This commit is contained in:
Hongze Cheng 2022-11-29 15:47:24 +08:00
parent 05eb8dfecc
commit 2317c5ff5c
1 changed files with 37 additions and 13 deletions

View File

@ -77,34 +77,58 @@ int32_t vnodePreProcessWriteMsg(SVnode *pVnode, SRpcMsg *pMsg) {
tDecoderClear(&dc); tDecoderClear(&dc);
} break; } break;
case TDMT_VND_SUBMIT: { case TDMT_VND_SUBMIT: {
int64_t ctime = taosGetTimestampMs();
tDecoderInit(&dc, (uint8_t *)pMsg->pCont + sizeof(SMsgHead), pMsg->contLen - sizeof(SMsgHead)); tDecoderInit(&dc, (uint8_t *)pMsg->pCont + sizeof(SMsgHead), pMsg->contLen - sizeof(SMsgHead));
tStartDecode(&dc); tStartDecode(&dc);
int32_t flag; uint64_t nSubmitTbData;
tDecodeI32v(&dc, &flag); if (tDecodeU64v(&dc, &nSubmitTbData) < 0) {
code = TSDB_CODE_INVALID_MSG;
goto _err;
}
if (flag & SUBMIT_REQ_AUTO_CREATE_TABLE) { for (int32_t i = 0; i < nSubmitTbData; i++) {
int64_t ctime = taosGetTimestampMs(); if (tStartDecode(&dc) < 0) {
int64_t nReq; code = TSDB_CODE_INVALID_MSG;
int64_t uid; goto _err;
}
int32_t flags;
if (tDecodeI32v(&dc, &flags) < 0) {
code = TSDB_CODE_INVALID_MSG;
goto _err;
}
if (flags & SUBMIT_REQ_AUTO_CREATE_TABLE) {
if (tStartDecode(&dc) < 0) {
code = TSDB_CODE_INVALID_MSG;
goto _err;
}
if (tDecodeI32v(&dc, NULL) < 0) {
code = TSDB_CODE_INVALID_MSG;
goto _err;
}
tDecodeI64v(&dc, &nReq);
for (int64_t iReq; iReq < nReq; iReq++) {
char *name = NULL; char *name = NULL;
if (tDecodeCStr(&dc, &name) < 0) {
code = TSDB_CODE_INVALID_MSG;
goto _err;
}
tStartDecode(&dc); int64_t uid = metaGetTableEntryUidByName(pVnode->pMeta, name);
tDecodeI32v(&dc, NULL);
tDecodeCStr(&dc, &name);
uid = metaGetTableEntryUidByName(pVnode->pMeta, name);
if (uid == 0) { if (uid == 0) {
uid = tGenIdPI64(); uid = tGenIdPI64();
} }
*(int64_t *)(dc.data + dc.pos) = uid; *(int64_t *)(dc.data + dc.pos) = uid;
*(int64_t *)(dc.data + dc.pos + 8) = ctime; *(int64_t *)(dc.data + dc.pos + 8) = ctime;
tEndDecode(&dc); tEndDecode(&dc);
} }
tEndDecode(&dc);
} }
tEndDecode(&dc); tEndDecode(&dc);