diff --git a/docs/en/12-taos-sql/03-table.md b/docs/en/12-taos-sql/03-table.md index ca22a6ace7..487ce92e03 100644 --- a/docs/en/12-taos-sql/03-table.md +++ b/docs/en/12-taos-sql/03-table.md @@ -25,7 +25,7 @@ create_definition: col_name column_definition column_definition: - type_name [comment 'string_value'] [PRIMARY KEY] [ENCODE 'encode_type'] [COMPRESS 'compress_type'] [LEVEL 'level_type'] + type_name [comment 'string_value'] [PRIMARY KEY] [ENCODE 'encode_type'] [COMPRESS 'compress_type'] [LEVEL 'level_type'] table_options: table_option ... @@ -52,9 +52,9 @@ table_option: { **Parameter description** -1. COMMENT: specifies comments for the table. This parameter can be used with supertables, standard tables, and subtables. +1. COMMENT: specifies comments for the table. This parameter can be used with supertables, standard tables, and subtables. The maximum length of the comment is 1024 bytes. 2. SMA: specifies functions on which to enable small materialized aggregates (SMA). SMA is user-defined precomputation of aggregates based on data blocks. Enter one of the following values: max, min, or sum This parameter can be used with supertables and standard tables. -3. TTL: specifies the time to live (TTL) for the table. If TTL is specified when creatinga table, after the time period for which the table has been existing is over TTL, TDengine will automatically delete the table. Please be noted that the system may not delete the table at the exact moment that the TTL expires but guarantee there is such a system and finally the table will be deleted. The unit of TTL is in days. The default value is 0, i.e. never expire. +3. TTL: specifies the time to live (TTL) for the table. If TTL is specified when creatinga table, after the time period for which the table has been existing is over TTL, TDengine will automatically delete the table. Please be noted that the system may not delete the table at the exact moment that the TTL expires but guarantee there is such a system and finally the table will be deleted. The unit of TTL is in days. The value range is [0, 2147483647]. The default value is 0, i.e. never expire. ## Create Subtables @@ -112,6 +112,11 @@ You can perform the following modifications on existing tables: 4. RENAME COLUMN: renames a specified column in the table. 5. The primary key column of a table cannot be modified or added or deleted using ADD/DROP COLUMN. +**Parameter description** + +1. COMMENT: specifies comments for the table. This parameter can be used with supertables, standard tables, and subtables. The maximum length of the comment is 1024 bytes. +2. TTL: specifies the time to live (TTL) for the table. If TTL is specified when creatinga table, after the time period for which the table has been existing is over TTL, TDengine will automatically delete the table. Please be noted that the system may not delete the table at the exact moment that the TTL expires but guarantee there is such a system and finally the table will be deleted. The unit of TTL is in days. The value range is [0, 2147483647]. The default value is 0, i.e. never expire. + ### Add a Column ```sql @@ -136,6 +141,18 @@ ALTER TABLE tb_name MODIFY COLUMN field_name data_type(length); ALTER TABLE tb_name RENAME COLUMN old_col_name new_col_name ``` +### Alter Table TTL + +```sql +ALTER TABLE tb_name TTL value +``` + +### Alter Table Comment + +```sql +ALTER TABLE tb_name COMMENT 'string_value' +``` + ## Modify a Subtable ```sql @@ -159,12 +176,29 @@ alter_table_option: { 1. Only the value of a tag can be modified directly. For all other modifications, you must modify the supertable from which the subtable was created. +**Parameter description** + +1. COMMENT: specifies comments for the table. This parameter can be used with supertables, standard tables, and subtables. The maximum length of the comment is 1024 bytes. +2. TTL: specifies the time to live (TTL) for the table. If TTL is specified when creatinga table, after the time period for which the table has been existing is over TTL, TDengine will automatically delete the table. Please be noted that the system may not delete the table at the exact moment that the TTL expires but guarantee there is such a system and finally the table will be deleted. The unit of TTL is in days. The value range is [0, 2147483647]. The default value is 0, i.e. never expire. + ### Change Tag Value Of Sub Table ``` ALTER TABLE tb_name SET TAG tag_name=new_tag_value; ``` +### Alter Table TTL + +```sql +ALTER TABLE tb_name TTL value +``` + +### Alter Table Comment + +```sql +ALTER TABLE tb_name COMMENT 'string_value' +``` + ## Delete a Table The following SQL statement deletes one or more tables. diff --git a/docs/en/21-tdinternal/08-compress.md b/docs/en/21-tdinternal/08-compress.md index a3b073c3a7..10a06a4c91 100644 --- a/docs/en/21-tdinternal/08-compress.md +++ b/docs/en/21-tdinternal/08-compress.md @@ -1,12 +1,8 @@ - --- - title: Configurable Column Compression description: Configurable column storage compression method --- -# Configurable Storage Compression - Since TDengine 3.3.0.0, more advanced compression feature is introduced, you can specify compression or not, the compression method and compression level for each column. ## Compression Terminology Definition @@ -32,16 +28,14 @@ In this article, it specifically refers to the level within the secondary compre - Default compression algorithm list and applicable range for each data type -| Data Type | Optional Encoding Algorithm | Default Encoding Algorithm | Optional Compression Algorithm|Default Compression Algorithm| Default Compression Level| +| Data Type | Optional Encoding Algorithm | Default Encoding Algorithm | Optional Compression Algorithm|Default Compression Algorithm| Default Compression Level| | :-----------:|:----------:|:-------:|:-------:|:----------:|:----:| - tinyint/untinyint/smallint/usmallint/int/uint | simple8b| simple8b | lz4/zlib/zstd/xz| lz4 | medium| +| tinyint/untinyint/smallint/usmallint/int/uint | simple8b| simple8b | lz4/zlib/zstd/xz| lz4 | medium| | bigint/ubigint/timestamp | simple8b/delta-i | delta-i |lz4/zlib/zstd/xz | lz4| medium| -|float/double | delta-d|delta-d |lz4/zlib/zstd/xz/tsz|tsz| medium| +|float/double | delta-d|delta-d |lz4/zlib/zstd/xz/tsz|lz4| medium| |binary/nchar| disabled| disabled|lz4/zlib/zstd/xz| lz4| medium| |bool| bit-packing| bit-packing| lz4/zlib/zstd/xz| lz4| medium| -Note: For floating point types, if configured as tsz, its precision is determined by the global configuration of taosd. If configured as tsz, but the lossy compression flag is not configured, lz4 is used for compression by default. - ## SQL ### Create Table with Compression @@ -76,7 +70,7 @@ ALTER TABLE [db_name.]tabName MODIFY COLUMN colName [ENCODE 'ecode_type'] [COMPR - Change the compression method of the column -### View Compression Dethod +### View Compression Method ```sql DESCRIBE [dbname.]tabName diff --git a/docs/zh/12-taos-sql/03-table.md b/docs/zh/12-taos-sql/03-table.md index 773ce75430..09580fb788 100644 --- a/docs/zh/12-taos-sql/03-table.md +++ b/docs/zh/12-taos-sql/03-table.md @@ -23,10 +23,10 @@ create_subtable_clause: { } create_definition: - col_name column_definition + col_name column_definition column_definition: - type_name [comment 'string_value'] [PRIMARY KEY] [ENCODE 'encode_type'] [COMPRESS 'compress_type'] [LEVEL 'level_type'] + type_name [comment 'string_value'] [PRIMARY KEY] [ENCODE 'encode_type'] [COMPRESS 'compress_type'] [LEVEL 'level_type'] table_options: table_option ... @@ -52,9 +52,9 @@ table_option: { **参数说明** -1. COMMENT:表注释。可用于超级表、子表和普通表。 +1. COMMENT:表注释。可用于超级表、子表和普通表。最大长度为 1024 个字节。 2. SMA:Small Materialized Aggregates,提供基于数据块的自定义预计算功能。预计算类型包括 MAX、MIN 和 SUM。可用于超级表/普通表。 -3. TTL:Time to Live,是用户用来指定表的生命周期的参数。如果创建表时指定了这个参数,当该表的存在时间超过 TTL 指定的时间后,TDengine 自动删除该表。这个 TTL 的时间只是一个大概时间,系统不保证到了时间一定会将其删除,而只保证存在这样一个机制且最终一定会删除。TTL 单位是天,默认为 0,表示不限制,到期时间为表创建时间加上 TTL 时间。TTL 与数据库 KEEP 参数没有关联,如果 KEEP 比 TTL 小,在表被删除之前数据也可能已经被删除。 +3. TTL:Time to Live,是用户用来指定表的生命周期的参数。如果创建表时指定了这个参数,当该表的存在时间超过 TTL 指定的时间后,TDengine 自动删除该表。这个 TTL 的时间只是一个大概时间,系统不保证到了时间一定会将其删除,而只保证存在这样一个机制且最终一定会删除。TTL 单位是天,取值范围为[0, 2147483647],默认为 0,表示不限制,到期时间为表创建时间加上 TTL 时间。TTL 与数据库 KEEP 参数没有关联,如果 KEEP 比 TTL 小,在表被删除之前数据也可能已经被删除。 ## 创建子表 @@ -112,6 +112,11 @@ alter_table_option: { 4. RENAME COLUMN:修改列名称。 5. 普通表的主键列不能被修改,也不能通过 ADD/DROP COLUMN 来添加/删除主键列。 +**参数说明** + +1. COMMENT:表注释。可用于超级表、子表和普通表。最大长度为 1024 个字节。 +2. TTL:Time to Live,是用户用来指定表的生命周期的参数。如果创建表时指定了这个参数,当该表的存在时间超过 TTL 指定的时间后,TDengine 自动删除该表。这个 TTL 的时间只是一个大概时间,系统不保证到了时间一定会将其删除,而只保证存在这样一个机制且最终一定会删除。TTL 单位是天,取值范围为[0, 2147483647],默认为 0,表示不限制,到期时间为表创建时间加上 TTL 时间。TTL 与数据库 KEEP 参数没有关联,如果 KEEP 比 TTL 小,在表被删除之前数据也可能已经被删除。 + ### 增加列 ```sql @@ -136,6 +141,18 @@ ALTER TABLE tb_name MODIFY COLUMN field_name data_type(length); ALTER TABLE tb_name RENAME COLUMN old_col_name new_col_name ``` +### 修改表生命周期 + +```sql +ALTER TABLE tb_name TTL value +``` + +### 修改表注释 + +```sql +ALTER TABLE tb_name COMMENT 'string_value' +``` + ## 修改子表 ```sql @@ -159,12 +176,29 @@ alter_table_option: { 1. 对子表的列和标签的修改,除了更改标签值以外,都要通过超级表才能进行。 +**参数说明** + +1. COMMENT:表注释。可用于超级表、子表和普通表。最大长度为 1024 个字节。 +2. TTL:Time to Live,是用户用来指定表的生命周期的参数。如果创建表时指定了这个参数,当该表的存在时间超过 TTL 指定的时间后,TDengine 自动删除该表。这个 TTL 的时间只是一个大概时间,系统不保证到了时间一定会将其删除,而只保证存在这样一个机制且最终一定会删除。TTL 单位是天,取值范围为[0, 2147483647],默认为 0,表示不限制,到期时间为表创建时间加上 TTL 时间。TTL 与数据库 KEEP 参数没有关联,如果 KEEP 比 TTL 小,在表被删除之前数据也可能已经被删除。 + ### 修改子表标签值 ``` ALTER TABLE tb_name SET TAG tag_name=new_tag_value; ``` +### 修改表生命周期 + +```sql +ALTER TABLE tb_name TTL value +``` + +### 修改表注释 + +```sql +ALTER TABLE tb_name COMMENT 'string_value' +``` + ## 删除表 可以在一条 SQL 语句中删除一个或多个普通表或子表。 diff --git a/docs/zh/21-tdinternal/08-compress.md b/docs/zh/21-tdinternal/08-compress.md index 9653a9366b..dfec63c212 100644 --- a/docs/zh/21-tdinternal/08-compress.md +++ b/docs/zh/21-tdinternal/08-compress.md @@ -3,8 +3,6 @@ title: 可配置压缩算法 description: 可配置压缩算法 --- -# 可配置存储压缩 - 从 TDengine 3.3.0.0 版本开始,TDengine 提供了更高级的压缩功能,用户可以在建表时针对每一列配置是否进行压缩、以及使用的压缩算法和压缩级别。 ## 压缩术语定义 @@ -30,16 +28,14 @@ description: 可配置压缩算法 - 各个数据类型的默认压缩算法列表和适用范围 -| 数据类型 | 可选编码算法 | 编码算法默认值 | 可选压缩算法|可选压缩算法| 压缩等级默认值| +| 数据类型 | 可选编码算法 | 编码算法默认值 | 可选压缩算法|压缩算法默认值| 压缩等级默认值| | :-----------:|:----------:|:-------:|:-------:|:----------:|:----:| - tinyint/untinyint/smallint/usmallint/int/uint | simple8b| simple8b | lz4/zlib/zstd/xz| lz4 | medium| +| tinyint/untinyint/smallint/usmallint/int/uint | simple8b| simple8b | lz4/zlib/zstd/xz| lz4 | medium| | bigint/ubigint/timestamp | simple8b/delta-i | delta-i |lz4/zlib/zstd/xz | lz4| medium| -|float/double | delta-d|delta-d |lz4/zlib/zstd/xz/tsz|tsz| medium| +|float/double | delta-d|delta-d |lz4/zlib/zstd/xz/tsz|lz4| medium| |binary/nchar| disabled| disabled|lz4/zlib/zstd/xz| lz4| medium| |bool| bit-packing| bit-packing| lz4/zlib/zstd/xz| lz4| medium| -注意: 针对浮点类型,如果配置为tsz, 其精度由taosd的全局配置决定,如果配置为tsz, 但是没有配置有损压缩标志, 则使用lz4进行压缩 - ## SQL 语法 ### 建表时指定压缩 diff --git a/include/client/taos.h b/include/client/taos.h index a22c8e5138..1d2b3a913c 100644 --- a/include/client/taos.h +++ b/include/client/taos.h @@ -366,7 +366,7 @@ typedef enum { } TSDB_SERVER_STATUS; DLL_EXPORT TSDB_SERVER_STATUS taos_check_server_status(const char *fqdn, int port, char *details, int maxlen); - +DLL_EXPORT char* getBuildInfo(); #ifdef __cplusplus } #endif diff --git a/include/common/taosdef.h b/include/common/taosdef.h index 9e92e2f569..c6e03dc1d8 100644 --- a/include/common/taosdef.h +++ b/include/common/taosdef.h @@ -30,10 +30,6 @@ typedef int64_t tb_uid_t; #define IS_TSWINDOW_SPECIFIED(win) (((win).skey != INT64_MIN) || ((win).ekey != INT64_MAX)) #define TSWINDOW_IS_EQUAL(t1, t2) (((t1).skey == (t2).skey) && ((t1).ekey == (t2).ekey)) -//define show cluster alive and show db.alive -#define SHOW_STATUS_NOT_AVAILABLE 0 -#define SHOW_STATUS_AVAILABLE 1 -#define SHOW_STATUS_HALF_AVAILABLE 2 typedef enum { TSDB_SUPER_TABLE = 1, // super table diff --git a/include/libs/executor/storageapi.h b/include/libs/executor/storageapi.h index 8c67f77adb..1b2280115a 100644 --- a/include/libs/executor/storageapi.h +++ b/include/libs/executor/storageapi.h @@ -410,7 +410,7 @@ typedef struct SStateStore { void (*streamFileStateClear)(struct SStreamFileState* pFileState); bool (*needClearDiskBuff)(struct SStreamFileState* pFileState); - SStreamState* (*streamStateOpen)(const char* path, void* pTask, int64_t streamId, int32_t taskId, bool specPath, int32_t szPage, int32_t pages); + SStreamState* (*streamStateOpen)(const char* path, void* pTask, int64_t streamId, int32_t taskId); void (*streamStateClose)(SStreamState* pState, bool remove); int32_t (*streamStateBegin)(SStreamState* pState); int32_t (*streamStateCommit)(SStreamState* pState); diff --git a/include/libs/nodes/querynodes.h b/include/libs/nodes/querynodes.h index befd6afce9..457937835d 100644 --- a/include/libs/nodes/querynodes.h +++ b/include/libs/nodes/querynodes.h @@ -628,6 +628,7 @@ char* nodesGetStrValueFromNode(SValueNode* pNode); void nodesValueNodeToVariant(const SValueNode* pNode, SVariant* pVal); SValueNode* nodesMakeValueNodeFromString(char* literal); SValueNode* nodesMakeValueNodeFromBool(bool b); +SNode* nodesMakeValueNodeFromInt32(int32_t value); char* nodesGetFillModeString(EFillMode mode); int32_t nodesMergeConds(SNode** pDst, SNodeList** pSrc); diff --git a/include/libs/stream/streamState.h b/include/libs/stream/streamState.h index 1333257dfb..106efa8947 100644 --- a/include/libs/stream/streamState.h +++ b/include/libs/stream/streamState.h @@ -29,8 +29,7 @@ extern "C" { #include "storageapi.h" -SStreamState* streamStateOpen(const char* path, void* pTask, int64_t streamId, int32_t taskId, bool specPath, - int32_t szPage, int32_t pages); +SStreamState* streamStateOpen(const char* path, void* pTask, int64_t streamId, int32_t taskId); void streamStateClose(SStreamState* pState, bool remove); int32_t streamStateBegin(SStreamState* pState); int32_t streamStateCommit(SStreamState* pState); diff --git a/include/libs/wal/wal.h b/include/libs/wal/wal.h index 7f779609eb..155da9d116 100644 --- a/include/libs/wal/wal.h +++ b/include/libs/wal/wal.h @@ -60,6 +60,7 @@ typedef struct { EWalType level; // wal level int32_t encryptAlgorithm; char encryptKey[ENCRYPT_KEY_LEN + 1]; + int8_t clearFiles; } SWalCfg; typedef struct { diff --git a/include/util/taoserror.h b/include/util/taoserror.h index a06581bcad..6dc9b46db5 100644 --- a/include/util/taoserror.h +++ b/include/util/taoserror.h @@ -336,6 +336,7 @@ int32_t taosGetErrSize(); #define TSDB_CODE_MND_DB_IN_CREATING TAOS_DEF_ERROR_CODE(0, 0x0396) // #define TSDB_CODE_MND_INVALID_SYS_TABLENAME TAOS_DEF_ERROR_CODE(0, 0x039A) #define TSDB_CODE_MND_ENCRYPT_NOT_ALLOW_CHANGE TAOS_DEF_ERROR_CODE(0, 0x039B) +#define TSDB_CODE_MND_INVALID_WAL_LEVEL TAOS_DEF_ERROR_CODE(0, 0x039C) // mnode-node #define TSDB_CODE_MND_MNODE_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x03A0) diff --git a/source/common/test/CMakeLists.txt b/source/common/test/CMakeLists.txt index bacc766990..2fe3ef652d 100644 --- a/source/common/test/CMakeLists.txt +++ b/source/common/test/CMakeLists.txt @@ -40,12 +40,24 @@ add_test( COMMAND dataformatTest ) -# tmsg test -add_executable(tmsgTest "") -target_sources(tmsgTest +if (${TD_LINUX}) + # tmsg test + add_executable(tmsgTest "") + target_sources(tmsgTest PRIVATE "tmsgTest.cpp" "../src/tmsg.c" -) -target_include_directories(tmsgTest PUBLIC "${TD_SOURCE_DIR}/include/common/") -target_link_libraries(tmsgTest PUBLIC os util gtest gtest_main) \ No newline at end of file + ) + target_include_directories(tmsgTest PUBLIC "${TD_SOURCE_DIR}/include/common/") + target_link_libraries(tmsgTest PUBLIC os util gtest gtest_main) + add_test( + NAME tmsgTest + COMMAND tmsgTest + ) + + # config file for msg type table + SET(MSG_TBL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/msgTypeTable.ini) + add_custom_command(TARGET tmsgTest POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${MSG_TBL_FILE} $ + ) +endif () \ No newline at end of file diff --git a/source/common/test/msgTypeTable.ini b/source/common/test/msgTypeTable.ini new file mode 100644 index 0000000000..bdb6aece0c --- /dev/null +++ b/source/common/test/msgTypeTable.ini @@ -0,0 +1,556 @@ +TDMT_DND_CREATE_MNODE = 1 +TDMT_DND_CREATE_MNODE_RSP = 2 +TDMT_DND_DROP_MNODE = 3 +TDMT_DND_DROP_MNODE_RSP = 4 +TDMT_DND_CREATE_QNODE = 5 +TDMT_DND_CREATE_QNODE_RSP = 6 +TDMT_DND_DROP_QNODE = 7 +TDMT_DND_DROP_QNODE_RSP = 8 +TDMT_DND_CREATE_SNODE = 9 +TDMT_DND_CREATE_SNODE_RSP = 10 +TDMT_DND_DROP_SNODE = 11 +TDMT_DND_DROP_SNODE_RSP = 12 +TDMT_DND_CREATE_BNODE = 13 +TDMT_DND_CREATE_BNODE_RSP = 14 +TDMT_DND_DROP_BNODE = 15 +TDMT_DND_DROP_BNODE_RSP = 16 +TDMT_DND_CREATE_VNODE = 17 +TDMT_DND_CREATE_VNODE_RSP = 18 +TDMT_DND_DROP_VNODE = 19 +TDMT_DND_DROP_VNODE_RSP = 20 +TDMT_DND_SERVER_STATUS = 21 +TDMT_DND_SERVER_STATUS_RSP = 22 +TDMT_DND_NET_TEST = 23 +TDMT_DND_NET_TEST_RSP = 24 +TDMT_DND_CONFIG_DNODE = 25 +TDMT_DND_CONFIG_DNODE_RSP = 26 +TDMT_DND_SYSTABLE_RETRIEVE = 27 +TDMT_DND_SYSTABLE_RETRIEVE_RSP = 28 +TDMT_DND_UNUSED_CODE = 29 +TDMT_DND_UNUSED_CODE_RSP = 30 +TDMT_DND_ALTER_MNODE_TYPE = 31 +TDMT_DND_ALTER_MNODE_TYPE_RSP = 32 +TDMT_DND_ALTER_VNODE_TYPE = 33 +TDMT_DND_ALTER_VNODE_TYPE_RSP = 34 +TDMT_DND_CHECK_VNODE_LEARNER_CATCHUP = 35 +TDMT_DND_CHECK_VNODE_LEARNER_CATCHUP_RSP = 36 +TDMT_DND_CREATE_ENCRYPT_KEY = 37 +TDMT_DND_CREATE_ENCRYPT_KEY_RSP = 38 +TDMT_DND_MAX_MSG = 39 +TDMT_DND_MAX_MSG_RSP = 40 +TDMT_MND_CONNECT = 257 +TDMT_MND_CONNECT_RSP = 258 +TDMT_MND_CREATE_ACCT = 259 +TDMT_MND_CREATE_ACCT_RSP = 260 +TDMT_MND_ALTER_ACCT = 261 +TDMT_MND_ALTER_ACCT_RSP = 262 +TDMT_MND_DROP_ACCT = 263 +TDMT_MND_DROP_ACCT_RSP = 264 +TDMT_MND_CREATE_USER = 265 +TDMT_MND_CREATE_USER_RSP = 266 +TDMT_MND_ALTER_USER = 267 +TDMT_MND_ALTER_USER_RSP = 268 +TDMT_MND_DROP_USER = 269 +TDMT_MND_DROP_USER_RSP = 270 +TDMT_MND_GET_USER_AUTH = 271 +TDMT_MND_GET_USER_AUTH_RSP = 272 +TDMT_MND_CREATE_DNODE = 273 +TDMT_MND_CREATE_DNODE_RSP = 274 +TDMT_MND_CONFIG_DNODE = 275 +TDMT_MND_CONFIG_DNODE_RSP = 276 +TDMT_MND_DROP_DNODE = 277 +TDMT_MND_DROP_DNODE_RSP = 278 +TDMT_MND_CREATE_MNODE = 279 +TDMT_MND_CREATE_MNODE_RSP = 280 +TDMT_MND_ALTER_MNODE = 281 +TDMT_MND_ALTER_MNODE_RSP = 282 +TDMT_MND_DROP_MNODE = 283 +TDMT_MND_DROP_MNODE_RSP = 284 +TDMT_MND_CREATE_QNODE = 285 +TDMT_MND_CREATE_QNODE_RSP = 286 +TDMT_MND_ALTER_QNODE = 287 +TDMT_MND_ALTER_QNODE_RSP = 288 +TDMT_MND_DROP_QNODE = 289 +TDMT_MND_DROP_QNODE_RSP = 290 +TDMT_MND_QNODE_LIST = 291 +TDMT_MND_QNODE_LIST_RSP = 292 +TDMT_MND_DNODE_LIST = 293 +TDMT_MND_DNODE_LIST_RSP = 294 +TDMT_MND_CREATE_SNODE = 295 +TDMT_MND_CREATE_SNODE_RSP = 296 +TDMT_MND_ALTER_SNODE = 297 +TDMT_MND_ALTER_SNODE_RSP = 298 +TDMT_MND_DROP_SNODE = 299 +TDMT_MND_DROP_SNODE_RSP = 300 +TDMT_MND_CREATE_BNODE = 301 +TDMT_MND_CREATE_BNODE_RSP = 302 +TDMT_MND_ALTER_BNODE = 303 +TDMT_MND_ALTER_BNODE_RSP = 304 +TDMT_MND_DROP_BNODE = 305 +TDMT_MND_DROP_BNODE_RSP = 306 +TDMT_MND_CREATE_DB = 307 +TDMT_MND_CREATE_DB_RSP = 308 +TDMT_MND_DROP_DB = 309 +TDMT_MND_DROP_DB_RSP = 310 +TDMT_MND_USE_DB = 311 +TDMT_MND_USE_DB_RSP = 312 +TDMT_MND_ALTER_DB = 313 +TDMT_MND_ALTER_DB_RSP = 314 +TDMT_MND_SYNC_DB = 315 +TDMT_MND_SYNC_DB_RSP = 316 +TDMT_MND_COMPACT_DB = 317 +TDMT_MND_COMPACT_DB_RSP = 318 +TDMT_MND_TRIM_DB = 319 +TDMT_MND_TRIM_DB_RSP = 320 +TDMT_MND_GET_DB_CFG = 321 +TDMT_MND_GET_DB_CFG_RSP = 322 +TDMT_MND_VGROUP_LIST = 323 +TDMT_MND_VGROUP_LIST_RSP = 324 +TDMT_MND_CREATE_FUNC = 325 +TDMT_MND_CREATE_FUNC_RSP = 326 +TDMT_MND_RETRIEVE_FUNC = 327 +TDMT_MND_RETRIEVE_FUNC_RSP = 328 +TDMT_MND_DROP_FUNC = 329 +TDMT_MND_DROP_FUNC_RSP = 330 +TDMT_MND_CREATE_STB = 331 +TDMT_MND_CREATE_STB_RSP = 332 +TDMT_MND_ALTER_STB = 333 +TDMT_MND_ALTER_STB_RSP = 334 +TDMT_MND_DROP_STB = 335 +TDMT_MND_DROP_STB_RSP = 336 +TDMT_MND_TABLE_META = 337 +TDMT_MND_TABLE_META_RSP = 338 +TDMT_MND_CREATE_SMA = 339 +TDMT_MND_CREATE_SMA_RSP = 340 +TDMT_MND_DROP_SMA = 341 +TDMT_MND_DROP_SMA_RSP = 342 +TDMT_MND_CREATE_STREAM = 343 +TDMT_MND_CREATE_STREAM_RSP = 344 +TDMT_MND_ALTER_STREAM = 345 +TDMT_MND_ALTER_STREAM_RSP = 346 +TDMT_MND_DROP_STREAM = 347 +TDMT_MND_DROP_STREAM_RSP = 348 +TDMT_MND_RECOVER_STREAM = 349 +TDMT_MND_RECOVER_STREAM_RSP = 350 +TDMT_MND_CREATE_INDEX = 351 +TDMT_MND_CREATE_INDEX_RSP = 352 +TDMT_MND_DROP_INDEX = 353 +TDMT_MND_DROP_INDEX_RSP = 354 +TDMT_MND_GET_INDEX = 355 +TDMT_MND_GET_INDEX_RSP = 356 +TDMT_MND_GET_TABLE_INDEX = 357 +TDMT_MND_GET_TABLE_INDEX_RSP = 358 +TDMT_MND_BATCH_META = 359 +TDMT_MND_BATCH_META_RSP = 360 +TDMT_MND_TABLE_CFG = 361 +TDMT_MND_TABLE_CFG_RSP = 362 +TDMT_MND_TMQ_CREATE_TOPIC = 363 +TDMT_MND_TMQ_CREATE_TOPIC_RSP = 364 +TDMT_MND_UNUSED1 = 365 +TDMT_MND_UNUSED1_RSP = 366 +TDMT_MND_TMQ_DROP_TOPIC = 367 +TDMT_MND_TMQ_DROP_TOPIC_RSP = 368 +TDMT_MND_TMQ_SUBSCRIBE = 369 +TDMT_MND_TMQ_SUBSCRIBE_RSP = 370 +TDMT_MND_TMQ_ASK_EP = 371 +TDMT_MND_TMQ_ASK_EP_RSP = 372 +TDMT_MND_TMQ_CONSUMER_RECOVER = 373 +TDMT_MND_TMQ_CONSUMER_RECOVER_RSP = 374 +TDMT_MND_TMQ_HB = 375 +TDMT_MND_TMQ_HB_RSP = 376 +TDMT_MND_TMQ_DO_REBALANCE = 377 +TDMT_MND_TMQ_DO_REBALANCE_RSP = 378 +TDMT_MND_TMQ_DROP_CGROUP = 379 +TDMT_MND_TMQ_DROP_CGROUP_RSP = 380 +TDMT_MND_CREATE_VG = 381 +TDMT_MND_CREATE_VG_RSP = 382 +TDMT_MND_TMQ_TIMER = 383 +TDMT_MND_TMQ_TIMER_RSP = 384 +TDMT_MND_TELEM_TIMER = 385 +TDMT_MND_TELEM_TIMER_RSP = 386 +TDMT_MND_TRANS_TIMER = 387 +TDMT_MND_TRANS_TIMER_RSP = 388 +TDMT_MND_TTL_TIMER = 389 +TDMT_MND_TTL_TIMER_RSP = 390 +TDMT_MND_GRANT_HB_TIMER = 391 +TDMT_MND_GRANT_HB_TIMER_RSP = 392 +TDMT_MND_NODECHECK_TIMER = 393 +TDMT_MND_NODECHECK_TIMER_RSP = 394 +TDMT_MND_KILL_TRANS = 395 +TDMT_MND_KILL_TRANS_RSP = 396 +TDMT_MND_KILL_QUERY = 397 +TDMT_MND_KILL_QUERY_RSP = 398 +TDMT_MND_KILL_CONN = 399 +TDMT_MND_KILL_CONN_RSP = 400 +TDMT_MND_HEARTBEAT = 401 +TDMT_MND_HEARTBEAT_RSP = 402 +TDMT_MND_STATUS = 403 +TDMT_MND_STATUS_RSP = 404 +TDMT_MND_SHOW = 405 +TDMT_MND_SHOW_RSP = 406 +TDMT_MND_SYSTABLE_RETRIEVE = 407 +TDMT_MND_SYSTABLE_RETRIEVE_RSP = 408 +TDMT_MND_GRANT = 409 +TDMT_MND_GRANT_RSP = 410 +TDMT_MND_AUTH = 411 +TDMT_MND_AUTH_RSP = 412 +TDMT_MND_APPLY_MSG = 413 +TDMT_MND_APPLY_MSG_RSP = 414 +TDMT_MND_BALANCE_VGROUP = 415 +TDMT_MND_BALANCE_VGROUP_RSP = 416 +TDMT_MND_MERGE_VGROUP = 417 +TDMT_MND_MERGE_VGROUP_RSP = 418 +TDMT_MND_REDISTRIBUTE_VGROUP = 419 +TDMT_MND_REDISTRIBUTE_VGROUP_RSP = 420 +TDMT_MND_SPLIT_VGROUP = 421 +TDMT_MND_SPLIT_VGROUP_RSP = 422 +TDMT_MND_SHOW_VARIABLES = 423 +TDMT_MND_SHOW_VARIABLES_RSP = 424 +TDMT_MND_SERVER_VERSION = 425 +TDMT_MND_SERVER_VERSION_RSP = 426 +TDMT_MND_UPTIME_TIMER = 427 +TDMT_MND_UPTIME_TIMER_RSP = 428 +TDMT_MND_TMQ_LOST_CONSUMER_CLEAR = 429 +TDMT_MND_TMQ_LOST_CONSUMER_CLEAR_RSP = 430 +TDMT_MND_STREAM_HEARTBEAT = 431 +TDMT_MND_STREAM_HEARTBEAT_RSP = 432 +TDMT_MND_RETRIEVE_IP_WHITE = 433 +TDMT_MND_RETRIEVE_IP_WHITE_RSP = 434 +TDMT_MND_GET_USER_WHITELIST = 435 +TDMT_MND_GET_USER_WHITELIST_RSP = 436 +TDMT_MND_NOTIFY = 437 +TDMT_MND_NOTIFY_RSP = 438 +TDMT_MND_BALANCE_VGROUP_LEADER = 439 +TDMT_MND_BALANCE_VGROUP_LEADER_RSP = 440 +TDMT_MND_RESTORE_DNODE = 441 +TDMT_MND_RESTORE_DNODE_RSP = 442 +TDMT_MND_PAUSE_STREAM = 443 +TDMT_MND_PAUSE_STREAM_RSP = 444 +TDMT_MND_RESUME_STREAM = 445 +TDMT_MND_RESUME_STREAM_RSP = 446 +TDMT_MND_STREAM_UPDATE_CHKPT_EVT = 447 +TDMT_MND_STREAM_UPDATE_CHKPT_EVT_RSP = 448 +TDMT_MND_STREAM_BEGIN_CHECKPOINT = 449 +TDMT_MND_STREAM_BEGIN_CHECKPOINT_RSP = 450 +TDMT_MND_STREAM_CHKPT_REPORT = 451 +TDMT_MND_STREAM_CHKPT_REPORT_RSP = 452 +TDMT_MND_STREAM_NODECHANGE_CHECK = 453 +TDMT_MND_STREAM_NODECHANGE_CHECK_RSP = 454 +TDMT_MND_TRIM_DB_TIMER = 455 +TDMT_MND_TRIM_DB_TIMER_RSP = 456 +TDMT_MND_GRANT_NOTIFY = 457 +TDMT_MND_GRANT_NOTIFY_RSP = 458 +TDMT_MND_CREATE_VIEW = 459 +TDMT_MND_CREATE_VIEW_RSP = 460 +TDMT_MND_DROP_VIEW = 461 +TDMT_MND_DROP_VIEW_RSP = 462 +TDMT_MND_VIEW_META = 463 +TDMT_MND_VIEW_META_RSP = 464 +TDMT_MND_STATIS = 465 +TDMT_MND_STATIS_RSP = 466 +TDMT_MND_KILL_COMPACT = 467 +TDMT_MND_KILL_COMPACT_RSP = 468 +TDMT_MND_COMPACT_TIMER = 469 +TDMT_MND_COMPACT_TIMER_RSP = 470 +TDMT_MND_STREAM_REQ_CHKPT = 471 +TDMT_MND_STREAM_REQ_CHKPT_RSP = 472 +TDMT_MND_CONFIG_CLUSTER = 473 +TDMT_MND_CONFIG_CLUSTER_RSP = 474 +TDMT_MND_CREATE_ENCRYPT_KEY = 475 +TDMT_MND_CREATE_ENCRYPT_KEY_RSP = 476 +TDMT_MND_S3MIGRATE_DB = 477 +TDMT_MND_S3MIGRATE_DB_RSP = 478 +TDMT_MND_S3MIGRATE_DB_TIMER = 479 +TDMT_MND_S3MIGRATE_DB_TIMER_RSP = 480 +TDMT_MND_UNUSED2 = 481 +TDMT_MND_UNUSED2_RSP = 482 +TDMT_MND_CREATE_TSMA = 483 +TDMT_MND_CREATE_TSMA_RSP = 484 +TDMT_MND_DROP_TSMA = 485 +TDMT_MND_DROP_TSMA_RSP = 486 +TDMT_MND_STB_DROP = 487 +TDMT_MND_STB_DROP_RSP = 488 +TDMT_MND_GET_TABLE_TSMA = 489 +TDMT_MND_GET_TABLE_TSMA_RSP = 490 +TDMT_MND_GET_TSMA = 491 +TDMT_MND_GET_TSMA_RSP = 492 +TDMT_MND_DROP_TB_WITH_TSMA = 493 +TDMT_MND_DROP_TB_WITH_TSMA_RSP = 494 +TDMT_MND_MAX_MSG = 495 +TDMT_MND_MAX_MSG_RSP = 496 +TDMT_VND_SUBMIT = 513 +TDMT_VND_SUBMIT_RSP = 514 +TDMT_VND_CREATE_TABLE = 515 +TDMT_VND_CREATE_TABLE_RSP = 516 +TDMT_VND_ALTER_TABLE = 517 +TDMT_VND_ALTER_TABLE_RSP = 518 +TDMT_VND_DROP_TABLE = 519 +TDMT_VND_DROP_TABLE_RSP = 520 +TDMT_VND_UPDATE_TAG_VAL = 521 +TDMT_VND_UPDATE_TAG_VAL_RSP = 522 +TDMT_VND_TABLE_META = 523 +TDMT_VND_TABLE_META_RSP = 524 +TDMT_VND_TABLES_META = 525 +TDMT_VND_TABLES_META_RSP = 526 +TDMT_VND_TABLE_CFG = 527 +TDMT_VND_TABLE_CFG_RSP = 528 +TDMT_VND_BATCH_META = 529 +TDMT_VND_BATCH_META_RSP = 530 +TDMT_VND_CREATE_STB = 531 +TDMT_VND_CREATE_STB_RSP = 532 +TDMT_VND_ALTER_STB = 533 +TDMT_VND_ALTER_STB_RSP = 534 +TDMT_VND_DROP_STB = 535 +TDMT_VND_DROP_STB_RSP = 536 +TDMT_VND_UNUSED1 = 537 +TDMT_VND_UNUSED1_RSP = 538 +TDMT_VND_UNUSED2 = 539 +TDMT_VND_UNUSED2_RSP = 540 +TDMT_VND_UNUSED3 = 541 +TDMT_VND_UNUSED3_RSP = 542 +TDMT_VND_UNUSED4 = 543 +TDMT_VND_UNUSED4_RSP = 544 +TDMT_VND_UNUSED5 = 545 +TDMT_VND_UNUSED5_RSP = 546 +TDMT_VND_UNUSED6 = 547 +TDMT_VND_UNUSED6_RSP = 548 +TDMT_VND_UNUSED7 = 549 +TDMT_VND_UNUSED7_RSP = 550 +TDMT_VND_UNUSED8 = 551 +TDMT_VND_UNUSED8_RSP = 552 +TDMT_VND_UNUSED9 = 553 +TDMT_VND_UNUSED9_RSP = 554 +TDMT_VND_UNUSED10 = 555 +TDMT_VND_UNUSED10_RSP = 556 +TDMT_VND_UNUSED11 = 557 +TDMT_VND_UNUSED11_RSP = 558 +TDMT_VND_UNUSED12 = 559 +TDMT_VND_UNUSED12_RSP = 560 +TDMT_VND_UNUSED13 = 561 +TDMT_VND_UNUSED13_RSP = 562 +TDMT_VND_UNUSED14 = 563 +TDMT_VND_UNUSED14_RSP = 564 +TDMT_VND_UNUSED15 = 565 +TDMT_VND_UNUSED15_RSP = 566 +TDMT_VND_CREATE_SMA = 567 +TDMT_VND_CREATE_SMA_RSP = 568 +TDMT_VND_CANCEL_SMA = 569 +TDMT_VND_CANCEL_SMA_RSP = 570 +TDMT_VND_DROP_SMA = 571 +TDMT_VND_DROP_SMA_RSP = 572 +TDMT_VND_SUBMIT_RSMA = 573 +TDMT_VND_SUBMIT_RSMA_RSP = 574 +TDMT_VND_FETCH_RSMA = 575 +TDMT_VND_FETCH_RSMA_RSP = 576 +TDMT_VND_EXEC_RSMA = 577 +TDMT_VND_EXEC_RSMA_RSP = 578 +TDMT_VND_DELETE = 579 +TDMT_VND_DELETE_RSP = 580 +TDMT_VND_BATCH_DEL = 581 +TDMT_VND_BATCH_DEL_RSP = 582 +TDMT_VND_ALTER_CONFIG = 583 +TDMT_VND_ALTER_CONFIG_RSP = 584 +TDMT_VND_ALTER_REPLICA = 585 +TDMT_VND_ALTER_REPLICA_RSP = 586 +TDMT_VND_ALTER_CONFIRM = 587 +TDMT_VND_ALTER_CONFIRM_RSP = 588 +TDMT_VND_ALTER_HASHRANGE = 589 +TDMT_VND_ALTER_HASHRANGE_RSP = 590 +TDMT_VND_COMPACT = 591 +TDMT_VND_COMPACT_RSP = 592 +TDMT_VND_DROP_TTL_TABLE = 593 +TDMT_VND_DROP_TTL_TABLE_RSP = 594 +TDMT_VND_TRIM = 595 +TDMT_VND_TRIM_RSP = 596 +TDMT_VND_COMMIT = 597 +TDMT_VND_COMMIT_RSP = 598 +TDMT_VND_CREATE_INDEX = 599 +TDMT_VND_CREATE_INDEX_RSP = 600 +TDMT_VND_DROP_INDEX = 601 +TDMT_VND_DROP_INDEX_RSP = 602 +TDMT_VND_DISABLE_WRITE = 603 +TDMT_VND_DISABLE_WRITE_RSP = 604 +TDMT_VND_QUERY_COMPACT_PROGRESS = 605 +TDMT_VND_QUERY_COMPACT_PROGRESS_RSP = 606 +TDMT_VND_KILL_COMPACT = 607 +TDMT_VND_KILL_COMPACT_RSP = 608 +TDMT_VND_S3MIGRATE = 609 +TDMT_VND_S3MIGRATE_RSP = 610 +TDMT_VND_ARB_HEARTBEAT = 611 +TDMT_VND_ARB_HEARTBEAT_RSP = 612 +TDMT_VND_ARB_CHECK_SYNC = 613 +TDMT_VND_ARB_CHECK_SYNC_RSP = 614 +TDMT_VND_FETCH_TTL_EXPIRED_TBS = 615 +TDMT_VND_FETCH_TTL_EXPIRED_TBS_RSP = 616 +TDMT_VND_MAX_MSG = 617 +TDMT_VND_MAX_MSG_RSP = 618 +TDMT_SCH_QUERY = 769 +TDMT_SCH_QUERY_RSP = 770 +TDMT_SCH_MERGE_QUERY = 771 +TDMT_SCH_MERGE_QUERY_RSP = 772 +TDMT_SCH_QUERY_CONTINUE = 773 +TDMT_SCH_QUERY_CONTINUE_RSP = 774 +TDMT_SCH_QUERY_HEARTBEAT = 775 +TDMT_SCH_QUERY_HEARTBEAT_RSP = 776 +TDMT_SCH_FETCH = 777 +TDMT_SCH_FETCH_RSP = 778 +TDMT_SCH_MERGE_FETCH = 779 +TDMT_SCH_MERGE_FETCH_RSP = 780 +TDMT_SCH_CANCEL_TASK = 781 +TDMT_SCH_CANCEL_TASK_RSP = 782 +TDMT_SCH_DROP_TASK = 783 +TDMT_SCH_DROP_TASK_RSP = 784 +TDMT_SCH_EXPLAIN = 785 +TDMT_SCH_EXPLAIN_RSP = 786 +TDMT_SCH_LINK_BROKEN = 787 +TDMT_SCH_LINK_BROKEN_RSP = 788 +TDMT_SCH_TASK_NOTIFY = 789 +TDMT_SCH_TASK_NOTIFY_RSP = 790 +TDMT_SCH_MAX_MSG = 791 +TDMT_SCH_MAX_MSG_RSP = 792 +TDMT_STREAM_TASK_DEPLOY = 1025 +TDMT_STREAM_TASK_DEPLOY_RSP = 1026 +TDMT_STREAM_TASK_DROP = 1027 +TDMT_STREAM_TASK_DROP_RSP = 1028 +TDMT_STREAM_TASK_RUN = 1029 +TDMT_STREAM_TASK_RUN_RSP = 1030 +TDMT_STREAM_TASK_DISPATCH = 1031 +TDMT_STREAM_TASK_DISPATCH_RSP = 1032 +TDMT_STREAM_TASK_UPDATE_CHKPT = 1033 +TDMT_STREAM_TASK_UPDATE_CHKPT_RSP = 1034 +TDMT_STREAM_RETRIEVE = 1035 +TDMT_STREAM_RETRIEVE_RSP = 1036 +TDMT_STREAM_TASK_CHECKPOINT_READY = 1037 +TDMT_STREAM_TASK_CHECKPOINT_READY_RSP = 1038 +TDMT_STREAM_TASK_REPORT_CHECKPOINT = 1039 +TDMT_STREAM_TASK_REPORT_CHECKPOINT_RSP = 1040 +TDMT_STREAM_TASK_RESTORE_CHECKPOINT = 1041 +TDMT_STREAM_TASK_RESTORE_CHECKPOINT_RSP = 1042 +TDMT_STREAM_TASK_PAUSE = 1043 +TDMT_STREAM_TASK_PAUSE_RSP = 1044 +TDMT_STREAM_TASK_RESUME = 1045 +TDMT_STREAM_TASK_RESUME_RSP = 1046 +TDMT_STREAM_TASK_STOP = 1047 +TDMT_STREAM_TASK_STOP_RSP = 1048 +TDMT_STREAM_UNUSED = 1049 +TDMT_STREAM_UNUSED_RSP = 1050 +TDMT_STREAM_CREATE = 1051 +TDMT_STREAM_CREATE_RSP = 1052 +TDMT_STREAM_DROP = 1053 +TDMT_STREAM_DROP_RSP = 1054 +TDMT_STREAM_RETRIEVE_TRIGGER = 1055 +TDMT_STREAM_RETRIEVE_TRIGGER_RSP = 1056 +TDMT_STREAM_MAX_MSG = 1057 +TDMT_STREAM_MAX_MSG_RSP = 1058 +TDMT_MON_MAX_MSG = 1281 +TDMT_MON_MAX_MSG_RSP = 1282 +TDMT_SYNC_TIMEOUT = 1537 +TDMT_SYNC_TIMEOUT_RSP = 1538 +TDMT_SYNC_TIMEOUT_ELECTION = 1539 +TDMT_SYNC_TIMEOUT_ELECTION_RSP = 1540 +TDMT_SYNC_PING_REPLY = 1541 +TDMT_SYNC_PING_REPLY_RSP = 1542 +TDMT_SYNC_CLIENT_REQUEST = 1543 +TDMT_SYNC_CLIENT_REQUEST_RSP = 1544 +TDMT_SYNC_CLIENT_REQUEST_BATCH = 1545 +TDMT_SYNC_CLIENT_REQUEST_BATCH_RSP = 1546 +TDMT_SYNC_CLIENT_REQUEST_REPLY = 1547 +TDMT_SYNC_CLIENT_REQUEST_REPLY_RSP = 1548 +TDMT_SYNC_REQUEST_VOTE = 1549 +TDMT_SYNC_REQUEST_VOTE_RSP = 1550 +TDMT_SYNC_REQUEST_VOTE_REPLY = 1551 +TDMT_SYNC_REQUEST_VOTE_REPLY_RSP = 1552 +TDMT_SYNC_APPEND_ENTRIES = 1553 +TDMT_SYNC_APPEND_ENTRIES_RSP = 1554 +TDMT_SYNC_APPEND_ENTRIES_BATCH = 1555 +TDMT_SYNC_APPEND_ENTRIES_BATCH_RSP = 1556 +TDMT_SYNC_APPEND_ENTRIES_REPLY = 1557 +TDMT_SYNC_APPEND_ENTRIES_REPLY_RSP = 1558 +TDMT_SYNC_NOOP = 1559 +TDMT_SYNC_NOOP_RSP = 1560 +TDMT_SYNC_UNKNOWN = 1561 +TDMT_SYNC_UNKNOWN_RSP = 1562 +TDMT_SYNC_COMMON_RESPONSE = 1563 +TDMT_SYNC_COMMON_RESPONSE_RSP = 1564 +TDMT_SYNC_APPLY_MSG = 1565 +TDMT_SYNC_APPLY_MSG_RSP = 1566 +TDMT_SYNC_CONFIG_CHANGE = 1567 +TDMT_SYNC_CONFIG_CHANGE_RSP = 1568 +TDMT_SYNC_CONFIG_CHANGE_FINISH = 1569 +TDMT_SYNC_CONFIG_CHANGE_FINISH_RSP = 1570 +TDMT_SYNC_SNAPSHOT_SEND = 1571 +TDMT_SYNC_SNAPSHOT_SEND_RSP = 1572 +TDMT_SYNC_SNAPSHOT_RSP = 1573 +TDMT_SYNC_SNAPSHOT_RSP_RSP = 1574 +TDMT_SYNC_LEADER_TRANSFER = 1575 +TDMT_SYNC_LEADER_TRANSFER_RSP = 1576 +TDMT_SYNC_SET_MNODE_STANDBY = 1577 +TDMT_SYNC_SET_MNODE_STANDBY_RSP = 1578 +TDMT_SYNC_SET_VNODE_STANDBY = 1579 +TDMT_SYNC_SET_VNODE_STANDBY_RSP = 1580 +TDMT_SYNC_HEARTBEAT = 1581 +TDMT_SYNC_HEARTBEAT_RSP = 1582 +TDMT_SYNC_HEARTBEAT_REPLY = 1583 +TDMT_SYNC_HEARTBEAT_REPLY_RSP = 1584 +TDMT_SYNC_LOCAL_CMD = 1585 +TDMT_SYNC_LOCAL_CMD_RSP = 1586 +TDMT_SYNC_PREP_SNAPSHOT = 1587 +TDMT_SYNC_PREP_SNAPSHOT_RSP = 1588 +TDMT_SYNC_PREP_SNAPSHOT_REPLY = 1589 +TDMT_SYNC_PREP_SNAPSHOT_REPLY_RSP = 1590 +TDMT_SYNC_UNUSED_CODE = 1591 +TDMT_SYNC_UNUSED_CODE_RSP = 1592 +TDMT_SYNC_FORCE_FOLLOWER = 1593 +TDMT_SYNC_FORCE_FOLLOWER_RSP = 1594 +TDMT_SYNC_SET_ASSIGNED_LEADER = 1595 +TDMT_SYNC_SET_ASSIGNED_LEADER_RSP = 1596 +TDMT_SYNC_MAX_MSG = 1597 +TDMT_SYNC_MAX_MSG_RSP = 1598 +TDMT_VND_STREAM_SCAN_HISTORY = 1793 +TDMT_VND_STREAM_SCAN_HISTORY_RSP = 1794 +TDMT_VND_STREAM_CHECK_POINT_SOURCE = 1795 +TDMT_VND_STREAM_CHECK_POINT_SOURCE_RSP = 1796 +TDMT_VND_STREAM_TASK_UPDATE = 1797 +TDMT_VND_STREAM_TASK_UPDATE_RSP = 1798 +TDMT_VND_STREAM_TASK_RESET = 1799 +TDMT_VND_STREAM_TASK_RESET_RSP = 1800 +TDMT_VND_STREAM_TASK_CHECK = 1801 +TDMT_VND_STREAM_TASK_CHECK_RSP = 1802 +TDMT_VND_STREAM_UNUSED = 1803 +TDMT_VND_STREAM_UNUSED_RSP = 1804 +TDMT_VND_GET_STREAM_PROGRESS = 1805 +TDMT_VND_GET_STREAM_PROGRESS_RSP = 1806 +TDMT_VND_STREAM_MAX_MSG = 1807 +TDMT_VND_STREAM_MAX_MSG_RSP = 1808 +TDMT_VND_TMQ_SUBSCRIBE = 2049 +TDMT_VND_TMQ_SUBSCRIBE_RSP = 2050 +TDMT_VND_TMQ_DELETE_SUB = 2051 +TDMT_VND_TMQ_DELETE_SUB_RSP = 2052 +TDMT_VND_TMQ_COMMIT_OFFSET = 2053 +TDMT_VND_TMQ_COMMIT_OFFSET_RSP = 2054 +TDMT_VND_TMQ_SEEK = 2055 +TDMT_VND_TMQ_SEEK_RSP = 2056 +TDMT_VND_TMQ_ADD_CHECKINFO = 2057 +TDMT_VND_TMQ_ADD_CHECKINFO_RSP = 2058 +TDMT_VND_TMQ_DEL_CHECKINFO = 2059 +TDMT_VND_TMQ_DEL_CHECKINFO_RSP = 2060 +TDMT_VND_TMQ_CONSUME = 2061 +TDMT_VND_TMQ_CONSUME_RSP = 2062 +TDMT_VND_TMQ_CONSUME_PUSH = 2063 +TDMT_VND_TMQ_CONSUME_PUSH_RSP = 2064 +TDMT_VND_TMQ_VG_WALINFO = 2065 +TDMT_VND_TMQ_VG_WALINFO_RSP = 2066 +TDMT_VND_TMQ_VG_COMMITTEDINFO = 2067 +TDMT_VND_TMQ_VG_COMMITTEDINFO_RSP = 2068 +TDMT_VND_TMQ_MAX_MSG = 2069 +TDMT_VND_TMQ_MAX_MSG_RSP = 2070 +TDMT_MND_ARB_HEARTBEAT_TIMER = 2305 +TDMT_MND_ARB_HEARTBEAT_TIMER_RSP = 2306 +TDMT_MND_ARB_CHECK_SYNC_TIMER = 2307 +TDMT_MND_ARB_CHECK_SYNC_TIMER_RSP = 2308 +TDMT_MND_ARB_UPDATE_GROUP = 2309 +TDMT_MND_ARB_UPDATE_GROUP_RSP = 2310 +TDMT_MND_ARB_UPDATE_GROUP_BATCH = 2311 +TDMT_MND_ARB_UPDATE_GROUP_BATCH_RSP = 2312 +TDMT_MND_ARB_MAX_MSG = 2313 +TDMT_MND_ARB_MAX_MSG_RSP = 2314 diff --git a/source/common/test/tmsgTest.cpp b/source/common/test/tmsgTest.cpp index 910e133c64..34b0026b17 100644 --- a/source/common/test/tmsgTest.cpp +++ b/source/common/test/tmsgTest.cpp @@ -1,5 +1,14 @@ #include - +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include "tmsg.h" @@ -12,15 +21,260 @@ #undef TD_MSG_SEG_CODE_ #include "tmsgdef.h" -TEST(td_msg_test, simple_msg_test) { - // std::cout << TMSG_INFO(TDMT_VND_DROP_TABLE) << std::endl; - // std::cout << TMSG_INFO(TDMT_MND_DROP_SUPER_TABLE) << std::endl; - // std::cout << TMSG_INFO(TDMT_MND_CREATE_SUPER_TABLE) << std::endl; +#undef getline +#undef close - int32_t msgSize = sizeof(tMsgTypeInfo) / sizeof(SMsgTypeInfo); - for (int32_t i = 0; i < msgSize; ++i) { - SMsgTypeInfo *pInfo = &tMsgTypeInfo[i]; - std::cout << i * 2 + 1 << " " << pInfo->name << " " << pInfo->type << std::endl; - std::cout << i * 2 + 2 << " " << pInfo->rspName << " " << pInfo->rspType << std::endl; +using namespace std; + +enum class ParseStatus { + Success, + FileNotExist, + FileNotOpen, + ResponseWithoutRequest, + RequestWithoutResponse +}; + +typedef struct { + string name; + string rspName; + int32_t type; + int32_t rspType; +} STestMsgTypeInfo; + +string getExecutableDirectory() { + char result[PATH_MAX]; + ssize_t count = readlink("/proc/self/exe", result, PATH_MAX); + if (count != -1) { + result[count] = '\0'; + string path(result); + size_t pos = path.rfind('/'); + if (pos != string::npos) { + path.erase(pos + 1); + } + return path; + } else { + throw std::runtime_error("Failed to get the executable's directory"); } +} + + +// parses key-value pairs from strings +pair parseKeyValuePair(const string &line, char delim = '=') { + size_t pos = line.find(delim); + if (pos == string::npos) + return make_pair("", 0); + + string key = line.substr(0, pos); + + // remove leading spaces + size_t firstNotSpace = key.find_first_not_of(" "); + if (firstNotSpace != string::npos) { + key = key.substr(firstNotSpace); + } else { + key.clear(); + } + + // remove ending spaces + size_t lastNotSpace = key.find_last_not_of(" "); + if (lastNotSpace != string::npos) { + key = key.substr(0, lastNotSpace + 1); + } + + if (key.front() == '"' && key.back() == '"') + key = key.substr(1, key.size() - 2); + + if (key.front() == '\'' && key.back() == '\'') + key = key.substr(1, key.size() - 2); + + string valStr = line.substr(pos + 1); + int32_t val = stoi(valStr); + return make_pair(key, val); +} + +// read the configuration file and parse it into the STestMsgTypeInfo array +ParseStatus readConfig(const string& filePath, vector& msgTypes) { + ifstream file(filePath); + if (!file.is_open()) { + if (file.fail() && errno == ENOENT) { + cerr << "Error: The file does not exist, file: " << filePath << endl; + return ParseStatus::FileNotExist; + } else { + cerr << "Error: Could not open the file, file: " << filePath << endl; + return ParseStatus::FileNotOpen; + } + } + + auto endsWith = [](const string& str, const string& suffix) { + if (str.length() < suffix.length()) { + return false; + } + return equal(str.end() - suffix.length(), str.end(), suffix.begin()); + }; + + + bool evenLine = true; + string line; + string suffix("_RSP"); + pair reqKwInfo; + while (std::getline(file, line)) { + char delim = '#'; + if (line.find('=') != string::npos) { + delim = '='; + } else if (line.find(':') != string::npos) { + delim = ':'; + } else if (line.find('{') != string::npos || line.find('}') != string::npos) { + // TODO: parse json format + continue; + } else { + continue; + } + + auto curKwInfo = parseKeyValuePair(line, delim); + evenLine = ! evenLine; + + // check message type + if (evenLine == false) { // req msg + reqKwInfo = curKwInfo; + } else { // rsp msg + if (reqKwInfo.first.empty()) { + cerr << "Error: Found a response message without a matching request, rsp: " << curKwInfo.first << endl; + return ParseStatus::ResponseWithoutRequest; + } else if (!endsWith(curKwInfo.first, suffix)) { + cerr << "Error: A request message was not followed by a matching response, req: " << reqKwInfo.first << endl; + return ParseStatus::RequestWithoutResponse; + } else { + STestMsgTypeInfo msgInfo; + msgInfo.name = reqKwInfo.first; + msgInfo.rspName = curKwInfo.first; + msgInfo.type = reqKwInfo.second; + msgInfo.rspType = curKwInfo.second; + msgTypes.push_back(msgInfo); + + // reset req info + reqKwInfo = make_pair("", -1); + } + } + } + + if (!reqKwInfo.first.empty()) { + cerr << "Error: A request message was not followed by a matching response, req: " << reqKwInfo.first << endl; + return ParseStatus::RequestWithoutResponse; + } + + return ParseStatus::Success; +} + + +TEST(td_msg_test, msg_type_compatibility_test) { + // cout << TMSG_INFO(TDMT_VND_DROP_TABLE) << endl; + // cout << TMSG_INFO(TDMT_MND_DROP_SUPER_TABLE) << endl; + // cout << TMSG_INFO(TDMT_MND_CREATE_SUPER_TABLE) << endl; + + // int32_t msgSize = sizeof(tMsgTypeInfo) / sizeof(SMsgTypeInfo); + // for (int32_t i = 0; i < msgSize; ++i) { + // SMsgTypeInfo *pInfo = &tMsgTypeInfo[i]; + // cout << i * 2 + 1 << " " << pInfo->name << " " << pInfo->type << endl; + // cout << i * 2 + 2 << " " << pInfo->rspName << " " << pInfo->rspType << endl; + // } + + + // current msgs: to map + unordered_map map; + for (const auto& info : tMsgTypeInfo) { + map[info.name] = &info; + } + + string configFileName = "msgTypeTable.ini"; + string execDir = getExecutableDirectory(); + string configFilePath(execDir + configFileName); + + vector msgTypes; + ParseStatus status = readConfig(configFilePath, msgTypes); + + switch (status) { + case ParseStatus::Success: + for (const auto& stdInfo : msgTypes) { + auto it = map.find(stdInfo.name); + if (it == map.end()) { + FAIL() << "Error: Could not find msg: " << stdInfo.name << "."; + } else { + auto newInfo = it->second; + + ASSERT_STREQ(stdInfo.name.c_str(), newInfo->name); + ASSERT_STREQ(stdInfo.rspName.c_str(), newInfo->rspName); + ASSERT_EQ(stdInfo.type, newInfo->type) + << "Message type mismatch(" << stdInfo.name << "): expected " << stdInfo.type << ", got " << newInfo->type << "."; + ASSERT_EQ(stdInfo.rspType, newInfo->rspType) + << "Message response type mismatch(" << stdInfo.rspName << "): expected " << stdInfo.rspType << ", got " << newInfo->rspType << "."; + } + } + break; + case ParseStatus::FileNotExist: + FAIL() << "Error: The file does not exist, file: " << configFileName << "."; + break; + case ParseStatus::FileNotOpen: + FAIL() << "Error: Could not open the file, file: " << configFileName << "."; + break; + case ParseStatus::ResponseWithoutRequest: + FAIL() << "Error: Found a response message without a matching request."; + break; + case ParseStatus::RequestWithoutResponse: + FAIL() << "Error: A request message was not followed by a matching response."; + break; + default: + FAIL() << "Unknown Error."; + break; + } +} + + +size_t maxLengthOfMsgType() { + size_t maxLen = 0; + for (const auto& info : tMsgTypeInfo) { + maxLen = std::max(maxLen, strlen(info.name)); + maxLen = std::max(maxLen, strlen(info.rspName)); + } + return (maxLen / 4 + 1) * 4; +} + + +void generateConfigFile(const string& filePath) { + size_t maxStringLength = maxLengthOfMsgType(); + std::ofstream file(filePath); + if (!file.is_open()) { + cerr << "Failed to open file for writing, at: " << filePath << "." << endl; + return; + } + + for (const auto& info : tMsgTypeInfo) { + file << std::left << std::setw(maxStringLength) << info.name << "= " << info.type << endl; + file << std::left << std::setw(maxStringLength) << info.rspName << "= " << info.rspType << endl; + } + + if (file.fail()) { + cerr << "An error occurred while writing to the file." << endl; + } else { + cout << "Data successfully written to file: " << filePath << endl; + } + + file.close(); +} + + +void processCommandArgs(int argc, char** argv) { + for (int i = 1; i < argc; ++i) { + if (string(argv[i]) == "--output-config") { + string configFile = (i + 1 < argc) ? argv[++i] : "./msgTypeTable.ini"; + generateConfigFile(configFile); + exit(0); + } + } +} + + +int main(int argc, char **argv) { + processCommandArgs(argc, argv); + + testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); } \ No newline at end of file diff --git a/source/dnode/mgmt/exe/dmMain.c b/source/dnode/mgmt/exe/dmMain.c index 786df6b907..65f695cb8b 100644 --- a/source/dnode/mgmt/exe/dmMain.c +++ b/source/dnode/mgmt/exe/dmMain.c @@ -261,7 +261,7 @@ static void dmPrintVersion() { printf("%s\ntaosd version: %s compatible_version: %s\n", TD_PRODUCT_NAME, version, compatible_version); printf("git: %s\n", gitinfo); #ifdef TD_ENTERPRISE - printf("git: %s\n", gitinfoOfInternal); + printf("gitOfInternal: %s\n", gitinfoOfInternal); #endif printf("build: %s\n", buildinfo); } diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c b/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c index 7bc41559c3..6053c4db80 100644 --- a/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c +++ b/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c @@ -144,7 +144,7 @@ static void vmGenerateVnodeCfg(SCreateVnodeReq *pCreate, SVnodeCfg *pCfg) { } #if defined(TD_ENTERPRISE) pCfg->tsdbCfg.encryptAlgorithm = pCreate->encryptAlgorithm; - if(pCfg->tsdbCfg.encryptAlgorithm == DND_CA_SM4){ + if (pCfg->tsdbCfg.encryptAlgorithm == DND_CA_SM4) { strncpy(pCfg->tsdbCfg.encryptKey, tsEncryptKey, ENCRYPT_KEY_LEN); } #else @@ -160,7 +160,7 @@ static void vmGenerateVnodeCfg(SCreateVnodeReq *pCreate, SVnodeCfg *pCfg) { pCfg->walCfg.level = pCreate->walLevel; #if defined(TD_ENTERPRISE) pCfg->walCfg.encryptAlgorithm = pCreate->encryptAlgorithm; - if(pCfg->walCfg.encryptAlgorithm == DND_CA_SM4){ + if (pCfg->walCfg.encryptAlgorithm == DND_CA_SM4) { strncpy(pCfg->walCfg.encryptKey, tsEncryptKey, ENCRYPT_KEY_LEN); } #else @@ -169,7 +169,7 @@ static void vmGenerateVnodeCfg(SCreateVnodeReq *pCreate, SVnodeCfg *pCfg) { #if defined(TD_ENTERPRISE) pCfg->tdbEncryptAlgorithm = pCreate->encryptAlgorithm; - if(pCfg->tdbEncryptAlgorithm == DND_CA_SM4){ + if (pCfg->tdbEncryptAlgorithm == DND_CA_SM4) { strncpy(pCfg->tdbEncryptKey, tsEncryptKey, ENCRYPT_KEY_LEN); } #else @@ -278,7 +278,7 @@ int32_t vmProcessCreateVnodeReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) { req.keepTimeOffset, req.s3ChunkSize, req.s3KeepLocal, req.s3Compact, req.isTsma, req.precision, req.compression, req.minRows, req.maxRows, req.walFsyncPeriod, req.walLevel, req.walRetentionPeriod, req.walRetentionSize, req.walRollPeriod, req.walSegmentSize, req.hashMethod, req.hashBegin, req.hashEnd, req.hashPrefix, req.hashSuffix, - req.replica, req.selfIndex, req.learnerReplica, req.learnerSelfIndex, req.strict, req.changeVersion, + req.replica, req.selfIndex, req.learnerReplica, req.learnerSelfIndex, req.strict, req.changeVersion, req.encryptAlgorithm); for (int32_t i = 0; i < req.replica; ++i) { @@ -304,8 +304,8 @@ int32_t vmProcessCreateVnodeReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) { return -1; } - if(req.encryptAlgorithm == DND_CA_SM4){ - if(strlen(tsEncryptKey) == 0){ + if (req.encryptAlgorithm == DND_CA_SM4) { + if (strlen(tsEncryptKey) == 0) { terrno = TSDB_CODE_DNODE_INVALID_ENCRYPTKEY; dError("vgId:%d, failed to create vnode since encrypt key is empty", req.vgId); return -1; @@ -482,7 +482,9 @@ int32_t vmProcessAlterVnodeTypeReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) { .diskPrimary = pVnode->diskPrimary, }; tstrncpy(wrapperCfg.path, pVnode->path, sizeof(wrapperCfg.path)); - vmCloseVnode(pMgmt, pVnode, false); + + bool commitAndRemoveWal = vnodeShouldRemoveWal(pVnode->pImpl); + vmCloseVnode(pMgmt, pVnode, commitAndRemoveWal); int32_t diskPrimary = wrapperCfg.diskPrimary; char path[TSDB_FILENAME_LEN] = {0}; @@ -737,7 +739,9 @@ int32_t vmProcessAlterVnodeReplicaReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) { .diskPrimary = pVnode->diskPrimary, }; tstrncpy(wrapperCfg.path, pVnode->path, sizeof(wrapperCfg.path)); - vmCloseVnode(pMgmt, pVnode, false); + + bool commitAndRemoveWal = vnodeShouldRemoveWal(pVnode->pImpl); + vmCloseVnode(pMgmt, pVnode, commitAndRemoveWal); int32_t diskPrimary = wrapperCfg.diskPrimary; char path[TSDB_FILENAME_LEN] = {0}; diff --git a/source/dnode/mnode/impl/src/mndDb.c b/source/dnode/mnode/impl/src/mndDb.c index d12f73cee6..78e3ceabce 100644 --- a/source/dnode/mnode/impl/src/mndDb.c +++ b/source/dnode/mnode/impl/src/mndDb.c @@ -495,6 +495,16 @@ static int32_t mndCheckInChangeDbCfg(SMnode *pMnode, SDbCfg *pOldCfg, SDbCfg *pN #else if (pNewCfg->replications != 1 && pNewCfg->replications != 3) return -1; #endif + + if (pNewCfg->walLevel == 0 && pOldCfg->replications > 1) { + terrno = TSDB_CODE_MND_INVALID_WAL_LEVEL; + return -1; + } + if (pNewCfg->replications > 1 && pOldCfg->walLevel == 0) { + terrno = TSDB_CODE_MND_INVALID_WAL_LEVEL; + return -1; + } + if (pNewCfg->sstTrigger < TSDB_MIN_STT_TRIGGER || pNewCfg->sstTrigger > TSDB_MAX_STT_TRIGGER) return -1; if (pNewCfg->minRows < TSDB_MIN_MINROWS_FBLOCK || pNewCfg->minRows > TSDB_MAX_MINROWS_FBLOCK) return -1; if (pNewCfg->maxRows < TSDB_MIN_MAXROWS_FBLOCK || pNewCfg->maxRows > TSDB_MAX_MAXROWS_FBLOCK) return -1; diff --git a/source/dnode/vnode/inc/vnode.h b/source/dnode/vnode/inc/vnode.h index 21d967ad93..fccba91db7 100644 --- a/source/dnode/vnode/inc/vnode.h +++ b/source/dnode/vnode/inc/vnode.h @@ -52,6 +52,7 @@ extern const SVnodeCfg vnodeCfgDefault; int32_t vnodeInit(int32_t nthreads); void vnodeCleanup(); int32_t vnodeCreate(const char *path, SVnodeCfg *pCfg, int32_t diskPrimary, STfs *pTfs); +bool vnodeShouldRemoveWal(SVnode *pVnode); int32_t vnodeAlterReplica(const char *path, SAlterVnodeReplicaReq *pReq, int32_t diskPrimary, STfs *pTfs); int32_t vnodeAlterHashRange(const char *srcPath, const char *dstPath, SAlterVnodeHashRangeReq *pReq, int32_t diskPrimary, STfs *pTfs); @@ -181,7 +182,7 @@ void tsdbReaderSetNotifyCb(STsdbReader *pReader, TsdReaderNotifyCbFn not int32_t tsdbReuseCacherowsReader(void *pReader, void *pTableIdList, int32_t numOfTables); int32_t tsdbCacherowsReaderOpen(void *pVnode, int32_t type, void *pTableIdList, int32_t numOfTables, int32_t numOfCols, SArray *pCidList, int32_t *pSlotIds, uint64_t suid, void **pReader, const char *idstr, - SArray *pFuncTypeList, SColumnInfo* pkCol, int32_t numOfPks); + SArray *pFuncTypeList, SColumnInfo *pkCol, int32_t numOfPks); int32_t tsdbRetrieveCacheRows(void *pReader, SSDataBlock *pResBlock, const int32_t *slotIds, const int32_t *dstSlotIds, SArray *pTableUids); void *tsdbCacherowsReaderClose(void *pReader); @@ -218,8 +219,8 @@ typedef struct STqReader { STqReader *tqReaderOpen(SVnode *pVnode); void tqReaderClose(STqReader *); -bool tqGetTablePrimaryKey(STqReader* pReader); -void tqSetTablePrimaryKey(STqReader* pReader, int64_t uid); +bool tqGetTablePrimaryKey(STqReader *pReader); +void tqSetTablePrimaryKey(STqReader *pReader, int64_t uid); void tqReaderSetColIdList(STqReader *pReader, SArray *pColIdList); int32_t tqReaderSetTbUidList(STqReader *pReader, const SArray *tbUidList, const char *id); @@ -278,8 +279,8 @@ struct STsdbCfg { int32_t keep2; // just for save config, don't use in tsdbRead/tsdbCommit/..., and use STsdbKeepCfg in STsdb instead int32_t keepTimeOffset; // just for save config, use STsdbKeepCfg in STsdb instead SRetention retentions[TSDB_RETENTION_MAX]; - int32_t encryptAlgorithm; - char encryptKey[ENCRYPT_KEY_LEN + 1]; + int32_t encryptAlgorithm; + char encryptKey[ENCRYPT_KEY_LEN + 1]; }; typedef struct { diff --git a/source/dnode/vnode/src/sma/smaRollup.c b/source/dnode/vnode/src/sma/smaRollup.c index ac5463e492..81bb519b27 100644 --- a/source/dnode/vnode/src/sma/smaRollup.c +++ b/source/dnode/vnode/src/sma/smaRollup.c @@ -299,7 +299,7 @@ static int32_t tdSetRSmaInfoItemParams(SSma *pSma, SRSmaParam *param, SRSmaStat tdRSmaTaskInit(pStreamTask->pMeta, pItem, &pStreamTask->id); pStreamTask->status.pSM = streamCreateStateMachine(pStreamTask); pStreamTask->chkInfo.pActiveInfo = streamTaskCreateActiveChkptInfo(); - pStreamState = streamStateOpen(taskInfDir, pStreamTask, pStreamTask->id.streamId, pStreamTask->id.taskId, true, -1, -1); + pStreamState = streamStateOpen(taskInfDir, pStreamTask, pStreamTask->id.streamId, pStreamTask->id.taskId); if (!pStreamState) { terrno = TSDB_CODE_RSMA_STREAM_STATE_OPEN; return TSDB_CODE_FAILED; diff --git a/source/dnode/vnode/src/tqCommon/tqCommon.c b/source/dnode/vnode/src/tqCommon/tqCommon.c index 963503c135..50a52e58c5 100644 --- a/source/dnode/vnode/src/tqCommon/tqCommon.c +++ b/source/dnode/vnode/src/tqCommon/tqCommon.c @@ -49,7 +49,7 @@ int32_t tqExpandStreamTask(SStreamTask* pTask) { // sink task does not need the pState if (pTask->info.taskLevel != TASK_LEVEL__SINK) { - pTask->pState = streamStateOpen(pMeta->path, pTask, false, streamId, taskId, -1, -1); + pTask->pState = streamStateOpen(pMeta->path, pTask, streamId, taskId); if (pTask->pState == NULL) { tqError("s-task:%s (vgId:%d) failed to open state for task, expand task failed", pTask->id.idStr, vgId); return -1; diff --git a/source/dnode/vnode/src/vnd/vnodeCfg.c b/source/dnode/vnode/src/vnd/vnodeCfg.c index cd6863fd89..c7b54d36b6 100644 --- a/source/dnode/vnode/src/vnd/vnodeCfg.c +++ b/source/dnode/vnode/src/vnd/vnodeCfg.c @@ -13,9 +13,9 @@ * along with this program. If not, see . */ +#include "tglobal.h" #include "tutil.h" #include "vnd.h" -#include "tglobal.h" const SVnodeCfg vnodeCfgDefault = {.vgId = -1, .dbname = "", @@ -47,6 +47,7 @@ const SVnodeCfg vnodeCfgDefault = {.vgId = -1, .segSize = 0, .retentionSize = -1, .level = TAOS_WAL_WRITE, + .clearFiles = 0, }, .hashBegin = 0, .hashEnd = 0, @@ -142,6 +143,7 @@ int vnodeEncodeConfig(const void *pObj, SJson *pJson) { if (tjsonAddIntegerToObject(pJson, "wal.retentionSize", pCfg->walCfg.retentionSize) < 0) return -1; if (tjsonAddIntegerToObject(pJson, "wal.segSize", pCfg->walCfg.segSize) < 0) return -1; if (tjsonAddIntegerToObject(pJson, "wal.level", pCfg->walCfg.level) < 0) return -1; + if (tjsonAddIntegerToObject(pJson, "wal.clearFiles", pCfg->walCfg.clearFiles) < 0) return -1; if (tjsonAddIntegerToObject(pJson, "wal.encryptAlgorithm", pCfg->walCfg.encryptAlgorithm) < 0) return -1; if (tjsonAddIntegerToObject(pJson, "tdbEncryptAlgorithm", pCfg->tdbEncryptAlgorithm) < 0) return -1; if (tjsonAddIntegerToObject(pJson, "sstTrigger", pCfg->sttTrigger) < 0) return -1; @@ -249,12 +251,11 @@ int vnodeDecodeConfig(const SJson *pJson, void *pObj) { tjsonGetNumberValue(pJson, "tsdb.encryptAlgorithm", pCfg->tsdbCfg.encryptAlgorithm, code); if (code < 0) return -1; #if defined(TD_ENTERPRISE) - if(pCfg->tsdbCfg.encryptAlgorithm == DND_CA_SM4){ - if(tsEncryptKey[0] == 0){ + if (pCfg->tsdbCfg.encryptAlgorithm == DND_CA_SM4) { + if (tsEncryptKey[0] == 0) { terrno = TSDB_CODE_DNODE_INVALID_ENCRYPTKEY; return -1; - } - else{ + } else { strncpy(pCfg->tsdbCfg.encryptKey, tsEncryptKey, ENCRYPT_KEY_LEN); } } @@ -273,15 +274,16 @@ int vnodeDecodeConfig(const SJson *pJson, void *pObj) { if (code < 0) return -1; tjsonGetNumberValue(pJson, "wal.level", pCfg->walCfg.level, code); if (code < 0) return -1; + tjsonGetNumberValue(pJson, "wal.clearFiles", pCfg->walCfg.clearFiles, code); + if (code < 0) return -1; tjsonGetNumberValue(pJson, "wal.encryptAlgorithm", pCfg->walCfg.encryptAlgorithm, code); if (code < 0) return -1; #if defined(TD_ENTERPRISE) - if(pCfg->walCfg.encryptAlgorithm == DND_CA_SM4){ - if(tsEncryptKey[0] == 0){ + if (pCfg->walCfg.encryptAlgorithm == DND_CA_SM4) { + if (tsEncryptKey[0] == 0) { terrno = TSDB_CODE_DNODE_INVALID_ENCRYPTKEY; return -1; - } - else{ + } else { strncpy(pCfg->walCfg.encryptKey, tsEncryptKey, ENCRYPT_KEY_LEN); } } @@ -289,12 +291,11 @@ int vnodeDecodeConfig(const SJson *pJson, void *pObj) { tjsonGetNumberValue(pJson, "tdbEncryptAlgorithm", pCfg->tdbEncryptAlgorithm, code); if (code < 0) return -1; #if defined(TD_ENTERPRISE) - if(pCfg->tdbEncryptAlgorithm == DND_CA_SM4){ - if(tsEncryptKey[0] == 0){ + if (pCfg->tdbEncryptAlgorithm == DND_CA_SM4) { + if (tsEncryptKey[0] == 0) { terrno = TSDB_CODE_DNODE_INVALID_ENCRYPTKEY; return -1; - } - else{ + } else { strncpy(pCfg->tdbEncryptKey, tsEncryptKey, ENCRYPT_KEY_LEN); } } diff --git a/source/dnode/vnode/src/vnd/vnodeOpen.c b/source/dnode/vnode/src/vnd/vnodeOpen.c index da8c3a6cad..ea9209c6b4 100644 --- a/source/dnode/vnode/src/vnd/vnodeOpen.c +++ b/source/dnode/vnode/src/vnd/vnodeOpen.c @@ -81,6 +81,8 @@ int32_t vnodeCreate(const char *path, SVnodeCfg *pCfg, int32_t diskPrimary, STfs return 0; } +bool vnodeShouldRemoveWal(SVnode *pVnode) { return pVnode->config.walCfg.clearFiles == 1; } + int32_t vnodeAlterReplica(const char *path, SAlterVnodeReplicaReq *pReq, int32_t diskPrimary, STfs *pTfs) { SVnodeInfo info = {0}; char dir[TSDB_FILENAME_LEN] = {0}; @@ -129,6 +131,12 @@ int32_t vnodeAlterReplica(const char *path, SAlterVnodeReplicaReq *pReq, int32_t } pCfg->changeVersion = pReq->changeVersion; + if (info.config.walCfg.clearFiles) { + info.config.walCfg.clearFiles = 0; + + vInfo("vgId:%d, reset wal clearFiles", pReq->vgId); + } + vInfo("vgId:%d, save config while alter, replicas:%d totalReplicas:%d selfIndex:%d changeVersion:%d", pReq->vgId, pCfg->replicaNum, pCfg->totalReplicaNum, pCfg->myIndex, pCfg->changeVersion); @@ -486,15 +494,14 @@ SVnode *vnodeOpen(const char *path, int32_t diskPrimary, STfs *pTfs, SMsgCb msgC if (tsEnableMonitor && pVnode->monitor.insertCounter == NULL) { taos_counter_t *counter = NULL; - int32_t label_count = 7; - const char *sample_labels[] = {VNODE_METRIC_TAG_NAME_SQL_TYPE, VNODE_METRIC_TAG_NAME_CLUSTER_ID, - VNODE_METRIC_TAG_NAME_DNODE_ID, VNODE_METRIC_TAG_NAME_DNODE_EP, - VNODE_METRIC_TAG_NAME_VGROUP_ID, VNODE_METRIC_TAG_NAME_USERNAME, - VNODE_METRIC_TAG_NAME_RESULT}; - counter = taos_counter_new(VNODE_METRIC_SQL_COUNT, "counter for insert sql", - label_count, sample_labels); - vInfo("vgId:%d, new metric:%p",TD_VID(pVnode), counter); - if(taos_collector_registry_register_metric(counter) == 1){ + int32_t label_count = 7; + const char *sample_labels[] = {VNODE_METRIC_TAG_NAME_SQL_TYPE, VNODE_METRIC_TAG_NAME_CLUSTER_ID, + VNODE_METRIC_TAG_NAME_DNODE_ID, VNODE_METRIC_TAG_NAME_DNODE_EP, + VNODE_METRIC_TAG_NAME_VGROUP_ID, VNODE_METRIC_TAG_NAME_USERNAME, + VNODE_METRIC_TAG_NAME_RESULT}; + counter = taos_counter_new(VNODE_METRIC_SQL_COUNT, "counter for insert sql", label_count, sample_labels); + vInfo("vgId:%d, new metric:%p", TD_VID(pVnode), counter); + if (taos_collector_registry_register_metric(counter) == 1) { taos_counter_destroy(counter); counter = taos_collector_registry_get_metric(VNODE_METRIC_SQL_COUNT); vInfo("vgId:%d, get metric from registry:%p", TD_VID(pVnode), counter); diff --git a/source/dnode/vnode/src/vnd/vnodeSvr.c b/source/dnode/vnode/src/vnd/vnodeSvr.c index b1f353af81..f9bb636be3 100644 --- a/source/dnode/vnode/src/vnd/vnodeSvr.c +++ b/source/dnode/vnode/src/vnd/vnodeSvr.c @@ -2023,6 +2023,9 @@ static int32_t vnodeProcessAlterConfigReq(SVnode *pVnode, int64_t ver, void *pRe } if (pVnode->config.walCfg.level != req.walLevel) { + if (pVnode->config.walCfg.level == 0) { + pVnode->config.walCfg.clearFiles = 1; + } pVnode->config.walCfg.level = req.walLevel; walChanged = true; } diff --git a/source/libs/command/src/command.c b/source/libs/command/src/command.c index 4cc496e4a0..40e85e90d2 100644 --- a/source/libs/command/src/command.c +++ b/source/libs/command/src/command.c @@ -239,23 +239,6 @@ static int32_t buildCreateDBResultDataBlock(SSDataBlock** pOutput) { return code; } -static int32_t buildAliveResultDataBlock(SSDataBlock** pOutput) { - SSDataBlock* pBlock = createDataBlock(); - if (NULL == pBlock) { - return TSDB_CODE_OUT_OF_MEMORY; - } - - SColumnInfoData infoData = createColumnInfoData(TSDB_DATA_TYPE_INT, sizeof(int32_t), 1); - int32_t code = blockDataAppendColInfo(pBlock, &infoData); - - if (TSDB_CODE_SUCCESS == code) { - *pOutput = pBlock; - } else { - blockDataDestroy(pBlock); - } - return code; -} - int64_t getValOfDiffPrecision(int8_t unit, int64_t val) { int64_t v = 0; switch (unit) { @@ -403,110 +386,6 @@ static void setCreateDBResultIntoDataBlock(SSDataBlock* pBlock, char* dbName, ch colDataSetVal(pCol2, 0, buf2, false); } -#define CHECK_LEADER(n) \ - (row[n] && (fields[n].type == TSDB_DATA_TYPE_VARCHAR && \ - strncasecmp(row[n], "leader", varDataLen((char*)row[n] - VARSTR_HEADER_SIZE)) == 0)) -// on this row, if have leader return true else return false -bool existLeaderRole(TAOS_ROW row, TAOS_FIELD* fields, int nFields) { - // vgroup_id | db_name | tables | v1_dnode | v1_status | v2_dnode | v2_status | v3_dnode | v3_status | v4_dnode | - // v4_status | cacheload | tsma | - if (nFields != 14) { - return false; - } - - // check have leader on cloumn v*_status on 4 6 8 10 - if (CHECK_LEADER(4) || CHECK_LEADER(6) || CHECK_LEADER(8) || CHECK_LEADER(10)) { - return true; - } - - return false; -} - -// get db alive status, return 1 is alive else return 0 -int32_t getAliveStatusFromApi(int64_t* pConnId, char* dbName, int32_t* pStatus) { - char sql[128 + TSDB_DB_NAME_LEN] = "select * from information_schema.ins_vgroups"; - int32_t code; - - // filter with db name - if (dbName && dbName[0] != 0) { - char str[64 + TSDB_DB_NAME_LEN] = ""; - // test db name exist - sprintf(str, "show create database %s ;", dbName); - TAOS_RES* dbRes = taos_query(pConnId, str); - code = taos_errno(dbRes); - if (code != TSDB_CODE_SUCCESS) { - taos_free_result(dbRes); - return code; - } - taos_free_result(dbRes); - - sprintf(str, " where db_name='%s' ;", dbName); - strcat(sql, str); - } - - TAOS_RES* res = taos_query(pConnId, sql); - code = taos_errno(res); - if (code != TSDB_CODE_SUCCESS) { - taos_free_result(res); - return code; - } - - TAOS_ROW row = NULL; - TAOS_FIELD* fields = taos_fetch_fields(res); - int32_t nFields = taos_num_fields(res); - int32_t nAvailble = 0; - int32_t nUnAvailble = 0; - - while ((row = taos_fetch_row(res)) != NULL) { - if (existLeaderRole(row, fields, nFields)) { - nAvailble++; - } else { - nUnAvailble++; - } - } - taos_free_result(res); - - int32_t status = 0; - if (nAvailble + nUnAvailble == 0 || nUnAvailble == 0) { - status = SHOW_STATUS_AVAILABLE; - } else if (nAvailble > 0 && nUnAvailble > 0) { - status = SHOW_STATUS_HALF_AVAILABLE; - } else { - status = SHOW_STATUS_NOT_AVAILABLE; - } - - if (pStatus) { - *pStatus = status; - } - return TSDB_CODE_SUCCESS; -} - -static int32_t setAliveResultIntoDataBlock(int64_t* pConnId, SSDataBlock* pBlock, char* dbName) { - blockDataEnsureCapacity(pBlock, 1); - pBlock->info.rows = 1; - - SColumnInfoData* pCol1 = taosArrayGet(pBlock->pDataBlock, 0); - int32_t status = 0; - int32_t code = getAliveStatusFromApi(pConnId, dbName, &status); - if (code == TSDB_CODE_SUCCESS) { - colDataSetVal(pCol1, 0, (const char*)&status, false); - } - return code; -} - -static int32_t execShowAliveStatus(int64_t* pConnId, SShowAliveStmt* pStmt, SRetrieveTableRsp** pRsp) { - SSDataBlock* pBlock = NULL; - int32_t code = buildAliveResultDataBlock(&pBlock); - if (TSDB_CODE_SUCCESS == code) { - code = setAliveResultIntoDataBlock(pConnId, pBlock, pStmt->dbName); - } - if (TSDB_CODE_SUCCESS == code) { - code = buildRetrieveTableRsp(pBlock, SHOW_ALIVE_RESULT_COLS, pRsp); - } - blockDataDestroy(pBlock); - return code; -} - static int32_t execShowCreateDatabase(SShowCreateDatabaseStmt* pStmt, SRetrieveTableRsp** pRsp) { SSDataBlock* pBlock = NULL; int32_t code = buildCreateDBResultDataBlock(&pBlock); @@ -1075,9 +954,6 @@ int32_t qExecCommand(int64_t* pConnId, bool sysInfoUser, SNode* pStmt, SRetrieve return execShowLocalVariables(pRsp); case QUERY_NODE_SELECT_STMT: return execSelectWithoutFrom((SSelectStmt*)pStmt, pRsp); - case QUERY_NODE_SHOW_DB_ALIVE_STMT: - case QUERY_NODE_SHOW_CLUSTER_ALIVE_STMT: - return execShowAliveStatus(pConnId, (SShowAliveStmt*)pStmt, pRsp); default: break; } diff --git a/source/libs/monitorfw/inc/taos_assert.h b/source/libs/monitorfw/inc/taos_assert.h index d3226eed26..9d2732acc5 100644 --- a/source/libs/monitorfw/inc/taos_assert.h +++ b/source/libs/monitorfw/inc/taos_assert.h @@ -1,16 +1,17 @@ -/* - * Copyright (c) 2019 TAOS Data, Inc. +/** + * Copyright 2019-2020 DigitalOcean Inc. * - * 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. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * 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. + * http://www.apache.org/licenses/LICENSE-2.0 * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #include diff --git a/source/libs/monitorfw/inc/taos_collector_registry_i.h b/source/libs/monitorfw/inc/taos_collector_registry_i.h index ed5bb1fe19..c69abf54c0 100644 --- a/source/libs/monitorfw/inc/taos_collector_registry_i.h +++ b/source/libs/monitorfw/inc/taos_collector_registry_i.h @@ -1,16 +1,17 @@ -/* - * Copyright (c) 2019 TAOS Data, Inc. +/** + * Copyright 2019-2020 DigitalOcean Inc. * - * 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. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * 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. + * http://www.apache.org/licenses/LICENSE-2.0 * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #include "taos_collector_registry_t.h" diff --git a/source/libs/monitorfw/inc/taos_collector_registry_t.h b/source/libs/monitorfw/inc/taos_collector_registry_t.h index 8e8a881fca..9c00270abd 100644 --- a/source/libs/monitorfw/inc/taos_collector_registry_t.h +++ b/source/libs/monitorfw/inc/taos_collector_registry_t.h @@ -1,16 +1,17 @@ -/* - * Copyright (c) 2019 TAOS Data, Inc. +/** + * Copyright 2019-2020 DigitalOcean Inc. * - * 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. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * 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. + * http://www.apache.org/licenses/LICENSE-2.0 * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #ifndef TAOS_REGISTRY_T_H diff --git a/source/libs/monitorfw/inc/taos_collector_t.h b/source/libs/monitorfw/inc/taos_collector_t.h index 264e8e9ad9..b7748357fc 100644 --- a/source/libs/monitorfw/inc/taos_collector_t.h +++ b/source/libs/monitorfw/inc/taos_collector_t.h @@ -1,16 +1,17 @@ -/* - * Copyright (c) 2019 TAOS Data, Inc. +/** + * Copyright 2019-2020 DigitalOcean Inc. * - * 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. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * 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. + * http://www.apache.org/licenses/LICENSE-2.0 * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #ifndef TAOS_COLLECTOR_T_H diff --git a/source/libs/monitorfw/inc/taos_errors.h b/source/libs/monitorfw/inc/taos_errors.h index ee2a894df3..50e92c3093 100644 --- a/source/libs/monitorfw/inc/taos_errors.h +++ b/source/libs/monitorfw/inc/taos_errors.h @@ -1,16 +1,17 @@ -/* - * Copyright (c) 2019 TAOS Data, Inc. +/** + * Copyright 2019-2020 DigitalOcean Inc. * - * 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. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * 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. + * http://www.apache.org/licenses/LICENSE-2.0 * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #define TAOS_STDIO_CLOSE_DIR_ERROR "failed to close dir" diff --git a/source/libs/monitorfw/inc/taos_linked_list_i.h b/source/libs/monitorfw/inc/taos_linked_list_i.h index 015f8a57ad..73be405023 100644 --- a/source/libs/monitorfw/inc/taos_linked_list_i.h +++ b/source/libs/monitorfw/inc/taos_linked_list_i.h @@ -1,16 +1,17 @@ -/* - * Copyright (c) 2019 TAOS Data, Inc. +/** + * Copyright 2019-2020 DigitalOcean Inc. * - * 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. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * 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. + * http://www.apache.org/licenses/LICENSE-2.0 * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #ifndef TAOS_LIST_I_INCLUDED diff --git a/source/libs/monitorfw/inc/taos_linked_list_t.h b/source/libs/monitorfw/inc/taos_linked_list_t.h index ccd82ffb61..abb7ff5418 100644 --- a/source/libs/monitorfw/inc/taos_linked_list_t.h +++ b/source/libs/monitorfw/inc/taos_linked_list_t.h @@ -1,16 +1,17 @@ -/* - * Copyright (c) 2019 TAOS Data, Inc. +/** + * Copyright 2019-2020 DigitalOcean Inc. * - * 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. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * 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. + * http://www.apache.org/licenses/LICENSE-2.0 * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #ifndef TAOS_LIST_T_H diff --git a/source/libs/monitorfw/inc/taos_log.h b/source/libs/monitorfw/inc/taos_log.h index fecbda59e5..3b3be4efbf 100644 --- a/source/libs/monitorfw/inc/taos_log.h +++ b/source/libs/monitorfw/inc/taos_log.h @@ -1,16 +1,17 @@ -/* - * Copyright (c) 2019 TAOS Data, Inc. +/** + * Copyright 2019-2020 DigitalOcean Inc. * - * 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. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * 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. + * http://www.apache.org/licenses/LICENSE-2.0 * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #include diff --git a/source/libs/monitorfw/inc/taos_map_i.h b/source/libs/monitorfw/inc/taos_map_i.h index 55f248b96a..c9d584315b 100644 --- a/source/libs/monitorfw/inc/taos_map_i.h +++ b/source/libs/monitorfw/inc/taos_map_i.h @@ -1,16 +1,17 @@ -/* - * Copyright (c) 2019 TAOS Data, Inc. +/** + * Copyright 2019-2020 DigitalOcean Inc. * - * 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. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * 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. + * http://www.apache.org/licenses/LICENSE-2.0 * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #ifndef TAOS_MAP_I_INCLUDED diff --git a/source/libs/monitorfw/inc/taos_map_t.h b/source/libs/monitorfw/inc/taos_map_t.h index 6fcbda1366..8119397e5d 100644 --- a/source/libs/monitorfw/inc/taos_map_t.h +++ b/source/libs/monitorfw/inc/taos_map_t.h @@ -1,16 +1,17 @@ -/* - * Copyright (c) 2019 TAOS Data, Inc. +/** + * Copyright 2019-2020 DigitalOcean Inc. * - * 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. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * 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. + * http://www.apache.org/licenses/LICENSE-2.0 * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #ifndef TAOS_MAP_T_H diff --git a/source/libs/monitorfw/inc/taos_metric_formatter_custom_i.h b/source/libs/monitorfw/inc/taos_metric_formatter_custom_i.h index f3e4ebae75..169e170e1a 100644 --- a/source/libs/monitorfw/inc/taos_metric_formatter_custom_i.h +++ b/source/libs/monitorfw/inc/taos_metric_formatter_custom_i.h @@ -1,16 +1,17 @@ -/* - * Copyright (c) 2019 TAOS Data, Inc. +/** + * Copyright 2019-2020 DigitalOcean Inc. * - * 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. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * 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. + * http://www.apache.org/licenses/LICENSE-2.0 * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #ifndef TAOS_METRIC_FORMATTER_CUSTOMV2_I_H diff --git a/source/libs/monitorfw/inc/taos_metric_formatter_i.h b/source/libs/monitorfw/inc/taos_metric_formatter_i.h index fba30d9eeb..ab60359f4a 100644 --- a/source/libs/monitorfw/inc/taos_metric_formatter_i.h +++ b/source/libs/monitorfw/inc/taos_metric_formatter_i.h @@ -1,16 +1,17 @@ -/* - * Copyright (c) 2019 TAOS Data, Inc. +/** + * Copyright 2019-2020 DigitalOcean Inc. * - * 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. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * 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. + * http://www.apache.org/licenses/LICENSE-2.0 * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #ifndef TAOS_METRIC_FORMATTER_I_H diff --git a/source/libs/monitorfw/inc/taos_metric_formatter_t.h b/source/libs/monitorfw/inc/taos_metric_formatter_t.h index 0d7425aa59..0a629469a8 100644 --- a/source/libs/monitorfw/inc/taos_metric_formatter_t.h +++ b/source/libs/monitorfw/inc/taos_metric_formatter_t.h @@ -1,16 +1,17 @@ -/* - * Copyright (c) 2019 TAOS Data, Inc. +/** + * Copyright 2019-2020 DigitalOcean Inc. * - * 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. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * 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. + * http://www.apache.org/licenses/LICENSE-2.0 * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #ifndef TAOS_METRIC_FORMATTER_T_H diff --git a/source/libs/monitorfw/inc/taos_metric_i.h b/source/libs/monitorfw/inc/taos_metric_i.h index e8ae799547..489ba2ac0b 100644 --- a/source/libs/monitorfw/inc/taos_metric_i.h +++ b/source/libs/monitorfw/inc/taos_metric_i.h @@ -1,16 +1,17 @@ -/* - * Copyright (c) 2019 TAOS Data, Inc. +/** + * Copyright 2019-2020 DigitalOcean Inc. * - * 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. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * 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. + * http://www.apache.org/licenses/LICENSE-2.0 * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ // Private diff --git a/source/libs/monitorfw/inc/taos_metric_sample_i.h b/source/libs/monitorfw/inc/taos_metric_sample_i.h index b5e90f1933..a354432774 100644 --- a/source/libs/monitorfw/inc/taos_metric_sample_i.h +++ b/source/libs/monitorfw/inc/taos_metric_sample_i.h @@ -1,16 +1,17 @@ -/* - * Copyright (c) 2019 TAOS Data, Inc. +/** + * Copyright 2019-2020 DigitalOcean Inc. * - * 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. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * 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. + * http://www.apache.org/licenses/LICENSE-2.0 * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #include "taos_metric_sample_t.h" diff --git a/source/libs/monitorfw/inc/taos_metric_sample_t.h b/source/libs/monitorfw/inc/taos_metric_sample_t.h index 387512af9d..59dd92aba8 100644 --- a/source/libs/monitorfw/inc/taos_metric_sample_t.h +++ b/source/libs/monitorfw/inc/taos_metric_sample_t.h @@ -1,16 +1,17 @@ -/* - * Copyright (c) 2019 TAOS Data, Inc. +/** + * Copyright 2019-2020 DigitalOcean Inc. * - * 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. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * 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. + * http://www.apache.org/licenses/LICENSE-2.0 * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #ifndef TAOS_METRIC_SAMPLE_T_H diff --git a/source/libs/monitorfw/inc/taos_metric_t.h b/source/libs/monitorfw/inc/taos_metric_t.h index da237aa814..d285b56d33 100644 --- a/source/libs/monitorfw/inc/taos_metric_t.h +++ b/source/libs/monitorfw/inc/taos_metric_t.h @@ -1,16 +1,17 @@ -/* - * Copyright (c) 2019 TAOS Data, Inc. +/** + * Copyright 2019-2020 DigitalOcean Inc. * - * 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. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * 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. + * http://www.apache.org/licenses/LICENSE-2.0 * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #ifndef TAOS_METRIC_T_H diff --git a/source/libs/monitorfw/inc/taos_monitor_util_i.h b/source/libs/monitorfw/inc/taos_monitor_util_i.h index fe072204a3..8ac048c8b5 100644 --- a/source/libs/monitorfw/inc/taos_monitor_util_i.h +++ b/source/libs/monitorfw/inc/taos_monitor_util_i.h @@ -1,16 +1,17 @@ -/* - * Copyright (c) 2019 TAOS Data, Inc. +/** + * Copyright 2019-2020 DigitalOcean Inc. * - * 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. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * 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. + * http://www.apache.org/licenses/LICENSE-2.0 * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #ifndef TAOS_MONITOR_UTIL_I_H diff --git a/source/libs/monitorfw/inc/taos_string_builder_i.h b/source/libs/monitorfw/inc/taos_string_builder_i.h index 142ca020ba..933d778691 100644 --- a/source/libs/monitorfw/inc/taos_string_builder_i.h +++ b/source/libs/monitorfw/inc/taos_string_builder_i.h @@ -1,16 +1,17 @@ -/* - * Copyright (c) 2019 TAOS Data, Inc. +/** + * Copyright 2019-2020 DigitalOcean Inc. * - * 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. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * 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. + * http://www.apache.org/licenses/LICENSE-2.0 * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #ifndef TAOS_STRING_BUILDER_I_H diff --git a/source/libs/monitorfw/inc/taos_string_builder_t.h b/source/libs/monitorfw/inc/taos_string_builder_t.h index edd3d574fa..c0d487865c 100644 --- a/source/libs/monitorfw/inc/taos_string_builder_t.h +++ b/source/libs/monitorfw/inc/taos_string_builder_t.h @@ -1,16 +1,17 @@ -/* - * Copyright (c) 2019 TAOS Data, Inc. +/** + * Copyright 2019-2020 DigitalOcean Inc. * - * 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. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * 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. + * http://www.apache.org/licenses/LICENSE-2.0 * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #ifndef TAOS_STRING_BUILDER_T_H diff --git a/source/libs/monitorfw/src/taos_collector.c b/source/libs/monitorfw/src/taos_collector.c index 414c02121d..8be4edaef9 100644 --- a/source/libs/monitorfw/src/taos_collector.c +++ b/source/libs/monitorfw/src/taos_collector.c @@ -1,16 +1,17 @@ -/* - * Copyright (c) 2019 TAOS Data, Inc. +/** + * Copyright 2019-2020 DigitalOcean Inc. * - * 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. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * 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. + * http://www.apache.org/licenses/LICENSE-2.0 * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #include diff --git a/source/libs/monitorfw/src/taos_collector_registry.c b/source/libs/monitorfw/src/taos_collector_registry.c index d4838ef301..0c8385791d 100644 --- a/source/libs/monitorfw/src/taos_collector_registry.c +++ b/source/libs/monitorfw/src/taos_collector_registry.c @@ -1,16 +1,17 @@ -/* - * Copyright (c) 2019 TAOS Data, Inc. +/** + * Copyright 2019-2020 DigitalOcean Inc. * - * 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. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * 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. + * http://www.apache.org/licenses/LICENSE-2.0 * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #include diff --git a/source/libs/monitorfw/src/taos_counter.c b/source/libs/monitorfw/src/taos_counter.c index d522411b2b..b4c867c66f 100644 --- a/source/libs/monitorfw/src/taos_counter.c +++ b/source/libs/monitorfw/src/taos_counter.c @@ -1,16 +1,17 @@ -/* - * Copyright (c) 2019 TAOS Data, Inc. +/** + * Copyright 2019-2020 DigitalOcean Inc. * - * 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. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * 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. + * http://www.apache.org/licenses/LICENSE-2.0 * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ // Public diff --git a/source/libs/monitorfw/src/taos_gauge.c b/source/libs/monitorfw/src/taos_gauge.c index 7793f4c464..1f9fa6fc9c 100644 --- a/source/libs/monitorfw/src/taos_gauge.c +++ b/source/libs/monitorfw/src/taos_gauge.c @@ -1,16 +1,17 @@ -/* - * Copyright (c) 2019 TAOS Data, Inc. +/** + * Copyright 2019-2020 DigitalOcean Inc. * - * 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. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * 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. + * http://www.apache.org/licenses/LICENSE-2.0 * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ // Public diff --git a/source/libs/monitorfw/src/taos_linked_list.c b/source/libs/monitorfw/src/taos_linked_list.c index 2becb08a07..7c46e89ab0 100644 --- a/source/libs/monitorfw/src/taos_linked_list.c +++ b/source/libs/monitorfw/src/taos_linked_list.c @@ -1,16 +1,17 @@ -/* - * Copyright (c) 2019 TAOS Data, Inc. +/** + * Copyright 2019-2020 DigitalOcean Inc. * - * 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. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * 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. + * http://www.apache.org/licenses/LICENSE-2.0 * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ // Public diff --git a/source/libs/monitorfw/src/taos_map.c b/source/libs/monitorfw/src/taos_map.c index ffb7d000fc..55aaabf1a7 100644 --- a/source/libs/monitorfw/src/taos_map.c +++ b/source/libs/monitorfw/src/taos_map.c @@ -1,16 +1,17 @@ -/* - * Copyright (c) 2019 TAOS Data, Inc. +/** + * Copyright 2019-2020 DigitalOcean Inc. * - * 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. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * 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. + * http://www.apache.org/licenses/LICENSE-2.0 * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #include diff --git a/source/libs/monitorfw/src/taos_metric.c b/source/libs/monitorfw/src/taos_metric.c index 5cecbc927f..056bf131f2 100644 --- a/source/libs/monitorfw/src/taos_metric.c +++ b/source/libs/monitorfw/src/taos_metric.c @@ -1,16 +1,17 @@ -/* - * Copyright (c) 2019 TAOS Data, Inc. +/** + * Copyright 2019-2020 DigitalOcean Inc. * - * 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. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * 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. + * http://www.apache.org/licenses/LICENSE-2.0 * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #include diff --git a/source/libs/monitorfw/src/taos_metric_formatter.c b/source/libs/monitorfw/src/taos_metric_formatter.c index 53012935ba..5f34edf3e6 100644 --- a/source/libs/monitorfw/src/taos_metric_formatter.c +++ b/source/libs/monitorfw/src/taos_metric_formatter.c @@ -1,16 +1,17 @@ -/* - * Copyright (c) 2019 TAOS Data, Inc. +/** + * Copyright 2019-2020 DigitalOcean Inc. * - * 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. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * 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. + * http://www.apache.org/licenses/LICENSE-2.0 * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #include diff --git a/source/libs/monitorfw/src/taos_metric_formatter_custom.c b/source/libs/monitorfw/src/taos_metric_formatter_custom.c index 3b1318dfc0..553227c801 100644 --- a/source/libs/monitorfw/src/taos_metric_formatter_custom.c +++ b/source/libs/monitorfw/src/taos_metric_formatter_custom.c @@ -1,16 +1,17 @@ -/* - * Copyright (c) 2019 TAOS Data, Inc. +/** + * Copyright 2019-2020 DigitalOcean Inc. * - * 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. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * 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. + * http://www.apache.org/licenses/LICENSE-2.0 * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #define ALLOW_FORBID_FUNC diff --git a/source/libs/monitorfw/src/taos_metric_sample.c b/source/libs/monitorfw/src/taos_metric_sample.c index c6d817b513..4688672835 100644 --- a/source/libs/monitorfw/src/taos_metric_sample.c +++ b/source/libs/monitorfw/src/taos_metric_sample.c @@ -1,16 +1,17 @@ -/* - * Copyright (c) 2019 TAOS Data, Inc. +/** + * Copyright 2019-2020 DigitalOcean Inc. * - * 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. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * 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. + * http://www.apache.org/licenses/LICENSE-2.0 * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ diff --git a/source/libs/monitorfw/src/taos_monitor_util.c b/source/libs/monitorfw/src/taos_monitor_util.c index 182402b3ff..d338215426 100644 --- a/source/libs/monitorfw/src/taos_monitor_util.c +++ b/source/libs/monitorfw/src/taos_monitor_util.c @@ -1,16 +1,17 @@ -/* - * Copyright (c) 2019 TAOS Data, Inc. +/** + * Copyright 2019-2020 DigitalOcean Inc. * - * 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. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * 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. + * http://www.apache.org/licenses/LICENSE-2.0 * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ diff --git a/source/libs/monitorfw/src/taos_string_builder.c b/source/libs/monitorfw/src/taos_string_builder.c index 0f3940cdab..e1bfa4142c 100644 --- a/source/libs/monitorfw/src/taos_string_builder.c +++ b/source/libs/monitorfw/src/taos_string_builder.c @@ -1,16 +1,17 @@ -/* - * Copyright (c) 2019 TAOS Data, Inc. +/** + * Copyright 2019-2020 DigitalOcean Inc. * - * 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. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * 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. + * http://www.apache.org/licenses/LICENSE-2.0 * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #include diff --git a/source/libs/nodes/src/nodesUtilFuncs.c b/source/libs/nodes/src/nodesUtilFuncs.c index c081841b3b..5a7c2343e9 100644 --- a/source/libs/nodes/src/nodesUtilFuncs.c +++ b/source/libs/nodes/src/nodesUtilFuncs.c @@ -2676,6 +2676,18 @@ SValueNode* nodesMakeValueNodeFromBool(bool b) { return pValNode; } +SNode* nodesMakeValueNodeFromInt32(int32_t value) { + SValueNode* pValNode = (SValueNode*)nodesMakeNode(QUERY_NODE_VALUE); + if (pValNode) { + pValNode->node.resType.type = TSDB_DATA_TYPE_INT; + pValNode->node.resType.bytes = tDataTypes[TSDB_DATA_TYPE_INT].bytes; + nodesSetValueNodeValue(pValNode, &value); + pValNode->translate = true; + pValNode->isNull = false; + } + return (SNode*)pValNode; +} + bool nodesIsStar(SNode* pNode) { return (QUERY_NODE_COLUMN == nodeType(pNode)) && ('\0' == ((SColumnNode*)pNode)->tableAlias[0]) && (0 == strcmp(((SColumnNode*)pNode)->colName, "*")); diff --git a/source/libs/parser/src/parAstParser.c b/source/libs/parser/src/parAstParser.c index 122118b71c..aa2fd287c5 100644 --- a/source/libs/parser/src/parAstParser.c +++ b/source/libs/parser/src/parAstParser.c @@ -821,6 +821,16 @@ static int32_t collectMetaKeyFromShowTSMASStmt(SCollectMetaKeyCxt* pCxt, SShowSt pCxt->pMetaCache); } +static int32_t collectMetaKeyFromShowAlive(SCollectMetaKeyCxt* pCxt, SShowAliveStmt* pStmt) { + int32_t code = reserveTableMetaInCache(pCxt->pParseCxt->acctId, TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_VGROUPS, + pCxt->pMetaCache); + if (TSDB_CODE_SUCCESS == code) { + // just to verify whether the database exists + code = reserveDbCfgInCache(pCxt->pParseCxt->acctId, pStmt->dbName, pCxt->pMetaCache); + } + return code; +} + static int32_t collectMetaKeyFromQuery(SCollectMetaKeyCxt* pCxt, SNode* pStmt) { pCxt->pStmt = pStmt; switch (nodeType(pStmt)) { @@ -960,6 +970,9 @@ static int32_t collectMetaKeyFromQuery(SCollectMetaKeyCxt* pCxt, SNode* pStmt) { break; case QUERY_NODE_SHOW_TSMAS_STMT: return collectMetaKeyFromShowTSMASStmt(pCxt, (SShowStmt*)pStmt); + case QUERY_NODE_SHOW_DB_ALIVE_STMT: + case QUERY_NODE_SHOW_CLUSTER_ALIVE_STMT: + return collectMetaKeyFromShowAlive(pCxt, (SShowAliveStmt*)pStmt); default: break; } diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 335324c86f..04fea01fe7 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -33,6 +33,20 @@ #define SYSTABLE_SHOW_TYPE_OFFSET QUERY_NODE_SHOW_DNODES_STMT +#define CHECK_RES_OUT_OF_MEM(p) \ + do { \ + if (TSDB_CODE_SUCCESS != (p)) { \ + return TSDB_CODE_OUT_OF_MEMORY; \ + } \ + } while (0) + +#define CHECK_POINTER_OUT_OF_MEM(p) \ + do { \ + if (NULL == (p)) { \ + return TSDB_CODE_OUT_OF_MEMORY; \ + } \ + } while (0) + typedef struct SRewriteTbNameContext { int32_t errCode; char* pTbName; @@ -7302,7 +7316,17 @@ static int32_t translateAlterDatabase(STranslateContext* pCxt, SAlterDatabaseStm "Invalid option, wal_level 0 should be used with replica 1"); } } - +#if 0 + if (pStmt->pOptions->replica > 1 && pStmt->pOptions->walLevel < 1) { + SDbCfgInfo dbCfg = {0}; + dbCfg.walLevel = -1; + int32_t code = getDBCfg(pCxt, pStmt->dbName, &dbCfg); + if (TSDB_CODE_SUCCESS == code && dbCfg.walLevel == 0) { + return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_DB_OPTION, + "Invalid option, wal_level 0 should be used with replica 1"); + } + } +#endif int32_t code = checkDatabaseOptions(pCxt, pStmt->dbName, pStmt->pOptions); if (TSDB_CODE_SUCCESS != code) { return code; @@ -11597,20 +11621,6 @@ static int32_t extractShowCreateDatabaseResultSchema(int32_t* numOfCols, SSchema return TSDB_CODE_SUCCESS; } -static int32_t extractShowAliveResultSchema(int32_t* numOfCols, SSchema** pSchema) { - *numOfCols = 1; - *pSchema = taosMemoryCalloc((*numOfCols), sizeof(SSchema)); - if (NULL == (*pSchema)) { - return TSDB_CODE_OUT_OF_MEMORY; - } - - (*pSchema)[0].type = TSDB_DATA_TYPE_INT; - (*pSchema)[0].bytes = sizeof(int32_t); - strcpy((*pSchema)[0].name, "status"); - - return TSDB_CODE_SUCCESS; -} - static int32_t extractShowCreateTableResultSchema(int32_t* numOfCols, SSchema** pSchema) { *numOfCols = 2; *pSchema = taosMemoryCalloc((*numOfCols), sizeof(SSchema)); @@ -11708,9 +11718,6 @@ int32_t extractResultSchema(const SNode* pRoot, int32_t* numOfCols, SSchema** pS } case QUERY_NODE_SHOW_CREATE_DATABASE_STMT: return extractShowCreateDatabaseResultSchema(numOfCols, pSchema); - case QUERY_NODE_SHOW_DB_ALIVE_STMT: - case QUERY_NODE_SHOW_CLUSTER_ALIVE_STMT: - return extractShowAliveResultSchema(numOfCols, pSchema); case QUERY_NODE_SHOW_CREATE_TABLE_STMT: case QUERY_NODE_SHOW_CREATE_STABLE_STMT: return extractShowCreateTableResultSchema(numOfCols, pSchema); @@ -11837,6 +11844,24 @@ static int32_t createOperatorNode(EOperatorType opType, const char* pColName, SN return TSDB_CODE_SUCCESS; } +static int32_t createParOperatorNode(EOperatorType opType, const char* pLeftCol, const char* pRightCol, SNode** ppResOp) { + SOperatorNode* pOper = (SOperatorNode*)nodesMakeNode(QUERY_NODE_OPERATOR); + CHECK_POINTER_OUT_OF_MEM(pOper); + + pOper->opType = opType; + pOper->pLeft = nodesMakeNode(QUERY_NODE_COLUMN); + pOper->pRight = nodesMakeNode(QUERY_NODE_COLUMN); + if (NULL == pOper->pLeft || NULL == pOper->pRight) { + nodesDestroyNode((SNode*)pOper); + return TSDB_CODE_OUT_OF_MEMORY; + } + strcpy(((SColumnNode*)pOper->pLeft)->colName, pLeftCol); + strcpy(((SColumnNode*)pOper->pRight)->colName, pRightCol); + + *ppResOp = (SNode*)pOper; + return TSDB_CODE_SUCCESS; +} + static const char* getTbNameColName(ENodeType type) { const char* colName; switch (type) { @@ -13364,6 +13389,203 @@ static int32_t rewriteShowCompactDetailsStmt(STranslateContext* pCxt, SQuery* pQ return code; } +static int32_t createParWhenThenNode(SNode* pWhen, SNode* pThen, SNode** ppResWhenThen) { + SWhenThenNode* pWThen = (SWhenThenNode*)nodesMakeNode(QUERY_NODE_WHEN_THEN); + CHECK_POINTER_OUT_OF_MEM(pWThen); + + pWThen->pWhen = pWhen; + pWThen->pThen = pThen; + *ppResWhenThen = (SNode*)pWThen; + return TSDB_CODE_SUCCESS; +} + +static int32_t createParCaseWhenNode(SNode* pCase, SNodeList* pWhenThenList, SNode* pElse, const char* pAias, SNode** ppResCaseWhen) { + SCaseWhenNode* pCaseWhen = (SCaseWhenNode*)nodesMakeNode(QUERY_NODE_CASE_WHEN); + CHECK_POINTER_OUT_OF_MEM(pCaseWhen); + + pCaseWhen->pCase = pCase; + pCaseWhen->pWhenThenList = pWhenThenList; + pCaseWhen->pElse = pElse; + if (pAias) { + strcpy(pCaseWhen->node.aliasName, pAias); + strcpy(pCaseWhen->node.userAlias, pAias); + } + *ppResCaseWhen = (SNode*)pCaseWhen; + return TSDB_CODE_SUCCESS; +} + +static int32_t createParFunctionNode(const char* pFunName, const char* pAias, SNodeList* pParameterList, SNode** ppResFunc) { + SFunctionNode* pFunc = (SFunctionNode*)nodesMakeNode(QUERY_NODE_FUNCTION); + CHECK_POINTER_OUT_OF_MEM(pFunc); + strcpy(pFunc->functionName, pFunName); + strcpy(pFunc->node.aliasName, pAias); + strcpy(pFunc->node.userAlias, pAias); + pFunc->pParameterList = pParameterList; + *ppResFunc = (SNode*)pFunc; + return TSDB_CODE_SUCCESS; +} + +static int32_t createParListNode(SNode* pItem, SNodeList** ppResList) { + SNodeList* pList = nodesMakeList(); + CHECK_POINTER_OUT_OF_MEM(pList); + CHECK_RES_OUT_OF_MEM(nodesListStrictAppend(pList, pItem)); + *ppResList = pList; + return TSDB_CODE_SUCCESS; +} + +static int32_t createParTempTableNode(SSelectStmt* pSubquery, SNode** ppResTempTable) { + STempTableNode* pTempTable = (STempTableNode*)nodesMakeNode(QUERY_NODE_TEMP_TABLE); + CHECK_POINTER_OUT_OF_MEM(pTempTable); + pTempTable->pSubquery = (SNode*)pSubquery; + taosRandStr(pTempTable->table.tableAlias, 8); + strcpy(pSubquery->stmtName, pTempTable->table.tableAlias); + pSubquery->isSubquery = true; + *ppResTempTable = (SNode*)pTempTable; + return TSDB_CODE_SUCCESS; +} + +static int32_t rewriteShowAliveStmt(STranslateContext* pCxt, SQuery* pQuery) { + int32_t code = TSDB_CODE_SUCCESS; + char* pDbName = ((SShowAliveStmt*)pQuery->pRoot)->dbName; + if (pDbName && pDbName[0] != 0) { + SDbCfgInfo dbCfg = {0}; + code = getDBCfg(pCxt, pDbName, &dbCfg); + if (TSDB_CODE_SUCCESS != code) { + return code; + } + } + + SValueNode* pValNode = nodesMakeValueNodeFromString("leader"); + CHECK_POINTER_OUT_OF_MEM(pValNode); + + SNode* pCond1 = NULL; + SNode* pCond2 = NULL; + SNode* pCond3 = NULL; + SNode* pCond4 = NULL; + CHECK_RES_OUT_OF_MEM(createOperatorNode(OP_TYPE_EQUAL, "v1_status", (SNode*)pValNode, &pCond1)); + CHECK_RES_OUT_OF_MEM(createOperatorNode(OP_TYPE_EQUAL, "v2_status", (SNode*)pValNode, &pCond2)); + CHECK_RES_OUT_OF_MEM(createOperatorNode(OP_TYPE_EQUAL, "v3_status", (SNode*)pValNode, &pCond3)); + CHECK_RES_OUT_OF_MEM(createOperatorNode(OP_TYPE_EQUAL, "v4_status", (SNode*)pValNode, &pCond4)); + nodesDestroyNode((SNode*)pValNode); + + SNode* pTemp1 = NULL; + SNode* pTemp2 = NULL; + SNode* pFullCond = NULL; + CHECK_RES_OUT_OF_MEM(createLogicCondNode(pCond1, pCond2, &pTemp1, LOGIC_COND_TYPE_OR)); + CHECK_RES_OUT_OF_MEM(createLogicCondNode(pTemp1, pCond3, &pTemp2, LOGIC_COND_TYPE_OR)); + CHECK_RES_OUT_OF_MEM(createLogicCondNode(pTemp2, pCond4, &pFullCond, LOGIC_COND_TYPE_OR)); + + SNode* pThen = nodesMakeValueNodeFromInt32(1); + CHECK_POINTER_OUT_OF_MEM(pThen); + + SNode* pWhenThen = NULL; + CHECK_RES_OUT_OF_MEM(createParWhenThenNode(pFullCond, pThen, &pWhenThen)); + SNodeList* pWhenThenlist = NULL; + CHECK_RES_OUT_OF_MEM(createParListNode(pWhenThen, &pWhenThenlist)); + + SNode* pElse = nodesMakeValueNodeFromInt32(0); + CHECK_POINTER_OUT_OF_MEM(pElse); + + // case when (v1_status = "leader" or v2_status = "lead er" or v3_status = "leader" or v4_status = "leader") then 1 else 0 end + SNode* pCaseWhen = NULL; + CHECK_RES_OUT_OF_MEM(createParCaseWhenNode(NULL, pWhenThenlist, pElse, NULL, &pCaseWhen)); + + SNodeList* pParaList = NULL; + CHECK_RES_OUT_OF_MEM(createParListNode(pCaseWhen, &pParaList)); + + + // sum( case when ... end) as leader_col + SNode* pSumFun = NULL; + const char* pSumColAlias = "leader_col"; + CHECK_RES_OUT_OF_MEM(createParFunctionNode("sum", pSumColAlias, pParaList, &pSumFun)); + + SNode* pPara1 = nodesMakeValueNodeFromInt32(1); + CHECK_POINTER_OUT_OF_MEM(pThen); + pParaList = NULL; + CHECK_RES_OUT_OF_MEM(createParListNode(pPara1, &pParaList)); + + // count(1) as count_col + SNode* pCountFun = NULL; + const char* pCountColAlias = "count_col"; + CHECK_RES_OUT_OF_MEM(createParFunctionNode("count", pCountColAlias, pParaList, &pCountFun)); + + SNodeList* pProjList = NULL; + CHECK_RES_OUT_OF_MEM(createParListNode(pSumFun, &pProjList)); + CHECK_RES_OUT_OF_MEM(nodesListStrictAppend(pProjList, pCountFun)); + + SSelectStmt* pSubSelect = NULL; + // select sum( case when .... end) as leader_col, count(*) as count_col from information_schema.ins_vgroups + CHECK_RES_OUT_OF_MEM(createSimpleSelectStmtFromProjList(TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_VGROUPS, pProjList, &pSubSelect)); + + if (pDbName && pDbName[0] != 0) { + // for show db.alive + // select sum( case when .... end) as leader_col, count(*) as count_col from information_schema.ins_vgroups where db_name = "..." + SNode* pDbCond = NULL; + pValNode = nodesMakeValueNodeFromString(pDbName); + CHECK_RES_OUT_OF_MEM(createOperatorNode(OP_TYPE_EQUAL, "db_name", (SNode*)pValNode, &pDbCond)); + nodesDestroyNode((SNode*)pValNode); + pCxt->showRewrite = false; + pQuery->showRewrite = false; + pSubSelect->pWhere = pDbCond; + } + + + + pCond1 = NULL; + CHECK_RES_OUT_OF_MEM(createParOperatorNode(OP_TYPE_EQUAL, pSumColAlias, pCountColAlias, &pCond1)); + pCond2 = NULL; + SNode* pTempVal = nodesMakeValueNodeFromInt32(0); + CHECK_RES_OUT_OF_MEM(createOperatorNode(OP_TYPE_GREATER_THAN, pSumColAlias, pTempVal, &pCond2)); + //leader_col = count_col and leader_col > 0 + pTemp1 = NULL; + CHECK_RES_OUT_OF_MEM(createLogicCondNode(pCond1, pCond2, &pTemp1, LOGIC_COND_TYPE_AND)); + + pThen = nodesMakeValueNodeFromInt32(1); + CHECK_POINTER_OUT_OF_MEM(pThen); + pWhenThen = NULL; + CHECK_RES_OUT_OF_MEM(createParWhenThenNode(pTemp1, pThen, &pWhenThen)); + pWhenThenlist = NULL; + CHECK_RES_OUT_OF_MEM(createParListNode(pWhenThen, &pWhenThenlist)); + + pCond1 = NULL; + CHECK_RES_OUT_OF_MEM(createParOperatorNode(OP_TYPE_LOWER_THAN, pSumColAlias, pCountColAlias, &pCond1)); + pCond2 = NULL; + CHECK_RES_OUT_OF_MEM(createOperatorNode(OP_TYPE_GREATER_THAN, pSumColAlias, pTempVal, &pCond2)); + // leader_col < count_col and leader_col > 0 + pTemp2 = NULL; + CHECK_RES_OUT_OF_MEM(createLogicCondNode(pCond1, pCond2, &pTemp2, LOGIC_COND_TYPE_AND)); + nodesDestroyNode((SNode*)pTempVal); + + pThen = nodesMakeValueNodeFromInt32(2); + CHECK_POINTER_OUT_OF_MEM(pThen); + pWhenThen = NULL; + CHECK_RES_OUT_OF_MEM(createParWhenThenNode(pTemp2, pThen, &pWhenThen)); + CHECK_RES_OUT_OF_MEM(nodesListStrictAppend(pWhenThenlist, pWhenThen)); + + // case when leader_col = count_col and count_col > 0 then 1 when leader_col < count_col and count_col > 0 then 2 else 0 end as status + pCaseWhen = NULL; + pElse = nodesMakeValueNodeFromInt32(0); + CHECK_POINTER_OUT_OF_MEM(pElse); + CHECK_RES_OUT_OF_MEM(createParCaseWhenNode(NULL, pWhenThenlist, pElse, "status", &pCaseWhen)); + + pProjList = NULL; + CHECK_RES_OUT_OF_MEM(createParListNode(pCaseWhen, &pProjList)); + + SNode* pTempTblNode = NULL; + CHECK_RES_OUT_OF_MEM(createParTempTableNode(pSubSelect, &pTempTblNode)); + + + SSelectStmt* pStmt = (SSelectStmt*)nodesMakeNode(QUERY_NODE_SELECT_STMT); + CHECK_POINTER_OUT_OF_MEM(pStmt); + pStmt->pProjectionList = pProjList; + pStmt->pFromTable = pTempTblNode; + sprintf(pStmt->stmtName, "%p", pStmt); + + nodesDestroyNode(pQuery->pRoot); + pQuery->pRoot = (SNode*)pStmt; + return TSDB_CODE_SUCCESS; +} + static int32_t rewriteQuery(STranslateContext* pCxt, SQuery* pQuery) { int32_t code = TSDB_CODE_SUCCESS; switch (nodeType(pQuery->pRoot)) { @@ -13440,6 +13662,10 @@ static int32_t rewriteQuery(STranslateContext* pCxt, SQuery* pQuery) { case QUERY_NODE_SHOW_COMPACT_DETAILS_STMT: code = rewriteShowCompactDetailsStmt(pCxt, pQuery); break; + case QUERY_NODE_SHOW_DB_ALIVE_STMT: + case QUERY_NODE_SHOW_CLUSTER_ALIVE_STMT: + code = rewriteShowAliveStmt(pCxt, pQuery); + break; default: break; } @@ -13531,8 +13757,6 @@ static int32_t setQuery(STranslateContext* pCxt, SQuery* pQuery) { break; case QUERY_NODE_DESCRIBE_STMT: case QUERY_NODE_SHOW_CREATE_DATABASE_STMT: - case QUERY_NODE_SHOW_DB_ALIVE_STMT: - case QUERY_NODE_SHOW_CLUSTER_ALIVE_STMT: case QUERY_NODE_SHOW_CREATE_TABLE_STMT: case QUERY_NODE_SHOW_CREATE_STABLE_STMT: case QUERY_NODE_SHOW_CREATE_VIEW_STMT: diff --git a/source/libs/stream/src/streamSessionState.c b/source/libs/stream/src/streamSessionState.c index 005fd1603c..84db657392 100644 --- a/source/libs/stream/src/streamSessionState.c +++ b/source/libs/stream/src/streamSessionState.c @@ -874,9 +874,8 @@ int32_t createCountWinResultBuff(SStreamFileState* pFileState, SSessionKey* pKey void* pFileStore = getStateFileStore(pFileState); void* p = NULL; - SStreamStateCur* pCur = streamStateSessionSeekToLast_rocksdb(pFileStore, pKey->groupId); - int32_t code_file = streamStateSessionGetKVByCur_rocksdb(pCur, pWinKey, &p, pVLen); - if (code_file == TSDB_CODE_SUCCESS || isFlushedState(pFileState, endTs, 0)) { + int32_t code_file = getCountWinStateFromDisc(pFileStore, pWinKey, &p, pVLen); + if (code_file == TSDB_CODE_SUCCESS && isFlushedState(pFileState, endTs, 0)) { (*pVal) = createSessionWinBuff(pFileState, pWinKey, p, pVLen); code = code_file; qDebug("===stream===0 get state win:%" PRId64 ",%" PRId64 " from disc, res %d", pWinKey->win.skey, pWinKey->win.ekey, code_file); @@ -885,7 +884,6 @@ int32_t createCountWinResultBuff(SStreamFileState* pFileState, SSessionKey* pKey code = TSDB_CODE_FAILED; taosMemoryFree(p); } - streamStateFreeCur(pCur); goto _end; } else { (*pVal) = addNewSessionWindow(pFileState, pWinStates, pWinKey); diff --git a/source/libs/stream/src/streamState.c b/source/libs/stream/src/streamState.c index 57bc7e2d2d..550eac3ef3 100644 --- a/source/libs/stream/src/streamState.c +++ b/source/libs/stream/src/streamState.c @@ -98,8 +98,7 @@ int stateKeyCmpr(const void* pKey1, int kLen1, const void* pKey2, int kLen2) { return winKeyCmprImpl(&pWin1->key, &pWin2->key); } -SStreamState* streamStateOpen(const char* path, void* pTask, int64_t streamId, int32_t taskId, bool specPath, - int32_t szPage, int32_t pages) { +SStreamState* streamStateOpen(const char* path, void* pTask, int64_t streamId, int32_t taskId) { SStreamState* pState = taosMemoryCalloc(1, sizeof(SStreamState)); stDebug("open stream state %p, %s", pState, path); if (pState == NULL) { diff --git a/source/libs/stream/test/backendTest.cpp b/source/libs/stream/test/backendTest.cpp index e6a508f6f7..2fb257fe4e 100644 --- a/source/libs/stream/test/backendTest.cpp +++ b/source/libs/stream/test/backendTest.cpp @@ -46,7 +46,7 @@ SStreamState *stateCreate(const char *path) { SStreamMeta *pMeta = streamMetaOpen((path), NULL, NULL, NULL, 0, 0, NULL); pTask->pMeta = pMeta; - SStreamState *p = streamStateOpen((char *)path, pTask, 0, 0, true, 32, 32 * 1024); + SStreamState *p = streamStateOpen((char *)path, pTask, 0, 0); ASSERT(p != NULL); return p; } diff --git a/source/libs/wal/src/walMgmt.c b/source/libs/wal/src/walMgmt.c index 54e6abd85a..3dbaed1bc7 100644 --- a/source/libs/wal/src/walMgmt.c +++ b/source/libs/wal/src/walMgmt.c @@ -232,6 +232,12 @@ void walClose(SWal *pWal) { pWal->pRefHash = NULL; taosThreadMutexUnlock(&pWal->mutex); + if (pWal->cfg.level == TAOS_WAL_SKIP) { + wInfo("vgId:%d, remove all wals, path:%s", pWal->cfg.vgId, pWal->path); + taosRemoveDir(pWal->path); + taosMkDir(pWal->path); + } + taosRemoveRef(tsWal.refSetId, pWal->refId); } diff --git a/source/util/src/terror.c b/source/util/src/terror.c index 239090b8f4..fb2f4be487 100644 --- a/source/util/src/terror.c +++ b/source/util/src/terror.c @@ -253,6 +253,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_ENCRYPT_KEY, "The cluster has not b TAOS_DEFINE_ERROR(TSDB_CODE_MND_DB_IN_CREATING, "Database in creating status") TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_SYS_TABLENAME, "Invalid system table name") TAOS_DEFINE_ERROR(TSDB_CODE_MND_ENCRYPT_NOT_ALLOW_CHANGE, "Encryption is not allowed to be changed after database is created") +TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_WAL_LEVEL, "Invalid option, wal_level 0 should be used with replica 1") // mnode-node TAOS_DEFINE_ERROR(TSDB_CODE_MND_MNODE_ALREADY_EXIST, "Mnode already exists") diff --git a/source/util/src/version.c.in b/source/util/src/version.c.in index 2446bf9278..07bb1d42f8 100644 --- a/source/util/src/version.c.in +++ b/source/util/src/version.c.in @@ -5,3 +5,6 @@ char gitinfoOfInternal[48] = "${TD_VER_GIT_INTERNAL}"; char buildinfo[64] = "${TD_VER_OSTYPE}-${TD_VER_CPUTYPE} ${TD_VER_DATE}"; void libtaos_${TD_LIB_VER_NUMBER}_${TD_VER_OSTYPE}_${TD_VER_CPUTYPE}_${TD_VER_VERTYPE}() {}; +char* getBuildInfo(){ + return buildinfo; +} diff --git a/source/util/test/CMakeLists.txt b/source/util/test/CMakeLists.txt index 89978fd5aa..e8aabfe338 100644 --- a/source/util/test/CMakeLists.txt +++ b/source/util/test/CMakeLists.txt @@ -12,6 +12,7 @@ IF (HEADER_GTEST_INCLUDE_DIR AND (LIB_GTEST_STATIC_DIR OR LIB_GTEST_SHARED_DIR)) AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} SOURCE_LIST) LIST(REMOVE_ITEM SOURCE_LIST ${CMAKE_CURRENT_SOURCE_DIR}/trefTest.c) + LIST(REMOVE_ITEM SOURCE_LIST ${CMAKE_CURRENT_SOURCE_DIR}/terrorTest.cpp) ADD_EXECUTABLE(utilTest ${SOURCE_LIST}) TARGET_LINK_LIBRARIES(utilTest util common os gtest pthread) @@ -125,10 +126,18 @@ add_test( # COMMAND decompressTest #) -# terrorTest -add_executable(terrorTest "terrorTest.cpp") -target_link_libraries(terrorTest os util common gtest_main) -add_test( - NAME terrorTest - COMMAND terrorTest -) \ No newline at end of file +if (${TD_LINUX}) + # terrorTest + add_executable(terrorTest "terrorTest.cpp") + target_link_libraries(terrorTest os util common gtest_main) + add_test( + NAME terrorTest + COMMAND terrorTest + ) + + # config + SET(ERR_TBL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/errorCodeTable.ini) + add_custom_command(TARGET terrorTest POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${ERR_TBL_FILE} $ + ) +endif () \ No newline at end of file diff --git a/source/util/test/errorCodeTable.ini b/source/util/test/errorCodeTable.ini new file mode 100644 index 0000000000..1da1fd7d21 --- /dev/null +++ b/source/util/test/errorCodeTable.ini @@ -0,0 +1,632 @@ +TSDB_CODE_SUCCESS = 0 +TSDB_CODE_RPC_NETWORK_UNAVAIL = -2147483637 +TSDB_CODE_RPC_FQDN_ERROR = -2147483627 +TSDB_CODE_RPC_PORT_EADDRINUSE = -2147483625 +TSDB_CODE_RPC_BROKEN_LINK = -2147483624 +TSDB_CODE_RPC_TIMEOUT = -2147483623 +TSDB_CODE_RPC_SOMENODE_NOT_CONNECTED = -2147483616 +TSDB_CODE_RPC_MAX_SESSIONS = -2147483614 +TSDB_CODE_RPC_NETWORK_ERROR = -2147483613 +TSDB_CODE_RPC_NETWORK_BUSY = -2147483612 +TSDB_CODE_TIME_UNSYNCED = -2147483629 +TSDB_CODE_OPS_NOT_SUPPORT = -2147483392 +TSDB_CODE_OUT_OF_MEMORY = -2147483390 +TSDB_CODE_FILE_CORRUPTED = -2147483388 +TSDB_CODE_REF_FULL = -2147483386 +TSDB_CODE_REF_ID_REMOVED = -2147483385 +TSDB_CODE_REF_INVALID_ID = -2147483384 +TSDB_CODE_REF_ALREADY_EXIST = -2147483383 +TSDB_CODE_REF_NOT_EXIST = -2147483382 +TSDB_CODE_APP_ERROR = -2147483376 +TSDB_CODE_ACTION_IN_PROGRESS = -2147483375 +TSDB_CODE_OUT_OF_RANGE = -2147483374 +TSDB_CODE_INVALID_MSG = -2147483371 +TSDB_CODE_INVALID_MSG_LEN = -2147483370 +TSDB_CODE_INVALID_PTR = -2147483369 +TSDB_CODE_INVALID_PARA = -2147483368 +TSDB_CODE_INVALID_CFG = -2147483367 +TSDB_CODE_INVALID_OPTION = -2147483366 +TSDB_CODE_INVALID_JSON_FORMAT = -2147483365 +TSDB_CODE_INVALID_VERSION_NUMBER = -2147483364 +TSDB_CODE_INVALID_VERSION_STRING = -2147483363 +TSDB_CODE_VERSION_NOT_COMPATIBLE = -2147483362 +TSDB_CODE_CHECKSUM_ERROR = -2147483361 +TSDB_CODE_COMPRESS_ERROR = -2147483360 +TSDB_CODE_MSG_NOT_PROCESSED = -2147483359 +TSDB_CODE_CFG_NOT_FOUND = -2147483358 +TSDB_CODE_REPEAT_INIT = -2147483357 +TSDB_CODE_DUP_KEY = -2147483356 +TSDB_CODE_NEED_RETRY = -2147483355 +TSDB_CODE_OUT_OF_RPC_MEMORY_QUEUE = -2147483354 +TSDB_CODE_INVALID_TIMESTAMP = -2147483353 +TSDB_CODE_MSG_DECODE_ERROR = -2147483352 +TSDB_CODE_MSG_ENCODE_ERROR = -2147483347 +TSDB_CODE_NO_AVAIL_DISK = -2147483351 +TSDB_CODE_NOT_FOUND = -2147483350 +TSDB_CODE_NO_DISKSPACE = -2147483349 +TSDB_CODE_TIMEOUT_ERROR = -2147483348 +TSDB_CODE_NO_ENOUGH_DISKSPACE = -2147483346 +TSDB_CODE_APP_IS_STARTING = -2147483344 +TSDB_CODE_APP_IS_STOPPING = -2147483343 +TSDB_CODE_INVALID_DATA_FMT = -2147483342 +TSDB_CODE_INVALID_CFG_VALUE = -2147483341 +TSDB_CODE_IP_NOT_IN_WHITE_LIST = -2147483340 +TSDB_CODE_FAILED_TO_CONNECT_S3 = -2147483339 +TSDB_CODE_MSG_PREPROCESSED = -2147483338 +TSDB_CODE_TSC_INVALID_OPERATION = -2147483136 +TSDB_CODE_TSC_INVALID_QHANDLE = -2147483135 +TSDB_CODE_TSC_INVALID_TIME_STAMP = -2147483134 +TSDB_CODE_TSC_INVALID_VALUE = -2147483133 +TSDB_CODE_TSC_INVALID_VERSION = -2147483132 +TSDB_CODE_TSC_INVALID_IE = -2147483131 +TSDB_CODE_TSC_INVALID_FQDN = -2147483130 +TSDB_CODE_TSC_INVALID_USER_LENGTH = -2147483129 +TSDB_CODE_TSC_INVALID_PASS_LENGTH = -2147483128 +TSDB_CODE_TSC_INVALID_DB_LENGTH = -2147483127 +TSDB_CODE_TSC_INVALID_TABLE_ID_LENGTH = -2147483126 +TSDB_CODE_TSC_INVALID_CONNECTION = -2147483125 +TSDB_CODE_TSC_QUERY_CACHE_ERASED = -2147483122 +TSDB_CODE_TSC_QUERY_CANCELLED = -2147483121 +TSDB_CODE_TSC_SORTED_RES_TOO_MANY = -2147483120 +TSDB_CODE_TSC_ACTION_IN_PROGRESS = -2147483118 +TSDB_CODE_TSC_DISCONNECTED = -2147483117 +TSDB_CODE_TSC_NO_WRITE_AUTH = -2147483116 +TSDB_CODE_TSC_CONN_KILLED = -2147483115 +TSDB_CODE_TSC_SQL_SYNTAX_ERROR = -2147483114 +TSDB_CODE_TSC_DB_NOT_SELECTED = -2147483113 +TSDB_CODE_TSC_EXCEED_SQL_LIMIT = -2147483111 +TSDB_CODE_TSC_FILE_EMPTY = -2147483110 +TSDB_CODE_TSC_LINE_SYNTAX_ERROR = -2147483109 +TSDB_CODE_TSC_NO_META_CACHED = -2147483108 +TSDB_CODE_TSC_DUP_COL_NAMES = -2147483107 +TSDB_CODE_TSC_INVALID_TAG_LENGTH = -2147483106 +TSDB_CODE_TSC_INVALID_COLUMN_LENGTH = -2147483105 +TSDB_CODE_TSC_DUP_NAMES = -2147483104 +TSDB_CODE_TSC_INVALID_JSON = -2147483103 +TSDB_CODE_TSC_INVALID_JSON_TYPE = -2147483102 +TSDB_CODE_TSC_VALUE_OUT_OF_RANGE = -2147483100 +TSDB_CODE_TSC_INVALID_INPUT = -2147483095 +TSDB_CODE_TSC_STMT_API_ERROR = -2147483094 +TSDB_CODE_TSC_STMT_TBNAME_ERROR = -2147483093 +TSDB_CODE_TSC_STMT_CLAUSE_ERROR = -2147483092 +TSDB_CODE_TSC_QUERY_KILLED = -2147483091 +TSDB_CODE_TSC_NO_EXEC_NODE = -2147483090 +TSDB_CODE_TSC_NOT_STABLE_ERROR = -2147483089 +TSDB_CODE_TSC_STMT_CACHE_ERROR = -2147483088 +TSDB_CODE_TSC_ENCODE_PARAM_ERROR = -2147483087 +TSDB_CODE_TSC_ENCODE_PARAM_NULL = -2147483086 +TSDB_CODE_TSC_COMPRESS_PARAM_ERROR = -2147483085 +TSDB_CODE_TSC_COMPRESS_LEVEL_ERROR = -2147483084 +TSDB_CODE_TSC_INTERNAL_ERROR = -2147482881 +TSDB_CODE_MND_REQ_REJECTED = -2147482880 +TSDB_CODE_MND_NO_RIGHTS = -2147482877 +TSDB_CODE_MND_INVALID_SHOWOBJ = -2147482869 +TSDB_CODE_MND_INVALID_QUERY_ID = -2147482868 +TSDB_CODE_MND_INVALID_CONN_ID = -2147482866 +TSDB_CODE_MND_USER_DISABLED = -2147482859 +TSDB_CODE_MND_INVALID_PLATFORM = -2147482858 +TSDB_CODE_SDB_OBJ_ALREADY_THERE = -2147482848 +TSDB_CODE_SDB_INVALID_TABLE_TYPE = -2147482846 +TSDB_CODE_SDB_OBJ_NOT_THERE = -2147482845 +TSDB_CODE_SDB_INVALID_ACTION_TYPE = -2147482842 +TSDB_CODE_SDB_INVALID_DATA_VER = -2147482840 +TSDB_CODE_SDB_INVALID_DATA_LEN = -2147482839 +TSDB_CODE_SDB_INVALID_DATA_CONTENT = -2147482838 +TSDB_CODE_SDB_OBJ_CREATING = -2147482836 +TSDB_CODE_SDB_OBJ_DROPPING = -2147482835 +TSDB_CODE_MND_DNODE_ALREADY_EXIST = -2147482832 +TSDB_CODE_MND_DNODE_NOT_EXIST = -2147482831 +TSDB_CODE_MND_VGROUP_NOT_EXIST = -2147482830 +TSDB_CODE_MND_CANT_DROP_LEADER = -2147482829 +TSDB_CODE_MND_NO_ENOUGH_DNODES = -2147482828 +TSDB_CODE_MND_INVALID_CLUSTER_CFG = -2147482827 +TSDB_CODE_MND_VGROUP_NOT_IN_DNODE = -2147482824 +TSDB_CODE_MND_VGROUP_ALREADY_IN_DNODE = -2147482823 +TSDB_CODE_MND_INVALID_CLUSTER_ID = -2147482821 +TSDB_CODE_MND_ACCT_ALREADY_EXIST = -2147482816 +TSDB_CODE_MND_INVALID_ACCT_OPTION = -2147482814 +TSDB_CODE_MND_ACCT_EXPIRED = -2147482813 +TSDB_CODE_MND_ACCT_NOT_EXIST = -2147482812 +TSDB_CODE_MND_TOO_MANY_ACCTS = -2147482811 +TSDB_CODE_MND_USER_ALREADY_EXIST = -2147482800 +TSDB_CODE_MND_USER_NOT_EXIST = -2147482799 +TSDB_CODE_MND_INVALID_USER_FORMAT = -2147482798 +TSDB_CODE_MND_USER_NOT_AVAILABLE = -2147482792 +TSDB_CODE_MND_INVALID_PASS_FORMAT = -2147482797 +TSDB_CODE_MND_NO_USER_FROM_CONN = -2147482796 +TSDB_CODE_MND_TOO_MANY_USERS = -2147482795 +TSDB_CODE_MND_INVALID_ALTER_OPER = -2147482794 +TSDB_CODE_MND_AUTH_FAILURE = -2147482793 +TSDB_CODE_MND_PRIVILEDGE_EXIST = -2147482791 +TSDB_CODE_MND_USER_HOST_EXIST = -2147482790 +TSDB_CODE_MND_USER_HOST_NOT_EXIST = -2147482789 +TSDB_CODE_MND_TOO_MANY_USER_HOST = -2147482788 +TSDB_CODE_MND_USER_LOCAL_HOST_NOT_DROP = -2147482787 +TSDB_CODE_MND_STB_ALREADY_EXIST = -2147482784 +TSDB_CODE_MND_STB_NOT_EXIST = -2147482782 +TSDB_CODE_MND_TOO_MANY_TAGS = -2147482780 +TSDB_CODE_MND_TOO_MANY_COLUMNS = -2147482779 +TSDB_CODE_MND_TAG_ALREADY_EXIST = -2147482775 +TSDB_CODE_MND_TAG_NOT_EXIST = -2147482774 +TSDB_CODE_MND_COLUMN_ALREADY_EXIST = -2147482773 +TSDB_CODE_MND_COLUMN_NOT_EXIST = -2147482772 +TSDB_CODE_MND_INVALID_STB_OPTION = -2147482770 +TSDB_CODE_MND_INVALID_ROW_BYTES = -2147482769 +TSDB_CODE_MND_FIELD_VALUE_OVERFLOW = -2147482768 +TSDB_CODE_MND_COLUMN_COMPRESS_ALREADY_EXIST = -2147482632 +TSDB_CODE_MND_INVALID_FUNC_NAME = -2147482768 +TSDB_CODE_MND_INVALID_FUNC_CODE = -2147482766 +TSDB_CODE_MND_FUNC_ALREADY_EXIST = -2147482765 +TSDB_CODE_MND_FUNC_NOT_EXIST = -2147482764 +TSDB_CODE_MND_INVALID_FUNC_BUFSIZE = -2147482763 +TSDB_CODE_MND_INVALID_FUNC_COMMENT = -2147482760 +TSDB_CODE_MND_INVALID_FUNC_RETRIEVE = -2147482759 +TSDB_CODE_MND_TAG_INDEX_ALREADY_EXIST = -2147482493 +TSDB_CODE_MND_TAG_INDEX_NOT_EXIST = -2147482492 +TSDB_CODE_MND_DB_NOT_SELECTED = -2147482752 +TSDB_CODE_MND_DB_ALREADY_EXIST = -2147482751 +TSDB_CODE_MND_INVALID_DB_OPTION = -2147482750 +TSDB_CODE_MND_INVALID_DB = -2147482749 +TSDB_CODE_MND_TOO_MANY_DATABASES = -2147482747 +TSDB_CODE_MND_DB_IN_DROPPING = -2147482746 +TSDB_CODE_MND_DB_NOT_EXIST = -2147482744 +TSDB_CODE_MND_INVALID_DB_ACCT = -2147482743 +TSDB_CODE_MND_DB_OPTION_UNCHANGED = -2147482742 +TSDB_CODE_MND_DB_INDEX_NOT_EXIST = -2147482741 +TSDB_CODE_MND_DB_RETENTION_PERIOD_ZERO = -2147482740 +TSDB_CODE_MND_INVALID_ENCRYPT_KEY = -2147482738 +TSDB_CODE_MND_DB_IN_CREATING = -2147482730 +TSDB_CODE_MND_INVALID_SYS_TABLENAME = -2147482726 +TSDB_CODE_MND_ENCRYPT_NOT_ALLOW_CHANGE = -2147482725 +TSDB_CODE_MND_MNODE_ALREADY_EXIST = -2147482720 +TSDB_CODE_MND_MNODE_NOT_EXIST = -2147482719 +TSDB_CODE_MND_QNODE_ALREADY_EXIST = -2147482718 +TSDB_CODE_MND_QNODE_NOT_EXIST = -2147482717 +TSDB_CODE_MND_SNODE_ALREADY_EXIST = -2147482716 +TSDB_CODE_MND_SNODE_NOT_EXIST = -2147482715 +TSDB_CODE_MND_TOO_FEW_MNODES = -2147482712 +TSDB_CODE_MND_TOO_MANY_MNODES = -2147482711 +TSDB_CODE_MND_ARBGROUP_ALREADY_EXIST = -2147482710 +TSDB_CODE_MND_ARBGROUP_NOT_EXIST = -2147482709 +TSDB_CODE_MND_ARB_TOKEN_MISMATCH = -2147482708 +TSDB_CODE_MND_TOO_MANY_DNODES = -2147482704 +TSDB_CODE_MND_NO_ENOUGH_MEM_IN_DNODE = -2147482703 +TSDB_CODE_MND_INVALID_DNODE_CFG = -2147482702 +TSDB_CODE_MND_INVALID_DNODE_EP = -2147482701 +TSDB_CODE_MND_INVALID_DNODE_ID = -2147482700 +TSDB_CODE_MND_VGROUP_UN_CHANGED = -2147482699 +TSDB_CODE_MND_HAS_OFFLINE_DNODE = -2147482698 +TSDB_CODE_MND_INVALID_REPLICA = -2147482697 +TSDB_CODE_MND_NO_ENOUGH_VNODES = -2147482694 +TSDB_CODE_MND_NAME_CONFLICT_WITH_TOPIC = -2147482688 +TSDB_CODE_MND_TOO_MANY_STBS = -2147482687 +TSDB_CODE_MND_INVALID_STB_ALTER_OPTION = -2147482686 +TSDB_CODE_MND_STB_OPTION_UNCHNAGED = -2147482685 +TSDB_CODE_MND_FIELD_CONFLICT_WITH_TOPIC = -2147482684 +TSDB_CODE_MND_SINGLE_STB_MODE_DB = -2147482683 +TSDB_CODE_MND_INVALID_SCHEMA_VER = -2147482682 +TSDB_CODE_MND_STABLE_UID_NOT_MATCH = -2147482681 +TSDB_CODE_MND_FIELD_CONFLICT_WITH_TSMA = -2147482680 +TSDB_CODE_MND_DNODE_IN_CREATING = -2147482696 +TSDB_CODE_MND_DNODE_IN_DROPPING = -2147482695 +TSDB_CODE_MND_TRANS_ALREADY_EXIST = -2147482672 +TSDB_CODE_MND_TRANS_NOT_EXIST = -2147482671 +TSDB_CODE_MND_TRANS_INVALID_STAGE = -2147482670 +TSDB_CODE_MND_TRANS_CONFLICT = -2147482669 +TSDB_CODE_MND_TRANS_CLOG_IS_NULL = -2147482668 +TSDB_CODE_MND_TRANS_NETWORK_UNAVAILL = -2147482667 +TSDB_CODE_MND_LAST_TRANS_NOT_FINISHED = -2147482666 +TSDB_CODE_MND_TRANS_SYNC_TIMEOUT = -2147482665 +TSDB_CODE_MND_TRANS_CTX_SWITCH = -2147482664 +TSDB_CODE_MND_TRANS_UNKNOW_ERROR = -2147482657 +TSDB_CODE_MND_TOPIC_ALREADY_EXIST = -2147482656 +TSDB_CODE_MND_TOPIC_NOT_EXIST = -2147482655 +TSDB_CODE_MND_TOO_MANY_TOPICS = -2147482654 +TSDB_CODE_MND_INVALID_TOPIC = -2147482653 +TSDB_CODE_MND_INVALID_TOPIC_QUERY = -2147482652 +TSDB_CODE_MND_INVALID_TOPIC_OPTION = -2147482651 +TSDB_CODE_MND_CONSUMER_NOT_EXIST = -2147482650 +TSDB_CODE_MND_TOPIC_OPTION_UNCHNAGED = -2147482649 +TSDB_CODE_MND_SUBSCRIBE_NOT_EXIST = -2147482648 +TSDB_CODE_MND_OFFSET_NOT_EXIST = -2147482647 +TSDB_CODE_MND_CONSUMER_NOT_READY = -2147482646 +TSDB_CODE_MND_TOPIC_SUBSCRIBED = -2147482645 +TSDB_CODE_MND_CGROUP_USED = -2147482644 +TSDB_CODE_MND_TOPIC_MUST_BE_DELETED = -2147482643 +TSDB_CODE_MND_INVALID_SUB_OPTION = -2147482642 +TSDB_CODE_MND_IN_REBALANCE = -2147482641 +TSDB_CODE_MND_STREAM_ALREADY_EXIST = -2147482640 +TSDB_CODE_MND_STREAM_NOT_EXIST = -2147482639 +TSDB_CODE_MND_INVALID_STREAM_OPTION = -2147482638 +TSDB_CODE_MND_STREAM_MUST_BE_DELETED = -2147482637 +TSDB_CODE_MND_MULTI_REPLICA_SOURCE_DB = -2147482635 +TSDB_CODE_MND_TOO_MANY_STREAMS = -2147482634 +TSDB_CODE_MND_INVALID_TARGET_TABLE = -2147482633 +TSDB_CODE_MND_SMA_ALREADY_EXIST = -2147482496 +TSDB_CODE_MND_SMA_NOT_EXIST = -2147482495 +TSDB_CODE_MND_INVALID_SMA_OPTION = -2147482494 +TSDB_CODE_MND_INVALID_DROP_TSMA = -2147482491 +TSDB_CODE_MND_MAX_TSMA_NUM_EXCEEDED = -2147482490 +TSDB_CODE_MND_VIEW_ALREADY_EXIST = -2147482464 +TSDB_CODE_MND_VIEW_NOT_EXIST = -2147482463 +TSDB_CODE_MND_INVALID_COMPACT_ID = -2147482447 +TSDB_CODE_MND_COMPACT_DETAIL_NOT_EXIST = -2147482446 +TSDB_CODE_DNODE_OFFLINE = -2147482616 +TSDB_CODE_MNODE_NOT_FOUND = -2147482614 +TSDB_CODE_MNODE_ALREADY_DEPLOYED = -2147482615 +TSDB_CODE_MNODE_NOT_DEPLOYED = -2147482613 +TSDB_CODE_QNODE_NOT_FOUND = -2147482611 +TSDB_CODE_QNODE_ALREADY_DEPLOYED = -2147482612 +TSDB_CODE_QNODE_NOT_DEPLOYED = -2147482610 +TSDB_CODE_SNODE_NOT_FOUND = -2147482608 +TSDB_CODE_SNODE_ALREADY_DEPLOYED = -2147482609 +TSDB_CODE_SNODE_NOT_DEPLOYED = -2147482607 +TSDB_CODE_MNODE_NOT_CATCH_UP = -2147482606 +TSDB_CODE_MNODE_ALREADY_IS_VOTER = -2147482605 +TSDB_CODE_MNODE_ONLY_TWO_MNODE = -2147482604 +TSDB_CODE_MNODE_NO_NEED_RESTORE = -2147482603 +TSDB_CODE_DNODE_ONLY_USE_WHEN_OFFLINE = -2147482602 +TSDB_CODE_DNODE_NO_MACHINE_CODE = -2147482601 +TSDB_CODE_DNODE_NO_ENCRYPT_KEY = -2147482600 +TSDB_CODE_DNODE_INVALID_ENCRYPT_CONFIG = -2147482599 +TSDB_CODE_DNODE_INVALID_ENCRYPTKEY = -2147482592 +TSDB_CODE_DNODE_ENCRYPTKEY_CHANGED = -2147482591 +TSDB_CODE_DNODE_INVALID_ENCRYPT_KLEN = -2147482590 +TSDB_CODE_DNODE_INVALID_STATUS_INTERVAL = -2147482589 +TSDB_CODE_DNODE_INVALID_TIMEZONE = -2147482588 +TSDB_CODE_DNODE_INVALID_CHARSET = -2147482587 +TSDB_CODE_DNODE_INVALID_LOCALE = -2147482586 +TSDB_CODE_DNODE_INVALID_TTL_CHG_ON_WR = -2147482585 +TSDB_CODE_DNODE_INVALID_EN_WHITELIST = -2147482584 +TSDB_CODE_VND_INVALID_VGROUP_ID = -2147482365 +TSDB_CODE_VND_INIT_FAILED = -2147482364 +TSDB_CODE_VND_NO_WRITE_AUTH = -2147482350 +TSDB_CODE_VND_NOT_EXIST = -2147482336 +TSDB_CODE_VND_ALREADY_EXIST = -2147482335 +TSDB_CODE_VND_HASH_MISMATCH = -2147482334 +TSDB_CODE_VND_INVALID_TABLE_ACTION = -2147482332 +TSDB_CODE_VND_COL_ALREADY_EXISTS = -2147482331 +TSDB_CODE_VND_COL_NOT_EXISTS = -2147482330 +TSDB_CODE_VND_COL_SUBSCRIBED = -2147482329 +TSDB_CODE_VND_NO_AVAIL_BUFPOOL = -2147482328 +TSDB_CODE_VND_STOPPED = -2147482327 +TSDB_CODE_VND_DUP_REQUEST = -2147482320 +TSDB_CODE_VND_QUERY_BUSY = -2147482319 +TSDB_CODE_VND_NOT_CATCH_UP = -2147482318 +TSDB_CODE_VND_ALREADY_IS_VOTER = -2147482317 +TSDB_CODE_VND_DIR_ALREADY_EXIST = -2147482316 +TSDB_CODE_VND_META_DATA_UNSAFE_DELETE = -2147482315 +TSDB_CODE_VND_ARB_NOT_SYNCED = -2147482314 +TSDB_CODE_VND_COLUMN_COMPRESS_ALREADY_EXIST = -2147482314 +TSDB_CODE_TDB_INVALID_TABLE_ID = -2147482112 +TSDB_CODE_TDB_INVALID_TABLE_TYPE = -2147482111 +TSDB_CODE_TDB_IVD_TB_SCHEMA_VERSION = -2147482110 +TSDB_CODE_TDB_TABLE_ALREADY_EXIST = -2147482109 +TSDB_CODE_TDB_INVALID_CONFIG = -2147482108 +TSDB_CODE_TDB_INIT_FAILED = -2147482107 +TSDB_CODE_TDB_NO_DISK_PERMISSIONS = -2147482105 +TSDB_CODE_TDB_TAG_VER_OUT_OF_DATE = -2147482102 +TSDB_CODE_TDB_TIMESTAMP_OUT_OF_RANGE = -2147482101 +TSDB_CODE_TDB_SUBMIT_MSG_MSSED_UP = -2147482100 +TSDB_CODE_TDB_INVALID_ACTION = -2147482099 +TSDB_CODE_TDB_INVALID_CREATE_TB_MSG = -2147482098 +TSDB_CODE_TDB_NO_TABLE_DATA_IN_MEM = -2147482097 +TSDB_CODE_TDB_FILE_ALREADY_EXISTS = -2147482096 +TSDB_CODE_TDB_TABLE_RECONFIGURE = -2147482095 +TSDB_CODE_TDB_IVD_CREATE_TABLE_INFO = -2147482094 +TSDB_CODE_TDB_NO_AVAIL_DISK = -2147482093 +TSDB_CODE_TDB_MESSED_MSG = -2147482092 +TSDB_CODE_TDB_IVLD_TAG_VAL = -2147482091 +TSDB_CODE_TDB_NO_CACHE_LAST_ROW = -2147482090 +TSDB_CODE_TDB_TABLE_NOT_EXIST = -2147482088 +TSDB_CODE_TDB_STB_ALREADY_EXIST = -2147482087 +TSDB_CODE_TDB_STB_NOT_EXIST = -2147482086 +TSDB_CODE_TDB_INVALID_TABLE_SCHEMA_VER = -2147482085 +TSDB_CODE_TDB_TDB_ENV_OPEN_ERROR = -2147482084 +TSDB_CODE_TDB_TABLE_IN_OTHER_STABLE = -2147482083 +TSDB_CODE_QRY_INVALID_QHANDLE = -2147481856 +TSDB_CODE_QRY_INVALID_MSG = -2147481855 +TSDB_CODE_QRY_DUP_JOIN_KEY = -2147481851 +TSDB_CODE_QRY_EXCEED_TAGS_LIMIT = -2147481850 +TSDB_CODE_QRY_NOT_READY = -2147481849 +TSDB_CODE_QRY_HAS_RSP = -2147481848 +TSDB_CODE_QRY_IN_EXEC = -2147481847 +TSDB_CODE_QRY_TOO_MANY_TIMEWINDOW = -2147481846 +TSDB_CODE_QRY_NOT_ENOUGH_BUFFER = -2147481845 +TSDB_CODE_QRY_INCONSISTAN = -2147481844 +TSDB_CODE_QRY_SYS_ERROR = -2147481843 +TSDB_CODE_QRY_INVALID_TIME_CONDITION = -2147481842 +TSDB_CODE_QRY_INVALID_INPUT = -2147481841 +TSDB_CODE_QRY_SCH_NOT_EXIST = -2147481824 +TSDB_CODE_QRY_TASK_NOT_EXIST = -2147481823 +TSDB_CODE_QRY_TASK_ALREADY_EXIST = -2147481822 +TSDB_CODE_QRY_TASK_CTX_NOT_EXIST = -2147481821 +TSDB_CODE_QRY_TASK_CANCELLED = -2147481820 +TSDB_CODE_QRY_TASK_DROPPED = -2147481819 +TSDB_CODE_QRY_TASK_CANCELLING = -2147481818 +TSDB_CODE_QRY_TASK_DROPPING = -2147481817 +TSDB_CODE_QRY_DUPLICATED_OPERATION = -2147481816 +TSDB_CODE_QRY_TASK_MSG_ERROR = -2147481815 +TSDB_CODE_QRY_JOB_FREED = -2147481814 +TSDB_CODE_QRY_TASK_STATUS_ERROR = -2147481813 +TSDB_CODE_QRY_JSON_IN_ERROR = -2147481812 +TSDB_CODE_QRY_JSON_NOT_SUPPORT_ERROR = -2147481811 +TSDB_CODE_QRY_JSON_IN_GROUP_ERROR = -2147481810 +TSDB_CODE_QRY_JOB_NOT_EXIST = -2147481809 +TSDB_CODE_QRY_QWORKER_QUIT = -2147481808 +TSDB_CODE_QRY_GEO_NOT_SUPPORT_ERROR = -2147481807 +TSDB_CODE_QRY_INVALID_WINDOW_CONDITION = -2147481838 +TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR = -2147481806 +TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR = -2147481806 +TSDB_CODE_QRY_INVALID_JOIN_CONDITION = -2147481805 +TSDB_CODE_GRANT_EXPIRED = -2147481600 +TSDB_CODE_GRANT_DNODE_LIMITED = -2147481599 +TSDB_CODE_GRANT_ACCT_LIMITED = -2147481598 +TSDB_CODE_GRANT_TIMESERIES_LIMITED = -2147481597 +TSDB_CODE_GRANT_DB_LIMITED = -2147481596 +TSDB_CODE_GRANT_USER_LIMITED = -2147481595 +TSDB_CODE_GRANT_CONN_LIMITED = -2147481594 +TSDB_CODE_GRANT_STREAM_LIMITED = -2147481593 +TSDB_CODE_GRANT_SPEED_LIMITED = -2147481592 +TSDB_CODE_GRANT_STORAGE_LIMITED = -2147481591 +TSDB_CODE_GRANT_SUBSCRIPTION_LIMITED = -2147481590 +TSDB_CODE_GRANT_CPU_LIMITED = -2147481589 +TSDB_CODE_GRANT_STABLE_LIMITED = -2147481588 +TSDB_CODE_GRANT_TABLE_LIMITED = -2147481587 +TSDB_CODE_GRANT_PAR_IVLD_ACTIVE = -2147481586 +TSDB_CODE_GRANT_PAR_IVLD_KEY = -2147481585 +TSDB_CODE_GRANT_PAR_DEC_IVLD_KEY = -2147481584 +TSDB_CODE_GRANT_PAR_DEC_IVLD_KLEN = -2147481583 +TSDB_CODE_GRANT_GEN_IVLD_KEY = -2147481582 +TSDB_CODE_GRANT_GEN_ACTIVE_LEN = -2147481581 +TSDB_CODE_GRANT_GEN_ENC_IVLD_KLEN = -2147481580 +TSDB_CODE_GRANT_PAR_IVLD_DIST = -2147481579 +TSDB_CODE_GRANT_UNLICENSED_CLUSTER = -2147481578 +TSDB_CODE_GRANT_LACK_OF_BASIC = -2147481577 +TSDB_CODE_GRANT_OBJ_NOT_EXIST = -2147481576 +TSDB_CODE_GRANT_LAST_ACTIVE_NOT_FOUND = -2147481575 +TSDB_CODE_GRANT_MACHINES_MISMATCH = -2147481568 +TSDB_CODE_GRANT_OPT_EXPIRE_TOO_LARGE = -2147481567 +TSDB_CODE_GRANT_DUPLICATED_ACTIVE = -2147481566 +TSDB_CODE_GRANT_VIEW_LIMITED = -2147481565 +TSDB_CODE_GRANT_BASIC_EXPIRED = -2147481564 +TSDB_CODE_GRANT_STREAM_EXPIRED = -2147481563 +TSDB_CODE_GRANT_SUBSCRIPTION_EXPIRED = -2147481562 +TSDB_CODE_GRANT_VIEW_EXPIRED = -2147481561 +TSDB_CODE_GRANT_AUDIT_EXPIRED = -2147481560 +TSDB_CODE_GRANT_CSV_EXPIRED = -2147481559 +TSDB_CODE_GRANT_MULTI_STORAGE_EXPIRED = -2147481558 +TSDB_CODE_GRANT_OBJECT_STROAGE_EXPIRED = -2147481557 +TSDB_CODE_GRANT_DUAL_REPLICA_HA_EXPIRED = -2147481556 +TSDB_CODE_GRANT_DB_ENCRYPTION_EXPIRED = -2147481555 +TSDB_CODE_SYN_TIMEOUT = -2147481341 +TSDB_CODE_SYN_MISMATCHED_SIGNATURE = -2147481337 +TSDB_CODE_SYN_NOT_LEADER = -2147481332 +TSDB_CODE_SYN_NEW_CONFIG_ERROR = -2147481329 +TSDB_CODE_SYN_PROPOSE_NOT_READY = -2147481327 +TSDB_CODE_SYN_RESTORING = -2147481324 +TSDB_CODE_SYN_INVALID_SNAPSHOT_MSG = -2147481323 +TSDB_CODE_SYN_BUFFER_FULL = -2147481322 +TSDB_CODE_SYN_WRITE_STALL = -2147481321 +TSDB_CODE_SYN_NEGOTIATION_WIN_FULL = -2147481320 +TSDB_CODE_SYN_INTERNAL_ERROR = -2147481089 +TSDB_CODE_TQ_INVALID_CONFIG = -2147481088 +TSDB_CODE_TQ_INIT_FAILED = -2147481087 +TSDB_CODE_TQ_NO_DISK_PERMISSIONS = -2147481085 +TSDB_CODE_TQ_FILE_ALREADY_EXISTS = -2147481082 +TSDB_CODE_TQ_FAILED_TO_CREATE_DIR = -2147481081 +TSDB_CODE_TQ_META_NO_SUCH_KEY = -2147481080 +TSDB_CODE_TQ_META_KEY_NOT_IN_TXN = -2147481079 +TSDB_CODE_TQ_META_KEY_DUP_IN_TXN = -2147481078 +TSDB_CODE_TQ_GROUP_NOT_SET = -2147481077 +TSDB_CODE_TQ_TABLE_SCHEMA_NOT_FOUND = -2147481076 +TSDB_CODE_TQ_NO_COMMITTED_OFFSET = -2147481075 +TSDB_CODE_WAL_FILE_CORRUPTED = -2147479551 +TSDB_CODE_WAL_INVALID_VER = -2147479549 +TSDB_CODE_WAL_LOG_NOT_EXIST = -2147479547 +TSDB_CODE_WAL_CHKSUM_MISMATCH = -2147479546 +TSDB_CODE_WAL_LOG_INCOMPLETE = -2147479545 +TSDB_CODE_FS_INVLD_CFG = -2147474943 +TSDB_CODE_FS_TOO_MANY_MOUNT = -2147474942 +TSDB_CODE_FS_DUP_PRIMARY = -2147474941 +TSDB_CODE_FS_NO_PRIMARY_DISK = -2147474940 +TSDB_CODE_FS_NO_MOUNT_AT_TIER = -2147474939 +TSDB_CODE_FS_FILE_ALREADY_EXISTS = -2147474938 +TSDB_CODE_FS_INVLD_LEVEL = -2147474937 +TSDB_CODE_FS_NO_VALID_DISK = -2147474936 +TSDB_CODE_CTG_INTERNAL_ERROR = -2147474432 +TSDB_CODE_CTG_INVALID_INPUT = -2147474431 +TSDB_CODE_CTG_NOT_READY = -2147474430 +TSDB_CODE_CTG_SYS_ERROR = -2147474429 +TSDB_CODE_CTG_DB_DROPPED = -2147474428 +TSDB_CODE_CTG_OUT_OF_SERVICE = -2147474427 +TSDB_CODE_CTG_VG_META_MISMATCH = -2147474426 +TSDB_CODE_CTG_EXIT = -2147474425 +TSDB_CODE_QW_MSG_ERROR = -2147474096 +TSDB_CODE_SCH_STATUS_ERROR = -2147474175 +TSDB_CODE_SCH_INTERNAL_ERROR = -2147474174 +TSDB_CODE_SCH_TIMEOUT_ERROR = -2147474172 +TSDB_CODE_SCH_JOB_IS_DROPPING = -2147474171 +TSDB_CODE_SCH_JOB_NOT_EXISTS = -2147474170 +TSDB_CODE_PAR_SYNTAX_ERROR = -2147473920 +TSDB_CODE_PAR_INCOMPLETE_SQL = -2147473919 +TSDB_CODE_PAR_INVALID_COLUMN = -2147473918 +TSDB_CODE_PAR_TABLE_NOT_EXIST = -2147473917 +TSDB_CODE_PAR_AMBIGUOUS_COLUMN = -2147473916 +TSDB_CODE_PAR_WRONG_VALUE_TYPE = -2147473915 +TSDB_CODE_PAR_ILLEGAL_USE_AGG_FUNCTION = -2147473912 +TSDB_CODE_PAR_WRONG_NUMBER_OF_SELECT = -2147473911 +TSDB_CODE_PAR_GROUPBY_LACK_EXPRESSION = -2147473910 +TSDB_CODE_PAR_NOT_SELECTED_EXPRESSION = -2147473909 +TSDB_CODE_PAR_NOT_SINGLE_GROUP = -2147473908 +TSDB_CODE_PAR_TAGS_NOT_MATCHED = -2147473907 +TSDB_CODE_PAR_INVALID_TAG_NAME = -2147473906 +TSDB_CODE_PAR_NAME_OR_PASSWD_TOO_LONG = -2147473904 +TSDB_CODE_PAR_PASSWD_EMPTY = -2147473903 +TSDB_CODE_PAR_INVALID_PORT = -2147473902 +TSDB_CODE_PAR_INVALID_ENDPOINT = -2147473901 +TSDB_CODE_PAR_EXPRIE_STATEMENT = -2147473900 +TSDB_CODE_PAR_INTER_VALUE_TOO_SMALL = -2147473899 +TSDB_CODE_PAR_INTER_VALUE_TOO_BIG = -2147473893 +TSDB_CODE_PAR_DB_NOT_SPECIFIED = -2147473898 +TSDB_CODE_PAR_INVALID_IDENTIFIER_NAME = -2147473897 +TSDB_CODE_PAR_CORRESPONDING_STABLE_ERR = -2147473896 +TSDB_CODE_PAR_INVALID_DB_OPTION = -2147473895 +TSDB_CODE_PAR_INVALID_TABLE_OPTION = -2147473894 +TSDB_CODE_PAR_GROUPBY_WINDOW_COEXIST = -2147473884 +TSDB_CODE_PAR_AGG_FUNC_NESTING = -2147473881 +TSDB_CODE_PAR_INVALID_STATE_WIN_TYPE = -2147473880 +TSDB_CODE_PAR_INVALID_STATE_WIN_COL = -2147473879 +TSDB_CODE_PAR_INVALID_STATE_WIN_TABLE = -2147473878 +TSDB_CODE_PAR_INTER_SESSION_GAP = -2147473877 +TSDB_CODE_PAR_INTER_SESSION_COL = -2147473876 +TSDB_CODE_PAR_INTER_OFFSET_NEGATIVE = -2147473875 +TSDB_CODE_PAR_INTER_OFFSET_UNIT = -2147473874 +TSDB_CODE_PAR_INTER_OFFSET_TOO_BIG = -2147473873 +TSDB_CODE_PAR_INTER_SLIDING_UNIT = -2147473872 +TSDB_CODE_PAR_INTER_SLIDING_TOO_BIG = -2147473871 +TSDB_CODE_PAR_INTER_SLIDING_TOO_SMALL = -2147473870 +TSDB_CODE_PAR_ONLY_ONE_JSON_TAG = -2147473869 +TSDB_CODE_PAR_INCORRECT_NUM_OF_COL = -2147473868 +TSDB_CODE_PAR_INCORRECT_TIMESTAMP_VAL = -2147473867 +TSDB_CODE_PAR_OFFSET_LESS_ZERO = -2147473865 +TSDB_CODE_PAR_SLIMIT_LEAK_PARTITION_GROUP_BY = -2147473864 +TSDB_CODE_PAR_INVALID_TOPIC_QUERY = -2147473863 +TSDB_CODE_PAR_INVALID_DROP_STABLE = -2147473862 +TSDB_CODE_PAR_INVALID_FILL_TIME_RANGE = -2147473861 +TSDB_CODE_PAR_DUPLICATED_COLUMN = -2147473860 +TSDB_CODE_PAR_INVALID_TAGS_LENGTH = -2147473859 +TSDB_CODE_PAR_INVALID_ROW_LENGTH = -2147473858 +TSDB_CODE_PAR_INVALID_COLUMNS_NUM = -2147473857 +TSDB_CODE_PAR_TOO_MANY_COLUMNS = -2147473856 +TSDB_CODE_PAR_INVALID_FIRST_COLUMN = -2147473855 +TSDB_CODE_PAR_INVALID_VAR_COLUMN_LEN = -2147473854 +TSDB_CODE_PAR_INVALID_TAGS_NUM = -2147473853 +TSDB_CODE_PAR_PERMISSION_DENIED = -2147473852 +TSDB_CODE_PAR_INVALID_STREAM_QUERY = -2147473851 +TSDB_CODE_PAR_INVALID_INTERNAL_PK = -2147473850 +TSDB_CODE_PAR_INVALID_TIMELINE_FUNC = -2147473849 +TSDB_CODE_PAR_INVALID_PASSWD = -2147473848 +TSDB_CODE_PAR_INVALID_ALTER_TABLE = -2147473847 +TSDB_CODE_PAR_CANNOT_DROP_PRIMARY_KEY = -2147473846 +TSDB_CODE_PAR_INVALID_MODIFY_COL = -2147473845 +TSDB_CODE_PAR_INVALID_TBNAME = -2147473844 +TSDB_CODE_PAR_INVALID_FUNCTION_NAME = -2147473843 +TSDB_CODE_PAR_COMMENT_TOO_LONG = -2147473842 +TSDB_CODE_PAR_NOT_ALLOWED_FUNC = -2147473841 +TSDB_CODE_PAR_NOT_ALLOWED_WIN_QUERY = -2147473840 +TSDB_CODE_PAR_INVALID_DROP_COL = -2147473839 +TSDB_CODE_PAR_INVALID_COL_JSON = -2147473838 +TSDB_CODE_PAR_VALUE_TOO_LONG = -2147473837 +TSDB_CODE_PAR_INVALID_DELETE_WHERE = -2147473835 +TSDB_CODE_PAR_INVALID_REDISTRIBUTE_VG = -2147473834 +TSDB_CODE_PAR_FILL_NOT_ALLOWED_FUNC = -2147473833 +TSDB_CODE_PAR_INVALID_WINDOW_PC = -2147473832 +TSDB_CODE_PAR_WINDOW_NOT_ALLOWED_FUNC = -2147473831 +TSDB_CODE_PAR_STREAM_NOT_ALLOWED_FUNC = -2147473830 +TSDB_CODE_PAR_GROUP_BY_NOT_ALLOWED_FUNC = -2147473829 +TSDB_CODE_PAR_INVALID_INTERP_CLAUSE = -2147473827 +TSDB_CODE_PAR_NO_VALID_FUNC_IN_WIN = -2147473826 +TSDB_CODE_PAR_ONLY_SUPPORT_SINGLE_TABLE = -2147473825 +TSDB_CODE_PAR_INVALID_SMA_INDEX = -2147473824 +TSDB_CODE_PAR_INVALID_SELECTED_EXPR = -2147473823 +TSDB_CODE_PAR_GET_META_ERROR = -2147473822 +TSDB_CODE_PAR_NOT_UNIQUE_TABLE_ALIAS = -2147473821 +TSDB_CODE_PAR_SYSTABLE_NOT_ALLOWED_FUNC = -2147473816 +TSDB_CODE_PAR_SYSTABLE_NOT_ALLOWED = -2147473815 +TSDB_CODE_PAR_INVALID_VARBINARY = -2147473814 +TSDB_CODE_PAR_INVALID_IP_RANGE = -2147473813 +TSDB_CODE_PAR_INVALID_STREAM_QUERY = -2147473851 +TSDB_CODE_PAR_INVALID_VIEW_QUERY = -2147473812 +TSDB_CODE_PAR_COL_QUERY_MISMATCH = -2147473811 +TSDB_CODE_PAR_VIEW_CONFLICT_WITH_TABLE = -2147473810 +TSDB_CODE_PAR_NOT_SUPPORT_MULTI_RESULT = -2147473808 +TSDB_CODE_PAR_INVALID_WJOIN_HAVING_EXPR = -2147473806 +TSDB_CODE_PAR_GRP_WINDOW_NOT_ALLOWED = -2147473807 +TSDB_CODE_PAR_INVALID_WIN_OFFSET_UNIT = -2147473805 +TSDB_CODE_PAR_VALID_PRIM_TS_REQUIRED = -2147473804 +TSDB_CODE_PAR_ORDERBY_UNKNOWN_EXPR = -2147473803 +TSDB_CODE_PAR_NOT_WIN_FUNC = -2147473802 +TSDB_CODE_PAR_TAG_IS_PRIMARY_KEY = -2147473801 +TSDB_CODE_PAR_SECOND_COL_PK = -2147473800 +TSDB_CODE_PAR_COL_PK_TYPE = -2147473799 +TSDB_CODE_PAR_INVALID_PK_OP = -2147473798 +TSDB_CODE_PAR_PRIMARY_KEY_IS_NULL = -2147473797 +TSDB_CODE_PAR_PRIMARY_KEY_IS_NONE = -2147473796 +TSDB_CODE_PAR_INTERNAL_ERROR = -2147473665 +TSDB_CODE_PLAN_INTERNAL_ERROR = -2147473664 +TSDB_CODE_PLAN_EXPECTED_TS_EQUAL = -2147473663 +TSDB_CODE_PLAN_NOT_SUPPORT_CROSS_JOIN = -2147473662 +TSDB_CODE_PLAN_NOT_SUPPORT_JOIN_COND = -2147473661 +TSDB_CODE_FUNC_FUNTION_ERROR = -2147473408 +TSDB_CODE_FUNC_FUNTION_PARA_NUM = -2147473407 +TSDB_CODE_FUNC_FUNTION_PARA_TYPE = -2147473406 +TSDB_CODE_FUNC_FUNTION_PARA_VALUE = -2147473405 +TSDB_CODE_FUNC_NOT_BUILTIN_FUNTION = -2147473404 +TSDB_CODE_FUNC_DUP_TIMESTAMP = -2147473403 +TSDB_CODE_FUNC_TO_TIMESTAMP_FAILED_FORMAT_ERR = -2147473402 +TSDB_CODE_FUNC_TO_TIMESTAMP_FAILED_TS_ERR = -2147473401 +TSDB_CODE_FUNC_TO_TIMESTAMP_FAILED_NOT_SUPPORTED = -2147473400 +TSDB_CODE_FUNC_TO_CHAR_NOT_SUPPORTED = -2147473399 +TSDB_CODE_UDF_STOPPING = -2147473151 +TSDB_CODE_UDF_PIPE_READ_ERR = -2147473150 +TSDB_CODE_UDF_PIPE_CONNECT_ERR = -2147473149 +TSDB_CODE_UDF_PIPE_NOT_EXIST = -2147473148 +TSDB_CODE_UDF_LOAD_UDF_FAILURE = -2147473147 +TSDB_CODE_UDF_INVALID_INPUT = -2147473146 +TSDB_CODE_UDF_INVALID_BUFSIZE = -2147473145 +TSDB_CODE_UDF_INVALID_OUTPUT_TYPE = -2147473144 +TSDB_CODE_UDF_SCRIPT_NOT_SUPPORTED = -2147473143 +TSDB_CODE_UDF_FUNC_EXEC_FAILURE = -2147473142 +TSDB_CODE_SML_INVALID_PROTOCOL_TYPE = -2147471360 +TSDB_CODE_SML_INVALID_PRECISION_TYPE = -2147471359 +TSDB_CODE_SML_INVALID_DATA = -2147471358 +TSDB_CODE_SML_INVALID_DB_CONF = -2147471357 +TSDB_CODE_SML_NOT_SAME_TYPE = -2147471356 +TSDB_CODE_SML_INTERNAL_ERROR = -2147471355 +TSDB_CODE_SML_NOT_SUPPORT_PK = -2147471354 +TSDB_CODE_TSMA_INIT_FAILED = -2147471104 +TSDB_CODE_TSMA_ALREADY_EXIST = -2147471103 +TSDB_CODE_TSMA_INVALID_ENV = -2147471102 +TSDB_CODE_TSMA_INVALID_STAT = -2147471101 +TSDB_CODE_TSMA_INVALID_PTR = -2147471100 +TSDB_CODE_TSMA_INVALID_PARA = -2147471099 +TSDB_CODE_TSMA_INVALID_TB = -2147471098 +TSDB_CODE_TSMA_INVALID_INTERVAL = -2147471097 +TSDB_CODE_TSMA_INVALID_FUNC_PARAM = -2147471096 +TSDB_CODE_TSMA_UNSUPPORTED_FUNC = -2147471095 +TSDB_CODE_TSMA_MUST_BE_DROPPED = -2147471088 +TSDB_CODE_TSMA_NAME_TOO_LONG = -2147471087 +TSDB_CODE_RSMA_INVALID_ENV = -2147471024 +TSDB_CODE_RSMA_INVALID_STAT = -2147471023 +TSDB_CODE_RSMA_QTASKINFO_CREATE = -2147471022 +TSDB_CODE_RSMA_INVALID_SCHEMA = -2147471021 +TSDB_CODE_RSMA_STREAM_STATE_OPEN = -2147471020 +TSDB_CODE_RSMA_STREAM_STATE_COMMIT = -2147471019 +TSDB_CODE_RSMA_FS_SYNC = -2147471018 +TSDB_CODE_RSMA_RESULT = -2147471017 +TSDB_CODE_INDEX_REBUILDING = -2147470848 +TSDB_CODE_INDEX_INVALID_FILE = -2147470847 +TSDB_CODE_SCALAR_CONVERT_ERROR = -2147470768 +TSDB_CODE_TMQ_INVALID_MSG = -2147467264 +TSDB_CODE_TMQ_NEED_INITIALIZED = -2147467248 +TSDB_CODE_TMQ_SNAPSHOT_ERROR = -2147467258 +TSDB_CODE_TMQ_NO_COMMITTED = -2147467247 +TSDB_CODE_TMQ_VERSION_OUT_OF_RANGE = -2147467257 +TSDB_CODE_TMQ_INVALID_VGID = -2147467256 +TSDB_CODE_TMQ_INVALID_TOPIC = -2147467255 +TSDB_CODE_TMQ_CONSUMER_MISMATCH = -2147467263 +TSDB_CODE_TMQ_CONSUMER_CLOSED = -2147467262 +TSDB_CODE_TMQ_CONSUMER_ERROR = -2147467261 +TSDB_CODE_TMQ_TOPIC_OUT_OF_RANGE = -2147467260 +TSDB_CODE_TMQ_GROUP_OUT_OF_RANGE = -2147467259 +TSDB_CODE_TMQ_SAME_COMMITTED_VALUE = -2147467246 +TSDB_CODE_TMQ_REPLAY_NEED_ONE_VGROUP = -2147467245 +TSDB_CODE_TMQ_REPLAY_NOT_SUPPORT = -2147467244 +TSDB_CODE_STREAM_TASK_NOT_EXIST = -2147467008 +TSDB_CODE_STREAM_EXEC_CANCELLED = -2147467006 +TSDB_CODE_STREAM_INVALID_STATETRANS = -2147467005 +TSDB_CODE_STREAM_TASK_IVLD_STATUS = -2147467004 +TSDB_CODE_TDLITE_IVLD_OPEN_FLAGS = -2147462912 +TSDB_CODE_TDLITE_IVLD_OPEN_DIR = -2147462911 +TSDB_CODE_UTIL_QUEUE_OUT_OF_MEMORY = -2147459072 diff --git a/source/util/test/terrorTest.cpp b/source/util/test/terrorTest.cpp index fbb698f780..0e968edbe3 100644 --- a/source/util/test/terrorTest.cpp +++ b/source/util/test/terrorTest.cpp @@ -2,14 +2,219 @@ #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include "taoserror.h" using namespace std; -TEST(TAOS_ERROR_TEST, terror_test) { +enum class ParseStatus { + Success, + FileNotExist, + FileNotOpen, +}; + +typedef struct { + int32_t val; + string str; // unused + string macro; +} STestTaosError; + +string getExecutableDirectory() { + char result[PATH_MAX]; + ssize_t count = readlink("/proc/self/exe", result, PATH_MAX); + if (count != -1) { + result[count] = '\0'; + string path(result); + size_t pos = path.rfind('/'); + if (pos != string::npos) { + path.erase(pos + 1); + } + return path; + } else { + throw std::runtime_error("Failed to get the executable's directory"); + } +} + +// parses key-value pairs from strings +pair parseKeyValuePair(const string &line, char delim = '=') { + size_t pos = line.find(delim); + if (pos == string::npos) + return make_pair("", 0); + + string key = line.substr(0, pos); + + // remove leading spaces + size_t firstNotSpace = key.find_first_not_of(" "); + if (firstNotSpace != string::npos) { + key = key.substr(firstNotSpace); + } else { + key.clear(); + } + + // remove ending spaces + size_t lastNotSpace = key.find_last_not_of(" "); + if (lastNotSpace != string::npos) { + key = key.substr(0, lastNotSpace + 1); + } + + if (key.front() == '"' && key.back() == '"') + key = key.substr(1, key.size() - 2); + + if (key.front() == '\'' && key.back() == '\'') + key = key.substr(1, key.size() - 2); + + string valStr = line.substr(pos + 1); + int32_t val = stoi(valStr); + return make_pair(key, val); +} + +// read the configuration file and parse it into the STestTaosError array +ParseStatus readConfig(const string& filePath, vector& errorInfos) { + ifstream file(filePath); + if (!file.is_open()) { + if (file.fail() && errno == ENOENT) { + cerr << "Error: The file does not exist, file: " << filePath << endl; + return ParseStatus::FileNotExist; + } else { + cerr << "Error: Could not open the file, file: " << filePath << endl; + return ParseStatus::FileNotOpen; + } + } + + string line; + while (std::getline(file, line)) { + char delim = '#'; + if (line.find('=') != string::npos) { + delim = '='; + } else if (line.find(':') != string::npos) { + delim = ':'; + } else if (line.find('{') != string::npos || line.find('}') != string::npos) { + // TODO: parse json format + continue; + } else { + continue; + } + + auto curKwInfo = parseKeyValuePair(line, delim); + + STestTaosError errorInfo; + errorInfo.macro = curKwInfo.first; + errorInfo.val = curKwInfo.second; + errorInfos.push_back(errorInfo); + } + + return ParseStatus::Success; +} + + +TEST(TAOS_ERROR_TEST, terror_compatibility_test) { + int32_t errSize = taosGetErrSize(); + // for (int32_t i = 0; i < errSize; ++i) { + // STaosError *pInfo = &errors[i]; + // std::cout << i + 1 << " " << pInfo->macro << " " << pInfo->val << std::endl; + // } + + + // current errors: to map + unordered_map map; + for (int32_t i = 0; i < errSize; ++i) { + STaosError *pInfo = &errors[i]; + map[pInfo->macro] = pInfo; + } + + string configFileName = "errorCodeTable.ini"; + string execDir = getExecutableDirectory(); + string configFilePath(execDir + configFileName); + + vector errorInfos; + ParseStatus status = readConfig(configFilePath, errorInfos); + + switch (status) { + case ParseStatus::Success: + for (const auto& stdInfo : errorInfos) { + auto it = map.find(stdInfo.macro); + if (it == map.end()) { + FAIL() << "Error: Could not find error: " << stdInfo.macro << "."; + } else { + auto newInfo = it->second; + + ASSERT_STREQ(stdInfo.macro.c_str(), newInfo->macro); + ASSERT_EQ(stdInfo.val, newInfo->val) + << "Error code mismatch(" << stdInfo.macro << "): expected " << stdInfo.val << ", got " << newInfo->val << "."; + } + } + break; + case ParseStatus::FileNotExist: + FAIL() << "Error: The file does not exist, file: " << configFileName << "."; + break; + case ParseStatus::FileNotOpen: + FAIL() << "Error: Could not open the file, file: " << configFileName << "."; + break; + default: + FAIL() << "Unknown Error."; + break; + } +} + + +size_t maxLengthOfErrorMacro() { + size_t maxLen = 0; int32_t errSize = taosGetErrSize(); for (int32_t i = 0; i < errSize; ++i) { STaosError *pInfo = &errors[i]; - std::cout << i + 1 << " " << pInfo->macro << " " << pInfo->val << std::endl; + maxLen = std::max(maxLen, strlen(pInfo->macro)); } + return (maxLen / 4 + 1) * 4; +} + + +void generateConfigFile(const string& filePath) { + int32_t errSize = taosGetErrSize(); + size_t maxStringLength = maxLengthOfErrorMacro(); + std::ofstream file(filePath); + if (!file.is_open()) { + cerr << "Failed to open file for writing, at: " << filePath << "." << endl; + return; + } + + for (int32_t i = 0; i < errSize; ++i) { + STaosError *pInfo = &errors[i]; + file << std::left << std::setw(maxStringLength) << pInfo->macro << "= " << pInfo->val << endl; + } + + if (file.fail()) { + cerr << "An error occurred while writing to the file." << endl; + } else { + cout << "Data successfully written to file: " << filePath << endl; + } + + file.close(); +} + + +void processCommandArgs(int argc, char** argv) { + for (int i = 1; i < argc; ++i) { + if (string(argv[i]) == "--output-config") { + string configFile = (i + 1 < argc) ? argv[++i] : "./errorCodeTable.ini"; + generateConfigFile(configFile); + exit(0); + } + } +} + + +int main(int argc, char **argv) { + processCommandArgs(argc, argv); + + testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); } \ No newline at end of file diff --git a/tests/script/tsim/show/showalive.sim b/tests/script/tsim/show/showalive.sim new file mode 100644 index 0000000000..4cad1da01d --- /dev/null +++ b/tests/script/tsim/show/showalive.sim @@ -0,0 +1,167 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/deploy.sh -n dnode2 -i 2 +system sh/deploy.sh -n dnode3 -i 3 +system sh/deploy.sh -n dnode4 -i 4 +system sh/exec.sh -n dnode1 -s start +system sh/exec.sh -n dnode2 -s start +system sh/exec.sh -n dnode3 -s start +system sh/exec.sh -n dnode4 -s start + +sleep 1000 + +sql connect + + +print =============== add dnode into cluster +sql create dnode $hostname1 port 7200 +sql create dnode $hostname2 port 7300 +sql create dnode $hostname3 port 7400 +sql create dnode $hostname4 port 7500 + +sleep 1000 + +print =============== create database, stable, table +sql create database test vgroups 6; +sql use test; +sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int); +sql create table t1 using st tags(1,1,1); +sql create table t2 using st tags(2,2,2); +sql insert into t1 values(1648791211000,1,2,3); +sql insert into t1 values(1648791222001,2,2,3); +sql insert into t2 values(1648791211000,1,2,3); +sql insert into t2 values(1648791222001,2,2,3); + +$loop_count = 0 + +loop0: + +sleep 1000 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print show cluster alive; +sql show cluster alive; + +if $data00 != 1 then + print =====data00=$data00 + goto loop0 +endi + +print show test.alive; +sql show test.alive; + +if $data00 != 1 then + print =====data00=$data00 + goto loop0 +endi + +print stop dnode3 +print stop dnode4 +system sh/exec.sh -n dnode3 -s stop -x SIGKILL +system sh/exec.sh -n dnode4 -s stop -x SIGKILL + +$loop_count = 0 + +loop1: + +sleep 1000 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print show cluster alive; +sql show cluster alive; + +if $data00 != 2 then + print =====data00=$data00 + goto loop1 +endi + +print show test.alive +sql show test.alive; + +if $data00 != 2 then + print =====data00=$data00 + goto loop1 +endi + + +sql create database test1 vgroups 2; + +$loop_count = 0 + +loop2: + +sleep 1000 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print show cluster alive; +sql show cluster alive; + +if $data00 != 2 then + goto loop2 +endi + +print show test1.alive; +sql show test1.alive; + +if $data00 != 1 then + print =====data00=$data00 + goto loop2 +endi + +print stop dnode2 + +system sh/exec.sh -n dnode2 -s stop -x SIGKILL + + +$loop_count = 0 + +loop3: + +sleep 1000 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + + +print show cluster alive; +sql show cluster alive; + +if $data00 != 2 then + print =====data00=$data00 + goto loop3 +endi + +print show test.alive; +sql show test.alive; + +if $data00 != 2 then + print =====data00=$data00 + goto loop3 +endi + +sql show test1.alive; + +if $data00 != 2 then + print =====data00=$data00 + goto loop3 +endi + + +system sh/exec.sh -n dnode1 -s stop -x SIGINT +system sh/exec.sh -n dnode2 -s stop -x SIGINT +system sh/exec.sh -n dnode3 -s stop -x SIGINT +system sh/exec.sh -n dnode4 -s stop -x SIGINT diff --git a/tests/script/tsim/stream/pauseAndResume.sim b/tests/script/tsim/stream/pauseAndResume.sim index 9a05e645c2..b9d6e141be 100644 --- a/tests/script/tsim/stream/pauseAndResume.sim +++ b/tests/script/tsim/stream/pauseAndResume.sim @@ -336,6 +336,8 @@ sql create table ts3 using st tags(3,2,2); sql create table ts4 using st tags(4,2,2); sql create stream streams6 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 watermark 1d into streamt6 as select _wstart, count(*) c1 from st interval(10s); +sleep 1000 + sql insert into ts1 values(1648791213001,1,12,3,1.0); sql insert into ts2 values(1648791213001,1,12,3,1.0); @@ -354,6 +356,8 @@ sql insert into ts2 values(1648791233001,1,12,3,1.0); sql resume stream streams6; +sleep 1000 + sql insert into ts3 values(1648791243001,1,12,3,1.0); sql insert into ts4 values(1648791253001,1,12,3,1.0); diff --git a/tools/shell/src/shellArguments.c b/tools/shell/src/shellArguments.c index f48b19a287..8368837cc4 100644 --- a/tools/shell/src/shellArguments.c +++ b/tools/shell/src/shellArguments.c @@ -435,8 +435,8 @@ int32_t shellParseArgs(int32_t argc, char *argv[]) { shell.info.promptSize = strlen(shell.info.promptHeader); #ifdef TD_ENTERPRISE snprintf(shell.info.programVersion, sizeof(shell.info.programVersion), - "%s\ntaos version: %s compatible_version: %s\ngit: %s\ngit: %s\nbuild: %s", TD_PRODUCT_NAME, version, - compatible_version, gitinfo, gitinfoOfInternal, buildinfo); + "%s\ntaos version: %s compatible_version: %s\ngit: %s\ngitOfInternal: %s\nbuild: %s", TD_PRODUCT_NAME, + version, compatible_version, gitinfo, gitinfoOfInternal, buildinfo); #else snprintf(shell.info.programVersion, sizeof(shell.info.programVersion), "%s\ntaos version: %s compatible_version: %s\ngit: %s\nbuild: %s", TD_PRODUCT_NAME, version, diff --git a/utils/TSZ/sz/src/sz_double.c b/utils/TSZ/sz/src/sz_double.c index 0510fc612d..7fe5a07843 100644 --- a/utils/TSZ/sz/src/sz_double.c +++ b/utils/TSZ/sz/src/sz_double.c @@ -385,11 +385,11 @@ unsigned int optimize_intervals_double_1D_opt(double *oriData, size_t dataLength totalSampleSize++; pred_value = data_pos[-1]; pred_err = fabs(pred_value - *data_pos); - double dbri = (unsigned long)((pred_err/realPrecision+1)/2); + double dbri = (pred_err/realPrecision+1)/2; if(dbri >= (double)confparams_cpr->maxRangeRadius) radiusIndex = confparams_cpr->maxRangeRadius - 1; else - radiusIndex = dbri; + radiusIndex = (size_t)dbri; intervals[radiusIndex]++; data_pos += confparams_cpr->sampleDistance; diff --git a/utils/TSZ/sz/src/sz_float.c b/utils/TSZ/sz/src/sz_float.c index 4b18eb6ee8..e5dc40f003 100644 --- a/utils/TSZ/sz/src/sz_float.c +++ b/utils/TSZ/sz/src/sz_float.c @@ -53,9 +53,12 @@ unsigned int optimize_intervals_float_1D(float *oriData, size_t dataLength, doub //pred_value = 2*oriData[i-1] - oriData[i-2]; pred_value = oriData[i-1]; pred_err = fabs(pred_value - oriData[i]); - radiusIndex = (unsigned long)((pred_err/realPrecision+1)/2); - if(radiusIndex>=confparams_cpr->maxRangeRadius) - radiusIndex = confparams_cpr->maxRangeRadius - 1; + double dbri = (pred_err/realPrecision+1)/2; + if(dbri >= confparams_cpr->maxRangeRadius) { + radiusIndex = confparams_cpr->maxRangeRadius - 1; + } else { + radiusIndex = (size_t)dbri; + } intervals[radiusIndex]++; } } @@ -404,9 +407,12 @@ unsigned int optimize_intervals_float_1D_opt(float *oriData, size_t dataLength, totalSampleSize++; pred_value = data_pos[-1]; pred_err = fabs(pred_value - *data_pos); - radiusIndex = (unsigned long)((pred_err/realPrecision+1)/2); - if(radiusIndex>=confparams_cpr->maxRangeRadius) - radiusIndex = confparams_cpr->maxRangeRadius - 1; + double dbri = (pred_err/realPrecision+1)/2; + if(dbri >= confparams_cpr->maxRangeRadius) { + radiusIndex = confparams_cpr->maxRangeRadius - 1; + } else { + radiusIndex = (size_t)dbri; + } intervals[radiusIndex]++; data_pos += confparams_cpr->sampleDistance;