ehn: remove void
This commit is contained in:
parent
2560bc51ed
commit
ea5a2a6946
|
@ -1292,7 +1292,10 @@ int32_t s3DeleteObjects(const char *object_name[], int nobject) {
|
||||||
void s3DeleteObjectsByPrefix(const char *prefix) {
|
void s3DeleteObjectsByPrefix(const char *prefix) {
|
||||||
SArray *objectArray = getListByPrefix(prefix);
|
SArray *objectArray = getListByPrefix(prefix);
|
||||||
if (objectArray == NULL) return;
|
if (objectArray == NULL) return;
|
||||||
(void)s3DeleteObjects(TARRAY_DATA(objectArray), TARRAY_SIZE(objectArray));
|
int32_t code = s3DeleteObjects(TARRAY_DATA(objectArray), TARRAY_SIZE(objectArray));
|
||||||
|
if (code) {
|
||||||
|
uError("failed to delete objects with prefix %s", prefix);
|
||||||
|
}
|
||||||
taosArrayDestroyEx(objectArray, s3FreeObjectKey);
|
taosArrayDestroyEx(objectArray, s3FreeObjectKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2299,11 +2299,14 @@ static int taosLogVarComp(void const *lp, void const *rp) {
|
||||||
return strcasecmp(lpVar->name, rpVar->name);
|
return strcasecmp(lpVar->name, rpVar->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t taosCheckAndSetDebugFlag(int32_t *pFlagPtr, char *name, int32_t flag, SArray *noNeedToSetVars) {
|
static void taosCheckAndSetDebugFlag(int32_t *pFlagPtr, char *name, int32_t flag, SArray *noNeedToSetVars) {
|
||||||
if (noNeedToSetVars != NULL && taosArraySearch(noNeedToSetVars, name, taosLogVarComp, TD_EQ) != NULL) {
|
if (noNeedToSetVars != NULL && taosArraySearch(noNeedToSetVars, name, taosLogVarComp, TD_EQ) != NULL) {
|
||||||
TAOS_RETURN(TSDB_CODE_SUCCESS);
|
return;
|
||||||
}
|
}
|
||||||
return taosSetDebugFlag(pFlagPtr, name, flag);
|
if (taosSetDebugFlag(pFlagPtr, name, flag) != 0) {
|
||||||
|
uError("failed to set flag %s to %d", name, flag);
|
||||||
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t taosSetGlobalDebugFlag(int32_t flag) { return taosSetAllDebugFlag(tsCfg, flag); }
|
int32_t taosSetGlobalDebugFlag(int32_t flag) { return taosSetAllDebugFlag(tsCfg, flag); }
|
||||||
|
@ -2320,29 +2323,29 @@ static int32_t taosSetAllDebugFlag(SConfig *pCfg, int32_t flag) {
|
||||||
pItem->i32 = flag;
|
pItem->i32 = flag;
|
||||||
noNeedToSetVars = pItem->array;
|
noNeedToSetVars = pItem->array;
|
||||||
|
|
||||||
(void)taosCheckAndSetDebugFlag(&simDebugFlag, "simDebugFlag", flag, noNeedToSetVars);
|
taosCheckAndSetDebugFlag(&simDebugFlag, "simDebugFlag", flag, noNeedToSetVars);
|
||||||
(void)taosCheckAndSetDebugFlag(&uDebugFlag, "uDebugFlag", flag, noNeedToSetVars);
|
taosCheckAndSetDebugFlag(&uDebugFlag, "uDebugFlag", flag, noNeedToSetVars);
|
||||||
(void)taosCheckAndSetDebugFlag(&rpcDebugFlag, "rpcDebugFlag", flag, noNeedToSetVars);
|
taosCheckAndSetDebugFlag(&rpcDebugFlag, "rpcDebugFlag", flag, noNeedToSetVars);
|
||||||
(void)taosCheckAndSetDebugFlag(&qDebugFlag, "qDebugFlag", flag, noNeedToSetVars);
|
taosCheckAndSetDebugFlag(&qDebugFlag, "qDebugFlag", flag, noNeedToSetVars);
|
||||||
|
|
||||||
(void)taosCheckAndSetDebugFlag(&jniDebugFlag, "jniDebugFlag", flag, noNeedToSetVars);
|
taosCheckAndSetDebugFlag(&jniDebugFlag, "jniDebugFlag", flag, noNeedToSetVars);
|
||||||
(void)taosCheckAndSetDebugFlag(&cDebugFlag, "cDebugFlag", flag, noNeedToSetVars);
|
taosCheckAndSetDebugFlag(&cDebugFlag, "cDebugFlag", flag, noNeedToSetVars);
|
||||||
|
|
||||||
(void)taosCheckAndSetDebugFlag(&dDebugFlag, "dDebugFlag", flag, noNeedToSetVars);
|
taosCheckAndSetDebugFlag(&dDebugFlag, "dDebugFlag", flag, noNeedToSetVars);
|
||||||
(void)taosCheckAndSetDebugFlag(&vDebugFlag, "vDebugFlag", flag, noNeedToSetVars);
|
taosCheckAndSetDebugFlag(&vDebugFlag, "vDebugFlag", flag, noNeedToSetVars);
|
||||||
(void)taosCheckAndSetDebugFlag(&mDebugFlag, "mDebugFlag", flag, noNeedToSetVars);
|
taosCheckAndSetDebugFlag(&mDebugFlag, "mDebugFlag", flag, noNeedToSetVars);
|
||||||
(void)taosCheckAndSetDebugFlag(&wDebugFlag, "wDebugFlag", flag, noNeedToSetVars);
|
taosCheckAndSetDebugFlag(&wDebugFlag, "wDebugFlag", flag, noNeedToSetVars);
|
||||||
(void)taosCheckAndSetDebugFlag(&sDebugFlag, "sDebugFlag", flag, noNeedToSetVars);
|
taosCheckAndSetDebugFlag(&sDebugFlag, "sDebugFlag", flag, noNeedToSetVars);
|
||||||
(void)taosCheckAndSetDebugFlag(&tsdbDebugFlag, "tsdbDebugFlag", flag, noNeedToSetVars);
|
taosCheckAndSetDebugFlag(&tsdbDebugFlag, "tsdbDebugFlag", flag, noNeedToSetVars);
|
||||||
(void)taosCheckAndSetDebugFlag(&tqDebugFlag, "tqDebugFlag", flag, noNeedToSetVars);
|
taosCheckAndSetDebugFlag(&tqDebugFlag, "tqDebugFlag", flag, noNeedToSetVars);
|
||||||
(void)taosCheckAndSetDebugFlag(&fsDebugFlag, "fsDebugFlag", flag, noNeedToSetVars);
|
taosCheckAndSetDebugFlag(&fsDebugFlag, "fsDebugFlag", flag, noNeedToSetVars);
|
||||||
(void)taosCheckAndSetDebugFlag(&udfDebugFlag, "udfDebugFlag", flag, noNeedToSetVars);
|
taosCheckAndSetDebugFlag(&udfDebugFlag, "udfDebugFlag", flag, noNeedToSetVars);
|
||||||
(void)taosCheckAndSetDebugFlag(&smaDebugFlag, "smaDebugFlag", flag, noNeedToSetVars);
|
taosCheckAndSetDebugFlag(&smaDebugFlag, "smaDebugFlag", flag, noNeedToSetVars);
|
||||||
(void)taosCheckAndSetDebugFlag(&idxDebugFlag, "idxDebugFlag", flag, noNeedToSetVars);
|
taosCheckAndSetDebugFlag(&idxDebugFlag, "idxDebugFlag", flag, noNeedToSetVars);
|
||||||
(void)taosCheckAndSetDebugFlag(&tdbDebugFlag, "tdbDebugFlag", flag, noNeedToSetVars);
|
taosCheckAndSetDebugFlag(&tdbDebugFlag, "tdbDebugFlag", flag, noNeedToSetVars);
|
||||||
(void)taosCheckAndSetDebugFlag(&metaDebugFlag, "metaDebugFlag", flag, noNeedToSetVars);
|
taosCheckAndSetDebugFlag(&metaDebugFlag, "metaDebugFlag", flag, noNeedToSetVars);
|
||||||
(void)taosCheckAndSetDebugFlag(&stDebugFlag, "stDebugFlag", flag, noNeedToSetVars);
|
taosCheckAndSetDebugFlag(&stDebugFlag, "stDebugFlag", flag, noNeedToSetVars);
|
||||||
(void)taosCheckAndSetDebugFlag(&sndDebugFlag, "sndDebugFlag", flag, noNeedToSetVars);
|
taosCheckAndSetDebugFlag(&sndDebugFlag, "sndDebugFlag", flag, noNeedToSetVars);
|
||||||
|
|
||||||
taosArrayClear(noNeedToSetVars); // reset array
|
taosArrayClear(noNeedToSetVars); // reset array
|
||||||
|
|
||||||
|
|
|
@ -354,8 +354,10 @@ bool tdSKvRowGetVal(STSRow *pRow, col_id_t colId, col_id_t colIdx, SCellVal *pVa
|
||||||
}
|
}
|
||||||
|
|
||||||
void *pBitmap = tdGetBitmapAddrKv(pRow, tdRowGetNCols(pRow));
|
void *pBitmap = tdGetBitmapAddrKv(pRow, tdRowGetNCols(pRow));
|
||||||
(void)tdGetKvRowValOfCol(pVal, pRow, pBitmap, pColIdx->offset,
|
if (tdGetKvRowValOfCol(pVal, pRow, pBitmap, pColIdx->offset,
|
||||||
POINTER_DISTANCE(pColIdx, TD_ROW_COL_IDX(pRow)) / sizeof(SKvRowIdx));
|
POINTER_DISTANCE(pColIdx, TD_ROW_COL_IDX(pRow)) / sizeof(SKvRowIdx)) != TSDB_CODE_SUCCESS) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,9 @@ static int64_t m_deltaUtc = 0;
|
||||||
|
|
||||||
void deltaToUtcInitOnce() {
|
void deltaToUtcInitOnce() {
|
||||||
struct tm tm = {0};
|
struct tm tm = {0};
|
||||||
(void)taosStrpTime("1970-01-01 00:00:00", (const char*)("%Y-%m-%d %H:%M:%S"), &tm);
|
if (taosStrpTime("1970-01-01 00:00:00", (const char*)("%Y-%m-%d %H:%M:%S"), &tm) != 0) {
|
||||||
|
uError("failed to parse time string");
|
||||||
|
}
|
||||||
m_deltaUtc = (int64_t)taosMktime(&tm);
|
m_deltaUtc = (int64_t)taosMktime(&tm);
|
||||||
// printf("====delta:%lld\n\n", seconds);
|
// printf("====delta:%lld\n\n", seconds);
|
||||||
}
|
}
|
||||||
|
@ -689,10 +691,10 @@ int64_t taosTimeAdd(int64_t t, int64_t duration, char unit, int32_t precision) {
|
||||||
int64_t numOfMonth = (unit == 'y') ? duration * 12 : duration;
|
int64_t numOfMonth = (unit == 'y') ? duration * 12 : duration;
|
||||||
int64_t fraction = t % TSDB_TICK_PER_SECOND(precision);
|
int64_t fraction = t % TSDB_TICK_PER_SECOND(precision);
|
||||||
|
|
||||||
struct tm tm;
|
struct tm tm;
|
||||||
time_t tt = (time_t)(t / TSDB_TICK_PER_SECOND(precision));
|
time_t tt = (time_t)(t / TSDB_TICK_PER_SECOND(precision));
|
||||||
(void)taosLocalTime(&tt, &tm, NULL);
|
struct tm* ptm = taosLocalTime(&tt, &tm, NULL);
|
||||||
int32_t mon = tm.tm_year * 12 + tm.tm_mon + (int32_t)numOfMonth;
|
int32_t mon = tm.tm_year * 12 + tm.tm_mon + (int32_t)numOfMonth;
|
||||||
tm.tm_year = mon / 12;
|
tm.tm_year = mon / 12;
|
||||||
tm.tm_mon = mon % 12;
|
tm.tm_mon = mon % 12;
|
||||||
int daysOfMonth[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
|
int daysOfMonth[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
|
||||||
|
@ -750,13 +752,13 @@ int32_t taosTimeCountIntervalForFill(int64_t skey, int64_t ekey, int64_t interva
|
||||||
skey /= (int64_t)(TSDB_TICK_PER_SECOND(precision));
|
skey /= (int64_t)(TSDB_TICK_PER_SECOND(precision));
|
||||||
ekey /= (int64_t)(TSDB_TICK_PER_SECOND(precision));
|
ekey /= (int64_t)(TSDB_TICK_PER_SECOND(precision));
|
||||||
|
|
||||||
struct tm tm;
|
struct tm tm;
|
||||||
time_t t = (time_t)skey;
|
time_t t = (time_t)skey;
|
||||||
(void)taosLocalTime(&t, &tm, NULL);
|
struct tm* ptm = taosLocalTime(&t, &tm, NULL);
|
||||||
int32_t smon = tm.tm_year * 12 + tm.tm_mon;
|
int32_t smon = tm.tm_year * 12 + tm.tm_mon;
|
||||||
|
|
||||||
t = (time_t)ekey;
|
t = (time_t)ekey;
|
||||||
(void)taosLocalTime(&t, &tm, NULL);
|
ptm = taosLocalTime(&t, &tm, NULL);
|
||||||
int32_t emon = tm.tm_year * 12 + tm.tm_mon;
|
int32_t emon = tm.tm_year * 12 + tm.tm_mon;
|
||||||
|
|
||||||
if (unit == 'y') {
|
if (unit == 'y') {
|
||||||
|
@ -778,9 +780,9 @@ int64_t taosTimeTruncate(int64_t ts, const SInterval* pInterval) {
|
||||||
|
|
||||||
if (IS_CALENDAR_TIME_DURATION(pInterval->slidingUnit)) {
|
if (IS_CALENDAR_TIME_DURATION(pInterval->slidingUnit)) {
|
||||||
start /= (int64_t)(TSDB_TICK_PER_SECOND(precision));
|
start /= (int64_t)(TSDB_TICK_PER_SECOND(precision));
|
||||||
struct tm tm;
|
struct tm tm;
|
||||||
time_t tt = (time_t)start;
|
time_t tt = (time_t)start;
|
||||||
(void)taosLocalTime(&tt, &tm, NULL);
|
struct tm* ptm = taosLocalTime(&tt, &tm, NULL);
|
||||||
tm.tm_sec = 0;
|
tm.tm_sec = 0;
|
||||||
tm.tm_min = 0;
|
tm.tm_min = 0;
|
||||||
tm.tm_hour = 0;
|
tm.tm_hour = 0;
|
||||||
|
|
|
@ -21,29 +21,29 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define SERIALIZE_MEM_TO_BUF(buf, key, mem) \
|
#define SERIALIZE_MEM_TO_BUF(buf, key, mem) \
|
||||||
do { \
|
do { \
|
||||||
TAOS_UNUSED(memcpy((void *)buf, (void *)(&key->mem), sizeof(key->mem))); \
|
(void)memcpy((void *)buf, (void *)(&key->mem), sizeof(key->mem)); \
|
||||||
buf += sizeof(key->mem); \
|
buf += sizeof(key->mem); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define SERIALIZE_STR_MEM_TO_BUF(buf, key, mem, len) \
|
#define SERIALIZE_STR_MEM_TO_BUF(buf, key, mem, len) \
|
||||||
do { \
|
do { \
|
||||||
TAOS_UNUSED(memcpy((void *)buf, (void *)key->mem, len)); \
|
(void)memcpy((void *)buf, (void *)key->mem, len); \
|
||||||
buf += len; \
|
buf += len; \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define SERIALIZE_VAR_TO_BUF(buf, var, type) \
|
#define SERIALIZE_VAR_TO_BUF(buf, var, type) \
|
||||||
do { \
|
do { \
|
||||||
type c = var; \
|
type c = var; \
|
||||||
TAOS_UNUSED(memcpy((void *)buf, (void *)&c, sizeof(c))); \
|
(void)memcpy((void *)buf, (void *)&c, sizeof(c)); \
|
||||||
buf += sizeof(c); \
|
buf += sizeof(c); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define SERIALIZE_STR_VAR_TO_BUF(buf, var, len) \
|
#define SERIALIZE_STR_VAR_TO_BUF(buf, var, len) \
|
||||||
do { \
|
do { \
|
||||||
TAOS_UNUSED(memcpy((void *)buf, (void *)var, len)); \
|
(void)memcpy((void *)buf, (void *)var, len); \
|
||||||
buf += len; \
|
buf += len; \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define INDEX_MERGE_ADD_DEL(src, dst, tgt) \
|
#define INDEX_MERGE_ADD_DEL(src, dst, tgt) \
|
||||||
|
|
|
@ -427,7 +427,9 @@ void cleanDir(const char* pPath, const char* id) {
|
||||||
|
|
||||||
if (taosIsDir(pPath)) {
|
if (taosIsDir(pPath)) {
|
||||||
taosRemoveDir(pPath);
|
taosRemoveDir(pPath);
|
||||||
TAOS_UNUSED(taosMkDir(pPath));
|
if (taosMkDir(pPath) != 0) {
|
||||||
|
stError("%s failed to create dir:%s", id, pPath);
|
||||||
|
}
|
||||||
stInfo("%s clear dir:%s, succ", id, pPath);
|
stInfo("%s clear dir:%s, succ", id, pPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -833,8 +835,12 @@ int32_t streamBackendInit(const char* streamPath, int64_t chkpId, int32_t vgId,
|
||||||
pHandle->list = tdListNew(sizeof(SCfComparator));
|
pHandle->list = tdListNew(sizeof(SCfComparator));
|
||||||
TSDB_CHECK_NULL(pHandle->list, code, lino, _EXIT, terrno);
|
TSDB_CHECK_NULL(pHandle->list, code, lino, _EXIT, terrno);
|
||||||
|
|
||||||
TAOS_UNUSED(taosThreadMutexInit(&pHandle->mutex, NULL));
|
code = taosThreadMutexInit(&pHandle->mutex, NULL);
|
||||||
TAOS_UNUSED(taosThreadMutexInit(&pHandle->cfMutex, NULL));
|
TSDB_CHECK_CODE(code, lino, _EXIT);
|
||||||
|
|
||||||
|
code = taosThreadMutexInit(&pHandle->cfMutex, NULL);
|
||||||
|
TSDB_CHECK_CODE(code, lino, _EXIT);
|
||||||
|
|
||||||
pHandle->cfInst = taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_NO_LOCK);
|
pHandle->cfInst = taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_NO_LOCK);
|
||||||
TSDB_CHECK_NULL(pHandle->cfInst, code, lino, _EXIT, terrno);
|
TSDB_CHECK_NULL(pHandle->cfInst, code, lino, _EXIT, terrno);
|
||||||
|
|
||||||
|
@ -2583,7 +2589,9 @@ STaskDbWrapper* taskDbOpenImpl(const char* key, char* statePath, char* dbPath) {
|
||||||
pTaskDb->idstr = key ? taosStrdup(key) : NULL;
|
pTaskDb->idstr = key ? taosStrdup(key) : NULL;
|
||||||
pTaskDb->path = statePath ? taosStrdup(statePath) : NULL;
|
pTaskDb->path = statePath ? taosStrdup(statePath) : NULL;
|
||||||
|
|
||||||
TAOS_UNUSED(taosThreadMutexInit(&pTaskDb->mutex, NULL));
|
code = taosThreadMutexInit(&pTaskDb->mutex, NULL);
|
||||||
|
TSDB_CHECK_CODE(code, lino, _EXIT);
|
||||||
|
|
||||||
taskDbInitChkpOpt(pTaskDb);
|
taskDbInitChkpOpt(pTaskDb);
|
||||||
taskDbInitOpt(pTaskDb);
|
taskDbInitOpt(pTaskDb);
|
||||||
|
|
||||||
|
|
|
@ -352,7 +352,9 @@ static void httpAsyncCb(uv_async_t* handle) {
|
||||||
static int32_t BATCH_SIZE = 20;
|
static int32_t BATCH_SIZE = 20;
|
||||||
int32_t count = 0;
|
int32_t count = 0;
|
||||||
|
|
||||||
TAOS_UNUSED(taosThreadMutexLock(&item->mtx));
|
if ((taosThreadMutexLock(&item->mtx)) != 0) {
|
||||||
|
tError("http-report failed to lock mutex");
|
||||||
|
}
|
||||||
httpMayDiscardMsg(http, item);
|
httpMayDiscardMsg(http, item);
|
||||||
|
|
||||||
while (!QUEUE_IS_EMPTY(&item->qmsg) && count++ < BATCH_SIZE) {
|
while (!QUEUE_IS_EMPTY(&item->qmsg) && count++ < BATCH_SIZE) {
|
||||||
|
@ -360,7 +362,9 @@ static void httpAsyncCb(uv_async_t* handle) {
|
||||||
QUEUE_REMOVE(h);
|
QUEUE_REMOVE(h);
|
||||||
QUEUE_PUSH(&wq, h);
|
QUEUE_PUSH(&wq, h);
|
||||||
}
|
}
|
||||||
TAOS_UNUSED(taosThreadMutexUnlock(&item->mtx));
|
if (taosThreadMutexUnlock(&item->mtx) != 0) {
|
||||||
|
tError("http-report failed to unlock mutex");
|
||||||
|
}
|
||||||
|
|
||||||
httpTrace(&wq);
|
httpTrace(&wq);
|
||||||
|
|
||||||
|
@ -848,7 +852,9 @@ void taosDestroyHttpChan(int64_t chanId) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
TAOS_UNUSED(taosThreadJoin(load->thread, NULL));
|
if (taosThreadJoin(load->thread, NULL) != 0) {
|
||||||
|
tTrace("http-report failed to join thread, chanId %" PRId64 "", chanId);
|
||||||
|
}
|
||||||
|
|
||||||
httpModuleDestroy(load);
|
httpModuleDestroy(load);
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,9 @@ int32_t tmsgSendSyncReq(const SEpSet* epSet, SRpcMsg* pMsg) {
|
||||||
|
|
||||||
void tmsgSendRsp(SRpcMsg* pMsg) {
|
void tmsgSendRsp(SRpcMsg* pMsg) {
|
||||||
#if 1
|
#if 1
|
||||||
(void)rpcSendResponse(pMsg);
|
if (rpcSendResponse(pMsg) != 0) {
|
||||||
|
tError("failed to send response");
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
return (*defaultMsgCb.sendRspFp)(pMsg);
|
return (*defaultMsgCb.sendRspFp)(pMsg);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -113,7 +113,7 @@ void* rpcOpen(const SRpcInit* pInit) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t refId = transAddExHandle(transGetInstMgt(), pRpc);
|
int64_t refId = transAddExHandle(transGetInstMgt(), pRpc);
|
||||||
(void)transAcquireExHandle(transGetInstMgt(), refId);
|
void* tmp = transAcquireExHandle(transGetInstMgt(), refId);
|
||||||
pRpc->refId = refId;
|
pRpc->refId = refId;
|
||||||
return (void*)refId;
|
return (void*)refId;
|
||||||
_end:
|
_end:
|
||||||
|
@ -127,8 +127,13 @@ void rpcClose(void* arg) {
|
||||||
if (arg == NULL) {
|
if (arg == NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
(void)transRemoveExHandle(transGetInstMgt(), (int64_t)arg);
|
if (transRemoveExHandle(transGetInstMgt(), (int64_t)arg) != 0) {
|
||||||
(void)transReleaseExHandle(transGetInstMgt(), (int64_t)arg);
|
tError("failed to remove rpc handle");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (transReleaseExHandle(transGetInstMgt(), (int64_t)arg) != 0) {
|
||||||
|
tError("failed to release rpc handle");
|
||||||
|
}
|
||||||
tInfo("end to close rpc");
|
tInfo("end to close rpc");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2107,9 +2107,15 @@ static void cliAsyncCb(uv_async_t* handle) {
|
||||||
|
|
||||||
// batch process to avoid to lock/unlock frequently
|
// batch process to avoid to lock/unlock frequently
|
||||||
queue wq;
|
queue wq;
|
||||||
TAOS_UNUSED(taosThreadMutexLock(&item->mtx));
|
if (taosThreadMutexLock(&item->mtx) != 0) {
|
||||||
|
tError("failed to lock mutex, reason:%s", tstrerror(terrno));
|
||||||
|
}
|
||||||
|
|
||||||
QUEUE_MOVE(&item->qmsg, &wq);
|
QUEUE_MOVE(&item->qmsg, &wq);
|
||||||
TAOS_UNUSED(taosThreadMutexUnlock(&item->mtx));
|
|
||||||
|
if (taosThreadMutexUnlock(&item->mtx) != 0) {
|
||||||
|
tError("failed to unlock mutex, reason:%s", tstrerror(terrno));
|
||||||
|
}
|
||||||
|
|
||||||
int8_t supportBatch = pTransInst->supportBatch;
|
int8_t supportBatch = pTransInst->supportBatch;
|
||||||
if (supportBatch == 0) {
|
if (supportBatch == 0) {
|
||||||
|
@ -2299,7 +2305,9 @@ static int32_t createThrdObj(void* trans, SCliThrd** ppThrd) {
|
||||||
}
|
}
|
||||||
|
|
||||||
QUEUE_INIT(&pThrd->msg);
|
QUEUE_INIT(&pThrd->msg);
|
||||||
TAOS_UNUSED(taosThreadMutexInit(&pThrd->msgMtx, NULL));
|
if (taosThreadMutexInit(&pThrd->msgMtx, NULL) != 0) {
|
||||||
|
TAOS_CHECK_GOTO(terrno, NULL, _end);
|
||||||
|
}
|
||||||
|
|
||||||
pThrd->loop = (uv_loop_t*)taosMemoryMalloc(sizeof(uv_loop_t));
|
pThrd->loop = (uv_loop_t*)taosMemoryMalloc(sizeof(uv_loop_t));
|
||||||
if (pThrd->loop == NULL) {
|
if (pThrd->loop == NULL) {
|
||||||
|
@ -2406,7 +2414,10 @@ static void destroyThrdObj(SCliThrd* pThrd) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
TAOS_UNUSED(taosThreadJoin(pThrd->thread, NULL));
|
if (taosThreadJoin(pThrd->thread, NULL) != 0) {
|
||||||
|
tTrace("failed to join thread, reason:%s", tstrerror(terrno));
|
||||||
|
}
|
||||||
|
|
||||||
CLI_RELEASE_UV(pThrd->loop);
|
CLI_RELEASE_UV(pThrd->loop);
|
||||||
TAOS_UNUSED(taosThreadMutexDestroy(&pThrd->msgMtx));
|
TAOS_UNUSED(taosThreadMutexDestroy(&pThrd->msgMtx));
|
||||||
TRANS_DESTROY_ASYNC_POOL_MSG(pThrd->asyncPool, SCliMsg, destroyCmsgWrapper, (void*)pThrd);
|
TRANS_DESTROY_ASYNC_POOL_MSG(pThrd->asyncPool, SCliMsg, destroyCmsgWrapper, (void*)pThrd);
|
||||||
|
@ -3358,8 +3369,13 @@ _exception:
|
||||||
transReleaseExHandle(transGetInstMgt(), (int64_t)shandle);
|
transReleaseExHandle(transGetInstMgt(), (int64_t)shandle);
|
||||||
if (code != 0) {
|
if (code != 0) {
|
||||||
if (transpointId != 0) {
|
if (transpointId != 0) {
|
||||||
(void)transReleaseExHandle(transGetRefMgt(), transpointId);
|
if (transReleaseExHandle(transGetRefMgt(), transpointId) != 0) {
|
||||||
(void)transRemoveExHandle(transGetRefMgt(), transpointId);
|
tError("failed to release refId %" PRId64 "", transpointId);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (transRemoveExHandle(transGetRefMgt(), transpointId) != 0) {
|
||||||
|
tError("failed to remove refId %" PRId64 "", transpointId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
taosMemoryFree(pCli);
|
taosMemoryFree(pCli);
|
||||||
}
|
}
|
||||||
|
|
|
@ -272,7 +272,11 @@ int32_t transAsyncPoolCreate(uv_loop_t* loop, int sz, void* arg, AsyncCB cb, SAs
|
||||||
}
|
}
|
||||||
item->pThrd = arg;
|
item->pThrd = arg;
|
||||||
QUEUE_INIT(&item->qmsg);
|
QUEUE_INIT(&item->qmsg);
|
||||||
TAOS_UNUSED(taosThreadMutexInit(&item->mtx, NULL));
|
code = taosThreadMutexInit(&item->mtx, NULL);
|
||||||
|
if (code) {
|
||||||
|
taosMemoryFree(item);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
async->data = item;
|
async->data = item;
|
||||||
err = uv_async_init(loop, async, cb);
|
err = uv_async_init(loop, async, cb);
|
||||||
|
@ -328,7 +332,10 @@ int transAsyncSend(SAsyncPool* pool, queue* q) {
|
||||||
uv_async_t* async = &(pool->asyncs[idx]);
|
uv_async_t* async = &(pool->asyncs[idx]);
|
||||||
SAsyncItem* item = async->data;
|
SAsyncItem* item = async->data;
|
||||||
|
|
||||||
TAOS_UNUSED(taosThreadMutexLock(&item->mtx));
|
if (taosThreadMutexLock(&item->mtx) != 0) {
|
||||||
|
tError("failed to lock mutex");
|
||||||
|
}
|
||||||
|
|
||||||
QUEUE_PUSH(&item->qmsg, q);
|
QUEUE_PUSH(&item->qmsg, q);
|
||||||
TAOS_UNUSED(taosThreadMutexUnlock(&item->mtx));
|
TAOS_UNUSED(taosThreadMutexUnlock(&item->mtx));
|
||||||
int ret = uv_async_send(async);
|
int ret = uv_async_send(async);
|
||||||
|
|
|
@ -759,9 +759,15 @@ void uvWorkerAsyncCb(uv_async_t* handle) {
|
||||||
queue wq;
|
queue wq;
|
||||||
|
|
||||||
// batch process to avoid to lock/unlock frequently
|
// batch process to avoid to lock/unlock frequently
|
||||||
TAOS_UNUSED(taosThreadMutexLock(&item->mtx));
|
if (taosThreadMutexLock(&item->mtx) != 0) {
|
||||||
|
tError("failed to lock mutex");
|
||||||
|
}
|
||||||
|
|
||||||
QUEUE_MOVE(&item->qmsg, &wq);
|
QUEUE_MOVE(&item->qmsg, &wq);
|
||||||
TAOS_UNUSED(taosThreadMutexUnlock(&item->mtx));
|
|
||||||
|
if (taosThreadMutexUnlock(&item->mtx) != 0) {
|
||||||
|
tError("failed to unlock mutex");
|
||||||
|
}
|
||||||
|
|
||||||
while (!QUEUE_IS_EMPTY(&wq)) {
|
while (!QUEUE_IS_EMPTY(&wq)) {
|
||||||
queue* head = QUEUE_HEAD(&wq);
|
queue* head = QUEUE_HEAD(&wq);
|
||||||
|
@ -1637,7 +1643,10 @@ void destroyWorkThrd(SWorkThrd* pThrd) {
|
||||||
}
|
}
|
||||||
if (pThrd->inited) {
|
if (pThrd->inited) {
|
||||||
sendQuitToWorkThrd(pThrd);
|
sendQuitToWorkThrd(pThrd);
|
||||||
TAOS_UNUSED(taosThreadJoin(pThrd->thread, NULL));
|
if ((taosThreadJoin(pThrd->thread, NULL)) != 0) {
|
||||||
|
tError("failed to join work-thread");
|
||||||
|
}
|
||||||
|
|
||||||
SRV_RELEASE_UV(pThrd->loop);
|
SRV_RELEASE_UV(pThrd->loop);
|
||||||
TRANS_DESTROY_ASYNC_POOL_MSG(pThrd->asyncPool, SSvrMsg, destroySmsgWrapper, NULL);
|
TRANS_DESTROY_ASYNC_POOL_MSG(pThrd->asyncPool, SSvrMsg, destroySmsgWrapper, NULL);
|
||||||
}
|
}
|
||||||
|
@ -1657,7 +1666,9 @@ void transCloseServer(void* arg) {
|
||||||
if (srv->inited) {
|
if (srv->inited) {
|
||||||
tDebug("send quit msg to accept thread");
|
tDebug("send quit msg to accept thread");
|
||||||
TAOS_UNUSED(uv_async_send(srv->pAcceptAsync));
|
TAOS_UNUSED(uv_async_send(srv->pAcceptAsync));
|
||||||
TAOS_UNUSED(taosThreadJoin(srv->thread, NULL));
|
if (taosThreadJoin(srv->thread, NULL) != 0) {
|
||||||
|
tError("failed to join accept-thread");
|
||||||
|
}
|
||||||
|
|
||||||
SRV_RELEASE_UV(srv->loop);
|
SRV_RELEASE_UV(srv->loop);
|
||||||
for (int i = 0; i < srv->numOfThreads; i++) {
|
for (int i = 0; i < srv->numOfThreads; i++) {
|
||||||
|
|
|
@ -104,7 +104,7 @@ SWal *walOpen(const char *path, SWalCfg *pCfg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// set config
|
// set config
|
||||||
TAOS_UNUSED(memcpy(&pWal->cfg, pCfg, sizeof(SWalCfg)));
|
(void)memcpy(&pWal->cfg, pCfg, sizeof(SWalCfg));
|
||||||
|
|
||||||
pWal->fsyncSeq = pCfg->fsyncPeriod / 1000;
|
pWal->fsyncSeq = pCfg->fsyncPeriod / 1000;
|
||||||
if (pWal->cfg.retentionSize > 0) {
|
if (pWal->cfg.retentionSize > 0) {
|
||||||
|
@ -155,7 +155,7 @@ SWal *walOpen(const char *path, SWalCfg *pCfg) {
|
||||||
pWal->lastRollSeq = -1;
|
pWal->lastRollSeq = -1;
|
||||||
|
|
||||||
// init write buffer
|
// init write buffer
|
||||||
TAOS_UNUSED(memset(&pWal->writeHead, 0, sizeof(SWalCkHead)));
|
(void)memset(&pWal->writeHead, 0, sizeof(SWalCkHead));
|
||||||
pWal->writeHead.head.protoVer = WAL_PROTO_VER;
|
pWal->writeHead.head.protoVer = WAL_PROTO_VER;
|
||||||
pWal->writeHead.magic = WAL_MAGIC;
|
pWal->writeHead.magic = WAL_MAGIC;
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,11 @@ SWalReader *walOpenReader(SWal *pWal, SWalFilterCond *cond, int64_t id) {
|
||||||
pReader->cond.enableRef = 0;
|
pReader->cond.enableRef = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
TAOS_UNUSED(taosThreadMutexInit(&pReader->mutex, NULL));
|
terrno = taosThreadMutexInit(&pReader->mutex, NULL);
|
||||||
|
if (terrno) {
|
||||||
|
taosMemoryFree(pReader);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
pReader->pHead = taosMemoryMalloc(sizeof(SWalCkHead));
|
pReader->pHead = taosMemoryMalloc(sizeof(SWalCkHead));
|
||||||
if (pReader->pHead == NULL) {
|
if (pReader->pHead == NULL) {
|
||||||
|
@ -401,7 +405,9 @@ int32_t walReadVer(SWalReader *pReader, int64_t ver) {
|
||||||
TAOS_RETURN(TSDB_CODE_WAL_LOG_NOT_EXIST);
|
TAOS_RETURN(TSDB_CODE_WAL_LOG_NOT_EXIST);
|
||||||
}
|
}
|
||||||
|
|
||||||
TAOS_UNUSED(taosThreadMutexLock(&pReader->mutex));
|
if (taosThreadMutexLock(&pReader->mutex) != 0) {
|
||||||
|
wError("vgId:%d, failed to lock mutex", pReader->pWal->cfg.vgId);
|
||||||
|
}
|
||||||
|
|
||||||
if (pReader->curVersion != ver) {
|
if (pReader->curVersion != ver) {
|
||||||
code = walReaderSeekVer(pReader, ver);
|
code = walReaderSeekVer(pReader, ver);
|
||||||
|
@ -537,7 +543,7 @@ int32_t decryptBody(SWalCfg *cfg, SWalCkHead *pHead, int32_t plainBodyLen, const
|
||||||
|
|
||||||
// wDebug("CBC_Decrypt cryptedBodyLen:%d, plainBodyLen:%d, %s", count, plainBodyLen, func);
|
// wDebug("CBC_Decrypt cryptedBodyLen:%d, plainBodyLen:%d, %s", count, plainBodyLen, func);
|
||||||
|
|
||||||
TAOS_UNUSED(memcpy(pHead->head.body, newBody, plainBodyLen));
|
(void)memcpy(pHead->head.body, newBody, plainBodyLen);
|
||||||
|
|
||||||
taosMemoryFree(newBody);
|
taosMemoryFree(newBody);
|
||||||
}
|
}
|
||||||
|
@ -546,7 +552,10 @@ int32_t decryptBody(SWalCfg *cfg, SWalCkHead *pHead, int32_t plainBodyLen, const
|
||||||
}
|
}
|
||||||
|
|
||||||
void walReadReset(SWalReader *pReader) {
|
void walReadReset(SWalReader *pReader) {
|
||||||
TAOS_UNUSED(taosThreadMutexLock(&pReader->mutex));
|
if ((taosThreadMutexLock(&pReader->mutex)) != 0) {
|
||||||
|
wError("vgId:%d, failed to lock mutex", pReader->pWal->cfg.vgId);
|
||||||
|
}
|
||||||
|
|
||||||
TAOS_UNUSED(taosCloseFile(&pReader->pIdxFile));
|
TAOS_UNUSED(taosCloseFile(&pReader->pIdxFile));
|
||||||
TAOS_UNUSED(taosCloseFile(&pReader->pLogFile));
|
TAOS_UNUSED(taosCloseFile(&pReader->pLogFile));
|
||||||
pReader->curFileFirstVer = -1;
|
pReader->curFileFirstVer = -1;
|
||||||
|
|
|
@ -185,10 +185,14 @@ int32_t walRollback(SWal *pWal, int64_t ver) {
|
||||||
|
|
||||||
walBuildLogName(pWal, pInfo->firstVer, fnameStr);
|
walBuildLogName(pWal, pInfo->firstVer, fnameStr);
|
||||||
wDebug("vgId:%d, wal remove file %s for rollback", pWal->cfg.vgId, fnameStr);
|
wDebug("vgId:%d, wal remove file %s for rollback", pWal->cfg.vgId, fnameStr);
|
||||||
TAOS_UNUSED(taosRemoveFile(fnameStr));
|
if (taosRemoveFile(fnameStr) != 0) {
|
||||||
|
wWarn("vgId:%d, failed to remove file %s for rollback since %s", pWal->cfg.vgId, fnameStr, terrstr());
|
||||||
|
}
|
||||||
walBuildIdxName(pWal, pInfo->firstVer, fnameStr);
|
walBuildIdxName(pWal, pInfo->firstVer, fnameStr);
|
||||||
wDebug("vgId:%d, wal remove file %s for rollback", pWal->cfg.vgId, fnameStr);
|
wDebug("vgId:%d, wal remove file %s for rollback", pWal->cfg.vgId, fnameStr);
|
||||||
TAOS_UNUSED(taosRemoveFile(fnameStr));
|
if (taosRemoveFile(fnameStr) != 0) {
|
||||||
|
wWarn("vgId:%d, failed to remove file %s for rollback since %s", pWal->cfg.vgId, fnameStr, terrstr());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -460,7 +464,9 @@ int32_t walEndSnapshot(SWal *pWal) {
|
||||||
}
|
}
|
||||||
for (SWalFileInfo *iter = pWal->fileInfoSet->pData; iter <= pUntil; iter++) {
|
for (SWalFileInfo *iter = pWal->fileInfoSet->pData; iter <= pUntil; iter++) {
|
||||||
deleteCnt++;
|
deleteCnt++;
|
||||||
TAOS_UNUSED(taosArrayPush(pWal->toDeleteFiles, iter));
|
if (taosArrayPush(pWal->toDeleteFiles, iter) == NULL) {
|
||||||
|
wError("vgId:%d, failed to push file info to delete list", pWal->cfg.vgId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// make new array, remove files
|
// make new array, remove files
|
||||||
|
@ -603,8 +609,8 @@ static FORCE_INLINE int32_t walWriteImpl(SWal *pWal, int64_t index, tmsg_t msgTy
|
||||||
|
|
||||||
TAOS_CHECK_GOTO(terrno, &lino, _exit);
|
TAOS_CHECK_GOTO(terrno, &lino, _exit);
|
||||||
}
|
}
|
||||||
TAOS_UNUSED(memset(newBody, 0, cyptedBodyLen));
|
(void)memset(newBody, 0, cyptedBodyLen);
|
||||||
TAOS_UNUSED(memcpy(newBody, body, plainBodyLen));
|
(void)memcpy(newBody, body, plainBodyLen);
|
||||||
|
|
||||||
newBodyEncrypted = taosMemoryMalloc(cyptedBodyLen);
|
newBodyEncrypted = taosMemoryMalloc(cyptedBodyLen);
|
||||||
if (newBodyEncrypted == NULL) {
|
if (newBodyEncrypted == NULL) {
|
||||||
|
|
Loading…
Reference in New Issue