Merge branch '3.0' of https://github.com/taosdata/TDengine into 3.0
This commit is contained in:
commit
b9c39b59fc
|
@ -118,21 +118,32 @@ curl -L -u username:password -d "<SQL>" <ip>:<PORT>/rest/sql/[db_name][?tz=timez
|
|||
|
||||
### HTTP 响应码
|
||||
|
||||
从 `TDengine 3.0.3.0` 开始 `taosAdapter` 提供配置参数 `httpCodeServerError` 用来设置当 C 接口返回错误时是否返回非 200 的http状态码。
|
||||
无论是否设置此参数,响应 body 里都有详细的错误码和错误信息,具体请参考 [错误](../rest-api/#错误) 。
|
||||
默认情况下,`taosAdapter` 对大多数 C 接口调用出错时也会返回 200 响应码,但是 HTTP body 中包含错误信息。从 `TDengine 3.0.3.0` 开始 `taosAdapter` 提供配置参数 `httpCodeServerError` 用来设置当 C 接口返回错误时是否返回非 200 的 HTTP 响应码。无论是否设置此参数,响应 body 里都有详细的错误码和错误信息,具体请参考 [错误](../rest-api/#错误) 。
|
||||
|
||||
| **说明** | **httpCodeServerError false** | **httpCodeServerError true** |
|
||||
|--------------------|-------------------------------|---------------------------------------|
|
||||
| taos_errno() 返回 0 | 200 | 200 |
|
||||
| taos_errno() 返回 非0 | 200(除鉴权错误) | 500 (除鉴权错误和 400/502/503 错误) |
|
||||
| 参数错误 | 400(仅处理 HTTP 请求 URL 参数错误) | 400 (处理 HTTP 请求 URL 参数错误和 taosd 返回错误) |
|
||||
| 鉴权错误 | 401 | 401 |
|
||||
| 接口不存在 | 404 | 404 |
|
||||
| 集群不可用错误 | 502 | 502 |
|
||||
| 系统资源不足 | 503 | 503 |
|
||||
**当 httpCodeServerError 为 false 时:**
|
||||
|
||||
返回 400 的 C 错误码为:
|
||||
| **分类说明** |**HTTP 响应码** |
|
||||
|--------------------|-------------------------------|
|
||||
| C 接口调用成功 | 200 | 200 |
|
||||
| C 接口调用出错,且不是鉴权错误 | 200 |
|
||||
| HTTP 请求 URL 参数错误 | 400 |
|
||||
| C 接口调用鉴权错误 | 401 |
|
||||
| 接口不存在 | 404 |
|
||||
| 系统资源不足 | 503 |
|
||||
|
||||
**当 httpCodeServerError 为 true 时:**
|
||||
|
||||
| **分类说明** | **HTTP 响应码** |
|
||||
|--------------------|-------------------------------|
|
||||
| C 接口调用成功 | 200 |
|
||||
| HTTP 请求 URL 参数错误和 C 接口调用参数解析错误 | 400 |
|
||||
| C 接口调用鉴权错误 | 401 |
|
||||
| 接口不存在 | 404 |
|
||||
| C 接口调用网络不可用错误 | 502 |
|
||||
| 系统资源不足 |503 |
|
||||
| 其他 C 接口调用错误 | 500 |
|
||||
|
||||
C 接口参数解析相关错误码:
|
||||
- TSDB_CODE_TSC_SQL_SYNTAX_ERROR (0x0216)
|
||||
- TSDB_CODE_TSC_LINE_SYNTAX_ERROR (0x021B)
|
||||
- TSDB_CODE_PAR_SYNTAX_ERROR (0x2600)
|
||||
|
@ -140,7 +151,7 @@ curl -L -u username:password -d "<SQL>" <ip>:<PORT>/rest/sql/[db_name][?tz=timez
|
|||
- TSDB_CODE_TSC_VALUE_OUT_OF_RANGE (0x0224)
|
||||
- TSDB_CODE_PAR_INVALID_FILL_TIME_RANGE (0x263B)
|
||||
|
||||
返回 401 的错误码为:
|
||||
C 接口鉴权相关错误码:
|
||||
|
||||
- TSDB_CODE_MND_USER_ALREADY_EXIST (0x0350)
|
||||
- TSDB_CODE_MND_USER_NOT_EXIST (0x0351)
|
||||
|
@ -151,7 +162,7 @@ curl -L -u username:password -d "<SQL>" <ip>:<PORT>/rest/sql/[db_name][?tz=timez
|
|||
- TSDB_CODE_MND_INVALID_ALTER_OPER (0x0356)
|
||||
- TSDB_CODE_MND_AUTH_FAILURE (0x0357)
|
||||
|
||||
返回 502 的错误码为:
|
||||
C 接口网络不可用相关错误码:
|
||||
|
||||
- TSDB_CODE_RPC_NETWORK_UNAVAIL (0x000B)
|
||||
|
||||
|
|
|
@ -2817,7 +2817,7 @@ enum {
|
|||
TOPIC_SUB_TYPE__COLUMN,
|
||||
};
|
||||
|
||||
#define DEFAULT_MAX_POLL_INTERVAL 3000000
|
||||
#define DEFAULT_MAX_POLL_INTERVAL 300000
|
||||
#define DEFAULT_SESSION_TIMEOUT 12000
|
||||
|
||||
typedef struct {
|
||||
|
|
|
@ -49,7 +49,7 @@ int32_t toUInteger(const char *z, int32_t n, int32_t base, uint64_t *value);
|
|||
*/
|
||||
int32_t toIntegerPure(const char *z, int32_t n, int32_t base, int64_t *value);
|
||||
|
||||
void taosVariantCreateFromBinary(SVariant *pVar, const char *pz, size_t len, uint32_t type);
|
||||
int32_t taosVariantCreateFromBinary(SVariant *pVar, const char *pz, size_t len, uint32_t type);
|
||||
|
||||
void taosVariantDestroy(SVariant *pV);
|
||||
|
||||
|
|
|
@ -119,9 +119,9 @@ void mndPostProcessQueryMsg(SRpcMsg *pMsg);
|
|||
*/
|
||||
void mndGenerateMachineCode();
|
||||
|
||||
void mndDumpSdb();
|
||||
int32_t mndDumpSdb();
|
||||
|
||||
void mndDeleteTrans();
|
||||
int32_t mndDeleteTrans();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -173,6 +173,7 @@ int32_t nodesNodeToSQL(SNode* pNode, char* buf, int32_t bufSize, int32_t* len);
|
|||
char* nodesGetNameFromColumnNode(SNode* pNode);
|
||||
int32_t nodesGetOutputNumFromSlotList(SNodeList* pSlots);
|
||||
void nodesSortList(SNodeList** pList, int32_t (*)(SNode* pNode1, SNode* pNode2));
|
||||
void destroyFuncParam(void* pFuncStruct);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -57,7 +57,6 @@ typedef struct SExprNode {
|
|||
char aliasName[TSDB_COL_NAME_LEN];
|
||||
char userAlias[TSDB_COL_NAME_LEN];
|
||||
SArray* pAssociation;
|
||||
bool orderAlias;
|
||||
bool asAlias;
|
||||
bool asParam;
|
||||
bool asPosition;
|
||||
|
|
|
@ -736,6 +736,16 @@ static void monitorSendAllSlowLogFromTempDir(int64_t clusterId) {
|
|||
continue;
|
||||
}
|
||||
char* tmp = taosStrdup(filename);
|
||||
if (tmp == NULL) {
|
||||
tscError("failed to dup string:%s since %s", filename, terrstr());
|
||||
if (taosUnLockFile(pFile) != 0) {
|
||||
tscError("failed to unlock file:%s, terrno:%d", filename, terrno);
|
||||
}
|
||||
if (taosCloseFile(&(pFile)) != 0) {
|
||||
tscError("failed to close file:%s, terrno:%d", filename, terrno);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
monitorSendSlowLogAtBeginning(clusterId, &tmp, pFile, 0);
|
||||
taosMemoryFree(tmp);
|
||||
}
|
||||
|
|
|
@ -1939,6 +1939,10 @@ int32_t smlClearForRerun(SSmlHandle *info) {
|
|||
return TSDB_CODE_SML_INVALID_DATA;
|
||||
}
|
||||
info->lines = (SSmlLineInfo *)taosMemoryCalloc(info->lineNum, sizeof(SSmlLineInfo));
|
||||
if (unlikely(info->lines == NULL)) {
|
||||
uError("SML:0x%" PRIx64 " info->lines == NULL", info->id);
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
|
||||
(void)memset(&info->preLine, 0, sizeof(SSmlLineInfo));
|
||||
|
@ -1971,10 +1975,14 @@ static bool getLine(SSmlHandle *info, char *lines[], char **rawLine, char *rawLi
|
|||
|
||||
if (*rawLine != NULL && (uDebugFlag & DEBUG_DEBUG)) {
|
||||
char *print = taosMemoryCalloc(*len + 1, 1);
|
||||
if (print != NULL){
|
||||
(void)memcpy(print, *tmp, *len);
|
||||
uDebug("SML:0x%" PRIx64 " smlParseLine is raw, numLines:%d, protocol:%d, len:%d, data:%s", info->id, numLines,
|
||||
info->protocol, *len, print);
|
||||
taosMemoryFree(print);
|
||||
} else{
|
||||
uError("SML:0x%" PRIx64 " smlParseLine taosMemoryCalloc failed", info->id);
|
||||
}
|
||||
} else {
|
||||
uDebug("SML:0x%" PRIx64 " smlParseLine is not numLines:%d, protocol:%d, len:%d, data:%s", info->id, numLines,
|
||||
info->protocol, *len, *tmp);
|
||||
|
|
|
@ -300,6 +300,7 @@ void tmq_conf_destroy(tmq_conf_t* conf) {
|
|||
tmq_conf_res_t tmq_conf_set(tmq_conf_t* conf, const char* key, const char* value) {
|
||||
int32_t code = 0;
|
||||
if (conf == NULL || key == NULL || value == NULL) {
|
||||
tscError("tmq_conf_set null, conf:%p key:%p value:%p", conf, key, value);
|
||||
return TMQ_CONF_INVALID;
|
||||
}
|
||||
if (strcasecmp(key, "group.id") == 0) {
|
||||
|
@ -320,6 +321,7 @@ tmq_conf_res_t tmq_conf_set(tmq_conf_t* conf, const char* key, const char* value
|
|||
conf->autoCommit = false;
|
||||
return TMQ_CONF_OK;
|
||||
} else {
|
||||
tscError("invalid value for enable.auto.commit: %s", value);
|
||||
return TMQ_CONF_INVALID;
|
||||
}
|
||||
}
|
||||
|
@ -328,6 +330,7 @@ tmq_conf_res_t tmq_conf_set(tmq_conf_t* conf, const char* key, const char* value
|
|||
int64_t tmp;
|
||||
code = taosStr2int64(value, &tmp);
|
||||
if (tmp < 0 || code != 0) {
|
||||
tscError("invalid value for auto.commit.interval.ms: %s", value);
|
||||
return TMQ_CONF_INVALID;
|
||||
}
|
||||
conf->autoCommitInterval = (tmp > INT32_MAX ? INT32_MAX : tmp);
|
||||
|
@ -338,6 +341,7 @@ tmq_conf_res_t tmq_conf_set(tmq_conf_t* conf, const char* key, const char* value
|
|||
int64_t tmp;
|
||||
code = taosStr2int64(value, &tmp);
|
||||
if (tmp < 6000 || tmp > 1800000 || code != 0) {
|
||||
tscError("invalid value for session.timeout.ms: %s", value);
|
||||
return TMQ_CONF_INVALID;
|
||||
}
|
||||
conf->sessionTimeoutMs = tmp;
|
||||
|
@ -348,6 +352,7 @@ tmq_conf_res_t tmq_conf_set(tmq_conf_t* conf, const char* key, const char* value
|
|||
int64_t tmp;
|
||||
code = taosStr2int64(value, &tmp);
|
||||
if (tmp < 1000 || tmp >= conf->sessionTimeoutMs || code != 0) {
|
||||
tscError("invalid value for heartbeat.interval.ms: %s", value);
|
||||
return TMQ_CONF_INVALID;
|
||||
}
|
||||
conf->heartBeatIntervalMs = tmp;
|
||||
|
@ -358,6 +363,7 @@ tmq_conf_res_t tmq_conf_set(tmq_conf_t* conf, const char* key, const char* value
|
|||
int32_t tmp;
|
||||
code = taosStr2int32(value, &tmp);
|
||||
if (tmp < 1000 || code != 0) {
|
||||
tscError("invalid value for max.poll.interval.ms: %s", value);
|
||||
return TMQ_CONF_INVALID;
|
||||
}
|
||||
conf->maxPollIntervalMs = tmp;
|
||||
|
@ -375,6 +381,7 @@ tmq_conf_res_t tmq_conf_set(tmq_conf_t* conf, const char* key, const char* value
|
|||
conf->resetOffset = TMQ_OFFSET__RESET_LATEST;
|
||||
return TMQ_CONF_OK;
|
||||
} else {
|
||||
tscError("invalid value for auto.offset.reset: %s", value);
|
||||
return TMQ_CONF_INVALID;
|
||||
}
|
||||
}
|
||||
|
@ -387,6 +394,7 @@ tmq_conf_res_t tmq_conf_set(tmq_conf_t* conf, const char* key, const char* value
|
|||
conf->withTbName = false;
|
||||
return TMQ_CONF_OK;
|
||||
} else {
|
||||
tscError("invalid value for msg.with.table.name: %s", value);
|
||||
return TMQ_CONF_INVALID;
|
||||
}
|
||||
}
|
||||
|
@ -399,22 +407,38 @@ tmq_conf_res_t tmq_conf_set(tmq_conf_t* conf, const char* key, const char* value
|
|||
conf->snapEnable = false;
|
||||
return TMQ_CONF_OK;
|
||||
} else {
|
||||
tscError("invalid value for experimental.snapshot.enable: %s", value);
|
||||
return TMQ_CONF_INVALID;
|
||||
}
|
||||
}
|
||||
|
||||
if (strcasecmp(key, "td.connect.ip") == 0) {
|
||||
conf->ip = taosStrdup(value);
|
||||
void *tmp = taosStrdup(value);
|
||||
if (tmp == NULL) {
|
||||
tscError("tmq_conf_set out of memory:%d", terrno);
|
||||
return TMQ_CONF_INVALID;
|
||||
}
|
||||
conf->ip = tmp;
|
||||
return TMQ_CONF_OK;
|
||||
}
|
||||
|
||||
if (strcasecmp(key, "td.connect.user") == 0) {
|
||||
conf->user = taosStrdup(value);
|
||||
void *tmp = taosStrdup(value);
|
||||
if (tmp == NULL) {
|
||||
tscError("tmq_conf_set out of memory:%d", terrno);
|
||||
return TMQ_CONF_INVALID;
|
||||
}
|
||||
conf->user = tmp;
|
||||
return TMQ_CONF_OK;
|
||||
}
|
||||
|
||||
if (strcasecmp(key, "td.connect.pass") == 0) {
|
||||
conf->pass = taosStrdup(value);
|
||||
void *tmp = taosStrdup(value);
|
||||
if (tmp == NULL) {
|
||||
tscError("tmq_conf_set out of memory:%d", terrno);
|
||||
return TMQ_CONF_INVALID;
|
||||
}
|
||||
conf->pass = tmp;
|
||||
return TMQ_CONF_OK;
|
||||
}
|
||||
|
||||
|
@ -422,6 +446,7 @@ tmq_conf_res_t tmq_conf_set(tmq_conf_t* conf, const char* key, const char* value
|
|||
int64_t tmp;
|
||||
code = taosStr2int64(value, &tmp);
|
||||
if (tmp <= 0 || tmp > 65535 || code != 0) {
|
||||
tscError("invalid value for td.connect.port: %s", value);
|
||||
return TMQ_CONF_INVALID;
|
||||
}
|
||||
|
||||
|
@ -437,6 +462,7 @@ tmq_conf_res_t tmq_conf_set(tmq_conf_t* conf, const char* key, const char* value
|
|||
conf->replayEnable = false;
|
||||
return TMQ_CONF_OK;
|
||||
} else {
|
||||
tscError("invalid value for enable.replay: %s", value);
|
||||
return TMQ_CONF_INVALID;
|
||||
}
|
||||
}
|
||||
|
@ -458,6 +484,7 @@ tmq_conf_res_t tmq_conf_set(tmq_conf_t* conf, const char* key, const char* value
|
|||
return TMQ_CONF_OK;
|
||||
}
|
||||
|
||||
tscError("unknown key: %s", key);
|
||||
return TMQ_CONF_UNKNOWN;
|
||||
}
|
||||
|
||||
|
@ -468,7 +495,11 @@ int32_t tmq_list_append(tmq_list_t* list, const char* src) {
|
|||
SArray* container = &list->container;
|
||||
if (src == NULL || src[0] == 0) return TSDB_CODE_INVALID_PARA;
|
||||
char* topic = taosStrdup(src);
|
||||
if (taosArrayPush(container, &topic) == NULL) return TSDB_CODE_INVALID_PARA;
|
||||
if (topic == NULL) return terrno;
|
||||
if (taosArrayPush(container, &topic) == NULL) {
|
||||
taosMemoryFree(topic);
|
||||
return terrno;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -947,13 +978,13 @@ void tmqSendHbReq(void* param, void* tmrId) {
|
|||
|
||||
int32_t tlen = tSerializeSMqHbReq(NULL, 0, &req);
|
||||
if (tlen < 0) {
|
||||
tscError("tSerializeSMqHbReq failed");
|
||||
tscError("tSerializeSMqHbReq failed, size:%d", tlen);
|
||||
goto OVER;
|
||||
}
|
||||
|
||||
void* pReq = taosMemoryCalloc(1, tlen);
|
||||
if (tlen < 0) {
|
||||
tscError("failed to malloc MqHbReq msg, size:%d", tlen);
|
||||
if (pReq == NULL) {
|
||||
tscError("failed to malloc MqHbReq msg, code:%d", terrno);
|
||||
goto OVER;
|
||||
}
|
||||
|
||||
|
@ -3514,6 +3545,10 @@ int32_t tmq_get_topic_assignment(tmq_t* tmq, const char* pTopicName, tmq_topic_a
|
|||
}
|
||||
(void)taosThreadMutexInit(&pCommon->mutex, 0);
|
||||
pCommon->pTopicName = taosStrdup(pTopic->topicName);
|
||||
if (pCommon->pTopicName == NULL) {
|
||||
code = terrno;
|
||||
goto end;
|
||||
}
|
||||
pCommon->consumerId = tmq->consumerId;
|
||||
|
||||
for (int32_t i = 0; i < (*numOfAssignment); ++i) {
|
||||
|
|
|
@ -1092,6 +1092,9 @@ int32_t taosSetSlowLogScope(char *pScopeStr, int32_t *pScope) {
|
|||
while((scope = strsep(&pScopeStr, "|")) != NULL){
|
||||
taosMemoryFreeClear(tmp);
|
||||
tmp = taosStrdup(scope);
|
||||
if (tmp == NULL) {
|
||||
TAOS_RETURN(terrno);
|
||||
}
|
||||
(void)strtrim(tmp);
|
||||
if (0 == strcasecmp(tmp, "all")) {
|
||||
slowScope |= SLOW_LOG_TYPE_ALL;
|
||||
|
|
|
@ -143,7 +143,7 @@ bool tNameIsValid(const SName* name) {
|
|||
|
||||
SName* tNameDup(const SName* name) {
|
||||
SName* p = taosMemoryMalloc(sizeof(SName));
|
||||
memcpy(p, name, sizeof(SName));
|
||||
if (p) TAOS_MEMCPY(p, name, sizeof(SName));
|
||||
return p;
|
||||
}
|
||||
|
||||
|
|
|
@ -368,7 +368,7 @@ int32_t toUInteger(const char *z, int32_t n, int32_t base, uint64_t *value) {
|
|||
* @param len
|
||||
* @param type
|
||||
*/
|
||||
void taosVariantCreateFromBinary(SVariant *pVar, const char *pz, size_t len, uint32_t type) {
|
||||
int32_t taosVariantCreateFromBinary(SVariant *pVar, const char *pz, size_t len, uint32_t type) {
|
||||
switch (type) {
|
||||
case TSDB_DATA_TYPE_BOOL:
|
||||
case TSDB_DATA_TYPE_TINYINT: {
|
||||
|
@ -426,6 +426,7 @@ void taosVariantCreateFromBinary(SVariant *pVar, const char *pz, size_t len, uin
|
|||
size_t lenInwchar = len / TSDB_NCHAR_SIZE;
|
||||
|
||||
pVar->ucs4 = taosMemoryCalloc(1, (lenInwchar + 1) * TSDB_NCHAR_SIZE);
|
||||
if(!pVar->ucs4) return terrno;
|
||||
(void)memcpy(pVar->ucs4, pz, lenInwchar * TSDB_NCHAR_SIZE);
|
||||
pVar->nLen = (int32_t)len;
|
||||
|
||||
|
@ -446,6 +447,7 @@ void taosVariantCreateFromBinary(SVariant *pVar, const char *pz, size_t len, uin
|
|||
}
|
||||
|
||||
pVar->nType = type;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void taosVariantDestroy(SVariant *pVar) {
|
||||
|
|
|
@ -433,7 +433,8 @@ int mainWindows(int argc, char **argv) {
|
|||
}
|
||||
|
||||
if (global.dumpSdb) {
|
||||
mndDumpSdb();
|
||||
int32_t code = 0;
|
||||
TAOS_CHECK_RETURN(mndDumpSdb());
|
||||
taosCleanupCfg();
|
||||
taosCloseLog();
|
||||
taosCleanupArgs();
|
||||
|
@ -442,6 +443,7 @@ int mainWindows(int argc, char **argv) {
|
|||
}
|
||||
|
||||
if (global.deleteTrans) {
|
||||
int32_t code = 0;
|
||||
TdFilePtr pFile;
|
||||
if ((code = dmCheckRunning(tsDataDir, &pFile)) != 0) {
|
||||
printf("failed to generate encrypt code since taosd is running, please stop it first, reason:%s",
|
||||
|
@ -449,7 +451,7 @@ int mainWindows(int argc, char **argv) {
|
|||
return code;
|
||||
}
|
||||
|
||||
mndDeleteTrans();
|
||||
TAOS_CHECK_RETURN(mndDeleteTrans());
|
||||
taosCleanupCfg();
|
||||
taosCloseLog();
|
||||
taosCleanupArgs();
|
||||
|
|
|
@ -24,6 +24,12 @@ static inline void dmBuildMnodeRedirectRsp(SDnode *pDnode, SRpcMsg *pMsg) {
|
|||
SEpSet epSet = {0};
|
||||
dmGetMnodeEpSetForRedirect(&pDnode->data, pMsg, &epSet);
|
||||
|
||||
if (epSet.numOfEps <= 1) {
|
||||
pMsg->pCont = NULL;
|
||||
pMsg->code = TSDB_CODE_MNODE_NOT_FOUND;
|
||||
return;
|
||||
}
|
||||
|
||||
int32_t contLen = tSerializeSEpSet(NULL, 0, &epSet);
|
||||
pMsg->pCont = rpcMallocCont(contLen);
|
||||
if (pMsg->pCont == NULL) {
|
||||
|
@ -109,7 +115,8 @@ static void dmProcessRpcMsg(SDnode *pDnode, SRpcMsg *pRpc, SEpSet *pEpSet) {
|
|||
int32_t svrVer = 0;
|
||||
(void)taosVersionStrToInt(version, &svrVer);
|
||||
if ((code = taosCheckVersionCompatible(pRpc->info.cliVer, svrVer, 3)) != 0) {
|
||||
dError("Version not compatible, cli ver: %d, svr ver: %d, ip:0x%x", pRpc->info.cliVer, svrVer, pRpc->info.conn.clientIp);
|
||||
dError("Version not compatible, cli ver: %d, svr ver: %d, ip:0x%x", pRpc->info.cliVer, svrVer,
|
||||
pRpc->info.conn.clientIp);
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@ extern "C" {
|
|||
#define MND_STREAM_TASK_UPDATE_NAME "stream-task-update"
|
||||
#define MND_STREAM_CHKPT_UPDATE_NAME "stream-chkpt-update"
|
||||
#define MND_STREAM_CHKPT_CONSEN_NAME "stream-chkpt-consen"
|
||||
#define MND_STREAM_RESTART_NAME "stream-restart"
|
||||
|
||||
typedef struct SStreamTransInfo {
|
||||
int64_t startTime;
|
||||
|
@ -120,6 +121,7 @@ int32_t mndStreamGetRelTrans(SMnode *pMnode, int64_t streamId);
|
|||
int32_t mndGetNumOfStreams(SMnode *pMnode, char *dbName, int32_t *pNumOfStreams);
|
||||
int32_t mndGetNumOfStreamTasks(const SStreamObj *pStream);
|
||||
int32_t mndTakeVgroupSnapshot(SMnode *pMnode, bool *allReady, SArray** pList);
|
||||
void mndDestroyVgroupChangeInfo(SVgroupChangeInfo *pInfo);
|
||||
void mndKillTransImpl(SMnode *pMnode, int32_t transId, const char *pDbName);
|
||||
int32_t setTransAction(STrans *pTrans, void *pCont, int32_t contLen, int32_t msgType, const SEpSet *pEpset,
|
||||
int32_t retryCode, int32_t acceptCode);
|
||||
|
@ -127,31 +129,39 @@ int32_t doCreateTrans(SMnode *pMnode, SStreamObj *pStream, SRpcMsg *pReq, ETrnC
|
|||
const char *pMsg, STrans **pTrans1);
|
||||
int32_t mndPersistTransLog(SStreamObj *pStream, STrans *pTrans, int32_t status);
|
||||
SSdbRaw *mndStreamActionEncode(SStreamObj *pStream);
|
||||
void killAllCheckpointTrans(SMnode *pMnode, SVgroupChangeInfo *pChangeInfo);
|
||||
int32_t mndStreamSetUpdateEpsetAction(SMnode *pMnode, SStreamObj *pStream, SVgroupChangeInfo *pInfo, STrans *pTrans);
|
||||
|
||||
int32_t mndGetStreamObj(SMnode *pMnode, int64_t streamId, SStreamObj** pStream);
|
||||
bool mndStreamNodeIsUpdated(SMnode *pMnode);
|
||||
|
||||
int32_t extractNodeEpset(SMnode *pMnode, SEpSet *pEpSet, bool *hasEpset, int32_t taskId, int32_t nodeId);
|
||||
int32_t mndProcessStreamHb(SRpcMsg *pReq);
|
||||
void saveTaskAndNodeInfoIntoBuf(SStreamObj *pStream, SStreamExecInfo *pExecNode);
|
||||
int32_t extractStreamNodeList(SMnode *pMnode);
|
||||
int32_t mndStreamSetResumeAction(STrans *pTrans, SMnode *pMnode, SStreamObj *pStream, int8_t igUntreated);
|
||||
int32_t mndStreamSetPauseAction(SMnode *pMnode, STrans *pTrans, SStreamObj *pStream);
|
||||
int32_t mndStreamSetDropAction(SMnode *pMnode, STrans *pTrans, SStreamObj *pStream);
|
||||
int32_t mndStreamSetDropActionFromList(SMnode *pMnode, STrans *pTrans, SArray *pList);
|
||||
int32_t mndStreamSetResetTaskAction(SMnode *pMnode, STrans *pTrans, SStreamObj *pStream);
|
||||
int32_t mndCreateStreamResetStatusTrans(SMnode *pMnode, SStreamObj *pStream);
|
||||
int32_t mndStreamSetUpdateChkptAction(SMnode *pMnode, STrans *pTrans, SStreamObj *pStream);
|
||||
int32_t mndCreateStreamResetStatusTrans(SMnode *pMnode, SStreamObj *pStream);
|
||||
int32_t mndStreamSetChkptIdAction(SMnode *pMnode, STrans *pTrans, SStreamTask* pTask, int64_t checkpointId, int64_t ts);
|
||||
int32_t mndStreamSetRestartAction(SMnode* pMnode, STrans *pTrans, SStreamObj* pStream);
|
||||
int32_t mndStreamSetCheckpointAction(SMnode *pMnode, STrans *pTrans, SStreamTask *pTask, int64_t checkpointId,
|
||||
int8_t mndTrigger);
|
||||
int32_t mndCreateStreamChkptInfoUpdateTrans(SMnode *pMnode, SStreamObj *pStream, SArray *pChkptInfoList);
|
||||
int32_t mndScanCheckpointReportInfo(SRpcMsg *pReq);
|
||||
int32_t mndCreateSetConsensusChkptIdTrans(SMnode *pMnode, SStreamObj *pStream, int32_t taskId, int64_t checkpointId,
|
||||
int64_t ts);
|
||||
void removeTasksInBuf(SArray *pTaskIds, SStreamExecInfo *pExecInfo);
|
||||
int32_t mndFindChangedNodeInfo(SMnode *pMnode, const SArray *pPrevNodeList, const SArray *pNodeList,
|
||||
SVgroupChangeInfo *pInfo);
|
||||
void killAllCheckpointTrans(SMnode *pMnode, SVgroupChangeInfo *pChangeInfo);
|
||||
|
||||
int32_t createStreamTaskIter(SStreamObj *pStream, SStreamTaskIter **pIter);
|
||||
void destroyStreamTaskIter(SStreamTaskIter *pIter);
|
||||
bool streamTaskIterNextTask(SStreamTaskIter *pIter);
|
||||
int32_t streamTaskIterGetCurrent(SStreamTaskIter *pIter, SStreamTask **pTask);
|
||||
|
||||
int32_t mndInitExecInfo();
|
||||
void mndInitStreamExecInfo(SMnode *pMnode, SStreamExecInfo *pExecInfo);
|
||||
void mndStreamResetInitTaskListLoadFlag();
|
||||
|
|
|
@ -287,6 +287,8 @@ int32_t mndRetrieveCompact(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock,
|
|||
SCompactObj *pCompact = NULL;
|
||||
char *sep = NULL;
|
||||
SDbObj *pDb = NULL;
|
||||
int32_t code = 0;
|
||||
int32_t lino = 0;
|
||||
|
||||
if (strlen(pShow->db) > 0) {
|
||||
sep = strchr(pShow->db, '.');
|
||||
|
@ -310,26 +312,30 @@ int32_t mndRetrieveCompact(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock,
|
|||
char tmpBuf[TSDB_SHOW_SQL_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&pCompact->compactId, false);
|
||||
RETRIEVE_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, (const char *)&pCompact->compactId, false), pCompact, &lino,
|
||||
_OVER);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
if (pDb != NULL || !IS_SYS_DBNAME(pCompact->dbname)) {
|
||||
SName name = {0};
|
||||
(void)tNameFromString(&name, pCompact->dbname, T_NAME_ACCT | T_NAME_DB);
|
||||
TAOS_CHECK_GOTO(tNameFromString(&name, pCompact->dbname, T_NAME_ACCT | T_NAME_DB), &lino, _OVER);
|
||||
(void)tNameGetDbName(&name, varDataVal(tmpBuf));
|
||||
} else {
|
||||
(void)strncpy(varDataVal(tmpBuf), pCompact->dbname, TSDB_SHOW_SQL_LEN);
|
||||
}
|
||||
varDataSetLen(tmpBuf, strlen(varDataVal(tmpBuf)));
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)tmpBuf, false);
|
||||
RETRIEVE_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, (const char *)tmpBuf, false), pCompact, &lino, _OVER);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&pCompact->startTime, false);
|
||||
RETRIEVE_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, (const char *)&pCompact->startTime, false), pCompact, &lino,
|
||||
_OVER);
|
||||
|
||||
numOfRows++;
|
||||
sdbRelease(pSdb, pCompact);
|
||||
}
|
||||
|
||||
_OVER:
|
||||
if (code != 0) mError("failed to retrieve at line:%d, since %s", lino, tstrerror(code));
|
||||
pShow->numOfRows += numOfRows;
|
||||
mndReleaseDb(pMnode, pDb);
|
||||
return numOfRows;
|
||||
|
@ -468,7 +474,7 @@ static int32_t mndKillCompact(SMnode *pMnode, SRpcMsg *pReq, SCompactObj *pCompa
|
|||
mndTransDrop(pTrans);
|
||||
return -1;
|
||||
}
|
||||
(void)sdbSetRawStatus(pCommitRaw, SDB_STATUS_DROPPED);
|
||||
sdbSetRawStatus(pCommitRaw, SDB_STATUS_DROPPED);
|
||||
*/
|
||||
}
|
||||
|
||||
|
|
|
@ -463,6 +463,15 @@ static void freeItem(void *param) {
|
|||
}
|
||||
}
|
||||
|
||||
#define ADD_TOPIC_TO_ARRAY(element, array) \
|
||||
char *newTopicCopy = taosStrdup(element); \
|
||||
MND_TMQ_NULL_CHECK(newTopicCopy);\
|
||||
if (taosArrayPush(pConsumerNew->array, &newTopicCopy) == NULL){\
|
||||
taosMemoryFree(newTopicCopy);\
|
||||
code = terrno;\
|
||||
goto END;\
|
||||
}
|
||||
|
||||
static int32_t getTopicAddDelete(SMqConsumerObj *pExistedConsumer, SMqConsumerObj *pConsumerNew){
|
||||
int32_t code = 0;
|
||||
pConsumerNew->rebNewTopics = taosArrayInit(0, sizeof(void *));
|
||||
|
@ -477,15 +486,13 @@ static int32_t getTopicAddDelete(SMqConsumerObj *pExistedConsumer, SMqConsumerOb
|
|||
if (i >= oldTopicNum) {
|
||||
void* tmp = taosArrayGetP(pConsumerNew->assignedTopics, j);
|
||||
MND_TMQ_NULL_CHECK(tmp);
|
||||
char *newTopicCopy = taosStrdup(tmp);
|
||||
MND_TMQ_NULL_CHECK(taosArrayPush(pConsumerNew->rebNewTopics, &newTopicCopy));
|
||||
ADD_TOPIC_TO_ARRAY(tmp, rebNewTopics);
|
||||
j++;
|
||||
continue;
|
||||
} else if (j >= newTopicNum) {
|
||||
void* tmp = taosArrayGetP(pExistedConsumer->currentTopics, i);
|
||||
MND_TMQ_NULL_CHECK(tmp);
|
||||
char *oldTopicCopy = taosStrdup(tmp);
|
||||
MND_TMQ_NULL_CHECK(taosArrayPush(pConsumerNew->rebRemovedTopics, &oldTopicCopy));
|
||||
ADD_TOPIC_TO_ARRAY(tmp, rebRemovedTopics);
|
||||
i++;
|
||||
continue;
|
||||
} else {
|
||||
|
@ -499,13 +506,11 @@ static int32_t getTopicAddDelete(SMqConsumerObj *pExistedConsumer, SMqConsumerOb
|
|||
j++;
|
||||
continue;
|
||||
} else if (comp < 0) {
|
||||
char *oldTopicCopy = taosStrdup(oldTopic);
|
||||
MND_TMQ_NULL_CHECK(taosArrayPush(pConsumerNew->rebRemovedTopics, &oldTopicCopy));
|
||||
ADD_TOPIC_TO_ARRAY(oldTopic, rebRemovedTopics);
|
||||
i++;
|
||||
continue;
|
||||
} else {
|
||||
char *newTopicCopy = taosStrdup(newTopic);
|
||||
MND_TMQ_NULL_CHECK(taosArrayPush(pConsumerNew->rebNewTopics, &newTopicCopy));
|
||||
ADD_TOPIC_TO_ARRAY(newTopic, rebNewTopics);
|
||||
j++;
|
||||
continue;
|
||||
}
|
||||
|
@ -789,6 +794,9 @@ static int32_t mndConsumerActionUpdate(SSdb *pSdb, SMqConsumerObj *pOldConsumer,
|
|||
return TSDB_CODE_TMQ_INVALID_MSG;
|
||||
}
|
||||
char *pNewTopic = taosStrdup(tmp);
|
||||
if (pNewTopic == NULL) {
|
||||
return terrno;
|
||||
}
|
||||
removeFromTopicList(pOldConsumer->rebNewTopics, pNewTopic, pOldConsumer->consumerId, "new");
|
||||
bool existing = existInCurrentTopicList(pOldConsumer, pNewTopic);
|
||||
if (existing) {
|
||||
|
|
|
@ -981,7 +981,8 @@ static int32_t mndProcessCreateDbReq(SRpcMsg *pReq) {
|
|||
if (code == 0) code = TSDB_CODE_ACTION_IN_PROGRESS;
|
||||
|
||||
SName name = {0};
|
||||
(void)tNameFromString(&name, createReq.db, T_NAME_ACCT | T_NAME_DB);
|
||||
if (tNameFromString(&name, createReq.db, T_NAME_ACCT | T_NAME_DB) < 0)
|
||||
mError("db:%s, failed to parse db name", createReq.db);
|
||||
|
||||
auditRecord(pReq, pMnode->clusterId, "createDB", name.dbname, "", createReq.sql, createReq.sqlLen);
|
||||
|
||||
|
@ -1135,7 +1136,10 @@ static int32_t mndSetAlterDbPrepareLogs(SMnode *pMnode, STrans *pTrans, SDbObj *
|
|||
TAOS_RETURN(code);
|
||||
}
|
||||
|
||||
(void)sdbSetRawStatus(pRedoRaw, SDB_STATUS_READY);
|
||||
if ((code = sdbSetRawStatus(pRedoRaw, SDB_STATUS_READY)) != 0) {
|
||||
sdbFreeRaw(pRedoRaw);
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1152,7 +1156,10 @@ static int32_t mndSetAlterDbCommitLogs(SMnode *pMnode, STrans *pTrans, SDbObj *p
|
|||
TAOS_RETURN(code);
|
||||
}
|
||||
|
||||
(void)sdbSetRawStatus(pCommitRaw, SDB_STATUS_READY);
|
||||
if ((code = sdbSetRawStatus(pCommitRaw, SDB_STATUS_READY)) != 0) {
|
||||
sdbFreeRaw(pCommitRaw);
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
|
||||
|
@ -1284,7 +1291,8 @@ static int32_t mndProcessAlterDbReq(SRpcMsg *pReq) {
|
|||
}
|
||||
|
||||
SName name = {0};
|
||||
(void)tNameFromString(&name, alterReq.db, T_NAME_ACCT | T_NAME_DB);
|
||||
if (tNameFromString(&name, alterReq.db, T_NAME_ACCT | T_NAME_DB) < 0)
|
||||
mError("db:%s, failed to parse db name", alterReq.db);
|
||||
|
||||
auditRecord(pReq, pMnode->clusterId, "alterDB", name.dbname, "", alterReq.sql, alterReq.sqlLen);
|
||||
|
||||
|
@ -1371,7 +1379,11 @@ static int32_t mndProcessGetDbCfgReq(SRpcMsg *pReq) {
|
|||
goto _OVER;
|
||||
}
|
||||
|
||||
(void)tSerializeSDbCfgRsp(pRsp, contLen, &cfgRsp);
|
||||
int32_t ret = 0;
|
||||
if ((ret = tSerializeSDbCfgRsp(pRsp, contLen, &cfgRsp)) < 0) {
|
||||
code = ret;
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
pReq->info.rsp = pRsp;
|
||||
pReq->info.rspLen = contLen;
|
||||
|
@ -1473,7 +1485,11 @@ static int32_t mndSetDropDbCommitLogs(SMnode *pMnode, STrans *pTrans, SDbObj *pD
|
|||
sdbRelease(pSdb, pVgroup);
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
(void)sdbSetRawStatus(pVgRaw, SDB_STATUS_DROPPED);
|
||||
if ((code = sdbSetRawStatus(pVgRaw, SDB_STATUS_DROPPED)) != 0) {
|
||||
sdbCancelFetch(pSdb, pIter);
|
||||
sdbRelease(pSdb, pVgroup);
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
}
|
||||
|
||||
sdbRelease(pSdb, pVgroup);
|
||||
|
@ -1498,7 +1514,11 @@ static int32_t mndSetDropDbCommitLogs(SMnode *pMnode, STrans *pTrans, SDbObj *pD
|
|||
sdbRelease(pSdb, pStbRaw);
|
||||
return -1;
|
||||
}
|
||||
(void)sdbSetRawStatus(pStbRaw, SDB_STATUS_DROPPED);
|
||||
if ((code = sdbSetRawStatus(pStbRaw, SDB_STATUS_DROPPED)) != 0) {
|
||||
sdbCancelFetch(pSdb, pIter);
|
||||
sdbRelease(pSdb, pStbRaw);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
sdbRelease(pSdb, pStb);
|
||||
|
@ -1562,7 +1582,8 @@ static int32_t mndBuildDropDbRsp(SDbObj *pDb, int32_t *pRspLen, void **ppRsp, bo
|
|||
TAOS_RETURN(code);
|
||||
}
|
||||
|
||||
(void)tSerializeSDropDbRsp(pRsp, rspLen, &dropRsp);
|
||||
int32_t ret = 0;
|
||||
if ((ret = tSerializeSDropDbRsp(pRsp, rspLen, &dropRsp)) < 0) return ret;
|
||||
*pRspLen = rspLen;
|
||||
*ppRsp = pRsp;
|
||||
TAOS_RETURN(code);
|
||||
|
@ -1643,7 +1664,8 @@ static int32_t mndProcessDropDbReq(SRpcMsg *pReq) {
|
|||
}
|
||||
|
||||
SName name = {0};
|
||||
(void)tNameFromString(&name, dropReq.db, T_NAME_ACCT | T_NAME_DB);
|
||||
if (tNameFromString(&name, dropReq.db, T_NAME_ACCT | T_NAME_DB) < 0)
|
||||
mError("db:%s, failed to parse db name", dropReq.db);
|
||||
|
||||
auditRecord(pReq, pMnode->clusterId, "dropDB", name.dbname, "", dropReq.sql, dropReq.sqlLen);
|
||||
|
||||
|
@ -1805,14 +1827,18 @@ static int32_t mndProcessUseDbReq(SRpcMsg *pReq) {
|
|||
goto _OVER;
|
||||
}
|
||||
|
||||
(void)tSerializeSUseDbRsp(pRsp, contLen, &usedbRsp);
|
||||
int32_t ret = 0;
|
||||
if ((ret = tSerializeSUseDbRsp(pRsp, contLen, &usedbRsp)) < 0) {
|
||||
code = ret;
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
pReq->info.rsp = pRsp;
|
||||
pReq->info.rspLen = contLen;
|
||||
|
||||
_OVER:
|
||||
if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) {
|
||||
mError("db:%s, failed to process use db req since %s", usedbReq.db, terrstr());
|
||||
mError("db:%s, failed to process use db req since %s", usedbReq.db, tstrerror(code));
|
||||
}
|
||||
|
||||
mndReleaseDb(pMnode, pDb);
|
||||
|
@ -1964,7 +1990,8 @@ int32_t mndValidateDbInfo(SMnode *pMnode, SDbCacheInfo *pDbs, int32_t numOfDbs,
|
|||
tFreeSDbHbBatchRsp(&batchRsp);
|
||||
return -1;
|
||||
}
|
||||
(void)tSerializeSDbHbBatchRsp(pRsp, rspLen, &batchRsp);
|
||||
int32_t ret = 0;
|
||||
if ((ret = tSerializeSDbHbBatchRsp(pRsp, rspLen, &batchRsp)) < 0) return ret;
|
||||
|
||||
*ppRsp = pRsp;
|
||||
*pRspLen = rspLen;
|
||||
|
@ -1977,6 +2004,7 @@ static int32_t mndTrimDb(SMnode *pMnode, SDbObj *pDb) {
|
|||
SSdb *pSdb = pMnode->pSdb;
|
||||
SVgObj *pVgroup = NULL;
|
||||
void *pIter = NULL;
|
||||
int32_t code = 0;
|
||||
SVTrimDbReq trimReq = {.timestamp = taosGetTimestampSec()};
|
||||
int32_t reqLen = tSerializeSVTrimDbReq(NULL, 0, &trimReq);
|
||||
int32_t contLen = reqLen + sizeof(SMsgHead);
|
||||
|
@ -1993,7 +2021,11 @@ static int32_t mndTrimDb(SMnode *pMnode, SDbObj *pDb) {
|
|||
}
|
||||
pHead->contLen = htonl(contLen);
|
||||
pHead->vgId = htonl(pVgroup->vgId);
|
||||
(void)tSerializeSVTrimDbReq((char *)pHead + sizeof(SMsgHead), contLen, &trimReq);
|
||||
int32_t ret = 0;
|
||||
if ((ret = tSerializeSVTrimDbReq((char *)pHead + sizeof(SMsgHead), contLen, &trimReq)) < 0) {
|
||||
sdbRelease(pSdb, pVgroup);
|
||||
return ret;
|
||||
}
|
||||
|
||||
SRpcMsg rpcMsg = {.msgType = TDMT_VND_TRIM, .pCont = pHead, .contLen = contLen};
|
||||
SEpSet epSet = mndGetVgroupEpset(pMnode, pVgroup);
|
||||
|
@ -2046,6 +2078,7 @@ static int32_t mndS3MigrateDb(SMnode *pMnode, SDbObj *pDb) {
|
|||
SVS3MigrateDbReq s3migrateReq = {.timestamp = taosGetTimestampSec()};
|
||||
int32_t reqLen = tSerializeSVS3MigrateDbReq(NULL, 0, &s3migrateReq);
|
||||
int32_t contLen = reqLen + sizeof(SMsgHead);
|
||||
int32_t code = 0;
|
||||
|
||||
while (1) {
|
||||
pIter = sdbFetch(pSdb, SDB_VGROUP, pIter, (void **)&pVgroup);
|
||||
|
@ -2061,7 +2094,11 @@ static int32_t mndS3MigrateDb(SMnode *pMnode, SDbObj *pDb) {
|
|||
}
|
||||
pHead->contLen = htonl(contLen);
|
||||
pHead->vgId = htonl(pVgroup->vgId);
|
||||
(void)tSerializeSVS3MigrateDbReq((char *)pHead + sizeof(SMsgHead), contLen, &s3migrateReq);
|
||||
int32_t ret = 0;
|
||||
if ((ret = tSerializeSVS3MigrateDbReq((char *)pHead + sizeof(SMsgHead), contLen, &s3migrateReq)) < 0) {
|
||||
sdbRelease(pSdb, pVgroup);
|
||||
return ret;
|
||||
}
|
||||
|
||||
SRpcMsg rpcMsg = {.msgType = TDMT_VND_S3MIGRATE, .pCont = pHead, .contLen = contLen};
|
||||
SEpSet epSet = mndGetVgroupEpset(pMnode, pVgroup);
|
||||
|
@ -2243,6 +2280,8 @@ static void mndDumpDbInfoData(SMnode *pMnode, SSDataBlock *pBlock, SDbObj *pDb,
|
|||
int32_t cols = 0;
|
||||
int32_t bytes = pShow->pMeta->pSchemas[cols].bytes;
|
||||
char *buf = taosMemoryMalloc(bytes);
|
||||
int32_t code = 0;
|
||||
int32_t lino = 0;
|
||||
|
||||
const char *name = mndGetDbStr(pDb->name);
|
||||
if (name != NULL) {
|
||||
|
@ -2286,47 +2325,47 @@ static void mndDumpDbInfoData(SMnode *pMnode, SSDataBlock *pBlock, SDbObj *pDb,
|
|||
for (int32_t i = 0; i < pShow->numOfColumns; ++i) {
|
||||
SColumnInfoData *pColInfo = taosArrayGet(pBlock->pDataBlock, i);
|
||||
if (i == 0) {
|
||||
(void)colDataSetVal(pColInfo, rows, buf, false);
|
||||
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, buf, false), &lino, _OVER);
|
||||
} else if (i == 1) {
|
||||
(void)colDataSetVal(pColInfo, rows, (const char *)&pDb->createdTime, false);
|
||||
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)&pDb->createdTime, false), &lino, _OVER);
|
||||
} else if (i == 3) {
|
||||
(void)colDataSetVal(pColInfo, rows, (const char *)&numOfTables, false);
|
||||
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)&numOfTables, false), &lino, _OVER);
|
||||
} else if (i == 14) {
|
||||
(void)colDataSetVal(pColInfo, rows, precVstr, false);
|
||||
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, precVstr, false), &lino, _OVER);
|
||||
} else if (i == 15) {
|
||||
(void)colDataSetVal(pColInfo, rows, statusVstr, false);
|
||||
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, statusVstr, false), &lino, _OVER);
|
||||
} else {
|
||||
colDataSetNULL(pColInfo, rows);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
SColumnInfoData *pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
(void)colDataSetVal(pColInfo, rows, buf, false);
|
||||
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, buf, false), &lino, _OVER);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
(void)colDataSetVal(pColInfo, rows, (const char *)&pDb->createdTime, false);
|
||||
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)&pDb->createdTime, false), &lino, _OVER);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
(void)colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.numOfVgroups, false);
|
||||
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.numOfVgroups, false), &lino, _OVER);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
(void)colDataSetVal(pColInfo, rows, (const char *)&numOfTables, false);
|
||||
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)&numOfTables, false), &lino, _OVER);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
(void)colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.replications, false);
|
||||
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.replications, false), &lino, _OVER);
|
||||
|
||||
const char *strictStr = pDb->cfg.strict ? "on" : "off";
|
||||
char strictVstr[24] = {0};
|
||||
STR_WITH_MAXSIZE_TO_VARSTR(strictVstr, strictStr, 24);
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
(void)colDataSetVal(pColInfo, rows, (const char *)strictVstr, false);
|
||||
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)strictVstr, false), &lino, _OVER);
|
||||
|
||||
char durationVstr[128] = {0};
|
||||
int32_t len = formatDurationOrKeep(&durationVstr[VARSTR_HEADER_SIZE], pDb->cfg.daysPerFile);
|
||||
|
||||
varDataSetLen(durationVstr, len);
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
(void)colDataSetVal(pColInfo, rows, (const char *)durationVstr, false);
|
||||
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)durationVstr, false), &lino, _OVER);
|
||||
|
||||
char keepVstr[512] = {0};
|
||||
char keep0Str[128] = {0};
|
||||
|
@ -2344,67 +2383,67 @@ static void mndDumpDbInfoData(SMnode *pMnode, SSDataBlock *pBlock, SDbObj *pDb,
|
|||
}
|
||||
varDataSetLen(keepVstr, len);
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
(void)colDataSetVal(pColInfo, rows, (const char *)keepVstr, false);
|
||||
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)keepVstr, false), &lino, _OVER);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
(void)colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.buffer, false);
|
||||
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.buffer, false), &lino, _OVER);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
(void)colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.pageSize, false);
|
||||
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.pageSize, false), &lino, _OVER);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
(void)colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.pages, false);
|
||||
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.pages, false), &lino, _OVER);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
(void)colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.minRows, false);
|
||||
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.minRows, false), &lino, _OVER);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
(void)colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.maxRows, false);
|
||||
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.maxRows, false), &lino, _OVER);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
(void)colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.compression, false);
|
||||
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.compression, false), &lino, _OVER);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
(void)colDataSetVal(pColInfo, rows, (const char *)precVstr, false);
|
||||
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)precVstr, false), &lino, _OVER);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
(void)colDataSetVal(pColInfo, rows, (const char *)statusVstr, false);
|
||||
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)statusVstr, false), &lino, _OVER);
|
||||
|
||||
char *rentensionVstr = buildRetension(pDb->cfg.pRetensions);
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
if (rentensionVstr == NULL) {
|
||||
colDataSetNULL(pColInfo, rows);
|
||||
} else {
|
||||
(void)colDataSetVal(pColInfo, rows, (const char *)rentensionVstr, false);
|
||||
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)rentensionVstr, false), &lino, _OVER);
|
||||
taosMemoryFree(rentensionVstr);
|
||||
}
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
(void)colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.numOfStables, false);
|
||||
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.numOfStables, false), &lino, _OVER);
|
||||
|
||||
const char *cacheModelStr = getCacheModelStr(pDb->cfg.cacheLast);
|
||||
char cacheModelVstr[24] = {0};
|
||||
STR_WITH_MAXSIZE_TO_VARSTR(cacheModelVstr, cacheModelStr, 24);
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
(void)colDataSetVal(pColInfo, rows, (const char *)cacheModelVstr, false);
|
||||
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)cacheModelVstr, false), &lino, _OVER);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
(void)colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.cacheLastSize, false);
|
||||
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.cacheLastSize, false), &lino, _OVER);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
(void)colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.walLevel, false);
|
||||
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.walLevel, false), &lino, _OVER);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
(void)colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.walFsyncPeriod, false);
|
||||
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.walFsyncPeriod, false), &lino, _OVER);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
(void)colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.walRetentionPeriod, false);
|
||||
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.walRetentionPeriod, false), &lino, _OVER);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
(void)colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.walRetentionSize, false);
|
||||
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.walRetentionSize, false), &lino, _OVER);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
(void)colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.sstTrigger, false);
|
||||
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.sstTrigger, false), &lino, _OVER);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
int16_t hashPrefix = pDb->cfg.hashPrefix;
|
||||
|
@ -2413,39 +2452,40 @@ static void mndDumpDbInfoData(SMnode *pMnode, SSDataBlock *pBlock, SDbObj *pDb,
|
|||
} else if (hashPrefix < 0) {
|
||||
hashPrefix = pDb->cfg.hashPrefix + strlen(pDb->name) + 1;
|
||||
}
|
||||
(void)colDataSetVal(pColInfo, rows, (const char *)&hashPrefix, false);
|
||||
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)&hashPrefix, false), &lino, _OVER);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
(void)colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.hashSuffix, false);
|
||||
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.hashSuffix, false), &lino, _OVER);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
(void)colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.tsdbPageSize, false);
|
||||
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.tsdbPageSize, false), &lino, _OVER);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
(void)colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.keepTimeOffset, false);
|
||||
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.keepTimeOffset, false), &lino, _OVER);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
(void)colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.s3ChunkSize, false);
|
||||
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.s3ChunkSize, false), &lino, _OVER);
|
||||
|
||||
char keeplocalVstr[128] = {0};
|
||||
len = sprintf(&keeplocalVstr[VARSTR_HEADER_SIZE], "%dm", pDb->cfg.s3KeepLocal);
|
||||
varDataSetLen(keeplocalVstr, len);
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
(void)colDataSetVal(pColInfo, rows, (const char *)keeplocalVstr, false);
|
||||
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)keeplocalVstr, false), &lino, _OVER);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
(void)colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.s3Compact, false);
|
||||
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.s3Compact, false), &lino, _OVER);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
(void)colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.withArbitrator, false);
|
||||
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.withArbitrator, false), &lino, _OVER);
|
||||
|
||||
const char *encryptAlgorithmStr = getEncryptAlgorithmStr(pDb->cfg.encryptAlgorithm);
|
||||
char encryptAlgorithmVStr[24] = {0};
|
||||
STR_WITH_MAXSIZE_TO_VARSTR(encryptAlgorithmVStr, encryptAlgorithmStr, 24);
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
(void)colDataSetVal(pColInfo, rows, (const char *)encryptAlgorithmVStr, false);
|
||||
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)encryptAlgorithmVStr, false), &lino, _OVER);
|
||||
}
|
||||
|
||||
_OVER:
|
||||
if (code != 0) mError("failed to retrieve at line:%d, since %s", lino, tstrerror(code));
|
||||
taosMemoryFree(buf);
|
||||
}
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#define _DEFAULT_SOURCE
|
||||
#include "mndDb.h"
|
||||
#include "mndInt.h"
|
||||
#include "mndShow.h"
|
||||
#include "mndStb.h"
|
||||
#include "sdb.h"
|
||||
#include "tconfig.h"
|
||||
|
@ -46,6 +47,8 @@ char *i642str(int64_t val) {
|
|||
}
|
||||
|
||||
void dumpFunc(SSdb *pSdb, SJson *json) {
|
||||
int32_t code = 0;
|
||||
int32_t lino = 0;
|
||||
void *pIter = NULL;
|
||||
SJson *items = tjsonAddArrayToObject(json, "funcs");
|
||||
|
||||
|
@ -55,26 +58,30 @@ void dumpFunc(SSdb *pSdb, SJson *json) {
|
|||
if (pIter == NULL) break;
|
||||
|
||||
SJson *item = tjsonCreateObject();
|
||||
(void)tjsonAddItemToArray(items, item);
|
||||
(void)tjsonAddStringToObject(item, "name", pObj->name);
|
||||
(void)tjsonAddStringToObject(item, "createdTime", i642str(pObj->createdTime));
|
||||
(void)tjsonAddStringToObject(item, "funcType", i642str(pObj->funcType));
|
||||
(void)tjsonAddStringToObject(item, "scriptType", i642str(pObj->scriptType));
|
||||
(void)tjsonAddStringToObject(item, "align", i642str(pObj->align));
|
||||
(void)tjsonAddStringToObject(item, "outputType", i642str(pObj->outputType));
|
||||
(void)tjsonAddStringToObject(item, "outputLen", i642str(pObj->outputLen));
|
||||
(void)tjsonAddStringToObject(item, "bufSize", i642str(pObj->bufSize));
|
||||
(void)tjsonAddStringToObject(item, "signature", i642str(pObj->signature));
|
||||
(void)tjsonAddStringToObject(item, "commentSize", i642str(pObj->commentSize));
|
||||
(void)tjsonAddStringToObject(item, "codeSize", i642str(pObj->codeSize));
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddItemToArray(items, item), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "name", pObj->name), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "createdTime", i642str(pObj->createdTime)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "funcType", i642str(pObj->funcType)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "scriptType", i642str(pObj->scriptType)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "align", i642str(pObj->align)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "outputType", i642str(pObj->outputType)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "outputLen", i642str(pObj->outputLen)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "bufSize", i642str(pObj->bufSize)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "signature", i642str(pObj->signature)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "commentSize", i642str(pObj->commentSize)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "codeSize", i642str(pObj->codeSize)), pObj, &lino, _OVER);
|
||||
sdbRelease(pSdb, pObj);
|
||||
}
|
||||
_OVER:
|
||||
if (code != 0) mError("failed to dump func info at line:%d since %s", lino, tstrerror(code));
|
||||
}
|
||||
|
||||
void dumpDb(SSdb *pSdb, SJson *json) {
|
||||
int32_t code = 0;
|
||||
int32_t lino = 0;
|
||||
void *pIter = NULL;
|
||||
SJson *items = tjsonCreateObject();
|
||||
(void)tjsonAddItemToObject(json, "dbs", items);
|
||||
TAOS_CHECK_GOTO(tjsonAddItemToObject(json, "dbs", items), &lino, _OVER);
|
||||
|
||||
while (1) {
|
||||
SDbObj *pObj = NULL;
|
||||
|
@ -82,65 +89,86 @@ void dumpDb(SSdb *pSdb, SJson *json) {
|
|||
if (pIter == NULL) break;
|
||||
|
||||
SJson *item = tjsonCreateObject();
|
||||
(void)tjsonAddItemToObject(items, "db", item);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddItemToObject(items, "db", item), pObj, &lino, _OVER);
|
||||
|
||||
(void)tjsonAddStringToObject(item, "name", mndGetDbStr(pObj->name));
|
||||
(void)tjsonAddStringToObject(item, "acct", pObj->acct);
|
||||
(void)tjsonAddStringToObject(item, "createUser", pObj->createUser);
|
||||
(void)tjsonAddStringToObject(item, "createdTime", i642str(pObj->createdTime));
|
||||
(void)tjsonAddStringToObject(item, "updateTime", i642str(pObj->updateTime));
|
||||
(void)tjsonAddStringToObject(item, "uid", i642str(pObj->uid));
|
||||
(void)tjsonAddStringToObject(item, "cfgVersion", i642str(pObj->cfgVersion));
|
||||
(void)tjsonAddStringToObject(item, "vgVersion", i642str(pObj->vgVersion));
|
||||
(void)tjsonAddStringToObject(item, "numOfVgroups", i642str(pObj->cfg.numOfVgroups));
|
||||
(void)tjsonAddStringToObject(item, "numOfStables", i642str(pObj->cfg.numOfStables));
|
||||
(void)tjsonAddStringToObject(item, "buffer", i642str(pObj->cfg.buffer));
|
||||
(void)tjsonAddStringToObject(item, "pageSize", i642str(pObj->cfg.pageSize));
|
||||
(void)tjsonAddStringToObject(item, "pages", i642str(pObj->cfg.pages));
|
||||
(void)tjsonAddStringToObject(item, "cacheLastSize", i642str(pObj->cfg.cacheLastSize));
|
||||
(void)tjsonAddStringToObject(item, "daysPerFile", i642str(pObj->cfg.daysPerFile));
|
||||
(void)tjsonAddStringToObject(item, "daysToKeep0", i642str(pObj->cfg.daysToKeep0));
|
||||
(void)tjsonAddStringToObject(item, "daysToKeep1", i642str(pObj->cfg.daysToKeep1));
|
||||
(void)tjsonAddStringToObject(item, "daysToKeep2", i642str(pObj->cfg.daysToKeep2));
|
||||
(void)tjsonAddStringToObject(item, "minRows", i642str(pObj->cfg.minRows));
|
||||
(void)tjsonAddStringToObject(item, "maxRows", i642str(pObj->cfg.maxRows));
|
||||
(void)tjsonAddStringToObject(item, "precision", i642str(pObj->cfg.precision));
|
||||
(void)tjsonAddStringToObject(item, "compression", i642str(pObj->cfg.compression));
|
||||
(void)tjsonAddStringToObject(item, "encryptAlgorithm", i642str(pObj->cfg.encryptAlgorithm));
|
||||
(void)tjsonAddStringToObject(item, "replications", i642str(pObj->cfg.replications));
|
||||
(void)tjsonAddStringToObject(item, "strict", i642str(pObj->cfg.strict));
|
||||
(void)tjsonAddStringToObject(item, "cacheLast", i642str(pObj->cfg.cacheLast));
|
||||
(void)tjsonAddStringToObject(item, "hashMethod", i642str(pObj->cfg.hashMethod));
|
||||
(void)tjsonAddStringToObject(item, "hashPrefix", i642str(pObj->cfg.hashPrefix));
|
||||
(void)tjsonAddStringToObject(item, "hashSuffix", i642str(pObj->cfg.hashSuffix));
|
||||
(void)tjsonAddStringToObject(item, "sstTrigger", i642str(pObj->cfg.sstTrigger));
|
||||
(void)tjsonAddStringToObject(item, "tsdbPageSize", i642str(pObj->cfg.tsdbPageSize));
|
||||
(void)tjsonAddStringToObject(item, "schemaless", i642str(pObj->cfg.schemaless));
|
||||
(void)tjsonAddStringToObject(item, "walLevel", i642str(pObj->cfg.walLevel));
|
||||
(void)tjsonAddStringToObject(item, "walFsyncPeriod", i642str(pObj->cfg.walFsyncPeriod));
|
||||
(void)tjsonAddStringToObject(item, "walRetentionPeriod", i642str(pObj->cfg.walRetentionPeriod));
|
||||
(void)tjsonAddStringToObject(item, "walRetentionSize", i642str(pObj->cfg.walRetentionSize));
|
||||
(void)tjsonAddStringToObject(item, "walRollPeriod", i642str(pObj->cfg.walRollPeriod));
|
||||
(void)tjsonAddStringToObject(item, "walSegmentSize", i642str(pObj->cfg.walSegmentSize));
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "name", mndGetDbStr(pObj->name)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "acct", pObj->acct), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "createUser", pObj->createUser), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "createdTime", i642str(pObj->createdTime)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "updateTime", i642str(pObj->updateTime)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "uid", i642str(pObj->uid)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "cfgVersion", i642str(pObj->cfgVersion)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "vgVersion", i642str(pObj->vgVersion)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "numOfVgroups", i642str(pObj->cfg.numOfVgroups)), pObj, &lino,
|
||||
_OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "numOfStables", i642str(pObj->cfg.numOfStables)), pObj, &lino,
|
||||
_OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "buffer", i642str(pObj->cfg.buffer)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "pageSize", i642str(pObj->cfg.pageSize)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "pages", i642str(pObj->cfg.pages)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "cacheLastSize", i642str(pObj->cfg.cacheLastSize)), pObj, &lino,
|
||||
_OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "daysPerFile", i642str(pObj->cfg.daysPerFile)), pObj, &lino,
|
||||
_OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "daysToKeep0", i642str(pObj->cfg.daysToKeep0)), pObj, &lino,
|
||||
_OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "daysToKeep1", i642str(pObj->cfg.daysToKeep1)), pObj, &lino,
|
||||
_OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "daysToKeep2", i642str(pObj->cfg.daysToKeep2)), pObj, &lino,
|
||||
_OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "minRows", i642str(pObj->cfg.minRows)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "maxRows", i642str(pObj->cfg.maxRows)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "precision", i642str(pObj->cfg.precision)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "compression", i642str(pObj->cfg.compression)), pObj, &lino,
|
||||
_OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "encryptAlgorithm", i642str(pObj->cfg.encryptAlgorithm)), pObj,
|
||||
&lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "replications", i642str(pObj->cfg.replications)), pObj, &lino,
|
||||
_OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "strict", i642str(pObj->cfg.strict)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "cacheLast", i642str(pObj->cfg.cacheLast)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "hashMethod", i642str(pObj->cfg.hashMethod)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "hashPrefix", i642str(pObj->cfg.hashPrefix)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "hashSuffix", i642str(pObj->cfg.hashSuffix)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "sstTrigger", i642str(pObj->cfg.sstTrigger)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "tsdbPageSize", i642str(pObj->cfg.tsdbPageSize)), pObj, &lino,
|
||||
_OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "schemaless", i642str(pObj->cfg.schemaless)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "walLevel", i642str(pObj->cfg.walLevel)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "walFsyncPeriod", i642str(pObj->cfg.walFsyncPeriod)), pObj, &lino,
|
||||
_OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "walRetentionPeriod", i642str(pObj->cfg.walRetentionPeriod)), pObj,
|
||||
&lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "walRetentionSize", i642str(pObj->cfg.walRetentionSize)), pObj,
|
||||
&lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "walRollPeriod", i642str(pObj->cfg.walRollPeriod)), pObj, &lino,
|
||||
_OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "walSegmentSize", i642str(pObj->cfg.walSegmentSize)), pObj, &lino,
|
||||
_OVER);
|
||||
|
||||
(void)tjsonAddStringToObject(item, "numOfRetensions", i642str(pObj->cfg.numOfRetensions));
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "numOfRetensions", i642str(pObj->cfg.numOfRetensions)), pObj,
|
||||
&lino, _OVER);
|
||||
for (int32_t i = 0; i < pObj->cfg.numOfRetensions; ++i) {
|
||||
SJson *rentensions = tjsonAddArrayToObject(item, "rentensions");
|
||||
SJson *rentension = tjsonCreateObject();
|
||||
(void)tjsonAddItemToArray(rentensions, rentension);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddItemToArray(rentensions, rentension), pObj, &lino, _OVER);
|
||||
|
||||
SRetention *pRetension = taosArrayGet(pObj->cfg.pRetensions, i);
|
||||
(void)tjsonAddStringToObject(item, "freq", i642str(pRetension->freq));
|
||||
(void)tjsonAddStringToObject(item, "freqUnit", i642str(pRetension->freqUnit));
|
||||
(void)tjsonAddStringToObject(item, "keep", i642str(pRetension->keep));
|
||||
(void)tjsonAddStringToObject(item, "keepUnit", i642str(pRetension->keepUnit));
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "freq", i642str(pRetension->freq)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "freqUnit", i642str(pRetension->freqUnit)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "keep", i642str(pRetension->keep)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "keepUnit", i642str(pRetension->keepUnit)), pObj, &lino, _OVER);
|
||||
}
|
||||
|
||||
sdbRelease(pSdb, pObj);
|
||||
}
|
||||
_OVER:
|
||||
if (code != 0) mError("failed to dump db info at line:%d since %s", lino, tstrerror(code));
|
||||
}
|
||||
|
||||
void dumpStb(SSdb *pSdb, SJson *json) {
|
||||
int32_t code = 0;
|
||||
int32_t lino = 0;
|
||||
void *pIter = NULL;
|
||||
SJson *items = tjsonAddArrayToObject(json, "stbs");
|
||||
|
||||
|
@ -150,62 +178,67 @@ void dumpStb(SSdb *pSdb, SJson *json) {
|
|||
if (pIter == NULL) break;
|
||||
|
||||
SJson *item = tjsonCreateObject();
|
||||
(void)tjsonAddItemToArray(items, item);
|
||||
(void)tjsonAddStringToObject(item, "name", mndGetStbStr(pObj->name));
|
||||
(void)tjsonAddStringToObject(item, "db", mndGetDbStr(pObj->db));
|
||||
(void)tjsonAddStringToObject(item, "createdTime", i642str(pObj->createdTime));
|
||||
(void)tjsonAddStringToObject(item, "updateTime", i642str(pObj->updateTime));
|
||||
(void)tjsonAddStringToObject(item, "uid", i642str(pObj->uid));
|
||||
(void)tjsonAddStringToObject(item, "dbUid", i642str(pObj->dbUid));
|
||||
(void)tjsonAddStringToObject(item, "tagVer", i642str(pObj->tagVer));
|
||||
(void)tjsonAddStringToObject(item, "colVer", i642str(pObj->colVer));
|
||||
(void)tjsonAddStringToObject(item, "smaVer", i642str(pObj->smaVer));
|
||||
(void)tjsonAddStringToObject(item, "nextColId", i642str(pObj->nextColId));
|
||||
(void)tjsonAddStringToObject(item, "watermark1", i642str(pObj->watermark[0]));
|
||||
(void)tjsonAddStringToObject(item, "watermark2", i642str(pObj->watermark[1]));
|
||||
(void)tjsonAddStringToObject(item, "maxdelay0", i642str(pObj->maxdelay[0]));
|
||||
(void)tjsonAddStringToObject(item, "maxdelay1", i642str(pObj->maxdelay[1]));
|
||||
(void)tjsonAddStringToObject(item, "ttl", i642str(pObj->ttl));
|
||||
(void)tjsonAddStringToObject(item, "numOfFuncs", i642str(pObj->numOfFuncs));
|
||||
(void)tjsonAddStringToObject(item, "commentLen", i642str(pObj->commentLen));
|
||||
(void)tjsonAddStringToObject(item, "ast1Len", i642str(pObj->ast1Len));
|
||||
(void)tjsonAddStringToObject(item, "ast2Len", i642str(pObj->ast2Len));
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddItemToArray(items, item), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "name", mndGetStbStr(pObj->name)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "db", mndGetDbStr(pObj->db)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "createdTime", i642str(pObj->createdTime)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "updateTime", i642str(pObj->updateTime)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "uid", i642str(pObj->uid)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "dbUid", i642str(pObj->dbUid)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "tagVer", i642str(pObj->tagVer)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "colVer", i642str(pObj->colVer)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "smaVer", i642str(pObj->smaVer)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "nextColId", i642str(pObj->nextColId)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "watermark1", i642str(pObj->watermark[0])), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "watermark2", i642str(pObj->watermark[1])), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "maxdelay0", i642str(pObj->maxdelay[0])), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "maxdelay1", i642str(pObj->maxdelay[1])), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "ttl", i642str(pObj->ttl)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "numOfFuncs", i642str(pObj->numOfFuncs)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "commentLen", i642str(pObj->commentLen)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "ast1Len", i642str(pObj->ast1Len)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "ast2Len", i642str(pObj->ast2Len)), pObj, &lino, _OVER);
|
||||
|
||||
(void)tjsonAddStringToObject(item, "numOfColumns", i642str(pObj->numOfColumns));
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "numOfColumns", i642str(pObj->numOfColumns)), pObj, &lino, _OVER);
|
||||
SJson *columns = tjsonAddArrayToObject(item, "columns");
|
||||
for (int32_t i = 0; i < pObj->numOfColumns; ++i) {
|
||||
SJson *column = tjsonCreateObject();
|
||||
(void)tjsonAddItemToArray(columns, column);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddItemToArray(columns, column), pObj, &lino, _OVER);
|
||||
|
||||
SSchema *pColumn = &pObj->pColumns[i];
|
||||
(void)tjsonAddStringToObject(column, "type", i642str(pColumn->type));
|
||||
(void)tjsonAddStringToObject(column, "typestr", tDataTypes[pColumn->type].name);
|
||||
(void)tjsonAddStringToObject(column, "flags", i642str(pColumn->flags));
|
||||
(void)tjsonAddStringToObject(column, "colId", i642str(pColumn->colId));
|
||||
(void)tjsonAddStringToObject(column, "bytes", i642str(pColumn->bytes));
|
||||
(void)tjsonAddStringToObject(column, "name", pColumn->name);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(column, "type", i642str(pColumn->type)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(column, "typestr", tDataTypes[pColumn->type].name), pObj, &lino,
|
||||
_OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(column, "flags", i642str(pColumn->flags)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(column, "colId", i642str(pColumn->colId)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(column, "bytes", i642str(pColumn->bytes)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(column, "name", pColumn->name), pObj, &lino, _OVER);
|
||||
}
|
||||
|
||||
(void)tjsonAddStringToObject(item, "numOfTags", i642str(pObj->numOfTags));
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "numOfTags", i642str(pObj->numOfTags)), pObj, &lino, _OVER);
|
||||
SJson *tags = tjsonAddArrayToObject(item, "tags");
|
||||
for (int32_t i = 0; i < pObj->numOfTags; ++i) {
|
||||
SJson *tag = tjsonCreateObject();
|
||||
(void)tjsonAddItemToArray(tags, tag);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddItemToArray(tags, tag), pObj, &lino, _OVER);
|
||||
|
||||
SSchema *pTag = &pObj->pTags[i];
|
||||
(void)tjsonAddStringToObject(tag, "type", i642str(pTag->type));
|
||||
(void)tjsonAddStringToObject(tag, "typestr", tDataTypes[pTag->type].name);
|
||||
(void)tjsonAddStringToObject(tag, "flags", i642str(pTag->flags));
|
||||
(void)tjsonAddStringToObject(tag, "colId", i642str(pTag->colId));
|
||||
(void)tjsonAddStringToObject(tag, "bytes", i642str(pTag->bytes));
|
||||
(void)tjsonAddStringToObject(tag, "name", pTag->name);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(tag, "type", i642str(pTag->type)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(tag, "typestr", tDataTypes[pTag->type].name), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(tag, "flags", i642str(pTag->flags)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(tag, "colId", i642str(pTag->colId)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(tag, "bytes", i642str(pTag->bytes)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(tag, "name", pTag->name), pObj, &lino, _OVER);
|
||||
}
|
||||
|
||||
sdbRelease(pSdb, pObj);
|
||||
}
|
||||
_OVER:
|
||||
if (code != 0) mError("failed to dump stable info at line:%d since %s", lino, tstrerror(code));
|
||||
}
|
||||
|
||||
void dumpSma(SSdb *pSdb, SJson *json) {
|
||||
int32_t code = 0;
|
||||
int32_t lino = 0;
|
||||
void *pIter = NULL;
|
||||
SJson *items = tjsonAddArrayToObject(json, "smas");
|
||||
|
||||
|
@ -215,32 +248,37 @@ void dumpSma(SSdb *pSdb, SJson *json) {
|
|||
if (pIter == NULL) break;
|
||||
|
||||
SJson *item = tjsonCreateObject();
|
||||
(void)tjsonAddItemToArray(items, item);
|
||||
(void)tjsonAddStringToObject(item, "name", mndGetStbStr(pObj->name));
|
||||
(void)tjsonAddStringToObject(item, "stb", mndGetStbStr(pObj->stb));
|
||||
(void)tjsonAddStringToObject(item, "db", mndGetDbStr(pObj->db));
|
||||
(void)tjsonAddStringToObject(item, "dstTbName", mndGetStbStr(pObj->dstTbName));
|
||||
(void)tjsonAddStringToObject(item, "createdTime", i642str(pObj->createdTime));
|
||||
(void)tjsonAddStringToObject(item, "uid", i642str(pObj->uid));
|
||||
(void)tjsonAddStringToObject(item, "stbUid", i642str(pObj->stbUid));
|
||||
(void)tjsonAddStringToObject(item, "dbUid", i642str(pObj->dbUid));
|
||||
(void)tjsonAddStringToObject(item, "dstTbUid", i642str(pObj->dstTbUid));
|
||||
(void)tjsonAddStringToObject(item, "intervalUnit", i642str(pObj->intervalUnit));
|
||||
(void)tjsonAddStringToObject(item, "slidingUnit", i642str(pObj->slidingUnit));
|
||||
(void)tjsonAddStringToObject(item, "timezone", i642str(pObj->timezone));
|
||||
(void)tjsonAddStringToObject(item, "dstVgId", i642str(pObj->dstVgId));
|
||||
(void)tjsonAddStringToObject(item, "interval", i642str(pObj->interval));
|
||||
(void)tjsonAddStringToObject(item, "offset", i642str(pObj->offset));
|
||||
(void)tjsonAddStringToObject(item, "sliding", i642str(pObj->sliding));
|
||||
(void)tjsonAddStringToObject(item, "exprLen", i642str(pObj->exprLen));
|
||||
(void)tjsonAddStringToObject(item, "tagsFilterLen", i642str(pObj->tagsFilterLen));
|
||||
(void)tjsonAddStringToObject(item, "sqlLen", i642str(pObj->sqlLen));
|
||||
(void)tjsonAddStringToObject(item, "astLen", i642str(pObj->astLen));
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddItemToArray(items, item), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "name", mndGetStbStr(pObj->name)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "stb", mndGetStbStr(pObj->stb)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "db", mndGetDbStr(pObj->db)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "dstTbName", mndGetStbStr(pObj->dstTbName)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "createdTime", i642str(pObj->createdTime)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "uid", i642str(pObj->uid)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "stbUid", i642str(pObj->stbUid)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "dbUid", i642str(pObj->dbUid)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "dstTbUid", i642str(pObj->dstTbUid)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "intervalUnit", i642str(pObj->intervalUnit)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "slidingUnit", i642str(pObj->slidingUnit)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "timezone", i642str(pObj->timezone)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "dstVgId", i642str(pObj->dstVgId)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "interval", i642str(pObj->interval)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "offset", i642str(pObj->offset)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "sliding", i642str(pObj->sliding)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "exprLen", i642str(pObj->exprLen)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "tagsFilterLen", i642str(pObj->tagsFilterLen)), pObj, &lino,
|
||||
_OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "sqlLen", i642str(pObj->sqlLen)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "astLen", i642str(pObj->astLen)), pObj, &lino, _OVER);
|
||||
sdbRelease(pSdb, pObj);
|
||||
}
|
||||
_OVER:
|
||||
if (code != 0) mError("failed to dump sma info at line:%d since %s", lino, tstrerror(code));
|
||||
}
|
||||
|
||||
void dumpVgroup(SSdb *pSdb, SJson *json) {
|
||||
int32_t code = 0;
|
||||
int32_t lino = 0;
|
||||
void *pIter = NULL;
|
||||
SJson *items = tjsonAddArrayToObject(json, "vgroups");
|
||||
|
||||
|
@ -250,28 +288,33 @@ void dumpVgroup(SSdb *pSdb, SJson *json) {
|
|||
if (pIter == NULL) break;
|
||||
|
||||
SJson *item = tjsonCreateObject();
|
||||
(void)tjsonAddItemToArray(items, item);
|
||||
(void)tjsonAddStringToObject(item, "vgId", i642str(pObj->vgId));
|
||||
(void)tjsonAddStringToObject(item, "createdTime", i642str(pObj->createdTime));
|
||||
(void)tjsonAddStringToObject(item, "updateTime", i642str(pObj->updateTime));
|
||||
(void)tjsonAddStringToObject(item, "version", i642str(pObj->version));
|
||||
(void)tjsonAddStringToObject(item, "hashBegin", i642str(pObj->hashBegin));
|
||||
(void)tjsonAddStringToObject(item, "hashEnd", i642str(pObj->hashEnd));
|
||||
(void)tjsonAddStringToObject(item, "db", mndGetDbStr(pObj->dbName));
|
||||
(void)tjsonAddStringToObject(item, "dbUid", i642str(pObj->dbUid));
|
||||
(void)tjsonAddStringToObject(item, "isTsma", i642str(pObj->isTsma));
|
||||
(void)tjsonAddStringToObject(item, "replica", i642str(pObj->replica));
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddItemToArray(items, item), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "vgId", i642str(pObj->vgId)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "createdTime", i642str(pObj->createdTime)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "updateTime", i642str(pObj->updateTime)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "version", i642str(pObj->version)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "hashBegin", i642str(pObj->hashBegin)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "hashEnd", i642str(pObj->hashEnd)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "db", mndGetDbStr(pObj->dbName)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "dbUid", i642str(pObj->dbUid)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "isTsma", i642str(pObj->isTsma)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "replica", i642str(pObj->replica)), pObj, &lino, _OVER);
|
||||
for (int32_t i = 0; i < pObj->replica; ++i) {
|
||||
SJson *replicas = tjsonAddArrayToObject(item, "replicas");
|
||||
SJson *replica = tjsonCreateObject();
|
||||
(void)tjsonAddItemToArray(replicas, replica);
|
||||
(void)tjsonAddStringToObject(replica, "dnodeId", i642str(pObj->vnodeGid[i].dnodeId));
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddItemToArray(replicas, replica), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(replica, "dnodeId", i642str(pObj->vnodeGid[i].dnodeId)), pObj, &lino,
|
||||
_OVER);
|
||||
}
|
||||
sdbRelease(pSdb, pObj);
|
||||
}
|
||||
_OVER:
|
||||
if (code != 0) mError("failed to dump vgroup info at line:%d since %s", lino, tstrerror(code));
|
||||
}
|
||||
|
||||
void dumpTopic(SSdb *pSdb, SJson *json) {
|
||||
int32_t code = 0;
|
||||
int32_t lino = 0;
|
||||
void *pIter = NULL;
|
||||
SJson *items = tjsonAddArrayToObject(json, "topics");
|
||||
|
||||
|
@ -281,28 +324,32 @@ void dumpTopic(SSdb *pSdb, SJson *json) {
|
|||
if (pIter == NULL) break;
|
||||
|
||||
SJson *item = tjsonCreateObject();
|
||||
(void)tjsonAddItemToArray(items, item);
|
||||
(void)tjsonAddStringToObject(item, "name", mndGetDbStr(pObj->name));
|
||||
(void)tjsonAddStringToObject(item, "name", mndGetDbStr(pObj->db));
|
||||
(void)tjsonAddStringToObject(item, "createTime", i642str(pObj->createTime));
|
||||
(void)tjsonAddStringToObject(item, "updateTime", i642str(pObj->updateTime));
|
||||
(void)tjsonAddStringToObject(item, "uid", i642str(pObj->uid));
|
||||
(void)tjsonAddStringToObject(item, "dbUid", i642str(pObj->dbUid));
|
||||
(void)tjsonAddStringToObject(item, "version", i642str(pObj->version));
|
||||
(void)tjsonAddStringToObject(item, "subType", i642str(pObj->subType));
|
||||
(void)tjsonAddStringToObject(item, "withMeta", i642str(pObj->withMeta));
|
||||
(void)tjsonAddStringToObject(item, "stbUid", i642str(pObj->stbUid));
|
||||
(void)tjsonAddStringToObject(item, "stbName", mndGetStableStr(pObj->stbName));
|
||||
(void)tjsonAddStringToObject(item, "sqlLen", i642str(pObj->sqlLen));
|
||||
(void)tjsonAddStringToObject(item, "astLen", i642str(pObj->astLen));
|
||||
(void)tjsonAddStringToObject(item, "sqlLen", i642str(pObj->sqlLen));
|
||||
(void)tjsonAddStringToObject(item, "ntbUid", i642str(pObj->ntbUid));
|
||||
(void)tjsonAddStringToObject(item, "ctbStbUid", i642str(pObj->ctbStbUid));
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddItemToArray(items, item), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "name", mndGetDbStr(pObj->name)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "name", mndGetDbStr(pObj->db)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "createTime", i642str(pObj->createTime)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "updateTime", i642str(pObj->updateTime)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "uid", i642str(pObj->uid)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "dbUid", i642str(pObj->dbUid)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "version", i642str(pObj->version)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "subType", i642str(pObj->subType)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "withMeta", i642str(pObj->withMeta)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "stbUid", i642str(pObj->stbUid)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "stbName", mndGetStableStr(pObj->stbName)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "sqlLen", i642str(pObj->sqlLen)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "astLen", i642str(pObj->astLen)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "sqlLen", i642str(pObj->sqlLen)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "ntbUid", i642str(pObj->ntbUid)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "ctbStbUid", i642str(pObj->ctbStbUid)), pObj, &lino, _OVER);
|
||||
sdbRelease(pSdb, pObj);
|
||||
}
|
||||
_OVER:
|
||||
if (code != 0) mError("failed to dump topic info at line:%d since %s", lino, tstrerror(code));
|
||||
}
|
||||
|
||||
void dumpConsumer(SSdb *pSdb, SJson *json) {
|
||||
int32_t code = 0;
|
||||
int32_t lino = 0;
|
||||
void *pIter = NULL;
|
||||
SJson *items = tjsonAddArrayToObject(json, "consumers");
|
||||
|
||||
|
@ -312,14 +359,18 @@ void dumpConsumer(SSdb *pSdb, SJson *json) {
|
|||
if (pIter == NULL) break;
|
||||
|
||||
SJson *item = tjsonCreateObject();
|
||||
(void)tjsonAddItemToArray(items, item);
|
||||
(void)tjsonAddStringToObject(item, "consumerId", i642str(pObj->consumerId));
|
||||
(void)tjsonAddStringToObject(item, "cgroup", pObj->cgroup);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddItemToArray(items, item), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "consumerId", i642str(pObj->consumerId)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "cgroup", pObj->cgroup), pObj, &lino, _OVER);
|
||||
sdbRelease(pSdb, pObj);
|
||||
}
|
||||
_OVER:
|
||||
if (code != 0) mError("failed to dump consumer info at line:%d since %s", lino, tstrerror(code));
|
||||
}
|
||||
|
||||
void dumpSubscribe(SSdb *pSdb, SJson *json) {
|
||||
int32_t code = 0;
|
||||
int32_t lino = 0;
|
||||
void *pIter = NULL;
|
||||
SJson *items = tjsonAddArrayToObject(json, "subscribes");
|
||||
|
||||
|
@ -329,15 +380,19 @@ void dumpSubscribe(SSdb *pSdb, SJson *json) {
|
|||
if (pIter == NULL) break;
|
||||
|
||||
SJson *item = tjsonCreateObject();
|
||||
(void)tjsonAddItemToArray(items, item);
|
||||
(void)tjsonAddStringToObject(item, "key", pObj->key);
|
||||
(void)tjsonAddStringToObject(item, "dbUid", i642str(pObj->dbUid));
|
||||
(void)tjsonAddStringToObject(item, "stbUid", i642str(pObj->stbUid));
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddItemToArray(items, item), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "key", pObj->key), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "dbUid", i642str(pObj->dbUid)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "stbUid", i642str(pObj->stbUid)), pObj, &lino, _OVER);
|
||||
sdbRelease(pSdb, pObj);
|
||||
}
|
||||
_OVER:
|
||||
if (code != 0) mError("failed to dump subscribe info at line:%d since %s", lino, tstrerror(code));
|
||||
}
|
||||
|
||||
void dumpStream(SSdb *pSdb, SJson *json) {
|
||||
int32_t code = 0;
|
||||
int32_t lino = 0;
|
||||
void *pIter = NULL;
|
||||
SJson *items = tjsonAddArrayToObject(json, "streams");
|
||||
|
||||
|
@ -347,31 +402,38 @@ void dumpStream(SSdb *pSdb, SJson *json) {
|
|||
if (pIter == NULL) break;
|
||||
|
||||
SJson *item = tjsonCreateObject();
|
||||
(void)tjsonAddItemToArray(items, item);
|
||||
(void)tjsonAddStringToObject(item, "name", mndGetDbStr(pObj->name));
|
||||
(void)tjsonAddStringToObject(item, "createTime", i642str(pObj->createTime));
|
||||
(void)tjsonAddStringToObject(item, "updateTime", i642str(pObj->updateTime));
|
||||
(void)tjsonAddStringToObject(item, "version", i642str(pObj->version));
|
||||
(void)tjsonAddStringToObject(item, "totalLevel", i642str(pObj->totalLevel));
|
||||
(void)tjsonAddStringToObject(item, "smaId", i642str(pObj->smaId));
|
||||
(void)tjsonAddStringToObject(item, "uid", i642str(pObj->uid));
|
||||
(void)tjsonAddStringToObject(item, "status", i642str(pObj->status));
|
||||
(void)tjsonAddStringToObject(item, "igExpired", i642str(pObj->conf.igExpired));
|
||||
(void)tjsonAddStringToObject(item, "trigger", i642str(pObj->conf.trigger));
|
||||
(void)tjsonAddStringToObject(item, "triggerParam", i642str(pObj->conf.triggerParam));
|
||||
(void)tjsonAddStringToObject(item, "watermark", i642str(pObj->conf.watermark));
|
||||
(void)tjsonAddStringToObject(item, "sourceDbUid", i642str(pObj->sourceDbUid));
|
||||
(void)tjsonAddStringToObject(item, "targetDbUid", i642str(pObj->targetDbUid));
|
||||
(void)tjsonAddStringToObject(item, "sourceDb", mndGetDbStr(pObj->sourceDb));
|
||||
(void)tjsonAddStringToObject(item, "targetDb", mndGetDbStr(pObj->targetDb));
|
||||
(void)tjsonAddStringToObject(item, "targetSTbName", mndGetStbStr(pObj->targetSTbName));
|
||||
(void)tjsonAddStringToObject(item, "targetStbUid", i642str(pObj->targetStbUid));
|
||||
(void)tjsonAddStringToObject(item, "fixedSinkVgId", i642str(pObj->fixedSinkVgId));
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddItemToArray(items, item), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "name", mndGetDbStr(pObj->name)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "createTime", i642str(pObj->createTime)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "updateTime", i642str(pObj->updateTime)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "version", i642str(pObj->version)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "totalLevel", i642str(pObj->totalLevel)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "smaId", i642str(pObj->smaId)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "uid", i642str(pObj->uid)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "status", i642str(pObj->status)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "igExpired", i642str(pObj->conf.igExpired)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "trigger", i642str(pObj->conf.trigger)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "triggerParam", i642str(pObj->conf.triggerParam)), pObj, &lino,
|
||||
_OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "watermark", i642str(pObj->conf.watermark)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "sourceDbUid", i642str(pObj->sourceDbUid)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "targetDbUid", i642str(pObj->targetDbUid)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "sourceDb", mndGetDbStr(pObj->sourceDb)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "targetDb", mndGetDbStr(pObj->targetDb)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "targetSTbName", mndGetStbStr(pObj->targetSTbName)), pObj, &lino,
|
||||
_OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "targetStbUid", i642str(pObj->targetStbUid)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "fixedSinkVgId", i642str(pObj->fixedSinkVgId)), pObj, &lino,
|
||||
_OVER);
|
||||
sdbRelease(pSdb, pObj);
|
||||
}
|
||||
_OVER:
|
||||
if (code != 0) mError("failed to dump stream info at line:%d since %s", lino, tstrerror(code));
|
||||
}
|
||||
|
||||
void dumpAcct(SSdb *pSdb, SJson *json) {
|
||||
int32_t code = 0;
|
||||
int32_t lino = 0;
|
||||
void *pIter = NULL;
|
||||
SJson *items = tjsonAddArrayToObject(json, "accts");
|
||||
|
||||
|
@ -381,13 +443,15 @@ void dumpAcct(SSdb *pSdb, SJson *json) {
|
|||
if (pIter == NULL) break;
|
||||
|
||||
SJson *item = tjsonCreateObject();
|
||||
(void)tjsonAddItemToArray(items, item);
|
||||
(void)tjsonAddStringToObject(item, "acct", pObj->acct);
|
||||
(void)tjsonAddStringToObject(item, "createdTime", i642str(pObj->createdTime));
|
||||
(void)tjsonAddStringToObject(item, "updateTime", i642str(pObj->updateTime));
|
||||
(void)tjsonAddStringToObject(item, "acctId", i642str(pObj->acctId));
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddItemToArray(items, item), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "acct", pObj->acct), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "createdTime", i642str(pObj->createdTime)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "updateTime", i642str(pObj->updateTime)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "acctId", i642str(pObj->acctId)), pObj, &lino, _OVER);
|
||||
sdbRelease(pSdb, pObj);
|
||||
}
|
||||
_OVER:
|
||||
if (code != 0) mError("failed to dump acct info at line:%d since %s", lino, tstrerror(code));
|
||||
}
|
||||
|
||||
void dumpAuth(SSdb *pSdb, SJson *json) {
|
||||
|
@ -395,6 +459,8 @@ void dumpAuth(SSdb *pSdb, SJson *json) {
|
|||
}
|
||||
|
||||
void dumpUser(SSdb *pSdb, SJson *json) {
|
||||
int32_t code = 0;
|
||||
int32_t lino = 0;
|
||||
void *pIter = NULL;
|
||||
SJson *items = tjsonAddArrayToObject(json, "users");
|
||||
|
||||
|
@ -404,21 +470,27 @@ void dumpUser(SSdb *pSdb, SJson *json) {
|
|||
if (pIter == NULL) break;
|
||||
|
||||
SJson *item = tjsonCreateObject();
|
||||
(void)tjsonAddItemToArray(items, item);
|
||||
(void)tjsonAddStringToObject(item, "name", pObj->user);
|
||||
(void)tjsonAddStringToObject(item, "acct", pObj->acct);
|
||||
(void)tjsonAddStringToObject(item, "createdTime", i642str(pObj->createdTime));
|
||||
(void)tjsonAddStringToObject(item, "updateTime", i642str(pObj->updateTime));
|
||||
(void)tjsonAddStringToObject(item, "superUser", i642str(pObj->superUser));
|
||||
(void)tjsonAddStringToObject(item, "authVersion", i642str(pObj->authVersion));
|
||||
(void)tjsonAddStringToObject(item, "passVersion", i642str(pObj->passVersion));
|
||||
(void)tjsonAddStringToObject(item, "numOfReadDbs", i642str(taosHashGetSize(pObj->readDbs)));
|
||||
(void)tjsonAddStringToObject(item, "numOfWriteDbs", i642str(taosHashGetSize(pObj->writeDbs)));
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddItemToArray(items, item), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "name", pObj->user), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "acct", pObj->acct), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "createdTime", i642str(pObj->createdTime)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "updateTime", i642str(pObj->updateTime)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "superUser", i642str(pObj->superUser)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "authVersion", i642str(pObj->authVersion)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "passVersion", i642str(pObj->passVersion)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "numOfReadDbs", i642str(taosHashGetSize(pObj->readDbs))), pObj,
|
||||
&lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "numOfWriteDbs", i642str(taosHashGetSize(pObj->writeDbs))), pObj,
|
||||
&lino, _OVER);
|
||||
sdbRelease(pSdb, pObj);
|
||||
}
|
||||
_OVER:
|
||||
if (code != 0) mError("failed to dump user info at line:%d since %s", lino, tstrerror(code));
|
||||
}
|
||||
|
||||
void dumpDnode(SSdb *pSdb, SJson *json) {
|
||||
int32_t code = 0;
|
||||
int32_t lino = 0;
|
||||
void *pIter = NULL;
|
||||
SJson *items = tjsonAddArrayToObject(json, "dnodes");
|
||||
|
||||
|
@ -428,17 +500,21 @@ void dumpDnode(SSdb *pSdb, SJson *json) {
|
|||
if (pIter == NULL) break;
|
||||
|
||||
SJson *item = tjsonCreateObject();
|
||||
(void)tjsonAddItemToArray(items, item);
|
||||
(void)tjsonAddStringToObject(item, "id", i642str(pObj->id));
|
||||
(void)tjsonAddStringToObject(item, "createdTime", i642str(pObj->createdTime));
|
||||
(void)tjsonAddStringToObject(item, "updateTime", i642str(pObj->updateTime));
|
||||
(void)tjsonAddStringToObject(item, "port", i642str(pObj->port));
|
||||
(void)tjsonAddStringToObject(item, "fqdn", pObj->fqdn);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddItemToArray(items, item), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "id", i642str(pObj->id)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "createdTime", i642str(pObj->createdTime)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "updateTime", i642str(pObj->updateTime)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "port", i642str(pObj->port)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "fqdn", pObj->fqdn), pObj, &lino, _OVER);
|
||||
sdbRelease(pSdb, pObj);
|
||||
}
|
||||
_OVER:
|
||||
if (code != 0) mError("failed to dump dnode info at line:%d since %s", lino, tstrerror(code));
|
||||
}
|
||||
|
||||
void dumpSnode(SSdb *pSdb, SJson *json) {
|
||||
int32_t code = 0;
|
||||
int32_t lino = 0;
|
||||
void *pIter = NULL;
|
||||
SJson *items = tjsonAddArrayToObject(json, "snodes");
|
||||
|
||||
|
@ -448,15 +524,19 @@ void dumpSnode(SSdb *pSdb, SJson *json) {
|
|||
if (pIter == NULL) break;
|
||||
|
||||
SJson *item = tjsonCreateObject();
|
||||
(void)tjsonAddItemToArray(items, item);
|
||||
(void)tjsonAddStringToObject(item, "id", i642str(pObj->id));
|
||||
(void)tjsonAddStringToObject(item, "createdTime", i642str(pObj->createdTime));
|
||||
(void)tjsonAddStringToObject(item, "updateTime", i642str(pObj->updateTime));
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddItemToArray(items, item), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "id", i642str(pObj->id)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "createdTime", i642str(pObj->createdTime)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "updateTime", i642str(pObj->updateTime)), pObj, &lino, _OVER);
|
||||
sdbRelease(pSdb, pObj);
|
||||
}
|
||||
_OVER:
|
||||
if (code != 0) mError("failed to dump snode info at line:%d since %s", lino, tstrerror(code));
|
||||
}
|
||||
|
||||
void dumpQnode(SSdb *pSdb, SJson *json) {
|
||||
int32_t code = 0;
|
||||
int32_t lino = 0;
|
||||
void *pIter = NULL;
|
||||
SJson *items = tjsonAddArrayToObject(json, "qnodes");
|
||||
|
||||
|
@ -466,15 +546,19 @@ void dumpQnode(SSdb *pSdb, SJson *json) {
|
|||
if (pIter == NULL) break;
|
||||
|
||||
SJson *item = tjsonCreateObject();
|
||||
(void)tjsonAddItemToArray(items, item);
|
||||
(void)tjsonAddStringToObject(item, "id", i642str(pObj->id));
|
||||
(void)tjsonAddStringToObject(item, "createdTime", i642str(pObj->createdTime));
|
||||
(void)tjsonAddStringToObject(item, "updateTime", i642str(pObj->updateTime));
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddItemToArray(items, item), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "id", i642str(pObj->id)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "createdTime", i642str(pObj->createdTime)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "updateTime", i642str(pObj->updateTime)), pObj, &lino, _OVER);
|
||||
sdbRelease(pSdb, pObj);
|
||||
}
|
||||
_OVER:
|
||||
if (code != 0) mError("failed to dump qnode info at line:%d since %s", lino, tstrerror(code));
|
||||
}
|
||||
|
||||
void dumpMnode(SSdb *pSdb, SJson *json) {
|
||||
int32_t code = 0;
|
||||
int32_t lino = 0;
|
||||
void *pIter = NULL;
|
||||
SJson *items = tjsonAddArrayToObject(json, "mnodes");
|
||||
|
||||
|
@ -484,15 +568,20 @@ void dumpMnode(SSdb *pSdb, SJson *json) {
|
|||
if (pIter == NULL) break;
|
||||
|
||||
SJson *item = tjsonCreateObject();
|
||||
(void)tjsonAddItemToArray(items, item);
|
||||
(void)tjsonAddStringToObject(item, "id", i642str(pObj->id));
|
||||
(void)tjsonAddStringToObject(item, "createdTime", i642str(pObj->createdTime));
|
||||
(void)tjsonAddStringToObject(item, "updateTime", i642str(pObj->updateTime));
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddItemToArray(items, item), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "id", i642str(pObj->id)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "createdTime", i642str(pObj->createdTime)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "updateTime", i642str(pObj->updateTime)), pObj, &lino, _OVER);
|
||||
sdbRelease(pSdb, pObj);
|
||||
}
|
||||
_OVER:
|
||||
if (code != 0) mError("failed to dump mnode info at line:%d since %s", lino, tstrerror(code));
|
||||
}
|
||||
|
||||
void dumpCluster(SSdb *pSdb, SJson *json) {
|
||||
int32_t code = 0;
|
||||
int32_t lino = 0;
|
||||
|
||||
void *pIter = NULL;
|
||||
SJson *items = tjsonAddArrayToObject(json, "clusters");
|
||||
|
||||
|
@ -502,16 +591,21 @@ void dumpCluster(SSdb *pSdb, SJson *json) {
|
|||
if (pIter == NULL) break;
|
||||
|
||||
SJson *item = tjsonCreateObject();
|
||||
(void)tjsonAddItemToArray(items, item);
|
||||
(void)tjsonAddStringToObject(item, "id", i642str(pObj->id));
|
||||
(void)tjsonAddStringToObject(item, "createdTime", i642str(pObj->createdTime));
|
||||
(void)tjsonAddStringToObject(item, "updateTime", i642str(pObj->updateTime));
|
||||
(void)tjsonAddStringToObject(item, "name", pObj->name);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddItemToArray(items, item), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "id", i642str(pObj->id)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "createdTime", i642str(pObj->createdTime)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "updateTime", i642str(pObj->updateTime)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "name", pObj->name), pObj, &lino, _OVER);
|
||||
sdbRelease(pSdb, pObj);
|
||||
}
|
||||
|
||||
_OVER:
|
||||
if (code != 0) mError("failed to dump cluster info at line:%d since %s", lino, tstrerror(code));
|
||||
}
|
||||
|
||||
void dumpTrans(SSdb *pSdb, SJson *json) {
|
||||
int32_t code = 0;
|
||||
int32_t lino = 0;
|
||||
void *pIter = NULL;
|
||||
SJson *items = tjsonAddArrayToObject(json, "transactions");
|
||||
|
||||
|
@ -521,53 +615,64 @@ void dumpTrans(SSdb *pSdb, SJson *json) {
|
|||
if (pIter == NULL) break;
|
||||
|
||||
SJson *item = tjsonCreateObject();
|
||||
(void)tjsonAddItemToArray(items, item);
|
||||
(void)tjsonAddStringToObject(item, "id", i642str(pObj->id));
|
||||
(void)tjsonAddStringToObject(item, "stage", i642str(pObj->stage));
|
||||
(void)tjsonAddStringToObject(item, "policy", i642str(pObj->policy));
|
||||
(void)tjsonAddStringToObject(item, "conflict", i642str(pObj->conflict));
|
||||
(void)tjsonAddStringToObject(item, "exec", i642str(pObj->exec));
|
||||
(void)tjsonAddStringToObject(item, "oper", i642str(pObj->oper));
|
||||
(void)tjsonAddStringToObject(item, "createdTime", i642str(pObj->createdTime));
|
||||
(void)tjsonAddStringToObject(item, "dbname", pObj->dbname);
|
||||
(void)tjsonAddStringToObject(item, "stbname", pObj->stbname);
|
||||
(void)tjsonAddStringToObject(item, "opername", pObj->opername);
|
||||
(void)tjsonAddStringToObject(item, "commitLogNum", i642str(taosArrayGetSize(pObj->commitActions)));
|
||||
(void)tjsonAddStringToObject(item, "redoActionNum", i642str(taosArrayGetSize(pObj->redoActions)));
|
||||
(void)tjsonAddStringToObject(item, "undoActionNum", i642str(taosArrayGetSize(pObj->undoActions)));
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddItemToArray(items, item), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "id", i642str(pObj->id)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "stage", i642str(pObj->stage)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "policy", i642str(pObj->policy)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "conflict", i642str(pObj->conflict)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "exec", i642str(pObj->exec)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "oper", i642str(pObj->oper)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "createdTime", i642str(pObj->createdTime)), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "dbname", pObj->dbname), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "stbname", pObj->stbname), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "opername", pObj->opername), pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "commitLogNum", i642str(taosArrayGetSize(pObj->commitActions))),
|
||||
pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "redoActionNum", i642str(taosArrayGetSize(pObj->redoActions))),
|
||||
pObj, &lino, _OVER);
|
||||
RETRIEVE_CHECK_GOTO(tjsonAddStringToObject(item, "undoActionNum", i642str(taosArrayGetSize(pObj->undoActions))),
|
||||
pObj, &lino, _OVER);
|
||||
sdbRelease(pSdb, pObj);
|
||||
}
|
||||
|
||||
_OVER:
|
||||
if (code != 0) mError("failed to dump trans info at line:%d since %s", lino, tstrerror(code));
|
||||
}
|
||||
|
||||
void dumpHeader(SSdb *pSdb, SJson *json) {
|
||||
(void)tjsonAddStringToObject(json, "sver", i642str(1));
|
||||
(void)tjsonAddStringToObject(json, "applyIndex", i642str(pSdb->applyIndex));
|
||||
(void)tjsonAddStringToObject(json, "applyTerm", i642str(pSdb->applyTerm));
|
||||
(void)tjsonAddStringToObject(json, "applyConfig", i642str(pSdb->applyConfig));
|
||||
int32_t code = 0;
|
||||
int32_t lino = 0;
|
||||
TAOS_CHECK_GOTO(tjsonAddStringToObject(json, "sver", i642str(1)), &lino, _OVER);
|
||||
TAOS_CHECK_GOTO(tjsonAddStringToObject(json, "applyIndex", i642str(pSdb->applyIndex)), &lino, _OVER);
|
||||
TAOS_CHECK_GOTO(tjsonAddStringToObject(json, "applyTerm", i642str(pSdb->applyTerm)), &lino, _OVER);
|
||||
TAOS_CHECK_GOTO(tjsonAddStringToObject(json, "applyConfig", i642str(pSdb->applyConfig)), &lino, _OVER);
|
||||
|
||||
SJson *maxIdsJson = tjsonCreateObject();
|
||||
(void)tjsonAddItemToObject(json, "maxIds", maxIdsJson);
|
||||
TAOS_CHECK_GOTO(tjsonAddItemToObject(json, "maxIds", maxIdsJson), &lino, _OVER);
|
||||
for (int32_t i = 0; i < SDB_MAX; ++i) {
|
||||
if(i == 5) continue;
|
||||
int64_t maxId = 0;
|
||||
if (i < SDB_MAX) {
|
||||
maxId = pSdb->maxId[i];
|
||||
}
|
||||
(void)tjsonAddStringToObject(maxIdsJson, sdbTableName(i), i642str(maxId));
|
||||
TAOS_CHECK_GOTO(tjsonAddStringToObject(maxIdsJson, sdbTableName(i), i642str(maxId)), &lino, _OVER);
|
||||
}
|
||||
|
||||
SJson *tableVersJson = tjsonCreateObject();
|
||||
(void)tjsonAddItemToObject(json, "tableVers", tableVersJson);
|
||||
TAOS_CHECK_GOTO(tjsonAddItemToObject(json, "tableVers", tableVersJson), &lino, _OVER);
|
||||
for (int32_t i = 0; i < SDB_MAX; ++i) {
|
||||
int64_t tableVer = 0;
|
||||
if (i < SDB_MAX) {
|
||||
tableVer = pSdb->tableVer[i];
|
||||
}
|
||||
(void)tjsonAddStringToObject(tableVersJson, sdbTableName(i), i642str(tableVer));
|
||||
TAOS_CHECK_GOTO(tjsonAddStringToObject(tableVersJson, sdbTableName(i), i642str(tableVer)), &lino, _OVER);
|
||||
}
|
||||
|
||||
_OVER:
|
||||
if (code != 0) mError("failed to dump sdb info at line:%d since %s", lino, tstrerror(code));
|
||||
}
|
||||
|
||||
void mndDumpSdb() {
|
||||
int32_t mndDumpSdb() {
|
||||
mInfo("start to dump sdb info to sdb.json");
|
||||
|
||||
char path[PATH_MAX * 2] = {0};
|
||||
|
@ -581,12 +686,12 @@ void mndDumpSdb() {
|
|||
msgCb.mgmt = (SMgmtWrapper *)(&msgCb); // hack
|
||||
tmsgSetDefault(&msgCb);
|
||||
|
||||
(void)walInit(NULL);
|
||||
(void)syncInit();
|
||||
TAOS_CHECK_RETURN(walInit(NULL));
|
||||
TAOS_CHECK_RETURN(syncInit());
|
||||
|
||||
SMnodeOpt opt = {.msgCb = msgCb};
|
||||
SMnode *pMnode = mndOpen(path, &opt);
|
||||
if (pMnode == NULL) return;
|
||||
if (pMnode == NULL) return -1;
|
||||
|
||||
SSdb *pSdb = pMnode->pSdb;
|
||||
SJson *json = tjsonCreateObject();
|
||||
|
@ -616,21 +721,21 @@ void mndDumpSdb() {
|
|||
char file[] = "sdb.json";
|
||||
TdFilePtr pFile = taosOpenFile(file, TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_TRUNC | TD_FILE_WRITE_THROUGH);
|
||||
if (pFile == NULL) {
|
||||
terrno = terrno;
|
||||
mError("failed to write %s since %s", file, terrstr());
|
||||
return;
|
||||
return terrno;
|
||||
}
|
||||
(void)taosWriteFile(pFile, pCont, contLen);
|
||||
(void)taosWriteFile(pFile, "\n", 1);
|
||||
UNUSED(taosFsyncFile(pFile));
|
||||
(void)taosCloseFile(&pFile);
|
||||
TAOS_CHECK_RETURN(taosWriteFile(pFile, pCont, contLen));
|
||||
TAOS_CHECK_RETURN(taosWriteFile(pFile, "\n", 1));
|
||||
TAOS_CHECK_RETURN(taosFsyncFile(pFile));
|
||||
TAOS_CHECK_RETURN(taosCloseFile(&pFile));
|
||||
tjsonDelete(json);
|
||||
taosMemoryFree(pCont);
|
||||
|
||||
mInfo("dump sdb info success");
|
||||
return 0;
|
||||
}
|
||||
|
||||
void mndDeleteTrans() {
|
||||
int32_t mndDeleteTrans() {
|
||||
mInfo("start to dump sdb info to sdb.json");
|
||||
|
||||
char path[PATH_MAX * 2] = {0};
|
||||
|
@ -644,16 +749,18 @@ void mndDeleteTrans() {
|
|||
msgCb.mgmt = (SMgmtWrapper *)(&msgCb); // hack
|
||||
tmsgSetDefault(&msgCb);
|
||||
|
||||
(void)walInit(NULL);
|
||||
(void)syncInit();
|
||||
TAOS_CHECK_RETURN(walInit(NULL));
|
||||
TAOS_CHECK_RETURN(syncInit());
|
||||
|
||||
SMnodeOpt opt = {.msgCb = msgCb};
|
||||
SMnode *pMnode = mndOpen(path, &opt);
|
||||
if (pMnode == NULL) return;
|
||||
if (pMnode == NULL) return terrno;
|
||||
|
||||
(void)sdbWriteFileForDump(pMnode->pSdb);
|
||||
TAOS_CHECK_RETURN(sdbWriteFileForDump(pMnode->pSdb));
|
||||
|
||||
mInfo("dump sdb info success");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
|
|
@ -133,7 +133,6 @@ int mndSetCreateIdxRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SStb
|
|||
}
|
||||
static void *mndBuildDropIdxReq(SMnode *pMnode, SVgObj *pVgroup, SStbObj *pStbObj, SIdxObj *pIdx, int32_t *contLen) {
|
||||
int32_t len = 0;
|
||||
int32_t ret = 0;
|
||||
|
||||
SDropIndexReq req = {0};
|
||||
memcpy(req.colName, pIdx->colName, sizeof(pIdx->colName));
|
||||
|
@ -159,7 +158,11 @@ static void *mndBuildDropIdxReq(SMnode *pMnode, SVgObj *pVgroup, SStbObj *pStbOb
|
|||
pHead->vgId = htonl(pVgroup->vgId);
|
||||
|
||||
void *pBuf = POINTER_SHIFT(pHead, sizeof(SMsgHead));
|
||||
(void)tSerializeSDropIdxReq(pBuf, len - sizeof(SMsgHead), &req);
|
||||
int32_t ret = 0;
|
||||
if ((ret = tSerializeSDropIdxReq(pBuf, len - sizeof(SMsgHead), &req)) < 0) {
|
||||
terrno = ret;
|
||||
return NULL;
|
||||
}
|
||||
*contLen = len;
|
||||
return pHead;
|
||||
_err:
|
||||
|
@ -333,7 +336,7 @@ void mndReleaseIdx(SMnode *pMnode, SIdxObj *pIdx) {
|
|||
|
||||
SDbObj *mndAcquireDbByIdx(SMnode *pMnode, const char *idxName) {
|
||||
SName name = {0};
|
||||
(void)tNameFromString(&name, idxName, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE);
|
||||
if ((terrno = tNameFromString(&name, idxName, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE)) < 0) return NULL;
|
||||
|
||||
char db[TSDB_TABLE_FNAME_LEN] = {0};
|
||||
(void)tNameGetFullDbName(&name, db);
|
||||
|
@ -559,6 +562,8 @@ int32_t mndRetrieveTagIdx(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, i
|
|||
int32_t numOfRows = 0;
|
||||
SIdxObj *pIdx = NULL;
|
||||
int32_t cols = 0;
|
||||
int32_t code = 0;
|
||||
int32_t lino = 0;
|
||||
|
||||
SDbObj *pDb = NULL;
|
||||
if (strlen(pShow->db) > 0) {
|
||||
|
@ -578,7 +583,10 @@ int32_t mndRetrieveTagIdx(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, i
|
|||
cols = 0;
|
||||
|
||||
SName idxName = {0};
|
||||
(void)tNameFromString(&idxName, pIdx->name, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE);
|
||||
if ((code = tNameFromString(&idxName, pIdx->name, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE)) != 0) {
|
||||
sdbRelease(pSdb, pIdx);
|
||||
goto _OVER;
|
||||
}
|
||||
char n1[TSDB_TABLE_FNAME_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||
|
||||
STR_TO_VARSTR(n1, (char *)tNameGetTableName(&idxName));
|
||||
|
@ -587,42 +595,49 @@ int32_t mndRetrieveTagIdx(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, i
|
|||
STR_TO_VARSTR(n2, (char *)mndGetDbStr(pIdx->db));
|
||||
|
||||
SName stbName = {0};
|
||||
(void)tNameFromString(&stbName, pIdx->stb, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE);
|
||||
if ((code = tNameFromString(&stbName, pIdx->stb, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE)) != 0) {
|
||||
sdbRelease(pSdb, pIdx);
|
||||
goto _OVER;
|
||||
}
|
||||
char n3[TSDB_TABLE_FNAME_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||
STR_TO_VARSTR(n3, (char *)tNameGetTableName(&stbName));
|
||||
|
||||
SColumnInfoData *pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)n1, false);
|
||||
RETRIEVE_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, (const char *)n1, false), pIdx, &lino, _OVER);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)n2, false);
|
||||
RETRIEVE_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, (const char *)n2, false), pIdx, &lino, _OVER);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)n3, false);
|
||||
RETRIEVE_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, (const char *)n3, false), pIdx, &lino, _OVER);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
|
||||
(void)colDataSetVal(pColInfo, numOfRows, NULL, true);
|
||||
RETRIEVE_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, NULL, true), pIdx, &lino, _OVER);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&pIdx->createdTime, false);
|
||||
RETRIEVE_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, (const char *)&pIdx->createdTime, false), pIdx, &lino,
|
||||
_OVER);
|
||||
|
||||
char col[TSDB_TABLE_FNAME_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||
STR_TO_VARSTR(col, (char *)pIdx->colName);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)col, false);
|
||||
RETRIEVE_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, (const char *)col, false), pIdx, &lino, _OVER);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
|
||||
char tag[TSDB_TABLE_FNAME_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||
STR_TO_VARSTR(tag, (char *)"tag_index");
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)tag, false);
|
||||
RETRIEVE_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, (const char *)tag, false), pIdx, &lino, _OVER);
|
||||
|
||||
numOfRows++;
|
||||
sdbRelease(pSdb, pIdx);
|
||||
}
|
||||
|
||||
_OVER:
|
||||
if (code != 0) mError("failed to retrieve at line:%d, since %s", lino, tstrerror(code));
|
||||
|
||||
mndReleaseDb(pMnode, pDb);
|
||||
pShow->numOfRows += numOfRows;
|
||||
return numOfRows;
|
||||
|
|
|
@ -846,6 +846,7 @@ static int32_t mndRetrieveConns(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBl
|
|||
if (pShow->pIter == NULL) {
|
||||
SProfileMgmt *pMgmt = &pMnode->profileMgmt;
|
||||
pShow->pIter = taosCacheCreateIter(pMgmt->connCache);
|
||||
if (!pShow->pIter) return terrno;
|
||||
}
|
||||
|
||||
while (numOfRows < rows) {
|
||||
|
@ -1005,6 +1006,7 @@ static int32_t mndRetrieveQueries(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *p
|
|||
if (pShow->pIter == NULL) {
|
||||
SProfileMgmt *pMgmt = &pMnode->profileMgmt;
|
||||
pShow->pIter = taosCacheCreateIter(pMgmt->connCache);
|
||||
if (!pShow->pIter) return terrno;
|
||||
}
|
||||
|
||||
// means fetched some data last time for this conn
|
||||
|
@ -1042,6 +1044,7 @@ static int32_t mndRetrieveApps(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlo
|
|||
if (pShow->pIter == NULL) {
|
||||
SProfileMgmt *pMgmt = &pMnode->profileMgmt;
|
||||
pShow->pIter = taosCacheCreateIter(pMgmt->appCache);
|
||||
if (!pShow->pIter) return terrno;
|
||||
}
|
||||
|
||||
while (numOfRows < rows) {
|
||||
|
|
|
@ -651,6 +651,9 @@ static int32_t mndCreateSma(SMnode *pMnode, SRpcMsg *pReq, SMCreateSmaReq *pCrea
|
|||
streamObj.targetDbUid = pDb->uid;
|
||||
streamObj.version = 1;
|
||||
streamObj.sql = taosStrdup(pCreate->sql);
|
||||
if (!streamObj.sql) {
|
||||
return terrno;
|
||||
}
|
||||
streamObj.smaId = smaObj.uid;
|
||||
streamObj.conf.watermark = pCreate->watermark;
|
||||
streamObj.deleteMark = pCreate->deleteMark;
|
||||
|
@ -658,6 +661,10 @@ static int32_t mndCreateSma(SMnode *pMnode, SRpcMsg *pReq, SMCreateSmaReq *pCrea
|
|||
streamObj.conf.trigger = STREAM_TRIGGER_WINDOW_CLOSE;
|
||||
streamObj.conf.triggerParam = pCreate->maxDelay;
|
||||
streamObj.ast = taosStrdup(smaObj.ast);
|
||||
if (!streamObj.ast) {
|
||||
taosMemoryFree(streamObj.sql);
|
||||
return terrno;
|
||||
}
|
||||
streamObj.indexForMultiAggBalance = -1;
|
||||
|
||||
// check the maxDelay
|
||||
|
@ -1509,6 +1516,9 @@ static int32_t mndRetrieveIdx(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBloc
|
|||
if (pShow->pIter == NULL) {
|
||||
pShow->pIter = taosMemoryCalloc(1, sizeof(SSmaAndTagIter));
|
||||
}
|
||||
if (!pShow->pIter) {
|
||||
return terrno;
|
||||
}
|
||||
int32_t read = mndRetrieveSma(pReq, pShow, pBlock, rows);
|
||||
if (read < rows) {
|
||||
read += mndRetrieveTagIdx(pReq, pShow, pBlock, rows - read);
|
||||
|
@ -1555,27 +1565,6 @@ static void initSMAObj(SCreateTSMACxt* pCxt) {
|
|||
pCxt->pSma->ast = pCxt->pCreateSmaReq->ast;
|
||||
}
|
||||
|
||||
static void initStreamObj(SStreamObj *pStream, const char *streamName, const SMCreateSmaReq *pCreateReq,
|
||||
const SDbObj *pDb, SSmaObj *pSma) {
|
||||
tstrncpy(pStream->name, streamName, TSDB_STREAM_FNAME_LEN);
|
||||
tstrncpy(pStream->sourceDb, pDb->name, TSDB_DB_FNAME_LEN);
|
||||
tstrncpy(pStream->targetDb, pDb->name, TSDB_DB_FNAME_LEN);
|
||||
pStream->createTime = taosGetTimestampMs();
|
||||
pStream->updateTime = pStream->createTime;
|
||||
pStream->uid = mndGenerateUid(streamName, strlen(streamName));
|
||||
pStream->sourceDbUid = pDb->uid;
|
||||
pStream->targetDbUid = pDb->uid;
|
||||
pStream->version = 1;
|
||||
pStream->sql = taosStrdup(pCreateReq->sql);
|
||||
pStream->smaId = pSma->uid;
|
||||
pStream->conf.watermark = 0;
|
||||
pStream->deleteMark = 0;
|
||||
pStream->conf.fillHistory = STREAM_FILL_HISTORY_ON;
|
||||
pStream->conf.trigger = STREAM_TRIGGER_WINDOW_CLOSE;
|
||||
pStream->conf.triggerParam = 10000;
|
||||
pStream->ast = taosStrdup(pSma->ast);
|
||||
}
|
||||
|
||||
static int32_t mndCreateTSMABuildCreateStreamReq(SCreateTSMACxt *pCxt) {
|
||||
tstrncpy(pCxt->pCreateStreamReq->name, pCxt->streamName, TSDB_STREAM_FNAME_LEN);
|
||||
tstrncpy(pCxt->pCreateStreamReq->sourceDB, pCxt->pDb->name, TSDB_DB_FNAME_LEN);
|
||||
|
@ -1653,11 +1642,15 @@ static int32_t mndCreateTSMABuildCreateStreamReq(SCreateTSMACxt *pCxt) {
|
|||
return code;
|
||||
}
|
||||
|
||||
static void mndCreateTSMABuildDropStreamReq(SCreateTSMACxt* pCxt) {
|
||||
static int32_t mndCreateTSMABuildDropStreamReq(SCreateTSMACxt* pCxt) {
|
||||
tstrncpy(pCxt->pDropStreamReq->name, pCxt->streamName, TSDB_STREAM_FNAME_LEN);
|
||||
pCxt->pDropStreamReq->igNotExists = false;
|
||||
pCxt->pDropStreamReq->sql = taosStrdup(pCxt->pDropSmaReq->name);
|
||||
if (!pCxt->pDropStreamReq->sql) {
|
||||
return terrno;
|
||||
}
|
||||
pCxt->pDropStreamReq->sqlLen = strlen(pCxt->pDropStreamReq->sql);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
static int32_t mndSetUpdateDbTsmaVersionPrepareLogs(SMnode *pMnode, STrans *pTrans, SDbObj *pOld, SDbObj *pNew) {
|
||||
|
@ -1815,7 +1808,10 @@ static int32_t mndCreateTSMA(SCreateTSMACxt *pCxt) {
|
|||
if (TSDB_CODE_SUCCESS != code) {
|
||||
goto _OVER;
|
||||
}
|
||||
mndCreateTSMABuildDropStreamReq(pCxt);
|
||||
code = mndCreateTSMABuildDropStreamReq(pCxt);
|
||||
if (TSDB_CODE_SUCCESS != code) {
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
if (TSDB_CODE_SUCCESS != (code = mndCreateTSMATxnPrepare(pCxt))) {
|
||||
goto _OVER;
|
||||
|
@ -1985,7 +1981,10 @@ static int32_t mndDropTSMA(SCreateTSMACxt* pCxt) {
|
|||
}
|
||||
SMDropStreamReq dropStreamReq = {0};
|
||||
pCxt->pDropStreamReq = &dropStreamReq;
|
||||
mndCreateTSMABuildDropStreamReq(pCxt);
|
||||
code = mndCreateTSMABuildDropStreamReq(pCxt);
|
||||
if (TSDB_CODE_SUCCESS != code) {
|
||||
goto _OVER;
|
||||
}
|
||||
mndTransSetDbName(pTrans, pCxt->pDb->name, NULL);
|
||||
if (mndTransCheckConflict(pCxt->pMnode, pTrans) != 0) goto _OVER;
|
||||
mndTransSetSerial(pTrans);
|
||||
|
@ -2141,12 +2140,15 @@ static int32_t mndRetrieveTSMA(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlo
|
|||
SMnode * pMnode = pReq->info.node;
|
||||
int32_t code = 0;
|
||||
SColumnInfoData *pColInfo;
|
||||
if (pShow->db[0]) {
|
||||
pDb = mndAcquireDb(pMnode, pShow->db);
|
||||
}
|
||||
if (pShow->pIter == NULL) {
|
||||
pShow->pIter = taosMemoryCalloc(1, sizeof(SSmaAndTagIter));
|
||||
}
|
||||
if (!pShow->pIter) {
|
||||
return terrno;
|
||||
}
|
||||
if (pShow->db[0]) {
|
||||
pDb = mndAcquireDb(pMnode, pShow->db);
|
||||
}
|
||||
SSmaAndTagIter *pIter = pShow->pIter;
|
||||
while (numOfRows < rows) {
|
||||
pIter->pSmaIter = sdbFetch(pMnode->pSdb, SDB_SMA, pIter->pSmaIter, (void **)&pSma);
|
||||
|
@ -2273,7 +2275,7 @@ static int32_t mndRetrieveTSMA(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlo
|
|||
mndReleaseDb(pMnode, pSrcDb);
|
||||
if (TSDB_CODE_SUCCESS != code) {
|
||||
sdbCancelFetch(pMnode->pSdb, pIter->pSmaIter);
|
||||
numOfRows = -1;
|
||||
numOfRows = code;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,9 +62,8 @@ static int32_t mndProcessStreamReqCheckpoint(SRpcMsg *pReq);
|
|||
static int32_t mndProcessCheckpointReport(SRpcMsg *pReq);
|
||||
static int32_t mndProcessConsensusInTmr(SRpcMsg *pMsg);
|
||||
static void doSendQuickRsp(SRpcHandleInfo *pInfo, int32_t msgSize, int32_t vgId, int32_t code);
|
||||
static int32_t mndProcessDropOrphanTaskReq(SRpcMsg* pReq);
|
||||
static int32_t mndFindChangedNodeInfo(SMnode *pMnode, const SArray *pPrevNodeList, const SArray *pNodeList, SVgroupChangeInfo* pInfo);
|
||||
static void mndDestroyVgroupChangeInfo(SVgroupChangeInfo *pInfo);
|
||||
static int32_t mndProcessDropOrphanTaskReq(SRpcMsg *pReq);
|
||||
static void saveTaskAndNodeInfoIntoBuf(SStreamObj *pStream, SStreamExecInfo *pExecNode);
|
||||
|
||||
static void addAllStreamTasksIntoBuf(SMnode *pMnode, SStreamExecInfo *pExecInfo);
|
||||
static void removeExpiredNodeInfo(const SArray *pNodeSnapshot);
|
||||
|
@ -920,6 +919,85 @@ _OVER:
|
|||
return code;
|
||||
}
|
||||
|
||||
static int32_t mndProcessRestartStreamReq(SRpcMsg *pReq) {
|
||||
SMnode *pMnode = pReq->info.node;
|
||||
SStreamObj *pStream = NULL;
|
||||
int32_t code = 0;
|
||||
SMPauseStreamReq pauseReq = {0};
|
||||
|
||||
if (tDeserializeSMPauseStreamReq(pReq->pCont, pReq->contLen, &pauseReq) < 0) {
|
||||
return TSDB_CODE_INVALID_MSG;
|
||||
}
|
||||
|
||||
code = mndAcquireStream(pMnode, pauseReq.name, &pStream);
|
||||
if (pStream == NULL || code != 0) {
|
||||
if (pauseReq.igNotExists) {
|
||||
mInfo("stream:%s, not exist, not restart stream", pauseReq.name);
|
||||
return 0;
|
||||
} else {
|
||||
mError("stream:%s not exist, failed to restart stream", pauseReq.name);
|
||||
TAOS_RETURN(TSDB_CODE_MND_STREAM_NOT_EXIST);
|
||||
}
|
||||
}
|
||||
|
||||
mInfo("stream:%s,%" PRId64 " start to restart stream", pauseReq.name, pStream->uid);
|
||||
if ((code = mndCheckDbPrivilegeByName(pMnode, pReq->info.conn.user, MND_OPER_WRITE_DB, pStream->targetDb)) != 0) {
|
||||
sdbRelease(pMnode->pSdb, pStream);
|
||||
return code;
|
||||
}
|
||||
|
||||
// check if it is conflict with other trans in both sourceDb and targetDb.
|
||||
code = mndStreamTransConflictCheck(pMnode, pStream->uid, MND_STREAM_RESTART_NAME, true);
|
||||
if (code) {
|
||||
sdbRelease(pMnode->pSdb, pStream);
|
||||
return code;
|
||||
}
|
||||
|
||||
bool updated = mndStreamNodeIsUpdated(pMnode);
|
||||
if (updated) {
|
||||
mError("tasks are not ready for restart, node update detected");
|
||||
sdbRelease(pMnode->pSdb, pStream);
|
||||
TAOS_RETURN(TSDB_CODE_STREAM_TASK_IVLD_STATUS);
|
||||
}
|
||||
|
||||
STrans *pTrans = NULL;
|
||||
code = doCreateTrans(pMnode, pStream, pReq, TRN_CONFLICT_NOTHING, MND_STREAM_RESTART_NAME, "restart the stream", &pTrans);
|
||||
if (pTrans == NULL || code) {
|
||||
mError("stream:%s failed to pause stream since %s", pauseReq.name, tstrerror(code));
|
||||
sdbRelease(pMnode->pSdb, pStream);
|
||||
return code;
|
||||
}
|
||||
|
||||
code = mndStreamRegisterTrans(pTrans, MND_STREAM_RESTART_NAME, pStream->uid);
|
||||
if (code) {
|
||||
sdbRelease(pMnode->pSdb, pStream);
|
||||
mndTransDrop(pTrans);
|
||||
return code;
|
||||
}
|
||||
|
||||
// if nodeUpdate happened, not send pause trans
|
||||
code = mndStreamSetRestartAction(pMnode, pTrans, pStream);
|
||||
if (code) {
|
||||
mError("stream:%s, failed to restart task since %s", pauseReq.name, tstrerror(code));
|
||||
sdbRelease(pMnode->pSdb, pStream);
|
||||
mndTransDrop(pTrans);
|
||||
return code;
|
||||
}
|
||||
|
||||
code = mndTransPrepare(pMnode, pTrans);
|
||||
if (code != TSDB_CODE_SUCCESS && code != TSDB_CODE_ACTION_IN_PROGRESS) {
|
||||
mError("trans:%d, failed to prepare restart stream trans since %s", pTrans->id, tstrerror(code));
|
||||
sdbRelease(pMnode->pSdb, pStream);
|
||||
mndTransDrop(pTrans);
|
||||
return code;
|
||||
}
|
||||
|
||||
sdbRelease(pMnode->pSdb, pStream);
|
||||
mndTransDrop(pTrans);
|
||||
|
||||
return TSDB_CODE_ACTION_IN_PROGRESS;
|
||||
}
|
||||
|
||||
int64_t mndStreamGenChkptId(SMnode *pMnode, bool lock) {
|
||||
SStreamObj *pStream = NULL;
|
||||
void *pIter = NULL;
|
||||
|
@ -973,82 +1051,6 @@ int64_t mndStreamGenChkptId(SMnode *pMnode, bool lock) {
|
|||
return maxChkptId + 1;
|
||||
}
|
||||
|
||||
static int32_t mndBuildStreamCheckpointSourceReq(void **pBuf, int32_t *pLen, int32_t nodeId, int64_t checkpointId,
|
||||
int64_t streamId, int32_t taskId, int32_t transId, int8_t mndTrigger) {
|
||||
SStreamCheckpointSourceReq req = {0};
|
||||
req.checkpointId = checkpointId;
|
||||
req.nodeId = nodeId;
|
||||
req.expireTime = -1;
|
||||
req.streamId = streamId; // pTask->id.streamId;
|
||||
req.taskId = taskId; // pTask->id.taskId;
|
||||
req.transId = transId;
|
||||
req.mndTrigger = mndTrigger;
|
||||
|
||||
int32_t code;
|
||||
int32_t blen;
|
||||
|
||||
tEncodeSize(tEncodeStreamCheckpointSourceReq, &req, blen, code);
|
||||
if (code < 0) {
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
}
|
||||
|
||||
int32_t tlen = sizeof(SMsgHead) + blen;
|
||||
|
||||
void *buf = taosMemoryMalloc(tlen);
|
||||
if (buf == NULL) {
|
||||
return terrno;
|
||||
}
|
||||
|
||||
void *abuf = POINTER_SHIFT(buf, sizeof(SMsgHead));
|
||||
SEncoder encoder;
|
||||
tEncoderInit(&encoder, abuf, tlen);
|
||||
int32_t pos = tEncodeStreamCheckpointSourceReq(&encoder, &req);
|
||||
if (pos == -1) {
|
||||
tEncoderClear(&encoder);
|
||||
return TSDB_CODE_INVALID_MSG;
|
||||
}
|
||||
|
||||
SMsgHead *pMsgHead = (SMsgHead *)buf;
|
||||
pMsgHead->contLen = htonl(tlen);
|
||||
pMsgHead->vgId = htonl(nodeId);
|
||||
|
||||
tEncoderClear(&encoder);
|
||||
|
||||
*pBuf = buf;
|
||||
*pLen = tlen;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int32_t doSetCheckpointAction(SMnode *pMnode, STrans *pTrans, SStreamTask *pTask, int64_t checkpointId,
|
||||
int8_t mndTrigger) {
|
||||
void *buf;
|
||||
int32_t tlen;
|
||||
int32_t code = 0;
|
||||
SEpSet epset = {0};
|
||||
bool hasEpset = false;
|
||||
|
||||
if ((code = mndBuildStreamCheckpointSourceReq(&buf, &tlen, pTask->info.nodeId, checkpointId, pTask->id.streamId,
|
||||
pTask->id.taskId, pTrans->id, mndTrigger)) < 0) {
|
||||
taosMemoryFree(buf);
|
||||
return code;
|
||||
}
|
||||
|
||||
code = extractNodeEpset(pMnode, &epset, &hasEpset, pTask->id.taskId, pTask->info.nodeId);
|
||||
if (code != TSDB_CODE_SUCCESS || !hasEpset) {
|
||||
taosMemoryFree(buf);
|
||||
return code;
|
||||
}
|
||||
|
||||
code = setTransAction(pTrans, buf, tlen, TDMT_VND_STREAM_CHECK_POINT_SOURCE, &epset, TSDB_CODE_SYN_PROPOSE_NOT_READY,
|
||||
TSDB_CODE_VND_INVALID_VGROUP_ID);
|
||||
if (code != 0) {
|
||||
taosMemoryFree(buf);
|
||||
}
|
||||
|
||||
return code;
|
||||
}
|
||||
|
||||
static int32_t mndProcessStreamCheckpointTrans(SMnode *pMnode, SStreamObj *pStream, int64_t checkpointId,
|
||||
int8_t mndTrigger, bool lock) {
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
|
@ -1096,7 +1098,7 @@ static int32_t mndProcessStreamCheckpointTrans(SMnode *pMnode, SStreamObj *pStre
|
|||
int32_t sz = taosArrayGetSize(pLevel);
|
||||
for (int32_t j = 0; j < sz; j++) {
|
||||
SStreamTask *pTask = taosArrayGetP(pLevel, j);
|
||||
code = doSetCheckpointAction(pMnode, pTrans, pTask, checkpointId, mndTrigger);
|
||||
code = mndStreamSetCheckpointAction(pMnode, pTrans, pTask, checkpointId, mndTrigger);
|
||||
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
taosWUnLockLatch(&pStream->lock);
|
||||
|
@ -1143,70 +1145,9 @@ int32_t extractStreamNodeList(SMnode *pMnode) {
|
|||
return taosArrayGetSize(execInfo.pNodeList);
|
||||
}
|
||||
|
||||
static int32_t doCheckForUpdated(SMnode *pMnode, SArray **ppNodeSnapshot) {
|
||||
bool allReady = false;
|
||||
bool nodeUpdated = false;
|
||||
SVgroupChangeInfo changeInfo = {0};
|
||||
|
||||
int32_t numOfNodes = extractStreamNodeList(pMnode);
|
||||
|
||||
if (numOfNodes == 0) {
|
||||
mDebug("stream task node change checking done, no vgroups exist, do nothing");
|
||||
execInfo.ts = taosGetTimestampSec();
|
||||
return false;
|
||||
}
|
||||
|
||||
for (int32_t i = 0; i < numOfNodes; ++i) {
|
||||
SNodeEntry *pNodeEntry = taosArrayGet(execInfo.pNodeList, i);
|
||||
if (pNodeEntry == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (pNodeEntry->stageUpdated) {
|
||||
mDebug("stream task not ready due to node update detected, checkpoint not issued");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
int32_t code = mndTakeVgroupSnapshot(pMnode, &allReady, ppNodeSnapshot);
|
||||
if (code) {
|
||||
mError("failed to get the vgroup snapshot, ignore it and continue");
|
||||
}
|
||||
|
||||
if (!allReady) {
|
||||
mWarn("not all vnodes ready, quit from vnodes status check");
|
||||
return true;
|
||||
}
|
||||
|
||||
code = mndFindChangedNodeInfo(pMnode, execInfo.pNodeList, *ppNodeSnapshot, &changeInfo);
|
||||
if (code) {
|
||||
nodeUpdated = false;
|
||||
} else {
|
||||
nodeUpdated = (taosArrayGetSize(changeInfo.pUpdateNodeList) > 0);
|
||||
if (nodeUpdated) {
|
||||
mDebug("stream tasks not ready due to node update");
|
||||
}
|
||||
}
|
||||
|
||||
mndDestroyVgroupChangeInfo(&changeInfo);
|
||||
return nodeUpdated;
|
||||
}
|
||||
|
||||
// check if the node update happens or not
|
||||
static bool taskNodeIsUpdated(SMnode *pMnode) {
|
||||
SArray *pNodeSnapshot = NULL;
|
||||
|
||||
streamMutexLock(&execInfo.lock);
|
||||
bool updated = doCheckForUpdated(pMnode, &pNodeSnapshot);
|
||||
streamMutexUnlock(&execInfo.lock);
|
||||
|
||||
taosArrayDestroy(pNodeSnapshot);
|
||||
return updated;
|
||||
}
|
||||
|
||||
static int32_t mndCheckTaskAndNodeStatus(SMnode *pMnode) {
|
||||
bool ready = true;
|
||||
if (taskNodeIsUpdated(pMnode)) {
|
||||
if (mndStreamNodeIsUpdated(pMnode)) {
|
||||
TAOS_RETURN(TSDB_CODE_STREAM_TASK_IVLD_STATUS);
|
||||
}
|
||||
|
||||
|
@ -1605,32 +1546,6 @@ int32_t mndDropStreamByDb(SMnode *pMnode, STrans *pTrans, SDbObj *pDb) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
int32_t mndGetNumOfStreams(SMnode *pMnode, char *dbName, int32_t *pNumOfStreams) {
|
||||
SSdb *pSdb = pMnode->pSdb;
|
||||
SDbObj *pDb = mndAcquireDb(pMnode, dbName);
|
||||
if (pDb == NULL) {
|
||||
TAOS_RETURN(TSDB_CODE_MND_DB_NOT_SELECTED);
|
||||
}
|
||||
|
||||
int32_t numOfStreams = 0;
|
||||
void *pIter = NULL;
|
||||
while (1) {
|
||||
SStreamObj *pStream = NULL;
|
||||
pIter = sdbFetch(pSdb, SDB_STREAM, pIter, (void **)&pStream);
|
||||
if (pIter == NULL) break;
|
||||
|
||||
if (pStream->sourceDbUid == pDb->uid) {
|
||||
numOfStreams++;
|
||||
}
|
||||
|
||||
sdbRelease(pSdb, pStream);
|
||||
}
|
||||
|
||||
*pNumOfStreams = numOfStreams;
|
||||
mndReleaseDb(pMnode, pDb);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int32_t mndRetrieveStream(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows) {
|
||||
SMnode *pMnode = pReq->info.node;
|
||||
SSdb *pSdb = pMnode->pSdb;
|
||||
|
@ -1770,7 +1685,7 @@ static int32_t mndProcessPauseStreamReq(SRpcMsg *pReq) {
|
|||
TAOS_RETURN(code);
|
||||
}
|
||||
|
||||
bool updated = taskNodeIsUpdated(pMnode);
|
||||
bool updated = mndStreamNodeIsUpdated(pMnode);
|
||||
if (updated) {
|
||||
mError("tasks are not ready for pause, node update detected");
|
||||
sdbRelease(pMnode->pSdb, pStream);
|
||||
|
@ -1965,102 +1880,6 @@ static int32_t mndProcessResumeStreamReq(SRpcMsg *pReq) {
|
|||
return TSDB_CODE_ACTION_IN_PROGRESS;
|
||||
}
|
||||
|
||||
static bool isNodeEpsetChanged(const SEpSet *pPrevEpset, const SEpSet *pCurrent) {
|
||||
const SEp *pEp = GET_ACTIVE_EP(pPrevEpset);
|
||||
const SEp *p = GET_ACTIVE_EP(pCurrent);
|
||||
|
||||
if (pEp->port == p->port && strncmp(pEp->fqdn, p->fqdn, TSDB_FQDN_LEN) == 0) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// 1. increase the replica does not affect the stream process.
|
||||
// 2. decreasing the replica may affect the stream task execution in the way that there is one or more running stream
|
||||
// tasks on the will be removed replica.
|
||||
// 3. vgroup redistribution is an combination operation of first increase replica and then decrease replica. So we
|
||||
// will handle it as mentioned in 1 & 2 items.
|
||||
static int32_t mndFindChangedNodeInfo(SMnode *pMnode, const SArray *pPrevNodeList, const SArray *pNodeList,
|
||||
SVgroupChangeInfo *pInfo) {
|
||||
int32_t code = 0;
|
||||
int32_t lino = 0;
|
||||
|
||||
if (pInfo == NULL) {
|
||||
return TSDB_CODE_INVALID_PARA;
|
||||
}
|
||||
|
||||
pInfo->pUpdateNodeList = taosArrayInit(4, sizeof(SNodeUpdateInfo)),
|
||||
pInfo->pDBMap = taosHashInit(32, taosGetDefaultHashFunction(TSDB_DATA_TYPE_VARCHAR), true, HASH_NO_LOCK);
|
||||
|
||||
if (pInfo->pUpdateNodeList == NULL || pInfo->pDBMap == NULL) {
|
||||
mndDestroyVgroupChangeInfo(pInfo);
|
||||
TSDB_CHECK_NULL(NULL, code, lino, _err, terrno);
|
||||
}
|
||||
|
||||
int32_t numOfNodes = taosArrayGetSize(pPrevNodeList);
|
||||
for (int32_t i = 0; i < numOfNodes; ++i) {
|
||||
SNodeEntry *pPrevEntry = taosArrayGet(pPrevNodeList, i);
|
||||
if (pPrevEntry == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
int32_t num = taosArrayGetSize(pNodeList);
|
||||
for (int32_t j = 0; j < num; ++j) {
|
||||
SNodeEntry *pCurrent = taosArrayGet(pNodeList, j);
|
||||
if(pCurrent == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (pCurrent->nodeId == pPrevEntry->nodeId) {
|
||||
if (pPrevEntry->stageUpdated || isNodeEpsetChanged(&pPrevEntry->epset, &pCurrent->epset)) {
|
||||
const SEp *pPrevEp = GET_ACTIVE_EP(&pPrevEntry->epset);
|
||||
|
||||
char buf[256] = {0};
|
||||
code = epsetToStr(&pCurrent->epset, buf, tListLen(buf)); // ignore this error
|
||||
if (code) {
|
||||
mError("failed to convert epset string, code:%s", tstrerror(code));
|
||||
TSDB_CHECK_CODE(code, lino, _err);
|
||||
}
|
||||
|
||||
mDebug("nodeId:%d restart/epset changed detected, old:%s:%d -> new:%s, stageUpdate:%d", pCurrent->nodeId,
|
||||
pPrevEp->fqdn, pPrevEp->port, buf, pPrevEntry->stageUpdated);
|
||||
|
||||
SNodeUpdateInfo updateInfo = {.nodeId = pPrevEntry->nodeId};
|
||||
epsetAssign(&updateInfo.prevEp, &pPrevEntry->epset);
|
||||
epsetAssign(&updateInfo.newEp, &pCurrent->epset);
|
||||
|
||||
void* p = taosArrayPush(pInfo->pUpdateNodeList, &updateInfo);
|
||||
TSDB_CHECK_NULL(p, code, lino, _err, terrno);
|
||||
}
|
||||
|
||||
// todo handle the snode info
|
||||
if (pCurrent->nodeId != SNODE_HANDLE) {
|
||||
SVgObj *pVgroup = mndAcquireVgroup(pMnode, pCurrent->nodeId);
|
||||
code = taosHashPut(pInfo->pDBMap, pVgroup->dbName, strlen(pVgroup->dbName), NULL, 0);
|
||||
mndReleaseVgroup(pMnode, pVgroup);
|
||||
TSDB_CHECK_CODE(code, lino, _err);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return code;
|
||||
|
||||
_err:
|
||||
mError("failed to find node change info, code:%s at %s line:%d", tstrerror(code), __func__, lino);
|
||||
mndDestroyVgroupChangeInfo(pInfo);
|
||||
return code;
|
||||
}
|
||||
|
||||
static void mndDestroyVgroupChangeInfo(SVgroupChangeInfo* pInfo) {
|
||||
if (pInfo != NULL) {
|
||||
taosArrayDestroy(pInfo->pUpdateNodeList);
|
||||
taosHashCleanup(pInfo->pDBMap);
|
||||
}
|
||||
}
|
||||
|
||||
static int32_t mndProcessVgroupChange(SMnode *pMnode, SVgroupChangeInfo *pChangeInfo, bool includeAllNodes) {
|
||||
SSdb *pSdb = pMnode->pSdb;
|
||||
SStreamObj *pStream = NULL;
|
||||
|
|
|
@ -21,6 +21,10 @@ typedef struct SKeyInfo {
|
|||
int32_t keyLen;
|
||||
} SKeyInfo;
|
||||
|
||||
static bool identicalName(const char *pDb, const char *pParam, int32_t len) {
|
||||
return (strlen(pDb) == len) && (strncmp(pDb, pParam, len) == 0);
|
||||
}
|
||||
|
||||
int32_t mndStreamRegisterTrans(STrans *pTrans, const char *pTransName, int64_t streamId) {
|
||||
SStreamTransInfo info = {
|
||||
.transId = pTrans->id, .startTime = taosGetTimestampMs(), .name = pTransName, .streamId = streamId};
|
||||
|
@ -117,7 +121,8 @@ int32_t mndStreamTransConflictCheck(SMnode *pMnode, int64_t streamId, const char
|
|||
}
|
||||
|
||||
if (strcmp(tInfo.name, MND_STREAM_CHECKPOINT_NAME) == 0) {
|
||||
if ((strcmp(pTransName, MND_STREAM_DROP_NAME) != 0) && (strcmp(pTransName, MND_STREAM_TASK_RESET_NAME) != 0)) {
|
||||
if ((strcmp(pTransName, MND_STREAM_DROP_NAME) != 0) && (strcmp(pTransName, MND_STREAM_TASK_RESET_NAME) != 0) &&
|
||||
(strcmp(pTransName, MND_STREAM_RESTART_NAME) != 0)) {
|
||||
mWarn("conflict with other transId:%d streamUid:0x%" PRIx64 ", trans:%s", tInfo.transId, tInfo.streamId,
|
||||
tInfo.name);
|
||||
return TSDB_CODE_MND_TRANS_CONFLICT;
|
||||
|
@ -126,7 +131,8 @@ int32_t mndStreamTransConflictCheck(SMnode *pMnode, int64_t streamId, const char
|
|||
}
|
||||
} else if ((strcmp(tInfo.name, MND_STREAM_CREATE_NAME) == 0) || (strcmp(tInfo.name, MND_STREAM_DROP_NAME) == 0) ||
|
||||
(strcmp(tInfo.name, MND_STREAM_TASK_RESET_NAME) == 0) ||
|
||||
strcmp(tInfo.name, MND_STREAM_TASK_UPDATE_NAME) == 0) {
|
||||
(strcmp(tInfo.name, MND_STREAM_TASK_UPDATE_NAME) == 0) ||
|
||||
strcmp(tInfo.name, MND_STREAM_RESTART_NAME) == 0) {
|
||||
mWarn("conflict with other transId:%d streamUid:0x%" PRIx64 ", trans:%s", tInfo.transId, tInfo.streamId,
|
||||
tInfo.name);
|
||||
return TSDB_CODE_MND_TRANS_CONFLICT;
|
||||
|
@ -282,10 +288,6 @@ int32_t setTransAction(STrans *pTrans, void *pCont, int32_t contLen, int32_t msg
|
|||
return mndTransAppendRedoAction(pTrans, &action);
|
||||
}
|
||||
|
||||
static bool identicalName(const char *pDb, const char *pParam, int32_t len) {
|
||||
return (strlen(pDb) == len) && (strncmp(pDb, pParam, len) == 0);
|
||||
}
|
||||
|
||||
int32_t doKillCheckpointTrans(SMnode *pMnode, const char *pDBName, size_t len) {
|
||||
void *pIter = NULL;
|
||||
|
||||
|
|
|
@ -0,0 +1,669 @@
|
|||
/*
|
||||
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
|
||||
*
|
||||
* This program is free software: you can use, redistribute, and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3
|
||||
* or later ("AGPL"), as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "mndDb.h"
|
||||
#include "mndStb.h"
|
||||
#include "mndStream.h"
|
||||
#include "mndTrans.h"
|
||||
#include "mndVgroup.h"
|
||||
#include "taoserror.h"
|
||||
#include "tmisce.h"
|
||||
|
||||
static int32_t doSetPauseAction(SMnode *pMnode, STrans *pTrans, SStreamTask *pTask) {
|
||||
SVPauseStreamTaskReq *pReq = taosMemoryCalloc(1, sizeof(SVPauseStreamTaskReq));
|
||||
if (pReq == NULL) {
|
||||
mError("failed to malloc in pause stream, size:%" PRIzu ", code:%s", sizeof(SVPauseStreamTaskReq),
|
||||
tstrerror(TSDB_CODE_OUT_OF_MEMORY));
|
||||
// terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
pReq->head.vgId = htonl(pTask->info.nodeId);
|
||||
pReq->taskId = pTask->id.taskId;
|
||||
pReq->streamId = pTask->id.streamId;
|
||||
|
||||
SEpSet epset = {0};
|
||||
bool hasEpset = false;
|
||||
int32_t code = extractNodeEpset(pMnode, &epset, &hasEpset, pTask->id.taskId, pTask->info.nodeId);
|
||||
if (code != TSDB_CODE_SUCCESS || !hasEpset) {
|
||||
terrno = code;
|
||||
taosMemoryFree(pReq);
|
||||
return code;
|
||||
}
|
||||
|
||||
char buf[256] = {0};
|
||||
code = epsetToStr(&epset, buf, tListLen(buf));
|
||||
if (code != 0) { // print error and continue
|
||||
mError("failed to convert epset to str, code:%s", tstrerror(code));
|
||||
}
|
||||
|
||||
mDebug("pause stream task in node:%d, epset:%s", pTask->info.nodeId, buf);
|
||||
code = setTransAction(pTrans, pReq, sizeof(SVPauseStreamTaskReq), TDMT_STREAM_TASK_PAUSE, &epset, 0, TSDB_CODE_VND_INVALID_VGROUP_ID);
|
||||
if (code != 0) {
|
||||
taosMemoryFree(pReq);
|
||||
return code;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int32_t doSetDropAction(SMnode *pMnode, STrans *pTrans, SStreamTask *pTask) {
|
||||
SVDropStreamTaskReq *pReq = taosMemoryCalloc(1, sizeof(SVDropStreamTaskReq));
|
||||
if (pReq == NULL) {
|
||||
// terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
pReq->head.vgId = htonl(pTask->info.nodeId);
|
||||
pReq->taskId = pTask->id.taskId;
|
||||
pReq->streamId = pTask->id.streamId;
|
||||
|
||||
SEpSet epset = {0};
|
||||
bool hasEpset = false;
|
||||
int32_t code = extractNodeEpset(pMnode, &epset, &hasEpset, pTask->id.taskId, pTask->info.nodeId);
|
||||
if (code != TSDB_CODE_SUCCESS || !hasEpset) { // no valid epset, return directly without redoAction
|
||||
return code;
|
||||
}
|
||||
|
||||
// The epset of nodeId of this task may have been expired now, let's use the newest epset from mnode.
|
||||
code = setTransAction(pTrans, pReq, sizeof(SVDropStreamTaskReq), TDMT_STREAM_TASK_DROP, &epset, 0, TSDB_CODE_VND_INVALID_VGROUP_ID);
|
||||
if (code != 0) {
|
||||
taosMemoryFree(pReq);
|
||||
return code;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int32_t doSetResumeAction(STrans *pTrans, SMnode *pMnode, SStreamTask *pTask, int8_t igUntreated) {
|
||||
terrno = 0;
|
||||
|
||||
SVResumeStreamTaskReq *pReq = taosMemoryCalloc(1, sizeof(SVResumeStreamTaskReq));
|
||||
if (pReq == NULL) {
|
||||
mError("failed to malloc in resume stream, size:%" PRIzu ", code:%s", sizeof(SVResumeStreamTaskReq),
|
||||
tstrerror(TSDB_CODE_OUT_OF_MEMORY));
|
||||
// terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
pReq->head.vgId = htonl(pTask->info.nodeId);
|
||||
pReq->taskId = pTask->id.taskId;
|
||||
pReq->streamId = pTask->id.streamId;
|
||||
pReq->igUntreated = igUntreated;
|
||||
|
||||
SEpSet epset = {0};
|
||||
bool hasEpset = false;
|
||||
int32_t code = extractNodeEpset(pMnode, &epset, &hasEpset, pTask->id.taskId, pTask->info.nodeId);
|
||||
if (code != TSDB_CODE_SUCCESS || (!hasEpset)) {
|
||||
terrno = code;
|
||||
taosMemoryFree(pReq);
|
||||
return terrno;
|
||||
}
|
||||
|
||||
code = setTransAction(pTrans, pReq, sizeof(SVResumeStreamTaskReq), TDMT_STREAM_TASK_RESUME, &epset, 0, TSDB_CODE_VND_INVALID_VGROUP_ID);
|
||||
if (code != 0) {
|
||||
taosMemoryFree(pReq);
|
||||
return terrno;
|
||||
}
|
||||
|
||||
mDebug("set the resume action for trans:%d", pTrans->id);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int32_t doSetDropActionFromId(SMnode *pMnode, STrans *pTrans, SOrphanTask* pTask) {
|
||||
SVDropStreamTaskReq *pReq = taosMemoryCalloc(1, sizeof(SVDropStreamTaskReq));
|
||||
if (pReq == NULL) {
|
||||
// terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
pReq->head.vgId = htonl(pTask->nodeId);
|
||||
pReq->taskId = pTask->taskId;
|
||||
pReq->streamId = pTask->streamId;
|
||||
|
||||
SEpSet epset = {0};
|
||||
bool hasEpset = false;
|
||||
int32_t code = extractNodeEpset(pMnode, &epset, &hasEpset, pTask->taskId, pTask->nodeId);
|
||||
if (code != TSDB_CODE_SUCCESS || (!hasEpset)) { // no valid epset, return directly without redoAction
|
||||
taosMemoryFree(pReq);
|
||||
return code;
|
||||
}
|
||||
|
||||
// The epset of nodeId of this task may have been expired now, let's use the newest epset from mnode.
|
||||
code = setTransAction(pTrans, pReq, sizeof(SVDropStreamTaskReq), TDMT_STREAM_TASK_DROP, &epset, 0, TSDB_CODE_VND_INVALID_VGROUP_ID);
|
||||
if (code != 0) {
|
||||
taosMemoryFree(pReq);
|
||||
return code;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void initNodeUpdateMsg(SStreamTaskNodeUpdateMsg *pMsg, const SVgroupChangeInfo *pInfo, SStreamTaskId *pId,
|
||||
int32_t transId) {
|
||||
int32_t code = 0;
|
||||
|
||||
pMsg->streamId = pId->streamId;
|
||||
pMsg->taskId = pId->taskId;
|
||||
pMsg->transId = transId;
|
||||
pMsg->pNodeList = taosArrayInit(taosArrayGetSize(pInfo->pUpdateNodeList), sizeof(SNodeUpdateInfo));
|
||||
if (pMsg->pNodeList == NULL) {
|
||||
mError("failed to prepare node list, code:%s", tstrerror(terrno));
|
||||
code = terrno;
|
||||
}
|
||||
|
||||
if (code == 0) {
|
||||
void *p = taosArrayAddAll(pMsg->pNodeList, pInfo->pUpdateNodeList);
|
||||
if (p == NULL) {
|
||||
mError("failed to add update node list into nodeList");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int32_t doBuildStreamTaskUpdateMsg(void **pBuf, int32_t *pLen, SVgroupChangeInfo *pInfo, int32_t nodeId,
|
||||
SStreamTaskId *pId, int32_t transId) {
|
||||
SStreamTaskNodeUpdateMsg req = {0};
|
||||
initNodeUpdateMsg(&req, pInfo, pId, transId);
|
||||
|
||||
int32_t code = 0;
|
||||
int32_t blen;
|
||||
|
||||
tEncodeSize(tEncodeStreamTaskUpdateMsg, &req, blen, code);
|
||||
if (code < 0) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
taosArrayDestroy(req.pNodeList);
|
||||
return terrno;
|
||||
}
|
||||
|
||||
int32_t tlen = sizeof(SMsgHead) + blen;
|
||||
|
||||
void *buf = taosMemoryMalloc(tlen);
|
||||
if (buf == NULL) {
|
||||
taosArrayDestroy(req.pNodeList);
|
||||
return terrno;
|
||||
}
|
||||
|
||||
void *abuf = POINTER_SHIFT(buf, sizeof(SMsgHead));
|
||||
SEncoder encoder;
|
||||
tEncoderInit(&encoder, abuf, tlen);
|
||||
code = tEncodeStreamTaskUpdateMsg(&encoder, &req);
|
||||
if (code == -1) {
|
||||
tEncoderClear(&encoder);
|
||||
taosMemoryFree(buf);
|
||||
taosArrayDestroy(req.pNodeList);
|
||||
return code;
|
||||
}
|
||||
|
||||
SMsgHead *pMsgHead = (SMsgHead *)buf;
|
||||
pMsgHead->contLen = htonl(tlen);
|
||||
pMsgHead->vgId = htonl(nodeId);
|
||||
|
||||
tEncoderClear(&encoder);
|
||||
|
||||
*pBuf = buf;
|
||||
*pLen = tlen;
|
||||
|
||||
taosArrayDestroy(req.pNodeList);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
static int32_t doSetUpdateTaskAction(SMnode *pMnode, STrans *pTrans, SStreamTask *pTask, SVgroupChangeInfo *pInfo) {
|
||||
void *pBuf = NULL;
|
||||
int32_t len = 0;
|
||||
SEpSet epset = {0};
|
||||
bool hasEpset = false;
|
||||
|
||||
bool unusedRet = streamTaskUpdateEpsetInfo(pTask, pInfo->pUpdateNodeList);
|
||||
int32_t code = doBuildStreamTaskUpdateMsg(&pBuf, &len, pInfo, pTask->info.nodeId, &pTask->id, pTrans->id);
|
||||
if (code) {
|
||||
mError("failed to build stream task epset update msg, code:%s", tstrerror(code));
|
||||
return code;
|
||||
}
|
||||
|
||||
code = extractNodeEpset(pMnode, &epset, &hasEpset, pTask->id.taskId, pTask->info.nodeId);
|
||||
if (code != TSDB_CODE_SUCCESS || !hasEpset) {
|
||||
mError("failed to extract epset during create update epset, code:%s", tstrerror(code));
|
||||
return code;
|
||||
}
|
||||
|
||||
code = setTransAction(pTrans, pBuf, len, TDMT_VND_STREAM_TASK_UPDATE, &epset, 0, TSDB_CODE_VND_INVALID_VGROUP_ID);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
mError("failed to create update task epset trans, code:%s", tstrerror(code));
|
||||
taosMemoryFree(pBuf);
|
||||
}
|
||||
|
||||
return code;
|
||||
}
|
||||
|
||||
static int32_t doSetUpdateChkptAction(SMnode *pMnode, STrans *pTrans, SStreamTask *pTask) {
|
||||
SVUpdateCheckpointInfoReq *pReq = taosMemoryCalloc(1, sizeof(SVUpdateCheckpointInfoReq));
|
||||
if (pReq == NULL) {
|
||||
mError("failed to malloc in reset stream, size:%" PRIzu ", code:%s", sizeof(SVUpdateCheckpointInfoReq),
|
||||
tstrerror(terrno));
|
||||
return terrno;
|
||||
}
|
||||
|
||||
pReq->head.vgId = htonl(pTask->info.nodeId);
|
||||
pReq->taskId = pTask->id.taskId;
|
||||
pReq->streamId = pTask->id.streamId;
|
||||
|
||||
SChkptReportInfo *pStreamItem = (SChkptReportInfo*)taosHashGet(execInfo.pChkptStreams, &pTask->id.streamId, sizeof(pTask->id.streamId));
|
||||
if (pStreamItem == NULL) {
|
||||
return TSDB_CODE_INVALID_PARA;
|
||||
}
|
||||
|
||||
int32_t size = taosArrayGetSize(pStreamItem->pTaskList);
|
||||
for(int32_t i = 0; i < size; ++i) {
|
||||
STaskChkptInfo* pInfo = taosArrayGet(pStreamItem->pTaskList, i);
|
||||
if (pInfo == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (pInfo->taskId == pTask->id.taskId) {
|
||||
pReq->checkpointId = pInfo->checkpointId;
|
||||
pReq->checkpointVer = pInfo->version;
|
||||
pReq->checkpointTs = pInfo->ts;
|
||||
pReq->dropRelHTask = pInfo->dropHTask;
|
||||
pReq->transId = pInfo->transId;
|
||||
pReq->hStreamId = pTask->hTaskInfo.id.streamId;
|
||||
pReq->hTaskId = pTask->hTaskInfo.id.taskId;
|
||||
}
|
||||
}
|
||||
|
||||
SEpSet epset = {0};
|
||||
bool hasEpset = false;
|
||||
int32_t code = extractNodeEpset(pMnode, &epset, &hasEpset, pTask->id.taskId, pTask->info.nodeId);
|
||||
if (code != TSDB_CODE_SUCCESS || !hasEpset) {
|
||||
taosMemoryFree(pReq);
|
||||
return code;
|
||||
}
|
||||
|
||||
code = setTransAction(pTrans, pReq, sizeof(SVUpdateCheckpointInfoReq), TDMT_STREAM_TASK_UPDATE_CHKPT, &epset, 0, TSDB_CODE_VND_INVALID_VGROUP_ID);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
taosMemoryFree(pReq);
|
||||
}
|
||||
|
||||
return code;
|
||||
}
|
||||
|
||||
static int32_t doSetResetAction(SMnode *pMnode, STrans *pTrans, SStreamTask *pTask) {
|
||||
SVResetStreamTaskReq *pReq = taosMemoryCalloc(1, sizeof(SVResetStreamTaskReq));
|
||||
if (pReq == NULL) {
|
||||
mError("failed to malloc in reset stream, size:%" PRIzu ", code:%s", sizeof(SVResetStreamTaskReq),
|
||||
tstrerror(terrno));
|
||||
return terrno;
|
||||
}
|
||||
|
||||
pReq->head.vgId = htonl(pTask->info.nodeId);
|
||||
pReq->taskId = pTask->id.taskId;
|
||||
pReq->streamId = pTask->id.streamId;
|
||||
|
||||
SEpSet epset = {0};
|
||||
bool hasEpset = false;
|
||||
int32_t code = extractNodeEpset(pMnode, &epset, &hasEpset, pTask->id.taskId, pTask->info.nodeId);
|
||||
if (code != TSDB_CODE_SUCCESS || !hasEpset) {
|
||||
taosMemoryFree(pReq);
|
||||
return code;
|
||||
}
|
||||
|
||||
code = setTransAction(pTrans, pReq, sizeof(SVResetStreamTaskReq), TDMT_VND_STREAM_TASK_RESET, &epset, 0, TSDB_CODE_VND_INVALID_VGROUP_ID);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
taosMemoryFree(pReq);
|
||||
}
|
||||
|
||||
return code;
|
||||
}
|
||||
|
||||
static int32_t mndBuildStreamCheckpointSourceReq(void **pBuf, int32_t *pLen, int32_t nodeId, int64_t checkpointId,
|
||||
int64_t streamId, int32_t taskId, int32_t transId, int8_t mndTrigger) {
|
||||
SStreamCheckpointSourceReq req = {0};
|
||||
req.checkpointId = checkpointId;
|
||||
req.nodeId = nodeId;
|
||||
req.expireTime = -1;
|
||||
req.streamId = streamId; // pTask->id.streamId;
|
||||
req.taskId = taskId; // pTask->id.taskId;
|
||||
req.transId = transId;
|
||||
req.mndTrigger = mndTrigger;
|
||||
|
||||
int32_t code;
|
||||
int32_t blen;
|
||||
|
||||
tEncodeSize(tEncodeStreamCheckpointSourceReq, &req, blen, code);
|
||||
if (code < 0) {
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
}
|
||||
|
||||
int32_t tlen = sizeof(SMsgHead) + blen;
|
||||
|
||||
void *buf = taosMemoryMalloc(tlen);
|
||||
if (buf == NULL) {
|
||||
return terrno;
|
||||
}
|
||||
|
||||
void *abuf = POINTER_SHIFT(buf, sizeof(SMsgHead));
|
||||
SEncoder encoder;
|
||||
tEncoderInit(&encoder, abuf, tlen);
|
||||
int32_t pos = tEncodeStreamCheckpointSourceReq(&encoder, &req);
|
||||
if (pos == -1) {
|
||||
tEncoderClear(&encoder);
|
||||
return TSDB_CODE_INVALID_MSG;
|
||||
}
|
||||
|
||||
SMsgHead *pMsgHead = (SMsgHead *)buf;
|
||||
pMsgHead->contLen = htonl(tlen);
|
||||
pMsgHead->vgId = htonl(nodeId);
|
||||
|
||||
tEncoderClear(&encoder);
|
||||
|
||||
*pBuf = buf;
|
||||
*pLen = tlen;
|
||||
|
||||
return 0;
|
||||
}
|
||||
int32_t mndStreamSetPauseAction(SMnode *pMnode, STrans *pTrans, SStreamObj *pStream) {
|
||||
SStreamTaskIter *pIter = NULL;
|
||||
|
||||
int32_t code = createStreamTaskIter(pStream, &pIter);
|
||||
if (code) {
|
||||
mError("failed to create stream task iter:%s", pStream->name);
|
||||
return code;
|
||||
}
|
||||
|
||||
while (streamTaskIterNextTask(pIter)) {
|
||||
SStreamTask *pTask = NULL;
|
||||
code = streamTaskIterGetCurrent(pIter, &pTask);
|
||||
if (code) {
|
||||
destroyStreamTaskIter(pIter);
|
||||
return code;
|
||||
}
|
||||
|
||||
code = doSetPauseAction(pMnode, pTrans, pTask);
|
||||
if (code) {
|
||||
destroyStreamTaskIter(pIter);
|
||||
return code;
|
||||
}
|
||||
|
||||
if (atomic_load_8(&pTask->status.taskStatus) != TASK_STATUS__PAUSE) {
|
||||
atomic_store_8(&pTask->status.statusBackup, pTask->status.taskStatus);
|
||||
atomic_store_8(&pTask->status.taskStatus, TASK_STATUS__PAUSE);
|
||||
}
|
||||
}
|
||||
|
||||
destroyStreamTaskIter(pIter);
|
||||
return code;
|
||||
}
|
||||
|
||||
int32_t mndStreamSetDropAction(SMnode *pMnode, STrans *pTrans, SStreamObj *pStream) {
|
||||
SStreamTaskIter *pIter = NULL;
|
||||
|
||||
int32_t code = createStreamTaskIter(pStream, &pIter);
|
||||
if (code) {
|
||||
mError("failed to create stream task iter:%s", pStream->name);
|
||||
return code;
|
||||
}
|
||||
|
||||
while(streamTaskIterNextTask(pIter)) {
|
||||
SStreamTask *pTask = NULL;
|
||||
code = streamTaskIterGetCurrent(pIter, &pTask);
|
||||
if (code) {
|
||||
destroyStreamTaskIter(pIter);
|
||||
return code;
|
||||
}
|
||||
|
||||
code = doSetDropAction(pMnode, pTrans, pTask);
|
||||
if (code) {
|
||||
destroyStreamTaskIter(pIter);
|
||||
return code;
|
||||
}
|
||||
}
|
||||
destroyStreamTaskIter(pIter);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t mndStreamSetResumeAction(STrans *pTrans, SMnode *pMnode, SStreamObj *pStream, int8_t igUntreated) {
|
||||
SStreamTaskIter *pIter = NULL;
|
||||
int32_t code = createStreamTaskIter(pStream, &pIter);
|
||||
if (code) {
|
||||
mError("failed to create stream task iter:%s", pStream->name);
|
||||
return code;
|
||||
}
|
||||
|
||||
while (streamTaskIterNextTask(pIter)) {
|
||||
SStreamTask *pTask = NULL;
|
||||
code = streamTaskIterGetCurrent(pIter, &pTask);
|
||||
if (code || pTask == NULL) {
|
||||
destroyStreamTaskIter(pIter);
|
||||
return code;
|
||||
}
|
||||
|
||||
code = doSetResumeAction(pTrans, pMnode, pTask, igUntreated);
|
||||
if (code) {
|
||||
destroyStreamTaskIter(pIter);
|
||||
return code;
|
||||
}
|
||||
|
||||
if (atomic_load_8(&pTask->status.taskStatus) == TASK_STATUS__PAUSE) {
|
||||
atomic_store_8(&pTask->status.taskStatus, pTask->status.statusBackup);
|
||||
}
|
||||
}
|
||||
destroyStreamTaskIter(pIter);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// build trans to update the epset
|
||||
int32_t mndStreamSetUpdateEpsetAction(SMnode *pMnode, SStreamObj *pStream, SVgroupChangeInfo *pInfo, STrans *pTrans) {
|
||||
mDebug("stream:0x%" PRIx64 " set tasks epset update action", pStream->uid);
|
||||
SStreamTaskIter *pIter = NULL;
|
||||
|
||||
taosWLockLatch(&pStream->lock);
|
||||
int32_t code = createStreamTaskIter(pStream, &pIter);
|
||||
if (code) {
|
||||
taosWUnLockLatch(&pStream->lock);
|
||||
mError("failed to create stream task iter:%s", pStream->name);
|
||||
return code;
|
||||
}
|
||||
|
||||
while (streamTaskIterNextTask(pIter)) {
|
||||
SStreamTask *pTask = NULL;
|
||||
code = streamTaskIterGetCurrent(pIter, &pTask);
|
||||
if (code) {
|
||||
destroyStreamTaskIter(pIter);
|
||||
taosWUnLockLatch(&pStream->lock);
|
||||
return code;
|
||||
}
|
||||
|
||||
code = doSetUpdateTaskAction(pMnode, pTrans, pTask, pInfo);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
destroyStreamTaskIter(pIter);
|
||||
taosWUnLockLatch(&pStream->lock);
|
||||
return code;
|
||||
}
|
||||
}
|
||||
|
||||
destroyStreamTaskIter(pIter);
|
||||
taosWUnLockLatch(&pStream->lock);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t mndStreamSetUpdateChkptAction(SMnode *pMnode, STrans *pTrans, SStreamObj *pStream) {
|
||||
SStreamTaskIter *pIter = NULL;
|
||||
|
||||
taosWLockLatch(&pStream->lock);
|
||||
int32_t code = createStreamTaskIter(pStream, &pIter);
|
||||
if (code) {
|
||||
taosWUnLockLatch(&pStream->lock);
|
||||
mError("failed to create stream task iter:%s", pStream->name);
|
||||
return code;
|
||||
}
|
||||
|
||||
while (streamTaskIterNextTask(pIter)) {
|
||||
SStreamTask *pTask = NULL;
|
||||
code = streamTaskIterGetCurrent(pIter, &pTask);
|
||||
if (code) {
|
||||
destroyStreamTaskIter(pIter);
|
||||
taosWUnLockLatch(&pStream->lock);
|
||||
return code;
|
||||
}
|
||||
|
||||
code = doSetUpdateChkptAction(pMnode, pTrans, pTask);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
destroyStreamTaskIter(pIter);
|
||||
taosWUnLockLatch(&pStream->lock);
|
||||
return code;
|
||||
}
|
||||
}
|
||||
|
||||
destroyStreamTaskIter(pIter);
|
||||
taosWUnLockLatch(&pStream->lock);
|
||||
return code;
|
||||
}
|
||||
|
||||
int32_t mndStreamSetDropActionFromList(SMnode *pMnode, STrans *pTrans, SArray* pList) {
|
||||
for(int32_t i = 0; i < taosArrayGetSize(pList); ++i) {
|
||||
SOrphanTask* pTask = taosArrayGet(pList, i);
|
||||
if (pTask == NULL) {
|
||||
return terrno;
|
||||
}
|
||||
|
||||
int32_t code = doSetDropActionFromId(pMnode, pTrans, pTask);
|
||||
if (code != 0) {
|
||||
return code;
|
||||
} else {
|
||||
mDebug("add drop task:0x%x action to drop orphan task", pTask->taskId);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t mndStreamSetResetTaskAction(SMnode *pMnode, STrans *pTrans, SStreamObj *pStream) {
|
||||
SStreamTaskIter *pIter = NULL;
|
||||
|
||||
taosWLockLatch(&pStream->lock);
|
||||
int32_t code = createStreamTaskIter(pStream, &pIter);
|
||||
if (code) {
|
||||
taosWUnLockLatch(&pStream->lock);
|
||||
mError("failed to create stream task iter:%s", pStream->name);
|
||||
return code;
|
||||
}
|
||||
|
||||
while (streamTaskIterNextTask(pIter)) {
|
||||
SStreamTask *pTask = NULL;
|
||||
code = streamTaskIterGetCurrent(pIter, &pTask);
|
||||
if (code) {
|
||||
destroyStreamTaskIter(pIter);
|
||||
taosWUnLockLatch(&pStream->lock);
|
||||
return code;
|
||||
}
|
||||
|
||||
code = doSetResetAction(pMnode, pTrans, pTask);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
destroyStreamTaskIter(pIter);
|
||||
taosWUnLockLatch(&pStream->lock);
|
||||
return code;
|
||||
}
|
||||
}
|
||||
|
||||
destroyStreamTaskIter(pIter);
|
||||
taosWUnLockLatch(&pStream->lock);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t mndStreamSetChkptIdAction(SMnode *pMnode, STrans *pTrans, SStreamTask* pTask, int64_t checkpointId, int64_t ts) {
|
||||
SRestoreCheckpointInfo req = {
|
||||
.taskId = pTask->id.taskId,
|
||||
.streamId = pTask->id.streamId,
|
||||
.checkpointId = checkpointId,
|
||||
.startTs = ts,
|
||||
.nodeId = pTask->info.nodeId,
|
||||
.transId = pTrans->id,
|
||||
};
|
||||
|
||||
int32_t code = 0;
|
||||
int32_t blen;
|
||||
tEncodeSize(tEncodeRestoreCheckpointInfo, &req, blen, code);
|
||||
if (code < 0) {
|
||||
return terrno;
|
||||
}
|
||||
|
||||
int32_t tlen = sizeof(SMsgHead) + blen;
|
||||
|
||||
void *pBuf = taosMemoryMalloc(tlen);
|
||||
if (pBuf == NULL) {
|
||||
return terrno;
|
||||
}
|
||||
|
||||
void *abuf = POINTER_SHIFT(pBuf, sizeof(SMsgHead));
|
||||
SEncoder encoder;
|
||||
tEncoderInit(&encoder, abuf, tlen);
|
||||
code = tEncodeRestoreCheckpointInfo(&encoder, &req);
|
||||
tEncoderClear(&encoder);
|
||||
if (code == -1) {
|
||||
taosMemoryFree(pBuf);
|
||||
return code;
|
||||
}
|
||||
|
||||
SMsgHead *pMsgHead = (SMsgHead *)pBuf;
|
||||
pMsgHead->contLen = htonl(tlen);
|
||||
pMsgHead->vgId = htonl(pTask->info.nodeId);
|
||||
|
||||
SEpSet epset = {0};
|
||||
bool hasEpset = false;
|
||||
code = extractNodeEpset(pMnode, &epset, &hasEpset, pTask->id.taskId, pTask->info.nodeId);
|
||||
if (code != TSDB_CODE_SUCCESS || !hasEpset) {
|
||||
taosMemoryFree(pBuf);
|
||||
return code;
|
||||
}
|
||||
|
||||
code = setTransAction(pTrans, pBuf, tlen, TDMT_STREAM_CONSEN_CHKPT, &epset, 0, TSDB_CODE_VND_INVALID_VGROUP_ID);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
taosMemoryFree(pBuf);
|
||||
}
|
||||
|
||||
return code;
|
||||
}
|
||||
|
||||
|
||||
int32_t mndStreamSetCheckpointAction(SMnode *pMnode, STrans *pTrans, SStreamTask *pTask, int64_t checkpointId,
|
||||
int8_t mndTrigger) {
|
||||
void *buf;
|
||||
int32_t tlen;
|
||||
int32_t code = 0;
|
||||
SEpSet epset = {0};
|
||||
bool hasEpset = false;
|
||||
|
||||
if ((code = mndBuildStreamCheckpointSourceReq(&buf, &tlen, pTask->info.nodeId, checkpointId, pTask->id.streamId,
|
||||
pTask->id.taskId, pTrans->id, mndTrigger)) < 0) {
|
||||
taosMemoryFree(buf);
|
||||
return code;
|
||||
}
|
||||
|
||||
code = extractNodeEpset(pMnode, &epset, &hasEpset, pTask->id.taskId, pTask->info.nodeId);
|
||||
if (code != TSDB_CODE_SUCCESS || !hasEpset) {
|
||||
taosMemoryFree(buf);
|
||||
return code;
|
||||
}
|
||||
|
||||
code = setTransAction(pTrans, buf, tlen, TDMT_VND_STREAM_CHECK_POINT_SOURCE, &epset, TSDB_CODE_SYN_PROPOSE_NOT_READY,
|
||||
TSDB_CODE_VND_INVALID_VGROUP_ID);
|
||||
if (code != 0) {
|
||||
taosMemoryFree(buf);
|
||||
}
|
||||
|
||||
return code;
|
||||
}
|
||||
|
||||
int32_t mndStreamSetRestartAction(SMnode* pMnode, STrans *pTrans, SStreamObj* pStream) {
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -304,41 +304,6 @@ int32_t extractNodeEpset(SMnode *pMnode, SEpSet *pEpSet, bool *hasEpset, int32_t
|
|||
}
|
||||
}
|
||||
|
||||
static int32_t doSetResumeAction(STrans *pTrans, SMnode *pMnode, SStreamTask *pTask, int8_t igUntreated) {
|
||||
terrno = 0;
|
||||
|
||||
SVResumeStreamTaskReq *pReq = taosMemoryCalloc(1, sizeof(SVResumeStreamTaskReq));
|
||||
if (pReq == NULL) {
|
||||
mError("failed to malloc in resume stream, size:%" PRIzu ", code:%s", sizeof(SVResumeStreamTaskReq),
|
||||
tstrerror(TSDB_CODE_OUT_OF_MEMORY));
|
||||
// terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
pReq->head.vgId = htonl(pTask->info.nodeId);
|
||||
pReq->taskId = pTask->id.taskId;
|
||||
pReq->streamId = pTask->id.streamId;
|
||||
pReq->igUntreated = igUntreated;
|
||||
|
||||
SEpSet epset = {0};
|
||||
bool hasEpset = false;
|
||||
int32_t code = extractNodeEpset(pMnode, &epset, &hasEpset, pTask->id.taskId, pTask->info.nodeId);
|
||||
if (code != TSDB_CODE_SUCCESS || (!hasEpset)) {
|
||||
terrno = code;
|
||||
taosMemoryFree(pReq);
|
||||
return terrno;
|
||||
}
|
||||
|
||||
code = setTransAction(pTrans, pReq, sizeof(SVResumeStreamTaskReq), TDMT_STREAM_TASK_RESUME, &epset, 0, TSDB_CODE_VND_INVALID_VGROUP_ID);
|
||||
if (code != 0) {
|
||||
taosMemoryFree(pReq);
|
||||
return terrno;
|
||||
}
|
||||
|
||||
mDebug("set the resume action for trans:%d", pTrans->id);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t mndGetStreamTask(STaskId *pId, SStreamObj *pStream, SStreamTask **pTask) {
|
||||
*pTask = NULL;
|
||||
|
||||
|
@ -377,396 +342,29 @@ int32_t mndGetNumOfStreamTasks(const SStreamObj *pStream) {
|
|||
return num;
|
||||
}
|
||||
|
||||
int32_t mndStreamSetResumeAction(STrans *pTrans, SMnode *pMnode, SStreamObj *pStream, int8_t igUntreated) {
|
||||
SStreamTaskIter *pIter = NULL;
|
||||
int32_t code = createStreamTaskIter(pStream, &pIter);
|
||||
if (code) {
|
||||
mError("failed to create stream task iter:%s", pStream->name);
|
||||
return code;
|
||||
int32_t mndGetNumOfStreams(SMnode *pMnode, char *dbName, int32_t *pNumOfStreams) {
|
||||
SSdb *pSdb = pMnode->pSdb;
|
||||
SDbObj *pDb = mndAcquireDb(pMnode, dbName);
|
||||
if (pDb == NULL) {
|
||||
TAOS_RETURN(TSDB_CODE_MND_DB_NOT_SELECTED);
|
||||
}
|
||||
|
||||
while (streamTaskIterNextTask(pIter)) {
|
||||
SStreamTask *pTask = NULL;
|
||||
code = streamTaskIterGetCurrent(pIter, &pTask);
|
||||
if (code || pTask == NULL) {
|
||||
destroyStreamTaskIter(pIter);
|
||||
return code;
|
||||
int32_t numOfStreams = 0;
|
||||
void *pIter = NULL;
|
||||
while (1) {
|
||||
SStreamObj *pStream = NULL;
|
||||
pIter = sdbFetch(pSdb, SDB_STREAM, pIter, (void **)&pStream);
|
||||
if (pIter == NULL) break;
|
||||
|
||||
if (pStream->sourceDbUid == pDb->uid) {
|
||||
numOfStreams++;
|
||||
}
|
||||
|
||||
code = doSetResumeAction(pTrans, pMnode, pTask, igUntreated);
|
||||
if (code) {
|
||||
destroyStreamTaskIter(pIter);
|
||||
return code;
|
||||
sdbRelease(pSdb, pStream);
|
||||
}
|
||||
|
||||
if (atomic_load_8(&pTask->status.taskStatus) == TASK_STATUS__PAUSE) {
|
||||
atomic_store_8(&pTask->status.taskStatus, pTask->status.statusBackup);
|
||||
}
|
||||
}
|
||||
destroyStreamTaskIter(pIter);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int32_t doSetPauseAction(SMnode *pMnode, STrans *pTrans, SStreamTask *pTask) {
|
||||
SVPauseStreamTaskReq *pReq = taosMemoryCalloc(1, sizeof(SVPauseStreamTaskReq));
|
||||
if (pReq == NULL) {
|
||||
mError("failed to malloc in pause stream, size:%" PRIzu ", code:%s", sizeof(SVPauseStreamTaskReq),
|
||||
tstrerror(TSDB_CODE_OUT_OF_MEMORY));
|
||||
// terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
pReq->head.vgId = htonl(pTask->info.nodeId);
|
||||
pReq->taskId = pTask->id.taskId;
|
||||
pReq->streamId = pTask->id.streamId;
|
||||
|
||||
SEpSet epset = {0};
|
||||
bool hasEpset = false;
|
||||
int32_t code = extractNodeEpset(pMnode, &epset, &hasEpset, pTask->id.taskId, pTask->info.nodeId);
|
||||
if (code != TSDB_CODE_SUCCESS || !hasEpset) {
|
||||
terrno = code;
|
||||
taosMemoryFree(pReq);
|
||||
return code;
|
||||
}
|
||||
|
||||
char buf[256] = {0};
|
||||
code = epsetToStr(&epset, buf, tListLen(buf));
|
||||
if (code != 0) { // print error and continue
|
||||
mError("failed to convert epset to str, code:%s", tstrerror(code));
|
||||
}
|
||||
|
||||
mDebug("pause stream task in node:%d, epset:%s", pTask->info.nodeId, buf);
|
||||
code = setTransAction(pTrans, pReq, sizeof(SVPauseStreamTaskReq), TDMT_STREAM_TASK_PAUSE, &epset, 0, TSDB_CODE_VND_INVALID_VGROUP_ID);
|
||||
if (code != 0) {
|
||||
taosMemoryFree(pReq);
|
||||
return code;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t mndStreamSetPauseAction(SMnode *pMnode, STrans *pTrans, SStreamObj *pStream) {
|
||||
SStreamTaskIter *pIter = NULL;
|
||||
|
||||
int32_t code = createStreamTaskIter(pStream, &pIter);
|
||||
if (code) {
|
||||
mError("failed to create stream task iter:%s", pStream->name);
|
||||
return code;
|
||||
}
|
||||
|
||||
while (streamTaskIterNextTask(pIter)) {
|
||||
SStreamTask *pTask = NULL;
|
||||
code = streamTaskIterGetCurrent(pIter, &pTask);
|
||||
if (code) {
|
||||
destroyStreamTaskIter(pIter);
|
||||
return code;
|
||||
}
|
||||
|
||||
code = doSetPauseAction(pMnode, pTrans, pTask);
|
||||
if (code) {
|
||||
destroyStreamTaskIter(pIter);
|
||||
return code;
|
||||
}
|
||||
|
||||
if (atomic_load_8(&pTask->status.taskStatus) != TASK_STATUS__PAUSE) {
|
||||
atomic_store_8(&pTask->status.statusBackup, pTask->status.taskStatus);
|
||||
atomic_store_8(&pTask->status.taskStatus, TASK_STATUS__PAUSE);
|
||||
}
|
||||
}
|
||||
|
||||
destroyStreamTaskIter(pIter);
|
||||
return code;
|
||||
}
|
||||
|
||||
static int32_t doSetDropAction(SMnode *pMnode, STrans *pTrans, SStreamTask *pTask) {
|
||||
SVDropStreamTaskReq *pReq = taosMemoryCalloc(1, sizeof(SVDropStreamTaskReq));
|
||||
if (pReq == NULL) {
|
||||
// terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
pReq->head.vgId = htonl(pTask->info.nodeId);
|
||||
pReq->taskId = pTask->id.taskId;
|
||||
pReq->streamId = pTask->id.streamId;
|
||||
|
||||
SEpSet epset = {0};
|
||||
bool hasEpset = false;
|
||||
int32_t code = extractNodeEpset(pMnode, &epset, &hasEpset, pTask->id.taskId, pTask->info.nodeId);
|
||||
if (code != TSDB_CODE_SUCCESS || !hasEpset) { // no valid epset, return directly without redoAction
|
||||
return code;
|
||||
}
|
||||
|
||||
// The epset of nodeId of this task may have been expired now, let's use the newest epset from mnode.
|
||||
code = setTransAction(pTrans, pReq, sizeof(SVDropStreamTaskReq), TDMT_STREAM_TASK_DROP, &epset, 0, TSDB_CODE_VND_INVALID_VGROUP_ID);
|
||||
if (code != 0) {
|
||||
taosMemoryFree(pReq);
|
||||
return code;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t mndStreamSetDropAction(SMnode *pMnode, STrans *pTrans, SStreamObj *pStream) {
|
||||
SStreamTaskIter *pIter = NULL;
|
||||
|
||||
int32_t code = createStreamTaskIter(pStream, &pIter);
|
||||
if (code) {
|
||||
mError("failed to create stream task iter:%s", pStream->name);
|
||||
return code;
|
||||
}
|
||||
|
||||
while(streamTaskIterNextTask(pIter)) {
|
||||
SStreamTask *pTask = NULL;
|
||||
code = streamTaskIterGetCurrent(pIter, &pTask);
|
||||
if (code) {
|
||||
destroyStreamTaskIter(pIter);
|
||||
return code;
|
||||
}
|
||||
|
||||
code = doSetDropAction(pMnode, pTrans, pTask);
|
||||
if (code) {
|
||||
destroyStreamTaskIter(pIter);
|
||||
return code;
|
||||
}
|
||||
}
|
||||
destroyStreamTaskIter(pIter);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int32_t doSetDropActionFromId(SMnode *pMnode, STrans *pTrans, SOrphanTask* pTask) {
|
||||
SVDropStreamTaskReq *pReq = taosMemoryCalloc(1, sizeof(SVDropStreamTaskReq));
|
||||
if (pReq == NULL) {
|
||||
// terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
pReq->head.vgId = htonl(pTask->nodeId);
|
||||
pReq->taskId = pTask->taskId;
|
||||
pReq->streamId = pTask->streamId;
|
||||
|
||||
SEpSet epset = {0};
|
||||
bool hasEpset = false;
|
||||
int32_t code = extractNodeEpset(pMnode, &epset, &hasEpset, pTask->taskId, pTask->nodeId);
|
||||
if (code != TSDB_CODE_SUCCESS || (!hasEpset)) { // no valid epset, return directly without redoAction
|
||||
taosMemoryFree(pReq);
|
||||
return code;
|
||||
}
|
||||
|
||||
// The epset of nodeId of this task may have been expired now, let's use the newest epset from mnode.
|
||||
code = setTransAction(pTrans, pReq, sizeof(SVDropStreamTaskReq), TDMT_STREAM_TASK_DROP, &epset, 0, TSDB_CODE_VND_INVALID_VGROUP_ID);
|
||||
if (code != 0) {
|
||||
taosMemoryFree(pReq);
|
||||
return code;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t mndStreamSetDropActionFromList(SMnode *pMnode, STrans *pTrans, SArray* pList) {
|
||||
for(int32_t i = 0; i < taosArrayGetSize(pList); ++i) {
|
||||
SOrphanTask* pTask = taosArrayGet(pList, i);
|
||||
if (pTask == NULL) {
|
||||
return terrno;
|
||||
}
|
||||
|
||||
int32_t code = doSetDropActionFromId(pMnode, pTrans, pTask);
|
||||
if (code != 0) {
|
||||
return code;
|
||||
} else {
|
||||
mDebug("add drop task:0x%x action to drop orphan task", pTask->taskId);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void initNodeUpdateMsg(SStreamTaskNodeUpdateMsg *pMsg, const SVgroupChangeInfo *pInfo, SStreamTaskId *pId,
|
||||
int32_t transId) {
|
||||
int32_t code = 0;
|
||||
|
||||
pMsg->streamId = pId->streamId;
|
||||
pMsg->taskId = pId->taskId;
|
||||
pMsg->transId = transId;
|
||||
pMsg->pNodeList = taosArrayInit(taosArrayGetSize(pInfo->pUpdateNodeList), sizeof(SNodeUpdateInfo));
|
||||
if (pMsg->pNodeList == NULL) {
|
||||
mError("failed to prepare node list, code:%s", tstrerror(terrno));
|
||||
code = terrno;
|
||||
}
|
||||
|
||||
if (code == 0) {
|
||||
void *p = taosArrayAddAll(pMsg->pNodeList, pInfo->pUpdateNodeList);
|
||||
if (p == NULL) {
|
||||
mError("failed to add update node list into nodeList");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int32_t doBuildStreamTaskUpdateMsg(void **pBuf, int32_t *pLen, SVgroupChangeInfo *pInfo, int32_t nodeId,
|
||||
SStreamTaskId *pId, int32_t transId) {
|
||||
SStreamTaskNodeUpdateMsg req = {0};
|
||||
initNodeUpdateMsg(&req, pInfo, pId, transId);
|
||||
|
||||
int32_t code = 0;
|
||||
int32_t blen;
|
||||
|
||||
tEncodeSize(tEncodeStreamTaskUpdateMsg, &req, blen, code);
|
||||
if (code < 0) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
taosArrayDestroy(req.pNodeList);
|
||||
return terrno;
|
||||
}
|
||||
|
||||
int32_t tlen = sizeof(SMsgHead) + blen;
|
||||
|
||||
void *buf = taosMemoryMalloc(tlen);
|
||||
if (buf == NULL) {
|
||||
taosArrayDestroy(req.pNodeList);
|
||||
return terrno;
|
||||
}
|
||||
|
||||
void *abuf = POINTER_SHIFT(buf, sizeof(SMsgHead));
|
||||
SEncoder encoder;
|
||||
tEncoderInit(&encoder, abuf, tlen);
|
||||
code = tEncodeStreamTaskUpdateMsg(&encoder, &req);
|
||||
if (code == -1) {
|
||||
tEncoderClear(&encoder);
|
||||
taosMemoryFree(buf);
|
||||
taosArrayDestroy(req.pNodeList);
|
||||
return code;
|
||||
}
|
||||
|
||||
SMsgHead *pMsgHead = (SMsgHead *)buf;
|
||||
pMsgHead->contLen = htonl(tlen);
|
||||
pMsgHead->vgId = htonl(nodeId);
|
||||
|
||||
tEncoderClear(&encoder);
|
||||
|
||||
*pBuf = buf;
|
||||
*pLen = tlen;
|
||||
|
||||
taosArrayDestroy(req.pNodeList);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
static int32_t doSetUpdateTaskAction(SMnode *pMnode, STrans *pTrans, SStreamTask *pTask, SVgroupChangeInfo *pInfo) {
|
||||
void *pBuf = NULL;
|
||||
int32_t len = 0;
|
||||
SEpSet epset = {0};
|
||||
bool hasEpset = false;
|
||||
|
||||
bool unusedRet = streamTaskUpdateEpsetInfo(pTask, pInfo->pUpdateNodeList);
|
||||
int32_t code = doBuildStreamTaskUpdateMsg(&pBuf, &len, pInfo, pTask->info.nodeId, &pTask->id, pTrans->id);
|
||||
if (code) {
|
||||
mError("failed to build stream task epset update msg, code:%s", tstrerror(code));
|
||||
return code;
|
||||
}
|
||||
|
||||
code = extractNodeEpset(pMnode, &epset, &hasEpset, pTask->id.taskId, pTask->info.nodeId);
|
||||
if (code != TSDB_CODE_SUCCESS || !hasEpset) {
|
||||
mError("failed to extract epset during create update epset, code:%s", tstrerror(code));
|
||||
return code;
|
||||
}
|
||||
|
||||
code = setTransAction(pTrans, pBuf, len, TDMT_VND_STREAM_TASK_UPDATE, &epset, 0, TSDB_CODE_VND_INVALID_VGROUP_ID);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
mError("failed to create update task epset trans, code:%s", tstrerror(code));
|
||||
taosMemoryFree(pBuf);
|
||||
}
|
||||
|
||||
return code;
|
||||
}
|
||||
|
||||
// build trans to update the epset
|
||||
int32_t mndStreamSetUpdateEpsetAction(SMnode *pMnode, SStreamObj *pStream, SVgroupChangeInfo *pInfo, STrans *pTrans) {
|
||||
mDebug("stream:0x%" PRIx64 " set tasks epset update action", pStream->uid);
|
||||
SStreamTaskIter *pIter = NULL;
|
||||
|
||||
taosWLockLatch(&pStream->lock);
|
||||
int32_t code = createStreamTaskIter(pStream, &pIter);
|
||||
if (code) {
|
||||
taosWUnLockLatch(&pStream->lock);
|
||||
mError("failed to create stream task iter:%s", pStream->name);
|
||||
return code;
|
||||
}
|
||||
|
||||
while (streamTaskIterNextTask(pIter)) {
|
||||
SStreamTask *pTask = NULL;
|
||||
code = streamTaskIterGetCurrent(pIter, &pTask);
|
||||
if (code) {
|
||||
destroyStreamTaskIter(pIter);
|
||||
taosWUnLockLatch(&pStream->lock);
|
||||
return code;
|
||||
}
|
||||
|
||||
code = doSetUpdateTaskAction(pMnode, pTrans, pTask, pInfo);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
destroyStreamTaskIter(pIter);
|
||||
taosWUnLockLatch(&pStream->lock);
|
||||
return code;
|
||||
}
|
||||
}
|
||||
|
||||
destroyStreamTaskIter(pIter);
|
||||
taosWUnLockLatch(&pStream->lock);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int32_t doSetResetAction(SMnode *pMnode, STrans *pTrans, SStreamTask *pTask) {
|
||||
SVResetStreamTaskReq *pReq = taosMemoryCalloc(1, sizeof(SVResetStreamTaskReq));
|
||||
if (pReq == NULL) {
|
||||
mError("failed to malloc in reset stream, size:%" PRIzu ", code:%s", sizeof(SVResetStreamTaskReq),
|
||||
tstrerror(terrno));
|
||||
return terrno;
|
||||
}
|
||||
|
||||
pReq->head.vgId = htonl(pTask->info.nodeId);
|
||||
pReq->taskId = pTask->id.taskId;
|
||||
pReq->streamId = pTask->id.streamId;
|
||||
|
||||
SEpSet epset = {0};
|
||||
bool hasEpset = false;
|
||||
int32_t code = extractNodeEpset(pMnode, &epset, &hasEpset, pTask->id.taskId, pTask->info.nodeId);
|
||||
if (code != TSDB_CODE_SUCCESS || !hasEpset) {
|
||||
taosMemoryFree(pReq);
|
||||
return code;
|
||||
}
|
||||
|
||||
code = setTransAction(pTrans, pReq, sizeof(SVResetStreamTaskReq), TDMT_VND_STREAM_TASK_RESET, &epset, 0, TSDB_CODE_VND_INVALID_VGROUP_ID);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
taosMemoryFree(pReq);
|
||||
}
|
||||
|
||||
return code;
|
||||
}
|
||||
|
||||
int32_t mndStreamSetResetTaskAction(SMnode *pMnode, STrans *pTrans, SStreamObj *pStream) {
|
||||
SStreamTaskIter *pIter = NULL;
|
||||
|
||||
taosWLockLatch(&pStream->lock);
|
||||
int32_t code = createStreamTaskIter(pStream, &pIter);
|
||||
if (code) {
|
||||
taosWUnLockLatch(&pStream->lock);
|
||||
mError("failed to create stream task iter:%s", pStream->name);
|
||||
return code;
|
||||
}
|
||||
|
||||
while (streamTaskIterNextTask(pIter)) {
|
||||
SStreamTask *pTask = NULL;
|
||||
code = streamTaskIterGetCurrent(pIter, &pTask);
|
||||
if (code) {
|
||||
destroyStreamTaskIter(pIter);
|
||||
taosWUnLockLatch(&pStream->lock);
|
||||
return code;
|
||||
}
|
||||
|
||||
code = doSetResetAction(pMnode, pTrans, pTask);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
destroyStreamTaskIter(pIter);
|
||||
taosWUnLockLatch(&pStream->lock);
|
||||
return code;
|
||||
}
|
||||
}
|
||||
|
||||
destroyStreamTaskIter(pIter);
|
||||
taosWUnLockLatch(&pStream->lock);
|
||||
*pNumOfStreams = numOfStreams;
|
||||
mndReleaseDb(pMnode, pDb);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1000,90 +598,6 @@ int32_t removeExpiredNodeEntryAndTaskInBuf(SArray *pNodeSnapshot) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int32_t doSetUpdateChkptAction(SMnode *pMnode, STrans *pTrans, SStreamTask *pTask) {
|
||||
SVUpdateCheckpointInfoReq *pReq = taosMemoryCalloc(1, sizeof(SVUpdateCheckpointInfoReq));
|
||||
if (pReq == NULL) {
|
||||
mError("failed to malloc in reset stream, size:%" PRIzu ", code:%s", sizeof(SVUpdateCheckpointInfoReq),
|
||||
tstrerror(terrno));
|
||||
return terrno;
|
||||
}
|
||||
|
||||
pReq->head.vgId = htonl(pTask->info.nodeId);
|
||||
pReq->taskId = pTask->id.taskId;
|
||||
pReq->streamId = pTask->id.streamId;
|
||||
|
||||
SChkptReportInfo *pStreamItem = (SChkptReportInfo*)taosHashGet(execInfo.pChkptStreams, &pTask->id.streamId, sizeof(pTask->id.streamId));
|
||||
if (pStreamItem == NULL) {
|
||||
return TSDB_CODE_INVALID_PARA;
|
||||
}
|
||||
|
||||
int32_t size = taosArrayGetSize(pStreamItem->pTaskList);
|
||||
for(int32_t i = 0; i < size; ++i) {
|
||||
STaskChkptInfo* pInfo = taosArrayGet(pStreamItem->pTaskList, i);
|
||||
if (pInfo == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (pInfo->taskId == pTask->id.taskId) {
|
||||
pReq->checkpointId = pInfo->checkpointId;
|
||||
pReq->checkpointVer = pInfo->version;
|
||||
pReq->checkpointTs = pInfo->ts;
|
||||
pReq->dropRelHTask = pInfo->dropHTask;
|
||||
pReq->transId = pInfo->transId;
|
||||
pReq->hStreamId = pTask->hTaskInfo.id.streamId;
|
||||
pReq->hTaskId = pTask->hTaskInfo.id.taskId;
|
||||
}
|
||||
}
|
||||
|
||||
SEpSet epset = {0};
|
||||
bool hasEpset = false;
|
||||
int32_t code = extractNodeEpset(pMnode, &epset, &hasEpset, pTask->id.taskId, pTask->info.nodeId);
|
||||
if (code != TSDB_CODE_SUCCESS || !hasEpset) {
|
||||
taosMemoryFree(pReq);
|
||||
return code;
|
||||
}
|
||||
|
||||
code = setTransAction(pTrans, pReq, sizeof(SVUpdateCheckpointInfoReq), TDMT_STREAM_TASK_UPDATE_CHKPT, &epset, 0, TSDB_CODE_VND_INVALID_VGROUP_ID);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
taosMemoryFree(pReq);
|
||||
}
|
||||
|
||||
return code;
|
||||
}
|
||||
|
||||
int32_t mndStreamSetUpdateChkptAction(SMnode *pMnode, STrans *pTrans, SStreamObj *pStream) {
|
||||
SStreamTaskIter *pIter = NULL;
|
||||
|
||||
taosWLockLatch(&pStream->lock);
|
||||
int32_t code = createStreamTaskIter(pStream, &pIter);
|
||||
if (code) {
|
||||
taosWUnLockLatch(&pStream->lock);
|
||||
mError("failed to create stream task iter:%s", pStream->name);
|
||||
return code;
|
||||
}
|
||||
|
||||
while (streamTaskIterNextTask(pIter)) {
|
||||
SStreamTask *pTask = NULL;
|
||||
code = streamTaskIterGetCurrent(pIter, &pTask);
|
||||
if (code) {
|
||||
destroyStreamTaskIter(pIter);
|
||||
taosWUnLockLatch(&pStream->lock);
|
||||
return code;
|
||||
}
|
||||
|
||||
code = doSetUpdateChkptAction(pMnode, pTrans, pTask);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
destroyStreamTaskIter(pIter);
|
||||
taosWUnLockLatch(&pStream->lock);
|
||||
return code;
|
||||
}
|
||||
}
|
||||
|
||||
destroyStreamTaskIter(pIter);
|
||||
taosWUnLockLatch(&pStream->lock);
|
||||
return code;
|
||||
}
|
||||
|
||||
int32_t mndScanCheckpointReportInfo(SRpcMsg *pReq) {
|
||||
SMnode *pMnode = pReq->info.node;
|
||||
void *pIter = NULL;
|
||||
|
@ -1172,60 +686,6 @@ int32_t mndScanCheckpointReportInfo(SRpcMsg *pReq) {
|
|||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
static int32_t mndStreamSetChkptIdAction(SMnode *pMnode, STrans *pTrans, SStreamTask* pTask, int64_t checkpointId, int64_t ts) {
|
||||
SRestoreCheckpointInfo req = {
|
||||
.taskId = pTask->id.taskId,
|
||||
.streamId = pTask->id.streamId,
|
||||
.checkpointId = checkpointId,
|
||||
.startTs = ts,
|
||||
.nodeId = pTask->info.nodeId,
|
||||
.transId = pTrans->id,
|
||||
};
|
||||
|
||||
int32_t code = 0;
|
||||
int32_t blen;
|
||||
tEncodeSize(tEncodeRestoreCheckpointInfo, &req, blen, code);
|
||||
if (code < 0) {
|
||||
return terrno;
|
||||
}
|
||||
|
||||
int32_t tlen = sizeof(SMsgHead) + blen;
|
||||
|
||||
void *pBuf = taosMemoryMalloc(tlen);
|
||||
if (pBuf == NULL) {
|
||||
return terrno;
|
||||
}
|
||||
|
||||
void *abuf = POINTER_SHIFT(pBuf, sizeof(SMsgHead));
|
||||
SEncoder encoder;
|
||||
tEncoderInit(&encoder, abuf, tlen);
|
||||
code = tEncodeRestoreCheckpointInfo(&encoder, &req);
|
||||
tEncoderClear(&encoder);
|
||||
if (code == -1) {
|
||||
taosMemoryFree(pBuf);
|
||||
return code;
|
||||
}
|
||||
|
||||
SMsgHead *pMsgHead = (SMsgHead *)pBuf;
|
||||
pMsgHead->contLen = htonl(tlen);
|
||||
pMsgHead->vgId = htonl(pTask->info.nodeId);
|
||||
|
||||
SEpSet epset = {0};
|
||||
bool hasEpset = false;
|
||||
code = extractNodeEpset(pMnode, &epset, &hasEpset, pTask->id.taskId, pTask->info.nodeId);
|
||||
if (code != TSDB_CODE_SUCCESS || !hasEpset) {
|
||||
taosMemoryFree(pBuf);
|
||||
return code;
|
||||
}
|
||||
|
||||
code = setTransAction(pTrans, pBuf, tlen, TDMT_STREAM_CONSEN_CHKPT, &epset, 0, TSDB_CODE_VND_INVALID_VGROUP_ID);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
taosMemoryFree(pBuf);
|
||||
}
|
||||
|
||||
return code;
|
||||
}
|
||||
|
||||
int32_t mndCreateSetConsensusChkptIdTrans(SMnode *pMnode, SStreamObj *pStream, int32_t taskId, int64_t checkpointId,
|
||||
int64_t ts) {
|
||||
char msg[128] = {0};
|
||||
|
@ -1880,6 +1340,163 @@ int32_t setTaskAttrInResBlock(SStreamObj *pStream, SStreamTask *pTask, SSDataBlo
|
|||
return code;
|
||||
}
|
||||
|
||||
static bool isNodeEpsetChanged(const SEpSet *pPrevEpset, const SEpSet *pCurrent) {
|
||||
const SEp *pEp = GET_ACTIVE_EP(pPrevEpset);
|
||||
const SEp *p = GET_ACTIVE_EP(pCurrent);
|
||||
|
||||
if (pEp->port == p->port && strncmp(pEp->fqdn, p->fqdn, TSDB_FQDN_LEN) == 0) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void mndDestroyVgroupChangeInfo(SVgroupChangeInfo* pInfo) {
|
||||
if (pInfo != NULL) {
|
||||
taosArrayDestroy(pInfo->pUpdateNodeList);
|
||||
taosHashCleanup(pInfo->pDBMap);
|
||||
}
|
||||
}
|
||||
|
||||
// 1. increase the replica does not affect the stream process.
|
||||
// 2. decreasing the replica may affect the stream task execution in the way that there is one or more running stream
|
||||
// tasks on the will be removed replica.
|
||||
// 3. vgroup redistribution is an combination operation of first increase replica and then decrease replica. So we
|
||||
// will handle it as mentioned in 1 & 2 items.
|
||||
int32_t mndFindChangedNodeInfo(SMnode *pMnode, const SArray *pPrevNodeList, const SArray *pNodeList,
|
||||
SVgroupChangeInfo *pInfo) {
|
||||
int32_t code = 0;
|
||||
int32_t lino = 0;
|
||||
|
||||
if (pInfo == NULL) {
|
||||
return TSDB_CODE_INVALID_PARA;
|
||||
}
|
||||
|
||||
pInfo->pUpdateNodeList = taosArrayInit(4, sizeof(SNodeUpdateInfo)),
|
||||
pInfo->pDBMap = taosHashInit(32, taosGetDefaultHashFunction(TSDB_DATA_TYPE_VARCHAR), true, HASH_NO_LOCK);
|
||||
|
||||
if (pInfo->pUpdateNodeList == NULL || pInfo->pDBMap == NULL) {
|
||||
mndDestroyVgroupChangeInfo(pInfo);
|
||||
TSDB_CHECK_NULL(NULL, code, lino, _err, terrno);
|
||||
}
|
||||
|
||||
int32_t numOfNodes = taosArrayGetSize(pPrevNodeList);
|
||||
for (int32_t i = 0; i < numOfNodes; ++i) {
|
||||
SNodeEntry *pPrevEntry = taosArrayGet(pPrevNodeList, i);
|
||||
if (pPrevEntry == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
int32_t num = taosArrayGetSize(pNodeList);
|
||||
for (int32_t j = 0; j < num; ++j) {
|
||||
SNodeEntry *pCurrent = taosArrayGet(pNodeList, j);
|
||||
if(pCurrent == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (pCurrent->nodeId == pPrevEntry->nodeId) {
|
||||
if (pPrevEntry->stageUpdated || isNodeEpsetChanged(&pPrevEntry->epset, &pCurrent->epset)) {
|
||||
const SEp *pPrevEp = GET_ACTIVE_EP(&pPrevEntry->epset);
|
||||
|
||||
char buf[256] = {0};
|
||||
code = epsetToStr(&pCurrent->epset, buf, tListLen(buf)); // ignore this error
|
||||
if (code) {
|
||||
mError("failed to convert epset string, code:%s", tstrerror(code));
|
||||
TSDB_CHECK_CODE(code, lino, _err);
|
||||
}
|
||||
|
||||
mDebug("nodeId:%d restart/epset changed detected, old:%s:%d -> new:%s, stageUpdate:%d", pCurrent->nodeId,
|
||||
pPrevEp->fqdn, pPrevEp->port, buf, pPrevEntry->stageUpdated);
|
||||
|
||||
SNodeUpdateInfo updateInfo = {.nodeId = pPrevEntry->nodeId};
|
||||
epsetAssign(&updateInfo.prevEp, &pPrevEntry->epset);
|
||||
epsetAssign(&updateInfo.newEp, &pCurrent->epset);
|
||||
|
||||
void* p = taosArrayPush(pInfo->pUpdateNodeList, &updateInfo);
|
||||
TSDB_CHECK_NULL(p, code, lino, _err, terrno);
|
||||
}
|
||||
|
||||
// todo handle the snode info
|
||||
if (pCurrent->nodeId != SNODE_HANDLE) {
|
||||
SVgObj *pVgroup = mndAcquireVgroup(pMnode, pCurrent->nodeId);
|
||||
code = taosHashPut(pInfo->pDBMap, pVgroup->dbName, strlen(pVgroup->dbName), NULL, 0);
|
||||
mndReleaseVgroup(pMnode, pVgroup);
|
||||
TSDB_CHECK_CODE(code, lino, _err);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return code;
|
||||
|
||||
_err:
|
||||
mError("failed to find node change info, code:%s at %s line:%d", tstrerror(code), __func__, lino);
|
||||
mndDestroyVgroupChangeInfo(pInfo);
|
||||
return code;
|
||||
}
|
||||
|
||||
static int32_t doCheckForUpdated(SMnode *pMnode, SArray **ppNodeSnapshot) {
|
||||
bool allReady = false;
|
||||
bool nodeUpdated = false;
|
||||
SVgroupChangeInfo changeInfo = {0};
|
||||
|
||||
int32_t numOfNodes = extractStreamNodeList(pMnode);
|
||||
|
||||
if (numOfNodes == 0) {
|
||||
mDebug("stream task node change checking done, no vgroups exist, do nothing");
|
||||
execInfo.ts = taosGetTimestampSec();
|
||||
return false;
|
||||
}
|
||||
|
||||
for (int32_t i = 0; i < numOfNodes; ++i) {
|
||||
SNodeEntry *pNodeEntry = taosArrayGet(execInfo.pNodeList, i);
|
||||
if (pNodeEntry == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (pNodeEntry->stageUpdated) {
|
||||
mDebug("stream task not ready due to node update detected, checkpoint not issued");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
int32_t code = mndTakeVgroupSnapshot(pMnode, &allReady, ppNodeSnapshot);
|
||||
if (code) {
|
||||
mError("failed to get the vgroup snapshot, ignore it and continue");
|
||||
}
|
||||
|
||||
if (!allReady) {
|
||||
mWarn("not all vnodes ready, quit from vnodes status check");
|
||||
return true;
|
||||
}
|
||||
|
||||
code = mndFindChangedNodeInfo(pMnode, execInfo.pNodeList, *ppNodeSnapshot, &changeInfo);
|
||||
if (code) {
|
||||
nodeUpdated = false;
|
||||
} else {
|
||||
nodeUpdated = (taosArrayGetSize(changeInfo.pUpdateNodeList) > 0);
|
||||
if (nodeUpdated) {
|
||||
mDebug("stream tasks not ready due to node update");
|
||||
}
|
||||
}
|
||||
|
||||
mndDestroyVgroupChangeInfo(&changeInfo);
|
||||
return nodeUpdated;
|
||||
}
|
||||
|
||||
// check if the node update happens or not
|
||||
bool mndStreamNodeIsUpdated(SMnode *pMnode) {
|
||||
SArray *pNodeSnapshot = NULL;
|
||||
|
||||
streamMutexLock(&execInfo.lock);
|
||||
bool updated = doCheckForUpdated(pMnode, &pNodeSnapshot);
|
||||
streamMutexUnlock(&execInfo.lock);
|
||||
|
||||
taosArrayDestroy(pNodeSnapshot);
|
||||
return updated;
|
||||
}
|
||||
|
||||
uint32_t seed = 0;
|
||||
static SRpcMsg createRpcMsg(STransAction* pAction, int64_t traceId, int64_t signature) {
|
||||
SRpcMsg rpcMsg = {.msgType = pAction->msgType, .contLen = pAction->contLen, .info.ahandle = (void *)signature};
|
||||
|
|
|
@ -113,6 +113,7 @@ static int32_t mndBuildSubChangeReq(void **pBuf, int32_t *pLen, SMqSubscribeObj
|
|||
MND_TMQ_RETURN_CHECK(qSubPlanToString(pPlan, &req.qmsg, &msgLen));
|
||||
} else {
|
||||
req.qmsg = taosStrdup("");
|
||||
MND_TMQ_NULL_CHECK(req.qmsg);
|
||||
}
|
||||
req.subType = pSub->subType;
|
||||
req.withMeta = pSub->withMeta;
|
||||
|
|
|
@ -451,12 +451,14 @@ static int32_t mndCreateTopic(SMnode *pMnode, SRpcMsg *pReq, SCMCreateTopicReq *
|
|||
topicObj.dbUid = pDb->uid;
|
||||
topicObj.version = 1;
|
||||
topicObj.sql = taosStrdup(pCreate->sql);
|
||||
MND_TMQ_NULL_CHECK(topicObj.sql);
|
||||
topicObj.sqlLen = strlen(pCreate->sql) + 1;
|
||||
topicObj.subType = pCreate->subType;
|
||||
topicObj.withMeta = pCreate->withMeta;
|
||||
|
||||
if (pCreate->subType == TOPIC_SUB_TYPE__COLUMN) {
|
||||
topicObj.ast = taosStrdup(pCreate->ast);
|
||||
MND_TMQ_NULL_CHECK(topicObj.ast);
|
||||
topicObj.astLen = strlen(pCreate->ast) + 1;
|
||||
qDebugL("topic:%s ast %s", topicObj.name, topicObj.ast);
|
||||
MND_TMQ_RETURN_CHECK(nodesStringToNode(pCreate->ast, &pAst));
|
||||
|
@ -482,6 +484,7 @@ static int32_t mndCreateTopic(SMnode *pMnode, SRpcMsg *pReq, SCMCreateTopicReq *
|
|||
if(pCreate->ast != NULL){
|
||||
qDebugL("topic:%s ast %s", topicObj.name, pCreate->ast);
|
||||
topicObj.ast = taosStrdup(pCreate->ast);
|
||||
MND_TMQ_NULL_CHECK(topicObj.ast);
|
||||
topicObj.astLen = strlen(pCreate->ast) + 1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -795,7 +795,7 @@ static int32_t mndTransSync(SMnode *pMnode, STrans *pTrans) {
|
|||
mError("trans:%d, failed to encode while sync trans since %s", pTrans->id, tstrerror(code));
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
(void)sdbSetRawStatus(pRaw, SDB_STATUS_READY);
|
||||
TAOS_CHECK_RETURN(sdbSetRawStatus(pRaw, SDB_STATUS_READY));
|
||||
|
||||
mInfo("trans:%d, sync to other mnodes, stage:%s createTime:%" PRId64, pTrans->id, mndTransStr(pTrans->stage),
|
||||
pTrans->createdTime);
|
||||
|
@ -1778,7 +1778,7 @@ static bool mndTransPerformFinishStage(SMnode *pMnode, STrans *pTrans, bool topH
|
|||
mError("trans:%d, failed to encode while finish trans since %s", pTrans->id, terrstr());
|
||||
return false;
|
||||
}
|
||||
(void)sdbSetRawStatus(pRaw, SDB_STATUS_DROPPED);
|
||||
TAOS_CHECK_RETURN(sdbSetRawStatus(pRaw, SDB_STATUS_DROPPED));
|
||||
|
||||
int32_t code = sdbWrite(pMnode->pSdb, pRaw);
|
||||
if (code != 0) {
|
||||
|
@ -1943,6 +1943,8 @@ static int32_t mndRetrieveTrans(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBl
|
|||
int32_t numOfRows = 0;
|
||||
STrans *pTrans = NULL;
|
||||
int32_t cols = 0;
|
||||
int32_t code = 0;
|
||||
int32_t lino = 0;
|
||||
|
||||
while (numOfRows < rows) {
|
||||
pShow->pIter = sdbFetch(pSdb, SDB_TRANS, pShow->pIter, (void **)&pTrans);
|
||||
|
@ -1951,36 +1953,39 @@ static int32_t mndRetrieveTrans(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBl
|
|||
cols = 0;
|
||||
|
||||
SColumnInfoData *pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&pTrans->id, false);
|
||||
RETRIEVE_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, (const char *)&pTrans->id, false), pTrans, &lino, _OVER);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&pTrans->createdTime, false);
|
||||
RETRIEVE_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, (const char *)&pTrans->createdTime, false), pTrans, &lino,
|
||||
_OVER);
|
||||
|
||||
char stage[TSDB_TRANS_STAGE_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||
STR_WITH_MAXSIZE_TO_VARSTR(stage, mndTransStr(pTrans->stage), pShow->pMeta->pSchemas[cols].bytes);
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)stage, false);
|
||||
RETRIEVE_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, (const char *)stage, false), pTrans, &lino, _OVER);
|
||||
|
||||
char opername[TSDB_TRANS_OPER_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||
STR_WITH_MAXSIZE_TO_VARSTR(opername, pTrans->opername, pShow->pMeta->pSchemas[cols].bytes);
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)opername, false);
|
||||
RETRIEVE_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, (const char *)opername, false), pTrans, &lino, _OVER);
|
||||
|
||||
char dbname[TSDB_DB_NAME_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||
STR_WITH_MAXSIZE_TO_VARSTR(dbname, mndGetDbStr(pTrans->dbname), pShow->pMeta->pSchemas[cols].bytes);
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)dbname, false);
|
||||
RETRIEVE_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, (const char *)dbname, false), pTrans, &lino, _OVER);
|
||||
|
||||
char stbname[TSDB_TABLE_NAME_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||
STR_WITH_MAXSIZE_TO_VARSTR(stbname, mndGetDbStr(pTrans->stbname), pShow->pMeta->pSchemas[cols].bytes);
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)stbname, false);
|
||||
RETRIEVE_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, (const char *)stbname, false), pTrans, &lino, _OVER);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&pTrans->failedTimes, false);
|
||||
RETRIEVE_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, (const char *)&pTrans->failedTimes, false), pTrans, &lino,
|
||||
_OVER);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&pTrans->lastExecTime, false);
|
||||
RETRIEVE_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, (const char *)&pTrans->lastExecTime, false), pTrans, &lino,
|
||||
_OVER);
|
||||
|
||||
char lastInfo[TSDB_TRANS_ERROR_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||
char detail[TSDB_TRANS_ERROR_LEN + 1] = {0};
|
||||
|
@ -1996,12 +2001,14 @@ static int32_t mndRetrieveTrans(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBl
|
|||
}
|
||||
STR_WITH_MAXSIZE_TO_VARSTR(lastInfo, detail, pShow->pMeta->pSchemas[cols].bytes);
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)lastInfo, false);
|
||||
RETRIEVE_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, (const char *)lastInfo, false), pTrans, &lino, _OVER);
|
||||
|
||||
numOfRows++;
|
||||
sdbRelease(pSdb, pTrans);
|
||||
}
|
||||
|
||||
_OVER:
|
||||
if (code != 0) mError("failed to retrieve at line:%d, since %s", lino, tstrerror(code));
|
||||
pShow->numOfRows += numOfRows;
|
||||
return numOfRows;
|
||||
}
|
||||
|
|
|
@ -286,7 +286,7 @@ int32_t metaCacheUpsert(SMeta* pMeta, SMetaInfo* pInfo) {
|
|||
|
||||
SMetaCacheEntry* pEntryNew = (SMetaCacheEntry*)taosMemoryMalloc(sizeof(*pEntryNew));
|
||||
if (pEntryNew == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _exit;
|
||||
}
|
||||
|
||||
|
@ -411,7 +411,7 @@ int32_t metaStatsCacheUpsert(SMeta* pMeta, SMetaStbStats* pInfo) {
|
|||
|
||||
SMetaStbStatsEntry* pEntryNew = (SMetaStbStatsEntry*)taosMemoryMalloc(sizeof(*pEntryNew));
|
||||
if (pEntryNew == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _exit;
|
||||
}
|
||||
|
||||
|
@ -492,7 +492,7 @@ static int checkAllEntriesInCache(const STagFilterResEntry* pEntry, SArray* pInv
|
|||
LRUHandle* pRes = taosLRUCacheLookup(pCache, buf, len);
|
||||
if (pRes == NULL) { // remove the item in the linked list
|
||||
if (taosArrayPush(pInvalidRes, &pNode) == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
} else {
|
||||
(void)taosLRUCacheRelease(pCache, pRes, false);
|
||||
|
@ -612,7 +612,7 @@ static void freeUidCachePayload(const void* key, size_t keyLen, void* value, voi
|
|||
static int32_t addNewEntry(SHashObj* pTableEntry, const void* pKey, int32_t keyLen, uint64_t suid) {
|
||||
STagFilterResEntry* p = taosMemoryMalloc(sizeof(STagFilterResEntry));
|
||||
if (p == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
p->hitTimes = 0;
|
||||
|
|
|
@ -39,7 +39,7 @@ int meteDecodeColCmprEntry(SDecoder *pDecoder, SMetaEntry *pME) {
|
|||
uDebug("dencode cols:%d", pWrapper->nCols);
|
||||
pWrapper->pColCmpr = (SColCmpr *)tDecoderMalloc(pDecoder, pWrapper->nCols * sizeof(SColCmpr));
|
||||
if (pWrapper->pColCmpr == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
for (int i = 0; i < pWrapper->nCols; i++) {
|
||||
|
@ -53,7 +53,7 @@ static FORCE_INLINE int32_t metatInitDefaultSColCmprWrapper(SDecoder *pDecoder,
|
|||
SSchemaWrapper *pSchema) {
|
||||
pCmpr->nCols = pSchema->nCols;
|
||||
if ((pCmpr->pColCmpr = (SColCmpr *)tDecoderMalloc(pDecoder, pCmpr->nCols * sizeof(SColCmpr))) == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
for (int32_t i = 0; i < pCmpr->nCols; i++) {
|
||||
|
@ -149,7 +149,7 @@ int metaDecodeEntry(SDecoder *pCoder, SMetaEntry *pME) {
|
|||
} else if (pME->type == TSDB_TSMA_TABLE) {
|
||||
pME->smaEntry.tsma = tDecoderMalloc(pCoder, sizeof(STSma));
|
||||
if (!pME->smaEntry.tsma) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
TAOS_CHECK_RETURN(tDecodeTSma(pCoder, pME->smaEntry.tsma, true));
|
||||
} else {
|
||||
|
|
|
@ -1460,7 +1460,7 @@ int32_t metaGetTableTagsByUids(void *pVnode, int64_t suid, SArray *uidList) {
|
|||
if (!p->pTagVal) {
|
||||
if (isLock) metaULock(pMeta);
|
||||
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_RETURN(terrno);
|
||||
}
|
||||
memcpy(p->pTagVal, val, len);
|
||||
tdbFree(val);
|
||||
|
@ -1511,13 +1511,13 @@ int32_t metaGetTableTags(void *pVnode, uint64_t suid, SArray *pUidTagInfo) {
|
|||
if (!info.pTagVal) {
|
||||
metaCloseCtbCursor(pCur);
|
||||
taosHashCleanup(pSepecifiedUidMap);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
memcpy(info.pTagVal, pCur->pVal, pCur->vLen);
|
||||
if (taosArrayPush(pUidTagInfo, &info) == NULL) {
|
||||
metaCloseCtbCursor(pCur);
|
||||
taosHashCleanup(pSepecifiedUidMap);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
} else { // only the specified tables need to be added
|
||||
|
@ -1538,7 +1538,7 @@ int32_t metaGetTableTags(void *pVnode, uint64_t suid, SArray *pUidTagInfo) {
|
|||
if (!pTagInfo->pTagVal) {
|
||||
metaCloseCtbCursor(pCur);
|
||||
taosHashCleanup(pSepecifiedUidMap);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
memcpy(pTagInfo->pTagVal, pCur->pVal, pCur->vLen);
|
||||
}
|
||||
|
|
|
@ -106,7 +106,7 @@ static int metaSaveSmaToDB(SMeta *pMeta, const SMetaEntry *pME) {
|
|||
|
||||
pVal = taosMemoryMalloc(vLen);
|
||||
if (pVal == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
terrno = terrno;
|
||||
goto _err;
|
||||
}
|
||||
|
||||
|
|
|
@ -98,7 +98,7 @@ int32_t metaSnapRead(SMetaSnapReader* pReader, uint8_t** ppData) {
|
|||
|
||||
*ppData = taosMemoryMalloc(sizeof(SSnapDataHdr) + nData);
|
||||
if (*ppData == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _exit;
|
||||
}
|
||||
|
||||
|
@ -275,7 +275,7 @@ static int32_t saveSuperTableInfoForChildTable(SMetaEntry* me, SHashObj* suidInf
|
|||
STableInfoForChildTable dataTmp = {0};
|
||||
dataTmp.tableName = taosStrdup(me->name);
|
||||
if (dataTmp.tableName == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto END;
|
||||
}
|
||||
dataTmp.schemaRow = tCloneSSchemaWrapper(&me->stbEntry.schemaRow);
|
||||
|
|
|
@ -151,7 +151,7 @@ static int metaSaveJsonVarToIdx(SMeta *pMeta, const SMetaEntry *pCtbEntry, const
|
|||
if (pTagVal->nData > 0) {
|
||||
char *val = taosMemoryCalloc(1, pTagVal->nData + VARSTR_HEADER_SIZE);
|
||||
if (val == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _exception);
|
||||
TAOS_CHECK_GOTO(terrno, NULL, _exception);
|
||||
}
|
||||
int32_t len = taosUcs4ToMbs((TdUcs4 *)pTagVal->pData, pTagVal->nData, val + VARSTR_HEADER_SIZE);
|
||||
if (len < 0) {
|
||||
|
@ -217,7 +217,7 @@ int metaDelJsonVarFromIdx(SMeta *pMeta, const SMetaEntry *pCtbEntry, const SSche
|
|||
|
||||
SIndexMultiTerm *terms = indexMultiTermCreate();
|
||||
if (terms == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
int16_t nCols = taosArrayGetSize(pTagVals);
|
||||
|
@ -235,7 +235,7 @@ int metaDelJsonVarFromIdx(SMeta *pMeta, const SMetaEntry *pCtbEntry, const SSche
|
|||
if (pTagVal->nData > 0) {
|
||||
char *val = taosMemoryCalloc(1, pTagVal->nData + VARSTR_HEADER_SIZE);
|
||||
if (val == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _exception);
|
||||
TAOS_CHECK_GOTO(terrno, NULL, _exception);
|
||||
}
|
||||
int32_t len = taosUcs4ToMbs((TdUcs4 *)pTagVal->pData, pTagVal->nData, val + VARSTR_HEADER_SIZE);
|
||||
if (len < 0) {
|
||||
|
@ -2760,7 +2760,7 @@ int metaCreateTagIdxKey(tb_uid_t suid, int32_t cid, const void *pTagData, int32_
|
|||
|
||||
*ppTagIdxKey = (STagIdxKey *)taosMemoryMalloc(*nTagIdxKey);
|
||||
if (*ppTagIdxKey == NULL) {
|
||||
return terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
(*ppTagIdxKey)->suid = suid;
|
||||
|
|
|
@ -53,12 +53,12 @@ int32_t ttlMgrOpen(STtlManger **ppTtlMgr, TDB *pEnv, int8_t rollback, const char
|
|||
*ppTtlMgr = NULL;
|
||||
|
||||
STtlManger *pTtlMgr = (STtlManger *)tdbOsCalloc(1, sizeof(*pTtlMgr));
|
||||
if (pTtlMgr == NULL) TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
if (pTtlMgr == NULL) TAOS_RETURN(terrno);
|
||||
|
||||
char *logBuffer = (char *)tdbOsCalloc(1, strlen(logPrefix) + 1);
|
||||
if (logBuffer == NULL) {
|
||||
tdbOsFree(pTtlMgr);
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_RETURN(terrno);
|
||||
}
|
||||
(void)strcpy(logBuffer, logPrefix);
|
||||
pTtlMgr->logPrefix = logBuffer;
|
||||
|
|
|
@ -213,11 +213,11 @@ static int32_t tdInitSmaStat(SSmaStat **pSmaStat, int8_t smaType, const SSma *pS
|
|||
atomic_store_8(RSMA_TRIGGER_STAT(pRSmaStat), TASK_TRIGGER_STAT_INIT);
|
||||
(void)tsem_init(&pRSmaStat->notEmpty, 0, 0);
|
||||
if (!(pRSmaStat->blocks = taosArrayInit(1, sizeof(SSDataBlock)))) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
TAOS_CHECK_GOTO(code, &lino, _exit);
|
||||
}
|
||||
SSDataBlock datablock = {.info.type = STREAM_CHECKPOINT};
|
||||
TSDB_CHECK_NULL(taosArrayPush(pRSmaStat->blocks, &datablock), code, lino, _exit, TSDB_CODE_OUT_OF_MEMORY);
|
||||
TSDB_CHECK_NULL(taosArrayPush(pRSmaStat->blocks, &datablock), code, lino, _exit, terrno);
|
||||
|
||||
// init smaMgmt
|
||||
TAOS_CHECK_GOTO(smaInit(), &lino, _exit);
|
||||
|
|
|
@ -273,7 +273,7 @@ static int32_t tdSetRSmaInfoItemParams(SSma *pSma, SRSmaParam *param, SRSmaStat
|
|||
if (!taosCheckExistFile(taskInfDir)) {
|
||||
char *s = taosStrdup(taskInfDir);
|
||||
if (!s) {
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_RETURN(terrno);
|
||||
}
|
||||
if (taosMulMkDir(s) != 0) {
|
||||
code = TAOS_SYSTEM_ERROR(errno);
|
||||
|
@ -294,7 +294,7 @@ static int32_t tdSetRSmaInfoItemParams(SSma *pSma, SRSmaParam *param, SRSmaStat
|
|||
pStreamTask->pMeta = pVnode->pTq->pStreamMeta;
|
||||
pStreamTask->exec.qmsg = taosMemoryMalloc(strlen(RSMA_EXEC_TASK_FLAG) + 1);
|
||||
if (!pStreamTask->exec.qmsg) {
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_RETURN(terrno);
|
||||
}
|
||||
(void)sprintf(pStreamTask->exec.qmsg, "%s", RSMA_EXEC_TASK_FLAG);
|
||||
pStreamTask->chkInfo.checkpointId = streamMetaGetLatestCheckpointId(pStreamTask->pMeta);
|
||||
|
@ -321,7 +321,7 @@ static int32_t tdSetRSmaInfoItemParams(SSma *pSma, SRSmaParam *param, SRSmaStat
|
|||
}
|
||||
|
||||
if (!(pItem->pResList = taosArrayInit(1, POINTER_BYTES))) {
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_RETURN(terrno);
|
||||
}
|
||||
|
||||
if (pItem->fetchResultVer < pItem->submitReqVer) {
|
||||
|
@ -504,11 +504,11 @@ static int32_t tdUidStorePut(STbUidStore *pStore, tb_uid_t suid, tb_uid_t *uid)
|
|||
if (uid) {
|
||||
if (!pStore->tbUids) {
|
||||
if (!(pStore->tbUids = taosArrayInit(1, sizeof(tb_uid_t)))) {
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_RETURN(terrno);
|
||||
}
|
||||
}
|
||||
if (!taosArrayPush(pStore->tbUids, uid)) {
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_RETURN(terrno);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -516,7 +516,7 @@ static int32_t tdUidStorePut(STbUidStore *pStore, tb_uid_t suid, tb_uid_t *uid)
|
|||
if (!pStore->uidHash) {
|
||||
pStore->uidHash = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_ENTRY_LOCK);
|
||||
if (!pStore->uidHash) {
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_RETURN(terrno);
|
||||
}
|
||||
}
|
||||
if (uid) {
|
||||
|
@ -524,16 +524,16 @@ static int32_t tdUidStorePut(STbUidStore *pStore, tb_uid_t suid, tb_uid_t *uid)
|
|||
if (uidArray && ((uidArray = *(SArray **)uidArray))) {
|
||||
if (!taosArrayPush(uidArray, uid)) {
|
||||
taosArrayDestroy(uidArray);
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_RETURN(terrno);
|
||||
}
|
||||
} else {
|
||||
SArray *pUidArray = taosArrayInit(1, sizeof(tb_uid_t));
|
||||
if (!pUidArray) {
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_RETURN(terrno);
|
||||
}
|
||||
if (!taosArrayPush(pUidArray, uid)) {
|
||||
taosArrayDestroy(pUidArray);
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_RETURN(terrno);
|
||||
}
|
||||
TAOS_CHECK_RETURN(taosHashPut(pStore->uidHash, &suid, sizeof(suid), &pUidArray, sizeof(pUidArray)));
|
||||
}
|
||||
|
@ -634,7 +634,7 @@ static int32_t tdRSmaProcessDelReq(SSma *pSma, int64_t suid, int8_t level, SBatc
|
|||
|
||||
void *pBuf = rpcMallocCont(len + sizeof(SMsgHead));
|
||||
if (!pBuf) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
}
|
||||
|
||||
|
@ -696,7 +696,7 @@ static int32_t tdRSmaExecAndSubmitResult(SSma *pSma, qTaskInfo_t taskInfo, SRSma
|
|||
SBatchDeleteReq deleteReq = {.suid = suid, .level = pItem->level};
|
||||
deleteReq.deleteReqs = taosArrayInit(0, sizeof(SSingleDeleteReq));
|
||||
if (!deleteReq.deleteReqs) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
}
|
||||
code = tqBuildDeleteReq(pSma->pVnode->pTq, NULL, output, &deleteReq, "", true);
|
||||
|
@ -1065,7 +1065,7 @@ static int32_t tdRSmaRestoreQTaskInfoInit(SSma *pSma, int64_t *nTables) {
|
|||
tb_uid_t suid = 0;
|
||||
|
||||
if (!(suidList = taosArrayInit(1, sizeof(tb_uid_t)))) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
}
|
||||
|
||||
|
@ -1085,7 +1085,7 @@ static int32_t tdRSmaRestoreQTaskInfoInit(SSma *pSma, int64_t *nTables) {
|
|||
int64_t nRsmaTables = 0;
|
||||
metaReaderDoInit(&mr, SMA_META(pSma), META_READER_LOCK);
|
||||
if (!(uidStore.tbUids = taosArrayInit(1024, sizeof(tb_uid_t)))) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
}
|
||||
|
||||
|
@ -1518,7 +1518,7 @@ static int32_t tdRSmaBatchExec(SSma *pSma, SRSmaInfo *pInfo, STaosQall *qall, SA
|
|||
version = packData.ver;
|
||||
if (!taosArrayPush(pSubmitArr, &packData)) {
|
||||
taosFreeQitem(msg);
|
||||
TAOS_CHECK_EXIT(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_CHECK_EXIT(terrno);
|
||||
}
|
||||
++nSubmit;
|
||||
} else if (inputType == STREAM_INPUT__REF_DATA_BLOCK) {
|
||||
|
@ -1608,7 +1608,7 @@ int32_t tdRSmaProcessExecImpl(SSma *pSma, ERsmaExecType type) {
|
|||
|
||||
if (!(pSubmitArr =
|
||||
taosArrayInit(TMIN(RSMA_EXEC_BATCH_SIZE, atomic_load_64(&pRSmaStat->nBufItems)), sizeof(SPackedData)))) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
}
|
||||
|
||||
|
|
|
@ -170,12 +170,12 @@ int32_t smaBlockToSubmit(SVnode *pVnode, const SArray *pBlocks, const STSchema *
|
|||
|
||||
pReq->aSubmitTbData = taosArrayInit(1, sizeof(SSubmitTbData));
|
||||
if (pReq->aSubmitTbData == NULL) {
|
||||
TAOS_CHECK_EXIT(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_CHECK_EXIT(terrno);
|
||||
}
|
||||
|
||||
pTableIndexMap = taosHashInit(numOfBlocks, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_NO_LOCK);
|
||||
if (pTableIndexMap == NULL) {
|
||||
TAOS_CHECK_EXIT(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_CHECK_EXIT(terrno);
|
||||
}
|
||||
|
||||
// SSubmitTbData req
|
||||
|
@ -205,7 +205,7 @@ int32_t smaBlockToSubmit(SVnode *pVnode, const SArray *pBlocks, const STSchema *
|
|||
}
|
||||
|
||||
if( taosArrayPush(pReq->aSubmitTbData, &tbData) == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -232,7 +232,7 @@ int32_t smaBlockToSubmit(SVnode *pVnode, const SArray *pBlocks, const STSchema *
|
|||
SEncoder encoder;
|
||||
len += sizeof(SSubmitReq2Msg);
|
||||
if (!(pBuf = rpcMallocCont(len))) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
}
|
||||
|
||||
|
@ -277,7 +277,7 @@ static int32_t tsmaProcessDelReq(SSma *pSma, int64_t indexUid, SBatchDeleteReq *
|
|||
|
||||
void *pBuf = rpcMallocCont(len + sizeof(SMsgHead));
|
||||
if (!pBuf) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
}
|
||||
|
||||
|
|
|
@ -70,11 +70,14 @@ int32_t tqOpen(const char* path, SVnode* pVnode) {
|
|||
}
|
||||
pVnode->pTq = pTq;
|
||||
pTq->path = taosStrdup(path);
|
||||
if (pTq->path == NULL) {
|
||||
return terrno;
|
||||
}
|
||||
pTq->pVnode = pVnode;
|
||||
|
||||
pTq->pHandle = taosHashInit(64, MurmurHash3_32, true, HASH_ENTRY_LOCK);
|
||||
if (pTq->pHandle == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
taosHashSetFreeFp(pTq->pHandle, tqDestroyTqHandle);
|
||||
|
||||
|
@ -82,18 +85,18 @@ int32_t tqOpen(const char* path, SVnode* pVnode) {
|
|||
|
||||
pTq->pPushMgr = taosHashInit(64, MurmurHash3_32, false, HASH_NO_LOCK);
|
||||
if (pTq->pPushMgr == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
pTq->pCheckInfo = taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK);
|
||||
if (pTq->pCheckInfo == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
taosHashSetFreeFp(pTq->pCheckInfo, (FDelete)tDeleteSTqCheckInfo);
|
||||
|
||||
pTq->pOffset = taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_VARCHAR), true, HASH_ENTRY_LOCK);
|
||||
if (pTq->pOffset == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
taosHashSetFreeFp(pTq->pOffset, (FDelete)tDeleteSTqOffset);
|
||||
|
||||
|
@ -464,7 +467,6 @@ int32_t tqProcessVgCommittedInfoReq(STQ* pTq, SRpcMsg* pMsg) {
|
|||
|
||||
void* buf = rpcMallocCont(len);
|
||||
if (buf == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
SEncoder encoder = {0};
|
||||
|
|
|
@ -198,7 +198,7 @@ int32_t tqMetaGetOffset(STQ* pTq, const char* subkey, STqOffset** pOffset){
|
|||
if (taosHashPut(pTq->pOffset, subkey, strlen(subkey), &offset, sizeof(STqOffset)) != 0) {
|
||||
tDeleteSTqOffset(&offset);
|
||||
tdbFree(data);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
tdbFree(data);
|
||||
|
||||
|
@ -341,16 +341,24 @@ int32_t tqMetaCreateHandle(STQ* pTq, SMqRebVgReq* req, STqHandle* handle) {
|
|||
handle->execHandle.subType = req->subType;
|
||||
handle->fetchMeta = req->withMeta;
|
||||
if (req->subType == TOPIC_SUB_TYPE__COLUMN) {
|
||||
handle->execHandle.execCol.qmsg = taosStrdup(req->qmsg);
|
||||
void *tmp = taosStrdup(req->qmsg);
|
||||
if (tmp == NULL) {
|
||||
return terrno;
|
||||
}
|
||||
handle->execHandle.execCol.qmsg = tmp;
|
||||
} else if (req->subType == TOPIC_SUB_TYPE__DB) {
|
||||
handle->execHandle.execDb.pFilterOutTbUid =
|
||||
taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_ENTRY_LOCK);
|
||||
if(handle->execHandle.execDb.pFilterOutTbUid == NULL){
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
}else if(req->subType == TOPIC_SUB_TYPE__TABLE){
|
||||
handle->execHandle.execTb.suid = req->suid;
|
||||
handle->execHandle.execTb.qmsg = taosStrdup(req->qmsg);
|
||||
void *tmp = taosStrdup(req->qmsg);
|
||||
if (tmp == NULL) {
|
||||
return terrno;
|
||||
}
|
||||
handle->execHandle.execTb.qmsg = tmp;
|
||||
}
|
||||
|
||||
handle->snapshotVer = walGetCommittedVer(pTq->pVnode->pWal);
|
||||
|
|
|
@ -577,7 +577,7 @@ static int32_t buildResSDataBlock(SSDataBlock* pBlock, SSchemaWrapper* pSchema,
|
|||
int32_t code = blockDataAppendColInfo(pBlock, &colInfo);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
blockDataFreeRes(pBlock);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -36,11 +36,11 @@ int32_t tqAddBlockDataToRsp(const SSDataBlock* pBlock, void* pRsp, int32_t numOf
|
|||
actualLen += sizeof(SRetrieveTableRspForTmq);
|
||||
if (taosArrayPush(((SMqDataRspCommon*)pRsp)->blockDataLen, &actualLen) == NULL){
|
||||
taosMemoryFree(buf);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
if (taosArrayPush(((SMqDataRspCommon*)pRsp)->blockData, &buf) == NULL) {
|
||||
taosMemoryFree(buf);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
return TSDB_CODE_SUCCESS;
|
||||
|
@ -52,7 +52,7 @@ static int32_t tqAddBlockSchemaToRsp(const STqExecHandle* pExec, void* pRsp) {
|
|||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
if (taosArrayPush(((SMqDataRspCommon*)pRsp)->blockSchema, &pSW) == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -69,6 +69,10 @@ static int32_t tqAddTbNameToRsp(const STQ* pTq, int64_t uid, void* pRsp, int32_t
|
|||
|
||||
for (int32_t i = 0; i < n; i++) {
|
||||
char* tbName = taosStrdup(mr.me.name);
|
||||
if (tbName == NULL) {
|
||||
metaReaderClear(&mr);
|
||||
return terrno;
|
||||
}
|
||||
if(taosArrayPush(((SMqDataRspCommon*)pRsp)->blockTbName, &tbName) == NULL){
|
||||
continue;
|
||||
}
|
||||
|
@ -213,6 +217,10 @@ int32_t tqScanTaosx(STQ* pTq, const STqHandle* pHandle, STaosxRsp* pRsp, SMqBatc
|
|||
}
|
||||
} else {
|
||||
char* tbName = taosStrdup(qExtractTbnameFromTask(task));
|
||||
if (tbName == NULL) {
|
||||
tqError("vgId:%d, failed to add tbname to rsp msg, null", pTq->pVnode->config.vgId);
|
||||
return terrno;
|
||||
}
|
||||
if (taosArrayPush(pRsp->common.blockTbName, &tbName) == NULL){
|
||||
tqError("vgId:%d, failed to add tbname to rsp msg", pTq->pVnode->config.vgId);
|
||||
continue;
|
||||
|
@ -327,12 +335,12 @@ static void tqProcessSubData(STQ* pTq, STqHandle* pHandle, STaosxRsp* pRsp, int3
|
|||
if (pRsp->createTableNum == 0) {
|
||||
pRsp->createTableLen = taosArrayInit(0, sizeof(int32_t));
|
||||
if (pRsp->createTableLen == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto END;
|
||||
}
|
||||
pRsp->createTableReq = taosArrayInit(0, sizeof(void*));
|
||||
if (pRsp->createTableReq == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto END;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -198,7 +198,7 @@ int32_t initCreateTableMsg(SVCreateTbReq* pCreateTableReq, uint64_t suid, const
|
|||
pCreateTableReq->ctb.stbName = taosStrdup((char*)tNameGetTableName(&name));
|
||||
if (pCreateTableReq->ctb.stbName == NULL) { // ignore this error code
|
||||
tqError("failed to duplicate the stb name:%s, failed to init create-table msg and create req table", stbFullName);
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -291,7 +291,7 @@ static int32_t doBuildAndSendCreateTableMsg(SVnode* pVnode, char* stbFullName, S
|
|||
|
||||
void* p = taosArrayPush(tagArray, &tagVal);
|
||||
if (p == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
code = createDefaultTagColName(&pCreateTbReq->ctb.tagName);
|
||||
|
@ -317,7 +317,7 @@ static int32_t doBuildAndSendCreateTableMsg(SVnode* pVnode, char* stbFullName, S
|
|||
}
|
||||
void* p = taosArrayPush(tagArray, &tagVal);
|
||||
if (p == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _end;
|
||||
}
|
||||
}
|
||||
|
@ -356,7 +356,7 @@ static int32_t doBuildAndSendCreateTableMsg(SVnode* pVnode, char* stbFullName, S
|
|||
|
||||
void* p = taosArrayPush(reqs.pArray, pCreateTbReq);
|
||||
if (p == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _end;
|
||||
}
|
||||
|
||||
|
@ -446,13 +446,13 @@ int32_t doMergeExistedRows(SSubmitTbData* pExisted, const SSubmitTbData* pNew, c
|
|||
if (pNewRow->ts < pOldRow->ts) {
|
||||
void* p = taosArrayPush(pFinal, &pNewRow);
|
||||
if (p == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
j += 1;
|
||||
} else if (pNewRow->ts > pOldRow->ts) {
|
||||
void* p = taosArrayPush(pFinal, &pOldRow);
|
||||
if (p == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
k += 1;
|
||||
|
@ -461,7 +461,7 @@ int32_t doMergeExistedRows(SSubmitTbData* pExisted, const SSubmitTbData* pNew, c
|
|||
if (pNewRow->numOfPKs == 0) {
|
||||
void* p = taosArrayPush(pFinal, &pNewRow);
|
||||
if (p == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
k += 1;
|
||||
|
@ -478,7 +478,7 @@ int32_t doMergeExistedRows(SSubmitTbData* pExisted, const SSubmitTbData* pNew, c
|
|||
if (ret <= 0) {
|
||||
void* p = taosArrayPush(pFinal, &pNewRow);
|
||||
if (p == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
j += 1;
|
||||
|
@ -490,7 +490,7 @@ int32_t doMergeExistedRows(SSubmitTbData* pExisted, const SSubmitTbData* pNew, c
|
|||
} else {
|
||||
void* p = taosArrayPush(pFinal, &pOldRow);
|
||||
if (p == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
k += 1;
|
||||
|
@ -503,7 +503,7 @@ int32_t doMergeExistedRows(SSubmitTbData* pExisted, const SSubmitTbData* pNew, c
|
|||
SRow* pRow = *(SRow**)TARRAY_GET_ELEM(pNew->aRowP, j++);
|
||||
void* p = taosArrayPush(pFinal, &pRow);
|
||||
if (p == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -511,7 +511,7 @@ int32_t doMergeExistedRows(SSubmitTbData* pExisted, const SSubmitTbData* pNew, c
|
|||
SRow* pRow = *(SRow**)TARRAY_GET_ELEM(pExisted->aRowP, k++);
|
||||
void* p = taosArrayPush(pFinal, &pRow);
|
||||
if (p == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -564,7 +564,7 @@ int32_t buildAutoCreateTableReq(const char* stbFullName, int64_t suid, int32_t n
|
|||
STagVal tagVal = {.cid = numOfCols, .type = TSDB_DATA_TYPE_UBIGINT, .i64 = pDataBlock->info.id.groupId};
|
||||
void* p = taosArrayPush(pTagArray, &tagVal);
|
||||
if (p == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
code = tTagNew(pTagArray, 1, false, (STag**)&pCreateTbReq->ctb.pTag);
|
||||
|
@ -604,7 +604,7 @@ int32_t buildSubmitMsgImpl(SSubmitReq2* pSubmitReq, int32_t vgId, void** pMsg, i
|
|||
pBuf = rpcMallocCont(len);
|
||||
if (NULL == pBuf) {
|
||||
tDestroySubmitReq(pSubmitReq, TSDB_MSG_FLG_ENCODE);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
((SSubmitReq2Msg*)pBuf)->header.vgId = vgId;
|
||||
|
@ -652,7 +652,7 @@ int32_t doConvertRows(SSubmitTbData* pTableData, const STSchema* pTSchema, SSDat
|
|||
taosArrayDestroy(pTableData->aRowP);
|
||||
pTableData->aRowP = NULL;
|
||||
taosArrayDestroy(pVals);
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
tqError("s-task:%s failed to prepare write stream res blocks, code:%s", id, tstrerror(code));
|
||||
return code;
|
||||
}
|
||||
|
@ -695,7 +695,7 @@ int32_t doConvertRows(SSubmitTbData* pTableData, const STSchema* pTSchema, SSDat
|
|||
SColVal cv = COL_VAL_NULL(pCol->colId, pCol->type);
|
||||
void* p = taosArrayPush(pVals, &cv);
|
||||
if (p == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
} else {
|
||||
SColumnInfoData* pColData = taosArrayGet(pDataBlock->pDataBlock, dataIndex);
|
||||
|
@ -713,7 +713,7 @@ int32_t doConvertRows(SSubmitTbData* pTableData, const STSchema* pTSchema, SSDat
|
|||
SColVal cv = COL_VAL_NULL(pCol->colId, pCol->type);
|
||||
void* p = taosArrayPush(pVals, &cv);
|
||||
if (p == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
dataIndex++;
|
||||
|
@ -725,7 +725,7 @@ int32_t doConvertRows(SSubmitTbData* pTableData, const STSchema* pTSchema, SSDat
|
|||
SColVal cv = COL_VAL_VALUE(pCol->colId, sv);
|
||||
void* p = taosArrayPush(pVals, &cv);
|
||||
if (p == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
} else {
|
||||
SValue sv = {.type = pCol->type};
|
||||
|
@ -733,7 +733,7 @@ int32_t doConvertRows(SSubmitTbData* pTableData, const STSchema* pTSchema, SSDat
|
|||
SColVal cv = COL_VAL_VALUE(pCol->colId, sv);
|
||||
void* p = taosArrayPush(pVals, &cv);
|
||||
if (p == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
dataIndex++;
|
||||
|
@ -752,7 +752,7 @@ int32_t doConvertRows(SSubmitTbData* pTableData, const STSchema* pTSchema, SSDat
|
|||
|
||||
void* p = taosArrayPush(pTableData->aRowP, &pRow);
|
||||
if (p == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1026,7 +1026,7 @@ void tqSinkDataIntoDstTable(SStreamTask* pTask, void* vnode, void* data) {
|
|||
|
||||
SSubmitReq2 submitReq = {.aSubmitTbData = taosArrayInit(1, sizeof(SSubmitTbData))};
|
||||
if (submitReq.aSubmitTbData == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
tqError("s-task:%s vgId:%d failed to prepare submit msg in sink task, code:%s", id, vgId, tstrerror(code));
|
||||
return;
|
||||
}
|
||||
|
@ -1066,7 +1066,7 @@ void tqSinkDataIntoDstTable(SStreamTask* pTask, void* vnode, void* data) {
|
|||
|
||||
SSubmitReq2 submitReq = {.aSubmitTbData = taosArrayInit(1, sizeof(SSubmitTbData))};
|
||||
if (submitReq.aSubmitTbData == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
tqError("s-task:%s vgId:%d failed to prepare submit msg in sink task, code:%s", id, vgId, tstrerror(code));
|
||||
taosHashCleanup(pTableIndexMap);
|
||||
return;
|
||||
|
|
|
@ -33,7 +33,7 @@ int32_t tqSnapReaderOpen(STQ* pTq, int64_t sver, int64_t ever, int8_t type, STqS
|
|||
// alloc
|
||||
pReader = (STqSnapReader*)taosMemoryCalloc(1, sizeof(STqSnapReader));
|
||||
if (pReader == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _err;
|
||||
}
|
||||
pReader->pTq = pTq;
|
||||
|
|
|
@ -95,7 +95,7 @@ int32_t streamStateSnapRead(SStreamStateReader* pReader, uint8_t** ppData) {
|
|||
}
|
||||
*ppData = taosMemoryMalloc(sizeof(SSnapDataHdr) + len);
|
||||
if (*ppData == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _err;
|
||||
}
|
||||
// refactor later, avoid mem/free freq
|
||||
|
|
|
@ -96,7 +96,7 @@ int32_t tqScanWalInFuture(STQ* pTq, int32_t numOfTasks, int32_t idleDuration) {
|
|||
|
||||
SBuildScanWalMsgParam* pParam = taosMemoryMalloc(sizeof(SBuildScanWalMsgParam));
|
||||
if (pParam == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
pParam->pTq = pTq;
|
||||
|
|
|
@ -46,7 +46,7 @@ int32_t streamTaskSnapReaderOpen(STQ* pTq, int64_t sver, int64_t ever, SStreamTa
|
|||
pReader->ever = ever;
|
||||
pReader->tdbTbList = taosArrayInit(4, sizeof(STablePair));
|
||||
if (pReader->tdbTbList == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _err);
|
||||
TAOS_CHECK_GOTO(terrno, NULL, _err);
|
||||
}
|
||||
|
||||
STablePair pair1 = {.tbl = pTq->pStreamMeta->pTaskDb, .type = SNAP_DATA_STREAM_TASK};
|
||||
|
@ -159,7 +159,7 @@ NextTbl:
|
|||
}
|
||||
*ppData = taosMemoryMalloc(sizeof(SSnapDataHdr) + vLen);
|
||||
if (*ppData == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _err;
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ int32_t tqInitDataRsp(SMqDataRspCommon* pRsp, STqOffsetVal pOffset) {
|
|||
pRsp->blockDataLen = taosArrayInit(0, sizeof(int32_t));
|
||||
|
||||
if (pRsp->blockData == NULL || pRsp->blockDataLen == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
tOffsetCopy(&pRsp->reqOffset, &pOffset);
|
||||
|
@ -71,7 +71,7 @@ static int32_t tqInitTaosxRsp(SMqDataRspCommon* pRsp, STqOffsetVal pOffset) {
|
|||
taosArrayDestroy(pRsp->blockSchema);
|
||||
pRsp->blockSchema = NULL;
|
||||
}
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -540,7 +540,7 @@ int32_t tqDoSendDataRsp(const SRpcHandleInfo* pRpcHandleInfo, const void* pRsp,
|
|||
int32_t tlen = sizeof(SMqRspHead) + len;
|
||||
void* buf = rpcMallocCont(tlen);
|
||||
if (buf == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
SMqRspHead* pHead = (SMqRspHead*)buf;
|
||||
|
|
|
@ -578,7 +578,7 @@ int32_t tqStreamTaskProcessCheckpointReadyMsg(SStreamMeta* pMeta, SRpcMsg* pMsg)
|
|||
{ // send checkpoint ready rsp
|
||||
SMStreamCheckpointReadyRspMsg* pReadyRsp = rpcMallocCont(sizeof(SMStreamCheckpointReadyRspMsg));
|
||||
if (pReadyRsp == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
pReadyRsp->upstreamTaskId = req.upstreamTaskId;
|
||||
|
|
|
@ -425,7 +425,7 @@ static int32_t tsdbCacheSerialize(SLastCol *pLastCol, char **value, size_t *size
|
|||
|
||||
*value = taosMemoryMalloc(*size);
|
||||
if (NULL == *value) {
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_RETURN(terrno);
|
||||
}
|
||||
|
||||
int32_t offset = tsdbCacheSerializeV0(*value, pLastCol);
|
||||
|
@ -509,7 +509,7 @@ static int32_t reallocVarDataVal(SValue *pValue) {
|
|||
if (nData > 0) {
|
||||
uint8_t *p = taosMemoryMalloc(nData);
|
||||
if (!p) {
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_RETURN(terrno);
|
||||
}
|
||||
pValue->pData = p;
|
||||
(void)memcpy(pValue->pData, pVal, nData);
|
||||
|
@ -1115,11 +1115,11 @@ static int32_t tsdbCacheUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, SArray
|
|||
if (!remainCols) {
|
||||
remainCols = taosArrayInit(num_keys * 2, sizeof(SIdxKey));
|
||||
if (!remainCols) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit);
|
||||
TAOS_CHECK_GOTO(terrno, &lino, _exit);
|
||||
}
|
||||
}
|
||||
if (!taosArrayPush(remainCols, &(SIdxKey){i, *key})) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit);
|
||||
TAOS_CHECK_GOTO(terrno, &lino, _exit);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1273,7 +1273,7 @@ int32_t tsdbCacheRowFormatUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, int6
|
|||
for (SColVal *pColVal = tsdbRowIterNext(&iter); pColVal && iCol < nCol; pColVal = tsdbRowIterNext(&iter), iCol++) {
|
||||
SLastUpdateCtx updateCtx = {.lflag = LFLAG_LAST_ROW, .tsdbRowKey = tsdbRowKey, .colVal = *pColVal};
|
||||
if (!taosArrayPush(ctxArray, &updateCtx)) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit);
|
||||
TAOS_CHECK_GOTO(terrno, &lino, _exit);
|
||||
}
|
||||
|
||||
if (!COL_VAL_IS_VALUE(pColVal)) {
|
||||
|
@ -1284,7 +1284,7 @@ int32_t tsdbCacheRowFormatUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, int6
|
|||
}
|
||||
updateCtx.lflag = LFLAG_LAST;
|
||||
if (!taosArrayPush(ctxArray, &updateCtx)) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit);
|
||||
TAOS_CHECK_GOTO(terrno, &lino, _exit);
|
||||
}
|
||||
}
|
||||
tsdbRowClose(&iter);
|
||||
|
@ -1310,7 +1310,7 @@ int32_t tsdbCacheRowFormatUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, int6
|
|||
if (COL_VAL_IS_VALUE(&colVal)) {
|
||||
SLastUpdateCtx updateCtx = {.lflag = LFLAG_LAST, .tsdbRowKey = tsdbRowKey, .colVal = colVal};
|
||||
if (!taosArrayPush(ctxArray, &updateCtx)) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit);
|
||||
TAOS_CHECK_GOTO(terrno, &lino, _exit);
|
||||
}
|
||||
(void)tSimpleHashIterateRemove(iColHash, &iCol, sizeof(iCol), &pIte, &iter);
|
||||
}
|
||||
|
@ -1352,7 +1352,7 @@ int32_t tsdbCacheColFormatUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, SBlo
|
|||
.colVal = COL_VAL_VALUE(PRIMARYKEY_TIMESTAMP_COL_ID, ((SValue){.type = TSDB_DATA_TYPE_TIMESTAMP,
|
||||
.val = lRow.pBlockData->aTSKEY[lRow.iRow]}))};
|
||||
if (!taosArrayPush(ctxArray, &updateCtx)) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit);
|
||||
TAOS_CHECK_GOTO(terrno, &lino, _exit);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1375,7 +1375,7 @@ int32_t tsdbCacheColFormatUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, SBlo
|
|||
|
||||
SLastUpdateCtx updateCtx = {.lflag = LFLAG_LAST, .tsdbRowKey = tsdbRowKey, .colVal = colVal};
|
||||
if (!taosArrayPush(ctxArray, &updateCtx)) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit);
|
||||
TAOS_CHECK_GOTO(terrno, &lino, _exit);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -1388,7 +1388,7 @@ int32_t tsdbCacheColFormatUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, SBlo
|
|||
for (SColVal *pColVal = tsdbRowIterNext(&iter); pColVal; pColVal = tsdbRowIterNext(&iter)) {
|
||||
SLastUpdateCtx updateCtx = {.lflag = LFLAG_LAST_ROW, .tsdbRowKey = tsdbRowKey, .colVal = *pColVal};
|
||||
if (!taosArrayPush(ctxArray, &updateCtx)) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit);
|
||||
TAOS_CHECK_GOTO(terrno, &lino, _exit);
|
||||
}
|
||||
}
|
||||
tsdbRowClose(&iter);
|
||||
|
@ -1423,7 +1423,7 @@ static int32_t tsdbCacheLoadFromRaw(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArr
|
|||
|
||||
SLastKey *key = &(SLastKey){.lflag = ltype, .uid = uid, .cid = PRIMARYKEY_TIMESTAMP_COL_ID};
|
||||
if (!taosArrayInsert(remainCols, 0, &(SIdxKey){0, *key})) {
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_RETURN(terrno);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1447,7 +1447,7 @@ static int32_t tsdbCacheLoadFromRaw(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArr
|
|||
int lastrowIndex = 0;
|
||||
|
||||
if (!slotIds || !lastColIds || !lastSlotIds || !lastrowColIds || !lastrowSlotIds) {
|
||||
TAOS_CHECK_EXIT(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_CHECK_EXIT(terrno);
|
||||
}
|
||||
|
||||
for (int i = 0; i < num_keys; ++i) {
|
||||
|
@ -1457,11 +1457,11 @@ static int32_t tsdbCacheLoadFromRaw(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArr
|
|||
if (NULL == lastTmpIndexArray) {
|
||||
lastTmpIndexArray = taosArrayInit(num_keys, sizeof(int32_t));
|
||||
if (!lastTmpIndexArray) {
|
||||
TAOS_CHECK_EXIT(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_CHECK_EXIT(terrno);
|
||||
}
|
||||
}
|
||||
if (!taosArrayPush(lastTmpIndexArray, &(i))) {
|
||||
TAOS_CHECK_EXIT(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_CHECK_EXIT(terrno);
|
||||
}
|
||||
lastColIds[lastIndex] = idxKey->key.cid;
|
||||
lastSlotIds[lastIndex] = pr->pSlotIds[idxKey->idx];
|
||||
|
@ -1470,11 +1470,11 @@ static int32_t tsdbCacheLoadFromRaw(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArr
|
|||
if (NULL == lastrowTmpIndexArray) {
|
||||
lastrowTmpIndexArray = taosArrayInit(num_keys, sizeof(int32_t));
|
||||
if (!lastrowTmpIndexArray) {
|
||||
TAOS_CHECK_EXIT(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_CHECK_EXIT(terrno);
|
||||
}
|
||||
}
|
||||
if (!taosArrayPush(lastrowTmpIndexArray, &(i))) {
|
||||
TAOS_CHECK_EXIT(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_CHECK_EXIT(terrno);
|
||||
}
|
||||
lastrowColIds[lastrowIndex] = idxKey->key.cid;
|
||||
lastrowSlotIds[lastrowIndex] = pr->pSlotIds[idxKey->idx];
|
||||
|
@ -1484,7 +1484,7 @@ static int32_t tsdbCacheLoadFromRaw(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArr
|
|||
|
||||
pTmpColArray = taosArrayInit(lastIndex + lastrowIndex, sizeof(SLastCol));
|
||||
if (!pTmpColArray) {
|
||||
TAOS_CHECK_EXIT(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_CHECK_EXIT(terrno);
|
||||
}
|
||||
|
||||
if (lastTmpIndexArray != NULL) {
|
||||
|
@ -1492,7 +1492,7 @@ static int32_t tsdbCacheLoadFromRaw(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArr
|
|||
for (int i = 0; i < taosArrayGetSize(lastTmpColArray); i++) {
|
||||
if (!taosArrayInsert(pTmpColArray, *(int32_t *)taosArrayGet(lastTmpIndexArray, i),
|
||||
taosArrayGet(lastTmpColArray, i))) {
|
||||
TAOS_CHECK_EXIT(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_CHECK_EXIT(terrno);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1502,7 +1502,7 @@ static int32_t tsdbCacheLoadFromRaw(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArr
|
|||
for (int i = 0; i < taosArrayGetSize(lastrowTmpColArray); i++) {
|
||||
if (!taosArrayInsert(pTmpColArray, *(int32_t *)taosArrayGet(lastrowTmpIndexArray, i),
|
||||
taosArrayGet(lastrowTmpColArray, i))) {
|
||||
TAOS_CHECK_EXIT(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_CHECK_EXIT(terrno);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1594,7 +1594,7 @@ static int32_t tsdbCacheLoadFromRocks(STsdb *pTsdb, tb_uid_t uid, SArray *pLastA
|
|||
if (!keys_list || !keys_list_sizes || !key_list) {
|
||||
taosMemoryFree(keys_list);
|
||||
taosMemoryFree(keys_list_sizes);
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_RETURN(terrno);
|
||||
}
|
||||
char **values_list = NULL;
|
||||
size_t *values_list_sizes = NULL;
|
||||
|
@ -1631,7 +1631,7 @@ static int32_t tsdbCacheLoadFromRocks(STsdb *pTsdb, tb_uid_t uid, SArray *pLastA
|
|||
SLastCol *pTmpLastCol = taosMemoryCalloc(1, sizeof(SLastCol));
|
||||
if (!pTmpLastCol) {
|
||||
taosMemoryFreeClear(pToFree);
|
||||
TAOS_CHECK_EXIT(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_CHECK_EXIT(terrno);
|
||||
}
|
||||
|
||||
size_t charge = 0;
|
||||
|
@ -1720,7 +1720,7 @@ int32_t tsdbCacheGetBatch(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArray, SCache
|
|||
TAOS_CHECK_GOTO(tsdbCacheReallocSLastCol(&lastCol, NULL), NULL, _exit);
|
||||
|
||||
if (taosArrayPush(pLastArray, &lastCol) == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _exit;
|
||||
}
|
||||
} else {
|
||||
|
@ -1729,29 +1729,29 @@ int32_t tsdbCacheGetBatch(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArray, SCache
|
|||
.colVal = COL_VAL_NONE(cid, pr->pSchema->columns[pr->pSlotIds[i]].type)};
|
||||
|
||||
if (taosArrayPush(pLastArray, &noneCol) == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _exit;
|
||||
}
|
||||
|
||||
if (!remainCols) {
|
||||
if ((remainCols = taosArrayInit(numKeys, sizeof(SIdxKey))) == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _exit;
|
||||
}
|
||||
}
|
||||
if (!ignoreFromRocks) {
|
||||
if ((ignoreFromRocks = taosArrayInit(numKeys, sizeof(bool))) == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _exit;
|
||||
}
|
||||
}
|
||||
if (taosArrayPush(remainCols, &(SIdxKey){i, key}) == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _exit;
|
||||
}
|
||||
bool ignoreRocks = pLastCol ? (pLastCol->cacheStatus == TSDB_LAST_CACHE_NO_CACHE) : false;
|
||||
if (taosArrayPush(ignoreFromRocks, &ignoreRocks) == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _exit;
|
||||
}
|
||||
}
|
||||
|
@ -1844,7 +1844,7 @@ int32_t tsdbCacheDel(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSKEY sKey, TSKE
|
|||
remainCols = taosArrayInit(numCols * 2, sizeof(SIdxKey));
|
||||
}
|
||||
if (!taosArrayPush(remainCols, &(SIdxKey){i, lastKey})) {
|
||||
TAOS_CHECK_EXIT(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_CHECK_EXIT(terrno);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2032,7 +2032,7 @@ static int32_t getTableDelDataFromTbData(STbData *pTbData, SArray *aDelData) {
|
|||
|
||||
for (; pDelData; pDelData = pDelData->pNext) {
|
||||
if (!taosArrayPush(aDelData, pDelData)) {
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_RETURN(terrno);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2098,7 +2098,7 @@ static int32_t loadTombFromBlk(const TTombBlkArray *pTombBlkArray, SCacheRowsRea
|
|||
uint64_t *uidList = getUidList(pReader);
|
||||
|
||||
if (!uidList) {
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_RETURN(terrno);
|
||||
}
|
||||
|
||||
for (int i = 0, j = 0; i < pTombBlkArray->size && j < numOfTables; ++i) {
|
||||
|
@ -2176,7 +2176,7 @@ static int32_t loadTombFromBlk(const TTombBlkArray *pTombBlkArray, SCacheRowsRea
|
|||
if (pInfo->pTombData == NULL) {
|
||||
pInfo->pTombData = taosArrayInit(4, sizeof(SDelData));
|
||||
if (!pInfo->pTombData) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
finished = true;
|
||||
break;
|
||||
}
|
||||
|
@ -2189,7 +2189,7 @@ static int32_t loadTombFromBlk(const TTombBlkArray *pTombBlkArray, SCacheRowsRea
|
|||
|
||||
SDelData delData = {.version = record.version, .sKey = record.skey, .eKey = record.ekey};
|
||||
if (!taosArrayPush(pInfo->pTombData, &delData)) {
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_RETURN(terrno);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2397,7 +2397,7 @@ static int32_t getNextRowFromFS(void *iter, TSDBROW **ppRow, bool *pIgnoreEarlie
|
|||
if (!state->pIndexList) {
|
||||
state->pIndexList = taosArrayInit(1, sizeof(SBrinBlk));
|
||||
if (!state->pIndexList) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _err);
|
||||
TAOS_CHECK_GOTO(terrno, &lino, _err);
|
||||
}
|
||||
} else {
|
||||
taosArrayClear(state->pIndexList);
|
||||
|
@ -2410,7 +2410,7 @@ static int32_t getNextRowFromFS(void *iter, TSDBROW **ppRow, bool *pIgnoreEarlie
|
|||
if (state->suid >= pBrinBlk->minTbid.suid && state->suid <= pBrinBlk->maxTbid.suid) {
|
||||
if (state->uid >= pBrinBlk->minTbid.uid && state->uid <= pBrinBlk->maxTbid.uid) {
|
||||
if (!taosArrayPush(state->pIndexList, pBrinBlk)) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _err);
|
||||
TAOS_CHECK_GOTO(terrno, &lino, _err);
|
||||
}
|
||||
}
|
||||
} else if (state->suid > pBrinBlk->maxTbid.suid ||
|
||||
|
@ -2971,7 +2971,7 @@ static int32_t nextRowIterGet(CacheNextRowIter *pIter, TSDBROW **ppRow, bool *pI
|
|||
|
||||
if (!pIter->pSkyline) {
|
||||
pIter->pSkyline = taosArrayInit(32, sizeof(TSDBKEY));
|
||||
TSDB_CHECK_NULL(pIter->pSkyline, code, lino, _err, TSDB_CODE_OUT_OF_MEMORY);
|
||||
TSDB_CHECK_NULL(pIter->pSkyline, code, lino, _err, terrno);
|
||||
|
||||
uint64_t uid = pIter->idx.uid;
|
||||
STableLoadInfo *pInfo = getTableLoadInfo(pIter->pr, uid);
|
||||
|
@ -2979,7 +2979,7 @@ static int32_t nextRowIterGet(CacheNextRowIter *pIter, TSDBROW **ppRow, bool *pI
|
|||
|
||||
if (pInfo->pTombData == NULL) {
|
||||
pInfo->pTombData = taosArrayInit(4, sizeof(SDelData));
|
||||
TSDB_CHECK_NULL(pInfo->pTombData, code, lino, _err, TSDB_CODE_OUT_OF_MEMORY);
|
||||
TSDB_CHECK_NULL(pInfo->pTombData, code, lino, _err, terrno);
|
||||
}
|
||||
|
||||
if (!taosArrayAddAll(pInfo->pTombData, pIter->pMemDelData)) {
|
||||
|
@ -3024,7 +3024,7 @@ _err:
|
|||
static int32_t initLastColArrayPartial(STSchema *pTSchema, SArray **ppColArray, int16_t *slotIds, int nCols) {
|
||||
SArray *pColArray = taosArrayInit(nCols, sizeof(SLastCol));
|
||||
if (NULL == pColArray) {
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_RETURN(terrno);
|
||||
}
|
||||
|
||||
for (int32_t i = 0; i < nCols; ++i) {
|
||||
|
@ -3032,7 +3032,7 @@ static int32_t initLastColArrayPartial(STSchema *pTSchema, SArray **ppColArray,
|
|||
SLastCol col = {.rowKey.ts = 0,
|
||||
.colVal = COL_VAL_NULL(pTSchema->columns[slotId].colId, pTSchema->columns[slotId].type)};
|
||||
if (!taosArrayPush(pColArray, &col)) {
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_RETURN(terrno);
|
||||
}
|
||||
}
|
||||
*ppColArray = pColArray;
|
||||
|
@ -3044,7 +3044,7 @@ static int32_t cloneTSchema(STSchema *pSrc, STSchema **ppDst) {
|
|||
int32_t len = sizeof(STSchema) + sizeof(STColumn) * pSrc->numOfCols;
|
||||
*ppDst = taosMemoryMalloc(len);
|
||||
if (NULL == *ppDst) {
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_RETURN(terrno);
|
||||
}
|
||||
memcpy(*ppDst, pSrc, len);
|
||||
|
||||
|
@ -3083,14 +3083,14 @@ static int32_t mergeLastCid(tb_uid_t uid, STsdb *pTsdb, SArray **ppLastArray, SC
|
|||
if (NULL == aColArray) {
|
||||
taosArrayDestroy(pColArray);
|
||||
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_RETURN(terrno);
|
||||
}
|
||||
|
||||
for (int i = 0; i < nCols; ++i) {
|
||||
if (!taosArrayPush(aColArray, &aCols[i])) {
|
||||
taosArrayDestroy(pColArray);
|
||||
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_RETURN(terrno);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3260,14 +3260,14 @@ static int32_t mergeLastRowCid(tb_uid_t uid, STsdb *pTsdb, SArray **ppLastArray,
|
|||
if (NULL == aColArray) {
|
||||
taosArrayDestroy(pColArray);
|
||||
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_RETURN(terrno);
|
||||
}
|
||||
|
||||
for (int i = 0; i < nCols; ++i) {
|
||||
if (!taosArrayPush(aColArray, &aCols[i])) {
|
||||
taosArrayDestroy(pColArray);
|
||||
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_RETURN(terrno);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3496,7 +3496,7 @@ int32_t tsdbCacheSetPageS3(SLRUCache *pCache, STsdbFD *pFD, int64_t pgno, uint8_
|
|||
_taos_lru_deleter_t deleter = deleteBCache;
|
||||
uint8_t *pPg = taosMemoryMalloc(charge);
|
||||
if (!pPg) {
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_RETURN(terrno);
|
||||
}
|
||||
memcpy(pPg, pPage, charge);
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ static int32_t saveOneRow(SArray* pRow, SSDataBlock* pBlock, SCacheRowsReader* p
|
|||
|
||||
SArray* funcTypeBlockArray = taosArrayInit(pReader->numOfCols, sizeof(int32_t));
|
||||
if (funcTypeBlockArray == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
for (int32_t i = 0; i < pReader->numOfCols; ++i) {
|
||||
|
@ -98,7 +98,7 @@ static int32_t saveOneRow(SArray* pRow, SSDataBlock* pBlock, SCacheRowsReader* p
|
|||
|
||||
void* px = taosArrayInsert(funcTypeBlockArray, dstSlotIds[i], pVal);
|
||||
if (px == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -282,7 +282,7 @@ int32_t tsdbReuseCacherowsReader(void* reader, void* pTableIdList, int32_t numOf
|
|||
destroySttBlockReader(pReader->pLDataIterArray, NULL);
|
||||
pReader->pLDataIterArray = taosArrayInit(4, POINTER_BYTES);
|
||||
|
||||
return (pReader->pLDataIterArray != NULL) ? TSDB_CODE_SUCCESS : TSDB_CODE_OUT_OF_MEMORY;
|
||||
return (pReader->pLDataIterArray != NULL) ? TSDB_CODE_SUCCESS : terrno;
|
||||
}
|
||||
|
||||
int32_t tsdbCacherowsReaderOpen(void* pVnode, int32_t type, void* pTableIdList, int32_t numOfTables, int32_t numOfCols,
|
||||
|
@ -343,7 +343,7 @@ int32_t tsdbCacherowsReaderOpen(void* pVnode, int32_t type, void* pTableIdList,
|
|||
p->transferBuf[i] = taosMemoryMalloc(p->pSchema->columns[i].bytes);
|
||||
if (p->transferBuf[i] == NULL) {
|
||||
tsdbCacherowsReaderClose(p);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -456,7 +456,7 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32
|
|||
pr->pReadSnap = NULL;
|
||||
pRow = taosArrayInit(TARRAY_SIZE(pr->pCidList), sizeof(SLastCol));
|
||||
if (pRow == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _end;
|
||||
}
|
||||
|
||||
|
@ -494,7 +494,7 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32
|
|||
if (HASTYPE(pr->type, CACHESCAN_RETRIEVE_TYPE_SINGLE)) {
|
||||
SArray* pLastCols = taosArrayInit(pr->numOfCols, sizeof(SLastCol));
|
||||
if (pLastCols == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _end;
|
||||
}
|
||||
|
||||
|
@ -504,7 +504,7 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32
|
|||
SLastCol p = {.rowKey.ts = INT64_MIN, .colVal.value.type = TSDB_DATA_TYPE_BOOL, .colVal.flag = CV_FLAG_NULL};
|
||||
void* px = taosArrayPush(pLastCols, &p);
|
||||
if (px == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _end;
|
||||
}
|
||||
continue;
|
||||
|
@ -537,7 +537,7 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32
|
|||
|
||||
void* px = taosArrayPush(pLastCols, &p);
|
||||
if (px == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _end;
|
||||
}
|
||||
}
|
||||
|
@ -600,7 +600,7 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32
|
|||
if (TARRAY_SIZE(pTableUidList) == 0) {
|
||||
void* px = taosArrayPush(pTableUidList, &uid);
|
||||
if (px == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _end;
|
||||
}
|
||||
} else {
|
||||
|
@ -676,7 +676,7 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32
|
|||
|
||||
void* px = taosArrayPush(pTableUidList, &uid);
|
||||
if (px == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _end;
|
||||
}
|
||||
|
||||
|
|
|
@ -439,7 +439,7 @@ static int32_t tsdbCommitInfoInit(STsdb *pTsdb) {
|
|||
|
||||
pTsdb->commitInfo->arr = taosArrayInit(0, sizeof(SFileSetCommitInfo *));
|
||||
if (pTsdb->commitInfo->arr == NULL) {
|
||||
TSDB_CHECK_CODE(code = TSDB_CODE_OUT_OF_MEMORY, lino, _exit);
|
||||
TSDB_CHECK_CODE(code = terrno, lino, _exit);
|
||||
}
|
||||
|
||||
_exit:
|
||||
|
@ -457,7 +457,7 @@ static int32_t tsdbCommitInfoAdd(STsdb *tsdb, int32_t fid) {
|
|||
SFileSetCommitInfo *tinfo;
|
||||
|
||||
if ((tinfo = taosMemoryMalloc(sizeof(*tinfo))) == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit);
|
||||
TAOS_CHECK_GOTO(terrno, &lino, _exit);
|
||||
}
|
||||
tinfo->fid = fid;
|
||||
tinfo->fset = NULL;
|
||||
|
@ -465,7 +465,7 @@ static int32_t tsdbCommitInfoAdd(STsdb *tsdb, int32_t fid) {
|
|||
TAOS_CHECK_GOTO(vHashPut(tsdb->commitInfo->ht, tinfo), &lino, _exit);
|
||||
|
||||
if ((taosArrayPush(tsdb->commitInfo->arr, &tinfo)) == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit);
|
||||
TAOS_CHECK_GOTO(terrno, &lino, _exit);
|
||||
}
|
||||
taosArraySort(tsdb->commitInfo->arr, tFileSetCommitInfoPCompare);
|
||||
|
||||
|
|
|
@ -183,7 +183,7 @@ int32_t tsdbDataFileReadBrinBlk(SDataFileReader *reader, const TBrinBlkArray **b
|
|||
if (reader->headFooter->brinBlkPtr->size > 0) {
|
||||
data = taosMemoryMalloc(reader->headFooter->brinBlkPtr->size);
|
||||
if (data == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit);
|
||||
TAOS_CHECK_GOTO(terrno, &lino, _exit);
|
||||
}
|
||||
|
||||
int32_t encryptAlgorithm = reader->config->tsdb->pVnode->config.tsdbCfg.encryptAlgorithm;
|
||||
|
@ -557,7 +557,7 @@ int32_t tsdbDataFileReadTombBlk(SDataFileReader *reader, const TTombBlkArray **t
|
|||
|
||||
if (reader->tombFooter->tombBlkPtr->size > 0) {
|
||||
if ((data = taosMemoryMalloc(reader->tombFooter->tombBlkPtr->size)) == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit);
|
||||
TAOS_CHECK_GOTO(terrno, &lino, _exit);
|
||||
}
|
||||
|
||||
int32_t encryptAlgorithm = reader->config->tsdb->pVnode->config.tsdbCfg.encryptAlgorithm;
|
||||
|
|
|
@ -72,13 +72,13 @@ static int32_t tsdbBinaryToFS(uint8_t *pData, int64_t nData, STsdbFS *pFS) {
|
|||
|
||||
int32_t nt = tGetDFileSet(pData + n, &fSet);
|
||||
if (nt < 0) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _exit;
|
||||
}
|
||||
|
||||
n += nt;
|
||||
if (taosArrayPush(pFS->aDFileSet, &fSet) == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _exit;
|
||||
}
|
||||
}
|
||||
|
@ -102,7 +102,7 @@ static int32_t tsdbSaveFSToFile(STsdbFS *pFS, const char *fname) {
|
|||
int32_t size = tsdbFSToBinary(NULL, pFS) + sizeof(TSCKSUM);
|
||||
pData = taosMemoryMalloc(size);
|
||||
if (pData == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
}
|
||||
int32_t tsize = tsdbFSToBinary(pData, pFS);
|
||||
|
@ -140,7 +140,7 @@ int32_t tsdbFSCreate(STsdbFS *pFS) {
|
|||
pFS->pDelFile = NULL;
|
||||
pFS->aDFileSet = taosArrayInit(0, sizeof(SDFileSet));
|
||||
if (pFS->aDFileSet == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _exit;
|
||||
}
|
||||
|
||||
|
@ -306,7 +306,7 @@ static int32_t load_fs(const char *fname, STsdbFS *pFS) {
|
|||
|
||||
pData = taosMemoryMalloc(size);
|
||||
if (pData == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
(void)taosCloseFile(&pFD);
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
}
|
||||
|
@ -386,7 +386,7 @@ static int32_t tsdbNewFileSet(STsdb *pTsdb, SDFileSet *pSetTo, SDFileSet *pSetFr
|
|||
// head
|
||||
pSetTo->pHeadF = (SHeadFile *)taosMemoryMalloc(sizeof(SHeadFile));
|
||||
if (pSetTo->pHeadF == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
}
|
||||
*pSetTo->pHeadF = *pSetFrom->pHeadF;
|
||||
|
@ -395,7 +395,7 @@ static int32_t tsdbNewFileSet(STsdb *pTsdb, SDFileSet *pSetTo, SDFileSet *pSetFr
|
|||
// data
|
||||
pSetTo->pDataF = (SDataFile *)taosMemoryMalloc(sizeof(SDataFile));
|
||||
if (pSetTo->pDataF == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
}
|
||||
*pSetTo->pDataF = *pSetFrom->pDataF;
|
||||
|
@ -404,7 +404,7 @@ static int32_t tsdbNewFileSet(STsdb *pTsdb, SDFileSet *pSetTo, SDFileSet *pSetFr
|
|||
// sma
|
||||
pSetTo->pSmaF = (SSmaFile *)taosMemoryMalloc(sizeof(SSmaFile));
|
||||
if (pSetTo->pSmaF == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
}
|
||||
*pSetTo->pSmaF = *pSetFrom->pSmaF;
|
||||
|
@ -414,7 +414,7 @@ static int32_t tsdbNewFileSet(STsdb *pTsdb, SDFileSet *pSetTo, SDFileSet *pSetFr
|
|||
for (int32_t iStt = 0; iStt < pSetFrom->nSttF; iStt++) {
|
||||
pSetTo->aSttF[iStt] = (SSttFile *)taosMemoryMalloc(sizeof(SSttFile));
|
||||
if (pSetTo->aSttF[iStt] == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
}
|
||||
|
||||
|
@ -442,7 +442,7 @@ static int32_t tsdbMergeFileSet(STsdb *pTsdb, SDFileSet *pSetOld, SDFileSet *pSe
|
|||
if ((!sameDisk) || (pHeadF->commitID != pSetNew->pHeadF->commitID)) {
|
||||
pSetOld->pHeadF = (SHeadFile *)taosMemoryMalloc(sizeof(SHeadFile));
|
||||
if (pSetOld->pHeadF == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
}
|
||||
*pSetOld->pHeadF = *pSetNew->pHeadF;
|
||||
|
@ -465,7 +465,7 @@ static int32_t tsdbMergeFileSet(STsdb *pTsdb, SDFileSet *pSetOld, SDFileSet *pSe
|
|||
if ((!sameDisk) || (pDataF->commitID != pSetNew->pDataF->commitID)) {
|
||||
pSetOld->pDataF = (SDataFile *)taosMemoryMalloc(sizeof(SDataFile));
|
||||
if (pSetOld->pDataF == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
}
|
||||
*pSetOld->pDataF = *pSetNew->pDataF;
|
||||
|
@ -486,7 +486,7 @@ static int32_t tsdbMergeFileSet(STsdb *pTsdb, SDFileSet *pSetOld, SDFileSet *pSe
|
|||
if ((!sameDisk) || (pSmaF->commitID != pSetNew->pSmaF->commitID)) {
|
||||
pSetOld->pSmaF = (SSmaFile *)taosMemoryMalloc(sizeof(SSmaFile));
|
||||
if (pSetOld->pSmaF == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
}
|
||||
*pSetOld->pSmaF = *pSetNew->pSmaF;
|
||||
|
@ -507,7 +507,7 @@ static int32_t tsdbMergeFileSet(STsdb *pTsdb, SDFileSet *pSetOld, SDFileSet *pSe
|
|||
if (pSetNew->nSttF > pSetOld->nSttF) {
|
||||
pSetOld->aSttF[pSetOld->nSttF] = (SSttFile *)taosMemoryMalloc(sizeof(SSttFile));
|
||||
if (pSetOld->aSttF[pSetOld->nSttF] == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
}
|
||||
*pSetOld->aSttF[pSetOld->nSttF] = *pSetNew->aSttF[pSetOld->nSttF];
|
||||
|
@ -528,7 +528,7 @@ static int32_t tsdbMergeFileSet(STsdb *pTsdb, SDFileSet *pSetOld, SDFileSet *pSe
|
|||
pSetOld->nSttF = 1;
|
||||
pSetOld->aSttF[0] = (SSttFile *)taosMemoryMalloc(sizeof(SSttFile));
|
||||
if (pSetOld->aSttF[0] == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
}
|
||||
*pSetOld->aSttF[0] = *pSetNew->aSttF[0];
|
||||
|
@ -546,7 +546,7 @@ static int32_t tsdbMergeFileSet(STsdb *pTsdb, SDFileSet *pSetOld, SDFileSet *pSe
|
|||
|
||||
pSetOld->aSttF[iStt] = (SSttFile *)taosMemoryMalloc(sizeof(SSttFile));
|
||||
if (pSetOld->aSttF[iStt] == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
}
|
||||
*pSetOld->aSttF[iStt] = *pSetNew->aSttF[iStt];
|
||||
|
@ -574,7 +574,7 @@ static int32_t tsdbMergeFileSet(STsdb *pTsdb, SDFileSet *pSetOld, SDFileSet *pSe
|
|||
for (int32_t iStt = 0; iStt < pSetNew->nSttF; iStt++) {
|
||||
pSetOld->aSttF[iStt] = (SSttFile *)taosMemoryMalloc(sizeof(SSttFile));
|
||||
if (pSetOld->aSttF[iStt] == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
}
|
||||
|
||||
|
@ -610,7 +610,7 @@ static int32_t tsdbFSApplyChange(STsdb *pTsdb, STsdbFS *pFS) {
|
|||
if (pDelFile == NULL || (pDelFile->commitID != pFS->pDelFile->commitID)) {
|
||||
pTsdb->fs.pDelFile = (SDelFile *)taosMemoryMalloc(sizeof(SDelFile));
|
||||
if (pTsdb->fs.pDelFile == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
}
|
||||
|
||||
|
@ -668,7 +668,7 @@ static int32_t tsdbFSApplyChange(STsdb *pTsdb, STsdbFS *pFS) {
|
|||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
|
||||
if (taosArrayInsert(pTsdb->fs.aDFileSet, iOld, &fSet) == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
}
|
||||
|
||||
|
@ -684,7 +684,7 @@ static int32_t tsdbFSApplyChange(STsdb *pTsdb, STsdbFS *pFS) {
|
|||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
|
||||
if (taosArrayInsert(pTsdb->fs.aDFileSet, iOld, &fSet) == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
}
|
||||
|
||||
|
|
|
@ -122,7 +122,7 @@ static int32_t load_json(const char *fname, cJSON **json) {
|
|||
|
||||
data = taosMemoryMalloc(size + 1);
|
||||
if (data == NULL) {
|
||||
TSDB_CHECK_CODE(code = TSDB_CODE_OUT_OF_MEMORY, lino, _exit);
|
||||
TSDB_CHECK_CODE(code = terrno, lino, _exit);
|
||||
}
|
||||
|
||||
if (taosReadFile(fp, data, size) < 0) {
|
||||
|
@ -387,7 +387,7 @@ static void tsdbFSDestroyFileObjHash(STFileHash *hash);
|
|||
|
||||
static int32_t tsdbFSAddEntryToFileObjHash(STFileHash *hash, const char *fname) {
|
||||
STFileHashEntry *entry = taosMemoryMalloc(sizeof(*entry));
|
||||
if (entry == NULL) return TSDB_CODE_OUT_OF_MEMORY;
|
||||
if (entry == NULL) return terrno;
|
||||
|
||||
strncpy(entry->fname, fname, TSDB_FILENAME_LEN);
|
||||
|
||||
|
@ -752,7 +752,7 @@ int32_t tsdbDisableAndCancelAllBgTask(STsdb *pTsdb) {
|
|||
STFileSystem *fs = pTsdb->pFS;
|
||||
SArray *channelArray = taosArrayInit(0, sizeof(SVAChannelID));
|
||||
if (channelArray == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
(void)taosThreadMutexLock(&pTsdb->mutex);
|
||||
|
@ -913,7 +913,7 @@ int32_t tsdbFSEditCommit(STFileSystem *fs) {
|
|||
|
||||
SMergeArg *arg = taosMemoryMalloc(sizeof(*arg));
|
||||
if (arg == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
}
|
||||
|
||||
|
@ -962,7 +962,7 @@ int32_t tsdbFSCreateCopySnapshot(STFileSystem *fs, TFileSetArray **fsetArr) {
|
|||
STFileSet *fset1;
|
||||
|
||||
fsetArr[0] = taosMemoryMalloc(sizeof(TFileSetArray));
|
||||
if (fsetArr[0] == NULL) return TSDB_CODE_OUT_OF_MEMORY;
|
||||
if (fsetArr[0] == NULL) return terrno;
|
||||
|
||||
TARRAY2_INIT(fsetArr[0]);
|
||||
|
||||
|
@ -1058,7 +1058,7 @@ int32_t tsdbFSCreateCopyRangedSnapshot(STFileSystem *fs, TFileSetRangeArray *pRa
|
|||
SHashObj *pHash = NULL;
|
||||
|
||||
fsetArr[0] = taosMemoryMalloc(sizeof(TFileSetArray));
|
||||
if (fsetArr == NULL) return TSDB_CODE_OUT_OF_MEMORY;
|
||||
if (fsetArr == NULL) return terrno;
|
||||
TARRAY2_INIT(fsetArr[0]);
|
||||
|
||||
if (pRanges) {
|
||||
|
|
|
@ -388,7 +388,7 @@ int32_t resetDataBlockIterator(SDataBlockIter* pIter, int32_t order, bool needFr
|
|||
if (pIter->blockList == NULL) {
|
||||
pIter->blockList = taosArrayInit(4, sizeof(SFileDataBlockInfo));
|
||||
if (pIter->blockList == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
} else {
|
||||
clearDataBlockIterator(pIter, needFree);
|
||||
|
@ -691,7 +691,7 @@ static int32_t doLoadBlockIndex(STsdbReader* pReader, SDataFileReader* pFileRead
|
|||
|
||||
void* p1 = taosArrayPush(pIndexList, pBrinBlk);
|
||||
if (p1 == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
i += 1;
|
||||
|
@ -815,7 +815,7 @@ static int32_t loadFileBlockBrinInfo(STsdbReader* pReader, SArray* pIndexList, S
|
|||
pScanInfo->pBlockList = taosArrayInit(4, sizeof(SFileDataBlockInfo));
|
||||
if (pScanInfo->pBlockList == NULL) {
|
||||
clearBrinBlockIter(&iter);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -823,7 +823,7 @@ static int32_t loadFileBlockBrinInfo(STsdbReader* pReader, SArray* pIndexList, S
|
|||
pScanInfo->pBlockIdxList = taosArrayInit(4, sizeof(STableDataBlockIdx));
|
||||
if (pScanInfo->pBlockIdxList == NULL) {
|
||||
clearBrinBlockIter(&iter);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -836,7 +836,7 @@ static int32_t loadFileBlockBrinInfo(STsdbReader* pReader, SArray* pIndexList, S
|
|||
void* p1 = taosArrayPush(pScanInfo->pBlockList, &blockInfo);
|
||||
if (p1 == NULL) {
|
||||
clearBrinBlockIter(&iter);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
// todo: refactor to record the fileset skey/ekey
|
||||
|
@ -865,7 +865,7 @@ static int32_t loadFileBlockBrinInfo(STsdbReader* pReader, SArray* pIndexList, S
|
|||
|
||||
if (p1 == NULL) {
|
||||
clearBrinBlockIter(&iter);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2908,7 +2908,7 @@ int32_t initDelSkylineIterator(STableBlockScanInfo* pBlockScanInfo, int32_t orde
|
|||
} else {
|
||||
pBlockScanInfo->delSkyline = taosArrayInit(4, sizeof(TSDBKEY));
|
||||
if (pBlockScanInfo->delSkyline == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3021,7 +3021,7 @@ static int32_t moveToNextFile(STsdbReader* pReader, SBlockNumber* pBlockNum, SAr
|
|||
size_t numOfTables = tSimpleHashGetSize(pReader->status.pTableMap);
|
||||
SArray* pIndexList = taosArrayInit(numOfTables, sizeof(SBrinBlk));
|
||||
if (pIndexList == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
while (1) {
|
||||
|
@ -3541,7 +3541,7 @@ static int32_t initForFirstBlockInFile(STsdbReader* pReader, SDataBlockIter* pBl
|
|||
SBlockNumber num = {0};
|
||||
SArray* pTableList = taosArrayInit(40, POINTER_BYTES);
|
||||
if (pTableList == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
int32_t code = moveToNextFile(pReader, &num, pTableList);
|
||||
|
@ -4935,7 +4935,7 @@ static int32_t doSuspendCurrentReader(STsdbReader* pCurrentReader) {
|
|||
destroySttBlockReader(pStatus->pLDataIterArray, &pCost->sttCost);
|
||||
pStatus->pLDataIterArray = taosArrayInit(4, POINTER_BYTES);
|
||||
if (pStatus->pLDataIterArray == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ static int32_t initBlockScanInfoBuf(SBlockInfoBuf* pBuf, int32_t numOfTables) {
|
|||
if (pBuf->pData == NULL) {
|
||||
pBuf->pData = taosArrayInit(num + 1, POINTER_BYTES);
|
||||
if (pBuf->pData == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ static int32_t initBlockScanInfoBuf(SBlockInfoBuf* pBuf, int32_t numOfTables) {
|
|||
|
||||
void* px = taosArrayPush(pBuf->pData, &p);
|
||||
if (px == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -54,7 +54,7 @@ static int32_t initBlockScanInfoBuf(SBlockInfoBuf* pBuf, int32_t numOfTables) {
|
|||
}
|
||||
void* px = taosArrayPush(pBuf->pData, &p);
|
||||
if (px == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -101,7 +101,7 @@ int32_t ensureBlockScanInfoBuf(SBlockInfoBuf* pBuf, int32_t numOfTables) {
|
|||
|
||||
void* px = taosArrayPush(pBuf->pData, &p);
|
||||
if (px == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -112,7 +112,7 @@ int32_t ensureBlockScanInfoBuf(SBlockInfoBuf* pBuf, int32_t numOfTables) {
|
|||
}
|
||||
void* px = taosArrayPush(pBuf->pData, &p);
|
||||
if (px == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -655,7 +655,7 @@ int32_t initBlockIterator(STsdbReader* pReader, SDataBlockIter* pBlockIter, int3
|
|||
char* buf = taosMemoryMalloc(sizeof(SBlockOrderWrapper) * num);
|
||||
if (buf == NULL) {
|
||||
cleanupBlockOrderSupporter(&sup);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
sup.pDataBlockInfo[sup.numOfTables] = (SBlockOrderWrapper*)buf;
|
||||
|
@ -686,7 +686,7 @@ int32_t initBlockIterator(STsdbReader* pReader, SDataBlockIter* pBlockIter, int3
|
|||
STableDataBlockIdx tableDataBlockIdx = {.globalIndex = i};
|
||||
void* px = taosArrayPush(pTableScanInfo->pBlockIdxList, &tableDataBlockIdx);
|
||||
if (px == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -730,7 +730,7 @@ int32_t initBlockIterator(STsdbReader* pReader, SDataBlockIter* pBlockIter, int3
|
|||
|
||||
void* px = taosArrayPush(pBlockIter->blockList, pBlockInfo);
|
||||
if (px == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
STableBlockScanInfo* pTableScanInfo = sup.pDataBlockInfo[pos][index].pInfo;
|
||||
|
@ -738,7 +738,7 @@ int32_t initBlockIterator(STsdbReader* pReader, SDataBlockIter* pBlockIter, int3
|
|||
|
||||
px = taosArrayPush(pTableScanInfo->pBlockIdxList, &tableDataBlockIdx);
|
||||
if (px == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
// set data block index overflow, in order to disable the offset comparator
|
||||
|
@ -862,7 +862,7 @@ static int32_t doCheckTombBlock(STombBlock* pBlock, STsdbReader* pReader, int32_
|
|||
SDelData delData = {.version = record.version, .sKey = record.skey, .eKey = record.ekey};
|
||||
void* px = taosArrayPush(pScanInfo->pFileDelData, &delData);
|
||||
if (px == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1122,7 +1122,7 @@ int32_t doAdjustValidDataIters(SArray* pLDIterList, int32_t numOfFileObj) {
|
|||
void* px = taosArrayPush(pLDIterList, &pIter);
|
||||
if (px == NULL) {
|
||||
taosMemoryFree(pIter);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
} else if (size > numOfFileObj) { // remove unused LDataIter
|
||||
|
@ -1149,7 +1149,7 @@ int32_t adjustSttDataIters(SArray* pSttFileBlockIterArray, STFileSet* pFileSet)
|
|||
}
|
||||
void* px = taosArrayPush(pSttFileBlockIterArray, &pList);
|
||||
if (px == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -691,7 +691,7 @@ int32_t tsdbReadBlockIdx(SDataFReader *pReader, SArray *aBlockIdx) {
|
|||
n += tGetBlockIdx(pReader->aBuf[0] + n, &blockIdx);
|
||||
|
||||
if (taosArrayPush(aBlockIdx, &blockIdx) == NULL) {
|
||||
TSDB_CHECK_CODE(code = TSDB_CODE_OUT_OF_MEMORY, lino, _exit);
|
||||
TSDB_CHECK_CODE(code = terrno, lino, _exit);
|
||||
}
|
||||
}
|
||||
if (n != size) {
|
||||
|
@ -734,7 +734,7 @@ int32_t tsdbReadSttBlk(SDataFReader *pReader, int32_t iStt, SArray *aSttBlk) {
|
|||
n += tGetSttBlk(pReader->aBuf[0] + n, &sttBlk);
|
||||
|
||||
if (taosArrayPush(aSttBlk, &sttBlk) == NULL) {
|
||||
TSDB_CHECK_CODE(code = TSDB_CODE_OUT_OF_MEMORY, lino, _exit);
|
||||
TSDB_CHECK_CODE(code = terrno, lino, _exit);
|
||||
}
|
||||
}
|
||||
if (n != size) {
|
||||
|
@ -866,7 +866,7 @@ int32_t tsdbReadDelDatav1(SDelFReader *pReader, SDelIdx *pDelIdx, SArray *aDelDa
|
|||
continue;
|
||||
}
|
||||
if (taosArrayPush(aDelData, &delData) == NULL) {
|
||||
TSDB_CHECK_CODE(code = TSDB_CODE_OUT_OF_MEMORY, lino, _exit);
|
||||
TSDB_CHECK_CODE(code = terrno, lino, _exit);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -908,7 +908,7 @@ int32_t tsdbReadDelIdx(SDelFReader *pReader, SArray *aDelIdx) {
|
|||
n += tGetDelIdx(pReader->aBuf[0] + n, &delIdx);
|
||||
|
||||
if (taosArrayPush(aDelIdx, &delIdx) == NULL) {
|
||||
TSDB_CHECK_CODE(code = TSDB_CODE_OUT_OF_MEMORY, lino, _exit);
|
||||
TSDB_CHECK_CODE(code = terrno, lino, _exit);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -364,7 +364,7 @@ static int32_t tsdbAsyncRetentionImpl(STsdb *tsdb, int64_t now, bool s3Migrate)
|
|||
|
||||
SRtnArg *arg = taosMemoryMalloc(sizeof(*arg));
|
||||
if (arg == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit);
|
||||
TAOS_CHECK_GOTO(terrno, &lino, _exit);
|
||||
}
|
||||
|
||||
arg->tsdb = tsdb;
|
||||
|
|
|
@ -244,7 +244,7 @@ static int32_t tsdbSnapCmprData(STsdbSnapReader* reader, uint8_t** data) {
|
|||
}
|
||||
*data = taosMemoryMalloc(sizeof(SSnapDataHdr) + size);
|
||||
if (*data == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
}
|
||||
|
||||
|
@ -347,7 +347,7 @@ static int32_t tsdbSnapCmprTombData(STsdbSnapReader* reader, uint8_t** data) {
|
|||
|
||||
data[0] = taosMemoryMalloc(size + sizeof(SSnapDataHdr));
|
||||
if (data[0] == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
}
|
||||
|
||||
|
|
|
@ -123,7 +123,7 @@ int32_t tsdbSttFileReadStatisBlk(SSttFileReader *reader, const TStatisBlkArray *
|
|||
int32_t size = reader->footer->statisBlkPtr->size / sizeof(SStatisBlk);
|
||||
void *data = taosMemoryMalloc(reader->footer->statisBlkPtr->size);
|
||||
if (!data) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
int32_t encryptAlgorithm = reader->config->tsdb->pVnode->config.tsdbCfg.encryptAlgorithm;
|
||||
|
@ -157,7 +157,7 @@ int32_t tsdbSttFileReadTombBlk(SSttFileReader *reader, const TTombBlkArray **tom
|
|||
int32_t size = reader->footer->tombBlkPtr->size / sizeof(STombBlk);
|
||||
void *data = taosMemoryMalloc(reader->footer->tombBlkPtr->size);
|
||||
if (!data) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
int32_t encryptAlgorithm = reader->config->tsdb->pVnode->config.tsdbCfg.encryptAlgorithm;
|
||||
|
@ -191,7 +191,7 @@ int32_t tsdbSttFileReadSttBlk(SSttFileReader *reader, const TSttBlkArray **sttBl
|
|||
int32_t size = reader->footer->sttBlkPtr->size / sizeof(SSttBlk);
|
||||
void *data = taosMemoryMalloc(reader->footer->sttBlkPtr->size);
|
||||
if (!data) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
int32_t encryptAlgorithm = reader->config->tsdb->pVnode->config.tsdbCfg.encryptAlgorithm;
|
||||
|
|
|
@ -56,7 +56,7 @@ static int32_t tsdbUpgradeHead(STsdb *tsdb, SDFileSet *pDFileSet, SDataFReader *
|
|||
|
||||
// read SBlockIdx array
|
||||
if ((ctx->aBlockIdx = taosArrayInit(0, sizeof(SBlockIdx))) == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit);
|
||||
TAOS_CHECK_GOTO(terrno, &lino, _exit);
|
||||
}
|
||||
|
||||
TAOS_CHECK_GOTO(tsdbReadBlockIdx(reader, ctx->aBlockIdx), &lino, _exit);
|
||||
|
@ -236,7 +236,7 @@ static int32_t tsdbUpgradeSttFile(STsdb *tsdb, SDFileSet *pDFileSet, SDataFReade
|
|||
|
||||
SArray *aSttBlk = taosArrayInit(0, sizeof(SSttBlk));
|
||||
if (aSttBlk == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit);
|
||||
TAOS_CHECK_GOTO(terrno, &lino, _exit);
|
||||
}
|
||||
|
||||
TAOS_CHECK_GOTO(tsdbReadSttBlk(reader, iStt, aSttBlk), &lino, _exit);
|
||||
|
@ -460,7 +460,7 @@ static int32_t tsdbDumpTombDataToFSet(STsdb *tsdb, SDelFReader *reader, SArray *
|
|||
tsdbFidKeyRange(fset->fid, tsdb->keepCfg.days, tsdb->keepCfg.precision, &ctx->minKey, &ctx->maxKey);
|
||||
|
||||
if ((ctx->aDelData = taosArrayInit(0, sizeof(SDelData))) == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit);
|
||||
TAOS_CHECK_GOTO(terrno, &lino, _exit);
|
||||
}
|
||||
|
||||
for (int32_t iDelIdx = 0; iDelIdx < taosArrayGetSize(aDelIdx); iDelIdx++) {
|
||||
|
@ -550,7 +550,7 @@ static int32_t tsdbUpgradeTombFile(STsdb *tsdb, SDelFile *pDelFile, TFileSetArra
|
|||
SArray *aDelIdx = NULL;
|
||||
|
||||
if ((aDelIdx = taosArrayInit(0, sizeof(SDelIdx))) == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit);
|
||||
TAOS_CHECK_GOTO(terrno, &lino, _exit);
|
||||
}
|
||||
|
||||
TAOS_CHECK_GOTO(tsdbDelFReaderOpen(&reader, pDelFile, tsdb), &lino, _exit);
|
||||
|
|
|
@ -116,7 +116,7 @@ int32_t tMapDataToArray(SMapData *pMapData, int32_t itemSize, int32_t (*tGetItem
|
|||
|
||||
SArray *pArray = taosArrayInit(pMapData->nItem, itemSize);
|
||||
if (pArray == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _exit;
|
||||
}
|
||||
|
||||
|
|
|
@ -679,7 +679,7 @@ int32_t vnodeAChannelInit(int64_t asyncID, SVAChannelID *channelID) {
|
|||
// create channel object
|
||||
SVAChannel *channel = (SVAChannel *)taosMemoryMalloc(sizeof(SVAChannel));
|
||||
if (channel == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
channel->state = EVA_CHANNEL_STATE_OPEN;
|
||||
for (int32_t i = 0; i < EVA_PRIORITY_MAX; i++) {
|
||||
|
@ -727,7 +727,7 @@ int32_t vnodeAChannelDestroy(SVAChannelID *channelID, bool waitRunning) {
|
|||
};
|
||||
SArray *cancelArray = taosArrayInit(0, sizeof(SVATaskCancelInfo));
|
||||
if (cancelArray == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
(void)taosThreadMutexLock(&async->mutex);
|
||||
|
|
|
@ -21,7 +21,7 @@ static int32_t vnodeBufPoolCreate(SVnode *pVnode, int32_t id, int64_t size, SVBu
|
|||
|
||||
pPool = taosMemoryMalloc(sizeof(SVBufPool) + size);
|
||||
if (pPool == NULL) {
|
||||
return terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
memset(pPool, 0, sizeof(SVBufPool));
|
||||
|
||||
|
@ -43,7 +43,7 @@ static int32_t vnodeBufPoolCreate(SVnode *pVnode, int32_t id, int64_t size, SVBu
|
|||
pPool->lock = taosMemoryMalloc(sizeof(TdThreadSpinlock));
|
||||
if (!pPool->lock) {
|
||||
taosMemoryFree(pPool);
|
||||
return terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
if (taosThreadSpinInit(pPool->lock, 0) != 0) {
|
||||
taosMemoryFree((void *)pPool->lock);
|
||||
|
|
|
@ -125,7 +125,7 @@ int vnodeEncodeConfig(const void *pObj, SJson *pJson) {
|
|||
}
|
||||
SJson *pNodeRetentions = tjsonCreateArray();
|
||||
if (pNodeRetentions == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
TAOS_CHECK_RETURN(tjsonAddItemToObject(pJson, "retentions", pNodeRetentions));
|
||||
for (int32_t i = 0; i < nRetention; ++i) {
|
||||
|
@ -167,7 +167,7 @@ int vnodeEncodeConfig(const void *pObj, SJson *pJson) {
|
|||
|
||||
SJson *nodeInfo = tjsonCreateArray();
|
||||
if (nodeInfo == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
TAOS_CHECK_RETURN(tjsonAddItemToObject(pJson, "syncCfg.nodeInfo", nodeInfo));
|
||||
vDebug("vgId:%d, encode config, replicas:%d totalReplicas:%d selfIndex:%d changeVersion:%d", pCfg->vgId,
|
||||
|
@ -175,7 +175,7 @@ int vnodeEncodeConfig(const void *pObj, SJson *pJson) {
|
|||
for (int i = 0; i < pCfg->syncCfg.totalReplicaNum; ++i) {
|
||||
SJson *info = tjsonCreateObject();
|
||||
if (info == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
SNodeInfo *pNode = (SNodeInfo *)&pCfg->syncCfg.nodeInfo[i];
|
||||
|
|
|
@ -241,7 +241,7 @@ int vnodeLoadInfo(const char *dir, SVnodeInfo *pInfo) {
|
|||
|
||||
pData = taosMemoryMalloc(size + 1);
|
||||
if (pData == NULL) {
|
||||
TSDB_CHECK_CODE(code = TSDB_CODE_OUT_OF_MEMORY, lino, _exit);
|
||||
TSDB_CHECK_CODE(code = terrno, lino, _exit);
|
||||
}
|
||||
|
||||
if (taosReadFile(pFile, pData, size) < 0) {
|
||||
|
|
|
@ -55,7 +55,7 @@ int32_t vHashInit(SVHashTable** ht, uint32_t (*hash)(const void*), int32_t (*com
|
|||
|
||||
(*ht) = (SVHashTable*)taosMemoryMalloc(sizeof(SVHashTable));
|
||||
if (*ht == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
(*ht)->hash = hash;
|
||||
|
@ -102,7 +102,7 @@ int32_t vHashPut(SVHashTable* ht, void* obj) {
|
|||
|
||||
SVHashEntry* entry = (SVHashEntry*)taosMemoryMalloc(sizeof(SVHashEntry));
|
||||
if (entry == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
entry->obj = obj;
|
||||
entry->next = ht->buckets[bucketIndex];
|
||||
|
|
|
@ -248,7 +248,7 @@ int32_t vnodeGetTableCfg(SVnode *pVnode, SRpcMsg *pMsg, bool direct) {
|
|||
cfgRsp.tagsLen = pTag->len;
|
||||
cfgRsp.pTags = taosMemoryMalloc(cfgRsp.tagsLen);
|
||||
if (NULL == cfgRsp.pTags) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _exit;
|
||||
}
|
||||
(void)memcpy(cfgRsp.pTags, pTag, cfgRsp.tagsLen);
|
||||
|
@ -274,7 +274,7 @@ int32_t vnodeGetTableCfg(SVnode *pVnode, SRpcMsg *pMsg, bool direct) {
|
|||
cfgRsp.pSchemaExt = (SSchemaExt *)taosMemoryMalloc(cfgRsp.numOfColumns * sizeof(SSchemaExt));
|
||||
|
||||
if (NULL == cfgRsp.pSchemas || NULL == cfgRsp.pSchemaExt) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _exit;
|
||||
}
|
||||
(void)memcpy(cfgRsp.pSchemas, schema.pSchema, sizeof(SSchema) * schema.nCols);
|
||||
|
@ -377,7 +377,7 @@ int32_t vnodeGetBatchMeta(SVnode *pVnode, SRpcMsg *pMsg) {
|
|||
|
||||
batchRsp.pRsps = taosArrayInit(msgNum, sizeof(SBatchRspMsg));
|
||||
if (NULL == batchRsp.pRsps) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
qError("taosArrayInit %d SBatchRspMsg failed", msgNum);
|
||||
goto _exit;
|
||||
}
|
||||
|
@ -428,7 +428,7 @@ int32_t vnodeGetBatchMeta(SVnode *pVnode, SRpcMsg *pMsg) {
|
|||
|
||||
if (NULL == taosArrayPush(batchRsp.pRsps, &rsp)) {
|
||||
qError("taosArrayPush failed");
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _exit;
|
||||
}
|
||||
}
|
||||
|
@ -566,7 +566,7 @@ int32_t vnodeGetAllTableList(SVnode *pVnode, uint64_t uid, SArray *list) {
|
|||
STableKeyInfo info = {uid = id};
|
||||
if (NULL == taosArrayPush(list, &info)) {
|
||||
qError("taosArrayPush failed");
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _exit;
|
||||
}
|
||||
}
|
||||
|
@ -596,7 +596,7 @@ int32_t vnodeGetCtbIdList(void *pVnode, int64_t suid, SArray *list) {
|
|||
|
||||
if (NULL == taosArrayPush(list, &id)) {
|
||||
qError("taosArrayPush failed");
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _exit;
|
||||
}
|
||||
}
|
||||
|
@ -621,7 +621,7 @@ int32_t vnodeGetStbIdList(SVnode *pVnode, int64_t suid, SArray *list) {
|
|||
|
||||
if (NULL == taosArrayPush(list, &id)) {
|
||||
qError("taosArrayPush failed");
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _exit;
|
||||
}
|
||||
}
|
||||
|
@ -651,7 +651,7 @@ int32_t vnodeGetStbIdListByFilter(SVnode *pVnode, int64_t suid, SArray *list, bo
|
|||
|
||||
if (NULL == taosArrayPush(list, &id)) {
|
||||
qError("taosArrayPush failed");
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _exit;
|
||||
}
|
||||
}
|
||||
|
@ -766,7 +766,7 @@ int32_t vnodeGetTimeSeriesNum(SVnode *pVnode, int64_t *num) {
|
|||
SArray *suidList = NULL;
|
||||
|
||||
if (!(suidList = taosArrayInit(1, sizeof(tb_uid_t)))) {
|
||||
return terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
int32_t tbFilterSize = 0;
|
||||
|
|
|
@ -281,7 +281,7 @@ int32_t vnodeSnapRead(SVSnapReader *pReader, uint8_t **ppData, uint32_t *nData)
|
|||
*ppData = taosMemoryMalloc(sizeof(SSnapDataHdr) + size + 1);
|
||||
if (*ppData == NULL) {
|
||||
(void)taosCloseFile(&pFile);
|
||||
TSDB_CHECK_CODE(code = TSDB_CODE_OUT_OF_MEMORY, lino, _exit);
|
||||
TSDB_CHECK_CODE(code = terrno, lino, _exit);
|
||||
}
|
||||
((SSnapDataHdr *)(*ppData))->type = SNAP_DATA_CFG;
|
||||
((SSnapDataHdr *)(*ppData))->size = size + 1;
|
||||
|
|
|
@ -180,7 +180,7 @@ static int32_t vnodePreProcessDropTtlMsg(SVnode *pVnode, SRpcMsg *pMsg) {
|
|||
{ // find expired uids
|
||||
tbUids = taosArrayInit(8, sizeof(tb_uid_t));
|
||||
if (tbUids == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
}
|
||||
|
||||
|
@ -206,7 +206,7 @@ static int32_t vnodePreProcessDropTtlMsg(SVnode *pVnode, SRpcMsg *pMsg) {
|
|||
|
||||
SMsgHead *pContNew = rpcMallocCont(contLenNew);
|
||||
if (pContNew == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
}
|
||||
|
||||
|
@ -1535,7 +1535,7 @@ static int32_t vnodeResetTableCxt(SMeta *pMeta, SSubmitReqConvertCxt *pCxt) {
|
|||
pCxt->pTbData->pCreateTbReq = NULL;
|
||||
pCxt->pTbData->aRowP = taosArrayInit(128, POINTER_BYTES);
|
||||
if (NULL == pCxt->pTbData->aRowP) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
taosArrayDestroy(pCxt->pColValues);
|
||||
|
@ -1622,7 +1622,7 @@ static int32_t vnodeDecodeCreateTbReq(SSubmitReqConvertCxt *pCxt) {
|
|||
static int32_t vnodeSubmitReqConvertToSubmitReq2(SVnode *pVnode, SSubmitReq *pReq, SSubmitReq2 *pReq2) {
|
||||
pReq2->aSubmitTbData = taosArrayInit(128, sizeof(SSubmitTbData));
|
||||
if (NULL == pReq2->aSubmitTbData) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
SSubmitReqConvertCxt cxt = {0};
|
||||
|
@ -1650,7 +1650,7 @@ static int32_t vnodeSubmitReqConvertToSubmitReq2(SVnode *pVnode, SSubmitReq *pRe
|
|||
}
|
||||
}
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
code = (NULL == taosArrayPush(pReq2->aSubmitTbData, cxt.pTbData) ? TSDB_CODE_OUT_OF_MEMORY : TSDB_CODE_SUCCESS);
|
||||
code = (NULL == taosArrayPush(pReq2->aSubmitTbData, cxt.pTbData) ? terrno : TSDB_CODE_SUCCESS);
|
||||
}
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
taosMemoryFreeClear(cxt.pTbData);
|
||||
|
@ -1669,7 +1669,7 @@ static int32_t vnodeRebuildSubmitReqMsg(SSubmitReq2 *pSubmitReq, void **ppMsg) {
|
|||
if (TSDB_CODE_SUCCESS == code) {
|
||||
pMsg = taosMemoryMalloc(msglen);
|
||||
if (NULL == pMsg) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
}
|
||||
}
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
|
@ -1846,7 +1846,7 @@ static int32_t vnodeProcessSubmitReq(SVnode *pVnode, int64_t ver, void *pReq, in
|
|||
if (pSubmitRsp->aCreateTbRsp == NULL &&
|
||||
(pSubmitRsp->aCreateTbRsp = taosArrayInit(TARRAY_SIZE(pSubmitReq->aSubmitTbData), sizeof(SVCreateTbRsp))) ==
|
||||
NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _exit;
|
||||
}
|
||||
|
||||
|
@ -1858,7 +1858,7 @@ static int32_t vnodeProcessSubmitReq(SVnode *pVnode, int64_t ver, void *pReq, in
|
|||
|
||||
if (newTbUids == NULL &&
|
||||
(newTbUids = taosArrayInit(TARRAY_SIZE(pSubmitReq->aSubmitTbData), sizeof(int64_t))) == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _exit;
|
||||
}
|
||||
|
||||
|
@ -2237,7 +2237,7 @@ static int32_t vnodeProcessDeleteReq(SVnode *pVnode, int64_t ver, void *pReq, in
|
|||
|
||||
pRes->uidList = taosArrayInit(0, sizeof(tb_uid_t));
|
||||
if (pRes->uidList == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _err;
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ char* tsAuditBatchUri = "/audit-batch";
|
|||
int32_t auditInit(const SAuditCfg *pCfg) {
|
||||
tsAudit.cfg = *pCfg;
|
||||
tsAudit.records = taosArrayInit(0, sizeof(SAuditRecord *));
|
||||
if(tsAudit.records == NULL) return TSDB_CODE_OUT_OF_MEMORY;
|
||||
if(tsAudit.records == NULL) return terrno;
|
||||
return taosThreadMutexInit(&tsAudit.lock, NULL);
|
||||
}
|
||||
|
||||
|
|
|
@ -443,7 +443,7 @@ int32_t ctgGetTbTag(SCatalog* pCtg, SRequestConnInfo* pConn, SName* pTableName,
|
|||
if (tTagIsJson(pTag)) {
|
||||
pTagVals = taosArrayInit(1, sizeof(STagVal));
|
||||
if (NULL == pTagVals) {
|
||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_JRET(terrno);
|
||||
}
|
||||
|
||||
char* pJson = NULL;
|
||||
|
@ -460,7 +460,7 @@ int32_t ctgGetTbTag(SCatalog* pCtg, SRequestConnInfo* pConn, SName* pTableName,
|
|||
if (NULL == taosArrayPush(pTagVals, &tagVal)) {
|
||||
taosMemoryFree(pJson);
|
||||
taosArrayDestroy(pTagVals);
|
||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_JRET(terrno);
|
||||
}
|
||||
} else {
|
||||
CTG_ERR_JRET(tTagToValArray((const STag*)pCfg->pTags, &pTagVals));
|
||||
|
@ -938,14 +938,14 @@ int32_t catalogGetHandle(int64_t clusterId, SCatalog** catalogHandle) {
|
|||
false, HASH_ENTRY_LOCK);
|
||||
if (NULL == clusterCtg->dbCache) {
|
||||
qError("taosHashInit %d dbCache failed", CTG_DEFAULT_CACHE_DB_NUMBER);
|
||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_JRET(terrno);
|
||||
}
|
||||
|
||||
clusterCtg->userCache = taosHashInit(gCtgMgmt.cfg.maxUserCacheNum,
|
||||
taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_ENTRY_LOCK);
|
||||
if (NULL == clusterCtg->userCache) {
|
||||
qError("taosHashInit %d user cache failed", gCtgMgmt.cfg.maxUserCacheNum);
|
||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_JRET(terrno);
|
||||
}
|
||||
|
||||
code = taosHashPut(gCtgMgmt.pCluster, &clusterId, sizeof(clusterId), &clusterCtg, POINTER_BYTES);
|
||||
|
@ -1592,7 +1592,7 @@ int32_t catalogGetExpiredViews(SCatalog* pCtg, SViewVersion** views, uint32_t* n
|
|||
|
||||
*dynViewVersion = taosMemoryMalloc(sizeof(SDynViewVersion));
|
||||
if (NULL == *dynViewVersion) {
|
||||
CTG_API_LEAVE(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_API_LEAVE(terrno);
|
||||
}
|
||||
|
||||
(*dynViewVersion)->svrBootTs = atomic_load_64(&pCtg->dynViewVer.svrBootTs);
|
||||
|
|
|
@ -61,7 +61,7 @@ int32_t ctgInitGetTbMetaTask(SCtgJob* pJob, int32_t taskIdx, void* param) {
|
|||
ctx->pName = taosMemoryMalloc(sizeof(*name));
|
||||
if (NULL == ctx->pName) {
|
||||
taosMemoryFree(task.taskCtx);
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
TAOS_MEMCPY(ctx->pName, name, sizeof(*name));
|
||||
|
@ -69,7 +69,7 @@ int32_t ctgInitGetTbMetaTask(SCtgJob* pJob, int32_t taskIdx, void* param) {
|
|||
|
||||
if (NULL == taosArrayPush(pJob->pTasks, &task)) {
|
||||
ctgFreeTask(&task, true);
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, tbName:%s", pJob->queryId, taskIdx,
|
||||
|
@ -97,12 +97,12 @@ int32_t ctgInitGetTbMetasTask(SCtgJob* pJob, int32_t taskIdx, void* param) {
|
|||
qError("qid:0x%" PRIx64 " taosArrayInit %d SMetaRes %d failed", pJob->queryId, pJob->tbMetaNum,
|
||||
(int32_t)sizeof(SMetaRes));
|
||||
ctgFreeTask(&task, true);
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
if (NULL == taosArrayPush(pJob->pTasks, &task)) {
|
||||
ctgFreeTask(&task, true);
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, dbNum:%lu, tbNum:%d", pJob->queryId, taskIdx,
|
||||
|
@ -130,7 +130,7 @@ int32_t ctgInitGetDbVgTask(SCtgJob* pJob, int32_t taskIdx, void* param) {
|
|||
|
||||
if (NULL == taosArrayPush(pJob->pTasks, &task)) {
|
||||
ctgFreeTask(&task, true);
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, dbFName:%s", pJob->queryId, taskIdx,
|
||||
|
@ -158,7 +158,7 @@ int32_t ctgInitGetDbCfgTask(SCtgJob* pJob, int32_t taskIdx, void* param) {
|
|||
|
||||
if (NULL == taosArrayPush(pJob->pTasks, &task)) {
|
||||
ctgFreeTask(&task, true);
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, dbFName:%s", pJob->queryId, taskIdx,
|
||||
|
@ -186,7 +186,7 @@ int32_t ctgInitGetDbInfoTask(SCtgJob* pJob, int32_t taskIdx, void* param) {
|
|||
|
||||
if (NULL == taosArrayPush(pJob->pTasks, &task)) {
|
||||
ctgFreeTask(&task, true);
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, dbFName:%s", pJob->queryId, taskIdx,
|
||||
|
@ -212,7 +212,7 @@ int32_t ctgInitGetTbHashTask(SCtgJob* pJob, int32_t taskIdx, void* param) {
|
|||
ctx->pName = taosMemoryMalloc(sizeof(*name));
|
||||
if (NULL == ctx->pName) {
|
||||
taosMemoryFree(task.taskCtx);
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
TAOS_MEMCPY(ctx->pName, name, sizeof(*name));
|
||||
|
@ -220,7 +220,7 @@ int32_t ctgInitGetTbHashTask(SCtgJob* pJob, int32_t taskIdx, void* param) {
|
|||
|
||||
if (NULL == taosArrayPush(pJob->pTasks, &task)) {
|
||||
ctgFreeTask(&task, true);
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, tableName:%s", pJob->queryId, taskIdx,
|
||||
|
@ -248,12 +248,12 @@ int32_t ctgInitGetTbHashsTask(SCtgJob* pJob, int32_t taskIdx, void* param) {
|
|||
qError("qid:0x%" PRIx64 " taosArrayInit %d SMetaRes %d failed", pJob->queryId, pJob->tbHashNum,
|
||||
(int32_t)sizeof(SMetaRes));
|
||||
ctgFreeTask(&task, true);
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
if (NULL == taosArrayPush(pJob->pTasks, &task)) {
|
||||
ctgFreeTask(&task, true);
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, dbNum:%lu, tbNum:%d", pJob->queryId, taskIdx,
|
||||
|
@ -272,7 +272,7 @@ int32_t ctgInitGetQnodeTask(SCtgJob* pJob, int32_t taskIdx, void* param) {
|
|||
|
||||
if (NULL == taosArrayPush(pJob->pTasks, &task)) {
|
||||
ctgFreeTask(&task, true);
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized", pJob->queryId, taskIdx, ctgTaskTypeStr(task.type));
|
||||
|
@ -290,7 +290,7 @@ int32_t ctgInitGetDnodeTask(SCtgJob* pJob, int32_t taskIdx, void* param) {
|
|||
|
||||
if (NULL == taosArrayPush(pJob->pTasks, &task)) {
|
||||
ctgFreeTask(&task, true);
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized", pJob->queryId, taskIdx, ctgTaskTypeStr(task.type));
|
||||
|
@ -317,7 +317,7 @@ int32_t ctgInitGetIndexTask(SCtgJob* pJob, int32_t taskIdx, void* param) {
|
|||
|
||||
if (NULL == taosArrayPush(pJob->pTasks, &task)) {
|
||||
ctgFreeTask(&task, true);
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, indexFName:%s", pJob->queryId, taskIdx,
|
||||
|
@ -345,7 +345,7 @@ int32_t ctgInitGetUdfTask(SCtgJob* pJob, int32_t taskIdx, void* param) {
|
|||
|
||||
if (NULL == taosArrayPush(pJob->pTasks, &task)) {
|
||||
ctgFreeTask(&task, true);
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, udfName:%s", pJob->queryId, taskIdx,
|
||||
|
@ -373,7 +373,7 @@ int32_t ctgInitGetUserTask(SCtgJob* pJob, int32_t taskIdx, void* param) {
|
|||
|
||||
if (NULL == taosArrayPush(pJob->pTasks, &task)) {
|
||||
ctgFreeTask(&task, true);
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, user:%s", pJob->queryId, taskIdx,
|
||||
|
@ -391,7 +391,7 @@ int32_t ctgInitGetSvrVerTask(SCtgJob* pJob, int32_t taskIdx, void* param) {
|
|||
|
||||
if (NULL == taosArrayPush(pJob->pTasks, &task)) {
|
||||
ctgFreeTask(&task, true);
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized", pJob->queryId, taskIdx, ctgTaskTypeStr(task.type));
|
||||
|
@ -416,14 +416,14 @@ int32_t ctgInitGetTbIndexTask(SCtgJob* pJob, int32_t taskIdx, void* param) {
|
|||
ctx->pName = taosMemoryMalloc(sizeof(*name));
|
||||
if (NULL == ctx->pName) {
|
||||
taosMemoryFree(task.taskCtx);
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
TAOS_MEMCPY(ctx->pName, name, sizeof(*name));
|
||||
|
||||
if (NULL == taosArrayPush(pJob->pTasks, &task)) {
|
||||
ctgFreeTask(&task, true);
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, tbName:%s", pJob->queryId, taskIdx,
|
||||
|
@ -449,14 +449,14 @@ int32_t ctgInitGetTbCfgTask(SCtgJob* pJob, int32_t taskIdx, void* param) {
|
|||
ctx->pName = taosMemoryMalloc(sizeof(*name));
|
||||
if (NULL == ctx->pName) {
|
||||
taosMemoryFree(task.taskCtx);
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
TAOS_MEMCPY(ctx->pName, name, sizeof(*name));
|
||||
|
||||
if (NULL == taosArrayPush(pJob->pTasks, &task)) {
|
||||
ctgFreeTask(&task, true);
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, tbName:%s", pJob->queryId, taskIdx,
|
||||
|
@ -482,14 +482,14 @@ int32_t ctgInitGetTbTagTask(SCtgJob* pJob, int32_t taskIdx, void* param) {
|
|||
ctx->pName = taosMemoryMalloc(sizeof(*name));
|
||||
if (NULL == ctx->pName) {
|
||||
taosMemoryFree(task.taskCtx);
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
TAOS_MEMCPY(ctx->pName, name, sizeof(*name));
|
||||
|
||||
if (NULL == taosArrayPush(pJob->pTasks, &task)) {
|
||||
ctgFreeTask(&task, true);
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, tbName:%s", pJob->queryId, taskIdx,
|
||||
|
@ -517,12 +517,12 @@ int32_t ctgInitGetViewsTask(SCtgJob* pJob, int32_t taskIdx, void* param) {
|
|||
qError("qid:0x%" PRIx64 " taosArrayInit %d SMetaRes %d failed", pJob->queryId, pJob->viewNum,
|
||||
(int32_t)sizeof(SMetaRes));
|
||||
ctgFreeTask(&task, true);
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
if (NULL == taosArrayPush(pJob->pTasks, &task)) {
|
||||
ctgFreeTask(&task, true);
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, dbNum:%lu, viewNum:%d", pJob->queryId, taskIdx,
|
||||
|
@ -549,12 +549,12 @@ int32_t ctgInitGetTbTSMATask(SCtgJob* pJob, int32_t taskId, void* param) {
|
|||
qError("qid:0x%" PRIx64 " taosArrayInit %d SMetaRes %d failed", pJob->queryId, pJob->tbTsmaNum,
|
||||
(int32_t)sizeof(SMetaRes));
|
||||
ctgFreeTask(&task, true);
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
if (NULL == taosArrayPush(pJob->pTasks, &task)) {
|
||||
ctgFreeTask(&task, true);
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
return TSDB_CODE_SUCCESS;
|
||||
|
@ -577,12 +577,12 @@ int32_t ctgInitGetTSMATask(SCtgJob* pJob, int32_t taskId, void* param) {
|
|||
qError("qid:0x%" PRIx64 " taosArrayInit %d SMetaRes %d failed", pJob->queryId, pJob->tsmaNum,
|
||||
(int32_t)sizeof(SMetaRes));
|
||||
ctgFreeTask(&task, true);
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
if (NULL == taosArrayPush(pJob->pTasks, &task)) {
|
||||
ctgFreeTask(&task, true);
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
return TSDB_CODE_SUCCESS;
|
||||
|
@ -614,7 +614,7 @@ int32_t ctgHandleForceUpdate(SCatalog* pCtg, int32_t taskNum, SCtgJob* pJob, con
|
|||
if (NULL == pDb || NULL == pTb) {
|
||||
taosHashCleanup(pDb);
|
||||
taosHashCleanup(pTb);
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
for (int32_t i = 0; i < pJob->dbVgNum; ++i) {
|
||||
|
@ -865,14 +865,14 @@ int32_t ctgInitJob(SCatalog* pCtg, SRequestConnInfo* pConn, SCtgJob** job, const
|
|||
taosHashInit(CTG_DEFAULT_BATCH_NUM, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), false, HASH_NO_LOCK);
|
||||
if (NULL == pJob->pBatchs) {
|
||||
ctgError("taosHashInit %d batch failed", CTG_DEFAULT_BATCH_NUM);
|
||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_JRET(terrno);
|
||||
}
|
||||
#endif
|
||||
|
||||
pJob->pTasks = taosArrayInit(taskNum, sizeof(SCtgTask));
|
||||
if (NULL == pJob->pTasks) {
|
||||
ctgError("taosArrayInit %d tasks failed", taskNum);
|
||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_JRET(terrno);
|
||||
}
|
||||
|
||||
if (pReq->forceUpdate && taskNum) {
|
||||
|
@ -1035,7 +1035,7 @@ int32_t ctgDumpTbMetaRes(SCtgTask* pTask) {
|
|||
if (NULL == pJob->jobRes.pTableMeta) {
|
||||
pJob->jobRes.pTableMeta = taosArrayInit(pJob->tbMetaNum, sizeof(SMetaRes));
|
||||
if (NULL == pJob->jobRes.pTableMeta) {
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1068,7 +1068,7 @@ int32_t ctgDumpDbVgRes(SCtgTask* pTask) {
|
|||
if (NULL == pJob->jobRes.pDbVgroup) {
|
||||
pJob->jobRes.pDbVgroup = taosArrayInit(pJob->dbVgNum, sizeof(SMetaRes));
|
||||
if (NULL == pJob->jobRes.pDbVgroup) {
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1089,7 +1089,7 @@ int32_t ctgDumpTbHashRes(SCtgTask* pTask) {
|
|||
if (NULL == pJob->jobRes.pTableHash) {
|
||||
pJob->jobRes.pTableHash = taosArrayInit(pJob->tbHashNum, sizeof(SMetaRes));
|
||||
if (NULL == pJob->jobRes.pTableHash) {
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1197,7 +1197,7 @@ int32_t ctgDumpIndexRes(SCtgTask* pTask) {
|
|||
if (NULL == pJob->jobRes.pIndex) {
|
||||
pJob->jobRes.pIndex = taosArrayInit(pJob->indexNum, sizeof(SMetaRes));
|
||||
if (NULL == pJob->jobRes.pIndex) {
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1218,7 +1218,7 @@ int32_t ctgDumpQnodeRes(SCtgTask* pTask) {
|
|||
if (NULL == pJob->jobRes.pQnodeList) {
|
||||
pJob->jobRes.pQnodeList = taosArrayInit(1, sizeof(SMetaRes));
|
||||
if (NULL == pJob->jobRes.pQnodeList) {
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1239,7 +1239,7 @@ int32_t ctgDumpDnodeRes(SCtgTask* pTask) {
|
|||
if (NULL == pJob->jobRes.pDnodeList) {
|
||||
pJob->jobRes.pDnodeList = taosArrayInit(1, sizeof(SMetaRes));
|
||||
if (NULL == pJob->jobRes.pDnodeList) {
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1260,7 +1260,7 @@ int32_t ctgDumpDbCfgRes(SCtgTask* pTask) {
|
|||
if (NULL == pJob->jobRes.pDbCfg) {
|
||||
pJob->jobRes.pDbCfg = taosArrayInit(pJob->dbCfgNum, sizeof(SMetaRes));
|
||||
if (NULL == pJob->jobRes.pDbCfg) {
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1281,7 +1281,7 @@ int32_t ctgDumpDbInfoRes(SCtgTask* pTask) {
|
|||
if (NULL == pJob->jobRes.pDbInfo) {
|
||||
pJob->jobRes.pDbInfo = taosArrayInit(pJob->dbInfoNum, sizeof(SMetaRes));
|
||||
if (NULL == pJob->jobRes.pDbInfo) {
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1302,7 +1302,7 @@ int32_t ctgDumpUdfRes(SCtgTask* pTask) {
|
|||
if (NULL == pJob->jobRes.pUdfList) {
|
||||
pJob->jobRes.pUdfList = taosArrayInit(pJob->udfNum, sizeof(SMetaRes));
|
||||
if (NULL == pJob->jobRes.pUdfList) {
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1323,7 +1323,7 @@ int32_t ctgDumpUserRes(SCtgTask* pTask) {
|
|||
if (NULL == pJob->jobRes.pUser) {
|
||||
pJob->jobRes.pUser = taosArrayInit(pJob->userNum, sizeof(SMetaRes));
|
||||
if (NULL == pJob->jobRes.pUser) {
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1909,7 +1909,7 @@ int32_t ctgHandleGetTbHashRsp(SCtgTaskReq* tReq, int32_t reqType, const SDataBuf
|
|||
|
||||
pTask->res = taosMemoryMalloc(sizeof(SVgroupInfo));
|
||||
if (NULL == pTask->res) {
|
||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_JRET(terrno);
|
||||
}
|
||||
|
||||
CTG_ERR_JRET(ctgGetVgInfoFromHashValue(pCtg, &pTask->pJob->conn.mgmtEps, pOut->dbVgroup, ctx->pName,
|
||||
|
@ -2088,7 +2088,7 @@ int32_t ctgHandleGetTbTagRsp(SCtgTaskReq* tReq, int32_t reqType, const SDataBuf*
|
|||
if (tTagIsJson(pTag)) {
|
||||
pTagVals = taosArrayInit(1, sizeof(STagVal));
|
||||
if (NULL == pTagVals) {
|
||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_JRET(terrno);
|
||||
}
|
||||
|
||||
char* pJson = NULL;
|
||||
|
@ -2105,7 +2105,7 @@ int32_t ctgHandleGetTbTagRsp(SCtgTaskReq* tReq, int32_t reqType, const SDataBuf*
|
|||
if (NULL == taosArrayPush(pTagVals, &tagVal)) {
|
||||
taosMemoryFree(pJson);
|
||||
taosArrayDestroy(pTagVals);
|
||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_JRET(terrno);
|
||||
}
|
||||
} else {
|
||||
CTG_ERR_JRET(tTagToValArray((const STag*)pRsp->pTags, &pTagVals));
|
||||
|
@ -2850,7 +2850,7 @@ int32_t ctgLaunchGetTbMetasTask(SCtgTask* pTask) {
|
|||
pTask->msgCtxs = taosArrayInit_s(sizeof(SCtgMsgCtx), pCtx->fetchNum);
|
||||
if (NULL == pTask->msgCtxs) {
|
||||
ctgError("taosArrayInit_s %d SCtgMsgCtx %d failed", pCtx->fetchNum, (int32_t)sizeof(SCtgMsgCtx));
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
for (int32_t i = 0; i < pCtx->fetchNum; ++i) {
|
||||
|
@ -2953,7 +2953,7 @@ int32_t ctgLaunchGetTbHashTask(SCtgTask* pTask) {
|
|||
if (NULL != dbCache) {
|
||||
pTask->res = taosMemoryMalloc(sizeof(SVgroupInfo));
|
||||
if (NULL == pTask->res) {
|
||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_JRET(terrno);
|
||||
}
|
||||
CTG_ERR_JRET(ctgGetVgInfoFromHashValue(pCtg, &pConn->mgmtEps, dbCache->vgCache.vgInfo, pCtx->pName,
|
||||
(SVgroupInfo*)pTask->res));
|
||||
|
@ -3021,7 +3021,7 @@ int32_t ctgLaunchGetTbHashsTask(SCtgTask* pTask) {
|
|||
int32_t inc = baseResIdx - taosArrayGetSize(pCtx->pResList);
|
||||
for (int32_t j = 0; j < inc; ++j) {
|
||||
if (NULL == taosArrayPush(pCtx->pResList, &(SMetaRes){0})) {
|
||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_JRET(terrno);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3038,7 +3038,7 @@ int32_t ctgLaunchGetTbHashsTask(SCtgTask* pTask) {
|
|||
pTask->msgCtxs = taosArrayInit_s(sizeof(SCtgMsgCtx), pCtx->fetchNum);
|
||||
if (NULL == pTask->msgCtxs) {
|
||||
ctgError("taosArrayInit_s %d SCtgMsgCtx %d failed", pCtx->fetchNum, (int32_t)sizeof(SCtgMsgCtx));
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
for (int32_t i = 0; i < pCtx->fetchNum; ++i) {
|
||||
|
@ -3507,7 +3507,7 @@ int32_t ctgLaunchGetViewsTask(SCtgTask* pTask) {
|
|||
pTask->msgCtxs = taosArrayInit_s(sizeof(SCtgMsgCtx), pCtx->fetchNum);
|
||||
if (NULL == pTask->msgCtxs) {
|
||||
ctgError("taosArrayInit_s %d SCtgMsgCtx %d failed", pCtx->fetchNum, (int32_t)sizeof(SCtgMsgCtx));
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
for (int32_t i = 0; i < pCtx->fetchNum; ++i) {
|
||||
|
@ -3600,7 +3600,7 @@ int32_t ctgLaunchGetTbTSMATask(SCtgTask* pTask) {
|
|||
pTask->msgCtxs = taosArrayInit_s(sizeof(SCtgMsgCtx), pCtx->fetchNum);
|
||||
if (NULL == pTask->msgCtxs) {
|
||||
ctgError("taosArrayInit_s %d SCtgMsgCtx %d failed", pCtx->fetchNum, (int32_t)sizeof(SCtgMsgCtx));
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
for (int32_t i = 0; i < pCtx->fetchNum; ++i) {
|
||||
|
|
|
@ -600,7 +600,7 @@ int32_t ctgCopyTbMeta(SCatalog *pCtg, SCtgTbMetaCtx *ctx, SCtgDBCache **pDb, SCt
|
|||
metaSize = CTG_META_SIZE(stbMeta);
|
||||
*pTableMeta = taosMemoryRealloc(*pTableMeta, metaSize);
|
||||
if (NULL == *pTableMeta) {
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
TAOS_MEMCPY(&(*pTableMeta)->sversion, &stbMeta->sversion, metaSize - sizeof(SCTableMeta));
|
||||
|
@ -814,7 +814,7 @@ int32_t ctgGetCachedStbNameFromSuid(SCatalog* pCtg, char* dbFName, uint64_t suid
|
|||
|
||||
*stbName = taosStrdup(stb);
|
||||
if (NULL == *stbName) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
}
|
||||
|
||||
taosHashRelease(dbCache->stbCache, stb);
|
||||
|
@ -956,7 +956,7 @@ int32_t ctgDropDbCacheEnqueue(SCatalog *pCtg, const char *dbFName, int64_t dbId)
|
|||
if (NULL == msg) {
|
||||
ctgError("malloc %d failed", (int32_t)sizeof(SCtgDropDBMsg));
|
||||
taosMemoryFree(op);
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
char *p = strchr(dbFName, '.');
|
||||
|
@ -1032,7 +1032,7 @@ int32_t ctgDropStbMetaEnqueue(SCatalog *pCtg, const char *dbFName, int64_t dbId,
|
|||
if (NULL == msg) {
|
||||
ctgError("malloc %d failed", (int32_t)sizeof(SCtgDropStbMetaMsg));
|
||||
taosMemoryFree(op);
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
msg->pCtg = pCtg;
|
||||
|
@ -1067,7 +1067,7 @@ int32_t ctgDropTbMetaEnqueue(SCatalog *pCtg, const char *dbFName, int64_t dbId,
|
|||
if (NULL == msg) {
|
||||
ctgError("malloc %d failed", (int32_t)sizeof(SCtgDropTblMetaMsg));
|
||||
taosMemoryFree(op);
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
msg->pCtg = pCtg;
|
||||
|
@ -1102,7 +1102,7 @@ int32_t ctgUpdateVgroupEnqueue(SCatalog *pCtg, const char *dbFName, int64_t dbId
|
|||
ctgError("malloc %d failed", (int32_t)sizeof(SCtgUpdateVgMsg));
|
||||
taosMemoryFree(op);
|
||||
freeVgInfo(dbInfo);
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
char *p = strchr(dbFName, '.');
|
||||
|
@ -1152,7 +1152,7 @@ int32_t ctgUpdateDbCfgEnqueue(SCatalog *pCtg, const char *dbFName, int64_t dbId,
|
|||
ctgError("malloc %d failed", (int32_t)sizeof(SCtgUpdateDbCfgMsg));
|
||||
taosMemoryFree(op);
|
||||
freeDbCfgInfo(cfgInfo);
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
char *p = strchr(dbFName, '.');
|
||||
|
@ -1193,7 +1193,7 @@ int32_t ctgUpdateTbMetaEnqueue(SCatalog *pCtg, STableMetaOutput *output, bool sy
|
|||
if (NULL == msg) {
|
||||
ctgError("malloc %d failed", (int32_t)sizeof(SCtgUpdateTbMetaMsg));
|
||||
taosMemoryFree(op);
|
||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_JRET(terrno);
|
||||
}
|
||||
|
||||
char *p = strchr(output->dbFName, '.');
|
||||
|
@ -1235,7 +1235,7 @@ int32_t ctgUpdateVgEpsetEnqueue(SCatalog *pCtg, char *dbFName, int32_t vgId, SEp
|
|||
if (NULL == msg) {
|
||||
ctgError("malloc %d failed", (int32_t)sizeof(SCtgUpdateEpsetMsg));
|
||||
taosMemoryFree(op);
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
msg->pCtg = pCtg;
|
||||
|
@ -1269,7 +1269,7 @@ int32_t ctgUpdateUserEnqueue(SCatalog *pCtg, SGetUserAuthRsp *pAuth, bool syncOp
|
|||
if (NULL == msg) {
|
||||
ctgError("malloc %d failed", (int32_t)sizeof(SCtgUpdateUserMsg));
|
||||
taosMemoryFree(op);
|
||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_JRET(terrno);
|
||||
}
|
||||
|
||||
msg->pCtg = pCtg;
|
||||
|
@ -1303,7 +1303,7 @@ int32_t ctgUpdateTbIndexEnqueue(SCatalog *pCtg, STableIndex **pIndex, bool syncO
|
|||
if (NULL == msg) {
|
||||
ctgError("malloc %d failed", (int32_t)sizeof(SCtgUpdateTbIndexMsg));
|
||||
taosMemoryFree(op);
|
||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_JRET(terrno);
|
||||
}
|
||||
|
||||
msg->pCtg = pCtg;
|
||||
|
@ -1339,7 +1339,7 @@ int32_t ctgDropTbIndexEnqueue(SCatalog *pCtg, SName *pName, bool syncOp) {
|
|||
if (NULL == msg) {
|
||||
ctgError("malloc %d failed", (int32_t)sizeof(SCtgDropTbIndexMsg));
|
||||
taosMemoryFree(op);
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
msg->pCtg = pCtg;
|
||||
|
@ -1374,7 +1374,7 @@ int32_t ctgClearCacheEnqueue(SCatalog *pCtg, bool clearMeta, bool freeCtg, bool
|
|||
if (NULL == msg) {
|
||||
ctgError("malloc %d failed", (int32_t)sizeof(SCtgClearCacheMsg));
|
||||
taosMemoryFree(op);
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
msg->pCtg = pCtg;
|
||||
|
@ -1406,7 +1406,7 @@ int32_t ctgUpdateViewMetaEnqueue(SCatalog *pCtg, SViewMetaRsp *pRsp, bool syncOp
|
|||
if (NULL == msg) {
|
||||
ctgError("malloc %d failed", (int32_t)sizeof(SCtgUpdateViewMetaMsg));
|
||||
taosMemoryFree(op);
|
||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_JRET(terrno);
|
||||
}
|
||||
|
||||
char *p = strchr(pRsp->dbFName, '.');
|
||||
|
@ -1450,7 +1450,7 @@ int32_t ctgDropViewMetaEnqueue(SCatalog *pCtg, const char *dbFName, uint64_t dbI
|
|||
if (NULL == msg) {
|
||||
ctgError("malloc %d failed", (int32_t)sizeof(SCtgDropViewMetaMsg));
|
||||
taosMemoryFree(op);
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
msg->pCtg = pCtg;
|
||||
|
@ -1485,7 +1485,7 @@ int32_t ctgUpdateTbTSMAEnqueue(SCatalog *pCtg, STSMACache **pTsma, int32_t tsmaV
|
|||
if (NULL == msg) {
|
||||
ctgError("malloc %d failed", (int32_t)sizeof(SCtgUpdateTbTSMAMsg));
|
||||
taosMemoryFree(op);
|
||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_JRET(terrno);
|
||||
}
|
||||
|
||||
msg->pCtg = pCtg;
|
||||
|
@ -1644,7 +1644,7 @@ int32_t ctgUpdateDbTsmaVersionEnqueue(SCatalog* pCtg, int32_t tsmaVersion, const
|
|||
if (NULL == msg) {
|
||||
ctgError("malloc %d failed", (int32_t)sizeof(SCtgUpdateTbTSMAMsg));
|
||||
taosMemoryFree(op);
|
||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_JRET(terrno);
|
||||
}
|
||||
|
||||
msg->pCtg = pCtg;
|
||||
|
@ -1675,28 +1675,28 @@ int32_t ctgAddNewDBCache(SCatalog *pCtg, const char *dbFName, uint64_t dbId) {
|
|||
true, HASH_ENTRY_LOCK);
|
||||
if (NULL == newDBCache.tbCache) {
|
||||
ctgError("taosHashInit %d tbCache failed", gCtgMgmt.cfg.maxTblCacheNum);
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
newDBCache.stbCache = taosHashInit(gCtgMgmt.cfg.maxTblCacheNum, taosGetDefaultHashFunction(TSDB_DATA_TYPE_UBIGINT),
|
||||
true, HASH_ENTRY_LOCK);
|
||||
if (NULL == newDBCache.stbCache) {
|
||||
ctgError("taosHashInit %d stbCache failed", gCtgMgmt.cfg.maxTblCacheNum);
|
||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_JRET(terrno);
|
||||
}
|
||||
|
||||
newDBCache.viewCache = taosHashInit(gCtgMgmt.cfg.maxViewCacheNum, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY),
|
||||
true, HASH_ENTRY_LOCK);
|
||||
if (NULL == newDBCache.viewCache) {
|
||||
ctgError("taosHashInit %d viewCache failed", gCtgMgmt.cfg.maxViewCacheNum);
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
newDBCache.tsmaCache = taosHashInit(gCtgMgmt.cfg.maxTSMACacheNum, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY),
|
||||
true, HASH_ENTRY_LOCK);
|
||||
if (!newDBCache.tsmaCache) {
|
||||
ctgError("taosHashInit %d tsmaCache failed", gCtgMgmt.cfg.maxTSMACacheNum);
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
code = taosHashPut(pCtg->dbCache, dbFName, strlen(dbFName), &newDBCache, sizeof(SCtgDBCache));
|
||||
|
@ -1707,7 +1707,7 @@ int32_t ctgAddNewDBCache(SCatalog *pCtg, const char *dbFName, uint64_t dbId) {
|
|||
}
|
||||
|
||||
ctgError("taosHashPut db to cache failed, dbFName:%s", dbFName);
|
||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_JRET(terrno);
|
||||
}
|
||||
|
||||
CTG_CACHE_NUM_INC(CTG_CI_DB, 1);
|
||||
|
@ -1845,7 +1845,7 @@ int32_t ctgWriteTbMetaToCache(SCatalog *pCtg, SCtgDBCache *dbCache, char *dbFNam
|
|||
if (taosHashPut(dbCache->tbCache, tbName, strlen(tbName), &cache, sizeof(SCtgTbCache)) != 0) {
|
||||
ctgError("taosHashPut new tbCache failed, dbFName:%s, tbName:%s, tbType:%d", dbFName, tbName, meta->tableType);
|
||||
taosMemoryFree(meta);
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
(void)atomic_add_fetch_64(&dbCache->dbCacheSize, strlen(tbName) + sizeof(SCtgTbCache) + ctgGetTbMetaCacheSize(meta));
|
||||
|
@ -1879,7 +1879,7 @@ int32_t ctgWriteTbMetaToCache(SCatalog *pCtg, SCtgDBCache *dbCache, char *dbFNam
|
|||
|
||||
if (taosHashPut(dbCache->stbCache, &meta->suid, sizeof(meta->suid), tbName, strlen(tbName) + 1) != 0) {
|
||||
ctgError("taosHashPut to stable cache failed, suid:0x%" PRIx64, meta->suid);
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
(void)atomic_add_fetch_64(&dbCache->dbCacheSize, sizeof(meta->suid) + strlen(tbName) + 1);
|
||||
|
@ -1911,7 +1911,7 @@ int32_t ctgWriteTbIndexToCache(SCatalog *pCtg, SCtgDBCache *dbCache, char *dbFNa
|
|||
ctgFreeSTableIndex(*index);
|
||||
taosMemoryFreeClear(*index);
|
||||
ctgError("taosHashPut new tbCache failed, tbName:%s", tbName);
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
(void)atomic_add_fetch_64(&dbCache->dbCacheSize, strlen(tbName) + sizeof(SCtgTbCache) + ctgGetTbIndexCacheSize(pIndex));
|
||||
|
@ -1971,7 +1971,7 @@ int32_t ctgWriteViewMetaToCache(SCatalog *pCtg, SCtgDBCache *dbCache, char *dbFN
|
|||
|
||||
if (taosHashPut(dbCache->viewCache, viewName, strlen(viewName), &cache, sizeof(cache)) != 0) {
|
||||
ctgError("taosHashPut new tbCache failed, viewName:%s", viewName);
|
||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_JRET(terrno);
|
||||
}
|
||||
|
||||
(void)atomic_add_fetch_64(&dbCache->dbCacheSize, strlen(viewName) + sizeof(SCtgViewCache) + ctgGetViewMetaCacheSize(pMeta));
|
||||
|
@ -2101,16 +2101,16 @@ int32_t ctgWriteTbTSMAToCache(SCatalog *pCtg, SCtgDBCache *dbCache, char *dbFNam
|
|||
SCtgTSMACache cache = {0};
|
||||
cache.pTsmas = taosArrayInit(4, sizeof(POINTER_BYTES));
|
||||
if (NULL == cache.pTsmas) {
|
||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_JRET(terrno);
|
||||
}
|
||||
|
||||
if (NULL == taosArrayPush(cache.pTsmas, &pTsmaCache)) {
|
||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_JRET(terrno);
|
||||
}
|
||||
|
||||
if (taosHashPut(dbCache->tsmaCache, tbName, strlen(tbName), &cache, sizeof(cache))) {
|
||||
ctgError("taosHashPut new tsmacache for tb: %s.%s failed", dbFName, tbName);
|
||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_JRET(terrno);
|
||||
}
|
||||
|
||||
(void)atomic_add_fetch_64(&dbCache->dbCacheSize, strlen(tbName) + sizeof(STSMACache) + ctgGetTbTSMACacheSize(pTsmaCache));
|
||||
|
@ -2155,13 +2155,13 @@ int32_t ctgWriteTbTSMAToCache(SCatalog *pCtg, SCtgDBCache *dbCache, char *dbFNam
|
|||
pCache->pTsmas = taosArrayInit(4, sizeof(POINTER_BYTES));
|
||||
if (!pCache->pTsmas) {
|
||||
CTG_UNLOCK(CTG_WRITE, &pCache->tsmaLock);
|
||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_JRET(terrno);
|
||||
}
|
||||
}
|
||||
|
||||
// push the new cache
|
||||
if (NULL == taosArrayPush(pCache->pTsmas, &pTsmaCache)) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
} else {
|
||||
*ppTsmaCache = NULL;
|
||||
|
||||
|
@ -2437,7 +2437,7 @@ int32_t ctgOpUpdateTbMeta(SCtgCacheOperation *operation) {
|
|||
if (CTG_IS_META_CTABLE(pMeta->metaType) || CTG_IS_META_BOTH(pMeta->metaType)) {
|
||||
SCTableMeta *ctbMeta = taosMemoryMalloc(sizeof(SCTableMeta));
|
||||
if (NULL == ctbMeta) {
|
||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_JRET(terrno);
|
||||
}
|
||||
TAOS_MEMCPY(ctbMeta, &pMeta->ctbMeta, sizeof(SCTableMeta));
|
||||
CTG_ERR_JRET(ctgWriteTbMetaToCache(pCtg, dbCache, pMeta->dbFName, pMeta->dbId, pMeta->ctbName,
|
||||
|
@ -2590,7 +2590,7 @@ int32_t ctgOpUpdateUser(SCtgCacheOperation *operation) {
|
|||
|
||||
if (taosHashPut(pCtg->userCache, msg->userAuth.user, strlen(msg->userAuth.user), &userAuth, sizeof(userAuth))) {
|
||||
ctgError("taosHashPut user %s to cache failed", msg->userAuth.user);
|
||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_JRET(terrno);
|
||||
}
|
||||
|
||||
taosMemoryFreeClear(msg);
|
||||
|
@ -3423,7 +3423,7 @@ int32_t ctgGetTbMetasFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgTbMe
|
|||
for (int32_t i = 0; i < tbNum; ++i) {
|
||||
CTG_ERR_JRET(ctgAddFetch(&ctx->pFetchs, dbIdx, i, fetchIdx, baseResIdx + i, flag));
|
||||
if (NULL == taosArrayPush(ctx->pResList, &(SMetaData){0})) {
|
||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_JRET(terrno);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3442,7 +3442,7 @@ int32_t ctgGetTbMetasFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgTbMe
|
|||
ctgDebug("tb %s not in cache, dbFName:%s", pName->tname, dbFName);
|
||||
CTG_ERR_JRET(ctgAddFetch(&ctx->pFetchs, dbIdx, i, fetchIdx, baseResIdx + i, flag));
|
||||
if (NULL == taosArrayPush(ctx->pResList, &(SMetaData){0})) {
|
||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_JRET(terrno);
|
||||
}
|
||||
|
||||
CTG_META_NHIT_INC();
|
||||
|
@ -3459,7 +3459,7 @@ int32_t ctgGetTbMetasFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgTbMe
|
|||
|
||||
CTG_ERR_JRET(ctgAddFetch(&ctx->pFetchs, dbIdx, i, fetchIdx, baseResIdx + i, flag));
|
||||
if (NULL == taosArrayPush(ctx->pResList, &(SMetaData){0})) {
|
||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_JRET(terrno);
|
||||
}
|
||||
|
||||
CTG_META_NHIT_INC();
|
||||
|
@ -3508,7 +3508,7 @@ int32_t ctgGetTbMetasFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgTbMe
|
|||
|
||||
res.pRes = pTableMeta;
|
||||
if (NULL == taosArrayPush(ctx->pResList, &res)) {
|
||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_JRET(terrno);
|
||||
}
|
||||
|
||||
continue;
|
||||
|
@ -3533,7 +3533,7 @@ int32_t ctgGetTbMetasFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgTbMe
|
|||
|
||||
res.pRes = pTableMeta;
|
||||
if (NULL == taosArrayPush(ctx->pResList, &res)) {
|
||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_JRET(terrno);
|
||||
}
|
||||
|
||||
continue;
|
||||
|
@ -3559,7 +3559,7 @@ int32_t ctgGetTbMetasFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgTbMe
|
|||
ctgDebug("stb 0x%" PRIx64 " not in cache, dbFName:%s", pTableMeta->suid, dbFName);
|
||||
CTG_ERR_JRET(ctgAddFetch(&ctx->pFetchs, dbIdx, i, fetchIdx, baseResIdx + i, flag));
|
||||
if (NULL == taosArrayPush(ctx->pResList, &(SMetaRes){0})) {
|
||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_JRET(terrno);
|
||||
}
|
||||
taosMemoryFreeClear(pTableMeta);
|
||||
|
||||
|
@ -3574,7 +3574,7 @@ int32_t ctgGetTbMetasFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgTbMe
|
|||
|
||||
CTG_ERR_JRET(ctgAddFetch(&ctx->pFetchs, dbIdx, i, fetchIdx, baseResIdx + i, flag));
|
||||
if (NULL == taosArrayPush(ctx->pResList, &(SMetaRes){0})) {
|
||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_JRET(terrno);
|
||||
}
|
||||
taosMemoryFreeClear(pTableMeta);
|
||||
|
||||
|
@ -3593,7 +3593,7 @@ int32_t ctgGetTbMetasFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgTbMe
|
|||
|
||||
CTG_ERR_JRET(ctgAddFetch(&ctx->pFetchs, dbIdx, i, fetchIdx, baseResIdx + i, flag));
|
||||
if (NULL == taosArrayPush(ctx->pResList, &(SMetaRes){0})) {
|
||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_JRET(terrno);
|
||||
}
|
||||
|
||||
taosMemoryFreeClear(pTableMeta);
|
||||
|
@ -3612,7 +3612,7 @@ int32_t ctgGetTbMetasFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgTbMe
|
|||
|
||||
CTG_ERR_JRET(ctgAddFetch(&ctx->pFetchs, dbIdx, i, fetchIdx, baseResIdx + i, flag));
|
||||
if (NULL == taosArrayPush(ctx->pResList, &(SMetaRes){0})) {
|
||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_JRET(terrno);
|
||||
}
|
||||
|
||||
taosMemoryFreeClear(pTableMeta);
|
||||
|
@ -3629,7 +3629,7 @@ int32_t ctgGetTbMetasFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgTbMe
|
|||
pTableMeta = taosMemoryRealloc(pTableMeta, metaSize + schemaExtSize);
|
||||
if (NULL == pTableMeta) {
|
||||
ctgReleaseTbMetaToCache(pCtg, dbCache, pCache);
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
TAOS_MEMCPY(&pTableMeta->sversion, &stbMeta->sversion, metaSize + schemaExtSize - sizeof(SCTableMeta));
|
||||
|
@ -3646,7 +3646,7 @@ int32_t ctgGetTbMetasFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgTbMe
|
|||
|
||||
res.pRes = pTableMeta;
|
||||
if (NULL == taosArrayPush(ctx->pResList, &res)) {
|
||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_JRET(terrno);
|
||||
}
|
||||
|
||||
lastSuid = pTableMeta->suid;
|
||||
|
@ -3759,7 +3759,7 @@ int32_t ctgGetViewsFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgViewsC
|
|||
for (int32_t i = 0; i < tbNum; ++i) {
|
||||
CTG_ERR_RET(ctgAddFetch(&ctx->pFetchs, dbIdx, i, fetchIdx, baseResIdx + i, flag));
|
||||
if (NULL == taosArrayPush(ctx->pResList, &(SMetaData){0})) {
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3778,7 +3778,7 @@ int32_t ctgGetViewsFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgViewsC
|
|||
ctgDebug("view %s not in cache, dbFName:%s", pName->tname, dbFName);
|
||||
CTG_ERR_JRET(ctgAddFetch(&ctx->pFetchs, dbIdx, i, fetchIdx, baseResIdx + i, flag));
|
||||
if (NULL == taosArrayPush(ctx->pResList, &(SMetaRes){0})) {
|
||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_JRET(terrno);
|
||||
}
|
||||
CTG_CACHE_NHIT_INC(CTG_CI_VIEW, 1);
|
||||
|
||||
|
@ -3792,7 +3792,7 @@ int32_t ctgGetViewsFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgViewsC
|
|||
ctgDebug("view %s meta not in cache, dbFName:%s", pName->tname, dbFName);
|
||||
CTG_ERR_JRET(ctgAddFetch(&ctx->pFetchs, dbIdx, i, fetchIdx, baseResIdx + i, flag));
|
||||
if (NULL == taosArrayPush(ctx->pResList, &(SMetaRes){0})) {
|
||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_JRET(terrno);
|
||||
}
|
||||
CTG_CACHE_NHIT_INC(CTG_CI_VIEW, 1);
|
||||
|
||||
|
@ -3824,7 +3824,7 @@ int32_t ctgGetViewsFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgViewsC
|
|||
ctgReleaseViewMetaToCache(pCtg, dbCache, pCache);
|
||||
ctgFreeSViewMeta(pViewMeta);
|
||||
taosMemoryFree(pViewMeta);
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
TAOS_MEMCPY(pViewMeta->pSchema, pCache->pMeta->pSchema, pViewMeta->numOfCols * sizeof(SSchema));
|
||||
|
||||
|
@ -3835,7 +3835,7 @@ int32_t ctgGetViewsFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgViewsC
|
|||
|
||||
res.pRes = pViewMeta;
|
||||
if (NULL == taosArrayPush(ctx->pResList, &res)) {
|
||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_JRET(terrno);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3875,7 +3875,7 @@ int32_t ctgGetTbTSMAFromCache(SCatalog* pCtg, SCtgTbTSMACtx* pCtx, int32_t dbIdx
|
|||
for (int32_t i = 0; i < tbNum; ++i) {
|
||||
CTG_ERR_RET(ctgAddTSMAFetch(&pCtx->pFetches, dbIdx, i, fetchIdx, baseResIdx + i, flag, FETCH_TSMA_SOURCE_TB_META, NULL));
|
||||
if (NULL == taosArrayPush(pCtx->pResList, &(SMetaData){0})) {
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3895,7 +3895,7 @@ int32_t ctgGetTbTSMAFromCache(SCatalog* pCtg, SCtgTbTSMACtx* pCtx, int32_t dbIdx
|
|||
ctgDebug("tb: %s.%s not in cache", dbFName, pName->tname);
|
||||
CTG_ERR_JRET(ctgAddTSMAFetch(&pCtx->pFetches, dbIdx, i, fetchIdx, baseResIdx + i, flag, FETCH_TSMA_SOURCE_TB_META, NULL));
|
||||
if (NULL == taosArrayPush(pCtx->pResList, &(SMetaRes){0})) {
|
||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_JRET(terrno);
|
||||
}
|
||||
|
||||
continue;
|
||||
|
@ -3908,7 +3908,7 @@ int32_t ctgGetTbTSMAFromCache(SCatalog* pCtg, SCtgTbTSMACtx* pCtx, int32_t dbIdx
|
|||
|
||||
CTG_ERR_JRET(ctgAddTSMAFetch(&pCtx->pFetches, dbIdx, i, fetchIdx, baseResIdx + i, flag, FETCH_TSMA_SOURCE_TB_META, NULL));
|
||||
if (NULL == taosArrayPush(pCtx->pResList, &(SMetaRes){0})) {
|
||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_JRET(terrno);
|
||||
}
|
||||
|
||||
taosHashRelease(dbCache->tbCache, pTbCache);
|
||||
|
@ -3933,7 +3933,7 @@ int32_t ctgGetTbTSMAFromCache(SCatalog* pCtg, SCtgTbTSMACtx* pCtx, int32_t dbIdx
|
|||
|
||||
CTG_ERR_JRET(ctgAddTSMAFetch(&pCtx->pFetches, dbIdx, i, fetchIdx, baseResIdx + i, flag, FETCH_TSMA_SOURCE_TB_META, NULL));
|
||||
if (NULL == taosArrayPush(pCtx->pResList, &(SMetaRes){0})) {
|
||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_JRET(terrno);
|
||||
}
|
||||
|
||||
continue;
|
||||
|
@ -3945,7 +3945,7 @@ int32_t ctgGetTbTSMAFromCache(SCatalog* pCtg, SCtgTbTSMACtx* pCtx, int32_t dbIdx
|
|||
if (!pCache || !pCache->pTsmas || pCache->pTsmas->size == 0) {
|
||||
if (NULL == taosArrayPush(pCtx->pResList, &(SMetaRes){0})) {
|
||||
ctgReleaseTSMAToCache(pCtg, dbCache, pCache);
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
continue;
|
||||
|
@ -3960,7 +3960,7 @@ int32_t ctgGetTbTSMAFromCache(SCatalog* pCtg, SCtgTbTSMACtx* pCtx, int32_t dbIdx
|
|||
|
||||
CTG_ERR_JRET(ctgAddTSMAFetch(&pCtx->pFetches, dbIdx, i, fetchIdx, baseResIdx + i, flag, FETCH_TB_TSMA, &tsmaSourceTbName));
|
||||
if (NULL == taosArrayPush(pCtx->pResList, &(SMetaRes){0})) {
|
||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_JRET(terrno);
|
||||
}
|
||||
|
||||
CTG_CACHE_NHIT_INC(CTG_CI_TBL_TSMA, 1);
|
||||
|
@ -3979,7 +3979,7 @@ int32_t ctgGetTbTSMAFromCache(SCatalog* pCtg, SCtgTbTSMACtx* pCtx, int32_t dbIdx
|
|||
if (!pRsp->pTsmas) {
|
||||
ctgReleaseTSMAToCache(pCtg, dbCache, pCache);
|
||||
taosMemoryFreeClear(pRsp);
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
SMetaRes res = {0};
|
||||
|
@ -3998,14 +3998,14 @@ int32_t ctgGetTbTSMAFromCache(SCatalog* pCtg, SCtgTbTSMACtx* pCtx, int32_t dbIdx
|
|||
ctgReleaseTSMAToCache(pCtg, dbCache, pCache);
|
||||
tFreeTableTSMAInfoRsp(pRsp);
|
||||
taosMemoryFreeClear(pRsp);
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
}
|
||||
res.pRes = pRsp;
|
||||
CTG_UNLOCK(CTG_READ, &pCache->tsmaLock);
|
||||
taosHashRelease(dbCache->tsmaCache, pCache);
|
||||
if (NULL == taosArrayPush(pCtx->pResList, &res)) {
|
||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_JRET(terrno);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4075,16 +4075,16 @@ int32_t ctgGetTSMAFromCache(SCatalog* pCtg, SCtgTbTSMACtx* pCtx, SName* pTsmaNam
|
|||
pRsp->pTsmas = taosArrayInit(1, POINTER_BYTES);
|
||||
if (!pRsp->pTsmas) {
|
||||
tFreeAndClearTableTSMAInfo(pTsmaOut);
|
||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_JRET(terrno);
|
||||
}
|
||||
|
||||
if (NULL == taosArrayPush(pRsp->pTsmas, &pTsmaOut)) {
|
||||
tFreeAndClearTableTSMAInfo(pTsmaOut);
|
||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_JRET(terrno);
|
||||
}
|
||||
|
||||
if (NULL == taosArrayPush(pCtx->pResList, &res)) {
|
||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_JRET(terrno);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ int32_t ctgHandleBatchRsp(SCtgJob* pJob, SCtgTaskCallbackParam* cbParam, SDataBu
|
|||
SHashObj* pBatchs = taosHashInit(taskNum, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), false, HASH_NO_LOCK);
|
||||
if (NULL == pBatchs) {
|
||||
ctgError("taosHashInit %d batch failed", taskNum);
|
||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_JRET(terrno);
|
||||
}
|
||||
|
||||
for (int32_t i = 0; i < taskNum; ++i) {
|
||||
|
@ -441,7 +441,7 @@ int32_t ctgHandleMsgCallback(void* param, SDataBuf* pMsg, int32_t rspCode) {
|
|||
taosHashInit(CTG_DEFAULT_BATCH_NUM, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), false, HASH_NO_LOCK);
|
||||
if (NULL == pBatchs) {
|
||||
ctgError("taosHashInit %d batch failed", CTG_DEFAULT_BATCH_NUM);
|
||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_JRET(terrno);
|
||||
}
|
||||
|
||||
SCtgMsgCtx* pMsgCtx = CTG_GET_TASK_MSGCTX(pTask, -1);
|
||||
|
@ -575,7 +575,7 @@ int32_t ctgAddBatch(SCatalog* pCtg, int32_t vgId, SRequestConnInfo* pConn, SCtgT
|
|||
taosArrayDestroy(newBatch.pMsgs);
|
||||
taosArrayDestroy(newBatch.pTaskIds);
|
||||
taosArrayDestroy(newBatch.pMsgIdxs);
|
||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_JRET(terrno);
|
||||
}
|
||||
|
||||
newBatch.conn = *pConn;
|
||||
|
@ -585,14 +585,14 @@ int32_t ctgAddBatch(SCatalog* pCtg, int32_t vgId, SRequestConnInfo* pConn, SCtgT
|
|||
req.msgLen = msgSize;
|
||||
req.msg = msg;
|
||||
if (NULL == taosArrayPush(newBatch.pMsgs, &req)) {
|
||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_JRET(terrno);
|
||||
}
|
||||
msg = NULL;
|
||||
if (NULL == taosArrayPush(newBatch.pTaskIds, &pTask->taskId)) {
|
||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_JRET(terrno);
|
||||
}
|
||||
if (NULL == taosArrayPush(newBatch.pMsgIdxs, &req.msgIdx)) {
|
||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_JRET(terrno);
|
||||
}
|
||||
|
||||
if (vgId > 0) {
|
||||
|
@ -662,14 +662,14 @@ int32_t ctgAddBatch(SCatalog* pCtg, int32_t vgId, SRequestConnInfo* pConn, SCtgT
|
|||
req.msgLen = msgSize;
|
||||
req.msg = msg;
|
||||
if (NULL == taosArrayPush(pBatch->pMsgs, &req)) {
|
||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_JRET(terrno);
|
||||
}
|
||||
msg = NULL;
|
||||
if (NULL == taosArrayPush(pBatch->pTaskIds, &pTask->taskId)) {
|
||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_JRET(terrno);
|
||||
}
|
||||
if (NULL == taosArrayPush(pBatch->pMsgIdxs, &req.msgIdx)) {
|
||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_JRET(terrno);
|
||||
}
|
||||
|
||||
if (vgId > 0) {
|
||||
|
@ -819,7 +819,7 @@ int32_t ctgGetQnodeListFromMnode(SCatalog* pCtg, SRequestConnInfo* pConn, SArray
|
|||
if (pTask) {
|
||||
void* pOut = taosArrayInit(4, sizeof(SQueryNodeLoad));
|
||||
if (NULL == pOut) {
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
CTG_ERR_RET(ctgUpdateMsgCtx(CTG_GET_TASK_MSGCTX(pTask, -1), reqType, pOut, NULL));
|
||||
|
@ -832,11 +832,11 @@ int32_t ctgGetQnodeListFromMnode(SCatalog* pCtg, SRequestConnInfo* pConn, SArray
|
|||
#else
|
||||
SArray* pTaskId = taosArrayInit(1, sizeof(int32_t));
|
||||
if (NULL == pTaskId) {
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
if (NULL == taosArrayPush(pTaskId, &pTask->taskId)) {
|
||||
taosArrayDestroy(pTaskId);
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
CTG_RET(ctgAsyncSendMsg(pCtg, pConn, pTask->pJob, pTaskId, -1, NULL, NULL, 0, reqType, msg, msgLen));
|
||||
|
@ -884,11 +884,11 @@ int32_t ctgGetDnodeListFromMnode(SCatalog* pCtg, SRequestConnInfo* pConn, SArray
|
|||
#else
|
||||
SArray* pTaskId = taosArrayInit(1, sizeof(int32_t));
|
||||
if (NULL == pTaskId) {
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
if (NULL == taosArrayPush(pTaskId, &pTask->taskId)) {
|
||||
taosArrayDestroy(pTaskId);
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
CTG_RET(ctgAsyncSendMsg(pCtg, pConn, pTask->pJob, pTaskId, -1, NULL, NULL, 0, reqType, msg, msgLen));
|
||||
|
@ -940,11 +940,11 @@ int32_t ctgGetDBVgInfoFromMnode(SCatalog* pCtg, SRequestConnInfo* pConn, SBuildU
|
|||
#else
|
||||
SArray* pTaskId = taosArrayInit(1, sizeof(int32_t));
|
||||
if (NULL == pTaskId) {
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
if (NULL == taosArrayPush(pTaskId, &pTask->taskId)) {
|
||||
taosArrayDestroy(pTaskId);
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
CTG_RET(ctgAsyncSendMsg(pCtg, pConn, pTask->pJob, pTaskId, -1, NULL, NULL, 0, reqType, msg, msgLen));
|
||||
|
@ -998,11 +998,11 @@ int32_t ctgGetDBCfgFromMnode(SCatalog* pCtg, SRequestConnInfo* pConn, const char
|
|||
#else
|
||||
SArray* pTaskId = taosArrayInit(1, sizeof(int32_t));
|
||||
if (NULL == pTaskId) {
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
if (NULL == taosArrayPush(pTaskId, &pTask->taskId)) {
|
||||
taosArrayDestroy(pTaskId);
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
CTG_RET(ctgAsyncSendMsg(pCtg, pConn, pTask->pJob, pTaskId, -1, NULL, NULL, 0, reqType, msg, msgLen));
|
||||
|
@ -1056,11 +1056,11 @@ int32_t ctgGetIndexInfoFromMnode(SCatalog* pCtg, SRequestConnInfo* pConn, const
|
|||
#else
|
||||
SArray* pTaskId = taosArrayInit(1, sizeof(int32_t));
|
||||
if (NULL == pTaskId) {
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
if (NULL == taosArrayPush(pTaskId, &pTask->taskId)) {
|
||||
taosArrayDestroy(pTaskId);
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
CTG_RET(ctgAsyncSendMsg(pCtg, pConn, pTask->pJob, pTaskId, -1, NULL, NULL, 0, reqType, msg, msgLen));
|
||||
|
@ -1121,11 +1121,11 @@ int32_t ctgGetTbIndexFromMnode(SCatalog* pCtg, SRequestConnInfo* pConn, SName* n
|
|||
#else
|
||||
SArray* pTaskId = taosArrayInit(1, sizeof(int32_t));
|
||||
if (NULL == pTaskId) {
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
if (NULL == taosArrayPush(pTaskId, &pTask->taskId)) {
|
||||
taosArrayDestroy(pTaskId);
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
CTG_RET(ctgAsyncSendMsg(pCtg, pConn, pTask->pJob, pTaskId, -1, NULL, NULL, 0, reqType, msg, msgLen));
|
||||
|
@ -1179,11 +1179,11 @@ int32_t ctgGetUdfInfoFromMnode(SCatalog* pCtg, SRequestConnInfo* pConn, const ch
|
|||
#else
|
||||
SArray* pTaskId = taosArrayInit(1, sizeof(int32_t));
|
||||
if (NULL == pTaskId) {
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
if (NULL == taosArrayPush(pTaskId, &pTask->taskId)) {
|
||||
taosArrayDestroy(pTaskId);
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
CTG_RET(ctgAsyncSendMsg(pCtg, pConn, pTask->pJob, pTaskId, -1, NULL, NULL, 0, reqType, msg, msgLen));
|
||||
|
@ -1237,11 +1237,11 @@ int32_t ctgGetUserDbAuthFromMnode(SCatalog* pCtg, SRequestConnInfo* pConn, const
|
|||
#else
|
||||
SArray* pTaskId = taosArrayInit(1, sizeof(int32_t));
|
||||
if (NULL == pTaskId) {
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
if (NULL == taosArrayPush(pTaskId, &pTask->taskId)) {
|
||||
taosArrayDestroy(pTaskId);
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
CTG_RET(ctgAsyncSendMsg(pCtg, pConn, pTask->pJob, pTaskId, -1, NULL, NULL, 0, reqType, msg, msgLen));
|
||||
|
@ -1297,11 +1297,11 @@ int32_t ctgGetTbMetaFromMnodeImpl(SCatalog* pCtg, SRequestConnInfo* pConn, const
|
|||
#else
|
||||
SArray* pTaskId = taosArrayInit(1, sizeof(int32_t));
|
||||
if (NULL == pTaskId) {
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
if (NULL == taosArrayPush(pTaskId, &pTask->taskId)) {
|
||||
taosArrayDestroy(pTaskId);
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
CTG_RET(ctgAsyncSendMsg(pCtg, pConn, pTask->pJob, pTaskId, -1, NULL, NULL, 0, reqType, msg, msgLen));
|
||||
|
@ -1378,11 +1378,11 @@ int32_t ctgGetTbMetaFromVnode(SCatalog* pCtg, SRequestConnInfo* pConn, const SNa
|
|||
(void)tNameGetFullDbName(ctx->pName, dbFName);
|
||||
SArray* pTaskId = taosArrayInit(1, sizeof(int32_t));
|
||||
if (NULL == pTaskId) {
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
if (NULL == taosArrayPush(pTaskId, &pTask->taskId)) {
|
||||
taosArrayDestroy(pTaskId);
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
CTG_RET(ctgAsyncSendMsg(pCtg, &vConn, pTask->pJob, pTaskId, -1, NULL, dbFName, ctx->vgId, reqType, msg, msgLen));
|
||||
|
@ -1451,11 +1451,11 @@ int32_t ctgGetTableCfgFromVnode(SCatalog* pCtg, SRequestConnInfo* pConn, const S
|
|||
(void)tNameGetFullDbName(ctx->pName, dbFName);
|
||||
SArray* pTaskId = taosArrayInit(1, sizeof(int32_t));
|
||||
if (NULL == pTaskId) {
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
if (NULL == taosArrayPush(pTaskId, &pTask->taskId)) {
|
||||
taosArrayDestroy(pTaskId);
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
CTG_RET(ctgAsyncSendMsg(pCtg, &vConn, pTask->pJob, pTaskId, -1, NULL, dbFName, ctx->pVgInfo->vgId, reqType, msg,
|
||||
|
@ -1515,11 +1515,11 @@ int32_t ctgGetTableCfgFromMnode(SCatalog* pCtg, SRequestConnInfo* pConn, const S
|
|||
#else
|
||||
SArray* pTaskId = taosArrayInit(1, sizeof(int32_t));
|
||||
if (NULL == pTaskId) {
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
if (NULL == taosArrayPush(pTaskId, &pTask->taskId)) {
|
||||
taosArrayDestroy(pTaskId);
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
CTG_RET(ctgAsyncSendMsg(pCtg, pConn, pTask->pJob, pTaskId, -1, NULL, NULL, 0, reqType, msg, msgLen));
|
||||
|
@ -1567,11 +1567,11 @@ int32_t ctgGetSvrVerFromMnode(SCatalog* pCtg, SRequestConnInfo* pConn, char** ou
|
|||
#else
|
||||
SArray* pTaskId = taosArrayInit(1, sizeof(int32_t));
|
||||
if (NULL == pTaskId) {
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
if (NULL == taosArrayPush(pTaskId, &pTask->taskId)) {
|
||||
taosArrayDestroy(pTaskId);
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
CTG_RET(ctgAsyncSendMsg(pCtg, pConn, pTask->pJob, pTaskId, -1, NULL, NULL, 0, reqType, msg, msgLen));
|
||||
|
@ -1629,11 +1629,11 @@ int32_t ctgGetViewInfoFromMnode(SCatalog* pCtg, SRequestConnInfo* pConn, SName*
|
|||
#else
|
||||
SArray* pTaskId = taosArrayInit(1, sizeof(int32_t));
|
||||
if (NULL == pTaskId) {
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
if (NULL == taosArrayPush(pTaskId, &pTask->taskId)) {
|
||||
taosArrayDestroy(pTaskId);
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
CTG_RET(ctgAsyncSendMsg(pCtg, pConn, pTask->pJob, pTaskId, -1, NULL, NULL, 0, reqType, msg, msgLen));
|
||||
|
@ -1690,11 +1690,11 @@ int32_t ctgGetTbTSMAFromMnode(SCatalog* pCtg, SRequestConnInfo* pConn, const SNa
|
|||
#else
|
||||
SArray* pTaskId = taosArrayInit(1, sizeof(int32_t));
|
||||
if (NULL == pTaskId) {
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
if (NULL == taosArrayPush(pTaskId, &pTask->taskId)) {
|
||||
taosArrayDestroy(pTaskId);
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
CTG_RET(ctgAsyncSendMsg(pCtg, pConn, pTask->pJob, pTaskId, -1, NULL, NULL, 0, reqType, msg, msgLen));
|
||||
|
@ -1761,11 +1761,11 @@ int32_t ctgGetStreamProgressFromVnode(SCatalog* pCtg, SRequestConnInfo* pConn, c
|
|||
(void)tNameGetFullDbName(pTbName, dbFName);
|
||||
SArray* pTaskId = taosArrayInit(1, sizeof(int32_t));
|
||||
if (NULL == pTaskId) {
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
if (NULL == taosArrayPush(pTaskId, &pTask->taskId)) {
|
||||
taosArrayDestroy(pTaskId);
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
CTG_RET(
|
||||
|
|
|
@ -52,13 +52,13 @@ int32_t ctgMetaRentAdd(SCtgRentMgmt *mgmt, void *meta, int64_t id, int32_t size)
|
|||
if (NULL == slot->meta) {
|
||||
qError("taosArrayInit %d failed, id:0x%" PRIx64 ", slot idx:%d, type:%d", CTG_DEFAULT_RENT_SLOT_SIZE, id, widx,
|
||||
mgmt->type);
|
||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_JRET(terrno);
|
||||
}
|
||||
}
|
||||
|
||||
if (NULL == taosArrayPush(slot->meta, meta)) {
|
||||
qError("taosArrayPush meta to rent failed, id:0x%" PRIx64 ", slot idx:%d, type:%d", id, widx, mgmt->type);
|
||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_JRET(terrno);
|
||||
}
|
||||
|
||||
mgmt->rentCacheSize += size;
|
||||
|
@ -181,7 +181,7 @@ int32_t ctgMetaRentGetImpl(SCtgRentMgmt *mgmt, void **res, uint32_t *num, int32_
|
|||
*res = taosMemoryMalloc(msize);
|
||||
if (NULL == *res) {
|
||||
qError("malloc %d failed", (int32_t)msize);
|
||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_JRET(terrno);
|
||||
}
|
||||
|
||||
void *meta = taosArrayGet(slot->meta, 0);
|
||||
|
|
|
@ -1098,7 +1098,7 @@ int32_t ctgAddMsgCtx(SArray* pCtxs, int32_t reqType, void* out, char* target) {
|
|||
|
||||
if (NULL == taosArrayPush(pCtxs, &ctx)) {
|
||||
ctgFreeMsgCtx(&ctx);
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
return TSDB_CODE_SUCCESS;
|
||||
|
@ -1124,7 +1124,7 @@ int32_t ctgGenerateVgList(SCatalog* pCtg, SHashObj* vgHash, SArray** pList) {
|
|||
vgList = taosArrayInit(vgNum, sizeof(SVgroupInfo));
|
||||
if (NULL == vgList) {
|
||||
ctgError("taosArrayInit failed, num:%d", vgNum);
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
void* pIter = taosHashIterate(vgHash, NULL);
|
||||
|
@ -1134,7 +1134,7 @@ int32_t ctgGenerateVgList(SCatalog* pCtg, SHashObj* vgHash, SArray** pList) {
|
|||
if (NULL == taosArrayPush(vgList, vgInfo)) {
|
||||
ctgError("taosArrayPush failed, vgId:%d", vgInfo->vgId);
|
||||
taosHashCancelIterate(vgHash, pIter);
|
||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_JRET(terrno);
|
||||
}
|
||||
|
||||
pIter = taosHashIterate(vgHash, pIter);
|
||||
|
@ -1267,7 +1267,7 @@ int32_t ctgGetVgInfosFromHashValue(SCatalog* pCtg, SEpSet* pMgmgEpSet, SCtgTaskR
|
|||
for (int32_t i = 0; i < tbNum; ++i) {
|
||||
vgInfo = taosMemoryMalloc(sizeof(SVgroupInfo));
|
||||
if (NULL == vgInfo) {
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
TAOS_MEMCPY(vgInfo, &mgmtInfo, sizeof(mgmtInfo));
|
||||
|
@ -1292,7 +1292,7 @@ int32_t ctgGetVgInfosFromHashValue(SCatalog* pCtg, SEpSet* pMgmgEpSet, SCtgTaskR
|
|||
} else {
|
||||
res.pRes = vgInfo;
|
||||
if (NULL == taosArrayPush(pCtx->pResList, &res)) {
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1310,7 +1310,7 @@ int32_t ctgGetVgInfosFromHashValue(SCatalog* pCtg, SEpSet* pMgmgEpSet, SCtgTaskR
|
|||
for (int32_t i = 0; i < tbNum; ++i) {
|
||||
vgInfo = taosMemoryMalloc(sizeof(SVgroupInfo));
|
||||
if (NULL == vgInfo) {
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
SVgroupInfo* pSrcVg = (SVgroupInfo*)taosArrayGet(dbInfo->vgArray, 0);
|
||||
|
@ -1341,7 +1341,7 @@ int32_t ctgGetVgInfosFromHashValue(SCatalog* pCtg, SEpSet* pMgmgEpSet, SCtgTaskR
|
|||
} else {
|
||||
res.pRes = vgInfo;
|
||||
if (NULL == taosArrayPush(pCtx->pResList, &res)) {
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1377,7 +1377,7 @@ int32_t ctgGetVgInfosFromHashValue(SCatalog* pCtg, SEpSet* pMgmgEpSet, SCtgTaskR
|
|||
|
||||
SVgroupInfo* pNewVg = taosMemoryMalloc(sizeof(SVgroupInfo));
|
||||
if (NULL == pNewVg) {
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
*pNewVg = *vgInfo;
|
||||
|
@ -1403,7 +1403,7 @@ int32_t ctgGetVgInfosFromHashValue(SCatalog* pCtg, SEpSet* pMgmgEpSet, SCtgTaskR
|
|||
} else {
|
||||
res.pRes = pNewVg;
|
||||
if (NULL == taosArrayPush(pCtx->pResList, &res)) {
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1535,14 +1535,14 @@ int32_t ctgMakeVgArray(SDBVgInfo* dbInfo) {
|
|||
if (dbInfo->vgHash && NULL == dbInfo->vgArray) {
|
||||
dbInfo->vgArray = taosArrayInit(100, sizeof(SVgroupInfo));
|
||||
if (NULL == dbInfo->vgArray) {
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
void* pIter = taosHashIterate(dbInfo->vgHash, NULL);
|
||||
while (pIter) {
|
||||
if (NULL == taosArrayPush(dbInfo->vgArray, pIter)) {
|
||||
taosHashCancelIterate(dbInfo->vgHash, pIter);
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
pIter = taosHashIterate(dbInfo->vgHash, pIter);
|
||||
|
@ -1560,7 +1560,7 @@ int32_t ctgCloneVgInfo(SDBVgInfo* src, SDBVgInfo** dst) {
|
|||
*dst = taosMemoryMalloc(sizeof(SDBVgInfo));
|
||||
if (NULL == *dst) {
|
||||
qError("malloc %d failed", (int32_t)sizeof(SDBVgInfo));
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
TAOS_MEMCPY(*dst, src, sizeof(SDBVgInfo));
|
||||
|
@ -1570,7 +1570,7 @@ int32_t ctgCloneVgInfo(SDBVgInfo* src, SDBVgInfo** dst) {
|
|||
if (NULL == (*dst)->vgHash) {
|
||||
qError("taosHashInit %d failed", (int32_t)hashSize);
|
||||
taosMemoryFreeClear(*dst);
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
int32_t* vgId = NULL;
|
||||
|
@ -1605,7 +1605,7 @@ int32_t ctgCloneMetaOutput(STableMetaOutput* output, STableMetaOutput** pOutput)
|
|||
*pOutput = taosMemoryMalloc(sizeof(STableMetaOutput));
|
||||
if (NULL == *pOutput) {
|
||||
qError("malloc %d failed", (int32_t)sizeof(STableMetaOutput));
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
TAOS_MEMCPY(*pOutput, output, sizeof(STableMetaOutput));
|
||||
|
@ -1622,7 +1622,7 @@ int32_t ctgCloneMetaOutput(STableMetaOutput* output, STableMetaOutput** pOutput)
|
|||
if (NULL == (*pOutput)->tbMeta) {
|
||||
qError("malloc %d failed", (int32_t)sizeof(STableMetaOutput));
|
||||
taosMemoryFreeClear(*pOutput);
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
TAOS_MEMCPY((*pOutput)->tbMeta, output->tbMeta, metaSize);
|
||||
|
@ -1646,7 +1646,7 @@ int32_t ctgCloneTableIndex(SArray* pIndex, SArray** pRes) {
|
|||
int32_t num = taosArrayGetSize(pIndex);
|
||||
*pRes = taosArrayInit(num, sizeof(STableIndexInfo));
|
||||
if (NULL == *pRes) {
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
for (int32_t i = 0; i < num; ++i) {
|
||||
|
@ -1657,7 +1657,7 @@ int32_t ctgCloneTableIndex(SArray* pIndex, SArray** pRes) {
|
|||
}
|
||||
pInfo = taosArrayPush(*pRes, pInfo);
|
||||
if (NULL == pInfo) {
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
pInfo->expr = taosStrdup(pInfo->expr);
|
||||
if (NULL == pInfo->expr) {
|
||||
|
@ -1707,7 +1707,7 @@ int32_t ctgAddFetch(SArray** pFetchs, int32_t dbIdx, int32_t tbIdx, int32_t* fet
|
|||
if (NULL == (*pFetchs)) {
|
||||
*pFetchs = taosArrayInit(CTG_DEFAULT_FETCH_NUM, sizeof(SCtgFetch));
|
||||
if (NULL == *pFetchs) {
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1719,7 +1719,7 @@ int32_t ctgAddFetch(SArray** pFetchs, int32_t dbIdx, int32_t tbIdx, int32_t* fet
|
|||
fetch.flag = flag;
|
||||
|
||||
if (NULL == taosArrayPush(*pFetchs, &fetch)) {
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
return TSDB_CODE_SUCCESS;
|
||||
|
@ -2579,7 +2579,7 @@ int32_t ctgBuildViewNullRes(SCtgTask* pTask, SCtgViewsCtx* pCtx) {
|
|||
|
||||
for (int32_t m = 0; m < viewNum; ++m) {
|
||||
if (NULL == taosArrayPush(pCtx->pResList, &(SMetaData){0})) {
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2603,7 +2603,7 @@ int32_t dupViewMetaFromRsp(SViewMetaRsp* pRsp, SViewMeta* pViewMeta) {
|
|||
pViewMeta->numOfCols = pRsp->numOfCols;
|
||||
pViewMeta->pSchema = taosMemoryMalloc(pViewMeta->numOfCols * sizeof(SSchema));
|
||||
if (pViewMeta->pSchema == NULL) {
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
TAOS_MEMCPY(pViewMeta->pSchema, pRsp->pSchema, pViewMeta->numOfCols * sizeof(SSchema));
|
||||
|
@ -2679,7 +2679,7 @@ int32_t ctgAddTSMAFetch(SArray** pFetchs, int32_t dbIdx, int32_t tbIdx, int32_t*
|
|||
if (NULL == (*pFetchs)) {
|
||||
*pFetchs = taosArrayInit(CTG_DEFAULT_FETCH_NUM, sizeof(SCtgTSMAFetch));
|
||||
if (NULL == *pFetchs) {
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2696,7 +2696,7 @@ int32_t ctgAddTSMAFetch(SArray** pFetchs, int32_t dbIdx, int32_t tbIdx, int32_t*
|
|||
}
|
||||
|
||||
if (NULL == taosArrayPush(*pFetchs, &fetch)) {
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
return TSDB_CODE_SUCCESS;
|
||||
|
|
|
@ -692,7 +692,7 @@ static int32_t setCreateTBResultIntoDataBlock(SSDataBlock* pBlock, SDbCfgInfo* p
|
|||
SColumnInfoData* pCol2 = taosArrayGet(pBlock->pDataBlock, 1);
|
||||
char* buf2 = taosMemoryMalloc(SHOW_CREATE_TB_RESULT_FIELD2_LEN);
|
||||
if (NULL == buf2) {
|
||||
QRY_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
QRY_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
int32_t len = 0;
|
||||
|
@ -864,7 +864,7 @@ static int32_t buildLocalVariablesResultDataBlock(SSDataBlock** pOutput) {
|
|||
pBlock->pDataBlock = taosArrayInit(SHOW_LOCAL_VARIABLES_RESULT_COLS, sizeof(SColumnInfoData));
|
||||
if (NULL == pBlock->pDataBlock) {
|
||||
taosMemoryFree(pBlock);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
SColumnInfoData infoData = {0};
|
||||
|
|
|
@ -135,7 +135,7 @@ int32_t qExplainInitCtx(SExplainCtx **pCtx, SHashObj *groupHash, bool verbose, d
|
|||
char *tbuf = taosMemoryMalloc(TSDB_EXPLAIN_RESULT_ROW_SIZE);
|
||||
if (NULL == tbuf) {
|
||||
qError("malloc size %d failed", TSDB_EXPLAIN_RESULT_ROW_SIZE);
|
||||
QRY_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
QRY_ERR_JRET(terrno);
|
||||
}
|
||||
|
||||
ctx->mode = mode;
|
||||
|
@ -184,7 +184,7 @@ int32_t qExplainGenerateResNodeExecInfo(SPhysiNode *pNode, SArray **pExecInfo, S
|
|||
*pExecInfo = taosArrayInit(group->nodeNum, sizeof(SExplainExecInfo));
|
||||
if (NULL == (*pExecInfo)) {
|
||||
qError("taosArrayInit %d explainExecInfo failed", group->nodeNum);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
SExplainRsp *rsp = NULL;
|
||||
|
@ -302,7 +302,7 @@ int32_t qExplainResAppendRow(SExplainCtx *ctx, char *tbuf, int32_t len, int32_t
|
|||
row.buf = taosMemoryMalloc(len);
|
||||
if (NULL == row.buf) {
|
||||
qError("taosMemoryMalloc %d failed", len);
|
||||
QRY_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
QRY_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
memcpy(row.buf, tbuf, len);
|
||||
|
@ -313,7 +313,7 @@ int32_t qExplainResAppendRow(SExplainCtx *ctx, char *tbuf, int32_t len, int32_t
|
|||
if (NULL == taosArrayPush(ctx->rows, &row)) {
|
||||
qError("taosArrayPush row to explain res rows failed");
|
||||
taosMemoryFree(row.buf);
|
||||
QRY_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
QRY_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
return TSDB_CODE_SUCCESS;
|
||||
|
@ -1971,7 +1971,7 @@ int32_t qExplainGetRspFromCtx(void *ctx, SRetrieveTableRsp **pRsp) {
|
|||
SRetrieveTableRsp *rsp = (SRetrieveTableRsp *)taosMemoryCalloc(1, rspSize);
|
||||
if (NULL == rsp) {
|
||||
qError("malloc SRetrieveTableRsp failed, size:%d", rspSize);
|
||||
QRY_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
QRY_ERR_JRET(terrno);
|
||||
}
|
||||
|
||||
rsp->completed = 1;
|
||||
|
@ -2018,7 +2018,7 @@ int32_t qExplainPrepareCtx(SQueryPlan *pDag, SExplainCtx **pCtx) {
|
|||
taosHashInit(EXPLAIN_MAX_GROUP_NUM, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), false, HASH_NO_LOCK);
|
||||
if (NULL == groupHash) {
|
||||
qError("groupHash %d failed", EXPLAIN_MAX_GROUP_NUM);
|
||||
QRY_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
QRY_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
QRY_ERR_JRET(
|
||||
|
@ -2128,7 +2128,7 @@ int32_t qExplainUpdateExecInfo(SExplainCtx *pCtx, SExplainRsp *pRspMsg, int32_t
|
|||
group->nodeExecInfo = taosArrayInit(group->nodeNum, sizeof(SExplainRsp));
|
||||
if (NULL == group->nodeExecInfo) {
|
||||
qError("taosArrayInit %d explainExecInfo failed", group->nodeNum);
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
TAOS_CHECK_ERRNO(code);
|
||||
}
|
||||
|
||||
|
@ -2149,7 +2149,7 @@ int32_t qExplainUpdateExecInfo(SExplainCtx *pCtx, SExplainRsp *pRspMsg, int32_t
|
|||
|
||||
if(taosArrayPush(group->nodeExecInfo, pRspMsg) == NULL)
|
||||
{
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
TAOS_CHECK_ERRNO(code);
|
||||
}
|
||||
|
||||
|
|
|
@ -208,7 +208,7 @@ static SSDataBlock* doLoadRemoteDataImpl(SOperatorInfo* pOperator) {
|
|||
if (p != NULL) {
|
||||
void* tmp = taosArrayPush(pExchangeInfo->pRecycledBlocks, &p);
|
||||
if (!tmp) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
qError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(code));
|
||||
pTaskInfo->code = code;
|
||||
T_LONG_JMP(pTaskInfo->env, code);
|
||||
|
@ -308,7 +308,7 @@ _end:
|
|||
static int32_t initDataSource(int32_t numOfSources, SExchangeInfo* pInfo, const char* id) {
|
||||
pInfo->pSourceDataInfo = taosArrayInit(numOfSources, sizeof(SSourceDataInfo));
|
||||
if (pInfo->pSourceDataInfo == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
if (pInfo->dynamicOp) {
|
||||
|
@ -329,7 +329,7 @@ static int32_t initDataSource(int32_t numOfSources, SExchangeInfo* pInfo, const
|
|||
SSourceDataInfo* pDs = taosArrayPush(pInfo->pSourceDataInfo, &dataInfo);
|
||||
if (pDs == NULL) {
|
||||
taosArrayDestroyEx(pInfo->pSourceDataInfo, freeSourceDataInfo);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -355,7 +355,7 @@ static int32_t initExchangeOperator(SExchangePhysiNode* pExNode, SExchangeInfo*
|
|||
pInfo->pSources = taosArrayInit(numOfSources, sizeof(SDownstreamSourceNode));
|
||||
if (pInfo->pSources == NULL) {
|
||||
qError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(TSDB_CODE_OUT_OF_MEMORY));
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
if (pExNode->node.dynamicOp) {
|
||||
|
@ -375,7 +375,7 @@ static int32_t initExchangeOperator(SExchangePhysiNode* pExNode, SExchangeInfo*
|
|||
void* tmp = taosArrayPush(pInfo->pSources, pNode);
|
||||
if (!tmp) {
|
||||
qError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(terrno));
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
SExchangeSrcIndex idx = {.srcIdx = i, .inUseIdx = -1};
|
||||
int32_t code =
|
||||
|
@ -579,13 +579,13 @@ int32_t loadRemoteDataCallback(void* param, SDataBuf* pMsg, int32_t code) {
|
|||
int32_t buildTableScanOperatorParam(SOperatorParam** ppRes, SArray* pUidList, int32_t srcOpType, bool tableSeq) {
|
||||
*ppRes = taosMemoryMalloc(sizeof(SOperatorParam));
|
||||
if (NULL == *ppRes) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
STableScanOperatorParam* pScan = taosMemoryMalloc(sizeof(STableScanOperatorParam));
|
||||
if (NULL == pScan) {
|
||||
taosMemoryFreeClear(*ppRes);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
pScan->pUidList = taosArrayDup(pUidList, NULL);
|
||||
|
@ -1045,7 +1045,7 @@ int32_t addSingleExchangeSource(SOperatorInfo* pOperator, SExchangeOperatorBasic
|
|||
void* tmp = taosArrayPush(pExchangeInfo->pSourceDataInfo, &dataInfo);
|
||||
if (!tmp) {
|
||||
qError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(TSDB_CODE_OUT_OF_MEMORY));
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
pIdx->inUseIdx = taosArrayGetSize(pExchangeInfo->pSourceDataInfo) - 1;
|
||||
} else {
|
||||
|
|
|
@ -622,14 +622,14 @@ int32_t getColInfoResultForGroupby(void* pVnode, SNodeList* group, STableListInf
|
|||
tagFilterAssist ctx = {0};
|
||||
ctx.colHash = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_SMALLINT), false, HASH_NO_LOCK);
|
||||
if (ctx.colHash == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto end;
|
||||
}
|
||||
|
||||
ctx.index = 0;
|
||||
ctx.cInfoList = taosArrayInit(4, sizeof(SColumnInfo));
|
||||
if (ctx.cInfoList == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto end;
|
||||
}
|
||||
|
||||
|
@ -766,7 +766,7 @@ int32_t getColInfoResultForGroupby(void* pVnode, SNodeList* group, STableListInf
|
|||
pTableListInfo->remainGroups =
|
||||
taosHashInit(rows, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_NO_LOCK);
|
||||
if (pTableListInfo->remainGroups == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
@ -1024,7 +1024,7 @@ static int32_t optimizeTbnameInCondImpl(void* pVnode, SArray* pExistedUidList, S
|
|||
uHash = taosHashInit(numOfExisted / 0.7, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_NO_LOCK);
|
||||
if (!uHash) {
|
||||
qError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(TSDB_CODE_OUT_OF_MEMORY));
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
for (int i = 0; i < numOfExisted; i++) {
|
||||
|
@ -1052,7 +1052,7 @@ static int32_t optimizeTbnameInCondImpl(void* pVnode, SArray* pExistedUidList, S
|
|||
STUidTagInfo s = {.uid = uid, .name = name, .pTagVal = NULL};
|
||||
void* tmp = taosArrayPush(pExistedUidList, &s);
|
||||
if (!tmp) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -1193,13 +1193,13 @@ static int32_t doSetQualifiedUid(STableListInfo* pListInfo, SArray* pUidList, co
|
|||
info.uid = uid;
|
||||
void* p = taosArrayPush(pListInfo->pTableList, &info);
|
||||
if (p == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
if (addUid) {
|
||||
void* tmp = taosArrayPush(pUidList, &uid);
|
||||
if (tmp == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1465,7 +1465,7 @@ _end:
|
|||
void* p = taosArrayPush(pListInfo->pTableList, &info);
|
||||
if (p == NULL) {
|
||||
taosArrayDestroy(pUidList);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
qTrace("tagfilter get uid:%" PRIu64 ", %s", info.uid, idstr);
|
||||
|
@ -1652,7 +1652,7 @@ int32_t extractColMatchInfo(SNodeList* pNodeList, SDataBlockDescNode* pOutputNod
|
|||
|
||||
SArray* pList = taosArrayInit(numOfCols, sizeof(SColMatchItem));
|
||||
if (pList == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
return code;
|
||||
}
|
||||
|
||||
|
@ -2643,7 +2643,7 @@ static int32_t sortTableGroup(STableListInfo* pTableListInfo) {
|
|||
pTableListInfo->groupOffset = taosMemoryMalloc(sizeof(int32_t) * pTableListInfo->numOfOuputGroups);
|
||||
if (pTableListInfo->groupOffset == NULL) {
|
||||
taosArrayDestroy(pList);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
memcpy(pTableListInfo->groupOffset, taosArrayGet(pList, 0), sizeof(int32_t) * pTableListInfo->numOfOuputGroups);
|
||||
|
@ -2666,7 +2666,7 @@ int32_t buildGroupIdMapForAllTables(STableListInfo* pTableListInfo, SReadHandle*
|
|||
pTableListInfo->remainGroups =
|
||||
taosHashInit(numOfTables, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_NO_LOCK);
|
||||
if (pTableListInfo->remainGroups == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
for (int i = 0; i < numOfTables; i++) {
|
||||
|
|
|
@ -488,7 +488,7 @@ int32_t qUpdateTableListForStreamScanner(qTaskInfo_t tinfo, const SArray* tableI
|
|||
keyBuf = taosMemoryMalloc(bufLen);
|
||||
if (keyBuf == NULL) {
|
||||
taosArrayDestroy(qa);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -877,7 +877,7 @@ int32_t qAppendTaskStopInfo(SExecTaskInfo* pTaskInfo, SExchangeOpStopInfo* pInfo
|
|||
|
||||
if (!tmp) {
|
||||
qError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(TSDB_CODE_OUT_OF_MEMORY));
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -1137,7 +1137,7 @@ int32_t createDataSinkParam(SDataSinkNode* pNode, void** pParam, SExecTaskInfo*
|
|||
pDeleterParam->pUidList = taosArrayInit(numOfTables, sizeof(uint64_t));
|
||||
if (NULL == pDeleterParam->pUidList) {
|
||||
taosMemoryFree(pDeleterParam);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
for (int32_t i = 0; i < numOfTables; ++i) {
|
||||
|
@ -1151,7 +1151,7 @@ int32_t createDataSinkParam(SDataSinkNode* pNode, void** pParam, SExecTaskInfo*
|
|||
if (!tmp) {
|
||||
taosArrayDestroy(pDeleterParam->pUidList);
|
||||
taosMemoryFree(pDeleterParam);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -403,7 +403,7 @@ static int32_t createPrimaryTsExprIfNeeded(SFillOperatorInfo* pInfo, SFillPhysiN
|
|||
|
||||
SExprInfo* pExpr = taosMemoryRealloc(pExprSupp->pExprInfo, (pExprSupp->numOfExprs + 1) * sizeof(SExprInfo));
|
||||
if (pExpr == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
int32_t code = createExprFromTargetNode(&pExpr[pExprSupp->numOfExprs], (STargetNode*)pPhyFillNode->pWStartTs);
|
||||
|
|
|
@ -45,7 +45,7 @@ static int32_t initGroupColsInfo(SGroupColsInfo* pCols, bool grpColsMayBeNull, S
|
|||
pCols->withNull = grpColsMayBeNull;
|
||||
pCols->pColsInfo = taosMemoryMalloc(pCols->colNum * sizeof(SGroupColInfo));
|
||||
if (NULL == pCols->pColsInfo) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
int32_t i = 0;
|
||||
|
@ -67,7 +67,7 @@ static int32_t initGroupColsInfo(SGroupColsInfo* pCols, bool grpColsMayBeNull, S
|
|||
if (pCols->colNum > 1) {
|
||||
pCols->pBuf = taosMemoryMalloc(pCols->bufSize);
|
||||
if (NULL == pCols->pBuf) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -227,7 +227,7 @@ static int32_t acquireFdFromFileCtx(SGcFileCacheCtx* pFileCtx, int32_t fileId, S
|
|||
if (NULL == pFileCtx->pCacheFile) {
|
||||
pFileCtx->pCacheFile = taosHashInit(10, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), false, HASH_ENTRY_LOCK);
|
||||
if (NULL == pFileCtx->pCacheFile) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
taosHashSetFreeFp(pFileCtx->pCacheFile, freeSGroupCacheFileInfo);
|
||||
}
|
||||
|
@ -461,7 +461,7 @@ static int32_t addBlkToBufCache(struct SOperatorInfo* pOperator, SSDataBlock* pB
|
|||
pBufInfo->pBuf = taosMemoryMalloc(bufSize);
|
||||
if (NULL == pBufInfo->pBuf) {
|
||||
qError("group cache add block to cache failed, size:%" PRId64, bufSize);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
QRY_ERR_RET(blockDataToBuf(pBufInfo->pBuf, pBlock));
|
||||
|
||||
|
@ -508,7 +508,7 @@ void blockDataDeepClear(SSDataBlock* pDataBlock) {
|
|||
static int32_t buildGroupCacheBaseBlock(SSDataBlock** ppDst, SSDataBlock* pSrc) {
|
||||
*ppDst = taosMemoryMalloc(sizeof(*pSrc));
|
||||
if (NULL == *ppDst) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
(*ppDst)->pBlockAgg = NULL;
|
||||
(*ppDst)->pDataBlock = taosArrayDup(pSrc->pDataBlock, NULL);
|
||||
|
@ -578,7 +578,7 @@ static int32_t readBlockFromDisk(SGroupCacheOperatorInfo* pGCache, SGroupCacheDa
|
|||
|
||||
*ppBuf = taosMemoryMalloc(pBasic->bufSize);
|
||||
if (NULL == *ppBuf) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _return;
|
||||
}
|
||||
|
||||
|
@ -643,7 +643,7 @@ static int32_t addNewGroupToVgHash(SOperatorInfo* pOperator, SSHashObj* pHash, S
|
|||
if (NULL == pVgCtx) {
|
||||
SArray* pList = taosArrayInit(10, sizeof(*pNew));
|
||||
if (NULL == pList) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
if (NULL == taosArrayPush(pList, pNew)) {
|
||||
QRY_ERR_RET(terrno);
|
||||
|
@ -798,7 +798,7 @@ static int32_t addFileRefTableNum(SGcFileCacheCtx* pFileCtx, int32_t fileId, int
|
|||
if (NULL == pFileCtx->pCacheFile) {
|
||||
pFileCtx->pCacheFile = taosHashInit(10, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), false, HASH_ENTRY_LOCK);
|
||||
if (NULL == pFileCtx->pCacheFile) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
taosHashSetFreeFp(pFileCtx->pCacheFile, freeSGroupCacheFileInfo);
|
||||
}
|
||||
|
@ -913,7 +913,7 @@ static int32_t addNewGroupData(struct SOperatorInfo* pOperator, SOperatorParam*
|
|||
taosWLockLatch(&pCtx->grpLock);
|
||||
if (NULL == taosArrayPush(pCtx->pNewGrpList, &newGroup)) {
|
||||
taosWUnLockLatch(&pCtx->grpLock);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
taosWUnLockLatch(&pCtx->grpLock);
|
||||
|
||||
|
@ -1248,12 +1248,12 @@ static int32_t initGroupCacheBlockCache(SGroupCacheOperatorInfo* pInfo) {
|
|||
SGcBlkCacheInfo* pCache = &pInfo->blkCache;
|
||||
pCache->pDirtyBlk = taosHashInit(10, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_ENTRY_LOCK);
|
||||
if (NULL == pCache->pDirtyBlk) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
taosHashSetFreeFp(pCache->pDirtyBlk, freeGcBlkBufInfo);
|
||||
pCache->pReadBlk = taosHashInit(10, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_ENTRY_LOCK);
|
||||
if (NULL == pCache->pReadBlk) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
pCache->writeDownstreamId = -1;
|
||||
|
||||
|
@ -1421,30 +1421,30 @@ static int32_t initGroupCacheDownstreamCtx(SOperatorInfo* pOperator) {
|
|||
|
||||
pCtx->pNewGrpList = taosArrayInit(10, sizeof(SGcNewGroupInfo));
|
||||
if (NULL == pCtx->pNewGrpList) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
if (!pInfo->globalGrp) {
|
||||
pCtx->pGrpHash = taosHashInit(32, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_ENTRY_LOCK);
|
||||
if (pCtx->pGrpHash == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
taosHashSetFreeFp(pCtx->pGrpHash, freeRemoveGroupCacheData);
|
||||
}
|
||||
|
||||
pCtx->pSessions = taosHashInit(20, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_ENTRY_LOCK);
|
||||
if (pCtx->pSessions == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
taosHashSetFreeFp(pCtx->pSessions, freeSGcSessionCtx);
|
||||
|
||||
pCtx->pFreeBlock = taosArrayInit(10, POINTER_BYTES);
|
||||
if (NULL == pCtx->pFreeBlock) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
pCtx->pWaitSessions = taosHashInit(20, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_ENTRY_LOCK);
|
||||
if (pCtx->pWaitSessions == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
(void)snprintf(pCtx->fileCtx.baseFilename, sizeof(pCtx->fileCtx.baseFilename) - 1, "%s/gc_%d_%" PRIx64 "_%" PRIu64 "_%d",
|
||||
|
@ -1539,7 +1539,7 @@ int32_t createGroupCacheOperatorInfo(SOperatorInfo** pDownstream, int32_t numOfD
|
|||
if (pInfo->globalGrp) {
|
||||
pInfo->pGrpHash = taosHashInit(32, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_ENTRY_LOCK);
|
||||
if (pInfo->pGrpHash == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _error;
|
||||
}
|
||||
taosHashSetFreeFp(pInfo->pGrpHash, freeRemoveGroupCacheData);
|
||||
|
|
|
@ -94,7 +94,7 @@ static void destroyGroupOperatorInfo(void* param) {
|
|||
static int32_t initGroupOptrInfo(SArray** pGroupColVals, int32_t* keyLen, char** keyBuf, const SArray* pGroupColList) {
|
||||
*pGroupColVals = taosArrayInit(4, sizeof(SGroupKeys));
|
||||
if ((*pGroupColVals) == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
int32_t numOfGroupCols = taosArrayGetSize(pGroupColList);
|
||||
|
@ -117,7 +117,7 @@ static int32_t initGroupOptrInfo(SArray** pGroupColVals, int32_t* keyLen, char**
|
|||
|
||||
void* tmp = taosArrayPush((*pGroupColVals), &key);
|
||||
if (!tmp) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1758,7 +1758,7 @@ int32_t extractColumnInfo(SNodeList* pNodeList, SArray** pArrayRes) {
|
|||
size_t numOfCols = LIST_LENGTH(pNodeList);
|
||||
SArray* pList = taosArrayInit(numOfCols, sizeof(SColumn));
|
||||
if (pList == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
(*pArrayRes) = NULL;
|
||||
QUERY_CHECK_CODE(code, lino, _end);
|
||||
}
|
||||
|
|
|
@ -155,7 +155,7 @@ static int32_t hJoinInitKeyColsInfo(SHJoinTableCtx* pTable, SNodeList* pList) {
|
|||
|
||||
pTable->keyCols = taosMemoryMalloc(pTable->keyNum * sizeof(SHJoinColInfo));
|
||||
if (NULL == pTable->keyCols) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
int64_t bufSize = 0;
|
||||
|
@ -173,7 +173,7 @@ static int32_t hJoinInitKeyColsInfo(SHJoinTableCtx* pTable, SNodeList* pList) {
|
|||
if (pTable->keyNum > 1) {
|
||||
pTable->keyBuf = taosMemoryMalloc(bufSize);
|
||||
if (NULL == pTable->keyBuf) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -212,7 +212,7 @@ static int32_t hJoinInitValColsInfo(SHJoinTableCtx* pTable, SNodeList* pList) {
|
|||
|
||||
pTable->valCols = taosMemoryMalloc(pTable->valNum * sizeof(SHJoinColInfo));
|
||||
if (NULL == pTable->valCols) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
int32_t i = 0;
|
||||
|
@ -260,7 +260,7 @@ static int32_t hJoinInitValColsInfo(SHJoinTableCtx* pTable, SNodeList* pList) {
|
|||
static int32_t hJoinInitPrimKeyInfo(SHJoinTableCtx* pTable, int32_t slotId) {
|
||||
pTable->primCol = taosMemoryMalloc(sizeof(SHJoinColMap));
|
||||
if (NULL == pTable->primCol) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
pTable->primCol->srcSlot = slotId;
|
||||
|
@ -413,7 +413,7 @@ static FORCE_INLINE int32_t hJoinAddPageToBufs(SArray* pRowBufs) {
|
|||
page.offset = 0;
|
||||
page.data = taosMemoryMalloc(page.pageSize);
|
||||
if (NULL == page.data) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
if (NULL == taosArrayPush(pRowBufs, &page)) {
|
||||
|
@ -425,7 +425,7 @@ static FORCE_INLINE int32_t hJoinAddPageToBufs(SArray* pRowBufs) {
|
|||
static int32_t hJoinInitBufPages(SHJoinOperatorInfo* pInfo) {
|
||||
pInfo->pRowBufs = taosArrayInit(32, sizeof(SBufPageInfo));
|
||||
if (NULL == pInfo->pRowBufs) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
return hJoinAddPageToBufs(pInfo->pRowBufs);
|
||||
|
@ -784,13 +784,13 @@ static int32_t hJoinAddRowToHashImpl(SHJoinOperatorInfo* pJoin, SGroupData* pGro
|
|||
if (NULL == pGroup) {
|
||||
group.rows = taosMemoryMalloc(sizeof(SBufRowInfo));
|
||||
if (NULL == group.rows) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
pRow = group.rows;
|
||||
} else {
|
||||
pRow = taosMemoryMalloc(sizeof(SBufRowInfo));
|
||||
if (NULL == pRow) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ int32_t doCreateTask(uint64_t queryId, uint64_t taskId, int32_t vgId, EOPTR_EXEC
|
|||
p->pResultBlockList = taosArrayInit(128, POINTER_BYTES);
|
||||
if (p->stopInfo.pStopInfo == NULL || p->pResultBlockList == NULL) {
|
||||
doDestroyTask(p);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
p->storageAPI = *pAPI;
|
||||
|
|
|
@ -191,7 +191,7 @@ static int32_t insertTableToScanIgnoreList(STableScanInfo* pTableScanInfo, uint6
|
|||
pTableScanInfo->pIgnoreTables =
|
||||
taosHashInit(tableNum, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), true, HASH_NO_LOCK);
|
||||
if (NULL == pTableScanInfo->pIgnoreTables) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1169,7 +1169,7 @@ static int32_t createTableListInfoFromParam(SOperatorInfo* pOperator) {
|
|||
info.uid = *pUid;
|
||||
void* p = taosArrayPush(pListInfo->pTableList, &info);
|
||||
if (p == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
tableIdx++;
|
||||
|
|
|
@ -582,7 +582,7 @@ int32_t deleteCountWinState(SStreamAggSupporter* pAggSup, SSDataBlock* pBlock, S
|
|||
int32_t lino = 0;
|
||||
SArray* pWins = taosArrayInit(16, sizeof(SSessionKey));
|
||||
if (!pWins) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
QUERY_CHECK_CODE(code, lino, _end);
|
||||
}
|
||||
|
||||
|
@ -880,7 +880,7 @@ int32_t createStreamCountAggOperatorInfo(SOperatorInfo* downstream, SPhysiNode*
|
|||
pInfo->dataVersion = 0;
|
||||
pInfo->historyWins = taosArrayInit(4, sizeof(SSessionKey));
|
||||
if (!pInfo->historyWins) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
QUERY_CHECK_CODE(code, lino, _error);
|
||||
}
|
||||
|
||||
|
|
|
@ -695,7 +695,7 @@ static int32_t doStreamEventAggNext(SOperatorInfo* pOperator, SSDataBlock** ppRe
|
|||
if (pInfo->isHistoryOp) {
|
||||
SArray* pHisWins = taosArrayInit(16, sizeof(SEventWindowInfo));
|
||||
if (!pHisWins) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
QUERY_CHECK_CODE(code, lino, _end);
|
||||
}
|
||||
|
||||
|
|
|
@ -858,7 +858,7 @@ static int32_t doDeleteFillResultImpl(SOperatorInfo* pOperator, TSKEY startTs, T
|
|||
};
|
||||
void* tmp = taosArrayPush(pInfo->pFillInfo->delRanges, &tw);
|
||||
if (!tmp) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
QUERY_CHECK_CODE(code, lino, _end);
|
||||
}
|
||||
}
|
||||
|
@ -1264,13 +1264,13 @@ SStreamFillInfo* initStreamFillInfo(SStreamFillSupporter* pFillSup, SSDataBlock*
|
|||
if (pFillSup->type == TSDB_FILL_LINEAR) {
|
||||
pFillInfo->pLinearInfo->pEndPoints = taosArrayInit(pFillSup->numOfAllCols, sizeof(SPoint));
|
||||
if (!pFillInfo->pLinearInfo->pEndPoints) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
QUERY_CHECK_CODE(code, lino, _end);
|
||||
}
|
||||
|
||||
pFillInfo->pLinearInfo->pNextEndPoints = taosArrayInit(pFillSup->numOfAllCols, sizeof(SPoint));
|
||||
if (!pFillInfo->pLinearInfo->pNextEndPoints) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
QUERY_CHECK_CODE(code, lino, _end);
|
||||
}
|
||||
|
||||
|
@ -1285,7 +1285,7 @@ SStreamFillInfo* initStreamFillInfo(SStreamFillSupporter* pFillSup, SSDataBlock*
|
|||
|
||||
void* tmpRes = taosArrayPush(pFillInfo->pLinearInfo->pEndPoints, &value);
|
||||
if (!tmpRes) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
QUERY_CHECK_CODE(code, lino, _end);
|
||||
}
|
||||
|
||||
|
@ -1297,7 +1297,7 @@ SStreamFillInfo* initStreamFillInfo(SStreamFillSupporter* pFillSup, SSDataBlock*
|
|||
|
||||
tmpRes = taosArrayPush(pFillInfo->pLinearInfo->pNextEndPoints, &value);
|
||||
if (!tmpRes) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
QUERY_CHECK_CODE(code, lino, _end);
|
||||
}
|
||||
}
|
||||
|
@ -1331,7 +1331,7 @@ SStreamFillInfo* initStreamFillInfo(SStreamFillSupporter* pFillSup, SSDataBlock*
|
|||
pFillInfo->type = pFillSup->type;
|
||||
pFillInfo->delRanges = taosArrayInit(16, sizeof(STimeRange));
|
||||
if (!pFillInfo->delRanges) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
QUERY_CHECK_CODE(code, lino, _end);
|
||||
}
|
||||
|
||||
|
|
|
@ -157,7 +157,7 @@ static int32_t savePullWindow(SPullWindowInfo* pPullInfo, SArray* pPullWins) {
|
|||
}
|
||||
}
|
||||
if (taosArrayInsert(pPullWins, index, pPullInfo) == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
@ -298,7 +298,7 @@ static int32_t doDeleteWindows(SOperatorInfo* pOperator, SInterval* pInterval, S
|
|||
if (pUpWins) {
|
||||
void* tmp = taosArrayPush(pUpWins, &winRes);
|
||||
if (!tmp) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
QUERY_CHECK_CODE(code, lino, _end);
|
||||
}
|
||||
}
|
||||
|
@ -683,7 +683,7 @@ int32_t addPullWindow(SHashObj* pMap, SWinKey* pWinRes, int32_t size) {
|
|||
for (int32_t i = 0; i < size; i++) {
|
||||
void* tmp = taosArrayPush(childIds, &i);
|
||||
if (!tmp) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
QUERY_CHECK_CODE(code, lino, _end);
|
||||
}
|
||||
}
|
||||
|
@ -819,13 +819,13 @@ static int32_t processPullOver(SSDataBlock* pBlock, SHashObj* pMap, SHashObj* pF
|
|||
|
||||
void* tmp = taosArrayPush(pInfo->pMidPullDatas, &winRes);
|
||||
if (!tmp) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
QUERY_CHECK_CODE(code, lino, _end);
|
||||
}
|
||||
} else if (savePullWindow(&pull, pPullWins) == TSDB_CODE_SUCCESS) {
|
||||
void* tmp = taosArrayPush(pInfo->pDelWins, &winRes);
|
||||
if (!tmp) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
QUERY_CHECK_CODE(code, lino, _end);
|
||||
}
|
||||
|
||||
|
@ -1302,7 +1302,7 @@ int32_t decodeSPullWindowInfoArray(void* buf, SArray* pPullInfos, void** ppBuf)
|
|||
buf = decodeSPullWindowInfo(buf, &item);
|
||||
void* tmp = taosArrayPush(pPullInfos, &item);
|
||||
if (!tmp) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
QUERY_CHECK_CODE(code, lino, _end);
|
||||
}
|
||||
}
|
||||
|
@ -1417,7 +1417,7 @@ void doStreamIntervalDecodeOpState(void* buf, int32_t len, SOperatorInfo* pOpera
|
|||
SWinKey key = {0};
|
||||
SArray* pArray = taosArrayInit(0, sizeof(int32_t));
|
||||
if (!pArray) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
QUERY_CHECK_CODE(code, lino, _end);
|
||||
}
|
||||
|
||||
|
@ -1429,7 +1429,7 @@ void doStreamIntervalDecodeOpState(void* buf, int32_t len, SOperatorInfo* pOpera
|
|||
buf = taosDecodeFixedI32(buf, &chId);
|
||||
void* tmp = taosArrayPush(pArray, &chId);
|
||||
if (!tmp) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
QUERY_CHECK_CODE(code, lino, _end);
|
||||
}
|
||||
}
|
||||
|
@ -1477,7 +1477,7 @@ static int32_t copyIntervalDeleteKey(SSHashObj* pMap, SArray* pWins) {
|
|||
void* pKey = tSimpleHashGetKey(pIte, NULL);
|
||||
void* tmp = taosArrayPush(pWins, pKey);
|
||||
if (!tmp) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
QUERY_CHECK_CODE(code, lino, _end);
|
||||
}
|
||||
}
|
||||
|
@ -1539,7 +1539,7 @@ int32_t copyUpdateResult(SSHashObj** ppWinUpdated, SArray* pUpdated, __compar_fn
|
|||
while ((pIte = tSimpleHashIterate(*ppWinUpdated, pIte, &iter)) != NULL) {
|
||||
void* tmp = taosArrayPush(pUpdated, pIte);
|
||||
if (!tmp) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
QUERY_CHECK_CODE(code, lino, _end);
|
||||
}
|
||||
}
|
||||
|
@ -2315,7 +2315,7 @@ int32_t saveDeleteInfo(SArray* pWins, SSessionKey key) {
|
|||
int32_t lino = 0;
|
||||
void* res = taosArrayPush(pWins, &key);
|
||||
if (!res) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
QUERY_CHECK_CODE(code, lino, _end);
|
||||
}
|
||||
|
||||
|
@ -3159,7 +3159,7 @@ int32_t getMaxTsWins(const SArray* pAllWins, SArray* pMaxWins) {
|
|||
SSessionKey* pSeKey = &pWinInfo->sessionWin;
|
||||
void* tmp = taosArrayPush(pMaxWins, pSeKey);
|
||||
if (!tmp) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
QUERY_CHECK_CODE(code, lino, _end);
|
||||
}
|
||||
|
||||
|
@ -3173,7 +3173,7 @@ int32_t getMaxTsWins(const SArray* pAllWins, SArray* pMaxWins) {
|
|||
if (preGpId != pSeKey->groupId) {
|
||||
void* tmp = taosArrayPush(pMaxWins, pSeKey);
|
||||
if (!tmp) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
QUERY_CHECK_CODE(code, lino, _end);
|
||||
}
|
||||
preGpId = pSeKey->groupId;
|
||||
|
@ -3910,7 +3910,7 @@ int32_t deleteSessionWinState(SStreamAggSupporter* pAggSup, SSDataBlock* pBlock,
|
|||
int32_t lino = 0;
|
||||
SArray* pWins = taosArrayInit(16, sizeof(SSessionKey));
|
||||
if (!pWins) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
QUERY_CHECK_CODE(code, lino, _end);
|
||||
}
|
||||
code = doDeleteTimeWindows(pAggSup, pBlock, pWins);
|
||||
|
@ -4127,7 +4127,7 @@ int32_t createStreamFinalSessionAggOperatorInfo(SOperatorInfo* downstream, SPhys
|
|||
pAPI->stateStore.streamStateSetNumber(pChInfo->streamAggSup.pState, i, pInfo->primaryTsIndex);
|
||||
void* tmp = taosArrayPush(pInfo->pChildren, &pChildOp);
|
||||
if (!tmp) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
QUERY_CHECK_CODE(code, lino, _error);
|
||||
}
|
||||
}
|
||||
|
@ -5223,7 +5223,7 @@ static int32_t doStreamIntervalAggNext(SOperatorInfo* pOperator, SSDataBlock** p
|
|||
while ((pIte = tSimpleHashIterate(pInfo->pUpdatedMap, pIte, &iter)) != NULL) {
|
||||
void* tmp = taosArrayPush(pInfo->pUpdated, pIte);
|
||||
if (!tmp) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
QUERY_CHECK_CODE(code, lino, _end);
|
||||
}
|
||||
}
|
||||
|
@ -5644,7 +5644,7 @@ static int32_t doStreamMidIntervalAggNext(SOperatorInfo* pOperator, SSDataBlock*
|
|||
pBlock->info.type == STREAM_CLEAR) {
|
||||
SArray* delWins = taosArrayInit(8, sizeof(SWinKey));
|
||||
if (!delWins) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
QUERY_CHECK_CODE(code, lino, _end);
|
||||
}
|
||||
code =
|
||||
|
@ -5698,7 +5698,7 @@ static int32_t doStreamMidIntervalAggNext(SOperatorInfo* pOperator, SSDataBlock*
|
|||
} else if (pBlock->info.type == STREAM_MID_RETRIEVE) {
|
||||
SArray* delWins = taosArrayInit(8, sizeof(SWinKey));
|
||||
if (!delWins) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
QUERY_CHECK_CODE(code, lino, _end);
|
||||
}
|
||||
code = doDeleteWindows(pOperator, &pInfo->interval, pBlock, delWins, pInfo->pUpdatedMap, NULL);
|
||||
|
@ -5743,7 +5743,7 @@ static int32_t doStreamMidIntervalAggNext(SOperatorInfo* pOperator, SSDataBlock*
|
|||
while ((pIte = tSimpleHashIterate(pInfo->pUpdatedMap, pIte, &iter)) != NULL) {
|
||||
void* tmp = taosArrayPush(pInfo->pUpdated, pIte);
|
||||
if (!tmp) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
QUERY_CHECK_CODE(code, lino, _end);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2576,7 +2576,7 @@ int32_t optSysIntersection(SArray* in, SArray* out) {
|
|||
if (has == true) {
|
||||
void* tmp = taosArrayPush(out, &tgt);
|
||||
if (!tmp) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _end;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -544,7 +544,7 @@ static int32_t initPrevRowsKeeper(STimeSliceOperatorInfo* pInfo, SSDataBlock* pB
|
|||
|
||||
pInfo->pPrevRow = taosArrayInit(4, sizeof(SGroupKeys));
|
||||
if (pInfo->pPrevRow == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
int32_t numOfCols = taosArrayGetSize(pBlock->pDataBlock);
|
||||
|
@ -579,7 +579,7 @@ static int32_t initNextRowsKeeper(STimeSliceOperatorInfo* pInfo, SSDataBlock* pB
|
|||
|
||||
pInfo->pNextRow = taosArrayInit(4, sizeof(SGroupKeys));
|
||||
if (pInfo->pNextRow == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
int32_t numOfCols = taosArrayGetSize(pBlock->pDataBlock);
|
||||
|
@ -615,7 +615,7 @@ static int32_t initFillLinearInfo(STimeSliceOperatorInfo* pInfo, SSDataBlock* pB
|
|||
|
||||
pInfo->pLinearInfo = taosArrayInit(4, sizeof(SFillLinearInfo));
|
||||
if (pInfo->pLinearInfo == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
int32_t numOfCols = taosArrayGetSize(pBlock->pDataBlock);
|
||||
|
|
|
@ -229,7 +229,7 @@ static int32_t doAddNewBucket(SLHashObj* pHashObj) {
|
|||
|
||||
char* p = taosMemoryRealloc(pHashObj->pBucket, POINTER_BYTES * newLen);
|
||||
if (p == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
memset(p + POINTER_BYTES * pHashObj->numOfBuckets, 0, newLen - pHashObj->numOfBuckets);
|
||||
|
|
|
@ -432,7 +432,7 @@ void tsortDestroySortHandle(SSortHandle* pSortHandle) {
|
|||
|
||||
int32_t tsortAddSource(SSortHandle* pSortHandle, void* pSource) {
|
||||
void* p = taosArrayPush(pSortHandle->pOrderedSource, &pSource);
|
||||
return (p != NULL)? TSDB_CODE_SUCCESS:TSDB_CODE_OUT_OF_MEMORY;
|
||||
return (p != NULL)? TSDB_CODE_SUCCESS:terrno;
|
||||
}
|
||||
|
||||
static int32_t doAddNewExternalMemSource(SDiskbasedBuf* pBuf, SArray* pAllSources, SSDataBlock* pBlock,
|
||||
|
@ -449,7 +449,7 @@ static int32_t doAddNewExternalMemSource(SDiskbasedBuf* pBuf, SArray* pAllSource
|
|||
void* p = taosArrayPush(pAllSources, &pSource);
|
||||
if (p == NULL) {
|
||||
taosArrayDestroy(pPageIdList);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
(*sourceId) += 1;
|
||||
|
@ -525,7 +525,7 @@ static int32_t doAddToBuf(SSDataBlock* pDataBlock, SSortHandle* pHandle) {
|
|||
if (px == NULL) {
|
||||
taosArrayDestroy(pPageIdList);
|
||||
blockDataDestroy(p);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
int32_t size = blockDataGetSize(p) + sizeof(int32_t) + taosArrayGetSize(p->pDataBlock) * sizeof(int32_t);
|
||||
|
|
|
@ -3902,8 +3902,7 @@ int32_t doAddIntoResult(SqlFunctionCtx* pCtx, void* pData, int32_t rowIndex, SSD
|
|||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
|
||||
SVariant val = {0};
|
||||
// TODO(smj) : this func need err code
|
||||
taosVariantCreateFromBinary(&val, pData, tDataTypes[type].bytes, type);
|
||||
TAOS_CHECK_RETURN(taosVariantCreateFromBinary(&val, pData, tDataTypes[type].bytes, type));
|
||||
|
||||
STopBotResItem* pItems = pRes->pItems;
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue