Merge branch '3.0' of https://github.com/taosdata/TDengine into fix/TD-30837
This commit is contained in:
commit
063b492f72
|
@ -33,7 +33,7 @@ void executeSQL(TAOS *taos, const char *sql) {
|
|||
void checkErrorCode(TAOS_STMT *stmt, int code, const char *msg) {
|
||||
if (code != 0) {
|
||||
printf("%s. error: %s\n", msg, taos_stmt_errstr(stmt));
|
||||
taos_stmt_close(stmt);
|
||||
(void)taos_stmt_close(stmt);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
@ -123,7 +123,7 @@ void insertData(TAOS *taos) {
|
|||
int affectedRows = taos_stmt_affected_rows(stmt);
|
||||
printf("successfully inserted %d rows\n", affectedRows);
|
||||
// close
|
||||
taos_stmt_close(stmt);
|
||||
(void)taos_stmt_close(stmt);
|
||||
}
|
||||
|
||||
int main() {
|
||||
|
|
|
@ -33,7 +33,7 @@ void executeSQL(TAOS *taos, const char *sql) {
|
|||
void checkErrorCode(TAOS_STMT *stmt, int code, const char* msg) {
|
||||
if (code != 0) {
|
||||
printf("%s. error: %s\n", msg, taos_stmt_errstr(stmt));
|
||||
taos_stmt_close(stmt);
|
||||
(void)taos_stmt_close(stmt);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ void insertData(TAOS *taos) {
|
|||
int affectedRows = taos_stmt_affected_rows(stmt);
|
||||
printf("successfully inserted %d rows\n", affectedRows);
|
||||
// close
|
||||
taos_stmt_close(stmt);
|
||||
(void)taos_stmt_close(stmt);
|
||||
}
|
||||
|
||||
int main() {
|
||||
|
|
|
@ -1,66 +0,0 @@
|
|||
// A simple demo for asynchronous subscription.
|
||||
// compile with:
|
||||
// gcc -o subscribe_demo subscribe_demo.c -ltaos
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <taos.h>
|
||||
|
||||
int nTotalRows;
|
||||
|
||||
/**
|
||||
* @brief callback function of subscription.
|
||||
*
|
||||
* @param tsub
|
||||
* @param res
|
||||
* @param param. the additional parameter passed to taos_subscribe
|
||||
* @param code. error code
|
||||
*/
|
||||
void subscribe_callback(TAOS_SUB* tsub, TAOS_RES* res, void* param, int code) {
|
||||
if (code != 0) {
|
||||
printf("error: %d\n", code);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
TAOS_ROW row = NULL;
|
||||
int num_fields = taos_num_fields(res);
|
||||
TAOS_FIELD* fields = taos_fetch_fields(res);
|
||||
int nRows = 0;
|
||||
|
||||
while ((row = taos_fetch_row(res))) {
|
||||
char buf[4096] = {0};
|
||||
taos_print_row(buf, row, fields, num_fields);
|
||||
puts(buf);
|
||||
nRows++;
|
||||
}
|
||||
|
||||
nTotalRows += nRows;
|
||||
printf("%d rows consumed.\n", nRows);
|
||||
}
|
||||
|
||||
int main() {
|
||||
TAOS* taos = taos_connect("localhost", "root", "taosdata", NULL, 6030);
|
||||
if (taos == NULL) {
|
||||
printf("failed to connect to server\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
int restart = 1; // if the topic already exists, where to subscribe from the begin.
|
||||
const char* topic = "topic-meter-current-bg-10";
|
||||
const char* sql = "select * from power.meters where current > 10";
|
||||
void* param = NULL; // additional parameter.
|
||||
int interval = 2000; // consumption interval in microseconds.
|
||||
TAOS_SUB* tsub = taos_subscribe(taos, restart, topic, sql, subscribe_callback, NULL, interval);
|
||||
|
||||
// wait for insert from others process. you can open TDengine CLI to insert some records for test.
|
||||
|
||||
getchar(); // press Enter to stop
|
||||
|
||||
printf("total rows consumed: %d\n", nTotalRows);
|
||||
int keep = 0; // whether to keep subscribe process
|
||||
taos_unsubscribe(tsub, keep);
|
||||
|
||||
taos_close(taos);
|
||||
taos_cleanup();
|
||||
}
|
|
@ -1076,10 +1076,10 @@ typedef struct {
|
|||
SUpdateUserIpWhite* pUserIpWhite;
|
||||
} SUpdateIpWhite;
|
||||
|
||||
int32_t tSerializeSUpdateIpWhite(void* buf, int32_t bufLen, SUpdateIpWhite* pReq);
|
||||
int32_t tDeserializeSUpdateIpWhite(void* buf, int32_t bufLen, SUpdateIpWhite* pReq);
|
||||
void tFreeSUpdateIpWhiteReq(SUpdateIpWhite* pReq);
|
||||
SUpdateIpWhite* cloneSUpdateIpWhiteReq(SUpdateIpWhite* pReq);
|
||||
int32_t tSerializeSUpdateIpWhite(void* buf, int32_t bufLen, SUpdateIpWhite* pReq);
|
||||
int32_t tDeserializeSUpdateIpWhite(void* buf, int32_t bufLen, SUpdateIpWhite* pReq);
|
||||
void tFreeSUpdateIpWhiteReq(SUpdateIpWhite* pReq);
|
||||
int32_t cloneSUpdateIpWhiteReq(SUpdateIpWhite* pReq, SUpdateIpWhite** pUpdate);
|
||||
|
||||
typedef struct {
|
||||
int64_t ipWhiteVer;
|
||||
|
@ -3640,7 +3640,7 @@ static FORCE_INLINE void tqOffsetResetToLog(STqOffsetVal* pOffsetVal, int64_t ve
|
|||
|
||||
int32_t tEncodeSTqOffsetVal(SEncoder* pEncoder, const STqOffsetVal* pOffsetVal);
|
||||
int32_t tDecodeSTqOffsetVal(SDecoder* pDecoder, STqOffsetVal* pOffsetVal);
|
||||
int32_t 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);
|
||||
int32_t tOffsetCopy(STqOffsetVal* pLeft, const STqOffsetVal* pRight);
|
||||
void tOffsetDestroy(void* pVal);
|
||||
|
|
|
@ -201,7 +201,7 @@ void qStreamSetOpen(qTaskInfo_t tinfo);
|
|||
|
||||
void qStreamSetSourceExcluded(qTaskInfo_t tinfo, int8_t sourceExcluded);
|
||||
|
||||
void qStreamExtractOffset(qTaskInfo_t tinfo, STqOffsetVal* pOffset);
|
||||
int32_t qStreamExtractOffset(qTaskInfo_t tinfo, STqOffsetVal* pOffset);
|
||||
|
||||
SMqBatchMetaRsp* qStreamExtractMetaMsg(qTaskInfo_t tinfo);
|
||||
|
||||
|
|
|
@ -682,13 +682,13 @@ void streamTaskCleanupCheckInfo(STaskCheckInfo* pInfo);
|
|||
// fill-history task
|
||||
int32_t streamLaunchFillHistoryTask(SStreamTask* pTask);
|
||||
int32_t streamStartScanHistoryAsync(SStreamTask* pTask, int8_t igUntreated);
|
||||
int32_t streamExecScanHistoryInFuture(SStreamTask* pTask, int32_t idleDuration);
|
||||
void streamExecScanHistoryInFuture(SStreamTask* pTask, int32_t idleDuration);
|
||||
bool streamHistoryTaskSetVerRangeStep2(SStreamTask* pTask, int64_t latestVer);
|
||||
|
||||
// checkpoint related
|
||||
void streamTaskGetActiveCheckpointInfo(const SStreamTask* pTask, int32_t* pTransId, int64_t* pCheckpointId);
|
||||
int32_t streamTaskSetActiveCheckpointInfo(SStreamTask* pTask, int64_t activeCheckpointId);
|
||||
int32_t streamTaskSetFailedChkptInfo(SStreamTask* pTask, int32_t transId, int64_t checkpointId);
|
||||
void streamTaskSetFailedChkptInfo(SStreamTask* pTask, int32_t transId, int64_t checkpointId);
|
||||
bool streamTaskAlreadySendTrigger(SStreamTask* pTask, int32_t downstreamNodeId);
|
||||
void streamTaskGetTriggerRecvStatus(SStreamTask* pTask, int32_t* pRecved, int32_t* pTotal);
|
||||
void streamTaskInitTriggerDispatchInfo(SStreamTask* pTask);
|
||||
|
|
|
@ -164,13 +164,13 @@ int rpcRegisterBrokenLinkArg(SRpcMsg *msg);
|
|||
int rpcReleaseHandle(void *handle, int8_t type); // just release conn to rpc instance, no close sock
|
||||
|
||||
// These functions will not be called in the child process
|
||||
int rpcSendRequestWithCtx(void *thandle, const SEpSet *pEpSet, SRpcMsg *pMsg, int64_t *rid, SRpcCtx *ctx);
|
||||
int rpcSendRecv(void *shandle, SEpSet *pEpSet, SRpcMsg *pReq, SRpcMsg *pRsp);
|
||||
int rpcSendRecvWithTimeout(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pRsp, int8_t *epUpdated,
|
||||
int32_t timeoutMs);
|
||||
int rpcSetDefaultAddr(void *thandle, const char *ip, const char *fqdn);
|
||||
void *rpcAllocHandle();
|
||||
void rpcSetIpWhite(void *thandl, void *arg);
|
||||
int rpcSendRequestWithCtx(void *thandle, const SEpSet *pEpSet, SRpcMsg *pMsg, int64_t *rid, SRpcCtx *ctx);
|
||||
int rpcSendRecv(void *shandle, SEpSet *pEpSet, SRpcMsg *pReq, SRpcMsg *pRsp);
|
||||
int rpcSendRecvWithTimeout(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pRsp, int8_t *epUpdated,
|
||||
int32_t timeoutMs);
|
||||
int rpcSetDefaultAddr(void *thandle, const char *ip, const char *fqdn);
|
||||
void *rpcAllocHandle();
|
||||
int32_t rpcSetIpWhite(void *thandl, void *arg);
|
||||
|
||||
int32_t rpcUtilSIpRangeToStr(SIpV4Range *pRange, char *buf);
|
||||
|
||||
|
|
|
@ -90,6 +90,8 @@ int32_t taosGetErrSize();
|
|||
#define TSDB_CODE_RPC_NETWORK_ERROR TAOS_DEF_ERROR_CODE(0, 0x0023)
|
||||
#define TSDB_CODE_RPC_NETWORK_BUSY TAOS_DEF_ERROR_CODE(0, 0x0024)
|
||||
#define TSDB_CODE_HTTP_MODULE_QUIT TAOS_DEF_ERROR_CODE(0, 0x0025)
|
||||
#define TSDB_CODE_RPC_MODULE_QUIT TAOS_DEF_ERROR_CODE(0, 0x0026)
|
||||
#define TSDB_CODE_RPC_ASYNC_MODULE_QUIT TAOS_DEF_ERROR_CODE(0, 0x0027)
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -116,7 +116,7 @@ static FORCE_INLINE int32_t tarray2SortInsert(void *arr, const void *elePtr, int
|
|||
if ((cb) && (a)->size > 0) { \
|
||||
TArray2Cb cb_ = (TArray2Cb)(cb); \
|
||||
for (int32_t i = 0; i < (a)->size; ++i) { \
|
||||
cb_((a)->data + i); \
|
||||
(void)cb_((a)->data + i); \
|
||||
} \
|
||||
} \
|
||||
(a)->size = 0; \
|
||||
|
|
|
@ -84,7 +84,7 @@ int32_t taosWTryLockLatch(SRWLatch *pLatch);
|
|||
int32_t old_ = atomic_add_fetch_32((x), 0); \
|
||||
if (old_ & 0x00000001) { \
|
||||
if (i_ % 1000 == 0) { \
|
||||
sched_yield(); \
|
||||
(void)sched_yield(); \
|
||||
} \
|
||||
continue; \
|
||||
}
|
||||
|
@ -98,9 +98,9 @@ int32_t taosWTryLockLatch(SRWLatch *pLatch);
|
|||
#define taosCorBeginWrite(x) \
|
||||
taosCorBeginRead(x) if (atomic_val_compare_exchange_32((x), old_, old_ + 1) != old_) { continue; }
|
||||
|
||||
#define taosCorEndWrite(x) \
|
||||
atomic_add_fetch_32((x), 1); \
|
||||
break; \
|
||||
#define taosCorEndWrite(x) \
|
||||
(void)atomic_add_fetch_32((x), 1); \
|
||||
break; \
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -85,7 +85,6 @@ void taos_cleanup(void) {
|
|||
tscWarn("failed to close clientReqRefPool");
|
||||
}
|
||||
|
||||
DestroyRegexCache();
|
||||
rpcCleanup();
|
||||
tscDebug("rpc cleanup");
|
||||
|
||||
|
@ -93,6 +92,8 @@ void taos_cleanup(void) {
|
|||
|
||||
tmqMgmtClose();
|
||||
|
||||
DestroyRegexCache();
|
||||
|
||||
tscInfo("all local resources released");
|
||||
taosCleanupCfg();
|
||||
taosCloseLog();
|
||||
|
|
|
@ -489,6 +489,7 @@ static int32_t monitorReadSend(int64_t clusterId, TdFilePtr pFile, int64_t* offs
|
|||
SAppInstInfo* pInst = getAppInstByClusterId(clusterId);
|
||||
if (pInst == NULL) {
|
||||
tscError("failed to get app instance by clusterId:%" PRId64, clusterId);
|
||||
taosMemoryFree(fileName);
|
||||
return terrno;
|
||||
}
|
||||
SEpSet ep = getEpSet_s(&pInst->mgmtEp);
|
||||
|
|
|
@ -32,10 +32,10 @@ static void removeEmptyDir() {
|
|||
empty = false;
|
||||
}
|
||||
if (empty) taosRemoveDir(filename);
|
||||
taosCloseDir(&pDirTmp);
|
||||
(void)taosCloseDir(&pDirTmp);
|
||||
}
|
||||
|
||||
taosCloseDir(&pDir);
|
||||
(void)taosCloseDir(&pDir);
|
||||
}
|
||||
|
||||
#ifdef WINDOWS
|
||||
|
@ -92,12 +92,12 @@ static int32_t generateConfigFile(char* confDir) {
|
|||
uDebug("[rsync] conf:%s", confContent);
|
||||
if (taosWriteFile(pFile, confContent, strlen(confContent)) <= 0) {
|
||||
uError("[rsync] write conf file error," ERRNO_ERR_FORMAT, ERRNO_ERR_DATA);
|
||||
taosCloseFile(&pFile);
|
||||
(void)taosCloseFile(&pFile);
|
||||
code = TAOS_SYSTEM_ERROR(errno);
|
||||
return code;
|
||||
}
|
||||
|
||||
taosCloseFile(&pFile);
|
||||
(void)taosCloseFile(&pFile);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -238,7 +238,7 @@ const char* columnLevelStr(uint8_t type) {
|
|||
|
||||
bool checkColumnEncode(char encode[TSDB_CL_COMPRESS_OPTION_LEN]) {
|
||||
if (0 == strlen(encode)) return true;
|
||||
strtolower(encode, encode);
|
||||
(void)strtolower(encode, encode);
|
||||
for (int i = 0; i < supportedEncodeNum; ++i) {
|
||||
if (0 == strcmp((const char*)encode, supportedEncode[i])) {
|
||||
return true;
|
||||
|
@ -255,7 +255,7 @@ bool checkColumnEncodeOrSetDefault(uint8_t type, char encode[TSDB_CL_COMPRESS_OP
|
|||
}
|
||||
bool checkColumnCompress(char compress[TSDB_CL_COMPRESS_OPTION_LEN]) {
|
||||
if (0 == strlen(compress)) return true;
|
||||
strtolower(compress, compress);
|
||||
(void)strtolower(compress, compress);
|
||||
for (int i = 0; i < supportedCompressNum; ++i) {
|
||||
if (0 == strcmp((const char*)compress, supportedCompress[i])) {
|
||||
return true;
|
||||
|
@ -273,7 +273,7 @@ bool checkColumnCompressOrSetDefault(uint8_t type, char compress[TSDB_CL_COMPRES
|
|||
}
|
||||
bool checkColumnLevel(char level[TSDB_CL_COMPRESS_OPTION_LEN]) {
|
||||
if (0 == strlen(level)) return true;
|
||||
strtolower(level, level);
|
||||
(void)strtolower(level, level);
|
||||
if (1 == strlen(level)) {
|
||||
if ('h' == level[0] || 'm' == level[0] || 'l' == level[0]) return true;
|
||||
} else {
|
||||
|
|
|
@ -706,7 +706,10 @@ static int32_t tRowMergeImpl(SArray *aRowP, STSchema *pTSchema, int32_t iStart,
|
|||
if (code) goto _exit;
|
||||
|
||||
taosArrayRemoveBatch(aRowP, iStart, nRow, (FDelete)tRowPDestroy);
|
||||
taosArrayInsert(aRowP, iStart, &pRow);
|
||||
if (taosArrayInsert(aRowP, iStart, &pRow) == NULL) {
|
||||
code = terrno;
|
||||
goto _exit;
|
||||
}
|
||||
|
||||
_exit:
|
||||
if (aIter) {
|
||||
|
@ -1708,7 +1711,7 @@ bool tTagGet(const STag *pTag, STagVal *pTagVal) {
|
|||
offset = pTag->idx[midx];
|
||||
}
|
||||
|
||||
tGetTagVal(p + offset, &tv, isJson);
|
||||
(void)tGetTagVal(p + offset, &tv, isJson);
|
||||
if (isJson) {
|
||||
c = tTagValJsonCmprFn(pTagVal, &tv);
|
||||
} else {
|
||||
|
@ -1758,7 +1761,7 @@ int32_t tTagToValArray(const STag *pTag, SArray **ppArray) {
|
|||
} else {
|
||||
offset = pTag->idx[iTag];
|
||||
}
|
||||
tGetTagVal(p + offset, &tv, pTag->flags & TD_TAG_JSON);
|
||||
(void)tGetTagVal(p + offset, &tv, pTag->flags & TD_TAG_JSON);
|
||||
if (taosArrayPush(*ppArray, &tv) == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
goto _err;
|
||||
|
@ -1788,7 +1791,7 @@ void tTagSetCid(const STag *pTag, int16_t iTag, int16_t cid) {
|
|||
offset = pTag->idx[iTag];
|
||||
}
|
||||
|
||||
tPutI16v(p + offset, cid);
|
||||
(void)tPutI16v(p + offset, cid);
|
||||
}
|
||||
|
||||
// STSchema ========================================
|
||||
|
@ -3152,16 +3155,16 @@ static int32_t tColDataCopyRowSingleCol(SColData *pFromColData, int32_t iFromRow
|
|||
SET_BIT1(pToColData->pBitMap, iToRow, GET_BIT1(pFromColData->pBitMap, iFromRow));
|
||||
} break;
|
||||
case HAS_VALUE: {
|
||||
tColDataCopyRowCell(pFromColData, iFromRow, pToColData, iToRow);
|
||||
(void)tColDataCopyRowCell(pFromColData, iFromRow, pToColData, iToRow);
|
||||
} break;
|
||||
case (HAS_VALUE | HAS_NONE):
|
||||
case (HAS_VALUE | HAS_NULL): {
|
||||
SET_BIT1(pToColData->pBitMap, iToRow, GET_BIT1(pFromColData->pBitMap, iFromRow));
|
||||
tColDataCopyRowCell(pFromColData, iFromRow, pToColData, iToRow);
|
||||
(void)tColDataCopyRowCell(pFromColData, iFromRow, pToColData, iToRow);
|
||||
} break;
|
||||
case (HAS_VALUE | HAS_NULL | HAS_NONE): {
|
||||
SET_BIT2(pToColData->pBitMap, iToRow, GET_BIT2(pFromColData->pBitMap, iFromRow));
|
||||
tColDataCopyRowCell(pFromColData, iFromRow, pToColData, iToRow);
|
||||
(void)tColDataCopyRowCell(pFromColData, iFromRow, pToColData, iToRow);
|
||||
} break;
|
||||
default:
|
||||
return -1;
|
||||
|
@ -3235,24 +3238,24 @@ static int32_t tColDataMergeSortMerge(SColData *aColData, int32_t start, int32_t
|
|||
tColDataArrGetRowKey(aColData, nColData, j, &keyj);
|
||||
while (i <= mid && j <= end) {
|
||||
if (tRowKeyCompare(&keyi, &keyj) <= 0) {
|
||||
tColDataCopyRowAppend(aColData, i++, aDstColData, nColData);
|
||||
(void)tColDataCopyRowAppend(aColData, i++, aDstColData, nColData);
|
||||
tColDataArrGetRowKey(aColData, nColData, i, &keyi);
|
||||
} else {
|
||||
tColDataCopyRowAppend(aColData, j++, aDstColData, nColData);
|
||||
(void)tColDataCopyRowAppend(aColData, j++, aDstColData, nColData);
|
||||
tColDataArrGetRowKey(aColData, nColData, j, &keyj);
|
||||
}
|
||||
}
|
||||
|
||||
while (i <= mid) {
|
||||
tColDataCopyRowAppend(aColData, i++, aDstColData, nColData);
|
||||
(void)tColDataCopyRowAppend(aColData, i++, aDstColData, nColData);
|
||||
}
|
||||
|
||||
while (j <= end) {
|
||||
tColDataCopyRowAppend(aColData, j++, aDstColData, nColData);
|
||||
(void)tColDataCopyRowAppend(aColData, j++, aDstColData, nColData);
|
||||
}
|
||||
|
||||
for (i = start, k = 0; i <= end; ++i, ++k) {
|
||||
tColDataCopyRow(aDstColData, k, aColData, i, nColData);
|
||||
(void)tColDataCopyRow(aDstColData, k, aColData, i, nColData);
|
||||
}
|
||||
|
||||
if (aDstColData) {
|
||||
|
@ -3551,7 +3554,7 @@ void tColDataSortMerge(SArray *colDataArr) {
|
|||
|
||||
// sort -------
|
||||
if (doSort) {
|
||||
tColDataSort(aColData, nColData);
|
||||
(void)tColDataSort(aColData, nColData);
|
||||
}
|
||||
|
||||
if (doMerge != 1) {
|
||||
|
@ -4209,17 +4212,17 @@ int32_t tValueColumnGet(SValueColumn *valCol, int32_t idx, SValue *value) {
|
|||
int32_t offset, nextOffset;
|
||||
SBufferReader reader = BUFFER_READER_INITIALIZER(idx * sizeof(offset), &valCol->offsets);
|
||||
|
||||
tBufferGetI32(&reader, &offset);
|
||||
(void)tBufferGetI32(&reader, &offset);
|
||||
if (idx == valCol->numOfValues - 1) {
|
||||
nextOffset = tBufferGetSize(&valCol->data);
|
||||
} else {
|
||||
tBufferGetI32(&reader, &nextOffset);
|
||||
(void)tBufferGetI32(&reader, &nextOffset);
|
||||
}
|
||||
value->nData = nextOffset - offset;
|
||||
value->pData = (uint8_t *)tBufferGetDataAt(&valCol->data, offset);
|
||||
} else {
|
||||
SBufferReader reader = BUFFER_READER_INITIALIZER(idx * tDataTypes[value->type].bytes, &valCol->data);
|
||||
tBufferGet(&reader, tDataTypes[value->type].bytes, &value->val);
|
||||
(void)tBufferGet(&reader, tDataTypes[value->type].bytes, &value->val);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -4269,7 +4272,7 @@ int32_t tValueColumnDecompress(void *input, const SValueColumnCompressInfo *info
|
|||
SBuffer *assist) {
|
||||
int32_t code;
|
||||
|
||||
tValueColumnClear(valCol);
|
||||
(void)tValueColumnClear(valCol);
|
||||
valCol->type = info->type;
|
||||
// offset
|
||||
if (IS_VAR_DATA_TYPE(valCol->type)) {
|
||||
|
|
|
@ -396,8 +396,9 @@ struct SConfig *taosGetCfg() { return tsCfg; }
|
|||
|
||||
static int32_t taosLoadCfg(SConfig *pCfg, const char **envCmd, const char *inputCfgDir, const char *envFile,
|
||||
char *apolloUrl) {
|
||||
char cfgDir[PATH_MAX] = {0};
|
||||
char cfgFile[PATH_MAX + 100] = {0};
|
||||
int32_t code = 0;
|
||||
char cfgDir[PATH_MAX] = {0};
|
||||
char cfgFile[PATH_MAX + 100] = {0};
|
||||
|
||||
TAOS_CHECK_RETURN(taosExpandDir(inputCfgDir, cfgDir, PATH_MAX));
|
||||
char lastC = cfgDir[strlen(cfgDir) - 1];
|
||||
|
@ -424,32 +425,32 @@ static int32_t taosLoadCfg(SConfig *pCfg, const char **envCmd, const char *input
|
|||
}
|
||||
|
||||
if (apolloUrl != NULL && apolloUrl[0] == '\0') {
|
||||
TAOS_CHECK_RETURN(cfgGetApollUrl(envCmd, envFile, apolloUrl));
|
||||
(void)(cfgGetApollUrl(envCmd, envFile, apolloUrl));
|
||||
}
|
||||
|
||||
if (cfgLoad(pCfg, CFG_STYPE_APOLLO_URL, apolloUrl) != 0) {
|
||||
uError("failed to load from apollo url:%s since %s", apolloUrl, terrstr());
|
||||
TAOS_RETURN(TSDB_CODE_INVALID_CFG);
|
||||
if ((code = cfgLoad(pCfg, CFG_STYPE_APOLLO_URL, apolloUrl)) != 0) {
|
||||
uError("failed to load from apollo url:%s since %s", apolloUrl, tstrerror(code));
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
|
||||
if (cfgLoad(pCfg, CFG_STYPE_CFG_FILE, cfgFile) != 0) {
|
||||
uError("failed to load from cfg file:%s since %s", cfgFile, terrstr());
|
||||
TAOS_RETURN(TSDB_CODE_INVALID_CFG);
|
||||
if ((code = cfgLoad(pCfg, CFG_STYPE_CFG_FILE, cfgFile)) != 0) {
|
||||
uError("failed to load from cfg file:%s since %s", cfgFile, tstrerror(code));
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
|
||||
if (cfgLoad(pCfg, CFG_STYPE_ENV_FILE, envFile) != 0) {
|
||||
uError("failed to load from env file:%s since %s", envFile, terrstr());
|
||||
TAOS_RETURN(TSDB_CODE_INVALID_CFG);
|
||||
if ((code = cfgLoad(pCfg, CFG_STYPE_ENV_FILE, envFile)) != 0) {
|
||||
uError("failed to load from env file:%s since %s", envFile, tstrerror(code));
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
|
||||
if (cfgLoad(pCfg, CFG_STYPE_ENV_VAR, NULL) != 0) {
|
||||
uError("failed to load from global env variables since %s", terrstr());
|
||||
TAOS_RETURN(TSDB_CODE_INVALID_CFG);
|
||||
if ((code = cfgLoad(pCfg, CFG_STYPE_ENV_VAR, NULL)) != 0) {
|
||||
uError("failed to load from global env variables since %s", tstrerror(code));
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
|
||||
if (cfgLoad(pCfg, CFG_STYPE_ENV_CMD, envCmd) != 0) {
|
||||
uError("failed to load from cmd env variables since %s", terrstr());
|
||||
TAOS_RETURN(TSDB_CODE_INVALID_CFG);
|
||||
if ((code = cfgLoad(pCfg, CFG_STYPE_ENV_CMD, envCmd)) != 0) {
|
||||
uError("failed to load from cmd env variables since %s", tstrerror(code));
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
|
||||
TAOS_RETURN(TSDB_CODE_SUCCESS);
|
||||
|
@ -1280,12 +1281,12 @@ int32_t taosCreateLog(const char *logname, int32_t logFileNum, const char *cfgDi
|
|||
}
|
||||
|
||||
if ((code = taosLoadCfg(pCfg, envCmd, cfgDir, envFile, apolloUrl)) != TSDB_CODE_SUCCESS) {
|
||||
printf("failed to load cfg since %s", tstrerror(code));
|
||||
printf("failed to load cfg since %s\n", tstrerror(code));
|
||||
goto _exit;
|
||||
}
|
||||
|
||||
if ((code = cfgLoadFromArray(pCfg, pArgs)) != TSDB_CODE_SUCCESS) {
|
||||
printf("failed to load cfg from array since %s", tstrerror(code));
|
||||
printf("failed to load cfg from array since %s\n", tstrerror(code));
|
||||
goto _exit;
|
||||
}
|
||||
|
||||
|
@ -1302,12 +1303,12 @@ int32_t taosCreateLog(const char *logname, int32_t logFileNum, const char *cfgDi
|
|||
TAOS_CHECK_RETURN(taosSetAllDebugFlag(pCfg, pDebugItem->i32));
|
||||
|
||||
if ((code = taosMulModeMkDir(tsLogDir, 0777, true)) != TSDB_CODE_SUCCESS) {
|
||||
printf("failed to create dir:%s since %s", tsLogDir, tstrerror(code));
|
||||
printf("failed to create dir:%s since %s\n", tsLogDir, tstrerror(code));
|
||||
goto _exit;
|
||||
}
|
||||
|
||||
if ((code = taosInitLog(logname, logFileNum)) != 0) {
|
||||
printf("failed to init log file since %s", terrstr());
|
||||
printf("failed to init log file since %s\n", tstrerror(code));
|
||||
goto _exit;
|
||||
}
|
||||
|
||||
|
@ -1329,12 +1330,12 @@ int32_t taosReadDataFolder(const char *cfgDir, const char **envCmd, const char *
|
|||
if (cfgAddInt32(pCfg, "dDebugFlag", dDebugFlag, 0, 255, CFG_SCOPE_SERVER, CFG_DYN_SERVER) != 0) return -1;
|
||||
|
||||
if ((code = taosLoadCfg(pCfg, envCmd, cfgDir, envFile, apolloUrl)) != 0) {
|
||||
printf("failed to load cfg since %s", terrstr());
|
||||
printf("failed to load cfg since %s\n", tstrerror(code));
|
||||
goto _exit;
|
||||
}
|
||||
|
||||
if ((code = cfgLoadFromArray(pCfg, pArgs)) != 0) {
|
||||
printf("failed to load cfg from array since %s", terrstr());
|
||||
printf("failed to load cfg from array since %s\n", tstrerror(code));
|
||||
goto _exit;
|
||||
}
|
||||
|
||||
|
|
|
@ -522,7 +522,7 @@ int32_t tDeserializeSClientHbBatchReq(void *buf, int32_t bufLen, SClientHbBatchR
|
|||
}
|
||||
|
||||
if (!tDecodeIsEnd(&decoder)) {
|
||||
tDecodeI64(&decoder, &pBatchReq->ipWhiteList);
|
||||
if (tDecodeI64(&decoder, &pBatchReq->ipWhiteList) < 0) return -1;
|
||||
}
|
||||
|
||||
tEndDecode(&decoder);
|
||||
|
@ -1764,23 +1764,33 @@ int32_t tDeserializeSUpdateIpWhite(void *buf, int32_t bufLen, SUpdateIpWhite *pR
|
|||
return 0;
|
||||
}
|
||||
void tFreeSUpdateIpWhiteReq(SUpdateIpWhite *pReq) {
|
||||
for (int i = 0; i < pReq->numOfUser; i++) {
|
||||
SUpdateUserIpWhite *pUserWhite = &pReq->pUserIpWhite[i];
|
||||
taosMemoryFree(pUserWhite->pIpRanges);
|
||||
if (pReq == NULL) return;
|
||||
|
||||
if (pReq->pUserIpWhite) {
|
||||
for (int i = 0; i < pReq->numOfUser; i++) {
|
||||
SUpdateUserIpWhite *pUserWhite = &pReq->pUserIpWhite[i];
|
||||
taosMemoryFree(pUserWhite->pIpRanges);
|
||||
}
|
||||
}
|
||||
taosMemoryFree(pReq->pUserIpWhite);
|
||||
// impl later
|
||||
return;
|
||||
}
|
||||
SUpdateIpWhite *cloneSUpdateIpWhiteReq(SUpdateIpWhite *pReq) {
|
||||
int32_t cloneSUpdateIpWhiteReq(SUpdateIpWhite *pReq, SUpdateIpWhite **pUpdateMsg) {
|
||||
int32_t code = 0;
|
||||
if (pReq == NULL) {
|
||||
return 0;
|
||||
}
|
||||
SUpdateIpWhite *pClone = taosMemoryCalloc(1, sizeof(SUpdateIpWhite));
|
||||
if (pClone == NULL) return NULL;
|
||||
if (pClone == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
pClone->numOfUser = pReq->numOfUser;
|
||||
pClone->ver = pReq->ver;
|
||||
if ((pClone->pUserIpWhite = taosMemoryCalloc(1, sizeof(SUpdateUserIpWhite) * pReq->numOfUser)) == NULL) {
|
||||
pClone->pUserIpWhite = taosMemoryCalloc(1, sizeof(SUpdateUserIpWhite) * pReq->numOfUser);
|
||||
if (pClone->pUserIpWhite == NULL) {
|
||||
taosMemoryFree(pClone);
|
||||
return NULL;
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
for (int i = 0; i < pReq->numOfUser; i++) {
|
||||
|
@ -1792,17 +1802,21 @@ SUpdateIpWhite *cloneSUpdateIpWhiteReq(SUpdateIpWhite *pReq) {
|
|||
pNew->numOfRange = pOld->numOfRange;
|
||||
|
||||
int32_t sz = pOld->numOfRange * sizeof(SIpV4Range);
|
||||
if ((pNew->pIpRanges = taosMemoryCalloc(1, sz)) == NULL) {
|
||||
for (int j = 0; j < i; j++) {
|
||||
taosMemoryFree(pClone->pUserIpWhite[j].pIpRanges);
|
||||
}
|
||||
taosMemoryFree(pClone->pUserIpWhite);
|
||||
taosMemoryFree(pClone);
|
||||
return NULL;
|
||||
pNew->pIpRanges = taosMemoryCalloc(1, sz);
|
||||
if (pNew->pIpRanges == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
break;
|
||||
}
|
||||
memcpy(pNew->pIpRanges, pOld->pIpRanges, sz);
|
||||
}
|
||||
return pClone;
|
||||
_return:
|
||||
if (code < 0) {
|
||||
tFreeSUpdateIpWhiteReq(pClone);
|
||||
taosMemoryFree(pClone);
|
||||
} else {
|
||||
*pUpdateMsg = pClone;
|
||||
}
|
||||
return code;
|
||||
}
|
||||
int32_t tSerializeRetrieveIpWhite(void *buf, int32_t bufLen, SRetrieveIpWhiteReq *pReq) {
|
||||
SEncoder encoder = {0};
|
||||
|
@ -2149,21 +2163,21 @@ int32_t tDeserializeSGetUserAuthRspImpl(SDecoder *pDecoder, SGetUserAuthRsp *pRs
|
|||
char db[TSDB_DB_FNAME_LEN] = {0};
|
||||
if (tDecodeCStrTo(pDecoder, db) < 0) goto _err;
|
||||
int32_t len = strlen(db);
|
||||
taosHashPut(pRsp->createdDbs, db, len + 1, db, len + 1);
|
||||
if (taosHashPut(pRsp->createdDbs, db, len + 1, db, len + 1) < 0) goto _err;
|
||||
}
|
||||
|
||||
for (int32_t i = 0; i < numOfReadDbs; ++i) {
|
||||
char db[TSDB_DB_FNAME_LEN] = {0};
|
||||
if (tDecodeCStrTo(pDecoder, db) < 0) goto _err;
|
||||
int32_t len = strlen(db);
|
||||
taosHashPut(pRsp->readDbs, db, len + 1, db, len + 1);
|
||||
if (taosHashPut(pRsp->readDbs, db, len + 1, db, len + 1) < 0) goto _err;
|
||||
}
|
||||
|
||||
for (int32_t i = 0; i < numOfWriteDbs; ++i) {
|
||||
char db[TSDB_DB_FNAME_LEN] = {0};
|
||||
if (tDecodeCStrTo(pDecoder, db) < 0) goto _err;
|
||||
int32_t len = strlen(db);
|
||||
taosHashPut(pRsp->writeDbs, db, len + 1, db, len + 1);
|
||||
if (taosHashPut(pRsp->writeDbs, db, len + 1, db, len + 1) < 0) goto _err;
|
||||
}
|
||||
|
||||
if (!tDecodeIsEnd(pDecoder)) {
|
||||
|
@ -2195,7 +2209,7 @@ int32_t tDeserializeSGetUserAuthRspImpl(SDecoder *pDecoder, SGetUserAuthRsp *pRs
|
|||
if ((value = taosMemoryCalloc(valuelen + 1, sizeof(char))) == NULL) goto _err;
|
||||
if (tDecodeCStrTo(pDecoder, value) < 0) goto _err;
|
||||
|
||||
taosHashPut(pRsp->readTbs, key, keyLen, value, valuelen + 1);
|
||||
if (taosHashPut(pRsp->readTbs, key, keyLen, value, valuelen + 1) < 0) goto _err;
|
||||
|
||||
taosMemoryFreeClear(key);
|
||||
taosMemoryFreeClear(value);
|
||||
|
@ -2214,7 +2228,7 @@ int32_t tDeserializeSGetUserAuthRspImpl(SDecoder *pDecoder, SGetUserAuthRsp *pRs
|
|||
if ((value = taosMemoryCalloc(valuelen + 1, sizeof(char))) == NULL) goto _err;
|
||||
if (tDecodeCStrTo(pDecoder, value) < 0) goto _err;
|
||||
|
||||
taosHashPut(pRsp->writeTbs, key, keyLen, value, valuelen + 1);
|
||||
if (taosHashPut(pRsp->writeTbs, key, keyLen, value, valuelen + 1) < 0) goto _err;
|
||||
|
||||
taosMemoryFreeClear(key);
|
||||
taosMemoryFreeClear(value);
|
||||
|
@ -2233,7 +2247,7 @@ int32_t tDeserializeSGetUserAuthRspImpl(SDecoder *pDecoder, SGetUserAuthRsp *pRs
|
|||
if ((value = taosMemoryCalloc(valuelen + 1, sizeof(char))) == NULL) goto _err;
|
||||
if (tDecodeCStrTo(pDecoder, value) < 0) goto _err;
|
||||
|
||||
taosHashPut(pRsp->alterTbs, key, keyLen, value, valuelen + 1);
|
||||
if (taosHashPut(pRsp->alterTbs, key, keyLen, value, valuelen + 1) < 0) goto _err;
|
||||
|
||||
taosMemoryFreeClear(key);
|
||||
taosMemoryFreeClear(value);
|
||||
|
@ -2252,7 +2266,7 @@ int32_t tDeserializeSGetUserAuthRspImpl(SDecoder *pDecoder, SGetUserAuthRsp *pRs
|
|||
if ((value = taosMemoryCalloc(valuelen + 1, sizeof(char))) == NULL) goto _err;
|
||||
if (tDecodeCStrTo(pDecoder, value) < 0) goto _err;
|
||||
|
||||
taosHashPut(pRsp->readViews, key, keyLen, value, valuelen + 1);
|
||||
if (taosHashPut(pRsp->readViews, key, keyLen, value, valuelen + 1) < 0) goto _err;
|
||||
|
||||
taosMemoryFreeClear(key);
|
||||
taosMemoryFreeClear(value);
|
||||
|
@ -2271,7 +2285,7 @@ int32_t tDeserializeSGetUserAuthRspImpl(SDecoder *pDecoder, SGetUserAuthRsp *pRs
|
|||
if ((value = taosMemoryCalloc(valuelen + 1, sizeof(char))) == NULL) goto _err;
|
||||
if (tDecodeCStrTo(pDecoder, value) < 0) goto _err;
|
||||
|
||||
taosHashPut(pRsp->writeViews, key, keyLen, value, valuelen + 1);
|
||||
if (taosHashPut(pRsp->writeViews, key, keyLen, value, valuelen + 1) < 0) goto _err;
|
||||
|
||||
taosMemoryFreeClear(key);
|
||||
taosMemoryFreeClear(value);
|
||||
|
@ -2290,7 +2304,7 @@ int32_t tDeserializeSGetUserAuthRspImpl(SDecoder *pDecoder, SGetUserAuthRsp *pRs
|
|||
if ((value = taosMemoryCalloc(valuelen + 1, sizeof(char))) == NULL) goto _err;
|
||||
if (tDecodeCStrTo(pDecoder, value) < 0) goto _err;
|
||||
|
||||
taosHashPut(pRsp->alterViews, key, keyLen, value, valuelen + 1);
|
||||
if (taosHashPut(pRsp->alterViews, key, keyLen, value, valuelen + 1) < 0) goto _err;
|
||||
|
||||
taosMemoryFreeClear(key);
|
||||
taosMemoryFreeClear(value);
|
||||
|
@ -2306,7 +2320,7 @@ int32_t tDeserializeSGetUserAuthRspImpl(SDecoder *pDecoder, SGetUserAuthRsp *pRs
|
|||
int32_t ref = 0;
|
||||
if (tDecodeI32(pDecoder, &ref) < 0) goto _err;
|
||||
|
||||
taosHashPut(pRsp->useDbs, key, keyLen, &ref, sizeof(ref));
|
||||
if (taosHashPut(pRsp->useDbs, key, keyLen, &ref, sizeof(ref)) < 0) goto _err;
|
||||
taosMemoryFreeClear(key);
|
||||
}
|
||||
// since 3.0.7.0
|
||||
|
@ -4226,7 +4240,7 @@ int32_t tSerializeSDbCfgRsp(void *buf, int32_t bufLen, const SDbCfgRsp *pRsp) {
|
|||
tEncoderInit(&encoder, buf, bufLen);
|
||||
|
||||
if (tStartEncode(&encoder) < 0) return -1;
|
||||
tSerializeSDbCfgRspImpl(&encoder, pRsp);
|
||||
if (tSerializeSDbCfgRspImpl(&encoder, pRsp) < 0) return -1;
|
||||
tEndEncode(&encoder);
|
||||
int32_t tlen = encoder.pos;
|
||||
tEncoderClear(&encoder);
|
||||
|
@ -7087,7 +7101,7 @@ int32_t tDeserializeSMqSeekReq(void *buf, int32_t bufLen, SMqSeekReq *pReq) {
|
|||
|
||||
if (tStartDecode(&decoder) < 0) return -1;
|
||||
if (tDecodeI64(&decoder, &pReq->consumerId) < 0) return -1;
|
||||
tDecodeCStrTo(&decoder, pReq->subKey);
|
||||
if (tDecodeCStrTo(&decoder, pReq->subKey) < 0) return -1;
|
||||
|
||||
tEndDecode(&decoder);
|
||||
|
||||
|
@ -7342,6 +7356,7 @@ int32_t tSerializeSMqPollReq(void *buf, int32_t bufLen, SMqPollReq *pReq) {
|
|||
if (tEncodeSTqOffsetVal(&encoder, &pReq->reqOffset) < 0) return -1;
|
||||
if (tEncodeI8(&encoder, pReq->enableReplay) < 0) return -1;
|
||||
if (tEncodeI8(&encoder, pReq->sourceExcluded) < 0) return -1;
|
||||
if (tEncodeI8(&encoder, pReq->enableBatchMeta) < 0) return -1;
|
||||
|
||||
tEndEncode(&encoder);
|
||||
|
||||
|
@ -7353,7 +7368,6 @@ int32_t tSerializeSMqPollReq(void *buf, int32_t bufLen, SMqPollReq *pReq) {
|
|||
pHead->vgId = htonl(pReq->head.vgId);
|
||||
pHead->contLen = htonl(tlen + headLen);
|
||||
}
|
||||
if (tEncodeI8(&encoder, pReq->enableBatchMeta) < 0) return -1;
|
||||
|
||||
return tlen + headLen;
|
||||
}
|
||||
|
@ -7801,8 +7815,8 @@ int32_t tEncodeTSma(SEncoder *pCoder, const STSma *pSma) {
|
|||
if (tEncodeCStr(pCoder, pSma->tagsFilter) < 0) return -1;
|
||||
}
|
||||
|
||||
tEncodeSSchemaWrapper(pCoder, &pSma->schemaRow);
|
||||
tEncodeSSchemaWrapper(pCoder, &pSma->schemaTag);
|
||||
if (tEncodeSSchemaWrapper(pCoder, &pSma->schemaRow) < 0) return -1;
|
||||
if (tEncodeSSchemaWrapper(pCoder, &pSma->schemaTag) < 0) return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -7847,8 +7861,8 @@ int32_t tDecodeTSma(SDecoder *pCoder, STSma *pSma, bool deepCopy) {
|
|||
pSma->tagsFilter = NULL;
|
||||
}
|
||||
// only needed in dstVgroup
|
||||
tDecodeSSchemaWrapperEx(pCoder, &pSma->schemaRow);
|
||||
tDecodeSSchemaWrapperEx(pCoder, &pSma->schemaTag);
|
||||
if (tDecodeSSchemaWrapperEx(pCoder, &pSma->schemaRow) < 0) return -1;
|
||||
if (tDecodeSSchemaWrapperEx(pCoder, &pSma->schemaTag) < 0) return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -7856,7 +7870,7 @@ int32_t tDecodeTSma(SDecoder *pCoder, STSma *pSma, bool deepCopy) {
|
|||
int32_t tEncodeSVCreateTSmaReq(SEncoder *pCoder, const SVCreateTSmaReq *pReq) {
|
||||
if (tStartEncode(pCoder) < 0) return -1;
|
||||
|
||||
tEncodeTSma(pCoder, pReq);
|
||||
if (tEncodeTSma(pCoder, pReq) < 0) return -1;
|
||||
|
||||
tEndEncode(pCoder);
|
||||
return 0;
|
||||
|
@ -7865,7 +7879,7 @@ int32_t tEncodeSVCreateTSmaReq(SEncoder *pCoder, const SVCreateTSmaReq *pReq) {
|
|||
int32_t tDecodeSVCreateTSmaReq(SDecoder *pCoder, SVCreateTSmaReq *pReq) {
|
||||
if (tStartDecode(pCoder) < 0) return -1;
|
||||
|
||||
tDecodeTSma(pCoder, pReq, false);
|
||||
if (tDecodeTSma(pCoder, pReq, false) < 0) return -1;
|
||||
|
||||
tEndDecode(pCoder);
|
||||
return 0;
|
||||
|
@ -9180,7 +9194,7 @@ int32_t tDecodeSTqOffsetVal(SDecoder *pDecoder, STqOffsetVal *pOffsetVal) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
int32_t tFormatOffset(char *buf, int32_t maxLen, const STqOffsetVal *pVal) {
|
||||
void tFormatOffset(char *buf, int32_t maxLen, const STqOffsetVal *pVal) {
|
||||
if (pVal->type == TMQ_OFFSET__RESET_NONE) {
|
||||
(void)snprintf(buf, maxLen, "none");
|
||||
} else if (pVal->type == TMQ_OFFSET__RESET_EARLIEST) {
|
||||
|
@ -9192,7 +9206,7 @@ int32_t tFormatOffset(char *buf, int32_t maxLen, const STqOffsetVal *pVal) {
|
|||
} else if (pVal->type == TMQ_OFFSET__SNAPSHOT_DATA || pVal->type == TMQ_OFFSET__SNAPSHOT_META) {
|
||||
if (IS_VAR_DATA_TYPE(pVal->primaryKey.type)) {
|
||||
char *tmp = taosMemoryCalloc(1, pVal->primaryKey.nData + 1);
|
||||
if (tmp == NULL) return terrno;
|
||||
if (tmp == NULL) return;
|
||||
(void)memcpy(tmp, pVal->primaryKey.pData, pVal->primaryKey.nData);
|
||||
(void)snprintf(buf, maxLen, "tsdb:%" PRId64 "|%" PRId64 ",pk type:%d,val:%s", pVal->uid, pVal->ts,
|
||||
pVal->primaryKey.type, tmp);
|
||||
|
@ -9202,8 +9216,6 @@ int32_t tFormatOffset(char *buf, int32_t maxLen, const STqOffsetVal *pVal) {
|
|||
pVal->primaryKey.type, pVal->primaryKey.val);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool tOffsetEqual(const STqOffsetVal *pLeft, const STqOffsetVal *pRight) {
|
||||
|
@ -9230,7 +9242,9 @@ int32_t tOffsetCopy(STqOffsetVal *pLeft, const STqOffsetVal *pRight) {
|
|||
tOffsetDestroy(pLeft);
|
||||
*pLeft = *pRight;
|
||||
if (IS_VAR_DATA_TYPE(pRight->primaryKey.type)) {
|
||||
if ((pLeft->primaryKey.pData = taosMemoryMalloc(pRight->primaryKey.nData)) == NULL) {
|
||||
pLeft->primaryKey.pData = taosMemoryMalloc(pRight->primaryKey.nData);
|
||||
if (pLeft->primaryKey.pData == NULL) {
|
||||
uError("failed to allocate memory for offset");
|
||||
return terrno;
|
||||
}
|
||||
(void)memcpy(pLeft->primaryKey.pData, pRight->primaryKey.pData, pRight->primaryKey.nData);
|
||||
|
@ -10727,7 +10741,7 @@ void tFreeSMDropTbReqOnSingleVg(void *p) {
|
|||
int32_t tSerializeSMDropTbsReq(void *buf, int32_t bufLen, const SMDropTbsReq *pReq) {
|
||||
SEncoder encoder = {0};
|
||||
tEncoderInit(&encoder, buf, bufLen);
|
||||
tStartEncode(&encoder);
|
||||
if (tStartEncode(&encoder) < 0) return -1;
|
||||
int32_t size = pReq->pVgReqs ? pReq->pVgReqs->size : 0;
|
||||
if (tEncodeI32(&encoder, size) < 0) return -1;
|
||||
for (int32_t i = 0; i < size; ++i) {
|
||||
|
@ -10743,7 +10757,7 @@ int32_t tSerializeSMDropTbsReq(void *buf, int32_t bufLen, const SMDropTbsReq *pR
|
|||
int32_t tDeserializeSMDropTbsReq(void *buf, int32_t bufLen, SMDropTbsReq *pReq) {
|
||||
SDecoder decoder = {0};
|
||||
tDecoderInit(&decoder, buf, bufLen);
|
||||
tStartDecode(&decoder);
|
||||
if (tStartDecode(&decoder) < 0) return -1;
|
||||
int32_t size = 0;
|
||||
if (tDecodeI32(&decoder, &size) < 0) return -1;
|
||||
pReq->pVgReqs = taosArrayInit(size, sizeof(SMDropTbReqsOnSingleVg));
|
||||
|
|
|
@ -68,7 +68,7 @@ bool tdSTSRowIterFetch(STSRowIter *pIter, col_id_t colId, col_type_t colType, SC
|
|||
return false;
|
||||
}
|
||||
}
|
||||
tdSTSRowIterGetTpVal(pIter, pCol->type, pCol->offset, pVal);
|
||||
(void)tdSTSRowIterGetTpVal(pIter, pCol->type, pCol->offset, pVal);
|
||||
++pIter->colIdx;
|
||||
} else if (TD_IS_KV_ROW(pIter->pRow)) {
|
||||
return tdSTSRowIterGetKvVal(pIter, colId, &pIter->kvIdx, pVal);
|
||||
|
|
|
@ -80,11 +80,11 @@ static void dmSetAssert(int32_t signum, void *sigInfo, void *context) { tsAssert
|
|||
static void dmStopDnode(int signum, void *sigInfo, void *context) {
|
||||
// taosIgnSignal(SIGUSR1);
|
||||
// taosIgnSignal(SIGUSR2);
|
||||
taosIgnSignal(SIGTERM);
|
||||
taosIgnSignal(SIGHUP);
|
||||
taosIgnSignal(SIGINT);
|
||||
taosIgnSignal(SIGABRT);
|
||||
taosIgnSignal(SIGBREAK);
|
||||
(void)taosIgnSignal(SIGTERM);
|
||||
(void)taosIgnSignal(SIGHUP);
|
||||
(void)taosIgnSignal(SIGINT);
|
||||
(void)taosIgnSignal(SIGABRT);
|
||||
(void)taosIgnSignal(SIGBREAK);
|
||||
|
||||
dInfo("shut down signal is %d", signum);
|
||||
#ifndef WINDOWS
|
||||
|
@ -102,11 +102,11 @@ void dmLogCrash(int signum, void *sigInfo, void *context) {
|
|||
// taosIgnSignal(SIGBREAK);
|
||||
|
||||
#ifndef WINDOWS
|
||||
taosIgnSignal(SIGBUS);
|
||||
(void)taosIgnSignal(SIGBUS);
|
||||
#endif
|
||||
taosIgnSignal(SIGABRT);
|
||||
taosIgnSignal(SIGFPE);
|
||||
taosIgnSignal(SIGSEGV);
|
||||
(void)taosIgnSignal(SIGABRT);
|
||||
(void)taosIgnSignal(SIGFPE);
|
||||
(void)taosIgnSignal(SIGSEGV);
|
||||
|
||||
char *pMsg = NULL;
|
||||
const char *flags = "UTL FATAL ";
|
||||
|
@ -135,23 +135,23 @@ _return:
|
|||
}
|
||||
|
||||
static void dmSetSignalHandle() {
|
||||
taosSetSignal(SIGUSR1, dmSetDebugFlag);
|
||||
taosSetSignal(SIGUSR2, dmSetAssert);
|
||||
taosSetSignal(SIGTERM, dmStopDnode);
|
||||
taosSetSignal(SIGHUP, dmStopDnode);
|
||||
taosSetSignal(SIGINT, dmStopDnode);
|
||||
taosSetSignal(SIGBREAK, dmStopDnode);
|
||||
(void)taosSetSignal(SIGUSR1, dmSetDebugFlag);
|
||||
(void)taosSetSignal(SIGUSR2, dmSetAssert);
|
||||
(void)taosSetSignal(SIGTERM, dmStopDnode);
|
||||
(void)taosSetSignal(SIGHUP, dmStopDnode);
|
||||
(void)taosSetSignal(SIGINT, dmStopDnode);
|
||||
(void)taosSetSignal(SIGBREAK, dmStopDnode);
|
||||
#ifndef WINDOWS
|
||||
taosSetSignal(SIGTSTP, dmStopDnode);
|
||||
taosSetSignal(SIGQUIT, dmStopDnode);
|
||||
(void)taosSetSignal(SIGTSTP, dmStopDnode);
|
||||
(void)taosSetSignal(SIGQUIT, dmStopDnode);
|
||||
#endif
|
||||
|
||||
#ifndef WINDOWS
|
||||
taosSetSignal(SIGBUS, dmLogCrash);
|
||||
(void)taosSetSignal(SIGBUS, dmLogCrash);
|
||||
#endif
|
||||
taosSetSignal(SIGABRT, dmLogCrash);
|
||||
taosSetSignal(SIGFPE, dmLogCrash);
|
||||
taosSetSignal(SIGSEGV, dmLogCrash);
|
||||
(void)taosSetSignal(SIGABRT, dmLogCrash);
|
||||
(void)taosSetSignal(SIGFPE, dmLogCrash);
|
||||
(void)taosSetSignal(SIGSEGV, dmLogCrash);
|
||||
}
|
||||
|
||||
static int32_t dmParseArgs(int32_t argc, char const *argv[]) {
|
||||
|
|
|
@ -21,32 +21,45 @@
|
|||
extern SConfig *tsCfg;
|
||||
|
||||
static void dmUpdateDnodeCfg(SDnodeMgmt *pMgmt, SDnodeCfg *pCfg) {
|
||||
int32_t code = 0;
|
||||
if (pMgmt->pData->dnodeId == 0 || pMgmt->pData->clusterId == 0) {
|
||||
dInfo("set local info, dnodeId:%d clusterId:%" PRId64, pCfg->dnodeId, pCfg->clusterId);
|
||||
taosThreadRwlockWrlock(&pMgmt->pData->lock);
|
||||
(void)taosThreadRwlockWrlock(&pMgmt->pData->lock);
|
||||
pMgmt->pData->dnodeId = pCfg->dnodeId;
|
||||
pMgmt->pData->clusterId = pCfg->clusterId;
|
||||
dmWriteEps(pMgmt->pData);
|
||||
taosThreadRwlockUnlock(&pMgmt->pData->lock);
|
||||
code = dmWriteEps(pMgmt->pData);
|
||||
if (code != 0) {
|
||||
dInfo("failed to set local info, dnodeId:%d clusterId:%" PRId64 " reason:%s", pCfg->dnodeId, pCfg->clusterId,
|
||||
tstrerror(code));
|
||||
}
|
||||
(void)taosThreadRwlockUnlock(&pMgmt->pData->lock);
|
||||
}
|
||||
}
|
||||
static void dmMayShouldUpdateIpWhiteList(SDnodeMgmt *pMgmt, int64_t ver) {
|
||||
int32_t code = 0;
|
||||
dDebug("ip-white-list on dnode ver: %" PRId64 ", status ver: %" PRId64 "", pMgmt->pData->ipWhiteVer, ver);
|
||||
if (pMgmt->pData->ipWhiteVer == ver) {
|
||||
if (ver == 0) {
|
||||
dDebug("disable ip-white-list on dnode ver: %" PRId64 ", status ver: %" PRId64 "", pMgmt->pData->ipWhiteVer, ver);
|
||||
rpcSetIpWhite(pMgmt->msgCb.serverRpc, NULL);
|
||||
// pMgmt->ipWhiteVer = ver;
|
||||
(void)rpcSetIpWhite(pMgmt->msgCb.serverRpc, NULL);
|
||||
}
|
||||
return;
|
||||
}
|
||||
int64_t oldVer = pMgmt->pData->ipWhiteVer;
|
||||
// pMgmt->ipWhiteVer = ver;
|
||||
|
||||
SRetrieveIpWhiteReq req = {.ipWhiteVer = oldVer};
|
||||
int32_t contLen = tSerializeRetrieveIpWhite(NULL, 0, &req);
|
||||
void *pHead = rpcMallocCont(contLen);
|
||||
tSerializeRetrieveIpWhite(pHead, contLen, &req);
|
||||
if (contLen < 0) {
|
||||
dError("failed to serialize ip white list request since: %s", tstrerror(contLen));
|
||||
return;
|
||||
}
|
||||
void *pHead = rpcMallocCont(contLen);
|
||||
contLen = tSerializeRetrieveIpWhite(pHead, contLen, &req);
|
||||
if (contLen < 0) {
|
||||
rpcFreeCont(pHead);
|
||||
dError("failed to serialize ip white list request since:%s", tstrerror(contLen));
|
||||
return;
|
||||
}
|
||||
|
||||
SRpcMsg rpcMsg = {.pCont = pHead,
|
||||
.contLen = contLen,
|
||||
|
@ -57,9 +70,12 @@ static void dmMayShouldUpdateIpWhiteList(SDnodeMgmt *pMgmt, int64_t ver) {
|
|||
.info.handle = 0};
|
||||
SEpSet epset = {0};
|
||||
|
||||
dmGetMnodeEpSet(pMgmt->pData, &epset);
|
||||
(void)dmGetMnodeEpSet(pMgmt->pData, &epset);
|
||||
|
||||
rpcSendRequest(pMgmt->msgCb.clientRpc, &epset, &rpcMsg, NULL);
|
||||
code = rpcSendRequest(pMgmt->msgCb.clientRpc, &epset, &rpcMsg, NULL);
|
||||
if (code != 0) {
|
||||
dError("failed to send retrieve ip white list request since:%s", tstrerror(code));
|
||||
}
|
||||
}
|
||||
static void dmProcessStatusRsp(SDnodeMgmt *pMgmt, SRpcMsg *pRsp) {
|
||||
const STraceId *trace = &pRsp->info.traceId;
|
||||
|
@ -70,9 +86,9 @@ static void dmProcessStatusRsp(SDnodeMgmt *pMgmt, SRpcMsg *pRsp) {
|
|||
dGInfo("dnode:%d, set to dropped since not exist in mnode, statusSeq:%d", pMgmt->pData->dnodeId,
|
||||
pMgmt->statusSeq);
|
||||
pMgmt->pData->dropped = 1;
|
||||
dmWriteEps(pMgmt->pData);
|
||||
(void)dmWriteEps(pMgmt->pData);
|
||||
dInfo("dnode will exit since it is in the dropped state");
|
||||
raise(SIGINT);
|
||||
(void)raise(SIGINT);
|
||||
}
|
||||
} else {
|
||||
SStatusRsp statusRsp = {0};
|
||||
|
@ -93,9 +109,10 @@ static void dmProcessStatusRsp(SDnodeMgmt *pMgmt, SRpcMsg *pRsp) {
|
|||
}
|
||||
|
||||
void dmSendStatusReq(SDnodeMgmt *pMgmt) {
|
||||
int32_t code = 0;
|
||||
SStatusReq req = {0};
|
||||
|
||||
taosThreadRwlockRdlock(&pMgmt->pData->lock);
|
||||
(void)taosThreadRwlockRdlock(&pMgmt->pData->lock);
|
||||
req.sver = tsVersion;
|
||||
req.dnodeVer = pMgmt->pData->dnodeVer;
|
||||
req.dnodeId = pMgmt->pData->dnodeId;
|
||||
|
@ -129,7 +146,7 @@ void dmSendStatusReq(SDnodeMgmt *pMgmt) {
|
|||
memcpy(req.clusterCfg.timezone, tsTimezoneStr, TD_TIMEZONE_LEN);
|
||||
memcpy(req.clusterCfg.locale, tsLocale, TD_LOCALE_LEN);
|
||||
memcpy(req.clusterCfg.charset, tsCharset, TD_LOCALE_LEN);
|
||||
taosThreadRwlockUnlock(&pMgmt->pData->lock);
|
||||
(void)taosThreadRwlockUnlock(&pMgmt->pData->lock);
|
||||
|
||||
SMonVloadInfo vinfo = {0};
|
||||
(*pMgmt->getVnodeLoadsFp)(&vinfo);
|
||||
|
@ -146,8 +163,18 @@ void dmSendStatusReq(SDnodeMgmt *pMgmt) {
|
|||
req.ipWhiteVer = pMgmt->pData->ipWhiteVer;
|
||||
|
||||
int32_t contLen = tSerializeSStatusReq(NULL, 0, &req);
|
||||
void *pHead = rpcMallocCont(contLen);
|
||||
tSerializeSStatusReq(pHead, contLen, &req);
|
||||
if (contLen < 0) {
|
||||
dError("failed to serialize status req since %s", tstrerror(contLen));
|
||||
return;
|
||||
}
|
||||
|
||||
void *pHead = rpcMallocCont(contLen);
|
||||
contLen = tSerializeSStatusReq(pHead, contLen, &req);
|
||||
if (contLen < 0) {
|
||||
rpcFreeCont(pHead);
|
||||
dError("failed to serialize status req since %s", tstrerror(contLen));
|
||||
return;
|
||||
}
|
||||
tFreeSStatusReq(&req);
|
||||
|
||||
SRpcMsg rpcMsg = {.pCont = pHead,
|
||||
|
@ -163,8 +190,15 @@ void dmSendStatusReq(SDnodeMgmt *pMgmt) {
|
|||
|
||||
SEpSet epSet = {0};
|
||||
int8_t epUpdated = 0;
|
||||
dmGetMnodeEpSet(pMgmt->pData, &epSet);
|
||||
rpcSendRecvWithTimeout(pMgmt->msgCb.statusRpc, &epSet, &rpcMsg, &rpcRsp, &epUpdated, tsStatusInterval * 5 * 1000);
|
||||
(void)dmGetMnodeEpSet(pMgmt->pData, &epSet);
|
||||
|
||||
code =
|
||||
rpcSendRecvWithTimeout(pMgmt->msgCb.statusRpc, &epSet, &rpcMsg, &rpcRsp, &epUpdated, tsStatusInterval * 5 * 1000);
|
||||
if (code != 0) {
|
||||
dError("failed to send status req since %s", tstrerror(code));
|
||||
return;
|
||||
}
|
||||
|
||||
if (rpcRsp.code != 0) {
|
||||
dmRotateMnodeEpSet(pMgmt->pData);
|
||||
char tbuf[512];
|
||||
|
@ -193,7 +227,7 @@ void dmSendNotifyReq(SDnodeMgmt *pMgmt, SNotifyReq *pReq) {
|
|||
|
||||
SEpSet epSet = {0};
|
||||
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) {
|
||||
|
|
|
@ -266,22 +266,22 @@ static void *dmCrashReportThreadFp(void *param) {
|
|||
int32_t dmStartStatusThread(SDnodeMgmt *pMgmt) {
|
||||
int32_t code = 0;
|
||||
TdThreadAttr thAttr;
|
||||
taosThreadAttrInit(&thAttr);
|
||||
taosThreadAttrSetDetachState(&thAttr, PTHREAD_CREATE_JOINABLE);
|
||||
(void)taosThreadAttrInit(&thAttr);
|
||||
(void)taosThreadAttrSetDetachState(&thAttr, PTHREAD_CREATE_JOINABLE);
|
||||
if (taosThreadCreate(&pMgmt->statusThread, &thAttr, dmStatusThreadFp, pMgmt) != 0) {
|
||||
code = TAOS_SYSTEM_ERROR(errno);
|
||||
dError("failed to create status thread since %s", tstrerror(code));
|
||||
return code;
|
||||
}
|
||||
|
||||
taosThreadAttrDestroy(&thAttr);
|
||||
(void)taosThreadAttrDestroy(&thAttr);
|
||||
tmsgReportStartup("dnode-status", "initialized");
|
||||
return 0;
|
||||
}
|
||||
|
||||
void dmStopStatusThread(SDnodeMgmt *pMgmt) {
|
||||
if (taosCheckPthreadValid(pMgmt->statusThread)) {
|
||||
taosThreadJoin(pMgmt->statusThread, NULL);
|
||||
(void)taosThreadJoin(pMgmt->statusThread, NULL);
|
||||
taosThreadClear(&pMgmt->statusThread);
|
||||
}
|
||||
}
|
||||
|
@ -289,40 +289,40 @@ void dmStopStatusThread(SDnodeMgmt *pMgmt) {
|
|||
int32_t dmStartNotifyThread(SDnodeMgmt *pMgmt) {
|
||||
int32_t code = 0;
|
||||
TdThreadAttr thAttr;
|
||||
taosThreadAttrInit(&thAttr);
|
||||
taosThreadAttrSetDetachState(&thAttr, PTHREAD_CREATE_JOINABLE);
|
||||
(void)taosThreadAttrInit(&thAttr);
|
||||
(void)taosThreadAttrSetDetachState(&thAttr, PTHREAD_CREATE_JOINABLE);
|
||||
if (taosThreadCreate(&pMgmt->notifyThread, &thAttr, dmNotifyThreadFp, pMgmt) != 0) {
|
||||
code = TAOS_SYSTEM_ERROR(errno);
|
||||
dError("failed to create notify thread since %s", strerror(code));
|
||||
return code;
|
||||
}
|
||||
|
||||
taosThreadAttrDestroy(&thAttr);
|
||||
(void)taosThreadAttrDestroy(&thAttr);
|
||||
tmsgReportStartup("dnode-notify", "initialized");
|
||||
return 0;
|
||||
}
|
||||
|
||||
void dmStopNotifyThread(SDnodeMgmt *pMgmt) {
|
||||
if (taosCheckPthreadValid(pMgmt->notifyThread)) {
|
||||
tsem_post(&dmNotifyHdl.sem);
|
||||
taosThreadJoin(pMgmt->notifyThread, NULL);
|
||||
(void)tsem_post(&dmNotifyHdl.sem);
|
||||
(void)taosThreadJoin(pMgmt->notifyThread, NULL);
|
||||
taosThreadClear(&pMgmt->notifyThread);
|
||||
}
|
||||
tsem_destroy(&dmNotifyHdl.sem);
|
||||
(void)tsem_destroy(&dmNotifyHdl.sem);
|
||||
}
|
||||
|
||||
int32_t dmStartMonitorThread(SDnodeMgmt *pMgmt) {
|
||||
int32_t code = 0;
|
||||
TdThreadAttr thAttr;
|
||||
taosThreadAttrInit(&thAttr);
|
||||
taosThreadAttrSetDetachState(&thAttr, PTHREAD_CREATE_JOINABLE);
|
||||
(void)taosThreadAttrInit(&thAttr);
|
||||
(void)taosThreadAttrSetDetachState(&thAttr, PTHREAD_CREATE_JOINABLE);
|
||||
if (taosThreadCreate(&pMgmt->monitorThread, &thAttr, dmMonitorThreadFp, pMgmt) != 0) {
|
||||
code = TAOS_SYSTEM_ERROR(errno);
|
||||
dError("failed to create monitor thread since %s", tstrerror(code));
|
||||
return code;
|
||||
}
|
||||
|
||||
taosThreadAttrDestroy(&thAttr);
|
||||
(void)taosThreadAttrDestroy(&thAttr);
|
||||
tmsgReportStartup("dnode-monitor", "initialized");
|
||||
return 0;
|
||||
}
|
||||
|
@ -330,30 +330,30 @@ int32_t dmStartMonitorThread(SDnodeMgmt *pMgmt) {
|
|||
int32_t dmStartAuditThread(SDnodeMgmt *pMgmt) {
|
||||
int32_t code = 0;
|
||||
TdThreadAttr thAttr;
|
||||
taosThreadAttrInit(&thAttr);
|
||||
taosThreadAttrSetDetachState(&thAttr, PTHREAD_CREATE_JOINABLE);
|
||||
(void)taosThreadAttrInit(&thAttr);
|
||||
(void)taosThreadAttrSetDetachState(&thAttr, PTHREAD_CREATE_JOINABLE);
|
||||
if (taosThreadCreate(&pMgmt->auditThread, &thAttr, dmAuditThreadFp, pMgmt) != 0) {
|
||||
code = TAOS_SYSTEM_ERROR(errno);
|
||||
dError("failed to create audit thread since %s", tstrerror(code));
|
||||
return code;
|
||||
}
|
||||
|
||||
taosThreadAttrDestroy(&thAttr);
|
||||
(void)taosThreadAttrDestroy(&thAttr);
|
||||
tmsgReportStartup("dnode-audit", "initialized");
|
||||
return 0;
|
||||
}
|
||||
|
||||
void dmStopMonitorThread(SDnodeMgmt *pMgmt) {
|
||||
if (taosCheckPthreadValid(pMgmt->monitorThread)) {
|
||||
taosThreadJoin(pMgmt->monitorThread, NULL);
|
||||
taosThreadClear(&pMgmt->monitorThread);
|
||||
(void)taosThreadJoin(pMgmt->monitorThread, NULL);
|
||||
(void)taosThreadClear(&pMgmt->monitorThread);
|
||||
}
|
||||
}
|
||||
|
||||
void dmStopAuditThread(SDnodeMgmt *pMgmt) {
|
||||
if (taosCheckPthreadValid(pMgmt->auditThread)) {
|
||||
taosThreadJoin(pMgmt->auditThread, NULL);
|
||||
taosThreadClear(&pMgmt->auditThread);
|
||||
(void)taosThreadJoin(pMgmt->auditThread, NULL);
|
||||
(void)taosThreadClear(&pMgmt->auditThread);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -364,15 +364,15 @@ int32_t dmStartCrashReportThread(SDnodeMgmt *pMgmt) {
|
|||
}
|
||||
|
||||
TdThreadAttr thAttr;
|
||||
taosThreadAttrInit(&thAttr);
|
||||
taosThreadAttrSetDetachState(&thAttr, PTHREAD_CREATE_JOINABLE);
|
||||
(void)taosThreadAttrInit(&thAttr);
|
||||
(void)taosThreadAttrSetDetachState(&thAttr, PTHREAD_CREATE_JOINABLE);
|
||||
if (taosThreadCreate(&pMgmt->crashReportThread, &thAttr, dmCrashReportThreadFp, pMgmt) != 0) {
|
||||
code = TAOS_SYSTEM_ERROR(errno);
|
||||
dError("failed to create crashReport thread since %s", tstrerror(code));
|
||||
return code;
|
||||
}
|
||||
|
||||
taosThreadAttrDestroy(&thAttr);
|
||||
(void)taosThreadAttrDestroy(&thAttr);
|
||||
tmsgReportStartup("dnode-crashReport", "initialized");
|
||||
return 0;
|
||||
}
|
||||
|
@ -383,8 +383,8 @@ void dmStopCrashReportThread(SDnodeMgmt *pMgmt) {
|
|||
}
|
||||
|
||||
if (taosCheckPthreadValid(pMgmt->crashReportThread)) {
|
||||
taosThreadJoin(pMgmt->crashReportThread, NULL);
|
||||
taosThreadClear(&pMgmt->crashReportThread);
|
||||
(void)taosThreadJoin(pMgmt->crashReportThread, NULL);
|
||||
(void)taosThreadClear(&pMgmt->crashReportThread);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -454,7 +454,11 @@ static void dmProcessMgmtQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) {
|
|||
.contLen = pMsg->info.rspLen,
|
||||
.info = pMsg->info,
|
||||
};
|
||||
rpcSendResponse(&rsp);
|
||||
|
||||
code = rpcSendResponse(&rsp);
|
||||
if (code != 0) {
|
||||
dError("failed to send response since %s", tstrerror(code));
|
||||
}
|
||||
}
|
||||
|
||||
dTrace("msg:%p, is freed, code:0x%x", pMsg, code);
|
||||
|
@ -463,6 +467,7 @@ static void dmProcessMgmtQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) {
|
|||
}
|
||||
|
||||
int32_t dmStartWorker(SDnodeMgmt *pMgmt) {
|
||||
int32_t code = 0;
|
||||
SSingleWorkerCfg cfg = {
|
||||
.min = 1,
|
||||
.max = 1,
|
||||
|
@ -470,9 +475,9 @@ int32_t dmStartWorker(SDnodeMgmt *pMgmt) {
|
|||
.fp = (FItem)dmProcessMgmtQueue,
|
||||
.param = pMgmt,
|
||||
};
|
||||
if (tSingleWorkerInit(&pMgmt->mgmtWorker, &cfg) != 0) {
|
||||
dError("failed to start dnode-mgmt worker since %s", terrstr());
|
||||
return -1;
|
||||
if ((code = tSingleWorkerInit(&pMgmt->mgmtWorker, &cfg)) != 0) {
|
||||
dError("failed to start dnode-mgmt worker since %s", tstrerror(code));
|
||||
return code;
|
||||
}
|
||||
|
||||
dDebug("dnode workers are initialized");
|
||||
|
@ -487,6 +492,5 @@ void dmStopWorker(SDnodeMgmt *pMgmt) {
|
|||
int32_t dmPutNodeMsgToMgmtQueue(SDnodeMgmt *pMgmt, SRpcMsg *pMsg) {
|
||||
SSingleWorker *pWorker = &pMgmt->mgmtWorker;
|
||||
dTrace("msg:%p, put into worker %s", pMsg, pWorker->name);
|
||||
taosWriteQitem(pWorker->queue, pMsg);
|
||||
return 0;
|
||||
return taosWriteQitem(pWorker->queue, pMsg);
|
||||
}
|
||||
|
|
|
@ -17,12 +17,12 @@
|
|||
#include "mmInt.h"
|
||||
|
||||
void mmGetMonitorInfo(SMnodeMgmt *pMgmt, SMonMmInfo *pInfo) {
|
||||
mndGetMonitorInfo(pMgmt->pMnode, &pInfo->cluster, &pInfo->vgroup, &pInfo->stb, &pInfo->grant);
|
||||
(void)mndGetMonitorInfo(pMgmt->pMnode, &pInfo->cluster, &pInfo->vgroup, &pInfo->stb, &pInfo->grant);
|
||||
}
|
||||
|
||||
void mmGetMnodeLoads(SMnodeMgmt *pMgmt, SMonMloadInfo *pInfo) {
|
||||
pInfo->isMnode = 1;
|
||||
mndGetLoad(pMgmt->pMnode, &pInfo->load);
|
||||
(void)mndGetLoad(pMgmt->pMnode, &pInfo->load);
|
||||
}
|
||||
|
||||
int32_t mmProcessCreateReq(const SMgmtInputOpt *pInput, SRpcMsg *pMsg) {
|
||||
|
|
|
@ -68,7 +68,7 @@ static void mmClose(SMnodeMgmt *pMgmt) {
|
|||
if (pMgmt->pMnode != NULL) {
|
||||
mmStopWorker(pMgmt);
|
||||
mndClose(pMgmt->pMnode);
|
||||
taosThreadRwlockDestroy(&pMgmt->lock);
|
||||
(void)taosThreadRwlockDestroy(&pMgmt->lock);
|
||||
pMgmt->pMnode = NULL;
|
||||
}
|
||||
|
||||
|
@ -107,7 +107,7 @@ static int32_t mmOpen(SMgmtInputOpt *pInput, SMgmtOutputOpt *pOutput) {
|
|||
pMgmt->msgCb = pInput->msgCb;
|
||||
pMgmt->msgCb.putToQueueFp = (PutToQueueFp)mmPutMsgToQueue;
|
||||
pMgmt->msgCb.mgmt = pMgmt;
|
||||
taosThreadRwlockInit(&pMgmt->lock, NULL);
|
||||
(void)taosThreadRwlockInit(&pMgmt->lock, NULL);
|
||||
|
||||
SMnodeOpt option = {0};
|
||||
if ((code = mmReadFile(pMgmt->path, &option)) != 0) {
|
||||
|
@ -163,9 +163,9 @@ static int32_t mmStart(SMnodeMgmt *pMgmt) {
|
|||
static void mmStop(SMnodeMgmt *pMgmt) {
|
||||
dDebug("mnode-mgmt start to stop");
|
||||
mndPreClose(pMgmt->pMnode);
|
||||
taosThreadRwlockWrlock(&pMgmt->lock);
|
||||
(void)taosThreadRwlockWrlock(&pMgmt->lock);
|
||||
pMgmt->stopped = 1;
|
||||
taosThreadRwlockUnlock(&pMgmt->lock);
|
||||
(void)taosThreadRwlockUnlock(&pMgmt->lock);
|
||||
|
||||
mndStop(pMgmt->pMnode);
|
||||
}
|
||||
|
|
|
@ -20,20 +20,20 @@
|
|||
|
||||
static inline int32_t mmAcquire(SMnodeMgmt *pMgmt) {
|
||||
int32_t code = 0;
|
||||
taosThreadRwlockRdlock(&pMgmt->lock);
|
||||
(void)taosThreadRwlockRdlock(&pMgmt->lock);
|
||||
if (pMgmt->stopped) {
|
||||
code = -1;
|
||||
} else {
|
||||
atomic_add_fetch_32(&pMgmt->refCount, 1);
|
||||
(void)atomic_add_fetch_32(&pMgmt->refCount, 1);
|
||||
}
|
||||
taosThreadRwlockUnlock(&pMgmt->lock);
|
||||
(void)taosThreadRwlockUnlock(&pMgmt->lock);
|
||||
return code;
|
||||
}
|
||||
|
||||
static inline void mmRelease(SMnodeMgmt *pMgmt) {
|
||||
taosThreadRwlockRdlock(&pMgmt->lock);
|
||||
atomic_sub_fetch_32(&pMgmt->refCount, 1);
|
||||
taosThreadRwlockUnlock(&pMgmt->lock);
|
||||
(void)taosThreadRwlockRdlock(&pMgmt->lock);
|
||||
(void)atomic_sub_fetch_32(&pMgmt->refCount, 1);
|
||||
(void)taosThreadRwlockUnlock(&pMgmt->lock);
|
||||
}
|
||||
|
||||
static inline void mmSendRsp(SRpcMsg *pMsg, int32_t code) {
|
||||
|
@ -100,16 +100,16 @@ static void mmProcessSyncMsg(SQueueInfo *pInfo, SRpcMsg *pMsg) {
|
|||
|
||||
static inline int32_t mmPutMsgToWorker(SMnodeMgmt *pMgmt, SSingleWorker *pWorker, SRpcMsg *pMsg) {
|
||||
const STraceId *trace = &pMsg->info.traceId;
|
||||
|
||||
if (mmAcquire(pMgmt) == 0) {
|
||||
int32_t code = 0;
|
||||
if ((code = mmAcquire(pMgmt)) == 0) {
|
||||
dGTrace("msg:%p, put into %s queue, type:%s", pMsg, pWorker->name, TMSG_INFO(pMsg->msgType));
|
||||
taosWriteQitem(pWorker->queue, pMsg);
|
||||
code = taosWriteQitem(pWorker->queue, pMsg);
|
||||
mmRelease(pMgmt);
|
||||
return 0;
|
||||
return code;
|
||||
} else {
|
||||
dGTrace("msg:%p, failed to put into %s queue since %s, type:%s", pMsg, pWorker->name, terrstr(),
|
||||
dGTrace("msg:%p, failed to put into %s queue since %s, type:%s", pMsg, pWorker->name, tstrerror(code),
|
||||
TMSG_INFO(pMsg->msgType));
|
||||
return -1;
|
||||
return code;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -18,13 +18,13 @@
|
|||
|
||||
void qmGetMonitorInfo(SQnodeMgmt *pMgmt, SMonQmInfo *qmInfo) {
|
||||
SQnodeLoad qload = {0};
|
||||
qndGetLoad(pMgmt->pQnode, &qload);
|
||||
(void)qndGetLoad(pMgmt->pQnode, &qload);
|
||||
|
||||
qload.dnodeId = pMgmt->pData->dnodeId;
|
||||
}
|
||||
|
||||
void qmGetQnodeLoads(SQnodeMgmt *pMgmt, SQnodeLoad *pInfo) {
|
||||
qndGetLoad(pMgmt->pQnode, pInfo);
|
||||
(void)qndGetLoad(pMgmt->pQnode, pInfo);
|
||||
|
||||
pInfo->dnodeId = pMgmt->pData->dnodeId;
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ static inline void qmSendRsp(SRpcMsg *pMsg, int32_t code) {
|
|||
.contLen = pMsg->info.rspLen,
|
||||
.info = pMsg->info,
|
||||
};
|
||||
tmsgSendRsp(&rsp);
|
||||
(void)tmsgSendRsp(&rsp);
|
||||
}
|
||||
|
||||
static void qmProcessQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) {
|
||||
|
@ -43,8 +43,7 @@ static void qmProcessQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) {
|
|||
|
||||
static int32_t qmPutNodeMsgToWorker(SSingleWorker *pWorker, SRpcMsg *pMsg) {
|
||||
dTrace("msg:%p, put into worker %s, type:%s", pMsg, pWorker->name, TMSG_INFO(pMsg->msgType));
|
||||
taosWriteQitem(pWorker->queue, pMsg);
|
||||
return 0;
|
||||
return taosWriteQitem(pWorker->queue, pMsg);
|
||||
}
|
||||
|
||||
int32_t qmPutNodeMsgToQueryQueue(SQnodeMgmt *pMgmt, SRpcMsg *pMsg) {
|
||||
|
@ -69,18 +68,18 @@ int32_t qmPutRpcMsgToQueue(SQnodeMgmt *pMgmt, EQueueType qtype, SRpcMsg *pRpc) {
|
|||
switch (qtype) {
|
||||
case QUERY_QUEUE:
|
||||
dTrace("msg:%p, is created and will put into qnode-query queue, len:%d", pMsg, pRpc->contLen);
|
||||
taosWriteQitem(pMgmt->queryWorker.queue, pMsg);
|
||||
return 0;
|
||||
code = taosWriteQitem(pMgmt->queryWorker.queue, pMsg);
|
||||
return code;
|
||||
case READ_QUEUE:
|
||||
case FETCH_QUEUE:
|
||||
dTrace("msg:%p, is created and will put into qnode-fetch queue, len:%d", pMsg, pRpc->contLen);
|
||||
taosWriteQitem(pMgmt->fetchWorker.queue, pMsg);
|
||||
return 0;
|
||||
code = taosWriteQitem(pMgmt->fetchWorker.queue, pMsg);
|
||||
return code;
|
||||
default:
|
||||
terrno = TSDB_CODE_INVALID_PARA;
|
||||
rpcFreeCont(pMsg->pCont);
|
||||
taosFreeQitem(pMsg);
|
||||
return -1;
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ static inline void smSendRsp(SRpcMsg *pMsg, int32_t code) {
|
|||
.contLen = pMsg->info.rspLen,
|
||||
.info = pMsg->info,
|
||||
};
|
||||
tmsgSendRsp(&rsp);
|
||||
(void)tmsgSendRsp(&rsp);
|
||||
}
|
||||
|
||||
static void smProcessWriteQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numOfMsgs) {
|
||||
|
@ -31,7 +31,7 @@ static void smProcessWriteQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numO
|
|||
|
||||
for (int32_t i = 0; i < numOfMsgs; i++) {
|
||||
SRpcMsg *pMsg = NULL;
|
||||
taosGetQitem(qall, (void **)&pMsg);
|
||||
(void)taosGetQitem(qall, (void **)&pMsg);
|
||||
const STraceId *trace = &pMsg->info.traceId;
|
||||
|
||||
dTrace("msg:%p, get from snode-write queue", pMsg);
|
||||
|
|
|
@ -20,13 +20,13 @@
|
|||
#define MAX_CONTENT_LEN 2 * 1024 * 1024
|
||||
|
||||
int32_t vmGetVnodeListFromHash(SVnodeMgmt *pMgmt, int32_t *numOfVnodes, SVnodeObj ***ppVnodes) {
|
||||
taosThreadRwlockRdlock(&pMgmt->lock);
|
||||
(void)taosThreadRwlockRdlock(&pMgmt->lock);
|
||||
|
||||
int32_t num = 0;
|
||||
int32_t size = taosHashGetSize(pMgmt->hash);
|
||||
SVnodeObj **pVnodes = taosMemoryCalloc(size, sizeof(SVnodeObj *));
|
||||
if (pVnodes == NULL) {
|
||||
taosThreadRwlockUnlock(&pMgmt->lock);
|
||||
(void)taosThreadRwlockUnlock(&pMgmt->lock);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ int32_t vmGetVnodeListFromHash(SVnodeMgmt *pMgmt, int32_t *numOfVnodes, SVnodeOb
|
|||
}
|
||||
}
|
||||
|
||||
taosThreadRwlockUnlock(&pMgmt->lock);
|
||||
(void)taosThreadRwlockUnlock(&pMgmt->lock);
|
||||
*numOfVnodes = num;
|
||||
*ppVnodes = pVnodes;
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ void vmGetVnodeLoads(SVnodeMgmt *pMgmt, SMonVloadInfo *pInfo, bool isReset) {
|
|||
|
||||
tfsUpdateSize(pMgmt->pTfs);
|
||||
|
||||
taosThreadRwlockRdlock(&pMgmt->lock);
|
||||
(void)taosThreadRwlockRdlock(&pMgmt->lock);
|
||||
|
||||
void *pIter = taosHashIterate(pMgmt->hash, NULL);
|
||||
while (pIter) {
|
||||
|
@ -32,21 +32,21 @@ void vmGetVnodeLoads(SVnodeMgmt *pMgmt, SMonVloadInfo *pInfo, bool isReset) {
|
|||
SVnodeObj *pVnode = *ppVnode;
|
||||
SVnodeLoad vload = {.vgId = pVnode->vgId};
|
||||
if (!pVnode->failed) {
|
||||
vnodeGetLoad(pVnode->pImpl, &vload);
|
||||
(void)vnodeGetLoad(pVnode->pImpl, &vload);
|
||||
if (isReset) vnodeResetLoad(pVnode->pImpl, &vload);
|
||||
}
|
||||
taosArrayPush(pInfo->pVloads, &vload);
|
||||
(void)taosArrayPush(pInfo->pVloads, &vload);
|
||||
pIter = taosHashIterate(pMgmt->hash, pIter);
|
||||
}
|
||||
|
||||
taosThreadRwlockUnlock(&pMgmt->lock);
|
||||
(void)taosThreadRwlockUnlock(&pMgmt->lock);
|
||||
}
|
||||
|
||||
void vmGetVnodeLoadsLite(SVnodeMgmt *pMgmt, SMonVloadInfo *pInfo) {
|
||||
pInfo->pVloads = taosArrayInit(pMgmt->state.totalVnodes, sizeof(SVnodeLoadLite));
|
||||
if (!pInfo->pVloads) return;
|
||||
|
||||
taosThreadRwlockRdlock(&pMgmt->lock);
|
||||
(void)taosThreadRwlockRdlock(&pMgmt->lock);
|
||||
|
||||
void *pIter = taosHashIterate(pMgmt->hash, NULL);
|
||||
while (pIter) {
|
||||
|
@ -57,13 +57,13 @@ void vmGetVnodeLoadsLite(SVnodeMgmt *pMgmt, SMonVloadInfo *pInfo) {
|
|||
if (!pVnode->failed) {
|
||||
SVnodeLoadLite vload = {0};
|
||||
if (vnodeGetLoadLite(pVnode->pImpl, &vload) == 0) {
|
||||
taosArrayPush(pInfo->pVloads, &vload);
|
||||
(void)taosArrayPush(pInfo->pVloads, &vload);
|
||||
}
|
||||
}
|
||||
pIter = taosHashIterate(pMgmt->hash, pIter);
|
||||
}
|
||||
|
||||
taosThreadRwlockUnlock(&pMgmt->lock);
|
||||
(void)taosThreadRwlockUnlock(&pMgmt->lock);
|
||||
}
|
||||
|
||||
void vmGetMonitorInfo(SVnodeMgmt *pMgmt, SMonVmInfo *pInfo) {
|
||||
|
@ -109,7 +109,7 @@ void vmGetMonitorInfo(SVnodeMgmt *pMgmt, SMonVmInfo *pInfo) {
|
|||
pMgmt->state.numOfBatchInsertReqs = numOfBatchInsertReqs;
|
||||
pMgmt->state.numOfBatchInsertSuccessReqs = numOfBatchInsertSuccessReqs;
|
||||
|
||||
tfsGetMonitorInfo(pMgmt->pTfs, &pInfo->tfs);
|
||||
(void)tfsGetMonitorInfo(pMgmt->pTfs, &pInfo->tfs);
|
||||
taosArrayDestroy(pVloads);
|
||||
}
|
||||
|
||||
|
@ -200,7 +200,7 @@ static void vmGenerateVnodeCfg(SCreateVnodeReq *pCreate, SVnodeCfg *pCfg) {
|
|||
pNode->nodePort = pCreate->replicas[pCfg->syncCfg.replicaNum].port;
|
||||
pNode->nodeRole = TAOS_SYNC_ROLE_VOTER;
|
||||
tstrncpy(pNode->nodeFqdn, pCreate->replicas[pCfg->syncCfg.replicaNum].fqdn, TSDB_FQDN_LEN);
|
||||
tmsgUpdateDnodeInfo(&pNode->nodeId, &pNode->clusterId, pNode->nodeFqdn, &pNode->nodePort);
|
||||
(void)tmsgUpdateDnodeInfo(&pNode->nodeId, &pNode->clusterId, pNode->nodeFqdn, &pNode->nodePort);
|
||||
pCfg->syncCfg.replicaNum++;
|
||||
}
|
||||
if (pCreate->selfIndex != -1) {
|
||||
|
@ -212,7 +212,7 @@ static void vmGenerateVnodeCfg(SCreateVnodeReq *pCreate, SVnodeCfg *pCfg) {
|
|||
pNode->nodePort = pCreate->learnerReplicas[pCfg->syncCfg.totalReplicaNum].port;
|
||||
pNode->nodeRole = TAOS_SYNC_ROLE_LEARNER;
|
||||
tstrncpy(pNode->nodeFqdn, pCreate->learnerReplicas[pCfg->syncCfg.totalReplicaNum].fqdn, TSDB_FQDN_LEN);
|
||||
tmsgUpdateDnodeInfo(&pNode->nodeId, &pNode->clusterId, pNode->nodeFqdn, &pNode->nodePort);
|
||||
(void)tmsgUpdateDnodeInfo(&pNode->nodeId, &pNode->clusterId, pNode->nodeFqdn, &pNode->nodePort);
|
||||
pCfg->syncCfg.totalReplicaNum++;
|
||||
}
|
||||
pCfg->syncCfg.totalReplicaNum += pCfg->syncCfg.replicaNum;
|
||||
|
@ -323,7 +323,7 @@ int32_t vmProcessCreateVnodeReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) {
|
|||
SVnodeObj *pVnode = vmAcquireVnodeImpl(pMgmt, req.vgId, false);
|
||||
if (pVnode != NULL && (req.replica == 1 || !pVnode->failed)) {
|
||||
dError("vgId:%d, already exist", req.vgId);
|
||||
tFreeSCreateVnodeReq(&req);
|
||||
(void)tFreeSCreateVnodeReq(&req);
|
||||
vmReleaseVnode(pMgmt, pVnode);
|
||||
code = TSDB_CODE_VND_ALREADY_EXIST;
|
||||
return 0;
|
||||
|
@ -340,7 +340,7 @@ int32_t vmProcessCreateVnodeReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) {
|
|||
if (vnodeCreate(path, &vnodeCfg, diskPrimary, pMgmt->pTfs) < 0) {
|
||||
dError("vgId:%d, failed to create vnode since %s", req.vgId, terrstr());
|
||||
vmReleaseVnode(pMgmt, pVnode);
|
||||
tFreeSCreateVnodeReq(&req);
|
||||
(void)tFreeSCreateVnodeReq(&req);
|
||||
code = terrno != 0 ? terrno : -1;
|
||||
return code;
|
||||
}
|
||||
|
@ -374,14 +374,14 @@ int32_t vmProcessCreateVnodeReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) {
|
|||
goto _OVER;
|
||||
}
|
||||
|
||||
//taosThreadMutexLock(&pMgmt->createLock);
|
||||
// taosThreadMutexLock(&pMgmt->createLock);
|
||||
code = vmWriteVnodeListToFile(pMgmt);
|
||||
if (code != 0) {
|
||||
code = terrno != 0 ? terrno : code;
|
||||
//taosThreadMutexUnlock(&pMgmt->createLock);
|
||||
// taosThreadMutexUnlock(&pMgmt->createLock);
|
||||
goto _OVER;
|
||||
}
|
||||
//taosThreadMutexUnlock(&pMgmt->createLock);
|
||||
// taosThreadMutexUnlock(&pMgmt->createLock);
|
||||
|
||||
_OVER:
|
||||
if (code != 0) {
|
||||
|
@ -392,7 +392,7 @@ _OVER:
|
|||
TMSG_INFO(pMsg->msgType));
|
||||
}
|
||||
|
||||
tFreeSCreateVnodeReq(&req);
|
||||
(void)tFreeSCreateVnodeReq(&req);
|
||||
terrno = code;
|
||||
return code;
|
||||
}
|
||||
|
@ -779,10 +779,11 @@ int32_t vmProcessAlterVnodeReplicaReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) {
|
|||
}
|
||||
|
||||
int32_t vmProcessDropVnodeReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) {
|
||||
int32_t code = 0;
|
||||
SDropVnodeReq dropReq = {0};
|
||||
if (tDeserializeSDropVnodeReq(pMsg->pCont, pMsg->contLen, &dropReq) != 0) {
|
||||
terrno = TSDB_CODE_INVALID_MSG;
|
||||
return -1;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
int32_t vgId = dropReq.vgId;
|
||||
|
@ -791,25 +792,25 @@ int32_t vmProcessDropVnodeReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) {
|
|||
if (dropReq.dnodeId != pMgmt->pData->dnodeId) {
|
||||
terrno = TSDB_CODE_INVALID_MSG;
|
||||
dError("vgId:%d, dnodeId:%d not matched with local dnode", dropReq.vgId, dropReq.dnodeId);
|
||||
return -1;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
SVnodeObj *pVnode = vmAcquireVnodeImpl(pMgmt, vgId, false);
|
||||
if (pVnode == NULL) {
|
||||
dInfo("vgId:%d, failed to drop since %s", vgId, terrstr());
|
||||
terrno = TSDB_CODE_VND_NOT_EXIST;
|
||||
return -1;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
pVnode->dropped = 1;
|
||||
if (vmWriteVnodeListToFile(pMgmt) != 0) {
|
||||
if ((code = vmWriteVnodeListToFile(pMgmt)) != 0) {
|
||||
pVnode->dropped = 0;
|
||||
vmReleaseVnode(pMgmt, pVnode);
|
||||
return -1;
|
||||
return code;
|
||||
}
|
||||
|
||||
vmCloseVnode(pMgmt, pVnode, false);
|
||||
vmWriteVnodeListToFile(pMgmt);
|
||||
(void)vmWriteVnodeListToFile(pMgmt);
|
||||
|
||||
dInfo("vgId:%d, is dropped", vgId);
|
||||
return 0;
|
||||
|
@ -864,7 +865,7 @@ int32_t vmProcessArbHeartBeatReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) {
|
|||
continue;
|
||||
}
|
||||
|
||||
taosArrayPush(arbHbRsp.hbMembers, &rspMember);
|
||||
(void)taosArrayPush(arbHbRsp.hbMembers, &rspMember);
|
||||
|
||||
vmReleaseVnode(pMgmt, pVnode);
|
||||
}
|
||||
|
@ -895,7 +896,7 @@ int32_t vmProcessArbHeartBeatReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) {
|
|||
_OVER:
|
||||
tFreeSVArbHeartBeatReq(&arbHbReq);
|
||||
tFreeSVArbHeartBeatRsp(&arbHbRsp);
|
||||
return terrno == TSDB_CODE_SUCCESS ? 0 : -1;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
SArray *vmGetMsgHandles() {
|
||||
|
|
|
@ -23,12 +23,12 @@ int32_t vmGetPrimaryDisk(SVnodeMgmt *pMgmt, int32_t vgId) {
|
|||
int32_t diskId = -1;
|
||||
SVnodeObj *pVnode = NULL;
|
||||
|
||||
taosThreadRwlockRdlock(&pMgmt->lock);
|
||||
taosHashGetDup(pMgmt->hash, &vgId, sizeof(int32_t), (void *)&pVnode);
|
||||
(void)taosThreadRwlockRdlock(&pMgmt->lock);
|
||||
(void)taosHashGetDup(pMgmt->hash, &vgId, sizeof(int32_t), (void *)&pVnode);
|
||||
if (pVnode != NULL) {
|
||||
diskId = pVnode->diskPrimary;
|
||||
}
|
||||
taosThreadRwlockUnlock(&pMgmt->lock);
|
||||
(void)taosThreadRwlockUnlock(&pMgmt->lock);
|
||||
return diskId;
|
||||
}
|
||||
|
||||
|
@ -96,8 +96,8 @@ int32_t vmAllocPrimaryDisk(SVnodeMgmt *pMgmt, int32_t vgId) {
|
|||
SVnodeObj *vmAcquireVnodeImpl(SVnodeMgmt *pMgmt, int32_t vgId, bool strict) {
|
||||
SVnodeObj *pVnode = NULL;
|
||||
|
||||
taosThreadRwlockRdlock(&pMgmt->lock);
|
||||
taosHashGetDup(pMgmt->hash, &vgId, sizeof(int32_t), (void *)&pVnode);
|
||||
(void)taosThreadRwlockRdlock(&pMgmt->lock);
|
||||
(void)taosHashGetDup(pMgmt->hash, &vgId, sizeof(int32_t), (void *)&pVnode);
|
||||
if (pVnode == NULL || strict && (pVnode->dropped || pVnode->failed)) {
|
||||
terrno = TSDB_CODE_VND_INVALID_VGROUP_ID;
|
||||
pVnode = NULL;
|
||||
|
@ -105,7 +105,7 @@ SVnodeObj *vmAcquireVnodeImpl(SVnodeMgmt *pMgmt, int32_t vgId, bool strict) {
|
|||
int32_t refCount = atomic_add_fetch_32(&pVnode->refCount, 1);
|
||||
// dTrace("vgId:%d, acquire vnode, ref:%d", pVnode->vgId, refCount);
|
||||
}
|
||||
taosThreadRwlockUnlock(&pMgmt->lock);
|
||||
(void)taosThreadRwlockUnlock(&pMgmt->lock);
|
||||
|
||||
return pVnode;
|
||||
}
|
||||
|
@ -115,10 +115,10 @@ SVnodeObj *vmAcquireVnode(SVnodeMgmt *pMgmt, int32_t vgId) { return vmAcquireVno
|
|||
void vmReleaseVnode(SVnodeMgmt *pMgmt, SVnodeObj *pVnode) {
|
||||
if (pVnode == NULL) return;
|
||||
|
||||
taosThreadRwlockRdlock(&pMgmt->lock);
|
||||
(void)taosThreadRwlockRdlock(&pMgmt->lock);
|
||||
int32_t refCount = atomic_sub_fetch_32(&pVnode->refCount, 1);
|
||||
// dTrace("vgId:%d, release vnode, ref:%d", pVnode->vgId, refCount);
|
||||
taosThreadRwlockUnlock(&pMgmt->lock);
|
||||
(void)taosThreadRwlockUnlock(&pMgmt->lock);
|
||||
}
|
||||
|
||||
static void vmFreeVnodeObj(SVnodeObj **ppVnode) {
|
||||
|
@ -163,15 +163,15 @@ int32_t vmOpenVnode(SVnodeMgmt *pMgmt, SWrapperCfg *pCfg, SVnode *pImpl) {
|
|||
pVnode->failed = 1;
|
||||
}
|
||||
|
||||
taosThreadRwlockWrlock(&pMgmt->lock);
|
||||
(void)taosThreadRwlockWrlock(&pMgmt->lock);
|
||||
SVnodeObj *pOld = NULL;
|
||||
taosHashGetDup(pMgmt->hash, &pVnode->vgId, sizeof(int32_t), (void *)&pOld);
|
||||
(void)taosHashGetDup(pMgmt->hash, &pVnode->vgId, sizeof(int32_t), (void *)&pOld);
|
||||
if (pOld) {
|
||||
ASSERT(pOld->failed);
|
||||
vmFreeVnodeObj(&pOld);
|
||||
}
|
||||
int32_t code = taosHashPut(pMgmt->hash, &pVnode->vgId, sizeof(int32_t), &pVnode, sizeof(SVnodeObj *));
|
||||
taosThreadRwlockUnlock(&pMgmt->lock);
|
||||
(void)taosThreadRwlockUnlock(&pMgmt->lock);
|
||||
|
||||
return code;
|
||||
}
|
||||
|
@ -184,9 +184,9 @@ void vmCloseVnode(SVnodeMgmt *pMgmt, SVnodeObj *pVnode, bool commitAndRemoveWal)
|
|||
vnodeProposeCommitOnNeed(pVnode->pImpl, atExit);
|
||||
}
|
||||
|
||||
taosThreadRwlockWrlock(&pMgmt->lock);
|
||||
taosHashRemove(pMgmt->hash, &pVnode->vgId, sizeof(int32_t));
|
||||
taosThreadRwlockUnlock(&pMgmt->lock);
|
||||
(void)taosThreadRwlockWrlock(&pMgmt->lock);
|
||||
(void)taosHashRemove(pMgmt->hash, &pVnode->vgId, sizeof(int32_t));
|
||||
(void)taosThreadRwlockUnlock(&pMgmt->lock);
|
||||
vmReleaseVnode(pMgmt, pVnode);
|
||||
|
||||
if (pVnode->failed) {
|
||||
|
@ -235,8 +235,8 @@ void vmCloseVnode(SVnodeMgmt *pMgmt, SVnodeObj *pVnode, bool commitAndRemoveWal)
|
|||
|
||||
if (commitAndRemoveWal) {
|
||||
dInfo("vgId:%d, commit data for vnode split", pVnode->vgId);
|
||||
vnodeSyncCommit(pVnode->pImpl);
|
||||
vnodeBegin(pVnode->pImpl);
|
||||
(void)vnodeSyncCommit(pVnode->pImpl);
|
||||
(void)vnodeBegin(pVnode->pImpl);
|
||||
dInfo("vgId:%d, commit data finished", pVnode->vgId);
|
||||
}
|
||||
|
||||
|
@ -250,8 +250,8 @@ _closed:
|
|||
if (commitAndRemoveWal) {
|
||||
snprintf(path, TSDB_FILENAME_LEN, "vnode%svnode%d%swal", TD_DIRSEP, pVnode->vgId, TD_DIRSEP);
|
||||
dInfo("vgId:%d, remove all wals, path:%s", pVnode->vgId, path);
|
||||
tfsRmdir(pMgmt->pTfs, path);
|
||||
tfsMkdir(pMgmt->pTfs, path);
|
||||
(void)tfsRmdir(pMgmt->pTfs, path);
|
||||
(void)tfsMkdir(pMgmt->pTfs, path);
|
||||
}
|
||||
|
||||
if (pVnode->dropped) {
|
||||
|
@ -332,7 +332,7 @@ static void *vmOpenVnodeInThread(void *param) {
|
|||
|
||||
dInfo("vgId:%d, is opened by thread:%d", pCfg->vgId, pThread->threadIndex);
|
||||
pThread->opened++;
|
||||
atomic_add_fetch_32(&pMgmt->state.openVnodes, 1);
|
||||
(void)atomic_add_fetch_32(&pMgmt->state.openVnodes, 1);
|
||||
}
|
||||
|
||||
dInfo("thread:%d, numOfVnodes:%d, opened:%d failed:%d", pThread->threadIndex, pThread->vnodeNum, pThread->opened,
|
||||
|
@ -381,13 +381,13 @@ static int32_t vmOpenVnodes(SVnodeMgmt *pMgmt) {
|
|||
if (pThread->vnodeNum == 0) continue;
|
||||
|
||||
TdThreadAttr thAttr;
|
||||
taosThreadAttrInit(&thAttr);
|
||||
taosThreadAttrSetDetachState(&thAttr, PTHREAD_CREATE_JOINABLE);
|
||||
(void)taosThreadAttrInit(&thAttr);
|
||||
(void)taosThreadAttrSetDetachState(&thAttr, PTHREAD_CREATE_JOINABLE);
|
||||
if (taosThreadCreate(&pThread->thread, &thAttr, vmOpenVnodeInThread, pThread) != 0) {
|
||||
dError("thread:%d, failed to create thread to open vnode, reason:%s", pThread->threadIndex, strerror(errno));
|
||||
}
|
||||
|
||||
taosThreadAttrDestroy(&thAttr);
|
||||
(void)taosThreadAttrDestroy(&thAttr);
|
||||
}
|
||||
|
||||
bool updateVnodesList = false;
|
||||
|
@ -395,7 +395,7 @@ static int32_t vmOpenVnodes(SVnodeMgmt *pMgmt) {
|
|||
for (int32_t t = 0; t < threadNum; ++t) {
|
||||
SVnodeThread *pThread = &threads[t];
|
||||
if (pThread->vnodeNum > 0 && taosCheckPthreadValid(pThread->thread)) {
|
||||
taosThreadJoin(pThread->thread, NULL);
|
||||
(void)taosThreadJoin(pThread->thread, NULL);
|
||||
taosThreadClear(&pThread->thread);
|
||||
}
|
||||
taosMemoryFree(pThread->pCfgs);
|
||||
|
@ -484,19 +484,19 @@ static void vmCloseVnodes(SVnodeMgmt *pMgmt) {
|
|||
if (pThread->vnodeNum == 0) continue;
|
||||
|
||||
TdThreadAttr thAttr;
|
||||
taosThreadAttrInit(&thAttr);
|
||||
taosThreadAttrSetDetachState(&thAttr, PTHREAD_CREATE_JOINABLE);
|
||||
(void)taosThreadAttrInit(&thAttr);
|
||||
(void)taosThreadAttrSetDetachState(&thAttr, PTHREAD_CREATE_JOINABLE);
|
||||
if (taosThreadCreate(&pThread->thread, &thAttr, vmCloseVnodeInThread, pThread) != 0) {
|
||||
dError("thread:%d, failed to create thread to close vnode since %s", pThread->threadIndex, strerror(errno));
|
||||
}
|
||||
|
||||
taosThreadAttrDestroy(&thAttr);
|
||||
(void)taosThreadAttrDestroy(&thAttr);
|
||||
}
|
||||
|
||||
for (int32_t t = 0; t < threadNum; ++t) {
|
||||
SVnodeThread *pThread = &threads[t];
|
||||
if (pThread->vnodeNum > 0 && taosCheckPthreadValid(pThread->thread)) {
|
||||
taosThreadJoin(pThread->thread, NULL);
|
||||
(void)taosThreadJoin(pThread->thread, NULL);
|
||||
taosThreadClear(&pThread->thread);
|
||||
}
|
||||
taosMemoryFree(pThread->ppVnodes);
|
||||
|
@ -519,8 +519,8 @@ static void vmCleanup(SVnodeMgmt *pMgmt) {
|
|||
vmCloseVnodes(pMgmt);
|
||||
vmStopWorker(pMgmt);
|
||||
vnodeCleanup();
|
||||
taosThreadRwlockDestroy(&pMgmt->lock);
|
||||
taosThreadMutexDestroy(&pMgmt->createLock);
|
||||
(void)taosThreadRwlockDestroy(&pMgmt->lock);
|
||||
(void)taosThreadMutexDestroy(&pMgmt->createLock);
|
||||
taosMemoryFree(pMgmt);
|
||||
}
|
||||
|
||||
|
@ -569,22 +569,22 @@ static void *vmThreadFp(void *param) {
|
|||
static int32_t vmInitTimer(SVnodeMgmt *pMgmt) {
|
||||
int32_t code = 0;
|
||||
TdThreadAttr thAttr;
|
||||
taosThreadAttrInit(&thAttr);
|
||||
taosThreadAttrSetDetachState(&thAttr, PTHREAD_CREATE_JOINABLE);
|
||||
(void)taosThreadAttrInit(&thAttr);
|
||||
(void)taosThreadAttrSetDetachState(&thAttr, PTHREAD_CREATE_JOINABLE);
|
||||
if (taosThreadCreate(&pMgmt->thread, &thAttr, vmThreadFp, pMgmt) != 0) {
|
||||
code = TAOS_SYSTEM_ERROR(errno);
|
||||
dError("failed to create vnode timer thread since %s", tstrerror(code));
|
||||
return code;
|
||||
}
|
||||
|
||||
taosThreadAttrDestroy(&thAttr);
|
||||
(void)taosThreadAttrDestroy(&thAttr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void vmCleanupTimer(SVnodeMgmt *pMgmt) {
|
||||
pMgmt->stop = true;
|
||||
if (taosCheckPthreadValid(pMgmt->thread)) {
|
||||
taosThreadJoin(pMgmt->thread, NULL);
|
||||
(void)taosThreadJoin(pMgmt->thread, NULL);
|
||||
taosThreadClear(&pMgmt->thread);
|
||||
}
|
||||
}
|
||||
|
@ -707,7 +707,7 @@ static void *vmRestoreVnodeInThread(void *param) {
|
|||
} else {
|
||||
dInfo("vgId:%d, is restored by thread:%d", pVnode->vgId, pThread->threadIndex);
|
||||
pThread->opened++;
|
||||
atomic_add_fetch_32(&pMgmt->state.openVnodes, 1);
|
||||
(void)atomic_add_fetch_32(&pMgmt->state.openVnodes, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -761,20 +761,20 @@ static int32_t vmStartVnodes(SVnodeMgmt *pMgmt) {
|
|||
if (pThread->vnodeNum == 0) continue;
|
||||
|
||||
TdThreadAttr thAttr;
|
||||
taosThreadAttrInit(&thAttr);
|
||||
taosThreadAttrSetDetachState(&thAttr, PTHREAD_CREATE_JOINABLE);
|
||||
(void)taosThreadAttrInit(&thAttr);
|
||||
(void)taosThreadAttrSetDetachState(&thAttr, PTHREAD_CREATE_JOINABLE);
|
||||
if (taosThreadCreate(&pThread->thread, &thAttr, vmRestoreVnodeInThread, pThread) != 0) {
|
||||
dError("thread:%d, failed to create thread to restore vnode since %s", pThread->threadIndex, strerror(errno));
|
||||
ASSERT(errno == 0);
|
||||
}
|
||||
|
||||
taosThreadAttrDestroy(&thAttr);
|
||||
(void)taosThreadAttrDestroy(&thAttr);
|
||||
}
|
||||
|
||||
for (int32_t t = 0; t < threadNum; ++t) {
|
||||
SVnodeThread *pThread = &threads[t];
|
||||
if (pThread->vnodeNum > 0 && taosCheckPthreadValid(pThread->thread)) {
|
||||
taosThreadJoin(pThread->thread, NULL);
|
||||
(void)taosThreadJoin(pThread->thread, NULL);
|
||||
taosThreadClear(&pThread->thread);
|
||||
}
|
||||
taosMemoryFree(pThread->ppVnodes);
|
||||
|
|
|
@ -187,7 +187,7 @@ static void vmProcessSyncQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numOf
|
|||
static void vmSendResponse(SRpcMsg *pMsg) {
|
||||
if (pMsg->info.handle) {
|
||||
SRpcMsg rsp = {.info = pMsg->info, .code = terrno};
|
||||
rpcSendResponse(&rsp);
|
||||
(void)rpcSendResponse(&rsp);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -236,7 +236,7 @@ static int32_t vmPutMsgToQueue(SVnodeMgmt *pMgmt, SRpcMsg *pMsg, EQueueType qtyp
|
|||
dError("vgId:%d, msg:%p preprocess query msg failed since %s", pVnode->vgId, pMsg, tstrerror(code));
|
||||
} else {
|
||||
dGTrace("vgId:%d, msg:%p put into vnode-query queue", pVnode->vgId, pMsg);
|
||||
taosWriteQitem(pVnode->pQueryQ, pMsg);
|
||||
code = taosWriteQitem(pVnode->pQueryQ, pMsg);
|
||||
}
|
||||
break;
|
||||
case STREAM_QUEUE:
|
||||
|
|
|
@ -47,8 +47,8 @@ static int32_t dmCheckRepeatInit(SDnode *pDnode) {
|
|||
}
|
||||
|
||||
static int32_t dmInitSystem() {
|
||||
taosIgnSIGPIPE();
|
||||
taosBlockSIGPIPE();
|
||||
(void)taosIgnSIGPIPE();
|
||||
(void)taosBlockSIGPIPE();
|
||||
taosResolveCRC();
|
||||
return 0;
|
||||
}
|
||||
|
@ -200,10 +200,10 @@ void dmCleanup() {
|
|||
auditCleanup();
|
||||
syncCleanUp();
|
||||
walCleanUp();
|
||||
udfcClose();
|
||||
(void)udfcClose();
|
||||
udfStopUdfd();
|
||||
taosStopCacheRefreshWorker();
|
||||
dmDiskClose();
|
||||
(void)dmDiskClose();
|
||||
DestroyRegexCache();
|
||||
|
||||
#if defined(USE_S3)
|
||||
|
|
|
@ -47,7 +47,8 @@ int32_t dmInitDnode(SDnode *pDnode) {
|
|||
}
|
||||
|
||||
// compress module init
|
||||
tsCompressInit(tsLossyColumns, tsFPrecision, tsDPrecision, tsMaxRange, tsCurRange, (int)tsIfAdtFse, tsCompressor);
|
||||
(void)tsCompressInit(tsLossyColumns, tsFPrecision, tsDPrecision, tsMaxRange, tsCurRange, (int)tsIfAdtFse,
|
||||
tsCompressor);
|
||||
|
||||
pDnode->wrappers[DNODE].func = dmGetMgmtFunc();
|
||||
pDnode->wrappers[MNODE].func = mmGetMgmtFunc();
|
||||
|
@ -60,7 +61,7 @@ int32_t dmInitDnode(SDnode *pDnode) {
|
|||
pWrapper->pDnode = pDnode;
|
||||
pWrapper->name = dmNodeName(ntype);
|
||||
pWrapper->ntype = ntype;
|
||||
taosThreadRwlockInit(&pWrapper->lock, NULL);
|
||||
(void)taosThreadRwlockInit(&pWrapper->lock, NULL);
|
||||
|
||||
snprintf(path, sizeof(path), "%s%s%s", tsDataDir, TD_DIRSEP, pWrapper->name);
|
||||
pWrapper->path = taosStrdup(path);
|
||||
|
@ -214,8 +215,8 @@ int32_t dmInitVars(SDnode *pDnode) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
taosThreadRwlockInit(&pData->lock, NULL);
|
||||
taosThreadMutexInit(&pDnode->mutex, NULL);
|
||||
(void)taosThreadRwlockInit(&pData->lock, NULL);
|
||||
(void)taosThreadMutexInit(&pDnode->mutex, NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -223,16 +224,16 @@ void dmClearVars(SDnode *pDnode) {
|
|||
for (EDndNodeType ntype = DNODE; ntype < NODE_END; ++ntype) {
|
||||
SMgmtWrapper *pWrapper = &pDnode->wrappers[ntype];
|
||||
taosMemoryFreeClear(pWrapper->path);
|
||||
taosThreadRwlockDestroy(&pWrapper->lock);
|
||||
(void)taosThreadRwlockDestroy(&pWrapper->lock);
|
||||
}
|
||||
if (pDnode->lockfile != NULL) {
|
||||
taosUnLockFile(pDnode->lockfile);
|
||||
taosCloseFile(&pDnode->lockfile);
|
||||
(void)taosUnLockFile(pDnode->lockfile);
|
||||
(void)taosCloseFile(&pDnode->lockfile);
|
||||
pDnode->lockfile = NULL;
|
||||
}
|
||||
|
||||
SDnodeData *pData = &pDnode->data;
|
||||
taosThreadRwlockWrlock(&pData->lock);
|
||||
(void)taosThreadRwlockWrlock(&pData->lock);
|
||||
if (pData->oldDnodeEps != NULL) {
|
||||
if (dmWriteEps(pData) == 0) {
|
||||
dmRemoveDnodePairs(pData);
|
||||
|
@ -248,10 +249,10 @@ void dmClearVars(SDnode *pDnode) {
|
|||
taosHashCleanup(pData->dnodeHash);
|
||||
pData->dnodeHash = NULL;
|
||||
}
|
||||
taosThreadRwlockUnlock(&pData->lock);
|
||||
(void)taosThreadRwlockUnlock(&pData->lock);
|
||||
|
||||
taosThreadRwlockDestroy(&pData->lock);
|
||||
taosThreadMutexDestroy(&pDnode->mutex);
|
||||
(void)taosThreadRwlockDestroy(&pData->lock);
|
||||
(void)taosThreadMutexDestroy(&pDnode->mutex);
|
||||
memset(&pDnode->mutex, 0, sizeof(pDnode->mutex));
|
||||
}
|
||||
|
||||
|
@ -266,14 +267,14 @@ SMgmtWrapper *dmAcquireWrapper(SDnode *pDnode, EDndNodeType ntype) {
|
|||
SMgmtWrapper *pWrapper = &pDnode->wrappers[ntype];
|
||||
SMgmtWrapper *pRetWrapper = pWrapper;
|
||||
|
||||
taosThreadRwlockRdlock(&pWrapper->lock);
|
||||
(void)taosThreadRwlockRdlock(&pWrapper->lock);
|
||||
if (pWrapper->deployed) {
|
||||
int32_t refCount = atomic_add_fetch_32(&pWrapper->refCount, 1);
|
||||
// dTrace("node:%s, is acquired, ref:%d", pWrapper->name, refCount);
|
||||
} else {
|
||||
pRetWrapper = NULL;
|
||||
}
|
||||
taosThreadRwlockUnlock(&pWrapper->lock);
|
||||
(void)taosThreadRwlockUnlock(&pWrapper->lock);
|
||||
|
||||
return pRetWrapper;
|
||||
}
|
||||
|
@ -281,7 +282,7 @@ SMgmtWrapper *dmAcquireWrapper(SDnode *pDnode, EDndNodeType ntype) {
|
|||
int32_t dmMarkWrapper(SMgmtWrapper *pWrapper) {
|
||||
int32_t code = 0;
|
||||
|
||||
taosThreadRwlockRdlock(&pWrapper->lock);
|
||||
(void)taosThreadRwlockRdlock(&pWrapper->lock);
|
||||
if (pWrapper->deployed) {
|
||||
int32_t refCount = atomic_add_fetch_32(&pWrapper->refCount, 1);
|
||||
// dTrace("node:%s, is marked, ref:%d", pWrapper->name, refCount);
|
||||
|
@ -304,7 +305,7 @@ int32_t dmMarkWrapper(SMgmtWrapper *pWrapper) {
|
|||
break;
|
||||
}
|
||||
}
|
||||
taosThreadRwlockUnlock(&pWrapper->lock);
|
||||
(void)taosThreadRwlockUnlock(&pWrapper->lock);
|
||||
|
||||
return code;
|
||||
}
|
||||
|
@ -312,9 +313,9 @@ int32_t dmMarkWrapper(SMgmtWrapper *pWrapper) {
|
|||
void dmReleaseWrapper(SMgmtWrapper *pWrapper) {
|
||||
if (pWrapper == NULL) return;
|
||||
|
||||
taosThreadRwlockRdlock(&pWrapper->lock);
|
||||
(void)taosThreadRwlockRdlock(&pWrapper->lock);
|
||||
int32_t refCount = atomic_sub_fetch_32(&pWrapper->refCount, 1);
|
||||
taosThreadRwlockUnlock(&pWrapper->lock);
|
||||
(void)taosThreadRwlockUnlock(&pWrapper->lock);
|
||||
// dTrace("node:%s, is released, ref:%d", pWrapper->name, refCount);
|
||||
}
|
||||
|
||||
|
@ -343,7 +344,7 @@ void dmProcessNetTestReq(SDnode *pDnode, SRpcMsg *pMsg) {
|
|||
rsp.contLen = pMsg->contLen;
|
||||
}
|
||||
|
||||
rpcSendResponse(&rsp);
|
||||
(void)rpcSendResponse(&rsp);
|
||||
rpcFreeCont(pMsg->pCont);
|
||||
}
|
||||
|
||||
|
@ -360,11 +361,11 @@ void dmProcessServerStartupStatus(SDnode *pDnode, SRpcMsg *pMsg) {
|
|||
} else {
|
||||
rsp.pCont = rpcMallocCont(contLen);
|
||||
if (rsp.pCont != NULL) {
|
||||
tSerializeSServerStatusRsp(rsp.pCont, contLen, &statusRsp);
|
||||
(void)tSerializeSServerStatusRsp(rsp.pCont, contLen, &statusRsp);
|
||||
rsp.contLen = contLen;
|
||||
}
|
||||
}
|
||||
|
||||
rpcSendResponse(&rsp);
|
||||
(void)rpcSendResponse(&rsp);
|
||||
rpcFreeCont(pMsg->pCont);
|
||||
}
|
||||
|
|
|
@ -77,12 +77,12 @@ void dmCloseNode(SMgmtWrapper *pWrapper) {
|
|||
taosMsleep(10);
|
||||
}
|
||||
|
||||
taosThreadRwlockWrlock(&pWrapper->lock);
|
||||
(void)taosThreadRwlockWrlock(&pWrapper->lock);
|
||||
if (pWrapper->pMgmt != NULL) {
|
||||
(*pWrapper->func.closeFp)(pWrapper->pMgmt);
|
||||
pWrapper->pMgmt = NULL;
|
||||
}
|
||||
taosThreadRwlockUnlock(&pWrapper->lock);
|
||||
(void)taosThreadRwlockUnlock(&pWrapper->lock);
|
||||
|
||||
dInfo("node:%s, has been closed", pWrapper->name);
|
||||
}
|
||||
|
|
|
@ -18,18 +18,22 @@
|
|||
#include "qworker.h"
|
||||
#include "tversion.h"
|
||||
|
||||
static inline void dmSendRsp(SRpcMsg *pMsg) { rpcSendResponse(pMsg); }
|
||||
static inline void dmSendRsp(SRpcMsg *pMsg) { (void)rpcSendResponse(pMsg); }
|
||||
|
||||
static inline void dmBuildMnodeRedirectRsp(SDnode *pDnode, SRpcMsg *pMsg) {
|
||||
SEpSet epSet = {0};
|
||||
dmGetMnodeEpSetForRedirect(&pDnode->data, pMsg, &epSet);
|
||||
|
||||
const int32_t contLen = tSerializeSEpSet(NULL, 0, &epSet);
|
||||
int32_t contLen = tSerializeSEpSet(NULL, 0, &epSet);
|
||||
pMsg->pCont = rpcMallocCont(contLen);
|
||||
if (pMsg->pCont == NULL) {
|
||||
pMsg->code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
} else {
|
||||
tSerializeSEpSet(pMsg->pCont, contLen, &epSet);
|
||||
contLen = tSerializeSEpSet(pMsg->pCont, contLen, &epSet);
|
||||
if (contLen < 0) {
|
||||
pMsg->code = contLen;
|
||||
return;
|
||||
}
|
||||
pMsg->contLen = contLen;
|
||||
}
|
||||
}
|
||||
|
@ -65,13 +69,17 @@ static int32_t dmConvertErrCode(tmsg_t msgType, int32_t code) {
|
|||
return code;
|
||||
}
|
||||
static void dmUpdateRpcIpWhite(SDnodeData *pData, void *pTrans, SRpcMsg *pRpc) {
|
||||
int32_t code = 0;
|
||||
SUpdateIpWhite ipWhite = {0}; // aosMemoryCalloc(1, sizeof(SUpdateIpWhite));
|
||||
tDeserializeSUpdateIpWhite(pRpc->pCont, pRpc->contLen, &ipWhite);
|
||||
|
||||
rpcSetIpWhite(pTrans, &ipWhite);
|
||||
code = tDeserializeSUpdateIpWhite(pRpc->pCont, pRpc->contLen, &ipWhite);
|
||||
if (code < 0) {
|
||||
dError("failed to update rpc ip-white since: %s", tstrerror(code));
|
||||
return;
|
||||
}
|
||||
code = rpcSetIpWhite(pTrans, &ipWhite);
|
||||
pData->ipWhiteVer = ipWhite.ver;
|
||||
|
||||
tFreeSUpdateIpWhiteReq(&ipWhite);
|
||||
(void)tFreeSUpdateIpWhiteReq(&ipWhite);
|
||||
|
||||
rpcFreeCont(pRpc->pCont);
|
||||
}
|
||||
|
@ -80,7 +88,7 @@ static bool dmIsForbiddenIp(int8_t forbidden, char *user, uint32_t clientIp) {
|
|||
SIpV4Range range = {.ip = clientIp, .mask = 32};
|
||||
char buf[36] = {0};
|
||||
|
||||
rpcUtilSIpRangeToStr(&range, buf);
|
||||
(void)rpcUtilSIpRangeToStr(&range, buf);
|
||||
dError("User:%s host:%s not in ip white list", user, buf);
|
||||
return true;
|
||||
} else {
|
||||
|
@ -99,7 +107,7 @@ static void dmProcessRpcMsg(SDnode *pDnode, SRpcMsg *pRpc, SEpSet *pEpSet) {
|
|||
pRpc->info.handle, pRpc->contLen, pRpc->code, pRpc->info.ahandle, pRpc->info.refId);
|
||||
|
||||
int32_t svrVer = 0;
|
||||
taosVersionStrToInt(version, &svrVer);
|
||||
(void)taosVersionStrToInt(version, &svrVer);
|
||||
if ((code = taosCheckVersionCompatible(pRpc->info.cliVer, svrVer, 3)) != 0) {
|
||||
dError("Version not compatible, cli ver: %d, svr ver: %d", pRpc->info.cliVer, svrVer);
|
||||
goto _OVER;
|
||||
|
@ -238,7 +246,7 @@ _OVER:
|
|||
if (pWrapper != NULL) {
|
||||
dmSendRsp(&rsp);
|
||||
} else {
|
||||
rpcSendResponse(&rsp);
|
||||
(void)rpcSendResponse(&rsp);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -295,7 +303,7 @@ static inline int32_t dmSendReq(const SEpSet *pEpSet, SRpcMsg *pMsg) {
|
|||
return code;
|
||||
} else {
|
||||
pMsg->info.handle = 0;
|
||||
rpcSendRequest(pDnode->trans.clientRpc, pEpSet, pMsg, NULL);
|
||||
(void)rpcSendRequest(pDnode->trans.clientRpc, pEpSet, pMsg, NULL);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -314,14 +322,13 @@ static inline int32_t dmSendSyncReq(const SEpSet *pEpSet, SRpcMsg *pMsg) {
|
|||
pMsg->info.handle);
|
||||
return code;
|
||||
} else {
|
||||
rpcSendRequest(pDnode->trans.syncRpc, pEpSet, pMsg, NULL);
|
||||
return 0;
|
||||
return rpcSendRequest(pDnode->trans.syncRpc, pEpSet, pMsg, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void dmRegisterBrokenLinkArg(SRpcMsg *pMsg) { rpcRegisterBrokenLinkArg(pMsg); }
|
||||
static inline void dmRegisterBrokenLinkArg(SRpcMsg *pMsg) { (void)rpcRegisterBrokenLinkArg(pMsg); }
|
||||
|
||||
static inline void dmReleaseHandle(SRpcHandleInfo *pHandle, int8_t type) { rpcReleaseHandle(pHandle, type); }
|
||||
static inline void dmReleaseHandle(SRpcHandleInfo *pHandle, int8_t type) { (void)rpcReleaseHandle(pHandle, type); }
|
||||
|
||||
static bool rpcRfp(int32_t code, tmsg_t msgType) {
|
||||
if (code == TSDB_CODE_RPC_NETWORK_UNAVAIL || code == TSDB_CODE_RPC_BROKEN_LINK || code == TSDB_CODE_MNODE_NOT_FOUND ||
|
||||
|
@ -381,7 +388,7 @@ int32_t dmInitClient(SDnode *pDnode) {
|
|||
rpcInit.batchSize = 8 * 1024;
|
||||
rpcInit.timeToGetConn = tsTimeToGetAvailableConn;
|
||||
|
||||
taosVersionStrToInt(version, &(rpcInit.compatibilityVer));
|
||||
(void)taosVersionStrToInt(version, &(rpcInit.compatibilityVer));
|
||||
|
||||
pTrans->clientRpc = rpcOpen(&rpcInit);
|
||||
if (pTrans->clientRpc == NULL) {
|
||||
|
@ -425,7 +432,7 @@ int32_t dmInitStatusClient(SDnode *pDnode) {
|
|||
rpcInit.supportBatch = 1;
|
||||
rpcInit.batchSize = 8 * 1024;
|
||||
rpcInit.timeToGetConn = tsTimeToGetAvailableConn;
|
||||
taosVersionStrToInt(version, &(rpcInit.compatibilityVer));
|
||||
(void)taosVersionStrToInt(version, &(rpcInit.compatibilityVer));
|
||||
|
||||
pTrans->statusRpc = rpcOpen(&rpcInit);
|
||||
if (pTrans->statusRpc == NULL) {
|
||||
|
@ -470,7 +477,7 @@ int32_t dmInitSyncClient(SDnode *pDnode) {
|
|||
rpcInit.supportBatch = 1;
|
||||
rpcInit.batchSize = 8 * 1024;
|
||||
rpcInit.timeToGetConn = tsTimeToGetAvailableConn;
|
||||
taosVersionStrToInt(version, &(rpcInit.compatibilityVer));
|
||||
(void)taosVersionStrToInt(version, &(rpcInit.compatibilityVer));
|
||||
|
||||
pTrans->syncRpc = rpcOpen(&rpcInit);
|
||||
if (pTrans->syncRpc == NULL) {
|
||||
|
@ -521,7 +528,7 @@ int32_t dmInitServer(SDnode *pDnode) {
|
|||
rpcInit.idleTime = tsShellActivityTimer * 1000;
|
||||
rpcInit.parent = pDnode;
|
||||
rpcInit.compressSize = tsCompressMsgSize;
|
||||
taosVersionStrToInt(version, &(rpcInit.compatibilityVer));
|
||||
(void)taosVersionStrToInt(version, &(rpcInit.compatibilityVer));
|
||||
pTrans->serverRpc = rpcOpen(&rpcInit);
|
||||
if (pTrans->serverRpc == NULL) {
|
||||
dError("failed to init dnode rpc server");
|
||||
|
|
|
@ -33,7 +33,7 @@ static int32_t dmReadDnodePairs(SDnodeData *pData);
|
|||
|
||||
void dmGetDnodeEp(void *data, int32_t dnodeId, char *pEp, char *pFqdn, uint16_t *pPort) {
|
||||
SDnodeData *pData = data;
|
||||
taosThreadRwlockRdlock(&pData->lock);
|
||||
(void)taosThreadRwlockRdlock(&pData->lock);
|
||||
|
||||
SDnodeEp *pDnodeEp = taosHashGet(pData->dnodeHash, &dnodeId, sizeof(int32_t));
|
||||
if (pDnodeEp != NULL) {
|
||||
|
@ -48,7 +48,7 @@ void dmGetDnodeEp(void *data, int32_t dnodeId, char *pEp, char *pFqdn, uint16_t
|
|||
}
|
||||
}
|
||||
|
||||
taosThreadRwlockUnlock(&pData->lock);
|
||||
(void)taosThreadRwlockUnlock(&pData->lock);
|
||||
}
|
||||
|
||||
static int32_t dmDecodeEps(SJson *pJson, SDnodeData *pData) {
|
||||
|
@ -255,8 +255,8 @@ _OVER:
|
|||
if (taosArrayGetSize(pData->dnodeEps) == 0) {
|
||||
SDnodeEp dnodeEp = {0};
|
||||
dnodeEp.isMnode = 1;
|
||||
taosGetFqdnPortFromEp(tsFirst, &dnodeEp.ep);
|
||||
taosArrayPush(pData->dnodeEps, &dnodeEp);
|
||||
(void)taosGetFqdnPortFromEp(tsFirst, &dnodeEp.ep);
|
||||
(void)taosArrayPush(pData->dnodeEps, &dnodeEp);
|
||||
}
|
||||
|
||||
if ((code = dmReadDnodePairs(pData)) != 0) {
|
||||
|
@ -337,7 +337,7 @@ int32_t dmWriteEps(SDnodeData *pData) {
|
|||
if (taosWriteFile(pFile, buffer, len) <= 0) TAOS_CHECK_GOTO(TAOS_SYSTEM_ERROR(errno), NULL, _OVER);
|
||||
if (taosFsyncFile(pFile) < 0) TAOS_CHECK_GOTO(TAOS_SYSTEM_ERROR(errno), NULL, _OVER);
|
||||
|
||||
taosCloseFile(&pFile);
|
||||
(void)taosCloseFile(&pFile);
|
||||
if (taosRenameFile(file, realfile) != 0) TAOS_CHECK_GOTO(TAOS_SYSTEM_ERROR(errno), NULL, _OVER);
|
||||
|
||||
code = 0;
|
||||
|
@ -348,7 +348,7 @@ int32_t dmWriteEps(SDnodeData *pData) {
|
|||
_OVER:
|
||||
if (pJson != NULL) tjsonDelete(pJson);
|
||||
if (buffer != NULL) taosMemoryFree(buffer);
|
||||
if (pFile != NULL) taosCloseFile(&pFile);
|
||||
if (pFile != NULL) (void)taosCloseFile(&pFile);
|
||||
|
||||
if (code != 0) {
|
||||
dError("failed to write dnode file:%s since %s, dnodeVer:%" PRId64, realfile, tstrerror(code), pData->dnodeVer);
|
||||
|
@ -358,18 +358,18 @@ _OVER:
|
|||
|
||||
int32_t dmGetDnodeSize(SDnodeData *pData) {
|
||||
int32_t size = 0;
|
||||
taosThreadRwlockRdlock(&pData->lock);
|
||||
(void)taosThreadRwlockRdlock(&pData->lock);
|
||||
size = taosArrayGetSize(pData->dnodeEps);
|
||||
taosThreadRwlockUnlock(&pData->lock);
|
||||
(void)taosThreadRwlockUnlock(&pData->lock);
|
||||
return size;
|
||||
}
|
||||
|
||||
void dmUpdateEps(SDnodeData *pData, SArray *eps) {
|
||||
taosThreadRwlockWrlock(&pData->lock);
|
||||
(void)taosThreadRwlockWrlock(&pData->lock);
|
||||
dDebug("new dnode list get from mnode, dnodeVer:%" PRId64, pData->dnodeVer);
|
||||
dmResetEps(pData, eps);
|
||||
dmWriteEps(pData);
|
||||
taosThreadRwlockUnlock(&pData->lock);
|
||||
(void)dmWriteEps(pData);
|
||||
(void)taosThreadRwlockUnlock(&pData->lock);
|
||||
}
|
||||
|
||||
static void dmResetEps(SDnodeData *pData, SArray *dnodeEps) {
|
||||
|
@ -398,7 +398,7 @@ static void dmResetEps(SDnodeData *pData, SArray *dnodeEps) {
|
|||
|
||||
for (int32_t i = 0; i < numOfEps; i++) {
|
||||
SDnodeEp *pDnodeEp = taosArrayGet(dnodeEps, i);
|
||||
taosHashPut(pData->dnodeHash, &pDnodeEp->id, sizeof(int32_t), pDnodeEp, sizeof(SDnodeEp));
|
||||
(void)taosHashPut(pData->dnodeHash, &pDnodeEp->id, sizeof(int32_t), pDnodeEp, sizeof(SDnodeEp));
|
||||
}
|
||||
|
||||
pData->validMnodeEps = true;
|
||||
|
@ -418,7 +418,7 @@ static void dmPrintEps(SDnodeData *pData) {
|
|||
static bool dmIsEpChanged(SDnodeData *pData, int32_t dnodeId, const char *ep) {
|
||||
bool changed = false;
|
||||
if (dnodeId == 0) return changed;
|
||||
taosThreadRwlockRdlock(&pData->lock);
|
||||
(void)taosThreadRwlockRdlock(&pData->lock);
|
||||
|
||||
SDnodeEp *pDnodeEp = taosHashGet(pData->dnodeHash, &dnodeId, sizeof(int32_t));
|
||||
if (pDnodeEp != NULL) {
|
||||
|
@ -430,14 +430,14 @@ static bool dmIsEpChanged(SDnodeData *pData, int32_t dnodeId, const char *ep) {
|
|||
}
|
||||
}
|
||||
|
||||
taosThreadRwlockUnlock(&pData->lock);
|
||||
(void)taosThreadRwlockUnlock(&pData->lock);
|
||||
return changed;
|
||||
}
|
||||
|
||||
void dmGetMnodeEpSet(SDnodeData *pData, SEpSet *pEpSet) {
|
||||
taosThreadRwlockRdlock(&pData->lock);
|
||||
(void)taosThreadRwlockRdlock(&pData->lock);
|
||||
*pEpSet = pData->mnodeEps;
|
||||
taosThreadRwlockUnlock(&pData->lock);
|
||||
(void)taosThreadRwlockUnlock(&pData->lock);
|
||||
}
|
||||
|
||||
void dmEpSetToStr(char *buf, int32_t len, SEpSet *epSet) {
|
||||
|
@ -464,12 +464,12 @@ static FORCE_INLINE void dmSwapEps(SEp *epLhs, SEp *epRhs) {
|
|||
}
|
||||
|
||||
void dmRotateMnodeEpSet(SDnodeData *pData) {
|
||||
taosThreadRwlockRdlock(&pData->lock);
|
||||
(void)taosThreadRwlockRdlock(&pData->lock);
|
||||
SEpSet *pEpSet = &pData->mnodeEps;
|
||||
for (int i = 1; i < pEpSet->numOfEps; i++) {
|
||||
dmSwapEps(&pEpSet->eps[i - 1], &pEpSet->eps[i]);
|
||||
}
|
||||
taosThreadRwlockUnlock(&pData->lock);
|
||||
(void)taosThreadRwlockUnlock(&pData->lock);
|
||||
}
|
||||
|
||||
void dmGetMnodeEpSetForRedirect(SDnodeData *pData, SRpcMsg *pMsg, SEpSet *pEpSet) {
|
||||
|
@ -486,9 +486,9 @@ void dmGetMnodeEpSetForRedirect(SDnodeData *pData, SRpcMsg *pMsg, SEpSet *pEpSet
|
|||
|
||||
void dmSetMnodeEpSet(SDnodeData *pData, SEpSet *pEpSet) {
|
||||
if (memcmp(pEpSet, &pData->mnodeEps, sizeof(SEpSet)) == 0) return;
|
||||
taosThreadRwlockWrlock(&pData->lock);
|
||||
(void)taosThreadRwlockWrlock(&pData->lock);
|
||||
pData->mnodeEps = *pEpSet;
|
||||
taosThreadRwlockUnlock(&pData->lock);
|
||||
(void)taosThreadRwlockUnlock(&pData->lock);
|
||||
|
||||
dInfo("mnode is changed, num:%d use:%d", pEpSet->numOfEps, pEpSet->inUse);
|
||||
for (int32_t i = 0; i < pEpSet->numOfEps; ++i) {
|
||||
|
@ -502,7 +502,7 @@ bool dmUpdateDnodeInfo(void *data, int32_t *did, int64_t *clusterId, char *fqdn,
|
|||
int32_t dnodeId = -1;
|
||||
if (did != NULL) dnodeId = *did;
|
||||
|
||||
taosThreadRwlockRdlock(&pData->lock);
|
||||
(void)taosThreadRwlockRdlock(&pData->lock);
|
||||
|
||||
if (pData->oldDnodeEps != NULL) {
|
||||
int32_t size = (int32_t)taosArrayGetSize(pData->oldDnodeEps);
|
||||
|
@ -542,7 +542,7 @@ bool dmUpdateDnodeInfo(void *data, int32_t *did, int64_t *clusterId, char *fqdn,
|
|||
}
|
||||
}
|
||||
|
||||
taosThreadRwlockUnlock(&pData->lock);
|
||||
(void)taosThreadRwlockUnlock(&pData->lock);
|
||||
return updated;
|
||||
}
|
||||
|
||||
|
@ -550,26 +550,26 @@ static int32_t dmDecodeEpPairs(SJson *pJson, SDnodeData *pData) {
|
|||
int32_t code = 0;
|
||||
|
||||
SJson *dnodes = tjsonGetObjectItem(pJson, "dnodes");
|
||||
if (dnodes == NULL) return -1;
|
||||
if (dnodes == NULL) return TSDB_CODE_INVALID_CFG_VALUE;
|
||||
int32_t numOfDnodes = tjsonGetArraySize(dnodes);
|
||||
|
||||
for (int32_t i = 0; i < numOfDnodes; ++i) {
|
||||
SJson *dnode = tjsonGetArrayItem(dnodes, i);
|
||||
if (dnode == NULL) return -1;
|
||||
if (dnode == NULL) return TSDB_CODE_INVALID_CFG_VALUE;
|
||||
|
||||
SDnodeEpPair pair = {0};
|
||||
tjsonGetInt32ValueFromDouble(dnode, "id", pair.id, code);
|
||||
if (code < 0) return -1;
|
||||
if (code < 0) return TSDB_CODE_INVALID_CFG_VALUE;
|
||||
code = tjsonGetStringValue(dnode, "fqdn", pair.oldFqdn);
|
||||
if (code < 0) return -1;
|
||||
if (code < 0) return TSDB_CODE_INVALID_CFG_VALUE;
|
||||
tjsonGetUInt16ValueFromDouble(dnode, "port", pair.oldPort, code);
|
||||
if (code < 0) return -1;
|
||||
if (code < 0) return TSDB_CODE_INVALID_CFG_VALUE;
|
||||
code = tjsonGetStringValue(dnode, "new_fqdn", pair.newFqdn);
|
||||
if (code < 0) return -1;
|
||||
if (code < 0) return TSDB_CODE_INVALID_CFG_VALUE;
|
||||
tjsonGetUInt16ValueFromDouble(dnode, "new_port", pair.newPort, code);
|
||||
if (code < 0) return -1;
|
||||
if (code < 0) return TSDB_CODE_INVALID_CFG_VALUE;
|
||||
|
||||
if (taosArrayPush(pData->oldDnodeEps, &pair) == NULL) return -1;
|
||||
if (taosArrayPush(pData->oldDnodeEps, &pair) == NULL) return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
return code;
|
||||
|
|
|
@ -211,7 +211,7 @@ int32_t dmCheckRunning(const char *dataDir, TdFilePtr *pFile) {
|
|||
|
||||
if (ret < 0) {
|
||||
code = TAOS_SYSTEM_ERROR(errno);
|
||||
taosCloseFile(pFile);
|
||||
(void)taosCloseFile(pFile);
|
||||
*pFile = NULL;
|
||||
return code;
|
||||
}
|
||||
|
@ -239,7 +239,7 @@ static int32_t dmWriteCheckCodeFile(char *file, char *realfile, char *key, bool
|
|||
opts.source = DM_KEY_INDICATOR;
|
||||
opts.result = result;
|
||||
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);
|
||||
if (pFile == NULL) {
|
||||
|
@ -359,7 +359,7 @@ static int32_t dmCompareEncryptKey(char *file, char *key, bool toLogFile) {
|
|||
opts.source = content;
|
||||
opts.result = result;
|
||||
opts.unitLen = 16;
|
||||
CBC_Decrypt(&opts);
|
||||
(void)CBC_Decrypt(&opts);
|
||||
|
||||
if (strcmp(opts.result, DM_KEY_INDICATOR) != 0) {
|
||||
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) {
|
||||
taosGetCpuUsage(&pInfo->cpu_system, &pInfo->cpu_engine);
|
||||
taosGetCpuCores(&pInfo->cpu_cores, false);
|
||||
taosGetProcMemory(&pInfo->mem_engine);
|
||||
taosGetSysMemory(&pInfo->mem_system);
|
||||
(void)taosGetProcMemory(&pInfo->mem_engine);
|
||||
(void)taosGetSysMemory(&pInfo->mem_system);
|
||||
pInfo->mem_total = tsTotalMemoryKB;
|
||||
pInfo->disk_engine = 0;
|
||||
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));
|
||||
if (rsp.pTsmaRsp) rsp.pTsmaRsp->pTsmas = taosArrayInit(4, POINTER_BYTES);
|
||||
if (rsp.pTsmaRsp && rsp.pTsmaRsp->pTsmas) {
|
||||
rsp.dbTsmaVersion = pDb->tsmaVersion;
|
||||
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);
|
||||
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;
|
||||
}
|
||||
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) {
|
||||
mndReleaseDb(pMnode, pDb);
|
||||
mError("db:%s, failed to malloc usedb response", pDb->name);
|
||||
taosArrayDestroyP(rsp.pTsmaRsp->pTsmas, tFreeAndClearTableTSMAInfo);
|
||||
taosMemoryFreeClear(rsp.pTsmaRsp);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -185,8 +185,8 @@ static int32_t mndCreateDefaultDnode(SMnode *pMnode) {
|
|||
|
||||
TAOS_CHECK_GOTO(mndTransPrepare(pMnode, pTrans), NULL, _OVER);
|
||||
code = 0;
|
||||
mndUpdateIpWhiteForAllUser(pMnode, TSDB_DEFAULT_USER, dnodeObj.fqdn, IP_WHITE_ADD,
|
||||
1); // TODO: check the return value
|
||||
(void)mndUpdateIpWhiteForAllUser(pMnode, TSDB_DEFAULT_USER, dnodeObj.fqdn, IP_WHITE_ADD,
|
||||
1); // TODO: check the return value
|
||||
|
||||
_OVER:
|
||||
mndTransDrop(pTrans);
|
||||
|
@ -916,7 +916,8 @@ static int32_t mndCreateDnode(SMnode *pMnode, SRpcMsg *pReq, SCreateDnodeReq *pC
|
|||
TAOS_CHECK_GOTO(mndTransPrepare(pMnode, pTrans), NULL, _OVER);
|
||||
code = 0;
|
||||
|
||||
mndUpdateIpWhiteForAllUser(pMnode, TSDB_DEFAULT_USER, dnodeObj.fqdn, IP_WHITE_ADD, 1); // TODO: check the return value
|
||||
(void)mndUpdateIpWhiteForAllUser(pMnode, TSDB_DEFAULT_USER, dnodeObj.fqdn, IP_WHITE_ADD,
|
||||
1); // TODO: check the return value
|
||||
_OVER:
|
||||
mndTransDrop(pTrans);
|
||||
sdbFreeRaw(pRaw);
|
||||
|
@ -1231,7 +1232,8 @@ static int32_t mndDropDnode(SMnode *pMnode, SRpcMsg *pReq, SDnodeObj *pDnode, SM
|
|||
|
||||
TAOS_CHECK_GOTO(mndTransPrepare(pMnode, pTrans), NULL, _OVER);
|
||||
|
||||
mndUpdateIpWhiteForAllUser(pMnode, TSDB_DEFAULT_USER, pDnode->fqdn, IP_WHITE_DROP, 1); // TODO: check the return value
|
||||
(void)mndUpdateIpWhiteForAllUser(pMnode, TSDB_DEFAULT_USER, pDnode->fqdn, IP_WHITE_DROP,
|
||||
1); // TODO: check the return value
|
||||
code = 0;
|
||||
|
||||
_OVER:
|
||||
|
@ -1749,7 +1751,7 @@ static int32_t mndRetrieveDnodes(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB
|
|||
#ifdef TD_ENTERPRISE
|
||||
STR_TO_VARSTR(buf, pDnode->machineId);
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, numOfRows, buf, false);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, buf, false);
|
||||
#endif
|
||||
|
||||
numOfRows++;
|
||||
|
|
|
@ -74,7 +74,7 @@ void dumpFunc(SSdb *pSdb, SJson *json) {
|
|||
void dumpDb(SSdb *pSdb, SJson *json) {
|
||||
void *pIter = NULL;
|
||||
SJson *items = tjsonCreateObject();
|
||||
tjsonAddItemToObject(json, "dbs", items);
|
||||
(void)tjsonAddItemToObject(json, "dbs", items);
|
||||
|
||||
while (1) {
|
||||
SDbObj *pObj = NULL;
|
||||
|
@ -82,7 +82,7 @@ void dumpDb(SSdb *pSdb, SJson *json) {
|
|||
if (pIter == NULL) break;
|
||||
|
||||
SJson *item = tjsonCreateObject();
|
||||
tjsonAddItemToObject(items, "db", item);
|
||||
(void)tjsonAddItemToObject(items, "db", item);
|
||||
|
||||
(void)tjsonAddStringToObject(item, "name", mndGetDbStr(pObj->name));
|
||||
(void)tjsonAddStringToObject(item, "acct", pObj->acct);
|
||||
|
@ -546,7 +546,7 @@ void dumpHeader(SSdb *pSdb, SJson *json) {
|
|||
(void)tjsonAddStringToObject(json, "applyConfig", i642str(pSdb->applyConfig));
|
||||
|
||||
SJson *maxIdsJson = tjsonCreateObject();
|
||||
tjsonAddItemToObject(json, "maxIds", maxIdsJson);
|
||||
(void)tjsonAddItemToObject(json, "maxIds", maxIdsJson);
|
||||
for (int32_t i = 0; i < SDB_MAX; ++i) {
|
||||
if(i == 5) continue;
|
||||
int64_t maxId = 0;
|
||||
|
@ -557,7 +557,7 @@ void dumpHeader(SSdb *pSdb, SJson *json) {
|
|||
}
|
||||
|
||||
SJson *tableVersJson = tjsonCreateObject();
|
||||
tjsonAddItemToObject(json, "tableVers", tableVersJson);
|
||||
(void)tjsonAddItemToObject(json, "tableVers", tableVersJson);
|
||||
for (int32_t i = 0; i < SDB_MAX; ++i) {
|
||||
int64_t tableVer = 0;
|
||||
if (i < SDB_MAX) {
|
||||
|
@ -581,8 +581,8 @@ void mndDumpSdb() {
|
|||
msgCb.mgmt = (SMgmtWrapper *)(&msgCb); // hack
|
||||
tmsgSetDefault(&msgCb);
|
||||
|
||||
walInit();
|
||||
syncInit();
|
||||
(void)walInit();
|
||||
(void)syncInit();
|
||||
|
||||
SMnodeOpt opt = {.msgCb = msgCb};
|
||||
SMnode *pMnode = mndOpen(path, &opt);
|
||||
|
@ -620,10 +620,10 @@ void mndDumpSdb() {
|
|||
mError("failed to write %s since %s", file, terrstr());
|
||||
return;
|
||||
}
|
||||
taosWriteFile(pFile, pCont, contLen);
|
||||
taosWriteFile(pFile, "\n", 1);
|
||||
(void)taosWriteFile(pFile, pCont, contLen);
|
||||
(void)taosWriteFile(pFile, "\n", 1);
|
||||
UNUSED(taosFsyncFile(pFile));
|
||||
taosCloseFile(&pFile);
|
||||
(void)taosCloseFile(&pFile);
|
||||
tjsonDelete(json);
|
||||
taosMemoryFree(pCont);
|
||||
|
||||
|
|
|
@ -598,7 +598,7 @@ static int32_t mndProcessRetrieveFuncReq(SRpcMsg *pReq) {
|
|||
goto RETRIEVE_FUNC_OVER;
|
||||
}
|
||||
|
||||
tSerializeSRetrieveFuncRsp(pRsp, contLen, &retrieveRsp);
|
||||
(void)tSerializeSRetrieveFuncRsp(pRsp, contLen, &retrieveRsp);
|
||||
|
||||
pReq->info.rsp = pRsp;
|
||||
pReq->info.rspLen = contLen;
|
||||
|
|
|
@ -159,7 +159,7 @@ static void *mndBuildDropIdxReq(SMnode *pMnode, SVgObj *pVgroup, SStbObj *pStbOb
|
|||
pHead->vgId = htonl(pVgroup->vgId);
|
||||
|
||||
void *pBuf = POINTER_SHIFT(pHead, sizeof(SMsgHead));
|
||||
tSerializeSDropIdxReq(pBuf, len - sizeof(SMsgHead), &req);
|
||||
(void)tSerializeSDropIdxReq(pBuf, len - sizeof(SMsgHead), &req);
|
||||
*contLen = len;
|
||||
return pHead;
|
||||
_err:
|
||||
|
@ -333,10 +333,10 @@ void mndReleaseIdx(SMnode *pMnode, SIdxObj *pIdx) {
|
|||
|
||||
SDbObj *mndAcquireDbByIdx(SMnode *pMnode, const char *idxName) {
|
||||
SName name = {0};
|
||||
tNameFromString(&name, idxName, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE);
|
||||
(void)tNameFromString(&name, idxName, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE);
|
||||
|
||||
char db[TSDB_TABLE_FNAME_LEN] = {0};
|
||||
tNameGetFullDbName(&name, db);
|
||||
(void)tNameGetFullDbName(&name, db);
|
||||
|
||||
return mndAcquireDb(pMnode, db);
|
||||
}
|
||||
|
@ -578,7 +578,7 @@ int32_t mndRetrieveTagIdx(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, i
|
|||
cols = 0;
|
||||
|
||||
SName idxName = {0};
|
||||
tNameFromString(&idxName, pIdx->name, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE);
|
||||
(void)tNameFromString(&idxName, pIdx->name, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE);
|
||||
char n1[TSDB_TABLE_FNAME_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||
|
||||
STR_TO_VARSTR(n1, (char *)tNameGetTableName(&idxName));
|
||||
|
@ -587,37 +587,37 @@ int32_t mndRetrieveTagIdx(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, i
|
|||
STR_TO_VARSTR(n2, (char *)mndGetDbStr(pIdx->db));
|
||||
|
||||
SName stbName = {0};
|
||||
tNameFromString(&stbName, pIdx->stb, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE);
|
||||
(void)tNameFromString(&stbName, pIdx->stb, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE);
|
||||
char n3[TSDB_TABLE_FNAME_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||
STR_TO_VARSTR(n3, (char *)tNameGetTableName(&stbName));
|
||||
|
||||
SColumnInfoData *pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, numOfRows, (const char *)n1, false);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)n1, false);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, numOfRows, (const char *)n2, false);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)n2, false);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, numOfRows, (const char *)n3, false);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)n3, false);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
|
||||
colDataSetVal(pColInfo, numOfRows, NULL, true);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, NULL, true);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, numOfRows, (const char *)&pIdx->createdTime, false);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&pIdx->createdTime, false);
|
||||
|
||||
char col[TSDB_TABLE_FNAME_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||
STR_TO_VARSTR(col, (char *)pIdx->colName);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, numOfRows, (const char *)col, false);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)col, false);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
|
||||
char tag[TSDB_TABLE_FNAME_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||
STR_TO_VARSTR(tag, (char *)"tag_index");
|
||||
colDataSetVal(pColInfo, numOfRows, (const char *)tag, false);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)tag, false);
|
||||
|
||||
numOfRows++;
|
||||
sdbRelease(pSdb, pIdx);
|
||||
|
|
|
@ -48,32 +48,32 @@
|
|||
|
||||
static inline int32_t mndAcquireRpc(SMnode *pMnode) {
|
||||
int32_t code = 0;
|
||||
taosThreadRwlockRdlock(&pMnode->lock);
|
||||
(void)taosThreadRwlockRdlock(&pMnode->lock);
|
||||
if (pMnode->stopped) {
|
||||
code = TSDB_CODE_APP_IS_STOPPING;
|
||||
} else if (!mndIsLeader(pMnode)) {
|
||||
code = -1;
|
||||
} else {
|
||||
#if 1
|
||||
atomic_add_fetch_32(&pMnode->rpcRef, 1);
|
||||
(void)atomic_add_fetch_32(&pMnode->rpcRef, 1);
|
||||
#else
|
||||
int32_t ref = atomic_add_fetch_32(&pMnode->rpcRef, 1);
|
||||
mTrace("mnode rpc is acquired, ref:%d", ref);
|
||||
#endif
|
||||
}
|
||||
taosThreadRwlockUnlock(&pMnode->lock);
|
||||
(void)taosThreadRwlockUnlock(&pMnode->lock);
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
|
||||
static inline void mndReleaseRpc(SMnode *pMnode) {
|
||||
taosThreadRwlockRdlock(&pMnode->lock);
|
||||
(void)taosThreadRwlockRdlock(&pMnode->lock);
|
||||
#if 1
|
||||
atomic_sub_fetch_32(&pMnode->rpcRef, 1);
|
||||
(void)atomic_sub_fetch_32(&pMnode->rpcRef, 1);
|
||||
#else
|
||||
int32_t ref = atomic_sub_fetch_32(&pMnode->rpcRef, 1);
|
||||
mTrace("mnode rpc is released, ref:%d", ref);
|
||||
#endif
|
||||
taosThreadRwlockUnlock(&pMnode->lock);
|
||||
(void)taosThreadRwlockUnlock(&pMnode->lock);
|
||||
}
|
||||
|
||||
static void *mndBuildTimerMsg(int32_t *pContLen) {
|
||||
|
@ -85,7 +85,7 @@ static void *mndBuildTimerMsg(int32_t *pContLen) {
|
|||
void *pReq = rpcMallocCont(contLen);
|
||||
if (pReq == NULL) return NULL;
|
||||
|
||||
tSerializeSMTimerMsg(pReq, contLen, &timerReq);
|
||||
(void)tSerializeSMTimerMsg(pReq, contLen, &timerReq);
|
||||
*pContLen = contLen;
|
||||
return pReq;
|
||||
}
|
||||
|
@ -96,7 +96,8 @@ static void mndPullupTrans(SMnode *pMnode) {
|
|||
void *pReq = mndBuildTimerMsg(&contLen);
|
||||
if (pReq != NULL) {
|
||||
SRpcMsg rpcMsg = {.msgType = TDMT_MND_TRANS_TIMER, .pCont = pReq, .contLen = contLen};
|
||||
tmsgPutToQueue(&pMnode->msgCb, WRITE_QUEUE, &rpcMsg);
|
||||
//TODO check return value
|
||||
(void)tmsgPutToQueue(&pMnode->msgCb, WRITE_QUEUE, &rpcMsg);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -106,7 +107,8 @@ static void mndPullupCompacts(SMnode *pMnode) {
|
|||
void *pReq = mndBuildTimerMsg(&contLen);
|
||||
if (pReq != NULL) {
|
||||
SRpcMsg rpcMsg = {.msgType = TDMT_MND_COMPACT_TIMER, .pCont = pReq, .contLen = contLen};
|
||||
tmsgPutToQueue(&pMnode->msgCb, WRITE_QUEUE, &rpcMsg);
|
||||
//TODO check return value
|
||||
(void)tmsgPutToQueue(&pMnode->msgCb, WRITE_QUEUE, &rpcMsg);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -115,7 +117,8 @@ static void mndPullupTtl(SMnode *pMnode) {
|
|||
int32_t contLen = 0;
|
||||
void *pReq = mndBuildTimerMsg(&contLen);
|
||||
SRpcMsg rpcMsg = {.msgType = TDMT_MND_TTL_TIMER, .pCont = pReq, .contLen = contLen};
|
||||
tmsgPutToQueue(&pMnode->msgCb, WRITE_QUEUE, &rpcMsg);
|
||||
//TODO check return value
|
||||
(void)tmsgPutToQueue(&pMnode->msgCb, WRITE_QUEUE, &rpcMsg);
|
||||
}
|
||||
|
||||
static void mndPullupTrimDb(SMnode *pMnode) {
|
||||
|
@ -123,7 +126,8 @@ static void mndPullupTrimDb(SMnode *pMnode) {
|
|||
int32_t contLen = 0;
|
||||
void *pReq = mndBuildTimerMsg(&contLen);
|
||||
SRpcMsg rpcMsg = {.msgType = TDMT_MND_S3MIGRATE_DB_TIMER, .pCont = pReq, .contLen = contLen};
|
||||
tmsgPutToQueue(&pMnode->msgCb, WRITE_QUEUE, &rpcMsg);
|
||||
// TODO check return value
|
||||
(void)tmsgPutToQueue(&pMnode->msgCb, WRITE_QUEUE, &rpcMsg);
|
||||
}
|
||||
|
||||
static void mndPullupS3MigrateDb(SMnode *pMnode) {
|
||||
|
@ -131,7 +135,8 @@ static void mndPullupS3MigrateDb(SMnode *pMnode) {
|
|||
int32_t contLen = 0;
|
||||
void *pReq = mndBuildTimerMsg(&contLen);
|
||||
SRpcMsg rpcMsg = {.msgType = TDMT_MND_TRIM_DB_TIMER, .pCont = pReq, .contLen = contLen};
|
||||
tmsgPutToQueue(&pMnode->msgCb, WRITE_QUEUE, &rpcMsg);
|
||||
// TODO check return value
|
||||
(void)tmsgPutToQueue(&pMnode->msgCb, WRITE_QUEUE, &rpcMsg);
|
||||
}
|
||||
|
||||
static int32_t mndPullupArbHeartbeat(SMnode *pMnode) {
|
||||
|
@ -155,7 +160,7 @@ static void mndCalMqRebalance(SMnode *pMnode) {
|
|||
void *pReq = mndBuildTimerMsg(&contLen);
|
||||
if (pReq != NULL) {
|
||||
SRpcMsg rpcMsg = {.msgType = TDMT_MND_TMQ_TIMER, .pCont = pReq, .contLen = contLen};
|
||||
tmsgPutToQueue(&pMnode->msgCb, WRITE_QUEUE, &rpcMsg);
|
||||
(void)tmsgPutToQueue(&pMnode->msgCb, WRITE_QUEUE, &rpcMsg);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -164,7 +169,8 @@ static void mndStreamCheckpointTimer(SMnode *pMnode) {
|
|||
if (pMsg != NULL) {
|
||||
int32_t size = sizeof(SMStreamDoCheckpointMsg);
|
||||
SRpcMsg rpcMsg = {.msgType = TDMT_MND_STREAM_BEGIN_CHECKPOINT, .pCont = pMsg, .contLen = size};
|
||||
tmsgPutToQueue(&pMnode->msgCb, WRITE_QUEUE, &rpcMsg);
|
||||
// TODO check return value
|
||||
(void)tmsgPutToQueue(&pMnode->msgCb, WRITE_QUEUE, &rpcMsg);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -173,7 +179,8 @@ static void mndStreamCheckNode(SMnode *pMnode) {
|
|||
void *pReq = mndBuildTimerMsg(&contLen);
|
||||
if (pReq != NULL) {
|
||||
SRpcMsg rpcMsg = {.msgType = TDMT_MND_NODECHECK_TIMER, .pCont = pReq, .contLen = contLen};
|
||||
tmsgPutToQueue(&pMnode->msgCb, READ_QUEUE, &rpcMsg);
|
||||
// TODO check return value
|
||||
(void)tmsgPutToQueue(&pMnode->msgCb, READ_QUEUE, &rpcMsg);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -182,7 +189,8 @@ static void mndStreamConsensusChkpt(SMnode *pMnode) {
|
|||
void *pReq = mndBuildTimerMsg(&contLen);
|
||||
if (pReq != NULL) {
|
||||
SRpcMsg rpcMsg = {.msgType = TDMT_MND_STREAM_CONSEN_TIMER, .pCont = pReq, .contLen = contLen};
|
||||
tmsgPutToQueue(&pMnode->msgCb, WRITE_QUEUE, &rpcMsg);
|
||||
// TODO check return value
|
||||
(void)tmsgPutToQueue(&pMnode->msgCb, WRITE_QUEUE, &rpcMsg);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -192,7 +200,8 @@ static void mndPullupTelem(SMnode *pMnode) {
|
|||
void *pReq = mndBuildTimerMsg(&contLen);
|
||||
if (pReq != NULL) {
|
||||
SRpcMsg rpcMsg = {.msgType = TDMT_MND_TELEM_TIMER, .pCont = pReq, .contLen = contLen};
|
||||
tmsgPutToQueue(&pMnode->msgCb, READ_QUEUE, &rpcMsg);
|
||||
// TODO check return value
|
||||
(void)tmsgPutToQueue(&pMnode->msgCb, READ_QUEUE, &rpcMsg);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -203,7 +212,8 @@ static void mndPullupGrant(SMnode *pMnode) {
|
|||
if (pReq != NULL) {
|
||||
SRpcMsg rpcMsg = {
|
||||
.msgType = TDMT_MND_GRANT_HB_TIMER, .pCont = pReq, .contLen = contLen, .info.ahandle = (void *)0x9527};
|
||||
tmsgPutToQueue(&pMnode->msgCb, WRITE_QUEUE, &rpcMsg);
|
||||
// TODO check return value
|
||||
(void)tmsgPutToQueue(&pMnode->msgCb, WRITE_QUEUE, &rpcMsg);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -214,7 +224,8 @@ static void mndIncreaseUpTime(SMnode *pMnode) {
|
|||
if (pReq != NULL) {
|
||||
SRpcMsg rpcMsg = {
|
||||
.msgType = TDMT_MND_UPTIME_TIMER, .pCont = pReq, .contLen = contLen, .info.ahandle = (void *)0x9528};
|
||||
tmsgPutToQueue(&pMnode->msgCb, WRITE_QUEUE, &rpcMsg);
|
||||
// TODO check return value
|
||||
(void)tmsgPutToQueue(&pMnode->msgCb, WRITE_QUEUE, &rpcMsg);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -287,24 +298,24 @@ static void mndCheckDnodeOffline(SMnode *pMnode) {
|
|||
|
||||
static bool mnodeIsNotLeader(SMnode *pMnode) {
|
||||
terrno = 0;
|
||||
taosThreadRwlockRdlock(&pMnode->lock);
|
||||
(void)taosThreadRwlockRdlock(&pMnode->lock);
|
||||
SSyncState state = syncGetState(pMnode->syncMgmt.sync);
|
||||
if (terrno != 0) {
|
||||
taosThreadRwlockUnlock(&pMnode->lock);
|
||||
(void)taosThreadRwlockUnlock(&pMnode->lock);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (state.state != TAOS_SYNC_STATE_LEADER) {
|
||||
taosThreadRwlockUnlock(&pMnode->lock);
|
||||
(void)taosThreadRwlockUnlock(&pMnode->lock);
|
||||
terrno = TSDB_CODE_SYN_NOT_LEADER;
|
||||
return true;
|
||||
}
|
||||
if (!state.restored || !pMnode->restored) {
|
||||
taosThreadRwlockUnlock(&pMnode->lock);
|
||||
(void)taosThreadRwlockUnlock(&pMnode->lock);
|
||||
terrno = TSDB_CODE_SYN_RESTORING;
|
||||
return true;
|
||||
}
|
||||
taosThreadRwlockUnlock(&pMnode->lock);
|
||||
(void)taosThreadRwlockUnlock(&pMnode->lock);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -429,21 +440,21 @@ static void *mndThreadFp(void *param) {
|
|||
static int32_t mndInitTimer(SMnode *pMnode) {
|
||||
int32_t code = 0;
|
||||
TdThreadAttr thAttr;
|
||||
taosThreadAttrInit(&thAttr);
|
||||
taosThreadAttrSetDetachState(&thAttr, PTHREAD_CREATE_JOINABLE);
|
||||
(void)taosThreadAttrInit(&thAttr);
|
||||
(void)taosThreadAttrSetDetachState(&thAttr, PTHREAD_CREATE_JOINABLE);
|
||||
if ((code = taosThreadCreate(&pMnode->thread, &thAttr, mndThreadFp, pMnode)) != 0) {
|
||||
mError("failed to create timer thread since %s", strerror(errno));
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
|
||||
taosThreadAttrDestroy(&thAttr);
|
||||
(void)taosThreadAttrDestroy(&thAttr);
|
||||
tmsgReportStartup("mnode-timer", "initialized");
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
|
||||
static void mndCleanupTimer(SMnode *pMnode) {
|
||||
if (taosCheckPthreadValid(pMnode->thread)) {
|
||||
taosThreadJoin(pMnode->thread, NULL);
|
||||
(void)taosThreadJoin(pMnode->thread, NULL);
|
||||
taosThreadClear(&pMnode->thread);
|
||||
}
|
||||
}
|
||||
|
@ -467,7 +478,7 @@ static int32_t mndCreateDir(SMnode *pMnode, const char *path) {
|
|||
static int32_t mndInitWal(SMnode *pMnode) {
|
||||
int32_t code = 0;
|
||||
char path[PATH_MAX + 20] = {0};
|
||||
snprintf(path, sizeof(path), "%s%swal", pMnode->path, TD_DIRSEP);
|
||||
(void)snprintf(path, sizeof(path), "%s%swal", pMnode->path, TD_DIRSEP);
|
||||
SWalCfg cfg = {.vgId = 1,
|
||||
.fsyncPeriod = 0,
|
||||
.rollPeriod = -1,
|
||||
|
@ -486,7 +497,7 @@ static int32_t mndInitWal(SMnode *pMnode) {
|
|||
TAOS_RETURN(code);
|
||||
}
|
||||
else{
|
||||
strncpy(cfg.encryptKey, tsEncryptKey, ENCRYPT_KEY_LEN);
|
||||
(void)strncpy(cfg.encryptKey, tsEncryptKey, ENCRYPT_KEY_LEN);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -642,8 +653,8 @@ static void mndSetOptions(SMnode *pMnode, const SMnodeOpt *pOption) {
|
|||
pMnode->syncMgmt.numOfReplicas = pOption->numOfReplicas;
|
||||
pMnode->syncMgmt.numOfTotalReplicas = pOption->numOfTotalReplicas;
|
||||
pMnode->syncMgmt.lastIndex = pOption->lastIndex;
|
||||
memcpy(pMnode->syncMgmt.replicas, pOption->replicas, sizeof(pOption->replicas));
|
||||
memcpy(pMnode->syncMgmt.nodeRoles, pOption->nodeRoles, sizeof(pOption->nodeRoles));
|
||||
(void)memcpy(pMnode->syncMgmt.replicas, pOption->replicas, sizeof(pOption->replicas));
|
||||
(void)memcpy(pMnode->syncMgmt.nodeRoles, pOption->nodeRoles, sizeof(pOption->nodeRoles));
|
||||
}
|
||||
|
||||
SMnode *mndOpen(const char *path, const SMnodeOpt *pOption) {
|
||||
|
@ -656,7 +667,7 @@ SMnode *mndOpen(const char *path, const SMnodeOpt *pOption) {
|
|||
mError("failed to open mnode since %s", terrstr());
|
||||
return NULL;
|
||||
}
|
||||
memset(pMnode, 0, sizeof(SMnode));
|
||||
(void)memset(pMnode, 0, sizeof(SMnode));
|
||||
|
||||
char timestr[24] = "1970-01-01 00:00:00.00";
|
||||
(void)taosParseTime(timestr, &pMnode->checkTime, (int32_t)strlen(timestr), TSDB_TIME_PRECISION_MILLI, 0);
|
||||
|
@ -704,9 +715,10 @@ SMnode *mndOpen(const char *path, const SMnodeOpt *pOption) {
|
|||
|
||||
void mndPreClose(SMnode *pMnode) {
|
||||
if (pMnode != NULL) {
|
||||
syncLeaderTransfer(pMnode->syncMgmt.sync);
|
||||
// TODO check return value
|
||||
(void)syncLeaderTransfer(pMnode->syncMgmt.sync);
|
||||
syncPreStop(pMnode->syncMgmt.sync);
|
||||
sdbWriteFile(pMnode->pSdb, 0);
|
||||
(void)sdbWriteFile(pMnode->pSdb, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -785,9 +797,9 @@ static int32_t mndCheckMnodeState(SRpcMsg *pMsg) {
|
|||
}
|
||||
|
||||
SMnode *pMnode = pMsg->info.node;
|
||||
taosThreadRwlockRdlock(&pMnode->lock);
|
||||
(void)taosThreadRwlockRdlock(&pMnode->lock);
|
||||
if (pMnode->stopped) {
|
||||
taosThreadRwlockUnlock(&pMnode->lock);
|
||||
(void)taosThreadRwlockUnlock(&pMnode->lock);
|
||||
code = TSDB_CODE_APP_IS_STOPPING;
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
|
@ -795,31 +807,31 @@ static int32_t mndCheckMnodeState(SRpcMsg *pMsg) {
|
|||
terrno = 0;
|
||||
SSyncState state = syncGetState(pMnode->syncMgmt.sync);
|
||||
if (terrno != 0) {
|
||||
taosThreadRwlockUnlock(&pMnode->lock);
|
||||
(void)taosThreadRwlockUnlock(&pMnode->lock);
|
||||
code = terrno;
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
|
||||
if (state.state != TAOS_SYNC_STATE_LEADER) {
|
||||
taosThreadRwlockUnlock(&pMnode->lock);
|
||||
(void)taosThreadRwlockUnlock(&pMnode->lock);
|
||||
code = TSDB_CODE_SYN_NOT_LEADER;
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
if (!state.restored || !pMnode->restored) {
|
||||
taosThreadRwlockUnlock(&pMnode->lock);
|
||||
(void)taosThreadRwlockUnlock(&pMnode->lock);
|
||||
code = TSDB_CODE_SYN_RESTORING;
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
#if 1
|
||||
atomic_add_fetch_32(&pMnode->rpcRef, 1);
|
||||
(void)atomic_add_fetch_32(&pMnode->rpcRef, 1);
|
||||
#else
|
||||
int32_t ref = atomic_add_fetch_32(&pMnode->rpcRef, 1);
|
||||
mTrace("mnode rpc is acquired, ref:%d", ref);
|
||||
#endif
|
||||
|
||||
taosThreadRwlockUnlock(&pMnode->lock);
|
||||
(void)taosThreadRwlockUnlock(&pMnode->lock);
|
||||
TAOS_RETURN(code);
|
||||
|
||||
_OVER:
|
||||
|
@ -854,7 +866,7 @@ _OVER:
|
|||
int32_t contLen = tSerializeSEpSet(NULL, 0, &epSet);
|
||||
pMsg->info.rsp = rpcMallocCont(contLen);
|
||||
if (pMsg->info.rsp != NULL) {
|
||||
tSerializeSEpSet(pMsg->info.rsp, contLen, &epSet);
|
||||
(void)tSerializeSEpSet(pMsg->info.rsp, contLen, &epSet);
|
||||
pMsg->info.hasEpSet = 1;
|
||||
pMsg->info.rspLen = contLen;
|
||||
}
|
||||
|
@ -973,7 +985,7 @@ int32_t mndGetMonitorInfo(SMnode *pMnode, SMonClusterInfo *pClusterInfo, SMonVgr
|
|||
} else {
|
||||
tstrncpy(desc.status, "offline", sizeof(desc.status));
|
||||
}
|
||||
taosArrayPush(pClusterInfo->dnodes, &desc);
|
||||
(void)taosArrayPush(pClusterInfo->dnodes, &desc);
|
||||
sdbRelease(pSdb, pObj);
|
||||
}
|
||||
|
||||
|
@ -999,7 +1011,7 @@ int32_t mndGetMonitorInfo(SMnode *pMnode, SMonClusterInfo *pClusterInfo, SMonVgr
|
|||
tstrncpy(desc.role, syncStr(pObj->syncState), sizeof(desc.role));
|
||||
desc.syncState = pObj->syncState;
|
||||
}
|
||||
taosArrayPush(pClusterInfo->mnodes, &desc);
|
||||
(void)taosArrayPush(pClusterInfo->mnodes, &desc);
|
||||
sdbRelease(pSdb, pObj);
|
||||
}
|
||||
|
||||
|
@ -1017,8 +1029,8 @@ int32_t mndGetMonitorInfo(SMnode *pMnode, SMonClusterInfo *pClusterInfo, SMonVgr
|
|||
desc.vgroup_id = pVgroup->vgId;
|
||||
|
||||
SName name = {0};
|
||||
tNameFromString(&name, pVgroup->dbName, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE);
|
||||
tNameGetDbName(&name, desc.database_name);
|
||||
(void)tNameFromString(&name, pVgroup->dbName, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE);
|
||||
(void)tNameGetDbName(&name, desc.database_name);
|
||||
|
||||
desc.tables_num = pVgroup->numOfTables;
|
||||
pGrantInfo->timeseries_used += pVgroup->numOfTimeSeries;
|
||||
|
@ -1039,7 +1051,7 @@ int32_t mndGetMonitorInfo(SMnode *pMnode, SMonClusterInfo *pClusterInfo, SMonVgr
|
|||
pClusterInfo->vnodes_total++;
|
||||
}
|
||||
|
||||
taosArrayPush(pVgroupInfo->vgroups, &desc);
|
||||
(void)taosArrayPush(pVgroupInfo->vgroups, &desc);
|
||||
sdbRelease(pSdb, pVgroup);
|
||||
}
|
||||
|
||||
|
@ -1053,14 +1065,14 @@ int32_t mndGetMonitorInfo(SMnode *pMnode, SMonClusterInfo *pClusterInfo, SMonVgr
|
|||
SMonStbDesc desc = {0};
|
||||
|
||||
SName name1 = {0};
|
||||
tNameFromString(&name1, pStb->db, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE);
|
||||
tNameGetDbName(&name1, desc.database_name);
|
||||
(void)tNameFromString(&name1, pStb->db, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE);
|
||||
(void)tNameGetDbName(&name1, desc.database_name);
|
||||
|
||||
SName name2 = {0};
|
||||
tNameFromString(&name2, pStb->name, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE);
|
||||
(void)tNameFromString(&name2, pStb->name, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE);
|
||||
tstrncpy(desc.stb_name, tNameGetTableName(&name2), TSDB_TABLE_NAME_LEN);
|
||||
|
||||
taosArrayPush(pStbInfo->stbs, &desc);
|
||||
(void)taosArrayPush(pStbInfo->stbs, &desc);
|
||||
sdbRelease(pSdb, pStb);
|
||||
}
|
||||
|
||||
|
@ -1094,14 +1106,14 @@ int64_t mndGetRoleTimeMs(SMnode *pMnode) {
|
|||
|
||||
void mndSetRestored(SMnode *pMnode, bool restored) {
|
||||
if (restored) {
|
||||
taosThreadRwlockWrlock(&pMnode->lock);
|
||||
(void)taosThreadRwlockWrlock(&pMnode->lock);
|
||||
pMnode->restored = true;
|
||||
taosThreadRwlockUnlock(&pMnode->lock);
|
||||
(void)taosThreadRwlockUnlock(&pMnode->lock);
|
||||
mInfo("mnode set restored:%d", restored);
|
||||
} else {
|
||||
taosThreadRwlockWrlock(&pMnode->lock);
|
||||
(void)taosThreadRwlockWrlock(&pMnode->lock);
|
||||
pMnode->restored = false;
|
||||
taosThreadRwlockUnlock(&pMnode->lock);
|
||||
(void)taosThreadRwlockUnlock(&pMnode->lock);
|
||||
mInfo("mnode set restored:%d", restored);
|
||||
while (1) {
|
||||
if (pMnode->rpcRef <= 0) break;
|
||||
|
@ -1113,9 +1125,9 @@ void mndSetRestored(SMnode *pMnode, bool restored) {
|
|||
bool mndGetRestored(SMnode *pMnode) { return pMnode->restored; }
|
||||
|
||||
void mndSetStop(SMnode *pMnode) {
|
||||
taosThreadRwlockWrlock(&pMnode->lock);
|
||||
(void)taosThreadRwlockWrlock(&pMnode->lock);
|
||||
pMnode->stopped = true;
|
||||
taosThreadRwlockUnlock(&pMnode->lock);
|
||||
(void)taosThreadRwlockUnlock(&pMnode->lock);
|
||||
mInfo("mnode set stopped");
|
||||
}
|
||||
|
||||
|
|
|
@ -270,7 +270,7 @@ void mndGetMnodeEpSet(SMnode *pMnode, SEpSet *pEpSet) {
|
|||
}
|
||||
}
|
||||
if (pObj->pDnode != NULL) {
|
||||
addEpIntoEpSet(pEpSet, pObj->pDnode->fqdn, pObj->pDnode->port);
|
||||
(void)addEpIntoEpSet(pEpSet, pObj->pDnode->fqdn, pObj->pDnode->port);
|
||||
}
|
||||
sdbRelease(pSdb, pObj);
|
||||
}
|
||||
|
@ -341,7 +341,7 @@ static int32_t mndBuildCreateMnodeRedoAction(STrans *pTrans, SDCreateMnodeReq *p
|
|||
int32_t code = 0;
|
||||
int32_t contLen = tSerializeSDCreateMnodeReq(NULL, 0, pCreateReq);
|
||||
void *pReq = taosMemoryMalloc(contLen);
|
||||
tSerializeSDCreateMnodeReq(pReq, contLen, pCreateReq);
|
||||
(void)tSerializeSDCreateMnodeReq(pReq, contLen, pCreateReq);
|
||||
|
||||
STransAction action = {
|
||||
.epSet = *pCreateEpSet,
|
||||
|
@ -363,7 +363,7 @@ static int32_t mndBuildAlterMnodeTypeRedoAction(STrans *pTrans, SDAlterMnodeType
|
|||
int32_t code = 0;
|
||||
int32_t contLen = tSerializeSDCreateMnodeReq(NULL, 0, pAlterMnodeTypeReq);
|
||||
void *pReq = taosMemoryMalloc(contLen);
|
||||
tSerializeSDCreateMnodeReq(pReq, contLen, pAlterMnodeTypeReq);
|
||||
(void)tSerializeSDCreateMnodeReq(pReq, contLen, pAlterMnodeTypeReq);
|
||||
|
||||
STransAction action = {
|
||||
.epSet = *pAlterMnodeTypeEpSet,
|
||||
|
@ -385,7 +385,7 @@ static int32_t mndBuildAlterMnodeRedoAction(STrans *pTrans, SDCreateMnodeReq *pA
|
|||
int32_t code = 0;
|
||||
int32_t contLen = tSerializeSDCreateMnodeReq(NULL, 0, pAlterReq);
|
||||
void *pReq = taosMemoryMalloc(contLen);
|
||||
tSerializeSDCreateMnodeReq(pReq, contLen, pAlterReq);
|
||||
(void)tSerializeSDCreateMnodeReq(pReq, contLen, pAlterReq);
|
||||
|
||||
STransAction action = {
|
||||
.epSet = *pAlterEpSet,
|
||||
|
@ -407,7 +407,7 @@ static int32_t mndBuildDropMnodeRedoAction(STrans *pTrans, SDDropMnodeReq *pDrop
|
|||
int32_t code = 0;
|
||||
int32_t contLen = tSerializeSCreateDropMQSNodeReq(NULL, 0, pDropReq);
|
||||
void *pReq = taosMemoryMalloc(contLen);
|
||||
tSerializeSCreateDropMQSNodeReq(pReq, contLen, pDropReq);
|
||||
(void)tSerializeSCreateDropMQSNodeReq(pReq, contLen, pDropReq);
|
||||
|
||||
STransAction action = {
|
||||
.epSet = *pDroprEpSet,
|
||||
|
@ -881,13 +881,13 @@ static int32_t mndRetrieveMnodes(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB
|
|||
|
||||
cols = 0;
|
||||
SColumnInfoData *pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, numOfRows, (const char *)&pObj->id, false);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&pObj->id, false);
|
||||
|
||||
char b1[TSDB_EP_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||
STR_WITH_MAXSIZE_TO_VARSTR(b1, pObj->pDnode->ep, TSDB_EP_LEN + VARSTR_HEADER_SIZE);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, numOfRows, b1, false);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, b1, false);
|
||||
|
||||
char role[20] = "offline";
|
||||
if (pObj->id == pMnode->selfDnodeId) {
|
||||
|
@ -904,7 +904,7 @@ static int32_t mndRetrieveMnodes(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB
|
|||
char b2[12 + VARSTR_HEADER_SIZE] = {0};
|
||||
STR_WITH_MAXSIZE_TO_VARSTR(b2, role, pShow->pMeta->pSchemas[cols].bytes);
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, numOfRows, (const char *)b2, false);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)b2, false);
|
||||
|
||||
const char *status = "ready";
|
||||
if (objStatus == SDB_STATUS_CREATING) status = "creating";
|
||||
|
@ -913,14 +913,14 @@ static int32_t mndRetrieveMnodes(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB
|
|||
char b3[9 + VARSTR_HEADER_SIZE] = {0};
|
||||
STR_WITH_MAXSIZE_TO_VARSTR(b3, status, pShow->pMeta->pSchemas[cols].bytes);
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, numOfRows, (const char *)b3, false);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)b3, false);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, numOfRows, (const char *)&pObj->createdTime, false);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&pObj->createdTime, false);
|
||||
|
||||
int64_t roleTimeMs = (isDnodeOnline) ? pObj->roleTimeMs : 0;
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, numOfRows, (const char *)&roleTimeMs, false);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&roleTimeMs, false);
|
||||
|
||||
numOfRows++;
|
||||
sdbRelease(pSdb, pObj);
|
||||
|
|
|
@ -263,7 +263,7 @@ static int32_t mndProcessConnectReq(SRpcMsg *pReq) {
|
|||
|
||||
if (connReq.db[0]) {
|
||||
char db[TSDB_DB_FNAME_LEN] = {0};
|
||||
snprintf(db, TSDB_DB_FNAME_LEN, "%d%s%s", pUser->acctId, TS_PATH_DELIMITER, connReq.db);
|
||||
(void)snprintf(db, TSDB_DB_FNAME_LEN, "%d%s%s", pUser->acctId, TS_PATH_DELIMITER, connReq.db);
|
||||
pDb = mndAcquireDb(pMnode, db);
|
||||
if (pDb == NULL) {
|
||||
if (0 != strcmp(connReq.db, TSDB_INFORMATION_SCHEMA_DB) &&
|
||||
|
@ -307,9 +307,9 @@ static int32_t mndProcessConnectReq(SRpcMsg *pReq) {
|
|||
tstrncpy(connectRsp.monitorParas.tsSlowLogExceptDb, tsSlowLogExceptDb, TSDB_DB_NAME_LEN);
|
||||
connectRsp.whiteListVer = pUser->ipWhiteListVer;
|
||||
|
||||
strcpy(connectRsp.sVer, version);
|
||||
snprintf(connectRsp.sDetailVer, sizeof(connectRsp.sDetailVer), "ver:%s\nbuild:%s\ngitinfo:%s", version, buildinfo,
|
||||
gitinfo);
|
||||
(void)strcpy(connectRsp.sVer, version);
|
||||
(void)snprintf(connectRsp.sDetailVer, sizeof(connectRsp.sDetailVer), "ver:%s\nbuild:%s\ngitinfo:%s", version,
|
||||
buildinfo, gitinfo);
|
||||
mndGetMnodeEpSet(pMnode, &connectRsp.epSet);
|
||||
|
||||
int32_t contLen = tSerializeSConnectRsp(NULL, 0, &connectRsp);
|
||||
|
@ -335,7 +335,7 @@ static int32_t mndProcessConnectReq(SRpcMsg *pReq) {
|
|||
code = 0;
|
||||
|
||||
char detail[1000] = {0};
|
||||
sprintf(detail, "app:%s", connReq.app);
|
||||
(void)sprintf(detail, "app:%s", connReq.app);
|
||||
|
||||
auditRecord(pReq, pMnode->clusterId, "login", "", "", detail, strlen(detail));
|
||||
|
||||
|
@ -371,9 +371,9 @@ static SAppObj *mndCreateApp(SMnode *pMnode, uint32_t clientIp, SAppHbReq *pReq)
|
|||
app.appId = pReq->appId;
|
||||
app.ip = clientIp;
|
||||
app.pid = pReq->pid;
|
||||
strcpy(app.name, pReq->name);
|
||||
(void)strcpy(app.name, pReq->name);
|
||||
app.startTime = pReq->startTime;
|
||||
memcpy(&app.summary, &pReq->summary, sizeof(pReq->summary));
|
||||
(void)memcpy(&app.summary, &pReq->summary, sizeof(pReq->summary));
|
||||
app.lastAccessTimeMs = taosGetTimestampMs();
|
||||
|
||||
const int32_t keepTime = tsShellActivityTimer * 3;
|
||||
|
@ -456,7 +456,7 @@ static int32_t mndUpdateAppInfo(SMnode *pMnode, SClientHbReq *pHbReq, SRpcConnIn
|
|||
}
|
||||
}
|
||||
|
||||
memcpy(&pApp->summary, &pReq->summary, sizeof(pReq->summary));
|
||||
(void)memcpy(&pApp->summary, &pReq->summary, sizeof(pReq->summary));
|
||||
|
||||
mndReleaseApp(pMnode, pApp);
|
||||
|
||||
|
@ -492,7 +492,7 @@ static int32_t mndProcessQueryHeartBeat(SMnode *pMnode, SRpcMsg *pMsg, SClientHb
|
|||
SRpcConnInfo connInfo = pMsg->info.conn;
|
||||
|
||||
if (0 != pHbReq->app.appId) {
|
||||
mndUpdateAppInfo(pMnode, pHbReq, &connInfo);
|
||||
TAOS_CHECK_RETURN(mndUpdateAppInfo(pMnode, pHbReq, &connInfo));
|
||||
}
|
||||
|
||||
if (pHbReq->query) {
|
||||
|
@ -520,7 +520,7 @@ static int32_t mndProcessQueryHeartBeat(SMnode *pMnode, SRpcMsg *pMsg, SClientHb
|
|||
TAOS_RETURN(code);
|
||||
}
|
||||
|
||||
mndSaveQueryList(pConn, pBasic);
|
||||
TAOS_CHECK_RETURN(mndSaveQueryList(pConn, pBasic));
|
||||
if (pConn->killed != 0) {
|
||||
rspBasic->killConnection = 1;
|
||||
}
|
||||
|
@ -546,7 +546,8 @@ static int32_t mndProcessQueryHeartBeat(SMnode *pMnode, SRpcMsg *pMsg, SClientHb
|
|||
|
||||
int32_t kvNum = taosHashGetSize(pHbReq->info);
|
||||
if (NULL == pHbReq->info || kvNum <= 0) {
|
||||
taosArrayPush(pBatchRsp->rsps, &hbRsp);
|
||||
// TODO return value
|
||||
(void)taosArrayPush(pBatchRsp->rsps, &hbRsp);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -574,7 +575,10 @@ static int32_t mndProcessQueryHeartBeat(SMnode *pMnode, SRpcMsg *pMsg, SClientHb
|
|||
|
||||
if (needCheck) {
|
||||
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,
|
||||
pRspVer->dynViewVer);
|
||||
}
|
||||
|
@ -589,31 +593,31 @@ static int32_t mndProcessQueryHeartBeat(SMnode *pMnode, SRpcMsg *pMsg, SClientHb
|
|||
case HEARTBEAT_KEY_USER_AUTHINFO: {
|
||||
void *rspMsg = NULL;
|
||||
int32_t rspLen = 0;
|
||||
mndValidateUserAuthInfo(pMnode, kv->value, kv->valueLen / sizeof(SUserAuthVersion), &rspMsg, &rspLen,
|
||||
pObj->ipWhiteListVer);
|
||||
(void)mndValidateUserAuthInfo(pMnode, kv->value, kv->valueLen / sizeof(SUserAuthVersion), &rspMsg, &rspLen,
|
||||
pObj->ipWhiteListVer);
|
||||
if (rspMsg && rspLen > 0) {
|
||||
SKv kv1 = {.key = HEARTBEAT_KEY_USER_AUTHINFO, .valueLen = rspLen, .value = rspMsg};
|
||||
taosArrayPush(hbRsp.info, &kv1);
|
||||
(void)taosArrayPush(hbRsp.info, &kv1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HEARTBEAT_KEY_DBINFO: {
|
||||
void *rspMsg = NULL;
|
||||
int32_t rspLen = 0;
|
||||
mndValidateDbInfo(pMnode, kv->value, kv->valueLen / sizeof(SDbCacheInfo), &rspMsg, &rspLen);
|
||||
(void)mndValidateDbInfo(pMnode, kv->value, kv->valueLen / sizeof(SDbCacheInfo), &rspMsg, &rspLen);
|
||||
if (rspMsg && rspLen > 0) {
|
||||
SKv kv1 = {.key = HEARTBEAT_KEY_DBINFO, .valueLen = rspLen, .value = rspMsg};
|
||||
taosArrayPush(hbRsp.info, &kv1);
|
||||
(void)taosArrayPush(hbRsp.info, &kv1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HEARTBEAT_KEY_STBINFO: {
|
||||
void *rspMsg = NULL;
|
||||
int32_t rspLen = 0;
|
||||
mndValidateStbInfo(pMnode, kv->value, kv->valueLen / sizeof(SSTableVersion), &rspMsg, &rspLen);
|
||||
(void)mndValidateStbInfo(pMnode, kv->value, kv->valueLen / sizeof(SSTableVersion), &rspMsg, &rspLen);
|
||||
if (rspMsg && rspLen > 0) {
|
||||
SKv kv1 = {.key = HEARTBEAT_KEY_STBINFO, .valueLen = rspLen, .value = rspMsg};
|
||||
taosArrayPush(hbRsp.info, &kv1);
|
||||
(void)taosArrayPush(hbRsp.info, &kv1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -628,10 +632,10 @@ static int32_t mndProcessQueryHeartBeat(SMnode *pMnode, SRpcMsg *pMsg, SClientHb
|
|||
|
||||
void *rspMsg = NULL;
|
||||
int32_t rspLen = 0;
|
||||
mndValidateViewInfo(pMnode, kv->value, kv->valueLen / sizeof(SViewVersion), &rspMsg, &rspLen);
|
||||
(void)mndValidateViewInfo(pMnode, kv->value, kv->valueLen / sizeof(SViewVersion), &rspMsg, &rspLen);
|
||||
if (rspMsg && rspLen > 0) {
|
||||
SKv kv1 = {.key = HEARTBEAT_KEY_VIEWINFO, .valueLen = rspLen, .value = rspMsg};
|
||||
taosArrayPush(hbRsp.info, &kv1);
|
||||
(void)taosArrayPush(hbRsp.info, &kv1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -639,10 +643,10 @@ static int32_t mndProcessQueryHeartBeat(SMnode *pMnode, SRpcMsg *pMsg, SClientHb
|
|||
case HEARTBEAT_KEY_TSMA: {
|
||||
void *rspMsg = NULL;
|
||||
int32_t rspLen = 0;
|
||||
mndValidateTSMAInfo(pMnode, kv->value, kv->valueLen / sizeof(STSMAVersion), &rspMsg, &rspLen);
|
||||
(void)mndValidateTSMAInfo(pMnode, kv->value, kv->valueLen / sizeof(STSMAVersion), &rspMsg, &rspLen);
|
||||
if (rspMsg && rspLen > 0) {
|
||||
SKv kv = {.key = HEARTBEAT_KEY_TSMA, .valueLen = rspLen, .value = rspMsg};
|
||||
taosArrayPush(hbRsp.info, &kv);
|
||||
(void)taosArrayPush(hbRsp.info, &kv);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -655,9 +659,10 @@ static int32_t mndProcessQueryHeartBeat(SMnode *pMnode, SRpcMsg *pMsg, SClientHb
|
|||
pIter = taosHashIterate(pHbReq->info, pIter);
|
||||
}
|
||||
|
||||
taosArrayPush(pBatchRsp->rsps, &hbRsp);
|
||||
|
||||
return TSDB_CODE_SUCCESS;
|
||||
if (taosArrayPush(pBatchRsp->rsps, &hbRsp) == NULL) {
|
||||
if (terrno != 0) code = terrno;
|
||||
}
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
|
||||
static int32_t mndProcessHeartBeatReq(SRpcMsg *pReq) {
|
||||
|
@ -675,9 +680,9 @@ static int32_t mndProcessHeartBeatReq(SRpcMsg *pReq) {
|
|||
SConnPreparedObj obj = {0};
|
||||
obj.totalDnodes = mndGetDnodeSize(pMnode);
|
||||
obj.ipWhiteListVer = batchReq.ipWhiteList;
|
||||
mndGetOnlineDnodeNum(pMnode, &obj.onlineDnodes);
|
||||
TAOS_CHECK_RETURN(mndGetOnlineDnodeNum(pMnode, &obj.onlineDnodes));
|
||||
mndGetMnodeEpSet(pMnode, &obj.epSet);
|
||||
mndCreateQnodeList(pMnode, &obj.pQnodeList, -1);
|
||||
TAOS_CHECK_RETURN(mndCreateQnodeList(pMnode, &obj.pQnodeList, -1));
|
||||
|
||||
SClientHbBatchRsp batchRsp = {0};
|
||||
batchRsp.svrTimestamp = taosGetTimestampSec();
|
||||
|
@ -701,7 +706,7 @@ static int32_t mndProcessHeartBeatReq(SRpcMsg *pReq) {
|
|||
} else if (pHbReq->connKey.connType == CONN_TYPE__TMQ) {
|
||||
SClientHbRsp *pRsp = mndMqHbBuildRsp(pMnode, pHbReq);
|
||||
if (pRsp != NULL) {
|
||||
taosArrayPush(batchRsp.rsps, pRsp);
|
||||
(void)taosArrayPush(batchRsp.rsps, pRsp);
|
||||
taosMemoryFree(pRsp);
|
||||
}
|
||||
}
|
||||
|
@ -845,32 +850,32 @@ static int32_t mndRetrieveConns(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBl
|
|||
cols = 0;
|
||||
|
||||
SColumnInfoData *pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, numOfRows, (const char *)&pConn->id, false);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&pConn->id, false);
|
||||
|
||||
char user[TSDB_USER_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||
STR_TO_VARSTR(user, pConn->user);
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, numOfRows, (const char *)user, false);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)user, false);
|
||||
|
||||
char app[TSDB_APP_NAME_LEN + VARSTR_HEADER_SIZE];
|
||||
STR_TO_VARSTR(app, pConn->app);
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, numOfRows, (const char *)app, false);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)app, false);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, numOfRows, (const char *)&pConn->pid, false);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&pConn->pid, false);
|
||||
|
||||
char endpoint[TSDB_IPv4ADDR_LEN + 6 + VARSTR_HEADER_SIZE] = {0};
|
||||
sprintf(&endpoint[VARSTR_HEADER_SIZE], "%s:%d", taosIpStr(pConn->ip), pConn->port);
|
||||
(void)sprintf(&endpoint[VARSTR_HEADER_SIZE], "%s:%d", taosIpStr(pConn->ip), pConn->port);
|
||||
varDataLen(endpoint) = strlen(&endpoint[VARSTR_HEADER_SIZE]);
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, numOfRows, (const char *)endpoint, false);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)endpoint, false);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, numOfRows, (const char *)&pConn->loginTimeMs, false);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&pConn->loginTimeMs, false);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, numOfRows, (const char *)&pConn->lastAccessTimeMs, false);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&pConn->lastAccessTimeMs, false);
|
||||
|
||||
numOfRows++;
|
||||
}
|
||||
|
@ -903,50 +908,50 @@ static int32_t packQueriesIntoBlock(SShowObj *pShow, SConnObj *pConn, SSDataBloc
|
|||
cols = 0;
|
||||
|
||||
char queryId[26 + VARSTR_HEADER_SIZE] = {0};
|
||||
sprintf(&queryId[VARSTR_HEADER_SIZE], "%x:%" PRIx64, pConn->id, pQuery->reqRid);
|
||||
(void)sprintf(&queryId[VARSTR_HEADER_SIZE], "%x:%" PRIx64, pConn->id, pQuery->reqRid);
|
||||
varDataLen(queryId) = strlen(&queryId[VARSTR_HEADER_SIZE]);
|
||||
SColumnInfoData *pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, curRowIndex, (const char *)queryId, false);
|
||||
(void)colDataSetVal(pColInfo, curRowIndex, (const char *)queryId, false);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, curRowIndex, (const char *)&pQuery->queryId, false);
|
||||
(void)colDataSetVal(pColInfo, curRowIndex, (const char *)&pQuery->queryId, false);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, curRowIndex, (const char *)&pConn->id, false);
|
||||
(void)colDataSetVal(pColInfo, curRowIndex, (const char *)&pConn->id, false);
|
||||
|
||||
char app[TSDB_APP_NAME_LEN + VARSTR_HEADER_SIZE];
|
||||
STR_TO_VARSTR(app, pConn->app);
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, curRowIndex, (const char *)app, false);
|
||||
(void)colDataSetVal(pColInfo, curRowIndex, (const char *)app, false);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, curRowIndex, (const char *)&pConn->pid, false);
|
||||
(void)colDataSetVal(pColInfo, curRowIndex, (const char *)&pConn->pid, false);
|
||||
|
||||
char user[TSDB_USER_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||
STR_TO_VARSTR(user, pConn->user);
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, curRowIndex, (const char *)user, false);
|
||||
(void)colDataSetVal(pColInfo, curRowIndex, (const char *)user, false);
|
||||
|
||||
char endpoint[TSDB_IPv4ADDR_LEN + 6 + VARSTR_HEADER_SIZE] = {0};
|
||||
sprintf(&endpoint[VARSTR_HEADER_SIZE], "%s:%d", taosIpStr(pConn->ip), pConn->port);
|
||||
(void)sprintf(&endpoint[VARSTR_HEADER_SIZE], "%s:%d", taosIpStr(pConn->ip), pConn->port);
|
||||
varDataLen(endpoint) = strlen(&endpoint[VARSTR_HEADER_SIZE]);
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, curRowIndex, (const char *)endpoint, false);
|
||||
(void)colDataSetVal(pColInfo, curRowIndex, (const char *)endpoint, false);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, curRowIndex, (const char *)&pQuery->stime, false);
|
||||
(void)colDataSetVal(pColInfo, curRowIndex, (const char *)&pQuery->stime, false);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, curRowIndex, (const char *)&pQuery->useconds, false);
|
||||
(void)colDataSetVal(pColInfo, curRowIndex, (const char *)&pQuery->useconds, false);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, curRowIndex, (const char *)&pQuery->stableQuery, false);
|
||||
(void)colDataSetVal(pColInfo, curRowIndex, (const char *)&pQuery->stableQuery, false);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, curRowIndex, (const char *)&pQuery->isSubQuery, false);
|
||||
(void)colDataSetVal(pColInfo, curRowIndex, (const char *)&pQuery->isSubQuery, false);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, curRowIndex, (const char *)&pQuery->subPlanNum, false);
|
||||
(void)colDataSetVal(pColInfo, curRowIndex, (const char *)&pQuery->subPlanNum, false);
|
||||
|
||||
char subStatus[TSDB_SHOW_SUBQUERY_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||
int64_t reserve = 64;
|
||||
|
@ -965,12 +970,12 @@ static int32_t packQueriesIntoBlock(SShowObj *pShow, SConnObj *pConn, SSDataBloc
|
|||
}
|
||||
varDataLen(subStatus) = strlen(&subStatus[VARSTR_HEADER_SIZE]);
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, curRowIndex, subStatus, (varDataLen(subStatus) == 0) ? true : false);
|
||||
(void)colDataSetVal(pColInfo, curRowIndex, subStatus, (varDataLen(subStatus) == 0) ? true : false);
|
||||
|
||||
char sql[TSDB_SHOW_SQL_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||
STR_TO_VARSTR(sql, pQuery->sql);
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, curRowIndex, (const char *)sql, false);
|
||||
(void)colDataSetVal(pColInfo, curRowIndex, (const char *)sql, false);
|
||||
|
||||
pBlock->info.rows++;
|
||||
}
|
||||
|
@ -1037,55 +1042,55 @@ static int32_t mndRetrieveApps(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlo
|
|||
cols = 0;
|
||||
|
||||
SColumnInfoData *pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, numOfRows, (const char *)&pApp->appId, false);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&pApp->appId, false);
|
||||
|
||||
char ip[TSDB_IPv4ADDR_LEN + 6 + VARSTR_HEADER_SIZE] = {0};
|
||||
sprintf(&ip[VARSTR_HEADER_SIZE], "%s", taosIpStr(pApp->ip));
|
||||
(void)sprintf(&ip[VARSTR_HEADER_SIZE], "%s", taosIpStr(pApp->ip));
|
||||
varDataLen(ip) = strlen(&ip[VARSTR_HEADER_SIZE]);
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, numOfRows, (const char *)ip, false);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)ip, false);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, numOfRows, (const char *)&pApp->pid, false);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&pApp->pid, false);
|
||||
|
||||
char name[TSDB_APP_NAME_LEN + 6 + VARSTR_HEADER_SIZE] = {0};
|
||||
sprintf(&name[VARSTR_HEADER_SIZE], "%s", pApp->name);
|
||||
(void)sprintf(&name[VARSTR_HEADER_SIZE], "%s", pApp->name);
|
||||
varDataLen(name) = strlen(&name[VARSTR_HEADER_SIZE]);
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, numOfRows, (const char *)name, false);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)name, false);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, numOfRows, (const char *)&pApp->startTime, false);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&pApp->startTime, false);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, numOfRows, (const char *)&pApp->summary.numOfInsertsReq, false);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&pApp->summary.numOfInsertsReq, false);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, numOfRows, (const char *)&pApp->summary.numOfInsertRows, false);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&pApp->summary.numOfInsertRows, false);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, numOfRows, (const char *)&pApp->summary.insertElapsedTime, false);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&pApp->summary.insertElapsedTime, false);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, numOfRows, (const char *)&pApp->summary.insertBytes, false);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&pApp->summary.insertBytes, false);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, numOfRows, (const char *)&pApp->summary.fetchBytes, false);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&pApp->summary.fetchBytes, false);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, numOfRows, (const char *)&pApp->summary.queryElapsedTime, false);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&pApp->summary.queryElapsedTime, false);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, numOfRows, (const char *)&pApp->summary.numOfSlowQueries, false);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&pApp->summary.numOfSlowQueries, false);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, numOfRows, (const char *)&pApp->summary.totalRequests, false);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&pApp->summary.totalRequests, false);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, numOfRows, (const char *)&pApp->summary.currentRequests, false);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&pApp->summary.currentRequests, false);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, numOfRows, (const char *)&pApp->lastAccessTimeMs, false);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&pApp->lastAccessTimeMs, false);
|
||||
|
||||
numOfRows++;
|
||||
}
|
||||
|
|
|
@ -1760,14 +1760,14 @@ static int32_t mndCreateTSMATxnPrepare(SCreateTSMACxt* pCxt) {
|
|||
SDbObj newDb = {0};
|
||||
memcpy(&newDb, pCxt->pDb, sizeof(SDbObj));
|
||||
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(mndSetCreateSmaUndoLogs(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(mndTransAppendUndoAction(pTrans, &createStreamUndoAction), 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);
|
||||
|
||||
code = TSDB_CODE_SUCCESS;
|
||||
|
@ -2030,12 +2030,12 @@ static int32_t mndDropTSMA(SCreateTSMACxt* pCxt) {
|
|||
SDbObj newDb = {0};
|
||||
memcpy(&newDb, pCxt->pDb, sizeof(SDbObj));
|
||||
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(mndSetDropSmaCommitLogs(pCxt->pMnode, pTrans, pCxt->pSma), NULL, _OVER);
|
||||
TAOS_CHECK_GOTO(mndTransAppendRedoAction(pTrans, &dropStreamRedoAction), 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);
|
||||
code = TSDB_CODE_SUCCESS;
|
||||
_OVER:
|
||||
|
@ -2450,13 +2450,14 @@ static int32_t mndGetTSMA(SMnode *pMnode, char *tsmaFName, STableTSMAInfoRsp *rs
|
|||
typedef bool (*tsmaFilter)(const SSmaObj* pSma, void* param);
|
||||
|
||||
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 * pBaseTsma = NULL;
|
||||
SSdb * pSdb = pMnode->pSdb;
|
||||
void * pIter = NULL;
|
||||
SStreamObj * pStream = NULL;
|
||||
SStbObj * pStb = NULL;
|
||||
bool shouldRetry = false;
|
||||
|
||||
while (1) {
|
||||
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);
|
||||
if (!pStb) {
|
||||
sdbRelease(pSdb, pSma);
|
||||
shouldRetry = true;
|
||||
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);
|
||||
if (TSDB_CODE_SUCCESS != code) {
|
||||
sdbRelease(pSdb, pSma);
|
||||
mndReleaseStb(pMnode, pStb);
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
sprintf(streamName, "%d.%s", smaName.acctId, smaName.tname);
|
||||
pStream = NULL;
|
||||
|
||||
code = mndAcquireStream(pMnode, streamName, &pStream);
|
||||
if (!pStream || (code != 0)) {
|
||||
if (!pStream) {
|
||||
shouldRetry = true;
|
||||
sdbRelease(pSdb, pSma);
|
||||
mndReleaseStb(pMnode, pStb);
|
||||
continue;
|
||||
}
|
||||
if (code != 0) {
|
||||
sdbRelease(pSdb, pSma);
|
||||
mndReleaseStb(pMnode, pStb);
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
|
||||
int64_t streamId = pStream->uid;
|
||||
mndReleaseStream(pMnode, pStream);
|
||||
|
@ -2522,6 +2532,9 @@ static int32_t mndGetSomeTsmas(SMnode* pMnode, STableTSMAInfoRsp* pRsp, tsmaFilt
|
|||
}
|
||||
*exist = true;
|
||||
}
|
||||
if (shouldRetry) {
|
||||
return TSDB_CODE_NEED_RETRY;
|
||||
}
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -2562,6 +2575,9 @@ static int32_t mndProcessGetTbTSMAReq(SRpcMsg *pReq) {
|
|||
code = mndGetTSMA(pMnode, tsmaReq.name, &rsp, &exist);
|
||||
} else {
|
||||
code = mndGetTableTSMA(pMnode, tsmaReq.name, &rsp, &exist);
|
||||
if (TSDB_CODE_NEED_RETRY == code) {
|
||||
code = TSDB_CODE_SUCCESS;
|
||||
}
|
||||
}
|
||||
if (code) {
|
||||
goto _OVER;
|
||||
|
|
|
@ -223,7 +223,7 @@ static int32_t mndSetCreateSnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, S
|
|||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
tSerializeSCreateDropMQSNodeReq(pReq, contLen, &createReq);
|
||||
(void)tSerializeSCreateDropMQSNodeReq(pReq, contLen, &createReq);
|
||||
|
||||
STransAction action = {0};
|
||||
action.epSet = mndGetDnodeEpset(pDnode);
|
||||
|
@ -251,7 +251,7 @@ static int32_t mndSetCreateSnodeUndoActions(STrans *pTrans, SDnodeObj *pDnode, S
|
|||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
tSerializeSCreateDropMQSNodeReq(pReq, contLen, &dropReq);
|
||||
(void)tSerializeSCreateDropMQSNodeReq(pReq, contLen, &dropReq);
|
||||
|
||||
STransAction action = {0};
|
||||
action.epSet = mndGetDnodeEpset(pDnode);
|
||||
|
@ -383,7 +383,7 @@ static int32_t mndSetDropSnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, SSn
|
|||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
tSerializeSCreateDropMQSNodeReq(pReq, contLen, &dropReq);
|
||||
(void)tSerializeSCreateDropMQSNodeReq(pReq, contLen, &dropReq);
|
||||
|
||||
STransAction action = {0};
|
||||
action.epSet = mndGetDnodeEpset(pDnode);
|
||||
|
@ -482,16 +482,16 @@ static int32_t mndRetrieveSnodes(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB
|
|||
|
||||
cols = 0;
|
||||
SColumnInfoData *pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, numOfRows, (const char *)&pObj->id, false);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&pObj->id, false);
|
||||
|
||||
char ep[TSDB_EP_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||
STR_WITH_MAXSIZE_TO_VARSTR(ep, pObj->pDnode->ep, pShow->pMeta->pSchemas[cols].bytes);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, numOfRows, (const char *)ep, false);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)ep, false);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, numOfRows, (const char *)&pObj->createdTime, false);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&pObj->createdTime, false);
|
||||
|
||||
numOfRows++;
|
||||
sdbRelease(pSdb, pObj);
|
||||
|
|
|
@ -278,7 +278,7 @@ static SSdbRow *mndStbActionDecode(SSdbRaw *pRaw) {
|
|||
for (int32_t i = 0; i < pStb->numOfFuncs; ++i) {
|
||||
char funcName[TSDB_FUNC_NAME_LEN] = {0};
|
||||
SDB_GET_BINARY(pRaw, dataPos, funcName, TSDB_FUNC_NAME_LEN, _OVER)
|
||||
taosArrayPush(pStb->pFuncs, funcName);
|
||||
(void)taosArrayPush(pStb->pFuncs, funcName);
|
||||
}
|
||||
|
||||
if (pStb->commentLen > 0) {
|
||||
|
@ -479,10 +479,10 @@ void mndReleaseStb(SMnode *pMnode, SStbObj *pStb) {
|
|||
|
||||
SDbObj *mndAcquireDbByStb(SMnode *pMnode, const char *stbName) {
|
||||
SName name = {0};
|
||||
tNameFromString(&name, stbName, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE);
|
||||
if ((terrno = tNameFromString(&name, stbName, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE)) != 0) return NULL;
|
||||
|
||||
char db[TSDB_TABLE_FNAME_LEN] = {0};
|
||||
tNameGetFullDbName(&name, db);
|
||||
(void)tNameGetFullDbName(&name, db);
|
||||
|
||||
return mndAcquireDb(pMnode, db);
|
||||
}
|
||||
|
@ -503,9 +503,11 @@ void *mndBuildVCreateStbReq(SMnode *pMnode, SVgObj *pVgroup, SStbObj *pStb, int3
|
|||
SName name = {0};
|
||||
SVCreateStbReq req = {0};
|
||||
|
||||
tNameFromString(&name, pStb->name, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE);
|
||||
if ((terrno = tNameFromString(&name, pStb->name, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE)) != 0) {
|
||||
goto _err;
|
||||
}
|
||||
char dbFName[TSDB_DB_FNAME_LEN] = {0};
|
||||
tNameGetFullDbName(&name, dbFName);
|
||||
(void)tNameGetFullDbName(&name, dbFName);
|
||||
|
||||
req.name = (char *)tNameGetTableName(&name);
|
||||
req.suid = pStb->uid;
|
||||
|
@ -600,7 +602,9 @@ static void *mndBuildVDropStbReq(SMnode *pMnode, SVgObj *pVgroup, SStbObj *pStb,
|
|||
SMsgHead *pHead = NULL;
|
||||
SEncoder encoder = {0};
|
||||
|
||||
tNameFromString(&name, pStb->name, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE);
|
||||
if ((terrno = tNameFromString(&name, pStb->name, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE)) != 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
req.name = (char *)tNameGetTableName(&name);
|
||||
req.suid = pStb->uid;
|
||||
|
@ -621,7 +625,7 @@ static void *mndBuildVDropStbReq(SMnode *pMnode, SVgObj *pVgroup, SStbObj *pStb,
|
|||
void *pBuf = POINTER_SHIFT(pHead, sizeof(SMsgHead));
|
||||
|
||||
tEncoderInit(&encoder, pBuf, contLen - sizeof(SMsgHead));
|
||||
tEncodeSVDropStbReq(&encoder, &req);
|
||||
(void)tEncodeSVDropStbReq(&encoder, &req);
|
||||
tEncoderClear(&encoder);
|
||||
|
||||
*pContLen = contLen;
|
||||
|
@ -948,7 +952,9 @@ int32_t mndBuildStbFromReq(SMnode *pMnode, SStbObj *pDst, SMCreateStbReq *pCreat
|
|||
}
|
||||
static int32_t mndGenIdxNameForFirstTag(char *fullname, char *dbname, char *stbname, char *tagname) {
|
||||
SName name = {0};
|
||||
tNameFromString(&name, stbname, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE);
|
||||
if ((terrno = tNameFromString(&name, stbname, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE)) != 0) {
|
||||
return -1;
|
||||
}
|
||||
return snprintf(fullname, TSDB_INDEX_FNAME_LEN, "%s.%s_%s", dbname, tagname, tNameGetTableName(&name));
|
||||
}
|
||||
|
||||
|
@ -969,7 +975,9 @@ static int32_t mndCreateStb(SMnode *pMnode, SRpcMsg *pReq, SMCreateStbReq *pCrea
|
|||
TAOS_CHECK_GOTO(mndBuildStbFromReq(pMnode, &stbObj, pCreate, pDb), NULL, _OVER);
|
||||
|
||||
SSchema *pSchema = &(stbObj.pTags[0]);
|
||||
mndGenIdxNameForFirstTag(fullIdxName, pDb->name, stbObj.name, pSchema->name);
|
||||
if (mndGenIdxNameForFirstTag(fullIdxName, pDb->name, stbObj.name, pSchema->name) < 0) {
|
||||
goto _OVER;
|
||||
}
|
||||
SSIdx idx = {0};
|
||||
if (mndAcquireGlobalIdx(pMnode, fullIdxName, SDB_IDX, &idx) == 0 && idx.pIdx != NULL) {
|
||||
code = TSDB_CODE_MND_TAG_INDEX_ALREADY_EXIST;
|
||||
|
@ -995,7 +1003,7 @@ static int32_t mndCreateStb(SMnode *pMnode, SRpcMsg *pReq, SMCreateStbReq *pCrea
|
|||
|
||||
_OVER:
|
||||
mndTransDrop(pTrans);
|
||||
mndStbActionDelete(pMnode->pSdb, &stbObj);
|
||||
(void)mndStbActionDelete(pMnode->pSdb, &stbObj);
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
|
||||
|
@ -1031,7 +1039,7 @@ static int32_t mndProcessTtlTimer(SRpcMsg *pReq) {
|
|||
}
|
||||
pHead->contLen = htonl(contLen);
|
||||
pHead->vgId = htonl(pVgroup->vgId);
|
||||
tSerializeSVDropTtlTableReq((char *)pHead + sizeof(SMsgHead), reqLen, &ttlReq);
|
||||
(void)tSerializeSVDropTtlTableReq((char *)pHead + sizeof(SMsgHead), reqLen, &ttlReq);
|
||||
|
||||
SRpcMsg rpcMsg = {
|
||||
.msgType = TDMT_VND_FETCH_TTL_EXPIRED_TBS, .pCont = pHead, .contLen = contLen, .info = pReq->info};
|
||||
|
@ -1069,7 +1077,7 @@ static int32_t mndProcessTrimDbTimer(SRpcMsg *pReq) {
|
|||
}
|
||||
pHead->contLen = htonl(contLen);
|
||||
pHead->vgId = htonl(pVgroup->vgId);
|
||||
tSerializeSVTrimDbReq((char *)pHead + sizeof(SMsgHead), reqLen, &trimReq);
|
||||
(void)tSerializeSVTrimDbReq((char *)pHead + sizeof(SMsgHead), reqLen, &trimReq);
|
||||
|
||||
SRpcMsg rpcMsg = {.msgType = TDMT_VND_TRIM, .pCont = pHead, .contLen = contLen};
|
||||
SEpSet epSet = mndGetVgroupEpset(pMnode, pVgroup);
|
||||
|
@ -1106,7 +1114,7 @@ static int32_t mndProcessS3MigrateDbTimer(SRpcMsg *pReq) {
|
|||
}
|
||||
pHead->contLen = htonl(contLen);
|
||||
pHead->vgId = htonl(pVgroup->vgId);
|
||||
tSerializeSVS3MigrateDbReq((char *)pHead + sizeof(SMsgHead), reqLen, &s3migrateReq);
|
||||
(void)tSerializeSVS3MigrateDbReq((char *)pHead + sizeof(SMsgHead), reqLen, &s3migrateReq);
|
||||
|
||||
SRpcMsg rpcMsg = {.msgType = TDMT_VND_S3MIGRATE, .pCont = pHead, .contLen = contLen};
|
||||
SEpSet epSet = mndGetVgroupEpset(pMnode, pVgroup);
|
||||
|
@ -1335,7 +1343,7 @@ static int32_t mndProcessCreateStbReq(SRpcMsg *pReq) {
|
|||
if (code == 0) code = TSDB_CODE_ACTION_IN_PROGRESS;
|
||||
|
||||
SName name = {0};
|
||||
tNameFromString(&name, createReq.name, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE);
|
||||
TAOS_CHECK_RETURN(tNameFromString(&name, createReq.name, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE));
|
||||
|
||||
if (createReq.sql == NULL && createReq.sqlLen == 0) {
|
||||
char detail[1000] = {0};
|
||||
|
@ -1499,7 +1507,12 @@ static int32_t mndCheckAlterColForTopic(SMnode *pMnode, const char *stbFullName,
|
|||
}
|
||||
|
||||
SNodeList *pNodeList = NULL;
|
||||
nodesCollectColumns((SSelectStmt *)pAst, SQL_CLAUSE_FROM, NULL, COLLECT_COL_TYPE_ALL, &pNodeList);
|
||||
if ((code = nodesCollectColumns((SSelectStmt *)pAst, SQL_CLAUSE_FROM, NULL, COLLECT_COL_TYPE_ALL, &pNodeList)) !=
|
||||
0) {
|
||||
sdbRelease(pSdb, pTopic);
|
||||
sdbCancelFetch(pSdb, pIter);
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
SNode *pNode = NULL;
|
||||
FOREACH(pNode, pNodeList) {
|
||||
SColumnNode *pCol = (SColumnNode *)pNode;
|
||||
|
@ -1549,7 +1562,13 @@ static int32_t mndCheckAlterColForStream(SMnode *pMnode, const char *stbFullName
|
|||
}
|
||||
|
||||
SNodeList *pNodeList = NULL;
|
||||
nodesCollectColumns((SSelectStmt *)pAst, SQL_CLAUSE_FROM, NULL, COLLECT_COL_TYPE_ALL, &pNodeList);
|
||||
if ((code = nodesCollectColumns((SSelectStmt *)pAst, SQL_CLAUSE_FROM, NULL, COLLECT_COL_TYPE_ALL, &pNodeList)) !=
|
||||
0) {
|
||||
sdbRelease(pSdb, pStream);
|
||||
sdbCancelFetch(pSdb, pIter);
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
|
||||
SNode *pNode = NULL;
|
||||
FOREACH(pNode, pNodeList) {
|
||||
SColumnNode *pCol = (SColumnNode *)pNode;
|
||||
|
@ -1600,7 +1619,11 @@ static int32_t mndCheckAlterColForTSma(SMnode *pMnode, const char *stbFullName,
|
|||
}
|
||||
|
||||
SNodeList *pNodeList = NULL;
|
||||
nodesCollectColumns((SSelectStmt *)pAst, SQL_CLAUSE_FROM, NULL, COLLECT_COL_TYPE_ALL, &pNodeList);
|
||||
if ((code = nodesCollectColumns((SSelectStmt *)pAst, SQL_CLAUSE_FROM, NULL, COLLECT_COL_TYPE_ALL, &pNodeList)) !=
|
||||
0) {
|
||||
sdbCancelFetch(pSdb, pIter);
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
SNode *pNode = NULL;
|
||||
FOREACH(pNode, pNodeList) {
|
||||
SColumnNode *pCol = (SColumnNode *)pNode;
|
||||
|
@ -2291,7 +2314,7 @@ static int32_t mndBuildSMAlterStbRsp(SDbObj *pDb, SStbObj *pObj, void **pCont, i
|
|||
uint32_t contLen = 0;
|
||||
SMAlterStbRsp alterRsp = {0};
|
||||
SName name = {0};
|
||||
tNameFromString(&name, pObj->name, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE);
|
||||
TAOS_CHECK_RETURN(tNameFromString(&name, pObj->name, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE));
|
||||
|
||||
alterRsp.pMeta = taosMemoryCalloc(1, sizeof(STableMetaRsp));
|
||||
if (NULL == alterRsp.pMeta) {
|
||||
|
@ -2313,7 +2336,7 @@ static int32_t mndBuildSMAlterStbRsp(SDbObj *pDb, SStbObj *pObj, void **pCont, i
|
|||
|
||||
void *cont = taosMemoryMalloc(contLen);
|
||||
tEncoderInit(&ec, cont, contLen);
|
||||
tEncodeSMAlterStbRsp(&ec, &alterRsp);
|
||||
(void)tEncodeSMAlterStbRsp(&ec, &alterRsp);
|
||||
tEncoderClear(&ec);
|
||||
|
||||
tFreeSMAlterStbRsp(&alterRsp);
|
||||
|
@ -2344,7 +2367,7 @@ int32_t mndBuildSMCreateStbRsp(SMnode *pMnode, char *dbFName, char *stbFName, vo
|
|||
uint32_t contLen = 0;
|
||||
SMCreateStbRsp stbRsp = {0};
|
||||
SName name = {0};
|
||||
tNameFromString(&name, pObj->name, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE);
|
||||
TAOS_CHECK_GOTO(tNameFromString(&name, pObj->name, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE), NULL, _OVER);
|
||||
|
||||
stbRsp.pMeta = taosMemoryCalloc(1, sizeof(STableMetaRsp));
|
||||
if (NULL == stbRsp.pMeta) {
|
||||
|
@ -2366,7 +2389,7 @@ int32_t mndBuildSMCreateStbRsp(SMnode *pMnode, char *dbFName, char *stbFName, vo
|
|||
|
||||
void *cont = taosMemoryMalloc(contLen);
|
||||
tEncoderInit(&ec, cont, contLen);
|
||||
tEncodeSMCreateStbRsp(&ec, &stbRsp);
|
||||
(void)tEncodeSMCreateStbRsp(&ec, &stbRsp);
|
||||
tEncoderClear(&ec);
|
||||
|
||||
tFreeSMCreateStbRsp(&stbRsp);
|
||||
|
@ -2605,7 +2628,8 @@ static int32_t mndProcessAlterStbReq(SRpcMsg *pReq) {
|
|||
if (code == 0) code = TSDB_CODE_ACTION_IN_PROGRESS;
|
||||
|
||||
SName name = {0};
|
||||
tNameFromString(&name, alterReq.name, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE);
|
||||
// TODO check return value
|
||||
(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);
|
||||
|
||||
|
@ -2755,7 +2779,12 @@ static int32_t mndCheckDropStbForTopic(SMnode *pMnode, const char *stbFullName,
|
|||
}
|
||||
|
||||
SNodeList *pNodeList = NULL;
|
||||
nodesCollectColumns((SSelectStmt *)pAst, SQL_CLAUSE_FROM, NULL, COLLECT_COL_TYPE_ALL, &pNodeList);
|
||||
if ((code = nodesCollectColumns((SSelectStmt *)pAst, SQL_CLAUSE_FROM, NULL, COLLECT_COL_TYPE_ALL, &pNodeList)) !=
|
||||
0) {
|
||||
sdbRelease(pSdb, pTopic);
|
||||
sdbCancelFetch(pSdb, pIter);
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
SNode *pNode = NULL;
|
||||
FOREACH(pNode, pNodeList) {
|
||||
SColumnNode *pCol = (SColumnNode *)pNode;
|
||||
|
@ -2803,7 +2832,12 @@ static int32_t mndCheckDropStbForStream(SMnode *pMnode, const char *stbFullName,
|
|||
}
|
||||
|
||||
SNodeList *pNodeList = NULL;
|
||||
nodesCollectColumns((SSelectStmt *)pAst, SQL_CLAUSE_FROM, NULL, COLLECT_COL_TYPE_ALL, &pNodeList);
|
||||
if ((code = nodesCollectColumns((SSelectStmt *)pAst, SQL_CLAUSE_FROM, NULL, COLLECT_COL_TYPE_ALL, &pNodeList)) !=
|
||||
0) {
|
||||
sdbCancelFetch(pSdb, pIter);
|
||||
sdbRelease(pSdb, pStream);
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
SNode *pNode = NULL;
|
||||
FOREACH(pNode, pNodeList) {
|
||||
SColumnNode *pCol = (SColumnNode *)pNode;
|
||||
|
@ -2882,7 +2916,8 @@ static int32_t mndProcessDropStbReq(SRpcMsg *pReq) {
|
|||
if (code == 0) code = TSDB_CODE_ACTION_IN_PROGRESS;
|
||||
|
||||
SName name = {0};
|
||||
tNameFromString(&name, dropReq.name, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE);
|
||||
// TODO check return value
|
||||
(void)tNameFromString(&name, dropReq.name, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE);
|
||||
|
||||
auditRecord(pReq, pMnode->clusterId, "dropStb", name.dbname, name.tname, dropReq.sql, dropReq.sqlLen);
|
||||
|
||||
|
@ -2933,7 +2968,7 @@ static int32_t mndProcessTableMetaReq(SRpcMsg *pReq) {
|
|||
goto _OVER;
|
||||
}
|
||||
|
||||
tSerializeSTableMetaRsp(pRsp, rspLen, &metaRsp);
|
||||
(void)tSerializeSTableMetaRsp(pRsp, rspLen, &metaRsp);
|
||||
pReq->info.rsp = pRsp;
|
||||
pReq->info.rspLen = rspLen;
|
||||
code = 0;
|
||||
|
@ -2984,7 +3019,7 @@ static int32_t mndProcessTableCfgReq(SRpcMsg *pReq) {
|
|||
goto _OVER;
|
||||
}
|
||||
|
||||
tSerializeSTableCfgRsp(pRsp, rspLen, &cfgRsp);
|
||||
(void)tSerializeSTableCfgRsp(pRsp, rspLen, &cfgRsp);
|
||||
pReq->info.rsp = pRsp;
|
||||
pReq->info.rspLen = rspLen;
|
||||
code = 0;
|
||||
|
@ -3034,7 +3069,7 @@ int32_t mndValidateStbInfo(SMnode *pMnode, SSTableVersion *pStbVersions, int32_t
|
|||
tstrncpy(metaRsp.dbFName, pStbVersion->dbFName, sizeof(metaRsp.dbFName));
|
||||
tstrncpy(metaRsp.tbName, pStbVersion->stbName, sizeof(metaRsp.tbName));
|
||||
tstrncpy(metaRsp.stbName, pStbVersion->stbName, sizeof(metaRsp.stbName));
|
||||
taosArrayPush(hbRsp.pMetaRsp, &metaRsp);
|
||||
(void)taosArrayPush(hbRsp.pMetaRsp, &metaRsp);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -3047,11 +3082,11 @@ int32_t mndValidateStbInfo(SMnode *pMnode, SSTableVersion *pStbVersions, int32_t
|
|||
tstrncpy(metaRsp.dbFName, pStbVersion->dbFName, sizeof(metaRsp.dbFName));
|
||||
tstrncpy(metaRsp.tbName, pStbVersion->stbName, sizeof(metaRsp.tbName));
|
||||
tstrncpy(metaRsp.stbName, pStbVersion->stbName, sizeof(metaRsp.stbName));
|
||||
taosArrayPush(hbRsp.pMetaRsp, &metaRsp);
|
||||
(void)taosArrayPush(hbRsp.pMetaRsp, &metaRsp);
|
||||
continue;
|
||||
}
|
||||
|
||||
taosArrayPush(hbRsp.pMetaRsp, &metaRsp);
|
||||
(void)taosArrayPush(hbRsp.pMetaRsp, &metaRsp);
|
||||
}
|
||||
|
||||
if (sma) {
|
||||
|
@ -3075,7 +3110,7 @@ int32_t mndValidateStbInfo(SMnode *pMnode, SSTableVersion *pStbVersions, int32_t
|
|||
strcpy(indexRsp.dbFName, pStbVersion->dbFName);
|
||||
strcpy(indexRsp.tbName, pStbVersion->stbName);
|
||||
|
||||
taosArrayPush(hbRsp.pIndexRsp, &indexRsp);
|
||||
(void)taosArrayPush(hbRsp.pIndexRsp, &indexRsp);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3093,7 +3128,7 @@ int32_t mndValidateStbInfo(SMnode *pMnode, SSTableVersion *pStbVersions, int32_t
|
|||
TAOS_RETURN(code);
|
||||
}
|
||||
|
||||
tSerializeSSTbHbRsp(pRsp, rspLen, &hbRsp);
|
||||
(void)tSerializeSSTbHbRsp(pRsp, rspLen, &hbRsp);
|
||||
tFreeSSTbHbRsp(&hbRsp);
|
||||
*ppRsp = pRsp;
|
||||
*pRspLen = rspLen;
|
||||
|
@ -3130,23 +3165,23 @@ int32_t mndGetNumOfStbs(SMnode *pMnode, char *dbName, int32_t *pNumOfStbs) {
|
|||
|
||||
void mndExtractDbNameFromStbFullName(const char *stbFullName, char *dst) {
|
||||
SName name = {0};
|
||||
tNameFromString(&name, stbFullName, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE);
|
||||
(void)tNameFromString(&name, stbFullName, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE);
|
||||
|
||||
tNameGetFullDbName(&name, dst);
|
||||
(void)tNameGetFullDbName(&name, dst);
|
||||
}
|
||||
|
||||
void mndExtractShortDbNameFromStbFullName(const char *stbFullName, char *dst) {
|
||||
SName name = {0};
|
||||
tNameFromString(&name, stbFullName, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE);
|
||||
(void)tNameFromString(&name, stbFullName, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE);
|
||||
|
||||
tNameGetDbName(&name, dst);
|
||||
(void)tNameGetDbName(&name, dst);
|
||||
}
|
||||
|
||||
void mndExtractShortDbNameFromDbFullName(const char *stbFullName, char *dst) {
|
||||
SName name = {0};
|
||||
tNameFromString(&name, stbFullName, T_NAME_ACCT | T_NAME_DB);
|
||||
(void)tNameFromString(&name, stbFullName, T_NAME_ACCT | T_NAME_DB);
|
||||
|
||||
tNameGetDbName(&name, dst);
|
||||
(void)tNameGetDbName(&name, dst);
|
||||
}
|
||||
|
||||
void mndExtractTbNameFromStbFullName(const char *stbFullName, char *dst, int32_t dstSize) {
|
||||
|
@ -3473,37 +3508,37 @@ static int32_t mndRetrieveStb(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBloc
|
|||
varDataSetLen(stbName, strlen(&stbName[VARSTR_HEADER_SIZE]));
|
||||
|
||||
SColumnInfoData *pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, numOfRows, (const char *)stbName, false);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)stbName, false);
|
||||
|
||||
char db[TSDB_DB_NAME_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||
tNameFromString(&name, pStb->db, T_NAME_ACCT | T_NAME_DB);
|
||||
tNameGetDbName(&name, varDataVal(db));
|
||||
(void)tNameFromString(&name, pStb->db, T_NAME_ACCT | T_NAME_DB);
|
||||
(void)tNameGetDbName(&name, varDataVal(db));
|
||||
varDataSetLen(db, strlen(varDataVal(db)));
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, numOfRows, (const char *)db, false);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)db, false);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, numOfRows, (const char *)&pStb->createdTime, false);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&pStb->createdTime, false);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, numOfRows, (const char *)&pStb->numOfColumns, false);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&pStb->numOfColumns, false);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, numOfRows, (const char *)&pStb->numOfTags, false);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&pStb->numOfTags, false);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, numOfRows, (const char *)&pStb->updateTime, false); // number of tables
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&pStb->updateTime, false); // number of tables
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
if (pStb->commentLen > 0) {
|
||||
char comment[TSDB_TB_COMMENT_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||
STR_TO_VARSTR(comment, pStb->comment);
|
||||
colDataSetVal(pColInfo, numOfRows, comment, false);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, comment, false);
|
||||
} else if (pStb->commentLen == 0) {
|
||||
char comment[VARSTR_HEADER_SIZE + VARSTR_HEADER_SIZE] = {0};
|
||||
STR_TO_VARSTR(comment, "");
|
||||
colDataSetVal(pColInfo, numOfRows, comment, false);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, comment, false);
|
||||
} else {
|
||||
colDataSetNULL(pColInfo, numOfRows);
|
||||
}
|
||||
|
@ -3513,14 +3548,14 @@ static int32_t mndRetrieveStb(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBloc
|
|||
varDataSetLen(watermark, strlen(varDataVal(watermark)));
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, numOfRows, (const char *)watermark, false);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)watermark, false);
|
||||
|
||||
char maxDelay[64 + VARSTR_HEADER_SIZE] = {0};
|
||||
sprintf(varDataVal(maxDelay), "%" PRId64 "a,%" PRId64 "a", pStb->maxdelay[0], pStb->maxdelay[1]);
|
||||
varDataSetLen(maxDelay, strlen(varDataVal(maxDelay)));
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, numOfRows, (const char *)maxDelay, false);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)maxDelay, false);
|
||||
|
||||
char rollup[160 + VARSTR_HEADER_SIZE] = {0};
|
||||
int32_t rollupNum = (int32_t)taosArrayGetSize(pStb->pFuncs);
|
||||
|
@ -3530,16 +3565,16 @@ static int32_t mndRetrieveStb(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBloc
|
|||
for (int32_t i = 0; i < rollupNum; ++i) {
|
||||
char *funcName = taosArrayGet(pStb->pFuncs, i);
|
||||
if (i) {
|
||||
strncat(varDataVal(rollup), sep, rollupLen);
|
||||
(void)strncat(varDataVal(rollup), sep, rollupLen);
|
||||
rollupLen -= sepLen;
|
||||
}
|
||||
strncat(varDataVal(rollup), funcName, rollupLen);
|
||||
(void)strncat(varDataVal(rollup), funcName, rollupLen);
|
||||
rollupLen -= strlen(funcName);
|
||||
}
|
||||
varDataSetLen(rollup, strlen(varDataVal(rollup)));
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, numOfRows, (const char *)rollup, false);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)rollup, false);
|
||||
|
||||
numOfRows++;
|
||||
sdbRelease(pSdb, pStb);
|
||||
|
@ -3577,20 +3612,20 @@ static int32_t buildDbColsInfoBlock(const SSDataBlock *p, const SSysTableMeta *p
|
|||
for (int32_t j = 0; j < pm->colNum; j++) {
|
||||
// table name
|
||||
SColumnInfoData *pColInfoData = taosArrayGet(p->pDataBlock, 0);
|
||||
colDataSetVal(pColInfoData, numOfRows, tName, false);
|
||||
(void)colDataSetVal(pColInfoData, numOfRows, tName, false);
|
||||
|
||||
// database name
|
||||
pColInfoData = taosArrayGet(p->pDataBlock, 1);
|
||||
colDataSetVal(pColInfoData, numOfRows, dName, false);
|
||||
(void)colDataSetVal(pColInfoData, numOfRows, dName, false);
|
||||
|
||||
pColInfoData = taosArrayGet(p->pDataBlock, 2);
|
||||
colDataSetVal(pColInfoData, numOfRows, typeName, false);
|
||||
(void)colDataSetVal(pColInfoData, numOfRows, typeName, false);
|
||||
|
||||
// col name
|
||||
char colName[TSDB_COL_NAME_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||
STR_TO_VARSTR(colName, pm->schema[j].name);
|
||||
pColInfoData = taosArrayGet(p->pDataBlock, 3);
|
||||
colDataSetVal(pColInfoData, numOfRows, colName, false);
|
||||
(void)colDataSetVal(pColInfoData, numOfRows, colName, false);
|
||||
|
||||
// col type
|
||||
int8_t colType = pm->schema[j].type;
|
||||
|
@ -3605,10 +3640,10 @@ static int32_t buildDbColsInfoBlock(const SSDataBlock *p, const SSysTableMeta *p
|
|||
(int32_t)((pm->schema[j].bytes - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE));
|
||||
}
|
||||
varDataSetLen(colTypeStr, colTypeLen);
|
||||
colDataSetVal(pColInfoData, numOfRows, (char *)colTypeStr, false);
|
||||
(void)colDataSetVal(pColInfoData, numOfRows, (char *)colTypeStr, false);
|
||||
|
||||
pColInfoData = taosArrayGet(p->pDataBlock, 5);
|
||||
colDataSetVal(pColInfoData, numOfRows, (const char *)&pm->schema[j].bytes, false);
|
||||
(void)colDataSetVal(pColInfoData, numOfRows, (const char *)&pm->schema[j].bytes, false);
|
||||
for (int32_t k = 6; k <= 8; ++k) {
|
||||
pColInfoData = taosArrayGet(p->pDataBlock, k);
|
||||
colDataSetNULL(pColInfoData, numOfRows);
|
||||
|
@ -3724,26 +3759,26 @@ static int32_t mndRetrieveStbCol(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB
|
|||
mDebug("mndRetrieveStbCol get stable cols, stable name:%s, db:%s", pStb->name, pStb->db);
|
||||
|
||||
char db[TSDB_DB_NAME_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||
tNameFromString(&name, pStb->db, T_NAME_ACCT | T_NAME_DB);
|
||||
tNameGetDbName(&name, varDataVal(db));
|
||||
(void)tNameFromString(&name, pStb->db, T_NAME_ACCT | T_NAME_DB);
|
||||
(void)tNameGetDbName(&name, varDataVal(db));
|
||||
varDataSetLen(db, strlen(varDataVal(db)));
|
||||
|
||||
for (int i = 0; i < pStb->numOfColumns; i++) {
|
||||
int32_t cols = 0;
|
||||
SColumnInfoData *pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, numOfRows, (const char *)stbName, false);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)stbName, false);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, numOfRows, (const char *)db, false);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)db, false);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, numOfRows, typeName, false);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, typeName, false);
|
||||
|
||||
// col name
|
||||
char colName[TSDB_COL_NAME_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||
STR_TO_VARSTR(colName, pStb->pColumns[i].name);
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, numOfRows, colName, false);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, colName, false);
|
||||
|
||||
// col type
|
||||
int8_t colType = pStb->pColumns[i].type;
|
||||
|
@ -3758,10 +3793,10 @@ static int32_t mndRetrieveStbCol(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB
|
|||
(int32_t)((pStb->pColumns[i].bytes - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE));
|
||||
}
|
||||
varDataSetLen(colTypeStr, colTypeLen);
|
||||
colDataSetVal(pColInfo, numOfRows, (char *)colTypeStr, false);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (char *)colTypeStr, false);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, numOfRows, (const char *)&pStb->pColumns[i].bytes, false);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&pStb->pColumns[i].bytes, false);
|
||||
while (cols < pShow->numOfColumns) {
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetNULL(pColInfo, numOfRows);
|
||||
|
@ -4064,7 +4099,7 @@ static void *mndBuildVDropTbsReq(SMnode *pMnode, const SVgroupInfo *pVgInfo, con
|
|||
void *pBuf = POINTER_SHIFT(pHead, sizeof(SMsgHead));
|
||||
|
||||
tEncoderInit(&encoder, pBuf, contLen - sizeof(SMsgHead));
|
||||
tEncodeSVDropTbBatchReq(&encoder, pReq);
|
||||
(void)tEncodeSVDropTbBatchReq(&encoder, pReq);
|
||||
tEncoderClear(&encoder);
|
||||
|
||||
*len = contLen;
|
||||
|
@ -4155,10 +4190,19 @@ static int32_t mndDropTbAdd(SMnode *pMnode, SHashObj *pVgHashMap, const SVgroupI
|
|||
if (pReqs == NULL) {
|
||||
reqs.info = *pVgInfo;
|
||||
reqs.req.pArray = taosArrayInit(TARRAY_MIN_SIZE, sizeof(SVDropTbReq));
|
||||
taosArrayPush(reqs.req.pArray, &req);
|
||||
taosHashPut(pVgHashMap, &pVgInfo->vgId, sizeof(pVgInfo->vgId), &reqs, sizeof(reqs));
|
||||
if (reqs.req.pArray == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
if (taosArrayPush(reqs.req.pArray, &req) == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
if (taosHashPut(pVgHashMap, &pVgInfo->vgId, sizeof(pVgInfo->vgId), &reqs, sizeof(reqs)) != 0) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
} else {
|
||||
taosArrayPush(pReqs->req.pArray, &req);
|
||||
if (taosArrayPush(pReqs->req.pArray, &req) == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -4231,7 +4275,10 @@ static int32_t mndDropTbAddTsmaResTbsForSingleVg(SMnode *pMnode, SMndDropTbsWith
|
|||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
goto _end;
|
||||
}
|
||||
taosHashPut(pCtx->pTsmaMap, &pTb->suid, sizeof(pTb->suid), &infos, sizeof(infos));
|
||||
if (taosHashPut(pCtx->pTsmaMap, &pTb->suid, sizeof(pTb->suid), &infos, sizeof(infos)) != 0) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
goto _end;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4258,11 +4305,15 @@ static int32_t mndDropTbAddTsmaResTbsForSingleVg(SMnode *pMnode, SMndDropTbsWith
|
|||
sdbRelease(pMnode->pSdb, pSma);
|
||||
goto _end;
|
||||
}
|
||||
taosHashPut(pCtx->pDbMap, pSma->db, TSDB_DB_FNAME_LEN, &info.dbInfo, sizeof(SMDropTbDbInfo));
|
||||
if (taosHashPut(pCtx->pDbMap, pSma->db, TSDB_DB_FNAME_LEN, &info.dbInfo, sizeof(SMDropTbDbInfo)) != 0) {
|
||||
sdbCancelFetch(pMnode->pSdb, pIter);
|
||||
sdbRelease(pMnode->pSdb, pSma);
|
||||
goto _end;
|
||||
}
|
||||
} else {
|
||||
info.dbInfo = *pDbInfo;
|
||||
}
|
||||
taosArrayPush(pInfos->pTsmaInfos, &info);
|
||||
(void)taosArrayPush(pInfos->pTsmaInfos, &info);
|
||||
}
|
||||
sdbRelease(pMnode->pSdb, pSma);
|
||||
}
|
||||
|
@ -4270,7 +4321,7 @@ static int32_t mndDropTbAddTsmaResTbsForSingleVg(SMnode *pMnode, SMndDropTbsWith
|
|||
// generate vg req map
|
||||
for (int32_t i = 0; i < pTbs->size; ++i) {
|
||||
SVDropTbReq *pTb = taosArrayGet(pTbs, i);
|
||||
mndDropTbAdd(pMnode, pCtx->pVgMap, &vgInfo, pTb->name, pTb->suid, pTb->igNotExists);
|
||||
TAOS_CHECK_GOTO(mndDropTbAdd(pMnode, pCtx->pVgMap, &vgInfo, pTb->name, pTb->suid, pTb->igNotExists), NULL, _end);
|
||||
|
||||
SMDropTbTsmaInfos *pInfos = taosHashGet(pCtx->pTsmaMap, &pTb->suid, sizeof(pTb->suid));
|
||||
SArray *pVgInfos = NULL;
|
||||
|
@ -4282,8 +4333,8 @@ static int32_t mndDropTbAddTsmaResTbsForSingleVg(SMnode *pMnode, SMndDropTbsWith
|
|||
taosGetTbHashVal(buf, len, pInfo->dbInfo.hashMethod, pInfo->dbInfo.hashPrefix, pInfo->dbInfo.hashSuffix);
|
||||
const SVgroupInfo *pVgInfo = taosArraySearch(pInfo->dbInfo.dbVgInfos, &hashVal, vgHashValCmp, TD_EQ);
|
||||
void *p = taosStrdup(buf + strlen(pInfo->tsmaResTbDbFName) + TSDB_NAME_DELIMITER_LEN);
|
||||
taosArrayPush(pCtx->pResTbNames, &p);
|
||||
mndDropTbAdd(pMnode, pCtx->pVgMap, pVgInfo, p, pInfo->suid, true);
|
||||
(void)taosArrayPush(pCtx->pResTbNames, &p);
|
||||
TAOS_CHECK_GOTO(mndDropTbAdd(pMnode, pCtx->pVgMap, pVgInfo, p, pInfo->suid, true), NULL, _end);
|
||||
}
|
||||
}
|
||||
_end:
|
||||
|
|
|
@ -1375,7 +1375,7 @@ static int32_t buildResult(SSDataBlock *pBlock, int32_t *numOfRows, int64_t cons
|
|||
if (data) {
|
||||
// vg id
|
||||
char buf[TSDB_OFFSET_LEN * 2 + VARSTR_HEADER_SIZE] = {0};
|
||||
tFormatOffset(varDataVal(buf), TSDB_OFFSET_LEN, &data->offset);
|
||||
(void)tFormatOffset(varDataVal(buf), TSDB_OFFSET_LEN, &data->offset);
|
||||
(void)sprintf(varDataVal(buf) + strlen(varDataVal(buf)), "/%" PRId64, data->ever);
|
||||
varDataSetLen(buf, strlen(varDataVal(buf)));
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
|
|
|
@ -212,8 +212,7 @@ int32_t mndProcessWriteMsg(SMnode *pMnode, SRpcMsg *pMsg, SFsmCbMeta *pMeta) {
|
|||
mndTransRefresh(pMnode, pTrans);
|
||||
|
||||
sdbSetApplyInfo(pMnode->pSdb, pMeta->index, pMeta->term, pMeta->lastConfigIndex);
|
||||
sdbWriteFile(pMnode->pSdb, tsMndSdbWriteDelta);
|
||||
code = 0;
|
||||
code = sdbWriteFile(pMnode->pSdb, tsMndSdbWriteDelta);
|
||||
|
||||
_OUT:
|
||||
if (pTrans) mndReleaseTrans(pMnode, pTrans);
|
||||
|
@ -222,7 +221,7 @@ _OUT:
|
|||
|
||||
static int32_t mndPostMgmtCode(SMnode *pMnode, int32_t code) {
|
||||
SSyncMgmt *pMgmt = &pMnode->syncMgmt;
|
||||
taosThreadMutexLock(&pMgmt->lock);
|
||||
(void)taosThreadMutexLock(&pMgmt->lock);
|
||||
if (pMgmt->transId == 0) {
|
||||
goto _OUT;
|
||||
}
|
||||
|
@ -232,7 +231,7 @@ static int32_t mndPostMgmtCode(SMnode *pMnode, int32_t code) {
|
|||
pMgmt->transSec = 0;
|
||||
pMgmt->transSeq = 0;
|
||||
pMgmt->errCode = code;
|
||||
tsem_post(&pMgmt->syncSem);
|
||||
(void)tsem_post(&pMgmt->syncSem);
|
||||
|
||||
if (pMgmt->errCode != 0) {
|
||||
mError("trans:%d, failed to propose since %s, post sem", transId, tstrerror(pMgmt->errCode));
|
||||
|
@ -241,7 +240,7 @@ static int32_t mndPostMgmtCode(SMnode *pMnode, int32_t code) {
|
|||
}
|
||||
|
||||
_OUT:
|
||||
taosThreadMutexUnlock(&pMgmt->lock);
|
||||
(void)taosThreadMutexUnlock(&pMgmt->lock);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -304,7 +303,7 @@ void mndRestoreFinish(const SSyncFSM *pFsm, const SyncIndex commitIdx) {
|
|||
} else {
|
||||
mInfo("vgId:1, sync restore finished");
|
||||
}
|
||||
mndRefreshUserIpWhiteList(pMnode);
|
||||
(void)mndRefreshUserIpWhiteList(pMnode);
|
||||
|
||||
ASSERT(commitIdx == mndSyncAppliedIndex(pFsm));
|
||||
}
|
||||
|
@ -350,16 +349,16 @@ static void mndBecomeFollower(const SSyncFSM *pFsm) {
|
|||
SSyncMgmt *pMgmt = &pMnode->syncMgmt;
|
||||
mInfo("vgId:1, become follower");
|
||||
|
||||
taosThreadMutexLock(&pMgmt->lock);
|
||||
(void)taosThreadMutexLock(&pMgmt->lock);
|
||||
if (pMgmt->transId != 0) {
|
||||
mInfo("vgId:1, become follower and post sem, trans:%d, failed to propose since not leader", pMgmt->transId);
|
||||
pMgmt->transId = 0;
|
||||
pMgmt->transSec = 0;
|
||||
pMgmt->transSeq = 0;
|
||||
pMgmt->errCode = TSDB_CODE_SYN_NOT_LEADER;
|
||||
tsem_post(&pMgmt->syncSem);
|
||||
(void)tsem_post(&pMgmt->syncSem);
|
||||
}
|
||||
taosThreadMutexUnlock(&pMgmt->lock);
|
||||
(void)taosThreadMutexUnlock(&pMgmt->lock);
|
||||
}
|
||||
|
||||
static void mndBecomeLearner(const SSyncFSM *pFsm) {
|
||||
|
@ -367,16 +366,16 @@ static void mndBecomeLearner(const SSyncFSM *pFsm) {
|
|||
SSyncMgmt *pMgmt = &pMnode->syncMgmt;
|
||||
mInfo("vgId:1, become learner");
|
||||
|
||||
taosThreadMutexLock(&pMgmt->lock);
|
||||
(void)taosThreadMutexLock(&pMgmt->lock);
|
||||
if (pMgmt->transId != 0) {
|
||||
mInfo("vgId:1, become learner and post sem, trans:%d, failed to propose since not leader", pMgmt->transId);
|
||||
pMgmt->transId = 0;
|
||||
pMgmt->transSec = 0;
|
||||
pMgmt->transSeq = 0;
|
||||
pMgmt->errCode = TSDB_CODE_SYN_NOT_LEADER;
|
||||
tsem_post(&pMgmt->syncSem);
|
||||
(void)tsem_post(&pMgmt->syncSem);
|
||||
}
|
||||
taosThreadMutexUnlock(&pMgmt->lock);
|
||||
(void)taosThreadMutexUnlock(&pMgmt->lock);
|
||||
}
|
||||
|
||||
static void mndBecomeLeader(const SSyncFSM *pFsm) {
|
||||
|
@ -435,12 +434,12 @@ SSyncFSM *mndSyncMakeFsm(SMnode *pMnode) {
|
|||
|
||||
int32_t mndInitSync(SMnode *pMnode) {
|
||||
SSyncMgmt *pMgmt = &pMnode->syncMgmt;
|
||||
taosThreadMutexInit(&pMgmt->lock, NULL);
|
||||
taosThreadMutexLock(&pMgmt->lock);
|
||||
(void)taosThreadMutexInit(&pMgmt->lock, NULL);
|
||||
(void)taosThreadMutexLock(&pMgmt->lock);
|
||||
pMgmt->transId = 0;
|
||||
pMgmt->transSec = 0;
|
||||
pMgmt->transSeq = 0;
|
||||
taosThreadMutexUnlock(&pMgmt->lock);
|
||||
(void)taosThreadMutexUnlock(&pMgmt->lock);
|
||||
|
||||
SSyncInfo syncInfo = {
|
||||
.snapshotStrategy = SYNC_STRATEGY_STANDARD_SNAPSHOT,
|
||||
|
@ -477,7 +476,7 @@ int32_t mndInitSync(SMnode *pMnode) {
|
|||
}
|
||||
|
||||
int32_t code = 0;
|
||||
tsem_init(&pMgmt->syncSem, 0, 0);
|
||||
(void)tsem_init(&pMgmt->syncSem, 0, 0);
|
||||
pMgmt->sync = syncOpen(&syncInfo, true);
|
||||
if (pMgmt->sync <= 0) {
|
||||
if (terrno != 0) code = terrno;
|
||||
|
@ -495,15 +494,15 @@ void mndCleanupSync(SMnode *pMnode) {
|
|||
syncStop(pMgmt->sync);
|
||||
mInfo("mnode-sync is stopped, id:%" PRId64, pMgmt->sync);
|
||||
|
||||
tsem_destroy(&pMgmt->syncSem);
|
||||
taosThreadMutexDestroy(&pMgmt->lock);
|
||||
(void)tsem_destroy(&pMgmt->syncSem);
|
||||
(void)taosThreadMutexDestroy(&pMgmt->lock);
|
||||
memset(pMgmt, 0, sizeof(SSyncMgmt));
|
||||
}
|
||||
|
||||
void mndSyncCheckTimeout(SMnode *pMnode) {
|
||||
mTrace("check sync timeout");
|
||||
SSyncMgmt *pMgmt = &pMnode->syncMgmt;
|
||||
taosThreadMutexLock(&pMgmt->lock);
|
||||
(void)taosThreadMutexLock(&pMgmt->lock);
|
||||
if (pMgmt->transId != 0) {
|
||||
int32_t curSec = taosGetTimestampSec();
|
||||
int32_t delta = curSec - pMgmt->transSec;
|
||||
|
@ -515,7 +514,7 @@ void mndSyncCheckTimeout(SMnode *pMnode) {
|
|||
pMgmt->transSeq = 0;
|
||||
terrno = TSDB_CODE_SYN_TIMEOUT;
|
||||
pMgmt->errCode = TSDB_CODE_SYN_TIMEOUT;
|
||||
tsem_post(&pMgmt->syncSem);
|
||||
(void)tsem_post(&pMgmt->syncSem);
|
||||
} else {
|
||||
mDebug("trans:%d, waiting for sync confirm, start:%d cur:%d delta:%d seq:%" PRId64, pMgmt->transId,
|
||||
pMgmt->transSec, curSec, curSec - pMgmt->transSec, pMgmt->transSeq);
|
||||
|
@ -523,7 +522,7 @@ void mndSyncCheckTimeout(SMnode *pMnode) {
|
|||
} else {
|
||||
// mTrace("check sync timeout msg, no trans waiting for confirm");
|
||||
}
|
||||
taosThreadMutexUnlock(&pMgmt->lock);
|
||||
(void)taosThreadMutexUnlock(&pMgmt->lock);
|
||||
}
|
||||
|
||||
int32_t mndSyncPropose(SMnode *pMnode, SSdbRaw *pRaw, int32_t transId) {
|
||||
|
@ -536,12 +535,12 @@ int32_t mndSyncPropose(SMnode *pMnode, SSdbRaw *pRaw, int32_t transId) {
|
|||
if (req.pCont == NULL) return TSDB_CODE_OUT_OF_MEMORY;
|
||||
memcpy(req.pCont, pRaw, req.contLen);
|
||||
|
||||
taosThreadMutexLock(&pMgmt->lock);
|
||||
(void)taosThreadMutexLock(&pMgmt->lock);
|
||||
pMgmt->errCode = 0;
|
||||
|
||||
if (pMgmt->transId != 0) {
|
||||
mError("trans:%d, can't be proposed since trans:%d already waiting for confirm", transId, pMgmt->transId);
|
||||
taosThreadMutexUnlock(&pMgmt->lock);
|
||||
(void)taosThreadMutexUnlock(&pMgmt->lock);
|
||||
rpcFreeCont(req.pCont);
|
||||
TAOS_RETURN(TSDB_CODE_MND_LAST_TRANS_NOT_FINISHED);
|
||||
}
|
||||
|
@ -555,23 +554,24 @@ int32_t mndSyncPropose(SMnode *pMnode, SSdbRaw *pRaw, int32_t transId) {
|
|||
if (code == 0) {
|
||||
mInfo("trans:%d, is proposing and wait sem, seq:%" PRId64, transId, seq);
|
||||
pMgmt->transSeq = seq;
|
||||
taosThreadMutexUnlock(&pMgmt->lock);
|
||||
tsem_wait(&pMgmt->syncSem);
|
||||
(void)taosThreadMutexUnlock(&pMgmt->lock);
|
||||
(void)tsem_wait(&pMgmt->syncSem);
|
||||
} else if (code > 0) {
|
||||
mInfo("trans:%d, confirm at once since replica is 1, continue execute", transId);
|
||||
pMgmt->transId = 0;
|
||||
pMgmt->transSec = 0;
|
||||
pMgmt->transSeq = 0;
|
||||
taosThreadMutexUnlock(&pMgmt->lock);
|
||||
sdbWriteWithoutFree(pMnode->pSdb, pRaw);
|
||||
sdbSetApplyInfo(pMnode->pSdb, req.info.conn.applyIndex, req.info.conn.applyTerm, SYNC_INDEX_INVALID);
|
||||
code = 0;
|
||||
(void)taosThreadMutexUnlock(&pMgmt->lock);
|
||||
code = sdbWriteWithoutFree(pMnode->pSdb, pRaw);
|
||||
if (code == 0) {
|
||||
sdbSetApplyInfo(pMnode->pSdb, req.info.conn.applyIndex, req.info.conn.applyTerm, SYNC_INDEX_INVALID);
|
||||
}
|
||||
} else {
|
||||
mError("trans:%d, failed to proposed since %s", transId, terrstr());
|
||||
pMgmt->transId = 0;
|
||||
pMgmt->transSec = 0;
|
||||
pMgmt->transSeq = 0;
|
||||
taosThreadMutexUnlock(&pMgmt->lock);
|
||||
(void)taosThreadMutexUnlock(&pMgmt->lock);
|
||||
if (terrno == 0) {
|
||||
terrno = TSDB_CODE_APP_ERROR;
|
||||
}
|
||||
|
@ -600,15 +600,15 @@ void mndSyncStart(SMnode *pMnode) {
|
|||
void mndSyncStop(SMnode *pMnode) {
|
||||
SSyncMgmt *pMgmt = &pMnode->syncMgmt;
|
||||
|
||||
taosThreadMutexLock(&pMgmt->lock);
|
||||
(void)taosThreadMutexLock(&pMgmt->lock);
|
||||
if (pMgmt->transId != 0) {
|
||||
mInfo("vgId:1, is stopped and post sem, trans:%d", pMgmt->transId);
|
||||
pMgmt->transId = 0;
|
||||
pMgmt->transSec = 0;
|
||||
pMgmt->errCode = TSDB_CODE_APP_IS_STOPPING;
|
||||
tsem_post(&pMgmt->syncSem);
|
||||
(void)tsem_post(&pMgmt->syncSem);
|
||||
}
|
||||
taosThreadMutexUnlock(&pMgmt->lock);
|
||||
(void)taosThreadMutexUnlock(&pMgmt->lock);
|
||||
}
|
||||
|
||||
bool mndIsLeader(SMnode *pMnode) {
|
||||
|
|
|
@ -70,16 +70,16 @@ static void mndBuildRuntimeInfo(SMnode* pMnode, SJson* pJson) {
|
|||
SMnodeStat mstat = {0};
|
||||
mndGetStat(pMnode, &mstat);
|
||||
|
||||
tjsonAddDoubleToObject(pJson, "numOfDnode", mstat.numOfDnode);
|
||||
tjsonAddDoubleToObject(pJson, "numOfMnode", mstat.numOfMnode);
|
||||
tjsonAddDoubleToObject(pJson, "numOfVgroup", mstat.numOfVgroup);
|
||||
tjsonAddDoubleToObject(pJson, "numOfDatabase", mstat.numOfDatabase);
|
||||
tjsonAddDoubleToObject(pJson, "numOfSuperTable", mstat.numOfSuperTable);
|
||||
tjsonAddDoubleToObject(pJson, "numOfChildTable", mstat.numOfChildTable);
|
||||
tjsonAddDoubleToObject(pJson, "numOfColumn", mstat.numOfColumn);
|
||||
tjsonAddDoubleToObject(pJson, "numOfPoint", mstat.totalPoints);
|
||||
tjsonAddDoubleToObject(pJson, "totalStorage", mstat.totalStorage);
|
||||
tjsonAddDoubleToObject(pJson, "compStorage", mstat.compStorage);
|
||||
(void)tjsonAddDoubleToObject(pJson, "numOfDnode", mstat.numOfDnode);
|
||||
(void)tjsonAddDoubleToObject(pJson, "numOfMnode", mstat.numOfMnode);
|
||||
(void)tjsonAddDoubleToObject(pJson, "numOfVgroup", mstat.numOfVgroup);
|
||||
(void)tjsonAddDoubleToObject(pJson, "numOfDatabase", mstat.numOfDatabase);
|
||||
(void)tjsonAddDoubleToObject(pJson, "numOfSuperTable", mstat.numOfSuperTable);
|
||||
(void)tjsonAddDoubleToObject(pJson, "numOfChildTable", mstat.numOfChildTable);
|
||||
(void)tjsonAddDoubleToObject(pJson, "numOfColumn", mstat.numOfColumn);
|
||||
(void)tjsonAddDoubleToObject(pJson, "numOfPoint", mstat.totalPoints);
|
||||
(void)tjsonAddDoubleToObject(pJson, "totalStorage", mstat.totalStorage);
|
||||
(void)tjsonAddDoubleToObject(pJson, "compStorage", mstat.compStorage);
|
||||
}
|
||||
|
||||
static char* mndBuildTelemetryReport(SMnode* pMnode) {
|
||||
|
@ -90,29 +90,29 @@ static char* mndBuildTelemetryReport(SMnode* pMnode) {
|
|||
if (pJson == NULL) return NULL;
|
||||
|
||||
char clusterName[64] = {0};
|
||||
mndGetClusterName(pMnode, clusterName, sizeof(clusterName));
|
||||
tjsonAddStringToObject(pJson, "instanceId", clusterName);
|
||||
tjsonAddDoubleToObject(pJson, "reportVersion", 1);
|
||||
if ((terrno = mndGetClusterName(pMnode, clusterName, sizeof(clusterName))) != 0) return NULL;
|
||||
(void)tjsonAddStringToObject(pJson, "instanceId", clusterName);
|
||||
(void)tjsonAddDoubleToObject(pJson, "reportVersion", 1);
|
||||
|
||||
if (taosGetOsReleaseName(tmp, NULL, NULL, sizeof(tmp)) == 0) {
|
||||
tjsonAddStringToObject(pJson, "os", tmp);
|
||||
(void)tjsonAddStringToObject(pJson, "os", tmp);
|
||||
}
|
||||
|
||||
float numOfCores = 0;
|
||||
if (taosGetCpuInfo(tmp, sizeof(tmp), &numOfCores) == 0) {
|
||||
tjsonAddStringToObject(pJson, "cpuModel", tmp);
|
||||
tjsonAddDoubleToObject(pJson, "numOfCpu", numOfCores);
|
||||
(void)tjsonAddStringToObject(pJson, "cpuModel", tmp);
|
||||
(void)tjsonAddDoubleToObject(pJson, "numOfCpu", numOfCores);
|
||||
} else {
|
||||
tjsonAddDoubleToObject(pJson, "numOfCpu", tsNumOfCores);
|
||||
(void)tjsonAddDoubleToObject(pJson, "numOfCpu", tsNumOfCores);
|
||||
}
|
||||
|
||||
snprintf(tmp, sizeof(tmp), "%" PRId64 " kB", tsTotalMemoryKB);
|
||||
tjsonAddStringToObject(pJson, "memory", tmp);
|
||||
(void)tjsonAddStringToObject(pJson, "memory", tmp);
|
||||
|
||||
tjsonAddStringToObject(pJson, "version", version);
|
||||
tjsonAddStringToObject(pJson, "buildInfo", buildinfo);
|
||||
tjsonAddStringToObject(pJson, "gitInfo", gitinfo);
|
||||
tjsonAddStringToObject(pJson, "email", pMgmt->email);
|
||||
(void)tjsonAddStringToObject(pJson, "version", version);
|
||||
(void)tjsonAddStringToObject(pJson, "buildInfo", buildinfo);
|
||||
(void)tjsonAddStringToObject(pJson, "gitInfo", gitinfo);
|
||||
(void)tjsonAddStringToObject(pJson, "email", pMgmt->email);
|
||||
|
||||
mndBuildRuntimeInfo(pMnode, pJson);
|
||||
|
||||
|
@ -126,9 +126,9 @@ static int32_t mndProcessTelemTimer(SRpcMsg* pReq) {
|
|||
STelemMgmt* pMgmt = &pMnode->telemMgmt;
|
||||
if (!tsEnableTelem) return 0;
|
||||
|
||||
taosThreadMutexLock(&pMgmt->lock);
|
||||
(void)taosThreadMutexLock(&pMgmt->lock);
|
||||
char* pCont = mndBuildTelemetryReport(pMnode);
|
||||
taosThreadMutexUnlock(&pMgmt->lock);
|
||||
(void)taosThreadMutexUnlock(&pMgmt->lock);
|
||||
|
||||
if (pCont != NULL) {
|
||||
if (taosSendHttpReport(tsTelemServer, tsTelemUri, tsTelemPort, pCont, strlen(pCont), HTTP_FLAT) != 0) {
|
||||
|
@ -142,10 +142,12 @@ static int32_t mndProcessTelemTimer(SRpcMsg* pReq) {
|
|||
}
|
||||
|
||||
int32_t mndInitTelem(SMnode* pMnode) {
|
||||
int32_t code = 0;
|
||||
STelemMgmt* pMgmt = &pMnode->telemMgmt;
|
||||
|
||||
taosThreadMutexInit(&pMgmt->lock, NULL);
|
||||
taosGetEmail(pMgmt->email, sizeof(pMgmt->email));
|
||||
(void)taosThreadMutexInit(&pMgmt->lock, NULL);
|
||||
if ((code = taosGetEmail(pMgmt->email, sizeof(pMgmt->email))) != 0)
|
||||
mWarn("failed to get email since %s", tstrerror(code));
|
||||
mndSetMsgHandle(pMnode, TDMT_MND_TELEM_TIMER, mndProcessTelemTimer);
|
||||
|
||||
return 0;
|
||||
|
@ -153,5 +155,5 @@ int32_t mndInitTelem(SMnode* pMnode) {
|
|||
|
||||
void mndCleanupTelem(SMnode* pMnode) {
|
||||
STelemMgmt* pMgmt = &pMnode->telemMgmt;
|
||||
taosThreadMutexDestroy(&pMgmt->lock);
|
||||
(void)taosThreadMutexDestroy(&pMgmt->lock);
|
||||
}
|
||||
|
|
|
@ -376,7 +376,7 @@ SSdbRow *mndTransDecode(SSdbRaw *pRaw) {
|
|||
for (int32_t i = 0; i < arbgroupIdNum; ++i) {
|
||||
int32_t arbGroupId = 0;
|
||||
SDB_GET_INT32(pRaw, dataPos, &arbGroupId, _OVER)
|
||||
taosHashPut(pTrans->arbGroupIds, &arbGroupId, sizeof(int32_t), NULL, 0);
|
||||
if ((terrno = taosHashPut(pTrans->arbGroupIds, &arbGroupId, sizeof(int32_t), NULL, 0)) != 0) goto _OVER;
|
||||
}
|
||||
|
||||
SDB_GET_RESERVE(pRaw, dataPos, TRANS_RESERVE_SIZE, _OVER)
|
||||
|
@ -461,7 +461,7 @@ static int32_t mndTransActionInsert(SSdb *pSdb, STrans *pTrans) {
|
|||
mInfo("trans:%d, perform insert action, row:%p stage:%s, callfunc:1, startFunc:%d", pTrans->id, pTrans,
|
||||
mndTransStr(pTrans->stage), pTrans->startFunc);
|
||||
|
||||
taosThreadMutexInit(&pTrans->mutex, NULL);
|
||||
(void)taosThreadMutexInit(&pTrans->mutex, NULL);
|
||||
|
||||
if (pTrans->startFunc > 0) {
|
||||
TransCbFp fp = mndTransGetCbFp(pTrans->startFunc);
|
||||
|
@ -616,7 +616,7 @@ STrans *mndTransCreate(SMnode *pMnode, ETrnPolicy policy, ETrnConflct conflict,
|
|||
pTrans->pRpcArray = taosArrayInit(1, sizeof(SRpcHandleInfo));
|
||||
pTrans->mTraceId = pReq ? TRACE_GET_ROOTID(&pReq->info.traceId) : tGenIdPI64();
|
||||
taosInitRWLatch(&pTrans->lockRpcArray);
|
||||
taosThreadMutexInit(&pTrans->mutex, NULL);
|
||||
(void)taosThreadMutexInit(&pTrans->mutex, NULL);
|
||||
|
||||
if (pTrans->redoActions == NULL || pTrans->undoActions == NULL || pTrans->commitActions == NULL ||
|
||||
pTrans->pRpcArray == NULL) {
|
||||
|
@ -627,7 +627,10 @@ STrans *mndTransCreate(SMnode *pMnode, ETrnPolicy policy, ETrnConflct conflict,
|
|||
}
|
||||
|
||||
if (pReq != NULL) {
|
||||
taosArrayPush(pTrans->pRpcArray, &pReq->info);
|
||||
if (taosArrayPush(pTrans->pRpcArray, &pReq->info) == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return NULL;
|
||||
}
|
||||
pTrans->originRpcType = pReq->msgType;
|
||||
}
|
||||
|
||||
|
@ -765,7 +768,7 @@ void mndTransSetDbName(STrans *pTrans, const char *dbname, const char *stbname)
|
|||
}
|
||||
|
||||
void mndTransAddArbGroupId(STrans *pTrans, int32_t groupId) {
|
||||
taosHashPut(pTrans->arbGroupIds, &groupId, sizeof(int32_t), NULL, 0);
|
||||
(void)taosHashPut(pTrans->arbGroupIds, &groupId, sizeof(int32_t), NULL, 0);
|
||||
}
|
||||
|
||||
void mndTransSetSerial(STrans *pTrans) { pTrans->exec = TRN_EXEC_SERIAL; }
|
||||
|
@ -1505,9 +1508,9 @@ static int32_t mndTransExecuteActionsSerial(SMnode *pMnode, STrans *pTrans, SArr
|
|||
pTrans->actionPos++;
|
||||
mInfo("trans:%d, %s:%d is executed and need sync to other mnodes", pTrans->id, mndTransStr(pAction->stage),
|
||||
pAction->id);
|
||||
taosThreadMutexUnlock(&pTrans->mutex);
|
||||
(void)taosThreadMutexUnlock(&pTrans->mutex);
|
||||
code = mndTransSync(pMnode, pTrans);
|
||||
taosThreadMutexLock(&pTrans->mutex);
|
||||
(void)taosThreadMutexLock(&pTrans->mutex);
|
||||
if (code != 0) {
|
||||
pTrans->actionPos--;
|
||||
pTrans->code = terrno;
|
||||
|
@ -1540,21 +1543,21 @@ static int32_t mndTransExecuteActionsSerial(SMnode *pMnode, STrans *pTrans, SArr
|
|||
|
||||
static int32_t mndTransExecuteRedoActionsSerial(SMnode *pMnode, STrans *pTrans, bool topHalf) {
|
||||
int32_t code = TSDB_CODE_ACTION_IN_PROGRESS;
|
||||
taosThreadMutexLock(&pTrans->mutex);
|
||||
(void)taosThreadMutexLock(&pTrans->mutex);
|
||||
if (pTrans->stage == TRN_STAGE_REDO_ACTION) {
|
||||
code = mndTransExecuteActionsSerial(pMnode, pTrans, pTrans->redoActions, topHalf);
|
||||
}
|
||||
taosThreadMutexUnlock(&pTrans->mutex);
|
||||
(void)taosThreadMutexUnlock(&pTrans->mutex);
|
||||
return code;
|
||||
}
|
||||
|
||||
static int32_t mndTransExecuteUndoActionsSerial(SMnode *pMnode, STrans *pTrans, bool topHalf) {
|
||||
int32_t code = TSDB_CODE_ACTION_IN_PROGRESS;
|
||||
taosThreadMutexLock(&pTrans->mutex);
|
||||
(void)taosThreadMutexLock(&pTrans->mutex);
|
||||
if (pTrans->stage == TRN_STAGE_UNDO_ACTION) {
|
||||
code = mndTransExecuteActionsSerial(pMnode, pTrans, pTrans->undoActions, topHalf);
|
||||
}
|
||||
taosThreadMutexUnlock(&pTrans->mutex);
|
||||
(void)taosThreadMutexUnlock(&pTrans->mutex);
|
||||
return code;
|
||||
}
|
||||
|
||||
|
@ -1894,7 +1897,7 @@ void mndTransPullup(SMnode *pMnode) {
|
|||
STrans *pTrans = NULL;
|
||||
pIter = sdbFetch(pMnode->pSdb, SDB_TRANS, pIter, (void **)&pTrans);
|
||||
if (pIter == NULL) break;
|
||||
taosArrayPush(pArray, &pTrans->id);
|
||||
(void)taosArrayPush(pArray, &pTrans->id);
|
||||
sdbRelease(pSdb, pTrans);
|
||||
}
|
||||
|
||||
|
@ -1925,36 +1928,36 @@ static int32_t mndRetrieveTrans(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBl
|
|||
cols = 0;
|
||||
|
||||
SColumnInfoData *pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, numOfRows, (const char *)&pTrans->id, false);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&pTrans->id, false);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, numOfRows, (const char *)&pTrans->createdTime, false);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&pTrans->createdTime, false);
|
||||
|
||||
char stage[TSDB_TRANS_STAGE_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||
STR_WITH_MAXSIZE_TO_VARSTR(stage, mndTransStr(pTrans->stage), pShow->pMeta->pSchemas[cols].bytes);
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, numOfRows, (const char *)stage, false);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)stage, false);
|
||||
|
||||
char opername[TSDB_TRANS_OPER_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||
STR_WITH_MAXSIZE_TO_VARSTR(opername, pTrans->opername, pShow->pMeta->pSchemas[cols].bytes);
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, numOfRows, (const char *)opername, false);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)opername, false);
|
||||
|
||||
char dbname[TSDB_DB_NAME_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||
STR_WITH_MAXSIZE_TO_VARSTR(dbname, mndGetDbStr(pTrans->dbname), pShow->pMeta->pSchemas[cols].bytes);
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, numOfRows, (const char *)dbname, false);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)dbname, false);
|
||||
|
||||
char stbname[TSDB_TABLE_NAME_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||
STR_WITH_MAXSIZE_TO_VARSTR(stbname, mndGetDbStr(pTrans->stbname), pShow->pMeta->pSchemas[cols].bytes);
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, numOfRows, (const char *)stbname, false);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)stbname, false);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, numOfRows, (const char *)&pTrans->failedTimes, false);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&pTrans->failedTimes, false);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, numOfRows, (const char *)&pTrans->lastExecTime, false);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&pTrans->lastExecTime, false);
|
||||
|
||||
char lastInfo[TSDB_TRANS_ERROR_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||
char detail[TSDB_TRANS_ERROR_LEN + 1] = {0};
|
||||
|
@ -1970,7 +1973,7 @@ static int32_t mndRetrieveTrans(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBl
|
|||
}
|
||||
STR_WITH_MAXSIZE_TO_VARSTR(lastInfo, detail, pShow->pMeta->pSchemas[cols].bytes);
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, numOfRows, (const char *)lastInfo, false);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)lastInfo, false);
|
||||
|
||||
numOfRows++;
|
||||
sdbRelease(pSdb, pTrans);
|
||||
|
|
|
@ -682,7 +682,7 @@ static void ipRangeToStr(SIpV4Range *range, char *buf) {
|
|||
struct in_addr addr;
|
||||
addr.s_addr = range->ip;
|
||||
|
||||
uv_inet_ntop(AF_INET, &addr, buf, 32);
|
||||
(void)uv_inet_ntop(AF_INET, &addr, buf, 32);
|
||||
if (range->mask != 32) {
|
||||
(void)sprintf(buf + strlen(buf), "/%d", range->mask);
|
||||
}
|
||||
|
@ -2188,7 +2188,7 @@ static int32_t mndProcessAlterUserPrivilegesReq(SAlterUserReq *pAlterReq, SMnode
|
|||
mndReleaseDb(pMnode, pDb);
|
||||
TAOS_CHECK_GOTO(terrno, &lino, _OVER); // TODO: refactor the terrno to code
|
||||
}
|
||||
taosHashRemove(pNewUser->readDbs, pAlterReq->objname, len);
|
||||
(void)taosHashRemove(pNewUser->readDbs, pAlterReq->objname, len);
|
||||
mndReleaseDb(pMnode, pDb);
|
||||
} else {
|
||||
taosHashClear(pNewUser->readDbs);
|
||||
|
@ -2204,7 +2204,7 @@ static int32_t mndProcessAlterUserPrivilegesReq(SAlterUserReq *pAlterReq, SMnode
|
|||
mndReleaseDb(pMnode, pDb);
|
||||
TAOS_CHECK_GOTO(terrno, &lino, _OVER); // TODO: refactor the terrno to code
|
||||
}
|
||||
taosHashRemove(pNewUser->writeDbs, pAlterReq->objname, len);
|
||||
(void)taosHashRemove(pNewUser->writeDbs, pAlterReq->objname, len);
|
||||
mndReleaseDb(pMnode, pDb);
|
||||
} else {
|
||||
taosHashClear(pNewUser->writeDbs);
|
||||
|
@ -2311,7 +2311,7 @@ static int32_t mndProcessAlterUserReq(SRpcMsg *pReq) {
|
|||
|
||||
TAOS_CHECK_GOTO(mndAcquireUser(pMnode, alterReq.user, &pUser), &lino, _OVER);
|
||||
|
||||
mndAcquireUser(pMnode, pReq->info.conn.user, &pOperUser);
|
||||
(void)mndAcquireUser(pMnode, pReq->info.conn.user, &pOperUser);
|
||||
if (pOperUser == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_MND_NO_USER_FROM_CONN, &lino, _OVER);
|
||||
}
|
||||
|
@ -2517,7 +2517,7 @@ static int32_t mndDropUser(SMnode *pMnode, SRpcMsg *pReq, SUserObj *pUser) {
|
|||
mndTransDrop(pTrans);
|
||||
TAOS_RETURN(terrno);
|
||||
}
|
||||
ipWhiteMgtRemove(pUser->user);
|
||||
(void)ipWhiteMgtRemove(pUser->user);
|
||||
|
||||
mndTransDrop(pTrans);
|
||||
TAOS_RETURN(0);
|
||||
|
@ -2830,7 +2830,10 @@ static int32_t mndLoopHash(SHashObj *hash, char *priType, SSDataBlock *pBlock, i
|
|||
}
|
||||
|
||||
if (nodesStringToNode(value, &pAst) == 0) {
|
||||
nodesNodeToSQL(pAst, *sql, bufSz, &sqlLen);
|
||||
if (nodesNodeToSQL(pAst, *sql, bufSz, &sqlLen) != 0) {
|
||||
sqlLen = 5;
|
||||
(void)sprintf(*sql, "error");
|
||||
}
|
||||
nodesDestroyNode(pAst);
|
||||
} else {
|
||||
sqlLen = 5;
|
||||
|
|
|
@ -390,7 +390,7 @@ void *mndBuildCreateVnodeReq(SMnode *pMnode, SDnodeObj *pDnode, SDbObj *pDb, SVg
|
|||
return NULL;
|
||||
}
|
||||
|
||||
tSerializeSCreateVnodeReq(pReq, contLen, &createReq);
|
||||
(void)tSerializeSCreateVnodeReq(pReq, contLen, &createReq);
|
||||
*pContLen = contLen;
|
||||
return pReq;
|
||||
}
|
||||
|
@ -436,7 +436,7 @@ static void *mndBuildAlterVnodeConfigReq(SMnode *pMnode, SDbObj *pDb, SVgObj *pV
|
|||
pHead->contLen = htonl(contLen);
|
||||
pHead->vgId = htonl(pVgroup->vgId);
|
||||
|
||||
tSerializeSAlterVnodeConfigReq((char *)pReq + sizeof(SMsgHead), contLen, &alterReq);
|
||||
(void)tSerializeSAlterVnodeConfigReq((char *)pReq + sizeof(SMsgHead), contLen, &alterReq);
|
||||
*pContLen = contLen;
|
||||
return pReq;
|
||||
}
|
||||
|
@ -514,7 +514,7 @@ static void *mndBuildAlterVnodeReplicaReq(SMnode *pMnode, SDbObj *pDb, SVgObj *p
|
|||
return NULL;
|
||||
}
|
||||
|
||||
tSerializeSAlterVnodeReplicaReq(pReq, contLen, &alterReq);
|
||||
(void)tSerializeSAlterVnodeReplicaReq(pReq, contLen, &alterReq);
|
||||
*pContLen = contLen;
|
||||
return pReq;
|
||||
}
|
||||
|
@ -587,7 +587,7 @@ static void *mndBuildCheckLearnCatchupReq(SMnode *pMnode, SDbObj *pDb, SVgObj *p
|
|||
return NULL;
|
||||
}
|
||||
|
||||
tSerializeSAlterVnodeReplicaReq(pReq, contLen, &req);
|
||||
(void)tSerializeSAlterVnodeReplicaReq(pReq, contLen, &req);
|
||||
*pContLen = contLen;
|
||||
return pReq;
|
||||
}
|
||||
|
@ -611,7 +611,7 @@ static void *mndBuildDisableVnodeWriteReq(SMnode *pMnode, SDbObj *pDb, int32_t v
|
|||
return NULL;
|
||||
}
|
||||
|
||||
tSerializeSDisableVnodeWriteReq(pReq, contLen, &disableReq);
|
||||
(void)tSerializeSDisableVnodeWriteReq(pReq, contLen, &disableReq);
|
||||
*pContLen = contLen;
|
||||
return pReq;
|
||||
}
|
||||
|
@ -639,7 +639,7 @@ static void *mndBuildAlterVnodeHashRangeReq(SMnode *pMnode, int32_t srcVgId, SVg
|
|||
return NULL;
|
||||
}
|
||||
|
||||
tSerializeSAlterVnodeHashRangeReq(pReq, contLen, &alterReq);
|
||||
(void)tSerializeSAlterVnodeHashRangeReq(pReq, contLen, &alterReq);
|
||||
*pContLen = contLen;
|
||||
return pReq;
|
||||
}
|
||||
|
@ -664,7 +664,7 @@ void *mndBuildDropVnodeReq(SMnode *pMnode, SDnodeObj *pDnode, SDbObj *pDb, SVgOb
|
|||
return NULL;
|
||||
}
|
||||
|
||||
tSerializeSDropVnodeReq(pReq, contLen, &dropReq);
|
||||
(void)tSerializeSDropVnodeReq(pReq, contLen, &dropReq);
|
||||
*pContLen = contLen;
|
||||
return pReq;
|
||||
}
|
||||
|
@ -699,7 +699,7 @@ static bool mndBuildDnodesArrayFp(SMnode *pMnode, void *pObj, void *p1, void *p2
|
|||
}
|
||||
|
||||
if (online && pDnode->numOfSupportVnodes > 0) {
|
||||
taosArrayPush(pArray, pDnode);
|
||||
if (taosArrayPush(pArray, pDnode) == NULL) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -907,7 +907,7 @@ SEpSet mndGetVgroupEpset(SMnode *pMnode, const SVgObj *pVgroup) {
|
|||
epset.inUse = epset.numOfEps;
|
||||
}
|
||||
|
||||
addEpIntoEpSet(&epset, pDnode->fqdn, pDnode->port);
|
||||
(void)addEpIntoEpSet(&epset, pDnode->fqdn, pDnode->port);
|
||||
mndReleaseDnode(pMnode, pDnode);
|
||||
}
|
||||
epsetSort(&epset);
|
||||
|
@ -930,7 +930,7 @@ SEpSet mndGetVgroupEpsetById(SMnode *pMnode, int32_t vgId) {
|
|||
epset.inUse = epset.numOfEps;
|
||||
}
|
||||
|
||||
addEpIntoEpSet(&epset, pDnode->fqdn, pDnode->port);
|
||||
(void)addEpIntoEpSet(&epset, pDnode->fqdn, pDnode->port);
|
||||
mndReleaseDnode(pMnode, pDnode);
|
||||
}
|
||||
|
||||
|
@ -965,26 +965,26 @@ static int32_t mndRetrieveVgroups(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *p
|
|||
|
||||
cols = 0;
|
||||
SColumnInfoData *pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, numOfRows, (const char *)&pVgroup->vgId, false);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&pVgroup->vgId, false);
|
||||
|
||||
SName name = {0};
|
||||
char db[TSDB_DB_NAME_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||
tNameFromString(&name, pVgroup->dbName, T_NAME_ACCT | T_NAME_DB);
|
||||
tNameGetDbName(&name, varDataVal(db));
|
||||
(void)tNameFromString(&name, pVgroup->dbName, T_NAME_ACCT | T_NAME_DB);
|
||||
(void)tNameGetDbName(&name, varDataVal(db));
|
||||
varDataSetLen(db, strlen(varDataVal(db)));
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, numOfRows, (const char *)db, false);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)db, false);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, numOfRows, (const char *)&pVgroup->numOfTables, false);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&pVgroup->numOfTables, false);
|
||||
|
||||
// default 3 replica, add 1 replica if move vnode
|
||||
for (int32_t i = 0; i < 4; ++i) {
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
if (i < pVgroup->replica) {
|
||||
int16_t dnodeId = (int16_t)pVgroup->vnodeGid[i].dnodeId;
|
||||
colDataSetVal(pColInfo, numOfRows, (const char *)&dnodeId, false);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&dnodeId, false);
|
||||
|
||||
bool exist = false;
|
||||
bool online = false;
|
||||
|
@ -1038,7 +1038,7 @@ static int32_t mndRetrieveVgroups(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *p
|
|||
STR_WITH_MAXSIZE_TO_VARSTR(buf1, role, pShow->pMeta->pSchemas[cols].bytes);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, numOfRows, (const char *)buf1, false);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)buf1, false);
|
||||
} else {
|
||||
colDataSetNULL(pColInfo, numOfRows);
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
|
@ -1048,19 +1048,19 @@ static int32_t mndRetrieveVgroups(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *p
|
|||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
int32_t cacheUsage = (int32_t)pVgroup->cacheUsage;
|
||||
colDataSetVal(pColInfo, numOfRows, (const char *)&cacheUsage, false);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&cacheUsage, false);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, numOfRows, (const char *)&pVgroup->numOfCachedTables, false);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&pVgroup->numOfCachedTables, false);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, numOfRows, (const char *)&pVgroup->isTsma, false);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&pVgroup->isTsma, false);
|
||||
|
||||
// pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
// if (pDb == NULL || pDb->compactStartTime <= 0) {
|
||||
// colDataSetNULL(pColInfo, numOfRows);
|
||||
// } else {
|
||||
// colDataSetVal(pColInfo, numOfRows, (const char *)&pDb->compactStartTime, false);
|
||||
// (void)colDataSetVal(pColInfo, numOfRows, (const char *)&pDb->compactStartTime, false);
|
||||
// }
|
||||
|
||||
numOfRows++;
|
||||
|
@ -1158,10 +1158,10 @@ static int32_t mndRetrieveVnodes(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB
|
|||
cols = 0;
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, numOfRows, (const char *)&pGid->dnodeId, false);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&pGid->dnodeId, false);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, numOfRows, (const char *)&pVgroup->vgId, false);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&pVgroup->vgId, false);
|
||||
|
||||
// db_name
|
||||
const char *dbname = mndGetDbStr(pVgroup->dbName);
|
||||
|
@ -1172,7 +1172,7 @@ static int32_t mndRetrieveVnodes(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB
|
|||
STR_WITH_MAXSIZE_TO_VARSTR(b1, "NULL", TSDB_DB_NAME_LEN + VARSTR_HEADER_SIZE);
|
||||
}
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, numOfRows, (const char *)b1, false);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)b1, false);
|
||||
|
||||
// dnode is online?
|
||||
SDnodeObj *pDnode = mndAcquireDnode(pMnode, pGid->dnodeId);
|
||||
|
@ -1186,18 +1186,18 @@ static int32_t mndRetrieveVnodes(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB
|
|||
ESyncState syncState = (isDnodeOnline) ? pGid->syncState : TAOS_SYNC_STATE_OFFLINE;
|
||||
STR_TO_VARSTR(buf, syncStr(syncState));
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, numOfRows, (const char *)buf, false);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)buf, false);
|
||||
|
||||
int64_t roleTimeMs = (isDnodeOnline) ? pGid->roleTimeMs : 0;
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, numOfRows, (const char *)&roleTimeMs, false);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&roleTimeMs, false);
|
||||
|
||||
int64_t startTimeMs = (isDnodeOnline) ? pGid->startTimeMs : 0;
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, numOfRows, (const char *)&startTimeMs, false);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&startTimeMs, false);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, numOfRows, (const char *)&pGid->syncRestore, false);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&pGid->syncRestore, false);
|
||||
|
||||
numOfRows++;
|
||||
sdbRelease(pSdb, pDnode);
|
||||
|
@ -2452,7 +2452,7 @@ static void *mndBuildSForceBecomeFollowerReq(SMnode *pMnode, SVgObj *pVgroup, in
|
|||
pHead->contLen = htonl(contLen);
|
||||
pHead->vgId = htonl(pVgroup->vgId);
|
||||
|
||||
tSerializeSForceBecomeFollowerReq((char *)pReq + sizeof(SMsgHead), contLen, &balanceReq);
|
||||
(void)tSerializeSForceBecomeFollowerReq((char *)pReq + sizeof(SMsgHead), contLen, &balanceReq);
|
||||
*pContLen = contLen;
|
||||
return pReq;
|
||||
}
|
||||
|
@ -3366,7 +3366,7 @@ static void *mndBuildCompactVnodeReq(SMnode *pMnode, SDbObj *pDb, SVgObj *pVgrou
|
|||
pHead->contLen = htonl(contLen);
|
||||
pHead->vgId = htonl(pVgroup->vgId);
|
||||
|
||||
tSerializeSCompactVnodeReq((char *)pReq + sizeof(SMsgHead), contLen, &compactReq);
|
||||
(void)tSerializeSCompactVnodeReq((char *)pReq + sizeof(SMsgHead), contLen, &compactReq);
|
||||
*pContLen = contLen;
|
||||
return pReq;
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ SSdb *sdbInit(SSdbOpt *pOption) {
|
|||
}
|
||||
|
||||
for (ESdbType i = 0; i < SDB_MAX; ++i) {
|
||||
taosThreadRwlockInit(&pSdb->locks[i], NULL);
|
||||
(void)taosThreadRwlockInit(&pSdb->locks[i], NULL);
|
||||
pSdb->maxId[i] = 0;
|
||||
pSdb->tableVer[i] = 0;
|
||||
pSdb->keyTypes[i] = SDB_KEY_INT32;
|
||||
|
@ -60,7 +60,7 @@ SSdb *sdbInit(SSdbOpt *pOption) {
|
|||
pSdb->commitTerm = -1;
|
||||
pSdb->commitConfig = -1;
|
||||
pSdb->pMnode = pOption->pMnode;
|
||||
taosThreadMutexInit(&pSdb->filelock, NULL);
|
||||
(void)taosThreadMutexInit(&pSdb->filelock, NULL);
|
||||
mInfo("sdb init success");
|
||||
return pSdb;
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ SSdb *sdbInit(SSdbOpt *pOption) {
|
|||
void sdbCleanup(SSdb *pSdb) {
|
||||
mInfo("start to cleanup sdb");
|
||||
|
||||
sdbWriteFile(pSdb, 0);
|
||||
(void)sdbWriteFile(pSdb, 0);
|
||||
|
||||
if (pSdb->currDir != NULL) {
|
||||
taosMemoryFreeClear(pSdb->currDir);
|
||||
|
@ -99,14 +99,14 @@ void sdbCleanup(SSdb *pSdb) {
|
|||
|
||||
taosHashClear(hash);
|
||||
taosHashCleanup(hash);
|
||||
taosThreadRwlockDestroy(&pSdb->locks[i]);
|
||||
(void)taosThreadRwlockDestroy(&pSdb->locks[i]);
|
||||
pSdb->hashObjs[i] = NULL;
|
||||
memset(&pSdb->locks[i], 0, sizeof(pSdb->locks[i]));
|
||||
|
||||
mInfo("sdb table:%s is cleaned up", sdbTableName(i));
|
||||
}
|
||||
|
||||
taosThreadMutexDestroy(&pSdb->filelock);
|
||||
(void)taosThreadMutexDestroy(&pSdb->filelock);
|
||||
taosMemoryFree(pSdb);
|
||||
mInfo("sdb is cleaned up");
|
||||
}
|
||||
|
@ -188,19 +188,19 @@ void sdbGetCommitInfo(SSdb *pSdb, int64_t *index, int64_t *term, int64_t *config
|
|||
void sdbWriteLock(SSdb *pSdb, int32_t type) {
|
||||
TdThreadRwlock *pLock = &pSdb->locks[type];
|
||||
// mTrace("sdb table:%d start write lock:%p", type, pLock);
|
||||
taosThreadRwlockWrlock(pLock);
|
||||
(void)taosThreadRwlockWrlock(pLock);
|
||||
// mTrace("sdb table:%d stop write lock:%p", type, pLock);
|
||||
}
|
||||
|
||||
void sdbReadLock(SSdb *pSdb, int32_t type) {
|
||||
TdThreadRwlock *pLock = &pSdb->locks[type];
|
||||
// mTrace("sdb table:%d start read lock:%p", type, pLock);
|
||||
taosThreadRwlockRdlock(pLock);
|
||||
(void)taosThreadRwlockRdlock(pLock);
|
||||
// mTrace("sdb table:%d stop read lock:%p", type, pLock);
|
||||
}
|
||||
|
||||
void sdbUnLock(SSdb *pSdb, int32_t type) {
|
||||
TdThreadRwlock *pLock = &pSdb->locks[type];
|
||||
// mTrace("sdb table:%d unlock:%p", type, pLock);
|
||||
taosThreadRwlockUnlock(pLock);
|
||||
(void)taosThreadRwlockUnlock(pLock);
|
||||
}
|
||||
|
|
|
@ -258,7 +258,7 @@ static int32_t sdbReadFileImp(SSdb *pSdb) {
|
|||
if (code != 0) {
|
||||
mError("failed to read sdb file:%s head since %s", file, tstrerror(code));
|
||||
taosMemoryFree(pRaw);
|
||||
taosCloseFile(&pFile);
|
||||
(void)taosCloseFile(&pFile);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -361,14 +361,14 @@ static int32_t sdbReadFileImp(SSdb *pSdb) {
|
|||
pSdb->commitTerm, pSdb->commitConfig);
|
||||
|
||||
_OVER:
|
||||
taosCloseFile(&pFile);
|
||||
(void)taosCloseFile(&pFile);
|
||||
sdbFreeRaw(pRaw);
|
||||
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
|
||||
int32_t sdbReadFile(SSdb *pSdb) {
|
||||
taosThreadMutexLock(&pSdb->filelock);
|
||||
(void)taosThreadMutexLock(&pSdb->filelock);
|
||||
|
||||
sdbResetData(pSdb);
|
||||
int32_t code = sdbReadFileImp(pSdb);
|
||||
|
@ -377,7 +377,7 @@ int32_t sdbReadFile(SSdb *pSdb) {
|
|||
sdbResetData(pSdb);
|
||||
}
|
||||
|
||||
taosThreadMutexUnlock(&pSdb->filelock);
|
||||
(void)taosThreadMutexUnlock(&pSdb->filelock);
|
||||
return code;
|
||||
}
|
||||
|
||||
|
@ -404,7 +404,7 @@ static int32_t sdbWriteFileImp(SSdb *pSdb) {
|
|||
code = sdbWriteFileHead(pSdb, pFile);
|
||||
if (code != 0) {
|
||||
mError("failed to write sdb file:%s head since %s", tmpfile, tstrerror(code));
|
||||
taosCloseFile(&pFile);
|
||||
(void)taosCloseFile(&pFile);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -507,7 +507,9 @@ static int32_t sdbWriteFileImp(SSdb *pSdb) {
|
|||
}
|
||||
}
|
||||
|
||||
taosCloseFile(&pFile);
|
||||
if (taosCloseFile(&pFile) != 0) {
|
||||
code = taosRenameFile(tmpfile, curfile);
|
||||
}
|
||||
|
||||
if (code == 0) {
|
||||
code = taosRenameFile(tmpfile, curfile);
|
||||
|
@ -541,7 +543,7 @@ int32_t sdbWriteFile(SSdb *pSdb, int32_t delta) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
taosThreadMutexLock(&pSdb->filelock);
|
||||
(void)taosThreadMutexLock(&pSdb->filelock);
|
||||
if (pSdb->pWal != NULL) {
|
||||
if (pSdb->sync > 0) {
|
||||
code = syncBeginSnapshot(pSdb->sync, pSdb->applyIndex);
|
||||
|
@ -560,7 +562,7 @@ int32_t sdbWriteFile(SSdb *pSdb, int32_t delta) {
|
|||
if (code != 0) {
|
||||
mError("failed to write sdb file since %s", tstrerror(code));
|
||||
}
|
||||
taosThreadMutexUnlock(&pSdb->filelock);
|
||||
(void)taosThreadMutexUnlock(&pSdb->filelock);
|
||||
return code;
|
||||
}
|
||||
|
||||
|
@ -602,7 +604,7 @@ static void sdbCloseIter(SSdbIter *pIter) {
|
|||
if (pIter == NULL) return;
|
||||
|
||||
if (pIter->file != NULL) {
|
||||
taosCloseFile(&pIter->file);
|
||||
(void)taosCloseFile(&pIter->file);
|
||||
pIter->file = NULL;
|
||||
}
|
||||
|
||||
|
@ -624,18 +626,18 @@ int32_t sdbStartRead(SSdb *pSdb, SSdbIter **ppIter, int64_t *index, int64_t *ter
|
|||
char datafile[PATH_MAX] = {0};
|
||||
snprintf(datafile, sizeof(datafile), "%s%ssdb.data", pSdb->currDir, TD_DIRSEP);
|
||||
|
||||
taosThreadMutexLock(&pSdb->filelock);
|
||||
(void)taosThreadMutexLock(&pSdb->filelock);
|
||||
int64_t commitIndex = pSdb->commitIndex;
|
||||
int64_t commitTerm = pSdb->commitTerm;
|
||||
int64_t commitConfig = pSdb->commitConfig;
|
||||
if (taosCopyFile(datafile, pIter->name) < 0) {
|
||||
taosThreadMutexUnlock(&pSdb->filelock);
|
||||
(void)taosThreadMutexUnlock(&pSdb->filelock);
|
||||
code = TAOS_SYSTEM_ERROR(errno);
|
||||
mError("failed to copy sdb file %s to %s since %s", datafile, pIter->name, tstrerror(code));
|
||||
sdbCloseIter(pIter);
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
taosThreadMutexUnlock(&pSdb->filelock);
|
||||
(void)taosThreadMutexUnlock(&pSdb->filelock);
|
||||
|
||||
pIter->file = taosOpenFile(pIter->name, TD_FILE_READ);
|
||||
if (pIter->file == NULL) {
|
||||
|
@ -725,7 +727,10 @@ int32_t sdbStopWrite(SSdb *pSdb, SSdbIter *pIter, bool isApply, int64_t index, i
|
|||
goto _OVER;
|
||||
}
|
||||
|
||||
taosCloseFile(&pIter->file);
|
||||
if (taosCloseFile(&pIter->file) != 0) {
|
||||
code = TAOS_SYSTEM_ERROR(errno);
|
||||
goto _OVER;
|
||||
}
|
||||
pIter->file = NULL;
|
||||
|
||||
char datafile[PATH_MAX] = {0};
|
||||
|
|
|
@ -176,7 +176,7 @@ static int32_t sdbInsertRow(SSdb *pSdb, SHashObj *hash, SSdbRaw *pRaw, SSdbRow *
|
|||
if (code != 0) {
|
||||
if (terrno == 0) terrno = TSDB_CODE_MND_TRANS_UNKNOW_ERROR;
|
||||
code = terrno;
|
||||
taosHashRemove(hash, pRow->pObj, keySize);
|
||||
(void)taosHashRemove(hash, pRow->pObj, keySize);
|
||||
sdbFreeRow(pSdb, pRow, false);
|
||||
terrno = code;
|
||||
sdbUnLock(pSdb, type);
|
||||
|
@ -239,10 +239,10 @@ static int32_t sdbDeleteRow(SSdb *pSdb, SHashObj *hash, SSdbRaw *pRaw, SSdbRow *
|
|||
SSdbRow *pOldRow = *ppOldRow;
|
||||
pOldRow->status = pRaw->status;
|
||||
|
||||
atomic_add_fetch_32(&pOldRow->refCount, 1);
|
||||
(void)atomic_add_fetch_32(&pOldRow->refCount, 1);
|
||||
sdbPrintOper(pSdb, pOldRow, "delete");
|
||||
|
||||
taosHashRemove(hash, pOldRow->pObj, keySize);
|
||||
TAOS_CHECK_RETURN(taosHashRemove(hash, pOldRow->pObj, keySize));
|
||||
pSdb->tableVer[pOldRow->type]++;
|
||||
sdbUnLock(pSdb, type);
|
||||
|
||||
|
@ -309,7 +309,7 @@ void *sdbAcquireAll(SSdb *pSdb, ESdbType type, const void *pKey, bool onlyReady)
|
|||
SSdbRow *pRow = *ppRow;
|
||||
switch (pRow->status) {
|
||||
case SDB_STATUS_READY:
|
||||
atomic_add_fetch_32(&pRow->refCount, 1);
|
||||
(void)atomic_add_fetch_32(&pRow->refCount, 1);
|
||||
pRet = pRow->pObj;
|
||||
sdbPrintOper(pSdb, pRow, "acquire");
|
||||
break;
|
||||
|
@ -327,7 +327,7 @@ void *sdbAcquireAll(SSdb *pSdb, ESdbType type, const void *pKey, bool onlyReady)
|
|||
if (pRet == NULL) {
|
||||
if (!onlyReady) {
|
||||
terrno = 0;
|
||||
atomic_add_fetch_32(&pRow->refCount, 1);
|
||||
(void)atomic_add_fetch_32(&pRow->refCount, 1);
|
||||
pRet = pRow->pObj;
|
||||
sdbPrintOper(pSdb, pRow, "acquire");
|
||||
}
|
||||
|
@ -395,7 +395,7 @@ void *sdbFetch(SSdb *pSdb, ESdbType type, void *pIter, void **ppObj) {
|
|||
continue;
|
||||
}
|
||||
|
||||
atomic_add_fetch_32(&pRow->refCount, 1);
|
||||
(void)atomic_add_fetch_32(&pRow->refCount, 1);
|
||||
sdbPrintOper(pSdb, pRow, "fetch");
|
||||
*ppObj = pRow->pObj;
|
||||
break;
|
||||
|
@ -423,7 +423,7 @@ void *sdbFetchAll(SSdb *pSdb, ESdbType type, void *pIter, void **ppObj, ESdbStat
|
|||
continue;
|
||||
}
|
||||
|
||||
atomic_add_fetch_32(&pRow->refCount, 1);
|
||||
(void)atomic_add_fetch_32(&pRow->refCount, 1);
|
||||
sdbPrintOper(pSdb, pRow, "fetch");
|
||||
*ppObj = pRow->pObj;
|
||||
*status = pRow->status;
|
||||
|
|
|
@ -42,7 +42,7 @@ void sdbFreeRow(SSdb *pSdb, SSdbRow *pRow, bool callFunc) {
|
|||
// remove attached object such as trans
|
||||
SdbDeleteFp deleteFp = pSdb->deleteFps[pRow->type];
|
||||
if (deleteFp != NULL) {
|
||||
(*deleteFp)(pSdb, pRow->pObj, callFunc);
|
||||
(void)(*deleteFp)(pSdb, pRow->pObj, callFunc);
|
||||
}
|
||||
|
||||
sdbPrintOper(pSdb, pRow, "free");
|
||||
|
|
|
@ -36,7 +36,7 @@ int32_t sndBuildStreamTask(SSnode *pSnode, SStreamTask *pTask, int64_t nextProce
|
|||
streamTaskOpenAllUpstreamInput(pTask);
|
||||
|
||||
streamTaskResetUpstreamStageInfo(pTask);
|
||||
streamSetupScheduleTrigger(pTask);
|
||||
(void)streamSetupScheduleTrigger(pTask);
|
||||
|
||||
SCheckpointInfo *pChkInfo = &pTask->chkInfo;
|
||||
tqSetRestoreVersionInfo(pTask);
|
||||
|
@ -91,14 +91,14 @@ FAIL:
|
|||
}
|
||||
|
||||
int32_t sndInit(SSnode *pSnode) {
|
||||
streamTaskSchedTask(&pSnode->msgCb, pSnode->pMeta->vgId, 0, 0, STREAM_EXEC_T_START_ALL_TASKS);
|
||||
(void)streamTaskSchedTask(&pSnode->msgCb, pSnode->pMeta->vgId, 0, 0, STREAM_EXEC_T_START_ALL_TASKS);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void sndClose(SSnode *pSnode) {
|
||||
stopRsync();
|
||||
streamMetaNotifyClose(pSnode->pMeta);
|
||||
streamMetaCommit(pSnode->pMeta);
|
||||
(void)streamMetaCommit(pSnode->pMeta);
|
||||
streamMetaClose(pSnode->pMeta);
|
||||
taosMemoryFree(pSnode);
|
||||
}
|
||||
|
|
|
@ -39,9 +39,9 @@ typedef struct SMetaCache SMetaCache;
|
|||
// clang-format on
|
||||
|
||||
// metaOpen ==================
|
||||
int32_t metaRLock(SMeta* pMeta);
|
||||
int32_t metaWLock(SMeta* pMeta);
|
||||
int32_t metaULock(SMeta* pMeta);
|
||||
void metaRLock(SMeta* pMeta);
|
||||
void metaWLock(SMeta* pMeta);
|
||||
void metaULock(SMeta* pMeta);
|
||||
|
||||
// metaEntry ==================
|
||||
int metaEncodeEntry(SEncoder* pCoder, const SMetaEntry* pME);
|
||||
|
|
|
@ -194,7 +194,7 @@ typedef enum {
|
|||
|
||||
#define TD_SMA_LOOPS_CHECK(n, limit) \
|
||||
if (++(n) > limit) { \
|
||||
sched_yield(); \
|
||||
(void)sched_yield(); \
|
||||
(n) = 0; \
|
||||
}
|
||||
|
||||
|
|
|
@ -378,7 +378,7 @@ struct STsdb {
|
|||
struct {
|
||||
SVHashTable *ht;
|
||||
SArray *arr;
|
||||
} *commitInfo;
|
||||
} * commitInfo;
|
||||
};
|
||||
|
||||
struct TSDBKEY {
|
||||
|
@ -937,7 +937,7 @@ int32_t tsdbCacheDel(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSKEY sKey, TSKE
|
|||
|
||||
int32_t tsdbCacheInsertLast(SLRUCache *pCache, tb_uid_t uid, TSDBROW *row, STsdb *pTsdb);
|
||||
int32_t tsdbCacheInsertLastrow(SLRUCache *pCache, STsdb *pTsdb, tb_uid_t uid, TSDBROW *row, bool dup);
|
||||
int32_t tsdbCacheRelease(SLRUCache *pCache, LRUHandle *h);
|
||||
void tsdbCacheRelease(SLRUCache *pCache, LRUHandle *h);
|
||||
|
||||
int32_t tsdbCacheGetBlockIdx(SLRUCache *pCache, SDataFReader *pFileReader, LRUHandle **handle);
|
||||
int32_t tsdbBICacheRelease(SLRUCache *pCache, LRUHandle *h);
|
||||
|
@ -945,7 +945,6 @@ int32_t tsdbBICacheRelease(SLRUCache *pCache, LRUHandle *h);
|
|||
int32_t tsdbCacheGetBlockS3(SLRUCache *pCache, STsdbFD *pFD, LRUHandle **handle);
|
||||
int32_t tsdbCacheGetPageS3(SLRUCache *pCache, STsdbFD *pFD, int64_t pgno, LRUHandle **handle);
|
||||
int32_t tsdbCacheSetPageS3(SLRUCache *pCache, STsdbFD *pFD, int64_t pgno, uint8_t *pPage);
|
||||
int32_t tsdbCacheRelease(SLRUCache *pCache, LRUHandle *h);
|
||||
|
||||
int32_t tsdbCacheDeleteLastrow(SLRUCache *pCache, tb_uid_t uid, TSKEY eKey);
|
||||
int32_t tsdbCacheDeleteLast(SLRUCache *pCache, tb_uid_t uid, TSKEY eKey);
|
||||
|
|
|
@ -156,7 +156,7 @@ int32_t metaCacheOpen(SMeta* pMeta) {
|
|||
}
|
||||
|
||||
taosHashSetFreeFp(pMeta->pCache->sTagFilterResCache.pTableEntry, freeCacheEntryFp);
|
||||
taosThreadMutexInit(&pMeta->pCache->sTagFilterResCache.lock, NULL);
|
||||
(void)taosThreadMutexInit(&pMeta->pCache->sTagFilterResCache.lock, NULL);
|
||||
|
||||
pMeta->pCache->STbGroupResCache.pResCache = taosLRUCacheInit(5 * 1024 * 1024, -1, 0.5);
|
||||
if (pMeta->pCache->STbGroupResCache.pResCache == NULL) {
|
||||
|
@ -171,7 +171,7 @@ int32_t metaCacheOpen(SMeta* pMeta) {
|
|||
}
|
||||
|
||||
taosHashSetFreeFp(pMeta->pCache->STbGroupResCache.pTableEntry, freeCacheEntryFp);
|
||||
taosThreadMutexInit(&pMeta->pCache->STbGroupResCache.lock, NULL);
|
||||
(void)taosThreadMutexInit(&pMeta->pCache->STbGroupResCache.lock, NULL);
|
||||
|
||||
pMeta->pCache->STbFilterCache.pStb =
|
||||
taosHashInit(0, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_NO_LOCK);
|
||||
|
@ -201,11 +201,11 @@ void metaCacheClose(SMeta* pMeta) {
|
|||
statsCacheClose(pMeta);
|
||||
|
||||
taosLRUCacheCleanup(pMeta->pCache->sTagFilterResCache.pUidResCache);
|
||||
taosThreadMutexDestroy(&pMeta->pCache->sTagFilterResCache.lock);
|
||||
(void)taosThreadMutexDestroy(&pMeta->pCache->sTagFilterResCache.lock);
|
||||
taosHashCleanup(pMeta->pCache->sTagFilterResCache.pTableEntry);
|
||||
|
||||
taosLRUCacheCleanup(pMeta->pCache->STbGroupResCache.pResCache);
|
||||
taosThreadMutexDestroy(&pMeta->pCache->STbGroupResCache.lock);
|
||||
(void)taosThreadMutexDestroy(&pMeta->pCache->STbGroupResCache.lock);
|
||||
taosHashCleanup(pMeta->pCache->STbGroupResCache.pTableEntry);
|
||||
|
||||
taosHashCleanup(pMeta->pCache->STbFilterCache.pStb);
|
||||
|
@ -495,7 +495,7 @@ static int checkAllEntriesInCache(const STagFilterResEntry* pEntry, SArray* pInv
|
|||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
} else {
|
||||
taosLRUCacheRelease(pCache, pRes, false);
|
||||
(void)taosLRUCacheRelease(pCache, pRes, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -552,7 +552,9 @@ int32_t metaGetCachedTableUidList(void* pVnode, tb_uid_t suid, const uint8_t* pK
|
|||
int32_t size = *(int32_t*)p;
|
||||
|
||||
// set the result into the buffer
|
||||
taosArrayAddBatch(pList1, p + sizeof(int32_t), size);
|
||||
if (taosArrayAddBatch(pList1, p + sizeof(int32_t), size) == NULL) {
|
||||
return terrno;
|
||||
}
|
||||
|
||||
(*pEntry)->hitTimes += 1;
|
||||
|
||||
|
@ -562,7 +564,7 @@ int32_t metaGetCachedTableUidList(void* pVnode, tb_uid_t suid, const uint8_t* pK
|
|||
((double)(*pEntry)->hitTimes) / acc);
|
||||
}
|
||||
|
||||
taosLRUCacheRelease(pCache, pHandle, false);
|
||||
(void)taosLRUCacheRelease(pCache, pHandle, false);
|
||||
|
||||
// unlock meta
|
||||
(void)taosThreadMutexUnlock(pLock);
|
||||
|
@ -618,7 +620,7 @@ static int32_t addNewEntry(SHashObj* pTableEntry, const void* pKey, int32_t keyL
|
|||
p->hitTimes = 0;
|
||||
tdListInit(&p->list, keyLen);
|
||||
TAOS_CHECK_RETURN(taosHashPut(pTableEntry, &suid, sizeof(uint64_t), &p, POINTER_BYTES));
|
||||
tdListAppend(&p->list, pKey);
|
||||
(void)tdListAppend(&p->list, pKey);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -662,7 +664,7 @@ int32_t metaUidFilterCachePut(void* pVnode, uint64_t suid, const void* pKey, int
|
|||
} else { // check if it exists or not
|
||||
size_t size = listNEles(&(*pEntry)->list);
|
||||
if (size == 0) {
|
||||
tdListAppend(&(*pEntry)->list, pKey);
|
||||
(void)tdListAppend(&(*pEntry)->list, pKey);
|
||||
} else {
|
||||
SListNode* pNode = listHead(&(*pEntry)->list);
|
||||
uint64_t* p = (uint64_t*)pNode->data;
|
||||
|
@ -671,7 +673,7 @@ int32_t metaUidFilterCachePut(void* pVnode, uint64_t suid, const void* pKey, int
|
|||
(void)taosThreadMutexUnlock(pLock);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
} else { // not equal, append it
|
||||
tdListAppend(&(*pEntry)->list, pKey);
|
||||
(void)tdListAppend(&(*pEntry)->list, pKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -761,7 +763,7 @@ int32_t metaGetCachedTbGroup(void* pVnode, tb_uid_t suid, const uint8_t* pKey, i
|
|||
((double)(*pEntry)->hitTimes) / acc);
|
||||
}
|
||||
|
||||
taosLRUCacheRelease(pCache, pHandle, false);
|
||||
(void)taosLRUCacheRelease(pCache, pHandle, false);
|
||||
|
||||
// unlock meta
|
||||
(void)taosThreadMutexUnlock(pLock);
|
||||
|
@ -839,7 +841,7 @@ int32_t metaPutTbGroupToCache(void* pVnode, uint64_t suid, const void* pKey, int
|
|||
} else { // check if it exists or not
|
||||
size_t size = listNEles(&(*pEntry)->list);
|
||||
if (size == 0) {
|
||||
tdListAppend(&(*pEntry)->list, pKey);
|
||||
(void)tdListAppend(&(*pEntry)->list, pKey);
|
||||
} else {
|
||||
SListNode* pNode = listHead(&(*pEntry)->list);
|
||||
uint64_t* p = (uint64_t*)pNode->data;
|
||||
|
@ -848,14 +850,14 @@ int32_t metaPutTbGroupToCache(void* pVnode, uint64_t suid, const void* pKey, int
|
|||
(void)taosThreadMutexUnlock(pLock);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
} else { // not equal, append it
|
||||
tdListAppend(&(*pEntry)->list, pKey);
|
||||
(void)tdListAppend(&(*pEntry)->list, pKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// add to cache.
|
||||
taosLRUCacheInsert(pCache, key, TAG_FILTER_RES_KEY_LEN, pPayload, payloadLen, freeTbGroupCachePayload, NULL,
|
||||
TAOS_LRU_PRIORITY_LOW, NULL);
|
||||
(void)taosLRUCacheInsert(pCache, key, TAG_FILTER_RES_KEY_LEN, pPayload, payloadLen, freeTbGroupCachePayload, NULL,
|
||||
TAOS_LRU_PRIORITY_LOW, NULL);
|
||||
_end:
|
||||
(void)taosThreadMutexUnlock(pLock);
|
||||
metaDebug("vgId:%d, suid:%" PRIu64 " tb group added into cache, total:%d, tables:%d", vgId, suid,
|
||||
|
|
|
@ -29,10 +29,10 @@ static int ncolIdxCmpr(const void *pKey1, int kLen1, const void *pKey2, int kLen
|
|||
|
||||
static int32_t metaInitLock(SMeta *pMeta) {
|
||||
TdThreadRwlockAttr attr;
|
||||
taosThreadRwlockAttrInit(&attr);
|
||||
taosThreadRwlockAttrSetKindNP(&attr, PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP);
|
||||
taosThreadRwlockInit(&pMeta->lock, &attr);
|
||||
taosThreadRwlockAttrDestroy(&attr);
|
||||
(void)taosThreadRwlockAttrInit(&attr);
|
||||
(void)taosThreadRwlockAttrSetKindNP(&attr, PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP);
|
||||
(void)taosThreadRwlockInit(&pMeta->lock, &attr);
|
||||
(void)taosThreadRwlockAttrDestroy(&attr);
|
||||
return 0;
|
||||
}
|
||||
static int32_t metaDestroyLock(SMeta *pMeta) { return taosThreadRwlockDestroy(&pMeta->lock); }
|
||||
|
@ -48,7 +48,7 @@ int32_t metaOpen(SVnode *pVnode, SMeta **ppMeta, int8_t rollback) {
|
|||
char indexFullPath[128] = {0};
|
||||
|
||||
// create handle
|
||||
vnodeGetPrimaryDir(pVnode->path, pVnode->diskPrimary, pVnode->pTfs, path, TSDB_FILENAME_LEN);
|
||||
(void)vnodeGetPrimaryDir(pVnode->path, pVnode->diskPrimary, pVnode->pTfs, path, TSDB_FILENAME_LEN);
|
||||
offset = strlen(path);
|
||||
snprintf(path + offset, TSDB_FILENAME_LEN - offset - 1, "%s%s", TD_DIRSEP, VNODE_META_DIR);
|
||||
|
||||
|
@ -56,16 +56,16 @@ int32_t metaOpen(SVnode *pVnode, SMeta **ppMeta, int8_t rollback) {
|
|||
TSDB_CHECK_CODE(code = TSDB_CODE_OUT_OF_MEMORY, lino, _exit);
|
||||
}
|
||||
|
||||
metaInitLock(pMeta);
|
||||
(void)metaInitLock(pMeta);
|
||||
|
||||
pMeta->path = (char *)&pMeta[1];
|
||||
strcpy(pMeta->path, path);
|
||||
taosRealPath(pMeta->path, NULL, strlen(path) + 1);
|
||||
(void)taosRealPath(pMeta->path, NULL, strlen(path) + 1);
|
||||
|
||||
pMeta->pVnode = pVnode;
|
||||
|
||||
// create path if not created yet
|
||||
taosMkDir(pMeta->path);
|
||||
(void)taosMkDir(pMeta->path);
|
||||
|
||||
// open env
|
||||
code = tdbOpen(pMeta->path, pVnode->config.szPage, pVnode->config.szCache, &pMeta->pEnv, rollback,
|
||||
|
@ -186,31 +186,19 @@ int metaAlterCache(SMeta *pMeta, int32_t nPage) {
|
|||
return code;
|
||||
}
|
||||
|
||||
int32_t metaRLock(SMeta *pMeta) {
|
||||
void metaRLock(SMeta *pMeta) {
|
||||
metaTrace("meta rlock %p", &pMeta->lock);
|
||||
int32_t code = taosThreadRwlockRdlock(&pMeta->lock);
|
||||
if (code) {
|
||||
return TAOS_SYSTEM_ERROR(code);
|
||||
}
|
||||
return 0;
|
||||
(void)taosThreadRwlockRdlock(&pMeta->lock);
|
||||
}
|
||||
|
||||
int32_t metaWLock(SMeta *pMeta) {
|
||||
void metaWLock(SMeta *pMeta) {
|
||||
metaTrace("meta wlock %p", &pMeta->lock);
|
||||
int32_t code = taosThreadRwlockWrlock(&pMeta->lock);
|
||||
if (code) {
|
||||
return TAOS_SYSTEM_ERROR(code);
|
||||
}
|
||||
return 0;
|
||||
(void)taosThreadRwlockWrlock(&pMeta->lock);
|
||||
}
|
||||
|
||||
int32_t metaULock(SMeta *pMeta) {
|
||||
void metaULock(SMeta *pMeta) {
|
||||
metaTrace("meta ulock %p", &pMeta->lock);
|
||||
int32_t code = taosThreadRwlockUnlock(&pMeta->lock);
|
||||
if (code) {
|
||||
return TAOS_SYSTEM_ERROR(code);
|
||||
}
|
||||
return 0;
|
||||
(void)taosThreadRwlockUnlock(&pMeta->lock);
|
||||
}
|
||||
|
||||
static void metaCleanup(SMeta **ppMeta) {
|
||||
|
@ -235,7 +223,7 @@ static void metaCleanup(SMeta **ppMeta) {
|
|||
if (pMeta->pSkmDb) tdbTbClose(pMeta->pSkmDb);
|
||||
if (pMeta->pTbDb) tdbTbClose(pMeta->pTbDb);
|
||||
if (pMeta->pEnv) tdbClose(pMeta->pEnv);
|
||||
metaDestroyLock(pMeta);
|
||||
(void)metaDestroyLock(pMeta);
|
||||
|
||||
taosMemoryFreeClear(*ppMeta);
|
||||
}
|
||||
|
|
|
@ -252,7 +252,7 @@ void metaCloseTbCursor(SMTbCursor *pTbCur) {
|
|||
if (!pTbCur->paused) {
|
||||
metaReaderClear(&pTbCur->mr);
|
||||
if (pTbCur->pDbc) {
|
||||
tdbTbcClose((TBC *)pTbCur->pDbc);
|
||||
(void)tdbTbcClose((TBC *)pTbCur->pDbc);
|
||||
}
|
||||
}
|
||||
taosMemoryFree(pTbCur);
|
||||
|
@ -262,7 +262,7 @@ void metaCloseTbCursor(SMTbCursor *pTbCur) {
|
|||
void metaPauseTbCursor(SMTbCursor *pTbCur) {
|
||||
if (!pTbCur->paused) {
|
||||
metaReaderClear(&pTbCur->mr);
|
||||
tdbTbcClose((TBC *)pTbCur->pDbc);
|
||||
(void)tdbTbcClose((TBC *)pTbCur->pDbc);
|
||||
pTbCur->paused = 1;
|
||||
}
|
||||
}
|
||||
|
@ -270,19 +270,19 @@ void metaResumeTbCursor(SMTbCursor *pTbCur, int8_t first, int8_t move) {
|
|||
if (pTbCur->paused) {
|
||||
metaReaderDoInit(&pTbCur->mr, pTbCur->pMeta, META_READER_LOCK);
|
||||
|
||||
tdbTbcOpen(((SMeta *)pTbCur->pMeta)->pUidIdx, (TBC **)&pTbCur->pDbc, NULL);
|
||||
(void)tdbTbcOpen(((SMeta *)pTbCur->pMeta)->pUidIdx, (TBC **)&pTbCur->pDbc, NULL);
|
||||
|
||||
if (first) {
|
||||
tdbTbcMoveToFirst((TBC *)pTbCur->pDbc);
|
||||
(void)tdbTbcMoveToFirst((TBC *)pTbCur->pDbc);
|
||||
} else {
|
||||
int c = 1;
|
||||
tdbTbcMoveTo(pTbCur->pDbc, pTbCur->pKey, pTbCur->kLen, &c);
|
||||
(void)tdbTbcMoveTo(pTbCur->pDbc, pTbCur->pKey, pTbCur->kLen, &c);
|
||||
if (c == 0) {
|
||||
if (move) tdbTbcMoveToNext(pTbCur->pDbc);
|
||||
} else if (c < 0) {
|
||||
tdbTbcMoveToPrev(pTbCur->pDbc);
|
||||
(void)tdbTbcMoveToPrev(pTbCur->pDbc);
|
||||
} else {
|
||||
tdbTbcMoveToNext(pTbCur->pDbc);
|
||||
(void)tdbTbcMoveToNext(pTbCur->pDbc);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -303,7 +303,7 @@ int32_t metaTbCursorNext(SMTbCursor *pTbCur, ETableType jumpTableType) {
|
|||
|
||||
tDecoderClear(&pTbCur->mr.coder);
|
||||
|
||||
metaGetTableEntryByVersion(&pTbCur->mr, ((SUidIdxVal *)pTbCur->pVal)[0].version, *(tb_uid_t *)pTbCur->pKey);
|
||||
(void)metaGetTableEntryByVersion(&pTbCur->mr, ((SUidIdxVal *)pTbCur->pVal)[0].version, *(tb_uid_t *)pTbCur->pKey);
|
||||
if (pTbCur->mr.me.type == jumpTableType) {
|
||||
continue;
|
||||
}
|
||||
|
@ -327,7 +327,7 @@ int32_t metaTbCursorPrev(SMTbCursor *pTbCur, ETableType jumpTableType) {
|
|||
|
||||
tDecoderClear(&pTbCur->mr.coder);
|
||||
|
||||
metaGetTableEntryByVersion(&pTbCur->mr, ((SUidIdxVal *)pTbCur->pVal)[0].version, *(tb_uid_t *)pTbCur->pKey);
|
||||
(void)metaGetTableEntryByVersion(&pTbCur->mr, ((SUidIdxVal *)pTbCur->pVal)[0].version, *(tb_uid_t *)pTbCur->pKey);
|
||||
if (pTbCur->mr.me.type == jumpTableType) {
|
||||
continue;
|
||||
}
|
||||
|
@ -355,11 +355,11 @@ _query:
|
|||
|
||||
version = ((SUidIdxVal *)pData)[0].version;
|
||||
|
||||
tdbTbGet(pMeta->pTbDb, &(STbDbKey){.uid = uid, .version = version}, sizeof(STbDbKey), &pData, &nData);
|
||||
(void)tdbTbGet(pMeta->pTbDb, &(STbDbKey){.uid = uid, .version = version}, sizeof(STbDbKey), &pData, &nData);
|
||||
|
||||
SMetaEntry me = {0};
|
||||
tDecoderInit(&dc, pData, nData);
|
||||
metaDecodeEntry(&dc, &me);
|
||||
(void)metaDecodeEntry(&dc, &me);
|
||||
if (me.type == TSDB_SUPER_TABLE) {
|
||||
if (sver == -1 || sver == me.stbEntry.schemaRow.version) {
|
||||
pSchema = tCloneSSchemaWrapper(&me.stbEntry.schemaRow);
|
||||
|
@ -385,7 +385,7 @@ _query:
|
|||
}
|
||||
|
||||
tDecoderInit(&dc, pData, nData);
|
||||
tDecodeSSchemaWrapperEx(&dc, &schema);
|
||||
(void)tDecodeSSchemaWrapperEx(&dc, &schema);
|
||||
pSchema = tCloneSSchemaWrapper(&schema);
|
||||
tDecoderClear(&dc);
|
||||
|
||||
|
@ -433,7 +433,7 @@ void metaCloseCtbCursor(SMCtbCursor *pCtbCur) {
|
|||
if (!pCtbCur->paused) {
|
||||
if (pCtbCur->pMeta && pCtbCur->lock) metaULock(pCtbCur->pMeta);
|
||||
if (pCtbCur->pCur) {
|
||||
tdbTbcClose(pCtbCur->pCur);
|
||||
(void)tdbTbcClose(pCtbCur->pCur);
|
||||
}
|
||||
}
|
||||
tdbFree(pCtbCur->pKey);
|
||||
|
@ -444,7 +444,7 @@ void metaCloseCtbCursor(SMCtbCursor *pCtbCur) {
|
|||
|
||||
void metaPauseCtbCursor(SMCtbCursor *pCtbCur) {
|
||||
if (!pCtbCur->paused) {
|
||||
tdbTbcClose((TBC *)pCtbCur->pCur);
|
||||
(void)tdbTbcClose((TBC *)pCtbCur->pCur);
|
||||
if (pCtbCur->lock) {
|
||||
metaULock(pCtbCur->pMeta);
|
||||
}
|
||||
|
@ -472,17 +472,17 @@ int32_t metaResumeCtbCursor(SMCtbCursor *pCtbCur, int8_t first) {
|
|||
ctbIdxKey.suid = pCtbCur->suid;
|
||||
ctbIdxKey.uid = INT64_MIN;
|
||||
int c = 0;
|
||||
tdbTbcMoveTo(pCtbCur->pCur, &ctbIdxKey, sizeof(ctbIdxKey), &c);
|
||||
(void)tdbTbcMoveTo(pCtbCur->pCur, &ctbIdxKey, sizeof(ctbIdxKey), &c);
|
||||
if (c > 0) {
|
||||
tdbTbcMoveToNext(pCtbCur->pCur);
|
||||
(void)tdbTbcMoveToNext(pCtbCur->pCur);
|
||||
}
|
||||
} else {
|
||||
int c = 0;
|
||||
ret = tdbTbcMoveTo(pCtbCur->pCur, pCtbCur->pKey, pCtbCur->kLen, &c);
|
||||
if (c < 0) {
|
||||
tdbTbcMoveToPrev(pCtbCur->pCur);
|
||||
(void)tdbTbcMoveToPrev(pCtbCur->pCur);
|
||||
} else {
|
||||
tdbTbcMoveToNext(pCtbCur->pCur);
|
||||
(void)tdbTbcMoveToNext(pCtbCur->pCur);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -540,9 +540,9 @@ SMStbCursor *metaOpenStbCursor(SMeta *pMeta, tb_uid_t suid) {
|
|||
}
|
||||
|
||||
// move to the suid
|
||||
tdbTbcMoveTo(pStbCur->pCur, &suid, sizeof(suid), &c);
|
||||
(void)tdbTbcMoveTo(pStbCur->pCur, &suid, sizeof(suid), &c);
|
||||
if (c > 0) {
|
||||
tdbTbcMoveToNext(pStbCur->pCur);
|
||||
(void)tdbTbcMoveToNext(pStbCur->pCur);
|
||||
}
|
||||
|
||||
return pStbCur;
|
||||
|
@ -552,7 +552,7 @@ void metaCloseStbCursor(SMStbCursor *pStbCur) {
|
|||
if (pStbCur) {
|
||||
if (pStbCur->pMeta) metaULock(pStbCur->pMeta);
|
||||
if (pStbCur->pCur) {
|
||||
tdbTbcClose(pStbCur->pCur);
|
||||
(void)tdbTbcClose(pStbCur->pCur);
|
||||
|
||||
tdbFree(pStbCur->pKey);
|
||||
tdbFree(pStbCur->pVal);
|
||||
|
@ -603,35 +603,35 @@ int32_t metaGetTbTSchemaEx(SMeta *pMeta, tb_uid_t suid, tb_uid_t uid, int32_t sv
|
|||
skmDbKey.uid = suid ? suid : uid;
|
||||
skmDbKey.sver = INT32_MAX;
|
||||
|
||||
tdbTbcOpen(pMeta->pSkmDb, &pSkmDbC, NULL);
|
||||
(void)tdbTbcOpen(pMeta->pSkmDb, &pSkmDbC, NULL);
|
||||
metaRLock(pMeta);
|
||||
|
||||
if (tdbTbcMoveTo(pSkmDbC, &skmDbKey, sizeof(skmDbKey), &c) < 0) {
|
||||
metaULock(pMeta);
|
||||
tdbTbcClose(pSkmDbC);
|
||||
(void)tdbTbcClose(pSkmDbC);
|
||||
code = TSDB_CODE_NOT_FOUND;
|
||||
goto _exit;
|
||||
}
|
||||
|
||||
if (c == 0) {
|
||||
metaULock(pMeta);
|
||||
tdbTbcClose(pSkmDbC);
|
||||
(void)tdbTbcClose(pSkmDbC);
|
||||
code = TSDB_CODE_FAILED;
|
||||
metaError("meta/query: incorrect c: %" PRId32 ".", c);
|
||||
goto _exit;
|
||||
}
|
||||
|
||||
if (c < 0) {
|
||||
tdbTbcMoveToPrev(pSkmDbC);
|
||||
(void)tdbTbcMoveToPrev(pSkmDbC);
|
||||
}
|
||||
|
||||
const void *pKey = NULL;
|
||||
int32_t nKey = 0;
|
||||
tdbTbcGet(pSkmDbC, &pKey, &nKey, NULL, NULL);
|
||||
(void)tdbTbcGet(pSkmDbC, &pKey, &nKey, NULL, NULL);
|
||||
|
||||
if (((SSkmDbKey *)pKey)->uid != skmDbKey.uid) {
|
||||
metaULock(pMeta);
|
||||
tdbTbcClose(pSkmDbC);
|
||||
(void)tdbTbcClose(pSkmDbC);
|
||||
code = TSDB_CODE_NOT_FOUND;
|
||||
goto _exit;
|
||||
}
|
||||
|
@ -639,7 +639,7 @@ int32_t metaGetTbTSchemaEx(SMeta *pMeta, tb_uid_t suid, tb_uid_t uid, int32_t sv
|
|||
sver = ((SSkmDbKey *)pKey)->sver;
|
||||
|
||||
metaULock(pMeta);
|
||||
tdbTbcClose(pSkmDbC);
|
||||
(void)tdbTbcClose(pSkmDbC);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -753,9 +753,9 @@ SMSmaCursor *metaOpenSmaCursor(SMeta *pMeta, tb_uid_t uid) {
|
|||
// move to the suid
|
||||
smaIdxKey.uid = uid;
|
||||
smaIdxKey.smaUid = INT64_MIN;
|
||||
tdbTbcMoveTo(pSmaCur->pCur, &smaIdxKey, sizeof(smaIdxKey), &c);
|
||||
(void)tdbTbcMoveTo(pSmaCur->pCur, &smaIdxKey, sizeof(smaIdxKey), &c);
|
||||
if (c > 0) {
|
||||
tdbTbcMoveToNext(pSmaCur->pCur);
|
||||
(void)tdbTbcMoveToNext(pSmaCur->pCur);
|
||||
}
|
||||
|
||||
return pSmaCur;
|
||||
|
@ -765,7 +765,7 @@ void metaCloseSmaCursor(SMSmaCursor *pSmaCur) {
|
|||
if (pSmaCur) {
|
||||
if (pSmaCur->pMeta) metaULock(pSmaCur->pMeta);
|
||||
if (pSmaCur->pCur) {
|
||||
tdbTbcClose(pSmaCur->pCur);
|
||||
(void)tdbTbcClose(pSmaCur->pCur);
|
||||
|
||||
tdbFree(pSmaCur->pKey);
|
||||
tdbFree(pSmaCur->pVal);
|
||||
|
@ -863,7 +863,7 @@ STSmaWrapper *metaGetSmaInfoByTable(SMeta *pMeta, tb_uid_t uid, bool deepCopy) {
|
|||
_err:
|
||||
metaReaderClear(&mr);
|
||||
taosArrayDestroy(pSmaIds);
|
||||
tFreeTSmaWrapper(pSW, deepCopy);
|
||||
(void)tFreeTSmaWrapper(pSW, deepCopy);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -1086,7 +1086,7 @@ int32_t metaFilterCreateTime(void *pVnode, SMetaFltParam *arg, SArray *pUids) {
|
|||
|
||||
END:
|
||||
if (pCursor->pMeta) metaULock(pCursor->pMeta);
|
||||
if (pCursor->pCur) tdbTbcClose(pCursor->pCur);
|
||||
if (pCursor->pCur) (void)tdbTbcClose(pCursor->pCur);
|
||||
taosMemoryFree(pCursor);
|
||||
return ret;
|
||||
}
|
||||
|
@ -1153,7 +1153,7 @@ int32_t metaFilterTableName(void *pVnode, SMetaFltParam *arg, SArray *pUids) {
|
|||
|
||||
END:
|
||||
if (pCursor->pMeta) metaULock(pCursor->pMeta);
|
||||
if (pCursor->pCur) tdbTbcClose(pCursor->pCur);
|
||||
if (pCursor->pCur) (void)tdbTbcClose(pCursor->pCur);
|
||||
taosMemoryFree(buf);
|
||||
taosMemoryFree(pKey);
|
||||
|
||||
|
@ -1182,7 +1182,7 @@ int32_t metaFilterTtl(void *pVnode, SMetaFltParam *arg, SArray *pUids) {
|
|||
|
||||
END:
|
||||
if (pCursor->pMeta) metaULock(pCursor->pMeta);
|
||||
if (pCursor->pCur) tdbTbcClose(pCursor->pCur);
|
||||
if (pCursor->pCur) (void)tdbTbcClose(pCursor->pCur);
|
||||
taosMemoryFree(buf);
|
||||
taosMemoryFree(pKey);
|
||||
|
||||
|
@ -1221,7 +1221,7 @@ int32_t metaFilterTableIds(void *pVnode, SMetaFltParam *arg, SArray *pUids) {
|
|||
}
|
||||
tbDbKey.uid = param->suid;
|
||||
tbDbKey.version = ((SUidIdxVal *)pData)[0].version;
|
||||
tdbTbGet(pMeta->pTbDb, &tbDbKey, sizeof(tbDbKey), &pData, &nData);
|
||||
(void)tdbTbGet(pMeta->pTbDb, &tbDbKey, sizeof(tbDbKey), &pData, &nData);
|
||||
|
||||
tDecoderInit(&dc, pData, nData);
|
||||
ret = metaDecodeEntry(&dc, &oStbEntry);
|
||||
|
@ -1353,7 +1353,7 @@ int32_t metaFilterTableIds(void *pVnode, SMetaFltParam *arg, SArray *pUids) {
|
|||
|
||||
END:
|
||||
if (pCursor->pMeta) metaULock(pCursor->pMeta);
|
||||
if (pCursor->pCur) tdbTbcClose(pCursor->pCur);
|
||||
if (pCursor->pCur) (void)tdbTbcClose(pCursor->pCur);
|
||||
if (oStbEntry.pBuf) taosMemoryFree(oStbEntry.pBuf);
|
||||
tDecoderClear(&dc);
|
||||
tdbFree(pData);
|
||||
|
@ -1427,7 +1427,7 @@ int32_t metaGetTableTags(void *pVnode, uint64_t suid, SArray *pUidTagInfo) {
|
|||
taosHashInit(numOfElems / 0.7, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_NO_LOCK);
|
||||
for (int i = 0; i < numOfElems; i++) {
|
||||
STUidTagInfo *pTagInfo = taosArrayGet(pUidTagInfo, i);
|
||||
taosHashPut(pSepecifiedUidMap, &pTagInfo->uid, sizeof(uint64_t), &i, sizeof(int32_t));
|
||||
(void)taosHashPut(pSepecifiedUidMap, &pTagInfo->uid, sizeof(uint64_t), &i, sizeof(int32_t));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1513,7 +1513,7 @@ int32_t metaGetInfo(SMeta *pMeta, int64_t uid, SMetaInfo *pInfo, SMetaReader *pR
|
|||
}
|
||||
// upsert the cache
|
||||
metaWLock(pMeta);
|
||||
metaCacheUpsert(pMeta, pInfo);
|
||||
(void)metaCacheUpsert(pMeta, pInfo);
|
||||
metaULock(pMeta);
|
||||
|
||||
if (lock) {
|
||||
|
@ -1565,7 +1565,7 @@ int32_t metaGetStbStats(void *pVnode, int64_t uid, int64_t *numOfTables, int32_t
|
|||
|
||||
// upsert the cache
|
||||
metaWLock(pVnodeObj->pMeta);
|
||||
metaStatsCacheUpsert(pVnodeObj->pMeta, &state);
|
||||
(void)metaStatsCacheUpsert(pVnodeObj->pMeta, &state);
|
||||
metaULock(pVnodeObj->pMeta);
|
||||
|
||||
_exit:
|
||||
|
@ -1578,6 +1578,6 @@ void metaUpdateStbStats(SMeta *pMeta, int64_t uid, int64_t deltaCtb, int32_t del
|
|||
if (metaStatsCacheGet(pMeta, uid, &stats) == TSDB_CODE_SUCCESS) {
|
||||
stats.ctbNum += deltaCtb;
|
||||
stats.colNum += deltaCol;
|
||||
metaStatsCacheUpsert(pMeta, &stats);
|
||||
(void)metaStatsCacheUpsert(pMeta, &stats);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@ _exit:
|
|||
|
||||
void metaSnapReaderClose(SMetaSnapReader** ppReader) {
|
||||
if (ppReader && *ppReader) {
|
||||
tdbTbcClose((*ppReader)->pTbc);
|
||||
(void)tdbTbcClose((*ppReader)->pTbc);
|
||||
taosMemoryFree(*ppReader);
|
||||
*ppReader = NULL;
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ int32_t metaSnapRead(SMetaSnapReader* pReader, uint8_t** ppData) {
|
|||
|
||||
if (key.version < pReader->sver //
|
||||
|| metaGetInfo(pReader->pMeta, key.uid, &info, NULL) == TSDB_CODE_NOT_FOUND) {
|
||||
tdbTbcMoveToNext(pReader->pTbc);
|
||||
(void)tdbTbcMoveToNext(pReader->pTbc);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -110,7 +110,7 @@ int32_t metaSnapRead(SMetaSnapReader* pReader, uint8_t** ppData) {
|
|||
metaDebug("vgId:%d, vnode snapshot meta read data, version:%" PRId64 " uid:%" PRId64 " blockLen:%d",
|
||||
TD_VID(pReader->pMeta->pVnode), key.version, key.uid, nData);
|
||||
|
||||
tdbTbcMoveToNext(pReader->pTbc);
|
||||
(void)tdbTbcMoveToNext(pReader->pTbc);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -223,17 +223,17 @@ static int32_t MoveToSnapShotVersion(SSnapContext* ctx) {
|
|||
int32_t code = 0;
|
||||
(void)tdbTbcClose((TBC*)ctx->pCur);
|
||||
code = tdbTbcOpen(ctx->pMeta->pTbDb, (TBC**)&ctx->pCur, NULL);
|
||||
if (code != 0){
|
||||
if (code != 0) {
|
||||
return TAOS_GET_TERRNO(code);
|
||||
}
|
||||
STbDbKey key = {.version = ctx->snapVersion, .uid = INT64_MAX};
|
||||
int c = 0;
|
||||
code = tdbTbcMoveTo((TBC*)ctx->pCur, &key, sizeof(key), &c);
|
||||
if (code != 0){
|
||||
if (code != 0) {
|
||||
return TAOS_GET_TERRNO(code);
|
||||
}
|
||||
if (c < 0) {
|
||||
tdbTbcMoveToPrev((TBC*)ctx->pCur);
|
||||
(void)tdbTbcMoveToPrev((TBC*)ctx->pCur);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -241,13 +241,13 @@ static int32_t MoveToSnapShotVersion(SSnapContext* ctx) {
|
|||
static int32_t MoveToPosition(SSnapContext* ctx, int64_t ver, int64_t uid) {
|
||||
(void)tdbTbcClose((TBC*)ctx->pCur);
|
||||
int32_t code = tdbTbcOpen(ctx->pMeta->pTbDb, (TBC**)&ctx->pCur, NULL);
|
||||
if (code != 0){
|
||||
if (code != 0) {
|
||||
return TAOS_GET_TERRNO(code);
|
||||
}
|
||||
STbDbKey key = {.version = ver, .uid = uid};
|
||||
int c = 0;
|
||||
code = tdbTbcMoveTo((TBC*)ctx->pCur, &key, sizeof(key), &c);
|
||||
if (code != 0){
|
||||
if (code != 0) {
|
||||
return TAOS_GET_TERRNO(code);
|
||||
}
|
||||
return c;
|
||||
|
@ -256,11 +256,11 @@ static int32_t MoveToPosition(SSnapContext* ctx, int64_t ver, int64_t uid) {
|
|||
static int32_t MoveToFirst(SSnapContext* ctx) {
|
||||
(void)tdbTbcClose((TBC*)ctx->pCur);
|
||||
int32_t code = tdbTbcOpen(ctx->pMeta->pTbDb, (TBC**)&ctx->pCur, NULL);
|
||||
if (code != 0){
|
||||
if (code != 0) {
|
||||
return TAOS_GET_TERRNO(code);
|
||||
}
|
||||
code = tdbTbcMoveToFirst((TBC*)ctx->pCur);
|
||||
if (code != 0){
|
||||
if (code != 0) {
|
||||
return TAOS_GET_TERRNO(code);
|
||||
}
|
||||
return 0;
|
||||
|
@ -271,38 +271,39 @@ static int32_t saveSuperTableInfoForChildTable(SMetaEntry* me, SHashObj* suidInf
|
|||
if (data) {
|
||||
return 0;
|
||||
}
|
||||
int32_t code = 0;
|
||||
int32_t code = 0;
|
||||
STableInfoForChildTable dataTmp = {0};
|
||||
dataTmp.tableName = taosStrdup(me->name);
|
||||
if (dataTmp.tableName == NULL){
|
||||
if (dataTmp.tableName == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
goto END;
|
||||
}
|
||||
dataTmp.schemaRow = tCloneSSchemaWrapper(&me->stbEntry.schemaRow);
|
||||
if (dataTmp.schemaRow == NULL){
|
||||
if (dataTmp.schemaRow == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
goto END;
|
||||
}
|
||||
dataTmp.tagRow = tCloneSSchemaWrapper(&me->stbEntry.schemaTag);
|
||||
if (dataTmp.tagRow == NULL){
|
||||
if (dataTmp.tagRow == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
goto END;
|
||||
}
|
||||
code = taosHashPut(suidInfo, &me->uid, sizeof(tb_uid_t), &dataTmp, sizeof(STableInfoForChildTable));
|
||||
if (code != 0){
|
||||
if (code != 0) {
|
||||
goto END;
|
||||
}
|
||||
return 0;
|
||||
|
||||
END:
|
||||
destroySTableInfoForChildTable(&dataTmp);
|
||||
return TAOS_GET_TERRNO(code);;
|
||||
return TAOS_GET_TERRNO(code);
|
||||
;
|
||||
}
|
||||
|
||||
int32_t buildSnapContext(SVnode* pVnode, int64_t snapVersion, int64_t suid, int8_t subType, int8_t withMeta,
|
||||
SSnapContext** ctxRet) {
|
||||
SSnapContext* ctx = taosMemoryCalloc(1, sizeof(SSnapContext));
|
||||
if (ctx == NULL){
|
||||
if (ctx == NULL) {
|
||||
return TAOS_GET_TERRNO(TSDB_CODE_OUT_OF_MEMORY);
|
||||
}
|
||||
*ctxRet = ctx;
|
||||
|
@ -319,14 +320,16 @@ int32_t buildSnapContext(SVnode* pVnode, int64_t snapVersion, int64_t suid, int8
|
|||
|
||||
ctx->suidInfo = taosHashInit(100, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), true, HASH_NO_LOCK);
|
||||
if (ctx->suidInfo == NULL) {
|
||||
return TAOS_GET_TERRNO(TSDB_CODE_OUT_OF_MEMORY);;
|
||||
return TAOS_GET_TERRNO(TSDB_CODE_OUT_OF_MEMORY);
|
||||
;
|
||||
}
|
||||
taosHashSetFreeFp(ctx->suidInfo, destroySTableInfoForChildTable);
|
||||
|
||||
ctx->index = 0;
|
||||
ctx->idList = taosArrayInit(100, sizeof(int64_t));
|
||||
if (ctx->idList == NULL){
|
||||
return TAOS_GET_TERRNO(TSDB_CODE_OUT_OF_MEMORY);;
|
||||
if (ctx->idList == NULL) {
|
||||
return TAOS_GET_TERRNO(TSDB_CODE_OUT_OF_MEMORY);
|
||||
;
|
||||
}
|
||||
void* pKey = NULL;
|
||||
void* pVal = NULL;
|
||||
|
@ -334,7 +337,7 @@ int32_t buildSnapContext(SVnode* pVnode, int64_t snapVersion, int64_t suid, int8
|
|||
|
||||
metaDebug("tmqsnap init snapVersion:%" PRIi64, ctx->snapVersion);
|
||||
int32_t code = MoveToFirst(ctx);
|
||||
if (code != 0){
|
||||
if (code != 0) {
|
||||
return code;
|
||||
}
|
||||
while (1) {
|
||||
|
@ -348,7 +351,8 @@ int32_t buildSnapContext(SVnode* pVnode, int64_t snapVersion, int64_t suid, int8
|
|||
continue;
|
||||
}
|
||||
|
||||
if (tdbTbGet(ctx->pMeta->pUidIdx, &tmp->uid, sizeof(tb_uid_t), NULL, NULL) < 0) { // check if table exist for now, need optimize later
|
||||
if (tdbTbGet(ctx->pMeta->pUidIdx, &tmp->uid, sizeof(tb_uid_t), NULL, NULL) <
|
||||
0) { // check if table exist for now, need optimize later
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -356,7 +360,7 @@ int32_t buildSnapContext(SVnode* pVnode, int64_t snapVersion, int64_t suid, int8
|
|||
SMetaEntry me = {0};
|
||||
tDecoderInit(&dc, pVal, vLen);
|
||||
ret = metaDecodeEntry(&dc, &me);
|
||||
if (ret < 0){
|
||||
if (ret < 0) {
|
||||
tDecoderClear(&dc);
|
||||
return TAOS_GET_TERRNO(ret);
|
||||
}
|
||||
|
@ -368,7 +372,7 @@ int32_t buildSnapContext(SVnode* pVnode, int64_t snapVersion, int64_t suid, int8
|
|||
}
|
||||
}
|
||||
|
||||
if (taosArrayPush(ctx->idList, &tmp->uid) == NULL){
|
||||
if (taosArrayPush(ctx->idList, &tmp->uid) == NULL) {
|
||||
tDecoderClear(&dc);
|
||||
return TAOS_GET_TERRNO(TSDB_CODE_OUT_OF_MEMORY);
|
||||
}
|
||||
|
@ -383,7 +387,7 @@ int32_t buildSnapContext(SVnode* pVnode, int64_t snapVersion, int64_t suid, int8
|
|||
taosHashClear(ctx->idVersion);
|
||||
|
||||
code = MoveToSnapShotVersion(ctx);
|
||||
if (code != 0){
|
||||
if (code != 0) {
|
||||
return code;
|
||||
}
|
||||
while (1) {
|
||||
|
@ -405,7 +409,7 @@ int32_t buildSnapContext(SVnode* pVnode, int64_t snapVersion, int64_t suid, int8
|
|||
SMetaEntry me = {0};
|
||||
tDecoderInit(&dc, pVal, vLen);
|
||||
ret = metaDecodeEntry(&dc, &me);
|
||||
if (ret < 0){
|
||||
if (ret < 0) {
|
||||
tDecoderClear(&dc);
|
||||
return TAOS_GET_TERRNO(ret);
|
||||
}
|
||||
|
@ -421,7 +425,7 @@ int32_t buildSnapContext(SVnode* pVnode, int64_t snapVersion, int64_t suid, int8
|
|||
if ((ctx->subType == TOPIC_SUB_TYPE__DB && me.type == TSDB_SUPER_TABLE) ||
|
||||
(ctx->subType == TOPIC_SUB_TYPE__TABLE && me.uid == ctx->suid)) {
|
||||
ret = saveSuperTableInfoForChildTable(&me, ctx->suidInfo);
|
||||
if (ret != 0){
|
||||
if (ret != 0) {
|
||||
tDecoderClear(&dc);
|
||||
return ret;
|
||||
}
|
||||
|
@ -431,7 +435,7 @@ int32_t buildSnapContext(SVnode* pVnode, int64_t snapVersion, int64_t suid, int8
|
|||
|
||||
for (int i = 0; i < taosArrayGetSize(ctx->idList); i++) {
|
||||
int64_t* uid = taosArrayGet(ctx->idList, i);
|
||||
if (uid == NULL){
|
||||
if (uid == NULL) {
|
||||
return TAOS_GET_TERRNO(TSDB_CODE_OUT_OF_MEMORY);
|
||||
}
|
||||
SIdInfo* idData = (SIdInfo*)taosHashGet(ctx->idVersion, uid, sizeof(int64_t));
|
||||
|
@ -467,7 +471,7 @@ static int32_t buildNormalChildTableInfo(SVCreateTbReq* req, void** pBuf, int32_
|
|||
ret = TAOS_GET_TERRNO(TSDB_CODE_OUT_OF_MEMORY);
|
||||
goto end;
|
||||
}
|
||||
if (taosArrayPush(reqs.pArray, req) == NULL){
|
||||
if (taosArrayPush(reqs.pArray, req) == NULL) {
|
||||
ret = TAOS_GET_TERRNO(TSDB_CODE_OUT_OF_MEMORY);
|
||||
goto end;
|
||||
}
|
||||
|
@ -540,10 +544,10 @@ int32_t setForSnapShot(SSnapContext* ctx, int64_t uid) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
void taosXSetTablePrimaryKey(SSnapContext* ctx, int64_t uid){
|
||||
bool ret = false;
|
||||
SSchemaWrapper *schema = metaGetTableSchema(ctx->pMeta, uid, -1, 1);
|
||||
if (schema && schema->nCols >= 2 && schema->pSchema[1].flags & COL_IS_KEY){
|
||||
void taosXSetTablePrimaryKey(SSnapContext* ctx, int64_t uid) {
|
||||
bool ret = false;
|
||||
SSchemaWrapper* schema = metaGetTableSchema(ctx->pMeta, uid, -1, 1);
|
||||
if (schema && schema->nCols >= 2 && schema->pSchema[1].flags & COL_IS_KEY) {
|
||||
ret = true;
|
||||
}
|
||||
tDeleteSchemaWrapper(schema);
|
||||
|
@ -639,7 +643,7 @@ int32_t getTableInfoFromSnapshot(SSnapContext* ctx, void** pBuf, int32_t* contLe
|
|||
ret = TAOS_GET_TERRNO(TSDB_CODE_OUT_OF_MEMORY);
|
||||
goto END;
|
||||
}
|
||||
STag* p = (STag*)me.ctbEntry.pTags;
|
||||
STag* p = (STag*)me.ctbEntry.pTags;
|
||||
if (tTagIsJson(p)) {
|
||||
if (p->nTag != 0) {
|
||||
SSchema* schema = &data->tagRow->pSchema[0];
|
||||
|
@ -651,7 +655,7 @@ int32_t getTableInfoFromSnapshot(SSnapContext* ctx, void** pBuf, int32_t* contLe
|
|||
}
|
||||
} else {
|
||||
SArray* pTagVals = NULL;
|
||||
ret = tTagToValArray((const STag*)p, &pTagVals);
|
||||
ret = tTagToValArray((const STag*)p, &pTagVals);
|
||||
if (ret != 0) {
|
||||
metaError("meta/snap: tag to val array failed.");
|
||||
taosArrayDestroy(pTagVals);
|
||||
|
@ -701,9 +705,9 @@ END:
|
|||
}
|
||||
|
||||
int32_t getMetaTableInfoFromSnapshot(SSnapContext* ctx, SMetaTableInfo* result) {
|
||||
void* pKey = NULL;
|
||||
void* pVal = NULL;
|
||||
int vLen, kLen;
|
||||
void* pKey = NULL;
|
||||
void* pVal = NULL;
|
||||
int vLen, kLen;
|
||||
|
||||
while (1) {
|
||||
if (ctx->index >= taosArrayGetSize(ctx->idList)) {
|
||||
|
@ -711,7 +715,7 @@ int32_t getMetaTableInfoFromSnapshot(SSnapContext* ctx, SMetaTableInfo* result)
|
|||
return 0;
|
||||
}
|
||||
int64_t* uidTmp = taosArrayGet(ctx->idList, ctx->index);
|
||||
if (uidTmp == NULL){
|
||||
if (uidTmp == NULL) {
|
||||
return TAOS_GET_TERRNO(TSDB_CODE_OUT_OF_MEMORY);
|
||||
}
|
||||
ctx->index++;
|
||||
|
@ -728,21 +732,21 @@ int32_t getMetaTableInfoFromSnapshot(SSnapContext* ctx, SMetaTableInfo* result)
|
|||
continue;
|
||||
}
|
||||
ret = tdbTbcGet((TBC*)ctx->pCur, (const void**)&pKey, &kLen, (const void**)&pVal, &vLen);
|
||||
if (ret != 0){
|
||||
if (ret != 0) {
|
||||
return TAOS_GET_TERRNO(ret);
|
||||
}
|
||||
SDecoder dc = {0};
|
||||
SMetaEntry me = {0};
|
||||
tDecoderInit(&dc, pVal, vLen);
|
||||
ret = metaDecodeEntry(&dc, &me);
|
||||
if (ret != 0){
|
||||
if (ret != 0) {
|
||||
tDecoderClear(&dc);
|
||||
return TAOS_GET_TERRNO(ret);
|
||||
}
|
||||
metaDebug("tmqsnap get uid info uid:%" PRIi64 " name:%s index:%d", me.uid, me.name, ctx->index - 1);
|
||||
|
||||
if ((ctx->subType == TOPIC_SUB_TYPE__DB && me.type == TSDB_CHILD_TABLE) ||
|
||||
(ctx->subType == TOPIC_SUB_TYPE__TABLE && me.type == TSDB_CHILD_TABLE && me.ctbEntry.suid == ctx->suid)){
|
||||
(ctx->subType == TOPIC_SUB_TYPE__TABLE && me.type == TSDB_CHILD_TABLE && me.ctbEntry.suid == ctx->suid)) {
|
||||
STableInfoForChildTable* data =
|
||||
(STableInfoForChildTable*)taosHashGet(ctx->suidInfo, &me.ctbEntry.suid, sizeof(tb_uid_t));
|
||||
if (data == NULL) {
|
||||
|
@ -763,7 +767,7 @@ int32_t getMetaTableInfoFromSnapshot(SSnapContext* ctx, SMetaTableInfo* result)
|
|||
result->uid = me.uid;
|
||||
tstrncpy(result->tbName, me.name, TSDB_TABLE_NAME_LEN);
|
||||
tDecoderClear(&dc);
|
||||
if(result->schema == NULL){
|
||||
if (result->schema == NULL) {
|
||||
return TAOS_GET_TERRNO(TSDB_CODE_OUT_OF_MEMORY);
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -161,10 +161,10 @@ static int metaSaveJsonVarToIdx(SMeta *pMeta, const SMetaEntry *pCtbEntry, const
|
|||
term = indexTermCreate(suid, ADD_VALUE, TSDB_DATA_TYPE_BOOL, key, nKey, (const char *)&val, len);
|
||||
}
|
||||
if (term != NULL) {
|
||||
indexMultiTermAdd(terms, term);
|
||||
(void)indexMultiTermAdd(terms, term);
|
||||
}
|
||||
}
|
||||
indexJsonPut(pMeta->pTagIvtIdx, terms, tuid);
|
||||
(void)indexJsonPut(pMeta->pTagIvtIdx, terms, tuid);
|
||||
indexMultiTermDestroy(terms);
|
||||
|
||||
taosArrayDestroy(pTagVals);
|
||||
|
@ -223,10 +223,10 @@ int metaDelJsonVarFromIdx(SMeta *pMeta, const SMetaEntry *pCtbEntry, const SSche
|
|||
term = indexTermCreate(suid, DEL_VALUE, TSDB_DATA_TYPE_BOOL, key, nKey, (const char *)&val, len);
|
||||
}
|
||||
if (term != NULL) {
|
||||
indexMultiTermAdd(terms, term);
|
||||
(void)indexMultiTermAdd(terms, term);
|
||||
}
|
||||
}
|
||||
indexJsonPut(pMeta->pTagIvtIdx, terms, tuid);
|
||||
(void)indexJsonPut(pMeta->pTagIvtIdx, terms, tuid);
|
||||
indexMultiTermDestroy(terms);
|
||||
taosArrayDestroy(pTagVals);
|
||||
#endif
|
||||
|
@ -239,7 +239,7 @@ static inline void metaTimeSeriesNotifyCheck(SMeta *pMeta) {
|
|||
int64_t deltaTS = nTimeSeries - pMeta->pVnode->config.vndStats.numOfReportedTimeSeries;
|
||||
if (deltaTS > tsTimeSeriesThreshold) {
|
||||
if (0 == atomic_val_compare_exchange_8(&dmNotifyHdl.state, 1, 2)) {
|
||||
tsem_post(&dmNotifyHdl.sem);
|
||||
(void)tsem_post(&dmNotifyHdl.sem);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -323,10 +323,10 @@ int metaDropSTable(SMeta *pMeta, int64_t verison, SVDropStbReq *pReq, SArray *tb
|
|||
// drop all child tables
|
||||
TBC *pCtbIdxc = NULL;
|
||||
|
||||
tdbTbcOpen(pMeta->pCtbIdx, &pCtbIdxc, NULL);
|
||||
(void)(void)tdbTbcOpen(pMeta->pCtbIdx, &pCtbIdxc, NULL);
|
||||
rc = tdbTbcMoveTo(pCtbIdxc, &(SCtbIdxKey){.suid = pReq->suid, .uid = INT64_MIN}, sizeof(SCtbIdxKey), &c);
|
||||
if (rc < 0) {
|
||||
tdbTbcClose(pCtbIdxc);
|
||||
(void)tdbTbcClose(pCtbIdxc);
|
||||
metaWLock(pMeta);
|
||||
goto _drop_super_table;
|
||||
}
|
||||
|
@ -344,7 +344,7 @@ int metaDropSTable(SMeta *pMeta, int64_t verison, SVDropStbReq *pReq, SArray *tb
|
|||
(void)taosArrayPush(tbUidList, &(((SCtbIdxKey *)pKey)->uid));
|
||||
}
|
||||
|
||||
tdbTbcClose(pCtbIdxc);
|
||||
(void)tdbTbcClose(pCtbIdxc);
|
||||
|
||||
(void)tsdbCacheDropSubTables(pMeta->pVnode->pTsdb, tbUidList, pReq->suid);
|
||||
|
||||
|
@ -352,19 +352,19 @@ int metaDropSTable(SMeta *pMeta, int64_t verison, SVDropStbReq *pReq, SArray *tb
|
|||
|
||||
for (int32_t iChild = 0; iChild < taosArrayGetSize(tbUidList); iChild++) {
|
||||
tb_uid_t uid = *(tb_uid_t *)taosArrayGet(tbUidList, iChild);
|
||||
metaDropTableByUid(pMeta, uid, NULL, NULL, NULL);
|
||||
(void)metaDropTableByUid(pMeta, uid, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
// drop super table
|
||||
_drop_super_table:
|
||||
tdbTbGet(pMeta->pUidIdx, &pReq->suid, sizeof(tb_uid_t), &pData, &nData);
|
||||
tdbTbDelete(pMeta->pTbDb, &(STbDbKey){.version = ((SUidIdxVal *)pData)[0].version, .uid = pReq->suid},
|
||||
sizeof(STbDbKey), pMeta->txn);
|
||||
tdbTbDelete(pMeta->pNameIdx, pReq->name, strlen(pReq->name) + 1, pMeta->txn);
|
||||
tdbTbDelete(pMeta->pUidIdx, &pReq->suid, sizeof(tb_uid_t), pMeta->txn);
|
||||
tdbTbDelete(pMeta->pSuidIdx, &pReq->suid, sizeof(tb_uid_t), pMeta->txn);
|
||||
(void)tdbTbDelete(pMeta->pTbDb, &(STbDbKey){.version = ((SUidIdxVal *)pData)[0].version, .uid = pReq->suid},
|
||||
sizeof(STbDbKey), pMeta->txn);
|
||||
(void)tdbTbDelete(pMeta->pNameIdx, pReq->name, strlen(pReq->name) + 1, pMeta->txn);
|
||||
(void)tdbTbDelete(pMeta->pUidIdx, &pReq->suid, sizeof(tb_uid_t), pMeta->txn);
|
||||
(void)tdbTbDelete(pMeta->pSuidIdx, &pReq->suid, sizeof(tb_uid_t), pMeta->txn);
|
||||
|
||||
metaStatsCacheDrop(pMeta, pReq->suid);
|
||||
(void)metaStatsCacheDrop(pMeta, pReq->suid);
|
||||
|
||||
metaULock(pMeta);
|
||||
|
||||
|
@ -387,10 +387,10 @@ static void metaGetSubtables(SMeta *pMeta, int64_t suid, SArray *uids) {
|
|||
int nKey = 0;
|
||||
TBC *pCtbIdxc = NULL;
|
||||
|
||||
tdbTbcOpen(pMeta->pCtbIdx, &pCtbIdxc, NULL);
|
||||
(void)tdbTbcOpen(pMeta->pCtbIdx, &pCtbIdxc, NULL);
|
||||
int rc = tdbTbcMoveTo(pCtbIdxc, &(SCtbIdxKey){.suid = suid, .uid = INT64_MIN}, sizeof(SCtbIdxKey), &c);
|
||||
if (rc < 0) {
|
||||
tdbTbcClose(pCtbIdxc);
|
||||
(void)tdbTbcClose(pCtbIdxc);
|
||||
metaWLock(pMeta);
|
||||
return;
|
||||
}
|
||||
|
@ -410,7 +410,7 @@ static void metaGetSubtables(SMeta *pMeta, int64_t suid, SArray *uids) {
|
|||
|
||||
tdbFree(pKey);
|
||||
|
||||
tdbTbcClose(pCtbIdxc);
|
||||
(void)tdbTbcClose(pCtbIdxc);
|
||||
}
|
||||
|
||||
int metaAlterSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) {
|
||||
|
@ -425,28 +425,28 @@ int metaAlterSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) {
|
|||
int32_t ret;
|
||||
int32_t c = -2;
|
||||
|
||||
tdbTbcOpen(pMeta->pUidIdx, &pUidIdxc, NULL);
|
||||
(void)tdbTbcOpen(pMeta->pUidIdx, &pUidIdxc, NULL);
|
||||
ret = tdbTbcMoveTo(pUidIdxc, &pReq->suid, sizeof(tb_uid_t), &c);
|
||||
if (ret < 0 || c) {
|
||||
tdbTbcClose(pUidIdxc);
|
||||
(void)tdbTbcClose(pUidIdxc);
|
||||
|
||||
return terrno = TSDB_CODE_TDB_STB_NOT_EXIST;
|
||||
}
|
||||
|
||||
ret = tdbTbcGet(pUidIdxc, NULL, NULL, &pData, &nData);
|
||||
if (ret < 0) {
|
||||
tdbTbcClose(pUidIdxc);
|
||||
(void)tdbTbcClose(pUidIdxc);
|
||||
|
||||
return terrno = TSDB_CODE_TDB_STB_NOT_EXIST;
|
||||
}
|
||||
|
||||
oversion = ((SUidIdxVal *)pData)[0].version;
|
||||
|
||||
tdbTbcOpen(pMeta->pTbDb, &pTbDbc, NULL);
|
||||
(void)tdbTbcOpen(pMeta->pTbDb, &pTbDbc, NULL);
|
||||
ret = tdbTbcMoveTo(pTbDbc, &((STbDbKey){.uid = pReq->suid, .version = oversion}), sizeof(STbDbKey), &c);
|
||||
if (!(ret == 0 && c == 0)) {
|
||||
tdbTbcClose(pUidIdxc);
|
||||
tdbTbcClose(pTbDbc);
|
||||
(void)tdbTbcClose(pUidIdxc);
|
||||
(void)tdbTbcClose(pTbDbc);
|
||||
|
||||
metaError("meta/table: invalide ret: %" PRId32 " or c: %" PRId32 "alter stb failed.", ret, c);
|
||||
return terrno = TSDB_CODE_TDB_STB_NOT_EXIST;
|
||||
|
@ -454,8 +454,8 @@ int metaAlterSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) {
|
|||
|
||||
ret = tdbTbcGet(pTbDbc, NULL, NULL, &pData, &nData);
|
||||
if (ret < 0) {
|
||||
tdbTbcClose(pUidIdxc);
|
||||
tdbTbcClose(pTbDbc);
|
||||
(void)tdbTbcClose(pUidIdxc);
|
||||
(void)tdbTbcClose(pTbDbc);
|
||||
|
||||
return terrno = TSDB_CODE_TDB_STB_NOT_EXIST;
|
||||
}
|
||||
|
@ -463,7 +463,7 @@ int metaAlterSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) {
|
|||
oStbEntry.pBuf = taosMemoryMalloc(nData);
|
||||
memcpy(oStbEntry.pBuf, pData, nData);
|
||||
tDecoderInit(&dc, oStbEntry.pBuf, nData);
|
||||
metaDecodeEntry(&dc, &oStbEntry);
|
||||
(void)metaDecodeEntry(&dc, &oStbEntry);
|
||||
|
||||
nStbEntry.version = version;
|
||||
nStbEntry.type = TSDB_SUPER_TABLE;
|
||||
|
@ -487,7 +487,7 @@ int metaAlterSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) {
|
|||
int8_t col_type = pReq->schemaRow.pSchema[nCols - 1].type;
|
||||
|
||||
metaGetSubtables(pMeta, pReq->suid, uids);
|
||||
tsdbCacheNewSTableColumn(pTsdb, uids, cid, col_type);
|
||||
(void)tsdbCacheNewSTableColumn(pTsdb, uids, cid, col_type);
|
||||
} else if (deltaCol == -1) {
|
||||
int16_t cid = -1;
|
||||
bool hasPrimaryKey = false;
|
||||
|
@ -503,7 +503,7 @@ int metaAlterSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) {
|
|||
|
||||
if (cid != -1) {
|
||||
metaGetSubtables(pMeta, pReq->suid, uids);
|
||||
tsdbCacheDropSTableColumn(pTsdb, uids, cid, hasPrimaryKey);
|
||||
(void)tsdbCacheDropSTableColumn(pTsdb, uids, cid, hasPrimaryKey);
|
||||
}
|
||||
}
|
||||
if (uids) taosArrayDestroy(uids);
|
||||
|
@ -512,25 +512,25 @@ int metaAlterSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) {
|
|||
metaWLock(pMeta);
|
||||
// compare two entry
|
||||
if (oStbEntry.stbEntry.schemaRow.version != pReq->schemaRow.version) {
|
||||
metaSaveToSkmDb(pMeta, &nStbEntry);
|
||||
(void)metaSaveToSkmDb(pMeta, &nStbEntry);
|
||||
}
|
||||
|
||||
// update table.db
|
||||
metaSaveToTbDb(pMeta, &nStbEntry);
|
||||
(void)metaSaveToTbDb(pMeta, &nStbEntry);
|
||||
|
||||
// update uid index
|
||||
metaUpdateUidIdx(pMeta, &nStbEntry);
|
||||
(void)metaUpdateUidIdx(pMeta, &nStbEntry);
|
||||
|
||||
// metaStatsCacheDrop(pMeta, nStbEntry.uid);
|
||||
|
||||
if (updStat) {
|
||||
metaUpdateStbStats(pMeta, pReq->suid, 0, deltaCol);
|
||||
(void)metaUpdateStbStats(pMeta, pReq->suid, 0, deltaCol);
|
||||
}
|
||||
metaULock(pMeta);
|
||||
|
||||
if (updStat) {
|
||||
int64_t ctbNum;
|
||||
metaGetStbStats(pMeta->pVnode, pReq->suid, &ctbNum, NULL);
|
||||
(void)metaGetStbStats(pMeta->pVnode, pReq->suid, &ctbNum, NULL);
|
||||
pMeta->pVnode->config.vndStats.numOfTimeSeries += (ctbNum * deltaCol);
|
||||
metaTimeSeriesNotifyCheck(pMeta);
|
||||
}
|
||||
|
@ -540,8 +540,8 @@ int metaAlterSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) {
|
|||
_exit:
|
||||
if (oStbEntry.pBuf) taosMemoryFree(oStbEntry.pBuf);
|
||||
tDecoderClear(&dc);
|
||||
tdbTbcClose(pTbDbc);
|
||||
tdbTbcClose(pUidIdxc);
|
||||
(void)tdbTbcClose(pTbDbc);
|
||||
(void)tdbTbcClose(pUidIdxc);
|
||||
return 0;
|
||||
}
|
||||
int metaAddIndexToSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) {
|
||||
|
@ -568,7 +568,7 @@ int metaAddIndexToSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) {
|
|||
|
||||
tbDbKey.uid = suid;
|
||||
tbDbKey.version = ((SUidIdxVal *)pData)[0].version;
|
||||
tdbTbGet(pMeta->pTbDb, &tbDbKey, sizeof(tbDbKey), &pData, &nData);
|
||||
(void)tdbTbGet(pMeta->pTbDb, &tbDbKey, sizeof(tbDbKey), &pData, &nData);
|
||||
|
||||
tDecoderInit(&dc, pData, nData);
|
||||
ret = metaDecodeEntry(&dc, &oStbEntry);
|
||||
|
@ -619,10 +619,10 @@ int metaAddIndexToSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) {
|
|||
* iterator all pTdDbc by uid and version
|
||||
*/
|
||||
TBC *pCtbIdxc = NULL;
|
||||
tdbTbcOpen(pMeta->pCtbIdx, &pCtbIdxc, NULL);
|
||||
(void)tdbTbcOpen(pMeta->pCtbIdx, &pCtbIdxc, NULL);
|
||||
int rc = tdbTbcMoveTo(pCtbIdxc, &(SCtbIdxKey){.suid = suid, .uid = INT64_MIN}, sizeof(SCtbIdxKey), &c);
|
||||
if (rc < 0) {
|
||||
tdbTbcClose(pCtbIdxc);
|
||||
(void)tdbTbcClose(pCtbIdxc);
|
||||
goto _err;
|
||||
}
|
||||
for (;;) {
|
||||
|
@ -632,7 +632,7 @@ int metaAddIndexToSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) {
|
|||
if (rc < 0) {
|
||||
tdbFree(pKey);
|
||||
tdbFree(pVal);
|
||||
tdbTbcClose(pCtbIdxc);
|
||||
(void)tdbTbcClose(pCtbIdxc);
|
||||
pCtbIdxc = NULL;
|
||||
break;
|
||||
}
|
||||
|
@ -667,12 +667,12 @@ int metaAddIndexToSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) {
|
|||
tdbFree(pVal);
|
||||
if (rc < 0) {
|
||||
metaDestroyTagIdxKey(pTagIdxKey);
|
||||
tdbTbcClose(pCtbIdxc);
|
||||
(void)tdbTbcClose(pCtbIdxc);
|
||||
goto _err;
|
||||
}
|
||||
|
||||
metaWLock(pMeta);
|
||||
tdbTbUpsert(pMeta->pTagIdx, pTagIdxKey, nTagIdxKey, NULL, 0, pMeta->txn);
|
||||
(void)tdbTbUpsert(pMeta->pTagIdx, pTagIdxKey, nTagIdxKey, NULL, 0, pMeta->txn);
|
||||
metaULock(pMeta);
|
||||
metaDestroyTagIdxKey(pTagIdxKey);
|
||||
pTagIdxKey = NULL;
|
||||
|
@ -688,16 +688,16 @@ int metaAddIndexToSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) {
|
|||
|
||||
metaWLock(pMeta);
|
||||
// update table.db
|
||||
metaSaveToTbDb(pMeta, &nStbEntry);
|
||||
(void)metaSaveToTbDb(pMeta, &nStbEntry);
|
||||
// update uid index
|
||||
metaUpdateUidIdx(pMeta, &nStbEntry);
|
||||
(void)metaUpdateUidIdx(pMeta, &nStbEntry);
|
||||
metaULock(pMeta);
|
||||
|
||||
if (oStbEntry.pBuf) taosMemoryFree(oStbEntry.pBuf);
|
||||
tDecoderClear(&dc);
|
||||
tdbFree(pData);
|
||||
|
||||
tdbTbcClose(pCtbIdxc);
|
||||
(void)tdbTbcClose(pCtbIdxc);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
_err:
|
||||
if (oStbEntry.pBuf) taosMemoryFree(oStbEntry.pBuf);
|
||||
|
@ -729,7 +729,7 @@ int metaDropIndexFromSTable(SMeta *pMeta, int64_t version, SDropIndexReq *pReq)
|
|||
|
||||
tbDbKey.uid = suid;
|
||||
tbDbKey.version = ((SUidIdxVal *)pData)[0].version;
|
||||
tdbTbGet(pMeta->pTbDb, &tbDbKey, sizeof(tbDbKey), &pData, &nData);
|
||||
(void)tdbTbGet(pMeta->pTbDb, &tbDbKey, sizeof(tbDbKey), &pData, &nData);
|
||||
tDecoderInit(&dc, pData, nData);
|
||||
ret = metaDecodeEntry(&dc, &oStbEntry);
|
||||
if (ret < 0) {
|
||||
|
@ -756,10 +756,10 @@ int metaDropIndexFromSTable(SMeta *pMeta, int64_t version, SDropIndexReq *pReq)
|
|||
* iterator all pTdDbc by uid and version
|
||||
*/
|
||||
TBC *pCtbIdxc = NULL;
|
||||
tdbTbcOpen(pMeta->pCtbIdx, &pCtbIdxc, NULL);
|
||||
(void)tdbTbcOpen(pMeta->pCtbIdx, &pCtbIdxc, NULL);
|
||||
int rc = tdbTbcMoveTo(pCtbIdxc, &(SCtbIdxKey){.suid = suid, .uid = INT64_MIN}, sizeof(SCtbIdxKey), &c);
|
||||
if (rc < 0) {
|
||||
tdbTbcClose(pCtbIdxc);
|
||||
(void)tdbTbcClose(pCtbIdxc);
|
||||
goto _err;
|
||||
}
|
||||
for (;;) {
|
||||
|
@ -769,7 +769,7 @@ int metaDropIndexFromSTable(SMeta *pMeta, int64_t version, SDropIndexReq *pReq)
|
|||
if (rc < 0) {
|
||||
tdbFree(pKey);
|
||||
tdbFree(pVal);
|
||||
tdbTbcClose(pCtbIdxc);
|
||||
(void)tdbTbcClose(pCtbIdxc);
|
||||
pCtbIdxc = NULL;
|
||||
break;
|
||||
}
|
||||
|
@ -804,12 +804,12 @@ int metaDropIndexFromSTable(SMeta *pMeta, int64_t version, SDropIndexReq *pReq)
|
|||
tdbFree(pVal);
|
||||
if (rc < 0) {
|
||||
metaDestroyTagIdxKey(pTagIdxKey);
|
||||
tdbTbcClose(pCtbIdxc);
|
||||
(void)tdbTbcClose(pCtbIdxc);
|
||||
goto _err;
|
||||
}
|
||||
|
||||
metaWLock(pMeta);
|
||||
tdbTbDelete(pMeta->pTagIdx, pTagIdxKey, nTagIdxKey, pMeta->txn);
|
||||
(void)tdbTbDelete(pMeta->pTagIdx, pTagIdxKey, nTagIdxKey, pMeta->txn);
|
||||
metaULock(pMeta);
|
||||
metaDestroyTagIdxKey(pTagIdxKey);
|
||||
pTagIdxKey = NULL;
|
||||
|
@ -836,9 +836,9 @@ int metaDropIndexFromSTable(SMeta *pMeta, int64_t version, SDropIndexReq *pReq)
|
|||
|
||||
metaWLock(pMeta);
|
||||
// update table.db
|
||||
metaSaveToTbDb(pMeta, &nStbEntry);
|
||||
(void)metaSaveToTbDb(pMeta, &nStbEntry);
|
||||
// update uid index
|
||||
metaUpdateUidIdx(pMeta, &nStbEntry);
|
||||
(void)metaUpdateUidIdx(pMeta, &nStbEntry);
|
||||
metaULock(pMeta);
|
||||
|
||||
tDeleteSchemaWrapper(tag);
|
||||
|
@ -849,7 +849,7 @@ int metaDropIndexFromSTable(SMeta *pMeta, int64_t version, SDropIndexReq *pReq)
|
|||
tDecoderClear(&dc);
|
||||
tdbFree(pData);
|
||||
|
||||
tdbTbcClose(pCtbIdxc);
|
||||
(void)tdbTbcClose(pCtbIdxc);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
_err:
|
||||
if (oStbEntry.pBuf) taosMemoryFree(oStbEntry.pBuf);
|
||||
|
@ -937,18 +937,18 @@ int metaCreateTable(SMeta *pMeta, int64_t ver, SVCreateTbReq *pReq, STableMetaRs
|
|||
|
||||
if (!sysTbl) {
|
||||
int32_t nCols = 0;
|
||||
metaGetStbStats(pMeta->pVnode, me.ctbEntry.suid, 0, &nCols);
|
||||
(void)metaGetStbStats(pMeta->pVnode, me.ctbEntry.suid, 0, &nCols);
|
||||
pStats->numOfTimeSeries += nCols - 1;
|
||||
}
|
||||
|
||||
metaWLock(pMeta);
|
||||
metaUpdateStbStats(pMeta, me.ctbEntry.suid, 1, 0);
|
||||
metaUidCacheClear(pMeta, me.ctbEntry.suid);
|
||||
metaTbGroupCacheClear(pMeta, me.ctbEntry.suid);
|
||||
(void)metaUpdateStbStats(pMeta, me.ctbEntry.suid, 1, 0);
|
||||
(void)metaUidCacheClear(pMeta, me.ctbEntry.suid);
|
||||
(void)metaTbGroupCacheClear(pMeta, me.ctbEntry.suid);
|
||||
metaULock(pMeta);
|
||||
|
||||
if (!TSDB_CACHE_NO(pMeta->pVnode->config)) {
|
||||
tsdbCacheNewTable(pMeta->pVnode->pTsdb, me.uid, me.ctbEntry.suid, NULL);
|
||||
(void)tsdbCacheNewTable(pMeta->pVnode->pTsdb, me.uid, me.ctbEntry.suid, NULL);
|
||||
}
|
||||
} else {
|
||||
me.ntbEntry.btime = pReq->btime;
|
||||
|
@ -964,7 +964,7 @@ int metaCreateTable(SMeta *pMeta, int64_t ver, SVCreateTbReq *pReq, STableMetaRs
|
|||
pStats->numOfNTimeSeries += me.ntbEntry.schemaRow.nCols - 1;
|
||||
|
||||
if (!TSDB_CACHE_NO(pMeta->pVnode->config)) {
|
||||
tsdbCacheNewTable(pMeta->pVnode->pTsdb, me.uid, -1, &me.ntbEntry.schemaRow);
|
||||
(void)tsdbCacheNewTable(pMeta->pVnode->pTsdb, me.uid, -1, &me.ntbEntry.schemaRow);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -982,7 +982,7 @@ int metaCreateTable(SMeta *pMeta, int64_t ver, SVCreateTbReq *pReq, STableMetaRs
|
|||
(*pMetaRsp)->suid = pReq->ctb.suid;
|
||||
strcpy((*pMetaRsp)->tbName, pReq->name);
|
||||
} else {
|
||||
metaUpdateMetaRsp(pReq->uid, pReq->name, &pReq->ntb.schemaRow, *pMetaRsp);
|
||||
(void)metaUpdateMetaRsp(pReq->uid, pReq->name, &pReq->ntb.schemaRow, *pMetaRsp);
|
||||
for (int32_t i = 0; i < pReq->colCmpr.nCols; i++) {
|
||||
SColCmpr *p = &pReq->colCmpr.pColCmpr[i];
|
||||
(*pMetaRsp)->pSchemaExt[i].colId = p->id;
|
||||
|
@ -1036,7 +1036,7 @@ int metaDropTable(SMeta *pMeta, int64_t version, SVDropTbReq *pReq, SArray *tbUi
|
|||
(void)taosArrayPush(tbUids, &uid);
|
||||
|
||||
if (!TSDB_CACHE_NO(pMeta->pVnode->config)) {
|
||||
tsdbCacheDropTable(pMeta->pVnode->pTsdb, uid, suid, NULL);
|
||||
(void)tsdbCacheDropTable(pMeta->pVnode->pTsdb, uid, suid, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1062,7 +1062,7 @@ void metaDropTables(SMeta *pMeta, SArray *tbUids) {
|
|||
tb_uid_t suid = 0;
|
||||
int8_t sysTbl = 0;
|
||||
int type;
|
||||
metaDropTableByUid(pMeta, uid, &type, &suid, &sysTbl);
|
||||
(void)metaDropTableByUid(pMeta, uid, &type, &suid, &sysTbl);
|
||||
if (!sysTbl && type == TSDB_CHILD_TABLE && suid != 0 && suidHash) {
|
||||
int64_t *pVal = tSimpleHashGet(suidHash, &suid, sizeof(tb_uid_t));
|
||||
if (pVal) {
|
||||
|
@ -1070,7 +1070,7 @@ void metaDropTables(SMeta *pMeta, SArray *tbUids) {
|
|||
} else {
|
||||
nCtbDropped = 1;
|
||||
}
|
||||
tSimpleHashPut(suidHash, &suid, sizeof(tb_uid_t), &nCtbDropped, sizeof(int64_t));
|
||||
(void)tSimpleHashPut(suidHash, &suid, sizeof(tb_uid_t), &nCtbDropped, sizeof(int64_t));
|
||||
}
|
||||
/*
|
||||
if (!TSDB_CACHE_NO(pMeta->pVnode->config)) {
|
||||
|
@ -1111,7 +1111,7 @@ static int32_t metaFilterTableByHash(SMeta *pMeta, SArray *uidList) {
|
|||
|
||||
code = tdbTbcMoveToFirst(pCur);
|
||||
if (code) {
|
||||
tdbTbcClose(pCur);
|
||||
(void)tdbTbcClose(pCur);
|
||||
return code;
|
||||
}
|
||||
|
||||
|
@ -1127,7 +1127,7 @@ static int32_t metaFilterTableByHash(SMeta *pMeta, SArray *uidList) {
|
|||
SMetaEntry me = {0};
|
||||
SDecoder dc = {0};
|
||||
tDecoderInit(&dc, pData, nData);
|
||||
metaDecodeEntry(&dc, &me);
|
||||
(void)metaDecodeEntry(&dc, &me);
|
||||
|
||||
if (me.type != TSDB_SUPER_TABLE) {
|
||||
char tbFName[TSDB_TABLE_FNAME_LEN + 1];
|
||||
|
@ -1142,7 +1142,7 @@ static int32_t metaFilterTableByHash(SMeta *pMeta, SArray *uidList) {
|
|||
}
|
||||
tdbFree(pData);
|
||||
tdbFree(pKey);
|
||||
tdbTbcClose(pCur);
|
||||
(void)tdbTbcClose(pCur);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1237,7 +1237,7 @@ static int metaDropTableByUid(SMeta *pMeta, tb_uid_t uid, int *type, tb_uid_t *p
|
|||
}
|
||||
int64_t version = ((SUidIdxVal *)pData)[0].version;
|
||||
|
||||
tdbTbGet(pMeta->pTbDb, &(STbDbKey){.version = version, .uid = uid}, sizeof(STbDbKey), &pData, &nData);
|
||||
(void)tdbTbGet(pMeta->pTbDb, &(STbDbKey){.version = version, .uid = uid}, sizeof(STbDbKey), &pData, &nData);
|
||||
|
||||
tDecoderInit(&dc, pData, nData);
|
||||
rc = metaDecodeEntry(&dc, &e);
|
||||
|
@ -1260,7 +1260,7 @@ static int metaDropTableByUid(SMeta *pMeta, tb_uid_t uid, int *type, tb_uid_t *p
|
|||
SMetaEntry stbEntry = {0};
|
||||
|
||||
tDecoderInit(&tdc, tData, tLen);
|
||||
metaDecodeEntry(&tdc, &stbEntry);
|
||||
(void)metaDecodeEntry(&tdc, &stbEntry);
|
||||
|
||||
if (pSysTbl) *pSysTbl = metaTbInFilterCache(pMeta, stbEntry.name, 1) ? 1 : 0;
|
||||
|
||||
|
@ -1268,7 +1268,7 @@ static int metaDropTableByUid(SMeta *pMeta, tb_uid_t uid, int *type, tb_uid_t *p
|
|||
SSchemaWrapper *pTagSchema = &stbEntry.stbEntry.schemaTag;
|
||||
if (pTagSchema->nCols == 1 && pTagSchema->pSchema[0].type == TSDB_DATA_TYPE_JSON) {
|
||||
pTagColumn = &stbEntry.stbEntry.schemaTag.pSchema[0];
|
||||
metaDelJsonVarFromIdx(pMeta, &e, pTagColumn);
|
||||
(void)metaDelJsonVarFromIdx(pMeta, &e, pTagColumn);
|
||||
} else {
|
||||
for (int i = 0; i < pTagSchema->nCols; i++) {
|
||||
pTagColumn = &stbEntry.stbEntry.schemaTag.pSchema[i];
|
||||
|
@ -1296,7 +1296,7 @@ static int metaDropTableByUid(SMeta *pMeta, tb_uid_t uid, int *type, tb_uid_t *p
|
|||
|
||||
if (metaCreateTagIdxKey(e.ctbEntry.suid, pTagColumn->colId, pTagData, nTagData, pTagColumn->type, uid,
|
||||
&pTagIdxKey, &nTagIdxKey) == 0) {
|
||||
tdbTbDelete(pMeta->pTagIdx, pTagIdxKey, nTagIdxKey, pMeta->txn);
|
||||
(void)tdbTbDelete(pMeta->pTagIdx, pTagIdxKey, nTagIdxKey, pMeta->txn);
|
||||
}
|
||||
metaDestroyTagIdxKey(pTagIdxKey);
|
||||
pTagIdxKey = NULL;
|
||||
|
@ -1308,9 +1308,9 @@ static int metaDropTableByUid(SMeta *pMeta, tb_uid_t uid, int *type, tb_uid_t *p
|
|||
}
|
||||
}
|
||||
|
||||
tdbTbDelete(pMeta->pTbDb, &(STbDbKey){.version = version, .uid = uid}, sizeof(STbDbKey), pMeta->txn);
|
||||
tdbTbDelete(pMeta->pNameIdx, e.name, strlen(e.name) + 1, pMeta->txn);
|
||||
tdbTbDelete(pMeta->pUidIdx, &uid, sizeof(uid), pMeta->txn);
|
||||
(void)tdbTbDelete(pMeta->pTbDb, &(STbDbKey){.version = version, .uid = uid}, sizeof(STbDbKey), pMeta->txn);
|
||||
(void)tdbTbDelete(pMeta->pNameIdx, e.name, strlen(e.name) + 1, pMeta->txn);
|
||||
(void)tdbTbDelete(pMeta->pUidIdx, &uid, sizeof(uid), pMeta->txn);
|
||||
|
||||
if (e.type == TSDB_CHILD_TABLE || e.type == TSDB_NORMAL_TABLE) metaDeleteBtimeIdx(pMeta, &e);
|
||||
if (e.type == TSDB_NORMAL_TABLE) metaDeleteNcolIdx(pMeta, &e);
|
||||
|
@ -1318,12 +1318,13 @@ static int metaDropTableByUid(SMeta *pMeta, tb_uid_t uid, int *type, tb_uid_t *p
|
|||
if (e.type != TSDB_SUPER_TABLE) metaDeleteTtl(pMeta, &e);
|
||||
|
||||
if (e.type == TSDB_CHILD_TABLE) {
|
||||
tdbTbDelete(pMeta->pCtbIdx, &(SCtbIdxKey){.suid = e.ctbEntry.suid, .uid = uid}, sizeof(SCtbIdxKey), pMeta->txn);
|
||||
(void)tdbTbDelete(pMeta->pCtbIdx, &(SCtbIdxKey){.suid = e.ctbEntry.suid, .uid = uid}, sizeof(SCtbIdxKey),
|
||||
pMeta->txn);
|
||||
|
||||
--pMeta->pVnode->config.vndStats.numOfCTables;
|
||||
metaUpdateStbStats(pMeta, e.ctbEntry.suid, -1, 0);
|
||||
metaUidCacheClear(pMeta, e.ctbEntry.suid);
|
||||
metaTbGroupCacheClear(pMeta, e.ctbEntry.suid);
|
||||
(void)metaUpdateStbStats(pMeta, e.ctbEntry.suid, -1, 0);
|
||||
(void)metaUidCacheClear(pMeta, e.ctbEntry.suid);
|
||||
(void)metaTbGroupCacheClear(pMeta, e.ctbEntry.suid);
|
||||
/*
|
||||
if (!TSDB_CACHE_NO(pMeta->pVnode->config)) {
|
||||
tsdbCacheDropTable(pMeta->pVnode->pTsdb, e.uid, e.ctbEntry.suid, NULL);
|
||||
|
@ -1341,16 +1342,16 @@ static int metaDropTableByUid(SMeta *pMeta, tb_uid_t uid, int *type, tb_uid_t *p
|
|||
}
|
||||
*/
|
||||
} else if (e.type == TSDB_SUPER_TABLE) {
|
||||
tdbTbDelete(pMeta->pSuidIdx, &e.uid, sizeof(tb_uid_t), pMeta->txn);
|
||||
(void)tdbTbDelete(pMeta->pSuidIdx, &e.uid, sizeof(tb_uid_t), pMeta->txn);
|
||||
// drop schema.db (todo)
|
||||
|
||||
metaStatsCacheDrop(pMeta, uid);
|
||||
metaUidCacheClear(pMeta, uid);
|
||||
metaTbGroupCacheClear(pMeta, uid);
|
||||
(void)metaStatsCacheDrop(pMeta, uid);
|
||||
(void)metaUidCacheClear(pMeta, uid);
|
||||
(void)metaTbGroupCacheClear(pMeta, uid);
|
||||
--pMeta->pVnode->config.vndStats.numOfSTables;
|
||||
}
|
||||
|
||||
metaCacheDrop(pMeta, uid);
|
||||
(void)metaCacheDrop(pMeta, uid);
|
||||
|
||||
tDecoderClear(&dc);
|
||||
tdbFree(pData);
|
||||
|
@ -1423,30 +1424,30 @@ static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAl
|
|||
// search uid index
|
||||
TBC *pUidIdxc = NULL;
|
||||
|
||||
tdbTbcOpen(pMeta->pUidIdx, &pUidIdxc, NULL);
|
||||
tdbTbcMoveTo(pUidIdxc, &uid, sizeof(uid), &c);
|
||||
(void)tdbTbcOpen(pMeta->pUidIdx, &pUidIdxc, NULL);
|
||||
(void)tdbTbcMoveTo(pUidIdxc, &uid, sizeof(uid), &c);
|
||||
if (c != 0) {
|
||||
tdbTbcClose(pUidIdxc);
|
||||
(void)tdbTbcClose(pUidIdxc);
|
||||
metaError("meta/table: invalide c: %" PRId32 " alt tb column failed.", c);
|
||||
return TSDB_CODE_FAILED;
|
||||
}
|
||||
|
||||
tdbTbcGet(pUidIdxc, NULL, NULL, &pData, &nData);
|
||||
(void)tdbTbcGet(pUidIdxc, NULL, NULL, &pData, &nData);
|
||||
oversion = ((SUidIdxVal *)pData)[0].version;
|
||||
|
||||
// search table.db
|
||||
TBC *pTbDbc = NULL;
|
||||
|
||||
tdbTbcOpen(pMeta->pTbDb, &pTbDbc, NULL);
|
||||
tdbTbcMoveTo(pTbDbc, &((STbDbKey){.uid = uid, .version = oversion}), sizeof(STbDbKey), &c);
|
||||
(void)tdbTbcOpen(pMeta->pTbDb, &pTbDbc, NULL);
|
||||
(void)tdbTbcMoveTo(pTbDbc, &((STbDbKey){.uid = uid, .version = oversion}), sizeof(STbDbKey), &c);
|
||||
if (c != 0) {
|
||||
tdbTbcClose(pUidIdxc);
|
||||
tdbTbcClose(pTbDbc);
|
||||
(void)tdbTbcClose(pUidIdxc);
|
||||
(void)tdbTbcClose(pTbDbc);
|
||||
metaError("meta/table: invalide c: %" PRId32 " alt tb column failed.", c);
|
||||
return TSDB_CODE_FAILED;
|
||||
}
|
||||
|
||||
tdbTbcGet(pTbDbc, NULL, NULL, &pData, &nData);
|
||||
(void)tdbTbcGet(pTbDbc, NULL, NULL, &pData, &nData);
|
||||
|
||||
// get table entry
|
||||
SDecoder dc = {0};
|
||||
|
@ -1455,8 +1456,8 @@ static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAl
|
|||
tDecoderInit(&dc, entry.pBuf, nData);
|
||||
ret = metaDecodeEntry(&dc, &entry);
|
||||
if (ret != 0) {
|
||||
tdbTbcClose(pUidIdxc);
|
||||
tdbTbcClose(pTbDbc);
|
||||
(void)tdbTbcClose(pUidIdxc);
|
||||
(void)tdbTbcClose(pTbDbc);
|
||||
tDecoderClear(&dc);
|
||||
metaError("meta/table: invalide ret: %" PRId32 " alt tb column failed.", ret);
|
||||
return ret;
|
||||
|
@ -1536,7 +1537,7 @@ static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAl
|
|||
SSchema *pCol = &pSchema->pSchema[entry.ntbEntry.schemaRow.nCols - 1];
|
||||
uint32_t compress = pAlterTbReq->action == TSDB_ALTER_TABLE_ADD_COLUMN ? createDefaultColCmprByType(pCol->type)
|
||||
: pAlterTbReq->compress;
|
||||
updataTableColCmpr(&entry.colCmpr, pCol, 1, compress);
|
||||
(void)updataTableColCmpr(&entry.colCmpr, pCol, 1, compress);
|
||||
freeColCmpr = true;
|
||||
ASSERT(entry.colCmpr.nCols == pSchema->nCols);
|
||||
break;
|
||||
|
@ -1574,7 +1575,7 @@ static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAl
|
|||
(void)tsdbCacheDropNTableColumn(pMeta->pVnode->pTsdb, entry.uid, cid, hasPrimayKey);
|
||||
}
|
||||
|
||||
updataTableColCmpr(&entry.colCmpr, &tScheam, 0, 0);
|
||||
(void)updataTableColCmpr(&entry.colCmpr, &tScheam, 0, 0);
|
||||
ASSERT(entry.colCmpr.nCols == pSchema->nCols);
|
||||
break;
|
||||
case TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES:
|
||||
|
@ -1620,20 +1621,20 @@ static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAl
|
|||
// do actual write
|
||||
metaWLock(pMeta);
|
||||
|
||||
metaDeleteNcolIdx(pMeta, &oldEntry);
|
||||
metaUpdateNcolIdx(pMeta, &entry);
|
||||
(void)metaDeleteNcolIdx(pMeta, &oldEntry);
|
||||
(void)metaUpdateNcolIdx(pMeta, &entry);
|
||||
// save to table db
|
||||
metaSaveToTbDb(pMeta, &entry);
|
||||
(void)metaSaveToTbDb(pMeta, &entry);
|
||||
|
||||
metaUpdateUidIdx(pMeta, &entry);
|
||||
(void)metaUpdateUidIdx(pMeta, &entry);
|
||||
|
||||
metaSaveToSkmDb(pMeta, &entry);
|
||||
(void)metaSaveToSkmDb(pMeta, &entry);
|
||||
|
||||
metaUpdateChangeTime(pMeta, entry.uid, pAlterTbReq->ctimeMs);
|
||||
(void)metaUpdateChangeTime(pMeta, entry.uid, pAlterTbReq->ctimeMs);
|
||||
|
||||
metaULock(pMeta);
|
||||
|
||||
metaUpdateMetaRsp(uid, pAlterTbReq->tbName, pSchema, pMetaRsp);
|
||||
(void)metaUpdateMetaRsp(uid, pAlterTbReq->tbName, pSchema, pMetaRsp);
|
||||
for (int32_t i = 0; i < entry.colCmpr.nCols; i++) {
|
||||
SColCmpr *p = &entry.colCmpr.pColCmpr[i];
|
||||
pMetaRsp->pSchemaExt[i].colId = p->id;
|
||||
|
@ -1644,16 +1645,16 @@ static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAl
|
|||
if (pNewSchema) taosMemoryFree(pNewSchema);
|
||||
if (freeColCmpr) taosMemoryFree(entry.colCmpr.pColCmpr);
|
||||
|
||||
tdbTbcClose(pTbDbc);
|
||||
tdbTbcClose(pUidIdxc);
|
||||
(void)tdbTbcClose(pTbDbc);
|
||||
(void)tdbTbcClose(pUidIdxc);
|
||||
tDecoderClear(&dc);
|
||||
|
||||
return 0;
|
||||
|
||||
_err:
|
||||
if (entry.pBuf) taosMemoryFree(entry.pBuf);
|
||||
tdbTbcClose(pTbDbc);
|
||||
tdbTbcClose(pUidIdxc);
|
||||
(void)tdbTbcClose(pTbDbc);
|
||||
(void)tdbTbcClose(pUidIdxc);
|
||||
tDecoderClear(&dc);
|
||||
|
||||
return TSDB_CODE_FAILED;
|
||||
|
@ -1688,15 +1689,15 @@ static int metaUpdateTableTagVal(SMeta *pMeta, int64_t version, SVAlterTbReq *pA
|
|||
// search uid index
|
||||
TBC *pUidIdxc = NULL;
|
||||
|
||||
tdbTbcOpen(pMeta->pUidIdx, &pUidIdxc, NULL);
|
||||
tdbTbcMoveTo(pUidIdxc, &uid, sizeof(uid), &c);
|
||||
(void)tdbTbcOpen(pMeta->pUidIdx, &pUidIdxc, NULL);
|
||||
(void)tdbTbcMoveTo(pUidIdxc, &uid, sizeof(uid), &c);
|
||||
if (c != 0) {
|
||||
tdbTbcClose(pUidIdxc);
|
||||
(void)tdbTbcClose(pUidIdxc);
|
||||
metaError("meta/table: invalide c: %" PRId32 " update tb tag val failed.", c);
|
||||
return terrno = TSDB_CODE_TDB_TABLE_NOT_EXIST;
|
||||
}
|
||||
|
||||
tdbTbcGet(pUidIdxc, NULL, NULL, &pData, &nData);
|
||||
(void)tdbTbcGet(pUidIdxc, NULL, NULL, &pData, &nData);
|
||||
oversion = ((SUidIdxVal *)pData)[0].version;
|
||||
|
||||
// search table.db
|
||||
|
@ -1705,34 +1706,34 @@ static int metaUpdateTableTagVal(SMeta *pMeta, int64_t version, SVAlterTbReq *pA
|
|||
SDecoder dc2 = {0};
|
||||
|
||||
/* get ctbEntry */
|
||||
tdbTbcOpen(pMeta->pTbDb, &pTbDbc, NULL);
|
||||
tdbTbcMoveTo(pTbDbc, &((STbDbKey){.uid = uid, .version = oversion}), sizeof(STbDbKey), &c);
|
||||
(void)tdbTbcOpen(pMeta->pTbDb, &pTbDbc, NULL);
|
||||
(void)tdbTbcMoveTo(pTbDbc, &((STbDbKey){.uid = uid, .version = oversion}), sizeof(STbDbKey), &c);
|
||||
if (c != 0) {
|
||||
tdbTbcClose(pUidIdxc);
|
||||
tdbTbcClose(pTbDbc);
|
||||
(void)tdbTbcClose(pUidIdxc);
|
||||
(void)tdbTbcClose(pTbDbc);
|
||||
metaError("meta/table: invalide c: %" PRId32 " update tb tag val failed.", c);
|
||||
return terrno = TSDB_CODE_TDB_TABLE_NOT_EXIST;
|
||||
}
|
||||
|
||||
tdbTbcGet(pTbDbc, NULL, NULL, &pData, &nData);
|
||||
(void)tdbTbcGet(pTbDbc, NULL, NULL, &pData, &nData);
|
||||
|
||||
ctbEntry.pBuf = taosMemoryMalloc(nData);
|
||||
memcpy(ctbEntry.pBuf, pData, nData);
|
||||
tDecoderInit(&dc1, ctbEntry.pBuf, nData);
|
||||
metaDecodeEntry(&dc1, &ctbEntry);
|
||||
(void)metaDecodeEntry(&dc1, &ctbEntry);
|
||||
|
||||
/* get stbEntry*/
|
||||
tdbTbGet(pMeta->pUidIdx, &ctbEntry.ctbEntry.suid, sizeof(tb_uid_t), &pVal, &nVal);
|
||||
(void)tdbTbGet(pMeta->pUidIdx, &ctbEntry.ctbEntry.suid, sizeof(tb_uid_t), &pVal, &nVal);
|
||||
if (!pVal) {
|
||||
terrno = TSDB_CODE_INVALID_MSG;
|
||||
goto _err;
|
||||
}
|
||||
|
||||
tdbTbGet(pMeta->pTbDb, &((STbDbKey){.uid = ctbEntry.ctbEntry.suid, .version = ((SUidIdxVal *)pVal)[0].version}),
|
||||
sizeof(STbDbKey), (void **)&stbEntry.pBuf, &nVal);
|
||||
(void)tdbTbGet(pMeta->pTbDb, &((STbDbKey){.uid = ctbEntry.ctbEntry.suid, .version = ((SUidIdxVal *)pVal)[0].version}),
|
||||
sizeof(STbDbKey), (void **)&stbEntry.pBuf, &nVal);
|
||||
tdbFree(pVal);
|
||||
tDecoderInit(&dc2, stbEntry.pBuf, nVal);
|
||||
metaDecodeEntry(&dc2, &stbEntry);
|
||||
(void)metaDecodeEntry(&dc2, &stbEntry);
|
||||
|
||||
SSchemaWrapper *pTagSchema = &stbEntry.stbEntry.schemaTag;
|
||||
SSchema *pColumn = NULL;
|
||||
|
@ -1802,12 +1803,12 @@ static int metaUpdateTableTagVal(SMeta *pMeta, int64_t version, SVAlterTbReq *pA
|
|||
metaWLock(pMeta);
|
||||
|
||||
// save to table.db
|
||||
metaSaveToTbDb(pMeta, &ctbEntry);
|
||||
(void)metaSaveToTbDb(pMeta, &ctbEntry);
|
||||
|
||||
// save to uid.idx
|
||||
metaUpdateUidIdx(pMeta, &ctbEntry);
|
||||
(void)metaUpdateUidIdx(pMeta, &ctbEntry);
|
||||
|
||||
metaUpdateTagIdx(pMeta, &ctbEntry);
|
||||
(void)metaUpdateTagIdx(pMeta, &ctbEntry);
|
||||
|
||||
if (NULL == ctbEntry.ctbEntry.pTags) {
|
||||
metaError("meta/table: null tags, update tag val failed.");
|
||||
|
@ -1815,13 +1816,13 @@ static int metaUpdateTableTagVal(SMeta *pMeta, int64_t version, SVAlterTbReq *pA
|
|||
}
|
||||
|
||||
SCtbIdxKey ctbIdxKey = {.suid = ctbEntry.ctbEntry.suid, .uid = uid};
|
||||
tdbTbUpsert(pMeta->pCtbIdx, &ctbIdxKey, sizeof(ctbIdxKey), ctbEntry.ctbEntry.pTags,
|
||||
((STag *)(ctbEntry.ctbEntry.pTags))->len, pMeta->txn);
|
||||
(void)tdbTbUpsert(pMeta->pCtbIdx, &ctbIdxKey, sizeof(ctbIdxKey), ctbEntry.ctbEntry.pTags,
|
||||
((STag *)(ctbEntry.ctbEntry.pTags))->len, pMeta->txn);
|
||||
|
||||
metaUidCacheClear(pMeta, ctbEntry.ctbEntry.suid);
|
||||
metaTbGroupCacheClear(pMeta, ctbEntry.ctbEntry.suid);
|
||||
(void)metaUidCacheClear(pMeta, ctbEntry.ctbEntry.suid);
|
||||
(void)metaTbGroupCacheClear(pMeta, ctbEntry.ctbEntry.suid);
|
||||
|
||||
metaUpdateChangeTime(pMeta, ctbEntry.uid, pAlterTbReq->ctimeMs);
|
||||
(void)metaUpdateChangeTime(pMeta, ctbEntry.uid, pAlterTbReq->ctimeMs);
|
||||
|
||||
metaULock(pMeta);
|
||||
|
||||
|
@ -1830,8 +1831,8 @@ static int metaUpdateTableTagVal(SMeta *pMeta, int64_t version, SVAlterTbReq *pA
|
|||
taosMemoryFree((void *)ctbEntry.ctbEntry.pTags);
|
||||
if (ctbEntry.pBuf) taosMemoryFree(ctbEntry.pBuf);
|
||||
if (stbEntry.pBuf) tdbFree(stbEntry.pBuf);
|
||||
tdbTbcClose(pTbDbc);
|
||||
tdbTbcClose(pUidIdxc);
|
||||
(void)tdbTbcClose(pTbDbc);
|
||||
(void)tdbTbcClose(pUidIdxc);
|
||||
return 0;
|
||||
|
||||
_err:
|
||||
|
@ -1839,8 +1840,8 @@ _err:
|
|||
tDecoderClear(&dc2);
|
||||
if (ctbEntry.pBuf) taosMemoryFree(ctbEntry.pBuf);
|
||||
if (stbEntry.pBuf) tdbFree(stbEntry.pBuf);
|
||||
tdbTbcClose(pTbDbc);
|
||||
tdbTbcClose(pUidIdxc);
|
||||
(void)tdbTbcClose(pTbDbc);
|
||||
(void)tdbTbcClose(pUidIdxc);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1868,30 +1869,30 @@ static int metaUpdateTableOptions(SMeta *pMeta, int64_t version, SVAlterTbReq *p
|
|||
// search uid index
|
||||
TBC *pUidIdxc = NULL;
|
||||
|
||||
tdbTbcOpen(pMeta->pUidIdx, &pUidIdxc, NULL);
|
||||
tdbTbcMoveTo(pUidIdxc, &uid, sizeof(uid), &c);
|
||||
(void)tdbTbcOpen(pMeta->pUidIdx, &pUidIdxc, NULL);
|
||||
(void)tdbTbcMoveTo(pUidIdxc, &uid, sizeof(uid), &c);
|
||||
if (c != 0) {
|
||||
tdbTbcClose(pUidIdxc);
|
||||
(void)tdbTbcClose(pUidIdxc);
|
||||
metaError("meta/table: invalide c: %" PRId32 " update tb options failed.", c);
|
||||
return TSDB_CODE_FAILED;
|
||||
}
|
||||
|
||||
tdbTbcGet(pUidIdxc, NULL, NULL, &pData, &nData);
|
||||
(void)tdbTbcGet(pUidIdxc, NULL, NULL, &pData, &nData);
|
||||
oversion = ((SUidIdxVal *)pData)[0].version;
|
||||
|
||||
// search table.db
|
||||
TBC *pTbDbc = NULL;
|
||||
|
||||
tdbTbcOpen(pMeta->pTbDb, &pTbDbc, NULL);
|
||||
tdbTbcMoveTo(pTbDbc, &((STbDbKey){.uid = uid, .version = oversion}), sizeof(STbDbKey), &c);
|
||||
(void)tdbTbcOpen(pMeta->pTbDb, &pTbDbc, NULL);
|
||||
(void)tdbTbcMoveTo(pTbDbc, &((STbDbKey){.uid = uid, .version = oversion}), sizeof(STbDbKey), &c);
|
||||
if (c != 0) {
|
||||
tdbTbcClose(pUidIdxc);
|
||||
tdbTbcClose(pTbDbc);
|
||||
(void)tdbTbcClose(pUidIdxc);
|
||||
(void)tdbTbcClose(pTbDbc);
|
||||
metaError("meta/table: invalide c: %" PRId32 " update tb options failed.", c);
|
||||
return TSDB_CODE_FAILED;
|
||||
}
|
||||
|
||||
tdbTbcGet(pTbDbc, NULL, NULL, &pData, &nData);
|
||||
(void)tdbTbcGet(pTbDbc, NULL, NULL, &pData, &nData);
|
||||
|
||||
// get table entry
|
||||
SDecoder dc = {0};
|
||||
|
@ -1901,8 +1902,8 @@ static int metaUpdateTableOptions(SMeta *pMeta, int64_t version, SVAlterTbReq *p
|
|||
ret = metaDecodeEntry(&dc, &entry);
|
||||
if (ret != 0) {
|
||||
tDecoderClear(&dc);
|
||||
tdbTbcClose(pUidIdxc);
|
||||
tdbTbcClose(pTbDbc);
|
||||
(void)tdbTbcClose(pUidIdxc);
|
||||
(void)tdbTbcClose(pTbDbc);
|
||||
metaError("meta/table: invalide ret: %" PRId32 " alt tb options failed.", ret);
|
||||
return TSDB_CODE_FAILED;
|
||||
}
|
||||
|
@ -1912,9 +1913,9 @@ static int metaUpdateTableOptions(SMeta *pMeta, int64_t version, SVAlterTbReq *p
|
|||
// build SMetaEntry
|
||||
if (entry.type == TSDB_CHILD_TABLE) {
|
||||
if (pAlterTbReq->updateTTL) {
|
||||
metaDeleteTtl(pMeta, &entry);
|
||||
(void)metaDeleteTtl(pMeta, &entry);
|
||||
entry.ctbEntry.ttlDays = pAlterTbReq->newTTL;
|
||||
metaUpdateTtl(pMeta, &entry);
|
||||
(void)metaUpdateTtl(pMeta, &entry);
|
||||
}
|
||||
if (pAlterTbReq->newCommentLen >= 0) {
|
||||
entry.ctbEntry.commentLen = pAlterTbReq->newCommentLen;
|
||||
|
@ -1922,9 +1923,9 @@ static int metaUpdateTableOptions(SMeta *pMeta, int64_t version, SVAlterTbReq *p
|
|||
}
|
||||
} else {
|
||||
if (pAlterTbReq->updateTTL) {
|
||||
metaDeleteTtl(pMeta, &entry);
|
||||
(void)metaDeleteTtl(pMeta, &entry);
|
||||
entry.ntbEntry.ttlDays = pAlterTbReq->newTTL;
|
||||
metaUpdateTtl(pMeta, &entry);
|
||||
(void)metaUpdateTtl(pMeta, &entry);
|
||||
}
|
||||
if (pAlterTbReq->newCommentLen >= 0) {
|
||||
entry.ntbEntry.commentLen = pAlterTbReq->newCommentLen;
|
||||
|
@ -1933,14 +1934,14 @@ static int metaUpdateTableOptions(SMeta *pMeta, int64_t version, SVAlterTbReq *p
|
|||
}
|
||||
|
||||
// save to table db
|
||||
metaSaveToTbDb(pMeta, &entry);
|
||||
metaUpdateUidIdx(pMeta, &entry);
|
||||
metaUpdateChangeTime(pMeta, entry.uid, pAlterTbReq->ctimeMs);
|
||||
(void)metaSaveToTbDb(pMeta, &entry);
|
||||
(void)metaUpdateUidIdx(pMeta, &entry);
|
||||
(void)metaUpdateChangeTime(pMeta, entry.uid, pAlterTbReq->ctimeMs);
|
||||
|
||||
metaULock(pMeta);
|
||||
|
||||
tdbTbcClose(pTbDbc);
|
||||
tdbTbcClose(pUidIdxc);
|
||||
(void)tdbTbcClose(pTbDbc);
|
||||
(void)tdbTbcClose(pUidIdxc);
|
||||
tDecoderClear(&dc);
|
||||
if (entry.pBuf) taosMemoryFree(entry.pBuf);
|
||||
return 0;
|
||||
|
@ -1981,7 +1982,7 @@ static int metaAddTagIndex(SMeta *pMeta, int64_t version, SVAlterTbReq *pAlterTb
|
|||
STbDbKey tbDbKey = {0};
|
||||
tbDbKey.uid = suid;
|
||||
tbDbKey.version = ((SUidIdxVal *)pVal)[0].version;
|
||||
tdbTbGet(pMeta->pTbDb, &tbDbKey, sizeof(tbDbKey), &pVal, &nVal);
|
||||
(void)tdbTbGet(pMeta->pTbDb, &tbDbKey, sizeof(tbDbKey), &pVal, &nVal);
|
||||
tDecoderInit(&dc, pVal, nVal);
|
||||
ret = metaDecodeEntry(&dc, &stbEntry);
|
||||
if (ret < 0) {
|
||||
|
@ -2017,10 +2018,10 @@ static int metaAddTagIndex(SMeta *pMeta, int64_t version, SVAlterTbReq *pAlterTb
|
|||
* iterator all pTdDbc by uid and version
|
||||
*/
|
||||
TBC *pCtbIdxc = NULL;
|
||||
tdbTbcOpen(pMeta->pCtbIdx, &pCtbIdxc, NULL);
|
||||
(void)tdbTbcOpen(pMeta->pCtbIdx, &pCtbIdxc, NULL);
|
||||
int rc = tdbTbcMoveTo(pCtbIdxc, &(SCtbIdxKey){.suid = suid, .uid = INT64_MIN}, sizeof(SCtbIdxKey), &c);
|
||||
if (rc < 0) {
|
||||
tdbTbcClose(pCtbIdxc);
|
||||
(void)tdbTbcClose(pCtbIdxc);
|
||||
goto _err;
|
||||
}
|
||||
for (;;) {
|
||||
|
@ -2057,14 +2058,14 @@ static int metaAddTagIndex(SMeta *pMeta, int64_t version, SVAlterTbReq *pAlterTb
|
|||
tdbFree(pKey);
|
||||
tdbFree(pVal);
|
||||
metaDestroyTagIdxKey(pTagIdxKey);
|
||||
tdbTbcClose(pCtbIdxc);
|
||||
(void)tdbTbcClose(pCtbIdxc);
|
||||
goto _err;
|
||||
}
|
||||
tdbTbUpsert(pMeta->pTagIdx, pTagIdxKey, nTagIdxKey, NULL, 0, pMeta->txn);
|
||||
(void)tdbTbUpsert(pMeta->pTagIdx, pTagIdxKey, nTagIdxKey, NULL, 0, pMeta->txn);
|
||||
metaDestroyTagIdxKey(pTagIdxKey);
|
||||
pTagIdxKey = NULL;
|
||||
}
|
||||
tdbTbcClose(pCtbIdxc);
|
||||
(void)tdbTbcClose(pCtbIdxc);
|
||||
return 0;
|
||||
|
||||
_err:
|
||||
|
@ -2115,7 +2116,7 @@ static int metaDropTagIndex(SMeta *pMeta, int64_t version, SVAlterTbReq *pAlterT
|
|||
STbDbKey tbDbKey = {0};
|
||||
tbDbKey.uid = suid;
|
||||
tbDbKey.version = ((SUidIdxVal *)pVal)[0].version;
|
||||
tdbTbGet(pMeta->pTbDb, &tbDbKey, sizeof(tbDbKey), &pVal, &nVal);
|
||||
(void)tdbTbGet(pMeta->pTbDb, &tbDbKey, sizeof(tbDbKey), &pVal, &nVal);
|
||||
|
||||
tDecoderInit(&dc, pVal, nVal);
|
||||
ret = metaDecodeEntry(&dc, &stbEntry);
|
||||
|
@ -2156,7 +2157,7 @@ static int metaDropTagIndex(SMeta *pMeta, int64_t version, SVAlterTbReq *pAlterT
|
|||
SArray *tagIdxList = taosArrayInit(512, sizeof(SMetaPair));
|
||||
|
||||
TBC *pTagIdxc = NULL;
|
||||
tdbTbcOpen(pMeta->pTagIdx, &pTagIdxc, NULL);
|
||||
(void)tdbTbcOpen(pMeta->pTagIdx, &pTagIdxc, NULL);
|
||||
int rc =
|
||||
tdbTbcMoveTo(pTagIdxc, &(STagIdxKey){.suid = suid, .cid = INT32_MIN, .type = pCol->type}, sizeof(STagIdxKey), &c);
|
||||
for (;;) {
|
||||
|
@ -2173,12 +2174,12 @@ static int metaDropTagIndex(SMeta *pMeta, int64_t version, SVAlterTbReq *pAlterT
|
|||
SMetaPair pair = {.key = pKey, nKey = nKey};
|
||||
(void)taosArrayPush(tagIdxList, &pair);
|
||||
}
|
||||
tdbTbcClose(pTagIdxc);
|
||||
(void)tdbTbcClose(pTagIdxc);
|
||||
|
||||
metaWLock(pMeta);
|
||||
for (int i = 0; i < taosArrayGetSize(tagIdxList); i++) {
|
||||
SMetaPair *pair = taosArrayGet(tagIdxList, i);
|
||||
tdbTbDelete(pMeta->pTagIdx, pair->key, pair->nkey, pMeta->txn);
|
||||
(void)tdbTbDelete(pMeta->pTagIdx, pair->key, pair->nkey, pMeta->txn);
|
||||
}
|
||||
metaULock(pMeta);
|
||||
|
||||
|
@ -2265,9 +2266,9 @@ int32_t metaUpdateTableColCompress(SMeta *pMeta, int64_t version, SVAlterTbReq *
|
|||
tbEntry.version = version;
|
||||
|
||||
metaWLock(pMeta);
|
||||
metaSaveToTbDb(pMeta, &tbEntry);
|
||||
metaUpdateUidIdx(pMeta, &tbEntry);
|
||||
metaUpdateChangeTime(pMeta, suid, pReq->ctimeMs);
|
||||
(void)metaSaveToTbDb(pMeta, &tbEntry);
|
||||
(void)metaUpdateUidIdx(pMeta, &tbEntry);
|
||||
(void)metaUpdateChangeTime(pMeta, suid, pReq->ctimeMs);
|
||||
|
||||
metaULock(pMeta);
|
||||
|
||||
|
@ -2362,7 +2363,7 @@ static int metaUpdateUidIdx(SMeta *pMeta, const SMetaEntry *pME) {
|
|||
// upsert cache
|
||||
SMetaInfo info;
|
||||
metaGetEntryInfo(pME, &info);
|
||||
metaCacheUpsert(pMeta, &info);
|
||||
(void)metaCacheUpsert(pMeta, &info);
|
||||
|
||||
SUidIdxVal uidIdxVal = {.suid = info.suid, .version = info.version, .skmVer = info.skmVer};
|
||||
|
||||
|
@ -2478,7 +2479,7 @@ static int metaUpdateTagIdx(SMeta *pMeta, const SMetaEntry *pCtbEntry) {
|
|||
}
|
||||
tbDbKey.uid = pCtbEntry->ctbEntry.suid;
|
||||
tbDbKey.version = ((SUidIdxVal *)pData)[0].version;
|
||||
tdbTbGet(pMeta->pTbDb, &tbDbKey, sizeof(tbDbKey), &pData, &nData);
|
||||
(void)tdbTbGet(pMeta->pTbDb, &tbDbKey, sizeof(tbDbKey), &pData, &nData);
|
||||
|
||||
tDecoderInit(&dc, pData, nData);
|
||||
ret = metaDecodeEntry(&dc, &stbEntry);
|
||||
|
@ -2525,7 +2526,7 @@ static int metaUpdateTagIdx(SMeta *pMeta, const SMetaEntry *pCtbEntry) {
|
|||
ret = -1;
|
||||
goto end;
|
||||
}
|
||||
tdbTbUpsert(pMeta->pTagIdx, pTagIdxKey, nTagIdxKey, NULL, 0, pMeta->txn);
|
||||
(void)tdbTbUpsert(pMeta->pTagIdx, pTagIdxKey, nTagIdxKey, NULL, 0, pMeta->txn);
|
||||
metaDestroyTagIdxKey(pTagIdxKey);
|
||||
pTagIdxKey = NULL;
|
||||
}
|
||||
|
@ -2574,7 +2575,7 @@ static int metaSaveToSkmDb(SMeta *pMeta, const SMetaEntry *pME) {
|
|||
}
|
||||
|
||||
tEncoderInit(&coder, pVal, vLen);
|
||||
tEncodeSSchemaWrapper(&coder, pSW);
|
||||
(void)tEncodeSSchemaWrapper(&coder, pSW);
|
||||
|
||||
if (tdbTbInsert(pMeta->pSkmDb, &skmDbKey, sizeof(skmDbKey), pVal, vLen, pMeta->txn) < 0) {
|
||||
rcode = -1;
|
||||
|
@ -2662,7 +2663,7 @@ int32_t colCompressDebug(SHashObj *pColCmprObj) {
|
|||
p = taosHashIterate(pColCmprObj, p);
|
||||
|
||||
uint8_t l1, l2, lvl;
|
||||
tcompressDebug(cmprAlg, &l1, &l2, &lvl);
|
||||
(void)tcompressDebug(cmprAlg, &l1, &l2, &lvl);
|
||||
|
||||
const char *l1str = columnEncodeStr(l1);
|
||||
const char *l2str = columnCompressStr(l2);
|
||||
|
@ -2711,7 +2712,7 @@ int32_t metaGetColCmpr(SMeta *pMeta, tb_uid_t uid, SHashObj **ppColCmprObj) {
|
|||
SColCmprWrapper *p = &e.colCmpr;
|
||||
for (int32_t i = 0; i < p->nCols; i++) {
|
||||
SColCmpr *pCmpr = &p->pColCmpr[i];
|
||||
taosHashPut(pColCmprObj, &pCmpr->id, sizeof(pCmpr->id), &pCmpr->alg, sizeof(pCmpr->alg));
|
||||
(void)taosHashPut(pColCmprObj, &pCmpr->id, sizeof(pCmpr->id), &pCmpr->alg, sizeof(pCmpr->alg));
|
||||
}
|
||||
} else {
|
||||
tDecoderClear(&dc);
|
||||
|
@ -2725,7 +2726,7 @@ int32_t metaGetColCmpr(SMeta *pMeta, tb_uid_t uid, SHashObj **ppColCmprObj) {
|
|||
metaULock(pMeta);
|
||||
|
||||
*ppColCmprObj = pColCmprObj;
|
||||
colCompressDebug(pColCmprObj);
|
||||
(void)colCompressDebug(pColCmprObj);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -257,7 +257,7 @@ static int32_t tdProcessRSmaAsyncPostCommitImpl(SSma *pSma) {
|
|||
if (RSMA_INFO_IS_DEL(pRSmaInfo)) {
|
||||
int32_t refVal = T_REF_VAL_GET(pRSmaInfo);
|
||||
if (refVal == 0) {
|
||||
taosHashRemove(RSMA_INFO_HASH(pRSmaStat), pSuid, sizeof(*pSuid));
|
||||
(void)taosHashRemove(RSMA_INFO_HASH(pRSmaStat), pSuid, sizeof(*pSuid));
|
||||
} else {
|
||||
smaDebug(
|
||||
"vgId:%d, rsma async post commit, not free rsma info since ref is %d although already deleted for "
|
||||
|
|
|
@ -46,7 +46,7 @@ int32_t smaInit() {
|
|||
old = atomic_val_compare_exchange_8(&smaMgmt.inited, 0, 2);
|
||||
if (old != 2) break;
|
||||
if (++nLoops > 1000) {
|
||||
sched_yield();
|
||||
(void)sched_yield();
|
||||
nLoops = 0;
|
||||
}
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ int32_t smaInit() {
|
|||
|
||||
if (!smaMgmt.refHash || !smaMgmt.tmrHandle) {
|
||||
code = terrno;
|
||||
taosCloseRef(smaMgmt.rsetId);
|
||||
(void)taosCloseRef(smaMgmt.rsetId);
|
||||
if (smaMgmt.refHash) {
|
||||
taosHashCleanup(smaMgmt.refHash);
|
||||
smaMgmt.refHash = NULL;
|
||||
|
@ -97,7 +97,7 @@ void smaCleanUp() {
|
|||
old = atomic_val_compare_exchange_8(&smaMgmt.inited, 1, 2);
|
||||
if (old != 2) break;
|
||||
if (++nLoops > 1000) {
|
||||
sched_yield();
|
||||
(void)sched_yield();
|
||||
nLoops = 0;
|
||||
}
|
||||
}
|
||||
|
@ -130,7 +130,7 @@ static int32_t tdNewSmaEnv(SSma *pSma, int8_t smaType, SSmaEnv **ppEnv) {
|
|||
: atomic_store_ptr(&SMA_RSMA_ENV(pSma), *ppEnv);
|
||||
|
||||
if ((code = tdInitSmaStat(&SMA_ENV_STAT(pEnv), smaType, pSma)) != TSDB_CODE_SUCCESS) {
|
||||
tdFreeSmaEnv(pEnv);
|
||||
(void)tdFreeSmaEnv(pEnv);
|
||||
*ppEnv = NULL;
|
||||
(smaType == TSDB_SMA_TYPE_TIME_RANGE) ? atomic_store_ptr(&SMA_TSMA_ENV(pSma), NULL)
|
||||
: atomic_store_ptr(&SMA_RSMA_ENV(pSma), NULL);
|
||||
|
@ -179,7 +179,7 @@ static void tRSmaInfoHashFreeNode(void *data) {
|
|||
if ((pItem = RSMA_INFO_ITEM((SRSmaInfo *)pRSmaInfo, 1)) && pItem->level) {
|
||||
(void)taosHashRemove(smaMgmt.refHash, &pItem, POINTER_BYTES);
|
||||
}
|
||||
tdFreeRSmaInfo(pRSmaInfo->pSma, pRSmaInfo);
|
||||
(void)tdFreeRSmaInfo(pRSmaInfo->pSma, pRSmaInfo);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -207,7 +207,7 @@ static int32_t tdInitSmaStat(SSmaStat **pSmaStat, int8_t smaType, const SSma *pS
|
|||
SRSmaStat *pRSmaStat = (SRSmaStat *)(*pSmaStat);
|
||||
pRSmaStat->pSma = (SSma *)pSma;
|
||||
atomic_store_8(RSMA_TRIGGER_STAT(pRSmaStat), TASK_TRIGGER_STAT_INIT);
|
||||
tsem_init(&pRSmaStat->notEmpty, 0, 0);
|
||||
(void)tsem_init(&pRSmaStat->notEmpty, 0, 0);
|
||||
if (!(pRSmaStat->blocks = taosArrayInit(1, sizeof(SSDataBlock)))) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
TAOS_CHECK_GOTO(code, &lino, _exit);
|
||||
|
@ -216,7 +216,7 @@ static int32_t tdInitSmaStat(SSmaStat **pSmaStat, int8_t smaType, const SSma *pS
|
|||
(void)taosArrayPush(pRSmaStat->blocks, &datablock);
|
||||
|
||||
// init smaMgmt
|
||||
smaInit();
|
||||
TAOS_CHECK_GOTO(smaInit(), &lino, _exit);
|
||||
|
||||
int64_t refId = taosAddRef(smaMgmt.rsetId, pRSmaStat);
|
||||
if (refId < 0) {
|
||||
|
@ -285,20 +285,20 @@ static void tdDestroyRSmaStat(void *pRSmaStat) {
|
|||
}
|
||||
|
||||
// step 3:
|
||||
tdRsmaStopExecutor(pSma);
|
||||
(void)tdRsmaStopExecutor(pSma);
|
||||
|
||||
// step 4: destroy the rsma info and associated fetch tasks
|
||||
taosHashCleanup(RSMA_INFO_HASH(pStat));
|
||||
|
||||
// step 5: free pStat
|
||||
tsem_destroy(&(pStat->notEmpty));
|
||||
(void)tsem_destroy(&(pStat->notEmpty));
|
||||
taosArrayDestroy(pStat->blocks);
|
||||
taosMemoryFreeClear(pStat);
|
||||
}
|
||||
}
|
||||
|
||||
static void *tdFreeSmaState(SSmaStat *pSmaStat, int8_t smaType) {
|
||||
tdDestroySmaState(pSmaStat, smaType);
|
||||
(void)tdDestroySmaState(pSmaStat, smaType);
|
||||
if (smaType == TSDB_SMA_TYPE_TIME_RANGE) {
|
||||
taosMemoryFreeClear(pSmaStat);
|
||||
}
|
||||
|
@ -438,7 +438,7 @@ static int32_t tdRsmaStopExecutor(const SSma *pSma) {
|
|||
pthread = (TdThread *)&pStat->data;
|
||||
|
||||
for (int32_t i = 0; i < tsNumOfVnodeRsmaThreads; ++i) {
|
||||
tsem_post(&(pRSmaStat->notEmpty));
|
||||
(void)tsem_post(&(pRSmaStat->notEmpty));
|
||||
}
|
||||
|
||||
for (int32_t i = 0; i < tsNumOfVnodeRsmaThreads; ++i) {
|
||||
|
|
|
@ -412,7 +412,7 @@ int32_t tdRSmaProcessCreateImpl(SSma *pSma, SRSmaParam *param, int64_t suid, con
|
|||
|
||||
_exit:
|
||||
if (code != 0) {
|
||||
tdFreeRSmaInfo(pSma, pRSmaInfo);
|
||||
(void)tdFreeRSmaInfo(pSma, pRSmaInfo);
|
||||
} else {
|
||||
smaDebug("vgId:%d, register rsma info succeed for table %" PRIi64, SMA_VID(pSma), suid);
|
||||
}
|
||||
|
@ -1264,7 +1264,7 @@ _checkpoint:
|
|||
if (pItem && pItem->pStreamTask) {
|
||||
SStreamTask *pTask = pItem->pStreamTask;
|
||||
// atomic_store_32(&pTask->pMeta->chkptNotReadyTasks, 1);
|
||||
streamTaskSetActiveCheckpointInfo(pTask, checkpointId);
|
||||
(void)streamTaskSetActiveCheckpointInfo(pTask, checkpointId);
|
||||
|
||||
pTask->chkInfo.checkpointId = checkpointId; // 1pTask->checkpointingId;
|
||||
pTask->chkInfo.checkpointVer = pItem->submitReqVer;
|
||||
|
@ -1373,7 +1373,7 @@ static void tdRSmaFetchTrigger(void *param, void *tmrId) {
|
|||
", rsetId:%d refId:%" PRIi64,
|
||||
SMA_VID(pSma), pItem->level, rsmaTriggerStat, smaMgmt.rsetId, pRSmaRef->refId);
|
||||
if (rsmaTriggerStat == TASK_TRIGGER_STAT_PAUSED) {
|
||||
taosTmrReset(tdRSmaFetchTrigger, RSMA_FETCH_INTERVAL, pItem, smaMgmt.tmrHandle, &pItem->tmrId);
|
||||
(void)taosTmrReset(tdRSmaFetchTrigger, RSMA_FETCH_INTERVAL, pItem, smaMgmt.tmrHandle, &pItem->tmrId);
|
||||
}
|
||||
tdReleaseRSmaInfo(pSma, pRSmaInfo);
|
||||
(void)tdReleaseSmaRef(smaMgmt.rsetId, pRSmaRef->refId);
|
||||
|
@ -1629,7 +1629,7 @@ int32_t tdRSmaProcessExecImpl(SSma *pSma, ERsmaExecType type) {
|
|||
batchMax = TMAX(batchMax, 4);
|
||||
}
|
||||
while (occupied || (++batchCnt < batchMax)) { // greedy mode
|
||||
taosReadAllQitems(pInfo->queue, pInfo->qall); // queue has mutex lock
|
||||
(void)taosReadAllQitems(pInfo->queue, pInfo->qall); // queue has mutex lock
|
||||
int32_t qallItemSize = taosQallItemSize(pInfo->qall);
|
||||
if (qallItemSize > 0) {
|
||||
if ((code = tdRSmaBatchExec(pSma, pInfo, pInfo->qall, pSubmitArr, type)) != 0) {
|
||||
|
@ -1663,7 +1663,7 @@ int32_t tdRSmaProcessExecImpl(SSma *pSma, ERsmaExecType type) {
|
|||
}
|
||||
|
||||
if (qallItemSize > 0) {
|
||||
atomic_fetch_sub_64(&pRSmaStat->nBufItems, qallItemSize);
|
||||
(void)atomic_fetch_sub_64(&pRSmaStat->nBufItems, qallItemSize);
|
||||
continue;
|
||||
}
|
||||
if (RSMA_NEED_FETCH(pInfo)) {
|
||||
|
@ -1673,7 +1673,7 @@ int32_t tdRSmaProcessExecImpl(SSma *pSma, ERsmaExecType type) {
|
|||
break;
|
||||
}
|
||||
}
|
||||
atomic_val_compare_exchange_8(&pInfo->assigned, 1, 0);
|
||||
(void)atomic_val_compare_exchange_8(&pInfo->assigned, 1, 0);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -123,7 +123,7 @@ static int32_t tdProcessTSmaCreateImpl(SSma *pSma, int64_t ver, const char *pMsg
|
|||
TAOS_CHECK_EXIT(metaCreateTSma(SMA_META(pSma), ver, pCfg));
|
||||
|
||||
// create stable to save tsma result in dstVgId
|
||||
tNameFromString(&stbFullName, pCfg->dstTbName, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE);
|
||||
(void)tNameFromString(&stbFullName, pCfg->dstTbName, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE);
|
||||
pReq.name = (char *)tNameGetTableName(&stbFullName);
|
||||
pReq.suid = pCfg->dstTbUid;
|
||||
pReq.schemaRow = pCfg->schemaRow;
|
||||
|
@ -283,7 +283,7 @@ static int32_t tsmaProcessDelReq(SSma *pSma, int64_t indexUid, SBatchDeleteReq *
|
|||
|
||||
SEncoder encoder;
|
||||
tEncoderInit(&encoder, POINTER_SHIFT(pBuf, sizeof(SMsgHead)), len);
|
||||
tEncodeSBatchDeleteReq(&encoder, pDelReq);
|
||||
(void)tEncodeSBatchDeleteReq(&encoder, pDelReq);
|
||||
tEncoderClear(&encoder);
|
||||
|
||||
((SMsgHead *)pBuf)->vgId = TD_VID(pSma->pVnode);
|
||||
|
|
|
@ -169,7 +169,7 @@ void tqPushEmptyDataRsp(STqHandle* pHandle, int32_t vgId) {
|
|||
}
|
||||
dataRsp.common.blockNum = 0;
|
||||
char buf[TSDB_OFFSET_LEN] = {0};
|
||||
tFormatOffset(buf, TSDB_OFFSET_LEN, &dataRsp.common.reqOffset);
|
||||
(void) tFormatOffset(buf, TSDB_OFFSET_LEN, &dataRsp.common.reqOffset);
|
||||
tqInfo("tqPushEmptyDataRsp to consumer:0x%" PRIx64 " vgId:%d, offset:%s, reqId:0x%" PRIx64, req.consumerId, vgId, buf,
|
||||
req.reqId);
|
||||
|
||||
|
@ -187,8 +187,8 @@ int32_t tqSendDataRsp(STqHandle* pHandle, const SRpcMsg* pMsg, const SMqPollReq*
|
|||
|
||||
char buf1[TSDB_OFFSET_LEN] = {0};
|
||||
char buf2[TSDB_OFFSET_LEN] = {0};
|
||||
tFormatOffset(buf1, TSDB_OFFSET_LEN, &((SMqDataRspCommon*)pRsp)->reqOffset);
|
||||
tFormatOffset(buf2, TSDB_OFFSET_LEN, &((SMqDataRspCommon*)pRsp)->rspOffset);
|
||||
(void) tFormatOffset(buf1, TSDB_OFFSET_LEN, &((SMqDataRspCommon*)pRsp)->reqOffset);
|
||||
(void) tFormatOffset(buf2, TSDB_OFFSET_LEN, &((SMqDataRspCommon*)pRsp)->rspOffset);
|
||||
|
||||
tqDebug("tmq poll vgId:%d consumer:0x%" PRIx64 " (epoch %d) send rsp, block num:%d, req:%s, rsp:%s, reqId:0x%" PRIx64,
|
||||
vgId, pReq->consumerId, pReq->epoch, ((SMqDataRspCommon*)pRsp)->blockNum, buf1, buf2, pReq->reqId);
|
||||
|
@ -412,7 +412,7 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg) {
|
|||
}
|
||||
|
||||
char buf[TSDB_OFFSET_LEN] = {0};
|
||||
tFormatOffset(buf, TSDB_OFFSET_LEN, &reqOffset);
|
||||
(void) tFormatOffset(buf, TSDB_OFFSET_LEN, &reqOffset);
|
||||
tqDebug("tmq poll: consumer:0x%" PRIx64 " (epoch %d), subkey %s, recv poll req vgId:%d, req:%s, reqId:0x%" PRIx64,
|
||||
consumerId, req.epoch, pHandle->subKey, vgId, buf, req.reqId);
|
||||
|
||||
|
@ -745,7 +745,7 @@ int32_t tqBuildStreamTask(void* pTqObj, SStreamTask* pTask, int64_t nextProcessV
|
|||
}
|
||||
|
||||
streamTaskResetUpstreamStageInfo(pTask);
|
||||
streamSetupScheduleTrigger(pTask);
|
||||
(void) streamSetupScheduleTrigger(pTask);
|
||||
|
||||
SCheckpointInfo* pChkInfo = &pTask->chkInfo;
|
||||
tqSetRestoreVersionInfo(pTask);
|
||||
|
@ -801,8 +801,11 @@ static void doStartFillhistoryStep2(SStreamTask* pTask, SStreamTask* pStreamTask
|
|||
if (done) {
|
||||
qDebug("s-task:%s scan wal(step 2) verRange:%" PRId64 "-%" PRId64 " ended, elapsed time:%.2fs", id, pStep2Range->minVer,
|
||||
pStep2Range->maxVer, 0.0);
|
||||
streamTaskPutTranstateIntoInputQ(pTask);
|
||||
streamExecTask(pTask); // exec directly
|
||||
int32_t code = streamTaskPutTranstateIntoInputQ(pTask); // todo: msg lost.
|
||||
if (code) {
|
||||
qError("s-task:%s failed put trans-state into inputQ, code:%s", id, tstrerror(code));
|
||||
}
|
||||
(void) streamExecTask(pTask); // exec directly
|
||||
} else {
|
||||
STimeWindow* pWindow = &pTask->dataRange.window;
|
||||
tqDebug("s-task:%s level:%d verRange:%" PRId64 "-%" PRId64 " window:%" PRId64 "-%" PRId64
|
||||
|
@ -811,7 +814,10 @@ static void doStartFillhistoryStep2(SStreamTask* pTask, SStreamTask* pStreamTask
|
|||
pStreamTask->id.idStr);
|
||||
ASSERT(pTask->status.schedStatus == TASK_SCHED_STATUS__WAITING);
|
||||
|
||||
streamSetParamForStreamScannerStep2(pTask, pStep2Range, pWindow);
|
||||
int32_t code = streamSetParamForStreamScannerStep2(pTask, pStep2Range, pWindow);
|
||||
if (code) {
|
||||
tqError("s-task:%s level:%d failed to set step2 param", id, pTask->info.taskLevel);
|
||||
}
|
||||
|
||||
int64_t dstVer = pStep2Range->minVer;
|
||||
pTask->chkInfo.nextProcessVer = dstVer;
|
||||
|
@ -820,12 +826,12 @@ static void doStartFillhistoryStep2(SStreamTask* pTask, SStreamTask* pStreamTask
|
|||
tqDebug("s-task:%s wal reader start scan WAL verRange:%" PRId64 "-%" PRId64 ", set sched-status:%d", id, dstVer,
|
||||
pStep2Range->maxVer, TASK_SCHED_STATUS__INACTIVE);
|
||||
|
||||
/*int8_t status = */ streamTaskSetSchedStatusInactive(pTask);
|
||||
(void) streamTaskSetSchedStatusInactive(pTask);
|
||||
|
||||
// now the fill-history task starts to scan data from wal files.
|
||||
int32_t code = streamTaskHandleEvent(pTask->status.pSM, TASK_EVENT_SCANHIST_DONE);
|
||||
code = streamTaskHandleEvent(pTask->status.pSM, TASK_EVENT_SCANHIST_DONE);
|
||||
if (code == TSDB_CODE_SUCCESS) {
|
||||
tqScanWalAsync(pTq, false);
|
||||
(void) tqScanWalAsync(pTq, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -949,11 +955,11 @@ int32_t tqProcessTaskScanHistory(STQ* pTq, SRpcMsg* pMsg) {
|
|||
pTask->streamTaskId.taskId, pTask->id.idStr);
|
||||
|
||||
tqDebug("s-task:%s fill-history task set status to be dropping", id);
|
||||
streamBuildAndSendDropTaskMsg(pTask->pMsgCb, pMeta->vgId, &pTask->id, 0);
|
||||
code = streamBuildAndSendDropTaskMsg(pTask->pMsgCb, pMeta->vgId, &pTask->id, 0);
|
||||
|
||||
atomic_store_32(&pTask->status.inScanHistorySentinel, 0);
|
||||
streamMetaReleaseTask(pMeta, pTask);
|
||||
return -1;
|
||||
return code; // todo: handle failure
|
||||
}
|
||||
|
||||
ASSERT(pStreamTask->info.taskLevel == TASK_LEVEL__SOURCE);
|
||||
|
@ -971,15 +977,14 @@ int32_t tqProcessTaskRunReq(STQ* pTq, SRpcMsg* pMsg) {
|
|||
|
||||
// extracted submit data from wal files for all tasks
|
||||
if (pReq->reqType == STREAM_EXEC_T_EXTRACT_WAL_DATA) {
|
||||
tqScanWal(pTq);
|
||||
return 0;
|
||||
return tqScanWal(pTq);
|
||||
}
|
||||
|
||||
int32_t code = tqStreamTaskProcessRunReq(pTq->pStreamMeta, pMsg, vnodeIsRoleLeader(pTq->pVnode));
|
||||
|
||||
// let's continue scan data in the wal files
|
||||
if (code == 0 && (pReq->reqType >= 0 || pReq->reqType == STREAM_EXEC_T_RESUME_TASK)) {
|
||||
tqScanWalAsync(pTq, false);
|
||||
(void) tqScanWalAsync(pTq, false); // it's ok to failed
|
||||
}
|
||||
|
||||
return code;
|
||||
|
@ -1044,7 +1049,11 @@ int32_t tqStreamProgressRetrieveReq(STQ *pTq, SRpcMsg *pMsg) {
|
|||
pRsp->subFetchIdx = req.subFetchIdx;
|
||||
pRsp->vgId = req.vgId;
|
||||
pRsp->streamId = req.streamId;
|
||||
tSerializeStreamProgressRsp(pRsp, sizeof(SStreamProgressRsp) + sizeof(SMsgHead), pRsp);
|
||||
code = tSerializeStreamProgressRsp(pRsp, sizeof(SStreamProgressRsp) + sizeof(SMsgHead), pRsp);
|
||||
if (code) {
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
SRpcMsg rsp = {.info = pMsg->info, .code = 0};
|
||||
rsp.pCont = pRspBuf;
|
||||
pRspBuf = NULL;
|
||||
|
@ -1079,18 +1088,18 @@ int32_t tqProcessTaskCheckPointSourceReq(STQ* pTq, SRpcMsg* pMsg, SRpcMsg* pRsp)
|
|||
tqError("vgId:%d failed to decode checkpoint-source msg, code:%s", vgId, tstrerror(code));
|
||||
|
||||
SRpcMsg rsp = {0};
|
||||
streamTaskBuildCheckpointSourceRsp(&req, &pMsg->info, &rsp, TSDB_CODE_SUCCESS);
|
||||
(void) streamTaskBuildCheckpointSourceRsp(&req, &pMsg->info, &rsp, TSDB_CODE_SUCCESS);
|
||||
tmsgSendRsp(&rsp); // error occurs
|
||||
return code;
|
||||
return TSDB_CODE_SUCCESS; // always return success to mnode, todo: handle failure of build and send msg to mnode
|
||||
}
|
||||
tDecoderClear(&decoder);
|
||||
|
||||
if (!vnodeIsRoleLeader(pTq->pVnode)) {
|
||||
tqDebug("vgId:%d not leader, ignore checkpoint-source msg, s-task:0x%x", vgId, req.taskId);
|
||||
SRpcMsg rsp = {0};
|
||||
streamTaskBuildCheckpointSourceRsp(&req, &pMsg->info, &rsp, TSDB_CODE_SUCCESS);
|
||||
(void) streamTaskBuildCheckpointSourceRsp(&req, &pMsg->info, &rsp, TSDB_CODE_SUCCESS);
|
||||
tmsgSendRsp(&rsp); // error occurs
|
||||
return TSDB_CODE_SUCCESS;
|
||||
return TSDB_CODE_SUCCESS; // always return success to mnode, todo: handle failure of build and send msg to mnode
|
||||
}
|
||||
|
||||
if (!pTq->pVnode->restored) {
|
||||
|
@ -1098,9 +1107,9 @@ int32_t tqProcessTaskCheckPointSourceReq(STQ* pTq, SRpcMsg* pMsg, SRpcMsg* pRsp)
|
|||
", transId:%d s-task:0x%x ignore it",
|
||||
vgId, req.checkpointId, req.transId, req.taskId);
|
||||
SRpcMsg rsp = {0};
|
||||
streamTaskBuildCheckpointSourceRsp(&req, &pMsg->info, &rsp, TSDB_CODE_SUCCESS);
|
||||
(void) streamTaskBuildCheckpointSourceRsp(&req, &pMsg->info, &rsp, TSDB_CODE_SUCCESS);
|
||||
tmsgSendRsp(&rsp); // error occurs
|
||||
return TSDB_CODE_SUCCESS;
|
||||
return TSDB_CODE_SUCCESS; // always return success to mnode, , todo: handle failure of build and send msg to mnode
|
||||
}
|
||||
|
||||
SStreamTask* pTask = NULL;
|
||||
|
@ -1110,7 +1119,7 @@ int32_t tqProcessTaskCheckPointSourceReq(STQ* pTq, SRpcMsg* pMsg, SRpcMsg* pRsp)
|
|||
" transId:%d it may have been destroyed",
|
||||
vgId, req.taskId, req.checkpointId, req.transId);
|
||||
SRpcMsg rsp = {0};
|
||||
streamTaskBuildCheckpointSourceRsp(&req, &pMsg->info, &rsp, TSDB_CODE_SUCCESS);
|
||||
(void) streamTaskBuildCheckpointSourceRsp(&req, &pMsg->info, &rsp, TSDB_CODE_SUCCESS);
|
||||
tmsgSendRsp(&rsp); // error occurs
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
@ -1123,13 +1132,13 @@ int32_t tqProcessTaskCheckPointSourceReq(STQ* pTq, SRpcMsg* pMsg, SRpcMsg* pRsp)
|
|||
streamMetaReleaseTask(pMeta, pTask);
|
||||
|
||||
SRpcMsg rsp = {0};
|
||||
streamTaskBuildCheckpointSourceRsp(&req, &pMsg->info, &rsp, TSDB_CODE_SUCCESS);
|
||||
(void) streamTaskBuildCheckpointSourceRsp(&req, &pMsg->info, &rsp, TSDB_CODE_SUCCESS);
|
||||
tmsgSendRsp(&rsp); // error occurs
|
||||
return TSDB_CODE_SUCCESS;
|
||||
return TSDB_CODE_SUCCESS; // todo retry handle error
|
||||
}
|
||||
|
||||
// todo save the checkpoint failed info
|
||||
taosThreadMutexLock(&pTask->lock);
|
||||
streamMutexLock(&pTask->lock);
|
||||
ETaskStatus status = streamTaskGetStatus(pTask).state;
|
||||
|
||||
if (req.mndTrigger == 1) {
|
||||
|
@ -1137,13 +1146,12 @@ int32_t tqProcessTaskCheckPointSourceReq(STQ* pTq, SRpcMsg* pMsg, SRpcMsg* pRsp)
|
|||
tqError("s-task:%s not ready for checkpoint, since it is halt, ignore checkpointId:%" PRId64 ", set it failure",
|
||||
pTask->id.idStr, req.checkpointId);
|
||||
|
||||
taosThreadMutexUnlock(&pTask->lock);
|
||||
streamMutexUnlock(&pTask->lock);
|
||||
streamMetaReleaseTask(pMeta, pTask);
|
||||
|
||||
SRpcMsg rsp = {0};
|
||||
streamTaskBuildCheckpointSourceRsp(&req, &pMsg->info, &rsp, TSDB_CODE_SUCCESS);
|
||||
(void) streamTaskBuildCheckpointSourceRsp(&req, &pMsg->info, &rsp, TSDB_CODE_SUCCESS);
|
||||
tmsgSendRsp(&rsp); // error occurs
|
||||
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
} else {
|
||||
|
@ -1162,7 +1170,7 @@ int32_t tqProcessTaskCheckPointSourceReq(STQ* pTq, SRpcMsg* pMsg, SRpcMsg* pRsp)
|
|||
" transId:%d already handled, ignore msg and continue process checkpoint",
|
||||
pTask->id.idStr, checkpointId, req.transId);
|
||||
|
||||
taosThreadMutexUnlock(&pTask->lock);
|
||||
streamMutexUnlock(&pTask->lock);
|
||||
streamMetaReleaseTask(pMeta, pTask);
|
||||
|
||||
return TSDB_CODE_SUCCESS;
|
||||
|
@ -1171,19 +1179,24 @@ int32_t tqProcessTaskCheckPointSourceReq(STQ* pTq, SRpcMsg* pMsg, SRpcMsg* pRsp)
|
|||
tqWarn("s-task:%s repeatly recv checkpoint-source msg checkpointId:%" PRId64
|
||||
" transId:%d already handled, return success", pTask->id.idStr, req.checkpointId, req.transId);
|
||||
|
||||
taosThreadMutexUnlock(&pTask->lock);
|
||||
streamMutexUnlock(&pTask->lock);
|
||||
streamMetaReleaseTask(pMeta, pTask);
|
||||
|
||||
SRpcMsg rsp = {0};
|
||||
streamTaskBuildCheckpointSourceRsp(&req, &pMsg->info, &rsp, TSDB_CODE_SUCCESS);
|
||||
(void) streamTaskBuildCheckpointSourceRsp(&req, &pMsg->info, &rsp, TSDB_CODE_SUCCESS);
|
||||
tmsgSendRsp(&rsp); // error occurs
|
||||
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
streamProcessCheckpointSourceReq(pTask, &req);
|
||||
taosThreadMutexUnlock(&pTask->lock);
|
||||
code = streamProcessCheckpointSourceReq(pTask, &req);
|
||||
streamMutexUnlock(&pTask->lock);
|
||||
|
||||
if (code) {
|
||||
qError("s-task:%s (vgId:%d) failed to process checkpoint-source req, code:%s", pTask->id.idStr, vgId, tstrerror(code));
|
||||
return code;
|
||||
}
|
||||
|
||||
if (req.mndTrigger) {
|
||||
qInfo("s-task:%s (vgId:%d) level:%d receive checkpoint-source msg chkpt:%" PRId64 ", transId:%d, ", pTask->id.idStr,
|
||||
|
@ -1198,13 +1211,13 @@ int32_t tqProcessTaskCheckPointSourceReq(STQ* pTq, SRpcMsg* pMsg, SRpcMsg* pRsp)
|
|||
code = streamAddCheckpointSourceRspMsg(&req, &pMsg->info, pTask);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
SRpcMsg rsp = {0};
|
||||
streamTaskBuildCheckpointSourceRsp(&req, &pMsg->info, &rsp, TSDB_CODE_SUCCESS);
|
||||
(void) streamTaskBuildCheckpointSourceRsp(&req, &pMsg->info, &rsp, TSDB_CODE_SUCCESS);
|
||||
tmsgSendRsp(&rsp); // error occurs
|
||||
return code;
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
streamMetaReleaseTask(pMeta, pTask);
|
||||
return code;
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
// downstream task has complete the stream task checkpoint procedure, let's start the handle the rsp by execute task
|
||||
|
|
|
@ -115,14 +115,15 @@ int32_t tqScanData(STQ* pTq, STqHandle* pHandle, SMqDataRsp* pRsp, STqOffsetVal*
|
|||
if (pDataBlock == NULL) {
|
||||
break;
|
||||
}
|
||||
|
||||
STqOffsetVal offset = {0};
|
||||
qStreamExtractOffset(task, &offset);
|
||||
code = qStreamExtractOffset(task, &offset);
|
||||
TSDB_CHECK_CODE(code, line, END);
|
||||
|
||||
pHandle->block = NULL;
|
||||
|
||||
code = createOneDataBlock(pDataBlock, true, &pHandle->block);
|
||||
if (code) {
|
||||
return code;
|
||||
}
|
||||
TSDB_CHECK_CODE(code, line, END);
|
||||
|
||||
pHandle->blockTime = offset.ts;
|
||||
tOffsetDestroy(&offset);
|
||||
|
@ -140,8 +141,11 @@ int32_t tqScanData(STQ* pTq, STqHandle* pHandle, SMqDataRsp* pRsp, STqOffsetVal*
|
|||
} else {
|
||||
code = copyDataBlock(pHandle->block, pDataBlock);
|
||||
TSDB_CHECK_CODE(code, line, END);
|
||||
|
||||
STqOffsetVal offset = {0};
|
||||
qStreamExtractOffset(task, &offset);
|
||||
code = qStreamExtractOffset(task, &offset);
|
||||
TSDB_CHECK_CODE(code, line, END);
|
||||
|
||||
pRsp->sleepTime = offset.ts - pHandle->blockTime;
|
||||
pHandle->blockTime = offset.ts;
|
||||
tOffsetDestroy(&offset);
|
||||
|
@ -164,10 +168,11 @@ int32_t tqScanData(STQ* pTq, STqHandle* pHandle, SMqDataRsp* pRsp, STqOffsetVal*
|
|||
|
||||
tqDebug("consumer:0x%" PRIx64 " vgId:%d tmq task executed finished, total blocks:%d, totalRows:%d",
|
||||
pHandle->consumerId, vgId, pRsp->common.blockNum, totalRows);
|
||||
qStreamExtractOffset(task, &pRsp->common.rspOffset);
|
||||
code = qStreamExtractOffset(task, &pRsp->common.rspOffset);
|
||||
END:
|
||||
if ( code!= 0){
|
||||
tqError("consumer:0x%" PRIx64 " vgId:%d tmq task executed error, line:%d code:%d", pHandle->consumerId, vgId, line, code);
|
||||
if (code != 0) {
|
||||
tqError("consumer:0x%" PRIx64 " vgId:%d tmq task executed error, line:%d code:%d", pHandle->consumerId, vgId, line,
|
||||
code);
|
||||
}
|
||||
return code;
|
||||
}
|
||||
|
@ -241,31 +246,40 @@ int32_t tqScanTaosx(STQ* pTq, const STqHandle* pHandle, STaosxRsp* pRsp, SMqBatc
|
|||
// get meta
|
||||
SMqBatchMetaRsp* tmp = qStreamExtractMetaMsg(task);
|
||||
if (taosArrayGetSize(tmp->batchMetaReq) > 0) {
|
||||
qStreamExtractOffset(task, &tmp->rspOffset);
|
||||
code = qStreamExtractOffset(task, &tmp->rspOffset);
|
||||
if (code) {
|
||||
return code;
|
||||
}
|
||||
|
||||
*pBatchMetaRsp = *tmp;
|
||||
tqDebug("tmqsnap task get meta");
|
||||
break;
|
||||
}
|
||||
|
||||
if (pDataBlock == NULL) {
|
||||
qStreamExtractOffset(task, pOffset);
|
||||
code = qStreamExtractOffset(task, pOffset);
|
||||
if (code) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (pOffset->type == TMQ_OFFSET__SNAPSHOT_DATA) {
|
||||
continue;
|
||||
}
|
||||
|
||||
tqDebug("tmqsnap vgId: %d, tsdb consume over, switch to wal, ver %" PRId64, TD_VID(pTq->pVnode),
|
||||
pHandle->snapshotVer + 1);
|
||||
qStreamExtractOffset(task, &pRsp->common.rspOffset);
|
||||
code = qStreamExtractOffset(task, &pRsp->common.rspOffset);
|
||||
break;
|
||||
}
|
||||
|
||||
if (pRsp->common.blockNum > 0) {
|
||||
tqDebug("tmqsnap task exec exited, get data");
|
||||
qStreamExtractOffset(task, &pRsp->common.rspOffset);
|
||||
code = qStreamExtractOffset(task, &pRsp->common.rspOffset);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
return code;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -39,19 +39,21 @@ int32_t streamTaskSnapReaderOpen(STQ* pTq, int64_t sver, int64_t ever, SStreamTa
|
|||
// alloc
|
||||
pReader = (SStreamTaskReader*)taosMemoryCalloc(1, sizeof(SStreamTaskReader));
|
||||
if (pReader == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
goto _err;
|
||||
TAOS_CHECK_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
}
|
||||
pReader->pTq = pTq;
|
||||
pReader->sver = sver;
|
||||
pReader->ever = ever;
|
||||
pReader->tdbTbList = taosArrayInit(4, sizeof(STablePair));
|
||||
if (pReader->tdbTbList == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _err);
|
||||
}
|
||||
|
||||
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};
|
||||
taosArrayPush(pReader->tdbTbList, &pair2);
|
||||
(void)taosArrayPush(pReader->tdbTbList, &pair2);
|
||||
|
||||
pReader->pos = 0;
|
||||
|
||||
|
@ -60,16 +62,14 @@ int32_t streamTaskSnapReaderOpen(STQ* pTq, int64_t sver, int64_t ever, SStreamTa
|
|||
if (code) {
|
||||
tqInfo("vgId:%d, vnode stream-task snapshot reader failed to open, reason: %s", TD_VID(pTq->pVnode),
|
||||
tstrerror(code));
|
||||
taosMemoryFree(pReader);
|
||||
goto _err;
|
||||
TAOS_CHECK_GOTO(code, NULL, _err);
|
||||
}
|
||||
|
||||
code = tdbTbcMoveToFirst(pReader->pCur);
|
||||
if (code) {
|
||||
tqInfo("vgId:%d, vnode stream-task snapshot reader failed to iterate, reason: %s", TD_VID(pTq->pVnode),
|
||||
tstrerror(code));
|
||||
taosMemoryFree(pReader);
|
||||
goto _err;
|
||||
TAOS_CHECK_GOTO(code, NULL, _err);
|
||||
}
|
||||
|
||||
tqDebug("vgId:%d, vnode stream-task snapshot reader opened", TD_VID(pTq->pVnode));
|
||||
|
@ -79,15 +79,18 @@ int32_t streamTaskSnapReaderOpen(STQ* pTq, int64_t sver, int64_t ever, SStreamTa
|
|||
|
||||
_err:
|
||||
tqError("vgId:%d, vnode stream-task snapshot reader open failed since %s", TD_VID(pTq->pVnode), tstrerror(code));
|
||||
(void)streamTaskSnapReaderClose(pReader);
|
||||
*ppReader = NULL;
|
||||
return code;
|
||||
}
|
||||
|
||||
int32_t streamTaskSnapReaderClose(SStreamTaskReader* pReader) {
|
||||
if (pReader == NULL) return 0;
|
||||
|
||||
int32_t code = 0;
|
||||
tqInfo("vgId:%d, vnode stream-task snapshot reader closed", TD_VID(pReader->pTq->pVnode));
|
||||
taosArrayDestroy(pReader->tdbTbList);
|
||||
tdbTbcClose(pReader->pCur);
|
||||
(void)tdbTbcClose(pReader->pCur);
|
||||
taosMemoryFree(pReader);
|
||||
return code;
|
||||
}
|
||||
|
@ -116,20 +119,24 @@ NextTbl:
|
|||
break;
|
||||
} else {
|
||||
pVal = taosMemoryCalloc(1, tLen);
|
||||
if (pVal == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
goto _err;
|
||||
}
|
||||
memcpy(pVal, tVal, tLen);
|
||||
vLen = tLen;
|
||||
}
|
||||
tdbTbcMoveToNext(pReader->pCur);
|
||||
(void)tdbTbcMoveToNext(pReader->pCur);
|
||||
break;
|
||||
}
|
||||
if (except == 1) {
|
||||
if (pReader->pos + 1 < taosArrayGetSize(pReader->tdbTbList)) {
|
||||
tdbTbcClose(pReader->pCur);
|
||||
(void)tdbTbcClose(pReader->pCur);
|
||||
|
||||
pReader->pos += 1;
|
||||
pPair = taosArrayGet(pReader->tdbTbList, pReader->pos);
|
||||
code = tdbTbcOpen(pPair->tbl, &pReader->pCur, NULL);
|
||||
tdbTbcMoveToFirst(pReader->pCur);
|
||||
(void)tdbTbcMoveToFirst(pReader->pCur);
|
||||
|
||||
goto NextTbl;
|
||||
}
|
||||
|
@ -174,8 +181,7 @@ int32_t streamTaskSnapWriterOpen(STQ* pTq, int64_t sver, int64_t ever, SStreamTa
|
|||
// alloc
|
||||
pWriter = (SStreamTaskWriter*)taosMemoryCalloc(1, sizeof(*pWriter));
|
||||
if (pWriter == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
goto _err;
|
||||
TAOS_CHECK_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
}
|
||||
pWriter->pTq = pTq;
|
||||
pWriter->sver = sver;
|
||||
|
@ -184,12 +190,6 @@ int32_t streamTaskSnapWriterOpen(STQ* pTq, int64_t sver, int64_t ever, SStreamTa
|
|||
*ppWriter = pWriter;
|
||||
tqDebug("vgId:%d, vnode stream-task snapshot writer opened", TD_VID(pTq->pVnode));
|
||||
return code;
|
||||
|
||||
_err:
|
||||
tqError("vgId:%d, vnode stream-task snapshot writer failed to write since %s", TD_VID(pTq->pVnode), tstrerror(code));
|
||||
*ppWriter = NULL;
|
||||
return code;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t streamTaskSnapWriterClose(SStreamTaskWriter* pWriter, int8_t rollback) {
|
||||
|
@ -199,7 +199,7 @@ int32_t streamTaskSnapWriterClose(SStreamTaskWriter* pWriter, int8_t rollback) {
|
|||
streamMetaWLock(pTq->pStreamMeta);
|
||||
tqDebug("vgId:%d, vnode stream-task snapshot writer closed", TD_VID(pTq->pVnode));
|
||||
if (rollback) {
|
||||
tdbAbort(pTq->pStreamMeta->db, pTq->pStreamMeta->txn);
|
||||
(void)tdbAbort(pTq->pStreamMeta->db, pTq->pStreamMeta->txn);
|
||||
} else {
|
||||
code = tdbCommit(pTq->pStreamMeta->db, pTq->pStreamMeta->txn);
|
||||
if (code) goto _err;
|
||||
|
@ -207,8 +207,7 @@ int32_t streamTaskSnapWriterClose(SStreamTaskWriter* pWriter, int8_t rollback) {
|
|||
if (code) goto _err;
|
||||
}
|
||||
|
||||
if (tdbBegin(pTq->pStreamMeta->db, &pTq->pStreamMeta->txn, tdbDefaultMalloc, tdbDefaultFree, NULL, 0) < 0) {
|
||||
code = -1;
|
||||
if ((code = tdbBegin(pTq->pStreamMeta->db, &pTq->pStreamMeta->txn, tdbDefaultMalloc, tdbDefaultFree, NULL, 0)) < 0) {
|
||||
taosMemoryFree(pWriter);
|
||||
goto _err;
|
||||
}
|
||||
|
@ -241,10 +240,11 @@ int32_t streamTaskSnapWrite(SStreamTaskWriter* pWriter, uint8_t* pData, uint32_t
|
|||
|
||||
int64_t key[2] = {taskId.streamId, taskId.taskId};
|
||||
streamMetaWLock(pTq->pStreamMeta);
|
||||
if (tdbTbUpsert(pTq->pStreamMeta->pTaskDb, key, sizeof(int64_t) << 1, (uint8_t*)pData + sizeof(SSnapDataHdr),
|
||||
nData - sizeof(SSnapDataHdr), pTq->pStreamMeta->txn) < 0) {
|
||||
if ((code =
|
||||
tdbTbUpsert(pTq->pStreamMeta->pTaskDb, key, sizeof(int64_t) << 1, (uint8_t*)pData + sizeof(SSnapDataHdr),
|
||||
nData - sizeof(SSnapDataHdr), pTq->pStreamMeta->txn)) < 0) {
|
||||
streamMetaWUnLock(pTq->pStreamMeta);
|
||||
return -1;
|
||||
return code;
|
||||
}
|
||||
streamMetaWUnLock(pTq->pStreamMeta);
|
||||
} else if (pHdr->type == SNAP_DATA_STREAM_TASK_CHECKPOINT) {
|
||||
|
|
|
@ -117,7 +117,7 @@ typedef struct {
|
|||
|
||||
static void tsdbGetRocksPath(STsdb *pTsdb, char *path) {
|
||||
SVnode *pVnode = pTsdb->pVnode;
|
||||
vnodeGetPrimaryDir(pTsdb->path, pVnode->diskPrimary, pVnode->pTfs, path, TSDB_FILENAME_LEN);
|
||||
(void)vnodeGetPrimaryDir(pTsdb->path, pVnode->diskPrimary, pVnode->pTfs, path, TSDB_FILENAME_LEN);
|
||||
|
||||
int32_t offset = strlen(path);
|
||||
snprintf(path + offset, TSDB_FILENAME_LEN - offset - 1, "%scache.rdb", TD_DIRSEP);
|
||||
|
@ -722,20 +722,14 @@ static int32_t tsdbCacheDropTableColumn(STsdb *pTsdb, int64_t uid, int16_t cid,
|
|||
rocksdb_writebatch_t *wb = pTsdb->rCache.writebatch;
|
||||
{
|
||||
SLastCol *pLastCol = NULL;
|
||||
code = tsdbCacheDeserialize(values_list[0], values_list_sizes[0], &pLastCol);
|
||||
if (code) {
|
||||
tsdbError("tsdb/cache: vgId:%d, deserialize failed since %s.", TD_VID(pTsdb->pVnode), tstrerror(code));
|
||||
}
|
||||
(void)tsdbCacheDeserialize(values_list[0], values_list_sizes[0], &pLastCol);
|
||||
if (NULL != pLastCol) {
|
||||
rocksdb_writebatch_delete(wb, keys_list[0], klen);
|
||||
}
|
||||
taosMemoryFreeClear(pLastCol);
|
||||
|
||||
pLastCol = NULL;
|
||||
code = tsdbCacheDeserialize(values_list[1], values_list_sizes[1], &pLastCol);
|
||||
if (code) {
|
||||
tsdbError("tsdb/cache: vgId:%d, deserialize failed since %s.", TD_VID(pTsdb->pVnode), tstrerror(code));
|
||||
}
|
||||
(void)tsdbCacheDeserialize(values_list[1], values_list_sizes[1], &pLastCol);
|
||||
if (NULL != pLastCol) {
|
||||
rocksdb_writebatch_delete(wb, keys_list[1], klen);
|
||||
}
|
||||
|
@ -748,7 +742,7 @@ static int32_t tsdbCacheDropTableColumn(STsdb *pTsdb, int64_t uid, int16_t cid,
|
|||
LRUHandle *h = taosLRUCacheLookup(pTsdb->lruCache, keys_list[0], klen);
|
||||
if (h) {
|
||||
erase = true;
|
||||
taosLRUCacheRelease(pTsdb->lruCache, h, erase);
|
||||
(void)taosLRUCacheRelease(pTsdb->lruCache, h, erase);
|
||||
}
|
||||
if (erase) {
|
||||
taosLRUCacheErase(pTsdb->lruCache, keys_list[0], klen);
|
||||
|
@ -758,7 +752,7 @@ static int32_t tsdbCacheDropTableColumn(STsdb *pTsdb, int64_t uid, int16_t cid,
|
|||
h = taosLRUCacheLookup(pTsdb->lruCache, keys_list[1], klen);
|
||||
if (h) {
|
||||
erase = true;
|
||||
taosLRUCacheRelease(pTsdb->lruCache, h, erase);
|
||||
(void)taosLRUCacheRelease(pTsdb->lruCache, h, erase);
|
||||
}
|
||||
if (erase) {
|
||||
taosLRUCacheErase(pTsdb->lruCache, keys_list[1], klen);
|
||||
|
@ -1066,12 +1060,12 @@ static int32_t tsdbCacheUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, SArray
|
|||
if (cmp_res < 0 || (cmp_res == 0 && !COL_VAL_IS_NONE(pColVal))) {
|
||||
tsdbCacheUpdateLastCol(pLastCol, pRowKey, pColVal);
|
||||
}
|
||||
taosLRUCacheRelease(pCache, h, false);
|
||||
(void)taosLRUCacheRelease(pCache, h, false);
|
||||
} else {
|
||||
if (!remainCols) {
|
||||
remainCols = taosArrayInit(num_keys * 2, sizeof(SIdxKey));
|
||||
}
|
||||
taosArrayPush(remainCols, &(SIdxKey){i, *key});
|
||||
(void)taosArrayPush(remainCols, &(SIdxKey){i, *key});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1123,10 +1117,12 @@ static int32_t tsdbCacheUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, SArray
|
|||
SColVal *pColVal = &updCtx->colVal;
|
||||
|
||||
SLastCol *pLastCol = NULL;
|
||||
code = tsdbCacheDeserialize(values_list[i], values_list_sizes[i], &pLastCol);
|
||||
(void)tsdbCacheDeserialize(values_list[i], values_list_sizes[i], &pLastCol);
|
||||
/*
|
||||
if (code) {
|
||||
tsdbError("tsdb/cache: vgId:%d, deserialize failed since %s.", TD_VID(pTsdb->pVnode), tstrerror(code));
|
||||
}
|
||||
*/
|
||||
SLastCol *PToFree = pLastCol;
|
||||
|
||||
if (IS_LAST_KEY(idxKey->key) && !COL_VAL_IS_VALUE(pColVal)) {
|
||||
|
@ -1242,18 +1238,18 @@ int32_t tsdbCacheRowFormatUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, int6
|
|||
tsdbRowGetKey(&lRow, &tsdbRowKey);
|
||||
|
||||
STSDBRowIter iter = {0};
|
||||
tsdbRowIterOpen(&iter, &lRow, pTSchema);
|
||||
(void)tsdbRowIterOpen(&iter, &lRow, pTSchema);
|
||||
int32_t iCol = 0;
|
||||
for (SColVal *pColVal = tsdbRowIterNext(&iter); pColVal && iCol < nCol; pColVal = tsdbRowIterNext(&iter), iCol++) {
|
||||
SLastUpdateCtx updateCtx = {.lflag = LFLAG_LAST_ROW, .tsdbRowKey = tsdbRowKey, .colVal = *pColVal};
|
||||
taosArrayPush(ctxArray, &updateCtx);
|
||||
(void)taosArrayPush(ctxArray, &updateCtx);
|
||||
|
||||
if (!COL_VAL_IS_VALUE(pColVal)) {
|
||||
tSimpleHashPut(iColHash, &iCol, sizeof(iCol), NULL, 0);
|
||||
(void)tSimpleHashPut(iColHash, &iCol, sizeof(iCol), NULL, 0);
|
||||
continue;
|
||||
}
|
||||
updateCtx.lflag = LFLAG_LAST;
|
||||
taosArrayPush(ctxArray, &updateCtx);
|
||||
(void)taosArrayPush(ctxArray, &updateCtx);
|
||||
}
|
||||
tsdbRowClose(&iter);
|
||||
|
||||
|
@ -1277,14 +1273,14 @@ int32_t tsdbCacheRowFormatUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, int6
|
|||
|
||||
if (COL_VAL_IS_VALUE(&colVal)) {
|
||||
SLastUpdateCtx updateCtx = {.lflag = LFLAG_LAST, .tsdbRowKey = tsdbRowKey, .colVal = colVal};
|
||||
taosArrayPush(ctxArray, &updateCtx);
|
||||
tSimpleHashIterateRemove(iColHash, &iCol, sizeof(iCol), &pIte, &iter);
|
||||
(void)taosArrayPush(ctxArray, &updateCtx);
|
||||
(void)tSimpleHashIterateRemove(iColHash, &iCol, sizeof(iCol), &pIte, &iter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 3. do update
|
||||
tsdbCacheUpdate(pTsdb, suid, uid, ctxArray);
|
||||
(void)tsdbCacheUpdate(pTsdb, suid, uid, ctxArray);
|
||||
|
||||
_exit:
|
||||
taosMemoryFreeClear(pTSchema);
|
||||
|
@ -1317,7 +1313,7 @@ int32_t tsdbCacheColFormatUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, SBlo
|
|||
.tsdbRowKey = tsdbRowKey,
|
||||
.colVal = COL_VAL_VALUE(PRIMARYKEY_TIMESTAMP_COL_ID, ((SValue){.type = TSDB_DATA_TYPE_TIMESTAMP,
|
||||
.val = lRow.pBlockData->aTSKEY[lRow.iRow]}))};
|
||||
taosArrayPush(ctxArray, &updateCtx);
|
||||
(void)taosArrayPush(ctxArray, &updateCtx);
|
||||
}
|
||||
|
||||
TSDBROW tRow = tsdbRowFromBlockData(pBlockData, 0);
|
||||
|
@ -1338,7 +1334,7 @@ int32_t tsdbCacheColFormatUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, SBlo
|
|||
tColDataGetValue(pColData, tRow.iRow, &colVal);
|
||||
|
||||
SLastUpdateCtx updateCtx = {.lflag = LFLAG_LAST, .tsdbRowKey = tsdbRowKey, .colVal = colVal};
|
||||
taosArrayPush(ctxArray, &updateCtx);
|
||||
(void)taosArrayPush(ctxArray, &updateCtx);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1346,15 +1342,15 @@ int32_t tsdbCacheColFormatUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, SBlo
|
|||
|
||||
// 2. prepare last row
|
||||
STSDBRowIter iter = {0};
|
||||
tsdbRowIterOpen(&iter, &lRow, pTSchema);
|
||||
(void)tsdbRowIterOpen(&iter, &lRow, pTSchema);
|
||||
for (SColVal *pColVal = tsdbRowIterNext(&iter); pColVal; pColVal = tsdbRowIterNext(&iter)) {
|
||||
SLastUpdateCtx updateCtx = {.lflag = LFLAG_LAST_ROW, .tsdbRowKey = tsdbRowKey, .colVal = *pColVal};
|
||||
taosArrayPush(ctxArray, &updateCtx);
|
||||
(void)taosArrayPush(ctxArray, &updateCtx);
|
||||
}
|
||||
tsdbRowClose(&iter);
|
||||
|
||||
// 3. do update
|
||||
tsdbCacheUpdate(pTsdb, suid, uid, ctxArray);
|
||||
(void)tsdbCacheUpdate(pTsdb, suid, uid, ctxArray);
|
||||
|
||||
_exit:
|
||||
taosMemoryFreeClear(pTSchema);
|
||||
|
@ -1379,7 +1375,7 @@ static int32_t tsdbCacheLoadFromRaw(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArr
|
|||
if (idxKey->key.cid != PRIMARYKEY_TIMESTAMP_COL_ID) {
|
||||
SLastKey *key = &(SLastKey){.lflag = ltype, .uid = uid, .cid = PRIMARYKEY_TIMESTAMP_COL_ID};
|
||||
|
||||
taosArrayInsert(remainCols, 0, &(SIdxKey){0, *key});
|
||||
(void)taosArrayInsert(remainCols, 0, &(SIdxKey){0, *key});
|
||||
}
|
||||
|
||||
int num_keys = TARRAY_SIZE(remainCols);
|
||||
|
@ -1416,7 +1412,7 @@ static int32_t tsdbCacheLoadFromRaw(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArr
|
|||
if (NULL == lastTmpIndexArray) {
|
||||
lastTmpIndexArray = taosArrayInit(num_keys, sizeof(int32_t));
|
||||
}
|
||||
taosArrayPush(lastTmpIndexArray, &(i));
|
||||
(void)taosArrayPush(lastTmpIndexArray, &(i));
|
||||
lastColIds[lastIndex] = idxKey->key.cid;
|
||||
lastSlotIds[lastIndex] = pr->pSlotIds[idxKey->idx];
|
||||
lastIndex++;
|
||||
|
@ -1424,7 +1420,7 @@ static int32_t tsdbCacheLoadFromRaw(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArr
|
|||
if (NULL == lastrowTmpIndexArray) {
|
||||
lastrowTmpIndexArray = taosArrayInit(num_keys, sizeof(int32_t));
|
||||
}
|
||||
taosArrayPush(lastrowTmpIndexArray, &(i));
|
||||
(void)taosArrayPush(lastrowTmpIndexArray, &(i));
|
||||
lastrowColIds[lastrowIndex] = idxKey->key.cid;
|
||||
lastrowSlotIds[lastrowIndex] = pr->pSlotIds[idxKey->idx];
|
||||
lastrowIndex++;
|
||||
|
@ -1434,17 +1430,18 @@ static int32_t tsdbCacheLoadFromRaw(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArr
|
|||
pTmpColArray = taosArrayInit(lastIndex + lastrowIndex, sizeof(SLastCol));
|
||||
|
||||
if (lastTmpIndexArray != NULL) {
|
||||
mergeLastCid(uid, pTsdb, &lastTmpColArray, pr, lastColIds, lastIndex, lastSlotIds);
|
||||
(void)mergeLastCid(uid, pTsdb, &lastTmpColArray, pr, lastColIds, lastIndex, lastSlotIds);
|
||||
for (int i = 0; i < taosArrayGetSize(lastTmpColArray); i++) {
|
||||
taosArrayInsert(pTmpColArray, *(int32_t *)taosArrayGet(lastTmpIndexArray, i), taosArrayGet(lastTmpColArray, i));
|
||||
(void)taosArrayInsert(pTmpColArray, *(int32_t *)taosArrayGet(lastTmpIndexArray, i),
|
||||
taosArrayGet(lastTmpColArray, i));
|
||||
}
|
||||
}
|
||||
|
||||
if (lastrowTmpIndexArray != NULL) {
|
||||
mergeLastRowCid(uid, pTsdb, &lastrowTmpColArray, pr, lastrowColIds, lastrowIndex, lastrowSlotIds);
|
||||
(void)mergeLastRowCid(uid, pTsdb, &lastrowTmpColArray, pr, lastrowColIds, lastrowIndex, lastrowSlotIds);
|
||||
for (int i = 0; i < taosArrayGetSize(lastrowTmpColArray); i++) {
|
||||
taosArrayInsert(pTmpColArray, *(int32_t *)taosArrayGet(lastrowTmpIndexArray, i),
|
||||
taosArrayGet(lastrowTmpColArray, i));
|
||||
(void)taosArrayInsert(pTmpColArray, *(int32_t *)taosArrayGet(lastrowTmpIndexArray, i),
|
||||
taosArrayGet(lastrowTmpColArray, i));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1586,10 +1583,7 @@ static int32_t tsdbCacheLoadFromRocks(STsdb *pTsdb, tb_uid_t uid, SArray *pLastA
|
|||
SLRUCache *pCache = pTsdb->lruCache;
|
||||
for (int i = 0, j = 0; i < num_keys && j < TARRAY_SIZE(remainCols); ++i) {
|
||||
SLastCol *pLastCol = NULL;
|
||||
code = tsdbCacheDeserialize(values_list[i], values_list_sizes[i], &pLastCol);
|
||||
if (code) {
|
||||
tsdbError("tsdb/cache: vgId:%d, deserialize failed since %s.", TD_VID(pTsdb->pVnode), tstrerror(code));
|
||||
}
|
||||
(void)tsdbCacheDeserialize(values_list[i], values_list_sizes[i], &pLastCol);
|
||||
SLastCol *PToFree = pLastCol;
|
||||
SIdxKey *idxKey = &((SIdxKey *)TARRAY_DATA(remainCols))[j];
|
||||
if (pLastCol) {
|
||||
|
@ -1682,19 +1676,19 @@ int32_t tsdbCacheGetBatch(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArray, SCache
|
|||
TAOS_CHECK_RETURN(reallocVarDataVal(&lastCol.rowKey.pks[j]));
|
||||
}
|
||||
TAOS_CHECK_RETURN(reallocVarData(&lastCol.colVal));
|
||||
taosArrayPush(pLastArray, &lastCol);
|
||||
(void)taosArrayPush(pLastArray, &lastCol);
|
||||
|
||||
taosLRUCacheRelease(pCache, h, false);
|
||||
(void)taosLRUCacheRelease(pCache, h, false);
|
||||
} else {
|
||||
SLastCol noneCol = {.rowKey.ts = TSKEY_MIN,
|
||||
.colVal = COL_VAL_NONE(cid, pr->pSchema->columns[pr->pSlotIds[i]].type)};
|
||||
|
||||
taosArrayPush(pLastArray, &noneCol);
|
||||
(void)taosArrayPush(pLastArray, &noneCol);
|
||||
|
||||
if (!remainCols) {
|
||||
remainCols = taosArrayInit(num_keys, sizeof(SIdxKey));
|
||||
}
|
||||
taosArrayPush(remainCols, &(SIdxKey){i, key});
|
||||
(void)taosArrayPush(remainCols, &(SIdxKey){i, key});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1721,7 +1715,7 @@ int32_t tsdbCacheGetBatch(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArray, SCache
|
|||
}
|
||||
taosArraySet(pLastArray, idxKey->idx, &lastCol);
|
||||
|
||||
taosLRUCacheRelease(pCache, h, false);
|
||||
(void)taosLRUCacheRelease(pCache, h, false);
|
||||
|
||||
taosArrayRemove(remainCols, i);
|
||||
} else {
|
||||
|
@ -1810,10 +1804,7 @@ int32_t tsdbCacheDel(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSKEY sKey, TSKE
|
|||
rocksdb_writebatch_t *wb = pTsdb->rCache.writebatch;
|
||||
for (int i = 0; i < num_keys; ++i) {
|
||||
SLastCol *pLastCol = NULL;
|
||||
code = tsdbCacheDeserialize(values_list[i], values_list_sizes[i], &pLastCol);
|
||||
if (code) {
|
||||
tsdbError("tsdb/cache: vgId:%d, deserialize failed since %s.", TD_VID(pTsdb->pVnode), tstrerror(code));
|
||||
}
|
||||
(void)tsdbCacheDeserialize(values_list[i], values_list_sizes[i], &pLastCol);
|
||||
(void)taosThreadMutexLock(&pTsdb->rCache.rMutex);
|
||||
if (NULL != pLastCol && (pLastCol->rowKey.ts <= eKey && pLastCol->rowKey.ts >= sKey)) {
|
||||
rocksdb_writebatch_delete(wb, keys_list[i], klen);
|
||||
|
@ -1821,10 +1812,7 @@ int32_t tsdbCacheDel(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSKEY sKey, TSKE
|
|||
taosMemoryFreeClear(pLastCol);
|
||||
|
||||
pLastCol = NULL;
|
||||
code = tsdbCacheDeserialize(values_list[i + num_keys], values_list_sizes[i + num_keys], &pLastCol);
|
||||
if (code) {
|
||||
tsdbError("tsdb/cache: vgId:%d, deserialize failed since %s.", TD_VID(pTsdb->pVnode), tstrerror(code));
|
||||
}
|
||||
(void)tsdbCacheDeserialize(values_list[i + num_keys], values_list_sizes[i + num_keys], &pLastCol);
|
||||
if (NULL != pLastCol && (pLastCol->rowKey.ts <= eKey && pLastCol->rowKey.ts >= sKey)) {
|
||||
rocksdb_writebatch_delete(wb, keys_list[num_keys + i], klen);
|
||||
}
|
||||
|
@ -1846,7 +1834,7 @@ int32_t tsdbCacheDel(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSKEY sKey, TSKE
|
|||
if (pLastCol->rowKey.ts <= eKey && pLastCol->rowKey.ts >= sKey) {
|
||||
erase = true;
|
||||
}
|
||||
taosLRUCacheRelease(pTsdb->lruCache, h, erase);
|
||||
(void)taosLRUCacheRelease(pTsdb->lruCache, h, erase);
|
||||
}
|
||||
if (erase) {
|
||||
taosLRUCacheErase(pTsdb->lruCache, keys_list[i], klen);
|
||||
|
@ -1862,7 +1850,7 @@ int32_t tsdbCacheDel(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSKEY sKey, TSKE
|
|||
if (pLastCol->rowKey.ts <= eKey && pLastCol->rowKey.ts >= sKey) {
|
||||
erase = true;
|
||||
}
|
||||
taosLRUCacheRelease(pTsdb->lruCache, h, erase);
|
||||
(void)taosLRUCacheRelease(pTsdb->lruCache, h, erase);
|
||||
}
|
||||
if (erase) {
|
||||
taosLRUCacheErase(pTsdb->lruCache, keys_list[num_keys + i], klen);
|
||||
|
@ -1982,7 +1970,7 @@ static int32_t getTableDelDataFromTbData(STbData *pTbData, SArray *aDelData) {
|
|||
SDelData *pDelData = pTbData ? pTbData->pHead : NULL;
|
||||
|
||||
for (; pDelData; pDelData = pDelData->pNext) {
|
||||
taosArrayPush(aDelData, pDelData);
|
||||
(void)taosArrayPush(aDelData, pDelData);
|
||||
}
|
||||
|
||||
return code;
|
||||
|
@ -2005,7 +1993,7 @@ static STableLoadInfo *getTableLoadInfo(SCacheRowsReader *pReader, uint64_t uid)
|
|||
if (!ppInfo) {
|
||||
pInfo = taosMemoryCalloc(1, sizeof(STableLoadInfo));
|
||||
if (pInfo) {
|
||||
tSimpleHashPut(pReader->pTableMap, &uid, sizeof(uint64_t), &pInfo, POINTER_BYTES);
|
||||
(void)tSimpleHashPut(pReader->pTableMap, &uid, sizeof(uint64_t), &pInfo, POINTER_BYTES);
|
||||
}
|
||||
|
||||
return pInfo;
|
||||
|
@ -2117,11 +2105,11 @@ static int32_t loadTombFromBlk(const TTombBlkArray *pTombBlkArray, SCacheRowsRea
|
|||
TD_VID(pReader->pTsdb->pVnode), pReader->pCurFileSet->fid, record.skey, record.ekey, uid);*/
|
||||
|
||||
SDelData delData = {.version = record.version, .sKey = record.skey, .eKey = record.ekey};
|
||||
taosArrayPush(pInfo->pTombData, &delData);
|
||||
(void)taosArrayPush(pInfo->pTombData, &delData);
|
||||
}
|
||||
}
|
||||
|
||||
tTombBlockDestroy(&block);
|
||||
(void)tTombBlockDestroy(&block);
|
||||
|
||||
if (finished) {
|
||||
TAOS_RETURN(code);
|
||||
|
@ -2312,7 +2300,7 @@ static int32_t getNextRowFromFS(void *iter, TSDBROW **ppRow, bool *pIgnoreEarlie
|
|||
|
||||
state->pr->pCurFileSet = state->pFileSet;
|
||||
|
||||
loadDataTomb(state->pr, state->pr->pFileReader);
|
||||
(void)loadDataTomb(state->pr, state->pr->pFileReader);
|
||||
|
||||
TAOS_CHECK_GOTO(tsdbDataFileReadBrinBlk(state->pr->pFileReader, &state->pr->pBlkArray), &lino, _err);
|
||||
}
|
||||
|
@ -2329,7 +2317,7 @@ static int32_t getNextRowFromFS(void *iter, TSDBROW **ppRow, bool *pIgnoreEarlie
|
|||
SBrinBlk *pBrinBlk = &pBlkArray->data[i];
|
||||
if (state->suid >= pBrinBlk->minTbid.suid && state->suid <= pBrinBlk->maxTbid.suid) {
|
||||
if (state->uid >= pBrinBlk->minTbid.uid && state->uid <= pBrinBlk->maxTbid.uid) {
|
||||
taosArrayPush(state->pIndexList, pBrinBlk);
|
||||
(void)taosArrayPush(state->pIndexList, pBrinBlk);
|
||||
}
|
||||
} else if (state->suid > pBrinBlk->maxTbid.suid ||
|
||||
(state->suid == pBrinBlk->maxTbid.suid && state->uid > pBrinBlk->maxTbid.uid)) {
|
||||
|
@ -2385,7 +2373,7 @@ static int32_t getNextRowFromFS(void *iter, TSDBROW **ppRow, bool *pIgnoreEarlie
|
|||
|
||||
if (!state->pLastRow) {
|
||||
if (state->pLastIter) {
|
||||
lastIterClose(&state->pLastIter);
|
||||
(void)lastIterClose(&state->pLastIter);
|
||||
}
|
||||
|
||||
clearLastFileSet(state);
|
||||
|
@ -2493,7 +2481,7 @@ static int32_t getNextRowFromFS(void *iter, TSDBROW **ppRow, bool *pIgnoreEarlie
|
|||
|
||||
if (!state->pLastRow) {
|
||||
if (state->pLastIter) {
|
||||
lastIterClose(&state->pLastIter);
|
||||
(void)lastIterClose(&state->pLastIter);
|
||||
}
|
||||
|
||||
*ppRow = &state->row;
|
||||
|
@ -2517,7 +2505,7 @@ static int32_t getNextRowFromFS(void *iter, TSDBROW **ppRow, bool *pIgnoreEarlie
|
|||
} else {
|
||||
// TODO: merge rows and *ppRow = mergedRow
|
||||
SRowMerger *pMerger = &state->rowMerger;
|
||||
tsdbRowMergerInit(pMerger, state->pTSchema);
|
||||
(void)tsdbRowMergerInit(pMerger, state->pTSchema);
|
||||
|
||||
TAOS_CHECK_GOTO(tsdbRowMergerAdd(pMerger, &state->row, state->pTSchema), &lino, _err);
|
||||
TAOS_CHECK_GOTO(tsdbRowMergerAdd(pMerger, state->pLastRow, state->pTSchema), &lino, _err);
|
||||
|
@ -2682,7 +2670,7 @@ int32_t clearNextRowFromFS(void *iter) {
|
|||
}
|
||||
|
||||
if (state->pLastIter) {
|
||||
lastIterClose(&state->pLastIter);
|
||||
(void)lastIterClose(&state->pLastIter);
|
||||
}
|
||||
|
||||
if (state->pBlockData) {
|
||||
|
@ -2715,7 +2703,7 @@ int32_t clearNextRowFromFS(void *iter) {
|
|||
|
||||
static void clearLastFileSet(SFSNextRowIter *state) {
|
||||
if (state->pLastIter) {
|
||||
lastIterClose(&state->pLastIter);
|
||||
(void)lastIterClose(&state->pLastIter);
|
||||
}
|
||||
|
||||
if (state->pBlockData) {
|
||||
|
@ -2724,7 +2712,7 @@ static void clearLastFileSet(SFSNextRowIter *state) {
|
|||
}
|
||||
|
||||
if (state->pr->pFileReader) {
|
||||
tsdbDataFileReaderClose(&state->pr->pFileReader);
|
||||
(void)tsdbDataFileReaderClose(&state->pr->pFileReader);
|
||||
state->pr->pFileReader = NULL;
|
||||
|
||||
state->pr->pCurFileSet = NULL;
|
||||
|
@ -2814,7 +2802,7 @@ static int32_t nextRowIterClose(CacheNextRowIter *pIter) {
|
|||
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
if (pIter->input[i].nextRowClearFn) {
|
||||
pIter->input[i].nextRowClearFn(pIter->input[i].iter);
|
||||
(void)pIter->input[i].nextRowClearFn(pIter->input[i].iter);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2898,7 +2886,7 @@ static int32_t nextRowIterGet(CacheNextRowIter *pIter, TSDBROW **ppRow, bool *pI
|
|||
pInfo->pTombData = taosArrayInit(4, sizeof(SDelData));
|
||||
}
|
||||
|
||||
taosArrayAddAll(pInfo->pTombData, pIter->pMemDelData);
|
||||
(void)taosArrayAddAll(pInfo->pTombData, pIter->pMemDelData);
|
||||
|
||||
size_t delSize = TARRAY_SIZE(pInfo->pTombData);
|
||||
if (delSize > 0) {
|
||||
|
@ -2944,7 +2932,7 @@ static int32_t initLastColArrayPartial(STSchema *pTSchema, SArray **ppColArray,
|
|||
int16_t slotId = slotIds[i];
|
||||
SLastCol col = {.rowKey.ts = 0,
|
||||
.colVal = COL_VAL_NULL(pTSchema->columns[slotId].colId, pTSchema->columns[slotId].type)};
|
||||
taosArrayPush(pColArray, &col);
|
||||
(void)taosArrayPush(pColArray, &col);
|
||||
}
|
||||
*ppColArray = pColArray;
|
||||
|
||||
|
@ -2998,18 +2986,18 @@ static int32_t mergeLastCid(tb_uid_t uid, STsdb *pTsdb, SArray **ppLastArray, SC
|
|||
}
|
||||
|
||||
for (int i = 0; i < nCols; ++i) {
|
||||
taosArrayPush(aColArray, &aCols[i]);
|
||||
(void)taosArrayPush(aColArray, &aCols[i]);
|
||||
}
|
||||
|
||||
STsdbRowKey lastRowKey = {.key.ts = TSKEY_MAX};
|
||||
|
||||
// inverse iterator
|
||||
CacheNextRowIter iter = {0};
|
||||
nextRowIterOpen(&iter, uid, pTsdb, pTSchema, pr->info.suid, pr->pLDataIterArray, pr->pReadSnap, pr->lastTs, pr);
|
||||
(void)nextRowIterOpen(&iter, uid, pTsdb, pTSchema, pr->info.suid, pr->pLDataIterArray, pr->pReadSnap, pr->lastTs, pr);
|
||||
|
||||
do {
|
||||
TSDBROW *pRow = NULL;
|
||||
nextRowIterGet(&iter, &pRow, &ignoreEarlierTs, true, TARRAY_DATA(aColArray), TARRAY_SIZE(aColArray));
|
||||
(void)nextRowIterGet(&iter, &pRow, &ignoreEarlierTs, true, TARRAY_DATA(aColArray), TARRAY_SIZE(aColArray));
|
||||
|
||||
if (!pRow) {
|
||||
break;
|
||||
|
@ -3142,7 +3130,7 @@ static int32_t mergeLastCid(tb_uid_t uid, STsdb *pTsdb, SArray **ppLastArray, SC
|
|||
}
|
||||
*ppLastArray = pColArray;
|
||||
|
||||
nextRowIterClose(&iter);
|
||||
(void)nextRowIterClose(&iter);
|
||||
taosArrayDestroy(aColArray);
|
||||
|
||||
TAOS_RETURN(code);
|
||||
|
@ -3184,16 +3172,16 @@ static int32_t mergeLastRowCid(tb_uid_t uid, STsdb *pTsdb, SArray **ppLastArray,
|
|||
}
|
||||
|
||||
for (int i = 0; i < nCols; ++i) {
|
||||
taosArrayPush(aColArray, &aCols[i]);
|
||||
(void)taosArrayPush(aColArray, &aCols[i]);
|
||||
}
|
||||
|
||||
// inverse iterator
|
||||
CacheNextRowIter iter = {0};
|
||||
nextRowIterOpen(&iter, uid, pTsdb, pTSchema, pr->info.suid, pr->pLDataIterArray, pr->pReadSnap, pr->lastTs, pr);
|
||||
(void)nextRowIterOpen(&iter, uid, pTsdb, pTSchema, pr->info.suid, pr->pLDataIterArray, pr->pReadSnap, pr->lastTs, pr);
|
||||
|
||||
do {
|
||||
TSDBROW *pRow = NULL;
|
||||
nextRowIterGet(&iter, &pRow, &ignoreEarlierTs, false, TARRAY_DATA(aColArray), TARRAY_SIZE(aColArray));
|
||||
(void)nextRowIterGet(&iter, &pRow, &ignoreEarlierTs, false, TARRAY_DATA(aColArray), TARRAY_SIZE(aColArray));
|
||||
|
||||
if (!pRow) {
|
||||
break;
|
||||
|
@ -3266,7 +3254,7 @@ static int32_t mergeLastRowCid(tb_uid_t uid, STsdb *pTsdb, SArray **ppLastArray,
|
|||
}
|
||||
*ppLastArray = pColArray;
|
||||
|
||||
nextRowIterClose(&iter);
|
||||
(void)nextRowIterClose(&iter);
|
||||
taosArrayDestroy(aColArray);
|
||||
|
||||
TAOS_RETURN(code);
|
||||
|
@ -3286,13 +3274,7 @@ _err:
|
|||
TAOS_RETURN(code);
|
||||
}
|
||||
|
||||
int32_t tsdbCacheRelease(SLRUCache *pCache, LRUHandle *h) {
|
||||
int32_t code = 0;
|
||||
|
||||
taosLRUCacheRelease(pCache, h, false);
|
||||
|
||||
return code;
|
||||
}
|
||||
void tsdbCacheRelease(SLRUCache *pCache, LRUHandle *h) { (void)taosLRUCacheRelease(pCache, h, false); }
|
||||
|
||||
void tsdbCacheSetCapacity(SVnode *pVnode, size_t capacity) {
|
||||
taosLRUCacheSetCapacity(pVnode->pTsdb->lruCache, capacity);
|
||||
|
|
|
@ -251,7 +251,7 @@ static int32_t tsdbCommitOpenReader(SCommitter2 *committer) {
|
|||
|
||||
_exit:
|
||||
if (code) {
|
||||
tsdbCommitCloseReader(committer);
|
||||
TAOS_UNUSED(tsdbCommitCloseReader(committer));
|
||||
tsdbError("vgId:%d %s failed at %s:%d since %s", TD_VID(committer->tsdb->pVnode), __func__, __FILE__, lino,
|
||||
tstrerror(code));
|
||||
}
|
||||
|
@ -259,8 +259,8 @@ _exit:
|
|||
}
|
||||
|
||||
static int32_t tsdbCommitCloseIter(SCommitter2 *committer) {
|
||||
tsdbIterMergerClose(&committer->tombIterMerger);
|
||||
tsdbIterMergerClose(&committer->dataIterMerger);
|
||||
TAOS_UNUSED(tsdbIterMergerClose(&committer->tombIterMerger));
|
||||
TAOS_UNUSED(tsdbIterMergerClose(&committer->dataIterMerger));
|
||||
TARRAY2_CLEAR(committer->tombIterArray, tsdbIterClose);
|
||||
TARRAY2_CLEAR(committer->dataIterArray, tsdbIterClose);
|
||||
return 0;
|
||||
|
@ -322,7 +322,7 @@ static int32_t tsdbCommitOpenIter(SCommitter2 *committer) {
|
|||
|
||||
_exit:
|
||||
if (code) {
|
||||
tsdbCommitCloseIter(committer);
|
||||
TAOS_UNUSED(tsdbCommitCloseIter(committer));
|
||||
tsdbError("vgId:%d %s failed at %s:%d since %s", TD_VID(committer->tsdb->pVnode), __func__, __FILE__, lino,
|
||||
tstrerror(code));
|
||||
}
|
||||
|
@ -335,7 +335,7 @@ static int32_t tsdbCommitFileSetBegin(SCommitter2 *committer) {
|
|||
STsdb *tsdb = committer->tsdb;
|
||||
|
||||
// check if can commit
|
||||
tsdbFSCheckCommit(tsdb, committer->ctx->info->fid);
|
||||
TAOS_UNUSED(tsdbFSCheckCommit(tsdb, committer->ctx->info->fid));
|
||||
|
||||
committer->ctx->expLevel = tsdbFidLevel(committer->ctx->info->fid, &tsdb->keepCfg, committer->now);
|
||||
tsdbFidKeyRange(committer->ctx->info->fid, committer->minutes, committer->precision, &committer->ctx->minKey,
|
||||
|
@ -344,7 +344,7 @@ static int32_t tsdbCommitFileSetBegin(SCommitter2 *committer) {
|
|||
TAOS_CHECK_GOTO(tfsAllocDisk(committer->tsdb->pVnode->pTfs, committer->ctx->expLevel, &committer->ctx->did), &lino,
|
||||
_exit);
|
||||
|
||||
tfsMkdirRecurAt(committer->tsdb->pVnode->pTfs, committer->tsdb->path, committer->ctx->did);
|
||||
TAOS_UNUSED(tfsMkdirRecurAt(committer->tsdb->pVnode->pTfs, committer->tsdb->path, committer->ctx->did));
|
||||
committer->ctx->tbid->suid = 0;
|
||||
committer->ctx->tbid->uid = 0;
|
||||
|
||||
|
@ -430,12 +430,12 @@ static int32_t tsdbCommitInfoDestroy(STsdb *pTsdb) {
|
|||
if (pTsdb->commitInfo) {
|
||||
for (int32_t i = 0; i < taosArrayGetSize(pTsdb->commitInfo->arr); i++) {
|
||||
SFileSetCommitInfo *info = *(SFileSetCommitInfo **)taosArrayGet(pTsdb->commitInfo->arr, i);
|
||||
vHashDrop(pTsdb->commitInfo->ht, info);
|
||||
TAOS_UNUSED(vHashDrop(pTsdb->commitInfo->ht, info));
|
||||
tsdbTFileSetClear(&info->fset);
|
||||
taosMemoryFree(info);
|
||||
}
|
||||
|
||||
vHashDestroy(&pTsdb->commitInfo->ht);
|
||||
TAOS_UNUSED(vHashDestroy(&pTsdb->commitInfo->ht));
|
||||
taosArrayDestroy(pTsdb->commitInfo->arr);
|
||||
pTsdb->commitInfo->arr = NULL;
|
||||
taosMemoryFreeClear(pTsdb->commitInfo);
|
||||
|
@ -461,7 +461,7 @@ static int32_t tsdbCommitInfoInit(STsdb *pTsdb) {
|
|||
|
||||
_exit:
|
||||
if (code) {
|
||||
tsdbCommitInfoDestroy(pTsdb);
|
||||
TAOS_UNUSED(tsdbCommitInfoDestroy(pTsdb));
|
||||
tsdbError("vgId:%d %s failed at %s:%d since %s", TD_VID(pTsdb->pVnode), __func__, __FILE__, lino, tstrerror(code));
|
||||
}
|
||||
return code;
|
||||
|
@ -531,7 +531,7 @@ static int32_t tsdbCommitInfoBuild(STsdb *tsdb) {
|
|||
SFileSetCommitInfo tinfo = {
|
||||
.fid = fid,
|
||||
};
|
||||
vHashGet(tsdb->commitInfo->ht, &tinfo, (void **)&info);
|
||||
TAOS_UNUSED(vHashGet(tsdb->commitInfo->ht, &tinfo, (void **)&info));
|
||||
if (info == NULL) {
|
||||
TAOS_CHECK_GOTO(tsdbCommitInfoAdd(tsdb, fid), &lino, _exit);
|
||||
}
|
||||
|
@ -555,7 +555,7 @@ static int32_t tsdbCommitInfoBuild(STsdb *tsdb) {
|
|||
};
|
||||
|
||||
// check if the file set already on the commit list
|
||||
vHashGet(tsdb->commitInfo->ht, &tinfo, (void **)&info);
|
||||
TAOS_UNUSED(vHashGet(tsdb->commitInfo->ht, &tinfo, (void **)&info));
|
||||
if (info != NULL) {
|
||||
continue;
|
||||
}
|
||||
|
@ -589,7 +589,7 @@ static int32_t tsdbCommitInfoBuild(STsdb *tsdb) {
|
|||
// begin tasks on file set
|
||||
for (int i = 0; i < taosArrayGetSize(tsdb->commitInfo->arr); i++) {
|
||||
SFileSetCommitInfo *info = *(SFileSetCommitInfo **)taosArrayGet(tsdb->commitInfo->arr, i);
|
||||
tsdbBeginTaskOnFileSet(tsdb, info->fid, &fset);
|
||||
TAOS_UNUSED(tsdbBeginTaskOnFileSet(tsdb, info->fid, &fset));
|
||||
if (fset) {
|
||||
code = tsdbTFileSetInitCopy(tsdb, fset, &info->fset);
|
||||
if (code) {
|
||||
|
@ -603,7 +603,7 @@ static int32_t tsdbCommitInfoBuild(STsdb *tsdb) {
|
|||
|
||||
_exit:
|
||||
if (code) {
|
||||
tsdbCommitInfoDestroy(tsdb);
|
||||
TAOS_UNUSED(tsdbCommitInfoDestroy(tsdb));
|
||||
tsdbError("vgId:%d %s failed at %s:%d since %s", TD_VID(tsdb->pVnode), __func__, __FILE__, lino, tstrerror(code));
|
||||
}
|
||||
return code;
|
||||
|
@ -689,7 +689,7 @@ int32_t tsdbCommitBegin(STsdb *tsdb, SCommitInfo *info) {
|
|||
(void)taosThreadMutexLock(&tsdb->mutex);
|
||||
tsdb->imem = NULL;
|
||||
(void)taosThreadMutexUnlock(&tsdb->mutex);
|
||||
tsdbUnrefMemTable(imem, NULL, true);
|
||||
TAOS_UNUSED(tsdbUnrefMemTable(imem, NULL, true));
|
||||
} else {
|
||||
SCommitter2 committer = {0};
|
||||
|
||||
|
@ -730,14 +730,14 @@ int32_t tsdbCommitCommit(STsdb *tsdb) {
|
|||
for (int32_t i = 0; i < taosArrayGetSize(tsdb->commitInfo->arr); i++) {
|
||||
SFileSetCommitInfo *info = *(SFileSetCommitInfo **)taosArrayGet(tsdb->commitInfo->arr, i);
|
||||
if (info->fset) {
|
||||
tsdbFinishTaskOnFileSet(tsdb, info->fid);
|
||||
TAOS_UNUSED(tsdbFinishTaskOnFileSet(tsdb, info->fid));
|
||||
}
|
||||
}
|
||||
|
||||
(void)taosThreadMutexUnlock(&tsdb->mutex);
|
||||
|
||||
tsdbCommitInfoDestroy(tsdb);
|
||||
tsdbUnrefMemTable(pMemTable, NULL, true);
|
||||
TAOS_UNUSED(tsdbCommitInfoDestroy(tsdb));
|
||||
TAOS_UNUSED(tsdbUnrefMemTable(pMemTable, NULL, true));
|
||||
}
|
||||
|
||||
_exit:
|
||||
|
@ -761,11 +761,11 @@ int32_t tsdbCommitAbort(STsdb *pTsdb) {
|
|||
for (int32_t i = 0; i < taosArrayGetSize(pTsdb->commitInfo->arr); i++) {
|
||||
SFileSetCommitInfo *info = *(SFileSetCommitInfo **)taosArrayGet(pTsdb->commitInfo->arr, i);
|
||||
if (info->fset) {
|
||||
tsdbFinishTaskOnFileSet(pTsdb, info->fid);
|
||||
TAOS_UNUSED(tsdbFinishTaskOnFileSet(pTsdb, info->fid));
|
||||
}
|
||||
}
|
||||
(void)taosThreadMutexUnlock(&pTsdb->mutex);
|
||||
tsdbCommitInfoDestroy(pTsdb);
|
||||
TAOS_UNUSED(tsdbCommitInfoDestroy(pTsdb));
|
||||
|
||||
_exit:
|
||||
if (code) {
|
||||
|
|
|
@ -35,7 +35,7 @@ int32_t tsdbDataFileRAWReaderOpen(const char *fname, const SDataFileRAWReaderCon
|
|||
}
|
||||
} else {
|
||||
char fname1[TSDB_FILENAME_LEN];
|
||||
tsdbTFileName(config->tsdb, &config->file, fname1);
|
||||
(void)tsdbTFileName(config->tsdb, &config->file, fname1);
|
||||
TAOS_CHECK_GOTO(tsdbOpenFile(fname1, config->tsdb, TD_FILE_READ, &reader[0]->fd, lcn), &lino, _exit);
|
||||
}
|
||||
|
||||
|
@ -159,7 +159,7 @@ static int32_t tsdbDataFileRAWWriterOpenDataFD(SDataFileRAWWriter *writer) {
|
|||
flag |= (TD_FILE_CREATE | TD_FILE_TRUNC);
|
||||
}
|
||||
|
||||
tsdbTFileName(writer->config->tsdb, &writer->file, fname);
|
||||
(void)tsdbTFileName(writer->config->tsdb, &writer->file, fname);
|
||||
TAOS_CHECK_GOTO(tsdbOpenFile(fname, writer->config->tsdb, flag, &writer->fd, writer->file.lcn), &lino, _exit);
|
||||
|
||||
_exit:
|
||||
|
@ -202,7 +202,7 @@ int32_t tsdbDataFileRAWWriterClose(SDataFileRAWWriter **writer, bool abort, TFil
|
|||
} else {
|
||||
TAOS_CHECK_GOTO(tsdbDataFileRAWWriterCloseCommit(writer[0], opArr), &lino, _exit);
|
||||
}
|
||||
tsdbDataFileRAWWriterDoClose(writer[0]);
|
||||
(void)tsdbDataFileRAWWriterDoClose(writer[0]);
|
||||
}
|
||||
taosMemoryFree(writer[0]);
|
||||
writer[0] = NULL;
|
||||
|
|
|
@ -135,7 +135,7 @@ int32_t tsdbDataFileReaderOpen(const char *fname[], const SDataFileReaderConfig
|
|||
for (int32_t i = 0; i < TSDB_FTYPE_MAX; ++i) {
|
||||
if (config->files[i].exist) {
|
||||
char fname1[TSDB_FILENAME_LEN];
|
||||
tsdbTFileName(config->tsdb, &config->files[i].file, fname1);
|
||||
(void)tsdbTFileName(config->tsdb, &config->files[i].file, fname1);
|
||||
int32_t lcn = config->files[i].file.lcn;
|
||||
TAOS_CHECK_GOTO(tsdbOpenFile(fname1, config->tsdb, TD_FILE_READ, &reader[0]->fd[i], lcn), &lino, _exit);
|
||||
}
|
||||
|
@ -667,7 +667,7 @@ static int32_t tsdbDataFileWriterCloseAbort(SDataFileWriter *writer) {
|
|||
|
||||
static int32_t tsdbDataFileWriterDoClose(SDataFileWriter *writer) {
|
||||
if (writer->ctx->reader) {
|
||||
tsdbDataFileReaderClose(&writer->ctx->reader);
|
||||
(void)tsdbDataFileReaderClose(&writer->ctx->reader);
|
||||
}
|
||||
|
||||
tTombBlockDestroy(writer->tombBlock);
|
||||
|
@ -857,7 +857,7 @@ int32_t tsdbFileWriteBrinBlock(STsdbFD *fd, SBrinBlock *brinBlock, uint32_t cmpr
|
|||
}
|
||||
}
|
||||
|
||||
tsdbWriterUpdVerRange(range, brinBlk.minVer, brinBlk.maxVer);
|
||||
(void)tsdbWriterUpdVerRange(range, brinBlk.minVer, brinBlk.maxVer);
|
||||
|
||||
// write to file
|
||||
for (int32_t i = 0; i < 10; ++i) {
|
||||
|
@ -1018,7 +1018,7 @@ static int32_t tsdbDataFileDoWriteBlockData(SDataFileWriter *writer, SBlockData
|
|||
}
|
||||
}
|
||||
|
||||
tsdbWriterUpdVerRange(&writer->ctx->range, record->minVer, record->maxVer);
|
||||
(void)tsdbWriterUpdVerRange(&writer->ctx->range, record->minVer, record->maxVer);
|
||||
|
||||
code = metaGetColCmpr(writer->config->tsdb->pVnode->pMeta, bData->suid != 0 ? bData->suid : bData->uid,
|
||||
&cmprInfo.pColCmpr);
|
||||
|
@ -1371,7 +1371,7 @@ int32_t tsdbFileWriteTombBlock(STsdbFD *fd, STombBlock *tombBlock, int8_t cmprAl
|
|||
}
|
||||
}
|
||||
|
||||
tsdbWriterUpdVerRange(range, tombBlk.minVer, tombBlk.maxVer);
|
||||
(void)tsdbWriterUpdVerRange(range, tombBlk.minVer, tombBlk.maxVer);
|
||||
|
||||
for (int32_t i = 0; i < ARRAY_SIZE(tombBlock->buffers); i++) {
|
||||
tBufferClear(buffer0);
|
||||
|
@ -1640,8 +1640,8 @@ static int32_t tsdbDataFileWriterCloseCommit(SDataFileWriter *writer, TFileOpArr
|
|||
.fid = writer->config->fid,
|
||||
.nf = writer->files[ftype],
|
||||
};
|
||||
tsdbTFileUpdVerRange(&op.nf, ofRange);
|
||||
tsdbTFileUpdVerRange(&op.nf, writer->ctx->range);
|
||||
(void)tsdbTFileUpdVerRange(&op.nf, ofRange);
|
||||
(void)tsdbTFileUpdVerRange(&op.nf, writer->ctx->range);
|
||||
TAOS_CHECK_GOTO(TARRAY2_APPEND(opArr, op), &lino, _exit);
|
||||
|
||||
// .data
|
||||
|
@ -1652,7 +1652,7 @@ static int32_t tsdbDataFileWriterCloseCommit(SDataFileWriter *writer, TFileOpArr
|
|||
.fid = writer->config->fid,
|
||||
.nf = writer->files[ftype],
|
||||
};
|
||||
tsdbTFileUpdVerRange(&op.nf, writer->ctx->range);
|
||||
(void)tsdbTFileUpdVerRange(&op.nf, writer->ctx->range);
|
||||
TAOS_CHECK_GOTO(TARRAY2_APPEND(opArr, op), &lino, _exit);
|
||||
} else if (writer->config->files[ftype].file.size != writer->files[ftype].size) {
|
||||
op = (STFileOp){
|
||||
|
@ -1661,7 +1661,7 @@ static int32_t tsdbDataFileWriterCloseCommit(SDataFileWriter *writer, TFileOpArr
|
|||
.of = writer->config->files[ftype].file,
|
||||
.nf = writer->files[ftype],
|
||||
};
|
||||
tsdbTFileUpdVerRange(&op.nf, writer->ctx->range);
|
||||
(void)tsdbTFileUpdVerRange(&op.nf, writer->ctx->range);
|
||||
TAOS_CHECK_GOTO(TARRAY2_APPEND(opArr, op), &lino, _exit);
|
||||
}
|
||||
|
||||
|
@ -1673,7 +1673,7 @@ static int32_t tsdbDataFileWriterCloseCommit(SDataFileWriter *writer, TFileOpArr
|
|||
.fid = writer->config->fid,
|
||||
.nf = writer->files[ftype],
|
||||
};
|
||||
tsdbTFileUpdVerRange(&op.nf, writer->ctx->range);
|
||||
(void)tsdbTFileUpdVerRange(&op.nf, writer->ctx->range);
|
||||
TAOS_CHECK_GOTO(TARRAY2_APPEND(opArr, op), &lino, _exit);
|
||||
} else if (writer->config->files[ftype].file.size != writer->files[ftype].size) {
|
||||
op = (STFileOp){
|
||||
|
@ -1682,7 +1682,7 @@ static int32_t tsdbDataFileWriterCloseCommit(SDataFileWriter *writer, TFileOpArr
|
|||
.of = writer->config->files[ftype].file,
|
||||
.nf = writer->files[ftype],
|
||||
};
|
||||
tsdbTFileUpdVerRange(&op.nf, writer->ctx->range);
|
||||
(void)tsdbTFileUpdVerRange(&op.nf, writer->ctx->range);
|
||||
TAOS_CHECK_GOTO(TARRAY2_APPEND(opArr, op), &lino, _exit);
|
||||
}
|
||||
}
|
||||
|
@ -1716,8 +1716,8 @@ static int32_t tsdbDataFileWriterCloseCommit(SDataFileWriter *writer, TFileOpArr
|
|||
.fid = writer->config->fid,
|
||||
.nf = writer->files[ftype],
|
||||
};
|
||||
tsdbTFileUpdVerRange(&op.nf, ofRange);
|
||||
tsdbTFileUpdVerRange(&op.nf, writer->ctx->tombRange);
|
||||
(void)tsdbTFileUpdVerRange(&op.nf, ofRange);
|
||||
(void)tsdbTFileUpdVerRange(&op.nf, writer->ctx->tombRange);
|
||||
TAOS_CHECK_GOTO(TARRAY2_APPEND(opArr, op), &lino, _exit);
|
||||
}
|
||||
int32_t encryptAlgorithm = writer->config->tsdb->pVnode->config.tsdbCfg.encryptAlgorithm;
|
||||
|
@ -1754,7 +1754,7 @@ static int32_t tsdbDataFileWriterOpenDataFD(SDataFileWriter *writer) {
|
|||
}
|
||||
|
||||
int32_t lcn = writer->files[ftype].lcn;
|
||||
tsdbTFileName(writer->config->tsdb, &writer->files[ftype], fname);
|
||||
(void)tsdbTFileName(writer->config->tsdb, &writer->files[ftype], fname);
|
||||
TAOS_CHECK_GOTO(tsdbOpenFile(fname, writer->config->tsdb, flag, &writer->fd[ftype], lcn), &lino, _exit);
|
||||
|
||||
if (writer->files[ftype].size == 0) {
|
||||
|
@ -1804,7 +1804,7 @@ int32_t tsdbDataFileWriterClose(SDataFileWriter **writer, bool abort, TFileOpArr
|
|||
} else {
|
||||
TAOS_CHECK_GOTO(tsdbDataFileWriterCloseCommit(writer[0], opArr), &lino, _exit);
|
||||
}
|
||||
tsdbDataFileWriterDoClose(writer[0]);
|
||||
(void)tsdbDataFileWriterDoClose(writer[0]);
|
||||
}
|
||||
taosMemoryFree(writer[0]);
|
||||
writer[0] = NULL;
|
||||
|
@ -1915,7 +1915,7 @@ static int32_t tsdbDataFileWriterOpenTombFD(SDataFileWriter *writer) {
|
|||
int32_t flag = (TD_FILE_READ | TD_FILE_WRITE | TD_FILE_CREATE | TD_FILE_TRUNC);
|
||||
|
||||
int32_t lcn = writer->files[ftype].lcn;
|
||||
tsdbTFileName(writer->config->tsdb, writer->files + ftype, fname);
|
||||
(void)tsdbTFileName(writer->config->tsdb, writer->files + ftype, fname);
|
||||
|
||||
TAOS_CHECK_GOTO(tsdbOpenFile(fname, writer->config->tsdb, flag, &writer->fd[ftype], lcn), &lino, _exit);
|
||||
|
||||
|
|
|
@ -102,8 +102,8 @@ static int32_t tsdbSaveFSToFile(STsdbFS *pFS, const char *fname) {
|
|||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
}
|
||||
tsdbFSToBinary(pData, pFS);
|
||||
taosCalcChecksumAppend(0, pData, size);
|
||||
(void)tsdbFSToBinary(pData, pFS);
|
||||
(void)taosCalcChecksumAppend(0, pData, size);
|
||||
|
||||
// save to file
|
||||
pFD = taosOpenFile(fname, TD_FILE_WRITE | TD_FILE_CREATE | TD_FILE_TRUNC | TD_FILE_WRITE_THROUGH);
|
||||
|
@ -125,7 +125,7 @@ _exit:
|
|||
tsdbError("%s failed at line %d since %s, fname:%s", __func__, lino, tstrerror(code), fname);
|
||||
}
|
||||
taosMemoryFree(pData);
|
||||
taosCloseFile(&pFD);
|
||||
(void)taosCloseFile(&pFD);
|
||||
return code;
|
||||
}
|
||||
|
||||
|
@ -267,14 +267,14 @@ void tsdbGetCurrentFName(STsdb *pTsdb, char *current, char *current_t) {
|
|||
|
||||
// CURRENT
|
||||
if (current) {
|
||||
vnodeGetPrimaryDir(pTsdb->path, pVnode->diskPrimary, pVnode->pTfs, current, TSDB_FILENAME_LEN);
|
||||
(void)vnodeGetPrimaryDir(pTsdb->path, pVnode->diskPrimary, pVnode->pTfs, current, TSDB_FILENAME_LEN);
|
||||
offset = strlen(current);
|
||||
snprintf(current + offset, TSDB_FILENAME_LEN - offset - 1, "%sCURRENT", TD_DIRSEP);
|
||||
}
|
||||
|
||||
// CURRENT.t
|
||||
if (current_t) {
|
||||
vnodeGetPrimaryDir(pTsdb->path, pVnode->diskPrimary, pVnode->pTfs, current_t, TSDB_FILENAME_LEN);
|
||||
(void)vnodeGetPrimaryDir(pTsdb->path, pVnode->diskPrimary, pVnode->pTfs, current_t, TSDB_FILENAME_LEN);
|
||||
offset = strlen(current_t);
|
||||
snprintf(current_t + offset, TSDB_FILENAME_LEN - offset - 1, "%sCURRENT.t", TD_DIRSEP);
|
||||
}
|
||||
|
@ -295,26 +295,26 @@ static int32_t load_fs(const char *fname, STsdbFS *pFS) {
|
|||
int64_t size;
|
||||
if (taosFStatFile(pFD, &size, NULL) < 0) {
|
||||
code = TAOS_SYSTEM_ERROR(errno);
|
||||
taosCloseFile(&pFD);
|
||||
(void)taosCloseFile(&pFD);
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
}
|
||||
|
||||
pData = taosMemoryMalloc(size);
|
||||
if (pData == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
taosCloseFile(&pFD);
|
||||
(void)taosCloseFile(&pFD);
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
}
|
||||
|
||||
if (taosReadFile(pFD, pData, size) < 0) {
|
||||
code = TAOS_SYSTEM_ERROR(errno);
|
||||
taosCloseFile(&pFD);
|
||||
(void)taosCloseFile(&pFD);
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
}
|
||||
|
||||
if (!taosCheckChecksumWhole(pData, size)) {
|
||||
code = TSDB_CODE_FILE_CORRUPTED;
|
||||
taosCloseFile(&pFD);
|
||||
(void)taosCloseFile(&pFD);
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
}
|
||||
|
||||
|
@ -326,7 +326,7 @@ _exit:
|
|||
tsdbError("%s failed at line %d since %s, fname:%s", __func__, lino, tstrerror(code), fname);
|
||||
}
|
||||
taosMemoryFree(pData);
|
||||
taosCloseFile(&pFD);
|
||||
(void)taosCloseFile(&pFD);
|
||||
return code;
|
||||
}
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ static int32_t create_fs(STsdb *pTsdb, STFileSystem **fs) {
|
|||
}
|
||||
|
||||
fs[0]->tsdb = pTsdb;
|
||||
tsem_init(&fs[0]->canEdit, 0, 1);
|
||||
(void)tsem_init(&fs[0]->canEdit, 0, 1);
|
||||
fs[0]->fsstate = TSDB_FS_STATE_NORMAL;
|
||||
fs[0]->neid = 0;
|
||||
TARRAY2_INIT(fs[0]->fSetArr);
|
||||
|
@ -60,7 +60,7 @@ static int32_t destroy_fs(STFileSystem **fs) {
|
|||
|
||||
TARRAY2_DESTROY(fs[0]->fSetArr, NULL);
|
||||
TARRAY2_DESTROY(fs[0]->fSetArrTmp, NULL);
|
||||
tsem_destroy(&fs[0]->canEdit);
|
||||
(void)tsem_destroy(&fs[0]->canEdit);
|
||||
taosMemoryFree(fs[0]);
|
||||
fs[0] = NULL;
|
||||
return 0;
|
||||
|
@ -69,7 +69,7 @@ static int32_t destroy_fs(STFileSystem **fs) {
|
|||
int32_t current_fname(STsdb *pTsdb, char *fname, EFCurrentT ftype) {
|
||||
int32_t offset = 0;
|
||||
|
||||
vnodeGetPrimaryDir(pTsdb->path, pTsdb->pVnode->diskPrimary, pTsdb->pVnode->pTfs, fname, TSDB_FILENAME_LEN);
|
||||
(void)vnodeGetPrimaryDir(pTsdb->path, pTsdb->pVnode->diskPrimary, pTsdb->pVnode->pTfs, fname, TSDB_FILENAME_LEN);
|
||||
offset = strlen(fname);
|
||||
snprintf(fname + offset, TSDB_FILENAME_LEN - offset - 1, "%s%s", TD_DIRSEP, gCurrentFname[ftype]);
|
||||
|
||||
|
@ -105,7 +105,7 @@ _exit:
|
|||
tsdbError("%s failed at %s:%d since %s", __func__, fname, __LINE__, tstrerror(code));
|
||||
}
|
||||
taosMemoryFree(data);
|
||||
taosCloseFile(&fp);
|
||||
(void)taosCloseFile(&fp);
|
||||
return code;
|
||||
}
|
||||
|
||||
|
@ -144,7 +144,7 @@ _exit:
|
|||
tsdbError("%s failed at %s:%d since %s", __func__, fname, __LINE__, tstrerror(code));
|
||||
json[0] = NULL;
|
||||
}
|
||||
taosCloseFile(&fp);
|
||||
(void)taosCloseFile(&fp);
|
||||
taosMemoryFree(data);
|
||||
return code;
|
||||
}
|
||||
|
@ -174,7 +174,7 @@ int32_t save_fs(const TFileSetArray *arr, const char *fname) {
|
|||
if (!item) {
|
||||
TSDB_CHECK_CODE(code = TSDB_CODE_OUT_OF_MEMORY, lino, _exit);
|
||||
}
|
||||
cJSON_AddItemToArray(ajson, item);
|
||||
(void)cJSON_AddItemToArray(ajson, item);
|
||||
|
||||
code = tsdbTFileSetToJson(fset, item);
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
|
@ -255,7 +255,7 @@ static int32_t apply_commit(STFileSystem *fs) {
|
|||
if (fset1 && fset2) {
|
||||
if (fset1->fid < fset2->fid) {
|
||||
// delete fset1
|
||||
tsdbTFileSetRemove(fset1);
|
||||
(void)tsdbTFileSetRemove(fset1);
|
||||
i1++;
|
||||
} else if (fset1->fid > fset2->fid) {
|
||||
// create new file set with fid of fset2->fid
|
||||
|
@ -274,7 +274,7 @@ static int32_t apply_commit(STFileSystem *fs) {
|
|||
}
|
||||
} else if (fset1) {
|
||||
// delete fset1
|
||||
tsdbTFileSetRemove(fset1);
|
||||
(void)tsdbTFileSetRemove(fset1);
|
||||
i1++;
|
||||
} else {
|
||||
// create new file set with fid of fset2->fid
|
||||
|
@ -298,11 +298,11 @@ static int32_t commit_edit(STFileSystem *fs) {
|
|||
char current[TSDB_FILENAME_LEN];
|
||||
char current_t[TSDB_FILENAME_LEN];
|
||||
|
||||
current_fname(fs->tsdb, current, TSDB_FCURRENT);
|
||||
(void)current_fname(fs->tsdb, current, TSDB_FCURRENT);
|
||||
if (fs->etype == TSDB_FEDIT_COMMIT) {
|
||||
current_fname(fs->tsdb, current_t, TSDB_FCURRENT_C);
|
||||
(void)current_fname(fs->tsdb, current_t, TSDB_FCURRENT_C);
|
||||
} else {
|
||||
current_fname(fs->tsdb, current_t, TSDB_FCURRENT_M);
|
||||
(void)current_fname(fs->tsdb, current_t, TSDB_FCURRENT_M);
|
||||
}
|
||||
|
||||
int32_t code;
|
||||
|
@ -333,9 +333,9 @@ static int32_t abort_edit(STFileSystem *fs) {
|
|||
char fname[TSDB_FILENAME_LEN];
|
||||
|
||||
if (fs->etype == TSDB_FEDIT_COMMIT) {
|
||||
current_fname(fs->tsdb, fname, TSDB_FCURRENT_C);
|
||||
(void)current_fname(fs->tsdb, fname, TSDB_FCURRENT_C);
|
||||
} else {
|
||||
current_fname(fs->tsdb, fname, TSDB_FCURRENT_M);
|
||||
(void)current_fname(fs->tsdb, fname, TSDB_FCURRENT_M);
|
||||
}
|
||||
|
||||
int32_t code;
|
||||
|
@ -368,7 +368,7 @@ static int32_t tsdbFSDoScanAndFixFile(STFileSystem *fs, const STFileObj *fobj) {
|
|||
|
||||
if (tsS3Enabled && fobj->f->lcn > 1) {
|
||||
char fname1[TSDB_FILENAME_LEN];
|
||||
tsdbTFileLastChunkName(fs->tsdb, fobj->f, fname1);
|
||||
(void)tsdbTFileLastChunkName(fs->tsdb, fobj->f, fname1);
|
||||
if (!taosCheckExistFile(fname1)) {
|
||||
code = TSDB_CODE_FILE_CORRUPTED;
|
||||
tsdbError("vgId:%d %s failed since file:%s does not exist", TD_VID(fs->tsdb->pVnode), __func__, fname1);
|
||||
|
@ -419,7 +419,7 @@ static int32_t tsdbFSCreateFileObjHash(STFileSystem *fs, STFileHash *hash) {
|
|||
}
|
||||
|
||||
// vnode.json
|
||||
current_fname(fs->tsdb, fname, TSDB_FCURRENT);
|
||||
(void)current_fname(fs->tsdb, fname, TSDB_FCURRENT);
|
||||
code = tsdbFSAddEntryToFileObjHash(hash, fname);
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
|
||||
|
@ -603,9 +603,9 @@ static int32_t open_fs(STFileSystem *fs, int8_t rollback) {
|
|||
char cCurrent[TSDB_FILENAME_LEN];
|
||||
char mCurrent[TSDB_FILENAME_LEN];
|
||||
|
||||
current_fname(pTsdb, fCurrent, TSDB_FCURRENT);
|
||||
current_fname(pTsdb, cCurrent, TSDB_FCURRENT_C);
|
||||
current_fname(pTsdb, mCurrent, TSDB_FCURRENT_M);
|
||||
(void)current_fname(pTsdb, fCurrent, TSDB_FCURRENT);
|
||||
(void)current_fname(pTsdb, cCurrent, TSDB_FCURRENT_C);
|
||||
(void)current_fname(pTsdb, mCurrent, TSDB_FCURRENT_M);
|
||||
|
||||
if (taosCheckExistFile(fCurrent)) { // current.json exists
|
||||
code = load_fs(pTsdb, fCurrent, fs->fSetArr);
|
||||
|
@ -744,7 +744,7 @@ int32_t tsdbOpenFS(STsdb *pTsdb, STFileSystem **fs, int8_t rollback) {
|
|||
_exit:
|
||||
if (code) {
|
||||
tsdbError("vgId:%d %s failed at line %d since %s", TD_VID(pTsdb->pVnode), __func__, lino, tstrerror(code));
|
||||
destroy_fs(fs);
|
||||
(void)destroy_fs(fs);
|
||||
} else {
|
||||
tsdbInfo("vgId:%d %s success", TD_VID(pTsdb->pVnode), __func__);
|
||||
}
|
||||
|
@ -777,7 +777,7 @@ int32_t tsdbDisableAndCancelAllBgTask(STsdb *pTsdb) {
|
|||
}
|
||||
fset->channel = (SVAChannelID){0};
|
||||
fset->mergeScheduled = false;
|
||||
tsdbFSSetBlockCommit(fset, false);
|
||||
(void)tsdbFSSetBlockCommit(fset, false);
|
||||
fset->channelOpened = false;
|
||||
}
|
||||
}
|
||||
|
@ -787,12 +787,12 @@ int32_t tsdbDisableAndCancelAllBgTask(STsdb *pTsdb) {
|
|||
// destroy all channels
|
||||
for (int32_t i = 0; i < taosArrayGetSize(channelArray); i++) {
|
||||
SVAChannelID *channel = taosArrayGet(channelArray, i);
|
||||
vnodeAChannelDestroy(channel, true);
|
||||
(void)vnodeAChannelDestroy(channel, true);
|
||||
}
|
||||
taosArrayDestroy(channelArray);
|
||||
|
||||
#ifdef TD_ENTERPRISE
|
||||
tsdbStopAllCompTask(pTsdb);
|
||||
(void)tsdbStopAllCompTask(pTsdb);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
@ -807,9 +807,9 @@ int32_t tsdbEnableBgTask(STsdb *pTsdb) {
|
|||
int32_t tsdbCloseFS(STFileSystem **fs) {
|
||||
if (fs[0] == NULL) return 0;
|
||||
|
||||
tsdbDisableAndCancelAllBgTask((*fs)->tsdb);
|
||||
close_file_system(fs[0]);
|
||||
destroy_fs(fs);
|
||||
(void)tsdbDisableAndCancelAllBgTask((*fs)->tsdb);
|
||||
(void)close_file_system(fs[0]);
|
||||
(void)destroy_fs(fs);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -832,12 +832,12 @@ int32_t tsdbFSEditBegin(STFileSystem *fs, const TFileOpArray *opArray, EFEditT e
|
|||
char current_t[TSDB_FILENAME_LEN];
|
||||
|
||||
if (etype == TSDB_FEDIT_COMMIT) {
|
||||
current_fname(fs->tsdb, current_t, TSDB_FCURRENT_C);
|
||||
(void)current_fname(fs->tsdb, current_t, TSDB_FCURRENT_C);
|
||||
} else {
|
||||
current_fname(fs->tsdb, current_t, TSDB_FCURRENT_M);
|
||||
(void)current_fname(fs->tsdb, current_t, TSDB_FCURRENT_M);
|
||||
}
|
||||
|
||||
tsem_wait(&fs->canEdit);
|
||||
(void)tsem_wait(&fs->canEdit);
|
||||
fs->etype = etype;
|
||||
|
||||
// edit
|
||||
|
@ -864,7 +864,7 @@ static int32_t tsdbFSSetBlockCommit(STFileSet *fset, bool block) {
|
|||
} else {
|
||||
fset->blockCommit = false;
|
||||
if (fset->numWaitCommit > 0) {
|
||||
taosThreadCondSignal(&fset->canCommit);
|
||||
(void)taosThreadCondSignal(&fset->canCommit);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
@ -873,11 +873,11 @@ static int32_t tsdbFSSetBlockCommit(STFileSet *fset, bool block) {
|
|||
int32_t tsdbFSCheckCommit(STsdb *tsdb, int32_t fid) {
|
||||
(void)taosThreadMutexLock(&tsdb->mutex);
|
||||
STFileSet *fset;
|
||||
tsdbFSGetFSet(tsdb->pFS, fid, &fset);
|
||||
(void)tsdbFSGetFSet(tsdb->pFS, fid, &fset);
|
||||
if (fset) {
|
||||
while (fset->blockCommit) {
|
||||
fset->numWaitCommit++;
|
||||
taosThreadCondWait(&fset->canCommit, &tsdb->mutex);
|
||||
(void)taosThreadCondWait(&fset->canCommit, &tsdb->mutex);
|
||||
fset->numWaitCommit--;
|
||||
}
|
||||
}
|
||||
|
@ -901,13 +901,13 @@ int32_t tsdbFSEditCommit(STFileSystem *fs) {
|
|||
STFileSet *fset;
|
||||
TARRAY2_FOREACH_REVERSE(fs->fSetArr, fset) {
|
||||
if (TARRAY2_SIZE(fset->lvlArr) == 0) {
|
||||
tsdbFSSetBlockCommit(fset, false);
|
||||
(void)tsdbFSSetBlockCommit(fset, false);
|
||||
continue;
|
||||
}
|
||||
|
||||
SSttLvl *lvl = TARRAY2_FIRST(fset->lvlArr);
|
||||
if (lvl->level != 0) {
|
||||
tsdbFSSetBlockCommit(fset, false);
|
||||
(void)tsdbFSSetBlockCommit(fset, false);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -932,9 +932,9 @@ int32_t tsdbFSEditCommit(STFileSystem *fs) {
|
|||
}
|
||||
|
||||
if (numFile >= sttTrigger * BLOCK_COMMIT_FACTOR) {
|
||||
tsdbFSSetBlockCommit(fset, true);
|
||||
(void)tsdbFSSetBlockCommit(fset, true);
|
||||
} else {
|
||||
tsdbFSSetBlockCommit(fset, false);
|
||||
(void)tsdbFSSetBlockCommit(fset, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -945,13 +945,13 @@ _exit:
|
|||
} else {
|
||||
tsdbInfo("vgId:%d %s done, etype:%d", TD_VID(fs->tsdb->pVnode), __func__, fs->etype);
|
||||
}
|
||||
tsem_post(&fs->canEdit);
|
||||
(void)tsem_post(&fs->canEdit);
|
||||
return code;
|
||||
}
|
||||
|
||||
int32_t tsdbFSEditAbort(STFileSystem *fs) {
|
||||
int32_t code = abort_edit(fs);
|
||||
tsem_post(&fs->canEdit);
|
||||
(void)tsem_post(&fs->canEdit);
|
||||
return code;
|
||||
}
|
||||
|
||||
|
@ -1163,7 +1163,7 @@ int32_t tsdbFSCreateRefRangedSnapshot(STFileSystem *fs, int64_t sver, int64_t ev
|
|||
(void)taosThreadMutexUnlock(&fs->tsdb->mutex);
|
||||
|
||||
if (code) {
|
||||
tsdbTFileSetRangeClear(&fsr1);
|
||||
(void)tsdbTFileSetRangeClear(&fsr1);
|
||||
TARRAY2_DESTROY(fsrArr[0], tsdbTFileSetRangeClear);
|
||||
fsrArr[0] = NULL;
|
||||
}
|
||||
|
@ -1181,15 +1181,15 @@ int32_t tsdbFSDestroyRefRangedSnapshot(TFileSetRangeArray **fsrArr) { return tsd
|
|||
int32_t tsdbBeginTaskOnFileSet(STsdb *tsdb, int32_t fid, STFileSet **fset) {
|
||||
int16_t sttTrigger = tsdb->pVnode->config.sttTrigger;
|
||||
|
||||
tsdbFSGetFSet(tsdb->pFS, fid, fset);
|
||||
(void)tsdbFSGetFSet(tsdb->pFS, fid, fset);
|
||||
if (sttTrigger == 1 && (*fset)) {
|
||||
for (;;) {
|
||||
if ((*fset)->taskRunning) {
|
||||
(*fset)->numWaitTask++;
|
||||
|
||||
taosThreadCondWait(&(*fset)->beginTask, &tsdb->mutex);
|
||||
(void)taosThreadCondWait(&(*fset)->beginTask, &tsdb->mutex);
|
||||
|
||||
tsdbFSGetFSet(tsdb->pFS, fid, fset);
|
||||
(void)tsdbFSGetFSet(tsdb->pFS, fid, fset);
|
||||
ASSERT(fset != NULL);
|
||||
|
||||
(*fset)->numWaitTask--;
|
||||
|
@ -1209,11 +1209,11 @@ int32_t tsdbFinishTaskOnFileSet(STsdb *tsdb, int32_t fid) {
|
|||
int16_t sttTrigger = tsdb->pVnode->config.sttTrigger;
|
||||
if (sttTrigger == 1) {
|
||||
STFileSet *fset = NULL;
|
||||
tsdbFSGetFSet(tsdb->pFS, fid, &fset);
|
||||
(void)tsdbFSGetFSet(tsdb->pFS, fid, &fset);
|
||||
if (fset != NULL && fset->taskRunning) {
|
||||
fset->taskRunning = false;
|
||||
if (fset->numWaitTask > 0) {
|
||||
taosThreadCondSignal(&fset->beginTask);
|
||||
(void)taosThreadCondSignal(&fset->beginTask);
|
||||
}
|
||||
tsdbInfo("vgId:%d finish task on file set:%d", TD_VID(tsdb->pVnode), fid);
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ static int32_t tsdbSttLvlInitEx(STsdb *pTsdb, const SSttLvl *lvl1, SSttLvl **lvl
|
|||
STFileObj *fobj;
|
||||
code = tsdbTFileObjInit(pTsdb, fobj1->f, &fobj);
|
||||
if (code) {
|
||||
tsdbSttLvlClear(lvl);
|
||||
(void)tsdbSttLvlClear(lvl);
|
||||
return code;
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ static int32_t tsdbSttLvlInitRef(STsdb *pTsdb, const SSttLvl *lvl1, SSttLvl **lv
|
|||
|
||||
STFileObj *fobj1;
|
||||
TARRAY2_FOREACH(lvl1->fobjArr, fobj1) {
|
||||
tsdbTFileObjRef(fobj1);
|
||||
(void)tsdbTFileObjRef(fobj1);
|
||||
code = TARRAY2_APPEND(lvl[0]->fobjArr, fobj1);
|
||||
if (code) return code;
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ static int32_t tsdbSttLvlFilteredInitEx(STsdb *pTsdb, const SSttLvl *lvl1, int64
|
|||
STFileObj *fobj;
|
||||
code = tsdbTFileObjInit(pTsdb, fobj1->f, &fobj);
|
||||
if (code) {
|
||||
tsdbSttLvlClear(lvl);
|
||||
(void)tsdbSttLvlClear(lvl);
|
||||
return code;
|
||||
}
|
||||
|
||||
|
@ -96,7 +96,7 @@ static int32_t tsdbSttLvlFilteredInitEx(STsdb *pTsdb, const SSttLvl *lvl1, int64
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void tsdbSttLvlRemoveFObj(void *data) { tsdbTFileObjRemove(*(STFileObj **)data); }
|
||||
static void tsdbSttLvlRemoveFObj(void *data) { (void)tsdbTFileObjRemove(*(STFileObj **)data); }
|
||||
static void tsdbSttLvlRemove(SSttLvl **lvl) {
|
||||
TARRAY2_DESTROY(lvl[0]->fobjArr, tsdbSttLvlRemoveFObj);
|
||||
taosMemoryFree(lvl[0]);
|
||||
|
@ -173,7 +173,7 @@ static int32_t tsdbSttLvlToJson(const SSttLvl *lvl, cJSON *json) {
|
|||
TARRAY2_FOREACH(lvl->fobjArr, fobj) {
|
||||
cJSON *item = cJSON_CreateObject();
|
||||
if (item == NULL) return TSDB_CODE_OUT_OF_MEMORY;
|
||||
cJSON_AddItemToArray(ajson, item);
|
||||
(void)cJSON_AddItemToArray(ajson, item);
|
||||
|
||||
int32_t code = tsdbTFileToJson(fobj->f, item);
|
||||
if (code) return code;
|
||||
|
@ -198,7 +198,7 @@ static int32_t tsdbJsonToSttLvl(STsdb *pTsdb, const cJSON *json, SSttLvl **lvl)
|
|||
|
||||
item1 = cJSON_GetObjectItem(json, "files");
|
||||
if (!cJSON_IsArray(item1)) {
|
||||
tsdbSttLvlClear(lvl);
|
||||
(void)tsdbSttLvlClear(lvl);
|
||||
return TSDB_CODE_FILE_CORRUPTED;
|
||||
}
|
||||
|
||||
|
@ -206,14 +206,14 @@ static int32_t tsdbJsonToSttLvl(STsdb *pTsdb, const cJSON *json, SSttLvl **lvl)
|
|||
STFile tf;
|
||||
code = tsdbJsonToTFile(item2, TSDB_FTYPE_STT, &tf);
|
||||
if (code) {
|
||||
tsdbSttLvlClear(lvl);
|
||||
(void)tsdbSttLvlClear(lvl);
|
||||
return code;
|
||||
}
|
||||
|
||||
STFileObj *fobj;
|
||||
code = tsdbTFileObjInit(pTsdb, &tf, &fobj);
|
||||
if (code) {
|
||||
tsdbSttLvlClear(lvl);
|
||||
(void)tsdbSttLvlClear(lvl);
|
||||
return code;
|
||||
}
|
||||
|
||||
|
@ -247,7 +247,7 @@ int32_t tsdbTFileSetToJson(const STFileSet *fset, cJSON *json) {
|
|||
TARRAY2_FOREACH(fset->lvlArr, lvl) {
|
||||
item2 = cJSON_CreateObject();
|
||||
if (!item2) return TSDB_CODE_OUT_OF_MEMORY;
|
||||
cJSON_AddItemToArray(item1, item2);
|
||||
(void)cJSON_AddItemToArray(item1, item2);
|
||||
|
||||
code = tsdbSttLvlToJson(lvl, item2);
|
||||
if (code) return code;
|
||||
|
@ -347,7 +347,7 @@ int32_t tsdbTFileSetEdit(STsdb *pTsdb, STFileSet *fset, const STFileOp *op) {
|
|||
TARRAY2_REMOVE(lvl->fobjArr, idx, tsdbSttLvlClearFObj);
|
||||
} else {
|
||||
ASSERT(tsdbIsSameTFile(&op->of, fset->farr[op->of.type]->f));
|
||||
tsdbTFileObjUnref(fset->farr[op->of.type]);
|
||||
(void)tsdbTFileObjUnref(fset->farr[op->of.type]);
|
||||
fset->farr[op->of.type] = NULL;
|
||||
}
|
||||
} else {
|
||||
|
@ -389,9 +389,9 @@ int32_t tsdbTFileSetApplyEdit(STsdb *pTsdb, const STFileSet *fset1, STFileSet *f
|
|||
}
|
||||
} else {
|
||||
if (fobj1->f->cid != fobj2->f->cid) {
|
||||
tsdbTFileObjRemove(fobj2);
|
||||
(void)tsdbTFileObjRemove(fobj2);
|
||||
} else {
|
||||
tsdbTFileObjRemoveUpdateLC(fobj2);
|
||||
(void)tsdbTFileObjRemoveUpdateLC(fobj2);
|
||||
}
|
||||
code = tsdbTFileObjInit(pTsdb, fobj1->f, &fset2->farr[ftype]);
|
||||
if (code) return code;
|
||||
|
@ -402,7 +402,7 @@ int32_t tsdbTFileSetApplyEdit(STsdb *pTsdb, const STFileSet *fset1, STFileSet *f
|
|||
if (code) return code;
|
||||
} else {
|
||||
// remove the file
|
||||
tsdbTFileObjRemove(fobj2);
|
||||
(void)tsdbTFileObjRemove(fobj2);
|
||||
fset2->farr[ftype] = NULL;
|
||||
}
|
||||
}
|
||||
|
@ -460,12 +460,12 @@ int32_t tsdbTFileSetInit(int32_t fid, STFileSet **fset) {
|
|||
TARRAY2_INIT(fset[0]->lvlArr);
|
||||
|
||||
// background task queue
|
||||
taosThreadCondInit(&(*fset)->beginTask, NULL);
|
||||
(void)taosThreadCondInit(&(*fset)->beginTask, NULL);
|
||||
(*fset)->taskRunning = false;
|
||||
(*fset)->numWaitTask = 0;
|
||||
|
||||
// block commit variables
|
||||
taosThreadCondInit(&fset[0]->canCommit, NULL);
|
||||
(void)taosThreadCondInit(&fset[0]->canCommit, NULL);
|
||||
(*fset)->numWaitCommit = 0;
|
||||
(*fset)->blockCommit = false;
|
||||
|
||||
|
@ -522,7 +522,8 @@ int32_t tsdbTFileSetFilteredInitDup(STsdb *pTsdb, const STFileSet *fset1, int64_
|
|||
.fid = fobj->f->fid,
|
||||
.of = fobj->f[0],
|
||||
};
|
||||
TARRAY2_APPEND(fopArr, op);
|
||||
code = TARRAY2_APPEND(fopArr, op);
|
||||
if (code) return code;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -567,7 +568,7 @@ int32_t tsdbTFileSetInitRef(STsdb *pTsdb, const STFileSet *fset1, STFileSet **fs
|
|||
for (int32_t ftype = TSDB_FTYPE_MIN; ftype < TSDB_FTYPE_MAX; ++ftype) {
|
||||
if (fset1->farr[ftype] == NULL) continue;
|
||||
|
||||
tsdbTFileObjRef(fset1->farr[ftype]);
|
||||
(void)tsdbTFileObjRef(fset1->farr[ftype]);
|
||||
fset[0]->farr[ftype] = fset1->farr[ftype];
|
||||
}
|
||||
|
||||
|
@ -609,13 +610,13 @@ void tsdbTFileSetClear(STFileSet **fset) {
|
|||
if (fset && *fset) {
|
||||
for (tsdb_ftype_t ftype = TSDB_FTYPE_MIN; ftype < TSDB_FTYPE_MAX; ++ftype) {
|
||||
if ((*fset)->farr[ftype] == NULL) continue;
|
||||
tsdbTFileObjUnref((*fset)->farr[ftype]);
|
||||
(void)tsdbTFileObjUnref((*fset)->farr[ftype]);
|
||||
}
|
||||
|
||||
TARRAY2_DESTROY((*fset)->lvlArr, tsdbSttLvlClear);
|
||||
|
||||
taosThreadCondDestroy(&(*fset)->beginTask);
|
||||
taosThreadCondDestroy(&(*fset)->canCommit);
|
||||
(void)taosThreadCondDestroy(&(*fset)->beginTask);
|
||||
(void)taosThreadCondDestroy(&(*fset)->canCommit);
|
||||
taosMemoryFreeClear(*fset);
|
||||
}
|
||||
}
|
||||
|
@ -625,7 +626,7 @@ int32_t tsdbTFileSetRemove(STFileSet *fset) {
|
|||
|
||||
for (tsdb_ftype_t ftype = TSDB_FTYPE_MIN; ftype < TSDB_FTYPE_MAX; ++ftype) {
|
||||
if (fset->farr[ftype] != NULL) {
|
||||
tsdbTFileObjRemove(fset->farr[ftype]);
|
||||
(void)tsdbTFileObjRemove(fset->farr[ftype]);
|
||||
fset->farr[ftype] = NULL;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ static int32_t tsdbFSetWriteTableDataBegin(SFSetWriter *writer, const TABLEID *t
|
|||
writer->ctx->tbid->uid = tbid->uid;
|
||||
|
||||
code = tsdbUpdateSkmTb(writer->config->tsdb, writer->ctx->tbid, writer->skmTb);
|
||||
TSDB_CHECK_CODE(code , lino, _exit);
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
|
||||
code = metaGetColCmpr(writer->config->tsdb->pVnode->pMeta, tbid->suid ? tbid->suid : tbid->uid, &writer->pColCmprObj);
|
||||
// TODO: TSDB_CHECK_CODE(code, lino, _exit);
|
||||
|
|
|
@ -221,7 +221,7 @@ void tsdbDelFileName(STsdb *pTsdb, SDelFile *pFile, char fname[]) {
|
|||
int32_t offset = 0;
|
||||
SVnode *pVnode = pTsdb->pVnode;
|
||||
|
||||
vnodeGetPrimaryDir(pTsdb->path, pVnode->diskPrimary, pVnode->pTfs, fname, TSDB_FILENAME_LEN);
|
||||
(void)vnodeGetPrimaryDir(pTsdb->path, pVnode->diskPrimary, pVnode->pTfs, fname, TSDB_FILENAME_LEN);
|
||||
offset = strlen(fname);
|
||||
snprintf((char *)fname + offset, TSDB_FILENAME_LEN - offset - 1, "%sv%dver%" PRId64 ".del", TD_DIRSEP,
|
||||
TD_VID(pTsdb->pVnode), pFile->commitID);
|
||||
|
|
|
@ -224,7 +224,7 @@ static int32_t tsdbMemTableIterNext(STsdbIter *iter, const TABLEID *tbid) {
|
|||
|
||||
iter->row->row = row[0];
|
||||
|
||||
tsdbTbDataIterNext(iter->memtData->tbIter);
|
||||
(void)tsdbTbDataIterNext(iter->memtData->tbIter);
|
||||
goto _exit;
|
||||
}
|
||||
|
||||
|
|
|
@ -410,7 +410,7 @@ static int32_t tsdbGetOrCreateTbData(SMemTable *pMemTable, tb_uid_t suid, tb_uid
|
|||
pMemTable->aBucket[idx] = pTbData;
|
||||
pMemTable->nTbData++;
|
||||
|
||||
tRBTreePut(pMemTable->tbDataTree, pTbData->rbtn);
|
||||
(void)tRBTreePut(pMemTable->tbDataTree, pTbData->rbtn);
|
||||
|
||||
taosWUnLockLatch(&pMemTable->latch);
|
||||
|
||||
|
@ -742,7 +742,7 @@ int32_t tsdbRefMemTable(SMemTable *pMemTable, SQueryNode *pQNode) {
|
|||
int32_t nRef = atomic_fetch_add_32(&pMemTable->nRef, 1);
|
||||
ASSERT(nRef > 0);
|
||||
|
||||
vnodeBufPoolRegisterQuery(pMemTable->pPool, pQNode);
|
||||
(void)vnodeBufPoolRegisterQuery(pMemTable->pPool, pQNode);
|
||||
|
||||
_exit:
|
||||
return code;
|
||||
|
|
|
@ -215,7 +215,7 @@ static int32_t tsdbMergeFileSetBeginOpenReader(SMerger *merger) {
|
|||
TAOS_CHECK_GOTO(tsdbSttFileReaderOpen(fobj->fname, &config, &reader), &lino, _exit);
|
||||
|
||||
if ((code = TARRAY2_APPEND(merger->sttReaderArr, reader))) {
|
||||
tsdbSttFileReaderClose(&reader);
|
||||
(void)tsdbSttFileReaderClose(&reader);
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
}
|
||||
}
|
||||
|
@ -230,7 +230,7 @@ _exit:
|
|||
if (code) {
|
||||
tsdbError("vgId:%d %s failed at %s:%d since %s", TD_VID(merger->tsdb->pVnode), __func__, __FILE__, lino,
|
||||
tstrerror(code));
|
||||
tsdbMergeFileSetEndCloseReader(merger);
|
||||
(void)tsdbMergeFileSetEndCloseReader(merger);
|
||||
}
|
||||
return code;
|
||||
}
|
||||
|
@ -282,7 +282,7 @@ static int32_t tsdbMergeFileSetBeginOpenWriter(SMerger *merger) {
|
|||
|
||||
TAOS_CHECK_GOTO(tfsAllocDisk(merger->tsdb->pVnode->pTfs, level, &did), &lino, _exit);
|
||||
|
||||
tfsMkdirRecurAt(merger->tsdb->pVnode->pTfs, merger->tsdb->path, did);
|
||||
(void)tfsMkdirRecurAt(merger->tsdb->pVnode->pTfs, merger->tsdb->path, did);
|
||||
SFSetWriterConfig config = {
|
||||
.tsdb = merger->tsdb,
|
||||
.toSttOnly = true,
|
||||
|
@ -355,9 +355,9 @@ static int32_t tsdbMergeFileSetEndCloseWriter(SMerger *merger) {
|
|||
}
|
||||
|
||||
static int32_t tsdbMergeFileSetEndCloseIter(SMerger *merger) {
|
||||
tsdbIterMergerClose(&merger->tombIterMerger);
|
||||
(void)tsdbIterMergerClose(&merger->tombIterMerger);
|
||||
TARRAY2_CLEAR(merger->tombIterArr, tsdbIterClose);
|
||||
tsdbIterMergerClose(&merger->dataIterMerger);
|
||||
(void)tsdbIterMergerClose(&merger->dataIterMerger);
|
||||
TARRAY2_CLEAR(merger->dataIterArr, tsdbIterClose);
|
||||
return 0;
|
||||
}
|
||||
|
@ -479,7 +479,7 @@ static int32_t tsdbMergeGetFSet(SMerger *merger) {
|
|||
STFileSet *fset;
|
||||
|
||||
(void)taosThreadMutexLock(&merger->tsdb->mutex);
|
||||
tsdbFSGetFSet(merger->tsdb->pFS, merger->fid, &fset);
|
||||
(void)tsdbFSGetFSet(merger->tsdb->pFS, merger->fid, &fset);
|
||||
if (fset == NULL) {
|
||||
(void)taosThreadMutexUnlock(&merger->tsdb->mutex);
|
||||
return 0;
|
||||
|
|
|
@ -57,18 +57,18 @@ int32_t tsdbOpen(SVnode *pVnode, STsdb **ppTsdb, const char *dir, STsdbKeepCfg *
|
|||
snprintf(pTsdb->path, TD_PATH_MAX, "%s%s%s", pVnode->path, TD_DIRSEP, dir);
|
||||
// taosRealPath(pTsdb->path, NULL, slen);
|
||||
pTsdb->pVnode = pVnode;
|
||||
taosThreadMutexInit(&pTsdb->mutex, NULL);
|
||||
(void)taosThreadMutexInit(&pTsdb->mutex, NULL);
|
||||
if (!pKeepCfg) {
|
||||
tsdbSetKeepCfg(pTsdb, &pVnode->config.tsdbCfg);
|
||||
(void)tsdbSetKeepCfg(pTsdb, &pVnode->config.tsdbCfg);
|
||||
} else {
|
||||
memcpy(&pTsdb->keepCfg, pKeepCfg, sizeof(STsdbKeepCfg));
|
||||
}
|
||||
|
||||
// create dir
|
||||
if (pVnode->pTfs) {
|
||||
tfsMkdir(pVnode->pTfs, pTsdb->path);
|
||||
(void)tfsMkdir(pVnode->pTfs, pTsdb->path);
|
||||
} else {
|
||||
taosMkDir(pTsdb->path);
|
||||
(void)taosMkDir(pTsdb->path);
|
||||
}
|
||||
|
||||
// open tsdb
|
||||
|
@ -87,8 +87,8 @@ int32_t tsdbOpen(SVnode *pVnode, STsdb **ppTsdb, const char *dir, STsdbKeepCfg *
|
|||
_exit:
|
||||
if (code) {
|
||||
tsdbError("vgId:%d %s failed at %s:%d since %s", TD_VID(pVnode), __func__, __FILE__, lino, tstrerror(code));
|
||||
tsdbCloseFS(&pTsdb->pFS);
|
||||
taosThreadMutexDestroy(&pTsdb->mutex);
|
||||
(void)tsdbCloseFS(&pTsdb->pFS);
|
||||
(void)taosThreadMutexDestroy(&pTsdb->mutex);
|
||||
taosMemoryFree(pTsdb);
|
||||
} else {
|
||||
tsdbDebug("vgId:%d, tsdb is opened at %s, days:%d, keep:%d,%d,%d, keepTimeoffset:%d", TD_VID(pVnode), pTsdb->path,
|
||||
|
@ -110,12 +110,12 @@ int32_t tsdbClose(STsdb **pTsdb) {
|
|||
(*pTsdb)->mem = NULL;
|
||||
(void)taosThreadMutexUnlock(&(*pTsdb)->mutex);
|
||||
|
||||
tsdbCloseFS(&(*pTsdb)->pFS);
|
||||
(void)tsdbCloseFS(&(*pTsdb)->pFS);
|
||||
tsdbCloseCache(*pTsdb);
|
||||
#ifdef TD_ENTERPRISE
|
||||
tsdbCloseCompMonitor(*pTsdb);
|
||||
(void)tsdbCloseCompMonitor(*pTsdb);
|
||||
#endif
|
||||
taosThreadMutexDestroy(&(*pTsdb)->mutex);
|
||||
(void)taosThreadMutexDestroy(&(*pTsdb)->mutex);
|
||||
taosMemoryFreeClear(*pTsdb);
|
||||
}
|
||||
return 0;
|
||||
|
|
|
@ -48,7 +48,7 @@ typedef struct {
|
|||
static int32_t getCurrentBlockInfo(SDataBlockIter* pBlockIter, SFileDataBlockInfo** pInfo);
|
||||
static int32_t buildDataBlockFromBufImpl(STableBlockScanInfo* pBlockScanInfo, int64_t endKey, int32_t capacity,
|
||||
STsdbReader* pReader);
|
||||
static int32_t getValidMemRow(SIterInfo* pIter, const SArray* pDelList, STsdbReader* pReader, TSDBROW** pRes);
|
||||
static void getValidMemRow(SIterInfo* pIter, const SArray* pDelList, STsdbReader* pReader, TSDBROW** pRes);
|
||||
static int32_t doMergeRowsInFileBlocks(SBlockData* pBlockData, STableBlockScanInfo* pScanInfo, SRowKey* pKey,
|
||||
STsdbReader* pReader);
|
||||
static int32_t doMergeRowsInSttBlock(SSttBlockReader* pSttBlockReader, STableBlockScanInfo* pScanInfo,
|
||||
|
@ -3866,11 +3866,11 @@ bool hasBeenDropped(const SArray* pDelList, int32_t* index, int64_t key, int64_t
|
|||
return false;
|
||||
}
|
||||
|
||||
FORCE_INLINE int32_t getValidMemRow(SIterInfo* pIter, const SArray* pDelList, STsdbReader* pReader, TSDBROW** pRes) {
|
||||
FORCE_INLINE void getValidMemRow(SIterInfo* pIter, const SArray* pDelList, STsdbReader* pReader, TSDBROW** pRes) {
|
||||
*pRes = NULL;
|
||||
|
||||
if (!pIter->hasVal) {
|
||||
return TSDB_CODE_SUCCESS;
|
||||
return;
|
||||
}
|
||||
|
||||
int32_t order = pReader->info.order;
|
||||
|
@ -3880,20 +3880,20 @@ FORCE_INLINE int32_t getValidMemRow(SIterInfo* pIter, const SArray* pDelList, ST
|
|||
TSDBROW_INIT_KEY(pRow, key);
|
||||
if (outOfTimeWindow(key.ts, &pReader->info.window)) {
|
||||
pIter->hasVal = false;
|
||||
return TSDB_CODE_SUCCESS;
|
||||
return;
|
||||
}
|
||||
|
||||
// it is a valid data version
|
||||
if (key.version <= pReader->info.verRange.maxVer && key.version >= pReader->info.verRange.minVer) {
|
||||
if (pDelList == NULL || TARRAY_SIZE(pDelList) == 0) {
|
||||
*pRes = pRow;
|
||||
return TSDB_CODE_SUCCESS;
|
||||
return;
|
||||
} else {
|
||||
bool dropped = hasBeenDropped(pDelList, &pIter->index, key.ts, key.version, order, &pReader->info.verRange,
|
||||
pReader->suppInfo.numOfPks > 0);
|
||||
if (!dropped) {
|
||||
*pRes = pRow;
|
||||
return TSDB_CODE_SUCCESS;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3901,7 +3901,7 @@ FORCE_INLINE int32_t getValidMemRow(SIterInfo* pIter, const SArray* pDelList, ST
|
|||
while (1) {
|
||||
pIter->hasVal = tsdbTbDataIterNext(pIter->iter);
|
||||
if (!pIter->hasVal) {
|
||||
return TSDB_CODE_SUCCESS;
|
||||
return;
|
||||
}
|
||||
|
||||
pRow = tsdbTbDataIterGet(pIter->iter);
|
||||
|
@ -3909,19 +3909,19 @@ FORCE_INLINE int32_t getValidMemRow(SIterInfo* pIter, const SArray* pDelList, ST
|
|||
TSDBROW_INIT_KEY(pRow, key);
|
||||
if (outOfTimeWindow(key.ts, &pReader->info.window)) {
|
||||
pIter->hasVal = false;
|
||||
return TSDB_CODE_SUCCESS;
|
||||
return;
|
||||
}
|
||||
|
||||
if (key.version <= pReader->info.verRange.maxVer && key.version >= pReader->info.verRange.minVer) {
|
||||
if (pDelList == NULL || TARRAY_SIZE(pDelList) == 0) {
|
||||
*pRes = pRow;
|
||||
return TSDB_CODE_SUCCESS;
|
||||
return;
|
||||
} else {
|
||||
bool dropped = hasBeenDropped(pDelList, &pIter->index, key.ts, key.version, order, &pReader->info.verRange,
|
||||
pReader->suppInfo.numOfPks > 0);
|
||||
if (!dropped) {
|
||||
*pRes = pRow;
|
||||
return TSDB_CODE_SUCCESS;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ static int32_t tsdbOpenFileImpl(STsdbFD *pFD) {
|
|||
|
||||
int32_t vid = 0;
|
||||
const char *object_name = taosDirEntryBaseName((char *)path);
|
||||
sscanf(object_name, "v%df%dver%" PRId64 ".data", &vid, &pFD->fid, &pFD->cid);
|
||||
(void)sscanf(object_name, "v%df%dver%" PRId64 ".data", &vid, &pFD->fid, &pFD->cid);
|
||||
|
||||
char *dot = strrchr(lc_path, '.');
|
||||
if (!dot) {
|
||||
|
@ -124,7 +124,7 @@ void tsdbCloseFile(STsdbFD **ppFD) {
|
|||
if (pFD) {
|
||||
taosMemoryFree(pFD->pBuf);
|
||||
// if (!pFD->s3File) {
|
||||
taosCloseFile(&pFD->pFD);
|
||||
(void)taosCloseFile(&pFD->pFD);
|
||||
//}
|
||||
taosMemoryFree(pFD);
|
||||
*ppFD = NULL;
|
||||
|
@ -156,7 +156,7 @@ static int32_t tsdbWriteFilePage(STsdbFD *pFD, int32_t encryptAlgorithm, char *e
|
|||
TSDB_CHECK_CODE(code = TAOS_SYSTEM_ERROR(errno), lino, _exit);
|
||||
}
|
||||
|
||||
taosCalcChecksumAppend(0, pFD->pBuf, pFD->szPage);
|
||||
(void)taosCalcChecksumAppend(0, pFD->pBuf, pFD->szPage);
|
||||
|
||||
if (encryptAlgorithm == DND_CA_SM4) {
|
||||
// if(tsiEncryptAlgorithm == DND_CA_SM4 && (tsiEncryptScope & DND_CS_TSDB) == DND_CS_TSDB){
|
||||
|
@ -430,7 +430,7 @@ static int32_t tsdbReadFileS3(STsdbFD *pFD, int64_t offset, uint8_t *pBuf, int64
|
|||
code = tsdbCacheGetPageS3(pFD->pTsdb->pgCache, pFD, pgno, &handle);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
if (handle) {
|
||||
tsdbCacheRelease(pFD->pTsdb->pgCache, handle);
|
||||
(void)tsdbCacheRelease(pFD->pTsdb->pgCache, handle);
|
||||
}
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
}
|
||||
|
@ -441,7 +441,7 @@ static int32_t tsdbReadFileS3(STsdbFD *pFD, int64_t offset, uint8_t *pBuf, int64
|
|||
|
||||
uint8_t *pPage = (uint8_t *)taosLRUCacheValue(pFD->pTsdb->pgCache, handle);
|
||||
memcpy(pFD->pBuf, pPage, pFD->szPage);
|
||||
tsdbCacheRelease(pFD->pTsdb->pgCache, handle);
|
||||
(void)tsdbCacheRelease(pFD->pTsdb->pgCache, handle);
|
||||
|
||||
// check
|
||||
if (pgno > 1 && !taosCheckChecksumWhole(pFD->pBuf, pFD->szPage)) {
|
||||
|
@ -477,7 +477,7 @@ static int32_t tsdbReadFileS3(STsdbFD *pFD, int64_t offset, uint8_t *pBuf, int64
|
|||
int nPage = pgnoEnd - pgno + 1;
|
||||
for (int i = 0; i < nPage; ++i) {
|
||||
if (pFD->szFile != pgno) { // DONOT cache last volatile page
|
||||
tsdbCacheSetPageS3(pFD->pTsdb->pgCache, pFD, pgno, pBlock + i * pFD->szPage);
|
||||
(void)tsdbCacheSetPageS3(pFD->pTsdb->pgCache, pFD, pgno, pBlock + i * pFD->szPage);
|
||||
}
|
||||
|
||||
if (szHint > 0 && n >= size) {
|
||||
|
|
|
@ -71,8 +71,8 @@ static int32_t tsdbDoCopyFileLC(SRTNer *rtner, const STFileObj *from, const STFi
|
|||
char fname_from[TSDB_FILENAME_LEN];
|
||||
char fname_to[TSDB_FILENAME_LEN];
|
||||
|
||||
tsdbTFileLastChunkName(rtner->tsdb, from->f, fname_from);
|
||||
tsdbTFileLastChunkName(rtner->tsdb, to, fname_to);
|
||||
(void)tsdbTFileLastChunkName(rtner->tsdb, from->f, fname_from);
|
||||
(void)tsdbTFileLastChunkName(rtner->tsdb, to, fname_to);
|
||||
|
||||
fdFrom = taosOpenFile(fname_from, TD_FILE_READ);
|
||||
if (fdFrom == NULL) {
|
||||
|
@ -99,8 +99,8 @@ _exit:
|
|||
tsdbError("vgId:%d, %s failed at %s:%d since %s", TD_VID(rtner->tsdb->pVnode), __func__, __FILE__, lino,
|
||||
tstrerror(code));
|
||||
}
|
||||
taosCloseFile(&fdFrom);
|
||||
taosCloseFile(&fdTo);
|
||||
(void)taosCloseFile(&fdFrom);
|
||||
(void)taosCloseFile(&fdTo);
|
||||
return code;
|
||||
}
|
||||
|
||||
|
@ -112,7 +112,7 @@ static int32_t tsdbDoCopyFile(SRTNer *rtner, const STFileObj *from, const STFile
|
|||
TdFilePtr fdFrom = NULL;
|
||||
TdFilePtr fdTo = NULL;
|
||||
|
||||
tsdbTFileName(rtner->tsdb, to, fname);
|
||||
(void)tsdbTFileName(rtner->tsdb, to, fname);
|
||||
|
||||
fdFrom = taosOpenFile(from->fname, TD_FILE_READ);
|
||||
if (fdFrom == NULL) {
|
||||
|
@ -136,8 +136,8 @@ _exit:
|
|||
tsdbError("vgId:%d, %s failed at %s:%d since %s", TD_VID(rtner->tsdb->pVnode), __func__, __FILE__, lino,
|
||||
tstrerror(code));
|
||||
}
|
||||
taosCloseFile(&fdFrom);
|
||||
taosCloseFile(&fdTo);
|
||||
(void)taosCloseFile(&fdFrom);
|
||||
(void)taosCloseFile(&fdTo);
|
||||
return code;
|
||||
}
|
||||
|
||||
|
@ -255,7 +255,7 @@ static int32_t tsdbDoRetention(SRTNer *rtner) {
|
|||
SDiskID did;
|
||||
|
||||
TAOS_CHECK_GOTO(tfsAllocDisk(rtner->tsdb->pVnode->pTfs, expLevel, &did), &lino, _exit);
|
||||
tfsMkdirRecurAt(rtner->tsdb->pVnode->pTfs, rtner->tsdb->path, did);
|
||||
(void)tfsMkdirRecurAt(rtner->tsdb->pVnode->pTfs, rtner->tsdb->path, did);
|
||||
|
||||
// data
|
||||
for (int32_t ftype = 0; ftype < TSDB_FTYPE_MAX && (fobj = fset->farr[ftype], 1); ++ftype) {
|
||||
|
@ -316,7 +316,7 @@ static int32_t tsdbRetention(void *arg) {
|
|||
|
||||
// begin task
|
||||
(void)taosThreadMutexLock(&pTsdb->mutex);
|
||||
tsdbBeginTaskOnFileSet(pTsdb, rtnArg->fid, &fset);
|
||||
(void)tsdbBeginTaskOnFileSet(pTsdb, rtnArg->fid, &fset);
|
||||
if (fset && (code = tsdbTFileSetInitCopy(pTsdb, fset, &rtner.fset))) {
|
||||
(void)taosThreadMutexUnlock(&pTsdb->mutex);
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
|
@ -337,7 +337,7 @@ static int32_t tsdbRetention(void *arg) {
|
|||
_exit:
|
||||
if (rtner.fset) {
|
||||
(void)taosThreadMutexLock(&pTsdb->mutex);
|
||||
tsdbFinishTaskOnFileSet(pTsdb, rtnArg->fid);
|
||||
(void)tsdbFinishTaskOnFileSet(pTsdb, rtnArg->fid);
|
||||
(void)taosThreadMutexUnlock(&pTsdb->mutex);
|
||||
}
|
||||
|
||||
|
@ -427,7 +427,7 @@ static int32_t tsdbCopyFileS3(SRTNer *rtner, const STFileObj *from, const STFile
|
|||
TdFilePtr fdFrom = NULL;
|
||||
// TdFilePtr fdTo = NULL;
|
||||
|
||||
tsdbTFileName(rtner->tsdb, to, fname);
|
||||
(void)tsdbTFileName(rtner->tsdb, to, fname);
|
||||
|
||||
fdFrom = taosOpenFile(from->fname, TD_FILE_READ);
|
||||
if (fdFrom == NULL) {
|
||||
|
@ -442,7 +442,7 @@ _exit:
|
|||
tsdbError("vgId:%d %s failed at line %s:%d since %s", TD_VID(rtner->tsdb->pVnode), __func__, __FILE__, lino,
|
||||
tstrerror(code));
|
||||
}
|
||||
taosCloseFile(&fdFrom);
|
||||
(void)taosCloseFile(&fdFrom);
|
||||
return code;
|
||||
}
|
||||
|
||||
|
@ -486,7 +486,7 @@ static int32_t tsdbMigrateDataFileLCS3(SRTNer *rtner, const STFileObj *fobj, int
|
|||
TAOS_CHECK_GOTO(TARRAY2_APPEND(&rtner->fopArr, op), &lino, _exit);
|
||||
|
||||
char fname[TSDB_FILENAME_LEN];
|
||||
tsdbTFileName(rtner->tsdb, &op.nf, fname);
|
||||
(void)tsdbTFileName(rtner->tsdb, &op.nf, fname);
|
||||
char *object_name = taosDirEntryBaseName(fname);
|
||||
char object_name_prefix[TSDB_FILENAME_LEN];
|
||||
int32_t node_id = vnodeNodeId(rtner->tsdb->pVnode);
|
||||
|
@ -542,8 +542,8 @@ _exit:
|
|||
tsdbError("vgId:%d %s failed at line %s:%d since %s", TD_VID(rtner->tsdb->pVnode), __func__, __FILE__, lino,
|
||||
tstrerror(code));
|
||||
}
|
||||
taosCloseFile(&fdFrom);
|
||||
taosCloseFile(&fdTo);
|
||||
(void)taosCloseFile(&fdFrom);
|
||||
(void)taosCloseFile(&fdTo);
|
||||
return code;
|
||||
}
|
||||
|
||||
|
@ -587,7 +587,7 @@ static int32_t tsdbMigrateDataFileS3(SRTNer *rtner, const STFileObj *fobj, int64
|
|||
TAOS_CHECK_GOTO(TARRAY2_APPEND(&rtner->fopArr, op), &lino, _exit);
|
||||
|
||||
char fname[TSDB_FILENAME_LEN];
|
||||
tsdbTFileName(rtner->tsdb, &op.nf, fname);
|
||||
(void)tsdbTFileName(rtner->tsdb, &op.nf, fname);
|
||||
char *object_name = taosDirEntryBaseName(fname);
|
||||
char object_name_prefix[TSDB_FILENAME_LEN];
|
||||
int32_t node_id = vnodeNodeId(rtner->tsdb->pVnode);
|
||||
|
@ -640,8 +640,8 @@ _exit:
|
|||
tsdbError("vgId:%d %s failed at line %s:%d since %s", TD_VID(rtner->tsdb->pVnode), __func__, __FILE__, lino,
|
||||
tstrerror(code));
|
||||
}
|
||||
taosCloseFile(&fdFrom);
|
||||
taosCloseFile(&fdTo);
|
||||
(void)taosCloseFile(&fdFrom);
|
||||
(void)taosCloseFile(&fdTo);
|
||||
return code;
|
||||
}
|
||||
|
||||
|
@ -673,7 +673,7 @@ static int32_t tsdbDoS3Migrate(SRTNer *rtner) {
|
|||
if (/*lcn < 1 && */ taosCheckExistFile(fobj->fname)) {
|
||||
int32_t mtime = 0;
|
||||
int64_t size = 0;
|
||||
taosStatFile(fobj->fname, &size, &mtime, NULL);
|
||||
(void)taosStatFile(fobj->fname, &size, &mtime, NULL);
|
||||
if (size > chunksize && mtime < rtner->now - tsS3UploadDelaySec) {
|
||||
if (pCfg->s3Compact && lcn < 0) {
|
||||
extern int32_t tsdbAsyncCompact(STsdb * tsdb, const STimeWindow *tw, bool sync);
|
||||
|
@ -695,12 +695,12 @@ static int32_t tsdbDoS3Migrate(SRTNer *rtner) {
|
|||
TAOS_CHECK_GOTO(TSDB_CODE_INVALID_PARA, &lino, _exit);
|
||||
}
|
||||
char fname1[TSDB_FILENAME_LEN];
|
||||
tsdbTFileLastChunkName(rtner->tsdb, fobj->f, fname1);
|
||||
(void)tsdbTFileLastChunkName(rtner->tsdb, fobj->f, fname1);
|
||||
|
||||
if (taosCheckExistFile(fname1)) {
|
||||
int32_t mtime = 0;
|
||||
int64_t size = 0;
|
||||
taosStatFile(fname1, &size, &mtime, NULL);
|
||||
(void)taosStatFile(fname1, &size, &mtime, NULL);
|
||||
if (size > chunksize && mtime < rtner->now - tsS3UploadDelaySec) {
|
||||
TAOS_CHECK_GOTO(tsdbMigrateDataFileLCS3(rtner, fobj, size, chunksize), &lino, _exit);
|
||||
}
|
||||
|
|
|
@ -196,7 +196,7 @@ int32_t tsdbFSetPartListToRangeDiff(STsdbFSetPartList* pList, TFileSetRangeArray
|
|||
|
||||
_err:
|
||||
if (pDiff) {
|
||||
tsdbTFileSetRangeArrayDestroy(&pDiff);
|
||||
(void)tsdbTFileSetRangeArrayDestroy(&pDiff);
|
||||
}
|
||||
return code;
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@ struct STsdbSnapReader {
|
|||
|
||||
static int32_t tsdbSnapReadFileSetCloseReader(STsdbSnapReader* reader) {
|
||||
TARRAY2_CLEAR(reader->sttReaderArr, tsdbSttFileReaderClose);
|
||||
tsdbDataFileReaderClose(&reader->dataReader);
|
||||
TAOS_UNUSED(tsdbDataFileReaderClose(&reader->dataReader));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -107,7 +107,7 @@ static int32_t tsdbSnapReadFileSetOpenReader(STsdbSnapReader* reader) {
|
|||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
|
||||
if ((code = TARRAY2_APPEND(reader->sttReaderArr, sttReader))) {
|
||||
tsdbSttFileReaderClose(&sttReader);
|
||||
TAOS_UNUSED(tsdbSttFileReaderClose(&sttReader));
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
}
|
||||
}
|
||||
|
@ -115,7 +115,7 @@ static int32_t tsdbSnapReadFileSetOpenReader(STsdbSnapReader* reader) {
|
|||
|
||||
_exit:
|
||||
if (code) {
|
||||
tsdbSnapReadFileSetCloseReader(reader);
|
||||
TAOS_UNUSED(tsdbSnapReadFileSetCloseReader(reader));
|
||||
TSDB_ERROR_LOG(TD_VID(reader->tsdb->pVnode), code, lino);
|
||||
}
|
||||
return code;
|
||||
|
@ -199,8 +199,8 @@ _exit:
|
|||
}
|
||||
|
||||
static int32_t tsdbSnapReadFileSetCloseIter(STsdbSnapReader* reader) {
|
||||
tsdbIterMergerClose(&reader->dataIterMerger);
|
||||
tsdbIterMergerClose(&reader->tombIterMerger);
|
||||
TAOS_UNUSED(tsdbIterMergerClose(&reader->dataIterMerger));
|
||||
TAOS_UNUSED(tsdbIterMergerClose(&reader->tombIterMerger));
|
||||
TARRAY2_CLEAR(reader->dataIterArr, tsdbIterClose);
|
||||
TARRAY2_CLEAR(reader->tombIterArr, tsdbIterClose);
|
||||
return 0;
|
||||
|
@ -232,8 +232,8 @@ _exit:
|
|||
}
|
||||
|
||||
static int32_t tsdbSnapReadRangeEnd(STsdbSnapReader* reader) {
|
||||
tsdbSnapReadFileSetCloseIter(reader);
|
||||
tsdbSnapReadFileSetCloseReader(reader);
|
||||
TAOS_UNUSED(tsdbSnapReadFileSetCloseIter(reader));
|
||||
TAOS_UNUSED(tsdbSnapReadFileSetCloseReader(reader));
|
||||
reader->ctx->fsr = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
@ -384,7 +384,7 @@ static int32_t tsdbSnapReadTombData(STsdbSnapReader* reader, uint8_t** data) {
|
|||
int32_t lino = 0;
|
||||
SMetaInfo info;
|
||||
|
||||
tTombBlockClear(reader->tombBlock);
|
||||
TAOS_UNUSED(tTombBlockClear(reader->tombBlock));
|
||||
|
||||
TABLEID tbid[1] = {0};
|
||||
for (STombRecord* record; (record = tsdbIterMergerGetTombRecord(reader->tombIterMerger)) != NULL;) {
|
||||
|
@ -441,7 +441,7 @@ _exit:
|
|||
if (code) {
|
||||
tsdbError("vgId:%d %s failed at %s:%d since %s, sver:%" PRId64 " ever:%" PRId64 " type:%d", TD_VID(tsdb->pVnode),
|
||||
__func__, __FILE__, lino, tstrerror(code), sver, ever, type);
|
||||
tsdbTFileSetRangeArrayDestroy(&reader[0]->fsrArr);
|
||||
TAOS_UNUSED(tsdbTFileSetRangeArrayDestroy(&reader[0]->fsrArr));
|
||||
taosMemoryFree(reader[0]);
|
||||
reader[0] = NULL;
|
||||
} else {
|
||||
|
@ -460,21 +460,21 @@ int32_t tsdbSnapReaderClose(STsdbSnapReader** reader) {
|
|||
|
||||
STsdb* tsdb = reader[0]->tsdb;
|
||||
|
||||
tTombBlockDestroy(reader[0]->tombBlock);
|
||||
TAOS_UNUSED(tTombBlockDestroy(reader[0]->tombBlock));
|
||||
tBlockDataDestroy(reader[0]->blockData);
|
||||
|
||||
tsdbIterMergerClose(&reader[0]->dataIterMerger);
|
||||
tsdbIterMergerClose(&reader[0]->tombIterMerger);
|
||||
TAOS_UNUSED(tsdbIterMergerClose(&reader[0]->dataIterMerger));
|
||||
TAOS_UNUSED(tsdbIterMergerClose(&reader[0]->tombIterMerger));
|
||||
TARRAY2_DESTROY(reader[0]->dataIterArr, tsdbIterClose);
|
||||
TARRAY2_DESTROY(reader[0]->tombIterArr, tsdbIterClose);
|
||||
TARRAY2_DESTROY(reader[0]->sttReaderArr, tsdbSttFileReaderClose);
|
||||
tsdbDataFileReaderClose(&reader[0]->dataReader);
|
||||
TAOS_UNUSED(tsdbDataFileReaderClose(&reader[0]->dataReader));
|
||||
|
||||
tsdbFSDestroyRefRangedSnapshot(&reader[0]->fsrArr);
|
||||
TAOS_UNUSED(tsdbFSDestroyRefRangedSnapshot(&reader[0]->fsrArr));
|
||||
tDestroyTSchema(reader[0]->skmTb->pTSchema);
|
||||
|
||||
for (int32_t i = 0; i < ARRAY_SIZE(reader[0]->buffers); ++i) {
|
||||
tBufferDestroy(reader[0]->buffers + i);
|
||||
TAOS_UNUSED(tBufferDestroy(reader[0]->buffers + i));
|
||||
}
|
||||
|
||||
taosMemoryFree(reader[0]);
|
||||
|
@ -706,7 +706,7 @@ _exit:
|
|||
|
||||
static int32_t tsdbSnapWriteFileSetCloseReader(STsdbSnapWriter* writer) {
|
||||
TARRAY2_CLEAR(writer->ctx->sttReaderArr, tsdbSttFileReaderClose);
|
||||
tsdbDataFileReaderClose(&writer->ctx->dataReader);
|
||||
TAOS_UNUSED(tsdbDataFileReaderClose(&writer->ctx->dataReader));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -782,8 +782,8 @@ _exit:
|
|||
}
|
||||
|
||||
static int32_t tsdbSnapWriteFileSetCloseIter(STsdbSnapWriter* writer) {
|
||||
tsdbIterMergerClose(&writer->ctx->dataIterMerger);
|
||||
tsdbIterMergerClose(&writer->ctx->tombIterMerger);
|
||||
TAOS_UNUSED(tsdbIterMergerClose(&writer->ctx->dataIterMerger));
|
||||
TAOS_UNUSED(tsdbIterMergerClose(&writer->ctx->tombIterMerger));
|
||||
TARRAY2_CLEAR(writer->ctx->dataIterArr, tsdbIterClose);
|
||||
TARRAY2_CLEAR(writer->ctx->tombIterArr, tsdbIterClose);
|
||||
return 0;
|
||||
|
@ -838,7 +838,7 @@ static int32_t tsdbSnapWriteFileSetBegin(STsdbSnapWriter* writer, int32_t fid) {
|
|||
code = TSDB_CODE_NO_AVAIL_DISK;
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
}
|
||||
tfsMkdirRecurAt(writer->tsdb->pVnode->pTfs, writer->tsdb->path, writer->ctx->did);
|
||||
TAOS_UNUSED(tfsMkdirRecurAt(writer->tsdb->pVnode->pTfs, writer->tsdb->path, writer->ctx->did));
|
||||
|
||||
writer->ctx->hasData = true;
|
||||
writer->ctx->hasTomb = true;
|
||||
|
@ -993,7 +993,7 @@ static int32_t tsdbSnapWriteDecmprTombBlock(SSnapDataHdr* hdr, STombBlock* tombB
|
|||
int32_t code = 0;
|
||||
int32_t lino = 0;
|
||||
|
||||
tTombBlockClear(tombBlock);
|
||||
TAOS_UNUSED(tTombBlockClear(tombBlock));
|
||||
|
||||
int64_t size = hdr->size;
|
||||
ASSERT(size % TOMB_RECORD_ELEM_NUM == 0);
|
||||
|
@ -1140,15 +1140,15 @@ int32_t tsdbSnapWriterClose(STsdbSnapWriter** writer, int8_t rollback) {
|
|||
(void)taosThreadMutexUnlock(&writer[0]->tsdb->mutex);
|
||||
}
|
||||
|
||||
tsdbIterMergerClose(&writer[0]->ctx->tombIterMerger);
|
||||
tsdbIterMergerClose(&writer[0]->ctx->dataIterMerger);
|
||||
TAOS_UNUSED(tsdbIterMergerClose(&writer[0]->ctx->tombIterMerger));
|
||||
TAOS_UNUSED(tsdbIterMergerClose(&writer[0]->ctx->dataIterMerger));
|
||||
TARRAY2_DESTROY(writer[0]->ctx->tombIterArr, tsdbIterClose);
|
||||
TARRAY2_DESTROY(writer[0]->ctx->dataIterArr, tsdbIterClose);
|
||||
TARRAY2_DESTROY(writer[0]->ctx->sttReaderArr, tsdbSttFileReaderClose);
|
||||
tsdbDataFileReaderClose(&writer[0]->ctx->dataReader);
|
||||
TAOS_UNUSED(tsdbDataFileReaderClose(&writer[0]->ctx->dataReader));
|
||||
|
||||
TARRAY2_DESTROY(writer[0]->fopArr, NULL);
|
||||
tsdbFSDestroyCopyRangedSnapshot(&writer[0]->fsetArr);
|
||||
TAOS_UNUSED(tsdbFSDestroyCopyRangedSnapshot(&writer[0]->fsetArr));
|
||||
|
||||
for (int32_t i = 0; i < ARRAY_SIZE(writer[0]->buffers); ++i) {
|
||||
tBufferDestroy(writer[0]->buffers + i);
|
||||
|
|
|
@ -65,7 +65,7 @@ _exit:
|
|||
if (code) {
|
||||
tsdbError("vgId:%d %s failed at line %d since %s, sver:0, ever:%" PRId64 " type:%d", TD_VID(tsdb->pVnode), __func__,
|
||||
lino, tstrerror(code), ever, type);
|
||||
tsdbFSDestroyRefSnapshot(&reader[0]->fsetArr);
|
||||
(void)tsdbFSDestroyRefSnapshot(&reader[0]->fsetArr);
|
||||
taosMemoryFree(reader[0]);
|
||||
reader[0] = NULL;
|
||||
} else {
|
||||
|
@ -84,7 +84,7 @@ int32_t tsdbSnapRAWReaderClose(STsdbSnapRAWReader** reader) {
|
|||
STsdb* tsdb = reader[0]->tsdb;
|
||||
|
||||
TARRAY2_DESTROY(reader[0]->dataReaderArr, tsdbDataFileRAWReaderClose);
|
||||
tsdbFSDestroyRefSnapshot(&reader[0]->fsetArr);
|
||||
(void)tsdbFSDestroyRefSnapshot(&reader[0]->fsetArr);
|
||||
taosMemoryFree(reader[0]);
|
||||
reader[0] = NULL;
|
||||
|
||||
|
@ -141,7 +141,7 @@ static int32_t tsdbSnapRAWReadFileSetOpenReader(STsdbSnapRAWReader* reader) {
|
|||
|
||||
_exit:
|
||||
if (code) {
|
||||
tsdbSnapRAWReadFileSetCloseReader(reader);
|
||||
(void)tsdbSnapRAWReadFileSetCloseReader(reader);
|
||||
TSDB_ERROR_LOG(TD_VID(reader->tsdb->pVnode), code, lino);
|
||||
}
|
||||
return code;
|
||||
|
@ -268,8 +268,8 @@ _exit:
|
|||
}
|
||||
|
||||
static int32_t tsdbSnapRAWReadEnd(STsdbSnapRAWReader* reader) {
|
||||
tsdbSnapRAWReadFileSetCloseIter(reader);
|
||||
tsdbSnapRAWReadFileSetCloseReader(reader);
|
||||
(void)tsdbSnapRAWReadFileSetCloseIter(reader);
|
||||
(void)tsdbSnapRAWReadFileSetCloseReader(reader);
|
||||
reader->ctx->fset = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
@ -420,7 +420,7 @@ static int32_t tsdbSnapRAWWriteFileSetBegin(STsdbSnapRAWWriter* writer, int32_t
|
|||
int32_t level = tsdbFidLevel(fid, &writer->tsdb->keepCfg, taosGetTimestampSec());
|
||||
code = tfsAllocDisk(writer->tsdb->pVnode->pTfs, level, &writer->ctx->did);
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
tfsMkdirRecurAt(writer->tsdb->pVnode->pTfs, writer->tsdb->path, writer->ctx->did);
|
||||
(void)tfsMkdirRecurAt(writer->tsdb->pVnode->pTfs, writer->tsdb->path, writer->ctx->did);
|
||||
|
||||
code = tsdbSnapRAWWriteFileSetOpenWriter(writer);
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
|
@ -499,7 +499,7 @@ int32_t tsdbSnapRAWWriterClose(STsdbSnapRAWWriter** writer, int8_t rollback) {
|
|||
}
|
||||
|
||||
TARRAY2_DESTROY(writer[0]->fopArr, NULL);
|
||||
tsdbFSDestroyCopySnapshot(&writer[0]->fsetArr);
|
||||
(void)tsdbFSDestroyCopySnapshot(&writer[0]->fsetArr);
|
||||
|
||||
taosMemoryFree(writer[0]);
|
||||
writer[0] = NULL;
|
||||
|
|
|
@ -55,7 +55,7 @@ int32_t tsdbSttFileReaderOpen(const char *fname, const SSttFileReaderConfig *con
|
|||
TAOS_CHECK_GOTO(tsdbOpenFile(fname, config->tsdb, TD_FILE_READ, &reader[0]->fd, 0), &lino, _exit);
|
||||
} else {
|
||||
char fname1[TSDB_FILENAME_LEN];
|
||||
tsdbTFileName(config->tsdb, config->file, fname1);
|
||||
(void)tsdbTFileName(config->tsdb, config->file, fname1);
|
||||
TAOS_CHECK_GOTO(tsdbOpenFile(fname1, config->tsdb, TD_FILE_READ, &reader[0]->fd, 0), &lino, _exit);
|
||||
}
|
||||
|
||||
|
@ -91,7 +91,7 @@ _exit:
|
|||
if (code) {
|
||||
tsdbError("vgId:%d %s failed at %s:%d since %s", TD_VID(config->tsdb->pVnode), __func__, __FILE__, lino,
|
||||
tstrerror(code));
|
||||
tsdbSttFileReaderClose(reader);
|
||||
(void)tsdbSttFileReaderClose(reader);
|
||||
}
|
||||
return code;
|
||||
}
|
||||
|
@ -507,7 +507,7 @@ static int32_t tsdbFileDoWriteSttBlockData(STsdbFD *fd, SBlockData *blockData, S
|
|||
if (sttBlk->maxVer < blockData->aVersion[iRow]) sttBlk->maxVer = blockData->aVersion[iRow];
|
||||
}
|
||||
|
||||
tsdbWriterUpdVerRange(range, sttBlk->minVer, sttBlk->maxVer);
|
||||
(void)tsdbWriterUpdVerRange(range, sttBlk->minVer, sttBlk->maxVer);
|
||||
TAOS_CHECK_RETURN(tBlockDataCompress(blockData, info, buffers, buffers + 4));
|
||||
|
||||
sttBlk->bInfo.offset = *fileSize;
|
||||
|
@ -790,7 +790,7 @@ static int32_t tsdbSttFWriterDoOpen(SSttFileWriter *writer) {
|
|||
int32_t flag = TD_FILE_READ | TD_FILE_WRITE | TD_FILE_CREATE | TD_FILE_TRUNC;
|
||||
char fname[TSDB_FILENAME_LEN];
|
||||
|
||||
tsdbTFileName(writer->config->tsdb, writer->file, fname);
|
||||
(void)tsdbTFileName(writer->config->tsdb, writer->file, fname);
|
||||
TAOS_CHECK_GOTO(tsdbOpenFile(fname, writer->config->tsdb, flag, &writer->fd, 0), &lino, _exit);
|
||||
|
||||
uint8_t hdr[TSDB_FHDR_SIZE] = {0};
|
||||
|
@ -860,7 +860,7 @@ static int32_t tsdbSttFWriterCloseCommit(SSttFileWriter *writer, TFileOpArray *o
|
|||
.fid = writer->config->fid,
|
||||
.nf = writer->file[0],
|
||||
};
|
||||
tsdbTFileUpdVerRange(&op.nf, writer->ctx->range);
|
||||
(void)tsdbTFileUpdVerRange(&op.nf, writer->ctx->range);
|
||||
|
||||
TAOS_CHECK_GOTO(TARRAY2_APPEND(opArray, op), &lino, _exit);
|
||||
|
||||
|
@ -874,7 +874,7 @@ _exit:
|
|||
|
||||
static int32_t tsdbSttFWriterCloseAbort(SSttFileWriter *writer) {
|
||||
char fname[TSDB_FILENAME_LEN];
|
||||
tsdbTFileName(writer->config->tsdb, writer->file, fname);
|
||||
(void)tsdbTFileName(writer->config->tsdb, writer->file, fname);
|
||||
tsdbCloseFile(&writer->fd);
|
||||
(void)taosRemoveFile(fname);
|
||||
return 0;
|
||||
|
|
|
@ -79,7 +79,7 @@ static int32_t tsdbUpgradeHead(STsdb *tsdb, SDFileSet *pDFileSet, SDataFReader *
|
|||
|
||||
// open fd
|
||||
char fname[TSDB_FILENAME_LEN];
|
||||
tsdbTFileName(tsdb, &file, fname);
|
||||
(void)tsdbTFileName(tsdb, &file, fname);
|
||||
|
||||
TAOS_CHECK_GOTO(tsdbOpenFile(fname, tsdb, TD_FILE_READ | TD_FILE_WRITE, &ctx->fd, 0), &lino, _exit);
|
||||
|
||||
|
@ -321,7 +321,7 @@ static int32_t tsdbUpgradeStt(STsdb *tsdb, SDFileSet *pDFileSet, SDataFReader *r
|
|||
if (TARRAY2_SIZE(lvl->fobjArr) > 0) {
|
||||
TAOS_CHECK_GOTO(TARRAY2_APPEND(fset->lvlArr, lvl), &lino, _exit);
|
||||
} else {
|
||||
tsdbSttLvlClear(&lvl);
|
||||
(void)tsdbSttLvlClear(&lvl);
|
||||
}
|
||||
|
||||
_exit:
|
||||
|
@ -358,7 +358,7 @@ static int32_t tsdbUpgradeFileSet(STsdb *tsdb, SDFileSet *pDFileSet, TFileSetArr
|
|||
TAOS_CHECK_GOTO(tsdbUpgradeStt(tsdb, pDFileSet, reader, fset), &lino, _exit);
|
||||
}
|
||||
|
||||
tsdbDataFReaderClose(&reader);
|
||||
(void)tsdbDataFReaderClose(&reader);
|
||||
|
||||
TAOS_CHECK_GOTO(TARRAY2_APPEND(fileSetArray, fset), &lino, _exit);
|
||||
|
||||
|
@ -570,7 +570,7 @@ _exit:
|
|||
if (code) {
|
||||
tsdbError("vgId:%d %s failed at %s:%d since %s", TD_VID(tsdb->pVnode), __func__, __FILE__, lino, tstrerror(code));
|
||||
}
|
||||
tsdbDelFReaderClose(&reader);
|
||||
(void)tsdbDelFReaderClose(&reader);
|
||||
taosArrayDestroy(aDelIdx);
|
||||
return code;
|
||||
}
|
||||
|
@ -612,7 +612,7 @@ static int32_t tsdbUpgradeFileSystem(STsdb *tsdb, int8_t rollback) {
|
|||
|
||||
// save new file system
|
||||
char fname[TSDB_FILENAME_LEN];
|
||||
current_fname(tsdb, fname, TSDB_FCURRENT);
|
||||
(void)current_fname(tsdb, fname, TSDB_FCURRENT);
|
||||
TAOS_CHECK_GOTO(save_fs(fileSetArray, fname), &lino, _exit);
|
||||
|
||||
_exit:
|
||||
|
|
|
@ -107,7 +107,7 @@ _exit:
|
|||
|
||||
void tMapDataGetItemByIdx(SMapData *pMapData, int32_t idx, void *pItem, int32_t (*tGetItemFn)(uint8_t *, void *)) {
|
||||
ASSERT(idx >= 0 && idx < pMapData->nItem);
|
||||
tGetItemFn(pMapData->pData + pMapData->aOffset[idx], pItem);
|
||||
(void)tGetItemFn(pMapData->pData + pMapData->aOffset[idx], pItem);
|
||||
}
|
||||
|
||||
#ifdef BUILD_NO_CALL
|
||||
|
@ -613,7 +613,7 @@ void tsdbRowGetColVal(TSDBROW *pRow, STSchema *pTSchema, int32_t iCol, SColVal *
|
|||
SValue value;
|
||||
|
||||
if (pRow->type == TSDBROW_ROW_FMT) {
|
||||
tRowGet(pRow->pTSRow, pTSchema, iCol, pColVal);
|
||||
(void)tRowGet(pRow->pTSRow, pTSchema, iCol, pColVal);
|
||||
} else if (pRow->type == TSDBROW_COL_FMT) {
|
||||
if (iCol == 0) {
|
||||
*pColVal =
|
||||
|
|
|
@ -171,12 +171,12 @@ static int32_t vnodeAsyncTaskDone(SVAsync *async, SVATask *task) {
|
|||
async->numTasks--;
|
||||
|
||||
if (task->numWait == 0) {
|
||||
taosThreadCondDestroy(&task->waitCond);
|
||||
(void)taosThreadCondDestroy(&task->waitCond);
|
||||
taosMemoryFree(task);
|
||||
} else if (task->numWait == 1) {
|
||||
taosThreadCondSignal(&task->waitCond);
|
||||
(void)taosThreadCondSignal(&task->waitCond);
|
||||
} else {
|
||||
taosThreadCondBroadcast(&task->waitCond);
|
||||
(void)taosThreadCondBroadcast(&task->waitCond);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -195,7 +195,7 @@ static int32_t vnodeAsyncCancelAllTasks(SVAsync *async, SArray *cancelArray) {
|
|||
.arg = task->arg,
|
||||
}));
|
||||
}
|
||||
vnodeAsyncTaskDone(async, task);
|
||||
(void)vnodeAsyncTaskDone(async, task);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -217,14 +217,14 @@ static void *vnodeAsyncLoop(void *arg) {
|
|||
|
||||
// finish last running task
|
||||
if (worker->runningTask != NULL) {
|
||||
vnodeAsyncTaskDone(async, worker->runningTask);
|
||||
(void)vnodeAsyncTaskDone(async, worker->runningTask);
|
||||
worker->runningTask = NULL;
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
if (async->stop || worker->workerId >= async->numWorkers) {
|
||||
if (async->stop) { // cancel all tasks
|
||||
vnodeAsyncCancelAllTasks(async, cancelArray);
|
||||
(void)vnodeAsyncCancelAllTasks(async, cancelArray);
|
||||
}
|
||||
worker->state = EVA_WORKER_STATE_STOP;
|
||||
async->numLaunchWorkers--;
|
||||
|
@ -259,7 +259,7 @@ static void *vnodeAsyncLoop(void *arg) {
|
|||
if (worker->runningTask == NULL) {
|
||||
worker->state = EVA_WORKER_STATE_IDLE;
|
||||
async->numIdleWorkers++;
|
||||
taosThreadCondWait(&async->hasTask, &async->mutex);
|
||||
(void)taosThreadCondWait(&async->hasTask, &async->mutex);
|
||||
async->numIdleWorkers--;
|
||||
worker->state = EVA_WORKER_STATE_ACTIVE;
|
||||
} else {
|
||||
|
@ -271,7 +271,7 @@ static void *vnodeAsyncLoop(void *arg) {
|
|||
(void)taosThreadMutexUnlock(&async->mutex);
|
||||
|
||||
// do run the task
|
||||
worker->runningTask->execute(worker->runningTask->arg);
|
||||
(void)worker->runningTask->execute(worker->runningTask->arg);
|
||||
}
|
||||
|
||||
_exit:
|
||||
|
@ -334,8 +334,8 @@ static int32_t vnodeAsyncInit(SVAsync **async, const char *label) {
|
|||
strcpy((char *)((*async) + 1), label);
|
||||
(*async)->label = (const char *)((*async) + 1);
|
||||
|
||||
taosThreadMutexInit(&(*async)->mutex, NULL);
|
||||
taosThreadCondInit(&(*async)->hasTask, NULL);
|
||||
(void)taosThreadMutexInit(&(*async)->mutex, NULL);
|
||||
(void)taosThreadCondInit(&(*async)->hasTask, NULL);
|
||||
(*async)->stop = false;
|
||||
|
||||
// worker
|
||||
|
@ -356,8 +356,8 @@ static int32_t vnodeAsyncInit(SVAsync **async, const char *label) {
|
|||
(*async)->chList.next = &(*async)->chList;
|
||||
ret = vHashInit(&(*async)->channelTable, vnodeAsyncChannelHash, vnodeAsyncChannelCompare);
|
||||
if (ret != 0) {
|
||||
taosThreadMutexDestroy(&(*async)->mutex);
|
||||
taosThreadCondDestroy(&(*async)->hasTask);
|
||||
(void)taosThreadMutexDestroy(&(*async)->mutex);
|
||||
(void)taosThreadCondDestroy(&(*async)->hasTask);
|
||||
taosMemoryFree(*async);
|
||||
return ret;
|
||||
}
|
||||
|
@ -371,9 +371,9 @@ static int32_t vnodeAsyncInit(SVAsync **async, const char *label) {
|
|||
}
|
||||
ret = vHashInit(&(*async)->taskTable, vnodeAsyncTaskHash, vnodeAsyncTaskCompare);
|
||||
if (ret != 0) {
|
||||
vHashDestroy(&(*async)->channelTable);
|
||||
taosThreadMutexDestroy(&(*async)->mutex);
|
||||
taosThreadCondDestroy(&(*async)->hasTask);
|
||||
(void)vHashDestroy(&(*async)->channelTable);
|
||||
(void)taosThreadMutexDestroy(&(*async)->mutex);
|
||||
(void)taosThreadCondDestroy(&(*async)->hasTask);
|
||||
taosMemoryFree(*async);
|
||||
return ret;
|
||||
}
|
||||
|
@ -389,7 +389,7 @@ static int32_t vnodeAsyncDestroy(SVAsync **async) {
|
|||
// set stop and broadcast
|
||||
(void)taosThreadMutexLock(&(*async)->mutex);
|
||||
(*async)->stop = true;
|
||||
taosThreadCondBroadcast(&(*async)->hasTask);
|
||||
(void)taosThreadCondBroadcast(&(*async)->hasTask);
|
||||
(void)taosThreadMutexUnlock(&(*async)->mutex);
|
||||
|
||||
// join all workers
|
||||
|
@ -402,7 +402,7 @@ static int32_t vnodeAsyncDestroy(SVAsync **async) {
|
|||
continue;
|
||||
}
|
||||
|
||||
taosThreadJoin((*async)->workers[i].thread, NULL);
|
||||
(void)taosThreadJoin((*async)->workers[i].thread, NULL);
|
||||
ASSERT((*async)->workers[i].state == EVA_WORKER_STATE_STOP);
|
||||
(*async)->workers[i].state = EVA_WORKER_STATE_UINIT;
|
||||
}
|
||||
|
@ -425,11 +425,11 @@ static int32_t vnodeAsyncDestroy(SVAsync **async) {
|
|||
ASSERT((*async)->numChannels == 0);
|
||||
ASSERT((*async)->numTasks == 0);
|
||||
|
||||
taosThreadMutexDestroy(&(*async)->mutex);
|
||||
taosThreadCondDestroy(&(*async)->hasTask);
|
||||
(void)taosThreadMutexDestroy(&(*async)->mutex);
|
||||
(void)taosThreadCondDestroy(&(*async)->hasTask);
|
||||
|
||||
vHashDestroy(&(*async)->channelTable);
|
||||
vHashDestroy(&(*async)->taskTable);
|
||||
(void)vHashDestroy(&(*async)->channelTable);
|
||||
(void)vHashDestroy(&(*async)->taskTable);
|
||||
taosMemoryFree(*async);
|
||||
*async = NULL;
|
||||
|
||||
|
@ -442,11 +442,11 @@ static int32_t vnodeAsyncLaunchWorker(SVAsync *async) {
|
|||
if (async->workers[i].state == EVA_WORKER_STATE_ACTIVE) {
|
||||
continue;
|
||||
} else if (async->workers[i].state == EVA_WORKER_STATE_STOP) {
|
||||
taosThreadJoin(async->workers[i].thread, NULL);
|
||||
(void)taosThreadJoin(async->workers[i].thread, NULL);
|
||||
async->workers[i].state = EVA_WORKER_STATE_UINIT;
|
||||
}
|
||||
|
||||
taosThreadCreate(&async->workers[i].thread, NULL, vnodeAsyncLoop, &async->workers[i]);
|
||||
(void)taosThreadCreate(&async->workers[i].thread, NULL, vnodeAsyncLoop, &async->workers[i]);
|
||||
async->workers[i].state = EVA_WORKER_STATE_ACTIVE;
|
||||
async->numLaunchWorkers++;
|
||||
break;
|
||||
|
@ -461,20 +461,20 @@ int32_t vnodeAsyncOpen(int32_t numOfThreads) {
|
|||
// vnode-commit
|
||||
code = vnodeAsyncInit(&vnodeAsyncs[1], "vnode-commit");
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
vnodeAsyncSetWorkers(1, numOfThreads);
|
||||
(void)vnodeAsyncSetWorkers(1, numOfThreads);
|
||||
|
||||
// vnode-merge
|
||||
code = vnodeAsyncInit(&vnodeAsyncs[2], "vnode-merge");
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
vnodeAsyncSetWorkers(2, numOfThreads);
|
||||
(void)vnodeAsyncSetWorkers(2, numOfThreads);
|
||||
|
||||
_exit:
|
||||
return code;
|
||||
}
|
||||
|
||||
int32_t vnodeAsyncClose() {
|
||||
vnodeAsyncDestroy(&vnodeAsyncs[1]);
|
||||
vnodeAsyncDestroy(&vnodeAsyncs[2]);
|
||||
(void)vnodeAsyncDestroy(&vnodeAsyncs[1]);
|
||||
(void)vnodeAsyncDestroy(&vnodeAsyncs[2]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -501,7 +501,7 @@ int32_t vnodeAsync(SVAChannelID *channelID, EVAPriority priority, int32_t (*exec
|
|||
task->arg = arg;
|
||||
task->state = EVA_TASK_STATE_WAITTING;
|
||||
task->numWait = 0;
|
||||
taosThreadCondInit(&task->waitCond, NULL);
|
||||
(void)taosThreadCondInit(&task->waitCond, NULL);
|
||||
|
||||
// schedule task
|
||||
(void)taosThreadMutexLock(&async->mutex);
|
||||
|
@ -512,10 +512,10 @@ int32_t vnodeAsync(SVAChannelID *channelID, EVAPriority priority, int32_t (*exec
|
|||
SVAChannel channel = {
|
||||
.channelId = channelID->id,
|
||||
};
|
||||
vHashGet(async->channelTable, &channel, (void **)&task->channel);
|
||||
(void)vHashGet(async->channelTable, &channel, (void **)&task->channel);
|
||||
if (task->channel == NULL) {
|
||||
(void)taosThreadMutexUnlock(&async->mutex);
|
||||
taosThreadCondDestroy(&task->waitCond);
|
||||
(void)taosThreadCondDestroy(&task->waitCond);
|
||||
taosMemoryFree(task);
|
||||
return TSDB_CODE_INVALID_PARA;
|
||||
}
|
||||
|
@ -527,7 +527,7 @@ int32_t vnodeAsync(SVAChannelID *channelID, EVAPriority priority, int32_t (*exec
|
|||
int32_t ret = vHashPut(async->taskTable, task);
|
||||
if (ret != 0) {
|
||||
(void)taosThreadMutexUnlock(&async->mutex);
|
||||
taosThreadCondDestroy(&task->waitCond);
|
||||
(void)taosThreadCondDestroy(&task->waitCond);
|
||||
taosMemoryFree(task);
|
||||
return ret;
|
||||
}
|
||||
|
@ -548,9 +548,9 @@ int32_t vnodeAsync(SVAChannelID *channelID, EVAPriority priority, int32_t (*exec
|
|||
|
||||
// signal worker or launch new worker
|
||||
if (async->numIdleWorkers > 0) {
|
||||
taosThreadCondSignal(&(async->hasTask));
|
||||
(void)taosThreadCondSignal(&(async->hasTask));
|
||||
} else if (async->numLaunchWorkers < async->numWorkers) {
|
||||
vnodeAsyncLaunchWorker(async);
|
||||
(void)vnodeAsyncLaunchWorker(async);
|
||||
}
|
||||
} else if (task->channel->scheduled->state == EVA_TASK_STATE_RUNNING ||
|
||||
priority >= VATASK_PIORITY(task->channel->scheduled)) {
|
||||
|
@ -603,14 +603,14 @@ int32_t vnodeAWait(SVATaskID *taskID) {
|
|||
|
||||
(void)taosThreadMutexLock(&async->mutex);
|
||||
|
||||
vHashGet(async->taskTable, &task2, (void **)&task);
|
||||
(void)vHashGet(async->taskTable, &task2, (void **)&task);
|
||||
if (task) {
|
||||
task->numWait++;
|
||||
taosThreadCondWait(&task->waitCond, &async->mutex);
|
||||
(void)taosThreadCondWait(&task->waitCond, &async->mutex);
|
||||
task->numWait--;
|
||||
|
||||
if (task->numWait == 0) {
|
||||
taosThreadCondDestroy(&task->waitCond);
|
||||
(void)taosThreadCondDestroy(&task->waitCond);
|
||||
taosMemoryFree(task);
|
||||
}
|
||||
}
|
||||
|
@ -636,14 +636,14 @@ int32_t vnodeACancel(SVATaskID *taskID) {
|
|||
|
||||
(void)taosThreadMutexLock(&async->mutex);
|
||||
|
||||
vHashGet(async->taskTable, &task2, (void **)&task);
|
||||
(void)vHashGet(async->taskTable, &task2, (void **)&task);
|
||||
if (task) {
|
||||
if (task->state == EVA_TASK_STATE_WAITTING) {
|
||||
cancel = task->cancel;
|
||||
arg = task->arg;
|
||||
task->next->prev = task->prev;
|
||||
task->prev->next = task->next;
|
||||
vnodeAsyncTaskDone(async, task);
|
||||
(void)vnodeAsyncTaskDone(async, task);
|
||||
} else {
|
||||
ret = TSDB_CODE_FAILED;
|
||||
}
|
||||
|
@ -666,7 +666,7 @@ int32_t vnodeAsyncSetWorkers(int64_t asyncID, int32_t numWorkers) {
|
|||
(void)taosThreadMutexLock(&async->mutex);
|
||||
async->numWorkers = numWorkers;
|
||||
if (async->numIdleWorkers > 0) {
|
||||
taosThreadCondBroadcast(&async->hasTask);
|
||||
(void)taosThreadCondBroadcast(&async->hasTask);
|
||||
}
|
||||
(void)taosThreadMutexUnlock(&async->mutex);
|
||||
|
||||
|
@ -736,12 +736,12 @@ int32_t vnodeAChannelDestroy(SVAChannelID *channelID, bool waitRunning) {
|
|||
|
||||
(void)taosThreadMutexLock(&async->mutex);
|
||||
|
||||
vHashGet(async->channelTable, &channel2, (void **)&channel);
|
||||
(void)vHashGet(async->channelTable, &channel2, (void **)&channel);
|
||||
if (channel) {
|
||||
// unregister channel
|
||||
channel->next->prev = channel->prev;
|
||||
channel->prev->next = channel->next;
|
||||
vHashDrop(async->channelTable, channel);
|
||||
(void)vHashDrop(async->channelTable, channel);
|
||||
async->numChannels--;
|
||||
|
||||
// cancel all waiting tasks
|
||||
|
@ -756,7 +756,7 @@ int32_t vnodeAChannelDestroy(SVAChannelID *channelID, bool waitRunning) {
|
|||
.arg = task->arg,
|
||||
}));
|
||||
}
|
||||
vnodeAsyncTaskDone(async, task);
|
||||
(void)vnodeAsyncTaskDone(async, task);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -771,7 +771,7 @@ int32_t vnodeAChannelDestroy(SVAChannelID *channelID, bool waitRunning) {
|
|||
.arg = channel->scheduled->arg,
|
||||
}));
|
||||
}
|
||||
vnodeAsyncTaskDone(async, channel->scheduled);
|
||||
(void)vnodeAsyncTaskDone(async, channel->scheduled);
|
||||
}
|
||||
taosMemoryFree(channel);
|
||||
} else {
|
||||
|
@ -779,10 +779,10 @@ int32_t vnodeAChannelDestroy(SVAChannelID *channelID, bool waitRunning) {
|
|||
// wait task
|
||||
SVATask *task = channel->scheduled;
|
||||
task->numWait++;
|
||||
taosThreadCondWait(&task->waitCond, &async->mutex);
|
||||
(void)taosThreadCondWait(&task->waitCond, &async->mutex);
|
||||
task->numWait--;
|
||||
if (task->numWait == 0) {
|
||||
taosThreadCondDestroy(&task->waitCond);
|
||||
(void)taosThreadCondDestroy(&task->waitCond);
|
||||
taosMemoryFree(task);
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ static int32_t vnodeBufPoolCreate(SVnode *pVnode, int32_t id, int64_t size, SVBu
|
|||
memset(pPool, 0, sizeof(SVBufPool));
|
||||
|
||||
// query handle list
|
||||
taosThreadMutexInit(&pPool->mutex, NULL);
|
||||
(void)taosThreadMutexInit(&pPool->mutex, NULL);
|
||||
pPool->nQuery = 0;
|
||||
pPool->qList.pNext = &pPool->qList;
|
||||
pPool->qList.ppNext = &pPool->qList.pNext;
|
||||
|
@ -61,10 +61,10 @@ static int32_t vnodeBufPoolCreate(SVnode *pVnode, int32_t id, int64_t size, SVBu
|
|||
static int vnodeBufPoolDestroy(SVBufPool *pPool) {
|
||||
vnodeBufPoolReset(pPool);
|
||||
if (pPool->lock) {
|
||||
taosThreadSpinDestroy(pPool->lock);
|
||||
(void)taosThreadSpinDestroy(pPool->lock);
|
||||
taosMemoryFree((void *)pPool->lock);
|
||||
}
|
||||
taosThreadMutexDestroy(&pPool->mutex);
|
||||
(void)taosThreadMutexDestroy(&pPool->mutex);
|
||||
taosMemoryFree(pPool);
|
||||
return 0;
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ int vnodeOpenBufPool(SVnode *pVnode) {
|
|||
int32_t code;
|
||||
if ((code = vnodeBufPoolCreate(pVnode, i, size, &pVnode->aBufPool[i]))) {
|
||||
vError("vgId:%d, failed to open vnode buffer pool since %s", TD_VID(pVnode), tstrerror(terrno));
|
||||
vnodeCloseBufPool(pVnode);
|
||||
(void)vnodeCloseBufPool(pVnode);
|
||||
return code;
|
||||
}
|
||||
|
||||
|
@ -93,7 +93,7 @@ int vnodeOpenBufPool(SVnode *pVnode) {
|
|||
int vnodeCloseBufPool(SVnode *pVnode) {
|
||||
for (int32_t i = 0; i < VNODE_BUFPOOL_SEGMENTS; i++) {
|
||||
if (pVnode->aBufPool[i]) {
|
||||
vnodeBufPoolDestroy(pVnode->aBufPool[i]);
|
||||
(void)vnodeBufPoolDestroy(pVnode->aBufPool[i]);
|
||||
pVnode->aBufPool[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
@ -141,7 +141,7 @@ void *vnodeBufPoolMallocAligned(SVBufPool *pPool, int size) {
|
|||
pNode = taosMemoryMalloc(sizeof(*pNode) + size);
|
||||
if (pNode == NULL) {
|
||||
if (pPool->lock) {
|
||||
taosThreadSpinUnlock(pPool->lock);
|
||||
(void)taosThreadSpinUnlock(pPool->lock);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
@ -155,7 +155,7 @@ void *vnodeBufPoolMallocAligned(SVBufPool *pPool, int size) {
|
|||
|
||||
pPool->size = pPool->size + sizeof(*pNode) + size;
|
||||
}
|
||||
if (pPool->lock) taosThreadSpinUnlock(pPool->lock);
|
||||
if (pPool->lock) (void)taosThreadSpinUnlock(pPool->lock);
|
||||
return p;
|
||||
}
|
||||
|
||||
|
@ -174,7 +174,7 @@ void *vnodeBufPoolMalloc(SVBufPool *pPool, int size) {
|
|||
// allocate a new node
|
||||
pNode = taosMemoryMalloc(sizeof(*pNode) + size);
|
||||
if (pNode == NULL) {
|
||||
if (pPool->lock) taosThreadSpinUnlock(pPool->lock);
|
||||
if (pPool->lock) (void)taosThreadSpinUnlock(pPool->lock);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -187,7 +187,7 @@ void *vnodeBufPoolMalloc(SVBufPool *pPool, int size) {
|
|||
|
||||
pPool->size = pPool->size + sizeof(*pNode) + size;
|
||||
}
|
||||
if (pPool->lock) taosThreadSpinUnlock(pPool->lock);
|
||||
if (pPool->lock) (void)taosThreadSpinUnlock(pPool->lock);
|
||||
return p;
|
||||
}
|
||||
|
||||
|
@ -223,7 +223,7 @@ void vnodeBufPoolAddToFreeList(SVBufPool *pPool) {
|
|||
vInfo("vgId:%d, buffer pool of id %d size changed from %" PRId64 " to %" PRId64, TD_VID(pVnode), pPool->id,
|
||||
pPool->node.size, size);
|
||||
|
||||
vnodeBufPoolDestroy(pPool);
|
||||
(void)vnodeBufPoolDestroy(pPool);
|
||||
pPool = pNewPool;
|
||||
pVnode->aBufPool[pPool->id] = pPool;
|
||||
}
|
||||
|
@ -234,7 +234,7 @@ void vnodeBufPoolAddToFreeList(SVBufPool *pPool) {
|
|||
vnodeBufPoolReset(pPool);
|
||||
pPool->freeNext = pVnode->freeList;
|
||||
pVnode->freeList = pPool;
|
||||
taosThreadCondSignal(&pVnode->poolNotEmpty);
|
||||
(void)taosThreadCondSignal(&pVnode->poolNotEmpty);
|
||||
}
|
||||
|
||||
void vnodeBufPoolUnRef(SVBufPool *pPool, bool proactive) {
|
||||
|
|
|
@ -127,7 +127,7 @@ int vnodeEncodeConfig(const void *pObj, SJson *pJson) {
|
|||
if (pNodeRetentions == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
tjsonAddItemToObject(pJson, "retentions", pNodeRetentions);
|
||||
TAOS_CHECK_RETURN(tjsonAddItemToObject(pJson, "retentions", pNodeRetentions));
|
||||
for (int32_t i = 0; i < nRetention; ++i) {
|
||||
SJson *pNodeRetention = tjsonCreateObject();
|
||||
const SRetention *pRetention = pCfg->tsdbCfg.retentions + i;
|
||||
|
@ -353,7 +353,7 @@ int vnodeDecodeConfig(const SJson *pJson, void *pObj) {
|
|||
if (info == NULL) return -1;
|
||||
tjsonGetNumberValue(info, "nodePort", pNode->nodePort, code);
|
||||
if (code) return code;
|
||||
tjsonGetStringValue(info, "nodeFqdn", pNode->nodeFqdn);
|
||||
(void)tjsonGetStringValue(info, "nodeFqdn", pNode->nodeFqdn);
|
||||
tjsonGetNumberValue(info, "nodeId", pNode->nodeId, code);
|
||||
if (code) return code;
|
||||
tjsonGetNumberValue(info, "clusterId", pNode->clusterId, code);
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue