Merge branch '3.0' of https://github.com/taosdata/TDengine into fix/ly_res
This commit is contained in:
commit
3c56bd0f37
|
@ -422,6 +422,10 @@ pipeline {
|
||||||
mkdir -p ${WKDIR}/tmp/${BRANCH_NAME}_${BUILD_ID}
|
mkdir -p ${WKDIR}/tmp/${BRANCH_NAME}_${BUILD_ID}
|
||||||
echo "''' + env.FILE_CHANGED + '''" > ${WKDIR}/tmp/${BRANCH_NAME}_${BUILD_ID}/docs_changed.txt
|
echo "''' + env.FILE_CHANGED + '''" > ${WKDIR}/tmp/${BRANCH_NAME}_${BUILD_ID}/docs_changed.txt
|
||||||
'''
|
'''
|
||||||
|
sh '''
|
||||||
|
cd ${WKC}/tests/parallel_test
|
||||||
|
./run_check_assert_container.sh -d ${WKDIR}
|
||||||
|
'''
|
||||||
sh '''
|
sh '''
|
||||||
date
|
date
|
||||||
rm -rf ${WKC}/debug
|
rm -rf ${WKC}/debug
|
||||||
|
|
|
@ -321,7 +321,7 @@ if (${BUILD_WITH_ROCKSDB})
|
||||||
endif(${TD_DARWIN_ARM64})
|
endif(${TD_DARWIN_ARM64})
|
||||||
|
|
||||||
if (${TD_WINDOWS})
|
if (${TD_WINDOWS})
|
||||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4244 /wd4819")
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4244 /wd4819 /std:c++17")
|
||||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4244 /wd4819")
|
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4244 /wd4819")
|
||||||
option(WITH_JNI "" OFF)
|
option(WITH_JNI "" OFF)
|
||||||
if(CMAKE_C_FLAGS MATCHES "/MT" OR CMAKE_C_FLAGS MATCHES "/MTd")
|
if(CMAKE_C_FLAGS MATCHES "/MT" OR CMAKE_C_FLAGS MATCHES "/MTd")
|
||||||
|
@ -370,7 +370,7 @@ if (${BUILD_WITH_ROCKSDB})
|
||||||
endif(${TD_DARWIN_ARM64})
|
endif(${TD_DARWIN_ARM64})
|
||||||
|
|
||||||
if (${TD_WINDOWS})
|
if (${TD_WINDOWS})
|
||||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4244 /wd4819")
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4244 /wd4819 /std:c++17")
|
||||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4244 /wd4819")
|
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4244 /wd4819")
|
||||||
option(WITH_JNI "" OFF)
|
option(WITH_JNI "" OFF)
|
||||||
if(CMAKE_C_FLAGS MATCHES "/MT" OR CMAKE_C_FLAGS MATCHES "/MTd")
|
if(CMAKE_C_FLAGS MATCHES "/MT" OR CMAKE_C_FLAGS MATCHES "/MTd")
|
||||||
|
|
|
@ -121,6 +121,8 @@ void mndGenerateMachineCode();
|
||||||
|
|
||||||
void mndDumpSdb();
|
void mndDumpSdb();
|
||||||
|
|
||||||
|
void mndDeleteTrans();
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1662,185 +1662,179 @@ _exit:
|
||||||
|
|
||||||
int32_t tSerializeSStatusRsp(void *buf, int32_t bufLen, SStatusRsp *pRsp) {
|
int32_t tSerializeSStatusRsp(void *buf, int32_t bufLen, SStatusRsp *pRsp) {
|
||||||
SEncoder encoder = {0};
|
SEncoder encoder = {0};
|
||||||
|
int32_t code = 0;
|
||||||
|
int32_t lino;
|
||||||
|
int32_t tlen;
|
||||||
tEncoderInit(&encoder, buf, bufLen);
|
tEncoderInit(&encoder, buf, bufLen);
|
||||||
|
|
||||||
if (tStartEncode(&encoder) < 0) return -1;
|
TAOS_CHECK_EXIT(tStartEncode(&encoder));
|
||||||
|
|
||||||
// status
|
// status
|
||||||
if (tEncodeI64(&encoder, pRsp->dnodeVer) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeI64(&encoder, pRsp->dnodeVer));
|
||||||
|
|
||||||
// dnode cfg
|
// dnode cfg
|
||||||
if (tEncodeI32(&encoder, pRsp->dnodeCfg.dnodeId) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeI32(&encoder, pRsp->dnodeCfg.dnodeId));
|
||||||
if (tEncodeI64(&encoder, pRsp->dnodeCfg.clusterId) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeI64(&encoder, pRsp->dnodeCfg.clusterId));
|
||||||
|
|
||||||
// dnode eps
|
// dnode eps
|
||||||
int32_t dlen = (int32_t)taosArrayGetSize(pRsp->pDnodeEps);
|
int32_t dlen = (int32_t)taosArrayGetSize(pRsp->pDnodeEps);
|
||||||
if (tEncodeI32(&encoder, dlen) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeI32(&encoder, dlen));
|
||||||
for (int32_t i = 0; i < dlen; ++i) {
|
for (int32_t i = 0; i < dlen; ++i) {
|
||||||
SDnodeEp *pDnodeEp = taosArrayGet(pRsp->pDnodeEps, i);
|
SDnodeEp *pDnodeEp = taosArrayGet(pRsp->pDnodeEps, i);
|
||||||
if (tEncodeI32(&encoder, pDnodeEp->id) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeI32(&encoder, pDnodeEp->id));
|
||||||
if (tEncodeI8(&encoder, pDnodeEp->isMnode) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeI8(&encoder, pDnodeEp->isMnode));
|
||||||
if (tEncodeCStr(&encoder, pDnodeEp->ep.fqdn) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pDnodeEp->ep.fqdn));
|
||||||
if (tEncodeU16(&encoder, pDnodeEp->ep.port) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeU16(&encoder, pDnodeEp->ep.port));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tEncodeI32(&encoder, pRsp->statusSeq) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeI32(&encoder, pRsp->statusSeq));
|
||||||
|
|
||||||
if (tEncodeI64(&encoder, pRsp->ipWhiteVer) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeI64(&encoder, pRsp->ipWhiteVer));
|
||||||
tEndEncode(&encoder);
|
tEndEncode(&encoder);
|
||||||
|
|
||||||
int32_t tlen = encoder.pos;
|
_exit:
|
||||||
|
if (code) {
|
||||||
|
tlen = code;
|
||||||
|
} else {
|
||||||
|
tlen = encoder.pos;
|
||||||
|
}
|
||||||
tEncoderClear(&encoder);
|
tEncoderClear(&encoder);
|
||||||
return tlen;
|
return tlen;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tDeserializeSStatusRsp(void *buf, int32_t bufLen, SStatusRsp *pRsp) {
|
int32_t tDeserializeSStatusRsp(void *buf, int32_t bufLen, SStatusRsp *pRsp) {
|
||||||
SDecoder decoder = {0};
|
SDecoder decoder = {0};
|
||||||
|
int32_t code = 0;
|
||||||
|
int32_t lino;
|
||||||
tDecoderInit(&decoder, buf, bufLen);
|
tDecoderInit(&decoder, buf, bufLen);
|
||||||
|
|
||||||
if (tStartDecode(&decoder) < 0) return -1;
|
TAOS_CHECK_EXIT(tStartDecode(&decoder));
|
||||||
|
|
||||||
// status
|
// status
|
||||||
if (tDecodeI64(&decoder, &pRsp->dnodeVer) < 0) return -1;
|
TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pRsp->dnodeVer));
|
||||||
|
|
||||||
// cluster cfg
|
// cluster cfg
|
||||||
if (tDecodeI32(&decoder, &pRsp->dnodeCfg.dnodeId) < 0) return -1;
|
TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pRsp->dnodeCfg.dnodeId));
|
||||||
if (tDecodeI64(&decoder, &pRsp->dnodeCfg.clusterId) < 0) return -1;
|
TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pRsp->dnodeCfg.clusterId));
|
||||||
|
|
||||||
// dnode eps
|
// dnode eps
|
||||||
int32_t dlen = 0;
|
int32_t dlen = 0;
|
||||||
if (tDecodeI32(&decoder, &dlen) < 0) return -1;
|
TAOS_CHECK_EXIT(tDecodeI32(&decoder, &dlen));
|
||||||
pRsp->pDnodeEps = taosArrayInit(dlen, sizeof(SDnodeEp));
|
pRsp->pDnodeEps = taosArrayInit(dlen, sizeof(SDnodeEp));
|
||||||
if (pRsp->pDnodeEps == NULL) {
|
if (pRsp->pDnodeEps == NULL) {
|
||||||
return -1;
|
TAOS_CHECK_EXIT(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int32_t i = 0; i < dlen; ++i) {
|
for (int32_t i = 0; i < dlen; ++i) {
|
||||||
SDnodeEp dnodeEp = {0};
|
SDnodeEp dnodeEp = {0};
|
||||||
if (tDecodeI32(&decoder, &dnodeEp.id) < 0) return -1;
|
TAOS_CHECK_EXIT(tDecodeI32(&decoder, &dnodeEp.id));
|
||||||
if (tDecodeI8(&decoder, &dnodeEp.isMnode) < 0) return -1;
|
TAOS_CHECK_EXIT(tDecodeI8(&decoder, &dnodeEp.isMnode));
|
||||||
if (tDecodeCStrTo(&decoder, dnodeEp.ep.fqdn) < 0) return -1;
|
TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, dnodeEp.ep.fqdn));
|
||||||
if (tDecodeU16(&decoder, &dnodeEp.ep.port) < 0) return -1;
|
TAOS_CHECK_EXIT(tDecodeU16(&decoder, &dnodeEp.ep.port));
|
||||||
if (taosArrayPush(pRsp->pDnodeEps, &dnodeEp) == NULL) {
|
if (taosArrayPush(pRsp->pDnodeEps, &dnodeEp) == NULL) {
|
||||||
return -1;
|
TAOS_CHECK_EXIT(terrno);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tDecodeI32(&decoder, &pRsp->statusSeq) < 0) return -1;
|
TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pRsp->statusSeq));
|
||||||
|
|
||||||
if (!tDecodeIsEnd(&decoder)) {
|
if (!tDecodeIsEnd(&decoder)) {
|
||||||
if (tDecodeI64(&decoder, &pRsp->ipWhiteVer) < 0) return -1;
|
TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pRsp->ipWhiteVer));
|
||||||
}
|
}
|
||||||
tEndDecode(&decoder);
|
tEndDecode(&decoder);
|
||||||
|
_exit:
|
||||||
tDecoderClear(&decoder);
|
tDecoderClear(&decoder);
|
||||||
return 0;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
void tFreeSStatusRsp(SStatusRsp *pRsp) { taosArrayDestroy(pRsp->pDnodeEps); }
|
void tFreeSStatusRsp(SStatusRsp *pRsp) { taosArrayDestroy(pRsp->pDnodeEps); }
|
||||||
|
|
||||||
int32_t tSerializeSStatisReq(void *buf, int32_t bufLen, SStatisReq *pReq) {
|
int32_t tSerializeSStatisReq(void *buf, int32_t bufLen, SStatisReq *pReq) {
|
||||||
SEncoder encoder = {0};
|
SEncoder encoder = {0};
|
||||||
|
int32_t code = 0;
|
||||||
|
int32_t lino;
|
||||||
|
int32_t tlen;
|
||||||
tEncoderInit(&encoder, buf, bufLen);
|
tEncoderInit(&encoder, buf, bufLen);
|
||||||
|
|
||||||
if (tStartEncode(&encoder) < 0) return -1;
|
TAOS_CHECK_EXIT(tStartEncode(&encoder));
|
||||||
|
TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->contLen));
|
||||||
if (tEncodeI32(&encoder, pReq->contLen) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->pCont));
|
||||||
if (tEncodeCStr(&encoder, pReq->pCont) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->type));
|
||||||
if (tEncodeI8(&encoder, pReq->type) < 0) return -1;
|
|
||||||
|
|
||||||
tEndEncode(&encoder);
|
tEndEncode(&encoder);
|
||||||
|
|
||||||
int32_t tlen = encoder.pos;
|
_exit:
|
||||||
|
if (code) {
|
||||||
|
tlen = code;
|
||||||
|
} else {
|
||||||
|
tlen = encoder.pos;
|
||||||
|
}
|
||||||
tEncoderClear(&encoder);
|
tEncoderClear(&encoder);
|
||||||
return tlen;
|
return tlen;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tDeserializeSStatisReq(void *buf, int32_t bufLen, SStatisReq *pReq) {
|
int32_t tDeserializeSStatisReq(void *buf, int32_t bufLen, SStatisReq *pReq) {
|
||||||
SDecoder decoder = {0};
|
SDecoder decoder = {0};
|
||||||
|
int32_t code = 0;
|
||||||
|
int32_t lino;
|
||||||
tDecoderInit(&decoder, buf, bufLen);
|
tDecoderInit(&decoder, buf, bufLen);
|
||||||
|
|
||||||
if (tStartDecode(&decoder) < 0) return -1;
|
TAOS_CHECK_EXIT(tStartDecode(&decoder));
|
||||||
|
TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->contLen));
|
||||||
if (tDecodeI32(&decoder, &pReq->contLen) < 0) return -1;
|
|
||||||
if (pReq->contLen > 0) {
|
if (pReq->contLen > 0) {
|
||||||
pReq->pCont = taosMemoryMalloc(pReq->contLen + 1);
|
pReq->pCont = taosMemoryMalloc(pReq->contLen + 1);
|
||||||
if (pReq->pCont == NULL) return -1;
|
if (pReq->pCont == NULL) {
|
||||||
if (tDecodeCStrTo(&decoder, pReq->pCont) < 0) return -1;
|
TAOS_CHECK_EXIT(terrno);
|
||||||
|
}
|
||||||
|
TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->pCont));
|
||||||
}
|
}
|
||||||
if (!tDecodeIsEnd(&decoder)) {
|
if (!tDecodeIsEnd(&decoder)) {
|
||||||
if (tDecodeI8(&decoder, (int8_t *)&pReq->type) < 0) return -1;
|
TAOS_CHECK_EXIT(tDecodeI8(&decoder, (int8_t *)&pReq->type));
|
||||||
}
|
}
|
||||||
tEndDecode(&decoder);
|
tEndDecode(&decoder);
|
||||||
|
_exit:
|
||||||
tDecoderClear(&decoder);
|
tDecoderClear(&decoder);
|
||||||
return 0;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
void tFreeSStatisReq(SStatisReq *pReq) { taosMemoryFreeClear(pReq->pCont); }
|
void tFreeSStatisReq(SStatisReq *pReq) { taosMemoryFreeClear(pReq->pCont); }
|
||||||
|
|
||||||
// int32_t tSerializeSCreateAcctReq(void *buf, int32_t bufLen, SCreateAcctReq *pReq) {
|
|
||||||
// SEncoder encoder = {0};
|
|
||||||
// tEncoderInit(&encoder, buf, bufLen);
|
|
||||||
|
|
||||||
// if (tStartEncode(&encoder) < 0) return -1;
|
|
||||||
// if (tEncodeCStr(&encoder, pReq->user) < 0) return -1;
|
|
||||||
// if (tEncodeCStr(&encoder, pReq->pass) < 0) return -1;
|
|
||||||
// if (tEncodeI32(&encoder, pReq->maxUsers) < 0) return -1;
|
|
||||||
// if (tEncodeI32(&encoder, pReq->maxDbs) < 0) return -1;
|
|
||||||
// if (tEncodeI32(&encoder, pReq->maxTimeSeries) < 0) return -1;
|
|
||||||
// if (tEncodeI32(&encoder, pReq->maxStreams) < 0) return -1;
|
|
||||||
// if (tEncodeI32(&encoder, pReq->accessState) < 0) return -1;
|
|
||||||
// if (tEncodeI64(&encoder, pReq->maxStorage) < 0) return -1;
|
|
||||||
// tEndEncode(&encoder);
|
|
||||||
|
|
||||||
// int32_t tlen = encoder.pos;
|
|
||||||
// tEncoderClear(&encoder);
|
|
||||||
// return tlen;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// int32_t tDeserializeSCreateAcctReq(void *buf, int32_t bufLen, SCreateAcctReq *pReq) {
|
|
||||||
// SDecoder decoder = {0};
|
|
||||||
// tDecoderInit(&decoder, buf, bufLen);
|
|
||||||
|
|
||||||
// if (tStartDecode(&decoder) < 0) return -1;
|
|
||||||
// if (tDecodeCStrTo(&decoder, pReq->user) < 0) return -1;
|
|
||||||
// if (tDecodeCStrTo(&decoder, pReq->pass) < 0) return -1;
|
|
||||||
// if (tDecodeI32(&decoder, &pReq->maxUsers) < 0) return -1;
|
|
||||||
// if (tDecodeI32(&decoder, &pReq->maxDbs) < 0) return -1;
|
|
||||||
// if (tDecodeI32(&decoder, &pReq->maxTimeSeries) < 0) return -1;
|
|
||||||
// if (tDecodeI32(&decoder, &pReq->maxStreams) < 0) return -1;
|
|
||||||
// if (tDecodeI32(&decoder, &pReq->accessState) < 0) return -1;
|
|
||||||
// if (tDecodeI64(&decoder, &pReq->maxStorage) < 0) return -1;
|
|
||||||
// tEndDecode(&decoder);
|
|
||||||
|
|
||||||
// tDecoderClear(&decoder);
|
|
||||||
// return 0;
|
|
||||||
// }
|
|
||||||
|
|
||||||
int32_t tSerializeSDropUserReq(void *buf, int32_t bufLen, SDropUserReq *pReq) {
|
int32_t tSerializeSDropUserReq(void *buf, int32_t bufLen, SDropUserReq *pReq) {
|
||||||
SEncoder encoder = {0};
|
SEncoder encoder = {0};
|
||||||
|
int32_t code = 0;
|
||||||
|
int32_t lino;
|
||||||
|
int32_t tlen;
|
||||||
tEncoderInit(&encoder, buf, bufLen);
|
tEncoderInit(&encoder, buf, bufLen);
|
||||||
|
|
||||||
if (tStartEncode(&encoder) < 0) return -1;
|
TAOS_CHECK_EXIT(tStartEncode(&encoder));
|
||||||
if (tEncodeCStr(&encoder, pReq->user) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->user));
|
||||||
ENCODESQL();
|
ENCODESQL();
|
||||||
tEndEncode(&encoder);
|
tEndEncode(&encoder);
|
||||||
|
|
||||||
int32_t tlen = encoder.pos;
|
_exit:
|
||||||
|
if (code) {
|
||||||
|
tlen = code;
|
||||||
|
} else {
|
||||||
|
tlen = encoder.pos;
|
||||||
|
}
|
||||||
tEncoderClear(&encoder);
|
tEncoderClear(&encoder);
|
||||||
return tlen;
|
return tlen;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tDeserializeSDropUserReq(void *buf, int32_t bufLen, SDropUserReq *pReq) {
|
int32_t tDeserializeSDropUserReq(void *buf, int32_t bufLen, SDropUserReq *pReq) {
|
||||||
SDecoder decoder = {0};
|
SDecoder decoder = {0};
|
||||||
|
int32_t code = 0;
|
||||||
|
int32_t lino;
|
||||||
tDecoderInit(&decoder, buf, bufLen);
|
tDecoderInit(&decoder, buf, bufLen);
|
||||||
|
|
||||||
if (tStartDecode(&decoder) < 0) return -1;
|
TAOS_CHECK_EXIT(tStartDecode(&decoder));
|
||||||
if (tDecodeCStrTo(&decoder, pReq->user) < 0) return -1;
|
TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->user));
|
||||||
DECODESQL();
|
DECODESQL();
|
||||||
tEndDecode(&decoder);
|
tEndDecode(&decoder);
|
||||||
|
|
||||||
|
_exit:
|
||||||
tDecoderClear(&decoder);
|
tDecoderClear(&decoder);
|
||||||
return 0;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
void tFreeSDropUserReq(SDropUserReq *pReq) { FREESQL(); }
|
void tFreeSDropUserReq(SDropUserReq *pReq) { FREESQL(); }
|
||||||
|
@ -1858,113 +1852,143 @@ SIpWhiteList *cloneIpWhiteList(SIpWhiteList *pIpWhiteList) {
|
||||||
|
|
||||||
int32_t tSerializeSCreateUserReq(void *buf, int32_t bufLen, SCreateUserReq *pReq) {
|
int32_t tSerializeSCreateUserReq(void *buf, int32_t bufLen, SCreateUserReq *pReq) {
|
||||||
SEncoder encoder = {0};
|
SEncoder encoder = {0};
|
||||||
|
int32_t code = 0;
|
||||||
|
int32_t lino;
|
||||||
|
int32_t tlen;
|
||||||
tEncoderInit(&encoder, buf, bufLen);
|
tEncoderInit(&encoder, buf, bufLen);
|
||||||
|
|
||||||
if (tStartEncode(&encoder) < 0) return -1;
|
TAOS_CHECK_EXIT(tStartEncode(&encoder));
|
||||||
if (tEncodeI8(&encoder, pReq->createType) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->createType));
|
||||||
if (tEncodeI8(&encoder, pReq->superUser) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->superUser));
|
||||||
if (tEncodeI8(&encoder, pReq->sysInfo) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->sysInfo));
|
||||||
if (tEncodeI8(&encoder, pReq->enable) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->enable));
|
||||||
if (tEncodeCStr(&encoder, pReq->user) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->user));
|
||||||
if (tEncodeCStr(&encoder, pReq->pass) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->pass));
|
||||||
if (tEncodeI32(&encoder, pReq->numIpRanges) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->numIpRanges));
|
||||||
for (int32_t i = 0; i < pReq->numIpRanges; ++i) {
|
for (int32_t i = 0; i < pReq->numIpRanges; ++i) {
|
||||||
if (tEncodeU32(&encoder, pReq->pIpRanges[i].ip) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeU32(&encoder, pReq->pIpRanges[i].ip));
|
||||||
if (tEncodeU32(&encoder, pReq->pIpRanges[i].mask) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeU32(&encoder, pReq->pIpRanges[i].mask));
|
||||||
}
|
}
|
||||||
ENCODESQL();
|
ENCODESQL();
|
||||||
if (tEncodeI8(&encoder, pReq->isImport) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->isImport));
|
||||||
if (tEncodeI8(&encoder, pReq->createDb) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->createDb));
|
||||||
|
|
||||||
tEndEncode(&encoder);
|
tEndEncode(&encoder);
|
||||||
|
|
||||||
int32_t tlen = encoder.pos;
|
_exit:
|
||||||
|
if (code) {
|
||||||
|
tlen = code;
|
||||||
|
} else {
|
||||||
|
tlen = encoder.pos;
|
||||||
|
}
|
||||||
tEncoderClear(&encoder);
|
tEncoderClear(&encoder);
|
||||||
return tlen;
|
return tlen;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tDeserializeSCreateUserReq(void *buf, int32_t bufLen, SCreateUserReq *pReq) {
|
int32_t tDeserializeSCreateUserReq(void *buf, int32_t bufLen, SCreateUserReq *pReq) {
|
||||||
SDecoder decoder = {0};
|
SDecoder decoder = {0};
|
||||||
|
int32_t code = 0;
|
||||||
|
int32_t lino;
|
||||||
tDecoderInit(&decoder, buf, bufLen);
|
tDecoderInit(&decoder, buf, bufLen);
|
||||||
|
|
||||||
if (tStartDecode(&decoder) < 0) return -1;
|
TAOS_CHECK_EXIT(tStartDecode(&decoder));
|
||||||
if (tDecodeI8(&decoder, &pReq->createType) < 0) return -1;
|
TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->createType));
|
||||||
if (tDecodeI8(&decoder, &pReq->superUser) < 0) return -1;
|
TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->superUser));
|
||||||
if (tDecodeI8(&decoder, &pReq->sysInfo) < 0) return -1;
|
TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->sysInfo));
|
||||||
if (tDecodeI8(&decoder, &pReq->enable) < 0) return -1;
|
TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->enable));
|
||||||
if (tDecodeCStrTo(&decoder, pReq->user) < 0) return -1;
|
TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->user));
|
||||||
if (tDecodeCStrTo(&decoder, pReq->pass) < 0) return -1;
|
TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->pass));
|
||||||
if (tDecodeI32(&decoder, &pReq->numIpRanges) < 0) return -1;
|
TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->numIpRanges));
|
||||||
pReq->pIpRanges = taosMemoryMalloc(pReq->numIpRanges * sizeof(SIpV4Range));
|
pReq->pIpRanges = taosMemoryMalloc(pReq->numIpRanges * sizeof(SIpV4Range));
|
||||||
if (pReq->pIpRanges == NULL) return -1;
|
if (pReq->pIpRanges == NULL) {
|
||||||
|
TAOS_CHECK_EXIT(terrno);
|
||||||
|
}
|
||||||
for (int32_t i = 0; i < pReq->numIpRanges; ++i) {
|
for (int32_t i = 0; i < pReq->numIpRanges; ++i) {
|
||||||
if (tDecodeU32(&decoder, &(pReq->pIpRanges[i].ip)) < 0) return -1;
|
TAOS_CHECK_EXIT(tDecodeU32(&decoder, &(pReq->pIpRanges[i].ip)));
|
||||||
if (tDecodeU32(&decoder, &(pReq->pIpRanges[i].mask)) < 0) return -1;
|
TAOS_CHECK_EXIT(tDecodeU32(&decoder, &(pReq->pIpRanges[i].mask)));
|
||||||
}
|
}
|
||||||
DECODESQL();
|
DECODESQL();
|
||||||
if (!tDecodeIsEnd(&decoder)) {
|
if (!tDecodeIsEnd(&decoder)) {
|
||||||
if (tDecodeI8(&decoder, &pReq->createDb) < 0) return -1;
|
TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->createDb));
|
||||||
if (tDecodeI8(&decoder, &pReq->isImport) < 0) return -1;
|
TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->isImport));
|
||||||
}
|
}
|
||||||
|
|
||||||
tEndDecode(&decoder);
|
tEndDecode(&decoder);
|
||||||
|
|
||||||
|
_exit:
|
||||||
tDecoderClear(&decoder);
|
tDecoderClear(&decoder);
|
||||||
return 0;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tSerializeSUpdateIpWhite(void *buf, int32_t bufLen, SUpdateIpWhite *pReq) {
|
int32_t tSerializeSUpdateIpWhite(void *buf, int32_t bufLen, SUpdateIpWhite *pReq) {
|
||||||
// impl later
|
|
||||||
SEncoder encoder = {0};
|
SEncoder encoder = {0};
|
||||||
|
int32_t code = 0;
|
||||||
|
int32_t lino;
|
||||||
|
int32_t tlen;
|
||||||
|
|
||||||
tEncoderInit(&encoder, buf, bufLen);
|
tEncoderInit(&encoder, buf, bufLen);
|
||||||
if (tStartEncode(&encoder) < 0) return -1;
|
TAOS_CHECK_EXIT(tStartEncode(&encoder));
|
||||||
if (tEncodeI64(&encoder, pReq->ver) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->ver));
|
||||||
if (tEncodeI32(&encoder, pReq->numOfUser) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->numOfUser));
|
||||||
for (int i = 0; i < pReq->numOfUser; i++) {
|
for (int i = 0; i < pReq->numOfUser; i++) {
|
||||||
SUpdateUserIpWhite *pUser = &(pReq->pUserIpWhite[i]);
|
SUpdateUserIpWhite *pUser = &(pReq->pUserIpWhite[i]);
|
||||||
|
|
||||||
if (tEncodeI64(&encoder, pUser->ver) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeI64(&encoder, pUser->ver));
|
||||||
if (tEncodeCStr(&encoder, pUser->user) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pUser->user));
|
||||||
if (tEncodeI32(&encoder, pUser->numOfRange) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeI32(&encoder, pUser->numOfRange));
|
||||||
for (int j = 0; j < pUser->numOfRange; j++) {
|
for (int j = 0; j < pUser->numOfRange; j++) {
|
||||||
SIpV4Range *pRange = &pUser->pIpRanges[j];
|
SIpV4Range *pRange = &pUser->pIpRanges[j];
|
||||||
if (tEncodeU32(&encoder, pRange->ip) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeU32(&encoder, pRange->ip));
|
||||||
if (tEncodeU32(&encoder, pRange->mask) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeU32(&encoder, pRange->mask));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tEndEncode(&encoder);
|
tEndEncode(&encoder);
|
||||||
|
|
||||||
int32_t tlen = encoder.pos;
|
_exit:
|
||||||
|
if (code) {
|
||||||
|
tlen = code;
|
||||||
|
} else {
|
||||||
|
tlen = encoder.pos;
|
||||||
|
}
|
||||||
tEncoderClear(&encoder);
|
tEncoderClear(&encoder);
|
||||||
return tlen;
|
return tlen;
|
||||||
}
|
}
|
||||||
int32_t tDeserializeSUpdateIpWhite(void *buf, int32_t bufLen, SUpdateIpWhite *pReq) {
|
int32_t tDeserializeSUpdateIpWhite(void *buf, int32_t bufLen, SUpdateIpWhite *pReq) {
|
||||||
SDecoder decoder = {0};
|
SDecoder decoder = {0};
|
||||||
|
int32_t code = 0;
|
||||||
|
int32_t lino;
|
||||||
tDecoderInit(&decoder, buf, bufLen);
|
tDecoderInit(&decoder, buf, bufLen);
|
||||||
|
|
||||||
if (tStartDecode(&decoder) < 0) return -1;
|
TAOS_CHECK_EXIT(tStartDecode(&decoder));
|
||||||
// impl later
|
// impl later
|
||||||
if (tDecodeI64(&decoder, &pReq->ver) < 0) return -1;
|
TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->ver));
|
||||||
if (tDecodeI32(&decoder, &pReq->numOfUser) < 0) return -1;
|
TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->numOfUser));
|
||||||
|
|
||||||
if ((pReq->pUserIpWhite = taosMemoryCalloc(1, sizeof(SUpdateUserIpWhite) * pReq->numOfUser)) == NULL) return -1;
|
if ((pReq->pUserIpWhite = taosMemoryCalloc(1, sizeof(SUpdateUserIpWhite) * pReq->numOfUser)) == NULL) {
|
||||||
|
TAOS_CHECK_EXIT(terrno);
|
||||||
|
}
|
||||||
for (int i = 0; i < pReq->numOfUser; i++) {
|
for (int i = 0; i < pReq->numOfUser; i++) {
|
||||||
SUpdateUserIpWhite *pUserWhite = &pReq->pUserIpWhite[i];
|
SUpdateUserIpWhite *pUserWhite = &pReq->pUserIpWhite[i];
|
||||||
if (tDecodeI64(&decoder, &pUserWhite->ver) < 0) return -1;
|
TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pUserWhite->ver));
|
||||||
if (tDecodeCStrTo(&decoder, pUserWhite->user) < 0) return -1;
|
TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pUserWhite->user));
|
||||||
if (tDecodeI32(&decoder, &pUserWhite->numOfRange) < 0) return -1;
|
TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pUserWhite->numOfRange));
|
||||||
|
|
||||||
if ((pUserWhite->pIpRanges = taosMemoryCalloc(1, pUserWhite->numOfRange * sizeof(SIpV4Range))) == NULL) return -1;
|
if ((pUserWhite->pIpRanges = taosMemoryCalloc(1, pUserWhite->numOfRange * sizeof(SIpV4Range))) == NULL) {
|
||||||
|
TAOS_CHECK_EXIT(terrno);
|
||||||
|
}
|
||||||
for (int j = 0; j < pUserWhite->numOfRange; j++) {
|
for (int j = 0; j < pUserWhite->numOfRange; j++) {
|
||||||
SIpV4Range *pRange = &pUserWhite->pIpRanges[j];
|
SIpV4Range *pRange = &pUserWhite->pIpRanges[j];
|
||||||
if (tDecodeU32(&decoder, &pRange->ip) < 0) return -1;
|
TAOS_CHECK_EXIT(tDecodeU32(&decoder, &pRange->ip));
|
||||||
if (tDecodeU32(&decoder, &pRange->mask) < 0) return -1;
|
TAOS_CHECK_EXIT(tDecodeU32(&decoder, &pRange->mask));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tEndDecode(&decoder);
|
tEndDecode(&decoder);
|
||||||
|
|
||||||
|
_exit:
|
||||||
tDecoderClear(&decoder);
|
tDecoderClear(&decoder);
|
||||||
return 0;
|
return code;
|
||||||
}
|
}
|
||||||
void tFreeSUpdateIpWhiteReq(SUpdateIpWhite *pReq) {
|
void tFreeSUpdateIpWhiteReq(SUpdateIpWhite *pReq) {
|
||||||
if (pReq == NULL) return;
|
if (pReq == NULL) return;
|
||||||
|
@ -2023,29 +2047,39 @@ _return:
|
||||||
}
|
}
|
||||||
int32_t tSerializeRetrieveIpWhite(void *buf, int32_t bufLen, SRetrieveIpWhiteReq *pReq) {
|
int32_t tSerializeRetrieveIpWhite(void *buf, int32_t bufLen, SRetrieveIpWhiteReq *pReq) {
|
||||||
SEncoder encoder = {0};
|
SEncoder encoder = {0};
|
||||||
|
int32_t code = 0;
|
||||||
|
int32_t lino;
|
||||||
|
int32_t tlen;
|
||||||
tEncoderInit(&encoder, buf, bufLen);
|
tEncoderInit(&encoder, buf, bufLen);
|
||||||
if (tStartEncode(&encoder) < 0) return -1;
|
|
||||||
|
|
||||||
if (tEncodeI64(&encoder, pReq->ipWhiteVer) < 0) {
|
TAOS_CHECK_EXIT(tStartEncode(&encoder));
|
||||||
return -1;
|
TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->ipWhiteVer));
|
||||||
}
|
|
||||||
tEndEncode(&encoder);
|
tEndEncode(&encoder);
|
||||||
|
|
||||||
int32_t tlen = encoder.pos;
|
_exit:
|
||||||
|
if (code) {
|
||||||
|
tlen = code;
|
||||||
|
} else {
|
||||||
|
tlen = encoder.pos;
|
||||||
|
}
|
||||||
tEncoderClear(&encoder);
|
tEncoderClear(&encoder);
|
||||||
return tlen;
|
return tlen;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tDeserializeRetrieveIpWhite(void *buf, int32_t bufLen, SRetrieveIpWhiteReq *pReq) {
|
int32_t tDeserializeRetrieveIpWhite(void *buf, int32_t bufLen, SRetrieveIpWhiteReq *pReq) {
|
||||||
SDecoder decoder = {0};
|
SDecoder decoder = {0};
|
||||||
|
int32_t code = 0;
|
||||||
|
int32_t lino;
|
||||||
|
|
||||||
tDecoderInit(&decoder, buf, bufLen);
|
tDecoderInit(&decoder, buf, bufLen);
|
||||||
|
|
||||||
if (tStartDecode(&decoder) < 0) return -1;
|
TAOS_CHECK_EXIT(tStartDecode(&decoder));
|
||||||
// impl later
|
TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->ipWhiteVer));
|
||||||
if (tDecodeI64(&decoder, &pReq->ipWhiteVer) < 0) return -1;
|
|
||||||
tEndDecode(&decoder);
|
tEndDecode(&decoder);
|
||||||
|
|
||||||
|
_exit:
|
||||||
tDecoderClear(&decoder);
|
tDecoderClear(&decoder);
|
||||||
return 0;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
void tFreeSCreateUserReq(SCreateUserReq *pReq) {
|
void tFreeSCreateUserReq(SCreateUserReq *pReq) {
|
||||||
|
@ -2055,77 +2089,90 @@ void tFreeSCreateUserReq(SCreateUserReq *pReq) {
|
||||||
|
|
||||||
int32_t tSerializeSAlterUserReq(void *buf, int32_t bufLen, SAlterUserReq *pReq) {
|
int32_t tSerializeSAlterUserReq(void *buf, int32_t bufLen, SAlterUserReq *pReq) {
|
||||||
SEncoder encoder = {0};
|
SEncoder encoder = {0};
|
||||||
|
int32_t code = 0;
|
||||||
|
int32_t lino;
|
||||||
|
int32_t tlen;
|
||||||
tEncoderInit(&encoder, buf, bufLen);
|
tEncoderInit(&encoder, buf, bufLen);
|
||||||
|
|
||||||
if (tStartEncode(&encoder) < 0) return -1;
|
TAOS_CHECK_EXIT(tStartEncode(&encoder));
|
||||||
if (tEncodeI8(&encoder, pReq->alterType) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->alterType));
|
||||||
if (tEncodeI8(&encoder, pReq->superUser) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->superUser));
|
||||||
if (tEncodeI8(&encoder, pReq->sysInfo) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->sysInfo));
|
||||||
if (tEncodeI8(&encoder, pReq->enable) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->enable));
|
||||||
if (tEncodeI8(&encoder, pReq->isView) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->isView));
|
||||||
if (tEncodeCStr(&encoder, pReq->user) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->user));
|
||||||
if (tEncodeCStr(&encoder, pReq->pass) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->pass));
|
||||||
if (tEncodeCStr(&encoder, pReq->objname) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->objname));
|
||||||
int32_t len = strlen(pReq->tabName);
|
int32_t len = strlen(pReq->tabName);
|
||||||
if (tEncodeI32(&encoder, len) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeI32(&encoder, len));
|
||||||
if (len > 0) {
|
if (len > 0) {
|
||||||
if (tEncodeCStr(&encoder, pReq->tabName) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->tabName));
|
||||||
}
|
}
|
||||||
if (tEncodeBinary(&encoder, pReq->tagCond, pReq->tagCondLen) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeBinary(&encoder, pReq->tagCond, pReq->tagCondLen));
|
||||||
if (tEncodeI32(&encoder, pReq->numIpRanges) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->numIpRanges));
|
||||||
for (int32_t i = 0; i < pReq->numIpRanges; ++i) {
|
for (int32_t i = 0; i < pReq->numIpRanges; ++i) {
|
||||||
if (tEncodeU32(&encoder, pReq->pIpRanges[i].ip) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeU32(&encoder, pReq->pIpRanges[i].ip));
|
||||||
if (tEncodeU32(&encoder, pReq->pIpRanges[i].mask) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeU32(&encoder, pReq->pIpRanges[i].mask));
|
||||||
}
|
}
|
||||||
if (tEncodeI64(&encoder, pReq->privileges) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->privileges));
|
||||||
ENCODESQL();
|
ENCODESQL();
|
||||||
if (tEncodeU8(&encoder, pReq->flag) < 0) return -1;
|
TAOS_CHECK_EXIT(tEncodeU8(&encoder, pReq->flag));
|
||||||
tEndEncode(&encoder);
|
tEndEncode(&encoder);
|
||||||
|
|
||||||
int32_t tlen = encoder.pos;
|
_exit:
|
||||||
|
if (code) {
|
||||||
|
tlen = code;
|
||||||
|
} else {
|
||||||
|
tlen = encoder.pos;
|
||||||
|
}
|
||||||
tEncoderClear(&encoder);
|
tEncoderClear(&encoder);
|
||||||
return tlen;
|
return tlen;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tDeserializeSAlterUserReq(void *buf, int32_t bufLen, SAlterUserReq *pReq) {
|
int32_t tDeserializeSAlterUserReq(void *buf, int32_t bufLen, SAlterUserReq *pReq) {
|
||||||
SDecoder decoder = {0};
|
SDecoder decoder = {0};
|
||||||
|
int32_t code = 0;
|
||||||
|
int32_t lino;
|
||||||
tDecoderInit(&decoder, buf, bufLen);
|
tDecoderInit(&decoder, buf, bufLen);
|
||||||
|
|
||||||
if (tStartDecode(&decoder) < 0) return -1;
|
TAOS_CHECK_EXIT(tStartDecode(&decoder));
|
||||||
if (tDecodeI8(&decoder, &pReq->alterType) < 0) return -1;
|
TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->alterType));
|
||||||
if (tDecodeI8(&decoder, &pReq->superUser) < 0) return -1;
|
TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->superUser));
|
||||||
if (tDecodeI8(&decoder, &pReq->sysInfo) < 0) return -1;
|
TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->sysInfo));
|
||||||
if (tDecodeI8(&decoder, &pReq->enable) < 0) return -1;
|
TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->enable));
|
||||||
if (tDecodeI8(&decoder, &pReq->isView) < 0) return -1;
|
TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->isView));
|
||||||
if (tDecodeCStrTo(&decoder, pReq->user) < 0) return -1;
|
TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->user));
|
||||||
if (tDecodeCStrTo(&decoder, pReq->pass) < 0) return -1;
|
TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->pass));
|
||||||
if (tDecodeCStrTo(&decoder, pReq->objname) < 0) return -1;
|
TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->objname));
|
||||||
if (!tDecodeIsEnd(&decoder)) {
|
if (!tDecodeIsEnd(&decoder)) {
|
||||||
int32_t len = 0;
|
int32_t len = 0;
|
||||||
if (tDecodeI32(&decoder, &len) < 0) return -1;
|
TAOS_CHECK_EXIT(tDecodeI32(&decoder, &len));
|
||||||
if (len > 0) {
|
if (len > 0) {
|
||||||
if (tDecodeCStrTo(&decoder, pReq->tabName) < 0) return -1;
|
TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->tabName));
|
||||||
}
|
}
|
||||||
uint64_t tagCondLen = 0;
|
uint64_t tagCondLen = 0;
|
||||||
if (tDecodeBinaryAlloc(&decoder, (void **)&pReq->tagCond, &tagCondLen) < 0) return -1;
|
TAOS_CHECK_EXIT(tDecodeBinaryAlloc(&decoder, (void **)&pReq->tagCond, &tagCondLen));
|
||||||
pReq->tagCondLen = tagCondLen;
|
pReq->tagCondLen = tagCondLen;
|
||||||
}
|
}
|
||||||
if (tDecodeI32(&decoder, &pReq->numIpRanges) < 0) return -1;
|
TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->numIpRanges));
|
||||||
pReq->pIpRanges = taosMemoryMalloc(pReq->numIpRanges * sizeof(SIpV4Range));
|
pReq->pIpRanges = taosMemoryMalloc(pReq->numIpRanges * sizeof(SIpV4Range));
|
||||||
if (pReq->pIpRanges == NULL) return -1;
|
if (pReq->pIpRanges == NULL) {
|
||||||
for (int32_t i = 0; i < pReq->numIpRanges; ++i) {
|
TAOS_CHECK_EXIT(terrno);
|
||||||
if (tDecodeU32(&decoder, &(pReq->pIpRanges[i].ip)) < 0) return -1;
|
|
||||||
if (tDecodeU32(&decoder, &(pReq->pIpRanges[i].mask)) < 0) return -1;
|
|
||||||
}
|
}
|
||||||
if (tDecodeI64(&decoder, &pReq->privileges) < 0) return -1;
|
for (int32_t i = 0; i < pReq->numIpRanges; ++i) {
|
||||||
|
TAOS_CHECK_EXIT(tDecodeU32(&decoder, &(pReq->pIpRanges[i].ip)));
|
||||||
|
TAOS_CHECK_EXIT(tDecodeU32(&decoder, &(pReq->pIpRanges[i].mask)));
|
||||||
|
}
|
||||||
|
TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->privileges));
|
||||||
DECODESQL();
|
DECODESQL();
|
||||||
if (!tDecodeIsEnd(&decoder)) {
|
if (!tDecodeIsEnd(&decoder)) {
|
||||||
if (tDecodeU8(&decoder, &pReq->flag) < 0) return -1;
|
TAOS_CHECK_EXIT(tDecodeU8(&decoder, &pReq->flag));
|
||||||
}
|
}
|
||||||
tEndDecode(&decoder);
|
tEndDecode(&decoder);
|
||||||
|
|
||||||
|
_exit:
|
||||||
tDecoderClear(&decoder);
|
tDecoderClear(&decoder);
|
||||||
return 0;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
void tFreeSAlterUserReq(SAlterUserReq *pReq) {
|
void tFreeSAlterUserReq(SAlterUserReq *pReq) {
|
||||||
|
@ -2136,60 +2183,71 @@ void tFreeSAlterUserReq(SAlterUserReq *pReq) {
|
||||||
|
|
||||||
int32_t tSerializeSGetUserAuthReq(void *buf, int32_t bufLen, SGetUserAuthReq *pReq) {
|
int32_t tSerializeSGetUserAuthReq(void *buf, int32_t bufLen, SGetUserAuthReq *pReq) {
|
||||||
SEncoder encoder = {0};
|
SEncoder encoder = {0};
|
||||||
tEncoderInit(&encoder, buf, bufLen);
|
int32_t code = 0;
|
||||||
|
int32_t lino;
|
||||||
|
int32_t tlen;
|
||||||
|
|
||||||
if (tStartEncode(&encoder) < 0) return -1;
|
tEncoderInit(&encoder, buf, bufLen);
|
||||||
if (tEncodeCStr(&encoder, pReq->user) < 0) return -1;
|
TAOS_CHECK_EXIT(tStartEncode(&encoder));
|
||||||
|
TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->user));
|
||||||
tEndEncode(&encoder);
|
tEndEncode(&encoder);
|
||||||
|
|
||||||
int32_t tlen = encoder.pos;
|
_exit:
|
||||||
|
if (code) {
|
||||||
|
tlen = code;
|
||||||
|
} else {
|
||||||
|
tlen = encoder.pos;
|
||||||
|
}
|
||||||
tEncoderClear(&encoder);
|
tEncoderClear(&encoder);
|
||||||
return tlen;
|
return tlen;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tDeserializeSGetUserAuthReq(void *buf, int32_t bufLen, SGetUserAuthReq *pReq) {
|
int32_t tDeserializeSGetUserAuthReq(void *buf, int32_t bufLen, SGetUserAuthReq *pReq) {
|
||||||
SDecoder decoder = {0};
|
SDecoder decoder = {0};
|
||||||
|
int32_t code = 0;
|
||||||
|
int32_t lino;
|
||||||
tDecoderInit(&decoder, buf, bufLen);
|
tDecoderInit(&decoder, buf, bufLen);
|
||||||
|
|
||||||
if (tStartDecode(&decoder) < 0) return -1;
|
TAOS_CHECK_EXIT(tStartDecode(&decoder));
|
||||||
if (tDecodeCStrTo(&decoder, pReq->user) < 0) return -1;
|
TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->user));
|
||||||
tEndDecode(&decoder);
|
tEndDecode(&decoder);
|
||||||
|
|
||||||
|
_exit:
|
||||||
tDecoderClear(&decoder);
|
tDecoderClear(&decoder);
|
||||||
return 0;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tSerializeSGetUserAuthRspImpl(SEncoder *pEncoder, SGetUserAuthRsp *pRsp) {
|
int32_t tSerializeSGetUserAuthRspImpl(SEncoder *pEncoder, SGetUserAuthRsp *pRsp) {
|
||||||
if (tEncodeCStr(pEncoder, pRsp->user) < 0) return -1;
|
TAOS_CHECK_RETURN(tEncodeCStr(pEncoder, pRsp->user));
|
||||||
if (tEncodeI8(pEncoder, pRsp->superAuth) < 0) return -1;
|
TAOS_CHECK_RETURN(tEncodeI8(pEncoder, pRsp->superAuth));
|
||||||
if (tEncodeI8(pEncoder, pRsp->sysInfo) < 0) return -1;
|
TAOS_CHECK_RETURN(tEncodeI8(pEncoder, pRsp->sysInfo));
|
||||||
if (tEncodeI8(pEncoder, pRsp->enable) < 0) return -1;
|
TAOS_CHECK_RETURN(tEncodeI8(pEncoder, pRsp->enable));
|
||||||
if (tEncodeI8(pEncoder, pRsp->dropped) < 0) return -1;
|
TAOS_CHECK_RETURN(tEncodeI8(pEncoder, pRsp->dropped));
|
||||||
if (tEncodeI32(pEncoder, pRsp->version) < 0) return -1;
|
TAOS_CHECK_RETURN(tEncodeI32(pEncoder, pRsp->version));
|
||||||
|
|
||||||
int32_t numOfCreatedDbs = taosHashGetSize(pRsp->createdDbs);
|
int32_t numOfCreatedDbs = taosHashGetSize(pRsp->createdDbs);
|
||||||
int32_t numOfReadDbs = taosHashGetSize(pRsp->readDbs);
|
int32_t numOfReadDbs = taosHashGetSize(pRsp->readDbs);
|
||||||
int32_t numOfWriteDbs = taosHashGetSize(pRsp->writeDbs);
|
int32_t numOfWriteDbs = taosHashGetSize(pRsp->writeDbs);
|
||||||
|
|
||||||
if (tEncodeI32(pEncoder, numOfCreatedDbs) < 0) return -1;
|
TAOS_CHECK_RETURN(tEncodeI32(pEncoder, numOfCreatedDbs));
|
||||||
if (tEncodeI32(pEncoder, numOfReadDbs) < 0) return -1;
|
TAOS_CHECK_RETURN(tEncodeI32(pEncoder, numOfReadDbs));
|
||||||
if (tEncodeI32(pEncoder, numOfWriteDbs) < 0) return -1;
|
TAOS_CHECK_RETURN(tEncodeI32(pEncoder, numOfWriteDbs));
|
||||||
|
|
||||||
char *db = taosHashIterate(pRsp->createdDbs, NULL);
|
char *db = taosHashIterate(pRsp->createdDbs, NULL);
|
||||||
while (db != NULL) {
|
while (db != NULL) {
|
||||||
if (tEncodeCStr(pEncoder, db) < 0) return -1;
|
TAOS_CHECK_RETURN(tEncodeCStr(pEncoder, db));
|
||||||
db = taosHashIterate(pRsp->createdDbs, db);
|
db = taosHashIterate(pRsp->createdDbs, db);
|
||||||
}
|
}
|
||||||
|
|
||||||
db = taosHashIterate(pRsp->readDbs, NULL);
|
db = taosHashIterate(pRsp->readDbs, NULL);
|
||||||
while (db != NULL) {
|
while (db != NULL) {
|
||||||
if (tEncodeCStr(pEncoder, db) < 0) return -1;
|
TAOS_CHECK_RETURN(tEncodeCStr(pEncoder, db));
|
||||||
db = taosHashIterate(pRsp->readDbs, db);
|
db = taosHashIterate(pRsp->readDbs, db);
|
||||||
}
|
}
|
||||||
|
|
||||||
db = taosHashIterate(pRsp->writeDbs, NULL);
|
db = taosHashIterate(pRsp->writeDbs, NULL);
|
||||||
while (db != NULL) {
|
while (db != NULL) {
|
||||||
if (tEncodeCStr(pEncoder, db) < 0) return -1;
|
TAOS_CHECK_RETURN(tEncodeCStr(pEncoder, db));
|
||||||
db = taosHashIterate(pRsp->writeDbs, db);
|
db = taosHashIterate(pRsp->writeDbs, db);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2200,25 +2258,25 @@ int32_t tSerializeSGetUserAuthRspImpl(SEncoder *pEncoder, SGetUserAuthRsp *pRsp)
|
||||||
int32_t numOfWriteViews = taosHashGetSize(pRsp->writeViews);
|
int32_t numOfWriteViews = taosHashGetSize(pRsp->writeViews);
|
||||||
int32_t numOfAlterViews = taosHashGetSize(pRsp->alterViews);
|
int32_t numOfAlterViews = taosHashGetSize(pRsp->alterViews);
|
||||||
int32_t numOfUseDbs = taosHashGetSize(pRsp->useDbs);
|
int32_t numOfUseDbs = taosHashGetSize(pRsp->useDbs);
|
||||||
if (tEncodeI32(pEncoder, numOfReadTbs) < 0) return -1;
|
TAOS_CHECK_RETURN(tEncodeI32(pEncoder, numOfReadTbs));
|
||||||
if (tEncodeI32(pEncoder, numOfWriteTbs) < 0) return -1;
|
TAOS_CHECK_RETURN(tEncodeI32(pEncoder, numOfWriteTbs));
|
||||||
if (tEncodeI32(pEncoder, numOfAlterTbs) < 0) return -1;
|
TAOS_CHECK_RETURN(tEncodeI32(pEncoder, numOfAlterTbs));
|
||||||
if (tEncodeI32(pEncoder, numOfReadViews) < 0) return -1;
|
TAOS_CHECK_RETURN(tEncodeI32(pEncoder, numOfReadViews));
|
||||||
if (tEncodeI32(pEncoder, numOfWriteViews) < 0) return -1;
|
TAOS_CHECK_RETURN(tEncodeI32(pEncoder, numOfWriteViews));
|
||||||
if (tEncodeI32(pEncoder, numOfAlterViews) < 0) return -1;
|
TAOS_CHECK_RETURN(tEncodeI32(pEncoder, numOfAlterViews));
|
||||||
if (tEncodeI32(pEncoder, numOfUseDbs) < 0) return -1;
|
TAOS_CHECK_RETURN(tEncodeI32(pEncoder, numOfUseDbs));
|
||||||
|
|
||||||
char *tb = taosHashIterate(pRsp->readTbs, NULL);
|
char *tb = taosHashIterate(pRsp->readTbs, NULL);
|
||||||
while (tb != NULL) {
|
while (tb != NULL) {
|
||||||
size_t keyLen = 0;
|
size_t keyLen = 0;
|
||||||
void *key = taosHashGetKey(tb, &keyLen);
|
void *key = taosHashGetKey(tb, &keyLen);
|
||||||
if (tEncodeI32(pEncoder, keyLen) < 0) return -1;
|
TAOS_CHECK_RETURN(tEncodeI32(pEncoder, keyLen));
|
||||||
if (tEncodeCStr(pEncoder, key) < 0) return -1;
|
TAOS_CHECK_RETURN(tEncodeCStr(pEncoder, key));
|
||||||
|
|
||||||
size_t valueLen = 0;
|
size_t valueLen = 0;
|
||||||
valueLen = strlen(tb);
|
valueLen = strlen(tb);
|
||||||
if (tEncodeI32(pEncoder, valueLen) < 0) return -1;
|
TAOS_CHECK_RETURN(tEncodeI32(pEncoder, valueLen));
|
||||||
if (tEncodeCStr(pEncoder, tb) < 0) return -1;
|
TAOS_CHECK_RETURN(tEncodeCStr(pEncoder, tb));
|
||||||
|
|
||||||
tb = taosHashIterate(pRsp->readTbs, tb);
|
tb = taosHashIterate(pRsp->readTbs, tb);
|
||||||
}
|
}
|
||||||
|
@ -2227,13 +2285,13 @@ int32_t tSerializeSGetUserAuthRspImpl(SEncoder *pEncoder, SGetUserAuthRsp *pRsp)
|
||||||
while (tb != NULL) {
|
while (tb != NULL) {
|
||||||
size_t keyLen = 0;
|
size_t keyLen = 0;
|
||||||
void *key = taosHashGetKey(tb, &keyLen);
|
void *key = taosHashGetKey(tb, &keyLen);
|
||||||
if (tEncodeI32(pEncoder, keyLen) < 0) return -1;
|
TAOS_CHECK_RETURN(tEncodeI32(pEncoder, keyLen));
|
||||||
if (tEncodeCStr(pEncoder, key) < 0) return -1;
|
TAOS_CHECK_RETURN(tEncodeCStr(pEncoder, key));
|
||||||
|
|
||||||
size_t valueLen = 0;
|
size_t valueLen = 0;
|
||||||
valueLen = strlen(tb);
|
valueLen = strlen(tb);
|
||||||
if (tEncodeI32(pEncoder, valueLen) < 0) return -1;
|
TAOS_CHECK_RETURN(tEncodeI32(pEncoder, valueLen));
|
||||||
if (tEncodeCStr(pEncoder, tb) < 0) return -1;
|
TAOS_CHECK_RETURN(tEncodeCStr(pEncoder, tb));
|
||||||
|
|
||||||
tb = taosHashIterate(pRsp->writeTbs, tb);
|
tb = taosHashIterate(pRsp->writeTbs, tb);
|
||||||
}
|
}
|
||||||
|
@ -2242,13 +2300,13 @@ int32_t tSerializeSGetUserAuthRspImpl(SEncoder *pEncoder, SGetUserAuthRsp *pRsp)
|
||||||
while (tb != NULL) {
|
while (tb != NULL) {
|
||||||
size_t keyLen = 0;
|
size_t keyLen = 0;
|
||||||
void *key = taosHashGetKey(tb, &keyLen);
|
void *key = taosHashGetKey(tb, &keyLen);
|
||||||
if (tEncodeI32(pEncoder, keyLen) < 0) return -1;
|
TAOS_CHECK_RETURN(tEncodeI32(pEncoder, keyLen));
|
||||||
if (tEncodeCStr(pEncoder, key) < 0) return -1;
|
TAOS_CHECK_RETURN(tEncodeCStr(pEncoder, key));
|
||||||
|
|
||||||
size_t valueLen = 0;
|
size_t valueLen = 0;
|
||||||
valueLen = strlen(tb);
|
valueLen = strlen(tb);
|
||||||
if (tEncodeI32(pEncoder, valueLen) < 0) return -1;
|
TAOS_CHECK_RETURN(tEncodeI32(pEncoder, valueLen));
|
||||||
if (tEncodeCStr(pEncoder, tb) < 0) return -1;
|
TAOS_CHECK_RETURN(tEncodeCStr(pEncoder, tb));
|
||||||
|
|
||||||
tb = taosHashIterate(pRsp->alterTbs, tb);
|
tb = taosHashIterate(pRsp->alterTbs, tb);
|
||||||
}
|
}
|
||||||
|
@ -2257,13 +2315,13 @@ int32_t tSerializeSGetUserAuthRspImpl(SEncoder *pEncoder, SGetUserAuthRsp *pRsp)
|
||||||
while (tb != NULL) {
|
while (tb != NULL) {
|
||||||
size_t keyLen = 0;
|
size_t keyLen = 0;
|
||||||
void *key = taosHashGetKey(tb, &keyLen);
|
void *key = taosHashGetKey(tb, &keyLen);
|
||||||
if (tEncodeI32(pEncoder, keyLen) < 0) return -1;
|
TAOS_CHECK_RETURN(tEncodeI32(pEncoder, keyLen));
|
||||||
if (tEncodeCStr(pEncoder, key) < 0) return -1;
|
TAOS_CHECK_RETURN(tEncodeCStr(pEncoder, key));
|
||||||
|
|
||||||
size_t valueLen = 0;
|
size_t valueLen = 0;
|
||||||
valueLen = strlen(tb);
|
valueLen = strlen(tb);
|
||||||
if (tEncodeI32(pEncoder, valueLen) < 0) return -1;
|
TAOS_CHECK_RETURN(tEncodeI32(pEncoder, valueLen));
|
||||||
if (tEncodeCStr(pEncoder, tb) < 0) return -1;
|
TAOS_CHECK_RETURN(tEncodeCStr(pEncoder, tb));
|
||||||
|
|
||||||
tb = taosHashIterate(pRsp->readViews, tb);
|
tb = taosHashIterate(pRsp->readViews, tb);
|
||||||
}
|
}
|
||||||
|
@ -2272,13 +2330,13 @@ int32_t tSerializeSGetUserAuthRspImpl(SEncoder *pEncoder, SGetUserAuthRsp *pRsp)
|
||||||
while (tb != NULL) {
|
while (tb != NULL) {
|
||||||
size_t keyLen = 0;
|
size_t keyLen = 0;
|
||||||
void *key = taosHashGetKey(tb, &keyLen);
|
void *key = taosHashGetKey(tb, &keyLen);
|
||||||
if (tEncodeI32(pEncoder, keyLen) < 0) return -1;
|
TAOS_CHECK_RETURN(tEncodeI32(pEncoder, keyLen));
|
||||||
if (tEncodeCStr(pEncoder, key) < 0) return -1;
|
TAOS_CHECK_RETURN(tEncodeCStr(pEncoder, key));
|
||||||
|
|
||||||
size_t valueLen = 0;
|
size_t valueLen = 0;
|
||||||
valueLen = strlen(tb);
|
valueLen = strlen(tb);
|
||||||
if (tEncodeI32(pEncoder, valueLen) < 0) return -1;
|
TAOS_CHECK_RETURN(tEncodeI32(pEncoder, valueLen));
|
||||||
if (tEncodeCStr(pEncoder, tb) < 0) return -1;
|
TAOS_CHECK_RETURN(tEncodeCStr(pEncoder, tb));
|
||||||
|
|
||||||
tb = taosHashIterate(pRsp->writeViews, tb);
|
tb = taosHashIterate(pRsp->writeViews, tb);
|
||||||
}
|
}
|
||||||
|
@ -2287,13 +2345,13 @@ int32_t tSerializeSGetUserAuthRspImpl(SEncoder *pEncoder, SGetUserAuthRsp *pRsp)
|
||||||
while (tb != NULL) {
|
while (tb != NULL) {
|
||||||
size_t keyLen = 0;
|
size_t keyLen = 0;
|
||||||
void *key = taosHashGetKey(tb, &keyLen);
|
void *key = taosHashGetKey(tb, &keyLen);
|
||||||
if (tEncodeI32(pEncoder, keyLen) < 0) return -1;
|
TAOS_CHECK_RETURN(tEncodeI32(pEncoder, keyLen));
|
||||||
if (tEncodeCStr(pEncoder, key) < 0) return -1;
|
TAOS_CHECK_RETURN(tEncodeCStr(pEncoder, key));
|
||||||
|
|
||||||
size_t valueLen = 0;
|
size_t valueLen = 0;
|
||||||
valueLen = strlen(tb);
|
valueLen = strlen(tb);
|
||||||
if (tEncodeI32(pEncoder, valueLen) < 0) return -1;
|
TAOS_CHECK_RETURN(tEncodeI32(pEncoder, valueLen));
|
||||||
if (tEncodeCStr(pEncoder, tb) < 0) return -1;
|
TAOS_CHECK_RETURN(tEncodeCStr(pEncoder, tb));
|
||||||
|
|
||||||
tb = taosHashIterate(pRsp->alterViews, tb);
|
tb = taosHashIterate(pRsp->alterViews, tb);
|
||||||
}
|
}
|
||||||
|
@ -2302,30 +2360,36 @@ int32_t tSerializeSGetUserAuthRspImpl(SEncoder *pEncoder, SGetUserAuthRsp *pRsp)
|
||||||
while (useDb != NULL) {
|
while (useDb != NULL) {
|
||||||
size_t keyLen = 0;
|
size_t keyLen = 0;
|
||||||
void *key = taosHashGetKey(useDb, &keyLen);
|
void *key = taosHashGetKey(useDb, &keyLen);
|
||||||
if (tEncodeI32(pEncoder, keyLen) < 0) return -1;
|
TAOS_CHECK_RETURN(tEncodeI32(pEncoder, keyLen));
|
||||||
if (tEncodeCStr(pEncoder, key) < 0) return -1;
|
TAOS_CHECK_RETURN(tEncodeCStr(pEncoder, key));
|
||||||
|
TAOS_CHECK_RETURN(tEncodeI32(pEncoder, *useDb));
|
||||||
if (tEncodeI32(pEncoder, *useDb) < 0) return -1;
|
|
||||||
useDb = taosHashIterate(pRsp->useDbs, useDb);
|
useDb = taosHashIterate(pRsp->useDbs, useDb);
|
||||||
}
|
}
|
||||||
|
|
||||||
// since 3.0.7.0
|
// since 3.0.7.0
|
||||||
if (tEncodeI32(pEncoder, pRsp->passVer) < 0) return -1;
|
TAOS_CHECK_RETURN(tEncodeI32(pEncoder, pRsp->passVer));
|
||||||
if (tEncodeI64(pEncoder, pRsp->whiteListVer) < 0) return -1;
|
TAOS_CHECK_RETURN(tEncodeI64(pEncoder, pRsp->whiteListVer));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tSerializeSGetUserAuthRsp(void *buf, int32_t bufLen, SGetUserAuthRsp *pRsp) {
|
int32_t tSerializeSGetUserAuthRsp(void *buf, int32_t bufLen, SGetUserAuthRsp *pRsp) {
|
||||||
SEncoder encoder = {0};
|
SEncoder encoder = {0};
|
||||||
|
int32_t code = 0;
|
||||||
|
int32_t lino;
|
||||||
|
int32_t tlen;
|
||||||
tEncoderInit(&encoder, buf, bufLen);
|
tEncoderInit(&encoder, buf, bufLen);
|
||||||
|
|
||||||
if (tStartEncode(&encoder) < 0) return -1;
|
TAOS_CHECK_EXIT(tStartEncode(&encoder));
|
||||||
|
TAOS_CHECK_EXIT(tSerializeSGetUserAuthRspImpl(&encoder, pRsp));
|
||||||
if (tSerializeSGetUserAuthRspImpl(&encoder, pRsp) < 0) return -1;
|
|
||||||
|
|
||||||
tEndEncode(&encoder);
|
tEndEncode(&encoder);
|
||||||
|
|
||||||
int32_t tlen = encoder.pos;
|
_exit:
|
||||||
|
if (code) {
|
||||||
|
tlen = code;
|
||||||
|
} else {
|
||||||
|
tlen = encoder.pos;
|
||||||
|
}
|
||||||
tEncoderClear(&encoder);
|
tEncoderClear(&encoder);
|
||||||
return tlen;
|
return tlen;
|
||||||
}
|
}
|
||||||
|
@ -2558,16 +2622,18 @@ _err:
|
||||||
|
|
||||||
int32_t tDeserializeSGetUserAuthRsp(void *buf, int32_t bufLen, SGetUserAuthRsp *pRsp) {
|
int32_t tDeserializeSGetUserAuthRsp(void *buf, int32_t bufLen, SGetUserAuthRsp *pRsp) {
|
||||||
SDecoder decoder = {0};
|
SDecoder decoder = {0};
|
||||||
|
int32_t code = 0;
|
||||||
|
int32_t lino;
|
||||||
tDecoderInit(&decoder, buf, bufLen);
|
tDecoderInit(&decoder, buf, bufLen);
|
||||||
|
|
||||||
if (tStartDecode(&decoder) < 0) return -1;
|
TAOS_CHECK_EXIT(tStartDecode(&decoder));
|
||||||
|
TAOS_CHECK_EXIT(tDeserializeSGetUserAuthRspImpl(&decoder, pRsp));
|
||||||
if (tDeserializeSGetUserAuthRspImpl(&decoder, pRsp) < 0) return -1;
|
|
||||||
|
|
||||||
tEndDecode(&decoder);
|
tEndDecode(&decoder);
|
||||||
|
|
||||||
|
_exit:
|
||||||
tDecoderClear(&decoder);
|
tDecoderClear(&decoder);
|
||||||
return 0;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
void tFreeSGetUserAuthRsp(SGetUserAuthRsp *pRsp) {
|
void tFreeSGetUserAuthRsp(SGetUserAuthRsp *pRsp) {
|
||||||
|
|
|
@ -59,6 +59,7 @@ static struct {
|
||||||
#endif
|
#endif
|
||||||
bool dumpConfig;
|
bool dumpConfig;
|
||||||
bool dumpSdb;
|
bool dumpSdb;
|
||||||
|
bool deleteTrans;
|
||||||
bool generateGrant;
|
bool generateGrant;
|
||||||
bool memDbg;
|
bool memDbg;
|
||||||
bool checkS3;
|
bool checkS3;
|
||||||
|
@ -187,6 +188,8 @@ static int32_t dmParseArgs(int32_t argc, char const *argv[]) {
|
||||||
}
|
}
|
||||||
} else if (strcmp(argv[i], "-s") == 0) {
|
} else if (strcmp(argv[i], "-s") == 0) {
|
||||||
global.dumpSdb = true;
|
global.dumpSdb = true;
|
||||||
|
} else if (strcmp(argv[i], "-dTxn") == 0) {
|
||||||
|
global.deleteTrans = true;
|
||||||
} else if (strcmp(argv[i], "-E") == 0) {
|
} else if (strcmp(argv[i], "-E") == 0) {
|
||||||
if (i < argc - 1) {
|
if (i < argc - 1) {
|
||||||
if (strlen(argv[++i]) >= PATH_MAX) {
|
if (strlen(argv[++i]) >= PATH_MAX) {
|
||||||
|
@ -436,6 +439,22 @@ int mainWindows(int argc, char **argv) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (global.deleteTrans) {
|
||||||
|
TdFilePtr pFile;
|
||||||
|
if ((code = dmCheckRunning(tsDataDir, &pFile)) != 0) {
|
||||||
|
printf("failed to generate encrypt code since taosd is running, please stop it first, reason:%s",
|
||||||
|
tstrerror(code));
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
mndDeleteTrans();
|
||||||
|
taosCleanupCfg();
|
||||||
|
taosCloseLog();
|
||||||
|
taosCleanupArgs();
|
||||||
|
taosConvDestroy();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
osSetProcPath(argc, (char **)argv);
|
osSetProcPath(argc, (char **)argv);
|
||||||
taosCleanupArgs();
|
taosCleanupArgs();
|
||||||
|
|
||||||
|
|
|
@ -630,4 +630,30 @@ void mndDumpSdb() {
|
||||||
mInfo("dump sdb info success");
|
mInfo("dump sdb info success");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void mndDeleteTrans() {
|
||||||
|
mInfo("start to dump sdb info to sdb.json");
|
||||||
|
|
||||||
|
char path[PATH_MAX * 2] = {0};
|
||||||
|
(void)snprintf(path, sizeof(path), "%s%smnode", tsDataDir, TD_DIRSEP);
|
||||||
|
|
||||||
|
SMsgCb msgCb = {0};
|
||||||
|
msgCb.reportStartupFp = reportStartup;
|
||||||
|
msgCb.sendReqFp = sendReq;
|
||||||
|
msgCb.sendSyncReqFp = sendSyncReq;
|
||||||
|
msgCb.sendRspFp = sendRsp;
|
||||||
|
msgCb.mgmt = (SMgmtWrapper *)(&msgCb); // hack
|
||||||
|
tmsgSetDefault(&msgCb);
|
||||||
|
|
||||||
|
(void)walInit(NULL);
|
||||||
|
(void)syncInit();
|
||||||
|
|
||||||
|
SMnodeOpt opt = {.msgCb = msgCb};
|
||||||
|
SMnode *pMnode = mndOpen(path, &opt);
|
||||||
|
if (pMnode == NULL) return;
|
||||||
|
|
||||||
|
(void)sdbWriteFileForDump(pMnode->pSdb);
|
||||||
|
|
||||||
|
mInfo("dump sdb info success");
|
||||||
|
}
|
||||||
|
|
||||||
#pragma GCC diagnostic pop
|
#pragma GCC diagnostic pop
|
||||||
|
|
|
@ -280,6 +280,7 @@ int32_t sdbReadFile(SSdb *pSdb);
|
||||||
*/
|
*/
|
||||||
int32_t sdbWriteFile(SSdb *pSdb, int32_t delta);
|
int32_t sdbWriteFile(SSdb *pSdb, int32_t delta);
|
||||||
|
|
||||||
|
int32_t sdbWriteFileForDump(SSdb *pSdb);
|
||||||
/**
|
/**
|
||||||
* @brief Parse and write raw data to sdb, then free the pRaw object
|
* @brief Parse and write raw data to sdb, then free the pRaw object
|
||||||
*
|
*
|
||||||
|
|
|
@ -381,7 +381,7 @@ int32_t sdbReadFile(SSdb *pSdb) {
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t sdbWriteFileImp(SSdb *pSdb) {
|
static int32_t sdbWriteFileImp(SSdb *pSdb, int32_t skip_type) {
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
|
|
||||||
char tmpfile[PATH_MAX] = {0};
|
char tmpfile[PATH_MAX] = {0};
|
||||||
|
@ -409,6 +409,7 @@ static int32_t sdbWriteFileImp(SSdb *pSdb) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int32_t i = SDB_MAX - 1; i >= 0; --i) {
|
for (int32_t i = SDB_MAX - 1; i >= 0; --i) {
|
||||||
|
if (i == skip_type) continue;
|
||||||
SdbEncodeFp encodeFp = pSdb->encodeFps[i];
|
SdbEncodeFp encodeFp = pSdb->encodeFps[i];
|
||||||
if (encodeFp == NULL) continue;
|
if (encodeFp == NULL) continue;
|
||||||
|
|
||||||
|
@ -550,7 +551,7 @@ int32_t sdbWriteFile(SSdb *pSdb, int32_t delta) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (code == 0) {
|
if (code == 0) {
|
||||||
code = sdbWriteFileImp(pSdb);
|
code = sdbWriteFileImp(pSdb, -1);
|
||||||
}
|
}
|
||||||
if (code == 0) {
|
if (code == 0) {
|
||||||
if (pSdb->pWal != NULL) {
|
if (pSdb->pWal != NULL) {
|
||||||
|
@ -566,6 +567,14 @@ int32_t sdbWriteFile(SSdb *pSdb, int32_t delta) {
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32_t sdbWriteFileForDump(SSdb *pSdb) {
|
||||||
|
int32_t code = 0;
|
||||||
|
|
||||||
|
code = sdbWriteFileImp(pSdb, 0);
|
||||||
|
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
int32_t sdbDeploy(SSdb *pSdb) {
|
int32_t sdbDeploy(SSdb *pSdb) {
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
code = sdbDeployData(pSdb);
|
code = sdbDeployData(pSdb);
|
||||||
|
|
|
@ -4749,13 +4749,13 @@ int32_t tsdbReaderOpen2(void* pVnode, SQueryTableDataCond* pCond, void* pTableLi
|
||||||
if (pCond->suid != 0) {
|
if (pCond->suid != 0) {
|
||||||
pReader->info.pSchema = metaGetTbTSchema(pReader->pTsdb->pVnode->pMeta, pReader->info.suid, -1, 1);
|
pReader->info.pSchema = metaGetTbTSchema(pReader->pTsdb->pVnode->pMeta, pReader->info.suid, -1, 1);
|
||||||
if (pReader->info.pSchema == NULL) {
|
if (pReader->info.pSchema == NULL) {
|
||||||
tsdbError("failed to get table schema, suid:%" PRIu64 ", ver:-1, %s", pReader->info.suid, pReader->idStr);
|
tsdbWarn("failed to get table schema, suid:%" PRIu64 ", ver:-1, %s", pReader->info.suid, pReader->idStr);
|
||||||
}
|
}
|
||||||
} else if (numOfTables > 0) {
|
} else if (numOfTables > 0) {
|
||||||
STableKeyInfo* pKey = pTableList;
|
STableKeyInfo* pKey = pTableList;
|
||||||
pReader->info.pSchema = metaGetTbTSchema(pReader->pTsdb->pVnode->pMeta, pKey->uid, -1, 1);
|
pReader->info.pSchema = metaGetTbTSchema(pReader->pTsdb->pVnode->pMeta, pKey->uid, -1, 1);
|
||||||
if (pReader->info.pSchema == NULL) {
|
if (pReader->info.pSchema == NULL) {
|
||||||
tsdbError("failed to get table schema, uid:%" PRIu64 ", ver:-1, %s", pKey->uid, pReader->idStr);
|
tsdbWarn("failed to get table schema, uid:%" PRIu64 ", ver:-1, %s", pKey->uid, pReader->idStr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,9 @@ class TDTestCase(TBase):
|
||||||
self.child_table_num = 1
|
self.child_table_num = 1
|
||||||
self.insert_round_num = 300
|
self.insert_round_num = 300
|
||||||
self.row_num_per_round = 15
|
self.row_num_per_round = 15
|
||||||
|
self.row_num_per_round_varbia_json = 8
|
||||||
|
self.rows_all1 = self.insert_round_num * self.row_num_per_round
|
||||||
|
self.rows_all2 = self.insert_round_num * self.row_num_per_round_varbia_json
|
||||||
self.start_ts = 1704082431000
|
self.start_ts = 1704082431000
|
||||||
|
|
||||||
def prepare_data(self):
|
def prepare_data(self):
|
||||||
|
@ -47,8 +50,8 @@ class TDTestCase(TBase):
|
||||||
# check the data
|
# check the data
|
||||||
for i in range(self.child_table_num):
|
for i in range(self.child_table_num):
|
||||||
tdSql.query(f"select * from ct_binary{i+1};")
|
tdSql.query(f"select * from ct_binary{i+1};")
|
||||||
tdSql.checkRows(4500)
|
tdSql.checkRows(self.rows_all1)
|
||||||
row_num = random.randint(0, 3999)
|
row_num = random.randint(0, self.rows_all1-1)
|
||||||
tdSql.checkData(row_num, 1, 'a' * self.max_column_length)
|
tdSql.checkData(row_num, 1, 'a' * self.max_column_length)
|
||||||
tdSql.query(f"show tags from ct_binary{i+1};")
|
tdSql.query(f"show tags from ct_binary{i+1};")
|
||||||
tdSql.checkData(0, 5, tag)
|
tdSql.checkData(0, 5, tag)
|
||||||
|
@ -71,8 +74,8 @@ class TDTestCase(TBase):
|
||||||
# check the data
|
# check the data
|
||||||
for i in range(self.child_table_num):
|
for i in range(self.child_table_num):
|
||||||
tdSql.query(f"select * from ct_varchar{i+1};")
|
tdSql.query(f"select * from ct_varchar{i+1};")
|
||||||
tdSql.checkRows(4500)
|
tdSql.checkRows(self.rows_all1)
|
||||||
row_num = random.randint(0, 3999)
|
row_num = random.randint(0, self.rows_all1-1)
|
||||||
tdSql.checkData(row_num, 1, 'b' * self.max_column_length)
|
tdSql.checkData(row_num, 1, 'b' * self.max_column_length)
|
||||||
tdSql.query(f"show tags from ct_varchar{i+1};")
|
tdSql.query(f"show tags from ct_varchar{i+1};")
|
||||||
tdSql.checkData(0, 5, tag)
|
tdSql.checkData(0, 5, tag)
|
||||||
|
@ -106,14 +109,14 @@ class TDTestCase(TBase):
|
||||||
# check the data
|
# check the data
|
||||||
for i in range(self.child_table_num):
|
for i in range(self.child_table_num):
|
||||||
tdSql.query(f"select * from ct_nchar{i+1};")
|
tdSql.query(f"select * from ct_nchar{i+1};")
|
||||||
tdSql.checkRows(4500)
|
tdSql.checkRows(self.rows_all1)
|
||||||
row_num = random.randint(0, 3999)
|
row_num = random.randint(0, self.rows_all1-1)
|
||||||
tdSql.checkData(row_num, 1, column)
|
tdSql.checkData(row_num, 1, column)
|
||||||
tdSql.query(f"show tags from ct_nchar{i+1};")
|
tdSql.query(f"show tags from ct_nchar{i+1};")
|
||||||
tdSql.checkData(0, 5, tag)
|
tdSql.checkData(0, 5, tag)
|
||||||
|
|
||||||
def test_varbinary_boundary(self):
|
def test_varbinary_boundary(self):
|
||||||
row_num_per_round = 8
|
|
||||||
# create tables
|
# create tables
|
||||||
tdSql.execute(f"create table st_varbinary (ts timestamp, c1 varbinary({self.max_column_length})) tags (t1 varbinary({self.max_tag_length}));")
|
tdSql.execute(f"create table st_varbinary (ts timestamp, c1 varbinary({self.max_column_length})) tags (t1 varbinary({self.max_tag_length}));")
|
||||||
for i in range(self.child_table_num):
|
for i in range(self.child_table_num):
|
||||||
|
@ -124,22 +127,21 @@ class TDTestCase(TBase):
|
||||||
# insert data
|
# insert data
|
||||||
for j in range(self.insert_round_num):
|
for j in range(self.insert_round_num):
|
||||||
sql = "insert into ct_varbinary%s values" % (i+1)
|
sql = "insert into ct_varbinary%s values" % (i+1)
|
||||||
for k in range(row_num_per_round):
|
for k in range(self.row_num_per_round_varbia_json):
|
||||||
sql += "(%s, '%s')," % (str(self.start_ts + (j * self.insert_round_num + k * self.row_num_per_round + 1)), '\\x' + column)
|
sql += "(%s, '%s')," % (str(self.start_ts + (j * self.insert_round_num + k * self.row_num_per_round + 1)), '\\x' + column)
|
||||||
tdSql.execute(sql)
|
tdSql.execute(sql)
|
||||||
tdLog.info(f"Insert {row_num_per_round} rows data into ct_varbinary{i+1} {j+1} times successfully")
|
tdLog.info(f"Insert {self.row_num_per_round_varbia_json} rows data into ct_varbinary{i+1} {j+1} times successfully")
|
||||||
tdSql.execute("flush database db;")
|
tdSql.execute("flush database db;")
|
||||||
# check the data
|
# check the data
|
||||||
for i in range(self.child_table_num):
|
for i in range(self.child_table_num):
|
||||||
tdSql.query(f"select * from ct_varbinary{i+1};")
|
tdSql.query(f"select * from ct_varbinary{i+1};")
|
||||||
tdSql.checkRows(2400)
|
tdSql.checkRows(self.rows_all2)
|
||||||
row_num = random.randint(0, 2399)
|
row_num = random.randint(0, self.rows_all2-1)
|
||||||
tdSql.checkData(row_num, 1, bytes.fromhex(column))
|
tdSql.checkData(row_num, 1, bytes.fromhex(column))
|
||||||
tdSql.query(f"show tags from ct_varbinary{i+1};")
|
tdSql.query(f"show tags from ct_varbinary{i+1};")
|
||||||
tdSql.checkData(0, 5, '\\x' + tag.upper())
|
tdSql.checkData(0, 5, '\\x' + tag.upper())
|
||||||
|
|
||||||
def test_json_tag_boundary(self):
|
def test_json_tag_boundary(self):
|
||||||
row_num_per_round = 8
|
|
||||||
max_json_tag_length = 4095
|
max_json_tag_length = 4095
|
||||||
max_json_tag_key_length = 256
|
max_json_tag_key_length = 256
|
||||||
# create tables
|
# create tables
|
||||||
|
@ -153,16 +155,16 @@ class TDTestCase(TBase):
|
||||||
# insert data
|
# insert data
|
||||||
for j in range(self.insert_round_num):
|
for j in range(self.insert_round_num):
|
||||||
sql = "insert into ct_json_tag%s values" % (i+1)
|
sql = "insert into ct_json_tag%s values" % (i+1)
|
||||||
for k in range(row_num_per_round):
|
for k in range(self.row_num_per_round_varbia_json):
|
||||||
sql += "(%s, '%s')," % (str(self.start_ts + (j * self.insert_round_num + k * self.row_num_per_round + 1)), '\\x' + column)
|
sql += "(%s, '%s')," % (str(self.start_ts + (j * self.insert_round_num + k * self.row_num_per_round + 1)), '\\x' + column)
|
||||||
tdSql.execute(sql)
|
tdSql.execute(sql)
|
||||||
tdLog.info(f"Insert {row_num_per_round} rows data into ct_json_tag{i+1} {j+1} times successfully")
|
tdLog.info(f"Insert {self.row_num_per_round_varbia_json} rows data into ct_json_tag{i+1} {j+1} times successfully")
|
||||||
tdSql.execute("flush database db;")
|
tdSql.execute("flush database db;")
|
||||||
# check the data
|
# check the data
|
||||||
for i in range(self.child_table_num):
|
for i in range(self.child_table_num):
|
||||||
tdSql.query(f"select * from ct_json_tag{i+1} where t1->'{tag_key}' = '{tag_value}';")
|
tdSql.query(f"select * from ct_json_tag{i+1} where t1->'{tag_key}' = '{tag_value}';")
|
||||||
tdSql.checkRows(2400)
|
tdSql.checkRows(self.rows_all2)
|
||||||
row_num = random.randint(0, 2399)
|
row_num = random.randint(0, self.rows_all2-1)
|
||||||
tdSql.checkData(row_num, 1, bytes.fromhex(column))
|
tdSql.checkData(row_num, 1, bytes.fromhex(column))
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
|
|
|
@ -1,23 +1,45 @@
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
from loguru import logger
|
||||||
|
|
||||||
# List of source directories to search
|
# List of source directories to search
|
||||||
|
|
||||||
|
self_path = os.path.dirname(os.path.realpath(__file__))
|
||||||
|
|
||||||
|
# Check if "community" or "tests" is in self_path
|
||||||
|
index_community = self_path.find("community")
|
||||||
|
if index_community != -1:
|
||||||
|
TD_project_path = self_path[:index_community]
|
||||||
|
index_TDinternal = TD_project_path.find("TDinternal")
|
||||||
|
# Check if index_TDinternal is valid and set work_path accordingly
|
||||||
|
if index_TDinternal != -1:
|
||||||
|
work_path = TD_project_path[:index_TDinternal]
|
||||||
|
else:
|
||||||
|
index_tests = self_path.find("tests")
|
||||||
|
if index_tests != -1:
|
||||||
|
TD_project_path = self_path[:index_tests]
|
||||||
|
# Check if index_TDengine is valid and set work_path accordingly
|
||||||
|
index_TDengine = TD_project_path.find("TDengine")
|
||||||
|
if index_TDengine != -1:
|
||||||
|
work_path = TD_project_path[:index_TDengine]
|
||||||
|
TD_project_path = TD_project_path.rstrip('/')
|
||||||
|
print(TD_project_path)
|
||||||
source_dirs = [
|
source_dirs = [
|
||||||
"community/source",
|
f"{TD_project_path}/community/source",
|
||||||
"community/include",
|
f"{TD_project_path}/community/include",
|
||||||
"enterprise/src/plugins/"
|
f"{TD_project_path}/enterprise/src/plugins/"
|
||||||
]
|
]
|
||||||
|
|
||||||
# List of directories to exclude
|
# List of directories to exclude
|
||||||
exclude_dirs = [
|
exclude_dirs = [
|
||||||
"community/source/client/jni"
|
f"{TD_project_path}/community/source/client/jni"
|
||||||
]
|
]
|
||||||
|
|
||||||
# List of files to exclude
|
# List of files to exclude
|
||||||
exclude_source_files = [
|
exclude_source_files = [
|
||||||
"community/source/libs/parser/src/sql.c",
|
f"{TD_project_path}/community/source/libs/parser/src/sql.c",
|
||||||
"community/source/util/src/tlog.c",
|
f"{TD_project_path}/community/source/util/src/tlog.c",
|
||||||
"community/include/util/tlog.h"
|
f"{TD_project_path}/community/include/util/tlog.h"
|
||||||
]
|
]
|
||||||
|
|
||||||
def grep_asserts_in_file(file_path, summary_list, detaild_list):
|
def grep_asserts_in_file(file_path, summary_list, detaild_list):
|
||||||
|
@ -26,10 +48,10 @@ def grep_asserts_in_file(file_path, summary_list, detaild_list):
|
||||||
with open(file_path, 'r') as file:
|
with open(file_path, 'r') as file:
|
||||||
for line_number, line in enumerate(file, start=1):
|
for line_number, line in enumerate(file, start=1):
|
||||||
if re.search(r'\bassert\(.*\)|\bASSERT\(.*\)|\bASSERTS\(.*\)|\bASSERT_CORE\(.*\)', line):
|
if re.search(r'\bassert\(.*\)|\bASSERT\(.*\)|\bASSERTS\(.*\)|\bASSERT_CORE\(.*\)', line):
|
||||||
detaild_list.append(f"{file_path}:{line_number}: {line.strip()}")
|
detaild_list.append(f"{file_path}:{line.strip()}:{line_number}")
|
||||||
match_count += 1
|
match_count += 1
|
||||||
if match_count > 0:
|
if match_count > 0:
|
||||||
summary_list.append(f"Total matches in {file_path}: {match_count}")
|
summary_list.append(f"Total matches in {file_path}:{match_count}")
|
||||||
|
|
||||||
def traverse_and_grep(source_dirs, exclude_dirs, exclude_source_files):
|
def traverse_and_grep(source_dirs, exclude_dirs, exclude_source_files):
|
||||||
"""Traverse directories and grep for assert, ASSERTS, or ASSERT function calls in .h and .c files."""
|
"""Traverse directories and grep for assert, ASSERTS, or ASSERT function calls in .h and .c files."""
|
||||||
|
@ -47,7 +69,52 @@ def traverse_and_grep(source_dirs, exclude_dirs, exclude_source_files):
|
||||||
grep_asserts_in_file(file_path, summary_list, detaild_list)
|
grep_asserts_in_file(file_path, summary_list, detaild_list)
|
||||||
return summary_list, detaild_list
|
return summary_list, detaild_list
|
||||||
|
|
||||||
|
def check_list_result(result_list,detaild_list):
|
||||||
|
logger.debug("check assert in source code")
|
||||||
|
error_message = "ERROR: do not add `assert` statements in new code."
|
||||||
|
error_message2 = "ERROR: Please check the detailed information below: assert statement with file name and line number"
|
||||||
|
remove_detail_items = [
|
||||||
|
f"{TD_project_path}/community/source/dnode/vnode/src/tsdb/tsdbCommit2.c:ASSERT_CORE(tsdb->imem == NULL, \"imem should be null to commit mem\");",
|
||||||
|
f"{TD_project_path}/community/include/util/types.h:assert(sizeof(float) == sizeof(uint32_t));",
|
||||||
|
f"{TD_project_path}/community/include/util/types.h:assert(sizeof(double) == sizeof(uint64_t));"
|
||||||
|
]
|
||||||
|
expected_strings = [
|
||||||
|
f"Total matches in {TD_project_path}/community/source/dnode/vnode/src/tsdb/tsdbCommit2.c:1",
|
||||||
|
f"Total matches in {TD_project_path}/community/include/util/types.h:2"
|
||||||
|
]
|
||||||
|
# logger.debug(len(result_list))
|
||||||
|
if len(result_list) != 2:
|
||||||
|
logger.error(f"{error_message}")
|
||||||
|
for item in expected_strings:
|
||||||
|
if item in result_list:
|
||||||
|
result_list.remove(item)
|
||||||
|
logger.error("\n" + "\n".join(result_list))
|
||||||
|
logger.error(f"{error_message2}")
|
||||||
|
for item in remove_detail_items:
|
||||||
|
if item in detaild_list:
|
||||||
|
detaild_list.remove(item)
|
||||||
|
logger.error("\n" + "\n".join(detaild_list))
|
||||||
|
exit(1)
|
||||||
|
else:
|
||||||
|
# check if all expected strings are in the result list
|
||||||
|
if all(item in result_list for item in expected_strings):
|
||||||
|
# logger.debug(result_list)
|
||||||
|
# logger.debug(detaild_list)
|
||||||
|
if all(any(remove_detail_item in detaild for remove_detail_item in remove_detail_items) for detaild in detaild_list):
|
||||||
|
logger.info("Validation successful.")
|
||||||
|
else:
|
||||||
|
logger.error(f"{error_message}")
|
||||||
|
for item in expected_strings:
|
||||||
|
if item in result_list:
|
||||||
|
result_list.remove(item)
|
||||||
|
logger.error("\n" + "\n".join(result_list))
|
||||||
|
logger.error(f"{error_message2}")
|
||||||
|
for item in remove_detail_items:
|
||||||
|
if item in detaild_list:
|
||||||
|
detaild_list.remove(item)
|
||||||
|
logger.error("\n" + "\n".join(detaild_list))
|
||||||
|
exit(1)
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
summary_list, detaild_list = traverse_and_grep(source_dirs, exclude_dirs, exclude_source_files)
|
summary_list, detaild_list = traverse_and_grep(source_dirs, exclude_dirs, exclude_source_files)
|
||||||
print("\n".join(summary_list))
|
check_list_result(summary_list,detaild_list)
|
||||||
# print("\n".join(detaild_list))
|
|
||||||
|
|
|
@ -0,0 +1,54 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
function usage() {
|
||||||
|
echo "$0"
|
||||||
|
echo -e "\t -d work dir"
|
||||||
|
echo -e "\t -h help"
|
||||||
|
}
|
||||||
|
|
||||||
|
while getopts "d:h" opt; do
|
||||||
|
case $opt in
|
||||||
|
d)
|
||||||
|
WORKDIR=$OPTARG
|
||||||
|
;;
|
||||||
|
h)
|
||||||
|
usage
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
\?)
|
||||||
|
echo "Invalid option: -$OPTARG"
|
||||||
|
usage
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ -z "$WORKDIR" ]; then
|
||||||
|
usage
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# enterprise edition
|
||||||
|
INTERNAL_REPDIR=$WORKDIR/TDinternal
|
||||||
|
REPDIR_DEBUG=$WORKDIR/debugNoSan/
|
||||||
|
|
||||||
|
REP_MOUNT_PARAM="$INTERNAL_REPDIR:/home/TDinternal"
|
||||||
|
|
||||||
|
CONTAINER_TESTDIR=/home/TDinternal/community
|
||||||
|
|
||||||
|
check_assert_scripts="$CONTAINER_TESTDIR/tests/ci/count_assert.py"
|
||||||
|
|
||||||
|
ulimit -c unlimited
|
||||||
|
cat << EOF
|
||||||
|
docker run \
|
||||||
|
-v $REP_MOUNT_PARAM \
|
||||||
|
--rm --ulimit core=-1 taos_test:v1.0 python3 $check_assert_scripts
|
||||||
|
EOF
|
||||||
|
docker run \
|
||||||
|
-v $REP_MOUNT_PARAM \
|
||||||
|
--rm --ulimit core=-1 taos_test:v1.0 python3 $check_assert_scripts
|
||||||
|
|
||||||
|
ret=$?
|
||||||
|
exit $ret
|
||||||
|
|
Loading…
Reference in New Issue