Merge branch '3.0' into fix/syntax
This commit is contained in:
commit
eac324b271
|
@ -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);
|
||||||
|
|
|
@ -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)
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -965,7 +965,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);
|
||||||
|
@ -1174,7 +1174,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,
|
||||||
|
@ -1208,7 +1208,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;
|
||||||
|
@ -1229,7 +1229,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));
|
||||||
|
|
|
@ -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));
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -1132,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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1083,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);
|
||||||
|
@ -3831,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) {
|
||||||
|
@ -3894,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);
|
||||||
|
@ -4591,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);
|
||||||
}
|
}
|
||||||
|
@ -4598,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;
|
||||||
|
@ -4620,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; }
|
||||||
|
|
|
@ -1319,7 +1319,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) {
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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};
|
||||||
|
@ -1970,6 +1971,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 +1981,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 +1996,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 +2012,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));
|
||||||
}
|
}
|
||||||
|
|
|
@ -227,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;
|
||||||
}
|
}
|
||||||
|
@ -420,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,
|
||||||
|
@ -641,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) {
|
||||||
|
@ -662,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);
|
||||||
|
@ -6520,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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1201,7 +1201,12 @@ static SStreamFillSupporter* initStreamFillSup(SStreamFillPhysiNode* pPhyFillNod
|
||||||
|
|
||||||
pFillSup->pAllColInfo = createFillColInfo(pFillExprInfo, pFillSup->numOfFillCols, noFillExprInfo, numOfNotFillCols,
|
pFillSup->pAllColInfo = createFillColInfo(pFillExprInfo, pFillSup->numOfFillCols, noFillExprInfo, numOfNotFillCols,
|
||||||
(const SNodeListNode*)(pPhyFillNode->pValues));
|
(const SNodeListNode*)(pPhyFillNode->pValues));
|
||||||
QUERY_CHECK_NULL(pFillSup->pAllColInfo, code, lino, _end, terrno);
|
if (pFillSup->pAllColInfo == NULL) {
|
||||||
|
code = terrno;
|
||||||
|
lino = __LINE__;
|
||||||
|
destroyExprInfo(noFillExprInfo, numOfNotFillCols);
|
||||||
|
goto _end;
|
||||||
|
}
|
||||||
|
|
||||||
pFillSup->type = convertFillType(pPhyFillNode->mode);
|
pFillSup->type = convertFillType(pPhyFillNode->mode);
|
||||||
pFillSup->numOfAllCols = pFillSup->numOfFillCols + numOfNotFillCols;
|
pFillSup->numOfAllCols = pFillSup->numOfFillCols + numOfNotFillCols;
|
||||||
|
|
|
@ -495,8 +495,11 @@ void destroyStreamFinalIntervalOperatorInfo(void* param) {
|
||||||
nodesDestroyNode((SNode*)pInfo->pPhyNode);
|
nodesDestroyNode((SNode*)pInfo->pPhyNode);
|
||||||
colDataDestroy(&pInfo->twAggSup.timeWindowData);
|
colDataDestroy(&pInfo->twAggSup.timeWindowData);
|
||||||
cleanupExprSupp(&pInfo->scalarSupp);
|
cleanupExprSupp(&pInfo->scalarSupp);
|
||||||
|
if (pInfo->pUpdatedMap != NULL) {
|
||||||
|
tSimpleHashSetFreeFp(pInfo->pUpdatedMap, destroyFlusedppPos);
|
||||||
tSimpleHashCleanup(pInfo->pUpdatedMap);
|
tSimpleHashCleanup(pInfo->pUpdatedMap);
|
||||||
pInfo->pUpdatedMap = NULL;
|
pInfo->pUpdatedMap = NULL;
|
||||||
|
}
|
||||||
tSimpleHashCleanup(pInfo->pDeletedMap);
|
tSimpleHashCleanup(pInfo->pDeletedMap);
|
||||||
|
|
||||||
blockDataDestroy(pInfo->pCheckpointRes);
|
blockDataDestroy(pInfo->pCheckpointRes);
|
||||||
|
|
|
@ -655,16 +655,20 @@ static SSDataBlock* sysTableScanUserCols(SOperatorInfo* pOperator) {
|
||||||
}
|
}
|
||||||
SSchemaWrapper* schemaWrapper = tCloneSSchemaWrapper(&smrSuperTable.me.stbEntry.schemaRow);
|
SSchemaWrapper* schemaWrapper = tCloneSSchemaWrapper(&smrSuperTable.me.stbEntry.schemaRow);
|
||||||
if (smrSuperTable.me.stbEntry.schemaRow.pSchema) {
|
if (smrSuperTable.me.stbEntry.schemaRow.pSchema) {
|
||||||
QUERY_CHECK_NULL(schemaWrapper, code, lino, _end, terrno);
|
if (schemaWrapper == NULL) {
|
||||||
|
code = terrno;
|
||||||
|
lino = __LINE__;
|
||||||
|
pAPI->metaReaderFn.clearReader(&smrSuperTable);
|
||||||
|
goto _end;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
code = taosHashPut(pInfo->pSchema, &suid, sizeof(int64_t), &schemaWrapper, POINTER_BYTES);
|
code = taosHashPut(pInfo->pSchema, &suid, sizeof(int64_t), &schemaWrapper, POINTER_BYTES);
|
||||||
if (code == TSDB_CODE_DUP_KEY) {
|
if (code == TSDB_CODE_DUP_KEY) {
|
||||||
code = TSDB_CODE_SUCCESS;
|
code = TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
QUERY_CHECK_CODE(code, lino, _end);
|
|
||||||
|
|
||||||
schemaRow = schemaWrapper;
|
schemaRow = schemaWrapper;
|
||||||
pAPI->metaReaderFn.clearReader(&smrSuperTable);
|
pAPI->metaReaderFn.clearReader(&smrSuperTable);
|
||||||
|
QUERY_CHECK_CODE(code, lino, _end);
|
||||||
}
|
}
|
||||||
} else if (pInfo->pCur->mr.me.type == TSDB_NORMAL_TABLE) {
|
} else if (pInfo->pCur->mr.me.type == TSDB_NORMAL_TABLE) {
|
||||||
qDebug("sysTableScanUserCols cursor get normal table, %s", GET_TASKID(pTaskInfo));
|
qDebug("sysTableScanUserCols cursor get normal table, %s", GET_TASKID(pTaskInfo));
|
||||||
|
@ -789,11 +793,12 @@ static SSDataBlock* sysTableScanUserTags(SOperatorInfo* pOperator) {
|
||||||
|
|
||||||
code = sysTableUserTagsFillOneTableTags(pInfo, &smrSuperTable, &smrChildTable, dbname, tableName, &numOfRows,
|
code = sysTableUserTagsFillOneTableTags(pInfo, &smrSuperTable, &smrChildTable, dbname, tableName, &numOfRows,
|
||||||
dataBlock);
|
dataBlock);
|
||||||
QUERY_CHECK_CODE(code, lino, _end);
|
|
||||||
|
|
||||||
pAPI->metaReaderFn.clearReader(&smrSuperTable);
|
pAPI->metaReaderFn.clearReader(&smrSuperTable);
|
||||||
pAPI->metaReaderFn.clearReader(&smrChildTable);
|
pAPI->metaReaderFn.clearReader(&smrChildTable);
|
||||||
|
|
||||||
|
QUERY_CHECK_CODE(code, lino, _end);
|
||||||
|
|
||||||
if (numOfRows > 0) {
|
if (numOfRows > 0) {
|
||||||
relocateAndFilterSysTagsScanResult(pInfo, numOfRows, dataBlock, pOperator->exprSupp.pFilterInfo, pTaskInfo);
|
relocateAndFilterSysTagsScanResult(pInfo, numOfRows, dataBlock, pOperator->exprSupp.pFilterInfo, pTaskInfo);
|
||||||
numOfRows = 0;
|
numOfRows = 0;
|
||||||
|
@ -831,6 +836,8 @@ static SSDataBlock* sysTableScanUserTags(SOperatorInfo* pOperator) {
|
||||||
pAPI->metaReaderFn.clearReader(&smrSuperTable);
|
pAPI->metaReaderFn.clearReader(&smrSuperTable);
|
||||||
pAPI->metaFn.closeTableMetaCursor(pInfo->pCur);
|
pAPI->metaFn.closeTableMetaCursor(pInfo->pCur);
|
||||||
pInfo->pCur = NULL;
|
pInfo->pCur = NULL;
|
||||||
|
blockDataDestroy(dataBlock);
|
||||||
|
dataBlock = NULL;
|
||||||
T_LONG_JMP(pTaskInfo->env, terrno);
|
T_LONG_JMP(pTaskInfo->env, terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -846,7 +853,15 @@ static SSDataBlock* sysTableScanUserTags(SOperatorInfo* pOperator) {
|
||||||
} else {
|
} else {
|
||||||
code = sysTableUserTagsFillOneTableTags(pInfo, &smrSuperTable, &pInfo->pCur->mr, dbname, tableName, &numOfRows,
|
code = sysTableUserTagsFillOneTableTags(pInfo, &smrSuperTable, &pInfo->pCur->mr, dbname, tableName, &numOfRows,
|
||||||
dataBlock);
|
dataBlock);
|
||||||
QUERY_CHECK_CODE(code, lino, _end);
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
|
qError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(code));
|
||||||
|
pAPI->metaReaderFn.clearReader(&smrSuperTable);
|
||||||
|
pAPI->metaFn.closeTableMetaCursor(pInfo->pCur);
|
||||||
|
pInfo->pCur = NULL;
|
||||||
|
blockDataDestroy(dataBlock);
|
||||||
|
dataBlock = NULL;
|
||||||
|
T_LONG_JMP(pTaskInfo->env, terrno);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
pAPI->metaReaderFn.clearReader(&smrSuperTable);
|
pAPI->metaReaderFn.clearReader(&smrSuperTable);
|
||||||
}
|
}
|
||||||
|
@ -1354,6 +1369,171 @@ _end:
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int32_t doSetUserTableMetaInfo(SStoreMetaReader* pMetaReaderFn, SStoreMeta* pMetaFn, void* pVnode,
|
||||||
|
SMetaReader* pMReader, int64_t uid, const char* dbname, int32_t vgId,
|
||||||
|
SSDataBlock* p, int32_t rowIndex, const char* idStr) {
|
||||||
|
char n[TSDB_TABLE_NAME_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||||
|
int32_t lino = 0;
|
||||||
|
int32_t code = pMetaReaderFn->getTableEntryByUid(pMReader, uid);
|
||||||
|
if (code < 0) {
|
||||||
|
qError("failed to get table meta, uid:%" PRId64 ", code:%s, %s", uid, tstrerror(terrno), idStr);
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
STR_TO_VARSTR(n, pMReader->me.name);
|
||||||
|
|
||||||
|
// table name
|
||||||
|
SColumnInfoData* pColInfoData = taosArrayGet(p->pDataBlock, 0);
|
||||||
|
QUERY_CHECK_NULL(pColInfoData, code, lino, _end, terrno);
|
||||||
|
|
||||||
|
code = colDataSetVal(pColInfoData, rowIndex, n, false);
|
||||||
|
QUERY_CHECK_CODE(code, lino, _end);
|
||||||
|
|
||||||
|
// database name
|
||||||
|
pColInfoData = taosArrayGet(p->pDataBlock, 1);
|
||||||
|
QUERY_CHECK_NULL(pColInfoData, code, lino, _end, terrno);
|
||||||
|
code = colDataSetVal(pColInfoData, rowIndex, dbname, false);
|
||||||
|
QUERY_CHECK_CODE(code, lino, _end);
|
||||||
|
|
||||||
|
// vgId
|
||||||
|
pColInfoData = taosArrayGet(p->pDataBlock, 6);
|
||||||
|
QUERY_CHECK_NULL(pColInfoData, code, lino, _end, terrno);
|
||||||
|
code = colDataSetVal(pColInfoData, rowIndex, (char*)&vgId, false);
|
||||||
|
QUERY_CHECK_CODE(code, lino, _end);
|
||||||
|
|
||||||
|
int32_t tableType = pMReader->me.type;
|
||||||
|
if (tableType == TSDB_CHILD_TABLE) {
|
||||||
|
// create time
|
||||||
|
int64_t ts = pMReader->me.ctbEntry.btime;
|
||||||
|
pColInfoData = taosArrayGet(p->pDataBlock, 2);
|
||||||
|
QUERY_CHECK_NULL(pColInfoData, code, lino, _end, terrno);
|
||||||
|
code = colDataSetVal(pColInfoData, rowIndex, (char*)&ts, false);
|
||||||
|
QUERY_CHECK_CODE(code, lino, _end);
|
||||||
|
|
||||||
|
SMetaReader mr1 = {0};
|
||||||
|
pMetaReaderFn->initReader(&mr1, pVnode, META_READER_NOLOCK, pMetaFn);
|
||||||
|
|
||||||
|
int64_t suid = pMReader->me.ctbEntry.suid;
|
||||||
|
code = pMetaReaderFn->getTableEntryByUid(&mr1, suid);
|
||||||
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
|
qError("failed to get super table meta, cname:%s, suid:0x%" PRIx64 ", code:%s, %s", pMReader->me.name, suid,
|
||||||
|
tstrerror(code), idStr);
|
||||||
|
pMetaReaderFn->clearReader(&mr1);
|
||||||
|
QUERY_CHECK_CODE(code, lino, _end);
|
||||||
|
}
|
||||||
|
|
||||||
|
pColInfoData = taosArrayGet(p->pDataBlock, 3);
|
||||||
|
if (pColInfoData == NULL) {
|
||||||
|
pMetaReaderFn->clearReader(&mr1);
|
||||||
|
QUERY_CHECK_NULL(pColInfoData, code, lino, _end, terrno);
|
||||||
|
}
|
||||||
|
|
||||||
|
code = colDataSetVal(pColInfoData, rowIndex, (char*)&mr1.me.stbEntry.schemaRow.nCols, false);
|
||||||
|
if (code != 0) {
|
||||||
|
pMetaReaderFn->clearReader(&mr1);
|
||||||
|
QUERY_CHECK_CODE(code, lino, _end);
|
||||||
|
}
|
||||||
|
|
||||||
|
// super table name
|
||||||
|
STR_TO_VARSTR(n, mr1.me.name);
|
||||||
|
pColInfoData = taosArrayGet(p->pDataBlock, 4);
|
||||||
|
if (pColInfoData == NULL) {
|
||||||
|
pMetaReaderFn->clearReader(&mr1);
|
||||||
|
QUERY_CHECK_NULL(pColInfoData, code, lino, _end, terrno);
|
||||||
|
}
|
||||||
|
|
||||||
|
code = colDataSetVal(pColInfoData, rowIndex, n, false);
|
||||||
|
pMetaReaderFn->clearReader(&mr1);
|
||||||
|
QUERY_CHECK_CODE(code, lino, _end);
|
||||||
|
|
||||||
|
// table comment
|
||||||
|
pColInfoData = taosArrayGet(p->pDataBlock, 8);
|
||||||
|
QUERY_CHECK_NULL(pColInfoData, code, lino, _end, terrno);
|
||||||
|
if (pMReader->me.ctbEntry.commentLen > 0) {
|
||||||
|
char comment[TSDB_TB_COMMENT_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||||
|
STR_TO_VARSTR(comment, pMReader->me.ctbEntry.comment);
|
||||||
|
code = colDataSetVal(pColInfoData, rowIndex, comment, false);
|
||||||
|
QUERY_CHECK_CODE(code, lino, _end);
|
||||||
|
} else if (pMReader->me.ctbEntry.commentLen == 0) {
|
||||||
|
char comment[VARSTR_HEADER_SIZE + VARSTR_HEADER_SIZE] = {0};
|
||||||
|
STR_TO_VARSTR(comment, "");
|
||||||
|
code = colDataSetVal(pColInfoData, rowIndex, comment, false);
|
||||||
|
QUERY_CHECK_CODE(code, lino, _end);
|
||||||
|
} else {
|
||||||
|
colDataSetNULL(pColInfoData, rowIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
// uid
|
||||||
|
pColInfoData = taosArrayGet(p->pDataBlock, 5);
|
||||||
|
QUERY_CHECK_NULL(pColInfoData, code, lino, _end, terrno);
|
||||||
|
code = colDataSetVal(pColInfoData, rowIndex, (char*)&pMReader->me.uid, false);
|
||||||
|
QUERY_CHECK_CODE(code, lino, _end);
|
||||||
|
|
||||||
|
// ttl
|
||||||
|
pColInfoData = taosArrayGet(p->pDataBlock, 7);
|
||||||
|
QUERY_CHECK_NULL(pColInfoData, code, lino, _end, terrno);
|
||||||
|
code = colDataSetVal(pColInfoData, rowIndex, (char*)&pMReader->me.ctbEntry.ttlDays, false);
|
||||||
|
QUERY_CHECK_CODE(code, lino, _end);
|
||||||
|
|
||||||
|
STR_TO_VARSTR(n, "CHILD_TABLE");
|
||||||
|
|
||||||
|
} else if (tableType == TSDB_NORMAL_TABLE) {
|
||||||
|
// create time
|
||||||
|
pColInfoData = taosArrayGet(p->pDataBlock, 2);
|
||||||
|
QUERY_CHECK_NULL(pColInfoData, code, lino, _end, terrno);
|
||||||
|
code = colDataSetVal(pColInfoData, rowIndex, (char*)&pMReader->me.ntbEntry.btime, false);
|
||||||
|
QUERY_CHECK_CODE(code, lino, _end);
|
||||||
|
|
||||||
|
// number of columns
|
||||||
|
pColInfoData = taosArrayGet(p->pDataBlock, 3);
|
||||||
|
QUERY_CHECK_NULL(pColInfoData, code, lino, _end, terrno);
|
||||||
|
|
||||||
|
code = colDataSetVal(pColInfoData, rowIndex, (char*)&pMReader->me.ntbEntry.schemaRow.nCols, false);
|
||||||
|
QUERY_CHECK_CODE(code, lino, _end);
|
||||||
|
|
||||||
|
// super table name
|
||||||
|
pColInfoData = taosArrayGet(p->pDataBlock, 4);
|
||||||
|
QUERY_CHECK_NULL(pColInfoData, code, lino, _end, terrno);
|
||||||
|
colDataSetNULL(pColInfoData, rowIndex);
|
||||||
|
|
||||||
|
// table comment
|
||||||
|
pColInfoData = taosArrayGet(p->pDataBlock, 8);
|
||||||
|
QUERY_CHECK_NULL(pColInfoData, code, lino, _end, terrno);
|
||||||
|
if (pMReader->me.ntbEntry.commentLen > 0) {
|
||||||
|
char comment[TSDB_TB_COMMENT_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||||
|
STR_TO_VARSTR(comment, pMReader->me.ntbEntry.comment);
|
||||||
|
code = colDataSetVal(pColInfoData, rowIndex, comment, false);
|
||||||
|
QUERY_CHECK_CODE(code, lino, _end);
|
||||||
|
} else if (pMReader->me.ntbEntry.commentLen == 0) {
|
||||||
|
char comment[VARSTR_HEADER_SIZE + VARSTR_HEADER_SIZE] = {0};
|
||||||
|
STR_TO_VARSTR(comment, "");
|
||||||
|
code = colDataSetVal(pColInfoData, rowIndex, comment, false);
|
||||||
|
QUERY_CHECK_CODE(code, lino, _end);
|
||||||
|
} else {
|
||||||
|
colDataSetNULL(pColInfoData, rowIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
// uid
|
||||||
|
pColInfoData = taosArrayGet(p->pDataBlock, 5);
|
||||||
|
QUERY_CHECK_NULL(pColInfoData, code, lino, _end, terrno);
|
||||||
|
code = colDataSetVal(pColInfoData, rowIndex, (char*)&pMReader->me.uid, false);
|
||||||
|
QUERY_CHECK_CODE(code, lino, _end);
|
||||||
|
|
||||||
|
// ttl
|
||||||
|
pColInfoData = taosArrayGet(p->pDataBlock, 7);
|
||||||
|
QUERY_CHECK_NULL(pColInfoData, code, lino, _end, terrno);
|
||||||
|
code = colDataSetVal(pColInfoData, rowIndex, (char*)&pMReader->me.ntbEntry.ttlDays, false);
|
||||||
|
QUERY_CHECK_CODE(code, lino, _end);
|
||||||
|
|
||||||
|
STR_TO_VARSTR(n, "NORMAL_TABLE");
|
||||||
|
// impl later
|
||||||
|
}
|
||||||
|
|
||||||
|
_end:
|
||||||
|
qError("%s failed at line %d since %s, %s", __func__, lino, tstrerror(code), idStr);
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
static SSDataBlock* sysTableBuildUserTablesByUids(SOperatorInfo* pOperator) {
|
static SSDataBlock* sysTableBuildUserTablesByUids(SOperatorInfo* pOperator) {
|
||||||
int32_t code = TSDB_CODE_SUCCESS;
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
int32_t lino = 0;
|
int32_t lino = 0;
|
||||||
|
@ -1395,152 +1575,15 @@ static SSDataBlock* sysTableBuildUserTablesByUids(SOperatorInfo* pOperator) {
|
||||||
|
|
||||||
SMetaReader mr = {0};
|
SMetaReader mr = {0};
|
||||||
pAPI->metaReaderFn.initReader(&mr, pInfo->readHandle.vnode, META_READER_LOCK, &pAPI->metaFn);
|
pAPI->metaReaderFn.initReader(&mr, pInfo->readHandle.vnode, META_READER_LOCK, &pAPI->metaFn);
|
||||||
ret = pAPI->metaReaderFn.getTableEntryByUid(&mr, *uid);
|
code = doSetUserTableMetaInfo(&pAPI->metaReaderFn, &pAPI->metaFn, pInfo->readHandle.vnode, &mr, *uid, dbname, vgId, p,
|
||||||
if (ret < 0) {
|
numOfRows, GET_TASKID(pTaskInfo));
|
||||||
pAPI->metaReaderFn.clearReader(&mr);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
STR_TO_VARSTR(n, mr.me.name);
|
|
||||||
|
|
||||||
// table name
|
|
||||||
SColumnInfoData* pColInfoData = taosArrayGet(p->pDataBlock, 0);
|
|
||||||
QUERY_CHECK_NULL(pColInfoData, code, lino, _end, terrno);
|
|
||||||
|
|
||||||
code = colDataSetVal(pColInfoData, numOfRows, n, false);
|
|
||||||
QUERY_CHECK_CODE(code, lino, _end);
|
|
||||||
|
|
||||||
// database name
|
|
||||||
pColInfoData = taosArrayGet(p->pDataBlock, 1);
|
|
||||||
QUERY_CHECK_NULL(pColInfoData, code, lino, _end, terrno);
|
|
||||||
code = colDataSetVal(pColInfoData, numOfRows, dbname, false);
|
|
||||||
QUERY_CHECK_CODE(code, lino, _end);
|
|
||||||
|
|
||||||
// vgId
|
|
||||||
pColInfoData = taosArrayGet(p->pDataBlock, 6);
|
|
||||||
QUERY_CHECK_NULL(pColInfoData, code, lino, _end, terrno);
|
|
||||||
code = colDataSetVal(pColInfoData, numOfRows, (char*)&vgId, false);
|
|
||||||
QUERY_CHECK_CODE(code, lino, _end);
|
|
||||||
|
|
||||||
int32_t tableType = mr.me.type;
|
|
||||||
if (tableType == TSDB_CHILD_TABLE) {
|
|
||||||
// create time
|
|
||||||
int64_t ts = mr.me.ctbEntry.btime;
|
|
||||||
pColInfoData = taosArrayGet(p->pDataBlock, 2);
|
|
||||||
QUERY_CHECK_NULL(pColInfoData, code, lino, _end, terrno);
|
|
||||||
code = colDataSetVal(pColInfoData, numOfRows, (char*)&ts, false);
|
|
||||||
QUERY_CHECK_CODE(code, lino, _end);
|
|
||||||
|
|
||||||
SMetaReader mr1 = {0};
|
|
||||||
pAPI->metaReaderFn.initReader(&mr1, pInfo->readHandle.vnode, META_READER_NOLOCK, &pAPI->metaFn);
|
|
||||||
|
|
||||||
int64_t suid = mr.me.ctbEntry.suid;
|
|
||||||
code = pAPI->metaReaderFn.getTableEntryByUid(&mr1, suid);
|
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
|
||||||
qError("failed to get super table meta, cname:%s, suid:0x%" PRIx64 ", code:%s, %s", mr.me.name,
|
|
||||||
suid, tstrerror(terrno), GET_TASKID(pTaskInfo));
|
|
||||||
pAPI->metaReaderFn.clearReader(&mr1);
|
|
||||||
pAPI->metaReaderFn.clearReader(&mr);
|
|
||||||
T_LONG_JMP(pTaskInfo->env, terrno);
|
|
||||||
}
|
|
||||||
pColInfoData = taosArrayGet(p->pDataBlock, 3);
|
|
||||||
QUERY_CHECK_NULL(pColInfoData, code, lino, _end, terrno);
|
|
||||||
code = colDataSetVal(pColInfoData, numOfRows, (char*)&mr1.me.stbEntry.schemaRow.nCols, false);
|
|
||||||
QUERY_CHECK_CODE(code, lino, _end);
|
|
||||||
|
|
||||||
// super table name
|
|
||||||
STR_TO_VARSTR(n, mr1.me.name);
|
|
||||||
pColInfoData = taosArrayGet(p->pDataBlock, 4);
|
|
||||||
QUERY_CHECK_NULL(pColInfoData, code, lino, _end, terrno);
|
|
||||||
code = colDataSetVal(pColInfoData, numOfRows, n, false);
|
|
||||||
QUERY_CHECK_CODE(code, lino, _end);
|
|
||||||
pAPI->metaReaderFn.clearReader(&mr1);
|
|
||||||
|
|
||||||
// table comment
|
|
||||||
pColInfoData = taosArrayGet(p->pDataBlock, 8);
|
|
||||||
QUERY_CHECK_NULL(pColInfoData, code, lino, _end, terrno);
|
|
||||||
if (mr.me.ctbEntry.commentLen > 0) {
|
|
||||||
char comment[TSDB_TB_COMMENT_LEN + VARSTR_HEADER_SIZE] = {0};
|
|
||||||
STR_TO_VARSTR(comment, mr.me.ctbEntry.comment);
|
|
||||||
code = colDataSetVal(pColInfoData, numOfRows, comment, false);
|
|
||||||
QUERY_CHECK_CODE(code, lino, _end);
|
|
||||||
} else if (mr.me.ctbEntry.commentLen == 0) {
|
|
||||||
char comment[VARSTR_HEADER_SIZE + VARSTR_HEADER_SIZE] = {0};
|
|
||||||
STR_TO_VARSTR(comment, "");
|
|
||||||
code = colDataSetVal(pColInfoData, numOfRows, comment, false);
|
|
||||||
QUERY_CHECK_CODE(code, lino, _end);
|
|
||||||
} else {
|
|
||||||
colDataSetNULL(pColInfoData, numOfRows);
|
|
||||||
}
|
|
||||||
|
|
||||||
// uid
|
|
||||||
pColInfoData = taosArrayGet(p->pDataBlock, 5);
|
|
||||||
QUERY_CHECK_NULL(pColInfoData, code, lino, _end, terrno);
|
|
||||||
code = colDataSetVal(pColInfoData, numOfRows, (char*)&mr.me.uid, false);
|
|
||||||
QUERY_CHECK_CODE(code, lino, _end);
|
|
||||||
|
|
||||||
// ttl
|
|
||||||
pColInfoData = taosArrayGet(p->pDataBlock, 7);
|
|
||||||
QUERY_CHECK_NULL(pColInfoData, code, lino, _end, terrno);
|
|
||||||
code = colDataSetVal(pColInfoData, numOfRows, (char*)&mr.me.ctbEntry.ttlDays, false);
|
|
||||||
QUERY_CHECK_CODE(code, lino, _end);
|
|
||||||
|
|
||||||
STR_TO_VARSTR(n, "CHILD_TABLE");
|
|
||||||
|
|
||||||
} else if (tableType == TSDB_NORMAL_TABLE) {
|
|
||||||
// create time
|
|
||||||
pColInfoData = taosArrayGet(p->pDataBlock, 2);
|
|
||||||
QUERY_CHECK_NULL(pColInfoData, code, lino, _end, terrno);
|
|
||||||
code = colDataSetVal(pColInfoData, numOfRows, (char*)&mr.me.ntbEntry.btime, false);
|
|
||||||
QUERY_CHECK_CODE(code, lino, _end);
|
|
||||||
|
|
||||||
// number of columns
|
|
||||||
pColInfoData = taosArrayGet(p->pDataBlock, 3);
|
|
||||||
QUERY_CHECK_NULL(pColInfoData, code, lino, _end, terrno);
|
|
||||||
code = colDataSetVal(pColInfoData, numOfRows, (char*)&mr.me.ntbEntry.schemaRow.nCols, false);
|
|
||||||
QUERY_CHECK_CODE(code, lino, _end);
|
|
||||||
|
|
||||||
// super table name
|
|
||||||
pColInfoData = taosArrayGet(p->pDataBlock, 4);
|
|
||||||
QUERY_CHECK_NULL(pColInfoData, code, lino, _end, terrno);
|
|
||||||
colDataSetNULL(pColInfoData, numOfRows);
|
|
||||||
|
|
||||||
// table comment
|
|
||||||
pColInfoData = taosArrayGet(p->pDataBlock, 8);
|
|
||||||
QUERY_CHECK_NULL(pColInfoData, code, lino, _end, terrno);
|
|
||||||
if (mr.me.ntbEntry.commentLen > 0) {
|
|
||||||
char comment[TSDB_TB_COMMENT_LEN + VARSTR_HEADER_SIZE] = {0};
|
|
||||||
STR_TO_VARSTR(comment, mr.me.ntbEntry.comment);
|
|
||||||
code = colDataSetVal(pColInfoData, numOfRows, comment, false);
|
|
||||||
QUERY_CHECK_CODE(code, lino, _end);
|
|
||||||
} else if (mr.me.ntbEntry.commentLen == 0) {
|
|
||||||
char comment[VARSTR_HEADER_SIZE + VARSTR_HEADER_SIZE] = {0};
|
|
||||||
STR_TO_VARSTR(comment, "");
|
|
||||||
code = colDataSetVal(pColInfoData, numOfRows, comment, false);
|
|
||||||
QUERY_CHECK_CODE(code, lino, _end);
|
|
||||||
} else {
|
|
||||||
colDataSetNULL(pColInfoData, numOfRows);
|
|
||||||
}
|
|
||||||
|
|
||||||
// uid
|
|
||||||
pColInfoData = taosArrayGet(p->pDataBlock, 5);
|
|
||||||
QUERY_CHECK_NULL(pColInfoData, code, lino, _end, terrno);
|
|
||||||
code = colDataSetVal(pColInfoData, numOfRows, (char*)&mr.me.uid, false);
|
|
||||||
QUERY_CHECK_CODE(code, lino, _end);
|
|
||||||
|
|
||||||
// ttl
|
|
||||||
pColInfoData = taosArrayGet(p->pDataBlock, 7);
|
|
||||||
QUERY_CHECK_NULL(pColInfoData, code, lino, _end, terrno);
|
|
||||||
code = colDataSetVal(pColInfoData, numOfRows, (char*)&mr.me.ntbEntry.ttlDays, false);
|
|
||||||
QUERY_CHECK_CODE(code, lino, _end);
|
|
||||||
|
|
||||||
STR_TO_VARSTR(n, "NORMAL_TABLE");
|
|
||||||
// impl later
|
|
||||||
}
|
|
||||||
|
|
||||||
pAPI->metaReaderFn.clearReader(&mr);
|
pAPI->metaReaderFn.clearReader(&mr);
|
||||||
|
QUERY_CHECK_CODE(code, lino, _end);
|
||||||
|
|
||||||
pColInfoData = taosArrayGet(p->pDataBlock, 9);
|
SColumnInfoData* pColInfoData = taosArrayGet(p->pDataBlock, 9);
|
||||||
QUERY_CHECK_NULL(pColInfoData, code, lino, _end, terrno);
|
QUERY_CHECK_NULL(pColInfoData, code, lino, _end, terrno);
|
||||||
|
|
||||||
code = colDataSetVal(pColInfoData, numOfRows, n, false);
|
code = colDataSetVal(pColInfoData, numOfRows, n, false);
|
||||||
QUERY_CHECK_CODE(code, lino, _end);
|
QUERY_CHECK_CODE(code, lino, _end);
|
||||||
|
|
||||||
|
|
|
@ -115,24 +115,20 @@ EFuncDataRequired fmFuncDataRequired(SFunctionNode* pFunc, STimeWindow* pTimeWin
|
||||||
return funcMgtBuiltins[pFunc->funcId].dataRequiredFunc(pFunc, pTimeWindow);
|
return funcMgtBuiltins[pFunc->funcId].dataRequiredFunc(pFunc, pTimeWindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t fmFuncDynDataRequired(int32_t funcId, void* pRes, SDataBlockInfo* pBlockInfo, int32_t *reqStatus) {
|
EFuncDataRequired fmFuncDynDataRequired(int32_t funcId, void* pRes, SDataBlockInfo* pBlockInfo) {
|
||||||
if (fmIsUserDefinedFunc(funcId) || funcId < 0 || funcId >= funcMgtBuiltinsNum) {
|
if (fmIsUserDefinedFunc(funcId) || funcId < 0 || funcId >= funcMgtBuiltinsNum) {
|
||||||
*reqStatus = -1;
|
return FUNC_DATA_REQUIRED_DATA_LOAD;
|
||||||
return TSDB_CODE_FAILED;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* name = funcMgtBuiltins[funcId].name;
|
const char* name = funcMgtBuiltins[funcId].name;
|
||||||
if ((strcmp(name, "_group_key") == 0) || (strcmp(name, "_select_value") == 0)) {
|
if ((strcmp(name, "_group_key") == 0) || (strcmp(name, "_select_value") == 0)) {
|
||||||
*reqStatus = FUNC_DATA_REQUIRED_NOT_LOAD;
|
return FUNC_DATA_REQUIRED_NOT_LOAD;;
|
||||||
return TSDB_CODE_SUCCESS;;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (funcMgtBuiltins[funcId].dynDataRequiredFunc == NULL) {
|
if (funcMgtBuiltins[funcId].dynDataRequiredFunc == NULL) {
|
||||||
*reqStatus = FUNC_DATA_REQUIRED_DATA_LOAD;
|
return FUNC_DATA_REQUIRED_DATA_LOAD;
|
||||||
return TSDB_CODE_SUCCESS;
|
|
||||||
} else {
|
} else {
|
||||||
*reqStatus = funcMgtBuiltins[funcId].dynDataRequiredFunc(pRes, pBlockInfo);
|
return funcMgtBuiltins[funcId].dynDataRequiredFunc(pRes, pBlockInfo);
|
||||||
return TSDB_CODE_SUCCESS;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,8 +14,6 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
#ifndef TAOS_TEST_H
|
#ifndef TAOS_TEST_H
|
||||||
#define TAOS_TEST_H
|
#define TAOS_TEST_H
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
#include "taos_collector_registry.h"
|
#include "taos_collector_registry.h"
|
||||||
|
|
||||||
// Private
|
// Private
|
||||||
#include "taos_assert.h"
|
#include "taos_test.h"
|
||||||
#include "taos_collector_t.h"
|
#include "taos_collector_t.h"
|
||||||
#include "taos_log.h"
|
#include "taos_log.h"
|
||||||
#include "taos_map_i.h"
|
#include "taos_map_i.h"
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
#include "taos_collector_registry.h"
|
#include "taos_collector_registry.h"
|
||||||
|
|
||||||
// Private
|
// Private
|
||||||
#include "taos_assert.h"
|
#include "taos_test.h"
|
||||||
#include "taos_collector_registry_t.h"
|
#include "taos_collector_registry_t.h"
|
||||||
#include "taos_collector_t.h"
|
#include "taos_collector_t.h"
|
||||||
#include "taos_errors.h"
|
#include "taos_errors.h"
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
#include "taos_alloc.h"
|
#include "taos_alloc.h"
|
||||||
|
|
||||||
// Private
|
// Private
|
||||||
#include "taos_assert.h"
|
#include "taos_test.h"
|
||||||
#include "taos_errors.h"
|
#include "taos_errors.h"
|
||||||
#include "taos_log.h"
|
#include "taos_log.h"
|
||||||
#include "taos_metric_i.h"
|
#include "taos_metric_i.h"
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
#include "taos_alloc.h"
|
#include "taos_alloc.h"
|
||||||
|
|
||||||
// Private
|
// Private
|
||||||
#include "taos_assert.h"
|
#include "taos_test.h"
|
||||||
#include "taos_errors.h"
|
#include "taos_errors.h"
|
||||||
#include "taos_log.h"
|
#include "taos_log.h"
|
||||||
#include "taos_metric_i.h"
|
#include "taos_metric_i.h"
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
#include "taos_alloc.h"
|
#include "taos_alloc.h"
|
||||||
|
|
||||||
// Private
|
// Private
|
||||||
#include "taos_assert.h"
|
#include "taos_test.h"
|
||||||
#include "taos_linked_list_i.h"
|
#include "taos_linked_list_i.h"
|
||||||
#include "taos_linked_list_t.h"
|
#include "taos_linked_list_t.h"
|
||||||
#include "taos_log.h"
|
#include "taos_log.h"
|
||||||
|
|
|
@ -21,13 +21,13 @@
|
||||||
#include "taos_alloc.h"
|
#include "taos_alloc.h"
|
||||||
|
|
||||||
// Private
|
// Private
|
||||||
#include "taos_assert.h"
|
|
||||||
#include "taos_errors.h"
|
#include "taos_errors.h"
|
||||||
#include "taos_linked_list_i.h"
|
#include "taos_linked_list_i.h"
|
||||||
#include "taos_linked_list_t.h"
|
#include "taos_linked_list_t.h"
|
||||||
#include "taos_log.h"
|
#include "taos_log.h"
|
||||||
#include "taos_map_i.h"
|
#include "taos_map_i.h"
|
||||||
#include "taos_map_t.h"
|
#include "taos_map_t.h"
|
||||||
|
#include "taos_test.h"
|
||||||
|
|
||||||
#define TAOS_MAP_INITIAL_SIZE 32
|
#define TAOS_MAP_INITIAL_SIZE 32
|
||||||
|
|
||||||
|
|
|
@ -20,13 +20,13 @@
|
||||||
#include "taos_alloc.h"
|
#include "taos_alloc.h"
|
||||||
|
|
||||||
// Private
|
// Private
|
||||||
#include "taos_assert.h"
|
|
||||||
#include "taos_errors.h"
|
#include "taos_errors.h"
|
||||||
#include "taos_log.h"
|
#include "taos_log.h"
|
||||||
#include "taos_map_i.h"
|
#include "taos_map_i.h"
|
||||||
#include "taos_metric_formatter_i.h"
|
#include "taos_metric_formatter_i.h"
|
||||||
#include "taos_metric_i.h"
|
#include "taos_metric_i.h"
|
||||||
#include "taos_metric_sample_i.h"
|
#include "taos_metric_sample_i.h"
|
||||||
|
#include "taos_test.h"
|
||||||
|
|
||||||
char *taos_metric_type_map[4] = {"counter", "gauge", "histogram", "summary"};
|
char *taos_metric_type_map[4] = {"counter", "gauge", "histogram", "summary"};
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
#include "taos_alloc.h"
|
#include "taos_alloc.h"
|
||||||
|
|
||||||
// Private
|
// Private
|
||||||
#include "taos_assert.h"
|
|
||||||
#include "taos_collector_t.h"
|
#include "taos_collector_t.h"
|
||||||
#include "taos_linked_list_t.h"
|
#include "taos_linked_list_t.h"
|
||||||
#include "taos_map_i.h"
|
#include "taos_map_i.h"
|
||||||
|
@ -28,7 +27,7 @@
|
||||||
#include "taos_metric_sample_t.h"
|
#include "taos_metric_sample_t.h"
|
||||||
#include "taos_metric_t.h"
|
#include "taos_metric_t.h"
|
||||||
#include "taos_string_builder_i.h"
|
#include "taos_string_builder_i.h"
|
||||||
|
#include "taos_test.h"
|
||||||
|
|
||||||
taos_metric_formatter_t *taos_metric_formatter_new() {
|
taos_metric_formatter_t *taos_metric_formatter_new() {
|
||||||
taos_metric_formatter_t *self = (taos_metric_formatter_t *)taos_malloc(sizeof(taos_metric_formatter_t));
|
taos_metric_formatter_t *self = (taos_metric_formatter_t *)taos_malloc(sizeof(taos_metric_formatter_t));
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#include "taos_metric_sample_t.h"
|
#include "taos_metric_sample_t.h"
|
||||||
#include "tjson.h"
|
#include "tjson.h"
|
||||||
#include "taos_monitor_util_i.h"
|
#include "taos_monitor_util_i.h"
|
||||||
#include "taos_assert.h"
|
#include "taos_test.h"
|
||||||
#include "tdef.h"
|
#include "tdef.h"
|
||||||
#include "taos_collector_t.h"
|
#include "taos_collector_t.h"
|
||||||
#include "taos_log.h"
|
#include "taos_log.h"
|
||||||
|
|
|
@ -20,11 +20,11 @@
|
||||||
#include "taos_alloc.h"
|
#include "taos_alloc.h"
|
||||||
|
|
||||||
// Private
|
// Private
|
||||||
#include "taos_assert.h"
|
|
||||||
#include "taos_errors.h"
|
#include "taos_errors.h"
|
||||||
#include "taos_log.h"
|
#include "taos_log.h"
|
||||||
#include "taos_metric_sample_i.h"
|
#include "taos_metric_sample_i.h"
|
||||||
#include "taos_metric_sample_t.h"
|
#include "taos_metric_sample_t.h"
|
||||||
|
#include "taos_test.h"
|
||||||
|
|
||||||
#ifdef C11_ATOMIC
|
#ifdef C11_ATOMIC
|
||||||
#include <stdatomic.h>
|
#include <stdatomic.h>
|
||||||
|
|
|
@ -20,9 +20,9 @@
|
||||||
#include "taos_alloc.h"
|
#include "taos_alloc.h"
|
||||||
|
|
||||||
// Private
|
// Private
|
||||||
#include "taos_assert.h"
|
|
||||||
#include "taos_string_builder_i.h"
|
#include "taos_string_builder_i.h"
|
||||||
#include "taos_string_builder_t.h"
|
#include "taos_string_builder_t.h"
|
||||||
|
#include "taos_test.h"
|
||||||
|
|
||||||
// The initial size of a string created via taos_string_builder
|
// The initial size of a string created via taos_string_builder
|
||||||
#define TAOS_STRING_BUILDER_INIT_SIZE 32
|
#define TAOS_STRING_BUILDER_INIT_SIZE 32
|
||||||
|
|
|
@ -1476,7 +1476,7 @@ static EDealRes translateColumnUseAlias(STranslateContext* pCxt, SColumnNode** p
|
||||||
pCxt->errCode = getFuncInfo(pCxt, (SFunctionNode*)pFoundNode);
|
pCxt->errCode = getFuncInfo(pCxt, (SFunctionNode*)pFoundNode);
|
||||||
if (TSDB_CODE_SUCCESS == pCxt->errCode) {
|
if (TSDB_CODE_SUCCESS == pCxt->errCode) {
|
||||||
if (fmIsVectorFunc(((SFunctionNode*)pFoundNode)->funcId)) {
|
if (fmIsVectorFunc(((SFunctionNode*)pFoundNode)->funcId)) {
|
||||||
pCxt->errCode = TSDB_CODE_PAR_ILLEGAL_USE_AGG_FUNCTION;
|
pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_ILLEGAL_USE_AGG_FUNCTION, (*pCol)->colName);
|
||||||
return DEAL_RES_ERROR;
|
return DEAL_RES_ERROR;
|
||||||
} else if (fmIsPseudoColumnFunc(((SFunctionNode*)pFoundNode)->funcId)) {
|
} else if (fmIsPseudoColumnFunc(((SFunctionNode*)pFoundNode)->funcId)) {
|
||||||
if ('\0' != (*pCol)->tableAlias[0]) {
|
if ('\0' != (*pCol)->tableAlias[0]) {
|
||||||
|
@ -1500,6 +1500,7 @@ static EDealRes translateColumnUseAlias(STranslateContext* pCxt, SColumnNode** p
|
||||||
nodesDestroyNode(*(SNode**)pCol);
|
nodesDestroyNode(*(SNode**)pCol);
|
||||||
*(SNode**)pCol = (SNode*)pNew;
|
*(SNode**)pCol = (SNode*)pNew;
|
||||||
if (QUERY_NODE_COLUMN == nodeType(pFoundNode)) {
|
if (QUERY_NODE_COLUMN == nodeType(pFoundNode)) {
|
||||||
|
pCxt->errCode = TSDB_CODE_SUCCESS;
|
||||||
if ('\0' != (*pCol)->tableAlias[0]) {
|
if ('\0' != (*pCol)->tableAlias[0]) {
|
||||||
return translateColumnWithPrefix(pCxt, pCol);
|
return translateColumnWithPrefix(pCxt, pCol);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1776,7 +1777,7 @@ static EDealRes translateColumn(STranslateContext* pCxt, SColumnNode** pCol) {
|
||||||
res = translateColumnWithPrefix(pCxt, pCol);
|
res = translateColumnWithPrefix(pCxt, pCol);
|
||||||
} else {
|
} else {
|
||||||
bool found = false;
|
bool found = false;
|
||||||
if ((clauseSupportAlias(pCxt->currClause)) &&
|
if ((pCxt->currClause == SQL_CLAUSE_ORDER_BY) &&
|
||||||
!(*pCol)->node.asParam) {
|
!(*pCol)->node.asParam) {
|
||||||
res = translateColumnUseAlias(pCxt, pCol, &found);
|
res = translateColumnUseAlias(pCxt, pCol, &found);
|
||||||
}
|
}
|
||||||
|
@ -5292,6 +5293,7 @@ static int32_t translateGroupBy(STranslateContext* pCxt, SSelectStmt* pSelect) {
|
||||||
return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_GROUPBY_WINDOW_COEXIST);
|
return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_GROUPBY_WINDOW_COEXIST);
|
||||||
}
|
}
|
||||||
bool other;
|
bool other;
|
||||||
|
pCxt->currClause = SQL_CLAUSE_GROUP_BY;
|
||||||
int32_t code = translateClausePosition(pCxt, pSelect->pProjectionList, pSelect->pGroupByList, &other);
|
int32_t code = translateClausePosition(pCxt, pSelect->pProjectionList, pSelect->pGroupByList, &other);
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
if (0 == LIST_LENGTH(pSelect->pGroupByList)) {
|
if (0 == LIST_LENGTH(pSelect->pGroupByList)) {
|
||||||
|
@ -5301,7 +5303,6 @@ static int32_t translateGroupBy(STranslateContext* pCxt, SSelectStmt* pSelect) {
|
||||||
code = replaceGroupByAlias(pCxt, pSelect);
|
code = replaceGroupByAlias(pCxt, pSelect);
|
||||||
}
|
}
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
pCxt->currClause = SQL_CLAUSE_GROUP_BY;
|
|
||||||
pSelect->timeLineResMode = TIME_LINE_NONE;
|
pSelect->timeLineResMode = TIME_LINE_NONE;
|
||||||
code = translateExprList(pCxt, pSelect->pGroupByList);
|
code = translateExprList(pCxt, pSelect->pGroupByList);
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,15 +74,17 @@ int32_t sclConvertValueToSclParam(SValueNode *pValueNode, SScalarParam *out, int
|
||||||
|
|
||||||
code = colDataSetVal(in.columnData, 0, nodesGetValueFromNode(pValueNode), false);
|
code = colDataSetVal(in.columnData, 0, nodesGetValueFromNode(pValueNode), false);
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
return code;
|
goto _exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
code = colInfoDataEnsureCapacity(out->columnData, 1, true);
|
code = colInfoDataEnsureCapacity(out->columnData, 1, true);
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
return code;
|
goto _exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
code = vectorConvertSingleColImpl(&in, out, overflow, -1, -1);
|
code = vectorConvertSingleColImpl(&in, out, overflow, -1, -1);
|
||||||
|
|
||||||
|
_exit:
|
||||||
sclFreeParam(&in);
|
sclFreeParam(&in);
|
||||||
|
|
||||||
return code;
|
return code;
|
||||||
|
@ -594,7 +596,7 @@ int32_t sclInitOperatorParams(SScalarParam **pParams, SOperatorNode *node, SScal
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
|
|
||||||
_return:
|
_return:
|
||||||
taosMemoryFreeClear(paramList);
|
sclFreeParamList(paramList, paramNum);
|
||||||
SCL_RET(code);
|
SCL_RET(code);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1591,16 +1591,14 @@ int32_t substrIdxFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *
|
||||||
SColumnInfoData *pInputData[3];
|
SColumnInfoData *pInputData[3];
|
||||||
SColumnInfoData *pOutputData = pOutput[0].columnData;
|
SColumnInfoData *pOutputData = pOutput[0].columnData;
|
||||||
int32_t outputLen;
|
int32_t outputLen;
|
||||||
int32_t numOfRows;
|
int32_t numOfRows = 0;
|
||||||
|
|
||||||
pInputData[0] = pInput[0].columnData;
|
pInputData[0] = pInput[0].columnData;
|
||||||
pInputData[1] = pInput[1].columnData;
|
pInputData[1] = pInput[1].columnData;
|
||||||
pInputData[2] = pInput[2].columnData;
|
pInputData[2] = pInput[2].columnData;
|
||||||
|
|
||||||
for (int32_t i = 0; i < inputNum; ++i) {
|
for (int32_t i = 0; i < inputNum; ++i) {
|
||||||
if (pInput[i].numOfRows > numOfRows) {
|
numOfRows = TMAX(numOfRows, pInput[i].numOfRows);
|
||||||
numOfRows = pInput[i].numOfRows;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
outputLen = pInputData[0]->info.bytes;
|
outputLen = pInputData[0]->info.bytes;
|
||||||
|
@ -1619,9 +1617,13 @@ int32_t substrIdxFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *
|
||||||
for (int32_t i = 0; i < inputNum; ++i) {
|
for (int32_t i = 0; i < inputNum; ++i) {
|
||||||
if (colDataIsNull_s(pInputData[i], k) || IS_NULL_TYPE(GET_PARAM_TYPE(&pInput[i]))) {
|
if (colDataIsNull_s(pInputData[i], k) || IS_NULL_TYPE(GET_PARAM_TYPE(&pInput[i]))) {
|
||||||
colDataSetNULL(pOutputData, k);
|
colDataSetNULL(pOutputData, k);
|
||||||
continue;
|
hasNull = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (hasNull) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
int32_t colIdx1 = (pInput[0].numOfRows == 1) ? 0 : k;
|
int32_t colIdx1 = (pInput[0].numOfRows == 1) ? 0 : k;
|
||||||
int32_t colIdx2 = (pInput[1].numOfRows == 1) ? 0 : k;
|
int32_t colIdx2 = (pInput[1].numOfRows == 1) ? 0 : k;
|
||||||
|
|
|
@ -294,6 +294,8 @@ void taosRemoveOldFiles(const char *dirname, int32_t keepDays) {
|
||||||
int32_t len = (int32_t)strlen(filename);
|
int32_t len = (int32_t)strlen(filename);
|
||||||
if (len > 3 && strcmp(filename + len - 3, ".gz") == 0) {
|
if (len > 3 && strcmp(filename + len - 3, ".gz") == 0) {
|
||||||
len -= 3;
|
len -= 3;
|
||||||
|
}else{
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t fileSec = 0;
|
int64_t fileSec = 0;
|
||||||
|
@ -308,7 +310,7 @@ void taosRemoveOldFiles(const char *dirname, int32_t keepDays) {
|
||||||
int32_t days = (int32_t)(TABS(sec - fileSec) / 86400 + 1);
|
int32_t days = (int32_t)(TABS(sec - fileSec) / 86400 + 1);
|
||||||
if (days > keepDays) {
|
if (days > keepDays) {
|
||||||
(void)taosRemoveFile(filename);
|
(void)taosRemoveFile(filename);
|
||||||
// printf("file:%s is removed, days:%d keepDays:%d", filename, days, keepDays);
|
uInfo("file:%s is removed, days:%d keepDays:%d, sed:%"PRId64, filename, days, keepDays, fileSec);
|
||||||
} else {
|
} else {
|
||||||
// printf("file:%s won't be removed, days:%d keepDays:%d", filename, days, keepDays);
|
// printf("file:%s won't be removed, days:%d keepDays:%d", filename, days, keepDays);
|
||||||
}
|
}
|
||||||
|
|
|
@ -154,6 +154,10 @@ static void *taosCacheTimedRefresh(void *handle);
|
||||||
|
|
||||||
static void doInitRefreshThread(void) {
|
static void doInitRefreshThread(void) {
|
||||||
pCacheArrayList = taosArrayInit(4, POINTER_BYTES);
|
pCacheArrayList = taosArrayInit(4, POINTER_BYTES);
|
||||||
|
if (pCacheArrayList == NULL) {
|
||||||
|
uError("failed to allocate memory, reason:%s", strerror(errno));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
(void)taosThreadMutexInit(&guard, NULL);
|
(void)taosThreadMutexInit(&guard, NULL);
|
||||||
|
|
||||||
|
@ -169,7 +173,11 @@ TdThread doRegisterCacheObj(SCacheObj *pCacheObj) {
|
||||||
(void)taosThreadOnce(&cacheThreadInit, doInitRefreshThread);
|
(void)taosThreadOnce(&cacheThreadInit, doInitRefreshThread);
|
||||||
|
|
||||||
(void)taosThreadMutexLock(&guard);
|
(void)taosThreadMutexLock(&guard);
|
||||||
(void)taosArrayPush(pCacheArrayList, &pCacheObj);
|
if (taosArrayPush(pCacheArrayList, &pCacheObj) != 0) {
|
||||||
|
uError("failed to add cache object into array, reason:%s", strerror(errno));
|
||||||
|
(void)taosThreadMutexUnlock(&guard);
|
||||||
|
return cacheRefreshWorker;
|
||||||
|
}
|
||||||
(void)taosThreadMutexUnlock(&guard);
|
(void)taosThreadMutexUnlock(&guard);
|
||||||
|
|
||||||
return cacheRefreshWorker;
|
return cacheRefreshWorker;
|
||||||
|
|
|
@ -159,7 +159,7 @@ static void lockTimerList(timer_list_t* list) {
|
||||||
static void unlockTimerList(timer_list_t* list) {
|
static void unlockTimerList(timer_list_t* list) {
|
||||||
int64_t tid = taosGetSelfPthreadId();
|
int64_t tid = taosGetSelfPthreadId();
|
||||||
if (atomic_val_compare_exchange_64(&(list->lockedBy), tid, 0) != tid) {
|
if (atomic_val_compare_exchange_64(&(list->lockedBy), tid, 0) != tid) {
|
||||||
ASSERTS(false, "%" PRId64 " trying to unlock a timer list not locked by current thread.", tid);
|
uError("%" PRId64 " trying to unlock a timer list not locked by current thread.", tid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -505,7 +505,9 @@ bool taosTmrReset(TAOS_TMR_CALLBACK fp, int32_t mseconds, void* param, void* han
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERTS(timer->refCount == 1, "timer refCount=%d not expected 1", timer->refCount);
|
if (timer->refCount == 1) {
|
||||||
|
uError("timer refCount=%d not expected 1", timer->refCount);
|
||||||
|
}
|
||||||
memset(timer, 0, sizeof(*timer));
|
memset(timer, 0, sizeof(*timer));
|
||||||
*pTmrId = (tmr_h)doStartTimer(timer, fp, mseconds, param, ctrl);
|
*pTmrId = (tmr_h)doStartTimer(timer, fp, mseconds, param, ctrl);
|
||||||
|
|
||||||
|
|
|
@ -494,7 +494,7 @@ int32_t tSingleWorkerInit(SSingleWorker *pWorker, const SSingleWorkerCfg *pCfg)
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
default:
|
default:
|
||||||
assert(0);
|
return TSDB_CODE_INVALID_PARA;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -517,7 +517,7 @@ void tSingleWorkerCleanup(SSingleWorker *pWorker) {
|
||||||
taosMemoryFree(pWorker->pool);
|
taosMemoryFree(pWorker->pool);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
assert(0);
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -812,7 +812,6 @@ int32_t tQueryAutoQWorkerInit(SQueryAutoQWorkerPool *pool) {
|
||||||
if (!pool->exitedWorkers) return TSDB_CODE_OUT_OF_MEMORY;
|
if (!pool->exitedWorkers) return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
pool->maxInUse = pool->max * 2 + 2;
|
pool->maxInUse = pool->max * 2 + 2;
|
||||||
|
|
||||||
|
|
||||||
if (!pool->pCb) {
|
if (!pool->pCb) {
|
||||||
pool->pCb = taosMemoryCalloc(1, sizeof(SQueryAutoQWorkerPoolCB));
|
pool->pCb = taosMemoryCalloc(1, sizeof(SQueryAutoQWorkerPoolCB));
|
||||||
if (!pool->pCb) return TSDB_CODE_OUT_OF_MEMORY;
|
if (!pool->pCb) return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
|
|
@ -141,12 +141,42 @@ class TDTestCase(TBase):
|
||||||
tdSql.checkRows(1)
|
tdSql.checkRows(1)
|
||||||
tdSql.checkData(0, 0, 102)
|
tdSql.checkData(0, 0, 102)
|
||||||
|
|
||||||
|
def FIX_TD_31684(self):
|
||||||
|
tdLog.info("check bug TD_31684 ...\n")
|
||||||
|
sqls = [
|
||||||
|
"drop database if exists td_31684",
|
||||||
|
"create database td_31684 cachemodel 'both' stt_trigger 1;",
|
||||||
|
"use td_31684;",
|
||||||
|
"create table t1 (ts timestamp, id int, name int) ;",
|
||||||
|
"insert into t1 values(now, 1, 1);",
|
||||||
|
"insert into t1 values(now, 1, 2);",
|
||||||
|
"insert into t1 values(now, 2, 3);",
|
||||||
|
"insert into t1 values(now, 3, 4);"
|
||||||
|
]
|
||||||
|
tdSql.executes(sqls)
|
||||||
|
sql1 = "select count(name) as total_name from t1 group by name"
|
||||||
|
sql2 = "select id as new_id, last(name) as last_name from t1 group by id order by new_id"
|
||||||
|
sql3 = "select id as new_id, count(id) as id from t1 group by id order by new_id"
|
||||||
|
tdSql.query(sql1)
|
||||||
|
tdSql.checkRows(4)
|
||||||
|
|
||||||
|
tdSql.query(sql2)
|
||||||
|
tdSql.checkRows(3)
|
||||||
|
tdSql.checkData(0, 1, 2)
|
||||||
|
tdSql.checkData(1, 1, 3)
|
||||||
|
|
||||||
|
tdSql.query(sql3)
|
||||||
|
tdSql.checkRows(3)
|
||||||
|
tdSql.checkData(0, 1, 2)
|
||||||
|
tdSql.checkData(2, 1, 1)
|
||||||
|
|
||||||
# run
|
# run
|
||||||
def run(self):
|
def run(self):
|
||||||
tdLog.debug(f"start to excute {__file__}")
|
tdLog.debug(f"start to excute {__file__}")
|
||||||
|
|
||||||
# TD BUGS
|
# TD BUGS
|
||||||
self.FIX_TD_30686()
|
self.FIX_TD_30686()
|
||||||
|
self.FIX_TD_31684()
|
||||||
|
|
||||||
# TS BUGS
|
# TS BUGS
|
||||||
self.FIX_TS_5105()
|
self.FIX_TS_5105()
|
||||||
|
|
|
@ -1170,7 +1170,7 @@ void testDetailError() {
|
||||||
int32_t code = tmq_write_raw((TAOS*)1, raw);
|
int32_t code = tmq_write_raw((TAOS*)1, raw);
|
||||||
ASSERT(code);
|
ASSERT(code);
|
||||||
const char* err = tmq_err2str(code);
|
const char* err = tmq_err2str(code);
|
||||||
char* tmp = strstr(err, "Invalid parameters,detail:taos:0x1 or data");
|
char* tmp = strstr(err, "Invalid parameters,detail:taos:");
|
||||||
ASSERT(tmp != NULL);
|
ASSERT(tmp != NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue