refactor: do some internal refactor.

This commit is contained in:
Haojun Liao 2024-08-02 11:49:21 +08:00
parent 42c11e9e36
commit 079f6358aa
2 changed files with 8 additions and 12 deletions

View File

@ -749,6 +749,7 @@ static int32_t mndProcessCreateStreamReq(SRpcMsg *pReq) {
int32_t sqlLen = 0;
const char *pMsg = "create stream tasks on dnodes";
int32_t code = TSDB_CODE_SUCCESS;
int32_t lino = 0;
terrno = TSDB_CODE_SUCCESS;
SCMCreateStreamReq createReq = {0};
@ -788,11 +789,7 @@ static int32_t mndProcessCreateStreamReq(SRpcMsg *pReq) {
if (createReq.sql != NULL) {
sqlLen = strlen(createReq.sql);
sql = taosMemoryMalloc(sqlLen + 1);
if (sql == NULL) {
code = terrno;
goto _OVER;
}
TSDB_CHECK_NULL(sql, code, lino, _OVER, terrno);
memset(sql, 0, sqlLen + 1);
memcpy(sql, createReq.sql, sqlLen);
}

View File

@ -167,29 +167,28 @@ int32_t mndStreamGetRelTrans(SMnode *pMnode, int64_t streamId) {
}
int32_t doCreateTrans(SMnode *pMnode, SStreamObj *pStream, SRpcMsg *pReq, ETrnConflct conflict, const char *name,
const char *pMsg, STrans ** pTrans1) {
const char *pMsg, STrans **pTrans1) {
*pTrans1 = NULL;
terrno = 0;
int32_t code = 0;
STrans *p = mndTransCreate(pMnode, TRN_POLICY_RETRY, conflict, pReq, name);
if (p == NULL) {
mError("failed to build trans:%s, reason: %s", name, tstrerror(TSDB_CODE_OUT_OF_MEMORY));
terrno = TSDB_CODE_OUT_OF_MEMORY;
mError("failed to build trans:%s, reason: %s", name, tstrerror(terrno));
return terrno;
}
mInfo("stream:0x%" PRIx64 " start to build trans %s, transId:%d", pStream->uid, pMsg, p->id);
mndTransSetDbName(p, pStream->sourceDb, pStream->targetSTbName);
if (mndTransCheckConflict(pMnode, p) != 0) {
terrno = TSDB_CODE_MND_TRANS_CONFLICT;
if ((code = mndTransCheckConflict(pMnode, p)) != 0) {
mError("failed to build trans:%s for stream:0x%" PRIx64 " code:%s", name, pStream->uid, tstrerror(terrno));
mndTransDrop(p);
return terrno;
return code;
}
*pTrans1 = p;
return 0;
return code;
}
SSdbRaw *mndStreamActionEncode(SStreamObj *pStream) {