Merge branch '3.0' into fix/3_liaohj
This commit is contained in:
commit
9aac625068
|
@ -45,7 +45,7 @@ static int DemoWithReqId() {
|
|||
TAOS_RES *result = taos_query_with_reqid(taos, sql, reqid);
|
||||
code = taos_errno(result);
|
||||
if (code != 0) {
|
||||
fprintf(stderr, "Failed to execute sql with qid: %ld, ErrCode: 0x%x, ErrMessage: %s\n.", reqid, code,
|
||||
fprintf(stderr, "Failed to execute sql withQID: %ld, ErrCode: 0x%x, ErrMessage: %s\n.", reqid, code,
|
||||
taos_errstr(result));
|
||||
taos_close(taos);
|
||||
taos_cleanup();
|
||||
|
|
|
@ -4,8 +4,6 @@ title: 数据压缩
|
|||
toc_max_heading_level: 4
|
||||
---
|
||||
|
||||
## 概述
|
||||
|
||||
数据压缩是一种在不损失数据有效信息的前提下,利用特定算法对数据进行重新组织和处理,以减少数据占用的存储空间和提高数据传输效率的技术。TDengine 在数据的存储和传输过程中均采用了这一技术,旨在优化存储资源的使用并加快数据交换的速度。
|
||||
|
||||
|
||||
|
@ -58,4 +56,4 @@ TDengine 在数据传输过程中提供了压缩功能,以减少网络带宽
|
|||
|
||||
下图展示了 TDengine 引擎在时序数据的整个传输及存储过程中的压缩及解压过程,以更好地理解整个处理过程。
|
||||
|
||||

|
||||

|
||||
|
|
|
@ -210,6 +210,7 @@ DLL_EXPORT int taos_select_db(TAOS *taos, const char *db);
|
|||
DLL_EXPORT int taos_print_row(char *str, TAOS_ROW row, TAOS_FIELD *fields, int num_fields);
|
||||
DLL_EXPORT void taos_stop_query(TAOS_RES *res);
|
||||
DLL_EXPORT bool taos_is_null(TAOS_RES *res, int32_t row, int32_t col);
|
||||
DLL_EXPORT int taos_is_null_by_column(TAOS_RES *res, int columnIndex, bool result[], int *rows);
|
||||
DLL_EXPORT bool taos_is_update_query(TAOS_RES *res);
|
||||
DLL_EXPORT int taos_fetch_block(TAOS_RES *res, TAOS_ROW *rows);
|
||||
DLL_EXPORT int taos_fetch_block_s(TAOS_RES *res, int *numOfRows, TAOS_ROW *rows);
|
||||
|
|
|
@ -113,10 +113,8 @@ static FORCE_INLINE bool colDataIsNull(const SColumnInfoData* pColumnInfoData, u
|
|||
|
||||
if (pColAgg != NULL && pColAgg->colId != -1) {
|
||||
if (pColAgg->numOfNull == totalRows) {
|
||||
ASSERT(pColumnInfoData->nullbitmap == NULL);
|
||||
return true;
|
||||
} else if (pColAgg->numOfNull == 0) {
|
||||
ASSERT(pColumnInfoData->nullbitmap == NULL);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -159,40 +157,32 @@ static FORCE_INLINE void colDataSetNNULL(SColumnInfoData* pColumnInfoData, uint3
|
|||
}
|
||||
|
||||
static FORCE_INLINE void colDataSetInt8(SColumnInfoData* pColumnInfoData, uint32_t rowIndex, int8_t* v) {
|
||||
ASSERT(pColumnInfoData->info.type == TSDB_DATA_TYPE_TINYINT ||
|
||||
pColumnInfoData->info.type == TSDB_DATA_TYPE_UTINYINT || pColumnInfoData->info.type == TSDB_DATA_TYPE_BOOL);
|
||||
char* p = pColumnInfoData->pData + pColumnInfoData->info.bytes * rowIndex;
|
||||
*(int8_t*)p = *(int8_t*)v;
|
||||
}
|
||||
|
||||
static FORCE_INLINE void colDataSetInt16(SColumnInfoData* pColumnInfoData, uint32_t rowIndex, int16_t* v) {
|
||||
ASSERT(pColumnInfoData->info.type == TSDB_DATA_TYPE_SMALLINT ||
|
||||
pColumnInfoData->info.type == TSDB_DATA_TYPE_USMALLINT);
|
||||
char* p = pColumnInfoData->pData + pColumnInfoData->info.bytes * rowIndex;
|
||||
*(int16_t*)p = *(int16_t*)v;
|
||||
}
|
||||
|
||||
static FORCE_INLINE void colDataSetInt32(SColumnInfoData* pColumnInfoData, uint32_t rowIndex, int32_t* v) {
|
||||
ASSERT(pColumnInfoData->info.type == TSDB_DATA_TYPE_INT || pColumnInfoData->info.type == TSDB_DATA_TYPE_UINT);
|
||||
char* p = pColumnInfoData->pData + pColumnInfoData->info.bytes * rowIndex;
|
||||
*(int32_t*)p = *(int32_t*)v;
|
||||
}
|
||||
|
||||
static FORCE_INLINE void colDataSetInt64(SColumnInfoData* pColumnInfoData, uint32_t rowIndex, int64_t* v) {
|
||||
int32_t type = pColumnInfoData->info.type;
|
||||
ASSERT(type == TSDB_DATA_TYPE_BIGINT || type == TSDB_DATA_TYPE_UBIGINT || type == TSDB_DATA_TYPE_TIMESTAMP);
|
||||
char* p = pColumnInfoData->pData + pColumnInfoData->info.bytes * rowIndex;
|
||||
*(int64_t*)p = *(int64_t*)v;
|
||||
}
|
||||
|
||||
static FORCE_INLINE void colDataSetFloat(SColumnInfoData* pColumnInfoData, uint32_t rowIndex, float* v) {
|
||||
ASSERT(pColumnInfoData->info.type == TSDB_DATA_TYPE_FLOAT);
|
||||
char* p = pColumnInfoData->pData + pColumnInfoData->info.bytes * rowIndex;
|
||||
*(float*)p = *(float*)v;
|
||||
}
|
||||
|
||||
static FORCE_INLINE void colDataSetDouble(SColumnInfoData* pColumnInfoData, uint32_t rowIndex, double* v) {
|
||||
ASSERT(pColumnInfoData->info.type == TSDB_DATA_TYPE_DOUBLE);
|
||||
char* p = pColumnInfoData->pData + pColumnInfoData->info.bytes * rowIndex;
|
||||
*(double*)p = *(double*)v;
|
||||
}
|
||||
|
|
|
@ -193,7 +193,7 @@ int32_t tColDataDecompress(void *input, SColDataCompressInfo *info, SColData *co
|
|||
|
||||
// for stmt bind
|
||||
int32_t tColDataAddValueByBind(SColData *pColData, TAOS_MULTI_BIND *pBind, int32_t buffMaxLen);
|
||||
int32_t tColDataSortMerge(SArray *colDataArr);
|
||||
int32_t tColDataSortMerge(SArray **arr);
|
||||
|
||||
// for raw block
|
||||
int32_t tColDataAddValueByDataBlock(SColData *pColData, int8_t type, int32_t bytes, int32_t nRows, char *lengthOrbitmap,
|
||||
|
|
|
@ -22,8 +22,12 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(WINDOWS) && !defined(__USE_PTHREAD)
|
||||
#ifdef WINDOWS
|
||||
#include <tlhelp32.h>
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#if defined(WINDOWS) && !defined(__USE_PTHREAD)
|
||||
#define __USE_WIN_THREAD
|
||||
// https://learn.microsoft.com/en-us/windows/win32/winprog/using-the-windows-headers
|
||||
// #ifndef _WIN32_WINNT
|
||||
|
@ -275,6 +279,10 @@ int32_t taosThreadSpinUnlock(TdThreadSpinlock *lock);
|
|||
void taosThreadTestCancel(void);
|
||||
void taosThreadClear(TdThread *thread);
|
||||
|
||||
#ifdef WINDOWS
|
||||
bool taosThreadIsMain();
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -84,11 +84,11 @@ typedef struct SConfigItem {
|
|||
};
|
||||
union {
|
||||
int64_t imin;
|
||||
double fmin;
|
||||
float fmin;
|
||||
};
|
||||
union {
|
||||
int64_t imax;
|
||||
double fmax;
|
||||
float fmax;
|
||||
};
|
||||
SArray *array; // SDiskCfg/SLogVar
|
||||
} SConfigItem;
|
||||
|
|
|
@ -32,14 +32,15 @@ typedef struct SGeosContext {
|
|||
GEOSWKBReader *WKBReader;
|
||||
GEOSWKBWriter *WKBWriter;
|
||||
|
||||
pcre2_code *WKTRegex;
|
||||
pcre2_code *WKTRegex;
|
||||
pcre2_match_data *WKTMatchData;
|
||||
|
||||
char errMsg[512];
|
||||
} SGeosContext;
|
||||
|
||||
SGeosContext* getThreadLocalGeosCtx();
|
||||
void destroyThreadLocalGeosCtx();
|
||||
SGeosContext *acquireThreadLocalGeosCtx();
|
||||
int32_t getThreadLocalGeosCtx(SGeosContext **ppCtx);
|
||||
const char *getGeosErrMsg(int32_t code);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ void taosIpPort2String(uint32_t ip, uint16_t port, char *str);
|
|||
|
||||
void *tmemmem(const char *haystack, int hlen, const char *needle, int nlen);
|
||||
|
||||
int32_t parseCfgReal(const char *str, double *out);
|
||||
int32_t parseCfgReal(const char *str, float *out);
|
||||
|
||||
static FORCE_INLINE void taosEncryptPass(uint8_t *inBuf, size_t inLen, char *target) {
|
||||
T_MD5_CTX context;
|
||||
|
|
|
@ -94,7 +94,7 @@ static int32_t registerRequest(SRequestObj *pRequest, STscObj *pTscObj) {
|
|||
int32_t total = atomic_add_fetch_64((int64_t *)&pSummary->totalRequests, 1);
|
||||
int32_t currentInst = atomic_add_fetch_64((int64_t *)&pSummary->currentRequests, 1);
|
||||
tscDebug("0x%" PRIx64 " new Request from connObj:0x%" PRIx64
|
||||
", current:%d, app current:%d, total:%d, qid:0x%" PRIx64,
|
||||
", current:%d, app current:%d, total:%d,QID:0x%" PRIx64,
|
||||
pRequest->self, pRequest->pTscObj->id, num, currentInst, total, pRequest->requestId);
|
||||
}
|
||||
|
||||
|
@ -249,7 +249,7 @@ static void deregisterRequest(SRequestObj *pRequest) {
|
|||
int32_t reqType = SLOW_LOG_TYPE_OTHERS;
|
||||
|
||||
int64_t duration = taosGetTimestampUs() - pRequest->metric.start;
|
||||
tscDebug("0x%" PRIx64 " free Request from connObj: 0x%" PRIx64 ", qid:0x%" PRIx64
|
||||
tscDebug("0x%" PRIx64 " free Request from connObj: 0x%" PRIx64 ",QID:0x%" PRIx64
|
||||
" elapsed:%.2f ms, "
|
||||
"current:%d, app current:%d",
|
||||
pRequest->self, pTscObj->id, pRequest->requestId, duration / 1000.0, num, currentInst);
|
||||
|
@ -294,7 +294,7 @@ static void deregisterRequest(SRequestObj *pRequest) {
|
|||
checkSlowLogExceptDb(pRequest, pTscObj->pAppInfo->monitorParas.tsSlowLogExceptDb)) {
|
||||
(void)atomic_add_fetch_64((int64_t *)&pActivity->numOfSlowQueries, 1);
|
||||
if (pTscObj->pAppInfo->monitorParas.tsSlowLogScope & reqType) {
|
||||
taosPrintSlowLog("PID:%d, Conn:%u, qid:0x%" PRIx64 ", Start:%" PRId64 " us, Duration:%" PRId64 "us, SQL:%s",
|
||||
taosPrintSlowLog("PID:%d, Conn:%u,QID:0x%" PRIx64 ", Start:%" PRId64 " us, Duration:%" PRId64 "us, SQL:%s",
|
||||
taosGetPId(), pTscObj->connId, pRequest->requestId, pRequest->metric.start, duration,
|
||||
pRequest->sqlstr);
|
||||
if (pTscObj->pAppInfo->monitorParas.tsEnableMonitor) {
|
||||
|
@ -971,10 +971,6 @@ void taos_init_imp(void) {
|
|||
|
||||
tscDebug("starting to initialize TAOS driver");
|
||||
|
||||
#ifndef WINDOWS
|
||||
taosSetCoreDump(true);
|
||||
#endif
|
||||
|
||||
ENV_ERR_RET(initTaskQueue(), "failed to init task queue");
|
||||
ENV_ERR_RET(fmFuncMgtInit(), "failed to init funcMgt");
|
||||
ENV_ERR_RET(nodesInitAllocatorSet(), "failed to init allocator set");
|
||||
|
|
|
@ -232,7 +232,7 @@ int32_t buildRequest(uint64_t connId, const char* sql, int sqlLen, void* param,
|
|||
int32_t err = taosHashPut(pTscObj->pRequests, &(*pRequest)->self, sizeof((*pRequest)->self), &(*pRequest)->self,
|
||||
sizeof((*pRequest)->self));
|
||||
if (err) {
|
||||
tscError("%" PRId64 " failed to add to request container, qid:0x%" PRIx64 ", conn:%" PRId64 ", %s",
|
||||
tscError("%" PRId64 " failed to add to request container,QID:0x%" PRIx64 ", conn:%" PRId64 ", %s",
|
||||
(*pRequest)->self, (*pRequest)->requestId, pTscObj->id, sql);
|
||||
destroyRequest(*pRequest);
|
||||
*pRequest = NULL;
|
||||
|
@ -243,15 +243,15 @@ int32_t buildRequest(uint64_t connId, const char* sql, int sqlLen, void* param,
|
|||
if (tsQueryUseNodeAllocator && !qIsInsertValuesSql((*pRequest)->sqlstr, (*pRequest)->sqlLen)) {
|
||||
if (TSDB_CODE_SUCCESS !=
|
||||
nodesCreateAllocator((*pRequest)->requestId, tsQueryNodeChunkSize, &((*pRequest)->allocatorRefId))) {
|
||||
tscError("%" PRId64 " failed to create node allocator, qid:0x%" PRIx64 ", conn:%" PRId64 ", %s",
|
||||
(*pRequest)->self, (*pRequest)->requestId, pTscObj->id, sql);
|
||||
tscError("%" PRId64 " failed to create node allocator,QID:0x%" PRIx64 ", conn:%" PRId64 ", %s", (*pRequest)->self,
|
||||
(*pRequest)->requestId, pTscObj->id, sql);
|
||||
destroyRequest(*pRequest);
|
||||
*pRequest = NULL;
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
}
|
||||
|
||||
tscDebugL("0x%" PRIx64 " SQL: %s, qid:0x%" PRIx64, (*pRequest)->self, (*pRequest)->sqlstr, (*pRequest)->requestId);
|
||||
tscDebugL("0x%" PRIx64 " SQL: %s,QID:0x%" PRIx64, (*pRequest)->self, (*pRequest)->sqlstr, (*pRequest)->requestId);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -365,10 +365,10 @@ void asyncExecLocalCmd(SRequestObj* pRequest, SQuery* pQuery) {
|
|||
|
||||
if (pRequest->code != TSDB_CODE_SUCCESS) {
|
||||
pResultInfo->numOfRows = 0;
|
||||
tscError("0x%" PRIx64 " fetch results failed, code:%s, qid:0x%" PRIx64, pRequest->self, tstrerror(code),
|
||||
tscError("0x%" PRIx64 " fetch results failed, code:%s,QID:0x%" PRIx64, pRequest->self, tstrerror(code),
|
||||
pRequest->requestId);
|
||||
} else {
|
||||
tscDebug("0x%" PRIx64 " fetch results, numOfRows:%" PRId64 " total Rows:%" PRId64 ", complete:%d, qid:0x%" PRIx64,
|
||||
tscDebug("0x%" PRIx64 " fetch results, numOfRows:%" PRId64 " total Rows:%" PRId64 ", complete:%d,QID:0x%" PRIx64,
|
||||
pRequest->self, pResultInfo->numOfRows, pResultInfo->totalRows, pResultInfo->completed,
|
||||
pRequest->requestId);
|
||||
}
|
||||
|
@ -513,7 +513,7 @@ int32_t setResSchemaInfo(SReqResultInfo* pResInfo, const SSchema* pSchema, int32
|
|||
taosMemoryFree(pResInfo->userFields);
|
||||
}
|
||||
pResInfo->fields = taosMemoryCalloc(numOfCols, sizeof(TAOS_FIELD));
|
||||
if(NULL == pResInfo->fields) return terrno;
|
||||
if (NULL == pResInfo->fields) return terrno;
|
||||
pResInfo->userFields = taosMemoryCalloc(numOfCols, sizeof(TAOS_FIELD));
|
||||
if (NULL == pResInfo->userFields) {
|
||||
taosMemoryFree(pResInfo->fields);
|
||||
|
@ -976,7 +976,7 @@ int32_t handleQueryExecRsp(SRequestObj* pRequest) {
|
|||
break;
|
||||
}
|
||||
default:
|
||||
tscError("0x%" PRIx64 ", invalid exec result for request type %d, qid:0x%" PRIx64, pRequest->self, pRequest->type,
|
||||
tscError("0x%" PRIx64 ", invalid exec result for request type %d,QID:0x%" PRIx64, pRequest->self, pRequest->type,
|
||||
pRequest->requestId);
|
||||
code = TSDB_CODE_APP_ERROR;
|
||||
}
|
||||
|
@ -1021,7 +1021,7 @@ void returnToUser(SRequestObj* pRequest) {
|
|||
(void)releaseRequest(pRequest->relation.userRefId);
|
||||
return;
|
||||
} else {
|
||||
tscError("0x%" PRIx64 ", user ref 0x%" PRIx64 " is not there, qid:0x%" PRIx64, pRequest->self,
|
||||
tscError("0x%" PRIx64 ", user ref 0x%" PRIx64 " is not there,QID:0x%" PRIx64, pRequest->self,
|
||||
pRequest->relation.userRefId, pRequest->requestId);
|
||||
}
|
||||
}
|
||||
|
@ -1053,11 +1053,11 @@ static int32_t createResultBlock(TAOS_RES* pRes, int32_t numOfRows, SSDataBlock*
|
|||
|
||||
for (int32_t i = 0; i < numOfRows; ++i) {
|
||||
TAOS_ROW pRow = taos_fetch_row(pRes);
|
||||
if(NULL == pRow[0] || NULL == pRow[1] || NULL == pRow[2]) {
|
||||
if (NULL == pRow[0] || NULL == pRow[1] || NULL == pRow[2]) {
|
||||
tscError("invalid data from vnode");
|
||||
return TSDB_CODE_TSC_INTERNAL_ERROR;
|
||||
}
|
||||
int64_t ts = *(int64_t*)pRow[0];
|
||||
int64_t ts = *(int64_t*)pRow[0];
|
||||
if (lastTs < ts) {
|
||||
lastTs = ts;
|
||||
}
|
||||
|
@ -1090,7 +1090,7 @@ void postSubQueryFetchCb(void* param, TAOS_RES* res, int32_t rowNum) {
|
|||
|
||||
SSDataBlock* pBlock = NULL;
|
||||
if (TSDB_CODE_SUCCESS != createResultBlock(res, rowNum, &pBlock)) {
|
||||
tscError("0x%" PRIx64 ", create result block failed, qid:0x%" PRIx64, pRequest->self, pRequest->requestId);
|
||||
tscError("0x%" PRIx64 ", create result block failed,QID:0x%" PRIx64, pRequest->self, pRequest->requestId);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1099,7 +1099,7 @@ void postSubQueryFetchCb(void* param, TAOS_RES* res, int32_t rowNum) {
|
|||
continuePostSubQuery(pNextReq, pBlock);
|
||||
(void)releaseRequest(pRequest->relation.nextRefId);
|
||||
} else {
|
||||
tscError("0x%" PRIx64 ", next req ref 0x%" PRIx64 " is not there, qid:0x%" PRIx64, pRequest->self,
|
||||
tscError("0x%" PRIx64 ", next req ref 0x%" PRIx64 " is not there,QID:0x%" PRIx64, pRequest->self,
|
||||
pRequest->relation.nextRefId, pRequest->requestId);
|
||||
}
|
||||
|
||||
|
@ -1118,7 +1118,7 @@ void handlePostSubQuery(SSqlCallbackWrapper* pWrapper) {
|
|||
continuePostSubQuery(pNextReq, NULL);
|
||||
(void)releaseRequest(pRequest->relation.nextRefId);
|
||||
} else {
|
||||
tscError("0x%" PRIx64 ", next req ref 0x%" PRIx64 " is not there, qid:0x%" PRIx64, pRequest->self,
|
||||
tscError("0x%" PRIx64 ", next req ref 0x%" PRIx64 " is not there,QID:0x%" PRIx64, pRequest->self,
|
||||
pRequest->relation.nextRefId, pRequest->requestId);
|
||||
}
|
||||
}
|
||||
|
@ -1149,11 +1149,11 @@ void schedulerExecCb(SExecResult* pResult, void* param, int32_t code) {
|
|||
}
|
||||
|
||||
taosMemoryFree(pResult);
|
||||
tscDebug("0x%" PRIx64 " enter scheduler exec cb, code:%s, qid:0x%" PRIx64, pRequest->self, tstrerror(code),
|
||||
tscDebug("0x%" PRIx64 " enter scheduler exec cb, code:%s,QID:0x%" PRIx64, pRequest->self, tstrerror(code),
|
||||
pRequest->requestId);
|
||||
|
||||
if (code != TSDB_CODE_SUCCESS && NEED_CLIENT_HANDLE_ERROR(code) && pRequest->sqlstr != NULL) {
|
||||
tscDebug("0x%" PRIx64 " client retry to handle the error, code:%s, tryCount:%d, qid:0x%" PRIx64, pRequest->self,
|
||||
tscDebug("0x%" PRIx64 " client retry to handle the error, code:%s, tryCount:%d,QID:0x%" PRIx64, pRequest->self,
|
||||
tstrerror(code), pRequest->retry, pRequest->requestId);
|
||||
(void)removeMeta(pTscObj, pRequest->targetTableList, IS_VIEW_REQUEST(pRequest->type));
|
||||
restartAsyncQuery(pRequest, code);
|
||||
|
@ -1586,7 +1586,7 @@ int32_t taosConnectImpl(const char* user, const char* auth, const char* db, __ta
|
|||
*pTscObj = NULL;
|
||||
return terrno;
|
||||
} else {
|
||||
tscDebug("0x%" PRIx64 " connection is opening, connId:%u, dnodeConn:%p, qid:0x%" PRIx64, (*pTscObj)->id,
|
||||
tscDebug("0x%" PRIx64 " connection is opening, connId:%u, dnodeConn:%p,QID:0x%" PRIx64, (*pTscObj)->id,
|
||||
(*pTscObj)->connId, (*pTscObj)->pAppInfo->pTransporter, pRequest->requestId);
|
||||
destroyRequest(pRequest);
|
||||
}
|
||||
|
@ -1717,7 +1717,7 @@ int32_t doProcessMsgFromServer(void* param) {
|
|||
char tbuf[40] = {0};
|
||||
TRACE_TO_STR(trace, tbuf);
|
||||
|
||||
tscDebug("processMsgFromServer handle %p, message: %s, size:%d, code: %s, qid:%s", pMsg->info.handle,
|
||||
tscDebug("processMsgFromServer handle %p, message: %s, size:%d, code: %s,QID:%s", pMsg->info.handle,
|
||||
TMSG_INFO(pMsg->msgType), pMsg->contLen, tstrerror(pMsg->code), tbuf);
|
||||
|
||||
if (pSendInfo->requestObjRefId != 0) {
|
||||
|
@ -1915,7 +1915,7 @@ void* doFetchRows(SRequestObj* pRequest, bool setupOneRowPtr, bool convertUcs4)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
tscDebug("0x%" PRIx64 " fetch results, numOfRows:%" PRId64 " total Rows:%" PRId64 ", complete:%d, qid:0x%" PRIx64,
|
||||
tscDebug("0x%" PRIx64 " fetch results, numOfRows:%" PRId64 " total Rows:%" PRId64 ", complete:%d,QID:0x%" PRIx64,
|
||||
pRequest->self, pResInfo->numOfRows, pResInfo->totalRows, pResInfo->completed, pRequest->requestId);
|
||||
|
||||
STscObj* pTscObj = pRequest->pTscObj;
|
||||
|
@ -2869,8 +2869,8 @@ static void fetchCallback(void* pResult, void* param, int32_t code) {
|
|||
|
||||
SReqResultInfo* pResultInfo = &pRequest->body.resInfo;
|
||||
|
||||
tscDebug("0x%" PRIx64 " enter scheduler fetch cb, code:%d - %s, qid:0x%" PRIx64, pRequest->self, code,
|
||||
tstrerror(code), pRequest->requestId);
|
||||
tscDebug("0x%" PRIx64 " enter scheduler fetch cb, code:%d - %s,QID:0x%" PRIx64, pRequest->self, code, tstrerror(code),
|
||||
pRequest->requestId);
|
||||
|
||||
pResultInfo->pData = pResult;
|
||||
pResultInfo->numOfRows = 0;
|
||||
|
@ -2892,10 +2892,10 @@ static void fetchCallback(void* pResult, void* param, int32_t code) {
|
|||
setQueryResultFromRsp(pResultInfo, (const SRetrieveTableRsp*)pResultInfo->pData, pResultInfo->convertUcs4);
|
||||
if (pRequest->code != TSDB_CODE_SUCCESS) {
|
||||
pResultInfo->numOfRows = 0;
|
||||
tscError("0x%" PRIx64 " fetch results failed, code:%s, qid:0x%" PRIx64, pRequest->self, tstrerror(pRequest->code),
|
||||
tscError("0x%" PRIx64 " fetch results failed, code:%s,QID:0x%" PRIx64, pRequest->self, tstrerror(pRequest->code),
|
||||
pRequest->requestId);
|
||||
} else {
|
||||
tscDebug("0x%" PRIx64 " fetch results, numOfRows:%" PRId64 " total Rows:%" PRId64 ", complete:%d, qid:0x%" PRIx64,
|
||||
tscDebug("0x%" PRIx64 " fetch results, numOfRows:%" PRId64 " total Rows:%" PRId64 ", complete:%d,QID:0x%" PRIx64,
|
||||
pRequest->self, pResultInfo->numOfRows, pResultInfo->totalRows, pResultInfo->completed,
|
||||
pRequest->requestId);
|
||||
|
||||
|
|
|
@ -860,6 +860,44 @@ int *taos_get_column_data_offset(TAOS_RES *res, int columnIndex) {
|
|||
return pResInfo->pCol[columnIndex].offset;
|
||||
}
|
||||
|
||||
int taos_is_null_by_column(TAOS_RES *res, int columnIndex, bool result[], int *rows){
|
||||
if (res == NULL || result == NULL || rows == NULL || *rows <= 0 ||
|
||||
columnIndex < 0 || TD_RES_TMQ_META(res) || TD_RES_TMQ_BATCH_META(res)) {
|
||||
return TSDB_CODE_INVALID_PARA;
|
||||
}
|
||||
|
||||
int32_t numOfFields = taos_num_fields(res);
|
||||
if (columnIndex >= numOfFields || numOfFields == 0) {
|
||||
return TSDB_CODE_INVALID_PARA;
|
||||
}
|
||||
|
||||
SReqResultInfo *pResInfo = tscGetCurResInfo(res);
|
||||
TAOS_FIELD *pField = &pResInfo->userFields[columnIndex];
|
||||
SResultColumn *pCol = &pResInfo->pCol[columnIndex];
|
||||
|
||||
if (*rows > pResInfo->numOfRows){
|
||||
*rows = pResInfo->numOfRows;
|
||||
}
|
||||
if (IS_VAR_DATA_TYPE(pField->type)) {
|
||||
for(int i = 0; i < *rows; i++){
|
||||
if(pCol->offset[i] == -1){
|
||||
result[i] = true;
|
||||
}else{
|
||||
result[i] = false;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
for(int i = 0; i < *rows; i++){
|
||||
if (colDataIsNull_f(pCol->nullbitmap, i)){
|
||||
result[i] = true;
|
||||
}else{
|
||||
result[i] = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int taos_validate_sql(TAOS *taos, const char *sql) {
|
||||
TAOS_RES *pObj = taosQueryImpl(taos, sql, true, TD_REQ_FROM_APP);
|
||||
|
||||
|
@ -941,7 +979,7 @@ static void doAsyncQueryFromAnalyse(SMetaData *pResultMeta, void *param, int32_t
|
|||
SRequestObj *pRequest = pWrapper->pRequest;
|
||||
SQuery *pQuery = pRequest->pQuery;
|
||||
|
||||
qDebug("0x%" PRIx64 " start to semantic analysis, qid:0x%" PRIx64, pRequest->self, pRequest->requestId);
|
||||
qDebug("0x%" PRIx64 " start to semantic analysis,QID:0x%" PRIx64, pRequest->self, pRequest->requestId);
|
||||
|
||||
int64_t analyseStart = taosGetTimestampUs();
|
||||
pRequest->metric.ctgCostUs = analyseStart - pRequest->metric.ctgStart;
|
||||
|
@ -1060,14 +1098,14 @@ void handleQueryAnslyseRes(SSqlCallbackWrapper *pWrapper, SMetaData *pResultMeta
|
|||
pRequest->pQuery = NULL;
|
||||
|
||||
if (NEED_CLIENT_HANDLE_ERROR(code)) {
|
||||
tscDebug("0x%" PRIx64 " client retry to handle the error, code:%d - %s, tryCount:%d, qid:0x%" PRIx64,
|
||||
tscDebug("0x%" PRIx64 " client retry to handle the error, code:%d - %s, tryCount:%d,QID:0x%" PRIx64,
|
||||
pRequest->self, code, tstrerror(code), pRequest->retry, pRequest->requestId);
|
||||
restartAsyncQuery(pRequest, code);
|
||||
return;
|
||||
}
|
||||
|
||||
// return to app directly
|
||||
tscError("0x%" PRIx64 " error occurs, code:%s, return to user app, qid:0x%" PRIx64, pRequest->self, tstrerror(code),
|
||||
tscError("0x%" PRIx64 " error occurs, code:%s, return to user app,QID:0x%" PRIx64, pRequest->self, tstrerror(code),
|
||||
pRequest->requestId);
|
||||
pRequest->code = code;
|
||||
returnToUser(pRequest);
|
||||
|
@ -1117,7 +1155,7 @@ static void doAsyncQueryFromParse(SMetaData *pResultMeta, void *param, int32_t c
|
|||
SQuery *pQuery = pRequest->pQuery;
|
||||
|
||||
pRequest->metric.ctgCostUs += taosGetTimestampUs() - pRequest->metric.ctgStart;
|
||||
qDebug("0x%" PRIx64 " start to continue parse, qid:0x%" PRIx64 ", code:%s", pRequest->self, pRequest->requestId,
|
||||
qDebug("0x%" PRIx64 " start to continue parse,QID:0x%" PRIx64 ", code:%s", pRequest->self, pRequest->requestId,
|
||||
tstrerror(code));
|
||||
|
||||
if (code == TSDB_CODE_SUCCESS) {
|
||||
|
@ -1130,7 +1168,7 @@ static void doAsyncQueryFromParse(SMetaData *pResultMeta, void *param, int32_t c
|
|||
}
|
||||
|
||||
if (TSDB_CODE_SUCCESS != code) {
|
||||
tscError("0x%" PRIx64 " error happens, code:%d - %s, qid:0x%" PRIx64, pWrapper->pRequest->self, code,
|
||||
tscError("0x%" PRIx64 " error happens, code:%d - %s,QID:0x%" PRIx64, pWrapper->pRequest->self, code,
|
||||
tstrerror(code), pWrapper->pRequest->requestId);
|
||||
destorySqlCallbackWrapper(pWrapper);
|
||||
pRequest->pWrapper = NULL;
|
||||
|
@ -1147,7 +1185,7 @@ void continueInsertFromCsv(SSqlCallbackWrapper *pWrapper, SRequestObj *pRequest)
|
|||
}
|
||||
|
||||
if (TSDB_CODE_SUCCESS != code) {
|
||||
tscError("0x%" PRIx64 " error happens, code:%d - %s, qid:0x%" PRIx64, pWrapper->pRequest->self, code,
|
||||
tscError("0x%" PRIx64 " error happens, code:%d - %s,QID:0x%" PRIx64, pWrapper->pRequest->self, code,
|
||||
tstrerror(code), pWrapper->pRequest->requestId);
|
||||
destorySqlCallbackWrapper(pWrapper);
|
||||
pRequest->pWrapper = NULL;
|
||||
|
@ -1265,7 +1303,7 @@ void doAsyncQuery(SRequestObj *pRequest, bool updateMetaForce) {
|
|||
}
|
||||
|
||||
if (TSDB_CODE_SUCCESS != code) {
|
||||
tscError("0x%" PRIx64 " error happens, code:%d - %s, qid:0x%" PRIx64, pRequest->self, code, tstrerror(code),
|
||||
tscError("0x%" PRIx64 " error happens, code:%d - %s,QID:0x%" PRIx64, pRequest->self, code, tstrerror(code),
|
||||
pRequest->requestId);
|
||||
destorySqlCallbackWrapper(pWrapper);
|
||||
pRequest->pWrapper = NULL;
|
||||
|
@ -1273,7 +1311,7 @@ void doAsyncQuery(SRequestObj *pRequest, bool updateMetaForce) {
|
|||
pRequest->pQuery = NULL;
|
||||
|
||||
if (NEED_CLIENT_HANDLE_ERROR(code)) {
|
||||
tscDebug("0x%" PRIx64 " client retry to handle the error, code:%d - %s, tryCount:%d, qid:0x%" PRIx64,
|
||||
tscDebug("0x%" PRIx64 " client retry to handle the error, code:%d - %s, tryCount:%d,QID:0x%" PRIx64,
|
||||
pRequest->self, code, tstrerror(code), pRequest->retry, pRequest->requestId);
|
||||
(void)refreshMeta(pRequest->pTscObj, pRequest); // ignore return code,try again
|
||||
pRequest->prevCode = code;
|
||||
|
|
|
@ -696,7 +696,7 @@ static void monitorSendAllSlowLogFromTempDir(int64_t clusterId) {
|
|||
continue;
|
||||
}
|
||||
if (taosLockFile(pFile) < 0) {
|
||||
tscError("failed to lock file:%s since %s, maybe used by other process", filename, terrstr());
|
||||
tscInfo("failed to lock file:%s since %s, maybe used by other process", filename, terrstr());
|
||||
(void)taosCloseFile(&pFile);
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -1570,7 +1570,7 @@ int32_t tmqPollCb(void* param, SDataBuf* pMsg, int32_t code) {
|
|||
if (msgEpoch < clientEpoch) {
|
||||
// do not write into queue since updating epoch reset
|
||||
tscWarn("consumer:0x%" PRIx64
|
||||
" msg discard from vgId:%d since from earlier epoch, rsp epoch %d, current epoch %d, qid:0x%" PRIx64,
|
||||
" msg discard from vgId:%d since from earlier epoch, rsp epoch %d, current epoch %d,QID:0x%" PRIx64,
|
||||
tmq->consumerId, vgId, msgEpoch, clientEpoch, requestId);
|
||||
code = TSDB_CODE_TMQ_CONSUMER_MISMATCH;
|
||||
goto END;
|
||||
|
@ -1603,7 +1603,7 @@ int32_t tmqPollCb(void* param, SDataBuf* pMsg, int32_t code) {
|
|||
|
||||
char buf[TSDB_OFFSET_LEN] = {0};
|
||||
tFormatOffset(buf, TSDB_OFFSET_LEN, &pRspWrapper->dataRsp.common.rspOffset);
|
||||
tscDebug("consumer:0x%" PRIx64 " recv poll rsp, vgId:%d, req ver:%" PRId64 ", rsp:%s type %d, qid:0x%" PRIx64,
|
||||
tscDebug("consumer:0x%" PRIx64 " recv poll rsp, vgId:%d, req ver:%" PRId64 ", rsp:%s type %d,QID:0x%" PRIx64,
|
||||
tmq->consumerId, vgId, pRspWrapper->dataRsp.common.reqOffset.version, buf, rspType, requestId);
|
||||
} else if (rspType == TMQ_MSG_TYPE__POLL_META_RSP) {
|
||||
SDecoder decoder = {0};
|
||||
|
@ -1635,7 +1635,7 @@ int32_t tmqPollCb(void* param, SDataBuf* pMsg, int32_t code) {
|
|||
}
|
||||
tDecoderClear(&decoder);
|
||||
(void)memcpy(&pRspWrapper->batchMetaRsp, pMsg->pData, sizeof(SMqRspHead));
|
||||
tscDebug("consumer:0x%" PRIx64 " recv poll batchmeta rsp, vgId:%d, qid:0x%" PRIx64, tmq->consumerId, vgId,
|
||||
tscDebug("consumer:0x%" PRIx64 " recv poll batchmeta rsp, vgId:%d,QID:0x%" PRIx64, tmq->consumerId, vgId,
|
||||
requestId);
|
||||
} else { // invalid rspType
|
||||
tscError("consumer:0x%" PRIx64 " invalid rsp msg received, type:%d ignored", tmq->consumerId, rspType);
|
||||
|
@ -1652,7 +1652,7 @@ END:
|
|||
}
|
||||
}
|
||||
int32_t total = taosQueueItemSize(tmq->mqueue);
|
||||
tscDebug("consumer:0x%" PRIx64 " put poll res into mqueue, type:%d, vgId:%d, total in queue:%d, qid:0x%" PRIx64,
|
||||
tscDebug("consumer:0x%" PRIx64 " put poll res into mqueue, type:%d, vgId:%d, total in queue:%d,QID:0x%" PRIx64,
|
||||
tmq ? tmq->consumerId : 0, rspType, vgId, total, requestId);
|
||||
|
||||
if (tmq) (void)tsem2_post(&tmq->rspSem);
|
||||
|
@ -2048,8 +2048,8 @@ static int32_t doTmqPollImpl(tmq_t* pTmq, SMqClientTopic* pTopic, SMqClientVg* p
|
|||
char offsetFormatBuf[TSDB_OFFSET_LEN] = {0};
|
||||
tFormatOffset(offsetFormatBuf, tListLen(offsetFormatBuf), &pVg->offsetInfo.endOffset);
|
||||
code = asyncSendMsgToServer(pTmq->pTscObj->pAppInfo->pTransporter, &pVg->epSet, &transporterId, sendInfo);
|
||||
tscDebug("consumer:0x%" PRIx64 " send poll to %s vgId:%d, code:%d, epoch %d, req:%s, qid:0x%" PRIx64,
|
||||
pTmq->consumerId, pTopic->topicName, pVg->vgId, code, pTmq->epoch, offsetFormatBuf, req.reqId);
|
||||
tscDebug("consumer:0x%" PRIx64 " send poll to %s vgId:%d, code:%d, epoch %d, req:%s,QID:0x%" PRIx64, pTmq->consumerId,
|
||||
pTopic->topicName, pVg->vgId, code, pTmq->epoch, offsetFormatBuf, req.reqId);
|
||||
if (code != 0) {
|
||||
return code;
|
||||
}
|
||||
|
@ -2221,7 +2221,7 @@ static void* tmqHandleAllRsp(tmq_t* tmq, int64_t timeout) {
|
|||
tFormatOffset(buf, TSDB_OFFSET_LEN, &pDataRsp->rspOffset);
|
||||
if (pDataRsp->blockNum == 0) {
|
||||
tscDebug("consumer:0x%" PRIx64 " empty block received, vgId:%d, offset:%s, vg total:%" PRId64
|
||||
", total:%" PRId64 ", qid:0x%" PRIx64,
|
||||
", total:%" PRId64 ",QID:0x%" PRIx64,
|
||||
tmq->consumerId, pVg->vgId, buf, pVg->numOfRows, tmq->totalRows, pollRspWrapper->reqId);
|
||||
pVg->emptyBlockReceiveTs = taosGetTimestampMs();
|
||||
tmqFreeRspWrapper(pRspWrapper);
|
||||
|
@ -2244,7 +2244,7 @@ static void* tmqHandleAllRsp(tmq_t* tmq, int64_t timeout) {
|
|||
}
|
||||
}
|
||||
tscDebug("consumer:0x%" PRIx64 " process poll rsp, vgId:%d, offset:%s, blocks:%d, rows:%" PRId64
|
||||
", vg total:%" PRId64 ", total:%" PRId64 ", qid:0x%" PRIx64,
|
||||
", vg total:%" PRId64 ", total:%" PRId64 ",QID:0x%" PRIx64,
|
||||
tmq->consumerId, pVg->vgId, buf, pDataRsp->blockNum, numOfRows, pVg->numOfRows, tmq->totalRows,
|
||||
pollRspWrapper->reqId);
|
||||
taosFreeQitem(pRspWrapper);
|
||||
|
@ -2355,7 +2355,7 @@ static void* tmqHandleAllRsp(tmq_t* tmq, int64_t timeout) {
|
|||
tmq->consumerId, pDataRsp->blockNum != 0);
|
||||
|
||||
if (pDataRsp->blockNum == 0) {
|
||||
tscDebug("consumer:0x%" PRIx64 " taosx empty block received, vgId:%d, vg total:%" PRId64 ", qid:0x%" PRIx64,
|
||||
tscDebug("consumer:0x%" PRIx64 " taosx empty block received, vgId:%d, vg total:%" PRId64 ",QID:0x%" PRIx64,
|
||||
tmq->consumerId, pVg->vgId, pVg->numOfRows, pollRspWrapper->reqId);
|
||||
pVg->emptyBlockReceiveTs = taosGetTimestampMs();
|
||||
tmqFreeRspWrapper(pRspWrapper);
|
||||
|
@ -2377,7 +2377,7 @@ static void* tmqHandleAllRsp(tmq_t* tmq, int64_t timeout) {
|
|||
char buf[TSDB_OFFSET_LEN] = {0};
|
||||
tFormatOffset(buf, TSDB_OFFSET_LEN, &pVg->offsetInfo.endOffset);
|
||||
tscDebug("consumer:0x%" PRIx64 " process taosx poll rsp, vgId:%d, offset:%s, blocks:%d, rows:%" PRId64
|
||||
", vg total:%" PRId64 ", total:%" PRId64 ", qid:0x%" PRIx64,
|
||||
", vg total:%" PRId64 ", total:%" PRId64 ",QID:0x%" PRIx64,
|
||||
tmq->consumerId, pVg->vgId, buf, pDataRsp->blockNum, numOfRows, pVg->numOfRows, tmq->totalRows,
|
||||
pollRspWrapper->reqId);
|
||||
|
||||
|
@ -2990,7 +2990,7 @@ int32_t askEp(tmq_t* pTmq, void* param, bool sync, bool updateEpSet) {
|
|||
sendInfo->msgType = TDMT_MND_TMQ_ASK_EP;
|
||||
|
||||
SEpSet epSet = getEpSet_s(&pTmq->pTscObj->pAppInfo->mgmtEp);
|
||||
tscDebug("consumer:0x%" PRIx64 " ask ep from mnode, qid:0x%" PRIx64, pTmq->consumerId, sendInfo->requestId);
|
||||
tscDebug("consumer:0x%" PRIx64 " ask ep from mnode,QID:0x%" PRIx64, pTmq->consumerId, sendInfo->requestId);
|
||||
return asyncSendMsgToServer(pTmq->pTscObj->pAppInfo->pTransporter, &epSet, NULL, sendInfo);
|
||||
}
|
||||
|
||||
|
@ -3497,7 +3497,7 @@ int32_t tmq_get_topic_assignment(tmq_t* tmq, const char* pTopicName, tmq_topic_a
|
|||
char offsetFormatBuf[TSDB_OFFSET_LEN] = {0};
|
||||
tFormatOffset(offsetFormatBuf, tListLen(offsetFormatBuf), &pClientVg->offsetInfo.beginOffset);
|
||||
|
||||
tscInfo("consumer:0x%" PRIx64 " %s retrieve wal info vgId:%d, epoch %d, req:%s, qid:0x%" PRIx64, tmq->consumerId,
|
||||
tscInfo("consumer:0x%" PRIx64 " %s retrieve wal info vgId:%d, epoch %d, req:%s,QID:0x%" PRIx64, tmq->consumerId,
|
||||
pTopic->topicName, pClientVg->vgId, tmq->epoch, offsetFormatBuf, req.reqId);
|
||||
code = asyncSendMsgToServer(tmq->pTscObj->pAppInfo->pTransporter, &pClientVg->epSet, &transporterId, sendInfo);
|
||||
if (code != 0) {
|
||||
|
|
|
@ -72,23 +72,42 @@ void s3CleanUp() { /*s3End();*/
|
|||
|
||||
static int32_t s3ListBucket(char const *bucketname);
|
||||
|
||||
static void s3DumpCfgByEp(int8_t epIndex) {
|
||||
// clang-format off
|
||||
(void)fprintf(stdout,
|
||||
"%-24s %s\n"
|
||||
"%-24s %s\n"
|
||||
"%-24s %s\n"
|
||||
"%-24s %s\n"
|
||||
"%-24s %s\n"
|
||||
"%-24s %s\n",
|
||||
"hostName", tsS3Hostname[epIndex],
|
||||
"bucketName", tsS3BucketName,
|
||||
"protocol", (protocolG[epIndex] == S3ProtocolHTTPS ? "https" : "http"),
|
||||
"uristyle", (uriStyleG[epIndex] == S3UriStyleVirtualHost ? "virtualhost" : "path"),
|
||||
"accessKey", tsS3AccessKeyId[epIndex],
|
||||
"accessKeySecret", tsS3AccessKeySecret[epIndex]);
|
||||
// clang-format on
|
||||
}
|
||||
|
||||
int32_t s3CheckCfg() {
|
||||
int32_t code = 0, lino = 0;
|
||||
int8_t i = 0;
|
||||
|
||||
if (!tsS3Enabled) {
|
||||
(void)fprintf(stderr, "s3 not configured.\n");
|
||||
goto _exit;
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
|
||||
code = s3Begin();
|
||||
if (code != 0) {
|
||||
(void)fprintf(stderr, "failed to initialize s3.\n");
|
||||
TAOS_CHECK_GOTO(code, &lino, _exit);
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
|
||||
for (; i < tsS3EpNum; i++) {
|
||||
(void)fprintf(stdout, "test s3 ep: %d/%d.\n", i + 1, tsS3EpNum);
|
||||
(void)fprintf(stdout, "test s3 ep (%d/%d):\n", i + 1, tsS3EpNum);
|
||||
s3DumpCfgByEp(i);
|
||||
|
||||
// test put
|
||||
char testdata[17] = "0123456789abcdef";
|
||||
|
@ -109,15 +128,15 @@ int32_t s3CheckCfg() {
|
|||
if (!fp) {
|
||||
(void)fprintf(stderr, "failed to open test file: %s.\n", path);
|
||||
// uError("ERROR: %s Failed to open %s", __func__, path);
|
||||
TAOS_CHECK_GOTO(TAOS_SYSTEM_ERROR(errno), &lino, _exit);
|
||||
TAOS_CHECK_GOTO(TAOS_SYSTEM_ERROR(errno), &lino, _next);
|
||||
}
|
||||
if (taosWriteFile(fp, testdata, strlen(testdata)) < 0) {
|
||||
(void)fprintf(stderr, "failed to write test file: %s.\n", path);
|
||||
TAOS_CHECK_GOTO(TAOS_SYSTEM_ERROR(errno), &lino, _exit);
|
||||
TAOS_CHECK_GOTO(TAOS_SYSTEM_ERROR(errno), &lino, _next);
|
||||
}
|
||||
if (taosFsyncFile(fp) < 0) {
|
||||
(void)fprintf(stderr, "failed to fsync test file: %s.\n", path);
|
||||
TAOS_CHECK_GOTO(TAOS_SYSTEM_ERROR(errno), &lino, _exit);
|
||||
TAOS_CHECK_GOTO(TAOS_SYSTEM_ERROR(errno), &lino, _next);
|
||||
}
|
||||
(void)taosCloseFile(&fp);
|
||||
|
||||
|
@ -125,7 +144,7 @@ int32_t s3CheckCfg() {
|
|||
code = s3PutObjectFromFileOffsetByEp(path, objectname[0], 0, 16, i);
|
||||
if (code != 0) {
|
||||
(void)fprintf(stderr, "put object %s : failed.\n", objectname[0]);
|
||||
TAOS_CHECK_GOTO(code, &lino, _exit);
|
||||
TAOS_CHECK_GOTO(code, &lino, _next);
|
||||
}
|
||||
(void)fprintf(stderr, "put object %s: success.\n\n", objectname[0]);
|
||||
|
||||
|
@ -134,7 +153,7 @@ int32_t s3CheckCfg() {
|
|||
code = s3ListBucketByEp(tsS3BucketName, i);
|
||||
if (code != 0) {
|
||||
(void)fprintf(stderr, "listing bucket %s : failed.\n", tsS3BucketName);
|
||||
TAOS_CHECK_GOTO(code, &lino, _exit);
|
||||
TAOS_CHECK_GOTO(code, &lino, _next);
|
||||
}
|
||||
(void)fprintf(stderr, "listing bucket %s: success.\n\n", tsS3BucketName);
|
||||
|
||||
|
@ -147,7 +166,7 @@ int32_t s3CheckCfg() {
|
|||
code = s3GetObjectBlockByEp(objectname[0], c_offset, c_len, true, &pBlock, i);
|
||||
if (code != 0) {
|
||||
(void)fprintf(stderr, "get object %s : failed.\n", objectname[0]);
|
||||
TAOS_CHECK_GOTO(code, &lino, _exit);
|
||||
TAOS_CHECK_GOTO(code, &lino, _next);
|
||||
}
|
||||
char buf[7] = {0};
|
||||
(void)memcpy(buf, pBlock, c_len);
|
||||
|
@ -160,18 +179,24 @@ int32_t s3CheckCfg() {
|
|||
code = s3DeleteObjectsByEp(objectname, 1, i);
|
||||
if (code != 0) {
|
||||
(void)fprintf(stderr, "delete object %s : failed.\n", objectname[0]);
|
||||
TAOS_CHECK_GOTO(code, &lino, _exit);
|
||||
TAOS_CHECK_GOTO(code, &lino, _next);
|
||||
}
|
||||
(void)fprintf(stderr, "delete object %s: success.\n\n", objectname[0]);
|
||||
|
||||
_next:
|
||||
if (fp) {
|
||||
(void)taosCloseFile(&fp);
|
||||
}
|
||||
|
||||
if (TSDB_CODE_SUCCESS != code) {
|
||||
(void)fprintf(stderr, "s3 check failed, code: %d, line: %d, index: %d.\n", code, lino, i);
|
||||
}
|
||||
|
||||
(void)fprintf(stdout, "=================================================================\n");
|
||||
}
|
||||
|
||||
s3End();
|
||||
|
||||
_exit:
|
||||
if (TSDB_CODE_SUCCESS != code) {
|
||||
(void)fprintf(stderr, "s3 check failed, code: %d, line: %d, index: %d.\n", code, lino, i);
|
||||
}
|
||||
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ int32_t getJsonValueLen(const char* data) {
|
|||
} else if (tTagIsJson(data)) { // json string
|
||||
dataLen = ((STag*)(data))->len;
|
||||
} else {
|
||||
ASSERT(0);
|
||||
uError("Invalid data type:%d in Json", *data);
|
||||
}
|
||||
return dataLen;
|
||||
}
|
||||
|
@ -801,7 +801,7 @@ int32_t blockDataSplitRows(SSDataBlock* pBlock, bool hasVarCol, int32_t startInd
|
|||
size_t rowSize = blockDataGetRowSize(pBlock);
|
||||
int32_t capacity = blockDataGetCapacityInRow(pBlock, pageSize, headerSize + colHeaderSize);
|
||||
if (capacity <= 0) {
|
||||
return TSDB_CODE_FAILED;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
*stopIndex = startIndex + capacity - 1;
|
||||
|
@ -835,7 +835,7 @@ int32_t blockDataSplitRows(SSDataBlock* pBlock, bool hasVarCol, int32_t startInd
|
|||
if (size > pageSize) { // pageSize must be able to hold one row
|
||||
*stopIndex = j - 1;
|
||||
if (*stopIndex < startIndex) {
|
||||
return TSDB_CODE_FAILED;
|
||||
return TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR;
|
||||
}
|
||||
|
||||
return TSDB_CODE_SUCCESS;
|
||||
|
@ -2060,7 +2060,7 @@ int32_t blockDataAppendColInfo(SSDataBlock* pBlock, SColumnInfoData* pColInfoDat
|
|||
}
|
||||
|
||||
// todo disable it temporarily
|
||||
// ASSERT(pColInfoData->info.type != 0);
|
||||
// A S S E R T(pColInfoData->info.type != 0);
|
||||
if (IS_VAR_DATA_TYPE(pColInfoData->info.type)) {
|
||||
pBlock->info.hasVarCol = true;
|
||||
}
|
||||
|
@ -2100,14 +2100,18 @@ size_t blockDataGetCapacityInRow(const SSDataBlock* pBlock, size_t pageSize, int
|
|||
int32_t payloadSize = pageSize - extraSize;
|
||||
int32_t rowSize = pBlock->info.rowSize;
|
||||
int32_t nRows = payloadSize / rowSize;
|
||||
ASSERT(nRows >= 1);
|
||||
if (nRows < 1) {
|
||||
uError("rows %d in page is too small, payloadSize:%d, rowSize:%d", nRows, payloadSize, rowSize);
|
||||
terrno = TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int32_t numVarCols = 0;
|
||||
int32_t numFixCols = 0;
|
||||
for (int32_t i = 0; i < numOfCols; ++i) {
|
||||
SColumnInfoData* pCol = taosArrayGet(pBlock->pDataBlock, i);
|
||||
if (pCol == NULL) {
|
||||
return terrno;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (IS_VAR_DATA_TYPE(pCol->info.type)) {
|
||||
|
@ -2135,7 +2139,11 @@ size_t blockDataGetCapacityInRow(const SSDataBlock* pBlock, size_t pageSize, int
|
|||
|
||||
int32_t newRows = (result != -1) ? result - 1 : nRows;
|
||||
// the true value must be less than the value of nRows
|
||||
ASSERT(newRows <= nRows && newRows >= 1);
|
||||
if (newRows > nRows || newRows < 1) {
|
||||
uError("invalid newRows:%d, nRows:%d", newRows, nRows);
|
||||
terrno = TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR;
|
||||
return -1;
|
||||
}
|
||||
|
||||
return newRows;
|
||||
}
|
||||
|
@ -2616,7 +2624,11 @@ int32_t buildSubmitReqFromDataBlock(SSubmitReq2** ppReq, const SSDataBlock* pDat
|
|||
}
|
||||
|
||||
// the rsma result should has the same column number with schema.
|
||||
ASSERT(colNum == pTSchema->numOfCols);
|
||||
if (colNum != pTSchema->numOfCols) {
|
||||
uError("colNum %d is not equal to numOfCols %d", colNum, pTSchema->numOfCols);
|
||||
code = TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR;
|
||||
goto _end;
|
||||
}
|
||||
|
||||
SSubmitTbData tbData = {0};
|
||||
|
||||
|
@ -2652,10 +2664,18 @@ int32_t buildSubmitReqFromDataBlock(SSubmitReq2** ppReq, const SSDataBlock* pDat
|
|||
|
||||
switch (pColInfoData->info.type) {
|
||||
case TSDB_DATA_TYPE_TIMESTAMP:
|
||||
ASSERT(pColInfoData->info.type == pCol->type);
|
||||
if (pColInfoData->info.type != pCol->type) {
|
||||
uError("colType:%d mismatch with sechma colType:%d", pColInfoData->info.type, pCol->type);
|
||||
terrno = TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR;
|
||||
return terrno;
|
||||
}
|
||||
if (!isStartKey) {
|
||||
isStartKey = true;
|
||||
ASSERT(PRIMARYKEY_TIMESTAMP_COL_ID == pCol->colId);
|
||||
if (PRIMARYKEY_TIMESTAMP_COL_ID != pCol->colId) {
|
||||
uError("the first timestamp colId %d is not primary colId", pCol->colId);
|
||||
terrno = TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR;
|
||||
return terrno;
|
||||
}
|
||||
SColVal cv = COL_VAL_VALUE(pCol->colId, ((SValue){.type = pCol->type, .val = *(TSKEY*)var}));
|
||||
void* px = taosArrayPush(pVals, &cv);
|
||||
if (px == NULL) {
|
||||
|
@ -2679,7 +2699,11 @@ int32_t buildSubmitReqFromDataBlock(SSubmitReq2** ppReq, const SSDataBlock* pDat
|
|||
case TSDB_DATA_TYPE_NCHAR:
|
||||
case TSDB_DATA_TYPE_VARBINARY:
|
||||
case TSDB_DATA_TYPE_VARCHAR: { // TSDB_DATA_TYPE_BINARY
|
||||
ASSERT(pColInfoData->info.type == pCol->type);
|
||||
if (pColInfoData->info.type != pCol->type) {
|
||||
uError("colType:%d mismatch with sechma colType:%d", pColInfoData->info.type, pCol->type);
|
||||
terrno = TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR;
|
||||
return terrno;
|
||||
}
|
||||
if (colDataIsNull_s(pColInfoData, j)) {
|
||||
SColVal cv = COL_VAL_NULL(pCol->colId, pCol->type);
|
||||
void* px = taosArrayPush(pVals, &cv);
|
||||
|
@ -2704,7 +2728,8 @@ int32_t buildSubmitReqFromDataBlock(SSubmitReq2** ppReq, const SSDataBlock* pDat
|
|||
case TSDB_DATA_TYPE_JSON:
|
||||
case TSDB_DATA_TYPE_MEDIUMBLOB:
|
||||
uError("the column type %" PRIi16 " is defined but not implemented yet", pColInfoData->info.type);
|
||||
ASSERT(0);
|
||||
terrno = TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR;
|
||||
return terrno;
|
||||
break;
|
||||
default:
|
||||
if (pColInfoData->info.type < TSDB_DATA_TYPE_MAX && pColInfoData->info.type > TSDB_DATA_TYPE_NULL) {
|
||||
|
@ -2752,7 +2777,8 @@ int32_t buildSubmitReqFromDataBlock(SSubmitReq2** ppReq, const SSDataBlock* pDat
|
|||
}
|
||||
} else {
|
||||
uError("the column type %" PRIi16 " is undefined\n", pColInfoData->info.type);
|
||||
ASSERT(0);
|
||||
terrno = TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR;
|
||||
return terrno;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -2763,7 +2789,6 @@ int32_t buildSubmitReqFromDataBlock(SSubmitReq2** ppReq, const SSDataBlock* pDat
|
|||
goto _end;
|
||||
}
|
||||
|
||||
ASSERT(pRow);
|
||||
void* px = taosArrayPush(tbData.aRowP, &pRow);
|
||||
if (px == NULL) {
|
||||
code = terrno;
|
||||
|
@ -2902,7 +2927,11 @@ int32_t blockEncode(const SSDataBlock* pBlock, char* data, int32_t numOfCols) {
|
|||
int32_t* rows = (int32_t*)data;
|
||||
*rows = pBlock->info.rows;
|
||||
data += sizeof(int32_t);
|
||||
ASSERT(*rows > 0);
|
||||
if (*rows <= 0) {
|
||||
uError("Invalid rows %d in block", *rows);
|
||||
terrno = TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int32_t* cols = (int32_t*)data;
|
||||
*cols = numOfCols;
|
||||
|
@ -3055,7 +3084,11 @@ int32_t blockDecode(SSDataBlock* pBlock, const char* pData, const char** pEndPos
|
|||
|
||||
for (int32_t i = 0; i < numOfCols; ++i) {
|
||||
colLen[i] = htonl(colLen[i]);
|
||||
ASSERT(colLen[i] >= 0);
|
||||
if (colLen[i] < 0) {
|
||||
uError("block decode colLen:%d error, colIdx:%d", colLen[i], i);
|
||||
terrno = TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
SColumnInfoData* pColInfoData = taosArrayGet(pBlock->pDataBlock, i);
|
||||
if (pColInfoData == NULL) {
|
||||
|
@ -3099,7 +3132,11 @@ int32_t blockDecode(SSDataBlock* pBlock, const char* pData, const char** pEndPos
|
|||
pBlock->info.dataLoad = 1;
|
||||
pBlock->info.rows = numOfRows;
|
||||
pBlock->info.blankFill = blankFill;
|
||||
ASSERT(pStart - pData == dataLen);
|
||||
if (pStart - pData != dataLen) {
|
||||
uError("block decode msg len error, pStart:%p, pData:%p, dataLen:%d", pStart, pData, dataLen);
|
||||
terrno = TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
*pEndPos = pStart;
|
||||
return code;
|
||||
|
|
|
@ -3302,229 +3302,74 @@ static int32_t tColDataSort(SColData *aColData, int32_t nColData) {
|
|||
|
||||
return tColDataMergeSort(aColData, 0, nVal - 1, nColData);
|
||||
}
|
||||
static void tColDataMergeImpl(SColData *pColData, int32_t iStart, int32_t iEnd /* not included */) {
|
||||
switch (pColData->flag) {
|
||||
case HAS_NONE:
|
||||
case HAS_NULL: {
|
||||
pColData->nVal -= (iEnd - iStart - 1);
|
||||
} break;
|
||||
case (HAS_NULL | HAS_NONE): {
|
||||
if (GET_BIT1(pColData->pBitMap, iStart) == 0) {
|
||||
for (int32_t i = iStart + 1; i < iEnd; ++i) {
|
||||
if (GET_BIT1(pColData->pBitMap, i) == 1) {
|
||||
SET_BIT1(pColData->pBitMap, iStart, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int32_t i = iEnd, j = iStart + 1; i < pColData->nVal; ++i, ++j) {
|
||||
SET_BIT1(pColData->pBitMap, j, GET_BIT1(pColData->pBitMap, i));
|
||||
}
|
||||
|
||||
pColData->nVal -= (iEnd - iStart - 1);
|
||||
static int32_t tColDataMerge(SArray **colArr) {
|
||||
int32_t code = 0;
|
||||
SArray *src = *colArr;
|
||||
SArray *dst = NULL;
|
||||
|
||||
uint8_t flag = 0;
|
||||
for (int32_t i = 0; i < pColData->nVal; ++i) {
|
||||
uint8_t bv = GET_BIT1(pColData->pBitMap, i);
|
||||
if (bv == BIT_FLG_NONE) {
|
||||
flag |= HAS_NONE;
|
||||
} else if (bv == BIT_FLG_NULL) {
|
||||
flag |= HAS_NULL;
|
||||
} else {
|
||||
uError("invalid bit value:%d", bv);
|
||||
return;
|
||||
}
|
||||
|
||||
if (flag == pColData->flag) break;
|
||||
}
|
||||
pColData->flag = flag;
|
||||
} break;
|
||||
case HAS_VALUE: {
|
||||
if (IS_VAR_DATA_TYPE(pColData->type)) {
|
||||
int32_t nDiff = pColData->aOffset[iEnd - 1] - pColData->aOffset[iStart];
|
||||
|
||||
memmove(pColData->pData + pColData->aOffset[iStart], pColData->pData + pColData->aOffset[iEnd - 1],
|
||||
pColData->nData - pColData->aOffset[iEnd - 1]);
|
||||
pColData->nData -= nDiff;
|
||||
|
||||
for (int32_t i = iEnd, j = iStart + 1; i < pColData->nVal; ++i, ++j) {
|
||||
pColData->aOffset[j] = pColData->aOffset[i] - nDiff;
|
||||
}
|
||||
} else {
|
||||
memmove(pColData->pData + TYPE_BYTES[pColData->type] * iStart,
|
||||
pColData->pData + TYPE_BYTES[pColData->type] * (iEnd - 1),
|
||||
TYPE_BYTES[pColData->type] * (pColData->nVal - iEnd + 1));
|
||||
pColData->nData -= (TYPE_BYTES[pColData->type] * (iEnd - iStart - 1));
|
||||
}
|
||||
|
||||
pColData->nVal -= (iEnd - iStart - 1);
|
||||
} break;
|
||||
case (HAS_VALUE | HAS_NONE): {
|
||||
uint8_t bv;
|
||||
int32_t iv;
|
||||
for (int32_t i = iEnd - 1; i >= iStart; --i) {
|
||||
bv = GET_BIT1(pColData->pBitMap, i);
|
||||
if (bv) {
|
||||
iv = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (bv) { // has a value
|
||||
if (IS_VAR_DATA_TYPE(pColData->type)) {
|
||||
if (iv != iStart) {
|
||||
memmove(&pColData->pData[pColData->aOffset[iStart]], &pColData->pData[pColData->aOffset[iv]],
|
||||
iv < (pColData->nVal - 1) ? pColData->aOffset[iv + 1] - pColData->aOffset[iv]
|
||||
: pColData->nData - pColData->aOffset[iv]);
|
||||
}
|
||||
} else {
|
||||
if (iv != iStart) {
|
||||
(void)memcpy(&pColData->pData[TYPE_BYTES[pColData->type] * iStart],
|
||||
&pColData->pData[TYPE_BYTES[pColData->type] * iv], TYPE_BYTES[pColData->type]);
|
||||
}
|
||||
memmove(&pColData->pData[TYPE_BYTES[pColData->type] * (iStart + 1)],
|
||||
&pColData->pData[TYPE_BYTES[pColData->type] * iEnd],
|
||||
TYPE_BYTES[pColData->type] * (iEnd - iStart - 1));
|
||||
pColData->nData -= (TYPE_BYTES[pColData->type] * (iEnd - iStart - 1));
|
||||
}
|
||||
|
||||
SET_BIT1(pColData->pBitMap, iStart, 1);
|
||||
for (int32_t i = iEnd, j = iStart + 1; i < pColData->nVal; ++i, ++j) {
|
||||
SET_BIT1(pColData->pBitMap, j, GET_BIT1(pColData->pBitMap, i));
|
||||
}
|
||||
|
||||
uint8_t flag = HAS_VALUE;
|
||||
for (int32_t i = 0; i < pColData->nVal - (iEnd - iStart - 1); ++i) {
|
||||
if (GET_BIT1(pColData->pBitMap, i) == 0) {
|
||||
flag |= HAS_NONE;
|
||||
}
|
||||
|
||||
if (flag == pColData->flag) break;
|
||||
}
|
||||
pColData->flag = flag;
|
||||
} else { // all NONE
|
||||
if (IS_VAR_DATA_TYPE(pColData->type)) {
|
||||
int32_t nDiff = pColData->aOffset[iEnd - 1] - pColData->aOffset[iStart];
|
||||
|
||||
memmove(&pColData->pData[pColData->aOffset[iStart]], &pColData->pData[pColData->aOffset[iEnd - 1]],
|
||||
pColData->nData - pColData->aOffset[iEnd - 1]);
|
||||
pColData->nData -= nDiff;
|
||||
|
||||
for (int32_t i = iEnd, j = iStart + 1; i < pColData->nVal; ++i, ++j) {
|
||||
pColData->aOffset[j] = pColData->aOffset[i] - nDiff;
|
||||
}
|
||||
} else {
|
||||
memmove(pColData->pData + TYPE_BYTES[pColData->type] * (iStart + 1),
|
||||
pColData->pData + TYPE_BYTES[pColData->type] * iEnd,
|
||||
TYPE_BYTES[pColData->type] * (pColData->nVal - iEnd + 1));
|
||||
pColData->nData -= (TYPE_BYTES[pColData->type] * (iEnd - iStart - 1));
|
||||
}
|
||||
|
||||
for (int32_t i = iEnd, j = iStart + 1; i < pColData->nVal; ++i, ++j) {
|
||||
SET_BIT1(pColData->pBitMap, j, GET_BIT1(pColData->pBitMap, i));
|
||||
}
|
||||
}
|
||||
pColData->nVal -= (iEnd - iStart - 1);
|
||||
} break;
|
||||
case (HAS_VALUE | HAS_NULL): {
|
||||
if (IS_VAR_DATA_TYPE(pColData->type)) {
|
||||
int32_t nDiff = pColData->aOffset[iEnd - 1] - pColData->aOffset[iStart];
|
||||
|
||||
memmove(pColData->pData + pColData->aOffset[iStart], pColData->pData + pColData->aOffset[iEnd - 1],
|
||||
pColData->nData - pColData->aOffset[iEnd - 1]);
|
||||
pColData->nData -= nDiff;
|
||||
|
||||
for (int32_t i = iEnd, j = iStart + 1; i < pColData->nVal; ++i, ++j) {
|
||||
pColData->aOffset[j] = pColData->aOffset[i] - nDiff;
|
||||
}
|
||||
} else {
|
||||
memmove(pColData->pData + TYPE_BYTES[pColData->type] * iStart,
|
||||
pColData->pData + TYPE_BYTES[pColData->type] * (iEnd - 1),
|
||||
TYPE_BYTES[pColData->type] * (pColData->nVal - iEnd + 1));
|
||||
pColData->nData -= (TYPE_BYTES[pColData->type] * (iEnd - iStart - 1));
|
||||
}
|
||||
|
||||
for (int32_t i = iEnd - 1, j = iStart; i < pColData->nVal; ++i, ++j) {
|
||||
SET_BIT1(pColData->pBitMap, j, GET_BIT1(pColData->pBitMap, i));
|
||||
}
|
||||
|
||||
pColData->nVal -= (iEnd - iStart - 1);
|
||||
|
||||
uint8_t flag = 0;
|
||||
for (int32_t i = 0; i < pColData->nVal; ++i) {
|
||||
if (GET_BIT1(pColData->pBitMap, i)) {
|
||||
flag |= HAS_VALUE;
|
||||
} else {
|
||||
flag |= HAS_NULL;
|
||||
}
|
||||
|
||||
if (flag == pColData->flag) break;
|
||||
}
|
||||
pColData->flag = flag;
|
||||
} break;
|
||||
case (HAS_VALUE | HAS_NULL | HAS_NONE): {
|
||||
uint8_t bv;
|
||||
int32_t iv;
|
||||
for (int32_t i = iEnd - 1; i >= iStart; --i) {
|
||||
bv = GET_BIT2(pColData->pBitMap, i);
|
||||
if (bv) {
|
||||
iv = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (bv) {
|
||||
// TODO
|
||||
ASSERT(0);
|
||||
} else { // ALL NONE
|
||||
if (IS_VAR_DATA_TYPE(pColData->type)) {
|
||||
// TODO
|
||||
ASSERT(0);
|
||||
} else {
|
||||
memmove(pColData->pData + TYPE_BYTES[pColData->type] * (iStart + 1),
|
||||
pColData->pData + TYPE_BYTES[pColData->type] * iEnd,
|
||||
TYPE_BYTES[pColData->type] * (pColData->nVal - iEnd));
|
||||
pColData->nData -= (TYPE_BYTES[pColData->type] * (iEnd - iStart - 1));
|
||||
}
|
||||
|
||||
for (int32_t i = iEnd, j = iStart + 1; i < pColData->nVal; ++i, ++j) {
|
||||
SET_BIT2(pColData->pBitMap, j, GET_BIT2(pColData->pBitMap, i));
|
||||
}
|
||||
}
|
||||
pColData->nVal -= (iEnd - iStart - 1);
|
||||
} break;
|
||||
default:
|
||||
ASSERT(0);
|
||||
break;
|
||||
dst = taosArrayInit(taosArrayGetSize(src), sizeof(SColData));
|
||||
if (dst == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
}
|
||||
static void tColDataMerge(SColData *aColData, int32_t nColData) {
|
||||
int32_t iStart = 0;
|
||||
SRowKey keyStart, keyEnd;
|
||||
|
||||
for (;;) {
|
||||
if (iStart >= aColData[0].nVal - 1) break;
|
||||
tColDataArrGetRowKey(aColData, nColData, iStart, &keyStart);
|
||||
for (int32_t i = 0; i < taosArrayGetSize(src); i++) {
|
||||
SColData *srcCol = taosArrayGet(src, i);
|
||||
|
||||
int32_t iEnd = iStart + 1;
|
||||
while (iEnd < aColData[0].nVal) {
|
||||
tColDataArrGetRowKey(aColData, nColData, iEnd, &keyEnd);
|
||||
if (tRowKeyCompare(&keyStart, &keyEnd) != 0) break;
|
||||
|
||||
iEnd++;
|
||||
SColData *dstCol = taosArrayReserve(dst, 1);
|
||||
if (dstCol == NULL) {
|
||||
code = terrno;
|
||||
goto _exit;
|
||||
}
|
||||
tColDataInit(dstCol, srcCol->cid, srcCol->type, srcCol->cflag);
|
||||
}
|
||||
|
||||
if (iEnd - iStart > 1) {
|
||||
for (int32_t i = 0; i < nColData; i++) {
|
||||
tColDataMergeImpl(&aColData[i], iStart, iEnd);
|
||||
int32_t numRows = ((SColData *)TARRAY_DATA(src))->nVal;
|
||||
SRowKey lastKey;
|
||||
for (int32_t i = 0; i < numRows; i++) {
|
||||
SRowKey key;
|
||||
tColDataArrGetRowKey((SColData *)TARRAY_DATA(src), taosArrayGetSize(src), i, &key);
|
||||
|
||||
if (i == 0 || tRowKeyCompare(&key, &lastKey) != 0) { // append new row
|
||||
for (int32_t j = 0; j < taosArrayGetSize(src); j++) {
|
||||
SColData *srcCol = taosArrayGet(src, j);
|
||||
SColData *dstCol = taosArrayGet(dst, j);
|
||||
|
||||
SColVal cv;
|
||||
tColDataGetValue(srcCol, i, &cv);
|
||||
code = tColDataAppendValue(dstCol, &cv);
|
||||
if (code) {
|
||||
goto _exit;
|
||||
}
|
||||
}
|
||||
lastKey = key;
|
||||
} else { // update existing row
|
||||
for (int32_t j = 0; j < taosArrayGetSize(src); j++) {
|
||||
SColData *srcCol = taosArrayGet(src, j);
|
||||
SColData *dstCol = taosArrayGet(dst, j);
|
||||
|
||||
SColVal cv;
|
||||
tColDataGetValue(srcCol, i, &cv);
|
||||
code = tColDataUpdateValue(dstCol, &cv, true);
|
||||
if (code) {
|
||||
goto _exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
iStart++;
|
||||
}
|
||||
|
||||
_exit:
|
||||
if (code) {
|
||||
taosArrayDestroyEx(dst, tColDataDestroy);
|
||||
} else {
|
||||
taosArrayDestroyEx(src, tColDataDestroy);
|
||||
*colArr = dst;
|
||||
}
|
||||
return code;
|
||||
}
|
||||
|
||||
int32_t tColDataSortMerge(SArray *colDataArr) {
|
||||
int32_t tColDataSortMerge(SArray **arr) {
|
||||
SArray *colDataArr = *arr;
|
||||
int32_t nColData = TARRAY_SIZE(colDataArr);
|
||||
SColData *aColData = (SColData *)TARRAY_DATA(colDataArr);
|
||||
|
||||
|
@ -3583,7 +3428,8 @@ int32_t tColDataSortMerge(SArray *colDataArr) {
|
|||
|
||||
// merge -------
|
||||
if (doMerge) {
|
||||
tColDataMerge(aColData, nColData);
|
||||
int32_t code = tColDataMerge(arr);
|
||||
if (code) return code;
|
||||
}
|
||||
|
||||
_exit:
|
||||
|
|
|
@ -515,7 +515,7 @@ static int32_t taosLoadCfg(SConfig *pCfg, const char **envCmd, const char *input
|
|||
int32_t taosAddClientLogCfg(SConfig *pCfg) {
|
||||
TAOS_CHECK_RETURN(cfgAddDir(pCfg, "configDir", configDir, CFG_SCOPE_BOTH, CFG_DYN_NONE));
|
||||
TAOS_CHECK_RETURN(cfgAddDir(pCfg, "scriptDir", configDir, CFG_SCOPE_BOTH, CFG_DYN_NONE));
|
||||
TAOS_CHECK_RETURN(cfgAddDir(pCfg, "logDir", tsLogDir, CFG_SCOPE_BOTH, CFG_DYN_CLIENT));
|
||||
TAOS_CHECK_RETURN(cfgAddDir(pCfg, "logDir", tsLogDir, CFG_SCOPE_BOTH, CFG_DYN_NONE));
|
||||
TAOS_CHECK_RETURN(cfgAddFloat(pCfg, "minimalLogDirGB", 1.0f, 0.001f, 10000000, CFG_SCOPE_BOTH, CFG_DYN_CLIENT));
|
||||
TAOS_CHECK_RETURN(
|
||||
cfgAddInt32(pCfg, "numOfLogLines", tsNumOfLogLines, 1000, 2000000000, CFG_SCOPE_BOTH, CFG_DYN_ENT_BOTH));
|
||||
|
@ -638,7 +638,7 @@ static int32_t taosAddSystemCfg(SConfig *pCfg) {
|
|||
TAOS_CHECK_RETURN(cfgAddLocale(pCfg, "locale", tsLocale, CFG_SCOPE_BOTH, CFG_DYN_CLIENT));
|
||||
TAOS_CHECK_RETURN(cfgAddCharset(pCfg, "charset", tsCharset, CFG_SCOPE_BOTH, CFG_DYN_NONE));
|
||||
TAOS_CHECK_RETURN(cfgAddBool(pCfg, "assert", tsAssert, CFG_SCOPE_BOTH, CFG_DYN_CLIENT));
|
||||
TAOS_CHECK_RETURN(cfgAddBool(pCfg, "enableCoreFile", 1, CFG_SCOPE_BOTH, CFG_DYN_CLIENT));
|
||||
TAOS_CHECK_RETURN(cfgAddBool(pCfg, "enableCoreFile", tsEnableCoreFile, CFG_SCOPE_BOTH, CFG_DYN_BOTH));
|
||||
TAOS_CHECK_RETURN(cfgAddFloat(pCfg, "numOfCores", tsNumOfCores, 1, 100000, CFG_SCOPE_BOTH, CFG_DYN_NONE));
|
||||
|
||||
TAOS_CHECK_RETURN(cfgAddBool(pCfg, "ssd42", tsSSE42Supported, CFG_SCOPE_BOTH, CFG_DYN_NONE));
|
||||
|
@ -1287,8 +1287,8 @@ static int32_t taosSetSystemCfg(SConfig *pCfg) {
|
|||
osSetSystemLocale(locale, charset);
|
||||
|
||||
TAOS_CHECK_GET_CFG_ITEM(pCfg, pItem, "enableCoreFile");
|
||||
bool enableCore = pItem->bval;
|
||||
taosSetCoreDump(enableCore);
|
||||
tsEnableCoreFile = pItem->bval;
|
||||
taosSetCoreDump(tsEnableCoreFile);
|
||||
|
||||
TAOS_CHECK_GET_CFG_ITEM(pCfg, pItem, "assert");
|
||||
tsAssert = pItem->bval;
|
||||
|
@ -1901,6 +1901,13 @@ static int32_t taosCfgDynamicOptionsForServer(SConfig *pCfg, const char *name) {
|
|||
goto _exit;
|
||||
}
|
||||
|
||||
if (strncasecmp(name, "enableCoreFile", 9) == 0) {
|
||||
tsEnableCoreFile = pItem->bval;
|
||||
taosSetCoreDump(tsEnableCoreFile);
|
||||
uInfo("%s set to %d", name, tsEnableCoreFile);
|
||||
goto _exit;
|
||||
}
|
||||
|
||||
if (strcasecmp("slowLogScope", name) == 0) {
|
||||
int32_t scope = 0;
|
||||
TAOS_CHECK_GOTO(taosSetSlowLogScope(pItem->str, &scope), NULL, _exit);
|
||||
|
@ -2009,9 +2016,9 @@ static int32_t taosCfgDynamicOptionsForClient(SConfig *pCfg, const char *name) {
|
|||
}
|
||||
case 'e': {
|
||||
if (strcasecmp("enableCoreFile", name) == 0) {
|
||||
bool enableCore = pItem->bval;
|
||||
taosSetCoreDump(enableCore);
|
||||
uInfo("%s set to %d", name, enableCore);
|
||||
tsEnableCoreFile = pItem->bval;
|
||||
taosSetCoreDump(tsEnableCoreFile);
|
||||
uInfo("%s set to %d", name, tsEnableCoreFile);
|
||||
matched = true;
|
||||
}
|
||||
break;
|
||||
|
@ -2088,11 +2095,6 @@ static int32_t taosCfgDynamicOptionsForClient(SConfig *pCfg, const char *name) {
|
|||
osSetSystemLocale(locale, charset);
|
||||
uInfo("locale set to '%s', charset set to '%s'", locale, charset);
|
||||
matched = true;
|
||||
} else if (strcasecmp("logDir", name) == 0) {
|
||||
uInfo("%s set from '%s' to '%s'", name, tsLogDir, pItem->str);
|
||||
tstrncpy(tsLogDir, pItem->str, PATH_MAX);
|
||||
TAOS_CHECK_GOTO(taosExpandDir(tsLogDir, tsLogDir, PATH_MAX), &lino, _out);
|
||||
matched = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -2205,7 +2207,6 @@ static int32_t taosCfgDynamicOptionsForClient(SConfig *pCfg, const char *name) {
|
|||
{"compressMsgSize", &tsCompressMsgSize},
|
||||
{"countAlwaysReturnValue", &tsCountAlwaysReturnValue},
|
||||
{"crashReporting", &tsEnableCrashReport},
|
||||
{"enableCoreFile", &tsAsyncLog},
|
||||
{"enableQueryHb", &tsEnableQueryHb},
|
||||
{"keepColumnName", &tsKeepColumnName},
|
||||
{"keepAliveIdle", &tsKeepAliveIdle},
|
||||
|
|
|
@ -566,30 +566,34 @@ int32_t tSerializeSClientHbBatchRsp(void *buf, int32_t bufLen, const SClientHbBa
|
|||
int32_t tDeserializeSClientHbBatchRsp(void *buf, int32_t bufLen, SClientHbBatchRsp *pBatchRsp) {
|
||||
SDecoder decoder = {0};
|
||||
tDecoderInit(&decoder, buf, bufLen);
|
||||
int32_t ret = -1;
|
||||
|
||||
if (tStartDecode(&decoder) < 0) return -1;
|
||||
if (tDecodeI64(&decoder, &pBatchRsp->reqId) < 0) return -1;
|
||||
if (tDecodeI64(&decoder, &pBatchRsp->rspId) < 0) return -1;
|
||||
if (tDecodeI32(&decoder, &pBatchRsp->svrTimestamp) < 0) return -1;
|
||||
if (tStartDecode(&decoder) < 0) goto _END;
|
||||
if (tDecodeI64(&decoder, &pBatchRsp->reqId) < 0) goto _END;
|
||||
if (tDecodeI64(&decoder, &pBatchRsp->rspId) < 0) goto _END;
|
||||
if (tDecodeI32(&decoder, &pBatchRsp->svrTimestamp) < 0) goto _END;
|
||||
|
||||
int32_t rspNum = 0;
|
||||
if (tDecodeI32(&decoder, &rspNum) < 0) return -1;
|
||||
if (tDecodeI32(&decoder, &rspNum) < 0) goto _END;
|
||||
if (pBatchRsp->rsps == NULL) {
|
||||
if ((pBatchRsp->rsps = taosArrayInit(rspNum, sizeof(SClientHbRsp))) == NULL) return -1;
|
||||
if ((pBatchRsp->rsps = taosArrayInit(rspNum, sizeof(SClientHbRsp))) == NULL) goto _END;
|
||||
}
|
||||
for (int32_t i = 0; i < rspNum; i++) {
|
||||
SClientHbRsp rsp = {0};
|
||||
if (tDeserializeSClientHbRsp(&decoder, &rsp) < 0) return -1;
|
||||
if (taosArrayPush(pBatchRsp->rsps, &rsp) == NULL) return -1;
|
||||
if (tDeserializeSClientHbRsp(&decoder, &rsp) < 0) goto _END;
|
||||
if (taosArrayPush(pBatchRsp->rsps, &rsp) == NULL) goto _END;
|
||||
}
|
||||
|
||||
if (!tDecodeIsEnd(&decoder)) {
|
||||
if (tDeserializeSMonitorParas(&decoder, &pBatchRsp->monitorParas) < 0) return -1;
|
||||
if (tDeserializeSMonitorParas(&decoder, &pBatchRsp->monitorParas) < 0) goto _END;
|
||||
}
|
||||
|
||||
tEndDecode(&decoder);
|
||||
ret = 0;
|
||||
|
||||
_END:
|
||||
tDecoderClear(&decoder);
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
int32_t tSerializeSMCreateStbReq(void *buf, int32_t bufLen, SMCreateStbReq *pReq) {
|
||||
|
@ -5258,44 +5262,47 @@ int32_t tSerializeSConnectRsp(void *buf, int32_t bufLen, SConnectRsp *pRsp) {
|
|||
int32_t tDeserializeSConnectRsp(void *buf, int32_t bufLen, SConnectRsp *pRsp) {
|
||||
SDecoder decoder = {0};
|
||||
tDecoderInit(&decoder, buf, bufLen);
|
||||
int32_t ret = -1;
|
||||
|
||||
if (tStartDecode(&decoder) < 0) return -1;
|
||||
if (tDecodeI32(&decoder, &pRsp->acctId) < 0) return -1;
|
||||
if (tDecodeI64(&decoder, &pRsp->clusterId) < 0) return -1;
|
||||
if (tDecodeU32(&decoder, &pRsp->connId) < 0) return -1;
|
||||
if (tDecodeI32(&decoder, &pRsp->dnodeNum) < 0) return -1;
|
||||
if (tDecodeI8(&decoder, &pRsp->superUser) < 0) return -1;
|
||||
if (tDecodeI8(&decoder, &pRsp->sysInfo) < 0) return -1;
|
||||
if (tDecodeI8(&decoder, &pRsp->connType) < 0) return -1;
|
||||
if (tDecodeSEpSet(&decoder, &pRsp->epSet) < 0) return -1;
|
||||
if (tDecodeI32(&decoder, &pRsp->svrTimestamp) < 0) return -1;
|
||||
if (tDecodeCStrTo(&decoder, pRsp->sVer) < 0) return -1;
|
||||
if (tDecodeCStrTo(&decoder, pRsp->sDetailVer) < 0) return -1;
|
||||
if (tStartDecode(&decoder) < 0) goto _END;
|
||||
if (tDecodeI32(&decoder, &pRsp->acctId) < 0) goto _END;
|
||||
if (tDecodeI64(&decoder, &pRsp->clusterId) < 0) goto _END;
|
||||
if (tDecodeU32(&decoder, &pRsp->connId) < 0) goto _END;
|
||||
if (tDecodeI32(&decoder, &pRsp->dnodeNum) < 0) goto _END;
|
||||
if (tDecodeI8(&decoder, &pRsp->superUser) < 0) goto _END;
|
||||
if (tDecodeI8(&decoder, &pRsp->sysInfo) < 0) goto _END;
|
||||
if (tDecodeI8(&decoder, &pRsp->connType) < 0) goto _END;
|
||||
if (tDecodeSEpSet(&decoder,&pRsp->epSet) < 0) goto _END;
|
||||
if (tDecodeI32(&decoder, &pRsp->svrTimestamp) < 0) goto _END;
|
||||
if (tDecodeCStrTo(&decoder, pRsp->sVer) < 0) goto _END;
|
||||
if (tDecodeCStrTo(&decoder, pRsp->sDetailVer) < 0) goto _END;
|
||||
|
||||
if (!tDecodeIsEnd(&decoder)) {
|
||||
if (tDecodeI32(&decoder, &pRsp->passVer) < 0) return -1;
|
||||
if (tDecodeI32(&decoder, &pRsp->passVer) < 0) goto _END;
|
||||
} else {
|
||||
pRsp->passVer = 0;
|
||||
}
|
||||
// since 3.0.7.0
|
||||
if (!tDecodeIsEnd(&decoder)) {
|
||||
if (tDecodeI32(&decoder, &pRsp->authVer) < 0) return -1;
|
||||
if (tDecodeI32(&decoder, &pRsp->authVer) < 0) goto _END;
|
||||
} else {
|
||||
pRsp->authVer = 0;
|
||||
}
|
||||
|
||||
if (!tDecodeIsEnd(&decoder)) {
|
||||
if (tDecodeI64(&decoder, &pRsp->whiteListVer) < 0) return -1;
|
||||
if (tDecodeI64(&decoder, &pRsp->whiteListVer) < 0) goto _END;
|
||||
} else {
|
||||
pRsp->whiteListVer = 0;
|
||||
}
|
||||
if (!tDecodeIsEnd(&decoder)) {
|
||||
if (tDeserializeSMonitorParas(&decoder, &pRsp->monitorParas) < 0) return -1;
|
||||
if (tDeserializeSMonitorParas(&decoder, &pRsp->monitorParas) < 0) goto _END;
|
||||
}
|
||||
tEndDecode(&decoder);
|
||||
ret = 0;
|
||||
|
||||
_END:
|
||||
tDecoderClear(&decoder);
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
int32_t tSerializeSMTimerMsg(void *buf, int32_t bufLen, SMTimerReq *pReq) {
|
||||
|
|
|
@ -83,12 +83,12 @@ extern "C" {
|
|||
}\
|
||||
}
|
||||
|
||||
#define dGFatal(param, ...) {if (dDebugFlag & DEBUG_FATAL) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); dFatal(param ", qid:%s", __VA_ARGS__, buf);}}
|
||||
#define dGError(param, ...) {if (dDebugFlag & DEBUG_ERROR) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); dError(param ", qid:%s", __VA_ARGS__, buf);}}
|
||||
#define dGWarn(param, ...) {if (dDebugFlag & DEBUG_WARN) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); dWarn(param ", qid:%s", __VA_ARGS__, buf);}}
|
||||
#define dGInfo(param, ...) {if (dDebugFlag & DEBUG_INFO) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); dInfo(param ", qid:%s", __VA_ARGS__, buf);}}
|
||||
#define dGDebug(param, ...) {if (dDebugFlag & DEBUG_DEBUG) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); dDebug(param ", qid:%s", __VA_ARGS__, buf);}}
|
||||
#define dGTrace(param, ...) {if (dDebugFlag & DEBUG_TRACE) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); dTrace(param ", qid:%s", __VA_ARGS__, buf);}}
|
||||
#define dGFatal(param, ...) {if (dDebugFlag & DEBUG_FATAL) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); dFatal(param ",QID:%s", __VA_ARGS__, buf);}}
|
||||
#define dGError(param, ...) {if (dDebugFlag & DEBUG_ERROR) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); dError(param ",QID:%s", __VA_ARGS__, buf);}}
|
||||
#define dGWarn(param, ...) {if (dDebugFlag & DEBUG_WARN) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); dWarn(param ",QID:%s", __VA_ARGS__, buf);}}
|
||||
#define dGInfo(param, ...) {if (dDebugFlag & DEBUG_INFO) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); dInfo(param ",QID:%s", __VA_ARGS__, buf);}}
|
||||
#define dGDebug(param, ...) {if (dDebugFlag & DEBUG_DEBUG) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); dDebug(param ",QID:%s", __VA_ARGS__, buf);}}
|
||||
#define dGTrace(param, ...) {if (dDebugFlag & DEBUG_TRACE) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); dTrace(param ",QID:%s", __VA_ARGS__, buf);}}
|
||||
|
||||
// clang-format on
|
||||
|
||||
|
|
|
@ -41,12 +41,12 @@ extern "C" {
|
|||
#define mDebug(...) { if (mDebugFlag & DEBUG_DEBUG) { taosPrintLog("MND ", DEBUG_DEBUG, mDebugFlag, __VA_ARGS__); }}
|
||||
#define mTrace(...) { if (mDebugFlag & DEBUG_TRACE) { taosPrintLog("MND ", DEBUG_TRACE, mDebugFlag, __VA_ARGS__); }}
|
||||
|
||||
#define mGFatal(param, ...) { if (mDebugFlag & DEBUG_FATAL){ char buf[40] = {0}; TRACE_TO_STR(trace, buf); mFatal(param ", qid:%s", __VA_ARGS__, buf);}}
|
||||
#define mGError(param, ...) { if (mDebugFlag & DEBUG_ERROR){ char buf[40] = {0}; TRACE_TO_STR(trace, buf); mError(param ", qid:%s", __VA_ARGS__, buf);}}
|
||||
#define mGWarn(param, ...) { if (mDebugFlag & DEBUG_WARN){ char buf[40] = {0}; TRACE_TO_STR(trace, buf); mWarn (param ", qid:%s", __VA_ARGS__, buf);}}
|
||||
#define mGInfo(param, ...) { if (mDebugFlag & DEBUG_INFO){ char buf[40] = {0}; TRACE_TO_STR(trace, buf); mInfo (param ", qid:%s", __VA_ARGS__, buf);}}
|
||||
#define mGDebug(param, ...) { if (mDebugFlag & DEBUG_DEBUG){ char buf[40] = {0}; TRACE_TO_STR(trace, buf); mDebug(param ", qid:%s", __VA_ARGS__, buf);}}
|
||||
#define mGTrace(param, ...) { if (mDebugFlag & DEBUG_TRACE){ char buf[40] = {0}; TRACE_TO_STR(trace, buf); mTrace(param ", qid:%s", __VA_ARGS__, buf);}}
|
||||
#define mGFatal(param, ...) { if (mDebugFlag & DEBUG_FATAL){ char buf[40] = {0}; TRACE_TO_STR(trace, buf); mFatal(param ",QID:%s", __VA_ARGS__, buf);}}
|
||||
#define mGError(param, ...) { if (mDebugFlag & DEBUG_ERROR){ char buf[40] = {0}; TRACE_TO_STR(trace, buf); mError(param ",QID:%s", __VA_ARGS__, buf);}}
|
||||
#define mGWarn(param, ...) { if (mDebugFlag & DEBUG_WARN){ char buf[40] = {0}; TRACE_TO_STR(trace, buf); mWarn (param ",QID:%s", __VA_ARGS__, buf);}}
|
||||
#define mGInfo(param, ...) { if (mDebugFlag & DEBUG_INFO){ char buf[40] = {0}; TRACE_TO_STR(trace, buf); mInfo (param ",QID:%s", __VA_ARGS__, buf);}}
|
||||
#define mGDebug(param, ...) { if (mDebugFlag & DEBUG_DEBUG){ char buf[40] = {0}; TRACE_TO_STR(trace, buf); mDebug(param ",QID:%s", __VA_ARGS__, buf);}}
|
||||
#define mGTrace(param, ...) { if (mDebugFlag & DEBUG_TRACE){ char buf[40] = {0}; TRACE_TO_STR(trace, buf); mTrace(param ",QID:%s", __VA_ARGS__, buf);}}
|
||||
// clang-format on
|
||||
|
||||
#define SYSTABLE_SCH_TABLE_NAME_LEN ((TSDB_TABLE_NAME_LEN - 1) + VARSTR_HEADER_SIZE)
|
||||
|
|
|
@ -404,10 +404,14 @@ static int32_t mndProcessArbHbTimer(SRpcMsg *pReq) {
|
|||
hbMembers = *(SArray **)pObj;
|
||||
} else {
|
||||
hbMembers = taosArrayInit(16, sizeof(SVArbHbReqMember));
|
||||
(void)taosHashPut(pDnodeHash, &dnodeId, sizeof(int32_t), &hbMembers, POINTER_BYTES);
|
||||
if (taosHashPut(pDnodeHash, &dnodeId, sizeof(int32_t), &hbMembers, POINTER_BYTES) != 0) {
|
||||
mError("dnodeId:%d, failed to push hb member inty]o hash, but conitnue next at this timer round", dnodeId);
|
||||
}
|
||||
}
|
||||
SVArbHbReqMember reqMember = {.vgId = pArbGroup->vgId, .hbSeq = pMember->state.nextHbSeq++};
|
||||
(void)taosArrayPush(hbMembers, &reqMember);
|
||||
if (taosArrayPush(hbMembers, &reqMember) == NULL) {
|
||||
mError("dnodeId:%d, failed to push hb member, but conitnue next at this timer round", dnodeId);
|
||||
}
|
||||
}
|
||||
|
||||
(void)taosThreadMutexUnlock(&pArbGroup->mutex);
|
||||
|
@ -998,7 +1002,9 @@ static int32_t mndUpdateArbHeartBeat(SMnode *pMnode, int32_t dnodeId, SArray *me
|
|||
|
||||
bool updateToken = mndUpdateArbGroupByHeartBeat(pGroup, pRspMember, nowMs, dnodeId, &newGroup);
|
||||
if (updateToken) {
|
||||
(void)taosArrayPush(pUpdateArray, &newGroup);
|
||||
if (taosArrayPush(pUpdateArray, &newGroup) == NULL) {
|
||||
mError("failed to push newGroup to updateArray, but continue at this hearbear");
|
||||
}
|
||||
}
|
||||
|
||||
sdbRelease(pMnode->pSdb, pGroup);
|
||||
|
|
|
@ -826,7 +826,9 @@ void mndCompactPullup(SMnode *pMnode) {
|
|||
SCompactObj *pCompact = NULL;
|
||||
pIter = sdbFetch(pMnode->pSdb, SDB_COMPACT, pIter, (void **)&pCompact);
|
||||
if (pIter == NULL) break;
|
||||
(void)taosArrayPush(pArray, &pCompact->compactId);
|
||||
if (taosArrayPush(pArray, &pCompact->compactId) == NULL) {
|
||||
mError("failed to push compact id:%d into array, but continue pull up", pCompact->compactId);
|
||||
}
|
||||
sdbRelease(pSdb, pCompact);
|
||||
}
|
||||
|
||||
|
|
|
@ -334,9 +334,21 @@ static int32_t addEpSetInfo(SMnode *pMnode, SMqConsumerObj *pConsumer, int32_t e
|
|||
}
|
||||
}
|
||||
SMqSubVgEp vgEp = {.epSet = pVgEp->epSet, .vgId = pVgEp->vgId, .offset = -1};
|
||||
(void)taosArrayPush(topicEp.vgs, &vgEp);
|
||||
if (taosArrayPush(topicEp.vgs, &vgEp) == NULL) {
|
||||
taosArrayDestroy(topicEp.vgs);
|
||||
taosRUnLockLatch(&pConsumer->lock);
|
||||
taosRUnLockLatch(&pSub->lock);
|
||||
mndReleaseSubscribe(pMnode, pSub);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
}
|
||||
if (taosArrayPush(rsp->topics, &topicEp) == NULL) {
|
||||
taosArrayDestroy(topicEp.vgs);
|
||||
taosRUnLockLatch(&pConsumer->lock);
|
||||
taosRUnLockLatch(&pSub->lock);
|
||||
mndReleaseSubscribe(pMnode, pSub);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
(void)taosArrayPush(rsp->topics, &topicEp);
|
||||
taosRUnLockLatch(&pSub->lock);
|
||||
mndReleaseSubscribe(pMnode, pSub);
|
||||
}
|
||||
|
|
|
@ -1710,7 +1710,9 @@ void mndBuildDBVgroupInfo(SDbObj *pDb, SMnode *pMnode, SArray *pVgList) {
|
|||
}
|
||||
}
|
||||
vindex++;
|
||||
(void)taosArrayPush(pVgList, &vgInfo);
|
||||
if (taosArrayPush(pVgList, &vgInfo) == NULL) {
|
||||
mError("db:%s, failed to push vgInfo to array, vgId:%d, but continue next", pDb->name, vgInfo.vgId);
|
||||
}
|
||||
}
|
||||
|
||||
sdbRelease(pSdb, pVgroup);
|
||||
|
@ -1856,7 +1858,10 @@ int32_t mndValidateDbInfo(SMnode *pMnode, SDbCacheInfo *pDbs, int32_t numOfDbs,
|
|||
|
||||
rsp.useDbRsp->vgNum = taosArrayGetSize(rsp.useDbRsp->pVgroupInfos);
|
||||
|
||||
(void)taosArrayPush(batchRsp.pArray, &rsp);
|
||||
if (taosArrayPush(batchRsp.pArray, &rsp) == NULL) {
|
||||
if (terrno != 0) code = terrno;
|
||||
return code;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
@ -1868,7 +1873,10 @@ int32_t mndValidateDbInfo(SMnode *pMnode, SDbCacheInfo *pDbs, int32_t numOfDbs,
|
|||
(void)memcpy(rsp.useDbRsp->db, pDbCacheInfo->dbFName, TSDB_DB_FNAME_LEN);
|
||||
rsp.useDbRsp->uid = pDbCacheInfo->dbId;
|
||||
rsp.useDbRsp->vgVersion = -1;
|
||||
(void)taosArrayPush(batchRsp.pArray, &rsp);
|
||||
if (taosArrayPush(batchRsp.pArray, &rsp) == NULL) {
|
||||
if (terrno != 0) code = terrno;
|
||||
return code;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -1940,7 +1948,11 @@ int32_t mndValidateDbInfo(SMnode *pMnode, SDbCacheInfo *pDbs, int32_t numOfDbs,
|
|||
rsp.useDbRsp->hashSuffix = pDb->cfg.hashSuffix;
|
||||
}
|
||||
|
||||
(void)taosArrayPush(batchRsp.pArray, &rsp);
|
||||
if (taosArrayPush(batchRsp.pArray, &rsp) == NULL) {
|
||||
mndReleaseDb(pMnode, pDb);
|
||||
if (terrno != 0) code = terrno;
|
||||
return code;
|
||||
}
|
||||
mndReleaseDb(pMnode, pDb);
|
||||
}
|
||||
|
||||
|
|
|
@ -430,7 +430,9 @@ static void mndGetDnodeEps(SMnode *pMnode, SArray *pDnodeEps) {
|
|||
if (mndIsMnode(pMnode, pDnode->id)) {
|
||||
dnodeEp.isMnode = 1;
|
||||
}
|
||||
(void)taosArrayPush(pDnodeEps, &dnodeEp);
|
||||
if (taosArrayPush(pDnodeEps, &dnodeEp) == NULL) {
|
||||
mError("failed to put ep into array, but continue at this call");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -991,7 +993,12 @@ static int32_t mndProcessDnodeListReq(SRpcMsg *pReq) {
|
|||
tstrncpy(epSet.eps[0].fqdn, pObj->fqdn, TSDB_FQDN_LEN);
|
||||
epSet.eps[0].port = pObj->port;
|
||||
|
||||
(void)taosArrayPush(rsp.dnodeList, &epSet);
|
||||
if (taosArrayPush(rsp.dnodeList, &epSet) == NULL) {
|
||||
if (terrno != 0) code = terrno;
|
||||
sdbRelease(pSdb, pObj);
|
||||
sdbCancelFetch(pSdb, pIter);
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
sdbRelease(pSdb, pObj);
|
||||
}
|
||||
|
@ -1845,7 +1852,9 @@ SArray *mndGetAllDnodeFqdns(SMnode *pMnode) {
|
|||
if (pIter == NULL) break;
|
||||
|
||||
char *fqdn = taosStrdup(pObj->fqdn);
|
||||
(void)taosArrayPush(fqdns, &fqdn);
|
||||
if (taosArrayPush(fqdns, &fqdn) == NULL) {
|
||||
mError("failed to fqdn into array, but continue at this time");
|
||||
}
|
||||
sdbRelease(pSdb, pObj);
|
||||
}
|
||||
return fqdns;
|
||||
|
|
|
@ -991,7 +991,9 @@ int32_t mndGetMonitorInfo(SMnode *pMnode, SMonClusterInfo *pClusterInfo, SMonVgr
|
|||
} else {
|
||||
tstrncpy(desc.status, "offline", sizeof(desc.status));
|
||||
}
|
||||
(void)taosArrayPush(pClusterInfo->dnodes, &desc);
|
||||
if (taosArrayPush(pClusterInfo->dnodes, &desc) == NULL) {
|
||||
mError("failed put dnode into array, but continue at this monitor report")
|
||||
}
|
||||
sdbRelease(pSdb, pObj);
|
||||
}
|
||||
|
||||
|
@ -1017,7 +1019,9 @@ int32_t mndGetMonitorInfo(SMnode *pMnode, SMonClusterInfo *pClusterInfo, SMonVgr
|
|||
tstrncpy(desc.role, syncStr(pObj->syncState), sizeof(desc.role));
|
||||
desc.syncState = pObj->syncState;
|
||||
}
|
||||
(void)taosArrayPush(pClusterInfo->mnodes, &desc);
|
||||
if (taosArrayPush(pClusterInfo->mnodes, &desc) == NULL) {
|
||||
mError("failed to put mnode into array, but continue at this monitor report");
|
||||
}
|
||||
sdbRelease(pSdb, pObj);
|
||||
}
|
||||
|
||||
|
@ -1057,7 +1061,9 @@ int32_t mndGetMonitorInfo(SMnode *pMnode, SMonClusterInfo *pClusterInfo, SMonVgr
|
|||
pClusterInfo->vnodes_total++;
|
||||
}
|
||||
|
||||
(void)taosArrayPush(pVgroupInfo->vgroups, &desc);
|
||||
if (taosArrayPush(pVgroupInfo->vgroups, &desc) == NULL) {
|
||||
mError("failed to put vgroup into array, but continue at this monitor report")
|
||||
}
|
||||
sdbRelease(pSdb, pVgroup);
|
||||
}
|
||||
|
||||
|
@ -1078,7 +1084,9 @@ int32_t mndGetMonitorInfo(SMnode *pMnode, SMonClusterInfo *pClusterInfo, SMonVgr
|
|||
(void)tNameFromString(&name2, pStb->name, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE);
|
||||
tstrncpy(desc.stb_name, tNameGetTableName(&name2), TSDB_TABLE_NAME_LEN);
|
||||
|
||||
(void)taosArrayPush(pStbInfo->stbs, &desc);
|
||||
if (taosArrayPush(pStbInfo->stbs, &desc) == NULL) {
|
||||
mError("failed to put stb into array, but continue at this monitor report");
|
||||
}
|
||||
sdbRelease(pSdb, pStb);
|
||||
}
|
||||
|
||||
|
|
|
@ -546,8 +546,9 @@ static int32_t mndProcessQueryHeartBeat(SMnode *pMnode, SRpcMsg *pMsg, SClientHb
|
|||
|
||||
int32_t kvNum = taosHashGetSize(pHbReq->info);
|
||||
if (NULL == pHbReq->info || kvNum <= 0) {
|
||||
// TODO return value
|
||||
(void)taosArrayPush(pBatchRsp->rsps, &hbRsp);
|
||||
if (taosArrayPush(pBatchRsp->rsps, &hbRsp) == NULL) {
|
||||
mError("failed to put rsp into array, but continue at this heartbeat");
|
||||
}
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -597,7 +598,9 @@ static int32_t mndProcessQueryHeartBeat(SMnode *pMnode, SRpcMsg *pMsg, SClientHb
|
|||
pObj->ipWhiteListVer);
|
||||
if (rspMsg && rspLen > 0) {
|
||||
SKv kv1 = {.key = HEARTBEAT_KEY_USER_AUTHINFO, .valueLen = rspLen, .value = rspMsg};
|
||||
(void)taosArrayPush(hbRsp.info, &kv1);
|
||||
if (taosArrayPush(hbRsp.info, &kv1) == NULL) {
|
||||
mError("failed to put kv into array, but continue at this heartbeat");
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -607,7 +610,9 @@ static int32_t mndProcessQueryHeartBeat(SMnode *pMnode, SRpcMsg *pMsg, SClientHb
|
|||
(void)mndValidateDbInfo(pMnode, kv->value, kv->valueLen / sizeof(SDbCacheInfo), &rspMsg, &rspLen);
|
||||
if (rspMsg && rspLen > 0) {
|
||||
SKv kv1 = {.key = HEARTBEAT_KEY_DBINFO, .valueLen = rspLen, .value = rspMsg};
|
||||
(void)taosArrayPush(hbRsp.info, &kv1);
|
||||
if (taosArrayPush(hbRsp.info, &kv1) == NULL) {
|
||||
mError("failed to put kv into array, but continue at this heartbeat");
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -617,7 +622,9 @@ static int32_t mndProcessQueryHeartBeat(SMnode *pMnode, SRpcMsg *pMsg, SClientHb
|
|||
(void)mndValidateStbInfo(pMnode, kv->value, kv->valueLen / sizeof(SSTableVersion), &rspMsg, &rspLen);
|
||||
if (rspMsg && rspLen > 0) {
|
||||
SKv kv1 = {.key = HEARTBEAT_KEY_STBINFO, .valueLen = rspLen, .value = rspMsg};
|
||||
(void)taosArrayPush(hbRsp.info, &kv1);
|
||||
if (taosArrayPush(hbRsp.info, &kv1) == NULL) {
|
||||
mError("failed to put kv into array, but continue at this heartbeat");
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -635,7 +642,9 @@ static int32_t mndProcessQueryHeartBeat(SMnode *pMnode, SRpcMsg *pMsg, SClientHb
|
|||
(void)mndValidateViewInfo(pMnode, kv->value, kv->valueLen / sizeof(SViewVersion), &rspMsg, &rspLen);
|
||||
if (rspMsg && rspLen > 0) {
|
||||
SKv kv1 = {.key = HEARTBEAT_KEY_VIEWINFO, .valueLen = rspLen, .value = rspMsg};
|
||||
(void)taosArrayPush(hbRsp.info, &kv1);
|
||||
if (taosArrayPush(hbRsp.info, &kv1) == NULL) {
|
||||
mError("failed to put kv into array, but continue at this heartbeat");
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -646,7 +655,9 @@ static int32_t mndProcessQueryHeartBeat(SMnode *pMnode, SRpcMsg *pMsg, SClientHb
|
|||
(void)mndValidateTSMAInfo(pMnode, kv->value, kv->valueLen / sizeof(STSMAVersion), &rspMsg, &rspLen);
|
||||
if (rspMsg && rspLen > 0) {
|
||||
SKv kv = {.key = HEARTBEAT_KEY_TSMA, .valueLen = rspLen, .value = rspMsg};
|
||||
(void)taosArrayPush(hbRsp.info, &kv);
|
||||
if (taosArrayPush(hbRsp.info, &kv) == NULL) {
|
||||
mError("failed to put kv into array, but continue at this heartbeat");
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -706,7 +717,9 @@ static int32_t mndProcessHeartBeatReq(SRpcMsg *pReq) {
|
|||
} else if (pHbReq->connKey.connType == CONN_TYPE__TMQ) {
|
||||
SClientHbRsp *pRsp = mndMqHbBuildRsp(pMnode, pHbReq);
|
||||
if (pRsp != NULL) {
|
||||
(void)taosArrayPush(batchRsp.rsps, pRsp);
|
||||
if (taosArrayPush(batchRsp.rsps, pRsp) == NULL) {
|
||||
mError("failed to put kv into array, but continue at this heartbeat");
|
||||
}
|
||||
taosMemoryFree(pRsp);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -498,7 +498,12 @@ int32_t mndCreateQnodeList(SMnode *pMnode, SArray **pList, int32_t limit) {
|
|||
nodeLoad.addr.epSet.eps[0].port = pObj->pDnode->port;
|
||||
nodeLoad.load = QNODE_LOAD_VALUE(pObj);
|
||||
|
||||
(void)taosArrayPush(qnodeList, &nodeLoad);
|
||||
if (taosArrayPush(qnodeList, &nodeLoad) == NULL) {
|
||||
sdbRelease(pSdb, pObj);
|
||||
sdbCancelFetch(pSdb, pIter);
|
||||
if (terrno != 0) code = terrno;
|
||||
return code;
|
||||
}
|
||||
|
||||
numOfRows++;
|
||||
sdbRelease(pSdb, pObj);
|
||||
|
|
|
@ -634,7 +634,10 @@ static void bindSourceSink(SStreamObj* pStream, SMnode* pMnode, SArray* tasks, b
|
|||
static void bindTwoLevel(SArray* tasks, int32_t begin, int32_t end) {
|
||||
int32_t code = 0;
|
||||
size_t size = taosArrayGetSize(tasks);
|
||||
ASSERT(size >= 2);
|
||||
if (size < 2) {
|
||||
mError("task list size is less than 2");
|
||||
return;
|
||||
}
|
||||
SArray* pDownTaskList = taosArrayGetP(tasks, size - 1);
|
||||
SArray* pUpTaskList = taosArrayGetP(tasks, size - 2);
|
||||
|
||||
|
|
|
@ -1521,7 +1521,7 @@ static void mndCancelRetrieveIdx(SMnode *pMnode, void *pIter) {
|
|||
if (p != NULL) {
|
||||
SSdb *pSdb = pMnode->pSdb;
|
||||
sdbCancelFetch(pSdb, p->pSmaIter);
|
||||
sdbCancelFetch(pSdb, p->pIdxIter);
|
||||
sdbCancelFetchByType(pSdb, p->pIdxIter, SDB_IDX);
|
||||
}
|
||||
taosMemoryFree(p);
|
||||
}
|
||||
|
|
|
@ -278,7 +278,7 @@ static SSdbRow *mndStbActionDecode(SSdbRaw *pRaw) {
|
|||
for (int32_t i = 0; i < pStb->numOfFuncs; ++i) {
|
||||
char funcName[TSDB_FUNC_NAME_LEN] = {0};
|
||||
SDB_GET_BINARY(pRaw, dataPos, funcName, TSDB_FUNC_NAME_LEN, _OVER)
|
||||
(void)taosArrayPush(pStb->pFuncs, funcName);
|
||||
if (taosArrayPush(pStb->pFuncs, funcName) == NULL) goto _OVER;
|
||||
}
|
||||
|
||||
if (pStb->commentLen > 0) {
|
||||
|
@ -3069,7 +3069,10 @@ int32_t mndValidateStbInfo(SMnode *pMnode, SSTableVersion *pStbVersions, int32_t
|
|||
tstrncpy(metaRsp.dbFName, pStbVersion->dbFName, sizeof(metaRsp.dbFName));
|
||||
tstrncpy(metaRsp.tbName, pStbVersion->stbName, sizeof(metaRsp.tbName));
|
||||
tstrncpy(metaRsp.stbName, pStbVersion->stbName, sizeof(metaRsp.stbName));
|
||||
(void)taosArrayPush(hbRsp.pMetaRsp, &metaRsp);
|
||||
if (taosArrayPush(hbRsp.pMetaRsp, &metaRsp) == NULL) {
|
||||
code = terrno;
|
||||
return code;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -3082,11 +3085,17 @@ int32_t mndValidateStbInfo(SMnode *pMnode, SSTableVersion *pStbVersions, int32_t
|
|||
tstrncpy(metaRsp.dbFName, pStbVersion->dbFName, sizeof(metaRsp.dbFName));
|
||||
tstrncpy(metaRsp.tbName, pStbVersion->stbName, sizeof(metaRsp.tbName));
|
||||
tstrncpy(metaRsp.stbName, pStbVersion->stbName, sizeof(metaRsp.stbName));
|
||||
(void)taosArrayPush(hbRsp.pMetaRsp, &metaRsp);
|
||||
if (taosArrayPush(hbRsp.pMetaRsp, &metaRsp) == NULL) {
|
||||
code = terrno;
|
||||
return code;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
(void)taosArrayPush(hbRsp.pMetaRsp, &metaRsp);
|
||||
if (taosArrayPush(hbRsp.pMetaRsp, &metaRsp) == NULL) {
|
||||
code = terrno;
|
||||
return code;
|
||||
}
|
||||
}
|
||||
|
||||
if (sma) {
|
||||
|
@ -3110,7 +3119,10 @@ int32_t mndValidateStbInfo(SMnode *pMnode, SSTableVersion *pStbVersions, int32_t
|
|||
strcpy(indexRsp.dbFName, pStbVersion->dbFName);
|
||||
strcpy(indexRsp.tbName, pStbVersion->stbName);
|
||||
|
||||
(void)taosArrayPush(hbRsp.pIndexRsp, &indexRsp);
|
||||
if (taosArrayPush(hbRsp.pIndexRsp, &indexRsp) == NULL) {
|
||||
code = terrno;
|
||||
return code;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4313,7 +4325,12 @@ static int32_t mndDropTbAddTsmaResTbsForSingleVg(SMnode *pMnode, SMndDropTbsWith
|
|||
} else {
|
||||
info.dbInfo = *pDbInfo;
|
||||
}
|
||||
(void)taosArrayPush(pInfos->pTsmaInfos, &info);
|
||||
if (taosArrayPush(pInfos->pTsmaInfos, &info) == NULL) {
|
||||
code = terrno;
|
||||
sdbCancelFetch(pMnode->pSdb, pIter);
|
||||
sdbRelease(pMnode->pSdb, pSma);
|
||||
goto _end;
|
||||
}
|
||||
}
|
||||
sdbRelease(pMnode->pSdb, pSma);
|
||||
}
|
||||
|
@ -4333,7 +4350,10 @@ static int32_t mndDropTbAddTsmaResTbsForSingleVg(SMnode *pMnode, SMndDropTbsWith
|
|||
taosGetTbHashVal(buf, len, pInfo->dbInfo.hashMethod, pInfo->dbInfo.hashPrefix, pInfo->dbInfo.hashSuffix);
|
||||
const SVgroupInfo *pVgInfo = taosArraySearch(pInfo->dbInfo.dbVgInfos, &hashVal, vgHashValCmp, TD_EQ);
|
||||
void *p = taosStrdup(buf + strlen(pInfo->tsmaResTbDbFName) + TSDB_NAME_DELIMITER_LEN);
|
||||
(void)taosArrayPush(pCtx->pResTbNames, &p);
|
||||
if (taosArrayPush(pCtx->pResTbNames, &p) == NULL) {
|
||||
code = terrno;
|
||||
goto _end;
|
||||
}
|
||||
TAOS_CHECK_GOTO(mndDropTbAdd(pMnode, pCtx->pVgMap, pVgInfo, p, pInfo->suid, true), NULL, _end);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -775,7 +775,7 @@ static int32_t mndProcessCreateStreamReq(SRpcMsg *pReq) {
|
|||
}
|
||||
|
||||
#ifdef WINDOWS
|
||||
terrno = TSDB_CODE_MND_INVALID_PLATFORM;
|
||||
code = TSDB_CODE_MND_INVALID_PLATFORM;
|
||||
goto _OVER;
|
||||
#endif
|
||||
|
||||
|
@ -1208,7 +1208,11 @@ static int32_t mndCheckTaskAndNodeStatus(SMnode *pMnode) {
|
|||
streamMutexLock(&execInfo.lock);
|
||||
if (taosArrayGetSize(execInfo.pNodeList) == 0) {
|
||||
mDebug("stream task node change checking done, no vgroups exist, do nothing");
|
||||
ASSERT(taosArrayGetSize(execInfo.pTaskList) == 0);
|
||||
if (taosArrayGetSize(execInfo.pTaskList) != 0) {
|
||||
streamMutexUnlock(&execInfo.lock);
|
||||
mError("stream task node change checking done, no vgroups exist, but task list is not empty");
|
||||
return TSDB_CODE_FAILED;
|
||||
}
|
||||
}
|
||||
|
||||
SArray *pInvalidList = taosArrayInit(4, sizeof(STaskId));
|
||||
|
@ -2163,7 +2167,9 @@ static int32_t refreshNodeListFromExistedStreams(SMnode *pMnode, SArray *pNodeLi
|
|||
|
||||
SNodeEntry entry = {.hbTimestamp = -1, .nodeId = pTask->info.nodeId, .lastHbMsgId = -1};
|
||||
epsetAssign(&entry.epset, &pTask->info.epSet);
|
||||
(void)taosHashPut(pHash, &entry.nodeId, sizeof(entry.nodeId), &entry, sizeof(entry));
|
||||
if (taosHashPut(pHash, &entry.nodeId, sizeof(entry.nodeId), &entry, sizeof(entry)) != 0) {
|
||||
mError("failed to put entry into hash map, nodeId:%d", entry.nodeId);
|
||||
}
|
||||
}
|
||||
|
||||
destroyStreamTaskIter(pTaskIter);
|
||||
|
@ -2788,7 +2794,13 @@ int32_t mndProcessConsensusInTmr(SRpcMsg *pMsg) {
|
|||
if (((now - pe->ts) >= 10 * 1000) || allSame) {
|
||||
mDebug("s-task:0x%x sendTs:%" PRId64 " wait %.2fs and all tasks have same checkpointId", pe->req.taskId,
|
||||
pe->req.startTs, (now - pe->ts) / 1000.0);
|
||||
ASSERT(chkId <= pe->req.checkpointId);
|
||||
if (chkId > pe->req.checkpointId) {
|
||||
streamMutexUnlock(&execInfo.lock);
|
||||
taosArrayDestroy(pStreamList);
|
||||
mError("s-task:0x%x checkpointId:%" PRId64 " is updated to %" PRId64 ", update it", pe->req.taskId,
|
||||
pe->req.checkpointId, chkId);
|
||||
return TSDB_CODE_FAILED;
|
||||
}
|
||||
code = mndCreateSetConsensusChkptIdTrans(pMnode, pStream, pe->req.taskId, chkId, pe->req.startTs);
|
||||
if (code != TSDB_CODE_SUCCESS && code != TSDB_CODE_ACTION_IN_PROGRESS) {
|
||||
mError("failed to create consensus-checkpoint trans, stream:0x%" PRIx64, pStream->uid);
|
||||
|
@ -2828,7 +2840,12 @@ int32_t mndProcessConsensusInTmr(SRpcMsg *pMsg) {
|
|||
|
||||
if (taosArrayGetSize(pInfo->pTaskList) == 0) {
|
||||
mndClearConsensusRspEntry(pInfo);
|
||||
ASSERT(streamId != -1);
|
||||
if (streamId == -1) {
|
||||
streamMutexUnlock(&execInfo.lock);
|
||||
taosArrayDestroy(pStreamList);
|
||||
mError("streamId is -1, streamId:%" PRIx64, pInfo->streamId);
|
||||
return TSDB_CODE_FAILED;
|
||||
}
|
||||
void* p = taosArrayPush(pStreamList, &streamId);
|
||||
if (p == NULL) {
|
||||
mError("failed to put into stream list, stream:0x%" PRIx64, streamId);
|
||||
|
|
|
@ -13,12 +13,13 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "mndDb.h"
|
||||
#include "mndStb.h"
|
||||
#include "mndStream.h"
|
||||
#include "mndTrans.h"
|
||||
#include "tmisce.h"
|
||||
#include "mndVgroup.h"
|
||||
#include "mndStb.h"
|
||||
#include "mndDb.h"
|
||||
#include "taoserror.h"
|
||||
#include "tmisce.h"
|
||||
|
||||
struct SStreamTaskIter {
|
||||
SStreamObj *pStream;
|
||||
|
@ -905,7 +906,12 @@ void removeStreamTasksInBuf(SStreamObj *pStream, SStreamExecInfo *pExecNode) {
|
|||
}
|
||||
}
|
||||
|
||||
ASSERT(taosHashGetSize(pExecNode->pTaskMap) == taosArrayGetSize(pExecNode->pTaskList));
|
||||
if (taosHashGetSize(pExecNode->pTaskMap) != taosArrayGetSize(pExecNode->pTaskList)) {
|
||||
streamMutexUnlock(&pExecNode->lock);
|
||||
destroyStreamTaskIter(pIter);
|
||||
mError("task map size, task list size, not equal");
|
||||
return;
|
||||
}
|
||||
|
||||
// 2. remove stream entry in consensus hash table and checkpoint-report hash table
|
||||
(void) mndClearConsensusCheckpointId(execInfo.pStreamConsensus, pStream->uid);
|
||||
|
|
|
@ -312,7 +312,12 @@ void mndRestoreFinish(const SSyncFSM *pFsm, const SyncIndex commitIdx) {
|
|||
}
|
||||
(void)mndRefreshUserIpWhiteList(pMnode);
|
||||
|
||||
ASSERT(commitIdx == mndSyncAppliedIndex(pFsm));
|
||||
SyncIndex fsmIndex = mndSyncAppliedIndex(pFsm);
|
||||
if (commitIdx != fsmIndex) {
|
||||
mError("vgId:1, sync restore finished, but commitIdx:%" PRId64 " is not equal to appliedIdx:%" PRId64, commitIdx,
|
||||
fsmIndex);
|
||||
mndSetRestored(pMnode, false);
|
||||
}
|
||||
}
|
||||
|
||||
int32_t mndSnapshotStartRead(const SSyncFSM *pFsm, void *pParam, void **ppReader) {
|
||||
|
|
|
@ -270,7 +270,9 @@ SSdbRow *mndTopicActionDecode(SSdbRaw *pRaw) {
|
|||
}
|
||||
int16_t colId;
|
||||
SDB_GET_INT16(pRaw, dataPos, &colId, TOPIC_DECODE_OVER);
|
||||
(void)taosArrayPush(pTopic->ntbColIds, &colId);
|
||||
if (taosArrayPush(pTopic->ntbColIds, &colId) == NULL) {
|
||||
goto TOPIC_DECODE_OVER;
|
||||
}
|
||||
}
|
||||
|
||||
SDB_GET_INT64(pRaw, dataPos, &pTopic->ctbStbUid, TOPIC_DECODE_OVER);
|
||||
|
|
|
@ -768,7 +768,9 @@ void mndTransSetDbName(STrans *pTrans, const char *dbname, const char *stbname)
|
|||
}
|
||||
|
||||
void mndTransAddArbGroupId(STrans *pTrans, int32_t groupId) {
|
||||
(void)taosHashPut(pTrans->arbGroupIds, &groupId, sizeof(int32_t), NULL, 0);
|
||||
if (taosHashPut(pTrans->arbGroupIds, &groupId, sizeof(int32_t), NULL, 0) != 0) {
|
||||
mError("trans:%d, failed to put groupid into hash, groupId:%d", pTrans->id, groupId);
|
||||
}
|
||||
}
|
||||
|
||||
void mndTransSetSerial(STrans *pTrans) { pTrans->exec = TRN_EXEC_SERIAL; }
|
||||
|
@ -1905,7 +1907,9 @@ void mndTransPullup(SMnode *pMnode) {
|
|||
STrans *pTrans = NULL;
|
||||
pIter = sdbFetch(pMnode->pSdb, SDB_TRANS, pIter, (void **)&pTrans);
|
||||
if (pIter == NULL) break;
|
||||
(void)taosArrayPush(pArray, &pTrans->id);
|
||||
if (taosArrayPush(pArray, &pTrans->id) == NULL) {
|
||||
mError("failed to put trans into array, trans:%d, but pull up will continute", pTrans->id);
|
||||
}
|
||||
sdbRelease(pSdb, pTrans);
|
||||
}
|
||||
|
||||
|
|
|
@ -334,10 +334,19 @@ void *sdbFetchAll(SSdb *pSdb, ESdbType type, void *pIter, void **ppObj, ESdbStat
|
|||
* @brief Cancel a traversal
|
||||
*
|
||||
* @param pSdb The sdb object.
|
||||
* @param type The initial iterator of table.
|
||||
* @param pIter The initial iterator of table.
|
||||
*/
|
||||
void sdbCancelFetch(SSdb *pSdb, void *pIter);
|
||||
|
||||
/**
|
||||
* @brief Cancel a traversal
|
||||
*
|
||||
* @param pSdb The sdb object.
|
||||
* @param pIter The initial iterator of table.
|
||||
* @param type The type of table.
|
||||
*/
|
||||
void sdbCancelFetchByType(SSdb *pSdb, void *pIter, ESdbType type);
|
||||
|
||||
/**
|
||||
* @brief Traverse a sdb
|
||||
*
|
||||
|
|
|
@ -103,14 +103,14 @@ void sdbPrintOper(SSdb *pSdb, SSdbRow *pRow, const char *oper) {
|
|||
EKeyType keyType = pSdb->keyTypes[pRow->type];
|
||||
|
||||
if (keyType == SDB_KEY_BINARY) {
|
||||
mTrace("%s:%s, ref:%d oper:%s row:%p status:%s", sdbTableName(pRow->type), (char *)pRow->pObj, pRow->refCount, oper,
|
||||
pRow->pObj, sdbStatusName(pRow->status));
|
||||
mTrace("%s:%s, ref:%d oper:%s row:%p row->pObj:%p status:%s", sdbTableName(pRow->type), (char *)pRow->pObj,
|
||||
pRow->refCount, oper, pRow, pRow->pObj, sdbStatusName(pRow->status));
|
||||
} else if (keyType == SDB_KEY_INT32) {
|
||||
mTrace("%s:%d, ref:%d oper:%s row:%p status:%s", sdbTableName(pRow->type), *(int32_t *)pRow->pObj, pRow->refCount,
|
||||
oper, pRow->pObj, sdbStatusName(pRow->status));
|
||||
mTrace("%s:%d, ref:%d oper:%s row:%p row->pObj:%p status:%s", sdbTableName(pRow->type), *(int32_t *)pRow->pObj,
|
||||
pRow->refCount, oper, pRow, pRow->pObj, sdbStatusName(pRow->status));
|
||||
} else if (keyType == SDB_KEY_INT64) {
|
||||
mTrace("%s:%" PRId64 ", ref:%d oper:%s row:%p status:%s", sdbTableName(pRow->type), *(int64_t *)pRow->pObj,
|
||||
pRow->refCount, oper, pRow->pObj, sdbStatusName(pRow->status));
|
||||
mTrace("%s:%" PRId64 ", ref:%d oper:%s row:%p row->pObj:%p status:%s", sdbTableName(pRow->type),
|
||||
*(int64_t *)pRow->pObj, pRow->refCount, oper, pRow, pRow->pObj, sdbStatusName(pRow->status));
|
||||
} else {
|
||||
}
|
||||
#endif
|
||||
|
@ -439,6 +439,7 @@ void *sdbFetchAll(SSdb *pSdb, ESdbType type, void *pIter, void **ppObj, ESdbStat
|
|||
void sdbCancelFetch(SSdb *pSdb, void *pIter) {
|
||||
if (pIter == NULL) return;
|
||||
SSdbRow *pRow = *(SSdbRow **)pIter;
|
||||
mTrace("cancel fetch row:%p", pRow);
|
||||
SHashObj *hash = sdbGetHash(pSdb, pRow->type);
|
||||
if (hash == NULL) return;
|
||||
|
||||
|
@ -448,6 +449,17 @@ void sdbCancelFetch(SSdb *pSdb, void *pIter) {
|
|||
sdbUnLock(pSdb, type);
|
||||
}
|
||||
|
||||
void sdbCancelFetchByType(SSdb *pSdb, void *pIter, ESdbType type) {
|
||||
if (pIter == NULL) return;
|
||||
if (type >= SDB_MAX || type < 0) return;
|
||||
SHashObj *hash = sdbGetHash(pSdb, type);
|
||||
if (hash == NULL) return;
|
||||
|
||||
sdbReadLock(pSdb, type);
|
||||
taosHashCancelIterate(hash, pIter);
|
||||
sdbUnLock(pSdb, type);
|
||||
}
|
||||
|
||||
void sdbTraverse(SSdb *pSdb, ESdbType type, sdbTraverseFp fp, void *p1, void *p2, void *p3) {
|
||||
SHashObj *hash = sdbGetHash(pSdb, type);
|
||||
if (hash == NULL) return;
|
||||
|
|
|
@ -32,12 +32,12 @@ extern "C" {
|
|||
#define vDebug(...) do { if (vDebugFlag & DEBUG_DEBUG) { taosPrintLog("VND ", DEBUG_DEBUG, vDebugFlag, __VA_ARGS__); }} while(0)
|
||||
#define vTrace(...) do { if (vDebugFlag & DEBUG_TRACE) { taosPrintLog("VND ", DEBUG_TRACE, vDebugFlag, __VA_ARGS__); }} while(0)
|
||||
|
||||
#define vGTrace(param, ...) do { if (vDebugFlag & DEBUG_TRACE) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); vTrace(param ", qid:%s", __VA_ARGS__, buf);}} while(0)
|
||||
#define vGFatal(param, ...) do { if (vDebugFlag & DEBUG_FATAL) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); vFatal(param ", qid:%s", __VA_ARGS__, buf);}} while(0)
|
||||
#define vGError(param, ...) do { if (vDebugFlag & DEBUG_ERROR) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); vError(param ", qid:%s", __VA_ARGS__, buf);}} while(0)
|
||||
#define vGWarn(param, ...) do { if (vDebugFlag & DEBUG_WARN) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); vWarn(param ", qid:%s", __VA_ARGS__, buf);}} while(0)
|
||||
#define vGInfo(param, ...) do { if (vDebugFlag & DEBUG_INFO) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); vInfo(param ", qid:%s", __VA_ARGS__, buf);}} while(0)
|
||||
#define vGDebug(param, ...) do { if (vDebugFlag & DEBUG_DEBUG) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); vDebug(param ", qid:%s", __VA_ARGS__, buf);}} while(0)
|
||||
#define vGTrace(param, ...) do { if (vDebugFlag & DEBUG_TRACE) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); vTrace(param ",QID:%s", __VA_ARGS__, buf);}} while(0)
|
||||
#define vGFatal(param, ...) do { if (vDebugFlag & DEBUG_FATAL) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); vFatal(param ",QID:%s", __VA_ARGS__, buf);}} while(0)
|
||||
#define vGError(param, ...) do { if (vDebugFlag & DEBUG_ERROR) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); vError(param ",QID:%s", __VA_ARGS__, buf);}} while(0)
|
||||
#define vGWarn(param, ...) do { if (vDebugFlag & DEBUG_WARN) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); vWarn(param ",QID:%s", __VA_ARGS__, buf);}} while(0)
|
||||
#define vGInfo(param, ...) do { if (vDebugFlag & DEBUG_INFO) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); vInfo(param ",QID:%s", __VA_ARGS__, buf);}} while(0)
|
||||
#define vGDebug(param, ...) do { if (vDebugFlag & DEBUG_DEBUG) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); vDebug(param ",QID:%s", __VA_ARGS__, buf);}} while(0)
|
||||
|
||||
// clang-format on
|
||||
|
||||
|
|
|
@ -122,7 +122,7 @@ int32_t metaCacheOpen(SMeta* pMeta) {
|
|||
|
||||
pMeta->pCache = (SMetaCache*)taosMemoryCalloc(1, sizeof(SMetaCache));
|
||||
if (pMeta->pCache == NULL) {
|
||||
TSDB_CHECK_CODE(code = TSDB_CODE_OUT_OF_MEMORY, lino, _exit);
|
||||
TSDB_CHECK_CODE(code = terrno, lino, _exit);
|
||||
}
|
||||
|
||||
// open entry cache
|
||||
|
@ -131,7 +131,7 @@ int32_t metaCacheOpen(SMeta* pMeta) {
|
|||
pMeta->pCache->sEntryCache.aBucket =
|
||||
(SMetaCacheEntry**)taosMemoryCalloc(pMeta->pCache->sEntryCache.nBucket, sizeof(SMetaCacheEntry*));
|
||||
if (pMeta->pCache->sEntryCache.aBucket == NULL) {
|
||||
TSDB_CHECK_CODE(code = TSDB_CODE_OUT_OF_MEMORY, lino, _exit);
|
||||
TSDB_CHECK_CODE(code = terrno, lino, _exit);
|
||||
}
|
||||
|
||||
// open stats cache
|
||||
|
@ -140,7 +140,7 @@ int32_t metaCacheOpen(SMeta* pMeta) {
|
|||
pMeta->pCache->sStbStatsCache.aBucket =
|
||||
(SMetaStbStatsEntry**)taosMemoryCalloc(pMeta->pCache->sStbStatsCache.nBucket, sizeof(SMetaStbStatsEntry*));
|
||||
if (pMeta->pCache->sStbStatsCache.aBucket == NULL) {
|
||||
TSDB_CHECK_CODE(code = TSDB_CODE_OUT_OF_MEMORY, lino, _exit);
|
||||
TSDB_CHECK_CODE(code = terrno, lino, _exit);
|
||||
}
|
||||
|
||||
pMeta->pCache->sTagFilterResCache.pUidResCache = taosLRUCacheInit(5 * 1024 * 1024, -1, 0.5);
|
||||
|
@ -228,7 +228,7 @@ static int32_t metaRehashCache(SMetaCache* pCache, int8_t expand) {
|
|||
|
||||
SMetaCacheEntry** aBucket = (SMetaCacheEntry**)taosMemoryCalloc(nBucket, sizeof(SMetaCacheEntry*));
|
||||
if (aBucket == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _exit;
|
||||
}
|
||||
|
||||
|
@ -361,7 +361,7 @@ static int32_t metaRehashStatsCache(SMetaCache* pCache, int8_t expand) {
|
|||
|
||||
SMetaStbStatsEntry** aBucket = (SMetaStbStatsEntry**)taosMemoryCalloc(nBucket, sizeof(SMetaStbStatsEntry*));
|
||||
if (aBucket == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _exit;
|
||||
}
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ int32_t metaOpen(SVnode *pVnode, SMeta **ppMeta, int8_t rollback) {
|
|||
snprintf(path + offset, TSDB_FILENAME_LEN - offset - 1, "%s%s", TD_DIRSEP, VNODE_META_DIR);
|
||||
|
||||
if ((pMeta = taosMemoryCalloc(1, sizeof(*pMeta) + strlen(path) + 1)) == NULL) {
|
||||
TSDB_CHECK_CODE(code = TSDB_CODE_OUT_OF_MEMORY, lino, _exit);
|
||||
TSDB_CHECK_CODE(code = terrno, lino, _exit);
|
||||
}
|
||||
|
||||
(void)metaInitLock(pMeta);
|
||||
|
|
|
@ -1255,7 +1255,7 @@ int32_t metaFilterTableIds(void *pVnode, SMetaFltParam *arg, SArray *pUids) {
|
|||
SIdxCursor *pCursor = NULL;
|
||||
pCursor = (SIdxCursor *)taosMemoryCalloc(1, sizeof(SIdxCursor));
|
||||
if (!pCursor) {
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
return terrno;
|
||||
}
|
||||
pCursor->pMeta = pMeta;
|
||||
pCursor->suid = param->suid;
|
||||
|
|
|
@ -137,7 +137,7 @@ int32_t metaSnapWriterOpen(SMeta* pMeta, int64_t sver, int64_t ever, SMetaSnapWr
|
|||
// alloc
|
||||
pWriter = (SMetaSnapWriter*)taosMemoryCalloc(1, sizeof(*pWriter));
|
||||
if (pWriter == NULL) {
|
||||
TSDB_CHECK_CODE(code = TSDB_CODE_OUT_OF_MEMORY, lino, _exit);
|
||||
TSDB_CHECK_CODE(code = terrno, lino, _exit);
|
||||
}
|
||||
pWriter->pMeta = pMeta;
|
||||
pWriter->sver = sver;
|
||||
|
@ -304,7 +304,7 @@ int32_t buildSnapContext(SVnode* pVnode, int64_t snapVersion, int64_t suid, int8
|
|||
SSnapContext** ctxRet) {
|
||||
SSnapContext* ctx = taosMemoryCalloc(1, sizeof(SSnapContext));
|
||||
if (ctx == NULL) {
|
||||
return TAOS_GET_TERRNO(TSDB_CODE_OUT_OF_MEMORY);
|
||||
return terrno;
|
||||
}
|
||||
*ctxRet = ctx;
|
||||
ctx->pMeta = pVnode->pMeta;
|
||||
|
|
|
@ -117,10 +117,10 @@ static int32_t tdNewSmaEnv(SSma *pSma, int8_t smaType, SSmaEnv **ppEnv) {
|
|||
SSmaEnv *pEnv = NULL;
|
||||
|
||||
pEnv = (SSmaEnv *)taosMemoryCalloc(1, sizeof(SSmaEnv));
|
||||
*ppEnv = pEnv;
|
||||
if (!pEnv) {
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
return terrno;
|
||||
}
|
||||
*ppEnv = pEnv;
|
||||
|
||||
SMA_ENV_TYPE(pEnv) = smaType;
|
||||
|
||||
|
@ -199,7 +199,7 @@ static int32_t tdInitSmaStat(SSmaStat **pSmaStat, int8_t smaType, const SSma *pS
|
|||
if (!(*pSmaStat)) {
|
||||
*pSmaStat = (SSmaStat *)taosMemoryCalloc(1, sizeof(SSmaStat) + sizeof(TdThread) * tsNumOfVnodeRsmaThreads);
|
||||
if (!(*pSmaStat)) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
TAOS_CHECK_GOTO(code, &lino, _exit);
|
||||
}
|
||||
|
||||
|
|
|
@ -139,7 +139,7 @@ int32_t smaOpen(SVnode *pVnode, int8_t rollback, bool force) {
|
|||
|
||||
SSma *pSma = taosMemoryCalloc(1, sizeof(SSma));
|
||||
if (!pSma) {
|
||||
TAOS_CHECK_EXIT(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_CHECK_EXIT(terrno);
|
||||
}
|
||||
|
||||
pVnode->pSma = pSma;
|
||||
|
|
|
@ -123,7 +123,7 @@ void *tdFreeRSmaInfo(SSma *pSma, SRSmaInfo *pInfo) {
|
|||
static FORCE_INLINE int32_t tdUidStoreInit(STbUidStore **pStore) {
|
||||
*pStore = taosMemoryCalloc(1, sizeof(STbUidStore));
|
||||
if (*pStore == NULL) {
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
return terrno;
|
||||
}
|
||||
|
||||
return TSDB_CODE_SUCCESS;
|
||||
|
@ -285,7 +285,7 @@ static int32_t tdSetRSmaInfoItemParams(SSma *pSma, SRSmaParam *param, SRSmaStat
|
|||
|
||||
SStreamTask *pStreamTask = taosMemoryCalloc(1, sizeof(*pStreamTask));
|
||||
if (!pStreamTask) {
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
return terrno;
|
||||
}
|
||||
pItem->pStreamTask = pStreamTask;
|
||||
pStreamTask->id.taskId = 0;
|
||||
|
@ -389,7 +389,7 @@ int32_t tdRSmaProcessCreateImpl(SSma *pSma, SRSmaParam *param, int64_t suid, con
|
|||
// from write queue: single thead
|
||||
pRSmaInfo = (SRSmaInfo *)taosMemoryCalloc(1, sizeof(SRSmaInfo));
|
||||
if (!pRSmaInfo) {
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
return terrno;
|
||||
}
|
||||
|
||||
STSchema *pTSchema = metaGetTbTSchema(SMA_META(pSma), suid, -1, 1);
|
||||
|
|
|
@ -38,7 +38,7 @@ int32_t rsmaSnapReaderOpen(SSma* pSma, int64_t sver, int64_t ever, SRSmaSnapRead
|
|||
// alloc
|
||||
pReader = (SRSmaSnapReader*)taosMemoryCalloc(1, sizeof(*pReader));
|
||||
if (pReader == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit);
|
||||
TAOS_CHECK_GOTO(terrno, &lino, _exit);
|
||||
}
|
||||
pReader->pSma = pSma;
|
||||
pReader->sver = sver;
|
||||
|
@ -136,7 +136,7 @@ int32_t rsmaSnapWriterOpen(SSma* pSma, int64_t sver, int64_t ever, void** ppRang
|
|||
// alloc
|
||||
pWriter = (SRSmaSnapWriter*)taosMemoryCalloc(1, sizeof(*pWriter));
|
||||
if (!pWriter) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit);
|
||||
TAOS_CHECK_GOTO(terrno, &lino, _exit);
|
||||
}
|
||||
pWriter->pSma = pSma;
|
||||
pWriter->sver = sver;
|
||||
|
|
|
@ -165,7 +165,7 @@ int32_t smaBlockToSubmit(SVnode *pVnode, const SArray *pBlocks, const STSchema *
|
|||
pReq = taosMemoryCalloc(1, sizeof(SSubmitReq2));
|
||||
|
||||
if (!tagArray || !pReq) {
|
||||
TAOS_CHECK_EXIT(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_CHECK_EXIT(terrno);
|
||||
}
|
||||
|
||||
pReq->aSubmitTbData = taosArrayInit(1, sizeof(SSubmitTbData));
|
||||
|
|
|
@ -66,7 +66,7 @@ static bool tqOffsetEqual(const STqOffset* pLeft, const STqOffset* pRight) {
|
|||
int32_t tqOpen(const char* path, SVnode* pVnode) {
|
||||
STQ* pTq = taosMemoryCalloc(1, sizeof(STQ));
|
||||
if (pTq == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
pVnode->pTq = pTq;
|
||||
pTq->path = taosStrdup(path);
|
||||
|
@ -173,7 +173,7 @@ void tqPushEmptyDataRsp(STqHandle* pHandle, int32_t vgId) {
|
|||
dataRsp.common.blockNum = 0;
|
||||
char buf[TSDB_OFFSET_LEN] = {0};
|
||||
(void)tFormatOffset(buf, TSDB_OFFSET_LEN, &dataRsp.common.reqOffset);
|
||||
tqInfo("tqPushEmptyDataRsp to consumer:0x%" PRIx64 " vgId:%d, offset:%s, qid:0x%" PRIx64, req.consumerId, vgId, buf,
|
||||
tqInfo("tqPushEmptyDataRsp to consumer:0x%" PRIx64 " vgId:%d, offset:%s,QID:0x%" PRIx64, req.consumerId, vgId, buf,
|
||||
req.reqId);
|
||||
|
||||
code = tqSendDataRsp(pHandle, pHandle->msg, &req, &dataRsp, TMQ_MSG_TYPE__POLL_DATA_RSP, vgId);
|
||||
|
@ -193,7 +193,7 @@ int32_t tqSendDataRsp(STqHandle* pHandle, const SRpcMsg* pMsg, const SMqPollReq*
|
|||
(void)tFormatOffset(buf1, TSDB_OFFSET_LEN, &((SMqDataRspCommon*)pRsp)->reqOffset);
|
||||
(void)tFormatOffset(buf2, TSDB_OFFSET_LEN, &((SMqDataRspCommon*)pRsp)->rspOffset);
|
||||
|
||||
tqDebug("tmq poll vgId:%d consumer:0x%" PRIx64 " (epoch %d) send rsp, block num:%d, req:%s, rsp:%s, qid:0x%" PRIx64,
|
||||
tqDebug("tmq poll vgId:%d consumer:0x%" PRIx64 " (epoch %d) send rsp, block num:%d, req:%s, rsp:%s,QID:0x%" PRIx64,
|
||||
vgId, pReq->consumerId, pReq->epoch, ((SMqDataRspCommon*)pRsp)->blockNum, buf1, buf2, pReq->reqId);
|
||||
|
||||
return tqDoSendDataRsp(&pMsg->info, pRsp, pReq->epoch, pReq->consumerId, type, sver, ever);
|
||||
|
@ -421,7 +421,7 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg) {
|
|||
|
||||
char buf[TSDB_OFFSET_LEN] = {0};
|
||||
(void)tFormatOffset(buf, TSDB_OFFSET_LEN, &reqOffset);
|
||||
tqDebug("tmq poll: consumer:0x%" PRIx64 " (epoch %d), subkey %s, recv poll req vgId:%d, req:%s, qid:0x%" PRIx64,
|
||||
tqDebug("tmq poll: consumer:0x%" PRIx64 " (epoch %d), subkey %s, recv poll req vgId:%d, req:%s,QID:0x%" PRIx64,
|
||||
consumerId, req.epoch, pHandle->subKey, vgId, buf, req.reqId);
|
||||
|
||||
code = tqExtractDataForMq(pTq, pHandle, &req, pMsg);
|
||||
|
|
|
@ -115,7 +115,7 @@ int32_t tqMetaSaveOffset(STQ* pTq, STqOffset* pOffset) {
|
|||
|
||||
buf = taosMemoryCalloc(1, vlen);
|
||||
if (buf == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto END;
|
||||
}
|
||||
|
||||
|
@ -212,7 +212,7 @@ int32_t tqMetaSaveHandle(STQ* pTq, const char* key, const STqHandle* pHandle) {
|
|||
|
||||
buf = taosMemoryCalloc(1, vlen);
|
||||
if (buf == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto END;
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ int32_t tqBuildFName(char** data, const char* path, char* name) {
|
|||
int32_t len = strlen(path) + strlen(name) + 2;
|
||||
char* fname = taosMemoryCalloc(1, len);
|
||||
if(fname == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
int32_t code = snprintf(fname, len, "%s%s%s", path, TD_DIRSEP, name);
|
||||
if (code < 0){
|
||||
|
@ -56,7 +56,7 @@ int32_t tqOffsetRestoreFromFile(STQ* pTq, char* name) {
|
|||
size = htonl(size);
|
||||
pMemBuf = taosMemoryCalloc(1, size);
|
||||
if (pMemBuf == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto END;
|
||||
}
|
||||
|
||||
|
|
|
@ -214,12 +214,12 @@ int32_t tqFetchLog(STQ* pTq, STqHandle* pHandle, int64_t* fetchOffset, uint64_t
|
|||
while (offset <= appliedVer) {
|
||||
if (walFetchHead(pHandle->pWalReader, offset) < 0) {
|
||||
tqDebug("tmq poll: consumer:0x%" PRIx64 ", (epoch %d) vgId:%d offset %" PRId64
|
||||
", no more log to return, qid:0x%" PRIx64 " 0x%" PRIx64,
|
||||
", no more log to return,QID:0x%" PRIx64 " 0x%" PRIx64,
|
||||
pHandle->consumerId, pHandle->epoch, vgId, offset, reqId, id);
|
||||
goto END;
|
||||
}
|
||||
|
||||
tqDebug("vgId:%d, consumer:0x%" PRIx64 " taosx get msg ver %" PRId64 ", type: %s, qid:0x%" PRIx64 " 0x%" PRIx64,
|
||||
tqDebug("vgId:%d, consumer:0x%" PRIx64 " taosx get msg ver %" PRId64 ", type: %s,QID:0x%" PRIx64 " 0x%" PRIx64,
|
||||
vgId, pHandle->consumerId, offset, TMSG_INFO(pHandle->pWalReader->pHead->head.msgType), reqId, id);
|
||||
|
||||
if (pHandle->pWalReader->pHead->head.msgType == TDMT_VND_SUBMIT) {
|
||||
|
@ -547,7 +547,7 @@ int32_t tqMaskBlock(SSchemaWrapper* pDst, SSDataBlock* pBlock, const SSchemaWrap
|
|||
pDst->nCols = cnt;
|
||||
pDst->pSchema = taosMemoryCalloc(cnt, sizeof(SSchema));
|
||||
if (pDst->pSchema == NULL) {
|
||||
return TAOS_GET_TERRNO(TSDB_CODE_OUT_OF_MEMORY);
|
||||
return TAOS_GET_TERRNO(terrno);
|
||||
}
|
||||
|
||||
int32_t j = 0;
|
||||
|
|
|
@ -19,7 +19,7 @@ int32_t tqAddBlockDataToRsp(const SSDataBlock* pBlock, void* pRsp, int32_t numOf
|
|||
int32_t dataStrLen = sizeof(SRetrieveTableRspForTmq) + blockGetEncodeSize(pBlock);
|
||||
void* buf = taosMemoryCalloc(1, dataStrLen);
|
||||
if (buf == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
SRetrieveTableRspForTmq* pRetrieve = (SRetrieveTableRspForTmq*)buf;
|
||||
|
@ -344,7 +344,7 @@ static void tqProcessSubData(STQ* pTq, STqHandle* pHandle, STaosxRsp* pRsp, int3
|
|||
}
|
||||
void* createReq = taosMemoryCalloc(1, len);
|
||||
if (createReq == NULL){
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto END;
|
||||
}
|
||||
SEncoder encoder = {0};
|
||||
|
|
|
@ -549,7 +549,7 @@ int32_t buildAutoCreateTableReq(const char* stbFullName, int64_t suid, int32_t n
|
|||
|
||||
SVCreateTbReq* pCreateTbReq = taosMemoryCalloc(1, sizeof(SVCreateTbReq));
|
||||
if (pCreateTbReq == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
taosArrayClear(pTagArray);
|
||||
|
@ -802,7 +802,7 @@ int32_t doCreateSinkInfo(const char* pDstTableName, STableSinkInfo** pInfo) {
|
|||
int32_t nameLen = strlen(pDstTableName);
|
||||
(*pInfo) = taosMemoryCalloc(1, sizeof(STableSinkInfo) + nameLen + 1);
|
||||
if (*pInfo == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
(*pInfo)->name.len = nameLen;
|
||||
|
|
|
@ -38,7 +38,7 @@ int32_t streamStateSnapReaderOpen(STQ* pTq, int64_t sver, int64_t ever, SStreamS
|
|||
// alloc
|
||||
pReader = (SStreamStateReader*)taosMemoryCalloc(1, sizeof(SStreamStateReader));
|
||||
if (pReader == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _err;
|
||||
}
|
||||
|
||||
|
@ -130,7 +130,7 @@ int32_t streamStateSnapWriterOpen(STQ* pTq, int64_t sver, int64_t ever, SStreamS
|
|||
// alloc
|
||||
pWriter = (SStreamStateWriter*)taosMemoryCalloc(1, sizeof(*pWriter));
|
||||
if (pWriter == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _err;
|
||||
}
|
||||
pWriter->pTq = pTq;
|
||||
|
|
|
@ -39,7 +39,7 @@ int32_t streamTaskSnapReaderOpen(STQ* pTq, int64_t sver, int64_t ever, SStreamTa
|
|||
// alloc
|
||||
pReader = (SStreamTaskReader*)taosMemoryCalloc(1, sizeof(SStreamTaskReader));
|
||||
if (pReader == NULL) {
|
||||
TAOS_CHECK_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_CHECK_RETURN(terrno);
|
||||
}
|
||||
pReader->pTq = pTq;
|
||||
pReader->sver = sver;
|
||||
|
@ -120,7 +120,7 @@ NextTbl:
|
|||
} else {
|
||||
pVal = taosMemoryCalloc(1, tLen);
|
||||
if (pVal == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _err;
|
||||
}
|
||||
memcpy(pVal, tVal, tLen);
|
||||
|
@ -181,7 +181,7 @@ int32_t streamTaskSnapWriterOpen(STQ* pTq, int64_t sver, int64_t ever, SStreamTa
|
|||
// alloc
|
||||
pWriter = (SStreamTaskWriter*)taosMemoryCalloc(1, sizeof(*pWriter));
|
||||
if (pWriter == NULL) {
|
||||
TAOS_CHECK_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_CHECK_RETURN(terrno);
|
||||
}
|
||||
pWriter->pTq = pTq;
|
||||
pWriter->sver = sver;
|
||||
|
|
|
@ -92,7 +92,7 @@ static int32_t extractResetOffsetVal(STqOffsetVal* pOffsetVal, STQ* pTq, STqHand
|
|||
char formatBuf[TSDB_OFFSET_LEN] = {0};
|
||||
tFormatOffset(formatBuf, TSDB_OFFSET_LEN, pOffsetVal);
|
||||
tqDebug("tmq poll: consumer:0x%" PRIx64
|
||||
", subkey %s, vgId:%d, existed offset found, offset reset to %s and continue. qid:0x%" PRIx64,
|
||||
", subkey %s, vgId:%d, existed offset found, offset reset to %s and continue.QID:0x%" PRIx64,
|
||||
consumerId, pHandle->subKey, vgId, formatBuf, pRequest->reqId);
|
||||
return 0;
|
||||
} else {
|
||||
|
@ -176,7 +176,7 @@ static int32_t extractDataAndRspForNormalSubscribe(STQ* pTq, STqHandle* pHandle,
|
|||
end : {
|
||||
char buf[TSDB_OFFSET_LEN] = {0};
|
||||
tFormatOffset(buf, TSDB_OFFSET_LEN, &dataRsp.common.rspOffset);
|
||||
tqDebug("tmq poll: consumer:0x%" PRIx64 ", subkey %s, vgId:%d, rsp block:%d, rsp offset type:%s, qid:0x%" PRIx64
|
||||
tqDebug("tmq poll: consumer:0x%" PRIx64 ", subkey %s, vgId:%d, rsp block:%d, rsp offset type:%s,QID:0x%" PRIx64
|
||||
" code:%d",
|
||||
consumerId, pHandle->subKey, vgId, dataRsp.common.blockNum, buf, pRequest->reqId, code);
|
||||
tDeleteMqDataRsp(&dataRsp);
|
||||
|
|
|
@ -582,7 +582,7 @@ int32_t tqStreamTaskProcessDeployReq(SStreamMeta* pMeta, SMsgCb* cb, int64_t sve
|
|||
SStreamTask* pTask = taosMemoryCalloc(1, size);
|
||||
if (pTask == NULL) {
|
||||
tqError("vgId:%d failed to create stream task due to out of memory, alloc size:%d", vgId, size);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
SDecoder decoder;
|
||||
|
|
|
@ -326,7 +326,7 @@ static int32_t tsdbCacheDeserialize(char const *value, size_t size, SLastCol **p
|
|||
|
||||
SLastCol *pLastCol = taosMemoryCalloc(1, sizeof(SLastCol));
|
||||
if (NULL == pLastCol) {
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
return terrno;
|
||||
}
|
||||
|
||||
int32_t offset = tsdbCacheDeserializeV0(value, pLastCol);
|
||||
|
@ -632,7 +632,7 @@ static int32_t tsdbCacheNewTableColumn(STsdb *pTsdb, int64_t uid, int16_t cid, i
|
|||
|
||||
SLastCol *pLastCol = taosMemoryCalloc(1, sizeof(SLastCol));
|
||||
if (!pLastCol) {
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
return terrno;
|
||||
}
|
||||
|
||||
size_t charge = 0;
|
||||
|
@ -679,13 +679,17 @@ int32_t tsdbCacheCommitNoLock(STsdb *pTsdb) {
|
|||
static int32_t tsdbCacheGetValuesFromRocks(STsdb *pTsdb, size_t numKeys, const char *const *ppKeysList,
|
||||
size_t *pKeysListSizes, char ***pppValuesList, size_t **ppValuesListSizes) {
|
||||
char **valuesList = taosMemoryCalloc(numKeys, sizeof(char *));
|
||||
if(!valuesList) return terrno;
|
||||
size_t *valuesListSizes = taosMemoryCalloc(numKeys, sizeof(size_t));
|
||||
if(!valuesListSizes) {
|
||||
taosMemoryFreeClear(valuesList);
|
||||
return terrno;
|
||||
}
|
||||
char **errs = taosMemoryCalloc(numKeys, sizeof(char *));
|
||||
if (!valuesList || !valuesListSizes || !errs) {
|
||||
if (!errs) {
|
||||
taosMemoryFreeClear(valuesList);
|
||||
taosMemoryFreeClear(valuesListSizes);
|
||||
taosMemoryFreeClear(errs);
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
return terrno;
|
||||
}
|
||||
rocksdb_multi_get(pTsdb->rCache.db, pTsdb->rCache.readoptions, numKeys, ppKeysList, pKeysListSizes, valuesList,
|
||||
valuesListSizes, errs);
|
||||
|
@ -705,12 +709,12 @@ static int32_t tsdbCacheDropTableColumn(STsdb *pTsdb, int64_t uid, int16_t cid,
|
|||
// build keys & multi get from rocks
|
||||
char **keys_list = taosMemoryCalloc(2, sizeof(char *));
|
||||
if (!keys_list) {
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
return terrno;
|
||||
}
|
||||
size_t *keys_list_sizes = taosMemoryCalloc(2, sizeof(size_t));
|
||||
if (!keys_list_sizes) {
|
||||
taosMemoryFree(keys_list);
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
return terrno;
|
||||
}
|
||||
const size_t klen = ROCKS_KEY_LEN;
|
||||
|
||||
|
@ -718,7 +722,7 @@ static int32_t tsdbCacheDropTableColumn(STsdb *pTsdb, int64_t uid, int16_t cid,
|
|||
if (!keys) {
|
||||
taosMemoryFree(keys_list);
|
||||
taosMemoryFree(keys_list_sizes);
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
return terrno;
|
||||
}
|
||||
((SLastKey *)keys)[0] = (SLastKey){.lflag = LFLAG_LAST, .uid = uid, .cid = cid};
|
||||
((SLastKey *)keys)[1] = (SLastKey){.lflag = LFLAG_LAST_ROW, .uid = uid, .cid = cid};
|
||||
|
@ -1003,7 +1007,7 @@ static int32_t tsdbCacheUpdateValue(SValue *pOld, SValue *pNew) {
|
|||
if (nData < pNew->nData) {
|
||||
pOld->pData = taosMemoryCalloc(1, pNew->nData);
|
||||
if (!pOld->pData) {
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
return terrno;
|
||||
}
|
||||
} else {
|
||||
pOld->pData = pFree;
|
||||
|
@ -1099,7 +1103,7 @@ static int32_t tsdbCachePutToLRU(STsdb *pTsdb, SLastKey *pLastKey, SLastCol *pLa
|
|||
|
||||
SLastCol *pLRULastCol = taosMemoryCalloc(1, sizeof(SLastCol));
|
||||
if (!pLRULastCol) {
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
return terrno;
|
||||
}
|
||||
|
||||
size_t charge = 0;
|
||||
|
@ -1182,11 +1186,15 @@ static int32_t tsdbCacheUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, SArray
|
|||
size_t *values_list_sizes = NULL;
|
||||
char **errs = NULL;
|
||||
keys_list = taosMemoryCalloc(num_keys, sizeof(char *));
|
||||
if(!keys_list) {
|
||||
(void)taosThreadMutexUnlock(&pTsdb->lruMutex);
|
||||
return terrno;
|
||||
}
|
||||
keys_list_sizes = taosMemoryCalloc(num_keys, sizeof(size_t));
|
||||
if (!keys_list || !keys_list_sizes) {
|
||||
if (!keys_list_sizes) {
|
||||
taosMemoryFree(keys_list);
|
||||
(void)taosThreadMutexUnlock(&pTsdb->lruMutex);
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
return terrno;
|
||||
}
|
||||
for (int i = 0; i < num_keys; ++i) {
|
||||
SIdxKey *idxKey = &((SIdxKey *)TARRAY_DATA(remainCols))[i];
|
||||
|
@ -1578,7 +1586,7 @@ static int32_t tsdbCacheLoadFromRaw(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArr
|
|||
|
||||
SLastCol *pTmpLastCol = taosMemoryCalloc(1, sizeof(SLastCol));
|
||||
if (!pTmpLastCol) {
|
||||
TAOS_CHECK_EXIT(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_CHECK_EXIT(terrno);
|
||||
}
|
||||
|
||||
size_t charge = 0;
|
||||
|
@ -1678,7 +1686,7 @@ static int32_t tsdbCacheLoadFromRocks(STsdb *pTsdb, tb_uid_t uid, SArray *pLastA
|
|||
SLastCol *pTmpLastCol = taosMemoryCalloc(1, sizeof(SLastCol));
|
||||
if (!pTmpLastCol) {
|
||||
taosMemoryFreeClear(PToFree);
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _exit;
|
||||
}
|
||||
|
||||
|
@ -1896,7 +1904,7 @@ int32_t tsdbCacheDel(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSKEY sKey, TSKE
|
|||
size_t *values_list_sizes = NULL;
|
||||
|
||||
if (!keys_list || !keys_list_sizes) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _exit;
|
||||
}
|
||||
const size_t klen = ROCKS_KEY_LEN;
|
||||
|
@ -1904,7 +1912,7 @@ int32_t tsdbCacheDel(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSKEY sKey, TSKE
|
|||
for (int i = 0; i < numKeys; ++i) {
|
||||
char *key = taosMemoryCalloc(1, sizeof(SLastKey));
|
||||
if (!key) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _exit;
|
||||
}
|
||||
((SLastKey *)key)[0] = *(SLastKey *)taosArrayGet(remainCols, i);
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
static int32_t setFirstLastResColToNull(SColumnInfoData* pCol, int32_t row) {
|
||||
char* buf = taosMemoryCalloc(1, pCol->info.bytes);
|
||||
if (buf == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
SFirstLastRes* pRes = (SFirstLastRes*)((char*)buf + VARSTR_HEADER_SIZE);
|
||||
|
@ -283,7 +283,7 @@ int32_t tsdbCacherowsReaderOpen(void* pVnode, int32_t type, void* pTableIdList,
|
|||
*pReader = NULL;
|
||||
SCacheRowsReader* p = taosMemoryCalloc(1, sizeof(SCacheRowsReader));
|
||||
if (p == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
p->type = type;
|
||||
|
@ -323,7 +323,7 @@ int32_t tsdbCacherowsReaderOpen(void* pVnode, int32_t type, void* pTableIdList,
|
|||
p->transferBuf = taosMemoryCalloc(p->pSchema->numOfCols, POINTER_BYTES);
|
||||
if (p->transferBuf == NULL) {
|
||||
tsdbCacherowsReaderClose(p);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
for (int32_t i = 0; i < p->pSchema->numOfCols; ++i) {
|
||||
|
@ -446,7 +446,7 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32
|
|||
|
||||
pRes = taosMemoryCalloc(pr->numOfCols, POINTER_BYTES);
|
||||
if (pRes == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _end;
|
||||
}
|
||||
|
||||
|
@ -456,7 +456,7 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32
|
|||
|
||||
pRes[j] = taosMemoryCalloc(1, sizeof(SFirstLastRes) + bytes + pkBufLen + VARSTR_HEADER_SIZE);
|
||||
if (pRes[j] == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _end;
|
||||
}
|
||||
|
||||
|
@ -504,7 +504,7 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32
|
|||
|
||||
p.rowKey.pks[j].pData = taosMemoryCalloc(1, pr->pkColumn.bytes);
|
||||
if (p.rowKey.pks[j].pData == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _end;
|
||||
}
|
||||
}
|
||||
|
@ -514,7 +514,7 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32
|
|||
if (IS_VAR_DATA_TYPE(pCol->type)) {
|
||||
p.colVal.value.pData = taosMemoryCalloc(pCol->bytes, sizeof(char));
|
||||
if (p.colVal.value.pData == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _end;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -432,7 +432,7 @@ static int32_t tsdbCommitInfoInit(STsdb *pTsdb) {
|
|||
|
||||
pTsdb->commitInfo = taosMemoryCalloc(1, sizeof(*pTsdb->commitInfo));
|
||||
if (pTsdb->commitInfo == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit);
|
||||
TAOS_CHECK_GOTO(terrno, &lino, _exit);
|
||||
}
|
||||
|
||||
TAOS_CHECK_GOTO(vHashInit(&pTsdb->commitInfo->ht, tFileSetCommitInfoHash, tFileSetCommitInfoCompare), &lino, _exit);
|
||||
|
|
|
@ -23,7 +23,7 @@ int32_t tsdbDataFileRAWReaderOpen(const char *fname, const SDataFileRAWReaderCon
|
|||
|
||||
reader[0] = taosMemoryCalloc(1, sizeof(SDataFileRAWReader));
|
||||
if (reader[0] == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit);
|
||||
TAOS_CHECK_GOTO(terrno, &lino, _exit);
|
||||
}
|
||||
|
||||
reader[0]->config[0] = config[0];
|
||||
|
@ -94,7 +94,7 @@ int32_t tsdbDataFileRAWWriterOpen(const SDataFileRAWWriterConfig *config, SDataF
|
|||
|
||||
SDataFileRAWWriter *writer = taosMemoryCalloc(1, sizeof(SDataFileRAWWriter));
|
||||
if (!writer) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit);
|
||||
TAOS_CHECK_GOTO(terrno, &lino, _exit);
|
||||
}
|
||||
|
||||
writer->config[0] = config[0];
|
||||
|
|
|
@ -111,7 +111,7 @@ int32_t tsdbDataFileReaderOpen(const char *fname[], const SDataFileReaderConfig
|
|||
int32_t lino = 0;
|
||||
|
||||
if ((*reader = taosMemoryCalloc(1, sizeof(**reader))) == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit);
|
||||
TAOS_CHECK_GOTO(terrno, &lino, _exit);
|
||||
}
|
||||
|
||||
for (int32_t i = 0; i < ARRAY_SIZE(reader[0]->local); i++) {
|
||||
|
@ -1803,7 +1803,7 @@ _exit:
|
|||
int32_t tsdbDataFileWriterOpen(const SDataFileWriterConfig *config, SDataFileWriter **writer) {
|
||||
writer[0] = taosMemoryCalloc(1, sizeof(*writer[0]));
|
||||
if (!writer[0]) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
writer[0]->config[0] = config[0];
|
||||
|
|
|
@ -53,7 +53,7 @@ static int32_t tsdbBinaryToFS(uint8_t *pData, int64_t nData, STsdbFS *pFS) {
|
|||
if (hasDel) {
|
||||
pFS->pDelFile = (SDelFile *)taosMemoryCalloc(1, sizeof(SDelFile));
|
||||
if (pFS->pDelFile == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _exit;
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ static const char *gCurrentFname[] = {
|
|||
static int32_t create_fs(STsdb *pTsdb, STFileSystem **fs) {
|
||||
fs[0] = taosMemoryCalloc(1, sizeof(*fs[0]));
|
||||
if (fs[0] == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
fs[0]->tsdb = pTsdb;
|
||||
|
@ -417,7 +417,7 @@ static int32_t tsdbFSCreateFileObjHash(STFileSystem *fs, STFileHash *hash) {
|
|||
hash->numBucket = 4096;
|
||||
hash->buckets = taosMemoryCalloc(hash->numBucket, sizeof(STFileHashEntry *));
|
||||
if (hash->buckets == NULL) {
|
||||
TSDB_CHECK_CODE(code = TSDB_CODE_OUT_OF_MEMORY, lino, _exit);
|
||||
TSDB_CHECK_CODE(code = terrno, lino, _exit);
|
||||
}
|
||||
|
||||
// vnode.json
|
||||
|
@ -1013,7 +1013,7 @@ int32_t tsdbFSCreateRefSnapshotWithoutLock(STFileSystem *fs, TFileSetArray **fse
|
|||
STFileSet *fset, *fset1;
|
||||
|
||||
fsetArr[0] = taosMemoryCalloc(1, sizeof(*fsetArr[0]));
|
||||
if (fsetArr[0] == NULL) return TSDB_CODE_OUT_OF_MEMORY;
|
||||
if (fsetArr[0] == NULL) return terrno;
|
||||
|
||||
TARRAY2_FOREACH(fs->fSetArr, fset) {
|
||||
code = tsdbTFileSetInitRef(fs->tsdb, fset, &fset1);
|
||||
|
@ -1025,6 +1025,7 @@ int32_t tsdbFSCreateRefSnapshotWithoutLock(STFileSystem *fs, TFileSetArray **fse
|
|||
|
||||
if (code) {
|
||||
TARRAY2_DESTROY(fsetArr[0], tsdbTFileSetClear);
|
||||
taosMemoryFree(fsetArr[0]);
|
||||
fsetArr[0] = NULL;
|
||||
}
|
||||
return code;
|
||||
|
@ -1118,7 +1119,7 @@ int32_t tsdbFSCreateRefRangedSnapshot(STFileSystem *fs, int64_t sver, int64_t ev
|
|||
|
||||
fsrArr[0] = taosMemoryCalloc(1, sizeof(*fsrArr[0]));
|
||||
if (fsrArr[0] == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _out;
|
||||
}
|
||||
|
||||
|
|
|
@ -576,12 +576,17 @@ int32_t tsdbTFileSetInitRef(STsdb *pTsdb, const STFileSet *fset1, STFileSet **fs
|
|||
SSttLvl *lvl;
|
||||
code = tsdbSttLvlInitRef(pTsdb, lvl1, &lvl);
|
||||
if (code) {
|
||||
taosMemoryFree(lvl);
|
||||
tsdbTFileSetClear(fset);
|
||||
return code;
|
||||
}
|
||||
|
||||
code = TARRAY2_APPEND(fset[0]->lvlArr, lvl);
|
||||
if (code) return code;
|
||||
if (code) {
|
||||
taosMemoryFree(lvl);
|
||||
tsdbTFileSetClear(fset);
|
||||
return code;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -36,7 +36,7 @@ int32_t tsdbFSetRAWWriterOpen(SFSetRAWWriterConfig *config, SFSetRAWWriter **wri
|
|||
|
||||
writer[0] = taosMemoryCalloc(1, sizeof(SFSetRAWWriter));
|
||||
if (writer[0] == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
writer[0]->config[0] = config[0];
|
||||
|
|
|
@ -136,7 +136,7 @@ int32_t tsdbFSetWriterOpen(SFSetWriterConfig *config, SFSetWriter **writer) {
|
|||
|
||||
writer[0] = taosMemoryCalloc(1, sizeof(*writer[0]));
|
||||
if (writer[0] == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
writer[0]->config[0] = config[0];
|
||||
|
|
|
@ -181,7 +181,7 @@ int32_t tGetDFileSet(uint8_t *p, SDFileSet *pSet) {
|
|||
// head
|
||||
pSet->pHeadF = (SHeadFile *)taosMemoryCalloc(1, sizeof(SHeadFile));
|
||||
if (pSet->pHeadF == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
pSet->pHeadF->nRef = 1;
|
||||
n += tGetHeadFile(p + n, pSet->pHeadF);
|
||||
|
@ -189,7 +189,7 @@ int32_t tGetDFileSet(uint8_t *p, SDFileSet *pSet) {
|
|||
// data
|
||||
pSet->pDataF = (SDataFile *)taosMemoryCalloc(1, sizeof(SDataFile));
|
||||
if (pSet->pDataF == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
pSet->pDataF->nRef = 1;
|
||||
n += tGetDataFile(p + n, pSet->pDataF);
|
||||
|
@ -197,7 +197,7 @@ int32_t tGetDFileSet(uint8_t *p, SDFileSet *pSet) {
|
|||
// sma
|
||||
pSet->pSmaF = (SSmaFile *)taosMemoryCalloc(1, sizeof(SSmaFile));
|
||||
if (pSet->pSmaF == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
pSet->pSmaF->nRef = 1;
|
||||
n += tGetSmaFile(p + n, pSet->pSmaF);
|
||||
|
@ -207,7 +207,7 @@ int32_t tGetDFileSet(uint8_t *p, SDFileSet *pSet) {
|
|||
for (int32_t iStt = 0; iStt < pSet->nSttF; iStt++) {
|
||||
pSet->aSttF[iStt] = (SSttFile *)taosMemoryCalloc(1, sizeof(SSttFile));
|
||||
if (pSet->aSttF[iStt] == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
pSet->aSttF[iStt]->nRef = 1;
|
||||
n += tGetSttFile(p + n, pSet->aSttF[iStt]);
|
||||
|
|
|
@ -86,14 +86,19 @@ void destroySttBlockLoadInfo(SSttBlockLoadInfo *pLoadInfo) {
|
|||
pInfo->sttBlockIndex = -1;
|
||||
pInfo->pin = false;
|
||||
|
||||
if (pLoadInfo->info.pCount != NULL) {
|
||||
taosArrayDestroy(pLoadInfo->info.pUid);
|
||||
taosArrayDestroyEx(pLoadInfo->info.pFirstKey, freeItem);
|
||||
taosArrayDestroyEx(pLoadInfo->info.pLastKey, freeItem);
|
||||
taosArrayDestroy(pLoadInfo->info.pCount);
|
||||
taosArrayDestroy(pLoadInfo->info.pFirstTs);
|
||||
taosArrayDestroy(pLoadInfo->info.pLastTs);
|
||||
}
|
||||
taosArrayDestroy(pLoadInfo->info.pUid);
|
||||
taosArrayDestroyEx(pLoadInfo->info.pFirstKey, freeItem);
|
||||
taosArrayDestroyEx(pLoadInfo->info.pLastKey, freeItem);
|
||||
taosArrayDestroy(pLoadInfo->info.pCount);
|
||||
taosArrayDestroy(pLoadInfo->info.pFirstTs);
|
||||
taosArrayDestroy(pLoadInfo->info.pLastTs);
|
||||
|
||||
pLoadInfo->info.pUid = NULL;
|
||||
pLoadInfo->info.pFirstKey = NULL;
|
||||
pLoadInfo->info.pLastKey = NULL;
|
||||
pLoadInfo->info.pCount = NULL;
|
||||
pLoadInfo->info.pFirstTs = NULL;
|
||||
pLoadInfo->info.pLastTs = NULL;
|
||||
|
||||
taosArrayDestroy(pLoadInfo->aSttBlk);
|
||||
taosMemoryFree(pLoadInfo);
|
||||
|
@ -834,7 +839,6 @@ int32_t tLDataIterNextRow(SLDataIter *pIter, const char *idStr, bool *hasNext) {
|
|||
int32_t lino = 0;
|
||||
|
||||
*hasNext = false;
|
||||
terrno = 0;
|
||||
|
||||
// no qualified last file block in current file, no need to fetch row
|
||||
if (pIter->pSttBlk == NULL) {
|
||||
|
@ -843,6 +847,7 @@ int32_t tLDataIterNextRow(SLDataIter *pIter, const char *idStr, bool *hasNext) {
|
|||
|
||||
code = loadLastBlock(pIter, idStr, &pBlockData);
|
||||
if (pBlockData == NULL || code != TSDB_CODE_SUCCESS) {
|
||||
lino = __LINE__;
|
||||
goto _exit;
|
||||
}
|
||||
|
||||
|
@ -888,6 +893,7 @@ int32_t tLDataIterNextRow(SLDataIter *pIter, const char *idStr, bool *hasNext) {
|
|||
if (iBlockL != pIter->iSttBlk) {
|
||||
code = loadLastBlock(pIter, idStr, &pBlockData);
|
||||
if ((pBlockData == NULL) || (code != 0)) {
|
||||
lino = __LINE__;
|
||||
goto _exit;
|
||||
}
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ int32_t tsdbOpen(SVnode *pVnode, STsdb **ppTsdb, const char *dir, STsdbKeepCfg *
|
|||
// create handle
|
||||
pTsdb = (STsdb *)taosMemoryCalloc(1, sizeof(*pTsdb) + slen);
|
||||
if (pTsdb == NULL) {
|
||||
TAOS_CHECK_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_CHECK_RETURN(terrno);
|
||||
}
|
||||
|
||||
pTsdb->path = (char *)&pTsdb[1];
|
||||
|
|
|
@ -45,7 +45,7 @@ typedef struct {
|
|||
bool moreThanCapcity;
|
||||
} SDataBlockToLoadInfo;
|
||||
|
||||
static int32_t getCurrentBlockInfo(SDataBlockIter* pBlockIter, SFileDataBlockInfo** pInfo);
|
||||
static int32_t getCurrentBlockInfo(SDataBlockIter* pBlockIter, SFileDataBlockInfo** pInfo, const char* idStr);
|
||||
static int32_t buildDataBlockFromBufImpl(STableBlockScanInfo* pBlockScanInfo, int64_t endKey, int32_t capacity,
|
||||
STsdbReader* pReader);
|
||||
static void getValidMemRow(SIterInfo* pIter, const SArray* pDelList, STsdbReader* pReader, TSDBROW** pRes);
|
||||
|
@ -257,7 +257,7 @@ static int32_t initFilesetIterator(SFilesetIter* pIter, TFileSetArray* pFileSetA
|
|||
if (pIter->pSttBlockReader == NULL) {
|
||||
pIter->pSttBlockReader = taosMemoryCalloc(1, sizeof(struct SSttBlockReader));
|
||||
if (pIter->pSttBlockReader == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
tsdbError("failed to prepare the last block iterator, since:%s %s", tstrerror(code), pReader->idStr);
|
||||
return code;
|
||||
}
|
||||
|
@ -507,13 +507,13 @@ static int32_t initResBlockInfo(SResultBlockInfo* pResBlockInfo, int64_t capacit
|
|||
if (IS_VAR_DATA_TYPE(pSup->pk.type)) {
|
||||
p->info.pks[0].pData = taosMemoryCalloc(1, pSup->pk.bytes);
|
||||
if (p->info.pks[0].pData == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
p->info.pks[1].pData = taosMemoryCalloc(1, pSup->pk.bytes);
|
||||
if (p->info.pks[1].pData == NULL) {
|
||||
taosMemoryFreeClear(p->info.pks[0].pData);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
p->info.pks[0].nData = pSup->pk.bytes;
|
||||
|
@ -533,7 +533,7 @@ static int32_t tsdbReaderCreate(SVnode* pVnode, SQueryTableDataCond* pCond, void
|
|||
int8_t level = 0;
|
||||
STsdbReader* pReader = (STsdbReader*)taosMemoryCalloc(1, sizeof(*pReader));
|
||||
if (pReader == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _end;
|
||||
}
|
||||
|
||||
|
@ -920,7 +920,7 @@ static int32_t doCopyColVal(SColumnInfoData* pColInfoData, int32_t rowIndex, int
|
|||
return code;
|
||||
}
|
||||
|
||||
static int32_t getCurrentBlockInfo(SDataBlockIter* pBlockIter, SFileDataBlockInfo** pInfo) {
|
||||
static int32_t getCurrentBlockInfo(SDataBlockIter* pBlockIter, SFileDataBlockInfo** pInfo, const char* id) {
|
||||
*pInfo = NULL;
|
||||
|
||||
if (pBlockIter->blockList == NULL) {
|
||||
|
@ -929,8 +929,10 @@ static int32_t getCurrentBlockInfo(SDataBlockIter* pBlockIter, SFileDataBlockInf
|
|||
|
||||
size_t num = TARRAY_SIZE(pBlockIter->blockList);
|
||||
if (num == 0) {
|
||||
tsdbError("tsdb read failed at: %s:%d", __func__, __LINE__);
|
||||
return TSDB_CODE_INTERNAL_ERROR;
|
||||
if (num != pBlockIter->numOfBlocks) {
|
||||
tsdbError("tsdb read failed at: %s:%d %s", __func__, __LINE__, id);
|
||||
}
|
||||
return TSDB_CODE_FAILED;
|
||||
}
|
||||
|
||||
*pInfo = taosArrayGet(pBlockIter->blockList, pBlockIter->index);
|
||||
|
@ -1206,7 +1208,7 @@ static int32_t copyBlockDataToSDataBlock(STsdbReader* pReader, SRowKey* pLastPro
|
|||
bool asc = ASCENDING_TRAVERSE(pReader->info.order);
|
||||
int32_t step = asc ? 1 : -1;
|
||||
|
||||
code = getCurrentBlockInfo(pBlockIter, &pBlockInfo);
|
||||
code = getCurrentBlockInfo(pBlockIter, &pBlockInfo, pReader->idStr);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
return code;
|
||||
}
|
||||
|
@ -1434,7 +1436,7 @@ static int32_t doLoadFileBlockData(STsdbReader* pReader, SDataBlockIter* pBlockI
|
|||
}
|
||||
}
|
||||
|
||||
code = getCurrentBlockInfo(pBlockIter, &pBlockInfo);
|
||||
code = getCurrentBlockInfo(pBlockIter, &pBlockInfo, pReader->idStr);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
return code;
|
||||
}
|
||||
|
@ -2786,7 +2788,7 @@ static int32_t buildComposedDataBlock(STsdbReader* pReader) {
|
|||
SSttBlockReader* pSttBlockReader = pReader->status.fileIter.pSttBlockReader;
|
||||
SFileBlockDumpInfo* pDumpInfo = &pReader->status.fBlockDumpInfo;
|
||||
|
||||
code = getCurrentBlockInfo(&pReader->status.blockIter, &pBlockInfo);
|
||||
code = getCurrentBlockInfo(&pReader->status.blockIter, &pBlockInfo, pReader->idStr);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -2835,7 +2837,8 @@ static int32_t buildComposedDataBlock(STsdbReader* pReader) {
|
|||
pDumpInfo->rowIndex += step;
|
||||
|
||||
if (pDumpInfo->rowIndex >= pBlockData->nRow || pDumpInfo->rowIndex < 0) {
|
||||
code = getCurrentBlockInfo(&pReader->status.blockIter, &pBlockInfo); // NOTE: get the new block info
|
||||
// NOTE: get the new block info
|
||||
code = getCurrentBlockInfo(&pReader->status.blockIter, &pBlockInfo, pReader->idStr);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
goto _end;
|
||||
}
|
||||
|
@ -3309,7 +3312,7 @@ static int32_t doBuildDataBlock(STsdbReader* pReader) {
|
|||
bool asc = ASCENDING_TRAVERSE(pReader->info.order);
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
|
||||
code = getCurrentBlockInfo(pBlockIter, &pBlockInfo);
|
||||
code = getCurrentBlockInfo(pBlockIter, &pBlockInfo, pReader->idStr);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
return code;
|
||||
}
|
||||
|
@ -3529,7 +3532,7 @@ static void initBlockDumpInfo(STsdbReader* pReader, SDataBlockIter* pBlockIter)
|
|||
SReaderStatus* pStatus = &pReader->status;
|
||||
SFileBlockDumpInfo* pDumpInfo = &pStatus->fBlockDumpInfo;
|
||||
|
||||
int32_t code = getCurrentBlockInfo(pBlockIter, &pBlockInfo);
|
||||
int32_t code = getCurrentBlockInfo(pBlockIter, &pBlockInfo, pReader->idStr);
|
||||
if (code == TSDB_CODE_SUCCESS) {
|
||||
pDumpInfo->totalRows = pBlockInfo->numRow;
|
||||
pDumpInfo->rowIndex = ASCENDING_TRAVERSE(pReader->info.order) ? 0 : pBlockInfo->numRow - 1;
|
||||
|
@ -4113,7 +4116,7 @@ int32_t doMergeRowsInFileBlocks(SBlockData* pBlockData, STableBlockScanInfo* pSc
|
|||
CHECK_FILEBLOCK_STATE st;
|
||||
|
||||
SFileDataBlockInfo* pFileBlockInfo = NULL;
|
||||
code = getCurrentBlockInfo(&pReader->status.blockIter, &pFileBlockInfo);
|
||||
code = getCurrentBlockInfo(&pReader->status.blockIter, &pFileBlockInfo, pReader->idStr);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
return code;
|
||||
}
|
||||
|
@ -5377,7 +5380,7 @@ int32_t tsdbRetrieveDatablockSMA2(STsdbReader* pReader, SSDataBlock* pDataBlock,
|
|||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
code = getCurrentBlockInfo(&pReader->status.blockIter, &pBlockInfo);
|
||||
code = getCurrentBlockInfo(&pReader->status.blockIter, &pBlockInfo, pReader->idStr);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
return code;
|
||||
}
|
||||
|
@ -5423,7 +5426,7 @@ int32_t tsdbRetrieveDatablockSMA2(STsdbReader* pReader, SSDataBlock* pDataBlock,
|
|||
size_t num = taosArrayGetSize(pResBlock->pDataBlock);
|
||||
pResBlock->pBlockAgg = taosMemoryCalloc(num, sizeof(SColumnDataAgg));
|
||||
if (pResBlock->pBlockAgg == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
for (int i = 0; i < num; ++i) {
|
||||
pResBlock->pBlockAgg[i].colId = -1;
|
||||
|
@ -5467,7 +5470,7 @@ static int32_t doRetrieveDataBlock(STsdbReader* pReader, SSDataBlock** pBlock) {
|
|||
SFileDataBlockInfo* pBlockInfo = NULL;
|
||||
*pBlock = NULL;
|
||||
|
||||
code = getCurrentBlockInfo(&pStatus->blockIter, &pBlockInfo);
|
||||
code = getCurrentBlockInfo(&pStatus->blockIter, &pBlockInfo, pReader->idStr);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
return code;
|
||||
}
|
||||
|
@ -5683,7 +5686,7 @@ int32_t tsdbGetFileBlocksDistInfo2(STsdbReader* pReader, STableBlockDistInfo* pT
|
|||
while (true) {
|
||||
if (hasNext) {
|
||||
SFileDataBlockInfo* pBlockInfo = NULL;
|
||||
code = getCurrentBlockInfo(pBlockIter, &pBlockInfo);
|
||||
code = getCurrentBlockInfo(pBlockIter, &pBlockInfo, pReader->idStr);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ static int32_t initBlockScanInfoBuf(SBlockInfoBuf* pBuf, int32_t numOfTables) {
|
|||
for (int32_t i = 0; i < num; ++i) {
|
||||
char* p = taosMemoryCalloc(pBuf->numPerBucket, sizeof(STableBlockScanInfo));
|
||||
if (p == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
void* px = taosArrayPush(pBuf->pData, &p);
|
||||
|
@ -50,7 +50,7 @@ static int32_t initBlockScanInfoBuf(SBlockInfoBuf* pBuf, int32_t numOfTables) {
|
|||
if (remainder > 0) {
|
||||
char* p = taosMemoryCalloc(remainder, sizeof(STableBlockScanInfo));
|
||||
if (p == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
void* px = taosArrayPush(pBuf->pData, &p);
|
||||
if (px == NULL) {
|
||||
|
@ -96,7 +96,7 @@ int32_t ensureBlockScanInfoBuf(SBlockInfoBuf* pBuf, int32_t numOfTables) {
|
|||
for (int32_t i = 0; i < num; ++i) {
|
||||
char* p = taosMemoryCalloc(pBuf->numPerBucket, sizeof(STableBlockScanInfo));
|
||||
if (p == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
void* px = taosArrayPush(pBuf->pData, &p);
|
||||
|
@ -108,7 +108,7 @@ int32_t ensureBlockScanInfoBuf(SBlockInfoBuf* pBuf, int32_t numOfTables) {
|
|||
if (remainder > 0) {
|
||||
char* p = taosMemoryCalloc(remainder, sizeof(STableBlockScanInfo));
|
||||
if (p == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
void* px = taosArrayPush(pBuf->pData, &p);
|
||||
if (px == NULL) {
|
||||
|
@ -231,7 +231,6 @@ int32_t initRowKey(SRowKey* pKey, int64_t ts, int32_t numOfPks, int32_t type, in
|
|||
pKey->pks[0].nData = 0;
|
||||
|
||||
if (pKey->pks[0].pData == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
|
@ -525,13 +524,13 @@ static void cleanupBlockOrderSupporter(SBlockOrderSupporter* pSup) {
|
|||
}
|
||||
|
||||
static int32_t initBlockOrderSupporter(SBlockOrderSupporter* pSup, int32_t numOfTables) {
|
||||
pSup->numOfBlocksPerTable = taosMemoryCalloc(1, sizeof(int32_t) * numOfTables);
|
||||
pSup->indexPerTable = taosMemoryCalloc(1, sizeof(int32_t) * numOfTables);
|
||||
pSup->pDataBlockInfo = taosMemoryCalloc(1, POINTER_BYTES * numOfTables);
|
||||
|
||||
if (pSup->numOfBlocksPerTable == NULL || pSup->indexPerTable == NULL || pSup->pDataBlockInfo == NULL) {
|
||||
pSup->indexPerTable = taosMemoryCalloc(1, sizeof(int32_t) * numOfTables);
|
||||
pSup->numOfBlocksPerTable = taosMemoryCalloc(1, sizeof(int32_t) * numOfTables);
|
||||
pSup->numOfTables = 0;
|
||||
if (pSup->pDataBlockInfo == NULL || pSup->indexPerTable == NULL || pSup->numOfBlocksPerTable == NULL) {
|
||||
cleanupBlockOrderSupporter(pSup);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
return TSDB_CODE_SUCCESS;
|
||||
|
|
|
@ -60,7 +60,7 @@ static int32_t tsdbOpenFileImpl(STsdbFD *pFD) {
|
|||
|
||||
pFD->pBuf = taosMemoryCalloc(1, szPage);
|
||||
if (pFD->pBuf == NULL) {
|
||||
TSDB_CHECK_CODE(code = TSDB_CODE_OUT_OF_MEMORY, lino, _exit);
|
||||
TSDB_CHECK_CODE(code = terrno, lino, _exit);
|
||||
}
|
||||
|
||||
if (lc_size > 0) {
|
||||
|
@ -100,7 +100,7 @@ int32_t tsdbOpenFile(const char *path, STsdb *pTsdb, int32_t flag, STsdbFD **ppF
|
|||
|
||||
pFD = (STsdbFD *)taosMemoryCalloc(1, sizeof(*pFD) + strlen(path) + 1);
|
||||
if (pFD == NULL) {
|
||||
TSDB_CHECK_CODE(code = TSDB_CODE_OUT_OF_MEMORY, lino, _exit);
|
||||
TSDB_CHECK_CODE(code = terrno, lino, _exit);
|
||||
}
|
||||
|
||||
pFD->path = (char *)&pFD[1];
|
||||
|
@ -363,7 +363,7 @@ static int32_t tsdbReadFileBlock(STsdbFD *pFD, int64_t offset, int64_t size, boo
|
|||
|
||||
buf = taosMemoryCalloc(1, size);
|
||||
if (buf == NULL) {
|
||||
TSDB_CHECK_CODE(code = TSDB_CODE_OUT_OF_MEMORY, lino, _exit);
|
||||
TSDB_CHECK_CODE(code = terrno, lino, _exit);
|
||||
}
|
||||
|
||||
for (int32_t chunkno = offset / chunksize + 1; n < size; ++chunkno) {
|
||||
|
@ -587,7 +587,7 @@ int32_t tsdbDataFReaderOpen(SDataFReader **ppReader, STsdb *pTsdb, SDFileSet *pS
|
|||
// alloc
|
||||
pReader = (SDataFReader *)taosMemoryCalloc(1, sizeof(*pReader));
|
||||
if (pReader == NULL) {
|
||||
TSDB_CHECK_CODE(code = TSDB_CODE_OUT_OF_MEMORY, lino, _exit);
|
||||
TSDB_CHECK_CODE(code = terrno, lino, _exit);
|
||||
}
|
||||
pReader->pTsdb = pTsdb;
|
||||
pReader->pSet = pSet;
|
||||
|
@ -794,7 +794,7 @@ int32_t tsdbDelFReaderOpen(SDelFReader **ppReader, SDelFile *pFile, STsdb *pTsdb
|
|||
// alloc
|
||||
pDelFReader = (SDelFReader *)taosMemoryCalloc(1, sizeof(*pDelFReader));
|
||||
if (pDelFReader == NULL) {
|
||||
TSDB_CHECK_CODE(code = TSDB_CODE_OUT_OF_MEMORY, lino, _exit);
|
||||
TSDB_CHECK_CODE(code = terrno, lino, _exit);
|
||||
}
|
||||
|
||||
// open impl
|
||||
|
|
|
@ -416,7 +416,7 @@ int32_t tsdbSnapReaderOpen(STsdb* tsdb, int64_t sver, int64_t ever, int8_t type,
|
|||
int32_t lino = 0;
|
||||
|
||||
reader[0] = (STsdbSnapReader*)taosMemoryCalloc(1, sizeof(*reader[0]));
|
||||
if (reader[0] == NULL) return TSDB_CODE_OUT_OF_MEMORY;
|
||||
if (reader[0] == NULL) return terrno;
|
||||
|
||||
reader[0]->tsdb = tsdb;
|
||||
reader[0]->sver = sver;
|
||||
|
@ -1047,7 +1047,7 @@ int32_t tsdbSnapWriterOpen(STsdb* pTsdb, int64_t sver, int64_t ever, void* pRang
|
|||
|
||||
// start to write
|
||||
writer[0] = taosMemoryCalloc(1, sizeof(*writer[0]));
|
||||
if (writer[0] == NULL) return TSDB_CODE_OUT_OF_MEMORY;
|
||||
if (writer[0] == NULL) return terrno;
|
||||
|
||||
writer[0]->tsdb = pTsdb;
|
||||
writer[0]->sver = sver;
|
||||
|
|
|
@ -52,7 +52,7 @@ int32_t tsdbSnapRAWReaderOpen(STsdb* tsdb, int64_t ever, int8_t type, STsdbSnapR
|
|||
int32_t lino = 0;
|
||||
|
||||
reader[0] = taosMemoryCalloc(1, sizeof(STsdbSnapRAWReader));
|
||||
if (reader[0] == NULL) return TSDB_CODE_OUT_OF_MEMORY;
|
||||
if (reader[0] == NULL) return terrno;
|
||||
|
||||
reader[0]->tsdb = tsdb;
|
||||
reader[0]->ever = ever;
|
||||
|
@ -196,7 +196,7 @@ static int32_t tsdbSnapRAWReadNext(STsdbSnapRAWReader* reader, SSnapDataHdr** pp
|
|||
|
||||
void* pBuf = taosMemoryCalloc(1, sizeof(SSnapDataHdr) + sizeof(STsdbDataRAWBlockHeader) + dataLength);
|
||||
if (pBuf == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
}
|
||||
SSnapDataHdr* pHdr = pBuf;
|
||||
|
@ -343,7 +343,7 @@ int32_t tsdbSnapRAWWriterOpen(STsdb* pTsdb, int64_t ever, STsdbSnapRAWWriter** w
|
|||
|
||||
// start to write
|
||||
writer[0] = taosMemoryCalloc(1, sizeof(*writer[0]));
|
||||
if (writer[0] == NULL) return TSDB_CODE_OUT_OF_MEMORY;
|
||||
if (writer[0] == NULL) return terrno;
|
||||
|
||||
writer[0]->tsdb = pTsdb;
|
||||
writer[0]->ever = ever;
|
||||
|
|
|
@ -41,7 +41,7 @@ int32_t tsdbSttFileReaderOpen(const char *fname, const SSttFileReaderConfig *con
|
|||
|
||||
reader[0] = taosMemoryCalloc(1, sizeof(*reader[0]));
|
||||
if (reader[0] == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit);
|
||||
TAOS_CHECK_GOTO(terrno, &lino, _exit);
|
||||
}
|
||||
|
||||
reader[0]->config[0] = config[0];
|
||||
|
@ -897,7 +897,7 @@ static int32_t tsdbSttFWriterCloseAbort(SSttFileWriter *writer) {
|
|||
int32_t tsdbSttFileWriterOpen(const SSttFileWriterConfig *config, SSttFileWriter **writer) {
|
||||
writer[0] = taosMemoryCalloc(1, sizeof(*writer[0]));
|
||||
if (writer[0] == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
writer[0]->config[0] = config[0];
|
||||
|
|
|
@ -326,7 +326,7 @@ static int32_t vnodeAsyncInit(SVAsync **async, const char *label) {
|
|||
|
||||
(*async) = (SVAsync *)taosMemoryCalloc(1, sizeof(SVAsync) + strlen(label) + 1);
|
||||
if ((*async) == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
strcpy((char *)((*async) + 1), label);
|
||||
|
@ -480,7 +480,7 @@ int32_t vnodeAsync(SVAChannelID *channelID, EVAPriority priority, int32_t (*exec
|
|||
// create task object
|
||||
SVATask *task = (SVATask *)taosMemoryCalloc(1, sizeof(SVATask));
|
||||
if (task == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
task->priority = priority;
|
||||
|
|
|
@ -372,7 +372,7 @@ int vnodeAsyncCommit(SVnode *pVnode) {
|
|||
|
||||
SCommitInfo *pInfo = (SCommitInfo *)taosMemoryCalloc(1, sizeof(*pInfo));
|
||||
if (NULL == pInfo) {
|
||||
TSDB_CHECK_CODE(code = TSDB_CODE_OUT_OF_MEMORY, lino, _exit);
|
||||
TSDB_CHECK_CODE(code = terrno, lino, _exit);
|
||||
}
|
||||
|
||||
// prepare to commit
|
||||
|
|
|
@ -27,7 +27,7 @@ struct SVHashEntry {
|
|||
static int32_t vHashRehash(SVHashTable* ht, uint32_t newNumBuckets) {
|
||||
SVHashEntry** newBuckets = (SVHashEntry**)taosMemoryCalloc(newNumBuckets, sizeof(SVHashEntry*));
|
||||
if (newBuckets == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
for (int32_t i = 0; i < ht->numBuckets; i++) {
|
||||
|
@ -65,7 +65,7 @@ int32_t vHashInit(SVHashTable** ht, uint32_t (*hash)(const void*), int32_t (*com
|
|||
(*ht)->buckets = (SVHashEntry**)taosMemoryCalloc((*ht)->numBuckets, sizeof(SVHashEntry*));
|
||||
if ((*ht)->buckets == NULL) {
|
||||
taosMemoryFree(*ht);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -118,7 +118,7 @@ int32_t vnodeGetTableMeta(SVnode *pVnode, SRpcMsg *pMsg, bool direct) {
|
|||
metaRsp.pSchemas = (SSchema *)taosMemoryMalloc(sizeof(SSchema) * (metaRsp.numOfColumns + metaRsp.numOfTags));
|
||||
metaRsp.pSchemaExt = (SSchemaExt *)taosMemoryCalloc(metaRsp.numOfColumns, sizeof(SSchemaExt));
|
||||
if (NULL == metaRsp.pSchemas || NULL == metaRsp.pSchemaExt) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _exit;
|
||||
}
|
||||
(void)memcpy(metaRsp.pSchemas, schema.pSchema, sizeof(SSchema) * schema.nCols);
|
||||
|
@ -150,7 +150,7 @@ int32_t vnodeGetTableMeta(SVnode *pVnode, SRpcMsg *pMsg, bool direct) {
|
|||
}
|
||||
|
||||
if (pRsp == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _exit;
|
||||
}
|
||||
|
||||
|
@ -309,7 +309,7 @@ int32_t vnodeGetTableCfg(SVnode *pVnode, SRpcMsg *pMsg, bool direct) {
|
|||
}
|
||||
|
||||
if (pRsp == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _exit;
|
||||
}
|
||||
|
||||
|
@ -869,7 +869,7 @@ int32_t vnodeGetStreamProgress(SVnode *pVnode, SRpcMsg *pMsg, bool direct) {
|
|||
buf = taosMemoryCalloc(1, rspLen);
|
||||
}
|
||||
if (!buf) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _OVER;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -166,7 +166,7 @@ int32_t vnodeSnapReaderOpen(SVnode *pVnode, SSnapshotParam *pParam, SVSnapReader
|
|||
|
||||
pReader = (SVSnapReader *)taosMemoryCalloc(1, sizeof(*pReader));
|
||||
if (pReader == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _exit;
|
||||
}
|
||||
pReader->pVnode = pVnode;
|
||||
|
@ -617,7 +617,7 @@ int32_t vnodeSnapWriterOpen(SVnode *pVnode, SSnapshotParam *pParam, SVSnapWriter
|
|||
// alloc
|
||||
pWriter = (SVSnapWriter *)taosMemoryCalloc(1, sizeof(*pWriter));
|
||||
if (pWriter == NULL) {
|
||||
TSDB_CHECK_CODE(code = TSDB_CODE_OUT_OF_MEMORY, lino, _exit);
|
||||
TSDB_CHECK_CODE(code = terrno, lino, _exit);
|
||||
}
|
||||
pWriter->pVnode = pVnode;
|
||||
pWriter->sver = sver;
|
||||
|
|
|
@ -1527,7 +1527,7 @@ static int32_t vnodeResetTableCxt(SMeta *pMeta, SSubmitReqConvertCxt *pCxt) {
|
|||
if (NULL == pCxt->pTbData) {
|
||||
pCxt->pTbData = taosMemoryCalloc(1, sizeof(SSubmitTbData));
|
||||
if (NULL == pCxt->pTbData) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
pCxt->pTbData->flags = 0;
|
||||
|
@ -1610,7 +1610,7 @@ static int32_t vnodeDecodeCreateTbReq(SSubmitReqConvertCxt *pCxt) {
|
|||
|
||||
pCxt->pTbData->pCreateTbReq = taosMemoryCalloc(1, sizeof(SVCreateTbReq));
|
||||
if (NULL == pCxt->pTbData->pCreateTbReq) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
SDecoder decoder = {0};
|
||||
|
|
|
@ -828,7 +828,7 @@ int32_t ctgInitJob(SCatalog* pCtg, SRequestConnInfo* pConn, SCtgJob** job, const
|
|||
|
||||
*job = taosMemoryCalloc(1, sizeof(SCtgJob));
|
||||
if (NULL == *job) {
|
||||
ctgError("failed to calloc, size:%d, qid:0x%" PRIx64, (int32_t)sizeof(SCtgJob), pConn->requestId);
|
||||
ctgError("failed to calloc, size:%d,QID:0x%" PRIx64, (int32_t)sizeof(SCtgJob), pConn->requestId);
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
}
|
||||
|
||||
|
|
|
@ -538,7 +538,7 @@ int32_t ctgAsyncSendMsg(SCatalog* pCtg, SRequestConnInfo* pConn, SCtgJob* pJob,
|
|||
CTG_ERR_JRET(code);
|
||||
}
|
||||
|
||||
ctgDebug("ctg req msg sent, qid:0x%" PRIx64 ", msg type:%d, %s", pJob->queryId, msgType, TMSG_INFO(msgType));
|
||||
ctgDebug("ctg req msg sent,QID:0x%" PRIx64 ", msg type:%d, %s", pJob->queryId, msgType, TMSG_INFO(msgType));
|
||||
return TSDB_CODE_SUCCESS;
|
||||
|
||||
_return:
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
|
||||
#define SET_RES_WINDOW_KEY(_k, _ori, _len, _uid) \
|
||||
do { \
|
||||
assert(sizeof(_uid) == sizeof(uint64_t)); \
|
||||
*(uint64_t*)(_k) = (_uid); \
|
||||
(void)memcpy((_k) + sizeof(uint64_t), (_ori), (_len)); \
|
||||
} while (0)
|
||||
|
|
|
@ -357,7 +357,6 @@ typedef struct SMJoinOperatorInfo {
|
|||
|
||||
#define MJOIN_PUSH_BLK_TO_CACHE(_cache, _blk) \
|
||||
do { \
|
||||
ASSERT(taosArrayGetSize((_cache)->grps) <= 1); \
|
||||
SMJoinGrpRows* pGrp = (SMJoinGrpRows*)taosArrayReserve((_cache)->grps, 1); \
|
||||
(_cache)->rowNum += (_blk)->info.rows; \
|
||||
pGrp->blk = (_blk); \
|
||||
|
@ -381,7 +380,6 @@ typedef struct SMJoinOperatorInfo {
|
|||
do { \
|
||||
SMJoinGrpRows* pGrp = taosArrayGet((_cache)->grps, 0); \
|
||||
if (NULL != pGrp) { \
|
||||
ASSERT(pGrp->blk == (_tb)->blk); \
|
||||
pGrp->beginIdx = (_tb)->blkRowIdx; \
|
||||
pGrp->readIdx = pGrp->beginIdx; \
|
||||
} \
|
||||
|
|
|
@ -27,11 +27,8 @@ typedef struct SOperatorCostInfo {
|
|||
|
||||
struct SOperatorInfo;
|
||||
|
||||
//typedef int32_t (*__optr_encode_fn_t)(struct SOperatorInfo* pOperator, char** result, int32_t* length);
|
||||
//typedef int32_t (*__optr_decode_fn_t)(struct SOperatorInfo* pOperator, char* result);
|
||||
|
||||
typedef int32_t (*__optr_open_fn_t)(struct SOperatorInfo* pOptr);
|
||||
typedef SSDataBlock* (*__optr_fn_t)(struct SOperatorInfo* pOptr);
|
||||
typedef int32_t (*__optr_fn_t)(struct SOperatorInfo* pOptr, SSDataBlock** pResBlock);
|
||||
typedef void (*__optr_close_fn_t)(void* param);
|
||||
typedef int32_t (*__optr_explain_fn_t)(struct SOperatorInfo* pOptr, void** pOptrExplain, uint32_t* len);
|
||||
typedef int32_t (*__optr_reqBuf_fn_t)(struct SOperatorInfo* pOptr);
|
||||
|
@ -185,6 +182,7 @@ int16_t getOperatorResultBlockId(struct SOperatorInfo* pOperator, int32_t
|
|||
int32_t createOperator(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo, SReadHandle* pHandle, SNode* pTagCond,
|
||||
SNode* pTagIndexCond, const char* pUser, const char* dbname, SOperatorInfo** pOptrInfo);
|
||||
void destroyOperator(SOperatorInfo* pOperator);
|
||||
void destroyOperatorAndDownstreams(SOperatorInfo* pOperator, SOperatorInfo** stream, int32_t num);
|
||||
|
||||
int32_t extractOperatorInTree(SOperatorInfo* pOperator, int32_t type, const char* id, SOperatorInfo** pOptrInfo);
|
||||
int32_t getTableScanInfo(SOperatorInfo* pOperator, int32_t* order, int32_t* scanFlag, bool inheritUsOrder);
|
||||
|
|
|
@ -56,9 +56,8 @@ static void setExecutionContext(SOperatorInfo* pOperator, int32_t numOfOutput, u
|
|||
static int32_t createDataBlockForEmptyInput(SOperatorInfo* pOperator, SSDataBlock** ppBlock);
|
||||
static void destroyDataBlockForEmptyInput(bool blockAllocated, SSDataBlock** ppBlock);
|
||||
|
||||
static int32_t doAggregateImpl(SOperatorInfo* pOperator, SqlFunctionCtx* pCtx);
|
||||
static SSDataBlock* getAggregateResult(SOperatorInfo* pOperator);
|
||||
|
||||
static int32_t doAggregateImpl(SOperatorInfo* pOperator, SqlFunctionCtx* pCtx);
|
||||
static int32_t getAggregateResultNext(SOperatorInfo* pOperator, SSDataBlock** ppRes);
|
||||
static int32_t doInitAggInfoSup(SAggSupporter* pAggSup, SqlFunctionCtx* pCtx, int32_t numOfOutput, size_t keyBufSize,
|
||||
const char* pKey);
|
||||
|
||||
|
@ -123,7 +122,7 @@ int32_t createAggregateOperatorInfo(SOperatorInfo* downstream, SAggPhysiNode* pA
|
|||
|
||||
setOperatorInfo(pOperator, "TableAggregate", QUERY_NODE_PHYSICAL_PLAN_HASH_AGG,
|
||||
!pAggNode->node.forceCreateNonBlockingOptr, OP_NOT_OPENED, pInfo, pTaskInfo);
|
||||
pOperator->fpSet = createOperatorFpSet(optrDummyOpenFn, getAggregateResult, NULL, destroyAggOperatorInfo,
|
||||
pOperator->fpSet = createOperatorFpSet(optrDummyOpenFn, getAggregateResultNext, NULL, destroyAggOperatorInfo,
|
||||
optrDefaultBufFn, NULL, optrDefaultGetNextExtFn, NULL);
|
||||
|
||||
if (downstream->operatorType == QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN) {
|
||||
|
@ -138,22 +137,14 @@ int32_t createAggregateOperatorInfo(SOperatorInfo* downstream, SAggPhysiNode* pA
|
|||
}
|
||||
|
||||
*pOptrInfo = pOperator;
|
||||
return code;
|
||||
return TSDB_CODE_SUCCESS;
|
||||
|
||||
_error:
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
qError("%s failed at line %d since %s", __func__, lino, tstrerror(code));
|
||||
}
|
||||
qError("%s failed at line %d since %s", __func__, lino, tstrerror(code));
|
||||
if (pInfo != NULL) {
|
||||
destroyAggOperatorInfo(pInfo);
|
||||
}
|
||||
if (pOperator != NULL) {
|
||||
pOperator->info = NULL;
|
||||
if (pOperator->pDownstream == NULL && downstream != NULL) {
|
||||
destroyOperator(downstream);
|
||||
}
|
||||
destroyOperator(pOperator);
|
||||
}
|
||||
destroyOperatorAndDownstreams(pOperator, &downstream, 1);
|
||||
pTaskInfo->code = code;
|
||||
return code;
|
||||
}
|
||||
|
@ -194,8 +185,9 @@ static bool nextGroupedResult(SOperatorInfo* pOperator) {
|
|||
pAggInfo->pNewGroupBlock = NULL;
|
||||
tSimpleHashClear(pAggInfo->aggSup.pResultRowHashTable);
|
||||
setExecutionContext(pOperator, pOperator->exprSupp.numOfExprs, pBlock->info.id.groupId);
|
||||
QUERY_CHECK_CODE(code, lino, _end);
|
||||
code = setInputDataBlock(pSup, pBlock, order, pBlock->info.scanFlag, true);
|
||||
QUERY_CHECK_CODE(code, lino, _end);
|
||||
|
||||
code = doAggregateImpl(pOperator, pSup->pCtx);
|
||||
QUERY_CHECK_CODE(code, lino, _end);
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ typedef struct SCacheRowsScanInfo {
|
|||
SColumnInfo pkCol;
|
||||
} SCacheRowsScanInfo;
|
||||
|
||||
static SSDataBlock* doScanCache(SOperatorInfo* pOperator);
|
||||
static int32_t doScanCacheNext(SOperatorInfo* pOperator, SSDataBlock** ppRes);
|
||||
static void destroyCacheScanOperator(void* param);
|
||||
static int32_t extractCacheScanSlotId(const SArray* pColMatchInfo, SExecTaskInfo* pTaskInfo, int32_t** pSlotIds,
|
||||
int32_t** pDstSlotIds);
|
||||
|
@ -235,7 +235,7 @@ int32_t createCacherowsScanOperator(SLastRowScanPhysiNode* pScanNode, SReadHandl
|
|||
pInfo, pTaskInfo);
|
||||
pOperator->exprSupp.numOfExprs = taosArrayGetSize(pInfo->pRes->pDataBlock);
|
||||
|
||||
pOperator->fpSet = createOperatorFpSet(optrDummyOpenFn, doScanCache, NULL, destroyCacheScanOperator, optrDefaultBufFn,
|
||||
pOperator->fpSet = createOperatorFpSet(optrDummyOpenFn, doScanCacheNext, NULL, destroyCacheScanOperator, optrDefaultBufFn,
|
||||
NULL, optrDefaultGetNextExtFn, NULL);
|
||||
|
||||
pOperator->cost.openCost = 0;
|
||||
|
@ -259,7 +259,7 @@ _error:
|
|||
return code;
|
||||
}
|
||||
|
||||
int32_t doScanCacheNext(SOperatorInfo* pOperator, SSDataBlock** ppRes) {
|
||||
static int32_t doScanCacheNext(SOperatorInfo* pOperator, SSDataBlock** ppRes) {
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
int32_t lino = 0;
|
||||
if (pOperator->status == OP_EXEC_DONE) {
|
||||
|
@ -445,12 +445,6 @@ _end:
|
|||
return code;
|
||||
}
|
||||
|
||||
static SSDataBlock* doScanCache(SOperatorInfo* pOperator) {
|
||||
SSDataBlock* pRes = NULL;
|
||||
int32_t code = doScanCacheNext(pOperator, &pRes);
|
||||
return pRes;
|
||||
}
|
||||
|
||||
void destroyCacheScanOperator(void* param) {
|
||||
SCacheRowsScanInfo* pInfo = (SCacheRowsScanInfo*)param;
|
||||
blockDataDestroy(pInfo->pRes);
|
||||
|
|
|
@ -64,6 +64,8 @@ void destroyCountWindowOperatorInfo(void* param) {
|
|||
taosMemoryFreeClear(param);
|
||||
}
|
||||
|
||||
static int32_t countWindowAggregateNext(SOperatorInfo* pOperator, SSDataBlock** ppRes);
|
||||
|
||||
static void clearWinStateBuff(SCountWindowResult* pBuff) { pBuff->winRows = 0; }
|
||||
|
||||
static SCountWindowResult* getCountWinStateInfo(SCountWindowSupp* pCountSup) {
|
||||
|
@ -227,7 +229,6 @@ static int32_t countWindowAggregateNext(SOperatorInfo* pOperator, SSDataBlock**
|
|||
SExprSupp* pExprSup = &pOperator->exprSupp;
|
||||
int32_t order = pInfo->binfo.inputTsOrder;
|
||||
SSDataBlock* pRes = pInfo->binfo.pRes;
|
||||
SOperatorInfo* downstream = pOperator->pDownstream[0];
|
||||
|
||||
blockDataCleanup(pRes);
|
||||
|
||||
|
@ -292,12 +293,6 @@ _end:
|
|||
return code;
|
||||
}
|
||||
|
||||
static SSDataBlock* countWindowAggregate(SOperatorInfo* pOperator) {
|
||||
SSDataBlock* pRes = NULL;
|
||||
int32_t code = countWindowAggregateNext(pOperator, &pRes);
|
||||
return pRes;
|
||||
}
|
||||
|
||||
int32_t createCountwindowOperatorInfo(SOperatorInfo* downstream, SPhysiNode* physiNode,
|
||||
SExecTaskInfo* pTaskInfo, SOperatorInfo** pOptrInfo) {
|
||||
QRY_OPTR_CHECK(pOptrInfo);
|
||||
|
@ -374,7 +369,7 @@ int32_t createCountwindowOperatorInfo(SOperatorInfo* downstream, SPhysiNode* phy
|
|||
|
||||
setOperatorInfo(pOperator, "CountWindowOperator", QUERY_NODE_PHYSICAL_PLAN_MERGE_COUNT, true, OP_NOT_OPENED, pInfo,
|
||||
pTaskInfo);
|
||||
pOperator->fpSet = createOperatorFpSet(optrDummyOpenFn, countWindowAggregate, NULL, destroyCountWindowOperatorInfo,
|
||||
pOperator->fpSet = createOperatorFpSet(optrDummyOpenFn, countWindowAggregateNext, NULL, destroyCountWindowOperatorInfo,
|
||||
optrDefaultBufFn, NULL, optrDefaultGetNextExtFn, NULL);
|
||||
|
||||
code = appendDownstream(pOperator, &downstream, 1);
|
||||
|
@ -383,20 +378,14 @@ int32_t createCountwindowOperatorInfo(SOperatorInfo* downstream, SPhysiNode* phy
|
|||
}
|
||||
|
||||
*pOptrInfo = pOperator;
|
||||
return code;
|
||||
return TSDB_CODE_SUCCESS;
|
||||
|
||||
_error:
|
||||
if (pInfo != NULL) {
|
||||
destroyCountWindowOperatorInfo(pInfo);
|
||||
}
|
||||
|
||||
if (pOperator != NULL) {
|
||||
pOperator->info = NULL;
|
||||
if (pOperator->pDownstream == NULL && downstream != NULL) {
|
||||
destroyOperator(downstream);
|
||||
}
|
||||
destroyOperator(pOperator);
|
||||
}
|
||||
destroyOperatorAndDownstreams(pOperator, &downstream, 1);
|
||||
pTaskInfo->code = code;
|
||||
return code;
|
||||
}
|
||||
|
|
|
@ -878,20 +878,20 @@ static int32_t seqJoinLaunchNewRetrieve(SOperatorInfo* pOperator, SSDataBlock**
|
|||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
static FORCE_INLINE SSDataBlock* seqStableJoinComposeRes(SStbJoinDynCtrlInfo* pStbJoin, SSDataBlock* pBlock) {
|
||||
pBlock->info.id.blockId = pStbJoin->outputBlkId;
|
||||
return pBlock;
|
||||
static FORCE_INLINE void seqStableJoinComposeRes(SStbJoinDynCtrlInfo* pStbJoin, SSDataBlock* pBlock) {
|
||||
if (pBlock != NULL) {
|
||||
pBlock->info.id.blockId = pStbJoin->outputBlkId;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
SSDataBlock* seqStableJoin(SOperatorInfo* pOperator) {
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
int32_t seqStableJoin(SOperatorInfo* pOperator, SSDataBlock** pRes) {
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
SDynQueryCtrlOperatorInfo* pInfo = pOperator->info;
|
||||
SStbJoinDynCtrlInfo* pStbJoin = (SStbJoinDynCtrlInfo*)&pInfo->stbJoin;
|
||||
SSDataBlock* pRes = NULL;
|
||||
|
||||
QRY_OPTR_CHECK(pRes);
|
||||
if (pOperator->status == OP_EXEC_DONE) {
|
||||
return pRes;
|
||||
return code;
|
||||
}
|
||||
|
||||
int64_t st = 0;
|
||||
|
@ -907,25 +907,24 @@ SSDataBlock* seqStableJoin(SOperatorInfo* pOperator) {
|
|||
}
|
||||
}
|
||||
|
||||
QRY_ERR_JRET(seqJoinContinueCurrRetrieve(pOperator, &pRes));
|
||||
if (pRes) {
|
||||
QRY_ERR_JRET(seqJoinContinueCurrRetrieve(pOperator, pRes));
|
||||
if (*pRes) {
|
||||
goto _return;
|
||||
}
|
||||
|
||||
QRY_ERR_JRET(seqJoinLaunchNewRetrieve(pOperator, &pRes));
|
||||
|
||||
QRY_ERR_JRET(seqJoinLaunchNewRetrieve(pOperator, pRes));
|
||||
|
||||
_return:
|
||||
|
||||
if (pOperator->cost.openCost == 0) {
|
||||
pOperator->cost.openCost = (taosGetTimestampUs() - st) / 1000.0;
|
||||
}
|
||||
|
||||
if (code) {
|
||||
pOperator->pTaskInfo->code = code;
|
||||
T_LONG_JMP(pOperator->pTaskInfo->env, pOperator->pTaskInfo->code);
|
||||
} else {
|
||||
seqStableJoinComposeRes(pStbJoin, *pRes);
|
||||
}
|
||||
|
||||
return pRes ? seqStableJoinComposeRes(pStbJoin, pRes) : NULL;
|
||||
return code;
|
||||
}
|
||||
|
||||
int32_t initSeqStbJoinTableHash(SStbJoinPrevJoinCtx* pPrev, bool batchFetch) {
|
||||
|
@ -1007,14 +1006,14 @@ int32_t createDynQueryCtrlOperatorInfo(SOperatorInfo** pDownstream, int32_t numO
|
|||
NULL, optrDefaultGetNextExtFn, NULL);
|
||||
|
||||
*pOptrInfo = pOperator;
|
||||
return code;
|
||||
return TSDB_CODE_SUCCESS;
|
||||
|
||||
_error:
|
||||
if (pInfo != NULL) {
|
||||
destroyDynQueryCtrlOperator(pInfo);
|
||||
}
|
||||
|
||||
taosMemoryFree(pOperator);
|
||||
destroyOperatorAndDownstreams(pOperator, pDownstream, numOfDownstream);
|
||||
pTaskInfo->code = code;
|
||||
return code;
|
||||
}
|
||||
|
|
|
@ -39,9 +39,9 @@ typedef struct SEventWindowOperatorInfo {
|
|||
SSDataBlock* pPreDataBlock;
|
||||
} SEventWindowOperatorInfo;
|
||||
|
||||
static SSDataBlock* eventWindowAggregate(SOperatorInfo* pOperator);
|
||||
static void destroyEWindowOperatorInfo(void* param);
|
||||
static int32_t eventWindowAggImpl(SOperatorInfo* pOperator, SEventWindowOperatorInfo* pInfo, SSDataBlock* pBlock);
|
||||
static int32_t eventWindowAggregateNext(SOperatorInfo* pOperator, SSDataBlock** pRes);
|
||||
static void destroyEWindowOperatorInfo(void* param);
|
||||
static int32_t eventWindowAggImpl(SOperatorInfo* pOperator, SEventWindowOperatorInfo* pInfo, SSDataBlock* pBlock);
|
||||
|
||||
// todo : move to util
|
||||
static void doKeepNewWindowStartInfo(SWindowRowsSup* pRowSup, const int64_t* tsList, int32_t rowIndex,
|
||||
|
@ -131,7 +131,7 @@ int32_t createEventwindowOperatorInfo(SOperatorInfo* downstream, SPhysiNode* phy
|
|||
|
||||
setOperatorInfo(pOperator, "EventWindowOperator", QUERY_NODE_PHYSICAL_PLAN_MERGE_STATE, true, OP_NOT_OPENED, pInfo,
|
||||
pTaskInfo);
|
||||
pOperator->fpSet = createOperatorFpSet(optrDummyOpenFn, eventWindowAggregate, NULL, destroyEWindowOperatorInfo,
|
||||
pOperator->fpSet = createOperatorFpSet(optrDummyOpenFn, eventWindowAggregateNext, NULL, destroyEWindowOperatorInfo,
|
||||
optrDefaultBufFn, NULL, optrDefaultGetNextExtFn, NULL);
|
||||
|
||||
code = appendDownstream(pOperator, &downstream, 1);
|
||||
|
@ -140,20 +140,14 @@ int32_t createEventwindowOperatorInfo(SOperatorInfo* downstream, SPhysiNode* phy
|
|||
}
|
||||
|
||||
*pOptrInfo = pOperator;
|
||||
return code;
|
||||
return TSDB_CODE_SUCCESS;
|
||||
|
||||
_error:
|
||||
if (pInfo != NULL) {
|
||||
destroyEWindowOperatorInfo(pInfo);
|
||||
}
|
||||
|
||||
if (pOperator != NULL) {
|
||||
pOperator->info = NULL;
|
||||
if (pOperator->pDownstream == NULL && downstream != NULL) {
|
||||
destroyOperator(downstream);
|
||||
}
|
||||
destroyOperator(pOperator);
|
||||
}
|
||||
destroyOperatorAndDownstreams(pOperator, &downstream, 1);
|
||||
pTaskInfo->code = code;
|
||||
return code;
|
||||
}
|
||||
|
@ -250,12 +244,6 @@ _end:
|
|||
return code;
|
||||
}
|
||||
|
||||
static SSDataBlock* eventWindowAggregate(SOperatorInfo* pOperator) {
|
||||
SSDataBlock* pRes = NULL;
|
||||
int32_t code = eventWindowAggregateNext(pOperator, &pRes);
|
||||
return pRes;
|
||||
}
|
||||
|
||||
static int32_t setSingleOutputTupleBufv1(SResultRowInfo* pResultRowInfo, STimeWindow* win, SResultRow** pResult,
|
||||
SExprSupp* pExprSup, SAggSupporter* pAggSup) {
|
||||
if (*pResult == NULL) {
|
||||
|
|
|
@ -305,12 +305,6 @@ _end:
|
|||
return code;
|
||||
}
|
||||
|
||||
static SSDataBlock* loadRemoteData(SOperatorInfo* pOperator) {
|
||||
SSDataBlock* pRes = NULL;
|
||||
int32_t code = loadRemoteDataNext(pOperator, &pRes);
|
||||
return pRes;
|
||||
}
|
||||
|
||||
static int32_t initDataSource(int32_t numOfSources, SExchangeInfo* pInfo, const char* id) {
|
||||
pInfo->pSourceDataInfo = taosArrayInit(numOfSources, sizeof(SSourceDataInfo));
|
||||
if (pInfo->pSourceDataInfo == NULL) {
|
||||
|
@ -447,10 +441,10 @@ int32_t createExchangeOperatorInfo(void* pTransporter, SExchangePhysiNode* pExNo
|
|||
code = filterInitFromNode((SNode*)pExNode->node.pConditions, &pOperator->exprSupp.pFilterInfo, 0);
|
||||
QUERY_CHECK_CODE(code, lino, _error);
|
||||
|
||||
pOperator->fpSet = createOperatorFpSet(prepareLoadRemoteData, loadRemoteData, NULL, destroyExchangeOperatorInfo,
|
||||
pOperator->fpSet = createOperatorFpSet(prepareLoadRemoteData, loadRemoteDataNext, NULL, destroyExchangeOperatorInfo,
|
||||
optrDefaultBufFn, NULL, optrDefaultGetNextExtFn, NULL);
|
||||
*pOptrInfo = pOperator;
|
||||
return code;
|
||||
return TSDB_CODE_SUCCESS;
|
||||
|
||||
_error:
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
|
@ -465,7 +459,6 @@ _error:
|
|||
pOperator->info = NULL;
|
||||
destroyOperator(pOperator);
|
||||
}
|
||||
pTaskInfo->code = code;
|
||||
return code;
|
||||
}
|
||||
|
||||
|
|
|
@ -1747,6 +1747,8 @@ static SColumn* createColumn(int32_t blockId, int32_t slotId, int32_t colId, SDa
|
|||
int32_t createExprFromOneNode(SExprInfo* pExp, SNode* pNode, int16_t slotId) {
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
int32_t lino = 0;
|
||||
pExp->base.numOfParams = 0;
|
||||
pExp->base.pParam = NULL;
|
||||
pExp->pExpr = taosMemoryCalloc(1, sizeof(tExprNode));
|
||||
QUERY_CHECK_NULL(pExp->pExpr, code, lino, _end, terrno);
|
||||
|
||||
|
@ -1787,6 +1789,7 @@ int32_t createExprFromOneNode(SExprInfo* pExp, SNode* pNode, int16_t slotId) {
|
|||
createResSchema(pType->type, pType->bytes, slotId, pType->scale, pType->precision, pValNode->node.aliasName);
|
||||
pExp->base.pParam[0].type = FUNC_PARAM_TYPE_VALUE;
|
||||
code = nodesValueNodeToVariant(pValNode, &pExp->base.pParam[0].param);
|
||||
QUERY_CHECK_CODE(code, lino, _end);
|
||||
} else if (type == QUERY_NODE_FUNCTION) {
|
||||
pExp->pExpr->nodeType = QUERY_NODE_FUNCTION;
|
||||
SFunctionNode* pFuncNode = (SFunctionNode*)pNode;
|
||||
|
|
|
@ -601,7 +601,7 @@ int32_t qCreateExecTask(SReadHandle* readHandle, int32_t vgId, uint64_t taskId,
|
|||
SExecTaskInfo** pTask = (SExecTaskInfo**)pTaskInfo;
|
||||
(void)taosThreadOnce(&initPoolOnce, initRefPool);
|
||||
|
||||
qDebug("start to create task, TID:0x%" PRIx64 " qid:0x%" PRIx64 ", vgId:%d", taskId, pSubplan->id.queryId, vgId);
|
||||
qDebug("start to create task, TID:0x%" PRIx64 "QID:0x%" PRIx64 ", vgId:%d", taskId, pSubplan->id.queryId, vgId);
|
||||
|
||||
int32_t code = createExecTaskInfo(pSubplan, pTask, readHandle, taskId, vgId, sql, model);
|
||||
if (code != TSDB_CODE_SUCCESS || NULL == *pTask) {
|
||||
|
@ -630,7 +630,7 @@ int32_t qCreateExecTask(SReadHandle* readHandle, int32_t vgId, uint64_t taskId,
|
|||
code = dsCreateDataSinker(pSinkManager, pSubplan->pDataSink, handle, pSinkParam, (*pTask)->id.str);
|
||||
}
|
||||
|
||||
qDebug("subplan task create completed, TID:0x%" PRIx64 " qid:0x%" PRIx64, taskId, pSubplan->id.queryId);
|
||||
qDebug("subplan task create completed, TID:0x%" PRIx64 "QID:0x%" PRIx64, taskId, pSubplan->id.queryId);
|
||||
|
||||
_error:
|
||||
// if failed to add ref for all tables in this query, abort current query
|
||||
|
@ -693,9 +693,11 @@ int32_t qExecTaskOpt(qTaskInfo_t tinfo, SArray* pResList, uint64_t* useconds, bo
|
|||
pTaskInfo->paramSet = true;
|
||||
code = pTaskInfo->pRoot->fpSet.getNextExtFn(pTaskInfo->pRoot, pTaskInfo->pOpParam, &pRes);
|
||||
} else {
|
||||
pRes = pTaskInfo->pRoot->fpSet.getNextFn(pTaskInfo->pRoot);
|
||||
code = pTaskInfo->pRoot->fpSet.getNextFn(pTaskInfo->pRoot, &pRes);
|
||||
}
|
||||
|
||||
QUERY_CHECK_CODE(code, lino, _end);
|
||||
|
||||
if (pRes == NULL) {
|
||||
st = taosGetTimestampUs();
|
||||
}
|
||||
|
@ -719,6 +721,7 @@ int32_t qExecTaskOpt(qTaskInfo_t tinfo, SArray* pResList, uint64_t* useconds, bo
|
|||
} else {
|
||||
void* tmp = taosArrayGet(pTaskInfo->pResultBlockList, blockIndex);
|
||||
QUERY_CHECK_NULL(tmp, code, lino, _end, terrno);
|
||||
|
||||
p = *(SSDataBlock**)tmp;
|
||||
code = copyDataBlock(p, pRes);
|
||||
QUERY_CHECK_CODE(code, lino, _end);
|
||||
|
@ -736,8 +739,10 @@ int32_t qExecTaskOpt(qTaskInfo_t tinfo, SArray* pResList, uint64_t* useconds, bo
|
|||
break;
|
||||
}
|
||||
|
||||
pRes = pTaskInfo->pRoot->fpSet.getNextFn(pTaskInfo->pRoot);
|
||||
code = pTaskInfo->pRoot->fpSet.getNextFn(pTaskInfo->pRoot, &pRes);
|
||||
QUERY_CHECK_CODE(code, lino, _end);
|
||||
}
|
||||
|
||||
if (pTaskInfo->pSubplan->dynamicRowThreshold) {
|
||||
pTaskInfo->pSubplan->rowsThreshold -= current;
|
||||
}
|
||||
|
@ -751,7 +756,6 @@ int32_t qExecTaskOpt(qTaskInfo_t tinfo, SArray* pResList, uint64_t* useconds, bo
|
|||
}
|
||||
|
||||
_end:
|
||||
|
||||
(void)cleanUpUdfs();
|
||||
|
||||
uint64_t total = pTaskInfo->pRoot->resultInfo.totalRows;
|
||||
|
@ -759,6 +763,11 @@ _end:
|
|||
GET_TASKID(pTaskInfo), current, (int32_t)taosArrayGetSize(pResList), total, 0, el / 1000.0);
|
||||
|
||||
atomic_store_64(&pTaskInfo->owner, 0);
|
||||
if (code) {
|
||||
pTaskInfo->code = code;
|
||||
qError("%s failed at line %d since %s", __func__, lino, tstrerror(code));
|
||||
}
|
||||
|
||||
return pTaskInfo->code;
|
||||
}
|
||||
|
||||
|
@ -779,9 +788,10 @@ void qCleanExecTaskBlockBuf(qTaskInfo_t tinfo) {
|
|||
int32_t qExecTask(qTaskInfo_t tinfo, SSDataBlock** pRes, uint64_t* useconds) {
|
||||
SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo;
|
||||
int64_t threadId = taosGetSelfPthreadId();
|
||||
int32_t lino = 0;
|
||||
int64_t curOwner = 0;
|
||||
|
||||
*pRes = NULL;
|
||||
int64_t curOwner = 0;
|
||||
|
||||
// todo extract method
|
||||
taosRLockLatch(&pTaskInfo->lock);
|
||||
|
@ -823,7 +833,12 @@ int32_t qExecTask(qTaskInfo_t tinfo, SSDataBlock** pRes, uint64_t* useconds) {
|
|||
|
||||
int64_t st = taosGetTimestampUs();
|
||||
|
||||
*pRes = pTaskInfo->pRoot->fpSet.getNextFn(pTaskInfo->pRoot);
|
||||
int32_t code = pTaskInfo->pRoot->fpSet.getNextFn(pTaskInfo->pRoot, pRes);
|
||||
if (code) {
|
||||
pTaskInfo->code = code;
|
||||
qError("%s failed at line %d, code:%s %s", __func__, lino, tstrerror(code), GET_TASKID(pTaskInfo));
|
||||
}
|
||||
|
||||
uint64_t el = (taosGetTimestampUs() - st);
|
||||
|
||||
pTaskInfo->cost.elapsedTime += el;
|
||||
|
@ -831,8 +846,7 @@ int32_t qExecTask(qTaskInfo_t tinfo, SSDataBlock** pRes, uint64_t* useconds) {
|
|||
*useconds = pTaskInfo->cost.elapsedTime;
|
||||
}
|
||||
|
||||
int32_t tmpRes = cleanUpUdfs();
|
||||
qTrace("%s at line %d res:%d", __func__, __LINE__, tmpRes);
|
||||
(void) cleanUpUdfs();
|
||||
|
||||
int32_t current = (*pRes != NULL) ? (*pRes)->info.rows : 0;
|
||||
uint64_t total = pTaskInfo->pRoot->resultInfo.totalRows;
|
||||
|
|
|
@ -1291,12 +1291,8 @@ FORCE_INLINE int32_t getNextBlockFromDownstreamImpl(struct SOperatorInfo* pOpera
|
|||
return code;
|
||||
}
|
||||
|
||||
*pResBlock = pOperator->pDownstream[idx]->fpSet.getNextFn(pOperator->pDownstream[idx]);
|
||||
if (*pResBlock == NULL && terrno != 0) {
|
||||
return terrno;
|
||||
} else {
|
||||
return code;
|
||||
}
|
||||
code = pOperator->pDownstream[idx]->fpSet.getNextFn(pOperator->pDownstream[idx], pResBlock);
|
||||
return code;
|
||||
}
|
||||
|
||||
bool compareVal(const char* v, const SStateKeys* pKey) {
|
||||
|
|
|
@ -318,12 +318,6 @@ static int32_t doFillNext(SOperatorInfo* pOperator, SSDataBlock** ppRes) {
|
|||
return code;
|
||||
}
|
||||
|
||||
static SSDataBlock* doFill(SOperatorInfo* pOperator) {
|
||||
SSDataBlock* pRes = NULL;
|
||||
int32_t code = doFillNext(pOperator, &pRes);
|
||||
return pRes;
|
||||
}
|
||||
|
||||
void destroyFillOperatorInfo(void* param) {
|
||||
SFillOperatorInfo* pInfo = (SFillOperatorInfo*)param;
|
||||
pInfo->pFillInfo = taosDestroyFillInfo(pInfo->pFillInfo);
|
||||
|
@ -513,27 +507,25 @@ int32_t createFillOperatorInfo(SOperatorInfo* downstream, SFillPhysiNode* pPhyFi
|
|||
}
|
||||
|
||||
setOperatorInfo(pOperator, "FillOperator", QUERY_NODE_PHYSICAL_PLAN_FILL, false, OP_NOT_OPENED, pInfo, pTaskInfo);
|
||||
pOperator->fpSet = createOperatorFpSet(optrDummyOpenFn, doFill, NULL, destroyFillOperatorInfo, optrDefaultBufFn, NULL,
|
||||
pOperator->fpSet = createOperatorFpSet(optrDummyOpenFn, doFillNext, NULL, destroyFillOperatorInfo, optrDefaultBufFn, NULL,
|
||||
optrDefaultGetNextExtFn, NULL);
|
||||
|
||||
code = appendDownstream(pOperator, &downstream, 1);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
goto _error;
|
||||
}
|
||||
|
||||
*pOptrInfo = pOperator;
|
||||
return code;
|
||||
return TSDB_CODE_SUCCESS;
|
||||
|
||||
_error:
|
||||
qError("%s failed at line %d since %s", __func__, lino, tstrerror(code));
|
||||
|
||||
if (pInfo != NULL) {
|
||||
destroyFillOperatorInfo(pInfo);
|
||||
}
|
||||
|
||||
destroyOperatorAndDownstreams(pOperator, &downstream, 1);
|
||||
pTaskInfo->code = code;
|
||||
if (pOperator != NULL) {
|
||||
pOperator->info = NULL;
|
||||
if (pOperator->pDownstream == NULL && downstream != NULL) {
|
||||
destroyOperator(downstream);
|
||||
}
|
||||
destroyOperator(pOperator);
|
||||
}
|
||||
return code;
|
||||
}
|
||||
|
||||
|
|
|
@ -692,39 +692,48 @@ _return:
|
|||
return code;
|
||||
}
|
||||
|
||||
static FORCE_INLINE int32_t getBlkFromDownstreamOperator(struct SOperatorInfo* pOperator, int32_t downstreamIdx, SSDataBlock** ppRes) {
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
SOperatorParam* pDownstreamParam = NULL;
|
||||
SSDataBlock* pBlock = NULL;
|
||||
static FORCE_INLINE int32_t getBlkFromDownstreamOperator(struct SOperatorInfo* pOperator, int32_t downstreamIdx,
|
||||
SSDataBlock** ppRes) {
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
SOperatorParam* pDownstreamParam = NULL;
|
||||
SSDataBlock* pBlock = NULL;
|
||||
SGroupCacheOperatorInfo* pGCache = pOperator->info;
|
||||
|
||||
code = appendNewGroupToDownstream(pOperator, downstreamIdx, &pDownstreamParam);
|
||||
if (code) {
|
||||
return code;
|
||||
}
|
||||
|
||||
SOperatorInfo* pDownstream = pOperator->pDownstream[downstreamIdx];
|
||||
if (pDownstreamParam) {
|
||||
code = pOperator->pDownstream[downstreamIdx]->fpSet.getNextExtFn(pOperator->pDownstream[downstreamIdx], pDownstreamParam, &pBlock);
|
||||
code = pDownstream->fpSet.getNextExtFn(pDownstream, pDownstreamParam, &pBlock);
|
||||
} else {
|
||||
pBlock = pOperator->pDownstream[downstreamIdx]->fpSet.getNextFn(pOperator->pDownstream[downstreamIdx]);
|
||||
code = pDownstream->fpSet.getNextFn(pDownstream, &pBlock);
|
||||
}
|
||||
|
||||
if (code) {
|
||||
qError("failed to get block from downstream, code:%s %s", tstrerror(code), GET_TASKID(pOperator->pTaskInfo));
|
||||
return code;
|
||||
}
|
||||
|
||||
if (pBlock) {
|
||||
qDebug("%s blk retrieved from group %" PRIu64, GET_TASKID(pOperator->pTaskInfo), pBlock->info.id.groupId);
|
||||
|
||||
qDebug("%s res block retrieved from group %" PRIu64, GET_TASKID(pOperator->pTaskInfo), pBlock->info.id.groupId);
|
||||
|
||||
pGCache->execInfo.pDownstreamBlkNum[downstreamIdx]++;
|
||||
if (NULL == pGCache->pDownstreams[downstreamIdx].pBaseBlock) {
|
||||
code = buildGroupCacheBaseBlock(&pGCache->pDownstreams[downstreamIdx].pBaseBlock, pBlock);
|
||||
if (code) {
|
||||
return code;
|
||||
}
|
||||
if (NULL == taosArrayPush(pGCache->pDownstreams[downstreamIdx].pFreeBlock, &pGCache->pDownstreams[downstreamIdx].pBaseBlock)) {
|
||||
|
||||
if (NULL == taosArrayPush(pGCache->pDownstreams[downstreamIdx].pFreeBlock,
|
||||
&pGCache->pDownstreams[downstreamIdx].pBaseBlock)) {
|
||||
QRY_ERR_RET(terrno);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*ppRes = pBlock;
|
||||
|
||||
return code;
|
||||
}
|
||||
|
||||
|
@ -1501,20 +1510,14 @@ int32_t createGroupCacheOperatorInfo(SOperatorInfo** pDownstream, int32_t numOfD
|
|||
qTrace("new group cache operator, maxCacheSize:%" PRId64 ", globalGrp:%d, batchFetch:%d", pInfo->maxCacheSize, pInfo->globalGrp, pInfo->batchFetch);
|
||||
|
||||
*pOptrInfo = pOperator;
|
||||
return code;
|
||||
return TSDB_CODE_SUCCESS;
|
||||
|
||||
_error:
|
||||
if (pInfo != NULL) {
|
||||
destroyGroupCacheOperator(pInfo);
|
||||
}
|
||||
|
||||
if (pOperator != NULL) {
|
||||
pOperator->info = NULL;
|
||||
if (pOperator->pDownstream == NULL && pDownstream != NULL && (*pDownstream) != NULL) {
|
||||
destroyOperator(*pDownstream);
|
||||
}
|
||||
destroyOperator(pOperator);
|
||||
}
|
||||
destroyOperatorAndDownstreams(pOperator, pDownstream, numOfDownstream);
|
||||
pTaskInfo->code = code;
|
||||
return code;
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue