other: merge 3.0
This commit is contained in:
commit
d89dac8697
|
@ -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();
|
||||
}
|
|
@ -1078,7 +1078,7 @@ typedef struct {
|
|||
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 cloneSUpdateIpWhiteReq(SUpdateIpWhite* pReq, SUpdateIpWhite** pUpdate);
|
||||
|
||||
typedef struct {
|
||||
int64_t ipWhiteVer;
|
||||
|
@ -3639,9 +3639,9 @@ 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 tOffsetCopy(STqOffsetVal* pLeft, const STqOffsetVal* pRight);
|
||||
void tOffsetDestroy(void* pVal);
|
||||
|
||||
typedef struct {
|
||||
|
|
|
@ -170,7 +170,7 @@ int rpcSendRecvWithTimeout(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcM
|
|||
int32_t timeoutMs);
|
||||
int rpcSetDefaultAddr(void *thandle, const char *ip, const char *fqdn);
|
||||
void *rpcAllocHandle();
|
||||
void rpcSetIpWhite(void *thandl, void *arg);
|
||||
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; \
|
||||
|
|
|
@ -27,9 +27,9 @@ typedef struct SBufferReader SBufferReader;
|
|||
|
||||
// SBuffer
|
||||
#define BUFFER_INITIALIZER ((SBuffer){0, 0, NULL})
|
||||
static int32_t tBufferInit(SBuffer *buffer);
|
||||
static int32_t tBufferDestroy(SBuffer *buffer);
|
||||
static int32_t tBufferClear(SBuffer *buffer);
|
||||
static void tBufferInit(SBuffer *buffer);
|
||||
static void tBufferDestroy(SBuffer *buffer);
|
||||
static void tBufferClear(SBuffer *buffer);
|
||||
static int32_t tBufferEnsureCapacity(SBuffer *buffer, uint32_t capacity);
|
||||
static int32_t tBufferPut(SBuffer *buffer, const void *data, uint32_t size);
|
||||
static int32_t tBufferPutAt(SBuffer *buffer, uint32_t offset, const void *data, uint32_t size);
|
||||
|
|
|
@ -29,27 +29,22 @@ struct SBufferReader {
|
|||
};
|
||||
|
||||
// SBuffer
|
||||
static FORCE_INLINE int32_t tBufferInit(SBuffer *buffer) {
|
||||
static FORCE_INLINE void tBufferInit(SBuffer *buffer) {
|
||||
buffer->size = 0;
|
||||
buffer->capacity = 0;
|
||||
buffer->data = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static FORCE_INLINE int32_t tBufferDestroy(SBuffer *buffer) {
|
||||
static FORCE_INLINE void tBufferDestroy(SBuffer *buffer) {
|
||||
buffer->size = 0;
|
||||
buffer->capacity = 0;
|
||||
if (buffer->data) {
|
||||
taosMemoryFree(buffer->data);
|
||||
buffer->data = NULL;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static FORCE_INLINE int32_t tBufferClear(SBuffer *buffer) {
|
||||
buffer->size = 0;
|
||||
return 0;
|
||||
}
|
||||
static FORCE_INLINE void tBufferClear(SBuffer *buffer) { buffer->size = 0; }
|
||||
|
||||
static FORCE_INLINE int32_t tBufferEnsureCapacity(SBuffer *buffer, uint32_t capacity) {
|
||||
if (buffer->capacity < capacity) {
|
||||
|
|
|
@ -555,7 +555,6 @@ int32_t createRequest(uint64_t connId, int32_t type, int64_t reqid, SRequestObj
|
|||
(*pRequest)->pDb = getDbOfConnection(pTscObj);
|
||||
(*pRequest)->pTscObj = pTscObj;
|
||||
(*pRequest)->inCallback = false;
|
||||
|
||||
(*pRequest)->msgBuf = taosMemoryCalloc(1, ERROR_MSG_BUF_DEFAULT_SIZE);
|
||||
if (NULL == (*pRequest)->msgBuf) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
|
@ -917,17 +916,17 @@ void taos_init_imp(void) {
|
|||
if (tscDbg.memEnable) {
|
||||
int32_t code = taosMemoryDbgInit();
|
||||
if (code) {
|
||||
printf("failed to init memory dbg, error:%s\n", tstrerror(code));
|
||||
(void)printf("failed to init memory dbg, error:%s\n", tstrerror(code));
|
||||
} else {
|
||||
tsAsyncLog = false;
|
||||
printf("memory dbg enabled\n");
|
||||
(void)printf("memory dbg enabled\n");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// In the APIs of other program language, taos_cleanup is not available yet.
|
||||
// So, to make sure taos_cleanup will be invoked to clean up the allocated resource to suppress the valgrind warning.
|
||||
atexit(taos_cleanup);
|
||||
(void)atexit(taos_cleanup);
|
||||
errno = TSDB_CODE_SUCCESS;
|
||||
taosSeedRand(taosGetTimestampSec());
|
||||
|
||||
|
@ -950,7 +949,7 @@ void taos_init_imp(void) {
|
|||
(void)snprintf(logDirName, 64, "taoslog");
|
||||
#endif
|
||||
if (taosCreateLog(logDirName, 10, configDir, NULL, NULL, NULL, NULL, 1) != 0) {
|
||||
printf(" WARING: Create %s failed:%s. configDir=%s\n", logDirName, strerror(errno), configDir);
|
||||
(void)printf(" WARING: Create %s failed:%s. configDir=%s\n", logDirName, strerror(errno), configDir);
|
||||
tscInitRes = -1;
|
||||
return;
|
||||
}
|
||||
|
@ -994,7 +993,7 @@ void taos_init_imp(void) {
|
|||
}
|
||||
|
||||
int taos_init() {
|
||||
taosThreadOnce(&tscinit, taos_init_imp);
|
||||
(void)taosThreadOnce(&tscinit, taos_init_imp);
|
||||
return tscInitRes;
|
||||
}
|
||||
|
||||
|
|
|
@ -1330,6 +1330,10 @@ static void *hbThreadFunc(void *param) {
|
|||
continue;
|
||||
}
|
||||
int tlen = tSerializeSClientHbBatchReq(NULL, 0, pReq);
|
||||
if (tlen == -1) {
|
||||
tFreeClientHbBatchReq(pReq);
|
||||
break;
|
||||
}
|
||||
void *buf = taosMemoryMalloc(tlen);
|
||||
if (buf == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
|
@ -1338,7 +1342,11 @@ static void *hbThreadFunc(void *param) {
|
|||
break;
|
||||
}
|
||||
|
||||
tSerializeSClientHbBatchReq(buf, tlen, pReq);
|
||||
if (tSerializeSClientHbBatchReq(buf, tlen, pReq) == -1) {
|
||||
tFreeClientHbBatchReq(pReq);
|
||||
taosMemoryFree(buf);
|
||||
break;
|
||||
}
|
||||
SMsgSendInfo *pInfo = taosMemoryCalloc(1, sizeof(SMsgSendInfo));
|
||||
|
||||
if (pInfo == NULL) {
|
||||
|
@ -1361,10 +1369,12 @@ static void *hbThreadFunc(void *param) {
|
|||
SAppInstInfo *pAppInstInfo = pAppHbMgr->pAppInstInfo;
|
||||
int64_t transporterId = 0;
|
||||
SEpSet epSet = getEpSet_s(&pAppInstInfo->mgmtEp);
|
||||
asyncSendMsgToServer(pAppInstInfo->pTransporter, &epSet, &transporterId, pInfo);
|
||||
if (TSDB_CODE_SUCCESS != asyncSendMsgToServer(pAppInstInfo->pTransporter, &epSet, &transporterId, pInfo)) {
|
||||
tscWarn("failed to async send msg to server");
|
||||
}
|
||||
tFreeClientHbBatchReq(pReq);
|
||||
// hbClearReqInfo(pAppHbMgr);
|
||||
atomic_add_fetch_32(&pAppHbMgr->reportCnt, 1);
|
||||
(void)atomic_add_fetch_32(&pAppHbMgr->reportCnt, 1);
|
||||
}
|
||||
|
||||
if (TSDB_CODE_SUCCESS != taosThreadMutexUnlock(&clientHbMgr.lock)) {
|
||||
|
@ -1629,7 +1639,7 @@ void hbDeregisterConn(STscObj *pTscObj, SClientHbKey connKey) {
|
|||
SClientHbReq *pReq = taosHashAcquire(pAppHbMgr->activeInfo, &connKey, sizeof(SClientHbKey));
|
||||
if (pReq) {
|
||||
tFreeClientHbReq(pReq);
|
||||
taosHashRemove(pAppHbMgr->activeInfo, &connKey, sizeof(SClientHbKey));
|
||||
(void)taosHashRemove(pAppHbMgr->activeInfo, &connKey, sizeof(SClientHbKey));
|
||||
taosHashRelease(pAppHbMgr->activeInfo, pReq);
|
||||
(void)atomic_sub_fetch_32(&pAppHbMgr->connKeyCnt, 1);
|
||||
}
|
||||
|
|
|
@ -332,7 +332,6 @@ int32_t execDdlQuery(SRequestObj* pRequest, SQuery* pQuery) {
|
|||
|
||||
int64_t transporterId = 0;
|
||||
TSC_ERR_RET(asyncSendMsgToServer(pTscObj->pAppInfo->pTransporter, &pMsgInfo->epSet, &transporterId, pSendMsg));
|
||||
|
||||
(void)tsem_wait(&pRequest->body.rspSem);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
@ -1083,7 +1082,7 @@ void postSubQueryFetchCb(void* param, TAOS_RES* res, int32_t rowNum) {
|
|||
SRequestObj* pNextReq = acquireRequest(pRequest->relation.nextRefId);
|
||||
if (pNextReq) {
|
||||
continuePostSubQuery(pNextReq, pBlock);
|
||||
releaseRequest(pRequest->relation.nextRefId);
|
||||
(void)releaseRequest(pRequest->relation.nextRefId);
|
||||
} else {
|
||||
tscError("0x%" PRIx64 ", next req ref 0x%" PRIx64 " is not there, reqId:0x%" PRIx64, pRequest->self,
|
||||
pRequest->relation.nextRefId, pRequest->requestId);
|
||||
|
@ -2545,7 +2544,7 @@ int32_t appendTbToReq(SHashObj* pHash, int32_t pos1, int32_t len1, int32_t pos2,
|
|||
}
|
||||
|
||||
char dbFName[TSDB_DB_FNAME_LEN];
|
||||
sprintf(dbFName, "%d.%.*s", acctId, dbLen, dbName);
|
||||
(void)sprintf(dbFName, "%d.%.*s", acctId, dbLen, dbName);
|
||||
|
||||
STablesReq* pDb = taosHashGet(pHash, dbFName, strlen(dbFName));
|
||||
if (pDb) {
|
||||
|
|
|
@ -484,7 +484,7 @@ JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_getSchemaMetaData
|
|||
(*env)->SetIntField(env, metadataObj, g_metadataColindexField, i);
|
||||
jstring metadataObjColname = (*env)->NewStringUTF(env, fields[i].name);
|
||||
(*env)->SetObjectField(env, metadataObj, g_metadataColnameField, metadataObjColname);
|
||||
(*env)->CallBooleanMethod(env, arrayListObj, g_arrayListAddFp, metadataObj);
|
||||
(void)(*env)->CallBooleanMethod(env, arrayListObj, g_arrayListAddFp, metadataObj);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ int taos_options(TSDB_OPTION option, const void *arg, ...) {
|
|||
for (int i = 1; atomic_val_compare_exchange_32(&lock, 0, 1) != 0; ++i) {
|
||||
if (i % 1000 == 0) {
|
||||
tscInfo("haven't acquire lock after spin %d times.", i);
|
||||
sched_yield();
|
||||
(void)sched_yield();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -754,7 +754,7 @@ bool taos_is_update_query(TAOS_RES *res) { return taos_num_fields(res) == 0; }
|
|||
|
||||
int taos_fetch_block(TAOS_RES *res, TAOS_ROW *rows) {
|
||||
int32_t numOfRows = 0;
|
||||
/*int32_t code = */ taos_fetch_block_s(res, &numOfRows, rows);
|
||||
/*int32_t code = */ terrno = taos_fetch_block_s(res, &numOfRows, rows);
|
||||
return numOfRows;
|
||||
}
|
||||
|
||||
|
|
|
@ -21,13 +21,10 @@ SHashObj* monitorSlowLogHash;
|
|||
char tmpSlowLogPath[PATH_MAX] = {0};
|
||||
|
||||
static int32_t getSlowLogTmpDir(char* tmpPath, int32_t size) {
|
||||
if (tsTempDir == NULL) {
|
||||
return -1;
|
||||
}
|
||||
int ret = snprintf(tmpPath, size, "%s/tdengine_slow_log/", tsTempDir);
|
||||
if (ret < 0) {
|
||||
tscError("failed to get tmp path ret:%d", ret);
|
||||
return ret;
|
||||
return TSDB_CODE_TSC_INTERNAL_ERROR;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -71,10 +68,9 @@ static void destroyMonitorClient(void* data) {
|
|||
if (pMonitor == NULL) {
|
||||
return;
|
||||
}
|
||||
taosTmrStopA(&pMonitor->timer);
|
||||
(void)taosTmrStopA(&pMonitor->timer);
|
||||
taosHashCleanup(pMonitor->counters);
|
||||
taos_collector_registry_destroy(pMonitor->registry);
|
||||
// taos_collector_destroy(pMonitor->colector);
|
||||
(void)taos_collector_registry_destroy(pMonitor->registry);
|
||||
taosMemoryFree(pMonitor);
|
||||
}
|
||||
|
||||
|
@ -142,15 +138,17 @@ static int32_t sendReport(void* pTransporter, SEpSet* epSet, char* pCont, MONITO
|
|||
void* buf = taosMemoryMalloc(tlen);
|
||||
if (buf == NULL) {
|
||||
tscError("sendReport failed, out of memory, len:%d", tlen);
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
goto FAILED;
|
||||
}
|
||||
tSerializeSStatisReq(buf, tlen, &sStatisReq);
|
||||
tlen = tSerializeSStatisReq(buf, tlen, &sStatisReq);
|
||||
if (tlen < 0) {
|
||||
taosMemoryFree(buf);
|
||||
goto FAILED;
|
||||
}
|
||||
|
||||
SMsgSendInfo* pInfo = taosMemoryCalloc(1, sizeof(SMsgSendInfo));
|
||||
if (pInfo == NULL) {
|
||||
tscError("sendReport failed, out of memory send info");
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
taosMemoryFree(buf);
|
||||
goto FAILED;
|
||||
}
|
||||
|
@ -168,12 +166,12 @@ static int32_t sendReport(void* pTransporter, SEpSet* epSet, char* pCont, MONITO
|
|||
|
||||
FAILED:
|
||||
monitorFreeSlowLogDataEx(param);
|
||||
return -1;
|
||||
return TAOS_GET_TERRNO(TSDB_CODE_TSC_INTERNAL_ERROR);
|
||||
}
|
||||
|
||||
static void generateClusterReport(taos_collector_registry_t* registry, void* pTransporter, SEpSet* epSet) {
|
||||
char ts[50] = {0};
|
||||
sprintf(ts, "%" PRId64, taosGetTimestamp(TSDB_TIME_PRECISION_MILLI));
|
||||
(void)sprintf(ts, "%" PRId64, taosGetTimestamp(TSDB_TIME_PRECISION_MILLI));
|
||||
char* pCont = (char*)taos_collector_registry_bridge_new(registry, ts, "%" PRId64, NULL);
|
||||
if (NULL == pCont) {
|
||||
tscError("generateClusterReport failed, get null content.");
|
||||
|
@ -181,7 +179,7 @@ static void generateClusterReport(taos_collector_registry_t* registry, void* pTr
|
|||
}
|
||||
|
||||
if (strlen(pCont) != 0 && sendReport(pTransporter, epSet, pCont, MONITOR_TYPE_COUNTER, NULL) == 0) {
|
||||
taos_collector_registry_clear_batch(registry);
|
||||
(void)taos_collector_registry_clear_batch(registry);
|
||||
}
|
||||
taosMemoryFreeClear(pCont);
|
||||
}
|
||||
|
@ -202,7 +200,7 @@ static void reportSendProcess(void* param, void* tmrId) {
|
|||
|
||||
SEpSet ep = getEpSet_s(&pInst->mgmtEp);
|
||||
generateClusterReport(pMonitor->registry, pInst->pTransporter, &ep);
|
||||
taosTmrReset(reportSendProcess, pInst->monitorParas.tsMonitorInterval * 1000, param, monitorTimer, &tmrId);
|
||||
(void)taosTmrReset(reportSendProcess, pInst->monitorParas.tsMonitorInterval * 1000, param, monitorTimer, &tmrId);
|
||||
taosRUnLockLatch(&monitorLock);
|
||||
}
|
||||
|
||||
|
@ -250,14 +248,13 @@ void monitorCreateClient(int64_t clusterId) {
|
|||
goto fail;
|
||||
}
|
||||
|
||||
taos_collector_registry_register_collector(pMonitor->registry, pMonitor->colector);
|
||||
(void)taos_collector_registry_register_collector(pMonitor->registry, pMonitor->colector);
|
||||
pMonitor->counters =
|
||||
(SHashObj*)taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK);
|
||||
if (pMonitor->counters == NULL) {
|
||||
tscError("failed to create monitor counters");
|
||||
goto fail;
|
||||
}
|
||||
// taosHashSetFreeFp(pMonitor->counters, destroyCounter);
|
||||
|
||||
if (taosHashPut(monitorCounterHash, &clusterId, LONG_BYTES, &pMonitor, POINTER_BYTES) != 0) {
|
||||
tscError("failed to put monitor client to hash");
|
||||
|
@ -300,10 +297,14 @@ void monitorCreateClientCounter(int64_t clusterId, const char* name, const char*
|
|||
taos_counter_t* newCounter = taos_counter_new(name, help, label_key_count, label_keys);
|
||||
if (newCounter == NULL) return;
|
||||
MonitorClient* pMonitor = *ppMonitor;
|
||||
taos_collector_add_metric(pMonitor->colector, newCounter);
|
||||
if (taos_collector_add_metric(pMonitor->colector, newCounter) != 0){
|
||||
tscError("failed to add metric to collector");
|
||||
(void)taos_counter_destroy(newCounter);
|
||||
goto end;
|
||||
}
|
||||
if (taosHashPut(pMonitor->counters, name, strlen(name), &newCounter, POINTER_BYTES) != 0) {
|
||||
tscError("failed to put counter to monitor");
|
||||
taos_counter_destroy(newCounter);
|
||||
(void)taos_counter_destroy(newCounter);
|
||||
goto end;
|
||||
}
|
||||
tscInfo("[monitor] monitorCreateClientCounter %" PRIx64 "(%p):%s : %p.", pMonitor->clusterId, pMonitor, name,
|
||||
|
@ -332,7 +333,10 @@ void monitorCounterInc(int64_t clusterId, const char* counterName, const char**
|
|||
tscError("monitorCounterInc not found pCounter %" PRIx64 ":%s.", clusterId, counterName);
|
||||
goto end;
|
||||
}
|
||||
taos_counter_inc(*ppCounter, label_values);
|
||||
if (taos_counter_inc(*ppCounter, label_values) != 0){
|
||||
tscError("monitorCounterInc failed to inc %" PRIx64 ":%s.", clusterId, counterName);
|
||||
goto end;
|
||||
}
|
||||
tscDebug("[monitor] monitorCounterInc %" PRIx64 "(%p):%s", pMonitor->clusterId, pMonitor, counterName);
|
||||
|
||||
end:
|
||||
|
@ -360,24 +364,23 @@ static void monitorWriteSlowLog2File(MonitorSlowLogData* slowLogData, char* tmpP
|
|||
tscInfo("[monitor] create slow log file:%s", path);
|
||||
pFile = taosOpenFile(path, TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_APPEND | TD_FILE_READ | TD_FILE_TRUNC);
|
||||
if (pFile == NULL) {
|
||||
terrno = TAOS_SYSTEM_ERROR(errno);
|
||||
tscError("failed to open file:%s since %s", path, terrstr());
|
||||
tscError("failed to open file:%s since %d", path, errno);
|
||||
return;
|
||||
}
|
||||
|
||||
SlowLogClient* pClient = taosMemoryCalloc(1, sizeof(SlowLogClient));
|
||||
if (pClient == NULL) {
|
||||
tscError("failed to allocate memory for slow log client");
|
||||
taosCloseFile(&pFile);
|
||||
(void)taosCloseFile(&pFile);
|
||||
return;
|
||||
}
|
||||
pClient->lastCheckTime = taosGetMonoTimestampMs();
|
||||
strcpy(pClient->path, path);
|
||||
(void)strcpy(pClient->path, path);
|
||||
pClient->offset = 0;
|
||||
pClient->pFile = pFile;
|
||||
if (taosHashPut(monitorSlowLogHash, &slowLogData->clusterId, LONG_BYTES, &pClient, POINTER_BYTES) != 0) {
|
||||
tscError("failed to put clusterId:%" PRId64 " to hash table", slowLogData->clusterId);
|
||||
taosCloseFile(&pFile);
|
||||
(void)taosCloseFile(&pFile);
|
||||
taosMemoryFree(pClient);
|
||||
return;
|
||||
}
|
||||
|
@ -423,7 +426,7 @@ static char* readFile(TdFilePtr pFile, int64_t* offset, int64_t size) {
|
|||
return NULL;
|
||||
}
|
||||
char* buf = pCont;
|
||||
strcat(buf++, "[");
|
||||
(void)strcat(buf++, "[");
|
||||
int64_t readSize = taosReadFile(pFile, buf, SLOW_LOG_SEND_SIZE_MAX);
|
||||
if (readSize <= 0) {
|
||||
if (readSize < 0) {
|
||||
|
@ -454,7 +457,7 @@ static char* readFile(TdFilePtr pFile, int64_t* offset, int64_t size) {
|
|||
static int64_t getFileSize(char* path) {
|
||||
int64_t fileSize = 0;
|
||||
if (taosStatFile(path, &fileSize, NULL, NULL) < 0) {
|
||||
return -1;
|
||||
return TSDB_CODE_TSC_INTERNAL_ERROR;
|
||||
}
|
||||
|
||||
return fileSize;
|
||||
|
@ -464,13 +467,13 @@ static int32_t sendSlowLog(int64_t clusterId, char* data, TdFilePtr pFile, int64
|
|||
char* fileName, void* pTransporter, SEpSet* epSet) {
|
||||
if (data == NULL) {
|
||||
taosMemoryFree(fileName);
|
||||
return -1;
|
||||
return TSDB_CODE_INVALID_PARA;
|
||||
}
|
||||
MonitorSlowLogData* pParam = taosMemoryMalloc(sizeof(MonitorSlowLogData));
|
||||
if (pParam == NULL) {
|
||||
taosMemoryFree(data);
|
||||
taosMemoryFree(fileName);
|
||||
return -1;
|
||||
return terrno;
|
||||
}
|
||||
pParam->data = data;
|
||||
pParam->offset = offset;
|
||||
|
@ -486,7 +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);
|
||||
return -1;
|
||||
return terrno;
|
||||
}
|
||||
SEpSet ep = getEpSet_s(&pInst->mgmtEp);
|
||||
char* data = readFile(pFile, offset, size);
|
||||
|
@ -495,13 +498,20 @@ static int32_t monitorReadSend(int64_t clusterId, TdFilePtr pFile, int64_t* offs
|
|||
}
|
||||
|
||||
static void monitorSendSlowLogAtBeginning(int64_t clusterId, char** fileName, TdFilePtr pFile, int64_t offset) {
|
||||
if (fileName == NULL){
|
||||
return;
|
||||
}
|
||||
int64_t size = getFileSize(*fileName);
|
||||
if (size <= offset) {
|
||||
processFileInTheEnd(pFile, *fileName);
|
||||
tscDebug("[monitor] monitorSendSlowLogAtBeginning delete file:%s", *fileName);
|
||||
} else {
|
||||
int32_t code = monitorReadSend(clusterId, pFile, &offset, size, SLOW_LOG_READ_BEGINNIG, *fileName);
|
||||
tscDebug("[monitor] monitorSendSlowLogAtBeginning send slow log clusterId:%" PRId64 ",ret:%d", clusterId, code);
|
||||
if (code == 0){
|
||||
tscDebug("[monitor] monitorSendSlowLogAtBeginning send slow log succ, clusterId:%" PRId64, clusterId);
|
||||
}else{
|
||||
tscError("[monitor] monitorSendSlowLogAtBeginning send slow log failed, clusterId:%" PRId64 ",ret:%d", clusterId, code);
|
||||
}
|
||||
*fileName = NULL;
|
||||
}
|
||||
}
|
||||
|
@ -509,10 +519,12 @@ static void monitorSendSlowLogAtBeginning(int64_t clusterId, char** fileName, Td
|
|||
static void monitorSendSlowLogAtRunning(int64_t clusterId) {
|
||||
void* tmp = taosHashGet(monitorSlowLogHash, &clusterId, LONG_BYTES);
|
||||
if (tmp == NULL) {
|
||||
tscError("failed to get slow log client by clusterId:%" PRId64, clusterId);
|
||||
return;
|
||||
}
|
||||
SlowLogClient* pClient = (*(SlowLogClient**)tmp);
|
||||
if (pClient == NULL) {
|
||||
tscError("failed to get slow log client by clusterId:%" PRId64, clusterId);
|
||||
return;
|
||||
}
|
||||
int64_t size = getFileSize(pClient->path);
|
||||
|
@ -574,14 +586,16 @@ static void monitorSendAllSlowLogAtQuit() {
|
|||
}
|
||||
|
||||
static void processFileRemoved(SlowLogClient* pClient) {
|
||||
taosUnLockFile(pClient->pFile);
|
||||
taosCloseFile(&(pClient->pFile));
|
||||
if (taosUnLockFile(pClient->pFile) != 0) {
|
||||
tscError("failed to unlock file:%s since %d", pClient->path, errno);
|
||||
return;
|
||||
}
|
||||
(void)taosCloseFile(&(pClient->pFile));
|
||||
|
||||
TdFilePtr pFile =
|
||||
taosOpenFile(pClient->path, TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_APPEND | TD_FILE_READ | TD_FILE_TRUNC);
|
||||
if (pFile == NULL) {
|
||||
terrno = TAOS_SYSTEM_ERROR(errno);
|
||||
tscError("failed to open file:%s since %s", pClient->path, terrstr());
|
||||
tscError("failed to open file:%s since %d", pClient->path, errno);
|
||||
} else {
|
||||
pClient->pFile = pFile;
|
||||
}
|
||||
|
@ -594,7 +608,7 @@ static void monitorSendAllSlowLog() {
|
|||
int64_t* clusterId = (int64_t*)taosHashGetKey(pIter, NULL);
|
||||
SAppInstInfo* pInst = getAppInstByClusterId(*clusterId);
|
||||
SlowLogClient* pClient = (*(SlowLogClient**)pIter);
|
||||
if (pClient == NULL) {
|
||||
if (pClient == NULL || pInst == NULL) {
|
||||
taosHashCancelIterate(monitorSlowLogHash, pIter);
|
||||
return;
|
||||
}
|
||||
|
@ -604,7 +618,7 @@ static void monitorSendAllSlowLog() {
|
|||
continue;
|
||||
}
|
||||
|
||||
if (pInst != NULL && pClient->offset == 0) {
|
||||
if (pClient->offset == 0) {
|
||||
int64_t size = getFileSize(pClient->path);
|
||||
if (size <= 0) {
|
||||
if (size < 0) {
|
||||
|
@ -657,7 +671,7 @@ static void monitorSendAllSlowLogFromTempDir(int64_t clusterId) {
|
|||
}
|
||||
|
||||
char filename[PATH_MAX] = {0};
|
||||
snprintf(filename, sizeof(filename), "%s%s", tmpPath, name);
|
||||
(void)snprintf(filename, sizeof(filename), "%s%s", tmpPath, name);
|
||||
TdFilePtr pFile = taosOpenFile(filename, TD_FILE_READ | TD_FILE_WRITE);
|
||||
if (pFile == NULL) {
|
||||
tscError("failed to open file:%s since %s", filename, terrstr());
|
||||
|
@ -665,7 +679,7 @@ static void monitorSendAllSlowLogFromTempDir(int64_t clusterId) {
|
|||
}
|
||||
if (taosLockFile(pFile) < 0) {
|
||||
tscError("failed to lock file:%s since %s, maybe used by other process", filename, terrstr());
|
||||
taosCloseFile(&pFile);
|
||||
(void)taosCloseFile(&pFile);
|
||||
continue;
|
||||
}
|
||||
char* tmp = taosStrdup(filename);
|
||||
|
@ -673,7 +687,7 @@ static void monitorSendAllSlowLogFromTempDir(int64_t clusterId) {
|
|||
taosMemoryFree(tmp);
|
||||
}
|
||||
|
||||
taosCloseDir(&pDir);
|
||||
(void)taosCloseDir(&pDir);
|
||||
}
|
||||
|
||||
static void* monitorThreadFunc(void* param) {
|
||||
|
@ -707,7 +721,7 @@ static void* monitorThreadFunc(void* param) {
|
|||
}
|
||||
|
||||
MonitorSlowLogData* slowLogData = NULL;
|
||||
taosReadQitem(monitorQueue, (void**)&slowLogData);
|
||||
(void)taosReadQitem(monitorQueue, (void**)&slowLogData);
|
||||
if (slowLogData != NULL) {
|
||||
if (slowLogData->type == SLOW_LOG_READ_BEGINNIG) {
|
||||
if (slowLogData->pFile != NULL) {
|
||||
|
@ -735,7 +749,7 @@ static void* monitorThreadFunc(void* param) {
|
|||
if (quitCnt == 0) {
|
||||
monitorSendAllSlowLog();
|
||||
}
|
||||
tsem2_timewait(&monitorSem, 100);
|
||||
(void)tsem2_timewait(&monitorSem, 100);
|
||||
}
|
||||
atomic_store_32(&slowLogFlag, -2);
|
||||
return NULL;
|
||||
|
@ -743,15 +757,22 @@ static void* monitorThreadFunc(void* param) {
|
|||
|
||||
static int32_t tscMonitortInit() {
|
||||
TdThreadAttr thAttr;
|
||||
taosThreadAttrInit(&thAttr);
|
||||
taosThreadAttrSetDetachState(&thAttr, PTHREAD_CREATE_JOINABLE);
|
||||
if (taosThreadAttrInit(&thAttr) != 0) {
|
||||
tscError("failed to init thread attr since %s", strerror(errno));
|
||||
return TSDB_CODE_TSC_INTERNAL_ERROR;
|
||||
}
|
||||
if (taosThreadAttrSetDetachState(&thAttr, PTHREAD_CREATE_JOINABLE) != 0) {
|
||||
tscError("failed to set thread attr since %s", strerror(errno));
|
||||
return TSDB_CODE_TSC_INTERNAL_ERROR;
|
||||
}
|
||||
|
||||
TdThread monitorThread;
|
||||
if (taosThreadCreate(&monitorThread, &thAttr, monitorThreadFunc, NULL) != 0) {
|
||||
tscError("failed to create monitor thread since %s", strerror(errno));
|
||||
return -1;
|
||||
return TSDB_CODE_TSC_INTERNAL_ERROR;
|
||||
}
|
||||
|
||||
taosThreadAttrDestroy(&thAttr);
|
||||
(void)taosThreadAttrDestroy(&thAttr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -767,15 +788,14 @@ static void tscMonitorStop() {
|
|||
}
|
||||
|
||||
int32_t monitorInit() {
|
||||
int32_t code;
|
||||
int32_t code = 0;
|
||||
|
||||
tscInfo("[monitor] tscMonitor init");
|
||||
monitorCounterHash =
|
||||
(SHashObj*)taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_ENTRY_LOCK);
|
||||
if (monitorCounterHash == NULL) {
|
||||
tscError("failed to create monitorCounterHash");
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return -1;
|
||||
return TAOS_GET_TERRNO(TSDB_CODE_OUT_OF_MEMORY);
|
||||
}
|
||||
taosHashSetFreeFp(monitorCounterHash, destroyMonitorClient);
|
||||
|
||||
|
@ -783,46 +803,39 @@ int32_t monitorInit() {
|
|||
(SHashObj*)taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_ENTRY_LOCK);
|
||||
if (monitorSlowLogHash == NULL) {
|
||||
tscError("failed to create monitorSlowLogHash");
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return -1;
|
||||
return TAOS_GET_TERRNO(TSDB_CODE_OUT_OF_MEMORY);
|
||||
}
|
||||
taosHashSetFreeFp(monitorSlowLogHash, destroySlowLogClient);
|
||||
|
||||
monitorTimer = taosTmrInit(0, 0, 0, "MONITOR");
|
||||
if (monitorTimer == NULL) {
|
||||
tscError("failed to create monitor timer");
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return -1;
|
||||
return TAOS_GET_TERRNO(TSDB_CODE_OUT_OF_MEMORY);
|
||||
}
|
||||
|
||||
if (getSlowLogTmpDir(tmpSlowLogPath, sizeof(tmpSlowLogPath)) < 0) {
|
||||
terrno = TSDB_CODE_TSC_INTERNAL_ERROR;
|
||||
return -1;
|
||||
code = getSlowLogTmpDir(tmpSlowLogPath, sizeof(tmpSlowLogPath));
|
||||
if (code != 0) {
|
||||
return code;
|
||||
}
|
||||
|
||||
if (taosMulModeMkDir(tmpSlowLogPath, 0777, true) != 0) {
|
||||
tscError("failed to create dir:%s since %s", tmpSlowLogPath, terrstr());
|
||||
return terrno;
|
||||
return TAOS_GET_TERRNO(TSDB_CODE_OUT_OF_MEMORY);
|
||||
}
|
||||
|
||||
if (tsem2_init(&monitorSem, 0, 0) != 0) {
|
||||
terrno = TAOS_SYSTEM_ERROR(errno);
|
||||
tscError("sem init error since %s", terrstr());
|
||||
return -1;
|
||||
return TAOS_SYSTEM_ERROR(errno);
|
||||
}
|
||||
|
||||
code = taosOpenQueue(&monitorQueue);
|
||||
if (code) {
|
||||
terrno = code;
|
||||
tscError("open queue error since %s", terrstr());
|
||||
return -1;
|
||||
return TAOS_GET_TERRNO(code);
|
||||
}
|
||||
|
||||
taosInitRWLatch(&monitorLock);
|
||||
if (tscMonitortInit() != 0) {
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
return tscMonitortInit();
|
||||
}
|
||||
|
||||
void monitorClose() {
|
||||
|
@ -838,13 +851,13 @@ void monitorClose() {
|
|||
taosHashCleanup(monitorSlowLogHash);
|
||||
taosTmrCleanUp(monitorTimer);
|
||||
taosCloseQueue(monitorQueue);
|
||||
tsem2_destroy(&monitorSem);
|
||||
(void)tsem2_destroy(&monitorSem);
|
||||
taosWUnLockLatch(&monitorLock);
|
||||
}
|
||||
|
||||
int32_t monitorPutData2MonitorQueue(MonitorSlowLogData data) {
|
||||
int32_t code;
|
||||
MonitorSlowLogData* slowLogData;
|
||||
int32_t code = 0;
|
||||
MonitorSlowLogData* slowLogData = NULL;
|
||||
|
||||
if (atomic_load_32(&slowLogFlag) == -2) {
|
||||
tscError("[monitor] slow log thread is exiting");
|
||||
|
@ -854,13 +867,13 @@ int32_t monitorPutData2MonitorQueue(MonitorSlowLogData data) {
|
|||
code = taosAllocateQitem(sizeof(MonitorSlowLogData), DEF_QITEM, 0, (void**)&slowLogData);
|
||||
if (code) {
|
||||
tscError("[monitor] failed to allocate slow log data");
|
||||
return terrno = code;
|
||||
return code;
|
||||
}
|
||||
*slowLogData = data;
|
||||
tscDebug("[monitor] write slow log to queue, clusterId:%" PRIx64 " type:%s, data:%s", slowLogData->clusterId,
|
||||
queueTypeStr[slowLogData->type], slowLogData->data);
|
||||
if (taosWriteQitem(monitorQueue, slowLogData) == 0) {
|
||||
tsem2_post(&monitorSem);
|
||||
(void)tsem2_post(&monitorSem);
|
||||
} else {
|
||||
monitorFreeSlowLogData(slowLogData);
|
||||
taosFreeQitem(slowLogData);
|
||||
|
|
|
@ -69,7 +69,7 @@ void slowQueryLog(int64_t rid, bool killed, int32_t code, int32_t cost) {
|
|||
} else {
|
||||
clientSlowQueryLog(pTscObj->pAppInfo->clusterId, pTscObj->user, result, cost);
|
||||
}
|
||||
releaseTscObj(rid);
|
||||
(void)releaseTscObj(rid);
|
||||
} else {
|
||||
tscLog("slowQueryLog, not found rid");
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ void sqlReqLog(int64_t rid, bool killed, int32_t code, int8_t type) {
|
|||
} else {
|
||||
clientSQLReqLog(pTscObj->pAppInfo->clusterId, pTscObj->user, result, type);
|
||||
}
|
||||
releaseTscObj(rid);
|
||||
(void)releaseTscObj(rid);
|
||||
} else {
|
||||
tscLog("sqlReqLog, not found rid");
|
||||
}
|
||||
|
|
|
@ -40,7 +40,9 @@ int32_t genericRspCallback(void* param, SDataBuf* pMsg, int32_t code) {
|
|||
setErrno(pRequest, code);
|
||||
|
||||
if (NEED_CLIENT_RM_TBLMETA_REQ(pRequest->type)) {
|
||||
removeMeta(pRequest->pTscObj, pRequest->targetTableList, IS_VIEW_REQUEST(pRequest->type));
|
||||
if (removeMeta(pRequest->pTscObj, pRequest->targetTableList, IS_VIEW_REQUEST(pRequest->type)) != 0){
|
||||
tscError("failed to remove meta data for table");
|
||||
}
|
||||
}
|
||||
|
||||
taosMemoryFree(pMsg->pEpSet);
|
||||
|
@ -48,7 +50,7 @@ int32_t genericRspCallback(void* param, SDataBuf* pMsg, int32_t code) {
|
|||
if (pRequest->body.queryFp != NULL) {
|
||||
doRequestCallback(pRequest, code);
|
||||
} else {
|
||||
tsem_post(&pRequest->body.rspSem);
|
||||
(void)tsem_post(&pRequest->body.rspSem);
|
||||
}
|
||||
return code;
|
||||
}
|
||||
|
@ -61,7 +63,7 @@ int32_t processConnectRsp(void* param, SDataBuf* pMsg, int32_t code) {
|
|||
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
setErrno(pRequest, code);
|
||||
tsem_post(&pRequest->body.rspSem);
|
||||
(void)tsem_post(&pRequest->body.rspSem);
|
||||
goto End;
|
||||
}
|
||||
|
||||
|
@ -70,7 +72,7 @@ int32_t processConnectRsp(void* param, SDataBuf* pMsg, int32_t code) {
|
|||
if (NULL == pTscObj->pAppInfo) {
|
||||
code = TSDB_CODE_TSC_DISCONNECTED;
|
||||
setErrno(pRequest, code);
|
||||
tsem_post(&pRequest->body.rspSem);
|
||||
(void)tsem_post(&pRequest->body.rspSem);
|
||||
goto End;
|
||||
}
|
||||
|
||||
|
@ -78,14 +80,14 @@ int32_t processConnectRsp(void* param, SDataBuf* pMsg, int32_t code) {
|
|||
if (tDeserializeSConnectRsp(pMsg->pData, pMsg->len, &connectRsp) != 0) {
|
||||
code = TSDB_CODE_TSC_INVALID_VERSION;
|
||||
setErrno(pRequest, code);
|
||||
tsem_post(&pRequest->body.rspSem);
|
||||
(void)tsem_post(&pRequest->body.rspSem);
|
||||
goto End;
|
||||
}
|
||||
|
||||
if ((code = taosCheckVersionCompatibleFromStr(version, connectRsp.sVer, 3)) != 0) {
|
||||
tscError("version not compatible. client version: %s, server version: %s", version, connectRsp.sVer);
|
||||
setErrno(pRequest, code);
|
||||
tsem_post(&pRequest->body.rspSem);
|
||||
(void)tsem_post(&pRequest->body.rspSem);
|
||||
goto End;
|
||||
}
|
||||
|
||||
|
@ -95,14 +97,14 @@ int32_t processConnectRsp(void* param, SDataBuf* pMsg, int32_t code) {
|
|||
code = TSDB_CODE_TIME_UNSYNCED;
|
||||
tscError("time diff:%ds is too big", delta);
|
||||
setErrno(pRequest, code);
|
||||
tsem_post(&pRequest->body.rspSem);
|
||||
(void)tsem_post(&pRequest->body.rspSem);
|
||||
goto End;
|
||||
}
|
||||
|
||||
if (connectRsp.epSet.numOfEps == 0) {
|
||||
code = TSDB_CODE_APP_ERROR;
|
||||
setErrno(pRequest, code);
|
||||
tsem_post(&pRequest->body.rspSem);
|
||||
(void)tsem_post(&pRequest->body.rspSem);
|
||||
goto End;
|
||||
}
|
||||
|
||||
|
@ -111,8 +113,10 @@ int32_t processConnectRsp(void* param, SDataBuf* pMsg, int32_t code) {
|
|||
SEpSet srcEpSet = getEpSet_s(&pTscObj->pAppInfo->mgmtEp);
|
||||
SEpSet dstEpSet = connectRsp.epSet;
|
||||
if (srcEpSet.numOfEps == 1) {
|
||||
rpcSetDefaultAddr(pTscObj->pAppInfo->pTransporter, srcEpSet.eps[srcEpSet.inUse].fqdn,
|
||||
dstEpSet.eps[dstEpSet.inUse].fqdn);
|
||||
if (rpcSetDefaultAddr(pTscObj->pAppInfo->pTransporter, srcEpSet.eps[srcEpSet.inUse].fqdn,
|
||||
dstEpSet.eps[dstEpSet.inUse].fqdn) != 0){
|
||||
tscError("failed to set default addr for rpc");
|
||||
}
|
||||
updateEpSet = 0;
|
||||
}
|
||||
}
|
||||
|
@ -158,33 +162,35 @@ int32_t processConnectRsp(void* param, SDataBuf* pMsg, int32_t code) {
|
|||
MonitorSlowLogData data = {0};
|
||||
data.clusterId = pTscObj->pAppInfo->clusterId;
|
||||
data.type = SLOW_LOG_READ_BEGINNIG;
|
||||
monitorPutData2MonitorQueue(data);
|
||||
(void)monitorPutData2MonitorQueue(data); // ignore
|
||||
monitorClientSlowQueryInit(connectRsp.clusterId);
|
||||
monitorClientSQLReqInit(connectRsp.clusterId);
|
||||
}
|
||||
}
|
||||
|
||||
taosThreadMutexLock(&clientHbMgr.lock);
|
||||
(void)taosThreadMutexLock(&clientHbMgr.lock);
|
||||
SAppHbMgr* pAppHbMgr = taosArrayGetP(clientHbMgr.appHbMgrs, pTscObj->appHbMgrIdx);
|
||||
if (pAppHbMgr) {
|
||||
hbRegisterConn(pAppHbMgr, pTscObj->id, connectRsp.clusterId, connectRsp.connType);
|
||||
if (hbRegisterConn(pAppHbMgr, pTscObj->id, connectRsp.clusterId, connectRsp.connType) != 0){
|
||||
tscError("0x%" PRIx64 " failed to register conn to hbMgr", pRequest->requestId);
|
||||
}
|
||||
} else {
|
||||
taosThreadMutexUnlock(&clientHbMgr.lock);
|
||||
(void)taosThreadMutexUnlock(&clientHbMgr.lock);
|
||||
code = TSDB_CODE_TSC_DISCONNECTED;
|
||||
setErrno(pRequest, code);
|
||||
tsem_post(&pRequest->body.rspSem);
|
||||
(void)tsem_post(&pRequest->body.rspSem);
|
||||
goto End;
|
||||
}
|
||||
taosThreadMutexUnlock(&clientHbMgr.lock);
|
||||
(void)taosThreadMutexUnlock(&clientHbMgr.lock);
|
||||
|
||||
tscDebug("0x%" PRIx64 " clusterId:%" PRId64 ", totalConn:%" PRId64, pRequest->requestId, connectRsp.clusterId,
|
||||
pTscObj->pAppInfo->numOfConns);
|
||||
|
||||
tsem_post(&pRequest->body.rspSem);
|
||||
(void)tsem_post(&pRequest->body.rspSem);
|
||||
End:
|
||||
|
||||
if (pRequest) {
|
||||
releaseRequest(pRequest->self);
|
||||
(void)releaseRequest(pRequest->self);
|
||||
}
|
||||
|
||||
taosMemoryFree(param);
|
||||
|
@ -216,7 +222,7 @@ int32_t processCreateDbRsp(void* param, SDataBuf* pMsg, int32_t code) {
|
|||
setErrno(pRequest, code);
|
||||
} else {
|
||||
struct SCatalog* pCatalog = NULL;
|
||||
int32_t code = catalogGetHandle(pRequest->pTscObj->pAppInfo->clusterId, &pCatalog);
|
||||
code = catalogGetHandle(pRequest->pTscObj->pAppInfo->clusterId, &pCatalog);
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
STscObj* pTscObj = pRequest->pTscObj;
|
||||
|
||||
|
@ -225,28 +231,33 @@ int32_t processCreateDbRsp(void* param, SDataBuf* pMsg, int32_t code) {
|
|||
.requestObjRefId = pRequest->self,
|
||||
.mgmtEps = getEpSet_s(&pTscObj->pAppInfo->mgmtEp)};
|
||||
char dbFName[TSDB_DB_FNAME_LEN];
|
||||
snprintf(dbFName, sizeof(dbFName) - 1, "%d.%s", pTscObj->acctId, TSDB_INFORMATION_SCHEMA_DB);
|
||||
catalogRefreshDBVgInfo(pCatalog, &conn, dbFName);
|
||||
snprintf(dbFName, sizeof(dbFName) - 1, "%d.%s", pTscObj->acctId, TSDB_PERFORMANCE_SCHEMA_DB);
|
||||
catalogRefreshDBVgInfo(pCatalog, &conn, dbFName);
|
||||
(void)snprintf(dbFName, sizeof(dbFName) - 1, "%d.%s", pTscObj->acctId, TSDB_INFORMATION_SCHEMA_DB);
|
||||
if (catalogRefreshDBVgInfo(pCatalog, &conn, dbFName) != 0){
|
||||
tscError("0x%" PRIx64 " failed to refresh db vg info", pRequest->requestId);
|
||||
}
|
||||
(void)snprintf(dbFName, sizeof(dbFName) - 1, "%d.%s", pTscObj->acctId, TSDB_PERFORMANCE_SCHEMA_DB);
|
||||
if (catalogRefreshDBVgInfo(pCatalog, &conn, dbFName) != 0){
|
||||
tscError("0x%" PRIx64 " failed to refresh db vg info", pRequest->requestId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (pRequest->body.queryFp) {
|
||||
doRequestCallback(pRequest, code);
|
||||
} else {
|
||||
tsem_post(&pRequest->body.rspSem);
|
||||
(void)tsem_post(&pRequest->body.rspSem);
|
||||
}
|
||||
return code;
|
||||
}
|
||||
|
||||
int32_t processUseDbRsp(void* param, SDataBuf* pMsg, int32_t code) {
|
||||
SRequestObj* pRequest = param;
|
||||
|
||||
if (TSDB_CODE_MND_DB_NOT_EXIST == code || TSDB_CODE_MND_DB_IN_CREATING == code ||
|
||||
TSDB_CODE_MND_DB_IN_DROPPING == code) {
|
||||
SUseDbRsp usedbRsp = {0};
|
||||
tDeserializeSUseDbRsp(pMsg->pData, pMsg->len, &usedbRsp);
|
||||
if (tDeserializeSUseDbRsp(pMsg->pData, pMsg->len, &usedbRsp) != 0){
|
||||
tscError("0x%" PRIx64 " deserialize SUseDbRsp failed", pRequest->requestId);
|
||||
}
|
||||
struct SCatalog* pCatalog = NULL;
|
||||
|
||||
if (usedbRsp.vgVersion >= 0) { // cached in local
|
||||
|
@ -256,10 +267,12 @@ int32_t processUseDbRsp(void* param, SDataBuf* pMsg, int32_t code) {
|
|||
tscWarn("0x%" PRIx64 "catalogGetHandle failed, clusterId:%" PRIx64 ", error:%s", pRequest->requestId, clusterId,
|
||||
tstrerror(code1));
|
||||
} else {
|
||||
catalogRemoveDB(pCatalog, usedbRsp.db, usedbRsp.uid);
|
||||
if (catalogRemoveDB(pCatalog, usedbRsp.db, usedbRsp.uid) != 0){
|
||||
tscError("0x%" PRIx64 "catalogRemoveDB failed, db:%s, uid:%" PRId64, pRequest->requestId, usedbRsp.db,
|
||||
usedbRsp.uid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tFreeSUsedbRsp(&usedbRsp);
|
||||
}
|
||||
|
||||
|
@ -272,14 +285,16 @@ int32_t processUseDbRsp(void* param, SDataBuf* pMsg, int32_t code) {
|
|||
doRequestCallback(pRequest, pRequest->code);
|
||||
|
||||
} else {
|
||||
tsem_post(&pRequest->body.rspSem);
|
||||
(void)tsem_post(&pRequest->body.rspSem);
|
||||
}
|
||||
|
||||
return code;
|
||||
}
|
||||
|
||||
SUseDbRsp usedbRsp = {0};
|
||||
tDeserializeSUseDbRsp(pMsg->pData, pMsg->len, &usedbRsp);
|
||||
if (tDeserializeSUseDbRsp(pMsg->pData, pMsg->len, &usedbRsp) != 0){
|
||||
tscError("0x%" PRIx64 " deserialize SUseDbRsp failed", pRequest->requestId);
|
||||
}
|
||||
|
||||
if (strlen(usedbRsp.db) == 0) {
|
||||
if (usedbRsp.errCode != 0) {
|
||||
|
@ -292,6 +307,9 @@ int32_t processUseDbRsp(void* param, SDataBuf* pMsg, int32_t code) {
|
|||
tscTrace("db:%s, usedbRsp received, numOfVgroups:%d", usedbRsp.db, usedbRsp.vgNum);
|
||||
for (int32_t i = 0; i < usedbRsp.vgNum; ++i) {
|
||||
SVgroupInfo* pInfo = taosArrayGet(usedbRsp.pVgroupInfos, i);
|
||||
if (pInfo == NULL){
|
||||
continue;
|
||||
}
|
||||
tscTrace("vgId:%d, numOfEps:%d inUse:%d ", pInfo->vgId, pInfo->epSet.numOfEps, pInfo->epSet.inUse);
|
||||
for (int32_t j = 0; j < pInfo->epSet.numOfEps; ++j) {
|
||||
tscTrace("vgId:%d, index:%d epset:%s:%u", pInfo->vgId, j, pInfo->epSet.eps[j].fqdn, pInfo->epSet.eps[j].port);
|
||||
|
@ -299,11 +317,12 @@ int32_t processUseDbRsp(void* param, SDataBuf* pMsg, int32_t code) {
|
|||
}
|
||||
|
||||
SName name = {0};
|
||||
tNameFromString(&name, usedbRsp.db, T_NAME_ACCT | T_NAME_DB);
|
||||
if(tNameFromString(&name, usedbRsp.db, T_NAME_ACCT | T_NAME_DB) != TSDB_CODE_SUCCESS) {
|
||||
tscError("0x%" PRIx64 " failed to parse db name:%s", pRequest->requestId, usedbRsp.db);
|
||||
}
|
||||
|
||||
SUseDbOutput output = {0};
|
||||
code = queryBuildUseDbOutput(&output, &usedbRsp);
|
||||
|
||||
if (code != 0) {
|
||||
terrno = code;
|
||||
if (output.dbVgroup) taosHashCleanup(output.dbVgroup->vgHash);
|
||||
|
@ -317,26 +336,31 @@ int32_t processUseDbRsp(void* param, SDataBuf* pMsg, int32_t code) {
|
|||
tscWarn("catalogGetHandle failed, clusterId:%" PRIx64 ", error:%s", pRequest->pTscObj->pAppInfo->clusterId,
|
||||
tstrerror(code1));
|
||||
} else {
|
||||
catalogUpdateDBVgInfo(pCatalog, output.db, output.dbId, output.dbVgroup);
|
||||
if (catalogUpdateDBVgInfo(pCatalog, output.db, output.dbId, output.dbVgroup) != 0){
|
||||
tscError("0x%" PRIx64 " failed to update db vg info, db:%s, dbId:%" PRId64, pRequest->requestId, output.db,
|
||||
output.dbId);
|
||||
}
|
||||
output.dbVgroup = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
taosMemoryFreeClear(output.dbVgroup);
|
||||
|
||||
tFreeSUsedbRsp(&usedbRsp);
|
||||
|
||||
char db[TSDB_DB_NAME_LEN] = {0};
|
||||
tNameGetDbName(&name, db);
|
||||
if(tNameGetDbName(&name, db) != TSDB_CODE_SUCCESS) {
|
||||
tscError("0x%" PRIx64 " failed to get db name since %s", pRequest->requestId, tstrerror(code));
|
||||
}
|
||||
|
||||
setConnectionDB(pRequest->pTscObj, db);
|
||||
|
||||
taosMemoryFree(pMsg->pData);
|
||||
taosMemoryFree(pMsg->pEpSet);
|
||||
|
||||
if (pRequest->body.queryFp != NULL) {
|
||||
doRequestCallback(pRequest, pRequest->code);
|
||||
} else {
|
||||
tsem_post(&pRequest->body.rspSem);
|
||||
(void)tsem_post(&pRequest->body.rspSem);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -353,7 +377,7 @@ int32_t processCreateSTableRsp(void* param, SDataBuf* pMsg, int32_t code) {
|
|||
SMCreateStbRsp createRsp = {0};
|
||||
SDecoder coder = {0};
|
||||
tDecoderInit(&coder, pMsg->pData, pMsg->len);
|
||||
tDecodeSMCreateStbRsp(&coder, &createRsp);
|
||||
(void)tDecodeSMCreateStbRsp(&coder, &createRsp); // pMsg->len == 0
|
||||
tDecoderClear(&coder);
|
||||
|
||||
pRequest->body.resInfo.execRes.msgType = TDMT_MND_CREATE_STB;
|
||||
|
@ -380,7 +404,7 @@ int32_t processCreateSTableRsp(void* param, SDataBuf* pMsg, int32_t code) {
|
|||
|
||||
doRequestCallback(pRequest, code);
|
||||
} else {
|
||||
tsem_post(&pRequest->body.rspSem);
|
||||
(void)tsem_post(&pRequest->body.rspSem);
|
||||
}
|
||||
return code;
|
||||
}
|
||||
|
@ -391,33 +415,41 @@ int32_t processDropDbRsp(void* param, SDataBuf* pMsg, int32_t code) {
|
|||
setErrno(pRequest, code);
|
||||
} else {
|
||||
SDropDbRsp dropdbRsp = {0};
|
||||
tDeserializeSDropDbRsp(pMsg->pData, pMsg->len, &dropdbRsp);
|
||||
|
||||
if (tDeserializeSDropDbRsp(pMsg->pData, pMsg->len, &dropdbRsp) != 0){
|
||||
tscError("0x%" PRIx64 " deserialize SDropDbRsp failed", pRequest->requestId);
|
||||
}
|
||||
struct SCatalog* pCatalog = NULL;
|
||||
int32_t code = catalogGetHandle(pRequest->pTscObj->pAppInfo->clusterId, &pCatalog);
|
||||
code = catalogGetHandle(pRequest->pTscObj->pAppInfo->clusterId, &pCatalog);
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
catalogRemoveDB(pCatalog, dropdbRsp.db, dropdbRsp.uid);
|
||||
if (catalogRemoveDB(pCatalog, dropdbRsp.db, dropdbRsp.uid) != 0){
|
||||
tscError("0x%" PRIx64 " failed to remove db:%s", pRequest->requestId, dropdbRsp.db);
|
||||
}
|
||||
STscObj* pTscObj = pRequest->pTscObj;
|
||||
|
||||
SRequestConnInfo conn = {.pTrans = pTscObj->pAppInfo->pTransporter,
|
||||
.requestId = pRequest->requestId,
|
||||
.requestObjRefId = pRequest->self,
|
||||
.mgmtEps = getEpSet_s(&pTscObj->pAppInfo->mgmtEp)};
|
||||
char dbFName[TSDB_DB_FNAME_LEN];
|
||||
snprintf(dbFName, sizeof(dbFName) - 1, "%d.%s", pTscObj->acctId, TSDB_INFORMATION_SCHEMA_DB);
|
||||
catalogRefreshDBVgInfo(pCatalog, &conn, dbFName);
|
||||
snprintf(dbFName, sizeof(dbFName) - 1, "%d.%s", pTscObj->acctId, TSDB_PERFORMANCE_SCHEMA_DB);
|
||||
catalogRefreshDBVgInfo(pCatalog, &conn, dbFName);
|
||||
char dbFName[TSDB_DB_FNAME_LEN] = {0};
|
||||
(void)snprintf(dbFName, sizeof(dbFName) - 1, "%d.%s", pTscObj->acctId, TSDB_INFORMATION_SCHEMA_DB);
|
||||
if (catalogRefreshDBVgInfo(pCatalog, &conn, dbFName) != TSDB_CODE_SUCCESS) {
|
||||
tscError("0x%" PRIx64 " failed to refresh db vg info, db:%s", pRequest->requestId, dbFName);
|
||||
}
|
||||
(void)snprintf(dbFName, sizeof(dbFName) - 1, "%d.%s", pTscObj->acctId, TSDB_PERFORMANCE_SCHEMA_DB);
|
||||
if (catalogRefreshDBVgInfo(pCatalog, &conn, dbFName) != 0) {
|
||||
tscError("0x%" PRIx64 " failed to refresh db vg info, db:%s", pRequest->requestId, dbFName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
END:
|
||||
taosMemoryFree(pMsg->pData);
|
||||
taosMemoryFree(pMsg->pEpSet);
|
||||
|
||||
if (pRequest->body.queryFp != NULL) {
|
||||
doRequestCallback(pRequest, code);
|
||||
} else {
|
||||
tsem_post(&pRequest->body.rspSem);
|
||||
(void)tsem_post(&pRequest->body.rspSem);
|
||||
}
|
||||
return code;
|
||||
}
|
||||
|
@ -430,7 +462,7 @@ int32_t processAlterStbRsp(void* param, SDataBuf* pMsg, int32_t code) {
|
|||
SMAlterStbRsp alterRsp = {0};
|
||||
SDecoder coder = {0};
|
||||
tDecoderInit(&coder, pMsg->pData, pMsg->len);
|
||||
tDecodeSMAlterStbRsp(&coder, &alterRsp);
|
||||
(void)tDecodeSMAlterStbRsp(&coder, &alterRsp); // pMsg->len = 0
|
||||
tDecoderClear(&coder);
|
||||
|
||||
pRequest->body.resInfo.execRes.msgType = TDMT_MND_ALTER_STB;
|
||||
|
@ -457,57 +489,72 @@ int32_t processAlterStbRsp(void* param, SDataBuf* pMsg, int32_t code) {
|
|||
|
||||
doRequestCallback(pRequest, code);
|
||||
} else {
|
||||
tsem_post(&pRequest->body.rspSem);
|
||||
(void)tsem_post(&pRequest->body.rspSem);
|
||||
}
|
||||
return code;
|
||||
}
|
||||
|
||||
static int32_t buildShowVariablesBlock(SArray* pVars, SSDataBlock** block) {
|
||||
int32_t code = 0;
|
||||
int32_t line = 0;
|
||||
SSDataBlock* pBlock = taosMemoryCalloc(1, sizeof(SSDataBlock));
|
||||
TSDB_CHECK_NULL(pBlock, code, line, END, TSDB_CODE_OUT_OF_MEMORY);
|
||||
pBlock->info.hasVarCol = true;
|
||||
|
||||
pBlock->pDataBlock = taosArrayInit(SHOW_VARIABLES_RESULT_COLS, sizeof(SColumnInfoData));
|
||||
|
||||
TSDB_CHECK_NULL(pBlock->pDataBlock, code, line, END, TSDB_CODE_OUT_OF_MEMORY);
|
||||
SColumnInfoData infoData = {0};
|
||||
infoData.info.type = TSDB_DATA_TYPE_VARCHAR;
|
||||
infoData.info.bytes = SHOW_VARIABLES_RESULT_FIELD1_LEN;
|
||||
taosArrayPush(pBlock->pDataBlock, &infoData);
|
||||
TSDB_CHECK_NULL(taosArrayPush(pBlock->pDataBlock, &infoData), code, line, END, TSDB_CODE_OUT_OF_MEMORY);
|
||||
|
||||
infoData.info.type = TSDB_DATA_TYPE_VARCHAR;
|
||||
infoData.info.bytes = SHOW_VARIABLES_RESULT_FIELD2_LEN;
|
||||
taosArrayPush(pBlock->pDataBlock, &infoData);
|
||||
TSDB_CHECK_NULL(taosArrayPush(pBlock->pDataBlock, &infoData), code, line, END, TSDB_CODE_OUT_OF_MEMORY);
|
||||
|
||||
infoData.info.type = TSDB_DATA_TYPE_VARCHAR;
|
||||
infoData.info.bytes = SHOW_VARIABLES_RESULT_FIELD3_LEN;
|
||||
taosArrayPush(pBlock->pDataBlock, &infoData);
|
||||
TSDB_CHECK_NULL(taosArrayPush(pBlock->pDataBlock, &infoData), code, line, END, TSDB_CODE_OUT_OF_MEMORY);
|
||||
|
||||
int32_t numOfCfg = taosArrayGetSize(pVars);
|
||||
blockDataEnsureCapacity(pBlock, numOfCfg);
|
||||
code = blockDataEnsureCapacity(pBlock, numOfCfg);
|
||||
TSDB_CHECK_CODE(code, line, END);
|
||||
|
||||
for (int32_t i = 0, c = 0; i < numOfCfg; ++i, c = 0) {
|
||||
SVariablesInfo* pInfo = taosArrayGet(pVars, i);
|
||||
TSDB_CHECK_NULL(pInfo, code, line, END, TSDB_CODE_OUT_OF_MEMORY);
|
||||
|
||||
char name[TSDB_CONFIG_OPTION_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||
STR_WITH_MAXSIZE_TO_VARSTR(name, pInfo->name, TSDB_CONFIG_OPTION_LEN + VARSTR_HEADER_SIZE);
|
||||
SColumnInfoData* pColInfo = taosArrayGet(pBlock->pDataBlock, c++);
|
||||
colDataSetVal(pColInfo, i, name, false);
|
||||
TSDB_CHECK_NULL(pColInfo, code, line, END, TSDB_CODE_OUT_OF_MEMORY);
|
||||
code = colDataSetVal(pColInfo, i, name, false);
|
||||
TSDB_CHECK_CODE(code, line, END);
|
||||
|
||||
char value[TSDB_CONFIG_VALUE_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||
STR_WITH_MAXSIZE_TO_VARSTR(value, pInfo->value, TSDB_CONFIG_VALUE_LEN + VARSTR_HEADER_SIZE);
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, c++);
|
||||
colDataSetVal(pColInfo, i, value, false);
|
||||
TSDB_CHECK_NULL(pColInfo, code, line, END, TSDB_CODE_OUT_OF_MEMORY);
|
||||
code = colDataSetVal(pColInfo, i, value, false);
|
||||
TSDB_CHECK_CODE(code, line, END);
|
||||
|
||||
char scope[TSDB_CONFIG_SCOPE_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||
STR_WITH_MAXSIZE_TO_VARSTR(scope, pInfo->scope, TSDB_CONFIG_SCOPE_LEN + VARSTR_HEADER_SIZE);
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, c++);
|
||||
colDataSetVal(pColInfo, i, scope, false);
|
||||
TSDB_CHECK_NULL(pColInfo, code, line, END, TSDB_CODE_OUT_OF_MEMORY);
|
||||
code = colDataSetVal(pColInfo, i, scope, false);
|
||||
TSDB_CHECK_CODE(code, line, END);
|
||||
}
|
||||
|
||||
pBlock->info.rows = numOfCfg;
|
||||
|
||||
*block = pBlock;
|
||||
return code;
|
||||
|
||||
return TSDB_CODE_SUCCESS;
|
||||
END:
|
||||
taosArrayDestroy(pBlock->pDataBlock);
|
||||
taosMemoryFree(pBlock);
|
||||
return code;
|
||||
}
|
||||
|
||||
static int32_t buildShowVariablesRsp(SArray* pVars, SRetrieveTableRsp** pRsp) {
|
||||
|
@ -577,55 +624,72 @@ int32_t processShowVariablesRsp(void* param, SDataBuf* pMsg, int32_t code) {
|
|||
if (pRequest->body.queryFp != NULL) {
|
||||
doRequestCallback(pRequest, code);
|
||||
} else {
|
||||
tsem_post(&pRequest->body.rspSem);
|
||||
(void)tsem_post(&pRequest->body.rspSem);
|
||||
}
|
||||
return code;
|
||||
}
|
||||
|
||||
static int32_t buildCompactDbBlock(SCompactDbRsp* pRsp, SSDataBlock** block) {
|
||||
int32_t code = 0;
|
||||
int32_t line = 0;
|
||||
SSDataBlock* pBlock = taosMemoryCalloc(1, sizeof(SSDataBlock));
|
||||
TSDB_CHECK_NULL(pBlock, code, line, END, TSDB_CODE_OUT_OF_MEMORY);
|
||||
pBlock->info.hasVarCol = true;
|
||||
|
||||
pBlock->pDataBlock = taosArrayInit(COMPACT_DB_RESULT_COLS, sizeof(SColumnInfoData));
|
||||
|
||||
TSDB_CHECK_NULL(pBlock->pDataBlock, code, line, END, TSDB_CODE_OUT_OF_MEMORY);
|
||||
SColumnInfoData infoData = {0};
|
||||
infoData.info.type = TSDB_DATA_TYPE_VARCHAR;
|
||||
infoData.info.bytes = COMPACT_DB_RESULT_FIELD1_LEN;
|
||||
taosArrayPush(pBlock->pDataBlock, &infoData);
|
||||
TSDB_CHECK_NULL(taosArrayPush(pBlock->pDataBlock, &infoData), code, line, END, TSDB_CODE_OUT_OF_MEMORY);
|
||||
|
||||
infoData.info.type = TSDB_DATA_TYPE_INT;
|
||||
infoData.info.bytes = tDataTypes[TSDB_DATA_TYPE_INT].bytes;
|
||||
taosArrayPush(pBlock->pDataBlock, &infoData);
|
||||
TSDB_CHECK_NULL(taosArrayPush(pBlock->pDataBlock, &infoData), code, line, END, TSDB_CODE_OUT_OF_MEMORY);
|
||||
|
||||
infoData.info.type = TSDB_DATA_TYPE_VARCHAR;
|
||||
infoData.info.bytes = COMPACT_DB_RESULT_FIELD3_LEN;
|
||||
taosArrayPush(pBlock->pDataBlock, &infoData);
|
||||
TSDB_CHECK_NULL(taosArrayPush(pBlock->pDataBlock, &infoData), code, line, END, TSDB_CODE_OUT_OF_MEMORY);
|
||||
|
||||
blockDataEnsureCapacity(pBlock, 1);
|
||||
code = blockDataEnsureCapacity(pBlock, 1);
|
||||
TSDB_CHECK_CODE(code, line, END);
|
||||
|
||||
SColumnInfoData* pResultCol = taosArrayGet(pBlock->pDataBlock, 0);
|
||||
TSDB_CHECK_NULL(pResultCol, code, line, END, TSDB_CODE_OUT_OF_MEMORY);
|
||||
SColumnInfoData* pIdCol = taosArrayGet(pBlock->pDataBlock, 1);
|
||||
TSDB_CHECK_NULL(pIdCol, code, line, END, TSDB_CODE_OUT_OF_MEMORY);
|
||||
SColumnInfoData* pReasonCol = taosArrayGet(pBlock->pDataBlock, 2);
|
||||
TSDB_CHECK_NULL(pReasonCol, code, line, END, TSDB_CODE_OUT_OF_MEMORY);
|
||||
|
||||
char result[COMPACT_DB_RESULT_FIELD1_LEN] = {0};
|
||||
char reason[COMPACT_DB_RESULT_FIELD3_LEN] = {0};
|
||||
if (pRsp->bAccepted) {
|
||||
STR_TO_VARSTR(result, "accepted");
|
||||
colDataSetVal(pResultCol, 0, result, false);
|
||||
colDataSetVal(pIdCol, 0, (void*)&pRsp->compactId, false);
|
||||
code = colDataSetVal(pResultCol, 0, result, false);
|
||||
TSDB_CHECK_CODE(code, line, END);
|
||||
code = colDataSetVal(pIdCol, 0, (void*)&pRsp->compactId, false);
|
||||
TSDB_CHECK_CODE(code, line, END);
|
||||
STR_TO_VARSTR(reason, "success");
|
||||
colDataSetVal(pReasonCol, 0, reason, false);
|
||||
code = colDataSetVal(pReasonCol, 0, reason, false);
|
||||
TSDB_CHECK_CODE(code, line, END);
|
||||
} else {
|
||||
STR_TO_VARSTR(result, "rejected");
|
||||
colDataSetVal(pResultCol, 0, result, false);
|
||||
code = colDataSetVal(pResultCol, 0, result, false);
|
||||
TSDB_CHECK_CODE(code, line, END);
|
||||
colDataSetNULL(pIdCol, 0);
|
||||
STR_TO_VARSTR(reason, "compaction is ongoing");
|
||||
colDataSetVal(pReasonCol, 0, reason, false);
|
||||
code = colDataSetVal(pReasonCol, 0, reason, false);
|
||||
TSDB_CHECK_CODE(code, line, END);
|
||||
}
|
||||
pBlock->info.rows = 1;
|
||||
|
||||
*block = pBlock;
|
||||
|
||||
return TSDB_CODE_SUCCESS;
|
||||
END:
|
||||
taosMemoryFree(pBlock);
|
||||
taosArrayDestroy(pBlock->pDataBlock);
|
||||
return code;
|
||||
}
|
||||
|
||||
static int32_t buildRetriveTableRspForCompactDb(SCompactDbRsp* pCompactDb, SRetrieveTableRsp** pRsp) {
|
||||
|
@ -696,7 +760,7 @@ int32_t processCompactDbRsp(void* param, SDataBuf* pMsg, int32_t code) {
|
|||
if (pRequest->body.queryFp != NULL) {
|
||||
pRequest->body.queryFp(((SSyncQueryParam *)pRequest->body.interParam)->userParam, pRequest, code);
|
||||
} else {
|
||||
tsem_post(&pRequest->body.rspSem);
|
||||
(void)tsem_post(&pRequest->body.rspSem);
|
||||
}
|
||||
return code;
|
||||
}
|
||||
|
|
|
@ -14,15 +14,20 @@ static FORCE_INLINE int32_t stmtAllocQNodeFromBuf(STableBufInfo* pTblBuf, void**
|
|||
pTblBuf->buffOffset += pTblBuf->buffUnit;
|
||||
} else if (pTblBuf->buffIdx < taosArrayGetSize(pTblBuf->pBufList)) {
|
||||
pTblBuf->pCurBuff = taosArrayGetP(pTblBuf->pBufList, pTblBuf->buffIdx++);
|
||||
if (NULL == pTblBuf->pCurBuff) {
|
||||
return TAOS_GET_TERRNO(TSDB_CODE_OUT_OF_MEMORY);
|
||||
}
|
||||
*pBuf = pTblBuf->pCurBuff;
|
||||
pTblBuf->buffOffset = pTblBuf->buffUnit;
|
||||
} else {
|
||||
void* buff = taosMemoryMalloc(pTblBuf->buffSize);
|
||||
if (NULL == buff) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
taosArrayPush(pTblBuf->pBufList, &buff);
|
||||
if(taosArrayPush(pTblBuf->pBufList, &buff) == NULL){
|
||||
return terrno;
|
||||
}
|
||||
|
||||
pTblBuf->buffIdx++;
|
||||
pTblBuf->pCurBuff = buff;
|
||||
|
@ -48,7 +53,7 @@ bool stmtDequeue(STscStmt* pStmt, SStmtQNode** param) {
|
|||
|
||||
*param = node;
|
||||
|
||||
atomic_sub_fetch_64(&pStmt->queue.qRemainNum, 1);
|
||||
(void)atomic_sub_fetch_64(&pStmt->queue.qRemainNum, 1);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -58,7 +63,7 @@ void stmtEnqueue(STscStmt* pStmt, SStmtQNode* param) {
|
|||
pStmt->queue.tail = param;
|
||||
|
||||
pStmt->stat.bindDataNum++;
|
||||
atomic_add_fetch_64(&pStmt->queue.qRemainNum, 1);
|
||||
(void)atomic_add_fetch_64(&pStmt->queue.qRemainNum, 1);
|
||||
}
|
||||
|
||||
static int32_t stmtCreateRequest(STscStmt* pStmt) {
|
||||
|
@ -183,8 +188,8 @@ int32_t stmtBackupQueryFields(STscStmt* pStmt) {
|
|||
if (NULL == pRes->fields || NULL == pRes->userFields) {
|
||||
STMT_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
}
|
||||
memcpy(pRes->fields, pStmt->exec.pRequest->body.resInfo.fields, size);
|
||||
memcpy(pRes->userFields, pStmt->exec.pRequest->body.resInfo.userFields, size);
|
||||
(void)memcpy(pRes->fields, pStmt->exec.pRequest->body.resInfo.fields, size);
|
||||
(void)memcpy(pRes->userFields, pStmt->exec.pRequest->body.resInfo.userFields, size);
|
||||
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
@ -201,7 +206,7 @@ int32_t stmtRestoreQueryFields(STscStmt* pStmt) {
|
|||
if (NULL == pStmt->exec.pRequest->body.resInfo.fields) {
|
||||
STMT_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
}
|
||||
memcpy(pStmt->exec.pRequest->body.resInfo.fields, pRes->fields, size);
|
||||
(void)memcpy(pStmt->exec.pRequest->body.resInfo.fields, pRes->fields, size);
|
||||
}
|
||||
|
||||
if (NULL == pStmt->exec.pRequest->body.resInfo.userFields) {
|
||||
|
@ -209,7 +214,7 @@ int32_t stmtRestoreQueryFields(STscStmt* pStmt) {
|
|||
if (NULL == pStmt->exec.pRequest->body.resInfo.userFields) {
|
||||
STMT_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
}
|
||||
memcpy(pStmt->exec.pRequest->body.resInfo.userFields, pRes->userFields, size);
|
||||
(void)memcpy(pStmt->exec.pRequest->body.resInfo.userFields, pRes->userFields, size);
|
||||
}
|
||||
|
||||
return TSDB_CODE_SUCCESS;
|
||||
|
@ -219,10 +224,13 @@ int32_t stmtUpdateBindInfo(TAOS_STMT* stmt, STableMeta* pTableMeta, void* tags,
|
|||
bool autoCreateTbl) {
|
||||
STscStmt* pStmt = (STscStmt*)stmt;
|
||||
char tbFName[TSDB_TABLE_FNAME_LEN];
|
||||
tNameExtractFullName(tbName, tbFName);
|
||||
int32_t code = tNameExtractFullName(tbName, tbFName);
|
||||
if (code != 0){
|
||||
return code;
|
||||
}
|
||||
|
||||
memcpy(&pStmt->bInfo.sname, tbName, sizeof(*tbName));
|
||||
strncpy(pStmt->bInfo.tbFName, tbFName, sizeof(pStmt->bInfo.tbFName) - 1);
|
||||
(void)memcpy(&pStmt->bInfo.sname, tbName, sizeof(*tbName));
|
||||
(void)strncpy(pStmt->bInfo.tbFName, tbFName, sizeof(pStmt->bInfo.tbFName) - 1);
|
||||
pStmt->bInfo.tbFName[sizeof(pStmt->bInfo.tbFName) - 1] = 0;
|
||||
|
||||
pStmt->bInfo.tbUid = autoCreateTbl ? 0 : pTableMeta->uid;
|
||||
|
@ -383,17 +391,21 @@ int32_t stmtCleanBindInfo(STscStmt* pStmt) {
|
|||
taosMemoryFreeClear(pStmt->bInfo.boundTags);
|
||||
}
|
||||
pStmt->bInfo.stbFName[0] = 0;
|
||||
;
|
||||
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
void stmtFreeTableBlkList(STableColsData* pTb) {
|
||||
qResetStmtColumns(pTb->aCol, true);
|
||||
(void)qResetStmtColumns(pTb->aCol, true);
|
||||
taosArrayDestroy(pTb->aCol);
|
||||
}
|
||||
|
||||
void stmtResetQueueTableBuf(STableBufInfo* pTblBuf, SStmtQueue* pQueue) {
|
||||
pTblBuf->pCurBuff = taosArrayGetP(pTblBuf->pBufList, 0);
|
||||
if (NULL == pTblBuf->pCurBuff) {
|
||||
tscError("QInfo:%p, failed to get buffer from list", pTblBuf);
|
||||
return;
|
||||
}
|
||||
pTblBuf->buffIdx = 1;
|
||||
pTblBuf->buffOffset = sizeof(*pQueue->head);
|
||||
|
||||
|
@ -438,7 +450,7 @@ int32_t stmtCleanExecInfo(STscStmt* pStmt, bool keepTable, bool deepClean) {
|
|||
}
|
||||
|
||||
qDestroyStmtDataBlock(pBlocks);
|
||||
taosHashRemove(pStmt->exec.pBlockHash, key, keyLen);
|
||||
STMT_ERR_RET(taosHashRemove(pStmt->exec.pBlockHash, key, keyLen));
|
||||
|
||||
pIter = taosHashIterate(pStmt->exec.pBlockHash, pIter);
|
||||
}
|
||||
|
@ -505,7 +517,7 @@ int32_t stmtCleanSQLInfo(STscStmt* pStmt) {
|
|||
qDestroyStmtDataBlock(pStmt->sql.siInfo.pDataCtx);
|
||||
taosArrayDestroyEx(pStmt->sql.siInfo.pTableCols, stmtFreeTbCols);
|
||||
|
||||
memset(&pStmt->sql, 0, sizeof(pStmt->sql));
|
||||
(void)memset(&pStmt->sql, 0, sizeof(pStmt->sql));
|
||||
pStmt->sql.siInfo.tableColsReady = true;
|
||||
|
||||
STMT_DLOG_E("end to free SQL info");
|
||||
|
@ -628,7 +640,7 @@ int32_t stmtGetFromCache(STscStmt* pStmt) {
|
|||
|
||||
if (TSDB_CODE_PAR_TABLE_NOT_EXIST == code) {
|
||||
tscDebug("tb %s not exist", pStmt->bInfo.tbFName);
|
||||
stmtCleanBindInfo(pStmt);
|
||||
STMT_ERR_RET(stmtCleanBindInfo(pStmt));
|
||||
|
||||
STMT_ERR_RET(code);
|
||||
}
|
||||
|
@ -726,6 +738,9 @@ int32_t stmtAsyncOutput(STscStmt* pStmt, void* param) {
|
|||
for (int32_t i = 0; i < pStmt->sql.siInfo.pTableColsIdx; ++i) {
|
||||
SArray** p = (SArray**)TARRAY_GET_ELEM(pStmt->sql.siInfo.pTableCols, i);
|
||||
*p = taosArrayInit(20, POINTER_BYTES);
|
||||
if (*p == NULL) {
|
||||
STMT_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
}
|
||||
}
|
||||
|
||||
atomic_store_8((int8_t*)&pStmt->sql.siInfo.tableColsReady, true);
|
||||
|
@ -735,7 +750,7 @@ int32_t stmtAsyncOutput(STscStmt* pStmt, void* param) {
|
|||
|
||||
// taosMemoryFree(pParam->pTbData);
|
||||
|
||||
atomic_sub_fetch_64(&pStmt->sql.siInfo.tbRemainNum, 1);
|
||||
(void)atomic_sub_fetch_64(&pStmt->sql.siInfo.tbRemainNum, 1);
|
||||
}
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
@ -757,7 +772,7 @@ void* stmtBindThreadFunc(void* param) {
|
|||
continue;
|
||||
}
|
||||
|
||||
stmtAsyncOutput(pStmt, asyncParam);
|
||||
(void)stmtAsyncOutput(pStmt, asyncParam);
|
||||
}
|
||||
|
||||
qInfo("stmt bind thread stopped");
|
||||
|
@ -767,8 +782,12 @@ void* stmtBindThreadFunc(void* param) {
|
|||
|
||||
int32_t stmtStartBindThread(STscStmt* pStmt) {
|
||||
TdThreadAttr thAttr;
|
||||
taosThreadAttrInit(&thAttr);
|
||||
taosThreadAttrSetDetachState(&thAttr, PTHREAD_CREATE_JOINABLE);
|
||||
if (taosThreadAttrInit(&thAttr) != 0) {
|
||||
return TSDB_CODE_TSC_INTERNAL_ERROR;
|
||||
}
|
||||
if (taosThreadAttrSetDetachState(&thAttr, PTHREAD_CREATE_JOINABLE) != 0) {
|
||||
return TSDB_CODE_TSC_INTERNAL_ERROR;
|
||||
}
|
||||
|
||||
if (taosThreadCreate(&pStmt->bindThread, &thAttr, stmtBindThreadFunc, pStmt) != 0) {
|
||||
terrno = TAOS_SYSTEM_ERROR(errno);
|
||||
|
@ -777,7 +796,7 @@ int32_t stmtStartBindThread(STscStmt* pStmt) {
|
|||
|
||||
pStmt->bindThreadInUse = true;
|
||||
|
||||
taosThreadAttrDestroy(&thAttr);
|
||||
(void)taosThreadAttrDestroy(&thAttr);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -800,7 +819,9 @@ int32_t stmtInitTableBuf(STableBufInfo* pTblBuf) {
|
|||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
taosArrayPush(pTblBuf->pBufList, &buff);
|
||||
if (taosArrayPush(pTblBuf->pBufList, &buff) == NULL){
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
pTblBuf->pCurBuff = buff;
|
||||
pTblBuf->buffIdx = 1;
|
||||
|
@ -834,7 +855,7 @@ TAOS_STMT* stmtInit(STscObj* taos, int64_t reqid, TAOS_STMT_OPTIONS* pOptions) {
|
|||
pStmt->errCode = TSDB_CODE_SUCCESS;
|
||||
|
||||
if (NULL != pOptions) {
|
||||
memcpy(&pStmt->options, pOptions, sizeof(pStmt->options));
|
||||
(void)memcpy(&pStmt->options, pOptions, sizeof(pStmt->options));
|
||||
if (pOptions->singleStbInsert && pOptions->singleTableBindOnce) {
|
||||
pStmt->stbInterlaceMode = true;
|
||||
}
|
||||
|
@ -848,24 +869,26 @@ TAOS_STMT* stmtInit(STscObj* taos, int64_t reqid, TAOS_STMT_OPTIONS* pOptions) {
|
|||
pStmt->sql.siInfo.pTableHash = tSimpleHashInit(100, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY));
|
||||
if (NULL == pStmt->sql.siInfo.pTableHash) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
stmtClose(pStmt);
|
||||
(void)stmtClose(pStmt);
|
||||
return NULL;
|
||||
}
|
||||
pStmt->sql.siInfo.pTableCols = taosArrayInit(STMT_TABLE_COLS_NUM, POINTER_BYTES);
|
||||
if (NULL == pStmt->sql.siInfo.pTableCols) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
stmtClose(pStmt);
|
||||
(void)stmtClose(pStmt);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
code = stmtInitTableBuf(&pStmt->sql.siInfo.tbBuf);
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
stmtInitQueue(pStmt);
|
||||
code = stmtInitQueue(pStmt);
|
||||
}
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
code = stmtStartBindThread(pStmt);
|
||||
}
|
||||
if (TSDB_CODE_SUCCESS != code) {
|
||||
terrno = code;
|
||||
stmtClose(pStmt);
|
||||
(void)stmtClose(pStmt);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
@ -904,7 +927,7 @@ int stmtPrepare(TAOS_STMT* stmt, const char* sql, unsigned long length) {
|
|||
|
||||
char* dbName = NULL;
|
||||
if (qParseDbName(sql, length, &dbName)) {
|
||||
stmtSetDbName(stmt, dbName);
|
||||
STMT_ERR_RET(stmtSetDbName(stmt, dbName));
|
||||
taosMemoryFreeClear(dbName);
|
||||
}
|
||||
|
||||
|
@ -928,7 +951,9 @@ int32_t stmtInitStbInterlaceTableInfo(STscStmt* pStmt) {
|
|||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
taosArrayPush(pStmt->sql.siInfo.pTableCols, &pTblCols);
|
||||
if (taosArrayPush(pStmt->sql.siInfo.pTableCols, &pTblCols) == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
}
|
||||
|
||||
pStmt->sql.siInfo.boundTags = pStmt->bInfo.boundTags;
|
||||
|
@ -966,7 +991,7 @@ int stmtSetTbName(TAOS_STMT* stmt, const char* tbName) {
|
|||
STMT_ERR_RET(stmtSwitchStatus(pStmt, STMT_SETTBNAME));
|
||||
|
||||
int32_t insert = 0;
|
||||
stmtIsInsert(stmt, &insert);
|
||||
STMT_ERR_RET(stmtIsInsert(stmt, &insert));
|
||||
if (0 == insert) {
|
||||
tscError("set tb name not available for none insert statement");
|
||||
STMT_ERR_RET(TSDB_CODE_TSC_STMT_API_ERROR);
|
||||
|
@ -977,18 +1002,18 @@ int stmtSetTbName(TAOS_STMT* stmt, const char* tbName) {
|
|||
|
||||
STMT_ERR_RET(qCreateSName(&pStmt->bInfo.sname, tbName, pStmt->taos->acctId, pStmt->exec.pRequest->pDb,
|
||||
pStmt->exec.pRequest->msgBuf, pStmt->exec.pRequest->msgBufLen));
|
||||
tNameExtractFullName(&pStmt->bInfo.sname, pStmt->bInfo.tbFName);
|
||||
STMT_ERR_RET(tNameExtractFullName(&pStmt->bInfo.sname, pStmt->bInfo.tbFName));
|
||||
|
||||
STMT_ERR_RET(stmtGetFromCache(pStmt));
|
||||
|
||||
if (pStmt->bInfo.needParse) {
|
||||
strncpy(pStmt->bInfo.tbName, tbName, sizeof(pStmt->bInfo.tbName) - 1);
|
||||
(void)strncpy(pStmt->bInfo.tbName, tbName, sizeof(pStmt->bInfo.tbName) - 1);
|
||||
pStmt->bInfo.tbName[sizeof(pStmt->bInfo.tbName) - 1] = 0;
|
||||
|
||||
STMT_ERR_RET(stmtParseSql(pStmt));
|
||||
}
|
||||
} else {
|
||||
strncpy(pStmt->bInfo.tbName, tbName, sizeof(pStmt->bInfo.tbName) - 1);
|
||||
(void)strncpy(pStmt->bInfo.tbName, tbName, sizeof(pStmt->bInfo.tbName) - 1);
|
||||
pStmt->bInfo.tbName[sizeof(pStmt->bInfo.tbName) - 1] = 0;
|
||||
pStmt->exec.pRequest->requestId++;
|
||||
pStmt->bInfo.needParse = false;
|
||||
|
@ -1136,13 +1161,13 @@ int32_t stmtAppendTablePostHandle(STscStmt* pStmt, SStmtQNode* param) {
|
|||
}
|
||||
|
||||
if (0 == pStmt->sql.siInfo.firstName[0]) {
|
||||
strcpy(pStmt->sql.siInfo.firstName, pStmt->bInfo.tbName);
|
||||
(void)strcpy(pStmt->sql.siInfo.firstName, pStmt->bInfo.tbName);
|
||||
}
|
||||
|
||||
param->tblData.getFromHash = pStmt->sql.siInfo.tbFromHash;
|
||||
param->next = NULL;
|
||||
|
||||
atomic_add_fetch_64(&pStmt->sql.siInfo.tbRemainNum, 1);
|
||||
(void)atomic_add_fetch_64(&pStmt->sql.siInfo.tbRemainNum, 1);
|
||||
|
||||
stmtEnqueue(pStmt, param);
|
||||
|
||||
|
@ -1162,7 +1187,9 @@ static FORCE_INLINE int32_t stmtGetTableColsFromCache(STscStmt* pStmt, SArray**
|
|||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
taosArrayPush(pStmt->sql.siInfo.pTableCols, &pTblCols);
|
||||
if (taosArrayPush(pStmt->sql.siInfo.pTableCols, &pTblCols) == NULL){
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1221,8 +1248,8 @@ int stmtBindBatch(TAOS_STMT* stmt, TAOS_MULTI_BIND* bind, int32_t colIdx) {
|
|||
STMT_ERR_RET(qStmtParseQuerySql(&ctx, pStmt->sql.pQuery));
|
||||
|
||||
if (pStmt->sql.pQuery->haveResultSet) {
|
||||
setResSchemaInfo(&pStmt->exec.pRequest->body.resInfo, pStmt->sql.pQuery->pResSchema,
|
||||
pStmt->sql.pQuery->numOfResCols);
|
||||
STMT_ERR_RET(setResSchemaInfo(&pStmt->exec.pRequest->body.resInfo, pStmt->sql.pQuery->pResSchema,
|
||||
pStmt->sql.pQuery->numOfResCols));
|
||||
taosMemoryFreeClear(pStmt->sql.pQuery->pResSchema);
|
||||
setResPrecision(&pStmt->exec.pRequest->body.resInfo, pStmt->sql.pQuery->precision);
|
||||
}
|
||||
|
@ -1274,7 +1301,7 @@ int stmtBindBatch(TAOS_STMT* stmt, TAOS_MULTI_BIND* bind, int32_t colIdx) {
|
|||
// param->tblData.aCol = taosArrayInit(20, POINTER_BYTES);
|
||||
|
||||
param->restoreTbCols = false;
|
||||
strcpy(param->tblData.tbName, pStmt->bInfo.tbName);
|
||||
(void)strcpy(param->tblData.tbName, pStmt->bInfo.tbName);
|
||||
}
|
||||
|
||||
int64_t startUs3 = taosGetTimestampUs();
|
||||
|
@ -1428,7 +1455,7 @@ int stmtUpdateTableUid(STscStmt* pStmt, SSubmitRsp* pRsp) {
|
|||
.requestId = pStmt->exec.pRequest->requestId,
|
||||
.requestObjRefId = pStmt->exec.pRequest->self,
|
||||
.mgmtEps = getEpSet_s(&pStmt->taos->pAppInfo->mgmtEp)};
|
||||
int32_t code = catalogGetTableMeta(pStmt->pCatalog, &conn, &pStmt->bInfo.sname, &pTableMeta);
|
||||
code = catalogGetTableMeta(pStmt->pCatalog, &conn, &pStmt->bInfo.sname, &pTableMeta);
|
||||
|
||||
pStmt->stat.ctgGetTbMetaNum++;
|
||||
|
||||
|
@ -1515,7 +1542,7 @@ int stmtExec(TAOS_STMT* stmt) {
|
|||
STMT_ERR_RET(stmtSwitchStatus(pStmt, STMT_EXECUTE));
|
||||
|
||||
if (STMT_TYPE_QUERY == pStmt->sql.type) {
|
||||
launchQueryImpl(pStmt->exec.pRequest, pStmt->sql.pQuery, true, NULL);
|
||||
(void)launchQueryImpl(pStmt->exec.pRequest, pStmt->sql.pQuery, true, NULL);
|
||||
} else {
|
||||
if (pStmt->sql.stbInterlaceMode) {
|
||||
int64_t startTs = taosGetTimestampUs();
|
||||
|
@ -1537,7 +1564,7 @@ int stmtExec(TAOS_STMT* stmt) {
|
|||
STMT_ERR_RET(qBuildStmtOutput(pStmt->sql.pQuery, pStmt->sql.pVgHash, pStmt->exec.pBlockHash));
|
||||
}
|
||||
|
||||
launchQueryImpl(pStmt->exec.pRequest, pStmt->sql.pQuery, true, NULL);
|
||||
(void)launchQueryImpl(pStmt->exec.pRequest, pStmt->sql.pQuery, true, NULL);
|
||||
}
|
||||
|
||||
if (pStmt->exec.pRequest->code && NEED_CLIENT_HANDLE_ERROR(pStmt->exec.pRequest->code)) {
|
||||
|
@ -1562,7 +1589,7 @@ _return:
|
|||
taosUsleep(1);
|
||||
}
|
||||
|
||||
stmtCleanExecInfo(pStmt, (code ? false : true), false);
|
||||
STMT_ERR_RET(stmtCleanExecInfo(pStmt, (code ? false : true), false));
|
||||
|
||||
tFreeSSubmitRsp(pRsp);
|
||||
|
||||
|
@ -1582,7 +1609,7 @@ int stmtClose(TAOS_STMT* stmt) {
|
|||
pStmt->queue.stopQueue = true;
|
||||
|
||||
if (pStmt->bindThreadInUse) {
|
||||
taosThreadJoin(pStmt->bindThread, NULL);
|
||||
(void)taosThreadJoin(pStmt->bindThread, NULL);
|
||||
pStmt->bindThreadInUse = false;
|
||||
}
|
||||
|
||||
|
@ -1597,7 +1624,7 @@ int stmtClose(TAOS_STMT* stmt) {
|
|||
pStmt->stat.bindDataUs1, pStmt->stat.bindDataUs2, pStmt->stat.bindDataUs3, pStmt->stat.bindDataUs4,
|
||||
pStmt->stat.addBatchUs, pStmt->stat.execWaitUs, pStmt->stat.execUseUs);
|
||||
|
||||
stmtCleanSQLInfo(pStmt);
|
||||
STMT_ERR_RET(stmtCleanSQLInfo(pStmt));
|
||||
taosMemoryFree(stmt);
|
||||
|
||||
return TSDB_CODE_SUCCESS;
|
||||
|
|
|
@ -2934,7 +2934,7 @@ int32_t tmqGetNextResInfo(TAOS_RES* res, bool convertUcs4, SReqResultInfo** pRes
|
|||
doFreeReqResultInfo(&pRspObj->resInfo);
|
||||
SSchemaWrapper* pSW = (SSchemaWrapper*)taosArrayGetP(common->blockSchema, pRspObj->resIter);
|
||||
if (pSW){
|
||||
setResSchemaInfo(&pRspObj->resInfo, pSW->pSchema, pSW->nCols);
|
||||
TAOS_CHECK_RETURN(setResSchemaInfo(&pRspObj->resInfo, pSW->pSchema, pSW->nCols));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ void tmqGlobalMethod(JNIEnv *env) {
|
|||
}
|
||||
|
||||
if (g_vm == NULL) {
|
||||
(*env)->GetJavaVM(env, &g_vm);
|
||||
(void)((*env)->GetJavaVM(env, &g_vm));
|
||||
}
|
||||
|
||||
jclass offset = (*env)->FindClass(env, "com/taosdata/jdbc/tmq/OffsetWaitCallback");
|
||||
|
@ -68,7 +68,7 @@ void tmqAssignmentMethod(JNIEnv *env) {
|
|||
}
|
||||
|
||||
if (g_vm == NULL) {
|
||||
(*env)->GetJavaVM(env, &g_vm);
|
||||
(void)((*env)->GetJavaVM(env, &g_vm));
|
||||
}
|
||||
|
||||
jclass assignment = (*env)->FindClass(env, "com/taosdata/jdbc/tmq/Assignment");
|
||||
|
@ -104,7 +104,7 @@ void commit_cb(tmq_t *tmq, int32_t code, void *param) {
|
|||
param = NULL;
|
||||
|
||||
if (needDetach) {
|
||||
(*g_vm)->DetachCurrentThread(g_vm);
|
||||
(void)((*g_vm)->DetachCurrentThread(g_vm));
|
||||
}
|
||||
env = NULL;
|
||||
}
|
||||
|
@ -126,7 +126,7 @@ void consumer_callback(tmq_t *tmq, int32_t code, void *param) {
|
|||
param = NULL;
|
||||
|
||||
if (needDetach) {
|
||||
(*g_vm)->DetachCurrentThread(g_vm);
|
||||
(void)((*g_vm)->DetachCurrentThread(g_vm));
|
||||
}
|
||||
env = NULL;
|
||||
}
|
||||
|
@ -493,7 +493,7 @@ JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_fetchRawBlockImp(
|
|||
(*env)->SetIntField(env, metadataObj, g_metadataColindexField, i);
|
||||
jstring metadataObjColname = (*env)->NewStringUTF(env, fields[i].name);
|
||||
(*env)->SetObjectField(env, metadataObj, g_metadataColnameField, metadataObjColname);
|
||||
(*env)->CallBooleanMethod(env, arrayListObj, g_arrayListAddFp, metadataObj);
|
||||
(void)(*env)->CallBooleanMethod(env, arrayListObj, g_arrayListAddFp, metadataObj);
|
||||
}
|
||||
|
||||
(*env)->CallVoidMethod(env, rowobj, g_blockdataSetNumOfRowsFp, (jint)numOfRows);
|
||||
|
@ -567,7 +567,7 @@ JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqGetTopicAssign
|
|||
(*env)->CallVoidMethod(env, jassignment, g_assignmentSetCurrentOffset, assignment.currentOffset);
|
||||
(*env)->CallVoidMethod(env, jassignment, g_assignmentSetBegin, assignment.begin);
|
||||
(*env)->CallVoidMethod(env, jassignment, g_assignmentSetEnd, assignment.end);
|
||||
(*env)->CallBooleanMethod(env, jarrayList, g_arrayListAddFp, jassignment);
|
||||
(void)(*env)->CallBooleanMethod(env, jarrayList, g_arrayListAddFp, jassignment);
|
||||
}
|
||||
tmq_free_assignment(pAssign);
|
||||
return JNI_SUCCESS;
|
||||
|
|
|
@ -86,7 +86,7 @@ static char* readFile(TdFilePtr pFile, int64_t *offset, int64_t size){
|
|||
return NULL;
|
||||
}
|
||||
char* buf = pCont;
|
||||
strcat(buf++, "[");
|
||||
(void)strcat(buf++, "[");
|
||||
int64_t readSize = taosReadFile(pFile, buf, SLOW_LOG_SEND_SIZE_MAX);
|
||||
if (readSize <= 0) {
|
||||
if (readSize < 0){
|
||||
|
@ -153,7 +153,7 @@ TEST(clientMonitorTest, ReadOneFile) {
|
|||
const int size = 10;
|
||||
for(int i = 0; i < batch; i++){
|
||||
char value[size] = {0};
|
||||
memset(value, '0' + i, size - 1);
|
||||
(void)memset(value, '0' + i, size - 1);
|
||||
if (taosWriteFile(pFile, value, strlen(value) + 1) < 0){
|
||||
uError("failed to write len to file:%p since %s", pFile, terrstr());
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -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 {
|
||||
|
|
|
@ -1764,23 +1764,33 @@ int32_t tDeserializeSUpdateIpWhite(void *buf, int32_t bufLen, SUpdateIpWhite *pR
|
|||
return 0;
|
||||
}
|
||||
void tFreeSUpdateIpWhiteReq(SUpdateIpWhite *pReq) {
|
||||
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};
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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) {
|
||||
|
@ -9226,16 +9238,17 @@ bool tOffsetEqual(const STqOffsetVal *pLeft, const STqOffsetVal *pRight) {
|
|||
return false;
|
||||
}
|
||||
|
||||
int32_t tOffsetCopy(STqOffsetVal *pLeft, const STqOffsetVal *pRight) {
|
||||
void 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) {
|
||||
return terrno;
|
||||
pLeft->primaryKey.pData = taosMemoryMalloc(pRight->primaryKey.nData);
|
||||
if (pLeft->primaryKey.pData == NULL) {
|
||||
uError("failed to allocate memory for offset");
|
||||
return;
|
||||
}
|
||||
(void)memcpy(pLeft->primaryKey.pData, pRight->primaryKey.pData, pRight->primaryKey.nData);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void tOffsetDestroy(void *param) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -260,7 +260,7 @@ static int32_t dmProcessCreateNodeReq(EDndNodeType ntype, SRpcMsg *pMsg) {
|
|||
return code;
|
||||
}
|
||||
|
||||
taosThreadMutexLock(&pDnode->mutex);
|
||||
(void)taosThreadMutexLock(&pDnode->mutex);
|
||||
SMgmtInputOpt input = dmBuildMgmtInputOpt(pWrapper);
|
||||
|
||||
dInfo("node:%s, start to create", pWrapper->name);
|
||||
|
@ -277,7 +277,7 @@ static int32_t dmProcessCreateNodeReq(EDndNodeType ntype, SRpcMsg *pMsg) {
|
|||
pWrapper->required = true;
|
||||
}
|
||||
|
||||
taosThreadMutexUnlock(&pDnode->mutex);
|
||||
(void)taosThreadMutexUnlock(&pDnode->mutex);
|
||||
return code;
|
||||
}
|
||||
|
||||
|
@ -316,7 +316,7 @@ static int32_t dmProcessAlterNodeTypeReq(EDndNodeType ntype, SRpcMsg *pMsg) {
|
|||
|
||||
dInfo("node:%s, catched up leader, continue to process alter-node-type-request", pWrapper->name);
|
||||
|
||||
taosThreadMutexLock(&pDnode->mutex);
|
||||
(void)taosThreadMutexLock(&pDnode->mutex);
|
||||
|
||||
dInfo("node:%s, stopping node", pWrapper->name);
|
||||
dmStopNode(pWrapper);
|
||||
|
@ -325,7 +325,7 @@ static int32_t dmProcessAlterNodeTypeReq(EDndNodeType ntype, SRpcMsg *pMsg) {
|
|||
|
||||
pWrapper = &pDnode->wrappers[ntype];
|
||||
if (taosMkDir(pWrapper->path) != 0) {
|
||||
taosThreadMutexUnlock(&pDnode->mutex);
|
||||
(void)taosThreadMutexUnlock(&pDnode->mutex);
|
||||
code = terrno;
|
||||
dError("failed to create dir:%s since %s", pWrapper->path, tstrerror(code));
|
||||
return code;
|
||||
|
@ -347,7 +347,7 @@ static int32_t dmProcessAlterNodeTypeReq(EDndNodeType ntype, SRpcMsg *pMsg) {
|
|||
pWrapper->required = true;
|
||||
}
|
||||
|
||||
taosThreadMutexUnlock(&pDnode->mutex);
|
||||
(void)taosThreadMutexUnlock(&pDnode->mutex);
|
||||
return code;
|
||||
}
|
||||
|
||||
|
@ -375,7 +375,7 @@ static int32_t dmProcessDropNodeReq(EDndNodeType ntype, SRpcMsg *pMsg) {
|
|||
return terrno = code;
|
||||
}
|
||||
|
||||
taosThreadMutexLock(&pDnode->mutex);
|
||||
(void)taosThreadMutexLock(&pDnode->mutex);
|
||||
SMgmtInputOpt input = dmBuildMgmtInputOpt(pWrapper);
|
||||
|
||||
dInfo("node:%s, start to drop", pWrapper->name);
|
||||
|
@ -395,7 +395,7 @@ static int32_t dmProcessDropNodeReq(EDndNodeType ntype, SRpcMsg *pMsg) {
|
|||
dmCloseNode(pWrapper);
|
||||
taosRemoveDir(pWrapper->path);
|
||||
}
|
||||
taosThreadMutexUnlock(&pDnode->mutex);
|
||||
(void)taosThreadMutexUnlock(&pDnode->mutex);
|
||||
return code;
|
||||
}
|
||||
|
||||
|
|
|
@ -65,10 +65,11 @@ 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 = rpcSetIpWhite(pTrans, &ipWhite);
|
||||
pData->ipWhiteVer = ipWhite.ver;
|
||||
|
||||
tFreeSUpdateIpWhiteReq(&ipWhite);
|
||||
|
|
|
@ -224,7 +224,7 @@ int32_t mndSetCreateQnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, SQnodeOb
|
|||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return -1;
|
||||
}
|
||||
tSerializeSCreateDropMQSNodeReq(pReq, contLen, &createReq);
|
||||
(void)tSerializeSCreateDropMQSNodeReq(pReq, contLen, &createReq);
|
||||
|
||||
STransAction action = {0};
|
||||
action.epSet = mndGetDnodeEpset(pDnode);
|
||||
|
@ -252,7 +252,7 @@ static int32_t mndSetCreateQnodeUndoActions(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);
|
||||
|
@ -330,7 +330,7 @@ static int32_t mndProcessCreateQnodeReq(SRpcMsg *pReq) {
|
|||
if (code == 0) code = TSDB_CODE_ACTION_IN_PROGRESS;
|
||||
|
||||
char obj[33] = {0};
|
||||
sprintf(obj, "%d", createReq.dnodeId);
|
||||
(void)sprintf(obj, "%d", createReq.dnodeId);
|
||||
|
||||
auditRecord(pReq, pMnode->clusterId, "createQnode", "", obj, createReq.sql, createReq.sqlLen);
|
||||
_OVER:
|
||||
|
@ -383,7 +383,7 @@ static int32_t mndSetDropQnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, SQn
|
|||
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);
|
||||
|
@ -459,7 +459,7 @@ static int32_t mndProcessDropQnodeReq(SRpcMsg *pReq) {
|
|||
if (code == 0) code = TSDB_CODE_ACTION_IN_PROGRESS;
|
||||
|
||||
char obj[33] = {0};
|
||||
sprintf(obj, "%d", dropReq.dnodeId);
|
||||
(void)sprintf(obj, "%d", dropReq.dnodeId);
|
||||
|
||||
auditRecord(pReq, pMnode->clusterId, "dropQnode", "", obj, dropReq.sql, dropReq.sqlLen);
|
||||
|
||||
|
@ -531,7 +531,7 @@ static int32_t mndProcessQnodeListReq(SRpcMsg *pReq) {
|
|||
goto _OVER;
|
||||
}
|
||||
|
||||
tSerializeSQnodeListRsp(pRsp, rspLen, &qlistRsp);
|
||||
(void)tSerializeSQnodeListRsp(pRsp, rspLen, &qlistRsp);
|
||||
|
||||
pReq->info.rspLen = rspLen;
|
||||
pReq->info.rsp = pRsp;
|
||||
|
@ -556,15 +556,15 @@ static int32_t mndRetrieveQnodes(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);
|
||||
|
|
|
@ -27,7 +27,7 @@ int32_t mndPreProcessQueryMsg(SRpcMsg *pMsg) {
|
|||
void mndPostProcessQueryMsg(SRpcMsg *pMsg) {
|
||||
if (TDMT_SCH_QUERY != pMsg->msgType && TDMT_SCH_MERGE_QUERY != pMsg->msgType) return;
|
||||
SMnode *pMnode = pMsg->info.node;
|
||||
qWorkerAbortPreprocessQueryMsg(pMnode->pQuery, pMsg);
|
||||
(void)qWorkerAbortPreprocessQueryMsg(pMnode->pQuery, pMsg);
|
||||
}
|
||||
|
||||
int32_t mndProcessQueryMsg(SRpcMsg *pMsg, SQueueInfo* pInfo) {
|
||||
|
@ -134,7 +134,10 @@ int32_t mndProcessBatchMetaMsg(SRpcMsg *pMsg) {
|
|||
rsp.msgLen = reqMsg.info.rspLen;
|
||||
rsp.msg = reqMsg.info.rsp;
|
||||
|
||||
taosArrayPush(batchRsp.pRsps, &rsp);
|
||||
if (taosArrayPush(batchRsp.pRsps, &rsp) == NULL) {
|
||||
mError("msg:%p, failed to put array since %s, app:%p type:%s", pMsg, terrstr(), pMsg->info.ahandle,
|
||||
TMSG_INFO(pMsg->msgType));
|
||||
}
|
||||
}
|
||||
|
||||
rspSize = tSerializeSBatchRsp(NULL, 0, &batchRsp);
|
||||
|
|
|
@ -115,7 +115,7 @@ int32_t mndSetSinkTaskInfo(SStreamObj* pStream, SStreamTask* pTask) {
|
|||
} else {
|
||||
pInfo->type = TASK_OUTPUT__TABLE;
|
||||
pInfo->tbSink.stbUid = pStream->targetStbUid;
|
||||
memcpy(pInfo->tbSink.stbFullName, pStream->targetSTbName, TSDB_TABLE_FNAME_LEN);
|
||||
(void)memcpy(pInfo->tbSink.stbFullName, pStream->targetSTbName, TSDB_TABLE_FNAME_LEN);
|
||||
pInfo->tbSink.pSchemaWrapper = tCloneSSchemaWrapper(&pStream->outputSchema);
|
||||
if (pInfo->tbSink.pSchemaWrapper == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
|
@ -145,7 +145,7 @@ int32_t mndAddDispatcherForInternalTask(SMnode* pMnode, SStreamObj* pStream, SAr
|
|||
int32_t numOfSinkNodes = taosArrayGetSize(pSinkNodeList);
|
||||
|
||||
if (isShuffle) {
|
||||
memcpy(pTask->outputInfo.shuffleDispatcher.stbFullName, pStream->targetSTbName, TSDB_TABLE_FNAME_LEN);
|
||||
(void)memcpy(pTask->outputInfo.shuffleDispatcher.stbFullName, pStream->targetSTbName, TSDB_TABLE_FNAME_LEN);
|
||||
SArray* pVgs = pTask->outputInfo.shuffleDispatcher.dbInfo.pVgroupInfos;
|
||||
|
||||
int32_t numOfVgroups = taosArrayGetSize(pVgs);
|
||||
|
@ -363,10 +363,14 @@ static int32_t buildSourceTask(SStreamObj* pStream, SEpSet* pEpset, bool isFillh
|
|||
|
||||
static void addNewTaskList(SStreamObj* pStream) {
|
||||
SArray* pTaskList = taosArrayInit(0, POINTER_BYTES);
|
||||
taosArrayPush(pStream->tasks, &pTaskList);
|
||||
if (taosArrayPush(pStream->tasks, &pTaskList) == NULL) {
|
||||
mError("failed to put array");
|
||||
}
|
||||
if (pStream->conf.fillHistory) {
|
||||
pTaskList = taosArrayInit(0, POINTER_BYTES);
|
||||
taosArrayPush(pStream->pHTasksList, &pTaskList);
|
||||
if (taosArrayPush(pStream->pHTasksList, &pTaskList) == NULL) {
|
||||
mError("failed to put array");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -584,10 +588,15 @@ static int32_t addSinkTask(SMnode* pMnode, SStreamObj* pStream, SEpSet* pEpset)
|
|||
}
|
||||
|
||||
static void bindTaskToSinkTask(SStreamObj* pStream, SMnode* pMnode, SArray* pSinkTaskList, SStreamTask* task) {
|
||||
mndAddDispatcherForInternalTask(pMnode, pStream, pSinkTaskList, task);
|
||||
int32_t code = 0;
|
||||
if ((code = mndAddDispatcherForInternalTask(pMnode, pStream, pSinkTaskList, task)) != 0) {
|
||||
mError("failed bind task to sink task since %s", tstrerror(code));
|
||||
}
|
||||
for (int32_t k = 0; k < taosArrayGetSize(pSinkTaskList); k++) {
|
||||
SStreamTask* pSinkTask = taosArrayGetP(pSinkTaskList, k);
|
||||
streamTaskSetUpstreamInfo(pSinkTask, task);
|
||||
if ((code = streamTaskSetUpstreamInfo(pSinkTask, task)) != 0) {
|
||||
mError("failed bind task to sink task since %s", tstrerror(code));
|
||||
}
|
||||
}
|
||||
mDebug("bindTaskToSinkTask taskId:%s to sink task list", task->id.idStr);
|
||||
}
|
||||
|
@ -604,6 +613,7 @@ static void bindAggSink(SStreamObj* pStream, SMnode* pMnode, SArray* tasks) {
|
|||
}
|
||||
|
||||
static void bindSourceSink(SStreamObj* pStream, SMnode* pMnode, SArray* tasks, bool hasExtraSink) {
|
||||
int32_t code = 0;
|
||||
SArray* pSinkTaskList = taosArrayGetP(tasks, SINK_NODE_LEVEL);
|
||||
SArray* pSourceTaskList = taosArrayGetP(tasks, hasExtraSink ? SINK_NODE_LEVEL + 1 : SINK_NODE_LEVEL);
|
||||
|
||||
|
@ -614,12 +624,15 @@ static void bindSourceSink(SStreamObj* pStream, SMnode* pMnode, SArray* tasks, b
|
|||
if (hasExtraSink) {
|
||||
bindTaskToSinkTask(pStream, pMnode, pSinkTaskList, pSourceTask);
|
||||
} else {
|
||||
mndSetSinkTaskInfo(pStream, pSourceTask);
|
||||
if ((code = mndSetSinkTaskInfo(pStream, pSourceTask)) != 0) {
|
||||
mError("failed bind task to sink task since %s", tstrerror(code));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void bindTwoLevel(SArray* tasks, int32_t begin, int32_t end) {
|
||||
int32_t code = 0;
|
||||
size_t size = taosArrayGetSize(tasks);
|
||||
ASSERT(size >= 2);
|
||||
SArray* pDownTaskList = taosArrayGetP(tasks, size - 1);
|
||||
|
@ -631,7 +644,9 @@ static void bindTwoLevel(SArray* tasks, int32_t begin, int32_t end) {
|
|||
SStreamTask* pUpTask = taosArrayGetP(pUpTaskList, i);
|
||||
pUpTask->info.selfChildId = i - begin;
|
||||
streamTaskSetFixedDownstreamInfo(pUpTask, *pDownTask);
|
||||
streamTaskSetUpstreamInfo(*pDownTask, pUpTask);
|
||||
if ((code = streamTaskSetUpstreamInfo(*pDownTask, pUpTask)) != 0) {
|
||||
mError("failed bind task to sink task since %s", tstrerror(code));
|
||||
}
|
||||
}
|
||||
mDebug("bindTwoLevel task list(%d-%d) to taskId:%s", begin, end - 1, (*(pDownTask))->id.idStr);
|
||||
}
|
||||
|
|
|
@ -158,7 +158,7 @@ static SShowObj *mndCreateShowObj(SMnode *pMnode, SRetrieveTableReq *pReq) {
|
|||
showObj.id = showId;
|
||||
showObj.pMnode = pMnode;
|
||||
showObj.type = convertToRetrieveType(pReq->tb, tListLen(pReq->tb));
|
||||
memcpy(showObj.db, pReq->db, TSDB_DB_FNAME_LEN);
|
||||
(void)memcpy(showObj.db, pReq->db, TSDB_DB_FNAME_LEN);
|
||||
tstrncpy(showObj.filterTb, pReq->filterTb, TSDB_TABLE_NAME_LEN);
|
||||
|
||||
int32_t keepTime = tsShellActivityTimer * 6 * 1000;
|
||||
|
@ -270,9 +270,9 @@ static int32_t mndProcessRetrieveSysTableReq(SRpcMsg *pReq) {
|
|||
|
||||
mDebug("show:0x%" PRIx64 ", start retrieve data, type:%d", pShow->id, pShow->type);
|
||||
if (retrieveReq.user[0] != 0) {
|
||||
memcpy(pReq->info.conn.user, retrieveReq.user, TSDB_USER_LEN);
|
||||
(void)memcpy(pReq->info.conn.user, retrieveReq.user, TSDB_USER_LEN);
|
||||
} else {
|
||||
memcpy(pReq->info.conn.user, TSDB_DEFAULT_USER, strlen(TSDB_DEFAULT_USER) + 1);
|
||||
(void)memcpy(pReq->info.conn.user, TSDB_DEFAULT_USER, strlen(TSDB_DEFAULT_USER) + 1);
|
||||
}
|
||||
code = -1;
|
||||
if (retrieveReq.db[0] &&
|
||||
|
@ -303,10 +303,10 @@ static int32_t mndProcessRetrieveSysTableReq(SRpcMsg *pReq) {
|
|||
idata.info.bytes = p->bytes;
|
||||
idata.info.type = p->type;
|
||||
idata.info.colId = p->colId;
|
||||
blockDataAppendColInfo(pBlock, &idata);
|
||||
TAOS_CHECK_RETURN(blockDataAppendColInfo(pBlock, &idata));
|
||||
}
|
||||
|
||||
blockDataEnsureCapacity(pBlock, rowsToRead);
|
||||
TAOS_CHECK_RETURN(blockDataEnsureCapacity(pBlock, rowsToRead));
|
||||
|
||||
if (mndCheckRetrieveFinished(pShow)) {
|
||||
mDebug("show:0x%" PRIx64 ", read finished, numOfRows:%d", pShow->id, pShow->numOfRows);
|
||||
|
|
|
@ -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);
|
||||
(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);
|
||||
code = 0;
|
||||
}
|
||||
} 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; }
|
||||
|
@ -1148,13 +1151,13 @@ static void mndTransSendRpcRsp(SMnode *pMnode, STrans *pTrans) {
|
|||
} else if (pTrans->originRpcType == TDMT_MND_CREATE_STB) {
|
||||
void *pCont = NULL;
|
||||
int32_t contLen = 0;
|
||||
if (0 == mndBuildSMCreateStbRsp(pMnode, pTrans->dbname, pTrans->stbname, &pCont, &contLen) != 0) {
|
||||
if (0 == mndBuildSMCreateStbRsp(pMnode, pTrans->dbname, pTrans->stbname, &pCont, &contLen)) {
|
||||
mndTransSetRpcRsp(pTrans, pCont, contLen);
|
||||
}
|
||||
} else if (pTrans->originRpcType == TDMT_MND_CREATE_INDEX) {
|
||||
void *pCont = NULL;
|
||||
int32_t contLen = 0;
|
||||
if (0 == mndBuildSMCreateStbRsp(pMnode, pTrans->dbname, pTrans->stbname, &pCont, &contLen) != 0) {
|
||||
if (0 == mndBuildSMCreateStbRsp(pMnode, pTrans->dbname, pTrans->stbname, &pCont, &contLen)) {
|
||||
mndTransSetRpcRsp(pTrans, pCont, contLen);
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ Testbase MndTestTopic::test;
|
|||
|
||||
void* MndTestTopic::BuildCreateDbReq(const char* dbname, int32_t* pContLen) {
|
||||
SCreateDbReq createReq = {0};
|
||||
strcpy(createReq.db, dbname);
|
||||
(void)strcpy(createReq.db, dbname);
|
||||
createReq.numOfVgroups = 2;
|
||||
createReq.buffer = -1;
|
||||
createReq.pageSize = -1;
|
||||
|
@ -53,7 +53,8 @@ void* MndTestTopic::BuildCreateDbReq(const char* dbname, int32_t* pContLen) {
|
|||
|
||||
int32_t contLen = tSerializeSCreateDbReq(NULL, 0, &createReq);
|
||||
void* pReq = rpcMallocCont(contLen);
|
||||
tSerializeSCreateDbReq(pReq, contLen, &createReq);
|
||||
assert(pReq != NULL);
|
||||
(void)tSerializeSCreateDbReq(pReq, contLen, &createReq);
|
||||
|
||||
*pContLen = contLen;
|
||||
return pReq;
|
||||
|
@ -61,14 +62,15 @@ void* MndTestTopic::BuildCreateDbReq(const char* dbname, int32_t* pContLen) {
|
|||
|
||||
void* MndTestTopic::BuildCreateTopicReq(const char* topicName, const char* sql, int32_t* pContLen) {
|
||||
SCMCreateTopicReq createReq = {0};
|
||||
strcpy(createReq.name, topicName);
|
||||
(void)strcpy(createReq.name, topicName);
|
||||
createReq.igExists = 0;
|
||||
createReq.sql = (char*)sql;
|
||||
createReq.ast = NULL;
|
||||
|
||||
int32_t contLen = tSerializeSCMCreateTopicReq(NULL, 0, &createReq);
|
||||
void* pReq = rpcMallocCont(contLen);
|
||||
tSerializeSCMCreateTopicReq(pReq, contLen, &createReq);
|
||||
assert(pReq != NULL);
|
||||
(void)tSerializeSCMCreateTopicReq(pReq, contLen, &createReq);
|
||||
|
||||
*pContLen = contLen;
|
||||
return pReq;
|
||||
|
@ -76,11 +78,12 @@ void* MndTestTopic::BuildCreateTopicReq(const char* topicName, const char* sql,
|
|||
|
||||
void* MndTestTopic::BuildDropTopicReq(const char* topicName, int32_t* pContLen) {
|
||||
SMDropTopicReq dropReq = {0};
|
||||
strcpy(dropReq.name, topicName);
|
||||
(void)strcpy(dropReq.name, topicName);
|
||||
|
||||
int32_t contLen = tSerializeSMDropTopicReq(NULL, 0, &dropReq);
|
||||
void* pReq = rpcMallocCont(contLen);
|
||||
tSerializeSMDropTopicReq(pReq, contLen, &dropReq);
|
||||
assert(pReq != NULL);
|
||||
(void)tSerializeSMDropTopicReq(pReq, contLen, &dropReq);
|
||||
|
||||
*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);
|
||||
(void) 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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -530,12 +530,12 @@ int32_t metaGetCachedTableUidList(void* pVnode, tb_uid_t suid, const uint8_t* pK
|
|||
uint64_t key[4];
|
||||
initCacheKey(key, pTableMap, suid, (const char*)pKey, keyLen);
|
||||
|
||||
taosThreadMutexLock(pLock);
|
||||
(void)taosThreadMutexLock(pLock);
|
||||
pMeta->pCache->sTagFilterResCache.accTimes += 1;
|
||||
|
||||
LRUHandle* pHandle = taosLRUCacheLookup(pCache, key, TAG_FILTER_RES_KEY_LEN);
|
||||
if (pHandle == NULL) {
|
||||
taosThreadMutexUnlock(pLock);
|
||||
(void)taosThreadMutexUnlock(pLock);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -565,7 +565,7 @@ int32_t metaGetCachedTableUidList(void* pVnode, tb_uid_t suid, const uint8_t* pK
|
|||
taosLRUCacheRelease(pCache, pHandle, false);
|
||||
|
||||
// unlock meta
|
||||
taosThreadMutexUnlock(pLock);
|
||||
(void)taosThreadMutexUnlock(pLock);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -652,7 +652,7 @@ int32_t metaUidFilterCachePut(void* pVnode, uint64_t suid, const void* pKey, int
|
|||
uint64_t key[4] = {0};
|
||||
initCacheKey(key, pTableEntry, suid, pKey, keyLen);
|
||||
|
||||
taosThreadMutexLock(pLock);
|
||||
(void)taosThreadMutexLock(pLock);
|
||||
STagFilterResEntry** pEntry = taosHashGet(pTableEntry, &suid, sizeof(uint64_t));
|
||||
if (pEntry == NULL) {
|
||||
code = addNewEntry(pTableEntry, pKey, keyLen, suid);
|
||||
|
@ -668,7 +668,7 @@ int32_t metaUidFilterCachePut(void* pVnode, uint64_t suid, const void* pKey, int
|
|||
uint64_t* p = (uint64_t*)pNode->data;
|
||||
if (p[1] == ((uint64_t*)pKey)[1] && p[0] == ((uint64_t*)pKey)[0]) {
|
||||
// we have already found the existed items, no need to added to cache anymore.
|
||||
taosThreadMutexUnlock(pLock);
|
||||
(void)taosThreadMutexUnlock(pLock);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
} else { // not equal, append it
|
||||
tdListAppend(&(*pEntry)->list, pKey);
|
||||
|
@ -680,7 +680,7 @@ int32_t metaUidFilterCachePut(void* pVnode, uint64_t suid, const void* pKey, int
|
|||
(void)taosLRUCacheInsert(pCache, key, TAG_FILTER_RES_KEY_LEN, pPayload, payloadLen, freeUidCachePayload, NULL,
|
||||
TAOS_LRU_PRIORITY_LOW, NULL);
|
||||
_end:
|
||||
taosThreadMutexUnlock(pLock);
|
||||
(void)taosThreadMutexUnlock(pLock);
|
||||
metaDebug("vgId:%d, suid:%" PRIu64 " list cache added into cache, total:%d, tables:%d", vgId, suid,
|
||||
(int32_t)taosLRUCacheGetUsage(pCache), taosHashGetSize(pTableEntry));
|
||||
|
||||
|
@ -697,11 +697,11 @@ int32_t metaUidCacheClear(SMeta* pMeta, uint64_t suid) {
|
|||
initCacheKey(p, pEntryHashMap, suid, (char*)&dummy[0], 16);
|
||||
|
||||
TdThreadMutex* pLock = &pMeta->pCache->sTagFilterResCache.lock;
|
||||
taosThreadMutexLock(pLock);
|
||||
(void)taosThreadMutexLock(pLock);
|
||||
|
||||
STagFilterResEntry** pEntry = taosHashGet(pEntryHashMap, &suid, sizeof(uint64_t));
|
||||
if (pEntry == NULL || listNEles(&(*pEntry)->list) == 0) {
|
||||
taosThreadMutexUnlock(pLock);
|
||||
(void)taosThreadMutexUnlock(pLock);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -717,7 +717,7 @@ int32_t metaUidCacheClear(SMeta* pMeta, uint64_t suid) {
|
|||
}
|
||||
|
||||
tdListEmpty(&(*pEntry)->list);
|
||||
taosThreadMutexUnlock(pLock);
|
||||
(void)taosThreadMutexUnlock(pLock);
|
||||
|
||||
metaDebug("vgId:%d suid:%" PRId64 " cached related tag filter uid list cleared", vgId, suid);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
|
@ -736,12 +736,12 @@ int32_t metaGetCachedTbGroup(void* pVnode, tb_uid_t suid, const uint8_t* pKey, i
|
|||
uint64_t key[4];
|
||||
initCacheKey(key, pTableMap, suid, (const char*)pKey, keyLen);
|
||||
|
||||
taosThreadMutexLock(pLock);
|
||||
(void)taosThreadMutexLock(pLock);
|
||||
pMeta->pCache->STbGroupResCache.accTimes += 1;
|
||||
|
||||
LRUHandle* pHandle = taosLRUCacheLookup(pCache, key, TAG_FILTER_RES_KEY_LEN);
|
||||
if (pHandle == NULL) {
|
||||
taosThreadMutexUnlock(pLock);
|
||||
(void)taosThreadMutexUnlock(pLock);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -764,7 +764,7 @@ int32_t metaGetCachedTbGroup(void* pVnode, tb_uid_t suid, const uint8_t* pKey, i
|
|||
taosLRUCacheRelease(pCache, pHandle, false);
|
||||
|
||||
// unlock meta
|
||||
taosThreadMutexUnlock(pLock);
|
||||
(void)taosThreadMutexUnlock(pLock);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -829,7 +829,7 @@ int32_t metaPutTbGroupToCache(void* pVnode, uint64_t suid, const void* pKey, int
|
|||
uint64_t key[4] = {0};
|
||||
initCacheKey(key, pTableEntry, suid, pKey, keyLen);
|
||||
|
||||
taosThreadMutexLock(pLock);
|
||||
(void)taosThreadMutexLock(pLock);
|
||||
STagFilterResEntry** pEntry = taosHashGet(pTableEntry, &suid, sizeof(uint64_t));
|
||||
if (pEntry == NULL) {
|
||||
code = addNewEntry(pTableEntry, pKey, keyLen, suid);
|
||||
|
@ -845,7 +845,7 @@ int32_t metaPutTbGroupToCache(void* pVnode, uint64_t suid, const void* pKey, int
|
|||
uint64_t* p = (uint64_t*)pNode->data;
|
||||
if (p[1] == ((uint64_t*)pKey)[1] && p[0] == ((uint64_t*)pKey)[0]) {
|
||||
// we have already found the existed items, no need to added to cache anymore.
|
||||
taosThreadMutexUnlock(pLock);
|
||||
(void)taosThreadMutexUnlock(pLock);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
} else { // not equal, append it
|
||||
tdListAppend(&(*pEntry)->list, pKey);
|
||||
|
@ -857,7 +857,7 @@ int32_t metaPutTbGroupToCache(void* pVnode, uint64_t suid, const void* pKey, int
|
|||
taosLRUCacheInsert(pCache, key, TAG_FILTER_RES_KEY_LEN, pPayload, payloadLen, freeTbGroupCachePayload, NULL,
|
||||
TAOS_LRU_PRIORITY_LOW, NULL);
|
||||
_end:
|
||||
taosThreadMutexUnlock(pLock);
|
||||
(void)taosThreadMutexUnlock(pLock);
|
||||
metaDebug("vgId:%d, suid:%" PRIu64 " tb group added into cache, total:%d, tables:%d", vgId, suid,
|
||||
(int32_t)taosLRUCacheGetUsage(pCache), taosHashGetSize(pTableEntry));
|
||||
|
||||
|
@ -874,11 +874,11 @@ int32_t metaTbGroupCacheClear(SMeta* pMeta, uint64_t suid) {
|
|||
initCacheKey(p, pEntryHashMap, suid, (char*)&dummy[0], 16);
|
||||
|
||||
TdThreadMutex* pLock = &pMeta->pCache->STbGroupResCache.lock;
|
||||
taosThreadMutexLock(pLock);
|
||||
(void)taosThreadMutexLock(pLock);
|
||||
|
||||
STagFilterResEntry** pEntry = taosHashGet(pEntryHashMap, &suid, sizeof(uint64_t));
|
||||
if (pEntry == NULL || listNEles(&(*pEntry)->list) == 0) {
|
||||
taosThreadMutexUnlock(pLock);
|
||||
(void)taosThreadMutexUnlock(pLock);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -894,7 +894,7 @@ int32_t metaTbGroupCacheClear(SMeta* pMeta, uint64_t suid) {
|
|||
}
|
||||
|
||||
tdListEmpty(&(*pEntry)->list);
|
||||
taosThreadMutexUnlock(pLock);
|
||||
(void)taosThreadMutexUnlock(pLock);
|
||||
|
||||
metaDebug("vgId:%d suid:%" PRId64 " cached related tb group cleared", vgId, suid);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -39,13 +39,15 @@ 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);
|
||||
|
@ -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,11 +79,14 @@ 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));
|
||||
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);
|
||||
|
@ -116,6 +119,10 @@ NextTbl:
|
|||
break;
|
||||
} else {
|
||||
pVal = taosMemoryCalloc(1, tLen);
|
||||
if (pVal == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
goto _err;
|
||||
}
|
||||
memcpy(pVal, tVal, tLen);
|
||||
vLen = tLen;
|
||||
}
|
||||
|
@ -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) {
|
||||
|
@ -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,16 +1430,17 @@ 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),
|
||||
(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);
|
||||
|
@ -2419,7 +2407,7 @@ static int32_t getNextRowFromFS(void *iter, TSDBROW **ppRow, bool *pIgnoreEarlie
|
|||
if (!state->pBrinBlock) {
|
||||
state->pBrinBlock = &state->brinBlock;
|
||||
} else {
|
||||
tBrinBlockClear(&state->brinBlock);
|
||||
(void)tBrinBlockClear(&state->brinBlock);
|
||||
}
|
||||
|
||||
TAOS_CHECK_GOTO(tsdbDataFileReadBrinBlock(state->pr->pFileReader, pBrinBlk, &state->brinBlock), &lino, _err);
|
||||
|
@ -2431,7 +2419,7 @@ static int32_t getNextRowFromFS(void *iter, TSDBROW **ppRow, bool *pIgnoreEarlie
|
|||
if (SFSNEXTROW_BRINBLOCK == state->state) {
|
||||
_next_brinrecord:
|
||||
if (state->iBrinRecord < 0) { // empty brin block, goto _next_brinindex
|
||||
tBrinBlockClear(&state->brinBlock);
|
||||
(void)tBrinBlockClear(&state->brinBlock);
|
||||
goto _next_brinindex;
|
||||
}
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -2691,7 +2679,7 @@ int32_t clearNextRowFromFS(void *iter) {
|
|||
}
|
||||
|
||||
if (state->pBrinBlock) {
|
||||
tBrinBlockDestroy(state->pBrinBlock);
|
||||
(void)tBrinBlockDestroy(state->pBrinBlock);
|
||||
state->pBrinBlock = NULL;
|
||||
}
|
||||
|
||||
|
@ -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) { taosLRUCacheRelease(pCache, h, false); }
|
||||
|
||||
void tsdbCacheSetCapacity(SVnode *pVnode, size_t capacity) {
|
||||
taosLRUCacheSetCapacity(pVnode->pTsdb->lruCache, capacity);
|
||||
|
|
|
@ -540,7 +540,7 @@ static int32_t tsdbCommitInfoBuild(STsdb *tsdb) {
|
|||
}
|
||||
}
|
||||
|
||||
taosThreadMutexLock(&tsdb->mutex);
|
||||
(void)taosThreadMutexLock(&tsdb->mutex);
|
||||
|
||||
// scan tomb data
|
||||
if (tsdb->imem->nDel > 0) {
|
||||
|
@ -572,7 +572,7 @@ static int32_t tsdbCommitInfoBuild(STsdb *tsdb) {
|
|||
} else {
|
||||
hasDataToCommit = true;
|
||||
if ((code = tsdbCommitInfoAdd(tsdb, fset->fid))) {
|
||||
taosThreadMutexUnlock(&tsdb->mutex);
|
||||
(void)taosThreadMutexUnlock(&tsdb->mutex);
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
}
|
||||
break;
|
||||
|
@ -593,13 +593,13 @@ static int32_t tsdbCommitInfoBuild(STsdb *tsdb) {
|
|||
if (fset) {
|
||||
code = tsdbTFileSetInitCopy(tsdb, fset, &info->fset);
|
||||
if (code) {
|
||||
taosThreadMutexUnlock(&tsdb->mutex);
|
||||
(void)taosThreadMutexUnlock(&tsdb->mutex);
|
||||
TAOS_CHECK_GOTO(code, &lino, _exit);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
taosThreadMutexUnlock(&tsdb->mutex);
|
||||
(void)taosThreadMutexUnlock(&tsdb->mutex);
|
||||
|
||||
_exit:
|
||||
if (code) {
|
||||
|
@ -667,11 +667,11 @@ _exit:
|
|||
}
|
||||
|
||||
int32_t tsdbPreCommit(STsdb *tsdb) {
|
||||
taosThreadMutexLock(&tsdb->mutex);
|
||||
(void)taosThreadMutexLock(&tsdb->mutex);
|
||||
ASSERT_CORE(tsdb->imem == NULL, "imem should be null to commit mem");
|
||||
tsdb->imem = tsdb->mem;
|
||||
tsdb->mem = NULL;
|
||||
taosThreadMutexUnlock(&tsdb->mutex);
|
||||
(void)taosThreadMutexUnlock(&tsdb->mutex);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -686,9 +686,9 @@ int32_t tsdbCommitBegin(STsdb *tsdb, SCommitInfo *info) {
|
|||
int64_t nDel = imem->nDel;
|
||||
|
||||
if (nRow == 0 && nDel == 0) {
|
||||
taosThreadMutexLock(&tsdb->mutex);
|
||||
(void)taosThreadMutexLock(&tsdb->mutex);
|
||||
tsdb->imem = NULL;
|
||||
taosThreadMutexUnlock(&tsdb->mutex);
|
||||
(void)taosThreadMutexUnlock(&tsdb->mutex);
|
||||
tsdbUnrefMemTable(imem, NULL, true);
|
||||
} else {
|
||||
SCommitter2 committer = {0};
|
||||
|
@ -719,10 +719,10 @@ int32_t tsdbCommitCommit(STsdb *tsdb) {
|
|||
if (tsdb->imem) {
|
||||
SMemTable *pMemTable = tsdb->imem;
|
||||
|
||||
taosThreadMutexLock(&tsdb->mutex);
|
||||
(void)taosThreadMutexLock(&tsdb->mutex);
|
||||
|
||||
if ((code = tsdbFSEditCommit(tsdb->pFS))) {
|
||||
taosThreadMutexUnlock(&tsdb->mutex);
|
||||
(void)taosThreadMutexUnlock(&tsdb->mutex);
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
}
|
||||
tsdb->imem = NULL;
|
||||
|
@ -734,7 +734,7 @@ int32_t tsdbCommitCommit(STsdb *tsdb) {
|
|||
}
|
||||
}
|
||||
|
||||
taosThreadMutexUnlock(&tsdb->mutex);
|
||||
(void)taosThreadMutexUnlock(&tsdb->mutex);
|
||||
|
||||
tsdbCommitInfoDestroy(tsdb);
|
||||
tsdbUnrefMemTable(pMemTable, NULL, true);
|
||||
|
@ -757,14 +757,14 @@ int32_t tsdbCommitAbort(STsdb *pTsdb) {
|
|||
|
||||
TAOS_CHECK_GOTO(tsdbFSEditAbort(pTsdb->pFS), &lino, _exit);
|
||||
|
||||
taosThreadMutexLock(&pTsdb->mutex);
|
||||
(void)taosThreadMutexLock(&pTsdb->mutex);
|
||||
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);
|
||||
}
|
||||
}
|
||||
taosThreadMutexUnlock(&pTsdb->mutex);
|
||||
(void)taosThreadMutexUnlock(&pTsdb->mutex);
|
||||
tsdbCommitInfoDestroy(pTsdb);
|
||||
|
||||
_exit:
|
||||
|
|
|
@ -230,7 +230,7 @@ int32_t tsdbDataFileReadBrinBlock(SDataFileReader *reader, const SBrinBlk *brinB
|
|||
|
||||
// decode brin block
|
||||
SBufferReader br = BUFFER_READER_INITIALIZER(0, buffer);
|
||||
tBrinBlockClear(brinBlock);
|
||||
(void)tBrinBlockClear(brinBlock);
|
||||
brinBlock->numOfPKs = brinBlk->numOfPKs;
|
||||
brinBlock->numOfRecords = brinBlk->numRec;
|
||||
for (int32_t i = 0; i < 10; i++) { // int64_t
|
||||
|
@ -673,12 +673,12 @@ static int32_t tsdbDataFileWriterDoClose(SDataFileWriter *writer) {
|
|||
tTombBlockDestroy(writer->tombBlock);
|
||||
TARRAY2_DESTROY(writer->tombBlkArray, NULL);
|
||||
tBlockDataDestroy(writer->blockData);
|
||||
tBrinBlockDestroy(writer->brinBlock);
|
||||
(void)tBrinBlockDestroy(writer->brinBlock);
|
||||
TARRAY2_DESTROY(writer->brinBlkArray, NULL);
|
||||
|
||||
tTombBlockDestroy(writer->ctx->tombBlock);
|
||||
tBlockDataDestroy(writer->ctx->blockData);
|
||||
tBrinBlockDestroy(writer->ctx->brinBlock);
|
||||
(void)tBrinBlockDestroy(writer->ctx->brinBlock);
|
||||
|
||||
for (int32_t i = 0; i < ARRAY_SIZE(writer->local); ++i) {
|
||||
tBufferDestroy(writer->local + i);
|
||||
|
@ -838,7 +838,7 @@ int32_t tsdbFileWriteBrinBlock(STsdbFD *fd, SBrinBlock *brinBlock, uint32_t cmpr
|
|||
for (int i = 0; i < brinBlock->numOfRecords; i++) {
|
||||
SBrinRecord record;
|
||||
|
||||
tBrinBlockGet(brinBlock, i, &record);
|
||||
(void)tBrinBlockGet(brinBlock, i, &record);
|
||||
if (i == 0) {
|
||||
brinBlk.minTbid.suid = record.suid;
|
||||
brinBlk.minTbid.uid = record.uid;
|
||||
|
@ -918,7 +918,7 @@ int32_t tsdbFileWriteBrinBlock(STsdbFD *fd, SBrinBlock *brinBlock, uint32_t cmpr
|
|||
// append to brinBlkArray
|
||||
TAOS_CHECK_RETURN(TARRAY2_APPEND_PTR(brinBlkArray, &brinBlk));
|
||||
|
||||
tBrinBlockClear(brinBlock);
|
||||
(void)tBrinBlockClear(brinBlock);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1147,7 +1147,7 @@ static int32_t tsdbDataFileDoWriteTableOldData(SDataFileWriter *writer, const ST
|
|||
|
||||
for (; writer->ctx->brinBlockIdx < writer->ctx->brinBlock->numOfRecords; writer->ctx->brinBlockIdx++) {
|
||||
SBrinRecord record;
|
||||
tBrinBlockGet(writer->ctx->brinBlock, writer->ctx->brinBlockIdx, &record);
|
||||
(void)tBrinBlockGet(writer->ctx->brinBlock, writer->ctx->brinBlockIdx, &record);
|
||||
if (record.uid != writer->ctx->tbid->uid) {
|
||||
writer->ctx->tbHasOldData = false;
|
||||
goto _exit;
|
||||
|
@ -1157,7 +1157,7 @@ static int32_t tsdbDataFileDoWriteTableOldData(SDataFileWriter *writer, const ST
|
|||
goto _exit;
|
||||
} else {
|
||||
SBrinRecord record[1];
|
||||
tBrinBlockGet(writer->ctx->brinBlock, writer->ctx->brinBlockIdx, record);
|
||||
(void)tBrinBlockGet(writer->ctx->brinBlock, writer->ctx->brinBlockIdx, record);
|
||||
if (tsdbRowKeyCmprNullAsLargest(key, &record->lastKey) > 0) { // key > record->lastKey
|
||||
if (writer->blockData->nRow > 0) {
|
||||
TAOS_CHECK_GOTO(tsdbDataFileDoWriteBlockData(writer, writer->blockData), &lino, _exit);
|
||||
|
@ -1351,7 +1351,7 @@ int32_t tsdbFileWriteTombBlock(STsdbFD *fd, STombBlock *tombBlock, int8_t cmprAl
|
|||
};
|
||||
for (int i = 0; i < TOMB_BLOCK_SIZE(tombBlock); i++) {
|
||||
STombRecord record;
|
||||
tTombBlockGet(tombBlock, i, &record);
|
||||
TAOS_UNUSED(tTombBlockGet(tombBlock, i, &record));
|
||||
|
||||
if (i == 0) {
|
||||
tombBlk.minTbid.suid = record.suid;
|
||||
|
@ -1506,7 +1506,7 @@ static int32_t tsdbDataFileDoWriteTombRecord(SDataFileWriter *writer, const STom
|
|||
while (writer->ctx->hasOldTomb) {
|
||||
for (; writer->ctx->tombBlockIdx < TOMB_BLOCK_SIZE(writer->ctx->tombBlock); writer->ctx->tombBlockIdx++) {
|
||||
STombRecord record1[1];
|
||||
tTombBlockGet(writer->ctx->tombBlock, writer->ctx->tombBlockIdx, record1);
|
||||
TAOS_UNUSED(tTombBlockGet(writer->ctx->tombBlock, writer->ctx->tombBlockIdx, record1));
|
||||
|
||||
int32_t c = tTombRecordCompare(record, record1);
|
||||
if (c < 0) {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -761,7 +761,7 @@ int32_t tsdbDisableAndCancelAllBgTask(STsdb *pTsdb) {
|
|||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
taosThreadMutexLock(&pTsdb->mutex);
|
||||
(void)taosThreadMutexLock(&pTsdb->mutex);
|
||||
|
||||
// disable
|
||||
pTsdb->bgTaskDisabled = true;
|
||||
|
@ -772,7 +772,7 @@ int32_t tsdbDisableAndCancelAllBgTask(STsdb *pTsdb) {
|
|||
if (fset->channelOpened) {
|
||||
if (taosArrayPush(channelArray, &fset->channel) == NULL) {
|
||||
taosArrayDestroy(channelArray);
|
||||
taosThreadMutexUnlock(&pTsdb->mutex);
|
||||
(void)taosThreadMutexUnlock(&pTsdb->mutex);
|
||||
return terrno;
|
||||
}
|
||||
fset->channel = (SVAChannelID){0};
|
||||
|
@ -782,7 +782,7 @@ int32_t tsdbDisableAndCancelAllBgTask(STsdb *pTsdb) {
|
|||
}
|
||||
}
|
||||
|
||||
taosThreadMutexUnlock(&pTsdb->mutex);
|
||||
(void)taosThreadMutexUnlock(&pTsdb->mutex);
|
||||
|
||||
// destroy all channels
|
||||
for (int32_t i = 0; i < taosArrayGetSize(channelArray); i++) {
|
||||
|
@ -798,9 +798,9 @@ int32_t tsdbDisableAndCancelAllBgTask(STsdb *pTsdb) {
|
|||
}
|
||||
|
||||
int32_t tsdbEnableBgTask(STsdb *pTsdb) {
|
||||
taosThreadMutexLock(&pTsdb->mutex);
|
||||
(void)taosThreadMutexLock(&pTsdb->mutex);
|
||||
pTsdb->bgTaskDisabled = false;
|
||||
taosThreadMutexUnlock(&pTsdb->mutex);
|
||||
(void)taosThreadMutexUnlock(&pTsdb->mutex);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -814,16 +814,16 @@ int32_t tsdbCloseFS(STFileSystem **fs) {
|
|||
}
|
||||
|
||||
int64_t tsdbFSAllocEid(STFileSystem *fs) {
|
||||
taosThreadMutexLock(&fs->tsdb->mutex);
|
||||
(void)taosThreadMutexLock(&fs->tsdb->mutex);
|
||||
int64_t cid = ++fs->neid;
|
||||
taosThreadMutexUnlock(&fs->tsdb->mutex);
|
||||
(void)taosThreadMutexUnlock(&fs->tsdb->mutex);
|
||||
return cid;
|
||||
}
|
||||
|
||||
void tsdbFSUpdateEid(STFileSystem *fs, int64_t cid) {
|
||||
taosThreadMutexLock(&fs->tsdb->mutex);
|
||||
(void)taosThreadMutexLock(&fs->tsdb->mutex);
|
||||
fs->neid = TMAX(fs->neid, cid);
|
||||
taosThreadMutexUnlock(&fs->tsdb->mutex);
|
||||
(void)taosThreadMutexUnlock(&fs->tsdb->mutex);
|
||||
}
|
||||
|
||||
int32_t tsdbFSEditBegin(STFileSystem *fs, const TFileOpArray *opArray, EFEditT etype) {
|
||||
|
@ -871,7 +871,7 @@ static int32_t tsdbFSSetBlockCommit(STFileSet *fset, bool block) {
|
|||
}
|
||||
|
||||
int32_t tsdbFSCheckCommit(STsdb *tsdb, int32_t fid) {
|
||||
taosThreadMutexLock(&tsdb->mutex);
|
||||
(void)taosThreadMutexLock(&tsdb->mutex);
|
||||
STFileSet *fset;
|
||||
tsdbFSGetFSet(tsdb->pFS, fid, &fset);
|
||||
if (fset) {
|
||||
|
@ -881,7 +881,7 @@ int32_t tsdbFSCheckCommit(STsdb *tsdb, int32_t fid) {
|
|||
fset->numWaitCommit--;
|
||||
}
|
||||
}
|
||||
taosThreadMutexUnlock(&tsdb->mutex);
|
||||
(void)taosThreadMutexUnlock(&tsdb->mutex);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -973,7 +973,7 @@ int32_t tsdbFSCreateCopySnapshot(STFileSystem *fs, TFileSetArray **fsetArr) {
|
|||
|
||||
TARRAY2_INIT(fsetArr[0]);
|
||||
|
||||
taosThreadMutexLock(&fs->tsdb->mutex);
|
||||
(void)taosThreadMutexLock(&fs->tsdb->mutex);
|
||||
TARRAY2_FOREACH(fs->fSetArr, fset) {
|
||||
code = tsdbTFileSetInitCopy(fs->tsdb, fset, &fset1);
|
||||
if (code) break;
|
||||
|
@ -981,7 +981,7 @@ int32_t tsdbFSCreateCopySnapshot(STFileSystem *fs, TFileSetArray **fsetArr) {
|
|||
code = TARRAY2_APPEND(fsetArr[0], fset1);
|
||||
if (code) break;
|
||||
}
|
||||
taosThreadMutexUnlock(&fs->tsdb->mutex);
|
||||
(void)taosThreadMutexUnlock(&fs->tsdb->mutex);
|
||||
|
||||
if (code) {
|
||||
TARRAY2_DESTROY(fsetArr[0], tsdbTFileSetClear);
|
||||
|
@ -1001,9 +1001,9 @@ int32_t tsdbFSDestroyCopySnapshot(TFileSetArray **fsetArr) {
|
|||
}
|
||||
|
||||
int32_t tsdbFSCreateRefSnapshot(STFileSystem *fs, TFileSetArray **fsetArr) {
|
||||
taosThreadMutexLock(&fs->tsdb->mutex);
|
||||
(void)taosThreadMutexLock(&fs->tsdb->mutex);
|
||||
int32_t code = tsdbFSCreateRefSnapshotWithoutLock(fs, fsetArr);
|
||||
taosThreadMutexUnlock(&fs->tsdb->mutex);
|
||||
(void)taosThreadMutexUnlock(&fs->tsdb->mutex);
|
||||
return code;
|
||||
}
|
||||
|
||||
|
@ -1075,7 +1075,7 @@ int32_t tsdbFSCreateCopyRangedSnapshot(STFileSystem *fs, TFileSetRangeArray *pRa
|
|||
}
|
||||
}
|
||||
|
||||
taosThreadMutexLock(&fs->tsdb->mutex);
|
||||
(void)taosThreadMutexLock(&fs->tsdb->mutex);
|
||||
TARRAY2_FOREACH(fs->fSetArr, fset) {
|
||||
int64_t ever = VERSION_MAX;
|
||||
if (pHash) {
|
||||
|
@ -1092,7 +1092,7 @@ int32_t tsdbFSCreateCopyRangedSnapshot(STFileSystem *fs, TFileSetRangeArray *pRa
|
|||
code = TARRAY2_APPEND(fsetArr[0], fset1);
|
||||
if (code) break;
|
||||
}
|
||||
taosThreadMutexUnlock(&fs->tsdb->mutex);
|
||||
(void)taosThreadMutexUnlock(&fs->tsdb->mutex);
|
||||
|
||||
_out:
|
||||
if (code) {
|
||||
|
@ -1131,7 +1131,7 @@ int32_t tsdbFSCreateRefRangedSnapshot(STFileSystem *fs, int64_t sver, int64_t ev
|
|||
}
|
||||
}
|
||||
|
||||
taosThreadMutexLock(&fs->tsdb->mutex);
|
||||
(void)taosThreadMutexLock(&fs->tsdb->mutex);
|
||||
TARRAY2_FOREACH(fs->fSetArr, fset) {
|
||||
int64_t sver1 = sver;
|
||||
int64_t ever1 = ever;
|
||||
|
@ -1160,7 +1160,7 @@ int32_t tsdbFSCreateRefRangedSnapshot(STFileSystem *fs, int64_t sver, int64_t ev
|
|||
|
||||
fsr1 = NULL;
|
||||
}
|
||||
taosThreadMutexUnlock(&fs->tsdb->mutex);
|
||||
(void)taosThreadMutexUnlock(&fs->tsdb->mutex);
|
||||
|
||||
if (code) {
|
||||
tsdbTFileSetRangeClear(&fsr1);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
|
@ -567,7 +567,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 +609,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 +625,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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -230,11 +230,11 @@ int32_t tsdbTFileObjInit(STsdb *pTsdb, const STFile *f, STFileObj **fobj) {
|
|||
return terrno;
|
||||
}
|
||||
|
||||
taosThreadMutexInit(&fobj[0]->mutex, NULL);
|
||||
(void)taosThreadMutexInit(&fobj[0]->mutex, NULL);
|
||||
fobj[0]->f[0] = f[0];
|
||||
fobj[0]->state = TSDB_FSTATE_LIVE;
|
||||
fobj[0]->ref = 1;
|
||||
tsdbTFileName(pTsdb, f, fobj[0]->fname);
|
||||
(void)tsdbTFileName(pTsdb, f, fobj[0]->fname);
|
||||
// fobj[0]->nlevel = tfsGetLevel(pTsdb->pVnode->pTfs);
|
||||
fobj[0]->nlevel = vnodeNodeId(pTsdb->pVnode);
|
||||
return 0;
|
||||
|
@ -242,18 +242,18 @@ int32_t tsdbTFileObjInit(STsdb *pTsdb, const STFile *f, STFileObj **fobj) {
|
|||
|
||||
int32_t tsdbTFileObjRef(STFileObj *fobj) {
|
||||
int32_t nRef;
|
||||
taosThreadMutexLock(&fobj->mutex);
|
||||
(void)(void)taosThreadMutexLock(&fobj->mutex);
|
||||
ASSERT(fobj->ref > 0 && fobj->state == TSDB_FSTATE_LIVE);
|
||||
nRef = ++fobj->ref;
|
||||
taosThreadMutexUnlock(&fobj->mutex);
|
||||
(void)(void)taosThreadMutexUnlock(&fobj->mutex);
|
||||
tsdbTrace("ref file %s, fobj:%p ref %d", fobj->fname, fobj, nRef);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t tsdbTFileObjUnref(STFileObj *fobj) {
|
||||
taosThreadMutexLock(&fobj->mutex);
|
||||
(void)(void)taosThreadMutexLock(&fobj->mutex);
|
||||
int32_t nRef = --fobj->ref;
|
||||
taosThreadMutexUnlock(&fobj->mutex);
|
||||
(void)(void)taosThreadMutexUnlock(&fobj->mutex);
|
||||
ASSERT(nRef >= 0);
|
||||
tsdbTrace("unref file %s, fobj:%p ref %d", fobj->fname, fobj, nRef);
|
||||
if (nRef == 0) {
|
||||
|
@ -318,11 +318,11 @@ static void tsdbTFileObjRemoveLC(STFileObj *fobj, bool remove_all) {
|
|||
}
|
||||
|
||||
int32_t tsdbTFileObjRemove(STFileObj *fobj) {
|
||||
taosThreadMutexLock(&fobj->mutex);
|
||||
(void)taosThreadMutexLock(&fobj->mutex);
|
||||
ASSERT(fobj->state == TSDB_FSTATE_LIVE && fobj->ref > 0);
|
||||
fobj->state = TSDB_FSTATE_DEAD;
|
||||
int32_t nRef = --fobj->ref;
|
||||
taosThreadMutexUnlock(&fobj->mutex);
|
||||
(void)taosThreadMutexUnlock(&fobj->mutex);
|
||||
tsdbTrace("remove unref file %s, fobj:%p ref %d", fobj->fname, fobj, nRef);
|
||||
if (nRef == 0) {
|
||||
tsdbTFileObjRemoveLC(fobj, true);
|
||||
|
@ -332,11 +332,11 @@ int32_t tsdbTFileObjRemove(STFileObj *fobj) {
|
|||
}
|
||||
|
||||
int32_t tsdbTFileObjRemoveUpdateLC(STFileObj *fobj) {
|
||||
taosThreadMutexLock(&fobj->mutex);
|
||||
(void)taosThreadMutexLock(&fobj->mutex);
|
||||
ASSERT(fobj->state == TSDB_FSTATE_LIVE && fobj->ref > 0);
|
||||
fobj->state = TSDB_FSTATE_DEAD;
|
||||
int32_t nRef = --fobj->ref;
|
||||
taosThreadMutexUnlock(&fobj->mutex);
|
||||
(void)taosThreadMutexUnlock(&fobj->mutex);
|
||||
tsdbTrace("remove unref file %s, fobj:%p ref %d", fobj->fname, fobj, nRef);
|
||||
if (nRef == 0) {
|
||||
tsdbTFileObjRemoveLC(fobj, false);
|
||||
|
|
|
@ -153,7 +153,7 @@ static int32_t tsdbDataIterNext(STsdbIter *iter, const TABLEID *tbid) {
|
|||
|
||||
for (; iter->dataData->brinBlockIdx < iter->dataData->brinBlock->numOfRecords; iter->dataData->brinBlockIdx++) {
|
||||
SBrinRecord record[1];
|
||||
tBrinBlockGet(iter->dataData->brinBlock, iter->dataData->brinBlockIdx, record);
|
||||
(void)tBrinBlockGet(iter->dataData->brinBlock, iter->dataData->brinBlockIdx, record);
|
||||
|
||||
if (iter->filterByVersion && (record->maxVer < iter->range[0] || record->minVer > iter->range[1])) {
|
||||
continue;
|
||||
|
@ -254,7 +254,8 @@ _exit:
|
|||
static int32_t tsdbDataTombIterNext(STsdbIter *iter, const TABLEID *tbid) {
|
||||
while (!iter->noMoreData) {
|
||||
for (; iter->dataTomb->tombBlockIdx < TOMB_BLOCK_SIZE(iter->dataTomb->tombBlock); iter->dataTomb->tombBlockIdx++) {
|
||||
tTombBlockGet(iter->dataTomb->tombBlock, iter->dataTomb->tombBlockIdx, iter->record);
|
||||
int32_t code = tTombBlockGet(iter->dataTomb->tombBlock, iter->dataTomb->tombBlockIdx, iter->record);
|
||||
if (code) return code;
|
||||
|
||||
if (iter->filterByVersion && (iter->record->version < iter->range[0] || iter->record->version > iter->range[1])) {
|
||||
continue;
|
||||
|
@ -372,7 +373,7 @@ static int32_t tsdbDataIterOpen(STsdbIter *iter) {
|
|||
iter->dataData->brinBlkArrayIdx = 0;
|
||||
|
||||
// SBrinBlock
|
||||
tBrinBlockInit(iter->dataData->brinBlock);
|
||||
(void)tBrinBlockInit(iter->dataData->brinBlock);
|
||||
iter->dataData->brinBlockIdx = 0;
|
||||
|
||||
// SBlockData
|
||||
|
@ -429,7 +430,7 @@ static int32_t tsdbMemTombIterOpen(STsdbIter *iter) {
|
|||
}
|
||||
|
||||
static int32_t tsdbDataIterClose(STsdbIter *iter) {
|
||||
tBrinBlockDestroy(iter->dataData->brinBlock);
|
||||
(void)tBrinBlockDestroy(iter->dataData->brinBlock);
|
||||
tBlockDataDestroy(iter->dataData->blockData);
|
||||
return 0;
|
||||
}
|
||||
|
@ -439,7 +440,8 @@ static int32_t tsdbMemTableIterClose(STsdbIter *iter) { return 0; }
|
|||
static int32_t tsdbSttTombIterNext(STsdbIter *iter, const TABLEID *tbid) {
|
||||
while (!iter->noMoreData) {
|
||||
for (; iter->sttTomb->tombBlockIdx < TOMB_BLOCK_SIZE(iter->sttTomb->tombBlock); iter->sttTomb->tombBlockIdx++) {
|
||||
tTombBlockGet(iter->sttTomb->tombBlock, iter->sttTomb->tombBlockIdx, iter->record);
|
||||
int32_t code = tTombBlockGet(iter->sttTomb->tombBlock, iter->sttTomb->tombBlockIdx, iter->record);
|
||||
if (code) return code;
|
||||
|
||||
if (iter->filterByVersion && (iter->record->version < iter->range[0] || iter->record->version > iter->range[1])) {
|
||||
continue;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -375,13 +375,13 @@ static int32_t tsdbMergeFileSetEnd(SMerger *merger) {
|
|||
// edit file system
|
||||
TAOS_CHECK_GOTO(tsdbFSEditBegin(merger->tsdb->pFS, merger->fopArr, TSDB_FEDIT_MERGE), &lino, _exit);
|
||||
|
||||
taosThreadMutexLock(&merger->tsdb->mutex);
|
||||
(void)taosThreadMutexLock(&merger->tsdb->mutex);
|
||||
code = tsdbFSEditCommit(merger->tsdb->pFS);
|
||||
if (code) {
|
||||
taosThreadMutexUnlock(&merger->tsdb->mutex);
|
||||
(void)taosThreadMutexUnlock(&merger->tsdb->mutex);
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
}
|
||||
taosThreadMutexUnlock(&merger->tsdb->mutex);
|
||||
(void)taosThreadMutexUnlock(&merger->tsdb->mutex);
|
||||
|
||||
_exit:
|
||||
if (code) {
|
||||
|
@ -478,10 +478,10 @@ _exit:
|
|||
static int32_t tsdbMergeGetFSet(SMerger *merger) {
|
||||
STFileSet *fset;
|
||||
|
||||
taosThreadMutexLock(&merger->tsdb->mutex);
|
||||
(void)taosThreadMutexLock(&merger->tsdb->mutex);
|
||||
tsdbFSGetFSet(merger->tsdb->pFS, merger->fid, &fset);
|
||||
if (fset == NULL) {
|
||||
taosThreadMutexUnlock(&merger->tsdb->mutex);
|
||||
(void)taosThreadMutexUnlock(&merger->tsdb->mutex);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -489,10 +489,10 @@ static int32_t tsdbMergeGetFSet(SMerger *merger) {
|
|||
|
||||
int32_t code = tsdbTFileSetInitCopy(merger->tsdb, fset, &merger->fset);
|
||||
if (code) {
|
||||
taosThreadMutexUnlock(&merger->tsdb->mutex);
|
||||
(void)taosThreadMutexUnlock(&merger->tsdb->mutex);
|
||||
return code;
|
||||
}
|
||||
taosThreadMutexUnlock(&merger->tsdb->mutex);
|
||||
(void)taosThreadMutexUnlock(&merger->tsdb->mutex);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -63,8 +63,8 @@ int32_t tCreateSttBlockLoadInfo(STSchema *pSchema, int16_t *colList, int32_t num
|
|||
return code;
|
||||
}
|
||||
|
||||
static void freeItem(void* pValue) {
|
||||
SValue* p = (SValue*) pValue;
|
||||
static void freeItem(void *pValue) {
|
||||
SValue *p = (SValue *)pValue;
|
||||
if (IS_VAR_DATA_TYPE(p->type)) {
|
||||
taosMemoryFree(p->pData);
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ void destroySttBlockReader(SArray *pLDataIterArray, SSttBlockLoadCostInfo *pLoad
|
|||
continue;
|
||||
}
|
||||
|
||||
SSttBlockLoadCostInfo* pCost = &pIter->pBlockLoadInfo->cost;
|
||||
SSttBlockLoadCostInfo *pCost = &pIter->pBlockLoadInfo->cost;
|
||||
if (pLoadCost != NULL) {
|
||||
pLoadCost->loadBlocks += pCost->loadBlocks;
|
||||
pLoadCost->loadStatisBlocks += pCost->loadStatisBlocks;
|
||||
|
@ -380,7 +380,7 @@ static int32_t loadSttStatisticsBlockData(SSttFileReader *pSttFileReader, SSttBl
|
|||
pBlockLoadInfo->cost.loadStatisBlocks += num;
|
||||
|
||||
STbStatisBlock block;
|
||||
tStatisBlockInit(&block);
|
||||
TAOS_UNUSED(tStatisBlockInit(&block));
|
||||
|
||||
int64_t st = taosGetTimestampUs();
|
||||
|
||||
|
@ -436,7 +436,7 @@ static int32_t loadSttStatisticsBlockData(SSttFileReader *pSttFileReader, SSttBl
|
|||
}
|
||||
} else {
|
||||
SValue vFirst = {0};
|
||||
for(int32_t j = 0; j < size; ++j) {
|
||||
for (int32_t j = 0; j < size; ++j) {
|
||||
taosArrayPush(pBlockLoadInfo->info.pFirstKey, &vFirst);
|
||||
taosArrayPush(pBlockLoadInfo->info.pLastKey, &vFirst);
|
||||
}
|
||||
|
@ -445,7 +445,7 @@ static int32_t loadSttStatisticsBlockData(SSttFileReader *pSttFileReader, SSttBl
|
|||
STbStatisRecord record = {0};
|
||||
|
||||
while (i < rows) {
|
||||
tStatisBlockGet(&block, i, &record);
|
||||
(void)tStatisBlockGet(&block, i, &record);
|
||||
if (record.suid != suid) {
|
||||
break;
|
||||
}
|
||||
|
@ -476,7 +476,7 @@ static int32_t loadSttStatisticsBlockData(SSttFileReader *pSttFileReader, SSttBl
|
|||
}
|
||||
}
|
||||
|
||||
tStatisBlockDestroy(&block);
|
||||
(void)tStatisBlockDestroy(&block);
|
||||
|
||||
double el = (taosGetTimestampUs() - st) / 1000.0;
|
||||
pBlockLoadInfo->cost.statisElapsedTime += el;
|
||||
|
|
|
@ -105,10 +105,10 @@ int32_t tsdbClose(STsdb **pTsdb) {
|
|||
tsdbDebug("vgId:%d, tsdb is close at %s, days:%d, keep:%d,%d,%d, keepTimeOffset:%d", TD_VID(pdb->pVnode), pdb->path,
|
||||
pdb->keepCfg.days, pdb->keepCfg.keep0, pdb->keepCfg.keep1, pdb->keepCfg.keep2,
|
||||
pdb->keepCfg.keepTimeOffset);
|
||||
taosThreadMutexLock(&(*pTsdb)->mutex);
|
||||
(void)taosThreadMutexLock(&(*pTsdb)->mutex);
|
||||
tsdbMemTableDestroy((*pTsdb)->mem, true);
|
||||
(*pTsdb)->mem = NULL;
|
||||
taosThreadMutexUnlock(&(*pTsdb)->mutex);
|
||||
(void)taosThreadMutexUnlock(&(*pTsdb)->mutex);
|
||||
|
||||
tsdbCloseFS(&(*pTsdb)->pFS);
|
||||
tsdbCloseCache(*pTsdb);
|
||||
|
|
|
@ -209,15 +209,15 @@ static int32_t tsdbDoRetentionEnd(SRTNer *rtner) {
|
|||
if (TARRAY2_SIZE(&rtner->fopArr) > 0) {
|
||||
TAOS_CHECK_GOTO(tsdbFSEditBegin(rtner->tsdb->pFS, &rtner->fopArr, TSDB_FEDIT_RETENTION), &lino, _exit);
|
||||
|
||||
taosThreadMutexLock(&rtner->tsdb->mutex);
|
||||
(void)taosThreadMutexLock(&rtner->tsdb->mutex);
|
||||
|
||||
code = tsdbFSEditCommit(rtner->tsdb->pFS);
|
||||
if (code) {
|
||||
taosThreadMutexUnlock(&rtner->tsdb->mutex);
|
||||
(void)taosThreadMutexUnlock(&rtner->tsdb->mutex);
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
}
|
||||
|
||||
taosThreadMutexUnlock(&rtner->tsdb->mutex);
|
||||
(void)taosThreadMutexUnlock(&rtner->tsdb->mutex);
|
||||
|
||||
TARRAY2_DESTROY(&rtner->fopArr, NULL);
|
||||
}
|
||||
|
@ -315,13 +315,13 @@ static int32_t tsdbRetention(void *arg) {
|
|||
};
|
||||
|
||||
// begin task
|
||||
taosThreadMutexLock(&pTsdb->mutex);
|
||||
(void)taosThreadMutexLock(&pTsdb->mutex);
|
||||
tsdbBeginTaskOnFileSet(pTsdb, rtnArg->fid, &fset);
|
||||
if (fset && (code = tsdbTFileSetInitCopy(pTsdb, fset, &rtner.fset))) {
|
||||
taosThreadMutexUnlock(&pTsdb->mutex);
|
||||
(void)taosThreadMutexUnlock(&pTsdb->mutex);
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
}
|
||||
taosThreadMutexUnlock(&pTsdb->mutex);
|
||||
(void)taosThreadMutexUnlock(&pTsdb->mutex);
|
||||
|
||||
// do retention
|
||||
if (rtner.fset) {
|
||||
|
@ -336,9 +336,9 @@ static int32_t tsdbRetention(void *arg) {
|
|||
|
||||
_exit:
|
||||
if (rtner.fset) {
|
||||
taosThreadMutexLock(&pTsdb->mutex);
|
||||
(void)taosThreadMutexLock(&pTsdb->mutex);
|
||||
tsdbFinishTaskOnFileSet(pTsdb, rtnArg->fid);
|
||||
taosThreadMutexUnlock(&pTsdb->mutex);
|
||||
(void)taosThreadMutexUnlock(&pTsdb->mutex);
|
||||
}
|
||||
|
||||
// clear resources
|
||||
|
@ -387,9 +387,9 @@ _exit:
|
|||
|
||||
int32_t tsdbAsyncRetention(STsdb *tsdb, int64_t now) {
|
||||
int32_t code = 0;
|
||||
taosThreadMutexLock(&tsdb->mutex);
|
||||
(void)taosThreadMutexLock(&tsdb->mutex);
|
||||
code = tsdbAsyncRetentionImpl(tsdb, now, false);
|
||||
taosThreadMutexUnlock(&tsdb->mutex);
|
||||
(void)taosThreadMutexUnlock(&tsdb->mutex);
|
||||
return code;
|
||||
}
|
||||
|
||||
|
@ -735,9 +735,9 @@ int32_t tsdbAsyncS3Migrate(STsdb *tsdb, int64_t now) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
taosThreadMutexLock(&tsdb->mutex);
|
||||
(void)taosThreadMutexLock(&tsdb->mutex);
|
||||
code = tsdbAsyncRetentionImpl(tsdb, now, true);
|
||||
taosThreadMutexUnlock(&tsdb->mutex);
|
||||
(void)taosThreadMutexUnlock(&tsdb->mutex);
|
||||
|
||||
if (code) {
|
||||
tsdbError("vgId:%d, %s failed, reason:%s", TD_VID(tsdb->pVnode), __func__, tstrerror(code));
|
||||
|
|
|
@ -351,7 +351,7 @@ static STsdbFSetPartList* tsdbSnapGetFSetPartList(STFileSystem* fs) {
|
|||
}
|
||||
|
||||
int32_t code = 0;
|
||||
taosThreadMutexLock(&fs->tsdb->mutex);
|
||||
(void)taosThreadMutexLock(&fs->tsdb->mutex);
|
||||
STFileSet* fset;
|
||||
TARRAY2_FOREACH(fs->fSetArr, fset) {
|
||||
STsdbFSetPartition* pItem = NULL;
|
||||
|
@ -364,7 +364,7 @@ static STsdbFSetPartList* tsdbSnapGetFSetPartList(STFileSystem* fs) {
|
|||
code = TARRAY2_SORT_INSERT(pList, pItem, tsdbFSetPartCmprFn);
|
||||
ASSERT(code == 0);
|
||||
}
|
||||
taosThreadMutexUnlock(&fs->tsdb->mutex);
|
||||
(void)taosThreadMutexUnlock(&fs->tsdb->mutex);
|
||||
|
||||
if (code) {
|
||||
TARRAY2_DESTROY(pList, tsdbFSetPartitionClear);
|
||||
|
|
|
@ -1022,7 +1022,8 @@ static int32_t tsdbSnapWriteTombData(STsdbSnapWriter* writer, SSnapDataHdr* hdr)
|
|||
code = tsdbSnapWriteDecmprTombBlock(hdr, tombBlock);
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
|
||||
tTombBlockGet(tombBlock, 0, &record);
|
||||
code = tTombBlockGet(tombBlock, 0, &record);
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
int32_t fid = tsdbKeyFid(record.skey, writer->minutes, writer->precision);
|
||||
if (!writer->ctx->fsetWriteBegin || fid != writer->ctx->fid) {
|
||||
code = tsdbSnapWriteFileSetEnd(writer);
|
||||
|
@ -1045,7 +1046,8 @@ static int32_t tsdbSnapWriteTombData(STsdbSnapWriter* writer, SSnapDataHdr* hdr)
|
|||
ASSERT(writer->ctx->hasData == false);
|
||||
|
||||
for (int32_t i = 0; i < TOMB_BLOCK_SIZE(tombBlock); ++i) {
|
||||
tTombBlockGet(tombBlock, i, &record);
|
||||
code = tTombBlockGet(tombBlock, i, &record);
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
|
||||
code = tsdbSnapWriteTombRecord(writer, &record);
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
|
@ -1125,17 +1127,17 @@ int32_t tsdbSnapWriterClose(STsdbSnapWriter** writer, int8_t rollback) {
|
|||
code = tsdbFSEditAbort(writer[0]->tsdb->pFS);
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
} else {
|
||||
taosThreadMutexLock(&writer[0]->tsdb->mutex);
|
||||
(void)taosThreadMutexLock(&writer[0]->tsdb->mutex);
|
||||
|
||||
code = tsdbFSEditCommit(writer[0]->tsdb->pFS);
|
||||
if (code) {
|
||||
taosThreadMutexUnlock(&writer[0]->tsdb->mutex);
|
||||
(void)taosThreadMutexUnlock(&writer[0]->tsdb->mutex);
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
}
|
||||
|
||||
writer[0]->tsdb->pFS->fsstate = TSDB_FS_STATE_NORMAL;
|
||||
|
||||
taosThreadMutexUnlock(&writer[0]->tsdb->mutex);
|
||||
(void)taosThreadMutexUnlock(&writer[0]->tsdb->mutex);
|
||||
}
|
||||
|
||||
tsdbIterMergerClose(&writer[0]->ctx->tombIterMerger);
|
||||
|
|
|
@ -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);
|
||||
|
@ -485,21 +485,21 @@ int32_t tsdbSnapRAWWriterClose(STsdbSnapRAWWriter** writer, int8_t rollback) {
|
|||
code = tsdbFSEditAbort(writer[0]->tsdb->pFS);
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
} else {
|
||||
taosThreadMutexLock(&writer[0]->tsdb->mutex);
|
||||
(void)taosThreadMutexLock(&writer[0]->tsdb->mutex);
|
||||
|
||||
code = tsdbFSEditCommit(writer[0]->tsdb->pFS);
|
||||
if (code) {
|
||||
taosThreadMutexUnlock(&writer[0]->tsdb->mutex);
|
||||
(void)taosThreadMutexUnlock(&writer[0]->tsdb->mutex);
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
}
|
||||
|
||||
writer[0]->tsdb->pFS->fsstate = TSDB_FS_STATE_NORMAL;
|
||||
|
||||
taosThreadMutexUnlock(&writer[0]->tsdb->mutex);
|
||||
(void)taosThreadMutexUnlock(&writer[0]->tsdb->mutex);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
@ -401,7 +401,7 @@ int32_t tsdbSttFileReadStatisBlock(SSttFileReader *reader, const SStatisBlk *sta
|
|||
&lino, _exit);
|
||||
|
||||
// decode data
|
||||
tStatisBlockClear(statisBlock);
|
||||
TAOS_UNUSED(tStatisBlockClear(statisBlock));
|
||||
statisBlock->numOfPKs = statisBlk->numOfPKs;
|
||||
statisBlock->numOfRecords = statisBlk->numRec;
|
||||
SBufferReader br = BUFFER_READER_INITIALIZER(0, buffer0);
|
||||
|
@ -574,11 +574,11 @@ static int32_t tsdbSttFileDoWriteStatisBlock(SSttFileWriter *writer) {
|
|||
statisBlk.cmprAlg = writer->config->cmprAlg;
|
||||
statisBlk.numOfPKs = statisBlock->numOfPKs;
|
||||
|
||||
tStatisBlockGet(statisBlock, 0, &record);
|
||||
(void)tStatisBlockGet(statisBlock, 0, &record);
|
||||
statisBlk.minTbid.suid = record.suid;
|
||||
statisBlk.minTbid.uid = record.uid;
|
||||
|
||||
tStatisBlockGet(statisBlock, statisBlock->numOfRecords - 1, &record);
|
||||
(void)tStatisBlockGet(statisBlock, statisBlock->numOfRecords - 1, &record);
|
||||
statisBlk.maxTbid.suid = record.suid;
|
||||
statisBlk.maxTbid.uid = record.uid;
|
||||
|
||||
|
@ -636,7 +636,7 @@ static int32_t tsdbSttFileDoWriteStatisBlock(SSttFileWriter *writer) {
|
|||
|
||||
TAOS_CHECK_GOTO(TARRAY2_APPEND_PTR(writer->statisBlkArray, &statisBlk), &lino, _exit);
|
||||
|
||||
tStatisBlockClear(writer->staticBlock);
|
||||
TAOS_UNUSED(tStatisBlockClear(writer->staticBlock));
|
||||
|
||||
_exit:
|
||||
if (code) {
|
||||
|
@ -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};
|
||||
|
@ -822,7 +822,7 @@ static void tsdbSttFWriterDoClose(SSttFileWriter *writer) {
|
|||
tDestroyTSchema(writer->skmRow->pTSchema);
|
||||
tDestroyTSchema(writer->skmTb->pTSchema);
|
||||
tTombBlockDestroy(writer->tombBlock);
|
||||
tStatisBlockDestroy(writer->staticBlock);
|
||||
(void)tStatisBlockDestroy(writer->staticBlock);
|
||||
tBlockDataDestroy(writer->blockData);
|
||||
TARRAY2_DESTROY(writer->tombBlkArray, NULL);
|
||||
TARRAY2_DESTROY(writer->statisBlkArray, NULL);
|
||||
|
@ -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;
|
||||
|
|
|
@ -167,7 +167,7 @@ _exit:
|
|||
tsdbError("vgId:%d %s failed at %s:%d since %s", TD_VID(tsdb->pVnode), __func__, __FILE__, lino, tstrerror(code));
|
||||
}
|
||||
TARRAY2_DESTROY(ctx->brinBlkArray, NULL);
|
||||
tBrinBlockDestroy(ctx->brinBlock);
|
||||
(void)tBrinBlockDestroy(ctx->brinBlock);
|
||||
tBlockDataDestroy(ctx->blockData);
|
||||
tMapDataClear(ctx->mDataBlk);
|
||||
taosArrayDestroy(ctx->aBlockIdx);
|
||||
|
|
|
@ -16,35 +16,26 @@
|
|||
#include "tsdbUtil2.h"
|
||||
|
||||
// SDelBlock ----------
|
||||
int32_t tTombBlockInit(STombBlock *tombBlock) {
|
||||
int32_t code;
|
||||
|
||||
void tTombBlockInit(STombBlock *tombBlock) {
|
||||
tombBlock->numOfRecords = 0;
|
||||
for (int32_t i = 0; i < TOMB_RECORD_ELEM_NUM; ++i) {
|
||||
TAOS_CHECK_GOTO(tBufferInit(&tombBlock->buffers[i]), NULL, _exit);
|
||||
tBufferInit(&tombBlock->buffers[i]);
|
||||
}
|
||||
|
||||
_exit:
|
||||
if (code) {
|
||||
TAOS_UNUSED(tTombBlockDestroy(tombBlock));
|
||||
}
|
||||
return code;
|
||||
return;
|
||||
}
|
||||
|
||||
int32_t tTombBlockDestroy(STombBlock *tombBlock) {
|
||||
void tTombBlockDestroy(STombBlock *tombBlock) {
|
||||
tombBlock->numOfRecords = 0;
|
||||
for (int32_t i = 0; i < TOMB_RECORD_ELEM_NUM; ++i) {
|
||||
TAOS_UNUSED(tBufferDestroy(&tombBlock->buffers[i]));
|
||||
tBufferDestroy(&tombBlock->buffers[i]);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t tTombBlockClear(STombBlock *tombBlock) {
|
||||
void tTombBlockClear(STombBlock *tombBlock) {
|
||||
tombBlock->numOfRecords = 0;
|
||||
for (int32_t i = 0; i < TOMB_RECORD_ELEM_NUM; ++i) {
|
||||
TAOS_UNUSED(tBufferClear(&tombBlock->buffers[i]));
|
||||
tBufferClear(&tombBlock->buffers[i]);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t tTombBlockPut(STombBlock *tombBlock, const STombRecord *record) {
|
||||
|
@ -79,12 +70,12 @@ int32_t tTombRecordCompare(const STombRecord *r1, const STombRecord *r2) {
|
|||
|
||||
// STbStatisBlock ----------
|
||||
int32_t tStatisBlockInit(STbStatisBlock *statisBlock) {
|
||||
int32_t code;
|
||||
int32_t code = 0;
|
||||
|
||||
statisBlock->numOfPKs = 0;
|
||||
statisBlock->numOfRecords = 0;
|
||||
for (int32_t i = 0; i < ARRAY_SIZE(statisBlock->buffers); ++i) {
|
||||
TAOS_CHECK_GOTO(tBufferInit(&statisBlock->buffers[i]), NULL, _exit);
|
||||
tBufferInit(&statisBlock->buffers[i]);
|
||||
}
|
||||
for (int32_t i = 0; i < TD_MAX_PK_COLS; ++i) {
|
||||
TAOS_CHECK_GOTO(tValueColumnInit(&statisBlock->firstKeyPKs[i]), NULL, _exit);
|
||||
|
@ -244,7 +235,7 @@ int32_t tBrinBlockInit(SBrinBlock *brinBlock) {
|
|||
brinBlock->numOfPKs = 0;
|
||||
brinBlock->numOfRecords = 0;
|
||||
for (int32_t i = 0; i < ARRAY_SIZE(brinBlock->buffers); ++i) {
|
||||
TAOS_CHECK_GOTO(tBufferInit(&brinBlock->buffers[i]), NULL, _exit);
|
||||
tBufferInit(&brinBlock->buffers[i]);
|
||||
}
|
||||
for (int32_t i = 0; i < TD_MAX_PK_COLS; ++i) {
|
||||
TAOS_CHECK_GOTO(tValueColumnInit(&brinBlock->firstKeyPKs[i]), NULL, _exit);
|
||||
|
@ -253,7 +244,7 @@ int32_t tBrinBlockInit(SBrinBlock *brinBlock) {
|
|||
|
||||
_exit:
|
||||
if (code) {
|
||||
TAOS_UNUSED(tBrinBlockDestroy(brinBlock));
|
||||
(void)tBrinBlockDestroy(brinBlock);
|
||||
}
|
||||
return code;
|
||||
}
|
||||
|
|
|
@ -65,9 +65,9 @@ typedef TARRAY2(STombBlk) TTombBlkArray;
|
|||
|
||||
#define TOMB_BLOCK_SIZE(db) ((db)->numOfRecords)
|
||||
|
||||
int32_t tTombBlockInit(STombBlock *tombBlock);
|
||||
int32_t tTombBlockDestroy(STombBlock *tombBlock);
|
||||
int32_t tTombBlockClear(STombBlock *tombBlock);
|
||||
void tTombBlockInit(STombBlock *tombBlock);
|
||||
void tTombBlockDestroy(STombBlock *tombBlock);
|
||||
void tTombBlockClear(STombBlock *tombBlock);
|
||||
int32_t tTombBlockPut(STombBlock *tombBlock, const STombRecord *record);
|
||||
int32_t tTombBlockGet(STombBlock *tombBlock, int32_t idx, STombRecord *record);
|
||||
int32_t tTombRecordCompare(const STombRecord *record1, const STombRecord *record2);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -213,22 +213,22 @@ static void *vnodeAsyncLoop(void *arg) {
|
|||
setThreadName(async->label);
|
||||
|
||||
for (;;) {
|
||||
taosThreadMutexLock(&async->mutex);
|
||||
(void)taosThreadMutexLock(&async->mutex);
|
||||
|
||||
// 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--;
|
||||
taosThreadMutexUnlock(&async->mutex);
|
||||
(void)taosThreadMutexUnlock(&async->mutex);
|
||||
goto _exit;
|
||||
}
|
||||
|
||||
|
@ -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 {
|
||||
|
@ -268,10 +268,10 @@ static void *vnodeAsyncLoop(void *arg) {
|
|||
}
|
||||
}
|
||||
|
||||
taosThreadMutexUnlock(&async->mutex);
|
||||
(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;
|
||||
}
|
||||
|
@ -387,22 +387,22 @@ static int32_t vnodeAsyncDestroy(SVAsync **async) {
|
|||
}
|
||||
|
||||
// set stop and broadcast
|
||||
taosThreadMutexLock(&(*async)->mutex);
|
||||
(void)taosThreadMutexLock(&(*async)->mutex);
|
||||
(*async)->stop = true;
|
||||
taosThreadCondBroadcast(&(*async)->hasTask);
|
||||
taosThreadMutexUnlock(&(*async)->mutex);
|
||||
(void)taosThreadMutexUnlock(&(*async)->mutex);
|
||||
|
||||
// join all workers
|
||||
for (int32_t i = 0; i < VNODE_ASYNC_MAX_WORKERS; i++) {
|
||||
taosThreadMutexLock(&(*async)->mutex);
|
||||
(void)taosThreadMutexLock(&(*async)->mutex);
|
||||
EVWorkerState state = (*async)->workers[i].state;
|
||||
taosThreadMutexUnlock(&(*async)->mutex);
|
||||
(void)taosThreadMutexUnlock(&(*async)->mutex);
|
||||
|
||||
if (state == EVA_WORKER_STATE_UINIT) {
|
||||
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,10 +501,10 @@ 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
|
||||
taosThreadMutexLock(&async->mutex);
|
||||
(void)taosThreadMutexLock(&async->mutex);
|
||||
|
||||
if (channelID->id == 0) {
|
||||
task->channel = NULL;
|
||||
|
@ -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) {
|
||||
taosThreadMutexUnlock(&async->mutex);
|
||||
taosThreadCondDestroy(&task->waitCond);
|
||||
(void)taosThreadMutexUnlock(&async->mutex);
|
||||
(void)taosThreadCondDestroy(&task->waitCond);
|
||||
taosMemoryFree(task);
|
||||
return TSDB_CODE_INVALID_PARA;
|
||||
}
|
||||
|
@ -526,8 +526,8 @@ int32_t vnodeAsync(SVAChannelID *channelID, EVAPriority priority, int32_t (*exec
|
|||
// add task to hash table
|
||||
int32_t ret = vHashPut(async->taskTable, task);
|
||||
if (ret != 0) {
|
||||
taosThreadMutexUnlock(&async->mutex);
|
||||
taosThreadCondDestroy(&task->waitCond);
|
||||
(void)taosThreadMutexUnlock(&async->mutex);
|
||||
(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)) {
|
||||
|
@ -580,7 +580,7 @@ int32_t vnodeAsync(SVAChannelID *channelID, EVAPriority priority, int32_t (*exec
|
|||
task->prev->next = task;
|
||||
}
|
||||
|
||||
taosThreadMutexUnlock(&async->mutex);
|
||||
(void)taosThreadMutexUnlock(&async->mutex);
|
||||
|
||||
if (taskID != NULL) {
|
||||
taskID->async = channelID->async;
|
||||
|
@ -601,21 +601,21 @@ int32_t vnodeAWait(SVATaskID *taskID) {
|
|||
.taskId = taskID->id,
|
||||
};
|
||||
|
||||
taosThreadMutexLock(&async->mutex);
|
||||
(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);
|
||||
}
|
||||
}
|
||||
|
||||
taosThreadMutexUnlock(&async->mutex);
|
||||
(void)taosThreadMutexUnlock(&async->mutex);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -634,22 +634,22 @@ int32_t vnodeACancel(SVATaskID *taskID) {
|
|||
void (*cancel)(void *) = NULL;
|
||||
void *arg = NULL;
|
||||
|
||||
taosThreadMutexLock(&async->mutex);
|
||||
(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;
|
||||
}
|
||||
}
|
||||
|
||||
taosThreadMutexUnlock(&async->mutex);
|
||||
(void)taosThreadMutexUnlock(&async->mutex);
|
||||
|
||||
if (cancel) {
|
||||
cancel(arg);
|
||||
|
@ -663,12 +663,12 @@ int32_t vnodeAsyncSetWorkers(int64_t asyncID, int32_t numWorkers) {
|
|||
return TSDB_CODE_INVALID_PARA;
|
||||
}
|
||||
SVAsync *async = vnodeAsyncs[asyncID];
|
||||
taosThreadMutexLock(&async->mutex);
|
||||
(void)taosThreadMutexLock(&async->mutex);
|
||||
async->numWorkers = numWorkers;
|
||||
if (async->numIdleWorkers > 0) {
|
||||
taosThreadCondBroadcast(&async->hasTask);
|
||||
}
|
||||
taosThreadMutexUnlock(&async->mutex);
|
||||
(void)taosThreadMutexUnlock(&async->mutex);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -693,14 +693,14 @@ int32_t vnodeAChannelInit(int64_t asyncID, SVAChannelID *channelID) {
|
|||
channel->scheduled = NULL;
|
||||
|
||||
// register channel
|
||||
taosThreadMutexLock(&async->mutex);
|
||||
(void)taosThreadMutexLock(&async->mutex);
|
||||
|
||||
channel->channelId = channelID->id = ++async->nextChannelId;
|
||||
|
||||
// add to hash table
|
||||
int32_t ret = vHashPut(async->channelTable, channel);
|
||||
if (ret != 0) {
|
||||
taosThreadMutexUnlock(&async->mutex);
|
||||
(void)taosThreadMutexUnlock(&async->mutex);
|
||||
taosMemoryFree(channel);
|
||||
return ret;
|
||||
}
|
||||
|
@ -713,7 +713,7 @@ int32_t vnodeAChannelInit(int64_t asyncID, SVAChannelID *channelID) {
|
|||
|
||||
async->numChannels++;
|
||||
|
||||
taosThreadMutexUnlock(&async->mutex);
|
||||
(void)taosThreadMutexUnlock(&async->mutex);
|
||||
|
||||
channelID->async = asyncID;
|
||||
return 0;
|
||||
|
@ -734,14 +734,14 @@ int32_t vnodeAChannelDestroy(SVAChannelID *channelID, bool waitRunning) {
|
|||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
taosThreadMutexLock(&async->mutex);
|
||||
(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);
|
||||
}
|
||||
|
||||
|
@ -793,7 +793,7 @@ int32_t vnodeAChannelDestroy(SVAChannelID *channelID, bool waitRunning) {
|
|||
}
|
||||
}
|
||||
|
||||
taosThreadMutexUnlock(&async->mutex);
|
||||
(void)taosThreadMutexUnlock(&async->mutex);
|
||||
for (int32_t i = 0; i < taosArrayGetSize(cancelArray); i++) {
|
||||
SVATaskCancelInfo *cancel = (SVATaskCancelInfo *)taosArrayGet(cancelArray, i);
|
||||
cancel->cancel(cancel->arg);
|
||||
|
|
|
@ -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) {
|
||||
|
@ -242,7 +242,9 @@ void vnodeBufPoolUnRef(SVBufPool *pPool, bool proactive) {
|
|||
|
||||
SVnode *pVnode = pPool->pVnode;
|
||||
|
||||
if (proactive) taosThreadMutexLock(&pVnode->mutex);
|
||||
if (proactive) {
|
||||
(void)taosThreadMutexLock(&pVnode->mutex);
|
||||
}
|
||||
|
||||
if (atomic_sub_fetch_32(&pPool->nRef, 1) > 0) goto _exit;
|
||||
|
||||
|
@ -267,12 +269,14 @@ void vnodeBufPoolUnRef(SVBufPool *pPool, bool proactive) {
|
|||
vnodeBufPoolAddToFreeList(pPool);
|
||||
|
||||
_exit:
|
||||
if (proactive) taosThreadMutexUnlock(&pVnode->mutex);
|
||||
if (proactive) {
|
||||
(void)taosThreadMutexUnlock(&pVnode->mutex);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
int32_t vnodeBufPoolRegisterQuery(SVBufPool *pPool, SQueryNode *pQNode) {
|
||||
taosThreadMutexLock(&pPool->mutex);
|
||||
(void)taosThreadMutexLock(&pPool->mutex);
|
||||
|
||||
pQNode->pNext = pPool->qList.pNext;
|
||||
pQNode->ppNext = &pPool->qList.pNext;
|
||||
|
@ -280,20 +284,24 @@ int32_t vnodeBufPoolRegisterQuery(SVBufPool *pPool, SQueryNode *pQNode) {
|
|||
pPool->qList.pNext = pQNode;
|
||||
pPool->nQuery++;
|
||||
|
||||
taosThreadMutexUnlock(&pPool->mutex);
|
||||
(void)taosThreadMutexUnlock(&pPool->mutex);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void vnodeBufPoolDeregisterQuery(SVBufPool *pPool, SQueryNode *pQNode, bool proactive) {
|
||||
int32_t code = 0;
|
||||
|
||||
if (proactive) taosThreadMutexLock(&pPool->mutex);
|
||||
if (proactive) {
|
||||
(void)taosThreadMutexLock(&pPool->mutex);
|
||||
}
|
||||
|
||||
pQNode->pNext->ppNext = pQNode->ppNext;
|
||||
*pQNode->ppNext = pQNode->pNext;
|
||||
pPool->nQuery--;
|
||||
|
||||
if (proactive) taosThreadMutexUnlock(&pPool->mutex);
|
||||
if (proactive) {
|
||||
(void)taosThreadMutexUnlock(&pPool->mutex);
|
||||
}
|
||||
}
|
||||
|
||||
int32_t vnodeBufPoolRecycle(SVBufPool *pPool) {
|
||||
|
@ -303,7 +311,7 @@ int32_t vnodeBufPoolRecycle(SVBufPool *pPool) {
|
|||
|
||||
vDebug("vgId:%d, recycle buffer pool %p of id %d", TD_VID(pVnode), pPool, pPool->id);
|
||||
|
||||
taosThreadMutexLock(&pPool->mutex);
|
||||
(void)taosThreadMutexLock(&pPool->mutex);
|
||||
|
||||
SQueryNode *pNode = pPool->qList.pNext;
|
||||
while (pNode != &pPool->qList) {
|
||||
|
@ -319,6 +327,6 @@ int32_t vnodeBufPoolRecycle(SVBufPool *pPool) {
|
|||
}
|
||||
|
||||
_exit:
|
||||
taosThreadMutexUnlock(&pPool->mutex);
|
||||
(void)taosThreadMutexUnlock(&pPool->mutex);
|
||||
return code;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -65,7 +65,7 @@ static int32_t vnodeGetBufPoolToUse(SVnode *pVnode) {
|
|||
int32_t code = 0;
|
||||
int32_t lino = 0;
|
||||
|
||||
taosThreadMutexLock(&pVnode->mutex);
|
||||
(void)taosThreadMutexLock(&pVnode->mutex);
|
||||
|
||||
int32_t nTry = 0;
|
||||
for (;;) {
|
||||
|
@ -91,7 +91,7 @@ static int32_t vnodeGetBufPoolToUse(SVnode *pVnode) {
|
|||
|
||||
struct timeval tv;
|
||||
struct timespec ts;
|
||||
taosGetTimeOfDay(&tv);
|
||||
(void)taosGetTimeOfDay(&tv);
|
||||
ts.tv_nsec = tv.tv_usec * 1000 + WAIT_TIME_MILI_SEC * 1000000;
|
||||
if (ts.tv_nsec > 999999999l) {
|
||||
ts.tv_sec = tv.tv_sec + 1;
|
||||
|
@ -110,7 +110,7 @@ static int32_t vnodeGetBufPoolToUse(SVnode *pVnode) {
|
|||
}
|
||||
|
||||
_exit:
|
||||
taosThreadMutexUnlock(&pVnode->mutex);
|
||||
(void)taosThreadMutexUnlock(&pVnode->mutex);
|
||||
if (code) {
|
||||
vError("vgId:%d, %s failed at line %d since %s", TD_VID(pVnode), __func__, lino, tstrerror(code));
|
||||
}
|
||||
|
@ -150,7 +150,7 @@ int vnodeShouldCommit(SVnode *pVnode, bool atExit) {
|
|||
bool diskAvail = osDataSpaceAvailable();
|
||||
bool needCommit = false;
|
||||
|
||||
taosThreadMutexLock(&pVnode->mutex);
|
||||
(void)taosThreadMutexLock(&pVnode->mutex);
|
||||
if (pVnode->inUse && diskAvail) {
|
||||
needCommit = (pVnode->inUse->size > pVnode->inUse->node.size) ||
|
||||
(atExit && (pVnode->inUse->size > 0 || pVnode->pMeta->changed ||
|
||||
|
@ -162,7 +162,7 @@ int vnodeShouldCommit(SVnode *pVnode, bool atExit) {
|
|||
TD_VID(pVnode), needCommit, diskAvail, pVnode->inUse ? pVnode->inUse->size : 0,
|
||||
pVnode->inUse ? pVnode->inUse->node.size : 0, pVnode->pMeta->changed, pVnode->state.applied,
|
||||
pVnode->state.committed);
|
||||
taosThreadMutexUnlock(&pVnode->mutex);
|
||||
(void)taosThreadMutexUnlock(&pVnode->mutex);
|
||||
return needCommit;
|
||||
}
|
||||
|
||||
|
@ -199,7 +199,7 @@ _exit:
|
|||
vInfo("vgId:%d, vnode info is saved, fname:%s replica:%d selfIndex:%d changeVersion:%d", pInfo->config.vgId, fname,
|
||||
pInfo->config.syncCfg.replicaNum, pInfo->config.syncCfg.myIndex, pInfo->config.syncCfg.changeVersion);
|
||||
}
|
||||
taosCloseFile(&pFile);
|
||||
(void)taosCloseFile(&pFile);
|
||||
taosMemoryFree(data);
|
||||
return code;
|
||||
}
|
||||
|
@ -259,7 +259,7 @@ _exit:
|
|||
vError("vgId:%d %s failed at %s:%d since %s", pInfo->config.vgId, __func__, __FILE__, lino, tstrerror(code));
|
||||
}
|
||||
taosMemoryFree(pData);
|
||||
taosCloseFile(&pFile);
|
||||
(void)taosCloseFile(&pFile);
|
||||
return code;
|
||||
}
|
||||
|
||||
|
@ -270,7 +270,7 @@ static int32_t vnodePrepareCommit(SVnode *pVnode, SCommitInfo *pInfo) {
|
|||
int64_t lastCommitted = pInfo->info.state.committed;
|
||||
|
||||
// wait last commit task
|
||||
vnodeAWait(&pVnode->commitTask);
|
||||
(void)vnodeAWait(&pVnode->commitTask);
|
||||
|
||||
code = syncNodeGetConfig(pVnode->sync, &pVnode->config.syncCfg);
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
|
@ -285,7 +285,7 @@ static int32_t vnodePrepareCommit(SVnode *pVnode, SCommitInfo *pInfo) {
|
|||
pInfo->txn = metaGetTxn(pVnode->pMeta);
|
||||
|
||||
// save info
|
||||
vnodeGetPrimaryDir(pVnode->path, pVnode->diskPrimary, pVnode->pTfs, dir, TSDB_FILENAME_LEN);
|
||||
(void)vnodeGetPrimaryDir(pVnode->path, pVnode->diskPrimary, pVnode->pTfs, dir, TSDB_FILENAME_LEN);
|
||||
|
||||
vDebug("vgId:%d, save config while prepare commit", TD_VID(pVnode));
|
||||
code = vnodeSaveInfo(dir, &pInfo->info);
|
||||
|
@ -299,11 +299,11 @@ static int32_t vnodePrepareCommit(SVnode *pVnode, SCommitInfo *pInfo) {
|
|||
code = smaPrepareAsyncCommit(pVnode->pSma);
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
|
||||
taosThreadMutexLock(&pVnode->mutex);
|
||||
(void)taosThreadMutexLock(&pVnode->mutex);
|
||||
ASSERT(pVnode->onCommit == NULL);
|
||||
pVnode->onCommit = pVnode->inUse;
|
||||
pVnode->inUse = NULL;
|
||||
taosThreadMutexUnlock(&pVnode->mutex);
|
||||
(void)taosThreadMutexUnlock(&pVnode->mutex);
|
||||
|
||||
_exit:
|
||||
if (code) {
|
||||
|
@ -316,7 +316,7 @@ _exit:
|
|||
return code;
|
||||
}
|
||||
static void vnodeReturnBufPool(SVnode *pVnode) {
|
||||
taosThreadMutexLock(&pVnode->mutex);
|
||||
(void)taosThreadMutexLock(&pVnode->mutex);
|
||||
|
||||
SVBufPool *pPool = pVnode->onCommit;
|
||||
int32_t nRef = atomic_sub_fetch_32(&pPool->nRef, 1);
|
||||
|
@ -340,7 +340,7 @@ static void vnodeReturnBufPool(SVnode *pVnode) {
|
|||
ASSERT(0);
|
||||
}
|
||||
|
||||
taosThreadMutexUnlock(&pVnode->mutex);
|
||||
(void)taosThreadMutexUnlock(&pVnode->mutex);
|
||||
}
|
||||
static int32_t vnodeCommit(void *arg) {
|
||||
int32_t code = 0;
|
||||
|
@ -395,8 +395,8 @@ _exit:
|
|||
}
|
||||
|
||||
int vnodeSyncCommit(SVnode *pVnode) {
|
||||
vnodeAsyncCommit(pVnode);
|
||||
vnodeAWait(&pVnode->commitTask);
|
||||
(void)vnodeAsyncCommit(pVnode);
|
||||
(void)vnodeAWait(&pVnode->commitTask);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -416,9 +416,9 @@ static int vnodeCommitImpl(SCommitInfo *pInfo) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
vnodeGetPrimaryDir(pVnode->path, pVnode->diskPrimary, pVnode->pTfs, dir, TSDB_FILENAME_LEN);
|
||||
(void)vnodeGetPrimaryDir(pVnode->path, pVnode->diskPrimary, pVnode->pTfs, dir, TSDB_FILENAME_LEN);
|
||||
|
||||
syncBeginSnapshot(pVnode->sync, pInfo->info.state.committed);
|
||||
(void)syncBeginSnapshot(pVnode->sync, pInfo->info.state.committed);
|
||||
|
||||
code = tsdbCommitBegin(pVnode->pTsdb, pInfo);
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
|
@ -455,7 +455,7 @@ static int vnodeCommitImpl(SCommitInfo *pInfo) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
syncEndSnapshot(pVnode->sync);
|
||||
(void)syncEndSnapshot(pVnode->sync);
|
||||
|
||||
_exit:
|
||||
if (code) {
|
||||
|
@ -470,7 +470,7 @@ bool vnodeShouldRollback(SVnode *pVnode) {
|
|||
char tFName[TSDB_FILENAME_LEN] = {0};
|
||||
int32_t offset = 0;
|
||||
|
||||
vnodeGetPrimaryDir(pVnode->path, pVnode->diskPrimary, pVnode->pTfs, tFName, TSDB_FILENAME_LEN);
|
||||
(void)vnodeGetPrimaryDir(pVnode->path, pVnode->diskPrimary, pVnode->pTfs, tFName, TSDB_FILENAME_LEN);
|
||||
offset = strlen(tFName);
|
||||
snprintf(tFName + offset, TSDB_FILENAME_LEN - offset - 1, "%s%s", TD_DIRSEP, VND_INFO_FNAME_TMP);
|
||||
|
||||
|
@ -481,7 +481,7 @@ void vnodeRollback(SVnode *pVnode) {
|
|||
char tFName[TSDB_FILENAME_LEN] = {0};
|
||||
int32_t offset = 0;
|
||||
|
||||
vnodeGetPrimaryDir(pVnode->path, pVnode->diskPrimary, pVnode->pTfs, tFName, TSDB_FILENAME_LEN);
|
||||
(void)vnodeGetPrimaryDir(pVnode->path, pVnode->diskPrimary, pVnode->pTfs, tFName, TSDB_FILENAME_LEN);
|
||||
offset = strlen(tFName);
|
||||
snprintf(tFName + offset, TSDB_FILENAME_LEN - offset - 1, "%s%s", TD_DIRSEP, VND_INFO_FNAME_TMP);
|
||||
|
||||
|
|
|
@ -98,7 +98,7 @@ int32_t vHashPut(SVHashTable* ht, void* obj) {
|
|||
}
|
||||
|
||||
if (ht->numEntries >= ht->numBuckets) {
|
||||
vHashRehash(ht, ht->numBuckets * 2);
|
||||
(void)vHashRehash(ht, ht->numBuckets * 2);
|
||||
bucketIndex = ht->hash(obj) % ht->numBuckets;
|
||||
}
|
||||
|
||||
|
@ -144,7 +144,7 @@ int32_t vHashDrop(SVHashTable* ht, const void* obj) {
|
|||
taosMemoryFree(tmp);
|
||||
ht->numEntries--;
|
||||
if (ht->numBuckets > VNODE_HASH_DEFAULT_NUM_BUCKETS && ht->numEntries < ht->numBuckets / 4) {
|
||||
vHashRehash(ht, ht->numBuckets / 2);
|
||||
(void)vHashRehash(ht, ht->numBuckets / 2);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ int vnodeInit(int nthreads) {
|
|||
|
||||
void vnodeCleanup() {
|
||||
if (atomic_val_compare_exchange_32(&VINIT, 1, 0) == 0) return;
|
||||
vnodeAsyncClose();
|
||||
(void)vnodeAsyncClose();
|
||||
walCleanUp();
|
||||
smaCleanUp();
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ int32_t vnodeCreate(const char *path, SVnodeCfg *pCfg, int32_t diskPrimary, STfs
|
|||
vError("vgId:%d, failed to prepare vnode dir since %s, path: %s", pCfg->vgId, strerror(errno), path);
|
||||
return TAOS_SYSTEM_ERROR(errno);
|
||||
}
|
||||
vnodeGetPrimaryDir(path, diskPrimary, pTfs, dir, TSDB_FILENAME_LEN);
|
||||
(void)vnodeGetPrimaryDir(path, diskPrimary, pTfs, dir, TSDB_FILENAME_LEN);
|
||||
|
||||
if (pCfg) {
|
||||
info.config = *pCfg;
|
||||
|
@ -88,7 +88,7 @@ int32_t vnodeAlterReplica(const char *path, SAlterVnodeReplicaReq *pReq, int32_t
|
|||
char dir[TSDB_FILENAME_LEN] = {0};
|
||||
int32_t ret = 0;
|
||||
|
||||
vnodeGetPrimaryDir(path, diskPrimary, pTfs, dir, TSDB_FILENAME_LEN);
|
||||
(void)vnodeGetPrimaryDir(path, diskPrimary, pTfs, dir, TSDB_FILENAME_LEN);
|
||||
|
||||
ret = vnodeLoadInfo(dir, &info);
|
||||
if (ret < 0) {
|
||||
|
@ -221,7 +221,7 @@ int32_t vnodeAlterHashRange(const char *srcPath, const char *dstPath, SAlterVnod
|
|||
char dir[TSDB_FILENAME_LEN] = {0};
|
||||
int32_t ret = 0;
|
||||
|
||||
vnodeGetPrimaryDir(srcPath, diskPrimary, pTfs, dir, TSDB_FILENAME_LEN);
|
||||
(void)vnodeGetPrimaryDir(srcPath, diskPrimary, pTfs, dir, TSDB_FILENAME_LEN);
|
||||
|
||||
ret = vnodeLoadInfo(dir, &info);
|
||||
if (ret < 0) {
|
||||
|
@ -283,7 +283,7 @@ int32_t vnodeRestoreVgroupId(const char *srcPath, const char *dstPath, int32_t s
|
|||
char dir[TSDB_FILENAME_LEN] = {0};
|
||||
int32_t code = 0;
|
||||
|
||||
vnodeGetPrimaryDir(dstPath, diskPrimary, pTfs, dir, TSDB_FILENAME_LEN);
|
||||
(void)vnodeGetPrimaryDir(dstPath, diskPrimary, pTfs, dir, TSDB_FILENAME_LEN);
|
||||
if (vnodeLoadInfo(dir, &info) == 0) {
|
||||
if (info.config.vgId != dstVgId) {
|
||||
vError("vgId:%d, unexpected vnode config.vgId:%d", dstVgId, info.config.vgId);
|
||||
|
@ -292,7 +292,7 @@ int32_t vnodeRestoreVgroupId(const char *srcPath, const char *dstPath, int32_t s
|
|||
return dstVgId;
|
||||
}
|
||||
|
||||
vnodeGetPrimaryDir(srcPath, diskPrimary, pTfs, dir, TSDB_FILENAME_LEN);
|
||||
(void)vnodeGetPrimaryDir(srcPath, diskPrimary, pTfs, dir, TSDB_FILENAME_LEN);
|
||||
if (vnodeLoadInfo(dir, &info) < 0) {
|
||||
vError("vgId:%d, failed to read vnode config from %s since %s", srcVgId, srcPath, tstrerror(terrno));
|
||||
return -1;
|
||||
|
@ -317,7 +317,7 @@ int32_t vnodeRestoreVgroupId(const char *srcPath, const char *dstPath, int32_t s
|
|||
|
||||
void vnodeDestroy(int32_t vgId, const char *path, STfs *pTfs, int32_t nodeId) {
|
||||
vInfo("path:%s is removed while destroy vnode", path);
|
||||
tfsRmdir(pTfs, path);
|
||||
(void)tfsRmdir(pTfs, path);
|
||||
|
||||
// int32_t nlevel = tfsGetLevel(pTfs);
|
||||
if (nodeId > 0 && vgId > 0 /*&& nlevel > 1*/ && tsS3Enabled) {
|
||||
|
@ -351,7 +351,7 @@ SVnode *vnodeOpen(const char *path, int32_t diskPrimary, STfs *pTfs, SMsgCb msgC
|
|||
vError("failed to open vnode from %s since %s. diskPrimary:%d", path, terrstr(), diskPrimary);
|
||||
return NULL;
|
||||
}
|
||||
vnodeGetPrimaryDir(path, diskPrimary, pTfs, dir, TSDB_FILENAME_LEN);
|
||||
(void)vnodeGetPrimaryDir(path, diskPrimary, pTfs, dir, TSDB_FILENAME_LEN);
|
||||
|
||||
info.config = vnodeCfgDefault;
|
||||
|
||||
|
@ -401,12 +401,12 @@ SVnode *vnodeOpen(const char *path, int32_t diskPrimary, STfs *pTfs, SMsgCb msgC
|
|||
pVnode->pTfs = pTfs;
|
||||
pVnode->diskPrimary = diskPrimary;
|
||||
pVnode->msgCb = msgCb;
|
||||
taosThreadMutexInit(&pVnode->lock, NULL);
|
||||
(void)taosThreadMutexInit(&pVnode->lock, NULL);
|
||||
pVnode->blocked = false;
|
||||
|
||||
tsem_init(&pVnode->syncSem, 0, 0);
|
||||
taosThreadMutexInit(&pVnode->mutex, NULL);
|
||||
taosThreadCondInit(&pVnode->poolNotEmpty, NULL);
|
||||
(void)taosThreadMutexInit(&pVnode->mutex, NULL);
|
||||
(void)taosThreadCondInit(&pVnode->poolNotEmpty, NULL);
|
||||
|
||||
if (vnodeAChannelInit(1, &pVnode->commitChannel) != 0) {
|
||||
vError("vgId:%d, failed to init commit channel", TD_VID(pVnode));
|
||||
|
@ -439,7 +439,7 @@ SVnode *vnodeOpen(const char *path, int32_t diskPrimary, STfs *pTfs, SMsgCb msgC
|
|||
|
||||
// open wal
|
||||
sprintf(tdir, "%s%s%s", dir, TD_DIRSEP, VNODE_WAL_DIR);
|
||||
taosRealPath(tdir, NULL, sizeof(tdir));
|
||||
(void)taosRealPath(tdir, NULL, sizeof(tdir));
|
||||
|
||||
pVnode->pWal = walOpen(tdir, &(pVnode->config.walCfg));
|
||||
if (pVnode->pWal == NULL) {
|
||||
|
@ -449,7 +449,7 @@ SVnode *vnodeOpen(const char *path, int32_t diskPrimary, STfs *pTfs, SMsgCb msgC
|
|||
|
||||
// open tq
|
||||
sprintf(tdir, "%s%s%s", dir, TD_DIRSEP, VNODE_TQ_DIR);
|
||||
taosRealPath(tdir, NULL, sizeof(tdir));
|
||||
(void)taosRealPath(tdir, NULL, sizeof(tdir));
|
||||
|
||||
// open query
|
||||
if (vnodeQueryOpen(pVnode)) {
|
||||
|
@ -502,7 +502,7 @@ SVnode *vnodeOpen(const char *path, int32_t diskPrimary, STfs *pTfs, SMsgCb msgC
|
|||
counter = taos_counter_new(VNODE_METRIC_SQL_COUNT, "counter for insert sql", label_count, sample_labels);
|
||||
vInfo("vgId:%d, new metric:%p", TD_VID(pVnode), counter);
|
||||
if (taos_collector_registry_register_metric(counter) == 1) {
|
||||
taos_counter_destroy(counter);
|
||||
(void)taos_counter_destroy(counter);
|
||||
counter = taos_collector_registry_get_metric(VNODE_METRIC_SQL_COUNT);
|
||||
vInfo("vgId:%d, get metric from registry:%p", TD_VID(pVnode), counter);
|
||||
}
|
||||
|
@ -516,10 +516,10 @@ _err:
|
|||
if (pVnode->pQuery) vnodeQueryClose(pVnode);
|
||||
if (pVnode->pTq) tqClose(pVnode->pTq);
|
||||
if (pVnode->pWal) walClose(pVnode->pWal);
|
||||
if (pVnode->pTsdb) tsdbClose(&pVnode->pTsdb);
|
||||
if (pVnode->pSma) smaClose(pVnode->pSma);
|
||||
if (pVnode->pMeta) metaClose(&pVnode->pMeta);
|
||||
if (pVnode->freeList) vnodeCloseBufPool(pVnode);
|
||||
if (pVnode->pTsdb) (void)tsdbClose(&pVnode->pTsdb);
|
||||
if (pVnode->pSma) (void)smaClose(pVnode->pSma);
|
||||
if (pVnode->pMeta) (void)metaClose(&pVnode->pMeta);
|
||||
if (pVnode->freeList) (void)vnodeCloseBufPool(pVnode);
|
||||
|
||||
taosMemoryFree(pVnode);
|
||||
return NULL;
|
||||
|
@ -534,22 +534,22 @@ void vnodePostClose(SVnode *pVnode) { vnodeSyncPostClose(pVnode); }
|
|||
|
||||
void vnodeClose(SVnode *pVnode) {
|
||||
if (pVnode) {
|
||||
vnodeAWait(&pVnode->commitTask);
|
||||
vnodeAChannelDestroy(&pVnode->commitChannel, true);
|
||||
(void)vnodeAWait(&pVnode->commitTask);
|
||||
(void)vnodeAChannelDestroy(&pVnode->commitChannel, true);
|
||||
vnodeSyncClose(pVnode);
|
||||
vnodeQueryClose(pVnode);
|
||||
tqClose(pVnode->pTq);
|
||||
walClose(pVnode->pWal);
|
||||
if (pVnode->pTsdb) tsdbClose(&pVnode->pTsdb);
|
||||
smaClose(pVnode->pSma);
|
||||
(void)smaClose(pVnode->pSma);
|
||||
if (pVnode->pMeta) metaClose(&pVnode->pMeta);
|
||||
vnodeCloseBufPool(pVnode);
|
||||
(void)vnodeCloseBufPool(pVnode);
|
||||
|
||||
// destroy handle
|
||||
tsem_destroy(&pVnode->syncSem);
|
||||
taosThreadCondDestroy(&pVnode->poolNotEmpty);
|
||||
taosThreadMutexDestroy(&pVnode->mutex);
|
||||
taosThreadMutexDestroy(&pVnode->lock);
|
||||
(void)taosThreadMutexDestroy(&pVnode->mutex);
|
||||
(void)taosThreadMutexDestroy(&pVnode->lock);
|
||||
taosMemoryFree(pVnode);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -709,11 +709,12 @@ const int tkLogStbNum = ARRAY_SIZE(tkLogStb);
|
|||
const int tkAuditStbNum = ARRAY_SIZE(tkAuditStb);
|
||||
|
||||
// exclude stbs of taoskeeper log
|
||||
static int32_t vnodeGetTimeSeriesBlackList(SVnode *pVnode) {
|
||||
int32_t tbSize = 0;
|
||||
static int32_t vnodeGetTimeSeriesBlackList(SVnode *pVnode, int32_t *tbSize) {
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
int32_t tbNum = 0;
|
||||
const char **pTbArr = NULL;
|
||||
const char *dbName = NULL;
|
||||
*tbSize = 0;
|
||||
|
||||
if (!(dbName = strchr(pVnode->config.dbname, '.'))) return 0;
|
||||
if (0 == strncmp(++dbName, "log", TSDB_DB_NAME_LEN)) {
|
||||
|
@ -724,19 +725,22 @@ static int32_t vnodeGetTimeSeriesBlackList(SVnode *pVnode) {
|
|||
pTbArr = (const char **)&tkAuditStb;
|
||||
}
|
||||
if (tbNum && pTbArr) {
|
||||
tbSize = metaSizeOfTbFilterCache(pVnode->pMeta, 0);
|
||||
if (tbSize < tbNum) {
|
||||
*tbSize = metaSizeOfTbFilterCache(pVnode->pMeta, 0);
|
||||
if (*tbSize < tbNum) {
|
||||
for (int32_t i = 0; i < tbNum; ++i) {
|
||||
tb_uid_t suid = metaGetTableEntryUidByName(pVnode->pMeta, pTbArr[i]);
|
||||
if (suid != 0) {
|
||||
metaPutTbToFilterCache(pVnode->pMeta, &suid, 0);
|
||||
code = metaPutTbToFilterCache(pVnode->pMeta, &suid, 0);
|
||||
if (TSDB_CODE_SUCCESS != code) {
|
||||
return code;
|
||||
}
|
||||
}
|
||||
tbSize = metaSizeOfTbFilterCache(pVnode->pMeta, 0);
|
||||
}
|
||||
*tbSize = metaSizeOfTbFilterCache(pVnode->pMeta, 0);
|
||||
}
|
||||
}
|
||||
|
||||
return tbSize;
|
||||
return code;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -758,8 +762,12 @@ int32_t vnodeGetTimeSeriesNum(SVnode *pVnode, int64_t *num) {
|
|||
}
|
||||
|
||||
int32_t tbFilterSize = 0;
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
#ifdef TD_ENTERPRISE
|
||||
tbFilterSize = vnodeGetTimeSeriesBlackList(pVnode);
|
||||
code = vnodeGetTimeSeriesBlackList(pVnode, &tbFilterSize);
|
||||
if (TSDB_CODE_SUCCESS != code) {
|
||||
goto _exit;
|
||||
}
|
||||
#endif
|
||||
|
||||
if ((!tbFilterSize && vnodeGetStbIdList(pVnode, 0, suidList) < 0) ||
|
||||
|
@ -771,7 +779,6 @@ int32_t vnodeGetTimeSeriesNum(SVnode *pVnode, int64_t *num) {
|
|||
|
||||
*num = 0;
|
||||
int64_t arrSize = taosArrayGetSize(suidList);
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
for (int64_t i = 0; i < arrSize; ++i) {
|
||||
tb_uid_t suid = *(tb_uid_t *)taosArrayGet(suidList, i);
|
||||
|
||||
|
|
|
@ -209,7 +209,7 @@ static void vnodeSnapReaderDestroyTsdbRanges(SVSnapReader *pReader) {
|
|||
for (int32_t j = 0; j < TSDB_RETENTION_MAX; ++j) {
|
||||
TFileSetRangeArray **ppRanges = vnodeSnapReaderGetTsdbRanges(pReader, tsdbTyps[j]);
|
||||
if (ppRanges == NULL) continue;
|
||||
tsdbTFileSetRangeArrayDestroy(ppRanges);
|
||||
(void)tsdbTFileSetRangeArrayDestroy(ppRanges);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -218,15 +218,15 @@ void vnodeSnapReaderClose(SVSnapReader *pReader) {
|
|||
vnodeSnapReaderDestroyTsdbRanges(pReader);
|
||||
|
||||
if (pReader->pRsmaReader) {
|
||||
rsmaSnapReaderClose(&pReader->pRsmaReader);
|
||||
(void)rsmaSnapReaderClose(&pReader->pRsmaReader);
|
||||
}
|
||||
|
||||
if (pReader->pTsdbReader) {
|
||||
tsdbSnapReaderClose(&pReader->pTsdbReader);
|
||||
(void)tsdbSnapReaderClose(&pReader->pTsdbReader);
|
||||
}
|
||||
|
||||
if (pReader->pTsdbRAWReader) {
|
||||
tsdbSnapRAWReaderClose(&pReader->pTsdbRAWReader);
|
||||
(void)tsdbSnapRAWReaderClose(&pReader->pTsdbRAWReader);
|
||||
}
|
||||
|
||||
if (pReader->pMetaReader) {
|
||||
|
@ -260,7 +260,7 @@ int32_t vnodeSnapRead(SVSnapReader *pReader, uint8_t **ppData, uint32_t *nData)
|
|||
char fName[TSDB_FILENAME_LEN];
|
||||
int32_t offset = 0;
|
||||
|
||||
vnodeGetPrimaryDir(pVnode->path, pVnode->diskPrimary, pVnode->pTfs, fName, TSDB_FILENAME_LEN);
|
||||
(void)vnodeGetPrimaryDir(pVnode->path, pVnode->diskPrimary, pVnode->pTfs, fName, TSDB_FILENAME_LEN);
|
||||
offset = strlen(fName);
|
||||
snprintf(fName + offset, TSDB_FILENAME_LEN - offset - 1, "%s%s", TD_DIRSEP, VND_INFO_FNAME);
|
||||
|
||||
|
@ -272,13 +272,13 @@ int32_t vnodeSnapRead(SVSnapReader *pReader, uint8_t **ppData, uint32_t *nData)
|
|||
|
||||
int64_t size;
|
||||
if (taosFStatFile(pFile, &size, NULL) < 0) {
|
||||
taosCloseFile(&pFile);
|
||||
(void)taosCloseFile(&pFile);
|
||||
TSDB_CHECK_CODE(code = TAOS_SYSTEM_ERROR(errno), lino, _exit);
|
||||
}
|
||||
|
||||
*ppData = taosMemoryMalloc(sizeof(SSnapDataHdr) + size + 1);
|
||||
if (*ppData == NULL) {
|
||||
taosCloseFile(&pFile);
|
||||
(void)taosCloseFile(&pFile);
|
||||
TSDB_CHECK_CODE(code = TSDB_CODE_OUT_OF_MEMORY, lino, _exit);
|
||||
}
|
||||
((SSnapDataHdr *)(*ppData))->type = SNAP_DATA_CFG;
|
||||
|
@ -287,11 +287,11 @@ int32_t vnodeSnapRead(SVSnapReader *pReader, uint8_t **ppData, uint32_t *nData)
|
|||
|
||||
if (taosReadFile(pFile, ((SSnapDataHdr *)(*ppData))->data, size) < 0) {
|
||||
taosMemoryFree(*ppData);
|
||||
taosCloseFile(&pFile);
|
||||
(void)taosCloseFile(&pFile);
|
||||
TSDB_CHECK_CODE(code = TAOS_SYSTEM_ERROR(errno), lino, _exit);
|
||||
}
|
||||
|
||||
taosCloseFile(&pFile);
|
||||
(void)taosCloseFile(&pFile);
|
||||
|
||||
pReader->cfgDone = 1;
|
||||
goto _exit;
|
||||
|
@ -590,15 +590,15 @@ extern int32_t tsdbDisableAndCancelAllBgTask(STsdb *pTsdb);
|
|||
extern int32_t tsdbEnableBgTask(STsdb *pTsdb);
|
||||
|
||||
static int32_t vnodeCancelAndDisableAllBgTask(SVnode *pVnode) {
|
||||
tsdbDisableAndCancelAllBgTask(pVnode->pTsdb);
|
||||
vnodeSyncCommit(pVnode);
|
||||
vnodeAChannelDestroy(&pVnode->commitChannel, true);
|
||||
(void)tsdbDisableAndCancelAllBgTask(pVnode->pTsdb);
|
||||
(void)vnodeSyncCommit(pVnode);
|
||||
(void)vnodeAChannelDestroy(&pVnode->commitChannel, true);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int32_t vnodeEnableBgTask(SVnode *pVnode) {
|
||||
tsdbEnableBgTask(pVnode->pTsdb);
|
||||
vnodeAChannelInit(1, &pVnode->commitChannel);
|
||||
(void)tsdbEnableBgTask(pVnode->pTsdb);
|
||||
(void)vnodeAChannelInit(1, &pVnode->commitChannel);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -646,7 +646,7 @@ static void vnodeSnapWriterDestroyTsdbRanges(SVSnapWriter *pWriter) {
|
|||
for (int32_t j = 0; j < TSDB_RETENTION_MAX; ++j) {
|
||||
TFileSetRangeArray **ppRanges = vnodeSnapWriterGetTsdbRanges(pWriter, tsdbTyps[j]);
|
||||
if (ppRanges == NULL) continue;
|
||||
tsdbTFileSetRangeArrayDestroy(ppRanges);
|
||||
(void)tsdbTFileSetRangeArrayDestroy(ppRanges);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -658,15 +658,15 @@ int32_t vnodeSnapWriterClose(SVSnapWriter *pWriter, int8_t rollback, SSnapshot *
|
|||
|
||||
// prepare
|
||||
if (pWriter->pTsdbSnapWriter) {
|
||||
tsdbSnapWriterPrepareClose(pWriter->pTsdbSnapWriter);
|
||||
(void)tsdbSnapWriterPrepareClose(pWriter->pTsdbSnapWriter);
|
||||
}
|
||||
|
||||
if (pWriter->pTsdbSnapRAWWriter) {
|
||||
tsdbSnapRAWWriterPrepareClose(pWriter->pTsdbSnapRAWWriter);
|
||||
(void)tsdbSnapRAWWriterPrepareClose(pWriter->pTsdbSnapRAWWriter);
|
||||
}
|
||||
|
||||
if (pWriter->pRsmaSnapWriter) {
|
||||
rsmaSnapWriterPrepareClose(pWriter->pRsmaSnapWriter);
|
||||
(void)rsmaSnapWriterPrepareClose(pWriter->pRsmaSnapWriter);
|
||||
}
|
||||
|
||||
// commit json
|
||||
|
@ -681,7 +681,7 @@ int32_t vnodeSnapWriterClose(SVSnapWriter *pWriter, int8_t rollback, SSnapshot *
|
|||
.applyTerm = pWriter->info.state.commitTerm};
|
||||
pVnode->statis = pWriter->info.statis;
|
||||
char dir[TSDB_FILENAME_LEN] = {0};
|
||||
vnodeGetPrimaryDir(pVnode->path, pVnode->diskPrimary, pVnode->pTfs, dir, TSDB_FILENAME_LEN);
|
||||
(void)vnodeGetPrimaryDir(pVnode->path, pVnode->diskPrimary, pVnode->pTfs, dir, TSDB_FILENAME_LEN);
|
||||
|
||||
code = vnodeCommitInfo(dir);
|
||||
if (code) goto _exit;
|
||||
|
@ -740,7 +740,7 @@ int32_t vnodeSnapWriterClose(SVSnapWriter *pWriter, int8_t rollback, SSnapshot *
|
|||
if (code) goto _exit;
|
||||
}
|
||||
|
||||
vnodeBegin(pVnode);
|
||||
(void)vnodeBegin(pVnode);
|
||||
|
||||
_exit:
|
||||
if (code) {
|
||||
|
@ -768,7 +768,7 @@ static int32_t vnodeSnapWriteInfo(SVSnapWriter *pWriter, uint8_t *pData, uint32_
|
|||
|
||||
// modify info as needed
|
||||
char dir[TSDB_FILENAME_LEN] = {0};
|
||||
vnodeGetPrimaryDir(pVnode->path, pVnode->diskPrimary, pVnode->pTfs, dir, TSDB_FILENAME_LEN);
|
||||
(void)vnodeGetPrimaryDir(pVnode->path, pVnode->diskPrimary, pVnode->pTfs, dir, TSDB_FILENAME_LEN);
|
||||
|
||||
SVnodeStats vndStats = pWriter->info.config.vndStats;
|
||||
pWriter->info.config = pVnode->config;
|
||||
|
|
|
@ -207,7 +207,7 @@ static int32_t vnodePreProcessDropTtlMsg(SVnode *pVnode, SRpcMsg *pMsg) {
|
|||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
}
|
||||
|
||||
tSerializeSVDropTtlTableReq((char *)pContNew + sizeof(SMsgHead), reqLenNew, &ttlReq);
|
||||
(void)tSerializeSVDropTtlTableReq((char *)pContNew + sizeof(SMsgHead), reqLenNew, &ttlReq);
|
||||
pContNew->contLen = htonl(reqLenNew);
|
||||
pContNew->vgId = pContOld->vgId;
|
||||
|
||||
|
@ -422,7 +422,7 @@ static int32_t vnodePreProcessDeleteMsg(SVnode *pVnode, SRpcMsg *pMsg) {
|
|||
((SMsgHead *)pCont)->vgId = TD_VID(pVnode);
|
||||
|
||||
tEncoderInit(pCoder, pCont + sizeof(SMsgHead), size);
|
||||
tEncodeDeleteRes(pCoder, &res);
|
||||
(void)tEncodeDeleteRes(pCoder, &res);
|
||||
tEncoderClear(pCoder);
|
||||
|
||||
rpcFreeCont(pMsg->pCont);
|
||||
|
@ -632,7 +632,7 @@ int32_t vnodeProcessWriteMsg(SVnode *pVnode, SRpcMsg *pMsg, int64_t ver, SRpcMsg
|
|||
} break;
|
||||
case TDMT_STREAM_CONSEN_CHKPT: {
|
||||
if (pVnode->restored) {
|
||||
tqProcessTaskConsenChkptIdReq(pVnode->pTq, pMsg);
|
||||
(void)tqProcessTaskConsenChkptIdReq(pVnode->pTq, pMsg);
|
||||
}
|
||||
} break;
|
||||
case TDMT_STREAM_TASK_PAUSE: {
|
||||
|
@ -649,7 +649,7 @@ int32_t vnodeProcessWriteMsg(SVnode *pVnode, SRpcMsg *pMsg, int64_t ver, SRpcMsg
|
|||
} break;
|
||||
case TDMT_VND_STREAM_TASK_RESET: {
|
||||
if (pVnode->restored && vnodeIsLeader(pVnode)) {
|
||||
tqProcessTaskResetReq(pVnode->pTq, pMsg);
|
||||
(void)tqProcessTaskResetReq(pVnode->pTq, pMsg);
|
||||
}
|
||||
} break;
|
||||
case TDMT_VND_ALTER_CONFIRM:
|
||||
|
@ -871,7 +871,7 @@ int32_t vnodeProcessStreamMsg(SVnode *pVnode, SRpcMsg *pMsg, SQueueInfo *pInfo)
|
|||
}
|
||||
|
||||
void smaHandleRes(void *pVnode, int64_t smaId, const SArray *data) {
|
||||
tdProcessTSmaInsert(((SVnode *)pVnode)->pSma, smaId, (const char *)data);
|
||||
(void)tdProcessTSmaInsert(((SVnode *)pVnode)->pSma, smaId, (const char *)data);
|
||||
}
|
||||
|
||||
void vnodeUpdateMetaRsp(SVnode *pVnode, STableMetaRsp *pMetaRsp) {
|
||||
|
@ -942,7 +942,7 @@ static int32_t vnodeProcessDropTtlTbReq(SVnode *pVnode, int64_t ver, void *pReq,
|
|||
int ret = 0;
|
||||
if (ttlReq.nUids > 0) {
|
||||
metaDropTables(pVnode->pMeta, ttlReq.pTbUids);
|
||||
tqUpdateTbUidList(pVnode->pTq, ttlReq.pTbUids, false);
|
||||
(void)tqUpdateTbUidList(pVnode->pTq, ttlReq.pTbUids, false);
|
||||
}
|
||||
|
||||
end:
|
||||
|
@ -1142,7 +1142,7 @@ static int32_t vnodeProcessCreateTbReq(SVnode *pVnode, int64_t ver, void *pReq,
|
|||
}
|
||||
} else {
|
||||
cRsp.code = TSDB_CODE_SUCCESS;
|
||||
tdFetchTbUidList(pVnode->pSma, &pStore, pCreateReq->ctb.suid, pCreateReq->uid);
|
||||
(void)tdFetchTbUidList(pVnode->pSma, &pStore, pCreateReq->ctb.suid, pCreateReq->uid);
|
||||
if (taosArrayPush(tbUids, &pCreateReq->uid) == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
rcode = -1;
|
||||
|
@ -1159,11 +1159,11 @@ static int32_t vnodeProcessCreateTbReq(SVnode *pVnode, int64_t ver, void *pReq,
|
|||
}
|
||||
|
||||
vDebug("vgId:%d, add %d new created tables into query table list", TD_VID(pVnode), (int32_t)taosArrayGetSize(tbUids));
|
||||
tqUpdateTbUidList(pVnode->pTq, tbUids, true);
|
||||
(void)tqUpdateTbUidList(pVnode->pTq, tbUids, true);
|
||||
if (tdUpdateTbUidList(pVnode->pSma, pStore, true) < 0) {
|
||||
goto _exit;
|
||||
}
|
||||
tdUidStoreFree(pStore);
|
||||
(void)tdUidStoreFree(pStore);
|
||||
|
||||
// prepare rsp
|
||||
int32_t ret = 0;
|
||||
|
@ -1175,13 +1175,13 @@ static int32_t vnodeProcessCreateTbReq(SVnode *pVnode, int64_t ver, void *pReq,
|
|||
goto _exit;
|
||||
}
|
||||
tEncoderInit(&encoder, pRsp->pCont, pRsp->contLen);
|
||||
tEncodeSVCreateTbBatchRsp(&encoder, &rsp);
|
||||
(void)tEncodeSVCreateTbBatchRsp(&encoder, &rsp);
|
||||
|
||||
if (tsEnableAudit && tsEnableAuditCreateTable) {
|
||||
int64_t clusterId = pVnode->config.syncCfg.nodeInfo[0].clusterId;
|
||||
|
||||
SName name = {0};
|
||||
tNameFromString(&name, pVnode->config.dbname, T_NAME_ACCT | T_NAME_DB);
|
||||
(void)tNameFromString(&name, pVnode->config.dbname, T_NAME_ACCT | T_NAME_DB);
|
||||
|
||||
SStringBuilder sb = {0};
|
||||
for (int32_t i = 0; i < tbNames->size; i++) {
|
||||
|
@ -1329,7 +1329,7 @@ _exit:
|
|||
tEncodeSize(tEncodeSVAlterTbRsp, &vAlterTbRsp, pRsp->contLen, ret);
|
||||
pRsp->pCont = rpcMallocCont(pRsp->contLen);
|
||||
tEncoderInit(&ec, pRsp->pCont, pRsp->contLen);
|
||||
tEncodeSVAlterTbRsp(&ec, &vAlterTbRsp);
|
||||
(void)tEncodeSVAlterTbRsp(&ec, &vAlterTbRsp);
|
||||
tEncoderClear(&ec);
|
||||
if (vMetaRsp.pSchemas) {
|
||||
taosMemoryFree(vMetaRsp.pSchemas);
|
||||
|
@ -1384,7 +1384,7 @@ static int32_t vnodeProcessDropTbReq(SVnode *pVnode, int64_t ver, void *pReq, in
|
|||
}
|
||||
} else {
|
||||
dropTbRsp.code = TSDB_CODE_SUCCESS;
|
||||
if (tbUid > 0) tdFetchTbUidList(pVnode->pSma, &pStore, pDropTbReq->suid, tbUid);
|
||||
if (tbUid > 0) (void)tdFetchTbUidList(pVnode->pSma, &pStore, pDropTbReq->suid, tbUid);
|
||||
}
|
||||
|
||||
if (taosArrayPush(rsp.pArray, &dropTbRsp) == NULL) {
|
||||
|
@ -1404,14 +1404,14 @@ static int32_t vnodeProcessDropTbReq(SVnode *pVnode, int64_t ver, void *pReq, in
|
|||
}
|
||||
}
|
||||
|
||||
tqUpdateTbUidList(pVnode->pTq, tbUids, false);
|
||||
(void)tqUpdateTbUidList(pVnode->pTq, tbUids, false);
|
||||
tdUpdateTbUidList(pVnode->pSma, pStore, false);
|
||||
|
||||
if (tsEnableAuditCreateTable) {
|
||||
int64_t clusterId = pVnode->config.syncCfg.nodeInfo[0].clusterId;
|
||||
|
||||
SName name = {0};
|
||||
tNameFromString(&name, pVnode->config.dbname, T_NAME_ACCT | T_NAME_DB);
|
||||
(void)tNameFromString(&name, pVnode->config.dbname, T_NAME_ACCT | T_NAME_DB);
|
||||
|
||||
SStringBuilder sb = {0};
|
||||
for (int32_t iReq = 0; iReq < req.nReqs; iReq++) {
|
||||
|
@ -1435,7 +1435,7 @@ static int32_t vnodeProcessDropTbReq(SVnode *pVnode, int64_t ver, void *pReq, in
|
|||
|
||||
_exit:
|
||||
taosArrayDestroy(tbUids);
|
||||
tdUidStoreFree(pStore);
|
||||
(void)tdUidStoreFree(pStore);
|
||||
tDecoderClear(&decoder);
|
||||
tEncodeSize(tEncodeSVDropTbBatchRsp, &rsp, pRsp->contLen, ret);
|
||||
pRsp->pCont = rpcMallocCont(pRsp->contLen);
|
||||
|
@ -1876,7 +1876,7 @@ static int32_t vnodeProcessSubmitReq(SVnode *pVnode, int64_t ver, void *pReq, in
|
|||
if (taosArrayGetSize(newTbUids) > 0) {
|
||||
vDebug("vgId:%d, add %d table into query table list in handling submit", TD_VID(pVnode),
|
||||
(int32_t)taosArrayGetSize(newTbUids));
|
||||
tqUpdateTbUidList(pVnode->pTq, newTbUids, true);
|
||||
(void)tqUpdateTbUidList(pVnode->pTq, newTbUids, true);
|
||||
}
|
||||
|
||||
_exit:
|
||||
|
@ -1885,13 +1885,13 @@ _exit:
|
|||
tEncodeSize(tEncodeSSubmitRsp2, pSubmitRsp, pRsp->contLen, ret);
|
||||
pRsp->pCont = rpcMallocCont(pRsp->contLen);
|
||||
tEncoderInit(&ec, pRsp->pCont, pRsp->contLen);
|
||||
tEncodeSSubmitRsp2(&ec, pSubmitRsp);
|
||||
(void)tEncodeSSubmitRsp2(&ec, pSubmitRsp);
|
||||
tEncoderClear(&ec);
|
||||
|
||||
// update statistics
|
||||
atomic_add_fetch_64(&pVnode->statis.nInsert, pSubmitRsp->affectedRows);
|
||||
atomic_add_fetch_64(&pVnode->statis.nInsertSuccess, pSubmitRsp->affectedRows);
|
||||
atomic_add_fetch_64(&pVnode->statis.nBatchInsert, 1);
|
||||
(void)atomic_add_fetch_64(&pVnode->statis.nInsert, pSubmitRsp->affectedRows);
|
||||
(void)atomic_add_fetch_64(&pVnode->statis.nInsertSuccess, pSubmitRsp->affectedRows);
|
||||
(void)atomic_add_fetch_64(&pVnode->statis.nBatchInsert, 1);
|
||||
|
||||
if (tsEnableMonitor && pSubmitRsp->affectedRows > 0 && strlen(pOriginalMsg->info.conn.user) > 0) {
|
||||
const char *sample_labels[] = {VNODE_METRIC_TAG_VALUE_INSERT_AFFECTED_ROWS,
|
||||
|
@ -1901,11 +1901,11 @@ _exit:
|
|||
pVnode->monitor.strVgId,
|
||||
pOriginalMsg->info.conn.user,
|
||||
"Success"};
|
||||
taos_counter_add(pVnode->monitor.insertCounter, pSubmitRsp->affectedRows, sample_labels);
|
||||
(void)taos_counter_add(pVnode->monitor.insertCounter, pSubmitRsp->affectedRows, sample_labels);
|
||||
}
|
||||
|
||||
if (code == 0) {
|
||||
atomic_add_fetch_64(&pVnode->statis.nBatchInsertSuccess, 1);
|
||||
(void)atomic_add_fetch_64(&pVnode->statis.nBatchInsertSuccess, 1);
|
||||
code = tdProcessRSmaSubmit(pVnode->pSma, ver, pSubmitReq, pReq, len);
|
||||
}
|
||||
/*
|
||||
|
@ -2125,10 +2125,10 @@ static int32_t vnodeProcessAlterConfigReq(SVnode *pVnode, int64_t ver, void *pRe
|
|||
if (req.sttTrigger > 1 && pVnode->config.sttTrigger > 1) {
|
||||
pVnode->config.sttTrigger = req.sttTrigger;
|
||||
} else {
|
||||
vnodeAWait(&pVnode->commitTask);
|
||||
tsdbDisableAndCancelAllBgTask(pVnode->pTsdb);
|
||||
(void)vnodeAWait(&pVnode->commitTask);
|
||||
(void)tsdbDisableAndCancelAllBgTask(pVnode->pTsdb);
|
||||
pVnode->config.sttTrigger = req.sttTrigger;
|
||||
tsdbEnableBgTask(pVnode->pTsdb);
|
||||
(void)tsdbEnableBgTask(pVnode->pTsdb);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2144,11 +2144,11 @@ static int32_t vnodeProcessAlterConfigReq(SVnode *pVnode, int64_t ver, void *pRe
|
|||
}
|
||||
|
||||
if (walChanged) {
|
||||
walAlter(pVnode->pWal, &pVnode->config.walCfg);
|
||||
(void)walAlter(pVnode->pWal, &pVnode->config.walCfg);
|
||||
}
|
||||
|
||||
if (tsdbChanged) {
|
||||
tsdbSetKeepCfg(pVnode->pTsdb, &pVnode->config.tsdbCfg);
|
||||
(void)tsdbSetKeepCfg(pVnode->pTsdb, &pVnode->config.tsdbCfg);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -2220,7 +2220,8 @@ static int32_t vnodeProcessDeleteReq(SVnode *pVnode, int64_t ver, void *pReq, in
|
|||
}
|
||||
|
||||
tDecoderInit(pCoder, pReq, len);
|
||||
tDecodeDeleteRes(pCoder, pRes);
|
||||
code = tDecodeDeleteRes(pCoder, pRes);
|
||||
if (code) goto _err;
|
||||
|
||||
if (pRes->affectedRows > 0) {
|
||||
for (int32_t iUid = 0; iUid < taosArrayGetSize(pRes->uidList); iUid++) {
|
||||
|
@ -2243,7 +2244,8 @@ static int32_t vnodeProcessDeleteReq(SVnode *pVnode, int64_t ver, void *pReq, in
|
|||
pRsp->pCont = rpcMallocCont(pRsp->contLen);
|
||||
SEncoder ec = {0};
|
||||
tEncoderInit(&ec, pRsp->pCont, pRsp->contLen);
|
||||
tEncodeSVDeleteRsp(&ec, &rsp);
|
||||
code = tEncodeSVDeleteRsp(&ec, &rsp);
|
||||
if (code) goto _err;
|
||||
tEncoderClear(&ec);
|
||||
return code;
|
||||
|
||||
|
@ -2325,7 +2327,7 @@ static int32_t vnodeProcessCompactVnodeReq(SVnode *pVnode, int64_t ver, void *pR
|
|||
}
|
||||
|
||||
static int32_t vnodeProcessConfigChangeReq(SVnode *pVnode, int64_t ver, void *pReq, int32_t len, SRpcMsg *pRsp) {
|
||||
syncCheckMember(pVnode->sync);
|
||||
(void)syncCheckMember(pVnode->sync);
|
||||
|
||||
pRsp->msgType = TDMT_SYNC_CONFIG_CHANGE_RSP;
|
||||
pRsp->code = TSDB_CODE_SUCCESS;
|
||||
|
|
|
@ -28,22 +28,22 @@ static inline void vnodeWaitBlockMsg(SVnode *pVnode, const SRpcMsg *pMsg) {
|
|||
const STraceId *trace = &pMsg->info.traceId;
|
||||
vGTrace("vgId:%d, msg:%p wait block, type:%s sec:%d seq:%" PRId64, pVnode->config.vgId, pMsg,
|
||||
TMSG_INFO(pMsg->msgType), pVnode->blockSec, pVnode->blockSeq);
|
||||
tsem_wait(&pVnode->syncSem);
|
||||
(void)tsem_wait(&pVnode->syncSem);
|
||||
}
|
||||
|
||||
static inline void vnodePostBlockMsg(SVnode *pVnode, const SRpcMsg *pMsg) {
|
||||
if (vnodeIsMsgBlock(pMsg->msgType)) {
|
||||
const STraceId *trace = &pMsg->info.traceId;
|
||||
taosThreadMutexLock(&pVnode->lock);
|
||||
(void)taosThreadMutexLock(&pVnode->lock);
|
||||
if (pVnode->blocked) {
|
||||
vGTrace("vgId:%d, msg:%p post block, type:%s sec:%d seq:%" PRId64, pVnode->config.vgId, pMsg,
|
||||
TMSG_INFO(pMsg->msgType), pVnode->blockSec, pVnode->blockSeq);
|
||||
pVnode->blocked = false;
|
||||
pVnode->blockSec = 0;
|
||||
pVnode->blockSeq = 0;
|
||||
tsem_post(&pVnode->syncSem);
|
||||
(void)tsem_post(&pVnode->syncSem);
|
||||
}
|
||||
taosThreadMutexUnlock(&pVnode->lock);
|
||||
(void)taosThreadMutexUnlock(&pVnode->lock);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,7 @@ void vnodeRedirectRpcMsg(SVnode *pVnode, SRpcMsg *pMsg, int32_t code) {
|
|||
if (rsp.pCont == NULL) {
|
||||
pMsg->code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
} else {
|
||||
tSerializeSEpSet(rsp.pCont, contLen, &newEpSet);
|
||||
(void)tSerializeSEpSet(rsp.pCont, contLen, &newEpSet);
|
||||
rsp.contLen = contLen;
|
||||
}
|
||||
|
||||
|
@ -113,7 +113,7 @@ static void vnodeHandleProposeError(SVnode *pVnode, SRpcMsg *pMsg, int32_t code)
|
|||
static int32_t inline vnodeProposeMsg(SVnode *pVnode, SRpcMsg *pMsg, bool isWeak) {
|
||||
int64_t seq = 0;
|
||||
|
||||
taosThreadMutexLock(&pVnode->lock);
|
||||
(void)taosThreadMutexLock(&pVnode->lock);
|
||||
int32_t code = syncPropose(pVnode->sync, pMsg, isWeak, &seq);
|
||||
bool wait = (code == 0 && vnodeIsMsgBlock(pMsg->msgType));
|
||||
if (wait) {
|
||||
|
@ -122,7 +122,7 @@ static int32_t inline vnodeProposeMsg(SVnode *pVnode, SRpcMsg *pMsg, bool isWeak
|
|||
pVnode->blockSec = taosGetTimestampSec();
|
||||
pVnode->blockSeq = seq;
|
||||
}
|
||||
taosThreadMutexUnlock(&pVnode->lock);
|
||||
(void)taosThreadMutexUnlock(&pVnode->lock);
|
||||
|
||||
if (code > 0) {
|
||||
vnodeHandleWriteMsg(pVnode, pMsg);
|
||||
|
@ -161,7 +161,7 @@ void vnodeProposeCommitOnNeed(SVnode *pVnode, bool atExit) {
|
|||
rpcFreeCont(rpcMsg.pCont);
|
||||
rpcMsg.pCont = NULL;
|
||||
} else {
|
||||
tmsgPutToQueue(&pVnode->msgCb, WRITE_QUEUE, &rpcMsg);
|
||||
(void)tmsgPutToQueue(&pVnode->msgCb, WRITE_QUEUE, &rpcMsg);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -171,14 +171,14 @@ static void inline vnodeProposeBatchMsg(SVnode *pVnode, SRpcMsg **pMsgArr, bool
|
|||
if (*arrSize <= 0) return;
|
||||
SRpcMsg *pLastMsg = pMsgArr[*arrSize - 1];
|
||||
|
||||
taosThreadMutexLock(&pVnode->lock);
|
||||
(void)taosThreadMutexLock(&pVnode->lock);
|
||||
int32_t code = syncProposeBatch(pVnode->sync, pMsgArr, pIsWeakArr, *arrSize);
|
||||
bool wait = (code == 0 && vnodeIsBlockMsg(pLastMsg->msgType));
|
||||
if (wait) {
|
||||
ASSERT(!pVnode->blocked);
|
||||
pVnode->blocked = true;
|
||||
}
|
||||
taosThreadMutexUnlock(&pVnode->lock);
|
||||
(void)taosThreadMutexUnlock(&pVnode->lock);
|
||||
|
||||
if (code > 0) {
|
||||
for (int32_t i = 0; i < *arrSize; ++i) {
|
||||
|
@ -556,7 +556,7 @@ static void vnodeRestoreFinish(const SSyncFSM *pFsm, const SyncIndex commitIdx)
|
|||
} while (true);
|
||||
|
||||
ASSERT(commitIdx == vnodeSyncAppliedIndex(pFsm));
|
||||
walApplyVer(pVnode->pWal, commitIdx);
|
||||
(void)walApplyVer(pVnode->pWal, commitIdx);
|
||||
pVnode->restored = true;
|
||||
|
||||
SStreamMeta *pMeta = pVnode->pTq->pStreamMeta;
|
||||
|
@ -598,17 +598,17 @@ static void vnodeBecomeFollower(const SSyncFSM *pFsm) {
|
|||
SVnode *pVnode = pFsm->data;
|
||||
vInfo("vgId:%d, become follower", pVnode->config.vgId);
|
||||
|
||||
taosThreadMutexLock(&pVnode->lock);
|
||||
(void)taosThreadMutexLock(&pVnode->lock);
|
||||
if (pVnode->blocked) {
|
||||
pVnode->blocked = false;
|
||||
vDebug("vgId:%d, become follower and post block", pVnode->config.vgId);
|
||||
tsem_post(&pVnode->syncSem);
|
||||
(void)tsem_post(&pVnode->syncSem);
|
||||
}
|
||||
taosThreadMutexUnlock(&pVnode->lock);
|
||||
(void)taosThreadMutexUnlock(&pVnode->lock);
|
||||
|
||||
if (pVnode->pTq) {
|
||||
tqUpdateNodeStage(pVnode->pTq, false);
|
||||
tqStopStreamTasksAsync(pVnode->pTq);
|
||||
(void)tqStopStreamTasksAsync(pVnode->pTq);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -616,13 +616,13 @@ static void vnodeBecomeLearner(const SSyncFSM *pFsm) {
|
|||
SVnode *pVnode = pFsm->data;
|
||||
vInfo("vgId:%d, become learner", pVnode->config.vgId);
|
||||
|
||||
taosThreadMutexLock(&pVnode->lock);
|
||||
(void)taosThreadMutexLock(&pVnode->lock);
|
||||
if (pVnode->blocked) {
|
||||
pVnode->blocked = false;
|
||||
vDebug("vgId:%d, become learner and post block", pVnode->config.vgId);
|
||||
tsem_post(&pVnode->syncSem);
|
||||
(void)tsem_post(&pVnode->syncSem);
|
||||
}
|
||||
taosThreadMutexUnlock(&pVnode->lock);
|
||||
(void)taosThreadMutexUnlock(&pVnode->lock);
|
||||
}
|
||||
|
||||
static void vnodeBecomeLeader(const SSyncFSM *pFsm) {
|
||||
|
@ -743,16 +743,16 @@ int32_t vnodeSyncStart(SVnode *pVnode) {
|
|||
|
||||
void vnodeSyncPreClose(SVnode *pVnode) {
|
||||
vInfo("vgId:%d, sync pre close", pVnode->config.vgId);
|
||||
syncLeaderTransfer(pVnode->sync);
|
||||
(void)syncLeaderTransfer(pVnode->sync);
|
||||
syncPreStop(pVnode->sync);
|
||||
|
||||
taosThreadMutexLock(&pVnode->lock);
|
||||
(void)taosThreadMutexLock(&pVnode->lock);
|
||||
if (pVnode->blocked) {
|
||||
vInfo("vgId:%d, post block after close sync", pVnode->config.vgId);
|
||||
pVnode->blocked = false;
|
||||
tsem_post(&pVnode->syncSem);
|
||||
(void)tsem_post(&pVnode->syncSem);
|
||||
}
|
||||
taosThreadMutexUnlock(&pVnode->lock);
|
||||
(void)taosThreadMutexUnlock(&pVnode->lock);
|
||||
}
|
||||
|
||||
void vnodeSyncPostClose(SVnode *pVnode) {
|
||||
|
@ -767,7 +767,7 @@ void vnodeSyncClose(SVnode *pVnode) {
|
|||
|
||||
void vnodeSyncCheckTimeout(SVnode *pVnode) {
|
||||
vTrace("vgId:%d, check sync timeout msg", pVnode->config.vgId);
|
||||
taosThreadMutexLock(&pVnode->lock);
|
||||
(void)taosThreadMutexLock(&pVnode->lock);
|
||||
if (pVnode->blocked) {
|
||||
int32_t curSec = taosGetTimestampSec();
|
||||
int32_t delta = curSec - pVnode->blockSec;
|
||||
|
@ -785,10 +785,10 @@ void vnodeSyncCheckTimeout(SVnode *pVnode) {
|
|||
pVnode->blocked = false;
|
||||
pVnode->blockSec = 0;
|
||||
pVnode->blockSeq = 0;
|
||||
tsem_post(&pVnode->syncSem);
|
||||
(void)tsem_post(&pVnode->syncSem);
|
||||
}
|
||||
}
|
||||
taosThreadMutexUnlock(&pVnode->lock);
|
||||
(void)taosThreadMutexUnlock(&pVnode->lock);
|
||||
}
|
||||
|
||||
bool vnodeIsRoleLeader(SVnode *pVnode) {
|
||||
|
|
|
@ -248,7 +248,11 @@ static int32_t buildExchangeOperatorParam(SOperatorParam** ppRes, int32_t downst
|
|||
taosMemoryFree(pExc);
|
||||
return terrno;
|
||||
}
|
||||
taosArrayPush(pExc->basic.uidList, pUid);
|
||||
if (NULL == taosArrayPush(pExc->basic.uidList, pUid)) {
|
||||
taosArrayDestroy(pExc->basic.uidList);
|
||||
taosMemoryFree(pExc);
|
||||
return terrno;
|
||||
}
|
||||
|
||||
(*ppRes)->opType = QUERY_NODE_PHYSICAL_PLAN_EXCHANGE;
|
||||
(*ppRes)->downstreamIdx = downstreamIdx;
|
||||
|
|
|
@ -1160,7 +1160,13 @@ SMqBatchMetaRsp* qStreamExtractMetaMsg(qTaskInfo_t tinfo) {
|
|||
|
||||
int32_t qStreamExtractOffset(qTaskInfo_t tinfo, STqOffsetVal* pOffset) {
|
||||
SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo;
|
||||
return tOffsetCopy(pOffset, &pTaskInfo->streamInfo.currentOffset);
|
||||
tOffsetCopy(pOffset, &pTaskInfo->streamInfo.currentOffset);
|
||||
return 0;
|
||||
/*if (code != TSDB_CODE_SUCCESS) {
|
||||
qError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(code));
|
||||
pTaskInfo->code = code;
|
||||
T_LONG_JMP(pTaskInfo->env, code);
|
||||
}*/
|
||||
}
|
||||
|
||||
int32_t initQueryTableDataCondForTmq(SQueryTableDataCond* pCond, SSnapContext* sContext, SMetaTableInfo* pMtInfo) {
|
||||
|
|
|
@ -522,7 +522,7 @@ int32_t setResultRowInitCtx(SResultRow* pResult, SqlFunctionCtx* pCtx, int32_t n
|
|||
if (!pResInfo->initialized) {
|
||||
if (pCtx[i].functionId != -1) {
|
||||
int32_t code = pCtx[i].fpSet.init(&pCtx[i], pResInfo);
|
||||
if (code != TSDB_CODE_SUCCESS && fmIsUserDefinedFunc(pCtx[i].functionId)){
|
||||
if (code != TSDB_CODE_SUCCESS && fmIsUserDefinedFunc(pCtx[i].functionId)) {
|
||||
pResInfo->initialized = false;
|
||||
return TSDB_CODE_UDF_FUNC_EXEC_FAILURE;
|
||||
}
|
||||
|
@ -593,7 +593,7 @@ _err:
|
|||
}
|
||||
|
||||
int32_t extractQualifiedTupleByFilterResult(SSDataBlock* pBlock, const SColumnInfoData* p, int32_t status) {
|
||||
int32_t code = 0;
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
int8_t* pIndicator = (int8_t*)p->pData;
|
||||
if (status == FILTER_RESULT_ALL_QUALIFIED) {
|
||||
// here nothing needs to be done
|
||||
|
@ -605,7 +605,6 @@ int32_t extractQualifiedTupleByFilterResult(SSDataBlock* pBlock, const SColumnIn
|
|||
} else {
|
||||
qError("unknown filter result type: %d", status);
|
||||
}
|
||||
|
||||
return code;
|
||||
}
|
||||
|
||||
|
@ -698,7 +697,7 @@ void finalizeResultRows(SDiskbasedBuf* pBuf, SResultRowPosition* resultRowPositi
|
|||
doUpdateNumOfRows(pCtx, pRow, pSup->numOfExprs, rowEntryOffset);
|
||||
if (pRow->numOfRows == 0) {
|
||||
releaseBufPage(pBuf, page);
|
||||
return ;
|
||||
return;
|
||||
}
|
||||
|
||||
int32_t size = pBlock->info.capacity;
|
||||
|
|
|
@ -1311,7 +1311,8 @@ static void destroyTableScanOperatorInfo(void* param) {
|
|||
}
|
||||
|
||||
int32_t createTableScanOperatorInfo(STableScanPhysiNode* pTableScanNode, SReadHandle* readHandle,
|
||||
STableListInfo* pTableListInfo, SExecTaskInfo* pTaskInfo, SOperatorInfo** pOptrInfo) {
|
||||
STableListInfo* pTableListInfo, SExecTaskInfo* pTaskInfo,
|
||||
SOperatorInfo** pOptrInfo) {
|
||||
QRY_OPTR_CHECK(pOptrInfo);
|
||||
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
|
@ -1422,7 +1423,7 @@ int32_t createTableSeqScanOperatorInfo(void* pReadHandle, SExecTaskInfo* pTaskIn
|
|||
*pOptrInfo = pOperator;
|
||||
return code;
|
||||
|
||||
_end:
|
||||
_end:
|
||||
if (pInfo != NULL) {
|
||||
taosMemoryFree(pInfo);
|
||||
}
|
||||
|
@ -2413,9 +2414,13 @@ _end:
|
|||
return code;
|
||||
}
|
||||
|
||||
static void doBlockDataWindowFilter(SSDataBlock* pBlock, int32_t tsIndex, STimeWindow* pWindow, const char* id) {
|
||||
static int32_t doBlockDataWindowFilter(SSDataBlock* pBlock, int32_t tsIndex, STimeWindow* pWindow, const char* id) {
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
int32_t lino = 0;
|
||||
bool* p = NULL;
|
||||
if (pWindow->skey != INT64_MIN || pWindow->ekey != INT64_MAX) {
|
||||
bool* p = taosMemoryCalloc(pBlock->info.rows, sizeof(bool));
|
||||
p = taosMemoryCalloc(pBlock->info.rows, sizeof(bool));
|
||||
QUERY_CHECK_NULL(p, code, lino, _end, terrno);
|
||||
bool hasUnqualified = false;
|
||||
|
||||
SColumnInfoData* pCol = taosArrayGet(pBlock->pDataBlock, tsIndex);
|
||||
|
@ -2445,18 +2450,27 @@ static void doBlockDataWindowFilter(SSDataBlock* pBlock, int32_t tsIndex, STimeW
|
|||
}
|
||||
|
||||
if (hasUnqualified) {
|
||||
trimDataBlock(pBlock, pBlock->info.rows, p);
|
||||
code = trimDataBlock(pBlock, pBlock->info.rows, p);
|
||||
QUERY_CHECK_CODE(code, lino, _end);
|
||||
}
|
||||
}
|
||||
|
||||
_end:
|
||||
taosMemoryFree(p);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
qError("%s failed at line %d since %s", __func__, lino, tstrerror(code));
|
||||
}
|
||||
return code;
|
||||
}
|
||||
|
||||
static void doBlockDataPrimaryKeyFilter(SSDataBlock* pBlock, STqOffsetVal* offset) {
|
||||
static int32_t doBlockDataPrimaryKeyFilter(SSDataBlock* pBlock, STqOffsetVal* offset) {
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
int32_t lino = 0;
|
||||
if (pBlock->info.window.skey != offset->ts || offset->primaryKey.type == 0) {
|
||||
return;
|
||||
return code;
|
||||
}
|
||||
bool* p = taosMemoryCalloc(pBlock->info.rows, sizeof(bool));
|
||||
QUERY_CHECK_NULL(p, code, lino, _end, terrno);
|
||||
bool hasUnqualified = false;
|
||||
|
||||
SColumnInfoData* pColTs = taosArrayGet(pBlock->pDataBlock, 0);
|
||||
|
@ -2485,16 +2499,26 @@ static void doBlockDataPrimaryKeyFilter(SSDataBlock* pBlock, STqOffsetVal* offse
|
|||
}
|
||||
|
||||
if (hasUnqualified) {
|
||||
trimDataBlock(pBlock, pBlock->info.rows, p);
|
||||
code = trimDataBlock(pBlock, pBlock->info.rows, p);
|
||||
QUERY_CHECK_CODE(code, lino, _end);
|
||||
}
|
||||
|
||||
_end:
|
||||
taosMemoryFree(p);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
qError("%s failed at line %d since %s", __func__, lino, tstrerror(code));
|
||||
}
|
||||
return code;
|
||||
}
|
||||
|
||||
// re-build the delete block, ONLY according to the split timestamp
|
||||
static void rebuildDeleteBlockData(SSDataBlock* pBlock, STimeWindow* pWindow, const char* id) {
|
||||
static int32_t rebuildDeleteBlockData(SSDataBlock* pBlock, STimeWindow* pWindow, const char* id) {
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
int32_t lino = 0;
|
||||
int32_t numOfRows = pBlock->info.rows;
|
||||
bool* p = taosMemoryCalloc(numOfRows, sizeof(bool));
|
||||
QUERY_CHECK_NULL(p, code, lino, _end, terrno);
|
||||
|
||||
bool hasUnqualified = false;
|
||||
int64_t skey = pWindow->skey;
|
||||
int64_t ekey = pWindow->ekey;
|
||||
|
@ -2531,14 +2555,20 @@ static void rebuildDeleteBlockData(SSDataBlock* pBlock, STimeWindow* pWindow, co
|
|||
}
|
||||
|
||||
if (hasUnqualified) {
|
||||
trimDataBlock(pBlock, pBlock->info.rows, p);
|
||||
code = trimDataBlock(pBlock, pBlock->info.rows, p);
|
||||
qDebug("%s re-build delete datablock, start key revised to:%" PRId64 ", rows:%" PRId64, id, skey,
|
||||
pBlock->info.rows);
|
||||
QUERY_CHECK_CODE(code, lino, _end);
|
||||
} else {
|
||||
qDebug("%s not update the delete block", id);
|
||||
}
|
||||
|
||||
_end:
|
||||
taosMemoryFree(p);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
qError("%s failed at line %d since %s", __func__, lino, tstrerror(code));
|
||||
}
|
||||
return code;
|
||||
}
|
||||
|
||||
static int32_t colIdComparFn(const void* param1, const void* param2) {
|
||||
|
@ -2657,7 +2687,8 @@ static int32_t setBlockIntoRes(SStreamScanInfo* pInfo, const SSDataBlock* pBlock
|
|||
}
|
||||
|
||||
// filter the block extracted from WAL files, according to the time window apply additional time window filter
|
||||
doBlockDataWindowFilter(pInfo->pRes, pInfo->primaryTsIndex, pTimeWindow, id);
|
||||
code = doBlockDataWindowFilter(pInfo->pRes, pInfo->primaryTsIndex, pTimeWindow, id);
|
||||
QUERY_CHECK_CODE(code, lino, _end);
|
||||
pInfo->pRes->info.dataLoad = 1;
|
||||
|
||||
code = blockDataUpdateTsWindow(pInfo->pRes, pInfo->primaryTsIndex);
|
||||
|
@ -2676,14 +2707,19 @@ _end:
|
|||
return code;
|
||||
}
|
||||
|
||||
static void processPrimaryKey(SSDataBlock* pBlock, bool hasPrimaryKey, STqOffsetVal* offset) {
|
||||
static int32_t processPrimaryKey(SSDataBlock* pBlock, bool hasPrimaryKey, STqOffsetVal* offset) {
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
SValue val = {0};
|
||||
if (hasPrimaryKey) {
|
||||
doBlockDataPrimaryKeyFilter(pBlock, offset);
|
||||
code = doBlockDataPrimaryKeyFilter(pBlock, offset);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
qError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(code));
|
||||
return code;
|
||||
}
|
||||
SColumnInfoData* pColPk = taosArrayGet(pBlock->pDataBlock, 1);
|
||||
|
||||
if (pBlock->info.rows < 1) {
|
||||
return;
|
||||
return code;
|
||||
}
|
||||
void* tmp = colDataGetData(pColPk, pBlock->info.rows - 1);
|
||||
val.type = pColPk->info.type;
|
||||
|
@ -2696,6 +2732,7 @@ static void processPrimaryKey(SSDataBlock* pBlock, bool hasPrimaryKey, STqOffset
|
|||
}
|
||||
}
|
||||
tqOffsetResetToData(offset, pBlock->info.id.uid, pBlock->info.window.ekey, val);
|
||||
return code;
|
||||
}
|
||||
|
||||
static int32_t doQueueScanNext(SOperatorInfo* pOperator, SSDataBlock** ppRes) {
|
||||
|
@ -2711,7 +2748,7 @@ static int32_t doQueueScanNext(SOperatorInfo* pOperator, SSDataBlock** ppRes) {
|
|||
|
||||
if (isTaskKilled(pTaskInfo)) {
|
||||
(*ppRes) = NULL;
|
||||
return code;
|
||||
return pTaskInfo->code;
|
||||
}
|
||||
|
||||
if (pTaskInfo->streamInfo.currentOffset.type == TMQ_OFFSET__SNAPSHOT_DATA) {
|
||||
|
@ -2720,9 +2757,9 @@ static int32_t doQueueScanNext(SOperatorInfo* pOperator, SSDataBlock** ppRes) {
|
|||
|
||||
if (pResult && pResult->info.rows > 0) {
|
||||
bool hasPrimaryKey = pAPI->tqReaderFn.tqGetTablePrimaryKey(pInfo->tqReader);
|
||||
processPrimaryKey(pResult, hasPrimaryKey, &pTaskInfo->streamInfo.currentOffset);
|
||||
qDebug("tmqsnap doQueueScan get data uid:%" PRId64 "", pResult->info.id.uid);
|
||||
if (pResult->info.rows > 0) {
|
||||
code = processPrimaryKey(pResult, hasPrimaryKey, &pTaskInfo->streamInfo.currentOffset);
|
||||
qDebug("tmqsnap doQueueScan get data utid:%" PRId64 "", pResult->info.id.uid);
|
||||
if (pResult->info.rows > 0 || code != TSDB_CODE_SUCCESS) {
|
||||
(*ppRes) = pResult;
|
||||
return code;
|
||||
}
|
||||
|
@ -3156,7 +3193,8 @@ FETCH_NEXT_BLOCK:
|
|||
|
||||
code = setBlockGroupIdByUid(pInfo, pDelBlock);
|
||||
QUERY_CHECK_CODE(code, lino, _end);
|
||||
rebuildDeleteBlockData(pDelBlock, &pStreamInfo->fillHistoryWindow, id);
|
||||
code = rebuildDeleteBlockData(pDelBlock, &pStreamInfo->fillHistoryWindow, id);
|
||||
QUERY_CHECK_CODE(code, lino, _end);
|
||||
printSpecDataBlock(pDelBlock, getStreamOpName(pOperator->operatorType), "delete recv filtered",
|
||||
GET_TASKID(pTaskInfo));
|
||||
if (pDelBlock->info.rows == 0) {
|
||||
|
@ -3479,7 +3517,7 @@ static int32_t doRawScanNext(SOperatorInfo* pOperator, SSDataBlock** ppRes) {
|
|||
|
||||
if (pBlock && pBlock->info.rows > 0) {
|
||||
bool hasPrimaryKey = pAPI->snapshotFn.taosXGetTablePrimaryKey(pInfo->sContext);
|
||||
processPrimaryKey(pBlock, hasPrimaryKey, &pTaskInfo->streamInfo.currentOffset);
|
||||
code = processPrimaryKey(pBlock, hasPrimaryKey, &pTaskInfo->streamInfo.currentOffset);
|
||||
qDebug("tmqsnap doRawScan get data uid:%" PRId64 "", pBlock->info.id.uid);
|
||||
(*ppRes) = pBlock;
|
||||
return code;
|
||||
|
@ -3964,7 +4002,7 @@ int32_t createStreamScanOperatorInfo(SReadHandle* pHandle, STableScanPhysiNode*
|
|||
QUERY_CHECK_CODE(code, lino, _error);
|
||||
|
||||
pInfo->updateWin = (STimeWindow){.skey = INT64_MAX, .ekey = INT64_MAX};
|
||||
createSpecialDataBlock(STREAM_CLEAR, &pInfo->pUpdateDataRes);
|
||||
code = createSpecialDataBlock(STREAM_CLEAR, &pInfo->pUpdateDataRes);
|
||||
QUERY_CHECK_CODE(code, lino, _error);
|
||||
|
||||
if (hasPrimaryKeyCol(pInfo)) {
|
||||
|
@ -5626,7 +5664,8 @@ int32_t getTableMergeScanExplainExecInfo(SOperatorInfo* pOptr, void** pOptrExpla
|
|||
}
|
||||
|
||||
int32_t createTableMergeScanOperatorInfo(STableScanPhysiNode* pTableScanNode, SReadHandle* readHandle,
|
||||
STableListInfo* pTableListInfo, SExecTaskInfo* pTaskInfo, SOperatorInfo** pOptrInfo) {
|
||||
STableListInfo* pTableListInfo, SExecTaskInfo* pTaskInfo,
|
||||
SOperatorInfo** pOptrInfo) {
|
||||
QRY_OPTR_CHECK(pOptrInfo);
|
||||
|
||||
int32_t code = 0;
|
||||
|
|
|
@ -510,18 +510,16 @@ int32_t doStreamEventDecodeOpState(void* buf, int32_t len, SOperatorInfo* pOpera
|
|||
int32_t mapSize = 0;
|
||||
buf = taosDecodeFixedI32(buf, &mapSize);
|
||||
for (int32_t i = 0; i < mapSize; i++) {
|
||||
SSessionKey key = {0};
|
||||
SResultWindowInfo winfo = {0};
|
||||
buf = decodeSSessionKey(buf, &key);
|
||||
buf = decodeSSessionKey(buf, &winfo.sessionWin);
|
||||
int32_t winCode = TSDB_CODE_SUCCESS;
|
||||
code = pAggSup->stateStore.streamStateSessionAddIfNotExist(
|
||||
pAggSup->pState, &winfo.sessionWin, pAggSup->gap, (void**)&winfo.pStatePos, &pAggSup->resultRowSize, &winCode);
|
||||
QUERY_CHECK_CODE(code, lino, _end);
|
||||
ASSERT(winCode == TSDB_CODE_SUCCESS);
|
||||
|
||||
buf = decodeSResultWindowInfo(buf, &winfo, pInfo->streamAggSup.resultRowSize);
|
||||
code =
|
||||
tSimpleHashPut(pInfo->streamAggSup.pResultRows, &key, sizeof(SSessionKey), &winfo, sizeof(SResultWindowInfo));
|
||||
tSimpleHashPut(pInfo->streamAggSup.pResultRows, &winfo.sessionWin, sizeof(SSessionKey), &winfo, sizeof(SResultWindowInfo));
|
||||
QUERY_CHECK_CODE(code, lino, _end);
|
||||
}
|
||||
|
||||
|
|
|
@ -5183,7 +5183,7 @@ int32_t createStreamIntervalOperatorInfo(SOperatorInfo* downstream, SPhysiNode*
|
|||
pInfo->pDelWins = taosArrayInit(4, sizeof(SWinKey));
|
||||
pInfo->delIndex = 0;
|
||||
|
||||
createSpecialDataBlock(STREAM_DELETE_RESULT, &pInfo->pDelRes);
|
||||
code = createSpecialDataBlock(STREAM_DELETE_RESULT, &pInfo->pDelRes);
|
||||
QUERY_CHECK_CODE(code, lino, _error);
|
||||
|
||||
initResultRowInfo(&pInfo->binfo.resultRowInfo);
|
||||
|
|
|
@ -2229,7 +2229,10 @@ int32_t apercentileFunction(SqlFunctionCtx* pCtx) {
|
|||
double v = 0; // value
|
||||
int64_t w = 1; // weigth
|
||||
GET_TYPED_DATA(v, double, type, data);
|
||||
tdigestAdd(pInfo->pTDigest, v, w);
|
||||
int32_t code = tdigestAdd(pInfo->pTDigest, v, w);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
return code;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// might be a race condition here that pHisto can be overwritten or setup function
|
||||
|
@ -2285,7 +2288,10 @@ static int32_t apercentileTransferInfo(SAPercentileInfo* pInput, SAPercentileInf
|
|||
(void)memcpy(pTDigest, pInput->pTDigest, (size_t)TDIGEST_SIZE(COMPRESSION));
|
||||
tdigestAutoFill(pTDigest, COMPRESSION);
|
||||
} else {
|
||||
tdigestMerge(pTDigest, pInput->pTDigest);
|
||||
int32_t code = tdigestMerge(pTDigest, pInput->pTDigest);
|
||||
if (TSDB_CODE_SUCCESS != code) {
|
||||
return code;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
buildHistogramInfo(pInput);
|
||||
|
|
|
@ -28,7 +28,7 @@ char *tsMonSlowLogUri = "/slow-sql-detail-batch";
|
|||
char *tsMonFwBasicUri = "/taosd-cluster-basic";
|
||||
|
||||
void monRecordLog(int64_t ts, ELogLevel level, const char *content) {
|
||||
taosThreadMutexLock(&tsMonitor.lock);
|
||||
(void)taosThreadMutexLock(&tsMonitor.lock);
|
||||
int32_t size = taosArrayGetSize(tsMonitor.logs);
|
||||
if (size < tsMonitor.cfg.maxLogs) {
|
||||
SMonLogItem item = {.ts = ts, .level = level};
|
||||
|
@ -37,11 +37,11 @@ void monRecordLog(int64_t ts, ELogLevel level, const char *content) {
|
|||
tstrncpy(pItem->content, content, MON_LOG_LEN);
|
||||
}
|
||||
}
|
||||
taosThreadMutexUnlock(&tsMonitor.lock);
|
||||
(void)taosThreadMutexUnlock(&tsMonitor.lock);
|
||||
}
|
||||
|
||||
int32_t monGetLogs(SMonLogs *logs) {
|
||||
taosThreadMutexLock(&tsMonitor.lock);
|
||||
(void)taosThreadMutexLock(&tsMonitor.lock);
|
||||
logs->logs = taosArrayDup(tsMonitor.logs, NULL);
|
||||
logs->numOfInfoLogs = tsNumOfInfoLogs;
|
||||
logs->numOfErrorLogs = tsNumOfErrorLogs;
|
||||
|
@ -52,7 +52,7 @@ int32_t monGetLogs(SMonLogs *logs) {
|
|||
tsNumOfDebugLogs = 0;
|
||||
tsNumOfTraceLogs = 0;
|
||||
taosArrayClear(tsMonitor.logs);
|
||||
taosThreadMutexUnlock(&tsMonitor.lock);
|
||||
(void)taosThreadMutexUnlock(&tsMonitor.lock);
|
||||
if (logs->logs == NULL) {
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
}
|
||||
|
@ -60,44 +60,44 @@ int32_t monGetLogs(SMonLogs *logs) {
|
|||
}
|
||||
|
||||
void monSetDmInfo(SMonDmInfo *pInfo) {
|
||||
taosThreadMutexLock(&tsMonitor.lock);
|
||||
(void)taosThreadMutexLock(&tsMonitor.lock);
|
||||
memcpy(&tsMonitor.dmInfo, pInfo, sizeof(SMonDmInfo));
|
||||
taosThreadMutexUnlock(&tsMonitor.lock);
|
||||
(void)taosThreadMutexUnlock(&tsMonitor.lock);
|
||||
memset(pInfo, 0, sizeof(SMonDmInfo));
|
||||
}
|
||||
|
||||
void monSetMmInfo(SMonMmInfo *pInfo) {
|
||||
taosThreadMutexLock(&tsMonitor.lock);
|
||||
(void)taosThreadMutexLock(&tsMonitor.lock);
|
||||
memcpy(&tsMonitor.mmInfo, pInfo, sizeof(SMonMmInfo));
|
||||
taosThreadMutexUnlock(&tsMonitor.lock);
|
||||
(void)taosThreadMutexUnlock(&tsMonitor.lock);
|
||||
memset(pInfo, 0, sizeof(SMonMmInfo));
|
||||
}
|
||||
|
||||
void monSetVmInfo(SMonVmInfo *pInfo) {
|
||||
taosThreadMutexLock(&tsMonitor.lock);
|
||||
(void)taosThreadMutexLock(&tsMonitor.lock);
|
||||
memcpy(&tsMonitor.vmInfo, pInfo, sizeof(SMonVmInfo));
|
||||
taosThreadMutexUnlock(&tsMonitor.lock);
|
||||
(void)taosThreadMutexUnlock(&tsMonitor.lock);
|
||||
memset(pInfo, 0, sizeof(SMonVmInfo));
|
||||
}
|
||||
|
||||
void monSetQmInfo(SMonQmInfo *pInfo) {
|
||||
taosThreadMutexLock(&tsMonitor.lock);
|
||||
(void)taosThreadMutexLock(&tsMonitor.lock);
|
||||
memcpy(&tsMonitor.qmInfo, pInfo, sizeof(SMonQmInfo));
|
||||
taosThreadMutexUnlock(&tsMonitor.lock);
|
||||
(void)taosThreadMutexUnlock(&tsMonitor.lock);
|
||||
memset(pInfo, 0, sizeof(SMonQmInfo));
|
||||
}
|
||||
|
||||
void monSetSmInfo(SMonSmInfo *pInfo) {
|
||||
taosThreadMutexLock(&tsMonitor.lock);
|
||||
(void)taosThreadMutexLock(&tsMonitor.lock);
|
||||
memcpy(&tsMonitor.smInfo, pInfo, sizeof(SMonSmInfo));
|
||||
taosThreadMutexUnlock(&tsMonitor.lock);
|
||||
(void)taosThreadMutexUnlock(&tsMonitor.lock);
|
||||
memset(pInfo, 0, sizeof(SMonSmInfo));
|
||||
}
|
||||
|
||||
void monSetBmInfo(SMonBmInfo *pInfo) {
|
||||
taosThreadMutexLock(&tsMonitor.lock);
|
||||
(void)taosThreadMutexLock(&tsMonitor.lock);
|
||||
memcpy(&tsMonitor.bmInfo, pInfo, sizeof(SMonBmInfo));
|
||||
taosThreadMutexUnlock(&tsMonitor.lock);
|
||||
(void)taosThreadMutexUnlock(&tsMonitor.lock);
|
||||
memset(pInfo, 0, sizeof(SMonBmInfo));
|
||||
}
|
||||
|
||||
|
@ -153,7 +153,7 @@ static SMonInfo *monCreateMonitorInfo() {
|
|||
|
||||
monGetLogs(&pMonitor->log);
|
||||
|
||||
taosThreadMutexLock(&tsMonitor.lock);
|
||||
(void)taosThreadMutexLock(&tsMonitor.lock);
|
||||
memcpy(&pMonitor->dmInfo, &tsMonitor.dmInfo, sizeof(SMonDmInfo));
|
||||
memcpy(&pMonitor->mmInfo, &tsMonitor.mmInfo, sizeof(SMonMmInfo));
|
||||
memcpy(&pMonitor->vmInfo, &tsMonitor.vmInfo, sizeof(SMonVmInfo));
|
||||
|
@ -166,7 +166,7 @@ static SMonInfo *monCreateMonitorInfo() {
|
|||
memset(&tsMonitor.smInfo, 0, sizeof(SMonSmInfo));
|
||||
memset(&tsMonitor.qmInfo, 0, sizeof(SMonQmInfo));
|
||||
memset(&tsMonitor.bmInfo, 0, sizeof(SMonBmInfo));
|
||||
taosThreadMutexUnlock(&tsMonitor.lock);
|
||||
(void)taosThreadMutexUnlock(&tsMonitor.lock);
|
||||
|
||||
pMonitor->pJson = tjsonCreateObject();
|
||||
if (pMonitor->pJson == NULL || pMonitor->log.logs == NULL) {
|
||||
|
|
|
@ -533,6 +533,10 @@ int32_t qResetStmtColumns(SArray* pCols, bool deepClear) {
|
|||
|
||||
for (int32_t i = 0; i < colNum; ++i) {
|
||||
SColData* pCol = (SColData*)taosArrayGet(pCols, i);
|
||||
if (pCol == NULL){
|
||||
qError("qResetStmtColumns column is NULL");
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
if (deepClear) {
|
||||
tColDataDeepClear(pCol);
|
||||
} else {
|
||||
|
@ -549,6 +553,10 @@ int32_t qResetStmtDataBlock(STableDataCxt* block, bool deepClear) {
|
|||
|
||||
for (int32_t i = 0; i < colNum; ++i) {
|
||||
SColData* pCol = (SColData*)taosArrayGet(pBlock->pData->aCol, i);
|
||||
if (pCol == NULL){
|
||||
qError("qResetStmtDataBlock column is NULL");
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
if (deepClear) {
|
||||
tColDataDeepClear(pCol);
|
||||
} else {
|
||||
|
|
|
@ -128,7 +128,7 @@ static STaskQueue taskQueue = {0};
|
|||
|
||||
static void processTaskQueue(SQueueInfo *pInfo, SSchedMsg *pSchedMsg) {
|
||||
__async_exec_fn_t execFn = (__async_exec_fn_t)pSchedMsg->ahandle;
|
||||
execFn(pSchedMsg->thandle);
|
||||
(void)execFn(pSchedMsg->thandle);
|
||||
taosFreeQitem(pSchedMsg);
|
||||
}
|
||||
|
||||
|
|
|
@ -1840,7 +1840,7 @@ int32_t filterDumpInfoToString(SFilterInfo *info, const char *msg, int32_t optio
|
|||
if (unit->compare.optr2) {
|
||||
(void)strcat(str, " && ");
|
||||
if (unit->compare.optr2 <= OP_TYPE_JSON_CONTAINS) {
|
||||
sprintf(str + strlen(str), "[%d][%d] %s [", refNode->dataBlockId, refNode->slotId,
|
||||
(void)sprintf(str + strlen(str), "[%d][%d] %s [", refNode->dataBlockId, refNode->slotId,
|
||||
operatorTypeStr(unit->compare.optr2));
|
||||
}
|
||||
|
||||
|
|
|
@ -329,10 +329,10 @@ static void tltrim(char *input, char *output, int32_t type, int32_t charLen) {
|
|||
int32_t resLen;
|
||||
if (type == TSDB_DATA_TYPE_VARCHAR) {
|
||||
resLen = charLen - numOfSpaces;
|
||||
memcpy(varDataVal(output), varDataVal(input) + numOfSpaces, resLen);
|
||||
(void)memcpy(varDataVal(output), varDataVal(input) + numOfSpaces, resLen);
|
||||
} else {
|
||||
resLen = (charLen - numOfSpaces) * TSDB_NCHAR_SIZE;
|
||||
memcpy(varDataVal(output), varDataVal(input) + numOfSpaces * TSDB_NCHAR_SIZE, resLen);
|
||||
(void)memcpy(varDataVal(output), varDataVal(input) + numOfSpaces * TSDB_NCHAR_SIZE, resLen);
|
||||
}
|
||||
|
||||
varDataSetLen(output, resLen);
|
||||
|
@ -362,7 +362,7 @@ static void trtrim(char *input, char *output, int32_t type, int32_t charLen) {
|
|||
} else {
|
||||
resLen = (charLen - numOfSpaces) * TSDB_NCHAR_SIZE;
|
||||
}
|
||||
memcpy(varDataVal(output), varDataVal(input), resLen);
|
||||
(void)memcpy(varDataVal(output), varDataVal(input), resLen);
|
||||
|
||||
varDataSetLen(output, resLen);
|
||||
}
|
||||
|
@ -401,11 +401,11 @@ static int32_t concatCopyHelper(const char *input, char *output, bool hasNchar,
|
|||
taosMemoryFree(newBuf);
|
||||
return TSDB_CODE_SCALAR_CONVERT_ERROR;
|
||||
}
|
||||
memcpy(varDataVal(output) + *dataLen, newBuf, varDataLen(input) * TSDB_NCHAR_SIZE);
|
||||
(void)memcpy(varDataVal(output) + *dataLen, newBuf, varDataLen(input) * TSDB_NCHAR_SIZE);
|
||||
*dataLen += varDataLen(input) * TSDB_NCHAR_SIZE;
|
||||
taosMemoryFree(newBuf);
|
||||
} else {
|
||||
memcpy(varDataVal(output) + *dataLen, varDataVal(input), varDataLen(input));
|
||||
(void)memcpy(varDataVal(output) + *dataLen, varDataVal(input), varDataLen(input));
|
||||
*dataLen += varDataLen(input);
|
||||
}
|
||||
return TSDB_CODE_SUCCESS;
|
||||
|
@ -581,7 +581,7 @@ int32_t concatWsFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *p
|
|||
|
||||
if (hasNull) {
|
||||
colDataSetNULL(pOutputData, k);
|
||||
memset(output, 0, dataLen);
|
||||
(void)memset(output, 0, dataLen);
|
||||
} else {
|
||||
varDataSetLen(output, dataLen);
|
||||
SCL_ERR_JRET(colDataSetVal(pOutputData, k, output, false));
|
||||
|
@ -725,7 +725,7 @@ int32_t substrFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOu
|
|||
char *output = outputBuf;
|
||||
int32_t resLen = TMIN(subLen, len - startPosBytes);
|
||||
if (resLen > 0) {
|
||||
memcpy(varDataVal(output), varDataVal(input) + startPosBytes, resLen);
|
||||
(void)memcpy(varDataVal(output), varDataVal(input) + startPosBytes, resLen);
|
||||
varDataSetLen(output, resLen);
|
||||
} else {
|
||||
varDataSetLen(output, 0);
|
||||
|
@ -768,7 +768,7 @@ int32_t md5Function(SScalarParam* pInput, int32_t inputNum, SScalarParam* pOutpu
|
|||
}
|
||||
}
|
||||
char *output = pOutputBuf;
|
||||
memcpy(varDataVal(output), varDataVal(input), varDataLen(input));
|
||||
(void)memcpy(varDataVal(output), varDataVal(input), varDataLen(input));
|
||||
int32_t len = taosCreateMD5Hash(varDataVal(output), varDataLen(input));
|
||||
varDataSetLen(output, len);
|
||||
int32_t code = colDataSetVal(pOutputData, i, output, false);
|
||||
|
@ -812,7 +812,7 @@ int32_t castFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutp
|
|||
switch (outputType) {
|
||||
case TSDB_DATA_TYPE_TINYINT: {
|
||||
if (inputType == TSDB_DATA_TYPE_BINARY) {
|
||||
memcpy(buf, varDataVal(input), varDataLen(input));
|
||||
(void)memcpy(buf, varDataVal(input), varDataLen(input));
|
||||
buf[varDataLen(input)] = 0;
|
||||
*(int8_t *)output = taosStr2Int8(buf, NULL, 10);
|
||||
} else if (inputType == TSDB_DATA_TYPE_NCHAR) {
|
||||
|
@ -831,7 +831,7 @@ int32_t castFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutp
|
|||
}
|
||||
case TSDB_DATA_TYPE_SMALLINT: {
|
||||
if (inputType == TSDB_DATA_TYPE_BINARY) {
|
||||
memcpy(buf, varDataVal(input), varDataLen(input));
|
||||
(void)memcpy(buf, varDataVal(input), varDataLen(input));
|
||||
buf[varDataLen(input)] = 0;
|
||||
*(int16_t *)output = taosStr2Int16(buf, NULL, 10);
|
||||
} else if (inputType == TSDB_DATA_TYPE_NCHAR) {
|
||||
|
@ -849,7 +849,7 @@ int32_t castFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutp
|
|||
}
|
||||
case TSDB_DATA_TYPE_INT: {
|
||||
if (inputType == TSDB_DATA_TYPE_BINARY) {
|
||||
memcpy(buf, varDataVal(input), varDataLen(input));
|
||||
(void)memcpy(buf, varDataVal(input), varDataLen(input));
|
||||
buf[varDataLen(input)] = 0;
|
||||
*(int32_t *)output = taosStr2Int32(buf, NULL, 10);
|
||||
} else if (inputType == TSDB_DATA_TYPE_NCHAR) {
|
||||
|
@ -868,7 +868,7 @@ int32_t castFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutp
|
|||
}
|
||||
case TSDB_DATA_TYPE_BIGINT: {
|
||||
if (inputType == TSDB_DATA_TYPE_BINARY) {
|
||||
memcpy(buf, varDataVal(input), varDataLen(input));
|
||||
(void)memcpy(buf, varDataVal(input), varDataLen(input));
|
||||
buf[varDataLen(input)] = 0;
|
||||
*(int64_t *)output = taosStr2Int64(buf, NULL, 10);
|
||||
} else if (inputType == TSDB_DATA_TYPE_NCHAR) {
|
||||
|
@ -886,7 +886,7 @@ int32_t castFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutp
|
|||
}
|
||||
case TSDB_DATA_TYPE_UTINYINT: {
|
||||
if (inputType == TSDB_DATA_TYPE_BINARY) {
|
||||
memcpy(buf, varDataVal(input), varDataLen(input));
|
||||
(void)memcpy(buf, varDataVal(input), varDataLen(input));
|
||||
buf[varDataLen(input)] = 0;
|
||||
*(uint8_t *)output = taosStr2UInt8(buf, NULL, 10);
|
||||
} else if (inputType == TSDB_DATA_TYPE_NCHAR) {
|
||||
|
@ -904,7 +904,7 @@ int32_t castFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutp
|
|||
}
|
||||
case TSDB_DATA_TYPE_USMALLINT: {
|
||||
if (inputType == TSDB_DATA_TYPE_BINARY) {
|
||||
memcpy(buf, varDataVal(input), varDataLen(input));
|
||||
(void)memcpy(buf, varDataVal(input), varDataLen(input));
|
||||
buf[varDataLen(input)] = 0;
|
||||
*(uint16_t *)output = taosStr2UInt16(buf, NULL, 10);
|
||||
} else if (inputType == TSDB_DATA_TYPE_NCHAR) {
|
||||
|
@ -922,7 +922,7 @@ int32_t castFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutp
|
|||
}
|
||||
case TSDB_DATA_TYPE_UINT: {
|
||||
if (inputType == TSDB_DATA_TYPE_BINARY) {
|
||||
memcpy(buf, varDataVal(input), varDataLen(input));
|
||||
(void)memcpy(buf, varDataVal(input), varDataLen(input));
|
||||
buf[varDataLen(input)] = 0;
|
||||
*(uint32_t *)output = taosStr2UInt32(buf, NULL, 10);
|
||||
} else if (inputType == TSDB_DATA_TYPE_NCHAR) {
|
||||
|
@ -940,7 +940,7 @@ int32_t castFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutp
|
|||
}
|
||||
case TSDB_DATA_TYPE_UBIGINT: {
|
||||
if (inputType == TSDB_DATA_TYPE_BINARY) {
|
||||
memcpy(buf, varDataVal(input), varDataLen(input));
|
||||
(void)memcpy(buf, varDataVal(input), varDataLen(input));
|
||||
buf[varDataLen(input)] = 0;
|
||||
*(uint64_t *)output = taosStr2UInt64(buf, NULL, 10);
|
||||
} else if (inputType == TSDB_DATA_TYPE_NCHAR) {
|
||||
|
@ -959,7 +959,7 @@ int32_t castFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutp
|
|||
}
|
||||
case TSDB_DATA_TYPE_FLOAT: {
|
||||
if (inputType == TSDB_DATA_TYPE_BINARY) {
|
||||
memcpy(buf, varDataVal(input), varDataLen(input));
|
||||
(void)memcpy(buf, varDataVal(input), varDataLen(input));
|
||||
buf[varDataLen(input)] = 0;
|
||||
*(float *)output = taosStr2Float(buf, NULL);
|
||||
} else if (inputType == TSDB_DATA_TYPE_NCHAR) {
|
||||
|
@ -977,7 +977,7 @@ int32_t castFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutp
|
|||
}
|
||||
case TSDB_DATA_TYPE_DOUBLE: {
|
||||
if (inputType == TSDB_DATA_TYPE_BINARY) {
|
||||
memcpy(buf, varDataVal(input), varDataLen(input));
|
||||
(void)memcpy(buf, varDataVal(input), varDataLen(input));
|
||||
buf[varDataLen(input)] = 0;
|
||||
*(double *)output = taosStr2Double(buf, NULL);
|
||||
} else if (inputType == TSDB_DATA_TYPE_NCHAR) {
|
||||
|
@ -995,7 +995,7 @@ int32_t castFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutp
|
|||
}
|
||||
case TSDB_DATA_TYPE_BOOL: {
|
||||
if (inputType == TSDB_DATA_TYPE_BINARY) {
|
||||
memcpy(buf, varDataVal(input), varDataLen(input));
|
||||
(void)memcpy(buf, varDataVal(input), varDataLen(input));
|
||||
buf[varDataLen(input)] = 0;
|
||||
*(bool *)output = taosStr2Int8(buf, NULL, 10);
|
||||
} else if (inputType == TSDB_DATA_TYPE_NCHAR) {
|
||||
|
@ -1036,7 +1036,7 @@ int32_t castFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutp
|
|||
varDataSetLen(output, len);
|
||||
} else if (inputType == TSDB_DATA_TYPE_BINARY) {
|
||||
int32_t len = TMIN(varDataLen(input), outputLen - VARSTR_HEADER_SIZE);
|
||||
memcpy(varDataVal(output), varDataVal(input), len);
|
||||
(void)memcpy(varDataVal(output), varDataVal(input), len);
|
||||
varDataSetLen(output, len);
|
||||
} else if (inputType == TSDB_DATA_TYPE_NCHAR) {
|
||||
int32_t len = taosUcs4ToMbs((TdUcs4 *)varDataVal(input), varDataLen(input), convBuf);
|
||||
|
@ -1045,13 +1045,13 @@ int32_t castFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutp
|
|||
goto _end;
|
||||
}
|
||||
len = TMIN(len, outputLen - VARSTR_HEADER_SIZE);
|
||||
memcpy(varDataVal(output), convBuf, len);
|
||||
(void)memcpy(varDataVal(output), convBuf, len);
|
||||
varDataSetLen(output, len);
|
||||
} else {
|
||||
NUM_TO_STRING(inputType, input, bufSize, buf);
|
||||
int32_t len = (int32_t)strlen(buf);
|
||||
len = (outputLen - VARSTR_HEADER_SIZE) > len ? len : (outputLen - VARSTR_HEADER_SIZE);
|
||||
memcpy(varDataVal(output), buf, len);
|
||||
(void)memcpy(varDataVal(output), buf, len);
|
||||
varDataSetLen(output, len);
|
||||
}
|
||||
break;
|
||||
|
@ -1059,7 +1059,7 @@ int32_t castFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutp
|
|||
case TSDB_DATA_TYPE_VARBINARY:{
|
||||
if (inputType == TSDB_DATA_TYPE_BINARY) {
|
||||
int32_t len = TMIN(varDataLen(input), outputLen - VARSTR_HEADER_SIZE);
|
||||
memcpy(varDataVal(output), varDataVal(input), len);
|
||||
(void)memcpy(varDataVal(output), varDataVal(input), len);
|
||||
varDataSetLen(output, len);
|
||||
}else{
|
||||
code = TSDB_CODE_FUNC_FUNTION_PARA_TYPE;
|
||||
|
@ -1091,7 +1091,7 @@ int32_t castFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutp
|
|||
varDataSetLen(output, len);
|
||||
} else if (inputType == TSDB_DATA_TYPE_NCHAR) {
|
||||
len = TMIN(outputLen - VARSTR_HEADER_SIZE, varDataLen(input));
|
||||
memcpy(output, input, len + VARSTR_HEADER_SIZE);
|
||||
(void)memcpy(output, input, len + VARSTR_HEADER_SIZE);
|
||||
varDataSetLen(output, len);
|
||||
} else {
|
||||
NUM_TO_STRING(inputType, input, bufSize, buf);
|
||||
|
@ -1141,7 +1141,7 @@ int32_t toISO8601Function(SScalarParam *pInput, int32_t inputNum, SScalarParam *
|
|||
int32_t tzLen = 0;
|
||||
if (tzPresent) {
|
||||
tzLen = varDataLen(pInput[1].columnData->pData);
|
||||
memcpy(tz, varDataVal(pInput[1].columnData->pData), tzLen);
|
||||
(void)memcpy(tz, varDataVal(pInput[1].columnData->pData), tzLen);
|
||||
}
|
||||
|
||||
for (int32_t i = 0; i < pInput[0].numOfRows; ++i) {
|
||||
|
@ -1218,7 +1218,7 @@ int32_t toISO8601Function(SScalarParam *pInput, int32_t inputNum, SScalarParam *
|
|||
|
||||
// add timezone string
|
||||
if (tzLen > 0) {
|
||||
snprintf(buf + len, tzLen + 1, "%s", tz);
|
||||
(void)snprintf(buf + len, tzLen + 1, "%s", tz);
|
||||
len += tzLen;
|
||||
}
|
||||
|
||||
|
@ -1286,7 +1286,7 @@ int32_t toJsonFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOu
|
|||
taosArrayDestroy(pTagVals);
|
||||
return TSDB_CODE_FAILED;
|
||||
}
|
||||
memcpy(tmp, varDataVal(input), varDataLen(input));
|
||||
(void)memcpy(tmp, varDataVal(input), varDataLen(input));
|
||||
tmp[varDataLen(input)] = 0;
|
||||
if (parseJsontoTagData(tmp, pTagVals, &pTag, NULL)) {
|
||||
code = tTagNew(pTagVals, 1, true, &pTag);
|
||||
|
@ -1402,7 +1402,7 @@ _return:
|
|||
int64_t offsetFromTz(char *timezone, int64_t factor) {
|
||||
char *minStr = &timezone[3];
|
||||
int64_t minutes = taosStr2Int64(minStr, NULL, 10);
|
||||
memset(minStr, 0, strlen(minStr));
|
||||
(void)memset(minStr, 0, strlen(minStr));
|
||||
int64_t hours = taosStr2Int64(timezone, NULL, 10);
|
||||
int64_t seconds = hours * 3600 + minutes * 60;
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
#define _DEBUG_PRINT_ 0
|
||||
|
||||
#if _DEBUG_PRINT_
|
||||
#define PRINTF(...) printf(__VA_ARGS__)
|
||||
#define PRINTF(...) (void)printf(__VA_ARGS__)
|
||||
#else
|
||||
#define PRINTF(...)
|
||||
#endif
|
||||
|
@ -84,7 +84,7 @@ void scltInitLogFile() {
|
|||
(void)strcpy(tsLogDir, TD_LOG_DIR_PATH);
|
||||
|
||||
if (taosInitLog(defaultLogFileNamePrefix, maxLogFileNum) < 0) {
|
||||
printf("failed to open log file in directory:%s\n", tsLogDir);
|
||||
(void)printf("failed to open log file in directory:%s\n", tsLogDir);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1450,7 +1450,7 @@ TEST(columnTest, json_column_arith_op) {
|
|||
OP_TYPE_REM, OP_TYPE_MINUS, OP_TYPE_BIT_AND, OP_TYPE_BIT_OR};
|
||||
int32_t input[len] = {1, 8, 2, 2, 3, 0, -4, 9};
|
||||
|
||||
printf("--------------------json int-4 op {1, 8, 2, 2, 3, 0, -4, 9}--------------------\n");
|
||||
(void)printf("--------------------json int-4 op {1, 8, 2, 2, 3, 0, -4, 9}--------------------\n");
|
||||
char *key = "k1";
|
||||
double eRes00[len] = {5.0, -4, 8.0, 2.0, 1.0, -4, 4 & -4, 4 | 9};
|
||||
double eRes01[len] = {5.0, 4, 8.0, 0.5, 3, 0, 4 & -4, 4 | 9};
|
||||
|
@ -1463,7 +1463,7 @@ TEST(columnTest, json_column_arith_op) {
|
|||
ASSERT_EQ(code, TSDB_CODE_SUCCESS);
|
||||
}
|
||||
|
||||
printf("--------------------json string- 0 op {1, 8, 2, 2, 3, 0, -4, 9}--------------------\n");
|
||||
(void)printf("--------------------json string- 0 op {1, 8, 2, 2, 3, 0, -4, 9}--------------------\n");
|
||||
|
||||
key = "k2";
|
||||
double eRes10[len] = {1.0, -8, 0, 0, 0, 0, 0, 9};
|
||||
|
@ -1477,7 +1477,7 @@ TEST(columnTest, json_column_arith_op) {
|
|||
ASSERT_EQ(code, TSDB_CODE_SUCCESS);
|
||||
}
|
||||
|
||||
printf("---------------------json null- null op {1, 8, 2, 2, 3, 0, -4, 9}-------------------\n");
|
||||
(void)printf("---------------------json null- null op {1, 8, 2, 2, 3, 0, -4, 9}-------------------\n");
|
||||
|
||||
key = "k3";
|
||||
double eRes20[len] = {DBL_MAX, DBL_MAX, DBL_MAX, DBL_MAX, DBL_MAX, DBL_MAX, DBL_MAX, DBL_MAX};
|
||||
|
@ -1491,7 +1491,7 @@ TEST(columnTest, json_column_arith_op) {
|
|||
ASSERT_EQ(code, TSDB_CODE_SUCCESS);
|
||||
}
|
||||
|
||||
printf("---------------------json bool- true op {1, 8, 2, 2, 3, 0, -4, 9}-------------------\n");
|
||||
(void)printf("---------------------json bool- true op {1, 8, 2, 2, 3, 0, -4, 9}-------------------\n");
|
||||
|
||||
key = "k4";
|
||||
double eRes30[len] = {2.0, -7, 2, 0.5, 1, -1, 1 & -4, 1 | 9};
|
||||
|
@ -1505,7 +1505,7 @@ TEST(columnTest, json_column_arith_op) {
|
|||
ASSERT_EQ(code, TSDB_CODE_SUCCESS);
|
||||
}
|
||||
|
||||
printf("----------------------json double-- 5.44 op {1, 8, 2, 2, 3, 0, -4, 9}------------------\n");
|
||||
(void)printf("----------------------json double-- 5.44 op {1, 8, 2, 2, 3, 0, -4, 9}------------------\n");
|
||||
|
||||
key = "k5";
|
||||
double eRes40[len] = {6.44, -2.56, 10.88, 2.72, 2.44, -5.44, 5 & -4, 5 | 9};
|
||||
|
@ -1519,7 +1519,7 @@ TEST(columnTest, json_column_arith_op) {
|
|||
ASSERT_EQ(code, TSDB_CODE_SUCCESS);
|
||||
}
|
||||
|
||||
printf("----------------------json int-- -10 op {1, 8, 2, 2, 3, 0, -4, 9}------------------\n");
|
||||
(void)printf("----------------------json int-- -10 op {1, 8, 2, 2, 3, 0, -4, 9}------------------\n");
|
||||
|
||||
key = "k6";
|
||||
double eRes50[len] = {-9, -18, -20, -5, -10 % 3, 10, -10 & -4, -10 | 9};
|
||||
|
@ -1533,7 +1533,7 @@ TEST(columnTest, json_column_arith_op) {
|
|||
ASSERT_EQ(code, TSDB_CODE_SUCCESS);
|
||||
}
|
||||
|
||||
printf("----------------------json double-- -9.8 op {1, 8, 2, 2, 3, 0, -4, 9}------------------\n");
|
||||
(void)printf("----------------------json double-- -9.8 op {1, 8, 2, 2, 3, 0, -4, 9}------------------\n");
|
||||
|
||||
key = "k7";
|
||||
double eRes60[len] = {-8.8, -17.8, -19.6, -4.9, -0.8, 9.8, -9 & -4, -9 | 9};
|
||||
|
@ -1547,7 +1547,7 @@ TEST(columnTest, json_column_arith_op) {
|
|||
ASSERT_EQ(code, TSDB_CODE_SUCCESS);
|
||||
}
|
||||
|
||||
printf("----------------------json bool-- 0 op {1, 8, 2, 2, 3, 0, -4, 9}------------------\n");
|
||||
(void)printf("----------------------json bool-- 0 op {1, 8, 2, 2, 3, 0, -4, 9}------------------\n");
|
||||
|
||||
key = "k8";
|
||||
double eRes70[len] = {1.0, -8, 0, 0, 0, 0, 0, 9};
|
||||
|
@ -1561,7 +1561,7 @@ TEST(columnTest, json_column_arith_op) {
|
|||
ASSERT_EQ(code, TSDB_CODE_SUCCESS);
|
||||
}
|
||||
|
||||
printf("----------------------json string-- 8 op {1, 8, 2, 2, 3, 0, -4, 9}------------------\n");
|
||||
(void)printf("----------------------json string-- 8 op {1, 8, 2, 2, 3, 0, -4, 9}------------------\n");
|
||||
|
||||
key = "k9";
|
||||
double eRes80[len] = {9, 0, 16, 4, 8 % 3, -8, 8 & -4, 8 | 9};
|
||||
|
@ -1575,7 +1575,7 @@ TEST(columnTest, json_column_arith_op) {
|
|||
ASSERT_EQ(code, TSDB_CODE_SUCCESS);
|
||||
}
|
||||
|
||||
printf("---------------------json not exist-- NULL op {1, 8, 2, 2, 3, 0, -4, 9}------------------\n");
|
||||
(void)printf("---------------------json not exist-- NULL op {1, 8, 2, 2, 3, 0, -4, 9}------------------\n");
|
||||
|
||||
key = "k10";
|
||||
double eRes90[len] = {DBL_MAX, DBL_MAX, DBL_MAX, DBL_MAX, DBL_MAX, DBL_MAX, DBL_MAX, DBL_MAX};
|
||||
|
@ -1628,7 +1628,7 @@ TEST(columnTest, json_column_logic_op) {
|
|||
|
||||
int32_t input[len] = {1, 8, 2, 2, 3, 0, 0, 0, 0};
|
||||
char *inputNchar[len1] = {"hell_", "hel%", "hell", "llll"};
|
||||
printf("--------------------json int---4 {1, 8, 2, 2, 3, 0, 0, 0, 0}------------------\n");
|
||||
(void)printf("--------------------json int---4 {1, 8, 2, 2, 3, 0, 0, 0, 0}------------------\n");
|
||||
char *key = "k1";
|
||||
bool eRes[len + len1] = {true, false, false, false, false, true, false, true, true, false, false, false, false};
|
||||
for (int i = 0; i < len; i++) {
|
||||
|
@ -1647,7 +1647,7 @@ TEST(columnTest, json_column_logic_op) {
|
|||
taosMemoryFree(rightData);
|
||||
}
|
||||
|
||||
printf("--------------------json string--0 {1, 8, 2, 2, 3, 0, 0, 0, 0}-------------------\n");
|
||||
(void)printf("--------------------json string--0 {1, 8, 2, 2, 3, 0, 0, 0, 0}-------------------\n");
|
||||
|
||||
key = "k2";
|
||||
bool eRes1[len + len1] = {false, false, false, false, false, false, false, true, false, true, false, true, true};
|
||||
|
@ -1668,7 +1668,7 @@ TEST(columnTest, json_column_logic_op) {
|
|||
taosMemoryFree(rightData);
|
||||
}
|
||||
|
||||
printf("--------------------json null---null {1, 8, 2, 2, 3, 0, 0, 0, 0}------------------\n");
|
||||
(void)printf("--------------------json null---null {1, 8, 2, 2, 3, 0, 0, 0, 0}------------------\n");
|
||||
|
||||
key = "k3"; // (null is true) return NULL, so use DBL_MAX represent NULL
|
||||
bool eRes2[len + len1] = {false, false, false, false, false, false, true, false, false, false, false, false, false};
|
||||
|
@ -1689,7 +1689,7 @@ TEST(columnTest, json_column_logic_op) {
|
|||
taosMemoryFree(rightData);
|
||||
}
|
||||
|
||||
printf("--------------------json bool--1 {1, 8, 2, 2, 3, 0, 0, 0, 0}-------------------\n");
|
||||
(void)printf("--------------------json bool--1 {1, 8, 2, 2, 3, 0, 0, 0, 0}-------------------\n");
|
||||
|
||||
key = "k4";
|
||||
bool eRes3[len + len1] = {false, false, false, false, false, false, false, true, true, false, false, false, false};
|
||||
|
@ -1710,7 +1710,7 @@ TEST(columnTest, json_column_logic_op) {
|
|||
taosMemoryFree(rightData);
|
||||
}
|
||||
|
||||
printf("--------------------json double--5.44 {1, 8, 2, 2, 3, 0, 0, 0, 0}-------------------\n");
|
||||
(void)printf("--------------------json double--5.44 {1, 8, 2, 2, 3, 0, 0, 0, 0}-------------------\n");
|
||||
|
||||
key = "k5";
|
||||
bool eRes4[len + len1] = {true, false, false, false, false, true, false, true, true, false, false, false, false};
|
||||
|
@ -1731,7 +1731,7 @@ TEST(columnTest, json_column_logic_op) {
|
|||
taosMemoryFree(rightData);
|
||||
}
|
||||
|
||||
printf("--------------------json int-- -10 {1, 8, 2, 2, 3, 0, 0, 0, 0}-------------------\n");
|
||||
(void)printf("--------------------json int-- -10 {1, 8, 2, 2, 3, 0, 0, 0, 0}-------------------\n");
|
||||
|
||||
key = "k6";
|
||||
bool eRes5[len + len1] = {false, false, true, true, false, true, false, true, true, false, false, false, false};
|
||||
|
@ -1752,7 +1752,7 @@ TEST(columnTest, json_column_logic_op) {
|
|||
taosMemoryFree(rightData);
|
||||
}
|
||||
|
||||
printf("--------------------json double-- -9.8 {1, 8, 2, 2, 3, 0, 0, 0, 0}-------------------\n");
|
||||
(void)printf("--------------------json double-- -9.8 {1, 8, 2, 2, 3, 0, 0, 0, 0}-------------------\n");
|
||||
|
||||
key = "k7";
|
||||
bool eRes6[len + len1] = {false, false, true, true, false, true, false, true, true, false, false, false, false};
|
||||
|
@ -1773,7 +1773,7 @@ TEST(columnTest, json_column_logic_op) {
|
|||
taosMemoryFree(rightData);
|
||||
}
|
||||
|
||||
printf("--------------------json bool-- 0 {1, 8, 2, 2, 3, 0, 0, 0, 0}-------------------\n");
|
||||
(void)printf("--------------------json bool-- 0 {1, 8, 2, 2, 3, 0, 0, 0, 0}-------------------\n");
|
||||
|
||||
key = "k8";
|
||||
bool eRes7[len + len1] = {false, false, false, false, false, false, false, true, false, false, false, false, false};
|
||||
|
@ -1794,7 +1794,7 @@ TEST(columnTest, json_column_logic_op) {
|
|||
taosMemoryFree(rightData);
|
||||
}
|
||||
|
||||
printf("--------------------json string-- 6.6hello {1, 8, 2, 2, 3, 0, 0, 0, 0}-------------------\n");
|
||||
(void)printf("--------------------json string-- 6.6hello {1, 8, 2, 2, 3, 0, 0, 0, 0}-------------------\n");
|
||||
|
||||
key = "k9";
|
||||
bool eRes8[len + len1] = {false, false, false, false, false, false, false, true, true, false, true, true, true};
|
||||
|
@ -1811,14 +1811,14 @@ TEST(columnTest, json_column_logic_op) {
|
|||
for (int i = len; i < len + len1; i++) {
|
||||
void *rightData = prepareNchar(inputNchar[i - len]);
|
||||
if (i == 11) {
|
||||
printf("abc\n");
|
||||
(void)printf("abc\n");
|
||||
}
|
||||
code = makeCalculate(row, key, TSDB_DATA_TYPE_NCHAR, rightData, eRes8[i], op[i], false);
|
||||
ASSERT_EQ(code, TSDB_CODE_SUCCESS);
|
||||
taosMemoryFree(rightData);
|
||||
}
|
||||
|
||||
printf("---------------------json not exist-- NULL {1, 8, 2, 2, 3, 0, 0, 0, 0}------------------\n");
|
||||
(void)printf("---------------------json not exist-- NULL {1, 8, 2, 2, 3, 0, 0, 0, 0}------------------\n");
|
||||
|
||||
key = "k10"; // (NULL is true) return NULL, so use DBL_MAX represent NULL
|
||||
bool eRes9[len + len1] = {false, false, false, false, false, false, true, false, false, false, false, false, false};
|
||||
|
|
|
@ -143,7 +143,7 @@ SListNode* streamBackendAddCompare(void* backend, void* arg);
|
|||
void streamBackendDelCompare(void* backend, void* arg);
|
||||
int32_t streamStateCvtDataFormat(char* path, char* key, void* cfInst);
|
||||
|
||||
STaskDbWrapper* taskDbOpen(const char* path, const char* key, int64_t chkptId, int64_t* processVer);
|
||||
int32_t taskDbOpen(const char* path, const char* key, int64_t chkptId, int64_t* processVer, STaskDbWrapper** ppTaskDb);
|
||||
void taskDbDestroy(void* pBackend, bool flush);
|
||||
void taskDbDestroy2(void* pBackend);
|
||||
|
||||
|
@ -252,7 +252,7 @@ int32_t taskDbDestroySnap(void* arg, SArray* pSnapInfo);
|
|||
|
||||
int32_t taskDbDoCheckpoint(void* arg, int64_t chkpId, int64_t processId);
|
||||
|
||||
SBkdMgt* bkdMgtCreate(char* path);
|
||||
int32_t bkdMgtCreate(char* path, SBkdMgt **bm);
|
||||
int32_t bkdMgtAddChkp(SBkdMgt* bm, char* task, char* path);
|
||||
int32_t bkdMgtGetDelta(SBkdMgt* bm, char* taskId, int64_t chkpId, SArray* list, char* name);
|
||||
int32_t bkdMgtDumpTo(SBkdMgt* bm, char* taskId, char* dname);
|
||||
|
|
|
@ -2525,35 +2525,35 @@ _EXIT:
|
|||
return NULL;
|
||||
}
|
||||
|
||||
STaskDbWrapper* taskDbOpen(const char* path, const char* key, int64_t chkptId, int64_t* processVer) {
|
||||
int32_t taskDbOpen(const char* path, const char* key, int64_t chkptId, int64_t* processVer, STaskDbWrapper** ppTaskDb) {
|
||||
char* statePath = NULL;
|
||||
char* dbPath = NULL;
|
||||
int code = 0;
|
||||
terrno = 0;
|
||||
if ((code = restoreCheckpointData(path, key, chkptId, &statePath, &dbPath, processVer)) < 0) {
|
||||
terrno = code;
|
||||
stError("failed to restore checkpoint data, path:%s, key:%s, checkpointId: %" PRId64 "reason:%s", path, key,
|
||||
chkptId, tstrerror(terrno));
|
||||
return NULL;
|
||||
chkptId, tstrerror(code));
|
||||
return code;
|
||||
}
|
||||
|
||||
STaskDbWrapper* pTaskDb = taskDbOpenImpl(key, statePath, dbPath);
|
||||
if (pTaskDb != NULL) {
|
||||
int64_t chkpId = -1, ver = -1;
|
||||
if ((code = chkpLoadExtraInfo(dbPath, &chkpId, &ver) == 0)) {
|
||||
if ((code = chkpLoadExtraInfo(dbPath, &chkpId, &ver)) == 0) {
|
||||
*processVer = ver;
|
||||
} else {
|
||||
terrno = code;
|
||||
stError("failed to load extra info, path:%s, key:%s, checkpointId: %" PRId64 "reason:%s", path, key, chkptId,
|
||||
tstrerror(terrno));
|
||||
tstrerror(code));
|
||||
taskDbDestroy(pTaskDb, false);
|
||||
return NULL;
|
||||
return code;
|
||||
}
|
||||
} else {
|
||||
code = TSDB_CODE_INVALID_PARA;
|
||||
}
|
||||
|
||||
taosMemoryFree(dbPath);
|
||||
taosMemoryFree(statePath);
|
||||
return pTaskDb;
|
||||
*ppTaskDb = pTaskDb;
|
||||
return code;
|
||||
}
|
||||
|
||||
void taskDbDestroy(void* pDb, bool flush) {
|
||||
|
@ -2794,7 +2794,9 @@ int32_t streamStateCvtDataFormat(char* path, char* key, void* pCfInst) {
|
|||
int32_t code = 0;
|
||||
|
||||
int64_t processVer = -1;
|
||||
STaskDbWrapper* pTaskDb = taskDbOpen(path, key, 0, &processVer);
|
||||
STaskDbWrapper* pTaskDb = NULL;
|
||||
|
||||
code = taskDbOpen(path, key, 0, &processVer, &pTaskDb);
|
||||
RocksdbCfInst* pSrcBackend = pCfInst;
|
||||
|
||||
for (int i = 0; i < nCf; i++) {
|
||||
|
@ -4626,10 +4628,11 @@ int32_t dbChkpGetDelta(SDbChkp* p, int64_t chkpId, SArray* list) {
|
|||
|
||||
void dbChkpDestroy(SDbChkp* pChkp);
|
||||
|
||||
SDbChkp* dbChkpCreate(char* path, int64_t initChkpId) {
|
||||
int32_t dbChkpCreate(char* path, int64_t initChkpId, SDbChkp** ppChkp) {
|
||||
int32_t code = 0;
|
||||
SDbChkp* p = taosMemoryCalloc(1, sizeof(SDbChkp));
|
||||
if (p == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
goto _EXIT;
|
||||
}
|
||||
|
||||
|
@ -4637,41 +4640,41 @@ SDbChkp* dbChkpCreate(char* path, int64_t initChkpId) {
|
|||
p->preCkptId = -1;
|
||||
p->pSST = taosArrayInit(64, sizeof(void*));
|
||||
if (p->pSST == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
dbChkpDestroy(p);
|
||||
return NULL;
|
||||
return code;
|
||||
}
|
||||
|
||||
p->path = path;
|
||||
p->len = strlen(path) + 128;
|
||||
p->buf = taosMemoryCalloc(1, p->len);
|
||||
if (p->buf == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
goto _EXIT;
|
||||
}
|
||||
|
||||
p->idx = 0;
|
||||
p->pSstTbl[0] = taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_ENTRY_LOCK);
|
||||
if (p->pSstTbl[0] == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
goto _EXIT;
|
||||
}
|
||||
|
||||
p->pSstTbl[1] = taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_ENTRY_LOCK);
|
||||
if (p->pSstTbl[1] == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
goto _EXIT;
|
||||
}
|
||||
|
||||
p->pAdd = taosArrayInit(64, sizeof(void*));
|
||||
if (p->pAdd == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
goto _EXIT;
|
||||
}
|
||||
|
||||
p->pDel = taosArrayInit(64, sizeof(void*));
|
||||
if (p->pDel == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
goto _EXIT;
|
||||
}
|
||||
|
||||
|
@ -4679,15 +4682,15 @@ SDbChkp* dbChkpCreate(char* path, int64_t initChkpId) {
|
|||
taosThreadRwlockInit(&p->rwLock, NULL);
|
||||
|
||||
SArray* list = NULL;
|
||||
int32_t code = dbChkpGetDelta(p, initChkpId, list);
|
||||
code = dbChkpGetDelta(p, initChkpId, list);
|
||||
if (code != 0) {
|
||||
goto _EXIT;
|
||||
}
|
||||
|
||||
return p;
|
||||
*ppChkp = p;
|
||||
return code;
|
||||
_EXIT:
|
||||
dbChkpDestroy(p);
|
||||
return NULL;
|
||||
return code;
|
||||
}
|
||||
|
||||
void dbChkpDestroy(SDbChkp* pChkp) {
|
||||
|
@ -4880,35 +4883,36 @@ _ERROR:
|
|||
return code;
|
||||
}
|
||||
|
||||
SBkdMgt* bkdMgtCreate(char* path) {
|
||||
terrno = 0;
|
||||
int32_t bkdMgtCreate(char* path, SBkdMgt** mgt) {
|
||||
int32_t code = 0;
|
||||
SBkdMgt* p = taosMemoryCalloc(1, sizeof(SBkdMgt));
|
||||
if (p == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return NULL;
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return code;
|
||||
}
|
||||
|
||||
p->pDbChkpTbl = taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK);
|
||||
if (p->pDbChkpTbl == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
bkdMgtDestroy(p);
|
||||
return NULL;
|
||||
return code;
|
||||
}
|
||||
|
||||
p->path = taosStrdup(path);
|
||||
if (p->path == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
bkdMgtDestroy(p);
|
||||
return NULL;
|
||||
return code;
|
||||
}
|
||||
|
||||
if (taosThreadRwlockInit(&p->rwLock, NULL) != 0) {
|
||||
terrno = TAOS_SYSTEM_ERROR(errno);
|
||||
code = TAOS_SYSTEM_ERROR(errno);
|
||||
bkdMgtDestroy(p);
|
||||
return NULL;
|
||||
return code;
|
||||
}
|
||||
*mgt = p;
|
||||
|
||||
return p;
|
||||
return code;
|
||||
}
|
||||
|
||||
void bkdMgtDestroy(SBkdMgt* bm) {
|
||||
|
@ -4949,11 +4953,11 @@ int32_t bkdMgtGetDelta(SBkdMgt* bm, char* taskId, int64_t chkpId, SArray* list,
|
|||
return code;
|
||||
}
|
||||
|
||||
SDbChkp* p = dbChkpCreate(path, chkpId);
|
||||
if (p == NULL) {
|
||||
SDbChkp* p = NULL;
|
||||
code = dbChkpCreate(path, chkpId, &p);
|
||||
if (code != 0) {
|
||||
taosMemoryFree(path);
|
||||
taosThreadRwlockUnlock(&bm->rwLock);
|
||||
code = terrno;
|
||||
return code;
|
||||
}
|
||||
|
||||
|
@ -4986,8 +4990,9 @@ int32_t bkdMgtAddChkp(SBkdMgt* bm, char* task, char* path) {
|
|||
taosThreadRwlockWrlock(&bm->rwLock);
|
||||
SDbChkp** pp = taosHashGet(bm->pDbChkpTbl, task, strlen(task));
|
||||
if (pp == NULL) {
|
||||
SDbChkp* p = dbChkpCreate(path, 0);
|
||||
if (p != NULL) {
|
||||
SDbChkp* p = NULL;
|
||||
code = dbChkpCreate(path, 0, &p);
|
||||
if (code != 0) {
|
||||
taosHashPut(bm->pDbChkpTbl, task, strlen(task), &p, sizeof(void*));
|
||||
code = 0;
|
||||
}
|
||||
|
|
|
@ -68,12 +68,12 @@ static void streamMetaEnvInit() {
|
|||
}
|
||||
}
|
||||
|
||||
void streamMetaInit() { (void) taosThreadOnce(&streamMetaModuleInit, streamMetaEnvInit); }
|
||||
void streamMetaInit() { (void)taosThreadOnce(&streamMetaModuleInit, streamMetaEnvInit); }
|
||||
|
||||
void streamMetaCleanup() {
|
||||
(void) taosCloseRef(streamBackendId);
|
||||
(void) taosCloseRef(streamBackendCfWrapperId);
|
||||
(void) taosCloseRef(streamMetaId);
|
||||
(void)taosCloseRef(streamBackendId);
|
||||
(void)taosCloseRef(streamBackendCfWrapperId);
|
||||
(void)taosCloseRef(streamMetaId);
|
||||
|
||||
metaRefMgtCleanup();
|
||||
streamTimerCleanUp();
|
||||
|
@ -128,7 +128,7 @@ int32_t metaRefMgtAdd(int64_t vgId, int64_t* rid) {
|
|||
|
||||
code = taosHashPut(gMetaRefMgt.pTable, &vgId, sizeof(vgId), &list, sizeof(void*));
|
||||
if (code) {
|
||||
stError("vgId:%d failed to put into metaRef table, rid:%" PRId64, (int32_t) vgId, *rid);
|
||||
stError("vgId:%d failed to put into metaRef table, rid:%" PRId64, (int32_t)vgId, *rid);
|
||||
return code;
|
||||
}
|
||||
} else {
|
||||
|
@ -186,7 +186,7 @@ int32_t streamMetaCheckBackendCompatible(SStreamMeta* pMeta) {
|
|||
|
||||
code = tdbTbcMoveToFirst(pCur);
|
||||
if (code) {
|
||||
(void) tdbTbcClose(pCur);
|
||||
(void)tdbTbcClose(pCur);
|
||||
stError("vgId:%d failed to open stream meta file cursor, not perform compatible check", pMeta->vgId);
|
||||
return ret;
|
||||
}
|
||||
|
@ -215,7 +215,7 @@ int32_t streamMetaCheckBackendCompatible(SStreamMeta* pMeta) {
|
|||
|
||||
tdbFree(pKey);
|
||||
tdbFree(pVal);
|
||||
(void) tdbTbcClose(pCur);
|
||||
(void)tdbTbcClose(pCur);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -276,6 +276,7 @@ int32_t streamMetaMayCvtDbFormat(SStreamMeta* pMeta) {
|
|||
}
|
||||
|
||||
int32_t streamTaskSetDb(SStreamMeta* pMeta, SStreamTask* pTask, const char* key) {
|
||||
int32_t code = 0;
|
||||
int64_t chkpId = pTask->chkInfo.checkpointId;
|
||||
|
||||
streamMutexLock(&pMeta->backendMutex);
|
||||
|
@ -299,8 +300,8 @@ int32_t streamTaskSetDb(SStreamMeta* pMeta, SStreamTask* pTask, const char* key)
|
|||
STaskDbWrapper* pBackend = NULL;
|
||||
int64_t processVer = -1;
|
||||
while (1) {
|
||||
pBackend = taskDbOpen(pMeta->path, key, chkpId, &processVer);
|
||||
if (pBackend != NULL) {
|
||||
code = taskDbOpen(pMeta->path, key, chkpId, &processVer, &pBackend);
|
||||
if (code == 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -319,7 +320,7 @@ int32_t streamTaskSetDb(SStreamMeta* pMeta, SStreamTask* pTask, const char* key)
|
|||
|
||||
if (processVer != -1) pTask->chkInfo.processedVer = processVer;
|
||||
|
||||
int32_t code = taosHashPut(pMeta->pTaskDbUnique, key, strlen(key), &pBackend, sizeof(void*));
|
||||
code = taosHashPut(pMeta->pTaskDbUnique, key, strlen(key), &pBackend, sizeof(void*));
|
||||
if (code) {
|
||||
stError("s-task:0x%x failed to put taskDb backend, code:out of memory", pTask->id.taskId);
|
||||
}
|
||||
|
@ -469,8 +470,8 @@ int32_t streamMetaOpen(const char* path, void* ahandle, FTaskBuild buildTaskFn,
|
|||
|
||||
pMeta->qHandle = taosInitScheduler(32, 1, "stream-chkp", NULL);
|
||||
|
||||
pMeta->bkdChkptMgt = bkdMgtCreate(tpath);
|
||||
if (pMeta->bkdChkptMgt == NULL) {
|
||||
code = bkdMgtCreate(tpath, (SBkdMgt**)&pMeta->bkdChkptMgt);
|
||||
if (code != 0) {
|
||||
goto _err;
|
||||
}
|
||||
|
||||
|
@ -485,7 +486,7 @@ _err:
|
|||
if (pMeta->pTaskList) taosArrayDestroy(pMeta->pTaskList);
|
||||
if (pMeta->pTaskDb) (void)tdbTbClose(pMeta->pTaskDb);
|
||||
if (pMeta->pCheckpointDb) (void)tdbTbClose(pMeta->pCheckpointDb);
|
||||
if (pMeta->db) (void) tdbClose(pMeta->db);
|
||||
if (pMeta->db) (void)tdbClose(pMeta->db);
|
||||
if (pMeta->pHbInfo) taosMemoryFreeClear(pMeta->pHbInfo);
|
||||
if (pMeta->updateInfo.pTasks) taosHashCleanup(pMeta->updateInfo.pTasks);
|
||||
if (pMeta->startInfo.pReadyTaskSet) taosHashCleanup(pMeta->startInfo.pReadyTaskSet);
|
||||
|
@ -531,7 +532,7 @@ void streamMetaClear(SStreamMeta* pMeta) {
|
|||
// release the ref by timer
|
||||
if (p->info.delaySchedParam != 0 && p->info.fillHistory == 0) { // one more ref in timer
|
||||
stDebug("s-task:%s stop schedTimer, and (before) desc ref:%d", p->id.idStr, p->refCnt);
|
||||
(void) taosTmrStop(p->schedInfo.pDelayTimer);
|
||||
(void)taosTmrStop(p->schedInfo.pDelayTimer);
|
||||
p->info.delaySchedParam = 0;
|
||||
streamMetaReleaseTask(pMeta, p);
|
||||
}
|
||||
|
@ -566,7 +567,7 @@ void streamMetaClose(SStreamMeta* pMeta) {
|
|||
if (pMeta == NULL) {
|
||||
return;
|
||||
}
|
||||
(void) taosRemoveRef(streamMetaId, pMeta->rid);
|
||||
(void)taosRemoveRef(streamMetaId, pMeta->rid);
|
||||
}
|
||||
|
||||
void streamMetaCloseImpl(void* arg) {
|
||||
|
@ -583,10 +584,10 @@ void streamMetaCloseImpl(void* arg) {
|
|||
streamMetaWUnLock(pMeta);
|
||||
|
||||
// already log the error, ignore here
|
||||
(void) tdbAbort(pMeta->db, pMeta->txn);
|
||||
(void) tdbTbClose(pMeta->pTaskDb);
|
||||
(void) tdbTbClose(pMeta->pCheckpointDb);
|
||||
(void) tdbClose(pMeta->db);
|
||||
(void)tdbAbort(pMeta->db, pMeta->txn);
|
||||
(void)tdbTbClose(pMeta->pTaskDb);
|
||||
(void)tdbTbClose(pMeta->pCheckpointDb);
|
||||
(void)tdbClose(pMeta->db);
|
||||
|
||||
taosArrayDestroy(pMeta->pTaskList);
|
||||
taosArrayDestroy(pMeta->chkpSaved);
|
||||
|
@ -610,7 +611,7 @@ void streamMetaCloseImpl(void* arg) {
|
|||
bkdMgtDestroy(pMeta->bkdChkptMgt);
|
||||
|
||||
pMeta->role = NODE_ROLE_UNINIT;
|
||||
(void) taosThreadRwlockDestroy(&pMeta->lock);
|
||||
(void)taosThreadRwlockDestroy(&pMeta->lock);
|
||||
|
||||
taosMemoryFree(pMeta);
|
||||
stDebug("vgId:%d end to close stream meta", vgId);
|
||||
|
@ -691,13 +692,13 @@ int32_t streamMetaRegisterTask(SStreamMeta* pMeta, int64_t ver, SStreamTask* pTa
|
|||
|
||||
p = taosArrayPush(pMeta->pTaskList, &pTask->id);
|
||||
if (p == NULL) {
|
||||
stError("s-task:0x%"PRIx64" failed to register task into meta-list, code: out of memory", id.taskId);
|
||||
stError("s-task:0x%" PRIx64 " failed to register task into meta-list, code: out of memory", id.taskId);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
code = taosHashPut(pMeta->pTasksMap, &id, sizeof(id), &pTask, POINTER_BYTES);
|
||||
if (code) {
|
||||
stError("s-task:0x%"PRIx64" failed to register task into meta-list, code: out of memory", id.taskId);
|
||||
stError("s-task:0x%" PRIx64 " failed to register task into meta-list, code: out of memory", id.taskId);
|
||||
return code;
|
||||
}
|
||||
|
||||
|
@ -710,7 +711,7 @@ int32_t streamMetaRegisterTask(SStreamMeta* pMeta, int64_t ver, SStreamTask* pTa
|
|||
}
|
||||
|
||||
if (pTask->info.fillHistory == 0) {
|
||||
(void) atomic_add_fetch_32(&pMeta->numOfStreamTasks, 1);
|
||||
(void)atomic_add_fetch_32(&pMeta->numOfStreamTasks, 1);
|
||||
}
|
||||
|
||||
*pAdded = true;
|
||||
|
@ -779,7 +780,7 @@ static void doRemoveIdFromList(SArray* pTaskList, int32_t num, SStreamTaskId* id
|
|||
|
||||
static int32_t streamTaskSendTransSuccessMsg(SStreamTask* pTask, void* param) {
|
||||
if (pTask->info.taskLevel == TASK_LEVEL__SOURCE) {
|
||||
(void) streamTaskSendCheckpointSourceRsp(pTask);
|
||||
(void)streamTaskSendCheckpointSourceRsp(pTask);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -802,7 +803,7 @@ int32_t streamMetaUnregisterTask(SStreamMeta* pMeta, int64_t streamId, int32_t t
|
|||
}
|
||||
|
||||
// handle the dropping event
|
||||
(void) streamTaskHandleEventAsync(pTask->status.pSM, TASK_EVENT_DROPPING, streamTaskSendTransSuccessMsg, NULL);
|
||||
(void)streamTaskHandleEventAsync(pTask->status.pSM, TASK_EVENT_DROPPING, streamTaskSendTransSuccessMsg, NULL);
|
||||
} else {
|
||||
stDebug("vgId:%d failed to find the task:0x%x, it may be dropped already", pMeta->vgId, taskId);
|
||||
streamMetaWUnLock(pMeta);
|
||||
|
@ -841,12 +842,12 @@ int32_t streamMetaUnregisterTask(SStreamMeta* pMeta, int64_t streamId, int32_t t
|
|||
pTask = *ppTask;
|
||||
// it is an fill-history task, remove the related stream task's id that points to it
|
||||
if (pTask->info.fillHistory == 0) {
|
||||
(void) atomic_sub_fetch_32(&pMeta->numOfStreamTasks, 1);
|
||||
(void)atomic_sub_fetch_32(&pMeta->numOfStreamTasks, 1);
|
||||
}
|
||||
|
||||
(void) taosHashRemove(pMeta->pTasksMap, &id, sizeof(id));
|
||||
(void)taosHashRemove(pMeta->pTasksMap, &id, sizeof(id));
|
||||
doRemoveIdFromList(pMeta->pTaskList, (int32_t)taosArrayGetSize(pMeta->pTaskList), &pTask->id);
|
||||
(void) streamMetaRemoveTask(pMeta, &id);
|
||||
(void)streamMetaRemoveTask(pMeta, &id);
|
||||
|
||||
ASSERT(taosHashGetSize(pMeta->pTasksMap) == taosArrayGetSize(pMeta->pTaskList));
|
||||
streamMetaWUnLock(pMeta);
|
||||
|
@ -854,7 +855,7 @@ int32_t streamMetaUnregisterTask(SStreamMeta* pMeta, int64_t streamId, int32_t t
|
|||
ASSERT(pTask->status.timerActive == 0);
|
||||
if (pTask->info.delaySchedParam != 0 && pTask->info.fillHistory == 0) {
|
||||
stDebug("s-task:%s stop schedTimer, and (before) desc ref:%d", pTask->id.idStr, pTask->refCnt);
|
||||
(void) taosTmrStop(pTask->schedInfo.pDelayTimer);
|
||||
(void)taosTmrStop(pTask->schedInfo.pDelayTimer);
|
||||
pTask->info.delaySchedParam = 0;
|
||||
streamMetaReleaseTask(pMeta, pTask);
|
||||
}
|
||||
|
@ -915,7 +916,7 @@ int64_t streamMetaGetLatestCheckpointId(SStreamMeta* pMeta) {
|
|||
|
||||
code = tdbTbcMoveToFirst(pCur);
|
||||
if (code) {
|
||||
(void) tdbTbcClose(pCur);
|
||||
(void)tdbTbcClose(pCur);
|
||||
stError("failed to open stream meta file cursor, the latest checkpointId is 0, vgId:%d", pMeta->vgId);
|
||||
return checkpointId;
|
||||
}
|
||||
|
@ -975,7 +976,7 @@ void streamMetaLoadAllTasks(SStreamMeta* pMeta) {
|
|||
if (code) {
|
||||
stError("vgId:%d failed to open stream meta cursor, code:%s, not load any stream tasks", vgId, tstrerror(terrno));
|
||||
taosArrayDestroy(pRecycleList);
|
||||
(void) tdbTbcClose(pCur);
|
||||
(void)tdbTbcClose(pCur);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1008,7 +1009,7 @@ void streamMetaLoadAllTasks(SStreamMeta* pMeta) {
|
|||
tFreeStreamTask(pTask);
|
||||
|
||||
STaskId id = streamTaskGetTaskId(pTask);
|
||||
(void) taosArrayPush(pRecycleList, &id);
|
||||
(void)taosArrayPush(pRecycleList, &id);
|
||||
|
||||
int32_t total = taosArrayGetSize(pRecycleList);
|
||||
stDebug("s-task:0x%x is already dropped, add into recycle list, total:%d", taskId, total);
|
||||
|
@ -1029,7 +1030,7 @@ void streamMetaLoadAllTasks(SStreamMeta* pMeta) {
|
|||
continue;
|
||||
}
|
||||
|
||||
(void) taosArrayPush(pMeta->pTaskList, &pTask->id);
|
||||
(void)taosArrayPush(pMeta->pTaskList, &pTask->id);
|
||||
} else {
|
||||
// todo this should replace the existed object put by replay creating stream task msg from mnode
|
||||
stError("s-task:0x%x already added into table meta by replaying WAL, need check", pTask->id.taskId);
|
||||
|
@ -1039,17 +1040,17 @@ void streamMetaLoadAllTasks(SStreamMeta* pMeta) {
|
|||
|
||||
if (taosHashPut(pMeta->pTasksMap, &id, sizeof(id), &pTask, POINTER_BYTES) != 0) {
|
||||
stError("s-task:0x%x failed to put into hashTable, code:%s, continue", pTask->id.taskId, tstrerror(terrno));
|
||||
(void) taosArrayPop(pMeta->pTaskList);
|
||||
(void)taosArrayPop(pMeta->pTaskList);
|
||||
tFreeStreamTask(pTask);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (pTask->info.fillHistory == 0) {
|
||||
(void) atomic_add_fetch_32(&pMeta->numOfStreamTasks, 1);
|
||||
(void)atomic_add_fetch_32(&pMeta->numOfStreamTasks, 1);
|
||||
}
|
||||
|
||||
if (streamTaskShouldPause(pTask)) {
|
||||
(void) atomic_add_fetch_32(&pMeta->numOfPausedTasks, 1);
|
||||
(void)atomic_add_fetch_32(&pMeta->numOfPausedTasks, 1);
|
||||
}
|
||||
|
||||
ASSERT(pTask->status.downstreamReady == 0);
|
||||
|
@ -1065,7 +1066,7 @@ void streamMetaLoadAllTasks(SStreamMeta* pMeta) {
|
|||
if (taosArrayGetSize(pRecycleList) > 0) {
|
||||
for (int32_t i = 0; i < taosArrayGetSize(pRecycleList); ++i) {
|
||||
STaskId* pId = taosArrayGet(pRecycleList, i);
|
||||
(void) streamMetaRemoveTask(pMeta, pId);
|
||||
(void)streamMetaRemoveTask(pMeta, pId);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1093,7 +1094,7 @@ bool streamMetaTaskInTimer(SStreamMeta* pMeta) {
|
|||
SStreamTask* pTask = *(SStreamTask**)pIter;
|
||||
if (pTask->status.timerActive >= 1) {
|
||||
stDebug("s-task:%s in timer, blocking tasks in vgId:%d restart, set closing again", pTask->id.idStr, pMeta->vgId);
|
||||
(void) streamTaskStop(pTask);
|
||||
(void)streamTaskStop(pTask);
|
||||
inTimer = true;
|
||||
}
|
||||
}
|
||||
|
@ -1126,7 +1127,7 @@ void streamMetaNotifyClose(SStreamMeta* pMeta) {
|
|||
|
||||
SStreamTask* pTask = *(SStreamTask**)pIter;
|
||||
stDebug("vgId:%d s-task:%s set task closing flag", vgId, pTask->id.idStr);
|
||||
(void) streamTaskStop(pTask);
|
||||
(void)streamTaskStop(pTask);
|
||||
}
|
||||
|
||||
streamMetaWUnLock(pMeta);
|
||||
|
@ -1173,7 +1174,7 @@ void streamMetaResetStartInfo(STaskStartInfo* pStartInfo, int32_t vgId) {
|
|||
|
||||
void streamMetaRLock(SStreamMeta* pMeta) {
|
||||
// stTrace("vgId:%d meta-rlock", pMeta->vgId);
|
||||
(void) taosThreadRwlockRdlock(&pMeta->lock);
|
||||
(void)taosThreadRwlockRdlock(&pMeta->lock);
|
||||
}
|
||||
|
||||
void streamMetaRUnLock(SStreamMeta* pMeta) {
|
||||
|
@ -1188,13 +1189,13 @@ void streamMetaRUnLock(SStreamMeta* pMeta) {
|
|||
|
||||
void streamMetaWLock(SStreamMeta* pMeta) {
|
||||
// stTrace("vgId:%d meta-wlock", pMeta->vgId);
|
||||
(void) taosThreadRwlockWrlock(&pMeta->lock);
|
||||
(void)taosThreadRwlockWrlock(&pMeta->lock);
|
||||
// stTrace("vgId:%d meta-wlock completed", pMeta->vgId);
|
||||
}
|
||||
|
||||
void streamMetaWUnLock(SStreamMeta* pMeta) {
|
||||
// stTrace("vgId:%d meta-wunlock", pMeta->vgId);
|
||||
(void) taosThreadRwlockUnlock(&pMeta->lock);
|
||||
(void)taosThreadRwlockUnlock(&pMeta->lock);
|
||||
}
|
||||
|
||||
int32_t streamMetaSendMsgBeforeCloseTasks(SStreamMeta* pMeta, SArray** pList) {
|
||||
|
@ -1320,7 +1321,7 @@ int32_t streamMetaStartAllTasks(SStreamMeta* pMeta) {
|
|||
code = streamMetaAcquireTask(pMeta, pTaskId->streamId, pTaskId->taskId, &pTask);
|
||||
if (pTask == NULL) {
|
||||
stError("vgId:%d failed to acquire task:0x%x during start tasks", pMeta->vgId, pTaskId->taskId);
|
||||
(void) streamMetaAddFailedTask(pMeta, pTaskId->streamId, pTaskId->taskId);
|
||||
(void)streamMetaAddFailedTask(pMeta, pTaskId->streamId, pTaskId->taskId);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -1343,7 +1344,7 @@ int32_t streamMetaStartAllTasks(SStreamMeta* pMeta) {
|
|||
code = streamMetaAcquireTask(pMeta, pTaskId->streamId, pTaskId->taskId, &pTask);
|
||||
if (pTask == NULL) {
|
||||
stError("vgId:%d failed to acquire task:0x%x during start tasks", pMeta->vgId, pTaskId->taskId);
|
||||
(void) streamMetaAddFailedTask(pMeta, pTaskId->streamId, pTaskId->taskId);
|
||||
(void)streamMetaAddFailedTask(pMeta, pTaskId->streamId, pTaskId->taskId);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -1361,10 +1362,11 @@ int32_t streamMetaStartAllTasks(SStreamMeta* pMeta) {
|
|||
if (HAS_RELATED_FILLHISTORY_TASK(pTask)) {
|
||||
stDebug("s-task:%s downstream ready, no need to check downstream, check only related fill-history task",
|
||||
pTask->id.idStr);
|
||||
(void) streamLaunchFillHistoryTask(pTask); // todo: how about retry launch fill-history task?
|
||||
(void)streamLaunchFillHistoryTask(pTask); // todo: how about retry launch fill-history task?
|
||||
}
|
||||
|
||||
(void) streamMetaAddTaskLaunchResult(pMeta, pTaskId->streamId, pTaskId->taskId, pInfo->checkTs, pInfo->readyTs, true);
|
||||
(void)streamMetaAddTaskLaunchResult(pMeta, pTaskId->streamId, pTaskId->taskId, pInfo->checkTs, pInfo->readyTs,
|
||||
true);
|
||||
streamMetaReleaseTask(pMeta, pTask);
|
||||
continue;
|
||||
}
|
||||
|
@ -1427,7 +1429,7 @@ int32_t streamMetaStopAllTasks(SStreamMeta* pMeta) {
|
|||
continue;
|
||||
}
|
||||
|
||||
(void) streamTaskStop(pTask);
|
||||
(void)streamTaskStop(pTask);
|
||||
streamMetaReleaseTask(pMeta, pTask);
|
||||
}
|
||||
|
||||
|
@ -1467,7 +1469,7 @@ int32_t streamMetaStartOneTask(SStreamMeta* pMeta, int64_t streamId, int32_t tas
|
|||
code = streamMetaAcquireTask(pMeta, streamId, taskId, &pTask);
|
||||
if (pTask == NULL) {
|
||||
stError("vgId:%d failed to acquire task:0x%x when starting task", pMeta->vgId, taskId);
|
||||
(void) streamMetaAddFailedTask(pMeta, streamId, taskId);
|
||||
(void)streamMetaAddFailedTask(pMeta, streamId, taskId);
|
||||
return TSDB_CODE_STREAM_TASK_IVLD_STATUS;
|
||||
}
|
||||
|
||||
|
@ -1560,7 +1562,6 @@ int32_t streamMetaAddTaskLaunchResult(SStreamMeta* pMeta, int64_t streamId, int3
|
|||
STaskInitTs initTs = {.start = startTs, .end = endTs, .success = ready};
|
||||
int32_t code = taosHashPut(pDst, &id, sizeof(id), &initTs, sizeof(STaskInitTs));
|
||||
if (code) {
|
||||
|
||||
}
|
||||
|
||||
int32_t numOfTotal = streamMetaGetNumOfTasks(pMeta);
|
||||
|
@ -1632,9 +1633,9 @@ int32_t streamMetaAddFailedTask(SStreamMeta* pMeta, int64_t streamId, int32_t ta
|
|||
streamMetaRUnLock(pMeta);
|
||||
|
||||
// add the failed task info, along with the related fill-history task info into tasks list.
|
||||
(void) streamMetaAddTaskLaunchResult(pMeta, streamId, taskId, startTs, now, false);
|
||||
(void)streamMetaAddTaskLaunchResult(pMeta, streamId, taskId, startTs, now, false);
|
||||
if (hasFillhistoryTask) {
|
||||
(void) streamMetaAddTaskLaunchResult(pMeta, hId.streamId, hId.taskId, startTs, now, false);
|
||||
(void)streamMetaAddTaskLaunchResult(pMeta, hId.streamId, hId.taskId, startTs, now, false);
|
||||
}
|
||||
} else {
|
||||
streamMetaRUnLock(pMeta);
|
||||
|
@ -1649,12 +1650,12 @@ int32_t streamMetaAddFailedTask(SStreamMeta* pMeta, int64_t streamId, int32_t ta
|
|||
|
||||
void streamMetaAddFailedTaskSelf(SStreamTask* pTask, int64_t failedTs) {
|
||||
int32_t startTs = pTask->execInfo.checkTs;
|
||||
(void) streamMetaAddTaskLaunchResult(pTask->pMeta, pTask->id.streamId, pTask->id.taskId, startTs, failedTs, false);
|
||||
(void)streamMetaAddTaskLaunchResult(pTask->pMeta, pTask->id.streamId, pTask->id.taskId, startTs, failedTs, false);
|
||||
|
||||
// automatically set the related fill-history task to be failed.
|
||||
if (HAS_RELATED_FILLHISTORY_TASK(pTask)) {
|
||||
STaskId* pId = &pTask->hTaskInfo.id;
|
||||
(void) streamMetaAddTaskLaunchResult(pTask->pMeta, pId->streamId, pId->taskId, startTs, failedTs, false);
|
||||
(void)streamMetaAddTaskLaunchResult(pTask->pMeta, pId->streamId, pId->taskId, startTs, failedTs, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -432,13 +432,12 @@ TEST_F(BackendEnv, checkOpen) {
|
|||
const char *path = "/tmp/backend/stream";
|
||||
const char *dump = "/tmp/backend/stream/dump";
|
||||
// taosMkDir(dump);
|
||||
code = taosMulMkDir(dump);
|
||||
ASSERT(code == 0);
|
||||
taosMulMkDir(dump);
|
||||
SBkdMgt *mgt = NULL;
|
||||
|
||||
SBkdMgt *mgt = bkdMgtCreate((char *)path);
|
||||
code = bkdMgtCreate((char *)path, &mgt);
|
||||
SArray *result = taosArrayInit(4, sizeof(void *));
|
||||
code = bkdMgtGetDelta(mgt, p->pTdbState->idstr, 3, result, (char *)dump);
|
||||
ASSERT(code == 0);
|
||||
bkdMgtGetDelta(mgt, p->pTdbState->idstr, 3, result, (char *)dump);
|
||||
|
||||
code = taskDbDoCheckpoint(p->pTdbState->pOwner->pBackend, 4, 0);
|
||||
ASSERT(code == 0);
|
||||
|
|
|
@ -53,7 +53,7 @@ TEST(TD_STREAM_UPDATE_TEST, update) {
|
|||
void *p = NULL;
|
||||
// SBackendWrapper *p = streamBackendInit(streamPath, -1, 2);
|
||||
// p = taskDbOpen((char *)streamPath, (char *)"test", -1);
|
||||
p = bkdMgtCreate((char *)streamPath);
|
||||
int32_t code = bkdMgtCreate((char *)streamPath, (SBkdMgt **)&p);
|
||||
|
||||
// const int64_t interval = 20 * 1000;
|
||||
// const int64_t watermark = 10 * 60 * 1000;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue