Merge branch '3.0' into enh/3.0/TS-5007
This commit is contained in:
commit
a6e1af6b42
|
@ -131,7 +131,7 @@ IF(TD_WINDOWS)
|
|||
SET(COMMON_FLAGS "/w /D_WIN32 /DWIN32 /Zi /MTd")
|
||||
ENDIF()
|
||||
|
||||
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /MANIFEST:NO")
|
||||
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /MANIFEST:NO /FORCE:MULTIPLE")
|
||||
|
||||
# IF (MSVC AND (MSVC_VERSION GREATER_EQUAL 1900))
|
||||
# SET(COMMON_FLAGS "${COMMON_FLAGS} /Wv:18")
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# libuv
|
||||
ExternalProject_Add(libuv
|
||||
GIT_REPOSITORY https://github.com/libuv/libuv.git
|
||||
GIT_TAG v1.48.0
|
||||
GIT_TAG v1.49.2
|
||||
SOURCE_DIR "${TD_CONTRIB_DIR}/libuv"
|
||||
BINARY_DIR "${TD_CONTRIB_DIR}/libuv"
|
||||
CONFIGURE_COMMAND ""
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -73,6 +73,9 @@ After modifying configuration file parameters, you need to restart the *taosd* s
|
|||
|tagFilterCache | |Not supported |Whether to cache tag filter results|
|
||||
|queryBufferSize | |Supported, effective after restart|Not effective yet|
|
||||
|queryRspPolicy | |Supported, effective immediately |Query response strategy|
|
||||
|queryUseMemoryPool | |Not supported |Whether query will use memory pool to manage memory, default value: 1 (on); 0: off, 1: on|
|
||||
|minReservedMemorySize | |Not supported |The minimum reserved system available memory size, all memory except reserved can be used for queries, unit: MB, default reserved size is 20% of system physical memory, value range 1024-1000000000|
|
||||
|singleQueryMaxMemorySize| |Not supported |The memory limit that a single query can use on a single node (dnode), exceeding this limit will return an error, unit: MB, default value: 0 (no limit), value range 0-1000000000|
|
||||
|filterScalarMode | |Not supported |Force scalar filter mode, 0: off; 1: on, default value 0|
|
||||
|queryPlannerTrace | |Supported, effective immediately |Internal parameter, whether the query plan outputs detailed logs|
|
||||
|queryNodeChunkSize | |Supported, effective immediately |Internal parameter, chunk size of the query plan|
|
||||
|
|
|
@ -286,6 +286,9 @@ This document details the server error codes that may be encountered when using
|
|||
| 0x80000729 | Task message error | Query message error | Preserve the scene and logs, report issue on GitHub |
|
||||
| 0x8000072B | Task status error | Subquery status error | Preserve the scene and logs, report issue on GitHub |
|
||||
| 0x8000072F | Job not exist | Query JOB no longer exists | Preserve the scene and logs, report issue on GitHub |
|
||||
| 0x80000739 | Query memory upper limit is reached | Single query memory upper limit is reached | Modify memory upper limit size or optimize SQL |
|
||||
| 0x8000073A | Query memory exhausted | Query memory in dnode is exhausted | Limit concurrent queries or add more physical memory |
|
||||
| 0x8000073B | Timeout for long time no fetch | Query without fetch for a long time | Correct application to fetch data asap |
|
||||
|
||||
## grant
|
||||
|
||||
|
|
|
@ -69,6 +69,9 @@ taosd 命令行参数如下
|
|||
|tagFilterCache | |不支持动态修改 |是否缓存标签过滤结果|
|
||||
|queryBufferSize | |支持动态修改 重启生效 |暂不生效|
|
||||
|queryRspPolicy | |支持动态修改 立即生效 |查询响应策略|
|
||||
|queryUseMemoryPool | |不支持动态修改 |查询是否使用内存池管理内存,默认值:1(打开); 0: 关闭,1: 打开|
|
||||
|minReservedMemorySize | |不支持动态修改 |最小预留的系统可用内存数量,除预留外的内存都可以被用于查询,单位:MB,默认预留大小为系统物理内存的 20%,取值范围 1024 - 1000000000|
|
||||
|singleQueryMaxMemorySize| |不支持动态修改 |单个查询在单个节点(dnode)上可以使用的内存上限,超过该上限将返回错误,单位:MB,默认值:0(无上限),取值范围 0 - 1000000000|
|
||||
|filterScalarMode | |不支持动态修改 |强制使用标量过滤模式,0:关闭;1:开启,默认值 0|
|
||||
|queryPlannerTrace | |支持动态修改 立即生效 |内部参数,查询计划是否输出详细日志|
|
||||
|queryNodeChunkSize | |支持动态修改 立即生效 |内部参数,查询计划的块大小|
|
||||
|
|
|
@ -296,6 +296,9 @@ description: TDengine 服务端的错误码列表和详细说明
|
|||
| 0x80000729 | Task message error | 查询消息错误 | 保留现场和日志,github上报issue |
|
||||
| 0x8000072B | Task status error | 子查询状态错误 | 保留现场和日志,github上报issue |
|
||||
| 0x8000072F | Job not exist | 查询JOB已经不存在 | 保留现场和日志,github上报issue |
|
||||
| 0x80000739 | Query memory upper limit is reached | 单个查询达到内存使用上限 | 设置合理的内存上限或调整 SQL 语句 |
|
||||
| 0x8000073A | Query memory exhausted | dnode查询内存到达使用上限 | 设置合理的内存上限或调整并发查询量或增大系统内存 |
|
||||
| 0x8000073B | Timeout for long time no fetch | 查询被长时间中断未恢复 | 调整应用实现尽快 fetch 数据 |
|
||||
|
||||
## grant
|
||||
|
||||
|
|
|
@ -79,6 +79,18 @@ extern int32_t tsTagFilterResCacheSize;
|
|||
extern int32_t tsBypassFlag;
|
||||
|
||||
// queue & threads
|
||||
extern int32_t tsQueryMinConcurrentTaskNum;
|
||||
extern int32_t tsQueryMaxConcurrentTaskNum;
|
||||
extern int32_t tsQueryConcurrentTaskNum;
|
||||
extern int32_t tsSingleQueryMaxMemorySize;
|
||||
extern int8_t tsQueryUseMemoryPool;
|
||||
extern int8_t tsMemPoolFullFunc;
|
||||
//extern int32_t tsQueryBufferPoolSize;
|
||||
extern int32_t tsMinReservedMemorySize;
|
||||
extern int64_t tsCurrentAvailMemorySize;
|
||||
extern int8_t tsNeedTrim;
|
||||
extern int32_t tsQueryNoFetchTimeoutSec;
|
||||
extern int32_t tsNumOfQueryThreads;
|
||||
extern int32_t tsNumOfRpcThreads;
|
||||
extern int32_t tsNumOfRpcSessions;
|
||||
extern int32_t tsShareConnLimit;
|
||||
|
|
|
@ -2782,7 +2782,7 @@ int32_t tDeserializeSResFetchReq(void* buf, int32_t bufLen, SResFetchReq* pReq);
|
|||
|
||||
typedef struct {
|
||||
SMsgHead header;
|
||||
uint64_t sId;
|
||||
uint64_t clientId;
|
||||
} SSchTasksStatusReq;
|
||||
|
||||
typedef struct {
|
||||
|
@ -2812,7 +2812,7 @@ typedef struct SQueryNodeEpId {
|
|||
|
||||
typedef struct {
|
||||
SMsgHead header;
|
||||
uint64_t sId;
|
||||
uint64_t clientId;
|
||||
SQueryNodeEpId epId;
|
||||
SArray* taskAction; // SArray<STaskAction>
|
||||
} SSchedulerHbReq;
|
||||
|
|
|
@ -47,7 +47,7 @@ typedef int32_t (*GetQueueSizeFp)(void* pMgmt, int32_t vgId, EQueueType qtype);
|
|||
typedef int32_t (*SendReqFp)(const SEpSet* pEpSet, SRpcMsg* pMsg);
|
||||
typedef void (*SendRspFp)(SRpcMsg* pMsg);
|
||||
typedef void (*RegisterBrokenLinkArgFp)(struct SRpcMsg* pMsg);
|
||||
typedef void (*ReleaseHandleFp)(SRpcHandleInfo* pHandle, int8_t type);
|
||||
typedef void (*ReleaseHandleFp)(SRpcHandleInfo* pHandle, int8_t type, int32_t status);
|
||||
typedef void (*ReportStartup)(const char* name, const char* desc);
|
||||
|
||||
typedef struct {
|
||||
|
@ -76,7 +76,7 @@ int32_t tmsgSendReq(const SEpSet* epSet, SRpcMsg* pMsg);
|
|||
int32_t tmsgSendSyncReq(const SEpSet* epSet, SRpcMsg* pMsg);
|
||||
void tmsgSendRsp(SRpcMsg* pMsg);
|
||||
void tmsgRegisterBrokenLinkArg(SRpcMsg* pMsg);
|
||||
void tmsgReleaseHandle(SRpcHandleInfo* pHandle, int8_t type);
|
||||
void tmsgReleaseHandle(SRpcHandleInfo* pHandle, int8_t type, int32_t code);
|
||||
void tmsgReportStartup(const char* name, const char* desc);
|
||||
bool tmsgUpdateDnodeInfo(int32_t* dnodeId, int64_t* clusterId, char* fqdn, uint16_t* port);
|
||||
void tmsgUpdateDnodeEpSet(SEpSet* epset);
|
||||
|
|
|
@ -29,6 +29,9 @@ extern "C" {
|
|||
#define DS_BUF_FULL 2
|
||||
#define DS_BUF_EMPTY 3
|
||||
|
||||
#define DS_FLAG_USE_MEMPOOL (1 << 0)
|
||||
|
||||
|
||||
struct SSDataBlock;
|
||||
|
||||
typedef struct SDeleterRes {
|
||||
|
@ -84,7 +87,7 @@ typedef struct SOutputData {
|
|||
* @param pHandle output
|
||||
* @return error code
|
||||
*/
|
||||
int32_t dsCreateDataSinker(void* pSinkManager, const SDataSinkNode* pDataSink, DataSinkHandle* pHandle, void* pParam, const char* id);
|
||||
int32_t dsCreateDataSinker(void* pSinkManager, SDataSinkNode** ppDataSink, DataSinkHandle* pHandle, void* pParam, const char* id);
|
||||
|
||||
int32_t dsDataSinkGetCacheSize(SDataSinkStat* pStat);
|
||||
|
||||
|
@ -131,6 +134,9 @@ void dsScheduleProcess(void* ahandle, void* pItem);
|
|||
*/
|
||||
void dsDestroyDataSinker(DataSinkHandle handle);
|
||||
|
||||
int32_t dsGetSinkFlags(DataSinkHandle handle, uint64_t* pFlags);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -58,6 +58,7 @@ typedef struct {
|
|||
|
||||
struct SStorageAPI api;
|
||||
void* pWorkerCb;
|
||||
bool localExec;
|
||||
} SReadHandle;
|
||||
|
||||
// in queue mode, data streams are seperated by msg
|
||||
|
@ -167,6 +168,7 @@ int32_t qExecTaskOpt(qTaskInfo_t tinfo, SArray* pResList, uint64_t* useconds, bo
|
|||
|
||||
int32_t qExecTask(qTaskInfo_t tinfo, SSDataBlock** pBlock, uint64_t* useconds);
|
||||
|
||||
int32_t qExecutorInit(void);
|
||||
void qResetTaskCode(qTaskInfo_t tinfo);
|
||||
|
||||
void qCleanExecTaskBlockBuf(qTaskInfo_t tinfo);
|
||||
|
|
|
@ -631,7 +631,7 @@ typedef struct SDownstreamSourceNode {
|
|||
SQueryNodeAddr addr;
|
||||
uint64_t clientId;
|
||||
uint64_t taskId;
|
||||
uint64_t schedId;
|
||||
uint64_t sId;
|
||||
int32_t execId;
|
||||
int32_t fetchMsgType;
|
||||
bool localExec;
|
||||
|
|
|
@ -113,6 +113,11 @@ int32_t qWorkerProcessLocalFetch(void *pMgmt, uint64_t sId, uint64_t qId, uint64
|
|||
|
||||
int32_t qWorkerDbgEnableDebug(char *option);
|
||||
|
||||
void qWorkerRetireJob(uint64_t jobId, uint64_t clientId, int32_t errCode);
|
||||
|
||||
void qWorkerRetireJobs(int64_t retireSize, int32_t errCode);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -171,7 +171,7 @@ void *rpcReallocCont(void *ptr, int64_t contLen);
|
|||
int32_t rpcSendRequest(void *thandle, const SEpSet *pEpSet, SRpcMsg *pMsg, int64_t *rid);
|
||||
int32_t rpcSendResponse(const SRpcMsg *pMsg);
|
||||
int32_t rpcRegisterBrokenLinkArg(SRpcMsg *msg);
|
||||
int32_t rpcReleaseHandle(void *handle, int8_t type); // just release conn to rpc instance, no close sock
|
||||
int32_t rpcReleaseHandle(void *handle, int8_t type, int32_t code); // just release conn to rpc instance, no close sock
|
||||
|
||||
// These functions will not be called in the child process
|
||||
int32_t rpcSendRequestWithCtx(void *thandle, const SEpSet *pEpSet, SRpcMsg *pMsg, int64_t *rid, SRpcCtx *ctx);
|
||||
|
|
|
@ -110,6 +110,7 @@ extern "C" {
|
|||
#include "osLz4.h"
|
||||
#include "osMath.h"
|
||||
#include "osMemory.h"
|
||||
#include "osMemPool.h"
|
||||
#include "osRand.h"
|
||||
#include "osSemaphore.h"
|
||||
#include "osSignal.h"
|
||||
|
|
|
@ -0,0 +1,206 @@
|
|||
/*
|
||||
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
|
||||
*
|
||||
* This program is free software: you can use, redistribute, and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3
|
||||
* or later ("AGPL"), as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef _TD_OS_MEMPOOL_H_
|
||||
#define _TD_OS_MEMPOOL_H_
|
||||
|
||||
#include "os.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define MEMPOOL_MAX_CHUNK_SIZE (1 << 30)
|
||||
#define MEMPOOL_MIN_CHUNK_SIZE (1 << 20)
|
||||
|
||||
typedef enum MemPoolEvictPolicy {
|
||||
E_EVICT_ALL = 1,
|
||||
E_EVICT_NONE,
|
||||
E_EVICT_AUTO,
|
||||
E_EVICT_MAX_VALUE, // no used
|
||||
} MemPoolEvictPolicy;
|
||||
|
||||
typedef struct SMemPoolJob {
|
||||
uint64_t jobId;
|
||||
uint64_t clientId;
|
||||
|
||||
int32_t remainSession;
|
||||
|
||||
int64_t allocMemSize;
|
||||
int64_t maxAllocMemSize;
|
||||
} SMemPoolJob;
|
||||
|
||||
typedef struct SMPStatItem {
|
||||
int64_t inErr;
|
||||
int64_t exec;
|
||||
int64_t succ;
|
||||
int64_t fail;
|
||||
} SMPStatItem;
|
||||
|
||||
typedef struct SMPStatItemExt {
|
||||
int64_t inErr;
|
||||
int64_t exec;
|
||||
int64_t succ;
|
||||
int64_t fail;
|
||||
int64_t origExec;
|
||||
int64_t origSucc;
|
||||
int64_t origFail;
|
||||
} SMPStatItemExt;
|
||||
|
||||
typedef struct SMPMemoryStat {
|
||||
SMPStatItem memMalloc;
|
||||
SMPStatItem memCalloc;
|
||||
SMPStatItemExt memRealloc;
|
||||
SMPStatItem memStrdup;
|
||||
SMPStatItem memStrndup;
|
||||
SMPStatItem memFree;
|
||||
SMPStatItem memTrim;
|
||||
|
||||
SMPStatItem chunkMalloc;
|
||||
SMPStatItem chunkRecycle;
|
||||
SMPStatItem chunkReUse;
|
||||
SMPStatItem chunkFree;
|
||||
} SMPMemoryStat;
|
||||
|
||||
typedef struct SMPStatDetail {
|
||||
SMPMemoryStat times;
|
||||
SMPMemoryStat bytes;
|
||||
} SMPStatDetail;
|
||||
|
||||
|
||||
typedef void (*mpDecConcSessionNum)(void);
|
||||
typedef void (*mpIncConcSessionNum)(void);
|
||||
typedef void (*mpSetConcSessionNum)(int32_t);
|
||||
typedef void (*mpReserveFailFp)(int64_t, int32_t);
|
||||
typedef void (*mpReserveReachFp)(uint64_t, uint64_t, int32_t);
|
||||
typedef void (*mpCfgUpdate)(void*, void*);
|
||||
|
||||
typedef struct SMemPoolCallBack {
|
||||
//mpDecConcSessionNum decSessFp;
|
||||
//mpIncConcSessionNum incSessFp;
|
||||
//mpSetConcSessionNum setSessFp;
|
||||
mpReserveFailFp failFp;
|
||||
mpReserveReachFp reachFp;
|
||||
//mpCfgUpdate cfgUpdateFp;
|
||||
} SMemPoolCallBack;
|
||||
|
||||
|
||||
typedef struct SMemPoolCfg {
|
||||
//bool reserveMode;
|
||||
int64_t reserveSize;
|
||||
//int32_t *upperLimitSize; //MB
|
||||
//int64_t retireUnitSize;
|
||||
int32_t *jobQuota; //MB
|
||||
int32_t chunkSize;
|
||||
int32_t threadNum;
|
||||
MemPoolEvictPolicy evicPolicy;
|
||||
SMemPoolCallBack cb;
|
||||
} SMemPoolCfg;
|
||||
|
||||
#define MEMPOOL_GET_ALLOC_SIZE(_dstat) ((_dstat)->bytes.memMalloc.succ + (_dstat)->bytes.memCalloc.succ + (_dstat)->bytes.memRealloc.succ + (_dstat)->bytes.memStrdup.succ + (_dstat)->bytes.memStrndup.succ)
|
||||
#define MEMPOOL_GET_FREE_SIZE(_dstat) ((_dstat)->bytes.memRealloc.origSucc + (_dstat)->bytes.memFree.succ)
|
||||
#define MEMPOOL_GET_USED_SIZE(_dstat) (MEMPOOL_GET_ALLOC_SIZE(_dstat) - MEMPOOL_GET_FREE_SIZE(_dstat))
|
||||
|
||||
|
||||
int32_t taosMemPoolOpen(char* poolName, SMemPoolCfg* cfg, void** poolHandle);
|
||||
void *taosMemPoolMalloc(void* poolHandle, void* session, int64_t size, char* fileName, int32_t lineNo);
|
||||
void *taosMemPoolCalloc(void* poolHandle, void* session, int64_t num, int64_t size, char* fileName, int32_t lineNo);
|
||||
void *taosMemPoolRealloc(void* poolHandle, void* session, void *ptr, int64_t size, char* fileName, int32_t lineNo);
|
||||
char *taosMemPoolStrdup(void* poolHandle, void* session, const char *ptr, char* fileName, int32_t lineNo);
|
||||
char *taosMemPoolStrndup(void* poolHandle, void* session, const char *ptr, int64_t size, char* fileName, int32_t lineNo);
|
||||
void taosMemPoolFree(void* poolHandle, void* session, void *ptr, char* fileName, int32_t lineNo);
|
||||
int64_t taosMemPoolGetMemorySize(void* poolHandle, void* session, void *ptr, char* fileName, int32_t lineNo);
|
||||
int32_t taosMemPoolTrim(void* poolHandle, void* session, int32_t size, char* fileName, int32_t lineNo, bool* trimed);
|
||||
void *taosMemPoolMallocAlign(void* poolHandle, void* session, uint32_t alignment, int64_t size, char* fileName, int32_t lineNo);
|
||||
void taosMemPoolClose(void* poolHandle);
|
||||
void taosMemPoolModDestroy(void);
|
||||
void taosAutoMemoryFree(void *ptr);
|
||||
int32_t taosMemPoolInitSession(void* poolHandle, void** ppSession, void* pJob, char *sessionId);
|
||||
void taosMemPoolDestroySession(void* poolHandle, void* session);
|
||||
int32_t taosMemPoolCallocJob(uint64_t jobId, uint64_t cId, void** ppJob);
|
||||
void taosMemPoolCfgUpdate(void* poolHandle, SMemPoolCfg* pCfg);
|
||||
void taosMemPoolPrintStat(void* poolHandle, void* session, char* procName);
|
||||
int32_t taosMemPoolTryLockPool(void* poolHandle, bool readLock);
|
||||
void taosMemPoolUnLockPool(void* poolHandle, bool readLock);
|
||||
void taosMemPoolGetUsedSizeBegin(void* poolHandle, int64_t* usedSize, bool* needEnd);
|
||||
void taosMemPoolGetUsedSizeEnd(void* poolHandle);
|
||||
int32_t taosMemPoolGetSessionStat(void* session, SMPStatDetail** ppStat, int64_t* allocSize, int64_t* maxAllocSize);
|
||||
void taosMemPoolSchedTrim(void);
|
||||
int32_t taosMemoryPoolInit(mpReserveFailFp, mpReserveReachFp);
|
||||
|
||||
|
||||
#define taosMemPoolFreeClear(ptr) \
|
||||
do { \
|
||||
if (ptr) { \
|
||||
taosMemPoolFree((void *)ptr); \
|
||||
(ptr) = NULL; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
|
||||
#ifndef BUILD_TEST
|
||||
extern void* gMemPoolHandle;
|
||||
extern threadlocal void* threadPoolSession;
|
||||
extern threadlocal bool threadPoolEnabled;
|
||||
extern int8_t tsMemPoolFullFunc;
|
||||
|
||||
|
||||
#define taosEnableMemPoolUsage(_session) do { threadPoolSession = _session; tsEnableRandErr = true;} while (0)
|
||||
#define taosDisableMemPoolUsage() do { threadPoolSession = NULL; tsEnableRandErr = false;} while (0)
|
||||
|
||||
#define taosSaveDisableMemPoolUsage(_enable, _randErr) do { (_enable) = threadPoolEnabled; (_randErr) = tsEnableRandErr; threadPoolEnabled = false; tsEnableRandErr = false;} while (0)
|
||||
#define taosRestoreEnableMemPoolUsage(_enable, _randErr) do { threadPoolEnabled = (_enable); tsEnableRandErr = (_randErr);} while (0)
|
||||
|
||||
|
||||
#define taosMemoryMalloc(_size) ((threadPoolEnabled && threadPoolSession) ? (taosMemPoolMalloc(gMemPoolHandle, threadPoolSession, _size, (char*)__FILE__, __LINE__)) : (taosMemMalloc(_size)))
|
||||
#define taosMemoryCalloc(_num, _size) ((threadPoolEnabled && threadPoolSession) ? (taosMemPoolCalloc(gMemPoolHandle, threadPoolSession, _num, _size, (char*)__FILE__, __LINE__)) : (taosMemCalloc(_num, _size)))
|
||||
#define taosMemoryRealloc(_ptr, _size) ((threadPoolEnabled && threadPoolSession) ? (taosMemPoolRealloc(gMemPoolHandle, threadPoolSession, _ptr, _size, (char*)__FILE__, __LINE__)) : (taosMemRealloc(_ptr, _size)))
|
||||
#define taosStrdup(_ptr) ((threadPoolEnabled && threadPoolSession) ? (taosMemPoolStrdup(gMemPoolHandle, threadPoolSession, _ptr, (char*)__FILE__, __LINE__)) : (taosStrdupi(_ptr)))
|
||||
#define taosStrndup(_ptr, _size) ((threadPoolEnabled && threadPoolSession) ? (taosMemPoolStrndup(gMemPoolHandle, threadPoolSession, _ptr, _size, (char*)__FILE__, __LINE__)) : (taosStrndupi(_ptr, _size)))
|
||||
#define taosMemoryFree(_ptr) ((threadPoolEnabled && threadPoolSession) ? (taosMemPoolFree(gMemPoolHandle, threadPoolSession, _ptr, (char*)__FILE__, __LINE__)) : (taosMemFree(_ptr)))
|
||||
#define taosMemorySize(_ptr) ((threadPoolEnabled && threadPoolSession) ? (taosMemPoolGetMemorySize(gMemPoolHandle, threadPoolSession, _ptr, (char*)__FILE__, __LINE__)) : (taosMemSize(_ptr)))
|
||||
#define taosMemoryTrim(_size, _trimed) ((threadPoolEnabled && threadPoolSession) ? (taosMemPoolTrim(gMemPoolHandle, threadPoolSession, _size, (char*)__FILE__, __LINE__, _trimed)) : (taosMemTrim(_size, _trimed)))
|
||||
#define taosMemoryMallocAlign(_alignment, _size) ((threadPoolEnabled && threadPoolSession) ? (taosMemPoolMallocAlign(gMemPoolHandle, threadPoolSession, _alignment, _size, (char*)__FILE__, __LINE__)) : (taosMemMallocAlign(_alignment, _size)))
|
||||
#else
|
||||
#define taosEnableMemoryPoolUsage(_pool, _session)
|
||||
#define taosDisableMemoryPoolUsage()
|
||||
#define taosSaveDisableMemoryPoolUsage()
|
||||
#define taosRestoreEnableMemoryPoolUsage()
|
||||
|
||||
#define taosMemoryMalloc(_size) taosMemMalloc(_size)
|
||||
#define taosMemoryCalloc(_num, _size) taosMemCalloc(_num, _size)
|
||||
#define taosMemoryRealloc(_ptr, _size) taosMemRealloc(_ptr, _size)
|
||||
#define taosStrdup(_ptr) taosStrdupi(_ptr)
|
||||
#define taosStrndup(_ptr, _size) taosStrndupi(_ptr, _size)
|
||||
#define taosMemoryFree(_ptr) taosMemFree(_ptr)
|
||||
#define taosMemorySize(_ptr) taosMemSize(_ptr)
|
||||
#define taosMemoryTrim(_size, _trimed) taosMemTrim(_size, _trimed)
|
||||
#define taosMemoryMallocAlign(_alignment, _size) taosMemMallocAlign(_alignment, _size)
|
||||
|
||||
#endif
|
||||
|
||||
#define taosMemoryFreeClear(ptr) \
|
||||
do { \
|
||||
if (ptr) { \
|
||||
taosMemoryFree((void *)ptr); \
|
||||
(ptr) = NULL; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /*_TD_OS_MEMPOOL_H_*/
|
|
@ -36,35 +36,32 @@ extern "C" {
|
|||
#endif // ifndef ALLOW_FORBID_FUNC
|
||||
#endif // if !defined(WINDOWS)
|
||||
|
||||
// #define taosMemoryMalloc malloc
|
||||
// #define taosMemoryCalloc calloc
|
||||
// #define taosMemoryRealloc realloc
|
||||
// #define taosMemoryFree free
|
||||
|
||||
int32_t taosMemoryDbgInit();
|
||||
int32_t taosMemoryDbgInitRestore();
|
||||
void *taosMemoryMalloc(int64_t size);
|
||||
void *taosMemoryCalloc(int64_t num, int64_t size);
|
||||
void *taosMemoryRealloc(void *ptr, int64_t size);
|
||||
char *taosStrdup(const char *ptr);
|
||||
void taosMemoryFree(void *ptr);
|
||||
int64_t taosMemorySize(void *ptr);
|
||||
void *taosMemMalloc(int64_t size);
|
||||
void *taosMemCalloc(int64_t num, int64_t size);
|
||||
void *taosMemRealloc(void *ptr, int64_t size);
|
||||
char *taosStrdupi(const char *ptr);
|
||||
char *taosStrndupi(const char *ptr, int64_t size);
|
||||
void taosMemFree(void *ptr);
|
||||
int64_t taosMemSize(void *ptr);
|
||||
void taosPrintBackTrace();
|
||||
void taosMemoryTrim(int32_t size);
|
||||
void *taosMemoryMallocAlign(uint32_t alignment, int64_t size);
|
||||
int32_t taosMemTrim(int32_t size, bool* trimed);
|
||||
void *taosMemMallocAlign(uint32_t alignment, int64_t size);
|
||||
|
||||
#define TAOS_MEMSET(_s, _c, _n) ((void)memset(_s, _c, _n))
|
||||
#define TAOS_MEMCPY(_d, _s, _n) ((void)memcpy(_d, _s, _n))
|
||||
#define TAOS_MEMMOVE(_d, _s, _n) ((void)memmove(_d, _s, _n))
|
||||
|
||||
#define taosMemoryFreeClear(ptr) \
|
||||
#define taosMemFreeClear(ptr) \
|
||||
do { \
|
||||
if (ptr) { \
|
||||
taosMemoryFree((void *)ptr); \
|
||||
taosMemFree((void *)ptr); \
|
||||
(ptr) = NULL; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#include "osMemPool.h"
|
||||
#define TAOS_MEMORY_REALLOC(ptr, len) \
|
||||
do { \
|
||||
void *tmp = taosMemoryRealloc(ptr, (len)); \
|
||||
|
|
|
@ -84,6 +84,7 @@ int64_t tsnprintf(char *dst, int64_t size, const char *format, ...);
|
|||
#define TAOS_STRNCAT(_dst, _src, len) ((void)strncat(_dst, _src, len))
|
||||
|
||||
char *tstrdup(const char *src);
|
||||
char *tstrndup(const char *str, int64_t size);
|
||||
int32_t taosUcs4len(TdUcs4 *ucs4);
|
||||
int32_t taosStr2int64(const char *str, int64_t *val);
|
||||
int32_t taosStr2int32(const char *str, int32_t *val);
|
||||
|
@ -126,7 +127,6 @@ double taosStr2Double(const char *str, char **pEnd);
|
|||
float taosStr2Float(const char *str, char **pEnd);
|
||||
int32_t taosHex2Ascii(const char *z, uint32_t n, void **data, uint32_t *size);
|
||||
int32_t taosAscii2Hex(const char *z, uint32_t n, void **data, uint32_t *size);
|
||||
char *taosStrndup(const char *s, int n);
|
||||
// int32_t taosBin2Ascii(const char *z, uint32_t n, void** data, uint32_t* size);
|
||||
bool isHex(const char *z, uint32_t n);
|
||||
bool isValidateHex(const char *z, uint32_t n);
|
||||
|
|
|
@ -45,6 +45,7 @@ int32_t taosGetCpuInstructions(char* sse42, char* avx, char* avx2, char* fma, ch
|
|||
int32_t taosGetTotalMemory(int64_t *totalKB);
|
||||
int32_t taosGetProcMemory(int64_t *usedKB);
|
||||
int32_t taosGetSysMemory(int64_t *usedKB);
|
||||
int32_t taosGetSysAvailMemory(int64_t *availSize);
|
||||
int32_t taosGetDiskSize(char *dataDir, SDiskSize *diskSize);
|
||||
int32_t taosGetProcIODelta(int64_t *rchars, int64_t *wchars, int64_t *read_bytes, int64_t *write_bytes);
|
||||
void taosSetDefaultProcIODelta(int64_t *rchars, int64_t *wchars, int64_t *read_bytes, int64_t *write_bytes);
|
||||
|
|
|
@ -645,6 +645,9 @@ int32_t taosGetErrSize();
|
|||
#define TSDB_CODE_QRY_FILTER_RANGE_ERROR TAOS_DEF_ERROR_CODE(0, 0x0736)
|
||||
#define TSDB_CODE_QRY_FILTER_INVALID_TYPE TAOS_DEF_ERROR_CODE(0, 0x0737)
|
||||
#define TSDB_CODE_QRY_TASK_SUCC_TO_PARTSUSS TAOS_DEF_ERROR_CODE(0, 0x0738)
|
||||
#define TSDB_CODE_QRY_REACH_QMEM_THRESHOLD TAOS_DEF_ERROR_CODE(0, 0x0739)
|
||||
#define TSDB_CODE_QRY_QUERY_MEM_EXHAUSTED TAOS_DEF_ERROR_CODE(0, 0x073A)
|
||||
#define TSDB_CODE_QRY_NO_FETCH_TIMEOUT TAOS_DEF_ERROR_CODE(0, 0x073B)
|
||||
|
||||
// grant
|
||||
#define TSDB_CODE_GRANT_EXPIRED TAOS_DEF_ERROR_CODE(0, 0x0800)
|
||||
|
|
|
@ -136,6 +136,7 @@ void cfgUnLock(SConfig *pCfg);
|
|||
// clang-format off
|
||||
int32_t cfgAddBool(SConfig *pCfg, const char *name, bool defaultVal, int8_t scope, int8_t dynScope,int8_t category);
|
||||
int32_t cfgAddInt32(SConfig *pCfg, const char *name, int32_t defaultVal, int64_t minval, int64_t maxval, int8_t scope, int8_t dynScope,int8_t category);
|
||||
int32_t cfgAddInt32Ex(SConfig *pCfg, const char *name, int32_t defaultVal, int64_t minval, int64_t maxval, int8_t scope, int8_t dynScope,int8_t category);
|
||||
int32_t cfgAddInt64(SConfig *pCfg, const char *name, int64_t defaultVal, int64_t minval, int64_t maxval, int8_t scope, int8_t dynScope,int8_t category);
|
||||
int32_t cfgAddFloat(SConfig *pCfg, const char *name, float defaultVal, float minval, float maxval, int8_t scope, int8_t dynScope,int8_t category);
|
||||
int32_t cfgAddString(SConfig *pCfg, const char *name, const char *defaultVal, int8_t scope, int8_t dynScope,int8_t category);
|
||||
|
|
|
@ -655,6 +655,8 @@ typedef enum {
|
|||
ANAL_ALGO_TYPE_END,
|
||||
} EAnalAlgoType;
|
||||
|
||||
#define MIN_RESERVE_MEM_SIZE 1024 // MB
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -87,6 +87,8 @@ BoundedQueue* createBoundedQueue(uint32_t maxSize, pq_comp_fn fn, FDelete delete
|
|||
|
||||
void taosBQSetFn(BoundedQueue* q, pq_comp_fn fn);
|
||||
|
||||
void taosBQClear(BoundedQueue* q);
|
||||
|
||||
void destroyBoundedQueue(BoundedQueue* q);
|
||||
|
||||
/*
|
||||
|
|
|
@ -72,6 +72,7 @@ void taosInitRWLatch(SRWLatch *pLatch);
|
|||
void taosWLockLatch(SRWLatch *pLatch);
|
||||
void taosWUnLockLatch(SRWLatch *pLatch);
|
||||
void taosRLockLatch(SRWLatch *pLatch);
|
||||
int32_t taosRTryLockLatch(SRWLatch *pLatch);
|
||||
void taosRUnLockLatch(SRWLatch *pLatch);
|
||||
int32_t taosWTryLockLatch(SRWLatch *pLatch);
|
||||
|
||||
|
|
|
@ -77,6 +77,7 @@ int32_t taosInitLog(const char *logName, int32_t maxFiles, bool tsc);
|
|||
void taosCloseLog();
|
||||
void taosResetLog();
|
||||
void taosDumpData(uint8_t *msg, int32_t len);
|
||||
void taosSetNoNewFile();
|
||||
|
||||
void taosPrintLog(const char *flags, int32_t level, int32_t dflag, const char *format, ...)
|
||||
#ifdef __GNUC__
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
|
||||
*
|
||||
* This program is free software: you can use, redistribute, and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3
|
||||
* or later ("AGPL"), as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef _TD_UTIL_MEMPOOL_H_
|
||||
#define _TD_UTIL_MEMPOOL_H_
|
||||
|
||||
#include "os.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef void *mpool_h;
|
||||
|
||||
mpool_h taosMemPoolInit(int32_t maxNum, int32_t blockSize);
|
||||
char *taosMemPoolMalloc(mpool_h handle);
|
||||
void taosMemPoolFree(mpool_h handle, char *p);
|
||||
void taosMemPoolCleanUp(mpool_h handle);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /*_TD_UTIL_MEMPOOL_H_*/
|
|
@ -50,7 +50,7 @@ typedef struct SDiskbasedBufStatis {
|
|||
* @param handle
|
||||
* @return
|
||||
*/
|
||||
int32_t createDiskbasedBuf(SDiskbasedBuf** pBuf, int32_t pagesize, int32_t inMemBufSize, const char* id,
|
||||
int32_t createDiskbasedBuf(SDiskbasedBuf** pBuf, int32_t pagesize, int64_t inMemBufSize, const char* id,
|
||||
const char* dir);
|
||||
|
||||
/**
|
||||
|
|
|
@ -39,6 +39,8 @@ bool taosTmrStop(tmr_h tmrId);
|
|||
|
||||
bool taosTmrStopA(tmr_h *tmrId);
|
||||
|
||||
bool taosTmrIsStopped(tmr_h* timerId);
|
||||
|
||||
bool taosTmrReset(TAOS_TMR_CALLBACK fp, int32_t mseconds, void *param, void *handle, tmr_h *pTmrId);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -689,7 +689,7 @@ void doDestroyRequest(void *p) {
|
|||
SRequestObj *pRequest = (SRequestObj *)p;
|
||||
|
||||
uint64_t reqId = pRequest->requestId;
|
||||
tscTrace("begin to destroy request %" PRIx64 " p:%p", reqId, pRequest);
|
||||
tscDebug("begin to destroy request 0x%" PRIx64 " p:%p", reqId, pRequest);
|
||||
|
||||
int64_t nextReqRefId = pRequest->relation.nextRefId;
|
||||
|
||||
|
@ -731,7 +731,7 @@ void doDestroyRequest(void *p) {
|
|||
taosMemoryFreeClear(pRequest->effectiveUser);
|
||||
taosMemoryFreeClear(pRequest->sqlstr);
|
||||
taosMemoryFree(pRequest);
|
||||
tscTrace("end to destroy request %" PRIx64 " p:%p", reqId, pRequest);
|
||||
tscDebug("end to destroy request %" PRIx64 " p:%p", reqId, pRequest);
|
||||
destroyNextReq(nextReqRefId);
|
||||
}
|
||||
|
||||
|
@ -955,7 +955,7 @@ void taos_init_imp(void) {
|
|||
taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), true, HASH_ENTRY_LOCK);
|
||||
if (NULL == appInfo.pInstMap || NULL == appInfo.pInstMapByClusterId) {
|
||||
(void)printf("failed to allocate memory when init appInfo\n");
|
||||
tscInitRes = TSDB_CODE_OUT_OF_MEMORY;
|
||||
tscInitRes = terrno;
|
||||
return;
|
||||
}
|
||||
taosHashSetFreeFp(appInfo.pInstMap, destroyAppInst);
|
||||
|
|
|
@ -595,6 +595,7 @@ static int32_t hbAsyncCallBack(void *param, SDataBuf *pMsg, int32_t code) {
|
|||
}
|
||||
|
||||
SAppInstInfo *pInst = pAppHbMgr->pAppInstInfo;
|
||||
|
||||
if (code != 0) {
|
||||
pInst->onlineDnodes = pInst->totalDnodes ? 0 : -1;
|
||||
tscDebug("hb rsp error %s, update server status %d/%d", tstrerror(code), pInst->onlineDnodes, pInst->totalDnodes);
|
||||
|
@ -1338,7 +1339,6 @@ static void *hbThreadFunc(void *param) {
|
|||
}
|
||||
void *buf = taosMemoryMalloc(tlen);
|
||||
if (buf == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
tFreeClientHbBatchReq(pReq);
|
||||
// hbClearReqInfo(pAppHbMgr);
|
||||
break;
|
||||
|
@ -1352,7 +1352,6 @@ static void *hbThreadFunc(void *param) {
|
|||
SMsgSendInfo *pInfo = taosMemoryCalloc(1, sizeof(SMsgSendInfo));
|
||||
|
||||
if (pInfo == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
tFreeClientHbBatchReq(pReq);
|
||||
// hbClearReqInfo(pAppHbMgr);
|
||||
taosMemoryFree(buf);
|
||||
|
@ -1364,7 +1363,6 @@ static void *hbThreadFunc(void *param) {
|
|||
pInfo->msgType = TDMT_MND_HEARTBEAT;
|
||||
pInfo->param = taosMemoryMalloc(sizeof(int32_t));
|
||||
if (pInfo->param == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
tFreeClientHbBatchReq(pReq);
|
||||
// hbClearReqInfo(pAppHbMgr);
|
||||
taosMemoryFree(buf);
|
||||
|
@ -1372,7 +1370,7 @@ static void *hbThreadFunc(void *param) {
|
|||
break;
|
||||
}
|
||||
*(int32_t *)pInfo->param = i;
|
||||
pInfo->paramFreeFp = taosMemoryFree;
|
||||
pInfo->paramFreeFp = taosAutoMemoryFree;
|
||||
pInfo->requestId = generateRequestId();
|
||||
pInfo->requestObjRefId = 0;
|
||||
|
||||
|
@ -1458,7 +1456,7 @@ int32_t appHbMgrInit(SAppInstInfo *pAppInstInfo, char *key, SAppHbMgr **pAppHbMg
|
|||
(*pAppHbMgr)->reportBytes = 0;
|
||||
(*pAppHbMgr)->key = taosStrdup(key);
|
||||
if ((*pAppHbMgr)->key == NULL) {
|
||||
TSC_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TSC_ERR_JRET(terrno);
|
||||
}
|
||||
|
||||
// init app info
|
||||
|
|
|
@ -126,7 +126,7 @@ int32_t taos_connect_internal(const char* ip, const char* user, const char* pass
|
|||
|
||||
char* key = getClusterKey(user, secretEncrypt, ip, port);
|
||||
if (NULL == key) {
|
||||
TSC_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TSC_ERR_RET(terrno);
|
||||
}
|
||||
tscInfo("connecting to server, numOfEps:%d inUse:%d user:%s db:%s key:%s", epSet.epSet.numOfEps, epSet.epSet.inUse,
|
||||
user, db, key);
|
||||
|
@ -1820,11 +1820,10 @@ int32_t doProcessMsgFromServerImpl(SRpcMsg* pMsg, SEpSet* pEpSet) {
|
|||
.handleRefId = pMsg->info.refId,
|
||||
.pEpSet = pEpSet};
|
||||
|
||||
if (pMsg->code != TSDB_CODE_OUT_OF_MEMORY && pMsg->contLen > 0) {
|
||||
if (pMsg->contLen > 0) {
|
||||
buf.pData = taosMemoryCalloc(1, pMsg->contLen);
|
||||
if (buf.pData == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
pMsg->code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
pMsg->code = terrno;
|
||||
} else {
|
||||
(void)memcpy(buf.pData, pMsg->pCont, pMsg->contLen);
|
||||
}
|
||||
|
@ -2957,7 +2956,6 @@ TAOS_RES* taosQueryImpl(TAOS* taos, const char* sql, bool validateOnly, int8_t s
|
|||
|
||||
SSyncQueryParam* param = taosMemoryCalloc(1, sizeof(SSyncQueryParam));
|
||||
if (NULL == param) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return NULL;
|
||||
}
|
||||
int32_t code = tsem_init(¶m->sem, 0, 0);
|
||||
|
@ -2998,7 +2996,6 @@ TAOS_RES* taosQueryImplWithReqid(TAOS* taos, const char* sql, bool validateOnly,
|
|||
|
||||
SSyncQueryParam* param = taosMemoryCalloc(1, sizeof(SSyncQueryParam));
|
||||
if (param == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return NULL;
|
||||
}
|
||||
int32_t code = tsem_init(¶m->sem, 0, 0);
|
||||
|
|
|
@ -292,7 +292,6 @@ TAOS *taos_connect(const char *ip, const char *user, const char *pass, const cha
|
|||
int64_t *rid = taosMemoryCalloc(1, sizeof(int64_t));
|
||||
if (NULL == rid) {
|
||||
tscError("out of memory when taos connect to %s:%u, user:%s db:%s", ip, port, user, db);
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return NULL;
|
||||
}
|
||||
*rid = pObj->id;
|
||||
|
@ -424,7 +423,7 @@ void taos_fetch_whitelist_a(TAOS *taos, __taos_async_whitelist_fn_t fp, void *pa
|
|||
|
||||
void *pReq = taosMemoryMalloc(msgLen);
|
||||
if (pReq == NULL) {
|
||||
fp(param, TSDB_CODE_OUT_OF_MEMORY, taos, 0, NULL);
|
||||
fp(param, terrno, taos, 0, NULL);
|
||||
releaseTscObj(connId);
|
||||
return;
|
||||
}
|
||||
|
@ -438,7 +437,7 @@ void taos_fetch_whitelist_a(TAOS *taos, __taos_async_whitelist_fn_t fp, void *pa
|
|||
|
||||
SFetchWhiteListInfo *pParam = taosMemoryMalloc(sizeof(SFetchWhiteListInfo));
|
||||
if (pParam == NULL) {
|
||||
fp(param, TSDB_CODE_OUT_OF_MEMORY, taos, 0, NULL);
|
||||
fp(param, terrno, taos, 0, NULL);
|
||||
taosMemoryFree(pReq);
|
||||
releaseTscObj(connId);
|
||||
return;
|
||||
|
@ -449,7 +448,7 @@ void taos_fetch_whitelist_a(TAOS *taos, __taos_async_whitelist_fn_t fp, void *pa
|
|||
pParam->userParam = param;
|
||||
SMsgSendInfo *pSendInfo = taosMemoryCalloc(1, sizeof(SMsgSendInfo));
|
||||
if (pSendInfo == NULL) {
|
||||
fp(param, TSDB_CODE_OUT_OF_MEMORY, taos, 0, NULL);
|
||||
fp(param, terrno, taos, 0, NULL);
|
||||
taosMemoryFree(pParam);
|
||||
taosMemoryFree(pReq);
|
||||
releaseTscObj(connId);
|
||||
|
|
|
@ -1348,7 +1348,7 @@ end:
|
|||
destroyRequest(pRequest);
|
||||
tDecoderClear(&coder);
|
||||
qDestroyQuery(pQuery);
|
||||
taosArrayDestroyP(pTagList, taosMemoryFree);
|
||||
taosArrayDestroyP(pTagList, NULL);
|
||||
return code;
|
||||
}
|
||||
|
||||
|
@ -1563,7 +1563,7 @@ static int32_t taosAlterTable(TAOS* taos, void* meta, int32_t metaLen) {
|
|||
req.source = TD_REQ_FROM_TAOX;
|
||||
tEncodeSize(tEncodeSVAlterTbReq, &req, tlen, code);
|
||||
if (code != 0) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto end;
|
||||
}
|
||||
tlen += sizeof(SMsgHead);
|
||||
|
@ -1577,7 +1577,7 @@ static int32_t taosAlterTable(TAOS* taos, void* meta, int32_t metaLen) {
|
|||
code = tEncodeSVAlterTbReq(&coder, &req);
|
||||
if (code != 0) {
|
||||
tEncoderClear(&coder);
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto end;
|
||||
}
|
||||
tEncoderClear(&coder);
|
||||
|
|
|
@ -444,7 +444,7 @@ int32_t smlParseEndLine(SSmlHandle *info, SSmlLineInfo *elements, SSmlKv *kvTs)
|
|||
}
|
||||
|
||||
clearColValArraySml(info->currTableDataCtx->pValues);
|
||||
taosArrayClearP(info->escapedStringList, taosMemoryFree);
|
||||
taosArrayClearP(info->escapedStringList, NULL);
|
||||
if (unlikely(ret != TSDB_CODE_SUCCESS)) {
|
||||
uError("SML:0x%" PRIx64 " %s smlBuildCol error:%d", info->id, __FUNCTION__, ret);
|
||||
return ret;
|
||||
|
@ -1270,7 +1270,7 @@ void smlDestroyInfo(SSmlHandle *info) {
|
|||
taosArrayDestroy(info->valueJsonArray);
|
||||
|
||||
taosArrayDestroyEx(info->preLineTagKV, freeSSmlKv);
|
||||
taosArrayDestroyP(info->escapedStringList, taosMemoryFree);
|
||||
taosArrayDestroyP(info->escapedStringList, NULL);
|
||||
|
||||
if (!info->dataFormat) {
|
||||
for (int i = 0; i < info->lineNum; i++) {
|
||||
|
@ -1536,7 +1536,7 @@ int32_t smlClearForRerun(SSmlHandle *info) {
|
|||
SML_CHECK_NULL(info->lines);
|
||||
}
|
||||
|
||||
taosArrayClearP(info->escapedStringList, taosMemoryFree);
|
||||
taosArrayClearP(info->escapedStringList, NULL);
|
||||
if(info->protocol == TSDB_SML_JSON_PROTOCOL) {
|
||||
taosMemoryFreeClear(info->preLine.tags);
|
||||
}
|
||||
|
|
|
@ -134,7 +134,7 @@ int32_t smlParseValue(SSmlKv *pVal, SSmlMsgBuf *msg) {
|
|||
void* data = NULL;
|
||||
uint32_t size = 0;
|
||||
if(taosHex2Ascii(pVal->value + NCHAR_ADD_LEN - 1, pVal->length - NCHAR_ADD_LEN, &data, &size) < 0){
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
if (size + VARSTR_HEADER_SIZE > TSDB_MAX_VARBINARY_LEN) {
|
||||
|
|
|
@ -300,7 +300,7 @@ int32_t stmtCacheBlock(STscStmt* pStmt) {
|
|||
|
||||
STableDataCxt** pSrc = taosHashGet(pStmt->exec.pBlockHash, pStmt->bInfo.tbFName, strlen(pStmt->bInfo.tbFName));
|
||||
if (!pSrc) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
STableDataCxt* pDst = NULL;
|
||||
|
||||
|
@ -355,7 +355,7 @@ int32_t stmtParseSql(STscStmt* pStmt) {
|
|||
STableDataCxt** pSrc =
|
||||
(STableDataCxt**)taosHashGet(pStmt->exec.pBlockHash, pStmt->bInfo.tbFName, strlen(pStmt->bInfo.tbFName));
|
||||
if (NULL == pSrc || NULL == *pSrc) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
STableDataCxt* pTableCtx = *pSrc;
|
||||
|
@ -845,13 +845,11 @@ TAOS_STMT* stmtInit(STscObj* taos, int64_t reqid, TAOS_STMT_OPTIONS* pOptions) {
|
|||
|
||||
pStmt = taosMemoryCalloc(1, sizeof(STscStmt));
|
||||
if (NULL == pStmt) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pStmt->sql.pTableCache = taosHashInit(100, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_NO_LOCK);
|
||||
if (NULL == pStmt->sql.pTableCache) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
taosMemoryFree(pStmt);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -876,13 +874,11 @@ TAOS_STMT* stmtInit(STscObj* taos, int64_t reqid, TAOS_STMT_OPTIONS* pOptions) {
|
|||
pStmt->sql.siInfo.mgmtEpSet = getEpSet_s(&pStmt->taos->pAppInfo->mgmtEp);
|
||||
pStmt->sql.siInfo.pTableHash = tSimpleHashInit(100, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY));
|
||||
if (NULL == pStmt->sql.siInfo.pTableHash) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
(void)stmtClose(pStmt);
|
||||
return NULL;
|
||||
}
|
||||
pStmt->sql.siInfo.pTableCols = taosArrayInit(STMT_TABLE_COLS_NUM, POINTER_BYTES);
|
||||
if (NULL == pStmt->sql.siInfo.pTableCols) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
(void)stmtClose(pStmt);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -948,7 +944,7 @@ int stmtPrepare(TAOS_STMT* stmt, const char* sql, unsigned long length) {
|
|||
int32_t stmtInitStbInterlaceTableInfo(STscStmt* pStmt) {
|
||||
STableDataCxt** pSrc = taosHashGet(pStmt->exec.pBlockHash, pStmt->bInfo.tbFName, strlen(pStmt->bInfo.tbFName));
|
||||
if (!pSrc) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
STableDataCxt* pDst = NULL;
|
||||
|
||||
|
|
|
@ -275,7 +275,7 @@ static int32_t stmtParseSql(STscStmt2* pStmt) {
|
|||
STableDataCxt** pSrc =
|
||||
(STableDataCxt**)taosHashGet(pStmt->exec.pBlockHash, pStmt->bInfo.tbFName, strlen(pStmt->bInfo.tbFName));
|
||||
if (NULL == pSrc || NULL == *pSrc) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
STableDataCxt* pTableCtx = *pSrc;
|
||||
|
@ -295,7 +295,7 @@ static int32_t stmtParseSql(STscStmt2* pStmt) {
|
|||
if (NULL == pStmt->sql.pBindInfo) {
|
||||
pStmt->sql.pBindInfo = taosMemoryMalloc(pTableCtx->boundColsInfo.numOfBound * sizeof(*pStmt->sql.pBindInfo));
|
||||
if (NULL == pStmt->sql.pBindInfo) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -540,7 +540,7 @@ static int32_t stmtGetFromCache(STscStmt2* pStmt) {
|
|||
|
||||
if (taosHashPut(pStmt->exec.pBlockHash, pStmt->bInfo.tbFName, strlen(pStmt->bInfo.tbFName), &pNewBlock,
|
||||
POINTER_BYTES)) {
|
||||
STMT_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
STMT_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
pStmt->exec.pCurrBlock = pNewBlock;
|
||||
|
@ -630,7 +630,7 @@ static int32_t stmtGetFromCache(STscStmt2* pStmt) {
|
|||
|
||||
if (taosHashPut(pStmt->exec.pBlockHash, pStmt->bInfo.tbFName, strlen(pStmt->bInfo.tbFName), &pNewBlock,
|
||||
POINTER_BYTES)) {
|
||||
STMT_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
STMT_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
pStmt->exec.pCurrBlock = pNewBlock;
|
||||
|
@ -766,13 +766,11 @@ TAOS_STMT2* stmtInit2(STscObj* taos, TAOS_STMT2_OPTION* pOptions) {
|
|||
|
||||
pStmt = taosMemoryCalloc(1, sizeof(STscStmt2));
|
||||
if (NULL == pStmt) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pStmt->sql.pTableCache = taosHashInit(100, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_NO_LOCK);
|
||||
if (NULL == pStmt->sql.pTableCache) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
taosMemoryFree(pStmt);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -798,7 +796,6 @@ TAOS_STMT2* stmtInit2(STscObj* taos, TAOS_STMT2_OPTION* pOptions) {
|
|||
pStmt->sql.siInfo.mgmtEpSet = getEpSet_s(&pStmt->taos->pAppInfo->mgmtEp);
|
||||
pStmt->sql.siInfo.pTableHash = tSimpleHashInit(100, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY));
|
||||
if (NULL == pStmt->sql.siInfo.pTableHash) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
(void)stmtClose(pStmt);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -894,7 +891,7 @@ int stmtPrepare2(TAOS_STMT2* stmt, const char* sql, unsigned long length) {
|
|||
static int32_t stmtInitStbInterlaceTableInfo(STscStmt2* pStmt) {
|
||||
STableDataCxt** pSrc = taosHashGet(pStmt->exec.pBlockHash, pStmt->bInfo.tbFName, strlen(pStmt->bInfo.tbFName));
|
||||
if (!pSrc) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
STableDataCxt* pDst = NULL;
|
||||
|
||||
|
@ -1199,7 +1196,7 @@ static int32_t stmtCacheBlock(STscStmt2* pStmt) {
|
|||
|
||||
STableDataCxt** pSrc = taosHashGet(pStmt->exec.pBlockHash, pStmt->bInfo.tbFName, strlen(pStmt->bInfo.tbFName));
|
||||
if (!pSrc) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
STableDataCxt* pDst = NULL;
|
||||
|
||||
|
@ -1266,7 +1263,7 @@ static int32_t stmtBackupQueryFields(STscStmt2* pStmt) {
|
|||
pRes->fields = taosMemoryMalloc(size);
|
||||
pRes->userFields = taosMemoryMalloc(size);
|
||||
if (NULL == pRes->fields || NULL == pRes->userFields) {
|
||||
STMT_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
STMT_ERR_RET(terrno);
|
||||
}
|
||||
(void)memcpy(pRes->fields, pStmt->exec.pRequest->body.resInfo.fields, size);
|
||||
(void)memcpy(pRes->userFields, pStmt->exec.pRequest->body.resInfo.userFields, size);
|
||||
|
@ -1284,7 +1281,7 @@ static int32_t stmtRestoreQueryFields(STscStmt2* pStmt) {
|
|||
if (NULL == pStmt->exec.pRequest->body.resInfo.fields) {
|
||||
pStmt->exec.pRequest->body.resInfo.fields = taosMemoryMalloc(size);
|
||||
if (NULL == pStmt->exec.pRequest->body.resInfo.fields) {
|
||||
STMT_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
STMT_ERR_RET(terrno);
|
||||
}
|
||||
(void)memcpy(pStmt->exec.pRequest->body.resInfo.fields, pRes->fields, size);
|
||||
}
|
||||
|
@ -1292,7 +1289,7 @@ static int32_t stmtRestoreQueryFields(STscStmt2* pStmt) {
|
|||
if (NULL == pStmt->exec.pRequest->body.resInfo.userFields) {
|
||||
pStmt->exec.pRequest->body.resInfo.userFields = taosMemoryMalloc(size);
|
||||
if (NULL == pStmt->exec.pRequest->body.resInfo.userFields) {
|
||||
STMT_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
STMT_ERR_RET(terrno);
|
||||
}
|
||||
(void)memcpy(pStmt->exec.pRequest->body.resInfo.userFields, pRes->userFields, size);
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
tDecoderInit(&decoder, POINTER_SHIFT(pMsg->pData, sizeof(SMqRspHead)), pMsg->len - sizeof(SMqRspHead)); \
|
||||
if (FUNC(&decoder, DATA) < 0) { \
|
||||
tDecoderClear(&decoder); \
|
||||
code = TSDB_CODE_OUT_OF_MEMORY; \
|
||||
code = terrno; \
|
||||
goto END;\
|
||||
}\
|
||||
tDecoderClear(&decoder);\
|
||||
|
@ -534,7 +534,7 @@ int32_t tmq_list_append(tmq_list_t* list, const char* src) {
|
|||
void tmq_list_destroy(tmq_list_t* list) {
|
||||
if (list == NULL) return;
|
||||
SArray* container = &list->container;
|
||||
taosArrayDestroyP(container, taosMemoryFree);
|
||||
taosArrayDestroyP(container, NULL);
|
||||
}
|
||||
|
||||
int32_t tmq_list_get_size(const tmq_list_t* list) {
|
||||
|
@ -659,7 +659,7 @@ static int32_t doSendCommitMsg(tmq_t* tmq, int32_t vgId, SEpSet* epSet, STqOffse
|
|||
pMsgSendInfo->requestId = generateRequestId();
|
||||
pMsgSendInfo->requestObjRefId = 0;
|
||||
pMsgSendInfo->param = pParam;
|
||||
pMsgSendInfo->paramFreeFp = taosMemoryFree;
|
||||
pMsgSendInfo->paramFreeFp = taosAutoMemoryFree;
|
||||
pMsgSendInfo->fp = tmqCommitCb;
|
||||
pMsgSendInfo->msgType = TDMT_VND_TMQ_COMMIT_OFFSET;
|
||||
|
||||
|
@ -1385,7 +1385,7 @@ static int32_t askEp(tmq_t* pTmq, void* param, bool sync, bool updateEpSet) {
|
|||
sendInfo->requestId = generateRequestId();
|
||||
sendInfo->requestObjRefId = 0;
|
||||
sendInfo->param = pParam;
|
||||
sendInfo->paramFreeFp = taosMemoryFree;
|
||||
sendInfo->paramFreeFp = taosAutoMemoryFree;
|
||||
sendInfo->fp = askEpCb;
|
||||
sendInfo->msgType = TDMT_MND_TMQ_ASK_EP;
|
||||
|
||||
|
@ -1552,7 +1552,7 @@ static void tmqMgmtInit(void) {
|
|||
tmqMgmt.timer = taosTmrInit(1000, 100, 360000, "TMQ");
|
||||
|
||||
if (tmqMgmt.timer == NULL) {
|
||||
tmqInitRes = TSDB_CODE_OUT_OF_MEMORY;
|
||||
tmqInitRes = terrno;
|
||||
}
|
||||
|
||||
tmqMgmt.rsetId = taosOpenRef(10000, tmqFreeImpl);
|
||||
|
@ -1886,7 +1886,7 @@ int32_t tmq_subscribe(tmq_t* tmq, const tmq_list_t* topic_list) {
|
|||
}
|
||||
|
||||
END:
|
||||
taosArrayDestroyP(req.topicNames, taosMemoryFree);
|
||||
taosArrayDestroyP(req.topicNames, NULL);
|
||||
return code;
|
||||
}
|
||||
|
||||
|
@ -2177,7 +2177,7 @@ static int32_t doTmqPollImpl(tmq_t* pTmq, SMqClientTopic* pTopic, SMqClientVg* p
|
|||
sendInfo->requestId = req.reqId;
|
||||
sendInfo->requestObjRefId = 0;
|
||||
sendInfo->param = pParam;
|
||||
sendInfo->paramFreeFp = taosMemoryFree;
|
||||
sendInfo->paramFreeFp = taosAutoMemoryFree;
|
||||
sendInfo->fp = tmqPollCb;
|
||||
sendInfo->msgType = TDMT_VND_TMQ_CONSUME;
|
||||
|
||||
|
@ -2520,7 +2520,7 @@ int32_t tmq_unsubscribe(tmq_t* tmq) {
|
|||
|
||||
tmq_list_t* lst = tmq_list_new();
|
||||
if (lst == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto END;
|
||||
}
|
||||
code = tmq_subscribe(tmq, lst);
|
||||
|
@ -2701,10 +2701,12 @@ int32_t tmq_commit_sync(tmq_t* tmq, const TAOS_RES* pRes) {
|
|||
tqErrorC("failed to allocate memory for sync commit");
|
||||
return terrno;
|
||||
}
|
||||
if (tsem2_init(&pInfo->sem, 0, 0) != 0) {
|
||||
|
||||
code = tsem2_init(&pInfo->sem, 0, 0);
|
||||
if (code != 0) {
|
||||
tqErrorC("failed to init sem for sync commit");
|
||||
taosMemoryFree(pInfo);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return code;
|
||||
}
|
||||
pInfo->code = 0;
|
||||
|
||||
|
@ -2778,9 +2780,10 @@ int32_t tmq_commit_offset_sync(tmq_t* tmq, const char* pTopicName, int32_t vgId,
|
|||
return terrno;
|
||||
}
|
||||
|
||||
if (tsem2_init(&pInfo->sem, 0, 0) != 0) {
|
||||
code = tsem2_init(&pInfo->sem, 0, 0);
|
||||
if (code != 0) {
|
||||
taosMemoryFree(pInfo);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return code;
|
||||
}
|
||||
pInfo->code = 0;
|
||||
|
||||
|
@ -2847,6 +2850,7 @@ end:
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
int32_t tmqGetNextResInfo(TAOS_RES* res, bool convertUcs4, SReqResultInfo** pResInfo) {
|
||||
SMqRspObj* pRspObj = (SMqRspObj*)res;
|
||||
SMqDataRsp* data = &pRspObj->dataRsp;
|
||||
|
@ -2966,9 +2970,10 @@ static int32_t tmCommittedCb(void* param, SDataBuf* pMsg, int32_t code) {
|
|||
if (pMsg) {
|
||||
SDecoder decoder = {0};
|
||||
tDecoderInit(&decoder, (uint8_t*)pMsg->pData, pMsg->len);
|
||||
if (tDecodeMqVgOffset(&decoder, &pParam->vgOffset) < 0) {
|
||||
int32_t err = tDecodeMqVgOffset(&decoder, &pParam->vgOffset);
|
||||
if (err < 0) {
|
||||
tOffsetDestroy(&pParam->vgOffset.offset);
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = err;
|
||||
goto end;
|
||||
}
|
||||
tDecoderClear(&decoder);
|
||||
|
@ -3261,8 +3266,9 @@ int32_t tmq_get_topic_assignment(tmq_t* tmq, const char* pTopicName, tmq_topic_a
|
|||
code = terrno;
|
||||
goto end;
|
||||
}
|
||||
if (tsem2_init(&pCommon->rsp, 0, 0) != 0) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
|
||||
code = tsem2_init(&pCommon->rsp, 0, 0);
|
||||
if (code != 0) {
|
||||
goto end;
|
||||
}
|
||||
(void)taosThreadMutexInit(&pCommon->mutex, 0);
|
||||
|
@ -3296,7 +3302,7 @@ int32_t tmq_get_topic_assignment(tmq_t* tmq, const char* pTopicName, tmq_topic_a
|
|||
int32_t msgSize = tSerializeSMqPollReq(NULL, 0, &req);
|
||||
if (msgSize < 0) {
|
||||
taosMemoryFree(pParam);
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = msgSize;
|
||||
goto end;
|
||||
}
|
||||
|
||||
|
@ -3307,10 +3313,11 @@ int32_t tmq_get_topic_assignment(tmq_t* tmq, const char* pTopicName, tmq_topic_a
|
|||
goto end;
|
||||
}
|
||||
|
||||
if (tSerializeSMqPollReq(msg, msgSize, &req) < 0) {
|
||||
msgSize = tSerializeSMqPollReq(msg, msgSize, &req);
|
||||
if (msgSize < 0) {
|
||||
taosMemoryFree(msg);
|
||||
taosMemoryFree(pParam);
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = msgSize;
|
||||
goto end;
|
||||
}
|
||||
|
||||
|
@ -3326,7 +3333,7 @@ int32_t tmq_get_topic_assignment(tmq_t* tmq, const char* pTopicName, tmq_topic_a
|
|||
sendInfo->requestId = req.reqId;
|
||||
sendInfo->requestObjRefId = 0;
|
||||
sendInfo->param = pParam;
|
||||
sendInfo->paramFreeFp = taosMemoryFree;
|
||||
sendInfo->paramFreeFp = taosAutoMemoryFree;
|
||||
sendInfo->fp = tmqGetWalInfoCb;
|
||||
sendInfo->msgType = TDMT_VND_TMQ_VG_WALINFO;
|
||||
|
||||
|
|
|
@ -403,7 +403,7 @@ _exit:
|
|||
}
|
||||
|
||||
void tCleanupStreamDispatchReq(SStreamDispatchReq* pReq) {
|
||||
taosArrayDestroyP(pReq->data, taosMemoryFree);
|
||||
taosArrayDestroyP(pReq->data, NULL);
|
||||
taosArrayDestroy(pReq->dataLen);
|
||||
}
|
||||
|
||||
|
|
|
@ -9393,7 +9393,7 @@ int32_t tSerializeSSchedulerHbReq(void *buf, int32_t bufLen, SSchedulerHbReq *pR
|
|||
tEncoderInit(&encoder, buf, bufLen);
|
||||
|
||||
TAOS_CHECK_EXIT(tStartEncode(&encoder));
|
||||
TAOS_CHECK_EXIT(tEncodeU64(&encoder, pReq->sId));
|
||||
TAOS_CHECK_EXIT(tEncodeU64(&encoder, pReq->clientId));
|
||||
TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->epId.nodeId));
|
||||
TAOS_CHECK_EXIT(tEncodeU16(&encoder, pReq->epId.ep.port));
|
||||
TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->epId.ep.fqdn));
|
||||
|
@ -9440,7 +9440,7 @@ int32_t tDeserializeSSchedulerHbReq(void *buf, int32_t bufLen, SSchedulerHbReq *
|
|||
tDecoderInit(&decoder, (char *)buf + headLen, bufLen - headLen);
|
||||
|
||||
TAOS_CHECK_EXIT(tStartDecode(&decoder));
|
||||
TAOS_CHECK_EXIT(tDecodeU64(&decoder, &pReq->sId));
|
||||
TAOS_CHECK_EXIT(tDecodeU64(&decoder, &pReq->clientId));
|
||||
TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->epId.nodeId));
|
||||
TAOS_CHECK_EXIT(tDecodeU16(&decoder, &pReq->epId.ep.port));
|
||||
TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->epId.ep.fqdn));
|
||||
|
@ -11350,11 +11350,11 @@ int32_t tDecodeMqDataRsp(SDecoder *pDecoder, SMqDataRsp *pRsp) {
|
|||
static void tDeleteMqDataRspCommon(SMqDataRsp *pRsp) {
|
||||
taosArrayDestroy(pRsp->blockDataLen);
|
||||
pRsp->blockDataLen = NULL;
|
||||
taosArrayDestroyP(pRsp->blockData, (FDelete)taosMemoryFree);
|
||||
taosArrayDestroyP(pRsp->blockData, NULL);
|
||||
pRsp->blockData = NULL;
|
||||
taosArrayDestroyP(pRsp->blockSchema, (FDelete)tDeleteSchemaWrapper);
|
||||
pRsp->blockSchema = NULL;
|
||||
taosArrayDestroyP(pRsp->blockTbName, (FDelete)taosMemoryFree);
|
||||
taosArrayDestroyP(pRsp->blockTbName, NULL);
|
||||
pRsp->blockTbName = NULL;
|
||||
tOffsetDestroy(&pRsp->reqOffset);
|
||||
tOffsetDestroy(&pRsp->rspOffset);
|
||||
|
@ -11416,7 +11416,7 @@ void tDeleteSTaosxRsp(SMqDataRsp *pRsp) {
|
|||
|
||||
taosArrayDestroy(pRsp->createTableLen);
|
||||
pRsp->createTableLen = NULL;
|
||||
taosArrayDestroyP(pRsp->createTableReq, (FDelete)taosMemoryFree);
|
||||
taosArrayDestroyP(pRsp->createTableReq, NULL);
|
||||
pRsp->createTableReq = NULL;
|
||||
}
|
||||
|
||||
|
@ -12975,7 +12975,7 @@ _exit:
|
|||
|
||||
void tDeleteMqBatchMetaRsp(SMqBatchMetaRsp *pRsp) {
|
||||
taosMemoryFreeClear(pRsp->pMetaBuff);
|
||||
taosArrayDestroyP(pRsp->batchMetaReq, taosMemoryFree);
|
||||
taosArrayDestroyP(pRsp->batchMetaReq, NULL);
|
||||
taosArrayDestroy(pRsp->batchMetaLen);
|
||||
pRsp->batchMetaReq = NULL;
|
||||
pRsp->batchMetaLen = NULL;
|
||||
|
|
|
@ -63,13 +63,28 @@ char tsEncryptKey[17] = {0};
|
|||
int32_t tsMaxShellConns = 50000;
|
||||
int32_t tsShellActivityTimer = 3; // second
|
||||
|
||||
// memory pool
|
||||
int8_t tsMemPoolFullFunc = 0;
|
||||
int8_t tsQueryUseMemoryPool = 1;
|
||||
int32_t tsQueryBufferPoolSize = 0; // MB
|
||||
int32_t tsSingleQueryMaxMemorySize = 0; // MB
|
||||
int32_t tsMinReservedMemorySize = 0; // MB
|
||||
int64_t tsCurrentAvailMemorySize = 0;
|
||||
int8_t tsNeedTrim = 0;
|
||||
|
||||
// queue & threads
|
||||
int32_t tsQueryMinConcurrentTaskNum = 1;
|
||||
int32_t tsQueryMaxConcurrentTaskNum = 0;
|
||||
int32_t tsQueryConcurrentTaskNum = 0;
|
||||
int32_t tsQueryNoFetchTimeoutSec = 3600 * 5;
|
||||
|
||||
int32_t tsNumOfRpcThreads = 1;
|
||||
int32_t tsNumOfRpcSessions = 30000;
|
||||
int32_t tsShareConnLimit = 10;
|
||||
int32_t tsReadTimeout = 900;
|
||||
int32_t tsTimeToGetAvailableConn = 500000;
|
||||
|
||||
int32_t tsNumOfQueryThreads = 0;
|
||||
int32_t tsNumOfCommitThreads = 2;
|
||||
int32_t tsNumOfTaskQueueThreads = 16;
|
||||
int32_t tsNumOfMnodeQueryThreads = 16;
|
||||
|
@ -802,6 +817,12 @@ static int32_t taosAddServerCfg(SConfig *pCfg) {
|
|||
TAOS_CHECK_RETURN(cfgAddInt32(pCfg, "queryRspPolicy", tsQueryRspPolicy, 0, 1, CFG_SCOPE_SERVER, CFG_DYN_SERVER,CFG_CATEGORY_GLOBAL));
|
||||
TAOS_CHECK_RETURN(cfgAddInt32(pCfg, "numOfCommitThreads", tsNumOfCommitThreads, 1, 1024, CFG_SCOPE_SERVER, CFG_DYN_SERVER_LAZY,CFG_CATEGORY_LOCAL));
|
||||
TAOS_CHECK_RETURN(cfgAddInt32(pCfg, "retentionSpeedLimitMB", tsRetentionSpeedLimitMB, 0, 1024, CFG_SCOPE_SERVER, CFG_DYN_SERVER,CFG_CATEGORY_GLOBAL));
|
||||
TAOS_CHECK_RETURN(cfgAddBool(pCfg, "queryUseMemoryPool", tsQueryUseMemoryPool, CFG_SCOPE_SERVER, CFG_DYN_NONE,CFG_CATEGORY_LOCAL) != 0);
|
||||
TAOS_CHECK_RETURN(cfgAddBool(pCfg, "memPoolFullFunc", tsMemPoolFullFunc, CFG_SCOPE_SERVER, CFG_DYN_NONE,CFG_CATEGORY_LOCAL) != 0);
|
||||
TAOS_CHECK_RETURN(cfgAddInt32(pCfg, "singleQueryMaxMemorySize", tsSingleQueryMaxMemorySize, 0, 1000000000, CFG_SCOPE_SERVER, CFG_DYN_NONE,CFG_CATEGORY_LOCAL) != 0);
|
||||
//TAOS_CHECK_RETURN(cfgAddInt32(pCfg, "queryBufferPoolSize", tsQueryBufferPoolSize, 0, 1000000000, CFG_SCOPE_SERVER, CFG_DYN_ENT_SERVER) != 0);
|
||||
TAOS_CHECK_RETURN(cfgAddInt32Ex(pCfg, "minReservedMemorySize", 0, 1024, 1000000000, CFG_SCOPE_SERVER, CFG_DYN_NONE,CFG_CATEGORY_LOCAL) != 0);
|
||||
TAOS_CHECK_RETURN(cfgAddInt32(pCfg, "queryNoFetchTimeoutSec", tsQueryNoFetchTimeoutSec, 60, 1000000000, CFG_SCOPE_SERVER, CFG_DYN_ENT_SERVER,CFG_CATEGORY_LOCAL) != 0);
|
||||
|
||||
TAOS_CHECK_RETURN(cfgAddInt32(pCfg, "numOfMnodeReadThreads", tsNumOfMnodeReadThreads, 1, 1024, CFG_SCOPE_SERVER, CFG_DYN_SERVER_LAZY,CFG_CATEGORY_LOCAL));
|
||||
TAOS_CHECK_RETURN(cfgAddInt32(pCfg, "numOfVnodeQueryThreads", tsNumOfVnodeQueryThreads, 1, 1024, CFG_SCOPE_SERVER, CFG_DYN_SERVER_LAZY,CFG_CATEGORY_LOCAL));
|
||||
|
@ -1764,6 +1785,21 @@ static int32_t taosSetServerCfg(SConfig *pCfg) {
|
|||
TAOS_CHECK_GET_CFG_ITEM(pCfg, pItem, "experimental");
|
||||
tsExperimental = pItem->bval;
|
||||
|
||||
TAOS_CHECK_GET_CFG_ITEM(pCfg, pItem, "queryUseMemoryPool");
|
||||
tsQueryUseMemoryPool = pItem->bval;
|
||||
|
||||
TAOS_CHECK_GET_CFG_ITEM(pCfg, pItem, "memPoolFullFunc");
|
||||
tsMemPoolFullFunc = pItem->bval;
|
||||
|
||||
TAOS_CHECK_GET_CFG_ITEM(pCfg, pItem, "singleQueryMaxMemorySize");
|
||||
tsSingleQueryMaxMemorySize = pItem->i32;
|
||||
|
||||
// TAOS_CHECK_GET_CFG_ITEM(pCfg, pItem, "queryBufferPoolSize");
|
||||
// tsQueryBufferPoolSize = pItem->i32;
|
||||
|
||||
TAOS_CHECK_GET_CFG_ITEM(pCfg, pItem, "minReservedMemorySize");
|
||||
tsMinReservedMemorySize = pItem->i32;
|
||||
|
||||
// GRANT_CFG_GET;
|
||||
TAOS_RETURN(TSDB_CODE_SUCCESS);
|
||||
}
|
||||
|
@ -2404,7 +2440,8 @@ static int32_t taosCfgDynamicOptionsForServer(SConfig *pCfg, const char *name) {
|
|||
{"bypassFlag", &tsBypassFlag},
|
||||
{"arbHeartBeatIntervalSec", &tsArbHeartBeatIntervalSec},
|
||||
{"arbCheckSyncIntervalSec", &tsArbCheckSyncIntervalSec},
|
||||
{"arbSetAssignedTimeoutSec", &tsArbSetAssignedTimeoutSec}};
|
||||
{"arbSetAssignedTimeoutSec", &tsArbSetAssignedTimeoutSec},
|
||||
{"queryNoFetchTimeoutSec", &tsQueryNoFetchTimeoutSec}};
|
||||
|
||||
if ((code = taosCfgSetOption(debugOptions, tListLen(debugOptions), pItem, true)) != TSDB_CODE_SUCCESS) {
|
||||
code = taosCfgSetOption(options, tListLen(options), pItem, false);
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#endif
|
||||
#include "dmUtil.h"
|
||||
#include "tcs.h"
|
||||
#include "qworker.h"
|
||||
|
||||
#if defined(CUS_NAME) || defined(CUS_PROMPT) || defined(CUS_EMAIL)
|
||||
#include "cus_name.h"
|
||||
|
@ -478,6 +479,13 @@ int mainWindows(int argc, char **argv) {
|
|||
return code;
|
||||
}
|
||||
|
||||
if ((code = taosMemoryPoolInit(qWorkerRetireJobs, qWorkerRetireJob)) != 0) {
|
||||
dError("failed to init memPool, error:0x%x", code);
|
||||
taosCloseLog();
|
||||
taosCleanupArgs();
|
||||
return code;
|
||||
}
|
||||
|
||||
if ((tsCharsetCxt = taosConvInit(tsCharset)) == NULL) {
|
||||
dError("failed to init conv");
|
||||
taosCloseLog();
|
||||
|
|
|
@ -221,9 +221,12 @@ static void *dmMonitorThreadFp(void *param) {
|
|||
|
||||
trimCount = (trimCount + 1) % TRIM_FREQ;
|
||||
if (trimCount == 0) {
|
||||
taosMemoryTrim(0);
|
||||
taosMemoryTrim(0, NULL);
|
||||
}
|
||||
}
|
||||
if (atomic_val_compare_exchange_8(&tsNeedTrim, 1, 0)) {
|
||||
taosMemoryTrim(0, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
|
|
@ -220,6 +220,8 @@ int32_t mmStartWorker(SMnodeMgmt *pMgmt) {
|
|||
return code;
|
||||
}
|
||||
|
||||
tsNumOfQueryThreads += tsNumOfMnodeQueryThreads;
|
||||
|
||||
SSingleWorkerCfg fCfg = {
|
||||
.min = tsNumOfMnodeFetchThreads,
|
||||
.max = tsNumOfMnodeFetchThreads,
|
||||
|
|
|
@ -104,8 +104,8 @@ int32_t qmStartWorker(SQnodeMgmt *pMgmt) {
|
|||
int32_t code = 0;
|
||||
|
||||
SSingleWorkerCfg queryCfg = {
|
||||
.min = tsNumOfVnodeQueryThreads,
|
||||
.max = tsNumOfVnodeQueryThreads,
|
||||
.min = tsNumOfQnodeQueryThreads,
|
||||
.max = tsNumOfQnodeQueryThreads,
|
||||
.name = "qnode-query",
|
||||
.fp = (FItem)qmProcessQueue,
|
||||
.param = pMgmt,
|
||||
|
@ -117,6 +117,8 @@ int32_t qmStartWorker(SQnodeMgmt *pMgmt) {
|
|||
return code;
|
||||
}
|
||||
|
||||
tsNumOfQueryThreads += tsNumOfQnodeQueryThreads;
|
||||
|
||||
SSingleWorkerCfg fetchCfg = {
|
||||
.min = tsNumOfQnodeFetchThreads,
|
||||
.max = tsNumOfQnodeFetchThreads,
|
||||
|
|
|
@ -456,6 +456,8 @@ int32_t vmStartWorker(SVnodeMgmt *pMgmt) {
|
|||
pQPool->max = tsNumOfVnodeQueryThreads;
|
||||
if ((code = tQueryAutoQWorkerInit(pQPool)) != 0) return code;
|
||||
|
||||
tsNumOfQueryThreads += tsNumOfVnodeQueryThreads;
|
||||
|
||||
SAutoQWorkerPool *pStreamPool = &pMgmt->streamPool;
|
||||
pStreamPool->name = "vnode-stream";
|
||||
pStreamPool->ratio = tsRatioOfVnodeStreamThreads;
|
||||
|
|
|
@ -220,6 +220,7 @@ void dmCleanup() {
|
|||
|
||||
dInfo("dnode env is cleaned up");
|
||||
|
||||
taosMemPoolClose(gMemPoolHandle);
|
||||
taosCleanupCfg();
|
||||
taosCloseLog();
|
||||
}
|
||||
|
|
|
@ -368,7 +368,9 @@ static inline int32_t dmSendSyncReq(const SEpSet *pEpSet, SRpcMsg *pMsg) {
|
|||
|
||||
static inline void dmRegisterBrokenLinkArg(SRpcMsg *pMsg) { (void)rpcRegisterBrokenLinkArg(pMsg); }
|
||||
|
||||
static inline void dmReleaseHandle(SRpcHandleInfo *pHandle, int8_t type) { (void)rpcReleaseHandle(pHandle, type); }
|
||||
static inline void dmReleaseHandle(SRpcHandleInfo *pHandle, int8_t type, int32_t status) {
|
||||
(void)rpcReleaseHandle(pHandle, type, status);
|
||||
}
|
||||
|
||||
static bool rpcRfp(int32_t code, tmsg_t msgType) {
|
||||
if (code == TSDB_CODE_RPC_NETWORK_UNAVAIL || code == TSDB_CODE_RPC_BROKEN_LINK || code == TSDB_CODE_MNODE_NOT_FOUND ||
|
||||
|
|
|
@ -614,7 +614,7 @@ int32_t mndProcessSubscribeReq(SRpcMsg *pMsg) {
|
|||
END:
|
||||
mndTransDrop(pTrans);
|
||||
tDeleteSMqConsumerObj(pConsumerNew);
|
||||
taosArrayDestroyP(subscribe.topicNames, (FDelete)taosMemoryFree);
|
||||
taosArrayDestroyP(subscribe.topicNames, NULL);
|
||||
return (code == TSDB_CODE_TMQ_NO_NEED_REBALANCE || code == TSDB_CODE_MND_CONSUMER_NOT_EXIST) ? 0 : code;
|
||||
}
|
||||
|
||||
|
|
|
@ -351,10 +351,10 @@ END:
|
|||
|
||||
void tClearSMqConsumerObj(SMqConsumerObj *pConsumer) {
|
||||
if (pConsumer == NULL) return;
|
||||
taosArrayDestroyP(pConsumer->currentTopics, (FDelete)taosMemoryFree);
|
||||
taosArrayDestroyP(pConsumer->rebNewTopics, (FDelete)taosMemoryFree);
|
||||
taosArrayDestroyP(pConsumer->rebRemovedTopics, (FDelete)taosMemoryFree);
|
||||
taosArrayDestroyP(pConsumer->assignedTopics, (FDelete)taosMemoryFree);
|
||||
taosArrayDestroyP(pConsumer->currentTopics, NULL);
|
||||
taosArrayDestroyP(pConsumer->rebNewTopics, NULL);
|
||||
taosArrayDestroyP(pConsumer->rebRemovedTopics, NULL);
|
||||
taosArrayDestroyP(pConsumer->assignedTopics, NULL);
|
||||
}
|
||||
|
||||
void tDeleteSMqConsumerObj(SMqConsumerObj *pConsumer) {
|
||||
|
|
|
@ -627,9 +627,12 @@ static void *mndBuildVDropStbReq(SMnode *pMnode, SVgObj *pVgroup, SStbObj *pStb,
|
|||
void *pBuf = POINTER_SHIFT(pHead, sizeof(SMsgHead));
|
||||
|
||||
tEncoderInit(&encoder, pBuf, contLen - sizeof(SMsgHead));
|
||||
terrno = tEncodeSVDropStbReq(&encoder, &req);
|
||||
int32_t code = tEncodeSVDropStbReq(&encoder, &req);
|
||||
tEncoderClear(&encoder);
|
||||
if (terrno != 0) return NULL;
|
||||
if (code != 0) {
|
||||
terrno = code;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
*pContLen = contLen;
|
||||
return pHead;
|
||||
|
|
|
@ -213,7 +213,7 @@ int32_t ipWhiteMgtUpdate(SMnode *pMnode, char *user, SIpWhiteList *pNew) {
|
|||
|
||||
_OVER:
|
||||
(void)taosThreadRwlockUnlock(&ipWhiteMgt.rw);
|
||||
taosArrayDestroyP(fqdns, (FDelete)taosMemoryFree);
|
||||
taosArrayDestroyP(fqdns, NULL);
|
||||
if (code < 0) {
|
||||
mError("failed to update ip white list for user: %s at line %d since %s", user, lino, tstrerror(code));
|
||||
}
|
||||
|
@ -640,8 +640,8 @@ int32_t mndFetchAllIpWhite(SMnode *pMnode, SHashObj **ppIpWhiteTab) {
|
|||
}
|
||||
|
||||
_OVER:
|
||||
taosArrayDestroyP(fqdns, taosMemoryFree);
|
||||
taosArrayDestroyP(pUserNames, taosMemoryFree);
|
||||
taosArrayDestroyP(fqdns, NULL);
|
||||
taosArrayDestroyP(pUserNames, NULL);
|
||||
|
||||
if (code < 0) {
|
||||
mError("failed to fetch all ip white list at line %d since %s", lino, tstrerror(code));
|
||||
|
@ -1899,13 +1899,13 @@ static int32_t mndProcessCreateUserReq(SRpcMsg *pReq) {
|
|||
if (code == 0) code = TSDB_CODE_ACTION_IN_PROGRESS;
|
||||
|
||||
char detail[1000] = {0};
|
||||
(void)sprintf(detail, "enable:%d, superUser:%d, sysInfo:%d, password:xxx", createReq.enable, createReq.superUser,
|
||||
createReq.sysInfo);
|
||||
TAOS_UNUSED(snprintf(detail, sizeof(detail), "enable:%d, superUser:%d, sysInfo:%d, password:xxx", createReq.enable,
|
||||
createReq.superUser, createReq.sysInfo));
|
||||
char operation[15] = {0};
|
||||
if (createReq.isImport == 1) {
|
||||
(void)strcpy(operation, "importUser");
|
||||
tstrncpy(operation, "importUser", sizeof(operation));
|
||||
} else {
|
||||
(void)strcpy(operation, "createUser");
|
||||
tstrncpy(operation, "createUser", sizeof(operation));
|
||||
}
|
||||
|
||||
auditRecord(pReq, pMnode->clusterId, operation, "", createReq.user, detail, strlen(detail));
|
||||
|
@ -2502,9 +2502,10 @@ static int32_t mndProcessAlterUserReq(SRpcMsg *pReq) {
|
|||
|
||||
if (alterReq.alterType == TSDB_ALTER_USER_PASSWD) {
|
||||
char detail[1000] = {0};
|
||||
(void)sprintf(detail, "alterType:%s, enable:%d, superUser:%d, sysInfo:%d, createdb:%d, tabName:%s, password:xxx",
|
||||
mndUserAuditTypeStr(alterReq.alterType), alterReq.enable, alterReq.superUser, alterReq.sysInfo,
|
||||
alterReq.createdb ? 1 : 0, alterReq.tabName);
|
||||
(void)snprintf(detail, sizeof(detail),
|
||||
"alterType:%s, enable:%d, superUser:%d, sysInfo:%d, createdb:%d, tabName:%s, password:xxx",
|
||||
mndUserAuditTypeStr(alterReq.alterType), alterReq.enable, alterReq.superUser, alterReq.sysInfo,
|
||||
alterReq.createdb ? 1 : 0, alterReq.tabName);
|
||||
auditRecord(pReq, pMnode->clusterId, "alterUser", "", alterReq.user, detail, strlen(detail));
|
||||
} else if (alterReq.alterType == TSDB_ALTER_USER_SUPERUSER || alterReq.alterType == TSDB_ALTER_USER_ENABLE ||
|
||||
alterReq.alterType == TSDB_ALTER_USER_SYSINFO || alterReq.alterType == TSDB_ALTER_USER_CREATEDB) {
|
||||
|
@ -2877,8 +2878,8 @@ static int32_t mndLoopHash(SHashObj *hash, char *priType, SSDataBlock *pBlock, i
|
|||
SNode *pAst = NULL;
|
||||
int32_t sqlLen = 0;
|
||||
size_t bufSz = strlen(value) + 1;
|
||||
if (bufSz < 5) bufSz = 5;
|
||||
TAOS_MEMORY_REALLOC(*sql, bufSz + 1);
|
||||
if (bufSz < 6) bufSz = 6;
|
||||
TAOS_MEMORY_REALLOC(*sql, bufSz);
|
||||
if (*sql == NULL) {
|
||||
code = terrno;
|
||||
goto _exit;
|
||||
|
@ -2892,12 +2893,12 @@ static int32_t mndLoopHash(SHashObj *hash, char *priType, SSDataBlock *pBlock, i
|
|||
if (nodesStringToNode(value, &pAst) == 0) {
|
||||
if (nodesNodeToSQL(pAst, *sql, bufSz, &sqlLen) != 0) {
|
||||
sqlLen = 5;
|
||||
(void)sprintf(*sql, "error");
|
||||
(void)snprintf(*sql, bufSz, "error");
|
||||
}
|
||||
nodesDestroyNode(pAst);
|
||||
} else {
|
||||
sqlLen = 5;
|
||||
(void)sprintf(*sql, "error");
|
||||
(void)snprintf(*sql, bufSz, "error");
|
||||
}
|
||||
|
||||
STR_WITH_MAXSIZE_TO_VARSTR((*condition), (*sql), pShow->pMeta->pSchemas[cols].bytes);
|
||||
|
|
|
@ -308,7 +308,7 @@ static int32_t tdSetRSmaInfoItemParams(SSma *pSma, SRSmaParam *param, SRSmaStat
|
|||
if (!pStreamTask->exec.qmsg) {
|
||||
TAOS_RETURN(terrno);
|
||||
}
|
||||
(void)sprintf(pStreamTask->exec.qmsg, "%s", RSMA_EXEC_TASK_FLAG);
|
||||
TAOS_UNUSED(snprintf(pStreamTask->exec.qmsg, strlen(RSMA_EXEC_TASK_FLAG) + 1, "%s", RSMA_EXEC_TASK_FLAG));
|
||||
pStreamTask->chkInfo.checkpointId = streamMetaGetLatestCheckpointId(pStreamTask->pMeta);
|
||||
tdRSmaTaskInit(pStreamTask->pMeta, pItem, &pStreamTask->id);
|
||||
|
||||
|
|
|
@ -946,7 +946,7 @@ int32_t tsdbFSEditCommit(STFileSystem *fs) {
|
|||
arg->tsdb = fs->tsdb;
|
||||
arg->fid = fset->fid;
|
||||
|
||||
code = vnodeAsync(&fset->channel, EVA_PRIORITY_HIGH, tsdbMerge, taosMemoryFree, arg, NULL);
|
||||
code = vnodeAsync(&fset->channel, EVA_PRIORITY_HIGH, tsdbMerge, taosAutoMemoryFree, arg, NULL);
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
fset->mergeScheduled = true;
|
||||
}
|
||||
|
|
|
@ -150,7 +150,7 @@ _end:
|
|||
void clearBlockScanInfoBuf(SBlockInfoBuf* pBuf) {
|
||||
if (pBuf == NULL) return;
|
||||
if (pBuf->pData != NULL) {
|
||||
taosArrayDestroyP(pBuf->pData, (FDelete)taosMemoryFree);
|
||||
taosArrayDestroyP(pBuf->pData, NULL);
|
||||
pBuf->pData = NULL;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -106,6 +106,8 @@ static int32_t vnodeGetBufPoolToUse(SVnode *pVnode) {
|
|||
if (code && code != TSDB_CODE_TIMEOUT_ERROR) {
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
}
|
||||
|
||||
code = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1321,7 +1321,7 @@ _exit:
|
|||
taosArrayDestroy(tbUids);
|
||||
tDecoderClear(&decoder);
|
||||
tEncoderClear(&encoder);
|
||||
taosArrayDestroyP(tbNames, taosMemoryFree);
|
||||
taosArrayDestroyP(tbNames, NULL);
|
||||
return rcode;
|
||||
}
|
||||
|
||||
|
|
|
@ -519,7 +519,7 @@ int32_t ctgGetTbDistVgInfo(SCatalog* pCtg, SRequestConnInfo* pConn, SName* pTabl
|
|||
vgList = taosArrayInit(1, sizeof(SVgroupInfo));
|
||||
if (NULL == vgList) {
|
||||
ctgError("taosArrayInit %d failed", (int32_t)sizeof(SVgroupInfo));
|
||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_JRET(terrno);
|
||||
}
|
||||
|
||||
if (NULL == taosArrayPush(vgList, &vgroupInfo)) {
|
||||
|
@ -877,13 +877,13 @@ int32_t catalogInit(SCatalogCfg* cfg) {
|
|||
gCtgMgmt.timer = taosTmrInit(0, 0, 0, "catalog");
|
||||
if (NULL == gCtgMgmt.timer) {
|
||||
qError("init timer failed, error:%s", tstrerror(terrno));
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
gCtgMgmt.cacheTimer = taosTmrStart(ctgProcessTimerEvent, CTG_DEFAULT_CACHE_MON_MSEC, NULL, gCtgMgmt.timer);
|
||||
if (NULL == gCtgMgmt.cacheTimer) {
|
||||
qError("start cache timer failed");
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
CTG_ERR_RET(ctgStartUpdateThread());
|
||||
|
|
|
@ -1173,12 +1173,16 @@ int32_t ctgDumpTbIndexRes(SCtgTask* pTask) {
|
|||
SCtgJob* pJob = pTask->pJob;
|
||||
if (NULL == pJob->jobRes.pTableIndex) {
|
||||
SArray* pRes = taosArrayInit(pJob->tbIndexNum, sizeof(SMetaRes));
|
||||
if (NULL == pRes) {
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
if (atomic_val_compare_exchange_ptr(&pJob->jobRes.pTableIndex, NULL, pRes)) {
|
||||
taosArrayDestroy(pRes);
|
||||
}
|
||||
|
||||
if (NULL == pJob->jobRes.pTableIndex) {
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(TSDB_CODE_CTG_INTERNAL_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1198,12 +1202,16 @@ int32_t ctgDumpTbCfgRes(SCtgTask* pTask) {
|
|||
SCtgJob* pJob = pTask->pJob;
|
||||
if (NULL == pJob->jobRes.pTableCfg) {
|
||||
SArray* pRes = taosArrayInit(pJob->tbCfgNum, sizeof(SMetaRes));
|
||||
if (NULL == pRes) {
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
if (atomic_val_compare_exchange_ptr(&pJob->jobRes.pTableCfg, NULL, pRes)) {
|
||||
taosArrayDestroy(pRes);
|
||||
}
|
||||
|
||||
if (NULL == pJob->jobRes.pTableCfg) {
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(TSDB_CODE_CTG_INTERNAL_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1223,12 +1231,16 @@ int32_t ctgDumpTbTagRes(SCtgTask* pTask) {
|
|||
SCtgJob* pJob = pTask->pJob;
|
||||
if (NULL == pJob->jobRes.pTableTag) {
|
||||
SArray* pRes = taosArrayInit(pJob->tbTagNum, sizeof(SMetaRes));
|
||||
if (NULL == pRes) {
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
if (atomic_val_compare_exchange_ptr(&pJob->jobRes.pTableTag, NULL, pRes)) {
|
||||
taosArrayDestroy(pRes);
|
||||
}
|
||||
|
||||
if (NULL == pJob->jobRes.pTableTag) {
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(TSDB_CODE_CTG_INTERNAL_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3729,7 +3729,7 @@ int32_t ctgGetTbNamesFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgTbNa
|
|||
for (int32_t i = 0; i < tbNum; ++i) {
|
||||
CTG_ERR_JRET(ctgAddFetch(&ctx->pFetchs, dbIdx, i, fetchIdx, baseResIdx + i, flag));
|
||||
if (NULL == taosArrayPush(ctx->pResList, &(SMetaData){0})) {
|
||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_JRET(terrno);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3863,7 +3863,7 @@ int32_t ctgGetViewsFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgViewsC
|
|||
taosMemoryFree(pViewMeta->querySql);
|
||||
taosMemoryFree(pViewMeta->user);
|
||||
taosMemoryFree(pViewMeta);
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
pViewMeta->pSchema = taosMemoryMalloc(pViewMeta->numOfCols * sizeof(SSchema));
|
||||
if (pViewMeta->pSchema == NULL) {
|
||||
|
|
|
@ -34,9 +34,10 @@ int32_t ctgHandleBatchRsp(SCtgJob* pJob, SCtgTaskCallbackParam* cbParam, SDataBu
|
|||
SBatchRspMsg* pRsp = NULL;
|
||||
|
||||
if (TSDB_CODE_SUCCESS == rspCode && pMsg->pData && (pMsg->len > 0)) {
|
||||
if (tDeserializeSBatchRsp(pMsg->pData, pMsg->len, &batchRsp) < 0) {
|
||||
code = tDeserializeSBatchRsp(pMsg->pData, pMsg->len, &batchRsp);
|
||||
if (code < 0) {
|
||||
ctgError("tDeserializeSBatchRsp failed, msgLen:%d", pMsg->len);
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(code);
|
||||
}
|
||||
|
||||
msgNum = taosArrayGetSize(batchRsp.pRsps);
|
||||
|
@ -673,7 +674,7 @@ int32_t ctgAddBatch(SCatalog* pCtg, int32_t vgId, SRequestConnInfo* pConn, SCtgT
|
|||
newBatch.batchId = atomic_add_fetch_32(&pJob->batchId, 1);
|
||||
|
||||
if (0 != taosHashPut(pBatchs, &vgId, sizeof(vgId), &newBatch, sizeof(newBatch))) {
|
||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_JRET(terrno);
|
||||
}
|
||||
|
||||
ctgDebug("task %d %s req added to batch %d, target vgId %d", pTask->taskId, TMSG_INFO(msgType), newBatch.batchId,
|
||||
|
@ -778,7 +779,7 @@ int32_t ctgBuildBatchReqMsg(SCtgBatch* pBatch, int32_t vgId, void** msg, int32_t
|
|||
int32_t msgSize = tSerializeSBatchReq(NULL, 0, &batchReq);
|
||||
if (msgSize < 0) {
|
||||
qError("tSerializeSBatchReq failed");
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(msgSize);
|
||||
}
|
||||
|
||||
*msg = taosMemoryCalloc(1, msgSize);
|
||||
|
@ -786,9 +787,10 @@ int32_t ctgBuildBatchReqMsg(SCtgBatch* pBatch, int32_t vgId, void** msg, int32_t
|
|||
qError("calloc batchReq msg failed, size:%d", msgSize);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
if (tSerializeSBatchReq(*msg, msgSize, &batchReq) < 0) {
|
||||
msgSize = tSerializeSBatchReq(*msg, msgSize, &batchReq);
|
||||
if (msgSize < 0) {
|
||||
qError("tSerializeSBatchReq failed");
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(msgSize);
|
||||
}
|
||||
|
||||
*pSize = msgSize;
|
||||
|
@ -835,7 +837,7 @@ int32_t ctgGetQnodeListFromMnode(SCatalog* pCtg, SRequestConnInfo* pConn, SArray
|
|||
char* msg = NULL;
|
||||
int32_t msgLen = 0;
|
||||
int32_t reqType = TDMT_MND_QNODE_LIST;
|
||||
void* (*mallocFp)(int64_t) = pTask ? (MallocType)taosMemoryMalloc : (MallocType)rpcMallocCont;
|
||||
void* (*mallocFp)(int64_t) = pTask ? (MallocType)taosMemMalloc : (MallocType)rpcMallocCont;
|
||||
|
||||
ctgDebug("try to get qnode list from mnode, mgmtEpInUse:%d", pConn->mgmtEps.inUse);
|
||||
|
||||
|
@ -892,7 +894,7 @@ int32_t ctgGetDnodeListFromMnode(SCatalog* pCtg, SRequestConnInfo* pConn, SArray
|
|||
char* msg = NULL;
|
||||
int32_t msgLen = 0;
|
||||
int32_t reqType = TDMT_MND_DNODE_LIST;
|
||||
void* (*mallocFp)(int64_t) = pTask ? (MallocType)taosMemoryMalloc : (MallocType)rpcMallocCont;
|
||||
void* (*mallocFp)(int64_t) = pTask ? (MallocType)taosMemMalloc : (MallocType)rpcMallocCont;
|
||||
|
||||
ctgDebug("try to get dnode list from mnode, mgmtEpInUse:%d", pConn->mgmtEps.inUse);
|
||||
|
||||
|
@ -946,7 +948,7 @@ int32_t ctgGetDBVgInfoFromMnode(SCatalog* pCtg, SRequestConnInfo* pConn, SBuildU
|
|||
int32_t msgLen = 0;
|
||||
int32_t reqType = TDMT_MND_USE_DB;
|
||||
SCtgTask* pTask = tReq ? tReq->pTask : NULL;
|
||||
void* (*mallocFp)(int64_t) = pTask ? (MallocType)taosMemoryMalloc : (MallocType)rpcMallocCont;
|
||||
void* (*mallocFp)(int64_t) = pTask ? (MallocType)taosMemMalloc : (MallocType)rpcMallocCont;
|
||||
|
||||
ctgDebug("try to get db vgInfo from mnode, dbFName:%s", input->db);
|
||||
|
||||
|
@ -1001,7 +1003,7 @@ int32_t ctgGetDBCfgFromMnode(SCatalog* pCtg, SRequestConnInfo* pConn, const char
|
|||
char* msg = NULL;
|
||||
int32_t msgLen = 0;
|
||||
int32_t reqType = TDMT_MND_GET_DB_CFG;
|
||||
void* (*mallocFp)(int64_t) = pTask ? (MallocType)taosMemoryMalloc : (MallocType)rpcMallocCont;
|
||||
void* (*mallocFp)(int64_t) = pTask ? (MallocType)taosMemMalloc : (MallocType)rpcMallocCont;
|
||||
|
||||
ctgDebug("try to get db cfg from mnode, dbFName:%s", dbFName);
|
||||
|
||||
|
@ -1059,7 +1061,7 @@ int32_t ctgGetIndexInfoFromMnode(SCatalog* pCtg, SRequestConnInfo* pConn, const
|
|||
char* msg = NULL;
|
||||
int32_t msgLen = 0;
|
||||
int32_t reqType = TDMT_MND_GET_INDEX;
|
||||
void* (*mallocFp)(int64_t) = pTask ? (MallocType)taosMemoryMalloc : (MallocType)rpcMallocCont;
|
||||
void* (*mallocFp)(int64_t) = pTask ? (MallocType)taosMemMalloc : (MallocType)rpcMallocCont;
|
||||
|
||||
ctgDebug("try to get index from mnode, indexName:%s", indexName);
|
||||
|
||||
|
@ -1117,7 +1119,7 @@ int32_t ctgGetTbIndexFromMnode(SCatalog* pCtg, SRequestConnInfo* pConn, SName* n
|
|||
char* msg = NULL;
|
||||
int32_t msgLen = 0;
|
||||
int32_t reqType = TDMT_MND_GET_TABLE_INDEX;
|
||||
void* (*mallocFp)(int64_t) = pTask ? (MallocType)taosMemoryMalloc : (MallocType)rpcMallocCont;
|
||||
void* (*mallocFp)(int64_t) = pTask ? (MallocType)taosMemMalloc : (MallocType)rpcMallocCont;
|
||||
char tbFName[TSDB_TABLE_FNAME_LEN];
|
||||
|
||||
ctgDebug("try to get tb index from mnode, tbFName:%s", tbFName);
|
||||
|
@ -1183,7 +1185,7 @@ int32_t ctgGetUdfInfoFromMnode(SCatalog* pCtg, SRequestConnInfo* pConn, const ch
|
|||
char* msg = NULL;
|
||||
int32_t msgLen = 0;
|
||||
int32_t reqType = TDMT_MND_RETRIEVE_FUNC;
|
||||
void* (*mallocFp)(int64_t) = pTask ? (MallocType)taosMemoryMalloc : (MallocType)rpcMallocCont;
|
||||
void* (*mallocFp)(int64_t) = pTask ? (MallocType)taosMemMalloc : (MallocType)rpcMallocCont;
|
||||
|
||||
ctgDebug("try to get udf info from mnode, funcName:%s", funcName);
|
||||
|
||||
|
@ -1241,7 +1243,7 @@ int32_t ctgGetUserDbAuthFromMnode(SCatalog* pCtg, SRequestConnInfo* pConn, const
|
|||
char* msg = NULL;
|
||||
int32_t msgLen = 0;
|
||||
int32_t reqType = TDMT_MND_GET_USER_AUTH;
|
||||
void* (*mallocFp)(int64_t) = pTask ? (MallocType)taosMemoryMalloc : (MallocType)rpcMallocCont;
|
||||
void* (*mallocFp)(int64_t) = pTask ? (MallocType)taosMemMalloc : (MallocType)rpcMallocCont;
|
||||
|
||||
ctgDebug("try to get user auth from mnode, user:%s", user);
|
||||
|
||||
|
@ -1304,7 +1306,7 @@ int32_t ctgGetTbMetaFromMnodeImpl(SCatalog* pCtg, SRequestConnInfo* pConn, const
|
|||
int32_t reqType = TDMT_MND_TABLE_META;
|
||||
char tbFName[TSDB_TABLE_FNAME_LEN];
|
||||
(void)snprintf(tbFName, sizeof(tbFName), "%s.%s", dbFName, tbName);
|
||||
void* (*mallocFp)(int64_t) = pTask ? (MallocType)taosMemoryMalloc : (MallocType)rpcMallocCont;
|
||||
void* (*mallocFp)(int64_t) = pTask ? (MallocType)taosMemMalloc : (MallocType)rpcMallocCont;
|
||||
|
||||
ctgDebug("try to get table meta from mnode, tbFName:%s", tbFName);
|
||||
|
||||
|
@ -1370,7 +1372,7 @@ int32_t ctgGetTbMetaFromVnode(SCatalog* pCtg, SRequestConnInfo* pConn, const SNa
|
|||
int32_t reqType = (pTask && pTask->type == CTG_TASK_GET_TB_NAME ? TDMT_VND_TABLE_NAME : TDMT_VND_TABLE_META);
|
||||
char tbFName[TSDB_TABLE_FNAME_LEN];
|
||||
(void)snprintf(tbFName, sizeof(tbFName), "%s.%s", dbFName, pTableName->tname);
|
||||
void* (*mallocFp)(int64_t) = pTask ? (MallocType)taosMemoryMalloc : (MallocType)rpcMallocCont;
|
||||
void* (*mallocFp)(int64_t) = pTask ? (MallocType)taosMemMalloc : (MallocType)rpcMallocCont;
|
||||
|
||||
SEp* pEp = &vgroupInfo->epSet.eps[vgroupInfo->epSet.inUse];
|
||||
ctgDebug("try to get table meta from vnode, vgId:%d, ep num:%d, ep %s:%d, tbFName:%s", vgroupInfo->vgId,
|
||||
|
@ -1443,8 +1445,7 @@ int32_t ctgGetTableCfgFromVnode(SCatalog* pCtg, SRequestConnInfo* pConn, const S
|
|||
int32_t msgLen = 0;
|
||||
int32_t reqType = TDMT_VND_TABLE_CFG;
|
||||
char tbFName[TSDB_TABLE_FNAME_LEN];
|
||||
|
||||
void* (*mallocFp)(int64_t) = pTask ? (MallocType)taosMemoryMalloc : (MallocType)rpcMallocCont;
|
||||
void* (*mallocFp)(int64_t) = pTask ? (MallocType)taosMemMalloc : (MallocType)rpcMallocCont;
|
||||
char dbFName[TSDB_DB_FNAME_LEN];
|
||||
(void)tNameGetFullDbName(pTableName, dbFName);
|
||||
SBuildTableInput bInput = {.vgId = vgroupInfo->vgId, .dbFName = dbFName, .tbName = (char*)pTableName->tname};
|
||||
|
@ -1518,7 +1519,7 @@ int32_t ctgGetTableCfgFromMnode(SCatalog* pCtg, SRequestConnInfo* pConn, const S
|
|||
int32_t msgLen = 0;
|
||||
int32_t reqType = TDMT_MND_TABLE_CFG;
|
||||
char tbFName[TSDB_TABLE_FNAME_LEN];
|
||||
void* (*mallocFp)(int64_t) = pTask ? (MallocType)taosMemoryMalloc : (MallocType)rpcMallocCont;
|
||||
void* (*mallocFp)(int64_t) = pTask ? (MallocType)taosMemMalloc : (MallocType)rpcMallocCont;
|
||||
char dbFName[TSDB_DB_FNAME_LEN];
|
||||
(void)tNameGetFullDbName(pTableName, dbFName);
|
||||
SBuildTableInput bInput = {.vgId = 0, .dbFName = dbFName, .tbName = (char*)pTableName->tname};
|
||||
|
@ -1580,7 +1581,7 @@ int32_t ctgGetSvrVerFromMnode(SCatalog* pCtg, SRequestConnInfo* pConn, char** ou
|
|||
char* msg = NULL;
|
||||
int32_t msgLen = 0;
|
||||
int32_t reqType = TDMT_MND_SERVER_VERSION;
|
||||
void* (*mallocFp)(int64_t) = pTask ? (MallocType)taosMemoryMalloc : (MallocType)rpcMallocCont;
|
||||
void* (*mallocFp)(int64_t) = pTask ? (MallocType)taosMemMalloc : (MallocType)rpcMallocCont;
|
||||
|
||||
qDebug("try to get svr ver from mnode");
|
||||
|
||||
|
@ -1634,7 +1635,7 @@ int32_t ctgGetViewInfoFromMnode(SCatalog* pCtg, SRequestConnInfo* pConn, SName*
|
|||
int32_t msgLen = 0;
|
||||
int32_t reqType = TDMT_MND_VIEW_META;
|
||||
SCtgTask* pTask = tReq ? tReq->pTask : NULL;
|
||||
void* (*mallocFp)(int64_t) = pTask ? (MallocType)taosMemoryMalloc : (MallocType)rpcMallocCont;
|
||||
void* (*mallocFp)(int64_t) = pTask ? (MallocType)taosMemMalloc : (MallocType)rpcMallocCont;
|
||||
char fullName[TSDB_TABLE_FNAME_LEN];
|
||||
int32_t code = tNameExtractFullName(pName, fullName);
|
||||
if (code) {
|
||||
|
@ -1696,7 +1697,7 @@ int32_t ctgGetTbTSMAFromMnode(SCatalog* pCtg, SRequestConnInfo* pConn, const SNa
|
|||
char* msg = NULL;
|
||||
int32_t msgLen = 0;
|
||||
SCtgTask* pTask = tReq ? tReq->pTask : NULL;
|
||||
void* (*mallocFp)(int64_t) = pTask ? (MallocType)taosMemoryMalloc : (MallocType)rpcMallocCont;
|
||||
void* (*mallocFp)(int64_t) = pTask ? (MallocType)taosMemMalloc : (MallocType)rpcMallocCont;
|
||||
char tbFName[TSDB_TABLE_FNAME_LEN];
|
||||
int32_t code = tNameExtractFullName(name, tbFName);
|
||||
if (code) {
|
||||
|
@ -1768,7 +1769,7 @@ int32_t ctgGetStreamProgressFromVnode(SCatalog* pCtg, SRequestConnInfo* pConn, c
|
|||
}
|
||||
|
||||
SCtgTask* pTask = tReq ? tReq->pTask : NULL;
|
||||
void* (*mallocFp)(int64_t) = pTask ? (MallocType)taosMemoryMalloc : (MallocType)rpcMallocCont;
|
||||
void* (*mallocFp)(int64_t) = pTask ? (MallocType)taosMemMalloc : (MallocType)rpcMallocCont;
|
||||
|
||||
SEp* pEp = &vgroupInfo->epSet.eps[vgroupInfo->epSet.inUse];
|
||||
ctgDebug("try to get stream progress from vnode, vgId:%d, ep num:%d, ep %s:%d, target:%s", vgroupInfo->vgId,
|
||||
|
|
|
@ -1620,7 +1620,7 @@ int32_t ctgCloneVgInfo(SDBVgInfo* src, SDBVgInfo** dst) {
|
|||
taosHashCancelIterate(src->vgHash, pIter);
|
||||
taosHashCleanup((*dst)->vgHash);
|
||||
taosMemoryFreeClear(*dst);
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
pIter = taosHashIterate(src->vgHash, pIter);
|
||||
|
@ -1787,7 +1787,7 @@ static int32_t ctgCloneDbVgroup(void* pSrc, void** ppDst) {
|
|||
}
|
||||
|
||||
*ppDst = taosArrayDup((const SArray*)pSrc, NULL);
|
||||
return (*ppDst) ? TSDB_CODE_SUCCESS : TSDB_CODE_OUT_OF_MEMORY;
|
||||
return (*ppDst) ? TSDB_CODE_SUCCESS : terrno;
|
||||
#else
|
||||
return TSDB_CODE_CTG_INTERNAL_ERROR;
|
||||
#endif
|
||||
|
@ -1824,7 +1824,7 @@ static int32_t ctgCloneDbInfo(void* pSrc, void** ppDst) {
|
|||
#if 0
|
||||
SDbInfo* pDst = taosMemoryMalloc(sizeof(SDbInfo));
|
||||
if (NULL == pDst) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
TAOS_MEMCPY(pDst, pSrc, sizeof(SDbInfo));
|
||||
|
@ -2263,13 +2263,13 @@ static int32_t ctgCloneMetaDataArray(SArray* pSrc, __array_item_dup_fn_t copyFun
|
|||
int32_t size = taosArrayGetSize(pSrc);
|
||||
*pDst = taosArrayInit(size, sizeof(SMetaRes));
|
||||
if (NULL == *pDst) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
for (int32_t i = 0; i < size; ++i) {
|
||||
SMetaRes* pRes = taosArrayGet(pSrc, i);
|
||||
SMetaRes res = {.code = pRes->code, .pRes = copyFunc(pRes->pRes)};
|
||||
if (NULL == res.pRes) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
taosArrayPush(*pDst, &res);
|
||||
}
|
||||
|
@ -2630,11 +2630,11 @@ int32_t ctgBuildViewNullRes(SCtgTask* pTask, SCtgViewsCtx* pCtx) {
|
|||
int32_t dupViewMetaFromRsp(SViewMetaRsp* pRsp, SViewMeta* pViewMeta) {
|
||||
pViewMeta->querySql = tstrdup(pRsp->querySql);
|
||||
if (NULL == pViewMeta->querySql) {
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
pViewMeta->user = tstrdup(pRsp->user);
|
||||
if (NULL == pViewMeta->user) {
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
pViewMeta->version = pRsp->version;
|
||||
pViewMeta->viewId = pRsp->viewId;
|
||||
|
|
|
@ -2056,7 +2056,7 @@ static int32_t qExplainPrepareCtx(SQueryPlan *pDag, SExplainCtx **pCtx) {
|
|||
|
||||
if (0 != taosHashPut(groupHash, &plan->id.groupId, sizeof(plan->id.groupId), &group, sizeof(group))) {
|
||||
qError("taosHashPut to explainGroupHash failed, taskIdx:%d", n);
|
||||
QRY_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
QRY_ERR_JRET(terrno);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -39,6 +39,7 @@ typedef void (*FGetDataLength)(struct SDataSinkHandle* pHandle, int64_t* pLen, i
|
|||
typedef int32_t (*FGetDataBlock)(struct SDataSinkHandle* pHandle, SOutputData* pOutput);
|
||||
typedef int32_t (*FDestroyDataSinker)(struct SDataSinkHandle* pHandle);
|
||||
typedef int32_t (*FGetCacheSize)(struct SDataSinkHandle* pHandle, uint64_t* size);
|
||||
typedef int32_t (*FGetSinkFlags)(struct SDataSinkHandle* pHandle, uint64_t* flags);
|
||||
|
||||
typedef struct SDataSinkHandle {
|
||||
FPutDataBlock fPut;
|
||||
|
@ -48,12 +49,13 @@ typedef struct SDataSinkHandle {
|
|||
FGetDataBlock fGetData;
|
||||
FDestroyDataSinker fDestroy;
|
||||
FGetCacheSize fGetCacheSize;
|
||||
FGetSinkFlags fGetFlags;
|
||||
} SDataSinkHandle;
|
||||
|
||||
int32_t createDataDispatcher(SDataSinkManager* pManager, const SDataSinkNode* pDataSink, DataSinkHandle* pHandle);
|
||||
int32_t createDataDeleter(SDataSinkManager* pManager, const SDataSinkNode* pDataSink, DataSinkHandle* pHandle,
|
||||
int32_t createDataDispatcher(SDataSinkManager* pManager, SDataSinkNode** ppDataSink, DataSinkHandle* pHandle);
|
||||
int32_t createDataDeleter(SDataSinkManager* pManager, SDataSinkNode** ppDataSink, DataSinkHandle* pHandle,
|
||||
void* pParam);
|
||||
int32_t createDataInserter(SDataSinkManager* pManager, const SDataSinkNode* pDataSink, DataSinkHandle* pHandle,
|
||||
int32_t createDataInserter(SDataSinkManager* pManager, SDataSinkNode** ppDataSink, DataSinkHandle* pHandle,
|
||||
void* pParam);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -942,7 +942,7 @@ void updateLoadRemoteInfo(SLoadRemoteDataInfo* pInfo, int64_t numOfRows, int3
|
|||
struct SOperatorInfo* pOperator);
|
||||
|
||||
STimeWindow getFirstQualifiedTimeWindow(int64_t ts, STimeWindow* pWindow, SInterval* pInterval, int32_t order);
|
||||
int32_t getBufferPgSize(int32_t rowSize, uint32_t* defaultPgsz, uint32_t* defaultBufsz);
|
||||
int32_t getBufferPgSize(int32_t rowSize, uint32_t* defaultPgsz, int64_t* defaultBufsz);
|
||||
|
||||
extern void doDestroyExchangeOperatorInfo(void* param);
|
||||
|
||||
|
|
|
@ -581,7 +581,7 @@ int32_t doInitAggInfoSup(SAggSupporter* pAggSup, SqlFunctionCtx* pCtx, int32_t n
|
|||
}
|
||||
|
||||
uint32_t defaultPgsz = 0;
|
||||
uint32_t defaultBufsz = 0;
|
||||
int64_t defaultBufsz = 0;
|
||||
code = getBufferPgSize(pAggSup->resultRowSize, &defaultPgsz, &defaultBufsz);
|
||||
if (code) {
|
||||
qError("failed to get buff page size, rowSize:%d", pAggSup->resultRowSize);
|
||||
|
|
|
@ -131,11 +131,18 @@ int32_t createAnomalywindowOperatorInfo(SOperatorInfo* downstream, SPhysiNode* p
|
|||
|
||||
int32_t itemSize = sizeof(int32_t) + pInfo->aggSup.resultRowSize + pInfo->anomalyKey.bytes;
|
||||
pInfo->anomalySup.pResultRow = taosMemoryCalloc(1, itemSize);
|
||||
if (pInfo->anomalySup.pResultRow == NULL) {
|
||||
code = terrno;
|
||||
goto _error;
|
||||
}
|
||||
pInfo->anomalySup.blocks = taosArrayInit(16, sizeof(SSDataBlock*));
|
||||
if (pInfo->anomalySup.blocks == NULL) {
|
||||
code = terrno;
|
||||
goto _error;
|
||||
}
|
||||
pInfo->anomalySup.windows = taosArrayInit(16, sizeof(STimeWindow));
|
||||
|
||||
if (pInfo->anomalySup.windows == NULL || pInfo->anomalySup.blocks == NULL || pInfo->anomalySup.pResultRow == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
if (pInfo->anomalySup.windows == NULL) {
|
||||
code = terrno;
|
||||
goto _error;
|
||||
}
|
||||
|
||||
|
@ -269,8 +276,8 @@ static int32_t anomalyCacheBlock(SAnomalyWindowOperatorInfo* pInfo, SSDataBlock*
|
|||
int32_t code = createOneDataBlock(pSrc, true, &pDst);
|
||||
|
||||
if (code != 0) return code;
|
||||
if (pDst == NULL) return TSDB_CODE_OUT_OF_MEMORY;
|
||||
if (taosArrayPush(pInfo->anomalySup.blocks, &pDst) == NULL) return TSDB_CODE_OUT_OF_MEMORY;
|
||||
if (pDst == NULL) return code;
|
||||
if (taosArrayPush(pInfo->anomalySup.blocks, &pDst) == NULL) return terrno;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -41,6 +41,7 @@ typedef struct SDataCacheEntry {
|
|||
typedef struct SDataDeleterHandle {
|
||||
SDataSinkHandle sink;
|
||||
SDataSinkManager* pManager;
|
||||
SDataSinkNode* pSinkNode;
|
||||
SDataBlockDescNode* pSchema;
|
||||
SDataDeleterNode* pDeleter;
|
||||
SDeleterParam* pParam;
|
||||
|
@ -50,6 +51,7 @@ typedef struct SDataDeleterHandle {
|
|||
bool queryEnd;
|
||||
uint64_t useconds;
|
||||
uint64_t cachedSize;
|
||||
uint64_t flags;
|
||||
TdThreadMutex mutex;
|
||||
} SDataDeleterHandle;
|
||||
|
||||
|
@ -111,7 +113,7 @@ static int32_t allocBuf(SDataDeleterHandle* pDeleter, const SInputData* pInput,
|
|||
if (taosQueueItemSize(pDeleter->pDataBlocks) > capacity) {
|
||||
qError("SinkNode queue is full, no capacity, max:%d, current:%d, no capacity", capacity,
|
||||
taosQueueItemSize(pDeleter->pDataBlocks));
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR;
|
||||
}
|
||||
|
||||
pBuf->allocSize = sizeof(SDataCacheEntry) + sizeof(SDeleterRes);
|
||||
|
@ -257,6 +259,8 @@ static int32_t destroyDataSinker(SDataSinkHandle* pHandle) {
|
|||
}
|
||||
taosCloseQueue(pDeleter->pDataBlocks);
|
||||
(void)taosThreadMutexDestroy(&pDeleter->mutex);
|
||||
nodesDestroyNode((SNode*)pDeleter->pSinkNode);
|
||||
pDeleter->pSinkNode = NULL;
|
||||
|
||||
taosMemoryFree(pDeleter->pManager);
|
||||
|
||||
|
@ -270,8 +274,18 @@ static int32_t getCacheSize(struct SDataSinkHandle* pHandle, uint64_t* size) {
|
|||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
int32_t createDataDeleter(SDataSinkManager* pManager, const SDataSinkNode* pDataSink, DataSinkHandle* pHandle,
|
||||
|
||||
static int32_t getSinkFlags(struct SDataSinkHandle* pHandle, uint64_t* pFlags) {
|
||||
SDataDeleterHandle* pDispatcher = (SDataDeleterHandle*)pHandle;
|
||||
|
||||
*pFlags = atomic_load_64(&pDispatcher->flags);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
int32_t createDataDeleter(SDataSinkManager* pManager, SDataSinkNode** ppDataSink, DataSinkHandle* pHandle,
|
||||
void* pParam) {
|
||||
SDataSinkNode* pDataSink = *ppDataSink;
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
if (pParam == NULL) {
|
||||
code = TSDB_CODE_QRY_INVALID_INPUT;
|
||||
|
@ -296,9 +310,12 @@ int32_t createDataDeleter(SDataSinkManager* pManager, const SDataSinkNode* pData
|
|||
deleter->sink.fGetData = getDataBlock;
|
||||
deleter->sink.fDestroy = destroyDataSinker;
|
||||
deleter->sink.fGetCacheSize = getCacheSize;
|
||||
deleter->sink.fGetFlags = getSinkFlags;
|
||||
deleter->pManager = pManager;
|
||||
deleter->pDeleter = pDeleterNode;
|
||||
deleter->pSchema = pDataSink->pInputDataBlockDesc;
|
||||
deleter->pSinkNode = pDataSink;
|
||||
*ppDataSink = NULL;
|
||||
|
||||
deleter->pParam = pParam;
|
||||
deleter->status = DS_BUF_EMPTY;
|
||||
|
@ -307,6 +324,7 @@ int32_t createDataDeleter(SDataSinkManager* pManager, const SDataSinkNode* pData
|
|||
if (code) {
|
||||
goto _end;
|
||||
}
|
||||
deleter->flags = DS_FLAG_USE_MEMPOOL;
|
||||
code = taosThreadMutexInit(&deleter->mutex, NULL);
|
||||
if (code) {
|
||||
goto _end;
|
||||
|
@ -324,5 +342,8 @@ _end:
|
|||
taosMemoryFree(pManager);
|
||||
}
|
||||
|
||||
nodesDestroyNode((SNode *)*ppDataSink);
|
||||
*ppDataSink = NULL;
|
||||
|
||||
return code;
|
||||
}
|
||||
|
|
|
@ -43,6 +43,7 @@ typedef struct SDataDispatchHandle {
|
|||
SDataSinkHandle sink;
|
||||
SDataSinkManager* pManager;
|
||||
SDataBlockDescNode* pSchema;
|
||||
SDataSinkNode* pSinkNode;
|
||||
STaosQueue* pDataBlocks;
|
||||
SDataDispatchBuf nextOutput;
|
||||
int32_t outPutColCounts;
|
||||
|
@ -50,6 +51,7 @@ typedef struct SDataDispatchHandle {
|
|||
bool queryEnd;
|
||||
uint64_t useconds;
|
||||
uint64_t cachedSize;
|
||||
uint64_t flags;
|
||||
void* pCompressBuf;
|
||||
int32_t bufSize;
|
||||
TdThreadMutex mutex;
|
||||
|
@ -355,6 +357,7 @@ static int32_t destroyDataSinker(SDataSinkHandle* pHandle) {
|
|||
SDataDispatchHandle* pDispatcher = (SDataDispatchHandle*)pHandle;
|
||||
(void)atomic_sub_fetch_64(&gDataSinkStat.cachedSize, pDispatcher->cachedSize);
|
||||
taosMemoryFreeClear(pDispatcher->nextOutput.pData);
|
||||
nodesDestroyNode((SNode*)pDispatcher->pSinkNode);
|
||||
|
||||
while (!taosQueueEmpty(pDispatcher->pDataBlocks)) {
|
||||
SDataDispatchBuf* pBuf = NULL;
|
||||
|
@ -381,6 +384,13 @@ static int32_t getCacheSize(struct SDataSinkHandle* pHandle, uint64_t* size) {
|
|||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
static int32_t getSinkFlags(struct SDataSinkHandle* pHandle, uint64_t* pFlags) {
|
||||
SDataDispatchHandle* pDispatcher = (SDataDispatchHandle*)pHandle;
|
||||
|
||||
*pFlags = atomic_load_64(&pDispatcher->flags);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
static int32_t blockDescNodeCheck(SDataBlockDescNode* pInputDataBlockDesc) {
|
||||
if(tsSafetyCheckLevel == TSDB_SAFETY_CHECK_LEVELL_NEVER) {
|
||||
return TSDB_CODE_SUCCESS;
|
||||
|
@ -428,12 +438,13 @@ int32_t getOutputColCounts(SDataBlockDescNode* pInputDataBlockDesc) {
|
|||
return numOfCols;
|
||||
}
|
||||
|
||||
int32_t createDataDispatcher(SDataSinkManager* pManager, const SDataSinkNode* pDataSink, DataSinkHandle* pHandle) {
|
||||
int32_t createDataDispatcher(SDataSinkManager* pManager, SDataSinkNode** ppDataSink, DataSinkHandle* pHandle) {
|
||||
int32_t code;
|
||||
SDataSinkNode* pDataSink = *ppDataSink;
|
||||
code = blockDescNodeCheck(pDataSink->pInputDataBlockDesc);
|
||||
if (code) {
|
||||
qError("failed to check input data block desc, code:%d", code);
|
||||
return code;
|
||||
goto _return;
|
||||
}
|
||||
|
||||
SDataDispatchHandle* dispatcher = taosMemoryCalloc(1, sizeof(SDataDispatchHandle));
|
||||
|
@ -448,10 +459,12 @@ int32_t createDataDispatcher(SDataSinkManager* pManager, const SDataSinkNode* pD
|
|||
dispatcher->sink.fGetData = getDataBlock;
|
||||
dispatcher->sink.fDestroy = destroyDataSinker;
|
||||
dispatcher->sink.fGetCacheSize = getCacheSize;
|
||||
|
||||
dispatcher->sink.fGetFlags = getSinkFlags;
|
||||
dispatcher->pManager = pManager;
|
||||
pManager = NULL;
|
||||
dispatcher->pSchema = pDataSink->pInputDataBlockDesc;
|
||||
dispatcher->pSinkNode = pDataSink;
|
||||
*ppDataSink = NULL;
|
||||
dispatcher->outPutColCounts = getOutputColCounts(dispatcher->pSchema);
|
||||
dispatcher->status = DS_BUF_EMPTY;
|
||||
dispatcher->queryEnd = false;
|
||||
|
@ -466,6 +479,8 @@ int32_t createDataDispatcher(SDataSinkManager* pManager, const SDataSinkNode* pD
|
|||
goto _return;
|
||||
}
|
||||
|
||||
dispatcher->flags = DS_FLAG_USE_MEMPOOL;
|
||||
|
||||
*pHandle = dispatcher;
|
||||
return TSDB_CODE_SUCCESS;
|
||||
|
||||
|
@ -476,5 +491,9 @@ _return:
|
|||
if (dispatcher) {
|
||||
dsDestroyDataSinker(dispatcher);
|
||||
}
|
||||
|
||||
nodesDestroyNode((SNode *)*ppDataSink);
|
||||
*ppDataSink = NULL;
|
||||
|
||||
return terrno;
|
||||
}
|
||||
|
|
|
@ -45,6 +45,7 @@ typedef struct SDataInserterHandle {
|
|||
bool fullOrderColList;
|
||||
uint64_t useconds;
|
||||
uint64_t cachedSize;
|
||||
uint64_t flags;
|
||||
TdThreadMutex mutex;
|
||||
tsem_t ready;
|
||||
bool explain;
|
||||
|
@ -138,7 +139,7 @@ static int32_t sendSubmitRequest(SDataInserterHandle* pInserter, void* pMsg, int
|
|||
pParam->pInserter = pInserter;
|
||||
|
||||
pMsgSendInfo->param = pParam;
|
||||
pMsgSendInfo->paramFreeFp = taosMemoryFree;
|
||||
pMsgSendInfo->paramFreeFp = taosAutoMemoryFree;
|
||||
pMsgSendInfo->msgInfo.pData = pMsg;
|
||||
pMsgSendInfo->msgInfo.len = msgLen;
|
||||
pMsgSendInfo->msgType = TDMT_VND_SUBMIT;
|
||||
|
@ -434,6 +435,9 @@ static int32_t destroyDataSinker(SDataSinkHandle* pHandle) {
|
|||
taosMemoryFree(pInserter->pSchema);
|
||||
taosMemoryFree(pInserter->pParam);
|
||||
taosHashCleanup(pInserter->pCols);
|
||||
nodesDestroyNode((SNode *)pInserter->pNode);
|
||||
pInserter->pNode = NULL;
|
||||
|
||||
(void)taosThreadMutexDestroy(&pInserter->mutex);
|
||||
|
||||
taosMemoryFree(pInserter->pManager);
|
||||
|
@ -447,8 +451,16 @@ static int32_t getCacheSize(struct SDataSinkHandle* pHandle, uint64_t* size) {
|
|||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
int32_t createDataInserter(SDataSinkManager* pManager, const SDataSinkNode* pDataSink, DataSinkHandle* pHandle,
|
||||
static int32_t getSinkFlags(struct SDataSinkHandle* pHandle, uint64_t* pFlags) {
|
||||
SDataInserterHandle* pDispatcher = (SDataInserterHandle*)pHandle;
|
||||
|
||||
*pFlags = atomic_load_64(&pDispatcher->flags);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
int32_t createDataInserter(SDataSinkManager* pManager, SDataSinkNode** ppDataSink, DataSinkHandle* pHandle,
|
||||
void* pParam) {
|
||||
SDataSinkNode* pDataSink = *ppDataSink;
|
||||
SDataInserterHandle* inserter = taosMemoryCalloc(1, sizeof(SDataInserterHandle));
|
||||
if (NULL == inserter) {
|
||||
taosMemoryFree(pParam);
|
||||
|
@ -462,12 +474,14 @@ int32_t createDataInserter(SDataSinkManager* pManager, const SDataSinkNode* pDat
|
|||
inserter->sink.fGetData = NULL;
|
||||
inserter->sink.fDestroy = destroyDataSinker;
|
||||
inserter->sink.fGetCacheSize = getCacheSize;
|
||||
inserter->sink.fGetFlags = getSinkFlags;
|
||||
inserter->pManager = pManager;
|
||||
inserter->pNode = pInserterNode;
|
||||
inserter->pParam = pParam;
|
||||
inserter->status = DS_BUF_EMPTY;
|
||||
inserter->queryEnd = false;
|
||||
inserter->explain = pInserterNode->explain;
|
||||
*ppDataSink = NULL;
|
||||
|
||||
int64_t suid = 0;
|
||||
int32_t code = pManager->pAPI->metaFn.getTableSchema(inserter->pParam->readHandle->vnode, pInserterNode->tableId,
|
||||
|
@ -521,5 +535,8 @@ _return:
|
|||
taosMemoryFree(pManager);
|
||||
}
|
||||
|
||||
nodesDestroyNode((SNode *)*ppDataSink);
|
||||
*ppDataSink = NULL;
|
||||
|
||||
return terrno;
|
||||
}
|
||||
|
|
|
@ -39,23 +39,23 @@ int32_t dsDataSinkGetCacheSize(SDataSinkStat* pStat) {
|
|||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
int32_t dsCreateDataSinker(void* pSinkManager, const SDataSinkNode* pDataSink, DataSinkHandle* pHandle, void* pParam, const char* id) {
|
||||
int32_t dsCreateDataSinker(void* pSinkManager, SDataSinkNode** ppDataSink, DataSinkHandle* pHandle, void* pParam, const char* id) {
|
||||
SDataSinkManager* pManager = pSinkManager;
|
||||
switch ((int)nodeType(pDataSink)) {
|
||||
switch ((int)nodeType(*ppDataSink)) {
|
||||
case QUERY_NODE_PHYSICAL_PLAN_DISPATCH:
|
||||
return createDataDispatcher(pManager, pDataSink, pHandle);
|
||||
return createDataDispatcher(pManager, ppDataSink, pHandle);
|
||||
case QUERY_NODE_PHYSICAL_PLAN_DELETE: {
|
||||
return createDataDeleter(pManager, pDataSink, pHandle, pParam);
|
||||
return createDataDeleter(pManager, ppDataSink, pHandle, pParam);
|
||||
}
|
||||
case QUERY_NODE_PHYSICAL_PLAN_QUERY_INSERT: {
|
||||
return createDataInserter(pManager, pDataSink, pHandle, pParam);
|
||||
return createDataInserter(pManager, ppDataSink, pHandle, pParam);
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
taosMemoryFree(pSinkManager);
|
||||
qError("invalid input node type:%d, %s", nodeType(pDataSink), id);
|
||||
qError("invalid input node type:%d, %s", nodeType(*ppDataSink), id);
|
||||
|
||||
return TSDB_CODE_QRY_INVALID_INPUT;
|
||||
}
|
||||
|
@ -101,3 +101,9 @@ void dsDestroyDataSinker(DataSinkHandle handle) {
|
|||
(void)pHandleImpl->fDestroy(pHandleImpl);
|
||||
taosMemoryFree(pHandleImpl);
|
||||
}
|
||||
|
||||
int32_t dsGetSinkFlags(DataSinkHandle handle, uint64_t* pFlags) {
|
||||
SDataSinkHandle* pHandleImpl = (SDataSinkHandle*)handle;
|
||||
return pHandleImpl->fGetFlags(pHandleImpl, pFlags);
|
||||
}
|
||||
|
||||
|
|
|
@ -354,15 +354,15 @@ static int32_t initExchangeOperator(SExchangePhysiNode* pExNode, SExchangeInfo*
|
|||
|
||||
pInfo->pSources = taosArrayInit(numOfSources, sizeof(SDownstreamSourceNode));
|
||||
if (pInfo->pSources == NULL) {
|
||||
qError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(TSDB_CODE_OUT_OF_MEMORY));
|
||||
qError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(terrno));
|
||||
return terrno;
|
||||
}
|
||||
|
||||
if (pExNode->node.dynamicOp) {
|
||||
pInfo->pHashSources = tSimpleHashInit(numOfSources * 2, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT));
|
||||
if (NULL == pInfo->pHashSources) {
|
||||
qError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(TSDB_CODE_OUT_OF_MEMORY));
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
qError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(terrno));
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -370,7 +370,7 @@ static int32_t initExchangeOperator(SExchangePhysiNode* pExNode, SExchangeInfo*
|
|||
SDownstreamSourceNode* pNode = (SDownstreamSourceNode*)nodesListGetNode((SNodeList*)pExNode->pSrcEndPoints, i);
|
||||
if (!pNode) {
|
||||
qError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(terrno));
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
void* tmp = taosArrayPush(pInfo->pSources, pNode);
|
||||
if (!tmp) {
|
||||
|
@ -640,16 +640,16 @@ int32_t doSendFetchDataRequest(SExchangeInfo* pExchangeInfo, SExecTaskInfo* pTas
|
|||
|
||||
if (pSource->localExec) {
|
||||
SDataBuf pBuf = {0};
|
||||
int32_t code = (*pTaskInfo->localFetch.fp)(pTaskInfo->localFetch.handle, pSource->schedId, pTaskInfo->id.queryId,
|
||||
int32_t code = (*pTaskInfo->localFetch.fp)(pTaskInfo->localFetch.handle, pSource->sId, pTaskInfo->id.queryId,
|
||||
pSource->clientId, pSource->taskId, 0, pSource->execId, &pBuf.pData,
|
||||
pTaskInfo->localFetch.explainRes);
|
||||
code = loadRemoteDataCallback(pWrapper, &pBuf, code);
|
||||
QUERY_CHECK_CODE(code, lino, _end);
|
||||
taosMemoryFree(pWrapper);
|
||||
QUERY_CHECK_CODE(code, lino, _end);
|
||||
} else {
|
||||
SResFetchReq req = {0};
|
||||
req.header.vgId = pSource->addr.nodeId;
|
||||
req.sId = pSource->schedId;
|
||||
req.sId = pSource->sId;
|
||||
req.clientId = pSource->clientId;
|
||||
req.taskId = pSource->taskId;
|
||||
req.queryId = pTaskInfo->id.queryId;
|
||||
|
@ -668,7 +668,7 @@ int32_t doSendFetchDataRequest(SExchangeInfo* pExchangeInfo, SExecTaskInfo* pTas
|
|||
|
||||
int32_t msgSize = tSerializeSResFetchReq(NULL, 0, &req);
|
||||
if (msgSize < 0) {
|
||||
pTaskInfo->code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
pTaskInfo->code = msgSize;
|
||||
taosMemoryFree(pWrapper);
|
||||
freeOperatorParam(req.pOpParam, OP_GET_PARAM);
|
||||
return pTaskInfo->code;
|
||||
|
@ -676,14 +676,15 @@ int32_t doSendFetchDataRequest(SExchangeInfo* pExchangeInfo, SExecTaskInfo* pTas
|
|||
|
||||
void* msg = taosMemoryCalloc(1, msgSize);
|
||||
if (NULL == msg) {
|
||||
pTaskInfo->code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
pTaskInfo->code = terrno;
|
||||
taosMemoryFree(pWrapper);
|
||||
freeOperatorParam(req.pOpParam, OP_GET_PARAM);
|
||||
return pTaskInfo->code;
|
||||
}
|
||||
|
||||
if (tSerializeSResFetchReq(msg, msgSize, &req) < 0) {
|
||||
pTaskInfo->code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
msgSize = tSerializeSResFetchReq(msg, msgSize, &req);
|
||||
if (msgSize < 0) {
|
||||
pTaskInfo->code = msgSize;
|
||||
taosMemoryFree(pWrapper);
|
||||
taosMemoryFree(msg);
|
||||
freeOperatorParam(req.pOpParam, OP_GET_PARAM);
|
||||
|
@ -703,18 +704,19 @@ int32_t doSendFetchDataRequest(SExchangeInfo* pExchangeInfo, SExecTaskInfo* pTas
|
|||
taosMemoryFreeClear(msg);
|
||||
taosMemoryFree(pWrapper);
|
||||
qError("%s prepare message %d failed", GET_TASKID(pTaskInfo), (int32_t)sizeof(SMsgSendInfo));
|
||||
pTaskInfo->code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
pTaskInfo->code = terrno;
|
||||
return pTaskInfo->code;
|
||||
}
|
||||
|
||||
pMsgSendInfo->param = pWrapper;
|
||||
pMsgSendInfo->paramFreeFp = taosMemoryFree;
|
||||
pMsgSendInfo->paramFreeFp = taosAutoMemoryFree;
|
||||
pMsgSendInfo->msgInfo.pData = msg;
|
||||
pMsgSendInfo->msgInfo.len = msgSize;
|
||||
pMsgSendInfo->msgType = pSource->fetchMsgType;
|
||||
pMsgSendInfo->fp = loadRemoteDataCallback;
|
||||
|
||||
int64_t transporterId = 0;
|
||||
void* poolHandle = NULL;
|
||||
code = asyncSendMsgToServer(pExchangeInfo->pTransporter, &pSource->addr.epSet, &transporterId, pMsgSendInfo);
|
||||
QUERY_CHECK_CODE(code, lino, _end);
|
||||
int64_t* pRpcHandle = taosArrayGet(pExchangeInfo->pFetchRpcHandles, sourceIndex);
|
||||
|
@ -898,7 +900,7 @@ int32_t doExtractResultBlocks(SExchangeInfo* pExchangeInfo, SSourceDataInfo* pDa
|
|||
blockDataCleanup(pb);
|
||||
} else {
|
||||
code = createOneDataBlock(pExchangeInfo->pDummyBlock, false, &pb);
|
||||
QUERY_CHECK_NULL(pb, code, lino, _end, TSDB_CODE_OUT_OF_MEMORY);
|
||||
QUERY_CHECK_NULL(pb, code, lino, _end, code);
|
||||
}
|
||||
|
||||
int32_t compLen = *(int32_t*)pStart;
|
||||
|
@ -1055,7 +1057,7 @@ int32_t addSingleExchangeSource(SOperatorInfo* pOperator, SExchangeOperatorBasic
|
|||
|
||||
void* tmp = taosArrayPush(pExchangeInfo->pSourceDataInfo, &dataInfo);
|
||||
if (!tmp) {
|
||||
qError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(TSDB_CODE_OUT_OF_MEMORY));
|
||||
qError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(terrno));
|
||||
return terrno;
|
||||
}
|
||||
pIdx->inUseIdx = taosArrayGetSize(pExchangeInfo->pSourceDataInfo) - 1;
|
||||
|
|
|
@ -332,7 +332,6 @@ SArray* createSortInfo(SNodeList* pNodeList) {
|
|||
|
||||
SArray* pList = taosArrayInit(numOfCols, sizeof(SBlockOrderInfo));
|
||||
if (pList == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return pList;
|
||||
}
|
||||
|
||||
|
@ -342,7 +341,7 @@ SArray* createSortInfo(SNodeList* pNodeList) {
|
|||
qError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(terrno));
|
||||
taosArrayDestroy(pList);
|
||||
pList = NULL;
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
terrno = TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR;
|
||||
break;
|
||||
}
|
||||
SBlockOrderInfo bi = {0};
|
||||
|
@ -355,7 +354,6 @@ SArray* createSortInfo(SNodeList* pNodeList) {
|
|||
if (!tmp) {
|
||||
taosArrayDestroy(pList);
|
||||
pList = NULL;
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1129,7 +1127,7 @@ static int32_t optimizeTbnameInCondImpl(void* pVnode, SArray* pExistedUidList, S
|
|||
if (numOfExisted > 0) {
|
||||
uHash = taosHashInit(numOfExisted / 0.7, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_NO_LOCK);
|
||||
if (!uHash) {
|
||||
qError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(TSDB_CODE_OUT_OF_MEMORY));
|
||||
qError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(terrno));
|
||||
return terrno;
|
||||
}
|
||||
|
||||
|
@ -1330,7 +1328,7 @@ static int32_t copyExistedUids(SArray* pUidTagList, const SArray* pUidList) {
|
|||
STUidTagInfo info = {.uid = *uid};
|
||||
void* tmp = taosArrayPush(pUidTagList, &info);
|
||||
if (!tmp) {
|
||||
qError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(TSDB_CODE_OUT_OF_MEMORY));
|
||||
qError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(terrno));
|
||||
return code;
|
||||
}
|
||||
}
|
||||
|
@ -1356,15 +1354,13 @@ static int32_t doFilterByTagCond(STableListInfo* pListInfo, SArray* pUidList, SN
|
|||
tagFilterAssist ctx = {0};
|
||||
ctx.colHash = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_SMALLINT), false, HASH_NO_LOCK);
|
||||
if (ctx.colHash == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
QUERY_CHECK_CODE(code, lino, end);
|
||||
}
|
||||
|
||||
ctx.cInfoList = taosArrayInit(4, sizeof(SColumnInfo));
|
||||
if (ctx.cInfoList == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
QUERY_CHECK_CODE(code, lino, end);
|
||||
}
|
||||
|
||||
|
@ -1705,6 +1701,7 @@ int32_t getGroupIdFromTagsVal(void* pVnode, uint64_t uid, SNodeList* pGroupNode,
|
|||
|
||||
nodesDestroyList(groupNew);
|
||||
pAPI->metaReaderFn.clearReader(&mr);
|
||||
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -1716,7 +1713,6 @@ SArray* makeColumnArrayFromList(SNodeList* pNodeList) {
|
|||
size_t numOfCols = LIST_LENGTH(pNodeList);
|
||||
SArray* pList = taosArrayInit(numOfCols, sizeof(SColumn));
|
||||
if (pList == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -1724,7 +1720,7 @@ SArray* makeColumnArrayFromList(SNodeList* pNodeList) {
|
|||
SColumnNode* pColNode = (SColumnNode*)nodesListGetNode(pNodeList, i);
|
||||
if (!pColNode) {
|
||||
taosArrayDestroy(pList);
|
||||
qError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(TSDB_CODE_OUT_OF_MEMORY));
|
||||
qError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -1740,7 +1736,7 @@ SArray* makeColumnArrayFromList(SNodeList* pNodeList) {
|
|||
void* tmp = taosArrayPush(pList, &c);
|
||||
if (!tmp) {
|
||||
taosArrayDestroy(pList);
|
||||
qError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(TSDB_CODE_OUT_OF_MEMORY));
|
||||
qError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(terrno));
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
@ -1835,7 +1831,6 @@ static SResSchema createResSchema(int32_t type, int32_t bytes, int32_t slotId, i
|
|||
static SColumn* createColumn(int32_t blockId, int32_t slotId, int32_t colId, SDataType* pType, EColumnType colType) {
|
||||
SColumn* pCol = taosMemoryCalloc(1, sizeof(SColumn));
|
||||
if (pCol == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -2174,7 +2169,7 @@ SqlFunctionCtx* createSqlFunctionCtx(SExprInfo* pExprInfo, int32_t numOfOutput,
|
|||
}
|
||||
bool tmp = pCtx->fpSet.getEnv(pExpr->pExpr->_function.pFunctNode, &env);
|
||||
if (!tmp) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
QUERY_CHECK_CODE(code, lino, _end);
|
||||
}
|
||||
} else {
|
||||
|
@ -2187,7 +2182,7 @@ SqlFunctionCtx* createSqlFunctionCtx(SExprInfo* pExprInfo, int32_t numOfOutput,
|
|||
if (pCtx->sfp.getEnv != NULL) {
|
||||
bool tmp = pCtx->sfp.getEnv(pExpr->pExpr->_function.pFunctNode, &env);
|
||||
if (!tmp) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
QUERY_CHECK_CODE(code, lino, _end);
|
||||
}
|
||||
}
|
||||
|
@ -2236,6 +2231,8 @@ _end:
|
|||
}
|
||||
taosMemoryFreeClear(*rowEntryInfoOffset);
|
||||
taosMemoryFreeClear(pFuncCtx);
|
||||
|
||||
terrno = code;
|
||||
return NULL;
|
||||
}
|
||||
return pFuncCtx;
|
||||
|
@ -3073,6 +3070,7 @@ SNodeList* makeColsNodeArrFromSortKeys(SNodeList* pSortKeys) {
|
|||
int32_t code = nodesListMakeAppend(&ret, pSortKey->pExpr);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
qError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(code));
|
||||
terrno = code;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
@ -3098,3 +3096,4 @@ _end:
|
|||
}
|
||||
return code;
|
||||
}
|
||||
|
||||
|
|
|
@ -441,6 +441,7 @@ static int32_t filterUnqualifiedTables(const SStreamScanInfo* pScanInfo, const S
|
|||
}
|
||||
|
||||
_end:
|
||||
|
||||
pAPI->metaReaderFn.clearReader(&mr);
|
||||
(*ppArrayRes) = qa;
|
||||
|
||||
|
@ -599,6 +600,11 @@ void qUpdateOperatorParam(qTaskInfo_t tinfo, void* pParam) {
|
|||
((SExecTaskInfo*)tinfo)->paramSet = false;
|
||||
}
|
||||
|
||||
int32_t qExecutorInit(void) {
|
||||
taosThreadOnce(&initPoolOnce, initRefPool);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
int32_t qCreateExecTask(SReadHandle* readHandle, int32_t vgId, uint64_t taskId, SSubplan* pSubplan,
|
||||
qTaskInfo_t* pTaskInfo, DataSinkHandle* handle, int8_t compressResult, char* sql,
|
||||
EOPTR_EXEC_MODEL model) {
|
||||
|
@ -630,8 +636,18 @@ int32_t qCreateExecTask(SReadHandle* readHandle, int32_t vgId, uint64_t taskId,
|
|||
goto _error;
|
||||
}
|
||||
|
||||
SDataSinkNode* pSink = NULL;
|
||||
if (readHandle->localExec) {
|
||||
code = nodesCloneNode((SNode *)pSubplan->pDataSink, (SNode **)&pSink);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
qError("failed to nodesCloneNode, srcType:%d, code:%s, %s", nodeType(pSubplan->pDataSink), tstrerror(code), (*pTask)->id.str);
|
||||
taosMemoryFree(pSinkManager);
|
||||
goto _error;
|
||||
}
|
||||
}
|
||||
|
||||
// pSinkParam has been freed during create sinker.
|
||||
code = dsCreateDataSinker(pSinkManager, pSubplan->pDataSink, handle, pSinkParam, (*pTask)->id.str);
|
||||
code = dsCreateDataSinker(pSinkManager, readHandle->localExec ? &pSink : &pSubplan->pDataSink, handle, pSinkParam, (*pTask)->id.str);
|
||||
if (code) {
|
||||
qError("s-task:%s failed to create data sinker, code:%s", (*pTask)->id.str, tstrerror(code));
|
||||
}
|
||||
|
@ -726,7 +742,7 @@ int32_t qExecTaskOpt(qTaskInfo_t tinfo, SArray* pResList, uint64_t* useconds, bo
|
|||
QUERY_CHECK_CODE(code, lino, _end);
|
||||
|
||||
void* tmp = taosArrayPush(pTaskInfo->pResultBlockList, &p1);
|
||||
QUERY_CHECK_NULL(tmp, code, lino, _end, TSDB_CODE_OUT_OF_MEMORY);
|
||||
QUERY_CHECK_NULL(tmp, code, lino, _end, terrno);
|
||||
p = p1;
|
||||
} else {
|
||||
void* tmp = taosArrayGet(pTaskInfo->pResultBlockList, blockIndex);
|
||||
|
@ -881,7 +897,7 @@ int32_t qAppendTaskStopInfo(SExecTaskInfo* pTaskInfo, SExchangeOpStopInfo* pInfo
|
|||
taosWUnLockLatch(&pTaskInfo->stopInfo.lock);
|
||||
|
||||
if (!tmp) {
|
||||
qError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(TSDB_CODE_OUT_OF_MEMORY));
|
||||
qError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(terrno));
|
||||
return terrno;
|
||||
}
|
||||
return TSDB_CODE_SUCCESS;
|
||||
|
@ -1570,8 +1586,7 @@ void qProcessRspMsg(void* parent, SRpcMsg* pMsg, SEpSet* pEpSet) {
|
|||
if (pMsg->contLen > 0) {
|
||||
buf.pData = taosMemoryCalloc(1, pMsg->contLen);
|
||||
if (buf.pData == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
pMsg->code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
pMsg->code = terrno;
|
||||
} else {
|
||||
memcpy(buf.pData, pMsg->pCont, pMsg->contLen);
|
||||
}
|
||||
|
@ -1590,7 +1605,6 @@ SArray* qGetQueriedTableListInfo(qTaskInfo_t tinfo) {
|
|||
|
||||
code = getTableListInfo(pTaskInfo, &plist);
|
||||
if (code || plist == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -438,9 +438,6 @@ static int32_t doCreateConstantValColumnSMAInfo(SInputColumnInfoData* pInput, SF
|
|||
return terrno;
|
||||
}
|
||||
pInput->pColumnDataAgg[paramIndex] = da;
|
||||
if (da == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
} else {
|
||||
da = pInput->pColumnDataAgg[paramIndex];
|
||||
}
|
||||
|
@ -974,7 +971,7 @@ void destroyExprInfo(SExprInfo* pExpr, int32_t numOfExprs) {
|
|||
}
|
||||
}
|
||||
|
||||
int32_t getBufferPgSize(int32_t rowSize, uint32_t* defaultPgsz, uint32_t* defaultBufsz) {
|
||||
int32_t getBufferPgSize(int32_t rowSize, uint32_t* defaultPgsz, int64_t* defaultBufsz) {
|
||||
*defaultPgsz = 4096;
|
||||
uint32_t last = *defaultPgsz;
|
||||
while (*defaultPgsz < rowSize * 4) {
|
||||
|
@ -1056,7 +1053,7 @@ int32_t initExprSupp(SExprSupp* pSup, SExprInfo* pExprInfo, int32_t numOfExpr, S
|
|||
if (pSup->pExprInfo != NULL) {
|
||||
pSup->pCtx = createSqlFunctionCtx(pExprInfo, numOfExpr, &pSup->rowEntryInfoOffset, pStore);
|
||||
if (pSup->pCtx == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1145,7 +1142,7 @@ int32_t createDataSinkParam(SDataSinkNode* pNode, void** pParam, SExecTaskInfo*
|
|||
if (!pTable) {
|
||||
taosArrayDestroy(pDeleterParam->pUidList);
|
||||
taosMemoryFree(pDeleterParam);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR;
|
||||
}
|
||||
void* tmp = taosArrayPush(pDeleterParam->pUidList, &pTable->uid);
|
||||
if (!tmp) {
|
||||
|
|
|
@ -387,10 +387,10 @@ static int32_t initFillInfo(SFillOperatorInfo* pInfo, SExprInfo* pExpr, int32_t
|
|||
return terrno;
|
||||
}
|
||||
|
||||
if (pInfo->pFillInfo == NULL || pInfo->p == NULL) {
|
||||
if (pInfo->pFillInfo == NULL) {
|
||||
taosMemoryFree(pInfo->pFillInfo);
|
||||
taosMemoryFree(pInfo->p);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR;
|
||||
} else {
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -384,7 +384,7 @@ void freeGcBlkBufInfo(void* ptr) {
|
|||
static int32_t addBlkToDirtyBufList(SGroupCacheOperatorInfo* pGCache, SGcDownstreamCtx* pCtx, SGcBlkCacheInfo* pCache, SGcBlkBufInfo* pBufInfo) {
|
||||
if (0 != taosHashPut(pCache->pDirtyBlk, &pBufInfo->basic.blkId, sizeof(pBufInfo->basic.blkId), pBufInfo, sizeof(*pBufInfo))) {
|
||||
freeGcBlkBufInfo(pBufInfo);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
pBufInfo = taosHashGet(pCache->pDirtyBlk, &pBufInfo->basic.blkId, sizeof(pBufInfo->basic.blkId));
|
||||
if (NULL == pBufInfo) {
|
||||
|
@ -906,7 +906,7 @@ static int32_t addNewGroupData(struct SOperatorInfo* pOperator, SOperatorParam*
|
|||
|
||||
*ppGrp = taosHashGet(pGrpHash, &uid, sizeof(uid));
|
||||
if (NULL == *ppGrp) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
QRY_ERR_RET(initNewGroupData(pCtx, *ppGrp, pParam->downstreamIdx, vgId, pGCache->batchFetch, pGcParam->needCache));
|
||||
|
||||
|
@ -1147,12 +1147,12 @@ static int32_t groupCacheSessionWait(struct SOperatorInfo* pOperator, SGcDownstr
|
|||
if (NULL == pGroup->waitQueue) {
|
||||
pGroup->waitQueue = taosArrayInit(1, POINTER_BYTES);
|
||||
if (NULL == pGroup->waitQueue) {
|
||||
QRY_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
QRY_ERR_JRET(terrno);
|
||||
}
|
||||
}
|
||||
|
||||
if (NULL == taosArrayPush(pGroup->waitQueue, &pSession)) {
|
||||
QRY_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
QRY_ERR_JRET(terrno);
|
||||
}
|
||||
|
||||
if (!pSession->semInit) {
|
||||
|
@ -1413,7 +1413,7 @@ static int32_t initGroupCacheDownstreamCtx(SOperatorInfo* pOperator) {
|
|||
pCtx->lastBlkUid = 0;
|
||||
pCtx->pVgTbHash = tSimpleHashInit(10, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT));
|
||||
if (NULL == pCtx->pVgTbHash) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
tSimpleHashSetFreeFp(pCtx->pVgTbHash, freeSGcVgroupCtx);
|
||||
|
||||
|
|
|
@ -614,7 +614,6 @@ SSDataBlock* createBlockDataNotLoaded(const SOperatorInfo* pOperator, SSDataBloc
|
|||
if (pDataBlock->pBlockAgg) {
|
||||
pDstBlock->pBlockAgg = taosMemoryCalloc(numOfCols, sizeof(SColumnDataAgg));
|
||||
if (pDstBlock->pBlockAgg == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
blockDataDestroy(pDstBlock);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -1161,7 +1160,7 @@ int32_t createPartitionOperatorInfo(SOperatorInfo* downstream, SPartitionPhysiNo
|
|||
}
|
||||
|
||||
uint32_t defaultPgsz = 0;
|
||||
uint32_t defaultBufsz = 0;
|
||||
int64_t defaultBufsz = 0;
|
||||
|
||||
pInfo->binfo.pRes = createDataBlockFromDescNode(pPartNode->node.pOutputDataBlockDesc);
|
||||
QUERY_CHECK_NULL(pInfo->binfo.pRes, code, lino, _error, terrno);
|
||||
|
|
|
@ -804,7 +804,7 @@ static int32_t hJoinAddRowToHashImpl(SHJoinOperatorInfo* pJoin, SGroupData* pGro
|
|||
pRow->next = NULL;
|
||||
if (tSimpleHashPut(pJoin->pKeyHash, pTable->keyData, keyLen, &group, sizeof(group))) {
|
||||
taosMemoryFree(pRow);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
} else {
|
||||
pRow->next = pGroup->rows;
|
||||
|
@ -1201,7 +1201,7 @@ int32_t createHashJoinOperatorInfo(SOperatorInfo** pDownstream, int32_t numOfDow
|
|||
size_t hashCap = pInfo->pBuild->inputStat.inputRowNum > 0 ? (pInfo->pBuild->inputStat.inputRowNum * 1.5) : 1024;
|
||||
pInfo->pKeyHash = tSimpleHashInit(hashCap, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY));
|
||||
if (pInfo->pKeyHash == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _return;
|
||||
}
|
||||
|
||||
|
|
|
@ -331,7 +331,7 @@ int32_t openNonSortMergeOperator(SOperatorInfo* pOperator) {
|
|||
pNonSortMergeInfo->pSourceStatus =
|
||||
taosMemoryCalloc(pOperator->numOfDownstream, sizeof(*pNonSortMergeInfo->pSourceStatus));
|
||||
if (NULL == pNonSortMergeInfo->pSourceStatus) {
|
||||
pTaskInfo->code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
pTaskInfo->code = terrno;
|
||||
return pTaskInfo->code;
|
||||
}
|
||||
|
||||
|
|
|
@ -722,7 +722,7 @@ int32_t getOperatorExplainExecInfo(SOperatorInfo* operatorInfo, SArray* pExecInf
|
|||
code = getOperatorExplainExecInfo(operatorInfo->pDownstream[i], pExecInfoList);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
// taosMemoryFreeClear(*pRes);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return code;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -102,7 +102,6 @@ int32_t createExecTaskInfo(SSubplan* pPlan, SExecTaskInfo** pTaskInfo, SReadHand
|
|||
int32_t code = doCreateTask(pPlan->id.queryId, taskId, vgId, model, &pHandle->api, pTaskInfo);
|
||||
if (*pTaskInfo == NULL || code != 0) {
|
||||
nodesDestroyNode((SNode*)pPlan);
|
||||
taosMemoryFree(sql);
|
||||
return code;
|
||||
}
|
||||
|
||||
|
@ -112,7 +111,16 @@ int32_t createExecTaskInfo(SSubplan* pPlan, SExecTaskInfo** pTaskInfo, SReadHand
|
|||
}
|
||||
}
|
||||
|
||||
TSWAP((*pTaskInfo)->sql, sql);
|
||||
if (NULL != sql) {
|
||||
(*pTaskInfo)->sql = taosStrdup(sql);
|
||||
if (NULL == (*pTaskInfo)->sql) {
|
||||
code = terrno;
|
||||
nodesDestroyNode((SNode*)pPlan);
|
||||
doDestroyTask(*pTaskInfo);
|
||||
(*pTaskInfo) = NULL;
|
||||
return code;
|
||||
}
|
||||
}
|
||||
|
||||
(*pTaskInfo)->pSubplan = pPlan;
|
||||
(*pTaskInfo)->pWorkerCb = pHandle->pWorkerCb;
|
||||
|
|
|
@ -1167,7 +1167,7 @@ static int32_t createTableListInfoFromParam(SOperatorInfo* pOperator) {
|
|||
if (TSDB_CODE_DUP_KEY == terrno) {
|
||||
continue;
|
||||
}
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
info.uid = *pUid;
|
||||
|
@ -4572,11 +4572,10 @@ int32_t createStreamScanOperatorInfo(SReadHandle* pHandle, STableScanPhysiNode*
|
|||
int32_t numOfTags;
|
||||
SExprInfo* pTagExpr = createExpr(pTableScanNode->pTags, &numOfTags);
|
||||
if (pTagExpr == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
goto _error;
|
||||
}
|
||||
if (initExprSupp(&pInfo->tagCalSup, pTagExpr, numOfTags, &pTaskInfo->storageAPI.functionStore) != 0) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = initExprSupp(&pInfo->tagCalSup, pTagExpr, numOfTags, &pTaskInfo->storageAPI.functionStore);
|
||||
if (code != 0) {
|
||||
goto _error;
|
||||
}
|
||||
}
|
||||
|
@ -5173,7 +5172,7 @@ static int32_t doTagScanFromMetaEntryNext(SOperatorInfo* pOperator, SSDataBlock*
|
|||
|
||||
while (pInfo->curPos < size && pRes->info.rows < pOperator->resultInfo.capacity) {
|
||||
code = doTagScanOneTable(pOperator, pRes, &mr, &pTaskInfo->storageAPI);
|
||||
if (code != TSDB_CODE_OUT_OF_MEMORY) {
|
||||
if (code != TSDB_CODE_OUT_OF_MEMORY && code != TSDB_CODE_QRY_REACH_QMEM_THRESHOLD && code != TSDB_CODE_QRY_QUERY_MEM_EXHAUSTED) {
|
||||
// ignore other error
|
||||
code = TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -112,10 +112,10 @@ int32_t createSortOperatorInfo(SOperatorInfo* downstream, SSortPhysiNode* pSortN
|
|||
goto _error;
|
||||
}
|
||||
SNodeList* pSortColsNodeArr = makeColsNodeArrFromSortKeys(pSortNode->pSortKeys);
|
||||
if (!pSortColsNodeArr) code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
if (!pSortColsNodeArr) code = terrno;
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
pGroupIdCalc->pSortColsArr = makeColumnArrayFromList(pSortColsNodeArr);
|
||||
if (!pGroupIdCalc->pSortColsArr) code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
if (!pGroupIdCalc->pSortColsArr) code = terrno;
|
||||
nodesClearList(pSortColsNodeArr);
|
||||
}
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
|
|
|
@ -549,7 +549,7 @@ void doStreamEventSaveCheckpoint(SOperatorInfo* pOperator) {
|
|||
int32_t len = doStreamEventEncodeOpState(NULL, 0, pOperator);
|
||||
void* buf = taosMemoryCalloc(1, len);
|
||||
if (!buf) {
|
||||
qError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(TSDB_CODE_OUT_OF_MEMORY));
|
||||
qError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(terrno));
|
||||
return;
|
||||
}
|
||||
void* pBuf = buf;
|
||||
|
|
|
@ -1466,7 +1466,7 @@ void doStreamIntervalSaveCheckpoint(SOperatorInfo* pOperator) {
|
|||
int32_t len = doStreamIntervalEncodeOpState(NULL, 0, pOperator);
|
||||
void* buf = taosMemoryCalloc(1, len);
|
||||
if (!buf) {
|
||||
qError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(TSDB_CODE_OUT_OF_MEMORY));
|
||||
qError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(terrno));
|
||||
return;
|
||||
}
|
||||
void* pBuf = buf;
|
||||
|
|
|
@ -609,7 +609,6 @@ static SSDataBlock* sysTableScanUserCols(SOperatorInfo* pOperator) {
|
|||
}
|
||||
|
||||
if (!pInfo->pCur || !pInfo->pSchema) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
qError("sysTableScanUserCols failed since %s", terrstr());
|
||||
blockDataDestroy(pDataBlock);
|
||||
pInfo->loadInfo.totalRows = 0;
|
||||
|
@ -1014,7 +1013,7 @@ static int32_t sysTableGetGeomText(char* iGeom, int32_t nGeom, char** output, in
|
|||
char* outputWKT = NULL;
|
||||
|
||||
if (nGeom == 0) {
|
||||
if (!(*output = taosStrdup(""))) code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
if (!(*output = taosStrdup(""))) code = terrno;
|
||||
*nOutput = 0;
|
||||
return code;
|
||||
}
|
||||
|
@ -1112,8 +1111,9 @@ static int32_t sysTableUserTagsFillOneTableTags(const SSysTableScanInfo* pInfo,
|
|||
code = sysTableGetGeomText(tagVal.pData, tagVal.nData, &tagData, &tagLen);
|
||||
QUERY_CHECK_CODE(code, lino, _end);
|
||||
} else if (tagType == TSDB_DATA_TYPE_VARBINARY) {
|
||||
if (taosAscii2Hex(tagVal.pData, tagVal.nData, (void**)&tagData, &tagLen) < 0) {
|
||||
qError("varbinary for systable failed since %s", tstrerror(TSDB_CODE_OUT_OF_MEMORY));
|
||||
code = taosAscii2Hex(tagVal.pData, tagVal.nData, (void**)&tagData, &tagLen);
|
||||
if (code < 0) {
|
||||
qError("varbinary for systable failed since %s", tstrerror(code));
|
||||
}
|
||||
} else if (IS_VAR_DATA_TYPE(tagType)) {
|
||||
tagData = (char*)tagVal.pData;
|
||||
|
@ -1601,6 +1601,7 @@ static SSDataBlock* sysTableBuildUserTablesByUids(SOperatorInfo* pOperator) {
|
|||
|
||||
SMetaReader mr = {0};
|
||||
pAPI->metaReaderFn.initReader(&mr, pInfo->readHandle.vnode, META_READER_LOCK, &pAPI->metaFn);
|
||||
|
||||
code = doSetUserTableMetaInfo(&pAPI->metaReaderFn, &pAPI->metaFn, pInfo->readHandle.vnode, &mr, *uid, dbname, vgId,
|
||||
p, numOfRows, GET_TASKID(pTaskInfo));
|
||||
|
||||
|
@ -2396,7 +2397,7 @@ static SSDataBlock* sysTableScanFromMNode(SOperatorInfo* pOperator, SSysTableSca
|
|||
SMsgSendInfo* pMsgSendInfo = taosMemoryCalloc(1, sizeof(SMsgSendInfo));
|
||||
if (NULL == pMsgSendInfo) {
|
||||
qError("%s prepare message %d failed", GET_TASKID(pTaskInfo), (int32_t)sizeof(SMsgSendInfo));
|
||||
pTaskInfo->code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
pTaskInfo->code = terrno;
|
||||
taosMemoryFree(buf1);
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -630,7 +630,7 @@ static void doInterpUnclosedTimeWindow(SOperatorInfo* pOperatorInfo, int32_t num
|
|||
int32_t ret = setTimeWindowOutputBuf(pResultRowInfo, &w, (scanFlag == MAIN_SCAN), &pResult, groupId, pSup->pCtx,
|
||||
numOfOutput, pSup->rowEntryInfoOffset, &pInfo->aggSup, pTaskInfo);
|
||||
if (ret != TSDB_CODE_SUCCESS) {
|
||||
T_LONG_JMP(pTaskInfo->env, TSDB_CODE_OUT_OF_MEMORY);
|
||||
T_LONG_JMP(pTaskInfo->env, ret);
|
||||
}
|
||||
|
||||
if(isResultRowInterpolated(pResult, RESULT_ROW_END_INTERP)) {
|
||||
|
@ -711,7 +711,7 @@ static bool filterWindowWithLimit(SIntervalAggOperatorInfo* pOperatorInfo, STime
|
|||
if (pOperatorInfo->limit == 0) return true;
|
||||
|
||||
if (pOperatorInfo->pBQ == NULL) {
|
||||
pOperatorInfo->pBQ = createBoundedQueue(pOperatorInfo->limit - 1, tsKeyCompFn, taosMemoryFree, pOperatorInfo);
|
||||
pOperatorInfo->pBQ = createBoundedQueue(pOperatorInfo->limit - 1, tsKeyCompFn, taosAutoMemoryFree, pOperatorInfo);
|
||||
QUERY_CHECK_NULL(pOperatorInfo->pBQ, code, lino, _end, terrno);
|
||||
}
|
||||
|
||||
|
@ -780,7 +780,7 @@ static bool hashIntervalAgg(SOperatorInfo* pOperatorInfo, SResultRowInfo* pResul
|
|||
int32_t ret = setTimeWindowOutputBuf(pResultRowInfo, &win, (scanFlag == MAIN_SCAN), &pResult, tableGroupId,
|
||||
pSup->pCtx, numOfOutput, pSup->rowEntryInfoOffset, &pInfo->aggSup, pTaskInfo);
|
||||
if (ret != TSDB_CODE_SUCCESS || pResult == NULL) {
|
||||
T_LONG_JMP(pTaskInfo->env, TSDB_CODE_OUT_OF_MEMORY);
|
||||
T_LONG_JMP(pTaskInfo->env, ret);
|
||||
}
|
||||
|
||||
TSKEY ekey = ascScan ? win.ekey : win.skey;
|
||||
|
@ -827,7 +827,7 @@ static bool hashIntervalAgg(SOperatorInfo* pOperatorInfo, SResultRowInfo* pResul
|
|||
int32_t code = setTimeWindowOutputBuf(pResultRowInfo, &nextWin, (scanFlag == MAIN_SCAN), &pResult, tableGroupId,
|
||||
pSup->pCtx, numOfOutput, pSup->rowEntryInfoOffset, &pInfo->aggSup, pTaskInfo);
|
||||
if (code != TSDB_CODE_SUCCESS || pResult == NULL) {
|
||||
T_LONG_JMP(pTaskInfo->env, TSDB_CODE_OUT_OF_MEMORY);
|
||||
T_LONG_JMP(pTaskInfo->env, code);
|
||||
}
|
||||
|
||||
ekey = ascScan ? nextWin.ekey : nextWin.skey;
|
||||
|
@ -2271,7 +2271,7 @@ static void doMergeIntervalAggImpl(SOperatorInfo* pOperatorInfo, SResultRowInfo*
|
|||
setTimeWindowOutputBuf(pResultRowInfo, &win, (scanFlag == MAIN_SCAN), &pResult, tableGroupId, pExprSup->pCtx,
|
||||
numOfOutput, pExprSup->rowEntryInfoOffset, &iaInfo->aggSup, pTaskInfo);
|
||||
if (ret != TSDB_CODE_SUCCESS || pResult == NULL) {
|
||||
T_LONG_JMP(pTaskInfo->env, TSDB_CODE_OUT_OF_MEMORY);
|
||||
T_LONG_JMP(pTaskInfo->env, ret);
|
||||
}
|
||||
|
||||
TSKEY ekey = ascScan ? win.ekey : win.skey;
|
||||
|
@ -2312,7 +2312,7 @@ static void doMergeIntervalAggImpl(SOperatorInfo* pOperatorInfo, SResultRowInfo*
|
|||
int32_t code = outputPrevIntervalResult(pOperatorInfo, tableGroupId, pResultBlock, &win);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
qError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(code));
|
||||
T_LONG_JMP(pTaskInfo->env, TSDB_CODE_OUT_OF_MEMORY);
|
||||
T_LONG_JMP(pTaskInfo->env, code);
|
||||
}
|
||||
|
||||
STimeWindow nextWin = win;
|
||||
|
@ -2329,7 +2329,7 @@ static void doMergeIntervalAggImpl(SOperatorInfo* pOperatorInfo, SResultRowInfo*
|
|||
setTimeWindowOutputBuf(pResultRowInfo, &nextWin, (scanFlag == MAIN_SCAN), &pResult, tableGroupId,
|
||||
pExprSup->pCtx, numOfOutput, pExprSup->rowEntryInfoOffset, &iaInfo->aggSup, pTaskInfo);
|
||||
if (code != TSDB_CODE_SUCCESS || pResult == NULL) {
|
||||
T_LONG_JMP(pTaskInfo->env, TSDB_CODE_OUT_OF_MEMORY);
|
||||
T_LONG_JMP(pTaskInfo->env, code);
|
||||
}
|
||||
|
||||
ekey = ascScan ? nextWin.ekey : nextWin.skey;
|
||||
|
@ -2354,7 +2354,7 @@ static void doMergeIntervalAggImpl(SOperatorInfo* pOperatorInfo, SResultRowInfo*
|
|||
code = outputPrevIntervalResult(pOperatorInfo, tableGroupId, pResultBlock, &nextWin);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
qError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(code));
|
||||
T_LONG_JMP(pTaskInfo->env, TSDB_CODE_OUT_OF_MEMORY);
|
||||
T_LONG_JMP(pTaskInfo->env, code);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1647,7 +1647,7 @@ SNode* qptMakeDownstreamSrcNode(SNode** ppNode) {
|
|||
pDs->addr.nodeId = qptCtx.param.vnode.vgId;
|
||||
memcpy(&pDs->addr.epSet, &qptCtx.param.vnode.epSet, sizeof(pDs->addr.epSet));
|
||||
pDs->taskId = (QPT_CORRECT_HIGH_PROB() && qptCtx.buildCtx.pCurrTask) ? qptCtx.buildCtx.pCurrTask->id.taskId : taosRand();
|
||||
pDs->schedId = QPT_CORRECT_HIGH_PROB() ? qptCtx.param.schedulerId : taosRand();
|
||||
pDs->sId = QPT_CORRECT_HIGH_PROB() ? 0 : taosRand();
|
||||
pDs->execId = taosRand();
|
||||
pDs->fetchMsgType = QPT_CORRECT_HIGH_PROB() ? (QPT_RAND_BOOL_V ? TDMT_SCH_FETCH : TDMT_SCH_MERGE_FETCH) : taosRand();
|
||||
pDs->localExec = QPT_RAND_BOOL_V;
|
||||
|
@ -3133,7 +3133,7 @@ void qptExecPlan(SReadHandle* pReadHandle, SNode* pNode, SExecTaskInfo* pTaskInf
|
|||
case QUERY_NODE_PHYSICAL_PLAN_QUERY_INSERT:
|
||||
case QUERY_NODE_PHYSICAL_PLAN_DELETE: {
|
||||
DataSinkHandle handle = NULL;
|
||||
qptCtx.result.code = dsCreateDataSinker(NULL, (SDataSinkNode*)pNode, &handle, NULL, NULL);
|
||||
qptCtx.result.code = dsCreateDataSinker(NULL, (SDataSinkNode**)&pNode, &handle, NULL, NULL);
|
||||
dsDestroyDataSinker(handle);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ static int32_t loadDataFromFilePage(tMemBucket *pMemBucket, int32_t slotIdx, SFi
|
|||
pIdList = *(SArray **)p;
|
||||
} else {
|
||||
taosMemoryFree(*buffer);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
int32_t offset = 0;
|
||||
|
|
|
@ -836,6 +836,44 @@ static int32_t physiProjectCopy(const SProjectPhysiNode* pSrc, SProjectPhysiNode
|
|||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
static int32_t dataSinkNodeCopy(const SDataSinkNode* pSrc, SDataSinkNode* pDst) {
|
||||
CLONE_NODE_FIELD_EX(pInputDataBlockDesc, SDataBlockDescNode*);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
static int32_t physiDispatchCopy(const SDataDispatcherNode* pSrc, SDataDispatcherNode* pDst) {
|
||||
COPY_BASE_OBJECT_FIELD(sink, dataSinkNodeCopy);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
static int32_t physiInserterCopy(const SDataInserterNode* pSrc, SDataInserterNode* pDst) {
|
||||
COPY_BASE_OBJECT_FIELD(sink, dataSinkNodeCopy);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
static int32_t physiQueryInserterCopy(const SQueryInserterNode* pSrc, SQueryInserterNode* pDst) {
|
||||
COPY_BASE_OBJECT_FIELD(sink, dataSinkNodeCopy);
|
||||
CLONE_NODE_LIST_FIELD(pCols);
|
||||
COPY_SCALAR_FIELD(tableId);
|
||||
COPY_SCALAR_FIELD(stableId);
|
||||
COPY_SCALAR_FIELD(tableType);
|
||||
COPY_CHAR_ARRAY_FIELD(tableName);
|
||||
COPY_SCALAR_FIELD(vgId);
|
||||
COPY_OBJECT_FIELD(epSet, sizeof(SEpSet));
|
||||
COPY_SCALAR_FIELD(explain);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
static int32_t physiDeleterCopy(const SDataDeleterNode* pSrc, SDataDeleterNode* pDst) {
|
||||
COPY_BASE_OBJECT_FIELD(sink, dataSinkNodeCopy);
|
||||
COPY_SCALAR_FIELD(tableId);
|
||||
COPY_SCALAR_FIELD(tableType);
|
||||
COPY_CHAR_ARRAY_FIELD(tableFName);
|
||||
COPY_CHAR_ARRAY_FIELD(tsColName);
|
||||
COPY_OBJECT_FIELD(deleteTimeRange, sizeof(STimeWindow));
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
static int32_t dataBlockDescCopy(const SDataBlockDescNode* pSrc, SDataBlockDescNode* pDst) {
|
||||
COPY_SCALAR_FIELD(dataBlockId);
|
||||
CLONE_NODE_LIST_FIELD(pSlots);
|
||||
|
@ -858,7 +896,7 @@ static int32_t downstreamSourceCopy(const SDownstreamSourceNode* pSrc, SDownstre
|
|||
COPY_OBJECT_FIELD(addr, sizeof(SQueryNodeAddr));
|
||||
COPY_SCALAR_FIELD(clientId);
|
||||
COPY_SCALAR_FIELD(taskId);
|
||||
COPY_SCALAR_FIELD(schedId);
|
||||
COPY_SCALAR_FIELD(sId);
|
||||
COPY_SCALAR_FIELD(execId);
|
||||
COPY_SCALAR_FIELD(fetchMsgType);
|
||||
COPY_SCALAR_FIELD(localExec);
|
||||
|
@ -1091,6 +1129,18 @@ int32_t nodesCloneNode(const SNode* pNode, SNode** ppNode) {
|
|||
case QUERY_NODE_PHYSICAL_PLAN_PROJECT:
|
||||
code = physiProjectCopy((const SProjectPhysiNode*)pNode, (SProjectPhysiNode*)pDst);
|
||||
break;
|
||||
case QUERY_NODE_PHYSICAL_PLAN_DISPATCH:
|
||||
code = physiDispatchCopy((const SDataDispatcherNode*)pNode, (SDataDispatcherNode*)pDst);
|
||||
break;
|
||||
//case QUERY_NODE_PHYSICAL_PLAN_INSERT:
|
||||
// code = physiInserterCopy((const SDataInserterNode*)pNode, (SDataInserterNode*)pDst);
|
||||
// break;
|
||||
case QUERY_NODE_PHYSICAL_PLAN_QUERY_INSERT:
|
||||
code = physiQueryInserterCopy((const SQueryInserterNode*)pNode, (SQueryInserterNode*)pDst);
|
||||
break;
|
||||
case QUERY_NODE_PHYSICAL_PLAN_DELETE:
|
||||
code = physiDeleterCopy((const SDataDeleterNode*)pNode, (SDataDeleterNode*)pDst);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -5333,7 +5333,7 @@ static int32_t jsonToColumnDefNode(const SJson* pJson, void* pObj) {
|
|||
static const char* jkDownstreamSourceAddr = "Addr";
|
||||
static const char* jkDownstreamSourceClientId = "ClientId";
|
||||
static const char* jkDownstreamSourceTaskId = "TaskId";
|
||||
static const char* jkDownstreamSourceSchedId = "SchedId";
|
||||
static const char* jkDownstreamSourceSeriousId = "SeriousId";
|
||||
static const char* jkDownstreamSourceExecId = "ExecId";
|
||||
static const char* jkDownstreamSourceFetchMsgType = "FetchMsgType";
|
||||
|
||||
|
@ -5348,7 +5348,7 @@ static int32_t downstreamSourceNodeToJson(const void* pObj, SJson* pJson) {
|
|||
code = tjsonAddIntegerToObject(pJson, jkDownstreamSourceTaskId, pNode->taskId);
|
||||
}
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
code = tjsonAddIntegerToObject(pJson, jkDownstreamSourceSchedId, pNode->schedId);
|
||||
code = tjsonAddIntegerToObject(pJson, jkDownstreamSourceSeriousId, pNode->sId);
|
||||
}
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
code = tjsonAddIntegerToObject(pJson, jkDownstreamSourceExecId, pNode->execId);
|
||||
|
@ -5371,7 +5371,7 @@ static int32_t jsonToDownstreamSourceNode(const SJson* pJson, void* pObj) {
|
|||
code = tjsonGetUBigIntValue(pJson, jkDownstreamSourceTaskId, &pNode->taskId);
|
||||
}
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
code = tjsonGetUBigIntValue(pJson, jkDownstreamSourceSchedId, &pNode->schedId);
|
||||
code = tjsonGetUBigIntValue(pJson, jkDownstreamSourceSeriousId, &pNode->sId);
|
||||
}
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
code = tjsonGetIntValue(pJson, jkDownstreamSourceExecId, &pNode->execId);
|
||||
|
|
|
@ -1761,7 +1761,7 @@ static int32_t downstreamSourceNodeInlineToMsg(const void* pObj, STlvEncoder* pE
|
|||
code = tlvEncodeValueU64(pEncoder, pNode->taskId);
|
||||
}
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
code = tlvEncodeValueU64(pEncoder, pNode->schedId);
|
||||
code = tlvEncodeValueU64(pEncoder, pNode->sId);
|
||||
}
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
code = tlvEncodeValueI32(pEncoder, pNode->execId);
|
||||
|
@ -1788,7 +1788,7 @@ static int32_t msgToDownstreamSourceNodeInlineToMsg(STlvDecoder* pDecoder, void*
|
|||
code = tlvDecodeValueU64(pDecoder, &pNode->taskId);
|
||||
}
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
code = tlvDecodeValueU64(pDecoder, &pNode->schedId);
|
||||
code = tlvDecodeValueU64(pDecoder, &pNode->sId);
|
||||
}
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
code = tlvDecodeValueI32(pDecoder, &pNode->execId);
|
||||
|
|
|
@ -1079,7 +1079,7 @@ void nodesDestroyNode(SNode* pNode) {
|
|||
taosMemoryFreeClear(pReal->pMeta);
|
||||
taosMemoryFreeClear(pReal->pVgroupList);
|
||||
taosArrayDestroyEx(pReal->pSmaIndexes, destroySmaIndex);
|
||||
taosArrayDestroyP(pReal->tsmaTargetTbVgInfo, taosMemoryFree);
|
||||
taosArrayDestroyP(pReal->tsmaTargetTbVgInfo, NULL);
|
||||
taosArrayDestroy(pReal->tsmaTargetTbInfo);
|
||||
break;
|
||||
}
|
||||
|
@ -1627,7 +1627,7 @@ void nodesDestroyNode(SNode* pNode) {
|
|||
nodesDestroyList(pLogicNode->pTags);
|
||||
nodesDestroyNode(pLogicNode->pSubtable);
|
||||
taosArrayDestroyEx(pLogicNode->pFuncTypes, destroyFuncParam);
|
||||
taosArrayDestroyP(pLogicNode->pTsmaTargetTbVgInfo, taosMemoryFree);
|
||||
taosArrayDestroyP(pLogicNode->pTsmaTargetTbVgInfo, NULL);
|
||||
taosArrayDestroy(pLogicNode->pTsmaTargetTbInfo);
|
||||
break;
|
||||
}
|
||||
|
@ -2012,7 +2012,7 @@ int32_t nodesMakeList(SNodeList** ppListOut) {
|
|||
|
||||
int32_t nodesListAppend(SNodeList* pList, SNode* pNode) {
|
||||
if (NULL == pList || NULL == pNode) {
|
||||
return TSDB_CODE_FAILED;
|
||||
return TSDB_CODE_INVALID_PARA;
|
||||
}
|
||||
SListCell* p = NULL;
|
||||
int32_t code = nodesCalloc(1, sizeof(SListCell), (void**)&p);
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue