Merge branch '3.0' into feat/TD-30813-2
This commit is contained in:
commit
bad8df5ec1
|
@ -193,7 +193,7 @@ int32_t tColDataDecompress(void *input, SColDataCompressInfo *info, SColData *co
|
||||||
|
|
||||||
// for stmt bind
|
// for stmt bind
|
||||||
int32_t tColDataAddValueByBind(SColData *pColData, TAOS_MULTI_BIND *pBind, int32_t buffMaxLen);
|
int32_t tColDataAddValueByBind(SColData *pColData, TAOS_MULTI_BIND *pBind, int32_t buffMaxLen);
|
||||||
int32_t tColDataSortMerge(SArray *colDataArr);
|
int32_t tColDataSortMerge(SArray **arr);
|
||||||
|
|
||||||
// for raw block
|
// for raw block
|
||||||
int32_t tColDataAddValueByDataBlock(SColData *pColData, int8_t type, int32_t bytes, int32_t nRows, char *lengthOrbitmap,
|
int32_t tColDataAddValueByDataBlock(SColData *pColData, int8_t type, int32_t bytes, int32_t nRows, char *lengthOrbitmap,
|
||||||
|
|
|
@ -707,7 +707,9 @@ static FORCE_INLINE SColCmprWrapper* tCloneSColCmprWrapper(const SColCmprWrapper
|
||||||
}
|
}
|
||||||
|
|
||||||
static FORCE_INLINE int32_t tInitDefaultSColCmprWrapperByCols(SColCmprWrapper* pCmpr, int32_t nCols) {
|
static FORCE_INLINE int32_t tInitDefaultSColCmprWrapperByCols(SColCmprWrapper* pCmpr, int32_t nCols) {
|
||||||
assert(!pCmpr->pColCmpr);
|
if (!(!pCmpr->pColCmpr)) {
|
||||||
|
return TSDB_CODE_INVALID_PARA;
|
||||||
|
}
|
||||||
pCmpr->pColCmpr = (SColCmpr*)taosMemoryCalloc(nCols, sizeof(SColCmpr));
|
pCmpr->pColCmpr = (SColCmpr*)taosMemoryCalloc(nCols, sizeof(SColCmpr));
|
||||||
if (pCmpr->pColCmpr == NULL) {
|
if (pCmpr->pColCmpr == NULL) {
|
||||||
return terrno;
|
return terrno;
|
||||||
|
@ -718,7 +720,9 @@ static FORCE_INLINE int32_t tInitDefaultSColCmprWrapperByCols(SColCmprWrapper* p
|
||||||
|
|
||||||
static FORCE_INLINE int32_t tInitDefaultSColCmprWrapper(SColCmprWrapper* pCmpr, SSchemaWrapper* pSchema) {
|
static FORCE_INLINE int32_t tInitDefaultSColCmprWrapper(SColCmprWrapper* pCmpr, SSchemaWrapper* pSchema) {
|
||||||
pCmpr->nCols = pSchema->nCols;
|
pCmpr->nCols = pSchema->nCols;
|
||||||
assert(!pCmpr->pColCmpr);
|
if (!(!pCmpr->pColCmpr)) {
|
||||||
|
return TSDB_CODE_INVALID_PARA;
|
||||||
|
}
|
||||||
pCmpr->pColCmpr = (SColCmpr*)taosMemoryCalloc(pCmpr->nCols, sizeof(SColCmpr));
|
pCmpr->pColCmpr = (SColCmpr*)taosMemoryCalloc(pCmpr->nCols, sizeof(SColCmpr));
|
||||||
if (pCmpr->pColCmpr == NULL) {
|
if (pCmpr->pColCmpr == NULL) {
|
||||||
return terrno;
|
return terrno;
|
||||||
|
|
|
@ -295,7 +295,7 @@ typedef enum EFuncDataRequired {
|
||||||
} EFuncDataRequired;
|
} EFuncDataRequired;
|
||||||
|
|
||||||
EFuncDataRequired fmFuncDataRequired(SFunctionNode* pFunc, STimeWindow* pTimeWindow);
|
EFuncDataRequired fmFuncDataRequired(SFunctionNode* pFunc, STimeWindow* pTimeWindow);
|
||||||
int32_t fmFuncDynDataRequired(int32_t funcId, void* pRes, SDataBlockInfo* pBlockInfo, int32_t *reqStatus);
|
EFuncDataRequired fmFuncDynDataRequired(int32_t funcId, void* pRes, SDataBlockInfo* pBlockInfo);
|
||||||
|
|
||||||
int32_t fmGetFuncExecFuncs(int32_t funcId, SFuncExecFuncs* pFpSet);
|
int32_t fmGetFuncExecFuncs(int32_t funcId, SFuncExecFuncs* pFpSet);
|
||||||
int32_t fmGetScalarFuncExecFuncs(int32_t funcId, SScalarFuncExecFuncs* pFpSet);
|
int32_t fmGetScalarFuncExecFuncs(int32_t funcId, SScalarFuncExecFuncs* pFpSet);
|
||||||
|
|
|
@ -84,11 +84,11 @@ typedef struct SConfigItem {
|
||||||
};
|
};
|
||||||
union {
|
union {
|
||||||
int64_t imin;
|
int64_t imin;
|
||||||
double fmin;
|
float fmin;
|
||||||
};
|
};
|
||||||
union {
|
union {
|
||||||
int64_t imax;
|
int64_t imax;
|
||||||
double fmax;
|
float fmax;
|
||||||
};
|
};
|
||||||
SArray *array; // SDiskCfg/SLogVar
|
SArray *array; // SDiskCfg/SLogVar
|
||||||
} SConfigItem;
|
} SConfigItem;
|
||||||
|
|
|
@ -40,7 +40,7 @@ extern const int32_t TYPE_BYTES[21];
|
||||||
#define LONG_BYTES sizeof(int64_t)
|
#define LONG_BYTES sizeof(int64_t)
|
||||||
#define FLOAT_BYTES sizeof(float)
|
#define FLOAT_BYTES sizeof(float)
|
||||||
#define DOUBLE_BYTES sizeof(double)
|
#define DOUBLE_BYTES sizeof(double)
|
||||||
#define POINTER_BYTES sizeof(void *) // 8 by default assert(sizeof(ptrdiff_t) == sizseof(void*)
|
#define POINTER_BYTES sizeof(void *)
|
||||||
#define TSDB_KEYSIZE sizeof(TSKEY)
|
#define TSDB_KEYSIZE sizeof(TSKEY)
|
||||||
#define TSDB_NCHAR_SIZE sizeof(TdUcs4)
|
#define TSDB_NCHAR_SIZE sizeof(TdUcs4)
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@ void taosIpPort2String(uint32_t ip, uint16_t port, char *str);
|
||||||
|
|
||||||
void *tmemmem(const char *haystack, int hlen, const char *needle, int nlen);
|
void *tmemmem(const char *haystack, int hlen, const char *needle, int nlen);
|
||||||
|
|
||||||
int32_t parseCfgReal(const char *str, double *out);
|
int32_t parseCfgReal(const char *str, float *out);
|
||||||
|
|
||||||
static FORCE_INLINE void taosEncryptPass(uint8_t *inBuf, size_t inLen, char *target) {
|
static FORCE_INLINE void taosEncryptPass(uint8_t *inBuf, size_t inLen, char *target) {
|
||||||
T_MD5_CTX context;
|
T_MD5_CTX context;
|
||||||
|
|
|
@ -477,7 +477,7 @@ int32_t createTscObj(const char *user, const char *auth, const char *db, int32_t
|
||||||
STscObj **pObj) {
|
STscObj **pObj) {
|
||||||
*pObj = (STscObj *)taosMemoryCalloc(1, sizeof(STscObj));
|
*pObj = (STscObj *)taosMemoryCalloc(1, sizeof(STscObj));
|
||||||
if (NULL == *pObj) {
|
if (NULL == *pObj) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
(*pObj)->pRequests = taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_ENTRY_LOCK);
|
(*pObj)->pRequests = taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_ENTRY_LOCK);
|
||||||
|
@ -556,7 +556,7 @@ int32_t createRequest(uint64_t connId, int32_t type, int64_t reqid, SRequestObj
|
||||||
(*pRequest)->inCallback = false;
|
(*pRequest)->inCallback = false;
|
||||||
(*pRequest)->msgBuf = taosMemoryCalloc(1, ERROR_MSG_BUF_DEFAULT_SIZE);
|
(*pRequest)->msgBuf = taosMemoryCalloc(1, ERROR_MSG_BUF_DEFAULT_SIZE);
|
||||||
if (NULL == (*pRequest)->msgBuf) {
|
if (NULL == (*pRequest)->msgBuf) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _return;
|
goto _return;
|
||||||
}
|
}
|
||||||
(*pRequest)->msgBufLen = ERROR_MSG_BUF_DEFAULT_SIZE;
|
(*pRequest)->msgBufLen = ERROR_MSG_BUF_DEFAULT_SIZE;
|
||||||
|
@ -971,10 +971,6 @@ void taos_init_imp(void) {
|
||||||
|
|
||||||
tscDebug("starting to initialize TAOS driver");
|
tscDebug("starting to initialize TAOS driver");
|
||||||
|
|
||||||
#ifndef WINDOWS
|
|
||||||
taosSetCoreDump(true);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
ENV_ERR_RET(initTaskQueue(), "failed to init task queue");
|
ENV_ERR_RET(initTaskQueue(), "failed to init task queue");
|
||||||
ENV_ERR_RET(fmFuncMgtInit(), "failed to init funcMgt");
|
ENV_ERR_RET(fmFuncMgtInit(), "failed to init funcMgt");
|
||||||
ENV_ERR_RET(nodesInitAllocatorSet(), "failed to init allocator set");
|
ENV_ERR_RET(nodesInitAllocatorSet(), "failed to init allocator set");
|
||||||
|
|
|
@ -169,8 +169,7 @@ static int32_t hbGenerateVgInfoFromRsp(SDBVgInfo **pInfo, SUseDbRsp *rsp) {
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
SDBVgInfo *vgInfo = taosMemoryCalloc(1, sizeof(SDBVgInfo));
|
SDBVgInfo *vgInfo = taosMemoryCalloc(1, sizeof(SDBVgInfo));
|
||||||
if (NULL == vgInfo) {
|
if (NULL == vgInfo) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
return code;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
vgInfo->vgVersion = rsp->vgVersion;
|
vgInfo->vgVersion = rsp->vgVersion;
|
||||||
|
@ -713,7 +712,7 @@ int32_t hbGetQueryBasicInfo(SClientHbKey *connKey, SClientHbReq *req) {
|
||||||
if (NULL == hbBasic) {
|
if (NULL == hbBasic) {
|
||||||
tscError("calloc %d failed", (int32_t)sizeof(SQueryHbReqBasic));
|
tscError("calloc %d failed", (int32_t)sizeof(SQueryHbReqBasic));
|
||||||
releaseTscObj(connKey->tscRid);
|
releaseTscObj(connKey->tscRid);
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
hbBasic->connId = pTscObj->connId;
|
hbBasic->connId = pTscObj->connId;
|
||||||
|
@ -1174,7 +1173,7 @@ static FORCE_INLINE void hbMgrInitHandle() {
|
||||||
int32_t hbGatherAllInfo(SAppHbMgr *pAppHbMgr, SClientHbBatchReq **pBatchReq) {
|
int32_t hbGatherAllInfo(SAppHbMgr *pAppHbMgr, SClientHbBatchReq **pBatchReq) {
|
||||||
*pBatchReq = taosMemoryCalloc(1, sizeof(SClientHbBatchReq));
|
*pBatchReq = taosMemoryCalloc(1, sizeof(SClientHbBatchReq));
|
||||||
if (pBatchReq == NULL) {
|
if (pBatchReq == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
int32_t connKeyCnt = atomic_load_32(&pAppHbMgr->connKeyCnt);
|
int32_t connKeyCnt = atomic_load_32(&pAppHbMgr->connKeyCnt);
|
||||||
(*pBatchReq)->reqs = taosArrayInit(connKeyCnt, sizeof(SClientHbReq));
|
(*pBatchReq)->reqs = taosArrayInit(connKeyCnt, sizeof(SClientHbReq));
|
||||||
|
|
|
@ -135,7 +135,7 @@ int32_t taos_connect_internal(const char* ip, const char* user, const char* pass
|
||||||
if (pInst == NULL) {
|
if (pInst == NULL) {
|
||||||
p = taosMemoryCalloc(1, sizeof(struct SAppInstInfo));
|
p = taosMemoryCalloc(1, sizeof(struct SAppInstInfo));
|
||||||
if (NULL == p) {
|
if (NULL == p) {
|
||||||
TSC_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
TSC_ERR_JRET(terrno);
|
||||||
}
|
}
|
||||||
p->mgmtEp = epSet;
|
p->mgmtEp = epSet;
|
||||||
code = taosThreadMutexInit(&p->qnodeMutex, NULL);
|
code = taosThreadMutexInit(&p->qnodeMutex, NULL);
|
||||||
|
@ -513,9 +513,11 @@ int32_t setResSchemaInfo(SReqResultInfo* pResInfo, const SSchema* pSchema, int32
|
||||||
taosMemoryFree(pResInfo->userFields);
|
taosMemoryFree(pResInfo->userFields);
|
||||||
}
|
}
|
||||||
pResInfo->fields = taosMemoryCalloc(numOfCols, sizeof(TAOS_FIELD));
|
pResInfo->fields = taosMemoryCalloc(numOfCols, sizeof(TAOS_FIELD));
|
||||||
|
if(NULL == pResInfo->fields) return terrno;
|
||||||
pResInfo->userFields = taosMemoryCalloc(numOfCols, sizeof(TAOS_FIELD));
|
pResInfo->userFields = taosMemoryCalloc(numOfCols, sizeof(TAOS_FIELD));
|
||||||
if (NULL == pResInfo->fields || NULL == pResInfo->userFields) {
|
if (NULL == pResInfo->userFields) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
taosMemoryFree(pResInfo->fields);
|
||||||
|
return terrno;
|
||||||
}
|
}
|
||||||
if (numOfCols != pResInfo->numOfCols) {
|
if (numOfCols != pResInfo->numOfCols) {
|
||||||
tscError("numOfCols:%d != pResInfo->numOfCols:%d", numOfCols, pResInfo->numOfCols);
|
tscError("numOfCols:%d != pResInfo->numOfCols:%d", numOfCols, pResInfo->numOfCols);
|
||||||
|
@ -1594,7 +1596,7 @@ int32_t taosConnectImpl(const char* user, const char* auth, const char* db, __ta
|
||||||
static int32_t buildConnectMsg(SRequestObj* pRequest, SMsgSendInfo** pMsgSendInfo) {
|
static int32_t buildConnectMsg(SRequestObj* pRequest, SMsgSendInfo** pMsgSendInfo) {
|
||||||
*pMsgSendInfo = taosMemoryCalloc(1, sizeof(SMsgSendInfo));
|
*pMsgSendInfo = taosMemoryCalloc(1, sizeof(SMsgSendInfo));
|
||||||
if (*pMsgSendInfo == NULL) {
|
if (*pMsgSendInfo == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
(*pMsgSendInfo)->msgType = TDMT_MND_CONNECT;
|
(*pMsgSendInfo)->msgType = TDMT_MND_CONNECT;
|
||||||
|
@ -1605,7 +1607,7 @@ static int32_t buildConnectMsg(SRequestObj* pRequest, SMsgSendInfo** pMsgSendInf
|
||||||
(*pMsgSendInfo)->param = taosMemoryCalloc(1, sizeof(pRequest->self));
|
(*pMsgSendInfo)->param = taosMemoryCalloc(1, sizeof(pRequest->self));
|
||||||
if (NULL == (*pMsgSendInfo)->param) {
|
if (NULL == (*pMsgSendInfo)->param) {
|
||||||
taosMemoryFree(*pMsgSendInfo);
|
taosMemoryFree(*pMsgSendInfo);
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
*(int64_t*)(*pMsgSendInfo)->param = pRequest->self;
|
*(int64_t*)(*pMsgSendInfo)->param = pRequest->self;
|
||||||
|
@ -1981,7 +1983,11 @@ static int32_t doPrepareResPtr(SReqResultInfo* pResInfo) {
|
||||||
pResInfo->convertBuf = taosMemoryCalloc(pResInfo->numOfCols, POINTER_BYTES);
|
pResInfo->convertBuf = taosMemoryCalloc(pResInfo->numOfCols, POINTER_BYTES);
|
||||||
|
|
||||||
if (pResInfo->row == NULL || pResInfo->pCol == NULL || pResInfo->length == NULL || pResInfo->convertBuf == NULL) {
|
if (pResInfo->row == NULL || pResInfo->pCol == NULL || pResInfo->length == NULL || pResInfo->convertBuf == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
taosMemoryFree(pResInfo->row);
|
||||||
|
taosMemoryFree(pResInfo->pCol);
|
||||||
|
taosMemoryFree(pResInfo->length);
|
||||||
|
taosMemoryFree(pResInfo->convertBuf);
|
||||||
|
return terrno;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2129,7 +2135,7 @@ static int32_t doConvertJson(SReqResultInfo* pResultInfo, int32_t numOfCols, int
|
||||||
|
|
||||||
taosMemoryFreeClear(pResultInfo->convertJson);
|
taosMemoryFreeClear(pResultInfo->convertJson);
|
||||||
pResultInfo->convertJson = taosMemoryCalloc(1, dataLen);
|
pResultInfo->convertJson = taosMemoryCalloc(1, dataLen);
|
||||||
if (pResultInfo->convertJson == NULL) return TSDB_CODE_OUT_OF_MEMORY;
|
if (pResultInfo->convertJson == NULL) return terrno;
|
||||||
char* p1 = pResultInfo->convertJson;
|
char* p1 = pResultInfo->convertJson;
|
||||||
|
|
||||||
int32_t totalLen = 0;
|
int32_t totalLen = 0;
|
||||||
|
|
|
@ -966,7 +966,7 @@ int32_t cloneCatalogReq(SCatalogReq **ppTarget, SCatalogReq *pSrc) {
|
||||||
int32_t code = TSDB_CODE_SUCCESS;
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
SCatalogReq *pTarget = taosMemoryCalloc(1, sizeof(SCatalogReq));
|
SCatalogReq *pTarget = taosMemoryCalloc(1, sizeof(SCatalogReq));
|
||||||
if (pTarget == NULL) {
|
if (pTarget == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
} else {
|
} else {
|
||||||
pTarget->pDbVgroup = taosArrayDup(pSrc->pDbVgroup, NULL);
|
pTarget->pDbVgroup = taosArrayDup(pSrc->pDbVgroup, NULL);
|
||||||
pTarget->pDbCfg = taosArrayDup(pSrc->pDbCfg, NULL);
|
pTarget->pDbCfg = taosArrayDup(pSrc->pDbCfg, NULL);
|
||||||
|
@ -1175,7 +1175,7 @@ int32_t createParseContext(const SRequestObj *pRequest, SParseContext **pCxt, SS
|
||||||
|
|
||||||
*pCxt = taosMemoryCalloc(1, sizeof(SParseContext));
|
*pCxt = taosMemoryCalloc(1, sizeof(SParseContext));
|
||||||
if (*pCxt == NULL) {
|
if (*pCxt == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
**pCxt = (SParseContext){.requestId = pRequest->requestId,
|
**pCxt = (SParseContext){.requestId = pRequest->requestId,
|
||||||
|
@ -1209,7 +1209,7 @@ int32_t prepareAndParseSqlSyntax(SSqlCallbackWrapper **ppWrapper, SRequestObj *p
|
||||||
STscObj *pTscObj = pRequest->pTscObj;
|
STscObj *pTscObj = pRequest->pTscObj;
|
||||||
SSqlCallbackWrapper *pWrapper = taosMemoryCalloc(1, sizeof(SSqlCallbackWrapper));
|
SSqlCallbackWrapper *pWrapper = taosMemoryCalloc(1, sizeof(SSqlCallbackWrapper));
|
||||||
if (pWrapper == NULL) {
|
if (pWrapper == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
} else {
|
} else {
|
||||||
pWrapper->pRequest = pRequest;
|
pWrapper->pRequest = pRequest;
|
||||||
pRequest->pWrapper = pWrapper;
|
pRequest->pWrapper = pWrapper;
|
||||||
|
@ -1230,7 +1230,7 @@ int32_t prepareAndParseSqlSyntax(SSqlCallbackWrapper **ppWrapper, SRequestObj *p
|
||||||
|
|
||||||
pWrapper->pCatalogReq = taosMemoryCalloc(1, sizeof(SCatalogReq));
|
pWrapper->pCatalogReq = taosMemoryCalloc(1, sizeof(SCatalogReq));
|
||||||
if (pWrapper->pCatalogReq == NULL) {
|
if (pWrapper->pCatalogReq == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
} else {
|
} else {
|
||||||
pWrapper->pCatalogReq->forceUpdate = updateMetaForce;
|
pWrapper->pCatalogReq->forceUpdate = updateMetaForce;
|
||||||
TSC_ERR_RET(qnodeRequired(pRequest, &pWrapper->pCatalogReq->qNodeRequired));
|
TSC_ERR_RET(qnodeRequired(pRequest, &pWrapper->pCatalogReq->qNodeRequired));
|
||||||
|
|
|
@ -696,7 +696,7 @@ static void monitorSendAllSlowLogFromTempDir(int64_t clusterId) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (taosLockFile(pFile) < 0) {
|
if (taosLockFile(pFile) < 0) {
|
||||||
tscError("failed to lock file:%s since %s, maybe used by other process", filename, terrstr());
|
tscInfo("failed to lock file:%s since %s, maybe used by other process", filename, terrstr());
|
||||||
(void)taosCloseFile(&pFile);
|
(void)taosCloseFile(&pFile);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -201,7 +201,7 @@ End:
|
||||||
|
|
||||||
SMsgSendInfo* buildMsgInfoImpl(SRequestObj* pRequest) {
|
SMsgSendInfo* buildMsgInfoImpl(SRequestObj* pRequest) {
|
||||||
SMsgSendInfo* pMsgSendInfo = taosMemoryCalloc(1, sizeof(SMsgSendInfo));
|
SMsgSendInfo* pMsgSendInfo = taosMemoryCalloc(1, sizeof(SMsgSendInfo));
|
||||||
|
if(pMsgSendInfo == NULL) return pMsgSendInfo;
|
||||||
pMsgSendInfo->requestObjRefId = pRequest->self;
|
pMsgSendInfo->requestObjRefId = pRequest->self;
|
||||||
pMsgSendInfo->requestId = pRequest->requestId;
|
pMsgSendInfo->requestId = pRequest->requestId;
|
||||||
pMsgSendInfo->param = pRequest;
|
pMsgSendInfo->param = pRequest;
|
||||||
|
@ -507,7 +507,7 @@ static int32_t buildShowVariablesBlock(SArray* pVars, SSDataBlock** block) {
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
int32_t line = 0;
|
int32_t line = 0;
|
||||||
SSDataBlock* pBlock = taosMemoryCalloc(1, sizeof(SSDataBlock));
|
SSDataBlock* pBlock = taosMemoryCalloc(1, sizeof(SSDataBlock));
|
||||||
TSDB_CHECK_NULL(pBlock, code, line, END, TSDB_CODE_OUT_OF_MEMORY);
|
TSDB_CHECK_NULL(pBlock, code, line, END, terrno);
|
||||||
pBlock->info.hasVarCol = true;
|
pBlock->info.hasVarCol = true;
|
||||||
|
|
||||||
pBlock->pDataBlock = taosArrayInit(SHOW_VARIABLES_RESULT_COLS, sizeof(SColumnInfoData));
|
pBlock->pDataBlock = taosArrayInit(SHOW_VARIABLES_RESULT_COLS, sizeof(SColumnInfoData));
|
||||||
|
@ -658,7 +658,7 @@ static int32_t buildCompactDbBlock(SCompactDbRsp* pRsp, SSDataBlock** block) {
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
int32_t line = 0;
|
int32_t line = 0;
|
||||||
SSDataBlock* pBlock = taosMemoryCalloc(1, sizeof(SSDataBlock));
|
SSDataBlock* pBlock = taosMemoryCalloc(1, sizeof(SSDataBlock));
|
||||||
TSDB_CHECK_NULL(pBlock, code, line, END, TSDB_CODE_OUT_OF_MEMORY);
|
TSDB_CHECK_NULL(pBlock, code, line, END, terrno);
|
||||||
pBlock->info.hasVarCol = true;
|
pBlock->info.hasVarCol = true;
|
||||||
|
|
||||||
pBlock->pDataBlock = taosArrayInit(COMPACT_DB_RESULT_COLS, sizeof(SColumnInfoData));
|
pBlock->pDataBlock = taosArrayInit(COMPACT_DB_RESULT_COLS, sizeof(SColumnInfoData));
|
||||||
|
|
|
@ -1900,7 +1900,7 @@ static int32_t tmqWriteRawMetaDataImpl(TAOS* taos, void* data, int32_t dataLen)
|
||||||
TAOS_FIELD* fields = taosMemoryCalloc(pSW->nCols, sizeof(TAOS_FIELD));
|
TAOS_FIELD* fields = taosMemoryCalloc(pSW->nCols, sizeof(TAOS_FIELD));
|
||||||
if (fields == NULL) {
|
if (fields == NULL) {
|
||||||
SET_ERROR_MSG("calloc fields failed");
|
SET_ERROR_MSG("calloc fields failed");
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
for (int i = 0; i < pSW->nCols; i++) {
|
for (int i = 0; i < pSW->nCols; i++) {
|
||||||
|
@ -2059,7 +2059,7 @@ static int32_t encodeMqDataRsp(__encode_func__* encodeFunc, void* rspObj, tmq_ra
|
||||||
len += sizeof(int8_t) + sizeof(int32_t);
|
len += sizeof(int8_t) + sizeof(int32_t);
|
||||||
buf = taosMemoryCalloc(1, len);
|
buf = taosMemoryCalloc(1, len);
|
||||||
if (buf == NULL) {
|
if (buf == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto FAILED;
|
goto FAILED;
|
||||||
}
|
}
|
||||||
tEncoderInit(&encoder, buf, len);
|
tEncoderInit(&encoder, buf, len);
|
||||||
|
|
|
@ -104,7 +104,7 @@ int32_t smlParseValue(SSmlKv *pVal, SSmlMsgBuf *msg) {
|
||||||
}
|
}
|
||||||
char* tmp = taosMemoryCalloc(pVal->length, 1);
|
char* tmp = taosMemoryCalloc(pVal->length, 1);
|
||||||
if (tmp == NULL){
|
if (tmp == NULL){
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
(void)memcpy(tmp, pVal->value + NCHAR_ADD_LEN - 1, pVal->length - NCHAR_ADD_LEN);
|
(void)memcpy(tmp, pVal->value + NCHAR_ADD_LEN - 1, pVal->length - NCHAR_ADD_LEN);
|
||||||
code = doGeomFromText(tmp, (unsigned char **)&pVal->value, &pVal->length);
|
code = doGeomFromText(tmp, (unsigned char **)&pVal->value, &pVal->length);
|
||||||
|
|
|
@ -506,7 +506,7 @@ static int32_t doSendCommitMsg(tmq_t* tmq, int32_t vgId, SEpSet* epSet, STqOffse
|
||||||
|
|
||||||
void* buf = taosMemoryCalloc(1, sizeof(SMsgHead) + len);
|
void* buf = taosMemoryCalloc(1, sizeof(SMsgHead) + len);
|
||||||
if (buf == NULL) {
|
if (buf == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
((SMsgHead*)buf)->vgId = htonl(vgId);
|
((SMsgHead*)buf)->vgId = htonl(vgId);
|
||||||
|
@ -526,7 +526,7 @@ static int32_t doSendCommitMsg(tmq_t* tmq, int32_t vgId, SEpSet* epSet, STqOffse
|
||||||
SMqCommitCbParam* pParam = taosMemoryCalloc(1, sizeof(SMqCommitCbParam));
|
SMqCommitCbParam* pParam = taosMemoryCalloc(1, sizeof(SMqCommitCbParam));
|
||||||
if (pParam == NULL) {
|
if (pParam == NULL) {
|
||||||
taosMemoryFree(buf);
|
taosMemoryFree(buf);
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
pParam->params = pParamSet;
|
pParam->params = pParamSet;
|
||||||
|
@ -540,7 +540,7 @@ static int32_t doSendCommitMsg(tmq_t* tmq, int32_t vgId, SEpSet* epSet, STqOffse
|
||||||
if (pMsgSendInfo == NULL) {
|
if (pMsgSendInfo == NULL) {
|
||||||
taosMemoryFree(buf);
|
taosMemoryFree(buf);
|
||||||
taosMemoryFree(pParam);
|
taosMemoryFree(pParam);
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
pMsgSendInfo->msgInfo = (SDataBuf){.pData = buf, .len = sizeof(SMsgHead) + len, .handle = NULL};
|
pMsgSendInfo->msgInfo = (SDataBuf){.pData = buf, .len = sizeof(SMsgHead) + len, .handle = NULL};
|
||||||
|
@ -581,7 +581,7 @@ static int32_t prepareCommitCbParamSet(tmq_t* tmq, tmq_commit_cb* pCommitFp, voi
|
||||||
SMqCommitCbParamSet** ppParamSet) {
|
SMqCommitCbParamSet** ppParamSet) {
|
||||||
SMqCommitCbParamSet* pParamSet = taosMemoryCalloc(1, sizeof(SMqCommitCbParamSet));
|
SMqCommitCbParamSet* pParamSet = taosMemoryCalloc(1, sizeof(SMqCommitCbParamSet));
|
||||||
if (pParamSet == NULL) {
|
if (pParamSet == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
pParamSet->refId = tmq->refId;
|
pParamSet->refId = tmq->refId;
|
||||||
|
@ -1382,7 +1382,7 @@ int32_t tmq_subscribe(tmq_t* tmq, const tmq_list_t* topic_list) {
|
||||||
}
|
}
|
||||||
char* topicFName = taosMemoryCalloc(1, TSDB_TOPIC_FNAME_LEN);
|
char* topicFName = taosMemoryCalloc(1, TSDB_TOPIC_FNAME_LEN);
|
||||||
if (topicFName == NULL) {
|
if (topicFName == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto FAIL;
|
goto FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1414,7 +1414,7 @@ int32_t tmq_subscribe(tmq_t* tmq, const tmq_list_t* topic_list) {
|
||||||
|
|
||||||
sendInfo = taosMemoryCalloc(1, sizeof(SMsgSendInfo));
|
sendInfo = taosMemoryCalloc(1, sizeof(SMsgSendInfo));
|
||||||
if (sendInfo == NULL) {
|
if (sendInfo == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
taosMemoryFree(buf);
|
taosMemoryFree(buf);
|
||||||
goto FAIL;
|
goto FAIL;
|
||||||
}
|
}
|
||||||
|
@ -1843,7 +1843,7 @@ void tmqBuildConsumeReqImpl(SMqPollReq* pReq, tmq_t* tmq, int64_t timeout, SMqCl
|
||||||
int32_t tmqBuildMetaRspFromWrapper(SMqPollRspWrapper* pWrapper, SMqMetaRspObj** ppRspObj) {
|
int32_t tmqBuildMetaRspFromWrapper(SMqPollRspWrapper* pWrapper, SMqMetaRspObj** ppRspObj) {
|
||||||
SMqMetaRspObj* pRspObj = taosMemoryCalloc(1, sizeof(SMqMetaRspObj));
|
SMqMetaRspObj* pRspObj = taosMemoryCalloc(1, sizeof(SMqMetaRspObj));
|
||||||
if (pRspObj == NULL) {
|
if (pRspObj == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
pRspObj->resType = RES_TYPE__TMQ_META;
|
pRspObj->resType = RES_TYPE__TMQ_META;
|
||||||
tstrncpy(pRspObj->topic, pWrapper->topicHandle->topicName, TSDB_TOPIC_FNAME_LEN);
|
tstrncpy(pRspObj->topic, pWrapper->topicHandle->topicName, TSDB_TOPIC_FNAME_LEN);
|
||||||
|
@ -1858,7 +1858,7 @@ int32_t tmqBuildMetaRspFromWrapper(SMqPollRspWrapper* pWrapper, SMqMetaRspObj**
|
||||||
int32_t tmqBuildBatchMetaRspFromWrapper(SMqPollRspWrapper* pWrapper, SMqBatchMetaRspObj** ppRspObj) {
|
int32_t tmqBuildBatchMetaRspFromWrapper(SMqPollRspWrapper* pWrapper, SMqBatchMetaRspObj** ppRspObj) {
|
||||||
SMqBatchMetaRspObj* pRspObj = taosMemoryCalloc(1, sizeof(SMqBatchMetaRspObj));
|
SMqBatchMetaRspObj* pRspObj = taosMemoryCalloc(1, sizeof(SMqBatchMetaRspObj));
|
||||||
if (pRspObj == NULL) {
|
if (pRspObj == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
pRspObj->common.resType = RES_TYPE__TMQ_BATCH_META;
|
pRspObj->common.resType = RES_TYPE__TMQ_BATCH_META;
|
||||||
tstrncpy(pRspObj->common.topic, pWrapper->topicHandle->topicName, TSDB_TOPIC_FNAME_LEN);
|
tstrncpy(pRspObj->common.topic, pWrapper->topicHandle->topicName, TSDB_TOPIC_FNAME_LEN);
|
||||||
|
@ -1969,7 +1969,7 @@ int32_t tmqBuildRspFromWrapper(SMqPollRspWrapper* pWrapper, SMqClientVg* pVg, in
|
||||||
SMqRspObj** ppRspObj) {
|
SMqRspObj** ppRspObj) {
|
||||||
SMqRspObj* pRspObj = taosMemoryCalloc(1, sizeof(SMqRspObj));
|
SMqRspObj* pRspObj = taosMemoryCalloc(1, sizeof(SMqRspObj));
|
||||||
if (pRspObj == NULL) {
|
if (pRspObj == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
pRspObj->common.resType = RES_TYPE__TMQ;
|
pRspObj->common.resType = RES_TYPE__TMQ;
|
||||||
(void)memcpy(&pRspObj->rsp, &pWrapper->dataRsp, sizeof(SMqDataRsp));
|
(void)memcpy(&pRspObj->rsp, &pWrapper->dataRsp, sizeof(SMqDataRsp));
|
||||||
|
@ -1982,7 +1982,7 @@ int32_t tmqBuildTaosxRspFromWrapper(SMqPollRspWrapper* pWrapper, SMqClientVg* pV
|
||||||
SMqTaosxRspObj** ppRspObj) {
|
SMqTaosxRspObj** ppRspObj) {
|
||||||
SMqTaosxRspObj* pRspObj = taosMemoryCalloc(1, sizeof(SMqTaosxRspObj));
|
SMqTaosxRspObj* pRspObj = taosMemoryCalloc(1, sizeof(SMqTaosxRspObj));
|
||||||
if (pRspObj == NULL) {
|
if (pRspObj == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
pRspObj->common.resType = RES_TYPE__TMQ_METADATA;
|
pRspObj->common.resType = RES_TYPE__TMQ_METADATA;
|
||||||
(void)memcpy(&pRspObj->rsp, &pWrapper->taosxRsp, sizeof(STaosxRsp));
|
(void)memcpy(&pRspObj->rsp, &pWrapper->taosxRsp, sizeof(STaosxRsp));
|
||||||
|
@ -2008,8 +2008,7 @@ static int32_t doTmqPollImpl(tmq_t* pTmq, SMqClientTopic* pTopic, SMqClientVg* p
|
||||||
|
|
||||||
msg = taosMemoryCalloc(1, msgSize);
|
msg = taosMemoryCalloc(1, msgSize);
|
||||||
if (NULL == msg) {
|
if (NULL == msg) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
return code;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tSerializeSMqPollReq(msg, msgSize, &req) < 0) {
|
if (tSerializeSMqPollReq(msg, msgSize, &req) < 0) {
|
||||||
|
@ -2032,10 +2031,9 @@ static int32_t doTmqPollImpl(tmq_t* pTmq, SMqClientTopic* pTopic, SMqClientVg* p
|
||||||
|
|
||||||
sendInfo = taosMemoryCalloc(1, sizeof(SMsgSendInfo));
|
sendInfo = taosMemoryCalloc(1, sizeof(SMsgSendInfo));
|
||||||
if (sendInfo == NULL) {
|
if (sendInfo == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
|
||||||
taosMemoryFreeClear(pParam);
|
taosMemoryFreeClear(pParam);
|
||||||
taosMemoryFreeClear(msg);
|
taosMemoryFreeClear(msg);
|
||||||
return code;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
sendInfo->msgInfo = (SDataBuf){.pData = msg, .len = msgSize, .handle = NULL};
|
sendInfo->msgInfo = (SDataBuf){.pData = msg, .len = msgSize, .handle = NULL};
|
||||||
|
@ -2956,7 +2954,7 @@ int32_t askEp(tmq_t* pTmq, void* param, bool sync, bool updateEpSet) {
|
||||||
pReq = taosMemoryCalloc(1, tlen);
|
pReq = taosMemoryCalloc(1, tlen);
|
||||||
if (pReq == NULL) {
|
if (pReq == NULL) {
|
||||||
tscError("consumer:0x%" PRIx64 ", failed to malloc askEpReq msg, size:%d", pTmq->consumerId, tlen);
|
tscError("consumer:0x%" PRIx64 ", failed to malloc askEpReq msg, size:%d", pTmq->consumerId, tlen);
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tSerializeSMqAskEpReq(pReq, tlen, &req) < 0) {
|
if (tSerializeSMqAskEpReq(pReq, tlen, &req) < 0) {
|
||||||
|
@ -2969,7 +2967,7 @@ int32_t askEp(tmq_t* pTmq, void* param, bool sync, bool updateEpSet) {
|
||||||
if (pParam == NULL) {
|
if (pParam == NULL) {
|
||||||
tscError("consumer:0x%" PRIx64 ", failed to malloc subscribe param", pTmq->consumerId);
|
tscError("consumer:0x%" PRIx64 ", failed to malloc subscribe param", pTmq->consumerId);
|
||||||
taosMemoryFree(pReq);
|
taosMemoryFree(pReq);
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
pParam->refId = pTmq->refId;
|
pParam->refId = pTmq->refId;
|
||||||
|
@ -2980,7 +2978,7 @@ int32_t askEp(tmq_t* pTmq, void* param, bool sync, bool updateEpSet) {
|
||||||
if (sendInfo == NULL) {
|
if (sendInfo == NULL) {
|
||||||
taosMemoryFree(pReq);
|
taosMemoryFree(pReq);
|
||||||
taosMemoryFree(pParam);
|
taosMemoryFree(pParam);
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
sendInfo->msgInfo = (SDataBuf){.pData = pReq, .len = tlen, .handle = NULL};
|
sendInfo->msgInfo = (SDataBuf){.pData = pReq, .len = tlen, .handle = NULL};
|
||||||
|
@ -3175,7 +3173,7 @@ int64_t getCommittedFromServer(tmq_t* tmq, char* tname, int32_t vgId, SEpSet* ep
|
||||||
|
|
||||||
void* buf = taosMemoryCalloc(1, sizeof(SMsgHead) + len);
|
void* buf = taosMemoryCalloc(1, sizeof(SMsgHead) + len);
|
||||||
if (buf == NULL) {
|
if (buf == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
((SMsgHead*)buf)->vgId = htonl(vgId);
|
((SMsgHead*)buf)->vgId = htonl(vgId);
|
||||||
|
@ -3195,14 +3193,14 @@ int64_t getCommittedFromServer(tmq_t* tmq, char* tname, int32_t vgId, SEpSet* ep
|
||||||
SMsgSendInfo* sendInfo = taosMemoryCalloc(1, sizeof(SMsgSendInfo));
|
SMsgSendInfo* sendInfo = taosMemoryCalloc(1, sizeof(SMsgSendInfo));
|
||||||
if (sendInfo == NULL) {
|
if (sendInfo == NULL) {
|
||||||
taosMemoryFree(buf);
|
taosMemoryFree(buf);
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
SMqCommittedParam* pParam = taosMemoryMalloc(sizeof(SMqCommittedParam));
|
SMqCommittedParam* pParam = taosMemoryMalloc(sizeof(SMqCommittedParam));
|
||||||
if (pParam == NULL) {
|
if (pParam == NULL) {
|
||||||
taosMemoryFree(buf);
|
taosMemoryFree(buf);
|
||||||
taosMemoryFree(sendInfo);
|
taosMemoryFree(sendInfo);
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
if (tsem2_init(&pParam->sem, 0, 0) != 0) {
|
if (tsem2_init(&pParam->sem, 0, 0) != 0) {
|
||||||
taosMemoryFree(buf);
|
taosMemoryFree(buf);
|
||||||
|
@ -3393,7 +3391,7 @@ int32_t tmq_get_topic_assignment(tmq_t* tmq, const char* pTopicName, tmq_topic_a
|
||||||
if (*assignment == NULL) {
|
if (*assignment == NULL) {
|
||||||
tscError("consumer:0x%" PRIx64 " failed to malloc buffer, size:%" PRIzu, tmq->consumerId,
|
tscError("consumer:0x%" PRIx64 " failed to malloc buffer, size:%" PRIzu, tmq->consumerId,
|
||||||
(*numOfAssignment) * sizeof(tmq_topic_assignment));
|
(*numOfAssignment) * sizeof(tmq_topic_assignment));
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3421,7 +3419,7 @@ int32_t tmq_get_topic_assignment(tmq_t* tmq, const char* pTopicName, tmq_topic_a
|
||||||
if (needFetch) {
|
if (needFetch) {
|
||||||
pCommon = taosMemoryCalloc(1, sizeof(SMqVgCommon));
|
pCommon = taosMemoryCalloc(1, sizeof(SMqVgCommon));
|
||||||
if (pCommon == NULL) {
|
if (pCommon == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3468,7 +3466,7 @@ int32_t tmq_get_topic_assignment(tmq_t* tmq, const char* pTopicName, tmq_topic_a
|
||||||
char* msg = taosMemoryCalloc(1, msgSize);
|
char* msg = taosMemoryCalloc(1, msgSize);
|
||||||
if (NULL == msg) {
|
if (NULL == msg) {
|
||||||
taosMemoryFree(pParam);
|
taosMemoryFree(pParam);
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3483,7 +3481,7 @@ int32_t tmq_get_topic_assignment(tmq_t* tmq, const char* pTopicName, tmq_topic_a
|
||||||
if (sendInfo == NULL) {
|
if (sendInfo == NULL) {
|
||||||
taosMemoryFree(pParam);
|
taosMemoryFree(pParam);
|
||||||
taosMemoryFree(msg);
|
taosMemoryFree(msg);
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3631,7 +3629,7 @@ int32_t tmq_offset_seek(tmq_t* tmq, const char* pTopicName, int32_t vgId, int64_
|
||||||
|
|
||||||
char* msg = taosMemoryCalloc(1, msgSize);
|
char* msg = taosMemoryCalloc(1, msgSize);
|
||||||
if (NULL == msg) {
|
if (NULL == msg) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tSerializeSMqSeekReq(msg, msgSize, &req) < 0) {
|
if (tSerializeSMqSeekReq(msg, msgSize, &req) < 0) {
|
||||||
|
@ -3642,7 +3640,7 @@ int32_t tmq_offset_seek(tmq_t* tmq, const char* pTopicName, int32_t vgId, int64_
|
||||||
SMsgSendInfo* sendInfo = taosMemoryCalloc(1, sizeof(SMsgSendInfo));
|
SMsgSendInfo* sendInfo = taosMemoryCalloc(1, sizeof(SMsgSendInfo));
|
||||||
if (sendInfo == NULL) {
|
if (sendInfo == NULL) {
|
||||||
taosMemoryFree(msg);
|
taosMemoryFree(msg);
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
SMqSeekParam* pParam = taosMemoryMalloc(sizeof(SMqSeekParam));
|
SMqSeekParam* pParam = taosMemoryMalloc(sizeof(SMqSeekParam));
|
||||||
|
|
|
@ -1232,7 +1232,7 @@ int32_t dataBlockCompar(const void* p1, const void* p2, const void* param) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t blockDataAssign(SColumnInfoData* pCols, const SSDataBlock* pDataBlock, const int32_t* index) {
|
static void blockDataAssign(SColumnInfoData* pCols, const SSDataBlock* pDataBlock, const int32_t* index) {
|
||||||
size_t numOfCols = taosArrayGetSize(pDataBlock->pDataBlock);
|
size_t numOfCols = taosArrayGetSize(pDataBlock->pDataBlock);
|
||||||
for (int32_t i = 0; i < numOfCols; ++i) {
|
for (int32_t i = 0; i < numOfCols; ++i) {
|
||||||
SColumnInfoData* pDst = &pCols[i];
|
SColumnInfoData* pDst = &pCols[i];
|
||||||
|
@ -1260,8 +1260,6 @@ static int32_t blockDataAssign(SColumnInfoData* pCols, const SSDataBlock* pDataB
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return TSDB_CODE_SUCCESS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t createHelpColInfoData(const SSDataBlock* pDataBlock, SColumnInfoData** ppCols) {
|
static int32_t createHelpColInfoData(const SSDataBlock* pDataBlock, SColumnInfoData** ppCols) {
|
||||||
|
@ -1448,18 +1446,16 @@ int32_t blockDataSort(SSDataBlock* pDataBlock, SArray* pOrderInfo) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t p2 = taosGetTimestampUs();
|
int64_t p2 = taosGetTimestampUs();
|
||||||
code = blockDataAssign(pCols, pDataBlock, index);
|
blockDataAssign(pCols, pDataBlock, index);
|
||||||
if (code) {
|
|
||||||
return code;
|
|
||||||
}
|
|
||||||
|
|
||||||
int64_t p3 = taosGetTimestampUs();
|
int64_t p3 = taosGetTimestampUs();
|
||||||
copyBackToBlock(pDataBlock, pCols);
|
copyBackToBlock(pDataBlock, pCols);
|
||||||
int64_t p4 = taosGetTimestampUs();
|
|
||||||
|
|
||||||
|
int64_t p4 = taosGetTimestampUs();
|
||||||
uDebug("blockDataSort complex sort:%" PRId64 ", create:%" PRId64 ", assign:%" PRId64 ", copyback:%" PRId64
|
uDebug("blockDataSort complex sort:%" PRId64 ", create:%" PRId64 ", assign:%" PRId64 ", copyback:%" PRId64
|
||||||
", rows:%d\n",
|
", rows:%d\n",
|
||||||
p1 - p0, p2 - p1, p3 - p2, p4 - p3, rows);
|
p1 - p0, p2 - p1, p3 - p2, p4 - p3, rows);
|
||||||
|
|
||||||
destroyTupleIndex(index);
|
destroyTupleIndex(index);
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3494,229 +3494,74 @@ static int32_t tColDataSort(SColData *aColData, int32_t nColData) {
|
||||||
|
|
||||||
return tColDataMergeSort(aColData, 0, nVal - 1, nColData);
|
return tColDataMergeSort(aColData, 0, nVal - 1, nColData);
|
||||||
}
|
}
|
||||||
static void tColDataMergeImpl(SColData *pColData, int32_t iStart, int32_t iEnd /* not included */) {
|
|
||||||
switch (pColData->flag) {
|
static int32_t tColDataMerge(SArray **colArr) {
|
||||||
case HAS_NONE:
|
int32_t code = 0;
|
||||||
case HAS_NULL: {
|
SArray *src = *colArr;
|
||||||
pColData->nVal -= (iEnd - iStart - 1);
|
SArray *dst = NULL;
|
||||||
} break;
|
|
||||||
case (HAS_NULL | HAS_NONE): {
|
dst = taosArrayInit(taosArrayGetSize(src), sizeof(SColData));
|
||||||
if (GET_BIT1(pColData->pBitMap, iStart) == 0) {
|
if (dst == NULL) {
|
||||||
for (int32_t i = iStart + 1; i < iEnd; ++i) {
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
if (GET_BIT1(pColData->pBitMap, i) == 1) {
|
|
||||||
SET_BIT1(pColData->pBitMap, iStart, 1);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (int32_t i = iEnd, j = iStart + 1; i < pColData->nVal; ++i, ++j) {
|
|
||||||
SET_BIT1(pColData->pBitMap, j, GET_BIT1(pColData->pBitMap, i));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pColData->nVal -= (iEnd - iStart - 1);
|
for (int32_t i = 0; i < taosArrayGetSize(src); i++) {
|
||||||
|
SColData *srcCol = taosArrayGet(src, i);
|
||||||
|
|
||||||
uint8_t flag = 0;
|
SColData *dstCol = taosArrayReserve(dst, 1);
|
||||||
for (int32_t i = 0; i < pColData->nVal; ++i) {
|
if (dstCol == NULL) {
|
||||||
uint8_t bv = GET_BIT1(pColData->pBitMap, i);
|
code = terrno;
|
||||||
if (bv == BIT_FLG_NONE) {
|
goto _exit;
|
||||||
flag |= HAS_NONE;
|
}
|
||||||
} else if (bv == BIT_FLG_NULL) {
|
tColDataInit(dstCol, srcCol->cid, srcCol->type, srcCol->cflag);
|
||||||
flag |= HAS_NULL;
|
}
|
||||||
|
|
||||||
|
int32_t numRows = ((SColData *)TARRAY_DATA(src))->nVal;
|
||||||
|
SRowKey lastKey;
|
||||||
|
for (int32_t i = 0; i < numRows; i++) {
|
||||||
|
SRowKey key;
|
||||||
|
tColDataArrGetRowKey((SColData *)TARRAY_DATA(src), taosArrayGetSize(src), i, &key);
|
||||||
|
|
||||||
|
if (i == 0 || tRowKeyCompare(&key, &lastKey) != 0) { // append new row
|
||||||
|
for (int32_t j = 0; j < taosArrayGetSize(src); j++) {
|
||||||
|
SColData *srcCol = taosArrayGet(src, j);
|
||||||
|
SColData *dstCol = taosArrayGet(dst, j);
|
||||||
|
|
||||||
|
SColVal cv;
|
||||||
|
tColDataGetValue(srcCol, i, &cv);
|
||||||
|
code = tColDataAppendValue(dstCol, &cv);
|
||||||
|
if (code) {
|
||||||
|
goto _exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
lastKey = key;
|
||||||
|
} else { // update existing row
|
||||||
|
for (int32_t j = 0; j < taosArrayGetSize(src); j++) {
|
||||||
|
SColData *srcCol = taosArrayGet(src, j);
|
||||||
|
SColData *dstCol = taosArrayGet(dst, j);
|
||||||
|
|
||||||
|
SColVal cv;
|
||||||
|
tColDataGetValue(srcCol, i, &cv);
|
||||||
|
code = tColDataUpdateValue(dstCol, &cv, true);
|
||||||
|
if (code) {
|
||||||
|
goto _exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_exit:
|
||||||
|
if (code) {
|
||||||
|
taosArrayDestroyEx(dst, tColDataDestroy);
|
||||||
} else {
|
} else {
|
||||||
uError("invalid bit value:%d", bv);
|
taosArrayDestroyEx(src, tColDataDestroy);
|
||||||
return;
|
*colArr = dst;
|
||||||
}
|
|
||||||
|
|
||||||
if (flag == pColData->flag) break;
|
|
||||||
}
|
|
||||||
pColData->flag = flag;
|
|
||||||
} break;
|
|
||||||
case HAS_VALUE: {
|
|
||||||
if (IS_VAR_DATA_TYPE(pColData->type)) {
|
|
||||||
int32_t nDiff = pColData->aOffset[iEnd - 1] - pColData->aOffset[iStart];
|
|
||||||
|
|
||||||
memmove(pColData->pData + pColData->aOffset[iStart], pColData->pData + pColData->aOffset[iEnd - 1],
|
|
||||||
pColData->nData - pColData->aOffset[iEnd - 1]);
|
|
||||||
pColData->nData -= nDiff;
|
|
||||||
|
|
||||||
for (int32_t i = iEnd, j = iStart + 1; i < pColData->nVal; ++i, ++j) {
|
|
||||||
pColData->aOffset[j] = pColData->aOffset[i] - nDiff;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
memmove(pColData->pData + TYPE_BYTES[pColData->type] * iStart,
|
|
||||||
pColData->pData + TYPE_BYTES[pColData->type] * (iEnd - 1),
|
|
||||||
TYPE_BYTES[pColData->type] * (pColData->nVal - iEnd + 1));
|
|
||||||
pColData->nData -= (TYPE_BYTES[pColData->type] * (iEnd - iStart - 1));
|
|
||||||
}
|
|
||||||
|
|
||||||
pColData->nVal -= (iEnd - iStart - 1);
|
|
||||||
} break;
|
|
||||||
case (HAS_VALUE | HAS_NONE): {
|
|
||||||
uint8_t bv;
|
|
||||||
int32_t iv;
|
|
||||||
for (int32_t i = iEnd - 1; i >= iStart; --i) {
|
|
||||||
bv = GET_BIT1(pColData->pBitMap, i);
|
|
||||||
if (bv) {
|
|
||||||
iv = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bv) { // has a value
|
|
||||||
if (IS_VAR_DATA_TYPE(pColData->type)) {
|
|
||||||
if (iv != iStart) {
|
|
||||||
memmove(&pColData->pData[pColData->aOffset[iStart]], &pColData->pData[pColData->aOffset[iv]],
|
|
||||||
iv < (pColData->nVal - 1) ? pColData->aOffset[iv + 1] - pColData->aOffset[iv]
|
|
||||||
: pColData->nData - pColData->aOffset[iv]);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (iv != iStart) {
|
|
||||||
(void)memcpy(&pColData->pData[TYPE_BYTES[pColData->type] * iStart],
|
|
||||||
&pColData->pData[TYPE_BYTES[pColData->type] * iv], TYPE_BYTES[pColData->type]);
|
|
||||||
}
|
|
||||||
memmove(&pColData->pData[TYPE_BYTES[pColData->type] * (iStart + 1)],
|
|
||||||
&pColData->pData[TYPE_BYTES[pColData->type] * iEnd],
|
|
||||||
TYPE_BYTES[pColData->type] * (iEnd - iStart - 1));
|
|
||||||
pColData->nData -= (TYPE_BYTES[pColData->type] * (iEnd - iStart - 1));
|
|
||||||
}
|
|
||||||
|
|
||||||
SET_BIT1(pColData->pBitMap, iStart, 1);
|
|
||||||
for (int32_t i = iEnd, j = iStart + 1; i < pColData->nVal; ++i, ++j) {
|
|
||||||
SET_BIT1(pColData->pBitMap, j, GET_BIT1(pColData->pBitMap, i));
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t flag = HAS_VALUE;
|
|
||||||
for (int32_t i = 0; i < pColData->nVal - (iEnd - iStart - 1); ++i) {
|
|
||||||
if (GET_BIT1(pColData->pBitMap, i) == 0) {
|
|
||||||
flag |= HAS_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (flag == pColData->flag) break;
|
|
||||||
}
|
|
||||||
pColData->flag = flag;
|
|
||||||
} else { // all NONE
|
|
||||||
if (IS_VAR_DATA_TYPE(pColData->type)) {
|
|
||||||
int32_t nDiff = pColData->aOffset[iEnd - 1] - pColData->aOffset[iStart];
|
|
||||||
|
|
||||||
memmove(&pColData->pData[pColData->aOffset[iStart]], &pColData->pData[pColData->aOffset[iEnd - 1]],
|
|
||||||
pColData->nData - pColData->aOffset[iEnd - 1]);
|
|
||||||
pColData->nData -= nDiff;
|
|
||||||
|
|
||||||
for (int32_t i = iEnd, j = iStart + 1; i < pColData->nVal; ++i, ++j) {
|
|
||||||
pColData->aOffset[j] = pColData->aOffset[i] - nDiff;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
memmove(pColData->pData + TYPE_BYTES[pColData->type] * (iStart + 1),
|
|
||||||
pColData->pData + TYPE_BYTES[pColData->type] * iEnd,
|
|
||||||
TYPE_BYTES[pColData->type] * (pColData->nVal - iEnd + 1));
|
|
||||||
pColData->nData -= (TYPE_BYTES[pColData->type] * (iEnd - iStart - 1));
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int32_t i = iEnd, j = iStart + 1; i < pColData->nVal; ++i, ++j) {
|
|
||||||
SET_BIT1(pColData->pBitMap, j, GET_BIT1(pColData->pBitMap, i));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pColData->nVal -= (iEnd - iStart - 1);
|
|
||||||
} break;
|
|
||||||
case (HAS_VALUE | HAS_NULL): {
|
|
||||||
if (IS_VAR_DATA_TYPE(pColData->type)) {
|
|
||||||
int32_t nDiff = pColData->aOffset[iEnd - 1] - pColData->aOffset[iStart];
|
|
||||||
|
|
||||||
memmove(pColData->pData + pColData->aOffset[iStart], pColData->pData + pColData->aOffset[iEnd - 1],
|
|
||||||
pColData->nData - pColData->aOffset[iEnd - 1]);
|
|
||||||
pColData->nData -= nDiff;
|
|
||||||
|
|
||||||
for (int32_t i = iEnd, j = iStart + 1; i < pColData->nVal; ++i, ++j) {
|
|
||||||
pColData->aOffset[j] = pColData->aOffset[i] - nDiff;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
memmove(pColData->pData + TYPE_BYTES[pColData->type] * iStart,
|
|
||||||
pColData->pData + TYPE_BYTES[pColData->type] * (iEnd - 1),
|
|
||||||
TYPE_BYTES[pColData->type] * (pColData->nVal - iEnd + 1));
|
|
||||||
pColData->nData -= (TYPE_BYTES[pColData->type] * (iEnd - iStart - 1));
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int32_t i = iEnd - 1, j = iStart; i < pColData->nVal; ++i, ++j) {
|
|
||||||
SET_BIT1(pColData->pBitMap, j, GET_BIT1(pColData->pBitMap, i));
|
|
||||||
}
|
|
||||||
|
|
||||||
pColData->nVal -= (iEnd - iStart - 1);
|
|
||||||
|
|
||||||
uint8_t flag = 0;
|
|
||||||
for (int32_t i = 0; i < pColData->nVal; ++i) {
|
|
||||||
if (GET_BIT1(pColData->pBitMap, i)) {
|
|
||||||
flag |= HAS_VALUE;
|
|
||||||
} else {
|
|
||||||
flag |= HAS_NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (flag == pColData->flag) break;
|
|
||||||
}
|
|
||||||
pColData->flag = flag;
|
|
||||||
} break;
|
|
||||||
case (HAS_VALUE | HAS_NULL | HAS_NONE): {
|
|
||||||
uint8_t bv;
|
|
||||||
int32_t iv;
|
|
||||||
for (int32_t i = iEnd - 1; i >= iStart; --i) {
|
|
||||||
bv = GET_BIT2(pColData->pBitMap, i);
|
|
||||||
if (bv) {
|
|
||||||
iv = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bv) {
|
|
||||||
// TODO
|
|
||||||
ASSERT(0);
|
|
||||||
} else { // ALL NONE
|
|
||||||
if (IS_VAR_DATA_TYPE(pColData->type)) {
|
|
||||||
// TODO
|
|
||||||
ASSERT(0);
|
|
||||||
} else {
|
|
||||||
memmove(pColData->pData + TYPE_BYTES[pColData->type] * (iStart + 1),
|
|
||||||
pColData->pData + TYPE_BYTES[pColData->type] * iEnd,
|
|
||||||
TYPE_BYTES[pColData->type] * (pColData->nVal - iEnd));
|
|
||||||
pColData->nData -= (TYPE_BYTES[pColData->type] * (iEnd - iStart - 1));
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int32_t i = iEnd, j = iStart + 1; i < pColData->nVal; ++i, ++j) {
|
|
||||||
SET_BIT2(pColData->pBitMap, j, GET_BIT2(pColData->pBitMap, i));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pColData->nVal -= (iEnd - iStart - 1);
|
|
||||||
} break;
|
|
||||||
default:
|
|
||||||
ASSERT(0);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
static void tColDataMerge(SColData *aColData, int32_t nColData) {
|
|
||||||
int32_t iStart = 0;
|
|
||||||
SRowKey keyStart, keyEnd;
|
|
||||||
|
|
||||||
for (;;) {
|
|
||||||
if (iStart >= aColData[0].nVal - 1) break;
|
|
||||||
tColDataArrGetRowKey(aColData, nColData, iStart, &keyStart);
|
|
||||||
|
|
||||||
int32_t iEnd = iStart + 1;
|
|
||||||
while (iEnd < aColData[0].nVal) {
|
|
||||||
tColDataArrGetRowKey(aColData, nColData, iEnd, &keyEnd);
|
|
||||||
if (tRowKeyCompare(&keyStart, &keyEnd) != 0) break;
|
|
||||||
|
|
||||||
iEnd++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (iEnd - iStart > 1) {
|
|
||||||
for (int32_t i = 0; i < nColData; i++) {
|
|
||||||
tColDataMergeImpl(&aColData[i], iStart, iEnd);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
iStart++;
|
|
||||||
}
|
}
|
||||||
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tColDataSortMerge(SArray *colDataArr) {
|
int32_t tColDataSortMerge(SArray **arr) {
|
||||||
|
SArray *colDataArr = *arr;
|
||||||
int32_t nColData = TARRAY_SIZE(colDataArr);
|
int32_t nColData = TARRAY_SIZE(colDataArr);
|
||||||
SColData *aColData = (SColData *)TARRAY_DATA(colDataArr);
|
SColData *aColData = (SColData *)TARRAY_DATA(colDataArr);
|
||||||
|
|
||||||
|
@ -3775,7 +3620,8 @@ int32_t tColDataSortMerge(SArray *colDataArr) {
|
||||||
|
|
||||||
// merge -------
|
// merge -------
|
||||||
if (doMerge) {
|
if (doMerge) {
|
||||||
tColDataMerge(aColData, nColData);
|
int32_t code = tColDataMerge(arr);
|
||||||
|
if (code) return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
_exit:
|
_exit:
|
||||||
|
|
|
@ -638,7 +638,7 @@ static int32_t taosAddSystemCfg(SConfig *pCfg) {
|
||||||
TAOS_CHECK_RETURN(cfgAddLocale(pCfg, "locale", tsLocale, CFG_SCOPE_BOTH, CFG_DYN_CLIENT));
|
TAOS_CHECK_RETURN(cfgAddLocale(pCfg, "locale", tsLocale, CFG_SCOPE_BOTH, CFG_DYN_CLIENT));
|
||||||
TAOS_CHECK_RETURN(cfgAddCharset(pCfg, "charset", tsCharset, CFG_SCOPE_BOTH, CFG_DYN_NONE));
|
TAOS_CHECK_RETURN(cfgAddCharset(pCfg, "charset", tsCharset, CFG_SCOPE_BOTH, CFG_DYN_NONE));
|
||||||
TAOS_CHECK_RETURN(cfgAddBool(pCfg, "assert", tsAssert, CFG_SCOPE_BOTH, CFG_DYN_CLIENT));
|
TAOS_CHECK_RETURN(cfgAddBool(pCfg, "assert", tsAssert, CFG_SCOPE_BOTH, CFG_DYN_CLIENT));
|
||||||
TAOS_CHECK_RETURN(cfgAddBool(pCfg, "enableCoreFile", 1, CFG_SCOPE_BOTH, CFG_DYN_CLIENT));
|
TAOS_CHECK_RETURN(cfgAddBool(pCfg, "enableCoreFile", tsEnableCoreFile, CFG_SCOPE_BOTH, CFG_DYN_BOTH));
|
||||||
TAOS_CHECK_RETURN(cfgAddFloat(pCfg, "numOfCores", tsNumOfCores, 1, 100000, CFG_SCOPE_BOTH, CFG_DYN_NONE));
|
TAOS_CHECK_RETURN(cfgAddFloat(pCfg, "numOfCores", tsNumOfCores, 1, 100000, CFG_SCOPE_BOTH, CFG_DYN_NONE));
|
||||||
|
|
||||||
TAOS_CHECK_RETURN(cfgAddBool(pCfg, "ssd42", tsSSE42Supported, CFG_SCOPE_BOTH, CFG_DYN_NONE));
|
TAOS_CHECK_RETURN(cfgAddBool(pCfg, "ssd42", tsSSE42Supported, CFG_SCOPE_BOTH, CFG_DYN_NONE));
|
||||||
|
@ -1287,8 +1287,8 @@ static int32_t taosSetSystemCfg(SConfig *pCfg) {
|
||||||
osSetSystemLocale(locale, charset);
|
osSetSystemLocale(locale, charset);
|
||||||
|
|
||||||
TAOS_CHECK_GET_CFG_ITEM(pCfg, pItem, "enableCoreFile");
|
TAOS_CHECK_GET_CFG_ITEM(pCfg, pItem, "enableCoreFile");
|
||||||
bool enableCore = pItem->bval;
|
tsEnableCoreFile = pItem->bval;
|
||||||
taosSetCoreDump(enableCore);
|
taosSetCoreDump(tsEnableCoreFile);
|
||||||
|
|
||||||
TAOS_CHECK_GET_CFG_ITEM(pCfg, pItem, "assert");
|
TAOS_CHECK_GET_CFG_ITEM(pCfg, pItem, "assert");
|
||||||
tsAssert = pItem->bval;
|
tsAssert = pItem->bval;
|
||||||
|
@ -1901,6 +1901,13 @@ static int32_t taosCfgDynamicOptionsForServer(SConfig *pCfg, const char *name) {
|
||||||
goto _exit;
|
goto _exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (strncasecmp(name, "enableCoreFile", 9) == 0) {
|
||||||
|
tsEnableCoreFile = pItem->bval;
|
||||||
|
taosSetCoreDump(tsEnableCoreFile);
|
||||||
|
uInfo("%s set to %d", name, tsEnableCoreFile);
|
||||||
|
goto _exit;
|
||||||
|
}
|
||||||
|
|
||||||
if (strcasecmp("slowLogScope", name) == 0) {
|
if (strcasecmp("slowLogScope", name) == 0) {
|
||||||
int32_t scope = 0;
|
int32_t scope = 0;
|
||||||
TAOS_CHECK_GOTO(taosSetSlowLogScope(pItem->str, &scope), NULL, _exit);
|
TAOS_CHECK_GOTO(taosSetSlowLogScope(pItem->str, &scope), NULL, _exit);
|
||||||
|
@ -2009,9 +2016,9 @@ static int32_t taosCfgDynamicOptionsForClient(SConfig *pCfg, const char *name) {
|
||||||
}
|
}
|
||||||
case 'e': {
|
case 'e': {
|
||||||
if (strcasecmp("enableCoreFile", name) == 0) {
|
if (strcasecmp("enableCoreFile", name) == 0) {
|
||||||
bool enableCore = pItem->bval;
|
tsEnableCoreFile = pItem->bval;
|
||||||
taosSetCoreDump(enableCore);
|
taosSetCoreDump(tsEnableCoreFile);
|
||||||
uInfo("%s set to %d", name, enableCore);
|
uInfo("%s set to %d", name, tsEnableCoreFile);
|
||||||
matched = true;
|
matched = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -2205,7 +2212,6 @@ static int32_t taosCfgDynamicOptionsForClient(SConfig *pCfg, const char *name) {
|
||||||
{"compressMsgSize", &tsCompressMsgSize},
|
{"compressMsgSize", &tsCompressMsgSize},
|
||||||
{"countAlwaysReturnValue", &tsCountAlwaysReturnValue},
|
{"countAlwaysReturnValue", &tsCountAlwaysReturnValue},
|
||||||
{"crashReporting", &tsEnableCrashReport},
|
{"crashReporting", &tsEnableCrashReport},
|
||||||
{"enableCoreFile", &tsAsyncLog},
|
|
||||||
{"enableQueryHb", &tsEnableQueryHb},
|
{"enableQueryHb", &tsEnableQueryHb},
|
||||||
{"keepColumnName", &tsKeepColumnName},
|
{"keepColumnName", &tsKeepColumnName},
|
||||||
{"keepAliveIdle", &tsKeepAliveIdle},
|
{"keepAliveIdle", &tsKeepAliveIdle},
|
||||||
|
|
|
@ -57,7 +57,11 @@ void vmGetVnodeLoadsLite(SVnodeMgmt *pMgmt, SMonVloadInfo *pInfo) {
|
||||||
if (!pVnode->failed) {
|
if (!pVnode->failed) {
|
||||||
SVnodeLoadLite vload = {0};
|
SVnodeLoadLite vload = {0};
|
||||||
if (vnodeGetLoadLite(pVnode->pImpl, &vload) == 0) {
|
if (vnodeGetLoadLite(pVnode->pImpl, &vload) == 0) {
|
||||||
(void)taosArrayPush(pInfo->pVloads, &vload);
|
if (taosArrayPush(pInfo->pVloads, &vload) == NULL) {
|
||||||
|
taosArrayDestroy(pInfo->pVloads);
|
||||||
|
pInfo->pVloads = NULL;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pIter = taosHashIterate(pMgmt->hash, pIter);
|
pIter = taosHashIterate(pMgmt->hash, pIter);
|
||||||
|
@ -841,6 +845,9 @@ int32_t vmProcessArbHeartBeatReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) {
|
||||||
arbHbRsp.dnodeId = pMgmt->pData->dnodeId;
|
arbHbRsp.dnodeId = pMgmt->pData->dnodeId;
|
||||||
strncpy(arbHbRsp.arbToken, arbHbReq.arbToken, TSDB_ARB_TOKEN_SIZE);
|
strncpy(arbHbRsp.arbToken, arbHbReq.arbToken, TSDB_ARB_TOKEN_SIZE);
|
||||||
arbHbRsp.hbMembers = taosArrayInit(size, sizeof(SVArbHbRspMember));
|
arbHbRsp.hbMembers = taosArrayInit(size, sizeof(SVArbHbRspMember));
|
||||||
|
if (arbHbRsp.hbMembers == NULL) {
|
||||||
|
goto _OVER;
|
||||||
|
}
|
||||||
|
|
||||||
for (int32_t i = 0; i < size; i++) {
|
for (int32_t i = 0; i < size; i++) {
|
||||||
SVArbHbReqMember *pReqMember = taosArrayGet(arbHbReq.hbMembers, i);
|
SVArbHbReqMember *pReqMember = taosArrayGet(arbHbReq.hbMembers, i);
|
||||||
|
@ -865,7 +872,11 @@ int32_t vmProcessArbHeartBeatReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
(void)taosArrayPush(arbHbRsp.hbMembers, &rspMember);
|
if (taosArrayPush(arbHbRsp.hbMembers, &rspMember) == NULL) {
|
||||||
|
dError("dnodeId:%d vgId:%d failed to push arb hb rsp member", arbHbReq.dnodeId, pReqMember->vgId);
|
||||||
|
vmReleaseVnode(pMgmt, pVnode);
|
||||||
|
goto _OVER;
|
||||||
|
}
|
||||||
|
|
||||||
vmReleaseVnode(pMgmt, pVnode);
|
vmReleaseVnode(pMgmt, pVnode);
|
||||||
}
|
}
|
||||||
|
|
|
@ -167,7 +167,6 @@ int32_t vmOpenVnode(SVnodeMgmt *pMgmt, SWrapperCfg *pCfg, SVnode *pImpl) {
|
||||||
SVnodeObj *pOld = NULL;
|
SVnodeObj *pOld = NULL;
|
||||||
(void)taosHashGetDup(pMgmt->hash, &pVnode->vgId, sizeof(int32_t), (void *)&pOld);
|
(void)taosHashGetDup(pMgmt->hash, &pVnode->vgId, sizeof(int32_t), (void *)&pOld);
|
||||||
if (pOld) {
|
if (pOld) {
|
||||||
ASSERT(pOld->failed);
|
|
||||||
vmFreeVnodeObj(&pOld);
|
vmFreeVnodeObj(&pOld);
|
||||||
}
|
}
|
||||||
int32_t code = taosHashPut(pMgmt->hash, &pVnode->vgId, sizeof(int32_t), &pVnode, sizeof(SVnodeObj *));
|
int32_t code = taosHashPut(pMgmt->hash, &pVnode->vgId, sizeof(int32_t), &pVnode, sizeof(SVnodeObj *));
|
||||||
|
@ -190,7 +189,6 @@ void vmCloseVnode(SVnodeMgmt *pMgmt, SVnodeObj *pVnode, bool commitAndRemoveWal)
|
||||||
vmReleaseVnode(pMgmt, pVnode);
|
vmReleaseVnode(pMgmt, pVnode);
|
||||||
|
|
||||||
if (pVnode->failed) {
|
if (pVnode->failed) {
|
||||||
ASSERT(pVnode->pImpl == NULL);
|
|
||||||
goto _closed;
|
goto _closed;
|
||||||
}
|
}
|
||||||
dInfo("vgId:%d, pre close", pVnode->vgId);
|
dInfo("vgId:%d, pre close", pVnode->vgId);
|
||||||
|
@ -692,8 +690,6 @@ static void *vmRestoreVnodeInThread(void *param) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT(pVnode->pImpl);
|
|
||||||
|
|
||||||
char stepDesc[TSDB_STEP_DESC_LEN] = {0};
|
char stepDesc[TSDB_STEP_DESC_LEN] = {0};
|
||||||
snprintf(stepDesc, TSDB_STEP_DESC_LEN, "vgId:%d, start to restore, %d of %d have been restored", pVnode->vgId,
|
snprintf(stepDesc, TSDB_STEP_DESC_LEN, "vgId:%d, start to restore, %d of %d have been restored", pVnode->vgId,
|
||||||
pMgmt->state.openVnodes, pMgmt->state.totalVnodes);
|
pMgmt->state.openVnodes, pMgmt->state.totalVnodes);
|
||||||
|
@ -764,7 +760,6 @@ static int32_t vmStartVnodes(SVnodeMgmt *pMgmt) {
|
||||||
(void)taosThreadAttrSetDetachState(&thAttr, PTHREAD_CREATE_JOINABLE);
|
(void)taosThreadAttrSetDetachState(&thAttr, PTHREAD_CREATE_JOINABLE);
|
||||||
if (taosThreadCreate(&pThread->thread, &thAttr, vmRestoreVnodeInThread, pThread) != 0) {
|
if (taosThreadCreate(&pThread->thread, &thAttr, vmRestoreVnodeInThread, pThread) != 0) {
|
||||||
dError("thread:%d, failed to create thread to restore vnode since %s", pThread->threadIndex, strerror(errno));
|
dError("thread:%d, failed to create thread to restore vnode since %s", pThread->threadIndex, strerror(errno));
|
||||||
ASSERT(errno == 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
(void)taosThreadAttrDestroy(&thAttr);
|
(void)taosThreadAttrDestroy(&thAttr);
|
||||||
|
|
|
@ -256,7 +256,9 @@ _OVER:
|
||||||
SDnodeEp dnodeEp = {0};
|
SDnodeEp dnodeEp = {0};
|
||||||
dnodeEp.isMnode = 1;
|
dnodeEp.isMnode = 1;
|
||||||
(void)taosGetFqdnPortFromEp(tsFirst, &dnodeEp.ep);
|
(void)taosGetFqdnPortFromEp(tsFirst, &dnodeEp.ep);
|
||||||
(void)taosArrayPush(pData->dnodeEps, &dnodeEp);
|
if (taosArrayPush(pData->dnodeEps, &dnodeEp) == NULL) {
|
||||||
|
return terrno;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((code = dmReadDnodePairs(pData)) != 0) {
|
if ((code = dmReadDnodePairs(pData)) != 0) {
|
||||||
|
@ -398,7 +400,11 @@ static void dmResetEps(SDnodeData *pData, SArray *dnodeEps) {
|
||||||
|
|
||||||
for (int32_t i = 0; i < numOfEps; i++) {
|
for (int32_t i = 0; i < numOfEps; i++) {
|
||||||
SDnodeEp *pDnodeEp = taosArrayGet(dnodeEps, i);
|
SDnodeEp *pDnodeEp = taosArrayGet(dnodeEps, i);
|
||||||
(void)taosHashPut(pData->dnodeHash, &pDnodeEp->id, sizeof(int32_t), pDnodeEp, sizeof(SDnodeEp));
|
int32_t code = taosHashPut(pData->dnodeHash, &pDnodeEp->id, sizeof(int32_t), pDnodeEp, sizeof(SDnodeEp));
|
||||||
|
if (code) {
|
||||||
|
dError("dnode:%d, fqdn:%s port:%u isMnode:%d failed to put into hash, reason:%s", pDnodeEp->id, pDnodeEp->ep.fqdn,
|
||||||
|
pDnodeEp->ep.port, pDnodeEp->isMnode, tstrerror(code));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pData->validMnodeEps = true;
|
pData->validMnodeEps = true;
|
||||||
|
|
|
@ -407,7 +407,9 @@ static int32_t mndProcessArbHbTimer(SRpcMsg *pReq) {
|
||||||
(void)taosHashPut(pDnodeHash, &dnodeId, sizeof(int32_t), &hbMembers, POINTER_BYTES);
|
(void)taosHashPut(pDnodeHash, &dnodeId, sizeof(int32_t), &hbMembers, POINTER_BYTES);
|
||||||
}
|
}
|
||||||
SVArbHbReqMember reqMember = {.vgId = pArbGroup->vgId, .hbSeq = pMember->state.nextHbSeq++};
|
SVArbHbReqMember reqMember = {.vgId = pArbGroup->vgId, .hbSeq = pMember->state.nextHbSeq++};
|
||||||
(void)taosArrayPush(hbMembers, &reqMember);
|
if (taosArrayPush(hbMembers, &reqMember) == NULL) {
|
||||||
|
mError("dnodeId:%d, failed to push hb member, but conitnue next at this timer round", dnodeId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
(void)taosThreadMutexUnlock(&pArbGroup->mutex);
|
(void)taosThreadMutexUnlock(&pArbGroup->mutex);
|
||||||
|
@ -998,7 +1000,9 @@ static int32_t mndUpdateArbHeartBeat(SMnode *pMnode, int32_t dnodeId, SArray *me
|
||||||
|
|
||||||
bool updateToken = mndUpdateArbGroupByHeartBeat(pGroup, pRspMember, nowMs, dnodeId, &newGroup);
|
bool updateToken = mndUpdateArbGroupByHeartBeat(pGroup, pRspMember, nowMs, dnodeId, &newGroup);
|
||||||
if (updateToken) {
|
if (updateToken) {
|
||||||
(void)taosArrayPush(pUpdateArray, &newGroup);
|
if (taosArrayPush(pUpdateArray, &newGroup) == NULL) {
|
||||||
|
mError("failed to push newGroup to updateArray, but continue at this hearbear");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sdbRelease(pMnode->pSdb, pGroup);
|
sdbRelease(pMnode->pSdb, pGroup);
|
||||||
|
|
|
@ -826,7 +826,9 @@ void mndCompactPullup(SMnode *pMnode) {
|
||||||
SCompactObj *pCompact = NULL;
|
SCompactObj *pCompact = NULL;
|
||||||
pIter = sdbFetch(pMnode->pSdb, SDB_COMPACT, pIter, (void **)&pCompact);
|
pIter = sdbFetch(pMnode->pSdb, SDB_COMPACT, pIter, (void **)&pCompact);
|
||||||
if (pIter == NULL) break;
|
if (pIter == NULL) break;
|
||||||
(void)taosArrayPush(pArray, &pCompact->compactId);
|
if (taosArrayPush(pArray, &pCompact->compactId) == NULL) {
|
||||||
|
mError("failed to push compact id:%d into array, but continue pull up", pCompact->compactId);
|
||||||
|
}
|
||||||
sdbRelease(pSdb, pCompact);
|
sdbRelease(pSdb, pCompact);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -334,9 +334,21 @@ static int32_t addEpSetInfo(SMnode *pMnode, SMqConsumerObj *pConsumer, int32_t e
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SMqSubVgEp vgEp = {.epSet = pVgEp->epSet, .vgId = pVgEp->vgId, .offset = -1};
|
SMqSubVgEp vgEp = {.epSet = pVgEp->epSet, .vgId = pVgEp->vgId, .offset = -1};
|
||||||
(void)taosArrayPush(topicEp.vgs, &vgEp);
|
if (taosArrayPush(topicEp.vgs, &vgEp) == NULL) {
|
||||||
|
taosArrayDestroy(topicEp.vgs);
|
||||||
|
taosRUnLockLatch(&pConsumer->lock);
|
||||||
|
taosRUnLockLatch(&pSub->lock);
|
||||||
|
mndReleaseSubscribe(pMnode, pSub);
|
||||||
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (taosArrayPush(rsp->topics, &topicEp) == NULL) {
|
||||||
|
taosArrayDestroy(topicEp.vgs);
|
||||||
|
taosRUnLockLatch(&pConsumer->lock);
|
||||||
|
taosRUnLockLatch(&pSub->lock);
|
||||||
|
mndReleaseSubscribe(pMnode, pSub);
|
||||||
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
(void)taosArrayPush(rsp->topics, &topicEp);
|
|
||||||
taosRUnLockLatch(&pSub->lock);
|
taosRUnLockLatch(&pSub->lock);
|
||||||
mndReleaseSubscribe(pMnode, pSub);
|
mndReleaseSubscribe(pMnode, pSub);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1710,7 +1710,9 @@ void mndBuildDBVgroupInfo(SDbObj *pDb, SMnode *pMnode, SArray *pVgList) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
vindex++;
|
vindex++;
|
||||||
(void)taosArrayPush(pVgList, &vgInfo);
|
if (taosArrayPush(pVgList, &vgInfo) == NULL) {
|
||||||
|
mError("db:%s, failed to push vgInfo to array, vgId:%d, but continue next", pDb->name, vgInfo.vgId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sdbRelease(pSdb, pVgroup);
|
sdbRelease(pSdb, pVgroup);
|
||||||
|
@ -1856,7 +1858,10 @@ int32_t mndValidateDbInfo(SMnode *pMnode, SDbCacheInfo *pDbs, int32_t numOfDbs,
|
||||||
|
|
||||||
rsp.useDbRsp->vgNum = taosArrayGetSize(rsp.useDbRsp->pVgroupInfos);
|
rsp.useDbRsp->vgNum = taosArrayGetSize(rsp.useDbRsp->pVgroupInfos);
|
||||||
|
|
||||||
(void)taosArrayPush(batchRsp.pArray, &rsp);
|
if (taosArrayPush(batchRsp.pArray, &rsp) == NULL) {
|
||||||
|
if (terrno != 0) code = terrno;
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -1868,7 +1873,10 @@ int32_t mndValidateDbInfo(SMnode *pMnode, SDbCacheInfo *pDbs, int32_t numOfDbs,
|
||||||
(void)memcpy(rsp.useDbRsp->db, pDbCacheInfo->dbFName, TSDB_DB_FNAME_LEN);
|
(void)memcpy(rsp.useDbRsp->db, pDbCacheInfo->dbFName, TSDB_DB_FNAME_LEN);
|
||||||
rsp.useDbRsp->uid = pDbCacheInfo->dbId;
|
rsp.useDbRsp->uid = pDbCacheInfo->dbId;
|
||||||
rsp.useDbRsp->vgVersion = -1;
|
rsp.useDbRsp->vgVersion = -1;
|
||||||
(void)taosArrayPush(batchRsp.pArray, &rsp);
|
if (taosArrayPush(batchRsp.pArray, &rsp) == NULL) {
|
||||||
|
if (terrno != 0) code = terrno;
|
||||||
|
return code;
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1940,7 +1948,11 @@ int32_t mndValidateDbInfo(SMnode *pMnode, SDbCacheInfo *pDbs, int32_t numOfDbs,
|
||||||
rsp.useDbRsp->hashSuffix = pDb->cfg.hashSuffix;
|
rsp.useDbRsp->hashSuffix = pDb->cfg.hashSuffix;
|
||||||
}
|
}
|
||||||
|
|
||||||
(void)taosArrayPush(batchRsp.pArray, &rsp);
|
if (taosArrayPush(batchRsp.pArray, &rsp) == NULL) {
|
||||||
|
mndReleaseDb(pMnode, pDb);
|
||||||
|
if (terrno != 0) code = terrno;
|
||||||
|
return code;
|
||||||
|
}
|
||||||
mndReleaseDb(pMnode, pDb);
|
mndReleaseDb(pMnode, pDb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -430,7 +430,9 @@ static void mndGetDnodeEps(SMnode *pMnode, SArray *pDnodeEps) {
|
||||||
if (mndIsMnode(pMnode, pDnode->id)) {
|
if (mndIsMnode(pMnode, pDnode->id)) {
|
||||||
dnodeEp.isMnode = 1;
|
dnodeEp.isMnode = 1;
|
||||||
}
|
}
|
||||||
(void)taosArrayPush(pDnodeEps, &dnodeEp);
|
if (taosArrayPush(pDnodeEps, &dnodeEp) == NULL) {
|
||||||
|
mError("failed to put ep into array, but continue at this call");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -991,7 +993,12 @@ static int32_t mndProcessDnodeListReq(SRpcMsg *pReq) {
|
||||||
tstrncpy(epSet.eps[0].fqdn, pObj->fqdn, TSDB_FQDN_LEN);
|
tstrncpy(epSet.eps[0].fqdn, pObj->fqdn, TSDB_FQDN_LEN);
|
||||||
epSet.eps[0].port = pObj->port;
|
epSet.eps[0].port = pObj->port;
|
||||||
|
|
||||||
(void)taosArrayPush(rsp.dnodeList, &epSet);
|
if (taosArrayPush(rsp.dnodeList, &epSet) == NULL) {
|
||||||
|
if (terrno != 0) code = terrno;
|
||||||
|
sdbRelease(pSdb, pObj);
|
||||||
|
sdbCancelFetch(pSdb, pIter);
|
||||||
|
goto _OVER;
|
||||||
|
}
|
||||||
|
|
||||||
sdbRelease(pSdb, pObj);
|
sdbRelease(pSdb, pObj);
|
||||||
}
|
}
|
||||||
|
@ -1845,7 +1852,9 @@ SArray *mndGetAllDnodeFqdns(SMnode *pMnode) {
|
||||||
if (pIter == NULL) break;
|
if (pIter == NULL) break;
|
||||||
|
|
||||||
char *fqdn = taosStrdup(pObj->fqdn);
|
char *fqdn = taosStrdup(pObj->fqdn);
|
||||||
(void)taosArrayPush(fqdns, &fqdn);
|
if (taosArrayPush(fqdns, &fqdn) == NULL) {
|
||||||
|
mError("failed to fqdn into array, but continue at this time");
|
||||||
|
}
|
||||||
sdbRelease(pSdb, pObj);
|
sdbRelease(pSdb, pObj);
|
||||||
}
|
}
|
||||||
return fqdns;
|
return fqdns;
|
||||||
|
|
|
@ -89,7 +89,7 @@ static int32_t mndFindSuperTableTagId(const SStbObj *pStb, const char *tagName,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1;
|
return TSDB_CODE_MND_TAG_NOT_EXIST;
|
||||||
}
|
}
|
||||||
|
|
||||||
int mndSetCreateIdxRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SStbObj *pStb, SIdxObj *pIdx) {
|
int mndSetCreateIdxRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SStbObj *pStb, SIdxObj *pIdx) {
|
||||||
|
@ -188,7 +188,7 @@ int mndSetDropIdxRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SStbOb
|
||||||
sdbRelease(pSdb, pVgroup);
|
sdbRelease(pSdb, pVgroup);
|
||||||
code = TSDB_CODE_MND_RETURN_VALUE_NULL;
|
code = TSDB_CODE_MND_RETURN_VALUE_NULL;
|
||||||
if (terrno != 0) code = terrno;
|
if (terrno != 0) code = terrno;
|
||||||
return -1;
|
return code;
|
||||||
}
|
}
|
||||||
STransAction action = {0};
|
STransAction action = {0};
|
||||||
action.epSet = mndGetVgroupEpset(pMnode, pVgroup);
|
action.epSet = mndGetVgroupEpset(pMnode, pVgroup);
|
||||||
|
@ -199,7 +199,7 @@ int mndSetDropIdxRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SStbOb
|
||||||
taosMemoryFree(pReq);
|
taosMemoryFree(pReq);
|
||||||
sdbCancelFetch(pSdb, pIter);
|
sdbCancelFetch(pSdb, pIter);
|
||||||
sdbRelease(pSdb, pVgroup);
|
sdbRelease(pSdb, pVgroup);
|
||||||
return -1;
|
return code;
|
||||||
}
|
}
|
||||||
sdbRelease(pSdb, pVgroup);
|
sdbRelease(pSdb, pVgroup);
|
||||||
}
|
}
|
||||||
|
@ -824,7 +824,7 @@ static int32_t mndDropIdx(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SIdxObj *p
|
||||||
}
|
}
|
||||||
|
|
||||||
mInfo("trans:%d, used to drop idx:%s", pTrans->id, pIdx->name);
|
mInfo("trans:%d, used to drop idx:%s", pTrans->id, pIdx->name);
|
||||||
mndTransSetDbName(pTrans, pDb->name, NULL);
|
mndTransSetDbName(pTrans, pDb->name, pStb->name);
|
||||||
TAOS_CHECK_GOTO(mndTransCheckConflict(pMnode, pTrans), NULL, _OVER);
|
TAOS_CHECK_GOTO(mndTransCheckConflict(pMnode, pTrans), NULL, _OVER);
|
||||||
|
|
||||||
mndTransSetSerial(pTrans);
|
mndTransSetSerial(pTrans);
|
||||||
|
|
|
@ -991,7 +991,9 @@ int32_t mndGetMonitorInfo(SMnode *pMnode, SMonClusterInfo *pClusterInfo, SMonVgr
|
||||||
} else {
|
} else {
|
||||||
tstrncpy(desc.status, "offline", sizeof(desc.status));
|
tstrncpy(desc.status, "offline", sizeof(desc.status));
|
||||||
}
|
}
|
||||||
(void)taosArrayPush(pClusterInfo->dnodes, &desc);
|
if (taosArrayPush(pClusterInfo->dnodes, &desc) == NULL) {
|
||||||
|
mError("failed put dnode into array, but continue at this monitor report")
|
||||||
|
}
|
||||||
sdbRelease(pSdb, pObj);
|
sdbRelease(pSdb, pObj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1017,7 +1019,9 @@ int32_t mndGetMonitorInfo(SMnode *pMnode, SMonClusterInfo *pClusterInfo, SMonVgr
|
||||||
tstrncpy(desc.role, syncStr(pObj->syncState), sizeof(desc.role));
|
tstrncpy(desc.role, syncStr(pObj->syncState), sizeof(desc.role));
|
||||||
desc.syncState = pObj->syncState;
|
desc.syncState = pObj->syncState;
|
||||||
}
|
}
|
||||||
(void)taosArrayPush(pClusterInfo->mnodes, &desc);
|
if (taosArrayPush(pClusterInfo->mnodes, &desc) == NULL) {
|
||||||
|
mError("failed to put mnode into array, but continue at this monitor report");
|
||||||
|
}
|
||||||
sdbRelease(pSdb, pObj);
|
sdbRelease(pSdb, pObj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1057,7 +1061,9 @@ int32_t mndGetMonitorInfo(SMnode *pMnode, SMonClusterInfo *pClusterInfo, SMonVgr
|
||||||
pClusterInfo->vnodes_total++;
|
pClusterInfo->vnodes_total++;
|
||||||
}
|
}
|
||||||
|
|
||||||
(void)taosArrayPush(pVgroupInfo->vgroups, &desc);
|
if (taosArrayPush(pVgroupInfo->vgroups, &desc) == NULL) {
|
||||||
|
mError("failed to put vgroup into array, but continue at this monitor report")
|
||||||
|
}
|
||||||
sdbRelease(pSdb, pVgroup);
|
sdbRelease(pSdb, pVgroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1078,7 +1084,9 @@ int32_t mndGetMonitorInfo(SMnode *pMnode, SMonClusterInfo *pClusterInfo, SMonVgr
|
||||||
(void)tNameFromString(&name2, pStb->name, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE);
|
(void)tNameFromString(&name2, pStb->name, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE);
|
||||||
tstrncpy(desc.stb_name, tNameGetTableName(&name2), TSDB_TABLE_NAME_LEN);
|
tstrncpy(desc.stb_name, tNameGetTableName(&name2), TSDB_TABLE_NAME_LEN);
|
||||||
|
|
||||||
(void)taosArrayPush(pStbInfo->stbs, &desc);
|
if (taosArrayPush(pStbInfo->stbs, &desc) == NULL) {
|
||||||
|
mError("failed to put stb into array, but continue at this monitor report");
|
||||||
|
}
|
||||||
sdbRelease(pSdb, pStb);
|
sdbRelease(pSdb, pStb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -546,8 +546,9 @@ static int32_t mndProcessQueryHeartBeat(SMnode *pMnode, SRpcMsg *pMsg, SClientHb
|
||||||
|
|
||||||
int32_t kvNum = taosHashGetSize(pHbReq->info);
|
int32_t kvNum = taosHashGetSize(pHbReq->info);
|
||||||
if (NULL == pHbReq->info || kvNum <= 0) {
|
if (NULL == pHbReq->info || kvNum <= 0) {
|
||||||
// TODO return value
|
if (taosArrayPush(pBatchRsp->rsps, &hbRsp) == NULL) {
|
||||||
(void)taosArrayPush(pBatchRsp->rsps, &hbRsp);
|
mError("failed to put rsp into array, but continue at this heartbeat");
|
||||||
|
}
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -597,7 +598,9 @@ static int32_t mndProcessQueryHeartBeat(SMnode *pMnode, SRpcMsg *pMsg, SClientHb
|
||||||
pObj->ipWhiteListVer);
|
pObj->ipWhiteListVer);
|
||||||
if (rspMsg && rspLen > 0) {
|
if (rspMsg && rspLen > 0) {
|
||||||
SKv kv1 = {.key = HEARTBEAT_KEY_USER_AUTHINFO, .valueLen = rspLen, .value = rspMsg};
|
SKv kv1 = {.key = HEARTBEAT_KEY_USER_AUTHINFO, .valueLen = rspLen, .value = rspMsg};
|
||||||
(void)taosArrayPush(hbRsp.info, &kv1);
|
if (taosArrayPush(hbRsp.info, &kv1) == NULL) {
|
||||||
|
mError("failed to put kv into array, but continue at this heartbeat");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -607,7 +610,9 @@ static int32_t mndProcessQueryHeartBeat(SMnode *pMnode, SRpcMsg *pMsg, SClientHb
|
||||||
(void)mndValidateDbInfo(pMnode, kv->value, kv->valueLen / sizeof(SDbCacheInfo), &rspMsg, &rspLen);
|
(void)mndValidateDbInfo(pMnode, kv->value, kv->valueLen / sizeof(SDbCacheInfo), &rspMsg, &rspLen);
|
||||||
if (rspMsg && rspLen > 0) {
|
if (rspMsg && rspLen > 0) {
|
||||||
SKv kv1 = {.key = HEARTBEAT_KEY_DBINFO, .valueLen = rspLen, .value = rspMsg};
|
SKv kv1 = {.key = HEARTBEAT_KEY_DBINFO, .valueLen = rspLen, .value = rspMsg};
|
||||||
(void)taosArrayPush(hbRsp.info, &kv1);
|
if (taosArrayPush(hbRsp.info, &kv1) == NULL) {
|
||||||
|
mError("failed to put kv into array, but continue at this heartbeat");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -617,7 +622,9 @@ static int32_t mndProcessQueryHeartBeat(SMnode *pMnode, SRpcMsg *pMsg, SClientHb
|
||||||
(void)mndValidateStbInfo(pMnode, kv->value, kv->valueLen / sizeof(SSTableVersion), &rspMsg, &rspLen);
|
(void)mndValidateStbInfo(pMnode, kv->value, kv->valueLen / sizeof(SSTableVersion), &rspMsg, &rspLen);
|
||||||
if (rspMsg && rspLen > 0) {
|
if (rspMsg && rspLen > 0) {
|
||||||
SKv kv1 = {.key = HEARTBEAT_KEY_STBINFO, .valueLen = rspLen, .value = rspMsg};
|
SKv kv1 = {.key = HEARTBEAT_KEY_STBINFO, .valueLen = rspLen, .value = rspMsg};
|
||||||
(void)taosArrayPush(hbRsp.info, &kv1);
|
if (taosArrayPush(hbRsp.info, &kv1) == NULL) {
|
||||||
|
mError("failed to put kv into array, but continue at this heartbeat");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -635,7 +642,9 @@ static int32_t mndProcessQueryHeartBeat(SMnode *pMnode, SRpcMsg *pMsg, SClientHb
|
||||||
(void)mndValidateViewInfo(pMnode, kv->value, kv->valueLen / sizeof(SViewVersion), &rspMsg, &rspLen);
|
(void)mndValidateViewInfo(pMnode, kv->value, kv->valueLen / sizeof(SViewVersion), &rspMsg, &rspLen);
|
||||||
if (rspMsg && rspLen > 0) {
|
if (rspMsg && rspLen > 0) {
|
||||||
SKv kv1 = {.key = HEARTBEAT_KEY_VIEWINFO, .valueLen = rspLen, .value = rspMsg};
|
SKv kv1 = {.key = HEARTBEAT_KEY_VIEWINFO, .valueLen = rspLen, .value = rspMsg};
|
||||||
(void)taosArrayPush(hbRsp.info, &kv1);
|
if (taosArrayPush(hbRsp.info, &kv1) == NULL) {
|
||||||
|
mError("failed to put kv into array, but continue at this heartbeat");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -646,7 +655,9 @@ static int32_t mndProcessQueryHeartBeat(SMnode *pMnode, SRpcMsg *pMsg, SClientHb
|
||||||
(void)mndValidateTSMAInfo(pMnode, kv->value, kv->valueLen / sizeof(STSMAVersion), &rspMsg, &rspLen);
|
(void)mndValidateTSMAInfo(pMnode, kv->value, kv->valueLen / sizeof(STSMAVersion), &rspMsg, &rspLen);
|
||||||
if (rspMsg && rspLen > 0) {
|
if (rspMsg && rspLen > 0) {
|
||||||
SKv kv = {.key = HEARTBEAT_KEY_TSMA, .valueLen = rspLen, .value = rspMsg};
|
SKv kv = {.key = HEARTBEAT_KEY_TSMA, .valueLen = rspLen, .value = rspMsg};
|
||||||
(void)taosArrayPush(hbRsp.info, &kv);
|
if (taosArrayPush(hbRsp.info, &kv) == NULL) {
|
||||||
|
mError("failed to put kv into array, but continue at this heartbeat");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -706,7 +717,9 @@ static int32_t mndProcessHeartBeatReq(SRpcMsg *pReq) {
|
||||||
} else if (pHbReq->connKey.connType == CONN_TYPE__TMQ) {
|
} else if (pHbReq->connKey.connType == CONN_TYPE__TMQ) {
|
||||||
SClientHbRsp *pRsp = mndMqHbBuildRsp(pMnode, pHbReq);
|
SClientHbRsp *pRsp = mndMqHbBuildRsp(pMnode, pHbReq);
|
||||||
if (pRsp != NULL) {
|
if (pRsp != NULL) {
|
||||||
(void)taosArrayPush(batchRsp.rsps, pRsp);
|
if (taosArrayPush(batchRsp.rsps, pRsp) == NULL) {
|
||||||
|
mError("failed to put kv into array, but continue at this heartbeat");
|
||||||
|
}
|
||||||
taosMemoryFree(pRsp);
|
taosMemoryFree(pRsp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -498,7 +498,12 @@ int32_t mndCreateQnodeList(SMnode *pMnode, SArray **pList, int32_t limit) {
|
||||||
nodeLoad.addr.epSet.eps[0].port = pObj->pDnode->port;
|
nodeLoad.addr.epSet.eps[0].port = pObj->pDnode->port;
|
||||||
nodeLoad.load = QNODE_LOAD_VALUE(pObj);
|
nodeLoad.load = QNODE_LOAD_VALUE(pObj);
|
||||||
|
|
||||||
(void)taosArrayPush(qnodeList, &nodeLoad);
|
if (taosArrayPush(qnodeList, &nodeLoad) == NULL) {
|
||||||
|
sdbRelease(pSdb, pObj);
|
||||||
|
sdbCancelFetch(pSdb, pIter);
|
||||||
|
if (terrno != 0) code = terrno;
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
numOfRows++;
|
numOfRows++;
|
||||||
sdbRelease(pSdb, pObj);
|
sdbRelease(pSdb, pObj);
|
||||||
|
|
|
@ -1845,8 +1845,7 @@ static int32_t mndTSMAGenerateOutputName(const char* tsmaName, char* streamName,
|
||||||
|
|
||||||
static int32_t mndProcessCreateTSMAReq(SRpcMsg* pReq) {
|
static int32_t mndProcessCreateTSMAReq(SRpcMsg* pReq) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
terrno = TSDB_CODE_MND_INVALID_PLATFORM;
|
TAOS_RETURN(TSDB_CODE_MND_INVALID_PLATFORM);
|
||||||
goto _OVER;
|
|
||||||
#endif
|
#endif
|
||||||
SMnode * pMnode = pReq->info.node;
|
SMnode * pMnode = pReq->info.node;
|
||||||
int32_t code = -1;
|
int32_t code = -1;
|
||||||
|
|
|
@ -278,7 +278,7 @@ static SSdbRow *mndStbActionDecode(SSdbRaw *pRaw) {
|
||||||
for (int32_t i = 0; i < pStb->numOfFuncs; ++i) {
|
for (int32_t i = 0; i < pStb->numOfFuncs; ++i) {
|
||||||
char funcName[TSDB_FUNC_NAME_LEN] = {0};
|
char funcName[TSDB_FUNC_NAME_LEN] = {0};
|
||||||
SDB_GET_BINARY(pRaw, dataPos, funcName, TSDB_FUNC_NAME_LEN, _OVER)
|
SDB_GET_BINARY(pRaw, dataPos, funcName, TSDB_FUNC_NAME_LEN, _OVER)
|
||||||
(void)taosArrayPush(pStb->pFuncs, funcName);
|
if (taosArrayPush(pStb->pFuncs, funcName) == NULL) goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pStb->commentLen > 0) {
|
if (pStb->commentLen > 0) {
|
||||||
|
@ -3069,7 +3069,10 @@ int32_t mndValidateStbInfo(SMnode *pMnode, SSTableVersion *pStbVersions, int32_t
|
||||||
tstrncpy(metaRsp.dbFName, pStbVersion->dbFName, sizeof(metaRsp.dbFName));
|
tstrncpy(metaRsp.dbFName, pStbVersion->dbFName, sizeof(metaRsp.dbFName));
|
||||||
tstrncpy(metaRsp.tbName, pStbVersion->stbName, sizeof(metaRsp.tbName));
|
tstrncpy(metaRsp.tbName, pStbVersion->stbName, sizeof(metaRsp.tbName));
|
||||||
tstrncpy(metaRsp.stbName, pStbVersion->stbName, sizeof(metaRsp.stbName));
|
tstrncpy(metaRsp.stbName, pStbVersion->stbName, sizeof(metaRsp.stbName));
|
||||||
(void)taosArrayPush(hbRsp.pMetaRsp, &metaRsp);
|
if (taosArrayPush(hbRsp.pMetaRsp, &metaRsp) == NULL) {
|
||||||
|
code = terrno;
|
||||||
|
return code;
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3082,11 +3085,17 @@ int32_t mndValidateStbInfo(SMnode *pMnode, SSTableVersion *pStbVersions, int32_t
|
||||||
tstrncpy(metaRsp.dbFName, pStbVersion->dbFName, sizeof(metaRsp.dbFName));
|
tstrncpy(metaRsp.dbFName, pStbVersion->dbFName, sizeof(metaRsp.dbFName));
|
||||||
tstrncpy(metaRsp.tbName, pStbVersion->stbName, sizeof(metaRsp.tbName));
|
tstrncpy(metaRsp.tbName, pStbVersion->stbName, sizeof(metaRsp.tbName));
|
||||||
tstrncpy(metaRsp.stbName, pStbVersion->stbName, sizeof(metaRsp.stbName));
|
tstrncpy(metaRsp.stbName, pStbVersion->stbName, sizeof(metaRsp.stbName));
|
||||||
(void)taosArrayPush(hbRsp.pMetaRsp, &metaRsp);
|
if (taosArrayPush(hbRsp.pMetaRsp, &metaRsp) == NULL) {
|
||||||
|
code = terrno;
|
||||||
|
return code;
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
(void)taosArrayPush(hbRsp.pMetaRsp, &metaRsp);
|
if (taosArrayPush(hbRsp.pMetaRsp, &metaRsp) == NULL) {
|
||||||
|
code = terrno;
|
||||||
|
return code;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sma) {
|
if (sma) {
|
||||||
|
@ -3110,7 +3119,10 @@ int32_t mndValidateStbInfo(SMnode *pMnode, SSTableVersion *pStbVersions, int32_t
|
||||||
strcpy(indexRsp.dbFName, pStbVersion->dbFName);
|
strcpy(indexRsp.dbFName, pStbVersion->dbFName);
|
||||||
strcpy(indexRsp.tbName, pStbVersion->stbName);
|
strcpy(indexRsp.tbName, pStbVersion->stbName);
|
||||||
|
|
||||||
(void)taosArrayPush(hbRsp.pIndexRsp, &indexRsp);
|
if (taosArrayPush(hbRsp.pIndexRsp, &indexRsp) == NULL) {
|
||||||
|
code = terrno;
|
||||||
|
return code;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4313,7 +4325,12 @@ static int32_t mndDropTbAddTsmaResTbsForSingleVg(SMnode *pMnode, SMndDropTbsWith
|
||||||
} else {
|
} else {
|
||||||
info.dbInfo = *pDbInfo;
|
info.dbInfo = *pDbInfo;
|
||||||
}
|
}
|
||||||
(void)taosArrayPush(pInfos->pTsmaInfos, &info);
|
if (taosArrayPush(pInfos->pTsmaInfos, &info) == NULL) {
|
||||||
|
code = terrno;
|
||||||
|
sdbCancelFetch(pMnode->pSdb, pIter);
|
||||||
|
sdbRelease(pMnode->pSdb, pSma);
|
||||||
|
goto _end;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
sdbRelease(pMnode->pSdb, pSma);
|
sdbRelease(pMnode->pSdb, pSma);
|
||||||
}
|
}
|
||||||
|
@ -4333,7 +4350,10 @@ static int32_t mndDropTbAddTsmaResTbsForSingleVg(SMnode *pMnode, SMndDropTbsWith
|
||||||
taosGetTbHashVal(buf, len, pInfo->dbInfo.hashMethod, pInfo->dbInfo.hashPrefix, pInfo->dbInfo.hashSuffix);
|
taosGetTbHashVal(buf, len, pInfo->dbInfo.hashMethod, pInfo->dbInfo.hashPrefix, pInfo->dbInfo.hashSuffix);
|
||||||
const SVgroupInfo *pVgInfo = taosArraySearch(pInfo->dbInfo.dbVgInfos, &hashVal, vgHashValCmp, TD_EQ);
|
const SVgroupInfo *pVgInfo = taosArraySearch(pInfo->dbInfo.dbVgInfos, &hashVal, vgHashValCmp, TD_EQ);
|
||||||
void *p = taosStrdup(buf + strlen(pInfo->tsmaResTbDbFName) + TSDB_NAME_DELIMITER_LEN);
|
void *p = taosStrdup(buf + strlen(pInfo->tsmaResTbDbFName) + TSDB_NAME_DELIMITER_LEN);
|
||||||
(void)taosArrayPush(pCtx->pResTbNames, &p);
|
if (taosArrayPush(pCtx->pResTbNames, &p) == NULL) {
|
||||||
|
code = terrno;
|
||||||
|
goto _end;
|
||||||
|
}
|
||||||
TAOS_CHECK_GOTO(mndDropTbAdd(pMnode, pCtx->pVgMap, pVgInfo, p, pInfo->suid, true), NULL, _end);
|
TAOS_CHECK_GOTO(mndDropTbAdd(pMnode, pCtx->pVgMap, pVgInfo, p, pInfo->suid, true), NULL, _end);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -270,7 +270,9 @@ SSdbRow *mndTopicActionDecode(SSdbRaw *pRaw) {
|
||||||
}
|
}
|
||||||
int16_t colId;
|
int16_t colId;
|
||||||
SDB_GET_INT16(pRaw, dataPos, &colId, TOPIC_DECODE_OVER);
|
SDB_GET_INT16(pRaw, dataPos, &colId, TOPIC_DECODE_OVER);
|
||||||
(void)taosArrayPush(pTopic->ntbColIds, &colId);
|
if (taosArrayPush(pTopic->ntbColIds, &colId) == NULL) {
|
||||||
|
goto TOPIC_DECODE_OVER;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SDB_GET_INT64(pRaw, dataPos, &pTopic->ctbStbUid, TOPIC_DECODE_OVER);
|
SDB_GET_INT64(pRaw, dataPos, &pTopic->ctbStbUid, TOPIC_DECODE_OVER);
|
||||||
|
|
|
@ -1905,7 +1905,9 @@ void mndTransPullup(SMnode *pMnode) {
|
||||||
STrans *pTrans = NULL;
|
STrans *pTrans = NULL;
|
||||||
pIter = sdbFetch(pMnode->pSdb, SDB_TRANS, pIter, (void **)&pTrans);
|
pIter = sdbFetch(pMnode->pSdb, SDB_TRANS, pIter, (void **)&pTrans);
|
||||||
if (pIter == NULL) break;
|
if (pIter == NULL) break;
|
||||||
(void)taosArrayPush(pArray, &pTrans->id);
|
if (taosArrayPush(pArray, &pTrans->id) == NULL) {
|
||||||
|
mError("failed to put trans into array, trans:%d, but pull up will continute", pTrans->id);
|
||||||
|
}
|
||||||
sdbRelease(pSdb, pTrans);
|
sdbRelease(pSdb, pTrans);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,9 @@
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
int32_t sndBuildStreamTask(SSnode *pSnode, SStreamTask *pTask, int64_t nextProcessVer) {
|
int32_t sndBuildStreamTask(SSnode *pSnode, SStreamTask *pTask, int64_t nextProcessVer) {
|
||||||
ASSERT(pTask->info.taskLevel == TASK_LEVEL__AGG && taosArrayGetSize(pTask->upstreamInfo.pList) != 0);
|
if (!(pTask->info.taskLevel == TASK_LEVEL__AGG && taosArrayGetSize(pTask->upstreamInfo.pList) != 0)) {
|
||||||
|
return TSDB_CODE_INVALID_PARA;
|
||||||
|
}
|
||||||
int32_t code = streamTaskInit(pTask, pSnode->pMeta, &pSnode->msgCb, nextProcessVer);
|
int32_t code = streamTaskInit(pTask, pSnode->pMeta, &pSnode->msgCb, nextProcessVer);
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
return code;
|
return code;
|
||||||
|
@ -135,7 +137,7 @@ int32_t sndProcessStreamMsg(SSnode *pSnode, SRpcMsg *pMsg) {
|
||||||
return tqStreamTaskProcessRetrieveTriggerRsp(pSnode->pMeta, pMsg);
|
return tqStreamTaskProcessRetrieveTriggerRsp(pSnode->pMeta, pMsg);
|
||||||
default:
|
default:
|
||||||
sndError("invalid snode msg:%d", pMsg->msgType);
|
sndError("invalid snode msg:%d", pMsg->msgType);
|
||||||
ASSERT(0);
|
return TSDB_CODE_INVALID_MSG;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -164,7 +166,7 @@ int32_t sndProcessWriteMsg(SSnode *pSnode, SRpcMsg *pMsg, SRpcMsg *pRsp) {
|
||||||
case TDMT_STREAM_CONSEN_CHKPT:
|
case TDMT_STREAM_CONSEN_CHKPT:
|
||||||
return tqStreamTaskProcessConsenChkptIdReq(pSnode->pMeta, pMsg);
|
return tqStreamTaskProcessConsenChkptIdReq(pSnode->pMeta, pMsg);
|
||||||
default:
|
default:
|
||||||
ASSERT(0);
|
return TSDB_CODE_INVALID_MSG;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -156,7 +156,7 @@ int metaDropSTable(SMeta* pMeta, int64_t verison, SVDropStbReq* pReq
|
||||||
int metaCreateTable(SMeta* pMeta, int64_t version, SVCreateTbReq* pReq, STableMetaRsp** pMetaRsp);
|
int metaCreateTable(SMeta* pMeta, int64_t version, SVCreateTbReq* pReq, STableMetaRsp** pMetaRsp);
|
||||||
int metaDropTable(SMeta* pMeta, int64_t version, SVDropTbReq* pReq, SArray* tbUids, int64_t* tbUid);
|
int metaDropTable(SMeta* pMeta, int64_t version, SVDropTbReq* pReq, SArray* tbUids, int64_t* tbUid);
|
||||||
int32_t metaTrimTables(SMeta* pMeta);
|
int32_t metaTrimTables(SMeta* pMeta);
|
||||||
void metaDropTables(SMeta* pMeta, SArray* tbUids);
|
int32_t metaDropTables(SMeta* pMeta, SArray* tbUids);
|
||||||
int metaTtlFindExpired(SMeta* pMeta, int64_t timePointMs, SArray* tbUids, int32_t ttlDropMaxCount);
|
int metaTtlFindExpired(SMeta* pMeta, int64_t timePointMs, SArray* tbUids, int32_t ttlDropMaxCount);
|
||||||
int metaAlterTable(SMeta* pMeta, int64_t version, SVAlterTbReq* pReq, STableMetaRsp* pMetaRsp);
|
int metaAlterTable(SMeta* pMeta, int64_t version, SVAlterTbReq* pReq, STableMetaRsp* pMetaRsp);
|
||||||
int metaUpdateChangeTimeWithLock(SMeta* pMeta, tb_uid_t uid, int64_t changeTimeMs);
|
int metaUpdateChangeTimeWithLock(SMeta* pMeta, tb_uid_t uid, int64_t changeTimeMs);
|
||||||
|
|
|
@ -122,7 +122,7 @@ int32_t metaCacheOpen(SMeta* pMeta) {
|
||||||
|
|
||||||
pMeta->pCache = (SMetaCache*)taosMemoryCalloc(1, sizeof(SMetaCache));
|
pMeta->pCache = (SMetaCache*)taosMemoryCalloc(1, sizeof(SMetaCache));
|
||||||
if (pMeta->pCache == NULL) {
|
if (pMeta->pCache == NULL) {
|
||||||
TSDB_CHECK_CODE(code = TSDB_CODE_OUT_OF_MEMORY, lino, _exit);
|
TSDB_CHECK_CODE(code = terrno, lino, _exit);
|
||||||
}
|
}
|
||||||
|
|
||||||
// open entry cache
|
// open entry cache
|
||||||
|
@ -131,7 +131,7 @@ int32_t metaCacheOpen(SMeta* pMeta) {
|
||||||
pMeta->pCache->sEntryCache.aBucket =
|
pMeta->pCache->sEntryCache.aBucket =
|
||||||
(SMetaCacheEntry**)taosMemoryCalloc(pMeta->pCache->sEntryCache.nBucket, sizeof(SMetaCacheEntry*));
|
(SMetaCacheEntry**)taosMemoryCalloc(pMeta->pCache->sEntryCache.nBucket, sizeof(SMetaCacheEntry*));
|
||||||
if (pMeta->pCache->sEntryCache.aBucket == NULL) {
|
if (pMeta->pCache->sEntryCache.aBucket == NULL) {
|
||||||
TSDB_CHECK_CODE(code = TSDB_CODE_OUT_OF_MEMORY, lino, _exit);
|
TSDB_CHECK_CODE(code = terrno, lino, _exit);
|
||||||
}
|
}
|
||||||
|
|
||||||
// open stats cache
|
// open stats cache
|
||||||
|
@ -140,7 +140,7 @@ int32_t metaCacheOpen(SMeta* pMeta) {
|
||||||
pMeta->pCache->sStbStatsCache.aBucket =
|
pMeta->pCache->sStbStatsCache.aBucket =
|
||||||
(SMetaStbStatsEntry**)taosMemoryCalloc(pMeta->pCache->sStbStatsCache.nBucket, sizeof(SMetaStbStatsEntry*));
|
(SMetaStbStatsEntry**)taosMemoryCalloc(pMeta->pCache->sStbStatsCache.nBucket, sizeof(SMetaStbStatsEntry*));
|
||||||
if (pMeta->pCache->sStbStatsCache.aBucket == NULL) {
|
if (pMeta->pCache->sStbStatsCache.aBucket == NULL) {
|
||||||
TSDB_CHECK_CODE(code = TSDB_CODE_OUT_OF_MEMORY, lino, _exit);
|
TSDB_CHECK_CODE(code = terrno, lino, _exit);
|
||||||
}
|
}
|
||||||
|
|
||||||
pMeta->pCache->sTagFilterResCache.pUidResCache = taosLRUCacheInit(5 * 1024 * 1024, -1, 0.5);
|
pMeta->pCache->sTagFilterResCache.pUidResCache = taosLRUCacheInit(5 * 1024 * 1024, -1, 0.5);
|
||||||
|
@ -228,7 +228,7 @@ static int32_t metaRehashCache(SMetaCache* pCache, int8_t expand) {
|
||||||
|
|
||||||
SMetaCacheEntry** aBucket = (SMetaCacheEntry**)taosMemoryCalloc(nBucket, sizeof(SMetaCacheEntry*));
|
SMetaCacheEntry** aBucket = (SMetaCacheEntry**)taosMemoryCalloc(nBucket, sizeof(SMetaCacheEntry*));
|
||||||
if (aBucket == NULL) {
|
if (aBucket == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _exit;
|
goto _exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -361,7 +361,7 @@ static int32_t metaRehashStatsCache(SMetaCache* pCache, int8_t expand) {
|
||||||
|
|
||||||
SMetaStbStatsEntry** aBucket = (SMetaStbStatsEntry**)taosMemoryCalloc(nBucket, sizeof(SMetaStbStatsEntry*));
|
SMetaStbStatsEntry** aBucket = (SMetaStbStatsEntry**)taosMemoryCalloc(nBucket, sizeof(SMetaStbStatsEntry*));
|
||||||
if (aBucket == NULL) {
|
if (aBucket == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _exit;
|
goto _exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ int32_t metaOpen(SVnode *pVnode, SMeta **ppMeta, int8_t rollback) {
|
||||||
snprintf(path + offset, TSDB_FILENAME_LEN - offset - 1, "%s%s", TD_DIRSEP, VNODE_META_DIR);
|
snprintf(path + offset, TSDB_FILENAME_LEN - offset - 1, "%s%s", TD_DIRSEP, VNODE_META_DIR);
|
||||||
|
|
||||||
if ((pMeta = taosMemoryCalloc(1, sizeof(*pMeta) + strlen(path) + 1)) == NULL) {
|
if ((pMeta = taosMemoryCalloc(1, sizeof(*pMeta) + strlen(path) + 1)) == NULL) {
|
||||||
TSDB_CHECK_CODE(code = TSDB_CODE_OUT_OF_MEMORY, lino, _exit);
|
TSDB_CHECK_CODE(code = terrno, lino, _exit);
|
||||||
}
|
}
|
||||||
|
|
||||||
(void)metaInitLock(pMeta);
|
(void)metaInitLock(pMeta);
|
||||||
|
|
|
@ -1255,7 +1255,7 @@ int32_t metaFilterTableIds(void *pVnode, SMetaFltParam *arg, SArray *pUids) {
|
||||||
SIdxCursor *pCursor = NULL;
|
SIdxCursor *pCursor = NULL;
|
||||||
pCursor = (SIdxCursor *)taosMemoryCalloc(1, sizeof(SIdxCursor));
|
pCursor = (SIdxCursor *)taosMemoryCalloc(1, sizeof(SIdxCursor));
|
||||||
if (!pCursor) {
|
if (!pCursor) {
|
||||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
return terrno;
|
||||||
}
|
}
|
||||||
pCursor->pMeta = pMeta;
|
pCursor->pMeta = pMeta;
|
||||||
pCursor->suid = param->suid;
|
pCursor->suid = param->suid;
|
||||||
|
@ -1486,7 +1486,12 @@ int32_t metaGetTableTags(void *pVnode, uint64_t suid, SArray *pUidTagInfo) {
|
||||||
taosHashInit(numOfElems / 0.7, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_NO_LOCK);
|
taosHashInit(numOfElems / 0.7, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_NO_LOCK);
|
||||||
for (int i = 0; i < numOfElems; i++) {
|
for (int i = 0; i < numOfElems; i++) {
|
||||||
STUidTagInfo *pTagInfo = taosArrayGet(pUidTagInfo, i);
|
STUidTagInfo *pTagInfo = taosArrayGet(pUidTagInfo, i);
|
||||||
(void)taosHashPut(pSepecifiedUidMap, &pTagInfo->uid, sizeof(uint64_t), &i, sizeof(int32_t));
|
int32_t code = taosHashPut(pSepecifiedUidMap, &pTagInfo->uid, sizeof(uint64_t), &i, sizeof(int32_t));
|
||||||
|
if (code) {
|
||||||
|
metaCloseCtbCursor(pCur);
|
||||||
|
taosHashCleanup(pSepecifiedUidMap);
|
||||||
|
return code;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -137,7 +137,7 @@ int32_t metaSnapWriterOpen(SMeta* pMeta, int64_t sver, int64_t ever, SMetaSnapWr
|
||||||
// alloc
|
// alloc
|
||||||
pWriter = (SMetaSnapWriter*)taosMemoryCalloc(1, sizeof(*pWriter));
|
pWriter = (SMetaSnapWriter*)taosMemoryCalloc(1, sizeof(*pWriter));
|
||||||
if (pWriter == NULL) {
|
if (pWriter == NULL) {
|
||||||
TSDB_CHECK_CODE(code = TSDB_CODE_OUT_OF_MEMORY, lino, _exit);
|
TSDB_CHECK_CODE(code = terrno, lino, _exit);
|
||||||
}
|
}
|
||||||
pWriter->pMeta = pMeta;
|
pWriter->pMeta = pMeta;
|
||||||
pWriter->sver = sver;
|
pWriter->sver = sver;
|
||||||
|
@ -304,7 +304,7 @@ int32_t buildSnapContext(SVnode* pVnode, int64_t snapVersion, int64_t suid, int8
|
||||||
SSnapContext** ctxRet) {
|
SSnapContext** ctxRet) {
|
||||||
SSnapContext* ctx = taosMemoryCalloc(1, sizeof(SSnapContext));
|
SSnapContext* ctx = taosMemoryCalloc(1, sizeof(SSnapContext));
|
||||||
if (ctx == NULL) {
|
if (ctx == NULL) {
|
||||||
return TAOS_GET_TERRNO(TSDB_CODE_OUT_OF_MEMORY);
|
return terrno;
|
||||||
}
|
}
|
||||||
*ctxRet = ctx;
|
*ctxRet = ctx;
|
||||||
ctx->pMeta = pVnode->pMeta;
|
ctx->pMeta = pVnode->pMeta;
|
||||||
|
|
|
@ -381,7 +381,11 @@ int metaDropSTable(SMeta *pMeta, int64_t verison, SVDropStbReq *pReq, SArray *tb
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
(void)taosArrayPush(tbUidList, &(((SCtbIdxKey *)pKey)->uid));
|
if (taosArrayPush(tbUidList, &(((SCtbIdxKey *)pKey)->uid)) == NULL) {
|
||||||
|
tdbFree(pKey);
|
||||||
|
(void)tdbTbcClose(pCtbIdxc);
|
||||||
|
return terrno;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
(void)tdbTbcClose(pCtbIdxc);
|
(void)tdbTbcClose(pCtbIdxc);
|
||||||
|
@ -505,7 +509,11 @@ int metaAlterSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) {
|
||||||
return terrno = TSDB_CODE_TDB_STB_NOT_EXIST;
|
return terrno = TSDB_CODE_TDB_STB_NOT_EXIST;
|
||||||
}
|
}
|
||||||
|
|
||||||
oStbEntry.pBuf = taosMemoryMalloc(nData);
|
if ((oStbEntry.pBuf = taosMemoryMalloc(nData)) == NULL) {
|
||||||
|
(void)tdbTbcClose(pTbDbc);
|
||||||
|
(void)tdbTbcClose(pUidIdxc);
|
||||||
|
return terrno;
|
||||||
|
}
|
||||||
memcpy(oStbEntry.pBuf, pData, nData);
|
memcpy(oStbEntry.pBuf, pData, nData);
|
||||||
tDecoderInit(&dc, oStbEntry.pBuf, nData);
|
tDecoderInit(&dc, oStbEntry.pBuf, nData);
|
||||||
(void)metaDecodeEntry(&dc, &oStbEntry);
|
(void)metaDecodeEntry(&dc, &oStbEntry);
|
||||||
|
@ -527,6 +535,13 @@ int metaAlterSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) {
|
||||||
if (!TSDB_CACHE_NO(pMeta->pVnode->config)) {
|
if (!TSDB_CACHE_NO(pMeta->pVnode->config)) {
|
||||||
STsdb *pTsdb = pMeta->pVnode->pTsdb;
|
STsdb *pTsdb = pMeta->pVnode->pTsdb;
|
||||||
SArray *uids = taosArrayInit(8, sizeof(int64_t));
|
SArray *uids = taosArrayInit(8, sizeof(int64_t));
|
||||||
|
if (uids == NULL) {
|
||||||
|
if (oStbEntry.pBuf) taosMemoryFree(oStbEntry.pBuf);
|
||||||
|
tDecoderClear(&dc);
|
||||||
|
(void)tdbTbcClose(pTbDbc);
|
||||||
|
(void)tdbTbcClose(pUidIdxc);
|
||||||
|
return terrno;
|
||||||
|
}
|
||||||
if (deltaCol == 1) {
|
if (deltaCol == 1) {
|
||||||
int16_t cid = pReq->schemaRow.pSchema[nCols - 1].colId;
|
int16_t cid = pReq->schemaRow.pSchema[nCols - 1].colId;
|
||||||
int8_t col_type = pReq->schemaRow.pSchema[nCols - 1].type;
|
int8_t col_type = pReq->schemaRow.pSchema[nCols - 1].type;
|
||||||
|
@ -808,7 +823,10 @@ int metaDropIndexFromSTable(SMeta *pMeta, int64_t version, SDropIndexReq *pReq)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pCol == NULL) {
|
if (pCol == NULL) {
|
||||||
code = TSDB_CODE_VND_COL_NOT_EXISTS;
|
metaError("vgId:%d, failed to drop index on %s.%s,since %s", TD_VID(pMeta->pVnode), pReq->stb, pReq->colName,
|
||||||
|
tstrerror(TSDB_CODE_VND_COL_NOT_EXISTS));
|
||||||
|
code = 0;
|
||||||
|
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1108,7 +1126,10 @@ int metaDropTable(SMeta *pMeta, int64_t version, SVDropTbReq *pReq, SArray *tbUi
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((type == TSDB_CHILD_TABLE || type == TSDB_NORMAL_TABLE) && tbUids) {
|
if ((type == TSDB_CHILD_TABLE || type == TSDB_NORMAL_TABLE) && tbUids) {
|
||||||
(void)taosArrayPush(tbUids, &uid);
|
if (taosArrayPush(tbUids, &uid) == NULL) {
|
||||||
|
rc = terrno;
|
||||||
|
goto _exit;
|
||||||
|
}
|
||||||
|
|
||||||
if (!TSDB_CACHE_NO(pMeta->pVnode->config)) {
|
if (!TSDB_CACHE_NO(pMeta->pVnode->config)) {
|
||||||
(void)tsdbCacheDropTable(pMeta->pVnode->pTsdb, uid, suid, NULL);
|
(void)tsdbCacheDropTable(pMeta->pVnode->pTsdb, uid, suid, NULL);
|
||||||
|
@ -1125,11 +1146,15 @@ _exit:
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
void metaDropTables(SMeta *pMeta, SArray *tbUids) {
|
int32_t metaDropTables(SMeta *pMeta, SArray *tbUids) {
|
||||||
if (taosArrayGetSize(tbUids) == 0) return;
|
int32_t code = 0;
|
||||||
|
if (taosArrayGetSize(tbUids) == 0) return TSDB_CODE_SUCCESS;
|
||||||
|
|
||||||
int64_t nCtbDropped = 0;
|
int64_t nCtbDropped = 0;
|
||||||
SSHashObj *suidHash = tSimpleHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT));
|
SSHashObj *suidHash = tSimpleHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT));
|
||||||
|
if (suidHash == NULL) {
|
||||||
|
return terrno;
|
||||||
|
}
|
||||||
|
|
||||||
metaWLock(pMeta);
|
metaWLock(pMeta);
|
||||||
for (int i = 0; i < taosArrayGetSize(tbUids); ++i) {
|
for (int i = 0; i < taosArrayGetSize(tbUids); ++i) {
|
||||||
|
@ -1137,7 +1162,8 @@ void metaDropTables(SMeta *pMeta, SArray *tbUids) {
|
||||||
tb_uid_t suid = 0;
|
tb_uid_t suid = 0;
|
||||||
int8_t sysTbl = 0;
|
int8_t sysTbl = 0;
|
||||||
int type;
|
int type;
|
||||||
(void)metaDropTableByUid(pMeta, uid, &type, &suid, &sysTbl);
|
code = metaDropTableByUid(pMeta, uid, &type, &suid, &sysTbl);
|
||||||
|
if (code) return code;
|
||||||
if (!sysTbl && type == TSDB_CHILD_TABLE && suid != 0 && suidHash) {
|
if (!sysTbl && type == TSDB_CHILD_TABLE && suid != 0 && suidHash) {
|
||||||
int64_t *pVal = tSimpleHashGet(suidHash, &suid, sizeof(tb_uid_t));
|
int64_t *pVal = tSimpleHashGet(suidHash, &suid, sizeof(tb_uid_t));
|
||||||
if (pVal) {
|
if (pVal) {
|
||||||
|
@ -1145,7 +1171,8 @@ void metaDropTables(SMeta *pMeta, SArray *tbUids) {
|
||||||
} else {
|
} else {
|
||||||
nCtbDropped = 1;
|
nCtbDropped = 1;
|
||||||
}
|
}
|
||||||
(void)tSimpleHashPut(suidHash, &suid, sizeof(tb_uid_t), &nCtbDropped, sizeof(int64_t));
|
code = tSimpleHashPut(suidHash, &suid, sizeof(tb_uid_t), &nCtbDropped, sizeof(int64_t));
|
||||||
|
if (code) return code;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
if (!TSDB_CACHE_NO(pMeta->pVnode->config)) {
|
if (!TSDB_CACHE_NO(pMeta->pVnode->config)) {
|
||||||
|
@ -1170,6 +1197,7 @@ void metaDropTables(SMeta *pMeta, SArray *tbUids) {
|
||||||
tSimpleHashCleanup(suidHash);
|
tSimpleHashCleanup(suidHash);
|
||||||
|
|
||||||
pMeta->changed = true;
|
pMeta->changed = true;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t metaFilterTableByHash(SMeta *pMeta, SArray *uidList) {
|
static int32_t metaFilterTableByHash(SMeta *pMeta, SArray *uidList) {
|
||||||
|
@ -1210,7 +1238,10 @@ static int32_t metaFilterTableByHash(SMeta *pMeta, SArray *uidList) {
|
||||||
tbFName[TSDB_TABLE_FNAME_LEN] = '\0';
|
tbFName[TSDB_TABLE_FNAME_LEN] = '\0';
|
||||||
int32_t ret = vnodeValidateTableHash(pMeta->pVnode, tbFName);
|
int32_t ret = vnodeValidateTableHash(pMeta->pVnode, tbFName);
|
||||||
if (ret < 0 && terrno == TSDB_CODE_VND_HASH_MISMATCH) {
|
if (ret < 0 && terrno == TSDB_CODE_VND_HASH_MISMATCH) {
|
||||||
(void)taosArrayPush(uidList, &me.uid);
|
if (taosArrayPush(uidList, &me.uid) == NULL) {
|
||||||
|
code = terrno;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tDecoderClear(&dc);
|
tDecoderClear(&dc);
|
||||||
|
@ -1239,7 +1270,8 @@ int32_t metaTrimTables(SMeta *pMeta) {
|
||||||
}
|
}
|
||||||
|
|
||||||
metaInfo("vgId:%d, trim %ld tables", TD_VID(pMeta->pVnode), taosArrayGetSize(tbUids));
|
metaInfo("vgId:%d, trim %ld tables", TD_VID(pMeta->pVnode), taosArrayGetSize(tbUids));
|
||||||
metaDropTables(pMeta, tbUids);
|
code = metaDropTables(pMeta, tbUids);
|
||||||
|
if (code) goto end;
|
||||||
|
|
||||||
end:
|
end:
|
||||||
taosArrayDestroy(tbUids);
|
taosArrayDestroy(tbUids);
|
||||||
|
@ -1867,11 +1899,19 @@ static int metaUpdateTableTagVal(SMeta *pMeta, int64_t version, SVAlterTbReq *pA
|
||||||
} else {
|
} else {
|
||||||
memcpy(&val.i64, pAlterTbReq->pTagVal, pAlterTbReq->nTagVal);
|
memcpy(&val.i64, pAlterTbReq->pTagVal, pAlterTbReq->nTagVal);
|
||||||
}
|
}
|
||||||
(void)taosArrayPush(pTagArray, &val);
|
if (taosArrayPush(pTagArray, &val) == NULL) {
|
||||||
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
taosArrayDestroy(pTagArray);
|
||||||
|
goto _err;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
STagVal val = {.cid = pCol->colId};
|
STagVal val = {.cid = pCol->colId};
|
||||||
if (tTagGet(pOldTag, &val)) {
|
if (tTagGet(pOldTag, &val)) {
|
||||||
(void)taosArrayPush(pTagArray, &val);
|
if (taosArrayPush(pTagArray, &val) == NULL) {
|
||||||
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
taosArrayDestroy(pTagArray);
|
||||||
|
goto _err;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2238,6 +2278,9 @@ static int metaDropTagIndex(SMeta *pMeta, int64_t version, SVAlterTbReq *pAlterT
|
||||||
}
|
}
|
||||||
|
|
||||||
SArray *tagIdxList = taosArrayInit(512, sizeof(SMetaPair));
|
SArray *tagIdxList = taosArrayInit(512, sizeof(SMetaPair));
|
||||||
|
if (tagIdxList == NULL) {
|
||||||
|
goto _err;
|
||||||
|
}
|
||||||
|
|
||||||
TBC *pTagIdxc = NULL;
|
TBC *pTagIdxc = NULL;
|
||||||
TAOS_CHECK_RETURN(tdbTbcOpen(pMeta->pTagIdx, &pTagIdxc, NULL));
|
TAOS_CHECK_RETURN(tdbTbcOpen(pMeta->pTagIdx, &pTagIdxc, NULL));
|
||||||
|
@ -2255,7 +2298,9 @@ static int metaDropTagIndex(SMeta *pMeta, int64_t version, SVAlterTbReq *pAlterT
|
||||||
}
|
}
|
||||||
|
|
||||||
SMetaPair pair = {.key = pKey, nKey = nKey};
|
SMetaPair pair = {.key = pKey, nKey = nKey};
|
||||||
(void)taosArrayPush(tagIdxList, &pair);
|
if (taosArrayPush(tagIdxList, &pair) == NULL) {
|
||||||
|
goto _err;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
(void)tdbTbcClose(pTagIdxc);
|
(void)tdbTbcClose(pTagIdxc);
|
||||||
|
|
||||||
|
@ -2797,7 +2842,14 @@ int32_t metaGetColCmpr(SMeta *pMeta, tb_uid_t uid, SHashObj **ppColCmprObj) {
|
||||||
SColCmprWrapper *p = &e.colCmpr;
|
SColCmprWrapper *p = &e.colCmpr;
|
||||||
for (int32_t i = 0; i < p->nCols; i++) {
|
for (int32_t i = 0; i < p->nCols; i++) {
|
||||||
SColCmpr *pCmpr = &p->pColCmpr[i];
|
SColCmpr *pCmpr = &p->pColCmpr[i];
|
||||||
(void)taosHashPut(pColCmprObj, &pCmpr->id, sizeof(pCmpr->id), &pCmpr->alg, sizeof(pCmpr->alg));
|
rc = taosHashPut(pColCmprObj, &pCmpr->id, sizeof(pCmpr->id), &pCmpr->alg, sizeof(pCmpr->alg));
|
||||||
|
if (rc < 0) {
|
||||||
|
tDecoderClear(&dc);
|
||||||
|
tdbFree(pData);
|
||||||
|
metaULock(pMeta);
|
||||||
|
taosHashClear(pColCmprObj);
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
tDecoderClear(&dc);
|
tDecoderClear(&dc);
|
||||||
|
|
|
@ -117,10 +117,10 @@ static int32_t tdNewSmaEnv(SSma *pSma, int8_t smaType, SSmaEnv **ppEnv) {
|
||||||
SSmaEnv *pEnv = NULL;
|
SSmaEnv *pEnv = NULL;
|
||||||
|
|
||||||
pEnv = (SSmaEnv *)taosMemoryCalloc(1, sizeof(SSmaEnv));
|
pEnv = (SSmaEnv *)taosMemoryCalloc(1, sizeof(SSmaEnv));
|
||||||
*ppEnv = pEnv;
|
|
||||||
if (!pEnv) {
|
if (!pEnv) {
|
||||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
return terrno;
|
||||||
}
|
}
|
||||||
|
*ppEnv = pEnv;
|
||||||
|
|
||||||
SMA_ENV_TYPE(pEnv) = smaType;
|
SMA_ENV_TYPE(pEnv) = smaType;
|
||||||
|
|
||||||
|
@ -199,7 +199,7 @@ static int32_t tdInitSmaStat(SSmaStat **pSmaStat, int8_t smaType, const SSma *pS
|
||||||
if (!(*pSmaStat)) {
|
if (!(*pSmaStat)) {
|
||||||
*pSmaStat = (SSmaStat *)taosMemoryCalloc(1, sizeof(SSmaStat) + sizeof(TdThread) * tsNumOfVnodeRsmaThreads);
|
*pSmaStat = (SSmaStat *)taosMemoryCalloc(1, sizeof(SSmaStat) + sizeof(TdThread) * tsNumOfVnodeRsmaThreads);
|
||||||
if (!(*pSmaStat)) {
|
if (!(*pSmaStat)) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
TAOS_CHECK_GOTO(code, &lino, _exit);
|
TAOS_CHECK_GOTO(code, &lino, _exit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -139,7 +139,7 @@ int32_t smaOpen(SVnode *pVnode, int8_t rollback, bool force) {
|
||||||
|
|
||||||
SSma *pSma = taosMemoryCalloc(1, sizeof(SSma));
|
SSma *pSma = taosMemoryCalloc(1, sizeof(SSma));
|
||||||
if (!pSma) {
|
if (!pSma) {
|
||||||
TAOS_CHECK_EXIT(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_CHECK_EXIT(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
pVnode->pSma = pSma;
|
pVnode->pSma = pSma;
|
||||||
|
|
|
@ -123,7 +123,7 @@ void *tdFreeRSmaInfo(SSma *pSma, SRSmaInfo *pInfo) {
|
||||||
static FORCE_INLINE int32_t tdUidStoreInit(STbUidStore **pStore) {
|
static FORCE_INLINE int32_t tdUidStoreInit(STbUidStore **pStore) {
|
||||||
*pStore = taosMemoryCalloc(1, sizeof(STbUidStore));
|
*pStore = taosMemoryCalloc(1, sizeof(STbUidStore));
|
||||||
if (*pStore == NULL) {
|
if (*pStore == NULL) {
|
||||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
|
@ -285,7 +285,7 @@ static int32_t tdSetRSmaInfoItemParams(SSma *pSma, SRSmaParam *param, SRSmaStat
|
||||||
|
|
||||||
SStreamTask *pStreamTask = taosMemoryCalloc(1, sizeof(*pStreamTask));
|
SStreamTask *pStreamTask = taosMemoryCalloc(1, sizeof(*pStreamTask));
|
||||||
if (!pStreamTask) {
|
if (!pStreamTask) {
|
||||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
return terrno;
|
||||||
}
|
}
|
||||||
pItem->pStreamTask = pStreamTask;
|
pItem->pStreamTask = pStreamTask;
|
||||||
pStreamTask->id.taskId = 0;
|
pStreamTask->id.taskId = 0;
|
||||||
|
@ -389,7 +389,7 @@ int32_t tdRSmaProcessCreateImpl(SSma *pSma, SRSmaParam *param, int64_t suid, con
|
||||||
// from write queue: single thead
|
// from write queue: single thead
|
||||||
pRSmaInfo = (SRSmaInfo *)taosMemoryCalloc(1, sizeof(SRSmaInfo));
|
pRSmaInfo = (SRSmaInfo *)taosMemoryCalloc(1, sizeof(SRSmaInfo));
|
||||||
if (!pRSmaInfo) {
|
if (!pRSmaInfo) {
|
||||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
STSchema *pTSchema = metaGetTbTSchema(SMA_META(pSma), suid, -1, 1);
|
STSchema *pTSchema = metaGetTbTSchema(SMA_META(pSma), suid, -1, 1);
|
||||||
|
|
|
@ -38,7 +38,7 @@ int32_t rsmaSnapReaderOpen(SSma* pSma, int64_t sver, int64_t ever, SRSmaSnapRead
|
||||||
// alloc
|
// alloc
|
||||||
pReader = (SRSmaSnapReader*)taosMemoryCalloc(1, sizeof(*pReader));
|
pReader = (SRSmaSnapReader*)taosMemoryCalloc(1, sizeof(*pReader));
|
||||||
if (pReader == NULL) {
|
if (pReader == NULL) {
|
||||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit);
|
TAOS_CHECK_GOTO(terrno, &lino, _exit);
|
||||||
}
|
}
|
||||||
pReader->pSma = pSma;
|
pReader->pSma = pSma;
|
||||||
pReader->sver = sver;
|
pReader->sver = sver;
|
||||||
|
@ -136,7 +136,7 @@ int32_t rsmaSnapWriterOpen(SSma* pSma, int64_t sver, int64_t ever, void** ppRang
|
||||||
// alloc
|
// alloc
|
||||||
pWriter = (SRSmaSnapWriter*)taosMemoryCalloc(1, sizeof(*pWriter));
|
pWriter = (SRSmaSnapWriter*)taosMemoryCalloc(1, sizeof(*pWriter));
|
||||||
if (!pWriter) {
|
if (!pWriter) {
|
||||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit);
|
TAOS_CHECK_GOTO(terrno, &lino, _exit);
|
||||||
}
|
}
|
||||||
pWriter->pSma = pSma;
|
pWriter->pSma = pSma;
|
||||||
pWriter->sver = sver;
|
pWriter->sver = sver;
|
||||||
|
|
|
@ -165,7 +165,7 @@ int32_t smaBlockToSubmit(SVnode *pVnode, const SArray *pBlocks, const STSchema *
|
||||||
pReq = taosMemoryCalloc(1, sizeof(SSubmitReq2));
|
pReq = taosMemoryCalloc(1, sizeof(SSubmitReq2));
|
||||||
|
|
||||||
if (!tagArray || !pReq) {
|
if (!tagArray || !pReq) {
|
||||||
TAOS_CHECK_EXIT(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_CHECK_EXIT(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
pReq->aSubmitTbData = taosArrayInit(1, sizeof(SSubmitTbData));
|
pReq->aSubmitTbData = taosArrayInit(1, sizeof(SSubmitTbData));
|
||||||
|
|
|
@ -66,7 +66,7 @@ static bool tqOffsetEqual(const STqOffset* pLeft, const STqOffset* pRight) {
|
||||||
int32_t tqOpen(const char* path, SVnode* pVnode) {
|
int32_t tqOpen(const char* path, SVnode* pVnode) {
|
||||||
STQ* pTq = taosMemoryCalloc(1, sizeof(STQ));
|
STQ* pTq = taosMemoryCalloc(1, sizeof(STQ));
|
||||||
if (pTq == NULL) {
|
if (pTq == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
pVnode->pTq = pTq;
|
pVnode->pTq = pTq;
|
||||||
pTq->path = taosStrdup(path);
|
pTq->path = taosStrdup(path);
|
||||||
|
|
|
@ -115,7 +115,7 @@ int32_t tqMetaSaveOffset(STQ* pTq, STqOffset* pOffset) {
|
||||||
|
|
||||||
buf = taosMemoryCalloc(1, vlen);
|
buf = taosMemoryCalloc(1, vlen);
|
||||||
if (buf == NULL) {
|
if (buf == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto END;
|
goto END;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -212,7 +212,7 @@ int32_t tqMetaSaveHandle(STQ* pTq, const char* key, const STqHandle* pHandle) {
|
||||||
|
|
||||||
buf = taosMemoryCalloc(1, vlen);
|
buf = taosMemoryCalloc(1, vlen);
|
||||||
if (buf == NULL) {
|
if (buf == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto END;
|
goto END;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ int32_t tqBuildFName(char** data, const char* path, char* name) {
|
||||||
int32_t len = strlen(path) + strlen(name) + 2;
|
int32_t len = strlen(path) + strlen(name) + 2;
|
||||||
char* fname = taosMemoryCalloc(1, len);
|
char* fname = taosMemoryCalloc(1, len);
|
||||||
if(fname == NULL) {
|
if(fname == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
int32_t code = snprintf(fname, len, "%s%s%s", path, TD_DIRSEP, name);
|
int32_t code = snprintf(fname, len, "%s%s%s", path, TD_DIRSEP, name);
|
||||||
if (code < 0){
|
if (code < 0){
|
||||||
|
@ -56,7 +56,7 @@ int32_t tqOffsetRestoreFromFile(STQ* pTq, char* name) {
|
||||||
size = htonl(size);
|
size = htonl(size);
|
||||||
pMemBuf = taosMemoryCalloc(1, size);
|
pMemBuf = taosMemoryCalloc(1, size);
|
||||||
if (pMemBuf == NULL) {
|
if (pMemBuf == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto END;
|
goto END;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -547,7 +547,7 @@ int32_t tqMaskBlock(SSchemaWrapper* pDst, SSDataBlock* pBlock, const SSchemaWrap
|
||||||
pDst->nCols = cnt;
|
pDst->nCols = cnt;
|
||||||
pDst->pSchema = taosMemoryCalloc(cnt, sizeof(SSchema));
|
pDst->pSchema = taosMemoryCalloc(cnt, sizeof(SSchema));
|
||||||
if (pDst->pSchema == NULL) {
|
if (pDst->pSchema == NULL) {
|
||||||
return TAOS_GET_TERRNO(TSDB_CODE_OUT_OF_MEMORY);
|
return TAOS_GET_TERRNO(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t j = 0;
|
int32_t j = 0;
|
||||||
|
|
|
@ -19,7 +19,7 @@ int32_t tqAddBlockDataToRsp(const SSDataBlock* pBlock, void* pRsp, int32_t numOf
|
||||||
int32_t dataStrLen = sizeof(SRetrieveTableRspForTmq) + blockGetEncodeSize(pBlock);
|
int32_t dataStrLen = sizeof(SRetrieveTableRspForTmq) + blockGetEncodeSize(pBlock);
|
||||||
void* buf = taosMemoryCalloc(1, dataStrLen);
|
void* buf = taosMemoryCalloc(1, dataStrLen);
|
||||||
if (buf == NULL) {
|
if (buf == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
SRetrieveTableRspForTmq* pRetrieve = (SRetrieveTableRspForTmq*)buf;
|
SRetrieveTableRspForTmq* pRetrieve = (SRetrieveTableRspForTmq*)buf;
|
||||||
|
@ -344,7 +344,7 @@ static void tqProcessSubData(STQ* pTq, STqHandle* pHandle, STaosxRsp* pRsp, int3
|
||||||
}
|
}
|
||||||
void* createReq = taosMemoryCalloc(1, len);
|
void* createReq = taosMemoryCalloc(1, len);
|
||||||
if (createReq == NULL){
|
if (createReq == NULL){
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto END;
|
goto END;
|
||||||
}
|
}
|
||||||
SEncoder encoder = {0};
|
SEncoder encoder = {0};
|
||||||
|
|
|
@ -549,7 +549,7 @@ int32_t buildAutoCreateTableReq(const char* stbFullName, int64_t suid, int32_t n
|
||||||
|
|
||||||
SVCreateTbReq* pCreateTbReq = taosMemoryCalloc(1, sizeof(SVCreateTbReq));
|
SVCreateTbReq* pCreateTbReq = taosMemoryCalloc(1, sizeof(SVCreateTbReq));
|
||||||
if (pCreateTbReq == NULL) {
|
if (pCreateTbReq == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
taosArrayClear(pTagArray);
|
taosArrayClear(pTagArray);
|
||||||
|
@ -802,7 +802,7 @@ int32_t doCreateSinkInfo(const char* pDstTableName, STableSinkInfo** pInfo) {
|
||||||
int32_t nameLen = strlen(pDstTableName);
|
int32_t nameLen = strlen(pDstTableName);
|
||||||
(*pInfo) = taosMemoryCalloc(1, sizeof(STableSinkInfo) + nameLen + 1);
|
(*pInfo) = taosMemoryCalloc(1, sizeof(STableSinkInfo) + nameLen + 1);
|
||||||
if (*pInfo == NULL) {
|
if (*pInfo == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
(*pInfo)->name.len = nameLen;
|
(*pInfo)->name.len = nameLen;
|
||||||
|
|
|
@ -38,7 +38,7 @@ int32_t streamStateSnapReaderOpen(STQ* pTq, int64_t sver, int64_t ever, SStreamS
|
||||||
// alloc
|
// alloc
|
||||||
pReader = (SStreamStateReader*)taosMemoryCalloc(1, sizeof(SStreamStateReader));
|
pReader = (SStreamStateReader*)taosMemoryCalloc(1, sizeof(SStreamStateReader));
|
||||||
if (pReader == NULL) {
|
if (pReader == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,7 +130,7 @@ int32_t streamStateSnapWriterOpen(STQ* pTq, int64_t sver, int64_t ever, SStreamS
|
||||||
// alloc
|
// alloc
|
||||||
pWriter = (SStreamStateWriter*)taosMemoryCalloc(1, sizeof(*pWriter));
|
pWriter = (SStreamStateWriter*)taosMemoryCalloc(1, sizeof(*pWriter));
|
||||||
if (pWriter == NULL) {
|
if (pWriter == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
pWriter->pTq = pTq;
|
pWriter->pTq = pTq;
|
||||||
|
|
|
@ -39,7 +39,7 @@ int32_t streamTaskSnapReaderOpen(STQ* pTq, int64_t sver, int64_t ever, SStreamTa
|
||||||
// alloc
|
// alloc
|
||||||
pReader = (SStreamTaskReader*)taosMemoryCalloc(1, sizeof(SStreamTaskReader));
|
pReader = (SStreamTaskReader*)taosMemoryCalloc(1, sizeof(SStreamTaskReader));
|
||||||
if (pReader == NULL) {
|
if (pReader == NULL) {
|
||||||
TAOS_CHECK_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_CHECK_RETURN(terrno);
|
||||||
}
|
}
|
||||||
pReader->pTq = pTq;
|
pReader->pTq = pTq;
|
||||||
pReader->sver = sver;
|
pReader->sver = sver;
|
||||||
|
@ -120,7 +120,7 @@ NextTbl:
|
||||||
} else {
|
} else {
|
||||||
pVal = taosMemoryCalloc(1, tLen);
|
pVal = taosMemoryCalloc(1, tLen);
|
||||||
if (pVal == NULL) {
|
if (pVal == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
memcpy(pVal, tVal, tLen);
|
memcpy(pVal, tVal, tLen);
|
||||||
|
@ -181,7 +181,7 @@ int32_t streamTaskSnapWriterOpen(STQ* pTq, int64_t sver, int64_t ever, SStreamTa
|
||||||
// alloc
|
// alloc
|
||||||
pWriter = (SStreamTaskWriter*)taosMemoryCalloc(1, sizeof(*pWriter));
|
pWriter = (SStreamTaskWriter*)taosMemoryCalloc(1, sizeof(*pWriter));
|
||||||
if (pWriter == NULL) {
|
if (pWriter == NULL) {
|
||||||
TAOS_CHECK_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_CHECK_RETURN(terrno);
|
||||||
}
|
}
|
||||||
pWriter->pTq = pTq;
|
pWriter->pTq = pTq;
|
||||||
pWriter->sver = sver;
|
pWriter->sver = sver;
|
||||||
|
|
|
@ -582,7 +582,7 @@ int32_t tqStreamTaskProcessDeployReq(SStreamMeta* pMeta, SMsgCb* cb, int64_t sve
|
||||||
SStreamTask* pTask = taosMemoryCalloc(1, size);
|
SStreamTask* pTask = taosMemoryCalloc(1, size);
|
||||||
if (pTask == NULL) {
|
if (pTask == NULL) {
|
||||||
tqError("vgId:%d failed to create stream task due to out of memory, alloc size:%d", vgId, size);
|
tqError("vgId:%d failed to create stream task due to out of memory, alloc size:%d", vgId, size);
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
SDecoder decoder;
|
SDecoder decoder;
|
||||||
|
|
|
@ -326,7 +326,7 @@ static int32_t tsdbCacheDeserialize(char const *value, size_t size, SLastCol **p
|
||||||
|
|
||||||
SLastCol *pLastCol = taosMemoryCalloc(1, sizeof(SLastCol));
|
SLastCol *pLastCol = taosMemoryCalloc(1, sizeof(SLastCol));
|
||||||
if (NULL == pLastCol) {
|
if (NULL == pLastCol) {
|
||||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t offset = tsdbCacheDeserializeV0(value, pLastCol);
|
int32_t offset = tsdbCacheDeserializeV0(value, pLastCol);
|
||||||
|
@ -632,7 +632,7 @@ static int32_t tsdbCacheNewTableColumn(STsdb *pTsdb, int64_t uid, int16_t cid, i
|
||||||
|
|
||||||
SLastCol *pLastCol = taosMemoryCalloc(1, sizeof(SLastCol));
|
SLastCol *pLastCol = taosMemoryCalloc(1, sizeof(SLastCol));
|
||||||
if (!pLastCol) {
|
if (!pLastCol) {
|
||||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t charge = 0;
|
size_t charge = 0;
|
||||||
|
@ -679,13 +679,17 @@ int32_t tsdbCacheCommitNoLock(STsdb *pTsdb) {
|
||||||
static int32_t tsdbCacheGetValuesFromRocks(STsdb *pTsdb, size_t numKeys, const char *const *ppKeysList,
|
static int32_t tsdbCacheGetValuesFromRocks(STsdb *pTsdb, size_t numKeys, const char *const *ppKeysList,
|
||||||
size_t *pKeysListSizes, char ***pppValuesList, size_t **ppValuesListSizes) {
|
size_t *pKeysListSizes, char ***pppValuesList, size_t **ppValuesListSizes) {
|
||||||
char **valuesList = taosMemoryCalloc(numKeys, sizeof(char *));
|
char **valuesList = taosMemoryCalloc(numKeys, sizeof(char *));
|
||||||
|
if(!valuesList) return terrno;
|
||||||
size_t *valuesListSizes = taosMemoryCalloc(numKeys, sizeof(size_t));
|
size_t *valuesListSizes = taosMemoryCalloc(numKeys, sizeof(size_t));
|
||||||
|
if(!valuesListSizes) {
|
||||||
|
taosMemoryFreeClear(valuesList);
|
||||||
|
return terrno;
|
||||||
|
}
|
||||||
char **errs = taosMemoryCalloc(numKeys, sizeof(char *));
|
char **errs = taosMemoryCalloc(numKeys, sizeof(char *));
|
||||||
if (!valuesList || !valuesListSizes || !errs) {
|
if (!errs) {
|
||||||
taosMemoryFreeClear(valuesList);
|
taosMemoryFreeClear(valuesList);
|
||||||
taosMemoryFreeClear(valuesListSizes);
|
taosMemoryFreeClear(valuesListSizes);
|
||||||
taosMemoryFreeClear(errs);
|
return terrno;
|
||||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
|
||||||
}
|
}
|
||||||
rocksdb_multi_get(pTsdb->rCache.db, pTsdb->rCache.readoptions, numKeys, ppKeysList, pKeysListSizes, valuesList,
|
rocksdb_multi_get(pTsdb->rCache.db, pTsdb->rCache.readoptions, numKeys, ppKeysList, pKeysListSizes, valuesList,
|
||||||
valuesListSizes, errs);
|
valuesListSizes, errs);
|
||||||
|
@ -705,12 +709,12 @@ static int32_t tsdbCacheDropTableColumn(STsdb *pTsdb, int64_t uid, int16_t cid,
|
||||||
// build keys & multi get from rocks
|
// build keys & multi get from rocks
|
||||||
char **keys_list = taosMemoryCalloc(2, sizeof(char *));
|
char **keys_list = taosMemoryCalloc(2, sizeof(char *));
|
||||||
if (!keys_list) {
|
if (!keys_list) {
|
||||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
return terrno;
|
||||||
}
|
}
|
||||||
size_t *keys_list_sizes = taosMemoryCalloc(2, sizeof(size_t));
|
size_t *keys_list_sizes = taosMemoryCalloc(2, sizeof(size_t));
|
||||||
if (!keys_list_sizes) {
|
if (!keys_list_sizes) {
|
||||||
taosMemoryFree(keys_list);
|
taosMemoryFree(keys_list);
|
||||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
return terrno;
|
||||||
}
|
}
|
||||||
const size_t klen = ROCKS_KEY_LEN;
|
const size_t klen = ROCKS_KEY_LEN;
|
||||||
|
|
||||||
|
@ -718,7 +722,7 @@ static int32_t tsdbCacheDropTableColumn(STsdb *pTsdb, int64_t uid, int16_t cid,
|
||||||
if (!keys) {
|
if (!keys) {
|
||||||
taosMemoryFree(keys_list);
|
taosMemoryFree(keys_list);
|
||||||
taosMemoryFree(keys_list_sizes);
|
taosMemoryFree(keys_list_sizes);
|
||||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
return terrno;
|
||||||
}
|
}
|
||||||
((SLastKey *)keys)[0] = (SLastKey){.lflag = LFLAG_LAST, .uid = uid, .cid = cid};
|
((SLastKey *)keys)[0] = (SLastKey){.lflag = LFLAG_LAST, .uid = uid, .cid = cid};
|
||||||
((SLastKey *)keys)[1] = (SLastKey){.lflag = LFLAG_LAST_ROW, .uid = uid, .cid = cid};
|
((SLastKey *)keys)[1] = (SLastKey){.lflag = LFLAG_LAST_ROW, .uid = uid, .cid = cid};
|
||||||
|
@ -1003,7 +1007,7 @@ static int32_t tsdbCacheUpdateValue(SValue *pOld, SValue *pNew) {
|
||||||
if (nData < pNew->nData) {
|
if (nData < pNew->nData) {
|
||||||
pOld->pData = taosMemoryCalloc(1, pNew->nData);
|
pOld->pData = taosMemoryCalloc(1, pNew->nData);
|
||||||
if (!pOld->pData) {
|
if (!pOld->pData) {
|
||||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
return terrno;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
pOld->pData = pFree;
|
pOld->pData = pFree;
|
||||||
|
@ -1099,7 +1103,7 @@ static int32_t tsdbCachePutToLRU(STsdb *pTsdb, SLastKey *pLastKey, SLastCol *pLa
|
||||||
|
|
||||||
SLastCol *pLRULastCol = taosMemoryCalloc(1, sizeof(SLastCol));
|
SLastCol *pLRULastCol = taosMemoryCalloc(1, sizeof(SLastCol));
|
||||||
if (!pLRULastCol) {
|
if (!pLRULastCol) {
|
||||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t charge = 0;
|
size_t charge = 0;
|
||||||
|
@ -1182,11 +1186,15 @@ static int32_t tsdbCacheUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, SArray
|
||||||
size_t *values_list_sizes = NULL;
|
size_t *values_list_sizes = NULL;
|
||||||
char **errs = NULL;
|
char **errs = NULL;
|
||||||
keys_list = taosMemoryCalloc(num_keys, sizeof(char *));
|
keys_list = taosMemoryCalloc(num_keys, sizeof(char *));
|
||||||
|
if(!keys_list) {
|
||||||
|
(void)taosThreadMutexUnlock(&pTsdb->lruMutex);
|
||||||
|
return terrno;
|
||||||
|
}
|
||||||
keys_list_sizes = taosMemoryCalloc(num_keys, sizeof(size_t));
|
keys_list_sizes = taosMemoryCalloc(num_keys, sizeof(size_t));
|
||||||
if (!keys_list || !keys_list_sizes) {
|
if (!keys_list_sizes) {
|
||||||
taosMemoryFree(keys_list);
|
taosMemoryFree(keys_list);
|
||||||
(void)taosThreadMutexUnlock(&pTsdb->lruMutex);
|
(void)taosThreadMutexUnlock(&pTsdb->lruMutex);
|
||||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
return terrno;
|
||||||
}
|
}
|
||||||
for (int i = 0; i < num_keys; ++i) {
|
for (int i = 0; i < num_keys; ++i) {
|
||||||
SIdxKey *idxKey = &((SIdxKey *)TARRAY_DATA(remainCols))[i];
|
SIdxKey *idxKey = &((SIdxKey *)TARRAY_DATA(remainCols))[i];
|
||||||
|
@ -1578,7 +1586,7 @@ static int32_t tsdbCacheLoadFromRaw(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArr
|
||||||
|
|
||||||
SLastCol *pTmpLastCol = taosMemoryCalloc(1, sizeof(SLastCol));
|
SLastCol *pTmpLastCol = taosMemoryCalloc(1, sizeof(SLastCol));
|
||||||
if (!pTmpLastCol) {
|
if (!pTmpLastCol) {
|
||||||
TAOS_CHECK_EXIT(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_CHECK_EXIT(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t charge = 0;
|
size_t charge = 0;
|
||||||
|
@ -1678,7 +1686,7 @@ static int32_t tsdbCacheLoadFromRocks(STsdb *pTsdb, tb_uid_t uid, SArray *pLastA
|
||||||
SLastCol *pTmpLastCol = taosMemoryCalloc(1, sizeof(SLastCol));
|
SLastCol *pTmpLastCol = taosMemoryCalloc(1, sizeof(SLastCol));
|
||||||
if (!pTmpLastCol) {
|
if (!pTmpLastCol) {
|
||||||
taosMemoryFreeClear(PToFree);
|
taosMemoryFreeClear(PToFree);
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _exit;
|
goto _exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1896,7 +1904,7 @@ int32_t tsdbCacheDel(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSKEY sKey, TSKE
|
||||||
size_t *values_list_sizes = NULL;
|
size_t *values_list_sizes = NULL;
|
||||||
|
|
||||||
if (!keys_list || !keys_list_sizes) {
|
if (!keys_list || !keys_list_sizes) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _exit;
|
goto _exit;
|
||||||
}
|
}
|
||||||
const size_t klen = ROCKS_KEY_LEN;
|
const size_t klen = ROCKS_KEY_LEN;
|
||||||
|
@ -1904,7 +1912,7 @@ int32_t tsdbCacheDel(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSKEY sKey, TSKE
|
||||||
for (int i = 0; i < numKeys; ++i) {
|
for (int i = 0; i < numKeys; ++i) {
|
||||||
char *key = taosMemoryCalloc(1, sizeof(SLastKey));
|
char *key = taosMemoryCalloc(1, sizeof(SLastKey));
|
||||||
if (!key) {
|
if (!key) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _exit;
|
goto _exit;
|
||||||
}
|
}
|
||||||
((SLastKey *)key)[0] = *(SLastKey *)taosArrayGet(remainCols, i);
|
((SLastKey *)key)[0] = *(SLastKey *)taosArrayGet(remainCols, i);
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
static int32_t setFirstLastResColToNull(SColumnInfoData* pCol, int32_t row) {
|
static int32_t setFirstLastResColToNull(SColumnInfoData* pCol, int32_t row) {
|
||||||
char* buf = taosMemoryCalloc(1, pCol->info.bytes);
|
char* buf = taosMemoryCalloc(1, pCol->info.bytes);
|
||||||
if (buf == NULL) {
|
if (buf == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
SFirstLastRes* pRes = (SFirstLastRes*)((char*)buf + VARSTR_HEADER_SIZE);
|
SFirstLastRes* pRes = (SFirstLastRes*)((char*)buf + VARSTR_HEADER_SIZE);
|
||||||
|
@ -283,7 +283,7 @@ int32_t tsdbCacherowsReaderOpen(void* pVnode, int32_t type, void* pTableIdList,
|
||||||
*pReader = NULL;
|
*pReader = NULL;
|
||||||
SCacheRowsReader* p = taosMemoryCalloc(1, sizeof(SCacheRowsReader));
|
SCacheRowsReader* p = taosMemoryCalloc(1, sizeof(SCacheRowsReader));
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
p->type = type;
|
p->type = type;
|
||||||
|
@ -323,7 +323,7 @@ int32_t tsdbCacherowsReaderOpen(void* pVnode, int32_t type, void* pTableIdList,
|
||||||
p->transferBuf = taosMemoryCalloc(p->pSchema->numOfCols, POINTER_BYTES);
|
p->transferBuf = taosMemoryCalloc(p->pSchema->numOfCols, POINTER_BYTES);
|
||||||
if (p->transferBuf == NULL) {
|
if (p->transferBuf == NULL) {
|
||||||
tsdbCacherowsReaderClose(p);
|
tsdbCacherowsReaderClose(p);
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int32_t i = 0; i < p->pSchema->numOfCols; ++i) {
|
for (int32_t i = 0; i < p->pSchema->numOfCols; ++i) {
|
||||||
|
@ -446,7 +446,7 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32
|
||||||
|
|
||||||
pRes = taosMemoryCalloc(pr->numOfCols, POINTER_BYTES);
|
pRes = taosMemoryCalloc(pr->numOfCols, POINTER_BYTES);
|
||||||
if (pRes == NULL) {
|
if (pRes == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _end;
|
goto _end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -456,7 +456,7 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32
|
||||||
|
|
||||||
pRes[j] = taosMemoryCalloc(1, sizeof(SFirstLastRes) + bytes + pkBufLen + VARSTR_HEADER_SIZE);
|
pRes[j] = taosMemoryCalloc(1, sizeof(SFirstLastRes) + bytes + pkBufLen + VARSTR_HEADER_SIZE);
|
||||||
if (pRes[j] == NULL) {
|
if (pRes[j] == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _end;
|
goto _end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -504,7 +504,7 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32
|
||||||
|
|
||||||
p.rowKey.pks[j].pData = taosMemoryCalloc(1, pr->pkColumn.bytes);
|
p.rowKey.pks[j].pData = taosMemoryCalloc(1, pr->pkColumn.bytes);
|
||||||
if (p.rowKey.pks[j].pData == NULL) {
|
if (p.rowKey.pks[j].pData == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _end;
|
goto _end;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -514,7 +514,7 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32
|
||||||
if (IS_VAR_DATA_TYPE(pCol->type)) {
|
if (IS_VAR_DATA_TYPE(pCol->type)) {
|
||||||
p.colVal.value.pData = taosMemoryCalloc(pCol->bytes, sizeof(char));
|
p.colVal.value.pData = taosMemoryCalloc(pCol->bytes, sizeof(char));
|
||||||
if (p.colVal.value.pData == NULL) {
|
if (p.colVal.value.pData == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _end;
|
goto _end;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -432,7 +432,7 @@ static int32_t tsdbCommitInfoInit(STsdb *pTsdb) {
|
||||||
|
|
||||||
pTsdb->commitInfo = taosMemoryCalloc(1, sizeof(*pTsdb->commitInfo));
|
pTsdb->commitInfo = taosMemoryCalloc(1, sizeof(*pTsdb->commitInfo));
|
||||||
if (pTsdb->commitInfo == NULL) {
|
if (pTsdb->commitInfo == NULL) {
|
||||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit);
|
TAOS_CHECK_GOTO(terrno, &lino, _exit);
|
||||||
}
|
}
|
||||||
|
|
||||||
TAOS_CHECK_GOTO(vHashInit(&pTsdb->commitInfo->ht, tFileSetCommitInfoHash, tFileSetCommitInfoCompare), &lino, _exit);
|
TAOS_CHECK_GOTO(vHashInit(&pTsdb->commitInfo->ht, tFileSetCommitInfoHash, tFileSetCommitInfoCompare), &lino, _exit);
|
||||||
|
|
|
@ -23,7 +23,7 @@ int32_t tsdbDataFileRAWReaderOpen(const char *fname, const SDataFileRAWReaderCon
|
||||||
|
|
||||||
reader[0] = taosMemoryCalloc(1, sizeof(SDataFileRAWReader));
|
reader[0] = taosMemoryCalloc(1, sizeof(SDataFileRAWReader));
|
||||||
if (reader[0] == NULL) {
|
if (reader[0] == NULL) {
|
||||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit);
|
TAOS_CHECK_GOTO(terrno, &lino, _exit);
|
||||||
}
|
}
|
||||||
|
|
||||||
reader[0]->config[0] = config[0];
|
reader[0]->config[0] = config[0];
|
||||||
|
@ -94,7 +94,7 @@ int32_t tsdbDataFileRAWWriterOpen(const SDataFileRAWWriterConfig *config, SDataF
|
||||||
|
|
||||||
SDataFileRAWWriter *writer = taosMemoryCalloc(1, sizeof(SDataFileRAWWriter));
|
SDataFileRAWWriter *writer = taosMemoryCalloc(1, sizeof(SDataFileRAWWriter));
|
||||||
if (!writer) {
|
if (!writer) {
|
||||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit);
|
TAOS_CHECK_GOTO(terrno, &lino, _exit);
|
||||||
}
|
}
|
||||||
|
|
||||||
writer->config[0] = config[0];
|
writer->config[0] = config[0];
|
||||||
|
|
|
@ -111,7 +111,7 @@ int32_t tsdbDataFileReaderOpen(const char *fname[], const SDataFileReaderConfig
|
||||||
int32_t lino = 0;
|
int32_t lino = 0;
|
||||||
|
|
||||||
if ((*reader = taosMemoryCalloc(1, sizeof(**reader))) == NULL) {
|
if ((*reader = taosMemoryCalloc(1, sizeof(**reader))) == NULL) {
|
||||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit);
|
TAOS_CHECK_GOTO(terrno, &lino, _exit);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int32_t i = 0; i < ARRAY_SIZE(reader[0]->local); i++) {
|
for (int32_t i = 0; i < ARRAY_SIZE(reader[0]->local); i++) {
|
||||||
|
@ -1803,7 +1803,7 @@ _exit:
|
||||||
int32_t tsdbDataFileWriterOpen(const SDataFileWriterConfig *config, SDataFileWriter **writer) {
|
int32_t tsdbDataFileWriterOpen(const SDataFileWriterConfig *config, SDataFileWriter **writer) {
|
||||||
writer[0] = taosMemoryCalloc(1, sizeof(*writer[0]));
|
writer[0] = taosMemoryCalloc(1, sizeof(*writer[0]));
|
||||||
if (!writer[0]) {
|
if (!writer[0]) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
writer[0]->config[0] = config[0];
|
writer[0]->config[0] = config[0];
|
||||||
|
|
|
@ -53,7 +53,7 @@ static int32_t tsdbBinaryToFS(uint8_t *pData, int64_t nData, STsdbFS *pFS) {
|
||||||
if (hasDel) {
|
if (hasDel) {
|
||||||
pFS->pDelFile = (SDelFile *)taosMemoryCalloc(1, sizeof(SDelFile));
|
pFS->pDelFile = (SDelFile *)taosMemoryCalloc(1, sizeof(SDelFile));
|
||||||
if (pFS->pDelFile == NULL) {
|
if (pFS->pDelFile == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _exit;
|
goto _exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ static const char *gCurrentFname[] = {
|
||||||
static int32_t create_fs(STsdb *pTsdb, STFileSystem **fs) {
|
static int32_t create_fs(STsdb *pTsdb, STFileSystem **fs) {
|
||||||
fs[0] = taosMemoryCalloc(1, sizeof(*fs[0]));
|
fs[0] = taosMemoryCalloc(1, sizeof(*fs[0]));
|
||||||
if (fs[0] == NULL) {
|
if (fs[0] == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
fs[0]->tsdb = pTsdb;
|
fs[0]->tsdb = pTsdb;
|
||||||
|
@ -417,7 +417,7 @@ static int32_t tsdbFSCreateFileObjHash(STFileSystem *fs, STFileHash *hash) {
|
||||||
hash->numBucket = 4096;
|
hash->numBucket = 4096;
|
||||||
hash->buckets = taosMemoryCalloc(hash->numBucket, sizeof(STFileHashEntry *));
|
hash->buckets = taosMemoryCalloc(hash->numBucket, sizeof(STFileHashEntry *));
|
||||||
if (hash->buckets == NULL) {
|
if (hash->buckets == NULL) {
|
||||||
TSDB_CHECK_CODE(code = TSDB_CODE_OUT_OF_MEMORY, lino, _exit);
|
TSDB_CHECK_CODE(code = terrno, lino, _exit);
|
||||||
}
|
}
|
||||||
|
|
||||||
// vnode.json
|
// vnode.json
|
||||||
|
@ -1013,7 +1013,7 @@ int32_t tsdbFSCreateRefSnapshotWithoutLock(STFileSystem *fs, TFileSetArray **fse
|
||||||
STFileSet *fset, *fset1;
|
STFileSet *fset, *fset1;
|
||||||
|
|
||||||
fsetArr[0] = taosMemoryCalloc(1, sizeof(*fsetArr[0]));
|
fsetArr[0] = taosMemoryCalloc(1, sizeof(*fsetArr[0]));
|
||||||
if (fsetArr[0] == NULL) return TSDB_CODE_OUT_OF_MEMORY;
|
if (fsetArr[0] == NULL) return terrno;
|
||||||
|
|
||||||
TARRAY2_FOREACH(fs->fSetArr, fset) {
|
TARRAY2_FOREACH(fs->fSetArr, fset) {
|
||||||
code = tsdbTFileSetInitRef(fs->tsdb, fset, &fset1);
|
code = tsdbTFileSetInitRef(fs->tsdb, fset, &fset1);
|
||||||
|
@ -1025,6 +1025,7 @@ int32_t tsdbFSCreateRefSnapshotWithoutLock(STFileSystem *fs, TFileSetArray **fse
|
||||||
|
|
||||||
if (code) {
|
if (code) {
|
||||||
TARRAY2_DESTROY(fsetArr[0], tsdbTFileSetClear);
|
TARRAY2_DESTROY(fsetArr[0], tsdbTFileSetClear);
|
||||||
|
taosMemoryFree(fsetArr[0]);
|
||||||
fsetArr[0] = NULL;
|
fsetArr[0] = NULL;
|
||||||
}
|
}
|
||||||
return code;
|
return code;
|
||||||
|
@ -1118,7 +1119,7 @@ int32_t tsdbFSCreateRefRangedSnapshot(STFileSystem *fs, int64_t sver, int64_t ev
|
||||||
|
|
||||||
fsrArr[0] = taosMemoryCalloc(1, sizeof(*fsrArr[0]));
|
fsrArr[0] = taosMemoryCalloc(1, sizeof(*fsrArr[0]));
|
||||||
if (fsrArr[0] == NULL) {
|
if (fsrArr[0] == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _out;
|
goto _out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -576,12 +576,17 @@ int32_t tsdbTFileSetInitRef(STsdb *pTsdb, const STFileSet *fset1, STFileSet **fs
|
||||||
SSttLvl *lvl;
|
SSttLvl *lvl;
|
||||||
code = tsdbSttLvlInitRef(pTsdb, lvl1, &lvl);
|
code = tsdbSttLvlInitRef(pTsdb, lvl1, &lvl);
|
||||||
if (code) {
|
if (code) {
|
||||||
|
taosMemoryFree(lvl);
|
||||||
tsdbTFileSetClear(fset);
|
tsdbTFileSetClear(fset);
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
code = TARRAY2_APPEND(fset[0]->lvlArr, lvl);
|
code = TARRAY2_APPEND(fset[0]->lvlArr, lvl);
|
||||||
if (code) return code;
|
if (code) {
|
||||||
|
taosMemoryFree(lvl);
|
||||||
|
tsdbTFileSetClear(fset);
|
||||||
|
return code;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -36,7 +36,7 @@ int32_t tsdbFSetRAWWriterOpen(SFSetRAWWriterConfig *config, SFSetRAWWriter **wri
|
||||||
|
|
||||||
writer[0] = taosMemoryCalloc(1, sizeof(SFSetRAWWriter));
|
writer[0] = taosMemoryCalloc(1, sizeof(SFSetRAWWriter));
|
||||||
if (writer[0] == NULL) {
|
if (writer[0] == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
writer[0]->config[0] = config[0];
|
writer[0]->config[0] = config[0];
|
||||||
|
|
|
@ -136,7 +136,7 @@ int32_t tsdbFSetWriterOpen(SFSetWriterConfig *config, SFSetWriter **writer) {
|
||||||
|
|
||||||
writer[0] = taosMemoryCalloc(1, sizeof(*writer[0]));
|
writer[0] = taosMemoryCalloc(1, sizeof(*writer[0]));
|
||||||
if (writer[0] == NULL) {
|
if (writer[0] == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
writer[0]->config[0] = config[0];
|
writer[0]->config[0] = config[0];
|
||||||
|
|
|
@ -181,7 +181,7 @@ int32_t tGetDFileSet(uint8_t *p, SDFileSet *pSet) {
|
||||||
// head
|
// head
|
||||||
pSet->pHeadF = (SHeadFile *)taosMemoryCalloc(1, sizeof(SHeadFile));
|
pSet->pHeadF = (SHeadFile *)taosMemoryCalloc(1, sizeof(SHeadFile));
|
||||||
if (pSet->pHeadF == NULL) {
|
if (pSet->pHeadF == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
pSet->pHeadF->nRef = 1;
|
pSet->pHeadF->nRef = 1;
|
||||||
n += tGetHeadFile(p + n, pSet->pHeadF);
|
n += tGetHeadFile(p + n, pSet->pHeadF);
|
||||||
|
@ -189,7 +189,7 @@ int32_t tGetDFileSet(uint8_t *p, SDFileSet *pSet) {
|
||||||
// data
|
// data
|
||||||
pSet->pDataF = (SDataFile *)taosMemoryCalloc(1, sizeof(SDataFile));
|
pSet->pDataF = (SDataFile *)taosMemoryCalloc(1, sizeof(SDataFile));
|
||||||
if (pSet->pDataF == NULL) {
|
if (pSet->pDataF == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
pSet->pDataF->nRef = 1;
|
pSet->pDataF->nRef = 1;
|
||||||
n += tGetDataFile(p + n, pSet->pDataF);
|
n += tGetDataFile(p + n, pSet->pDataF);
|
||||||
|
@ -197,7 +197,7 @@ int32_t tGetDFileSet(uint8_t *p, SDFileSet *pSet) {
|
||||||
// sma
|
// sma
|
||||||
pSet->pSmaF = (SSmaFile *)taosMemoryCalloc(1, sizeof(SSmaFile));
|
pSet->pSmaF = (SSmaFile *)taosMemoryCalloc(1, sizeof(SSmaFile));
|
||||||
if (pSet->pSmaF == NULL) {
|
if (pSet->pSmaF == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
pSet->pSmaF->nRef = 1;
|
pSet->pSmaF->nRef = 1;
|
||||||
n += tGetSmaFile(p + n, pSet->pSmaF);
|
n += tGetSmaFile(p + n, pSet->pSmaF);
|
||||||
|
@ -207,7 +207,7 @@ int32_t tGetDFileSet(uint8_t *p, SDFileSet *pSet) {
|
||||||
for (int32_t iStt = 0; iStt < pSet->nSttF; iStt++) {
|
for (int32_t iStt = 0; iStt < pSet->nSttF; iStt++) {
|
||||||
pSet->aSttF[iStt] = (SSttFile *)taosMemoryCalloc(1, sizeof(SSttFile));
|
pSet->aSttF[iStt] = (SSttFile *)taosMemoryCalloc(1, sizeof(SSttFile));
|
||||||
if (pSet->aSttF[iStt] == NULL) {
|
if (pSet->aSttF[iStt] == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
pSet->aSttF[iStt]->nRef = 1;
|
pSet->aSttF[iStt]->nRef = 1;
|
||||||
n += tGetSttFile(p + n, pSet->aSttF[iStt]);
|
n += tGetSttFile(p + n, pSet->aSttF[iStt]);
|
||||||
|
|
|
@ -86,14 +86,19 @@ void destroySttBlockLoadInfo(SSttBlockLoadInfo *pLoadInfo) {
|
||||||
pInfo->sttBlockIndex = -1;
|
pInfo->sttBlockIndex = -1;
|
||||||
pInfo->pin = false;
|
pInfo->pin = false;
|
||||||
|
|
||||||
if (pLoadInfo->info.pCount != NULL) {
|
|
||||||
taosArrayDestroy(pLoadInfo->info.pUid);
|
taosArrayDestroy(pLoadInfo->info.pUid);
|
||||||
taosArrayDestroyEx(pLoadInfo->info.pFirstKey, freeItem);
|
taosArrayDestroyEx(pLoadInfo->info.pFirstKey, freeItem);
|
||||||
taosArrayDestroyEx(pLoadInfo->info.pLastKey, freeItem);
|
taosArrayDestroyEx(pLoadInfo->info.pLastKey, freeItem);
|
||||||
taosArrayDestroy(pLoadInfo->info.pCount);
|
taosArrayDestroy(pLoadInfo->info.pCount);
|
||||||
taosArrayDestroy(pLoadInfo->info.pFirstTs);
|
taosArrayDestroy(pLoadInfo->info.pFirstTs);
|
||||||
taosArrayDestroy(pLoadInfo->info.pLastTs);
|
taosArrayDestroy(pLoadInfo->info.pLastTs);
|
||||||
}
|
|
||||||
|
pLoadInfo->info.pUid = NULL;
|
||||||
|
pLoadInfo->info.pFirstKey = NULL;
|
||||||
|
pLoadInfo->info.pLastKey = NULL;
|
||||||
|
pLoadInfo->info.pCount = NULL;
|
||||||
|
pLoadInfo->info.pFirstTs = NULL;
|
||||||
|
pLoadInfo->info.pLastTs = NULL;
|
||||||
|
|
||||||
taosArrayDestroy(pLoadInfo->aSttBlk);
|
taosArrayDestroy(pLoadInfo->aSttBlk);
|
||||||
taosMemoryFree(pLoadInfo);
|
taosMemoryFree(pLoadInfo);
|
||||||
|
@ -834,7 +839,6 @@ int32_t tLDataIterNextRow(SLDataIter *pIter, const char *idStr, bool *hasNext) {
|
||||||
int32_t lino = 0;
|
int32_t lino = 0;
|
||||||
|
|
||||||
*hasNext = false;
|
*hasNext = false;
|
||||||
terrno = 0;
|
|
||||||
|
|
||||||
// no qualified last file block in current file, no need to fetch row
|
// no qualified last file block in current file, no need to fetch row
|
||||||
if (pIter->pSttBlk == NULL) {
|
if (pIter->pSttBlk == NULL) {
|
||||||
|
@ -843,6 +847,7 @@ int32_t tLDataIterNextRow(SLDataIter *pIter, const char *idStr, bool *hasNext) {
|
||||||
|
|
||||||
code = loadLastBlock(pIter, idStr, &pBlockData);
|
code = loadLastBlock(pIter, idStr, &pBlockData);
|
||||||
if (pBlockData == NULL || code != TSDB_CODE_SUCCESS) {
|
if (pBlockData == NULL || code != TSDB_CODE_SUCCESS) {
|
||||||
|
lino = __LINE__;
|
||||||
goto _exit;
|
goto _exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -888,6 +893,7 @@ int32_t tLDataIterNextRow(SLDataIter *pIter, const char *idStr, bool *hasNext) {
|
||||||
if (iBlockL != pIter->iSttBlk) {
|
if (iBlockL != pIter->iSttBlk) {
|
||||||
code = loadLastBlock(pIter, idStr, &pBlockData);
|
code = loadLastBlock(pIter, idStr, &pBlockData);
|
||||||
if ((pBlockData == NULL) || (code != 0)) {
|
if ((pBlockData == NULL) || (code != 0)) {
|
||||||
|
lino = __LINE__;
|
||||||
goto _exit;
|
goto _exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1126,8 +1132,8 @@ int32_t tMergeTreeNext(SMergeTree *pMTree, bool *pHasNext) {
|
||||||
if (c > 0) {
|
if (c > 0) {
|
||||||
(void)tRBTreePut(&pMTree->rbt, (SRBTreeNode *)pMTree->pIter);
|
(void)tRBTreePut(&pMTree->rbt, (SRBTreeNode *)pMTree->pIter);
|
||||||
pMTree->pIter = NULL;
|
pMTree->pIter = NULL;
|
||||||
} else {
|
} else if (!c) {
|
||||||
ASSERT(c);
|
return TSDB_CODE_INTERNAL_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,7 @@ int32_t tsdbOpen(SVnode *pVnode, STsdb **ppTsdb, const char *dir, STsdbKeepCfg *
|
||||||
// create handle
|
// create handle
|
||||||
pTsdb = (STsdb *)taosMemoryCalloc(1, sizeof(*pTsdb) + slen);
|
pTsdb = (STsdb *)taosMemoryCalloc(1, sizeof(*pTsdb) + slen);
|
||||||
if (pTsdb == NULL) {
|
if (pTsdb == NULL) {
|
||||||
TAOS_CHECK_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_CHECK_RETURN(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
pTsdb->path = (char *)&pTsdb[1];
|
pTsdb->path = (char *)&pTsdb[1];
|
||||||
|
|
|
@ -45,7 +45,7 @@ typedef struct {
|
||||||
bool moreThanCapcity;
|
bool moreThanCapcity;
|
||||||
} SDataBlockToLoadInfo;
|
} SDataBlockToLoadInfo;
|
||||||
|
|
||||||
static int32_t getCurrentBlockInfo(SDataBlockIter* pBlockIter, SFileDataBlockInfo** pInfo);
|
static int32_t getCurrentBlockInfo(SDataBlockIter* pBlockIter, SFileDataBlockInfo** pInfo, const char* idStr);
|
||||||
static int32_t buildDataBlockFromBufImpl(STableBlockScanInfo* pBlockScanInfo, int64_t endKey, int32_t capacity,
|
static int32_t buildDataBlockFromBufImpl(STableBlockScanInfo* pBlockScanInfo, int64_t endKey, int32_t capacity,
|
||||||
STsdbReader* pReader);
|
STsdbReader* pReader);
|
||||||
static void getValidMemRow(SIterInfo* pIter, const SArray* pDelList, STsdbReader* pReader, TSDBROW** pRes);
|
static void getValidMemRow(SIterInfo* pIter, const SArray* pDelList, STsdbReader* pReader, TSDBROW** pRes);
|
||||||
|
@ -257,7 +257,7 @@ static int32_t initFilesetIterator(SFilesetIter* pIter, TFileSetArray* pFileSetA
|
||||||
if (pIter->pSttBlockReader == NULL) {
|
if (pIter->pSttBlockReader == NULL) {
|
||||||
pIter->pSttBlockReader = taosMemoryCalloc(1, sizeof(struct SSttBlockReader));
|
pIter->pSttBlockReader = taosMemoryCalloc(1, sizeof(struct SSttBlockReader));
|
||||||
if (pIter->pSttBlockReader == NULL) {
|
if (pIter->pSttBlockReader == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
tsdbError("failed to prepare the last block iterator, since:%s %s", tstrerror(code), pReader->idStr);
|
tsdbError("failed to prepare the last block iterator, since:%s %s", tstrerror(code), pReader->idStr);
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
@ -507,13 +507,13 @@ static int32_t initResBlockInfo(SResultBlockInfo* pResBlockInfo, int64_t capacit
|
||||||
if (IS_VAR_DATA_TYPE(pSup->pk.type)) {
|
if (IS_VAR_DATA_TYPE(pSup->pk.type)) {
|
||||||
p->info.pks[0].pData = taosMemoryCalloc(1, pSup->pk.bytes);
|
p->info.pks[0].pData = taosMemoryCalloc(1, pSup->pk.bytes);
|
||||||
if (p->info.pks[0].pData == NULL) {
|
if (p->info.pks[0].pData == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
p->info.pks[1].pData = taosMemoryCalloc(1, pSup->pk.bytes);
|
p->info.pks[1].pData = taosMemoryCalloc(1, pSup->pk.bytes);
|
||||||
if (p->info.pks[1].pData == NULL) {
|
if (p->info.pks[1].pData == NULL) {
|
||||||
taosMemoryFreeClear(p->info.pks[0].pData);
|
taosMemoryFreeClear(p->info.pks[0].pData);
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
p->info.pks[0].nData = pSup->pk.bytes;
|
p->info.pks[0].nData = pSup->pk.bytes;
|
||||||
|
@ -533,7 +533,7 @@ static int32_t tsdbReaderCreate(SVnode* pVnode, SQueryTableDataCond* pCond, void
|
||||||
int8_t level = 0;
|
int8_t level = 0;
|
||||||
STsdbReader* pReader = (STsdbReader*)taosMemoryCalloc(1, sizeof(*pReader));
|
STsdbReader* pReader = (STsdbReader*)taosMemoryCalloc(1, sizeof(*pReader));
|
||||||
if (pReader == NULL) {
|
if (pReader == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _end;
|
goto _end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -920,7 +920,7 @@ static int32_t doCopyColVal(SColumnInfoData* pColInfoData, int32_t rowIndex, int
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t getCurrentBlockInfo(SDataBlockIter* pBlockIter, SFileDataBlockInfo** pInfo) {
|
static int32_t getCurrentBlockInfo(SDataBlockIter* pBlockIter, SFileDataBlockInfo** pInfo, const char* id) {
|
||||||
*pInfo = NULL;
|
*pInfo = NULL;
|
||||||
|
|
||||||
if (pBlockIter->blockList == NULL) {
|
if (pBlockIter->blockList == NULL) {
|
||||||
|
@ -929,8 +929,10 @@ static int32_t getCurrentBlockInfo(SDataBlockIter* pBlockIter, SFileDataBlockInf
|
||||||
|
|
||||||
size_t num = TARRAY_SIZE(pBlockIter->blockList);
|
size_t num = TARRAY_SIZE(pBlockIter->blockList);
|
||||||
if (num == 0) {
|
if (num == 0) {
|
||||||
tsdbError("tsdb read failed at: %s:%d", __func__, __LINE__);
|
if (num != pBlockIter->numOfBlocks) {
|
||||||
return TSDB_CODE_INTERNAL_ERROR;
|
tsdbError("tsdb read failed at: %s:%d %s", __func__, __LINE__, id);
|
||||||
|
}
|
||||||
|
return TSDB_CODE_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
*pInfo = taosArrayGet(pBlockIter->blockList, pBlockIter->index);
|
*pInfo = taosArrayGet(pBlockIter->blockList, pBlockIter->index);
|
||||||
|
@ -1081,7 +1083,6 @@ static void copyNumericCols(const SColData* pData, SFileBlockDumpInfo* pDumpInfo
|
||||||
int32_t step = asc ? 1 : -1;
|
int32_t step = asc ? 1 : -1;
|
||||||
|
|
||||||
// make sure it is aligned to 8bit, the allocated memory address is aligned to 256bit
|
// make sure it is aligned to 8bit, the allocated memory address is aligned to 256bit
|
||||||
// ASSERT((((uint64_t)pColData->pData) & (0x8 - 1)) == 0);
|
|
||||||
|
|
||||||
// 1. copy data in a batch model
|
// 1. copy data in a batch model
|
||||||
(void)memcpy(pColData->pData, p, dumpedRows * tDataTypes[pData->type].bytes);
|
(void)memcpy(pColData->pData, p, dumpedRows * tDataTypes[pData->type].bytes);
|
||||||
|
@ -1207,7 +1208,7 @@ static int32_t copyBlockDataToSDataBlock(STsdbReader* pReader, SRowKey* pLastPro
|
||||||
bool asc = ASCENDING_TRAVERSE(pReader->info.order);
|
bool asc = ASCENDING_TRAVERSE(pReader->info.order);
|
||||||
int32_t step = asc ? 1 : -1;
|
int32_t step = asc ? 1 : -1;
|
||||||
|
|
||||||
code = getCurrentBlockInfo(pBlockIter, &pBlockInfo);
|
code = getCurrentBlockInfo(pBlockIter, &pBlockInfo, pReader->idStr);
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
@ -1435,7 +1436,7 @@ static int32_t doLoadFileBlockData(STsdbReader* pReader, SDataBlockIter* pBlockI
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
code = getCurrentBlockInfo(pBlockIter, &pBlockInfo);
|
code = getCurrentBlockInfo(pBlockIter, &pBlockInfo, pReader->idStr);
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
@ -2787,7 +2788,7 @@ static int32_t buildComposedDataBlock(STsdbReader* pReader) {
|
||||||
SSttBlockReader* pSttBlockReader = pReader->status.fileIter.pSttBlockReader;
|
SSttBlockReader* pSttBlockReader = pReader->status.fileIter.pSttBlockReader;
|
||||||
SFileBlockDumpInfo* pDumpInfo = &pReader->status.fBlockDumpInfo;
|
SFileBlockDumpInfo* pDumpInfo = &pReader->status.fBlockDumpInfo;
|
||||||
|
|
||||||
code = getCurrentBlockInfo(&pReader->status.blockIter, &pBlockInfo);
|
code = getCurrentBlockInfo(&pReader->status.blockIter, &pBlockInfo, pReader->idStr);
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -2836,7 +2837,8 @@ static int32_t buildComposedDataBlock(STsdbReader* pReader) {
|
||||||
pDumpInfo->rowIndex += step;
|
pDumpInfo->rowIndex += step;
|
||||||
|
|
||||||
if (pDumpInfo->rowIndex >= pBlockData->nRow || pDumpInfo->rowIndex < 0) {
|
if (pDumpInfo->rowIndex >= pBlockData->nRow || pDumpInfo->rowIndex < 0) {
|
||||||
code = getCurrentBlockInfo(&pReader->status.blockIter, &pBlockInfo); // NOTE: get the new block info
|
// NOTE: get the new block info
|
||||||
|
code = getCurrentBlockInfo(&pReader->status.blockIter, &pBlockInfo, pReader->idStr);
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
goto _end;
|
goto _end;
|
||||||
}
|
}
|
||||||
|
@ -3310,7 +3312,7 @@ static int32_t doBuildDataBlock(STsdbReader* pReader) {
|
||||||
bool asc = ASCENDING_TRAVERSE(pReader->info.order);
|
bool asc = ASCENDING_TRAVERSE(pReader->info.order);
|
||||||
int32_t code = TSDB_CODE_SUCCESS;
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
|
|
||||||
code = getCurrentBlockInfo(pBlockIter, &pBlockInfo);
|
code = getCurrentBlockInfo(pBlockIter, &pBlockInfo, pReader->idStr);
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
@ -3530,7 +3532,7 @@ static void initBlockDumpInfo(STsdbReader* pReader, SDataBlockIter* pBlockIter)
|
||||||
SReaderStatus* pStatus = &pReader->status;
|
SReaderStatus* pStatus = &pReader->status;
|
||||||
SFileBlockDumpInfo* pDumpInfo = &pStatus->fBlockDumpInfo;
|
SFileBlockDumpInfo* pDumpInfo = &pStatus->fBlockDumpInfo;
|
||||||
|
|
||||||
int32_t code = getCurrentBlockInfo(pBlockIter, &pBlockInfo);
|
int32_t code = getCurrentBlockInfo(pBlockIter, &pBlockInfo, pReader->idStr);
|
||||||
if (code == TSDB_CODE_SUCCESS) {
|
if (code == TSDB_CODE_SUCCESS) {
|
||||||
pDumpInfo->totalRows = pBlockInfo->numRow;
|
pDumpInfo->totalRows = pBlockInfo->numRow;
|
||||||
pDumpInfo->rowIndex = ASCENDING_TRAVERSE(pReader->info.order) ? 0 : pBlockInfo->numRow - 1;
|
pDumpInfo->rowIndex = ASCENDING_TRAVERSE(pReader->info.order) ? 0 : pBlockInfo->numRow - 1;
|
||||||
|
@ -3828,7 +3830,6 @@ bool hasBeenDropped(const SArray* pDelList, int32_t* index, int64_t key, int64_t
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ASSERT(key >= last->ts);
|
|
||||||
if (key > last->ts) {
|
if (key > last->ts) {
|
||||||
return false;
|
return false;
|
||||||
} else if (key == last->ts) {
|
} else if (key == last->ts) {
|
||||||
|
@ -3891,7 +3892,7 @@ bool hasBeenDropped(const SArray* pDelList, int32_t* index, int64_t key, int64_t
|
||||||
} else if (key == pFirst->ts) {
|
} else if (key == pFirst->ts) {
|
||||||
return pFirst->version >= ver;
|
return pFirst->version >= ver;
|
||||||
} else {
|
} else {
|
||||||
// ASSERT(0);
|
tsdbError("unexpected error, key:%" PRId64 ", first:%" PRId64, key, pFirst->ts);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
TSDBKEY* pCurrent = taosArrayGet(pDelList, *index);
|
TSDBKEY* pCurrent = taosArrayGet(pDelList, *index);
|
||||||
|
@ -4115,7 +4116,7 @@ int32_t doMergeRowsInFileBlocks(SBlockData* pBlockData, STableBlockScanInfo* pSc
|
||||||
CHECK_FILEBLOCK_STATE st;
|
CHECK_FILEBLOCK_STATE st;
|
||||||
|
|
||||||
SFileDataBlockInfo* pFileBlockInfo = NULL;
|
SFileDataBlockInfo* pFileBlockInfo = NULL;
|
||||||
code = getCurrentBlockInfo(&pReader->status.blockIter, &pFileBlockInfo);
|
code = getCurrentBlockInfo(&pReader->status.blockIter, &pFileBlockInfo, pReader->idStr);
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
@ -4588,6 +4589,8 @@ int32_t tsdbSetTableList2(STsdbReader* pReader, const void* pTableList, int32_t
|
||||||
STableBlockScanInfo** p = NULL;
|
STableBlockScanInfo** p = NULL;
|
||||||
int32_t iter = 0;
|
int32_t iter = 0;
|
||||||
|
|
||||||
|
(void)tsdbAcquireReader(pReader);
|
||||||
|
|
||||||
while ((p = tSimpleHashIterate(pReader->status.pTableMap, p, &iter)) != NULL) {
|
while ((p = tSimpleHashIterate(pReader->status.pTableMap, p, &iter)) != NULL) {
|
||||||
clearBlockScanInfo(*p);
|
clearBlockScanInfo(*p);
|
||||||
}
|
}
|
||||||
|
@ -4595,12 +4598,14 @@ int32_t tsdbSetTableList2(STsdbReader* pReader, const void* pTableList, int32_t
|
||||||
if (size < num) {
|
if (size < num) {
|
||||||
code = ensureBlockScanInfoBuf(&pReader->blockInfoBuf, num);
|
code = ensureBlockScanInfoBuf(&pReader->blockInfoBuf, num);
|
||||||
if (code) {
|
if (code) {
|
||||||
|
(void) tsdbReleaseReader(pReader);
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
char* p1 = taosMemoryRealloc(pReader->status.uidList.tableUidList, sizeof(uint64_t) * num);
|
char* p1 = taosMemoryRealloc(pReader->status.uidList.tableUidList, sizeof(uint64_t) * num);
|
||||||
if (p1 == NULL) {
|
if (p1 == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
(void) tsdbReleaseReader(pReader);
|
||||||
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
pReader->status.uidList.tableUidList = (uint64_t*)p1;
|
pReader->status.uidList.tableUidList = (uint64_t*)p1;
|
||||||
|
@ -4617,16 +4622,19 @@ int32_t tsdbSetTableList2(STsdbReader* pReader, const void* pTableList, int32_t
|
||||||
STableBlockScanInfo* pInfo = NULL;
|
STableBlockScanInfo* pInfo = NULL;
|
||||||
code = getPosInBlockInfoBuf(&pReader->blockInfoBuf, i, &pInfo);
|
code = getPosInBlockInfoBuf(&pReader->blockInfoBuf, i, &pInfo);
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
|
(void) tsdbReleaseReader(pReader);
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
code = initTableBlockScanInfo(pInfo, pList[i].uid, pReader->status.pTableMap, pReader);
|
code = initTableBlockScanInfo(pInfo, pList[i].uid, pReader->status.pTableMap, pReader);
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
|
(void) tsdbReleaseReader(pReader);
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return TDB_CODE_SUCCESS;
|
(void) tsdbReleaseReader(pReader);
|
||||||
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t tsdbGetReaderMaxVersion2(STsdbReader* pReader) { return pReader->info.verRange.maxVer; }
|
uint64_t tsdbGetReaderMaxVersion2(STsdbReader* pReader) { return pReader->info.verRange.maxVer; }
|
||||||
|
@ -5372,7 +5380,7 @@ int32_t tsdbRetrieveDatablockSMA2(STsdbReader* pReader, SSDataBlock* pDataBlock,
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
code = getCurrentBlockInfo(&pReader->status.blockIter, &pBlockInfo);
|
code = getCurrentBlockInfo(&pReader->status.blockIter, &pBlockInfo, pReader->idStr);
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
@ -5418,7 +5426,7 @@ int32_t tsdbRetrieveDatablockSMA2(STsdbReader* pReader, SSDataBlock* pDataBlock,
|
||||||
size_t num = taosArrayGetSize(pResBlock->pDataBlock);
|
size_t num = taosArrayGetSize(pResBlock->pDataBlock);
|
||||||
pResBlock->pBlockAgg = taosMemoryCalloc(num, sizeof(SColumnDataAgg));
|
pResBlock->pBlockAgg = taosMemoryCalloc(num, sizeof(SColumnDataAgg));
|
||||||
if (pResBlock->pBlockAgg == NULL) {
|
if (pResBlock->pBlockAgg == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
for (int i = 0; i < num; ++i) {
|
for (int i = 0; i < num; ++i) {
|
||||||
pResBlock->pBlockAgg[i].colId = -1;
|
pResBlock->pBlockAgg[i].colId = -1;
|
||||||
|
@ -5462,7 +5470,7 @@ static int32_t doRetrieveDataBlock(STsdbReader* pReader, SSDataBlock** pBlock) {
|
||||||
SFileDataBlockInfo* pBlockInfo = NULL;
|
SFileDataBlockInfo* pBlockInfo = NULL;
|
||||||
*pBlock = NULL;
|
*pBlock = NULL;
|
||||||
|
|
||||||
code = getCurrentBlockInfo(&pStatus->blockIter, &pBlockInfo);
|
code = getCurrentBlockInfo(&pStatus->blockIter, &pBlockInfo, pReader->idStr);
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
@ -5678,7 +5686,7 @@ int32_t tsdbGetFileBlocksDistInfo2(STsdbReader* pReader, STableBlockDistInfo* pT
|
||||||
while (true) {
|
while (true) {
|
||||||
if (hasNext) {
|
if (hasNext) {
|
||||||
SFileDataBlockInfo* pBlockInfo = NULL;
|
SFileDataBlockInfo* pBlockInfo = NULL;
|
||||||
code = getCurrentBlockInfo(pBlockIter, &pBlockInfo);
|
code = getCurrentBlockInfo(pBlockIter, &pBlockInfo, pReader->idStr);
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ static int32_t initBlockScanInfoBuf(SBlockInfoBuf* pBuf, int32_t numOfTables) {
|
||||||
for (int32_t i = 0; i < num; ++i) {
|
for (int32_t i = 0; i < num; ++i) {
|
||||||
char* p = taosMemoryCalloc(pBuf->numPerBucket, sizeof(STableBlockScanInfo));
|
char* p = taosMemoryCalloc(pBuf->numPerBucket, sizeof(STableBlockScanInfo));
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
void* px = taosArrayPush(pBuf->pData, &p);
|
void* px = taosArrayPush(pBuf->pData, &p);
|
||||||
|
@ -50,7 +50,7 @@ static int32_t initBlockScanInfoBuf(SBlockInfoBuf* pBuf, int32_t numOfTables) {
|
||||||
if (remainder > 0) {
|
if (remainder > 0) {
|
||||||
char* p = taosMemoryCalloc(remainder, sizeof(STableBlockScanInfo));
|
char* p = taosMemoryCalloc(remainder, sizeof(STableBlockScanInfo));
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
void* px = taosArrayPush(pBuf->pData, &p);
|
void* px = taosArrayPush(pBuf->pData, &p);
|
||||||
if (px == NULL) {
|
if (px == NULL) {
|
||||||
|
@ -96,7 +96,7 @@ int32_t ensureBlockScanInfoBuf(SBlockInfoBuf* pBuf, int32_t numOfTables) {
|
||||||
for (int32_t i = 0; i < num; ++i) {
|
for (int32_t i = 0; i < num; ++i) {
|
||||||
char* p = taosMemoryCalloc(pBuf->numPerBucket, sizeof(STableBlockScanInfo));
|
char* p = taosMemoryCalloc(pBuf->numPerBucket, sizeof(STableBlockScanInfo));
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
void* px = taosArrayPush(pBuf->pData, &p);
|
void* px = taosArrayPush(pBuf->pData, &p);
|
||||||
|
@ -108,7 +108,7 @@ int32_t ensureBlockScanInfoBuf(SBlockInfoBuf* pBuf, int32_t numOfTables) {
|
||||||
if (remainder > 0) {
|
if (remainder > 0) {
|
||||||
char* p = taosMemoryCalloc(remainder, sizeof(STableBlockScanInfo));
|
char* p = taosMemoryCalloc(remainder, sizeof(STableBlockScanInfo));
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
void* px = taosArrayPush(pBuf->pData, &p);
|
void* px = taosArrayPush(pBuf->pData, &p);
|
||||||
if (px == NULL) {
|
if (px == NULL) {
|
||||||
|
@ -231,7 +231,6 @@ int32_t initRowKey(SRowKey* pKey, int64_t ts, int32_t numOfPks, int32_t type, in
|
||||||
pKey->pks[0].nData = 0;
|
pKey->pks[0].nData = 0;
|
||||||
|
|
||||||
if (pKey->pks[0].pData == NULL) {
|
if (pKey->pks[0].pData == NULL) {
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
|
||||||
return terrno;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -526,12 +525,22 @@ static void cleanupBlockOrderSupporter(SBlockOrderSupporter* pSup) {
|
||||||
|
|
||||||
static int32_t initBlockOrderSupporter(SBlockOrderSupporter* pSup, int32_t numOfTables) {
|
static int32_t initBlockOrderSupporter(SBlockOrderSupporter* pSup, int32_t numOfTables) {
|
||||||
pSup->numOfBlocksPerTable = taosMemoryCalloc(1, sizeof(int32_t) * numOfTables);
|
pSup->numOfBlocksPerTable = taosMemoryCalloc(1, sizeof(int32_t) * numOfTables);
|
||||||
pSup->indexPerTable = taosMemoryCalloc(1, sizeof(int32_t) * numOfTables);
|
if(pSup->numOfBlocksPerTable == NULL) {
|
||||||
pSup->pDataBlockInfo = taosMemoryCalloc(1, POINTER_BYTES * numOfTables);
|
|
||||||
|
|
||||||
if (pSup->numOfBlocksPerTable == NULL || pSup->indexPerTable == NULL || pSup->pDataBlockInfo == NULL) {
|
|
||||||
cleanupBlockOrderSupporter(pSup);
|
cleanupBlockOrderSupporter(pSup);
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
|
}
|
||||||
|
pSup->indexPerTable = taosMemoryCalloc(1, sizeof(int32_t) * numOfTables);
|
||||||
|
if(pSup->indexPerTable == NULL) {
|
||||||
|
taosMemoryFree(pSup->numOfBlocksPerTable);
|
||||||
|
cleanupBlockOrderSupporter(pSup);
|
||||||
|
return terrno;
|
||||||
|
}
|
||||||
|
pSup->pDataBlockInfo = taosMemoryCalloc(1, POINTER_BYTES * numOfTables);
|
||||||
|
if (pSup->pDataBlockInfo == NULL) {
|
||||||
|
cleanupBlockOrderSupporter(pSup);
|
||||||
|
taosMemoryFree(pSup->numOfBlocksPerTable);
|
||||||
|
taosMemoryFree(pSup->indexPerTable);
|
||||||
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
|
@ -1319,7 +1328,9 @@ static bool doCheckDatablockOverlap(STableBlockScanInfo* pBlockScanInfo, const S
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else { // it must be the last point
|
} else { // it must be the last point
|
||||||
ASSERT(p->version == 0);
|
if (!(p->version == 0)) {
|
||||||
|
tsdbError("unexpected version:%" PRId64, p->version);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else { // (p->ts > pBlock->maxKey.ts) {
|
} else { // (p->ts > pBlock->maxKey.ts) {
|
||||||
|
|
|
@ -60,7 +60,7 @@ static int32_t tsdbOpenFileImpl(STsdbFD *pFD) {
|
||||||
|
|
||||||
pFD->pBuf = taosMemoryCalloc(1, szPage);
|
pFD->pBuf = taosMemoryCalloc(1, szPage);
|
||||||
if (pFD->pBuf == NULL) {
|
if (pFD->pBuf == NULL) {
|
||||||
TSDB_CHECK_CODE(code = TSDB_CODE_OUT_OF_MEMORY, lino, _exit);
|
TSDB_CHECK_CODE(code = terrno, lino, _exit);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lc_size > 0) {
|
if (lc_size > 0) {
|
||||||
|
@ -100,7 +100,7 @@ int32_t tsdbOpenFile(const char *path, STsdb *pTsdb, int32_t flag, STsdbFD **ppF
|
||||||
|
|
||||||
pFD = (STsdbFD *)taosMemoryCalloc(1, sizeof(*pFD) + strlen(path) + 1);
|
pFD = (STsdbFD *)taosMemoryCalloc(1, sizeof(*pFD) + strlen(path) + 1);
|
||||||
if (pFD == NULL) {
|
if (pFD == NULL) {
|
||||||
TSDB_CHECK_CODE(code = TSDB_CODE_OUT_OF_MEMORY, lino, _exit);
|
TSDB_CHECK_CODE(code = terrno, lino, _exit);
|
||||||
}
|
}
|
||||||
|
|
||||||
pFD->path = (char *)&pFD[1];
|
pFD->path = (char *)&pFD[1];
|
||||||
|
@ -363,7 +363,7 @@ static int32_t tsdbReadFileBlock(STsdbFD *pFD, int64_t offset, int64_t size, boo
|
||||||
|
|
||||||
buf = taosMemoryCalloc(1, size);
|
buf = taosMemoryCalloc(1, size);
|
||||||
if (buf == NULL) {
|
if (buf == NULL) {
|
||||||
TSDB_CHECK_CODE(code = TSDB_CODE_OUT_OF_MEMORY, lino, _exit);
|
TSDB_CHECK_CODE(code = terrno, lino, _exit);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int32_t chunkno = offset / chunksize + 1; n < size; ++chunkno) {
|
for (int32_t chunkno = offset / chunksize + 1; n < size; ++chunkno) {
|
||||||
|
@ -587,7 +587,7 @@ int32_t tsdbDataFReaderOpen(SDataFReader **ppReader, STsdb *pTsdb, SDFileSet *pS
|
||||||
// alloc
|
// alloc
|
||||||
pReader = (SDataFReader *)taosMemoryCalloc(1, sizeof(*pReader));
|
pReader = (SDataFReader *)taosMemoryCalloc(1, sizeof(*pReader));
|
||||||
if (pReader == NULL) {
|
if (pReader == NULL) {
|
||||||
TSDB_CHECK_CODE(code = TSDB_CODE_OUT_OF_MEMORY, lino, _exit);
|
TSDB_CHECK_CODE(code = terrno, lino, _exit);
|
||||||
}
|
}
|
||||||
pReader->pTsdb = pTsdb;
|
pReader->pTsdb = pTsdb;
|
||||||
pReader->pSet = pSet;
|
pReader->pSet = pSet;
|
||||||
|
@ -794,7 +794,7 @@ int32_t tsdbDelFReaderOpen(SDelFReader **ppReader, SDelFile *pFile, STsdb *pTsdb
|
||||||
// alloc
|
// alloc
|
||||||
pDelFReader = (SDelFReader *)taosMemoryCalloc(1, sizeof(*pDelFReader));
|
pDelFReader = (SDelFReader *)taosMemoryCalloc(1, sizeof(*pDelFReader));
|
||||||
if (pDelFReader == NULL) {
|
if (pDelFReader == NULL) {
|
||||||
TSDB_CHECK_CODE(code = TSDB_CODE_OUT_OF_MEMORY, lino, _exit);
|
TSDB_CHECK_CODE(code = terrno, lino, _exit);
|
||||||
}
|
}
|
||||||
|
|
||||||
// open impl
|
// open impl
|
||||||
|
|
|
@ -416,7 +416,7 @@ int32_t tsdbSnapReaderOpen(STsdb* tsdb, int64_t sver, int64_t ever, int8_t type,
|
||||||
int32_t lino = 0;
|
int32_t lino = 0;
|
||||||
|
|
||||||
reader[0] = (STsdbSnapReader*)taosMemoryCalloc(1, sizeof(*reader[0]));
|
reader[0] = (STsdbSnapReader*)taosMemoryCalloc(1, sizeof(*reader[0]));
|
||||||
if (reader[0] == NULL) return TSDB_CODE_OUT_OF_MEMORY;
|
if (reader[0] == NULL) return terrno;
|
||||||
|
|
||||||
reader[0]->tsdb = tsdb;
|
reader[0]->tsdb = tsdb;
|
||||||
reader[0]->sver = sver;
|
reader[0]->sver = sver;
|
||||||
|
@ -1047,7 +1047,7 @@ int32_t tsdbSnapWriterOpen(STsdb* pTsdb, int64_t sver, int64_t ever, void* pRang
|
||||||
|
|
||||||
// start to write
|
// start to write
|
||||||
writer[0] = taosMemoryCalloc(1, sizeof(*writer[0]));
|
writer[0] = taosMemoryCalloc(1, sizeof(*writer[0]));
|
||||||
if (writer[0] == NULL) return TSDB_CODE_OUT_OF_MEMORY;
|
if (writer[0] == NULL) return terrno;
|
||||||
|
|
||||||
writer[0]->tsdb = pTsdb;
|
writer[0]->tsdb = pTsdb;
|
||||||
writer[0]->sver = sver;
|
writer[0]->sver = sver;
|
||||||
|
|
|
@ -52,7 +52,7 @@ int32_t tsdbSnapRAWReaderOpen(STsdb* tsdb, int64_t ever, int8_t type, STsdbSnapR
|
||||||
int32_t lino = 0;
|
int32_t lino = 0;
|
||||||
|
|
||||||
reader[0] = taosMemoryCalloc(1, sizeof(STsdbSnapRAWReader));
|
reader[0] = taosMemoryCalloc(1, sizeof(STsdbSnapRAWReader));
|
||||||
if (reader[0] == NULL) return TSDB_CODE_OUT_OF_MEMORY;
|
if (reader[0] == NULL) return terrno;
|
||||||
|
|
||||||
reader[0]->tsdb = tsdb;
|
reader[0]->tsdb = tsdb;
|
||||||
reader[0]->ever = ever;
|
reader[0]->ever = ever;
|
||||||
|
@ -196,7 +196,7 @@ static int32_t tsdbSnapRAWReadNext(STsdbSnapRAWReader* reader, SSnapDataHdr** pp
|
||||||
|
|
||||||
void* pBuf = taosMemoryCalloc(1, sizeof(SSnapDataHdr) + sizeof(STsdbDataRAWBlockHeader) + dataLength);
|
void* pBuf = taosMemoryCalloc(1, sizeof(SSnapDataHdr) + sizeof(STsdbDataRAWBlockHeader) + dataLength);
|
||||||
if (pBuf == NULL) {
|
if (pBuf == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
TSDB_CHECK_CODE(code, lino, _exit);
|
||||||
}
|
}
|
||||||
SSnapDataHdr* pHdr = pBuf;
|
SSnapDataHdr* pHdr = pBuf;
|
||||||
|
@ -343,7 +343,7 @@ int32_t tsdbSnapRAWWriterOpen(STsdb* pTsdb, int64_t ever, STsdbSnapRAWWriter** w
|
||||||
|
|
||||||
// start to write
|
// start to write
|
||||||
writer[0] = taosMemoryCalloc(1, sizeof(*writer[0]));
|
writer[0] = taosMemoryCalloc(1, sizeof(*writer[0]));
|
||||||
if (writer[0] == NULL) return TSDB_CODE_OUT_OF_MEMORY;
|
if (writer[0] == NULL) return terrno;
|
||||||
|
|
||||||
writer[0]->tsdb = pTsdb;
|
writer[0]->tsdb = pTsdb;
|
||||||
writer[0]->ever = ever;
|
writer[0]->ever = ever;
|
||||||
|
|
|
@ -41,7 +41,7 @@ int32_t tsdbSttFileReaderOpen(const char *fname, const SSttFileReaderConfig *con
|
||||||
|
|
||||||
reader[0] = taosMemoryCalloc(1, sizeof(*reader[0]));
|
reader[0] = taosMemoryCalloc(1, sizeof(*reader[0]));
|
||||||
if (reader[0] == NULL) {
|
if (reader[0] == NULL) {
|
||||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit);
|
TAOS_CHECK_GOTO(terrno, &lino, _exit);
|
||||||
}
|
}
|
||||||
|
|
||||||
reader[0]->config[0] = config[0];
|
reader[0]->config[0] = config[0];
|
||||||
|
@ -897,7 +897,7 @@ static int32_t tsdbSttFWriterCloseAbort(SSttFileWriter *writer) {
|
||||||
int32_t tsdbSttFileWriterOpen(const SSttFileWriterConfig *config, SSttFileWriter **writer) {
|
int32_t tsdbSttFileWriterOpen(const SSttFileWriterConfig *config, SSttFileWriter **writer) {
|
||||||
writer[0] = taosMemoryCalloc(1, sizeof(*writer[0]));
|
writer[0] = taosMemoryCalloc(1, sizeof(*writer[0]));
|
||||||
if (writer[0] == NULL) {
|
if (writer[0] == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
writer[0]->config[0] = config[0];
|
writer[0]->config[0] = config[0];
|
||||||
|
|
|
@ -33,8 +33,8 @@ int tsdbInsertData(STsdb *pTsdb, int64_t version, SSubmitReq2 *pMsg, SSubmitRsp2
|
||||||
int32_t affectedrows = 0;
|
int32_t affectedrows = 0;
|
||||||
int32_t numOfRows = 0;
|
int32_t numOfRows = 0;
|
||||||
|
|
||||||
if (ASSERTS(pTsdb->mem != NULL, "vgId:%d, mem is NULL", TD_VID(pTsdb->pVnode))) {
|
if (pTsdb->mem == NULL) {
|
||||||
TAOS_RETURN(TSDB_CODE_INVALID_PTR);
|
TAOS_RETURN(TSDB_CODE_INTERNAL_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
arrSize = taosArrayGetSize(pMsg->aSubmitTbData);
|
arrSize = taosArrayGetSize(pMsg->aSubmitTbData);
|
||||||
|
|
|
@ -326,7 +326,7 @@ static int32_t vnodeAsyncInit(SVAsync **async, const char *label) {
|
||||||
|
|
||||||
(*async) = (SVAsync *)taosMemoryCalloc(1, sizeof(SVAsync) + strlen(label) + 1);
|
(*async) = (SVAsync *)taosMemoryCalloc(1, sizeof(SVAsync) + strlen(label) + 1);
|
||||||
if ((*async) == NULL) {
|
if ((*async) == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
strcpy((char *)((*async) + 1), label);
|
strcpy((char *)((*async) + 1), label);
|
||||||
|
@ -480,7 +480,7 @@ int32_t vnodeAsync(SVAChannelID *channelID, EVAPriority priority, int32_t (*exec
|
||||||
// create task object
|
// create task object
|
||||||
SVATask *task = (SVATask *)taosMemoryCalloc(1, sizeof(SVATask));
|
SVATask *task = (SVATask *)taosMemoryCalloc(1, sizeof(SVATask));
|
||||||
if (task == NULL) {
|
if (task == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
task->priority = priority;
|
task->priority = priority;
|
||||||
|
|
|
@ -372,7 +372,7 @@ int vnodeAsyncCommit(SVnode *pVnode) {
|
||||||
|
|
||||||
SCommitInfo *pInfo = (SCommitInfo *)taosMemoryCalloc(1, sizeof(*pInfo));
|
SCommitInfo *pInfo = (SCommitInfo *)taosMemoryCalloc(1, sizeof(*pInfo));
|
||||||
if (NULL == pInfo) {
|
if (NULL == pInfo) {
|
||||||
TSDB_CHECK_CODE(code = TSDB_CODE_OUT_OF_MEMORY, lino, _exit);
|
TSDB_CHECK_CODE(code = terrno, lino, _exit);
|
||||||
}
|
}
|
||||||
|
|
||||||
// prepare to commit
|
// prepare to commit
|
||||||
|
|
|
@ -27,7 +27,7 @@ struct SVHashEntry {
|
||||||
static int32_t vHashRehash(SVHashTable* ht, uint32_t newNumBuckets) {
|
static int32_t vHashRehash(SVHashTable* ht, uint32_t newNumBuckets) {
|
||||||
SVHashEntry** newBuckets = (SVHashEntry**)taosMemoryCalloc(newNumBuckets, sizeof(SVHashEntry*));
|
SVHashEntry** newBuckets = (SVHashEntry**)taosMemoryCalloc(newNumBuckets, sizeof(SVHashEntry*));
|
||||||
if (newBuckets == NULL) {
|
if (newBuckets == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int32_t i = 0; i < ht->numBuckets; i++) {
|
for (int32_t i = 0; i < ht->numBuckets; i++) {
|
||||||
|
@ -65,7 +65,7 @@ int32_t vHashInit(SVHashTable** ht, uint32_t (*hash)(const void*), int32_t (*com
|
||||||
(*ht)->buckets = (SVHashEntry**)taosMemoryCalloc((*ht)->numBuckets, sizeof(SVHashEntry*));
|
(*ht)->buckets = (SVHashEntry**)taosMemoryCalloc((*ht)->numBuckets, sizeof(SVHashEntry*));
|
||||||
if ((*ht)->buckets == NULL) {
|
if ((*ht)->buckets == NULL) {
|
||||||
taosMemoryFree(*ht);
|
taosMemoryFree(*ht);
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -118,7 +118,7 @@ int32_t vnodeGetTableMeta(SVnode *pVnode, SRpcMsg *pMsg, bool direct) {
|
||||||
metaRsp.pSchemas = (SSchema *)taosMemoryMalloc(sizeof(SSchema) * (metaRsp.numOfColumns + metaRsp.numOfTags));
|
metaRsp.pSchemas = (SSchema *)taosMemoryMalloc(sizeof(SSchema) * (metaRsp.numOfColumns + metaRsp.numOfTags));
|
||||||
metaRsp.pSchemaExt = (SSchemaExt *)taosMemoryCalloc(metaRsp.numOfColumns, sizeof(SSchemaExt));
|
metaRsp.pSchemaExt = (SSchemaExt *)taosMemoryCalloc(metaRsp.numOfColumns, sizeof(SSchemaExt));
|
||||||
if (NULL == metaRsp.pSchemas || NULL == metaRsp.pSchemaExt) {
|
if (NULL == metaRsp.pSchemas || NULL == metaRsp.pSchemaExt) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _exit;
|
goto _exit;
|
||||||
}
|
}
|
||||||
(void)memcpy(metaRsp.pSchemas, schema.pSchema, sizeof(SSchema) * schema.nCols);
|
(void)memcpy(metaRsp.pSchemas, schema.pSchema, sizeof(SSchema) * schema.nCols);
|
||||||
|
@ -150,7 +150,7 @@ int32_t vnodeGetTableMeta(SVnode *pVnode, SRpcMsg *pMsg, bool direct) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pRsp == NULL) {
|
if (pRsp == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _exit;
|
goto _exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -309,7 +309,7 @@ int32_t vnodeGetTableCfg(SVnode *pVnode, SRpcMsg *pMsg, bool direct) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pRsp == NULL) {
|
if (pRsp == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _exit;
|
goto _exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -869,7 +869,7 @@ int32_t vnodeGetStreamProgress(SVnode *pVnode, SRpcMsg *pMsg, bool direct) {
|
||||||
buf = taosMemoryCalloc(1, rspLen);
|
buf = taosMemoryCalloc(1, rspLen);
|
||||||
}
|
}
|
||||||
if (!buf) {
|
if (!buf) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -166,7 +166,7 @@ int32_t vnodeSnapReaderOpen(SVnode *pVnode, SSnapshotParam *pParam, SVSnapReader
|
||||||
|
|
||||||
pReader = (SVSnapReader *)taosMemoryCalloc(1, sizeof(*pReader));
|
pReader = (SVSnapReader *)taosMemoryCalloc(1, sizeof(*pReader));
|
||||||
if (pReader == NULL) {
|
if (pReader == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _exit;
|
goto _exit;
|
||||||
}
|
}
|
||||||
pReader->pVnode = pVnode;
|
pReader->pVnode = pVnode;
|
||||||
|
@ -617,7 +617,7 @@ int32_t vnodeSnapWriterOpen(SVnode *pVnode, SSnapshotParam *pParam, SVSnapWriter
|
||||||
// alloc
|
// alloc
|
||||||
pWriter = (SVSnapWriter *)taosMemoryCalloc(1, sizeof(*pWriter));
|
pWriter = (SVSnapWriter *)taosMemoryCalloc(1, sizeof(*pWriter));
|
||||||
if (pWriter == NULL) {
|
if (pWriter == NULL) {
|
||||||
TSDB_CHECK_CODE(code = TSDB_CODE_OUT_OF_MEMORY, lino, _exit);
|
TSDB_CHECK_CODE(code = terrno, lino, _exit);
|
||||||
}
|
}
|
||||||
pWriter->pVnode = pVnode;
|
pWriter->pVnode = pVnode;
|
||||||
pWriter->sver = sver;
|
pWriter->sver = sver;
|
||||||
|
|
|
@ -960,7 +960,9 @@ static int32_t vnodeProcessDropTtlTbReq(SVnode *pVnode, int64_t ver, void *pReq,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ttlReq.nUids > 0) {
|
if (ttlReq.nUids > 0) {
|
||||||
metaDropTables(pVnode->pMeta, ttlReq.pTbUids);
|
int32_t code = metaDropTables(pVnode->pMeta, ttlReq.pTbUids);
|
||||||
|
if (code) return code;
|
||||||
|
|
||||||
(void)tqUpdateTbUidList(pVnode->pTq, ttlReq.pTbUids, false);
|
(void)tqUpdateTbUidList(pVnode->pTq, ttlReq.pTbUids, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1525,7 +1527,7 @@ static int32_t vnodeResetTableCxt(SMeta *pMeta, SSubmitReqConvertCxt *pCxt) {
|
||||||
if (NULL == pCxt->pTbData) {
|
if (NULL == pCxt->pTbData) {
|
||||||
pCxt->pTbData = taosMemoryCalloc(1, sizeof(SSubmitTbData));
|
pCxt->pTbData = taosMemoryCalloc(1, sizeof(SSubmitTbData));
|
||||||
if (NULL == pCxt->pTbData) {
|
if (NULL == pCxt->pTbData) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pCxt->pTbData->flags = 0;
|
pCxt->pTbData->flags = 0;
|
||||||
|
@ -1608,7 +1610,7 @@ static int32_t vnodeDecodeCreateTbReq(SSubmitReqConvertCxt *pCxt) {
|
||||||
|
|
||||||
pCxt->pTbData->pCreateTbReq = taosMemoryCalloc(1, sizeof(SVCreateTbReq));
|
pCxt->pTbData->pCreateTbReq = taosMemoryCalloc(1, sizeof(SVCreateTbReq));
|
||||||
if (NULL == pCxt->pTbData->pCreateTbReq) {
|
if (NULL == pCxt->pTbData->pCreateTbReq) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
SDecoder decoder = {0};
|
SDecoder decoder = {0};
|
||||||
|
@ -2327,6 +2329,7 @@ static int32_t vnodeProcessDropIndexReq(SVnode *pVnode, int64_t ver, void *pReq,
|
||||||
pRsp->contLen = 0;
|
pRsp->contLen = 0;
|
||||||
|
|
||||||
if ((code = tDeserializeSDropIdxReq(pReq, len, &req))) {
|
if ((code = tDeserializeSDropIdxReq(pReq, len, &req))) {
|
||||||
|
pRsp->code = code;
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,11 +27,8 @@ typedef struct SOperatorCostInfo {
|
||||||
|
|
||||||
struct SOperatorInfo;
|
struct SOperatorInfo;
|
||||||
|
|
||||||
//typedef int32_t (*__optr_encode_fn_t)(struct SOperatorInfo* pOperator, char** result, int32_t* length);
|
|
||||||
//typedef int32_t (*__optr_decode_fn_t)(struct SOperatorInfo* pOperator, char* result);
|
|
||||||
|
|
||||||
typedef int32_t (*__optr_open_fn_t)(struct SOperatorInfo* pOptr);
|
typedef int32_t (*__optr_open_fn_t)(struct SOperatorInfo* pOptr);
|
||||||
typedef SSDataBlock* (*__optr_fn_t)(struct SOperatorInfo* pOptr);
|
typedef int32_t (*__optr_fn_t)(struct SOperatorInfo* pOptr, SSDataBlock** pResBlock);
|
||||||
typedef void (*__optr_close_fn_t)(void* param);
|
typedef void (*__optr_close_fn_t)(void* param);
|
||||||
typedef int32_t (*__optr_explain_fn_t)(struct SOperatorInfo* pOptr, void** pOptrExplain, uint32_t* len);
|
typedef int32_t (*__optr_explain_fn_t)(struct SOperatorInfo* pOptr, void** pOptrExplain, uint32_t* len);
|
||||||
typedef int32_t (*__optr_reqBuf_fn_t)(struct SOperatorInfo* pOptr);
|
typedef int32_t (*__optr_reqBuf_fn_t)(struct SOperatorInfo* pOptr);
|
||||||
|
|
|
@ -57,8 +57,7 @@ static int32_t createDataBlockForEmptyInput(SOperatorInfo* pOperator, SSDataBloc
|
||||||
static void destroyDataBlockForEmptyInput(bool blockAllocated, SSDataBlock** ppBlock);
|
static void destroyDataBlockForEmptyInput(bool blockAllocated, SSDataBlock** ppBlock);
|
||||||
|
|
||||||
static int32_t doAggregateImpl(SOperatorInfo* pOperator, SqlFunctionCtx* pCtx);
|
static int32_t doAggregateImpl(SOperatorInfo* pOperator, SqlFunctionCtx* pCtx);
|
||||||
static SSDataBlock* getAggregateResult(SOperatorInfo* pOperator);
|
static int32_t getAggregateResultNext(SOperatorInfo* pOperator, SSDataBlock** ppRes);
|
||||||
|
|
||||||
static int32_t doInitAggInfoSup(SAggSupporter* pAggSup, SqlFunctionCtx* pCtx, int32_t numOfOutput, size_t keyBufSize,
|
static int32_t doInitAggInfoSup(SAggSupporter* pAggSup, SqlFunctionCtx* pCtx, int32_t numOfOutput, size_t keyBufSize,
|
||||||
const char* pKey);
|
const char* pKey);
|
||||||
|
|
||||||
|
@ -123,7 +122,7 @@ int32_t createAggregateOperatorInfo(SOperatorInfo* downstream, SAggPhysiNode* pA
|
||||||
|
|
||||||
setOperatorInfo(pOperator, "TableAggregate", QUERY_NODE_PHYSICAL_PLAN_HASH_AGG,
|
setOperatorInfo(pOperator, "TableAggregate", QUERY_NODE_PHYSICAL_PLAN_HASH_AGG,
|
||||||
!pAggNode->node.forceCreateNonBlockingOptr, OP_NOT_OPENED, pInfo, pTaskInfo);
|
!pAggNode->node.forceCreateNonBlockingOptr, OP_NOT_OPENED, pInfo, pTaskInfo);
|
||||||
pOperator->fpSet = createOperatorFpSet(optrDummyOpenFn, getAggregateResult, NULL, destroyAggOperatorInfo,
|
pOperator->fpSet = createOperatorFpSet(optrDummyOpenFn, getAggregateResultNext, NULL, destroyAggOperatorInfo,
|
||||||
optrDefaultBufFn, NULL, optrDefaultGetNextExtFn, NULL);
|
optrDefaultBufFn, NULL, optrDefaultGetNextExtFn, NULL);
|
||||||
|
|
||||||
if (downstream->operatorType == QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN) {
|
if (downstream->operatorType == QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN) {
|
||||||
|
|
|
@ -50,7 +50,7 @@ typedef struct SCacheRowsScanInfo {
|
||||||
SColumnInfo pkCol;
|
SColumnInfo pkCol;
|
||||||
} SCacheRowsScanInfo;
|
} SCacheRowsScanInfo;
|
||||||
|
|
||||||
static SSDataBlock* doScanCache(SOperatorInfo* pOperator);
|
static int32_t doScanCacheNext(SOperatorInfo* pOperator, SSDataBlock** ppRes);
|
||||||
static void destroyCacheScanOperator(void* param);
|
static void destroyCacheScanOperator(void* param);
|
||||||
static int32_t extractCacheScanSlotId(const SArray* pColMatchInfo, SExecTaskInfo* pTaskInfo, int32_t** pSlotIds,
|
static int32_t extractCacheScanSlotId(const SArray* pColMatchInfo, SExecTaskInfo* pTaskInfo, int32_t** pSlotIds,
|
||||||
int32_t** pDstSlotIds);
|
int32_t** pDstSlotIds);
|
||||||
|
@ -235,7 +235,7 @@ int32_t createCacherowsScanOperator(SLastRowScanPhysiNode* pScanNode, SReadHandl
|
||||||
pInfo, pTaskInfo);
|
pInfo, pTaskInfo);
|
||||||
pOperator->exprSupp.numOfExprs = taosArrayGetSize(pInfo->pRes->pDataBlock);
|
pOperator->exprSupp.numOfExprs = taosArrayGetSize(pInfo->pRes->pDataBlock);
|
||||||
|
|
||||||
pOperator->fpSet = createOperatorFpSet(optrDummyOpenFn, doScanCache, NULL, destroyCacheScanOperator, optrDefaultBufFn,
|
pOperator->fpSet = createOperatorFpSet(optrDummyOpenFn, doScanCacheNext, NULL, destroyCacheScanOperator, optrDefaultBufFn,
|
||||||
NULL, optrDefaultGetNextExtFn, NULL);
|
NULL, optrDefaultGetNextExtFn, NULL);
|
||||||
|
|
||||||
pOperator->cost.openCost = 0;
|
pOperator->cost.openCost = 0;
|
||||||
|
@ -259,7 +259,7 @@ _error:
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t doScanCacheNext(SOperatorInfo* pOperator, SSDataBlock** ppRes) {
|
static int32_t doScanCacheNext(SOperatorInfo* pOperator, SSDataBlock** ppRes) {
|
||||||
int32_t code = TSDB_CODE_SUCCESS;
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
int32_t lino = 0;
|
int32_t lino = 0;
|
||||||
if (pOperator->status == OP_EXEC_DONE) {
|
if (pOperator->status == OP_EXEC_DONE) {
|
||||||
|
@ -445,12 +445,6 @@ _end:
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
static SSDataBlock* doScanCache(SOperatorInfo* pOperator) {
|
|
||||||
SSDataBlock* pRes = NULL;
|
|
||||||
int32_t code = doScanCacheNext(pOperator, &pRes);
|
|
||||||
return pRes;
|
|
||||||
}
|
|
||||||
|
|
||||||
void destroyCacheScanOperator(void* param) {
|
void destroyCacheScanOperator(void* param) {
|
||||||
SCacheRowsScanInfo* pInfo = (SCacheRowsScanInfo*)param;
|
SCacheRowsScanInfo* pInfo = (SCacheRowsScanInfo*)param;
|
||||||
blockDataDestroy(pInfo->pRes);
|
blockDataDestroy(pInfo->pRes);
|
||||||
|
|
|
@ -64,6 +64,8 @@ void destroyCountWindowOperatorInfo(void* param) {
|
||||||
taosMemoryFreeClear(param);
|
taosMemoryFreeClear(param);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int32_t countWindowAggregateNext(SOperatorInfo* pOperator, SSDataBlock** ppRes);
|
||||||
|
|
||||||
static void clearWinStateBuff(SCountWindowResult* pBuff) { pBuff->winRows = 0; }
|
static void clearWinStateBuff(SCountWindowResult* pBuff) { pBuff->winRows = 0; }
|
||||||
|
|
||||||
static SCountWindowResult* getCountWinStateInfo(SCountWindowSupp* pCountSup) {
|
static SCountWindowResult* getCountWinStateInfo(SCountWindowSupp* pCountSup) {
|
||||||
|
@ -227,7 +229,6 @@ static int32_t countWindowAggregateNext(SOperatorInfo* pOperator, SSDataBlock**
|
||||||
SExprSupp* pExprSup = &pOperator->exprSupp;
|
SExprSupp* pExprSup = &pOperator->exprSupp;
|
||||||
int32_t order = pInfo->binfo.inputTsOrder;
|
int32_t order = pInfo->binfo.inputTsOrder;
|
||||||
SSDataBlock* pRes = pInfo->binfo.pRes;
|
SSDataBlock* pRes = pInfo->binfo.pRes;
|
||||||
SOperatorInfo* downstream = pOperator->pDownstream[0];
|
|
||||||
|
|
||||||
blockDataCleanup(pRes);
|
blockDataCleanup(pRes);
|
||||||
|
|
||||||
|
@ -292,12 +293,6 @@ _end:
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
static SSDataBlock* countWindowAggregate(SOperatorInfo* pOperator) {
|
|
||||||
SSDataBlock* pRes = NULL;
|
|
||||||
int32_t code = countWindowAggregateNext(pOperator, &pRes);
|
|
||||||
return pRes;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t createCountwindowOperatorInfo(SOperatorInfo* downstream, SPhysiNode* physiNode,
|
int32_t createCountwindowOperatorInfo(SOperatorInfo* downstream, SPhysiNode* physiNode,
|
||||||
SExecTaskInfo* pTaskInfo, SOperatorInfo** pOptrInfo) {
|
SExecTaskInfo* pTaskInfo, SOperatorInfo** pOptrInfo) {
|
||||||
QRY_OPTR_CHECK(pOptrInfo);
|
QRY_OPTR_CHECK(pOptrInfo);
|
||||||
|
@ -374,7 +369,7 @@ int32_t createCountwindowOperatorInfo(SOperatorInfo* downstream, SPhysiNode* phy
|
||||||
|
|
||||||
setOperatorInfo(pOperator, "CountWindowOperator", QUERY_NODE_PHYSICAL_PLAN_MERGE_COUNT, true, OP_NOT_OPENED, pInfo,
|
setOperatorInfo(pOperator, "CountWindowOperator", QUERY_NODE_PHYSICAL_PLAN_MERGE_COUNT, true, OP_NOT_OPENED, pInfo,
|
||||||
pTaskInfo);
|
pTaskInfo);
|
||||||
pOperator->fpSet = createOperatorFpSet(optrDummyOpenFn, countWindowAggregate, NULL, destroyCountWindowOperatorInfo,
|
pOperator->fpSet = createOperatorFpSet(optrDummyOpenFn, countWindowAggregateNext, NULL, destroyCountWindowOperatorInfo,
|
||||||
optrDefaultBufFn, NULL, optrDefaultGetNextExtFn, NULL);
|
optrDefaultBufFn, NULL, optrDefaultGetNextExtFn, NULL);
|
||||||
|
|
||||||
code = appendDownstream(pOperator, &downstream, 1);
|
code = appendDownstream(pOperator, &downstream, 1);
|
||||||
|
|
|
@ -878,20 +878,20 @@ static int32_t seqJoinLaunchNewRetrieve(SOperatorInfo* pOperator, SSDataBlock**
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static FORCE_INLINE SSDataBlock* seqStableJoinComposeRes(SStbJoinDynCtrlInfo* pStbJoin, SSDataBlock* pBlock) {
|
static FORCE_INLINE void seqStableJoinComposeRes(SStbJoinDynCtrlInfo* pStbJoin, SSDataBlock* pBlock) {
|
||||||
|
if (pBlock != NULL) {
|
||||||
pBlock->info.id.blockId = pStbJoin->outputBlkId;
|
pBlock->info.id.blockId = pStbJoin->outputBlkId;
|
||||||
return pBlock;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32_t seqStableJoin(SOperatorInfo* pOperator, SSDataBlock** pRes) {
|
||||||
SSDataBlock* seqStableJoin(SOperatorInfo* pOperator) {
|
|
||||||
int32_t code = TSDB_CODE_SUCCESS;
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
SDynQueryCtrlOperatorInfo* pInfo = pOperator->info;
|
SDynQueryCtrlOperatorInfo* pInfo = pOperator->info;
|
||||||
SStbJoinDynCtrlInfo* pStbJoin = (SStbJoinDynCtrlInfo*)&pInfo->stbJoin;
|
SStbJoinDynCtrlInfo* pStbJoin = (SStbJoinDynCtrlInfo*)&pInfo->stbJoin;
|
||||||
SSDataBlock* pRes = NULL;
|
|
||||||
|
|
||||||
|
QRY_OPTR_CHECK(pRes);
|
||||||
if (pOperator->status == OP_EXEC_DONE) {
|
if (pOperator->status == OP_EXEC_DONE) {
|
||||||
return pRes;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t st = 0;
|
int64_t st = 0;
|
||||||
|
@ -907,25 +907,24 @@ SSDataBlock* seqStableJoin(SOperatorInfo* pOperator) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QRY_ERR_JRET(seqJoinContinueCurrRetrieve(pOperator, &pRes));
|
QRY_ERR_JRET(seqJoinContinueCurrRetrieve(pOperator, pRes));
|
||||||
if (pRes) {
|
if (*pRes) {
|
||||||
goto _return;
|
goto _return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QRY_ERR_JRET(seqJoinLaunchNewRetrieve(pOperator, &pRes));
|
QRY_ERR_JRET(seqJoinLaunchNewRetrieve(pOperator, pRes));
|
||||||
|
|
||||||
_return:
|
_return:
|
||||||
|
|
||||||
if (pOperator->cost.openCost == 0) {
|
if (pOperator->cost.openCost == 0) {
|
||||||
pOperator->cost.openCost = (taosGetTimestampUs() - st) / 1000.0;
|
pOperator->cost.openCost = (taosGetTimestampUs() - st) / 1000.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (code) {
|
if (code) {
|
||||||
pOperator->pTaskInfo->code = code;
|
pOperator->pTaskInfo->code = code;
|
||||||
T_LONG_JMP(pOperator->pTaskInfo->env, pOperator->pTaskInfo->code);
|
} else {
|
||||||
|
seqStableJoinComposeRes(pStbJoin, *pRes);
|
||||||
}
|
}
|
||||||
|
return code;
|
||||||
return pRes ? seqStableJoinComposeRes(pStbJoin, pRes) : NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t initSeqStbJoinTableHash(SStbJoinPrevJoinCtx* pPrev, bool batchFetch) {
|
int32_t initSeqStbJoinTableHash(SStbJoinPrevJoinCtx* pPrev, bool batchFetch) {
|
||||||
|
|
|
@ -39,7 +39,7 @@ typedef struct SEventWindowOperatorInfo {
|
||||||
SSDataBlock* pPreDataBlock;
|
SSDataBlock* pPreDataBlock;
|
||||||
} SEventWindowOperatorInfo;
|
} SEventWindowOperatorInfo;
|
||||||
|
|
||||||
static SSDataBlock* eventWindowAggregate(SOperatorInfo* pOperator);
|
static int32_t eventWindowAggregateNext(SOperatorInfo* pOperator, SSDataBlock** pRes);
|
||||||
static void destroyEWindowOperatorInfo(void* param);
|
static void destroyEWindowOperatorInfo(void* param);
|
||||||
static int32_t eventWindowAggImpl(SOperatorInfo* pOperator, SEventWindowOperatorInfo* pInfo, SSDataBlock* pBlock);
|
static int32_t eventWindowAggImpl(SOperatorInfo* pOperator, SEventWindowOperatorInfo* pInfo, SSDataBlock* pBlock);
|
||||||
|
|
||||||
|
@ -131,7 +131,7 @@ int32_t createEventwindowOperatorInfo(SOperatorInfo* downstream, SPhysiNode* phy
|
||||||
|
|
||||||
setOperatorInfo(pOperator, "EventWindowOperator", QUERY_NODE_PHYSICAL_PLAN_MERGE_STATE, true, OP_NOT_OPENED, pInfo,
|
setOperatorInfo(pOperator, "EventWindowOperator", QUERY_NODE_PHYSICAL_PLAN_MERGE_STATE, true, OP_NOT_OPENED, pInfo,
|
||||||
pTaskInfo);
|
pTaskInfo);
|
||||||
pOperator->fpSet = createOperatorFpSet(optrDummyOpenFn, eventWindowAggregate, NULL, destroyEWindowOperatorInfo,
|
pOperator->fpSet = createOperatorFpSet(optrDummyOpenFn, eventWindowAggregateNext, NULL, destroyEWindowOperatorInfo,
|
||||||
optrDefaultBufFn, NULL, optrDefaultGetNextExtFn, NULL);
|
optrDefaultBufFn, NULL, optrDefaultGetNextExtFn, NULL);
|
||||||
|
|
||||||
code = appendDownstream(pOperator, &downstream, 1);
|
code = appendDownstream(pOperator, &downstream, 1);
|
||||||
|
@ -250,12 +250,6 @@ _end:
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
static SSDataBlock* eventWindowAggregate(SOperatorInfo* pOperator) {
|
|
||||||
SSDataBlock* pRes = NULL;
|
|
||||||
int32_t code = eventWindowAggregateNext(pOperator, &pRes);
|
|
||||||
return pRes;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int32_t setSingleOutputTupleBufv1(SResultRowInfo* pResultRowInfo, STimeWindow* win, SResultRow** pResult,
|
static int32_t setSingleOutputTupleBufv1(SResultRowInfo* pResultRowInfo, STimeWindow* win, SResultRow** pResult,
|
||||||
SExprSupp* pExprSup, SAggSupporter* pAggSup) {
|
SExprSupp* pExprSup, SAggSupporter* pAggSup) {
|
||||||
if (*pResult == NULL) {
|
if (*pResult == NULL) {
|
||||||
|
|
|
@ -305,12 +305,6 @@ _end:
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
static SSDataBlock* loadRemoteData(SOperatorInfo* pOperator) {
|
|
||||||
SSDataBlock* pRes = NULL;
|
|
||||||
int32_t code = loadRemoteDataNext(pOperator, &pRes);
|
|
||||||
return pRes;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int32_t initDataSource(int32_t numOfSources, SExchangeInfo* pInfo, const char* id) {
|
static int32_t initDataSource(int32_t numOfSources, SExchangeInfo* pInfo, const char* id) {
|
||||||
pInfo->pSourceDataInfo = taosArrayInit(numOfSources, sizeof(SSourceDataInfo));
|
pInfo->pSourceDataInfo = taosArrayInit(numOfSources, sizeof(SSourceDataInfo));
|
||||||
if (pInfo->pSourceDataInfo == NULL) {
|
if (pInfo->pSourceDataInfo == NULL) {
|
||||||
|
@ -447,7 +441,7 @@ int32_t createExchangeOperatorInfo(void* pTransporter, SExchangePhysiNode* pExNo
|
||||||
code = filterInitFromNode((SNode*)pExNode->node.pConditions, &pOperator->exprSupp.pFilterInfo, 0);
|
code = filterInitFromNode((SNode*)pExNode->node.pConditions, &pOperator->exprSupp.pFilterInfo, 0);
|
||||||
QUERY_CHECK_CODE(code, lino, _error);
|
QUERY_CHECK_CODE(code, lino, _error);
|
||||||
|
|
||||||
pOperator->fpSet = createOperatorFpSet(prepareLoadRemoteData, loadRemoteData, NULL, destroyExchangeOperatorInfo,
|
pOperator->fpSet = createOperatorFpSet(prepareLoadRemoteData, loadRemoteDataNext, NULL, destroyExchangeOperatorInfo,
|
||||||
optrDefaultBufFn, NULL, optrDefaultGetNextExtFn, NULL);
|
optrDefaultBufFn, NULL, optrDefaultGetNextExtFn, NULL);
|
||||||
*pOptrInfo = pOperator;
|
*pOptrInfo = pOperator;
|
||||||
return code;
|
return code;
|
||||||
|
@ -465,7 +459,6 @@ _error:
|
||||||
pOperator->info = NULL;
|
pOperator->info = NULL;
|
||||||
destroyOperator(pOperator);
|
destroyOperator(pOperator);
|
||||||
}
|
}
|
||||||
pTaskInfo->code = code;
|
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -435,6 +435,7 @@ int32_t isQualifiedTable(STableKeyInfo* info, SNode* pTagCond, void* metaHandle,
|
||||||
code = nodesCloneNode(pTagCond, &pTagCondTmp);
|
code = nodesCloneNode(pTagCond, &pTagCondTmp);
|
||||||
if (TSDB_CODE_SUCCESS != code) {
|
if (TSDB_CODE_SUCCESS != code) {
|
||||||
*pQualified = false;
|
*pQualified = false;
|
||||||
|
pAPI->metaReaderFn.clearReader(&mr);
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
STransTagExprCtx ctx = {.code = 0, .pReader = &mr};
|
STransTagExprCtx ctx = {.code = 0, .pReader = &mr};
|
||||||
|
@ -1746,6 +1747,8 @@ static SColumn* createColumn(int32_t blockId, int32_t slotId, int32_t colId, SDa
|
||||||
int32_t createExprFromOneNode(SExprInfo* pExp, SNode* pNode, int16_t slotId) {
|
int32_t createExprFromOneNode(SExprInfo* pExp, SNode* pNode, int16_t slotId) {
|
||||||
int32_t code = TSDB_CODE_SUCCESS;
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
int32_t lino = 0;
|
int32_t lino = 0;
|
||||||
|
pExp->base.numOfParams = 0;
|
||||||
|
pExp->base.pParam = NULL;
|
||||||
pExp->pExpr = taosMemoryCalloc(1, sizeof(tExprNode));
|
pExp->pExpr = taosMemoryCalloc(1, sizeof(tExprNode));
|
||||||
QUERY_CHECK_NULL(pExp->pExpr, code, lino, _end, terrno);
|
QUERY_CHECK_NULL(pExp->pExpr, code, lino, _end, terrno);
|
||||||
|
|
||||||
|
@ -1786,6 +1789,7 @@ int32_t createExprFromOneNode(SExprInfo* pExp, SNode* pNode, int16_t slotId) {
|
||||||
createResSchema(pType->type, pType->bytes, slotId, pType->scale, pType->precision, pValNode->node.aliasName);
|
createResSchema(pType->type, pType->bytes, slotId, pType->scale, pType->precision, pValNode->node.aliasName);
|
||||||
pExp->base.pParam[0].type = FUNC_PARAM_TYPE_VALUE;
|
pExp->base.pParam[0].type = FUNC_PARAM_TYPE_VALUE;
|
||||||
code = nodesValueNodeToVariant(pValNode, &pExp->base.pParam[0].param);
|
code = nodesValueNodeToVariant(pValNode, &pExp->base.pParam[0].param);
|
||||||
|
QUERY_CHECK_CODE(code, lino, _end);
|
||||||
} else if (type == QUERY_NODE_FUNCTION) {
|
} else if (type == QUERY_NODE_FUNCTION) {
|
||||||
pExp->pExpr->nodeType = QUERY_NODE_FUNCTION;
|
pExp->pExpr->nodeType = QUERY_NODE_FUNCTION;
|
||||||
SFunctionNode* pFuncNode = (SFunctionNode*)pNode;
|
SFunctionNode* pFuncNode = (SFunctionNode*)pNode;
|
||||||
|
@ -1970,6 +1974,8 @@ int32_t createExprInfo(SNodeList* pNodeList, SNodeList* pGroupKeys, SExprInfo**
|
||||||
// set the output buffer for the selectivity + tag query
|
// set the output buffer for the selectivity + tag query
|
||||||
static int32_t setSelectValueColumnInfo(SqlFunctionCtx* pCtx, int32_t numOfOutput) {
|
static int32_t setSelectValueColumnInfo(SqlFunctionCtx* pCtx, int32_t numOfOutput) {
|
||||||
int32_t num = 0;
|
int32_t num = 0;
|
||||||
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
|
int32_t lino = 0;
|
||||||
|
|
||||||
SqlFunctionCtx* p = NULL;
|
SqlFunctionCtx* p = NULL;
|
||||||
SqlFunctionCtx** pValCtx = taosMemoryCalloc(numOfOutput, POINTER_BYTES);
|
SqlFunctionCtx** pValCtx = taosMemoryCalloc(numOfOutput, POINTER_BYTES);
|
||||||
|
@ -1978,6 +1984,8 @@ static int32_t setSelectValueColumnInfo(SqlFunctionCtx* pCtx, int32_t numOfOutpu
|
||||||
}
|
}
|
||||||
|
|
||||||
SHashObj* pSelectFuncs = taosHashInit(8, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_ENTRY_LOCK);
|
SHashObj* pSelectFuncs = taosHashInit(8, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_ENTRY_LOCK);
|
||||||
|
QUERY_CHECK_NULL(pSelectFuncs, code, lino, _end, terrno);
|
||||||
|
|
||||||
for (int32_t i = 0; i < numOfOutput; ++i) {
|
for (int32_t i = 0; i < numOfOutput; ++i) {
|
||||||
const char* pName = pCtx[i].pExpr->pExpr->_function.functionName;
|
const char* pName = pCtx[i].pExpr->pExpr->_function.functionName;
|
||||||
if ((strcmp(pName, "_select_value") == 0) || (strcmp(pName, "_group_key") == 0) ||
|
if ((strcmp(pName, "_select_value") == 0) || (strcmp(pName, "_group_key") == 0) ||
|
||||||
|
@ -1991,8 +1999,8 @@ static int32_t setSelectValueColumnInfo(SqlFunctionCtx* pCtx, int32_t numOfOutpu
|
||||||
} else {
|
} else {
|
||||||
int32_t tempRes = taosHashPut(pSelectFuncs, pName, strlen(pName), &num, sizeof(num));
|
int32_t tempRes = taosHashPut(pSelectFuncs, pName, strlen(pName), &num, sizeof(num));
|
||||||
if (tempRes != TSDB_CODE_SUCCESS && tempRes != TSDB_CODE_DUP_KEY) {
|
if (tempRes != TSDB_CODE_SUCCESS && tempRes != TSDB_CODE_DUP_KEY) {
|
||||||
qError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(tempRes));
|
code = tempRes;
|
||||||
return tempRes;
|
QUERY_CHECK_CODE(code, lino, _end);
|
||||||
}
|
}
|
||||||
p = &pCtx[i];
|
p = &pCtx[i];
|
||||||
}
|
}
|
||||||
|
@ -2007,7 +2015,13 @@ static int32_t setSelectValueColumnInfo(SqlFunctionCtx* pCtx, int32_t numOfOutpu
|
||||||
taosMemoryFreeClear(pValCtx);
|
taosMemoryFreeClear(pValCtx);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TSDB_CODE_SUCCESS;
|
_end:
|
||||||
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
|
taosMemoryFreeClear(pValCtx);
|
||||||
|
taosHashCleanup(pSelectFuncs);
|
||||||
|
qError("%s failed at line %d since %s", __func__, lino, tstrerror(code));
|
||||||
|
}
|
||||||
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
SqlFunctionCtx* createSqlFunctionCtx(SExprInfo* pExprInfo, int32_t numOfOutput, int32_t** rowEntryInfoOffset,
|
SqlFunctionCtx* createSqlFunctionCtx(SExprInfo* pExprInfo, int32_t numOfOutput, int32_t** rowEntryInfoOffset,
|
||||||
|
|
|
@ -372,11 +372,11 @@ static int32_t filterUnqualifiedTables(const SStreamScanInfo* pScanInfo, const S
|
||||||
int32_t code = TSDB_CODE_SUCCESS;
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
int32_t lino = 0;
|
int32_t lino = 0;
|
||||||
SArray* qa = taosArrayInit(4, sizeof(tb_uid_t));
|
SArray* qa = taosArrayInit(4, sizeof(tb_uid_t));
|
||||||
QUERY_CHECK_NULL(qa, code, lino, _end, terrno);
|
QUERY_CHECK_NULL(qa, code, lino, _error, terrno);
|
||||||
int32_t numOfUids = taosArrayGetSize(tableIdList);
|
int32_t numOfUids = taosArrayGetSize(tableIdList);
|
||||||
if (numOfUids == 0) {
|
if (numOfUids == 0) {
|
||||||
(*ppArrayRes) = qa;
|
(*ppArrayRes) = qa;
|
||||||
goto _end;
|
goto _error;
|
||||||
}
|
}
|
||||||
|
|
||||||
STableScanInfo* pTableScanInfo = pScanInfo->pTableScanOp->info;
|
STableScanInfo* pTableScanInfo = pScanInfo->pTableScanOp->info;
|
||||||
|
@ -437,10 +437,11 @@ static int32_t filterUnqualifiedTables(const SStreamScanInfo* pScanInfo, const S
|
||||||
QUERY_CHECK_NULL(tmp, code, lino, _end, terrno);
|
QUERY_CHECK_NULL(tmp, code, lino, _end, terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_end:
|
||||||
pAPI->metaReaderFn.clearReader(&mr);
|
pAPI->metaReaderFn.clearReader(&mr);
|
||||||
(*ppArrayRes) = qa;
|
(*ppArrayRes) = qa;
|
||||||
|
|
||||||
_end:
|
_error:
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
qError("%s failed at line %d since %s", __func__, lino, tstrerror(code));
|
qError("%s failed at line %d since %s", __func__, lino, tstrerror(code));
|
||||||
}
|
}
|
||||||
|
@ -692,9 +693,11 @@ int32_t qExecTaskOpt(qTaskInfo_t tinfo, SArray* pResList, uint64_t* useconds, bo
|
||||||
pTaskInfo->paramSet = true;
|
pTaskInfo->paramSet = true;
|
||||||
code = pTaskInfo->pRoot->fpSet.getNextExtFn(pTaskInfo->pRoot, pTaskInfo->pOpParam, &pRes);
|
code = pTaskInfo->pRoot->fpSet.getNextExtFn(pTaskInfo->pRoot, pTaskInfo->pOpParam, &pRes);
|
||||||
} else {
|
} else {
|
||||||
pRes = pTaskInfo->pRoot->fpSet.getNextFn(pTaskInfo->pRoot);
|
code = pTaskInfo->pRoot->fpSet.getNextFn(pTaskInfo->pRoot, &pRes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QUERY_CHECK_CODE(code, lino, _end);
|
||||||
|
|
||||||
if (pRes == NULL) {
|
if (pRes == NULL) {
|
||||||
st = taosGetTimestampUs();
|
st = taosGetTimestampUs();
|
||||||
}
|
}
|
||||||
|
@ -718,6 +721,7 @@ int32_t qExecTaskOpt(qTaskInfo_t tinfo, SArray* pResList, uint64_t* useconds, bo
|
||||||
} else {
|
} else {
|
||||||
void* tmp = taosArrayGet(pTaskInfo->pResultBlockList, blockIndex);
|
void* tmp = taosArrayGet(pTaskInfo->pResultBlockList, blockIndex);
|
||||||
QUERY_CHECK_NULL(tmp, code, lino, _end, terrno);
|
QUERY_CHECK_NULL(tmp, code, lino, _end, terrno);
|
||||||
|
|
||||||
p = *(SSDataBlock**)tmp;
|
p = *(SSDataBlock**)tmp;
|
||||||
code = copyDataBlock(p, pRes);
|
code = copyDataBlock(p, pRes);
|
||||||
QUERY_CHECK_CODE(code, lino, _end);
|
QUERY_CHECK_CODE(code, lino, _end);
|
||||||
|
@ -735,8 +739,10 @@ int32_t qExecTaskOpt(qTaskInfo_t tinfo, SArray* pResList, uint64_t* useconds, bo
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
pRes = pTaskInfo->pRoot->fpSet.getNextFn(pTaskInfo->pRoot);
|
code = pTaskInfo->pRoot->fpSet.getNextFn(pTaskInfo->pRoot, &pRes);
|
||||||
|
QUERY_CHECK_CODE(code, lino, _end);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pTaskInfo->pSubplan->dynamicRowThreshold) {
|
if (pTaskInfo->pSubplan->dynamicRowThreshold) {
|
||||||
pTaskInfo->pSubplan->rowsThreshold -= current;
|
pTaskInfo->pSubplan->rowsThreshold -= current;
|
||||||
}
|
}
|
||||||
|
@ -750,7 +756,6 @@ int32_t qExecTaskOpt(qTaskInfo_t tinfo, SArray* pResList, uint64_t* useconds, bo
|
||||||
}
|
}
|
||||||
|
|
||||||
_end:
|
_end:
|
||||||
|
|
||||||
(void)cleanUpUdfs();
|
(void)cleanUpUdfs();
|
||||||
|
|
||||||
uint64_t total = pTaskInfo->pRoot->resultInfo.totalRows;
|
uint64_t total = pTaskInfo->pRoot->resultInfo.totalRows;
|
||||||
|
@ -758,6 +763,11 @@ _end:
|
||||||
GET_TASKID(pTaskInfo), current, (int32_t)taosArrayGetSize(pResList), total, 0, el / 1000.0);
|
GET_TASKID(pTaskInfo), current, (int32_t)taosArrayGetSize(pResList), total, 0, el / 1000.0);
|
||||||
|
|
||||||
atomic_store_64(&pTaskInfo->owner, 0);
|
atomic_store_64(&pTaskInfo->owner, 0);
|
||||||
|
if (code) {
|
||||||
|
pTaskInfo->code = code;
|
||||||
|
qError("%s failed at line %d since %s", __func__, lino, tstrerror(code));
|
||||||
|
}
|
||||||
|
|
||||||
return pTaskInfo->code;
|
return pTaskInfo->code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -778,9 +788,10 @@ void qCleanExecTaskBlockBuf(qTaskInfo_t tinfo) {
|
||||||
int32_t qExecTask(qTaskInfo_t tinfo, SSDataBlock** pRes, uint64_t* useconds) {
|
int32_t qExecTask(qTaskInfo_t tinfo, SSDataBlock** pRes, uint64_t* useconds) {
|
||||||
SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo;
|
SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo;
|
||||||
int64_t threadId = taosGetSelfPthreadId();
|
int64_t threadId = taosGetSelfPthreadId();
|
||||||
|
int32_t lino = 0;
|
||||||
|
int64_t curOwner = 0;
|
||||||
|
|
||||||
*pRes = NULL;
|
*pRes = NULL;
|
||||||
int64_t curOwner = 0;
|
|
||||||
|
|
||||||
// todo extract method
|
// todo extract method
|
||||||
taosRLockLatch(&pTaskInfo->lock);
|
taosRLockLatch(&pTaskInfo->lock);
|
||||||
|
@ -822,7 +833,12 @@ int32_t qExecTask(qTaskInfo_t tinfo, SSDataBlock** pRes, uint64_t* useconds) {
|
||||||
|
|
||||||
int64_t st = taosGetTimestampUs();
|
int64_t st = taosGetTimestampUs();
|
||||||
|
|
||||||
*pRes = pTaskInfo->pRoot->fpSet.getNextFn(pTaskInfo->pRoot);
|
int32_t code = pTaskInfo->pRoot->fpSet.getNextFn(pTaskInfo->pRoot, pRes);
|
||||||
|
if (code) {
|
||||||
|
pTaskInfo->code = code;
|
||||||
|
qError("%s failed at line %d, code:%s %s", __func__, lino, tstrerror(code), GET_TASKID(pTaskInfo));
|
||||||
|
}
|
||||||
|
|
||||||
uint64_t el = (taosGetTimestampUs() - st);
|
uint64_t el = (taosGetTimestampUs() - st);
|
||||||
|
|
||||||
pTaskInfo->cost.elapsedTime += el;
|
pTaskInfo->cost.elapsedTime += el;
|
||||||
|
@ -830,8 +846,7 @@ int32_t qExecTask(qTaskInfo_t tinfo, SSDataBlock** pRes, uint64_t* useconds) {
|
||||||
*useconds = pTaskInfo->cost.elapsedTime;
|
*useconds = pTaskInfo->cost.elapsedTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tmpRes = cleanUpUdfs();
|
(void) cleanUpUdfs();
|
||||||
qTrace("%s at line %d res:%d", __func__, __LINE__, tmpRes);
|
|
||||||
|
|
||||||
int32_t current = (*pRes != NULL) ? (*pRes)->info.rows : 0;
|
int32_t current = (*pRes != NULL) ? (*pRes)->info.rows : 0;
|
||||||
uint64_t total = pTaskInfo->pRoot->resultInfo.totalRows;
|
uint64_t total = pTaskInfo->pRoot->resultInfo.totalRows;
|
||||||
|
|
|
@ -1291,12 +1291,8 @@ FORCE_INLINE int32_t getNextBlockFromDownstreamImpl(struct SOperatorInfo* pOpera
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
*pResBlock = pOperator->pDownstream[idx]->fpSet.getNextFn(pOperator->pDownstream[idx]);
|
code = pOperator->pDownstream[idx]->fpSet.getNextFn(pOperator->pDownstream[idx], pResBlock);
|
||||||
if (*pResBlock == NULL && terrno != 0) {
|
|
||||||
return terrno;
|
|
||||||
} else {
|
|
||||||
return code;
|
return code;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool compareVal(const char* v, const SStateKeys* pKey) {
|
bool compareVal(const char* v, const SStateKeys* pKey) {
|
||||||
|
|
|
@ -318,12 +318,6 @@ static int32_t doFillNext(SOperatorInfo* pOperator, SSDataBlock** ppRes) {
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
static SSDataBlock* doFill(SOperatorInfo* pOperator) {
|
|
||||||
SSDataBlock* pRes = NULL;
|
|
||||||
int32_t code = doFillNext(pOperator, &pRes);
|
|
||||||
return pRes;
|
|
||||||
}
|
|
||||||
|
|
||||||
void destroyFillOperatorInfo(void* param) {
|
void destroyFillOperatorInfo(void* param) {
|
||||||
SFillOperatorInfo* pInfo = (SFillOperatorInfo*)param;
|
SFillOperatorInfo* pInfo = (SFillOperatorInfo*)param;
|
||||||
pInfo->pFillInfo = taosDestroyFillInfo(pInfo->pFillInfo);
|
pInfo->pFillInfo = taosDestroyFillInfo(pInfo->pFillInfo);
|
||||||
|
@ -513,7 +507,7 @@ int32_t createFillOperatorInfo(SOperatorInfo* downstream, SFillPhysiNode* pPhyFi
|
||||||
}
|
}
|
||||||
|
|
||||||
setOperatorInfo(pOperator, "FillOperator", QUERY_NODE_PHYSICAL_PLAN_FILL, false, OP_NOT_OPENED, pInfo, pTaskInfo);
|
setOperatorInfo(pOperator, "FillOperator", QUERY_NODE_PHYSICAL_PLAN_FILL, false, OP_NOT_OPENED, pInfo, pTaskInfo);
|
||||||
pOperator->fpSet = createOperatorFpSet(optrDummyOpenFn, doFill, NULL, destroyFillOperatorInfo, optrDefaultBufFn, NULL,
|
pOperator->fpSet = createOperatorFpSet(optrDummyOpenFn, doFillNext, NULL, destroyFillOperatorInfo, optrDefaultBufFn, NULL,
|
||||||
optrDefaultGetNextExtFn, NULL);
|
optrDefaultGetNextExtFn, NULL);
|
||||||
|
|
||||||
code = appendDownstream(pOperator, &downstream, 1);
|
code = appendDownstream(pOperator, &downstream, 1);
|
||||||
|
@ -522,6 +516,9 @@ int32_t createFillOperatorInfo(SOperatorInfo* downstream, SFillPhysiNode* pPhyFi
|
||||||
return code;
|
return code;
|
||||||
|
|
||||||
_error:
|
_error:
|
||||||
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
|
qError("%s failed at line %d since %s", __func__, lino, tstrerror(code));
|
||||||
|
}
|
||||||
if (pInfo != NULL) {
|
if (pInfo != NULL) {
|
||||||
destroyFillOperatorInfo(pInfo);
|
destroyFillOperatorInfo(pInfo);
|
||||||
}
|
}
|
||||||
|
|
|
@ -692,24 +692,32 @@ _return:
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
static FORCE_INLINE int32_t getBlkFromDownstreamOperator(struct SOperatorInfo* pOperator, int32_t downstreamIdx, SSDataBlock** ppRes) {
|
static FORCE_INLINE int32_t getBlkFromDownstreamOperator(struct SOperatorInfo* pOperator, int32_t downstreamIdx,
|
||||||
|
SSDataBlock** ppRes) {
|
||||||
int32_t code = TSDB_CODE_SUCCESS;
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
SOperatorParam* pDownstreamParam = NULL;
|
SOperatorParam* pDownstreamParam = NULL;
|
||||||
SSDataBlock* pBlock = NULL;
|
SSDataBlock* pBlock = NULL;
|
||||||
SGroupCacheOperatorInfo* pGCache = pOperator->info;
|
SGroupCacheOperatorInfo* pGCache = pOperator->info;
|
||||||
|
|
||||||
code = appendNewGroupToDownstream(pOperator, downstreamIdx, &pDownstreamParam);
|
code = appendNewGroupToDownstream(pOperator, downstreamIdx, &pDownstreamParam);
|
||||||
if (code) {
|
if (code) {
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SOperatorInfo* pDownstream = pOperator->pDownstream[downstreamIdx];
|
||||||
if (pDownstreamParam) {
|
if (pDownstreamParam) {
|
||||||
code = pOperator->pDownstream[downstreamIdx]->fpSet.getNextExtFn(pOperator->pDownstream[downstreamIdx], pDownstreamParam, &pBlock);
|
code = pDownstream->fpSet.getNextExtFn(pDownstream, pDownstreamParam, &pBlock);
|
||||||
} else {
|
} else {
|
||||||
pBlock = pOperator->pDownstream[downstreamIdx]->fpSet.getNextFn(pOperator->pDownstream[downstreamIdx]);
|
code = pDownstream->fpSet.getNextFn(pDownstream, &pBlock);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (code) {
|
||||||
|
qError("failed to get block from downstream, code:%s %s", tstrerror(code), GET_TASKID(pOperator->pTaskInfo));
|
||||||
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pBlock) {
|
if (pBlock) {
|
||||||
qDebug("%s blk retrieved from group %" PRIu64, GET_TASKID(pOperator->pTaskInfo), pBlock->info.id.groupId);
|
qDebug("%s res block retrieved from group %" PRIu64, GET_TASKID(pOperator->pTaskInfo), pBlock->info.id.groupId);
|
||||||
|
|
||||||
pGCache->execInfo.pDownstreamBlkNum[downstreamIdx]++;
|
pGCache->execInfo.pDownstreamBlkNum[downstreamIdx]++;
|
||||||
if (NULL == pGCache->pDownstreams[downstreamIdx].pBaseBlock) {
|
if (NULL == pGCache->pDownstreams[downstreamIdx].pBaseBlock) {
|
||||||
|
@ -717,14 +725,15 @@ static FORCE_INLINE int32_t getBlkFromDownstreamOperator(struct SOperatorInfo* p
|
||||||
if (code) {
|
if (code) {
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
if (NULL == taosArrayPush(pGCache->pDownstreams[downstreamIdx].pFreeBlock, &pGCache->pDownstreams[downstreamIdx].pBaseBlock)) {
|
|
||||||
|
if (NULL == taosArrayPush(pGCache->pDownstreams[downstreamIdx].pFreeBlock,
|
||||||
|
&pGCache->pDownstreams[downstreamIdx].pBaseBlock)) {
|
||||||
QRY_ERR_RET(terrno);
|
QRY_ERR_RET(terrno);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
*ppRes = pBlock;
|
*ppRes = pBlock;
|
||||||
|
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -531,12 +531,6 @@ _end:
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
static SSDataBlock* hashGroupbyAggregate(SOperatorInfo* pOperator) {
|
|
||||||
SSDataBlock* pRes = NULL;
|
|
||||||
int32_t code = hashGroupbyAggregateNext(pOperator, &pRes);
|
|
||||||
return pRes;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t createGroupOperatorInfo(SOperatorInfo* downstream, SAggPhysiNode* pAggNode, SExecTaskInfo* pTaskInfo,
|
int32_t createGroupOperatorInfo(SOperatorInfo* downstream, SAggPhysiNode* pAggNode, SExecTaskInfo* pTaskInfo,
|
||||||
SOperatorInfo** pOptrInfo) {
|
SOperatorInfo** pOptrInfo) {
|
||||||
QRY_OPTR_CHECK(pOptrInfo);
|
QRY_OPTR_CHECK(pOptrInfo);
|
||||||
|
@ -600,7 +594,7 @@ int32_t createGroupOperatorInfo(SOperatorInfo* downstream, SAggPhysiNode* pAggNo
|
||||||
pInfo->binfo.inputTsOrder = pAggNode->node.inputTsOrder;
|
pInfo->binfo.inputTsOrder = pAggNode->node.inputTsOrder;
|
||||||
pInfo->binfo.outputTsOrder = pAggNode->node.outputTsOrder;
|
pInfo->binfo.outputTsOrder = pAggNode->node.outputTsOrder;
|
||||||
|
|
||||||
pOperator->fpSet = createOperatorFpSet(optrDummyOpenFn, hashGroupbyAggregate, NULL, destroyGroupOperatorInfo,
|
pOperator->fpSet = createOperatorFpSet(optrDummyOpenFn, hashGroupbyAggregateNext, NULL, destroyGroupOperatorInfo,
|
||||||
optrDefaultBufFn, NULL, optrDefaultGetNextExtFn, NULL);
|
optrDefaultBufFn, NULL, optrDefaultGetNextExtFn, NULL);
|
||||||
code = appendDownstream(pOperator, &downstream, 1);
|
code = appendDownstream(pOperator, &downstream, 1);
|
||||||
QUERY_CHECK_CODE(code, lino, _error);
|
QUERY_CHECK_CODE(code, lino, _error);
|
||||||
|
@ -1103,12 +1097,6 @@ _end:
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
static SSDataBlock* hashPartition(SOperatorInfo* pOperator) {
|
|
||||||
SSDataBlock* pRes = NULL;
|
|
||||||
int32_t code = hashPartitionNext(pOperator, &pRes);
|
|
||||||
return pRes;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void destroyPartitionOperatorInfo(void* param) {
|
static void destroyPartitionOperatorInfo(void* param) {
|
||||||
SPartitionOperatorInfo* pInfo = (SPartitionOperatorInfo*)param;
|
SPartitionOperatorInfo* pInfo = (SPartitionOperatorInfo*)param;
|
||||||
cleanupBasicInfo(&pInfo->binfo);
|
cleanupBasicInfo(&pInfo->binfo);
|
||||||
|
@ -1232,7 +1220,7 @@ int32_t createPartitionOperatorInfo(SOperatorInfo* downstream, SPartitionPhysiNo
|
||||||
setOperatorInfo(pOperator, "PartitionOperator", QUERY_NODE_PHYSICAL_PLAN_PARTITION, false, OP_NOT_OPENED, pInfo,
|
setOperatorInfo(pOperator, "PartitionOperator", QUERY_NODE_PHYSICAL_PLAN_PARTITION, false, OP_NOT_OPENED, pInfo,
|
||||||
pTaskInfo);
|
pTaskInfo);
|
||||||
|
|
||||||
pOperator->fpSet = createOperatorFpSet(optrDummyOpenFn, hashPartition, NULL, destroyPartitionOperatorInfo,
|
pOperator->fpSet = createOperatorFpSet(optrDummyOpenFn, hashPartitionNext, NULL, destroyPartitionOperatorInfo,
|
||||||
optrDefaultBufFn, NULL, optrDefaultGetNextExtFn, NULL);
|
optrDefaultBufFn, NULL, optrDefaultGetNextExtFn, NULL);
|
||||||
|
|
||||||
code = appendDownstream(pOperator, &downstream, 1);
|
code = appendDownstream(pOperator, &downstream, 1);
|
||||||
|
@ -1583,12 +1571,6 @@ _end:
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
static SSDataBlock* doStreamHashPartition(SOperatorInfo* pOperator) {
|
|
||||||
SSDataBlock* pRes = NULL;
|
|
||||||
int32_t code = doStreamHashPartitionNext(pOperator, &pRes);
|
|
||||||
return pRes;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void destroyStreamPartitionOperatorInfo(void* param) {
|
static void destroyStreamPartitionOperatorInfo(void* param) {
|
||||||
SStreamPartitionOperatorInfo* pInfo = (SStreamPartitionOperatorInfo*)param;
|
SStreamPartitionOperatorInfo* pInfo = (SStreamPartitionOperatorInfo*)param;
|
||||||
cleanupBasicInfo(&pInfo->binfo);
|
cleanupBasicInfo(&pInfo->binfo);
|
||||||
|
@ -1785,7 +1767,7 @@ int32_t createStreamPartitionOperatorInfo(SOperatorInfo* downstream, SStreamPart
|
||||||
pOperator->exprSupp.numOfExprs = numOfCols;
|
pOperator->exprSupp.numOfExprs = numOfCols;
|
||||||
pOperator->exprSupp.pExprInfo = pExprInfo;
|
pOperator->exprSupp.pExprInfo = pExprInfo;
|
||||||
pOperator->fpSet =
|
pOperator->fpSet =
|
||||||
createOperatorFpSet(optrDummyOpenFn, doStreamHashPartition, NULL, destroyStreamPartitionOperatorInfo,
|
createOperatorFpSet(optrDummyOpenFn, doStreamHashPartitionNext, NULL, destroyStreamPartitionOperatorInfo,
|
||||||
optrDefaultBufFn, NULL, optrDefaultGetNextExtFn, NULL);
|
optrDefaultBufFn, NULL, optrDefaultGetNextExtFn, NULL);
|
||||||
setOperatorStreamStateFn(pOperator, streamOpReleaseState, streamOpReloadState);
|
setOperatorStreamStateFn(pOperator, streamOpReleaseState, streamOpReloadState);
|
||||||
|
|
||||||
|
|
|
@ -989,13 +989,14 @@ void hJoinSetDone(struct SOperatorInfo* pOperator) {
|
||||||
qDebug("hash Join done");
|
qDebug("hash Join done");
|
||||||
}
|
}
|
||||||
|
|
||||||
static SSDataBlock* hJoinMainProcess(struct SOperatorInfo* pOperator) {
|
static int32_t hJoinMainProcess(struct SOperatorInfo* pOperator, SSDataBlock** pResBlock) {
|
||||||
SHJoinOperatorInfo* pJoin = pOperator->info;
|
SHJoinOperatorInfo* pJoin = pOperator->info;
|
||||||
SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
|
SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
|
||||||
int32_t code = TSDB_CODE_SUCCESS;
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
SSDataBlock* pRes = pJoin->finBlk;
|
SSDataBlock* pRes = pJoin->finBlk;
|
||||||
int64_t st = 0;
|
int64_t st = 0;
|
||||||
|
|
||||||
|
QRY_OPTR_CHECK(pResBlock);
|
||||||
if (pOperator->cost.openCost == 0) {
|
if (pOperator->cost.openCost == 0) {
|
||||||
st = taosGetTimestampUs();
|
st = taosGetTimestampUs();
|
||||||
}
|
}
|
||||||
|
@ -1012,7 +1013,7 @@ static SSDataBlock* hJoinMainProcess(struct SOperatorInfo* pOperator) {
|
||||||
code = hJoinBuildHash(pOperator, &queryDone);
|
code = hJoinBuildHash(pOperator, &queryDone);
|
||||||
if (code) {
|
if (code) {
|
||||||
pTaskInfo->code = code;
|
pTaskInfo->code = code;
|
||||||
T_LONG_JMP(pTaskInfo->env, code);
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (queryDone) {
|
if (queryDone) {
|
||||||
|
@ -1026,18 +1027,20 @@ static SSDataBlock* hJoinMainProcess(struct SOperatorInfo* pOperator) {
|
||||||
code = (*pJoin->joinFp)(pOperator);
|
code = (*pJoin->joinFp)(pOperator);
|
||||||
if (code) {
|
if (code) {
|
||||||
pTaskInfo->code = code;
|
pTaskInfo->code = code;
|
||||||
T_LONG_JMP(pTaskInfo->env, code);
|
return pTaskInfo->code;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pRes->info.rows > 0 && pJoin->pFinFilter != NULL) {
|
if (pRes->info.rows > 0 && pJoin->pFinFilter != NULL) {
|
||||||
code = doFilter(pRes, pJoin->pFinFilter, NULL);
|
code = doFilter(pRes, pJoin->pFinFilter, NULL);
|
||||||
if (code) {
|
if (code) {
|
||||||
pTaskInfo->code = code;
|
pTaskInfo->code = code;
|
||||||
T_LONG_JMP(pTaskInfo->env, code);
|
return pTaskInfo->code;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pRes->info.rows > 0) {
|
if (pRes->info.rows > 0) {
|
||||||
return pRes;
|
*pResBlock = pRes;
|
||||||
|
return code;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1054,7 +1057,7 @@ static SSDataBlock* hJoinMainProcess(struct SOperatorInfo* pOperator) {
|
||||||
code = hJoinPrepareStart(pOperator, pBlock);
|
code = hJoinPrepareStart(pOperator, pBlock);
|
||||||
if (code) {
|
if (code) {
|
||||||
pTaskInfo->code = code;
|
pTaskInfo->code = code;
|
||||||
T_LONG_JMP(pTaskInfo->env, code);
|
return pTaskInfo->code;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!hJoinBlkReachThreshold(pJoin, pRes->info.rows)) {
|
if (!hJoinBlkReachThreshold(pJoin, pRes->info.rows)) {
|
||||||
|
@ -1065,7 +1068,7 @@ static SSDataBlock* hJoinMainProcess(struct SOperatorInfo* pOperator) {
|
||||||
code = doFilter(pRes, pJoin->pFinFilter, NULL);
|
code = doFilter(pRes, pJoin->pFinFilter, NULL);
|
||||||
if (code) {
|
if (code) {
|
||||||
pTaskInfo->code = code;
|
pTaskInfo->code = code;
|
||||||
T_LONG_JMP(pTaskInfo->env, code);
|
return pTaskInfo->code;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1075,14 +1078,16 @@ static SSDataBlock* hJoinMainProcess(struct SOperatorInfo* pOperator) {
|
||||||
}
|
}
|
||||||
|
|
||||||
_return:
|
_return:
|
||||||
|
|
||||||
if (pOperator->cost.openCost == 0) {
|
if (pOperator->cost.openCost == 0) {
|
||||||
pOperator->cost.openCost = (taosGetTimestampUs() - st) / 1000.0;
|
pOperator->cost.openCost = (taosGetTimestampUs() - st) / 1000.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (pRes->info.rows > 0) ? pRes : NULL;
|
if (pRes->info.rows > 0) {
|
||||||
}
|
*pResBlock = pRes;
|
||||||
|
}
|
||||||
|
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
static void destroyHashJoinOperator(void* param) {
|
static void destroyHashJoinOperator(void* param) {
|
||||||
SHJoinOperatorInfo* pJoinOperator = (SHJoinOperatorInfo*)param;
|
SHJoinOperatorInfo* pJoinOperator = (SHJoinOperatorInfo*)param;
|
||||||
|
|
|
@ -1691,13 +1691,13 @@ void mJoinResetOperator(struct SOperatorInfo* pOperator) {
|
||||||
pOperator->status = OP_OPENED;
|
pOperator->status = OP_OPENED;
|
||||||
}
|
}
|
||||||
|
|
||||||
SSDataBlock* mJoinMainProcess(struct SOperatorInfo* pOperator) {
|
int32_t mJoinMainProcess(struct SOperatorInfo* pOperator, SSDataBlock** pResBlock) {
|
||||||
SMJoinOperatorInfo* pJoin = pOperator->info;
|
SMJoinOperatorInfo* pJoin = pOperator->info;
|
||||||
int32_t code = TSDB_CODE_SUCCESS;
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
if (pOperator->status == OP_EXEC_DONE) {
|
if (pOperator->status == OP_EXEC_DONE) {
|
||||||
if (NULL == pOperator->pDownstreamGetParams || NULL == pOperator->pDownstreamGetParams[0] || NULL == pOperator->pDownstreamGetParams[1]) {
|
if (NULL == pOperator->pDownstreamGetParams || NULL == pOperator->pDownstreamGetParams[0] || NULL == pOperator->pDownstreamGetParams[1]) {
|
||||||
qDebug("%s merge join done", GET_TASKID(pOperator->pTaskInfo));
|
qDebug("%s merge join done", GET_TASKID(pOperator->pTaskInfo));
|
||||||
return NULL;
|
return code;
|
||||||
} else {
|
} else {
|
||||||
mJoinResetOperator(pOperator);
|
mJoinResetOperator(pOperator);
|
||||||
qDebug("%s start new round merge join", GET_TASKID(pOperator->pTaskInfo));
|
qDebug("%s start new round merge join", GET_TASKID(pOperator->pTaskInfo));
|
||||||
|
@ -1739,7 +1739,10 @@ SSDataBlock* mJoinMainProcess(struct SOperatorInfo* pOperator) {
|
||||||
}
|
}
|
||||||
|
|
||||||
pJoin->execInfo.resRows += pBlock ? pBlock->info.rows : 0;
|
pJoin->execInfo.resRows += pBlock ? pBlock->info.rows : 0;
|
||||||
return (pBlock && pBlock->info.rows > 0) ? pBlock : NULL;
|
if (pBlock && pBlock->info.rows > 0) {
|
||||||
|
*pResBlock = pBlock;
|
||||||
|
}
|
||||||
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
void destroyGrpArray(void* ppArray) {
|
void destroyGrpArray(void* ppArray) {
|
||||||
|
|
|
@ -57,18 +57,16 @@ typedef struct SMultiwayMergeOperatorInfo {
|
||||||
bool inputWithGroupId;
|
bool inputWithGroupId;
|
||||||
} SMultiwayMergeOperatorInfo;
|
} SMultiwayMergeOperatorInfo;
|
||||||
|
|
||||||
static SSDataBlock* doSortMerge1(SOperatorInfo* pOperator);
|
|
||||||
static int32_t doSortMerge(SOperatorInfo* pOperator, SSDataBlock** pResBlock);
|
static int32_t doSortMerge(SOperatorInfo* pOperator, SSDataBlock** pResBlock);
|
||||||
static SSDataBlock* doMultiwayMerge(SOperatorInfo* pOperator);
|
static int32_t doMultiwayMerge(SOperatorInfo* pOperator, SSDataBlock** pResBlock);
|
||||||
static int32_t doNonSortMerge(SOperatorInfo* pOperator, SSDataBlock** pResBlock);
|
static int32_t doNonSortMerge(SOperatorInfo* pOperator, SSDataBlock** pResBlock);
|
||||||
static SSDataBlock* doNonSortMerge1(SOperatorInfo* pOperator);
|
|
||||||
static SSDataBlock* doColsMerge1(SOperatorInfo* pOperator);
|
|
||||||
static int32_t doColsMerge(SOperatorInfo* pOperator, SSDataBlock** pResBlock);
|
static int32_t doColsMerge(SOperatorInfo* pOperator, SSDataBlock** pResBlock);
|
||||||
|
static int32_t sortMergeloadNextDataBlock(void* param, SSDataBlock** ppBlock);
|
||||||
|
|
||||||
int32_t sortMergeloadNextDataBlock(void* param, SSDataBlock** ppBlock) {
|
int32_t sortMergeloadNextDataBlock(void* param, SSDataBlock** ppBlock) {
|
||||||
SOperatorInfo* pOperator = (SOperatorInfo*)param;
|
SOperatorInfo* pOperator = (SOperatorInfo*)param;
|
||||||
*ppBlock = pOperator->fpSet.getNextFn(pOperator);
|
int32_t code = pOperator->fpSet.getNextFn(pOperator, ppBlock);
|
||||||
return TSDB_CODE_SUCCESS;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t openSortMergeOperator(SOperatorInfo* pOperator) {
|
int32_t openSortMergeOperator(SOperatorInfo* pOperator) {
|
||||||
|
@ -185,12 +183,6 @@ static int32_t doGetSortedBlockData(SMultiwayMergeOperatorInfo* pInfo, SSortHand
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
SSDataBlock* doSortMerge1(SOperatorInfo* pOperator) {
|
|
||||||
SSDataBlock* pBlock = NULL;
|
|
||||||
pOperator->pTaskInfo->code = doSortMerge(pOperator, &pBlock);
|
|
||||||
return pBlock;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t doSortMerge(SOperatorInfo* pOperator, SSDataBlock** pResBlock) {
|
int32_t doSortMerge(SOperatorInfo* pOperator, SSDataBlock** pResBlock) {
|
||||||
SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
|
SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
|
||||||
SMultiwayMergeOperatorInfo* pInfo = pOperator->info;
|
SMultiwayMergeOperatorInfo* pInfo = pOperator->info;
|
||||||
|
@ -343,12 +335,6 @@ int32_t openNonSortMergeOperator(SOperatorInfo* pOperator) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
SSDataBlock* doNonSortMerge1(SOperatorInfo* pOperator) {
|
|
||||||
SSDataBlock* pBlock = NULL;
|
|
||||||
pOperator->pTaskInfo->code = doNonSortMerge(pOperator, &pBlock);
|
|
||||||
return pBlock;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t doNonSortMerge(SOperatorInfo* pOperator, SSDataBlock** pResBlock) {
|
int32_t doNonSortMerge(SOperatorInfo* pOperator, SSDataBlock** pResBlock) {
|
||||||
QRY_OPTR_CHECK(pResBlock);
|
QRY_OPTR_CHECK(pResBlock);
|
||||||
|
|
||||||
|
@ -432,12 +418,6 @@ int32_t copyColumnsValue(SNodeList* pNodeList, uint64_t targetBlkId, SSDataBlock
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
SSDataBlock* doColsMerge1(SOperatorInfo* pOperator) {
|
|
||||||
SSDataBlock* pBlock = NULL;
|
|
||||||
pOperator->pTaskInfo->code = doColsMerge(pOperator, &pBlock);
|
|
||||||
return pBlock;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t doColsMerge(SOperatorInfo* pOperator, SSDataBlock** pResBlock) {
|
int32_t doColsMerge(SOperatorInfo* pOperator, SSDataBlock** pResBlock) {
|
||||||
QRY_OPTR_CHECK(pResBlock);
|
QRY_OPTR_CHECK(pResBlock);
|
||||||
|
|
||||||
|
@ -486,9 +466,9 @@ int32_t getColsMergeExplainExecInfo(SOperatorInfo* pOptr, void** pOptrExplain, u
|
||||||
|
|
||||||
SOperatorFpSet gMultiwayMergeFps[MERGE_TYPE_MAX_VALUE] = {
|
SOperatorFpSet gMultiwayMergeFps[MERGE_TYPE_MAX_VALUE] = {
|
||||||
{0},
|
{0},
|
||||||
{._openFn = openSortMergeOperator, .getNextFn = doSortMerge1, .closeFn = destroySortMergeOperatorInfo, .getExplainFn = getSortMergeExplainExecInfo},
|
{._openFn = openSortMergeOperator, .getNextFn = doSortMerge, .closeFn = destroySortMergeOperatorInfo, .getExplainFn = getSortMergeExplainExecInfo},
|
||||||
{._openFn = openNonSortMergeOperator, .getNextFn = doNonSortMerge1, .closeFn = destroyNonSortMergeOperatorInfo, .getExplainFn = getNonSortMergeExplainExecInfo},
|
{._openFn = openNonSortMergeOperator, .getNextFn = doNonSortMerge, .closeFn = destroyNonSortMergeOperatorInfo, .getExplainFn = getNonSortMergeExplainExecInfo},
|
||||||
{._openFn = openColsMergeOperator, .getNextFn = doColsMerge1, .closeFn = destroyColsMergeOperatorInfo, .getExplainFn = getColsMergeExplainExecInfo},
|
{._openFn = openColsMergeOperator, .getNextFn = doColsMerge, .closeFn = destroyColsMergeOperatorInfo, .getExplainFn = getColsMergeExplainExecInfo},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -518,30 +498,37 @@ int32_t openMultiwayMergeOperator(SOperatorInfo* pOperator) {
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
SSDataBlock* doMultiwayMerge(SOperatorInfo* pOperator) {
|
int32_t doMultiwayMerge(SOperatorInfo* pOperator, SSDataBlock** pResBlock) {
|
||||||
|
QRY_OPTR_CHECK(pResBlock);
|
||||||
|
|
||||||
if (pOperator->status == OP_EXEC_DONE) {
|
if (pOperator->status == OP_EXEC_DONE) {
|
||||||
return NULL;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
SSDataBlock* pBlock = NULL;
|
|
||||||
SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
|
SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
|
||||||
SMultiwayMergeOperatorInfo* pInfo = pOperator->info;
|
SMultiwayMergeOperatorInfo* pInfo = pOperator->info;
|
||||||
|
|
||||||
int32_t code = pOperator->fpSet._openFn(pOperator);
|
int32_t code = pOperator->fpSet._openFn(pOperator);
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
T_LONG_JMP(pTaskInfo->env, code);
|
pTaskInfo->code = code;
|
||||||
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NULL != gMultiwayMergeFps[pInfo->type].getNextFn) {
|
if (NULL != gMultiwayMergeFps[pInfo->type].getNextFn) {
|
||||||
pBlock = (*gMultiwayMergeFps[pInfo->type].getNextFn)(pOperator);
|
code = (*gMultiwayMergeFps[pInfo->type].getNextFn)(pOperator, pResBlock);
|
||||||
|
if (code) {
|
||||||
|
pTaskInfo->code = code;
|
||||||
|
return code;
|
||||||
}
|
}
|
||||||
if (pBlock != NULL) {
|
}
|
||||||
pOperator->resultInfo.totalRows += pBlock->info.rows;
|
|
||||||
|
if ((*pResBlock) != NULL) {
|
||||||
|
pOperator->resultInfo.totalRows += (*pResBlock)->info.rows;
|
||||||
} else {
|
} else {
|
||||||
setOperatorCompleted(pOperator);
|
setOperatorCompleted(pOperator);
|
||||||
}
|
}
|
||||||
|
|
||||||
return pBlock;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
void destroyMultiwayMergeOperatorInfo(void* param) {
|
void destroyMultiwayMergeOperatorInfo(void* param) {
|
||||||
|
@ -599,6 +586,7 @@ int32_t createMultiwayMergeOperatorInfo(SOperatorInfo** downStreams, size_t numS
|
||||||
SPhysiNode* pChildNode = (SPhysiNode*)nodesListGetNode(pPhyNode->pChildren, 0);
|
SPhysiNode* pChildNode = (SPhysiNode*)nodesListGetNode(pPhyNode->pChildren, 0);
|
||||||
SSDataBlock* pInputBlock = createDataBlockFromDescNode(pChildNode->pOutputDataBlockDesc);
|
SSDataBlock* pInputBlock = createDataBlockFromDescNode(pChildNode->pOutputDataBlockDesc);
|
||||||
TSDB_CHECK_NULL(pInputBlock, code, lino, _error, terrno);
|
TSDB_CHECK_NULL(pInputBlock, code, lino, _error, terrno);
|
||||||
|
pSortMergeInfo->pInputBlock = pInputBlock;
|
||||||
|
|
||||||
initResultSizeInfo(&pOperator->resultInfo, 1024);
|
initResultSizeInfo(&pOperator->resultInfo, 1024);
|
||||||
code = blockDataEnsureCapacity(pInfo->binfo.pRes, pOperator->resultInfo.capacity);
|
code = blockDataEnsureCapacity(pInfo->binfo.pRes, pOperator->resultInfo.capacity);
|
||||||
|
@ -611,7 +599,6 @@ int32_t createMultiwayMergeOperatorInfo(SOperatorInfo** downStreams, size_t numS
|
||||||
pSortMergeInfo->bufPageSize = getProperSortPageSize(rowSize, numOfCols);
|
pSortMergeInfo->bufPageSize = getProperSortPageSize(rowSize, numOfCols);
|
||||||
pSortMergeInfo->sortBufSize =
|
pSortMergeInfo->sortBufSize =
|
||||||
pSortMergeInfo->bufPageSize * (numStreams + 1); // one additional is reserved for merged result.
|
pSortMergeInfo->bufPageSize * (numStreams + 1); // one additional is reserved for merged result.
|
||||||
pSortMergeInfo->pInputBlock = pInputBlock;
|
|
||||||
code = extractColMatchInfo(pMergePhyNode->pTargets, pDescNode, &numOfOutputCols, COL_MATCH_FROM_SLOT_ID,
|
code = extractColMatchInfo(pMergePhyNode->pTargets, pDescNode, &numOfOutputCols, COL_MATCH_FROM_SLOT_ID,
|
||||||
&pSortMergeInfo->matchInfo);
|
&pSortMergeInfo->matchInfo);
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
|
|
|
@ -862,10 +862,13 @@ int32_t optrDefaultGetNextExtFn(struct SOperatorInfo* pOperator, SOperatorParam*
|
||||||
int32_t code = setOperatorParams(pOperator, pParam, OP_GET_PARAM);
|
int32_t code = setOperatorParams(pOperator, pParam, OP_GET_PARAM);
|
||||||
if (TSDB_CODE_SUCCESS != code) {
|
if (TSDB_CODE_SUCCESS != code) {
|
||||||
pOperator->pTaskInfo->code = code;
|
pOperator->pTaskInfo->code = code;
|
||||||
T_LONG_JMP(pOperator->pTaskInfo->env, pOperator->pTaskInfo->code);
|
} else {
|
||||||
|
code = pOperator->fpSet.getNextFn(pOperator, pRes);
|
||||||
|
if (code) {
|
||||||
|
pOperator->pTaskInfo->code = code;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
*pRes = pOperator->fpSet.getNextFn(pOperator);
|
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -165,7 +165,7 @@ int32_t createProjectOperatorInfo(SOperatorInfo* downstream, SProjectPhysiNode*
|
||||||
|
|
||||||
setOperatorInfo(pOperator, "ProjectOperator", QUERY_NODE_PHYSICAL_PLAN_PROJECT, false, OP_NOT_OPENED, pInfo,
|
setOperatorInfo(pOperator, "ProjectOperator", QUERY_NODE_PHYSICAL_PLAN_PROJECT, false, OP_NOT_OPENED, pInfo,
|
||||||
pTaskInfo);
|
pTaskInfo);
|
||||||
pOperator->fpSet = createOperatorFpSet(optrDummyOpenFn, doProjectOperation1, NULL, destroyProjectOperatorInfo,
|
pOperator->fpSet = createOperatorFpSet(optrDummyOpenFn, doProjectOperation, NULL, destroyProjectOperatorInfo,
|
||||||
optrDefaultBufFn, NULL, optrDefaultGetNextExtFn, NULL);
|
optrDefaultBufFn, NULL, optrDefaultGetNextExtFn, NULL);
|
||||||
setOperatorStreamStateFn(pOperator, streamOperatorReleaseState, streamOperatorReloadState);
|
setOperatorStreamStateFn(pOperator, streamOperatorReleaseState, streamOperatorReloadState);
|
||||||
|
|
||||||
|
@ -445,16 +445,6 @@ int32_t doProjectOperation(SOperatorInfo* pOperator, SSDataBlock** pResBlock) {
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
SSDataBlock* doProjectOperation1(SOperatorInfo* pOperator) {
|
|
||||||
SSDataBlock* pRes = NULL;
|
|
||||||
int32_t code = doProjectOperation(pOperator, &pRes);
|
|
||||||
if (code && pOperator->pTaskInfo->code == 0) {
|
|
||||||
pOperator->pTaskInfo->code = code;
|
|
||||||
}
|
|
||||||
|
|
||||||
return pRes;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t createIndefinitOutputOperatorInfo(SOperatorInfo* downstream, SPhysiNode* pNode,
|
int32_t createIndefinitOutputOperatorInfo(SOperatorInfo* downstream, SPhysiNode* pNode,
|
||||||
SExecTaskInfo* pTaskInfo, SOperatorInfo** pOptrInfo) {
|
SExecTaskInfo* pTaskInfo, SOperatorInfo** pOptrInfo) {
|
||||||
QRY_OPTR_CHECK(pOptrInfo);
|
QRY_OPTR_CHECK(pOptrInfo);
|
||||||
|
@ -526,7 +516,7 @@ int32_t createIndefinitOutputOperatorInfo(SOperatorInfo* downstream, SPhysiNode*
|
||||||
|
|
||||||
setOperatorInfo(pOperator, "IndefinitOperator", QUERY_NODE_PHYSICAL_PLAN_INDEF_ROWS_FUNC, false, OP_NOT_OPENED, pInfo,
|
setOperatorInfo(pOperator, "IndefinitOperator", QUERY_NODE_PHYSICAL_PLAN_INDEF_ROWS_FUNC, false, OP_NOT_OPENED, pInfo,
|
||||||
pTaskInfo);
|
pTaskInfo);
|
||||||
pOperator->fpSet = createOperatorFpSet(optrDummyOpenFn, doApplyIndefinitFunction1, NULL, destroyIndefinitOperatorInfo,
|
pOperator->fpSet = createOperatorFpSet(optrDummyOpenFn, doApplyIndefinitFunction, NULL, destroyIndefinitOperatorInfo,
|
||||||
optrDefaultBufFn, NULL, optrDefaultGetNextExtFn, NULL);
|
optrDefaultBufFn, NULL, optrDefaultGetNextExtFn, NULL);
|
||||||
|
|
||||||
code = appendDownstream(pOperator, &downstream, 1);
|
code = appendDownstream(pOperator, &downstream, 1);
|
||||||
|
|
|
@ -68,6 +68,7 @@ typedef struct STableCountScanOperatorInfo {
|
||||||
} STableCountScanOperatorInfo;
|
} STableCountScanOperatorInfo;
|
||||||
|
|
||||||
static bool processBlockWithProbability(const SSampleExecInfo* pInfo);
|
static bool processBlockWithProbability(const SSampleExecInfo* pInfo);
|
||||||
|
static int32_t doTableCountScanNext(SOperatorInfo* pOperator, SSDataBlock** ppRes);
|
||||||
|
|
||||||
bool processBlockWithProbability(const SSampleExecInfo* pInfo) {
|
bool processBlockWithProbability(const SSampleExecInfo* pInfo) {
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -226,9 +227,8 @@ static int32_t doDynamicPruneDataBlock(SOperatorInfo* pOperator, SDataBlockInfo*
|
||||||
|
|
||||||
SResultRowEntryInfo* pEntry = getResultEntryInfo(pRow, i, pTableScanInfo->base.pdInfo.pExprSup->rowEntryInfoOffset);
|
SResultRowEntryInfo* pEntry = getResultEntryInfo(pRow, i, pTableScanInfo->base.pdInfo.pExprSup->rowEntryInfoOffset);
|
||||||
|
|
||||||
int32_t reqStatus;
|
EFuncDataRequired reqStatus = fmFuncDynDataRequired(functionId, pEntry, pBlockInfo);
|
||||||
code = fmFuncDynDataRequired(functionId, pEntry, pBlockInfo, &reqStatus);
|
if (reqStatus != FUNC_DATA_REQUIRED_NOT_LOAD) {
|
||||||
if (code != TSDB_CODE_SUCCESS || reqStatus != FUNC_DATA_REQUIRED_NOT_LOAD) {
|
|
||||||
notLoadBlock = false;
|
notLoadBlock = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -419,7 +419,11 @@ static int32_t loadDataBlock(SOperatorInfo* pOperator, STableScanBase* pTableSca
|
||||||
size_t size = taosArrayGetSize(pBlock->pDataBlock);
|
size_t size = taosArrayGetSize(pBlock->pDataBlock);
|
||||||
bool keep = false;
|
bool keep = false;
|
||||||
code = doFilterByBlockSMA(pOperator->exprSupp.pFilterInfo, pBlock->pBlockAgg, size, pBlockInfo->rows, &keep);
|
code = doFilterByBlockSMA(pOperator->exprSupp.pFilterInfo, pBlock->pBlockAgg, size, pBlockInfo->rows, &keep);
|
||||||
|
if (code) {
|
||||||
|
pAPI->tsdReader.tsdReaderReleaseDataBlock(pTableScanInfo->dataReader);
|
||||||
|
qError("%s failed to do filter by block sma, code:%s", GET_TASKID(pTaskInfo), tstrerror(code));
|
||||||
QUERY_CHECK_CODE(code, lino, _end);
|
QUERY_CHECK_CODE(code, lino, _end);
|
||||||
|
}
|
||||||
|
|
||||||
if (!keep) {
|
if (!keep) {
|
||||||
qDebug("%s data block filter out by block SMA, brange:%" PRId64 "-%" PRId64 ", rows:%" PRId64,
|
qDebug("%s data block filter out by block SMA, brange:%" PRId64 "-%" PRId64 ", rows:%" PRId64,
|
||||||
|
@ -640,6 +644,7 @@ int32_t addTagPseudoColumnData(SReadHandle* pHandle, const SExprInfo* pExpr, int
|
||||||
h = taosLRUCacheLookup(pCache->pTableMetaEntryCache, &pBlock->info.id.uid, sizeof(pBlock->info.id.uid));
|
h = taosLRUCacheLookup(pCache->pTableMetaEntryCache, &pBlock->info.id.uid, sizeof(pBlock->info.id.uid));
|
||||||
if (h == NULL) {
|
if (h == NULL) {
|
||||||
pHandle->api.metaReaderFn.initReader(&mr, pHandle->vnode, META_READER_LOCK, &pHandle->api.metaFn);
|
pHandle->api.metaReaderFn.initReader(&mr, pHandle->vnode, META_READER_LOCK, &pHandle->api.metaFn);
|
||||||
|
freeReader = true;
|
||||||
code = pHandle->api.metaReaderFn.getEntryGetUidCache(&mr, pBlock->info.id.uid);
|
code = pHandle->api.metaReaderFn.getEntryGetUidCache(&mr, pBlock->info.id.uid);
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
if (code == TSDB_CODE_PAR_TABLE_NOT_EXIST) {
|
if (code == TSDB_CODE_PAR_TABLE_NOT_EXIST) {
|
||||||
|
@ -661,7 +666,6 @@ int32_t addTagPseudoColumnData(SReadHandle* pHandle, const SExprInfo* pExpr, int
|
||||||
QUERY_CHECK_CODE(code, lino, _end);
|
QUERY_CHECK_CODE(code, lino, _end);
|
||||||
|
|
||||||
val = *pVal;
|
val = *pVal;
|
||||||
freeReader = true;
|
|
||||||
} else {
|
} else {
|
||||||
pCache->cacheHit += 1;
|
pCache->cacheHit += 1;
|
||||||
STableCachedVal* pVal = taosLRUCacheValue(pCache->pTableMetaEntryCache, h);
|
STableCachedVal* pVal = taosLRUCacheValue(pCache->pTableMetaEntryCache, h);
|
||||||
|
@ -1001,30 +1005,30 @@ _end:
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
static SSDataBlock* doTableScanImpl(SOperatorInfo* pOperator) {
|
static int32_t doGroupedTableScan(SOperatorInfo* pOperator, SSDataBlock** pBlock) {
|
||||||
SSDataBlock* pRes = NULL;
|
|
||||||
int32_t code = doTableScanImplNext(pOperator, &pRes);
|
|
||||||
return pRes;
|
|
||||||
}
|
|
||||||
|
|
||||||
static SSDataBlock* doGroupedTableScan(SOperatorInfo* pOperator) {
|
|
||||||
int32_t code = TSDB_CODE_SUCCESS;
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
int32_t lino = 0;
|
int32_t lino = 0;
|
||||||
STableScanInfo* pTableScanInfo = pOperator->info;
|
STableScanInfo* pTableScanInfo = pOperator->info;
|
||||||
SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
|
SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
|
||||||
SStorageAPI* pAPI = &pTaskInfo->storageAPI;
|
SStorageAPI* pAPI = &pTaskInfo->storageAPI;
|
||||||
|
|
||||||
|
QRY_OPTR_CHECK(pBlock);
|
||||||
|
|
||||||
// The read handle is not initialized yet, since no qualified tables exists
|
// The read handle is not initialized yet, since no qualified tables exists
|
||||||
if (pTableScanInfo->base.dataReader == NULL || pOperator->status == OP_EXEC_DONE) {
|
if (pTableScanInfo->base.dataReader == NULL || pOperator->status == OP_EXEC_DONE) {
|
||||||
return NULL;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
// do the ascending order traverse in the first place.
|
// do the ascending order traverse in the first place.
|
||||||
while (pTableScanInfo->scanTimes < pTableScanInfo->scanInfo.numOfAsc) {
|
while (pTableScanInfo->scanTimes < pTableScanInfo->scanInfo.numOfAsc) {
|
||||||
SSDataBlock* p = doTableScanImpl(pOperator);
|
SSDataBlock* p = NULL;
|
||||||
|
code = doTableScanImplNext(pOperator, &p);
|
||||||
|
QUERY_CHECK_CODE(code, lino, _end);
|
||||||
|
|
||||||
if (p != NULL) {
|
if (p != NULL) {
|
||||||
markGroupProcessed(pTableScanInfo, p->info.id.groupId);
|
markGroupProcessed(pTableScanInfo, p->info.id.groupId);
|
||||||
return p;
|
*pBlock = p;
|
||||||
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
pTableScanInfo->scanTimes += 1;
|
pTableScanInfo->scanTimes += 1;
|
||||||
|
@ -1052,10 +1056,14 @@ static SSDataBlock* doGroupedTableScan(SOperatorInfo* pOperator) {
|
||||||
}
|
}
|
||||||
|
|
||||||
while (pTableScanInfo->scanTimes < total) {
|
while (pTableScanInfo->scanTimes < total) {
|
||||||
SSDataBlock* p = doTableScanImpl(pOperator);
|
SSDataBlock* p = NULL;
|
||||||
|
code = doTableScanImplNext(pOperator, &p);
|
||||||
|
QUERY_CHECK_CODE(code, lino, _end);
|
||||||
|
|
||||||
if (p != NULL) {
|
if (p != NULL) {
|
||||||
markGroupProcessed(pTableScanInfo, p->info.id.groupId);
|
markGroupProcessed(pTableScanInfo, p->info.id.groupId);
|
||||||
return p;
|
*pBlock = p;
|
||||||
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
pTableScanInfo->scanTimes += 1;
|
pTableScanInfo->scanTimes += 1;
|
||||||
|
@ -1079,8 +1087,13 @@ static SSDataBlock* doGroupedTableScan(SOperatorInfo* pOperator) {
|
||||||
pTableScanInfo->countState = TABLE_COUNT_STATE_PROCESSED;
|
pTableScanInfo->countState = TABLE_COUNT_STATE_PROCESSED;
|
||||||
STableKeyInfo* pStart =
|
STableKeyInfo* pStart =
|
||||||
(STableKeyInfo*)tableListGetInfo(pTableScanInfo->base.pTableListInfo, pTableScanInfo->tableStartIndex);
|
(STableKeyInfo*)tableListGetInfo(pTableScanInfo->base.pTableListInfo, pTableScanInfo->tableStartIndex);
|
||||||
if (NULL == pStart) return NULL;
|
|
||||||
return getBlockForEmptyTable(pOperator, pStart);
|
if (NULL == pStart) {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
*pBlock = getBlockForEmptyTable(pOperator, pStart);
|
||||||
|
return code;
|
||||||
}
|
}
|
||||||
} else { // group by tag + no sort
|
} else { // group by tag + no sort
|
||||||
int32_t numOfTables = 0;
|
int32_t numOfTables = 0;
|
||||||
|
@ -1096,7 +1109,9 @@ static SSDataBlock* doGroupedTableScan(SOperatorInfo* pOperator) {
|
||||||
STableKeyInfo info = {.uid = *(uint64_t*)pIte, .groupId = *pGroupId};
|
STableKeyInfo info = {.uid = *(uint64_t*)pIte, .groupId = *pGroupId};
|
||||||
taosHashCancelIterate(pTableListInfo->remainGroups, pIte);
|
taosHashCancelIterate(pTableListInfo->remainGroups, pIte);
|
||||||
markGroupProcessed(pTableScanInfo, *pGroupId);
|
markGroupProcessed(pTableScanInfo, *pGroupId);
|
||||||
return getBlockForEmptyTable(pOperator, &info);
|
*pBlock = getBlockForEmptyTable(pOperator, &info);
|
||||||
|
|
||||||
|
return code;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1107,9 +1122,9 @@ _end:
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
qError("%s failed at line %d since %s", __func__, lino, tstrerror(code));
|
qError("%s failed at line %d since %s", __func__, lino, tstrerror(code));
|
||||||
pTaskInfo->code = code;
|
pTaskInfo->code = code;
|
||||||
T_LONG_JMP(pTaskInfo->env, code);
|
|
||||||
}
|
}
|
||||||
return NULL;
|
|
||||||
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t createTableListInfoFromParam(SOperatorInfo* pOperator) {
|
static int32_t createTableListInfoFromParam(SOperatorInfo* pOperator) {
|
||||||
|
@ -1169,13 +1184,16 @@ static int32_t createTableListInfoFromParam(SOperatorInfo* pOperator) {
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
static SSDataBlock* startNextGroupScan(SOperatorInfo* pOperator) {
|
static int32_t startNextGroupScan(SOperatorInfo* pOperator, SSDataBlock** pResult) {
|
||||||
int32_t code = TSDB_CODE_SUCCESS;
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
int32_t lino = 0;
|
int32_t lino = 0;
|
||||||
STableScanInfo* pInfo = pOperator->info;
|
STableScanInfo* pInfo = pOperator->info;
|
||||||
SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
|
SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
|
||||||
SStorageAPI* pAPI = &pTaskInfo->storageAPI;
|
SStorageAPI* pAPI = &pTaskInfo->storageAPI;
|
||||||
int32_t numOfTables = 0;
|
int32_t numOfTables = 0;
|
||||||
|
|
||||||
|
QRY_OPTR_CHECK(pResult);
|
||||||
|
|
||||||
code = tableListGetSize(pInfo->base.pTableListInfo, &numOfTables);
|
code = tableListGetSize(pInfo->base.pTableListInfo, &numOfTables);
|
||||||
QUERY_CHECK_CODE(code, lino, _end);
|
QUERY_CHECK_CODE(code, lino, _end);
|
||||||
|
|
||||||
|
@ -1185,7 +1203,7 @@ static SSDataBlock* startNextGroupScan(SOperatorInfo* pOperator) {
|
||||||
taosArrayClear(pInfo->base.pTableListInfo->pTableList);
|
taosArrayClear(pInfo->base.pTableListInfo->pTableList);
|
||||||
taosHashClear(pInfo->base.pTableListInfo->map);
|
taosHashClear(pInfo->base.pTableListInfo->map);
|
||||||
}
|
}
|
||||||
return NULL;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
// reset value for the next group data output
|
// reset value for the next group data output
|
||||||
|
@ -1204,21 +1222,22 @@ static SSDataBlock* startNextGroupScan(SOperatorInfo* pOperator) {
|
||||||
QUERY_CHECK_CODE(code, lino, _end);
|
QUERY_CHECK_CODE(code, lino, _end);
|
||||||
pInfo->scanTimes = 0;
|
pInfo->scanTimes = 0;
|
||||||
|
|
||||||
SSDataBlock* result = doGroupedTableScan(pOperator);
|
code = doGroupedTableScan(pOperator, pResult);
|
||||||
if (result != NULL) {
|
QUERY_CHECK_CODE(code, lino, _end);
|
||||||
|
|
||||||
|
if (*pResult != NULL) {
|
||||||
if (pOperator->dynamicTask) {
|
if (pOperator->dynamicTask) {
|
||||||
result->info.id.groupId = result->info.id.uid;
|
(*pResult)->info.id.groupId = (*pResult)->info.id.uid;
|
||||||
}
|
}
|
||||||
return result;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
_end:
|
_end:
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
qError("%s failed at line %d since %s", __func__, lino, tstrerror(code));
|
qError("%s failed at line %d since %s", __func__, lino, tstrerror(code));
|
||||||
pTaskInfo->code = code;
|
pTaskInfo->code = code;
|
||||||
T_LONG_JMP(pTaskInfo->env, code);
|
|
||||||
}
|
}
|
||||||
return NULL;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
static SSDataBlock* groupSeqTableScan(SOperatorInfo* pOperator) {
|
static SSDataBlock* groupSeqTableScan(SOperatorInfo* pOperator) {
|
||||||
|
@ -1257,7 +1276,10 @@ static SSDataBlock* groupSeqTableScan(SOperatorInfo* pOperator) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
result = doGroupedTableScan(pOperator);
|
result = NULL;
|
||||||
|
code = doGroupedTableScan(pOperator, &result);
|
||||||
|
QUERY_CHECK_CODE(code, lino, _end);
|
||||||
|
|
||||||
if (result != NULL) {
|
if (result != NULL) {
|
||||||
if (pOperator->dynamicTask) {
|
if (pOperator->dynamicTask) {
|
||||||
result->info.id.groupId = result->info.id.uid;
|
result->info.id.groupId = result->info.id.uid;
|
||||||
|
@ -1266,7 +1288,9 @@ static SSDataBlock* groupSeqTableScan(SOperatorInfo* pOperator) {
|
||||||
}
|
}
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
result = startNextGroupScan(pOperator);
|
code = startNextGroupScan(pOperator, &result);
|
||||||
|
QUERY_CHECK_CODE(code, lino, _end);
|
||||||
|
|
||||||
if (result || pOperator->status == OP_EXEC_DONE) {
|
if (result || pOperator->status == OP_EXEC_DONE) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -1287,6 +1311,7 @@ static int32_t doTableScanNext(SOperatorInfo* pOperator, SSDataBlock** ppRes) {
|
||||||
STableScanInfo* pInfo = pOperator->info;
|
STableScanInfo* pInfo = pOperator->info;
|
||||||
SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
|
SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
|
||||||
SStorageAPI* pAPI = &pTaskInfo->storageAPI;
|
SStorageAPI* pAPI = &pTaskInfo->storageAPI;
|
||||||
|
QRY_OPTR_CHECK(ppRes);
|
||||||
|
|
||||||
if (pOperator->pOperatorGetParam) {
|
if (pOperator->pOperatorGetParam) {
|
||||||
pOperator->dynamicTask = true;
|
pOperator->dynamicTask = true;
|
||||||
|
@ -1299,8 +1324,11 @@ static int32_t doTableScanNext(SOperatorInfo* pOperator, SSDataBlock** ppRes) {
|
||||||
pInfo->currentGroupId = -1;
|
pInfo->currentGroupId = -1;
|
||||||
pOperator->status = OP_OPENED;
|
pOperator->status = OP_OPENED;
|
||||||
SSDataBlock* result = NULL;
|
SSDataBlock* result = NULL;
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
result = startNextGroupScan(pOperator);
|
code = startNextGroupScan(pOperator, &result);
|
||||||
|
QUERY_CHECK_CODE(code, lino, _end);
|
||||||
|
|
||||||
if (result || pOperator->status == OP_EXEC_DONE) {
|
if (result || pOperator->status == OP_EXEC_DONE) {
|
||||||
(*ppRes) = result;
|
(*ppRes) = result;
|
||||||
return code;
|
return code;
|
||||||
|
@ -1316,7 +1344,10 @@ static int32_t doTableScanNext(SOperatorInfo* pOperator, SSDataBlock** ppRes) {
|
||||||
pInfo->countState = TABLE_COUNT_STATE_END;
|
pInfo->countState = TABLE_COUNT_STATE_END;
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
SSDataBlock* result = doGroupedTableScan(pOperator);
|
SSDataBlock* result = NULL;
|
||||||
|
code = doGroupedTableScan(pOperator, &result);
|
||||||
|
QUERY_CHECK_CODE(code, lino, _end);
|
||||||
|
|
||||||
if (result || (pOperator->status == OP_EXEC_DONE) || isTaskKilled(pTaskInfo)) {
|
if (result || (pOperator->status == OP_EXEC_DONE) || isTaskKilled(pTaskInfo)) {
|
||||||
(*ppRes) = result;
|
(*ppRes) = result;
|
||||||
return code;
|
return code;
|
||||||
|
@ -1340,6 +1371,7 @@ static int32_t doTableScanNext(SOperatorInfo* pOperator, SSDataBlock** ppRes) {
|
||||||
(*ppRes) = NULL;
|
(*ppRes) = NULL;
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
STableKeyInfo* tmp = (STableKeyInfo*)tableListGetInfo(pInfo->base.pTableListInfo, pInfo->currentTable);
|
STableKeyInfo* tmp = (STableKeyInfo*)tableListGetInfo(pInfo->base.pTableListInfo, pInfo->currentTable);
|
||||||
if (!tmp) {
|
if (!tmp) {
|
||||||
qError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(terrno));
|
qError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(terrno));
|
||||||
|
@ -1368,16 +1400,9 @@ _end:
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
qError("%s failed at line %d since %s", __func__, lino, tstrerror(code));
|
qError("%s failed at line %d since %s", __func__, lino, tstrerror(code));
|
||||||
pTaskInfo->code = code;
|
pTaskInfo->code = code;
|
||||||
T_LONG_JMP(pTaskInfo->env, code);
|
|
||||||
}
|
}
|
||||||
(*ppRes) = NULL;
|
|
||||||
return code;
|
|
||||||
}
|
|
||||||
|
|
||||||
static SSDataBlock* doTableScan(SOperatorInfo* pOperator) {
|
return code;
|
||||||
SSDataBlock* pRes = NULL;
|
|
||||||
int32_t code = doTableScanNext(pOperator, &pRes);
|
|
||||||
return pRes;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t getTableScannerExecInfo(struct SOperatorInfo* pOptr, void** pOptrExplain, uint32_t* len) {
|
static int32_t getTableScannerExecInfo(struct SOperatorInfo* pOptr, void** pOptrExplain, uint32_t* len) {
|
||||||
|
@ -1497,7 +1522,7 @@ int32_t createTableScanOperatorInfo(STableScanPhysiNode* pTableScanNode, SReadHa
|
||||||
pInfo->filesetDelimited = pTableScanNode->filesetDelimited;
|
pInfo->filesetDelimited = pTableScanNode->filesetDelimited;
|
||||||
|
|
||||||
taosLRUCacheSetStrictCapacity(pInfo->base.metaCache.pTableMetaEntryCache, false);
|
taosLRUCacheSetStrictCapacity(pInfo->base.metaCache.pTableMetaEntryCache, false);
|
||||||
pOperator->fpSet = createOperatorFpSet(optrDummyOpenFn, doTableScan, NULL, destroyTableScanOperatorInfo,
|
pOperator->fpSet = createOperatorFpSet(optrDummyOpenFn, doTableScanNext, NULL, destroyTableScanOperatorInfo,
|
||||||
optrDefaultBufFn, getTableScannerExecInfo, optrDefaultGetNextExtFn, NULL);
|
optrDefaultBufFn, getTableScannerExecInfo, optrDefaultGetNextExtFn, NULL);
|
||||||
|
|
||||||
// for non-blocking operator, the open cost is always 0
|
// for non-blocking operator, the open cost is always 0
|
||||||
|
@ -1535,7 +1560,7 @@ int32_t createTableSeqScanOperatorInfo(void* pReadHandle, SExecTaskInfo* pTaskIn
|
||||||
|
|
||||||
setOperatorInfo(pOperator, "TableSeqScanOperator", QUERY_NODE_PHYSICAL_PLAN_TABLE_SEQ_SCAN, false, OP_NOT_OPENED,
|
setOperatorInfo(pOperator, "TableSeqScanOperator", QUERY_NODE_PHYSICAL_PLAN_TABLE_SEQ_SCAN, false, OP_NOT_OPENED,
|
||||||
pInfo, pTaskInfo);
|
pInfo, pTaskInfo);
|
||||||
pOperator->fpSet = createOperatorFpSet(optrDummyOpenFn, doTableScanImpl, NULL, NULL, optrDefaultBufFn, NULL,
|
pOperator->fpSet = createOperatorFpSet(optrDummyOpenFn, doTableScanImplNext, NULL, NULL, optrDefaultBufFn, NULL,
|
||||||
optrDefaultGetNextExtFn, NULL);
|
optrDefaultGetNextExtFn, NULL);
|
||||||
*pOptrInfo = pOperator;
|
*pOptrInfo = pOperator;
|
||||||
return code;
|
return code;
|
||||||
|
@ -1832,18 +1857,23 @@ static STimeWindow getSlidingWindow(TSKEY* startTsCol, TSKEY* endTsCol, uint64_t
|
||||||
static int32_t doRangeScan(SStreamScanInfo* pInfo, SSDataBlock* pSDB, int32_t tsColIndex, int32_t* pRowIndex,
|
static int32_t doRangeScan(SStreamScanInfo* pInfo, SSDataBlock* pSDB, int32_t tsColIndex, int32_t* pRowIndex,
|
||||||
SSDataBlock** ppRes) {
|
SSDataBlock** ppRes) {
|
||||||
qDebug("do stream range scan. windows index:%d", *pRowIndex);
|
qDebug("do stream range scan. windows index:%d", *pRowIndex);
|
||||||
|
|
||||||
int32_t code = TSDB_CODE_SUCCESS;
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
int32_t lino = 0;
|
int32_t lino = 0;
|
||||||
bool prepareRes = true;
|
bool prepareRes = true;
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
SSDataBlock* pResult = NULL;
|
SSDataBlock* pResult = NULL;
|
||||||
pResult = doTableScan(pInfo->pTableScanOp);
|
code = doTableScanNext(pInfo->pTableScanOp, &pResult);
|
||||||
|
QUERY_CHECK_CODE(code, lino, _end);
|
||||||
|
|
||||||
if (!pResult) {
|
if (!pResult) {
|
||||||
prepareRangeScan(pInfo, pSDB, pRowIndex, &prepareRes);
|
prepareRangeScan(pInfo, pSDB, pRowIndex, &prepareRes);
|
||||||
// scan next window data
|
// scan next window data
|
||||||
pResult = doTableScan(pInfo->pTableScanOp);
|
code = doTableScanNext(pInfo->pTableScanOp, &pResult);
|
||||||
|
QUERY_CHECK_CODE(code, lino, _end);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!pResult) {
|
if (!pResult) {
|
||||||
if (prepareRes) {
|
if (prepareRes) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -2891,7 +2921,9 @@ static int32_t doQueueScanNext(SOperatorInfo* pOperator, SSDataBlock** ppRes) {
|
||||||
|
|
||||||
if (pTaskInfo->streamInfo.currentOffset.type == TMQ_OFFSET__SNAPSHOT_DATA) {
|
if (pTaskInfo->streamInfo.currentOffset.type == TMQ_OFFSET__SNAPSHOT_DATA) {
|
||||||
while (1) {
|
while (1) {
|
||||||
SSDataBlock* pResult = doTableScan(pInfo->pTableScanOp);
|
SSDataBlock* pResult = NULL;
|
||||||
|
code = doTableScanNext(pInfo->pTableScanOp, &pResult);
|
||||||
|
QUERY_CHECK_CODE(code, lino, _end);
|
||||||
|
|
||||||
if (pResult && pResult->info.rows > 0) {
|
if (pResult && pResult->info.rows > 0) {
|
||||||
bool hasPrimaryKey = pAPI->tqReaderFn.tqGetTablePrimaryKey(pInfo->tqReader);
|
bool hasPrimaryKey = pAPI->tqReaderFn.tqGetTablePrimaryKey(pInfo->tqReader);
|
||||||
|
@ -3231,7 +3263,9 @@ static int32_t doStreamScanNext(SOperatorInfo* pOperator, SSDataBlock** ppRes) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
pInfo->pRecoverRes = doTableScan(pInfo->pTableScanOp);
|
code = doTableScanNext(pInfo->pTableScanOp, &pInfo->pRecoverRes);
|
||||||
|
QUERY_CHECK_CODE(code, lino, _end);
|
||||||
|
|
||||||
if (pInfo->pRecoverRes != NULL) {
|
if (pInfo->pRecoverRes != NULL) {
|
||||||
code = calBlockTbName(pInfo, pInfo->pRecoverRes, 0);
|
code = calBlockTbName(pInfo, pInfo->pRecoverRes, 0);
|
||||||
QUERY_CHECK_CODE(code, lino, _end);
|
QUERY_CHECK_CODE(code, lino, _end);
|
||||||
|
@ -3784,12 +3818,6 @@ _end:
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
static SSDataBlock* doRawScan(SOperatorInfo* pOperator) {
|
|
||||||
SSDataBlock* pRes = NULL;
|
|
||||||
int32_t code = doRawScanNext(pOperator, &pRes);
|
|
||||||
return pRes;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void destroyRawScanOperatorInfo(void* param) {
|
static void destroyRawScanOperatorInfo(void* param) {
|
||||||
SStreamRawScanInfo* pRawScan = (SStreamRawScanInfo*)param;
|
SStreamRawScanInfo* pRawScan = (SStreamRawScanInfo*)param;
|
||||||
pRawScan->pAPI->tsdReader.tsdReaderClose(pRawScan->dataReader);
|
pRawScan->pAPI->tsdReader.tsdReaderClose(pRawScan->dataReader);
|
||||||
|
@ -3828,7 +3856,7 @@ int32_t createRawScanOperatorInfo(SReadHandle* pHandle, SExecTaskInfo* pTaskInfo
|
||||||
setOperatorInfo(pOperator, "RawScanOperator", QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN, false, OP_NOT_OPENED, pInfo,
|
setOperatorInfo(pOperator, "RawScanOperator", QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN, false, OP_NOT_OPENED, pInfo,
|
||||||
pTaskInfo);
|
pTaskInfo);
|
||||||
|
|
||||||
pOperator->fpSet = createOperatorFpSet(NULL, doRawScan, NULL, destroyRawScanOperatorInfo, optrDefaultBufFn, NULL,
|
pOperator->fpSet = createOperatorFpSet(NULL, doRawScanNext, NULL, destroyRawScanOperatorInfo, optrDefaultBufFn, NULL,
|
||||||
optrDefaultGetNextExtFn, NULL);
|
optrDefaultGetNextExtFn, NULL);
|
||||||
*pOptrInfo = pOperator;
|
*pOptrInfo = pOperator;
|
||||||
return code;
|
return code;
|
||||||
|
@ -4207,7 +4235,7 @@ int32_t createStreamScanOperatorInfo(SReadHandle* pHandle, STableScanPhysiNode*
|
||||||
pTaskInfo);
|
pTaskInfo);
|
||||||
pOperator->exprSupp.numOfExprs = taosArrayGetSize(pInfo->pRes->pDataBlock);
|
pOperator->exprSupp.numOfExprs = taosArrayGetSize(pInfo->pRes->pDataBlock);
|
||||||
|
|
||||||
__optr_fn_t nextFn = (pTaskInfo->execModel == OPTR_EXEC_MODEL_STREAM) ? doStreamScan : doQueueScan;
|
__optr_fn_t nextFn = (pTaskInfo->execModel == OPTR_EXEC_MODEL_STREAM) ? doStreamScanNext : doQueueScanNext;
|
||||||
pOperator->fpSet = createOperatorFpSet(optrDummyOpenFn, nextFn, NULL, destroyStreamScanOperatorInfo, optrDefaultBufFn,
|
pOperator->fpSet = createOperatorFpSet(optrDummyOpenFn, nextFn, NULL, destroyStreamScanOperatorInfo, optrDefaultBufFn,
|
||||||
NULL, optrDefaultGetNextExtFn, NULL);
|
NULL, optrDefaultGetNextExtFn, NULL);
|
||||||
setOperatorStreamStateFn(pOperator, streamScanReleaseState, streamScanReloadState);
|
setOperatorStreamStateFn(pOperator, streamScanReleaseState, streamScanReloadState);
|
||||||
|
@ -4779,7 +4807,7 @@ int32_t createTagScanOperatorInfo(SReadHandle* pReadHandle, STagScanPhysiNode* p
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//TODO wjm check pInfo->filterCtx.code
|
//TODO wjm check pInfo->filterCtx.code
|
||||||
__optr_fn_t tagScanNextFn = (pTagScanNode->onlyMetaCtbIdx) ? doTagScanFromCtbIdx : doTagScanFromMetaEntry;
|
__optr_fn_t tagScanNextFn = (pTagScanNode->onlyMetaCtbIdx) ? doTagScanFromCtbIdxNext : doTagScanFromMetaEntryNext;
|
||||||
pOperator->fpSet = createOperatorFpSet(optrDummyOpenFn, tagScanNextFn, NULL, destroyTagScanOperatorInfo,
|
pOperator->fpSet = createOperatorFpSet(optrDummyOpenFn, tagScanNextFn, NULL, destroyTagScanOperatorInfo,
|
||||||
optrDefaultBufFn, NULL, optrDefaultGetNextExtFn, NULL);
|
optrDefaultBufFn, NULL, optrDefaultGetNextExtFn, NULL);
|
||||||
*pOptrInfo = pOperator;
|
*pOptrInfo = pOperator;
|
||||||
|
@ -6044,7 +6072,7 @@ int32_t createTableMergeScanOperatorInfo(STableScanPhysiNode* pTableScanNode, SR
|
||||||
pOperator->exprSupp.numOfExprs = numOfCols;
|
pOperator->exprSupp.numOfExprs = numOfCols;
|
||||||
|
|
||||||
pOperator->fpSet = createOperatorFpSet(
|
pOperator->fpSet = createOperatorFpSet(
|
||||||
optrDummyOpenFn, pTableScanNode->paraTablesSort ? doTableMergeScanParaSubTables : doTableMergeScan, NULL,
|
optrDummyOpenFn, pTableScanNode->paraTablesSort ? doTableMergeScanParaSubTablesNext : doTableMergeScanNext, NULL,
|
||||||
destroyTableMergeScanOperatorInfo, optrDefaultBufFn, getTableMergeScanExplainExecInfo, optrDefaultGetNextExtFn,
|
destroyTableMergeScanOperatorInfo, optrDefaultBufFn, getTableMergeScanExplainExecInfo, optrDefaultGetNextExtFn,
|
||||||
NULL);
|
NULL);
|
||||||
pOperator->cost.openCost = 0;
|
pOperator->cost.openCost = 0;
|
||||||
|
@ -6070,7 +6098,6 @@ _error:
|
||||||
|
|
||||||
// ====================================================================================================================
|
// ====================================================================================================================
|
||||||
// TableCountScanOperator
|
// TableCountScanOperator
|
||||||
static SSDataBlock* doTableCountScan(SOperatorInfo* pOperator);
|
|
||||||
static void destoryTableCountScanOperator(void* param);
|
static void destoryTableCountScanOperator(void* param);
|
||||||
static int32_t buildVnodeGroupedStbTableCount(STableCountScanOperatorInfo* pInfo, STableCountScanSupp* pSupp,
|
static int32_t buildVnodeGroupedStbTableCount(STableCountScanOperatorInfo* pInfo, STableCountScanSupp* pSupp,
|
||||||
SSDataBlock* pRes, char* dbName, tb_uid_t stbUid, SStorageAPI* pAPI);
|
SSDataBlock* pRes, char* dbName, tb_uid_t stbUid, SStorageAPI* pAPI);
|
||||||
|
@ -6212,7 +6239,7 @@ int32_t createTableCountScanOperatorInfo(SReadHandle* readHandle, STableCountSca
|
||||||
|
|
||||||
setOperatorInfo(pOperator, "TableCountScanOperator", QUERY_NODE_PHYSICAL_PLAN_TABLE_COUNT_SCAN, false, OP_NOT_OPENED,
|
setOperatorInfo(pOperator, "TableCountScanOperator", QUERY_NODE_PHYSICAL_PLAN_TABLE_COUNT_SCAN, false, OP_NOT_OPENED,
|
||||||
pInfo, pTaskInfo);
|
pInfo, pTaskInfo);
|
||||||
pOperator->fpSet = createOperatorFpSet(optrDummyOpenFn, doTableCountScan, NULL, destoryTableCountScanOperator,
|
pOperator->fpSet = createOperatorFpSet(optrDummyOpenFn, doTableCountScanNext, NULL, destoryTableCountScanOperator,
|
||||||
optrDefaultBufFn, NULL, optrDefaultGetNextExtFn, NULL);
|
optrDefaultBufFn, NULL, optrDefaultGetNextExtFn, NULL);
|
||||||
*pOptrInfo = pOperator;
|
*pOptrInfo = pOperator;
|
||||||
return code;
|
return code;
|
||||||
|
@ -6381,12 +6408,6 @@ static int32_t doTableCountScanNext(SOperatorInfo* pOperator, SSDataBlock** ppRe
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
static SSDataBlock* doTableCountScan(SOperatorInfo* pOperator) {
|
|
||||||
SSDataBlock* pRes = NULL;
|
|
||||||
int32_t code = doTableCountScanNext(pOperator, &pRes);
|
|
||||||
return pRes;
|
|
||||||
}
|
|
||||||
|
|
||||||
static SSDataBlock* buildVnodeDbTableCount(SOperatorInfo* pOperator, STableCountScanOperatorInfo* pInfo,
|
static SSDataBlock* buildVnodeDbTableCount(SOperatorInfo* pOperator, STableCountScanOperatorInfo* pInfo,
|
||||||
STableCountScanSupp* pSupp, SSDataBlock* pRes) {
|
STableCountScanSupp* pSupp, SSDataBlock* pRes) {
|
||||||
int32_t code = TSDB_CODE_SUCCESS;
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
|
@ -6502,8 +6523,8 @@ static void buildVnodeFilteredTbCount(SOperatorInfo* pOperator, STableCountScanO
|
||||||
_end:
|
_end:
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
pTaskInfo->code = code;
|
pTaskInfo->code = code;
|
||||||
T_LONG_JMP(pTaskInfo->env, code);
|
|
||||||
qError("%s failed at line %d since %s", __func__, lino, tstrerror(code));
|
qError("%s failed at line %d since %s", __func__, lino, tstrerror(code));
|
||||||
|
T_LONG_JMP(pTaskInfo->env, code);
|
||||||
}
|
}
|
||||||
setOperatorCompleted(pOperator);
|
setOperatorCompleted(pOperator);
|
||||||
}
|
}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue