fix: add more debug logs

This commit is contained in:
Cary Xu 2022-05-28 20:13:59 +08:00
parent b73cf23cc6
commit 174eb2d862
4 changed files with 18 additions and 3 deletions

View File

@ -619,7 +619,7 @@ void debugPrintSTag(STag *pTag, const char *tag, int32_t ln) {
tagVal.cid = *(int16_t *)POINTER_SHIFT(p, offset); tagVal.cid = *(int16_t *)POINTER_SHIFT(p, offset);
} }
printf("%s:%d loop[%d-%d] offset=%d\n", __func__, __LINE__, (int32_t)pTag->nTag, (int32_t)n, (int32_t)offset); printf("%s:%d loop[%d-%d] offset=%d\n", __func__, __LINE__, (int32_t)pTag->nTag, (int32_t)n, (int32_t)offset);
tGetTagVal(p, &tagVal, isJson); tGetTagVal(p + offset, &tagVal, isJson);
debugPrintTagVal(tagVal.type, tagVal.pData, tagVal.nData, __func__, __LINE__); debugPrintTagVal(tagVal.type, tagVal.pData, tagVal.nData, __func__, __LINE__);
} }
printf("\n"); printf("\n");
@ -703,7 +703,7 @@ int32_t tTagNew(SArray *pArray, int32_t version, int8_t isJson, STag **ppTag) {
ASSERT(szTag <= INT16_MAX); ASSERT(szTag <= INT16_MAX);
// build tag // build tag
(*ppTag) = (STag *)taosMemoryMalloc(szTag); (*ppTag) = (STag *)taosMemoryCalloc(szTag, 1);
if ((*ppTag) == NULL) { if ((*ppTag) == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = TSDB_CODE_OUT_OF_MEMORY;
goto _err; goto _err;

View File

@ -3847,6 +3847,7 @@ int tEncodeSVCreateTbReq(SEncoder *pCoder, const SVCreateTbReq *pReq) {
if (pReq->type == TSDB_CHILD_TABLE) { if (pReq->type == TSDB_CHILD_TABLE) {
if (tEncodeI64(pCoder, pReq->ctb.suid) < 0) return -1; if (tEncodeI64(pCoder, pReq->ctb.suid) < 0) return -1;
if (tEncodeTag(pCoder, (const STag *)pReq->ctb.pTag) < 0) return -1; if (tEncodeTag(pCoder, (const STag *)pReq->ctb.pTag) < 0) return -1;
debugPrintSTag((STag*)pReq->ctb.pTag, __func__, __LINE__);
} else if (pReq->type == TSDB_NORMAL_TABLE) { } else if (pReq->type == TSDB_NORMAL_TABLE) {
if (tEncodeSSchemaWrapper(pCoder, &pReq->ntb.schemaRow) < 0) return -1; if (tEncodeSSchemaWrapper(pCoder, &pReq->ntb.schemaRow) < 0) return -1;
} else { } else {
@ -3870,6 +3871,7 @@ int tDecodeSVCreateTbReq(SDecoder *pCoder, SVCreateTbReq *pReq) {
if (pReq->type == TSDB_CHILD_TABLE) { if (pReq->type == TSDB_CHILD_TABLE) {
if (tDecodeI64(pCoder, &pReq->ctb.suid) < 0) return -1; if (tDecodeI64(pCoder, &pReq->ctb.suid) < 0) return -1;
if (tDecodeTag(pCoder, (STag **)&pReq->ctb.pTag) < 0) return -1; if (tDecodeTag(pCoder, (STag **)&pReq->ctb.pTag) < 0) return -1;
debugPrintSTag((STag*)pReq->ctb.pTag, __func__, __LINE__);
} else if (pReq->type == TSDB_NORMAL_TABLE) { } else if (pReq->type == TSDB_NORMAL_TABLE) {
if (tDecodeSSchemaWrapper(pCoder, &pReq->ntb.schemaRow) < 0) return -1; if (tDecodeSSchemaWrapper(pCoder, &pReq->ntb.schemaRow) < 0) return -1;
} else { } else {

View File

@ -578,7 +578,7 @@ static int metaUpdateTableTagVal(SMeta *pMeta, int64_t version, SVAlterTbReq *pA
STagVal tagVal = {.cid = pCol->colId}; STagVal tagVal = {.cid = pCol->colId};
if (tTagGet(pOldTag, &tagVal) && tagVal.pData) { if (tTagGet(pOldTag, &tagVal) && tagVal.pData) {
if (IS_VAR_DATA_TYPE(pCol->type)) { if (IS_VAR_DATA_TYPE(pCol->type)) {
tTagValPush(pTagArray, &pCol->colId, pCol->type, tagVal.pData, varDataTLen(tagVal.pData), false); tTagValPush(pTagArray, &pCol->colId, pCol->type, varDataVal(tagVal.pData), varDataLen(tagVal.pData), false);
} else { } else {
tTagValPush(pTagArray, &pCol->colId, pCol->type, tagVal.pData, pCol->bytes, false); tTagValPush(pTagArray, &pCol->colId, pCol->type, tagVal.pData, pCol->bytes, false);
} }

View File

@ -4030,6 +4030,19 @@ static int32_t serializeVgroupCreateTableBatch(SVgroupCreateTableBatch* pTbBatch
pVgData->numOfTables = (int32_t)taosArrayGetSize(pTbBatch->req.pArray); pVgData->numOfTables = (int32_t)taosArrayGetSize(pTbBatch->req.pArray);
taosArrayPush(pBufArray, &pVgData); taosArrayPush(pBufArray, &pVgData);
#if 1 // debug print
SDecoder decoder = {0};
SVCreateTbBatchReq req = {0};
// decode
tDecoderInit(&decoder, pBuf, tlen - sizeof(SMsgHead));
if (tDecodeSVCreateTbBatchReq(&decoder, &req) < 0) {
ASSERT(0);
}
tDecoderClear(&decoder);
#endif
printf("%s:%d: OK in send \n", __func__, __LINE__);
ASSERT(0);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }