TDengine/include/common/tmsg.h

6867 lines
204 KiB
C
Raw Permalink Normal View History

2021-10-08 05:53:49 +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/>.
*/
#ifndef _TD_COMMON_TAOS_MSG_H_
#define _TD_COMMON_TAOS_MSG_H_
feat(taosx): support distributed taosx (#34126) * feat: add xnode syntax * refactor(xnode): reduce function complexity * chore: add lost xnode.h file * feat(xnode): create xnode task * chore: fix double free error * add xnoded * start xnoded as subprocess * complete xnode task feature * complete show xnode jobs feature * complete with option feature * complete alter xnode job feature * complete alter xnode task feature * complete user pass feature * clean code * modify status type as char * fix leader ep null * fix start task req null * fix pass id for status * support timeout msg * drop xnode task relative jobs * clean code * wip * chore: add test cases for xnode * chore: fix 3.0 merge changes * fix drain core dump and create task core dump * add password check * retrieve xnode status from xnoded * pass integer as double to cjson * add some debug log * add some job log * fix start task lock * do not handle http response * fix coredump drop xnode task by name * support start/stop/drop task by name * remove mock xnoded * support unix socket * kill pre-xnoded before start * support dnode close xnoded * test(xnode): add unit test cases for xnode * rebalance support where clause * fix some test issue * unformat http post content json string * add xnode zh doc * modify drain description * remove job create/stop/drop operation * support rebalance all without where condition * support alter task by name * add NULL param for mndCheckOperPrivilege * add xnode txnode module for libmnode.a * code clean * change parser len to 4096 * clean code * chore: try to fix gtest/gtest.h not found * chore: fix markdown files * chore: fix markdown in zh * chore: fix enum issue and add ci * chore: fix test case problem * chore: fix pKeyVal overflow * chore: rename to 排空节点 * chore: external cmake remove parallel * chore: add DEP_ext_gtest for xnode test * chore: fix gtest errors * chore: remove gtest pthread lib * chore: fix data type not match * chore: fix some lint errors * chore: fix void unlink * chore: fix return with null pointer check * chore: fix pointer double free and xnodeMemoryTest strncpy null * chore: fix xnode encode action invalid datelen * chore: remove TD_LINUX condition * chore: use PRIu64 denote long long * chore: fix task parser NULL and allow no with clause * fix(xnode): fix windows build error * chore: fix windows curl error * chore: fix test case ins_tables relative error * chore: fix memory leak * docs: update taosx docs * chore: update taosx docs * chore: add role priviledge table * chore: fix error code doc * chore: fix test_xnode.py * chore: fix doc typo * fix: ci error while run test_user_privilege_sysinfo.py --------- Co-authored-by: Linhe Huo <linhehuo@gmail.com> Co-authored-by: huohong <sallyhuo@taosdata.com> Co-authored-by: Simon Guan <guanshengliang@qq.com>
2026-01-01 06:51:03 +00:00
#include <stdint.h>
2021-10-08 05:53:49 +00:00
#include "taosdef.h"
#include "taoserror.h"
2021-12-31 03:45:44 +00:00
#include "tarray.h"
2021-12-25 06:35:39 +00:00
#include "tcoding.h"
2024-03-12 09:47:01 +00:00
#include "tcol.h"
2022-02-28 09:39:07 +00:00
#include "tencode.h"
2022-01-07 02:36:42 +00:00
#include "thash.h"
2021-12-29 09:20:10 +00:00
#include "tlist.h"
2022-03-10 11:05:58 +00:00
#include "tname.h"
2025-12-29 11:27:11 +00:00
#include "tpriv.h"
2022-03-23 02:44:32 +00:00
#include "trow.h"
2022-03-16 10:29:31 +00:00
#include "tuuid.h"
2021-10-08 05:53:49 +00:00
2022-02-28 09:39:07 +00:00
#ifdef __cplusplus
extern "C" {
#endif
2021-12-29 09:20:10 +00:00
/* ------------------------ MESSAGE DEFINITIONS ------------------------ */
2023-12-01 07:15:12 +00:00
2021-12-24 07:00:51 +00:00
#define TD_MSG_NUMBER_
#undef TD_MSG_DICT_
#undef TD_MSG_INFO_
#undef TD_MSG_TYPE_INFO_
2023-12-01 07:15:12 +00:00
#undef TD_MSG_RANGE_CODE_
2021-12-24 07:00:51 +00:00
#undef TD_MSG_SEG_CODE_
#include "tmsgdef.h"
#undef TD_MSG_NUMBER_
#undef TD_MSG_DICT_
#undef TD_MSG_INFO_
#undef TD_MSG_TYPE_INFO_
2023-12-01 07:15:12 +00:00
#undef TD_MSG_RANGE_CODE_
2021-12-24 07:00:51 +00:00
#define TD_MSG_SEG_CODE_
#include "tmsgdef.h"
#undef TD_MSG_NUMBER_
#undef TD_MSG_DICT_
#undef TD_MSG_INFO_
#undef TD_MSG_TYPE_INFO_
2021-12-24 07:00:51 +00:00
#undef TD_MSG_SEG_CODE_
2023-12-01 07:15:12 +00:00
#undef TD_MSG_RANGE_CODE_
2021-12-24 07:00:51 +00:00
#include "tmsgdef.h"
2022-02-28 09:39:07 +00:00
extern char* tMsgInfo[];
extern int32_t tMsgDict[];
2023-12-01 09:19:34 +00:00
extern int32_t tMsgRangeDict[];
2021-12-24 07:00:51 +00:00
2023-12-01 07:15:12 +00:00
typedef uint16_t tmsg_t;
2021-12-24 07:00:51 +00:00
feat(taosx): support distributed taosx (#34126) * feat: add xnode syntax * refactor(xnode): reduce function complexity * chore: add lost xnode.h file * feat(xnode): create xnode task * chore: fix double free error * add xnoded * start xnoded as subprocess * complete xnode task feature * complete show xnode jobs feature * complete with option feature * complete alter xnode job feature * complete alter xnode task feature * complete user pass feature * clean code * modify status type as char * fix leader ep null * fix start task req null * fix pass id for status * support timeout msg * drop xnode task relative jobs * clean code * wip * chore: add test cases for xnode * chore: fix 3.0 merge changes * fix drain core dump and create task core dump * add password check * retrieve xnode status from xnoded * pass integer as double to cjson * add some debug log * add some job log * fix start task lock * do not handle http response * fix coredump drop xnode task by name * support start/stop/drop task by name * remove mock xnoded * support unix socket * kill pre-xnoded before start * support dnode close xnoded * test(xnode): add unit test cases for xnode * rebalance support where clause * fix some test issue * unformat http post content json string * add xnode zh doc * modify drain description * remove job create/stop/drop operation * support rebalance all without where condition * support alter task by name * add NULL param for mndCheckOperPrivilege * add xnode txnode module for libmnode.a * code clean * change parser len to 4096 * clean code * chore: try to fix gtest/gtest.h not found * chore: fix markdown files * chore: fix markdown in zh * chore: fix enum issue and add ci * chore: fix test case problem * chore: fix pKeyVal overflow * chore: rename to 排空节点 * chore: external cmake remove parallel * chore: add DEP_ext_gtest for xnode test * chore: fix gtest errors * chore: remove gtest pthread lib * chore: fix data type not match * chore: fix some lint errors * chore: fix void unlink * chore: fix return with null pointer check * chore: fix pointer double free and xnodeMemoryTest strncpy null * chore: fix xnode encode action invalid datelen * chore: remove TD_LINUX condition * chore: use PRIu64 denote long long * chore: fix task parser NULL and allow no with clause * fix(xnode): fix windows build error * chore: fix windows curl error * chore: fix test case ins_tables relative error * chore: fix memory leak * docs: update taosx docs * chore: update taosx docs * chore: add role priviledge table * chore: fix error code doc * chore: fix test_xnode.py * chore: fix doc typo * fix: ci error while run test_user_privilege_sysinfo.py --------- Co-authored-by: Linhe Huo <linhehuo@gmail.com> Co-authored-by: huohong <sallyhuo@taosdata.com> Co-authored-by: Simon Guan <guanshengliang@qq.com>
2026-01-01 06:51:03 +00:00
#define TMSG_SEG_CODE(TYPE) (((TYPE) & 0xff00) >> 8)
#define TMSG_SEG_SEQ(TYPE) ((TYPE) & 0xff)
2023-12-01 07:15:12 +00:00
#define TMSG_INDEX(TYPE) (tMsgDict[TMSG_SEG_CODE(TYPE)] + TMSG_SEG_SEQ(TYPE))
2021-12-24 07:40:15 +00:00
2025-12-15 08:48:20 +00:00
#define DECODESQL() \
do { \
if (!tDecodeIsEnd(&decoder)) { \
TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->sqlLen)); \
if (pReq->sqlLen > 0) { \
TAOS_CHECK_EXIT(tDecodeBinaryAlloc(&decoder, (void**)&pReq->sql, NULL)); \
} \
} \
2025-04-24 01:11:54 +00:00
} while (0)
2025-12-15 08:48:20 +00:00
#define ENCODESQL() \
do { \
TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->sqlLen)); \
if (pReq->sqlLen > 0) { \
TAOS_CHECK_EXIT(tEncodeBinary(&encoder, (const uint8_t*)pReq->sql, pReq->sqlLen)); \
} \
2025-04-24 01:11:54 +00:00
} while (0)
#define FREESQL() \
do { \
if (pReq->sql != NULL) { \
taosMemoryFree(pReq->sql); \
} \
pReq->sql = NULL; \
} while (0)
2023-03-05 03:36:01 +00:00
static inline bool tmsgIsValid(tmsg_t type) {
2023-12-01 09:16:12 +00:00
// static int8_t sz = sizeof(tMsgRangeDict) / sizeof(tMsgRangeDict[0]);
int8_t maxSegIdx = TMSG_SEG_CODE(TDMT_MAX_MSG_MIN);
2023-12-01 09:16:12 +00:00
int segIdx = TMSG_SEG_CODE(type);
2023-12-01 09:19:34 +00:00
if (segIdx >= 0 && segIdx < maxSegIdx) {
return type < tMsgRangeDict[segIdx];
2023-03-05 03:36:01 +00:00
}
2023-12-01 09:19:34 +00:00
return false;
2023-03-05 03:36:01 +00:00
}
2023-12-01 09:19:34 +00:00
#define TMSG_INFO(type) (tmsgIsValid(type) ? tMsgInfo[TMSG_INDEX(type)] : "unKnown")
2021-12-24 07:40:15 +00:00
static inline bool vnodeIsMsgBlock(tmsg_t type) {
return (type == TDMT_VND_CREATE_TABLE) || (type == TDMT_VND_ALTER_TABLE) || (type == TDMT_VND_DROP_TABLE) ||
2023-09-01 05:24:47 +00:00
(type == TDMT_VND_UPDATE_TAG_VAL) || (type == TDMT_VND_ALTER_CONFIRM) || (type == TDMT_VND_COMMIT) ||
(type == TDMT_SYNC_CONFIG_CHANGE);
}
static inline bool syncUtilUserCommit(tmsg_t msgType) {
return msgType != TDMT_SYNC_NOOP && msgType != TDMT_SYNC_LEADER_TRANSFER;
}
2021-12-29 09:20:10 +00:00
/* ------------------------ OTHER DEFINITIONS ------------------------ */
2021-10-08 05:53:49 +00:00
// IE type
2022-02-17 11:07:39 +00:00
#define TSDB_IE_TYPE_SEC 1
#define TSDB_IE_TYPE_META 2
#define TSDB_IE_TYPE_MGMT_IP 3
#define TSDB_IE_TYPE_DNODE_CFG 4
2021-10-08 05:53:49 +00:00
#define TSDB_IE_TYPE_NEW_VERSION 5
2022-02-17 11:07:39 +00:00
#define TSDB_IE_TYPE_DNODE_EXT 6
2021-10-08 05:53:49 +00:00
#define TSDB_IE_TYPE_DNODE_STATE 7
enum {
CONN_TYPE__QUERY = 1,
CONN_TYPE__TMQ,
CONN_TYPE__UDFD,
CONN_TYPE__AUTH_TEST, // only for test authentication
CONN_TYPE__MAX,
};
2022-01-14 02:48:05 +00:00
2022-01-26 00:50:32 +00:00
enum {
2022-05-06 06:13:56 +00:00
HEARTBEAT_KEY_USER_AUTHINFO = 1,
HEARTBEAT_KEY_DBINFO,
2022-01-25 10:29:26 +00:00
HEARTBEAT_KEY_STBINFO,
HEARTBEAT_KEY_TMQ,
2023-10-12 11:56:17 +00:00
HEARTBEAT_KEY_DYN_VIEW,
HEARTBEAT_KEY_VIEWINFO,
2023-11-29 11:07:23 +00:00
HEARTBEAT_KEY_TSMA,
2022-01-25 10:29:26 +00:00
};
2021-12-02 11:56:43 +00:00
typedef enum _mgmt_table {
TSDB_MGMT_TABLE_START,
2021-10-08 05:53:49 +00:00
TSDB_MGMT_TABLE_DNODE,
TSDB_MGMT_TABLE_MNODE,
2022-04-14 12:54:43 +00:00
TSDB_MGMT_TABLE_MODULE,
2021-12-29 12:05:10 +00:00
TSDB_MGMT_TABLE_QNODE,
TSDB_MGMT_TABLE_SNODE,
feat(mqtt): mqtt subscription (#30127) * feat(mqtt): Initial commit for mqtt * chore(xnode/mnd): xnode message handlers for mnode * chore(mnd/xnode): mnode part for xnode * chore(xnode/translater): fix show commands * fix(ast/creater): fix xnode create option * fix(xnode/ci): fix ci & doc's error codes * chore(xnode/sql): make create/drop/show work properly * fix(xnode/sql): commit new files * fix(xnode/sql): commit cmake files * fix: fix testing cases * fix(xnode/tsc): fix tokens * fix(ast/anode): fix anode update decl. * fix(xnode/error): fix xnode error codes * fix: xnode make/destroy * chore: xnode with option & dnode id * chore: use taosmqtt for xnode * chore: new error code for xnode launching * chore(xnode): new error code * chore: header for _xnode_mgmt_mqtt * chore: source for _xnode_mgmt_mqtt * chore: remove test directory from cmake * chore: remove taosmqtt for ci to compile * chore: remove taosudf header from xnode * chore: new window macro * chore: remove xnode mgmt mqtt for windows compilation * Revert "chore: remove xnode mgmt mqtt for windows compilation" This reverts commit 197e1640c79e40343e683f42236b3f0824392944. * chore: cleanup code * chore: xnode mgmt comment windows part out * chore: mgmt/mqtt, move uv head toppest * xnode/mnode: create xnode once per dnode * fix(xnode/systable/test): fix column count * xnode/sdb: renumber sdb type for xnode to make start/stop order correct * xnode/mqtt: new param mqttPort * fix SXnode's struct type * transfer dnode id to mqtt subscription * tmqtt: remove uv_a linking * tmqtt/tools: sources for tools * tools: fix windows compilation * tools/producer: fix windows sleep param * tools/producer: fix uninited var rc * make tools only for linux * test/mnodes: wail 1 or 2 seconds for offline to be leader * update topic producer tool for geometry data type testing * format tool sql statements * show xnodes' ep * make shell auto complete xnodes * use usleep instead of sleep * mqtt/proto: first version mqtt protocol * remove assert styles * build with linux only * fix libuv for taosmqtt building * fix log printing * mem: use ttq_ prefix instead of tmqtt * xnode/parser/proto: protocol option for xnode * xnode/translater/option: translate xnode option proto * xnode/translator: translate proto param * xnode/tmsg: encode/decode proto param * xnode/mnode: proto parma for mndXnode * xnode/proto: protocol param for xnode * xnode/mqtt: save/load proto from xnode json * rename tmqtt proto header * rename head directories * rename header name styles * restyle func names * update * update * use camel db * use camel for cxt * update count of information_schema * fix exceptional cases * fix w.r.t reviews * fixes w.r.t reviews * use ttq_free * append xnode msgs * update information schema count * support tmq meta data sub * success typo fix Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * fix error line var w.r.t. suggestions from copilot * denote mqtt node with bnode instead of xnode * smoke testing for mqtt * soak testing * new package for test framework: paho 2.1.0 * import mqtt into util * fix soak testing * test/soak: user 5 topics per client * test/soak: cover qos * update docker image references to tdengine-ci:0.1 in CI scripts and common.py * refactor: rename bnode msg to backup node * refactor: rename xnode to bnode 1 * refactor: rename xnode to bnode 2 * refactor: rename xnode to bnode 3 * refactor: rename xnode to bnode 4 * refactor: rename xnode to bnode 4 * refactor: rename xnode to bnode 5 * refactor: rename xnode to bnode 6 * refactor: rename some files 1 * refactor: rename some files 2 * refactor: rename some files 3 * refactor: rename some files 4 --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: chenhaoran <haoran920c@163.com> Co-authored-by: Simon Guan <guanshengliang@qq.com>
2025-06-25 06:58:51 +00:00
TSDB_MGMT_TABLE_BACKUP_NODE, // no longer used
2022-04-14 12:54:43 +00:00
TSDB_MGMT_TABLE_CLUSTER,
TSDB_MGMT_TABLE_DB,
TSDB_MGMT_TABLE_FUNC,
TSDB_MGMT_TABLE_INDEX,
2021-12-10 07:20:04 +00:00
TSDB_MGMT_TABLE_STB,
2021-10-08 05:53:49 +00:00
TSDB_MGMT_TABLE_STREAMS,
2022-04-14 12:54:43 +00:00
TSDB_MGMT_TABLE_TABLE,
2022-07-16 08:03:45 +00:00
TSDB_MGMT_TABLE_TAG,
TSDB_MGMT_TABLE_COL,
2022-04-14 12:54:43 +00:00
TSDB_MGMT_TABLE_USER,
2021-10-08 05:53:49 +00:00
TSDB_MGMT_TABLE_GRANTS,
2022-04-14 12:54:43 +00:00
TSDB_MGMT_TABLE_VGROUP,
TSDB_MGMT_TABLE_TOPICS,
TSDB_MGMT_TABLE_CONSUMERS,
2022-05-09 10:09:55 +00:00
TSDB_MGMT_TABLE_SUBSCRIPTIONS,
2022-04-14 12:54:43 +00:00
TSDB_MGMT_TABLE_TRANS,
TSDB_MGMT_TABLE_SMAS,
TSDB_MGMT_TABLE_CONFIGS,
TSDB_MGMT_TABLE_CONNS,
TSDB_MGMT_TABLE_QUERIES,
2021-10-08 05:53:49 +00:00
TSDB_MGMT_TABLE_VNODES,
2022-06-15 12:59:33 +00:00
TSDB_MGMT_TABLE_APPS,
TSDB_MGMT_TABLE_STREAM_TASKS,
2025-06-24 10:06:20 +00:00
TSDB_MGMT_TABLE_STREAM_RECALCULATES,
2022-12-01 05:37:32 +00:00
TSDB_MGMT_TABLE_PRIVILEGES,
2023-09-19 06:19:54 +00:00
TSDB_MGMT_TABLE_VIEWS,
2023-11-27 08:59:58 +00:00
TSDB_MGMT_TABLE_TSMAS,
2023-11-23 04:43:28 +00:00
TSDB_MGMT_TABLE_COMPACT,
TSDB_MGMT_TABLE_COMPACT_DETAIL,
2024-01-18 07:23:38 +00:00
TSDB_MGMT_TABLE_GRANTS_FULL,
2024-01-31 05:52:03 +00:00
TSDB_MGMT_TABLE_GRANTS_LOGS,
2024-01-18 09:49:11 +00:00
TSDB_MGMT_TABLE_MACHINES,
TSDB_MGMT_TABLE_ARBGROUP,
2024-03-26 11:56:15 +00:00
TSDB_MGMT_TABLE_ENCRYPTIONS,
2024-06-17 06:31:39 +00:00
TSDB_MGMT_TABLE_USER_FULL,
2024-10-09 09:09:43 +00:00
TSDB_MGMT_TABLE_ANODE,
TSDB_MGMT_TABLE_ANODE_FULL,
2024-08-01 07:07:43 +00:00
TSDB_MGMT_TABLE_USAGE,
2024-11-18 08:57:15 +00:00
TSDB_MGMT_TABLE_FILESETS,
TSDB_MGMT_TABLE_TRANSACTION_DETAIL,
TSDB_MGMT_TABLE_VC_COL,
feat(mqtt): mqtt subscription (#30127) * feat(mqtt): Initial commit for mqtt * chore(xnode/mnd): xnode message handlers for mnode * chore(mnd/xnode): mnode part for xnode * chore(xnode/translater): fix show commands * fix(ast/creater): fix xnode create option * fix(xnode/ci): fix ci & doc's error codes * chore(xnode/sql): make create/drop/show work properly * fix(xnode/sql): commit new files * fix(xnode/sql): commit cmake files * fix: fix testing cases * fix(xnode/tsc): fix tokens * fix(ast/anode): fix anode update decl. * fix(xnode/error): fix xnode error codes * fix: xnode make/destroy * chore: xnode with option & dnode id * chore: use taosmqtt for xnode * chore: new error code for xnode launching * chore(xnode): new error code * chore: header for _xnode_mgmt_mqtt * chore: source for _xnode_mgmt_mqtt * chore: remove test directory from cmake * chore: remove taosmqtt for ci to compile * chore: remove taosudf header from xnode * chore: new window macro * chore: remove xnode mgmt mqtt for windows compilation * Revert "chore: remove xnode mgmt mqtt for windows compilation" This reverts commit 197e1640c79e40343e683f42236b3f0824392944. * chore: cleanup code * chore: xnode mgmt comment windows part out * chore: mgmt/mqtt, move uv head toppest * xnode/mnode: create xnode once per dnode * fix(xnode/systable/test): fix column count * xnode/sdb: renumber sdb type for xnode to make start/stop order correct * xnode/mqtt: new param mqttPort * fix SXnode's struct type * transfer dnode id to mqtt subscription * tmqtt: remove uv_a linking * tmqtt/tools: sources for tools * tools: fix windows compilation * tools/producer: fix windows sleep param * tools/producer: fix uninited var rc * make tools only for linux * test/mnodes: wail 1 or 2 seconds for offline to be leader * update topic producer tool for geometry data type testing * format tool sql statements * show xnodes' ep * make shell auto complete xnodes * use usleep instead of sleep * mqtt/proto: first version mqtt protocol * remove assert styles * build with linux only * fix libuv for taosmqtt building * fix log printing * mem: use ttq_ prefix instead of tmqtt * xnode/parser/proto: protocol option for xnode * xnode/translater/option: translate xnode option proto * xnode/translator: translate proto param * xnode/tmsg: encode/decode proto param * xnode/mnode: proto parma for mndXnode * xnode/proto: protocol param for xnode * xnode/mqtt: save/load proto from xnode json * rename tmqtt proto header * rename head directories * rename header name styles * restyle func names * update * update * use camel db * use camel for cxt * update count of information_schema * fix exceptional cases * fix w.r.t reviews * fixes w.r.t reviews * use ttq_free * append xnode msgs * update information schema count * support tmq meta data sub * success typo fix Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * fix error line var w.r.t. suggestions from copilot * denote mqtt node with bnode instead of xnode * smoke testing for mqtt * soak testing * new package for test framework: paho 2.1.0 * import mqtt into util * fix soak testing * test/soak: user 5 topics per client * test/soak: cover qos * update docker image references to tdengine-ci:0.1 in CI scripts and common.py * refactor: rename bnode msg to backup node * refactor: rename xnode to bnode 1 * refactor: rename xnode to bnode 2 * refactor: rename xnode to bnode 3 * refactor: rename xnode to bnode 4 * refactor: rename xnode to bnode 4 * refactor: rename xnode to bnode 5 * refactor: rename xnode to bnode 6 * refactor: rename some files 1 * refactor: rename some files 2 * refactor: rename some files 3 * refactor: rename some files 4 --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: chenhaoran <haoran920c@163.com> Co-authored-by: Simon Guan <guanshengliang@qq.com>
2025-06-25 06:58:51 +00:00
TSDB_MGMT_TABLE_BNODE,
2025-07-12 07:39:29 +00:00
TSDB_MGMT_TABLE_MOUNT,
feat[ts-6107]: shared storage (#31552) * add API to use s3 as shared storage * support using local file system as shared storage * upload file to shared storage * support read, compact and drop * finish basic mnode & vnode msg processing * follower sync migration state * implement mnode transaction, and improve log * send migration progress msg to dnode to avoid deadlock * implement following migration * remove mcount * avoid redo migration on startup * avoid follower deadlock when leader is down * trigger migrate by timer, avoid compact after migration * comment out the usage of 'tcs' functions in stream * change config item prefix from s3 to ss * change db option prefix from s3 to ss * rename s3 data struct, function, file to ss * rename s3 macro to ss * update s3 sql to ss * rename remaining s3 items to ss * check ss configruation, improve s3 retry * grant object storage -> shared storage, check ssEnabled * fix memory leaks * update build options * omit sensitive information when dump config * fix backward compatibility issue * fix issues found in ci-checks * fix some failed test cases * avoid follower timeout and improve log * fix: follower timeout because migration status not updated * refuse migration if there's an in progress one * fix ss test case * remove garbage files and other minor improvement * fix failed test cases * update unit test * fix failed test case * fix failed test case * update document * update document and fix failed test cases * fix minor issues in code, test and document * check new commit after migration task is scheduled * fix several issus 1. migrate information cannot be dropped sometimes because progress response was put into read queue. 2. memory leak in rare cases 3. data corruption in rare cases 4. failed test case * add shared storage upgrade tool * fix compile error
2025-07-14 08:33:53 +00:00
TSDB_MGMT_TABLE_SSMIGRATE,
TSDB_MGMT_TABLE_SCAN,
TSDB_MGMT_TABLE_SCAN_DETAIL,
2025-09-26 09:32:32 +00:00
TSDB_MGMT_TABLE_RSMA,
TSDB_MGMT_TABLE_RETENTION,
TSDB_MGMT_TABLE_RETENTION_DETAIL,
2025-11-28 02:10:37 +00:00
TSDB_MGMT_TABLE_INSTANCE,
2025-12-05 05:26:28 +00:00
TSDB_MGMT_TABLE_ENCRYPT_ALGORITHMS,
TSDB_MGMT_TABLE_TOKEN,
TSDB_MGMT_TABLE_ENCRYPT_STATUS,
2025-12-29 11:27:11 +00:00
TSDB_MGMT_TABLE_ROLE,
TSDB_MGMT_TABLE_ROLE_PRIVILEGES,
TSDB_MGMT_TABLE_ROLE_COL_PRIVILEGES,
feat(taosx): support distributed taosx (#34126) * feat: add xnode syntax * refactor(xnode): reduce function complexity * chore: add lost xnode.h file * feat(xnode): create xnode task * chore: fix double free error * add xnoded * start xnoded as subprocess * complete xnode task feature * complete show xnode jobs feature * complete with option feature * complete alter xnode job feature * complete alter xnode task feature * complete user pass feature * clean code * modify status type as char * fix leader ep null * fix start task req null * fix pass id for status * support timeout msg * drop xnode task relative jobs * clean code * wip * chore: add test cases for xnode * chore: fix 3.0 merge changes * fix drain core dump and create task core dump * add password check * retrieve xnode status from xnoded * pass integer as double to cjson * add some debug log * add some job log * fix start task lock * do not handle http response * fix coredump drop xnode task by name * support start/stop/drop task by name * remove mock xnoded * support unix socket * kill pre-xnoded before start * support dnode close xnoded * test(xnode): add unit test cases for xnode * rebalance support where clause * fix some test issue * unformat http post content json string * add xnode zh doc * modify drain description * remove job create/stop/drop operation * support rebalance all without where condition * support alter task by name * add NULL param for mndCheckOperPrivilege * add xnode txnode module for libmnode.a * code clean * change parser len to 4096 * clean code * chore: try to fix gtest/gtest.h not found * chore: fix markdown files * chore: fix markdown in zh * chore: fix enum issue and add ci * chore: fix test case problem * chore: fix pKeyVal overflow * chore: rename to 排空节点 * chore: external cmake remove parallel * chore: add DEP_ext_gtest for xnode test * chore: fix gtest errors * chore: remove gtest pthread lib * chore: fix data type not match * chore: fix some lint errors * chore: fix void unlink * chore: fix return with null pointer check * chore: fix pointer double free and xnodeMemoryTest strncpy null * chore: fix xnode encode action invalid datelen * chore: remove TD_LINUX condition * chore: use PRIu64 denote long long * chore: fix task parser NULL and allow no with clause * fix(xnode): fix windows build error * chore: fix windows curl error * chore: fix test case ins_tables relative error * chore: fix memory leak * docs: update taosx docs * chore: update taosx docs * chore: add role priviledge table * chore: fix error code doc * chore: fix test_xnode.py * chore: fix doc typo * fix: ci error while run test_user_privilege_sysinfo.py --------- Co-authored-by: Linhe Huo <linhehuo@gmail.com> Co-authored-by: huohong <sallyhuo@taosdata.com> Co-authored-by: Simon Guan <guanshengliang@qq.com>
2026-01-01 06:51:03 +00:00
TSDB_MGMT_TABLE_XNODES,
TSDB_MGMT_TABLE_XNODE_TASKS,
TSDB_MGMT_TABLE_XNODE_AGENTS,
TSDB_MGMT_TABLE_XNODE_JOBS,
TSDB_MGMT_TABLE_XNODE_FULL,
TSDB_MGMT_TABLE_VIRTUAL_TABLES_REFERENCING,
TSDB_MGMT_TABLE_SECURITY_POLICIES,
2021-10-08 05:53:49 +00:00
TSDB_MGMT_TABLE_MAX,
2021-12-02 11:56:43 +00:00
} EShowType;
2021-10-08 05:53:49 +00:00
2025-09-26 09:32:32 +00:00
typedef enum {
TSDB_OPTR_NORMAL = 0, // default
TSDB_OPTR_SSMIGRATE = 1,
TSDB_OPTR_ROLLUP = 2,
} ETsdbOpType;
typedef enum {
TSDB_TRIGGER_MANUAL = 0, // default
TSDB_TRIGGER_AUTO = 1,
} ETriggerType;
2024-05-30 11:41:22 +00:00
#define TSDB_ALTER_TABLE_ADD_TAG 1
#define TSDB_ALTER_TABLE_DROP_TAG 2
#define TSDB_ALTER_TABLE_UPDATE_TAG_NAME 3
2026-03-18 06:19:15 +00:00
#define TSDB_ALTER_TABLE_UPDATE_TAG_VAL 4 // deprecated, kept for wire compatibility
2024-05-30 11:41:22 +00:00
#define TSDB_ALTER_TABLE_ADD_COLUMN 5
#define TSDB_ALTER_TABLE_DROP_COLUMN 6
#define TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES 7
#define TSDB_ALTER_TABLE_UPDATE_TAG_BYTES 8
#define TSDB_ALTER_TABLE_UPDATE_OPTIONS 9
#define TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME 10
#define TSDB_ALTER_TABLE_ADD_TAG_INDEX 11
#define TSDB_ALTER_TABLE_DROP_TAG_INDEX 12
#define TSDB_ALTER_TABLE_UPDATE_COLUMN_COMPRESS 13
#define TSDB_ALTER_TABLE_ADD_COLUMN_WITH_COMPRESS_OPTION 14
2026-03-18 06:19:15 +00:00
#define TSDB_ALTER_TABLE_UPDATE_MULTI_TAG_VAL 15 // deprecated, kept for wire compatibility
#define TSDB_ALTER_TABLE_ALTER_COLUMN_REF 16
#define TSDB_ALTER_TABLE_REMOVE_COLUMN_REF 17
#define TSDB_ALTER_TABLE_ADD_COLUMN_WITH_COLUMN_REF 18
2026-03-18 06:19:15 +00:00
#define TSDB_ALTER_TABLE_UPDATE_MULTI_TABLE_TAG_VAL 19 // alter multiple tag values of multi tables
#define TSDB_ALTER_TABLE_UPDATE_CHILD_TABLE_TAG_VAL 20 // alter multiple tag values of the child tables of a stable
2021-10-08 05:53:49 +00:00
2023-02-02 09:16:30 +00:00
#define TSDB_FILL_NONE 0
#define TSDB_FILL_NULL 1
#define TSDB_FILL_NULL_F 2
#define TSDB_FILL_SET_VALUE 3
#define TSDB_FILL_SET_VALUE_F 4
#define TSDB_FILL_LINEAR 5
#define TSDB_FILL_PREV 6
#define TSDB_FILL_NEXT 7
2024-11-28 10:29:20 +00:00
#define TSDB_FILL_NEAR 8
2022-02-17 11:07:39 +00:00
#define TSDB_ALTER_USER_BASIC_INFO 1
// these definitions start from 5 is to keep compatible with old versions
#define TSDB_ALTER_USER_ADD_PRIVILEGES 5
#define TSDB_ALTER_USER_DEL_PRIVILEGES 6
2021-10-08 05:53:49 +00:00
2025-12-29 11:27:11 +00:00
#define TSDB_ALTER_ROLE_LOCK 0x1
#define TSDB_ALTER_ROLE_ROLE 0x2
#define TSDB_ALTER_ROLE_PRIVILEGES 0x3
#define TSDB_ALTER_ROLE_MAX 0x4 // increase according to actual use
#define TSDB_ALTER_RSMA_FUNCTION 0x1
2025-09-26 09:32:32 +00:00
2021-12-24 07:00:51 +00:00
#define TSDB_KILL_MSG_LEN 30
2021-10-08 05:53:49 +00:00
2022-03-04 11:36:03 +00:00
#define TSDB_TABLE_NUM_UNIT 100000
2022-02-17 11:07:39 +00:00
#define TSDB_VN_READ_ACCCESS ((char)0x1)
2021-12-24 07:00:51 +00:00
#define TSDB_VN_WRITE_ACCCESS ((char)0x2)
2022-02-17 11:07:39 +00:00
#define TSDB_VN_ALL_ACCCESS (TSDB_VN_READ_ACCCESS | TSDB_VN_WRITE_ACCCESS)
2021-10-08 05:53:49 +00:00
2021-12-24 07:00:51 +00:00
#define TSDB_COL_NORMAL 0x0u // the normal column of the table
2022-02-17 11:07:39 +00:00
#define TSDB_COL_TAG 0x1u // the tag column type
#define TSDB_COL_UDC 0x2u // the user specified normal string column, it is a dummy column
#define TSDB_COL_TMP 0x4u // internal column generated by the previous operators
#define TSDB_COL_NULL 0x8u // the column filter NULL or not
2021-10-08 05:53:49 +00:00
2022-02-17 11:07:39 +00:00
#define TSDB_COL_IS_TAG(f) (((f & (~(TSDB_COL_NULL))) & TSDB_COL_TAG) != 0)
2021-12-24 07:00:51 +00:00
#define TSDB_COL_IS_NORMAL_COL(f) ((f & (~(TSDB_COL_NULL))) == TSDB_COL_NORMAL)
2022-02-17 11:07:39 +00:00
#define TSDB_COL_IS_UD_COL(f) ((f & (~(TSDB_COL_NULL))) == TSDB_COL_UDC)
feat(taosx): support distributed taosx (#34126) * feat: add xnode syntax * refactor(xnode): reduce function complexity * chore: add lost xnode.h file * feat(xnode): create xnode task * chore: fix double free error * add xnoded * start xnoded as subprocess * complete xnode task feature * complete show xnode jobs feature * complete with option feature * complete alter xnode job feature * complete alter xnode task feature * complete user pass feature * clean code * modify status type as char * fix leader ep null * fix start task req null * fix pass id for status * support timeout msg * drop xnode task relative jobs * clean code * wip * chore: add test cases for xnode * chore: fix 3.0 merge changes * fix drain core dump and create task core dump * add password check * retrieve xnode status from xnoded * pass integer as double to cjson * add some debug log * add some job log * fix start task lock * do not handle http response * fix coredump drop xnode task by name * support start/stop/drop task by name * remove mock xnoded * support unix socket * kill pre-xnoded before start * support dnode close xnoded * test(xnode): add unit test cases for xnode * rebalance support where clause * fix some test issue * unformat http post content json string * add xnode zh doc * modify drain description * remove job create/stop/drop operation * support rebalance all without where condition * support alter task by name * add NULL param for mndCheckOperPrivilege * add xnode txnode module for libmnode.a * code clean * change parser len to 4096 * clean code * chore: try to fix gtest/gtest.h not found * chore: fix markdown files * chore: fix markdown in zh * chore: fix enum issue and add ci * chore: fix test case problem * chore: fix pKeyVal overflow * chore: rename to 排空节点 * chore: external cmake remove parallel * chore: add DEP_ext_gtest for xnode test * chore: fix gtest errors * chore: remove gtest pthread lib * chore: fix data type not match * chore: fix some lint errors * chore: fix void unlink * chore: fix return with null pointer check * chore: fix pointer double free and xnodeMemoryTest strncpy null * chore: fix xnode encode action invalid datelen * chore: remove TD_LINUX condition * chore: use PRIu64 denote long long * chore: fix task parser NULL and allow no with clause * fix(xnode): fix windows build error * chore: fix windows curl error * chore: fix test case ins_tables relative error * chore: fix memory leak * docs: update taosx docs * chore: update taosx docs * chore: add role priviledge table * chore: fix error code doc * chore: fix test_xnode.py * chore: fix doc typo * fix: ci error while run test_user_privilege_sysinfo.py --------- Co-authored-by: Linhe Huo <linhehuo@gmail.com> Co-authored-by: huohong <sallyhuo@taosdata.com> Co-authored-by: Simon Guan <guanshengliang@qq.com>
2026-01-01 06:51:03 +00:00
#define TSDB_COL_REQ_NULL(f) (((f) & TSDB_COL_NULL) != 0)
2022-01-28 02:54:50 +00:00
#define TD_SUPER_TABLE TSDB_SUPER_TABLE
#define TD_CHILD_TABLE TSDB_CHILD_TABLE
#define TD_NORMAL_TABLE TSDB_NORMAL_TABLE
#define TD_VIRTUAL_NORMAL_TABLE TSDB_VIRTUAL_NORMAL_TABLE
#define TD_VIRTUAL_CHILD_TABLE TSDB_VIRTUAL_CHILD_TABLE
2022-01-28 02:54:50 +00:00
2023-09-01 05:24:47 +00:00
typedef enum ENodeType {
// Syntax nodes are used in parser and planner module, and some are also used in executor module, such as COLUMN,
// VALUE, OPERATOR, FUNCTION and so on.
QUERY_NODE_COLUMN = 1,
QUERY_NODE_VALUE,
QUERY_NODE_OPERATOR,
QUERY_NODE_LOGIC_CONDITION,
QUERY_NODE_FUNCTION,
QUERY_NODE_REAL_TABLE,
QUERY_NODE_TEMP_TABLE,
QUERY_NODE_JOIN_TABLE,
QUERY_NODE_GROUPING_SET,
QUERY_NODE_ORDER_BY_EXPR,
QUERY_NODE_LIMIT,
QUERY_NODE_STATE_WINDOW,
QUERY_NODE_SESSION_WINDOW,
QUERY_NODE_INTERVAL_WINDOW,
QUERY_NODE_NODE_LIST,
QUERY_NODE_FILL,
QUERY_NODE_RAW_EXPR, // Only be used in parser module.
QUERY_NODE_TARGET,
QUERY_NODE_DATABLOCK_DESC,
QUERY_NODE_SLOT_DESC,
QUERY_NODE_COLUMN_DEF,
QUERY_NODE_DOWNSTREAM_SOURCE,
QUERY_NODE_DATABASE_OPTIONS,
QUERY_NODE_TABLE_OPTIONS,
QUERY_NODE_INDEX_OPTIONS,
QUERY_NODE_EXPLAIN_OPTIONS,
QUERY_NODE_LEFT_VALUE,
QUERY_NODE_COLUMN_REF,
QUERY_NODE_WHEN_THEN,
QUERY_NODE_CASE_WHEN,
QUERY_NODE_EVENT_WINDOW,
QUERY_NODE_HINT,
2023-09-19 06:19:54 +00:00
QUERY_NODE_VIEW,
2023-11-27 12:01:00 +00:00
QUERY_NODE_WINDOW_OFFSET,
2024-01-17 06:22:19 +00:00
QUERY_NODE_COUNT_WINDOW,
2024-03-07 10:06:15 +00:00
QUERY_NODE_COLUMN_OPTIONS,
2023-11-20 08:36:13 +00:00
QUERY_NODE_TSMA_OPTIONS,
2024-10-09 09:09:43 +00:00
QUERY_NODE_ANOMALY_WINDOW,
2024-11-28 10:29:20 +00:00
QUERY_NODE_RANGE_AROUND,
QUERY_NODE_STREAM_NOTIFY_OPTIONS,
QUERY_NODE_VIRTUAL_TABLE,
QUERY_NODE_SLIDING_WINDOW,
QUERY_NODE_PERIOD_WINDOW,
QUERY_NODE_STREAM_TRIGGER,
QUERY_NODE_STREAM,
QUERY_NODE_STREAM_TAG_DEF,
QUERY_NODE_EXTERNAL_WINDOW,
QUERY_NODE_STREAM_TRIGGER_OPTIONS,
QUERY_NODE_PLACE_HOLDER_TABLE,
QUERY_NODE_TIME_RANGE,
QUERY_NODE_STREAM_OUT_TABLE,
QUERY_NODE_STREAM_CALC_RANGE,
2025-06-03 10:31:49 +00:00
QUERY_NODE_COUNT_WINDOW_ARGS,
feat(mqtt): mqtt subscription (#30127) * feat(mqtt): Initial commit for mqtt * chore(xnode/mnd): xnode message handlers for mnode * chore(mnd/xnode): mnode part for xnode * chore(xnode/translater): fix show commands * fix(ast/creater): fix xnode create option * fix(xnode/ci): fix ci & doc's error codes * chore(xnode/sql): make create/drop/show work properly * fix(xnode/sql): commit new files * fix(xnode/sql): commit cmake files * fix: fix testing cases * fix(xnode/tsc): fix tokens * fix(ast/anode): fix anode update decl. * fix(xnode/error): fix xnode error codes * fix: xnode make/destroy * chore: xnode with option & dnode id * chore: use taosmqtt for xnode * chore: new error code for xnode launching * chore(xnode): new error code * chore: header for _xnode_mgmt_mqtt * chore: source for _xnode_mgmt_mqtt * chore: remove test directory from cmake * chore: remove taosmqtt for ci to compile * chore: remove taosudf header from xnode * chore: new window macro * chore: remove xnode mgmt mqtt for windows compilation * Revert "chore: remove xnode mgmt mqtt for windows compilation" This reverts commit 197e1640c79e40343e683f42236b3f0824392944. * chore: cleanup code * chore: xnode mgmt comment windows part out * chore: mgmt/mqtt, move uv head toppest * xnode/mnode: create xnode once per dnode * fix(xnode/systable/test): fix column count * xnode/sdb: renumber sdb type for xnode to make start/stop order correct * xnode/mqtt: new param mqttPort * fix SXnode's struct type * transfer dnode id to mqtt subscription * tmqtt: remove uv_a linking * tmqtt/tools: sources for tools * tools: fix windows compilation * tools/producer: fix windows sleep param * tools/producer: fix uninited var rc * make tools only for linux * test/mnodes: wail 1 or 2 seconds for offline to be leader * update topic producer tool for geometry data type testing * format tool sql statements * show xnodes' ep * make shell auto complete xnodes * use usleep instead of sleep * mqtt/proto: first version mqtt protocol * remove assert styles * build with linux only * fix libuv for taosmqtt building * fix log printing * mem: use ttq_ prefix instead of tmqtt * xnode/parser/proto: protocol option for xnode * xnode/translater/option: translate xnode option proto * xnode/translator: translate proto param * xnode/tmsg: encode/decode proto param * xnode/mnode: proto parma for mndXnode * xnode/proto: protocol param for xnode * xnode/mqtt: save/load proto from xnode json * rename tmqtt proto header * rename head directories * rename header name styles * restyle func names * update * update * use camel db * use camel for cxt * update count of information_schema * fix exceptional cases * fix w.r.t reviews * fixes w.r.t reviews * use ttq_free * append xnode msgs * update information schema count * support tmq meta data sub * success typo fix Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * fix error line var w.r.t. suggestions from copilot * denote mqtt node with bnode instead of xnode * smoke testing for mqtt * soak testing * new package for test framework: paho 2.1.0 * import mqtt into util * fix soak testing * test/soak: user 5 topics per client * test/soak: cover qos * update docker image references to tdengine-ci:0.1 in CI scripts and common.py * refactor: rename bnode msg to backup node * refactor: rename xnode to bnode 1 * refactor: rename xnode to bnode 2 * refactor: rename xnode to bnode 3 * refactor: rename xnode to bnode 4 * refactor: rename xnode to bnode 4 * refactor: rename xnode to bnode 5 * refactor: rename xnode to bnode 6 * refactor: rename some files 1 * refactor: rename some files 2 * refactor: rename some files 3 * refactor: rename some files 4 --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: chenhaoran <haoran920c@163.com> Co-authored-by: Simon Guan <guanshengliang@qq.com>
2025-06-25 06:58:51 +00:00
QUERY_NODE_BNODE_OPTIONS,
QUERY_NODE_DATE_TIME_RANGE,
QUERY_NODE_IP_RANGE,
QUERY_NODE_USER_OPTIONS,
QUERY_NODE_REMOTE_VALUE,
QUERY_NODE_TOKEN_OPTIONS,
QUERY_NODE_TRUE_FOR,
QUERY_NODE_REMOTE_VALUE_LIST,
QUERY_NODE_SURROUND,
QUERY_NODE_REMOTE_ROW,
QUERY_NODE_REMOTE_ZERO_ROWS,
2026-03-18 06:19:15 +00:00
QUERY_NODE_UPDATE_TAG_VALUE,
QUERY_NODE_ALTER_TABLE_UPDATE_TAG_VAL_CLAUSE,
QUERY_NODE_REMOTE_TABLE,
2026-03-18 06:19:15 +00:00
2023-09-01 05:24:47 +00:00
// Statement nodes are used in parser and planner module.
QUERY_NODE_SET_OPERATOR = 100,
QUERY_NODE_SELECT_STMT,
QUERY_NODE_VNODE_MODIFY_STMT,
QUERY_NODE_CREATE_DATABASE_STMT,
QUERY_NODE_DROP_DATABASE_STMT,
QUERY_NODE_ALTER_DATABASE_STMT,
QUERY_NODE_FLUSH_DATABASE_STMT,
QUERY_NODE_TRIM_DATABASE_STMT,
QUERY_NODE_CREATE_TABLE_STMT,
QUERY_NODE_CREATE_SUBTABLE_CLAUSE,
QUERY_NODE_CREATE_MULTI_TABLES_STMT,
QUERY_NODE_DROP_TABLE_CLAUSE,
QUERY_NODE_DROP_TABLE_STMT,
QUERY_NODE_DROP_SUPER_TABLE_STMT,
QUERY_NODE_ALTER_TABLE_STMT,
QUERY_NODE_ALTER_SUPER_TABLE_STMT,
QUERY_NODE_CREATE_USER_STMT,
QUERY_NODE_ALTER_USER_STMT,
QUERY_NODE_DROP_USER_STMT,
QUERY_NODE_USE_DATABASE_STMT,
QUERY_NODE_CREATE_DNODE_STMT,
QUERY_NODE_DROP_DNODE_STMT,
QUERY_NODE_ALTER_DNODE_STMT,
QUERY_NODE_CREATE_INDEX_STMT,
QUERY_NODE_DROP_INDEX_STMT,
QUERY_NODE_CREATE_QNODE_STMT,
QUERY_NODE_DROP_QNODE_STMT,
2025-07-12 07:39:29 +00:00
QUERY_NODE_CREATE_BACKUP_NODE_STMT, // no longer used
QUERY_NODE_DROP_BACKUP_NODE_STMT, // no longer used
2023-09-01 05:24:47 +00:00
QUERY_NODE_CREATE_SNODE_STMT,
QUERY_NODE_DROP_SNODE_STMT,
QUERY_NODE_CREATE_MNODE_STMT,
QUERY_NODE_DROP_MNODE_STMT,
QUERY_NODE_CREATE_TOPIC_STMT,
QUERY_NODE_DROP_TOPIC_STMT,
QUERY_NODE_DROP_CGROUP_STMT,
QUERY_NODE_ALTER_LOCAL_STMT,
QUERY_NODE_EXPLAIN_STMT,
QUERY_NODE_DESCRIBE_STMT,
QUERY_NODE_RESET_QUERY_CACHE_STMT,
QUERY_NODE_COMPACT_DATABASE_STMT,
2024-11-05 02:55:06 +00:00
QUERY_NODE_COMPACT_VGROUPS_STMT,
2023-09-01 05:24:47 +00:00
QUERY_NODE_CREATE_FUNCTION_STMT,
QUERY_NODE_DROP_FUNCTION_STMT,
QUERY_NODE_CREATE_STREAM_STMT,
QUERY_NODE_DROP_STREAM_STMT,
QUERY_NODE_BALANCE_VGROUP_STMT,
QUERY_NODE_MERGE_VGROUP_STMT,
QUERY_NODE_REDISTRIBUTE_VGROUP_STMT,
QUERY_NODE_SPLIT_VGROUP_STMT,
QUERY_NODE_SYNCDB_STMT,
QUERY_NODE_GRANT_STMT,
QUERY_NODE_REVOKE_STMT,
2023-12-18 06:18:52 +00:00
QUERY_NODE_ALTER_CLUSTER_STMT,
feat[ts-6107]: shared storage (#31552) * add API to use s3 as shared storage * support using local file system as shared storage * upload file to shared storage * support read, compact and drop * finish basic mnode & vnode msg processing * follower sync migration state * implement mnode transaction, and improve log * send migration progress msg to dnode to avoid deadlock * implement following migration * remove mcount * avoid redo migration on startup * avoid follower deadlock when leader is down * trigger migrate by timer, avoid compact after migration * comment out the usage of 'tcs' functions in stream * change config item prefix from s3 to ss * change db option prefix from s3 to ss * rename s3 data struct, function, file to ss * rename s3 macro to ss * update s3 sql to ss * rename remaining s3 items to ss * check ss configruation, improve s3 retry * grant object storage -> shared storage, check ssEnabled * fix memory leaks * update build options * omit sensitive information when dump config * fix backward compatibility issue * fix issues found in ci-checks * fix some failed test cases * avoid follower timeout and improve log * fix: follower timeout because migration status not updated * refuse migration if there's an in progress one * fix ss test case * remove garbage files and other minor improvement * fix failed test cases * update unit test * fix failed test case * fix failed test case * update document * update document and fix failed test cases * fix minor issues in code, test and document * check new commit after migration task is scheduled * fix several issus 1. migrate information cannot be dropped sometimes because progress response was put into read queue. 2. memory leak in rare cases 3. data corruption in rare cases 4. failed test case * add shared storage upgrade tool * fix compile error
2025-07-14 08:33:53 +00:00
QUERY_NODE_SSMIGRATE_DATABASE_STMT,
QUERY_NODE_CREATE_TSMA_STMT,
QUERY_NODE_DROP_TSMA_STMT,
QUERY_NODE_CREATE_VIRTUAL_TABLE_STMT,
QUERY_NODE_CREATE_VIRTUAL_SUBTABLE_STMT,
QUERY_NODE_DROP_VIRTUAL_TABLE_STMT,
QUERY_NODE_ALTER_VIRTUAL_TABLE_STMT,
2025-07-12 07:39:29 +00:00
QUERY_NODE_CREATE_MOUNT_STMT,
QUERY_NODE_DROP_MOUNT_STMT,
QUERY_NODE_SCAN_DATABASE_STMT,
QUERY_NODE_SCAN_VGROUPS_STMT,
2025-11-13 08:38:06 +00:00
QUERY_NODE_TRIM_DATABASE_WAL_STMT,
2025-12-15 08:48:20 +00:00
QUERY_NODE_ALTER_DNODES_RELOAD_TLS_STMT,
QUERY_NODE_CREATE_TOKEN_STMT,
QUERY_NODE_ALTER_TOKEN_STMT,
QUERY_NODE_DROP_TOKEN_STMT,
QUERY_NODE_ALTER_ENCRYPT_KEY_STMT,
2025-12-29 11:27:11 +00:00
QUERY_NODE_CREATE_ROLE_STMT,
QUERY_NODE_DROP_ROLE_STMT,
QUERY_NODE_ALTER_ROLE_STMT,
QUERY_NODE_CREATE_TOTP_SECRET_STMT,
QUERY_NODE_DROP_TOTP_SECRET_STMT,
QUERY_NODE_ALTER_KEY_EXPIRATION_STMT,
// placeholder for [155, 180]
QUERY_NODE_SHOW_CREATE_VIEW_STMT = 181,
QUERY_NODE_SHOW_CREATE_DATABASE_STMT,
QUERY_NODE_SHOW_CREATE_TABLE_STMT,
QUERY_NODE_SHOW_CREATE_STABLE_STMT,
QUERY_NODE_SHOW_TABLE_DISTRIBUTED_STMT,
QUERY_NODE_SHOW_LOCAL_VARIABLES_STMT,
QUERY_NODE_SHOW_SCORES_STMT,
QUERY_NODE_SHOW_TABLE_TAGS_STMT,
QUERY_NODE_KILL_CONNECTION_STMT,
QUERY_NODE_KILL_QUERY_STMT,
QUERY_NODE_KILL_TRANSACTION_STMT,
QUERY_NODE_KILL_COMPACT_STMT,
QUERY_NODE_DELETE_STMT,
QUERY_NODE_INSERT_STMT,
QUERY_NODE_QUERY,
QUERY_NODE_SHOW_DB_ALIVE_STMT,
QUERY_NODE_SHOW_CLUSTER_ALIVE_STMT,
QUERY_NODE_BALANCE_VGROUP_LEADER_STMT,
2024-05-13 08:20:27 +00:00
QUERY_NODE_BALANCE_VGROUP_LEADER_DATABASE_STMT,
QUERY_NODE_RESTORE_DNODE_STMT,
QUERY_NODE_RESTORE_QNODE_STMT,
QUERY_NODE_RESTORE_MNODE_STMT,
QUERY_NODE_RESTORE_VNODE_STMT,
QUERY_NODE_PAUSE_STREAM_STMT,
QUERY_NODE_RESUME_STREAM_STMT,
QUERY_NODE_CREATE_VIEW_STMT,
QUERY_NODE_DROP_VIEW_STMT,
2024-06-24 14:13:03 +00:00
QUERY_NODE_CREATE_SUBTABLE_FROM_FILE_CLAUSE,
2024-10-09 09:09:43 +00:00
QUERY_NODE_CREATE_ANODE_STMT,
QUERY_NODE_DROP_ANODE_STMT,
QUERY_NODE_UPDATE_ANODE_STMT,
2025-01-23 09:37:07 +00:00
QUERY_NODE_ASSIGN_LEADER_STMT,
QUERY_NODE_SHOW_CREATE_TSMA_STMT,
QUERY_NODE_SHOW_CREATE_VTABLE_STMT,
QUERY_NODE_RECALCULATE_STREAM_STMT,
feat(mqtt): mqtt subscription (#30127) * feat(mqtt): Initial commit for mqtt * chore(xnode/mnd): xnode message handlers for mnode * chore(mnd/xnode): mnode part for xnode * chore(xnode/translater): fix show commands * fix(ast/creater): fix xnode create option * fix(xnode/ci): fix ci & doc's error codes * chore(xnode/sql): make create/drop/show work properly * fix(xnode/sql): commit new files * fix(xnode/sql): commit cmake files * fix: fix testing cases * fix(xnode/tsc): fix tokens * fix(ast/anode): fix anode update decl. * fix(xnode/error): fix xnode error codes * fix: xnode make/destroy * chore: xnode with option & dnode id * chore: use taosmqtt for xnode * chore: new error code for xnode launching * chore(xnode): new error code * chore: header for _xnode_mgmt_mqtt * chore: source for _xnode_mgmt_mqtt * chore: remove test directory from cmake * chore: remove taosmqtt for ci to compile * chore: remove taosudf header from xnode * chore: new window macro * chore: remove xnode mgmt mqtt for windows compilation * Revert "chore: remove xnode mgmt mqtt for windows compilation" This reverts commit 197e1640c79e40343e683f42236b3f0824392944. * chore: cleanup code * chore: xnode mgmt comment windows part out * chore: mgmt/mqtt, move uv head toppest * xnode/mnode: create xnode once per dnode * fix(xnode/systable/test): fix column count * xnode/sdb: renumber sdb type for xnode to make start/stop order correct * xnode/mqtt: new param mqttPort * fix SXnode's struct type * transfer dnode id to mqtt subscription * tmqtt: remove uv_a linking * tmqtt/tools: sources for tools * tools: fix windows compilation * tools/producer: fix windows sleep param * tools/producer: fix uninited var rc * make tools only for linux * test/mnodes: wail 1 or 2 seconds for offline to be leader * update topic producer tool for geometry data type testing * format tool sql statements * show xnodes' ep * make shell auto complete xnodes * use usleep instead of sleep * mqtt/proto: first version mqtt protocol * remove assert styles * build with linux only * fix libuv for taosmqtt building * fix log printing * mem: use ttq_ prefix instead of tmqtt * xnode/parser/proto: protocol option for xnode * xnode/translater/option: translate xnode option proto * xnode/translator: translate proto param * xnode/tmsg: encode/decode proto param * xnode/mnode: proto parma for mndXnode * xnode/proto: protocol param for xnode * xnode/mqtt: save/load proto from xnode json * rename tmqtt proto header * rename head directories * rename header name styles * restyle func names * update * update * use camel db * use camel for cxt * update count of information_schema * fix exceptional cases * fix w.r.t reviews * fixes w.r.t reviews * use ttq_free * append xnode msgs * update information schema count * support tmq meta data sub * success typo fix Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * fix error line var w.r.t. suggestions from copilot * denote mqtt node with bnode instead of xnode * smoke testing for mqtt * soak testing * new package for test framework: paho 2.1.0 * import mqtt into util * fix soak testing * test/soak: user 5 topics per client * test/soak: cover qos * update docker image references to tdengine-ci:0.1 in CI scripts and common.py * refactor: rename bnode msg to backup node * refactor: rename xnode to bnode 1 * refactor: rename xnode to bnode 2 * refactor: rename xnode to bnode 3 * refactor: rename xnode to bnode 4 * refactor: rename xnode to bnode 4 * refactor: rename xnode to bnode 5 * refactor: rename xnode to bnode 6 * refactor: rename some files 1 * refactor: rename some files 2 * refactor: rename some files 3 * refactor: rename some files 4 --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: chenhaoran <haoran920c@163.com> Co-authored-by: Simon Guan <guanshengliang@qq.com>
2025-06-25 06:58:51 +00:00
QUERY_NODE_CREATE_BNODE_STMT,
QUERY_NODE_DROP_BNODE_STMT,
QUERY_NODE_KILL_SSMIGRATE_STMT,
QUERY_NODE_KILL_SCAN_STMT,
2025-09-26 09:32:32 +00:00
QUERY_NODE_CREATE_RSMA_STMT,
QUERY_NODE_DROP_RSMA_STMT,
QUERY_NODE_ALTER_RSMA_STMT,
QUERY_NODE_SHOW_CREATE_RSMA_STMT,
QUERY_NODE_ROLLUP_DATABASE_STMT,
QUERY_NODE_ROLLUP_VGROUPS_STMT,
QUERY_NODE_KILL_RETENTION_STMT,
QUERY_NODE_SET_VGROUP_KEEP_VERSION_STMT,
2025-12-05 05:26:28 +00:00
QUERY_NODE_CREATE_ENCRYPT_ALGORITHMS_STMT,
QUERY_NODE_DROP_ENCRYPT_ALGR_STMT,
QUERY_NODE_SHOW_CREATE_STREAM_STMT,
// show statement nodes
// see 'sysTableShowAdapter', 'SYSTABLE_SHOW_TYPE_OFFSET'
QUERY_NODE_SHOW_DNODES_STMT = 400,
2023-09-01 05:24:47 +00:00
QUERY_NODE_SHOW_MNODES_STMT,
QUERY_NODE_SHOW_MODULES_STMT,
QUERY_NODE_SHOW_QNODES_STMT,
QUERY_NODE_SHOW_SNODES_STMT,
2025-07-12 07:39:29 +00:00
QUERY_NODE_SHOW_BACKUP_NODES_STMT, // no longer used
QUERY_NODE_SHOW_ARBGROUPS_STMT,
2023-09-01 05:24:47 +00:00
QUERY_NODE_SHOW_CLUSTER_STMT,
QUERY_NODE_SHOW_DATABASES_STMT,
QUERY_NODE_SHOW_FUNCTIONS_STMT,
QUERY_NODE_SHOW_INDEXES_STMT,
QUERY_NODE_SHOW_STABLES_STMT,
QUERY_NODE_SHOW_STREAMS_STMT,
QUERY_NODE_SHOW_TABLES_STMT,
QUERY_NODE_SHOW_TAGS_STMT,
QUERY_NODE_SHOW_USERS_STMT,
2024-06-17 06:31:39 +00:00
QUERY_NODE_SHOW_USERS_FULL_STMT,
2023-09-01 05:24:47 +00:00
QUERY_NODE_SHOW_LICENCES_STMT,
QUERY_NODE_SHOW_VGROUPS_STMT,
QUERY_NODE_SHOW_TOPICS_STMT,
QUERY_NODE_SHOW_CONSUMERS_STMT,
QUERY_NODE_SHOW_CONNECTIONS_STMT,
QUERY_NODE_SHOW_QUERIES_STMT,
QUERY_NODE_SHOW_APPS_STMT,
QUERY_NODE_SHOW_VARIABLES_STMT,
QUERY_NODE_SHOW_DNODE_VARIABLES_STMT,
QUERY_NODE_SHOW_TRANSACTIONS_STMT,
QUERY_NODE_SHOW_SUBSCRIPTIONS_STMT,
QUERY_NODE_SHOW_VNODES_STMT,
QUERY_NODE_SHOW_USER_PRIVILEGES_STMT,
2023-10-09 09:19:36 +00:00
QUERY_NODE_SHOW_VIEWS_STMT,
2023-11-23 07:26:21 +00:00
QUERY_NODE_SHOW_COMPACTS_STMT,
2023-12-18 10:26:42 +00:00
QUERY_NODE_SHOW_COMPACT_DETAILS_STMT,
2024-01-18 07:23:38 +00:00
QUERY_NODE_SHOW_GRANTS_FULL_STMT,
2024-01-31 05:52:03 +00:00
QUERY_NODE_SHOW_GRANTS_LOGS_STMT,
2024-01-18 09:49:11 +00:00
QUERY_NODE_SHOW_CLUSTER_MACHINES_STMT,
2024-03-26 11:56:15 +00:00
QUERY_NODE_SHOW_ENCRYPTIONS_STMT,
2023-11-27 08:59:58 +00:00
QUERY_NODE_SHOW_TSMAS_STMT,
2024-10-09 09:09:43 +00:00
QUERY_NODE_SHOW_ANODES_STMT,
QUERY_NODE_SHOW_ANODES_FULL_STMT,
2024-11-04 10:44:56 +00:00
QUERY_NODE_SHOW_USAGE_STMT,
2024-11-21 02:16:17 +00:00
QUERY_NODE_SHOW_FILESETS_STMT,
QUERY_NODE_SHOW_TRANSACTION_DETAILS_STMT,
QUERY_NODE_SHOW_VTABLES_STMT,
feat(mqtt): mqtt subscription (#30127) * feat(mqtt): Initial commit for mqtt * chore(xnode/mnd): xnode message handlers for mnode * chore(mnd/xnode): mnode part for xnode * chore(xnode/translater): fix show commands * fix(ast/creater): fix xnode create option * fix(xnode/ci): fix ci & doc's error codes * chore(xnode/sql): make create/drop/show work properly * fix(xnode/sql): commit new files * fix(xnode/sql): commit cmake files * fix: fix testing cases * fix(xnode/tsc): fix tokens * fix(ast/anode): fix anode update decl. * fix(xnode/error): fix xnode error codes * fix: xnode make/destroy * chore: xnode with option & dnode id * chore: use taosmqtt for xnode * chore: new error code for xnode launching * chore(xnode): new error code * chore: header for _xnode_mgmt_mqtt * chore: source for _xnode_mgmt_mqtt * chore: remove test directory from cmake * chore: remove taosmqtt for ci to compile * chore: remove taosudf header from xnode * chore: new window macro * chore: remove xnode mgmt mqtt for windows compilation * Revert "chore: remove xnode mgmt mqtt for windows compilation" This reverts commit 197e1640c79e40343e683f42236b3f0824392944. * chore: cleanup code * chore: xnode mgmt comment windows part out * chore: mgmt/mqtt, move uv head toppest * xnode/mnode: create xnode once per dnode * fix(xnode/systable/test): fix column count * xnode/sdb: renumber sdb type for xnode to make start/stop order correct * xnode/mqtt: new param mqttPort * fix SXnode's struct type * transfer dnode id to mqtt subscription * tmqtt: remove uv_a linking * tmqtt/tools: sources for tools * tools: fix windows compilation * tools/producer: fix windows sleep param * tools/producer: fix uninited var rc * make tools only for linux * test/mnodes: wail 1 or 2 seconds for offline to be leader * update topic producer tool for geometry data type testing * format tool sql statements * show xnodes' ep * make shell auto complete xnodes * use usleep instead of sleep * mqtt/proto: first version mqtt protocol * remove assert styles * build with linux only * fix libuv for taosmqtt building * fix log printing * mem: use ttq_ prefix instead of tmqtt * xnode/parser/proto: protocol option for xnode * xnode/translater/option: translate xnode option proto * xnode/translator: translate proto param * xnode/tmsg: encode/decode proto param * xnode/mnode: proto parma for mndXnode * xnode/proto: protocol param for xnode * xnode/mqtt: save/load proto from xnode json * rename tmqtt proto header * rename head directories * rename header name styles * restyle func names * update * update * use camel db * use camel for cxt * update count of information_schema * fix exceptional cases * fix w.r.t reviews * fixes w.r.t reviews * use ttq_free * append xnode msgs * update information schema count * support tmq meta data sub * success typo fix Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * fix error line var w.r.t. suggestions from copilot * denote mqtt node with bnode instead of xnode * smoke testing for mqtt * soak testing * new package for test framework: paho 2.1.0 * import mqtt into util * fix soak testing * test/soak: user 5 topics per client * test/soak: cover qos * update docker image references to tdengine-ci:0.1 in CI scripts and common.py * refactor: rename bnode msg to backup node * refactor: rename xnode to bnode 1 * refactor: rename xnode to bnode 2 * refactor: rename xnode to bnode 3 * refactor: rename xnode to bnode 4 * refactor: rename xnode to bnode 4 * refactor: rename xnode to bnode 5 * refactor: rename xnode to bnode 6 * refactor: rename some files 1 * refactor: rename some files 2 * refactor: rename some files 3 * refactor: rename some files 4 --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: chenhaoran <haoran920c@163.com> Co-authored-by: Simon Guan <guanshengliang@qq.com>
2025-06-25 06:58:51 +00:00
QUERY_NODE_SHOW_BNODES_STMT,
2025-07-12 07:39:29 +00:00
QUERY_NODE_SHOW_MOUNTS_STMT,
QUERY_NODE_SHOW_SSMIGRATES_STMT,
QUERY_NODE_SHOW_SCANS_STMT,
QUERY_NODE_SHOW_SCAN_DETAILS_STMT,
2025-09-26 09:32:32 +00:00
QUERY_NODE_SHOW_RSMAS_STMT,
QUERY_NODE_SHOW_RETENTIONS_STMT,
QUERY_NODE_SHOW_RETENTION_DETAILS_STMT,
2025-11-28 02:10:37 +00:00
QUERY_NODE_SHOW_INSTANCES_STMT,
2025-12-05 05:26:28 +00:00
QUERY_NODE_SHOW_ENCRYPT_ALGORITHMS_STMT,
feat(taosx): support distributed taosx (#34126) * feat: add xnode syntax * refactor(xnode): reduce function complexity * chore: add lost xnode.h file * feat(xnode): create xnode task * chore: fix double free error * add xnoded * start xnoded as subprocess * complete xnode task feature * complete show xnode jobs feature * complete with option feature * complete alter xnode job feature * complete alter xnode task feature * complete user pass feature * clean code * modify status type as char * fix leader ep null * fix start task req null * fix pass id for status * support timeout msg * drop xnode task relative jobs * clean code * wip * chore: add test cases for xnode * chore: fix 3.0 merge changes * fix drain core dump and create task core dump * add password check * retrieve xnode status from xnoded * pass integer as double to cjson * add some debug log * add some job log * fix start task lock * do not handle http response * fix coredump drop xnode task by name * support start/stop/drop task by name * remove mock xnoded * support unix socket * kill pre-xnoded before start * support dnode close xnoded * test(xnode): add unit test cases for xnode * rebalance support where clause * fix some test issue * unformat http post content json string * add xnode zh doc * modify drain description * remove job create/stop/drop operation * support rebalance all without where condition * support alter task by name * add NULL param for mndCheckOperPrivilege * add xnode txnode module for libmnode.a * code clean * change parser len to 4096 * clean code * chore: try to fix gtest/gtest.h not found * chore: fix markdown files * chore: fix markdown in zh * chore: fix enum issue and add ci * chore: fix test case problem * chore: fix pKeyVal overflow * chore: rename to 排空节点 * chore: external cmake remove parallel * chore: add DEP_ext_gtest for xnode test * chore: fix gtest errors * chore: remove gtest pthread lib * chore: fix data type not match * chore: fix some lint errors * chore: fix void unlink * chore: fix return with null pointer check * chore: fix pointer double free and xnodeMemoryTest strncpy null * chore: fix xnode encode action invalid datelen * chore: remove TD_LINUX condition * chore: use PRIu64 denote long long * chore: fix task parser NULL and allow no with clause * fix(xnode): fix windows build error * chore: fix windows curl error * chore: fix test case ins_tables relative error * chore: fix memory leak * docs: update taosx docs * chore: update taosx docs * chore: add role priviledge table * chore: fix error code doc * chore: fix test_xnode.py * chore: fix doc typo * fix: ci error while run test_user_privilege_sysinfo.py --------- Co-authored-by: Linhe Huo <linhehuo@gmail.com> Co-authored-by: huohong <sallyhuo@taosdata.com> Co-authored-by: Simon Guan <guanshengliang@qq.com>
2026-01-01 06:51:03 +00:00
// the order of QUERY_NODE_SHOW_* must be aligned with the order of `sysTableShowAdapter` defines.
QUERY_NODE_SHOW_TOKENS_STMT,
QUERY_NODE_SHOW_ENCRYPT_STATUS_STMT,
2025-12-29 11:27:11 +00:00
QUERY_NODE_SHOW_ROLES_STMT,
QUERY_NODE_SHOW_ROLE_PRIVILEGES_STMT,
QUERY_NODE_SHOW_ROLE_COL_PRIVILEGES_STMT,
feat(taosx): support distributed taosx (#34126) * feat: add xnode syntax * refactor(xnode): reduce function complexity * chore: add lost xnode.h file * feat(xnode): create xnode task * chore: fix double free error * add xnoded * start xnoded as subprocess * complete xnode task feature * complete show xnode jobs feature * complete with option feature * complete alter xnode job feature * complete alter xnode task feature * complete user pass feature * clean code * modify status type as char * fix leader ep null * fix start task req null * fix pass id for status * support timeout msg * drop xnode task relative jobs * clean code * wip * chore: add test cases for xnode * chore: fix 3.0 merge changes * fix drain core dump and create task core dump * add password check * retrieve xnode status from xnoded * pass integer as double to cjson * add some debug log * add some job log * fix start task lock * do not handle http response * fix coredump drop xnode task by name * support start/stop/drop task by name * remove mock xnoded * support unix socket * kill pre-xnoded before start * support dnode close xnoded * test(xnode): add unit test cases for xnode * rebalance support where clause * fix some test issue * unformat http post content json string * add xnode zh doc * modify drain description * remove job create/stop/drop operation * support rebalance all without where condition * support alter task by name * add NULL param for mndCheckOperPrivilege * add xnode txnode module for libmnode.a * code clean * change parser len to 4096 * clean code * chore: try to fix gtest/gtest.h not found * chore: fix markdown files * chore: fix markdown in zh * chore: fix enum issue and add ci * chore: fix test case problem * chore: fix pKeyVal overflow * chore: rename to 排空节点 * chore: external cmake remove parallel * chore: add DEP_ext_gtest for xnode test * chore: fix gtest errors * chore: remove gtest pthread lib * chore: fix data type not match * chore: fix some lint errors * chore: fix void unlink * chore: fix return with null pointer check * chore: fix pointer double free and xnodeMemoryTest strncpy null * chore: fix xnode encode action invalid datelen * chore: remove TD_LINUX condition * chore: use PRIu64 denote long long * chore: fix task parser NULL and allow no with clause * fix(xnode): fix windows build error * chore: fix windows curl error * chore: fix test case ins_tables relative error * chore: fix memory leak * docs: update taosx docs * chore: update taosx docs * chore: add role priviledge table * chore: fix error code doc * chore: fix test_xnode.py * chore: fix doc typo * fix: ci error while run test_user_privilege_sysinfo.py --------- Co-authored-by: Linhe Huo <linhehuo@gmail.com> Co-authored-by: huohong <sallyhuo@taosdata.com> Co-authored-by: Simon Guan <guanshengliang@qq.com>
2026-01-01 06:51:03 +00:00
QUERY_NODE_SHOW_XNODES_STMT,
QUERY_NODE_SHOW_XNODE_TASKS_STMT,
QUERY_NODE_SHOW_XNODE_AGENTS_STMT,
QUERY_NODE_SHOW_XNODE_JOBS_STMT,
QUERY_NODE_SHOW_VALIDATE_VTABLE_STMT,
QUERY_NODE_SHOW_SECURITY_POLICIES_STMT,
2025-12-05 05:26:28 +00:00
2023-09-01 05:24:47 +00:00
// logic plan node
QUERY_NODE_LOGIC_PLAN_SCAN = 1000,
QUERY_NODE_LOGIC_PLAN_JOIN,
QUERY_NODE_LOGIC_PLAN_AGG,
QUERY_NODE_LOGIC_PLAN_PROJECT,
QUERY_NODE_LOGIC_PLAN_VNODE_MODIFY,
QUERY_NODE_LOGIC_PLAN_EXCHANGE,
QUERY_NODE_LOGIC_PLAN_MERGE,
QUERY_NODE_LOGIC_PLAN_WINDOW,
QUERY_NODE_LOGIC_PLAN_FILL,
QUERY_NODE_LOGIC_PLAN_SORT,
QUERY_NODE_LOGIC_PLAN_PARTITION,
QUERY_NODE_LOGIC_PLAN_INDEF_ROWS_FUNC,
QUERY_NODE_LOGIC_PLAN_INTERP_FUNC,
QUERY_NODE_LOGIC_SUBPLAN,
QUERY_NODE_LOGIC_PLAN,
QUERY_NODE_LOGIC_PLAN_GROUP_CACHE,
QUERY_NODE_LOGIC_PLAN_DYN_QUERY_CTRL,
2024-10-09 09:09:43 +00:00
QUERY_NODE_LOGIC_PLAN_FORECAST_FUNC,
QUERY_NODE_LOGIC_PLAN_VIRTUAL_TABLE_SCAN,
QUERY_NODE_LOGIC_PLAN_ANALYSIS_FUNC,
2023-09-01 05:24:47 +00:00
// physical plan node
QUERY_NODE_PHYSICAL_PLAN_TAG_SCAN = 1100,
QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN,
QUERY_NODE_PHYSICAL_PLAN_TABLE_SEQ_SCAN, // INACTIVE
2023-09-01 05:24:47 +00:00
QUERY_NODE_PHYSICAL_PLAN_TABLE_MERGE_SCAN,
QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN,
QUERY_NODE_PHYSICAL_PLAN_SYSTABLE_SCAN,
QUERY_NODE_PHYSICAL_PLAN_BLOCK_DIST_SCAN,
QUERY_NODE_PHYSICAL_PLAN_LAST_ROW_SCAN,
QUERY_NODE_PHYSICAL_PLAN_PROJECT,
QUERY_NODE_PHYSICAL_PLAN_MERGE_JOIN,
QUERY_NODE_PHYSICAL_PLAN_HASH_AGG,
QUERY_NODE_PHYSICAL_PLAN_EXCHANGE,
QUERY_NODE_PHYSICAL_PLAN_MERGE,
QUERY_NODE_PHYSICAL_PLAN_SORT,
QUERY_NODE_PHYSICAL_PLAN_GROUP_SORT,
QUERY_NODE_PHYSICAL_PLAN_HASH_INTERVAL,
QUERY_NODE_PHYSICAL_PLAN_MERGE_INTERVAL, // INACTIVE
2023-09-01 05:24:47 +00:00
QUERY_NODE_PHYSICAL_PLAN_MERGE_ALIGNED_INTERVAL,
QUERY_NODE_PHYSICAL_PLAN_UNUSED_1,
QUERY_NODE_PHYSICAL_PLAN_UNUSED_2,
QUERY_NODE_PHYSICAL_PLAN_UNUSED_3,
2023-09-01 05:24:47 +00:00
QUERY_NODE_PHYSICAL_PLAN_FILL,
QUERY_NODE_PHYSICAL_PLAN_UNUSED_4,
2023-09-01 05:24:47 +00:00
QUERY_NODE_PHYSICAL_PLAN_MERGE_SESSION,
QUERY_NODE_PHYSICAL_PLAN_UNUSED_5,
QUERY_NODE_PHYSICAL_PLAN_UNUSED_6,
QUERY_NODE_PHYSICAL_PLAN_UNUSED_7,
2023-09-01 05:24:47 +00:00
QUERY_NODE_PHYSICAL_PLAN_MERGE_STATE,
QUERY_NODE_PHYSICAL_PLAN_UNUSED_8,
2023-09-01 05:24:47 +00:00
QUERY_NODE_PHYSICAL_PLAN_PARTITION,
QUERY_NODE_PHYSICAL_PLAN_UNUSED_9,
2023-09-01 05:24:47 +00:00
QUERY_NODE_PHYSICAL_PLAN_INDEF_ROWS_FUNC,
QUERY_NODE_PHYSICAL_PLAN_INTERP_FUNC,
QUERY_NODE_PHYSICAL_PLAN_DISPATCH,
QUERY_NODE_PHYSICAL_PLAN_INSERT,
QUERY_NODE_PHYSICAL_PLAN_QUERY_INSERT,
QUERY_NODE_PHYSICAL_PLAN_DELETE,
QUERY_NODE_PHYSICAL_SUBPLAN,
QUERY_NODE_PHYSICAL_PLAN,
QUERY_NODE_PHYSICAL_PLAN_TABLE_COUNT_SCAN,
QUERY_NODE_PHYSICAL_PLAN_MERGE_EVENT,
QUERY_NODE_PHYSICAL_PLAN_UNUSED_10,
2023-09-01 05:24:47 +00:00
QUERY_NODE_PHYSICAL_PLAN_HASH_JOIN,
QUERY_NODE_PHYSICAL_PLAN_GROUP_CACHE,
QUERY_NODE_PHYSICAL_PLAN_DYN_QUERY_CTRL,
2024-01-17 06:22:19 +00:00
QUERY_NODE_PHYSICAL_PLAN_MERGE_COUNT,
QUERY_NODE_PHYSICAL_PLAN_UNUSED_11,
QUERY_NODE_PHYSICAL_PLAN_UNUSED_12,
QUERY_NODE_PHYSICAL_PLAN_UNUSED_13,
2024-10-09 09:09:43 +00:00
QUERY_NODE_PHYSICAL_PLAN_MERGE_ANOMALY,
QUERY_NODE_PHYSICAL_PLAN_UNUSED_14,
2024-10-09 09:09:43 +00:00
QUERY_NODE_PHYSICAL_PLAN_FORECAST_FUNC,
QUERY_NODE_PHYSICAL_PLAN_UNUSED_15,
QUERY_NODE_PHYSICAL_PLAN_UNUSED_16,
QUERY_NODE_PHYSICAL_PLAN_UNUSED_17,
QUERY_NODE_PHYSICAL_PLAN_UNUSED_18,
QUERY_NODE_PHYSICAL_PLAN_UNUSED_19,
QUERY_NODE_PHYSICAL_PLAN_UNUSED_20,
QUERY_NODE_PHYSICAL_PLAN_UNUSED_21,
QUERY_NODE_PHYSICAL_PLAN_UNUSED_22,
QUERY_NODE_PHYSICAL_PLAN_UNUSED_23,
QUERY_NODE_PHYSICAL_PLAN_UNUSED_24,
QUERY_NODE_PHYSICAL_PLAN_VIRTUAL_TABLE_SCAN,
QUERY_NODE_PHYSICAL_PLAN_EXTERNAL_WINDOW,
QUERY_NODE_PHYSICAL_PLAN_HASH_EXTERNAL,
QUERY_NODE_PHYSICAL_PLAN_MERGE_ALIGNED_EXTERNAL,
2025-05-08 01:48:53 +00:00
QUERY_NODE_PHYSICAL_PLAN_STREAM_INSERT,
QUERY_NODE_PHYSICAL_PLAN_ANALYSIS_FUNC,
feat(taosx): support distributed taosx (#34126) * feat: add xnode syntax * refactor(xnode): reduce function complexity * chore: add lost xnode.h file * feat(xnode): create xnode task * chore: fix double free error * add xnoded * start xnoded as subprocess * complete xnode task feature * complete show xnode jobs feature * complete with option feature * complete alter xnode job feature * complete alter xnode task feature * complete user pass feature * clean code * modify status type as char * fix leader ep null * fix start task req null * fix pass id for status * support timeout msg * drop xnode task relative jobs * clean code * wip * chore: add test cases for xnode * chore: fix 3.0 merge changes * fix drain core dump and create task core dump * add password check * retrieve xnode status from xnoded * pass integer as double to cjson * add some debug log * add some job log * fix start task lock * do not handle http response * fix coredump drop xnode task by name * support start/stop/drop task by name * remove mock xnoded * support unix socket * kill pre-xnoded before start * support dnode close xnoded * test(xnode): add unit test cases for xnode * rebalance support where clause * fix some test issue * unformat http post content json string * add xnode zh doc * modify drain description * remove job create/stop/drop operation * support rebalance all without where condition * support alter task by name * add NULL param for mndCheckOperPrivilege * add xnode txnode module for libmnode.a * code clean * change parser len to 4096 * clean code * chore: try to fix gtest/gtest.h not found * chore: fix markdown files * chore: fix markdown in zh * chore: fix enum issue and add ci * chore: fix test case problem * chore: fix pKeyVal overflow * chore: rename to 排空节点 * chore: external cmake remove parallel * chore: add DEP_ext_gtest for xnode test * chore: fix gtest errors * chore: remove gtest pthread lib * chore: fix data type not match * chore: fix some lint errors * chore: fix void unlink * chore: fix return with null pointer check * chore: fix pointer double free and xnodeMemoryTest strncpy null * chore: fix xnode encode action invalid datelen * chore: remove TD_LINUX condition * chore: use PRIu64 denote long long * chore: fix task parser NULL and allow no with clause * fix(xnode): fix windows build error * chore: fix windows curl error * chore: fix test case ins_tables relative error * chore: fix memory leak * docs: update taosx docs * chore: update taosx docs * chore: add role priviledge table * chore: fix error code doc * chore: fix test_xnode.py * chore: fix doc typo * fix: ci error while run test_user_privilege_sysinfo.py --------- Co-authored-by: Linhe Huo <linhehuo@gmail.com> Co-authored-by: huohong <sallyhuo@taosdata.com> Co-authored-by: Simon Guan <guanshengliang@qq.com>
2026-01-01 06:51:03 +00:00
// xnode
QUERY_NODE_CREATE_XNODE_STMT = 1200, // Xnode
QUERY_NODE_DROP_XNODE_STMT,
QUERY_NODE_DRAIN_XNODE_STMT,
QUERY_NODE_XNODE_TASK_OPTIONS, // XNode task options
QUERY_NODE_XNODE_TASK_SOURCE_OPT, // XNode task source
QUERY_NODE_XNODE_TASK_SINK_OPT, // XNode task sink
QUERY_NODE_CREATE_XNODE_TASK_STMT, // XNode task
QUERY_NODE_START_XNODE_TASK_STMT, // XNode task
QUERY_NODE_STOP_XNODE_TASK_STMT, // XNode task
QUERY_NODE_UPDATE_XNODE_TASK_STMT, // XNode task
QUERY_NODE_DROP_XNODE_TASK_STMT, // XNode task
QUERY_NODE_CREATE_XNODE_JOB_STMT, // XNode job
QUERY_NODE_ALTER_XNODE_JOB_STMT, // XNode job
QUERY_NODE_REBALANCE_XNODE_JOB_STMT, // XNode job
QUERY_NODE_REBALANCE_XNODE_JOB_WHERE_STMT, // XNode job
QUERY_NODE_DROP_XNODE_JOB_STMT, // XNode job
feat(taosx): support distributed taosx (#34126) * feat: add xnode syntax * refactor(xnode): reduce function complexity * chore: add lost xnode.h file * feat(xnode): create xnode task * chore: fix double free error * add xnoded * start xnoded as subprocess * complete xnode task feature * complete show xnode jobs feature * complete with option feature * complete alter xnode job feature * complete alter xnode task feature * complete user pass feature * clean code * modify status type as char * fix leader ep null * fix start task req null * fix pass id for status * support timeout msg * drop xnode task relative jobs * clean code * wip * chore: add test cases for xnode * chore: fix 3.0 merge changes * fix drain core dump and create task core dump * add password check * retrieve xnode status from xnoded * pass integer as double to cjson * add some debug log * add some job log * fix start task lock * do not handle http response * fix coredump drop xnode task by name * support start/stop/drop task by name * remove mock xnoded * support unix socket * kill pre-xnoded before start * support dnode close xnoded * test(xnode): add unit test cases for xnode * rebalance support where clause * fix some test issue * unformat http post content json string * add xnode zh doc * modify drain description * remove job create/stop/drop operation * support rebalance all without where condition * support alter task by name * add NULL param for mndCheckOperPrivilege * add xnode txnode module for libmnode.a * code clean * change parser len to 4096 * clean code * chore: try to fix gtest/gtest.h not found * chore: fix markdown files * chore: fix markdown in zh * chore: fix enum issue and add ci * chore: fix test case problem * chore: fix pKeyVal overflow * chore: rename to 排空节点 * chore: external cmake remove parallel * chore: add DEP_ext_gtest for xnode test * chore: fix gtest errors * chore: remove gtest pthread lib * chore: fix data type not match * chore: fix some lint errors * chore: fix void unlink * chore: fix return with null pointer check * chore: fix pointer double free and xnodeMemoryTest strncpy null * chore: fix xnode encode action invalid datelen * chore: remove TD_LINUX condition * chore: use PRIu64 denote long long * chore: fix task parser NULL and allow no with clause * fix(xnode): fix windows build error * chore: fix windows curl error * chore: fix test case ins_tables relative error * chore: fix memory leak * docs: update taosx docs * chore: update taosx docs * chore: add role priviledge table * chore: fix error code doc * chore: fix test_xnode.py * chore: fix doc typo * fix: ci error while run test_user_privilege_sysinfo.py --------- Co-authored-by: Linhe Huo <linhehuo@gmail.com> Co-authored-by: huohong <sallyhuo@taosdata.com> Co-authored-by: Simon Guan <guanshengliang@qq.com>
2026-01-01 06:51:03 +00:00
QUERY_NODE_CREATE_XNODE_AGENT_STMT, // XNode agent
QUERY_NODE_DROP_XNODE_AGENT_STMT, // XNode agent
QUERY_NODE_ALTER_XNODE_AGENT_STMT, // XNode agent
QUERY_NODE_ALTER_XNODE_STMT, // Alter xnode
2023-09-01 05:24:47 +00:00
} ENodeType;
2022-01-10 12:44:11 +00:00
typedef struct {
2024-02-22 10:24:35 +00:00
int32_t vgId;
uint8_t option; // 0x0 REQ_OPT_TBNAME, 0x01 REQ_OPT_TBUID
uint8_t autoCreateCtb; // 0x0 not auto create, 0x01 auto create
2024-02-22 10:24:35 +00:00
const char* dbFName;
const char* tbName;
2022-06-20 05:32:21 +00:00
} SBuildTableInput;
2021-12-13 09:10:31 +00:00
2022-01-10 12:44:11 +00:00
typedef struct {
2022-01-24 06:31:57 +00:00
char db[TSDB_DB_FNAME_LEN];
2022-03-01 11:48:21 +00:00
int64_t dbId;
int32_t vgVersion;
2022-03-16 10:29:31 +00:00
int32_t numOfTable; // unit is TSDB_TABLE_NUM_UNIT
2022-11-09 10:48:52 +00:00
int64_t stateTs;
2021-12-15 01:52:37 +00:00
} SBuildUseDBInput;
2022-02-09 10:55:16 +00:00
typedef struct SField {
char name[TSDB_COL_NAME_LEN];
uint8_t type;
int8_t flags;
int32_t bytes;
2022-02-09 10:55:16 +00:00
} SField;
2024-03-07 10:06:15 +00:00
typedef struct SFieldWithOptions {
char name[TSDB_COL_NAME_LEN];
uint8_t type;
int8_t flags;
int32_t bytes;
uint32_t compress;
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
STypeMod typeMod;
2024-03-07 10:06:15 +00:00
} SFieldWithOptions;
2022-02-09 10:55:16 +00:00
2022-03-24 06:25:37 +00:00
typedef struct SRetention {
2022-05-01 04:18:54 +00:00
int64_t freq;
int64_t keep;
2022-03-24 06:54:10 +00:00
int8_t freqUnit;
int8_t keepUnit;
2022-03-24 06:25:37 +00:00
} SRetention;
#define RETENTION_VALID(l, r) ((((l) == 0 && (r)->freq >= 0) || ((r)->freq > 0)) && ((r)->keep > 0))
2022-05-08 09:04:19 +00:00
2021-10-08 05:53:49 +00:00
#pragma pack(push, 1)
// null-terminated string instead of char array to avoid too many memory consumption in case of more than 1M tableMeta
2022-01-26 06:00:15 +00:00
typedef struct SEp {
2021-12-17 12:58:45 +00:00
char fqdn[TSDB_FQDN_LEN];
2021-10-08 05:53:49 +00:00
uint16_t port;
2022-01-26 06:00:15 +00:00
} SEp;
2021-10-08 05:53:49 +00:00
2022-01-10 12:44:11 +00:00
typedef struct {
2021-10-08 05:53:49 +00:00
int32_t contLen;
2022-03-25 12:19:09 +00:00
int32_t vgId;
2021-10-08 05:53:49 +00:00
} SMsgHead;
// Submit message for one table
typedef struct SSubmitBlk {
2022-02-15 06:57:42 +00:00
int64_t uid; // table unique id
2022-03-25 13:03:12 +00:00
int64_t suid; // stable id
2022-02-15 06:57:42 +00:00
int32_t sversion; // data schema version
int32_t dataLen; // data part length, not including the SSubmitBlk head
int32_t schemaLen; // schema length, if length is 0, no schema exists
int32_t numOfRows; // total number of rows in current submit block
2022-02-15 06:57:42 +00:00
char data[];
2021-10-08 05:53:49 +00:00
} SSubmitBlk;
// Submit message for this TSDB
2022-01-10 12:44:11 +00:00
typedef struct {
2021-12-16 09:05:13 +00:00
SMsgHead header;
2022-01-05 08:25:14 +00:00
int64_t version;
2021-12-16 09:05:13 +00:00
int32_t length;
int32_t numOfBlocks;
char blocks[];
2022-02-16 07:27:19 +00:00
} SSubmitReq;
2021-10-08 05:53:49 +00:00
2022-01-05 07:26:49 +00:00
typedef struct {
int32_t totalLen;
int32_t len;
2022-02-15 06:57:42 +00:00
STSRow* row;
2022-01-05 07:26:49 +00:00
} SSubmitBlkIter;
typedef struct {
2022-04-24 13:00:05 +00:00
int32_t totalLen;
int32_t len;
// head of SSubmitBlk
2022-04-25 13:08:11 +00:00
int64_t uid; // table unique id
int64_t suid; // stable id
int32_t sversion; // data schema version
int32_t dataLen; // data part length, not including the SSubmitBlk head
int32_t schemaLen; // schema length, if length is 0, no schema exists
int32_t numOfRows; // total number of rows in current submit block
2022-04-24 13:00:05 +00:00
// head of SSubmitBlk
2022-06-02 13:01:24 +00:00
int32_t numOfBlocks;
2022-03-24 23:50:28 +00:00
const void* pMsg;
2022-01-05 07:26:49 +00:00
} SSubmitMsgIter;
2022-05-01 04:18:54 +00:00
2022-06-01 09:26:15 +00:00
int32_t tInitSubmitMsgIter(const SSubmitReq* pMsg, SSubmitMsgIter* pIter);
2022-02-16 03:45:44 +00:00
int32_t tGetSubmitMsgNext(SSubmitMsgIter* pIter, SSubmitBlk** pPBlock);
2022-05-01 02:50:23 +00:00
int32_t tInitSubmitBlkIter(SSubmitMsgIter* pMsgIter, SSubmitBlk* pBlock, SSubmitBlkIter* pIter);
2022-02-09 12:34:11 +00:00
STSRow* tGetSubmitBlkNext(SSubmitBlkIter* pIter);
2022-05-05 10:57:09 +00:00
// for debug
2022-05-23 08:38:05 +00:00
int32_t tPrintFixedSchemaSubmitReq(SSubmitReq* pReq, STSchema* pSchema);
2022-01-05 07:26:49 +00:00
typedef struct {
bool hasRef;
col_id_t id;
char refDbName[TSDB_DB_NAME_LEN];
char refTableName[TSDB_TABLE_NAME_LEN];
char refColName[TSDB_COL_NAME_LEN];
2026-03-09 02:49:14 +00:00
char colName[TSDB_COL_NAME_LEN]; // for tmq get json
} SColRef;
typedef struct {
int32_t nCols;
int32_t version;
SColRef* pColRef;
int32_t nTagRefs;
SColRef* pTagRef;
} SColRefWrapper;
2025-12-15 08:48:20 +00:00
int32_t tEncodeSColRefWrapper(SEncoder* pCoder, const SColRefWrapper* pWrapper);
int32_t tDecodeSColRefWrapperEx(SDecoder* pDecoder, SColRefWrapper* pWrapper, bool decoderMalloc);
typedef struct {
int32_t vgId;
SColRef colRef;
} SColRefEx;
typedef struct {
int16_t colId;
char refDbName[TSDB_DB_NAME_LEN];
char refTableName[TSDB_TABLE_NAME_LEN];
char refColName[TSDB_COL_NAME_LEN];
} SRefColInfo;
typedef struct SVCTableRefCols {
uint64_t uid;
int32_t numOfSrcTbls;
int32_t numOfColRefs;
SRefColInfo* refCols;
} SVCTableRefCols;
typedef struct SVCTableMergeInfo {
uint64_t uid;
int32_t numOfSrcTbls;
} SVCTableMergeInfo;
typedef struct {
int32_t nCols;
SColRefEx* pColRefEx;
} SColRefExWrapper;
struct SSchema {
int8_t type;
int8_t flags;
col_id_t colId;
int32_t bytes;
char name[TSDB_COL_NAME_LEN];
};
2024-03-12 08:46:41 +00:00
struct SSchemaExt {
col_id_t colId;
uint32_t compress;
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
STypeMod typeMod;
2024-03-12 08:46:41 +00:00
};
2025-09-26 09:32:32 +00:00
struct SSchemaRsma {
int64_t interval[2];
int32_t nFuncs;
int8_t tbType;
tb_uid_t tbUid;
func_id_t* funcIds;
char tbName[TSDB_TABLE_NAME_LEN];
};
2023-01-18 14:05:16 +00:00
struct SSchema2 {
int8_t type;
int8_t flags;
col_id_t colId;
int32_t bytes;
char name[TSDB_COL_NAME_LEN];
2024-02-28 07:58:24 +00:00
uint32_t compress;
2023-01-29 13:16:47 +00:00
};
2023-01-18 14:05:16 +00:00
typedef struct {
2024-03-12 08:46:41 +00:00
char tbName[TSDB_TABLE_NAME_LEN];
char stbName[TSDB_TABLE_NAME_LEN];
char dbFName[TSDB_DB_FNAME_LEN];
int64_t dbId;
int32_t numOfTags;
int32_t numOfColumns;
int8_t precision;
int8_t tableType;
int32_t sversion;
int32_t tversion;
int32_t rversion;
2024-03-12 08:46:41 +00:00
uint64_t suid;
uint64_t tuid;
int32_t vgId;
2026-01-28 11:06:16 +00:00
union {
uint8_t flag;
struct {
uint8_t sysInfo : 1;
uint8_t isAudit : 1;
uint8_t privCat : 3; // ESysTblPrivCat
uint8_t secLvl : 3;
2026-01-28 11:06:16 +00:00
};
};
2025-12-29 11:27:11 +00:00
int64_t ownerId;
2024-03-12 08:46:41 +00:00
SSchema* pSchemas;
SSchemaExt* pSchemaExt;
int8_t virtualStb;
int32_t numOfColRefs;
SColRef* pColRefs;
int32_t numOfTagRefs;
SColRef* pTagRefs;
int8_t secureDelete;
} STableMetaRsp;
2021-10-08 05:53:49 +00:00
typedef struct {
2022-08-30 02:57:24 +00:00
int32_t code;
int64_t uid;
char* tblFName;
int32_t numOfRows;
int32_t affectedRows;
int64_t sver;
STableMetaRsp* pMeta;
2022-05-10 05:57:31 +00:00
} SSubmitBlkRsp;
2021-10-08 05:53:49 +00:00
typedef struct {
2022-05-10 05:57:31 +00:00
int32_t numOfRows;
int32_t affectedRows;
int32_t nBlocks;
union {
SArray* pArray;
SSubmitBlkRsp* pBlocks;
};
2022-02-16 07:27:19 +00:00
} SSubmitRsp;
2021-10-08 05:53:49 +00:00
2024-02-29 10:27:34 +00:00
// int32_t tEncodeSSubmitRsp(SEncoder* pEncoder, const SSubmitRsp* pRsp);
// int32_t tDecodeSSubmitRsp(SDecoder* pDecoder, SSubmitRsp* pRsp);
2024-02-26 08:28:10 +00:00
// void tFreeSSubmitBlkRsp(void* param);
2024-04-08 02:33:02 +00:00
void tFreeSSubmitRsp(SSubmitRsp* pRsp);
#define COL_SMA_ON ((int8_t)0x1)
#define COL_IDX_ON ((int8_t)0x2)
#define COL_IS_KEY ((int8_t)0x4)
#define COL_SET_NULL ((int8_t)0x10)
#define COL_SET_VAL ((int8_t)0x20)
#define COL_IS_SYSINFO ((int8_t)0x40)
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
#define COL_HAS_TYPE_MOD ((int8_t)0x80)
2025-06-06 01:09:40 +00:00
#define COL_REF_BY_STM ((int8_t)0x08)
2021-10-08 05:53:49 +00:00
2022-05-31 09:49:33 +00:00
#define COL_IS_SET(FLG) (((FLG) & (COL_SET_VAL | COL_SET_NULL)) != 0)
2022-05-12 10:38:35 +00:00
#define COL_CLR_SET(FLG) ((FLG) &= (~(COL_SET_VAL | COL_SET_NULL)))
2022-05-12 05:28:08 +00:00
#define IS_BSMA_ON(s) (((s)->flags & 0x01) == COL_SMA_ON)
2023-02-14 09:31:10 +00:00
#define IS_IDX_ON(s) (((s)->flags & 0x02) == COL_IDX_ON)
#define IS_SET_NULL(s) (((s)->flags & COL_SET_NULL) == COL_SET_NULL)
2022-04-29 13:32:54 +00:00
2023-02-14 09:31:10 +00:00
#define SSCHMEA_SET_IDX_ON(s) \
do { \
(s)->flags |= COL_IDX_ON; \
} while (0)
#define SSCHMEA_SET_IDX_OFF(s) \
do { \
(s)->flags &= (~COL_IDX_ON); \
} while (0)
2022-04-29 13:32:54 +00:00
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
#define SSCHEMA_SET_TYPE_MOD(s) \
do { \
(s)->flags |= COL_HAS_TYPE_MOD; \
} while (0)
#define HAS_TYPE_MOD(s) (((s)->flags & COL_HAS_TYPE_MOD))
2022-04-07 09:41:16 +00:00
#define SSCHMEA_TYPE(s) ((s)->type)
2022-04-29 13:32:54 +00:00
#define SSCHMEA_FLAGS(s) ((s)->flags)
2022-04-01 09:43:50 +00:00
#define SSCHMEA_COLID(s) ((s)->colId)
#define SSCHMEA_BYTES(s) ((s)->bytes)
2022-04-07 09:41:16 +00:00
#define SSCHMEA_NAME(s) ((s)->name)
2022-04-01 09:43:50 +00:00
2024-06-19 10:54:26 +00:00
typedef struct {
bool tsEnableMonitor;
int32_t tsMonitorInterval;
int32_t tsSlowLogThreshold;
int32_t tsSlowLogMaxLen;
int32_t tsSlowLogScope;
int32_t tsSlowLogThresholdTest; // Obsolete
char tsSlowLogExceptDb[TSDB_DB_NAME_LEN];
2024-06-19 10:54:26 +00:00
} SMonitorParas;
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
typedef struct {
STypeMod typeMod;
} SExtSchema;
bool hasExtSchema(const SExtSchema* pExtSchema);
2022-04-22 12:34:37 +00:00
typedef struct {
2025-09-26 09:32:32 +00:00
int32_t nCols;
int32_t version;
SSchema* pSchema;
SSchemaRsma* pRsma;
2022-04-22 12:34:37 +00:00
} SSchemaWrapper;
2024-03-06 12:06:26 +00:00
typedef struct {
col_id_t id;
uint32_t alg;
} SColCmpr;
typedef struct {
int32_t nCols;
int32_t version;
SColCmpr* pColCmpr;
} SColCmprWrapper;
static FORCE_INLINE int32_t tInitDefaultSColRefWrapperByCols(SColRefWrapper* pRef, int32_t nCols) {
if (pRef->pColRef) {
return TSDB_CODE_INVALID_PARA;
}
pRef->pColRef = (SColRef*)taosMemoryCalloc(nCols, sizeof(SColRef));
if (pRef->pColRef == NULL) {
return terrno;
}
pRef->nCols = nCols;
for (int32_t i = 0; i < nCols; i++) {
pRef->pColRef[i].hasRef = false;
pRef->pColRef[i].id = (col_id_t)(i + 1);
}
return 0;
}
static FORCE_INLINE int32_t tInitDefaultSColRefWrapperByTags(SColRefWrapper* pRef, int32_t nTags, col_id_t startColId) {
if (pRef->pTagRef) {
return TSDB_CODE_INVALID_PARA;
}
pRef->pTagRef = (SColRef*)taosMemoryCalloc(nTags, sizeof(SColRef));
if (pRef->pTagRef == NULL) {
return terrno;
}
pRef->nTagRefs = nTags;
for (int32_t i = 0; i < nTags; i++) {
pRef->pTagRef[i].hasRef = false;
pRef->pTagRef[i].id = (col_id_t)(startColId + i);
}
return 0;
}
2024-03-06 12:06:26 +00:00
static FORCE_INLINE SColCmprWrapper* tCloneSColCmprWrapper(const SColCmprWrapper* pSrcWrapper) {
2024-07-22 09:32:30 +00:00
if (pSrcWrapper->pColCmpr == NULL || pSrcWrapper->nCols == 0) {
terrno = TSDB_CODE_INVALID_PARA;
return NULL;
}
2024-03-06 12:06:26 +00:00
2024-03-20 03:43:38 +00:00
SColCmprWrapper* pDstWrapper = (SColCmprWrapper*)taosMemoryMalloc(sizeof(SColCmprWrapper));
2024-07-22 09:32:30 +00:00
if (pDstWrapper == NULL) {
return NULL;
}
2024-03-06 12:06:26 +00:00
pDstWrapper->nCols = pSrcWrapper->nCols;
pDstWrapper->version = pSrcWrapper->version;
int32_t size = sizeof(SColCmpr) * pDstWrapper->nCols;
2024-03-20 08:51:40 +00:00
pDstWrapper->pColCmpr = (SColCmpr*)taosMemoryCalloc(1, size);
2024-07-22 09:32:30 +00:00
if (pDstWrapper->pColCmpr == NULL) {
taosMemoryFree(pDstWrapper);
return NULL;
}
2024-07-25 00:51:19 +00:00
(void)memcpy(pDstWrapper->pColCmpr, pSrcWrapper->pColCmpr, size);
2024-03-06 12:06:26 +00:00
return pDstWrapper;
}
2024-07-22 09:32:30 +00:00
static FORCE_INLINE int32_t tInitDefaultSColCmprWrapperByCols(SColCmprWrapper* pCmpr, int32_t nCols) {
2024-08-26 08:56:48 +00:00
if (!(!pCmpr->pColCmpr)) {
return TSDB_CODE_INVALID_PARA;
}
2024-03-20 08:51:40 +00:00
pCmpr->pColCmpr = (SColCmpr*)taosMemoryCalloc(nCols, sizeof(SColCmpr));
2024-07-22 09:32:30 +00:00
if (pCmpr->pColCmpr == NULL) {
2024-07-26 13:39:27 +00:00
return terrno;
2024-07-22 09:32:30 +00:00
}
2024-03-08 03:23:11 +00:00
pCmpr->nCols = nCols;
2024-07-22 09:32:30 +00:00
return 0;
2024-03-08 03:23:11 +00:00
}
2024-07-22 09:32:30 +00:00
static FORCE_INLINE int32_t tInitDefaultSColCmprWrapper(SColCmprWrapper* pCmpr, SSchemaWrapper* pSchema) {
2024-03-06 12:06:26 +00:00
pCmpr->nCols = pSchema->nCols;
2024-08-26 08:56:48 +00:00
if (!(!pCmpr->pColCmpr)) {
return TSDB_CODE_INVALID_PARA;
}
2024-03-20 08:51:40 +00:00
pCmpr->pColCmpr = (SColCmpr*)taosMemoryCalloc(pCmpr->nCols, sizeof(SColCmpr));
2024-07-22 09:32:30 +00:00
if (pCmpr->pColCmpr == NULL) {
2024-07-26 13:39:27 +00:00
return terrno;
2024-07-22 09:32:30 +00:00
}
2024-03-06 12:06:26 +00:00
for (int32_t i = 0; i < pCmpr->nCols; i++) {
SColCmpr* pColCmpr = &pCmpr->pColCmpr[i];
SSchema* pColSchema = &pSchema->pSchema[i];
pColCmpr->id = pColSchema->colId;
pColCmpr->alg = 0;
}
2024-07-22 09:32:30 +00:00
return 0;
2024-03-06 12:06:26 +00:00
}
2024-07-22 09:32:30 +00:00
2024-03-06 12:06:26 +00:00
static FORCE_INLINE void tDeleteSColCmprWrapper(SColCmprWrapper* pWrapper) {
if (pWrapper == NULL) return;
taosMemoryFreeClear(pWrapper->pColCmpr);
taosMemoryFreeClear(pWrapper);
}
2022-05-11 06:42:20 +00:00
static FORCE_INLINE SSchemaWrapper* tCloneSSchemaWrapper(const SSchemaWrapper* pSchemaWrapper) {
2022-10-19 07:36:56 +00:00
if (pSchemaWrapper->pSchema == NULL) return NULL;
2025-09-26 09:32:32 +00:00
SSchemaWrapper* pSW = (SSchemaWrapper*)taosMemoryCalloc(1, sizeof(SSchemaWrapper));
2024-07-22 09:32:30 +00:00
if (pSW == NULL) {
return NULL;
}
2022-05-11 06:42:20 +00:00
pSW->nCols = pSchemaWrapper->nCols;
2022-05-26 08:29:52 +00:00
pSW->version = pSchemaWrapper->version;
2022-05-11 06:42:20 +00:00
pSW->pSchema = (SSchema*)taosMemoryCalloc(pSW->nCols, sizeof(SSchema));
if (pSW->pSchema == NULL) {
taosMemoryFree(pSW);
return NULL;
}
2022-10-19 07:36:56 +00:00
2024-07-25 00:51:19 +00:00
(void)memcpy(pSW->pSchema, pSchemaWrapper->pSchema, pSW->nCols * sizeof(SSchema));
2022-05-11 06:42:20 +00:00
return pSW;
}
2023-05-04 08:15:14 +00:00
static FORCE_INLINE void tDeleteSchemaWrapper(SSchemaWrapper* pSchemaWrapper) {
if (pSchemaWrapper) {
taosMemoryFree(pSchemaWrapper->pSchema);
2025-12-15 08:48:20 +00:00
if (pSchemaWrapper->pRsma) {
2025-09-26 09:32:32 +00:00
taosMemoryFreeClear(pSchemaWrapper->pRsma->funcIds);
taosMemoryFreeClear(pSchemaWrapper->pRsma);
}
taosMemoryFree(pSchemaWrapper);
}
2022-05-11 06:42:20 +00:00
}
2025-09-26 09:32:32 +00:00
static FORCE_INLINE void tDestroySchemaWrapper(SSchemaWrapper* pSchemaWrapper) {
if (pSchemaWrapper) {
taosMemoryFreeClear(pSchemaWrapper->pSchema);
2025-12-15 08:48:20 +00:00
if (pSchemaWrapper->pRsma) {
2025-09-26 09:32:32 +00:00
taosMemoryFreeClear(pSchemaWrapper->pRsma->funcIds);
taosMemoryFreeClear(pSchemaWrapper->pRsma);
}
}
}
2023-01-10 12:32:31 +00:00
static FORCE_INLINE void tDeleteSSchemaWrapperForHash(void* pSchemaWrapper) {
2023-01-11 06:50:18 +00:00
if (pSchemaWrapper != NULL && *(SSchemaWrapper**)pSchemaWrapper != NULL) {
2025-09-26 09:32:32 +00:00
tDeleteSchemaWrapper(*(SSchemaWrapper**)pSchemaWrapper);
2023-01-10 12:32:31 +00:00
}
}
2022-05-11 06:42:20 +00:00
static FORCE_INLINE int32_t taosEncodeSSchema(void** buf, const SSchema* pSchema) {
int32_t tlen = 0;
tlen += taosEncodeFixedI8(buf, pSchema->type);
tlen += taosEncodeFixedI8(buf, pSchema->flags);
tlen += taosEncodeFixedI32(buf, pSchema->bytes);
tlen += taosEncodeFixedI16(buf, pSchema->colId);
tlen += taosEncodeString(buf, pSchema->name);
return tlen;
}
static FORCE_INLINE void* taosDecodeSSchema(const void* buf, SSchema* pSchema) {
buf = taosDecodeFixedI8(buf, &pSchema->type);
buf = taosDecodeFixedI8(buf, &pSchema->flags);
buf = taosDecodeFixedI32(buf, &pSchema->bytes);
buf = taosDecodeFixedI16(buf, &pSchema->colId);
buf = taosDecodeStringTo(buf, pSchema->name);
return (void*)buf;
}
static FORCE_INLINE int32_t tEncodeSSchema(SEncoder* pEncoder, const SSchema* pSchema) {
2024-07-22 09:32:30 +00:00
TAOS_CHECK_RETURN(tEncodeI8(pEncoder, pSchema->type));
TAOS_CHECK_RETURN(tEncodeI8(pEncoder, pSchema->flags));
TAOS_CHECK_RETURN(tEncodeI32v(pEncoder, pSchema->bytes));
TAOS_CHECK_RETURN(tEncodeI16v(pEncoder, pSchema->colId));
TAOS_CHECK_RETURN(tEncodeCStr(pEncoder, pSchema->name));
2022-05-11 06:42:20 +00:00
return 0;
}
static FORCE_INLINE int32_t tDecodeSSchema(SDecoder* pDecoder, SSchema* pSchema) {
2024-07-22 09:32:30 +00:00
TAOS_CHECK_RETURN(tDecodeI8(pDecoder, &pSchema->type));
TAOS_CHECK_RETURN(tDecodeI8(pDecoder, &pSchema->flags));
TAOS_CHECK_RETURN(tDecodeI32v(pDecoder, &pSchema->bytes));
TAOS_CHECK_RETURN(tDecodeI16v(pDecoder, &pSchema->colId));
TAOS_CHECK_RETURN(tDecodeCStrTo(pDecoder, pSchema->name));
2022-05-11 06:42:20 +00:00
return 0;
}
2024-03-12 08:46:41 +00:00
static FORCE_INLINE int32_t tEncodeSSchemaExt(SEncoder* pEncoder, const SSchemaExt* pSchemaExt) {
2024-07-22 09:32:30 +00:00
TAOS_CHECK_RETURN(tEncodeI16v(pEncoder, pSchemaExt->colId));
TAOS_CHECK_RETURN(tEncodeU32(pEncoder, pSchemaExt->compress));
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
TAOS_CHECK_RETURN(tEncodeI32(pEncoder, pSchemaExt->typeMod));
2024-03-12 08:46:41 +00:00
return 0;
}
static FORCE_INLINE int32_t tDecodeSSchemaExt(SDecoder* pDecoder, SSchemaExt* pSchemaExt) {
2024-07-22 09:32:30 +00:00
TAOS_CHECK_RETURN(tDecodeI16v(pDecoder, &pSchemaExt->colId));
TAOS_CHECK_RETURN(tDecodeU32(pDecoder, &pSchemaExt->compress));
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
TAOS_CHECK_RETURN(tDecodeI32(pDecoder, &pSchemaExt->typeMod));
2024-03-12 08:46:41 +00:00
return 0;
}
static FORCE_INLINE int32_t tEncodeSColRef(SEncoder* pEncoder, const SColRef* pColRef) {
TAOS_CHECK_RETURN(tEncodeI8(pEncoder, pColRef->hasRef));
TAOS_CHECK_RETURN(tEncodeI16(pEncoder, pColRef->id));
if (pColRef->hasRef) {
TAOS_CHECK_RETURN(tEncodeCStr(pEncoder, pColRef->refDbName));
TAOS_CHECK_RETURN(tEncodeCStr(pEncoder, pColRef->refTableName));
TAOS_CHECK_RETURN(tEncodeCStr(pEncoder, pColRef->refColName));
}
return 0;
}
static FORCE_INLINE int32_t tDecodeSColRef(SDecoder* pDecoder, SColRef* pColRef) {
TAOS_CHECK_RETURN(tDecodeI8(pDecoder, (int8_t*)&pColRef->hasRef));
TAOS_CHECK_RETURN(tDecodeI16(pDecoder, &pColRef->id));
if (pColRef->hasRef) {
TAOS_CHECK_RETURN(tDecodeCStrTo(pDecoder, pColRef->refDbName));
TAOS_CHECK_RETURN(tDecodeCStrTo(pDecoder, pColRef->refTableName));
TAOS_CHECK_RETURN(tDecodeCStrTo(pDecoder, pColRef->refColName));
}
return 0;
}
2022-05-11 06:42:20 +00:00
static FORCE_INLINE int32_t taosEncodeSSchemaWrapper(void** buf, const SSchemaWrapper* pSW) {
int32_t tlen = 0;
tlen += taosEncodeVariantI32(buf, pSW->nCols);
2022-05-26 08:29:52 +00:00
tlen += taosEncodeVariantI32(buf, pSW->version);
2022-05-11 06:42:20 +00:00
for (int32_t i = 0; i < pSW->nCols; i++) {
tlen += taosEncodeSSchema(buf, &pSW->pSchema[i]);
}
return tlen;
}
static FORCE_INLINE void* taosDecodeSSchemaWrapper(const void* buf, SSchemaWrapper* pSW) {
buf = taosDecodeVariantI32(buf, &pSW->nCols);
2022-05-26 08:29:52 +00:00
buf = taosDecodeVariantI32(buf, &pSW->version);
if (pSW->nCols > 0) {
pSW->pSchema = (SSchema*)taosMemoryCalloc(pSW->nCols, sizeof(SSchema));
if (pSW->pSchema == NULL) {
return NULL;
}
2022-05-11 06:42:20 +00:00
for (int32_t i = 0; i < pSW->nCols; i++) {
buf = taosDecodeSSchema(buf, &pSW->pSchema[i]);
}
} else {
pSW->pSchema = NULL;
2022-05-11 06:42:20 +00:00
}
return (void*)buf;
}
static FORCE_INLINE int32_t tEncodeSSchemaWrapper(SEncoder* pEncoder, const SSchemaWrapper* pSW) {
if (pSW == NULL) {
return TSDB_CODE_INVALID_PARA;
}
2024-07-22 09:32:30 +00:00
TAOS_CHECK_RETURN(tEncodeI32v(pEncoder, pSW->nCols));
TAOS_CHECK_RETURN(tEncodeI32v(pEncoder, pSW->version));
2022-05-11 06:42:20 +00:00
for (int32_t i = 0; i < pSW->nCols; i++) {
2024-07-22 09:32:30 +00:00
TAOS_CHECK_RETURN(tEncodeSSchema(pEncoder, &pSW->pSchema[i]));
2022-05-11 06:42:20 +00:00
}
return 0;
}
static FORCE_INLINE int32_t tDecodeSSchemaWrapper(SDecoder* pDecoder, SSchemaWrapper* pSW) {
if (pSW == NULL) {
return TSDB_CODE_INVALID_PARA;
}
2024-07-22 09:32:30 +00:00
TAOS_CHECK_RETURN(tDecodeI32v(pDecoder, &pSW->nCols));
TAOS_CHECK_RETURN(tDecodeI32v(pDecoder, &pSW->version));
2022-05-11 06:42:20 +00:00
pSW->pSchema = (SSchema*)taosMemoryCalloc(pSW->nCols, sizeof(SSchema));
2024-07-22 09:32:30 +00:00
if (pSW->pSchema == NULL) {
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
}
2022-05-11 06:42:20 +00:00
for (int32_t i = 0; i < pSW->nCols; i++) {
2024-07-22 09:32:30 +00:00
TAOS_CHECK_RETURN(tDecodeSSchema(pDecoder, &pSW->pSchema[i]));
2022-05-11 06:42:20 +00:00
}
return 0;
}
2022-05-17 15:33:59 +00:00
static FORCE_INLINE int32_t tDecodeSSchemaWrapperEx(SDecoder* pDecoder, SSchemaWrapper* pSW) {
2024-07-22 09:32:30 +00:00
TAOS_CHECK_RETURN(tDecodeI32v(pDecoder, &pSW->nCols));
TAOS_CHECK_RETURN(tDecodeI32v(pDecoder, &pSW->version));
2022-05-17 15:33:59 +00:00
2025-07-03 07:56:15 +00:00
pSW->pSchema = (SSchema*)tDecoderMalloc(pDecoder, pSW->nCols * sizeof(SSchema));
2024-07-22 09:32:30 +00:00
if (pSW->pSchema == NULL) {
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
}
2022-05-17 15:33:59 +00:00
for (int32_t i = 0; i < pSW->nCols; i++) {
2024-07-22 09:32:30 +00:00
TAOS_CHECK_RETURN(tDecodeSSchema(pDecoder, &pSW->pSchema[i]));
2022-05-17 15:33:59 +00:00
}
return 0;
}
2021-10-08 05:53:49 +00:00
typedef struct {
2022-07-10 02:43:01 +00:00
char name[TSDB_TABLE_FNAME_LEN];
int8_t igExists;
2024-02-22 02:58:32 +00:00
int8_t source; // TD_REQ_FROM_TAOX-taosX or TD_REQ_FROM_APP-taosClient
2022-07-10 02:43:01 +00:00
int8_t reserved[6];
tb_uid_t suid;
int64_t delay1;
int64_t delay2;
int64_t watermark1;
int64_t watermark2;
int32_t ttl;
int32_t colVer;
int32_t tagVer;
int32_t numOfColumns;
int32_t numOfTags;
int32_t numOfFuncs;
int32_t commentLen;
int32_t ast1Len;
int32_t ast2Len;
2024-03-07 10:06:15 +00:00
SArray* pColumns; // array of SFieldWithOptions
2022-07-10 02:43:01 +00:00
SArray* pTags; // array of SField
SArray* pFuncs;
char* pComment;
char* pAst1;
char* pAst2;
2022-12-06 08:07:11 +00:00
int64_t deleteMark1;
int64_t deleteMark2;
2023-09-06 03:00:24 +00:00
int32_t sqlLen;
char* sql;
int64_t keep;
int8_t virtualStb;
int8_t secureDelete;
int8_t securityLevel;
2022-01-10 12:44:11 +00:00
} SMCreateStbReq;
2021-10-08 05:53:49 +00:00
2022-02-15 10:17:18 +00:00
int32_t tSerializeSMCreateStbReq(void* buf, int32_t bufLen, SMCreateStbReq* pReq);
int32_t tDeserializeSMCreateStbReq(void* buf, int32_t bufLen, SMCreateStbReq* pReq);
2022-02-14 10:42:42 +00:00
void tFreeSMCreateStbReq(SMCreateStbReq* pReq);
2022-02-09 10:28:11 +00:00
typedef struct {
STableMetaRsp* pMeta;
} SMCreateStbRsp;
int32_t tEncodeSMCreateStbRsp(SEncoder* pEncoder, const SMCreateStbRsp* pRsp);
int32_t tDecodeSMCreateStbRsp(SDecoder* pDecoder, SMCreateStbRsp* pRsp);
void tFreeSMCreateStbRsp(SMCreateStbRsp* pRsp);
2021-10-08 05:53:49 +00:00
typedef struct {
2022-07-10 02:43:01 +00:00
char name[TSDB_TABLE_FNAME_LEN];
int8_t igNotExists;
2024-02-22 02:58:32 +00:00
int8_t source; // TD_REQ_FROM_TAOX-taosX or TD_REQ_FROM_APP-taosClient
2022-07-10 02:43:01 +00:00
int8_t reserved[6];
tb_uid_t suid;
2023-09-06 03:00:24 +00:00
int32_t sqlLen;
char* sql;
2022-01-10 12:44:11 +00:00
} SMDropStbReq;
2021-12-12 02:46:49 +00:00
2022-02-15 10:17:18 +00:00
int32_t tSerializeSMDropStbReq(void* buf, int32_t bufLen, SMDropStbReq* pReq);
int32_t tDeserializeSMDropStbReq(void* buf, int32_t bufLen, SMDropStbReq* pReq);
2023-12-01 07:15:12 +00:00
void tFreeSMDropStbReq(SMDropStbReq* pReq);
2022-02-09 11:41:14 +00:00
2021-12-12 02:46:49 +00:00
typedef struct {
char name[TSDB_TABLE_FNAME_LEN];
int8_t alterType;
2022-02-09 12:29:42 +00:00
int32_t numOfFields;
SArray* pFields;
2022-05-10 12:59:10 +00:00
int32_t ttl;
int32_t commentLen;
char* comment;
2023-09-06 03:00:24 +00:00
int32_t sqlLen;
char* sql;
int64_t keep;
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
SArray* pTypeMods;
int8_t secureDelete;
int8_t securityLevel;
2022-05-07 05:06:23 +00:00
} SMAlterStbReq;
2021-10-08 05:53:49 +00:00
2022-05-07 05:06:23 +00:00
int32_t tSerializeSMAlterStbReq(void* buf, int32_t bufLen, SMAlterStbReq* pReq);
int32_t tDeserializeSMAlterStbReq(void* buf, int32_t bufLen, SMAlterStbReq* pReq);
void tFreeSMAltertbReq(SMAlterStbReq* pReq);
2021-10-08 05:53:49 +00:00
typedef struct SEpSet {
2022-02-15 06:57:42 +00:00
int8_t inUse;
int8_t numOfEps;
SEp eps[TSDB_MAX_REPLICA];
2021-10-08 05:53:49 +00:00
} SEpSet;
2022-05-07 10:03:06 +00:00
int32_t tEncodeSEpSet(SEncoder* pEncoder, const SEpSet* pEp);
int32_t tDecodeSEpSet(SDecoder* pDecoder, SEpSet* pEp);
2022-02-16 03:45:44 +00:00
int32_t taosEncodeSEpSet(void** buf, const SEpSet* pEp);
void* taosDecodeSEpSet(const void* buf, SEpSet* pEp);
2021-12-29 09:53:43 +00:00
int32_t tSerializeSEpSet(void* buf, int32_t bufLen, const SEpSet* pEpset);
int32_t tDeserializeSEpSet(void* buf, int32_t buflen, SEpSet* pEpset);
2022-04-21 09:51:33 +00:00
2021-10-08 05:53:49 +00:00
typedef struct {
2022-04-14 06:42:51 +00:00
int8_t connType;
2021-10-08 05:53:49 +00:00
int32_t pid;
2025-12-29 14:08:38 +00:00
int32_t totpCode;
2021-12-03 06:36:41 +00:00
char app[TSDB_APP_NAME_LEN];
char db[TSDB_DB_NAME_LEN];
2022-04-21 06:29:22 +00:00
char user[TSDB_USER_LEN];
char passwd[TSDB_PASSWORD_LEN];
char token[TSDB_TOKEN_LEN];
int64_t startTime;
2025-12-29 14:08:38 +00:00
int64_t connectTime;
char sVer[TSDB_VERSION_LEN];
2025-12-29 14:08:38 +00:00
char signature[20]; // SHA1 produces a 20-byte signature
2022-01-06 08:13:49 +00:00
} SConnectReq;
2022-02-15 07:08:46 +00:00
2022-02-16 03:45:44 +00:00
int32_t tSerializeSConnectReq(void* buf, int32_t bufLen, SConnectReq* pReq);
int32_t tDeserializeSConnectReq(void* buf, int32_t bufLen, SConnectReq* pReq);
2025-12-29 14:08:38 +00:00
void tSignConnectReq(SConnectReq* pReq);
int32_t tVerifyConnectReqSignature(const SConnectReq* pReq);
2022-01-19 09:35:06 +00:00
typedef struct {
2024-07-05 07:06:11 +00:00
int64_t clusterId;
int32_t acctId;
2024-07-05 07:06:11 +00:00
uint32_t connId;
int32_t dnodeNum;
int8_t superUser;
int8_t sysInfo;
int8_t connType;
int8_t enableAuditDelete;
2024-07-05 07:06:11 +00:00
SEpSet epSet;
int32_t svrTimestamp;
int32_t passVer;
int32_t authVer;
char sVer[TSDB_VERSION_LEN];
char sDetailVer[128];
int64_t whiteListVer;
int64_t timeWhiteListVer;
2025-12-29 11:27:11 +00:00
int64_t userId;
2024-06-19 10:54:26 +00:00
SMonitorParas monitorParas;
char user[TSDB_USER_LEN];
char tokenName[TSDB_TOKEN_NAME_LEN];
2025-12-16 08:27:11 +00:00
int8_t enableAuditSelect;
int8_t enableAuditInsert;
int8_t auditLevel;
union {
uint32_t flags;
struct {
uint32_t minSecLevel : 3; // per-user
uint32_t maxSecLevel : 3; // per-user
uint32_t sodInitial : 1; // cluster-wide: 1 = SoD still in initial phase
uint32_t macActive : 1; // cluster-wide: 1 = MAC mandatory mode activated
uint32_t reserved : 24;
};
};
2022-01-19 09:35:06 +00:00
} SConnectRsp;
2021-12-29 09:53:43 +00:00
2022-02-16 03:45:44 +00:00
int32_t tSerializeSConnectRsp(void* buf, int32_t bufLen, SConnectRsp* pRsp);
int32_t tDeserializeSConnectRsp(void* buf, int32_t bufLen, SConnectRsp* pRsp);
2022-01-19 09:35:06 +00:00
typedef struct {
char user[TSDB_USER_LEN];
char pass[TSDB_PASSWORD_LEN];
int32_t maxUsers;
int32_t maxDbs;
int32_t maxTimeSeries;
int32_t maxStreams;
int32_t accessState; // Configured only by command
int64_t maxStorage;
2022-01-19 09:35:06 +00:00
} SCreateAcctReq, SAlterAcctReq;
2022-01-14 02:48:05 +00:00
2024-02-29 10:27:34 +00:00
// int32_t tSerializeSCreateAcctReq(void* buf, int32_t bufLen, SCreateAcctReq* pReq);
// int32_t tDeserializeSCreateAcctReq(void* buf, int32_t bufLen, SCreateAcctReq* pReq);
2022-02-11 05:13:32 +00:00
2022-01-19 09:35:06 +00:00
typedef struct {
2023-12-01 07:15:12 +00:00
char user[TSDB_USER_LEN];
2025-12-30 06:18:44 +00:00
int8_t ignoreNotExists;
2023-09-06 03:00:24 +00:00
int32_t sqlLen;
char* sql;
2022-01-19 09:35:06 +00:00
} SDropUserReq, SDropAcctReq;
2021-10-08 05:53:49 +00:00
2022-02-11 09:48:26 +00:00
int32_t tSerializeSDropUserReq(void* buf, int32_t bufLen, SDropUserReq* pReq);
int32_t tDeserializeSDropUserReq(void* buf, int32_t bufLen, SDropUserReq* pReq);
2023-12-01 07:15:12 +00:00
void tFreeSDropUserReq(SDropUserReq* pReq);
2022-02-11 05:13:32 +00:00
2025-12-29 11:27:11 +00:00
typedef struct {
char name[TSDB_ROLE_LEN];
union {
uint8_t flag;
struct {
uint8_t ignoreExists : 1;
uint8_t reserve : 7;
};
};
int32_t sqlLen;
char* sql;
} SCreateRoleReq;
int32_t tSerializeSCreateRoleReq(void* buf, int32_t bufLen, SCreateRoleReq* pReq);
int32_t tDeserializeSCreateRoleReq(void* buf, int32_t bufLen, SCreateRoleReq* pReq);
void tFreeSCreateRoleReq(SCreateRoleReq* pReq);
typedef struct {
char name[TSDB_ROLE_LEN];
union {
uint8_t flag;
struct {
uint8_t ignoreNotExists : 1;
uint8_t reserve : 7;
};
};
int32_t sqlLen;
char* sql;
} SDropRoleReq;
int32_t tSerializeSDropRoleReq(void* buf, int32_t bufLen, SDropRoleReq* pReq);
int32_t tDeserializeSDropRoleReq(void* buf, int32_t bufLen, SDropRoleReq* pReq);
void tFreeSDropRoleReq(SDropRoleReq* pReq);
typedef struct {
SPrivSet privSet;
SArray* selectCols; // SColIdNameKV, for table privileges
SArray* insertCols; // SColIdNameKV, for table privileges
SArray* updateCols; // SColIdNameKV, for table privileges
// delete can only specify conditions by cond and cannot specify columns
char* cond; // for table privileges
int32_t condLen; // for table privileges
} SPrivSetReqArgs;
typedef struct {
uint8_t alterType; // TSDB_ALTER_ROLE_LOCK, TSDB_ALTER_ROLE_ROLE, TSDB_ALTER_ROLE_PRIVILEGES
uint8_t objType; // none, db, table, view, rsma, topic, etc.
2025-12-29 11:27:11 +00:00
union {
uint32_t flag;
struct {
uint32_t lock : 1; // lock or unlock role
uint32_t add : 1; // add or remove
uint32_t sysPriv : 1; // system or object privileges
uint32_t objLevel : 2;
2026-01-28 11:06:16 +00:00
uint32_t ignoreNotExists : 1;
uint32_t reserve : 26;
2025-12-29 11:27:11 +00:00
};
};
union {
SPrivSetReqArgs privileges;
char roleName[TSDB_ROLE_LEN];
};
char principal[TSDB_ROLE_LEN]; // role or user name
2026-01-28 11:06:16 +00:00
char objFName[TSDB_OBJ_FNAME_LEN]; // db
char tblName[TSDB_TABLE_NAME_LEN]; // none, table, view, rsma, topic, etc.
2025-12-29 11:27:11 +00:00
int32_t sqlLen;
char* sql;
} SAlterRoleReq;
int32_t tSerializeSAlterRoleReq(void* buf, int32_t bufLen, SAlterRoleReq* pReq);
int32_t tDeserializeSAlterRoleReq(void* buf, int32_t bufLen, SAlterRoleReq* pReq);
void tFreeSAlterRoleReq(SAlterRoleReq* pReq);
2025-12-05 05:26:28 +00:00
typedef struct {
char algorithmId[TSDB_ENCRYPT_ALGR_NAME_LEN];
int32_t sqlLen;
char* sql;
} SDropEncryptAlgrReq;
int32_t tSerializeSDropEncryptAlgrReq(void* buf, int32_t bufLen, SDropEncryptAlgrReq* pReq);
int32_t tDeserializeSDropEncryptAlgrReq(void* buf, int32_t bufLen, SDropEncryptAlgrReq* pReq);
void tFreeSDropEncryptAlgrReq(SDropEncryptAlgrReq* pReq);
2023-12-01 07:15:12 +00:00
typedef struct SIpV4Range {
uint32_t ip;
uint32_t mask;
2023-08-29 09:35:03 +00:00
} SIpV4Range;
typedef struct SIpv6Range {
uint64_t addr[2];
uint32_t mask;
} SIpV6Range;
typedef struct {
int8_t type; // 0: IPv4, 1: IPv6
int8_t neg; // only used in SIpWhiteListDual, if neg is 1, means this is a blacklist entry
union {
SIpV4Range ipV4;
SIpV6Range ipV6;
};
} SIpRange;
2023-09-07 03:54:34 +00:00
typedef struct {
int32_t num;
SIpV4Range pIpRange[];
} SIpWhiteList;
2021-10-08 05:53:49 +00:00
typedef struct {
int32_t num;
SIpRange pIpRanges[];
} SIpWhiteListDual;
SIpWhiteListDual* cloneIpWhiteList(const SIpWhiteListDual* src);
int32_t cvtIpWhiteListToDual(SIpWhiteList* pWhiteList, SIpWhiteListDual** pWhiteListDual);
int32_t cvtIpWhiteListDualToV4(SIpWhiteListDual* pWhiteListDual, SIpWhiteList** pWhiteList);
int32_t createDefaultIp6Range(SIpRange* pRange);
int32_t createDefaultIp4Range(SIpRange* pRange);
2025-12-15 08:48:20 +00:00
typedef struct {
int32_t sessPerUser;
int32_t sessConnTime;
int32_t sessConnIdleTime;
int32_t sessMaxConcurrency;
int32_t sessMaxCallVnodeNum;
} SUserSessCfg;
void initUserDefautSessCfg(SUserSessCfg* pCfg);
// copyIpRange ensures that unused bytes are always zeroed, so that [pDst] can be used as a key in hash tables
void copyIpRange(SIpRange* pDst, const SIpRange* pSrc);
// SDateTimeRange is used in client side during SQL statement parsing, client sends this structure
// to server, and server will convert it to SDateTimeWhiteListItem for internal usage.
typedef struct {
int16_t year;
int8_t month; // 1-12, when month is -1, it means day is week day and year is not used.
int8_t day; // 1-31 or 0-6 (0 means Sunday), depends on the month value.
int8_t hour;
int8_t minute;
int8_t neg; // this is a negative entry
int32_t duration; // duration in minute
} SDateTimeRange;
bool isValidDateTimeRange(SDateTimeRange* pRange);
int32_t tEncodeSDateTimeRange(SEncoder* pEncoder, const SDateTimeRange* pRange);
int32_t tDecodeSDateTimeRange(SDecoder* pDecoder, SDateTimeRange* pRange);
feat(taosx): support distributed taosx (#34126) * feat: add xnode syntax * refactor(xnode): reduce function complexity * chore: add lost xnode.h file * feat(xnode): create xnode task * chore: fix double free error * add xnoded * start xnoded as subprocess * complete xnode task feature * complete show xnode jobs feature * complete with option feature * complete alter xnode job feature * complete alter xnode task feature * complete user pass feature * clean code * modify status type as char * fix leader ep null * fix start task req null * fix pass id for status * support timeout msg * drop xnode task relative jobs * clean code * wip * chore: add test cases for xnode * chore: fix 3.0 merge changes * fix drain core dump and create task core dump * add password check * retrieve xnode status from xnoded * pass integer as double to cjson * add some debug log * add some job log * fix start task lock * do not handle http response * fix coredump drop xnode task by name * support start/stop/drop task by name * remove mock xnoded * support unix socket * kill pre-xnoded before start * support dnode close xnoded * test(xnode): add unit test cases for xnode * rebalance support where clause * fix some test issue * unformat http post content json string * add xnode zh doc * modify drain description * remove job create/stop/drop operation * support rebalance all without where condition * support alter task by name * add NULL param for mndCheckOperPrivilege * add xnode txnode module for libmnode.a * code clean * change parser len to 4096 * clean code * chore: try to fix gtest/gtest.h not found * chore: fix markdown files * chore: fix markdown in zh * chore: fix enum issue and add ci * chore: fix test case problem * chore: fix pKeyVal overflow * chore: rename to 排空节点 * chore: external cmake remove parallel * chore: add DEP_ext_gtest for xnode test * chore: fix gtest errors * chore: remove gtest pthread lib * chore: fix data type not match * chore: fix some lint errors * chore: fix void unlink * chore: fix return with null pointer check * chore: fix pointer double free and xnodeMemoryTest strncpy null * chore: fix xnode encode action invalid datelen * chore: remove TD_LINUX condition * chore: use PRIu64 denote long long * chore: fix task parser NULL and allow no with clause * fix(xnode): fix windows build error * chore: fix windows curl error * chore: fix test case ins_tables relative error * chore: fix memory leak * docs: update taosx docs * chore: update taosx docs * chore: add role priviledge table * chore: fix error code doc * chore: fix test_xnode.py * chore: fix doc typo * fix: ci error while run test_user_privilege_sysinfo.py --------- Co-authored-by: Linhe Huo <linhehuo@gmail.com> Co-authored-by: huohong <sallyhuo@taosdata.com> Co-authored-by: Simon Guan <guanshengliang@qq.com>
2026-01-01 06:51:03 +00:00
// SDateTimeWhiteListItem is used by server internally to represent datetime ranges.
typedef struct {
bool absolute; // true: absolute datetime range; false: weekly recurring datetime range
bool neg; // this is a negative entry
int32_t duration; // duration in seconds
int64_t start; // absolute timestamp in seconds or weekly offset in seconds
} SDateTimeWhiteListItem;
void DateTimeRangeToWhiteListItem(SDateTimeWhiteListItem* dst, const SDateTimeRange* src);
bool isDateTimeWhiteListItemExpired(const SDateTimeWhiteListItem* item);
typedef struct {
int32_t num;
SDateTimeWhiteListItem ranges[];
} SDateTimeWhiteList;
SDateTimeWhiteList* cloneDateTimeWhiteList(const SDateTimeWhiteList* src);
bool isTimeInDateTimeWhiteList(const SDateTimeWhiteList *wl, int64_t tm);
typedef struct {
int8_t createType;
int8_t hasSessionPerUser;
int8_t hasConnectTime;
int8_t hasConnectIdleTime;
int8_t hasCallPerSession;
int8_t hasVnodePerCall;
int8_t hasFailedLoginAttempts;
int8_t hasPasswordLifeTime;
int8_t hasPasswordReuseTime;
int8_t hasPasswordReuseMax;
int8_t hasPasswordLockTime;
int8_t hasPasswordGraceTime;
int8_t hasInactiveAccountTime;
int8_t hasAllowTokenNum;
int8_t hasSecurityLevel;
int8_t superUser; // denote if it is a super user or not
int8_t ignoreExists;
char user[TSDB_USER_LEN];
char pass[TSDB_USER_PASSWORD_LONGLEN];
char totpseed[TSDB_USER_TOTPSEED_MAX_LEN + 1];
int8_t sysInfo;
int8_t createDb;
int8_t isImport;
int8_t changepass;
int8_t enable;
int8_t minSecLevel;
int8_t maxSecLevel;
int8_t negIpRanges;
int8_t negTimeRanges;
int32_t sessionPerUser;
int32_t connectTime;
int32_t connectIdleTime;
int32_t callPerSession;
int32_t vnodePerCall;
int32_t failedLoginAttempts;
int32_t passwordLifeTime;
int32_t passwordReuseTime;
int32_t passwordReuseMax;
int32_t passwordLockTime;
int32_t passwordGraceTime;
int32_t inactiveAccountTime;
int32_t allowTokenNum;
int32_t numIpRanges;
SIpRange* pIpDualRanges;
int32_t numTimeRanges;
SDateTimeRange* pTimeRanges;
int32_t sqlLen;
char* sql;
2022-02-11 05:13:32 +00:00
} SCreateUserReq;
2022-02-11 09:48:26 +00:00
int32_t tSerializeSCreateUserReq(void* buf, int32_t bufLen, SCreateUserReq* pReq);
int32_t tDeserializeSCreateUserReq(void* buf, int32_t bufLen, SCreateUserReq* pReq);
2023-12-01 07:15:12 +00:00
void tFreeSCreateUserReq(SCreateUserReq* pReq);
2022-02-11 05:13:32 +00:00
2025-12-05 05:26:28 +00:00
typedef struct {
char algorithmId[TSDB_ENCRYPT_ALGR_NAME_LEN];
char name[TSDB_ENCRYPT_ALGR_NAME_LEN];
char desc[TSDB_ENCRYPT_ALGR_DESC_LEN];
char type[TSDB_ENCRYPT_ALGR_TYPE_LEN];
char osslAlgrName[TSDB_ENCRYPT_ALGR_NAME_LEN];
int32_t sqlLen;
char* sql;
} SCreateEncryptAlgrReq;
int32_t tSerializeSCreateEncryptAlgrReq(void* buf, int32_t bufLen, SCreateEncryptAlgrReq* pReq);
int32_t tDeserializeSCreateEncryptAlgrReq(void* buf, int32_t bufLen, SCreateEncryptAlgrReq* pReq);
void tFreeSCreateEncryptAlgrReq(SCreateEncryptAlgrReq* pReq);
2024-10-09 09:09:43 +00:00
typedef struct {
int32_t dnodeId;
int64_t analVer;
} SRetrieveAnalyticsAlgoReq;
2024-10-09 09:09:43 +00:00
typedef struct {
int64_t ver;
SHashObj* hash; // algoname:algotype -> SAnalUrl
} SRetrieveAnalyticAlgoRsp;
2024-10-09 09:09:43 +00:00
int32_t tSerializeRetrieveAnalyticAlgoReq(void* buf, int32_t bufLen, SRetrieveAnalyticsAlgoReq* pReq);
int32_t tDeserializeRetrieveAnalyticAlgoReq(void* buf, int32_t bufLen, SRetrieveAnalyticsAlgoReq* pReq);
int32_t tSerializeRetrieveAnalyticAlgoRsp(void* buf, int32_t bufLen, SRetrieveAnalyticAlgoRsp* pRsp);
int32_t tDeserializeRetrieveAnalyticAlgoRsp(void* buf, int32_t bufLen, SRetrieveAnalyticAlgoRsp* pRsp);
void tFreeRetrieveAnalyticAlgoRsp(SRetrieveAnalyticAlgoRsp* pRsp);
2024-10-09 09:09:43 +00:00
2022-02-11 05:13:32 +00:00
typedef struct {
2024-05-22 11:00:47 +00:00
int8_t alterType;
2024-05-22 11:00:47 +00:00
int8_t isView;
feat(taosx): support distributed taosx (#34126) * feat: add xnode syntax * refactor(xnode): reduce function complexity * chore: add lost xnode.h file * feat(xnode): create xnode task * chore: fix double free error * add xnoded * start xnoded as subprocess * complete xnode task feature * complete show xnode jobs feature * complete with option feature * complete alter xnode job feature * complete alter xnode task feature * complete user pass feature * clean code * modify status type as char * fix leader ep null * fix start task req null * fix pass id for status * support timeout msg * drop xnode task relative jobs * clean code * wip * chore: add test cases for xnode * chore: fix 3.0 merge changes * fix drain core dump and create task core dump * add password check * retrieve xnode status from xnoded * pass integer as double to cjson * add some debug log * add some job log * fix start task lock * do not handle http response * fix coredump drop xnode task by name * support start/stop/drop task by name * remove mock xnoded * support unix socket * kill pre-xnoded before start * support dnode close xnoded * test(xnode): add unit test cases for xnode * rebalance support where clause * fix some test issue * unformat http post content json string * add xnode zh doc * modify drain description * remove job create/stop/drop operation * support rebalance all without where condition * support alter task by name * add NULL param for mndCheckOperPrivilege * add xnode txnode module for libmnode.a * code clean * change parser len to 4096 * clean code * chore: try to fix gtest/gtest.h not found * chore: fix markdown files * chore: fix markdown in zh * chore: fix enum issue and add ci * chore: fix test case problem * chore: fix pKeyVal overflow * chore: rename to 排空节点 * chore: external cmake remove parallel * chore: add DEP_ext_gtest for xnode test * chore: fix gtest errors * chore: remove gtest pthread lib * chore: fix data type not match * chore: fix some lint errors * chore: fix void unlink * chore: fix return with null pointer check * chore: fix pointer double free and xnodeMemoryTest strncpy null * chore: fix xnode encode action invalid datelen * chore: remove TD_LINUX condition * chore: use PRIu64 denote long long * chore: fix task parser NULL and allow no with clause * fix(xnode): fix windows build error * chore: fix windows curl error * chore: fix test case ins_tables relative error * chore: fix memory leak * docs: update taosx docs * chore: update taosx docs * chore: add role priviledge table * chore: fix error code doc * chore: fix test_xnode.py * chore: fix doc typo * fix: ci error while run test_user_privilege_sysinfo.py --------- Co-authored-by: Linhe Huo <linhehuo@gmail.com> Co-authored-by: huohong <sallyhuo@taosdata.com> Co-authored-by: Simon Guan <guanshengliang@qq.com>
2026-01-01 06:51:03 +00:00
int8_t hasPassword;
int8_t hasTotpseed;
int8_t hasEnable;
int8_t hasSysinfo;
int8_t hasCreatedb;
int8_t hasChangepass;
int8_t hasSessionPerUser;
int8_t hasConnectTime;
int8_t hasConnectIdleTime;
int8_t hasCallPerSession;
int8_t hasVnodePerCall;
int8_t hasFailedLoginAttempts;
int8_t hasPasswordLifeTime;
int8_t hasPasswordReuseTime;
int8_t hasPasswordReuseMax;
int8_t hasPasswordLockTime;
int8_t hasPasswordGraceTime;
int8_t hasInactiveAccountTime;
int8_t hasAllowTokenNum;
int8_t hasSecurityLevel;
int8_t enable;
int8_t sysinfo;
int8_t createdb;
int8_t changepass;
int8_t minSecLevel;
int8_t maxSecLevel;
char user[TSDB_USER_LEN];
char pass[TSDB_USER_PASSWORD_LONGLEN];
char totpseed[TSDB_USER_TOTPSEED_MAX_LEN + 1];
int32_t sessionPerUser;
int32_t connectTime;
int32_t connectIdleTime;
int32_t callPerSession;
int32_t vnodePerCall;
int32_t failedLoginAttempts;
int32_t passwordLifeTime;
int32_t passwordReuseTime;
int32_t passwordReuseMax;
int32_t passwordLockTime;
int32_t passwordGraceTime;
int32_t inactiveAccountTime;
int32_t allowTokenNum;
int32_t numIpRanges;
int32_t numTimeRanges;
int32_t numDropIpRanges;
int32_t numDropTimeRanges;
SIpRange* pIpRanges;
SDateTimeRange* pTimeRanges;
SIpRange* pDropIpRanges;
SDateTimeRange* pDropTimeRanges;
2025-12-29 11:27:11 +00:00
SPrivSet privileges;
2025-12-29 11:27:11 +00:00
char objname[TSDB_OBJ_FNAME_LEN]; // db or topic
2023-12-01 07:15:12 +00:00
char tabName[TSDB_TABLE_NAME_LEN];
char* tagCond;
int32_t tagCondLen;
int32_t sqlLen;
char* sql;
2022-02-11 05:13:32 +00:00
} SAlterUserReq;
2022-02-11 09:48:26 +00:00
int32_t tSerializeSAlterUserReq(void* buf, int32_t bufLen, SAlterUserReq* pReq);
int32_t tDeserializeSAlterUserReq(void* buf, int32_t bufLen, SAlterUserReq* pReq);
2023-04-23 08:30:28 +00:00
void tFreeSAlterUserReq(SAlterUserReq* pReq);
2021-10-08 05:53:49 +00:00
typedef struct {
char name[TSDB_TOKEN_NAME_LEN];
char user[TSDB_USER_LEN];
int8_t enable;
int8_t ignoreExists;
int32_t ttl;
char provider[TSDB_TOKEN_PROVIDER_LEN];
char extraInfo[TSDB_TOKEN_EXTRA_INFO_LEN];
int32_t sqlLen;
char* sql;
} SCreateTokenReq;
int32_t tSerializeSCreateTokenReq(void* buf, int32_t bufLen, SCreateTokenReq* pReq);
int32_t tDeserializeSCreateTokenReq(void* buf, int32_t bufLen, SCreateTokenReq* pReq);
void tFreeSCreateTokenReq(SCreateTokenReq* pReq);
typedef struct {
char name[TSDB_TOKEN_NAME_LEN];
char user[TSDB_USER_LEN];
char token[TSDB_TOKEN_LEN];
} SCreateTokenRsp;
int32_t tSerializeSCreateTokenResp(void* buf, int32_t bufLen, SCreateTokenRsp* pRsp);
int32_t tDeserializeSCreateTokenResp(void* buf, int32_t bufLen, SCreateTokenRsp* pRsp);
void tFreeSCreateTokenResp(SCreateTokenRsp* pRsp);
typedef struct {
char name[TSDB_TOKEN_NAME_LEN];
int8_t hasEnable;
int8_t hasTtl;
int8_t hasProvider;
int8_t hasExtraInfo;
int8_t enable;
int32_t ttl;
char provider[TSDB_TOKEN_PROVIDER_LEN];
char extraInfo[TSDB_TOKEN_EXTRA_INFO_LEN];
int32_t sqlLen;
char* sql;
} SAlterTokenReq;
int32_t tSerializeSAlterTokenReq(void* buf, int32_t bufLen, SAlterTokenReq* pReq);
int32_t tDeserializeSAlterTokenReq(void* buf, int32_t bufLen, SAlterTokenReq* pReq);
void tFreeSAlterTokenReq(SAlterTokenReq* pReq);
typedef struct {
char name[TSDB_TOKEN_NAME_LEN];
2025-12-30 06:18:44 +00:00
int8_t ignoreNotExists;
int32_t sqlLen;
char* sql;
} SDropTokenReq;
int32_t tSerializeSDropTokenReq(void* buf, int32_t bufLen, SDropTokenReq* pReq);
int32_t tDeserializeSDropTokenReq(void* buf, int32_t bufLen, SDropTokenReq* pReq);
void tFreeSDropTokenReq(SDropTokenReq* pReq);
typedef struct {
char user[TSDB_USER_LEN];
int32_t sqlLen;
char* sql;
} SCreateTotpSecretReq;
int32_t tSerializeSCreateTotpSecretReq(void* buf, int32_t bufLen, SCreateTotpSecretReq* pReq);
int32_t tDeserializeSCreateTotpSecretReq(void* buf, int32_t bufLen, SCreateTotpSecretReq* pReq);
void tFreeSCreateTotpSecretReq(SCreateTotpSecretReq* pReq);
typedef struct {
char user[TSDB_USER_LEN];
char totpSecret[(TSDB_TOTP_SECRET_LEN * 8 + 4) / 5 + 1]; // base32 encoded totp secret + null terminator
} SCreateTotpSecretRsp;
int32_t tSerializeSCreateTotpSecretRsp(void* buf, int32_t bufLen, SCreateTotpSecretRsp* pRsp);
int32_t tDeserializeSCreateTotpSecretRsp(void* buf, int32_t bufLen, SCreateTotpSecretRsp* pRsp);
typedef SCreateTotpSecretReq SDropTotpSecretReq;
#define tSerializeSDropTotpSecretReq tSerializeSCreateTotpSecretReq
#define tDeserializeSDropTotpSecretReq tDeserializeSCreateTotpSecretReq
#define tFreeSDropTotpSecretReq tFreeSCreateTotpSecretReq
2022-02-11 07:20:27 +00:00
typedef struct {
char user[TSDB_USER_LEN];
} SGetUserAuthReq;
2022-02-11 09:48:26 +00:00
int32_t tSerializeSGetUserAuthReq(void* buf, int32_t bufLen, SGetUserAuthReq* pReq);
int32_t tDeserializeSGetUserAuthReq(void* buf, int32_t bufLen, SGetUserAuthReq* pReq);
2022-02-11 07:20:27 +00:00
typedef struct {
int8_t enabled;
int32_t expireTime;
} STokenStatus;
2022-02-11 07:20:27 +00:00
typedef struct {
2026-01-28 11:06:16 +00:00
char user[TSDB_USER_LEN];
int64_t userId;
int32_t version;
int32_t passVer;
int8_t superAuth;
int8_t sysInfo;
int8_t enable;
int8_t dropped;
union {
uint8_t flags;
struct {
uint8_t minSecLevel : 3;
2026-01-28 11:06:16 +00:00
uint8_t withInsertCond : 1;
uint8_t maxSecLevel : 3;
uint8_t reserved : 1;
2026-01-28 11:06:16 +00:00
};
};
2025-12-29 11:27:11 +00:00
SPrivSet sysPrivs;
SHashObj* objPrivs;
SHashObj* selectTbs;
SHashObj* insertTbs;
SHashObj* deleteTbs;
2026-01-28 11:06:16 +00:00
SHashObj* ownedDbs;
2023-12-01 07:15:12 +00:00
int64_t whiteListVer;
2025-12-15 08:48:20 +00:00
SUserSessCfg sessCfg;
int64_t timeWhiteListVer;
SHashObj* tokens;
2022-02-11 07:20:27 +00:00
} SGetUserAuthRsp;
2022-02-12 08:28:50 +00:00
int32_t tSerializeSGetUserAuthRsp(void* buf, int32_t bufLen, SGetUserAuthRsp* pRsp);
int32_t tDeserializeSGetUserAuthRsp(void* buf, int32_t bufLen, SGetUserAuthRsp* pRsp);
2022-04-27 07:08:51 +00:00
void tFreeSGetUserAuthRsp(SGetUserAuthRsp* pRsp);
2022-02-11 07:20:27 +00:00
2025-12-29 11:27:11 +00:00
int32_t tSerializePrivSysObjPolicies(SEncoder* pEncoder, SPrivSet* sysPriv, SHashObj* pHash);
int32_t tDeserializePrivSysObjPolicies(SDecoder* pDecoder, SPrivSet* sysPriv, SHashObj** pHash);
int32_t tSerializePrivTblPolicies(SEncoder* pEncoder, SHashObj* pHash);
int32_t tDeserializePrivTblPolicies(SDecoder* pDecoder, SHashObj** pHash);
int32_t tSerializeIpRange(SEncoder* encoder, SIpRange* pRange);
int32_t tDeserializeIpRange(SDecoder* decoder, SIpRange* pRange, bool supportNeg);
typedef struct {
int64_t ver;
char user[TSDB_USER_LEN];
int32_t numOfRange;
union {
SIpV4Range* pIpRanges;
SIpRange* pIpDualRanges;
};
} SUpdateUserIpWhite;
typedef struct {
int64_t ver;
int numOfUser;
SUpdateUserIpWhite* pUserIpWhite;
} SUpdateIpWhite;
int32_t tSerializeSUpdateIpWhite(void* buf, int32_t bufLen, SUpdateIpWhite* pReq);
int32_t tDeserializeSUpdateIpWhite(void* buf, int32_t bufLen, SUpdateIpWhite* pReq);
void tFreeSUpdateIpWhiteReq(SUpdateIpWhite* pReq);
int32_t cloneSUpdateIpWhiteReq(SUpdateIpWhite* pReq, SUpdateIpWhite** pUpdate);
int32_t tSerializeSUpdateIpWhiteDual(void* buf, int32_t bufLen, SUpdateIpWhite* pReq);
int32_t tDeserializeSUpdateIpWhiteDual(void* buf, int32_t bufLen, SUpdateIpWhite* pReq);
void tFreeSUpdateIpWhiteDualReq(SUpdateIpWhite* pReq);
// SRetrieveWhiteListReq is used to retrieve both ip and datetime whitelist, but the
// corresponding response struct is different.
typedef struct {
int64_t ver;
} SRetrieveWhiteListReq;
int32_t tSerializeRetrieveWhiteListReq(void* buf, int32_t bufLen, SRetrieveWhiteListReq* pReq);
int32_t tDeserializeRetrieveWhiteListReq(void* buf, int32_t bufLen, SRetrieveWhiteListReq* pReq);
// SGetUserWhiteListReq is used to get both ip and datetime whitelist, but the
// corresponding response struct is different.
typedef struct {
char user[TSDB_USER_LEN];
} SGetUserWhiteListReq;
int32_t tSerializeSGetUserWhiteListReq(void* buf, int32_t bufLen, SGetUserWhiteListReq* pReq);
int32_t tDeserializeSGetUserWhiteListReq(void* buf, int32_t bufLen, SGetUserWhiteListReq* pReq);
typedef struct {
char user[TSDB_USER_LEN];
int32_t numWhiteLists;
union {
SIpV4Range* pWhiteLists;
SIpRange* pWhiteListsDual;
};
} SGetUserIpWhiteListRsp;
int32_t tIpStrToUint(const SIpAddr* addr, SIpRange* range);
int32_t tIpUintToStr(const SIpRange* range, SIpAddr* addr);
int32_t tIpRangeSetMask(SIpRange* range, int32_t mask);
void tIpRangeSetDefaultMask(SIpRange* range);
int32_t tSerializeSGetUserIpWhiteListRsp(void* buf, int32_t bufLen, SGetUserIpWhiteListRsp* pRsp);
int32_t tDeserializeSGetUserIpWhiteListRsp(void* buf, int32_t bufLen, SGetUserIpWhiteListRsp* pRsp);
void tFreeSGetUserIpWhiteListRsp(SGetUserIpWhiteListRsp* pRsp);
int32_t tSerializeSGetUserIpWhiteListDualRsp(void* buf, int32_t bufLen, SGetUserIpWhiteListRsp* pRsp);
int32_t tDeserializeSGetUserIpWhiteListDualRsp(void* buf, int32_t bufLen, SGetUserIpWhiteListRsp* pRsp);
void tFreeSGetUserIpWhiteListDualRsp(SGetUserIpWhiteListRsp* pRsp);
typedef struct {
int64_t ver;
char user[TSDB_USER_LEN];
int32_t numWhiteLists;
SDateTimeWhiteListItem* pWhiteLists;
} SUserDateTimeWhiteList;
int32_t tSerializeSUserDateTimeWhiteList(void* buf, int32_t bufLen, SUserDateTimeWhiteList* pRsp);
int32_t tDeserializeSUserDateTimeWhiteList(void* buf, int32_t bufLen, SUserDateTimeWhiteList* pRsp);
void tFreeSUserDateTimeWhiteList(SUserDateTimeWhiteList* pRsp);
2025-12-15 08:48:20 +00:00
int32_t cloneSUserDateTimeWhiteList(const SUserDateTimeWhiteList* src, SUserDateTimeWhiteList* dest);
typedef struct {
int64_t ver;
int numOfUser;
SUserDateTimeWhiteList *pUsers;
} SRetrieveDateTimeWhiteListRsp;
int32_t tSerializeSRetrieveDateTimeWhiteListRsp(void* buf, int32_t bufLen, SRetrieveDateTimeWhiteListRsp* pRsp);
int32_t tDeserializeSRetrieveDateTimeWhiteListRsp(void* buf, int32_t bufLen, SRetrieveDateTimeWhiteListRsp* pRsp);
void tFreeSRetrieveDateTimeWhiteListRsp(SRetrieveDateTimeWhiteListRsp* pRsp);
2025-12-15 08:48:20 +00:00
int32_t cloneDataTimeWhiteListRsp(const SRetrieveDateTimeWhiteListRsp* src, SRetrieveDateTimeWhiteListRsp** dest);
2021-10-08 05:53:49 +00:00
/*
2022-03-17 09:48:21 +00:00
* for client side struct, only column id, type, bytes are necessary
2021-10-08 05:53:49 +00:00
* But for data in vnode side, we need all the following information.
*/
2022-01-10 12:44:11 +00:00
typedef struct {
2022-03-04 11:21:30 +00:00
union {
col_id_t colId;
int16_t slotId;
2022-03-04 11:21:30 +00:00
};
2022-03-16 10:29:31 +00:00
uint8_t precision;
uint8_t scale;
2022-11-10 07:37:18 +00:00
int32_t bytes;
int8_t type;
2024-03-21 01:37:46 +00:00
uint8_t pk;
bool noData;
2021-10-08 05:53:49 +00:00
} SColumnInfo;
typedef struct STimeWindow {
TSKEY skey;
TSKEY ekey;
} STimeWindow;
2023-09-01 05:24:47 +00:00
typedef struct SQueryHint {
bool batchScan;
} SQueryHint;
2021-10-08 05:53:49 +00:00
typedef struct {
2021-12-16 09:05:13 +00:00
int32_t tsOffset; // offset value in current msg body, NOTE: ts list is compressed
int32_t tsLen; // total length of ts comp block
int32_t tsNumOfBlocks; // ts comp block numbers
int32_t tsOrder; // ts comp block order
2021-10-08 05:53:49 +00:00
} STsBufInfo;
2022-01-10 12:44:11 +00:00
typedef struct {
2024-12-09 08:15:48 +00:00
void* timezone;
char intervalUnit;
char slidingUnit;
char offsetUnit;
int8_t precision;
int64_t interval;
int64_t sliding;
int64_t offset;
STimeWindow timeRange;
2021-10-08 05:53:49 +00:00
} SInterval;
2023-09-01 05:24:47 +00:00
typedef struct STbVerInfo {
2022-05-27 08:01:40 +00:00
char tbFName[TSDB_TABLE_FNAME_LEN];
int32_t sversion;
int32_t tversion;
int32_t rversion; // virtual table's column ref's version
2023-09-01 05:24:47 +00:00
} STbVerInfo;
typedef struct {
int32_t code;
2022-07-06 13:00:31 +00:00
int64_t affectedRows;
2023-09-01 05:24:47 +00:00
SArray* tbVerInfo; // STbVerInfo
2021-10-08 05:53:49 +00:00
} SQueryTableRsp;
2022-03-23 02:44:32 +00:00
int32_t tSerializeSQueryTableRsp(void* buf, int32_t bufLen, SQueryTableRsp* pRsp);
2022-03-10 11:05:58 +00:00
2022-03-23 02:44:32 +00:00
int32_t tDeserializeSQueryTableRsp(void* buf, int32_t bufLen, SQueryTableRsp* pRsp);
2022-03-10 11:05:58 +00:00
2022-06-20 05:32:21 +00:00
typedef struct {
SMsgHead header;
char dbFName[TSDB_DB_FNAME_LEN];
char tbName[TSDB_TABLE_NAME_LEN];
} STableCfgReq;
2022-06-18 11:50:53 +00:00
typedef struct {
2024-03-13 03:39:07 +00:00
char tbName[TSDB_TABLE_NAME_LEN];
char stbName[TSDB_TABLE_NAME_LEN];
char dbFName[TSDB_DB_FNAME_LEN];
int32_t numOfTags;
int32_t numOfColumns;
int8_t tableType;
int64_t delay1;
int64_t delay2;
int64_t watermark1;
int64_t watermark2;
int32_t ttl;
int32_t keep;
2025-12-29 11:27:11 +00:00
int64_t ownerId;
2024-03-13 03:39:07 +00:00
SArray* pFuncs;
int32_t commentLen;
char* pComment;
SSchema* pSchemas;
int32_t tagsLen;
char* pTags;
SSchemaExt* pSchemaExt;
2026-01-28 11:06:16 +00:00
union {
uint8_t flag;
struct {
uint8_t virtualStb : 1; // no compatibility problem for little-endian arch
uint8_t isAudit : 1;
uint8_t securityLevel : 3;
uint8_t reserve : 3;
2026-01-28 11:06:16 +00:00
};
};
SColRef* pColRefs;
int32_t numOfTagRefs;
SColRef* pTagRefs;
int8_t secureDelete;
2022-06-18 11:50:53 +00:00
} STableCfg;
2022-06-20 05:32:21 +00:00
typedef STableCfg STableCfgRsp;
2022-06-23 05:35:24 +00:00
int32_t tSerializeSTableCfgReq(void* buf, int32_t bufLen, STableCfgReq* pReq);
int32_t tDeserializeSTableCfgReq(void* buf, int32_t bufLen, STableCfgReq* pReq);
2022-06-20 05:32:21 +00:00
2022-06-23 05:35:24 +00:00
int32_t tSerializeSTableCfgRsp(void* buf, int32_t bufLen, STableCfgRsp* pRsp);
int32_t tDeserializeSTableCfgRsp(void* buf, int32_t bufLen, STableCfgRsp* pRsp);
void tFreeSTableCfgRsp(STableCfgRsp* pRsp);
2022-06-20 05:32:21 +00:00
typedef struct {
SMsgHead header;
tb_uid_t suid;
} SVSubTablesReq;
int32_t tSerializeSVSubTablesReq(void* buf, int32_t bufLen, SVSubTablesReq* pReq);
int32_t tDeserializeSVSubTablesReq(void* buf, int32_t bufLen, SVSubTablesReq* pReq);
typedef struct {
int32_t vgId;
SArray* pTables; // SArray<SVCTableRefCols*>
} SVSubTablesRsp;
int32_t tSerializeSVSubTablesRsp(void* buf, int32_t bufLen, SVSubTablesRsp* pRsp);
int32_t tDeserializeSVSubTablesRsp(void* buf, int32_t bufLen, SVSubTablesRsp* pRsp);
void tDestroySVSubTablesRsp(void* rsp);
typedef struct {
SMsgHead header;
tb_uid_t suid;
} SVStbRefDbsReq;
int32_t tSerializeSVStbRefDbsReq(void* buf, int32_t bufLen, SVStbRefDbsReq* pReq);
int32_t tDeserializeSVStbRefDbsReq(void* buf, int32_t bufLen, SVStbRefDbsReq* pReq);
typedef struct {
int32_t vgId;
SArray* pDbs; // SArray<char* (db name)>
} SVStbRefDbsRsp;
int32_t tSerializeSVStbRefDbsRsp(void* buf, int32_t bufLen, SVStbRefDbsRsp* pRsp);
int32_t tDeserializeSVStbRefDbsRsp(void* buf, int32_t bufLen, SVStbRefDbsRsp* pRsp);
void tDestroySVStbRefDbsRsp(void* rsp);
2021-10-08 05:53:49 +00:00
typedef struct {
2021-12-28 08:06:01 +00:00
char db[TSDB_DB_FNAME_LEN];
2021-12-15 10:29:21 +00:00
int32_t numOfVgroups;
2022-04-25 13:12:03 +00:00
int32_t numOfStables; // single_stable
int32_t buffer; // MB
int32_t pageSize;
int32_t pages;
int32_t cacheLastSize;
2026-03-20 05:56:20 +00:00
int32_t cacheLastShardBits; // Number of shards for last cache LRU, -1 for auto
2021-12-06 06:38:37 +00:00
int32_t daysPerFile;
int32_t daysToKeep0;
int32_t daysToKeep1;
int32_t daysToKeep2;
int32_t keepTimeOffset;
2021-12-20 03:51:18 +00:00
int32_t minRows;
int32_t maxRows;
int32_t walFsyncPeriod;
2021-12-09 05:07:00 +00:00
int8_t walLevel;
2021-12-06 06:38:37 +00:00
int8_t precision; // time resolution
int8_t compression;
int8_t replications;
2022-04-20 01:47:38 +00:00
int8_t strict;
int8_t cacheLast;
2022-05-25 13:20:11 +00:00
int8_t schemaless;
2021-12-09 05:07:00 +00:00
int8_t ignoreExist;
2022-03-24 06:25:37 +00:00
int32_t numOfRetensions;
SArray* pRetensions; // SRetention
2022-07-25 13:09:06 +00:00
int32_t walRetentionPeriod;
int64_t walRetentionSize;
2022-07-25 13:09:06 +00:00
int32_t walRollPeriod;
int64_t walSegmentSize;
int32_t sstTrigger;
int16_t hashPrefix;
int16_t hashSuffix;
feat[ts-6107]: shared storage (#31552) * add API to use s3 as shared storage * support using local file system as shared storage * upload file to shared storage * support read, compact and drop * finish basic mnode & vnode msg processing * follower sync migration state * implement mnode transaction, and improve log * send migration progress msg to dnode to avoid deadlock * implement following migration * remove mcount * avoid redo migration on startup * avoid follower deadlock when leader is down * trigger migrate by timer, avoid compact after migration * comment out the usage of 'tcs' functions in stream * change config item prefix from s3 to ss * change db option prefix from s3 to ss * rename s3 data struct, function, file to ss * rename s3 macro to ss * update s3 sql to ss * rename remaining s3 items to ss * check ss configruation, improve s3 retry * grant object storage -> shared storage, check ssEnabled * fix memory leaks * update build options * omit sensitive information when dump config * fix backward compatibility issue * fix issues found in ci-checks * fix some failed test cases * avoid follower timeout and improve log * fix: follower timeout because migration status not updated * refuse migration if there's an in progress one * fix ss test case * remove garbage files and other minor improvement * fix failed test cases * update unit test * fix failed test case * fix failed test case * update document * update document and fix failed test cases * fix minor issues in code, test and document * check new commit after migration task is scheduled * fix several issus 1. migrate information cannot be dropped sometimes because progress response was put into read queue. 2. memory leak in rare cases 3. data corruption in rare cases 4. failed test case * add shared storage upgrade tool * fix compile error
2025-07-14 08:33:53 +00:00
int32_t ssChunkSize;
int32_t ssKeepLocal;
int8_t ssCompact;
2022-09-13 06:19:50 +00:00
int32_t tsdbPageSize;
2023-09-06 03:00:24 +00:00
int32_t sqlLen;
char* sql;
int8_t withArbitrator;
2024-03-27 12:03:38 +00:00
int8_t encryptAlgorithm;
2024-10-26 12:58:02 +00:00
char dnodeListStr[TSDB_DNODE_LIST_LEN];
// 1. add auto-compact parameters
int32_t compactInterval; // minutes
int32_t compactStartTime; // minutes
int32_t compactEndTime; // minutes
int8_t compactTimeOffset; // hour
2025-12-05 05:26:28 +00:00
char encryptAlgrName[TSDB_ENCRYPT_ALGR_NAME_LEN];
2025-12-16 08:27:11 +00:00
int8_t isAudit;
2026-01-28 11:06:16 +00:00
int8_t allowDrop;
int8_t secureDelete;
int8_t securityLevel;
2022-01-10 12:44:11 +00:00
} SCreateDbReq;
2021-12-09 05:07:00 +00:00
2022-02-12 09:00:40 +00:00
int32_t tSerializeSCreateDbReq(void* buf, int32_t bufLen, SCreateDbReq* pReq);
int32_t tDeserializeSCreateDbReq(void* buf, int32_t bufLen, SCreateDbReq* pReq);
2022-03-24 06:25:37 +00:00
void tFreeSCreateDbReq(SCreateDbReq* pReq);
2022-02-12 09:00:40 +00:00
2021-12-09 05:07:00 +00:00
typedef struct {
2021-12-28 08:06:01 +00:00
char db[TSDB_DB_FNAME_LEN];
2022-04-25 13:12:03 +00:00
int32_t buffer;
int32_t pageSize;
int32_t pages;
int32_t cacheLastSize;
2026-03-20 05:56:20 +00:00
int32_t cacheLastShardBits; // Number of shards for last cache LRU, -1 for auto
2022-04-28 07:30:23 +00:00
int32_t daysPerFile;
2021-12-09 05:07:00 +00:00
int32_t daysToKeep0;
int32_t daysToKeep1;
int32_t daysToKeep2;
int32_t keepTimeOffset;
int32_t walFsyncPeriod;
2021-12-09 05:07:00 +00:00
int8_t walLevel;
2022-04-20 01:47:38 +00:00
int8_t strict;
int8_t cacheLast;
2022-03-31 09:20:26 +00:00
int8_t replications;
int32_t sstTrigger;
int32_t minRows;
int32_t walRetentionPeriod;
int32_t walRetentionSize;
feat[ts-6107]: shared storage (#31552) * add API to use s3 as shared storage * support using local file system as shared storage * upload file to shared storage * support read, compact and drop * finish basic mnode & vnode msg processing * follower sync migration state * implement mnode transaction, and improve log * send migration progress msg to dnode to avoid deadlock * implement following migration * remove mcount * avoid redo migration on startup * avoid follower deadlock when leader is down * trigger migrate by timer, avoid compact after migration * comment out the usage of 'tcs' functions in stream * change config item prefix from s3 to ss * change db option prefix from s3 to ss * rename s3 data struct, function, file to ss * rename s3 macro to ss * update s3 sql to ss * rename remaining s3 items to ss * check ss configruation, improve s3 retry * grant object storage -> shared storage, check ssEnabled * fix memory leaks * update build options * omit sensitive information when dump config * fix backward compatibility issue * fix issues found in ci-checks * fix some failed test cases * avoid follower timeout and improve log * fix: follower timeout because migration status not updated * refuse migration if there's an in progress one * fix ss test case * remove garbage files and other minor improvement * fix failed test cases * update unit test * fix failed test case * fix failed test case * update document * update document and fix failed test cases * fix minor issues in code, test and document * check new commit after migration task is scheduled * fix several issus 1. migrate information cannot be dropped sometimes because progress response was put into read queue. 2. memory leak in rare cases 3. data corruption in rare cases 4. failed test case * add shared storage upgrade tool * fix compile error
2025-07-14 08:33:53 +00:00
int32_t ssKeepLocal;
int8_t ssCompact;
2023-09-06 03:00:24 +00:00
int32_t sqlLen;
char* sql;
int8_t withArbitrator;
// 1. add auto-compact parameters
int32_t compactInterval;
2024-11-27 08:27:14 +00:00
int32_t compactStartTime;
int32_t compactEndTime;
2024-11-26 11:46:48 +00:00
int8_t compactTimeOffset;
2025-12-05 05:26:28 +00:00
char encryptAlgrName[TSDB_ENCRYPT_ALGR_NAME_LEN];
2025-12-16 08:27:11 +00:00
int8_t isAudit;
2026-01-28 11:06:16 +00:00
int8_t allowDrop;
int8_t secureDelete;
int8_t securityLevel;
2022-01-10 08:55:56 +00:00
} SAlterDbReq;
2021-12-09 05:07:00 +00:00
2022-02-12 09:00:40 +00:00
int32_t tSerializeSAlterDbReq(void* buf, int32_t bufLen, SAlterDbReq* pReq);
int32_t tDeserializeSAlterDbReq(void* buf, int32_t bufLen, SAlterDbReq* pReq);
2023-09-06 03:00:24 +00:00
void tFreeSAlterDbReq(SAlterDbReq* pReq);
2022-02-12 09:00:40 +00:00
2021-12-09 05:07:00 +00:00
typedef struct {
2023-12-01 07:15:12 +00:00
char db[TSDB_DB_FNAME_LEN];
int8_t ignoreNotExists;
2025-06-06 01:09:40 +00:00
int8_t force;
2023-09-06 03:00:24 +00:00
int32_t sqlLen;
char* sql;
2022-01-10 08:55:56 +00:00
} SDropDbReq;
2021-12-09 05:07:00 +00:00
2022-02-12 09:00:40 +00:00
int32_t tSerializeSDropDbReq(void* buf, int32_t bufLen, SDropDbReq* pReq);
int32_t tDeserializeSDropDbReq(void* buf, int32_t bufLen, SDropDbReq* pReq);
2023-09-06 03:00:24 +00:00
void tFreeSDropDbReq(SDropDbReq* pReq);
2022-02-12 09:00:40 +00:00
2021-12-09 05:07:00 +00:00
typedef struct {
2022-02-23 08:04:06 +00:00
char db[TSDB_DB_FNAME_LEN];
int64_t uid;
2022-01-27 01:33:44 +00:00
} SDropDbRsp;
2022-02-12 09:00:40 +00:00
int32_t tSerializeSDropDbRsp(void* buf, int32_t bufLen, SDropDbRsp* pRsp);
int32_t tDeserializeSDropDbRsp(void* buf, int32_t bufLen, SDropDbRsp* pRsp);
2025-07-12 07:39:29 +00:00
typedef struct {
char name[TSDB_MOUNT_NAME_LEN];
int64_t uid;
} SDropMountRsp;
int32_t tSerializeSDropMountRsp(void* buf, int32_t bufLen, SDropMountRsp* pRsp);
int32_t tDeserializeSDropMountRsp(void* buf, int32_t bufLen, SDropMountRsp* pRsp);
2022-01-27 01:33:44 +00:00
typedef struct {
char db[TSDB_DB_FNAME_LEN];
2022-03-01 11:48:21 +00:00
int64_t dbId;
int32_t vgVersion;
2022-03-16 10:29:31 +00:00
int32_t numOfTable; // unit is TSDB_TABLE_NUM_UNIT
int64_t stateTs; // ms
2022-01-10 08:55:56 +00:00
} SUseDbReq;
2021-12-09 05:07:00 +00:00
2022-02-12 09:00:40 +00:00
int32_t tSerializeSUseDbReq(void* buf, int32_t bufLen, SUseDbReq* pReq);
int32_t tDeserializeSUseDbReq(void* buf, int32_t bufLen, SUseDbReq* pReq);
2021-12-09 05:07:00 +00:00
typedef struct {
2022-02-23 08:04:06 +00:00
char db[TSDB_DB_FNAME_LEN];
int64_t uid;
int32_t vgVersion;
int32_t vgNum;
int16_t hashPrefix;
int16_t hashSuffix;
2022-02-23 08:04:06 +00:00
int8_t hashMethod;
2025-07-12 07:39:29 +00:00
union {
uint8_t flags;
struct {
uint8_t isMount : 1; // TS-5868
uint8_t padding : 7;
};
};
2022-02-23 08:04:06 +00:00
SArray* pVgroupInfos; // Array of SVgroupInfo
int32_t errCode;
int64_t stateTs; // ms
2022-02-14 07:27:38 +00:00
} SUseDbRsp;
2022-03-28 09:22:18 +00:00
int32_t tSerializeSUseDbRsp(void* buf, int32_t bufLen, const SUseDbRsp* pRsp);
2022-02-14 07:27:38 +00:00
int32_t tDeserializeSUseDbRsp(void* buf, int32_t bufLen, SUseDbRsp* pRsp);
2022-05-07 10:03:06 +00:00
int32_t tSerializeSUseDbRspImp(SEncoder* pEncoder, const SUseDbRsp* pRsp);
int32_t tDeserializeSUseDbRspImp(SDecoder* pDecoder, SUseDbRsp* pRsp);
2022-02-14 07:27:38 +00:00
void tFreeSUsedbRsp(SUseDbRsp* pRsp);
2022-04-08 08:05:30 +00:00
typedef struct {
2022-04-10 02:13:22 +00:00
char db[TSDB_DB_FNAME_LEN];
2022-04-08 08:05:30 +00:00
} SDbCfgReq;
int32_t tSerializeSDbCfgReq(void* buf, int32_t bufLen, SDbCfgReq* pReq);
int32_t tDeserializeSDbCfgReq(void* buf, int32_t bufLen, SDbCfgReq* pReq);
2024-04-08 02:33:02 +00:00
typedef struct {
char db[TSDB_DB_FNAME_LEN];
feat[ts-6107]: shared storage (#31552) * add API to use s3 as shared storage * support using local file system as shared storage * upload file to shared storage * support read, compact and drop * finish basic mnode & vnode msg processing * follower sync migration state * implement mnode transaction, and improve log * send migration progress msg to dnode to avoid deadlock * implement following migration * remove mcount * avoid redo migration on startup * avoid follower deadlock when leader is down * trigger migrate by timer, avoid compact after migration * comment out the usage of 'tcs' functions in stream * change config item prefix from s3 to ss * change db option prefix from s3 to ss * rename s3 data struct, function, file to ss * rename s3 macro to ss * update s3 sql to ss * rename remaining s3 items to ss * check ss configruation, improve s3 retry * grant object storage -> shared storage, check ssEnabled * fix memory leaks * update build options * omit sensitive information when dump config * fix backward compatibility issue * fix issues found in ci-checks * fix some failed test cases * avoid follower timeout and improve log * fix: follower timeout because migration status not updated * refuse migration if there's an in progress one * fix ss test case * remove garbage files and other minor improvement * fix failed test cases * update unit test * fix failed test case * fix failed test case * update document * update document and fix failed test cases * fix minor issues in code, test and document * check new commit after migration task is scheduled * fix several issus 1. migrate information cannot be dropped sometimes because progress response was put into read queue. 2. memory leak in rare cases 3. data corruption in rare cases 4. failed test case * add shared storage upgrade tool * fix compile error
2025-07-14 08:33:53 +00:00
} SSsMigrateDbReq;
2024-04-08 02:33:02 +00:00
feat[ts-6107]: shared storage (#31552) * add API to use s3 as shared storage * support using local file system as shared storage * upload file to shared storage * support read, compact and drop * finish basic mnode & vnode msg processing * follower sync migration state * implement mnode transaction, and improve log * send migration progress msg to dnode to avoid deadlock * implement following migration * remove mcount * avoid redo migration on startup * avoid follower deadlock when leader is down * trigger migrate by timer, avoid compact after migration * comment out the usage of 'tcs' functions in stream * change config item prefix from s3 to ss * change db option prefix from s3 to ss * rename s3 data struct, function, file to ss * rename s3 macro to ss * update s3 sql to ss * rename remaining s3 items to ss * check ss configruation, improve s3 retry * grant object storage -> shared storage, check ssEnabled * fix memory leaks * update build options * omit sensitive information when dump config * fix backward compatibility issue * fix issues found in ci-checks * fix some failed test cases * avoid follower timeout and improve log * fix: follower timeout because migration status not updated * refuse migration if there's an in progress one * fix ss test case * remove garbage files and other minor improvement * fix failed test cases * update unit test * fix failed test case * fix failed test case * update document * update document and fix failed test cases * fix minor issues in code, test and document * check new commit after migration task is scheduled * fix several issus 1. migrate information cannot be dropped sometimes because progress response was put into read queue. 2. memory leak in rare cases 3. data corruption in rare cases 4. failed test case * add shared storage upgrade tool * fix compile error
2025-07-14 08:33:53 +00:00
int32_t tSerializeSSsMigrateDbReq(void* buf, int32_t bufLen, SSsMigrateDbReq* pReq);
int32_t tDeserializeSSsMigrateDbReq(void* buf, int32_t bufLen, SSsMigrateDbReq* pReq);
2024-04-08 02:33:02 +00:00
typedef struct {
feat[ts-6107]: shared storage (#31552) * add API to use s3 as shared storage * support using local file system as shared storage * upload file to shared storage * support read, compact and drop * finish basic mnode & vnode msg processing * follower sync migration state * implement mnode transaction, and improve log * send migration progress msg to dnode to avoid deadlock * implement following migration * remove mcount * avoid redo migration on startup * avoid follower deadlock when leader is down * trigger migrate by timer, avoid compact after migration * comment out the usage of 'tcs' functions in stream * change config item prefix from s3 to ss * change db option prefix from s3 to ss * rename s3 data struct, function, file to ss * rename s3 macro to ss * update s3 sql to ss * rename remaining s3 items to ss * check ss configruation, improve s3 retry * grant object storage -> shared storage, check ssEnabled * fix memory leaks * update build options * omit sensitive information when dump config * fix backward compatibility issue * fix issues found in ci-checks * fix some failed test cases * avoid follower timeout and improve log * fix: follower timeout because migration status not updated * refuse migration if there's an in progress one * fix ss test case * remove garbage files and other minor improvement * fix failed test cases * update unit test * fix failed test case * fix failed test case * update document * update document and fix failed test cases * fix minor issues in code, test and document * check new commit after migration task is scheduled * fix several issus 1. migrate information cannot be dropped sometimes because progress response was put into read queue. 2. memory leak in rare cases 3. data corruption in rare cases 4. failed test case * add shared storage upgrade tool * fix compile error
2025-07-14 08:33:53 +00:00
int32_t ssMigrateId;
bool bAccepted;
} SSsMigrateDbRsp;
int32_t tSerializeSSsMigrateDbRsp(void* buf, int32_t bufLen, SSsMigrateDbRsp* pRsp);
int32_t tDeserializeSSsMigrateDbRsp(void* buf, int32_t bufLen, SSsMigrateDbRsp* pRsp);
// Request and response for TDMT_VND_LIST_SSMIGRATE_FILESETS
feat[ts-6107]: shared storage (#31552) * add API to use s3 as shared storage * support using local file system as shared storage * upload file to shared storage * support read, compact and drop * finish basic mnode & vnode msg processing * follower sync migration state * implement mnode transaction, and improve log * send migration progress msg to dnode to avoid deadlock * implement following migration * remove mcount * avoid redo migration on startup * avoid follower deadlock when leader is down * trigger migrate by timer, avoid compact after migration * comment out the usage of 'tcs' functions in stream * change config item prefix from s3 to ss * change db option prefix from s3 to ss * rename s3 data struct, function, file to ss * rename s3 macro to ss * update s3 sql to ss * rename remaining s3 items to ss * check ss configruation, improve s3 retry * grant object storage -> shared storage, check ssEnabled * fix memory leaks * update build options * omit sensitive information when dump config * fix backward compatibility issue * fix issues found in ci-checks * fix some failed test cases * avoid follower timeout and improve log * fix: follower timeout because migration status not updated * refuse migration if there's an in progress one * fix ss test case * remove garbage files and other minor improvement * fix failed test cases * update unit test * fix failed test case * fix failed test case * update document * update document and fix failed test cases * fix minor issues in code, test and document * check new commit after migration task is scheduled * fix several issus 1. migrate information cannot be dropped sometimes because progress response was put into read queue. 2. memory leak in rare cases 3. data corruption in rare cases 4. failed test case * add shared storage upgrade tool * fix compile error
2025-07-14 08:33:53 +00:00
typedef struct {
int32_t ssMigrateId;
} SListSsMigrateFileSetsReq;
feat[ts-6107]: shared storage (#31552) * add API to use s3 as shared storage * support using local file system as shared storage * upload file to shared storage * support read, compact and drop * finish basic mnode & vnode msg processing * follower sync migration state * implement mnode transaction, and improve log * send migration progress msg to dnode to avoid deadlock * implement following migration * remove mcount * avoid redo migration on startup * avoid follower deadlock when leader is down * trigger migrate by timer, avoid compact after migration * comment out the usage of 'tcs' functions in stream * change config item prefix from s3 to ss * change db option prefix from s3 to ss * rename s3 data struct, function, file to ss * rename s3 macro to ss * update s3 sql to ss * rename remaining s3 items to ss * check ss configruation, improve s3 retry * grant object storage -> shared storage, check ssEnabled * fix memory leaks * update build options * omit sensitive information when dump config * fix backward compatibility issue * fix issues found in ci-checks * fix some failed test cases * avoid follower timeout and improve log * fix: follower timeout because migration status not updated * refuse migration if there's an in progress one * fix ss test case * remove garbage files and other minor improvement * fix failed test cases * update unit test * fix failed test case * fix failed test case * update document * update document and fix failed test cases * fix minor issues in code, test and document * check new commit after migration task is scheduled * fix several issus 1. migrate information cannot be dropped sometimes because progress response was put into read queue. 2. memory leak in rare cases 3. data corruption in rare cases 4. failed test case * add shared storage upgrade tool * fix compile error
2025-07-14 08:33:53 +00:00
int32_t tSerializeSListSsMigrateFileSetsReq(void* buf, int32_t bufLen, SListSsMigrateFileSetsReq* pReq);
int32_t tDeserializeSListSsMigrateFileSetsReq(void* buf, int32_t bufLen, SListSsMigrateFileSetsReq* pReq);
feat[ts-6107]: shared storage (#31552) * add API to use s3 as shared storage * support using local file system as shared storage * upload file to shared storage * support read, compact and drop * finish basic mnode & vnode msg processing * follower sync migration state * implement mnode transaction, and improve log * send migration progress msg to dnode to avoid deadlock * implement following migration * remove mcount * avoid redo migration on startup * avoid follower deadlock when leader is down * trigger migrate by timer, avoid compact after migration * comment out the usage of 'tcs' functions in stream * change config item prefix from s3 to ss * change db option prefix from s3 to ss * rename s3 data struct, function, file to ss * rename s3 macro to ss * update s3 sql to ss * rename remaining s3 items to ss * check ss configruation, improve s3 retry * grant object storage -> shared storage, check ssEnabled * fix memory leaks * update build options * omit sensitive information when dump config * fix backward compatibility issue * fix issues found in ci-checks * fix some failed test cases * avoid follower timeout and improve log * fix: follower timeout because migration status not updated * refuse migration if there's an in progress one * fix ss test case * remove garbage files and other minor improvement * fix failed test cases * update unit test * fix failed test case * fix failed test case * update document * update document and fix failed test cases * fix minor issues in code, test and document * check new commit after migration task is scheduled * fix several issus 1. migrate information cannot be dropped sometimes because progress response was put into read queue. 2. memory leak in rare cases 3. data corruption in rare cases 4. failed test case * add shared storage upgrade tool * fix compile error
2025-07-14 08:33:53 +00:00
typedef struct {
int32_t ssMigrateId;
2025-12-15 08:48:20 +00:00
int32_t vgId; // vgroup id
SArray* pFileSets; // SArray<int32_t>
} SListSsMigrateFileSetsRsp;
int32_t tSerializeSListSsMigrateFileSetsRsp(void* buf, int32_t bufLen, SListSsMigrateFileSetsRsp* pRsp);
int32_t tDeserializeSListSsMigrateFileSetsRsp(void* buf, int32_t bufLen, SListSsMigrateFileSetsRsp* pRsp);
2025-12-15 08:48:20 +00:00
void tFreeSListSsMigrateFileSetsRsp(SListSsMigrateFileSetsRsp* pRsp);
// Request and response for TDMT_VND_SSMIGRATE_FILESET
typedef struct {
int32_t ssMigrateId;
2025-12-15 08:48:20 +00:00
int32_t nodeId; // node id of the leader vnode, filled by vnode
int32_t fid;
int64_t startTimeSec;
} SSsMigrateFileSetReq;
feat[ts-6107]: shared storage (#31552) * add API to use s3 as shared storage * support using local file system as shared storage * upload file to shared storage * support read, compact and drop * finish basic mnode & vnode msg processing * follower sync migration state * implement mnode transaction, and improve log * send migration progress msg to dnode to avoid deadlock * implement following migration * remove mcount * avoid redo migration on startup * avoid follower deadlock when leader is down * trigger migrate by timer, avoid compact after migration * comment out the usage of 'tcs' functions in stream * change config item prefix from s3 to ss * change db option prefix from s3 to ss * rename s3 data struct, function, file to ss * rename s3 macro to ss * update s3 sql to ss * rename remaining s3 items to ss * check ss configruation, improve s3 retry * grant object storage -> shared storage, check ssEnabled * fix memory leaks * update build options * omit sensitive information when dump config * fix backward compatibility issue * fix issues found in ci-checks * fix some failed test cases * avoid follower timeout and improve log * fix: follower timeout because migration status not updated * refuse migration if there's an in progress one * fix ss test case * remove garbage files and other minor improvement * fix failed test cases * update unit test * fix failed test case * fix failed test case * update document * update document and fix failed test cases * fix minor issues in code, test and document * check new commit after migration task is scheduled * fix several issus 1. migrate information cannot be dropped sometimes because progress response was put into read queue. 2. memory leak in rare cases 3. data corruption in rare cases 4. failed test case * add shared storage upgrade tool * fix compile error
2025-07-14 08:33:53 +00:00
int32_t tSerializeSSsMigrateFileSetReq(void* buf, int32_t bufLen, SSsMigrateFileSetReq* pReq);
int32_t tDeserializeSSsMigrateFileSetReq(void* buf, int32_t bufLen, SSsMigrateFileSetReq* pReq);
feat[ts-6107]: shared storage (#31552) * add API to use s3 as shared storage * support using local file system as shared storage * upload file to shared storage * support read, compact and drop * finish basic mnode & vnode msg processing * follower sync migration state * implement mnode transaction, and improve log * send migration progress msg to dnode to avoid deadlock * implement following migration * remove mcount * avoid redo migration on startup * avoid follower deadlock when leader is down * trigger migrate by timer, avoid compact after migration * comment out the usage of 'tcs' functions in stream * change config item prefix from s3 to ss * change db option prefix from s3 to ss * rename s3 data struct, function, file to ss * rename s3 macro to ss * update s3 sql to ss * rename remaining s3 items to ss * check ss configruation, improve s3 retry * grant object storage -> shared storage, check ssEnabled * fix memory leaks * update build options * omit sensitive information when dump config * fix backward compatibility issue * fix issues found in ci-checks * fix some failed test cases * avoid follower timeout and improve log * fix: follower timeout because migration status not updated * refuse migration if there's an in progress one * fix ss test case * remove garbage files and other minor improvement * fix failed test cases * update unit test * fix failed test case * fix failed test case * update document * update document and fix failed test cases * fix minor issues in code, test and document * check new commit after migration task is scheduled * fix several issus 1. migrate information cannot be dropped sometimes because progress response was put into read queue. 2. memory leak in rare cases 3. data corruption in rare cases 4. failed test case * add shared storage upgrade tool * fix compile error
2025-07-14 08:33:53 +00:00
typedef struct {
int32_t ssMigrateId;
2025-12-15 08:48:20 +00:00
int32_t nodeId; // node id of the leader vnode
feat[ts-6107]: shared storage (#31552) * add API to use s3 as shared storage * support using local file system as shared storage * upload file to shared storage * support read, compact and drop * finish basic mnode & vnode msg processing * follower sync migration state * implement mnode transaction, and improve log * send migration progress msg to dnode to avoid deadlock * implement following migration * remove mcount * avoid redo migration on startup * avoid follower deadlock when leader is down * trigger migrate by timer, avoid compact after migration * comment out the usage of 'tcs' functions in stream * change config item prefix from s3 to ss * change db option prefix from s3 to ss * rename s3 data struct, function, file to ss * rename s3 macro to ss * update s3 sql to ss * rename remaining s3 items to ss * check ss configruation, improve s3 retry * grant object storage -> shared storage, check ssEnabled * fix memory leaks * update build options * omit sensitive information when dump config * fix backward compatibility issue * fix issues found in ci-checks * fix some failed test cases * avoid follower timeout and improve log * fix: follower timeout because migration status not updated * refuse migration if there's an in progress one * fix ss test case * remove garbage files and other minor improvement * fix failed test cases * update unit test * fix failed test case * fix failed test case * update document * update document and fix failed test cases * fix minor issues in code, test and document * check new commit after migration task is scheduled * fix several issus 1. migrate information cannot be dropped sometimes because progress response was put into read queue. 2. memory leak in rare cases 3. data corruption in rare cases 4. failed test case * add shared storage upgrade tool * fix compile error
2025-07-14 08:33:53 +00:00
int32_t vgId;
int32_t fid;
} SSsMigrateFileSetRsp;
feat[ts-6107]: shared storage (#31552) * add API to use s3 as shared storage * support using local file system as shared storage * upload file to shared storage * support read, compact and drop * finish basic mnode & vnode msg processing * follower sync migration state * implement mnode transaction, and improve log * send migration progress msg to dnode to avoid deadlock * implement following migration * remove mcount * avoid redo migration on startup * avoid follower deadlock when leader is down * trigger migrate by timer, avoid compact after migration * comment out the usage of 'tcs' functions in stream * change config item prefix from s3 to ss * change db option prefix from s3 to ss * rename s3 data struct, function, file to ss * rename s3 macro to ss * update s3 sql to ss * rename remaining s3 items to ss * check ss configruation, improve s3 retry * grant object storage -> shared storage, check ssEnabled * fix memory leaks * update build options * omit sensitive information when dump config * fix backward compatibility issue * fix issues found in ci-checks * fix some failed test cases * avoid follower timeout and improve log * fix: follower timeout because migration status not updated * refuse migration if there's an in progress one * fix ss test case * remove garbage files and other minor improvement * fix failed test cases * update unit test * fix failed test case * fix failed test case * update document * update document and fix failed test cases * fix minor issues in code, test and document * check new commit after migration task is scheduled * fix several issus 1. migrate information cannot be dropped sometimes because progress response was put into read queue. 2. memory leak in rare cases 3. data corruption in rare cases 4. failed test case * add shared storage upgrade tool * fix compile error
2025-07-14 08:33:53 +00:00
int32_t tSerializeSSsMigrateFileSetRsp(void* buf, int32_t bufLen, SSsMigrateFileSetRsp* pRsp);
int32_t tDeserializeSSsMigrateFileSetRsp(void* buf, int32_t bufLen, SSsMigrateFileSetRsp* pRsp);
2024-04-08 02:33:02 +00:00
2025-12-15 08:48:20 +00:00
#define SSMIGRATE_FILESET_STATE_IN_PROGRESS 0
#define SSMIGRATE_FILESET_STATE_SUCCEEDED 1
#define SSMIGRATE_FILESET_STATE_COMPACT 2
#define SSMIGRATE_FILESET_STATE_SKIPPED 3
#define SSMIGRATE_FILESET_STATE_FAILED 4
feat[ts-6107]: shared storage (#31552) * add API to use s3 as shared storage * support using local file system as shared storage * upload file to shared storage * support read, compact and drop * finish basic mnode & vnode msg processing * follower sync migration state * implement mnode transaction, and improve log * send migration progress msg to dnode to avoid deadlock * implement following migration * remove mcount * avoid redo migration on startup * avoid follower deadlock when leader is down * trigger migrate by timer, avoid compact after migration * comment out the usage of 'tcs' functions in stream * change config item prefix from s3 to ss * change db option prefix from s3 to ss * rename s3 data struct, function, file to ss * rename s3 macro to ss * update s3 sql to ss * rename remaining s3 items to ss * check ss configruation, improve s3 retry * grant object storage -> shared storage, check ssEnabled * fix memory leaks * update build options * omit sensitive information when dump config * fix backward compatibility issue * fix issues found in ci-checks * fix some failed test cases * avoid follower timeout and improve log * fix: follower timeout because migration status not updated * refuse migration if there's an in progress one * fix ss test case * remove garbage files and other minor improvement * fix failed test cases * update unit test * fix failed test case * fix failed test case * update document * update document and fix failed test cases * fix minor issues in code, test and document * check new commit after migration task is scheduled * fix several issus 1. migrate information cannot be dropped sometimes because progress response was put into read queue. 2. memory leak in rare cases 3. data corruption in rare cases 4. failed test case * add shared storage upgrade tool * fix compile error
2025-07-14 08:33:53 +00:00
// Request and response for TDMT_VND_QUERY_SSMIGRATE_PROGRESS and TDMT_VND_FOLLOWER_SSMIGRATE
// Note this struct is reused as both request and response in TDMT_VND_QUERY_SSMIGRATE_PROGRESS,
// while as a request, the 'state' field is not used.
// This struct is also used in TDMT_VND_FOLLOWER_SSMIGRATE as request, which don't need a response.
feat[ts-6107]: shared storage (#31552) * add API to use s3 as shared storage * support using local file system as shared storage * upload file to shared storage * support read, compact and drop * finish basic mnode & vnode msg processing * follower sync migration state * implement mnode transaction, and improve log * send migration progress msg to dnode to avoid deadlock * implement following migration * remove mcount * avoid redo migration on startup * avoid follower deadlock when leader is down * trigger migrate by timer, avoid compact after migration * comment out the usage of 'tcs' functions in stream * change config item prefix from s3 to ss * change db option prefix from s3 to ss * rename s3 data struct, function, file to ss * rename s3 macro to ss * update s3 sql to ss * rename remaining s3 items to ss * check ss configruation, improve s3 retry * grant object storage -> shared storage, check ssEnabled * fix memory leaks * update build options * omit sensitive information when dump config * fix backward compatibility issue * fix issues found in ci-checks * fix some failed test cases * avoid follower timeout and improve log * fix: follower timeout because migration status not updated * refuse migration if there's an in progress one * fix ss test case * remove garbage files and other minor improvement * fix failed test cases * update unit test * fix failed test case * fix failed test case * update document * update document and fix failed test cases * fix minor issues in code, test and document * check new commit after migration task is scheduled * fix several issus 1. migrate information cannot be dropped sometimes because progress response was put into read queue. 2. memory leak in rare cases 3. data corruption in rare cases 4. failed test case * add shared storage upgrade tool * fix compile error
2025-07-14 08:33:53 +00:00
typedef struct {
2025-12-15 08:48:20 +00:00
int32_t ssMigrateId; // ss migrate id
int32_t nodeId; // node id of the leader vnode
int32_t vgId; // vgroup id
int32_t fid; // file set id
int32_t state; // SSMIGRATE_FILESET_STATE_*
} SSsMigrateProgress;
int tSerializeSSsMigrateProgress(void* buf, int32_t bufLen, SSsMigrateProgress* pProgress);
int tDeserializeSSsMigrateProgress(void* buf, int32_t bufLen, SSsMigrateProgress* pProgress);
// Request for TDMT_MND_KILL_SSMIGRATE
typedef struct {
int32_t ssMigrateId;
int32_t sqlLen;
char* sql;
} SKillSsMigrateReq;
int32_t tSerializeSKillSsMigrateReq(void* buf, int32_t bufLen, SKillSsMigrateReq* pReq);
int32_t tDeserializeSKillSsMigrateReq(void* buf, int32_t bufLen, SKillSsMigrateReq* pReq);
void tFreeSKillSsMigrateReq(SKillSsMigrateReq* pReq);
// Request for TDMT_VND_KILL_SSMIGRATE
typedef struct {
int32_t ssMigrateId;
} SVnodeKillSsMigrateReq;
int32_t tSerializeSVnodeKillSsMigrateReq(void* buf, int32_t bufLen, SVnodeKillSsMigrateReq* pReq);
int32_t tDeserializeSVnodeKillSsMigrateReq(void* buf, int32_t bufLen, SVnodeKillSsMigrateReq* pReq);
typedef struct {
int32_t vgId;
int64_t keepVersion;
} SMndSetVgroupKeepVersionReq;
int32_t tSerializeSMndSetVgroupKeepVersionReq(void* buf, int32_t bufLen, SMndSetVgroupKeepVersionReq* pReq);
int32_t tDeserializeSMndSetVgroupKeepVersionReq(void* buf, int32_t bufLen, SMndSetVgroupKeepVersionReq* pReq);
2022-07-11 07:16:10 +00:00
typedef struct {
int32_t timestampSec;
2023-09-01 05:24:47 +00:00
int32_t ttlDropMaxCount;
int32_t nUids;
SArray* pTbUids;
2022-07-11 07:16:10 +00:00
} SVDropTtlTableReq;
int32_t tSerializeSVDropTtlTableReq(void* buf, int32_t bufLen, SVDropTtlTableReq* pReq);
int32_t tDeserializeSVDropTtlTableReq(void* buf, int32_t bufLen, SVDropTtlTableReq* pReq);
2022-04-08 08:05:30 +00:00
typedef struct {
2023-05-09 09:04:20 +00:00
char db[TSDB_DB_FNAME_LEN];
2023-04-13 02:54:57 +00:00
int64_t dbId;
2025-12-29 11:27:11 +00:00
int64_t ownerId;
2023-04-13 02:54:57 +00:00
int32_t cfgVersion;
2022-04-08 08:05:30 +00:00
int32_t numOfVgroups;
2022-04-25 13:12:03 +00:00
int32_t numOfStables;
int32_t buffer;
int32_t cacheSize;
2026-03-20 05:56:20 +00:00
int32_t cacheShardBits;
2022-04-25 13:12:03 +00:00
int32_t pageSize;
int32_t pages;
2022-04-08 08:05:30 +00:00
int32_t daysPerFile;
int32_t daysToKeep0;
int32_t daysToKeep1;
int32_t daysToKeep2;
int32_t keepTimeOffset;
2022-04-08 08:05:30 +00:00
int32_t minRows;
int32_t maxRows;
int32_t walFsyncPeriod;
int16_t hashPrefix;
int16_t hashSuffix;
2024-09-18 11:04:44 +00:00
int8_t hashMethod;
2022-04-08 08:05:30 +00:00
int8_t walLevel;
int8_t precision;
int8_t compression;
int8_t replications;
2022-04-20 01:47:38 +00:00
int8_t strict;
int8_t cacheLast;
2025-12-05 05:26:28 +00:00
int8_t encryptAlgr;
char algorithmsId[TSDB_ENCRYPT_ALGR_NAME_LEN];
feat[ts-6107]: shared storage (#31552) * add API to use s3 as shared storage * support using local file system as shared storage * upload file to shared storage * support read, compact and drop * finish basic mnode & vnode msg processing * follower sync migration state * implement mnode transaction, and improve log * send migration progress msg to dnode to avoid deadlock * implement following migration * remove mcount * avoid redo migration on startup * avoid follower deadlock when leader is down * trigger migrate by timer, avoid compact after migration * comment out the usage of 'tcs' functions in stream * change config item prefix from s3 to ss * change db option prefix from s3 to ss * rename s3 data struct, function, file to ss * rename s3 macro to ss * update s3 sql to ss * rename remaining s3 items to ss * check ss configruation, improve s3 retry * grant object storage -> shared storage, check ssEnabled * fix memory leaks * update build options * omit sensitive information when dump config * fix backward compatibility issue * fix issues found in ci-checks * fix some failed test cases * avoid follower timeout and improve log * fix: follower timeout because migration status not updated * refuse migration if there's an in progress one * fix ss test case * remove garbage files and other minor improvement * fix failed test cases * update unit test * fix failed test case * fix failed test case * update document * update document and fix failed test cases * fix minor issues in code, test and document * check new commit after migration task is scheduled * fix several issus 1. migrate information cannot be dropped sometimes because progress response was put into read queue. 2. memory leak in rare cases 3. data corruption in rare cases 4. failed test case * add shared storage upgrade tool * fix compile error
2025-07-14 08:33:53 +00:00
int32_t ssChunkSize;
int32_t ssKeepLocal;
int8_t ssCompact;
2025-07-12 07:39:29 +00:00
union {
uint8_t flags;
struct {
2026-01-28 11:06:16 +00:00
uint8_t isMount : 1; // TS-5868
uint8_t allowDrop : 1; // TS-7232
uint8_t securityLevel : 3; // 6671585124
uint8_t padding : 3;
2025-07-12 07:39:29 +00:00
};
};
2024-11-27 08:27:14 +00:00
int8_t compactTimeOffset;
int32_t compactInterval;
int32_t compactStartTime;
int32_t compactEndTime;
int32_t tsdbPageSize;
int32_t walRetentionPeriod;
int32_t walRollPeriod;
int64_t walRetentionSize;
int64_t walSegmentSize;
int32_t numOfRetensions;
SArray* pRetensions;
2022-05-30 10:00:03 +00:00
int8_t schemaless;
int16_t sstTrigger;
int8_t withArbitrator;
2025-12-16 08:27:11 +00:00
int8_t isAudit;
int8_t secureDelete;
2022-04-08 08:05:30 +00:00
} SDbCfgRsp;
2023-09-01 07:11:25 +00:00
typedef SDbCfgRsp SDbCfgInfo;
2023-04-13 02:54:57 +00:00
2023-09-01 07:11:25 +00:00
int32_t tSerializeSDbCfgRspImpl(SEncoder* encoder, const SDbCfgRsp* pRsp);
2022-04-08 08:05:30 +00:00
int32_t tSerializeSDbCfgRsp(void* buf, int32_t bufLen, const SDbCfgRsp* pRsp);
int32_t tDeserializeSDbCfgRsp(void* buf, int32_t bufLen, SDbCfgRsp* pRsp);
2023-09-01 07:11:25 +00:00
int32_t tDeserializeSDbCfgRspImpl(SDecoder* decoder, SDbCfgRsp* pRsp);
void tFreeSDbCfgRsp(SDbCfgRsp* pRsp);
2022-04-08 08:05:30 +00:00
2022-03-07 11:37:17 +00:00
typedef struct {
int32_t rowNum;
} SQnodeListReq;
int32_t tSerializeSQnodeListReq(void* buf, int32_t bufLen, SQnodeListReq* pReq);
int32_t tDeserializeSQnodeListReq(void* buf, int32_t bufLen, SQnodeListReq* pReq);
2022-06-22 09:17:18 +00:00
typedef struct {
int32_t rowNum;
} SDnodeListReq;
int32_t tSerializeSDnodeListReq(void* buf, int32_t bufLen, SDnodeListReq* pReq);
2022-06-24 07:18:40 +00:00
typedef struct {
int32_t useless; // useless
} SServerVerReq;
int32_t tSerializeSServerVerReq(void* buf, int32_t bufLen, SServerVerReq* pReq);
2024-02-26 02:30:13 +00:00
// int32_t tDeserializeSServerVerReq(void* buf, int32_t bufLen, SServerVerReq* pReq);
2022-06-24 07:18:40 +00:00
typedef struct {
char ver[TSDB_VERSION_LEN];
} SServerVerRsp;
int32_t tSerializeSServerVerRsp(void* buf, int32_t bufLen, SServerVerRsp* pRsp);
int32_t tDeserializeSServerVerRsp(void* buf, int32_t bufLen, SServerVerRsp* pRsp);
2022-05-31 06:03:47 +00:00
typedef struct SQueryNodeAddr {
int32_t nodeId; // vgId or qnodeId
SEpSet epSet;
} SQueryNodeAddr;
2022-03-07 11:37:17 +00:00
typedef struct {
2022-05-31 06:03:47 +00:00
SQueryNodeAddr addr;
uint64_t load;
} SQueryNodeLoad;
2022-03-07 11:37:17 +00:00
typedef struct {
2022-05-31 06:03:47 +00:00
SArray* qnodeList; // SArray<SQueryNodeLoad>
2022-03-07 11:37:17 +00:00
} SQnodeListRsp;
int32_t tSerializeSQnodeListRsp(void* buf, int32_t bufLen, SQnodeListRsp* pRsp);
int32_t tDeserializeSQnodeListRsp(void* buf, int32_t bufLen, SQnodeListRsp* pRsp);
void tFreeSQnodeListRsp(SQnodeListRsp* pRsp);
typedef struct SDownstreamSourceNode {
ENodeType type;
SQueryNodeAddr addr;
uint64_t clientId;
uint64_t taskId;
uint64_t sId;
uint64_t srcTaskId;
int32_t execId;
int32_t fetchMsgType;
bool localExec;
} SDownstreamSourceNode;
typedef struct SDNodeAddr {
int32_t nodeId; // dnodeId
SEpSet epSet;
} SDNodeAddr;
2022-06-21 13:05:47 +00:00
typedef struct {
SArray* dnodeList; // SArray<SDNodeAddr>
2022-06-21 13:05:47 +00:00
} SDnodeListRsp;
int32_t tSerializeSDnodeListRsp(void* buf, int32_t bufLen, SDnodeListRsp* pRsp);
int32_t tDeserializeSDnodeListRsp(void* buf, int32_t bufLen, SDnodeListRsp* pRsp);
void tFreeSDnodeListRsp(SDnodeListRsp* pRsp);
2022-02-14 07:27:38 +00:00
typedef struct {
SArray* pTsmas; // SArray<STableTSMAInfo*>
} STableTSMAInfoRsp;
typedef struct {
SUseDbRsp* useDbRsp;
SDbCfgRsp* cfgRsp;
STableTSMAInfoRsp* pTsmaRsp;
int32_t dbTsmaVersion;
char db[TSDB_DB_FNAME_LEN];
int64_t dbId;
2023-05-09 09:04:20 +00:00
} SDbHbRsp;
typedef struct {
SArray* pArray; // Array of SDbHbRsp
} SDbHbBatchRsp;
2022-02-14 07:27:38 +00:00
2023-05-09 09:04:20 +00:00
int32_t tSerializeSDbHbBatchRsp(void* buf, int32_t bufLen, SDbHbBatchRsp* pRsp);
int32_t tDeserializeSDbHbBatchRsp(void* buf, int32_t bufLen, SDbHbBatchRsp* pRsp);
void tFreeSDbHbBatchRsp(SDbHbBatchRsp* pRsp);
2021-12-09 05:07:00 +00:00
2022-05-06 06:13:56 +00:00
typedef struct {
SArray* pArray; // Array of SGetUserAuthRsp
} SUserAuthBatchRsp;
int32_t tSerializeSUserAuthBatchRsp(void* buf, int32_t bufLen, SUserAuthBatchRsp* pRsp);
int32_t tDeserializeSUserAuthBatchRsp(void* buf, int32_t bufLen, SUserAuthBatchRsp* pRsp);
void tFreeSUserAuthBatchRsp(SUserAuthBatchRsp* pRsp);
2021-12-09 05:07:00 +00:00
typedef struct {
char db[TSDB_DB_FNAME_LEN];
STimeWindow timeRange;
2023-09-06 03:00:24 +00:00
int32_t sqlLen;
char* sql;
2024-11-08 03:13:37 +00:00
SArray* vgroupIds;
2025-09-26 09:32:32 +00:00
int32_t compactId;
2025-02-25 08:48:43 +00:00
int8_t metaOnly;
int8_t force;
2022-04-20 01:47:38 +00:00
} SCompactDbReq;
2022-02-12 09:00:40 +00:00
2022-04-20 01:47:38 +00:00
int32_t tSerializeSCompactDbReq(void* buf, int32_t bufLen, SCompactDbReq* pReq);
int32_t tDeserializeSCompactDbReq(void* buf, int32_t bufLen, SCompactDbReq* pReq);
2023-12-01 07:15:12 +00:00
void tFreeSCompactDbReq(SCompactDbReq* pReq);
2021-10-08 05:53:49 +00:00
typedef struct {
2025-09-26 09:32:32 +00:00
union {
int32_t compactId;
int32_t id;
};
int8_t bAccepted;
} SCompactDbRsp;
int32_t tSerializeSCompactDbRsp(void* buf, int32_t bufLen, SCompactDbRsp* pRsp);
int32_t tDeserializeSCompactDbRsp(void* buf, int32_t bufLen, SCompactDbRsp* pRsp);
typedef struct {
2025-09-26 09:32:32 +00:00
union {
int32_t compactId;
int32_t id;
};
2023-11-23 11:26:14 +00:00
int32_t sqlLen;
char* sql;
} SKillCompactReq;
int32_t tSerializeSKillCompactReq(void* buf, int32_t bufLen, SKillCompactReq* pReq);
2023-11-23 11:26:14 +00:00
int32_t tDeserializeSKillCompactReq(void* buf, int32_t bufLen, SKillCompactReq* pReq);
2024-01-26 09:14:00 +00:00
void tFreeSKillCompactReq(SKillCompactReq* pReq);
2025-09-26 09:32:32 +00:00
typedef SCompactDbRsp STrimDbRsp; // reuse structs
typedef SKillCompactReq SKillRetentionReq; // reuse structs
2021-10-08 05:53:49 +00:00
typedef struct {
2021-12-06 06:38:37 +00:00
char name[TSDB_FUNC_NAME_LEN];
2022-01-24 05:59:09 +00:00
int8_t igExists;
2021-12-08 05:48:18 +00:00
int8_t funcType;
int8_t scriptType;
2021-12-06 06:38:37 +00:00
int8_t outputType;
2021-12-08 05:48:18 +00:00
int32_t outputLen;
2021-12-06 06:38:37 +00:00
int32_t bufSize;
2022-04-20 09:43:02 +00:00
int32_t codeLen;
2022-01-24 02:38:49 +00:00
int64_t signature;
char* pComment;
char* pCode;
int8_t orReplace;
2022-01-10 08:55:56 +00:00
} SCreateFuncReq;
2021-10-08 05:53:49 +00:00
2022-02-12 08:28:50 +00:00
int32_t tSerializeSCreateFuncReq(void* buf, int32_t bufLen, SCreateFuncReq* pReq);
int32_t tDeserializeSCreateFuncReq(void* buf, int32_t bufLen, SCreateFuncReq* pReq);
void tFreeSCreateFuncReq(SCreateFuncReq* pReq);
2022-02-12 08:28:50 +00:00
2021-10-08 05:53:49 +00:00
typedef struct {
2022-01-24 09:55:37 +00:00
char name[TSDB_FUNC_NAME_LEN];
int8_t igNotExists;
2022-01-10 08:55:56 +00:00
} SDropFuncReq;
2021-12-08 05:48:18 +00:00
2022-02-12 08:28:50 +00:00
int32_t tSerializeSDropFuncReq(void* buf, int32_t bufLen, SDropFuncReq* pReq);
int32_t tDeserializeSDropFuncReq(void* buf, int32_t bufLen, SDropFuncReq* pReq);
2021-12-08 05:48:18 +00:00
typedef struct {
int32_t numOfFuncs;
2022-04-21 07:33:07 +00:00
bool ignoreCodeComment;
2022-02-12 08:28:50 +00:00
SArray* pFuncNames;
2022-01-10 08:55:56 +00:00
} SRetrieveFuncReq;
2021-10-08 05:53:49 +00:00
2022-02-12 08:28:50 +00:00
int32_t tSerializeSRetrieveFuncReq(void* buf, int32_t bufLen, SRetrieveFuncReq* pReq);
int32_t tDeserializeSRetrieveFuncReq(void* buf, int32_t bufLen, SRetrieveFuncReq* pReq);
void tFreeSRetrieveFuncReq(SRetrieveFuncReq* pReq);
2022-02-12 08:28:50 +00:00
2021-10-08 05:53:49 +00:00
typedef struct {
char name[TSDB_FUNC_NAME_LEN];
2021-12-08 05:48:18 +00:00
int8_t funcType;
int8_t scriptType;
int8_t outputType;
int32_t outputLen;
2021-10-08 05:53:49 +00:00
int32_t bufSize;
2022-01-24 02:38:49 +00:00
int64_t signature;
2021-12-08 05:48:18 +00:00
int32_t commentSize;
int32_t codeSize;
char* pComment;
char* pCode;
2021-12-08 05:48:18 +00:00
} SFuncInfo;
2021-10-08 05:53:49 +00:00
typedef struct {
int32_t funcVersion;
int64_t funcCreatedTime;
} SFuncExtraInfo;
2021-10-08 05:53:49 +00:00
typedef struct {
2021-12-08 05:48:18 +00:00
int32_t numOfFuncs;
2022-02-12 08:28:50 +00:00
SArray* pFuncInfos;
SArray* pFuncExtraInfos;
2021-12-08 05:48:18 +00:00
} SRetrieveFuncRsp;
2021-10-08 05:53:49 +00:00
2022-02-12 08:28:50 +00:00
int32_t tSerializeSRetrieveFuncRsp(void* buf, int32_t bufLen, SRetrieveFuncRsp* pRsp);
int32_t tDeserializeSRetrieveFuncRsp(void* buf, int32_t bufLen, SRetrieveFuncRsp* pRsp);
2022-04-24 05:42:54 +00:00
void tFreeSFuncInfo(SFuncInfo* pInfo);
void tFreeSRetrieveFuncRsp(SRetrieveFuncRsp* pRsp);
2022-02-12 08:28:50 +00:00
2021-10-08 05:53:49 +00:00
typedef struct {
2024-07-05 07:06:11 +00:00
int32_t statusInterval;
/*
Local timezone UTC offset in seconds (east-positive, e.g. +28800 for
Asia/Shanghai). Derived from taosGetLocalTimezoneOffset() on each
status report. Paired with the timezone string in
mndCheckClusterCfgPara: a mismatch is reported only when both the
timezone string AND this offset differ.
*/
int64_t checkTime;
2024-07-05 07:06:11 +00:00
char timezone[TD_TIMEZONE_LEN]; // tsTimezone
char locale[TD_LOCALE_LEN]; // tsLocale
char charset[TD_LOCALE_LEN]; // tsCharset
int8_t ttlChangeOnWrite;
int8_t enableWhiteList;
int8_t encryptionKeyStat;
uint32_t encryptionKeyChksum;
2024-06-19 10:54:26 +00:00
SMonitorParas monitorParas;
int32_t statusIntervalMs;
2021-11-02 06:27:20 +00:00
} SClusterCfg;
2021-10-08 05:53:49 +00:00
typedef struct {
int32_t openVnodes;
2024-09-30 04:34:13 +00:00
int32_t dropVnodes;
int32_t totalVnodes;
int32_t masterNum;
int64_t numOfSelectReqs;
int64_t numOfInsertReqs;
int64_t numOfInsertSuccessReqs;
int64_t numOfBatchInsertReqs;
int64_t numOfBatchInsertSuccessReqs;
int64_t errors;
} SVnodesStat;
2021-11-02 06:27:20 +00:00
typedef struct {
int32_t vgId;
int8_t syncState;
int8_t syncRestore;
2023-09-01 05:24:47 +00:00
int64_t syncTerm;
int64_t roleTimeMs;
int64_t startTimeMs;
int8_t syncCanRead;
int64_t cacheUsage;
2022-02-10 08:26:56 +00:00
int64_t numOfTables;
int64_t numOfTimeSeries;
2021-11-02 06:27:20 +00:00
int64_t totalStorage;
int64_t compStorage;
int64_t pointsWritten;
2022-03-05 07:05:13 +00:00
int64_t numOfSelectReqs;
int64_t numOfInsertReqs;
int64_t numOfInsertSuccessReqs;
int64_t numOfBatchInsertReqs;
int64_t numOfBatchInsertSuccessReqs;
2023-03-22 08:08:16 +00:00
int32_t numOfCachedTables;
2023-09-01 07:11:25 +00:00
int32_t learnerProgress; // use one reservered
int64_t syncAppliedIndex;
int64_t syncCommitIndex;
int64_t bufferSegmentUsed;
int64_t bufferSegmentSize;
int32_t snapSeq;
int64_t syncTotalIndex;
2021-11-02 06:27:20 +00:00
} SVnodeLoad;
2025-06-30 02:33:34 +00:00
typedef struct {
int64_t total_requests;
int64_t total_rows;
int64_t total_bytes;
double write_size;
double cache_hit_ratio;
int64_t rpc_queue_wait;
int64_t preprocess_time;
int64_t memory_table_size;
int64_t commit_count;
int64_t merge_count;
double commit_time;
double merge_time;
int64_t block_commit_time;
int64_t memtable_wait_time;
} SVnodeMetrics;
2024-11-06 07:25:50 +00:00
typedef struct {
2024-11-13 09:01:56 +00:00
int32_t vgId;
int64_t numOfTables;
int64_t memSize;
int64_t l1Size;
int64_t l2Size;
int64_t l3Size;
int64_t cacheSize;
int64_t walSize;
int64_t metaSize;
int64_t rawDataSize;
feat[ts-6107]: shared storage (#31552) * add API to use s3 as shared storage * support using local file system as shared storage * upload file to shared storage * support read, compact and drop * finish basic mnode & vnode msg processing * follower sync migration state * implement mnode transaction, and improve log * send migration progress msg to dnode to avoid deadlock * implement following migration * remove mcount * avoid redo migration on startup * avoid follower deadlock when leader is down * trigger migrate by timer, avoid compact after migration * comment out the usage of 'tcs' functions in stream * change config item prefix from s3 to ss * change db option prefix from s3 to ss * rename s3 data struct, function, file to ss * rename s3 macro to ss * update s3 sql to ss * rename remaining s3 items to ss * check ss configruation, improve s3 retry * grant object storage -> shared storage, check ssEnabled * fix memory leaks * update build options * omit sensitive information when dump config * fix backward compatibility issue * fix issues found in ci-checks * fix some failed test cases * avoid follower timeout and improve log * fix: follower timeout because migration status not updated * refuse migration if there's an in progress one * fix ss test case * remove garbage files and other minor improvement * fix failed test cases * update unit test * fix failed test case * fix failed test case * update document * update document and fix failed test cases * fix minor issues in code, test and document * check new commit after migration task is scheduled * fix several issus 1. migrate information cannot be dropped sometimes because progress response was put into read queue. 2. memory leak in rare cases 3. data corruption in rare cases 4. failed test case * add shared storage upgrade tool * fix compile error
2025-07-14 08:33:53 +00:00
int64_t ssSize;
2024-11-13 09:01:56 +00:00
const char* dbname;
int8_t estimateRawData;
2024-11-06 07:25:50 +00:00
} SDbSizeStatisInfo;
typedef struct {
int32_t vgId;
int64_t nTimeSeries;
} SVnodeLoadLite;
2022-04-19 13:39:42 +00:00
typedef struct {
2023-09-01 05:24:47 +00:00
int8_t syncState;
int64_t syncTerm;
2023-09-01 05:24:47 +00:00
int8_t syncRestore;
int64_t roleTimeMs;
2022-04-19 13:39:42 +00:00
} SMnodeLoad;
2022-05-31 06:03:47 +00:00
typedef struct {
int32_t dnodeId;
int64_t numOfProcessedQuery;
int64_t numOfProcessedCQuery;
int64_t numOfProcessedFetch;
int64_t numOfProcessedDrop;
2023-09-01 05:24:47 +00:00
int64_t numOfProcessedNotify;
2022-05-31 06:03:47 +00:00
int64_t numOfProcessedHb;
2022-06-05 12:33:21 +00:00
int64_t numOfProcessedDelete;
2022-05-31 06:03:47 +00:00
int64_t cacheDataSize;
int64_t numOfQueryInQueue;
int64_t numOfFetchInQueue;
int64_t timeInQueryQueue;
int64_t timeInFetchQueue;
} SQnodeLoad;
2021-11-02 06:27:20 +00:00
typedef struct {
2022-04-12 07:49:21 +00:00
int32_t sver; // software version
int64_t dnodeVer; // dnode table version in sdb
2021-11-02 06:27:20 +00:00
int32_t dnodeId;
2021-12-27 02:57:31 +00:00
int64_t clusterId;
2021-12-27 02:47:14 +00:00
int64_t rebootTime;
int64_t updateTime;
2022-07-04 10:30:10 +00:00
float numOfCores;
2021-12-30 03:35:46 +00:00
int32_t numOfSupportVnodes;
2024-01-24 11:08:19 +00:00
int32_t numOfDiskCfg;
int64_t memTotal;
int64_t memAvail;
2021-11-02 06:27:20 +00:00
char dnodeEp[TSDB_EP_LEN];
2024-01-24 11:08:19 +00:00
char machineId[TSDB_MACHINE_ID_LEN + 1];
2022-05-25 08:41:38 +00:00
SMnodeLoad mload;
2022-05-31 06:03:47 +00:00
SQnodeLoad qload;
2021-11-02 06:27:20 +00:00
SClusterCfg clusterCfg;
2022-02-10 03:40:16 +00:00
SArray* pVloads; // array of SVnodeLoad
2022-11-03 02:42:33 +00:00
int32_t statusSeq;
2023-09-11 02:45:45 +00:00
int64_t ipWhiteVer;
int64_t timeWhiteVer;
2024-10-09 09:09:43 +00:00
int64_t analVer;
2025-02-27 07:22:33 +00:00
int64_t timestamp;
2025-12-16 08:27:11 +00:00
char auditDB[TSDB_DB_FNAME_LEN];
char auditToken[TSDB_TOKEN_LEN];
SEpSet auditEpSet;
int32_t auditVgId;
2022-01-06 09:04:48 +00:00
} SStatusReq;
2021-10-08 05:53:49 +00:00
2022-02-16 05:36:03 +00:00
int32_t tSerializeSStatusReq(void* buf, int32_t bufLen, SStatusReq* pReq);
int32_t tDeserializeSStatusReq(void* buf, int32_t bufLen, SStatusReq* pReq);
2022-04-13 06:00:56 +00:00
void tFreeSStatusReq(SStatusReq* pReq);
2021-12-26 15:46:22 +00:00
2024-11-07 07:29:33 +00:00
typedef struct {
2024-11-08 08:11:04 +00:00
int32_t forceReadConfig;
2024-11-07 07:29:33 +00:00
int32_t cver;
2024-11-08 08:11:04 +00:00
SArray* array;
2024-11-07 07:29:33 +00:00
} SConfigReq;
int32_t tSerializeSConfigReq(void* buf, int32_t bufLen, SConfigReq* pReq);
int32_t tDeserializeSConfigReq(void* buf, int32_t bufLen, SConfigReq* pReq);
2024-12-09 11:07:27 +00:00
void tFreeSConfigReq(SConfigReq* pReq);
2024-11-07 07:29:33 +00:00
typedef struct {
int32_t dnodeId;
char machineId[TSDB_MACHINE_ID_LEN + 1];
} SDnodeInfoReq;
int32_t tSerializeSDnodeInfoReq(void* buf, int32_t bufLen, SDnodeInfoReq* pReq);
int32_t tDeserializeSDnodeInfoReq(void* buf, int32_t bufLen, SDnodeInfoReq* pReq);
2024-06-19 10:54:26 +00:00
typedef enum {
MONITOR_TYPE_COUNTER = 0,
MONITOR_TYPE_SLOW_LOG = 1,
} MONITOR_TYPE;
2023-10-23 08:59:54 +00:00
typedef struct {
2024-07-05 07:06:11 +00:00
int32_t contLen;
char* pCont;
MONITOR_TYPE type;
2023-10-23 08:59:54 +00:00
} SStatisReq;
int32_t tSerializeSStatisReq(void* buf, int32_t bufLen, SStatisReq* pReq);
int32_t tDeserializeSStatisReq(void* buf, int32_t bufLen, SStatisReq* pReq);
2024-04-08 02:33:02 +00:00
void tFreeSStatisReq(SStatisReq* pReq);
2023-10-23 08:59:54 +00:00
2024-10-17 03:34:57 +00:00
typedef struct {
char db[TSDB_DB_FNAME_LEN];
char table[TSDB_TABLE_NAME_LEN];
char operation[AUDIT_OPERATION_LEN];
int32_t sqlLen;
char* pSql;
2025-12-16 08:27:11 +00:00
double duration;
int64_t affectedRows;
2024-10-17 03:34:57 +00:00
} SAuditReq;
int32_t tSerializeSAuditReq(void* buf, int32_t bufLen, SAuditReq* pReq);
int32_t tDeserializeSAuditReq(void* buf, int32_t bufLen, SAuditReq* pReq);
void tFreeSAuditReq(SAuditReq* pReq);
2025-12-16 08:27:11 +00:00
typedef struct {
SArray* auditArr;
} SBatchAuditReq;
int32_t tSerializeSBatchAuditReq(void* buf, int32_t bufLen, SBatchAuditReq* pReq);
int32_t tDeserializeSBatchAuditReq(void* buf, int32_t bufLen, SBatchAuditReq* pReq);
void tFreeSBatchAuditReq(SBatchAuditReq* pReq);
2023-09-19 00:29:51 +00:00
typedef struct {
int32_t dnodeId;
int64_t clusterId;
SArray* pVloads;
2023-09-19 00:29:51 +00:00
} SNotifyReq;
int32_t tSerializeSNotifyReq(void* buf, int32_t bufLen, SNotifyReq* pReq);
int32_t tDeserializeSNotifyReq(void* buf, int32_t bufLen, SNotifyReq* pReq);
void tFreeSNotifyReq(SNotifyReq* pReq);
2021-10-08 05:53:49 +00:00
typedef struct {
2021-10-25 09:39:21 +00:00
int32_t dnodeId;
2021-12-27 02:57:31 +00:00
int64_t clusterId;
2021-10-08 05:53:49 +00:00
} SDnodeCfg;
typedef struct {
2022-02-15 06:57:42 +00:00
int32_t id;
int8_t isMnode;
SEp ep;
2021-10-08 05:53:49 +00:00
} SDnodeEp;
2023-05-06 12:38:50 +00:00
typedef struct {
int32_t id;
2023-05-11 03:32:39 +00:00
int8_t isMnode;
int8_t offlineReason;
2023-05-06 12:38:50 +00:00
SEp ep;
char active[TSDB_ACTIVE_KEY_LEN];
char connActive[TSDB_CONN_ACTIVE_KEY_LEN];
} SDnodeInfo;
2021-10-08 05:53:49 +00:00
typedef struct {
2022-04-12 07:49:21 +00:00
int64_t dnodeVer;
2021-11-02 06:27:20 +00:00
SDnodeCfg dnodeCfg;
2022-02-10 07:06:01 +00:00
SArray* pDnodeEps; // Array of SDnodeEp
2022-11-03 02:42:33 +00:00
int32_t statusSeq;
2023-09-06 09:22:30 +00:00
int64_t ipWhiteVer;
2024-10-09 09:09:43 +00:00
int64_t analVer;
int64_t timeWhiteVer;
2025-12-16 08:27:11 +00:00
char auditDB[TSDB_DB_FNAME_LEN];
char auditToken[TSDB_TOKEN_LEN];
SEpSet auditEpSet;
int32_t auditVgId;
2021-10-08 05:53:49 +00:00
} SStatusRsp;
2022-02-16 05:36:03 +00:00
int32_t tSerializeSStatusRsp(void* buf, int32_t bufLen, SStatusRsp* pRsp);
int32_t tDeserializeSStatusRsp(void* buf, int32_t bufLen, SStatusRsp* pRsp);
2022-03-18 03:23:50 +00:00
void tFreeSStatusRsp(SStatusRsp* pRsp);
2022-02-10 07:06:01 +00:00
2024-11-08 08:11:04 +00:00
typedef struct {
int32_t forceReadConfig;
int32_t isConifgVerified;
int32_t isVersionVerified;
2024-11-11 08:52:47 +00:00
int32_t cver;
2024-11-11 03:33:10 +00:00
SArray* array;
2024-11-08 08:11:04 +00:00
} SConfigRsp;
int32_t tSerializeSConfigRsp(void* buf, int32_t bufLen, SConfigRsp* pRsp);
int32_t tDeserializeSConfigRsp(void* buf, int32_t bufLen, SConfigRsp* pRsp);
void tFreeSConfigRsp(SConfigRsp* pRsp);
typedef struct {
int32_t dnodeId;
int32_t keyVersion; // Local key version
} SKeySyncReq;
int32_t tSerializeSKeySyncReq(void* buf, int32_t bufLen, SKeySyncReq* pReq);
int32_t tDeserializeSKeySyncReq(void* buf, int32_t bufLen, SKeySyncReq* pReq);
typedef struct {
int32_t keyVersion; // mnode's key version
int8_t needUpdate; // 1 if dnode needs to update keys
int32_t encryptionKeyStatus; // Encryption key status (TSDB_ENCRYPT_KEY_STAT_*)
char svrKey[129]; // Server key (if needUpdate)
char dbKey[129]; // Database key (if needUpdate)
char cfgKey[129]; // Config key (if needUpdate)
char metaKey[129]; // Metadata key (if needUpdate)
char dataKey[129]; // Data key (if needUpdate)
int32_t algorithm; // Encryption algorithm for master keys
int32_t cfgAlgorithm; // Encryption algorithm for CFG_KEY
int32_t metaAlgorithm; // Encryption algorithm for META_KEY
int64_t createTime; // Key creation time
int64_t svrKeyUpdateTime; // Server key update time
int64_t dbKeyUpdateTime; // Database key update time
} SKeySyncRsp;
int32_t tSerializeSKeySyncRsp(void* buf, int32_t bufLen, SKeySyncRsp* pRsp);
int32_t tDeserializeSKeySyncRsp(void* buf, int32_t bufLen, SKeySyncRsp* pRsp);
2022-02-10 07:06:01 +00:00
typedef struct {
2022-02-16 05:44:43 +00:00
int32_t reserved;
} SMTimerReq;
int32_t tSerializeSMTimerMsg(void* buf, int32_t bufLen, SMTimerReq* pReq);
2024-02-26 08:56:29 +00:00
// int32_t tDeserializeSMTimerMsg(void* buf, int32_t bufLen, SMTimerReq* pReq);
2022-02-10 07:06:01 +00:00
typedef struct SOrphanTask {
int64_t streamId;
int32_t taskId;
int32_t nodeId;
} SOrphanTask;
typedef struct SMStreamDropOrphanMsg {
SArray* pList; // SArray<SOrphanTask>
} SMStreamDropOrphanMsg;
int32_t tSerializeDropOrphanTaskMsg(void* buf, int32_t bufLen, SMStreamDropOrphanMsg* pMsg);
int32_t tDeserializeDropOrphanTaskMsg(void* buf, int32_t bufLen, SMStreamDropOrphanMsg* pMsg);
2024-08-02 02:47:06 +00:00
void tDestroyDropOrphanTaskMsg(SMStreamDropOrphanMsg* pMsg);
2021-10-08 05:53:49 +00:00
typedef struct {
2021-11-05 08:04:02 +00:00
int32_t id;
uint16_t port; // node sync Port
char fqdn[TSDB_FQDN_LEN]; // node FQDN
2021-11-05 07:42:19 +00:00
} SReplica;
typedef struct {
2021-12-06 07:06:29 +00:00
int32_t vgId;
2021-12-28 08:06:01 +00:00
char db[TSDB_DB_FNAME_LEN];
2022-02-23 08:04:06 +00:00
int64_t dbUid;
2021-12-19 06:43:58 +00:00
int32_t vgVersion;
2022-04-29 13:01:13 +00:00
int32_t numOfStables;
2022-04-25 13:12:03 +00:00
int32_t buffer;
int32_t pageSize;
int32_t pages;
int32_t cacheLastSize;
2026-03-20 05:56:20 +00:00
int32_t cacheLastShardBits; // Number of shards for last cache LRU, -1 for auto
2021-11-05 07:42:19 +00:00
int32_t daysPerFile;
int32_t daysToKeep0;
int32_t daysToKeep1;
int32_t daysToKeep2;
int32_t keepTimeOffset;
2021-12-18 12:56:05 +00:00
int32_t minRows;
int32_t maxRows;
int32_t walFsyncPeriod;
2022-03-03 01:09:11 +00:00
uint32_t hashBegin;
uint32_t hashEnd;
2022-03-07 09:53:02 +00:00
int8_t hashMethod;
2021-12-18 12:56:05 +00:00
int8_t walLevel;
2021-11-05 07:42:19 +00:00
int8_t precision;
int8_t compression;
2022-04-20 01:47:38 +00:00
int8_t strict;
int8_t cacheLast;
int8_t isTsma;
2021-11-05 08:04:02 +00:00
int8_t replica;
2021-11-05 07:42:19 +00:00
int8_t selfIndex;
SReplica replicas[TSDB_MAX_REPLICA];
2022-03-24 06:54:10 +00:00
int32_t numOfRetensions;
SArray* pRetensions; // SRetention
void* pTsma;
2022-07-26 05:26:52 +00:00
int32_t walRetentionPeriod;
2022-07-26 08:03:00 +00:00
int64_t walRetentionSize;
2022-07-26 05:26:52 +00:00
int32_t walRollPeriod;
2022-07-26 08:03:00 +00:00
int64_t walSegmentSize;
int16_t sstTrigger;
int16_t hashPrefix;
int16_t hashSuffix;
2022-09-13 09:49:35 +00:00
int32_t tsdbPageSize;
feat[ts-6107]: shared storage (#31552) * add API to use s3 as shared storage * support using local file system as shared storage * upload file to shared storage * support read, compact and drop * finish basic mnode & vnode msg processing * follower sync migration state * implement mnode transaction, and improve log * send migration progress msg to dnode to avoid deadlock * implement following migration * remove mcount * avoid redo migration on startup * avoid follower deadlock when leader is down * trigger migrate by timer, avoid compact after migration * comment out the usage of 'tcs' functions in stream * change config item prefix from s3 to ss * change db option prefix from s3 to ss * rename s3 data struct, function, file to ss * rename s3 macro to ss * update s3 sql to ss * rename remaining s3 items to ss * check ss configruation, improve s3 retry * grant object storage -> shared storage, check ssEnabled * fix memory leaks * update build options * omit sensitive information when dump config * fix backward compatibility issue * fix issues found in ci-checks * fix some failed test cases * avoid follower timeout and improve log * fix: follower timeout because migration status not updated * refuse migration if there's an in progress one * fix ss test case * remove garbage files and other minor improvement * fix failed test cases * update unit test * fix failed test case * fix failed test case * update document * update document and fix failed test cases * fix minor issues in code, test and document * check new commit after migration task is scheduled * fix several issus 1. migrate information cannot be dropped sometimes because progress response was put into read queue. 2. memory leak in rare cases 3. data corruption in rare cases 4. failed test case * add shared storage upgrade tool * fix compile error
2025-07-14 08:33:53 +00:00
int32_t ssChunkSize;
int32_t ssKeepLocal;
int8_t ssCompact;
2024-04-08 02:33:02 +00:00
int64_t reserved[6];
2023-04-18 11:03:45 +00:00
int8_t learnerReplica;
int8_t learnerSelfIndex;
SReplica learnerReplicas[TSDB_MAX_LEARNER_REPLICA];
2023-09-01 05:24:47 +00:00
int32_t changeVersion;
2024-04-01 09:19:29 +00:00
int8_t encryptAlgorithm;
2025-12-05 05:26:28 +00:00
char encryptAlgrName[TSDB_ENCRYPT_ALGR_NAME_LEN];
2026-01-28 11:06:16 +00:00
union {
uint8_t flags;
struct {
uint8_t isAudit : 1;
uint8_t allowDrop : 1;
uint8_t securityLevel : 3; // 6671585124
uint8_t padding : 3;
2026-01-28 11:06:16 +00:00
};
};
int8_t secureDelete;
2022-04-20 06:21:44 +00:00
} SCreateVnodeReq;
2021-10-08 05:53:49 +00:00
2022-02-16 05:55:37 +00:00
int32_t tSerializeSCreateVnodeReq(void* buf, int32_t bufLen, SCreateVnodeReq* pReq);
int32_t tDeserializeSCreateVnodeReq(void* buf, int32_t bufLen, SCreateVnodeReq* pReq);
2022-03-24 06:54:10 +00:00
int32_t tFreeSCreateVnodeReq(SCreateVnodeReq* pReq);
2022-02-16 05:55:37 +00:00
2023-11-23 04:43:28 +00:00
typedef struct {
2025-09-26 09:32:32 +00:00
union {
int32_t compactId;
int32_t id;
};
2023-11-23 04:43:28 +00:00
int32_t vgId;
int32_t dnodeId;
} SQueryCompactProgressReq;
int32_t tSerializeSQueryCompactProgressReq(void* buf, int32_t bufLen, SQueryCompactProgressReq* pReq);
int32_t tDeserializeSQueryCompactProgressReq(void* buf, int32_t bufLen, SQueryCompactProgressReq* pReq);
typedef struct {
2025-09-26 09:32:32 +00:00
union {
int32_t compactId;
int32_t id;
};
2023-11-23 04:43:28 +00:00
int32_t vgId;
int32_t dnodeId;
int32_t numberFileset;
2023-12-18 10:26:42 +00:00
int32_t finished;
2024-11-13 08:17:16 +00:00
int32_t progress;
int64_t remainingTime;
2023-11-23 04:43:28 +00:00
} SQueryCompactProgressRsp;
int32_t tSerializeSQueryCompactProgressRsp(void* buf, int32_t bufLen, SQueryCompactProgressRsp* pReq);
int32_t tDeserializeSQueryCompactProgressRsp(void* buf, int32_t bufLen, SQueryCompactProgressRsp* pReq);
2025-09-26 09:32:32 +00:00
typedef SQueryCompactProgressReq SQueryRetentionProgressReq;
typedef SQueryCompactProgressRsp SQueryRetentionProgressRsp;
2021-11-04 01:28:55 +00:00
typedef struct {
2022-02-23 08:04:06 +00:00
int32_t vgId;
int32_t dnodeId;
int64_t dbUid;
char db[TSDB_DB_FNAME_LEN];
2022-10-20 08:47:03 +00:00
int64_t reserved[8];
2022-04-20 06:21:44 +00:00
} SDropVnodeReq;
2021-11-04 01:28:55 +00:00
2022-02-16 05:55:37 +00:00
int32_t tSerializeSDropVnodeReq(void* buf, int32_t bufLen, SDropVnodeReq* pReq);
int32_t tDeserializeSDropVnodeReq(void* buf, int32_t bufLen, SDropVnodeReq* pReq);
2021-11-04 01:28:55 +00:00
2022-04-20 06:21:44 +00:00
typedef struct {
2023-02-04 05:50:21 +00:00
char colName[TSDB_COL_NAME_LEN];
char stb[TSDB_TABLE_FNAME_LEN];
int64_t stbUid;
2022-04-20 06:21:44 +00:00
int64_t dbUid;
2022-10-20 08:47:03 +00:00
int64_t reserved[8];
2023-02-04 05:50:21 +00:00
} SDropIndexReq;
int32_t tSerializeSDropIdxReq(void* buf, int32_t bufLen, SDropIndexReq* pReq);
int32_t tDeserializeSDropIdxReq(void* buf, int32_t bufLen, SDropIndexReq* pReq);
2022-04-20 06:21:44 +00:00
typedef struct {
2025-09-26 09:32:32 +00:00
int64_t dbUid;
char db[TSDB_DB_FNAME_LEN];
union {
int64_t compactStartTime;
int64_t startTime;
};
2023-03-07 13:46:34 +00:00
STimeWindow tw;
2025-09-26 09:32:32 +00:00
union {
int32_t compactId;
int32_t id;
};
int8_t metaOnly;
union {
uint16_t flags;
struct {
uint16_t optrType : 3; // ETsdbOpType
uint16_t triggerType : 1; // ETriggerType 0 manual, 1 auto
uint16_t reserved : 12;
};
};
int8_t force; // force compact
2022-04-20 06:21:44 +00:00
} SCompactVnodeReq;
int32_t tSerializeSCompactVnodeReq(void* buf, int32_t bufLen, SCompactVnodeReq* pReq);
int32_t tDeserializeSCompactVnodeReq(void* buf, int32_t bufLen, SCompactVnodeReq* pReq);
2023-11-23 04:43:28 +00:00
typedef struct {
2025-09-26 09:32:32 +00:00
union {
int32_t compactId;
int32_t taskId;
};
2024-01-26 09:14:00 +00:00
int32_t vgId;
int32_t dnodeId;
2023-11-23 04:43:28 +00:00
} SVKillCompactReq;
int32_t tSerializeSVKillCompactReq(void* buf, int32_t bufLen, SVKillCompactReq* pReq);
int32_t tDeserializeSVKillCompactReq(void* buf, int32_t bufLen, SVKillCompactReq* pReq);
2025-09-26 09:32:32 +00:00
typedef SVKillCompactReq SVKillRetentionReq;
typedef struct {
char db[TSDB_DB_FNAME_LEN];
int32_t maxSpeed;
int32_t sqlLen;
char* sql;
SArray* vgroupIds;
STimeWindow tw; // unit is second
union {
uint32_t flags;
struct {
uint32_t optrType : 3; // ETsdbOpType
uint32_t triggerType : 1; // ETriggerType 0 manual, 1 auto
uint32_t reserved : 28;
};
};
} STrimDbReq;
int32_t tSerializeSTrimDbReq(void* buf, int32_t bufLen, STrimDbReq* pReq);
int32_t tDeserializeSTrimDbReq(void* buf, int32_t bufLen, STrimDbReq* pReq);
void tFreeSTrimDbReq(STrimDbReq* pReq);
typedef SCompactVnodeReq SVTrimDbReq; // reuse SCompactVnodeReq, add task monitor since 3.3.8.0
int32_t tSerializeSVTrimDbReq(void* buf, int32_t bufLen, SVTrimDbReq* pReq);
int32_t tDeserializeSVTrimDbReq(void* buf, int32_t bufLen, SVTrimDbReq* pReq);
2022-04-20 06:21:44 +00:00
typedef struct {
2022-10-24 01:18:35 +00:00
int32_t vgVersion;
int32_t buffer;
int32_t pageSize;
int32_t pages;
int32_t cacheLastSize;
2026-03-20 05:56:20 +00:00
int32_t cacheLastShardBits; // Number of shards for last cache LRU, -1 for auto
2022-10-24 01:18:35 +00:00
int32_t daysPerFile;
int32_t daysToKeep0;
int32_t daysToKeep1;
int32_t daysToKeep2;
int32_t keepTimeOffset;
2022-10-24 01:18:35 +00:00
int32_t walFsyncPeriod;
int8_t walLevel;
int8_t strict;
int8_t cacheLast;
2024-04-08 02:33:02 +00:00
int64_t reserved[7];
2023-03-09 07:42:09 +00:00
// 1st modification
2023-03-09 07:25:47 +00:00
int16_t sttTrigger;
int32_t minRows;
// 2nd modification
int32_t walRetentionPeriod;
int32_t walRetentionSize;
feat[ts-6107]: shared storage (#31552) * add API to use s3 as shared storage * support using local file system as shared storage * upload file to shared storage * support read, compact and drop * finish basic mnode & vnode msg processing * follower sync migration state * implement mnode transaction, and improve log * send migration progress msg to dnode to avoid deadlock * implement following migration * remove mcount * avoid redo migration on startup * avoid follower deadlock when leader is down * trigger migrate by timer, avoid compact after migration * comment out the usage of 'tcs' functions in stream * change config item prefix from s3 to ss * change db option prefix from s3 to ss * rename s3 data struct, function, file to ss * rename s3 macro to ss * update s3 sql to ss * rename remaining s3 items to ss * check ss configruation, improve s3 retry * grant object storage -> shared storage, check ssEnabled * fix memory leaks * update build options * omit sensitive information when dump config * fix backward compatibility issue * fix issues found in ci-checks * fix some failed test cases * avoid follower timeout and improve log * fix: follower timeout because migration status not updated * refuse migration if there's an in progress one * fix ss test case * remove garbage files and other minor improvement * fix failed test cases * update unit test * fix failed test case * fix failed test case * update document * update document and fix failed test cases * fix minor issues in code, test and document * check new commit after migration task is scheduled * fix several issus 1. migrate information cannot be dropped sometimes because progress response was put into read queue. 2. memory leak in rare cases 3. data corruption in rare cases 4. failed test case * add shared storage upgrade tool * fix compile error
2025-07-14 08:33:53 +00:00
int32_t ssKeepLocal;
int8_t ssCompact;
2026-01-28 11:06:16 +00:00
int8_t allowDrop;
int8_t secureDelete;
int8_t securityLevel;
2022-10-20 08:47:03 +00:00
} SAlterVnodeConfigReq;
int32_t tSerializeSAlterVnodeConfigReq(void* buf, int32_t bufLen, SAlterVnodeConfigReq* pReq);
int32_t tDeserializeSAlterVnodeConfigReq(void* buf, int32_t bufLen, SAlterVnodeConfigReq* pReq);
typedef struct {
int32_t vgId;
int8_t strict;
2022-04-20 06:21:44 +00:00
int8_t selfIndex;
int8_t replica;
2022-04-20 06:21:44 +00:00
SReplica replicas[TSDB_MAX_REPLICA];
2022-10-20 08:47:03 +00:00
int64_t reserved[8];
2023-04-18 11:03:45 +00:00
int8_t learnerSelfIndex;
int8_t learnerReplica;
SReplica learnerReplicas[TSDB_MAX_LEARNER_REPLICA];
2023-09-01 05:24:47 +00:00
int32_t changeVersion;
int32_t electBaseLine;
} SAlterVnodeReplicaReq, SAlterVnodeTypeReq, SCheckLearnCatchupReq, SAlterVnodeElectBaselineReq;
2022-04-20 06:21:44 +00:00
2022-10-20 08:47:03 +00:00
int32_t tSerializeSAlterVnodeReplicaReq(void* buf, int32_t bufLen, SAlterVnodeReplicaReq* pReq);
int32_t tDeserializeSAlterVnodeReplicaReq(void* buf, int32_t bufLen, SAlterVnodeReplicaReq* pReq);
2022-04-20 06:21:44 +00:00
2023-01-30 05:54:15 +00:00
typedef struct {
2023-02-10 10:03:11 +00:00
int32_t vgId;
int8_t disable;
2023-01-30 05:54:15 +00:00
} SDisableVnodeWriteReq;
int32_t tSerializeSDisableVnodeWriteReq(void* buf, int32_t bufLen, SDisableVnodeWriteReq* pReq);
int32_t tDeserializeSDisableVnodeWriteReq(void* buf, int32_t bufLen, SDisableVnodeWriteReq* pReq);
2023-01-30 08:33:17 +00:00
typedef struct {
int32_t srcVgId;
int32_t dstVgId;
uint32_t hashBegin;
uint32_t hashEnd;
2023-09-01 05:24:47 +00:00
int32_t changeVersion;
int32_t reserved;
2023-01-30 08:33:17 +00:00
} SAlterVnodeHashRangeReq;
int32_t tSerializeSAlterVnodeHashRangeReq(void* buf, int32_t bufLen, SAlterVnodeHashRangeReq* pReq);
int32_t tDeserializeSAlterVnodeHashRangeReq(void* buf, int32_t bufLen, SAlterVnodeHashRangeReq* pReq);
2024-09-19 10:34:49 +00:00
#define REQ_OPT_TBNAME 0x0
#define REQ_OPT_TBUID 0x01
2021-10-08 05:53:49 +00:00
typedef struct {
2021-12-31 05:34:38 +00:00
SMsgHead header;
2022-01-28 09:50:16 +00:00
char dbFName[TSDB_DB_FNAME_LEN];
char tbName[TSDB_TABLE_NAME_LEN];
2024-09-19 10:34:49 +00:00
uint8_t option;
uint8_t autoCreateCtb;
2022-01-10 12:44:11 +00:00
} STableInfoReq;
2021-10-08 05:53:49 +00:00
2022-02-15 07:24:27 +00:00
int32_t tSerializeSTableInfoReq(void* buf, int32_t bufLen, STableInfoReq* pReq);
int32_t tDeserializeSTableInfoReq(void* buf, int32_t bufLen, STableInfoReq* pReq);
2021-10-08 05:53:49 +00:00
typedef struct {
2021-12-10 06:12:11 +00:00
int8_t metaClone; // create local clone of the cached table meta
2021-10-08 05:53:49 +00:00
int32_t numOfVgroups;
int32_t numOfTables;
int32_t numOfUdfs;
char tableNames[];
2022-01-10 12:44:11 +00:00
} SMultiTableInfoReq;
2021-10-08 05:53:49 +00:00
2022-01-26 06:00:15 +00:00
// todo refactor
2021-12-14 07:24:21 +00:00
typedef struct SVgroupInfo {
2022-02-15 06:57:42 +00:00
int32_t vgId;
uint32_t hashBegin;
uint32_t hashEnd;
2022-03-08 09:22:21 +00:00
SEpSet epSet;
2022-03-28 12:31:05 +00:00
union {
int32_t numOfTable; // unit is TSDB_TABLE_NUM_UNIT
int32_t taskId; // used in stream
};
2021-12-14 07:24:21 +00:00
} SVgroupInfo;
2021-10-08 05:53:49 +00:00
typedef struct {
2022-01-26 06:00:15 +00:00
int32_t numOfVgroups;
SVgroupInfo vgroups[];
2022-01-10 12:44:11 +00:00
} SVgroupsInfo;
2021-10-08 05:53:49 +00:00
2022-06-06 05:47:32 +00:00
typedef struct {
2022-06-01 12:28:29 +00:00
STableMetaRsp* pMeta;
} SMAlterStbRsp;
2022-06-06 05:47:32 +00:00
int32_t tEncodeSMAlterStbRsp(SEncoder* pEncoder, const SMAlterStbRsp* pRsp);
int32_t tDecodeSMAlterStbRsp(SDecoder* pDecoder, SMAlterStbRsp* pRsp);
void tFreeSMAlterStbRsp(SMAlterStbRsp* pRsp);
2022-06-02 04:34:35 +00:00
2022-02-15 07:24:27 +00:00
int32_t tSerializeSTableMetaRsp(void* buf, int32_t bufLen, STableMetaRsp* pRsp);
int32_t tDeserializeSTableMetaRsp(void* buf, int32_t bufLen, STableMetaRsp* pRsp);
void tFreeSTableMetaRsp(void* pRsp);
2022-06-15 05:49:29 +00:00
void tFreeSTableIndexRsp(void* info);
2022-02-15 07:24:27 +00:00
typedef struct {
2022-06-15 05:49:29 +00:00
SArray* pMetaRsp; // Array of STableMetaRsp
SArray* pIndexRsp; // Array of STableIndexRsp;
2022-06-13 02:38:45 +00:00
} SSTbHbRsp;
2022-02-15 07:24:27 +00:00
2022-06-13 02:38:45 +00:00
int32_t tSerializeSSTbHbRsp(void* buf, int32_t bufLen, SSTbHbRsp* pRsp);
int32_t tDeserializeSSTbHbRsp(void* buf, int32_t bufLen, SSTbHbRsp* pRsp);
void tFreeSSTbHbRsp(SSTbHbRsp* pRsp);
2022-02-15 07:24:27 +00:00
2023-10-13 08:29:34 +00:00
typedef struct {
2023-10-27 11:28:22 +00:00
SArray* pViewRsp; // Array of SViewMetaRsp*;
2023-10-13 08:29:34 +00:00
} SViewHbRsp;
int32_t tSerializeSViewHbRsp(void* buf, int32_t bufLen, SViewHbRsp* pRsp);
int32_t tDeserializeSViewHbRsp(void* buf, int32_t bufLen, SViewHbRsp* pRsp);
void tFreeSViewHbRsp(SViewHbRsp* pRsp);
2022-01-10 12:44:11 +00:00
typedef struct {
2021-12-06 07:06:29 +00:00
int32_t numOfTables;
int32_t numOfVgroup;
int32_t numOfUdf;
int32_t contLen;
int8_t compressed; // denote if compressed or not
int32_t rawLen; // size before compress
uint8_t metaClone; // make meta clone after retrieve meta from mnode
char meta[];
2021-10-08 05:53:49 +00:00
} SMultiTableMeta;
typedef struct {
int32_t dataLen;
char name[TSDB_TABLE_FNAME_LEN];
2021-12-24 07:40:15 +00:00
char* data;
2021-10-08 05:53:49 +00:00
} STagData;
2022-06-22 08:35:14 +00:00
typedef struct {
2025-02-25 10:21:32 +00:00
int32_t opType;
uint32_t valLen;
char* val;
2022-06-22 08:35:14 +00:00
} SShowVariablesReq;
int32_t tSerializeSShowVariablesReq(void* buf, int32_t bufLen, SShowVariablesReq* pReq);
2025-02-25 10:21:32 +00:00
int32_t tDeserializeSShowVariablesReq(void* buf, int32_t bufLen, SShowVariablesReq* pReq);
void tFreeSShowVariablesReq(SShowVariablesReq* pReq);
2022-06-22 08:35:14 +00:00
2022-06-24 07:18:40 +00:00
typedef struct {
char name[TSDB_CONFIG_OPTION_LEN + 1];
2024-11-13 08:51:40 +00:00
char value[TSDB_CONFIG_PATH_LEN + 1];
2023-07-14 05:57:02 +00:00
char scope[TSDB_CONFIG_SCOPE_LEN + 1];
2024-11-26 08:08:16 +00:00
char category[TSDB_CONFIG_CATEGORY_LEN + 1];
2024-11-13 08:51:40 +00:00
char info[TSDB_CONFIG_INFO_LEN + 1];
2022-06-24 07:18:40 +00:00
} SVariablesInfo;
typedef struct {
SArray* variables; // SArray<SVariablesInfo>
2022-06-24 07:18:40 +00:00
} SShowVariablesRsp;
int32_t tSerializeSShowVariablesRsp(void* buf, int32_t bufLen, SShowVariablesRsp* pReq);
int32_t tDeserializeSShowVariablesRsp(void* buf, int32_t bufLen, SShowVariablesRsp* pReq);
void tFreeSShowVariablesRsp(SShowVariablesRsp* pRsp);
2021-10-08 05:53:49 +00:00
/*
* sql: show tables like '%a_%'
* payload is the query condition, e.g., '%a_%'
* payloadLen is the length of payload
*/
typedef struct {
2022-02-15 07:08:46 +00:00
int32_t type;
2021-12-28 08:06:01 +00:00
char db[TSDB_DB_FNAME_LEN];
2022-02-14 10:42:42 +00:00
int32_t payloadLen;
char* payload;
2022-01-05 12:18:56 +00:00
} SShowReq;
2021-10-08 05:53:49 +00:00
2022-02-14 10:42:42 +00:00
int32_t tSerializeSShowReq(void* buf, int32_t bufLen, SShowReq* pReq);
2024-02-26 08:56:29 +00:00
// int32_t tDeserializeSShowReq(void* buf, int32_t bufLen, SShowReq* pReq);
2024-04-08 02:33:02 +00:00
void tFreeSShowReq(SShowReq* pReq);
2022-02-14 10:42:42 +00:00
2022-01-10 12:44:11 +00:00
typedef struct {
int64_t showId;
2022-01-10 12:44:11 +00:00
STableMetaRsp tableMeta;
2022-02-15 08:46:21 +00:00
} SShowRsp, SVShowTablesRsp;
2021-10-08 05:53:49 +00:00
2024-02-26 08:56:29 +00:00
// int32_t tSerializeSShowRsp(void* buf, int32_t bufLen, SShowRsp* pRsp);
// int32_t tDeserializeSShowRsp(void* buf, int32_t bufLen, SShowRsp* pRsp);
// void tFreeSShowRsp(SShowRsp* pRsp);
2021-10-08 05:53:49 +00:00
typedef struct {
2022-03-09 06:58:15 +00:00
char db[TSDB_DB_FNAME_LEN];
2022-03-16 09:52:44 +00:00
char tb[TSDB_TABLE_NAME_LEN];
char user[TSDB_USER_LEN];
2024-01-26 09:14:00 +00:00
char filterTb[TSDB_TABLE_NAME_LEN]; // for ins_columns
int64_t showId;
2024-01-26 09:14:00 +00:00
int64_t compactId; // for compact
2024-06-17 06:31:39 +00:00
bool withFull; // for show users full
} SRetrieveTableReq;
typedef struct SSysTableSchema {
int8_t type;
col_id_t colId;
int32_t bytes;
} SSysTableSchema;
int32_t tSerializeSRetrieveTableReq(void* buf, int32_t bufLen, SRetrieveTableReq* pReq);
int32_t tDeserializeSRetrieveTableReq(void* buf, int32_t bufLen, SRetrieveTableReq* pReq);
#define RETRIEVE_TABLE_RSP_VERSION 0
#define RETRIEVE_TABLE_RSP_TMQ_VERSION 1
#define RETRIEVE_TABLE_RSP_TMQ_RAW_VERSION 2
typedef struct {
int64_t useconds;
int8_t completed; // all results are returned to client
int8_t precision;
int8_t compressed;
2022-06-10 02:24:56 +00:00
int8_t streamBlockType;
int32_t payloadLen;
int32_t compLen;
int32_t numOfBlocks;
int64_t numOfRows; // from int32_t change to int64_t
int64_t numOfCols;
int64_t skey;
int64_t ekey;
int64_t version; // for stream
TSKEY watermark; // for stream
char parTbName[TSDB_TABLE_NAME_LEN]; // for stream
char data[];
} SRetrieveTableRsp;
#define PAYLOAD_PREFIX_LEN ((sizeof(int32_t)) << 1)
#define SET_PAYLOAD_LEN(_p, _compLen, _fullLen) \
do { \
((int32_t*)(_p))[0] = (_compLen); \
((int32_t*)(_p))[1] = (_fullLen); \
} while (0);
2024-01-17 12:08:26 +00:00
typedef struct {
int64_t version;
int64_t numOfRows;
int8_t compressed;
int8_t precision;
char data[];
} SRetrieveTableRspForTmq;
2022-03-11 11:29:43 +00:00
typedef struct {
2022-03-23 02:44:32 +00:00
int64_t handle;
int64_t useconds;
int8_t completed; // all results are returned to client
int8_t precision;
int8_t compressed;
int32_t compLen;
int32_t numOfRows;
int32_t fullLen;
2022-03-23 02:44:32 +00:00
char data[];
2022-03-11 11:29:43 +00:00
} SRetrieveMetaTableRsp;
2022-04-02 11:31:52 +00:00
typedef struct SExplainExecInfo {
2026-03-20 02:08:49 +00:00
/* the number of rows returned */
2022-04-02 11:31:52 +00:00
uint64_t numOfRows;
uint32_t verboseLen;
2022-04-07 09:41:16 +00:00
void* verboseInfo;
2026-03-20 02:08:49 +00:00
/* the timestamp when the operator is created */
TSKEY execCreate;
/* the first timestamp when the operator's next interface is called */
TSKEY execStart;
/* the timestamp when the first row is returned */
TSKEY execFirstRow;
/* the timestamp when the last row is returned */
TSKEY execLastRow;
/* the number of times the operator's next interface is called */
uint32_t execTimes;
/**
the time elapsed for executing the operator's next interface,
not including waiting time for data from downstream
*/
TSKEY execElapsed;
/* the time elapsed for waiting for data from downstream */
TSKEY inputWaitElapsed;
/* the time elapsed for waiting call from upstream */
TSKEY outputWaitElapsed;
/* the number of rows input */
uint64_t inputRows;
int32_t vgId;
2022-04-02 11:31:52 +00:00
} SExplainExecInfo;
2022-04-01 11:45:45 +00:00
typedef struct {
2022-04-02 11:31:52 +00:00
int32_t numOfPlans;
2022-04-07 09:41:16 +00:00
SExplainExecInfo* subplanInfo;
2022-04-01 11:45:45 +00:00
} SExplainRsp;
2022-09-15 06:46:15 +00:00
typedef struct {
SExplainRsp rsp;
uint64_t qId;
uint64_t cId;
uint64_t tId;
int64_t rId;
int32_t eId;
2022-09-15 06:46:15 +00:00
} SExplainLocalRsp;
typedef struct STableScanAnalyzeInfo {
2026-03-20 02:08:49 +00:00
int64_t totalBlocks;
int64_t fileLoadBlocks;
double fileLoadElapsed;
int64_t sttLoadBlocks;
double sttLoadElapsed;
int64_t memLoadBlocks;
double memLoadElapsed;
int64_t smaLoadBlocks;
double smaLoadElapsed;
int64_t composedBlocks;
double composedElapsed;
uint64_t checkRows;
uint64_t skipBlocks;
uint64_t filterOutBlocks;
double filterTime;
} STableScanAnalyzeInfo;
2022-04-02 11:31:52 +00:00
int32_t tSerializeSExplainRsp(void* buf, int32_t bufLen, SExplainRsp* pRsp);
int32_t tDeserializeSExplainRsp(void* buf, int32_t bufLen, SExplainRsp* pRsp);
void tFreeSExplainRsp(SExplainRsp* pRsp);
2022-04-01 11:45:45 +00:00
2023-12-18 08:34:31 +00:00
typedef struct {
char config[TSDB_DNODE_CONFIG_LEN];
2024-01-18 09:49:11 +00:00
char value[TSDB_CLUSTER_VALUE_LEN];
2023-12-18 08:34:31 +00:00
int32_t sqlLen;
char* sql;
} SMCfgClusterReq;
int32_t tSerializeSMCfgClusterReq(void* buf, int32_t bufLen, SMCfgClusterReq* pReq);
int32_t tDeserializeSMCfgClusterReq(void* buf, int32_t bufLen, SMCfgClusterReq* pReq);
void tFreeSMCfgClusterReq(SMCfgClusterReq* pReq);
2021-10-08 05:53:49 +00:00
typedef struct {
2021-12-28 05:43:11 +00:00
char fqdn[TSDB_FQDN_LEN]; // end point, hostname:port
int32_t port;
2023-09-06 03:00:24 +00:00
int32_t sqlLen;
char* sql;
2022-01-06 09:04:48 +00:00
} SCreateDnodeReq;
2021-12-08 10:50:52 +00:00
2022-02-12 03:58:40 +00:00
int32_t tSerializeSCreateDnodeReq(void* buf, int32_t bufLen, SCreateDnodeReq* pReq);
int32_t tDeserializeSCreateDnodeReq(void* buf, int32_t bufLen, SCreateDnodeReq* pReq);
2023-09-06 03:00:24 +00:00
void tFreeSCreateDnodeReq(SCreateDnodeReq* pReq);
2022-02-12 03:58:40 +00:00
2021-12-08 10:50:52 +00:00
typedef struct {
int32_t dnodeId;
char fqdn[TSDB_FQDN_LEN];
int32_t port;
int8_t force;
2023-05-16 01:50:10 +00:00
int8_t unsafe;
2023-09-06 03:00:24 +00:00
int32_t sqlLen;
char* sql;
2022-01-06 09:04:48 +00:00
} SDropDnodeReq;
2021-12-08 10:50:52 +00:00
2022-02-12 03:58:40 +00:00
int32_t tSerializeSDropDnodeReq(void* buf, int32_t bufLen, SDropDnodeReq* pReq);
int32_t tDeserializeSDropDnodeReq(void* buf, int32_t bufLen, SDropDnodeReq* pReq);
2023-09-06 03:00:24 +00:00
void tFreeSDropDnodeReq(SDropDnodeReq* pReq);
2022-02-12 03:58:40 +00:00
2023-05-09 09:15:37 +00:00
enum {
RESTORE_TYPE__ALL = 1,
RESTORE_TYPE__MNODE,
RESTORE_TYPE__VNODE,
RESTORE_TYPE__QNODE,
};
typedef struct {
int32_t dnodeId;
int8_t restoreType;
2023-09-06 03:00:24 +00:00
int32_t sqlLen;
char* sql;
2026-03-30 10:31:43 +00:00
int32_t vgId;
2023-05-09 09:15:37 +00:00
} SRestoreDnodeReq;
int32_t tSerializeSRestoreDnodeReq(void* buf, int32_t bufLen, SRestoreDnodeReq* pReq);
int32_t tDeserializeSRestoreDnodeReq(void* buf, int32_t bufLen, SRestoreDnodeReq* pReq);
2023-12-01 07:15:12 +00:00
void tFreeSRestoreDnodeReq(SRestoreDnodeReq* pReq);
2023-05-09 09:15:37 +00:00
2021-12-08 10:50:52 +00:00
typedef struct {
int32_t dnodeId;
2021-12-12 04:14:26 +00:00
char config[TSDB_DNODE_CONFIG_LEN];
2022-02-12 03:58:40 +00:00
char value[TSDB_DNODE_VALUE_LEN];
2023-09-06 03:00:24 +00:00
int32_t sqlLen;
char* sql;
2022-06-23 07:35:22 +00:00
} SMCfgDnodeReq;
2021-10-08 05:53:49 +00:00
2022-02-12 03:58:40 +00:00
int32_t tSerializeSMCfgDnodeReq(void* buf, int32_t bufLen, SMCfgDnodeReq* pReq);
int32_t tDeserializeSMCfgDnodeReq(void* buf, int32_t bufLen, SMCfgDnodeReq* pReq);
2023-12-01 07:15:12 +00:00
void tFreeSMCfgDnodeReq(SMCfgDnodeReq* pReq);
2022-02-12 03:58:40 +00:00
typedef struct {
int8_t keyType; // 0: SVR_KEY, 1: DB_KEY
char newKey[ENCRYPT_KEY_LEN + 1];
int32_t sqlLen;
char* sql;
} SMAlterEncryptKeyReq;
int32_t tSerializeSMAlterEncryptKeyReq(void* buf, int32_t bufLen, SMAlterEncryptKeyReq* pReq);
int32_t tDeserializeSMAlterEncryptKeyReq(void* buf, int32_t bufLen, SMAlterEncryptKeyReq* pReq);
void tFreeSMAlterEncryptKeyReq(SMAlterEncryptKeyReq* pReq);
typedef struct {
int32_t days;
char strategy[ENCRYPT_KEY_EXPIRE_STRATEGY_LEN + 1];
int32_t sqlLen;
char* sql;
} SMAlterKeyExpirationReq;
int32_t tSerializeSMAlterKeyExpirationReq(void* buf, int32_t bufLen, SMAlterKeyExpirationReq* pReq);
int32_t tDeserializeSMAlterKeyExpirationReq(void* buf, int32_t bufLen, SMAlterKeyExpirationReq* pReq);
void tFreeSMAlterKeyExpirationReq(SMAlterKeyExpirationReq* pReq);
2022-06-23 07:35:22 +00:00
typedef struct {
2024-11-21 06:30:28 +00:00
char config[TSDB_DNODE_CONFIG_LEN];
char value[TSDB_DNODE_VALUE_LEN];
int32_t version;
2022-06-23 07:35:22 +00:00
} SDCfgDnodeReq;
int32_t tSerializeSDCfgDnodeReq(void* buf, int32_t bufLen, SDCfgDnodeReq* pReq);
int32_t tDeserializeSDCfgDnodeReq(void* buf, int32_t bufLen, SDCfgDnodeReq* pReq);
2021-12-08 11:34:54 +00:00
typedef struct {
int32_t dnodeId;
2023-09-06 03:00:24 +00:00
int32_t sqlLen;
char* sql;
2022-04-10 02:13:22 +00:00
} SMCreateMnodeReq, SMDropMnodeReq, SDDropMnodeReq, SMCreateQnodeReq, SMDropQnodeReq, SDCreateQnodeReq, SDDropQnodeReq,
2025-12-15 08:48:20 +00:00
SMCreateSnodeReq, SMDropSnodeReq, SDDropSnodeReq;
2025-05-14 03:39:54 +00:00
int32_t tSerializeSCreateDropMQSNodeReq(void* buf, int32_t bufLen, SMCreateQnodeReq* pReq);
int32_t tDeserializeSCreateDropMQSNodeReq(void* buf, int32_t bufLen, SMCreateQnodeReq* pReq);
2021-12-08 11:34:54 +00:00
2025-05-13 06:37:07 +00:00
typedef struct {
2025-06-06 10:41:38 +00:00
int32_t nodeId;
SEpSet epSet;
} SNodeEpSet;
typedef struct {
int32_t snodeId;
SNodeEpSet leaders[2];
SNodeEpSet replica;
int32_t sqlLen;
char* sql;
2025-05-13 06:37:07 +00:00
} SDCreateSnodeReq;
2025-12-15 08:48:20 +00:00
int32_t tSerializeSDCreateSNodeReq(void* buf, int32_t bufLen, SDCreateSnodeReq* pReq);
int32_t tDeserializeSDCreateSNodeReq(void* buf, int32_t bufLen, SDCreateSnodeReq* pReq);
void tFreeSDCreateSnodeReq(SDCreateSnodeReq* pReq);
2025-05-14 03:39:54 +00:00
2025-12-15 08:48:20 +00:00
void tFreeSMCreateQnodeReq(SMCreateQnodeReq* pReq);
void tFreeSDDropQnodeReq(SDDropQnodeReq* pReq);
2021-10-08 05:53:49 +00:00
typedef struct {
2021-11-22 02:03:41 +00:00
int8_t replica;
2021-11-05 07:42:19 +00:00
SReplica replicas[TSDB_MAX_REPLICA];
2023-04-18 11:03:45 +00:00
int8_t learnerReplica;
SReplica learnerReplicas[TSDB_MAX_LEARNER_REPLICA];
int64_t lastIndex;
2026-01-22 06:24:32 +00:00
int8_t encrypted; // Whether sdb.data is encrypted (0=false, 1=true)
2023-04-18 11:03:45 +00:00
} SDCreateMnodeReq, SDAlterMnodeReq, SDAlterMnodeTypeReq;
2021-10-08 05:53:49 +00:00
2022-02-16 08:36:05 +00:00
int32_t tSerializeSDCreateMnodeReq(void* buf, int32_t bufLen, SDCreateMnodeReq* pReq);
int32_t tDeserializeSDCreateMnodeReq(void* buf, int32_t bufLen, SDCreateMnodeReq* pReq);
2024-10-09 09:09:43 +00:00
typedef struct {
int32_t urlLen;
int32_t sqlLen;
char* url;
char* sql;
} SMCreateAnodeReq;
int32_t tSerializeSMCreateAnodeReq(void* buf, int32_t bufLen, SMCreateAnodeReq* pReq);
int32_t tDeserializeSMCreateAnodeReq(void* buf, int32_t bufLen, SMCreateAnodeReq* pReq);
void tFreeSMCreateAnodeReq(SMCreateAnodeReq* pReq);
typedef struct {
int32_t anodeId;
int32_t sqlLen;
char* sql;
} SMDropAnodeReq, SMUpdateAnodeReq;
int32_t tSerializeSMDropAnodeReq(void* buf, int32_t bufLen, SMDropAnodeReq* pReq);
int32_t tDeserializeSMDropAnodeReq(void* buf, int32_t bufLen, SMDropAnodeReq* pReq);
void tFreeSMDropAnodeReq(SMDropAnodeReq* pReq);
int32_t tSerializeSMUpdateAnodeReq(void* buf, int32_t bufLen, SMUpdateAnodeReq* pReq);
int32_t tDeserializeSMUpdateAnodeReq(void* buf, int32_t bufLen, SMUpdateAnodeReq* pReq);
void tFreeSMUpdateAnodeReq(SMUpdateAnodeReq* pReq);
feat(mqtt): mqtt subscription (#30127) * feat(mqtt): Initial commit for mqtt * chore(xnode/mnd): xnode message handlers for mnode * chore(mnd/xnode): mnode part for xnode * chore(xnode/translater): fix show commands * fix(ast/creater): fix xnode create option * fix(xnode/ci): fix ci & doc's error codes * chore(xnode/sql): make create/drop/show work properly * fix(xnode/sql): commit new files * fix(xnode/sql): commit cmake files * fix: fix testing cases * fix(xnode/tsc): fix tokens * fix(ast/anode): fix anode update decl. * fix(xnode/error): fix xnode error codes * fix: xnode make/destroy * chore: xnode with option & dnode id * chore: use taosmqtt for xnode * chore: new error code for xnode launching * chore(xnode): new error code * chore: header for _xnode_mgmt_mqtt * chore: source for _xnode_mgmt_mqtt * chore: remove test directory from cmake * chore: remove taosmqtt for ci to compile * chore: remove taosudf header from xnode * chore: new window macro * chore: remove xnode mgmt mqtt for windows compilation * Revert "chore: remove xnode mgmt mqtt for windows compilation" This reverts commit 197e1640c79e40343e683f42236b3f0824392944. * chore: cleanup code * chore: xnode mgmt comment windows part out * chore: mgmt/mqtt, move uv head toppest * xnode/mnode: create xnode once per dnode * fix(xnode/systable/test): fix column count * xnode/sdb: renumber sdb type for xnode to make start/stop order correct * xnode/mqtt: new param mqttPort * fix SXnode's struct type * transfer dnode id to mqtt subscription * tmqtt: remove uv_a linking * tmqtt/tools: sources for tools * tools: fix windows compilation * tools/producer: fix windows sleep param * tools/producer: fix uninited var rc * make tools only for linux * test/mnodes: wail 1 or 2 seconds for offline to be leader * update topic producer tool for geometry data type testing * format tool sql statements * show xnodes' ep * make shell auto complete xnodes * use usleep instead of sleep * mqtt/proto: first version mqtt protocol * remove assert styles * build with linux only * fix libuv for taosmqtt building * fix log printing * mem: use ttq_ prefix instead of tmqtt * xnode/parser/proto: protocol option for xnode * xnode/translater/option: translate xnode option proto * xnode/translator: translate proto param * xnode/tmsg: encode/decode proto param * xnode/mnode: proto parma for mndXnode * xnode/proto: protocol param for xnode * xnode/mqtt: save/load proto from xnode json * rename tmqtt proto header * rename head directories * rename header name styles * restyle func names * update * update * use camel db * use camel for cxt * update count of information_schema * fix exceptional cases * fix w.r.t reviews * fixes w.r.t reviews * use ttq_free * append xnode msgs * update information schema count * support tmq meta data sub * success typo fix Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * fix error line var w.r.t. suggestions from copilot * denote mqtt node with bnode instead of xnode * smoke testing for mqtt * soak testing * new package for test framework: paho 2.1.0 * import mqtt into util * fix soak testing * test/soak: user 5 topics per client * test/soak: cover qos * update docker image references to tdengine-ci:0.1 in CI scripts and common.py * refactor: rename bnode msg to backup node * refactor: rename xnode to bnode 1 * refactor: rename xnode to bnode 2 * refactor: rename xnode to bnode 3 * refactor: rename xnode to bnode 4 * refactor: rename xnode to bnode 4 * refactor: rename xnode to bnode 5 * refactor: rename xnode to bnode 6 * refactor: rename some files 1 * refactor: rename some files 2 * refactor: rename some files 3 * refactor: rename some files 4 --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: chenhaoran <haoran920c@163.com> Co-authored-by: Simon Guan <guanshengliang@qq.com>
2025-06-25 06:58:51 +00:00
typedef struct {
int32_t dnodeId;
int32_t bnodeProto;
int32_t sqlLen;
char* sql;
} SMCreateBnodeReq, SDCreateBnodeReq;
int32_t tSerializeSMCreateBnodeReq(void* buf, int32_t bufLen, SMCreateBnodeReq* pReq);
int32_t tDeserializeSMCreateBnodeReq(void* buf, int32_t bufLen, SMCreateBnodeReq* pReq);
void tFreeSMCreateBnodeReq(SMCreateBnodeReq* pReq);
typedef struct {
int32_t dnodeId;
int32_t sqlLen;
char* sql;
} SMDropBnodeReq, SDDropBnodeReq;
int32_t tSerializeSMDropBnodeReq(void* buf, int32_t bufLen, SMDropBnodeReq* pReq);
int32_t tDeserializeSMDropBnodeReq(void* buf, int32_t bufLen, SMDropBnodeReq* pReq);
void tFreeSMDropBnodeReq(SMDropBnodeReq* pReq);
2024-10-09 09:09:43 +00:00
feat(taosx): support distributed taosx (#34126) * feat: add xnode syntax * refactor(xnode): reduce function complexity * chore: add lost xnode.h file * feat(xnode): create xnode task * chore: fix double free error * add xnoded * start xnoded as subprocess * complete xnode task feature * complete show xnode jobs feature * complete with option feature * complete alter xnode job feature * complete alter xnode task feature * complete user pass feature * clean code * modify status type as char * fix leader ep null * fix start task req null * fix pass id for status * support timeout msg * drop xnode task relative jobs * clean code * wip * chore: add test cases for xnode * chore: fix 3.0 merge changes * fix drain core dump and create task core dump * add password check * retrieve xnode status from xnoded * pass integer as double to cjson * add some debug log * add some job log * fix start task lock * do not handle http response * fix coredump drop xnode task by name * support start/stop/drop task by name * remove mock xnoded * support unix socket * kill pre-xnoded before start * support dnode close xnoded * test(xnode): add unit test cases for xnode * rebalance support where clause * fix some test issue * unformat http post content json string * add xnode zh doc * modify drain description * remove job create/stop/drop operation * support rebalance all without where condition * support alter task by name * add NULL param for mndCheckOperPrivilege * add xnode txnode module for libmnode.a * code clean * change parser len to 4096 * clean code * chore: try to fix gtest/gtest.h not found * chore: fix markdown files * chore: fix markdown in zh * chore: fix enum issue and add ci * chore: fix test case problem * chore: fix pKeyVal overflow * chore: rename to 排空节点 * chore: external cmake remove parallel * chore: add DEP_ext_gtest for xnode test * chore: fix gtest errors * chore: remove gtest pthread lib * chore: fix data type not match * chore: fix some lint errors * chore: fix void unlink * chore: fix return with null pointer check * chore: fix pointer double free and xnodeMemoryTest strncpy null * chore: fix xnode encode action invalid datelen * chore: remove TD_LINUX condition * chore: use PRIu64 denote long long * chore: fix task parser NULL and allow no with clause * fix(xnode): fix windows build error * chore: fix windows curl error * chore: fix test case ins_tables relative error * chore: fix memory leak * docs: update taosx docs * chore: update taosx docs * chore: add role priviledge table * chore: fix error code doc * chore: fix test_xnode.py * chore: fix doc typo * fix: ci error while run test_user_privilege_sysinfo.py --------- Co-authored-by: Linhe Huo <linhehuo@gmail.com> Co-authored-by: huohong <sallyhuo@taosdata.com> Co-authored-by: Simon Guan <guanshengliang@qq.com>
2026-01-01 06:51:03 +00:00
typedef struct {
bool shouldFree;
int32_t len;
const char* ptr;
} CowStr;
/**
* @brief Create a CowStr object.
*
* @param len: length of the string.
* @param ptr: pointer to the string input.
* @param shouldClone: whether to clone the string.
* @return CowStr object.
*/
CowStr xCreateCowStr(int32_t len, const char* ptr, bool shouldClone);
/**
* @brief Set a CowStr object with given string.
*
* @param cow: pointer to the CowStr object.
* @param len: length of the string.
* @param ptr: pointer to the string input.
* @param shouldFree: whether to free the string.
*/
void xSetCowStr(CowStr* cow, int32_t len, const char* ptr, bool shouldFree);
/**
* @brief Clone a CowStr object without copy the string.
*
* @param cow: pointer to the CowStr object.
* @return CowStr object.
*/
CowStr xCloneRefCowStr(CowStr* cow);
/**
* @brief Convert a CowStr object to a string.
*
* @param cow: pointer to the CowStr object.
*/
char* xCowStrToStr(CowStr* cow);
/**
* @brief Deallocate a CowStr object. Clears the string and resets length to 0.
*
* @param cow: pointer to the CowStr object.
*/
void xFreeCowStr(CowStr* cow);
/**
* @brief Encode and push a CowStr object into the encoder.
*
* @param encoder
* @param cow
* @return int32_t
*/
int32_t xEncodeCowStr(SEncoder* encoder, CowStr* cow);
/**
* @brief Decode a CowStr from the encoder.
*
* @param decoder
* @param cow
* @param shouldClone
* @return int32_t
*/
int32_t xDecodeCowStr(SDecoder* decoder, CowStr* cow, bool shouldClone);
typedef struct {
int32_t sqlLen;
int32_t urlLen;
int32_t userLen;
int32_t passLen;
int32_t passIsMd5;
char* sql;
char* url;
char* user;
char* pass;
CowStr token;
} SMCreateXnodeReq, SDCreateXnodeReq;
int32_t tSerializeSMCreateXnodeReq(void* buf, int32_t bufLen, SMCreateXnodeReq* pReq);
int32_t tDeserializeSMCreateXnodeReq(void* buf, int32_t bufLen, SMCreateXnodeReq* pReq);
void tFreeSMCreateXnodeReq(SMCreateXnodeReq* pReq);
typedef struct {
int32_t xnodeId;
int32_t force;
int32_t urlLen;
int32_t sqlLen;
char* url;
char* sql;
} SMDropXnodeReq, SDDropXnodeReq;
int32_t tSerializeSMDropXnodeReq(void* buf, int32_t bufLen, SMDropXnodeReq* pReq);
int32_t tDeserializeSMDropXnodeReq(void* buf, int32_t bufLen, SMDropXnodeReq* pReq);
void tFreeSMDropXnodeReq(SMDropXnodeReq* pReq);
typedef struct {
int32_t id;
CowStr token;
CowStr user;
CowStr pass;
int32_t urlLen;
int32_t sqlLen;
char* url;
char* sql;
} SMUpdateXnodeReq;
int32_t tSerializeSMUpdateXnodeReq(void* buf, int32_t bufLen, SMUpdateXnodeReq* pReq);
int32_t tDeserializeSMUpdateXnodeReq(void* buf, int32_t bufLen, SMUpdateXnodeReq* pReq);
void tFreeSMUpdateXnodeReq(SMUpdateXnodeReq* pReq);
typedef struct {
int32_t xnodeId;
int32_t sqlLen;
char* sql;
} SMDrainXnodeReq;
int32_t tSerializeSMDrainXnodeReq(void* buf, int32_t bufLen, SMDrainXnodeReq* pReq);
int32_t tDeserializeSMDrainXnodeReq(void* buf, int32_t bufLen, SMDrainXnodeReq* pReq);
void tFreeSMDrainXnodeReq(SMDrainXnodeReq* pReq);
feat(taosx): support distributed taosx (#34126) * feat: add xnode syntax * refactor(xnode): reduce function complexity * chore: add lost xnode.h file * feat(xnode): create xnode task * chore: fix double free error * add xnoded * start xnoded as subprocess * complete xnode task feature * complete show xnode jobs feature * complete with option feature * complete alter xnode job feature * complete alter xnode task feature * complete user pass feature * clean code * modify status type as char * fix leader ep null * fix start task req null * fix pass id for status * support timeout msg * drop xnode task relative jobs * clean code * wip * chore: add test cases for xnode * chore: fix 3.0 merge changes * fix drain core dump and create task core dump * add password check * retrieve xnode status from xnoded * pass integer as double to cjson * add some debug log * add some job log * fix start task lock * do not handle http response * fix coredump drop xnode task by name * support start/stop/drop task by name * remove mock xnoded * support unix socket * kill pre-xnoded before start * support dnode close xnoded * test(xnode): add unit test cases for xnode * rebalance support where clause * fix some test issue * unformat http post content json string * add xnode zh doc * modify drain description * remove job create/stop/drop operation * support rebalance all without where condition * support alter task by name * add NULL param for mndCheckOperPrivilege * add xnode txnode module for libmnode.a * code clean * change parser len to 4096 * clean code * chore: try to fix gtest/gtest.h not found * chore: fix markdown files * chore: fix markdown in zh * chore: fix enum issue and add ci * chore: fix test case problem * chore: fix pKeyVal overflow * chore: rename to 排空节点 * chore: external cmake remove parallel * chore: add DEP_ext_gtest for xnode test * chore: fix gtest errors * chore: remove gtest pthread lib * chore: fix data type not match * chore: fix some lint errors * chore: fix void unlink * chore: fix return with null pointer check * chore: fix pointer double free and xnodeMemoryTest strncpy null * chore: fix xnode encode action invalid datelen * chore: remove TD_LINUX condition * chore: use PRIu64 denote long long * chore: fix task parser NULL and allow no with clause * fix(xnode): fix windows build error * chore: fix windows curl error * chore: fix test case ins_tables relative error * chore: fix memory leak * docs: update taosx docs * chore: update taosx docs * chore: add role priviledge table * chore: fix error code doc * chore: fix test_xnode.py * chore: fix doc typo * fix: ci error while run test_user_privilege_sysinfo.py --------- Co-authored-by: Linhe Huo <linhehuo@gmail.com> Co-authored-by: huohong <sallyhuo@taosdata.com> Co-authored-by: Simon Guan <guanshengliang@qq.com>
2026-01-01 06:51:03 +00:00
typedef enum {
XNODE_TASK_SOURCE_DSN = 1,
XNODE_TASK_SOURCE_DATABASE,
XNODE_TASK_SOURCE_TOPIC,
} ENodeXTaskSourceType;
typedef enum {
XNODE_TASK_SINK_DSN = 1,
XNODE_TASK_SINK_DATABASE,
} ENodeXTaskSinkType;
typedef struct {
ENodeXTaskSourceType type;
CowStr cstr;
} xTaskSource;
/**
* @brief Deallocate a xTaskSource object.
*
* @param source ptr
*/
void xFreeTaskSource(xTaskSource* source);
/**
* @brief Create a xTaskSource object with cloned source string.
*
* @param sourceType: source type.
* @param len: length of source string.
* @param source: source string ptr.
* @return xTaskSource object
*/
xTaskSource xCreateClonedTaskSource(ENodeXTaskSourceType sourceType, int32_t len, char* ptr);
xTaskSource xCloneTaskSourceRef(xTaskSource* source);
xTaskSource xCreateTaskSource(ENodeXTaskSourceType sourceType, int32_t len, char* ptr);
const char* xGetTaskSourceTypeAsStr(xTaskSource* source);
const char* xGetTaskSourceStr(xTaskSource* source);
int32_t xSerializeTaskSource(SEncoder* encoder, xTaskSource* source);
int32_t xDeserializeTaskSource(SDecoder* decoder, xTaskSource* source);
typedef struct {
ENodeXTaskSinkType type;
CowStr cstr;
} xTaskSink;
/**
* @brief Deallocate a xTaskSink object.
*
* @param sink ptr
*/
void xFreeTaskSink(xTaskSink* sink);
/**
* @brief Create a xTaskSink object with cloned name string.
*
* @param sinkType: sink type.
* @param len: length of sink string.
* @param ptr: sink string ptr.
* @return xTaskSink object
*/
xTaskSink xCreateClonedTaskSink(ENodeXTaskSinkType sinkType, int32_t len, char* ptr);
xTaskSink xCreateTaskSink(ENodeXTaskSinkType sinkType, int32_t len, char* ptr);
xTaskSink xCloneTaskSinkRef(xTaskSink* sink);
const char* xGetTaskSinkTypeAsStr(xTaskSink* sink);
const char* xGetTaskSinkStr(xTaskSink* sink);
int32_t xSerializeTaskSink(SEncoder* encoder, xTaskSink* sink);
int32_t xDeserializeTaskSink(SDecoder* decoder, xTaskSink* sink);
typedef struct {
int32_t via;
CowStr parser;
// CowStr reason;
CowStr trigger;
CowStr health;
int32_t optionsNum;
CowStr options[TSDB_XNODE_TASK_OPTIONS_MAX_NUM];
} xTaskOptions;
/**
* @brief Deallocate a xTaskOptions object.
*
* @param options ptr
*/
void xFreeTaskOptions(xTaskOptions* options);
void printXnodeTaskOptions(xTaskOptions* options);
int32_t xSerializeTaskOptions(SEncoder* encoder, xTaskOptions* options);
int32_t xDeserializeTaskOptions(SDecoder* decoder, xTaskOptions* options);
typedef struct {
int32_t sqlLen;
char* sql;
int32_t xnodeId;
CowStr name;
xTaskSource source;
xTaskSink sink;
xTaskOptions options;
} SMCreateXnodeTaskReq;
int32_t tSerializeSMCreateXnodeTaskReq(void* buf, int32_t bufLen, SMCreateXnodeTaskReq* pReq);
int32_t tDeserializeSMCreateXnodeTaskReq(void* buf, int32_t bufLen, SMCreateXnodeTaskReq* pReq);
void tFreeSMCreateXnodeTaskReq(SMCreateXnodeTaskReq* pReq);
typedef struct {
int32_t tid;
CowStr name;
int32_t via;
int32_t xnodeId;
CowStr status;
xTaskSource source;
xTaskSink sink;
CowStr parser;
CowStr reason;
CowStr updateName;
CowStr labels;
feat(taosx): support distributed taosx (#34126) * feat: add xnode syntax * refactor(xnode): reduce function complexity * chore: add lost xnode.h file * feat(xnode): create xnode task * chore: fix double free error * add xnoded * start xnoded as subprocess * complete xnode task feature * complete show xnode jobs feature * complete with option feature * complete alter xnode job feature * complete alter xnode task feature * complete user pass feature * clean code * modify status type as char * fix leader ep null * fix start task req null * fix pass id for status * support timeout msg * drop xnode task relative jobs * clean code * wip * chore: add test cases for xnode * chore: fix 3.0 merge changes * fix drain core dump and create task core dump * add password check * retrieve xnode status from xnoded * pass integer as double to cjson * add some debug log * add some job log * fix start task lock * do not handle http response * fix coredump drop xnode task by name * support start/stop/drop task by name * remove mock xnoded * support unix socket * kill pre-xnoded before start * support dnode close xnoded * test(xnode): add unit test cases for xnode * rebalance support where clause * fix some test issue * unformat http post content json string * add xnode zh doc * modify drain description * remove job create/stop/drop operation * support rebalance all without where condition * support alter task by name * add NULL param for mndCheckOperPrivilege * add xnode txnode module for libmnode.a * code clean * change parser len to 4096 * clean code * chore: try to fix gtest/gtest.h not found * chore: fix markdown files * chore: fix markdown in zh * chore: fix enum issue and add ci * chore: fix test case problem * chore: fix pKeyVal overflow * chore: rename to 排空节点 * chore: external cmake remove parallel * chore: add DEP_ext_gtest for xnode test * chore: fix gtest errors * chore: remove gtest pthread lib * chore: fix data type not match * chore: fix some lint errors * chore: fix void unlink * chore: fix return with null pointer check * chore: fix pointer double free and xnodeMemoryTest strncpy null * chore: fix xnode encode action invalid datelen * chore: remove TD_LINUX condition * chore: use PRIu64 denote long long * chore: fix task parser NULL and allow no with clause * fix(xnode): fix windows build error * chore: fix windows curl error * chore: fix test case ins_tables relative error * chore: fix memory leak * docs: update taosx docs * chore: update taosx docs * chore: add role priviledge table * chore: fix error code doc * chore: fix test_xnode.py * chore: fix doc typo * fix: ci error while run test_user_privilege_sysinfo.py --------- Co-authored-by: Linhe Huo <linhehuo@gmail.com> Co-authored-by: huohong <sallyhuo@taosdata.com> Co-authored-by: Simon Guan <guanshengliang@qq.com>
2026-01-01 06:51:03 +00:00
int32_t sqlLen;
char* sql;
} SMUpdateXnodeTaskReq;
int32_t tSerializeSMUpdateXnodeTaskReq(void* buf, int32_t bufLen, SMUpdateXnodeTaskReq* pReq);
int32_t tDeserializeSMUpdateXnodeTaskReq(void* buf, int32_t bufLen, SMUpdateXnodeTaskReq* pReq);
void tFreeSMUpdateXnodeTaskReq(SMUpdateXnodeTaskReq* pReq);
typedef struct {
int32_t id;
feat(taosx): support distributed taosx (#34126) * feat: add xnode syntax * refactor(xnode): reduce function complexity * chore: add lost xnode.h file * feat(xnode): create xnode task * chore: fix double free error * add xnoded * start xnoded as subprocess * complete xnode task feature * complete show xnode jobs feature * complete with option feature * complete alter xnode job feature * complete alter xnode task feature * complete user pass feature * clean code * modify status type as char * fix leader ep null * fix start task req null * fix pass id for status * support timeout msg * drop xnode task relative jobs * clean code * wip * chore: add test cases for xnode * chore: fix 3.0 merge changes * fix drain core dump and create task core dump * add password check * retrieve xnode status from xnoded * pass integer as double to cjson * add some debug log * add some job log * fix start task lock * do not handle http response * fix coredump drop xnode task by name * support start/stop/drop task by name * remove mock xnoded * support unix socket * kill pre-xnoded before start * support dnode close xnoded * test(xnode): add unit test cases for xnode * rebalance support where clause * fix some test issue * unformat http post content json string * add xnode zh doc * modify drain description * remove job create/stop/drop operation * support rebalance all without where condition * support alter task by name * add NULL param for mndCheckOperPrivilege * add xnode txnode module for libmnode.a * code clean * change parser len to 4096 * clean code * chore: try to fix gtest/gtest.h not found * chore: fix markdown files * chore: fix markdown in zh * chore: fix enum issue and add ci * chore: fix test case problem * chore: fix pKeyVal overflow * chore: rename to 排空节点 * chore: external cmake remove parallel * chore: add DEP_ext_gtest for xnode test * chore: fix gtest errors * chore: remove gtest pthread lib * chore: fix data type not match * chore: fix some lint errors * chore: fix void unlink * chore: fix return with null pointer check * chore: fix pointer double free and xnodeMemoryTest strncpy null * chore: fix xnode encode action invalid datelen * chore: remove TD_LINUX condition * chore: use PRIu64 denote long long * chore: fix task parser NULL and allow no with clause * fix(xnode): fix windows build error * chore: fix windows curl error * chore: fix test case ins_tables relative error * chore: fix memory leak * docs: update taosx docs * chore: update taosx docs * chore: add role priviledge table * chore: fix error code doc * chore: fix test_xnode.py * chore: fix doc typo * fix: ci error while run test_user_privilege_sysinfo.py --------- Co-authored-by: Linhe Huo <linhehuo@gmail.com> Co-authored-by: huohong <sallyhuo@taosdata.com> Co-authored-by: Simon Guan <guanshengliang@qq.com>
2026-01-01 06:51:03 +00:00
bool force;
CowStr name;
feat(taosx): support distributed taosx (#34126) * feat: add xnode syntax * refactor(xnode): reduce function complexity * chore: add lost xnode.h file * feat(xnode): create xnode task * chore: fix double free error * add xnoded * start xnoded as subprocess * complete xnode task feature * complete show xnode jobs feature * complete with option feature * complete alter xnode job feature * complete alter xnode task feature * complete user pass feature * clean code * modify status type as char * fix leader ep null * fix start task req null * fix pass id for status * support timeout msg * drop xnode task relative jobs * clean code * wip * chore: add test cases for xnode * chore: fix 3.0 merge changes * fix drain core dump and create task core dump * add password check * retrieve xnode status from xnoded * pass integer as double to cjson * add some debug log * add some job log * fix start task lock * do not handle http response * fix coredump drop xnode task by name * support start/stop/drop task by name * remove mock xnoded * support unix socket * kill pre-xnoded before start * support dnode close xnoded * test(xnode): add unit test cases for xnode * rebalance support where clause * fix some test issue * unformat http post content json string * add xnode zh doc * modify drain description * remove job create/stop/drop operation * support rebalance all without where condition * support alter task by name * add NULL param for mndCheckOperPrivilege * add xnode txnode module for libmnode.a * code clean * change parser len to 4096 * clean code * chore: try to fix gtest/gtest.h not found * chore: fix markdown files * chore: fix markdown in zh * chore: fix enum issue and add ci * chore: fix test case problem * chore: fix pKeyVal overflow * chore: rename to 排空节点 * chore: external cmake remove parallel * chore: add DEP_ext_gtest for xnode test * chore: fix gtest errors * chore: remove gtest pthread lib * chore: fix data type not match * chore: fix some lint errors * chore: fix void unlink * chore: fix return with null pointer check * chore: fix pointer double free and xnodeMemoryTest strncpy null * chore: fix xnode encode action invalid datelen * chore: remove TD_LINUX condition * chore: use PRIu64 denote long long * chore: fix task parser NULL and allow no with clause * fix(xnode): fix windows build error * chore: fix windows curl error * chore: fix test case ins_tables relative error * chore: fix memory leak * docs: update taosx docs * chore: update taosx docs * chore: add role priviledge table * chore: fix error code doc * chore: fix test_xnode.py * chore: fix doc typo * fix: ci error while run test_user_privilege_sysinfo.py --------- Co-authored-by: Linhe Huo <linhehuo@gmail.com> Co-authored-by: huohong <sallyhuo@taosdata.com> Co-authored-by: Simon Guan <guanshengliang@qq.com>
2026-01-01 06:51:03 +00:00
int32_t sqlLen;
char* sql;
} SMDropXnodeTaskReq;
int32_t tSerializeSMDropXnodeTaskReq(void* buf, int32_t bufLen, SMDropXnodeTaskReq* pReq);
int32_t tDeserializeSMDropXnodeTaskReq(void* buf, int32_t bufLen, SMDropXnodeTaskReq* pReq);
void tFreeSMDropXnodeTaskReq(SMDropXnodeTaskReq* pReq);
typedef struct {
int32_t tid;
CowStr name;
int32_t sqlLen;
char* sql;
} SMStartXnodeTaskReq, SMStopXnodeTaskReq;
int32_t tSerializeSMStartXnodeTaskReq(void* buf, int32_t bufLen, SMStartXnodeTaskReq* pReq);
int32_t tDeserializeSMStartXnodeTaskReq(void* buf, int32_t bufLen, SMStartXnodeTaskReq* pReq);
void tFreeSMStartXnodeTaskReq(SMStartXnodeTaskReq* pReq);
int32_t tSerializeSMStopXnodeTaskReq(void* buf, int32_t bufLen, SMStopXnodeTaskReq* pReq);
int32_t tDeserializeSMStopXnodeTaskReq(void* buf, int32_t bufLen, SMStopXnodeTaskReq* pReq);
void tFreeSMStopXnodeTaskReq(SMStopXnodeTaskReq* pReq);
typedef struct {
int32_t tid;
int32_t via;
int32_t xnodeId;
CowStr status;
CowStr config;
CowStr reason;
feat(taosx): support distributed taosx (#34126) * feat: add xnode syntax * refactor(xnode): reduce function complexity * chore: add lost xnode.h file * feat(xnode): create xnode task * chore: fix double free error * add xnoded * start xnoded as subprocess * complete xnode task feature * complete show xnode jobs feature * complete with option feature * complete alter xnode job feature * complete alter xnode task feature * complete user pass feature * clean code * modify status type as char * fix leader ep null * fix start task req null * fix pass id for status * support timeout msg * drop xnode task relative jobs * clean code * wip * chore: add test cases for xnode * chore: fix 3.0 merge changes * fix drain core dump and create task core dump * add password check * retrieve xnode status from xnoded * pass integer as double to cjson * add some debug log * add some job log * fix start task lock * do not handle http response * fix coredump drop xnode task by name * support start/stop/drop task by name * remove mock xnoded * support unix socket * kill pre-xnoded before start * support dnode close xnoded * test(xnode): add unit test cases for xnode * rebalance support where clause * fix some test issue * unformat http post content json string * add xnode zh doc * modify drain description * remove job create/stop/drop operation * support rebalance all without where condition * support alter task by name * add NULL param for mndCheckOperPrivilege * add xnode txnode module for libmnode.a * code clean * change parser len to 4096 * clean code * chore: try to fix gtest/gtest.h not found * chore: fix markdown files * chore: fix markdown in zh * chore: fix enum issue and add ci * chore: fix test case problem * chore: fix pKeyVal overflow * chore: rename to 排空节点 * chore: external cmake remove parallel * chore: add DEP_ext_gtest for xnode test * chore: fix gtest errors * chore: remove gtest pthread lib * chore: fix data type not match * chore: fix some lint errors * chore: fix void unlink * chore: fix return with null pointer check * chore: fix pointer double free and xnodeMemoryTest strncpy null * chore: fix xnode encode action invalid datelen * chore: remove TD_LINUX condition * chore: use PRIu64 denote long long * chore: fix task parser NULL and allow no with clause * fix(xnode): fix windows build error * chore: fix windows curl error * chore: fix test case ins_tables relative error * chore: fix memory leak * docs: update taosx docs * chore: update taosx docs * chore: add role priviledge table * chore: fix error code doc * chore: fix test_xnode.py * chore: fix doc typo * fix: ci error while run test_user_privilege_sysinfo.py --------- Co-authored-by: Linhe Huo <linhehuo@gmail.com> Co-authored-by: huohong <sallyhuo@taosdata.com> Co-authored-by: Simon Guan <guanshengliang@qq.com>
2026-01-01 06:51:03 +00:00
int32_t sqlLen;
char* sql;
} SMCreateXnodeJobReq;
int32_t tSerializeSMCreateXnodeJobReq(void* buf, int32_t bufLen, SMCreateXnodeJobReq* pReq);
int32_t tDeserializeSMCreateXnodeJobReq(void* buf, int32_t bufLen, SMCreateXnodeJobReq* pReq);
void tFreeSMCreateXnodeJobReq(SMCreateXnodeJobReq* pReq);
typedef struct {
int32_t jid;
int32_t via;
int32_t xnodeId;
CowStr status;
int32_t configLen;
int32_t reasonLen;
int32_t sqlLen;
char* config;
char* reason;
char* sql;
} SMUpdateXnodeJobReq;
int32_t tSerializeSMUpdateXnodeJobReq(void* buf, int32_t bufLen, SMUpdateXnodeJobReq* pReq);
int32_t tDeserializeSMUpdateXnodeJobReq(void* buf, int32_t bufLen, SMUpdateXnodeJobReq* pReq);
void tFreeSMUpdateXnodeJobReq(SMUpdateXnodeJobReq* pReq);
typedef struct {
int32_t jid;
int32_t xnodeId;
int32_t sqlLen;
char* sql;
} SMRebalanceXnodeJobReq;
int32_t tSerializeSMRebalanceXnodeJobReq(void* buf, int32_t bufLen, SMRebalanceXnodeJobReq* pReq);
int32_t tDeserializeSMRebalanceXnodeJobReq(void* buf, int32_t bufLen, SMRebalanceXnodeJobReq* pReq);
void tFreeSMRebalanceXnodeJobReq(SMRebalanceXnodeJobReq* pReq);
typedef struct {
CowStr ast;
int32_t sqlLen;
char* sql;
} SMRebalanceXnodeJobsWhereReq;
int32_t tSerializeSMRebalanceXnodeJobsWhereReq(void* buf, int32_t bufLen, SMRebalanceXnodeJobsWhereReq* pReq);
int32_t tDeserializeSMRebalanceXnodeJobsWhereReq(void* buf, int32_t bufLen, SMRebalanceXnodeJobsWhereReq* pReq);
void tFreeSMRebalanceXnodeJobsWhereReq(SMRebalanceXnodeJobsWhereReq* pReq);
typedef struct {
int32_t jid;
CowStr ast;
feat(taosx): support distributed taosx (#34126) * feat: add xnode syntax * refactor(xnode): reduce function complexity * chore: add lost xnode.h file * feat(xnode): create xnode task * chore: fix double free error * add xnoded * start xnoded as subprocess * complete xnode task feature * complete show xnode jobs feature * complete with option feature * complete alter xnode job feature * complete alter xnode task feature * complete user pass feature * clean code * modify status type as char * fix leader ep null * fix start task req null * fix pass id for status * support timeout msg * drop xnode task relative jobs * clean code * wip * chore: add test cases for xnode * chore: fix 3.0 merge changes * fix drain core dump and create task core dump * add password check * retrieve xnode status from xnoded * pass integer as double to cjson * add some debug log * add some job log * fix start task lock * do not handle http response * fix coredump drop xnode task by name * support start/stop/drop task by name * remove mock xnoded * support unix socket * kill pre-xnoded before start * support dnode close xnoded * test(xnode): add unit test cases for xnode * rebalance support where clause * fix some test issue * unformat http post content json string * add xnode zh doc * modify drain description * remove job create/stop/drop operation * support rebalance all without where condition * support alter task by name * add NULL param for mndCheckOperPrivilege * add xnode txnode module for libmnode.a * code clean * change parser len to 4096 * clean code * chore: try to fix gtest/gtest.h not found * chore: fix markdown files * chore: fix markdown in zh * chore: fix enum issue and add ci * chore: fix test case problem * chore: fix pKeyVal overflow * chore: rename to 排空节点 * chore: external cmake remove parallel * chore: add DEP_ext_gtest for xnode test * chore: fix gtest errors * chore: remove gtest pthread lib * chore: fix data type not match * chore: fix some lint errors * chore: fix void unlink * chore: fix return with null pointer check * chore: fix pointer double free and xnodeMemoryTest strncpy null * chore: fix xnode encode action invalid datelen * chore: remove TD_LINUX condition * chore: use PRIu64 denote long long * chore: fix task parser NULL and allow no with clause * fix(xnode): fix windows build error * chore: fix windows curl error * chore: fix test case ins_tables relative error * chore: fix memory leak * docs: update taosx docs * chore: update taosx docs * chore: add role priviledge table * chore: fix error code doc * chore: fix test_xnode.py * chore: fix doc typo * fix: ci error while run test_user_privilege_sysinfo.py --------- Co-authored-by: Linhe Huo <linhehuo@gmail.com> Co-authored-by: huohong <sallyhuo@taosdata.com> Co-authored-by: Simon Guan <guanshengliang@qq.com>
2026-01-01 06:51:03 +00:00
int32_t sqlLen;
char* sql;
} SMDropXnodeJobReq;
int32_t tSerializeSMDropXnodeJobReq(void* buf, int32_t bufLen, SMDropXnodeJobReq* pReq);
int32_t tDeserializeSMDropXnodeJobReq(void* buf, int32_t bufLen, SMDropXnodeJobReq* pReq);
void tFreeSMDropXnodeJobReq(SMDropXnodeJobReq* pReq);
typedef struct {
int32_t sqlLen;
char* sql;
CowStr name;
CowStr status;
xTaskOptions options;
} SMCreateXnodeAgentReq;
int32_t tSerializeSMCreateXnodeAgentReq(void* buf, int32_t bufLen, SMCreateXnodeAgentReq* pReq);
int32_t tDeserializeSMCreateXnodeAgentReq(void* buf, int32_t bufLen, SMCreateXnodeAgentReq* pReq);
void tFreeSMCreateXnodeAgentReq(SMCreateXnodeAgentReq* pReq);
typedef struct {
int32_t sqlLen;
char* sql;
int32_t id;
CowStr name;
xTaskOptions options;
} SMUpdateXnodeAgentReq;
int32_t tSerializeSMUpdateXnodeAgentReq(void* buf, int32_t bufLen, SMUpdateXnodeAgentReq* pReq);
int32_t tDeserializeSMUpdateXnodeAgentReq(void* buf, int32_t bufLen, SMUpdateXnodeAgentReq* pReq);
void tFreeSMUpdateXnodeAgentReq(SMUpdateXnodeAgentReq* pReq);
typedef SMDropXnodeTaskReq SMDropXnodeAgentReq;
int32_t tSerializeSMDropXnodeAgentReq(void* buf, int32_t bufLen, SMDropXnodeAgentReq* pReq);
int32_t tDeserializeSMDropXnodeAgentReq(void* buf, int32_t bufLen, SMDropXnodeAgentReq* pReq);
void tFreeSMDropXnodeAgentReq(SMDropXnodeAgentReq* pReq);
typedef struct {
int32_t vgId;
int32_t hbSeq;
} SVArbHbReqMember;
typedef struct {
int32_t dnodeId;
char* arbToken;
int64_t arbTerm;
SArray* hbMembers; // SVArbHbReqMember
} SVArbHeartBeatReq;
int32_t tSerializeSVArbHeartBeatReq(void* buf, int32_t bufLen, SVArbHeartBeatReq* pReq);
int32_t tDeserializeSVArbHeartBeatReq(void* buf, int32_t bufLen, SVArbHeartBeatReq* pReq);
void tFreeSVArbHeartBeatReq(SVArbHeartBeatReq* pReq);
typedef struct {
int32_t vgId;
char memberToken[TSDB_ARB_TOKEN_SIZE];
int32_t hbSeq;
} SVArbHbRspMember;
typedef struct {
char arbToken[TSDB_ARB_TOKEN_SIZE];
int32_t dnodeId;
SArray* hbMembers; // SVArbHbRspMember
} SVArbHeartBeatRsp;
int32_t tSerializeSVArbHeartBeatRsp(void* buf, int32_t bufLen, SVArbHeartBeatRsp* pRsp);
int32_t tDeserializeSVArbHeartBeatRsp(void* buf, int32_t bufLen, SVArbHeartBeatRsp* pRsp);
void tFreeSVArbHeartBeatRsp(SVArbHeartBeatRsp* pRsp);
typedef struct {
2024-05-30 11:41:22 +00:00
char* arbToken;
int64_t arbTerm;
2024-05-30 11:41:22 +00:00
char* member0Token;
char* member1Token;
} SVArbCheckSyncReq;
int32_t tSerializeSVArbCheckSyncReq(void* buf, int32_t bufLen, SVArbCheckSyncReq* pReq);
int32_t tDeserializeSVArbCheckSyncReq(void* buf, int32_t bufLen, SVArbCheckSyncReq* pReq);
void tFreeSVArbCheckSyncReq(SVArbCheckSyncReq* pRsp);
typedef struct {
char* arbToken;
char* member0Token;
char* member1Token;
int32_t vgId;
int32_t errCode;
} SVArbCheckSyncRsp;
int32_t tSerializeSVArbCheckSyncRsp(void* buf, int32_t bufLen, SVArbCheckSyncRsp* pRsp);
int32_t tDeserializeSVArbCheckSyncRsp(void* buf, int32_t bufLen, SVArbCheckSyncRsp* pRsp);
void tFreeSVArbCheckSyncRsp(SVArbCheckSyncRsp* pRsp);
typedef struct {
2024-05-30 11:41:22 +00:00
char* arbToken;
int64_t arbTerm;
char* memberToken;
2025-01-24 08:50:04 +00:00
int8_t force;
} SVArbSetAssignedLeaderReq;
int32_t tSerializeSVArbSetAssignedLeaderReq(void* buf, int32_t bufLen, SVArbSetAssignedLeaderReq* pReq);
int32_t tDeserializeSVArbSetAssignedLeaderReq(void* buf, int32_t bufLen, SVArbSetAssignedLeaderReq* pReq);
void tFreeSVArbSetAssignedLeaderReq(SVArbSetAssignedLeaderReq* pReq);
typedef struct {
char* data;
} SVAuditRecordReq;
int32_t tSerializeSVAuditRecordReq(void* buf, int32_t bufLen, SVAuditRecordReq* pReq);
int32_t tDeserializeSVAuditRecordReq(void* buf, int32_t bufLen, SVAuditRecordReq* pReq);
void tFreeSVAuditRecordReq(SVAuditRecordReq* pReq);
typedef struct {
char* arbToken;
char* memberToken;
int32_t vgId;
} SVArbSetAssignedLeaderRsp;
int32_t tSerializeSVArbSetAssignedLeaderRsp(void* buf, int32_t bufLen, SVArbSetAssignedLeaderRsp* pRsp);
int32_t tDeserializeSVArbSetAssignedLeaderRsp(void* buf, int32_t bufLen, SVArbSetAssignedLeaderRsp* pRsp);
void tFreeSVArbSetAssignedLeaderRsp(SVArbSetAssignedLeaderRsp* pRsp);
typedef struct {
int32_t dnodeId;
char* token;
2024-05-21 09:10:57 +00:00
} SMArbUpdateGroupMember;
typedef struct {
int32_t dnodeId;
char* token;
int8_t acked;
} SMArbUpdateGroupAssigned;
typedef struct {
int32_t vgId;
int64_t dbUid;
SMArbUpdateGroupMember members[2];
int8_t isSync;
int8_t assignedAcked;
SMArbUpdateGroupAssigned assignedLeader;
int64_t version;
2024-12-25 02:10:21 +00:00
int32_t code;
int64_t updateTimeMs;
2024-05-21 09:10:57 +00:00
} SMArbUpdateGroup;
typedef struct {
SArray* updateArray; // SMArbUpdateGroup
} SMArbUpdateGroupBatchReq;
2024-05-21 09:10:57 +00:00
int32_t tSerializeSMArbUpdateGroupBatchReq(void* buf, int32_t bufLen, SMArbUpdateGroupBatchReq* pReq);
int32_t tDeserializeSMArbUpdateGroupBatchReq(void* buf, int32_t bufLen, SMArbUpdateGroupBatchReq* pReq);
void tFreeSMArbUpdateGroupBatchReq(SMArbUpdateGroupBatchReq* pReq);
2021-12-05 15:28:11 +00:00
typedef struct {
2022-06-20 07:42:31 +00:00
char queryStrId[TSDB_QUERY_ID_LEN];
2022-01-06 08:13:49 +00:00
} SKillQueryReq;
2021-12-05 15:28:11 +00:00
2022-02-16 07:44:20 +00:00
int32_t tSerializeSKillQueryReq(void* buf, int32_t bufLen, SKillQueryReq* pReq);
int32_t tDeserializeSKillQueryReq(void* buf, int32_t bufLen, SKillQueryReq* pReq);
2021-12-05 15:28:11 +00:00
typedef struct {
2022-06-17 07:26:45 +00:00
uint32_t connId;
2022-01-06 08:13:49 +00:00
} SKillConnReq;
2021-10-08 05:53:49 +00:00
2022-02-16 07:44:20 +00:00
int32_t tSerializeSKillConnReq(void* buf, int32_t bufLen, SKillConnReq* pReq);
int32_t tDeserializeSKillConnReq(void* buf, int32_t bufLen, SKillConnReq* pReq);
2022-02-17 16:26:43 +00:00
typedef struct {
int32_t transId;
} SKillTransReq;
int32_t tSerializeSKillTransReq(void* buf, int32_t bufLen, SKillTransReq* pReq);
int32_t tDeserializeSKillTransReq(void* buf, int32_t bufLen, SKillTransReq* pReq);
2022-06-07 03:53:32 +00:00
typedef struct {
int32_t useless; // useless
2023-09-06 03:00:24 +00:00
int32_t sqlLen;
char* sql;
2022-06-07 03:53:32 +00:00
} SBalanceVgroupReq;
int32_t tSerializeSBalanceVgroupReq(void* buf, int32_t bufLen, SBalanceVgroupReq* pReq);
int32_t tDeserializeSBalanceVgroupReq(void* buf, int32_t bufLen, SBalanceVgroupReq* pReq);
2023-12-01 07:15:12 +00:00
void tFreeSBalanceVgroupReq(SBalanceVgroupReq* pReq);
2022-06-07 03:53:32 +00:00
2025-01-23 09:37:07 +00:00
typedef struct {
int32_t useless; // useless
int32_t sqlLen;
char* sql;
} SAssignLeaderReq;
int32_t tSerializeSAssignLeaderReq(void* buf, int32_t bufLen, SAssignLeaderReq* pReq);
int32_t tDeserializeSAssignLeaderReq(void* buf, int32_t bufLen, SAssignLeaderReq* pReq);
void tFreeSAssignLeaderReq(SAssignLeaderReq* pReq);
2022-06-07 03:53:32 +00:00
typedef struct {
int32_t vgId1;
int32_t vgId2;
} SMergeVgroupReq;
int32_t tSerializeSMergeVgroupReq(void* buf, int32_t bufLen, SMergeVgroupReq* pReq);
int32_t tDeserializeSMergeVgroupReq(void* buf, int32_t bufLen, SMergeVgroupReq* pReq);
typedef struct {
int32_t vgId;
int32_t dnodeId1;
int32_t dnodeId2;
int32_t dnodeId3;
2023-09-06 03:00:24 +00:00
int32_t sqlLen;
char* sql;
2022-06-07 03:53:32 +00:00
} SRedistributeVgroupReq;
int32_t tSerializeSRedistributeVgroupReq(void* buf, int32_t bufLen, SRedistributeVgroupReq* pReq);
int32_t tDeserializeSRedistributeVgroupReq(void* buf, int32_t bufLen, SRedistributeVgroupReq* pReq);
2023-12-01 07:15:12 +00:00
void tFreeSRedistributeVgroupReq(SRedistributeVgroupReq* pReq);
2022-06-07 03:53:32 +00:00
2023-03-22 01:36:59 +00:00
typedef struct {
2024-05-13 08:20:27 +00:00
int32_t reserved;
2023-10-08 08:16:33 +00:00
int32_t vgId;
2023-09-06 03:00:24 +00:00
int32_t sqlLen;
char* sql;
2024-05-13 08:20:27 +00:00
char db[TSDB_DB_FNAME_LEN];
2023-03-22 01:36:59 +00:00
} SBalanceVgroupLeaderReq;
int32_t tSerializeSBalanceVgroupLeaderReq(void* buf, int32_t bufLen, SBalanceVgroupLeaderReq* pReq);
int32_t tDeserializeSBalanceVgroupLeaderReq(void* buf, int32_t bufLen, SBalanceVgroupLeaderReq* pReq);
2023-12-01 07:15:12 +00:00
void tFreeSBalanceVgroupLeaderReq(SBalanceVgroupLeaderReq* pReq);
2023-03-22 01:36:59 +00:00
typedef struct {
int32_t vgId;
2023-03-24 01:13:20 +00:00
} SForceBecomeFollowerReq;
2023-03-22 01:36:59 +00:00
2023-03-24 01:13:20 +00:00
int32_t tSerializeSForceBecomeFollowerReq(void* buf, int32_t bufLen, SForceBecomeFollowerReq* pReq);
2024-02-26 08:56:29 +00:00
// int32_t tDeserializeSForceBecomeFollowerReq(void* buf, int32_t bufLen, SForceBecomeFollowerReq* pReq);
2023-03-22 01:36:59 +00:00
typedef struct {
int32_t vgId;
2025-06-06 01:09:40 +00:00
bool force;
} SSplitVgroupReq;
int32_t tSerializeSSplitVgroupReq(void* buf, int32_t bufLen, SSplitVgroupReq* pReq);
int32_t tDeserializeSSplitVgroupReq(void* buf, int32_t bufLen, SSplitVgroupReq* pReq);
2021-10-08 05:53:49 +00:00
typedef struct {
char user[TSDB_USER_LEN];
char spi;
char encrypt;
char secret[TSDB_PASSWORD_LEN];
char ckey[TSDB_PASSWORD_LEN];
2022-01-06 12:17:25 +00:00
} SAuthReq, SAuthRsp;
2021-10-08 05:53:49 +00:00
2024-02-26 08:28:10 +00:00
// int32_t tSerializeSAuthReq(void* buf, int32_t bufLen, SAuthReq* pReq);
// int32_t tDeserializeSAuthReq(void* buf, int32_t bufLen, SAuthReq* pReq);
2022-02-16 08:36:05 +00:00
2021-10-08 05:53:49 +00:00
typedef struct {
2022-04-19 06:23:02 +00:00
int32_t statusCode;
2022-04-19 13:39:42 +00:00
char details[1024];
2022-04-19 06:23:02 +00:00
} SServerStatusRsp;
int32_t tSerializeSServerStatusRsp(void* buf, int32_t bufLen, SServerStatusRsp* pRsp);
int32_t tDeserializeSServerStatusRsp(void* buf, int32_t bufLen, SServerStatusRsp* pRsp);
2021-10-08 05:53:49 +00:00
/**
* The layout of the query message payload is as following:
* +--------------------+---------------------------------+
* |Sql statement | Physical plan |
* |(denoted by sqlLen) |(In JSON, denoted by contentLen) |
* +--------------------+---------------------------------+
*/
2022-01-19 09:35:06 +00:00
typedef struct SSubQueryMsg {
2021-12-31 05:34:38 +00:00
SMsgHead header;
2021-12-27 10:42:33 +00:00
uint64_t sId;
2021-12-24 07:00:51 +00:00
uint64_t queryId;
uint64_t clientId;
2021-12-24 07:00:51 +00:00
uint64_t taskId;
2022-03-09 08:13:46 +00:00
int64_t refId;
2022-06-30 03:04:49 +00:00
int32_t execId;
2022-11-17 10:04:57 +00:00
int32_t msgMask;
int32_t subQType;
2022-01-20 11:34:46 +00:00
int8_t taskType;
2022-04-01 11:45:45 +00:00
int8_t explain;
2022-07-06 08:29:51 +00:00
int8_t needFetch;
int8_t compress;
2022-11-17 10:04:57 +00:00
uint32_t sqlLen;
2022-11-29 15:39:58 +00:00
char* sql;
2022-11-17 10:04:57 +00:00
uint32_t msgLen;
2022-11-29 15:39:58 +00:00
char* msg;
SArray* subEndPoints; // subJobs's endpoints, element is SDownstreamSourceNode*
2021-12-23 09:42:40 +00:00
} SSubQueryMsg;
2021-12-19 08:27:50 +00:00
2022-11-29 15:39:58 +00:00
int32_t tSerializeSSubQueryMsg(void* buf, int32_t bufLen, SSubQueryMsg* pReq);
int32_t tDeserializeSSubQueryMsg(void* buf, int32_t bufLen, SSubQueryMsg* pReq);
void tFreeSSubQueryMsg(SSubQueryMsg* pReq);
2022-11-17 10:04:57 +00:00
typedef struct {
SMsgHead header;
uint64_t sId;
uint64_t queryId;
uint64_t taskId;
} SSinkDataReq;
2022-01-12 10:40:22 +00:00
typedef struct {
SMsgHead header;
uint64_t sId;
uint64_t queryId;
uint64_t clientId;
2022-01-12 10:40:22 +00:00
uint64_t taskId;
2022-06-30 03:04:49 +00:00
int32_t execId;
int32_t taskType;
2022-01-12 10:40:22 +00:00
} SQueryContinueReq;
2022-01-10 12:44:11 +00:00
typedef struct {
2021-12-31 05:34:38 +00:00
SMsgHead header;
2021-12-27 10:42:33 +00:00
uint64_t sId;
2021-12-24 07:00:51 +00:00
uint64_t queryId;
uint64_t taskId;
2022-01-10 12:44:11 +00:00
} SResReadyReq;
2021-12-19 08:27:50 +00:00
2022-01-10 12:44:11 +00:00
typedef struct {
2021-12-24 01:41:09 +00:00
int32_t code;
2022-05-21 08:24:41 +00:00
char tbFName[TSDB_TABLE_FNAME_LEN];
int32_t sversion;
int32_t tversion;
2021-12-24 01:41:09 +00:00
} SResReadyRsp;
typedef enum { OP_GET_PARAM = 1, OP_NOTIFY_PARAM } SOperatorParamType;
2023-09-01 05:24:47 +00:00
typedef struct SOperatorParam {
2023-09-01 07:11:25 +00:00
int32_t opType;
int32_t downstreamIdx;
void* value;
SArray* pChildren; // SArray<SOperatorParam*>
bool reUse;
2023-09-01 05:24:47 +00:00
} SOperatorParam;
void freeOperatorParam(SOperatorParam* pParam, SOperatorParamType type);
// virtual table's colId to origin table's colname
typedef struct SColIdNameKV {
col_id_t colId;
char colName[TSDB_COL_NAME_LEN];
} SColIdNameKV;
2025-12-29 11:27:11 +00:00
#define COL_MASK_ON ((int8_t)0x1)
#define IS_MASK_ON(c) (((c)->flags & 0x01) == COL_MASK_ON)
#define COL_SET_MASK_ON(c) \
do { \
(c)->flags |= COL_MASK_ON; \
} while (0)
typedef struct SColNameFlag {
col_id_t colId;
char colName[TSDB_COL_NAME_LEN];
int8_t flags; // 0x01: COL_MASK_ON
} SColNameFlag;
typedef struct SColIdPair {
col_id_t vtbColId;
col_id_t orgColId;
SDataType type;
} SColIdPair;
typedef struct SColIdSlotIdPair {
int32_t vtbSlotId;
col_id_t orgColId;
} SColIdSlotIdPair;
typedef struct SOrgTbInfo {
int32_t vgId;
char tbName[TSDB_TABLE_FNAME_LEN];
SArray* colMap; // SArray<SColIdNameKV>
} SOrgTbInfo;
void destroySOrgTbInfo(void *info);
typedef enum {
DYN_TYPE_STB_JOIN = 1,
DYN_TYPE_VSTB_SINGLE_SCAN,
DYN_TYPE_VSTB_BATCH_SCAN,
DYN_TYPE_VSTB_WIN_SCAN,
} ETableScanDynType;
typedef enum {
DYN_TYPE_SCAN_PARAM = 1,
NOTIFY_TYPE_SCAN_PARAM,
} ETableScanGetParamType;
2023-09-01 05:24:47 +00:00
typedef struct STableScanOperatorParam {
ETableScanGetParamType paramType;
/* for building scan data source */
bool tableSeq;
bool isNewParam;
uint64_t groupid;
SArray* pUidList;
SOrgTbInfo* pOrgTbInfo;
SArray* pBatchTbInfo; // SArray<SOrgTbInfo>
SArray* pTagList;
STimeWindow window;
ETableScanDynType dynType;
/* for notifying source step done */
bool notifyToProcess; // received notify STEP DONE message
TSKEY notifyTs; // notify timestamp
2023-09-01 05:24:47 +00:00
} STableScanOperatorParam;
typedef struct STagScanOperatorParam {
2025-12-15 08:48:20 +00:00
tb_uid_t vcUid;
} STagScanOperatorParam;
typedef struct SRefColIdGroup {
SArray* pSlotIdList; // SArray<int32_t>
} SRefColIdGroup;
typedef struct SVTableScanOperatorParam {
uint64_t uid;
STimeWindow window;
SOperatorParam* pTagScanOp;
SArray* pOpParamArray; // SArray<SOperatorParam>
SArray* pRefColGroups; // SArray<SRefColIdGroup>
} SVTableScanOperatorParam;
typedef struct SMergeOperatorParam {
int32_t winNum;
} SMergeOperatorParam;
typedef struct SAggOperatorParam {
bool needCleanRes;
} SAggOperatorParam;
typedef struct SExternalWindowOperatorParam {
SArray* ExtWins; // SArray<SExtWinTimeWindow>
} SExternalWindowOperatorParam;
typedef struct SDynQueryCtrlOperatorParam {
STimeWindow window;
} SDynQueryCtrlOperatorParam;
2025-04-29 07:31:17 +00:00
struct SStreamRuntimeFuncInfo;
typedef struct {
2025-12-15 08:48:20 +00:00
SMsgHead header;
uint64_t sId;
uint64_t queryId;
uint64_t clientId;
uint64_t taskId;
uint64_t srcTaskId; // used for subQ
uint64_t blockIdx; // used for subQ
2025-12-15 08:48:20 +00:00
int32_t execId;
SOperatorParam* pOpParam;
2025-04-29 07:31:17 +00:00
// used for new-stream
struct SStreamRuntimeFuncInfo* pStRtFuncInfo;
bool reset;
2025-06-05 09:26:09 +00:00
bool dynTbname;
2025-04-29 07:31:17 +00:00
// used for new-stream
2022-01-10 12:44:11 +00:00
} SResFetchReq;
2021-12-19 08:27:50 +00:00
int32_t tSerializeSResFetchReq(void* buf, int32_t bufLen, SResFetchReq* pReq, bool needStreamRtInfo, bool needStreamGrpInfo);
2022-11-29 15:39:58 +00:00
int32_t tDeserializeSResFetchReq(void* buf, int32_t bufLen, SResFetchReq* pReq);
void tDestroySResFetchReq(SResFetchReq* pReq);
2022-01-10 12:44:11 +00:00
typedef struct {
2021-12-31 11:31:35 +00:00
SMsgHead header;
2024-11-13 11:19:00 +00:00
uint64_t clientId;
2022-01-10 12:44:11 +00:00
} SSchTasksStatusReq;
2021-12-20 10:48:15 +00:00
2022-01-10 12:44:11 +00:00
typedef struct {
2021-12-24 07:00:51 +00:00
uint64_t queryId;
uint64_t clientId;
2021-12-24 07:00:51 +00:00
uint64_t taskId;
2022-03-09 08:13:46 +00:00
int64_t refId;
int32_t subJobId;
2022-06-30 03:04:49 +00:00
int32_t execId;
2021-12-24 07:00:51 +00:00
int8_t status;
2021-12-21 10:28:28 +00:00
} STaskStatus;
2022-01-10 12:44:11 +00:00
typedef struct {
2022-03-16 10:29:31 +00:00
int64_t refId;
SArray* taskStatus; // SArray<STaskStatus>
2021-12-21 10:28:28 +00:00
} SSchedulerStatusRsp;
2022-03-09 08:13:46 +00:00
typedef struct {
uint64_t queryId;
uint64_t taskId;
int8_t action;
} STaskAction;
typedef struct SQueryNodeEpId {
int32_t nodeId; // vgId or qnodeId
SEp ep;
} SQueryNodeEpId;
typedef struct {
SMsgHead header;
2024-11-13 11:19:00 +00:00
uint64_t clientId;
2022-03-09 08:13:46 +00:00
SQueryNodeEpId epId;
2022-03-16 10:29:31 +00:00
SArray* taskAction; // SArray<STaskAction>
2022-03-09 08:13:46 +00:00
} SSchedulerHbReq;
2022-03-16 10:29:31 +00:00
int32_t tSerializeSSchedulerHbReq(void* buf, int32_t bufLen, SSchedulerHbReq* pReq);
int32_t tDeserializeSSchedulerHbReq(void* buf, int32_t bufLen, SSchedulerHbReq* pReq);
void tFreeSSchedulerHbReq(SSchedulerHbReq* pReq);
2022-03-09 08:13:46 +00:00
typedef struct {
SQueryNodeEpId epId;
2022-03-16 10:29:31 +00:00
SArray* taskStatus; // SArray<STaskStatus>
2022-03-09 08:13:46 +00:00
} SSchedulerHbRsp;
2022-03-16 10:29:31 +00:00
int32_t tSerializeSSchedulerHbRsp(void* buf, int32_t bufLen, SSchedulerHbRsp* pRsp);
int32_t tDeserializeSSchedulerHbRsp(void* buf, int32_t bufLen, SSchedulerHbRsp* pRsp);
void tFreeSSchedulerHbRsp(SSchedulerHbRsp* pRsp);
2022-03-09 08:13:46 +00:00
2022-01-10 12:44:11 +00:00
typedef struct {
2021-12-31 11:31:35 +00:00
SMsgHead header;
2021-12-27 10:42:33 +00:00
uint64_t sId;
2021-12-24 07:00:51 +00:00
uint64_t queryId;
uint64_t clientId;
2021-12-24 07:00:51 +00:00
uint64_t taskId;
2022-03-09 08:13:46 +00:00
int64_t refId;
2022-06-30 05:44:26 +00:00
int32_t execId;
2022-01-10 12:44:11 +00:00
} STaskCancelReq;
2021-12-23 09:42:40 +00:00
2022-01-10 12:44:11 +00:00
typedef struct {
2021-12-24 01:41:09 +00:00
int32_t code;
} STaskCancelRsp;
2022-01-10 12:44:11 +00:00
typedef struct {
2021-12-31 11:31:35 +00:00
SMsgHead header;
2021-12-27 10:42:33 +00:00
uint64_t sId;
2021-12-24 07:00:51 +00:00
uint64_t queryId;
uint64_t clientId;
2021-12-24 07:00:51 +00:00
uint64_t taskId;
2022-03-09 08:13:46 +00:00
int64_t refId;
2022-06-30 03:04:49 +00:00
int32_t execId;
2022-01-10 12:44:11 +00:00
} STaskDropReq;
2021-12-21 10:28:28 +00:00
int32_t tSerializeSTaskDropReq(void* buf, int32_t bufLen, STaskDropReq* pReq);
int32_t tDeserializeSTaskDropReq(void* buf, int32_t bufLen, STaskDropReq* pReq);
2023-09-01 05:24:47 +00:00
typedef enum {
TASK_NOTIFY_FINISHED = 1,
} ETaskNotifyType;
typedef struct {
SMsgHead header;
uint64_t sId;
uint64_t queryId;
uint64_t clientId;
2023-09-01 05:24:47 +00:00
uint64_t taskId;
int64_t refId;
int32_t execId;
ETaskNotifyType type;
} STaskNotifyReq;
int32_t tSerializeSTaskNotifyReq(void* buf, int32_t bufLen, STaskNotifyReq* pReq);
int32_t tDeserializeSTaskNotifyReq(void* buf, int32_t bufLen, STaskNotifyReq* pReq);
2022-11-18 03:43:03 +00:00
2022-11-29 15:39:58 +00:00
int32_t tSerializeSQueryTableRsp(void* buf, int32_t bufLen, SQueryTableRsp* pRsp);
int32_t tDeserializeSQueryTableRsp(void* buf, int32_t bufLen, SQueryTableRsp* pRsp);
2022-11-17 10:04:57 +00:00
2022-01-10 12:44:11 +00:00
typedef struct {
2021-12-24 01:41:09 +00:00
int32_t code;
} STaskDropRsp;
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
#define STREAM_TRIGGER_AT_ONCE 1
#define STREAM_TRIGGER_WINDOW_CLOSE 2
#define STREAM_TRIGGER_MAX_DELAY 3
#define STREAM_TRIGGER_FORCE_WINDOW_CLOSE 4
#define STREAM_TRIGGER_CONTINUOUS_WINDOW_CLOSE 5
2024-08-06 08:14:15 +00:00
2023-02-28 06:19:21 +00:00
#define STREAM_DEFAULT_IGNORE_EXPIRED 1
#define STREAM_FILL_HISTORY_ON 1
#define STREAM_FILL_HISTORY_OFF 0
#define STREAM_DEFAULT_FILL_HISTORY STREAM_FILL_HISTORY_OFF
2023-04-24 07:01:56 +00:00
#define STREAM_DEFAULT_IGNORE_UPDATE 1
#define STREAM_CREATE_STABLE_TRUE 1
#define STREAM_CREATE_STABLE_FALSE 0
2022-04-16 05:15:14 +00:00
typedef struct SVgroupVer {
int32_t vgId;
int64_t ver;
} SVgroupVer;
2022-05-27 05:58:58 +00:00
enum {
TOPIC_SUB_TYPE__DB = 1,
TOPIC_SUB_TYPE__TABLE,
TOPIC_SUB_TYPE__COLUMN,
};
2025-02-18 09:32:00 +00:00
#define DEFAULT_MAX_POLL_INTERVAL 300000
#define DEFAULT_SESSION_TIMEOUT 12000
2025-02-19 03:12:13 +00:00
#define DEFAULT_MAX_POLL_WAIT_TIME 1000
#define DEFAULT_MIN_POLL_ROWS 4096
2022-03-10 09:15:45 +00:00
typedef struct {
2022-04-24 05:42:54 +00:00
char name[TSDB_TOPIC_FNAME_LEN]; // accout.topic
int8_t igExists;
2022-05-27 05:58:58 +00:00
int8_t subType;
2022-06-21 05:50:33 +00:00
int8_t withMeta;
2022-04-24 05:42:54 +00:00
char* sql;
2022-05-31 08:25:24 +00:00
char subDbName[TSDB_DB_FNAME_LEN];
char* ast;
char subStbName[TSDB_TABLE_FNAME_LEN];
int8_t reload;
2022-03-10 09:15:45 +00:00
} SCMCreateTopicReq;
int32_t tSerializeSCMCreateTopicReq(void* buf, int32_t bufLen, const SCMCreateTopicReq* pReq);
int32_t tDeserializeSCMCreateTopicReq(void* buf, int32_t bufLen, SCMCreateTopicReq* pReq);
void tFreeSCMCreateTopicReq(SCMCreateTopicReq* pReq);
2021-12-29 09:53:43 +00:00
typedef struct {
int64_t consumerId;
2023-10-08 08:06:15 +00:00
} SMqConsumerRecoverMsg, SMqConsumerClearMsg;
2021-12-29 09:53:43 +00:00
typedef struct {
2023-03-05 03:36:01 +00:00
int64_t consumerId;
char cgroup[TSDB_CGROUP_LEN];
char clientId[TSDB_CLIENT_ID_LEN];
char user[TSDB_USER_LEN];
char fqdn[TSDB_FQDN_LEN];
2023-03-05 03:36:01 +00:00
SArray* topicNames; // SArray<char**>
2023-09-01 07:11:25 +00:00
int8_t withTbName;
int8_t autoCommit;
int32_t autoCommitInterval;
int8_t resetOffsetCfg;
2023-10-08 08:06:15 +00:00
int8_t enableReplay;
2024-05-28 10:34:37 +00:00
int8_t enableBatchMeta;
int32_t sessionTimeoutMs;
int32_t maxPollIntervalMs;
2026-01-28 11:06:16 +00:00
int64_t ownerId;
2021-12-29 09:53:43 +00:00
} SCMSubscribeReq;
2022-02-28 09:39:07 +00:00
static FORCE_INLINE int32_t tSerializeSCMSubscribeReq(void** buf, const SCMSubscribeReq* pReq) {
int32_t tlen = 0;
2021-12-29 09:53:43 +00:00
tlen += taosEncodeFixedI64(buf, pReq->consumerId);
tlen += taosEncodeString(buf, pReq->cgroup);
2022-05-19 03:20:47 +00:00
tlen += taosEncodeString(buf, pReq->clientId);
2022-01-06 10:17:08 +00:00
2022-04-25 02:42:17 +00:00
int32_t topicNum = taosArrayGetSize(pReq->topicNames);
tlen += taosEncodeFixedI32(buf, topicNum);
for (int32_t i = 0; i < topicNum; i++) {
2022-01-06 10:17:08 +00:00
tlen += taosEncodeString(buf, (char*)taosArrayGetP(pReq->topicNames, i));
2022-01-04 02:40:34 +00:00
}
tlen += taosEncodeFixedI8(buf, pReq->withTbName);
tlen += taosEncodeFixedI8(buf, pReq->autoCommit);
tlen += taosEncodeFixedI32(buf, pReq->autoCommitInterval);
tlen += taosEncodeFixedI8(buf, pReq->resetOffsetCfg);
2023-10-08 08:06:15 +00:00
tlen += taosEncodeFixedI8(buf, pReq->enableReplay);
2024-05-28 10:34:37 +00:00
tlen += taosEncodeFixedI8(buf, pReq->enableBatchMeta);
tlen += taosEncodeFixedI32(buf, pReq->sessionTimeoutMs);
tlen += taosEncodeFixedI32(buf, pReq->maxPollIntervalMs);
tlen += taosEncodeString(buf, pReq->user);
tlen += taosEncodeString(buf, pReq->fqdn);
2021-12-29 09:53:43 +00:00
return tlen;
}
static FORCE_INLINE int32_t tDeserializeSCMSubscribeReq(void* buf, SCMSubscribeReq* pReq, int32_t len) {
void* start = buf;
2021-12-29 09:53:43 +00:00
buf = taosDecodeFixedI64(buf, &pReq->consumerId);
buf = taosDecodeStringTo(buf, pReq->cgroup);
2022-05-19 03:20:47 +00:00
buf = taosDecodeStringTo(buf, pReq->clientId);
2022-04-25 02:42:17 +00:00
int32_t topicNum = 0;
2022-04-25 02:42:17 +00:00
buf = taosDecodeFixedI32(buf, &topicNum);
pReq->topicNames = taosArrayInit(topicNum, sizeof(void*));
2024-07-25 00:51:19 +00:00
if (pReq->topicNames == NULL) {
2024-07-26 13:39:27 +00:00
return terrno;
}
2022-04-25 02:42:17 +00:00
for (int32_t i = 0; i < topicNum; i++) {
char* name = NULL;
2022-01-06 10:17:08 +00:00
buf = taosDecodeString(buf, &name);
2024-07-25 00:51:19 +00:00
if (taosArrayPush(pReq->topicNames, &name) == NULL) {
2024-07-26 13:39:27 +00:00
return terrno;
}
2022-01-04 02:40:34 +00:00
}
buf = taosDecodeFixedI8(buf, &pReq->withTbName);
buf = taosDecodeFixedI8(buf, &pReq->autoCommit);
buf = taosDecodeFixedI32(buf, &pReq->autoCommitInterval);
buf = taosDecodeFixedI8(buf, &pReq->resetOffsetCfg);
2023-10-08 08:06:15 +00:00
buf = taosDecodeFixedI8(buf, &pReq->enableReplay);
2024-05-28 10:34:37 +00:00
buf = taosDecodeFixedI8(buf, &pReq->enableBatchMeta);
if ((char*)buf - (char*)start < len) {
buf = taosDecodeFixedI32(buf, &pReq->sessionTimeoutMs);
buf = taosDecodeFixedI32(buf, &pReq->maxPollIntervalMs);
buf = taosDecodeStringTo(buf, pReq->user);
buf = taosDecodeStringTo(buf, pReq->fqdn);
} else {
pReq->sessionTimeoutMs = DEFAULT_SESSION_TIMEOUT;
pReq->maxPollIntervalMs = DEFAULT_MAX_POLL_INTERVAL;
}
return 0;
2022-01-04 02:40:34 +00:00
}
2022-02-10 03:22:50 +00:00
typedef struct {
char key[TSDB_SUBSCRIBE_KEY_LEN];
SArray* removedConsumers; // SArray<int64_t>
SArray* newConsumers; // SArray<int64_t>
2022-04-29 13:01:13 +00:00
} SMqRebInfo;
2022-02-11 08:24:38 +00:00
2022-04-29 13:01:13 +00:00
static FORCE_INLINE SMqRebInfo* tNewSMqRebSubscribe(const char* key) {
SMqRebInfo* pRebInfo = (SMqRebInfo*)taosMemoryCalloc(1, sizeof(SMqRebInfo));
if (pRebInfo == NULL) {
2022-05-10 09:12:11 +00:00
return NULL;
2022-02-11 08:24:38 +00:00
}
2022-10-17 08:28:55 +00:00
tstrncpy(pRebInfo->key, key, TSDB_SUBSCRIBE_KEY_LEN);
2022-04-29 13:01:13 +00:00
pRebInfo->removedConsumers = taosArrayInit(0, sizeof(int64_t));
if (pRebInfo->removedConsumers == NULL) {
2022-02-11 08:24:38 +00:00
goto _err;
}
2022-04-29 13:01:13 +00:00
pRebInfo->newConsumers = taosArrayInit(0, sizeof(int64_t));
if (pRebInfo->newConsumers == NULL) {
2022-02-11 08:24:38 +00:00
goto _err;
}
2022-04-29 13:01:13 +00:00
return pRebInfo;
2022-02-11 08:24:38 +00:00
_err:
2022-04-29 13:01:13 +00:00
taosArrayDestroy(pRebInfo->removedConsumers);
taosArrayDestroy(pRebInfo->newConsumers);
taosMemoryFreeClear(pRebInfo);
2022-02-11 08:24:38 +00:00
return NULL;
}
typedef struct {
int64_t streamId;
int64_t checkpointId;
char streamName[TSDB_STREAM_FNAME_LEN];
} SMStreamDoCheckpointMsg;
2021-12-29 09:53:43 +00:00
typedef struct {
2022-01-04 02:40:34 +00:00
int64_t status;
2021-12-29 09:53:43 +00:00
} SMVSubscribeRsp;
2021-12-23 12:28:08 +00:00
typedef struct {
2023-12-01 07:15:12 +00:00
char name[TSDB_TOPIC_FNAME_LEN];
int8_t igNotExists;
2023-09-06 03:00:24 +00:00
int32_t sqlLen;
char* sql;
int8_t force;
2022-02-16 02:25:14 +00:00
} SMDropTopicReq;
2022-02-16 12:18:18 +00:00
int32_t tSerializeSMDropTopicReq(void* buf, int32_t bufLen, SMDropTopicReq* pReq);
2022-02-16 02:25:14 +00:00
int32_t tDeserializeSMDropTopicReq(void* buf, int32_t bufLen, SMDropTopicReq* pReq);
2023-12-01 07:15:12 +00:00
void tFreeSMDropTopicReq(SMDropTopicReq* pReq);
2021-12-23 12:28:08 +00:00
typedef struct {
char name[TSDB_TOPIC_FNAME_LEN];
int8_t igNotExists;
int32_t sqlLen;
char* sql;
} SMReloadTopicReq;
int32_t tSerializeSMReloadTopicReq(void* buf, int32_t bufLen, SMReloadTopicReq* pReq);
int32_t tDeserializeSMReloadTopicReq(void* buf, int32_t bufLen, SMReloadTopicReq* pReq);
void tFreeSMReloadTopicReq(SMReloadTopicReq* pReq);
typedef struct {
char topic[TSDB_TOPIC_FNAME_LEN];
char cgroup[TSDB_CGROUP_LEN];
int8_t igNotExists;
int8_t force;
} SMDropCgroupReq;
int32_t tSerializeSMDropCgroupReq(void* buf, int32_t bufLen, SMDropCgroupReq* pReq);
int32_t tDeserializeSMDropCgroupReq(void* buf, int32_t bufLen, SMDropCgroupReq* pReq);
2022-05-27 02:24:40 +00:00
typedef struct {
int8_t reserved;
} SMDropCgroupRsp;
2021-12-23 12:28:08 +00:00
typedef struct {
char name[TSDB_TABLE_FNAME_LEN];
int8_t alterType;
SSchema schema;
2022-01-10 12:44:11 +00:00
} SAlterTopicReq;
2021-12-23 12:28:08 +00:00
typedef struct {
SMsgHead head;
char name[TSDB_TABLE_FNAME_LEN];
2022-02-23 08:04:06 +00:00
int64_t tuid;
2021-12-23 12:28:08 +00:00
int32_t sverson;
int32_t execLen;
char* executor;
int32_t sqlLen;
char* sql;
2022-01-10 12:44:11 +00:00
} SDCreateTopicReq;
2021-12-23 12:28:08 +00:00
typedef struct {
SMsgHead head;
char name[TSDB_TABLE_FNAME_LEN];
2022-02-23 08:04:06 +00:00
int64_t tuid;
2022-01-10 12:44:11 +00:00
} SDDropTopicReq;
2021-11-04 01:28:55 +00:00
2022-03-22 23:58:07 +00:00
typedef struct {
2025-09-26 09:32:32 +00:00
char* name;
int64_t uid;
int64_t interval[2];
int8_t intervalUnit;
int16_t nFuncs;
col_id_t* funcColIds; // column ids specified by user
func_id_t* funcIds; // function ids specified by user
2022-03-22 23:58:07 +00:00
} SRSmaParam;
2022-05-07 10:03:06 +00:00
int32_t tEncodeSRSmaParam(SEncoder* pCoder, const SRSmaParam* pRSmaParam);
int32_t tDecodeSRSmaParam(SDecoder* pCoder, SRSmaParam* pRSmaParam);
2022-04-20 08:50:45 +00:00
2022-04-28 04:09:31 +00:00
// TDMT_VND_CREATE_STB ==============
2022-04-20 08:50:45 +00:00
typedef struct SVCreateStbReq {
2024-03-06 12:06:26 +00:00
char* name;
tb_uid_t suid;
int8_t rollup;
SSchemaWrapper schemaRow;
SSchemaWrapper schemaTag;
SRSmaParam rsmaParam;
int32_t alterOriDataLen;
void* alterOriData;
int8_t source;
int8_t colCmpred;
SColCmprWrapper colCmpr;
int64_t keep;
2025-12-29 11:27:11 +00:00
int64_t ownerId;
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
SExtSchema* pExtSchemas;
int8_t virtualStb;
int8_t secureDelete;
int8_t securityLevel;
2022-04-20 08:50:45 +00:00
} SVCreateStbReq;
2022-05-07 10:03:06 +00:00
int tEncodeSVCreateStbReq(SEncoder* pCoder, const SVCreateStbReq* pReq);
int tDecodeSVCreateStbReq(SDecoder* pCoder, SVCreateStbReq* pReq);
2022-04-20 08:50:45 +00:00
2022-04-28 04:09:31 +00:00
// TDMT_VND_DROP_STB ==============
2022-04-21 14:01:58 +00:00
typedef struct SVDropStbReq {
2022-05-23 07:47:49 +00:00
char* name;
tb_uid_t suid;
2022-04-21 14:01:58 +00:00
} SVDropStbReq;
2022-05-07 10:03:06 +00:00
int32_t tEncodeSVDropStbReq(SEncoder* pCoder, const SVDropStbReq* pReq);
int32_t tDecodeSVDropStbReq(SDecoder* pCoder, SVDropStbReq* pReq);
2022-04-20 08:50:45 +00:00
2022-05-16 03:54:05 +00:00
// TDMT_VND_CREATE_TABLE ==============
#define TD_CREATE_IF_NOT_EXISTS 0x1
#define TD_CREATE_NORMAL_TB_IN_STREAM 0x2
#define TD_CREATE_SUB_TB_IN_STREAM 0x4
2021-12-25 06:35:39 +00:00
typedef struct SVCreateTbReq {
2022-05-23 07:47:49 +00:00
int32_t flags;
2022-05-27 03:38:09 +00:00
char* name;
2022-05-23 07:47:49 +00:00
tb_uid_t uid;
int64_t btime;
2022-05-23 07:47:49 +00:00
int32_t ttl;
2022-06-16 12:44:25 +00:00
int32_t commentLen;
char* comment;
2022-05-23 07:47:49 +00:00
int8_t type;
2022-03-22 23:58:07 +00:00
union {
struct {
char* stbName; // super table name
2022-07-25 13:09:06 +00:00
uint8_t tagNum;
2022-05-23 07:47:49 +00:00
tb_uid_t suid;
2022-07-12 10:58:33 +00:00
SArray* tagName;
2022-05-23 07:47:49 +00:00
uint8_t* pTag;
2022-04-22 07:01:48 +00:00
} ctb;
2021-12-25 06:35:39 +00:00
struct {
2022-05-26 08:29:52 +00:00
SSchemaWrapper schemaRow;
2026-01-28 11:06:16 +00:00
int64_t userId;
2022-04-22 07:01:48 +00:00
} ntb;
2021-12-25 06:35:39 +00:00
};
2024-03-06 12:06:26 +00:00
int32_t sqlLen;
char* sql;
SColCmprWrapper colCmpr;
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
SExtSchema* pExtSchemas;
SColRefWrapper colRef; // col reference for virtual table
2022-04-22 08:23:55 +00:00
} SVCreateTbReq;
2022-04-22 07:01:48 +00:00
2022-12-06 12:49:27 +00:00
int tEncodeSVCreateTbReq(SEncoder* pCoder, const SVCreateTbReq* pReq);
int tDecodeSVCreateTbReq(SDecoder* pCoder, SVCreateTbReq* pReq);
void tDestroySVCreateTbReq(SVCreateTbReq* pReq, int32_t flags);
2025-12-15 08:48:20 +00:00
void tDestroySVSubmitCreateTbReq(SVCreateTbReq* pReq, int32_t flags);
2022-04-22 07:01:48 +00:00
2022-05-28 09:16:04 +00:00
static FORCE_INLINE void tdDestroySVCreateTbReq(SVCreateTbReq* req) {
2022-11-27 09:09:02 +00:00
if (NULL == req) {
return;
}
2023-09-19 02:38:35 +00:00
taosMemoryFreeClear(req->sql);
2022-05-28 09:16:04 +00:00
taosMemoryFreeClear(req->name);
2022-06-16 12:44:25 +00:00
taosMemoryFreeClear(req->comment);
if (req->type == TSDB_CHILD_TABLE || req->type == TSDB_VIRTUAL_CHILD_TABLE) {
2022-05-28 09:16:04 +00:00
taosMemoryFreeClear(req->ctb.pTag);
taosMemoryFreeClear(req->ctb.stbName);
2022-07-12 10:58:33 +00:00
taosArrayDestroy(req->ctb.tagName);
2022-07-14 02:40:46 +00:00
req->ctb.tagName = NULL;
} else if (req->type == TSDB_NORMAL_TABLE || req->type == TSDB_VIRTUAL_NORMAL_TABLE) {
2022-05-28 09:16:04 +00:00
taosMemoryFreeClear(req->ntb.schemaRow.pSchema);
}
2024-03-23 11:49:09 +00:00
taosMemoryFreeClear(req->colCmpr.pColCmpr);
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
taosMemoryFreeClear(req->pExtSchemas);
taosMemoryFreeClear(req->colRef.pColRef);
taosMemoryFreeClear(req->colRef.pTagRef);
2022-05-28 09:16:04 +00:00
}
2021-12-31 03:39:51 +00:00
typedef struct {
2022-04-22 08:23:55 +00:00
int32_t nReqs;
union {
SVCreateTbReq* pReqs;
SArray* pArray;
};
2024-04-08 02:33:02 +00:00
int8_t source; // TD_REQ_FROM_TAOX-taosX or TD_REQ_FROM_APP-taosClient
2021-12-31 03:39:51 +00:00
} SVCreateTbBatchReq;
2021-12-25 06:35:39 +00:00
2024-07-05 07:06:11 +00:00
int tEncodeSVCreateTbBatchReq(SEncoder* pCoder, const SVCreateTbBatchReq* pReq);
int tDecodeSVCreateTbBatchReq(SDecoder* pCoder, SVCreateTbBatchReq* pReq);
2024-05-28 10:34:37 +00:00
void tDeleteSVCreateTbBatchReq(SVCreateTbBatchReq* pReq);
2021-12-25 06:35:39 +00:00
2021-12-31 03:39:51 +00:00
typedef struct {
int32_t code;
int32_t index; // index in batch req, start from 0
STableMetaRsp* pMeta;
2022-02-08 09:44:58 +00:00
} SVCreateTbRsp, SVUpdateTbRsp;
2021-12-25 06:35:39 +00:00
2022-08-30 02:57:24 +00:00
int tEncodeSVCreateTbRsp(SEncoder* pCoder, const SVCreateTbRsp* pRsp);
int tDecodeSVCreateTbRsp(SDecoder* pCoder, SVCreateTbRsp* pRsp);
void tFreeSVCreateTbRsp(void* param);
2022-04-23 10:50:26 +00:00
2022-02-08 09:44:58 +00:00
int32_t tSerializeSVCreateTbReq(void** buf, SVCreateTbReq* pReq);
void* tDeserializeSVCreateTbReq(void* buf, SVCreateTbReq* pReq);
2021-12-25 06:35:39 +00:00
2021-12-31 03:39:51 +00:00
typedef struct {
2022-04-23 10:50:26 +00:00
int32_t nRsps;
union {
SVCreateTbRsp* pRsps;
SArray* pArray;
};
2022-02-08 09:44:58 +00:00
} SVCreateTbBatchRsp;
2021-12-25 06:35:39 +00:00
2022-05-07 10:03:06 +00:00
int tEncodeSVCreateTbBatchRsp(SEncoder* pCoder, const SVCreateTbBatchRsp* pRsp);
int tDecodeSVCreateTbBatchRsp(SDecoder* pCoder, SVCreateTbBatchRsp* pRsp);
2022-04-23 10:50:26 +00:00
2024-02-26 08:28:10 +00:00
// int32_t tSerializeSVCreateTbBatchRsp(void* buf, int32_t bufLen, SVCreateTbBatchRsp* pRsp);
// int32_t tDeserializeSVCreateTbBatchRsp(void* buf, int32_t bufLen, SVCreateTbBatchRsp* pRsp);
2022-01-10 12:44:11 +00:00
2022-04-28 04:09:31 +00:00
// TDMT_VND_DROP_TABLE =================
2022-01-10 12:44:11 +00:00
typedef struct {
char* name;
uint64_t suid; // for tmq in wal format
2024-11-01 10:47:41 +00:00
int64_t uid;
int8_t igNotExists;
int8_t isVirtual;
2022-01-10 12:44:11 +00:00
} SVDropTbReq;
typedef struct {
2022-04-28 04:09:31 +00:00
int32_t code;
2022-01-10 12:44:11 +00:00
} SVDropTbRsp;
2022-04-28 04:09:31 +00:00
typedef struct {
int32_t nReqs;
union {
SVDropTbReq* pReqs;
SArray* pArray;
};
} SVDropTbBatchReq;
2022-05-07 10:03:06 +00:00
int32_t tEncodeSVDropTbBatchReq(SEncoder* pCoder, const SVDropTbBatchReq* pReq);
int32_t tDecodeSVDropTbBatchReq(SDecoder* pCoder, SVDropTbBatchReq* pReq);
2022-04-28 04:09:31 +00:00
typedef struct {
int32_t nRsps;
union {
SVDropTbRsp* pRsps;
SArray* pArray;
};
} SVDropTbBatchRsp;
2022-05-07 10:03:06 +00:00
int32_t tEncodeSVDropTbBatchRsp(SEncoder* pCoder, const SVDropTbBatchRsp* pRsp);
int32_t tDecodeSVDropTbBatchRsp(SDecoder* pCoder, SVDropTbBatchRsp* pRsp);
2022-01-28 02:54:50 +00:00
2022-05-16 03:54:05 +00:00
// TDMT_VND_ALTER_TABLE =====================
2026-03-18 06:19:15 +00:00
typedef struct SUpdatedTagVal {
2024-11-23 14:18:30 +00:00
char* tagName;
int32_t colId;
int8_t tagType;
int8_t tagFree;
uint32_t nTagVal;
uint8_t* pTagVal;
int8_t isNull;
SArray* pTagArray;
2026-03-18 06:19:15 +00:00
// NOTE: regexp and replacement are only a temporary solution for tag value update,
// they should be replaced by a more generic solution in the future for full expression
// support
char* regexp;
char* replacement;
} SUpdatedTagVal;
typedef struct SUpdateTableTagVal {
char *tbName;
SArray* tags; // Array of SUpdatedTagVal
} SUpdateTableTagVal;
typedef struct SVAlterTbReq {
char* tbName;
int8_t action;
char* colName;
int32_t colId;
2022-05-16 03:54:05 +00:00
// TSDB_ALTER_TABLE_ADD_COLUMN
2022-05-16 07:18:44 +00:00
int8_t type;
int8_t flags;
int32_t bytes;
2022-05-16 03:54:05 +00:00
// TSDB_ALTER_TABLE_DROP_COLUMN
// TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES
2024-03-08 08:33:16 +00:00
int8_t colModType;
int32_t colModBytes;
char* colNewName; // TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME
char* tagName; // TSDB_ALTER_TABLE_UPDATE_TAG_VAL
2022-05-23 07:47:49 +00:00
int8_t isNull;
2022-07-10 10:54:58 +00:00
int8_t tagType;
int8_t tagFree;
2022-05-23 07:47:49 +00:00
uint32_t nTagVal;
uint8_t* pTagVal;
2024-03-10 14:14:57 +00:00
SArray* pTagArray;
2022-05-16 03:54:05 +00:00
// TSDB_ALTER_TABLE_UPDATE_OPTIONS
2024-03-08 08:33:16 +00:00
int8_t updateTTL;
int32_t newTTL;
int32_t newCommentLen;
char* newComment;
2024-11-23 14:18:30 +00:00
int64_t ctimeMs; // fill by vnode
int8_t source; // TD_REQ_FROM_TAOX-taosX or TD_REQ_FROM_APP-taosClient
uint32_t compress; // TSDB_ALTER_TABLE_UPDATE_COLUMN_COMPRESS
2026-03-18 06:19:15 +00:00
SArray* pMultiTag; // TSDB_ALTER_TABLE_ADD_MULTI_TAGS and TSDB_ALTER_TABLE_UPDATE_CHILD_TABLE_TAG_VAL
SArray* tables; // Array of SUpdateTableTagVal, for TSDB_ALTER_TABLE_UPDATE_MULTI_TABLE_TAG_VAL
int32_t whereLen; // [whereLen] & [where] are for TSDB_ALTER_TABLE_UPDATE_CHILD_TABLE_TAG_VAL,
uint8_t* where; // [where] is the encode where condition.
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
// for Add column
STypeMod typeMod;
// TSDB_ALTER_TABLE_ALTER_COLUMN_REF
char* refDbName;
char* refTbName;
char* refColName;
// TSDB_ALTER_TABLE_REMOVE_COLUMN_REF
2022-05-16 03:54:05 +00:00
} SVAlterTbReq;
int32_t tEncodeSVAlterTbReq(SEncoder* pEncoder, const SVAlterTbReq* pReq);
int32_t tDecodeSVAlterTbReq(SDecoder* pDecoder, SVAlterTbReq* pReq);
void destroyAlterTbReq(SVAlterTbReq* pReq);
int32_t tDecodeSVAlterTbReqSetCtime(SDecoder* pDecoder, SVAlterTbReq* pReq, int64_t ctimeMs);
2024-11-25 12:27:48 +00:00
void tfreeMultiTagUpateVal(void* pMultiTag);
2026-03-18 06:19:15 +00:00
void tfreeUpdateTableTagVal(void* pMultiTable);
2022-05-16 03:54:05 +00:00
typedef struct {
2022-06-01 12:28:29 +00:00
int32_t code;
STableMetaRsp* pMeta;
2022-05-16 03:54:05 +00:00
} SVAlterTbRsp;
int32_t tEncodeSVAlterTbRsp(SEncoder* pEncoder, const SVAlterTbRsp* pRsp);
int32_t tDecodeSVAlterTbRsp(SDecoder* pDecoder, SVAlterTbRsp* pRsp);
// ======================
2022-01-10 12:44:11 +00:00
typedef struct {
SMsgHead head;
int64_t uid;
int32_t tid;
int16_t tversion;
int16_t colId;
int8_t type;
int16_t bytes;
int32_t tagValLen;
int16_t numOfTags;
int32_t schemaLen;
char data[];
} SUpdateTagValReq;
typedef struct {
SMsgHead head;
} SUpdateTagValRsp;
typedef struct {
2021-12-29 07:47:45 +00:00
SMsgHead head;
} SVShowTablesReq;
2022-01-10 12:44:11 +00:00
typedef struct {
2021-12-29 07:47:45 +00:00
SMsgHead head;
2021-12-29 15:07:01 +00:00
int32_t id;
2021-12-29 07:47:45 +00:00
} SVShowTablesFetchReq;
2022-01-10 12:44:11 +00:00
typedef struct {
2021-12-29 07:47:45 +00:00
int64_t useconds;
int8_t completed; // all results are returned to client
int8_t precision;
int8_t compressed;
int32_t compLen;
int32_t numOfRows;
char data[];
} SVShowTablesFetchRsp;
2022-04-26 09:08:42 +00:00
typedef struct {
2022-01-25 07:17:02 +00:00
int64_t consumerId;
int32_t epoch;
2022-03-07 09:53:02 +00:00
char cgroup[TSDB_CGROUP_LEN];
2022-04-26 09:08:42 +00:00
} SMqAskEpReq;
2022-01-19 09:35:06 +00:00
typedef struct {
2022-01-25 10:29:26 +00:00
int32_t key;
2022-01-19 09:35:06 +00:00
int32_t valueLen;
void* value;
} SKv;
typedef struct {
2022-04-12 11:10:52 +00:00
int64_t tscRid;
2022-04-14 11:54:59 +00:00
int8_t connType;
2022-01-19 09:35:06 +00:00
} SClientHbKey;
typedef struct {
2022-04-12 11:10:52 +00:00
int64_t tid;
char status[TSDB_JOB_STATUS_LEN];
int64_t startTs; // sub-task first execution start time, us
2022-04-12 11:10:52 +00:00
} SQuerySubDesc;
typedef enum EQueryExecPhase {
/* Main phases: 0-9 */
QUERY_PHASE_NONE = 0,
QUERY_PHASE_PARSE = 1,
QUERY_PHASE_CATALOG = 2,
QUERY_PHASE_PLAN = 3,
QUERY_PHASE_SCHEDULE = 4,
QUERY_PHASE_EXECUTE = 5,
QUERY_PHASE_FETCH = 6,
QUERY_PHASE_DONE = 7,
/* SCHEDULE sub-phases: 4x */
QUERY_PHASE_SCHEDULE_ANALYSIS = 41,
QUERY_PHASE_SCHEDULE_PLANNING = 42,
QUERY_PHASE_SCHEDULE_NODE_SELECTION = 43,
/* EXECUTE sub-phases: 5x */
QUERY_PHASE_EXEC_DATA_QUERY = 51,
QUERY_PHASE_EXEC_MERGE_QUERY = 52,
QUERY_PHASE_EXEC_WAITING_CHILDREN = 53,
/* FETCH sub-phases: 6x */
QUERY_PHASE_FETCH_IN_PROGRESS = 60, // A single fetch operation is in progress
QUERY_PHASE_FETCH_RETURNED = 61, // Data returned to client, business logic processing
} EQueryExecPhase;
const char* queryPhaseStr(int32_t phase);
2022-04-12 11:10:52 +00:00
typedef struct {
char sql[TSDB_SHOW_SQL_LEN];
uint64_t queryId;
int64_t useconds;
2022-06-16 02:29:30 +00:00
int64_t stime; // timestamp precision ms
2022-04-12 11:10:52 +00:00
int64_t reqRid;
bool stableQuery;
bool isSubQuery;
2022-04-12 11:10:52 +00:00
char fqdn[TSDB_FQDN_LEN];
int32_t subPlanNum;
SArray* subDesc; // SArray<SQuerySubDesc>
int32_t execPhase; // EQueryExecPhase
int64_t phaseStartTime; // when current phase started, ms
2022-04-12 11:10:52 +00:00
} SQueryDesc;
typedef struct {
uint32_t connId;
SArray* queryDesc; // SArray<SQueryDesc>
2022-04-12 11:10:52 +00:00
} SQueryHbReqBasic;
typedef struct {
uint32_t connId;
uint64_t killRid;
int32_t totalDnodes;
int32_t onlineDnodes;
int8_t killConnection;
int8_t align[3];
SEpSet epSet;
2022-06-01 09:26:15 +00:00
SArray* pQnodeList;
2022-04-12 11:10:52 +00:00
} SQueryHbRspBasic;
2022-06-15 12:59:33 +00:00
typedef struct SAppClusterSummary {
uint64_t numOfInsertsReq;
uint64_t numOfInsertRows;
uint64_t insertElapsedTime;
uint64_t insertBytes; // submit to tsdb since launched.
uint64_t fetchBytes;
2022-08-01 12:47:08 +00:00
uint64_t numOfQueryReq;
2022-06-15 12:59:33 +00:00
uint64_t queryElapsedTime;
uint64_t numOfSlowQueries;
uint64_t totalRequests;
uint64_t currentRequests; // the number of SRequestObj
} SAppClusterSummary;
typedef struct {
int64_t appId;
int32_t pid;
char name[TSDB_APP_NAME_LEN];
int64_t startTime;
SAppClusterSummary summary;
} SAppHbReq;
2022-04-12 11:10:52 +00:00
typedef struct {
SClientHbKey connKey;
2022-06-04 14:33:30 +00:00
int64_t clusterId;
2022-06-15 12:59:33 +00:00
SAppHbReq app;
2022-04-12 11:10:52 +00:00
SQueryHbReqBasic* query;
SHashObj* info; // hash<Skv.key, Skv>
char user[TSDB_USER_LEN];
char tokenName[TSDB_TOKEN_NAME_LEN];
char userApp[TSDB_APP_NAME_LEN];
uint32_t userIp;
SIpRange userDualIp;
char sVer[TSDB_VERSION_LEN];
char cInfo[CONNECTOR_INFO_LEN];
2022-01-19 09:35:06 +00:00
} SClientHbReq;
typedef struct {
int64_t reqId;
SArray* reqs; // SArray<SClientHbReq>
int64_t ipWhiteListVer;
2022-01-19 09:35:06 +00:00
} SClientHbBatchReq;
typedef struct {
2022-04-12 11:10:52 +00:00
SClientHbKey connKey;
int32_t status;
SQueryHbRspBasic* query;
SArray* info; // Array<Skv>
2022-01-19 09:35:06 +00:00
} SClientHbRsp;
typedef struct {
2024-07-05 07:06:11 +00:00
int64_t reqId;
int64_t rspId;
int32_t svrTimestamp;
SArray* rsps; // SArray<SClientHbRsp>
2024-06-19 10:54:26 +00:00
SMonitorParas monitorParas;
int8_t enableAuditDelete;
int8_t enableStrongPass;
2025-12-16 08:27:11 +00:00
int8_t enableAuditSelect;
int8_t enableAuditInsert;
int8_t auditLevel;
union {
uint32_t flags;
struct {
uint32_t sodInitial : 1; // cluster-wide: 1 = SoD still in initial phase
uint32_t macActive : 1; // cluster-wide: 1 = MAC mandatory mode activated
uint32_t reserved : 30;
};
};
2022-01-19 09:35:06 +00:00
} SClientHbBatchRsp;
2022-02-15 06:57:42 +00:00
static FORCE_INLINE uint32_t hbKeyHashFunc(const char* key, uint32_t keyLen) { return taosIntHash_64(key, keyLen); }
2022-01-19 09:35:06 +00:00
2022-02-15 06:57:42 +00:00
static FORCE_INLINE void tFreeReqKvHash(SHashObj* info) {
void* pIter = taosHashIterate(info, NULL);
2022-01-26 09:42:31 +00:00
while (pIter != NULL) {
SKv* kv = (SKv*)pIter;
2022-03-25 16:29:53 +00:00
taosMemoryFreeClear(kv->value);
2022-01-26 09:42:31 +00:00
pIter = taosHashIterate(info, pIter);
}
}
2022-04-12 11:10:52 +00:00
static FORCE_INLINE void tFreeClientHbQueryDesc(void* pDesc) {
SQueryDesc* desc = (SQueryDesc*)pDesc;
if (desc->subDesc) {
taosArrayDestroy(desc->subDesc);
desc->subDesc = NULL;
}
}
2022-02-15 06:57:42 +00:00
static FORCE_INLINE void tFreeClientHbReq(void* pReq) {
2022-01-19 09:35:06 +00:00
SClientHbReq* req = (SClientHbReq*)pReq;
2022-04-12 11:10:52 +00:00
if (req->query) {
if (req->query->queryDesc) {
taosArrayDestroyEx(req->query->queryDesc, tFreeClientHbQueryDesc);
}
taosMemoryFreeClear(req->query);
}
2022-01-26 09:42:31 +00:00
if (req->info) {
tFreeReqKvHash(req->info);
taosHashCleanup(req->info);
2022-05-21 13:59:04 +00:00
req->info = NULL;
2022-01-26 09:42:31 +00:00
}
2022-01-19 09:35:06 +00:00
}
2022-02-14 07:27:38 +00:00
int32_t tSerializeSClientHbBatchReq(void* buf, int32_t bufLen, const SClientHbBatchReq* pReq);
int32_t tDeserializeSClientHbBatchReq(void* buf, int32_t bufLen, SClientHbBatchReq* pReq);
2022-01-19 09:35:06 +00:00
2022-05-21 13:59:04 +00:00
static FORCE_INLINE void tFreeClientHbBatchReq(void* pReq) {
2022-09-23 07:28:25 +00:00
if (pReq == NULL) return;
2022-02-15 06:57:42 +00:00
SClientHbBatchReq* req = (SClientHbBatchReq*)pReq;
2022-05-21 13:59:04 +00:00
taosArrayDestroyEx(req->reqs, tFreeClientHbReq);
2022-03-25 16:29:53 +00:00
taosMemoryFree(pReq);
2022-01-19 09:35:06 +00:00
}
2022-02-15 06:57:42 +00:00
static FORCE_INLINE void tFreeClientKv(void* pKv) {
SKv* kv = (SKv*)pKv;
2022-01-26 09:42:31 +00:00
if (kv) {
2022-03-25 16:29:53 +00:00
taosMemoryFreeClear(kv->value);
2022-01-26 09:42:31 +00:00
}
}
2022-02-15 06:57:42 +00:00
static FORCE_INLINE void tFreeClientHbRsp(void* pRsp) {
2022-01-26 09:42:31 +00:00
SClientHbRsp* rsp = (SClientHbRsp*)pRsp;
2022-05-31 06:03:47 +00:00
if (rsp->query) {
taosArrayDestroy(rsp->query->pQnodeList);
taosMemoryFreeClear(rsp->query);
}
2022-01-26 09:42:31 +00:00
if (rsp->info) taosArrayDestroyEx(rsp->info, tFreeClientKv);
}
static FORCE_INLINE void tFreeClientHbBatchRsp(void* pRsp) {
2022-02-15 06:57:42 +00:00
SClientHbBatchRsp* rsp = (SClientHbBatchRsp*)pRsp;
2022-01-26 09:42:31 +00:00
taosArrayDestroyEx(rsp->rsps, tFreeClientHbRsp);
}
2022-02-14 07:27:38 +00:00
int32_t tSerializeSClientHbBatchRsp(void* buf, int32_t bufLen, const SClientHbBatchRsp* pBatchRsp);
int32_t tDeserializeSClientHbBatchRsp(void* buf, int32_t bufLen, SClientHbBatchRsp* pBatchRsp);
2022-05-23 07:47:49 +00:00
void tFreeSClientHbBatchRsp(SClientHbBatchRsp* pBatchRsp);
2022-01-19 09:35:06 +00:00
2022-05-07 10:03:06 +00:00
static FORCE_INLINE int32_t tEncodeSKv(SEncoder* pEncoder, const SKv* pKv) {
2024-07-22 09:32:30 +00:00
TAOS_CHECK_RETURN(tEncodeI32(pEncoder, pKv->key));
TAOS_CHECK_RETURN(tEncodeI32(pEncoder, pKv->valueLen));
TAOS_CHECK_RETURN(tEncodeBinary(pEncoder, (uint8_t*)pKv->value, pKv->valueLen));
2022-02-14 07:27:38 +00:00
return 0;
2022-01-19 09:35:06 +00:00
}
2022-05-07 10:03:06 +00:00
static FORCE_INLINE int32_t tDecodeSKv(SDecoder* pDecoder, SKv* pKv) {
2024-07-22 09:32:30 +00:00
TAOS_CHECK_RETURN(tDecodeI32(pDecoder, &pKv->key));
TAOS_CHECK_RETURN(tDecodeI32(pDecoder, &pKv->valueLen));
if (pKv->valueLen < 0) {
return TSDB_CODE_INVALID_MSG;
}
2022-03-25 16:29:53 +00:00
pKv->value = taosMemoryMalloc(pKv->valueLen + 1);
2024-07-22 09:32:30 +00:00
if (pKv->value == NULL) {
return TSDB_CODE_OUT_OF_MEMORY;
2024-07-22 09:32:30 +00:00
}
TAOS_CHECK_RETURN(tDecodeCStrTo(pDecoder, (char*)pKv->value));
2022-02-14 07:27:38 +00:00
return 0;
2022-01-19 09:35:06 +00:00
}
2022-05-07 10:03:06 +00:00
static FORCE_INLINE int32_t tEncodeSClientHbKey(SEncoder* pEncoder, const SClientHbKey* pKey) {
2024-07-22 09:32:30 +00:00
TAOS_CHECK_RETURN(tEncodeI64(pEncoder, pKey->tscRid));
TAOS_CHECK_RETURN(tEncodeI8(pEncoder, pKey->connType));
2022-02-14 07:27:38 +00:00
return 0;
2022-01-19 09:35:06 +00:00
}
2022-05-07 10:03:06 +00:00
static FORCE_INLINE int32_t tDecodeSClientHbKey(SDecoder* pDecoder, SClientHbKey* pKey) {
2024-07-22 09:32:30 +00:00
TAOS_CHECK_RETURN(tDecodeI64(pDecoder, &pKey->tscRid));
TAOS_CHECK_RETURN(tDecodeI8(pDecoder, &pKey->connType));
2022-02-14 07:27:38 +00:00
return 0;
2022-01-19 09:35:06 +00:00
}
typedef struct {
2022-01-19 09:35:06 +00:00
int32_t vgId;
// TODO stas
} SMqReportVgInfo;
2022-01-19 09:35:06 +00:00
static FORCE_INLINE int32_t taosEncodeSMqVgInfo(void** buf, const SMqReportVgInfo* pVgInfo) {
2022-02-28 09:39:07 +00:00
int32_t tlen = 0;
2022-01-19 09:35:06 +00:00
tlen += taosEncodeFixedI32(buf, pVgInfo->vgId);
return tlen;
}
static FORCE_INLINE void* taosDecodeSMqVgInfo(void* buf, SMqReportVgInfo* pVgInfo) {
2022-01-19 09:35:06 +00:00
buf = taosDecodeFixedI32(buf, &pVgInfo->vgId);
return buf;
}
typedef struct {
2022-01-19 09:35:06 +00:00
int32_t epoch;
int64_t topicUid;
char name[TSDB_TOPIC_FNAME_LEN];
2022-05-11 06:42:20 +00:00
SArray* pVgInfo; // SArray<SMqHbVgInfo>
} SMqTopicInfo;
2022-01-19 09:35:06 +00:00
static FORCE_INLINE int32_t taosEncodeSMqTopicInfoMsg(void** buf, const SMqTopicInfo* pTopicInfo) {
2022-02-28 09:39:07 +00:00
int32_t tlen = 0;
2022-01-19 09:35:06 +00:00
tlen += taosEncodeFixedI32(buf, pTopicInfo->epoch);
tlen += taosEncodeFixedI64(buf, pTopicInfo->topicUid);
tlen += taosEncodeString(buf, pTopicInfo->name);
int32_t sz = taosArrayGetSize(pTopicInfo->pVgInfo);
tlen += taosEncodeFixedI32(buf, sz);
for (int32_t i = 0; i < sz; i++) {
SMqReportVgInfo* pVgInfo = (SMqReportVgInfo*)taosArrayGet(pTopicInfo->pVgInfo, i);
2022-01-19 09:35:06 +00:00
tlen += taosEncodeSMqVgInfo(buf, pVgInfo);
}
return tlen;
}
static FORCE_INLINE void* taosDecodeSMqTopicInfoMsg(void* buf, SMqTopicInfo* pTopicInfo) {
2022-01-19 09:35:06 +00:00
buf = taosDecodeFixedI32(buf, &pTopicInfo->epoch);
buf = taosDecodeFixedI64(buf, &pTopicInfo->topicUid);
buf = taosDecodeStringTo(buf, pTopicInfo->name);
int32_t sz;
buf = taosDecodeFixedI32(buf, &sz);
2024-07-27 10:03:16 +00:00
if ((pTopicInfo->pVgInfo = taosArrayInit(sz, sizeof(SMqReportVgInfo))) == NULL) {
return NULL;
}
2022-01-19 09:35:06 +00:00
for (int32_t i = 0; i < sz; i++) {
SMqReportVgInfo vgInfo;
2022-01-19 09:35:06 +00:00
buf = taosDecodeSMqVgInfo(buf, &vgInfo);
2024-07-26 13:39:27 +00:00
if (taosArrayPush(pTopicInfo->pVgInfo, &vgInfo) == NULL) {
return NULL;
}
2022-01-19 09:35:06 +00:00
}
return buf;
}
typedef struct {
2022-02-15 06:57:42 +00:00
int32_t status; // ask hb endpoint
int32_t epoch;
int64_t consumerId;
SArray* pTopics; // SArray<SMqHbTopicInfo>
} SMqReportReq;
2022-01-19 09:35:06 +00:00
static FORCE_INLINE int32_t taosEncodeSMqReportMsg(void** buf, const SMqReportReq* pMsg) {
2022-02-28 09:39:07 +00:00
int32_t tlen = 0;
2022-01-19 09:35:06 +00:00
tlen += taosEncodeFixedI32(buf, pMsg->status);
tlen += taosEncodeFixedI32(buf, pMsg->epoch);
tlen += taosEncodeFixedI64(buf, pMsg->consumerId);
int32_t sz = taosArrayGetSize(pMsg->pTopics);
tlen += taosEncodeFixedI32(buf, sz);
2022-02-28 09:39:07 +00:00
for (int32_t i = 0; i < sz; i++) {
SMqTopicInfo* topicInfo = (SMqTopicInfo*)taosArrayGet(pMsg->pTopics, i);
tlen += taosEncodeSMqTopicInfoMsg(buf, topicInfo);
2022-01-19 09:35:06 +00:00
}
return tlen;
}
static FORCE_INLINE void* taosDecodeSMqReportMsg(void* buf, SMqReportReq* pMsg) {
2022-01-19 09:35:06 +00:00
buf = taosDecodeFixedI32(buf, &pMsg->status);
buf = taosDecodeFixedI32(buf, &pMsg->epoch);
buf = taosDecodeFixedI64(buf, &pMsg->consumerId);
int32_t sz;
buf = taosDecodeFixedI32(buf, &sz);
2024-07-27 10:03:16 +00:00
if ((pMsg->pTopics = taosArrayInit(sz, sizeof(SMqTopicInfo))) == NULL) {
return NULL;
}
2022-02-28 09:39:07 +00:00
for (int32_t i = 0; i < sz; i++) {
SMqTopicInfo topicInfo;
buf = taosDecodeSMqTopicInfoMsg(buf, &topicInfo);
2024-07-26 13:39:27 +00:00
if (taosArrayPush(pMsg->pTopics, &topicInfo) == NULL) {
return NULL;
}
2022-01-19 09:35:06 +00:00
}
return buf;
}
2022-05-16 20:26:37 +00:00
typedef struct {
SMsgHead head;
int64_t leftForVer;
int32_t vgId;
int64_t consumerId;
char subKey[TSDB_SUBSCRIBE_KEY_LEN];
} SMqVDeleteReq;
typedef struct {
int8_t reserved;
} SMqVDeleteRsp;
2022-06-15 13:13:47 +00:00
typedef struct {
2025-12-30 10:52:02 +00:00
char** name;
int32_t count;
int8_t igNotExists;
2022-06-16 09:07:31 +00:00
} SMDropStreamReq;
2022-06-15 13:13:47 +00:00
typedef struct {
int8_t reserved;
2022-06-16 09:07:31 +00:00
} SMDropStreamRsp;
2022-06-15 13:13:47 +00:00
typedef struct {
SMsgHead head;
int64_t resetRelHalt; // reset related stream task halt status
int64_t streamId;
2022-06-15 13:13:47 +00:00
int32_t taskId;
} SVDropStreamTaskReq;
typedef struct {
int8_t reserved;
} SVDropStreamTaskRsp;
2022-07-15 09:48:48 +00:00
int32_t tSerializeSMDropStreamReq(void* buf, int32_t bufLen, const SMDropStreamReq* pReq);
int32_t tDeserializeSMDropStreamReq(void* buf, int32_t bufLen, SMDropStreamReq* pReq);
void tFreeMDropStreamReq(SMDropStreamReq* pReq);
2022-07-15 09:48:48 +00:00
typedef struct {
char* name;
int8_t igNotExists;
} SMPauseStreamReq;
int32_t tSerializeSMPauseStreamReq(void* buf, int32_t bufLen, const SMPauseStreamReq* pReq);
int32_t tDeserializeSMPauseStreamReq(void* buf, int32_t bufLen, SMPauseStreamReq* pReq);
2025-12-15 08:48:20 +00:00
void tFreeMPauseStreamReq(SMPauseStreamReq* pReq);
typedef struct {
char* name;
int8_t igNotExists;
int8_t igUntreated;
} SMResumeStreamReq;
int32_t tSerializeSMResumeStreamReq(void* buf, int32_t bufLen, const SMResumeStreamReq* pReq);
int32_t tDeserializeSMResumeStreamReq(void* buf, int32_t bufLen, SMResumeStreamReq* pReq);
2025-12-15 08:48:20 +00:00
void tFreeMResumeStreamReq(SMResumeStreamReq* pReq);
typedef struct {
char* name;
int8_t calcAll;
STimeWindow timeRange;
} SMRecalcStreamReq;
int32_t tSerializeSMRecalcStreamReq(void* buf, int32_t bufLen, const SMRecalcStreamReq* pReq);
int32_t tDeserializeSMRecalcStreamReq(void* buf, int32_t bufLen, SMRecalcStreamReq* pReq);
2025-12-15 08:48:20 +00:00
void tFreeMRecalcStreamReq(SMRecalcStreamReq* pReq);
typedef struct SVndSetKeepVersionReq {
int64_t keepVersion;
} SVndSetKeepVersionReq;
int32_t tSerializeSVndSetKeepVersionReq(void* buf, int32_t bufLen, SVndSetKeepVersionReq* pReq);
int32_t tDeserializeSVndSetKeepVersionReq(void* buf, int32_t bufLen, SVndSetKeepVersionReq* pReq);
typedef struct SVUpdateCheckpointInfoReq {
SMsgHead head;
int64_t streamId;
int32_t taskId;
int64_t checkpointId;
int64_t checkpointVer;
int64_t checkpointTs;
int32_t transId;
2024-07-05 07:06:11 +00:00
int64_t hStreamId; // add encode/decode
int64_t hTaskId;
int8_t dropRelHTask;
} SVUpdateCheckpointInfoReq;
2022-07-15 09:48:48 +00:00
typedef struct {
int64_t leftForVer;
int32_t vgId;
int64_t oldConsumerId;
int64_t newConsumerId;
char subKey[TSDB_SUBSCRIBE_KEY_LEN];
int8_t subType;
int8_t withMeta;
char* qmsg; // SubPlanToString
SSchemaWrapper schema;
int64_t suid;
} SMqRebVgReq;
int32_t tEncodeSMqRebVgReq(SEncoder* pCoder, const SMqRebVgReq* pReq);
int32_t tDecodeSMqRebVgReq(SDecoder* pCoder, SMqRebVgReq* pReq);
2022-06-14 05:58:40 +00:00
// tqOffset
enum {
2022-06-29 12:57:15 +00:00
TMQ_OFFSET__RESET_NONE = -3,
TMQ_OFFSET__RESET_EARLIEST = -2,
2022-06-29 12:57:15 +00:00
TMQ_OFFSET__RESET_LATEST = -1,
TMQ_OFFSET__LOG = 1,
TMQ_OFFSET__SNAPSHOT_DATA = 2,
TMQ_OFFSET__SNAPSHOT_META = 3,
2022-06-14 05:58:40 +00:00
};
enum {
WITH_DATA = 0,
WITH_META = 1,
ONLY_META = 2,
};
#define TQ_OFFSET_VERSION 1
2022-06-14 05:58:40 +00:00
typedef struct {
int8_t type;
union {
2022-08-05 13:12:18 +00:00
// snapshot
2022-06-14 05:58:40 +00:00
struct {
int64_t uid;
int64_t ts;
SValue primaryKey;
2022-06-14 05:58:40 +00:00
};
2022-06-29 12:57:15 +00:00
// log
2022-06-14 05:58:40 +00:00
struct {
int64_t version;
};
};
2022-06-29 12:57:15 +00:00
} STqOffsetVal;
static FORCE_INLINE void tqOffsetResetToData(STqOffsetVal* pOffsetVal, int64_t uid, int64_t ts, SValue primaryKey) {
2022-08-31 05:27:08 +00:00
pOffsetVal->type = TMQ_OFFSET__SNAPSHOT_DATA;
pOffsetVal->uid = uid;
pOffsetVal->ts = ts;
2024-05-30 11:41:22 +00:00
if (IS_VAR_DATA_TYPE(pOffsetVal->primaryKey.type)) {
taosMemoryFree(pOffsetVal->primaryKey.pData);
}
pOffsetVal->primaryKey = primaryKey;
2022-08-31 05:27:08 +00:00
}
static FORCE_INLINE void tqOffsetResetToMeta(STqOffsetVal* pOffsetVal, int64_t uid) {
pOffsetVal->type = TMQ_OFFSET__SNAPSHOT_META;
pOffsetVal->uid = uid;
}
static FORCE_INLINE void tqOffsetResetToLog(STqOffsetVal* pOffsetVal, int64_t ver) {
pOffsetVal->type = TMQ_OFFSET__LOG;
pOffsetVal->version = ver;
}
2022-06-29 12:57:15 +00:00
int32_t tEncodeSTqOffsetVal(SEncoder* pEncoder, const STqOffsetVal* pOffsetVal);
int32_t tDecodeSTqOffsetVal(SDecoder* pDecoder, STqOffsetVal* pOffsetVal);
void tFormatOffset(char* buf, int32_t maxLen, const STqOffsetVal* pVal);
2022-06-29 12:57:15 +00:00
bool tOffsetEqual(const STqOffsetVal* pLeft, const STqOffsetVal* pRight);
2024-07-30 02:47:46 +00:00
void tOffsetCopy(STqOffsetVal* pLeft, const STqOffsetVal* pRight);
void tOffsetDestroy(void* pVal);
2022-06-29 12:57:15 +00:00
typedef struct {
STqOffsetVal val;
char subKey[TSDB_SUBSCRIBE_KEY_LEN];
2022-06-14 05:58:40 +00:00
} STqOffset;
int32_t tEncodeSTqOffset(SEncoder* pEncoder, const STqOffset* pOffset);
int32_t tDecodeSTqOffset(SDecoder* pDecoder, STqOffset* pOffset);
void tDeleteSTqOffset(void* val);
2022-06-14 05:58:40 +00:00
2023-04-23 03:51:43 +00:00
typedef struct SMqVgOffset {
int64_t consumerId;
STqOffset offset;
} SMqVgOffset;
int32_t tEncodeMqVgOffset(SEncoder* pEncoder, const SMqVgOffset* pOffset);
int32_t tDecodeMqVgOffset(SDecoder* pDecoder, SMqVgOffset* pOffset);
2022-03-23 05:50:53 +00:00
typedef struct {
char name[TSDB_TABLE_FNAME_LEN];
char stb[TSDB_TABLE_FNAME_LEN];
int8_t igExists;
int8_t intervalUnit;
int8_t slidingUnit;
int8_t timezone; // int8_t is not enough, timezone is unit of second
int32_t dstVgId; // for stream
2022-03-23 05:50:53 +00:00
int64_t interval;
int64_t offset;
int64_t sliding;
int64_t maxDelay;
int64_t watermark;
2022-03-23 09:53:00 +00:00
int32_t exprLen; // strlen + 1
int32_t tagsFilterLen; // strlen + 1
int32_t sqlLen; // strlen + 1
int32_t astLen; // strlen + 1
2022-03-24 08:18:08 +00:00
char* expr;
2022-03-23 05:50:53 +00:00
char* tagsFilter;
2022-03-23 09:53:00 +00:00
char* sql;
char* ast;
2022-12-06 08:07:11 +00:00
int64_t deleteMark;
int64_t lastTs;
2024-05-30 11:41:22 +00:00
int64_t normSourceTbUid; // the Uid of source tb if its a normal table, otherwise 0
SArray* pVgroupVerList;
2024-02-22 10:24:35 +00:00
int8_t recursiveTsma;
2024-05-30 11:41:22 +00:00
char baseTsmaName[TSDB_TABLE_FNAME_LEN]; // base tsma name for recursively created tsma
2025-06-24 10:27:02 +00:00
char* createStreamReq;
int32_t streamReqLen;
char* dropStreamReq;
int32_t dropStreamReqLen;
int64_t uid;
2022-03-23 05:50:53 +00:00
} SMCreateSmaReq;
int32_t tSerializeSMCreateSmaReq(void* buf, int32_t bufLen, SMCreateSmaReq* pReq);
int32_t tDeserializeSMCreateSmaReq(void* buf, int32_t bufLen, SMCreateSmaReq* pReq);
void tFreeSMCreateSmaReq(SMCreateSmaReq* pReq);
typedef struct {
2025-12-15 08:48:20 +00:00
char name[TSDB_TABLE_FNAME_LEN];
int8_t igNotExists;
2025-06-24 10:27:02 +00:00
char* dropStreamReq;
int32_t dropStreamReqLen;
2022-03-23 05:50:53 +00:00
} SMDropSmaReq;
int32_t tSerializeSMDropSmaReq(void* buf, int32_t bufLen, SMDropSmaReq* pReq);
int32_t tDeserializeSMDropSmaReq(void* buf, int32_t bufLen, SMDropSmaReq* pReq);
2025-12-15 08:48:20 +00:00
void tFreeSMDropSmaReq(SMDropSmaReq* pReq);
2022-03-23 05:50:53 +00:00
2025-09-26 09:32:32 +00:00
typedef struct {
char name[TSDB_TABLE_NAME_LEN];
union {
char tbFName[TSDB_TABLE_FNAME_LEN]; // used by mnode
char tbName[TSDB_TABLE_NAME_LEN]; // used by vnode
};
int8_t tbType; // ETableType: 1 stable, 3 normal table
union {
int8_t igExists; // used by mnode
int8_t alterType; // used by vnode
};
2025-09-26 09:32:32 +00:00
int8_t intervalUnit;
int16_t nFuncs; // number of functions specified by user
col_id_t* funcColIds; // column ids specified by user
func_id_t* funcIds; // function ids specified by user
int64_t interval[2]; // 0 unspecified, > 0 valid interval
int64_t tbUid;
int64_t uid; // rsma uid
int32_t sqlLen; // strlen + 1
char* sql;
} SMCreateRsmaReq;
int32_t tSerializeSMCreateRsmaReq(void* buf, int32_t bufLen, SMCreateRsmaReq* pReq);
int32_t tDeserializeSMCreateRsmaReq(void* buf, int32_t bufLen, SMCreateRsmaReq* pReq);
void tFreeSMCreateRsmaReq(SMCreateRsmaReq* pReq);
typedef SMCreateRsmaReq SVCreateRsmaReq;
int32_t tSerializeSVCreateRsmaReq(void* buf, int32_t bufLen, SVCreateRsmaReq* pReq);
int32_t tDeserializeSVCreateRsmaReq(void* buf, int32_t bufLen, SVCreateRsmaReq* pReq);
void tFreeSVCreateRsmaReq(SVCreateRsmaReq* pReq);
typedef SMCreateRsmaReq SVAlterRsmaReq;
int32_t tSerializeSVAlterRsmaReq(void* buf, int32_t bufLen, SVAlterRsmaReq* pReq);
int32_t tDeserializeSVAlterRsmaReq(void* buf, int32_t bufLen, SVAlterRsmaReq* pReq);
void tFreeSVAlterRsmaReq(SVAlterRsmaReq* pReq);
typedef struct {
char name[TSDB_TABLE_NAME_LEN];
int8_t alterType;
int8_t tbType; // ETableType: 1 stable, 3 normal table
int8_t igNotExists;
int16_t nFuncs; // number of functions specified by user
col_id_t* funcColIds; // column ids specified by user
func_id_t* funcIds; // function ids specified by user
int32_t sqlLen; // strlen + 1
char* sql;
} SMAlterRsmaReq;
int32_t tSerializeSMAlterRsmaReq(void* buf, int32_t bufLen, SMAlterRsmaReq* pReq);
int32_t tDeserializeSMAlterRsmaReq(void* buf, int32_t bufLen, SMAlterRsmaReq* pReq);
void tFreeSMAlterRsmaReq(SMAlterRsmaReq* pReq);
typedef struct {
int64_t id;
char name[TSDB_TABLE_NAME_LEN];
char tbFName[TSDB_TABLE_FNAME_LEN];
2025-12-29 11:27:11 +00:00
int64_t ownerId;
int32_t code;
int32_t version;
int8_t tbType;
int8_t intervalUnit;
col_id_t nFuncs;
col_id_t nColNames;
int64_t interval[2];
col_id_t* funcColIds;
func_id_t* funcIds;
SArray* colNames;
} SRsmaInfoRsp;
int32_t tSerializeRsmaInfoRsp(void* buf, int32_t bufLen, SRsmaInfoRsp* pReq);
int32_t tDeserializeRsmaInfoRsp(void* buf, int32_t bufLen, SRsmaInfoRsp* pReq);
void tFreeRsmaInfoRsp(SRsmaInfoRsp* pReq, bool deep);
2025-09-26 09:32:32 +00:00
typedef struct {
char name[TSDB_TABLE_FNAME_LEN];
int8_t igNotExists;
} SMDropRsmaReq;
int32_t tSerializeSMDropRsmaReq(void* buf, int32_t bufLen, SMDropRsmaReq* pReq);
int32_t tDeserializeSMDropRsmaReq(void* buf, int32_t bufLen, SMDropRsmaReq* pReq);
typedef struct {
char name[TSDB_TABLE_NAME_LEN];
char tbName[TSDB_TABLE_NAME_LEN];
int64_t uid;
int64_t tbUid;
int8_t tbType;
} SVDropRsmaReq;
int32_t tSerializeSVDropRsmaReq(void* buf, int32_t bufLen, SVDropRsmaReq* pReq);
int32_t tDeserializeSVDropRsmaReq(void* buf, int32_t bufLen, SVDropRsmaReq* pReq);
2022-12-22 14:23:03 +00:00
typedef struct {
char dbFName[TSDB_DB_FNAME_LEN];
char stbName[TSDB_TABLE_NAME_LEN];
char colName[TSDB_COL_NAME_LEN];
2023-02-23 06:04:07 +00:00
char idxName[TSDB_INDEX_FNAME_LEN];
2022-12-22 14:23:03 +00:00
int8_t idxType;
} SCreateTagIndexReq;
int32_t tSerializeSCreateTagIdxReq(void* buf, int32_t bufLen, SCreateTagIndexReq* pReq);
int32_t tDeserializeSCreateTagIdxReq(void* buf, int32_t bufLen, SCreateTagIndexReq* pReq);
2023-02-04 04:52:02 +00:00
typedef SMDropSmaReq SDropTagIndexReq;
2022-12-22 14:23:03 +00:00
2024-02-29 10:27:34 +00:00
// int32_t tSerializeSDropTagIdxReq(void* buf, int32_t bufLen, SDropTagIndexReq* pReq);
2023-01-04 12:36:01 +00:00
int32_t tDeserializeSDropTagIdxReq(void* buf, int32_t bufLen, SDropTagIndexReq* pReq);
typedef struct {
2022-06-07 12:49:27 +00:00
int8_t version; // for compatibility(default 0)
int8_t intervalUnit; // MACRO: TIME_UNIT_XXX
int8_t slidingUnit; // MACRO: TIME_UNIT_XXX
int8_t timezoneInt; // sma data expired if timezone changes.
int32_t dstVgId;
char indexName[TSDB_INDEX_NAME_LEN];
int32_t exprLen;
int32_t tagsFilterLen;
int64_t indexUid;
tb_uid_t tableUid; // super/child/common table uid
tb_uid_t dstTbUid; // for dstVgroup
int64_t interval;
int64_t offset; // use unit by precision of DB
int64_t sliding;
char* dstTbName; // for dstVgroup
char* expr; // sma expression
char* tagsFilter;
SSchemaWrapper schemaRow; // for dstVgroup
SSchemaWrapper schemaTag; // for dstVgroup
} STSma; // Time-range-wise SMA
typedef STSma SVCreateTSmaReq;
typedef struct {
2022-03-21 06:43:08 +00:00
int8_t type; // 0 status report, 1 update data
int64_t indexUid;
int64_t skey; // start TS key of interval/sliding window
2022-03-07 12:14:01 +00:00
} STSmaMsg;
typedef struct {
2022-03-21 06:43:08 +00:00
int64_t indexUid;
2022-03-10 07:34:15 +00:00
char indexName[TSDB_INDEX_NAME_LEN];
2022-03-07 12:14:01 +00:00
} SVDropTSmaReq;
2022-03-07 12:14:01 +00:00
typedef struct {
2022-03-16 10:29:31 +00:00
int tmp; // TODO: to avoid compile error
2022-03-07 12:14:01 +00:00
} SVCreateTSmaRsp, SVDropTSmaRsp;
#if 0
2022-03-07 12:14:01 +00:00
int32_t tSerializeSVCreateTSmaReq(void** buf, SVCreateTSmaReq* pReq);
void* tDeserializeSVCreateTSmaReq(void* buf, SVCreateTSmaReq* pReq);
int32_t tSerializeSVDropTSmaReq(void** buf, SVDropTSmaReq* pReq);
void* tDeserializeSVDropTSmaReq(void* buf, SVDropTSmaReq* pReq);
#endif
int32_t tEncodeSVCreateTSmaReq(SEncoder* pCoder, const SVCreateTSmaReq* pReq);
int32_t tDecodeSVCreateTSmaReq(SDecoder* pCoder, SVCreateTSmaReq* pReq);
int32_t tEncodeSVDropTSmaReq(SEncoder* pCoder, const SVDropTSmaReq* pReq);
2024-02-26 08:28:10 +00:00
// int32_t tDecodeSVDropTSmaReq(SDecoder* pCoder, SVDropTSmaReq* pReq);
typedef struct {
int32_t number;
STSma* tSma;
} STSmaWrapper;
2022-06-01 11:06:58 +00:00
static FORCE_INLINE void tDestroyTSma(STSma* pSma) {
if (pSma) {
2022-06-14 12:19:25 +00:00
taosMemoryFreeClear(pSma->dstTbName);
2022-03-25 16:29:53 +00:00
taosMemoryFreeClear(pSma->expr);
taosMemoryFreeClear(pSma->tagsFilter);
}
}
2022-06-01 11:06:58 +00:00
static FORCE_INLINE void tDestroyTSmaWrapper(STSmaWrapper* pSW, bool deepCopy) {
if (pSW) {
if (pSW->tSma) {
2022-05-16 15:55:17 +00:00
if (deepCopy) {
for (uint32_t i = 0; i < pSW->number; ++i) {
2022-06-01 11:06:58 +00:00
tDestroyTSma(pSW->tSma + i);
2022-05-16 15:55:17 +00:00
}
}
2022-03-25 16:29:53 +00:00
taosMemoryFreeClear(pSW->tSma);
}
}
}
2022-06-01 11:06:58 +00:00
static FORCE_INLINE void* tFreeTSmaWrapper(STSmaWrapper* pSW, bool deepCopy) {
tDestroyTSmaWrapper(pSW, deepCopy);
2022-05-16 15:55:17 +00:00
taosMemoryFreeClear(pSW);
2022-04-21 07:58:52 +00:00
return NULL;
2022-03-24 23:50:28 +00:00
}
int32_t tEncodeSVCreateTSmaReq(SEncoder* pCoder, const SVCreateTSmaReq* pReq);
int32_t tDecodeSVCreateTSmaReq(SDecoder* pCoder, SVCreateTSmaReq* pReq);
int32_t tEncodeTSma(SEncoder* pCoder, const STSma* pSma);
2022-06-14 12:19:25 +00:00
int32_t tDecodeTSma(SDecoder* pCoder, STSma* pSma, bool deepCopy);
static int32_t tEncodeTSmaWrapper(SEncoder* pEncoder, const STSmaWrapper* pReq) {
2024-07-26 13:39:27 +00:00
TAOS_CHECK_RETURN(tEncodeI32(pEncoder, pReq->number));
for (int32_t i = 0; i < pReq->number; ++i) {
2024-07-26 13:39:27 +00:00
TAOS_CHECK_RETURN(tEncodeTSma(pEncoder, pReq->tSma + i));
}
return 0;
}
2022-06-14 12:19:25 +00:00
static int32_t tDecodeTSmaWrapper(SDecoder* pDecoder, STSmaWrapper* pReq, bool deepCopy) {
2024-07-26 13:39:27 +00:00
TAOS_CHECK_RETURN(tDecodeI32(pDecoder, &pReq->number));
for (int32_t i = 0; i < pReq->number; ++i) {
2024-07-26 13:39:27 +00:00
TAOS_CHECK_RETURN(tDecodeTSma(pDecoder, pReq->tSma + i, deepCopy));
}
return 0;
}
2022-01-21 15:19:54 +00:00
2022-04-07 09:41:16 +00:00
typedef struct {
2022-04-07 13:32:30 +00:00
int idx;
2022-04-07 09:41:16 +00:00
} SMCreateFullTextReq;
int32_t tSerializeSMCreateFullTextReq(void* buf, int32_t bufLen, SMCreateFullTextReq* pReq);
int32_t tDeserializeSMCreateFullTextReq(void* buf, int32_t bufLen, SMCreateFullTextReq* pReq);
void tFreeSMCreateFullTextReq(SMCreateFullTextReq* pReq);
2022-04-07 14:04:38 +00:00
typedef struct {
char name[TSDB_TABLE_FNAME_LEN];
int8_t igNotExists;
} SMDropFullTextReq;
2024-02-29 10:27:34 +00:00
// int32_t tSerializeSMDropFullTextReq(void* buf, int32_t bufLen, SMDropFullTextReq* pReq);
// int32_t tDeserializeSMDropFullTextReq(void* buf, int32_t bufLen, SMDropFullTextReq* pReq);
2022-04-07 14:04:38 +00:00
2022-04-08 10:34:11 +00:00
typedef struct {
char indexFName[TSDB_INDEX_FNAME_LEN];
} SUserIndexReq;
int32_t tSerializeSUserIndexReq(void* buf, int32_t bufLen, SUserIndexReq* pReq);
int32_t tDeserializeSUserIndexReq(void* buf, int32_t bufLen, SUserIndexReq* pReq);
typedef struct {
char dbFName[TSDB_DB_FNAME_LEN];
char tblFName[TSDB_TABLE_FNAME_LEN];
char colName[TSDB_COL_NAME_LEN];
2025-12-29 11:27:11 +00:00
char owner[TSDB_USER_LEN];
2022-04-08 10:34:11 +00:00
char indexType[TSDB_INDEX_TYPE_LEN];
char indexExts[TSDB_INDEX_EXTS_LEN];
} SUserIndexRsp;
int32_t tSerializeSUserIndexRsp(void* buf, int32_t bufLen, const SUserIndexRsp* pRsp);
int32_t tDeserializeSUserIndexRsp(void* buf, int32_t bufLen, SUserIndexRsp* pRsp);
2022-06-07 09:25:01 +00:00
typedef struct {
char tbFName[TSDB_TABLE_FNAME_LEN];
} STableIndexReq;
int32_t tSerializeSTableIndexReq(void* buf, int32_t bufLen, STableIndexReq* pReq);
int32_t tDeserializeSTableIndexReq(void* buf, int32_t bufLen, STableIndexReq* pReq);
typedef struct {
int8_t intervalUnit;
int8_t slidingUnit;
int64_t interval;
int64_t offset;
int64_t sliding;
int64_t dstTbUid;
2022-06-09 05:24:04 +00:00
int32_t dstVgId;
SEpSet epSet;
char* expr;
2022-06-07 09:25:01 +00:00
} STableIndexInfo;
typedef struct {
2022-06-13 06:06:11 +00:00
char tbName[TSDB_TABLE_NAME_LEN];
char dbFName[TSDB_DB_FNAME_LEN];
2022-06-13 02:38:45 +00:00
uint64_t suid;
int32_t version;
2023-05-10 09:44:53 +00:00
int32_t indexSize;
SArray* pIndex; // STableIndexInfo
2022-06-07 09:25:01 +00:00
} STableIndexRsp;
int32_t tSerializeSTableIndexRsp(void* buf, int32_t bufLen, const STableIndexRsp* pRsp);
int32_t tDeserializeSTableIndexRsp(void* buf, int32_t bufLen, STableIndexRsp* pRsp);
2022-07-20 02:50:26 +00:00
void tFreeSerializeSTableIndexRsp(STableIndexRsp* pRsp);
2022-06-10 07:21:16 +00:00
void tFreeSTableIndexInfo(void* pInfo);
2022-06-07 09:25:01 +00:00
2022-02-28 12:46:23 +00:00
typedef struct {
int8_t mqMsgType;
int32_t code;
int32_t epoch;
2022-03-21 13:39:16 +00:00
int64_t consumerId;
int64_t walsver;
int64_t walever;
2022-02-28 12:46:23 +00:00
} SMqRspHead;
2022-04-20 13:36:55 +00:00
typedef struct {
SMsgHead head;
char subKey[TSDB_SUBSCRIBE_KEY_LEN];
int8_t withTbName;
int8_t useSnapshot;
int32_t epoch;
uint64_t reqId;
int64_t consumerId;
int64_t timeout;
2022-06-29 12:57:15 +00:00
STqOffsetVal reqOffset;
2023-10-08 08:06:15 +00:00
int8_t enableReplay;
int8_t sourceExcluded;
int8_t rawData;
2025-02-18 09:32:00 +00:00
int32_t minPollRows;
2024-05-28 10:34:37 +00:00
int8_t enableBatchMeta;
SHashObj* uidHash; // to find if uid is duplicated
2022-04-26 13:50:36 +00:00
} SMqPollReq;
2022-01-24 02:46:55 +00:00
2022-11-29 15:39:58 +00:00
int32_t tSerializeSMqPollReq(void* buf, int32_t bufLen, SMqPollReq* pReq);
int32_t tDeserializeSMqPollReq(void* buf, int32_t bufLen, SMqPollReq* pReq);
2024-05-30 11:41:22 +00:00
void tDestroySMqPollReq(SMqPollReq* pReq);
2022-11-21 12:38:42 +00:00
2022-02-10 03:22:50 +00:00
typedef struct {
2022-01-25 07:17:02 +00:00
int32_t vgId;
2022-02-23 08:04:06 +00:00
int64_t offset;
2022-01-25 07:17:02 +00:00
SEpSet epSet;
} SMqSubVgEp;
2022-05-11 06:42:20 +00:00
static FORCE_INLINE int32_t tEncodeSMqSubVgEp(void** buf, const SMqSubVgEp* pVgEp) {
int32_t tlen = 0;
tlen += taosEncodeFixedI32(buf, pVgEp->vgId);
tlen += taosEncodeFixedI64(buf, pVgEp->offset);
tlen += taosEncodeSEpSet(buf, &pVgEp->epSet);
return tlen;
}
static FORCE_INLINE void* tDecodeSMqSubVgEp(void* buf, SMqSubVgEp* pVgEp) {
buf = taosDecodeFixedI32(buf, &pVgEp->vgId);
buf = taosDecodeFixedI64(buf, &pVgEp->offset);
buf = taosDecodeSEpSet(buf, &pVgEp->epSet);
return buf;
}
2022-02-10 03:22:50 +00:00
typedef struct {
char topic[TSDB_TOPIC_FNAME_LEN];
char db[TSDB_DB_FNAME_LEN];
SArray* vgs; // SArray<SMqSubVgEp>
2022-01-25 07:17:02 +00:00
} SMqSubTopicEp;
int32_t tEncodeMqSubTopicEp(void** buf, const SMqSubTopicEp* pTopicEp);
void* tDecodeMqSubTopicEp(void* buf, SMqSubTopicEp* pTopicEp);
void tDeleteMqSubTopicEp(SMqSubTopicEp* pSubTopicEp);
2022-05-11 06:42:20 +00:00
2022-06-21 05:50:33 +00:00
typedef struct {
2022-06-29 12:57:15 +00:00
SMqRspHead head;
STqOffsetVal rspOffset;
2022-06-29 12:57:15 +00:00
int16_t resMsgType;
int32_t metaRspLen;
void* metaRsp;
2022-06-21 05:50:33 +00:00
} SMqMetaRsp;
int32_t tEncodeMqMetaRsp(SEncoder* pEncoder, const SMqMetaRsp* pRsp);
int32_t tDecodeMqMetaRsp(SDecoder* pDecoder, SMqMetaRsp* pRsp);
2024-05-30 11:41:22 +00:00
void tDeleteMqMetaRsp(SMqMetaRsp* pRsp);
2022-06-21 05:50:33 +00:00
#define MQ_DATA_RSP_VERSION 100
2024-04-19 05:48:17 +00:00
2024-09-09 08:05:32 +00:00
typedef struct {
SMqRspHead head;
STqOffsetVal rspOffset;
STqOffsetVal reqOffset;
int32_t blockNum;
int8_t withTbName;
int8_t withSchema;
SArray* blockDataLen;
SArray* blockData;
SArray* blockTbName;
SArray* blockSchema;
2024-04-19 05:48:17 +00:00
union {
struct {
int64_t sleepTime;
2024-09-09 08:05:32 +00:00
};
struct {
int32_t createTableNum;
SArray* createTableLen;
SArray* createTableReq;
2024-09-09 08:05:32 +00:00
};
struct {
int32_t len;
void* rawData;
};
2024-09-09 08:05:32 +00:00
};
void* data; // for free in client, only effected if type is data or metadata. raw data not effected
bool blockDataElementFree; // if true, free blockDataElement in blockData,(true in server, false in client)
bool timeout;
2024-09-09 08:05:32 +00:00
} SMqDataRsp;
2022-06-29 12:57:15 +00:00
int32_t tEncodeMqDataRsp(SEncoder* pEncoder, const SMqDataRsp* pObj);
2024-09-09 08:05:32 +00:00
int32_t tDecodeMqDataRsp(SDecoder* pDecoder, SMqDataRsp* pRsp);
int32_t tDecodeMqRawDataRsp(SDecoder* pDecoder, SMqDataRsp* pRsp);
2024-09-09 08:05:32 +00:00
void tDeleteMqDataRsp(SMqDataRsp* pRsp);
void tDeleteMqRawDataRsp(SMqDataRsp* pRsp);
2022-08-30 02:57:24 +00:00
2024-09-09 08:05:32 +00:00
int32_t tEncodeSTaosxRsp(SEncoder* pEncoder, const SMqDataRsp* pRsp);
int32_t tDecodeSTaosxRsp(SDecoder* pDecoder, SMqDataRsp* pRsp);
void tDeleteSTaosxRsp(SMqDataRsp* pRsp);
2022-08-30 02:57:24 +00:00
2024-05-23 09:35:54 +00:00
typedef struct SMqBatchMetaRsp {
2024-07-05 07:06:11 +00:00
SMqRspHead head; // not serialize
2024-05-23 09:35:54 +00:00
STqOffsetVal rspOffset;
SArray* batchMetaLen;
SArray* batchMetaReq;
void* pMetaBuff; // not serialize
uint32_t metaBuffLen; // not serialize
} SMqBatchMetaRsp;
int32_t tEncodeMqBatchMetaRsp(SEncoder* pEncoder, const SMqBatchMetaRsp* pRsp);
int32_t tDecodeMqBatchMetaRsp(SDecoder* pDecoder, SMqBatchMetaRsp* pRsp);
int32_t tSemiDecodeMqBatchMetaRsp(SDecoder* pDecoder, SMqBatchMetaRsp* pRsp);
void tDeleteMqBatchMetaRsp(SMqBatchMetaRsp* pRsp);
2022-03-17 09:48:21 +00:00
typedef struct {
int32_t code;
SArray* topics; // SArray<SMqSubTopicEp>
2022-04-26 09:08:42 +00:00
} SMqAskEpRsp;
2022-03-17 09:48:21 +00:00
2022-04-26 09:08:42 +00:00
static FORCE_INLINE int32_t tEncodeSMqAskEpRsp(void** buf, const SMqAskEpRsp* pRsp) {
2022-01-25 07:17:02 +00:00
int32_t tlen = 0;
2022-03-21 13:39:16 +00:00
// tlen += taosEncodeString(buf, pRsp->cgroup);
2022-01-25 07:17:02 +00:00
int32_t sz = taosArrayGetSize(pRsp->topics);
tlen += taosEncodeFixedI32(buf, sz);
for (int32_t i = 0; i < sz; i++) {
SMqSubTopicEp* pVgEp = (SMqSubTopicEp*)taosArrayGet(pRsp->topics, i);
tlen += tEncodeMqSubTopicEp(buf, pVgEp);
2022-01-25 07:17:02 +00:00
}
tlen += taosEncodeFixedI32(buf, pRsp->code);
2022-01-25 07:17:02 +00:00
return tlen;
}
2022-04-26 09:08:42 +00:00
static FORCE_INLINE void* tDecodeSMqAskEpRsp(void* buf, SMqAskEpRsp* pRsp) {
2022-03-21 13:39:16 +00:00
// buf = taosDecodeStringTo(buf, pRsp->cgroup);
2022-01-25 07:17:02 +00:00
int32_t sz;
buf = taosDecodeFixedI32(buf, &sz);
pRsp->topics = taosArrayInit(sz, sizeof(SMqSubTopicEp));
if (pRsp->topics == NULL) {
return NULL;
}
for (int32_t i = 0; i < sz; i++) {
SMqSubTopicEp topicEp;
buf = tDecodeMqSubTopicEp(buf, &topicEp);
2024-07-22 09:32:30 +00:00
if (buf == NULL) {
return NULL;
}
if ((taosArrayPush(pRsp->topics, &topicEp) == NULL)) {
return NULL;
}
2022-01-25 07:17:02 +00:00
}
buf = taosDecodeFixedI32(buf, &pRsp->code);
2022-01-25 07:17:02 +00:00
return buf;
}
2022-04-21 09:51:33 +00:00
2022-04-26 09:08:42 +00:00
static FORCE_INLINE void tDeleteSMqAskEpRsp(SMqAskEpRsp* pRsp) {
taosArrayDestroyEx(pRsp->topics, (FDelete)tDeleteMqSubTopicEp);
2022-04-26 09:08:42 +00:00
}
typedef struct {
int32_t vgId;
STqOffsetVal offset;
int64_t rows;
int64_t ever;
2023-09-01 07:11:25 +00:00
} OffsetRows;
2023-09-01 07:11:25 +00:00
typedef struct {
char topicName[TSDB_TOPIC_FNAME_LEN];
SArray* offsetRows;
} TopicOffsetRows;
typedef struct {
int64_t consumerId;
int32_t epoch;
SArray* topics;
int8_t pollFlag;
} SMqHbReq;
typedef struct {
char topic[TSDB_TOPIC_FNAME_LEN];
int8_t noPrivilege;
} STopicPrivilege;
typedef struct {
SArray* topicPrivileges; // SArray<STopicPrivilege>
int32_t debugFlag;
} SMqHbRsp;
typedef struct {
2023-09-01 07:11:25 +00:00
SMsgHead head;
int64_t consumerId;
char subKey[TSDB_SUBSCRIBE_KEY_LEN];
} SMqSeekReq;
2022-05-05 06:51:47 +00:00
#define TD_AUTO_CREATE_TABLE 0x1
typedef struct {
2022-05-23 07:47:49 +00:00
int64_t suid;
int64_t uid;
int32_t sver;
uint32_t nData;
uint8_t* pData;
SVCreateTbReq cTbReq;
2022-05-05 06:51:47 +00:00
} SVSubmitBlk;
2022-05-31 05:37:10 +00:00
typedef struct {
2022-06-05 12:33:21 +00:00
SMsgHead header;
uint64_t sId;
uint64_t queryId;
uint64_t clientId;
2022-06-05 12:33:21 +00:00
uint64_t taskId;
uint32_t sqlLen;
uint32_t phyLen;
char* sql;
char* msg;
2024-03-04 06:58:13 +00:00
int8_t source;
int8_t secureDelete;
2022-05-31 05:37:10 +00:00
} SVDeleteReq;
2022-06-07 12:49:27 +00:00
int32_t tSerializeSVDeleteReq(void* buf, int32_t bufLen, SVDeleteReq* pReq);
int32_t tDeserializeSVDeleteReq(void* buf, int32_t bufLen, SVDeleteReq* pReq);
2022-06-04 10:44:39 +00:00
2022-05-31 05:37:10 +00:00
typedef struct {
2022-06-04 10:44:39 +00:00
int64_t affectedRows;
2022-05-31 05:37:10 +00:00
} SVDeleteRsp;
2022-06-04 10:44:39 +00:00
int32_t tEncodeSVDeleteRsp(SEncoder* pCoder, const SVDeleteRsp* pReq);
int32_t tDecodeSVDeleteRsp(SDecoder* pCoder, SVDeleteRsp* pReq);
2022-06-28 10:01:56 +00:00
typedef struct SDeleteRes {
uint64_t suid;
SArray* uidList;
int64_t skey;
int64_t ekey;
int64_t affectedRows;
char tableFName[TSDB_TABLE_NAME_LEN];
char tsColName[TSDB_COL_NAME_LEN];
2023-09-01 07:11:25 +00:00
int64_t ctimeMs; // fill by vnode
2024-03-04 06:58:13 +00:00
int8_t source;
int8_t secureDelete; // force physical overwrite
2022-06-28 10:01:56 +00:00
} SDeleteRes;
int32_t tEncodeDeleteRes(SEncoder* pCoder, const SDeleteRes* pRes);
int32_t tDecodeDeleteRes(SDecoder* pCoder, SDeleteRes* pRes);
typedef struct {
// int64_t uid;
char tbname[TSDB_TABLE_NAME_LEN];
2022-11-29 15:39:58 +00:00
int64_t startTs;
int64_t endTs;
} SSingleDeleteReq;
int32_t tEncodeSSingleDeleteReq(SEncoder* pCoder, const SSingleDeleteReq* pReq);
int32_t tDecodeSSingleDeleteReq(SDecoder* pCoder, SSingleDeleteReq* pReq);
typedef struct {
int64_t suid;
SArray* deleteReqs; // SArray<SSingleDeleteReq>
int64_t ctimeMs; // fill by vnode
2023-11-10 06:44:29 +00:00
int8_t level; // 0 tsdb(default), 1 rsma1 , 2 rsma2
} SBatchDeleteReq;
int32_t tEncodeSBatchDeleteReq(SEncoder* pCoder, const SBatchDeleteReq* pReq);
int32_t tDecodeSBatchDeleteReq(SDecoder* pCoder, SBatchDeleteReq* pReq);
int32_t tDecodeSBatchDeleteReqSetCtime(SDecoder* pDecoder, SBatchDeleteReq* pReq, int64_t ctimeMs);
2022-07-26 10:00:50 +00:00
typedef struct {
2022-08-03 13:08:52 +00:00
int32_t msgIdx;
2022-07-26 10:00:50 +00:00
int32_t msgType;
int32_t msgLen;
void* msg;
} SBatchMsg;
typedef struct {
2022-11-29 15:39:58 +00:00
SMsgHead header;
SArray* pMsgs; // SArray<SBatchMsg>
} SBatchReq;
2022-07-26 10:00:50 +00:00
typedef struct {
int32_t reqType;
2022-08-03 13:08:52 +00:00
int32_t msgIdx;
2022-07-26 10:00:50 +00:00
int32_t msgLen;
int32_t rspCode;
void* msg;
2022-11-17 02:35:25 +00:00
} SBatchRspMsg;
typedef struct {
2022-11-29 15:39:58 +00:00
SArray* pRsps; // SArray<SBatchRspMsg>
2022-07-26 10:00:50 +00:00
} SBatchRsp;
2022-11-29 15:39:58 +00:00
int32_t tSerializeSBatchReq(void* buf, int32_t bufLen, SBatchReq* pReq);
int32_t tDeserializeSBatchReq(void* buf, int32_t bufLen, SBatchReq* pReq);
2022-11-17 08:31:22 +00:00
static FORCE_INLINE void tFreeSBatchReqMsg(void* msg) {
if (NULL == msg) {
return;
}
SBatchMsg* pMsg = (SBatchMsg*)msg;
taosMemoryFree(pMsg->msg);
}
2022-11-29 15:39:58 +00:00
int32_t tSerializeSBatchRsp(void* buf, int32_t bufLen, SBatchRsp* pRsp);
int32_t tDeserializeSBatchRsp(void* buf, int32_t bufLen, SBatchRsp* pRsp);
2022-11-17 02:35:25 +00:00
static FORCE_INLINE void tFreeSBatchRspMsg(void* p) {
2022-07-26 10:00:50 +00:00
if (NULL == p) {
return;
}
2022-11-17 02:35:25 +00:00
SBatchRspMsg* pRsp = (SBatchRspMsg*)p;
2022-07-26 10:00:50 +00:00
taosMemoryFree(pRsp->msg);
}
2022-11-29 15:39:58 +00:00
int32_t tSerializeSMqAskEpReq(void* buf, int32_t bufLen, SMqAskEpReq* pReq);
int32_t tDeserializeSMqAskEpReq(void* buf, int32_t bufLen, SMqAskEpReq* pReq);
int32_t tSerializeSMqHbReq(void* buf, int32_t bufLen, SMqHbReq* pReq);
int32_t tDeserializeSMqHbReq(void* buf, int32_t bufLen, SMqHbReq* pReq);
2024-03-12 11:42:26 +00:00
void tDestroySMqHbReq(SMqHbReq* pReq);
int32_t tSerializeSMqHbRsp(void* buf, int32_t bufLen, SMqHbRsp* pRsp);
int32_t tDeserializeSMqHbRsp(void* buf, int32_t bufLen, SMqHbRsp* pRsp);
2024-03-12 11:42:26 +00:00
void tDestroySMqHbRsp(SMqHbRsp* pRsp);
2023-09-01 07:11:25 +00:00
int32_t tSerializeSMqSeekReq(void* buf, int32_t bufLen, SMqSeekReq* pReq);
int32_t tDeserializeSMqSeekReq(void* buf, int32_t bufLen, SMqSeekReq* pReq);
2022-11-17 06:09:15 +00:00
2024-02-22 02:58:32 +00:00
#define TD_REQ_FROM_APP 0x0
2022-11-29 07:13:19 +00:00
#define SUBMIT_REQ_AUTO_CREATE_TABLE 0x1
#define SUBMIT_REQ_COLUMN_DATA_FORMAT 0x2
2024-02-03 16:24:42 +00:00
#define SUBMIT_REQ_FROM_FILE 0x4
2024-02-22 02:58:32 +00:00
#define TD_REQ_FROM_TAOX 0x8
#define TD_REQ_FROM_SML 0x10
feat(stream): optimize stream logic (#33027) * fix: remove debug log * fix: remove assert * fix: delete unused code * enh: [TD-37251] Support expr in state window. * feat(stream): support expr in state window trigger * enh: [TD-37251] Fix SCL_IS_CONST_CALC condition. * fix(stream): set ver in wal * fix: print code * fix: increase runner replica num * fix: trigger mem error * fix: sliding _tnext_ts value * fix(stream): disable tagFilterCache in stream reader trigger * fix: crash * Revert "fix(stream): fix history calc finish check" This reverts commit f93d17f1d27f011639d22cb0880637dbeb7e5532. * Revert "fix(stream): fix calc request allocation in trigger" This reverts commit c5410f6da09835303d32967f4b6d02a7e47cd589. * fix(stream): fix calc request allocation in trigger * enh: [TD-37251] External window support more placeholder. * fix(stream): modify size of return from 1000000->4096 * enh: [TD-37251] Modify error msg when stream query do not have from clause. * fix(stream): add log for group not found * fix(stream): do not return gid=0 in walMetaData interface * enh: [TD-37251] Fix missing ts column in vtable query. * fix: test case build failed * fix: invalid read issue * fix(stream): add vtable logic * fix(stream): encode error in wal * fix(stream): add vtable logic * fix(stream): add log * fix: diff funcition crash * Revert "Merge branch 'enh/TD-37251-3.0-dropoutput' into enh/TD-37251-3.0" This reverts commit e93cbd6fd42261527df046c70e0ece7568af187b, reversing changes made to dc3230591d4428c817703f52574aa01d5f10e5fe. * Revert "Merge branch 'enh/TD-37251-3.0-vtable' into enh/TD-37251-3.0" This reverts commit dc3230591d4428c817703f52574aa01d5f10e5fe, reversing changes made to 085e086782896db22acd292816e53497cbecb726. * fix(stream): fix block data len is too large if data type is vchar * fix: drop output table * feat: runner delete output table * process pDropBlock in trigger task. * fix(stream): opti log level * fix(stream): build block for drop table * fix(stream): set gid for normal table * fix(stream): set gid for normal table * feat: Support delete output. * fix(stream): rows error * fix(stream): memory leak * enh: [TD-37251] Fix external window wrong ts column. * fix(stream): fix calc time check in batch mode * fix: merge aligned external window issue * Revert "fix(stream): fix calc time check in batch mode" This reverts commit d895b7f5776cf77c2ce290cdeedca86c206da6ce. * fix(stream): add test case * fix(stream): add insert drop table logic * fix: external window end issue * fix(stream): add test case * fix(stream): fix trigger pull data * fix(stream): fix history calc request * enh: drop table on snode * fix(stream): adjust hash index if data is filtered in wal * fix(stream): rollback * enh: add merge aligned extwin window row idx * fix: drop output table * fix: compile issue * enh: [TD-37251] Add flag to identify interval window is overlapped * fix: overlap * fix(stream): set gid=-1 for initialized * fix(stream): modify log level * fix: trigger slow issue * fix(stream): add basic test for obj pool * fix(stream): fix metadata clear in trigger * fix(stream): fix idle runner allocation in trigger * fix: handle agg output on externalWin * fix: test case * fix(stream): adjust log * fix: reset pCtx pOutput * fix: memory leak * fix: search first win for tsCol * fix(stream): add test case for schema change * fix: mem leak * fix: mem leak * Reapply "Merge branch 'enh/TD-37251-3.0-vtable' into enh/TD-37251-3.0" This reverts commit b508e66958eb95117b1d086a964b87b5ac59a19e. * fix(stream): fix virtual table data pull * fix(stream): fix set table request * fix(stream): process empty uidlist * fix(stream): fix set table request * fix(stream): fix data new request in trigger * fix(stream): tablelist error for vtable * fix(stream): block ver is null * fix(stream): remove version limition for wal * fix(stream): block rows error * fix(stream): fix pending calc param in batch mode * fix(stream): auto create table * fix(stream): fix stream vtable data merge * fix: _tcurrentts * fix(stream): destroy hash * fix(stream): fix trigger status * fix(stream): colId error in vtable * fix(stream): update nrows of vtable data block * fix(stream): fix trigger status * fix(stream): enable low latency calc for period trigger * fix: test case file path * fix: test case file path * fix: string to node in reader * enh: add test log * fix(stream): increase wait time of non-low-latency mode * fix(stream): fix column capacity in scalar calculation * fix(stream): fix column capacity in trigger expr calculation * fix: get origTableInfos * fix(stream): fix calc data pull in trigger * fix(stream): fix calc data cache write in trigger * enh: [TD-37251] Add flag to identify interval wind * fix: external window memory usage issue * fix(stream): fix epxr result column in trigger * fix(stream): add metaCache for calc plan * fix(stream): fix stream obj list clear * fix(stream): rollback * enh: [TD-37251] Add flag to identify interval wind * fix: mem free * fix(stream): add metaCache for calc plan * fix(stream): fix calc data cache write in trigger * fix(stream): fix calc data cache write in trigger * enh: optimize external result block memory * fix(stream): modify logic of judge table for create table * fix(stream): fix event window check in trigger * fix(stream): fix count window check in trigger * fix(stream): colSize=0 while encoding block because pDataCol->hasNull is false in secode time & reload table list if create table * enh: optimize stream memory * fix(stream): trigger tag error * fix: add log * fix(stream): fix calc data write in trigger * fix: drop output table * fix(stream): fix max delay in trigger * fix: drop output table * fix(stream): fix max delay in trigger * fix(build): handle return value of function * fix(stream): read gid error if it is child table in stream * fix(stream): fix calc param of history calculation * fix(stream): fix recalc of delete data * fix(stream): fix calc data of period trigger * fix(stream): fix cache read check * fix(stream): filter error in calc plan * fix: reset externla window expr * fix(stream): fix calc parm of max delay * fix: time range and case issues * fix(stream): fix crash in trigger * fix: case issues * fix: fix window node mem leak. * fix(stream): fix meta data clear in trigger * fix(stream): table schema is old in TsdbDataRequest for vtable * fix: fix slingding window place holder check condition. * Revert "fix: fix slingding window place holder check condition." This reverts commit ad864a1dc113961b409e32e2ac7d1feb534b74d6. * fix(stream): null pointer error * fix: case issue * fix(stream): calc data error for vtable * fix(stream): fix data sorter in trigger * fix(stream): add log for delete data * fix(stream): fix start version of realtime calculation * fix(stream): fix cache data merger of vtable * fix: case issues * fix(ci): upgrade stream cases in test_cols_function * fix(stream): gid not found if change tag value * fix: fix slingding window place holder check condition. * fix(stream): fix virt table info request in trigger * fix(stream): set gid = uid if stream table type != SUPER table * fix: clean cache data by group * fix: add block info and case issues * fix: fix heap-buffer-overflow. * fix(stream): fix state window with extend param * fix: fix access null pointer. * fix: case issues * fix: case issue * fix(stream): fix ignore_nodata_trigger option for period trigger * fix(stream): fix pseudo col fetch for calc data * fix: Extend checking time to avoid timeout. * fix: case issues * fix(stream): fix group col fetch for virtual tables * fix(stream): tag is NULL for non vtable * fix(stream): fix sliding check of virtual table * test(stream): check stream status after create all streams * fix: add log * fix(stream): fix wal meta truncate when ignore disorder * fix(stream): gid not found for child table * fix: fix place holder condition pushdown error. * fix(stream): suid not equal when delete data for child table * fix: id issue * fix(stream): disable recalc for count trigger * fix: cast result rowSize error in project * fix(stream): add log for tsdb meta * fix(stream): fix gid in tsdb meta request * fix(stream): fix wend of unclosed windows * fix(stream): fix ignore_nodata_trigger option for period trigger * fix: case issues * fix(stream): fix calc data pull for empty interval window * fix: fix ext window condition. * fix(ci): smaBasic performance check affectd by debug level log * fix(stream): add suid when set table list for vtable * fix: forbid using prefilter when using %%trows an trigger table is virtual table. * fix: forbid prefilter %%trows cases. * fix(stream): sort cid in tsdbVirtalDataReq * fix: forbid prefilter %%trows cases. * fix(stream): add log for virtual table tsdb data * fix(stream): get delete msg for vtable * fix: winRowIndex * Revert "fix: winRowIndex" This reverts commit e08b41cf960bb9ca031b9ea20b4495cbbd4e3ed0. * fix(stream): fix data merge in trigger * test(stream): fix case ans * fix(stream): fix empty calc data pull for period trigger * fix(stream): col index error for tsdbVirtalDataReq * fix(stream): pTableList is NULL for vtable * test(stream): fix case ans * fix(stream): fix notification in trigger * fix(stream): memory leak * fix(stream): fix virtual data pull in trigger * test(stream): fix case ans * fix(stream): col index error for tsdbVirtalDataReq * fix(stream): pTableList is NULL for vtable * test(stream): fix case ans * fix(stream): fix notification in trigger * fix(stream): memory leak * fix(stream): fix virtual data pull in trigger * test(stream): fix case ans * fix: case issue * fix: crash issue * fix: forbid prefilter %%trows cases. * fix(stream): session case * fix(stream): fix data pull for virtual tables * fix(stream): add log * fix(stream): fix calc req send in batch mode * fix: fix stream UT * fix(stream): tablelist is null for non vtable * fix: mem leak * fix(stream): fix compile error in trigger * fix: return code issue --------- Co-authored-by: dapan1121 <wpan@taosdata.com> Co-authored-by: facetosea <285808407@qq.com> Co-authored-by: Jing Sima <simondominic9997@outlook.com> Co-authored-by: Jinqing Kuang <kuangjinqingcn@gmail.com> Co-authored-by: Tony Zhang <tonyzhang@taosdata.com>
2025-09-25 07:48:14 +00:00
#define SUBMIT_REQUEST_VERSION (2)
Feat/ts 6100 3.0.0722m (#32103) * migrate system-test/2-query * revert file * update case.task * resolve script migrate * run new test framework on new_testcases * migrate system-test/2-query * format docstring * fix test validation * fix test validation * fix error * migrate army case * migrate army case * fix error * migrate system-test/2-query * migrate system-test/2-query * migrate system-test/2-query * migrate system-test/2-query * test exe time * fix ci error * migrate system-test/1-insert * new common function * migrate system-test/1-insert * fix ci error * migrate system-test/1-insert * feat: add configuration and script for memory allocator settings * fix: correct HEAPPROFILE path and remove redundant metadata_thp setting in memory allocator script * fix ci error * migrate system-test/1-insert, 2-query * feat:insert into subquery (#31401) (#31710) * migrate system-test/99-TDcase * feat(gpt): add grant check for gpt. (#31708) * migrate system-test/99-TDcase * migrate system-test/99-TDcase * migrate system-test/99-TDcase * fix/send-heartbeat-statis (#31680) * migrate system-test/7-tmq * chore: support cmake option TAOSWS_GIT_TAG like taosadapter [skip ci] (#31486) * add system-test/6/cluster test * chore: move default branch from main to 3.3.6 for adapter/taosws * fix docstring validation * migrate system-test/7-tmq * migrate system-test/7-tmq * feat: add set_taos_malloc_env configuration and update related scripts * Update 03-kubernetes.md * enh: add log for snapshot (#31681) * simple test * more * migrate system-test/7-tmq * migrate system-test 0-others cases * migrate system-test/7-tmq * fix docstring validation * migrate system-test/7-tmq * fix docstring validation * fix: invalid queue * fix docstring validation * refactor: reorganize memory allocator script constants and improve mode descriptions * enh: TD-36324-improve-sync-heartbeat-log (#31727) * recover log level * fix: taosd crush in query when insufficient memory (#31746) Co-authored-by: Tony Zhang <tonyzhang@taosdata.com> * fix: overflow check in snprintf (#31780) * migrate system-test/7-tmq * migrate some cases * migrate system-test/7-tmq * fix failed cases * fix failed cases * migrate some cases * fix failed cases * fix failed cases * migrate testcases * fix: update environment file path in taosd.service and adjust set_taos_malloc.sh configuration * fix: set lcn before do s3 migrate. (#31782) * migrate testcases * fix failed cases * fix: add condition to set default malloc config for taosd service * fix: update usage message in set_taos_malloc.sh to include quiet mode option * fix: add quiet mode option to set malloc config in install script * fix: update set_taos_malloc.sh to improve output messages and adjust default malloc config invocation * recover log level * fix(tmq): [TS-6569]tdb error if write tmq meta data in multi thread (#31808) * fix: the calculation of dnode uptime (#31832) * migrate testcase * fix: correct timediff function bug and redress docs (#31798) * fix: enhance malloc configuration for taosd and taosadapter in install script * fix: TD-36442 show full condition (#31796) * enh/TD-36466-sync-heartbeat (#31805) * fix(plan) virtual table support BI moudle when use in select (#31787) * fix failed cases * enh: TS-5926-force-repair-wal (#31828) * migrate testcase * rename taos & taosd (#31855) * migrate testcase * migrate testcase * fix failed cases * fix: update environment file paths in taosd.service and set_taos_malloc.sh * feat: add performance tuning documentation for memory optimization and set_taos_malloc.sh usage * fix: update file paths in performance tuning documentation for consistency * feat: add performance tuning documentation for memory allocator configuration script * fix: add missing line breaks for improved readability in performance tuning documentation * fix: adjust heading levels for consistency in performance tuning documentation * fix cases * fix new_testcases * fix failed cases * fix(query): support show tags on virtual table (#31831) * fix failed cases * docs: replace mysql screenshot (#31888) * feat: use the new TDengine product name (#31859) * merge 3.0 * fix failed cases * fix failed cases * merge 3.0 * fix cases * fix cases * doc: Update 03-stream.md (#31675) * chore(deps): bump requests from 2.27.1 to 2.32.4 in /test (#31326) Bumps [requests](https://github.com/psf/requests) from 2.27.1 to 2.32.4. - [Release notes](https://github.com/psf/requests/releases) - [Changelog](https://github.com/psf/requests/blob/main/HISTORY.md) - [Commits](https://github.com/psf/requests/compare/v2.27.1...v2.32.4) --- updated-dependencies: - dependency-name: requests dependency-version: 2.32.4 dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * fix new cases * fix:Convert line endings from LF to CRLF for ans file * build(deps): bump golang.org/x/net in /tools/keeper (#30811) Bumps [golang.org/x/net](https://github.com/golang/net) from 0.36.0 to 0.38.0. - [Commits](https://github.com/golang/net/compare/v0.36.0...v0.38.0) --- updated-dependencies: - dependency-name: golang.org/x/net dependency-version: 0.38.0 dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps): bump urllib3 from 1.26.20 to 2.5.0 in /test (#31414) Bumps [urllib3](https://github.com/urllib3/urllib3) from 1.26.20 to 2.5.0. - [Release notes](https://github.com/urllib3/urllib3/releases) - [Changelog](https://github.com/urllib3/urllib3/blob/main/CHANGES.rst) - [Commits](https://github.com/urllib3/urllib3/compare/1.26.20...2.5.0) --- updated-dependencies: - dependency-name: urllib3 dependency-version: 2.5.0 dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps): bump org.apache.tomcat.embed:tomcat-embed-core (#31392) Bumps org.apache.tomcat.embed:tomcat-embed-core from 9.0.104 to 9.0.106. --- updated-dependencies: - dependency-name: org.apache.tomcat.embed:tomcat-embed-core dependency-version: 9.0.106 dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps): bump org.apache.tomcat.embed:tomcat-embed-core (#31393) Bumps org.apache.tomcat.embed:tomcat-embed-core from 9.0.104 to 9.0.106. --- updated-dependencies: - dependency-name: org.apache.tomcat.embed:tomcat-embed-core dependency-version: 9.0.106 dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps): bump org.apache.kafka:kafka-clients (#31341) Bumps org.apache.kafka:kafka-clients from 3.9.0 to 3.9.1. --- updated-dependencies: - dependency-name: org.apache.kafka:kafka-clients dependency-version: 3.9.1 dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * fix: add lock when calculating log buffer start/end (#31883) * fix new cases * fix new cases * fix failed cases * feat: new stream (#31678) * fix: windows compile issue * test: add vtable cases (#31829) * fix: windows compile issues * test:add test cases * fix: windows compile issue * case: em-4 stream case submit * test: stream4_sub1 found bug2 * test: submit test_scene_meters_bug2.py * add stream parameters example * feat: [TS-6100] Do not translate const value as column. * Feat/ts 6100 3.0 zlv (#31747) * modify asan exampel * modify asan exampel * add example * add example * modify case example --------- Co-authored-by: zelv01 <1101510017@qq.com> * feat(stream): fix memory leak * modify sliding example * test: update test case. * feat(stream): fix conflicts * fix: add offset case 10a 10s 10m 10h 10d * feat(stream): fix conflicts * chore(stream): rename case name #TS-6100 * add case * modify example * fix: windows compile issues * fix: data null check * feat: [TS-6100] Forbid where when using %%trows (#31827) * feat: [TS-6100] Forbid where when using %%trows * test: update cases * feat: [TS-6100] Fix leaks. --------- Co-authored-by: Simon Guan <guanshengliang@qq.com> * test: reproduce bugs * test: update test case. * test: update test case. * feat: [TS-6100] Fix leaks. * test: add cases * Feat/ts 6100 3.0.pw10 (#31841) * enh: add operator reset func * fix: merge join reset issue * fix: memory issues * fix: add debug assert * fix: memory issues * fix: memory leak * fix: memory issues * fix taos log miss * fix: case issue * fix: case issue * fix: case issues * fix: drop dnode issue * fix: memory issues * fix: memory issues * fix: memory leak issues * fix: recalculate time range issue * fix: add debug log * fix: memory issues * fix: enable case asan * Update streamlist_for_ci.task * fix: case asan issue * fix: stream name issue * fix: external window compile issues * fix: deploy memory issue * fix: ahandle issue * fix: ahandle issue * fix: ahandle issue * fix: virtual table reader list issue * fix: log info * fix: msg error * fix: virtual table addr list issue * fix: memory issues * fix: memory leak issue * fix: memory issues * fix: memory free issues * fix: memory issues * fix: snode deploy issue * fix: mnode reader issue * fix: memory issues * fix: add debug test * enh: add ignore nodata trigger * fix: memory leaks * fix: configuration issue * fix: memory issue * fix: external window issue * fix: external window issues * fix: external window placeholder issue * fix: placeholder function init issues * fix: memory leak issue * fix: add debug log * fix: compile issues * fix: double free issue * fix: runner addr update issue * fix: msg rsp issue * fix: external window reset issue * fix: configuration issue * fix: deploy msg issue * fix: compile issue --------- Co-authored-by: huohong <sallyhuo@taosdata.com> * test: reproduce bugs * fix: add sliding interval combine case * test: add cases * test: add recalc test. * test: reproduce bugs * case : add vt ts is null check * modify case * bug: submit test_idmp_meters_bug3.py * test: add test for recalc. * test: add cases * fix: error code check * test: add cases * fix(stream): scan wal with schema in that version * add case * test: add cases * test: update test case. * fix: windows compile issues * add case * test: add cases (#31845) * modify case * fix: reset interpPrev * test: add test_idmp_meters bug4 and bug3 * add case * fix(stream): opti wal interface * fix: remove test_idmp_meters_bug5.py * test: add cases * fix(stream): fix ts data fetch for virtual tables * cancel asan case * test: update test case. * test: update test case. * add case * test: add cases * test: add cases * test: add case test_idmp_meters_bug5.py * test: update test case. * fix(stream): tmq error * test: add cases * feat: [TS-6100] Restore deleted code in mndSma.c since they are still in use. * fix(stream): optimize val scan logic * test: add test_recalc_expired_time.py to ci. * test: update test case. * test: update test case. * feat: [TS-6100] Fix fill range check * fix(stream): optimize val scan logic * add case * test: modify for partition by %%1 * test: add fun case stream4_sub7 * fix(stream): optimize val scan logic * add case * feat: [TS-6100] Rename OPTIONS to STREAM_OPTIONS. * test: add test for recalc. * test: use stream_options. * fix: some cases error. * test: remove recalc from ci. * fix: ci case issues (#31880) * enh: add operator reset func * fix: merge join reset issue * fix: memory issues * fix: add debug assert * fix: memory issues * fix: memory leak * fix: memory issues * fix taos log miss * fix: case issue * fix: case issue * fix: case issues * fix: drop dnode issue * fix: memory issues * fix: memory issues * fix: memory leak issues * fix: recalculate time range issue * fix: add debug log * fix: memory issues * fix: enable case asan * Update streamlist_for_ci.task * fix: case asan issue * fix: stream name issue * fix: external window compile issues * fix: deploy memory issue * fix: ahandle issue * fix: ahandle issue * fix: ahandle issue * fix: virtual table reader list issue * fix: log info * fix: msg error * fix: virtual table addr list issue * fix: memory issues * fix: memory leak issue * fix: memory issues * fix: memory free issues * fix: memory issues * fix: snode deploy issue * fix: mnode reader issue * fix: memory issues * fix: add debug test * enh: add ignore nodata trigger * fix: memory leaks * fix: configuration issue * fix: memory issue * fix: external window issue * fix: external window issues * fix: external window placeholder issue * fix: placeholder function init issues * fix: memory leak issue * fix: add debug log * fix: compile issues * fix: double free issue * fix: runner addr update issue * fix: msg rsp issue * fix: external window reset issue * fix: configuration issue * fix: deploy msg issue * fix: compile issue * fix: external window idx issue * fix: ci issues --------- Co-authored-by: huohong <sallyhuo@taosdata.com> * fix(stream): fix compilation error * fix(stream): optimize val scan logic * test:add test cases * test: modify case * fix: external agg error * test(stream): tobacco scene testing #TD-36514 * test: add stream cases (#31885) * fix: windows compile issue * fix: calc timerange * fix: windows compile issue * modify case * fix(stream): compile error * test: remove one debug test case file * test: modify * test: add test cases * test: reproduce bugs * test: reproduce bugs * feat: [TS-6100] Placeholder function should only appera in SELECT and… (#31868) * feat: [TS-6100] Placeholder function should only appera in SELECT and WHERE and FROM. * test: update case --------- Co-authored-by: Simon Guan <guanshengliang@qq.com> * add example * add example * modify case example * modify case * test:alter sql * test: add stream5 case * fix(stream): get schema error with version * test: add delete recalc test py. * test: remove bug cases * test: stream5 case test passed * test: add state cases (#31893) * fix(stream): compile error * test: modify case * test: add cases * test: add test. * test: update test case. * chore(test): fix case err * test: update test case. * fix: align data get * fix(stream): fix row index of datablock written into data cache * fix: put align data * test: update test case. * test: add test cases for virtual table * chore(test): fix case err #TD-36514 * add case * test: add test for water mark. * test: add meters bug6 for stream5 * test: add cases (#31903) * test: add test for recalc. * feat: [TS-6100] %%trows can only be used when event type is window close. * test: add precision of database for ms/us/ns * modify case * add case * add case * test: add test to ci. * modify case * fix: ci case issues (#31904) * enh: add operator reset func * fix: merge join reset issue * fix: memory issues * fix: add debug assert * fix: memory issues * fix: memory leak * fix: memory issues * fix taos log miss * fix: case issue * fix: case issue * fix: case issues * fix: drop dnode issue * fix: memory issues * fix: memory issues * fix: memory leak issues * fix: recalculate time range issue * fix: add debug log * fix: memory issues * fix: enable case asan * Update streamlist_for_ci.task * fix: case asan issue * fix: stream name issue * fix: external window compile issues * fix: deploy memory issue * fix: ahandle issue * fix: ahandle issue * fix: ahandle issue * fix: virtual table reader list issue * fix: log info * fix: msg error * fix: virtual table addr list issue * fix: memory issues * fix: memory leak issue * fix: memory issues * fix: memory free issues * fix: memory issues * fix: snode deploy issue * fix: mnode reader issue * fix: memory issues * fix: add debug test * enh: add ignore nodata trigger * fix: memory leaks * fix: configuration issue * fix: memory issue * fix: external window issue * fix: external window issues * fix: external window placeholder issue * fix: placeholder function init issues * fix: memory leak issue * fix: add debug log * fix: compile issues * fix: double free issue * fix: runner addr update issue * fix: msg rsp issue * fix: external window reset issue * fix: configuration issue * fix: deploy msg issue * fix: compile issue * fix: external window idx issue * fix: ci issues * fix: ci case issues * fix: drop dnode issue --------- Co-authored-by: huohong <sallyhuo@taosdata.com> * fix(stream): ci error * test: update test case. * feat: [TS-6100] Disable some failed UT. * feat: [TS-6100] Fix virtual table * test: add bug 5. * test: add test delete recalc to ci. * test: add bug 6. * test(stream): tobacco scene #TD-36514 * fix: reqCids,reqCols memory leak in SSTriggerRealtimeContext Co-authored-by: Tony Zhang <tonyzhang@taosdata.com> * test: add case stream6 * fix(stream): implement some pending features in trigger task * modify case * modify case * fix: case issues * modify case * test: add recalc for warter mark. * fix(stream): fix count window trigger of virtual tables * fix(stream): memory leak * test: fix run err. * test: add stream6 bug7 * fix: adjust format * test(stream): tobacco scene testing #TD-36514 * test: change bug7 with update window1 and 2 * test: add test bug 7. * case: restore write 3 window * fix: windows compile issue * fix: notify * test: add cases * modify case * test: update test case. * test(stream): toobacco scene testing #TD-36514 --------- Co-authored-by: Simon Guan <slguan@taosdata.com> Co-authored-by: plum-lihui <huili@taosdata.com> Co-authored-by: Alex Duan <417921451@qq.com> Co-authored-by: zelv01 <1101510017@qq.com> Co-authored-by: Jing Sima <simondominic9997@outlook.com> Co-authored-by: xiangyang guo <66111494+happyguoxy@users.noreply.github.com> Co-authored-by: wangmm0220 <wangmm0220@gmail.com> Co-authored-by: Haojun Liao <hjliao@taosdata.com> Co-authored-by: zyyang90 <zyyang@taosdata.com> Co-authored-by: Alex Duan <51781608+DuanKuanJun@users.noreply.github.com> Co-authored-by: facetosea <285808407@qq.com> Co-authored-by: Simon Guan <guanshengliang@qq.com> Co-authored-by: huohong <sallyhuo@taosdata.com> Co-authored-by: Li Hui <52318143+plum-lihui@users.noreply.github.com> Co-authored-by: Jinqing Kuang <kuangjinqingcn@gmail.com> Co-authored-by: xiao-77 <berylbao@taosdata.com> Co-authored-by: Zhixiao Bao <62235797+xiao-77@users.noreply.github.com> Co-authored-by: happyguoxy <happy_guoxy@163.com> Co-authored-by: Tony Zhang <34825804+Tony2h@users.noreply.github.com> Co-authored-by: Tony Zhang <tonyzhang@taosdata.com> * test: rename TSDB * docs: fix rust examples (#31908) * docs: modify rust native test case * docs: modify rust ws test case * docs: modify rust examples * docs: update rust pool docs * fix new cases * migrate test case * feat: support reading sub table names and tag values from CSV files to create sub tables (#31909) * feat: add obtaining table names from tag files * feat: add write data table control * feat: add table params to write * feat: delete log file * feat: modify test case csv path * feat: resolve memory leakage in the table building thread * feat: resolve compilation errors * feat: resolve table name copy len error * feat: modify create table log level * feat: modifying query configuration parameter array out of bounds * feat: support custom primary key names * feat: modify log level * feat: add set primary key name case * feat: add column keywords case * feat: add keywords case data * feat: modify primaryKeyName value len * feat: modify primaryKeyName value define * feat: modify primaryKeyName value size * fix: compile issue (#31943) Co-authored-by: taos-support <it@taosdata.com> * package: fix error * package: fix error * fix failed cases * merge 3.0 * rename create_table_keywords.py to test_create_table_keywords.py * fix failed cases * fix new cases * docs: update stream (#31957) * docs: update jdbc out-dated descripiton (#31959) * fix: TD-36560 refactor arbitrator group function name and log (#31852) * feat: support BLOB data type (#31704) * rename 0-others/mounts.py to 0-others/test_mounts.py * fix failed cases * docs: update gpt (#31975) * fix failed cases * fix failed cases * package: fix error * feat: add taosBenchmark command line parameters (#31967) * feat: add command line parameters * feat: add command line parameter test cases * fix: tableName len error * enh: set TD Release build in tdengine-build.yml * Update tdengine-build.yml * fix: add json file path log * fix: streamline TD_CONFIG export in build steps * fix: Restore the build configuration --------- Co-authored-by: haoranchen <haoran920c@163.com> * fix: tableName len error (#31977) * fix: tableName len error * fix: modify TD_CONFIG=Release * fix: code format * fix: Restore the build configuration * enh: set TD Release build in tdengine-build.yml (#31980) * enh: set TD Release build in tdengine-build.yml * Update tdengine-build.yml * fix: update cache key for externals to include debug build version * fix: remove verbose flag from build commands in tdengine-build.yml * skip memleak cases * fix failed case * fix failed cases * package: fix error * fix(stmt2):tbname error output (#31997) * fix: possible memory leak (#31972) * feat: create connect add dbname params (#32002) * feat: create connect add dbname params * fix: connect param error * skip failed cases * fix cases on windows * fix cases * support connect bi mode and fix log level * unique sql connect username and password * fix log level * enh: mounted vnode may have no tq (#31916) * fix: subquery memleak (#32024) * fix failed case * fix cases * rename 2-query/test_insert_select.py to 2-query/test_system_insert_select.py * skip memleak cases * enh: rename data forecast/detect to forecasting/anomaly detection (#32021) * package: unique product name * package: update for main * skip tsim cases * chore: update jdbc connection pool validation query sql (#32056) * refactor: quotes usage in bash scripts Signed-off-by: WANG Xu <feici02@outlook.com> * enhn(mqtt/rawblock): new format for msg payload (#31801) * fix: fix broken link in 14-stream.md * docs: 15-spark.md is missing end semicolon (#32068) * chore: bump dev version to 3.3.7.0.alpha (#32066) * fix: blob test (#32020) * fix blob query error * fix blob query error * fix blob query error * fix blob query error * fix blob query error * opt query * opt write * opt write * opt write * opt bse * opt write * opt write * opt write * opt write * opt write * opt write * opt write * opt write * opt write * opt write * opt write * opt write * opt write * add cache * opt query * opt query * opt bse * add data iter * add data iter * add more compress * add more compress * add more compress * add more compress * add more compress * add more compress * opt blob transfer * opt blob transfer * opt blob transfer * opt write * avoid unordered data write * avoid unordered data write * opt read * refactor log * fix invalid write * refactor code * fix merge error * fix merge error * add error code * support blob type len * support blob type len * support blob type len * support blob type len * support blob type len * support blob type len * support blob type len * support blob type len * support blob type len * support blob type len * Merge remote-tracking branch 'origin/3.0' into enh/blob * refactor code * support blob type len * refactor code * refactor code * benchmark support blob type * benchmark support blob type * add log * handle sort and merge row * change file set * change file set * change file set * change file set * change file set * change file set * change file set * opt code * opt read * add restart error and add unit test * add restart error and add unit test * add restart error and add unit test * add restart error and add unit test * add restart error and add unit test * refactor code * add restart error and add unit test * opt code * refactor code * fix invalid write * blob test * blob test * blob test * blob test * blob test * support blob * add str trim * add str trim * Merge remote-tracking branch 'origin/3.0' into feat/blob * Merge remote-tracking branch 'origin/3.0' into feat/blob * update test case * fix invalid read * fix invalid read * fix invalid read * add stmt2 * add stmt2 * add stmt2 * update parameter * refactor test case * refactor test case * support blob * support stmt2 * add sub * support blob * support blob * support sub * fix tmq crash * support windows/darwin * fix stmt2 bind row * fix blob crash * fix blob crash * fix blob query error * fix blob crash * fix merge error * refactor bse * add blob transfer * add blob transfer * add transfer snapshot * refactor code * change log level * change log level * add test case * refactor code * revert taosBenchmark * revert taosbench * fix: improve error handling and encoding for file reading in grep_asserts_in_file function * rm assert * fix mem leak * fix compile error * fix conflict * fix conflict * fix compile error * fix compile error * fix pre check error * fix pre check error * fix compile error on windows * fix error on window * fix error on windows * fix error on windows * opt no-blob sql * fix compile error on dawain * fix compile error on dawain * fix invalid read * fix mem leak * fix invalid read * fix invalid read * fix error on windows * remove unused code * refactor code * fix mem leak * fix mem leak * rm unused code * rm unused code * fix invalid copy * fix invalid copy * fix invalid copy * fix invalid copy * fix invalid copy * refactor code * make ci happy * refactor code * change make * update test case * update ignore code * update bse snapshot and test case * update bse snapshot and test case * refactor code * change unit test * update bse snapshot * update bse snapshot * fix test case * fix bse snapshot * fix bse snapshot * fix snapshot transfer * remove unused log * support func query * add test case * forbidden unsupport code * merge 3.0 * merge 3.0 * change test case * add forbidden code * add forbidden code * add code * support length func * support length func * taosBenchmark support blob * support blob raw block * support write raw block * support more query * Merge branch 'feat/blob' into feat/blob_test * SBlobRow2 * change bse commit change * refactor code * rm exe test * refactor code * checke return code * rename blob name * refactor code * refactor code * refactor code * refactor code * fix unordere write * fix unordere write * fix row merge error * fix row merge error * fix row merge error * fix row merge error * support ordered data * support ordered data * Merge remote-tracking branch 'origin/3.0' into feat/blob_test * fix stmt2 blob crash * add not support write type * add not support write type * add not support write type * rm exe * fix col-formate error * fix col-formate error * fix mem leak * refactor code * add error code for single blob column restriction and update error message * add error code for single blob column restriction and update error message * add error code for single blob column restriction and update error message * refactor code * change error code * make ci happy --------- Co-authored-by: yihaoDeng <yhdeng@taosdata.com> Co-authored-by: chenhaoran <haoran920c@163.com> * package: update for main (#32091) * fix compile error on windows (#32089) * fix: source code merge issues --------- Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: WANG Xu <feici02@outlook.com> Co-authored-by: minhuinie <nminhui@163.com> Co-authored-by: huohong <sallyhuo@taosdata.com> Co-authored-by: chenhaoran <haoran920c@163.com> Co-authored-by: Nie Minhui <143420805+minhuinie@users.noreply.github.com> Co-authored-by: Mario Peng <48949600+Pengrongkun@users.noreply.github.com> Co-authored-by: Haojun Liao <hjxilinx@users.noreply.github.com> Co-authored-by: dongming chen <cademfly@hotmail.com> Co-authored-by: Linhe Huo <linhehuo@gmail.com> Co-authored-by: huohong <346479823@qq.com> Co-authored-by: Joel Brass <joel@jbrass.com> Co-authored-by: WANG Xu <feici02@outlook.com> Co-authored-by: Hongze Cheng <hzcheng@taosdata.com> Co-authored-by: Tony Zhang <34825804+Tony2h@users.noreply.github.com> Co-authored-by: Tony Zhang <tonyzhang@taosdata.com> Co-authored-by: Kaili Xu <klxu@taosdata.com> Co-authored-by: Zhixiao Bao <62235797+xiao-77@users.noreply.github.com> Co-authored-by: WANG MINGMING <wangmm0220@gmail.com> Co-authored-by: hongzhenliu <wluckyjob@gmail.com> Co-authored-by: Daniel Clow <106956386+danielclow@users.noreply.github.com> Co-authored-by: She Yanjie <57549981+sheyanjie-qq@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Simon Guan <slguan@taosdata.com> Co-authored-by: plum-lihui <huili@taosdata.com> Co-authored-by: Alex Duan <417921451@qq.com> Co-authored-by: zelv01 <1101510017@qq.com> Co-authored-by: Jing Sima <simondominic9997@outlook.com> Co-authored-by: xiangyang guo <66111494+happyguoxy@users.noreply.github.com> Co-authored-by: Haojun Liao <hjliao@taosdata.com> Co-authored-by: zyyang90 <zyyang@taosdata.com> Co-authored-by: Alex Duan <51781608+DuanKuanJun@users.noreply.github.com> Co-authored-by: facetosea <285808407@qq.com> Co-authored-by: Simon Guan <guanshengliang@qq.com> Co-authored-by: Li Hui <52318143+plum-lihui@users.noreply.github.com> Co-authored-by: Jinqing Kuang <kuangjinqingcn@gmail.com> Co-authored-by: xiao-77 <berylbao@taosdata.com> Co-authored-by: happyguoxy <happy_guoxy@163.com> Co-authored-by: guozhenwei <2227465945@qq.com> Co-authored-by: kevin men <men_shi_bin@163.com> Co-authored-by: taos-support <it@taosdata.com> Co-authored-by: Yihao Deng <luomoxyz@126.com> Co-authored-by: Minglei Jin <49711132+stephenkgu@users.noreply.github.com> Co-authored-by: yihaoDeng <yhdeng@taosdata.com>
2025-07-22 05:25:21 +00:00
#define SUBMIT_REQ_WITH_BLOB 0x10
2025-07-25 02:18:25 +00:00
#define SUBMIT_REQ_SCHEMA_RES 0x20
2025-10-31 09:40:04 +00:00
#define SUBMIT_REQ_ONLY_CREATE_TABLE 0x40
2022-11-29 07:13:19 +00:00
2024-04-08 02:33:02 +00:00
#define TD_REQ_FROM_TAOX_OLD 0x1 // for compatibility
2022-11-29 07:13:19 +00:00
2022-11-23 13:42:06 +00:00
typedef struct {
2022-11-29 07:13:19 +00:00
int32_t flags;
SVCreateTbReq* pCreateTbReq;
int64_t suid;
int64_t uid;
int32_t sver;
2022-11-23 13:42:06 +00:00
union {
SArray* aRowP;
SArray* aCol;
};
2025-12-15 08:48:20 +00:00
int64_t ctimeMs;
SBlobSet* pBlobSet;
2022-11-23 13:42:06 +00:00
} SSubmitTbData;
typedef struct {
2022-11-29 07:13:19 +00:00
SArray* aSubmitTbData; // SArray<SSubmitTbData>
Feat/ts 6100 3.0.0722m (#32103) * migrate system-test/2-query * revert file * update case.task * resolve script migrate * run new test framework on new_testcases * migrate system-test/2-query * format docstring * fix test validation * fix test validation * fix error * migrate army case * migrate army case * fix error * migrate system-test/2-query * migrate system-test/2-query * migrate system-test/2-query * migrate system-test/2-query * test exe time * fix ci error * migrate system-test/1-insert * new common function * migrate system-test/1-insert * fix ci error * migrate system-test/1-insert * feat: add configuration and script for memory allocator settings * fix: correct HEAPPROFILE path and remove redundant metadata_thp setting in memory allocator script * fix ci error * migrate system-test/1-insert, 2-query * feat:insert into subquery (#31401) (#31710) * migrate system-test/99-TDcase * feat(gpt): add grant check for gpt. (#31708) * migrate system-test/99-TDcase * migrate system-test/99-TDcase * migrate system-test/99-TDcase * fix/send-heartbeat-statis (#31680) * migrate system-test/7-tmq * chore: support cmake option TAOSWS_GIT_TAG like taosadapter [skip ci] (#31486) * add system-test/6/cluster test * chore: move default branch from main to 3.3.6 for adapter/taosws * fix docstring validation * migrate system-test/7-tmq * migrate system-test/7-tmq * feat: add set_taos_malloc_env configuration and update related scripts * Update 03-kubernetes.md * enh: add log for snapshot (#31681) * simple test * more * migrate system-test/7-tmq * migrate system-test 0-others cases * migrate system-test/7-tmq * fix docstring validation * migrate system-test/7-tmq * fix docstring validation * fix: invalid queue * fix docstring validation * refactor: reorganize memory allocator script constants and improve mode descriptions * enh: TD-36324-improve-sync-heartbeat-log (#31727) * recover log level * fix: taosd crush in query when insufficient memory (#31746) Co-authored-by: Tony Zhang <tonyzhang@taosdata.com> * fix: overflow check in snprintf (#31780) * migrate system-test/7-tmq * migrate some cases * migrate system-test/7-tmq * fix failed cases * fix failed cases * migrate some cases * fix failed cases * fix failed cases * migrate testcases * fix: update environment file path in taosd.service and adjust set_taos_malloc.sh configuration * fix: set lcn before do s3 migrate. (#31782) * migrate testcases * fix failed cases * fix: add condition to set default malloc config for taosd service * fix: update usage message in set_taos_malloc.sh to include quiet mode option * fix: add quiet mode option to set malloc config in install script * fix: update set_taos_malloc.sh to improve output messages and adjust default malloc config invocation * recover log level * fix(tmq): [TS-6569]tdb error if write tmq meta data in multi thread (#31808) * fix: the calculation of dnode uptime (#31832) * migrate testcase * fix: correct timediff function bug and redress docs (#31798) * fix: enhance malloc configuration for taosd and taosadapter in install script * fix: TD-36442 show full condition (#31796) * enh/TD-36466-sync-heartbeat (#31805) * fix(plan) virtual table support BI moudle when use in select (#31787) * fix failed cases * enh: TS-5926-force-repair-wal (#31828) * migrate testcase * rename taos & taosd (#31855) * migrate testcase * migrate testcase * fix failed cases * fix: update environment file paths in taosd.service and set_taos_malloc.sh * feat: add performance tuning documentation for memory optimization and set_taos_malloc.sh usage * fix: update file paths in performance tuning documentation for consistency * feat: add performance tuning documentation for memory allocator configuration script * fix: add missing line breaks for improved readability in performance tuning documentation * fix: adjust heading levels for consistency in performance tuning documentation * fix cases * fix new_testcases * fix failed cases * fix(query): support show tags on virtual table (#31831) * fix failed cases * docs: replace mysql screenshot (#31888) * feat: use the new TDengine product name (#31859) * merge 3.0 * fix failed cases * fix failed cases * merge 3.0 * fix cases * fix cases * doc: Update 03-stream.md (#31675) * chore(deps): bump requests from 2.27.1 to 2.32.4 in /test (#31326) Bumps [requests](https://github.com/psf/requests) from 2.27.1 to 2.32.4. - [Release notes](https://github.com/psf/requests/releases) - [Changelog](https://github.com/psf/requests/blob/main/HISTORY.md) - [Commits](https://github.com/psf/requests/compare/v2.27.1...v2.32.4) --- updated-dependencies: - dependency-name: requests dependency-version: 2.32.4 dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * fix new cases * fix:Convert line endings from LF to CRLF for ans file * build(deps): bump golang.org/x/net in /tools/keeper (#30811) Bumps [golang.org/x/net](https://github.com/golang/net) from 0.36.0 to 0.38.0. - [Commits](https://github.com/golang/net/compare/v0.36.0...v0.38.0) --- updated-dependencies: - dependency-name: golang.org/x/net dependency-version: 0.38.0 dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps): bump urllib3 from 1.26.20 to 2.5.0 in /test (#31414) Bumps [urllib3](https://github.com/urllib3/urllib3) from 1.26.20 to 2.5.0. - [Release notes](https://github.com/urllib3/urllib3/releases) - [Changelog](https://github.com/urllib3/urllib3/blob/main/CHANGES.rst) - [Commits](https://github.com/urllib3/urllib3/compare/1.26.20...2.5.0) --- updated-dependencies: - dependency-name: urllib3 dependency-version: 2.5.0 dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps): bump org.apache.tomcat.embed:tomcat-embed-core (#31392) Bumps org.apache.tomcat.embed:tomcat-embed-core from 9.0.104 to 9.0.106. --- updated-dependencies: - dependency-name: org.apache.tomcat.embed:tomcat-embed-core dependency-version: 9.0.106 dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps): bump org.apache.tomcat.embed:tomcat-embed-core (#31393) Bumps org.apache.tomcat.embed:tomcat-embed-core from 9.0.104 to 9.0.106. --- updated-dependencies: - dependency-name: org.apache.tomcat.embed:tomcat-embed-core dependency-version: 9.0.106 dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps): bump org.apache.kafka:kafka-clients (#31341) Bumps org.apache.kafka:kafka-clients from 3.9.0 to 3.9.1. --- updated-dependencies: - dependency-name: org.apache.kafka:kafka-clients dependency-version: 3.9.1 dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * fix: add lock when calculating log buffer start/end (#31883) * fix new cases * fix new cases * fix failed cases * feat: new stream (#31678) * fix: windows compile issue * test: add vtable cases (#31829) * fix: windows compile issues * test:add test cases * fix: windows compile issue * case: em-4 stream case submit * test: stream4_sub1 found bug2 * test: submit test_scene_meters_bug2.py * add stream parameters example * feat: [TS-6100] Do not translate const value as column. * Feat/ts 6100 3.0 zlv (#31747) * modify asan exampel * modify asan exampel * add example * add example * modify case example --------- Co-authored-by: zelv01 <1101510017@qq.com> * feat(stream): fix memory leak * modify sliding example * test: update test case. * feat(stream): fix conflicts * fix: add offset case 10a 10s 10m 10h 10d * feat(stream): fix conflicts * chore(stream): rename case name #TS-6100 * add case * modify example * fix: windows compile issues * fix: data null check * feat: [TS-6100] Forbid where when using %%trows (#31827) * feat: [TS-6100] Forbid where when using %%trows * test: update cases * feat: [TS-6100] Fix leaks. --------- Co-authored-by: Simon Guan <guanshengliang@qq.com> * test: reproduce bugs * test: update test case. * test: update test case. * feat: [TS-6100] Fix leaks. * test: add cases * Feat/ts 6100 3.0.pw10 (#31841) * enh: add operator reset func * fix: merge join reset issue * fix: memory issues * fix: add debug assert * fix: memory issues * fix: memory leak * fix: memory issues * fix taos log miss * fix: case issue * fix: case issue * fix: case issues * fix: drop dnode issue * fix: memory issues * fix: memory issues * fix: memory leak issues * fix: recalculate time range issue * fix: add debug log * fix: memory issues * fix: enable case asan * Update streamlist_for_ci.task * fix: case asan issue * fix: stream name issue * fix: external window compile issues * fix: deploy memory issue * fix: ahandle issue * fix: ahandle issue * fix: ahandle issue * fix: virtual table reader list issue * fix: log info * fix: msg error * fix: virtual table addr list issue * fix: memory issues * fix: memory leak issue * fix: memory issues * fix: memory free issues * fix: memory issues * fix: snode deploy issue * fix: mnode reader issue * fix: memory issues * fix: add debug test * enh: add ignore nodata trigger * fix: memory leaks * fix: configuration issue * fix: memory issue * fix: external window issue * fix: external window issues * fix: external window placeholder issue * fix: placeholder function init issues * fix: memory leak issue * fix: add debug log * fix: compile issues * fix: double free issue * fix: runner addr update issue * fix: msg rsp issue * fix: external window reset issue * fix: configuration issue * fix: deploy msg issue * fix: compile issue --------- Co-authored-by: huohong <sallyhuo@taosdata.com> * test: reproduce bugs * fix: add sliding interval combine case * test: add cases * test: add recalc test. * test: reproduce bugs * case : add vt ts is null check * modify case * bug: submit test_idmp_meters_bug3.py * test: add test for recalc. * test: add cases * fix: error code check * test: add cases * fix(stream): scan wal with schema in that version * add case * test: add cases * test: update test case. * fix: windows compile issues * add case * test: add cases (#31845) * modify case * fix: reset interpPrev * test: add test_idmp_meters bug4 and bug3 * add case * fix(stream): opti wal interface * fix: remove test_idmp_meters_bug5.py * test: add cases * fix(stream): fix ts data fetch for virtual tables * cancel asan case * test: update test case. * test: update test case. * add case * test: add cases * test: add cases * test: add case test_idmp_meters_bug5.py * test: update test case. * fix(stream): tmq error * test: add cases * feat: [TS-6100] Restore deleted code in mndSma.c since they are still in use. * fix(stream): optimize val scan logic * test: add test_recalc_expired_time.py to ci. * test: update test case. * test: update test case. * feat: [TS-6100] Fix fill range check * fix(stream): optimize val scan logic * add case * test: modify for partition by %%1 * test: add fun case stream4_sub7 * fix(stream): optimize val scan logic * add case * feat: [TS-6100] Rename OPTIONS to STREAM_OPTIONS. * test: add test for recalc. * test: use stream_options. * fix: some cases error. * test: remove recalc from ci. * fix: ci case issues (#31880) * enh: add operator reset func * fix: merge join reset issue * fix: memory issues * fix: add debug assert * fix: memory issues * fix: memory leak * fix: memory issues * fix taos log miss * fix: case issue * fix: case issue * fix: case issues * fix: drop dnode issue * fix: memory issues * fix: memory issues * fix: memory leak issues * fix: recalculate time range issue * fix: add debug log * fix: memory issues * fix: enable case asan * Update streamlist_for_ci.task * fix: case asan issue * fix: stream name issue * fix: external window compile issues * fix: deploy memory issue * fix: ahandle issue * fix: ahandle issue * fix: ahandle issue * fix: virtual table reader list issue * fix: log info * fix: msg error * fix: virtual table addr list issue * fix: memory issues * fix: memory leak issue * fix: memory issues * fix: memory free issues * fix: memory issues * fix: snode deploy issue * fix: mnode reader issue * fix: memory issues * fix: add debug test * enh: add ignore nodata trigger * fix: memory leaks * fix: configuration issue * fix: memory issue * fix: external window issue * fix: external window issues * fix: external window placeholder issue * fix: placeholder function init issues * fix: memory leak issue * fix: add debug log * fix: compile issues * fix: double free issue * fix: runner addr update issue * fix: msg rsp issue * fix: external window reset issue * fix: configuration issue * fix: deploy msg issue * fix: compile issue * fix: external window idx issue * fix: ci issues --------- Co-authored-by: huohong <sallyhuo@taosdata.com> * fix(stream): fix compilation error * fix(stream): optimize val scan logic * test:add test cases * test: modify case * fix: external agg error * test(stream): tobacco scene testing #TD-36514 * test: add stream cases (#31885) * fix: windows compile issue * fix: calc timerange * fix: windows compile issue * modify case * fix(stream): compile error * test: remove one debug test case file * test: modify * test: add test cases * test: reproduce bugs * test: reproduce bugs * feat: [TS-6100] Placeholder function should only appera in SELECT and… (#31868) * feat: [TS-6100] Placeholder function should only appera in SELECT and WHERE and FROM. * test: update case --------- Co-authored-by: Simon Guan <guanshengliang@qq.com> * add example * add example * modify case example * modify case * test:alter sql * test: add stream5 case * fix(stream): get schema error with version * test: add delete recalc test py. * test: remove bug cases * test: stream5 case test passed * test: add state cases (#31893) * fix(stream): compile error * test: modify case * test: add cases * test: add test. * test: update test case. * chore(test): fix case err * test: update test case. * fix: align data get * fix(stream): fix row index of datablock written into data cache * fix: put align data * test: update test case. * test: add test cases for virtual table * chore(test): fix case err #TD-36514 * add case * test: add test for water mark. * test: add meters bug6 for stream5 * test: add cases (#31903) * test: add test for recalc. * feat: [TS-6100] %%trows can only be used when event type is window close. * test: add precision of database for ms/us/ns * modify case * add case * add case * test: add test to ci. * modify case * fix: ci case issues (#31904) * enh: add operator reset func * fix: merge join reset issue * fix: memory issues * fix: add debug assert * fix: memory issues * fix: memory leak * fix: memory issues * fix taos log miss * fix: case issue * fix: case issue * fix: case issues * fix: drop dnode issue * fix: memory issues * fix: memory issues * fix: memory leak issues * fix: recalculate time range issue * fix: add debug log * fix: memory issues * fix: enable case asan * Update streamlist_for_ci.task * fix: case asan issue * fix: stream name issue * fix: external window compile issues * fix: deploy memory issue * fix: ahandle issue * fix: ahandle issue * fix: ahandle issue * fix: virtual table reader list issue * fix: log info * fix: msg error * fix: virtual table addr list issue * fix: memory issues * fix: memory leak issue * fix: memory issues * fix: memory free issues * fix: memory issues * fix: snode deploy issue * fix: mnode reader issue * fix: memory issues * fix: add debug test * enh: add ignore nodata trigger * fix: memory leaks * fix: configuration issue * fix: memory issue * fix: external window issue * fix: external window issues * fix: external window placeholder issue * fix: placeholder function init issues * fix: memory leak issue * fix: add debug log * fix: compile issues * fix: double free issue * fix: runner addr update issue * fix: msg rsp issue * fix: external window reset issue * fix: configuration issue * fix: deploy msg issue * fix: compile issue * fix: external window idx issue * fix: ci issues * fix: ci case issues * fix: drop dnode issue --------- Co-authored-by: huohong <sallyhuo@taosdata.com> * fix(stream): ci error * test: update test case. * feat: [TS-6100] Disable some failed UT. * feat: [TS-6100] Fix virtual table * test: add bug 5. * test: add test delete recalc to ci. * test: add bug 6. * test(stream): tobacco scene #TD-36514 * fix: reqCids,reqCols memory leak in SSTriggerRealtimeContext Co-authored-by: Tony Zhang <tonyzhang@taosdata.com> * test: add case stream6 * fix(stream): implement some pending features in trigger task * modify case * modify case * fix: case issues * modify case * test: add recalc for warter mark. * fix(stream): fix count window trigger of virtual tables * fix(stream): memory leak * test: fix run err. * test: add stream6 bug7 * fix: adjust format * test(stream): tobacco scene testing #TD-36514 * test: change bug7 with update window1 and 2 * test: add test bug 7. * case: restore write 3 window * fix: windows compile issue * fix: notify * test: add cases * modify case * test: update test case. * test(stream): toobacco scene testing #TD-36514 --------- Co-authored-by: Simon Guan <slguan@taosdata.com> Co-authored-by: plum-lihui <huili@taosdata.com> Co-authored-by: Alex Duan <417921451@qq.com> Co-authored-by: zelv01 <1101510017@qq.com> Co-authored-by: Jing Sima <simondominic9997@outlook.com> Co-authored-by: xiangyang guo <66111494+happyguoxy@users.noreply.github.com> Co-authored-by: wangmm0220 <wangmm0220@gmail.com> Co-authored-by: Haojun Liao <hjliao@taosdata.com> Co-authored-by: zyyang90 <zyyang@taosdata.com> Co-authored-by: Alex Duan <51781608+DuanKuanJun@users.noreply.github.com> Co-authored-by: facetosea <285808407@qq.com> Co-authored-by: Simon Guan <guanshengliang@qq.com> Co-authored-by: huohong <sallyhuo@taosdata.com> Co-authored-by: Li Hui <52318143+plum-lihui@users.noreply.github.com> Co-authored-by: Jinqing Kuang <kuangjinqingcn@gmail.com> Co-authored-by: xiao-77 <berylbao@taosdata.com> Co-authored-by: Zhixiao Bao <62235797+xiao-77@users.noreply.github.com> Co-authored-by: happyguoxy <happy_guoxy@163.com> Co-authored-by: Tony Zhang <34825804+Tony2h@users.noreply.github.com> Co-authored-by: Tony Zhang <tonyzhang@taosdata.com> * test: rename TSDB * docs: fix rust examples (#31908) * docs: modify rust native test case * docs: modify rust ws test case * docs: modify rust examples * docs: update rust pool docs * fix new cases * migrate test case * feat: support reading sub table names and tag values from CSV files to create sub tables (#31909) * feat: add obtaining table names from tag files * feat: add write data table control * feat: add table params to write * feat: delete log file * feat: modify test case csv path * feat: resolve memory leakage in the table building thread * feat: resolve compilation errors * feat: resolve table name copy len error * feat: modify create table log level * feat: modifying query configuration parameter array out of bounds * feat: support custom primary key names * feat: modify log level * feat: add set primary key name case * feat: add column keywords case * feat: add keywords case data * feat: modify primaryKeyName value len * feat: modify primaryKeyName value define * feat: modify primaryKeyName value size * fix: compile issue (#31943) Co-authored-by: taos-support <it@taosdata.com> * package: fix error * package: fix error * fix failed cases * merge 3.0 * rename create_table_keywords.py to test_create_table_keywords.py * fix failed cases * fix new cases * docs: update stream (#31957) * docs: update jdbc out-dated descripiton (#31959) * fix: TD-36560 refactor arbitrator group function name and log (#31852) * feat: support BLOB data type (#31704) * rename 0-others/mounts.py to 0-others/test_mounts.py * fix failed cases * docs: update gpt (#31975) * fix failed cases * fix failed cases * package: fix error * feat: add taosBenchmark command line parameters (#31967) * feat: add command line parameters * feat: add command line parameter test cases * fix: tableName len error * enh: set TD Release build in tdengine-build.yml * Update tdengine-build.yml * fix: add json file path log * fix: streamline TD_CONFIG export in build steps * fix: Restore the build configuration --------- Co-authored-by: haoranchen <haoran920c@163.com> * fix: tableName len error (#31977) * fix: tableName len error * fix: modify TD_CONFIG=Release * fix: code format * fix: Restore the build configuration * enh: set TD Release build in tdengine-build.yml (#31980) * enh: set TD Release build in tdengine-build.yml * Update tdengine-build.yml * fix: update cache key for externals to include debug build version * fix: remove verbose flag from build commands in tdengine-build.yml * skip memleak cases * fix failed case * fix failed cases * package: fix error * fix(stmt2):tbname error output (#31997) * fix: possible memory leak (#31972) * feat: create connect add dbname params (#32002) * feat: create connect add dbname params * fix: connect param error * skip failed cases * fix cases on windows * fix cases * support connect bi mode and fix log level * unique sql connect username and password * fix log level * enh: mounted vnode may have no tq (#31916) * fix: subquery memleak (#32024) * fix failed case * fix cases * rename 2-query/test_insert_select.py to 2-query/test_system_insert_select.py * skip memleak cases * enh: rename data forecast/detect to forecasting/anomaly detection (#32021) * package: unique product name * package: update for main * skip tsim cases * chore: update jdbc connection pool validation query sql (#32056) * refactor: quotes usage in bash scripts Signed-off-by: WANG Xu <feici02@outlook.com> * enhn(mqtt/rawblock): new format for msg payload (#31801) * fix: fix broken link in 14-stream.md * docs: 15-spark.md is missing end semicolon (#32068) * chore: bump dev version to 3.3.7.0.alpha (#32066) * fix: blob test (#32020) * fix blob query error * fix blob query error * fix blob query error * fix blob query error * fix blob query error * opt query * opt write * opt write * opt write * opt bse * opt write * opt write * opt write * opt write * opt write * opt write * opt write * opt write * opt write * opt write * opt write * opt write * opt write * add cache * opt query * opt query * opt bse * add data iter * add data iter * add more compress * add more compress * add more compress * add more compress * add more compress * add more compress * opt blob transfer * opt blob transfer * opt blob transfer * opt write * avoid unordered data write * avoid unordered data write * opt read * refactor log * fix invalid write * refactor code * fix merge error * fix merge error * add error code * support blob type len * support blob type len * support blob type len * support blob type len * support blob type len * support blob type len * support blob type len * support blob type len * support blob type len * support blob type len * Merge remote-tracking branch 'origin/3.0' into enh/blob * refactor code * support blob type len * refactor code * refactor code * benchmark support blob type * benchmark support blob type * add log * handle sort and merge row * change file set * change file set * change file set * change file set * change file set * change file set * change file set * opt code * opt read * add restart error and add unit test * add restart error and add unit test * add restart error and add unit test * add restart error and add unit test * add restart error and add unit test * refactor code * add restart error and add unit test * opt code * refactor code * fix invalid write * blob test * blob test * blob test * blob test * blob test * support blob * add str trim * add str trim * Merge remote-tracking branch 'origin/3.0' into feat/blob * Merge remote-tracking branch 'origin/3.0' into feat/blob * update test case * fix invalid read * fix invalid read * fix invalid read * add stmt2 * add stmt2 * add stmt2 * update parameter * refactor test case * refactor test case * support blob * support stmt2 * add sub * support blob * support blob * support sub * fix tmq crash * support windows/darwin * fix stmt2 bind row * fix blob crash * fix blob crash * fix blob query error * fix blob crash * fix merge error * refactor bse * add blob transfer * add blob transfer * add transfer snapshot * refactor code * change log level * change log level * add test case * refactor code * revert taosBenchmark * revert taosbench * fix: improve error handling and encoding for file reading in grep_asserts_in_file function * rm assert * fix mem leak * fix compile error * fix conflict * fix conflict * fix compile error * fix compile error * fix pre check error * fix pre check error * fix compile error on windows * fix error on window * fix error on windows * fix error on windows * opt no-blob sql * fix compile error on dawain * fix compile error on dawain * fix invalid read * fix mem leak * fix invalid read * fix invalid read * fix error on windows * remove unused code * refactor code * fix mem leak * fix mem leak * rm unused code * rm unused code * fix invalid copy * fix invalid copy * fix invalid copy * fix invalid copy * fix invalid copy * refactor code * make ci happy * refactor code * change make * update test case * update ignore code * update bse snapshot and test case * update bse snapshot and test case * refactor code * change unit test * update bse snapshot * update bse snapshot * fix test case * fix bse snapshot * fix bse snapshot * fix snapshot transfer * remove unused log * support func query * add test case * forbidden unsupport code * merge 3.0 * merge 3.0 * change test case * add forbidden code * add forbidden code * add code * support length func * support length func * taosBenchmark support blob * support blob raw block * support write raw block * support more query * Merge branch 'feat/blob' into feat/blob_test * SBlobRow2 * change bse commit change * refactor code * rm exe test * refactor code * checke return code * rename blob name * refactor code * refactor code * refactor code * refactor code * fix unordere write * fix unordere write * fix row merge error * fix row merge error * fix row merge error * fix row merge error * support ordered data * support ordered data * Merge remote-tracking branch 'origin/3.0' into feat/blob_test * fix stmt2 blob crash * add not support write type * add not support write type * add not support write type * rm exe * fix col-formate error * fix col-formate error * fix mem leak * refactor code * add error code for single blob column restriction and update error message * add error code for single blob column restriction and update error message * add error code for single blob column restriction and update error message * refactor code * change error code * make ci happy --------- Co-authored-by: yihaoDeng <yhdeng@taosdata.com> Co-authored-by: chenhaoran <haoran920c@163.com> * package: update for main (#32091) * fix compile error on windows (#32089) * fix: source code merge issues --------- Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: WANG Xu <feici02@outlook.com> Co-authored-by: minhuinie <nminhui@163.com> Co-authored-by: huohong <sallyhuo@taosdata.com> Co-authored-by: chenhaoran <haoran920c@163.com> Co-authored-by: Nie Minhui <143420805+minhuinie@users.noreply.github.com> Co-authored-by: Mario Peng <48949600+Pengrongkun@users.noreply.github.com> Co-authored-by: Haojun Liao <hjxilinx@users.noreply.github.com> Co-authored-by: dongming chen <cademfly@hotmail.com> Co-authored-by: Linhe Huo <linhehuo@gmail.com> Co-authored-by: huohong <346479823@qq.com> Co-authored-by: Joel Brass <joel@jbrass.com> Co-authored-by: WANG Xu <feici02@outlook.com> Co-authored-by: Hongze Cheng <hzcheng@taosdata.com> Co-authored-by: Tony Zhang <34825804+Tony2h@users.noreply.github.com> Co-authored-by: Tony Zhang <tonyzhang@taosdata.com> Co-authored-by: Kaili Xu <klxu@taosdata.com> Co-authored-by: Zhixiao Bao <62235797+xiao-77@users.noreply.github.com> Co-authored-by: WANG MINGMING <wangmm0220@gmail.com> Co-authored-by: hongzhenliu <wluckyjob@gmail.com> Co-authored-by: Daniel Clow <106956386+danielclow@users.noreply.github.com> Co-authored-by: She Yanjie <57549981+sheyanjie-qq@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Simon Guan <slguan@taosdata.com> Co-authored-by: plum-lihui <huili@taosdata.com> Co-authored-by: Alex Duan <417921451@qq.com> Co-authored-by: zelv01 <1101510017@qq.com> Co-authored-by: Jing Sima <simondominic9997@outlook.com> Co-authored-by: xiangyang guo <66111494+happyguoxy@users.noreply.github.com> Co-authored-by: Haojun Liao <hjliao@taosdata.com> Co-authored-by: zyyang90 <zyyang@taosdata.com> Co-authored-by: Alex Duan <51781608+DuanKuanJun@users.noreply.github.com> Co-authored-by: facetosea <285808407@qq.com> Co-authored-by: Simon Guan <guanshengliang@qq.com> Co-authored-by: Li Hui <52318143+plum-lihui@users.noreply.github.com> Co-authored-by: Jinqing Kuang <kuangjinqingcn@gmail.com> Co-authored-by: xiao-77 <berylbao@taosdata.com> Co-authored-by: happyguoxy <happy_guoxy@163.com> Co-authored-by: guozhenwei <2227465945@qq.com> Co-authored-by: kevin men <men_shi_bin@163.com> Co-authored-by: taos-support <it@taosdata.com> Co-authored-by: Yihao Deng <luomoxyz@126.com> Co-authored-by: Minglei Jin <49711132+stephenkgu@users.noreply.github.com> Co-authored-by: yihaoDeng <yhdeng@taosdata.com>
2025-07-22 05:25:21 +00:00
SArray* aSubmitBlobData;
bool raw;
2022-11-23 13:42:06 +00:00
} SSubmitReq2;
typedef struct {
SMsgHead header;
int64_t version;
char data[]; // SSubmitReq2
} SSubmitReq2Msg;
int32_t transformRawSSubmitTbData(void* data, int64_t suid, int64_t uid, int32_t sver);
2023-05-04 08:15:14 +00:00
int32_t tEncodeSubmitReq(SEncoder* pCoder, const SSubmitReq2* pReq);
int32_t tDecodeSubmitReq(SDecoder* pCoder, SSubmitReq2* pReq, SArray* rawList);
2023-05-04 08:15:14 +00:00
void tDestroySubmitTbData(SSubmitTbData* pTbData, int32_t flag);
void tDestroySubmitReq(SSubmitReq2* pReq, int32_t flag);
2022-11-23 13:42:06 +00:00
2022-11-29 03:33:08 +00:00
typedef struct {
int32_t affectedRows;
SArray* aCreateTbRsp; // SArray<SVCreateTbRsp>
} SSubmitRsp2;
int32_t tEncodeSSubmitRsp2(SEncoder* pCoder, const SSubmitRsp2* pRsp);
int32_t tDecodeSSubmitRsp2(SDecoder* pCoder, SSubmitRsp2* pRsp);
2022-11-29 09:45:50 +00:00
void tDestroySSubmitRsp2(SSubmitRsp2* pRsp, int32_t flag);
2022-11-29 03:33:08 +00:00
#define TSDB_MSG_FLG_ENCODE 0x1
#define TSDB_MSG_FLG_DECODE 0x2
#define TSDB_MSG_FLG_CMPT 0x3
2022-11-29 03:33:08 +00:00
2022-12-07 07:19:34 +00:00
typedef struct {
2022-12-08 05:34:42 +00:00
union {
struct {
void* msgStr;
int32_t msgLen;
int64_t ver;
};
void* pDataBlock;
};
} SPackedData;
2022-11-17 06:09:15 +00:00
2023-09-19 06:19:54 +00:00
typedef struct {
2023-09-21 11:28:07 +00:00
char fullname[TSDB_VIEW_FNAME_LEN];
2023-09-19 06:19:54 +00:00
char name[TSDB_VIEW_NAME_LEN];
char dbFName[TSDB_DB_FNAME_LEN];
2023-09-20 11:30:40 +00:00
char* querySql;
2023-09-20 07:01:03 +00:00
char* sql;
2023-09-19 06:19:54 +00:00
int8_t orReplace;
int8_t precision;
int32_t numOfCols;
SSchema* pSchema;
} SCMCreateViewReq;
int32_t tSerializeSCMCreateViewReq(void* buf, int32_t bufLen, const SCMCreateViewReq* pReq);
int32_t tDeserializeSCMCreateViewReq(void* buf, int32_t bufLen, SCMCreateViewReq* pReq);
void tFreeSCMCreateViewReq(SCMCreateViewReq* pReq);
typedef struct {
2023-09-21 11:28:07 +00:00
char fullname[TSDB_VIEW_FNAME_LEN];
char name[TSDB_VIEW_NAME_LEN];
2023-09-19 06:19:54 +00:00
char dbFName[TSDB_DB_FNAME_LEN];
2023-09-20 11:30:40 +00:00
char* sql;
2023-09-19 06:19:54 +00:00
int8_t igNotExists;
} SCMDropViewReq;
2023-09-20 11:30:40 +00:00
int32_t tSerializeSCMDropViewReq(void* buf, int32_t bufLen, const SCMDropViewReq* pReq);
int32_t tDeserializeSCMDropViewReq(void* buf, int32_t bufLen, SCMDropViewReq* pReq);
void tFreeSCMDropViewReq(SCMDropViewReq* pReq);
2023-09-19 06:19:54 +00:00
2023-09-28 03:44:38 +00:00
typedef struct {
2023-12-01 07:15:12 +00:00
char fullname[TSDB_VIEW_FNAME_LEN];
2023-09-28 03:44:38 +00:00
} SViewMetaReq;
int32_t tSerializeSViewMetaReq(void* buf, int32_t bufLen, const SViewMetaReq* pReq);
int32_t tDeserializeSViewMetaReq(void* buf, int32_t bufLen, SViewMetaReq* pReq);
typedef struct {
char name[TSDB_VIEW_NAME_LEN];
char dbFName[TSDB_DB_FNAME_LEN];
2025-12-29 11:27:11 +00:00
char* createUser;
int64_t ownerId;
2023-09-28 03:44:38 +00:00
uint64_t dbId;
uint64_t viewId;
char* querySql;
2023-10-11 10:49:47 +00:00
int8_t precision;
int8_t type;
2023-09-28 03:44:38 +00:00
int32_t version;
2023-10-11 10:49:47 +00:00
int32_t numOfCols;
SSchema* pSchema;
2023-09-28 03:44:38 +00:00
} SViewMetaRsp;
int32_t tSerializeSViewMetaRsp(void* buf, int32_t bufLen, const SViewMetaRsp* pRsp);
int32_t tDeserializeSViewMetaRsp(void* buf, int32_t bufLen, SViewMetaRsp* pRsp);
void tFreeSViewMetaRsp(SViewMetaRsp* pRsp);
2023-11-29 11:07:23 +00:00
typedef struct {
2024-05-30 11:41:22 +00:00
char name[TSDB_TABLE_FNAME_LEN]; // table name or tsma name
bool fetchingWithTsmaName; // if we are fetching with tsma name
} STableTSMAInfoReq;
2023-11-29 11:07:23 +00:00
int32_t tSerializeTableTSMAInfoReq(void* buf, int32_t bufLen, const STableTSMAInfoReq* pReq);
int32_t tDeserializeTableTSMAInfoReq(void* buf, int32_t bufLen, STableTSMAInfoReq* pReq);
typedef struct {
char name[TSDB_TABLE_NAME_LEN]; // rsmaName
union {
uint8_t flags;
struct {
uint8_t withColName : 1;
uint8_t reserved : 7;
};
};
} SRsmaInfoReq;
int32_t tSerializeRsmaInfoReq(void* buf, int32_t bufLen, const SRsmaInfoReq* pReq);
int32_t tDeserializeRsmaInfoReq(void* buf, int32_t bufLen, SRsmaInfoReq* pReq);
2023-11-29 11:07:23 +00:00
typedef struct {
int32_t funcId;
col_id_t colId;
} STableTSMAFuncInfo;
typedef struct {
char name[TSDB_TABLE_NAME_LEN];
uint64_t tsmaId;
char targetTb[TSDB_TABLE_NAME_LEN];
char targetDbFName[TSDB_DB_FNAME_LEN];
char tb[TSDB_TABLE_NAME_LEN];
char dbFName[TSDB_DB_FNAME_LEN];
uint64_t suid;
2023-12-22 06:05:31 +00:00
uint64_t destTbUid;
2023-11-29 11:07:23 +00:00
uint64_t dbId;
int32_t version;
int64_t interval;
int8_t unit;
2024-05-30 11:41:22 +00:00
SArray* pFuncs; // SArray<STableTSMAFuncInfo>
SArray* pTags; // SArray<SSchema>
SArray* pUsedCols; // SArray<SSchema>
2024-01-31 06:20:49 +00:00
char* ast;
2024-02-07 03:40:47 +00:00
int64_t streamUid;
int64_t reqTs;
int64_t rspTs;
2024-05-30 11:41:22 +00:00
int64_t delayDuration; // ms
2024-02-07 03:40:47 +00:00
bool fillHistoryFinished;
2025-06-24 10:27:02 +00:00
2025-12-15 08:48:20 +00:00
void* streamAddr; // for stream task, the address of the stream task
2023-11-29 11:07:23 +00:00
} STableTSMAInfo;
int32_t tSerializeTableTSMAInfoRsp(void* buf, int32_t bufLen, const STableTSMAInfoRsp* pRsp);
2024-02-07 03:40:47 +00:00
int32_t tDeserializeTableTSMAInfoRsp(void* buf, int32_t bufLen, STableTSMAInfoRsp* pRsp);
2023-12-22 06:05:31 +00:00
int32_t tCloneTbTSMAInfo(STableTSMAInfo* pInfo, STableTSMAInfo** pRes);
2023-11-29 11:07:23 +00:00
void tFreeTableTSMAInfo(void* p);
void tFreeAndClearTableTSMAInfo(void* p);
void tFreeTableTSMAInfoRsp(STableTSMAInfoRsp* pRsp);
2024-05-30 11:41:22 +00:00
#define STSMAHbRsp STableTSMAInfoRsp
#define tSerializeTSMAHbRsp tSerializeTableTSMAInfoRsp
2023-11-29 11:07:23 +00:00
#define tDeserializeTSMAHbRsp tDeserializeTableTSMAInfoRsp
2024-05-30 11:41:22 +00:00
#define tFreeTSMAHbRsp tFreeTableTSMAInfoRsp
2023-09-28 03:44:38 +00:00
2024-03-13 11:35:16 +00:00
typedef struct SDropCtbWithTsmaSingleVgReq {
SVgroupInfo vgInfo;
2024-05-30 11:41:22 +00:00
SArray* pTbs; // SVDropTbReq
2024-03-18 06:09:17 +00:00
} SMDropTbReqsOnSingleVg;
2024-03-13 11:35:16 +00:00
2024-03-18 06:09:17 +00:00
int32_t tEncodeSMDropTbReqOnSingleVg(SEncoder* pEncoder, const SMDropTbReqsOnSingleVg* pReq);
int32_t tDecodeSMDropTbReqOnSingleVg(SDecoder* pDecoder, SMDropTbReqsOnSingleVg* pReq);
2024-03-22 07:25:14 +00:00
void tFreeSMDropTbReqOnSingleVg(void* p);
2024-03-13 11:35:16 +00:00
2024-03-18 06:09:17 +00:00
typedef struct SDropTbsReq {
2024-05-30 11:41:22 +00:00
SArray* pVgReqs; // SMDropTbReqsOnSingleVg
2024-03-18 06:09:17 +00:00
} SMDropTbsReq;
2024-03-13 11:35:16 +00:00
2024-03-18 06:09:17 +00:00
int32_t tSerializeSMDropTbsReq(void* buf, int32_t bufLen, const SMDropTbsReq* pReq);
int32_t tDeserializeSMDropTbsReq(void* buf, int32_t bufLen, SMDropTbsReq* pReq);
2024-03-22 07:25:14 +00:00
void tFreeSMDropTbsReq(void*);
2024-03-15 01:09:16 +00:00
typedef struct SVFetchTtlExpiredTbsRsp {
2024-03-18 06:09:17 +00:00
SArray* pExpiredTbs; // SVDropTbReq
2024-03-15 01:09:16 +00:00
int32_t vgId;
} SVFetchTtlExpiredTbsRsp;
int32_t tEncodeVFetchTtlExpiredTbsRsp(SEncoder* pCoder, const SVFetchTtlExpiredTbsRsp* pRsp);
int32_t tDecodeVFetchTtlExpiredTbsRsp(SDecoder* pCoder, SVFetchTtlExpiredTbsRsp* pRsp);
void tFreeFetchTtlExpiredTbsRsp(void* p);
2023-09-28 03:44:38 +00:00
2024-03-12 09:47:01 +00:00
void setDefaultOptionsForField(SFieldWithOptions* field);
void setFieldWithOptions(SFieldWithOptions* fieldWithOptions, SField* field);
2023-09-28 03:44:38 +00:00
2025-12-15 08:48:20 +00:00
int32_t tSerializeSVSubTablesRspImpl(SEncoder* pEncoder, SVSubTablesRsp* pRsp);
int32_t tDeserializeSVSubTablesRspImpl(SDecoder* pDecoder, SVSubTablesRsp* pRsp);
2025-04-24 01:11:54 +00:00
2025-11-28 02:10:37 +00:00
typedef struct {
char id[TSDB_INSTANCE_ID_LEN];
char type[TSDB_INSTANCE_TYPE_LEN];
char desc[TSDB_INSTANCE_DESC_LEN];
int32_t expire;
} SInstanceRegisterReq;
int32_t tSerializeSInstanceRegisterReq(void* buf, int32_t bufLen, SInstanceRegisterReq* pReq);
int32_t tDeserializeSInstanceRegisterReq(void* buf, int32_t bufLen, SInstanceRegisterReq* pReq);
typedef struct {
char filter_type[TSDB_INSTANCE_TYPE_LEN];
} SInstanceListReq;
typedef struct {
int32_t count;
char** ids; // Array of instance IDs
} SInstanceListRsp;
int32_t tSerializeSInstanceListReq(void* buf, int32_t bufLen, SInstanceListReq* pReq);
int32_t tDeserializeSInstanceListReq(void* buf, int32_t bufLen, SInstanceListReq* pReq);
int32_t tSerializeSInstanceListRsp(void* buf, int32_t bufLen, SInstanceListRsp* pRsp);
int32_t tDeserializeSInstanceListRsp(void* buf, int32_t bufLen, SInstanceListRsp* pRsp);
2025-07-12 07:39:29 +00:00
#ifdef USE_MOUNT
typedef struct {
char mountName[TSDB_MOUNT_NAME_LEN];
int8_t ignoreExist;
int16_t nMounts;
int32_t* dnodeIds;
char** mountPaths;
int32_t sqlLen;
char* sql;
} SCreateMountReq;
int32_t tSerializeSCreateMountReq(void* buf, int32_t bufLen, SCreateMountReq* pReq);
int32_t tDeserializeSCreateMountReq(void* buf, int32_t bufLen, SCreateMountReq* pReq);
void tFreeSCreateMountReq(SCreateMountReq* pReq);
typedef struct {
char mountName[TSDB_MOUNT_NAME_LEN];
int8_t ignoreNotExists;
int32_t sqlLen;
char* sql;
} SDropMountReq;
int32_t tSerializeSDropMountReq(void* buf, int32_t bufLen, SDropMountReq* pReq);
int32_t tDeserializeSDropMountReq(void* buf, int32_t bufLen, SDropMountReq* pReq);
void tFreeSDropMountReq(SDropMountReq* pReq);
typedef struct {
char mountName[TSDB_MOUNT_NAME_LEN];
char mountPath[TSDB_MOUNT_PATH_LEN];
int64_t mountUid;
int32_t dnodeId;
uint32_t valLen;
int8_t ignoreExist;
void* pVal;
} SRetrieveMountPathReq;
int32_t tSerializeSRetrieveMountPathReq(void* buf, int32_t bufLen, SRetrieveMountPathReq* pReq);
int32_t tDeserializeSRetrieveMountPathReq(void* buf, int32_t bufLen, SRetrieveMountPathReq* pReq);
typedef struct {
// path
int32_t diskPrimary;
// vgInfo
int32_t vgId;
int32_t cacheLastSize;
int32_t szPage;
int32_t szCache;
uint64_t szBuf;
int8_t cacheLast;
int8_t standby;
int8_t hashMethod;
uint32_t hashBegin;
uint32_t hashEnd;
int16_t hashPrefix;
int16_t hashSuffix;
int16_t sttTrigger;
// syncInfo
int32_t replications;
// tsdbInfo
int8_t precision;
int8_t compression;
int8_t slLevel;
int32_t daysPerFile;
int32_t keep0;
int32_t keep1;
int32_t keep2;
int32_t keepTimeOffset;
int32_t minRows;
int32_t maxRows;
int32_t tsdbPageSize;
feat[ts-6107]: shared storage (#31552) * add API to use s3 as shared storage * support using local file system as shared storage * upload file to shared storage * support read, compact and drop * finish basic mnode & vnode msg processing * follower sync migration state * implement mnode transaction, and improve log * send migration progress msg to dnode to avoid deadlock * implement following migration * remove mcount * avoid redo migration on startup * avoid follower deadlock when leader is down * trigger migrate by timer, avoid compact after migration * comment out the usage of 'tcs' functions in stream * change config item prefix from s3 to ss * change db option prefix from s3 to ss * rename s3 data struct, function, file to ss * rename s3 macro to ss * update s3 sql to ss * rename remaining s3 items to ss * check ss configruation, improve s3 retry * grant object storage -> shared storage, check ssEnabled * fix memory leaks * update build options * omit sensitive information when dump config * fix backward compatibility issue * fix issues found in ci-checks * fix some failed test cases * avoid follower timeout and improve log * fix: follower timeout because migration status not updated * refuse migration if there's an in progress one * fix ss test case * remove garbage files and other minor improvement * fix failed test cases * update unit test * fix failed test case * fix failed test case * update document * update document and fix failed test cases * fix minor issues in code, test and document * check new commit after migration task is scheduled * fix several issus 1. migrate information cannot be dropped sometimes because progress response was put into read queue. 2. memory leak in rare cases 3. data corruption in rare cases 4. failed test case * add shared storage upgrade tool * fix compile error
2025-07-14 08:33:53 +00:00
int32_t ssChunkSize;
int32_t ssKeepLocal;
int8_t ssCompact;
2026-01-28 11:06:16 +00:00
union {
uint8_t flags;
struct {
uint8_t isAudit : 1;
uint8_t allowDrop : 1;
uint8_t securityLevel : 3;
uint8_t reserved : 3;
2026-01-28 11:06:16 +00:00
};
};
int8_t secureDelete;
2025-07-12 07:39:29 +00:00
// walInfo
int32_t walFsyncPeriod; // millisecond
int32_t walRetentionPeriod; // secs
int32_t walRollPeriod; // secs
int64_t walRetentionSize;
int64_t walSegSize;
int32_t walLevel;
// encryptInfo
int32_t encryptAlgorithm;
// SVState
int64_t committed;
int64_t commitID;
int64_t commitTerm;
// stats
int64_t numOfSTables;
int64_t numOfCTables;
int64_t numOfNTables;
// dbInfo
uint64_t dbId;
} SMountVgInfo;
typedef struct {
SMCreateStbReq req;
SArray* pColExts; // element: column id
SArray* pTagExts; // element: tag id
} SMountStbInfo;
int32_t tSerializeSMountStbInfo(void* buf, int32_t bufLen, int32_t* pFLen, SMountStbInfo* pInfo);
int32_t tDeserializeSMountStbInfo(void* buf, int32_t bufLen, int32_t flen, SMountStbInfo* pInfo);
typedef struct {
char dbName[TSDB_DB_FNAME_LEN];
uint64_t dbId;
2025-12-15 08:48:20 +00:00
SArray* pVgs; // SMountVgInfo
SArray* pStbs; // 0 serialized binary of SMountStbInfo, 1 SMountStbInfo
2025-07-12 07:39:29 +00:00
} SMountDbInfo;
typedef struct {
// common fields
char mountName[TSDB_MOUNT_NAME_LEN];
char mountPath[TSDB_MOUNT_PATH_LEN];
int8_t ignoreExist;
int64_t mountUid;
int64_t clusterId;
int32_t dnodeId;
uint32_t valLen;
void* pVal;
// response fields
SArray* pDbs; // SMountDbInfo
// memory fields, no serialized
SArray* pDisks[TFS_MAX_TIERS];
TdFilePtr pFile;
} SMountInfo;
int32_t tSerializeSMountInfo(void* buf, int32_t bufLen, SMountInfo* pReq);
int32_t tDeserializeSMountInfo(SDecoder* decoder, SMountInfo* pReq, bool extractStb);
void tFreeMountInfo(SMountInfo* pReq, bool stbExtracted);
typedef struct {
SCreateVnodeReq createReq;
char mountPath[TSDB_MOUNT_FPATH_LEN];
char mountName[TSDB_MOUNT_NAME_LEN];
int64_t mountId;
int32_t diskPrimary;
int32_t mountVgId;
int64_t committed;
int64_t commitID;
int64_t commitTerm;
int64_t numOfSTables;
int64_t numOfCTables;
int64_t numOfNTables;
} SMountVnodeReq;
2025-12-15 08:48:20 +00:00
int32_t tSerializeSMountVnodeReq(void* buf, int32_t* cBufLen, int32_t* tBufLen, SMountVnodeReq* pReq);
2025-07-12 07:39:29 +00:00
int32_t tDeserializeSMountVnodeReq(void* buf, int32_t bufLen, SMountVnodeReq* pReq);
int32_t tFreeSMountVnodeReq(SMountVnodeReq* pReq);
#endif // USE_MOUNT
2022-02-28 12:46:23 +00:00
#pragma pack(pop)
typedef struct {
char db[TSDB_DB_FNAME_LEN];
STimeWindow timeRange;
int32_t sqlLen;
char* sql;
SArray* vgroupIds;
} SScanDbReq;
int32_t tSerializeSScanDbReq(void* buf, int32_t bufLen, SScanDbReq* pReq);
int32_t tDeserializeSScanDbReq(void* buf, int32_t bufLen, SScanDbReq* pReq);
void tFreeSScanDbReq(SScanDbReq* pReq);
typedef struct {
int32_t scanId;
int8_t bAccepted;
} SScanDbRsp;
int32_t tSerializeSScanDbRsp(void* buf, int32_t bufLen, SScanDbRsp* pRsp);
int32_t tDeserializeSScanDbRsp(void* buf, int32_t bufLen, SScanDbRsp* pRsp);
typedef struct {
int32_t scanId;
int32_t sqlLen;
char* sql;
} SKillScanReq;
int32_t tSerializeSKillScanReq(void* buf, int32_t bufLen, SKillScanReq* pReq);
int32_t tDeserializeSKillScanReq(void* buf, int32_t bufLen, SKillScanReq* pReq);
void tFreeSKillScanReq(SKillScanReq* pReq);
typedef struct {
int32_t scanId;
int32_t vgId;
int32_t dnodeId;
} SVKillScanReq;
int32_t tSerializeSVKillScanReq(void* buf, int32_t bufLen, SVKillScanReq* pReq);
int32_t tDeserializeSVKillScanReq(void* buf, int32_t bufLen, SVKillScanReq* pReq);
typedef struct {
int32_t scanId;
int32_t vgId;
int32_t dnodeId;
int32_t numberFileset;
int32_t finished;
int32_t progress;
int64_t remainingTime;
} SQueryScanProgressRsp;
int32_t tSerializeSQueryScanProgressRsp(void* buf, int32_t bufLen, SQueryScanProgressRsp* pReq);
int32_t tDeserializeSQueryScanProgressRsp(void* buf, int32_t bufLen, SQueryScanProgressRsp* pReq);
typedef struct {
int32_t scanId;
int32_t vgId;
int32_t dnodeId;
} SQueryScanProgressReq;
int32_t tSerializeSQueryScanProgressReq(void* buf, int32_t bufLen, SQueryScanProgressReq* pReq);
int32_t tDeserializeSQueryScanProgressReq(void* buf, int32_t bufLen, SQueryScanProgressReq* pReq);
typedef struct {
int64_t dbUid;
char db[TSDB_DB_FNAME_LEN];
int64_t scanStartTime;
STimeWindow tw;
int32_t scanId;
} SScanVnodeReq;
int32_t tSerializeSScanVnodeReq(void* buf, int32_t bufLen, SScanVnodeReq* pReq);
int32_t tDeserializeSScanVnodeReq(void* buf, int32_t bufLen, SScanVnodeReq* pReq);
2021-10-08 05:53:49 +00:00
#ifdef __cplusplus
}
#endif
#endif /*_TD_COMMON_TAOS_MSG_H_*/