TDengine/source/dnode/mnode/impl/src/mndStream.c

949 lines
31 KiB
C
Raw Normal View History

2022-03-10 09:15:45 +00:00
/*
* 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/>.
*/
fix(stream): reduce the consensus checkpoint id trans. (#30105) * fix(stream): reduce the consensus checkpoint id trans. * refactor(stream): add some logs. * refactor(stream): set the max checkpoint exec time 30min. * refactor(stream): add checkpoint-consensus trans conflict check. * refactor(stream): remove unused local variables. * fix(stream): fix syntax error. * fix(stream): 1. fix free memory error 2. continue if put result into dst hashmap failed. * fix issue * fix issue * fix(mnd): follower mnode not processes the timer event. * fix(stream): print correct error msg. * fix(stream): add some logs. * fix(stream): add some logs. * fix(stream): add some logs. * fix(stream): add some logs. * fix(stream): add some logs. * fix(stream): add some logs. * fix(stream): add some logs. * fix(stream): add some logs. * fix(stream): truncate long subtable name * fix(stream): add buffer len. * refactor(stream): update some logs. * fix issue * refactor(stream): update some logs. * refactor(stream): update some logs. * fix(stream): check return value. * fix(stream): fix syntax error. * fix(stream): check return value. * fix(stream): update the timer check in mnode. * fix(stream): add restart stage tracking. * fix(stream): track the start task stage for meta. * fix(stream): fix error in log. * refactor(stream): adjust log info. * fix mem issue * fix(stream): check the number of required tasks for consensus checkpointId. * fix(stream): lock the whole start procedure. * fix(stream): add lock during start all tasks. * fix(stream): update logs. * fix(stream): update logs. * fix(stream): update logs. * fix(stream): fix dead-lock. * fix(stream): fix syntax error. * fix(stream): not drop the scan-history task. * fix(stream): fix syntax error. * fix(stream): wait for executor stop before restarting. * fix(stream): add some logs. * fix(stream): add some logs. * fix(stream): add some logs. * fix(stream): disable some logs. * fix(stream): reset the start info if no task left. --------- Co-authored-by: 54liuyao <54liuyao@163.com> Co-authored-by: Jinqing Kuang <kuangjinqingcn@gmail.com>
2025-03-17 02:20:17 +00:00
#include "mndStream.h"
2023-08-31 01:28:43 +00:00
#include "audit.h"
2022-03-10 09:15:45 +00:00
#include "mndDb.h"
2022-06-25 10:14:42 +00:00
#include "mndPrivilege.h"
2022-03-10 09:15:45 +00:00
#include "mndShow.h"
#include "mndStb.h"
#include "mndTrans.h"
2023-11-16 02:22:01 +00:00
#include "osMemory.h"
2022-03-26 08:48:14 +00:00
#include "parser.h"
2024-08-16 08:53:44 +00:00
#include "taoserror.h"
2023-08-01 10:14:58 +00:00
#include "tmisce.h"
2023-08-17 10:52:33 +00:00
#include "tname.h"
2022-03-10 09:15:45 +00:00
#define MND_STREAM_MAX_NUM 60
2024-02-21 08:17:06 +00:00
typedef struct {
int8_t placeHolder; // // to fix windows compile error, define place holder
} SMStreamNodeCheckMsg;
static int32_t mndNodeCheckSentinel = 0;
2025-04-22 09:46:17 +00:00
SStmRuntime mStreamMgmt;
2023-02-06 02:40:33 +00:00
2022-03-10 09:15:45 +00:00
static int32_t mndStreamActionInsert(SSdb *pSdb, SStreamObj *pStream);
static int32_t mndStreamActionDelete(SSdb *pSdb, SStreamObj *pStream);
static int32_t mndStreamActionUpdate(SSdb *pSdb, SStreamObj *pOldStream, SStreamObj *pNewStream);
2022-06-15 13:13:47 +00:00
static int32_t mndProcessDropStreamReq(SRpcMsg *pReq);
2023-11-24 01:47:35 +00:00
static int32_t mndProcessCreateStreamReqFromMNode(SRpcMsg *pReq);
static int32_t mndProcessDropStreamReqFromMNode(SRpcMsg *pReq);
2022-05-16 06:55:31 +00:00
static int32_t mndRetrieveStream(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows);
2022-03-10 09:15:45 +00:00
static void mndCancelGetNextStream(SMnode *pMnode, void *pIter);
static int32_t mndRetrieveStreamTask(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows);
static void mndCancelGetNextStreamTask(SMnode *pMnode, void *pIter);
2025-05-17 02:55:32 +00:00
static int32_t mndProcessStopStreamReq(SRpcMsg *pReq);
static int32_t mndProcessStartStreamReq(SRpcMsg *pReq);
static void doSendQuickRsp(SRpcHandleInfo *pInfo, int32_t msgSize, int32_t vgId, int32_t code);
static SSdbRow *mndStreamActionDecode(SSdbRaw *pRaw);
2024-01-15 11:56:38 +00:00
SSdbRaw *mndStreamSeqActionEncode(SStreamObj *pStream);
SSdbRow *mndStreamSeqActionDecode(SSdbRaw *pRaw);
static int32_t mndStreamSeqActionInsert(SSdb *pSdb, SStreamSeq *pStream);
static int32_t mndStreamSeqActionDelete(SSdb *pSdb, SStreamSeq *pStream);
static int32_t mndStreamSeqActionUpdate(SSdb *pSdb, SStreamSeq *pOldStream, SStreamSeq *pNewStream);
2025-04-10 01:09:30 +00:00
static int32_t mndProcessCreateStreamReq(SRpcMsg *pReq);
2023-08-23 06:26:45 +00:00
void mndCleanupStream(SMnode *pMnode) {
2025-04-24 01:11:54 +00:00
//STREAMTODO
mDebug("mnd stream runtime info cleanup");
2023-08-23 06:26:45 +00:00
}
2022-03-10 09:15:45 +00:00
SSdbRow *mndStreamActionDecode(SSdbRaw *pRaw) {
2024-09-29 06:32:54 +00:00
int32_t code = 0;
int32_t lino = 0;
SSdbRow *pRow = NULL;
2022-12-01 08:04:39 +00:00
SStreamObj *pStream = NULL;
void *buf = NULL;
2024-01-22 03:05:42 +00:00
int8_t sver = 0;
2024-09-29 06:32:54 +00:00
int32_t tlen;
int32_t dataPos = 0;
2022-03-10 09:15:45 +00:00
2024-09-29 06:32:54 +00:00
code = sdbGetRawSoftVer(pRaw, &sver);
TSDB_CHECK_CODE(code, lino, _over);
2022-03-10 09:15:45 +00:00
2024-02-20 06:49:52 +00:00
if (sver < 1 || sver > MND_STREAM_VER_NUMBER) {
2023-08-17 10:52:33 +00:00
mError("stream read invalid ver, data ver: %d, curr ver: %d", sver, MND_STREAM_VER_NUMBER);
2024-09-29 06:32:54 +00:00
goto _over;
2022-03-10 09:15:45 +00:00
}
2022-12-01 08:04:39 +00:00
pRow = sdbAllocRow(sizeof(SStreamObj));
2024-09-29 06:32:54 +00:00
TSDB_CHECK_NULL(pRow, code, lino, _over, terrno);
2022-03-10 09:15:45 +00:00
2022-12-01 08:04:39 +00:00
pStream = sdbGetRowObj(pRow);
2024-09-29 06:32:54 +00:00
TSDB_CHECK_NULL(pStream, code, lino, _over, terrno);
2022-03-10 09:15:45 +00:00
2024-09-29 06:32:54 +00:00
SDB_GET_INT32(pRaw, dataPos, &tlen, _over);
2024-01-22 03:05:42 +00:00
2022-03-25 16:29:53 +00:00
buf = taosMemoryMalloc(tlen + 1);
2024-09-29 06:32:54 +00:00
TSDB_CHECK_NULL(buf, code, lino, _over, terrno);
2024-01-22 03:05:42 +00:00
2024-09-29 06:32:54 +00:00
SDB_GET_BINARY(pRaw, dataPos, buf, tlen, _over);
2022-03-10 09:15:45 +00:00
2022-05-07 10:03:06 +00:00
SDecoder decoder;
tDecoderInit(&decoder, buf, tlen + 1);
2024-09-29 06:32:54 +00:00
code = tDecodeSStreamObj(&decoder, pStream, sver);
2022-10-21 03:42:30 +00:00
tDecoderClear(&decoder);
2022-03-10 09:15:45 +00:00
2024-09-29 06:32:54 +00:00
if (code < 0) {
2024-09-29 06:18:24 +00:00
tFreeStreamObj(pStream);
2022-03-10 09:15:45 +00:00
}
2024-09-29 06:32:54 +00:00
_over:
2022-03-25 16:29:53 +00:00
taosMemoryFreeClear(buf);
2024-09-29 06:32:54 +00:00
if (code != TSDB_CODE_SUCCESS) {
2025-04-24 01:11:54 +00:00
char *p = (pStream == NULL) ? "null" : pStream->pCreate->name;
2024-09-29 06:32:54 +00:00
mError("stream:%s, failed to decode from raw:%p since %s at:%d", p, pRaw, tstrerror(code), lino);
2022-03-25 16:29:53 +00:00
taosMemoryFreeClear(pRow);
2024-09-29 06:32:54 +00:00
terrno = code;
2022-03-10 09:15:45 +00:00
return NULL;
2024-09-29 06:32:54 +00:00
} else {
2025-04-24 01:11:54 +00:00
mTrace("stream:%s, decode from raw:%p, row:%p", pStream->pCreate->name, pRaw, pStream);
2022-03-10 09:15:45 +00:00
2024-09-29 06:32:54 +00:00
terrno = 0;
return pRow;
}
2022-03-10 09:15:45 +00:00
}
static int32_t mndStreamActionInsert(SSdb *pSdb, SStreamObj *pStream) {
2025-04-24 01:11:54 +00:00
mTrace("stream:%s, perform insert action", pStream->pCreate->name);
2022-03-10 09:15:45 +00:00
return 0;
}
static int32_t mndStreamActionDelete(SSdb *pSdb, SStreamObj *pStream) {
2025-04-24 01:11:54 +00:00
mInfo("stream:%s, perform delete action", pStream->pCreate->name);
2022-08-18 06:26:11 +00:00
tFreeStreamObj(pStream);
2022-03-10 09:15:45 +00:00
return 0;
}
static int32_t mndStreamActionUpdate(SSdb *pSdb, SStreamObj *pOldStream, SStreamObj *pNewStream) {
2025-04-24 01:11:54 +00:00
mTrace("stream:%s, perform update action", pOldStream->pCreate->name);
2022-03-10 09:15:45 +00:00
2025-05-17 02:55:32 +00:00
pOldStream->mainSnodeId = pNewStream->mainSnodeId;
2025-04-30 10:39:59 +00:00
atomic_store_8(&pOldStream->userStopped, atomic_load_8(&pNewStream->userStopped));
2023-08-03 10:09:36 +00:00
pOldStream->updateTime = pNewStream->updateTime;
2025-04-24 01:11:54 +00:00
2022-03-10 09:15:45 +00:00
return 0;
}
2024-07-22 02:07:18 +00:00
int32_t mndAcquireStream(SMnode *pMnode, char *streamName, SStreamObj **pStream) {
2024-07-23 11:16:06 +00:00
int32_t code = 0;
SSdb *pSdb = pMnode->pSdb;
2024-07-22 02:07:18 +00:00
(*pStream) = sdbAcquire(pSdb, SDB_STREAM, streamName);
if ((*pStream) == NULL && terrno == TSDB_CODE_SDB_OBJ_NOT_THERE) {
2024-07-23 11:16:06 +00:00
code = TSDB_CODE_MND_STREAM_NOT_EXIST;
2022-03-10 09:15:45 +00:00
}
2024-07-23 11:16:06 +00:00
return code;
2022-03-10 09:15:45 +00:00
}
void mndReleaseStream(SMnode *pMnode, SStreamObj *pStream) {
SSdb *pSdb = pMnode->pSdb;
sdbRelease(pSdb, pStream);
}
SSdbRaw *mndStreamSeqActionEncode(SStreamObj *pStream) { return NULL; }
SSdbRow *mndStreamSeqActionDecode(SSdbRaw *pRaw) { return NULL; }
int32_t mndStreamSeqActionInsert(SSdb *pSdb, SStreamSeq *pStream) { return 0; }
int32_t mndStreamSeqActionDelete(SSdb *pSdb, SStreamSeq *pStream) { return 0; }
int32_t mndStreamSeqActionUpdate(SSdb *pSdb, SStreamSeq *pOldStream, SStreamSeq *pNewStream) { return 0; }
2023-11-08 11:54:57 +00:00
2024-06-26 02:32:15 +00:00
static int32_t createSchemaByFields(const SArray *pFields, SSchemaWrapper *pWrapper) {
2024-03-21 02:50:07 +00:00
pWrapper->nCols = taosArrayGetSize(pFields);
pWrapper->pSchema = taosMemoryCalloc(pWrapper->nCols, sizeof(SSchema));
if (NULL == pWrapper->pSchema) {
2024-08-01 09:17:32 +00:00
return terrno;
2024-03-21 02:50:07 +00:00
}
int32_t index = 0;
2024-06-26 02:32:15 +00:00
for (int32_t i = 0; i < pWrapper->nCols; i++) {
SField *pField = (SField *)taosArrayGet(pFields, i);
2024-08-02 03:38:30 +00:00
if (pField == NULL) {
return terrno;
}
2024-03-21 02:50:07 +00:00
if (TSDB_DATA_TYPE_NULL == pField->type) {
pWrapper->pSchema[index].type = TSDB_DATA_TYPE_VARCHAR;
pWrapper->pSchema[index].bytes = VARSTR_HEADER_SIZE;
} else {
pWrapper->pSchema[index].type = pField->type;
pWrapper->pSchema[index].bytes = pField->bytes;
}
pWrapper->pSchema[index].colId = index + 1;
tstrncpy(pWrapper->pSchema[index].name, pField->name, sizeof(pWrapper->pSchema[index].name));
2024-03-21 02:50:07 +00:00
pWrapper->pSchema[index].flags = pField->flags;
index += 1;
}
return TSDB_CODE_SUCCESS;
}
2025-05-17 02:55:32 +00:00
static int32_t mndStreamBuildObj(SMnode *pMnode, SStreamObj *pObj, SCMCreateStreamReq *pCreate, int32_t snodeId) {
2024-08-01 09:17:32 +00:00
int32_t code = 0;
2022-06-16 08:01:22 +00:00
2025-04-10 11:41:37 +00:00
pObj->pCreate = pCreate;
2025-04-28 08:47:32 +00:00
strncpy(pObj->name, pCreate->name, TSDB_STREAM_NAME_LEN);
2025-05-17 02:55:32 +00:00
pObj->mainSnodeId = snodeId;
2025-05-06 02:27:12 +00:00
pObj->userDropped = 0;
2025-04-30 10:39:59 +00:00
pObj->userStopped = 0;
2025-04-25 06:59:41 +00:00
2022-06-16 08:01:22 +00:00
pObj->createTime = taosGetTimestampMs();
pObj->updateTime = pObj->createTime;
2024-08-01 09:17:32 +00:00
return code;
2022-06-16 08:01:22 +00:00
}
2025-04-24 01:11:54 +00:00
static int32_t mndStreamCreateOutStb(SMnode *pMnode, STrans *pTrans, const SCMCreateStreamReq *pStream, const char *user) {
2022-06-16 02:29:30 +00:00
SStbObj *pStb = NULL;
2024-01-15 11:56:38 +00:00
SDbObj *pDb = NULL;
int32_t code = 0;
int32_t lino = 0;
2022-05-06 17:47:45 +00:00
SMCreateStbReq createReq = {0};
TAOS_STRNCAT(createReq.name, pStream->outDB, TSDB_DB_FNAME_LEN);
TAOS_STRNCAT(createReq.name, ".", 2);
TAOS_STRNCAT(createReq.name, pStream->outTblName, TSDB_TABLE_NAME_LEN);
2025-04-24 01:11:54 +00:00
createReq.numOfColumns = taosArrayGetSize(pStream->outCols);
createReq.numOfTags = pStream->outTags ? taosArrayGetSize(pStream->outTags) : 1;
2024-03-31 00:08:23 +00:00
createReq.pColumns = taosArrayInit_s(sizeof(SFieldWithOptions), createReq.numOfColumns);
2024-08-01 09:17:32 +00:00
TSDB_CHECK_NULL(createReq.pColumns, code, lino, _OVER, terrno);
2022-05-06 17:47:45 +00:00
// build fields
2022-05-07 02:21:51 +00:00
for (int32_t i = 0; i < createReq.numOfColumns; i++) {
2024-03-31 00:08:23 +00:00
SFieldWithOptions *pField = taosArrayGet(createReq.pColumns, i);
2024-08-02 03:38:30 +00:00
TSDB_CHECK_NULL(pField, code, lino, _OVER, terrno);
2025-04-24 01:11:54 +00:00
TAOS_FIELD_E *pSrc = taosArrayGet(pStream->outCols, i);
2024-08-02 03:38:30 +00:00
2025-04-24 01:11:54 +00:00
tstrncpy(pField->name, pSrc->name, TSDB_COL_NAME_LEN);
pField->flags = 0;
pField->type = pSrc->type;
pField->bytes = pSrc->bytes;
2024-03-31 00:08:23 +00:00
pField->compress = createDefaultColCmprByType(pField->type);
feat(decimal): support decimal data type (#30060) * decimal: create table * decimal: add test case decimal.py * decimal: add decimal.c * support input decimal * decimal test * refactor svalue * fix test cases * add decimal unit test * add decimal test cmake * support insert and query decimal type * define wide integer, support decimal128 * support decimal128 divide * set decimal type expr res types * scalar decimal * convert to decimal * fix decimal64/128 from str and to str * fix decimal from str and decimal to str * decimal simple conversion * unit test for decimal * decimal conversion and unit tests * decimal + - * / * decimal scalar ops and comparision * start to refactor GET_TYPED_DATA * support decimal max func, cast func * refactor GET_TYPED_DATA interface * decimal scalar comparision * start to implement sum for decimal * support sum and avg for decimal type * decimal tests * add decimal test * decimal add test cases * decimal use int256/int128 * decimal testing * fix decimal table meta and add tests for decimal col streams * fix create stream and create tsma * test insert decimal values * decimal from str * test decimal input * test parse decimal from string * add taos_fetch_field_e api * decimal insert tests * test decimal operators * decimal operator test * feat:support decimal in raw block * decimal operator tests * decimal test * feat:support decimal in raw block * feat:support decimal in raw block * feat:add schemaExt to SMqDataRsp * feat:remove add schemaExt to SMqDataRsp * feat:remove add schemaExt to SMqDataRsp * feat:remove add schemaExt to SMqDataRsp * decimal test operators * decimal operator test * test decimal operators * test decimal compare operators * decimal unary operator test * decimal col with decimal col oper test * test decimal col filtering * fix decimal float operator test * decimal test where filtering * fix decimal filtering * fix decimal order by * fix decimal op test * test decimal agg funcs * test decimal functions * remove assert * fix ci build for ret check * fix decimal windows build * fix ci ret check * skip decimal ret check * skip decimal ret check * fix decimal tests * fix decimal ci test * decimal test * fix(tmq): heap user after free * fix(tmq): double free * fix(tmq): double free * fix decimal tests * fix(decimal): decimal test ci build * fix(decimal): windows build * fix(decimal): decimal test build * fix(decimal): fix decimal build and tests * fix(decimal): fix decimal tests * fix(decimal): fix taos_fetch_fields_e api * fix(decimal): fix decimal taos_fetch_fields_e api * fix(decimal): rebase 3.0 * fix(decimal): fix decimal functions * fix(decimal): fix decimal test case memory leak * fix(decimal): fix decimal tests * fix(decimal): fix decimal test case * fix(decimal): fix decimal tests * feat(decimal): fix unit tests * feat(decimal): fix deicmal unit test --------- Co-authored-by: wangmm0220 <wangmm0220@gmail.com> Co-authored-by: yihaoDeng <yhdeng@taosdata.com>
2025-03-14 10:08:07 +00:00
if (IS_DECIMAL_TYPE(pField->type)) {
2025-04-24 01:11:54 +00:00
pField->typeMod = decimalCalcTypeMod(pSrc->precision, pSrc->scale);
feat(decimal): support decimal data type (#30060) * decimal: create table * decimal: add test case decimal.py * decimal: add decimal.c * support input decimal * decimal test * refactor svalue * fix test cases * add decimal unit test * add decimal test cmake * support insert and query decimal type * define wide integer, support decimal128 * support decimal128 divide * set decimal type expr res types * scalar decimal * convert to decimal * fix decimal64/128 from str and to str * fix decimal from str and decimal to str * decimal simple conversion * unit test for decimal * decimal conversion and unit tests * decimal + - * / * decimal scalar ops and comparision * start to refactor GET_TYPED_DATA * support decimal max func, cast func * refactor GET_TYPED_DATA interface * decimal scalar comparision * start to implement sum for decimal * support sum and avg for decimal type * decimal tests * add decimal test * decimal add test cases * decimal use int256/int128 * decimal testing * fix decimal table meta and add tests for decimal col streams * fix create stream and create tsma * test insert decimal values * decimal from str * test decimal input * test parse decimal from string * add taos_fetch_field_e api * decimal insert tests * test decimal operators * decimal operator test * feat:support decimal in raw block * decimal operator tests * decimal test * feat:support decimal in raw block * feat:support decimal in raw block * feat:add schemaExt to SMqDataRsp * feat:remove add schemaExt to SMqDataRsp * feat:remove add schemaExt to SMqDataRsp * feat:remove add schemaExt to SMqDataRsp * decimal test operators * decimal operator test * test decimal operators * test decimal compare operators * decimal unary operator test * decimal col with decimal col oper test * test decimal col filtering * fix decimal float operator test * decimal test where filtering * fix decimal filtering * fix decimal order by * fix decimal op test * test decimal agg funcs * test decimal functions * remove assert * fix ci build for ret check * fix decimal windows build * fix ci ret check * skip decimal ret check * skip decimal ret check * fix decimal tests * fix decimal ci test * decimal test * fix(tmq): heap user after free * fix(tmq): double free * fix(tmq): double free * fix decimal tests * fix(decimal): decimal test ci build * fix(decimal): windows build * fix(decimal): decimal test build * fix(decimal): fix decimal build and tests * fix(decimal): fix decimal tests * fix(decimal): fix taos_fetch_fields_e api * fix(decimal): fix decimal taos_fetch_fields_e api * fix(decimal): rebase 3.0 * fix(decimal): fix decimal functions * fix(decimal): fix decimal test case memory leak * fix(decimal): fix decimal tests * fix(decimal): fix decimal test case * fix(decimal): fix decimal tests * feat(decimal): fix unit tests * feat(decimal): fix deicmal unit test --------- Co-authored-by: wangmm0220 <wangmm0220@gmail.com> Co-authored-by: yihaoDeng <yhdeng@taosdata.com>
2025-03-14 10:08:07 +00:00
}
2022-05-07 02:21:51 +00:00
}
2023-01-10 02:13:56 +00:00
2025-04-24 01:11:54 +00:00
if (NULL == pStream->outTags) {
2023-01-10 02:13:56 +00:00
createReq.numOfTags = 1;
2023-02-23 06:58:22 +00:00
createReq.pTags = taosArrayInit_s(sizeof(SField), 1);
2024-08-01 09:17:32 +00:00
TSDB_CHECK_NULL(createReq.pTags, code, lino, _OVER, terrno);
2023-01-10 02:13:56 +00:00
// build tags
SField *pField = taosArrayGet(createReq.pTags, 0);
2024-08-02 03:38:30 +00:00
TSDB_CHECK_NULL(pField, code, lino, _OVER, terrno);
tstrncpy(pField->name, "group_id", sizeof(pField->name));
2023-01-10 02:13:56 +00:00
pField->type = TSDB_DATA_TYPE_UBIGINT;
pField->flags = 0;
pField->bytes = 8;
} else {
2025-04-24 01:11:54 +00:00
createReq.numOfTags = taosArrayGetSize(pStream->outTags);
2023-02-23 06:58:22 +00:00
createReq.pTags = taosArrayInit_s(sizeof(SField), createReq.numOfTags);
2024-08-01 09:17:32 +00:00
TSDB_CHECK_NULL(createReq.pTags, code, lino, _OVER, terrno);
2023-01-10 02:13:56 +00:00
for (int32_t i = 0; i < createReq.numOfTags; i++) {
SField *pField = taosArrayGet(createReq.pTags, i);
2024-08-02 03:38:30 +00:00
if (pField == NULL) {
continue;
}
2025-04-24 01:11:54 +00:00
TAOS_FIELD_E *pSrc = taosArrayGet(pStream->outTags, i);
pField->bytes = pSrc->bytes;
pField->flags = 0;
pField->type = pSrc->type;
tstrncpy(pField->name, pSrc->name, TSDB_COL_NAME_LEN);
2023-01-10 02:13:56 +00:00
}
}
2022-05-06 17:47:45 +00:00
if ((code = mndCheckCreateStbReq(&createReq)) != 0) {
2022-05-06 17:47:45 +00:00
goto _OVER;
}
pStb = mndAcquireStb(pMnode, createReq.name);
if (pStb != NULL) {
code = TSDB_CODE_MND_STB_ALREADY_EXIST;
2022-05-06 17:47:45 +00:00
goto _OVER;
}
pDb = mndAcquireDbByStb(pMnode, createReq.name);
if (pDb == NULL) {
code = TSDB_CODE_MND_DB_NOT_SELECTED;
2022-05-06 17:47:45 +00:00
goto _OVER;
}
int32_t numOfStbs = -1;
2022-05-07 04:07:45 +00:00
if (mndGetNumOfStbs(pMnode, pDb->name, &numOfStbs) != 0) {
goto _OVER;
}
2022-05-06 17:47:45 +00:00
if (pDb->cfg.numOfStables == 1 && numOfStbs != 0) {
code = TSDB_CODE_MND_SINGLE_STB_MODE_DB;
2022-05-06 17:47:45 +00:00
goto _OVER;
}
SStbObj stbObj = {0};
if (mndBuildStbFromReq(pMnode, &stbObj, &createReq, pDb) != 0) {
goto _OVER;
}
2025-04-24 01:11:54 +00:00
stbObj.uid = pStream->outStbUid;
2022-05-07 15:19:05 +00:00
2022-08-18 06:26:11 +00:00
if (mndAddStbToTrans(pMnode, pTrans, pDb, &stbObj) < 0) {
mndFreeStb(&stbObj);
goto _OVER;
}
2025-04-24 01:11:54 +00:00
mDebug("stream:%s create dst stable:%s, cols:%d", pStream->name, pStream->outTblName, createReq.numOfColumns);
2022-08-18 06:26:11 +00:00
tFreeSMCreateStbReq(&createReq);
mndFreeStb(&stbObj);
2022-11-27 14:23:40 +00:00
mndReleaseStb(pMnode, pStb);
2022-11-16 02:55:19 +00:00
mndReleaseDb(pMnode, pDb);
2024-08-01 09:17:32 +00:00
return code;
2022-05-06 17:47:45 +00:00
_OVER:
2022-08-18 06:26:11 +00:00
tFreeSMCreateStbReq(&createReq);
2022-05-06 17:47:45 +00:00
mndReleaseStb(pMnode, pStb);
mndReleaseDb(pMnode, pDb);
2025-04-24 01:11:54 +00:00
mDebug("stream:%s failed to create dst stable:%s, line:%d code:%s", pStream->name, pStream->outTblName, lino,
tstrerror(code));
2024-08-01 09:17:32 +00:00
return code;
2022-05-06 17:47:45 +00:00
}
2025-04-10 11:41:37 +00:00
static int32_t mndStreamValidateCreate(SMnode *pMnode, char* pUser, SCMCreateStreamReq* pCreate) {
int32_t code = 0, lino = 0;
int64_t streamId = pCreate->streamId;
2025-04-10 11:41:37 +00:00
if (pCreate->triggerDB) {
code = mndCheckDbPrivilegeByName(pMnode, pUser, MND_OPER_READ_DB, pCreate->triggerDB);
if (code) {
mstError("user %s failed to create stream %s using trigger db %s since %s", pUser, pCreate->name, pCreate->triggerDB, tstrerror(code));
}
2025-04-10 11:41:37 +00:00
TSDB_CHECK_CODE(code, lino, _OVER);
}
2025-04-24 01:11:54 +00:00
/* STREAMTODO
2025-04-10 11:41:37 +00:00
if (pCreate->sourceDB) {
code = mndCheckDbPrivilegeByName(pMnode, pUser, MND_OPER_READ_DB, pCreate->sourceDB);
if (code) {
mstError("user %s failed to create stream %s using source db %s since %s", pUser, pCreate->name, pCreate->sourceDB, tstrerror(code));
}
2025-04-10 11:41:37 +00:00
TSDB_CHECK_CODE(code, lino, _OVER);
}
2025-04-24 01:11:54 +00:00
*/
2025-04-10 11:41:37 +00:00
if (pCreate->outDB) {
code = mndCheckDbPrivilegeByName(pMnode, pUser, MND_OPER_WRITE_DB, pCreate->outDB);
if (code) {
mstError("user %s failed to create stream %s using out db %s since %s", pUser, pCreate->name, pCreate->outDB, tstrerror(code));
}
2025-04-10 11:41:37 +00:00
TSDB_CHECK_CODE(code, lino, _OVER);
}
2025-04-10 11:41:37 +00:00
int32_t streamNum = sdbGetSize(pMnode->pSdb, SDB_STREAM);
if (streamNum > MND_STREAM_MAX_NUM) {
code = TSDB_CODE_MND_TOO_MANY_STREAMS;
mstError("failed to create stream %s since %s, stream number:%d", pCreate->name, tstrerror(code), streamNum);
return code;
}
_OVER:
return code;
}
static void *notifyAddrDup(void *p) { return taosStrdup((char *)p); }
static int32_t addStreamTaskNotifyInfo(const SCMCreateStreamReq *createReq, const SStreamObj *pStream,
SStreamTask *pTask) {
int32_t code = TSDB_CODE_SUCCESS;
2025-04-24 01:11:54 +00:00
/* STREAMTODO
int32_t lino = 0;
2025-04-24 01:11:54 +00:00
int64_t streamId = pStream->pCreate->streamId;
TSDB_CHECK_NULL(createReq, code, lino, _end, TSDB_CODE_INVALID_PARA);
TSDB_CHECK_NULL(pTask, code, lino, _end, TSDB_CODE_INVALID_PARA);
pTask->notifyInfo.pNotifyAddrUrls = taosArrayDup(createReq->pNotifyAddrUrls, notifyAddrDup);
TSDB_CHECK_NULL(pTask->notifyInfo.pNotifyAddrUrls, code, lino, _end, terrno);
pTask->notifyInfo.notifyEventTypes = createReq->notifyEventTypes;
pTask->notifyInfo.notifyErrorHandle = createReq->notifyErrorHandle;
pTask->notifyInfo.streamName = taosStrdup(mndGetDbStr(createReq->name));
TSDB_CHECK_NULL(pTask->notifyInfo.streamName, code, lino, _end, terrno);
pTask->notifyInfo.stbFullName = taosStrdup(createReq->targetStbFullName);
TSDB_CHECK_NULL(pTask->notifyInfo.stbFullName, code, lino, _end, terrno);
pTask->notifyInfo.pSchemaWrapper = tCloneSSchemaWrapper(&pStream->outputSchema);
TSDB_CHECK_NULL(pTask->notifyInfo.pSchemaWrapper, code, lino, _end, terrno);
_end:
2025-04-24 01:11:54 +00:00
if (code != TSDB_CODE_SUCCESS) {
2025-04-24 01:11:54 +00:00
mstError("%s failed at line %d since %s", __func__, lino, tstrerror(code));
}
2025-04-24 01:11:54 +00:00
*/
return code;
}
static int32_t addStreamNotifyInfo(SCMCreateStreamReq *createReq, SStreamObj *pStream) {
int32_t code = TSDB_CODE_SUCCESS;
2025-04-24 01:11:54 +00:00
/* STREAMTODO
int32_t lino = 0;
int32_t level = 0;
int32_t nTasks = 0;
SArray *pLevel = NULL;
TSDB_CHECK_NULL(createReq, code, lino, _end, TSDB_CODE_INVALID_PARA);
TSDB_CHECK_NULL(pStream, code, lino, _end, TSDB_CODE_INVALID_PARA);
if (taosArrayGetSize(createReq->pNotifyAddrUrls) == 0) {
goto _end;
}
feat(stream): add new trigger continuous_window_close (#30125) * opt stream build twa result * opt force window close memory * feat(stream):optimize new interval and scan operator * adj log * opt code * opt code * fill history * fix issue for fill history * add ci * feat(stream): add new stream nonblock interval operator * adjust code * use new scan operator * use new scan operator * add log * fix issue * recover stream scan next function * fix issue * fix issue * fix issue * ignore disorder data * fix issue * fix issue for interval sliding * fix issue * fix ci issue * fix ci issue * fix ci issue * add semi && final nonblock interval operator * fix issue * fix issue * fix issue * fix issue * fix issue * fix issue * fix issue * fix issue * refactor(stream): track the msgId for each upstream tasks. * fix(stream): fix race condition. * fix(stream): update the task last msgId when putting into input queue succ. * fix issue * fix issue * put recalculate data to rocksdb * fix issue * fix issue * enh(query)[TD-33071]: add support for saving and restoring tsdbReader scan progress - Implement functionality to save scan progress during tsdbReader operations - Enable resuming scans from the last saved position * fix issue * fix issue * fix issue * fix issue * fix issue * add rec interval check * enh(stream):add recalculate tasks. * enh(stream): support the re-calculate the tasks. * fix issue && do refactor * do refactor * fix issue * fix issue * update backend opt * add new interface * add new session operator * support blob * add new session operator * fix issue * add rec state for rec task * fix invalid read * add new session window * enh(stream): update the stream tasks backend. * new session operator * add pull data * fix(stream): fix error in expand stream backend. * fix issue * fix issue * fix issue * merge code * fix issue * fix(stream): check for null ptr. * fix(stream): add more check. * fix issue * fix issue * fix issue * add debug code * fix issue * fix issue * fix issue * set rec end flag * fix(stream): opt re-calculate stream tasks. * fix issue * fix issue * add new operator * enh(stream): dispatch recalculate block to agg tasks. * fix issue * fix issue * fix(stream): adjust filter. * fix issue * refactor * refactor(stream): adjust the recalculate end block. * fix issue * fix(stream): set correct create trigger block. * fix issue * fix(stream): fix error in build recalculate end block. * fix(stream): check null ptr. * add stream client && fix issue * fix mem leak * fix(stream): free msg. * add stream client * fix(stream): fix error. * add stream client && fix issue * add stream client * refactor(stream): set the recalculate task complete. * add wend and group_id for session window dest table * feat(stream): refactor and set the recalcul agg task complete. * add cfg for adapter * fix issue * add state && event operator * feat(stream): support fill-history task. * add new fill operator * fix(stream): set correct backend when updating fill-history task to recalculate task. * add new fill operator * fix(stream): s2025-03-06 11:10:31.272 et ops always open in scan tsdb * fix(stream):set the correct taskType for sink task. * new fill operator * adj stream fill operator * fix issue * fix issue * fix issue * fix issue * fix issue * fix issue * fix issue * fix issue * adj test * fix issue * fix(stream): fix issue * fix(steam): fix issue * fix(steam): fix issue * fix(steam): fix issue * fix(steam): fix issue * fix(stream): fix issue * fix(stream): fix issue * fix(stream): fix issue * fix: ut com error * fix(stream): fix mem leak and adjust operator type check rule * fix(stream): fix mem leak and adjust test case * refactor code * fix(stream): free items. * fix(stream): free fix memory leak. * fix(stream): fix syntax error. * fix: ignore unexpect block * fix: adjust op type --------- Co-authored-by: Haojun Liao <hjliao@taosdata.com> Co-authored-by: Jinqing Kuang <kuangjinqingcn@gmail.com> Co-authored-by: yihaoDeng <luomoxyz@126.com>
2025-03-14 12:14:01 +00:00
level = taosArrayGetSize(pStream->pTaskList);
for (int32_t i = 0; i < level; ++i) {
feat(stream): add new trigger continuous_window_close (#30125) * opt stream build twa result * opt force window close memory * feat(stream):optimize new interval and scan operator * adj log * opt code * opt code * fill history * fix issue for fill history * add ci * feat(stream): add new stream nonblock interval operator * adjust code * use new scan operator * use new scan operator * add log * fix issue * recover stream scan next function * fix issue * fix issue * fix issue * ignore disorder data * fix issue * fix issue for interval sliding * fix issue * fix ci issue * fix ci issue * fix ci issue * add semi && final nonblock interval operator * fix issue * fix issue * fix issue * fix issue * fix issue * fix issue * fix issue * fix issue * refactor(stream): track the msgId for each upstream tasks. * fix(stream): fix race condition. * fix(stream): update the task last msgId when putting into input queue succ. * fix issue * fix issue * put recalculate data to rocksdb * fix issue * fix issue * enh(query)[TD-33071]: add support for saving and restoring tsdbReader scan progress - Implement functionality to save scan progress during tsdbReader operations - Enable resuming scans from the last saved position * fix issue * fix issue * fix issue * fix issue * fix issue * add rec interval check * enh(stream):add recalculate tasks. * enh(stream): support the re-calculate the tasks. * fix issue && do refactor * do refactor * fix issue * fix issue * update backend opt * add new interface * add new session operator * support blob * add new session operator * fix issue * add rec state for rec task * fix invalid read * add new session window * enh(stream): update the stream tasks backend. * new session operator * add pull data * fix(stream): fix error in expand stream backend. * fix issue * fix issue * fix issue * merge code * fix issue * fix(stream): check for null ptr. * fix(stream): add more check. * fix issue * fix issue * fix issue * add debug code * fix issue * fix issue * fix issue * set rec end flag * fix(stream): opt re-calculate stream tasks. * fix issue * fix issue * add new operator * enh(stream): dispatch recalculate block to agg tasks. * fix issue * fix issue * fix(stream): adjust filter. * fix issue * refactor * refactor(stream): adjust the recalculate end block. * fix issue * fix(stream): set correct create trigger block. * fix issue * fix(stream): fix error in build recalculate end block. * fix(stream): check null ptr. * add stream client && fix issue * fix mem leak * fix(stream): free msg. * add stream client * fix(stream): fix error. * add stream client && fix issue * add stream client * refactor(stream): set the recalculate task complete. * add wend and group_id for session window dest table * feat(stream): refactor and set the recalcul agg task complete. * add cfg for adapter * fix issue * add state && event operator * feat(stream): support fill-history task. * add new fill operator * fix(stream): set correct backend when updating fill-history task to recalculate task. * add new fill operator * fix(stream): s2025-03-06 11:10:31.272 et ops always open in scan tsdb * fix(stream):set the correct taskType for sink task. * new fill operator * adj stream fill operator * fix issue * fix issue * fix issue * fix issue * fix issue * fix issue * fix issue * fix issue * adj test * fix issue * fix(stream): fix issue * fix(steam): fix issue * fix(steam): fix issue * fix(steam): fix issue * fix(steam): fix issue * fix(stream): fix issue * fix(stream): fix issue * fix(stream): fix issue * fix: ut com error * fix(stream): fix mem leak and adjust operator type check rule * fix(stream): fix mem leak and adjust test case * refactor code * fix(stream): free items. * fix(stream): free fix memory leak. * fix(stream): fix syntax error. * fix: ignore unexpect block * fix: adjust op type --------- Co-authored-by: Haojun Liao <hjliao@taosdata.com> Co-authored-by: Jinqing Kuang <kuangjinqingcn@gmail.com> Co-authored-by: yihaoDeng <luomoxyz@126.com>
2025-03-14 12:14:01 +00:00
pLevel = taosArrayGetP(pStream->pTaskList, i);
nTasks = taosArrayGetSize(pLevel);
for (int32_t j = 0; j < nTasks; ++j) {
code = addStreamTaskNotifyInfo(createReq, pStream, taosArrayGetP(pLevel, j));
TSDB_CHECK_CODE(code, lino, _end);
}
}
if (pStream->conf.fillHistory && createReq->notifyHistory) {
feat(stream): add new trigger continuous_window_close (#30125) * opt stream build twa result * opt force window close memory * feat(stream):optimize new interval and scan operator * adj log * opt code * opt code * fill history * fix issue for fill history * add ci * feat(stream): add new stream nonblock interval operator * adjust code * use new scan operator * use new scan operator * add log * fix issue * recover stream scan next function * fix issue * fix issue * fix issue * ignore disorder data * fix issue * fix issue for interval sliding * fix issue * fix ci issue * fix ci issue * fix ci issue * add semi && final nonblock interval operator * fix issue * fix issue * fix issue * fix issue * fix issue * fix issue * fix issue * fix issue * refactor(stream): track the msgId for each upstream tasks. * fix(stream): fix race condition. * fix(stream): update the task last msgId when putting into input queue succ. * fix issue * fix issue * put recalculate data to rocksdb * fix issue * fix issue * enh(query)[TD-33071]: add support for saving and restoring tsdbReader scan progress - Implement functionality to save scan progress during tsdbReader operations - Enable resuming scans from the last saved position * fix issue * fix issue * fix issue * fix issue * fix issue * add rec interval check * enh(stream):add recalculate tasks. * enh(stream): support the re-calculate the tasks. * fix issue && do refactor * do refactor * fix issue * fix issue * update backend opt * add new interface * add new session operator * support blob * add new session operator * fix issue * add rec state for rec task * fix invalid read * add new session window * enh(stream): update the stream tasks backend. * new session operator * add pull data * fix(stream): fix error in expand stream backend. * fix issue * fix issue * fix issue * merge code * fix issue * fix(stream): check for null ptr. * fix(stream): add more check. * fix issue * fix issue * fix issue * add debug code * fix issue * fix issue * fix issue * set rec end flag * fix(stream): opt re-calculate stream tasks. * fix issue * fix issue * add new operator * enh(stream): dispatch recalculate block to agg tasks. * fix issue * fix issue * fix(stream): adjust filter. * fix issue * refactor * refactor(stream): adjust the recalculate end block. * fix issue * fix(stream): set correct create trigger block. * fix issue * fix(stream): fix error in build recalculate end block. * fix(stream): check null ptr. * add stream client && fix issue * fix mem leak * fix(stream): free msg. * add stream client * fix(stream): fix error. * add stream client && fix issue * add stream client * refactor(stream): set the recalculate task complete. * add wend and group_id for session window dest table * feat(stream): refactor and set the recalcul agg task complete. * add cfg for adapter * fix issue * add state && event operator * feat(stream): support fill-history task. * add new fill operator * fix(stream): set correct backend when updating fill-history task to recalculate task. * add new fill operator * fix(stream): s2025-03-06 11:10:31.272 et ops always open in scan tsdb * fix(stream):set the correct taskType for sink task. * new fill operator * adj stream fill operator * fix issue * fix issue * fix issue * fix issue * fix issue * fix issue * fix issue * fix issue * adj test * fix issue * fix(stream): fix issue * fix(steam): fix issue * fix(steam): fix issue * fix(steam): fix issue * fix(steam): fix issue * fix(stream): fix issue * fix(stream): fix issue * fix(stream): fix issue * fix: ut com error * fix(stream): fix mem leak and adjust operator type check rule * fix(stream): fix mem leak and adjust test case * refactor code * fix(stream): free items. * fix(stream): free fix memory leak. * fix(stream): fix syntax error. * fix: ignore unexpect block * fix: adjust op type --------- Co-authored-by: Haojun Liao <hjliao@taosdata.com> Co-authored-by: Jinqing Kuang <kuangjinqingcn@gmail.com> Co-authored-by: yihaoDeng <luomoxyz@126.com>
2025-03-14 12:14:01 +00:00
level = taosArrayGetSize(pStream->pHTaskList);
for (int32_t i = 0; i < level; ++i) {
feat(stream): add new trigger continuous_window_close (#30125) * opt stream build twa result * opt force window close memory * feat(stream):optimize new interval and scan operator * adj log * opt code * opt code * fill history * fix issue for fill history * add ci * feat(stream): add new stream nonblock interval operator * adjust code * use new scan operator * use new scan operator * add log * fix issue * recover stream scan next function * fix issue * fix issue * fix issue * ignore disorder data * fix issue * fix issue for interval sliding * fix issue * fix ci issue * fix ci issue * fix ci issue * add semi && final nonblock interval operator * fix issue * fix issue * fix issue * fix issue * fix issue * fix issue * fix issue * fix issue * refactor(stream): track the msgId for each upstream tasks. * fix(stream): fix race condition. * fix(stream): update the task last msgId when putting into input queue succ. * fix issue * fix issue * put recalculate data to rocksdb * fix issue * fix issue * enh(query)[TD-33071]: add support for saving and restoring tsdbReader scan progress - Implement functionality to save scan progress during tsdbReader operations - Enable resuming scans from the last saved position * fix issue * fix issue * fix issue * fix issue * fix issue * add rec interval check * enh(stream):add recalculate tasks. * enh(stream): support the re-calculate the tasks. * fix issue && do refactor * do refactor * fix issue * fix issue * update backend opt * add new interface * add new session operator * support blob * add new session operator * fix issue * add rec state for rec task * fix invalid read * add new session window * enh(stream): update the stream tasks backend. * new session operator * add pull data * fix(stream): fix error in expand stream backend. * fix issue * fix issue * fix issue * merge code * fix issue * fix(stream): check for null ptr. * fix(stream): add more check. * fix issue * fix issue * fix issue * add debug code * fix issue * fix issue * fix issue * set rec end flag * fix(stream): opt re-calculate stream tasks. * fix issue * fix issue * add new operator * enh(stream): dispatch recalculate block to agg tasks. * fix issue * fix issue * fix(stream): adjust filter. * fix issue * refactor * refactor(stream): adjust the recalculate end block. * fix issue * fix(stream): set correct create trigger block. * fix issue * fix(stream): fix error in build recalculate end block. * fix(stream): check null ptr. * add stream client && fix issue * fix mem leak * fix(stream): free msg. * add stream client * fix(stream): fix error. * add stream client && fix issue * add stream client * refactor(stream): set the recalculate task complete. * add wend and group_id for session window dest table * feat(stream): refactor and set the recalcul agg task complete. * add cfg for adapter * fix issue * add state && event operator * feat(stream): support fill-history task. * add new fill operator * fix(stream): set correct backend when updating fill-history task to recalculate task. * add new fill operator * fix(stream): s2025-03-06 11:10:31.272 et ops always open in scan tsdb * fix(stream):set the correct taskType for sink task. * new fill operator * adj stream fill operator * fix issue * fix issue * fix issue * fix issue * fix issue * fix issue * fix issue * fix issue * adj test * fix issue * fix(stream): fix issue * fix(steam): fix issue * fix(steam): fix issue * fix(steam): fix issue * fix(steam): fix issue * fix(stream): fix issue * fix(stream): fix issue * fix(stream): fix issue * fix: ut com error * fix(stream): fix mem leak and adjust operator type check rule * fix(stream): fix mem leak and adjust test case * refactor code * fix(stream): free items. * fix(stream): free fix memory leak. * fix(stream): fix syntax error. * fix: ignore unexpect block * fix: adjust op type --------- Co-authored-by: Haojun Liao <hjliao@taosdata.com> Co-authored-by: Jinqing Kuang <kuangjinqingcn@gmail.com> Co-authored-by: yihaoDeng <luomoxyz@126.com>
2025-03-14 12:14:01 +00:00
pLevel = taosArrayGetP(pStream->pHTaskList, i);
nTasks = taosArrayGetSize(pLevel);
for (int32_t j = 0; j < nTasks; ++j) {
code = addStreamTaskNotifyInfo(createReq, pStream, taosArrayGetP(pLevel, j));
TSDB_CHECK_CODE(code, lino, _end);
}
}
}
_end:
2025-04-24 01:11:54 +00:00
if (code != TSDB_CODE_SUCCESS) {
mError("%s for stream %s failed at line %d since %s", __func__, pStream->name, lino, tstrerror(code));
}
2025-04-24 01:11:54 +00:00
*/
return code;
}
2022-06-16 08:01:22 +00:00
int32_t mndDropStreamByDb(SMnode *pMnode, STrans *pTrans, SDbObj *pDb) {
2024-08-02 03:38:30 +00:00
SSdb *pSdb = pMnode->pSdb;
void *pIter = NULL;
int32_t code = 0;
2022-06-16 08:01:22 +00:00
while (1) {
2022-07-02 03:55:59 +00:00
SStreamObj *pStream = NULL;
2022-06-16 08:01:22 +00:00
pIter = sdbFetch(pSdb, SDB_STREAM, pIter, (void **)&pStream);
if (pIter == NULL) break;
2025-04-24 01:11:54 +00:00
/* STREAMTODO
2022-06-16 08:01:22 +00:00
if (pStream->sourceDbUid == pDb->uid || pStream->targetDbUid == pDb->uid) {
if (pStream->sourceDbUid != pStream->targetDbUid) {
sdbRelease(pSdb, pStream);
2022-07-02 03:55:59 +00:00
sdbCancelFetch(pSdb, pIter);
mError("db:%s, failed to drop stream:%s since sourceDbUid:%" PRId64 " not match with targetDbUid:%" PRId64,
pDb->name, pStream->name, pStream->sourceDbUid, pStream->targetDbUid);
2024-08-02 03:38:30 +00:00
TAOS_RETURN(TSDB_CODE_MND_STREAM_MUST_BE_DELETED);
2022-06-16 08:01:22 +00:00
} else {
2025-04-24 01:11:54 +00:00
//STREAMTODO drop the stream obj in execInfo
//removeStreamTasksInBuf(pStream, &execInfo);
2024-08-02 03:38:30 +00:00
code = mndPersistTransLog(pStream, pTrans, SDB_STATUS_DROPPED);
if (code != TSDB_CODE_SUCCESS && code != TSDB_CODE_ACTION_IN_PROGRESS) {
2022-06-16 08:01:22 +00:00
sdbRelease(pSdb, pStream);
2022-07-02 03:55:59 +00:00
sdbCancelFetch(pSdb, pIter);
2024-08-02 03:38:30 +00:00
return code;
2022-06-16 08:01:22 +00:00
}
}
}
2025-04-24 01:11:54 +00:00
*/
2022-06-16 08:01:22 +00:00
sdbRelease(pSdb, pStream);
}
return 0;
}
2022-05-16 06:55:31 +00:00
static int32_t mndRetrieveStream(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows) {
2024-01-15 11:56:38 +00:00
SMnode *pMnode = pReq->info.node;
SSdb *pSdb = pMnode->pSdb;
2022-03-10 09:15:45 +00:00
int32_t numOfRows = 0;
SStreamObj *pStream = NULL;
int32_t code = 0;
2022-03-10 09:15:45 +00:00
while (numOfRows < rows) {
2022-04-28 08:31:35 +00:00
pShow->pIter = sdbFetch(pSdb, SDB_STREAM, pShow->pIter, (void **)&pStream);
2022-03-10 09:15:45 +00:00
if (pShow->pIter == NULL) break;
2025-04-24 01:11:54 +00:00
//STREAMTODO
//code = mndStreamGenerateResBlock(pStream, pBlock, numOfRows);
if (code == 0) {
numOfRows++;
}
sdbRelease(pSdb, pStream);
}
2022-03-10 09:15:45 +00:00
pShow->numOfRows += numOfRows;
return numOfRows;
}
2022-03-10 09:15:45 +00:00
static void mndCancelGetNextStream(SMnode *pMnode, void *pIter) {
SSdb *pSdb = pMnode->pSdb;
sdbCancelFetchByType(pSdb, pIter, SDB_STREAM);
}
2022-03-10 09:15:45 +00:00
static int32_t mndRetrieveStreamTask(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rowsCapacity) {
2024-01-15 11:56:38 +00:00
SMnode *pMnode = pReq->info.node;
SSdb *pSdb = pMnode->pSdb;
int32_t numOfRows = 0;
SStreamObj *pStream = NULL;
int32_t code = 0;
pShow->numOfRows += numOfRows;
return numOfRows;
}
static void mndCancelGetNextStreamTask(SMnode *pMnode, void *pIter) {
SSdb *pSdb = pMnode->pSdb;
sdbCancelFetchByType(pSdb, pIter, SDB_STREAM);
}
2023-03-28 11:39:38 +00:00
static void doSendQuickRsp(SRpcHandleInfo *pInfo, int32_t msgSize, int32_t vgId, int32_t code) {
SRpcMsg rsp = {.code = code, .info = *pInfo, .contLen = msgSize};
rsp.pCont = rpcMallocCont(rsp.contLen);
if (rsp.pCont != NULL) {
SMsgHead *pHead = rsp.pCont;
pHead->vgId = htonl(vgId);
tmsgSendRsp(&rsp);
pInfo->handle = NULL; // disable auto rsp
}
}
2025-05-17 02:55:32 +00:00
static int32_t mndProcessStopStreamReq(SRpcMsg *pReq) {
2025-04-10 01:09:30 +00:00
SMnode *pMnode = pReq->info.node;
SStreamObj *pStream = NULL;
2025-04-10 11:41:37 +00:00
int32_t code = 0;
2025-04-10 11:41:37 +00:00
SMPauseStreamReq pauseReq = {0};
if (tDeserializeSMPauseStreamReq(pReq->pCont, pReq->contLen, &pauseReq) < 0) {
TAOS_RETURN(TSDB_CODE_INVALID_MSG);
}
2024-07-22 05:31:57 +00:00
2025-04-10 11:41:37 +00:00
code = mndAcquireStream(pMnode, pauseReq.name, &pStream);
if (pStream == NULL || code != 0) {
if (pauseReq.igNotExists) {
mInfo("stream:%s, not exist, not pause stream", pauseReq.name);
return 0;
} else {
mError("stream:%s not exist, failed to pause stream", pauseReq.name);
TAOS_RETURN(TSDB_CODE_MND_STREAM_NOT_EXIST);
}
}
2025-04-10 11:41:37 +00:00
int64_t streamId = pStream->pCreate->streamId;
2025-04-10 01:09:30 +00:00
2025-04-10 11:41:37 +00:00
mstInfo("start to pause stream %s", pauseReq.name);
code = mndCheckDbPrivilegeByName(pMnode, pReq->info.conn.user, MND_OPER_WRITE_DB, pStream->pCreate->streamDB);
if (code != TSDB_CODE_SUCCESS) {
mstError("user %s failed to pause stream %s since %s", pReq->info.conn.user, pauseReq.name, tstrerror(code));
sdbRelease(pMnode->pSdb, pStream);
return code;
}
2025-04-10 11:41:37 +00:00
STrans *pTrans = NULL;
2025-05-17 02:55:32 +00:00
code = mndStreamCreateTrans(pMnode, pStream, pReq, TRN_CONFLICT_NOTHING, MND_STREAM_STOP_NAME, &pTrans);
2025-04-10 11:41:37 +00:00
if (pTrans == NULL || code) {
mstError("failed to pause stream %s since %s", pauseReq.name, tstrerror(code));
sdbRelease(pMnode->pSdb, pStream);
return code;
}
2025-04-30 10:39:59 +00:00
atomic_store_8(&pStream->userStopped, 1);
2025-04-10 11:41:37 +00:00
// pause stream
code = mndStreamTransAppend(pStream, pTrans, SDB_STATUS_READY);
if (code != TSDB_CODE_SUCCESS) {
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 pause stream trans since %s", pTrans->id, tstrerror(code));
sdbRelease(pMnode->pSdb, pStream);
mndTransDrop(pTrans);
return code;
}
2025-05-10 09:16:39 +00:00
mndStreamPostAction(mStreamMgmt.actionQ, streamId, pStream->pCreate->name, STREAM_ACT_UNDEPLOY);
2025-04-14 05:20:57 +00:00
2025-04-10 11:41:37 +00:00
sdbRelease(pMnode->pSdb, pStream);
mndTransDrop(pTrans);
return TSDB_CODE_ACTION_IN_PROGRESS;
}
2025-05-17 02:55:32 +00:00
static int32_t mndProcessStartStreamReq(SRpcMsg *pReq) {
2025-04-10 11:41:37 +00:00
SMnode *pMnode = pReq->info.node;
SStreamObj *pStream = NULL;
int32_t code = 0;
if ((code = grantCheckExpire(TSDB_GRANT_STREAMS)) < 0) {
return code;
}
SMResumeStreamReq resumeReq = {0};
if (tDeserializeSMResumeStreamReq(pReq->pCont, pReq->contLen, &resumeReq) < 0) {
TAOS_RETURN(TSDB_CODE_INVALID_MSG);
}
code = mndAcquireStream(pMnode, resumeReq.name, &pStream);
if (pStream == NULL || code != 0) {
if (resumeReq.igNotExists) {
mInfo("stream:%s not exist, not resume stream", resumeReq.name);
sdbRelease(pMnode->pSdb, pStream);
return 0;
} else {
mError("stream:%s not exist, failed to resume stream", resumeReq.name);
TAOS_RETURN(TSDB_CODE_MND_STREAM_NOT_EXIST);
2025-04-10 01:09:30 +00:00
}
}
2025-04-10 11:41:37 +00:00
int64_t streamId = pStream->pCreate->streamId;
2025-04-24 01:11:54 +00:00
2025-04-30 10:39:59 +00:00
atomic_store_8(&pStream->userStopped, 0);
2025-04-10 11:41:37 +00:00
2025-05-17 02:55:32 +00:00
mstInfo("start to start stream %s from stopped", resumeReq.name);
2025-04-10 11:41:37 +00:00
code = mndCheckDbPrivilegeByName(pMnode, pReq->info.conn.user, MND_OPER_WRITE_DB, pStream->pCreate->streamDB);
if (code != TSDB_CODE_SUCCESS) {
mstError("user %s failed to resume stream %s since %s", pReq->info.conn.user, resumeReq.name, tstrerror(code));
sdbRelease(pMnode->pSdb, pStream);
return code;
2025-04-10 01:09:30 +00:00
}
2025-04-10 11:41:37 +00:00
STrans *pTrans = NULL;
2025-05-17 02:55:32 +00:00
code = mndStreamCreateTrans(pMnode, pStream, pReq, TRN_CONFLICT_NOTHING, MND_STREAM_START_NAME, &pTrans);
2025-04-10 11:41:37 +00:00
if (pTrans == NULL || code) {
mstError("failed to resume stream %s since %s", resumeReq.name, tstrerror(code));
sdbRelease(pMnode->pSdb, pStream);
return code;
}
code = mndStreamTransAppend(pStream, pTrans, SDB_STATUS_READY);
if (code != TSDB_CODE_SUCCESS) {
mstError("failed to resume stream %s since %s", resumeReq.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) {
mstError("trans:%d, failed to prepare pause stream %s trans since %s", pTrans->id, resumeReq.name, tstrerror(code));
sdbRelease(pMnode->pSdb, pStream);
mndTransDrop(pTrans);
return code;
}
2025-05-10 09:16:39 +00:00
mndStreamPostAction(mStreamMgmt.actionQ, streamId, pStream->pCreate->name, STREAM_ACT_DEPLOY);
2025-04-14 05:20:57 +00:00
2025-04-10 11:41:37 +00:00
sdbRelease(pMnode->pSdb, pStream);
mndTransDrop(pTrans);
return TSDB_CODE_ACTION_IN_PROGRESS;
}
static int32_t mndProcessDropStreamReq(SRpcMsg *pReq) {
SMnode *pMnode = pReq->info.node;
SStreamObj *pStream = NULL;
int32_t code = 0;
SMDropStreamReq dropReq = {0};
if (tDeserializeSMDropStreamReq(pReq->pCont, pReq->contLen, &dropReq) < 0) {
mError("invalid drop stream msg recv, discarded");
code = TSDB_CODE_INVALID_MSG;
TAOS_RETURN(code);
}
mDebug("recv drop stream:%s msg", dropReq.name);
code = mndAcquireStream(pMnode, dropReq.name, &pStream);
if (pStream == NULL || code != 0) {
if (dropReq.igNotExists) {
mInfo("stream:%s not exist, ignore not exist is set, drop stream exec done with success", dropReq.name);
sdbRelease(pMnode->pSdb, pStream);
tFreeMDropStreamReq(&dropReq);
return 0;
} else {
mError("stream:%s not exist failed to drop it", dropReq.name);
tFreeMDropStreamReq(&dropReq);
TAOS_RETURN(TSDB_CODE_MND_STREAM_NOT_EXIST);
}
}
2025-04-10 11:41:37 +00:00
int64_t streamId = pStream->pCreate->streamId;
code = mndCheckDbPrivilegeByName(pMnode, pReq->info.conn.user, MND_OPER_WRITE_DB, pStream->pCreate->streamDB);
2025-04-10 01:09:30 +00:00
if (code != 0) {
2025-04-10 11:41:37 +00:00
mstError("user %s failed to drop stream %s since %s", pReq->info.conn.user, dropReq.name, tstrerror(code));
sdbRelease(pMnode->pSdb, pStream);
tFreeMDropStreamReq(&dropReq);
return code;
}
2025-04-10 11:41:37 +00:00
if (pStream->pCreate->tsmaId != 0) {
2025-04-24 01:11:54 +00:00
mstDebug("try to drop tsma related stream, tsmaId:%" PRIx64, pStream->pCreate->tsmaId);
2025-04-10 11:41:37 +00:00
void *pIter = NULL;
SSmaObj *pSma = NULL;
pIter = sdbFetch(pMnode->pSdb, SDB_SMA, pIter, (void **)&pSma);
while (pIter) {
if (pSma && pSma->uid == pStream->pCreate->tsmaId) {
sdbRelease(pMnode->pSdb, pSma);
sdbRelease(pMnode->pSdb, pStream);
sdbCancelFetch(pMnode->pSdb, pIter);
tFreeMDropStreamReq(&dropReq);
code = TSDB_CODE_TSMA_MUST_BE_DROPPED;
mstError("refused to drop tsma-related stream %s since tsma still exists", dropReq.name);
TAOS_RETURN(code);
}
if (pSma) {
sdbRelease(pMnode->pSdb, pSma);
}
pIter = sdbFetch(pMnode->pSdb, SDB_SMA, pIter, (void **)&pSma);
}
2025-04-10 01:09:30 +00:00
}
2025-05-06 02:27:12 +00:00
mstInfo("start to drop stream %s", pStream->pCreate->name);
atomic_store_8(&pStream->userDropped, 1);
2025-04-30 10:39:59 +00:00
msmUndeployStream(pMnode, streamId, pStream->pCreate->name);
2025-04-14 05:20:57 +00:00
2025-04-10 11:41:37 +00:00
STrans *pTrans = NULL;
code = mndStreamCreateTrans(pMnode, pStream, pReq, TRN_CONFLICT_NOTHING, MND_STREAM_DROP_NAME, &pTrans);
if (pTrans == NULL || code) {
mstError("failed to drop stream %s since %s", dropReq.name, tstrerror(code));
sdbRelease(pMnode->pSdb, pStream);
tFreeMDropStreamReq(&dropReq);
TAOS_RETURN(code);
}
2025-04-10 11:41:37 +00:00
// drop stream
code = mndStreamTransAppend(pStream, pTrans, SDB_STATUS_DROPPED);
if (code) {
mstError("trans:%d, failed to append drop stream trans since %s", pTrans->id, tstrerror(code));
sdbRelease(pMnode->pSdb, pStream);
mndTransDrop(pTrans);
tFreeMDropStreamReq(&dropReq);
TAOS_RETURN(code);
}
2025-04-10 11:41:37 +00:00
code = mndTransPrepare(pMnode, pTrans);
if (code != TSDB_CODE_SUCCESS && code != TSDB_CODE_ACTION_IN_PROGRESS) {
mstError("trans:%d, failed to prepare drop stream trans since %s", pTrans->id, tstrerror(code));
sdbRelease(pMnode->pSdb, pStream);
mndTransDrop(pTrans);
tFreeMDropStreamReq(&dropReq);
TAOS_RETURN(code);
}
2025-04-29 11:22:25 +00:00
auditRecord(pReq, pMnode->clusterId, "dropStream", "", pStream->pCreate->streamDB, NULL, 0);
2025-04-10 11:41:37 +00:00
sdbRelease(pMnode->pSdb, pStream);
mndTransDrop(pTrans);
mstDebug("drop stream %s half completed", dropReq.name);
code = TSDB_CODE_ACTION_IN_PROGRESS;
tFreeMDropStreamReq(&dropReq);
TAOS_RETURN(code);
}
static int32_t mndProcessCreateStreamReq(SRpcMsg *pReq) {
SMnode *pMnode = pReq->info.node;
SStreamObj *pStream = NULL;
SStreamObj streamObj = {0};
int32_t code = TSDB_CODE_SUCCESS;
int32_t lino = 0;
STrans *pTrans = NULL;
SCMCreateStreamReq* pCreate = taosMemoryCalloc(1, sizeof(SCMCreateStreamReq));
TSDB_CHECK_NULL(pCreate, code, lino, _OVER, terrno);
code = tDeserializeSCMCreateStreamReq(pReq->pCont, pReq->contLen, pCreate);
2025-04-10 01:09:30 +00:00
TSDB_CHECK_CODE(code, lino, _OVER);
2025-04-10 11:41:37 +00:00
#ifdef WINDOWS
code = TSDB_CODE_MND_INVALID_PLATFORM;
goto _OVER;
#endif
uint64_t streamId = pCreate->streamId;
2025-04-10 01:09:30 +00:00
2025-04-10 11:41:37 +00:00
mstInfo("start to create stream %s, sql:%s", pCreate->name, pCreate->sql);
2025-05-17 02:55:32 +00:00
int32_t snodeId = msmAssignRandomSnodeId(pMnode, streamId);
if (0 == snodeId) {
code = terrno;
TSDB_CHECK_CODE(code, lino, _OVER);
}
2025-04-10 11:41:37 +00:00
code = mndAcquireStream(pMnode, pCreate->name, &pStream);
if (pStream != NULL && code == 0) {
if (pCreate->igExists) {
mstInfo("stream %s already exist, ignore exist is set", pCreate->name);
} else {
code = TSDB_CODE_MND_STREAM_ALREADY_EXIST;
2025-04-10 01:09:30 +00:00
}
2024-08-02 02:47:06 +00:00
2025-04-10 11:41:37 +00:00
mndReleaseStream(pMnode, pStream);
goto _OVER;
} else if (code != TSDB_CODE_MND_STREAM_NOT_EXIST) {
goto _OVER;
}
if ((code = grantCheck(TSDB_GRANT_STREAMS)) < 0) {
goto _OVER;
}
2025-04-25 06:59:41 +00:00
code = mndStreamValidateCreate(pMnode, pReq->info.conn.user, pCreate);
TSDB_CHECK_CODE(code, lino, _OVER);
2025-05-17 02:55:32 +00:00
code = mndStreamBuildObj(pMnode, &streamObj, pCreate, snodeId);
2025-04-10 11:41:37 +00:00
TSDB_CHECK_CODE(code, lino, _OVER);
pStream = &streamObj;
code = mndStreamCreateTrans(pMnode, pStream, pReq, TRN_CONFLICT_DB, MND_STREAM_CREATE_NAME, &pTrans);
2025-04-10 01:09:30 +00:00
if (pTrans == NULL || code) {
goto _OVER;
}
2025-04-10 01:09:30 +00:00
// create stb for stream
2025-04-24 01:11:54 +00:00
if (TSDB_SUPER_TABLE == pCreate->outTblType && !pCreate->outStbExists) {
pCreate->outStbUid = mndGenerateUid(pCreate->outTblName, strlen(pCreate->outTblName));
code = mndStreamCreateOutStb(pMnode, pTrans, pStream->pCreate, pReq->info.conn.user);
2025-04-10 11:41:37 +00:00
TSDB_CHECK_CODE(code, lino, _OVER);
}
2025-04-10 01:09:30 +00:00
// add stream to trans
2025-04-10 11:41:37 +00:00
code = mndStreamTransAppend(pStream, pTrans, SDB_STATUS_READY);
2025-04-10 01:09:30 +00:00
if (code != TSDB_CODE_SUCCESS && code != TSDB_CODE_ACTION_IN_PROGRESS) {
2025-04-10 11:41:37 +00:00
mstError("failed to persist stream %s since %s", pCreate->name, tstrerror(code));
2025-04-10 01:09:30 +00:00
goto _OVER;
}
2025-04-10 01:09:30 +00:00
// execute creation
code = mndTransPrepare(pMnode, pTrans);
if (code != TSDB_CODE_SUCCESS && code != TSDB_CODE_ACTION_IN_PROGRESS) {
2025-04-10 11:41:37 +00:00
mstError("trans:%d, failed to prepare since %s", pTrans->id, tstrerror(code));
2025-04-10 01:09:30 +00:00
goto _OVER;
}
2025-04-10 11:41:37 +00:00
auditRecord(pReq, pMnode->clusterId, "createStream", pCreate->streamDB, pCreate->name, pCreate->sql, strlen(pCreate->sql));
2025-05-10 09:16:39 +00:00
mndStreamPostAction(mStreamMgmt.actionQ, streamId, pStream->pCreate->name, STREAM_ACT_DEPLOY);
2025-04-10 01:09:30 +00:00
_OVER:
2025-04-10 11:41:37 +00:00
2025-04-10 01:09:30 +00:00
if (code != TSDB_CODE_SUCCESS && code != TSDB_CODE_ACTION_IN_PROGRESS) {
2025-04-10 11:41:37 +00:00
mstError("failed to create stream %s at line:%d since %s", pCreate->name, lino, tstrerror(code));
2025-04-10 01:09:30 +00:00
} else {
2025-04-10 11:41:37 +00:00
mstDebug("create stream %s half completed", pCreate->name);
2025-04-10 01:09:30 +00:00
code = TSDB_CODE_ACTION_IN_PROGRESS;
}
2024-08-02 02:47:06 +00:00
mndTransDrop(pTrans);
2025-04-10 01:09:30 +00:00
tFreeStreamObj(&streamObj);
2024-08-02 02:47:06 +00:00
return code;
2024-08-16 08:53:44 +00:00
}
2025-04-10 01:09:30 +00:00
2025-04-10 11:41:37 +00:00
int32_t mndInitStream(SMnode *pMnode) {
SSdbTable table = {
.sdbType = SDB_STREAM,
.keyType = SDB_KEY_BINARY,
.encodeFp = (SdbEncodeFp)mndStreamActionEncode,
.decodeFp = (SdbDecodeFp)mndStreamActionDecode,
.insertFp = (SdbInsertFp)mndStreamActionInsert,
.updateFp = (SdbUpdateFp)mndStreamActionUpdate,
.deleteFp = (SdbDeleteFp)mndStreamActionDelete,
};
2025-04-28 08:47:32 +00:00
/*
2025-04-10 11:41:37 +00:00
SSdbTable tableSeq = {
.sdbType = SDB_STREAM_SEQ,
.keyType = SDB_KEY_BINARY,
.encodeFp = (SdbEncodeFp)mndStreamSeqActionEncode,
.decodeFp = (SdbDecodeFp)mndStreamSeqActionDecode,
.insertFp = (SdbInsertFp)mndStreamSeqActionInsert,
.updateFp = (SdbUpdateFp)mndStreamSeqActionUpdate,
.deleteFp = (SdbDeleteFp)mndStreamSeqActionDelete,
};
2025-04-28 08:47:32 +00:00
*/
2025-04-10 11:41:37 +00:00
mndSetMsgHandle(pMnode, TDMT_MND_CREATE_STREAM, mndProcessCreateStreamReq);
mndSetMsgHandle(pMnode, TDMT_MND_DROP_STREAM, mndProcessDropStreamReq);
2025-05-17 02:55:32 +00:00
mndSetMsgHandle(pMnode, TDMT_MND_START_STREAM, mndProcessStartStreamReq);
mndSetMsgHandle(pMnode, TDMT_MND_STOP_STREAM, mndProcessStopStreamReq);
2025-04-14 05:20:57 +00:00
mndSetMsgHandle(pMnode, TDMT_MND_STREAM_HEARTBEAT, mndProcessStreamHb);
2025-04-10 11:41:37 +00:00
mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_STREAMS, mndRetrieveStream);
mndAddShowFreeIterHandle(pMnode, TSDB_MGMT_TABLE_STREAMS, mndCancelGetNextStream);
mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_STREAM_TASKS, mndRetrieveStreamTask);
mndAddShowFreeIterHandle(pMnode, TSDB_MGMT_TABLE_STREAM_TASKS, mndCancelGetNextStreamTask);
2025-04-14 05:20:57 +00:00
int32_t code = msmInitRuntimeInfo(pMnode);
2025-04-10 11:41:37 +00:00
if (code) {
return code;
}
code = sdbSetTable(pMnode->pSdb, table);
if (code) {
return code;
}
2025-04-28 08:47:32 +00:00
//code = sdbSetTable(pMnode->pSdb, tableSeq);
2025-04-10 11:41:37 +00:00
return code;
}