other: merge 3.0
This commit is contained in:
commit
91dcf63933
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1763,6 +1763,14 @@ int32_t tSerializeSStatusReq(void* buf, int32_t bufLen, SStatusReq* pReq);
|
||||||
int32_t tDeserializeSStatusReq(void* buf, int32_t bufLen, SStatusReq* pReq);
|
int32_t tDeserializeSStatusReq(void* buf, int32_t bufLen, SStatusReq* pReq);
|
||||||
void tFreeSStatusReq(SStatusReq* pReq);
|
void tFreeSStatusReq(SStatusReq* pReq);
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int32_t dnodeId;
|
||||||
|
char machineId[TSDB_MACHINE_ID_LEN + 1];
|
||||||
|
} SDnodeInfoReq;
|
||||||
|
|
||||||
|
int32_t tSerializeSDnodeInfoReq(void* buf, int32_t bufLen, SDnodeInfoReq* pReq);
|
||||||
|
int32_t tDeserializeSDnodeInfoReq(void* buf, int32_t bufLen, SDnodeInfoReq* pReq);
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
MONITOR_TYPE_COUNTER = 0,
|
MONITOR_TYPE_COUNTER = 0,
|
||||||
MONITOR_TYPE_SLOW_LOG = 1,
|
MONITOR_TYPE_SLOW_LOG = 1,
|
||||||
|
@ -3647,7 +3655,7 @@ int32_t tEncodeSTqOffsetVal(SEncoder* pEncoder, const STqOffsetVal* pOffsetVal);
|
||||||
int32_t tDecodeSTqOffsetVal(SDecoder* pDecoder, STqOffsetVal* pOffsetVal);
|
int32_t tDecodeSTqOffsetVal(SDecoder* pDecoder, STqOffsetVal* pOffsetVal);
|
||||||
void tFormatOffset(char* buf, int32_t maxLen, const STqOffsetVal* pVal);
|
void tFormatOffset(char* buf, int32_t maxLen, const STqOffsetVal* pVal);
|
||||||
bool tOffsetEqual(const STqOffsetVal* pLeft, const STqOffsetVal* pRight);
|
bool tOffsetEqual(const STqOffsetVal* pLeft, const STqOffsetVal* pRight);
|
||||||
int32_t tOffsetCopy(STqOffsetVal* pLeft, const STqOffsetVal* pRight);
|
void tOffsetCopy(STqOffsetVal* pLeft, const STqOffsetVal* pRight);
|
||||||
void tOffsetDestroy(void* pVal);
|
void tOffsetDestroy(void* pVal);
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
|
@ -253,7 +253,7 @@
|
||||||
TD_DEF_MSG_TYPE(TDMT_MND_STREAM_CONSEN_TIMER, "stream-consen-tmr", NULL, NULL)
|
TD_DEF_MSG_TYPE(TDMT_MND_STREAM_CONSEN_TIMER, "stream-consen-tmr", NULL, NULL)
|
||||||
TD_DEF_MSG_TYPE(TDMT_MND_STREAM_DROP_ORPHANTASKS, "stream-drop-orphan-tasks", NULL, NULL)
|
TD_DEF_MSG_TYPE(TDMT_MND_STREAM_DROP_ORPHANTASKS, "stream-drop-orphan-tasks", NULL, NULL)
|
||||||
TD_DEF_MSG_TYPE(TDMT_MND_STREAM_TASK_RESET, "stream-reset-tasks", NULL, NULL)
|
TD_DEF_MSG_TYPE(TDMT_MND_STREAM_TASK_RESET, "stream-reset-tasks", NULL, NULL)
|
||||||
TD_DEF_MSG_TYPE(TDMT_MND_MAX_MSG, "mnd-max", NULL, NULL)
|
TD_DEF_MSG_TYPE(TDMT_MND_UPDATE_DNODE_INFO, "update-dnode-info", NULL, NULL)
|
||||||
TD_CLOSE_MSG_SEG(TDMT_END_MND_MSG)
|
TD_CLOSE_MSG_SEG(TDMT_END_MND_MSG)
|
||||||
|
|
||||||
TD_NEW_MSG_SEG(TDMT_VND_MSG) // 2<<8
|
TD_NEW_MSG_SEG(TDMT_VND_MSG) // 2<<8
|
||||||
|
|
|
@ -489,6 +489,7 @@ static int32_t monitorReadSend(int64_t clusterId, TdFilePtr pFile, int64_t* offs
|
||||||
SAppInstInfo* pInst = getAppInstByClusterId(clusterId);
|
SAppInstInfo* pInst = getAppInstByClusterId(clusterId);
|
||||||
if (pInst == NULL) {
|
if (pInst == NULL) {
|
||||||
tscError("failed to get app instance by clusterId:%" PRId64, clusterId);
|
tscError("failed to get app instance by clusterId:%" PRId64, clusterId);
|
||||||
|
taosMemoryFree(fileName);
|
||||||
return terrno;
|
return terrno;
|
||||||
}
|
}
|
||||||
SEpSet ep = getEpSet_s(&pInst->mgmtEp);
|
SEpSet ep = getEpSet_s(&pInst->mgmtEp);
|
||||||
|
|
|
@ -87,7 +87,7 @@ int32_t getJsonValueLen(const char* data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t colDataSetVal(SColumnInfoData* pColumnInfoData, uint32_t rowIndex, const char* pData, bool isNull) {
|
int32_t colDataSetVal(SColumnInfoData* pColumnInfoData, uint32_t rowIndex, const char* pData, bool isNull) {
|
||||||
if (isNull) {
|
if (isNull || pData == NULL) {
|
||||||
// There is a placehold for each NULL value of binary or nchar type.
|
// There is a placehold for each NULL value of binary or nchar type.
|
||||||
if (IS_VAR_DATA_TYPE(pColumnInfoData->info.type)) {
|
if (IS_VAR_DATA_TYPE(pColumnInfoData->info.type)) {
|
||||||
pColumnInfoData->varmeta.offset[rowIndex] = -1; // it is a null value of VAR type.
|
pColumnInfoData->varmeta.offset[rowIndex] = -1; // it is a null value of VAR type.
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1457,6 +1457,39 @@ int32_t tDeserializeSStatusReq(void *buf, int32_t bufLen, SStatusReq *pReq) {
|
||||||
|
|
||||||
void tFreeSStatusReq(SStatusReq *pReq) { taosArrayDestroy(pReq->pVloads); }
|
void tFreeSStatusReq(SStatusReq *pReq) { taosArrayDestroy(pReq->pVloads); }
|
||||||
|
|
||||||
|
int32_t tSerializeSDnodeInfoReq(void *buf, int32_t bufLen, SDnodeInfoReq *pReq) {
|
||||||
|
int32_t code = 0, lino = 0;
|
||||||
|
int32_t tlen = 0;
|
||||||
|
SEncoder encoder = {0};
|
||||||
|
tEncoderInit(&encoder, buf, bufLen);
|
||||||
|
|
||||||
|
TAOS_CHECK_EXIT(tStartEncode(&encoder));
|
||||||
|
TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->dnodeId));
|
||||||
|
TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->machineId));
|
||||||
|
|
||||||
|
tEndEncode(&encoder);
|
||||||
|
|
||||||
|
tlen = encoder.pos;
|
||||||
|
_exit:
|
||||||
|
tEncoderClear(&encoder);
|
||||||
|
return code < 0 ? code : tlen;
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t tDeserializeSDnodeInfoReq(void *buf, int32_t bufLen, SDnodeInfoReq *pReq) {
|
||||||
|
int32_t code = 0, lino = 0;
|
||||||
|
SDecoder decoder = {0};
|
||||||
|
tDecoderInit(&decoder, buf, bufLen);
|
||||||
|
|
||||||
|
TAOS_CHECK_EXIT(tStartDecode(&decoder));
|
||||||
|
TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->dnodeId));
|
||||||
|
TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->machineId));
|
||||||
|
|
||||||
|
_exit:
|
||||||
|
tEndDecode(&decoder);
|
||||||
|
tDecoderClear(&decoder);
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
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};
|
||||||
tEncoderInit(&encoder, buf, bufLen);
|
tEncoderInit(&encoder, buf, bufLen);
|
||||||
|
@ -9265,18 +9298,17 @@ bool tOffsetEqual(const STqOffsetVal *pLeft, const STqOffsetVal *pRight) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tOffsetCopy(STqOffsetVal *pLeft, const STqOffsetVal *pRight) {
|
void tOffsetCopy(STqOffsetVal *pLeft, const STqOffsetVal *pRight) {
|
||||||
tOffsetDestroy(pLeft);
|
tOffsetDestroy(pLeft);
|
||||||
*pLeft = *pRight;
|
*pLeft = *pRight;
|
||||||
if (IS_VAR_DATA_TYPE(pRight->primaryKey.type)) {
|
if (IS_VAR_DATA_TYPE(pRight->primaryKey.type)) {
|
||||||
pLeft->primaryKey.pData = taosMemoryMalloc(pRight->primaryKey.nData);
|
pLeft->primaryKey.pData = taosMemoryMalloc(pRight->primaryKey.nData);
|
||||||
if (pLeft->primaryKey.pData == NULL) {
|
if (pLeft->primaryKey.pData == NULL) {
|
||||||
uError("failed to allocate memory for offset");
|
uError("failed to allocate memory for offset");
|
||||||
return terrno;
|
return;
|
||||||
}
|
}
|
||||||
(void)memcpy(pLeft->primaryKey.pData, pRight->primaryKey.pData, pRight->primaryKey.nData);
|
(void)memcpy(pLeft->primaryKey.pData, pRight->primaryKey.pData, pRight->primaryKey.nData);
|
||||||
}
|
}
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void tOffsetDestroy(void *param) {
|
void tOffsetDestroy(void *param) {
|
||||||
|
|
|
@ -41,7 +41,7 @@ static void dmMayShouldUpdateIpWhiteList(SDnodeMgmt *pMgmt, int64_t ver) {
|
||||||
if (pMgmt->pData->ipWhiteVer == ver) {
|
if (pMgmt->pData->ipWhiteVer == ver) {
|
||||||
if (ver == 0) {
|
if (ver == 0) {
|
||||||
dDebug("disable ip-white-list on dnode ver: %" PRId64 ", status ver: %" PRId64 "", pMgmt->pData->ipWhiteVer, ver);
|
dDebug("disable ip-white-list on dnode ver: %" PRId64 ", status ver: %" PRId64 "", pMgmt->pData->ipWhiteVer, ver);
|
||||||
rpcSetIpWhite(pMgmt->msgCb.serverRpc, NULL);
|
(void)rpcSetIpWhite(pMgmt->msgCb.serverRpc, NULL);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -86,7 +86,7 @@ static void dmProcessStatusRsp(SDnodeMgmt *pMgmt, SRpcMsg *pRsp) {
|
||||||
dGInfo("dnode:%d, set to dropped since not exist in mnode, statusSeq:%d", pMgmt->pData->dnodeId,
|
dGInfo("dnode:%d, set to dropped since not exist in mnode, statusSeq:%d", pMgmt->pData->dnodeId,
|
||||||
pMgmt->statusSeq);
|
pMgmt->statusSeq);
|
||||||
pMgmt->pData->dropped = 1;
|
pMgmt->pData->dropped = 1;
|
||||||
dmWriteEps(pMgmt->pData);
|
(void)dmWriteEps(pMgmt->pData);
|
||||||
dInfo("dnode will exit since it is in the dropped state");
|
dInfo("dnode will exit since it is in the dropped state");
|
||||||
(void)raise(SIGINT);
|
(void)raise(SIGINT);
|
||||||
}
|
}
|
||||||
|
@ -167,8 +167,9 @@ void dmSendStatusReq(SDnodeMgmt *pMgmt) {
|
||||||
dError("failed to serialize status req since %s", tstrerror(contLen));
|
dError("failed to serialize status req since %s", tstrerror(contLen));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *pHead = rpcMallocCont(contLen);
|
void *pHead = rpcMallocCont(contLen);
|
||||||
tSerializeSStatusReq(pHead, contLen, &req);
|
contLen = tSerializeSStatusReq(pHead, contLen, &req);
|
||||||
if (contLen < 0) {
|
if (contLen < 0) {
|
||||||
rpcFreeCont(pHead);
|
rpcFreeCont(pHead);
|
||||||
dError("failed to serialize status req since %s", tstrerror(contLen));
|
dError("failed to serialize status req since %s", tstrerror(contLen));
|
||||||
|
@ -213,8 +214,17 @@ void dmSendStatusReq(SDnodeMgmt *pMgmt) {
|
||||||
|
|
||||||
void dmSendNotifyReq(SDnodeMgmt *pMgmt, SNotifyReq *pReq) {
|
void dmSendNotifyReq(SDnodeMgmt *pMgmt, SNotifyReq *pReq) {
|
||||||
int32_t contLen = tSerializeSNotifyReq(NULL, 0, pReq);
|
int32_t contLen = tSerializeSNotifyReq(NULL, 0, pReq);
|
||||||
void *pHead = rpcMallocCont(contLen);
|
if (contLen < 0) {
|
||||||
tSerializeSNotifyReq(pHead, contLen, pReq);
|
dError("failed to serialize notify req since %s", tstrerror(contLen));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
void *pHead = rpcMallocCont(contLen);
|
||||||
|
contLen = tSerializeSNotifyReq(pHead, contLen, pReq);
|
||||||
|
if (contLen < 0) {
|
||||||
|
rpcFreeCont(pHead);
|
||||||
|
dError("failed to serialize notify req since %s", tstrerror(contLen));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
SRpcMsg rpcMsg = {.pCont = pHead,
|
SRpcMsg rpcMsg = {.pCont = pHead,
|
||||||
.contLen = contLen,
|
.contLen = contLen,
|
||||||
|
@ -226,7 +236,7 @@ void dmSendNotifyReq(SDnodeMgmt *pMgmt, SNotifyReq *pReq) {
|
||||||
|
|
||||||
SEpSet epSet = {0};
|
SEpSet epSet = {0};
|
||||||
dmGetMnodeEpSet(pMgmt->pData, &epSet);
|
dmGetMnodeEpSet(pMgmt->pData, &epSet);
|
||||||
rpcSendRequest(pMgmt->msgCb.clientRpc, &epSet, &rpcMsg, NULL);
|
(void)rpcSendRequest(pMgmt->msgCb.clientRpc, &epSet, &rpcMsg, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t dmProcessAuthRsp(SDnodeMgmt *pMgmt, SRpcMsg *pMsg) {
|
int32_t dmProcessAuthRsp(SDnodeMgmt *pMgmt, SRpcMsg *pMsg) {
|
||||||
|
|
|
@ -173,6 +173,7 @@ SArray *mmGetMsgHandles() {
|
||||||
if (dmSetMgmtHandle(pArray, TDMT_MND_DROP_TSMA, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
if (dmSetMgmtHandle(pArray, TDMT_MND_DROP_TSMA, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
||||||
if (dmSetMgmtHandle(pArray, TDMT_MND_STB_DROP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
if (dmSetMgmtHandle(pArray, TDMT_MND_STB_DROP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
||||||
if (dmSetMgmtHandle(pArray, TDMT_MND_STB_DROP_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
if (dmSetMgmtHandle(pArray, TDMT_MND_STB_DROP_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
||||||
|
if (dmSetMgmtHandle(pArray, TDMT_MND_UPDATE_DNODE_INFO, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
||||||
if (dmSetMgmtHandle(pArray, TDMT_MND_DROP_TB_WITH_TSMA, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
if (dmSetMgmtHandle(pArray, TDMT_MND_DROP_TB_WITH_TSMA, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
||||||
if (dmSetMgmtHandle(pArray, TDMT_VND_FETCH_TTL_EXPIRED_TBS_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
if (dmSetMgmtHandle(pArray, TDMT_VND_FETCH_TTL_EXPIRED_TBS_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
||||||
if (dmSetMgmtHandle(pArray, TDMT_VND_DROP_TABLE_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
if (dmSetMgmtHandle(pArray, TDMT_VND_DROP_TABLE_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
||||||
|
|
|
@ -340,7 +340,7 @@ int32_t vmProcessCreateVnodeReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) {
|
||||||
if (vnodeCreate(path, &vnodeCfg, diskPrimary, pMgmt->pTfs) < 0) {
|
if (vnodeCreate(path, &vnodeCfg, diskPrimary, pMgmt->pTfs) < 0) {
|
||||||
dError("vgId:%d, failed to create vnode since %s", req.vgId, terrstr());
|
dError("vgId:%d, failed to create vnode since %s", req.vgId, terrstr());
|
||||||
vmReleaseVnode(pMgmt, pVnode);
|
vmReleaseVnode(pMgmt, pVnode);
|
||||||
tFreeSCreateVnodeReq(&req);
|
(void)tFreeSCreateVnodeReq(&req);
|
||||||
code = terrno != 0 ? terrno : -1;
|
code = terrno != 0 ? terrno : -1;
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
|
@ -361,7 +361,7 @@ void dmProcessServerStartupStatus(SDnode *pDnode, SRpcMsg *pMsg) {
|
||||||
} else {
|
} else {
|
||||||
rsp.pCont = rpcMallocCont(contLen);
|
rsp.pCont = rpcMallocCont(contLen);
|
||||||
if (rsp.pCont != NULL) {
|
if (rsp.pCont != NULL) {
|
||||||
tSerializeSServerStatusRsp(rsp.pCont, contLen, &statusRsp);
|
(void)tSerializeSServerStatusRsp(rsp.pCont, contLen, &statusRsp);
|
||||||
rsp.contLen = contLen;
|
rsp.contLen = contLen;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -246,7 +246,7 @@ _OVER:
|
||||||
if (pWrapper != NULL) {
|
if (pWrapper != NULL) {
|
||||||
dmSendRsp(&rsp);
|
dmSendRsp(&rsp);
|
||||||
} else {
|
} else {
|
||||||
rpcSendResponse(&rsp);
|
(void)rpcSendResponse(&rsp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -211,7 +211,7 @@ int32_t dmCheckRunning(const char *dataDir, TdFilePtr *pFile) {
|
||||||
|
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
code = TAOS_SYSTEM_ERROR(errno);
|
code = TAOS_SYSTEM_ERROR(errno);
|
||||||
taosCloseFile(pFile);
|
(void)taosCloseFile(pFile);
|
||||||
*pFile = NULL;
|
*pFile = NULL;
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
@ -239,7 +239,7 @@ static int32_t dmWriteCheckCodeFile(char *file, char *realfile, char *key, bool
|
||||||
opts.source = DM_KEY_INDICATOR;
|
opts.source = DM_KEY_INDICATOR;
|
||||||
opts.result = result;
|
opts.result = result;
|
||||||
opts.unitLen = 16;
|
opts.unitLen = 16;
|
||||||
CBC_Encrypt(&opts);
|
(void)CBC_Encrypt(&opts);
|
||||||
|
|
||||||
pFile = taosOpenFile(file, TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_TRUNC | TD_FILE_WRITE_THROUGH);
|
pFile = taosOpenFile(file, TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_TRUNC | TD_FILE_WRITE_THROUGH);
|
||||||
if (pFile == NULL) {
|
if (pFile == NULL) {
|
||||||
|
@ -359,7 +359,7 @@ static int32_t dmCompareEncryptKey(char *file, char *key, bool toLogFile) {
|
||||||
opts.source = content;
|
opts.source = content;
|
||||||
opts.result = result;
|
opts.result = result;
|
||||||
opts.unitLen = 16;
|
opts.unitLen = 16;
|
||||||
CBC_Decrypt(&opts);
|
(void)CBC_Decrypt(&opts);
|
||||||
|
|
||||||
if (strcmp(opts.result, DM_KEY_INDICATOR) != 0) {
|
if (strcmp(opts.result, DM_KEY_INDICATOR) != 0) {
|
||||||
code = TSDB_CODE_DNODE_ENCRYPTKEY_CHANGED;
|
code = TSDB_CODE_DNODE_ENCRYPTKEY_CHANGED;
|
||||||
|
|
|
@ -57,8 +57,8 @@ void *dmSetMgmtHandle(SArray *pArray, tmsg_t msgType, void *nodeMsgFp, bool need
|
||||||
void dmGetMonitorSystemInfo(SMonSysInfo *pInfo) {
|
void dmGetMonitorSystemInfo(SMonSysInfo *pInfo) {
|
||||||
taosGetCpuUsage(&pInfo->cpu_system, &pInfo->cpu_engine);
|
taosGetCpuUsage(&pInfo->cpu_system, &pInfo->cpu_engine);
|
||||||
taosGetCpuCores(&pInfo->cpu_cores, false);
|
taosGetCpuCores(&pInfo->cpu_cores, false);
|
||||||
taosGetProcMemory(&pInfo->mem_engine);
|
(void)taosGetProcMemory(&pInfo->mem_engine);
|
||||||
taosGetSysMemory(&pInfo->mem_system);
|
(void)taosGetSysMemory(&pInfo->mem_system);
|
||||||
pInfo->mem_total = tsTotalMemoryKB;
|
pInfo->mem_total = tsTotalMemoryKB;
|
||||||
pInfo->disk_engine = 0;
|
pInfo->disk_engine = 0;
|
||||||
pInfo->disk_used = tsDataSpace.size.used;
|
pInfo->disk_used = tsDataSpace.size.used;
|
||||||
|
|
|
@ -1892,13 +1892,21 @@ int32_t mndValidateDbInfo(SMnode *pMnode, SDbCacheInfo *pDbs, int32_t numOfDbs,
|
||||||
rsp.pTsmaRsp = taosMemoryCalloc(1, sizeof(STableTSMAInfoRsp));
|
rsp.pTsmaRsp = taosMemoryCalloc(1, sizeof(STableTSMAInfoRsp));
|
||||||
if (rsp.pTsmaRsp) rsp.pTsmaRsp->pTsmas = taosArrayInit(4, POINTER_BYTES);
|
if (rsp.pTsmaRsp) rsp.pTsmaRsp->pTsmas = taosArrayInit(4, POINTER_BYTES);
|
||||||
if (rsp.pTsmaRsp && rsp.pTsmaRsp->pTsmas) {
|
if (rsp.pTsmaRsp && rsp.pTsmaRsp->pTsmas) {
|
||||||
rsp.dbTsmaVersion = pDb->tsmaVersion;
|
|
||||||
bool exist = false;
|
bool exist = false;
|
||||||
if (mndGetDbTsmas(pMnode, 0, pDb->uid, rsp.pTsmaRsp, &exist) != 0) {
|
int32_t code = mndGetDbTsmas(pMnode, 0, pDb->uid, rsp.pTsmaRsp, &exist);
|
||||||
|
if (TSDB_CODE_SUCCESS != code) {
|
||||||
mndReleaseDb(pMnode, pDb);
|
mndReleaseDb(pMnode, pDb);
|
||||||
mError("db:%s, failed to get db tsmas", pDb->name);
|
if (code != TSDB_CODE_NEED_RETRY) {
|
||||||
|
mError("db:%s, failed to get db tsmas", pDb->name);
|
||||||
|
} else {
|
||||||
|
mWarn("db:%s, need retry to get db tsmas", pDb->name);
|
||||||
|
}
|
||||||
|
taosArrayDestroyP(rsp.pTsmaRsp->pTsmas, tFreeAndClearTableTSMAInfo);
|
||||||
|
taosMemoryFreeClear(rsp.pTsmaRsp);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
rsp.dbTsmaVersion = pDb->tsmaVersion;
|
||||||
|
mDebug("update tsma version to %d, got tsma num: %ld", pDb->tsmaVersion, rsp.pTsmaRsp->pTsmas->size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1909,6 +1917,8 @@ int32_t mndValidateDbInfo(SMnode *pMnode, SDbCacheInfo *pDbs, int32_t numOfDbs,
|
||||||
if (rsp.useDbRsp->pVgroupInfos == NULL) {
|
if (rsp.useDbRsp->pVgroupInfos == NULL) {
|
||||||
mndReleaseDb(pMnode, pDb);
|
mndReleaseDb(pMnode, pDb);
|
||||||
mError("db:%s, failed to malloc usedb response", pDb->name);
|
mError("db:%s, failed to malloc usedb response", pDb->name);
|
||||||
|
taosArrayDestroyP(rsp.pTsmaRsp->pTsmas, tFreeAndClearTableTSMAInfo);
|
||||||
|
taosMemoryFreeClear(rsp.pTsmaRsp);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -86,6 +86,7 @@ static int32_t mndProcessStatusReq(SRpcMsg *pReq);
|
||||||
static int32_t mndProcessNotifyReq(SRpcMsg *pReq);
|
static int32_t mndProcessNotifyReq(SRpcMsg *pReq);
|
||||||
static int32_t mndProcessRestoreDnodeReq(SRpcMsg *pReq);
|
static int32_t mndProcessRestoreDnodeReq(SRpcMsg *pReq);
|
||||||
static int32_t mndProcessStatisReq(SRpcMsg *pReq);
|
static int32_t mndProcessStatisReq(SRpcMsg *pReq);
|
||||||
|
static int32_t mndProcessUpdateDnodeInfoReq(SRpcMsg *pReq);
|
||||||
static int32_t mndProcessCreateEncryptKeyReq(SRpcMsg *pRsp);
|
static int32_t mndProcessCreateEncryptKeyReq(SRpcMsg *pRsp);
|
||||||
static int32_t mndProcessCreateEncryptKeyRsp(SRpcMsg *pRsp);
|
static int32_t mndProcessCreateEncryptKeyRsp(SRpcMsg *pRsp);
|
||||||
|
|
||||||
|
@ -126,6 +127,7 @@ int32_t mndInitDnode(SMnode *pMnode) {
|
||||||
mndSetMsgHandle(pMnode, TDMT_MND_STATIS, mndProcessStatisReq);
|
mndSetMsgHandle(pMnode, TDMT_MND_STATIS, mndProcessStatisReq);
|
||||||
mndSetMsgHandle(pMnode, TDMT_MND_CREATE_ENCRYPT_KEY, mndProcessCreateEncryptKeyReq);
|
mndSetMsgHandle(pMnode, TDMT_MND_CREATE_ENCRYPT_KEY, mndProcessCreateEncryptKeyReq);
|
||||||
mndSetMsgHandle(pMnode, TDMT_DND_CREATE_ENCRYPT_KEY_RSP, mndProcessCreateEncryptKeyRsp);
|
mndSetMsgHandle(pMnode, TDMT_DND_CREATE_ENCRYPT_KEY_RSP, mndProcessCreateEncryptKeyRsp);
|
||||||
|
mndSetMsgHandle(pMnode, TDMT_MND_UPDATE_DNODE_INFO, mndProcessUpdateDnodeInfoReq);
|
||||||
|
|
||||||
mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_CONFIGS, mndRetrieveConfigs);
|
mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_CONFIGS, mndRetrieveConfigs);
|
||||||
mndAddShowFreeIterHandle(pMnode, TSDB_MGMT_TABLE_CONFIGS, mndCancelGetNextConfig);
|
mndAddShowFreeIterHandle(pMnode, TSDB_MGMT_TABLE_CONFIGS, mndCancelGetNextConfig);
|
||||||
|
@ -601,37 +603,78 @@ static int32_t mndProcessStatisReq(SRpcMsg *pReq) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t mndUpdateDnodeObj(SMnode *pMnode, SDnodeObj *pDnode) {
|
static int32_t mndUpdateDnodeObj(SMnode *pMnode, SDnodeObj *pDnode) {
|
||||||
int32_t code = 0;
|
int32_t code = 0, lino = 0;
|
||||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, NULL, "update-dnode-obj");
|
SDnodeInfoReq infoReq = {0};
|
||||||
|
int32_t contLen = 0;
|
||||||
|
void *pReq = NULL;
|
||||||
|
|
||||||
|
infoReq.dnodeId = pDnode->id;
|
||||||
|
tstrncpy(infoReq.machineId, pDnode->machineId, TSDB_MACHINE_ID_LEN + 1);
|
||||||
|
|
||||||
|
if ((contLen = tSerializeSDnodeInfoReq(NULL, 0, &infoReq)) <= 0) {
|
||||||
|
TAOS_RETURN(contLen ? contLen : TSDB_CODE_OUT_OF_MEMORY);
|
||||||
|
}
|
||||||
|
pReq = rpcMallocCont(contLen);
|
||||||
|
if (pReq == NULL) {
|
||||||
|
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||||
|
}
|
||||||
|
|
||||||
|
(void)tSerializeSDnodeInfoReq(pReq, contLen, &infoReq);
|
||||||
|
|
||||||
|
SRpcMsg rpcMsg = {.msgType = TDMT_MND_UPDATE_DNODE_INFO, .pCont = pReq, .contLen = contLen};
|
||||||
|
TAOS_CHECK_EXIT(tmsgPutToQueue(&pMnode->msgCb, WRITE_QUEUE, &rpcMsg));
|
||||||
|
_exit:
|
||||||
|
if (code < 0) {
|
||||||
|
mError("dnode:%d, failed to update dnode info since %s", pDnode->id, tstrerror(code));
|
||||||
|
}
|
||||||
|
TAOS_RETURN(code);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int32_t mndProcessUpdateDnodeInfoReq(SRpcMsg *pReq) {
|
||||||
|
int32_t code = 0, lino = 0;
|
||||||
|
SMnode *pMnode = pReq->info.node;
|
||||||
|
SDnodeInfoReq infoReq = {0};
|
||||||
|
SDnodeObj *pDnode = NULL;
|
||||||
|
STrans *pTrans = NULL;
|
||||||
|
SSdbRaw *pCommitRaw = NULL;
|
||||||
|
|
||||||
|
TAOS_CHECK_EXIT(tDeserializeSDnodeInfoReq(pReq->pCont, pReq->contLen, &infoReq));
|
||||||
|
|
||||||
|
pDnode = mndAcquireDnode(pMnode, infoReq.dnodeId);
|
||||||
|
if (pDnode == NULL) {
|
||||||
|
TAOS_CHECK_EXIT(terrno);
|
||||||
|
}
|
||||||
|
|
||||||
|
pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, NULL, "update-dnode-obj");
|
||||||
if (pTrans == NULL) {
|
if (pTrans == NULL) {
|
||||||
code = TSDB_CODE_MND_RETURN_VALUE_NULL;
|
TAOS_CHECK_EXIT(terrno);
|
||||||
if (terrno != 0) code = terrno;
|
|
||||||
goto _exit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pDnode->updateTime = taosGetTimestampMs();
|
pDnode->updateTime = taosGetTimestampMs();
|
||||||
|
|
||||||
SSdbRaw *pCommitRaw = mndDnodeActionEncode(pDnode);
|
if ((pCommitRaw = mndDnodeActionEncode(pDnode)) == NULL) {
|
||||||
if (pCommitRaw == NULL) {
|
TAOS_CHECK_EXIT(terrno);
|
||||||
code = TSDB_CODE_MND_RETURN_VALUE_NULL;
|
|
||||||
if (terrno != 0) code = terrno;
|
|
||||||
goto _exit;
|
|
||||||
}
|
}
|
||||||
if ((code = mndTransAppendCommitlog(pTrans, pCommitRaw)) != 0) {
|
if ((code = mndTransAppendCommitlog(pTrans, pCommitRaw)) != 0) {
|
||||||
mError("trans:%d, failed to append commit log since %s", pTrans->id, tstrerror(code));
|
mError("trans:%d, failed to append commit log since %s", pTrans->id, tstrerror(code));
|
||||||
code = terrno;
|
TAOS_CHECK_EXIT(code);
|
||||||
goto _exit;
|
|
||||||
}
|
}
|
||||||
(void)sdbSetRawStatus(pCommitRaw, SDB_STATUS_READY);
|
(void)sdbSetRawStatus(pCommitRaw, SDB_STATUS_READY);
|
||||||
|
pCommitRaw = NULL;
|
||||||
|
|
||||||
if ((code = mndTransPrepare(pMnode, pTrans)) != 0) {
|
if ((code = mndTransPrepare(pMnode, pTrans)) != 0) {
|
||||||
mError("trans:%d, failed to prepare since %s", pTrans->id, tstrerror(code));
|
mError("trans:%d, failed to prepare since %s", pTrans->id, tstrerror(code));
|
||||||
goto _exit;
|
TAOS_CHECK_EXIT(code);
|
||||||
}
|
}
|
||||||
|
|
||||||
_exit:
|
_exit:
|
||||||
|
mndReleaseDnode(pMnode, pDnode);
|
||||||
|
if (code != 0) {
|
||||||
|
mError("dnode:%d, failed to update dnode info at line %d since %s", infoReq.dnodeId, lino, tstrerror(code));
|
||||||
|
}
|
||||||
mndTransDrop(pTrans);
|
mndTransDrop(pTrans);
|
||||||
return code;
|
sdbFreeRaw(pCommitRaw);
|
||||||
|
TAOS_RETURN(code);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t mndProcessStatusReq(SRpcMsg *pReq) {
|
static int32_t mndProcessStatusReq(SRpcMsg *pReq) {
|
||||||
|
|
|
@ -89,7 +89,7 @@ void grantRestore(EGrantType grant, uint64_t value) {}
|
||||||
int64_t grantRemain(EGrantType grant) { return 0; }
|
int64_t grantRemain(EGrantType grant) { return 0; }
|
||||||
int32_t tGetMachineId(char **result) {
|
int32_t tGetMachineId(char **result) {
|
||||||
*result = NULL;
|
*result = NULL;
|
||||||
return TSDB_CODE_APP_ERROR;
|
return 0;
|
||||||
}
|
}
|
||||||
int32_t dmProcessGrantReq(void *pInfo, SRpcMsg *pMsg) { return TSDB_CODE_SUCCESS; }
|
int32_t dmProcessGrantReq(void *pInfo, SRpcMsg *pMsg) { return TSDB_CODE_SUCCESS; }
|
||||||
int32_t dmProcessGrantNotify(void *pInfo, SRpcMsg *pMsg) { return TSDB_CODE_SUCCESS; }
|
int32_t dmProcessGrantNotify(void *pInfo, SRpcMsg *pMsg) { return TSDB_CODE_SUCCESS; }
|
||||||
|
|
|
@ -716,9 +716,9 @@ SMnode *mndOpen(const char *path, const SMnodeOpt *pOption) {
|
||||||
void mndPreClose(SMnode *pMnode) {
|
void mndPreClose(SMnode *pMnode) {
|
||||||
if (pMnode != NULL) {
|
if (pMnode != NULL) {
|
||||||
// TODO check return value
|
// TODO check return value
|
||||||
syncLeaderTransfer(pMnode->syncMgmt.sync);
|
(void)syncLeaderTransfer(pMnode->syncMgmt.sync);
|
||||||
syncPreStop(pMnode->syncMgmt.sync);
|
syncPreStop(pMnode->syncMgmt.sync);
|
||||||
sdbWriteFile(pMnode->pSdb, 0);
|
(void)sdbWriteFile(pMnode->pSdb, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1106,12 +1106,12 @@ int64_t mndGetRoleTimeMs(SMnode *pMnode) {
|
||||||
|
|
||||||
void mndSetRestored(SMnode *pMnode, bool restored) {
|
void mndSetRestored(SMnode *pMnode, bool restored) {
|
||||||
if (restored) {
|
if (restored) {
|
||||||
taosThreadRwlockWrlock(&pMnode->lock);
|
(void)taosThreadRwlockWrlock(&pMnode->lock);
|
||||||
pMnode->restored = true;
|
pMnode->restored = true;
|
||||||
(void)taosThreadRwlockUnlock(&pMnode->lock);
|
(void)taosThreadRwlockUnlock(&pMnode->lock);
|
||||||
mInfo("mnode set restored:%d", restored);
|
mInfo("mnode set restored:%d", restored);
|
||||||
} else {
|
} else {
|
||||||
taosThreadRwlockWrlock(&pMnode->lock);
|
(void)taosThreadRwlockWrlock(&pMnode->lock);
|
||||||
pMnode->restored = false;
|
pMnode->restored = false;
|
||||||
(void)taosThreadRwlockUnlock(&pMnode->lock);
|
(void)taosThreadRwlockUnlock(&pMnode->lock);
|
||||||
mInfo("mnode set restored:%d", restored);
|
mInfo("mnode set restored:%d", restored);
|
||||||
|
@ -1125,7 +1125,7 @@ void mndSetRestored(SMnode *pMnode, bool restored) {
|
||||||
bool mndGetRestored(SMnode *pMnode) { return pMnode->restored; }
|
bool mndGetRestored(SMnode *pMnode) { return pMnode->restored; }
|
||||||
|
|
||||||
void mndSetStop(SMnode *pMnode) {
|
void mndSetStop(SMnode *pMnode) {
|
||||||
taosThreadRwlockWrlock(&pMnode->lock);
|
(void)taosThreadRwlockWrlock(&pMnode->lock);
|
||||||
pMnode->stopped = true;
|
pMnode->stopped = true;
|
||||||
(void)taosThreadRwlockUnlock(&pMnode->lock);
|
(void)taosThreadRwlockUnlock(&pMnode->lock);
|
||||||
mInfo("mnode set stopped");
|
mInfo("mnode set stopped");
|
||||||
|
|
|
@ -575,7 +575,10 @@ static int32_t mndProcessQueryHeartBeat(SMnode *pMnode, SRpcMsg *pMsg, SClientHb
|
||||||
|
|
||||||
if (needCheck) {
|
if (needCheck) {
|
||||||
SKv kv1 = {.key = HEARTBEAT_KEY_DYN_VIEW, .valueLen = sizeof(*pDynViewVer), .value = pRspVer};
|
SKv kv1 = {.key = HEARTBEAT_KEY_DYN_VIEW, .valueLen = sizeof(*pDynViewVer), .value = pRspVer};
|
||||||
taosArrayPush(hbRsp.info, &kv1);
|
if (taosArrayPush(hbRsp.info, &kv1) == NULL) {
|
||||||
|
if (terrno != 0) code = terrno;
|
||||||
|
TAOS_RETURN(code);
|
||||||
|
};
|
||||||
mTrace("need to check view ver, lastest bootTs:%" PRId64 ", ver:%" PRIu64, pRspVer->svrBootTs,
|
mTrace("need to check view ver, lastest bootTs:%" PRId64 ", ver:%" PRIu64, pRspVer->svrBootTs,
|
||||||
pRspVer->dynViewVer);
|
pRspVer->dynViewVer);
|
||||||
}
|
}
|
||||||
|
@ -703,7 +706,7 @@ static int32_t mndProcessHeartBeatReq(SRpcMsg *pReq) {
|
||||||
} else if (pHbReq->connKey.connType == CONN_TYPE__TMQ) {
|
} else if (pHbReq->connKey.connType == CONN_TYPE__TMQ) {
|
||||||
SClientHbRsp *pRsp = mndMqHbBuildRsp(pMnode, pHbReq);
|
SClientHbRsp *pRsp = mndMqHbBuildRsp(pMnode, pHbReq);
|
||||||
if (pRsp != NULL) {
|
if (pRsp != NULL) {
|
||||||
taosArrayPush(batchRsp.rsps, pRsp);
|
(void)taosArrayPush(batchRsp.rsps, pRsp);
|
||||||
taosMemoryFree(pRsp);
|
taosMemoryFree(pRsp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1760,14 +1760,14 @@ static int32_t mndCreateTSMATxnPrepare(SCreateTSMACxt* pCxt) {
|
||||||
SDbObj newDb = {0};
|
SDbObj newDb = {0};
|
||||||
memcpy(&newDb, pCxt->pDb, sizeof(SDbObj));
|
memcpy(&newDb, pCxt->pDb, sizeof(SDbObj));
|
||||||
newDb.tsmaVersion++;
|
newDb.tsmaVersion++;
|
||||||
TAOS_CHECK_GOTO(mndSetUpdateDbTsmaVersionPrepareLogs(pCxt->pMnode, pTrans, pCxt->pDb, &newDb), NULL, _OVER);
|
|
||||||
TAOS_CHECK_GOTO(mndSetUpdateDbTsmaVersionCommitLogs(pCxt->pMnode, pTrans, pCxt->pDb, &newDb), NULL, _OVER);
|
|
||||||
TAOS_CHECK_GOTO(mndSetCreateSmaRedoLogs(pCxt->pMnode, pTrans, pCxt->pSma), NULL, _OVER);
|
TAOS_CHECK_GOTO(mndSetCreateSmaRedoLogs(pCxt->pMnode, pTrans, pCxt->pSma), NULL, _OVER);
|
||||||
TAOS_CHECK_GOTO(mndSetCreateSmaUndoLogs(pCxt->pMnode, pTrans, pCxt->pSma), NULL, _OVER);
|
TAOS_CHECK_GOTO(mndSetCreateSmaUndoLogs(pCxt->pMnode, pTrans, pCxt->pSma), NULL, _OVER);
|
||||||
TAOS_CHECK_GOTO(mndSetCreateSmaCommitLogs(pCxt->pMnode, pTrans, pCxt->pSma), NULL, _OVER);
|
TAOS_CHECK_GOTO(mndSetCreateSmaCommitLogs(pCxt->pMnode, pTrans, pCxt->pSma), NULL, _OVER);
|
||||||
TAOS_CHECK_GOTO(mndTransAppendRedoAction(pTrans, &createStreamRedoAction), NULL, _OVER);
|
TAOS_CHECK_GOTO(mndTransAppendRedoAction(pTrans, &createStreamRedoAction), NULL, _OVER);
|
||||||
TAOS_CHECK_GOTO(mndTransAppendUndoAction(pTrans, &createStreamUndoAction), NULL, _OVER);
|
TAOS_CHECK_GOTO(mndTransAppendUndoAction(pTrans, &createStreamUndoAction), NULL, _OVER);
|
||||||
TAOS_CHECK_GOTO(mndTransAppendUndoAction(pTrans, &dropStbUndoAction), NULL, _OVER);
|
TAOS_CHECK_GOTO(mndTransAppendUndoAction(pTrans, &dropStbUndoAction), NULL, _OVER);
|
||||||
|
TAOS_CHECK_GOTO(mndSetUpdateDbTsmaVersionPrepareLogs(pCxt->pMnode, pTrans, pCxt->pDb, &newDb), NULL, _OVER);
|
||||||
|
TAOS_CHECK_GOTO(mndSetUpdateDbTsmaVersionCommitLogs(pCxt->pMnode, pTrans, pCxt->pDb, &newDb), NULL, _OVER);
|
||||||
TAOS_CHECK_GOTO(mndTransPrepare(pCxt->pMnode, pTrans), NULL, _OVER);
|
TAOS_CHECK_GOTO(mndTransPrepare(pCxt->pMnode, pTrans), NULL, _OVER);
|
||||||
|
|
||||||
code = TSDB_CODE_SUCCESS;
|
code = TSDB_CODE_SUCCESS;
|
||||||
|
@ -2030,12 +2030,12 @@ static int32_t mndDropTSMA(SCreateTSMACxt* pCxt) {
|
||||||
SDbObj newDb = {0};
|
SDbObj newDb = {0};
|
||||||
memcpy(&newDb, pCxt->pDb, sizeof(SDbObj));
|
memcpy(&newDb, pCxt->pDb, sizeof(SDbObj));
|
||||||
newDb.tsmaVersion++;
|
newDb.tsmaVersion++;
|
||||||
TAOS_CHECK_GOTO(mndSetUpdateDbTsmaVersionPrepareLogs(pCxt->pMnode, pTrans, pCxt->pDb, &newDb), NULL, _OVER);
|
|
||||||
TAOS_CHECK_GOTO(mndSetUpdateDbTsmaVersionCommitLogs(pCxt->pMnode, pTrans, pCxt->pDb, &newDb), NULL, _OVER);
|
|
||||||
TAOS_CHECK_GOTO(mndSetDropSmaRedoLogs(pCxt->pMnode, pTrans, pCxt->pSma), NULL, _OVER);
|
TAOS_CHECK_GOTO(mndSetDropSmaRedoLogs(pCxt->pMnode, pTrans, pCxt->pSma), NULL, _OVER);
|
||||||
TAOS_CHECK_GOTO(mndSetDropSmaCommitLogs(pCxt->pMnode, pTrans, pCxt->pSma), NULL, _OVER);
|
TAOS_CHECK_GOTO(mndSetDropSmaCommitLogs(pCxt->pMnode, pTrans, pCxt->pSma), NULL, _OVER);
|
||||||
TAOS_CHECK_GOTO(mndTransAppendRedoAction(pTrans, &dropStreamRedoAction), NULL, _OVER);
|
TAOS_CHECK_GOTO(mndTransAppendRedoAction(pTrans, &dropStreamRedoAction), NULL, _OVER);
|
||||||
TAOS_CHECK_GOTO(mndTransAppendRedoAction(pTrans, &dropStbRedoAction), NULL, _OVER);
|
TAOS_CHECK_GOTO(mndTransAppendRedoAction(pTrans, &dropStbRedoAction), NULL, _OVER);
|
||||||
|
TAOS_CHECK_GOTO(mndSetUpdateDbTsmaVersionPrepareLogs(pCxt->pMnode, pTrans, pCxt->pDb, &newDb), NULL, _OVER);
|
||||||
|
TAOS_CHECK_GOTO(mndSetUpdateDbTsmaVersionCommitLogs(pCxt->pMnode, pTrans, pCxt->pDb, &newDb), NULL, _OVER);
|
||||||
TAOS_CHECK_GOTO(mndTransPrepare(pCxt->pMnode, pTrans), NULL, _OVER);
|
TAOS_CHECK_GOTO(mndTransPrepare(pCxt->pMnode, pTrans), NULL, _OVER);
|
||||||
code = TSDB_CODE_SUCCESS;
|
code = TSDB_CODE_SUCCESS;
|
||||||
_OVER:
|
_OVER:
|
||||||
|
@ -2450,13 +2450,14 @@ static int32_t mndGetTSMA(SMnode *pMnode, char *tsmaFName, STableTSMAInfoRsp *rs
|
||||||
typedef bool (*tsmaFilter)(const SSmaObj* pSma, void* param);
|
typedef bool (*tsmaFilter)(const SSmaObj* pSma, void* param);
|
||||||
|
|
||||||
static int32_t mndGetSomeTsmas(SMnode* pMnode, STableTSMAInfoRsp* pRsp, tsmaFilter filtered, void* param, bool* exist) {
|
static int32_t mndGetSomeTsmas(SMnode* pMnode, STableTSMAInfoRsp* pRsp, tsmaFilter filtered, void* param, bool* exist) {
|
||||||
int32_t code = -1;
|
int32_t code = 0;
|
||||||
SSmaObj * pSma = NULL;
|
SSmaObj * pSma = NULL;
|
||||||
SSmaObj * pBaseTsma = NULL;
|
SSmaObj * pBaseTsma = NULL;
|
||||||
SSdb * pSdb = pMnode->pSdb;
|
SSdb * pSdb = pMnode->pSdb;
|
||||||
void * pIter = NULL;
|
void * pIter = NULL;
|
||||||
SStreamObj * pStream = NULL;
|
SStreamObj * pStream = NULL;
|
||||||
SStbObj * pStb = NULL;
|
SStbObj * pStb = NULL;
|
||||||
|
bool shouldRetry = false;
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
pIter = sdbFetch(pSdb, SDB_SMA, pIter, (void **)&pSma);
|
pIter = sdbFetch(pSdb, SDB_SMA, pIter, (void **)&pSma);
|
||||||
|
@ -2470,6 +2471,7 @@ static int32_t mndGetSomeTsmas(SMnode* pMnode, STableTSMAInfoRsp* pRsp, tsmaFilt
|
||||||
pStb = mndAcquireStb(pMnode, pSma->dstTbName);
|
pStb = mndAcquireStb(pMnode, pSma->dstTbName);
|
||||||
if (!pStb) {
|
if (!pStb) {
|
||||||
sdbRelease(pSdb, pSma);
|
sdbRelease(pSdb, pSma);
|
||||||
|
shouldRetry = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2478,16 +2480,24 @@ static int32_t mndGetSomeTsmas(SMnode* pMnode, STableTSMAInfoRsp* pRsp, tsmaFilt
|
||||||
code = tNameFromString(&smaName, pSma->name, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE);
|
code = tNameFromString(&smaName, pSma->name, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE);
|
||||||
if (TSDB_CODE_SUCCESS != code) {
|
if (TSDB_CODE_SUCCESS != code) {
|
||||||
sdbRelease(pSdb, pSma);
|
sdbRelease(pSdb, pSma);
|
||||||
|
mndReleaseStb(pMnode, pStb);
|
||||||
TAOS_RETURN(code);
|
TAOS_RETURN(code);
|
||||||
}
|
}
|
||||||
sprintf(streamName, "%d.%s", smaName.acctId, smaName.tname);
|
sprintf(streamName, "%d.%s", smaName.acctId, smaName.tname);
|
||||||
pStream = NULL;
|
pStream = NULL;
|
||||||
|
|
||||||
code = mndAcquireStream(pMnode, streamName, &pStream);
|
code = mndAcquireStream(pMnode, streamName, &pStream);
|
||||||
if (!pStream || (code != 0)) {
|
if (!pStream) {
|
||||||
|
shouldRetry = true;
|
||||||
sdbRelease(pSdb, pSma);
|
sdbRelease(pSdb, pSma);
|
||||||
|
mndReleaseStb(pMnode, pStb);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (code != 0) {
|
||||||
|
sdbRelease(pSdb, pSma);
|
||||||
|
mndReleaseStb(pMnode, pStb);
|
||||||
|
TAOS_RETURN(code);
|
||||||
|
}
|
||||||
|
|
||||||
int64_t streamId = pStream->uid;
|
int64_t streamId = pStream->uid;
|
||||||
mndReleaseStream(pMnode, pStream);
|
mndReleaseStream(pMnode, pStream);
|
||||||
|
@ -2522,6 +2532,9 @@ static int32_t mndGetSomeTsmas(SMnode* pMnode, STableTSMAInfoRsp* pRsp, tsmaFilt
|
||||||
}
|
}
|
||||||
*exist = true;
|
*exist = true;
|
||||||
}
|
}
|
||||||
|
if (shouldRetry) {
|
||||||
|
return TSDB_CODE_NEED_RETRY;
|
||||||
|
}
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2562,6 +2575,9 @@ static int32_t mndProcessGetTbTSMAReq(SRpcMsg *pReq) {
|
||||||
code = mndGetTSMA(pMnode, tsmaReq.name, &rsp, &exist);
|
code = mndGetTSMA(pMnode, tsmaReq.name, &rsp, &exist);
|
||||||
} else {
|
} else {
|
||||||
code = mndGetTableTSMA(pMnode, tsmaReq.name, &rsp, &exist);
|
code = mndGetTableTSMA(pMnode, tsmaReq.name, &rsp, &exist);
|
||||||
|
if (TSDB_CODE_NEED_RETRY == code) {
|
||||||
|
code = TSDB_CODE_SUCCESS;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (code) {
|
if (code) {
|
||||||
goto _OVER;
|
goto _OVER;
|
||||||
|
|
|
@ -2629,7 +2629,7 @@ static int32_t mndProcessAlterStbReq(SRpcMsg *pReq) {
|
||||||
|
|
||||||
SName name = {0};
|
SName name = {0};
|
||||||
// TODO check return value
|
// TODO check return value
|
||||||
tNameFromString(&name, alterReq.name, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE);
|
(void)tNameFromString(&name, alterReq.name, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE);
|
||||||
|
|
||||||
auditRecord(pReq, pMnode->clusterId, "alterStb", name.dbname, name.tname, alterReq.sql, alterReq.sqlLen);
|
auditRecord(pReq, pMnode->clusterId, "alterStb", name.dbname, name.tname, alterReq.sql, alterReq.sqlLen);
|
||||||
|
|
||||||
|
|
|
@ -848,7 +848,7 @@ static int32_t mndProcessCreateStreamReq(SRpcMsg *pReq) {
|
||||||
|
|
||||||
_OVER:
|
_OVER:
|
||||||
if (code != TSDB_CODE_SUCCESS && code != TSDB_CODE_ACTION_IN_PROGRESS) {
|
if (code != TSDB_CODE_SUCCESS && code != TSDB_CODE_ACTION_IN_PROGRESS) {
|
||||||
mError("stream:%s, failed to create since %s", createReq.name, terrstr(code));
|
mError("stream:%s, failed to create since %s", createReq.name, terrstr());
|
||||||
} else {
|
} else {
|
||||||
mDebug("stream:%s create stream completed", createReq.name);
|
mDebug("stream:%s create stream completed", createReq.name);
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,10 +50,10 @@ int32_t streamTaskSnapReaderOpen(STQ* pTq, int64_t sver, int64_t ever, SStreamTa
|
||||||
}
|
}
|
||||||
|
|
||||||
STablePair pair1 = {.tbl = pTq->pStreamMeta->pTaskDb, .type = SNAP_DATA_STREAM_TASK};
|
STablePair pair1 = {.tbl = pTq->pStreamMeta->pTaskDb, .type = SNAP_DATA_STREAM_TASK};
|
||||||
taosArrayPush(pReader->tdbTbList, &pair1);
|
(void)taosArrayPush(pReader->tdbTbList, &pair1);
|
||||||
|
|
||||||
STablePair pair2 = {.tbl = pTq->pStreamMeta->pCheckpointDb, .type = SNAP_DATA_STREAM_TASK_CHECKPOINT};
|
STablePair pair2 = {.tbl = pTq->pStreamMeta->pCheckpointDb, .type = SNAP_DATA_STREAM_TASK_CHECKPOINT};
|
||||||
taosArrayPush(pReader->tdbTbList, &pair2);
|
(void)taosArrayPush(pReader->tdbTbList, &pair2);
|
||||||
|
|
||||||
pReader->pos = 0;
|
pReader->pos = 0;
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ int32_t streamTaskSnapReaderOpen(STQ* pTq, int64_t sver, int64_t ever, SStreamTa
|
||||||
|
|
||||||
_err:
|
_err:
|
||||||
tqError("vgId:%d, vnode stream-task snapshot reader open failed since %s", TD_VID(pTq->pVnode), tstrerror(code));
|
tqError("vgId:%d, vnode stream-task snapshot reader open failed since %s", TD_VID(pTq->pVnode), tstrerror(code));
|
||||||
streamTaskSnapReaderClose(pReader);
|
(void)streamTaskSnapReaderClose(pReader);
|
||||||
*ppReader = NULL;
|
*ppReader = NULL;
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
@ -90,7 +90,7 @@ int32_t streamTaskSnapReaderClose(SStreamTaskReader* pReader) {
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
tqInfo("vgId:%d, vnode stream-task snapshot reader closed", TD_VID(pReader->pTq->pVnode));
|
tqInfo("vgId:%d, vnode stream-task snapshot reader closed", TD_VID(pReader->pTq->pVnode));
|
||||||
taosArrayDestroy(pReader->tdbTbList);
|
taosArrayDestroy(pReader->tdbTbList);
|
||||||
tdbTbcClose(pReader->pCur);
|
(void)tdbTbcClose(pReader->pCur);
|
||||||
taosMemoryFree(pReader);
|
taosMemoryFree(pReader);
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
@ -126,17 +126,17 @@ NextTbl:
|
||||||
memcpy(pVal, tVal, tLen);
|
memcpy(pVal, tVal, tLen);
|
||||||
vLen = tLen;
|
vLen = tLen;
|
||||||
}
|
}
|
||||||
tdbTbcMoveToNext(pReader->pCur);
|
(void)tdbTbcMoveToNext(pReader->pCur);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (except == 1) {
|
if (except == 1) {
|
||||||
if (pReader->pos + 1 < taosArrayGetSize(pReader->tdbTbList)) {
|
if (pReader->pos + 1 < taosArrayGetSize(pReader->tdbTbList)) {
|
||||||
tdbTbcClose(pReader->pCur);
|
(void)tdbTbcClose(pReader->pCur);
|
||||||
|
|
||||||
pReader->pos += 1;
|
pReader->pos += 1;
|
||||||
pPair = taosArrayGet(pReader->tdbTbList, pReader->pos);
|
pPair = taosArrayGet(pReader->tdbTbList, pReader->pos);
|
||||||
code = tdbTbcOpen(pPair->tbl, &pReader->pCur, NULL);
|
code = tdbTbcOpen(pPair->tbl, &pReader->pCur, NULL);
|
||||||
tdbTbcMoveToFirst(pReader->pCur);
|
(void)tdbTbcMoveToFirst(pReader->pCur);
|
||||||
|
|
||||||
goto NextTbl;
|
goto NextTbl;
|
||||||
}
|
}
|
||||||
|
@ -199,7 +199,7 @@ int32_t streamTaskSnapWriterClose(SStreamTaskWriter* pWriter, int8_t rollback) {
|
||||||
streamMetaWLock(pTq->pStreamMeta);
|
streamMetaWLock(pTq->pStreamMeta);
|
||||||
tqDebug("vgId:%d, vnode stream-task snapshot writer closed", TD_VID(pTq->pVnode));
|
tqDebug("vgId:%d, vnode stream-task snapshot writer closed", TD_VID(pTq->pVnode));
|
||||||
if (rollback) {
|
if (rollback) {
|
||||||
tdbAbort(pTq->pStreamMeta->db, pTq->pStreamMeta->txn);
|
(void)tdbAbort(pTq->pStreamMeta->db, pTq->pStreamMeta->txn);
|
||||||
} else {
|
} else {
|
||||||
code = tdbCommit(pTq->pStreamMeta->db, pTq->pStreamMeta->txn);
|
code = tdbCommit(pTq->pStreamMeta->db, pTq->pStreamMeta->txn);
|
||||||
if (code) goto _err;
|
if (code) goto _err;
|
||||||
|
|
|
@ -301,8 +301,10 @@ static int32_t binarySearchForStartRowIndex(uint64_t *uidList, int32_t num, uint
|
||||||
|
|
||||||
static int32_t extractSttBlockInfo(SLDataIter *pIter, const TSttBlkArray *pArray, SSttBlockLoadInfo *pBlockLoadInfo,
|
static int32_t extractSttBlockInfo(SLDataIter *pIter, const TSttBlkArray *pArray, SSttBlockLoadInfo *pBlockLoadInfo,
|
||||||
uint64_t suid) {
|
uint64_t suid) {
|
||||||
|
void *px = NULL;
|
||||||
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
if (TARRAY2_SIZE(pArray) <= 0) {
|
if (TARRAY2_SIZE(pArray) <= 0) {
|
||||||
return TSDB_CODE_SUCCESS;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
SSttBlk *pStart = &pArray->data[0];
|
SSttBlk *pStart = &pArray->data[0];
|
||||||
|
@ -316,10 +318,17 @@ static int32_t extractSttBlockInfo(SLDataIter *pIter, const TSttBlkArray *pArray
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
} else { // all blocks are qualified
|
} else { // all blocks are qualified
|
||||||
taosArrayClear(pBlockLoadInfo->aSttBlk);
|
taosArrayClear(pBlockLoadInfo->aSttBlk);
|
||||||
taosArrayAddBatch(pBlockLoadInfo->aSttBlk, pArray->data, pArray->size);
|
px = taosArrayAddBatch(pBlockLoadInfo->aSttBlk, pArray->data, pArray->size);
|
||||||
|
if (px == NULL){
|
||||||
|
return terrno;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
SArray *pTmp = taosArrayInit(TARRAY2_SIZE(pArray), sizeof(SSttBlk));
|
SArray *pTmp = taosArrayInit(TARRAY2_SIZE(pArray), sizeof(SSttBlk));
|
||||||
|
if (pTmp == NULL) {
|
||||||
|
return terrno;
|
||||||
|
}
|
||||||
|
|
||||||
for (int32_t i = 0; i < TARRAY2_SIZE(pArray); ++i) {
|
for (int32_t i = 0; i < TARRAY2_SIZE(pArray); ++i) {
|
||||||
SSttBlk *p = &pArray->data[i];
|
SSttBlk *p = &pArray->data[i];
|
||||||
if (p->suid < suid) {
|
if (p->suid < suid) {
|
||||||
|
@ -327,7 +336,11 @@ static int32_t extractSttBlockInfo(SLDataIter *pIter, const TSttBlkArray *pArray
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p->suid == suid) {
|
if (p->suid == suid) {
|
||||||
taosArrayPush(pTmp, p);
|
void* px = taosArrayPush(pTmp, p);
|
||||||
|
if (px == NULL) {
|
||||||
|
code = terrno;
|
||||||
|
break;
|
||||||
|
}
|
||||||
} else if (p->suid > suid) {
|
} else if (p->suid > suid) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -337,7 +350,7 @@ static int32_t extractSttBlockInfo(SLDataIter *pIter, const TSttBlkArray *pArray
|
||||||
pBlockLoadInfo->aSttBlk = pTmp;
|
pBlockLoadInfo->aSttBlk = pTmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TSDB_CODE_SUCCESS;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t tValueDupPayload(SValue *pVal) {
|
static int32_t tValueDupPayload(SValue *pVal) {
|
||||||
|
@ -357,9 +370,11 @@ static int32_t tValueDupPayload(SValue *pVal) {
|
||||||
|
|
||||||
static int32_t loadSttStatisticsBlockData(SSttFileReader *pSttFileReader, SSttBlockLoadInfo *pBlockLoadInfo,
|
static int32_t loadSttStatisticsBlockData(SSttFileReader *pSttFileReader, SSttBlockLoadInfo *pBlockLoadInfo,
|
||||||
TStatisBlkArray *pStatisBlkArray, uint64_t suid, const char *id) {
|
TStatisBlkArray *pStatisBlkArray, uint64_t suid, const char *id) {
|
||||||
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
|
void* px = NULL;
|
||||||
int32_t numOfBlocks = TARRAY2_SIZE(pStatisBlkArray);
|
int32_t numOfBlocks = TARRAY2_SIZE(pStatisBlkArray);
|
||||||
if (numOfBlocks <= 0) {
|
if (numOfBlocks <= 0) {
|
||||||
return 0;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t startIndex = 0;
|
int32_t startIndex = 0;
|
||||||
|
@ -385,7 +400,10 @@ static int32_t loadSttStatisticsBlockData(SSttFileReader *pSttFileReader, SSttBl
|
||||||
int64_t st = taosGetTimestampUs();
|
int64_t st = taosGetTimestampUs();
|
||||||
|
|
||||||
for (int32_t k = startIndex; k < endIndex; ++k) {
|
for (int32_t k = startIndex; k < endIndex; ++k) {
|
||||||
tsdbSttFileReadStatisBlock(pSttFileReader, &pStatisBlkArray->data[k], &block);
|
code = tsdbSttFileReadStatisBlock(pSttFileReader, &pStatisBlkArray->data[k], &block);
|
||||||
|
if (code) {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
int32_t i = 0;
|
int32_t i = 0;
|
||||||
int32_t rows = block.numOfRecords;
|
int32_t rows = block.numOfRecords;
|
||||||
|
@ -409,21 +427,43 @@ static int32_t loadSttStatisticsBlockData(SSttFileReader *pSttFileReader, SSttBl
|
||||||
int32_t size = rows - i;
|
int32_t size = rows - i;
|
||||||
int32_t offset = i * sizeof(int64_t);
|
int32_t offset = i * sizeof(int64_t);
|
||||||
|
|
||||||
taosArrayAddBatch(pBlockLoadInfo->info.pUid, tBufferGetDataAt(&block.uids, offset), size);
|
px = taosArrayAddBatch(pBlockLoadInfo->info.pUid, tBufferGetDataAt(&block.uids, offset), size);
|
||||||
taosArrayAddBatch(pBlockLoadInfo->info.pFirstTs, tBufferGetDataAt(&block.firstKeyTimestamps, offset), size);
|
if (px == NULL) {
|
||||||
taosArrayAddBatch(pBlockLoadInfo->info.pLastTs, tBufferGetDataAt(&block.lastKeyTimestamps, offset), size);
|
return terrno;
|
||||||
taosArrayAddBatch(pBlockLoadInfo->info.pCount, tBufferGetDataAt(&block.counts, offset), size);
|
}
|
||||||
|
|
||||||
|
px = taosArrayAddBatch(pBlockLoadInfo->info.pFirstTs, tBufferGetDataAt(&block.firstKeyTimestamps, offset), size);
|
||||||
|
if (px == NULL){
|
||||||
|
return terrno;
|
||||||
|
}
|
||||||
|
|
||||||
|
px = taosArrayAddBatch(pBlockLoadInfo->info.pLastTs, tBufferGetDataAt(&block.lastKeyTimestamps, offset), size);
|
||||||
|
if (px == NULL){
|
||||||
|
return terrno;
|
||||||
|
}
|
||||||
|
|
||||||
|
px = taosArrayAddBatch(pBlockLoadInfo->info.pCount, tBufferGetDataAt(&block.counts, offset), size);
|
||||||
|
if (px == NULL){
|
||||||
|
return terrno;
|
||||||
|
}
|
||||||
|
|
||||||
if (block.numOfPKs > 0) {
|
if (block.numOfPKs > 0) {
|
||||||
SValue vFirst = {0}, vLast = {0};
|
SValue vFirst = {0}, vLast = {0};
|
||||||
for (int32_t f = i; f < rows; ++f) {
|
for (int32_t f = i; f < rows; ++f) {
|
||||||
int32_t code = tValueColumnGet(&block.firstKeyPKs[0], f, &vFirst);
|
code = tValueColumnGet(&block.firstKeyPKs[0], f, &vFirst);
|
||||||
if (code) {
|
if (code) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
tValueDupPayload(&vFirst);
|
code = tValueDupPayload(&vFirst);
|
||||||
taosArrayPush(pBlockLoadInfo->info.pFirstKey, &vFirst);
|
if (code) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
px = taosArrayPush(pBlockLoadInfo->info.pFirstKey, &vFirst);
|
||||||
|
if (px == NULL) {
|
||||||
|
return terrno;
|
||||||
|
}
|
||||||
|
|
||||||
// todo add api to clone the original data
|
// todo add api to clone the original data
|
||||||
code = tValueColumnGet(&block.lastKeyPKs[0], f, &vLast);
|
code = tValueColumnGet(&block.lastKeyPKs[0], f, &vLast);
|
||||||
|
@ -431,14 +471,28 @@ static int32_t loadSttStatisticsBlockData(SSttFileReader *pSttFileReader, SSttBl
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
tValueDupPayload(&vLast);
|
code = tValueDupPayload(&vLast);
|
||||||
taosArrayPush(pBlockLoadInfo->info.pLastKey, &vLast);
|
if (code) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
px = taosArrayPush(pBlockLoadInfo->info.pLastKey, &vLast);
|
||||||
|
if (px == NULL) {
|
||||||
|
return terrno;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
SValue vFirst = {0};
|
SValue vFirst = {0};
|
||||||
for (int32_t j = 0; j < size; ++j) {
|
for (int32_t j = 0; j < size; ++j) {
|
||||||
taosArrayPush(pBlockLoadInfo->info.pFirstKey, &vFirst);
|
px = taosArrayPush(pBlockLoadInfo->info.pFirstKey, &vFirst);
|
||||||
taosArrayPush(pBlockLoadInfo->info.pLastKey, &vFirst);
|
if (px == NULL) {
|
||||||
|
return terrno;
|
||||||
|
}
|
||||||
|
|
||||||
|
px = taosArrayPush(pBlockLoadInfo->info.pLastKey, &vFirst);
|
||||||
|
if (px == NULL) {
|
||||||
|
return terrno;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -450,24 +504,59 @@ static int32_t loadSttStatisticsBlockData(SSttFileReader *pSttFileReader, SSttBl
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
taosArrayPush(pBlockLoadInfo->info.pUid, &record.uid);
|
px = taosArrayPush(pBlockLoadInfo->info.pUid, &record.uid);
|
||||||
taosArrayPush(pBlockLoadInfo->info.pCount, &record.count);
|
if (px == NULL) {
|
||||||
|
return terrno;
|
||||||
|
}
|
||||||
|
|
||||||
taosArrayPush(pBlockLoadInfo->info.pFirstTs, &record.firstKey.ts);
|
px = taosArrayPush(pBlockLoadInfo->info.pCount, &record.count);
|
||||||
taosArrayPush(pBlockLoadInfo->info.pLastTs, &record.lastKey.ts);
|
if (px == NULL) {
|
||||||
|
return terrno;
|
||||||
|
}
|
||||||
|
|
||||||
|
px = taosArrayPush(pBlockLoadInfo->info.pFirstTs, &record.firstKey.ts);
|
||||||
|
if (px == NULL) {
|
||||||
|
return terrno;
|
||||||
|
}
|
||||||
|
|
||||||
|
px = taosArrayPush(pBlockLoadInfo->info.pLastTs, &record.lastKey.ts);
|
||||||
|
if (px == NULL) {
|
||||||
|
return terrno;
|
||||||
|
}
|
||||||
|
|
||||||
if (record.firstKey.numOfPKs > 0) {
|
if (record.firstKey.numOfPKs > 0) {
|
||||||
SValue s = record.firstKey.pks[0];
|
SValue s = record.firstKey.pks[0];
|
||||||
tValueDupPayload(&s);
|
code = tValueDupPayload(&s);
|
||||||
taosArrayPush(pBlockLoadInfo->info.pFirstKey, &s);
|
if (code) {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
px = taosArrayPush(pBlockLoadInfo->info.pFirstKey, &s);
|
||||||
|
if (px == NULL) {
|
||||||
|
return terrno;
|
||||||
|
}
|
||||||
|
|
||||||
s = record.lastKey.pks[0];
|
s = record.lastKey.pks[0];
|
||||||
tValueDupPayload(&s);
|
code = tValueDupPayload(&s);
|
||||||
taosArrayPush(pBlockLoadInfo->info.pLastKey, &s);
|
if (code) {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
px = taosArrayPush(pBlockLoadInfo->info.pLastKey, &s);
|
||||||
|
if (px == NULL) {
|
||||||
|
return terrno;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
SValue v = {0};
|
SValue v = {0};
|
||||||
taosArrayPush(pBlockLoadInfo->info.pFirstKey, &v);
|
px = taosArrayPush(pBlockLoadInfo->info.pFirstKey, &v);
|
||||||
taosArrayPush(pBlockLoadInfo->info.pLastKey, &v);
|
if (px == NULL) {
|
||||||
|
return terrno;
|
||||||
|
}
|
||||||
|
|
||||||
|
px = taosArrayPush(pBlockLoadInfo->info.pLastKey, &v);
|
||||||
|
if (px == NULL) {
|
||||||
|
return terrno;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
i += 1;
|
i += 1;
|
||||||
|
@ -482,7 +571,7 @@ static int32_t loadSttStatisticsBlockData(SSttFileReader *pSttFileReader, SSttBl
|
||||||
pBlockLoadInfo->cost.statisElapsedTime += el;
|
pBlockLoadInfo->cost.statisElapsedTime += el;
|
||||||
|
|
||||||
tsdbDebug("%s load %d statis blocks into buf, elapsed time:%.2fms", id, num, el);
|
tsdbDebug("%s load %d statis blocks into buf, elapsed time:%.2fms", id, num, el);
|
||||||
return TSDB_CODE_SUCCESS;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t doLoadSttFilesBlk(SSttBlockLoadInfo *pBlockLoadInfo, SLDataIter *pIter, int64_t suid,
|
static int32_t doLoadSttFilesBlk(SSttBlockLoadInfo *pBlockLoadInfo, SLDataIter *pIter, int64_t suid,
|
||||||
|
@ -617,7 +706,7 @@ int32_t tLDataIterOpen2(SLDataIter *pIter, SSttFileReader *pSttFileReader, int32
|
||||||
}
|
}
|
||||||
|
|
||||||
void tLDataIterClose2(SLDataIter *pIter) {
|
void tLDataIterClose2(SLDataIter *pIter) {
|
||||||
tsdbSttFileReaderClose(&pIter->pReader);
|
(void) tsdbSttFileReaderClose(&pIter->pReader); // always return 0
|
||||||
pIter->pReader = NULL;
|
pIter->pReader = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -890,7 +979,10 @@ int32_t tMergeTreeOpen2(SMergeTree *pMTree, SMergeTreeConf *pConf, SSttDataInfoF
|
||||||
goto _end;
|
goto _end;
|
||||||
}
|
}
|
||||||
|
|
||||||
adjustSttDataIters(pConf->pSttFileBlockIterArray, pConf->pCurrentFileset);
|
code = adjustSttDataIters(pConf->pSttFileBlockIterArray, pConf->pCurrentFileset);
|
||||||
|
if (code) {
|
||||||
|
goto _end;
|
||||||
|
}
|
||||||
|
|
||||||
for (int32_t j = 0; j < numOfLevels; ++j) {
|
for (int32_t j = 0; j < numOfLevels; ++j) {
|
||||||
SSttLvl *pSttLevel = ((STFileSet *)pConf->pCurrentFileset)->lvlArr->data[j];
|
SSttLvl *pSttLevel = ((STFileSet *)pConf->pCurrentFileset)->lvlArr->data[j];
|
||||||
|
@ -940,7 +1032,10 @@ int32_t tMergeTreeOpen2(SMergeTree *pMTree, SMergeTreeConf *pConf, SSttDataInfoF
|
||||||
|
|
||||||
// let's record the time window for current table of uid in the stt files
|
// let's record the time window for current table of uid in the stt files
|
||||||
if (pSttDataInfo != NULL && numOfRows > 0) {
|
if (pSttDataInfo != NULL && numOfRows > 0) {
|
||||||
taosArrayPush(pSttDataInfo->pKeyRangeList, &range);
|
void* px = taosArrayPush(pSttDataInfo->pKeyRangeList, &range);
|
||||||
|
if (px == NULL) {
|
||||||
|
return terrno;
|
||||||
|
}
|
||||||
pSttDataInfo->numOfRows += numOfRows;
|
pSttDataInfo->numOfRows += numOfRows;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -958,7 +1053,7 @@ _end:
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
void tMergeTreeAddIter(SMergeTree *pMTree, SLDataIter *pIter) { tRBTreePut(&pMTree->rbt, (SRBTreeNode *)pIter); }
|
void tMergeTreeAddIter(SMergeTree *pMTree, SLDataIter *pIter) { (void) tRBTreePut(&pMTree->rbt, (SRBTreeNode *)pIter); }
|
||||||
|
|
||||||
bool tMergeTreeIgnoreEarlierTs(SMergeTree *pMTree) { return pMTree->ignoreEarlierTs; }
|
bool tMergeTreeIgnoreEarlierTs(SMergeTree *pMTree) { return pMTree->ignoreEarlierTs; }
|
||||||
|
|
||||||
|
@ -1035,7 +1130,7 @@ bool tMergeTreeNext(SMergeTree *pMTree) {
|
||||||
if (pMTree->pIter && pIter) {
|
if (pMTree->pIter && pIter) {
|
||||||
int32_t c = pMTree->rbt.cmprFn(&pMTree->pIter->node, &pIter->node);
|
int32_t c = pMTree->rbt.cmprFn(&pMTree->pIter->node, &pIter->node);
|
||||||
if (c > 0) {
|
if (c > 0) {
|
||||||
tRBTreePut(&pMTree->rbt, (SRBTreeNode *)pMTree->pIter);
|
(void) tRBTreePut(&pMTree->rbt, (SRBTreeNode *)pMTree->pIter);
|
||||||
pMTree->pIter = NULL;
|
pMTree->pIter = NULL;
|
||||||
} else {
|
} else {
|
||||||
ASSERT(c);
|
ASSERT(c);
|
||||||
|
|
|
@ -3293,23 +3293,10 @@ static int32_t doBuildDataBlock(STsdbReader* pReader) {
|
||||||
|
|
||||||
if ((!hasDataInSttBlock(pScanInfo)) || (asc && pBlockInfo->lastKey < keyInStt) ||
|
if ((!hasDataInSttBlock(pScanInfo)) || (asc && pBlockInfo->lastKey < keyInStt) ||
|
||||||
(!asc && pBlockInfo->firstKey > keyInStt)) {
|
(!asc && pBlockInfo->firstKey > keyInStt)) {
|
||||||
if (pScanInfo->cleanSttBlocks && hasDataInSttBlock(pScanInfo)) {
|
// the stt blocks may located in the gap of different data block, but the whole sttRange may overlap with the
|
||||||
if (asc) { // file block is located before the stt block
|
// data block, so the overlap check is invalid actually.
|
||||||
ASSERT(pScanInfo->sttRange.skey.ts > pBlockInfo->lastKey);
|
|
||||||
} else { // stt block is before the file block
|
|
||||||
ASSERT(pScanInfo->sttRange.ekey.ts < pBlockInfo->firstKey);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
buildCleanBlockFromDataFiles(pReader, pScanInfo, pBlockInfo, pBlockIter->index);
|
buildCleanBlockFromDataFiles(pReader, pScanInfo, pBlockInfo, pBlockIter->index);
|
||||||
} else { // clean stt block
|
} else { // clean stt block
|
||||||
if (asc) {
|
|
||||||
ASSERT(pScanInfo->sttRange.ekey.ts < pBlockInfo->firstKey);
|
|
||||||
} else {
|
|
||||||
ASSERT(pScanInfo->sttRange.skey.ts > pBlockInfo->lastKey);
|
|
||||||
}
|
|
||||||
|
|
||||||
// return the stt file block
|
|
||||||
ASSERT(pReader->info.execMode == READER_EXEC_ROWS && pSttBlockReader->mergeTree.pIter == NULL);
|
ASSERT(pReader->info.execMode == READER_EXEC_ROWS && pSttBlockReader->mergeTree.pIter == NULL);
|
||||||
code = buildCleanBlockFromSttFiles(pReader, pScanInfo);
|
code = buildCleanBlockFromSttFiles(pReader, pScanInfo);
|
||||||
return code;
|
return code;
|
||||||
|
|
|
@ -256,7 +256,9 @@ int vnodeLoadInfo(const char *dir, SVnodeInfo *pInfo) {
|
||||||
|
|
||||||
_exit:
|
_exit:
|
||||||
if (code) {
|
if (code) {
|
||||||
vError("vgId:%d %s failed at %s:%d since %s", pInfo->config.vgId, __func__, __FILE__, lino, tstrerror(code));
|
if (pFile) {
|
||||||
|
vError("vgId:%d %s failed at %s:%d since %s", pInfo->config.vgId, __func__, __FILE__, lino, tstrerror(code));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
taosMemoryFree(pData);
|
taosMemoryFree(pData);
|
||||||
(void)taosCloseFile(&pFile);
|
(void)taosCloseFile(&pFile);
|
||||||
|
|
|
@ -45,11 +45,11 @@ static FORCE_INLINE void auditDeleteRecord(SAuditRecord * record) {
|
||||||
|
|
||||||
void auditCleanup() {
|
void auditCleanup() {
|
||||||
tsLogFp = NULL;
|
tsLogFp = NULL;
|
||||||
taosThreadMutexLock(&tsAudit.lock);
|
(void)taosThreadMutexLock(&tsAudit.lock);
|
||||||
taosArrayDestroyP(tsAudit.records, (FDelete)auditDeleteRecord);
|
taosArrayDestroyP(tsAudit.records, (FDelete)auditDeleteRecord);
|
||||||
taosThreadMutexUnlock(&tsAudit.lock);
|
(void)taosThreadMutexUnlock(&tsAudit.lock);
|
||||||
tsAudit.records = NULL;
|
tsAudit.records = NULL;
|
||||||
taosThreadMutexDestroy(&tsAudit.lock);
|
(void)taosThreadMutexDestroy(&tsAudit.lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern void auditRecordImp(SRpcMsg *pReq, int64_t clusterId, char *operation, char *target1, char *target2,
|
extern void auditRecordImp(SRpcMsg *pReq, int64_t clusterId, char *operation, char *target1, char *target2,
|
||||||
|
|
|
@ -2300,21 +2300,29 @@ int32_t tableListAddTableInfo(STableListInfo* pTableList, uint64_t uid, uint64_t
|
||||||
}
|
}
|
||||||
|
|
||||||
STableKeyInfo keyInfo = {.uid = uid, .groupId = gid};
|
STableKeyInfo keyInfo = {.uid = uid, .groupId = gid};
|
||||||
void* tmp = taosArrayPush(pTableList->pTableList, &keyInfo);
|
void* p = taosHashGet(pTableList->map, &uid, sizeof(uid));
|
||||||
|
if (p != NULL) {
|
||||||
|
qInfo("table:%" PRId64 " already in tableIdList, ignore it", uid);
|
||||||
|
goto _end;
|
||||||
|
}
|
||||||
|
|
||||||
|
void* tmp = taosArrayPush(pTableList->pTableList, &keyInfo);
|
||||||
QUERY_CHECK_NULL(tmp, code, lino, _end, terrno);
|
QUERY_CHECK_NULL(tmp, code, lino, _end, terrno);
|
||||||
|
|
||||||
int32_t slot = (int32_t)taosArrayGetSize(pTableList->pTableList) - 1;
|
int32_t slot = (int32_t)taosArrayGetSize(pTableList->pTableList) - 1;
|
||||||
code = taosHashPut(pTableList->map, &uid, sizeof(uid), &slot, sizeof(slot));
|
code = taosHashPut(pTableList->map, &uid, sizeof(uid), &slot, sizeof(slot));
|
||||||
if (code == TSDB_CODE_DUP_KEY) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
code = TSDB_CODE_SUCCESS;
|
ASSERT(code != TSDB_CODE_DUP_KEY); // we have checked the existence of uid in hash map above
|
||||||
|
taosArrayPopTailBatch(pTableList->pTableList, 1); // let's pop the last element in the array list
|
||||||
}
|
}
|
||||||
QUERY_CHECK_CODE(code, lino, _end);
|
|
||||||
|
|
||||||
_end:
|
_end:
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
qError("%s failed at line %d since %s", __func__, lino, tstrerror(code));
|
qError("%s failed at line %d since %s", __func__, lino, tstrerror(code));
|
||||||
|
} else {
|
||||||
|
qDebug("uid:%" PRIu64 ", groupId:%" PRIu64 " added into table list, slot:%d, total:%d", uid, gid, slot, slot + 1);
|
||||||
}
|
}
|
||||||
qDebug("uid:%" PRIu64 ", groupId:%" PRIu64 " added into table list, slot:%d, total:%d", uid, gid, slot, slot + 1);
|
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1437,7 +1437,7 @@ int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subT
|
||||||
}
|
}
|
||||||
|
|
||||||
end:
|
end:
|
||||||
(void) tOffsetCopy(&pTaskInfo->streamInfo.currentOffset, pOffset);
|
tOffsetCopy(&pTaskInfo->streamInfo.currentOffset, pOffset);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2369,11 +2369,12 @@ static FORCE_INLINE int optSysBinarySearch(SArray* arr, int s, int e, uint64_t k
|
||||||
int32_t optSysIntersection(SArray* in, SArray* out) {
|
int32_t optSysIntersection(SArray* in, SArray* out) {
|
||||||
int32_t code = TSDB_CODE_SUCCESS;
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
int32_t lino = 0;
|
int32_t lino = 0;
|
||||||
|
MergeIndex* mi = NULL;
|
||||||
int32_t sz = (int32_t)taosArrayGetSize(in);
|
int32_t sz = (int32_t)taosArrayGetSize(in);
|
||||||
if (sz <= 0) {
|
if (sz <= 0) {
|
||||||
goto _end;
|
goto _end;
|
||||||
}
|
}
|
||||||
MergeIndex* mi = taosMemoryCalloc(sz, sizeof(MergeIndex));
|
mi = taosMemoryCalloc(sz, sizeof(MergeIndex));
|
||||||
QUERY_CHECK_NULL(mi, code, lino, _end, terrno);
|
QUERY_CHECK_NULL(mi, code, lino, _end, terrno);
|
||||||
for (int i = 0; i < sz; i++) {
|
for (int i = 0; i < sz; i++) {
|
||||||
SArray* t = taosArrayGetP(in, i);
|
SArray* t = taosArrayGetP(in, i);
|
||||||
|
|
|
@ -258,7 +258,7 @@ int32_t indexSearch(SIndex* index, SIndexMultiTermQuery* multiQuerys, SArray* re
|
||||||
(void)idxTermSearch(index, qterm, &trslt);
|
(void)idxTermSearch(index, qterm, &trslt);
|
||||||
(void)taosArrayPush(iRslts, (void*)&trslt);
|
(void)taosArrayPush(iRslts, (void*)&trslt);
|
||||||
}
|
}
|
||||||
idxMergeFinalResults(iRslts, opera, result);
|
(void)idxMergeFinalResults(iRslts, opera, result);
|
||||||
idxInterRsltDestroy(iRslts);
|
idxInterRsltDestroy(iRslts);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -390,10 +390,10 @@ void idxCacheDebug(IndexCache* cache) {
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
taosThreadMutexLock(&cache->mtx);
|
(void)taosThreadMutexLock(&cache->mtx);
|
||||||
tbl = cache->imm;
|
tbl = cache->imm;
|
||||||
idxMemRef(tbl);
|
idxMemRef(tbl);
|
||||||
taosThreadMutexUnlock(&cache->mtx);
|
(void)taosThreadMutexUnlock(&cache->mtx);
|
||||||
if (tbl != NULL) {
|
if (tbl != NULL) {
|
||||||
SSkipList* slt = tbl->mem;
|
SSkipList* slt = tbl->mem;
|
||||||
SSkipListIterator* iter = tSkipListCreateIter(slt);
|
SSkipListIterator* iter = tSkipListCreateIter(slt);
|
||||||
|
@ -438,7 +438,7 @@ void idxCacheDestroyImm(IndexCache* cache) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
MemTable* tbl = NULL;
|
MemTable* tbl = NULL;
|
||||||
taosThreadMutexLock(&cache->mtx);
|
(void)taosThreadMutexLock(&cache->mtx);
|
||||||
|
|
||||||
tbl = cache->imm;
|
tbl = cache->imm;
|
||||||
cache->imm = NULL; // or throw int bg thread
|
cache->imm = NULL; // or throw int bg thread
|
||||||
|
@ -533,7 +533,7 @@ static void idxCacheMakeRoomForWrite(IndexCache* cache) {
|
||||||
}
|
}
|
||||||
// 1. sched to merge
|
// 1. sched to merge
|
||||||
// 2. unref cache in bgwork
|
// 2. unref cache in bgwork
|
||||||
idxCacheSchedToMerge(cache, quit);
|
(void)idxCacheSchedToMerge(cache, quit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -285,7 +285,7 @@ void fstStateCompileForAnyTrans(IdxFstFile* w, CompiledAddr addr, FstBuilderNode
|
||||||
}
|
}
|
||||||
for (int32_t i = sz - 1; i >= 0; i--) {
|
for (int32_t i = sz - 1; i >= 0; i--) {
|
||||||
FstTransition* t = taosArrayGet(node->trans, i);
|
FstTransition* t = taosArrayGet(node->trans, i);
|
||||||
idxFileWrite(w, (char*)&t->inp, 1);
|
(void)idxFileWrite(w, (char*)&t->inp, 1);
|
||||||
}
|
}
|
||||||
if (sz > TRANS_INDEX_THRESHOLD) {
|
if (sz > TRANS_INDEX_THRESHOLD) {
|
||||||
// A value of 255 indicates that no transition exists for the byte at that idx
|
// A value of 255 indicates that no transition exists for the byte at that idx
|
||||||
|
@ -1015,7 +1015,7 @@ void fstDestroy(Fst* fst) {
|
||||||
taosMemoryFree(fst->meta);
|
taosMemoryFree(fst->meta);
|
||||||
fstSliceDestroy(fst->data);
|
fstSliceDestroy(fst->data);
|
||||||
taosMemoryFree(fst->data);
|
taosMemoryFree(fst->data);
|
||||||
taosThreadMutexDestroy(&fst->mtx);
|
(void)taosThreadMutexDestroy(&fst->mtx);
|
||||||
}
|
}
|
||||||
taosMemoryFree(fst);
|
taosMemoryFree(fst);
|
||||||
}
|
}
|
||||||
|
|
|
@ -275,7 +275,7 @@ IdxFstFile* idxFileCreate(void* wrt) {
|
||||||
return cw;
|
return cw;
|
||||||
}
|
}
|
||||||
void idxFileDestroy(IdxFstFile* cw) {
|
void idxFileDestroy(IdxFstFile* cw) {
|
||||||
idxFileFlush(cw);
|
(void)idxFileFlush(cw);
|
||||||
taosMemoryFree(cw);
|
taosMemoryFree(cw);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -314,7 +314,7 @@ uint32_t idxFileMaskedCheckSum(IdxFstFile* write) {
|
||||||
|
|
||||||
int idxFileFlush(IdxFstFile* write) {
|
int idxFileFlush(IdxFstFile* write) {
|
||||||
IFileCtx* ctx = write->wrt;
|
IFileCtx* ctx = write->wrt;
|
||||||
ctx->flush(ctx);
|
(void)(ctx->flush(ctx));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -324,7 +324,7 @@ void idxFilePackUintIn(IdxFstFile* writer, uint64_t n, uint8_t nBytes) {
|
||||||
buf[i] = (uint8_t)n;
|
buf[i] = (uint8_t)n;
|
||||||
n = n >> 8;
|
n = n >> 8;
|
||||||
}
|
}
|
||||||
idxFileWrite(writer, buf, nBytes);
|
(void)idxFileWrite(writer, buf, nBytes);
|
||||||
taosMemoryFree(buf);
|
taosMemoryFree(buf);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -671,7 +671,7 @@ IndexTFile* idxTFileCreate(SIndex* idx, const char* path) {
|
||||||
tfileCacheDestroy(cache);
|
tfileCacheDestroy(cache);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
taosThreadMutexInit(&tfile->mtx, NULL);
|
(void)taosThreadMutexInit(&tfile->mtx, NULL);
|
||||||
tfile->cache = cache;
|
tfile->cache = cache;
|
||||||
return tfile;
|
return tfile;
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,7 +100,7 @@ extern char* tsMonFwUri;
|
||||||
#define VNODE_ROLE "taosd_vnodes_info:role"
|
#define VNODE_ROLE "taosd_vnodes_info:role"
|
||||||
|
|
||||||
void monInitMonitorFW(){
|
void monInitMonitorFW(){
|
||||||
taos_collector_registry_default_init();
|
(void)taos_collector_registry_default_init();
|
||||||
|
|
||||||
tsMonitor.metrics = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK);
|
tsMonitor.metrics = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK);
|
||||||
taos_gauge_t *gauge = NULL;
|
taos_gauge_t *gauge = NULL;
|
||||||
|
@ -115,9 +115,9 @@ void monInitMonitorFW(){
|
||||||
for(int32_t i = 0; i < 25; i++){
|
for(int32_t i = 0; i < 25; i++){
|
||||||
gauge= taos_gauge_new(dnodes_gauges[i], "", dnodes_label_count, dnodes_sample_labels);
|
gauge= taos_gauge_new(dnodes_gauges[i], "", dnodes_label_count, dnodes_sample_labels);
|
||||||
if(taos_collector_registry_register_metric(gauge) == 1){
|
if(taos_collector_registry_register_metric(gauge) == 1){
|
||||||
taos_counter_destroy(gauge);
|
(void)taos_counter_destroy(gauge);
|
||||||
}
|
}
|
||||||
taosHashPut(tsMonitor.metrics, dnodes_gauges[i], strlen(dnodes_gauges[i]), &gauge, sizeof(taos_gauge_t *));
|
(void)taosHashPut(tsMonitor.metrics, dnodes_gauges[i], strlen(dnodes_gauges[i]), &gauge, sizeof(taos_gauge_t *));
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t dnodes_data_label_count = 5;
|
int32_t dnodes_data_label_count = 5;
|
||||||
|
@ -126,9 +126,10 @@ void monInitMonitorFW(){
|
||||||
for(int32_t i = 0; i < 3; i++){
|
for(int32_t i = 0; i < 3; i++){
|
||||||
gauge= taos_gauge_new(dnodes_data_gauges[i], "", dnodes_data_label_count, dnodes_data_sample_labels);
|
gauge= taos_gauge_new(dnodes_data_gauges[i], "", dnodes_data_label_count, dnodes_data_sample_labels);
|
||||||
if(taos_collector_registry_register_metric(gauge) == 1){
|
if(taos_collector_registry_register_metric(gauge) == 1){
|
||||||
taos_counter_destroy(gauge);
|
(void)taos_counter_destroy(gauge);
|
||||||
}
|
}
|
||||||
taosHashPut(tsMonitor.metrics, dnodes_data_gauges[i], strlen(dnodes_data_gauges[i]), &gauge, sizeof(taos_gauge_t *));
|
(void)taosHashPut(tsMonitor.metrics, dnodes_data_gauges[i], strlen(dnodes_data_gauges[i]), &gauge,
|
||||||
|
sizeof(taos_gauge_t *));
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t dnodes_log_label_count = 4;
|
int32_t dnodes_log_label_count = 4;
|
||||||
|
@ -137,15 +138,16 @@ void monInitMonitorFW(){
|
||||||
for(int32_t i = 0; i < 3; i++){
|
for(int32_t i = 0; i < 3; i++){
|
||||||
gauge= taos_gauge_new(dnodes_log_gauges[i], "", dnodes_log_label_count, dnodes_log_sample_labels);
|
gauge= taos_gauge_new(dnodes_log_gauges[i], "", dnodes_log_label_count, dnodes_log_sample_labels);
|
||||||
if(taos_collector_registry_register_metric(gauge) == 1){
|
if(taos_collector_registry_register_metric(gauge) == 1){
|
||||||
taos_counter_destroy(gauge);
|
(void)taos_counter_destroy(gauge);
|
||||||
}
|
}
|
||||||
taosHashPut(tsMonitor.metrics, dnodes_log_gauges[i], strlen(dnodes_log_gauges[i]), &gauge, sizeof(taos_gauge_t *));
|
(void)taosHashPut(tsMonitor.metrics, dnodes_log_gauges[i], strlen(dnodes_log_gauges[i]), &gauge,
|
||||||
|
sizeof(taos_gauge_t *));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void monCleanupMonitorFW(){
|
void monCleanupMonitorFW(){
|
||||||
taosHashCleanup(tsMonitor.metrics);
|
taosHashCleanup(tsMonitor.metrics);
|
||||||
taos_collector_registry_destroy(TAOS_COLLECTOR_REGISTRY_DEFAULT);
|
(void)taos_collector_registry_destroy(TAOS_COLLECTOR_REGISTRY_DEFAULT);
|
||||||
TAOS_COLLECTOR_REGISTRY_DEFAULT = NULL;
|
TAOS_COLLECTOR_REGISTRY_DEFAULT = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,7 +167,7 @@ void monGenClusterInfoTable(SMonInfo *pMonitor){
|
||||||
uError("failed to delete metric %s", metric_names[i]);
|
uError("failed to delete metric %s", metric_names[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
taosHashRemove(tsMonitor.metrics, metric_names[i], strlen(metric_names[i]));
|
(void)taosHashRemove(tsMonitor.metrics, metric_names[i], strlen(metric_names[i]));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(pBasicInfo->cluster_id == 0) {
|
if(pBasicInfo->cluster_id == 0) {
|
||||||
|
@ -182,9 +184,9 @@ void monGenClusterInfoTable(SMonInfo *pMonitor){
|
||||||
for(int32_t i = 0; i < 18; i++){
|
for(int32_t i = 0; i < 18; i++){
|
||||||
gauge= taos_gauge_new(metric_names[i], "", label_count, sample_labels1);
|
gauge= taos_gauge_new(metric_names[i], "", label_count, sample_labels1);
|
||||||
if(taos_collector_registry_register_metric(gauge) == 1){
|
if(taos_collector_registry_register_metric(gauge) == 1){
|
||||||
taos_counter_destroy(gauge);
|
(void)taos_counter_destroy(gauge);
|
||||||
}
|
}
|
||||||
taosHashPut(tsMonitor.metrics, metric_names[i], strlen(metric_names[i]), &gauge, sizeof(taos_gauge_t *));
|
(void)taosHashPut(tsMonitor.metrics, metric_names[i], strlen(metric_names[i]), &gauge, sizeof(taos_gauge_t *));
|
||||||
}
|
}
|
||||||
|
|
||||||
char buf[TSDB_CLUSTER_ID_LEN] = {0};
|
char buf[TSDB_CLUSTER_ID_LEN] = {0};
|
||||||
|
@ -194,37 +196,37 @@ void monGenClusterInfoTable(SMonInfo *pMonitor){
|
||||||
taos_gauge_t **metric = NULL;
|
taos_gauge_t **metric = NULL;
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, MASTER_UPTIME, strlen(MASTER_UPTIME));
|
metric = taosHashGet(tsMonitor.metrics, MASTER_UPTIME, strlen(MASTER_UPTIME));
|
||||||
taos_gauge_set(*metric, pInfo->master_uptime, sample_label_values);
|
if (metric != NULL) (void)taos_gauge_set(*metric, pInfo->master_uptime, sample_label_values);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, DBS_TOTAL, strlen(DBS_TOTAL));
|
metric = taosHashGet(tsMonitor.metrics, DBS_TOTAL, strlen(DBS_TOTAL));
|
||||||
taos_gauge_set(*metric, pInfo->dbs_total, sample_label_values);
|
if (metric != NULL) (void)taos_gauge_set(*metric, pInfo->dbs_total, sample_label_values);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, TBS_TOTAL, strlen(TBS_TOTAL));
|
metric = taosHashGet(tsMonitor.metrics, TBS_TOTAL, strlen(TBS_TOTAL));
|
||||||
taos_gauge_set(*metric, pInfo->tbs_total, sample_label_values);
|
if (metric != NULL) (void)taos_gauge_set(*metric, pInfo->tbs_total, sample_label_values);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, STBS_TOTAL, strlen(STBS_TOTAL));
|
metric = taosHashGet(tsMonitor.metrics, STBS_TOTAL, strlen(STBS_TOTAL));
|
||||||
taos_gauge_set(*metric, pInfo->stbs_total, sample_label_values);
|
if (metric != NULL) (void)taos_gauge_set(*metric, pInfo->stbs_total, sample_label_values);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, VGROUPS_TOTAL, strlen(VGROUPS_TOTAL));
|
metric = taosHashGet(tsMonitor.metrics, VGROUPS_TOTAL, strlen(VGROUPS_TOTAL));
|
||||||
taos_gauge_set(*metric, pInfo->vgroups_total, sample_label_values);
|
if (metric != NULL) (void)taos_gauge_set(*metric, pInfo->vgroups_total, sample_label_values);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, VGROUPS_ALIVE, strlen(VGROUPS_ALIVE));
|
metric = taosHashGet(tsMonitor.metrics, VGROUPS_ALIVE, strlen(VGROUPS_ALIVE));
|
||||||
taos_gauge_set(*metric, pInfo->vgroups_alive, sample_label_values);
|
if (metric != NULL) (void)taos_gauge_set(*metric, pInfo->vgroups_alive, sample_label_values);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, VNODES_TOTAL, strlen(VNODES_TOTAL));
|
metric = taosHashGet(tsMonitor.metrics, VNODES_TOTAL, strlen(VNODES_TOTAL));
|
||||||
taos_gauge_set(*metric, pInfo->vnodes_total, sample_label_values);
|
if (metric != NULL) (void)taos_gauge_set(*metric, pInfo->vnodes_total, sample_label_values);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, VNODES_ALIVE, strlen(VNODES_ALIVE));
|
metric = taosHashGet(tsMonitor.metrics, VNODES_ALIVE, strlen(VNODES_ALIVE));
|
||||||
taos_gauge_set(*metric, pInfo->vnodes_alive, sample_label_values);
|
if (metric != NULL) (void)taos_gauge_set(*metric, pInfo->vnodes_alive, sample_label_values);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, CONNECTIONS_TOTAL, strlen(CONNECTIONS_TOTAL));
|
metric = taosHashGet(tsMonitor.metrics, CONNECTIONS_TOTAL, strlen(CONNECTIONS_TOTAL));
|
||||||
taos_gauge_set(*metric, pInfo->connections_total, sample_label_values);
|
if (metric != NULL) (void)taos_gauge_set(*metric, pInfo->connections_total, sample_label_values);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, TOPICS_TOTAL, strlen(TOPICS_TOTAL));
|
metric = taosHashGet(tsMonitor.metrics, TOPICS_TOTAL, strlen(TOPICS_TOTAL));
|
||||||
taos_gauge_set(*metric, pInfo->topics_toal, sample_label_values);
|
if (metric != NULL) (void)taos_gauge_set(*metric, pInfo->topics_toal, sample_label_values);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, STREAMS_TOTAL, strlen(STREAMS_TOTAL));
|
metric = taosHashGet(tsMonitor.metrics, STREAMS_TOTAL, strlen(STREAMS_TOTAL));
|
||||||
taos_gauge_set(*metric, pInfo->streams_total, sample_label_values);
|
if (metric != NULL) (void)taos_gauge_set(*metric, pInfo->streams_total, sample_label_values);
|
||||||
|
|
||||||
//dnodes number
|
//dnodes number
|
||||||
int32_t dnode_total = taosArrayGetSize(pInfo->dnodes);
|
int32_t dnode_total = taosArrayGetSize(pInfo->dnodes);
|
||||||
|
@ -239,10 +241,10 @@ void monGenClusterInfoTable(SMonInfo *pMonitor){
|
||||||
}
|
}
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, DNODES_TOTAL, strlen(DNODES_TOTAL));
|
metric = taosHashGet(tsMonitor.metrics, DNODES_TOTAL, strlen(DNODES_TOTAL));
|
||||||
taos_gauge_set(*metric, dnode_total, sample_label_values);
|
if (metric != NULL) (void)taos_gauge_set(*metric, dnode_total, sample_label_values);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, DNODES_ALIVE, strlen(DNODES_ALIVE));
|
metric = taosHashGet(tsMonitor.metrics, DNODES_ALIVE, strlen(DNODES_ALIVE));
|
||||||
taos_gauge_set(*metric, dnode_alive, sample_label_values);
|
if (metric != NULL) (void)taos_gauge_set(*metric, dnode_alive, sample_label_values);
|
||||||
|
|
||||||
//mnodes number
|
//mnodes number
|
||||||
int32_t mnode_total = taosArrayGetSize(pInfo->mnodes);
|
int32_t mnode_total = taosArrayGetSize(pInfo->mnodes);
|
||||||
|
@ -271,20 +273,20 @@ void monGenClusterInfoTable(SMonInfo *pMonitor){
|
||||||
}
|
}
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, MNODES_TOTAL, strlen(MNODES_TOTAL));
|
metric = taosHashGet(tsMonitor.metrics, MNODES_TOTAL, strlen(MNODES_TOTAL));
|
||||||
taos_gauge_set(*metric, mnode_total, sample_label_values);
|
if (metric != NULL) (void)taos_gauge_set(*metric, mnode_total, sample_label_values);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, MNODES_ALIVE, strlen(MNODES_ALIVE));
|
metric = taosHashGet(tsMonitor.metrics, MNODES_ALIVE, strlen(MNODES_ALIVE));
|
||||||
taos_gauge_set(*metric, mnode_alive, sample_label_values);
|
if (metric != NULL) (void)taos_gauge_set(*metric, mnode_alive, sample_label_values);
|
||||||
|
|
||||||
//grant info
|
//grant info
|
||||||
metric = taosHashGet(tsMonitor.metrics, EXPIRE_TIME, strlen(EXPIRE_TIME));
|
metric = taosHashGet(tsMonitor.metrics, EXPIRE_TIME, strlen(EXPIRE_TIME));
|
||||||
taos_gauge_set(*metric, pGrantInfo->expire_time, sample_label_values);
|
if (metric != NULL) (void)taos_gauge_set(*metric, pGrantInfo->expire_time, sample_label_values);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, TIMESERIES_USED, strlen(TIMESERIES_USED));
|
metric = taosHashGet(tsMonitor.metrics, TIMESERIES_USED, strlen(TIMESERIES_USED));
|
||||||
taos_gauge_set(*metric, pGrantInfo->timeseries_used, sample_label_values);
|
if (metric != NULL) (void)taos_gauge_set(*metric, pGrantInfo->timeseries_used, sample_label_values);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, TIMESERIES_TOTAL, strlen(TIMESERIES_TOTAL));
|
metric = taosHashGet(tsMonitor.metrics, TIMESERIES_TOTAL, strlen(TIMESERIES_TOTAL));
|
||||||
taos_gauge_set(*metric, pGrantInfo->timeseries_total, sample_label_values);
|
if (metric != NULL) (void)taos_gauge_set(*metric, pGrantInfo->timeseries_total, sample_label_values);
|
||||||
}
|
}
|
||||||
|
|
||||||
void monGenVgroupInfoTable(SMonInfo *pMonitor){
|
void monGenVgroupInfoTable(SMonInfo *pMonitor){
|
||||||
|
@ -306,11 +308,11 @@ void monGenVgroupInfoTable(SMonInfo *pMonitor){
|
||||||
const char *vgroup_sample_labels[] = {"cluster_id", "vgroup_id", "database_name"};
|
const char *vgroup_sample_labels[] = {"cluster_id", "vgroup_id", "database_name"};
|
||||||
taos_gauge_t *tableNumGauge = taos_gauge_new(TABLES_NUM, "", vgroup_label_count, vgroup_sample_labels);
|
taos_gauge_t *tableNumGauge = taos_gauge_new(TABLES_NUM, "", vgroup_label_count, vgroup_sample_labels);
|
||||||
if(taos_collector_registry_register_metric(tableNumGauge) == 1){
|
if(taos_collector_registry_register_metric(tableNumGauge) == 1){
|
||||||
taos_counter_destroy(tableNumGauge);
|
(void)taos_counter_destroy(tableNumGauge);
|
||||||
}
|
}
|
||||||
taos_gauge_t *statusGauge = taos_gauge_new(STATUS, "", vgroup_label_count, vgroup_sample_labels);
|
taos_gauge_t *statusGauge = taos_gauge_new(STATUS, "", vgroup_label_count, vgroup_sample_labels);
|
||||||
if(taos_collector_registry_register_metric(statusGauge) == 1){
|
if(taos_collector_registry_register_metric(statusGauge) == 1){
|
||||||
taos_counter_destroy(statusGauge);
|
(void)taos_counter_destroy(statusGauge);
|
||||||
}
|
}
|
||||||
|
|
||||||
char cluster_id[TSDB_CLUSTER_ID_LEN] = {0};
|
char cluster_id[TSDB_CLUSTER_ID_LEN] = {0};
|
||||||
|
@ -326,13 +328,13 @@ void monGenVgroupInfoTable(SMonInfo *pMonitor){
|
||||||
|
|
||||||
taos_gauge_t **metric = NULL;
|
taos_gauge_t **metric = NULL;
|
||||||
|
|
||||||
taos_gauge_set(tableNumGauge, pVgroupDesc->tables_num, sample_labels);
|
if (tableNumGauge != NULL) (void)taos_gauge_set(tableNumGauge, pVgroupDesc->tables_num, sample_labels);
|
||||||
|
|
||||||
int32_t status = 0;
|
int32_t status = 0;
|
||||||
if(strcmp(pVgroupDesc->status, "ready") == 0){
|
if(strcmp(pVgroupDesc->status, "ready") == 0){
|
||||||
status = 1;
|
status = 1;
|
||||||
}
|
}
|
||||||
taos_gauge_set(statusGauge, status, sample_labels);
|
if (statusGauge != NULL) (void)taos_gauge_set(statusGauge, status, sample_labels);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -401,70 +403,70 @@ void monGenDnodeInfoTable(SMonInfo *pMonitor) {
|
||||||
double io_write_disk_rate = io_write_disk / interval;
|
double io_write_disk_rate = io_write_disk / interval;
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, UPTIME, strlen(UPTIME));
|
metric = taosHashGet(tsMonitor.metrics, UPTIME, strlen(UPTIME));
|
||||||
taos_gauge_set(*metric, pInfo->uptime, sample_labels);
|
if (metric != NULL) (void)taos_gauge_set(*metric, pInfo->uptime, sample_labels);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, CPU_ENGINE, strlen(CPU_ENGINE));
|
metric = taosHashGet(tsMonitor.metrics, CPU_ENGINE, strlen(CPU_ENGINE));
|
||||||
taos_gauge_set(*metric, cpu_engine, sample_labels);
|
if (metric != NULL) (void)taos_gauge_set(*metric, cpu_engine, sample_labels);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, CPU_SYSTEM, strlen(CPU_SYSTEM));
|
metric = taosHashGet(tsMonitor.metrics, CPU_SYSTEM, strlen(CPU_SYSTEM));
|
||||||
taos_gauge_set(*metric, pSys->cpu_system, sample_labels);
|
if (metric != NULL) (void)taos_gauge_set(*metric, pSys->cpu_system, sample_labels);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, CPU_CORE, strlen(CPU_CORE));
|
metric = taosHashGet(tsMonitor.metrics, CPU_CORE, strlen(CPU_CORE));
|
||||||
taos_gauge_set(*metric, pSys->cpu_cores, sample_labels);
|
if (metric != NULL) (void)taos_gauge_set(*metric, pSys->cpu_cores, sample_labels);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, MEM_ENGINE, strlen(MEM_ENGINE));
|
metric = taosHashGet(tsMonitor.metrics, MEM_ENGINE, strlen(MEM_ENGINE));
|
||||||
taos_gauge_set(*metric, mem_engine, sample_labels);
|
if (metric != NULL) (void)taos_gauge_set(*metric, mem_engine, sample_labels);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, MEM_SYSTEM, strlen(MEM_SYSTEM));
|
metric = taosHashGet(tsMonitor.metrics, MEM_SYSTEM, strlen(MEM_SYSTEM));
|
||||||
taos_gauge_set(*metric, pSys->mem_system, sample_labels);
|
if (metric != NULL) (void)taos_gauge_set(*metric, pSys->mem_system, sample_labels);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, MEM_TOTAL, strlen(MEM_TOTAL));
|
metric = taosHashGet(tsMonitor.metrics, MEM_TOTAL, strlen(MEM_TOTAL));
|
||||||
taos_gauge_set(*metric, pSys->mem_total, sample_labels);
|
if (metric != NULL) (void)taos_gauge_set(*metric, pSys->mem_total, sample_labels);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, DISK_ENGINE, strlen(DISK_ENGINE));
|
metric = taosHashGet(tsMonitor.metrics, DISK_ENGINE, strlen(DISK_ENGINE));
|
||||||
taos_gauge_set(*metric, pSys->disk_engine, sample_labels);
|
if (metric != NULL) (void)taos_gauge_set(*metric, pSys->disk_engine, sample_labels);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, DISK_USED, strlen(DISK_USED));
|
metric = taosHashGet(tsMonitor.metrics, DISK_USED, strlen(DISK_USED));
|
||||||
taos_gauge_set(*metric, pSys->disk_used, sample_labels);
|
if (metric != NULL) (void)taos_gauge_set(*metric, pSys->disk_used, sample_labels);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, DISK_TOTAL, strlen(DISK_TOTAL));
|
metric = taosHashGet(tsMonitor.metrics, DISK_TOTAL, strlen(DISK_TOTAL));
|
||||||
taos_gauge_set(*metric, pSys->disk_total, sample_labels);
|
if (metric != NULL) (void)taos_gauge_set(*metric, pSys->disk_total, sample_labels);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, NET_IN, strlen(NET_IN));
|
metric = taosHashGet(tsMonitor.metrics, NET_IN, strlen(NET_IN));
|
||||||
taos_gauge_set(*metric, net_in_rate, sample_labels);
|
if (metric != NULL) (void)taos_gauge_set(*metric, net_in_rate, sample_labels);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, NET_OUT, strlen(NET_OUT));
|
metric = taosHashGet(tsMonitor.metrics, NET_OUT, strlen(NET_OUT));
|
||||||
taos_gauge_set(*metric, net_out_rate, sample_labels);
|
if (metric != NULL) (void)taos_gauge_set(*metric, net_out_rate, sample_labels);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, IO_READ, strlen(IO_READ));
|
metric = taosHashGet(tsMonitor.metrics, IO_READ, strlen(IO_READ));
|
||||||
taos_gauge_set(*metric, io_read_rate, sample_labels);
|
if (metric != NULL) (void)taos_gauge_set(*metric, io_read_rate, sample_labels);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, IO_WRITE, strlen(IO_WRITE));
|
metric = taosHashGet(tsMonitor.metrics, IO_WRITE, strlen(IO_WRITE));
|
||||||
taos_gauge_set(*metric, io_write_rate, sample_labels);
|
if (metric != NULL) (void)taos_gauge_set(*metric, io_write_rate, sample_labels);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, IO_READ_DISK, strlen(IO_READ_DISK));
|
metric = taosHashGet(tsMonitor.metrics, IO_READ_DISK, strlen(IO_READ_DISK));
|
||||||
taos_gauge_set(*metric, io_read_disk_rate, sample_labels);
|
if (metric != NULL) (void)taos_gauge_set(*metric, io_read_disk_rate, sample_labels);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, IO_WRITE_DISK, strlen(IO_WRITE_DISK));
|
metric = taosHashGet(tsMonitor.metrics, IO_WRITE_DISK, strlen(IO_WRITE_DISK));
|
||||||
taos_gauge_set(*metric, io_write_disk_rate, sample_labels);
|
if (metric != NULL) (void)taos_gauge_set(*metric, io_write_disk_rate, sample_labels);
|
||||||
|
|
||||||
//metric = taosHashGet(tsMonitor.metrics, ERRORS, strlen(ERRORS));
|
// metric = taosHashGet(tsMonitor.metrics, ERRORS, strlen(ERRORS));
|
||||||
//taos_gauge_set(*metric, pStat->errors, sample_labels);
|
// if(metric != NULL) (void)taos_gauge_set(*metric, pStat->errors, sample_labels);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, VNODES_NUM, strlen(VNODES_NUM));
|
metric = taosHashGet(tsMonitor.metrics, VNODES_NUM, strlen(VNODES_NUM));
|
||||||
taos_gauge_set(*metric, pStat->totalVnodes, sample_labels);
|
if (metric != NULL) (void)taos_gauge_set(*metric, pStat->totalVnodes, sample_labels);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, MASTERS, strlen(MASTERS));
|
metric = taosHashGet(tsMonitor.metrics, MASTERS, strlen(MASTERS));
|
||||||
taos_gauge_set(*metric, pStat->masterNum, sample_labels);
|
if (metric != NULL) (void)taos_gauge_set(*metric, pStat->masterNum, sample_labels);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, HAS_MNODE, strlen(HAS_MNODE));
|
metric = taosHashGet(tsMonitor.metrics, HAS_MNODE, strlen(HAS_MNODE));
|
||||||
taos_gauge_set(*metric, pInfo->has_mnode, sample_labels);
|
if (metric != NULL) (void)taos_gauge_set(*metric, pInfo->has_mnode, sample_labels);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, HAS_QNODE, strlen(HAS_QNODE));
|
metric = taosHashGet(tsMonitor.metrics, HAS_QNODE, strlen(HAS_QNODE));
|
||||||
taos_gauge_set(*metric, pInfo->has_qnode, sample_labels);
|
if (metric != NULL) (void)taos_gauge_set(*metric, pInfo->has_qnode, sample_labels);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, HAS_SNODE, strlen(HAS_SNODE));
|
metric = taosHashGet(tsMonitor.metrics, HAS_SNODE, strlen(HAS_SNODE));
|
||||||
taos_gauge_set(*metric, pInfo->has_snode, sample_labels);
|
if (metric != NULL) (void)taos_gauge_set(*metric, pInfo->has_snode, sample_labels);
|
||||||
|
|
||||||
//log number
|
//log number
|
||||||
SMonLogs *logs[6];
|
SMonLogs *logs[6];
|
||||||
|
@ -489,16 +491,16 @@ void monGenDnodeInfoTable(SMonInfo *pMonitor) {
|
||||||
}
|
}
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, DNODE_LOG_ERROR, strlen(DNODE_LOG_ERROR));
|
metric = taosHashGet(tsMonitor.metrics, DNODE_LOG_ERROR, strlen(DNODE_LOG_ERROR));
|
||||||
taos_gauge_set(*metric, numOfErrorLogs, sample_labels);
|
if (metric != NULL) (void)taos_gauge_set(*metric, numOfErrorLogs, sample_labels);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, DNODE_LOG_INFO, strlen(DNODE_LOG_INFO));
|
metric = taosHashGet(tsMonitor.metrics, DNODE_LOG_INFO, strlen(DNODE_LOG_INFO));
|
||||||
taos_gauge_set(*metric, numOfInfoLogs, sample_labels);
|
if (metric != NULL) (void)taos_gauge_set(*metric, numOfInfoLogs, sample_labels);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, DNODE_LOG_DEBUG, strlen(DNODE_LOG_DEBUG));
|
metric = taosHashGet(tsMonitor.metrics, DNODE_LOG_DEBUG, strlen(DNODE_LOG_DEBUG));
|
||||||
taos_gauge_set(*metric, numOfDebugLogs, sample_labels);
|
if (metric != NULL) (void)taos_gauge_set(*metric, numOfDebugLogs, sample_labels);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, DNODE_LOG_TRACE, strlen(DNODE_LOG_TRACE));
|
metric = taosHashGet(tsMonitor.metrics, DNODE_LOG_TRACE, strlen(DNODE_LOG_TRACE));
|
||||||
taos_gauge_set(*metric, numOfTraceLogs, sample_labels);
|
if (metric != NULL) (void)taos_gauge_set(*metric, numOfTraceLogs, sample_labels);
|
||||||
}
|
}
|
||||||
|
|
||||||
void monGenDnodeStatusInfoTable(SMonInfo *pMonitor){
|
void monGenDnodeStatusInfoTable(SMonInfo *pMonitor){
|
||||||
|
@ -519,7 +521,7 @@ void monGenDnodeStatusInfoTable(SMonInfo *pMonitor){
|
||||||
|
|
||||||
gauge= taos_gauge_new(DNODE_STATUS, "", dnodes_label_count, dnodes_sample_labels);
|
gauge= taos_gauge_new(DNODE_STATUS, "", dnodes_label_count, dnodes_sample_labels);
|
||||||
if(taos_collector_registry_register_metric(gauge) == 1){
|
if(taos_collector_registry_register_metric(gauge) == 1){
|
||||||
taos_counter_destroy(gauge);
|
(void)taos_counter_destroy(gauge);
|
||||||
}
|
}
|
||||||
|
|
||||||
char cluster_id[TSDB_CLUSTER_ID_LEN];
|
char cluster_id[TSDB_CLUSTER_ID_LEN];
|
||||||
|
@ -541,7 +543,7 @@ void monGenDnodeStatusInfoTable(SMonInfo *pMonitor){
|
||||||
if(strcmp(pDnodeDesc->status, "ready") == 0){
|
if(strcmp(pDnodeDesc->status, "ready") == 0){
|
||||||
status = 1;
|
status = 1;
|
||||||
}
|
}
|
||||||
taos_gauge_set(gauge, status, sample_labels);
|
if (gauge != NULL) (void)taos_gauge_set(gauge, status, sample_labels);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -567,13 +569,13 @@ void monGenDataDiskTable(SMonInfo *pMonitor){
|
||||||
const char *sample_labels[] = {cluster_id, dnode_id, pMonitor->dmInfo.basic.dnode_ep, pDatadirDesc->name, level};
|
const char *sample_labels[] = {cluster_id, dnode_id, pMonitor->dmInfo.basic.dnode_ep, pDatadirDesc->name, level};
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, DNODE_DATA_AVAIL, strlen(DNODE_DATA_AVAIL));
|
metric = taosHashGet(tsMonitor.metrics, DNODE_DATA_AVAIL, strlen(DNODE_DATA_AVAIL));
|
||||||
taos_gauge_set(*metric, pDatadirDesc->size.avail, sample_labels);
|
if (metric != NULL) (void)taos_gauge_set(*metric, pDatadirDesc->size.avail, sample_labels);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, DNODE_DATA_USED, strlen(DNODE_DATA_USED));
|
metric = taosHashGet(tsMonitor.metrics, DNODE_DATA_USED, strlen(DNODE_DATA_USED));
|
||||||
taos_gauge_set(*metric, pDatadirDesc->size.used, sample_labels);
|
if (metric != NULL) (void)taos_gauge_set(*metric, pDatadirDesc->size.used, sample_labels);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, DNODE_DATA_TOTAL, strlen(DNODE_DATA_TOTAL));
|
metric = taosHashGet(tsMonitor.metrics, DNODE_DATA_TOTAL, strlen(DNODE_DATA_TOTAL));
|
||||||
taos_gauge_set(*metric, pDatadirDesc->size.total, sample_labels);
|
if (metric != NULL) (void)taos_gauge_set(*metric, pDatadirDesc->size.total, sample_labels);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -594,24 +596,24 @@ void monGenLogDiskTable(SMonInfo *pMonitor){
|
||||||
const char *sample_log_labels[] = {cluster_id, dnode_id, pMonitor->dmInfo.basic.dnode_ep, pLogDesc->name};
|
const char *sample_log_labels[] = {cluster_id, dnode_id, pMonitor->dmInfo.basic.dnode_ep, pLogDesc->name};
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, DNODE_LOG_AVAIL, strlen(DNODE_LOG_AVAIL));
|
metric = taosHashGet(tsMonitor.metrics, DNODE_LOG_AVAIL, strlen(DNODE_LOG_AVAIL));
|
||||||
taos_gauge_set(*metric, pLogDesc->size.avail, sample_log_labels);
|
if (metric != NULL) (void)taos_gauge_set(*metric, pLogDesc->size.avail, sample_log_labels);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, DNODE_LOG_USED, strlen(DNODE_LOG_USED));
|
metric = taosHashGet(tsMonitor.metrics, DNODE_LOG_USED, strlen(DNODE_LOG_USED));
|
||||||
taos_gauge_set(*metric, pLogDesc->size.used, sample_log_labels);
|
if (metric != NULL) (void)taos_gauge_set(*metric, pLogDesc->size.used, sample_log_labels);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, DNODE_LOG_TOTAL, strlen(DNODE_LOG_TOTAL));
|
metric = taosHashGet(tsMonitor.metrics, DNODE_LOG_TOTAL, strlen(DNODE_LOG_TOTAL));
|
||||||
taos_gauge_set(*metric, pLogDesc->size.total, sample_log_labels);
|
if (metric != NULL) (void)taos_gauge_set(*metric, pLogDesc->size.total, sample_log_labels);
|
||||||
|
|
||||||
const char *sample_temp_labels[] = {cluster_id, dnode_id, pMonitor->dmInfo.basic.dnode_ep, pTempDesc->name};
|
const char *sample_temp_labels[] = {cluster_id, dnode_id, pMonitor->dmInfo.basic.dnode_ep, pTempDesc->name};
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, DNODE_LOG_AVAIL, strlen(DNODE_LOG_AVAIL));
|
metric = taosHashGet(tsMonitor.metrics, DNODE_LOG_AVAIL, strlen(DNODE_LOG_AVAIL));
|
||||||
taos_gauge_set(*metric, pTempDesc->size.avail, sample_temp_labels);
|
if (metric != NULL) (void)taos_gauge_set(*metric, pTempDesc->size.avail, sample_temp_labels);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, DNODE_LOG_USED, strlen(DNODE_LOG_USED));
|
metric = taosHashGet(tsMonitor.metrics, DNODE_LOG_USED, strlen(DNODE_LOG_USED));
|
||||||
taos_gauge_set(*metric, pTempDesc->size.used, sample_temp_labels);
|
if (metric != NULL) (void)taos_gauge_set(*metric, pTempDesc->size.used, sample_temp_labels);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, DNODE_LOG_TOTAL, strlen(DNODE_LOG_TOTAL));
|
metric = taosHashGet(tsMonitor.metrics, DNODE_LOG_TOTAL, strlen(DNODE_LOG_TOTAL));
|
||||||
taos_gauge_set(*metric, pTempDesc->size.total, sample_temp_labels);
|
if (metric != NULL) (void)taos_gauge_set(*metric, pTempDesc->size.total, sample_temp_labels);
|
||||||
}
|
}
|
||||||
|
|
||||||
void monGenMnodeRoleTable(SMonInfo *pMonitor){
|
void monGenMnodeRoleTable(SMonInfo *pMonitor){
|
||||||
|
@ -622,7 +624,7 @@ void monGenMnodeRoleTable(SMonInfo *pMonitor){
|
||||||
uError("failed to delete metric %s", mnodes_role_gauges[i]);
|
uError("failed to delete metric %s", mnodes_role_gauges[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
taosHashRemove(tsMonitor.metrics, mnodes_role_gauges[i], strlen(mnodes_role_gauges[i]));
|
(void)taosHashRemove(tsMonitor.metrics, mnodes_role_gauges[i], strlen(mnodes_role_gauges[i]));
|
||||||
}
|
}
|
||||||
|
|
||||||
SMonClusterInfo *pInfo = &pMonitor->mmInfo.cluster;
|
SMonClusterInfo *pInfo = &pMonitor->mmInfo.cluster;
|
||||||
|
@ -636,9 +638,10 @@ void monGenMnodeRoleTable(SMonInfo *pMonitor){
|
||||||
for(int32_t i = 0; i < 1; i++){
|
for(int32_t i = 0; i < 1; i++){
|
||||||
gauge= taos_gauge_new(mnodes_role_gauges[i], "", mnodes_role_label_count, mnodes_role_sample_labels);
|
gauge= taos_gauge_new(mnodes_role_gauges[i], "", mnodes_role_label_count, mnodes_role_sample_labels);
|
||||||
if(taos_collector_registry_register_metric(gauge) == 1){
|
if(taos_collector_registry_register_metric(gauge) == 1){
|
||||||
taos_counter_destroy(gauge);
|
(void)taos_counter_destroy(gauge);
|
||||||
}
|
}
|
||||||
taosHashPut(tsMonitor.metrics, mnodes_role_gauges[i], strlen(mnodes_role_gauges[i]), &gauge, sizeof(taos_gauge_t *));
|
(void)taosHashPut(tsMonitor.metrics, mnodes_role_gauges[i], strlen(mnodes_role_gauges[i]), &gauge,
|
||||||
|
sizeof(taos_gauge_t *));
|
||||||
}
|
}
|
||||||
|
|
||||||
char buf[TSDB_CLUSTER_ID_LEN] = {0};
|
char buf[TSDB_CLUSTER_ID_LEN] = {0};
|
||||||
|
@ -669,13 +672,13 @@ void monGenMnodeRoleTable(SMonInfo *pMonitor){
|
||||||
metric = taosHashGet(tsMonitor.metrics, MNODE_ROLE, strlen(MNODE_ROLE));
|
metric = taosHashGet(tsMonitor.metrics, MNODE_ROLE, strlen(MNODE_ROLE));
|
||||||
|
|
||||||
if(dnodeIsOnline){
|
if(dnodeIsOnline){
|
||||||
taos_gauge_set(*metric, pMnodeDesc->syncState, sample_labels);
|
if (metric != NULL) (void)taos_gauge_set(*metric, pMnodeDesc->syncState, sample_labels);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
taos_gauge_set(*metric, 0, sample_labels);
|
if (metric != NULL) (void)taos_gauge_set(*metric, 0, sample_labels);
|
||||||
}
|
}
|
||||||
//metric = taosHashGet(tsMonitor.metrics, MNODE_ROLE, strlen(MNODE_ROLE));
|
// metric = taosHashGet(tsMonitor.metrics, MNODE_ROLE, strlen(MNODE_ROLE));
|
||||||
//taos_gauge_set(*metric, pMnodeDesc->syncState, sample_labels);
|
// if(metric != NULL) (void)taos_gauge_set(*metric, pMnodeDesc->syncState, sample_labels);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -688,7 +691,7 @@ void monGenVnodeRoleTable(SMonInfo *pMonitor){
|
||||||
uError("failed to delete metric %s", vnodes_role_gauges[i]);
|
uError("failed to delete metric %s", vnodes_role_gauges[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
taosHashRemove(tsMonitor.metrics, vnodes_role_gauges[i], strlen(vnodes_role_gauges[i]));
|
(void)taosHashRemove(tsMonitor.metrics, vnodes_role_gauges[i], strlen(vnodes_role_gauges[i]));
|
||||||
}
|
}
|
||||||
|
|
||||||
SMonVgroupInfo *pInfo = &pMonitor->mmInfo.vgroup;
|
SMonVgroupInfo *pInfo = &pMonitor->mmInfo.vgroup;
|
||||||
|
@ -702,9 +705,10 @@ void monGenVnodeRoleTable(SMonInfo *pMonitor){
|
||||||
for(int32_t i = 0; i < 1; i++){
|
for(int32_t i = 0; i < 1; i++){
|
||||||
gauge= taos_gauge_new(vnodes_role_gauges[i], "", vnodes_role_label_count, vnodes_role_sample_labels);
|
gauge= taos_gauge_new(vnodes_role_gauges[i], "", vnodes_role_label_count, vnodes_role_sample_labels);
|
||||||
if(taos_collector_registry_register_metric(gauge) == 1){
|
if(taos_collector_registry_register_metric(gauge) == 1){
|
||||||
taos_counter_destroy(gauge);
|
(void)taos_counter_destroy(gauge);
|
||||||
}
|
}
|
||||||
taosHashPut(tsMonitor.metrics, vnodes_role_gauges[i], strlen(vnodes_role_gauges[i]), &gauge, sizeof(taos_gauge_t *));
|
(void)taosHashPut(tsMonitor.metrics, vnodes_role_gauges[i], strlen(vnodes_role_gauges[i]), &gauge,
|
||||||
|
sizeof(taos_gauge_t *));
|
||||||
}
|
}
|
||||||
|
|
||||||
char buf[TSDB_CLUSTER_ID_LEN] = {0};
|
char buf[TSDB_CLUSTER_ID_LEN] = {0};
|
||||||
|
@ -728,7 +732,7 @@ void monGenVnodeRoleTable(SMonInfo *pMonitor){
|
||||||
const char *sample_labels[] = {buf, vgroup_id, pVgroupDesc->database_name, dnode_id};
|
const char *sample_labels[] = {buf, vgroup_id, pVgroupDesc->database_name, dnode_id};
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, VNODE_ROLE, strlen(VNODE_ROLE));
|
metric = taosHashGet(tsMonitor.metrics, VNODE_ROLE, strlen(VNODE_ROLE));
|
||||||
taos_gauge_set(*metric, pVnodeDesc->syncState, sample_labels);
|
if (metric != NULL) (void)taos_gauge_set(*metric, pVnodeDesc->syncState, sample_labels);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -753,7 +757,7 @@ void monSendPromReport() {
|
||||||
if (taosSendHttpReport(tsMonitor.cfg.server, tsMonFwUri, tsMonitor.cfg.port, pCont, strlen(pCont), flag) != 0) {
|
if (taosSendHttpReport(tsMonitor.cfg.server, tsMonFwUri, tsMonitor.cfg.port, pCont, strlen(pCont), flag) != 0) {
|
||||||
uError("failed to send monitor msg");
|
uError("failed to send monitor msg");
|
||||||
}else{
|
}else{
|
||||||
taos_collector_registry_clear_batch(TAOS_COLLECTOR_REGISTRY_DEFAULT);
|
(void)taos_collector_registry_clear_batch(TAOS_COLLECTOR_REGISTRY_DEFAULT);
|
||||||
}
|
}
|
||||||
taosMemoryFreeClear(pCont);
|
taosMemoryFreeClear(pCont);
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,7 +110,7 @@ int32_t monInit(const SMonCfg *pCfg) {
|
||||||
tsMonitor.cfg = *pCfg;
|
tsMonitor.cfg = *pCfg;
|
||||||
tsLogFp = monRecordLog;
|
tsLogFp = monRecordLog;
|
||||||
tsMonitor.lastTime = taosGetTimestampMs();
|
tsMonitor.lastTime = taosGetTimestampMs();
|
||||||
taosThreadMutexInit(&tsMonitor.lock, NULL);
|
(void)taosThreadMutexInit(&tsMonitor.lock, NULL);
|
||||||
|
|
||||||
monInitMonitorFW();
|
monInitMonitorFW();
|
||||||
|
|
||||||
|
@ -126,7 +126,7 @@ void monCleanup() {
|
||||||
tFreeSMonSmInfo(&tsMonitor.smInfo);
|
tFreeSMonSmInfo(&tsMonitor.smInfo);
|
||||||
tFreeSMonQmInfo(&tsMonitor.qmInfo);
|
tFreeSMonQmInfo(&tsMonitor.qmInfo);
|
||||||
tFreeSMonBmInfo(&tsMonitor.bmInfo);
|
tFreeSMonBmInfo(&tsMonitor.bmInfo);
|
||||||
taosThreadMutexDestroy(&tsMonitor.lock);
|
(void)taosThreadMutexDestroy(&tsMonitor.lock);
|
||||||
|
|
||||||
monCleanupMonitorFW();
|
monCleanupMonitorFW();
|
||||||
}
|
}
|
||||||
|
@ -151,7 +151,9 @@ static SMonInfo *monCreateMonitorInfo() {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
monGetLogs(&pMonitor->log);
|
if ((terrno = monGetLogs(&pMonitor->log)) != 0) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
(void)taosThreadMutexLock(&tsMonitor.lock);
|
(void)taosThreadMutexLock(&tsMonitor.lock);
|
||||||
memcpy(&pMonitor->dmInfo, &tsMonitor.dmInfo, sizeof(SMonDmInfo));
|
memcpy(&pMonitor->dmInfo, &tsMonitor.dmInfo, sizeof(SMonDmInfo));
|
||||||
|
@ -185,14 +187,14 @@ static void monGenBasicJson(SMonInfo *pMonitor) {
|
||||||
|
|
||||||
SJson *pJson = pMonitor->pJson;
|
SJson *pJson = pMonitor->pJson;
|
||||||
char buf[40] = {0};
|
char buf[40] = {0};
|
||||||
taosFormatUtcTime(buf, sizeof(buf), pMonitor->curTime, TSDB_TIME_PRECISION_MILLI);
|
(void)taosFormatUtcTime(buf, sizeof(buf), pMonitor->curTime, TSDB_TIME_PRECISION_MILLI);
|
||||||
|
|
||||||
tjsonAddStringToObject(pJson, "ts", buf);
|
(void)tjsonAddStringToObject(pJson, "ts", buf);
|
||||||
tjsonAddDoubleToObject(pJson, "dnode_id", pInfo->dnode_id);
|
(void)tjsonAddDoubleToObject(pJson, "dnode_id", pInfo->dnode_id);
|
||||||
tjsonAddStringToObject(pJson, "dnode_ep", pInfo->dnode_ep);
|
(void)tjsonAddStringToObject(pJson, "dnode_ep", pInfo->dnode_ep);
|
||||||
snprintf(buf, sizeof(buf), "%" PRId64, pInfo->cluster_id);
|
snprintf(buf, sizeof(buf), "%" PRId64, pInfo->cluster_id);
|
||||||
tjsonAddStringToObject(pJson, "cluster_id", buf);
|
(void)tjsonAddStringToObject(pJson, "cluster_id", buf);
|
||||||
tjsonAddDoubleToObject(pJson, "protocol", pInfo->protocol);
|
(void)tjsonAddDoubleToObject(pJson, "protocol", pInfo->protocol);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void monGenBasicJsonBasic(SMonInfo *pMonitor) {
|
static void monGenBasicJsonBasic(SMonInfo *pMonitor) {
|
||||||
|
@ -203,12 +205,12 @@ static void monGenBasicJsonBasic(SMonInfo *pMonitor) {
|
||||||
char buf[40] = {0};
|
char buf[40] = {0};
|
||||||
|
|
||||||
sprintf(buf, "%" PRId64, taosGetTimestamp(TSDB_TIME_PRECISION_MILLI));
|
sprintf(buf, "%" PRId64, taosGetTimestamp(TSDB_TIME_PRECISION_MILLI));
|
||||||
tjsonAddStringToObject(pJson, "ts", buf);
|
(void)tjsonAddStringToObject(pJson, "ts", buf);
|
||||||
tjsonAddDoubleToObject(pJson, "dnode_id", pInfo->dnode_id);
|
(void)tjsonAddDoubleToObject(pJson, "dnode_id", pInfo->dnode_id);
|
||||||
tjsonAddStringToObject(pJson, "dnode_ep", pInfo->dnode_ep);
|
(void)tjsonAddStringToObject(pJson, "dnode_ep", pInfo->dnode_ep);
|
||||||
snprintf(buf, sizeof(buf), "%" PRId64, pInfo->cluster_id);
|
snprintf(buf, sizeof(buf), "%" PRId64, pInfo->cluster_id);
|
||||||
tjsonAddStringToObject(pJson, "cluster_id", buf);
|
(void)tjsonAddStringToObject(pJson, "cluster_id", buf);
|
||||||
tjsonAddDoubleToObject(pJson, "protocol", pInfo->protocol);
|
(void)tjsonAddDoubleToObject(pJson, "protocol", pInfo->protocol);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void monGenClusterJson(SMonInfo *pMonitor) {
|
static void monGenClusterJson(SMonInfo *pMonitor) {
|
||||||
|
@ -222,21 +224,21 @@ static void monGenClusterJson(SMonInfo *pMonitor) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
tjsonAddStringToObject(pJson, "first_ep", pInfo->first_ep);
|
(void)tjsonAddStringToObject(pJson, "first_ep", pInfo->first_ep);
|
||||||
tjsonAddDoubleToObject(pJson, "first_ep_dnode_id", pInfo->first_ep_dnode_id);
|
(void)tjsonAddDoubleToObject(pJson, "first_ep_dnode_id", pInfo->first_ep_dnode_id);
|
||||||
tjsonAddStringToObject(pJson, "version", pInfo->version);
|
(void)tjsonAddStringToObject(pJson, "version", pInfo->version);
|
||||||
tjsonAddDoubleToObject(pJson, "master_uptime", pInfo->master_uptime);
|
(void)tjsonAddDoubleToObject(pJson, "master_uptime", pInfo->master_uptime);
|
||||||
tjsonAddDoubleToObject(pJson, "monitor_interval", pInfo->monitor_interval);
|
(void)tjsonAddDoubleToObject(pJson, "monitor_interval", pInfo->monitor_interval);
|
||||||
tjsonAddDoubleToObject(pJson, "dbs_total", pInfo->dbs_total);
|
(void)tjsonAddDoubleToObject(pJson, "dbs_total", pInfo->dbs_total);
|
||||||
tjsonAddDoubleToObject(pJson, "tbs_total", pInfo->tbs_total);
|
(void)tjsonAddDoubleToObject(pJson, "tbs_total", pInfo->tbs_total);
|
||||||
tjsonAddDoubleToObject(pJson, "stbs_total", pInfo->stbs_total);
|
(void)tjsonAddDoubleToObject(pJson, "stbs_total", pInfo->stbs_total);
|
||||||
tjsonAddDoubleToObject(pJson, "vgroups_total", pInfo->vgroups_total);
|
(void)tjsonAddDoubleToObject(pJson, "vgroups_total", pInfo->vgroups_total);
|
||||||
tjsonAddDoubleToObject(pJson, "vgroups_alive", pInfo->vgroups_alive);
|
(void)tjsonAddDoubleToObject(pJson, "vgroups_alive", pInfo->vgroups_alive);
|
||||||
tjsonAddDoubleToObject(pJson, "vnodes_total", pInfo->vnodes_total);
|
(void)tjsonAddDoubleToObject(pJson, "vnodes_total", pInfo->vnodes_total);
|
||||||
tjsonAddDoubleToObject(pJson, "vnodes_alive", pInfo->vnodes_alive);
|
(void)tjsonAddDoubleToObject(pJson, "vnodes_alive", pInfo->vnodes_alive);
|
||||||
tjsonAddDoubleToObject(pJson, "connections_total", pInfo->connections_total);
|
(void)tjsonAddDoubleToObject(pJson, "connections_total", pInfo->connections_total);
|
||||||
tjsonAddDoubleToObject(pJson, "topics_total", pInfo->topics_toal);
|
(void)tjsonAddDoubleToObject(pJson, "topics_total", pInfo->topics_toal);
|
||||||
tjsonAddDoubleToObject(pJson, "streams_total", pInfo->streams_total);
|
(void)tjsonAddDoubleToObject(pJson, "streams_total", pInfo->streams_total);
|
||||||
|
|
||||||
SJson *pDnodesJson = tjsonAddArrayToObject(pJson, "dnodes");
|
SJson *pDnodesJson = tjsonAddArrayToObject(pJson, "dnodes");
|
||||||
if (pDnodesJson == NULL) return;
|
if (pDnodesJson == NULL) return;
|
||||||
|
@ -246,9 +248,9 @@ static void monGenClusterJson(SMonInfo *pMonitor) {
|
||||||
if (pDnodeJson == NULL) continue;
|
if (pDnodeJson == NULL) continue;
|
||||||
|
|
||||||
SMonDnodeDesc *pDnodeDesc = taosArrayGet(pInfo->dnodes, i);
|
SMonDnodeDesc *pDnodeDesc = taosArrayGet(pInfo->dnodes, i);
|
||||||
tjsonAddDoubleToObject(pDnodeJson, "dnode_id", pDnodeDesc->dnode_id);
|
(void)tjsonAddDoubleToObject(pDnodeJson, "dnode_id", pDnodeDesc->dnode_id);
|
||||||
tjsonAddStringToObject(pDnodeJson, "dnode_ep", pDnodeDesc->dnode_ep);
|
(void)tjsonAddStringToObject(pDnodeJson, "dnode_ep", pDnodeDesc->dnode_ep);
|
||||||
tjsonAddStringToObject(pDnodeJson, "status", pDnodeDesc->status);
|
(void)tjsonAddStringToObject(pDnodeJson, "status", pDnodeDesc->status);
|
||||||
|
|
||||||
if (tjsonAddItemToArray(pDnodesJson, pDnodeJson) != 0) tjsonDelete(pDnodeJson);
|
if (tjsonAddItemToArray(pDnodesJson, pDnodeJson) != 0) tjsonDelete(pDnodeJson);
|
||||||
}
|
}
|
||||||
|
@ -261,9 +263,9 @@ static void monGenClusterJson(SMonInfo *pMonitor) {
|
||||||
if (pMnodeJson == NULL) continue;
|
if (pMnodeJson == NULL) continue;
|
||||||
|
|
||||||
SMonMnodeDesc *pMnodeDesc = taosArrayGet(pInfo->mnodes, i);
|
SMonMnodeDesc *pMnodeDesc = taosArrayGet(pInfo->mnodes, i);
|
||||||
tjsonAddDoubleToObject(pMnodeJson, "mnode_id", pMnodeDesc->mnode_id);
|
(void)tjsonAddDoubleToObject(pMnodeJson, "mnode_id", pMnodeDesc->mnode_id);
|
||||||
tjsonAddStringToObject(pMnodeJson, "mnode_ep", pMnodeDesc->mnode_ep);
|
(void)tjsonAddStringToObject(pMnodeJson, "mnode_ep", pMnodeDesc->mnode_ep);
|
||||||
tjsonAddStringToObject(pMnodeJson, "role", pMnodeDesc->role);
|
(void)tjsonAddStringToObject(pMnodeJson, "role", pMnodeDesc->role);
|
||||||
|
|
||||||
if (tjsonAddItemToArray(pMnodesJson, pMnodeJson) != 0) tjsonDelete(pMnodeJson);
|
if (tjsonAddItemToArray(pMnodesJson, pMnodeJson) != 0) tjsonDelete(pMnodeJson);
|
||||||
}
|
}
|
||||||
|
@ -273,11 +275,11 @@ static void monGenClusterJsonBasic(SMonInfo *pMonitor) {
|
||||||
SMonClusterInfo *pInfo = &pMonitor->mmInfo.cluster;
|
SMonClusterInfo *pInfo = &pMonitor->mmInfo.cluster;
|
||||||
if (pMonitor->mmInfo.cluster.first_ep_dnode_id == 0) return;
|
if (pMonitor->mmInfo.cluster.first_ep_dnode_id == 0) return;
|
||||||
|
|
||||||
// tjsonAddStringToObject(pMonitor->pJson, "first_ep", pInfo->first_ep);
|
// (void)tjsonAddStringToObject(pMonitor->pJson, "first_ep", pInfo->first_ep);
|
||||||
tjsonAddStringToObject(pMonitor->pJson, "first_ep", tsFirst);
|
(void)tjsonAddStringToObject(pMonitor->pJson, "first_ep", tsFirst);
|
||||||
tjsonAddDoubleToObject(pMonitor->pJson, "first_ep_dnode_id", pInfo->first_ep_dnode_id);
|
(void)tjsonAddDoubleToObject(pMonitor->pJson, "first_ep_dnode_id", pInfo->first_ep_dnode_id);
|
||||||
tjsonAddStringToObject(pMonitor->pJson, "cluster_version", pInfo->version);
|
(void)tjsonAddStringToObject(pMonitor->pJson, "cluster_version", pInfo->version);
|
||||||
// tjsonAddDoubleToObject(pMonitor->pJson, "monitor_interval", pInfo->monitor_interval);
|
// (void)tjsonAddDoubleToObject(pMonitor->pJson, "monitor_interval", pInfo->monitor_interval);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void monGenVgroupJson(SMonInfo *pMonitor) {
|
static void monGenVgroupJson(SMonInfo *pMonitor) {
|
||||||
|
@ -296,10 +298,10 @@ static void monGenVgroupJson(SMonInfo *pMonitor) {
|
||||||
}
|
}
|
||||||
|
|
||||||
SMonVgroupDesc *pVgroupDesc = taosArrayGet(pInfo->vgroups, i);
|
SMonVgroupDesc *pVgroupDesc = taosArrayGet(pInfo->vgroups, i);
|
||||||
tjsonAddDoubleToObject(pVgroupJson, "vgroup_id", pVgroupDesc->vgroup_id);
|
(void)tjsonAddDoubleToObject(pVgroupJson, "vgroup_id", pVgroupDesc->vgroup_id);
|
||||||
tjsonAddStringToObject(pVgroupJson, "database_name", pVgroupDesc->database_name);
|
(void)tjsonAddStringToObject(pVgroupJson, "database_name", pVgroupDesc->database_name);
|
||||||
tjsonAddDoubleToObject(pVgroupJson, "tables_num", pVgroupDesc->tables_num);
|
(void)tjsonAddDoubleToObject(pVgroupJson, "tables_num", pVgroupDesc->tables_num);
|
||||||
tjsonAddStringToObject(pVgroupJson, "status", pVgroupDesc->status);
|
(void)tjsonAddStringToObject(pVgroupJson, "status", pVgroupDesc->status);
|
||||||
|
|
||||||
SJson *pVnodesJson = tjsonAddArrayToObject(pVgroupJson, "vnodes");
|
SJson *pVnodesJson = tjsonAddArrayToObject(pVgroupJson, "vnodes");
|
||||||
if (pVnodesJson == NULL) continue;
|
if (pVnodesJson == NULL) continue;
|
||||||
|
@ -311,8 +313,8 @@ static void monGenVgroupJson(SMonInfo *pMonitor) {
|
||||||
SJson *pVnodeJson = tjsonCreateObject();
|
SJson *pVnodeJson = tjsonCreateObject();
|
||||||
if (pVnodeJson == NULL) continue;
|
if (pVnodeJson == NULL) continue;
|
||||||
|
|
||||||
tjsonAddDoubleToObject(pVnodeJson, "dnode_id", pVnodeDesc->dnode_id);
|
(void)tjsonAddDoubleToObject(pVnodeJson, "dnode_id", pVnodeDesc->dnode_id);
|
||||||
tjsonAddStringToObject(pVnodeJson, "vnode_role", pVnodeDesc->vnode_role);
|
(void)tjsonAddStringToObject(pVnodeJson, "vnode_role", pVnodeDesc->vnode_role);
|
||||||
|
|
||||||
if (tjsonAddItemToArray(pVnodesJson, pVnodeJson) != 0) tjsonDelete(pVnodeJson);
|
if (tjsonAddItemToArray(pVnodesJson, pVnodeJson) != 0) tjsonDelete(pVnodeJson);
|
||||||
}
|
}
|
||||||
|
@ -335,8 +337,8 @@ static void monGenStbJson(SMonInfo *pMonitor) {
|
||||||
}
|
}
|
||||||
|
|
||||||
SMonStbDesc *pStbDesc = taosArrayGet(pInfo->stbs, i);
|
SMonStbDesc *pStbDesc = taosArrayGet(pInfo->stbs, i);
|
||||||
tjsonAddStringToObject(pStbJson, "stb_name", pStbDesc->stb_name);
|
(void)tjsonAddStringToObject(pStbJson, "stb_name", pStbDesc->stb_name);
|
||||||
tjsonAddStringToObject(pStbJson, "database_name", pStbDesc->database_name);
|
(void)tjsonAddStringToObject(pStbJson, "database_name", pStbDesc->database_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -351,9 +353,9 @@ static void monGenGrantJson(SMonInfo *pMonitor) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
tjsonAddDoubleToObject(pJson, "expire_time", pInfo->expire_time);
|
(void)tjsonAddDoubleToObject(pJson, "expire_time", pInfo->expire_time);
|
||||||
tjsonAddDoubleToObject(pJson, "timeseries_used", pInfo->timeseries_used);
|
(void)tjsonAddDoubleToObject(pJson, "timeseries_used", pInfo->timeseries_used);
|
||||||
tjsonAddDoubleToObject(pJson, "timeseries_total", pInfo->timeseries_total);
|
(void)tjsonAddDoubleToObject(pJson, "timeseries_total", pInfo->timeseries_total);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void monGenDnodeJson(SMonInfo *pMonitor) {
|
static void monGenDnodeJson(SMonInfo *pMonitor) {
|
||||||
|
@ -410,36 +412,36 @@ static void monGenDnodeJson(SMonInfo *pMonitor) {
|
||||||
double io_read_disk_rate = io_read_disk / interval;
|
double io_read_disk_rate = io_read_disk / interval;
|
||||||
double io_write_disk_rate = io_write_disk / interval;
|
double io_write_disk_rate = io_write_disk / interval;
|
||||||
|
|
||||||
tjsonAddDoubleToObject(pJson, "uptime", pInfo->uptime);
|
(void)tjsonAddDoubleToObject(pJson, "uptime", pInfo->uptime);
|
||||||
tjsonAddDoubleToObject(pJson, "cpu_engine", cpu_engine);
|
(void)tjsonAddDoubleToObject(pJson, "cpu_engine", cpu_engine);
|
||||||
tjsonAddDoubleToObject(pJson, "cpu_system", pSys->cpu_system);
|
(void)tjsonAddDoubleToObject(pJson, "cpu_system", pSys->cpu_system);
|
||||||
tjsonAddDoubleToObject(pJson, "cpu_cores", pSys->cpu_cores);
|
(void)tjsonAddDoubleToObject(pJson, "cpu_cores", pSys->cpu_cores);
|
||||||
tjsonAddDoubleToObject(pJson, "mem_engine", mem_engine);
|
(void)tjsonAddDoubleToObject(pJson, "mem_engine", mem_engine);
|
||||||
tjsonAddDoubleToObject(pJson, "mem_system", pSys->mem_system);
|
(void)tjsonAddDoubleToObject(pJson, "mem_system", pSys->mem_system);
|
||||||
tjsonAddDoubleToObject(pJson, "mem_total", pSys->mem_total);
|
(void)tjsonAddDoubleToObject(pJson, "mem_total", pSys->mem_total);
|
||||||
tjsonAddDoubleToObject(pJson, "disk_engine", pSys->disk_engine);
|
(void)tjsonAddDoubleToObject(pJson, "disk_engine", pSys->disk_engine);
|
||||||
tjsonAddDoubleToObject(pJson, "disk_used", pSys->disk_used);
|
(void)tjsonAddDoubleToObject(pJson, "disk_used", pSys->disk_used);
|
||||||
tjsonAddDoubleToObject(pJson, "disk_total", pSys->disk_total);
|
(void)tjsonAddDoubleToObject(pJson, "disk_total", pSys->disk_total);
|
||||||
tjsonAddDoubleToObject(pJson, "net_in", net_in_rate);
|
(void)tjsonAddDoubleToObject(pJson, "net_in", net_in_rate);
|
||||||
tjsonAddDoubleToObject(pJson, "net_out", net_out_rate);
|
(void)tjsonAddDoubleToObject(pJson, "net_out", net_out_rate);
|
||||||
tjsonAddDoubleToObject(pJson, "io_read", io_read_rate);
|
(void)tjsonAddDoubleToObject(pJson, "io_read", io_read_rate);
|
||||||
tjsonAddDoubleToObject(pJson, "io_write", io_write_rate);
|
(void)tjsonAddDoubleToObject(pJson, "io_write", io_write_rate);
|
||||||
tjsonAddDoubleToObject(pJson, "io_read_disk", io_read_disk_rate);
|
(void)tjsonAddDoubleToObject(pJson, "io_read_disk", io_read_disk_rate);
|
||||||
tjsonAddDoubleToObject(pJson, "io_write_disk", io_write_disk_rate);
|
(void)tjsonAddDoubleToObject(pJson, "io_write_disk", io_write_disk_rate);
|
||||||
tjsonAddDoubleToObject(pJson, "req_select", pStat->numOfSelectReqs);
|
(void)tjsonAddDoubleToObject(pJson, "req_select", pStat->numOfSelectReqs);
|
||||||
tjsonAddDoubleToObject(pJson, "req_select_rate", req_select_rate);
|
(void)tjsonAddDoubleToObject(pJson, "req_select_rate", req_select_rate);
|
||||||
tjsonAddDoubleToObject(pJson, "req_insert", pStat->numOfInsertReqs);
|
(void)tjsonAddDoubleToObject(pJson, "req_insert", pStat->numOfInsertReqs);
|
||||||
tjsonAddDoubleToObject(pJson, "req_insert_success", pStat->numOfInsertSuccessReqs);
|
(void)tjsonAddDoubleToObject(pJson, "req_insert_success", pStat->numOfInsertSuccessReqs);
|
||||||
tjsonAddDoubleToObject(pJson, "req_insert_rate", req_insert_rate);
|
(void)tjsonAddDoubleToObject(pJson, "req_insert_rate", req_insert_rate);
|
||||||
tjsonAddDoubleToObject(pJson, "req_insert_batch", pStat->numOfBatchInsertReqs);
|
(void)tjsonAddDoubleToObject(pJson, "req_insert_batch", pStat->numOfBatchInsertReqs);
|
||||||
tjsonAddDoubleToObject(pJson, "req_insert_batch_success", pStat->numOfBatchInsertSuccessReqs);
|
(void)tjsonAddDoubleToObject(pJson, "req_insert_batch_success", pStat->numOfBatchInsertSuccessReqs);
|
||||||
tjsonAddDoubleToObject(pJson, "req_insert_batch_rate", req_insert_batch_rate);
|
(void)tjsonAddDoubleToObject(pJson, "req_insert_batch_rate", req_insert_batch_rate);
|
||||||
tjsonAddDoubleToObject(pJson, "errors", pStat->errors);
|
(void)tjsonAddDoubleToObject(pJson, "errors", pStat->errors);
|
||||||
tjsonAddDoubleToObject(pJson, "vnodes_num", pStat->totalVnodes);
|
(void)tjsonAddDoubleToObject(pJson, "vnodes_num", pStat->totalVnodes);
|
||||||
tjsonAddDoubleToObject(pJson, "masters", pStat->masterNum);
|
(void)tjsonAddDoubleToObject(pJson, "masters", pStat->masterNum);
|
||||||
tjsonAddDoubleToObject(pJson, "has_mnode", pInfo->has_mnode);
|
(void)tjsonAddDoubleToObject(pJson, "has_mnode", pInfo->has_mnode);
|
||||||
tjsonAddDoubleToObject(pJson, "has_qnode", pInfo->has_qnode);
|
(void)tjsonAddDoubleToObject(pJson, "has_qnode", pInfo->has_qnode);
|
||||||
tjsonAddDoubleToObject(pJson, "has_snode", pInfo->has_snode);
|
(void)tjsonAddDoubleToObject(pJson, "has_snode", pInfo->has_snode);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void monGenDiskJson(SMonInfo *pMonitor) {
|
static void monGenDiskJson(SMonInfo *pMonitor) {
|
||||||
|
@ -474,18 +476,18 @@ static void monGenDiskJson(SMonInfo *pMonitor) {
|
||||||
SJson *pLogdirJson = tjsonCreateObject();
|
SJson *pLogdirJson = tjsonCreateObject();
|
||||||
if (pLogdirJson == NULL) return;
|
if (pLogdirJson == NULL) return;
|
||||||
if (tjsonAddItemToObject(pJson, "logdir", pLogdirJson) != 0) return;
|
if (tjsonAddItemToObject(pJson, "logdir", pLogdirJson) != 0) return;
|
||||||
tjsonAddStringToObject(pLogdirJson, "name", pLogDesc->name);
|
(void)tjsonAddStringToObject(pLogdirJson, "name", pLogDesc->name);
|
||||||
tjsonAddDoubleToObject(pLogdirJson, "avail", pLogDesc->size.avail);
|
(void)tjsonAddDoubleToObject(pLogdirJson, "avail", pLogDesc->size.avail);
|
||||||
tjsonAddDoubleToObject(pLogdirJson, "used", pLogDesc->size.used);
|
(void)tjsonAddDoubleToObject(pLogdirJson, "used", pLogDesc->size.used);
|
||||||
tjsonAddDoubleToObject(pLogdirJson, "total", pLogDesc->size.total);
|
(void)tjsonAddDoubleToObject(pLogdirJson, "total", pLogDesc->size.total);
|
||||||
|
|
||||||
SJson *pTempdirJson = tjsonCreateObject();
|
SJson *pTempdirJson = tjsonCreateObject();
|
||||||
if (pTempdirJson == NULL) return;
|
if (pTempdirJson == NULL) return;
|
||||||
if (tjsonAddItemToObject(pJson, "tempdir", pTempdirJson) != 0) return;
|
if (tjsonAddItemToObject(pJson, "tempdir", pTempdirJson) != 0) return;
|
||||||
tjsonAddStringToObject(pTempdirJson, "name", pTempDesc->name);
|
(void)tjsonAddStringToObject(pTempdirJson, "name", pTempDesc->name);
|
||||||
tjsonAddDoubleToObject(pTempdirJson, "avail", pTempDesc->size.avail);
|
(void)tjsonAddDoubleToObject(pTempdirJson, "avail", pTempDesc->size.avail);
|
||||||
tjsonAddDoubleToObject(pTempdirJson, "used", pTempDesc->size.used);
|
(void)tjsonAddDoubleToObject(pTempdirJson, "used", pTempDesc->size.used);
|
||||||
tjsonAddDoubleToObject(pTempdirJson, "total", pTempDesc->size.total);
|
(void)tjsonAddDoubleToObject(pTempdirJson, "total", pTempDesc->size.total);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *monLogLevelStr(ELogLevel level) {
|
static const char *monLogLevelStr(ELogLevel level) {
|
||||||
|
@ -530,26 +532,26 @@ static void monGenLogJson(SMonInfo *pMonitor) {
|
||||||
|
|
||||||
SJson *pLogError = tjsonCreateObject();
|
SJson *pLogError = tjsonCreateObject();
|
||||||
if (pLogError == NULL) return;
|
if (pLogError == NULL) return;
|
||||||
tjsonAddStringToObject(pLogError, "level", "error");
|
(void)tjsonAddStringToObject(pLogError, "level", "error");
|
||||||
tjsonAddDoubleToObject(pLogError, "total", numOfErrorLogs);
|
(void)tjsonAddDoubleToObject(pLogError, "total", numOfErrorLogs);
|
||||||
if (tjsonAddItemToArray(pSummaryJson, pLogError) != 0) tjsonDelete(pLogError);
|
if (tjsonAddItemToArray(pSummaryJson, pLogError) != 0) tjsonDelete(pLogError);
|
||||||
|
|
||||||
SJson *pLogInfo = tjsonCreateObject();
|
SJson *pLogInfo = tjsonCreateObject();
|
||||||
if (pLogInfo == NULL) return;
|
if (pLogInfo == NULL) return;
|
||||||
tjsonAddStringToObject(pLogInfo, "level", "info");
|
(void)tjsonAddStringToObject(pLogInfo, "level", "info");
|
||||||
tjsonAddDoubleToObject(pLogInfo, "total", numOfInfoLogs);
|
(void)tjsonAddDoubleToObject(pLogInfo, "total", numOfInfoLogs);
|
||||||
if (tjsonAddItemToArray(pSummaryJson, pLogInfo) != 0) tjsonDelete(pLogInfo);
|
if (tjsonAddItemToArray(pSummaryJson, pLogInfo) != 0) tjsonDelete(pLogInfo);
|
||||||
|
|
||||||
SJson *pLogDebug = tjsonCreateObject();
|
SJson *pLogDebug = tjsonCreateObject();
|
||||||
if (pLogDebug == NULL) return;
|
if (pLogDebug == NULL) return;
|
||||||
tjsonAddStringToObject(pLogDebug, "level", "debug");
|
(void)tjsonAddStringToObject(pLogDebug, "level", "debug");
|
||||||
tjsonAddDoubleToObject(pLogDebug, "total", numOfDebugLogs);
|
(void)tjsonAddDoubleToObject(pLogDebug, "total", numOfDebugLogs);
|
||||||
if (tjsonAddItemToArray(pSummaryJson, pLogDebug) != 0) tjsonDelete(pLogDebug);
|
if (tjsonAddItemToArray(pSummaryJson, pLogDebug) != 0) tjsonDelete(pLogDebug);
|
||||||
|
|
||||||
SJson *pLogTrace = tjsonCreateObject();
|
SJson *pLogTrace = tjsonCreateObject();
|
||||||
if (pLogTrace == NULL) return;
|
if (pLogTrace == NULL) return;
|
||||||
tjsonAddStringToObject(pLogTrace, "level", "trace");
|
(void)tjsonAddStringToObject(pLogTrace, "level", "trace");
|
||||||
tjsonAddDoubleToObject(pLogTrace, "total", numOfTraceLogs);
|
(void)tjsonAddDoubleToObject(pLogTrace, "total", numOfTraceLogs);
|
||||||
if (tjsonAddItemToArray(pSummaryJson, pLogTrace) != 0) tjsonDelete(pLogTrace);
|
if (tjsonAddItemToArray(pSummaryJson, pLogTrace) != 0) tjsonDelete(pLogTrace);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3439,7 +3439,7 @@ static EDealRes doCheckExprForGroupBy(SNode** pNode, void* pContext) {
|
||||||
bool partionByTbname = hasTbnameFunction(pSelect->pPartitionByList);
|
bool partionByTbname = hasTbnameFunction(pSelect->pPartitionByList);
|
||||||
FOREACH(pPartKey, pSelect->pPartitionByList) {
|
FOREACH(pPartKey, pSelect->pPartitionByList) {
|
||||||
if (nodesEqualNode(pPartKey, *pNode)) {
|
if (nodesEqualNode(pPartKey, *pNode)) {
|
||||||
return rewriteExprToGroupKeyFunc(pCxt, pNode);
|
return pCxt->currClause == SQL_CLAUSE_HAVING ? DEAL_RES_IGNORE_CHILD : rewriteExprToGroupKeyFunc(pCxt, pNode);
|
||||||
}
|
}
|
||||||
if ((partionByTbname) && QUERY_NODE_COLUMN == nodeType(*pNode) &&
|
if ((partionByTbname) && QUERY_NODE_COLUMN == nodeType(*pNode) &&
|
||||||
((SColumnNode*)*pNode)->colType == COLUMN_TYPE_TAG) {
|
((SColumnNode*)*pNode)->colType == COLUMN_TYPE_TAG) {
|
||||||
|
@ -3658,6 +3658,7 @@ static int32_t checkHavingGroupBy(STranslateContext* pCxt, SSelectStmt* pSelect)
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
if (NULL != pSelect->pHaving) {
|
if (NULL != pSelect->pHaving) {
|
||||||
|
pCxt->currClause = SQL_CLAUSE_HAVING;
|
||||||
code = checkExprForGroupBy(pCxt, &pSelect->pHaving);
|
code = checkExprForGroupBy(pCxt, &pSelect->pHaving);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
@ -12977,7 +12978,11 @@ static int32_t buildNormalTableBatchReq(int32_t acctId, const SCreateTableStmt*
|
||||||
}
|
}
|
||||||
SNode* pCol;
|
SNode* pCol;
|
||||||
col_id_t index = 0;
|
col_id_t index = 0;
|
||||||
tInitDefaultSColCmprWrapperByCols(&req.colCmpr, req.ntb.schemaRow.nCols);
|
int32_t code = tInitDefaultSColCmprWrapperByCols(&req.colCmpr, req.ntb.schemaRow.nCols);
|
||||||
|
if (TSDB_CODE_SUCCESS != code) {
|
||||||
|
tdDestroySVCreateTbReq(&req);
|
||||||
|
return code;
|
||||||
|
}
|
||||||
FOREACH(pCol, pStmt->pCols) {
|
FOREACH(pCol, pStmt->pCols) {
|
||||||
SColumnDefNode* pColDef = (SColumnDefNode*)pCol;
|
SColumnDefNode* pColDef = (SColumnDefNode*)pCol;
|
||||||
SSchema* pScheam = req.ntb.schemaRow.pSchema + index;
|
SSchema* pScheam = req.ntb.schemaRow.pSchema + index;
|
||||||
|
|
|
@ -1176,27 +1176,6 @@ EDealRes sclRewriteNonConstOperator(SNode **pNode, SScalarCtx *ctx) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (node->pRight && (QUERY_NODE_NODE_LIST == nodeType(node->pRight))) {
|
|
||||||
SNodeListNode *listNode = (SNodeListNode *)node->pRight;
|
|
||||||
SNode *tnode = NULL;
|
|
||||||
WHERE_EACH(tnode, listNode->pNodeList) {
|
|
||||||
if (SCL_IS_NULL_VALUE_NODE(tnode)) {
|
|
||||||
if (node->opType == OP_TYPE_IN) {
|
|
||||||
ERASE_NODE(listNode->pNodeList);
|
|
||||||
continue;
|
|
||||||
} else { // OP_TYPE_NOT_IN
|
|
||||||
return sclRewriteNullInOptr(pNode, ctx, node->opType);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
WHERE_NEXT;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (listNode->pNodeList->length <= 0) {
|
|
||||||
return sclRewriteNullInOptr(pNode, ctx, node->opType);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return DEAL_RES_CONTINUE;
|
return DEAL_RES_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1334,6 +1313,27 @@ EDealRes sclRewriteOperator(SNode **pNode, SScalarCtx *ctx) {
|
||||||
return DEAL_RES_ERROR;
|
return DEAL_RES_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (node->pRight && (QUERY_NODE_NODE_LIST == nodeType(node->pRight))) {
|
||||||
|
SNodeListNode *listNode = (SNodeListNode *)node->pRight;
|
||||||
|
SNode *tnode = NULL;
|
||||||
|
WHERE_EACH(tnode, listNode->pNodeList) {
|
||||||
|
if (SCL_IS_NULL_VALUE_NODE(tnode)) {
|
||||||
|
if (node->opType == OP_TYPE_IN) {
|
||||||
|
ERASE_NODE(listNode->pNodeList);
|
||||||
|
continue;
|
||||||
|
} else { // OP_TYPE_NOT_IN
|
||||||
|
return sclRewriteNullInOptr(pNode, ctx, node->opType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
WHERE_NEXT;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (listNode->pNodeList->length <= 0) {
|
||||||
|
return sclRewriteNullInOptr(pNode, ctx, node->opType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ((!SCL_IS_CONST_NODE(node->pLeft)) || (!SCL_IS_CONST_NODE(node->pRight))) {
|
if ((!SCL_IS_CONST_NODE(node->pLeft)) || (!SCL_IS_CONST_NODE(node->pRight))) {
|
||||||
return sclRewriteNonConstOperator(pNode, ctx);
|
return sclRewriteNonConstOperator(pNode, ctx);
|
||||||
}
|
}
|
||||||
|
|
|
@ -793,7 +793,7 @@ int32_t vectorConvertSingleColImpl(const SScalarParam *pIn, SScalarParam *pOut,
|
||||||
return vectorConvertFromVarData(&cCtx, overflow);
|
return vectorConvertFromVarData(&cCtx, overflow);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (overflow) {
|
if (overflow && TSDB_DATA_TYPE_NULL != cCtx.inType) {
|
||||||
if (1 != pIn->numOfRows) {
|
if (1 != pIn->numOfRows) {
|
||||||
sclError("invalid numOfRows %d", pIn->numOfRows);
|
sclError("invalid numOfRows %d", pIn->numOfRows);
|
||||||
return TSDB_CODE_APP_ERROR;
|
return TSDB_CODE_APP_ERROR;
|
||||||
|
|
|
@ -424,7 +424,7 @@ void cleanDir(const char* pPath, const char* id) {
|
||||||
|
|
||||||
if (taosIsDir(pPath)) {
|
if (taosIsDir(pPath)) {
|
||||||
taosRemoveDir(pPath);
|
taosRemoveDir(pPath);
|
||||||
taosMkDir(pPath);
|
(void)taosMkDir(pPath);
|
||||||
stInfo("%s clear dir:%s, succ", id, pPath);
|
stInfo("%s clear dir:%s, succ", id, pPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -531,7 +531,7 @@ int32_t rebuildFromRemoteChkp_s3(const char* key, char* chkpPath, int64_t chkpId
|
||||||
_EXIT:
|
_EXIT:
|
||||||
if (code != 0) {
|
if (code != 0) {
|
||||||
if (rename) {
|
if (rename) {
|
||||||
taosRenameFile(defaultTmp, defaultPath);
|
(void)taosRenameFile(defaultTmp, defaultPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -652,13 +652,13 @@ int32_t backendFileCopyFilesImpl(const char* src, const char* dst) {
|
||||||
|
|
||||||
taosMemoryFreeClear(srcName);
|
taosMemoryFreeClear(srcName);
|
||||||
taosMemoryFreeClear(dstName);
|
taosMemoryFreeClear(dstName);
|
||||||
taosCloseDir(&pDir);
|
(void)taosCloseDir(&pDir);
|
||||||
return code;
|
return code;
|
||||||
|
|
||||||
_ERROR:
|
_ERROR:
|
||||||
taosMemoryFreeClear(srcName);
|
taosMemoryFreeClear(srcName);
|
||||||
taosMemoryFreeClear(dstName);
|
taosMemoryFreeClear(dstName);
|
||||||
taosCloseDir(&pDir);
|
(void)taosCloseDir(&pDir);
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -820,8 +820,8 @@ void* streamBackendInit(const char* streamPath, int64_t chkpId, int32_t vgId) {
|
||||||
uint32_t dbMemLimit = nextPow2(tsMaxStreamBackendCache) << 20;
|
uint32_t dbMemLimit = nextPow2(tsMaxStreamBackendCache) << 20;
|
||||||
SBackendWrapper* pHandle = taosMemoryCalloc(1, sizeof(SBackendWrapper));
|
SBackendWrapper* pHandle = taosMemoryCalloc(1, sizeof(SBackendWrapper));
|
||||||
pHandle->list = tdListNew(sizeof(SCfComparator));
|
pHandle->list = tdListNew(sizeof(SCfComparator));
|
||||||
taosThreadMutexInit(&pHandle->mutex, NULL);
|
(void)taosThreadMutexInit(&pHandle->mutex, NULL);
|
||||||
taosThreadMutexInit(&pHandle->cfMutex, NULL);
|
(void)taosThreadMutexInit(&pHandle->cfMutex, NULL);
|
||||||
pHandle->cfInst = taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_NO_LOCK);
|
pHandle->cfInst = taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_NO_LOCK);
|
||||||
|
|
||||||
rocksdb_env_t* env = rocksdb_create_default_env(); // rocksdb_envoptions_create();
|
rocksdb_env_t* env = rocksdb_create_default_env(); // rocksdb_envoptions_create();
|
||||||
|
@ -890,7 +890,7 @@ _EXIT:
|
||||||
streamMutexDestroy(&pHandle->mutex);
|
streamMutexDestroy(&pHandle->mutex);
|
||||||
streamMutexDestroy(&pHandle->cfMutex);
|
streamMutexDestroy(&pHandle->cfMutex);
|
||||||
taosHashCleanup(pHandle->cfInst);
|
taosHashCleanup(pHandle->cfInst);
|
||||||
tdListFree(pHandle->list);
|
(void)tdListFree(pHandle->list);
|
||||||
taosMemoryFree(pHandle);
|
taosMemoryFree(pHandle);
|
||||||
stDebug("failed to init stream backend at %s", backendPath);
|
stDebug("failed to init stream backend at %s", backendPath);
|
||||||
taosMemoryFree(backendPath);
|
taosMemoryFree(backendPath);
|
||||||
|
@ -922,7 +922,7 @@ void streamBackendCleanup(void* arg) {
|
||||||
head = tdListPopHead(pHandle->list);
|
head = tdListPopHead(pHandle->list);
|
||||||
}
|
}
|
||||||
|
|
||||||
tdListFree(pHandle->list);
|
(void)tdListFree(pHandle->list);
|
||||||
streamMutexDestroy(&pHandle->mutex);
|
streamMutexDestroy(&pHandle->mutex);
|
||||||
|
|
||||||
streamMutexDestroy(&pHandle->cfMutex);
|
streamMutexDestroy(&pHandle->cfMutex);
|
||||||
|
@ -933,11 +933,11 @@ void streamBackendCleanup(void* arg) {
|
||||||
void streamBackendHandleCleanup(void* arg) {
|
void streamBackendHandleCleanup(void* arg) {
|
||||||
SBackendCfWrapper* wrapper = arg;
|
SBackendCfWrapper* wrapper = arg;
|
||||||
bool remove = wrapper->remove;
|
bool remove = wrapper->remove;
|
||||||
taosThreadRwlockWrlock(&wrapper->rwLock);
|
(void)taosThreadRwlockWrlock(&wrapper->rwLock);
|
||||||
|
|
||||||
stDebug("start to do-close backendwrapper %p, %s", wrapper, wrapper->idstr);
|
stDebug("start to do-close backendwrapper %p, %s", wrapper, wrapper->idstr);
|
||||||
if (wrapper->rocksdb == NULL) {
|
if (wrapper->rocksdb == NULL) {
|
||||||
taosThreadRwlockUnlock(&wrapper->rwLock);
|
(void)taosThreadRwlockUnlock(&wrapper->rwLock);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -988,9 +988,9 @@ void streamBackendHandleCleanup(void* arg) {
|
||||||
wrapper->readOpts = NULL;
|
wrapper->readOpts = NULL;
|
||||||
taosMemoryFreeClear(wrapper->cfOpts);
|
taosMemoryFreeClear(wrapper->cfOpts);
|
||||||
taosMemoryFreeClear(wrapper->param);
|
taosMemoryFreeClear(wrapper->param);
|
||||||
taosThreadRwlockUnlock(&wrapper->rwLock);
|
(void)taosThreadRwlockUnlock(&wrapper->rwLock);
|
||||||
|
|
||||||
taosThreadRwlockDestroy(&wrapper->rwLock);
|
(void)taosThreadRwlockDestroy(&wrapper->rwLock);
|
||||||
wrapper->rocksdb = NULL;
|
wrapper->rocksdb = NULL;
|
||||||
// taosReleaseRef(streamBackendId, wrapper->backendId);
|
// taosReleaseRef(streamBackendId, wrapper->backendId);
|
||||||
|
|
||||||
|
@ -1083,12 +1083,20 @@ int32_t delObsoleteCheckpoint(void* arg, const char* path) {
|
||||||
int32_t chkpMayDelObsolete(void* arg, int64_t chkpId, char* path) {
|
int32_t chkpMayDelObsolete(void* arg, int64_t chkpId, char* path) {
|
||||||
STaskDbWrapper* pBackend = arg;
|
STaskDbWrapper* pBackend = arg;
|
||||||
|
|
||||||
taosThreadRwlockWrlock(&pBackend->chkpDirLock);
|
(void)taosThreadRwlockWrlock(&pBackend->chkpDirLock);
|
||||||
|
|
||||||
taosArrayPush(pBackend->chkpSaved, &chkpId);
|
(void)taosArrayPush(pBackend->chkpSaved, &chkpId);
|
||||||
|
|
||||||
SArray* chkpDel = taosArrayInit(8, sizeof(int64_t));
|
SArray* chkpDel = taosArrayInit(8, sizeof(int64_t));
|
||||||
|
if (chkpDel == NULL) {
|
||||||
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
}
|
||||||
|
|
||||||
SArray* chkpDup = taosArrayInit(8, sizeof(int64_t));
|
SArray* chkpDup = taosArrayInit(8, sizeof(int64_t));
|
||||||
|
if (chkpDup == NULL) {
|
||||||
|
taosArrayDestroy(chkpDel);
|
||||||
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
}
|
||||||
|
|
||||||
int64_t firsId = 0;
|
int64_t firsId = 0;
|
||||||
if (taosArrayGetSize(pBackend->chkpInUse) >= 1) {
|
if (taosArrayGetSize(pBackend->chkpInUse) >= 1) {
|
||||||
|
@ -1097,9 +1105,9 @@ int32_t chkpMayDelObsolete(void* arg, int64_t chkpId, char* path) {
|
||||||
for (int i = 0; i < taosArrayGetSize(pBackend->chkpSaved); i++) {
|
for (int i = 0; i < taosArrayGetSize(pBackend->chkpSaved); i++) {
|
||||||
int64_t id = *(int64_t*)taosArrayGet(pBackend->chkpSaved, i);
|
int64_t id = *(int64_t*)taosArrayGet(pBackend->chkpSaved, i);
|
||||||
if (id >= firsId) {
|
if (id >= firsId) {
|
||||||
taosArrayPush(chkpDup, &id);
|
(void)taosArrayPush(chkpDup, &id);
|
||||||
} else {
|
} else {
|
||||||
taosArrayPush(chkpDel, &id);
|
(void)taosArrayPush(chkpDel, &id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -1108,17 +1116,17 @@ int32_t chkpMayDelObsolete(void* arg, int64_t chkpId, char* path) {
|
||||||
|
|
||||||
for (int i = 0; i < dsz; i++) {
|
for (int i = 0; i < dsz; i++) {
|
||||||
int64_t id = *(int64_t*)taosArrayGet(pBackend->chkpSaved, i);
|
int64_t id = *(int64_t*)taosArrayGet(pBackend->chkpSaved, i);
|
||||||
taosArrayPush(chkpDel, &id);
|
(void)taosArrayPush(chkpDel, &id);
|
||||||
}
|
}
|
||||||
for (int i = dsz < 0 ? 0 : dsz; i < sz; i++) {
|
for (int i = dsz < 0 ? 0 : dsz; i < sz; i++) {
|
||||||
int64_t id = *(int64_t*)taosArrayGet(pBackend->chkpSaved, i);
|
int64_t id = *(int64_t*)taosArrayGet(pBackend->chkpSaved, i);
|
||||||
taosArrayPush(chkpDup, &id);
|
(void)taosArrayPush(chkpDup, &id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
taosArrayDestroy(pBackend->chkpSaved);
|
taosArrayDestroy(pBackend->chkpSaved);
|
||||||
pBackend->chkpSaved = chkpDup;
|
pBackend->chkpSaved = chkpDup;
|
||||||
|
|
||||||
taosThreadRwlockUnlock(&pBackend->chkpDirLock);
|
(void)taosThreadRwlockUnlock(&pBackend->chkpDirLock);
|
||||||
|
|
||||||
for (int i = 0; i < taosArrayGetSize(chkpDel); i++) {
|
for (int i = 0; i < taosArrayGetSize(chkpDel); i++) {
|
||||||
int64_t id = *(int64_t*)taosArrayGet(chkpDel, i);
|
int64_t id = *(int64_t*)taosArrayGet(chkpDel, i);
|
||||||
|
@ -1263,7 +1271,7 @@ int32_t taskDbLoadChkpInfo(STaskDbWrapper* pBackend) {
|
||||||
|
|
||||||
int ret = sscanf(taosGetDirEntryName(de), "checkpoint%" PRId64 "", &checkpointId);
|
int ret = sscanf(taosGetDirEntryName(de), "checkpoint%" PRId64 "", &checkpointId);
|
||||||
if (ret == 1) {
|
if (ret == 1) {
|
||||||
taosArrayPush(pBackend->chkpSaved, &checkpointId);
|
(void)taosArrayPush(pBackend->chkpSaved, &checkpointId);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
continue;
|
continue;
|
||||||
|
@ -1272,7 +1280,7 @@ int32_t taskDbLoadChkpInfo(STaskDbWrapper* pBackend) {
|
||||||
taosArraySort(pBackend->chkpSaved, chkpIdComp);
|
taosArraySort(pBackend->chkpSaved, chkpIdComp);
|
||||||
|
|
||||||
taosMemoryFree(pChkpDir);
|
taosMemoryFree(pChkpDir);
|
||||||
taosCloseDir(&pDir);
|
(void)taosCloseDir(&pDir);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1281,7 +1289,7 @@ int32_t chkpGetAllDbCfHandle2(STaskDbWrapper* pBackend, rocksdb_column_family_ha
|
||||||
for (int i = 0; i < sizeof(ginitDict) / sizeof(ginitDict[0]); i++) {
|
for (int i = 0; i < sizeof(ginitDict) / sizeof(ginitDict[0]); i++) {
|
||||||
if (pBackend->pCf[i]) {
|
if (pBackend->pCf[i]) {
|
||||||
rocksdb_column_family_handle_t* p = pBackend->pCf[i];
|
rocksdb_column_family_handle_t* p = pBackend->pCf[i];
|
||||||
taosArrayPush(pHandle, &p);
|
(void)taosArrayPush(pHandle, &p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int32_t nCf = taosArrayGetSize(pHandle);
|
int32_t nCf = taosArrayGetSize(pHandle);
|
||||||
|
@ -1430,7 +1438,7 @@ int32_t taskDbBuildSnap(void* arg, SArray* pSnap) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
taosArrayPush(pSnap, &snap);
|
(void)taosArrayPush(pSnap, &snap);
|
||||||
|
|
||||||
pIter = taosHashIterate(pMeta->pTaskDbUnique, pIter);
|
pIter = taosHashIterate(pMeta->pTaskDbUnique, pIter);
|
||||||
}
|
}
|
||||||
|
@ -1497,7 +1505,7 @@ void* taskAcquireDb(int64_t refId) {
|
||||||
}
|
}
|
||||||
void taskReleaseDb(int64_t refId) {
|
void taskReleaseDb(int64_t refId) {
|
||||||
// release
|
// release
|
||||||
taosReleaseRef(taskDbWrapperId, refId);
|
(void)taosReleaseRef(taskDbWrapperId, refId);
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t taskGetDBRef(void* arg) {
|
int64_t taskGetDBRef(void* arg) {
|
||||||
|
@ -1558,7 +1566,7 @@ int32_t chkpLoadExtraInfo(char* pChkpIdDir, int64_t* chkpId, int64_t* processId)
|
||||||
code = 0;
|
code = 0;
|
||||||
_EXIT:
|
_EXIT:
|
||||||
taosMemoryFree(pDst);
|
taosMemoryFree(pDst);
|
||||||
taosCloseFile(&pFile);
|
(void)taosCloseFile(&pFile);
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
int32_t chkpAddExtraInfo(char* pChkpIdDir, int64_t chkpId, int64_t processId) {
|
int32_t chkpAddExtraInfo(char* pChkpIdDir, int64_t chkpId, int64_t processId) {
|
||||||
|
@ -1613,7 +1621,7 @@ int32_t chkpAddExtraInfo(char* pChkpIdDir, int64_t chkpId, int64_t processId) {
|
||||||
code = 0;
|
code = 0;
|
||||||
|
|
||||||
_EXIT:
|
_EXIT:
|
||||||
taosCloseFile(&pFile);
|
(void)taosCloseFile(&pFile);
|
||||||
taosMemoryFree(pDst);
|
taosMemoryFree(pDst);
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
@ -1671,7 +1679,7 @@ int32_t taskDbDoCheckpoint(void* arg, int64_t chkpId, int64_t processId) {
|
||||||
goto _EXIT;
|
goto _EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
atomic_store_64(&pTaskDb->dataWritten, 0);
|
(void)atomic_store_64(&pTaskDb->dataWritten, 0);
|
||||||
pTaskDb->chkpId = chkpId;
|
pTaskDb->chkpId = chkpId;
|
||||||
|
|
||||||
_EXIT:
|
_EXIT:
|
||||||
|
@ -1679,13 +1687,13 @@ _EXIT:
|
||||||
// clear checkpoint dir if failed
|
// clear checkpoint dir if failed
|
||||||
if (code != 0 && pChkpDir != NULL) {
|
if (code != 0 && pChkpDir != NULL) {
|
||||||
if (taosDirExist(pChkpIdDir)) {
|
if (taosDirExist(pChkpIdDir)) {
|
||||||
taosRemoveDir(pChkpIdDir);
|
(void)taosRemoveDir(pChkpIdDir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
taosMemoryFree(pChkpIdDir);
|
taosMemoryFree(pChkpIdDir);
|
||||||
taosMemoryFree(pChkpDir);
|
taosMemoryFree(pChkpDir);
|
||||||
|
|
||||||
taosReleaseRef(taskDbWrapperId, refId);
|
(void)taosReleaseRef(taskDbWrapperId, refId);
|
||||||
taosMemoryFree(ppCf);
|
taosMemoryFree(ppCf);
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
@ -1758,7 +1766,7 @@ int defaultKeyComp(void* state, const char* aBuf, size_t aLen, const char* bBuf,
|
||||||
}
|
}
|
||||||
int streamStateValueIsStale(char* v) {
|
int streamStateValueIsStale(char* v) {
|
||||||
int64_t ts = 0;
|
int64_t ts = 0;
|
||||||
taosDecodeFixedI64(v, &ts);
|
(void)taosDecodeFixedI64(v, &ts);
|
||||||
return (ts != 0 && ts < taosGetTimestampMs()) ? 1 : 0;
|
return (ts != 0 && ts < taosGetTimestampMs()) ? 1 : 0;
|
||||||
}
|
}
|
||||||
int iterValueIsStale(rocksdb_iterator_t* iter) {
|
int iterValueIsStale(rocksdb_iterator_t* iter) {
|
||||||
|
@ -1801,8 +1809,8 @@ int stateKeyDBComp(void* state, const char* aBuf, size_t aLen, const char* bBuf,
|
||||||
p1 = taosDecodeFixedI64(p1, &key1.key.ts);
|
p1 = taosDecodeFixedI64(p1, &key1.key.ts);
|
||||||
p2 = taosDecodeFixedI64(p2, &key2.key.ts);
|
p2 = taosDecodeFixedI64(p2, &key2.key.ts);
|
||||||
|
|
||||||
taosDecodeFixedI64(p1, &key1.opNum);
|
(void)taosDecodeFixedI64(p1, &key1.opNum);
|
||||||
taosDecodeFixedI64(p2, &key2.opNum);
|
(void)taosDecodeFixedI64(p2, &key2.opNum);
|
||||||
|
|
||||||
return stateKeyCmpr(&key1, sizeof(key1), &key2, sizeof(key2));
|
return stateKeyCmpr(&key1, sizeof(key1), &key2, sizeof(key2));
|
||||||
}
|
}
|
||||||
|
@ -1998,8 +2006,8 @@ int parKeyDBComp(void* state, const char* aBuf, size_t aLen, const char* bBuf, s
|
||||||
char* p1 = (char*)aBuf;
|
char* p1 = (char*)aBuf;
|
||||||
char* p2 = (char*)bBuf;
|
char* p2 = (char*)bBuf;
|
||||||
|
|
||||||
taosDecodeFixedI64(p1, &w1);
|
(void)taosDecodeFixedI64(p1, &w1);
|
||||||
taosDecodeFixedI64(p2, &w2);
|
(void)taosDecodeFixedI64(p2, &w2);
|
||||||
if (w1 == w2) {
|
if (w1 == w2) {
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
|
@ -2320,7 +2328,7 @@ void taskDbRemoveRef(void* pTaskDb) {
|
||||||
}
|
}
|
||||||
|
|
||||||
STaskDbWrapper* pBackend = pTaskDb;
|
STaskDbWrapper* pBackend = pTaskDb;
|
||||||
taosReleaseRef(taskDbWrapperId, pBackend->refId);
|
(void)taosReleaseRef(taskDbWrapperId, pBackend->refId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void taskDbInitOpt(STaskDbWrapper* pTaskDb) {
|
void taskDbInitOpt(STaskDbWrapper* pTaskDb) {
|
||||||
|
@ -2386,22 +2394,22 @@ void taskDbInitChkpOpt(STaskDbWrapper* pTaskDb) {
|
||||||
pTaskDb->chkpId = -1;
|
pTaskDb->chkpId = -1;
|
||||||
pTaskDb->chkpCap = 4;
|
pTaskDb->chkpCap = 4;
|
||||||
pTaskDb->chkpSaved = taosArrayInit(4, sizeof(int64_t));
|
pTaskDb->chkpSaved = taosArrayInit(4, sizeof(int64_t));
|
||||||
taskDbLoadChkpInfo(pTaskDb);
|
(void)taskDbLoadChkpInfo(pTaskDb);
|
||||||
|
|
||||||
pTaskDb->chkpInUse = taosArrayInit(4, sizeof(int64_t));
|
pTaskDb->chkpInUse = taosArrayInit(4, sizeof(int64_t));
|
||||||
|
|
||||||
taosThreadRwlockInit(&pTaskDb->chkpDirLock, NULL);
|
(void)taosThreadRwlockInit(&pTaskDb->chkpDirLock, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void taskDbRefChkp(STaskDbWrapper* pTaskDb, int64_t chkp) {
|
void taskDbRefChkp(STaskDbWrapper* pTaskDb, int64_t chkp) {
|
||||||
taosThreadRwlockWrlock(&pTaskDb->chkpDirLock);
|
(void)taosThreadRwlockWrlock(&pTaskDb->chkpDirLock);
|
||||||
taosArrayPush(pTaskDb->chkpInUse, &chkp);
|
(void)taosArrayPush(pTaskDb->chkpInUse, &chkp);
|
||||||
taosArraySort(pTaskDb->chkpInUse, chkpIdComp);
|
taosArraySort(pTaskDb->chkpInUse, chkpIdComp);
|
||||||
taosThreadRwlockUnlock(&pTaskDb->chkpDirLock);
|
(void)taosThreadRwlockUnlock(&pTaskDb->chkpDirLock);
|
||||||
}
|
}
|
||||||
|
|
||||||
void taskDbUnRefChkp(STaskDbWrapper* pTaskDb, int64_t chkp) {
|
void taskDbUnRefChkp(STaskDbWrapper* pTaskDb, int64_t chkp) {
|
||||||
taosThreadRwlockWrlock(&pTaskDb->chkpDirLock);
|
(void)taosThreadRwlockWrlock(&pTaskDb->chkpDirLock);
|
||||||
int32_t size = taosArrayGetSize(pTaskDb->chkpInUse);
|
int32_t size = taosArrayGetSize(pTaskDb->chkpInUse);
|
||||||
for (int i = 0; i < size; i++) {
|
for (int i = 0; i < size; i++) {
|
||||||
int64_t* p = taosArrayGet(pTaskDb->chkpInUse, i);
|
int64_t* p = taosArrayGet(pTaskDb->chkpInUse, i);
|
||||||
|
@ -2410,13 +2418,13 @@ void taskDbUnRefChkp(STaskDbWrapper* pTaskDb, int64_t chkp) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
taosThreadRwlockUnlock(&pTaskDb->chkpDirLock);
|
(void)taosThreadRwlockUnlock(&pTaskDb->chkpDirLock);
|
||||||
}
|
}
|
||||||
|
|
||||||
void taskDbDestroyChkpOpt(STaskDbWrapper* pTaskDb) {
|
void taskDbDestroyChkpOpt(STaskDbWrapper* pTaskDb) {
|
||||||
taosArrayDestroy(pTaskDb->chkpSaved);
|
taosArrayDestroy(pTaskDb->chkpSaved);
|
||||||
taosArrayDestroy(pTaskDb->chkpInUse);
|
taosArrayDestroy(pTaskDb->chkpInUse);
|
||||||
taosThreadRwlockDestroy(&pTaskDb->chkpDirLock);
|
(void)taosThreadRwlockDestroy(&pTaskDb->chkpDirLock);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t taskDbBuildFullPath(char* path, char* key, char** dbFullPath, char** stateFullPath) {
|
int32_t taskDbBuildFullPath(char* path, char* key, char** dbFullPath, char** stateFullPath) {
|
||||||
|
@ -2462,9 +2470,9 @@ int32_t taskDbBuildFullPath(char* path, char* key, char** dbFullPath, char** sta
|
||||||
|
|
||||||
void taskDbUpdateChkpId(void* pTaskDb, int64_t chkpId) {
|
void taskDbUpdateChkpId(void* pTaskDb, int64_t chkpId) {
|
||||||
STaskDbWrapper* p = pTaskDb;
|
STaskDbWrapper* p = pTaskDb;
|
||||||
streamMutexLock(&p->mutex);
|
(void)streamMutexLock(&p->mutex);
|
||||||
p->chkpId = chkpId;
|
p->chkpId = chkpId;
|
||||||
streamMutexUnlock(&p->mutex);
|
(void)streamMutexUnlock(&p->mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
STaskDbWrapper* taskDbOpenImpl(const char* key, char* statePath, char* dbPath) {
|
STaskDbWrapper* taskDbOpenImpl(const char* key, char* statePath, char* dbPath) {
|
||||||
|
@ -2476,7 +2484,7 @@ STaskDbWrapper* taskDbOpenImpl(const char* key, char* statePath, char* dbPath) {
|
||||||
pTaskDb->idstr = key ? taosStrdup(key) : NULL;
|
pTaskDb->idstr = key ? taosStrdup(key) : NULL;
|
||||||
pTaskDb->path = statePath ? taosStrdup(statePath) : NULL;
|
pTaskDb->path = statePath ? taosStrdup(statePath) : NULL;
|
||||||
|
|
||||||
taosThreadMutexInit(&pTaskDb->mutex, NULL);
|
(void)taosThreadMutexInit(&pTaskDb->mutex, NULL);
|
||||||
taskDbInitChkpOpt(pTaskDb);
|
taskDbInitChkpOpt(pTaskDb);
|
||||||
taskDbInitOpt(pTaskDb);
|
taskDbInitOpt(pTaskDb);
|
||||||
|
|
||||||
|
@ -2650,7 +2658,7 @@ int32_t taskDbGenChkpUploadData__rsync(STaskDbWrapper* pDb, int64_t chkpId, char
|
||||||
|
|
||||||
char* buf = taosMemoryCalloc(1, cap);
|
char* buf = taosMemoryCalloc(1, cap);
|
||||||
if (buf == NULL) {
|
if (buf == NULL) {
|
||||||
taosReleaseRef(taskDbWrapperId, refId);
|
(void)taosReleaseRef(taskDbWrapperId, refId);
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2658,7 +2666,7 @@ int32_t taskDbGenChkpUploadData__rsync(STaskDbWrapper* pDb, int64_t chkpId, char
|
||||||
snprintf(buf, cap, "%s%s%s%s%s%" PRId64 "", pDb->path, TD_DIRSEP, "checkpoints", TD_DIRSEP, "checkpoint", chkpId);
|
snprintf(buf, cap, "%s%s%s%s%s%" PRId64 "", pDb->path, TD_DIRSEP, "checkpoints", TD_DIRSEP, "checkpoint", chkpId);
|
||||||
if (nBytes <= 0 || nBytes >= cap) {
|
if (nBytes <= 0 || nBytes >= cap) {
|
||||||
taosMemoryFree(buf);
|
taosMemoryFree(buf);
|
||||||
taosReleaseRef(taskDbWrapperId, refId);
|
(void)taosReleaseRef(taskDbWrapperId, refId);
|
||||||
return TSDB_CODE_OUT_OF_RANGE;
|
return TSDB_CODE_OUT_OF_RANGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2669,7 +2677,7 @@ int32_t taskDbGenChkpUploadData__rsync(STaskDbWrapper* pDb, int64_t chkpId, char
|
||||||
taosMemoryFree(buf);
|
taosMemoryFree(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
taosReleaseRef(taskDbWrapperId, refId);
|
(void)taosReleaseRef(taskDbWrapperId, refId);
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2906,7 +2914,7 @@ int32_t streamStateOpenBackendCf(void* backend, char* name, char** cfs, int32_t
|
||||||
|
|
||||||
inst->dbOpt = handle->dbOpt;
|
inst->dbOpt = handle->dbOpt;
|
||||||
rocksdb_writeoptions_disable_WAL(inst->wOpt, 1);
|
rocksdb_writeoptions_disable_WAL(inst->wOpt, 1);
|
||||||
taosHashPut(handle->cfInst, idstr, strlen(idstr) + 1, &inst, sizeof(void*));
|
(void)taosHashPut(handle->cfInst, idstr, strlen(idstr) + 1, &inst, sizeof(void*));
|
||||||
} else {
|
} else {
|
||||||
inst = *pInst;
|
inst = *pInst;
|
||||||
}
|
}
|
||||||
|
@ -3146,9 +3154,9 @@ rocksdb_iterator_t* streamStateIterCreate(SStreamState* pState, const char* cfKe
|
||||||
break; \
|
break; \
|
||||||
} \
|
} \
|
||||||
STaskDbWrapper* wrapper = pState->pTdbState->pOwner->pBackend; \
|
STaskDbWrapper* wrapper = pState->pTdbState->pOwner->pBackend; \
|
||||||
atomic_add_fetch_64(&wrapper->dataWritten, 1); \
|
(void)atomic_add_fetch_64(&wrapper->dataWritten, 1); \
|
||||||
char toString[128] = {0}; \
|
char toString[128] = {0}; \
|
||||||
if (stDebugFlag & DEBUG_TRACE) ginitDict[i].toStrFunc((void*)key, toString); \
|
if (stDebugFlag & DEBUG_TRACE) (void)(ginitDict[i].toStrFunc((void*)key, toString)); \
|
||||||
int32_t klen = ginitDict[i].enFunc((void*)key, buf); \
|
int32_t klen = ginitDict[i].enFunc((void*)key, buf); \
|
||||||
rocksdb_column_family_handle_t* pHandle = ((rocksdb_column_family_handle_t**)wrapper->pCf)[ginitDict[i].idx]; \
|
rocksdb_column_family_handle_t* pHandle = ((rocksdb_column_family_handle_t**)wrapper->pCf)[ginitDict[i].idx]; \
|
||||||
rocksdb_writeoptions_t* opts = wrapper->writeOpt; \
|
rocksdb_writeoptions_t* opts = wrapper->writeOpt; \
|
||||||
|
@ -3180,7 +3188,7 @@ rocksdb_iterator_t* streamStateIterCreate(SStreamState* pState, const char* cfKe
|
||||||
} \
|
} \
|
||||||
STaskDbWrapper* wrapper = pState->pTdbState->pOwner->pBackend; \
|
STaskDbWrapper* wrapper = pState->pTdbState->pOwner->pBackend; \
|
||||||
char toString[128] = {0}; \
|
char toString[128] = {0}; \
|
||||||
if (stDebugFlag & DEBUG_TRACE) ginitDict[i].toStrFunc((void*)key, toString); \
|
if (stDebugFlag & DEBUG_TRACE) (void)(ginitDict[i].toStrFunc((void*)key, toString)); \
|
||||||
int32_t klen = ginitDict[i].enFunc((void*)key, buf); \
|
int32_t klen = ginitDict[i].enFunc((void*)key, buf); \
|
||||||
rocksdb_column_family_handle_t* pHandle = ((rocksdb_column_family_handle_t**)wrapper->pCf)[ginitDict[i].idx]; \
|
rocksdb_column_family_handle_t* pHandle = ((rocksdb_column_family_handle_t**)wrapper->pCf)[ginitDict[i].idx]; \
|
||||||
rocksdb_t* db = wrapper->db; \
|
rocksdb_t* db = wrapper->db; \
|
||||||
|
@ -3223,9 +3231,9 @@ rocksdb_iterator_t* streamStateIterCreate(SStreamState* pState, const char* cfKe
|
||||||
break; \
|
break; \
|
||||||
} \
|
} \
|
||||||
STaskDbWrapper* wrapper = pState->pTdbState->pOwner->pBackend; \
|
STaskDbWrapper* wrapper = pState->pTdbState->pOwner->pBackend; \
|
||||||
atomic_add_fetch_64(&wrapper->dataWritten, 1); \
|
(void)atomic_add_fetch_64(&wrapper->dataWritten, 1); \
|
||||||
char toString[128] = {0}; \
|
char toString[128] = {0}; \
|
||||||
if (stDebugFlag & DEBUG_TRACE) ginitDict[i].toStrFunc((void*)key, toString); \
|
if (stDebugFlag & DEBUG_TRACE) (void)(ginitDict[i].toStrFunc((void*)key, toString)); \
|
||||||
int32_t klen = ginitDict[i].enFunc((void*)key, buf); \
|
int32_t klen = ginitDict[i].enFunc((void*)key, buf); \
|
||||||
rocksdb_column_family_handle_t* pHandle = ((rocksdb_column_family_handle_t**)wrapper->pCf)[ginitDict[i].idx]; \
|
rocksdb_column_family_handle_t* pHandle = ((rocksdb_column_family_handle_t**)wrapper->pCf)[ginitDict[i].idx]; \
|
||||||
rocksdb_t* db = wrapper->db; \
|
rocksdb_t* db = wrapper->db; \
|
||||||
|
@ -3264,7 +3272,7 @@ int32_t streamStateClear_rocksdb(SStreamState* pState) {
|
||||||
stDebug("streamStateClear_rocksdb");
|
stDebug("streamStateClear_rocksdb");
|
||||||
|
|
||||||
STaskDbWrapper* wrapper = pState->pTdbState->pOwner->pBackend;
|
STaskDbWrapper* wrapper = pState->pTdbState->pOwner->pBackend;
|
||||||
atomic_add_fetch_64(&wrapper->dataWritten, 1);
|
(void)atomic_add_fetch_64(&wrapper->dataWritten, 1);
|
||||||
|
|
||||||
char sKeyStr[128] = {0};
|
char sKeyStr[128] = {0};
|
||||||
char eKeyStr[128] = {0};
|
char eKeyStr[128] = {0};
|
||||||
|
@ -3280,8 +3288,8 @@ int32_t streamStateClear_rocksdb(SStreamState* pState) {
|
||||||
if (err != NULL) {
|
if (err != NULL) {
|
||||||
char toStringStart[128] = {0};
|
char toStringStart[128] = {0};
|
||||||
char toStringEnd[128] = {0};
|
char toStringEnd[128] = {0};
|
||||||
stateKeyToString(&sKey, toStringStart);
|
(void)stateKeyToString(&sKey, toStringStart);
|
||||||
stateKeyToString(&eKey, toStringEnd);
|
(void)stateKeyToString(&eKey, toStringEnd);
|
||||||
|
|
||||||
stWarn("failed to delete range cf(state) start: %s, end:%s, reason:%s", toStringStart, toStringEnd, err);
|
stWarn("failed to delete range cf(state) start: %s, end:%s, reason:%s", toStringStart, toStringEnd, err);
|
||||||
taosMemoryFree(err);
|
taosMemoryFree(err);
|
||||||
|
@ -3298,15 +3306,21 @@ void streamStateCurNext_rocksdb(SStreamStateCur* pCur) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int32_t streamStateGetFirst_rocksdb(SStreamState* pState, SWinKey* key) {
|
int32_t streamStateGetFirst_rocksdb(SStreamState* pState, SWinKey* key) {
|
||||||
|
int code = 0;
|
||||||
stDebug("streamStateGetFirst_rocksdb");
|
stDebug("streamStateGetFirst_rocksdb");
|
||||||
SWinKey tmp = {.ts = 0, .groupId = 0};
|
SWinKey tmp = {.ts = 0, .groupId = 0};
|
||||||
streamStatePut_rocksdb(pState, &tmp, NULL, 0);
|
code = streamStatePut_rocksdb(pState, &tmp, NULL, 0);
|
||||||
|
if (code != 0) {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
SStreamStateCur* pCur = streamStateSeekKeyNext_rocksdb(pState, &tmp);
|
SStreamStateCur* pCur = streamStateSeekKeyNext_rocksdb(pState, &tmp);
|
||||||
int32_t code = streamStateGetKVByCur_rocksdb(pCur, key, NULL, 0);
|
code = streamStateGetKVByCur_rocksdb(pCur, key, NULL, 0);
|
||||||
|
if (code != 0) {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
streamStateFreeCur(pCur);
|
streamStateFreeCur(pCur);
|
||||||
streamStateDel_rocksdb(pState, &tmp);
|
return streamStateDel_rocksdb(pState, &tmp);
|
||||||
return code;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t streamStateGetGroupKVByCur_rocksdb(SStreamStateCur* pCur, SWinKey* pKey, const void** pVal, int32_t* pVLen) {
|
int32_t streamStateGetGroupKVByCur_rocksdb(SStreamStateCur* pCur, SWinKey* pKey, const void** pVal, int32_t* pVLen) {
|
||||||
|
@ -3335,6 +3349,9 @@ int32_t streamStateAddIfNotExist_rocksdb(SStreamState* pState, const SWinKey* ke
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
*pVal = taosMemoryMalloc(size);
|
*pVal = taosMemoryMalloc(size);
|
||||||
|
if (*pVal == NULL) {
|
||||||
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
}
|
||||||
memset(*pVal, 0, size);
|
memset(*pVal, 0, size);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -3351,7 +3368,7 @@ int32_t streamStateGetKVByCur_rocksdb(SStreamStateCur* pCur, SWinKey* pKey, cons
|
||||||
if (rocksdb_iter_valid(pCur->iter) && !iterValueIsStale(pCur->iter)) {
|
if (rocksdb_iter_valid(pCur->iter) && !iterValueIsStale(pCur->iter)) {
|
||||||
size_t tlen;
|
size_t tlen;
|
||||||
char* keyStr = (char*)rocksdb_iter_key(pCur->iter, &tlen);
|
char* keyStr = (char*)rocksdb_iter_key(pCur->iter, &tlen);
|
||||||
stateKeyDecode((void*)pKtmp, keyStr);
|
(void)stateKeyDecode((void*)pKtmp, keyStr);
|
||||||
if (pKtmp->opNum != pCur->number) {
|
if (pKtmp->opNum != pCur->number) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -3404,7 +3421,7 @@ SStreamStateCur* streamStateSeekKeyNext_rocksdb(SStreamState* pState, const SWin
|
||||||
SStateKey curKey;
|
SStateKey curKey;
|
||||||
size_t kLen;
|
size_t kLen;
|
||||||
char* keyStr = (char*)rocksdb_iter_key(pCur->iter, &kLen);
|
char* keyStr = (char*)rocksdb_iter_key(pCur->iter, &kLen);
|
||||||
stateKeyDecode((void*)&curKey, keyStr);
|
(void)stateKeyDecode((void*)&curKey, keyStr);
|
||||||
if (stateKeyCmpr(&sKey, sizeof(sKey), &curKey, sizeof(curKey)) > 0) {
|
if (stateKeyCmpr(&sKey, sizeof(sKey), &curKey, sizeof(curKey)) > 0) {
|
||||||
return pCur;
|
return pCur;
|
||||||
}
|
}
|
||||||
|
@ -3426,7 +3443,7 @@ SStreamStateCur* streamStateSeekToLast_rocksdb(SStreamState* pState) {
|
||||||
|
|
||||||
{
|
{
|
||||||
char tbuf[256] = {0};
|
char tbuf[256] = {0};
|
||||||
stateKeyToString((void*)&maxStateKey, tbuf);
|
(void)stateKeyToString((void*)&maxStateKey, tbuf);
|
||||||
stDebug("seek to last:%s", tbuf);
|
stDebug("seek to last:%s", tbuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3476,7 +3493,7 @@ SStreamStateCur* streamStateGetCur_rocksdb(SStreamState* pState, const SWinKey*
|
||||||
SStateKey curKey;
|
SStateKey curKey;
|
||||||
size_t kLen = 0;
|
size_t kLen = 0;
|
||||||
char* keyStr = (char*)rocksdb_iter_key(pCur->iter, &kLen);
|
char* keyStr = (char*)rocksdb_iter_key(pCur->iter, &kLen);
|
||||||
stateKeyDecode((void*)&curKey, keyStr);
|
(void)stateKeyDecode((void*)&curKey, keyStr);
|
||||||
|
|
||||||
if (stateKeyCmpr(&sKey, sizeof(sKey), &curKey, sizeof(curKey)) == 0) {
|
if (stateKeyCmpr(&sKey, sizeof(sKey), &curKey, sizeof(curKey)) == 0) {
|
||||||
pCur->number = pState->number;
|
pCur->number = pState->number;
|
||||||
|
@ -3624,7 +3641,7 @@ SStreamStateCur* streamStateSessionSeekKeyCurrentPrev_rocksdb(SStreamState* pSta
|
||||||
size_t klen;
|
size_t klen;
|
||||||
const char* iKey = rocksdb_iter_key(pCur->iter, &klen);
|
const char* iKey = rocksdb_iter_key(pCur->iter, &klen);
|
||||||
SStateSessionKey curKey = {0};
|
SStateSessionKey curKey = {0};
|
||||||
stateSessionKeyDecode(&curKey, (char*)iKey);
|
(void)stateSessionKeyDecode(&curKey, (char*)iKey);
|
||||||
if (stateSessionKeyCmpr(&sKey, sizeof(sKey), &curKey, sizeof(curKey)) >= 0) return pCur;
|
if (stateSessionKeyCmpr(&sKey, sizeof(sKey), &curKey, sizeof(curKey)) >= 0) return pCur;
|
||||||
|
|
||||||
rocksdb_iter_prev(pCur->iter);
|
rocksdb_iter_prev(pCur->iter);
|
||||||
|
@ -3661,7 +3678,7 @@ SStreamStateCur* streamStateSessionSeekKeyCurrentNext_rocksdb(SStreamState* pSta
|
||||||
size_t klen;
|
size_t klen;
|
||||||
const char* iKey = rocksdb_iter_key(pCur->iter, &klen);
|
const char* iKey = rocksdb_iter_key(pCur->iter, &klen);
|
||||||
SStateSessionKey curKey = {0};
|
SStateSessionKey curKey = {0};
|
||||||
stateSessionKeyDecode(&curKey, (char*)iKey);
|
(void)stateSessionKeyDecode(&curKey, (char*)iKey);
|
||||||
if (stateSessionKeyCmpr(&sKey, sizeof(sKey), &curKey, sizeof(curKey)) <= 0) return pCur;
|
if (stateSessionKeyCmpr(&sKey, sizeof(sKey), &curKey, sizeof(curKey)) <= 0) return pCur;
|
||||||
|
|
||||||
rocksdb_iter_next(pCur->iter);
|
rocksdb_iter_next(pCur->iter);
|
||||||
|
@ -3701,7 +3718,7 @@ SStreamStateCur* streamStateSessionSeekKeyNext_rocksdb(SStreamState* pState, con
|
||||||
size_t klen;
|
size_t klen;
|
||||||
const char* iKey = rocksdb_iter_key(pCur->iter, &klen);
|
const char* iKey = rocksdb_iter_key(pCur->iter, &klen);
|
||||||
SStateSessionKey curKey = {0};
|
SStateSessionKey curKey = {0};
|
||||||
stateSessionKeyDecode(&curKey, (char*)iKey);
|
(void)stateSessionKeyDecode(&curKey, (char*)iKey);
|
||||||
if (stateSessionKeyCmpr(&sKey, sizeof(sKey), &curKey, sizeof(curKey)) < 0) return pCur;
|
if (stateSessionKeyCmpr(&sKey, sizeof(sKey), &curKey, sizeof(curKey)) < 0) return pCur;
|
||||||
|
|
||||||
rocksdb_iter_next(pCur->iter);
|
rocksdb_iter_next(pCur->iter);
|
||||||
|
@ -3741,7 +3758,7 @@ SStreamStateCur* streamStateSessionSeekKeyPrev_rocksdb(SStreamState* pState, con
|
||||||
size_t klen;
|
size_t klen;
|
||||||
const char* iKey = rocksdb_iter_key(pCur->iter, &klen);
|
const char* iKey = rocksdb_iter_key(pCur->iter, &klen);
|
||||||
SStateSessionKey curKey = {0};
|
SStateSessionKey curKey = {0};
|
||||||
stateSessionKeyDecode(&curKey, (char*)iKey);
|
(void)stateSessionKeyDecode(&curKey, (char*)iKey);
|
||||||
if (stateSessionKeyCmpr(&sKey, sizeof(sKey), &curKey, sizeof(curKey)) > 0) return pCur;
|
if (stateSessionKeyCmpr(&sKey, sizeof(sKey), &curKey, sizeof(curKey)) > 0) return pCur;
|
||||||
|
|
||||||
rocksdb_iter_prev(pCur->iter);
|
rocksdb_iter_prev(pCur->iter);
|
||||||
|
@ -3764,7 +3781,7 @@ int32_t streamStateSessionGetKVByCur_rocksdb(SStreamStateCur* pCur, SSessionKey*
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
const char* curKey = rocksdb_iter_key(pCur->iter, (size_t*)&kLen);
|
const char* curKey = rocksdb_iter_key(pCur->iter, (size_t*)&kLen);
|
||||||
stateSessionKeyDecode((void*)&ktmp, (char*)curKey);
|
(void)stateSessionKeyDecode((void*)&ktmp, (char*)curKey);
|
||||||
|
|
||||||
if (pVal != NULL) *pVal = NULL;
|
if (pVal != NULL) *pVal = NULL;
|
||||||
if (pVLen != NULL) *pVLen = 0;
|
if (pVLen != NULL) *pVLen = 0;
|
||||||
|
@ -3843,7 +3860,7 @@ SStreamStateCur* streamStateFillGetCur_rocksdb(SStreamState* pState, const SWinK
|
||||||
size_t kLen;
|
size_t kLen;
|
||||||
SWinKey curKey;
|
SWinKey curKey;
|
||||||
char* keyStr = (char*)rocksdb_iter_key(pCur->iter, &kLen);
|
char* keyStr = (char*)rocksdb_iter_key(pCur->iter, &kLen);
|
||||||
winKeyDecode((void*)&curKey, keyStr);
|
(void)winKeyDecode((void*)&curKey, keyStr);
|
||||||
if (winKeyCmpr(key, sizeof(*key), &curKey, sizeof(curKey)) == 0) {
|
if (winKeyCmpr(key, sizeof(*key), &curKey, sizeof(curKey)) == 0) {
|
||||||
return pCur;
|
return pCur;
|
||||||
}
|
}
|
||||||
|
@ -3863,7 +3880,7 @@ int32_t streamStateFillGetKVByCur_rocksdb(SStreamStateCur* pCur, SWinKey* pKey,
|
||||||
}
|
}
|
||||||
size_t klen, vlen;
|
size_t klen, vlen;
|
||||||
char* keyStr = (char*)rocksdb_iter_key(pCur->iter, &klen);
|
char* keyStr = (char*)rocksdb_iter_key(pCur->iter, &klen);
|
||||||
winKeyDecode(&winKey, keyStr);
|
(void)winKeyDecode(&winKey, keyStr);
|
||||||
|
|
||||||
const char* valStr = rocksdb_iter_value(pCur->iter, &vlen);
|
const char* valStr = rocksdb_iter_value(pCur->iter, &vlen);
|
||||||
int32_t len = valueDecode((void*)valStr, vlen, NULL, (char**)pVal);
|
int32_t len = valueDecode((void*)valStr, vlen, NULL, (char**)pVal);
|
||||||
|
@ -3904,7 +3921,7 @@ SStreamStateCur* streamStateFillSeekKeyNext_rocksdb(SStreamState* pState, const
|
||||||
SWinKey curKey;
|
SWinKey curKey;
|
||||||
size_t kLen = 0;
|
size_t kLen = 0;
|
||||||
char* keyStr = (char*)rocksdb_iter_key(pCur->iter, &kLen);
|
char* keyStr = (char*)rocksdb_iter_key(pCur->iter, &kLen);
|
||||||
winKeyDecode((void*)&curKey, keyStr);
|
(void)winKeyDecode((void*)&curKey, keyStr);
|
||||||
if (winKeyCmpr(key, sizeof(*key), &curKey, sizeof(curKey)) < 0) {
|
if (winKeyCmpr(key, sizeof(*key), &curKey, sizeof(curKey)) < 0) {
|
||||||
return pCur;
|
return pCur;
|
||||||
}
|
}
|
||||||
|
@ -3941,7 +3958,7 @@ SStreamStateCur* streamStateFillSeekKeyPrev_rocksdb(SStreamState* pState, const
|
||||||
SWinKey curKey;
|
SWinKey curKey;
|
||||||
size_t kLen = 0;
|
size_t kLen = 0;
|
||||||
char* keyStr = (char*)rocksdb_iter_key(pCur->iter, &kLen);
|
char* keyStr = (char*)rocksdb_iter_key(pCur->iter, &kLen);
|
||||||
winKeyDecode((void*)&curKey, keyStr);
|
(void)winKeyDecode((void*)&curKey, keyStr);
|
||||||
if (winKeyCmpr(key, sizeof(*key), &curKey, sizeof(curKey)) > 0) {
|
if (winKeyCmpr(key, sizeof(*key), &curKey, sizeof(curKey)) > 0) {
|
||||||
return pCur;
|
return pCur;
|
||||||
}
|
}
|
||||||
|
@ -4024,11 +4041,12 @@ int32_t streamStateSessionAddIfNotExist_rocksdb(SStreamState* pState, SSessionKe
|
||||||
int32_t valSize = *pVLen;
|
int32_t valSize = *pVLen;
|
||||||
|
|
||||||
void* tmp = taosMemoryMalloc(valSize);
|
void* tmp = taosMemoryMalloc(valSize);
|
||||||
|
if (tmp == NULL) {
|
||||||
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
}
|
||||||
|
|
||||||
SStreamStateCur* pCur = streamStateSessionSeekKeyCurrentPrev_rocksdb(pState, key);
|
SStreamStateCur* pCur = streamStateSessionSeekKeyCurrentPrev_rocksdb(pState, key);
|
||||||
if (pCur == NULL) {
|
int32_t code = streamStateSessionGetKVByCur_rocksdb(pCur, key, pVal, pVLen);
|
||||||
}
|
|
||||||
int32_t code = streamStateSessionGetKVByCur_rocksdb(pCur, key, pVal, pVLen);
|
|
||||||
|
|
||||||
if (code == 0) {
|
if (code == 0) {
|
||||||
if (sessionRangeKeyCmpr(&searchKey, key) == 0) {
|
if (sessionRangeKeyCmpr(&searchKey, key) == 0) {
|
||||||
|
@ -4076,7 +4094,7 @@ void streamStateSessionClear_rocksdb(SStreamState* pState) {
|
||||||
if (code == 0 && size > 0) {
|
if (code == 0 && size > 0) {
|
||||||
memset(buf, 0, size);
|
memset(buf, 0, size);
|
||||||
// refactor later
|
// refactor later
|
||||||
streamStateSessionPut_rocksdb(pState, &delKey, buf, size);
|
(void)streamStateSessionPut_rocksdb(pState, &delKey, buf, size);
|
||||||
} else {
|
} else {
|
||||||
taosMemoryFreeClear(buf);
|
taosMemoryFreeClear(buf);
|
||||||
break;
|
break;
|
||||||
|
@ -4214,7 +4232,7 @@ int32_t streamDefaultIterGet_rocksdb(SStreamState* pState, const void* start, co
|
||||||
if (strncmp(key, start, strlen(start)) == 0 && strlen(key) >= strlen(start) + 1) {
|
if (strncmp(key, start, strlen(start)) == 0 && strlen(key) >= strlen(start) + 1) {
|
||||||
int64_t checkPoint = 0;
|
int64_t checkPoint = 0;
|
||||||
if (sscanf(key + strlen(key), ":%" PRId64 "", &checkPoint) == 1) {
|
if (sscanf(key + strlen(key), ":%" PRId64 "", &checkPoint) == 1) {
|
||||||
taosArrayPush(result, &checkPoint);
|
(void)taosArrayPush(result, &checkPoint);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
break;
|
break;
|
||||||
|
@ -4286,7 +4304,7 @@ void streamStateDestroyBatch(void* pBatch) { rocksdb_writebatch_destroy((rock
|
||||||
int32_t streamStatePutBatch(SStreamState* pState, const char* cfKeyName, rocksdb_writebatch_t* pBatch, void* key,
|
int32_t streamStatePutBatch(SStreamState* pState, const char* cfKeyName, rocksdb_writebatch_t* pBatch, void* key,
|
||||||
void* val, int32_t vlen, int64_t ttl) {
|
void* val, int32_t vlen, int64_t ttl) {
|
||||||
STaskDbWrapper* wrapper = pState->pTdbState->pOwner->pBackend;
|
STaskDbWrapper* wrapper = pState->pTdbState->pOwner->pBackend;
|
||||||
atomic_add_fetch_64(&wrapper->dataWritten, 1);
|
(void)atomic_add_fetch_64(&wrapper->dataWritten, 1);
|
||||||
|
|
||||||
int i = streamStateGetCfIdx(pState, cfKeyName);
|
int i = streamStateGetCfIdx(pState, cfKeyName);
|
||||||
if (i < 0) {
|
if (i < 0) {
|
||||||
|
@ -4306,7 +4324,7 @@ int32_t streamStatePutBatch(SStreamState* pState, const char* cfKeyName, rocksdb
|
||||||
|
|
||||||
{
|
{
|
||||||
char tbuf[256] = {0};
|
char tbuf[256] = {0};
|
||||||
ginitDict[i].toStrFunc((void*)key, tbuf);
|
(void)(ginitDict[i].toStrFunc((void*)key, tbuf));
|
||||||
stTrace("streamState str: %s succ to write to %s_%s, len: %d", tbuf, wrapper->idstr, ginitDict[i].key, vlen);
|
stTrace("streamState str: %s succ to write to %s_%s, len: %d", tbuf, wrapper->idstr, ginitDict[i].key, vlen);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -4321,7 +4339,7 @@ int32_t streamStatePutBatchOptimize(SStreamState* pState, int32_t cfIdx, rocksdb
|
||||||
|
|
||||||
STaskDbWrapper* wrapper = pState->pTdbState->pOwner->pBackend;
|
STaskDbWrapper* wrapper = pState->pTdbState->pOwner->pBackend;
|
||||||
|
|
||||||
atomic_add_fetch_64(&wrapper->dataWritten, 1);
|
(void)atomic_add_fetch_64(&wrapper->dataWritten, 1);
|
||||||
|
|
||||||
rocksdb_column_family_handle_t* pCf = wrapper->pCf[ginitDict[cfIdx].idx];
|
rocksdb_column_family_handle_t* pCf = wrapper->pCf[ginitDict[cfIdx].idx];
|
||||||
rocksdb_writebatch_put_cf((rocksdb_writebatch_t*)pBatch, pCf, buf, (size_t)klen, ttlV, (size_t)ttlVLen);
|
rocksdb_writebatch_put_cf((rocksdb_writebatch_t*)pBatch, pCf, buf, (size_t)klen, ttlV, (size_t)ttlVLen);
|
||||||
|
@ -4332,7 +4350,7 @@ int32_t streamStatePutBatchOptimize(SStreamState* pState, int32_t cfIdx, rocksdb
|
||||||
|
|
||||||
{
|
{
|
||||||
char tbuf[256] = {0};
|
char tbuf[256] = {0};
|
||||||
ginitDict[cfIdx].toStrFunc((void*)key, tbuf);
|
(void)(ginitDict[cfIdx].toStrFunc((void*)key, tbuf));
|
||||||
stTrace("streamState str: %s succ to write to %s_%s", tbuf, wrapper->idstr, ginitDict[cfIdx].key);
|
stTrace("streamState str: %s succ to write to %s_%s", tbuf, wrapper->idstr, ginitDict[cfIdx].key);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -4340,7 +4358,7 @@ int32_t streamStatePutBatchOptimize(SStreamState* pState, int32_t cfIdx, rocksdb
|
||||||
int32_t streamStatePutBatch_rocksdb(SStreamState* pState, void* pBatch) {
|
int32_t streamStatePutBatch_rocksdb(SStreamState* pState, void* pBatch) {
|
||||||
char* err = NULL;
|
char* err = NULL;
|
||||||
STaskDbWrapper* wrapper = pState->pTdbState->pOwner->pBackend;
|
STaskDbWrapper* wrapper = pState->pTdbState->pOwner->pBackend;
|
||||||
atomic_add_fetch_64(&wrapper->dataWritten, 1);
|
(void)atomic_add_fetch_64(&wrapper->dataWritten, 1);
|
||||||
rocksdb_write(wrapper->db, wrapper->writeOpt, (rocksdb_writebatch_t*)pBatch, &err);
|
rocksdb_write(wrapper->db, wrapper->writeOpt, (rocksdb_writebatch_t*)pBatch, &err);
|
||||||
if (err != NULL) {
|
if (err != NULL) {
|
||||||
stError("streamState failed to write batch, err:%s", err);
|
stError("streamState failed to write batch, err:%s", err);
|
||||||
|
@ -4429,8 +4447,8 @@ int32_t compareHashTableImpl(SHashObj* p1, SHashObj* p2, SArray* diff) {
|
||||||
if (fname == NULL) {
|
if (fname == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
strncpy(fname, name, len);
|
(void)strncpy(fname, name, len);
|
||||||
taosArrayPush(diff, &fname);
|
(void)taosArrayPush(diff, &fname);
|
||||||
}
|
}
|
||||||
pIter = taosHashIterate(p2, pIter);
|
pIter = taosHashIterate(p2, pIter);
|
||||||
}
|
}
|
||||||
|
@ -4506,7 +4524,7 @@ void dbChkpDebugInfo(SDbChkp* pDb) {
|
||||||
int32_t dbChkpGetDelta(SDbChkp* p, int64_t chkpId, SArray* list) {
|
int32_t dbChkpGetDelta(SDbChkp* p, int64_t chkpId, SArray* list) {
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
int32_t nBytes;
|
int32_t nBytes;
|
||||||
taosThreadRwlockWrlock(&p->rwLock);
|
(void)taosThreadRwlockWrlock(&p->rwLock);
|
||||||
|
|
||||||
p->preCkptId = p->curChkpId;
|
p->preCkptId = p->curChkpId;
|
||||||
p->curChkpId = chkpId;
|
p->curChkpId = chkpId;
|
||||||
|
@ -4524,7 +4542,7 @@ int32_t dbChkpGetDelta(SDbChkp* p, int64_t chkpId, SArray* list) {
|
||||||
nBytes =
|
nBytes =
|
||||||
snprintf(p->buf, p->len, "%s%s%s%scheckpoint%" PRId64 "", p->path, TD_DIRSEP, "checkpoints", TD_DIRSEP, chkpId);
|
snprintf(p->buf, p->len, "%s%s%s%scheckpoint%" PRId64 "", p->path, TD_DIRSEP, "checkpoints", TD_DIRSEP, chkpId);
|
||||||
if (nBytes <= 0 || nBytes >= p->len) {
|
if (nBytes <= 0 || nBytes >= p->len) {
|
||||||
taosThreadRwlockUnlock(&p->rwLock);
|
(void)taosThreadRwlockUnlock(&p->rwLock);
|
||||||
return TSDB_CODE_OUT_OF_RANGE;
|
return TSDB_CODE_OUT_OF_RANGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4534,7 +4552,7 @@ int32_t dbChkpGetDelta(SDbChkp* p, int64_t chkpId, SArray* list) {
|
||||||
|
|
||||||
TdDirPtr pDir = taosOpenDir(p->buf);
|
TdDirPtr pDir = taosOpenDir(p->buf);
|
||||||
if (pDir == NULL) {
|
if (pDir == NULL) {
|
||||||
taosThreadRwlockUnlock(&p->rwLock);
|
(void)taosThreadRwlockUnlock(&p->rwLock);
|
||||||
return TAOS_SYSTEM_ERROR(errno);
|
return TAOS_SYSTEM_ERROR(errno);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4570,9 +4588,9 @@ int32_t dbChkpGetDelta(SDbChkp* p, int64_t chkpId, SArray* list) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
taosCloseDir(&pDir);
|
(void)taosCloseDir(&pDir);
|
||||||
if (code != 0) {
|
if (code != 0) {
|
||||||
taosThreadRwlockUnlock(&p->rwLock);
|
(void)taosThreadRwlockUnlock(&p->rwLock);
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4584,12 +4602,12 @@ int32_t dbChkpGetDelta(SDbChkp* p, int64_t chkpId, SArray* list) {
|
||||||
if (name != NULL && !isBkdDataMeta(name, len)) {
|
if (name != NULL && !isBkdDataMeta(name, len)) {
|
||||||
char* fname = taosMemoryCalloc(1, len + 1);
|
char* fname = taosMemoryCalloc(1, len + 1);
|
||||||
if (fname == NULL) {
|
if (fname == NULL) {
|
||||||
taosThreadRwlockUnlock(&p->rwLock);
|
(void)taosThreadRwlockUnlock(&p->rwLock);
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
strncpy(fname, name, len);
|
(void)strncpy(fname, name, len);
|
||||||
taosArrayPush(p->pAdd, &fname);
|
(void)taosArrayPush(p->pAdd, &fname);
|
||||||
}
|
}
|
||||||
pIter = taosHashIterate(p->pSstTbl[1 - p->idx], pIter);
|
pIter = taosHashIterate(p->pSstTbl[1 - p->idx], pIter);
|
||||||
}
|
}
|
||||||
|
@ -4621,7 +4639,7 @@ int32_t dbChkpGetDelta(SDbChkp* p, int64_t chkpId, SArray* list) {
|
||||||
|
|
||||||
p->idx = 1 - p->idx;
|
p->idx = 1 - p->idx;
|
||||||
|
|
||||||
taosThreadRwlockUnlock(&p->rwLock);
|
(void)taosThreadRwlockUnlock(&p->rwLock);
|
||||||
|
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
@ -4679,7 +4697,7 @@ int32_t dbChkpCreate(char* path, int64_t initChkpId, SDbChkp** ppChkp) {
|
||||||
}
|
}
|
||||||
|
|
||||||
p->update = 0;
|
p->update = 0;
|
||||||
taosThreadRwlockInit(&p->rwLock, NULL);
|
(void)taosThreadRwlockInit(&p->rwLock, NULL);
|
||||||
|
|
||||||
SArray* list = NULL;
|
SArray* list = NULL;
|
||||||
code = dbChkpGetDelta(p, initChkpId, list);
|
code = dbChkpGetDelta(p, initChkpId, list);
|
||||||
|
@ -4720,7 +4738,7 @@ int32_t dbChkpDumpTo(SDbChkp* p, char* dname, SArray* list) {
|
||||||
static char* chkpMeta = "META";
|
static char* chkpMeta = "META";
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
|
|
||||||
taosThreadRwlockRdlock(&p->rwLock);
|
(void)taosThreadRwlockRdlock(&p->rwLock);
|
||||||
|
|
||||||
int32_t cap = p->len + 128;
|
int32_t cap = p->len + 128;
|
||||||
|
|
||||||
|
@ -4793,7 +4811,7 @@ int32_t dbChkpDumpTo(SDbChkp* p, char* dname, SArray* list) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
goto _ERROR;
|
goto _ERROR;
|
||||||
}
|
}
|
||||||
taosArrayPush(list, &p);
|
(void)taosArrayPush(list, &p);
|
||||||
}
|
}
|
||||||
|
|
||||||
// copy current file to dst dir
|
// copy current file to dst dir
|
||||||
|
@ -4859,7 +4877,7 @@ int32_t dbChkpDumpTo(SDbChkp* p, char* dname, SArray* list) {
|
||||||
if (nBytes <= 0 || nBytes >= sizeof(content)) {
|
if (nBytes <= 0 || nBytes >= sizeof(content)) {
|
||||||
code = TSDB_CODE_OUT_OF_RANGE;
|
code = TSDB_CODE_OUT_OF_RANGE;
|
||||||
stError("chkp failed to format meta file: %s, reason: invalid msg", dstDir);
|
stError("chkp failed to format meta file: %s, reason: invalid msg", dstDir);
|
||||||
taosCloseFile(&pFile);
|
(void)taosCloseFile(&pFile);
|
||||||
goto _ERROR;
|
goto _ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4867,10 +4885,10 @@ int32_t dbChkpDumpTo(SDbChkp* p, char* dname, SArray* list) {
|
||||||
if (nBytes != strlen(content)) {
|
if (nBytes != strlen(content)) {
|
||||||
code = TAOS_SYSTEM_ERROR(errno);
|
code = TAOS_SYSTEM_ERROR(errno);
|
||||||
stError("chkp failed to write meta file: %s,reason:%s", dstDir, tstrerror(code));
|
stError("chkp failed to write meta file: %s,reason:%s", dstDir, tstrerror(code));
|
||||||
taosCloseFile(&pFile);
|
(void)taosCloseFile(&pFile);
|
||||||
goto _ERROR;
|
goto _ERROR;
|
||||||
}
|
}
|
||||||
taosCloseFile(&pFile);
|
(void)taosCloseFile(&pFile);
|
||||||
|
|
||||||
// clear delta data buf
|
// clear delta data buf
|
||||||
taosArrayClearP(p->pAdd, taosMemoryFree);
|
taosArrayClearP(p->pAdd, taosMemoryFree);
|
||||||
|
@ -4879,7 +4897,7 @@ int32_t dbChkpDumpTo(SDbChkp* p, char* dname, SArray* list) {
|
||||||
|
|
||||||
_ERROR:
|
_ERROR:
|
||||||
taosMemoryFree(buffer);
|
taosMemoryFree(buffer);
|
||||||
taosThreadRwlockUnlock(&p->rwLock);
|
(void)taosThreadRwlockUnlock(&p->rwLock);
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4925,7 +4943,7 @@ void bkdMgtDestroy(SBkdMgt* bm) {
|
||||||
pIter = taosHashIterate(bm->pDbChkpTbl, pIter);
|
pIter = taosHashIterate(bm->pDbChkpTbl, pIter);
|
||||||
}
|
}
|
||||||
|
|
||||||
taosThreadRwlockDestroy(&bm->rwLock);
|
(void)taosThreadRwlockDestroy(&bm->rwLock);
|
||||||
taosMemoryFree(bm->path);
|
taosMemoryFree(bm->path);
|
||||||
taosHashCleanup(bm->pDbChkpTbl);
|
taosHashCleanup(bm->pDbChkpTbl);
|
||||||
|
|
||||||
|
@ -4933,7 +4951,7 @@ void bkdMgtDestroy(SBkdMgt* bm) {
|
||||||
}
|
}
|
||||||
int32_t bkdMgtGetDelta(SBkdMgt* bm, char* taskId, int64_t chkpId, SArray* list, char* dname) {
|
int32_t bkdMgtGetDelta(SBkdMgt* bm, char* taskId, int64_t chkpId, SArray* list, char* dname) {
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
taosThreadRwlockWrlock(&bm->rwLock);
|
(void)taosThreadRwlockWrlock(&bm->rwLock);
|
||||||
SDbChkp** ppChkp = taosHashGet(bm->pDbChkpTbl, taskId, strlen(taskId));
|
SDbChkp** ppChkp = taosHashGet(bm->pDbChkpTbl, taskId, strlen(taskId));
|
||||||
SDbChkp* pChkp = ppChkp != NULL ? *ppChkp : NULL;
|
SDbChkp* pChkp = ppChkp != NULL ? *ppChkp : NULL;
|
||||||
|
|
||||||
|
@ -4941,14 +4959,14 @@ int32_t bkdMgtGetDelta(SBkdMgt* bm, char* taskId, int64_t chkpId, SArray* list,
|
||||||
int32_t cap = strlen(bm->path) + 64;
|
int32_t cap = strlen(bm->path) + 64;
|
||||||
char* path = taosMemoryCalloc(1, cap);
|
char* path = taosMemoryCalloc(1, cap);
|
||||||
if (path == NULL) {
|
if (path == NULL) {
|
||||||
taosThreadRwlockUnlock(&bm->rwLock);
|
(void)taosThreadRwlockUnlock(&bm->rwLock);
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t nBytes = snprintf(path, cap, "%s%s%s", bm->path, TD_DIRSEP, taskId);
|
int32_t nBytes = snprintf(path, cap, "%s%s%s", bm->path, TD_DIRSEP, taskId);
|
||||||
if (nBytes <= 0 || nBytes >= cap) {
|
if (nBytes <= 0 || nBytes >= cap) {
|
||||||
taosMemoryFree(path);
|
taosMemoryFree(path);
|
||||||
taosThreadRwlockUnlock(&bm->rwLock);
|
(void)taosThreadRwlockUnlock(&bm->rwLock);
|
||||||
code = TSDB_CODE_OUT_OF_RANGE;
|
code = TSDB_CODE_OUT_OF_RANGE;
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
@ -4957,20 +4975,20 @@ int32_t bkdMgtGetDelta(SBkdMgt* bm, char* taskId, int64_t chkpId, SArray* list,
|
||||||
code = dbChkpCreate(path, chkpId, &p);
|
code = dbChkpCreate(path, chkpId, &p);
|
||||||
if (code != 0) {
|
if (code != 0) {
|
||||||
taosMemoryFree(path);
|
taosMemoryFree(path);
|
||||||
taosThreadRwlockUnlock(&bm->rwLock);
|
(void)taosThreadRwlockUnlock(&bm->rwLock);
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (taosHashPut(bm->pDbChkpTbl, taskId, strlen(taskId), &p, sizeof(void*)) != 0) {
|
if (taosHashPut(bm->pDbChkpTbl, taskId, strlen(taskId), &p, sizeof(void*)) != 0) {
|
||||||
dbChkpDestroy(p);
|
dbChkpDestroy(p);
|
||||||
taosThreadRwlockUnlock(&bm->rwLock);
|
(void)taosThreadRwlockUnlock(&bm->rwLock);
|
||||||
code = terrno;
|
code = terrno;
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
pChkp = p;
|
pChkp = p;
|
||||||
code = dbChkpDumpTo(pChkp, dname, list);
|
code = dbChkpDumpTo(pChkp, dname, list);
|
||||||
taosThreadRwlockUnlock(&bm->rwLock);
|
(void)taosThreadRwlockUnlock(&bm->rwLock);
|
||||||
return code;
|
return code;
|
||||||
} else {
|
} else {
|
||||||
code = dbChkpGetDelta(pChkp, chkpId, NULL);
|
code = dbChkpGetDelta(pChkp, chkpId, NULL);
|
||||||
|
@ -4979,7 +4997,7 @@ int32_t bkdMgtGetDelta(SBkdMgt* bm, char* taskId, int64_t chkpId, SArray* list,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
taosThreadRwlockUnlock(&bm->rwLock);
|
(void)taosThreadRwlockUnlock(&bm->rwLock);
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -181,7 +181,7 @@ int32_t syncReconfig(int64_t rid, SSyncCfg* pNewCfg) {
|
||||||
TAOS_RETURN(code);
|
TAOS_RETURN(code);
|
||||||
}
|
}
|
||||||
|
|
||||||
syncNodeUpdateNewConfigIndex(pSyncNode, pNewCfg);
|
TAOS_CHECK_RETURN(syncNodeUpdateNewConfigIndex(pSyncNode, pNewCfg));
|
||||||
syncNodeDoConfigChange(pSyncNode, pNewCfg, pNewCfg->lastIndex);
|
syncNodeDoConfigChange(pSyncNode, pNewCfg, pNewCfg->lastIndex);
|
||||||
|
|
||||||
if (pSyncNode->state == TAOS_SYNC_STATE_LEADER || pSyncNode->state == TAOS_SYNC_STATE_ASSIGNED_LEADER) {
|
if (pSyncNode->state == TAOS_SYNC_STATE_LEADER || pSyncNode->state == TAOS_SYNC_STATE_ASSIGNED_LEADER) {
|
||||||
|
|
|
@ -646,7 +646,7 @@ static SCliConn* getConnFromPool(SCliThrd* pThrd, char* key, bool* exceed) {
|
||||||
SConnList* plist = taosHashGet((SHashObj*)pool, key, klen);
|
SConnList* plist = taosHashGet((SHashObj*)pool, key, klen);
|
||||||
if (plist == NULL) {
|
if (plist == NULL) {
|
||||||
SConnList list = {0};
|
SConnList list = {0};
|
||||||
taosHashPut((SHashObj*)pool, key, klen, (void*)&list, sizeof(list));
|
(void)taosHashPut((SHashObj*)pool, key, klen, (void*)&list, sizeof(list));
|
||||||
plist = taosHashGet(pool, key, klen);
|
plist = taosHashGet(pool, key, klen);
|
||||||
|
|
||||||
SMsgList* nList = taosMemoryCalloc(1, sizeof(SMsgList));
|
SMsgList* nList = taosMemoryCalloc(1, sizeof(SMsgList));
|
||||||
|
@ -903,7 +903,7 @@ static int32_t specifyConnRef(SCliConn* conn, bool update, int64_t handle) {
|
||||||
conn->refId = exh->refId;
|
conn->refId = exh->refId;
|
||||||
taosWUnLockLatch(&exh->latch);
|
taosWUnLockLatch(&exh->latch);
|
||||||
|
|
||||||
transReleaseExHandle(transGetRefMgt(), handle);
|
(void)transReleaseExHandle(transGetRefMgt(), handle);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1010,7 +1010,7 @@ _failed:
|
||||||
if (conn) {
|
if (conn) {
|
||||||
taosMemoryFree(conn->stream);
|
taosMemoryFree(conn->stream);
|
||||||
transReqQueueClear(&conn->wreqQueue);
|
transReqQueueClear(&conn->wreqQueue);
|
||||||
transDestroyBuffer(&conn->readBuf);
|
(void)transDestroyBuffer(&conn->readBuf);
|
||||||
transQueueDestroy(&conn->cliMsgs);
|
transQueueDestroy(&conn->cliMsgs);
|
||||||
}
|
}
|
||||||
taosMemoryFree(conn);
|
taosMemoryFree(conn);
|
||||||
|
@ -1390,7 +1390,7 @@ static void cliHandleBatchReq(SCliBatch* pBatch, SCliThrd* pThrd) {
|
||||||
cliHandleFastFail(conn, -1);
|
cliHandleFastFail(conn, -1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
uv_timer_start(conn->timer, cliConnTimeout, TRANS_CONN_TIMEOUT, 0);
|
(void)uv_timer_start(conn->timer, cliConnTimeout, TRANS_CONN_TIMEOUT, 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1481,9 +1481,9 @@ void cliConnCb(uv_connect_t* req, int status) {
|
||||||
if (pConn->timer == NULL) {
|
if (pConn->timer == NULL) {
|
||||||
timeout = true;
|
timeout = true;
|
||||||
} else {
|
} else {
|
||||||
uv_timer_stop(pConn->timer);
|
(void)uv_timer_stop(pConn->timer);
|
||||||
pConn->timer->data = NULL;
|
pConn->timer->data = NULL;
|
||||||
taosArrayPush(pThrd->timerList, &pConn->timer);
|
(void)taosArrayPush(pThrd->timerList, &pConn->timer);
|
||||||
pConn->timer = NULL;
|
pConn->timer = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1609,7 +1609,7 @@ SCliConn* cliGetConn(SCliMsg** pMsg, SCliThrd* pThrd, bool* ignore, char* addr)
|
||||||
conn = getConnFromPool2(pThrd, addr, pMsg);
|
conn = getConnFromPool2(pThrd, addr, pMsg);
|
||||||
if (conn != NULL) specifyConnRef(conn, true, refId);
|
if (conn != NULL) specifyConnRef(conn, true, refId);
|
||||||
}
|
}
|
||||||
transReleaseExHandle(transGetRefMgt(), refId);
|
(void)transReleaseExHandle(transGetRefMgt(), refId);
|
||||||
}
|
}
|
||||||
return conn;
|
return conn;
|
||||||
};
|
};
|
||||||
|
@ -1759,14 +1759,14 @@ void cliHandleReq(SCliMsg* pMsg, SCliThrd* pThrd) {
|
||||||
|
|
||||||
if (conn != NULL) {
|
if (conn != NULL) {
|
||||||
transCtxMerge(&conn->ctx, &pMsg->ctx->appCtx);
|
transCtxMerge(&conn->ctx, &pMsg->ctx->appCtx);
|
||||||
transQueuePush(&conn->cliMsgs, pMsg);
|
(void)transQueuePush(&conn->cliMsgs, pMsg);
|
||||||
cliSend(conn);
|
cliSend(conn);
|
||||||
} else {
|
} else {
|
||||||
code = cliCreateConn(pThrd, &conn);
|
code = cliCreateConn(pThrd, &conn);
|
||||||
if (code != 0) {
|
if (code != 0) {
|
||||||
tError("%s failed to create conn, reason:%s", pTransInst->label, tstrerror(code));
|
tError("%s failed to create conn, reason:%s", pTransInst->label, tstrerror(code));
|
||||||
STransMsg resp = {.code = code};
|
STransMsg resp = {.code = code};
|
||||||
cliBuildExceptResp(pMsg, &resp);
|
(void)cliBuildExceptResp(pMsg, &resp);
|
||||||
|
|
||||||
resp.info.cliVer = pTransInst->compatibilityVer;
|
resp.info.cliVer = pTransInst->compatibilityVer;
|
||||||
if (pMsg->type != Release) {
|
if (pMsg->type != Release) {
|
||||||
|
@ -1827,7 +1827,7 @@ void cliHandleReq(SCliMsg* pMsg, SCliThrd* pThrd) {
|
||||||
|
|
||||||
ret = uv_tcp_connect(&conn->connReq, (uv_tcp_t*)(conn->stream), (const struct sockaddr*)&addr, cliConnCb);
|
ret = uv_tcp_connect(&conn->connReq, (uv_tcp_t*)(conn->stream), (const struct sockaddr*)&addr, cliConnCb);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
uv_timer_stop(conn->timer);
|
(void)uv_timer_stop(conn->timer);
|
||||||
conn->timer->data = NULL;
|
conn->timer->data = NULL;
|
||||||
(void)taosArrayPush(pThrd->timerList, &conn->timer);
|
(void)taosArrayPush(pThrd->timerList, &conn->timer);
|
||||||
conn->timer = NULL;
|
conn->timer = NULL;
|
||||||
|
@ -1923,7 +1923,7 @@ static void cliBatchDealReq(queue* wq, SCliThrd* pThrd) {
|
||||||
|
|
||||||
QUEUE_PUSH(&pBatchList->wq, &pBatch->listq);
|
QUEUE_PUSH(&pBatchList->wq, &pBatch->listq);
|
||||||
|
|
||||||
taosHashPut(pThrd->batchCache, key, klen, &pBatchList, sizeof(void*));
|
(void)taosHashPut(pThrd->batchCache, key, klen, &pBatchList, sizeof(void*));
|
||||||
} else {
|
} else {
|
||||||
if (QUEUE_IS_EMPTY(&(*ppBatchList)->wq)) {
|
if (QUEUE_IS_EMPTY(&(*ppBatchList)->wq)) {
|
||||||
SCliBatch* pBatch = taosMemoryCalloc(1, sizeof(SCliBatch));
|
SCliBatch* pBatch = taosMemoryCalloc(1, sizeof(SCliBatch));
|
||||||
|
@ -2099,10 +2099,10 @@ static void* cliWorkThread(void* arg) {
|
||||||
SCliThrd* pThrd = (SCliThrd*)arg;
|
SCliThrd* pThrd = (SCliThrd*)arg;
|
||||||
pThrd->pid = taosGetSelfPthreadId();
|
pThrd->pid = taosGetSelfPthreadId();
|
||||||
|
|
||||||
strtolower(threadName, pThrd->pTransInst->label);
|
(void)strtolower(threadName, pThrd->pTransInst->label);
|
||||||
setThreadName(threadName);
|
setThreadName(threadName);
|
||||||
|
|
||||||
uv_run(pThrd->loop, UV_RUN_DEFAULT);
|
(void)uv_run(pThrd->loop, UV_RUN_DEFAULT);
|
||||||
|
|
||||||
tDebug("thread quit-thread:%08" PRId64, pThrd->pid);
|
tDebug("thread quit-thread:%08" PRId64, pThrd->pid);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -2198,7 +2198,7 @@ static int32_t createThrdObj(void* trans, SCliThrd** ppThrd) {
|
||||||
}
|
}
|
||||||
|
|
||||||
QUEUE_INIT(&pThrd->msg);
|
QUEUE_INIT(&pThrd->msg);
|
||||||
taosThreadMutexInit(&pThrd->msgMtx, NULL);
|
(void)taosThreadMutexInit(&pThrd->msgMtx, NULL);
|
||||||
|
|
||||||
pThrd->loop = (uv_loop_t*)taosMemoryMalloc(sizeof(uv_loop_t));
|
pThrd->loop = (uv_loop_t*)taosMemoryMalloc(sizeof(uv_loop_t));
|
||||||
if (pThrd->loop == NULL) {
|
if (pThrd->loop == NULL) {
|
||||||
|
@ -2291,7 +2291,7 @@ _end:
|
||||||
(void)uv_loop_close(pThrd->loop);
|
(void)uv_loop_close(pThrd->loop);
|
||||||
taosMemoryFree(pThrd->loop);
|
taosMemoryFree(pThrd->loop);
|
||||||
taosMemoryFree(pThrd->prepare);
|
taosMemoryFree(pThrd->prepare);
|
||||||
taosThreadMutexDestroy(&pThrd->msgMtx);
|
(void)taosThreadMutexDestroy(&pThrd->msgMtx);
|
||||||
transAsyncPoolDestroy(pThrd->asyncPool);
|
transAsyncPoolDestroy(pThrd->asyncPool);
|
||||||
for (int i = 0; i < taosArrayGetSize(pThrd->timerList); i++) {
|
for (int i = 0; i < taosArrayGetSize(pThrd->timerList); i++) {
|
||||||
uv_timer_t* timer = taosArrayGetP(pThrd->timerList, i);
|
uv_timer_t* timer = taosArrayGetP(pThrd->timerList, i);
|
||||||
|
@ -2916,7 +2916,7 @@ int transSendRecv(void* shandle, const SEpSet* pEpSet, STransMsg* pReq, STransMs
|
||||||
|
|
||||||
STransConnCtx* pCtx = taosMemoryCalloc(1, sizeof(STransConnCtx));
|
STransConnCtx* pCtx = taosMemoryCalloc(1, sizeof(STransConnCtx));
|
||||||
if (pCtx == NULL) {
|
if (pCtx == NULL) {
|
||||||
tsem_destroy(sem);
|
(void)tsem_destroy(sem);
|
||||||
taosMemoryFree(sem);
|
taosMemoryFree(sem);
|
||||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _RETURN1);
|
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _RETURN1);
|
||||||
}
|
}
|
||||||
|
@ -2930,7 +2930,7 @@ int transSendRecv(void* shandle, const SEpSet* pEpSet, STransMsg* pReq, STransMs
|
||||||
|
|
||||||
SCliMsg* cliMsg = taosMemoryCalloc(1, sizeof(SCliMsg));
|
SCliMsg* cliMsg = taosMemoryCalloc(1, sizeof(SCliMsg));
|
||||||
if (cliMsg == NULL) {
|
if (cliMsg == NULL) {
|
||||||
tsem_destroy(sem);
|
(void)tsem_destroy(sem);
|
||||||
taosMemoryFree(sem);
|
taosMemoryFree(sem);
|
||||||
taosMemoryFree(pCtx);
|
taosMemoryFree(pCtx);
|
||||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _RETURN1);
|
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _RETURN1);
|
||||||
|
@ -2951,7 +2951,7 @@ int transSendRecv(void* shandle, const SEpSet* pEpSet, STransMsg* pReq, STransMs
|
||||||
destroyCmsg(cliMsg);
|
destroyCmsg(cliMsg);
|
||||||
TAOS_CHECK_GOTO((code == TSDB_CODE_RPC_ASYNC_MODULE_QUIT ? TSDB_CODE_RPC_MODULE_QUIT : code), NULL, _RETURN);
|
TAOS_CHECK_GOTO((code == TSDB_CODE_RPC_ASYNC_MODULE_QUIT ? TSDB_CODE_RPC_MODULE_QUIT : code), NULL, _RETURN);
|
||||||
}
|
}
|
||||||
tsem_wait(sem);
|
(void)tsem_wait(sem);
|
||||||
|
|
||||||
memcpy(pRsp, pTransRsp, sizeof(STransMsg));
|
memcpy(pRsp, pTransRsp, sizeof(STransMsg));
|
||||||
|
|
||||||
|
@ -3085,7 +3085,7 @@ int transSendRecvWithTimeout(void* shandle, SEpSet* pEpSet, STransMsg* pReq, STr
|
||||||
_RETURN:
|
_RETURN:
|
||||||
(void)transReleaseExHandle(transGetInstMgt(), (int64_t)shandle);
|
(void)transReleaseExHandle(transGetInstMgt(), (int64_t)shandle);
|
||||||
(void)taosReleaseRef(transGetSyncMsgMgt(), ref);
|
(void)taosReleaseRef(transGetSyncMsgMgt(), ref);
|
||||||
taosRemoveRef(transGetSyncMsgMgt(), ref);
|
(void)taosRemoveRef(transGetSyncMsgMgt(), ref);
|
||||||
return code;
|
return code;
|
||||||
_RETURN2:
|
_RETURN2:
|
||||||
transFreeMsg(pReq->pCont);
|
transFreeMsg(pReq->pCont);
|
||||||
|
|
|
@ -377,7 +377,7 @@ void transCtxMerge(STransCtx* dst, STransCtx* src) {
|
||||||
// if (dVal) {
|
// if (dVal) {
|
||||||
// dst->freeFunc(dVal->val);
|
// dst->freeFunc(dVal->val);
|
||||||
// }
|
// }
|
||||||
taosHashPut(dst->args, key, klen, sVal, sizeof(*sVal));
|
(void)taosHashPut(dst->args, key, klen, sVal, sizeof(*sVal));
|
||||||
iter = taosHashIterate(src->args, iter);
|
iter = taosHashIterate(src->args, iter);
|
||||||
}
|
}
|
||||||
taosHashCleanup(src->args);
|
taosHashCleanup(src->args);
|
||||||
|
|
|
@ -1673,7 +1673,7 @@ void transCloseServer(void* arg) {
|
||||||
destroyWorkThrd(srv->pThreadObj[i]);
|
destroyWorkThrd(srv->pThreadObj[i]);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
uv_loop_close(srv->loop);
|
(void)uv_loop_close(srv->loop);
|
||||||
}
|
}
|
||||||
|
|
||||||
taosMemoryFree(srv->pThreadObj);
|
taosMemoryFree(srv->pThreadObj);
|
||||||
|
|
|
@ -823,9 +823,9 @@ int32_t tsDecompressTimestampImp(const char *const input, const int32_t nelement
|
||||||
return nelements * longBytes;
|
return nelements * longBytes;
|
||||||
} else if (input[0] == 1) { // Decompress
|
} else if (input[0] == 1) { // Decompress
|
||||||
if (tsSIMDEnable && tsAVX512Supported && tsAVX512Enable) {
|
if (tsSIMDEnable && tsAVX512Supported && tsAVX512Enable) {
|
||||||
tsDecompressTimestampAvx512(input, nelements, output, false);
|
(void)tsDecompressTimestampAvx512(input, nelements, output, false);
|
||||||
} else if (tsSIMDEnable && tsAVX2Supported) {
|
} else if (tsSIMDEnable && tsAVX2Supported) {
|
||||||
tsDecompressTimestampAvx2(input, nelements, output, false);
|
(void)tsDecompressTimestampAvx2(input, nelements, output, false);
|
||||||
} else {
|
} else {
|
||||||
int64_t *ostream = (int64_t *)output;
|
int64_t *ostream = (int64_t *)output;
|
||||||
|
|
||||||
|
@ -1199,9 +1199,9 @@ int32_t tsDecompressFloatImp(const char *const input, const int32_t nelements, c
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tsSIMDEnable && tsAVX2Supported) {
|
if (tsSIMDEnable && tsAVX2Supported) {
|
||||||
tsDecompressFloatImplAvx2(input, nelements, output);
|
(void)tsDecompressFloatImplAvx2(input, nelements, output);
|
||||||
} else if (tsSIMDEnable && tsAVX512Supported && tsAVX512Enable) {
|
} else if (tsSIMDEnable && tsAVX512Supported && tsAVX512Enable) {
|
||||||
tsDecompressFloatImplAvx512(input, nelements, output);
|
(void)tsDecompressFloatImplAvx512(input, nelements, output);
|
||||||
} else { // alternative implementation without SIMD instructions.
|
} else { // alternative implementation without SIMD instructions.
|
||||||
tsDecompressFloatHelper(input, nelements, (float *)output);
|
tsDecompressFloatHelper(input, nelements, (float *)output);
|
||||||
}
|
}
|
||||||
|
|
|
@ -932,7 +932,7 @@ void taosLogCrashInfo(char *nodeType, char *pMsg, int64_t msgLen, int signum, vo
|
||||||
goto _return;
|
goto _return;
|
||||||
}
|
}
|
||||||
|
|
||||||
taosUnLockFile(pFile);
|
(void)taosUnLockFile(pFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
_return:
|
_return:
|
||||||
|
|
|
@ -8,7 +8,7 @@ int32_t doRegComp(pcre2_code** ppRegex, pcre2_match_data** ppMatchData, const ch
|
||||||
*ppRegex = pcre2_compile((PCRE2_SPTR8)pattern, PCRE2_ZERO_TERMINATED, options, &errorcode, &erroroffset, NULL);
|
*ppRegex = pcre2_compile((PCRE2_SPTR8)pattern, PCRE2_ZERO_TERMINATED, options, &errorcode, &erroroffset, NULL);
|
||||||
if (*ppRegex == NULL) {
|
if (*ppRegex == NULL) {
|
||||||
PCRE2_UCHAR buffer[256];
|
PCRE2_UCHAR buffer[256];
|
||||||
pcre2_get_error_message(errorcode, buffer, sizeof(buffer));
|
(void)pcre2_get_error_message(errorcode, buffer, sizeof(buffer));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ int32_t doRegExec(const char* pString, pcre2_code* pRegex, pcre2_match_data* pMa
|
||||||
ret = pcre2_match(pRegex, (PCRE2_SPTR)pString, PCRE2_ZERO_TERMINATED, 0, 0, pMatchData, NULL);
|
ret = pcre2_match(pRegex, (PCRE2_SPTR)pString, PCRE2_ZERO_TERMINATED, 0, 0, pMatchData, NULL);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
PCRE2_UCHAR buffer[256];
|
PCRE2_UCHAR buffer[256];
|
||||||
pcre2_get_error_message(ret, buffer, sizeof(buffer));
|
(void)pcre2_get_error_message(ret, buffer, sizeof(buffer));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -320,7 +320,7 @@ char *strbetween(char *string, char *begin, char *end) {
|
||||||
int32_t size = (int32_t)(_end - _begin);
|
int32_t size = (int32_t)(_end - _begin);
|
||||||
if (_end != NULL && size > 0) {
|
if (_end != NULL && size > 0) {
|
||||||
result = (char *)taosMemoryCalloc(1, size);
|
result = (char *)taosMemoryCalloc(1, size);
|
||||||
if (result) {
|
if (!result) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
memcpy(result, _begin + strlen(begin), size - +strlen(begin));
|
memcpy(result, _begin + strlen(begin), size - +strlen(begin));
|
||||||
|
|
|
@ -560,6 +560,8 @@
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/max.py -R
|
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/max.py -R
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/min.py
|
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/min.py
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/min.py -R
|
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/min.py -R
|
||||||
|
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/normal.py
|
||||||
|
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/normal.py -R
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/mode.py
|
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/mode.py
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/mode.py -R
|
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/mode.py -R
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/Now.py
|
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/Now.py
|
||||||
|
@ -739,6 +741,7 @@
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/Today.py -Q 2
|
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/Today.py -Q 2
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/max.py -Q 2
|
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/max.py -Q 2
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/min.py -Q 2
|
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/min.py -Q 2
|
||||||
|
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/normal.py -Q 2
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/mode.py -Q 2
|
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/mode.py -Q 2
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/count.py -Q 2
|
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/count.py -Q 2
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/countAlwaysReturnValue.py -Q 2
|
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/countAlwaysReturnValue.py -Q 2
|
||||||
|
@ -837,6 +840,7 @@
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/Today.py -Q 3
|
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/Today.py -Q 3
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/max.py -Q 3
|
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/max.py -Q 3
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/min.py -Q 3
|
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/min.py -Q 3
|
||||||
|
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/normal.py -Q 3
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/mode.py -Q 3
|
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/mode.py -Q 3
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/count.py -Q 3
|
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/count.py -Q 3
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/countAlwaysReturnValue.py -Q 3
|
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/countAlwaysReturnValue.py -Q 3
|
||||||
|
@ -934,6 +938,7 @@
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/Today.py -Q 4
|
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/Today.py -Q 4
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/max.py -Q 4
|
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/max.py -Q 4
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/min.py -Q 4
|
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/min.py -Q 4
|
||||||
|
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/normal.py -Q 4
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/mode.py -Q 4
|
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/mode.py -Q 4
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/count.py -Q 4
|
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/count.py -Q 4
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/countAlwaysReturnValue.py -Q 4
|
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/countAlwaysReturnValue.py -Q 4
|
||||||
|
|
|
@ -81,6 +81,12 @@ class TDTestCase:
|
||||||
num = self.row_nums
|
num = self.row_nums
|
||||||
tdSql.checkRows(num)
|
tdSql.checkRows(num)
|
||||||
|
|
||||||
|
tdSql.query(f"select c1, count(*), count(1), count(c1) from {self.dbname}.{self.stable} {keyword} by c1 having c1 >= 0")
|
||||||
|
num = 0
|
||||||
|
if nonempty_tb_num > 0:
|
||||||
|
num = self.row_nums
|
||||||
|
tdSql.checkRows(num)
|
||||||
|
|
||||||
tdSql.query(f"select ts, count(*) from {self.dbname}.{self.stable} {keyword} by ts ")
|
tdSql.query(f"select ts, count(*) from {self.dbname}.{self.stable} {keyword} by ts ")
|
||||||
tdSql.checkRows(nonempty_tb_num * self.row_nums)
|
tdSql.checkRows(nonempty_tb_num * self.row_nums)
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,143 @@
|
||||||
|
from wsgiref.headers import tspecials
|
||||||
|
from util.log import *
|
||||||
|
from util.cases import *
|
||||||
|
from util.sql import *
|
||||||
|
import numpy as np
|
||||||
|
|
||||||
|
|
||||||
|
class TDTestCase:
|
||||||
|
def init(self, conn, logSql, replicaVar=1):
|
||||||
|
self.replicaVar = int(replicaVar)
|
||||||
|
tdLog.debug("start to execute %s" % __file__)
|
||||||
|
tdSql.init(conn.cursor())
|
||||||
|
|
||||||
|
self.dbname = "db"
|
||||||
|
self.rowNum = 10
|
||||||
|
self.ts = 1537146000000
|
||||||
|
|
||||||
|
def inAndNotinTest(self):
|
||||||
|
dbname = self.dbname
|
||||||
|
|
||||||
|
tdSql.query(f"select 1 in (1, 2)")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, True)
|
||||||
|
|
||||||
|
tdSql.query(f"select 1 in (2, 3)")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, False)
|
||||||
|
|
||||||
|
tdSql.query(f"select 1 not in (2, 3)")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, True)
|
||||||
|
|
||||||
|
tdSql.query(f"select 1 not in (1)")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, False)
|
||||||
|
|
||||||
|
tdSql.query(f"select 1 in (1, null)")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, True)
|
||||||
|
|
||||||
|
tdSql.query(f"select 1 in (2, null)")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, False) # 1 not in (2, null) is NULL?
|
||||||
|
|
||||||
|
tdSql.query(f"select 1 not in (1, null)")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, False)
|
||||||
|
|
||||||
|
tdSql.query(f"select 1 not in (2, null)")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, False) # 1 not in (2, null) is NULL?
|
||||||
|
|
||||||
|
tdSql.query(f"select 1 not in (null)")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, False) # 1 not in (null) is NULL?
|
||||||
|
|
||||||
|
tdSql.execute(f'''create table {dbname}.stb(ts timestamp, col1 int, col2 nchar(20)) tags(loc nchar(20))''')
|
||||||
|
tdSql.execute(f"create table {dbname}.stb_1 using {dbname}.stb tags('beijing')")
|
||||||
|
tdSql.execute(f"create table {dbname}.stb_2 using {dbname}.stb tags('shanghai')")
|
||||||
|
|
||||||
|
for i in range(self.rowNum):
|
||||||
|
tdSql.execute(f"insert into {dbname}.stb_1 values({self.ts + i + 1}, {i+1}, 'taosdata_{i+1}')" )
|
||||||
|
for i in range(self.rowNum):
|
||||||
|
tdSql.execute(f"insert into {dbname}.stb_2 values({self.ts + i + 1}, {i+1}, 'taosdata_{i+1}')" )
|
||||||
|
|
||||||
|
tdSql.query(f"select * from {dbname}.stb_1 where col1 in (1, 2) order by ts")
|
||||||
|
tdSql.checkRows(2)
|
||||||
|
tdSql.checkData(0, 1, 1)
|
||||||
|
tdSql.checkData(1, 1, 2)
|
||||||
|
|
||||||
|
tdSql.query(f"select * from {dbname}.stb_1 where col1 in (1, 9, 3) order by ts")
|
||||||
|
tdSql.checkRows(3)
|
||||||
|
tdSql.checkData(0, 1, 1)
|
||||||
|
tdSql.checkData(1, 1, 3)
|
||||||
|
tdSql.checkData(2, 1, 9)
|
||||||
|
|
||||||
|
tdSql.query(f"select * from {dbname}.stb_1 where col1 in (1, 9, 3, 'xy') order by ts")
|
||||||
|
tdSql.checkRows(3)
|
||||||
|
tdSql.checkData(0, 1, 1)
|
||||||
|
tdSql.checkData(1, 1, 3)
|
||||||
|
tdSql.checkData(2, 1, 9)
|
||||||
|
|
||||||
|
tdSql.query(f"select * from {dbname}.stb_1 where col1 in (1, '9', 3) order by ts")
|
||||||
|
tdSql.checkRows(3)
|
||||||
|
tdSql.checkData(0, 1, 1)
|
||||||
|
tdSql.checkData(1, 1, 3)
|
||||||
|
tdSql.checkData(2, 1, 9)
|
||||||
|
|
||||||
|
tdSql.query(f"select * from {dbname}.stb_1 where col1 in (1, 9, 3, null) order by ts")
|
||||||
|
tdSql.checkRows(3)
|
||||||
|
tdSql.checkData(0, 1, 1)
|
||||||
|
tdSql.checkData(1, 1, 3)
|
||||||
|
tdSql.checkData(2, 1, 9)
|
||||||
|
|
||||||
|
tdSql.query(f"select * from {dbname}.stb_1 where col2 in (1, 'taosdata_1', 3, null) order by ts")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 1, 1)
|
||||||
|
|
||||||
|
tdSql.query(f"select * from {dbname}.stb_1 where col2 not in (1, 'taosdata_1', 3, null) order by ts")
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
|
||||||
|
tdSql.execute(f"insert into {dbname}.stb_1 values({self.ts + self.rowNum + 1}, {self.rowNum+1}, null)" )
|
||||||
|
tdSql.execute(f"insert into {dbname}.stb_2 values({self.ts + self.rowNum + 1}, {self.rowNum+1}, null)" )
|
||||||
|
|
||||||
|
tdSql.query(f"select * from {dbname}.stb_1 where col2 in (1, 'taosdata_1', 3, null) order by ts")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 1, 1)
|
||||||
|
|
||||||
|
tdSql.query(f"select * from {dbname}.stb_1 where col2 not in (1, 'taosdata_1', 3, null) order by ts")
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
|
||||||
|
tdSql.query(f"select * from {dbname}.stb where loc in ('beijing', null)")
|
||||||
|
tdSql.checkRows(11)
|
||||||
|
|
||||||
|
tdSql.query(f"select * from {dbname}.stb where loc in ('shanghai', null)")
|
||||||
|
tdSql.checkRows(11)
|
||||||
|
|
||||||
|
tdSql.query(f"select * from {dbname}.stb where loc in ('shanghai', 'shanghai', null)")
|
||||||
|
tdSql.checkRows(11)
|
||||||
|
|
||||||
|
tdSql.query(f"select * from {dbname}.stb where loc in ('beijing', 'shanghai', null)")
|
||||||
|
tdSql.checkRows(22)
|
||||||
|
|
||||||
|
tdSql.query(f"select * from {dbname}.stb where loc not in ('beijing', null)")
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
|
||||||
|
tdSql.query(f"select * from {dbname}.stb where loc not in ('shanghai', 'shanghai', null)")
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
dbname = "db"
|
||||||
|
tdSql.prepare()
|
||||||
|
|
||||||
|
self.inAndNotinTest()
|
||||||
|
|
||||||
|
|
||||||
|
def stop(self):
|
||||||
|
tdSql.close()
|
||||||
|
tdLog.success("%s successfully executed" % __file__)
|
||||||
|
|
||||||
|
tdCases.addWindows(__file__, TDTestCase())
|
||||||
|
tdCases.addLinux(__file__, TDTestCase())
|
|
@ -615,6 +615,8 @@ class TDTestCase:
|
||||||
self.replicaVar = int(replicaVar)
|
self.replicaVar = int(replicaVar)
|
||||||
tdLog.debug(f"start to excute {__file__}")
|
tdLog.debug(f"start to excute {__file__}")
|
||||||
tdSql.init(conn.cursor(), False)
|
tdSql.init(conn.cursor(), False)
|
||||||
|
tdSql.execute('alter local "debugFlag" "143"')
|
||||||
|
tdSql.execute('alter dnode 1 "debugFlag" "143"')
|
||||||
self.tsma_tester: TSMATester = TSMATester(tdSql)
|
self.tsma_tester: TSMATester = TSMATester(tdSql)
|
||||||
self.tsma_sql_generator: TSMATestSQLGenerator = TSMATestSQLGenerator()
|
self.tsma_sql_generator: TSMATestSQLGenerator = TSMATestSQLGenerator()
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,9 @@ class TDTestCase:
|
||||||
for i in range(rowCnt):
|
for i in range(rowCnt):
|
||||||
results.append(tdSql.getData(i,1))
|
results.append(tdSql.getData(i,1))
|
||||||
|
|
||||||
tdSql.query("select * from st1 order by groupid,_wstart")
|
sql = "select * from st1 order by groupid,_wstart"
|
||||||
|
tdSql.check_rows_loop(rowCnt, sql, loopCount=100, waitTime=0.5)
|
||||||
|
|
||||||
tdSql.checkRows(rowCnt)
|
tdSql.checkRows(rowCnt)
|
||||||
for i in range(rowCnt):
|
for i in range(rowCnt):
|
||||||
data1 = tdSql.getData(i,1)
|
data1 = tdSql.getData(i,1)
|
||||||
|
|
|
@ -243,6 +243,8 @@ python3 ./test.py -f 2-query/max.py -P
|
||||||
python3 ./test.py -f 2-query/max.py -P -R
|
python3 ./test.py -f 2-query/max.py -P -R
|
||||||
python3 ./test.py -f 2-query/min.py -P
|
python3 ./test.py -f 2-query/min.py -P
|
||||||
python3 ./test.py -f 2-query/min.py -P -R
|
python3 ./test.py -f 2-query/min.py -P -R
|
||||||
|
python3 ./test.py -f 2-query/normal.py -P
|
||||||
|
python3 ./test.py -f 2-query/normal.py -P -R
|
||||||
python3 ./test.py -f 2-query/mode.py -P
|
python3 ./test.py -f 2-query/mode.py -P
|
||||||
python3 ./test.py -f 2-query/mode.py -P -R
|
python3 ./test.py -f 2-query/mode.py -P -R
|
||||||
python3 ./test.py -f 2-query/Now.py -P
|
python3 ./test.py -f 2-query/Now.py -P
|
||||||
|
@ -424,6 +426,7 @@ python3 ./test.py -f 2-query/Now.py -P -Q 2
|
||||||
python3 ./test.py -f 2-query/Today.py -P -Q 2
|
python3 ./test.py -f 2-query/Today.py -P -Q 2
|
||||||
python3 ./test.py -f 2-query/max.py -P -Q 2
|
python3 ./test.py -f 2-query/max.py -P -Q 2
|
||||||
python3 ./test.py -f 2-query/min.py -P -Q 2
|
python3 ./test.py -f 2-query/min.py -P -Q 2
|
||||||
|
python3 ./test.py -f 2-query/normal.py -P -Q 2
|
||||||
python3 ./test.py -f 2-query/mode.py -P -Q 2
|
python3 ./test.py -f 2-query/mode.py -P -Q 2
|
||||||
python3 ./test.py -f 2-query/count.py -P -Q 2
|
python3 ./test.py -f 2-query/count.py -P -Q 2
|
||||||
python3 ./test.py -f 2-query/countAlwaysReturnValue.py -P -Q 2
|
python3 ./test.py -f 2-query/countAlwaysReturnValue.py -P -Q 2
|
||||||
|
@ -522,6 +525,7 @@ python3 ./test.py -f 2-query/Now.py -P -Q 3
|
||||||
python3 ./test.py -f 2-query/Today.py -P -Q 3
|
python3 ./test.py -f 2-query/Today.py -P -Q 3
|
||||||
python3 ./test.py -f 2-query/max.py -P -Q 3
|
python3 ./test.py -f 2-query/max.py -P -Q 3
|
||||||
python3 ./test.py -f 2-query/min.py -P -Q 3
|
python3 ./test.py -f 2-query/min.py -P -Q 3
|
||||||
|
python3 ./test.py -f 2-query/normal.py -P -Q 3
|
||||||
python3 ./test.py -f 2-query/mode.py -P -Q 3
|
python3 ./test.py -f 2-query/mode.py -P -Q 3
|
||||||
python3 ./test.py -f 2-query/count.py -P -Q 3
|
python3 ./test.py -f 2-query/count.py -P -Q 3
|
||||||
python3 ./test.py -f 2-query/countAlwaysReturnValue.py -P -Q 3
|
python3 ./test.py -f 2-query/countAlwaysReturnValue.py -P -Q 3
|
||||||
|
@ -619,6 +623,7 @@ python3 ./test.py -f 2-query/Now.py -P -Q 4
|
||||||
python3 ./test.py -f 2-query/Today.py -P -Q 4
|
python3 ./test.py -f 2-query/Today.py -P -Q 4
|
||||||
python3 ./test.py -f 2-query/max.py -P -Q 4
|
python3 ./test.py -f 2-query/max.py -P -Q 4
|
||||||
python3 ./test.py -f 2-query/min.py -P -Q 4
|
python3 ./test.py -f 2-query/min.py -P -Q 4
|
||||||
|
python3 ./test.py -f 2-query/normal.py -P -Q 4
|
||||||
python3 ./test.py -f 2-query/mode.py -P -Q 4
|
python3 ./test.py -f 2-query/mode.py -P -Q 4
|
||||||
python3 ./test.py -f 2-query/count.py -P -Q 4
|
python3 ./test.py -f 2-query/count.py -P -Q 4
|
||||||
python3 ./test.py -f 2-query/countAlwaysReturnValue.py -P -Q 4
|
python3 ./test.py -f 2-query/countAlwaysReturnValue.py -P -Q 4
|
||||||
|
|
|
@ -46,6 +46,7 @@ python3 .\test.py -f 2-query\between.py
|
||||||
@REM python3 .\test.py -f 2-query\Today.py
|
@REM python3 .\test.py -f 2-query\Today.py
|
||||||
@REM python3 .\test.py -f 2-query\max.py
|
@REM python3 .\test.py -f 2-query\max.py
|
||||||
@REM python3 .\test.py -f 2-query\min.py
|
@REM python3 .\test.py -f 2-query\min.py
|
||||||
|
@REM python3 .\test.py -f 2-query\normal.py
|
||||||
@REM python3 .\test.py -f 2-query\count.py
|
@REM python3 .\test.py -f 2-query\count.py
|
||||||
@REM python3 .\test.py -f 2-query\last.py
|
@REM python3 .\test.py -f 2-query\last.py
|
||||||
@REM python3 .\test.py -f 2-query\first.py
|
@REM python3 .\test.py -f 2-query\first.py
|
||||||
|
|
|
@ -382,6 +382,8 @@ python3 ./test.py -f 2-query/max.py
|
||||||
python3 ./test.py -f 2-query/max.py -R
|
python3 ./test.py -f 2-query/max.py -R
|
||||||
python3 ./test.py -f 2-query/min.py
|
python3 ./test.py -f 2-query/min.py
|
||||||
python3 ./test.py -f 2-query/min.py -R
|
python3 ./test.py -f 2-query/min.py -R
|
||||||
|
python3 ./test.py -f 2-query/normal.py
|
||||||
|
python3 ./test.py -f 2-query/normal.py -R
|
||||||
python3 ./test.py -f 2-query/mode.py
|
python3 ./test.py -f 2-query/mode.py
|
||||||
python3 ./test.py -f 2-query/mode.py -R
|
python3 ./test.py -f 2-query/mode.py -R
|
||||||
python3 ./test.py -f 2-query/Now.py
|
python3 ./test.py -f 2-query/Now.py
|
||||||
|
@ -550,6 +552,7 @@ python3 ./test.py -f 2-query/Now.py -Q 2
|
||||||
python3 ./test.py -f 2-query/Today.py -Q 2
|
python3 ./test.py -f 2-query/Today.py -Q 2
|
||||||
python3 ./test.py -f 2-query/max.py -Q 2
|
python3 ./test.py -f 2-query/max.py -Q 2
|
||||||
python3 ./test.py -f 2-query/min.py -Q 2
|
python3 ./test.py -f 2-query/min.py -Q 2
|
||||||
|
python3 ./test.py -f 2-query/normal.py -Q 2
|
||||||
python3 ./test.py -f 2-query/mode.py -Q 2
|
python3 ./test.py -f 2-query/mode.py -Q 2
|
||||||
python3 ./test.py -f 2-query/count.py -Q 2
|
python3 ./test.py -f 2-query/count.py -Q 2
|
||||||
python3 ./test.py -f 2-query/countAlwaysReturnValue.py -Q 2
|
python3 ./test.py -f 2-query/countAlwaysReturnValue.py -Q 2
|
||||||
|
@ -646,6 +649,7 @@ python3 ./test.py -f 2-query/Now.py -Q 3
|
||||||
python3 ./test.py -f 2-query/Today.py -Q 3
|
python3 ./test.py -f 2-query/Today.py -Q 3
|
||||||
python3 ./test.py -f 2-query/max.py -Q 3
|
python3 ./test.py -f 2-query/max.py -Q 3
|
||||||
python3 ./test.py -f 2-query/min.py -Q 3
|
python3 ./test.py -f 2-query/min.py -Q 3
|
||||||
|
python3 ./test.py -f 2-query/normal.py -Q 3
|
||||||
python3 ./test.py -f 2-query/mode.py -Q 3
|
python3 ./test.py -f 2-query/mode.py -Q 3
|
||||||
python3 ./test.py -f 2-query/count.py -Q 3
|
python3 ./test.py -f 2-query/count.py -Q 3
|
||||||
python3 ./test.py -f 2-query/countAlwaysReturnValue.py -Q 3
|
python3 ./test.py -f 2-query/countAlwaysReturnValue.py -Q 3
|
||||||
|
@ -742,6 +746,7 @@ python3 ./test.py -f 2-query/Now.py -Q 4
|
||||||
python3 ./test.py -f 2-query/Today.py -Q 4
|
python3 ./test.py -f 2-query/Today.py -Q 4
|
||||||
python3 ./test.py -f 2-query/max.py -Q 4
|
python3 ./test.py -f 2-query/max.py -Q 4
|
||||||
python3 ./test.py -f 2-query/min.py -Q 4
|
python3 ./test.py -f 2-query/min.py -Q 4
|
||||||
|
python3 ./test.py -f 2-query/normal.py -Q 4
|
||||||
python3 ./test.py -f 2-query/mode.py -Q 4
|
python3 ./test.py -f 2-query/mode.py -Q 4
|
||||||
python3 ./test.py -f 2-query/count.py -Q 4
|
python3 ./test.py -f 2-query/count.py -Q 4
|
||||||
python3 ./test.py -f 2-query/countAlwaysReturnValue.py -Q 4
|
python3 ./test.py -f 2-query/countAlwaysReturnValue.py -Q 4
|
||||||
|
|
Loading…
Reference in New Issue