Merge branch '3.0' into enh/TS-5043-3.0
This commit is contained in:
commit
73a9470286
|
@ -180,18 +180,20 @@ ELSE ()
|
||||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx2")
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx2")
|
||||||
ENDIF()
|
ENDIF()
|
||||||
MESSAGE(STATUS "SIMD instructions (FMA/AVX/AVX2) is ACTIVATED")
|
MESSAGE(STATUS "SIMD instructions (FMA/AVX/AVX2) is ACTIVATED")
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
# IF (COMPILER_SUPPORT_AVX512F AND COMPILER_SUPPORT_AVX512BMI)
|
IF ("${SIMD_AVX512_SUPPORT}" MATCHES "true")
|
||||||
# SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mavx512f -mavx512vbmi")
|
IF (COMPILER_SUPPORT_AVX512F AND COMPILER_SUPPORT_AVX512BMI)
|
||||||
# SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx512f -mavx512vbmi")
|
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mavx512f -mavx512vbmi")
|
||||||
# MESSAGE(STATUS "avx512f/avx512bmi supported by compiler")
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx512f -mavx512vbmi")
|
||||||
# ENDIF()
|
MESSAGE(STATUS "avx512f/avx512bmi enabled by compiler")
|
||||||
#
|
ENDIF()
|
||||||
# IF (COMPILER_SUPPORT_AVX512VL)
|
|
||||||
# SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mavx512vl")
|
IF (COMPILER_SUPPORT_AVX512VL)
|
||||||
# SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx512vl")
|
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mavx512vl")
|
||||||
# MESSAGE(STATUS "avx512vl supported by compiler")
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx512vl")
|
||||||
# ENDIF()
|
MESSAGE(STATUS "avx512vl enabled by compiler")
|
||||||
|
ENDIF()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
# build mode
|
# build mode
|
||||||
|
|
|
@ -25,7 +25,7 @@ create_definition:
|
||||||
col_name column_definition
|
col_name column_definition
|
||||||
|
|
||||||
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_options:
|
||||||
table_option ...
|
table_option ...
|
||||||
|
@ -52,9 +52,9 @@ table_option: {
|
||||||
|
|
||||||
**Parameter description**
|
**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.
|
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
|
## 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.
|
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.
|
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
|
### Add a Column
|
||||||
|
|
||||||
```sql
|
```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 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
|
## Modify a Subtable
|
||||||
|
|
||||||
```sql
|
```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.
|
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
|
### Change Tag Value Of Sub Table
|
||||||
|
|
||||||
```
|
```
|
||||||
ALTER TABLE tb_name SET TAG tag_name=new_tag_value;
|
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
|
## Delete a Table
|
||||||
|
|
||||||
The following SQL statement deletes one or more tables.
|
The following SQL statement deletes one or more tables.
|
||||||
|
|
|
@ -39,10 +39,10 @@ This is an example:
|
||||||
|
|
||||||
```sql
|
```sql
|
||||||
taos> show users;
|
taos> show users;
|
||||||
name | super | enable | sysinfo | create_time |
|
name | super | enable | sysinfo | createdb | create_time | allowed_host |
|
||||||
================================================================================
|
=========================================================================================================
|
||||||
test | 0 | 1 | 1 | 2022-08-29 15:10:27.315 |
|
test | 0 | 1 | 1 | 0 |2022-08-29 15:10:27.315 | 127.0.0.1 |
|
||||||
root | 1 | 1 | 1 | 2022-08-29 15:03:34.710 |
|
root | 1 | 1 | 1 | 1 |2022-08-29 15:03:34.710 | 127.0.0.1 |
|
||||||
Query OK, 2 rows in database (0.001657s)
|
Query OK, 2 rows in database (0.001657s)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -50,10 +50,10 @@ Alternatively, you can get the user information by querying a built-in table, IN
|
||||||
|
|
||||||
```sql
|
```sql
|
||||||
taos> select * from information_schema.ins_users;
|
taos> select * from information_schema.ins_users;
|
||||||
name | super | enable | sysinfo | create_time |
|
name | super | enable | sysinfo | createdb | create_time | allowed_host |
|
||||||
================================================================================
|
=========================================================================================================
|
||||||
test | 0 | 1 | 1 | 2022-08-29 15:10:27.315 |
|
test | 0 | 1 | 1 | 0 |2022-08-29 15:10:27.315 | 127.0.0.1 |
|
||||||
root | 1 | 1 | 1 | 2022-08-29 15:03:34.710 |
|
root | 1 | 1 | 1 | 1 |2022-08-29 15:03:34.710 | 127.0.0.1 |
|
||||||
Query OK, 2 rows in database (0.001953s)
|
Query OK, 2 rows in database (0.001953s)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -67,17 +67,19 @@ DROP USER user_name;
|
||||||
|
|
||||||
```sql
|
```sql
|
||||||
ALTER USER user_name alter_user_clause
|
ALTER USER user_name alter_user_clause
|
||||||
|
|
||||||
alter_user_clause: {
|
alter_user_clause: {
|
||||||
PASS 'literal'
|
PASS 'literal'
|
||||||
| ENABLE value
|
| ENABLE value
|
||||||
| SYSINFO value
|
| SYSINFO value
|
||||||
|
| CREATEDB value
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
- PASS: Modify the user password.
|
- PASS: Modify the user password.
|
||||||
- ENABLE: Specify whether the user is enabled or disabled. 1 indicates enabled and 0 indicates disabled.
|
- ENABLE: Specify whether the user is enabled or disabled. 1 indicates enabled and 0 indicates disabled.
|
||||||
- SYSINFO: Specify whether the user can query system information. 1 indicates that the user can query system information and 0 indicates that the user cannot query system information.
|
- SYSINFO: Specify whether the user can query system information. 1 indicates that the user can query system information and 0 indicates that the user cannot query system information.
|
||||||
|
- CREATEDB: Specify whether the user can create databases. 1 indicates that the user can create databases and 0 indicates that the user cannot create databases.
|
||||||
|
|
||||||
For example, you can use below command to disable user `test`:
|
For example, you can use below command to disable user `test`:
|
||||||
|
|
||||||
|
|
|
@ -23,10 +23,10 @@ create_subtable_clause: {
|
||||||
}
|
}
|
||||||
|
|
||||||
create_definition:
|
create_definition:
|
||||||
col_name column_definition
|
col_name column_definition
|
||||||
|
|
||||||
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_options:
|
||||||
table_option ...
|
table_option ...
|
||||||
|
@ -52,9 +52,9 @@ table_option: {
|
||||||
|
|
||||||
**参数说明**
|
**参数说明**
|
||||||
|
|
||||||
1. COMMENT:表注释。可用于超级表、子表和普通表。
|
1. COMMENT:表注释。可用于超级表、子表和普通表。最大长度为 1024 个字节。
|
||||||
2. SMA:Small Materialized Aggregates,提供基于数据块的自定义预计算功能。预计算类型包括 MAX、MIN 和 SUM。可用于超级表/普通表。
|
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:修改列名称。
|
4. RENAME COLUMN:修改列名称。
|
||||||
5. 普通表的主键列不能被修改,也不能通过 ADD/DROP 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
|
```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 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
|
```sql
|
||||||
|
@ -159,12 +176,29 @@ alter_table_option: {
|
||||||
|
|
||||||
1. 对子表的列和标签的修改,除了更改标签值以外,都要通过超级表才能进行。
|
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;
|
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 语句中删除一个或多个普通表或子表。
|
可以在一条 SQL 语句中删除一个或多个普通表或子表。
|
||||||
|
|
|
@ -0,0 +1,91 @@
|
||||||
|
---
|
||||||
|
title: 用户管理
|
||||||
|
sidebar_label: 用户管理
|
||||||
|
description: 本节讲述基本的用户管理功能
|
||||||
|
---
|
||||||
|
|
||||||
|
用户和权限管理是 TDengine 企业版的功能,本节只讲述基本的用户管理部分。要想了解和获取全面的权限管理功能,请联系 TDengine 销售团队。
|
||||||
|
|
||||||
|
## 创建用户
|
||||||
|
|
||||||
|
```sql
|
||||||
|
CREATE USER user_name PASS 'password' [SYSINFO {1|0}];
|
||||||
|
```
|
||||||
|
|
||||||
|
用户名最长不超过 23 个字节。
|
||||||
|
|
||||||
|
密码最长不超过 31 个字节。密码可以包含字母、数字以及除单引号、双引号、反引号、反斜杠和空格以外的特殊字符,密码不能为空字符串。
|
||||||
|
|
||||||
|
`SYSINFO` 表示该用户是否能够查看系统信息。`1` 表示可以查看,`0` 表示无权查看。系统信息包括服务配置、dnode、vnode、存储等信息。缺省值为 `1`。
|
||||||
|
|
||||||
|
在下面的示例中,我们创建一个密码为 `123456` 且可以查看系统信息的用户。
|
||||||
|
|
||||||
|
```sql
|
||||||
|
taos> create user test pass '123456' sysinfo 1;
|
||||||
|
Query OK, 0 of 0 rows affected (0.001254s)
|
||||||
|
```
|
||||||
|
|
||||||
|
## 查看用户
|
||||||
|
|
||||||
|
可以使用如下命令查看系统中的用户。
|
||||||
|
|
||||||
|
```sql
|
||||||
|
SHOW USERS;
|
||||||
|
```
|
||||||
|
|
||||||
|
以下是示例:
|
||||||
|
|
||||||
|
```sql
|
||||||
|
taos> show users;
|
||||||
|
name | super | enable | sysinfo | createdb | create_time | allowed_host |
|
||||||
|
=========================================================================================================
|
||||||
|
test | 0 | 1 | 1 | 0 |2022-08-29 15:10:27.315 | 127.0.0.1 |
|
||||||
|
root | 1 | 1 | 1 | 1 |2022-08-29 15:03:34.710 | 127.0.0.1 |
|
||||||
|
Query OK, 2 rows in database (0.001657s)
|
||||||
|
```
|
||||||
|
|
||||||
|
或者,可以查询内置系统表 INFORMATION_SCHEMA.INS_USERS 来获取用户信息。
|
||||||
|
|
||||||
|
```sql
|
||||||
|
taos> select * from information_schema.ins_users;
|
||||||
|
name | super | enable | sysinfo | createdb | create_time | allowed_host |
|
||||||
|
=========================================================================================================
|
||||||
|
test | 0 | 1 | 1 | 0 |2022-08-29 15:10:27.315 | 127.0.0.1 |
|
||||||
|
root | 1 | 1 | 1 | 1 |2022-08-29 15:03:34.710 | 127.0.0.1 |
|
||||||
|
Query OK, 2 rows in database (0.001953s)
|
||||||
|
```
|
||||||
|
|
||||||
|
## 删除用户
|
||||||
|
|
||||||
|
```sql
|
||||||
|
DROP USER user_name;
|
||||||
|
```
|
||||||
|
|
||||||
|
## 修改用户配置
|
||||||
|
|
||||||
|
```sql
|
||||||
|
ALTER USER user_name alter_user_clause
|
||||||
|
|
||||||
|
alter_user_clause: {
|
||||||
|
PASS 'literal'
|
||||||
|
| ENABLE value
|
||||||
|
| SYSINFO value
|
||||||
|
| CREATEDB value
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
- PASS: 修改密码,后跟新密码
|
||||||
|
- ENABLE: 启用或禁用该用户,`1` 表示启用,`0` 表示禁用
|
||||||
|
- SYSINFO: 允许或禁止查看系统信息,`1` 表示允许,`0` 表示禁止
|
||||||
|
- CREATEDB: 允许或禁止创建数据库,`1` 表示允许,`0` 表示禁止
|
||||||
|
|
||||||
|
下面的示例禁用了名为 `test` 的用户:
|
||||||
|
|
||||||
|
```sql
|
||||||
|
taos> alter user test enable 0;
|
||||||
|
Query OK, 0 of 0 rows affected (0.001160s)
|
||||||
|
```
|
||||||
|
|
||||||
|
## 授权管理
|
||||||
|
|
||||||
|
授权管理仅在 TDengine 企业版中可用,请联系 TDengine 销售团队。
|
|
@ -366,7 +366,7 @@ typedef enum {
|
||||||
} TSDB_SERVER_STATUS;
|
} TSDB_SERVER_STATUS;
|
||||||
|
|
||||||
DLL_EXPORT TSDB_SERVER_STATUS taos_check_server_status(const char *fqdn, int port, char *details, int maxlen);
|
DLL_EXPORT TSDB_SERVER_STATUS taos_check_server_status(const char *fqdn, int port, char *details, int maxlen);
|
||||||
|
DLL_EXPORT char* getBuildInfo();
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -40,6 +40,7 @@ extern "C" {
|
||||||
#define TSDB_INS_TABLE_COLS "ins_columns"
|
#define TSDB_INS_TABLE_COLS "ins_columns"
|
||||||
#define TSDB_INS_TABLE_TABLE_DISTRIBUTED "ins_table_distributed"
|
#define TSDB_INS_TABLE_TABLE_DISTRIBUTED "ins_table_distributed"
|
||||||
#define TSDB_INS_TABLE_USERS "ins_users"
|
#define TSDB_INS_TABLE_USERS "ins_users"
|
||||||
|
#define TSDB_INS_TABLE_USERS_FULL "ins_users_full"
|
||||||
#define TSDB_INS_TABLE_LICENCES "ins_grants"
|
#define TSDB_INS_TABLE_LICENCES "ins_grants"
|
||||||
#define TSDB_INS_TABLE_VGROUPS "ins_vgroups"
|
#define TSDB_INS_TABLE_VGROUPS "ins_vgroups"
|
||||||
#define TSDB_INS_TABLE_VNODES "ins_vnodes"
|
#define TSDB_INS_TABLE_VNODES "ins_vnodes"
|
||||||
|
|
|
@ -30,10 +30,6 @@ typedef int64_t tb_uid_t;
|
||||||
#define IS_TSWINDOW_SPECIFIED(win) (((win).skey != INT64_MIN) || ((win).ekey != INT64_MAX))
|
#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 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 {
|
typedef enum {
|
||||||
TSDB_SUPER_TABLE = 1, // super table
|
TSDB_SUPER_TABLE = 1, // super table
|
||||||
|
|
|
@ -158,6 +158,7 @@ typedef enum _mgmt_table {
|
||||||
TSDB_MGMT_TABLE_MACHINES,
|
TSDB_MGMT_TABLE_MACHINES,
|
||||||
TSDB_MGMT_TABLE_ARBGROUP,
|
TSDB_MGMT_TABLE_ARBGROUP,
|
||||||
TSDB_MGMT_TABLE_ENCRYPTIONS,
|
TSDB_MGMT_TABLE_ENCRYPTIONS,
|
||||||
|
TSDB_MGMT_TABLE_USER_FULL,
|
||||||
TSDB_MGMT_TABLE_MAX,
|
TSDB_MGMT_TABLE_MAX,
|
||||||
} EShowType;
|
} EShowType;
|
||||||
|
|
||||||
|
@ -362,6 +363,7 @@ typedef enum ENodeType {
|
||||||
QUERY_NODE_SHOW_TABLES_STMT,
|
QUERY_NODE_SHOW_TABLES_STMT,
|
||||||
QUERY_NODE_SHOW_TAGS_STMT,
|
QUERY_NODE_SHOW_TAGS_STMT,
|
||||||
QUERY_NODE_SHOW_USERS_STMT,
|
QUERY_NODE_SHOW_USERS_STMT,
|
||||||
|
QUERY_NODE_SHOW_USERS_FULL_STMT,
|
||||||
QUERY_NODE_SHOW_LICENCES_STMT,
|
QUERY_NODE_SHOW_LICENCES_STMT,
|
||||||
QUERY_NODE_SHOW_VGROUPS_STMT,
|
QUERY_NODE_SHOW_VGROUPS_STMT,
|
||||||
QUERY_NODE_SHOW_TOPICS_STMT,
|
QUERY_NODE_SHOW_TOPICS_STMT,
|
||||||
|
@ -1017,6 +1019,8 @@ typedef struct {
|
||||||
SIpV4Range* pIpRanges;
|
SIpV4Range* pIpRanges;
|
||||||
int32_t sqlLen;
|
int32_t sqlLen;
|
||||||
char* sql;
|
char* sql;
|
||||||
|
int8_t isImport;
|
||||||
|
int8_t createDb;
|
||||||
} SCreateUserReq;
|
} SCreateUserReq;
|
||||||
|
|
||||||
int32_t tSerializeSCreateUserReq(void* buf, int32_t bufLen, SCreateUserReq* pReq);
|
int32_t tSerializeSCreateUserReq(void* buf, int32_t bufLen, SCreateUserReq* pReq);
|
||||||
|
@ -2111,6 +2115,7 @@ typedef struct {
|
||||||
char filterTb[TSDB_TABLE_NAME_LEN]; // for ins_columns
|
char filterTb[TSDB_TABLE_NAME_LEN]; // for ins_columns
|
||||||
int64_t showId;
|
int64_t showId;
|
||||||
int64_t compactId; // for compact
|
int64_t compactId; // for compact
|
||||||
|
bool withFull; // for show users full
|
||||||
} SRetrieveTableReq;
|
} SRetrieveTableReq;
|
||||||
|
|
||||||
typedef struct SSysTableSchema {
|
typedef struct SSysTableSchema {
|
||||||
|
|
|
@ -50,348 +50,349 @@
|
||||||
#define TK_STATE 32
|
#define TK_STATE 32
|
||||||
#define TK_NK_COMMA 33
|
#define TK_NK_COMMA 33
|
||||||
#define TK_HOST 34
|
#define TK_HOST 34
|
||||||
#define TK_USER 35
|
#define TK_IS_IMPORT 35
|
||||||
#define TK_ENABLE 36
|
#define TK_NK_INTEGER 36
|
||||||
#define TK_NK_INTEGER 37
|
#define TK_CREATEDB 37
|
||||||
#define TK_SYSINFO 38
|
#define TK_USER 38
|
||||||
#define TK_CREATEDB 39
|
#define TK_ENABLE 39
|
||||||
#define TK_ADD 40
|
#define TK_SYSINFO 40
|
||||||
#define TK_DROP 41
|
#define TK_ADD 41
|
||||||
#define TK_GRANT 42
|
#define TK_DROP 42
|
||||||
#define TK_ON 43
|
#define TK_GRANT 43
|
||||||
#define TK_TO 44
|
#define TK_ON 44
|
||||||
#define TK_REVOKE 45
|
#define TK_TO 45
|
||||||
#define TK_FROM 46
|
#define TK_REVOKE 46
|
||||||
#define TK_SUBSCRIBE 47
|
#define TK_FROM 47
|
||||||
#define TK_READ 48
|
#define TK_SUBSCRIBE 48
|
||||||
#define TK_WRITE 49
|
#define TK_READ 49
|
||||||
#define TK_NK_DOT 50
|
#define TK_WRITE 50
|
||||||
#define TK_WITH 51
|
#define TK_NK_DOT 51
|
||||||
#define TK_ENCRYPT_KEY 52
|
#define TK_WITH 52
|
||||||
#define TK_DNODE 53
|
#define TK_ENCRYPT_KEY 53
|
||||||
#define TK_PORT 54
|
#define TK_DNODE 54
|
||||||
#define TK_DNODES 55
|
#define TK_PORT 55
|
||||||
#define TK_RESTORE 56
|
#define TK_DNODES 56
|
||||||
#define TK_NK_IPTOKEN 57
|
#define TK_RESTORE 57
|
||||||
#define TK_FORCE 58
|
#define TK_NK_IPTOKEN 58
|
||||||
#define TK_UNSAFE 59
|
#define TK_FORCE 59
|
||||||
#define TK_CLUSTER 60
|
#define TK_UNSAFE 60
|
||||||
#define TK_LOCAL 61
|
#define TK_CLUSTER 61
|
||||||
#define TK_QNODE 62
|
#define TK_LOCAL 62
|
||||||
#define TK_BNODE 63
|
#define TK_QNODE 63
|
||||||
#define TK_SNODE 64
|
#define TK_BNODE 64
|
||||||
#define TK_MNODE 65
|
#define TK_SNODE 65
|
||||||
#define TK_VNODE 66
|
#define TK_MNODE 66
|
||||||
#define TK_DATABASE 67
|
#define TK_VNODE 67
|
||||||
#define TK_USE 68
|
#define TK_DATABASE 68
|
||||||
#define TK_FLUSH 69
|
#define TK_USE 69
|
||||||
#define TK_TRIM 70
|
#define TK_FLUSH 70
|
||||||
#define TK_S3MIGRATE 71
|
#define TK_TRIM 71
|
||||||
#define TK_COMPACT 72
|
#define TK_S3MIGRATE 72
|
||||||
#define TK_IF 73
|
#define TK_COMPACT 73
|
||||||
#define TK_NOT 74
|
#define TK_IF 74
|
||||||
#define TK_EXISTS 75
|
#define TK_NOT 75
|
||||||
#define TK_BUFFER 76
|
#define TK_EXISTS 76
|
||||||
#define TK_CACHEMODEL 77
|
#define TK_BUFFER 77
|
||||||
#define TK_CACHESIZE 78
|
#define TK_CACHEMODEL 78
|
||||||
#define TK_COMP 79
|
#define TK_CACHESIZE 79
|
||||||
#define TK_DURATION 80
|
#define TK_COMP 80
|
||||||
#define TK_NK_VARIABLE 81
|
#define TK_DURATION 81
|
||||||
#define TK_MAXROWS 82
|
#define TK_NK_VARIABLE 82
|
||||||
#define TK_MINROWS 83
|
#define TK_MAXROWS 83
|
||||||
#define TK_KEEP 84
|
#define TK_MINROWS 84
|
||||||
#define TK_PAGES 85
|
#define TK_KEEP 85
|
||||||
#define TK_PAGESIZE 86
|
#define TK_PAGES 86
|
||||||
#define TK_TSDB_PAGESIZE 87
|
#define TK_PAGESIZE 87
|
||||||
#define TK_PRECISION 88
|
#define TK_TSDB_PAGESIZE 88
|
||||||
#define TK_REPLICA 89
|
#define TK_PRECISION 89
|
||||||
#define TK_VGROUPS 90
|
#define TK_REPLICA 90
|
||||||
#define TK_SINGLE_STABLE 91
|
#define TK_VGROUPS 91
|
||||||
#define TK_RETENTIONS 92
|
#define TK_SINGLE_STABLE 92
|
||||||
#define TK_SCHEMALESS 93
|
#define TK_RETENTIONS 93
|
||||||
#define TK_WAL_LEVEL 94
|
#define TK_SCHEMALESS 94
|
||||||
#define TK_WAL_FSYNC_PERIOD 95
|
#define TK_WAL_LEVEL 95
|
||||||
#define TK_WAL_RETENTION_PERIOD 96
|
#define TK_WAL_FSYNC_PERIOD 96
|
||||||
#define TK_WAL_RETENTION_SIZE 97
|
#define TK_WAL_RETENTION_PERIOD 97
|
||||||
#define TK_WAL_ROLL_PERIOD 98
|
#define TK_WAL_RETENTION_SIZE 98
|
||||||
#define TK_WAL_SEGMENT_SIZE 99
|
#define TK_WAL_ROLL_PERIOD 99
|
||||||
#define TK_STT_TRIGGER 100
|
#define TK_WAL_SEGMENT_SIZE 100
|
||||||
#define TK_TABLE_PREFIX 101
|
#define TK_STT_TRIGGER 101
|
||||||
#define TK_TABLE_SUFFIX 102
|
#define TK_TABLE_PREFIX 102
|
||||||
#define TK_S3_CHUNKSIZE 103
|
#define TK_TABLE_SUFFIX 103
|
||||||
#define TK_S3_KEEPLOCAL 104
|
#define TK_S3_CHUNKSIZE 104
|
||||||
#define TK_S3_COMPACT 105
|
#define TK_S3_KEEPLOCAL 105
|
||||||
#define TK_KEEP_TIME_OFFSET 106
|
#define TK_S3_COMPACT 106
|
||||||
#define TK_ENCRYPT_ALGORITHM 107
|
#define TK_KEEP_TIME_OFFSET 107
|
||||||
#define TK_NK_COLON 108
|
#define TK_ENCRYPT_ALGORITHM 108
|
||||||
#define TK_BWLIMIT 109
|
#define TK_NK_COLON 109
|
||||||
#define TK_START 110
|
#define TK_BWLIMIT 110
|
||||||
#define TK_TIMESTAMP 111
|
#define TK_START 111
|
||||||
#define TK_END 112
|
#define TK_TIMESTAMP 112
|
||||||
#define TK_TABLE 113
|
#define TK_END 113
|
||||||
#define TK_NK_LP 114
|
#define TK_TABLE 114
|
||||||
#define TK_NK_RP 115
|
#define TK_NK_LP 115
|
||||||
#define TK_STABLE 116
|
#define TK_NK_RP 116
|
||||||
#define TK_COLUMN 117
|
#define TK_STABLE 117
|
||||||
#define TK_MODIFY 118
|
#define TK_COLUMN 118
|
||||||
#define TK_RENAME 119
|
#define TK_MODIFY 119
|
||||||
#define TK_TAG 120
|
#define TK_RENAME 120
|
||||||
#define TK_SET 121
|
#define TK_TAG 121
|
||||||
#define TK_NK_EQ 122
|
#define TK_SET 122
|
||||||
#define TK_USING 123
|
#define TK_NK_EQ 123
|
||||||
#define TK_TAGS 124
|
#define TK_USING 124
|
||||||
#define TK_BOOL 125
|
#define TK_TAGS 125
|
||||||
#define TK_TINYINT 126
|
#define TK_BOOL 126
|
||||||
#define TK_SMALLINT 127
|
#define TK_TINYINT 127
|
||||||
#define TK_INT 128
|
#define TK_SMALLINT 128
|
||||||
#define TK_INTEGER 129
|
#define TK_INT 129
|
||||||
#define TK_BIGINT 130
|
#define TK_INTEGER 130
|
||||||
#define TK_FLOAT 131
|
#define TK_BIGINT 131
|
||||||
#define TK_DOUBLE 132
|
#define TK_FLOAT 132
|
||||||
#define TK_BINARY 133
|
#define TK_DOUBLE 133
|
||||||
#define TK_NCHAR 134
|
#define TK_BINARY 134
|
||||||
#define TK_UNSIGNED 135
|
#define TK_NCHAR 135
|
||||||
#define TK_JSON 136
|
#define TK_UNSIGNED 136
|
||||||
#define TK_VARCHAR 137
|
#define TK_JSON 137
|
||||||
#define TK_MEDIUMBLOB 138
|
#define TK_VARCHAR 138
|
||||||
#define TK_BLOB 139
|
#define TK_MEDIUMBLOB 139
|
||||||
#define TK_VARBINARY 140
|
#define TK_BLOB 140
|
||||||
#define TK_GEOMETRY 141
|
#define TK_VARBINARY 141
|
||||||
#define TK_DECIMAL 142
|
#define TK_GEOMETRY 142
|
||||||
#define TK_COMMENT 143
|
#define TK_DECIMAL 143
|
||||||
#define TK_MAX_DELAY 144
|
#define TK_COMMENT 144
|
||||||
#define TK_WATERMARK 145
|
#define TK_MAX_DELAY 145
|
||||||
#define TK_ROLLUP 146
|
#define TK_WATERMARK 146
|
||||||
#define TK_TTL 147
|
#define TK_ROLLUP 147
|
||||||
#define TK_SMA 148
|
#define TK_TTL 148
|
||||||
#define TK_DELETE_MARK 149
|
#define TK_SMA 149
|
||||||
#define TK_FIRST 150
|
#define TK_DELETE_MARK 150
|
||||||
#define TK_LAST 151
|
#define TK_FIRST 151
|
||||||
#define TK_SHOW 152
|
#define TK_LAST 152
|
||||||
#define TK_PRIVILEGES 153
|
#define TK_SHOW 153
|
||||||
#define TK_DATABASES 154
|
#define TK_FULL 154
|
||||||
#define TK_TABLES 155
|
#define TK_PRIVILEGES 155
|
||||||
#define TK_STABLES 156
|
#define TK_DATABASES 156
|
||||||
#define TK_MNODES 157
|
#define TK_TABLES 157
|
||||||
#define TK_QNODES 158
|
#define TK_STABLES 158
|
||||||
#define TK_ARBGROUPS 159
|
#define TK_MNODES 159
|
||||||
#define TK_FUNCTIONS 160
|
#define TK_QNODES 160
|
||||||
#define TK_INDEXES 161
|
#define TK_ARBGROUPS 161
|
||||||
#define TK_ACCOUNTS 162
|
#define TK_FUNCTIONS 162
|
||||||
#define TK_APPS 163
|
#define TK_INDEXES 163
|
||||||
#define TK_CONNECTIONS 164
|
#define TK_ACCOUNTS 164
|
||||||
#define TK_LICENCES 165
|
#define TK_APPS 165
|
||||||
#define TK_GRANTS 166
|
#define TK_CONNECTIONS 166
|
||||||
#define TK_FULL 167
|
#define TK_LICENCES 167
|
||||||
#define TK_LOGS 168
|
#define TK_GRANTS 168
|
||||||
#define TK_MACHINES 169
|
#define TK_LOGS 169
|
||||||
#define TK_ENCRYPTIONS 170
|
#define TK_MACHINES 170
|
||||||
#define TK_QUERIES 171
|
#define TK_ENCRYPTIONS 171
|
||||||
#define TK_SCORES 172
|
#define TK_QUERIES 172
|
||||||
#define TK_TOPICS 173
|
#define TK_SCORES 173
|
||||||
#define TK_VARIABLES 174
|
#define TK_TOPICS 174
|
||||||
#define TK_BNODES 175
|
#define TK_VARIABLES 175
|
||||||
#define TK_SNODES 176
|
#define TK_BNODES 176
|
||||||
#define TK_TRANSACTIONS 177
|
#define TK_SNODES 177
|
||||||
#define TK_DISTRIBUTED 178
|
#define TK_TRANSACTIONS 178
|
||||||
#define TK_CONSUMERS 179
|
#define TK_DISTRIBUTED 179
|
||||||
#define TK_SUBSCRIPTIONS 180
|
#define TK_CONSUMERS 180
|
||||||
#define TK_VNODES 181
|
#define TK_SUBSCRIPTIONS 181
|
||||||
#define TK_ALIVE 182
|
#define TK_VNODES 182
|
||||||
#define TK_VIEWS 183
|
#define TK_ALIVE 183
|
||||||
#define TK_VIEW 184
|
#define TK_VIEWS 184
|
||||||
#define TK_COMPACTS 185
|
#define TK_VIEW 185
|
||||||
#define TK_NORMAL 186
|
#define TK_COMPACTS 186
|
||||||
#define TK_CHILD 187
|
#define TK_NORMAL 187
|
||||||
#define TK_LIKE 188
|
#define TK_CHILD 188
|
||||||
#define TK_TBNAME 189
|
#define TK_LIKE 189
|
||||||
#define TK_QTAGS 190
|
#define TK_TBNAME 190
|
||||||
#define TK_AS 191
|
#define TK_QTAGS 191
|
||||||
#define TK_SYSTEM 192
|
#define TK_AS 192
|
||||||
#define TK_TSMA 193
|
#define TK_SYSTEM 193
|
||||||
#define TK_INTERVAL 194
|
#define TK_TSMA 194
|
||||||
#define TK_RECURSIVE 195
|
#define TK_INTERVAL 195
|
||||||
#define TK_TSMAS 196
|
#define TK_RECURSIVE 196
|
||||||
#define TK_FUNCTION 197
|
#define TK_TSMAS 197
|
||||||
#define TK_INDEX 198
|
#define TK_FUNCTION 198
|
||||||
#define TK_COUNT 199
|
#define TK_INDEX 199
|
||||||
#define TK_LAST_ROW 200
|
#define TK_COUNT 200
|
||||||
#define TK_META 201
|
#define TK_LAST_ROW 201
|
||||||
#define TK_ONLY 202
|
#define TK_META 202
|
||||||
#define TK_TOPIC 203
|
#define TK_ONLY 203
|
||||||
#define TK_CONSUMER 204
|
#define TK_TOPIC 204
|
||||||
#define TK_GROUP 205
|
#define TK_CONSUMER 205
|
||||||
#define TK_DESC 206
|
#define TK_GROUP 206
|
||||||
#define TK_DESCRIBE 207
|
#define TK_DESC 207
|
||||||
#define TK_RESET 208
|
#define TK_DESCRIBE 208
|
||||||
#define TK_QUERY 209
|
#define TK_RESET 209
|
||||||
#define TK_CACHE 210
|
#define TK_QUERY 210
|
||||||
#define TK_EXPLAIN 211
|
#define TK_CACHE 211
|
||||||
#define TK_ANALYZE 212
|
#define TK_EXPLAIN 212
|
||||||
#define TK_VERBOSE 213
|
#define TK_ANALYZE 213
|
||||||
#define TK_NK_BOOL 214
|
#define TK_VERBOSE 214
|
||||||
#define TK_RATIO 215
|
#define TK_NK_BOOL 215
|
||||||
#define TK_NK_FLOAT 216
|
#define TK_RATIO 216
|
||||||
#define TK_OUTPUTTYPE 217
|
#define TK_NK_FLOAT 217
|
||||||
#define TK_AGGREGATE 218
|
#define TK_OUTPUTTYPE 218
|
||||||
#define TK_BUFSIZE 219
|
#define TK_AGGREGATE 219
|
||||||
#define TK_LANGUAGE 220
|
#define TK_BUFSIZE 220
|
||||||
#define TK_REPLACE 221
|
#define TK_LANGUAGE 221
|
||||||
#define TK_STREAM 222
|
#define TK_REPLACE 222
|
||||||
#define TK_INTO 223
|
#define TK_STREAM 223
|
||||||
#define TK_PAUSE 224
|
#define TK_INTO 224
|
||||||
#define TK_RESUME 225
|
#define TK_PAUSE 225
|
||||||
#define TK_PRIMARY 226
|
#define TK_RESUME 226
|
||||||
#define TK_KEY 227
|
#define TK_PRIMARY 227
|
||||||
#define TK_TRIGGER 228
|
#define TK_KEY 228
|
||||||
#define TK_AT_ONCE 229
|
#define TK_TRIGGER 229
|
||||||
#define TK_WINDOW_CLOSE 230
|
#define TK_AT_ONCE 230
|
||||||
#define TK_IGNORE 231
|
#define TK_WINDOW_CLOSE 231
|
||||||
#define TK_EXPIRED 232
|
#define TK_IGNORE 232
|
||||||
#define TK_FILL_HISTORY 233
|
#define TK_EXPIRED 233
|
||||||
#define TK_UPDATE 234
|
#define TK_FILL_HISTORY 234
|
||||||
#define TK_SUBTABLE 235
|
#define TK_UPDATE 235
|
||||||
#define TK_UNTREATED 236
|
#define TK_SUBTABLE 236
|
||||||
#define TK_KILL 237
|
#define TK_UNTREATED 237
|
||||||
#define TK_CONNECTION 238
|
#define TK_KILL 238
|
||||||
#define TK_TRANSACTION 239
|
#define TK_CONNECTION 239
|
||||||
#define TK_BALANCE 240
|
#define TK_TRANSACTION 240
|
||||||
#define TK_VGROUP 241
|
#define TK_BALANCE 241
|
||||||
#define TK_LEADER 242
|
#define TK_VGROUP 242
|
||||||
#define TK_MERGE 243
|
#define TK_LEADER 243
|
||||||
#define TK_REDISTRIBUTE 244
|
#define TK_MERGE 244
|
||||||
#define TK_SPLIT 245
|
#define TK_REDISTRIBUTE 245
|
||||||
#define TK_DELETE 246
|
#define TK_SPLIT 246
|
||||||
#define TK_INSERT 247
|
#define TK_DELETE 247
|
||||||
#define TK_NK_BIN 248
|
#define TK_INSERT 248
|
||||||
#define TK_NK_HEX 249
|
#define TK_NK_BIN 249
|
||||||
#define TK_NULL 250
|
#define TK_NK_HEX 250
|
||||||
#define TK_NK_QUESTION 251
|
#define TK_NULL 251
|
||||||
#define TK_NK_ALIAS 252
|
#define TK_NK_QUESTION 252
|
||||||
#define TK_NK_ARROW 253
|
#define TK_NK_ALIAS 253
|
||||||
#define TK_ROWTS 254
|
#define TK_NK_ARROW 254
|
||||||
#define TK_QSTART 255
|
#define TK_ROWTS 255
|
||||||
#define TK_QEND 256
|
#define TK_QSTART 256
|
||||||
#define TK_QDURATION 257
|
#define TK_QEND 257
|
||||||
#define TK_WSTART 258
|
#define TK_QDURATION 258
|
||||||
#define TK_WEND 259
|
#define TK_WSTART 259
|
||||||
#define TK_WDURATION 260
|
#define TK_WEND 260
|
||||||
#define TK_IROWTS 261
|
#define TK_WDURATION 261
|
||||||
#define TK_ISFILLED 262
|
#define TK_IROWTS 262
|
||||||
#define TK_CAST 263
|
#define TK_ISFILLED 263
|
||||||
#define TK_NOW 264
|
#define TK_CAST 264
|
||||||
#define TK_TODAY 265
|
#define TK_NOW 265
|
||||||
#define TK_TIMEZONE 266
|
#define TK_TODAY 266
|
||||||
#define TK_CLIENT_VERSION 267
|
#define TK_TIMEZONE 267
|
||||||
#define TK_SERVER_VERSION 268
|
#define TK_CLIENT_VERSION 268
|
||||||
#define TK_SERVER_STATUS 269
|
#define TK_SERVER_VERSION 269
|
||||||
#define TK_CURRENT_USER 270
|
#define TK_SERVER_STATUS 270
|
||||||
#define TK_CASE 271
|
#define TK_CURRENT_USER 271
|
||||||
#define TK_WHEN 272
|
#define TK_CASE 272
|
||||||
#define TK_THEN 273
|
#define TK_WHEN 273
|
||||||
#define TK_ELSE 274
|
#define TK_THEN 274
|
||||||
#define TK_BETWEEN 275
|
#define TK_ELSE 275
|
||||||
#define TK_IS 276
|
#define TK_BETWEEN 276
|
||||||
#define TK_NK_LT 277
|
#define TK_IS 277
|
||||||
#define TK_NK_GT 278
|
#define TK_NK_LT 278
|
||||||
#define TK_NK_LE 279
|
#define TK_NK_GT 279
|
||||||
#define TK_NK_GE 280
|
#define TK_NK_LE 280
|
||||||
#define TK_NK_NE 281
|
#define TK_NK_GE 281
|
||||||
#define TK_MATCH 282
|
#define TK_NK_NE 282
|
||||||
#define TK_NMATCH 283
|
#define TK_MATCH 283
|
||||||
#define TK_CONTAINS 284
|
#define TK_NMATCH 284
|
||||||
#define TK_IN 285
|
#define TK_CONTAINS 285
|
||||||
#define TK_JOIN 286
|
#define TK_IN 286
|
||||||
#define TK_INNER 287
|
#define TK_JOIN 287
|
||||||
#define TK_LEFT 288
|
#define TK_INNER 288
|
||||||
#define TK_RIGHT 289
|
#define TK_LEFT 289
|
||||||
#define TK_OUTER 290
|
#define TK_RIGHT 290
|
||||||
#define TK_SEMI 291
|
#define TK_OUTER 291
|
||||||
#define TK_ANTI 292
|
#define TK_SEMI 292
|
||||||
#define TK_ASOF 293
|
#define TK_ANTI 293
|
||||||
#define TK_WINDOW 294
|
#define TK_ASOF 294
|
||||||
#define TK_WINDOW_OFFSET 295
|
#define TK_WINDOW 295
|
||||||
#define TK_JLIMIT 296
|
#define TK_WINDOW_OFFSET 296
|
||||||
#define TK_SELECT 297
|
#define TK_JLIMIT 297
|
||||||
#define TK_NK_HINT 298
|
#define TK_SELECT 298
|
||||||
#define TK_DISTINCT 299
|
#define TK_NK_HINT 299
|
||||||
#define TK_WHERE 300
|
#define TK_DISTINCT 300
|
||||||
#define TK_PARTITION 301
|
#define TK_WHERE 301
|
||||||
#define TK_BY 302
|
#define TK_PARTITION 302
|
||||||
#define TK_SESSION 303
|
#define TK_BY 303
|
||||||
#define TK_STATE_WINDOW 304
|
#define TK_SESSION 304
|
||||||
#define TK_EVENT_WINDOW 305
|
#define TK_STATE_WINDOW 305
|
||||||
#define TK_COUNT_WINDOW 306
|
#define TK_EVENT_WINDOW 306
|
||||||
#define TK_SLIDING 307
|
#define TK_COUNT_WINDOW 307
|
||||||
#define TK_FILL 308
|
#define TK_SLIDING 308
|
||||||
#define TK_VALUE 309
|
#define TK_FILL 309
|
||||||
#define TK_VALUE_F 310
|
#define TK_VALUE 310
|
||||||
#define TK_NONE 311
|
#define TK_VALUE_F 311
|
||||||
#define TK_PREV 312
|
#define TK_NONE 312
|
||||||
#define TK_NULL_F 313
|
#define TK_PREV 313
|
||||||
#define TK_LINEAR 314
|
#define TK_NULL_F 314
|
||||||
#define TK_NEXT 315
|
#define TK_LINEAR 315
|
||||||
#define TK_HAVING 316
|
#define TK_NEXT 316
|
||||||
#define TK_RANGE 317
|
#define TK_HAVING 317
|
||||||
#define TK_EVERY 318
|
#define TK_RANGE 318
|
||||||
#define TK_ORDER 319
|
#define TK_EVERY 319
|
||||||
#define TK_SLIMIT 320
|
#define TK_ORDER 320
|
||||||
#define TK_SOFFSET 321
|
#define TK_SLIMIT 321
|
||||||
#define TK_LIMIT 322
|
#define TK_SOFFSET 322
|
||||||
#define TK_OFFSET 323
|
#define TK_LIMIT 323
|
||||||
#define TK_ASC 324
|
#define TK_OFFSET 324
|
||||||
#define TK_NULLS 325
|
#define TK_ASC 325
|
||||||
#define TK_ABORT 326
|
#define TK_NULLS 326
|
||||||
#define TK_AFTER 327
|
#define TK_ABORT 327
|
||||||
#define TK_ATTACH 328
|
#define TK_AFTER 328
|
||||||
#define TK_BEFORE 329
|
#define TK_ATTACH 329
|
||||||
#define TK_BEGIN 330
|
#define TK_BEFORE 330
|
||||||
#define TK_BITAND 331
|
#define TK_BEGIN 331
|
||||||
#define TK_BITNOT 332
|
#define TK_BITAND 332
|
||||||
#define TK_BITOR 333
|
#define TK_BITNOT 333
|
||||||
#define TK_BLOCKS 334
|
#define TK_BITOR 334
|
||||||
#define TK_CHANGE 335
|
#define TK_BLOCKS 335
|
||||||
#define TK_COMMA 336
|
#define TK_CHANGE 336
|
||||||
#define TK_CONCAT 337
|
#define TK_COMMA 337
|
||||||
#define TK_CONFLICT 338
|
#define TK_CONCAT 338
|
||||||
#define TK_COPY 339
|
#define TK_CONFLICT 339
|
||||||
#define TK_DEFERRED 340
|
#define TK_COPY 340
|
||||||
#define TK_DELIMITERS 341
|
#define TK_DEFERRED 341
|
||||||
#define TK_DETACH 342
|
#define TK_DELIMITERS 342
|
||||||
#define TK_DIVIDE 343
|
#define TK_DETACH 343
|
||||||
#define TK_DOT 344
|
#define TK_DIVIDE 344
|
||||||
#define TK_EACH 345
|
#define TK_DOT 345
|
||||||
#define TK_FAIL 346
|
#define TK_EACH 346
|
||||||
#define TK_FILE 347
|
#define TK_FAIL 347
|
||||||
#define TK_FOR 348
|
#define TK_FILE 348
|
||||||
#define TK_GLOB 349
|
#define TK_FOR 349
|
||||||
#define TK_ID 350
|
#define TK_GLOB 350
|
||||||
#define TK_IMMEDIATE 351
|
#define TK_ID 351
|
||||||
#define TK_IMPORT 352
|
#define TK_IMMEDIATE 352
|
||||||
#define TK_INITIALLY 353
|
#define TK_IMPORT 353
|
||||||
#define TK_INSTEAD 354
|
#define TK_INITIALLY 354
|
||||||
#define TK_ISNULL 355
|
#define TK_INSTEAD 355
|
||||||
#define TK_MODULES 356
|
#define TK_ISNULL 356
|
||||||
#define TK_NK_BITNOT 357
|
#define TK_MODULES 357
|
||||||
#define TK_NK_SEMI 358
|
#define TK_NK_BITNOT 358
|
||||||
#define TK_NOTNULL 359
|
#define TK_NK_SEMI 359
|
||||||
#define TK_OF 360
|
#define TK_NOTNULL 360
|
||||||
#define TK_PLUS 361
|
#define TK_OF 361
|
||||||
#define TK_PRIVILEGE 362
|
#define TK_PLUS 362
|
||||||
#define TK_RAISE 363
|
#define TK_PRIVILEGE 363
|
||||||
#define TK_RESTRICT 364
|
#define TK_RAISE 364
|
||||||
#define TK_ROW 365
|
#define TK_RESTRICT 365
|
||||||
#define TK_STAR 366
|
#define TK_ROW 366
|
||||||
#define TK_STATEMENT 367
|
#define TK_STAR 367
|
||||||
#define TK_STRICT 368
|
#define TK_STATEMENT 368
|
||||||
#define TK_STRING 369
|
#define TK_STRICT 369
|
||||||
#define TK_TIMES 370
|
#define TK_STRING 370
|
||||||
#define TK_VALUES 371
|
#define TK_TIMES 371
|
||||||
#define TK_VARIABLE 372
|
#define TK_VALUES 372
|
||||||
#define TK_WAL 373
|
#define TK_VARIABLE 373
|
||||||
#define TK_ENCODE 374
|
#define TK_WAL 374
|
||||||
#define TK_COMPRESS 375
|
#define TK_ENCODE 375
|
||||||
#define TK_LEVEL 376
|
#define TK_COMPRESS 376
|
||||||
|
#define TK_LEVEL 377
|
||||||
|
|
||||||
#define TK_NK_SPACE 600
|
#define TK_NK_SPACE 600
|
||||||
#define TK_NK_COMMENT 601
|
#define TK_NK_COMMENT 601
|
||||||
|
|
|
@ -329,7 +329,7 @@ typedef struct {
|
||||||
|
|
||||||
typedef struct SStateStore {
|
typedef struct SStateStore {
|
||||||
int32_t (*streamStatePutParName)(SStreamState* pState, int64_t groupId, const char* tbname);
|
int32_t (*streamStatePutParName)(SStreamState* pState, int64_t groupId, const char* tbname);
|
||||||
int32_t (*streamStateGetParName)(SStreamState* pState, int64_t groupId, void** pVal);
|
int32_t (*streamStateGetParName)(SStreamState* pState, int64_t groupId, void** pVal, bool onlyCache);
|
||||||
|
|
||||||
int32_t (*streamStateAddIfNotExist)(SStreamState* pState, const SWinKey* key, void** pVal, int32_t* pVLen);
|
int32_t (*streamStateAddIfNotExist)(SStreamState* pState, const SWinKey* key, void** pVal, int32_t* pVLen);
|
||||||
int32_t (*streamStateReleaseBuf)(SStreamState* pState, void* pVal, bool used);
|
int32_t (*streamStateReleaseBuf)(SStreamState* pState, void* pVal, bool used);
|
||||||
|
@ -410,7 +410,7 @@ typedef struct SStateStore {
|
||||||
void (*streamFileStateClear)(struct SStreamFileState* pFileState);
|
void (*streamFileStateClear)(struct SStreamFileState* pFileState);
|
||||||
bool (*needClearDiskBuff)(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);
|
void (*streamStateClose)(SStreamState* pState, bool remove);
|
||||||
int32_t (*streamStateBegin)(SStreamState* pState);
|
int32_t (*streamStateBegin)(SStreamState* pState);
|
||||||
int32_t (*streamStateCommit)(SStreamState* pState);
|
int32_t (*streamStateCommit)(SStreamState* pState);
|
||||||
|
|
|
@ -258,6 +258,8 @@ typedef struct SCreateUserStmt {
|
||||||
char userName[TSDB_USER_LEN];
|
char userName[TSDB_USER_LEN];
|
||||||
char password[TSDB_USET_PASSWORD_LEN];
|
char password[TSDB_USET_PASSWORD_LEN];
|
||||||
int8_t sysinfo;
|
int8_t sysinfo;
|
||||||
|
int8_t createDb;
|
||||||
|
int8_t isImport;
|
||||||
int32_t numIpRanges;
|
int32_t numIpRanges;
|
||||||
SIpV4Range* pIpRanges;
|
SIpV4Range* pIpRanges;
|
||||||
|
|
||||||
|
@ -311,6 +313,7 @@ typedef struct SShowStmt {
|
||||||
SNode* pTbName; // SValueNode
|
SNode* pTbName; // SValueNode
|
||||||
EOperatorType tableCondType;
|
EOperatorType tableCondType;
|
||||||
EShowKind showKind; // show databases: user/system, show tables: normal/child, others NULL
|
EShowKind showKind; // show databases: user/system, show tables: normal/child, others NULL
|
||||||
|
bool withFull; // for show users full;
|
||||||
} SShowStmt;
|
} SShowStmt;
|
||||||
|
|
||||||
typedef struct SShowCreateDatabaseStmt {
|
typedef struct SShowCreateDatabaseStmt {
|
||||||
|
|
|
@ -628,6 +628,7 @@ char* nodesGetStrValueFromNode(SValueNode* pNode);
|
||||||
void nodesValueNodeToVariant(const SValueNode* pNode, SVariant* pVal);
|
void nodesValueNodeToVariant(const SValueNode* pNode, SVariant* pVal);
|
||||||
SValueNode* nodesMakeValueNodeFromString(char* literal);
|
SValueNode* nodesMakeValueNodeFromString(char* literal);
|
||||||
SValueNode* nodesMakeValueNodeFromBool(bool b);
|
SValueNode* nodesMakeValueNodeFromBool(bool b);
|
||||||
|
SNode* nodesMakeValueNodeFromInt32(int32_t value);
|
||||||
|
|
||||||
char* nodesGetFillModeString(EFillMode mode);
|
char* nodesGetFillModeString(EFillMode mode);
|
||||||
int32_t nodesMergeConds(SNode** pDst, SNodeList** pSrc);
|
int32_t nodesMergeConds(SNode** pDst, SNodeList** pSrc);
|
||||||
|
|
|
@ -29,8 +29,7 @@ extern "C" {
|
||||||
|
|
||||||
#include "storageapi.h"
|
#include "storageapi.h"
|
||||||
|
|
||||||
SStreamState* streamStateOpen(const char* path, void* pTask, int64_t streamId, int32_t taskId, bool specPath,
|
SStreamState* streamStateOpen(const char* path, void* pTask, int64_t streamId, int32_t taskId);
|
||||||
int32_t szPage, int32_t pages);
|
|
||||||
void streamStateClose(SStreamState* pState, bool remove);
|
void streamStateClose(SStreamState* pState, bool remove);
|
||||||
int32_t streamStateBegin(SStreamState* pState);
|
int32_t streamStateBegin(SStreamState* pState);
|
||||||
int32_t streamStateCommit(SStreamState* pState);
|
int32_t streamStateCommit(SStreamState* pState);
|
||||||
|
@ -102,7 +101,7 @@ int32_t streamStateCurNext(SStreamState* pState, SStreamStateCur* pCur);
|
||||||
int32_t streamStateCurPrev(SStreamState* pState, SStreamStateCur* pCur);
|
int32_t streamStateCurPrev(SStreamState* pState, SStreamStateCur* pCur);
|
||||||
|
|
||||||
int32_t streamStatePutParName(SStreamState* pState, int64_t groupId, const char* tbname);
|
int32_t streamStatePutParName(SStreamState* pState, int64_t groupId, const char* tbname);
|
||||||
int32_t streamStateGetParName(SStreamState* pState, int64_t groupId, void** pVal);
|
int32_t streamStateGetParName(SStreamState* pState, int64_t groupId, void** pVal, bool onlyCache);
|
||||||
|
|
||||||
void streamStateReloadInfo(SStreamState* pState, TSKEY ts);
|
void streamStateReloadInfo(SStreamState* pState, TSKEY ts);
|
||||||
|
|
||||||
|
|
|
@ -37,11 +37,12 @@ extern float tsNumOfCores;
|
||||||
extern int64_t tsTotalMemoryKB;
|
extern int64_t tsTotalMemoryKB;
|
||||||
extern char *tsProcPath;
|
extern char *tsProcPath;
|
||||||
extern char tsSIMDEnable;
|
extern char tsSIMDEnable;
|
||||||
extern char tsSSE42Enable;
|
extern char tsSSE42Supported;
|
||||||
extern char tsAVXEnable;
|
extern char tsAVXSupported;
|
||||||
extern char tsAVX2Enable;
|
extern char tsAVX2Supported;
|
||||||
extern char tsFMAEnable;
|
extern char tsFMASupported;
|
||||||
extern char tsAVX512Enable;
|
extern char tsAVX512Supported;
|
||||||
|
extern char tsAVX512Enable;
|
||||||
extern char tsTagFilterCache;
|
extern char tsTagFilterCache;
|
||||||
|
|
||||||
extern char configDir[];
|
extern char configDir[];
|
||||||
|
|
|
@ -549,6 +549,7 @@ typedef struct {
|
||||||
char dir[TSDB_FILENAME_LEN];
|
char dir[TSDB_FILENAME_LEN];
|
||||||
int32_t level;
|
int32_t level;
|
||||||
int32_t primary;
|
int32_t primary;
|
||||||
|
int8_t disable; // disable create new file
|
||||||
} SDiskCfg;
|
} SDiskCfg;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
|
@ -133,14 +133,15 @@ static int32_t hbUpdateUserAuthInfo(SAppHbMgr *pAppHbMgr, SUserAuthBatchRsp *bat
|
||||||
|
|
||||||
if (pTscObj->whiteListInfo.fp) {
|
if (pTscObj->whiteListInfo.fp) {
|
||||||
SWhiteListInfo *whiteListInfo = &pTscObj->whiteListInfo;
|
SWhiteListInfo *whiteListInfo = &pTscObj->whiteListInfo;
|
||||||
int64_t oldVer = atomic_load_64(&whiteListInfo->ver);
|
int64_t oldVer = atomic_load_64(&whiteListInfo->ver);
|
||||||
if (oldVer < pRsp->whiteListVer) {
|
|
||||||
|
if (oldVer < pRsp->whiteListVer || pRsp->whiteListVer == 0) {
|
||||||
atomic_store_64(&whiteListInfo->ver, pRsp->whiteListVer);
|
atomic_store_64(&whiteListInfo->ver, pRsp->whiteListVer);
|
||||||
if (whiteListInfo->fp) {
|
if (whiteListInfo->fp) {
|
||||||
(*whiteListInfo->fp)(whiteListInfo->param, &pRsp->whiteListVer, TAOS_NOTIFY_WHITELIST_VER);
|
(*whiteListInfo->fp)(whiteListInfo->param, &pRsp->whiteListVer, TAOS_NOTIFY_WHITELIST_VER);
|
||||||
}
|
}
|
||||||
tscDebug("update whitelist version of user %s from %"PRId64" to %"PRId64", tscRid:%" PRIi64, pRsp->user, oldVer,
|
tscDebug("update whitelist version of user %s from %" PRId64 " to %" PRId64 ", tscRid:%" PRIi64, pRsp->user,
|
||||||
atomic_load_64(&whiteListInfo->ver), pTscObj->id);
|
oldVer, atomic_load_64(&whiteListInfo->ver), pTscObj->id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
releaseTscObj(pReq->connKey.tscRid);
|
releaseTscObj(pReq->connKey.tscRid);
|
||||||
|
@ -202,8 +203,8 @@ static int32_t hbProcessDBInfoRsp(void *value, int32_t valueLen, struct SCatalog
|
||||||
for (int32_t i = 0; i < numOfBatchs; ++i) {
|
for (int32_t i = 0; i < numOfBatchs; ++i) {
|
||||||
SDbHbRsp *rsp = taosArrayGet(batchRsp.pArray, i);
|
SDbHbRsp *rsp = taosArrayGet(batchRsp.pArray, i);
|
||||||
if (rsp->useDbRsp) {
|
if (rsp->useDbRsp) {
|
||||||
tscDebug("hb use db rsp, db:%s, vgVersion:%d, stateTs:%" PRId64 ", uid:%" PRIx64,
|
tscDebug("hb use db rsp, db:%s, vgVersion:%d, stateTs:%" PRId64 ", uid:%" PRIx64, rsp->useDbRsp->db,
|
||||||
rsp->useDbRsp->db, rsp->useDbRsp->vgVersion, rsp->useDbRsp->stateTs, rsp->useDbRsp->uid);
|
rsp->useDbRsp->vgVersion, rsp->useDbRsp->stateTs, rsp->useDbRsp->uid);
|
||||||
|
|
||||||
if (rsp->useDbRsp->vgVersion < 0) {
|
if (rsp->useDbRsp->vgVersion < 0) {
|
||||||
tscDebug("hb to remove db, db:%s", rsp->useDbRsp->db);
|
tscDebug("hb to remove db, db:%s", rsp->useDbRsp->db);
|
||||||
|
@ -225,7 +226,9 @@ static int32_t hbProcessDBInfoRsp(void *value, int32_t valueLen, struct SCatalog
|
||||||
goto _return;
|
goto _return;
|
||||||
}
|
}
|
||||||
|
|
||||||
catalogUpdateDBVgInfo(pCatalog, (rsp->useDbRsp->db[0] == 'i') ? TSDB_PERFORMANCE_SCHEMA_DB : TSDB_INFORMATION_SCHEMA_DB, rsp->useDbRsp->uid, vgInfo);
|
catalogUpdateDBVgInfo(pCatalog,
|
||||||
|
(rsp->useDbRsp->db[0] == 'i') ? TSDB_PERFORMANCE_SCHEMA_DB : TSDB_INFORMATION_SCHEMA_DB,
|
||||||
|
rsp->useDbRsp->uid, vgInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -238,7 +241,7 @@ static int32_t hbProcessDBInfoRsp(void *value, int32_t valueLen, struct SCatalog
|
||||||
if (rsp->pTsmaRsp) {
|
if (rsp->pTsmaRsp) {
|
||||||
if (rsp->pTsmaRsp->pTsmas) {
|
if (rsp->pTsmaRsp->pTsmas) {
|
||||||
for (int32_t i = 0; i < rsp->pTsmaRsp->pTsmas->size; ++i) {
|
for (int32_t i = 0; i < rsp->pTsmaRsp->pTsmas->size; ++i) {
|
||||||
STableTSMAInfo* pTsma = taosArrayGetP(rsp->pTsmaRsp->pTsmas, i);
|
STableTSMAInfo *pTsma = taosArrayGetP(rsp->pTsmaRsp->pTsmas, i);
|
||||||
catalogAsyncUpdateTSMA(pCatalog, &pTsma, rsp->dbTsmaVersion);
|
catalogAsyncUpdateTSMA(pCatalog, &pTsma, rsp->dbTsmaVersion);
|
||||||
}
|
}
|
||||||
taosArrayClear(rsp->pTsmaRsp->pTsmas);
|
taosArrayClear(rsp->pTsmaRsp->pTsmas);
|
||||||
|
@ -294,16 +297,15 @@ static int32_t hbProcessStbInfoRsp(void *value, int32_t valueLen, struct SCatalo
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int32_t hbProcessDynViewRsp(void *value, int32_t valueLen, struct SCatalog *pCatalog) {
|
static int32_t hbProcessDynViewRsp(void *value, int32_t valueLen, struct SCatalog *pCatalog) {
|
||||||
return catalogUpdateDynViewVer(pCatalog, (SDynViewVersion*)value);
|
return catalogUpdateDynViewVer(pCatalog, (SDynViewVersion *)value);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void hbFreeSViewMetaInRsp(void* p) {
|
static void hbFreeSViewMetaInRsp(void *p) {
|
||||||
if (NULL == p || NULL == *(void**)p) {
|
if (NULL == p || NULL == *(void **)p) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
SViewMetaRsp *pRsp = *(SViewMetaRsp**)p;
|
SViewMetaRsp *pRsp = *(SViewMetaRsp **)p;
|
||||||
tFreeSViewMetaRsp(pRsp);
|
tFreeSViewMetaRsp(pRsp);
|
||||||
taosMemoryFreeClear(pRsp);
|
taosMemoryFreeClear(pRsp);
|
||||||
}
|
}
|
||||||
|
@ -337,7 +339,7 @@ static int32_t hbProcessViewInfoRsp(void *value, int32_t valueLen, struct SCatal
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t hbprocessTSMARsp(void* value, int32_t valueLen, struct SCatalog* pCatalog) {
|
static int32_t hbprocessTSMARsp(void *value, int32_t valueLen, struct SCatalog *pCatalog) {
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
|
|
||||||
STSMAHbRsp hbRsp = {0};
|
STSMAHbRsp hbRsp = {0};
|
||||||
|
@ -348,7 +350,7 @@ static int32_t hbprocessTSMARsp(void* value, int32_t valueLen, struct SCatalog*
|
||||||
|
|
||||||
int32_t numOfTsma = taosArrayGetSize(hbRsp.pTsmas);
|
int32_t numOfTsma = taosArrayGetSize(hbRsp.pTsmas);
|
||||||
for (int32_t i = 0; i < numOfTsma; ++i) {
|
for (int32_t i = 0; i < numOfTsma; ++i) {
|
||||||
STableTSMAInfo* pTsmaInfo = taosArrayGetP(hbRsp.pTsmas, i);
|
STableTSMAInfo *pTsmaInfo = taosArrayGetP(hbRsp.pTsmas, i);
|
||||||
|
|
||||||
if (!pTsmaInfo->pFuncs) {
|
if (!pTsmaInfo->pFuncs) {
|
||||||
tscDebug("hb to remove tsma: %s.%s", pTsmaInfo->dbFName, pTsmaInfo->name);
|
tscDebug("hb to remove tsma: %s.%s", pTsmaInfo->dbFName, pTsmaInfo->name);
|
||||||
|
@ -365,7 +367,7 @@ static int32_t hbprocessTSMARsp(void* value, int32_t valueLen, struct SCatalog*
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void hbProcessQueryRspKvs(int32_t kvNum, SArray* pKvs, struct SCatalog *pCatalog, SAppHbMgr *pAppHbMgr) {
|
static void hbProcessQueryRspKvs(int32_t kvNum, SArray *pKvs, struct SCatalog *pCatalog, SAppHbMgr *pAppHbMgr) {
|
||||||
for (int32_t i = 0; i < kvNum; ++i) {
|
for (int32_t i = 0; i < kvNum; ++i) {
|
||||||
SKv *kv = taosArrayGet(pKvs, i);
|
SKv *kv = taosArrayGet(pKvs, i);
|
||||||
switch (kv->key) {
|
switch (kv->key) {
|
||||||
|
@ -489,14 +491,14 @@ static int32_t hbQueryHbRspHandle(SAppHbMgr *pAppHbMgr, SClientHbRsp *pRsp) {
|
||||||
|
|
||||||
if (kvNum > 0) {
|
if (kvNum > 0) {
|
||||||
struct SCatalog *pCatalog = NULL;
|
struct SCatalog *pCatalog = NULL;
|
||||||
int32_t code = catalogGetHandle(pReq->clusterId, &pCatalog);
|
int32_t code = catalogGetHandle(pReq->clusterId, &pCatalog);
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
tscWarn("catalogGetHandle failed, clusterId:%" PRIx64 ", error:%s", pReq->clusterId, tstrerror(code));
|
tscWarn("catalogGetHandle failed, clusterId:%" PRIx64 ", error:%s", pReq->clusterId, tstrerror(code));
|
||||||
} else {
|
} else {
|
||||||
hbProcessQueryRspKvs(kvNum, pRsp->info, pCatalog, pAppHbMgr);
|
hbProcessQueryRspKvs(kvNum, pRsp->info, pCatalog, pAppHbMgr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
taosHashRelease(pAppHbMgr->activeInfo, pReq);
|
taosHashRelease(pAppHbMgr->activeInfo, pReq);
|
||||||
|
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
|
@ -799,8 +801,9 @@ int32_t hbGetExpiredDBInfo(SClientHbKey *connKey, struct SCatalog *pCatalog, SCl
|
||||||
|
|
||||||
for (int32_t i = 0; i < dbNum; ++i) {
|
for (int32_t i = 0; i < dbNum; ++i) {
|
||||||
SDbCacheInfo *db = &dbs[i];
|
SDbCacheInfo *db = &dbs[i];
|
||||||
tscDebug("the %dth expired dbFName:%s, dbId:%" PRId64 ", vgVersion:%d, cfgVersion:%d, numOfTable:%d, startTs:%" PRId64,
|
tscDebug("the %dth expired dbFName:%s, dbId:%" PRId64
|
||||||
i, db->dbFName, db->dbId, db->vgVersion, db->cfgVersion, db->numOfTable, db->stateTs);
|
", vgVersion:%d, cfgVersion:%d, numOfTable:%d, startTs:%" PRId64,
|
||||||
|
i, db->dbFName, db->dbId, db->vgVersion, db->cfgVersion, db->numOfTable, db->stateTs);
|
||||||
|
|
||||||
db->dbId = htobe64(db->dbId);
|
db->dbId = htobe64(db->dbId);
|
||||||
db->vgVersion = htonl(db->vgVersion);
|
db->vgVersion = htonl(db->vgVersion);
|
||||||
|
@ -916,7 +919,7 @@ int32_t hbGetExpiredViewInfo(SClientHbKey *connKey, struct SCatalog *pCatalog, S
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t hbGetExpiredTSMAInfo(SClientHbKey* connKey, struct SCatalog* pCatalog, SClientHbReq* pReq) {
|
int32_t hbGetExpiredTSMAInfo(SClientHbKey *connKey, struct SCatalog *pCatalog, SClientHbReq *pReq) {
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
uint32_t tsmaNum = 0;
|
uint32_t tsmaNum = 0;
|
||||||
STSMAVersion *tsmas = NULL;
|
STSMAVersion *tsmas = NULL;
|
||||||
|
@ -933,7 +936,7 @@ int32_t hbGetExpiredTSMAInfo(SClientHbKey* connKey, struct SCatalog* pCatalog, S
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int32_t i = 0; i < tsmaNum; ++i) {
|
for (int32_t i = 0; i < tsmaNum; ++i) {
|
||||||
STSMAVersion* tsma = &tsmas[i];
|
STSMAVersion *tsma = &tsmas[i];
|
||||||
tsma->dbId = htobe64(tsma->dbId);
|
tsma->dbId = htobe64(tsma->dbId);
|
||||||
tsma->tsmaId = htobe64(tsma->tsmaId);
|
tsma->tsmaId = htobe64(tsma->tsmaId);
|
||||||
tsma->version = htonl(tsma->version);
|
tsma->version = htonl(tsma->version);
|
||||||
|
@ -1012,7 +1015,7 @@ int32_t hbQueryHbReqHandle(SClientHbKey *connKey, void *param, SClientHbReq *req
|
||||||
if (TSDB_CODE_SUCCESS != code) {
|
if (TSDB_CODE_SUCCESS != code) {
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
code = hbGetExpiredTSMAInfo(connKey, pCatalog, req);
|
code = hbGetExpiredTSMAInfo(connKey, pCatalog, req);
|
||||||
} else {
|
} else {
|
||||||
req->app.appId = 0;
|
req->app.appId = 0;
|
||||||
|
@ -1151,7 +1154,8 @@ static void *hbThreadFunc(void *param) {
|
||||||
if (sz > 0) {
|
if (sz > 0) {
|
||||||
hbGatherAppInfo();
|
hbGatherAppInfo();
|
||||||
if (sz > 1 && !clientHbMgr.appHbHash) {
|
if (sz > 1 && !clientHbMgr.appHbHash) {
|
||||||
clientHbMgr.appHbHash = taosHashInit(0, taosGetDefaultHashFunction(TSDB_DATA_TYPE_UBIGINT), false, HASH_NO_LOCK);
|
clientHbMgr.appHbHash =
|
||||||
|
taosHashInit(0, taosGetDefaultHashFunction(TSDB_DATA_TYPE_UBIGINT), false, HASH_NO_LOCK);
|
||||||
}
|
}
|
||||||
taosHashClear(clientHbMgr.appHbHash);
|
taosHashClear(clientHbMgr.appHbHash);
|
||||||
}
|
}
|
||||||
|
@ -1433,6 +1437,4 @@ void hbDeregisterConn(STscObj *pTscObj, SClientHbKey connKey) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// set heart beat thread quit mode , if quicByKill 1 then kill thread else quit from inner
|
// set heart beat thread quit mode , if quicByKill 1 then kill thread else quit from inner
|
||||||
void taos_set_hb_quit(int8_t quitByKill) {
|
void taos_set_hb_quit(int8_t quitByKill) { clientHbMgr.quitByKill = quitByKill; }
|
||||||
clientHbMgr.quitByKill = quitByKill;
|
|
||||||
}
|
|
||||||
|
|
|
@ -1846,3 +1846,7 @@ int taos_set_conn_mode(TAOS* taos, int mode, int value) {
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char* getBuildInfo(){
|
||||||
|
return buildinfo;
|
||||||
|
}
|
|
@ -828,12 +828,8 @@ TEST(clientCase, projection_query_tables) {
|
||||||
// printf("error in create db, reason:%s\n", taos_errstr(pRes));
|
// printf("error in create db, reason:%s\n", taos_errstr(pRes));
|
||||||
// }
|
// }
|
||||||
// taos_free_result(pRes);
|
// taos_free_result(pRes);
|
||||||
/*
|
|
||||||
TAOS_RES* pRes = taos_query(pConn, "select last(ts), ts from cache_1.t1");
|
pRes= taos_query(pConn, "use abc1");
|
||||||
// pRes = taos_query(pConn, "select last(ts), ts from cache_1.no_pk_t1");
|
|
||||||
if (taos_errno(pRes) != 0) {
|
|
||||||
printf("failed to create table tu, reason:%s\n", taos_errstr(pRes));
|
|
||||||
}
|
|
||||||
taos_free_result(pRes);
|
taos_free_result(pRes);
|
||||||
|
|
||||||
pRes = taos_query(pConn, "create table tu using st2 tags(2)");
|
pRes = taos_query(pConn, "create table tu using st2 tags(2)");
|
||||||
|
@ -868,7 +864,6 @@ TEST(clientCase, projection_query_tables) {
|
||||||
createNewTable(pConn, i, 100000, 0, pstr);
|
createNewTable(pConn, i, 100000, 0, pstr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
pRes = taos_query(pConn, "select * from abc1.st2");
|
pRes = taos_query(pConn, "select * from abc1.st2");
|
||||||
if (taos_errno(pRes) != 0) {
|
if (taos_errno(pRes) != 0) {
|
||||||
|
|
|
@ -169,15 +169,22 @@ int32_t uploadByRsync(const char* id, const char* path) {
|
||||||
#else
|
#else
|
||||||
if (path[strlen(path) - 1] != '/') {
|
if (path[strlen(path) - 1] != '/') {
|
||||||
#endif
|
#endif
|
||||||
snprintf(command, PATH_MAX, "rsync -av --delete --timeout=10 --bwlimit=100000 %s/ rsync://%s/checkpoint/%s/",
|
snprintf(command, PATH_MAX,
|
||||||
|
"rsync -av --debug=all --log-file=%s/rsynclog --delete --timeout=10 --bwlimit=100000 %s/ "
|
||||||
|
"rsync://%s/checkpoint/%s/",
|
||||||
|
tsLogDir,
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
pathTransform
|
pathTransform
|
||||||
#else
|
#else
|
||||||
path
|
path
|
||||||
#endif
|
#endif
|
||||||
, tsSnodeAddress, id);
|
,
|
||||||
|
tsSnodeAddress, id);
|
||||||
} else {
|
} else {
|
||||||
snprintf(command, PATH_MAX, "rsync -av --delete --timeout=10 --bwlimit=100000 %s rsync://%s/checkpoint/%s/",
|
snprintf(command, PATH_MAX,
|
||||||
|
"rsync -av --debug=all --log-file=%s/rsynclog --delete --timeout=10 --bwlimit=100000 %s "
|
||||||
|
"rsync://%s/checkpoint/%s/",
|
||||||
|
tsLogDir,
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
pathTransform
|
pathTransform
|
||||||
#else
|
#else
|
||||||
|
@ -213,14 +220,15 @@ int32_t downloadRsync(const char* id, const char* path) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
char command[PATH_MAX] = {0};
|
char command[PATH_MAX] = {0};
|
||||||
snprintf(command, PATH_MAX, "rsync -av --debug=all --timeout=10 --bwlimit=100000 rsync://%s/checkpoint/%s/ %s",
|
snprintf(command, PATH_MAX,
|
||||||
tsSnodeAddress, id,
|
"rsync -av --debug=all --log-file=%s/rsynclog --timeout=10 --bwlimit=100000 rsync://%s/checkpoint/%s/ %s",
|
||||||
|
tsLogDir, tsSnodeAddress, id,
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
pathTransform
|
pathTransform
|
||||||
#else
|
#else
|
||||||
path
|
path
|
||||||
#endif
|
#endif
|
||||||
);
|
);
|
||||||
|
|
||||||
uDebug("[rsync] %s start to sync data from remote to:%s, %s", id, path, command);
|
uDebug("[rsync] %s start to sync data from remote to:%s, %s", id, path, command);
|
||||||
|
|
||||||
|
@ -249,7 +257,9 @@ int32_t deleteRsync(const char* id) {
|
||||||
}
|
}
|
||||||
|
|
||||||
char command[PATH_MAX] = {0};
|
char command[PATH_MAX] = {0};
|
||||||
snprintf(command, PATH_MAX, "rsync -av --delete --timeout=10 %s rsync://%s/checkpoint/%s/", tmp, tsSnodeAddress, id);
|
snprintf(command, PATH_MAX,
|
||||||
|
"rsync -av --debug=all --log-file=%s/rsynclog --delete --timeout=10 %s rsync://%s/checkpoint/%s/", tsLogDir,
|
||||||
|
tmp, tsSnodeAddress, id);
|
||||||
|
|
||||||
code = execCommand(command);
|
code = execCommand(command);
|
||||||
taosRemoveDir(tmp);
|
taosRemoveDir(tmp);
|
||||||
|
|
|
@ -269,6 +269,16 @@ static const SSysDbTableSchema userUsersSchema[] = {
|
||||||
{.name = "allowed_host", .bytes = TSDB_PRIVILEDGE_HOST_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
|
{.name = "allowed_host", .bytes = TSDB_PRIVILEDGE_HOST_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const SSysDbTableSchema userUsersFullSchema[] = {
|
||||||
|
{.name = "name", .bytes = TSDB_USER_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
|
||||||
|
{.name = "super", .bytes = 1, .type = TSDB_DATA_TYPE_TINYINT, .sysInfo = true},
|
||||||
|
{.name = "enable", .bytes = 1, .type = TSDB_DATA_TYPE_TINYINT, .sysInfo = true},
|
||||||
|
{.name = "sysinfo", .bytes = 1, .type = TSDB_DATA_TYPE_TINYINT, .sysInfo = true},
|
||||||
|
{.name = "createdb", .bytes = 1, .type = TSDB_DATA_TYPE_TINYINT, .sysInfo = true},
|
||||||
|
{.name = "encrypted_pass", .bytes = TSDB_USER_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
|
||||||
|
{.name = "allowed_host", .bytes = TSDB_PRIVILEDGE_HOST_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
|
||||||
|
};
|
||||||
|
|
||||||
GRANTS_SCHEMA;
|
GRANTS_SCHEMA;
|
||||||
|
|
||||||
static const SSysDbTableSchema vgroupsSchema[] = {
|
static const SSysDbTableSchema vgroupsSchema[] = {
|
||||||
|
@ -438,6 +448,7 @@ static const SSysTableMeta infosMeta[] = {
|
||||||
{TSDB_INS_TABLE_COLS, userColsSchema, tListLen(userColsSchema), false},
|
{TSDB_INS_TABLE_COLS, userColsSchema, tListLen(userColsSchema), false},
|
||||||
// {TSDB_INS_TABLE_TABLE_DISTRIBUTED, userTblDistSchema, tListLen(userTblDistSchema)},
|
// {TSDB_INS_TABLE_TABLE_DISTRIBUTED, userTblDistSchema, tListLen(userTblDistSchema)},
|
||||||
{TSDB_INS_TABLE_USERS, userUsersSchema, tListLen(userUsersSchema), true},
|
{TSDB_INS_TABLE_USERS, userUsersSchema, tListLen(userUsersSchema), true},
|
||||||
|
{TSDB_INS_TABLE_USERS_FULL, userUsersFullSchema, tListLen(userUsersFullSchema), true},
|
||||||
{TSDB_INS_TABLE_LICENCES, grantsSchema, tListLen(grantsSchema), true},
|
{TSDB_INS_TABLE_LICENCES, grantsSchema, tListLen(grantsSchema), true},
|
||||||
{TSDB_INS_TABLE_VGROUPS, vgroupsSchema, tListLen(vgroupsSchema), true},
|
{TSDB_INS_TABLE_VGROUPS, vgroupsSchema, tListLen(vgroupsSchema), true},
|
||||||
{TSDB_INS_TABLE_CONFIGS, configSchema, tListLen(configSchema), false},
|
{TSDB_INS_TABLE_CONFIGS, configSchema, tListLen(configSchema), false},
|
||||||
|
|
|
@ -326,6 +326,7 @@ int32_t taosSetTfsCfg(SConfig *pCfg) {
|
||||||
tstrncpy(tsDiskCfg[0].dir, pItem->str, TSDB_FILENAME_LEN);
|
tstrncpy(tsDiskCfg[0].dir, pItem->str, TSDB_FILENAME_LEN);
|
||||||
tsDiskCfg[0].level = 0;
|
tsDiskCfg[0].level = 0;
|
||||||
tsDiskCfg[0].primary = 1;
|
tsDiskCfg[0].primary = 1;
|
||||||
|
tsDiskCfg[0].disable = 0;
|
||||||
tstrncpy(tsDataDir, pItem->str, PATH_MAX);
|
tstrncpy(tsDataDir, pItem->str, PATH_MAX);
|
||||||
if (taosMulMkDir(tsDataDir) != 0) {
|
if (taosMulMkDir(tsDataDir) != 0) {
|
||||||
uError("failed to create dataDir:%s", tsDataDir);
|
uError("failed to create dataDir:%s", tsDataDir);
|
||||||
|
@ -595,12 +596,13 @@ static int32_t taosAddSystemCfg(SConfig *pCfg) {
|
||||||
if (cfgAddBool(pCfg, "enableCoreFile", 1, CFG_SCOPE_BOTH, CFG_DYN_CLIENT) != 0) return -1;
|
if (cfgAddBool(pCfg, "enableCoreFile", 1, CFG_SCOPE_BOTH, CFG_DYN_CLIENT) != 0) return -1;
|
||||||
if (cfgAddFloat(pCfg, "numOfCores", tsNumOfCores, 1, 100000, CFG_SCOPE_BOTH, CFG_DYN_NONE) != 0) return -1;
|
if (cfgAddFloat(pCfg, "numOfCores", tsNumOfCores, 1, 100000, CFG_SCOPE_BOTH, CFG_DYN_NONE) != 0) return -1;
|
||||||
|
|
||||||
if (cfgAddBool(pCfg, "ssd42", tsSSE42Enable, CFG_SCOPE_BOTH, CFG_DYN_NONE) != 0) return -1;
|
if (cfgAddBool(pCfg, "ssd42", tsSSE42Supported, CFG_SCOPE_BOTH, CFG_DYN_NONE) != 0) return -1;
|
||||||
if (cfgAddBool(pCfg, "avx", tsAVXEnable, CFG_SCOPE_BOTH, CFG_DYN_NONE) != 0) return -1;
|
if (cfgAddBool(pCfg, "avx", tsAVXSupported, CFG_SCOPE_BOTH, CFG_DYN_NONE) != 0) return -1;
|
||||||
if (cfgAddBool(pCfg, "avx2", tsAVX2Enable, CFG_SCOPE_BOTH, CFG_DYN_NONE) != 0) return -1;
|
if (cfgAddBool(pCfg, "avx2", tsAVX2Supported, CFG_SCOPE_BOTH, CFG_DYN_NONE) != 0) return -1;
|
||||||
if (cfgAddBool(pCfg, "fma", tsFMAEnable, CFG_SCOPE_BOTH, CFG_DYN_NONE) != 0) return -1;
|
if (cfgAddBool(pCfg, "fma", tsFMASupported, CFG_SCOPE_BOTH, CFG_DYN_NONE) != 0) return -1;
|
||||||
if (cfgAddBool(pCfg, "avx512", tsAVX512Enable, CFG_SCOPE_BOTH, CFG_DYN_NONE) != 0) return -1;
|
if (cfgAddBool(pCfg, "avx512", tsAVX512Supported, CFG_SCOPE_BOTH, CFG_DYN_NONE) != 0) return -1;
|
||||||
if (cfgAddBool(pCfg, "simdEnable", tsSIMDEnable, CFG_SCOPE_BOTH, CFG_DYN_NONE) != 0) return -1;
|
if (cfgAddBool(pCfg, "simdEnable", tsSIMDEnable, CFG_SCOPE_BOTH, CFG_DYN_NONE) != 0) return -1;
|
||||||
|
if (cfgAddBool(pCfg, "AVX512Enable", tsAVX512Enable, CFG_SCOPE_BOTH, CFG_DYN_NONE) != 0) return -1;
|
||||||
if (cfgAddBool(pCfg, "tagFilterCache", tsTagFilterCache, CFG_SCOPE_BOTH, CFG_DYN_NONE) != 0) return -1;
|
if (cfgAddBool(pCfg, "tagFilterCache", tsTagFilterCache, CFG_SCOPE_BOTH, CFG_DYN_NONE) != 0) return -1;
|
||||||
|
|
||||||
if (cfgAddInt64(pCfg, "openMax", tsOpenMax, 0, INT64_MAX, CFG_SCOPE_BOTH, CFG_DYN_NONE) != 0) return -1;
|
if (cfgAddInt64(pCfg, "openMax", tsOpenMax, 0, INT64_MAX, CFG_SCOPE_BOTH, CFG_DYN_NONE) != 0) return -1;
|
||||||
|
|
|
@ -817,7 +817,6 @@ int32_t tDeserializeSMAlterStbReq(void *buf, int32_t bufLen, SMAlterStbReq *pReq
|
||||||
|
|
||||||
for (int32_t i = 0; i < pReq->numOfFields; ++i) {
|
for (int32_t i = 0; i < pReq->numOfFields; ++i) {
|
||||||
if (pReq->alterType == TSDB_ALTER_TABLE_ADD_COLUMN_WITH_COMPRESS_OPTION) {
|
if (pReq->alterType == TSDB_ALTER_TABLE_ADD_COLUMN_WITH_COMPRESS_OPTION) {
|
||||||
|
|
||||||
taosArrayDestroy(pReq->pFields);
|
taosArrayDestroy(pReq->pFields);
|
||||||
pReq->pFields = taosArrayInit(pReq->numOfFields, sizeof(SFieldWithOptions));
|
pReq->pFields = taosArrayInit(pReq->numOfFields, sizeof(SFieldWithOptions));
|
||||||
SFieldWithOptions field = {0};
|
SFieldWithOptions field = {0};
|
||||||
|
@ -1637,8 +1636,10 @@ int32_t tSerializeSCreateUserReq(void *buf, int32_t bufLen, SCreateUserReq *pReq
|
||||||
if (tEncodeU32(&encoder, pReq->pIpRanges[i].ip) < 0) return -1;
|
if (tEncodeU32(&encoder, pReq->pIpRanges[i].ip) < 0) return -1;
|
||||||
if (tEncodeU32(&encoder, pReq->pIpRanges[i].mask) < 0) return -1;
|
if (tEncodeU32(&encoder, pReq->pIpRanges[i].mask) < 0) return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ENCODESQL();
|
ENCODESQL();
|
||||||
|
if (tEncodeI8(&encoder, pReq->isImport) < 0) return -1;
|
||||||
|
if (tEncodeI8(&encoder, pReq->createDb) < 0) return -1;
|
||||||
|
|
||||||
tEndEncode(&encoder);
|
tEndEncode(&encoder);
|
||||||
|
|
||||||
int32_t tlen = encoder.pos;
|
int32_t tlen = encoder.pos;
|
||||||
|
@ -1664,8 +1665,12 @@ int32_t tDeserializeSCreateUserReq(void *buf, int32_t bufLen, SCreateUserReq *pR
|
||||||
if (tDecodeU32(&decoder, &(pReq->pIpRanges[i].ip)) < 0) return -1;
|
if (tDecodeU32(&decoder, &(pReq->pIpRanges[i].ip)) < 0) return -1;
|
||||||
if (tDecodeU32(&decoder, &(pReq->pIpRanges[i].mask)) < 0) return -1;
|
if (tDecodeU32(&decoder, &(pReq->pIpRanges[i].mask)) < 0) return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
DECODESQL();
|
DECODESQL();
|
||||||
|
if (!tDecodeIsEnd(&decoder)) {
|
||||||
|
if (tDecodeI8(&decoder, &pReq->createDb) < 0) return -1;
|
||||||
|
if (tDecodeI8(&decoder, &pReq->isImport) < 0) return -1;
|
||||||
|
}
|
||||||
|
|
||||||
tEndDecode(&decoder);
|
tEndDecode(&decoder);
|
||||||
tDecoderClear(&decoder);
|
tDecoderClear(&decoder);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -4604,6 +4609,7 @@ int32_t tSerializeSRetrieveTableReq(void *buf, int32_t bufLen, SRetrieveTableReq
|
||||||
if (tEncodeCStr(&encoder, pReq->filterTb) < 0) return -1;
|
if (tEncodeCStr(&encoder, pReq->filterTb) < 0) return -1;
|
||||||
if (tEncodeCStr(&encoder, pReq->user) < 0) return -1;
|
if (tEncodeCStr(&encoder, pReq->user) < 0) return -1;
|
||||||
if (tEncodeI64(&encoder, pReq->compactId) < 0) return -1;
|
if (tEncodeI64(&encoder, pReq->compactId) < 0) return -1;
|
||||||
|
if (tEncodeI8(&encoder, pReq->withFull) < 0) return -1;
|
||||||
tEndEncode(&encoder);
|
tEndEncode(&encoder);
|
||||||
|
|
||||||
int32_t tlen = encoder.pos;
|
int32_t tlen = encoder.pos;
|
||||||
|
@ -4626,7 +4632,9 @@ int32_t tDeserializeSRetrieveTableReq(void *buf, int32_t bufLen, SRetrieveTableR
|
||||||
} else {
|
} else {
|
||||||
pReq->compactId = -1;
|
pReq->compactId = -1;
|
||||||
}
|
}
|
||||||
|
if (!tDecodeIsEnd(&decoder)) {
|
||||||
|
if (tDecodeI8(&decoder, (int8_t *)&pReq->withFull) < 0) return -1;
|
||||||
|
}
|
||||||
tEndDecode(&decoder);
|
tEndDecode(&decoder);
|
||||||
tDecoderClear(&decoder);
|
tDecoderClear(&decoder);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -110,10 +110,8 @@ static bool dmCheckDiskSpace() {
|
||||||
|
|
||||||
int32_t dmDiskInit() {
|
int32_t dmDiskInit() {
|
||||||
SDnode *pDnode = dmInstance();
|
SDnode *pDnode = dmInstance();
|
||||||
SDiskCfg dCfg = {0};
|
SDiskCfg dCfg = {.level = 0, .primary = 1, .disable = 0};
|
||||||
tstrncpy(dCfg.dir, tsDataDir, TSDB_FILENAME_LEN);
|
tstrncpy(dCfg.dir, tsDataDir, TSDB_FILENAME_LEN);
|
||||||
dCfg.level = 0;
|
|
||||||
dCfg.primary = 1;
|
|
||||||
SDiskCfg *pDisks = tsDiskCfg;
|
SDiskCfg *pDisks = tsDiskCfg;
|
||||||
int32_t numOfDisks = tsDiskCfgNum;
|
int32_t numOfDisks = tsDiskCfgNum;
|
||||||
if (numOfDisks <= 0 || pDisks == NULL) {
|
if (numOfDisks <= 0 || pDisks == NULL) {
|
||||||
|
|
|
@ -53,6 +53,7 @@ void mndUpdateIpWhiteForAllUser(SMnode *pMnode, char *user, char *fqdn, int8_t t
|
||||||
|
|
||||||
int32_t mndRefreshUserIpWhiteList(SMnode *pMnode);
|
int32_t mndRefreshUserIpWhiteList(SMnode *pMnode);
|
||||||
|
|
||||||
|
int64_t mndGetUserIpWhiteListVer(SMnode *pMnode, SUserObj *pUser);
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -13,20 +13,19 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
#include "mndCompact.h"
|
#include "mndCompact.h"
|
||||||
#include "mndTrans.h"
|
|
||||||
#include "mndShow.h"
|
|
||||||
#include "mndDb.h"
|
|
||||||
#include "mndCompactDetail.h"
|
|
||||||
#include "mndVgroup.h"
|
|
||||||
#include "tmsgcb.h"
|
|
||||||
#include "mndDnode.h"
|
|
||||||
#include "tmisce.h"
|
|
||||||
#include "audit.h"
|
#include "audit.h"
|
||||||
|
#include "mndCompactDetail.h"
|
||||||
|
#include "mndDb.h"
|
||||||
|
#include "mndDnode.h"
|
||||||
#include "mndPrivilege.h"
|
#include "mndPrivilege.h"
|
||||||
|
#include "mndShow.h"
|
||||||
#include "mndTrans.h"
|
#include "mndTrans.h"
|
||||||
|
#include "mndVgroup.h"
|
||||||
|
#include "tmisce.h"
|
||||||
|
#include "tmsgcb.h"
|
||||||
|
|
||||||
#define MND_COMPACT_VER_NUMBER 1
|
#define MND_COMPACT_VER_NUMBER 1
|
||||||
#define MND_COMPACT_ID_LEN 11
|
#define MND_COMPACT_ID_LEN 11
|
||||||
|
|
||||||
static int32_t mndProcessCompactTimer(SRpcMsg *pReq);
|
static int32_t mndProcessCompactTimer(SRpcMsg *pReq);
|
||||||
|
|
||||||
|
@ -50,12 +49,9 @@ int32_t mndInitCompact(SMnode *pMnode) {
|
||||||
return sdbSetTable(pMnode->pSdb, table);
|
return sdbSetTable(pMnode->pSdb, table);
|
||||||
}
|
}
|
||||||
|
|
||||||
void mndCleanupCompact(SMnode *pMnode) {
|
void mndCleanupCompact(SMnode *pMnode) { mDebug("mnd compact cleanup"); }
|
||||||
mDebug("mnd compact cleanup");
|
|
||||||
}
|
|
||||||
|
|
||||||
void tFreeCompactObj(SCompactObj *pCompact) {
|
void tFreeCompactObj(SCompactObj *pCompact) {}
|
||||||
}
|
|
||||||
|
|
||||||
int32_t tSerializeSCompactObj(void *buf, int32_t bufLen, const SCompactObj *pObj) {
|
int32_t tSerializeSCompactObj(void *buf, int32_t bufLen, const SCompactObj *pObj) {
|
||||||
SEncoder encoder = {0};
|
SEncoder encoder = {0};
|
||||||
|
@ -75,7 +71,7 @@ int32_t tSerializeSCompactObj(void *buf, int32_t bufLen, const SCompactObj *pObj
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tDeserializeSCompactObj(void *buf, int32_t bufLen, SCompactObj *pObj) {
|
int32_t tDeserializeSCompactObj(void *buf, int32_t bufLen, SCompactObj *pObj) {
|
||||||
int8_t ex = 0;
|
int8_t ex = 0;
|
||||||
SDecoder decoder = {0};
|
SDecoder decoder = {0};
|
||||||
tDecoderInit(&decoder, buf, bufLen);
|
tDecoderInit(&decoder, buf, bufLen);
|
||||||
|
|
||||||
|
@ -94,7 +90,7 @@ int32_t tDeserializeSCompactObj(void *buf, int32_t bufLen, SCompactObj *pObj) {
|
||||||
SSdbRaw *mndCompactActionEncode(SCompactObj *pCompact) {
|
SSdbRaw *mndCompactActionEncode(SCompactObj *pCompact) {
|
||||||
terrno = TSDB_CODE_SUCCESS;
|
terrno = TSDB_CODE_SUCCESS;
|
||||||
|
|
||||||
void *buf = NULL;
|
void *buf = NULL;
|
||||||
SSdbRaw *pRaw = NULL;
|
SSdbRaw *pRaw = NULL;
|
||||||
|
|
||||||
int32_t tlen = tSerializeSCompactObj(NULL, 0, pCompact);
|
int32_t tlen = tSerializeSCompactObj(NULL, 0, pCompact);
|
||||||
|
@ -102,8 +98,8 @@ SSdbRaw *mndCompactActionEncode(SCompactObj *pCompact) {
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
goto OVER;
|
goto OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t size = sizeof(int32_t) + tlen;
|
int32_t size = sizeof(int32_t) + tlen;
|
||||||
pRaw = sdbAllocRaw(SDB_COMPACT, MND_COMPACT_VER_NUMBER, size);
|
pRaw = sdbAllocRaw(SDB_COMPACT, MND_COMPACT_VER_NUMBER, size);
|
||||||
if (pRaw == NULL) {
|
if (pRaw == NULL) {
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
@ -127,7 +123,6 @@ SSdbRaw *mndCompactActionEncode(SCompactObj *pCompact) {
|
||||||
SDB_SET_BINARY(pRaw, dataPos, buf, tlen, OVER);
|
SDB_SET_BINARY(pRaw, dataPos, buf, tlen, OVER);
|
||||||
SDB_SET_DATALEN(pRaw, dataPos, OVER);
|
SDB_SET_DATALEN(pRaw, dataPos, OVER);
|
||||||
|
|
||||||
|
|
||||||
OVER:
|
OVER:
|
||||||
taosMemoryFreeClear(buf);
|
taosMemoryFreeClear(buf);
|
||||||
if (terrno != TSDB_CODE_SUCCESS) {
|
if (terrno != TSDB_CODE_SUCCESS) {
|
||||||
|
@ -141,9 +136,9 @@ OVER:
|
||||||
}
|
}
|
||||||
|
|
||||||
SSdbRow *mndCompactActionDecode(SSdbRaw *pRaw) {
|
SSdbRow *mndCompactActionDecode(SSdbRaw *pRaw) {
|
||||||
SSdbRow *pRow = NULL;
|
SSdbRow *pRow = NULL;
|
||||||
SCompactObj *pCompact = NULL;
|
SCompactObj *pCompact = NULL;
|
||||||
void *buf = NULL;
|
void *buf = NULL;
|
||||||
terrno = TSDB_CODE_SUCCESS;
|
terrno = TSDB_CODE_SUCCESS;
|
||||||
|
|
||||||
int8_t sver = 0;
|
int8_t sver = 0;
|
||||||
|
@ -184,7 +179,7 @@ SSdbRow *mndCompactActionDecode(SSdbRaw *pRaw) {
|
||||||
goto OVER;
|
goto OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
//taosInitRWLatch(&pView->lock);
|
// taosInitRWLatch(&pView->lock);
|
||||||
|
|
||||||
OVER:
|
OVER:
|
||||||
taosMemoryFreeClear(buf);
|
taosMemoryFreeClear(buf);
|
||||||
|
@ -210,15 +205,15 @@ int32_t mndCompactActionDelete(SSdb *pSdb, SCompactObj *pCompact) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t mndCompactActionUpdate(SSdb *pSdb, SCompactObj *pOldCompact, SCompactObj *pNewCompact) {
|
int32_t mndCompactActionUpdate(SSdb *pSdb, SCompactObj *pOldCompact, SCompactObj *pNewCompact) {
|
||||||
mTrace("compact:%" PRId32 ", perform update action, old row:%p new row:%p",
|
mTrace("compact:%" PRId32 ", perform update action, old row:%p new row:%p", pOldCompact->compactId, pOldCompact,
|
||||||
pOldCompact->compactId, pOldCompact, pNewCompact);
|
pNewCompact);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
SCompactObj *mndAcquireCompact(SMnode *pMnode, int64_t compactId) {
|
SCompactObj *mndAcquireCompact(SMnode *pMnode, int64_t compactId) {
|
||||||
SSdb *pSdb = pMnode->pSdb;
|
SSdb *pSdb = pMnode->pSdb;
|
||||||
SCompactObj *pCompact = sdbAcquire(pSdb, SDB_COMPACT, &compactId);
|
SCompactObj *pCompact = sdbAcquire(pSdb, SDB_COMPACT, &compactId);
|
||||||
if (pCompact == NULL && terrno == TSDB_CODE_SDB_OBJ_NOT_THERE) {
|
if (pCompact == NULL && terrno == TSDB_CODE_SDB_OBJ_NOT_THERE) {
|
||||||
terrno = TSDB_CODE_SUCCESS;
|
terrno = TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -230,8 +225,8 @@ void mndReleaseCompact(SMnode *pMnode, SCompactObj *pCompact) {
|
||||||
sdbRelease(pSdb, pCompact);
|
sdbRelease(pSdb, pCompact);
|
||||||
}
|
}
|
||||||
|
|
||||||
//compact db
|
// compact db
|
||||||
int32_t mndAddCompactToTran(SMnode *pMnode, STrans *pTrans, SCompactObj* pCompact, SDbObj *pDb, SCompactDbRsp *rsp){
|
int32_t mndAddCompactToTran(SMnode *pMnode, STrans *pTrans, SCompactObj *pCompact, SDbObj *pDb, SCompactDbRsp *rsp) {
|
||||||
pCompact->compactId = tGenIdPI32();
|
pCompact->compactId = tGenIdPI32();
|
||||||
|
|
||||||
strcpy(pCompact->dbname, pDb->name);
|
strcpy(pCompact->dbname, pDb->name);
|
||||||
|
@ -251,18 +246,19 @@ int32_t mndAddCompactToTran(SMnode *pMnode, STrans *pTrans, SCompactObj* pCompac
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//retrieve compact
|
// retrieve compact
|
||||||
int32_t mndRetrieveCompact(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows){
|
int32_t mndRetrieveCompact(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows) {
|
||||||
SMnode *pMnode = pReq->info.node;
|
SMnode *pMnode = pReq->info.node;
|
||||||
SSdb *pSdb = pMnode->pSdb;
|
SSdb *pSdb = pMnode->pSdb;
|
||||||
int32_t numOfRows = 0;
|
int32_t numOfRows = 0;
|
||||||
SCompactObj *pCompact = NULL;
|
SCompactObj *pCompact = NULL;
|
||||||
char *sep = NULL;
|
char *sep = NULL;
|
||||||
SDbObj *pDb = NULL;
|
SDbObj *pDb = NULL;
|
||||||
|
|
||||||
if (strlen(pShow->db) > 0) {
|
if (strlen(pShow->db) > 0) {
|
||||||
sep = strchr(pShow->db, '.');
|
sep = strchr(pShow->db, '.');
|
||||||
if (sep && ((0 == strcmp(sep + 1, TSDB_INFORMATION_SCHEMA_DB) || (0 == strcmp(sep + 1, TSDB_PERFORMANCE_SCHEMA_DB))))) {
|
if (sep &&
|
||||||
|
((0 == strcmp(sep + 1, TSDB_INFORMATION_SCHEMA_DB) || (0 == strcmp(sep + 1, TSDB_PERFORMANCE_SCHEMA_DB))))) {
|
||||||
sep++;
|
sep++;
|
||||||
} else {
|
} else {
|
||||||
pDb = mndAcquireDb(pMnode, pShow->db);
|
pDb = mndAcquireDb(pMnode, pShow->db);
|
||||||
|
@ -306,9 +302,9 @@ int32_t mndRetrieveCompact(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock,
|
||||||
return numOfRows;
|
return numOfRows;
|
||||||
}
|
}
|
||||||
|
|
||||||
//kill compact
|
// kill compact
|
||||||
static void *mndBuildKillCompactReq(SMnode *pMnode, SVgObj *pVgroup, int32_t *pContLen,
|
static void *mndBuildKillCompactReq(SMnode *pMnode, SVgObj *pVgroup, int32_t *pContLen, int32_t compactId,
|
||||||
int32_t compactId, int32_t dnodeid) {
|
int32_t dnodeid) {
|
||||||
SVKillCompactReq req = {0};
|
SVKillCompactReq req = {0};
|
||||||
req.compactId = compactId;
|
req.compactId = compactId;
|
||||||
req.vgId = pVgroup->vgId;
|
req.vgId = pVgroup->vgId;
|
||||||
|
@ -337,8 +333,8 @@ static void *mndBuildKillCompactReq(SMnode *pMnode, SVgObj *pVgroup, int32_t *pC
|
||||||
return pReq;
|
return pReq;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t mndAddKillCompactAction(SMnode *pMnode, STrans *pTrans, SVgObj *pVgroup,
|
static int32_t mndAddKillCompactAction(SMnode *pMnode, STrans *pTrans, SVgObj *pVgroup, int32_t compactId,
|
||||||
int32_t compactId, int32_t dnodeid) {
|
int32_t dnodeid) {
|
||||||
STransAction action = {0};
|
STransAction action = {0};
|
||||||
|
|
||||||
SDnodeObj *pDnode = mndAcquireDnode(pMnode, dnodeid);
|
SDnodeObj *pDnode = mndAcquireDnode(pMnode, dnodeid);
|
||||||
|
@ -365,7 +361,7 @@ static int32_t mndAddKillCompactAction(SMnode *pMnode, STrans *pTrans, SVgObj *p
|
||||||
static int32_t mndKillCompact(SMnode *pMnode, SRpcMsg *pReq, SCompactObj *pCompact) {
|
static int32_t mndKillCompact(SMnode *pMnode, SRpcMsg *pReq, SCompactObj *pCompact) {
|
||||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_DB, pReq, "kill-compact");
|
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_DB, pReq, "kill-compact");
|
||||||
if (pTrans == NULL) {
|
if (pTrans == NULL) {
|
||||||
mError("compact:%" PRId32 ", failed to drop since %s" , pCompact->compactId, terrstr());
|
mError("compact:%" PRId32 ", failed to drop since %s", pCompact->compactId, terrstr());
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
mInfo("trans:%d, used to kill compact:%" PRId32, pTrans->id, pCompact->compactId);
|
mInfo("trans:%d, used to kill compact:%" PRId32, pTrans->id, pCompact->compactId);
|
||||||
|
@ -388,13 +384,13 @@ static int32_t mndKillCompact(SMnode *pMnode, SRpcMsg *pReq, SCompactObj *pCompa
|
||||||
|
|
||||||
if (pDetail->compactId == pCompact->compactId) {
|
if (pDetail->compactId == pCompact->compactId) {
|
||||||
SVgObj *pVgroup = mndAcquireVgroup(pMnode, pDetail->vgId);
|
SVgObj *pVgroup = mndAcquireVgroup(pMnode, pDetail->vgId);
|
||||||
if(pVgroup == NULL){
|
if (pVgroup == NULL) {
|
||||||
mError("trans:%d, failed to append redo action since %s", pTrans->id, terrstr());
|
mError("trans:%d, failed to append redo action since %s", pTrans->id, terrstr());
|
||||||
mndTransDrop(pTrans);
|
mndTransDrop(pTrans);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mndAddKillCompactAction(pMnode, pTrans, pVgroup, pCompact->compactId, pDetail->dnodeId) != 0){
|
if (mndAddKillCompactAction(pMnode, pTrans, pVgroup, pCompact->compactId, pDetail->dnodeId) != 0) {
|
||||||
mError("trans:%d, failed to append redo action since %s", pTrans->id, terrstr());
|
mError("trans:%d, failed to append redo action since %s", pTrans->id, terrstr());
|
||||||
mndTransDrop(pTrans);
|
mndTransDrop(pTrans);
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -426,7 +422,7 @@ static int32_t mndKillCompact(SMnode *pMnode, SRpcMsg *pReq, SCompactObj *pCompa
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t mndProcessKillCompactReq(SRpcMsg *pReq){
|
int32_t mndProcessKillCompactReq(SRpcMsg *pReq) {
|
||||||
SKillCompactReq killCompactReq = {0};
|
SKillCompactReq killCompactReq = {0};
|
||||||
if (tDeserializeSKillCompactReq(pReq->pCont, pReq->contLen, &killCompactReq) != 0) {
|
if (tDeserializeSKillCompactReq(pReq->pCont, pReq->contLen, &killCompactReq) != 0) {
|
||||||
terrno = TSDB_CODE_INVALID_MSG;
|
terrno = TSDB_CODE_INVALID_MSG;
|
||||||
|
@ -435,10 +431,10 @@ int32_t mndProcessKillCompactReq(SRpcMsg *pReq){
|
||||||
|
|
||||||
mInfo("start to kill compact:%" PRId32, killCompactReq.compactId);
|
mInfo("start to kill compact:%" PRId32, killCompactReq.compactId);
|
||||||
|
|
||||||
SMnode *pMnode = pReq->info.node;
|
SMnode *pMnode = pReq->info.node;
|
||||||
int32_t code = -1;
|
int32_t code = -1;
|
||||||
SCompactObj *pCompact = mndAcquireCompact(pMnode, killCompactReq.compactId);
|
SCompactObj *pCompact = mndAcquireCompact(pMnode, killCompactReq.compactId);
|
||||||
if(pCompact == NULL){
|
if (pCompact == NULL) {
|
||||||
terrno = TSDB_CODE_MND_INVALID_COMPACT_ID;
|
terrno = TSDB_CODE_MND_INVALID_COMPACT_ID;
|
||||||
tFreeSKillCompactReq(&killCompactReq);
|
tFreeSKillCompactReq(&killCompactReq);
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -470,9 +466,10 @@ _OVER:
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
//update progress
|
// update progress
|
||||||
static int32_t mndUpdateCompactProgress(SMnode *pMnode, SRpcMsg *pReq, int32_t compactId, SQueryCompactProgressRsp* rsp) {
|
static int32_t mndUpdateCompactProgress(SMnode *pMnode, SRpcMsg *pReq, int32_t compactId,
|
||||||
void* pIter = NULL;
|
SQueryCompactProgressRsp *rsp) {
|
||||||
|
void *pIter = NULL;
|
||||||
while (1) {
|
while (1) {
|
||||||
SCompactDetailObj *pDetail = NULL;
|
SCompactDetailObj *pDetail = NULL;
|
||||||
pIter = sdbFetch(pMnode->pSdb, SDB_COMPACT_DETAIL, pIter, (void **)&pDetail);
|
pIter = sdbFetch(pMnode->pSdb, SDB_COMPACT_DETAIL, pIter, (void **)&pDetail);
|
||||||
|
@ -493,36 +490,36 @@ static int32_t mndUpdateCompactProgress(SMnode *pMnode, SRpcMsg *pReq, int32_t c
|
||||||
return TSDB_CODE_MND_COMPACT_DETAIL_NOT_EXIST;
|
return TSDB_CODE_MND_COMPACT_DETAIL_NOT_EXIST;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t mndProcessQueryCompactRsp(SRpcMsg *pReq){
|
int32_t mndProcessQueryCompactRsp(SRpcMsg *pReq) {
|
||||||
SQueryCompactProgressRsp req = {0};
|
SQueryCompactProgressRsp req = {0};
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
code = tDeserializeSQueryCompactProgressRsp(pReq->pCont, pReq->contLen, &req);
|
code = tDeserializeSQueryCompactProgressRsp(pReq->pCont, pReq->contLen, &req);
|
||||||
if (code != 0) {
|
if (code != 0) {
|
||||||
terrno = TSDB_CODE_INVALID_MSG;
|
terrno = TSDB_CODE_INVALID_MSG;
|
||||||
mError("failed to deserialize vnode-query-compact-progress-rsp, ret:%d, pCont:%p, len:%d",
|
mError("failed to deserialize vnode-query-compact-progress-rsp, ret:%d, pCont:%p, len:%d", code, pReq->pCont,
|
||||||
code, pReq->pCont, pReq->contLen);
|
pReq->contLen);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
mDebug("compact:%d, receive query response, vgId:%d, dnodeId:%d, numberFileset:%d, finished:%d",
|
mDebug("compact:%d, receive query response, vgId:%d, dnodeId:%d, numberFileset:%d, finished:%d", req.compactId,
|
||||||
req.compactId, req.vgId, req.dnodeId, req.numberFileset, req.finished);
|
req.vgId, req.dnodeId, req.numberFileset, req.finished);
|
||||||
|
|
||||||
SMnode *pMnode = pReq->info.node;
|
SMnode *pMnode = pReq->info.node;
|
||||||
|
|
||||||
code = mndUpdateCompactProgress(pMnode, pReq, req.compactId, &req);
|
code = mndUpdateCompactProgress(pMnode, pReq, req.compactId, &req);
|
||||||
if(code != 0){
|
if (code != 0) {
|
||||||
terrno = code;
|
terrno = code;
|
||||||
mError("compact:%d, failed to update progress, vgId:%d, dnodeId:%d, numberFileset:%d, finished:%d",
|
mError("compact:%d, failed to update progress, vgId:%d, dnodeId:%d, numberFileset:%d, finished:%d", req.compactId,
|
||||||
req.compactId, req.vgId, req.dnodeId, req.numberFileset, req.finished);
|
req.vgId, req.dnodeId, req.numberFileset, req.finished);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//timer
|
// timer
|
||||||
void mndCompactSendProgressReq(SMnode *pMnode, SCompactObj *pCompact){
|
void mndCompactSendProgressReq(SMnode *pMnode, SCompactObj *pCompact) {
|
||||||
void *pIter = NULL;
|
void *pIter = NULL;
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
SCompactDetailObj *pDetail = NULL;
|
SCompactDetailObj *pDetail = NULL;
|
||||||
|
@ -532,8 +529,8 @@ void mndCompactSendProgressReq(SMnode *pMnode, SCompactObj *pCompact){
|
||||||
if (pDetail->compactId == pCompact->compactId) {
|
if (pDetail->compactId == pCompact->compactId) {
|
||||||
SEpSet epSet = {0};
|
SEpSet epSet = {0};
|
||||||
|
|
||||||
SDnodeObj *pDnode = mndAcquireDnode(pMnode, pDetail->dnodeId);
|
SDnodeObj *pDnode = mndAcquireDnode(pMnode, pDetail->dnodeId);
|
||||||
if(pDnode == NULL) break;
|
if (pDnode == NULL) break;
|
||||||
addEpIntoEpSet(&epSet, pDnode->fqdn, pDnode->port);
|
addEpIntoEpSet(&epSet, pDnode->fqdn, pDnode->port);
|
||||||
mndReleaseDnode(pMnode, pDnode);
|
mndReleaseDnode(pMnode, pDnode);
|
||||||
|
|
||||||
|
@ -555,31 +552,29 @@ void mndCompactSendProgressReq(SMnode *pMnode, SCompactObj *pCompact){
|
||||||
sdbCancelFetch(pMnode->pSdb, pDetail);
|
sdbCancelFetch(pMnode->pSdb, pDetail);
|
||||||
sdbRelease(pMnode->pSdb, pDetail);
|
sdbRelease(pMnode->pSdb, pDetail);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
pHead->contLen = htonl(contLen);
|
pHead->contLen = htonl(contLen);
|
||||||
pHead->vgId = htonl(pDetail->vgId);
|
pHead->vgId = htonl(pDetail->vgId);
|
||||||
|
|
||||||
tSerializeSQueryCompactProgressReq((char *)pHead + sizeof(SMsgHead), contLen - sizeof(SMsgHead), &req);
|
tSerializeSQueryCompactProgressReq((char *)pHead + sizeof(SMsgHead), contLen - sizeof(SMsgHead), &req);
|
||||||
|
|
||||||
SRpcMsg rpcMsg = {.msgType = TDMT_VND_QUERY_COMPACT_PROGRESS,
|
SRpcMsg rpcMsg = {.msgType = TDMT_VND_QUERY_COMPACT_PROGRESS, .contLen = contLen};
|
||||||
.contLen = contLen};
|
|
||||||
|
|
||||||
//rpcMsg.pCont = rpcMallocCont(contLen);
|
|
||||||
//if (rpcMsg.pCont == NULL) {
|
|
||||||
// return;
|
|
||||||
//}
|
|
||||||
|
|
||||||
//memcpy(rpcMsg.pCont, pHead, contLen);
|
// rpcMsg.pCont = rpcMallocCont(contLen);
|
||||||
|
// if (rpcMsg.pCont == NULL) {
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// memcpy(rpcMsg.pCont, pHead, contLen);
|
||||||
|
|
||||||
rpcMsg.pCont = pHead;
|
rpcMsg.pCont = pHead;
|
||||||
|
|
||||||
char detail[1024] = {0};
|
char detail[1024] = {0};
|
||||||
int32_t len = snprintf(detail, sizeof(detail), "msgType:%s numOfEps:%d inUse:%d", TMSG_INFO(TDMT_VND_QUERY_COMPACT_PROGRESS),
|
int32_t len = snprintf(detail, sizeof(detail), "msgType:%s numOfEps:%d inUse:%d",
|
||||||
epSet.numOfEps, epSet.inUse);
|
TMSG_INFO(TDMT_VND_QUERY_COMPACT_PROGRESS), epSet.numOfEps, epSet.inUse);
|
||||||
for (int32_t i = 0; i < epSet.numOfEps; ++i) {
|
for (int32_t i = 0; i < epSet.numOfEps; ++i) {
|
||||||
len += snprintf(detail + len, sizeof(detail) - len, " ep:%d-%s:%u", i, epSet.eps[i].fqdn,
|
len += snprintf(detail + len, sizeof(detail) - len, " ep:%d-%s:%u", i, epSet.eps[i].fqdn, epSet.eps[i].port);
|
||||||
epSet.eps[i].port);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mDebug("compact:%d, send update progress msg to %s", pDetail->compactId, detail);
|
mDebug("compact:%d, send update progress msg to %s", pDetail->compactId, detail);
|
||||||
|
@ -592,40 +587,51 @@ void mndCompactSendProgressReq(SMnode *pMnode, SCompactObj *pCompact){
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t mndSaveCompactProgress(SMnode *pMnode, int32_t compactId) {
|
static int32_t mndSaveCompactProgress(SMnode *pMnode, int32_t compactId) {
|
||||||
bool needSave = false;
|
bool needSave = false;
|
||||||
void* pIter = NULL;
|
void *pIter = NULL;
|
||||||
while (1) {
|
while (1) {
|
||||||
SCompactDetailObj *pDetail = NULL;
|
SCompactDetailObj *pDetail = NULL;
|
||||||
pIter = sdbFetch(pMnode->pSdb, SDB_COMPACT_DETAIL, pIter, (void **)&pDetail);
|
pIter = sdbFetch(pMnode->pSdb, SDB_COMPACT_DETAIL, pIter, (void **)&pDetail);
|
||||||
if (pIter == NULL) break;
|
if (pIter == NULL) break;
|
||||||
|
|
||||||
if (pDetail->compactId == compactId) {
|
if (pDetail->compactId == compactId) {
|
||||||
mDebug("compact:%d, check save progress, vgId:%d, dnodeId:%d, numberFileset:%d, finished:%d, "
|
mDebug(
|
||||||
"newNumberFileset:%d, newFinished:%d",
|
"compact:%d, check save progress, vgId:%d, dnodeId:%d, numberFileset:%d, finished:%d, "
|
||||||
pDetail->compactId, pDetail->vgId, pDetail->dnodeId, pDetail->numberFileset, pDetail->finished,
|
"newNumberFileset:%d, newFinished:%d",
|
||||||
pDetail->newNumberFileset, pDetail->newFinished);
|
pDetail->compactId, pDetail->vgId, pDetail->dnodeId, pDetail->numberFileset, pDetail->finished,
|
||||||
|
pDetail->newNumberFileset, pDetail->newFinished);
|
||||||
|
|
||||||
//these 2 number will jump back after dnode restart, so < is not used here
|
// these 2 number will jump back after dnode restart, so < is not used here
|
||||||
if(pDetail->numberFileset != pDetail->newNumberFileset || pDetail->finished != pDetail->newFinished)
|
if (pDetail->numberFileset != pDetail->newNumberFileset || pDetail->finished != pDetail->newFinished)
|
||||||
needSave = true;
|
needSave = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
sdbRelease(pMnode->pSdb, pDetail);
|
sdbRelease(pMnode->pSdb, pDetail);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!needSave) {
|
SCompactObj *pCompact = mndAcquireCompact(pMnode, compactId);
|
||||||
mDebug("compact:%" PRId32 ", no need to save" , compactId);
|
if (pCompact == NULL) return 0;
|
||||||
|
|
||||||
|
SDbObj *pDb = mndAcquireDb(pMnode, pCompact->dbname);
|
||||||
|
if (pDb == NULL) {
|
||||||
|
needSave = true;
|
||||||
|
mWarn("compact:%" PRId32 ", no db exist, set needSave:%s", compactId, pCompact->dbname);
|
||||||
|
} else {
|
||||||
|
mndReleaseDb(pMnode, pDb);
|
||||||
|
pDb = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!needSave) {
|
||||||
|
mDebug("compact:%" PRId32 ", no need to save", compactId);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_DB, NULL, "update-compact-progress");
|
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_DB, NULL, "update-compact-progress");
|
||||||
if (pTrans == NULL) {
|
if (pTrans == NULL) {
|
||||||
mError("trans:%" PRId32 ", failed to create since %s" , pTrans->id, terrstr());
|
mError("trans:%" PRId32 ", failed to create since %s", pTrans->id, terrstr());
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
mInfo("compact:%d, trans:%d, used to update compact progress.", compactId, pTrans->id);
|
mInfo("compact:%d, trans:%d, used to update compact progress.", compactId, pTrans->id);
|
||||||
|
|
||||||
SCompactObj *pCompact = mndAcquireCompact(pMnode, compactId);
|
|
||||||
|
|
||||||
mndTransSetDbName(pTrans, pCompact->dbname, NULL);
|
mndTransSetDbName(pTrans, pCompact->dbname, NULL);
|
||||||
|
|
||||||
|
@ -636,14 +642,15 @@ static int32_t mndSaveCompactProgress(SMnode *pMnode, int32_t compactId) {
|
||||||
if (pIter == NULL) break;
|
if (pIter == NULL) break;
|
||||||
|
|
||||||
if (pDetail->compactId == compactId) {
|
if (pDetail->compactId == compactId) {
|
||||||
mInfo("compact:%d, trans:%d, check compact progress, vgId:%d, dnodeId:%d, numberFileset:%d, finished:%d, "
|
mInfo(
|
||||||
"newNumberFileset:%d, newFinished:%d",
|
"compact:%d, trans:%d, check compact progress, vgId:%d, dnodeId:%d, numberFileset:%d, finished:%d, "
|
||||||
pDetail->compactId, pTrans->id, pDetail->vgId, pDetail->dnodeId, pDetail->numberFileset, pDetail->finished,
|
"newNumberFileset:%d, newFinished:%d",
|
||||||
pDetail->newNumberFileset, pDetail->newFinished);
|
pDetail->compactId, pTrans->id, pDetail->vgId, pDetail->dnodeId, pDetail->numberFileset, pDetail->finished,
|
||||||
|
pDetail->newNumberFileset, pDetail->newFinished);
|
||||||
|
|
||||||
pDetail->numberFileset = pDetail->newNumberFileset;
|
pDetail->numberFileset = pDetail->newNumberFileset;
|
||||||
pDetail->finished = pDetail->newFinished;
|
pDetail->finished = pDetail->newFinished;
|
||||||
|
|
||||||
SSdbRaw *pCommitRaw = mndCompactDetailActionEncode(pDetail);
|
SSdbRaw *pCommitRaw = mndCompactDetailActionEncode(pDetail);
|
||||||
if (pCommitRaw == NULL || mndTransAppendCommitlog(pTrans, pCommitRaw) != 0) {
|
if (pCommitRaw == NULL || mndTransAppendCommitlog(pTrans, pCommitRaw) != 0) {
|
||||||
mError("compact:%d, trans:%d, failed to append commit log since %s", pDetail->compactId, pTrans->id, terrstr());
|
mError("compact:%d, trans:%d, failed to append commit log since %s", pDetail->compactId, pTrans->id, terrstr());
|
||||||
|
@ -657,22 +664,22 @@ static int32_t mndSaveCompactProgress(SMnode *pMnode, int32_t compactId) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool allFinished = true;
|
bool allFinished = true;
|
||||||
|
pIter = NULL;
|
||||||
while (1) {
|
while (1) {
|
||||||
SCompactDetailObj *pDetail = NULL;
|
SCompactDetailObj *pDetail = NULL;
|
||||||
pIter = sdbFetch(pMnode->pSdb, SDB_COMPACT_DETAIL, pIter, (void **)&pDetail);
|
pIter = sdbFetch(pMnode->pSdb, SDB_COMPACT_DETAIL, pIter, (void **)&pDetail);
|
||||||
if (pIter == NULL) break;
|
if (pIter == NULL) break;
|
||||||
|
|
||||||
if(pDetail->compactId == compactId){
|
if (pDetail->compactId == compactId) {
|
||||||
mInfo("compact:%d, trans:%d, check compact finished, vgId:%d, dnodeId:%d, numberFileset:%d, finished:%d",
|
mInfo("compact:%d, trans:%d, check compact finished, vgId:%d, dnodeId:%d, numberFileset:%d, finished:%d",
|
||||||
pDetail->compactId, pTrans->id, pDetail->vgId, pDetail->dnodeId, pDetail->numberFileset, pDetail->finished);
|
pDetail->compactId, pTrans->id, pDetail->vgId, pDetail->dnodeId, pDetail->numberFileset, pDetail->finished);
|
||||||
|
|
||||||
if(pDetail->numberFileset == -1 && pDetail->finished == -1){
|
if (pDetail->numberFileset == -1 && pDetail->finished == -1) {
|
||||||
allFinished = false;
|
allFinished = false;
|
||||||
sdbRelease(pMnode->pSdb, pDetail);
|
sdbRelease(pMnode->pSdb, pDetail);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (pDetail->numberFileset != -1 && pDetail->finished != -1 &&
|
if (pDetail->numberFileset != -1 && pDetail->finished != -1 && pDetail->numberFileset != pDetail->finished) {
|
||||||
pDetail->numberFileset != pDetail->finished) {
|
|
||||||
allFinished = false;
|
allFinished = false;
|
||||||
sdbRelease(pMnode->pSdb, pDetail);
|
sdbRelease(pMnode->pSdb, pDetail);
|
||||||
break;
|
break;
|
||||||
|
@ -682,21 +689,33 @@ static int32_t mndSaveCompactProgress(SMnode *pMnode, int32_t compactId) {
|
||||||
sdbRelease(pMnode->pSdb, pDetail);
|
sdbRelease(pMnode->pSdb, pDetail);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(allFinished){
|
pDb = mndAcquireDb(pMnode, pCompact->dbname);
|
||||||
|
if (pDb == NULL) {
|
||||||
|
allFinished = true;
|
||||||
|
mWarn("compact:%" PRId32 ", no db exist, set all finished:%s", compactId, pCompact->dbname);
|
||||||
|
} else {
|
||||||
|
mndReleaseDb(pMnode, pDb);
|
||||||
|
pDb = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (allFinished) {
|
||||||
mInfo("compact:%d, all finished", pCompact->compactId);
|
mInfo("compact:%d, all finished", pCompact->compactId);
|
||||||
|
pIter = NULL;
|
||||||
while (1) {
|
while (1) {
|
||||||
SCompactDetailObj *pDetail = NULL;
|
SCompactDetailObj *pDetail = NULL;
|
||||||
pIter = sdbFetch(pMnode->pSdb, SDB_COMPACT_DETAIL, pIter, (void **)&pDetail);
|
pIter = sdbFetch(pMnode->pSdb, SDB_COMPACT_DETAIL, pIter, (void **)&pDetail);
|
||||||
if (pIter == NULL) break;
|
if (pIter == NULL) break;
|
||||||
|
|
||||||
if (pDetail->compactId == pCompact->compactId) {
|
if (pDetail->compactId == pCompact->compactId) {
|
||||||
SSdbRaw *pCommitRaw = mndCompactDetailActionEncode(pDetail);
|
SSdbRaw *pCommitRaw = mndCompactDetailActionEncode(pDetail);
|
||||||
if (pCommitRaw == NULL || mndTransAppendCommitlog(pTrans, pCommitRaw) != 0) {
|
if (pCommitRaw == NULL || mndTransAppendCommitlog(pTrans, pCommitRaw) != 0) {
|
||||||
mError("compact:%d, trans:%d, failed to append commit log since %s", pDetail->compactId, pTrans->id, terrstr());
|
mError("compact:%d, trans:%d, failed to append commit log since %s", pDetail->compactId, pTrans->id,
|
||||||
|
terrstr());
|
||||||
mndTransDrop(pTrans);
|
mndTransDrop(pTrans);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
(void)sdbSetRawStatus(pCommitRaw, SDB_STATUS_DROPPED);
|
(void)sdbSetRawStatus(pCommitRaw, SDB_STATUS_DROPPED);
|
||||||
|
mInfo("compact:%d, add drop compactdetail action", pDetail->compactDetailId);
|
||||||
}
|
}
|
||||||
|
|
||||||
sdbRelease(pMnode->pSdb, pDetail);
|
sdbRelease(pMnode->pSdb, pDetail);
|
||||||
|
@ -709,6 +728,7 @@ static int32_t mndSaveCompactProgress(SMnode *pMnode, int32_t compactId) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
(void)sdbSetRawStatus(pCommitRaw, SDB_STATUS_DROPPED);
|
(void)sdbSetRawStatus(pCommitRaw, SDB_STATUS_DROPPED);
|
||||||
|
mInfo("compact:%d, add drop compact action", pCompact->compactId);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mndTransPrepare(pMnode, pTrans) != 0) {
|
if (mndTransPrepare(pMnode, pTrans) != 0) {
|
||||||
|
@ -739,8 +759,8 @@ void mndCompactPullup(SMnode *pMnode) {
|
||||||
|
|
||||||
for (int32_t i = 0; i < taosArrayGetSize(pArray); ++i) {
|
for (int32_t i = 0; i < taosArrayGetSize(pArray); ++i) {
|
||||||
mInfo("begin to pull up");
|
mInfo("begin to pull up");
|
||||||
int32_t *pCompactId = taosArrayGet(pArray, i);
|
int32_t *pCompactId = taosArrayGet(pArray, i);
|
||||||
SCompactObj *pCompact = mndAcquireCompact(pMnode, *pCompactId);
|
SCompactObj *pCompact = mndAcquireCompact(pMnode, *pCompactId);
|
||||||
if (pCompact != NULL) {
|
if (pCompact != NULL) {
|
||||||
mInfo("compact:%d, begin to pull up", pCompact->compactId);
|
mInfo("compact:%d, begin to pull up", pCompact->compactId);
|
||||||
mndCompactSendProgressReq(pMnode, pCompact);
|
mndCompactSendProgressReq(pMnode, pCompact);
|
||||||
|
|
|
@ -75,7 +75,13 @@ int32_t mndBuildInsTableSchema(SMnode *pMnode, const char *dbFName, const char *
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
STableMetaRsp *pMeta = taosHashGet(pMnode->infosMeta, tbName, strlen(tbName));
|
STableMetaRsp *pMeta = NULL;
|
||||||
|
if (strcmp(tbName, TSDB_INS_TABLE_USERS_FULL) == 0) {
|
||||||
|
pMeta = taosHashGet(pMnode->infosMeta, TSDB_INS_TABLE_USERS_FULL, strlen(tbName));
|
||||||
|
} else {
|
||||||
|
pMeta = taosHashGet(pMnode->infosMeta, tbName, strlen(tbName));
|
||||||
|
}
|
||||||
|
|
||||||
if (NULL == pMeta) {
|
if (NULL == pMeta) {
|
||||||
mError("invalid information schema table name:%s", tbName);
|
mError("invalid information schema table name:%s", tbName);
|
||||||
terrno = TSDB_CODE_PAR_TABLE_NOT_EXIST;
|
terrno = TSDB_CODE_PAR_TABLE_NOT_EXIST;
|
||||||
|
|
|
@ -31,7 +31,6 @@ int32_t mndCheckDbPrivilegeByName(SMnode *pMnode, const char *user, EOperType op
|
||||||
|
|
||||||
int32_t mndCheckTopicPrivilege(SMnode *pMnode, const char *user, EOperType operType, SMqTopicObj *pTopic) { return 0; }
|
int32_t mndCheckTopicPrivilege(SMnode *pMnode, const char *user, EOperType operType, SMqTopicObj *pTopic) { return 0; }
|
||||||
|
|
||||||
|
|
||||||
int32_t mndSetUserWhiteListRsp(SMnode *pMnode, SUserObj *pUser, SGetUserWhiteListRsp *pWhiteListRsp) {
|
int32_t mndSetUserWhiteListRsp(SMnode *pMnode, SUserObj *pUser, SGetUserWhiteListRsp *pWhiteListRsp) {
|
||||||
memcpy(pWhiteListRsp->user, pUser->user, TSDB_USER_LEN);
|
memcpy(pWhiteListRsp->user, pUser->user, TSDB_USER_LEN);
|
||||||
pWhiteListRsp->numWhiteLists = 1;
|
pWhiteListRsp->numWhiteLists = 1;
|
||||||
|
@ -41,25 +40,6 @@ int32_t mndSetUserWhiteListRsp(SMnode *pMnode, SUserObj *pUser, SGetUserWhiteLis
|
||||||
}
|
}
|
||||||
memset(pWhiteListRsp->pWhiteLists, 0, pWhiteListRsp->numWhiteLists * sizeof(SIpV4Range));
|
memset(pWhiteListRsp->pWhiteLists, 0, pWhiteListRsp->numWhiteLists * sizeof(SIpV4Range));
|
||||||
|
|
||||||
// if (tsEnableWhiteList) {
|
|
||||||
// memcpy(pWhiteListRsp->user, pUser->user, TSDB_USER_LEN);
|
|
||||||
// pWhiteListRsp->numWhiteLists = pUser->pIpWhiteList->num;
|
|
||||||
// pWhiteListRsp->pWhiteLists = taosMemoryMalloc(pWhiteListRsp->numWhiteLists * sizeof(SIpV4Range));
|
|
||||||
// if (pWhiteListRsp->pWhiteLists == NULL) {
|
|
||||||
// return TSDB_CODE_OUT_OF_MEMORY;
|
|
||||||
// }
|
|
||||||
// memcpy(pWhiteListRsp->pWhiteLists, pUser->pIpWhiteList->pIpRange,
|
|
||||||
// pWhiteListRsp->numWhiteLists * sizeof(SIpV4Range));
|
|
||||||
// } else {
|
|
||||||
// memcpy(pWhiteListRsp->user, pUser->user, TSDB_USER_LEN);
|
|
||||||
// pWhiteListRsp->numWhiteLists = 1;
|
|
||||||
// pWhiteListRsp->pWhiteLists = taosMemoryMalloc(pWhiteListRsp->numWhiteLists * sizeof(SIpV4Range));
|
|
||||||
// if (pWhiteListRsp->pWhiteLists == NULL) {
|
|
||||||
// return TSDB_CODE_OUT_OF_MEMORY;
|
|
||||||
// }
|
|
||||||
// memset(pWhiteListRsp->pWhiteLists, 0, pWhiteListRsp->numWhiteLists * sizeof(SIpV4Range));
|
|
||||||
// }
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,7 +50,7 @@ int32_t mndSetUserAuthRsp(SMnode *pMnode, SUserObj *pUser, SGetUserAuthRsp *pRsp
|
||||||
pRsp->sysInfo = pUser->sysInfo;
|
pRsp->sysInfo = pUser->sysInfo;
|
||||||
pRsp->version = pUser->authVersion;
|
pRsp->version = pUser->authVersion;
|
||||||
pRsp->passVer = pUser->passVersion;
|
pRsp->passVer = pUser->passVersion;
|
||||||
pRsp->whiteListVer = pUser->ipWhiteListVer;
|
pRsp->whiteListVer = mndGetUserIpWhiteListVer(pMnode, pUser);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -300,7 +300,7 @@ _CONNECT:
|
||||||
connectRsp.svrTimestamp = taosGetTimestampSec();
|
connectRsp.svrTimestamp = taosGetTimestampSec();
|
||||||
connectRsp.passVer = pUser->passVersion;
|
connectRsp.passVer = pUser->passVersion;
|
||||||
connectRsp.authVer = pUser->authVersion;
|
connectRsp.authVer = pUser->authVersion;
|
||||||
connectRsp.whiteListVer = pUser->ipWhiteListVer;
|
connectRsp.whiteListVer = mndGetUserIpWhiteListVer(pMnode, pUser);
|
||||||
|
|
||||||
strcpy(connectRsp.sVer, version);
|
strcpy(connectRsp.sVer, version);
|
||||||
snprintf(connectRsp.sDetailVer, sizeof(connectRsp.sDetailVer), "ver:%s\nbuild:%s\ngitinfo:%s", version, buildinfo,
|
snprintf(connectRsp.sDetailVer, sizeof(connectRsp.sDetailVer), "ver:%s\nbuild:%s\ngitinfo:%s", version, buildinfo,
|
||||||
|
|
|
@ -89,6 +89,8 @@ static int32_t convertToRetrieveType(char *name, int32_t len) {
|
||||||
// type = TSDB_MGMT_TABLE_DIST;
|
// type = TSDB_MGMT_TABLE_DIST;
|
||||||
} else if (strncasecmp(name, TSDB_INS_TABLE_USERS, len) == 0) {
|
} else if (strncasecmp(name, TSDB_INS_TABLE_USERS, len) == 0) {
|
||||||
type = TSDB_MGMT_TABLE_USER;
|
type = TSDB_MGMT_TABLE_USER;
|
||||||
|
} else if (strncasecmp(name, TSDB_INS_TABLE_USERS_FULL, len) == 0) {
|
||||||
|
type = TSDB_MGMT_TABLE_USER_FULL;
|
||||||
} else if (strncasecmp(name, TSDB_INS_TABLE_LICENCES, len) == 0) {
|
} else if (strncasecmp(name, TSDB_INS_TABLE_LICENCES, len) == 0) {
|
||||||
type = TSDB_MGMT_TABLE_GRANTS;
|
type = TSDB_MGMT_TABLE_GRANTS;
|
||||||
} else if (strncasecmp(name, TSDB_INS_TABLE_VGROUPS, len) == 0) {
|
} else if (strncasecmp(name, TSDB_INS_TABLE_VGROUPS, len) == 0) {
|
||||||
|
@ -276,6 +278,13 @@ static int32_t mndProcessRetrieveSysTableReq(SRpcMsg *pReq) {
|
||||||
if (retrieveReq.db[0] && mndCheckShowPrivilege(pMnode, pReq->info.conn.user, pShow->type, retrieveReq.db) != 0) {
|
if (retrieveReq.db[0] && mndCheckShowPrivilege(pMnode, pReq->info.conn.user, pShow->type, retrieveReq.db) != 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
if (pShow->type == TSDB_MGMT_TABLE_USER_FULL) {
|
||||||
|
if(strcmp(pReq->info.conn.user, "root") != 0){
|
||||||
|
mError("The operation is not permitted, user:%s, pShow->type:%d", pReq->info.conn.user, pShow->type);
|
||||||
|
terrno = TSDB_CODE_MND_NO_RIGHTS;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int32_t numOfCols = pShow->pMeta->numOfColumns;
|
int32_t numOfCols = pShow->pMeta->numOfColumns;
|
||||||
|
|
||||||
|
|
|
@ -1766,7 +1766,7 @@ static int32_t mndUpdateSuperTableColumnCompress(SMnode *pMnode, const SStbObj *
|
||||||
uint32_t dst = 0;
|
uint32_t dst = 0;
|
||||||
updated = tUpdateCompress(pCmpr->alg, p->bytes, TSDB_COLVAL_COMPRESS_DISABLED, TSDB_COLVAL_LEVEL_DISABLED,
|
updated = tUpdateCompress(pCmpr->alg, p->bytes, TSDB_COLVAL_COMPRESS_DISABLED, TSDB_COLVAL_LEVEL_DISABLED,
|
||||||
TSDB_COLVAL_LEVEL_MEDIUM, &dst);
|
TSDB_COLVAL_LEVEL_MEDIUM, &dst);
|
||||||
if (updated) pCmpr->alg = dst;
|
if (updated > 0) pCmpr->alg = dst;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1774,7 +1774,11 @@ static int32_t mndUpdateSuperTableColumnCompress(SMnode *pMnode, const SStbObj *
|
||||||
if (updated == 0) {
|
if (updated == 0) {
|
||||||
terrno = TSDB_CODE_MND_COLUMN_COMPRESS_ALREADY_EXIST;
|
terrno = TSDB_CODE_MND_COLUMN_COMPRESS_ALREADY_EXIST;
|
||||||
return -1;
|
return -1;
|
||||||
|
} else if (updated == -1) {
|
||||||
|
terrno = TSDB_CODE_TSC_COMPRESS_LEVEL_ERROR;
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
pNew->colVer++;
|
pNew->colVer++;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -45,35 +45,55 @@
|
||||||
#define ALTER_USER_DEL_PRIVS(_type) ((_type) == TSDB_ALTER_USER_DEL_PRIVILEGES)
|
#define ALTER_USER_DEL_PRIVS(_type) ((_type) == TSDB_ALTER_USER_DEL_PRIVILEGES)
|
||||||
|
|
||||||
#define ALTER_USER_ALL_PRIV(_priv) (BIT_FLAG_TEST_MASK((_priv), PRIVILEGE_TYPE_ALL))
|
#define ALTER_USER_ALL_PRIV(_priv) (BIT_FLAG_TEST_MASK((_priv), PRIVILEGE_TYPE_ALL))
|
||||||
#define ALTER_USER_READ_PRIV(_priv) (BIT_FLAG_TEST_MASK((_priv), PRIVILEGE_TYPE_READ) || BIT_FLAG_TEST_MASK((_priv), PRIVILEGE_TYPE_ALL))
|
#define ALTER_USER_READ_PRIV(_priv) \
|
||||||
#define ALTER_USER_WRITE_PRIV(_priv) (BIT_FLAG_TEST_MASK((_priv), PRIVILEGE_TYPE_WRITE) || BIT_FLAG_TEST_MASK((_priv), PRIVILEGE_TYPE_ALL))
|
(BIT_FLAG_TEST_MASK((_priv), PRIVILEGE_TYPE_READ) || BIT_FLAG_TEST_MASK((_priv), PRIVILEGE_TYPE_ALL))
|
||||||
#define ALTER_USER_ALTER_PRIV(_priv) (BIT_FLAG_TEST_MASK((_priv), PRIVILEGE_TYPE_ALTER) || BIT_FLAG_TEST_MASK((_priv), PRIVILEGE_TYPE_ALL))
|
#define ALTER_USER_WRITE_PRIV(_priv) \
|
||||||
|
(BIT_FLAG_TEST_MASK((_priv), PRIVILEGE_TYPE_WRITE) || BIT_FLAG_TEST_MASK((_priv), PRIVILEGE_TYPE_ALL))
|
||||||
|
#define ALTER_USER_ALTER_PRIV(_priv) \
|
||||||
|
(BIT_FLAG_TEST_MASK((_priv), PRIVILEGE_TYPE_ALTER) || BIT_FLAG_TEST_MASK((_priv), PRIVILEGE_TYPE_ALL))
|
||||||
#define ALTER_USER_SUBSCRIBE_PRIV(_priv) (BIT_FLAG_TEST_MASK((_priv), PRIVILEGE_TYPE_SUBSCRIBE))
|
#define ALTER_USER_SUBSCRIBE_PRIV(_priv) (BIT_FLAG_TEST_MASK((_priv), PRIVILEGE_TYPE_SUBSCRIBE))
|
||||||
|
|
||||||
#define ALTER_USER_TARGET_DB(_tbname) (0 == (_tbname)[0])
|
#define ALTER_USER_TARGET_DB(_tbname) (0 == (_tbname)[0])
|
||||||
#define ALTER_USER_TARGET_TB(_tbname) (0 != (_tbname)[0])
|
#define ALTER_USER_TARGET_TB(_tbname) (0 != (_tbname)[0])
|
||||||
|
|
||||||
#define ALTER_USER_ADD_READ_DB_PRIV(_type, _priv, _tbname) (ALTER_USER_ADD_PRIVS(_type) && ALTER_USER_READ_PRIV(_priv) && ALTER_USER_TARGET_DB(_tbname))
|
#define ALTER_USER_ADD_READ_DB_PRIV(_type, _priv, _tbname) \
|
||||||
#define ALTER_USER_DEL_READ_DB_PRIV(_type, _priv, _tbname) (ALTER_USER_DEL_PRIVS(_type) && ALTER_USER_READ_PRIV(_priv) && ALTER_USER_TARGET_DB(_tbname))
|
(ALTER_USER_ADD_PRIVS(_type) && ALTER_USER_READ_PRIV(_priv) && ALTER_USER_TARGET_DB(_tbname))
|
||||||
#define ALTER_USER_ADD_WRITE_DB_PRIV(_type, _priv, _tbname) (ALTER_USER_ADD_PRIVS(_type) && ALTER_USER_WRITE_PRIV(_priv) && ALTER_USER_TARGET_DB(_tbname))
|
#define ALTER_USER_DEL_READ_DB_PRIV(_type, _priv, _tbname) \
|
||||||
#define ALTER_USER_DEL_WRITE_DB_PRIV(_type, _priv, _tbname) (ALTER_USER_DEL_PRIVS(_type) && ALTER_USER_WRITE_PRIV(_priv) && ALTER_USER_TARGET_DB(_tbname))
|
(ALTER_USER_DEL_PRIVS(_type) && ALTER_USER_READ_PRIV(_priv) && ALTER_USER_TARGET_DB(_tbname))
|
||||||
#define ALTER_USER_ADD_ALTER_DB_PRIV(_type, _priv, _tbname) (ALTER_USER_ADD_PRIVS(_type) && ALTER_USER_ALTER_PRIV(_priv) && ALTER_USER_TARGET_DB(_tbname))
|
#define ALTER_USER_ADD_WRITE_DB_PRIV(_type, _priv, _tbname) \
|
||||||
#define ALTER_USER_DEL_ALTER_DB_PRIV(_type, _priv, _tbname) (ALTER_USER_DEL_PRIVS(_type) && ALTER_USER_ALTER_PRIV(_priv) && ALTER_USER_TARGET_DB(_tbname))
|
(ALTER_USER_ADD_PRIVS(_type) && ALTER_USER_WRITE_PRIV(_priv) && ALTER_USER_TARGET_DB(_tbname))
|
||||||
#define ALTER_USER_ADD_ALL_DB_PRIV(_type, _priv, _tbname) (ALTER_USER_ADD_PRIVS(_type) && ALTER_USER_ALL_PRIV(_priv) && ALTER_USER_TARGET_DB(_tbname))
|
#define ALTER_USER_DEL_WRITE_DB_PRIV(_type, _priv, _tbname) \
|
||||||
#define ALTER_USER_DEL_ALL_DB_PRIV(_type, _priv, _tbname) (ALTER_USER_DEL_PRIVS(_type) && ALTER_USER_ALL_PRIV(_priv) && ALTER_USER_TARGET_DB(_tbname))
|
(ALTER_USER_DEL_PRIVS(_type) && ALTER_USER_WRITE_PRIV(_priv) && ALTER_USER_TARGET_DB(_tbname))
|
||||||
|
#define ALTER_USER_ADD_ALTER_DB_PRIV(_type, _priv, _tbname) \
|
||||||
|
(ALTER_USER_ADD_PRIVS(_type) && ALTER_USER_ALTER_PRIV(_priv) && ALTER_USER_TARGET_DB(_tbname))
|
||||||
|
#define ALTER_USER_DEL_ALTER_DB_PRIV(_type, _priv, _tbname) \
|
||||||
|
(ALTER_USER_DEL_PRIVS(_type) && ALTER_USER_ALTER_PRIV(_priv) && ALTER_USER_TARGET_DB(_tbname))
|
||||||
|
#define ALTER_USER_ADD_ALL_DB_PRIV(_type, _priv, _tbname) \
|
||||||
|
(ALTER_USER_ADD_PRIVS(_type) && ALTER_USER_ALL_PRIV(_priv) && ALTER_USER_TARGET_DB(_tbname))
|
||||||
|
#define ALTER_USER_DEL_ALL_DB_PRIV(_type, _priv, _tbname) \
|
||||||
|
(ALTER_USER_DEL_PRIVS(_type) && ALTER_USER_ALL_PRIV(_priv) && ALTER_USER_TARGET_DB(_tbname))
|
||||||
|
|
||||||
#define ALTER_USER_ADD_READ_TB_PRIV(_type, _priv, _tbname) (ALTER_USER_ADD_PRIVS(_type) && ALTER_USER_READ_PRIV(_priv) && ALTER_USER_TARGET_TB(_tbname))
|
#define ALTER_USER_ADD_READ_TB_PRIV(_type, _priv, _tbname) \
|
||||||
#define ALTER_USER_DEL_READ_TB_PRIV(_type, _priv, _tbname) (ALTER_USER_DEL_PRIVS(_type) && ALTER_USER_READ_PRIV(_priv) && ALTER_USER_TARGET_TB(_tbname))
|
(ALTER_USER_ADD_PRIVS(_type) && ALTER_USER_READ_PRIV(_priv) && ALTER_USER_TARGET_TB(_tbname))
|
||||||
#define ALTER_USER_ADD_WRITE_TB_PRIV(_type, _priv, _tbname) (ALTER_USER_ADD_PRIVS(_type) && ALTER_USER_WRITE_PRIV(_priv) && ALTER_USER_TARGET_TB(_tbname))
|
#define ALTER_USER_DEL_READ_TB_PRIV(_type, _priv, _tbname) \
|
||||||
#define ALTER_USER_DEL_WRITE_TB_PRIV(_type, _priv, _tbname) (ALTER_USER_DEL_PRIVS(_type) && ALTER_USER_WRITE_PRIV(_priv) && ALTER_USER_TARGET_TB(_tbname))
|
(ALTER_USER_DEL_PRIVS(_type) && ALTER_USER_READ_PRIV(_priv) && ALTER_USER_TARGET_TB(_tbname))
|
||||||
#define ALTER_USER_ADD_ALTER_TB_PRIV(_type, _priv, _tbname) (ALTER_USER_ADD_PRIVS(_type) && ALTER_USER_ALTER_PRIV(_priv) && ALTER_USER_TARGET_TB(_tbname))
|
#define ALTER_USER_ADD_WRITE_TB_PRIV(_type, _priv, _tbname) \
|
||||||
#define ALTER_USER_DEL_ALTER_TB_PRIV(_type, _priv, _tbname) (ALTER_USER_DEL_PRIVS(_type) && ALTER_USER_ALTER_PRIV(_priv) && ALTER_USER_TARGET_TB(_tbname))
|
(ALTER_USER_ADD_PRIVS(_type) && ALTER_USER_WRITE_PRIV(_priv) && ALTER_USER_TARGET_TB(_tbname))
|
||||||
#define ALTER_USER_ADD_ALL_TB_PRIV(_type, _priv, _tbname) (ALTER_USER_ADD_PRIVS(_type) && ALTER_USER_ALL_PRIV(_priv) && ALTER_USER_TARGET_TB(_tbname))
|
#define ALTER_USER_DEL_WRITE_TB_PRIV(_type, _priv, _tbname) \
|
||||||
#define ALTER_USER_DEL_ALL_TB_PRIV(_type, _priv, _tbname) (ALTER_USER_DEL_PRIVS(_type) && ALTER_USER_ALL_PRIV(_priv) && ALTER_USER_TARGET_TB(_tbname))
|
(ALTER_USER_DEL_PRIVS(_type) && ALTER_USER_WRITE_PRIV(_priv) && ALTER_USER_TARGET_TB(_tbname))
|
||||||
|
#define ALTER_USER_ADD_ALTER_TB_PRIV(_type, _priv, _tbname) \
|
||||||
#define ALTER_USER_ADD_SUBSCRIBE_TOPIC_PRIV(_type, _priv) (ALTER_USER_ADD_PRIVS(_type) && ALTER_USER_SUBSCRIBE_PRIV(_priv))
|
(ALTER_USER_ADD_PRIVS(_type) && ALTER_USER_ALTER_PRIV(_priv) && ALTER_USER_TARGET_TB(_tbname))
|
||||||
#define ALTER_USER_DEL_SUBSCRIBE_TOPIC_PRIV(_type, _priv) (ALTER_USER_DEL_PRIVS(_type) && ALTER_USER_SUBSCRIBE_PRIV(_priv))
|
#define ALTER_USER_DEL_ALTER_TB_PRIV(_type, _priv, _tbname) \
|
||||||
|
(ALTER_USER_DEL_PRIVS(_type) && ALTER_USER_ALTER_PRIV(_priv) && ALTER_USER_TARGET_TB(_tbname))
|
||||||
|
#define ALTER_USER_ADD_ALL_TB_PRIV(_type, _priv, _tbname) \
|
||||||
|
(ALTER_USER_ADD_PRIVS(_type) && ALTER_USER_ALL_PRIV(_priv) && ALTER_USER_TARGET_TB(_tbname))
|
||||||
|
#define ALTER_USER_DEL_ALL_TB_PRIV(_type, _priv, _tbname) \
|
||||||
|
(ALTER_USER_DEL_PRIVS(_type) && ALTER_USER_ALL_PRIV(_priv) && ALTER_USER_TARGET_TB(_tbname))
|
||||||
|
|
||||||
|
#define ALTER_USER_ADD_SUBSCRIBE_TOPIC_PRIV(_type, _priv) \
|
||||||
|
(ALTER_USER_ADD_PRIVS(_type) && ALTER_USER_SUBSCRIBE_PRIV(_priv))
|
||||||
|
#define ALTER_USER_DEL_SUBSCRIBE_TOPIC_PRIV(_type, _priv) \
|
||||||
|
(ALTER_USER_DEL_PRIVS(_type) && ALTER_USER_SUBSCRIBE_PRIV(_priv))
|
||||||
|
|
||||||
static SIpWhiteList *createDefaultIpWhiteList();
|
static SIpWhiteList *createDefaultIpWhiteList();
|
||||||
SIpWhiteList *createIpWhiteList(void *buf, int32_t len);
|
SIpWhiteList *createIpWhiteList(void *buf, int32_t len);
|
||||||
|
@ -97,6 +117,7 @@ static int32_t mndProcessDropUserReq(SRpcMsg *pReq);
|
||||||
static int32_t mndProcessGetUserAuthReq(SRpcMsg *pReq);
|
static int32_t mndProcessGetUserAuthReq(SRpcMsg *pReq);
|
||||||
static int32_t mndProcessGetUserWhiteListReq(SRpcMsg *pReq);
|
static int32_t mndProcessGetUserWhiteListReq(SRpcMsg *pReq);
|
||||||
static int32_t mndRetrieveUsers(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows);
|
static int32_t mndRetrieveUsers(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows);
|
||||||
|
static int32_t mndRetrieveUsersFull(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows);
|
||||||
static void mndCancelGetNextUser(SMnode *pMnode, void *pIter);
|
static void mndCancelGetNextUser(SMnode *pMnode, void *pIter);
|
||||||
static int32_t mndRetrievePrivileges(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows);
|
static int32_t mndRetrievePrivileges(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows);
|
||||||
static void mndCancelGetNextPrivileges(SMnode *pMnode, void *pIter);
|
static void mndCancelGetNextPrivileges(SMnode *pMnode, void *pIter);
|
||||||
|
@ -502,6 +523,8 @@ int32_t mndInitUser(SMnode *pMnode) {
|
||||||
|
|
||||||
mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_USER, mndRetrieveUsers);
|
mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_USER, mndRetrieveUsers);
|
||||||
mndAddShowFreeIterHandle(pMnode, TSDB_MGMT_TABLE_USER, mndCancelGetNextUser);
|
mndAddShowFreeIterHandle(pMnode, TSDB_MGMT_TABLE_USER, mndCancelGetNextUser);
|
||||||
|
mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_USER_FULL, mndRetrieveUsersFull);
|
||||||
|
mndAddShowFreeIterHandle(pMnode, TSDB_MGMT_TABLE_USER_FULL, mndCancelGetNextUser);
|
||||||
mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_PRIVILEGES, mndRetrievePrivileges);
|
mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_PRIVILEGES, mndRetrievePrivileges);
|
||||||
mndAddShowFreeIterHandle(pMnode, TSDB_MGMT_TABLE_PRIVILEGES, mndCancelGetNextPrivileges);
|
mndAddShowFreeIterHandle(pMnode, TSDB_MGMT_TABLE_PRIVILEGES, mndCancelGetNextPrivileges);
|
||||||
return sdbSetTable(pMnode->pSdb, table);
|
return sdbSetTable(pMnode->pSdb, table);
|
||||||
|
@ -1440,7 +1463,12 @@ void mndReleaseUser(SMnode *pMnode, SUserObj *pUser) {
|
||||||
|
|
||||||
static int32_t mndCreateUser(SMnode *pMnode, char *acct, SCreateUserReq *pCreate, SRpcMsg *pReq) {
|
static int32_t mndCreateUser(SMnode *pMnode, char *acct, SCreateUserReq *pCreate, SRpcMsg *pReq) {
|
||||||
SUserObj userObj = {0};
|
SUserObj userObj = {0};
|
||||||
taosEncryptPass_c((uint8_t *)pCreate->pass, strlen(pCreate->pass), userObj.pass);
|
if (pCreate->isImport != 1) {
|
||||||
|
taosEncryptPass_c((uint8_t *)pCreate->pass, strlen(pCreate->pass), userObj.pass);
|
||||||
|
} else {
|
||||||
|
// mInfo("pCreate->pass:%s", pCreate->pass)
|
||||||
|
strncpy(userObj.pass, pCreate->pass, TSDB_PASSWORD_LEN);
|
||||||
|
}
|
||||||
tstrncpy(userObj.user, pCreate->user, TSDB_USER_LEN);
|
tstrncpy(userObj.user, pCreate->user, TSDB_USER_LEN);
|
||||||
tstrncpy(userObj.acct, acct, TSDB_USER_LEN);
|
tstrncpy(userObj.acct, acct, TSDB_USER_LEN);
|
||||||
userObj.createdTime = taosGetTimestampMs();
|
userObj.createdTime = taosGetTimestampMs();
|
||||||
|
@ -1448,7 +1476,7 @@ static int32_t mndCreateUser(SMnode *pMnode, char *acct, SCreateUserReq *pCreate
|
||||||
userObj.superUser = 0; // pCreate->superUser;
|
userObj.superUser = 0; // pCreate->superUser;
|
||||||
userObj.sysInfo = pCreate->sysInfo;
|
userObj.sysInfo = pCreate->sysInfo;
|
||||||
userObj.enable = pCreate->enable;
|
userObj.enable = pCreate->enable;
|
||||||
userObj.createdb = 0;
|
userObj.createdb = pCreate->createDb;
|
||||||
|
|
||||||
if (pCreate->numIpRanges == 0) {
|
if (pCreate->numIpRanges == 0) {
|
||||||
userObj.pIpWhiteList = createDefaultIpWhiteList();
|
userObj.pIpWhiteList = createDefaultIpWhiteList();
|
||||||
|
@ -1534,10 +1562,25 @@ static int32_t mndProcessCreateUserReq(SRpcMsg *pReq) {
|
||||||
goto _OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
mInfo("user:%s, start to create", createReq.user);
|
mInfo("user:%s, start to create, createdb:%d, is_import:%d", createReq.user, createReq.isImport, createReq.createDb);
|
||||||
if (mndCheckOperPrivilege(pMnode, pReq->info.conn.user, MND_OPER_CREATE_USER) != 0) {
|
|
||||||
|
#ifndef TD_ENTERPRISE
|
||||||
|
if (createReq.isImport == 1) {
|
||||||
goto _OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (createReq.isImport != 1) {
|
||||||
|
if (mndCheckOperPrivilege(pMnode, pReq->info.conn.user, MND_OPER_CREATE_USER) != 0) {
|
||||||
|
goto _OVER;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (strcmp(pReq->info.conn.user, "root") != 0) {
|
||||||
|
mError("The operation is not permitted, user:%s", pReq->info.conn.user);
|
||||||
|
terrno = TSDB_CODE_MND_NO_RIGHTS;
|
||||||
|
goto _OVER;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (createReq.user[0] == 0) {
|
if (createReq.user[0] == 0) {
|
||||||
terrno = TSDB_CODE_MND_INVALID_USER_FORMAT;
|
terrno = TSDB_CODE_MND_INVALID_USER_FORMAT;
|
||||||
|
@ -1549,9 +1592,11 @@ static int32_t mndProcessCreateUserReq(SRpcMsg *pReq) {
|
||||||
goto _OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strlen(createReq.pass) >= TSDB_PASSWORD_LEN) {
|
if (createReq.isImport != 1) {
|
||||||
terrno = TSDB_CODE_PAR_NAME_OR_PASSWD_TOO_LONG;
|
if (strlen(createReq.pass) >= TSDB_PASSWORD_LEN) {
|
||||||
goto _OVER;
|
terrno = TSDB_CODE_PAR_NAME_OR_PASSWD_TOO_LONG;
|
||||||
|
goto _OVER;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pUser = mndAcquireUser(pMnode, createReq.user);
|
pUser = mndAcquireUser(pMnode, createReq.user);
|
||||||
|
@ -1575,10 +1620,16 @@ static int32_t mndProcessCreateUserReq(SRpcMsg *pReq) {
|
||||||
if (code == 0) code = TSDB_CODE_ACTION_IN_PROGRESS;
|
if (code == 0) code = TSDB_CODE_ACTION_IN_PROGRESS;
|
||||||
|
|
||||||
char detail[1000] = {0};
|
char detail[1000] = {0};
|
||||||
sprintf(detail, "enable:%d, superUser:%d, sysInfo:%d, password:xxx",
|
sprintf(detail, "enable:%d, superUser:%d, sysInfo:%d, password:xxx", createReq.enable, createReq.superUser,
|
||||||
createReq.enable, createReq.superUser, createReq.sysInfo);
|
createReq.sysInfo);
|
||||||
|
char operation[15] = {0};
|
||||||
|
if (createReq.isImport == 1) {
|
||||||
|
strcpy(operation, "importUser");
|
||||||
|
} else {
|
||||||
|
strcpy(operation, "createUser");
|
||||||
|
}
|
||||||
|
|
||||||
auditRecord(pReq, pMnode->clusterId, "createUser", "", createReq.user, detail, strlen(detail));
|
auditRecord(pReq, pMnode->clusterId, operation, "", createReq.user, detail, strlen(detail));
|
||||||
|
|
||||||
_OVER:
|
_OVER:
|
||||||
if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) {
|
if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) {
|
||||||
|
@ -1766,7 +1817,7 @@ static int32_t mndRemoveTablePriviledge(SMnode *pMnode, SHashObj *hash, SHashObj
|
||||||
if (NULL == currRef) {
|
if (NULL == currRef) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (1 == *currRef) {
|
if (1 == *currRef) {
|
||||||
if (taosHashRemove(useDbHash, alterReq->objname, dbKeyLen) != 0) {
|
if (taosHashRemove(useDbHash, alterReq->objname, dbKeyLen) != 0) {
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -1800,12 +1851,12 @@ static char *mndUserAuditTypeStr(int32_t type) {
|
||||||
return "error";
|
return "error";
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t mndProcessAlterUserPrivilegesReq(SAlterUserReq *pAlterReq, SMnode *pMnode, SUserObj* pNewUser) {
|
static int32_t mndProcessAlterUserPrivilegesReq(SAlterUserReq *pAlterReq, SMnode *pMnode, SUserObj *pNewUser) {
|
||||||
SSdb *pSdb = pMnode->pSdb;
|
SSdb *pSdb = pMnode->pSdb;
|
||||||
void *pIter = NULL;
|
void *pIter = NULL;
|
||||||
|
|
||||||
if (ALTER_USER_ADD_READ_DB_PRIV(pAlterReq->alterType, pAlterReq->privileges, pAlterReq->tabName) ||
|
if (ALTER_USER_ADD_READ_DB_PRIV(pAlterReq->alterType, pAlterReq->privileges, pAlterReq->tabName) ||
|
||||||
ALTER_USER_ADD_ALL_DB_PRIV(pAlterReq->alterType, pAlterReq->privileges, pAlterReq->tabName)) {
|
ALTER_USER_ADD_ALL_DB_PRIV(pAlterReq->alterType, pAlterReq->privileges, pAlterReq->tabName)) {
|
||||||
if (strcmp(pAlterReq->objname, "1.*") != 0) {
|
if (strcmp(pAlterReq->objname, "1.*") != 0) {
|
||||||
int32_t len = strlen(pAlterReq->objname) + 1;
|
int32_t len = strlen(pAlterReq->objname) + 1;
|
||||||
SDbObj *pDb = mndAcquireDb(pMnode, pAlterReq->objname);
|
SDbObj *pDb = mndAcquireDb(pMnode, pAlterReq->objname);
|
||||||
|
@ -1830,7 +1881,8 @@ static int32_t mndProcessAlterUserPrivilegesReq(SAlterUserReq *pAlterReq, SMnode
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ALTER_USER_ADD_WRITE_DB_PRIV(pAlterReq->alterType, pAlterReq->privileges, pAlterReq->tabName) || ALTER_USER_ADD_ALL_DB_PRIV(pAlterReq->alterType, pAlterReq->privileges, pAlterReq->tabName)) {
|
if (ALTER_USER_ADD_WRITE_DB_PRIV(pAlterReq->alterType, pAlterReq->privileges, pAlterReq->tabName) ||
|
||||||
|
ALTER_USER_ADD_ALL_DB_PRIV(pAlterReq->alterType, pAlterReq->privileges, pAlterReq->tabName)) {
|
||||||
if (strcmp(pAlterReq->objname, "1.*") != 0) {
|
if (strcmp(pAlterReq->objname, "1.*") != 0) {
|
||||||
int32_t len = strlen(pAlterReq->objname) + 1;
|
int32_t len = strlen(pAlterReq->objname) + 1;
|
||||||
SDbObj *pDb = mndAcquireDb(pMnode, pAlterReq->objname);
|
SDbObj *pDb = mndAcquireDb(pMnode, pAlterReq->objname);
|
||||||
|
@ -1855,7 +1907,8 @@ static int32_t mndProcessAlterUserPrivilegesReq(SAlterUserReq *pAlterReq, SMnode
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ALTER_USER_DEL_READ_DB_PRIV(pAlterReq->alterType, pAlterReq->privileges, pAlterReq->tabName) || ALTER_USER_DEL_ALL_DB_PRIV(pAlterReq->alterType, pAlterReq->privileges, pAlterReq->tabName)) {
|
if (ALTER_USER_DEL_READ_DB_PRIV(pAlterReq->alterType, pAlterReq->privileges, pAlterReq->tabName) ||
|
||||||
|
ALTER_USER_DEL_ALL_DB_PRIV(pAlterReq->alterType, pAlterReq->privileges, pAlterReq->tabName)) {
|
||||||
if (strcmp(pAlterReq->objname, "1.*") != 0) {
|
if (strcmp(pAlterReq->objname, "1.*") != 0) {
|
||||||
int32_t len = strlen(pAlterReq->objname) + 1;
|
int32_t len = strlen(pAlterReq->objname) + 1;
|
||||||
SDbObj *pDb = mndAcquireDb(pMnode, pAlterReq->objname);
|
SDbObj *pDb = mndAcquireDb(pMnode, pAlterReq->objname);
|
||||||
|
@ -1870,7 +1923,8 @@ static int32_t mndProcessAlterUserPrivilegesReq(SAlterUserReq *pAlterReq, SMnode
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ALTER_USER_DEL_WRITE_DB_PRIV(pAlterReq->alterType, pAlterReq->privileges, pAlterReq->tabName) || ALTER_USER_DEL_ALL_DB_PRIV(pAlterReq->alterType, pAlterReq->privileges, pAlterReq->tabName)) {
|
if (ALTER_USER_DEL_WRITE_DB_PRIV(pAlterReq->alterType, pAlterReq->privileges, pAlterReq->tabName) ||
|
||||||
|
ALTER_USER_DEL_ALL_DB_PRIV(pAlterReq->alterType, pAlterReq->privileges, pAlterReq->tabName)) {
|
||||||
if (strcmp(pAlterReq->objname, "1.*") != 0) {
|
if (strcmp(pAlterReq->objname, "1.*") != 0) {
|
||||||
int32_t len = strlen(pAlterReq->objname) + 1;
|
int32_t len = strlen(pAlterReq->objname) + 1;
|
||||||
SDbObj *pDb = mndAcquireDb(pMnode, pAlterReq->objname);
|
SDbObj *pDb = mndAcquireDb(pMnode, pAlterReq->objname);
|
||||||
|
@ -1885,9 +1939,9 @@ static int32_t mndProcessAlterUserPrivilegesReq(SAlterUserReq *pAlterReq, SMnode
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SHashObj* pReadTbs = pNewUser->readTbs;
|
SHashObj *pReadTbs = pNewUser->readTbs;
|
||||||
SHashObj* pWriteTbs = pNewUser->writeTbs;
|
SHashObj *pWriteTbs = pNewUser->writeTbs;
|
||||||
SHashObj* pAlterTbs = pNewUser->alterTbs;
|
SHashObj *pAlterTbs = pNewUser->alterTbs;
|
||||||
|
|
||||||
#ifdef TD_ENTERPRISE
|
#ifdef TD_ENTERPRISE
|
||||||
if (pAlterReq->isView) {
|
if (pAlterReq->isView) {
|
||||||
|
@ -1897,15 +1951,18 @@ static int32_t mndProcessAlterUserPrivilegesReq(SAlterUserReq *pAlterReq, SMnode
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (ALTER_USER_ADD_READ_TB_PRIV(pAlterReq->alterType, pAlterReq->privileges, pAlterReq->tabName) || ALTER_USER_ADD_ALL_TB_PRIV(pAlterReq->alterType, pAlterReq->privileges, pAlterReq->tabName)) {
|
if (ALTER_USER_ADD_READ_TB_PRIV(pAlterReq->alterType, pAlterReq->privileges, pAlterReq->tabName) ||
|
||||||
|
ALTER_USER_ADD_ALL_TB_PRIV(pAlterReq->alterType, pAlterReq->privileges, pAlterReq->tabName)) {
|
||||||
if (mndTablePriviledge(pMnode, pReadTbs, pNewUser->useDbs, pAlterReq, pSdb) != 0) return -1;
|
if (mndTablePriviledge(pMnode, pReadTbs, pNewUser->useDbs, pAlterReq, pSdb) != 0) return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ALTER_USER_ADD_WRITE_TB_PRIV(pAlterReq->alterType, pAlterReq->privileges, pAlterReq->tabName) || ALTER_USER_ADD_ALL_TB_PRIV(pAlterReq->alterType, pAlterReq->privileges, pAlterReq->tabName)) {
|
if (ALTER_USER_ADD_WRITE_TB_PRIV(pAlterReq->alterType, pAlterReq->privileges, pAlterReq->tabName) ||
|
||||||
|
ALTER_USER_ADD_ALL_TB_PRIV(pAlterReq->alterType, pAlterReq->privileges, pAlterReq->tabName)) {
|
||||||
if (mndTablePriviledge(pMnode, pWriteTbs, pNewUser->useDbs, pAlterReq, pSdb) != 0) return -1;
|
if (mndTablePriviledge(pMnode, pWriteTbs, pNewUser->useDbs, pAlterReq, pSdb) != 0) return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ALTER_USER_ADD_ALTER_TB_PRIV(pAlterReq->alterType, pAlterReq->privileges, pAlterReq->tabName) || ALTER_USER_ADD_ALL_TB_PRIV(pAlterReq->alterType, pAlterReq->privileges, pAlterReq->tabName)) {
|
if (ALTER_USER_ADD_ALTER_TB_PRIV(pAlterReq->alterType, pAlterReq->privileges, pAlterReq->tabName) ||
|
||||||
|
ALTER_USER_ADD_ALL_TB_PRIV(pAlterReq->alterType, pAlterReq->privileges, pAlterReq->tabName)) {
|
||||||
if (mndTablePriviledge(pMnode, pAlterTbs, pNewUser->useDbs, pAlterReq, pSdb) != 0) return -1;
|
if (mndTablePriviledge(pMnode, pAlterTbs, pNewUser->useDbs, pAlterReq, pSdb) != 0) return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2016,7 +2073,7 @@ static int32_t mndProcessAlterUserReq(SRpcMsg *pReq) {
|
||||||
newUser.sysInfo = alterReq.sysInfo;
|
newUser.sysInfo = alterReq.sysInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(alterReq.alterType == TSDB_ALTER_USER_CREATEDB) {
|
if (alterReq.alterType == TSDB_ALTER_USER_CREATEDB) {
|
||||||
newUser.createdb = alterReq.createdb;
|
newUser.createdb = alterReq.createdb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2119,52 +2176,43 @@ static int32_t mndProcessAlterUserReq(SRpcMsg *pReq) {
|
||||||
code = mndAlterUser(pMnode, pUser, &newUser, pReq);
|
code = mndAlterUser(pMnode, pUser, &newUser, pReq);
|
||||||
if (code == 0) code = TSDB_CODE_ACTION_IN_PROGRESS;
|
if (code == 0) code = TSDB_CODE_ACTION_IN_PROGRESS;
|
||||||
|
|
||||||
if(alterReq.alterType == TSDB_ALTER_USER_PASSWD){
|
if (alterReq.alterType == TSDB_ALTER_USER_PASSWD) {
|
||||||
char detail[1000] = {0};
|
char detail[1000] = {0};
|
||||||
sprintf(detail, "alterType:%s, enable:%d, superUser:%d, sysInfo:%d, createdb:%d, tabName:%s, password:xxx",
|
sprintf(detail, "alterType:%s, enable:%d, superUser:%d, sysInfo:%d, createdb:%d, tabName:%s, password:xxx",
|
||||||
mndUserAuditTypeStr(alterReq.alterType), alterReq.enable, alterReq.superUser, alterReq.sysInfo,
|
mndUserAuditTypeStr(alterReq.alterType), alterReq.enable, alterReq.superUser, alterReq.sysInfo,
|
||||||
alterReq.createdb ? 1 : 0, alterReq.tabName);
|
alterReq.createdb ? 1 : 0, alterReq.tabName);
|
||||||
auditRecord(pReq, pMnode->clusterId, "alterUser", "", alterReq.user, detail, strlen(detail));
|
auditRecord(pReq, pMnode->clusterId, "alterUser", "", alterReq.user, detail, strlen(detail));
|
||||||
}
|
} else if (alterReq.alterType == TSDB_ALTER_USER_SUPERUSER || alterReq.alterType == TSDB_ALTER_USER_ENABLE ||
|
||||||
else if(alterReq.alterType == TSDB_ALTER_USER_SUPERUSER ||
|
alterReq.alterType == TSDB_ALTER_USER_SYSINFO || alterReq.alterType == TSDB_ALTER_USER_CREATEDB) {
|
||||||
alterReq.alterType == TSDB_ALTER_USER_ENABLE ||
|
|
||||||
alterReq.alterType == TSDB_ALTER_USER_SYSINFO ||
|
|
||||||
alterReq.alterType == TSDB_ALTER_USER_CREATEDB){
|
|
||||||
auditRecord(pReq, pMnode->clusterId, "alterUser", "", alterReq.user, alterReq.sql, alterReq.sqlLen);
|
auditRecord(pReq, pMnode->clusterId, "alterUser", "", alterReq.user, alterReq.sql, alterReq.sqlLen);
|
||||||
}
|
} else if (ALTER_USER_ADD_READ_DB_PRIV(alterReq.alterType, alterReq.privileges, alterReq.tabName) ||
|
||||||
else if(ALTER_USER_ADD_READ_DB_PRIV(alterReq.alterType, alterReq.privileges, alterReq.tabName)||
|
ALTER_USER_ADD_WRITE_DB_PRIV(alterReq.alterType, alterReq.privileges, alterReq.tabName) ||
|
||||||
ALTER_USER_ADD_WRITE_DB_PRIV(alterReq.alterType, alterReq.privileges, alterReq.tabName)||
|
ALTER_USER_ADD_ALL_DB_PRIV(alterReq.alterType, alterReq.privileges, alterReq.tabName) ||
|
||||||
ALTER_USER_ADD_ALL_DB_PRIV(alterReq.alterType, alterReq.privileges, alterReq.tabName)||
|
ALTER_USER_ADD_READ_TB_PRIV(alterReq.alterType, alterReq.privileges, alterReq.tabName) ||
|
||||||
ALTER_USER_ADD_READ_TB_PRIV(alterReq.alterType, alterReq.privileges, alterReq.tabName)||
|
ALTER_USER_ADD_WRITE_TB_PRIV(alterReq.alterType, alterReq.privileges, alterReq.tabName) ||
|
||||||
ALTER_USER_ADD_WRITE_TB_PRIV(alterReq.alterType, alterReq.privileges, alterReq.tabName)||
|
ALTER_USER_ADD_ALL_TB_PRIV(alterReq.alterType, alterReq.privileges, alterReq.tabName)) {
|
||||||
ALTER_USER_ADD_ALL_TB_PRIV(alterReq.alterType, alterReq.privileges, alterReq.tabName)){
|
if (strcmp(alterReq.objname, "1.*") != 0) {
|
||||||
if (strcmp(alterReq.objname, "1.*") != 0){
|
|
||||||
SName name = {0};
|
SName name = {0};
|
||||||
tNameFromString(&name, alterReq.objname, T_NAME_ACCT | T_NAME_DB);
|
tNameFromString(&name, alterReq.objname, T_NAME_ACCT | T_NAME_DB);
|
||||||
auditRecord(pReq, pMnode->clusterId, "GrantPrivileges", name.dbname, alterReq.user,
|
auditRecord(pReq, pMnode->clusterId, "GrantPrivileges", name.dbname, alterReq.user, alterReq.sql,
|
||||||
alterReq.sql, alterReq.sqlLen);
|
alterReq.sqlLen);
|
||||||
}else{
|
} else {
|
||||||
auditRecord(pReq, pMnode->clusterId, "GrantPrivileges", "", alterReq.user,
|
auditRecord(pReq, pMnode->clusterId, "GrantPrivileges", "", alterReq.user, alterReq.sql, alterReq.sqlLen);
|
||||||
alterReq.sql, alterReq.sqlLen);
|
|
||||||
}
|
}
|
||||||
}
|
} else if (ALTER_USER_ADD_SUBSCRIBE_TOPIC_PRIV(alterReq.alterType, alterReq.privileges)) {
|
||||||
else if(ALTER_USER_ADD_SUBSCRIBE_TOPIC_PRIV(alterReq.alterType, alterReq.privileges)){
|
auditRecord(pReq, pMnode->clusterId, "GrantPrivileges", alterReq.objname, alterReq.user, alterReq.sql,
|
||||||
auditRecord(pReq, pMnode->clusterId, "GrantPrivileges", alterReq.objname, alterReq.user,
|
alterReq.sqlLen);
|
||||||
alterReq.sql, alterReq.sqlLen);
|
} else if (ALTER_USER_DEL_SUBSCRIBE_TOPIC_PRIV(alterReq.alterType, alterReq.privileges)) {
|
||||||
}
|
auditRecord(pReq, pMnode->clusterId, "RevokePrivileges", alterReq.objname, alterReq.user, alterReq.sql,
|
||||||
else if(ALTER_USER_DEL_SUBSCRIBE_TOPIC_PRIV(alterReq.alterType, alterReq.privileges)){
|
alterReq.sqlLen);
|
||||||
auditRecord(pReq, pMnode->clusterId, "RevokePrivileges", alterReq.objname, alterReq.user,
|
} else {
|
||||||
alterReq.sql, alterReq.sqlLen);
|
if (strcmp(alterReq.objname, "1.*") != 0) {
|
||||||
}
|
|
||||||
else{
|
|
||||||
if (strcmp(alterReq.objname, "1.*") != 0){
|
|
||||||
SName name = {0};
|
SName name = {0};
|
||||||
tNameFromString(&name, alterReq.objname, T_NAME_ACCT | T_NAME_DB);
|
tNameFromString(&name, alterReq.objname, T_NAME_ACCT | T_NAME_DB);
|
||||||
auditRecord(pReq, pMnode->clusterId, "RevokePrivileges", name.dbname, alterReq.user,
|
auditRecord(pReq, pMnode->clusterId, "RevokePrivileges", name.dbname, alterReq.user, alterReq.sql,
|
||||||
alterReq.sql, alterReq.sqlLen);
|
alterReq.sqlLen);
|
||||||
}else{
|
} else {
|
||||||
auditRecord(pReq, pMnode->clusterId, "RevokePrivileges", "", alterReq.user,
|
auditRecord(pReq, pMnode->clusterId, "RevokePrivileges", "", alterReq.user, alterReq.sql, alterReq.sqlLen);
|
||||||
alterReq.sql, alterReq.sqlLen);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2364,6 +2412,88 @@ static int32_t mndRetrieveUsers(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBl
|
||||||
return numOfRows;
|
return numOfRows;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int32_t mndRetrieveUsersFull(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows) {
|
||||||
|
int32_t numOfRows = 0;
|
||||||
|
#ifdef TD_ENTERPRISE
|
||||||
|
SMnode *pMnode = pReq->info.node;
|
||||||
|
SSdb *pSdb = pMnode->pSdb;
|
||||||
|
SUserObj *pUser = NULL;
|
||||||
|
int32_t cols = 0;
|
||||||
|
int8_t flag = 0;
|
||||||
|
char *pWrite;
|
||||||
|
int32_t code = 0;
|
||||||
|
|
||||||
|
while (numOfRows < rows) {
|
||||||
|
pShow->pIter = sdbFetch(pSdb, SDB_USER, pShow->pIter, (void **)&pUser);
|
||||||
|
if (pShow->pIter == NULL) break;
|
||||||
|
|
||||||
|
cols = 0;
|
||||||
|
SColumnInfoData *pColInfo = taosArrayGet(pBlock->pDataBlock, cols);
|
||||||
|
char name[TSDB_USER_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||||
|
STR_WITH_MAXSIZE_TO_VARSTR(name, pUser->user, pShow->pMeta->pSchemas[cols].bytes);
|
||||||
|
code = colDataSetVal(pColInfo, numOfRows, (const char *)name, false);
|
||||||
|
if (code != 0) mError("User:%s, failed to retrieve at columns:%d, cause %s", pUser->acct, cols, tstrerror(code));
|
||||||
|
|
||||||
|
cols++;
|
||||||
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols);
|
||||||
|
code = colDataSetVal(pColInfo, numOfRows, (const char *)&pUser->superUser, false);
|
||||||
|
if (code != 0) mError("User:%s, failed to retrieve at columns:%d, cause %s", pUser->acct, cols, tstrerror(code));
|
||||||
|
|
||||||
|
cols++;
|
||||||
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols);
|
||||||
|
code = colDataSetVal(pColInfo, numOfRows, (const char *)&pUser->enable, false);
|
||||||
|
if (code != 0) mError("User:%s, failed to retrieve at columns:%d, cause %s", pUser->acct, cols, tstrerror(code));
|
||||||
|
|
||||||
|
cols++;
|
||||||
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols);
|
||||||
|
code = colDataSetVal(pColInfo, numOfRows, (const char *)&pUser->sysInfo, false);
|
||||||
|
if (code != 0) mError("User:%s, failed to retrieve at columns:%d, cause %s", pUser->acct, cols, tstrerror(code));
|
||||||
|
|
||||||
|
cols++;
|
||||||
|
flag = pUser->createdb ? 1 : 0;
|
||||||
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols);
|
||||||
|
code = colDataSetVal(pColInfo, numOfRows, (const char *)&flag, false);
|
||||||
|
if (code != 0) mError("User:%s, failed to retrieve at columns:%d, cause %s", pUser->acct, cols, tstrerror(code));
|
||||||
|
|
||||||
|
// mInfo("pUser->pass:%s", pUser->pass);
|
||||||
|
cols++;
|
||||||
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols);
|
||||||
|
char pass[TSDB_PASSWORD_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||||
|
STR_WITH_MAXSIZE_TO_VARSTR(pass, pUser->pass, pShow->pMeta->pSchemas[cols].bytes);
|
||||||
|
code = colDataSetVal(pColInfo, numOfRows, (const char *)pass, false);
|
||||||
|
if (code != 0) mError("User:%s, failed to retrieve at columns:%d, cause %s", pUser->acct, cols, tstrerror(code));
|
||||||
|
|
||||||
|
cols++;
|
||||||
|
|
||||||
|
char *buf = NULL;
|
||||||
|
int32_t tlen = convertIpWhiteListToStr(pUser->pIpWhiteList, &buf);
|
||||||
|
// int32_t tlen = mndFetchIpWhiteList(pUser->pIpWhiteList, &buf);
|
||||||
|
if (tlen != 0) {
|
||||||
|
char *varstr = taosMemoryCalloc(1, VARSTR_HEADER_SIZE + tlen);
|
||||||
|
varDataSetLen(varstr, tlen);
|
||||||
|
memcpy(varDataVal(varstr), buf, tlen);
|
||||||
|
|
||||||
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols);
|
||||||
|
code = colDataSetVal(pColInfo, numOfRows, (const char *)varstr, false);
|
||||||
|
if (code != 0) mError("User:%s, failed to retrieve at columns:%d, cause %s", pUser->acct, cols, tstrerror(code));
|
||||||
|
|
||||||
|
taosMemoryFree(varstr);
|
||||||
|
taosMemoryFree(buf);
|
||||||
|
} else {
|
||||||
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols);
|
||||||
|
code = colDataSetVal(pColInfo, numOfRows, (const char *)NULL, true);
|
||||||
|
if (code != 0) mError("User:%s, failed to retrieve at columns:%d, cause %s", pUser->acct, cols, tstrerror(code));
|
||||||
|
}
|
||||||
|
|
||||||
|
numOfRows++;
|
||||||
|
sdbRelease(pSdb, pUser);
|
||||||
|
}
|
||||||
|
|
||||||
|
pShow->numOfRows += numOfRows;
|
||||||
|
#endif
|
||||||
|
return numOfRows;
|
||||||
|
}
|
||||||
|
|
||||||
static void mndCancelGetNextUser(SMnode *pMnode, void *pIter) {
|
static void mndCancelGetNextUser(SMnode *pMnode, void *pIter) {
|
||||||
SSdb *pSdb = pMnode->pSdb;
|
SSdb *pSdb = pMnode->pSdb;
|
||||||
sdbCancelFetch(pSdb, pIter);
|
sdbCancelFetch(pSdb, pIter);
|
||||||
|
@ -2480,11 +2610,14 @@ static int32_t mndRetrievePrivileges(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock
|
||||||
int32_t numOfReadViews = taosHashGetSize(pUser->readViews);
|
int32_t numOfReadViews = taosHashGetSize(pUser->readViews);
|
||||||
int32_t numOfWriteViews = taosHashGetSize(pUser->writeViews);
|
int32_t numOfWriteViews = taosHashGetSize(pUser->writeViews);
|
||||||
int32_t numOfAlterViews = taosHashGetSize(pUser->alterViews);
|
int32_t numOfAlterViews = taosHashGetSize(pUser->alterViews);
|
||||||
if (numOfRows + numOfReadDbs + numOfWriteDbs + numOfTopics + numOfReadTbs + numOfWriteTbs + numOfAlterTbs + numOfReadViews + numOfWriteViews + numOfAlterViews >= rows) {
|
if (numOfRows + numOfReadDbs + numOfWriteDbs + numOfTopics + numOfReadTbs + numOfWriteTbs + numOfAlterTbs +
|
||||||
|
numOfReadViews + numOfWriteViews + numOfAlterViews >=
|
||||||
|
rows) {
|
||||||
mInfo(
|
mInfo(
|
||||||
"will restore. current num of rows: %d, read dbs %d, write dbs %d, topics %d, read tables %d, write tables "
|
"will restore. current num of rows: %d, read dbs %d, write dbs %d, topics %d, read tables %d, write tables "
|
||||||
"%d, alter tables %d, read views %d, write views %d, alter views %d",
|
"%d, alter tables %d, read views %d, write views %d, alter views %d",
|
||||||
numOfRows, numOfReadDbs, numOfWriteDbs, numOfTopics, numOfReadTbs, numOfWriteTbs, numOfAlterTbs, numOfReadViews, numOfWriteViews, numOfAlterViews);
|
numOfRows, numOfReadDbs, numOfWriteDbs, numOfTopics, numOfReadTbs, numOfWriteTbs, numOfAlterTbs,
|
||||||
|
numOfReadViews, numOfWriteViews, numOfAlterViews);
|
||||||
pShow->restore = true;
|
pShow->restore = true;
|
||||||
sdbRelease(pSdb, pUser);
|
sdbRelease(pSdb, pUser);
|
||||||
break;
|
break;
|
||||||
|
@ -2870,7 +3003,6 @@ int32_t mndUserRemoveView(SMnode *pMnode, STrans *pTrans, char *view) {
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int32_t mndUserRemoveTopic(SMnode *pMnode, STrans *pTrans, char *topic) {
|
int32_t mndUserRemoveTopic(SMnode *pMnode, STrans *pTrans, char *topic) {
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
SSdb *pSdb = pMnode->pSdb;
|
SSdb *pSdb = pMnode->pSdb;
|
||||||
|
@ -2910,3 +3042,9 @@ int32_t mndUserRemoveTopic(SMnode *pMnode, STrans *pTrans, char *topic) {
|
||||||
mndUserFreeObj(&newUser);
|
mndUserFreeObj(&newUser);
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int64_t mndGetUserIpWhiteListVer(SMnode *pMnode, SUserObj *pUser) {
|
||||||
|
// ver = 0, disable ip white list
|
||||||
|
// ver > 0, enable ip white list
|
||||||
|
return tsEnableWhiteList ? pUser->ipWhiteListVer : 0;
|
||||||
|
}
|
||||||
|
|
|
@ -2240,7 +2240,7 @@ int32_t metaUpdateTableColCompress(SMeta *pMeta, int64_t version, SVAlterTbReq *
|
||||||
uint32_t dst = 0;
|
uint32_t dst = 0;
|
||||||
updated = tUpdateCompress(p->alg, pReq->compress, TSDB_COLVAL_COMPRESS_DISABLED, TSDB_COLVAL_LEVEL_DISABLED,
|
updated = tUpdateCompress(p->alg, pReq->compress, TSDB_COLVAL_COMPRESS_DISABLED, TSDB_COLVAL_LEVEL_DISABLED,
|
||||||
TSDB_COLVAL_LEVEL_MEDIUM, &dst);
|
TSDB_COLVAL_LEVEL_MEDIUM, &dst);
|
||||||
if (updated) {
|
if (updated > 0) {
|
||||||
p->alg = dst;
|
p->alg = dst;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2250,6 +2250,11 @@ int32_t metaUpdateTableColCompress(SMeta *pMeta, int64_t version, SVAlterTbReq *
|
||||||
tDecoderClear(&dc);
|
tDecoderClear(&dc);
|
||||||
terrno = TSDB_CODE_VND_COLUMN_COMPRESS_ALREADY_EXIST;
|
terrno = TSDB_CODE_VND_COLUMN_COMPRESS_ALREADY_EXIST;
|
||||||
goto _err;
|
goto _err;
|
||||||
|
} else if (updated < 0) {
|
||||||
|
tdbFree(pVal);
|
||||||
|
tDecoderClear(&dc);
|
||||||
|
terrno = TSDB_CODE_TSC_COMPRESS_LEVEL_ERROR;
|
||||||
|
goto _err;
|
||||||
}
|
}
|
||||||
tbEntry.version = version;
|
tbEntry.version = version;
|
||||||
|
|
||||||
|
|
|
@ -299,7 +299,7 @@ static int32_t tdSetRSmaInfoItemParams(SSma *pSma, SRSmaParam *param, SRSmaStat
|
||||||
tdRSmaTaskInit(pStreamTask->pMeta, pItem, &pStreamTask->id);
|
tdRSmaTaskInit(pStreamTask->pMeta, pItem, &pStreamTask->id);
|
||||||
pStreamTask->status.pSM = streamCreateStateMachine(pStreamTask);
|
pStreamTask->status.pSM = streamCreateStateMachine(pStreamTask);
|
||||||
pStreamTask->chkInfo.pActiveInfo = streamTaskCreateActiveChkptInfo();
|
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) {
|
if (!pStreamState) {
|
||||||
terrno = TSDB_CODE_RSMA_STREAM_STATE_OPEN;
|
terrno = TSDB_CODE_RSMA_STREAM_STATE_OPEN;
|
||||||
return TSDB_CODE_FAILED;
|
return TSDB_CODE_FAILED;
|
||||||
|
|
|
@ -49,7 +49,7 @@ int32_t tqExpandStreamTask(SStreamTask* pTask) {
|
||||||
|
|
||||||
// sink task does not need the pState
|
// sink task does not need the pState
|
||||||
if (pTask->info.taskLevel != TASK_LEVEL__SINK) {
|
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) {
|
if (pTask->pState == NULL) {
|
||||||
tqError("s-task:%s (vgId:%d) failed to open state for task, expand task failed", pTask->id.idStr, vgId);
|
tqError("s-task:%s (vgId:%d) failed to open state for task, expand task failed", pTask->id.idStr, vgId);
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -368,6 +368,7 @@ TEST(testCase, tSma_Data_Insert_Query_Test) {
|
||||||
SDiskCfg pDisks = {0};
|
SDiskCfg pDisks = {0};
|
||||||
pDisks.level = 0;
|
pDisks.level = 0;
|
||||||
pDisks.primary = 1;
|
pDisks.primary = 1;
|
||||||
|
pDisks.disable = 0;
|
||||||
strncpy(pDisks.dir, TD_DATA_DIR_PATH, TSDB_FILENAME_LEN);
|
strncpy(pDisks.dir, TD_DATA_DIR_PATH, TSDB_FILENAME_LEN);
|
||||||
int32_t numOfDisks = 1;
|
int32_t numOfDisks = 1;
|
||||||
pTsdb->pTfs = tfsOpen(&pDisks, numOfDisks);
|
pTsdb->pTfs = tfsOpen(&pDisks, numOfDisks);
|
||||||
|
|
|
@ -239,23 +239,6 @@ static int32_t buildCreateDBResultDataBlock(SSDataBlock** pOutput) {
|
||||||
return code;
|
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 getValOfDiffPrecision(int8_t unit, int64_t val) {
|
||||||
int64_t v = 0;
|
int64_t v = 0;
|
||||||
switch (unit) {
|
switch (unit) {
|
||||||
|
@ -403,110 +386,6 @@ static void setCreateDBResultIntoDataBlock(SSDataBlock* pBlock, char* dbName, ch
|
||||||
colDataSetVal(pCol2, 0, buf2, false);
|
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) {
|
static int32_t execShowCreateDatabase(SShowCreateDatabaseStmt* pStmt, SRetrieveTableRsp** pRsp) {
|
||||||
SSDataBlock* pBlock = NULL;
|
SSDataBlock* pBlock = NULL;
|
||||||
int32_t code = buildCreateDBResultDataBlock(&pBlock);
|
int32_t code = buildCreateDBResultDataBlock(&pBlock);
|
||||||
|
@ -1075,9 +954,6 @@ int32_t qExecCommand(int64_t* pConnId, bool sysInfoUser, SNode* pStmt, SRetrieve
|
||||||
return execShowLocalVariables(pRsp);
|
return execShowLocalVariables(pRsp);
|
||||||
case QUERY_NODE_SELECT_STMT:
|
case QUERY_NODE_SELECT_STMT:
|
||||||
return execSelectWithoutFrom((SSelectStmt*)pStmt, pRsp);
|
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:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1157,7 +1157,7 @@ static SSDataBlock* buildStreamPartitionResult(SOperatorInfo* pOperator) {
|
||||||
pDest->info.parTbName[0] = 0;
|
pDest->info.parTbName[0] = 0;
|
||||||
if (pInfo->tbnameCalSup.numOfExprs > 0) {
|
if (pInfo->tbnameCalSup.numOfExprs > 0) {
|
||||||
void* tbname = NULL;
|
void* tbname = NULL;
|
||||||
if (pAPI->stateStore.streamStateGetParName(pOperator->pTaskInfo->streamInfo.pState, pParInfo->groupId, &tbname) == 0) {
|
if (pAPI->stateStore.streamStateGetParName(pOperator->pTaskInfo->streamInfo.pState, pParInfo->groupId, &tbname, false) == 0) {
|
||||||
memcpy(pDest->info.parTbName, tbname, TSDB_TABLE_NAME_LEN);
|
memcpy(pDest->info.parTbName, tbname, TSDB_TABLE_NAME_LEN);
|
||||||
pAPI->stateStore.streamStateFreeVal(tbname);
|
pAPI->stateStore.streamStateFreeVal(tbname);
|
||||||
}
|
}
|
||||||
|
@ -1178,7 +1178,7 @@ static SSDataBlock* buildStreamPartitionResult(SOperatorInfo* pOperator) {
|
||||||
void appendCreateTableRow(void* pState, SExprSupp* pTableSup, SExprSupp* pTagSup, uint64_t groupId,
|
void appendCreateTableRow(void* pState, SExprSupp* pTableSup, SExprSupp* pTagSup, uint64_t groupId,
|
||||||
SSDataBlock* pSrcBlock, int32_t rowId, SSDataBlock* pDestBlock, SStateStore* pAPI) {
|
SSDataBlock* pSrcBlock, int32_t rowId, SSDataBlock* pDestBlock, SStateStore* pAPI) {
|
||||||
void* pValue = NULL;
|
void* pValue = NULL;
|
||||||
if (pAPI->streamStateGetParName(pState, groupId, &pValue) != 0) {
|
if (pAPI->streamStateGetParName(pState, groupId, &pValue, true) != 0) {
|
||||||
SSDataBlock* pTmpBlock = blockCopyOneRow(pSrcBlock, rowId);
|
SSDataBlock* pTmpBlock = blockCopyOneRow(pSrcBlock, rowId);
|
||||||
memset(pTmpBlock->info.parTbName, 0, TSDB_TABLE_NAME_LEN);
|
memset(pTmpBlock->info.parTbName, 0, TSDB_TABLE_NAME_LEN);
|
||||||
pTmpBlock->info.id.groupId = groupId;
|
pTmpBlock->info.id.groupId = groupId;
|
||||||
|
|
|
@ -1892,7 +1892,7 @@ static int32_t generatePartitionDelResBlock(SStreamScanInfo* pInfo, SSDataBlock*
|
||||||
groupId = calGroupIdByData(&pInfo->partitionSup, pInfo->pPartScalarSup, pPreRes, preJ);
|
groupId = calGroupIdByData(&pInfo->partitionSup, pInfo->pPartScalarSup, pPreRes, preJ);
|
||||||
if (pInfo->pPartTbnameSup) {
|
if (pInfo->pPartTbnameSup) {
|
||||||
void* parTbname = NULL;
|
void* parTbname = NULL;
|
||||||
int32_t code = pInfo->stateStore.streamStateGetParName(pInfo->pStreamScanOp->pTaskInfo->streamInfo.pState, groupId, &parTbname);
|
int32_t code = pInfo->stateStore.streamStateGetParName(pInfo->pStreamScanOp->pTaskInfo->streamInfo.pState, groupId, &parTbname, false);
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
calBlockTbName(pInfo, pPreRes, preJ);
|
calBlockTbName(pInfo, pPreRes, preJ);
|
||||||
memcpy(varDataVal(tbname), pPreRes->info.parTbName, strlen(pPreRes->info.parTbName));
|
memcpy(varDataVal(tbname), pPreRes->info.parTbName, strlen(pPreRes->info.parTbName));
|
||||||
|
@ -1938,7 +1938,7 @@ static int32_t generateDeleteResultBlockImpl(SStreamScanInfo* pInfo, SSDataBlock
|
||||||
}
|
}
|
||||||
if (pInfo->tbnameCalSup.pExprInfo) {
|
if (pInfo->tbnameCalSup.pExprInfo) {
|
||||||
void* parTbname = NULL;
|
void* parTbname = NULL;
|
||||||
int32_t code = pInfo->stateStore.streamStateGetParName(pInfo->pStreamScanOp->pTaskInfo->streamInfo.pState, groupId, &parTbname);
|
int32_t code = pInfo->stateStore.streamStateGetParName(pInfo->pStreamScanOp->pTaskInfo->streamInfo.pState, groupId, &parTbname, false);
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
SSDataBlock* pPreRes = readPreVersionData(pInfo->pTableScanOp, srcUid, srcStartTsCol[i], srcStartTsCol[i], ver);
|
SSDataBlock* pPreRes = readPreVersionData(pInfo->pTableScanOp, srcUid, srcStartTsCol[i], srcStartTsCol[i], ver);
|
||||||
printDataBlock(pPreRes, "pre res", GET_TASKID(pInfo->pStreamScanOp->pTaskInfo));
|
printDataBlock(pPreRes, "pre res", GET_TASKID(pInfo->pStreamScanOp->pTaskInfo));
|
||||||
|
@ -4961,6 +4961,7 @@ static SSDataBlock* buildSysDbTableCount(SOperatorInfo* pOperator, STableCountSc
|
||||||
|
|
||||||
size_t infodbTableNum;
|
size_t infodbTableNum;
|
||||||
getInfosDbMeta(NULL, &infodbTableNum);
|
getInfosDbMeta(NULL, &infodbTableNum);
|
||||||
|
infodbTableNum -= 1;
|
||||||
size_t perfdbTableNum;
|
size_t perfdbTableNum;
|
||||||
getPerfDbMeta(NULL, &perfdbTableNum);
|
getPerfDbMeta(NULL, &perfdbTableNum);
|
||||||
|
|
||||||
|
|
|
@ -707,7 +707,7 @@ static void buildDeleteRange(SOperatorInfo* pOp, TSKEY start, TSKEY end, uint64_
|
||||||
SColumnInfoData* pTableCol = taosArrayGet(pBlock->pDataBlock, TABLE_NAME_COLUMN_INDEX);
|
SColumnInfoData* pTableCol = taosArrayGet(pBlock->pDataBlock, TABLE_NAME_COLUMN_INDEX);
|
||||||
|
|
||||||
void* tbname = NULL;
|
void* tbname = NULL;
|
||||||
pAPI->stateStore.streamStateGetParName(pOp->pTaskInfo->streamInfo.pState, groupId, &tbname);
|
pAPI->stateStore.streamStateGetParName(pOp->pTaskInfo->streamInfo.pState, groupId, &tbname, false);
|
||||||
if (tbname == NULL) {
|
if (tbname == NULL) {
|
||||||
colDataSetNULL(pTableCol, pBlock->info.rows);
|
colDataSetNULL(pTableCol, pBlock->info.rows);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -376,7 +376,7 @@ static void doBuildDeleteResult(SStreamIntervalOperatorInfo* pInfo, SArray* pWin
|
||||||
for (int32_t i = *index; i < size; i++) {
|
for (int32_t i = *index; i < size; i++) {
|
||||||
SWinKey* pWin = taosArrayGet(pWins, i);
|
SWinKey* pWin = taosArrayGet(pWins, i);
|
||||||
void* tbname = NULL;
|
void* tbname = NULL;
|
||||||
pInfo->stateStore.streamStateGetParName(pInfo->pState, pWin->groupId, &tbname);
|
pInfo->stateStore.streamStateGetParName(pInfo->pState, pWin->groupId, &tbname, false);
|
||||||
if (tbname == NULL) {
|
if (tbname == NULL) {
|
||||||
appendDataToSpecialBlock(pBlock, &pWin->ts, &pWin->ts, &uid, &pWin->groupId, NULL);
|
appendDataToSpecialBlock(pBlock, &pWin->ts, &pWin->ts, &uid, &pWin->groupId, NULL);
|
||||||
} else {
|
} else {
|
||||||
|
@ -750,7 +750,7 @@ int32_t buildDataBlockFromGroupRes(SOperatorInfo* pOperator, void* pState, SSDat
|
||||||
if (pBlock->info.id.groupId == 0) {
|
if (pBlock->info.id.groupId == 0) {
|
||||||
pBlock->info.id.groupId = groupId;
|
pBlock->info.id.groupId = groupId;
|
||||||
void* tbname = NULL;
|
void* tbname = NULL;
|
||||||
if (pAPI->stateStore.streamStateGetParName(pTaskInfo->streamInfo.pState, pBlock->info.id.groupId, &tbname) < 0) {
|
if (pAPI->stateStore.streamStateGetParName(pTaskInfo->streamInfo.pState, pBlock->info.id.groupId, &tbname, false) < 0) {
|
||||||
pBlock->info.parTbName[0] = 0;
|
pBlock->info.parTbName[0] = 0;
|
||||||
} else {
|
} else {
|
||||||
memcpy(pBlock->info.parTbName, tbname, TSDB_TABLE_NAME_LEN);
|
memcpy(pBlock->info.parTbName, tbname, TSDB_TABLE_NAME_LEN);
|
||||||
|
@ -2276,7 +2276,7 @@ void doBuildDeleteDataBlock(SOperatorInfo* pOp, SSHashObj* pStDeleted, SSDataBlo
|
||||||
SColumnInfoData* pTableCol = taosArrayGet(pBlock->pDataBlock, TABLE_NAME_COLUMN_INDEX);
|
SColumnInfoData* pTableCol = taosArrayGet(pBlock->pDataBlock, TABLE_NAME_COLUMN_INDEX);
|
||||||
|
|
||||||
void* tbname = NULL;
|
void* tbname = NULL;
|
||||||
pAPI->stateStore.streamStateGetParName(pOp->pTaskInfo->streamInfo.pState, res->groupId, &tbname);
|
pAPI->stateStore.streamStateGetParName(pOp->pTaskInfo->streamInfo.pState, res->groupId, &tbname, false);
|
||||||
if (tbname == NULL) {
|
if (tbname == NULL) {
|
||||||
colDataSetNULL(pTableCol, pBlock->info.rows);
|
colDataSetNULL(pTableCol, pBlock->info.rows);
|
||||||
} else {
|
} else {
|
||||||
|
@ -2446,7 +2446,7 @@ int32_t buildSessionResultDataBlock(SOperatorInfo* pOperator, void* pState, SSDa
|
||||||
|
|
||||||
void* tbname = NULL;
|
void* tbname = NULL;
|
||||||
if (pAPI->stateStore.streamStateGetParName((void*)pTaskInfo->streamInfo.pState, pBlock->info.id.groupId,
|
if (pAPI->stateStore.streamStateGetParName((void*)pTaskInfo->streamInfo.pState, pBlock->info.id.groupId,
|
||||||
&tbname) < 0) {
|
&tbname, false) < 0) {
|
||||||
pBlock->info.parTbName[0] = 0;
|
pBlock->info.parTbName[0] = 0;
|
||||||
} else {
|
} else {
|
||||||
memcpy(pBlock->info.parTbName, tbname, TSDB_TABLE_NAME_LEN);
|
memcpy(pBlock->info.parTbName, tbname, TSDB_TABLE_NAME_LEN);
|
||||||
|
|
|
@ -1090,6 +1090,10 @@ int32_t buildDbTableInfoBlock(bool sysInfo, const SSDataBlock* p, const SSysTabl
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(strcmp(pm->name, TSDB_INS_TABLE_USERS_FULL) == 0){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
SColumnInfoData* pColInfoData = taosArrayGet(p->pDataBlock, 0);
|
SColumnInfoData* pColInfoData = taosArrayGet(p->pDataBlock, 0);
|
||||||
|
|
||||||
STR_TO_VARSTR(n, pm->name);
|
STR_TO_VARSTR(n, pm->name);
|
||||||
|
|
|
@ -565,7 +565,7 @@ int32_t avgFunction(SqlFunctionCtx* pCtx) {
|
||||||
numOfElem = pInput->numOfRows;
|
numOfElem = pInput->numOfRows;
|
||||||
pAvgRes->count += pInput->numOfRows;
|
pAvgRes->count += pInput->numOfRows;
|
||||||
|
|
||||||
bool simdAvailable = tsAVXEnable && tsSIMDEnable && (numOfRows > THRESHOLD_SIZE);
|
bool simdAvailable = tsAVXSupported && tsSIMDEnable && (numOfRows > THRESHOLD_SIZE);
|
||||||
|
|
||||||
switch(type) {
|
switch(type) {
|
||||||
case TSDB_DATA_TYPE_UTINYINT:
|
case TSDB_DATA_TYPE_UTINYINT:
|
||||||
|
|
|
@ -370,7 +370,7 @@ static int32_t findFirstValPosition(const SColumnInfoData* pCol, int32_t start,
|
||||||
static void handleInt8Col(const void* data, int32_t start, int32_t numOfRows, SMinmaxResInfo* pBuf, bool isMinFunc,
|
static void handleInt8Col(const void* data, int32_t start, int32_t numOfRows, SMinmaxResInfo* pBuf, bool isMinFunc,
|
||||||
bool signVal) {
|
bool signVal) {
|
||||||
// AVX2 version to speedup the loop
|
// AVX2 version to speedup the loop
|
||||||
if (tsAVX2Enable && tsSIMDEnable) {
|
if (tsAVX2Supported && tsSIMDEnable) {
|
||||||
pBuf->v = i8VectorCmpAVX2(data, numOfRows, isMinFunc, signVal);
|
pBuf->v = i8VectorCmpAVX2(data, numOfRows, isMinFunc, signVal);
|
||||||
} else {
|
} else {
|
||||||
if (!pBuf->assign) {
|
if (!pBuf->assign) {
|
||||||
|
@ -404,7 +404,7 @@ static void handleInt8Col(const void* data, int32_t start, int32_t numOfRows, SM
|
||||||
static void handleInt16Col(const void* data, int32_t start, int32_t numOfRows, SMinmaxResInfo* pBuf, bool isMinFunc,
|
static void handleInt16Col(const void* data, int32_t start, int32_t numOfRows, SMinmaxResInfo* pBuf, bool isMinFunc,
|
||||||
bool signVal) {
|
bool signVal) {
|
||||||
// AVX2 version to speedup the loop
|
// AVX2 version to speedup the loop
|
||||||
if (tsAVX2Enable && tsSIMDEnable) {
|
if (tsAVX2Supported && tsSIMDEnable) {
|
||||||
pBuf->v = i16VectorCmpAVX2(data, numOfRows, isMinFunc, signVal);
|
pBuf->v = i16VectorCmpAVX2(data, numOfRows, isMinFunc, signVal);
|
||||||
} else {
|
} else {
|
||||||
if (!pBuf->assign) {
|
if (!pBuf->assign) {
|
||||||
|
@ -438,7 +438,7 @@ static void handleInt16Col(const void* data, int32_t start, int32_t numOfRows, S
|
||||||
static void handleInt32Col(const void* data, int32_t start, int32_t numOfRows, SMinmaxResInfo* pBuf, bool isMinFunc,
|
static void handleInt32Col(const void* data, int32_t start, int32_t numOfRows, SMinmaxResInfo* pBuf, bool isMinFunc,
|
||||||
bool signVal) {
|
bool signVal) {
|
||||||
// AVX2 version to speedup the loop
|
// AVX2 version to speedup the loop
|
||||||
if (tsAVX2Enable && tsSIMDEnable) {
|
if (tsAVX2Supported && tsSIMDEnable) {
|
||||||
pBuf->v = i32VectorCmpAVX2(data, numOfRows, isMinFunc, signVal);
|
pBuf->v = i32VectorCmpAVX2(data, numOfRows, isMinFunc, signVal);
|
||||||
} else {
|
} else {
|
||||||
if (!pBuf->assign) {
|
if (!pBuf->assign) {
|
||||||
|
@ -502,7 +502,7 @@ static void handleFloatCol(SColumnInfoData* pCol, int32_t start, int32_t numOfRo
|
||||||
float* val = (float*)&pBuf->v;
|
float* val = (float*)&pBuf->v;
|
||||||
|
|
||||||
// AVX version to speedup the loop
|
// AVX version to speedup the loop
|
||||||
if (tsAVXEnable && tsSIMDEnable) {
|
if (tsAVXSupported && tsSIMDEnable) {
|
||||||
*val = floatVectorCmpAVX(pData, numOfRows, isMinFunc);
|
*val = floatVectorCmpAVX(pData, numOfRows, isMinFunc);
|
||||||
} else {
|
} else {
|
||||||
if (!pBuf->assign) {
|
if (!pBuf->assign) {
|
||||||
|
@ -533,7 +533,7 @@ static void handleDoubleCol(SColumnInfoData* pCol, int32_t start, int32_t numOfR
|
||||||
double* val = (double*)&pBuf->v;
|
double* val = (double*)&pBuf->v;
|
||||||
|
|
||||||
// AVX version to speedup the loop
|
// AVX version to speedup the loop
|
||||||
if (tsAVXEnable && tsSIMDEnable) {
|
if (tsAVXSupported && tsSIMDEnable) {
|
||||||
*val = (double)doubleVectorCmpAVX(pData, numOfRows, isMinFunc);
|
*val = (double)doubleVectorCmpAVX(pData, numOfRows, isMinFunc);
|
||||||
} else {
|
} else {
|
||||||
if (!pBuf->assign) {
|
if (!pBuf->assign) {
|
||||||
|
|
|
@ -1,16 +1,17 @@
|
||||||
/*
|
/**
|
||||||
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
|
* Copyright 2019-2020 DigitalOcean Inc.
|
||||||
*
|
*
|
||||||
* This program is free software: you can use, redistribute, and/or modify
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* it under the terms of the GNU Affero General Public License, version 3
|
* you may not use this file except in compliance with the License.
|
||||||
* or later ("AGPL"), as published by the Free Software Foundation.
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* 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 <assert.h>
|
#include <assert.h>
|
||||||
|
|
|
@ -1,16 +1,17 @@
|
||||||
/*
|
/**
|
||||||
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
|
* Copyright 2019-2020 DigitalOcean Inc.
|
||||||
*
|
*
|
||||||
* This program is free software: you can use, redistribute, and/or modify
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* it under the terms of the GNU Affero General Public License, version 3
|
* you may not use this file except in compliance with the License.
|
||||||
* or later ("AGPL"), as published by the Free Software Foundation.
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* 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"
|
#include "taos_collector_registry_t.h"
|
||||||
|
|
|
@ -1,16 +1,17 @@
|
||||||
/*
|
/**
|
||||||
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
|
* Copyright 2019-2020 DigitalOcean Inc.
|
||||||
*
|
*
|
||||||
* This program is free software: you can use, redistribute, and/or modify
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* it under the terms of the GNU Affero General Public License, version 3
|
* you may not use this file except in compliance with the License.
|
||||||
* or later ("AGPL"), as published by the Free Software Foundation.
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* 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
|
#ifndef TAOS_REGISTRY_T_H
|
||||||
|
|
|
@ -1,16 +1,17 @@
|
||||||
/*
|
/**
|
||||||
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
|
* Copyright 2019-2020 DigitalOcean Inc.
|
||||||
*
|
*
|
||||||
* This program is free software: you can use, redistribute, and/or modify
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* it under the terms of the GNU Affero General Public License, version 3
|
* you may not use this file except in compliance with the License.
|
||||||
* or later ("AGPL"), as published by the Free Software Foundation.
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* 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
|
#ifndef TAOS_COLLECTOR_T_H
|
||||||
|
|
|
@ -1,16 +1,17 @@
|
||||||
/*
|
/**
|
||||||
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
|
* Copyright 2019-2020 DigitalOcean Inc.
|
||||||
*
|
*
|
||||||
* This program is free software: you can use, redistribute, and/or modify
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* it under the terms of the GNU Affero General Public License, version 3
|
* you may not use this file except in compliance with the License.
|
||||||
* or later ("AGPL"), as published by the Free Software Foundation.
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* 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"
|
#define TAOS_STDIO_CLOSE_DIR_ERROR "failed to close dir"
|
||||||
|
|
|
@ -1,16 +1,17 @@
|
||||||
/*
|
/**
|
||||||
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
|
* Copyright 2019-2020 DigitalOcean Inc.
|
||||||
*
|
*
|
||||||
* This program is free software: you can use, redistribute, and/or modify
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* it under the terms of the GNU Affero General Public License, version 3
|
* you may not use this file except in compliance with the License.
|
||||||
* or later ("AGPL"), as published by the Free Software Foundation.
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* 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
|
#ifndef TAOS_LIST_I_INCLUDED
|
||||||
|
|
|
@ -1,16 +1,17 @@
|
||||||
/*
|
/**
|
||||||
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
|
* Copyright 2019-2020 DigitalOcean Inc.
|
||||||
*
|
*
|
||||||
* This program is free software: you can use, redistribute, and/or modify
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* it under the terms of the GNU Affero General Public License, version 3
|
* you may not use this file except in compliance with the License.
|
||||||
* or later ("AGPL"), as published by the Free Software Foundation.
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* 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
|
#ifndef TAOS_LIST_T_H
|
||||||
|
|
|
@ -1,16 +1,17 @@
|
||||||
/*
|
/**
|
||||||
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
|
* Copyright 2019-2020 DigitalOcean Inc.
|
||||||
*
|
*
|
||||||
* This program is free software: you can use, redistribute, and/or modify
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* it under the terms of the GNU Affero General Public License, version 3
|
* you may not use this file except in compliance with the License.
|
||||||
* or later ("AGPL"), as published by the Free Software Foundation.
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* 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 <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
|
@ -1,16 +1,17 @@
|
||||||
/*
|
/**
|
||||||
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
|
* Copyright 2019-2020 DigitalOcean Inc.
|
||||||
*
|
*
|
||||||
* This program is free software: you can use, redistribute, and/or modify
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* it under the terms of the GNU Affero General Public License, version 3
|
* you may not use this file except in compliance with the License.
|
||||||
* or later ("AGPL"), as published by the Free Software Foundation.
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* 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
|
#ifndef TAOS_MAP_I_INCLUDED
|
||||||
|
|
|
@ -1,16 +1,17 @@
|
||||||
/*
|
/**
|
||||||
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
|
* Copyright 2019-2020 DigitalOcean Inc.
|
||||||
*
|
*
|
||||||
* This program is free software: you can use, redistribute, and/or modify
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* it under the terms of the GNU Affero General Public License, version 3
|
* you may not use this file except in compliance with the License.
|
||||||
* or later ("AGPL"), as published by the Free Software Foundation.
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* 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
|
#ifndef TAOS_MAP_T_H
|
||||||
|
|
|
@ -1,16 +1,17 @@
|
||||||
/*
|
/**
|
||||||
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
|
* Copyright 2019-2020 DigitalOcean Inc.
|
||||||
*
|
*
|
||||||
* This program is free software: you can use, redistribute, and/or modify
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* it under the terms of the GNU Affero General Public License, version 3
|
* you may not use this file except in compliance with the License.
|
||||||
* or later ("AGPL"), as published by the Free Software Foundation.
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* 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
|
#ifndef TAOS_METRIC_FORMATTER_CUSTOMV2_I_H
|
||||||
|
|
|
@ -1,16 +1,17 @@
|
||||||
/*
|
/**
|
||||||
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
|
* Copyright 2019-2020 DigitalOcean Inc.
|
||||||
*
|
*
|
||||||
* This program is free software: you can use, redistribute, and/or modify
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* it under the terms of the GNU Affero General Public License, version 3
|
* you may not use this file except in compliance with the License.
|
||||||
* or later ("AGPL"), as published by the Free Software Foundation.
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* 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
|
#ifndef TAOS_METRIC_FORMATTER_I_H
|
||||||
|
|
|
@ -1,16 +1,17 @@
|
||||||
/*
|
/**
|
||||||
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
|
* Copyright 2019-2020 DigitalOcean Inc.
|
||||||
*
|
*
|
||||||
* This program is free software: you can use, redistribute, and/or modify
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* it under the terms of the GNU Affero General Public License, version 3
|
* you may not use this file except in compliance with the License.
|
||||||
* or later ("AGPL"), as published by the Free Software Foundation.
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* 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
|
#ifndef TAOS_METRIC_FORMATTER_T_H
|
||||||
|
|
|
@ -1,16 +1,17 @@
|
||||||
/*
|
/**
|
||||||
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
|
* Copyright 2019-2020 DigitalOcean Inc.
|
||||||
*
|
*
|
||||||
* This program is free software: you can use, redistribute, and/or modify
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* it under the terms of the GNU Affero General Public License, version 3
|
* you may not use this file except in compliance with the License.
|
||||||
* or later ("AGPL"), as published by the Free Software Foundation.
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* 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
|
// Private
|
||||||
|
|
|
@ -1,16 +1,17 @@
|
||||||
/*
|
/**
|
||||||
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
|
* Copyright 2019-2020 DigitalOcean Inc.
|
||||||
*
|
*
|
||||||
* This program is free software: you can use, redistribute, and/or modify
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* it under the terms of the GNU Affero General Public License, version 3
|
* you may not use this file except in compliance with the License.
|
||||||
* or later ("AGPL"), as published by the Free Software Foundation.
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* 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"
|
#include "taos_metric_sample_t.h"
|
||||||
|
|
|
@ -1,16 +1,17 @@
|
||||||
/*
|
/**
|
||||||
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
|
* Copyright 2019-2020 DigitalOcean Inc.
|
||||||
*
|
*
|
||||||
* This program is free software: you can use, redistribute, and/or modify
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* it under the terms of the GNU Affero General Public License, version 3
|
* you may not use this file except in compliance with the License.
|
||||||
* or later ("AGPL"), as published by the Free Software Foundation.
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* 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
|
#ifndef TAOS_METRIC_SAMPLE_T_H
|
||||||
|
|
|
@ -1,16 +1,17 @@
|
||||||
/*
|
/**
|
||||||
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
|
* Copyright 2019-2020 DigitalOcean Inc.
|
||||||
*
|
*
|
||||||
* This program is free software: you can use, redistribute, and/or modify
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* it under the terms of the GNU Affero General Public License, version 3
|
* you may not use this file except in compliance with the License.
|
||||||
* or later ("AGPL"), as published by the Free Software Foundation.
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* 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
|
#ifndef TAOS_METRIC_T_H
|
||||||
|
|
|
@ -1,16 +1,17 @@
|
||||||
/*
|
/**
|
||||||
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
|
* Copyright 2019-2020 DigitalOcean Inc.
|
||||||
*
|
*
|
||||||
* This program is free software: you can use, redistribute, and/or modify
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* it under the terms of the GNU Affero General Public License, version 3
|
* you may not use this file except in compliance with the License.
|
||||||
* or later ("AGPL"), as published by the Free Software Foundation.
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* 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
|
#ifndef TAOS_MONITOR_UTIL_I_H
|
||||||
|
|
|
@ -1,16 +1,17 @@
|
||||||
/*
|
/**
|
||||||
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
|
* Copyright 2019-2020 DigitalOcean Inc.
|
||||||
*
|
*
|
||||||
* This program is free software: you can use, redistribute, and/or modify
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* it under the terms of the GNU Affero General Public License, version 3
|
* you may not use this file except in compliance with the License.
|
||||||
* or later ("AGPL"), as published by the Free Software Foundation.
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* 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
|
#ifndef TAOS_STRING_BUILDER_I_H
|
||||||
|
|
|
@ -1,16 +1,17 @@
|
||||||
/*
|
/**
|
||||||
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
|
* Copyright 2019-2020 DigitalOcean Inc.
|
||||||
*
|
*
|
||||||
* This program is free software: you can use, redistribute, and/or modify
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* it under the terms of the GNU Affero General Public License, version 3
|
* you may not use this file except in compliance with the License.
|
||||||
* or later ("AGPL"), as published by the Free Software Foundation.
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* 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
|
#ifndef TAOS_STRING_BUILDER_T_H
|
||||||
|
|
|
@ -1,16 +1,17 @@
|
||||||
/*
|
/**
|
||||||
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
|
* Copyright 2019-2020 DigitalOcean Inc.
|
||||||
*
|
*
|
||||||
* This program is free software: you can use, redistribute, and/or modify
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* it under the terms of the GNU Affero General Public License, version 3
|
* you may not use this file except in compliance with the License.
|
||||||
* or later ("AGPL"), as published by the Free Software Foundation.
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* 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 <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
|
@ -1,16 +1,17 @@
|
||||||
/*
|
/**
|
||||||
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
|
* Copyright 2019-2020 DigitalOcean Inc.
|
||||||
*
|
*
|
||||||
* This program is free software: you can use, redistribute, and/or modify
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* it under the terms of the GNU Affero General Public License, version 3
|
* you may not use this file except in compliance with the License.
|
||||||
* or later ("AGPL"), as published by the Free Software Foundation.
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* 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 <pthread.h>
|
#include <pthread.h>
|
||||||
|
|
|
@ -1,16 +1,17 @@
|
||||||
/*
|
/**
|
||||||
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
|
* Copyright 2019-2020 DigitalOcean Inc.
|
||||||
*
|
*
|
||||||
* This program is free software: you can use, redistribute, and/or modify
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* it under the terms of the GNU Affero General Public License, version 3
|
* you may not use this file except in compliance with the License.
|
||||||
* or later ("AGPL"), as published by the Free Software Foundation.
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* 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
|
// Public
|
||||||
|
|
|
@ -1,16 +1,17 @@
|
||||||
/*
|
/**
|
||||||
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
|
* Copyright 2019-2020 DigitalOcean Inc.
|
||||||
*
|
*
|
||||||
* This program is free software: you can use, redistribute, and/or modify
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* it under the terms of the GNU Affero General Public License, version 3
|
* you may not use this file except in compliance with the License.
|
||||||
* or later ("AGPL"), as published by the Free Software Foundation.
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* 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
|
// Public
|
||||||
|
|
|
@ -1,16 +1,17 @@
|
||||||
/*
|
/**
|
||||||
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
|
* Copyright 2019-2020 DigitalOcean Inc.
|
||||||
*
|
*
|
||||||
* This program is free software: you can use, redistribute, and/or modify
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* it under the terms of the GNU Affero General Public License, version 3
|
* you may not use this file except in compliance with the License.
|
||||||
* or later ("AGPL"), as published by the Free Software Foundation.
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* 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
|
// Public
|
||||||
|
|
|
@ -1,16 +1,17 @@
|
||||||
/*
|
/**
|
||||||
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
|
* Copyright 2019-2020 DigitalOcean Inc.
|
||||||
*
|
*
|
||||||
* This program is free software: you can use, redistribute, and/or modify
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* it under the terms of the GNU Affero General Public License, version 3
|
* you may not use this file except in compliance with the License.
|
||||||
* or later ("AGPL"), as published by the Free Software Foundation.
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* 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 <pthread.h>
|
#include <pthread.h>
|
||||||
|
|
|
@ -1,16 +1,17 @@
|
||||||
/*
|
/**
|
||||||
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
|
* Copyright 2019-2020 DigitalOcean Inc.
|
||||||
*
|
*
|
||||||
* This program is free software: you can use, redistribute, and/or modify
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* it under the terms of the GNU Affero General Public License, version 3
|
* you may not use this file except in compliance with the License.
|
||||||
* or later ("AGPL"), as published by the Free Software Foundation.
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* 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 <pthread.h>
|
#include <pthread.h>
|
||||||
|
|
|
@ -1,16 +1,17 @@
|
||||||
/*
|
/**
|
||||||
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
|
* Copyright 2019-2020 DigitalOcean Inc.
|
||||||
*
|
*
|
||||||
* This program is free software: you can use, redistribute, and/or modify
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* it under the terms of the GNU Affero General Public License, version 3
|
* you may not use this file except in compliance with the License.
|
||||||
* or later ("AGPL"), as published by the Free Software Foundation.
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* 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 <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
|
@ -1,16 +1,17 @@
|
||||||
/*
|
/**
|
||||||
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
|
* Copyright 2019-2020 DigitalOcean Inc.
|
||||||
*
|
*
|
||||||
* This program is free software: you can use, redistribute, and/or modify
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* it under the terms of the GNU Affero General Public License, version 3
|
* you may not use this file except in compliance with the License.
|
||||||
* or later ("AGPL"), as published by the Free Software Foundation.
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* 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
|
#define ALLOW_FORBID_FUNC
|
||||||
|
|
|
@ -1,16 +1,17 @@
|
||||||
/*
|
/**
|
||||||
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
|
* Copyright 2019-2020 DigitalOcean Inc.
|
||||||
*
|
*
|
||||||
* This program is free software: you can use, redistribute, and/or modify
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* it under the terms of the GNU Affero General Public License, version 3
|
* you may not use this file except in compliance with the License.
|
||||||
* or later ("AGPL"), as published by the Free Software Foundation.
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* 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.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,16 +1,17 @@
|
||||||
/*
|
/**
|
||||||
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
|
* Copyright 2019-2020 DigitalOcean Inc.
|
||||||
*
|
*
|
||||||
* This program is free software: you can use, redistribute, and/or modify
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* it under the terms of the GNU Affero General Public License, version 3
|
* you may not use this file except in compliance with the License.
|
||||||
* or later ("AGPL"), as published by the Free Software Foundation.
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* 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.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,16 +1,17 @@
|
||||||
/*
|
/**
|
||||||
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
|
* Copyright 2019-2020 DigitalOcean Inc.
|
||||||
*
|
*
|
||||||
* This program is free software: you can use, redistribute, and/or modify
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* it under the terms of the GNU Affero General Public License, version 3
|
* you may not use this file except in compliance with the License.
|
||||||
* or later ("AGPL"), as published by the Free Software Foundation.
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* 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 <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
|
@ -236,6 +236,7 @@ const char* nodesNodeName(ENodeType type) {
|
||||||
case QUERY_NODE_SHOW_TAGS_STMT:
|
case QUERY_NODE_SHOW_TAGS_STMT:
|
||||||
return "ShowTagsStmt";
|
return "ShowTagsStmt";
|
||||||
case QUERY_NODE_SHOW_USERS_STMT:
|
case QUERY_NODE_SHOW_USERS_STMT:
|
||||||
|
case QUERY_NODE_SHOW_USERS_FULL_STMT:
|
||||||
return "ShowUsersStmt";
|
return "ShowUsersStmt";
|
||||||
case QUERY_NODE_SHOW_LICENCES_STMT:
|
case QUERY_NODE_SHOW_LICENCES_STMT:
|
||||||
return "ShowGrantsStmt";
|
return "ShowGrantsStmt";
|
||||||
|
@ -7655,6 +7656,7 @@ static int32_t specificNodeToJson(const void* pObj, SJson* pJson) {
|
||||||
case QUERY_NODE_SHOW_TAGS_STMT:
|
case QUERY_NODE_SHOW_TAGS_STMT:
|
||||||
return showTagsStmtToJson(pObj, pJson);
|
return showTagsStmtToJson(pObj, pJson);
|
||||||
case QUERY_NODE_SHOW_USERS_STMT:
|
case QUERY_NODE_SHOW_USERS_STMT:
|
||||||
|
case QUERY_NODE_SHOW_USERS_FULL_STMT:
|
||||||
return showUsersStmtToJson(pObj, pJson);
|
return showUsersStmtToJson(pObj, pJson);
|
||||||
case QUERY_NODE_SHOW_VGROUPS_STMT:
|
case QUERY_NODE_SHOW_VGROUPS_STMT:
|
||||||
return showVgroupsStmtToJson(pObj, pJson);
|
return showVgroupsStmtToJson(pObj, pJson);
|
||||||
|
@ -8004,6 +8006,7 @@ static int32_t jsonToSpecificNode(const SJson* pJson, void* pObj) {
|
||||||
case QUERY_NODE_SHOW_TAGS_STMT:
|
case QUERY_NODE_SHOW_TAGS_STMT:
|
||||||
return jsonToShowTagsStmt(pJson, pObj);
|
return jsonToShowTagsStmt(pJson, pObj);
|
||||||
case QUERY_NODE_SHOW_USERS_STMT:
|
case QUERY_NODE_SHOW_USERS_STMT:
|
||||||
|
case QUERY_NODE_SHOW_USERS_FULL_STMT:
|
||||||
return jsonToShowUsersStmt(pJson, pObj);
|
return jsonToShowUsersStmt(pJson, pObj);
|
||||||
case QUERY_NODE_SHOW_VGROUPS_STMT:
|
case QUERY_NODE_SHOW_VGROUPS_STMT:
|
||||||
return jsonToShowVgroupsStmt(pJson, pObj);
|
return jsonToShowVgroupsStmt(pJson, pObj);
|
||||||
|
|
|
@ -524,6 +524,7 @@ SNode* nodesMakeNode(ENodeType type) {
|
||||||
case QUERY_NODE_SHOW_STREAMS_STMT:
|
case QUERY_NODE_SHOW_STREAMS_STMT:
|
||||||
case QUERY_NODE_SHOW_TABLES_STMT:
|
case QUERY_NODE_SHOW_TABLES_STMT:
|
||||||
case QUERY_NODE_SHOW_USERS_STMT:
|
case QUERY_NODE_SHOW_USERS_STMT:
|
||||||
|
case QUERY_NODE_SHOW_USERS_FULL_STMT:
|
||||||
case QUERY_NODE_SHOW_LICENCES_STMT:
|
case QUERY_NODE_SHOW_LICENCES_STMT:
|
||||||
case QUERY_NODE_SHOW_VGROUPS_STMT:
|
case QUERY_NODE_SHOW_VGROUPS_STMT:
|
||||||
case QUERY_NODE_SHOW_TOPICS_STMT:
|
case QUERY_NODE_SHOW_TOPICS_STMT:
|
||||||
|
@ -1217,6 +1218,7 @@ void nodesDestroyNode(SNode* pNode) {
|
||||||
case QUERY_NODE_SHOW_STREAMS_STMT:
|
case QUERY_NODE_SHOW_STREAMS_STMT:
|
||||||
case QUERY_NODE_SHOW_TABLES_STMT:
|
case QUERY_NODE_SHOW_TABLES_STMT:
|
||||||
case QUERY_NODE_SHOW_USERS_STMT:
|
case QUERY_NODE_SHOW_USERS_STMT:
|
||||||
|
case QUERY_NODE_SHOW_USERS_FULL_STMT:
|
||||||
case QUERY_NODE_SHOW_LICENCES_STMT:
|
case QUERY_NODE_SHOW_LICENCES_STMT:
|
||||||
case QUERY_NODE_SHOW_VGROUPS_STMT:
|
case QUERY_NODE_SHOW_VGROUPS_STMT:
|
||||||
case QUERY_NODE_SHOW_TOPICS_STMT:
|
case QUERY_NODE_SHOW_TOPICS_STMT:
|
||||||
|
@ -2676,6 +2678,18 @@ SValueNode* nodesMakeValueNodeFromBool(bool b) {
|
||||||
return pValNode;
|
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) {
|
bool nodesIsStar(SNode* pNode) {
|
||||||
return (QUERY_NODE_COLUMN == nodeType(pNode)) && ('\0' == ((SColumnNode*)pNode)->tableAlias[0]) &&
|
return (QUERY_NODE_COLUMN == nodeType(pNode)) && ('\0' == ((SColumnNode*)pNode)->tableAlias[0]) &&
|
||||||
(0 == strcmp(((SColumnNode*)pNode)->colName, "*"));
|
(0 == strcmp(((SColumnNode*)pNode)->colName, "*"));
|
||||||
|
|
|
@ -222,6 +222,7 @@ SNode* setAlterSuperTableType(SNode* pStmt);
|
||||||
SNode* createUseDatabaseStmt(SAstCreateContext* pCxt, SToken* pDbName);
|
SNode* createUseDatabaseStmt(SAstCreateContext* pCxt, SToken* pDbName);
|
||||||
SNode* setShowKind(SAstCreateContext* pCxt, SNode* pStmt, EShowKind showKind);
|
SNode* setShowKind(SAstCreateContext* pCxt, SNode* pStmt, EShowKind showKind);
|
||||||
SNode* createShowStmt(SAstCreateContext* pCxt, ENodeType type);
|
SNode* createShowStmt(SAstCreateContext* pCxt, ENodeType type);
|
||||||
|
SNode* createShowStmtWithFull(SAstCreateContext* pCxt, ENodeType type);
|
||||||
SNode* createShowStmtWithCond(SAstCreateContext* pCxt, ENodeType type, SNode* pDbName, SNode* pTbName,
|
SNode* createShowStmtWithCond(SAstCreateContext* pCxt, ENodeType type, SNode* pDbName, SNode* pTbName,
|
||||||
EOperatorType tableCondType);
|
EOperatorType tableCondType);
|
||||||
SNode* createShowTablesStmt(SAstCreateContext* pCxt, SShowTablesOption option, SNode* pTbName,
|
SNode* createShowTablesStmt(SAstCreateContext* pCxt, SShowTablesOption option, SNode* pTbName,
|
||||||
|
@ -234,7 +235,8 @@ SNode* createShowTableDistributedStmt(SAstCreateContext* pCxt, SNode* pRealTable
|
||||||
SNode* createShowDnodeVariablesStmt(SAstCreateContext* pCxt, SNode* pDnodeId, SNode* pLikePattern);
|
SNode* createShowDnodeVariablesStmt(SAstCreateContext* pCxt, SNode* pDnodeId, SNode* pLikePattern);
|
||||||
SNode* createShowVnodesStmt(SAstCreateContext* pCxt, SNode* pDnodeId, SNode* pDnodeEndpoint);
|
SNode* createShowVnodesStmt(SAstCreateContext* pCxt, SNode* pDnodeId, SNode* pDnodeEndpoint);
|
||||||
SNode* createShowTableTagsStmt(SAstCreateContext* pCxt, SNode* pTbName, SNode* pDbName, SNodeList* pTags);
|
SNode* createShowTableTagsStmt(SAstCreateContext* pCxt, SNode* pTbName, SNode* pDbName, SNodeList* pTags);
|
||||||
SNode* createCreateUserStmt(SAstCreateContext* pCxt, SToken* pUserName, const SToken* pPassword, int8_t sysinfo);
|
SNode* createCreateUserStmt(SAstCreateContext* pCxt, SToken* pUserName, const SToken* pPassword, int8_t sysinfo,
|
||||||
|
int8_t createdb, int8_t is_import);
|
||||||
SNode* addCreateUserStmtWhiteList(SAstCreateContext* pCxt, SNode* pStmt, SNodeList* pIpRangesNodeList);
|
SNode* addCreateUserStmtWhiteList(SAstCreateContext* pCxt, SNode* pStmt, SNodeList* pIpRangesNodeList);
|
||||||
SNode* createAlterUserStmt(SAstCreateContext* pCxt, SToken* pUserName, int8_t alterType, void* pAlterInfo);
|
SNode* createAlterUserStmt(SAstCreateContext* pCxt, SToken* pUserName, int8_t alterType, void* pAlterInfo);
|
||||||
SNode* createDropUserStmt(SAstCreateContext* pCxt, SToken* pUserName);
|
SNode* createDropUserStmt(SAstCreateContext* pCxt, SToken* pUserName);
|
||||||
|
|
|
@ -95,10 +95,19 @@ white_list(A) ::= HOST ip_range_list(B).
|
||||||
white_list_opt(A) ::= . { A = NULL; }
|
white_list_opt(A) ::= . { A = NULL; }
|
||||||
white_list_opt(A) ::= white_list(B). { A = B; }
|
white_list_opt(A) ::= white_list(B). { A = B; }
|
||||||
|
|
||||||
|
%type is_import_opt { int8_t }
|
||||||
|
%destructor is_import_opt { }
|
||||||
|
is_import_opt(A) ::= . { A = 0; }
|
||||||
|
is_import_opt(A) ::= IS_IMPORT NK_INTEGER(B). { A = taosStr2Int8(B.z, NULL, 10); }
|
||||||
|
|
||||||
|
%type is_createdb_opt { int8_t }
|
||||||
|
%destructor is_createdb_opt { }
|
||||||
|
is_createdb_opt(A) ::= . { A = 0; }
|
||||||
|
is_createdb_opt(A) ::= CREATEDB NK_INTEGER(B). { A = taosStr2Int8(B.z, NULL, 10); }
|
||||||
/************************************************ create/alter/drop user **********************************************/
|
/************************************************ create/alter/drop user **********************************************/
|
||||||
cmd ::= CREATE USER user_name(A) PASS NK_STRING(B) sysinfo_opt(C)
|
cmd ::= CREATE USER user_name(A) PASS NK_STRING(B) sysinfo_opt(C) is_createdb_opt(F) is_import_opt(E)
|
||||||
white_list_opt(D). {
|
white_list_opt(D). {
|
||||||
pCxt->pRootNode = createCreateUserStmt(pCxt, &A, &B, C);
|
pCxt->pRootNode = createCreateUserStmt(pCxt, &A, &B, C, E, F);
|
||||||
pCxt->pRootNode = addCreateUserStmtWhiteList(pCxt, pCxt->pRootNode, D);
|
pCxt->pRootNode = addCreateUserStmtWhiteList(pCxt, pCxt->pRootNode, D);
|
||||||
}
|
}
|
||||||
cmd ::= ALTER USER user_name(A) PASS NK_STRING(B). { pCxt->pRootNode = createAlterUserStmt(pCxt, &A, TSDB_ALTER_USER_PASSWD, &B); }
|
cmd ::= ALTER USER user_name(A) PASS NK_STRING(B). { pCxt->pRootNode = createAlterUserStmt(pCxt, &A, TSDB_ALTER_USER_PASSWD, &B); }
|
||||||
|
@ -494,6 +503,7 @@ col_name(A) ::= column_name(B).
|
||||||
/************************************************ show ****************************************************************/
|
/************************************************ show ****************************************************************/
|
||||||
cmd ::= SHOW DNODES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DNODES_STMT); }
|
cmd ::= SHOW DNODES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DNODES_STMT); }
|
||||||
cmd ::= SHOW USERS. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USERS_STMT); }
|
cmd ::= SHOW USERS. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USERS_STMT); }
|
||||||
|
cmd ::= SHOW USERS FULL. { pCxt->pRootNode = createShowStmtWithFull(pCxt, QUERY_NODE_SHOW_USERS_FULL_STMT); }
|
||||||
cmd ::= SHOW USER PRIVILEGES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USER_PRIVILEGES_STMT); }
|
cmd ::= SHOW USER PRIVILEGES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USER_PRIVILEGES_STMT); }
|
||||||
cmd ::= SHOW db_kind_opt(A) DATABASES. {
|
cmd ::= SHOW db_kind_opt(A) DATABASES. {
|
||||||
pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT);
|
pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT);
|
||||||
|
|
|
@ -2010,6 +2010,15 @@ SNode* createShowStmt(SAstCreateContext* pCxt, ENodeType type) {
|
||||||
CHECK_PARSER_STATUS(pCxt);
|
CHECK_PARSER_STATUS(pCxt);
|
||||||
SShowStmt* pStmt = (SShowStmt*)nodesMakeNode(type);
|
SShowStmt* pStmt = (SShowStmt*)nodesMakeNode(type);
|
||||||
CHECK_OUT_OF_MEM(pStmt);
|
CHECK_OUT_OF_MEM(pStmt);
|
||||||
|
pStmt->withFull = false;
|
||||||
|
return (SNode*)pStmt;
|
||||||
|
}
|
||||||
|
|
||||||
|
SNode* createShowStmtWithFull(SAstCreateContext* pCxt, ENodeType type) {
|
||||||
|
CHECK_PARSER_STATUS(pCxt);
|
||||||
|
SShowStmt* pStmt = (SShowStmt*)nodesMakeNode(type);
|
||||||
|
CHECK_OUT_OF_MEM(pStmt);
|
||||||
|
pStmt->withFull = true;
|
||||||
return (SNode*)pStmt;
|
return (SNode*)pStmt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2250,7 +2259,8 @@ SNode* addCreateUserStmtWhiteList(SAstCreateContext* pCxt, SNode* pCreateUserStm
|
||||||
return pCreateUserStmt;
|
return pCreateUserStmt;
|
||||||
}
|
}
|
||||||
|
|
||||||
SNode* createCreateUserStmt(SAstCreateContext* pCxt, SToken* pUserName, const SToken* pPassword, int8_t sysinfo) {
|
SNode* createCreateUserStmt(SAstCreateContext* pCxt, SToken* pUserName, const SToken* pPassword, int8_t sysinfo,
|
||||||
|
int8_t createDb, int8_t is_import) {
|
||||||
CHECK_PARSER_STATUS(pCxt);
|
CHECK_PARSER_STATUS(pCxt);
|
||||||
char password[TSDB_USET_PASSWORD_LEN + 3] = {0};
|
char password[TSDB_USET_PASSWORD_LEN + 3] = {0};
|
||||||
if (!checkUserName(pCxt, pUserName) || !checkPassword(pCxt, pPassword, password)) {
|
if (!checkUserName(pCxt, pUserName) || !checkPassword(pCxt, pPassword, password)) {
|
||||||
|
@ -2261,6 +2271,8 @@ SNode* createCreateUserStmt(SAstCreateContext* pCxt, SToken* pUserName, const ST
|
||||||
COPY_STRING_FORM_ID_TOKEN(pStmt->userName, pUserName);
|
COPY_STRING_FORM_ID_TOKEN(pStmt->userName, pUserName);
|
||||||
strcpy(pStmt->password, password);
|
strcpy(pStmt->password, password);
|
||||||
pStmt->sysinfo = sysinfo;
|
pStmt->sysinfo = sysinfo;
|
||||||
|
pStmt->createDb = createDb;
|
||||||
|
pStmt->isImport = is_import;
|
||||||
return (SNode*)pStmt;
|
return (SNode*)pStmt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2902,7 +2914,8 @@ SNode* createSyncdbStmt(SAstCreateContext* pCxt, const SToken* pDbName) {
|
||||||
SNode* createGrantStmt(SAstCreateContext* pCxt, int64_t privileges, STokenPair* pPrivLevel, SToken* pUserName,
|
SNode* createGrantStmt(SAstCreateContext* pCxt, int64_t privileges, STokenPair* pPrivLevel, SToken* pUserName,
|
||||||
SNode* pTagCond) {
|
SNode* pTagCond) {
|
||||||
CHECK_PARSER_STATUS(pCxt);
|
CHECK_PARSER_STATUS(pCxt);
|
||||||
if (!checkDbName(pCxt, &pPrivLevel->first, false) || !checkUserName(pCxt, pUserName)) {
|
if (!checkDbName(pCxt, &pPrivLevel->first, false) || !checkUserName(pCxt, pUserName) ||
|
||||||
|
!checkTableName(pCxt, &pPrivLevel->second)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
SGrantStmt* pStmt = (SGrantStmt*)nodesMakeNode(QUERY_NODE_GRANT_STMT);
|
SGrantStmt* pStmt = (SGrantStmt*)nodesMakeNode(QUERY_NODE_GRANT_STMT);
|
||||||
|
|
|
@ -557,6 +557,11 @@ static int32_t collectMetaKeyFromShowUsers(SCollectMetaKeyCxt* pCxt, SShowStmt*
|
||||||
pCxt->pMetaCache);
|
pCxt->pMetaCache);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int32_t collectMetaKeyFromShowUsersFull(SCollectMetaKeyCxt* pCxt, SShowStmt* pStmt) {
|
||||||
|
return reserveTableMetaInCache(pCxt->pParseCxt->acctId, TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_USERS_FULL,
|
||||||
|
pCxt->pMetaCache);
|
||||||
|
}
|
||||||
|
|
||||||
static int32_t collectMetaKeyFromShowLicence(SCollectMetaKeyCxt* pCxt, SShowStmt* pStmt) {
|
static int32_t collectMetaKeyFromShowLicence(SCollectMetaKeyCxt* pCxt, SShowStmt* pStmt) {
|
||||||
return reserveTableMetaInCache(pCxt->pParseCxt->acctId, TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_LICENCES,
|
return reserveTableMetaInCache(pCxt->pParseCxt->acctId, TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_LICENCES,
|
||||||
pCxt->pMetaCache);
|
pCxt->pMetaCache);
|
||||||
|
@ -821,6 +826,16 @@ static int32_t collectMetaKeyFromShowTSMASStmt(SCollectMetaKeyCxt* pCxt, SShowSt
|
||||||
pCxt->pMetaCache);
|
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) {
|
static int32_t collectMetaKeyFromQuery(SCollectMetaKeyCxt* pCxt, SNode* pStmt) {
|
||||||
pCxt->pStmt = pStmt;
|
pCxt->pStmt = pStmt;
|
||||||
switch (nodeType(pStmt)) {
|
switch (nodeType(pStmt)) {
|
||||||
|
@ -896,6 +911,8 @@ static int32_t collectMetaKeyFromQuery(SCollectMetaKeyCxt* pCxt, SNode* pStmt) {
|
||||||
return collectMetaKeyFromShowStableTags(pCxt, (SShowTableTagsStmt*)pStmt);
|
return collectMetaKeyFromShowStableTags(pCxt, (SShowTableTagsStmt*)pStmt);
|
||||||
case QUERY_NODE_SHOW_USERS_STMT:
|
case QUERY_NODE_SHOW_USERS_STMT:
|
||||||
return collectMetaKeyFromShowUsers(pCxt, (SShowStmt*)pStmt);
|
return collectMetaKeyFromShowUsers(pCxt, (SShowStmt*)pStmt);
|
||||||
|
case QUERY_NODE_SHOW_USERS_FULL_STMT:
|
||||||
|
return collectMetaKeyFromShowUsersFull(pCxt, (SShowStmt*)pStmt);
|
||||||
case QUERY_NODE_SHOW_LICENCES_STMT:
|
case QUERY_NODE_SHOW_LICENCES_STMT:
|
||||||
return collectMetaKeyFromShowLicence(pCxt, (SShowStmt*)pStmt);
|
return collectMetaKeyFromShowLicence(pCxt, (SShowStmt*)pStmt);
|
||||||
case QUERY_NODE_SHOW_VGROUPS_STMT:
|
case QUERY_NODE_SHOW_VGROUPS_STMT:
|
||||||
|
@ -960,6 +977,9 @@ static int32_t collectMetaKeyFromQuery(SCollectMetaKeyCxt* pCxt, SNode* pStmt) {
|
||||||
break;
|
break;
|
||||||
case QUERY_NODE_SHOW_TSMAS_STMT:
|
case QUERY_NODE_SHOW_TSMAS_STMT:
|
||||||
return collectMetaKeyFromShowTSMASStmt(pCxt, (SShowStmt*)pStmt);
|
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:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -351,6 +351,7 @@ static int32_t authQuery(SAuthCxt* pCxt, SNode* pStmt) {
|
||||||
case QUERY_NODE_SHOW_VNODES_STMT:
|
case QUERY_NODE_SHOW_VNODES_STMT:
|
||||||
case QUERY_NODE_SHOW_SCORES_STMT:
|
case QUERY_NODE_SHOW_SCORES_STMT:
|
||||||
case QUERY_NODE_SHOW_USERS_STMT:
|
case QUERY_NODE_SHOW_USERS_STMT:
|
||||||
|
case QUERY_NODE_SHOW_USERS_FULL_STMT:
|
||||||
case QUERY_NODE_SHOW_USER_PRIVILEGES_STMT:
|
case QUERY_NODE_SHOW_USER_PRIVILEGES_STMT:
|
||||||
case QUERY_NODE_SHOW_GRANTS_FULL_STMT:
|
case QUERY_NODE_SHOW_GRANTS_FULL_STMT:
|
||||||
case QUERY_NODE_SHOW_GRANTS_LOGS_STMT:
|
case QUERY_NODE_SHOW_GRANTS_LOGS_STMT:
|
||||||
|
|
|
@ -334,6 +334,7 @@ static SKeyword keywordTable[] = {
|
||||||
{"COMPRESS", TK_COMPRESS},
|
{"COMPRESS", TK_COMPRESS},
|
||||||
{"LEVEL", TK_LEVEL},
|
{"LEVEL", TK_LEVEL},
|
||||||
{"ARBGROUPS", TK_ARBGROUPS},
|
{"ARBGROUPS", TK_ARBGROUPS},
|
||||||
|
{"IS_IMPORT", TK_IS_IMPORT},
|
||||||
};
|
};
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,20 @@
|
||||||
|
|
||||||
#define SYSTABLE_SHOW_TYPE_OFFSET QUERY_NODE_SHOW_DNODES_STMT
|
#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 {
|
typedef struct SRewriteTbNameContext {
|
||||||
int32_t errCode;
|
int32_t errCode;
|
||||||
char* pTbName;
|
char* pTbName;
|
||||||
|
@ -183,6 +197,13 @@ static const SSysTableShowAdapter sysTableShowAdapter[] = {
|
||||||
.numOfShowCols = 1,
|
.numOfShowCols = 1,
|
||||||
.pShowCols = {"*"}
|
.pShowCols = {"*"}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
.showType = QUERY_NODE_SHOW_USERS_FULL_STMT,
|
||||||
|
.pDbName = TSDB_INFORMATION_SCHEMA_DB,
|
||||||
|
.pTableName = TSDB_INS_TABLE_USERS_FULL,
|
||||||
|
.numOfShowCols = 1,
|
||||||
|
.pShowCols = {"*"}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
.showType = QUERY_NODE_SHOW_LICENCES_STMT,
|
.showType = QUERY_NODE_SHOW_LICENCES_STMT,
|
||||||
.pDbName = TSDB_INFORMATION_SCHEMA_DB,
|
.pDbName = TSDB_INFORMATION_SCHEMA_DB,
|
||||||
|
@ -8504,6 +8525,8 @@ static int32_t translateCreateUser(STranslateContext* pCxt, SCreateUserStmt* pSt
|
||||||
createReq.sysInfo = pStmt->sysinfo;
|
createReq.sysInfo = pStmt->sysinfo;
|
||||||
createReq.enable = 1;
|
createReq.enable = 1;
|
||||||
strcpy(createReq.pass, pStmt->password);
|
strcpy(createReq.pass, pStmt->password);
|
||||||
|
createReq.isImport = pStmt->isImport;
|
||||||
|
createReq.createDb = pStmt->createDb;
|
||||||
|
|
||||||
createReq.numIpRanges = pStmt->numIpRanges;
|
createReq.numIpRanges = pStmt->numIpRanges;
|
||||||
if (pStmt->numIpRanges > 0) {
|
if (pStmt->numIpRanges > 0) {
|
||||||
|
@ -11607,20 +11630,6 @@ static int32_t extractShowCreateDatabaseResultSchema(int32_t* numOfCols, SSchema
|
||||||
return TSDB_CODE_SUCCESS;
|
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) {
|
static int32_t extractShowCreateTableResultSchema(int32_t* numOfCols, SSchema** pSchema) {
|
||||||
*numOfCols = 2;
|
*numOfCols = 2;
|
||||||
*pSchema = taosMemoryCalloc((*numOfCols), sizeof(SSchema));
|
*pSchema = taosMemoryCalloc((*numOfCols), sizeof(SSchema));
|
||||||
|
@ -11718,9 +11727,6 @@ int32_t extractResultSchema(const SNode* pRoot, int32_t* numOfCols, SSchema** pS
|
||||||
}
|
}
|
||||||
case QUERY_NODE_SHOW_CREATE_DATABASE_STMT:
|
case QUERY_NODE_SHOW_CREATE_DATABASE_STMT:
|
||||||
return extractShowCreateDatabaseResultSchema(numOfCols, pSchema);
|
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_TABLE_STMT:
|
||||||
case QUERY_NODE_SHOW_CREATE_STABLE_STMT:
|
case QUERY_NODE_SHOW_CREATE_STABLE_STMT:
|
||||||
return extractShowCreateTableResultSchema(numOfCols, pSchema);
|
return extractShowCreateTableResultSchema(numOfCols, pSchema);
|
||||||
|
@ -11847,6 +11853,24 @@ static int32_t createOperatorNode(EOperatorType opType, const char* pColName, SN
|
||||||
return TSDB_CODE_SUCCESS;
|
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) {
|
static const char* getTbNameColName(ENodeType type) {
|
||||||
const char* colName;
|
const char* colName;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
@ -13374,6 +13398,203 @@ static int32_t rewriteShowCompactDetailsStmt(STranslateContext* pCxt, SQuery* pQ
|
||||||
return code;
|
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) {
|
static int32_t rewriteQuery(STranslateContext* pCxt, SQuery* pQuery) {
|
||||||
int32_t code = TSDB_CODE_SUCCESS;
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
switch (nodeType(pQuery->pRoot)) {
|
switch (nodeType(pQuery->pRoot)) {
|
||||||
|
@ -13382,6 +13603,7 @@ static int32_t rewriteQuery(STranslateContext* pCxt, SQuery* pQuery) {
|
||||||
case QUERY_NODE_SHOW_TABLES_STMT:
|
case QUERY_NODE_SHOW_TABLES_STMT:
|
||||||
case QUERY_NODE_SHOW_STABLES_STMT:
|
case QUERY_NODE_SHOW_STABLES_STMT:
|
||||||
case QUERY_NODE_SHOW_USERS_STMT:
|
case QUERY_NODE_SHOW_USERS_STMT:
|
||||||
|
case QUERY_NODE_SHOW_USERS_FULL_STMT:
|
||||||
case QUERY_NODE_SHOW_DNODES_STMT:
|
case QUERY_NODE_SHOW_DNODES_STMT:
|
||||||
case QUERY_NODE_SHOW_MNODES_STMT:
|
case QUERY_NODE_SHOW_MNODES_STMT:
|
||||||
case QUERY_NODE_SHOW_MODULES_STMT:
|
case QUERY_NODE_SHOW_MODULES_STMT:
|
||||||
|
@ -13450,6 +13672,10 @@ static int32_t rewriteQuery(STranslateContext* pCxt, SQuery* pQuery) {
|
||||||
case QUERY_NODE_SHOW_COMPACT_DETAILS_STMT:
|
case QUERY_NODE_SHOW_COMPACT_DETAILS_STMT:
|
||||||
code = rewriteShowCompactDetailsStmt(pCxt, pQuery);
|
code = rewriteShowCompactDetailsStmt(pCxt, pQuery);
|
||||||
break;
|
break;
|
||||||
|
case QUERY_NODE_SHOW_DB_ALIVE_STMT:
|
||||||
|
case QUERY_NODE_SHOW_CLUSTER_ALIVE_STMT:
|
||||||
|
code = rewriteShowAliveStmt(pCxt, pQuery);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -13541,8 +13767,6 @@ static int32_t setQuery(STranslateContext* pCxt, SQuery* pQuery) {
|
||||||
break;
|
break;
|
||||||
case QUERY_NODE_DESCRIBE_STMT:
|
case QUERY_NODE_DESCRIBE_STMT:
|
||||||
case QUERY_NODE_SHOW_CREATE_DATABASE_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_TABLE_STMT:
|
||||||
case QUERY_NODE_SHOW_CREATE_STABLE_STMT:
|
case QUERY_NODE_SHOW_CREATE_STABLE_STMT:
|
||||||
case QUERY_NODE_SHOW_CREATE_VIEW_STMT:
|
case QUERY_NODE_SHOW_CREATE_VIEW_STMT:
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -737,9 +737,10 @@ int32_t castFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutp
|
||||||
int32_t code = TSDB_CODE_SUCCESS;
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
char *convBuf = taosMemoryMalloc(inputLen);
|
char *convBuf = taosMemoryMalloc(inputLen);
|
||||||
char *output = taosMemoryCalloc(1, outputLen + TSDB_NCHAR_SIZE);
|
char *output = taosMemoryCalloc(1, outputLen + TSDB_NCHAR_SIZE);
|
||||||
char buf[400] = {0};
|
int32_t bufSize = TSDB_MAX_FIELD_LEN + 1;
|
||||||
|
char *buf = taosMemoryMalloc(bufSize);
|
||||||
|
|
||||||
if (convBuf == NULL || output == NULL) {
|
if (convBuf == NULL || output == NULL || buf == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
goto _end;
|
goto _end;
|
||||||
}
|
}
|
||||||
|
@ -991,7 +992,7 @@ int32_t castFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutp
|
||||||
memcpy(varDataVal(output), convBuf, len);
|
memcpy(varDataVal(output), convBuf, len);
|
||||||
varDataSetLen(output, len);
|
varDataSetLen(output, len);
|
||||||
} else {
|
} else {
|
||||||
NUM_TO_STRING(inputType, input, sizeof(buf), buf);
|
NUM_TO_STRING(inputType, input, bufSize, buf);
|
||||||
int32_t len = (int32_t)strlen(buf);
|
int32_t len = (int32_t)strlen(buf);
|
||||||
len = (outputLen - VARSTR_HEADER_SIZE) > len ? len : (outputLen - VARSTR_HEADER_SIZE);
|
len = (outputLen - VARSTR_HEADER_SIZE) > len ? len : (outputLen - VARSTR_HEADER_SIZE);
|
||||||
memcpy(varDataVal(output), buf, len);
|
memcpy(varDataVal(output), buf, len);
|
||||||
|
@ -1037,7 +1038,7 @@ int32_t castFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutp
|
||||||
memcpy(output, input, len + VARSTR_HEADER_SIZE);
|
memcpy(output, input, len + VARSTR_HEADER_SIZE);
|
||||||
varDataSetLen(output, len);
|
varDataSetLen(output, len);
|
||||||
} else {
|
} else {
|
||||||
NUM_TO_STRING(inputType, input, sizeof(buf), buf);
|
NUM_TO_STRING(inputType, input, bufSize, buf);
|
||||||
len = (int32_t)strlen(buf);
|
len = (int32_t)strlen(buf);
|
||||||
len = outputCharLen > len ? len : outputCharLen;
|
len = outputCharLen > len ? len : outputCharLen;
|
||||||
bool ret = taosMbsToUcs4(buf, len, (TdUcs4 *)varDataVal(output), outputLen - VARSTR_HEADER_SIZE, &len);
|
bool ret = taosMbsToUcs4(buf, len, (TdUcs4 *)varDataVal(output), outputLen - VARSTR_HEADER_SIZE, &len);
|
||||||
|
@ -1067,6 +1068,7 @@ int32_t castFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutp
|
||||||
pOutput->numOfRows = pInput->numOfRows;
|
pOutput->numOfRows = pInput->numOfRows;
|
||||||
|
|
||||||
_end:
|
_end:
|
||||||
|
taosMemoryFree(buf);
|
||||||
taosMemoryFree(output);
|
taosMemoryFree(output);
|
||||||
taosMemoryFree(convBuf);
|
taosMemoryFree(convBuf);
|
||||||
return code;
|
return code;
|
||||||
|
|
|
@ -141,6 +141,7 @@ int32_t valueToString(void* k, char* buf);
|
||||||
int32_t valueIsStale(void* k, int64_t ts);
|
int32_t valueIsStale(void* k, int64_t ts);
|
||||||
|
|
||||||
void destroyCompare(void* arg);
|
void destroyCompare(void* arg);
|
||||||
|
static void cleanDir(const char* pPath, const char* id);
|
||||||
|
|
||||||
static bool streamStateIterSeekAndValid(rocksdb_iterator_t* iter, char* buf, size_t len);
|
static bool streamStateIterSeekAndValid(rocksdb_iterator_t* iter, char* buf, size_t len);
|
||||||
static rocksdb_iterator_t* streamStateIterCreate(SStreamState* pState, const char* cfName,
|
static rocksdb_iterator_t* streamStateIterCreate(SStreamState* pState, const char* cfName,
|
||||||
|
@ -212,12 +213,7 @@ int32_t rebuildDirFromCheckpoint(const char* path, int64_t chkpId, char** dst) {
|
||||||
char* chkp = taosMemoryCalloc(1, strlen(path) + 64);
|
char* chkp = taosMemoryCalloc(1, strlen(path) + 64);
|
||||||
sprintf(chkp, "%s%s%s%scheckpoint%" PRId64 "", path, TD_DIRSEP, "checkpoints", TD_DIRSEP, chkpId);
|
sprintf(chkp, "%s%s%s%scheckpoint%" PRId64 "", path, TD_DIRSEP, "checkpoints", TD_DIRSEP, chkpId);
|
||||||
if (taosIsDir(chkp) && isValidCheckpoint(chkp)) {
|
if (taosIsDir(chkp) && isValidCheckpoint(chkp)) {
|
||||||
if (taosIsDir(state)) {
|
cleanDir(state, "");
|
||||||
// remove dir if exists
|
|
||||||
// taosRenameFile(const char *oldName, const char *newName)
|
|
||||||
taosRemoveDir(state);
|
|
||||||
}
|
|
||||||
taosMkDir(state);
|
|
||||||
code = backendCopyFiles(chkp, state);
|
code = backendCopyFiles(chkp, state);
|
||||||
stInfo("copy snap file from %s to %s", chkp, state);
|
stInfo("copy snap file from %s to %s", chkp, state);
|
||||||
if (code != 0) {
|
if (code != 0) {
|
||||||
|
@ -322,6 +318,22 @@ int32_t remoteChkp_validAndCvtMeta(char* path, SArray* list, int64_t chkpId) {
|
||||||
return complete == 1 ? 0 : -1;
|
return complete == 1 ? 0 : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cleanDir(const char* pPath, const char* id) {
|
||||||
|
ASSERT(pPath != NULL);
|
||||||
|
|
||||||
|
if (taosIsDir(pPath)) {
|
||||||
|
taosRemoveDir(pPath);
|
||||||
|
taosMkDir(pPath);
|
||||||
|
stInfo("%s clear dir:%s, succ", id, pPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void validateDir(const char* pPath) {
|
||||||
|
if (!taosIsDir(pPath)) {
|
||||||
|
taosMulMkDir(pPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int32_t rebuildFromRemoteChkp_rsync(const char* key, char* chkptPath, int64_t checkpointId, char* defaultPath) {
|
int32_t rebuildFromRemoteChkp_rsync(const char* key, char* chkptPath, int64_t checkpointId, char* defaultPath) {
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
if (taosIsDir(chkptPath)) {
|
if (taosIsDir(chkptPath)) {
|
||||||
|
@ -329,11 +341,8 @@ int32_t rebuildFromRemoteChkp_rsync(const char* key, char* chkptPath, int64_t ch
|
||||||
stDebug("remove local checkpoint data dir:%s succ", chkptPath);
|
stDebug("remove local checkpoint data dir:%s succ", chkptPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (taosIsDir(defaultPath)) {
|
cleanDir(defaultPath, key);
|
||||||
taosRemoveDir(defaultPath);
|
stDebug("clear local default dir before downloading checkpoint data:%s succ", defaultPath);
|
||||||
taosMulMkDir(defaultPath);
|
|
||||||
stDebug("clear local default dir before downloading checkpoint data:%s succ", defaultPath);
|
|
||||||
}
|
|
||||||
|
|
||||||
code = streamTaskDownloadCheckpointData(key, chkptPath);
|
code = streamTaskDownloadCheckpointData(key, chkptPath);
|
||||||
if (code != 0) {
|
if (code != 0) {
|
||||||
|
@ -484,21 +493,14 @@ int32_t backendCopyFiles(const char* src, const char* dst) {
|
||||||
static int32_t rebuildFromLocalCheckpoint(const char* pTaskIdStr, const char* checkpointPath, int64_t checkpointId,
|
static int32_t rebuildFromLocalCheckpoint(const char* pTaskIdStr, const char* checkpointPath, int64_t checkpointId,
|
||||||
const char* defaultPath) {
|
const char* defaultPath) {
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
|
cleanDir(defaultPath, pTaskIdStr);
|
||||||
if (taosIsDir(defaultPath)) {
|
|
||||||
taosRemoveDir(defaultPath);
|
|
||||||
taosMkDir(defaultPath);
|
|
||||||
stInfo("%s clear local backend dir:%s, succ", pTaskIdStr, defaultPath);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (taosIsDir(checkpointPath) && isValidCheckpoint(checkpointPath)) {
|
if (taosIsDir(checkpointPath) && isValidCheckpoint(checkpointPath)) {
|
||||||
stDebug("%s local checkpoint data existed, checkpointId:%" PRId64 " copy to backend dir", pTaskIdStr, checkpointId);
|
stDebug("%s local checkpoint data existed, checkpointId:%" PRId64 " copy to backend dir", pTaskIdStr, checkpointId);
|
||||||
|
|
||||||
code = backendCopyFiles(checkpointPath, defaultPath);
|
code = backendCopyFiles(checkpointPath, defaultPath);
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
taosRemoveDir(defaultPath);
|
cleanDir(defaultPath, pTaskIdStr);
|
||||||
taosMkDir(defaultPath);
|
|
||||||
|
|
||||||
stError("%s failed to start stream backend from local %s, reason:%s, try download checkpoint from remote",
|
stError("%s failed to start stream backend from local %s, reason:%s, try download checkpoint from remote",
|
||||||
pTaskIdStr, checkpointPath, tstrerror(TAOS_SYSTEM_ERROR(errno)));
|
pTaskIdStr, checkpointPath, tstrerror(TAOS_SYSTEM_ERROR(errno)));
|
||||||
code = TSDB_CODE_SUCCESS;
|
code = TSDB_CODE_SUCCESS;
|
||||||
|
@ -520,26 +522,18 @@ int32_t restoreCheckpointData(const char* path, const char* key, int64_t chkptId
|
||||||
char* prefixPath = taosMemoryCalloc(1, strlen(path) + 128);
|
char* prefixPath = taosMemoryCalloc(1, strlen(path) + 128);
|
||||||
sprintf(prefixPath, "%s%s%s", path, TD_DIRSEP, key);
|
sprintf(prefixPath, "%s%s%s", path, TD_DIRSEP, key);
|
||||||
|
|
||||||
if (!taosIsDir(prefixPath)) {
|
validateDir(prefixPath);
|
||||||
code = taosMkDir(prefixPath);
|
|
||||||
ASSERT(code == 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
char* defaultPath = taosMemoryCalloc(1, strlen(path) + 256);
|
char* defaultPath = taosMemoryCalloc(1, strlen(path) + 256);
|
||||||
sprintf(defaultPath, "%s%s%s", prefixPath, TD_DIRSEP, "state");
|
sprintf(defaultPath, "%s%s%s", prefixPath, TD_DIRSEP, "state");
|
||||||
|
|
||||||
if (!taosIsDir(defaultPath)) {
|
validateDir(defaultPath);
|
||||||
taosMulMkDir(defaultPath);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t pathLen = strlen(path) + 256;
|
int32_t pathLen = strlen(path) + 256;
|
||||||
|
|
||||||
char* checkpointRoot = taosMemoryCalloc(1, pathLen);
|
char* checkpointRoot = taosMemoryCalloc(1, pathLen);
|
||||||
sprintf(checkpointRoot, "%s%s%s", prefixPath, TD_DIRSEP, "checkpoints");
|
sprintf(checkpointRoot, "%s%s%s", prefixPath, TD_DIRSEP, "checkpoints");
|
||||||
|
|
||||||
if (!taosIsDir(checkpointRoot)) {
|
validateDir(checkpointRoot);
|
||||||
taosMulMkDir(checkpointRoot);
|
|
||||||
}
|
|
||||||
taosMemoryFree(checkpointRoot);
|
taosMemoryFree(checkpointRoot);
|
||||||
|
|
||||||
stDebug("%s check local backend dir:%s, checkpointId:%" PRId64 " succ", key, defaultPath, chkptId);
|
stDebug("%s check local backend dir:%s, checkpointId:%" PRId64 " succ", key, defaultPath, chkptId);
|
||||||
|
@ -559,7 +553,8 @@ int32_t restoreCheckpointData(const char* path, const char* key, int64_t chkptId
|
||||||
code = 0; // reset the error code
|
code = 0; // reset the error code
|
||||||
}
|
}
|
||||||
} else { // no valid checkpoint id
|
} else { // no valid checkpoint id
|
||||||
stInfo("%s no valid checkpoint ever generated, no need to copy checkpoint data", key);
|
stInfo("%s no valid checkpoint ever generated, no need to copy checkpoint data, clean defaultPath:%s", key, defaultPath);
|
||||||
|
cleanDir(defaultPath, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
taosMemoryFree(chkptPath);
|
taosMemoryFree(chkptPath);
|
||||||
|
@ -2055,7 +2050,7 @@ STaskDbWrapper* taskDbOpenImpl(const char* key, char* statePath, char* dbPath) {
|
||||||
|
|
||||||
cfNames = rocksdb_list_column_families(pTaskDb->dbOpt, dbPath, &nCf, &err);
|
cfNames = rocksdb_list_column_families(pTaskDb->dbOpt, dbPath, &nCf, &err);
|
||||||
if (nCf == 0) {
|
if (nCf == 0) {
|
||||||
stInfo("%s newly create db, need to restart", key);
|
stInfo("%s newly create db in state-backend", key);
|
||||||
// pre create db
|
// pre create db
|
||||||
pTaskDb->db = rocksdb_open(pTaskDb->pCfOpts[0], dbPath, &err);
|
pTaskDb->db = rocksdb_open(pTaskDb->pCfOpts[0], dbPath, &err);
|
||||||
if (pTaskDb->db == NULL) goto _EXIT;
|
if (pTaskDb->db == NULL) goto _EXIT;
|
||||||
|
@ -2215,13 +2210,12 @@ int32_t taskDbGenChkpUploadData__s3(STaskDbWrapper* pDb, void* bkdChkpMgt, int64
|
||||||
sprintf(temp, "%s%s%s%" PRId64 "", pDb->path, TD_DIRSEP, "tmp", chkpId);
|
sprintf(temp, "%s%s%s%" PRId64 "", pDb->path, TD_DIRSEP, "tmp", chkpId);
|
||||||
|
|
||||||
if (taosDirExist(temp)) {
|
if (taosDirExist(temp)) {
|
||||||
taosRemoveDir(temp);
|
cleanDir(temp, "");
|
||||||
taosMkDir(temp);
|
|
||||||
} else {
|
} else {
|
||||||
taosMkDir(temp);
|
taosMkDir(temp);
|
||||||
}
|
}
|
||||||
code = bkdMgtGetDelta(p, pDb->idstr, chkpId, list, temp);
|
|
||||||
|
|
||||||
|
code = bkdMgtGetDelta(p, pDb->idstr, chkpId, list, temp);
|
||||||
*path = temp;
|
*path = temp;
|
||||||
|
|
||||||
return code;
|
return code;
|
||||||
|
@ -4329,4 +4323,4 @@ int32_t bkdMgtDumpTo(SBkdMgt* bm, char* taskId, char* dname) {
|
||||||
taosThreadRwlockUnlock(&bm->rwLock);
|
taosThreadRwlockUnlock(&bm->rwLock);
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -299,12 +299,10 @@ int32_t streamTaskStartMonitorCheckRsp(SStreamTask* pTask) {
|
||||||
|
|
||||||
int32_t streamTaskStopMonitorCheckRsp(STaskCheckInfo* pInfo, const char* id) {
|
int32_t streamTaskStopMonitorCheckRsp(STaskCheckInfo* pInfo, const char* id) {
|
||||||
taosThreadMutexLock(&pInfo->checkInfoLock);
|
taosThreadMutexLock(&pInfo->checkInfoLock);
|
||||||
streamTaskCompleteCheckRsp(pInfo, false, id);
|
|
||||||
|
|
||||||
pInfo->stopCheckProcess = 1;
|
pInfo->stopCheckProcess = 1;
|
||||||
taosThreadMutexUnlock(&pInfo->checkInfoLock);
|
taosThreadMutexUnlock(&pInfo->checkInfoLock);
|
||||||
|
|
||||||
stDebug("s-task:%s set stop check-rsp monit", id);
|
stDebug("s-task:%s set stop check-rsp monitor flag", id);
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -438,6 +436,7 @@ int32_t streamTaskStartCheckDownstream(STaskCheckInfo* pInfo, const char* id) {
|
||||||
ASSERT(pInfo->startTs > 0);
|
ASSERT(pInfo->startTs > 0);
|
||||||
stError("s-task:%s already in check procedure, checkTs:%" PRId64 ", start monitor check rsp failed", id,
|
stError("s-task:%s already in check procedure, checkTs:%" PRId64 ", start monitor check rsp failed", id,
|
||||||
pInfo->startTs);
|
pInfo->startTs);
|
||||||
|
pInfo->stopCheckProcess = 0; // disable auto stop of check process
|
||||||
return TSDB_CODE_FAILED;
|
return TSDB_CODE_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -874,9 +874,8 @@ int32_t createCountWinResultBuff(SStreamFileState* pFileState, SSessionKey* pKey
|
||||||
void* pFileStore = getStateFileStore(pFileState);
|
void* pFileStore = getStateFileStore(pFileState);
|
||||||
void* p = NULL;
|
void* p = NULL;
|
||||||
|
|
||||||
SStreamStateCur* pCur = streamStateSessionSeekToLast_rocksdb(pFileStore, pKey->groupId);
|
int32_t code_file = getCountWinStateFromDisc(pFileStore, pWinKey, &p, pVLen);
|
||||||
int32_t code_file = streamStateSessionGetKVByCur_rocksdb(pCur, pWinKey, &p, pVLen);
|
if (code_file == TSDB_CODE_SUCCESS && isFlushedState(pFileState, endTs, 0)) {
|
||||||
if (code_file == TSDB_CODE_SUCCESS || isFlushedState(pFileState, endTs, 0)) {
|
|
||||||
(*pVal) = createSessionWinBuff(pFileState, pWinKey, p, pVLen);
|
(*pVal) = createSessionWinBuff(pFileState, pWinKey, p, pVLen);
|
||||||
code = code_file;
|
code = code_file;
|
||||||
qDebug("===stream===0 get state win:%" PRId64 ",%" PRId64 " from disc, res %d", pWinKey->win.skey, pWinKey->win.ekey, 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;
|
code = TSDB_CODE_FAILED;
|
||||||
taosMemoryFree(p);
|
taosMemoryFree(p);
|
||||||
}
|
}
|
||||||
streamStateFreeCur(pCur);
|
|
||||||
goto _end;
|
goto _end;
|
||||||
} else {
|
} else {
|
||||||
(*pVal) = addNewSessionWindow(pFileState, pWinStates, pWinKey);
|
(*pVal) = addNewSessionWindow(pFileState, pWinStates, pWinKey);
|
||||||
|
|
|
@ -98,8 +98,7 @@ int stateKeyCmpr(const void* pKey1, int kLen1, const void* pKey2, int kLen2) {
|
||||||
return winKeyCmprImpl(&pWin1->key, &pWin2->key);
|
return winKeyCmprImpl(&pWin1->key, &pWin2->key);
|
||||||
}
|
}
|
||||||
|
|
||||||
SStreamState* streamStateOpen(const char* path, void* pTask, int64_t streamId, int32_t taskId, bool specPath,
|
SStreamState* streamStateOpen(const char* path, void* pTask, int64_t streamId, int32_t taskId) {
|
||||||
int32_t szPage, int32_t pages) {
|
|
||||||
SStreamState* pState = taosMemoryCalloc(1, sizeof(SStreamState));
|
SStreamState* pState = taosMemoryCalloc(1, sizeof(SStreamState));
|
||||||
stDebug("open stream state %p, %s", pState, path);
|
stDebug("open stream state %p, %s", pState, path);
|
||||||
if (pState == NULL) {
|
if (pState == NULL) {
|
||||||
|
@ -1097,7 +1096,9 @@ _end:
|
||||||
int32_t streamStatePutParName(SStreamState* pState, int64_t groupId, const char tbname[TSDB_TABLE_NAME_LEN]) {
|
int32_t streamStatePutParName(SStreamState* pState, int64_t groupId, const char tbname[TSDB_TABLE_NAME_LEN]) {
|
||||||
#ifdef USE_ROCKSDB
|
#ifdef USE_ROCKSDB
|
||||||
if (tSimpleHashGet(pState->parNameMap, &groupId, sizeof(int64_t)) == NULL) {
|
if (tSimpleHashGet(pState->parNameMap, &groupId, sizeof(int64_t)) == NULL) {
|
||||||
tSimpleHashPut(pState->parNameMap, &groupId, sizeof(int64_t), tbname, TSDB_TABLE_NAME_LEN);
|
if (tSimpleHashGetSize(pState->parNameMap) < MAX_TABLE_NAME_NUM) {
|
||||||
|
tSimpleHashPut(pState->parNameMap, &groupId, sizeof(int64_t), tbname, TSDB_TABLE_NAME_LEN);
|
||||||
|
}
|
||||||
streamStatePutParName_rocksdb(pState, groupId, tbname);
|
streamStatePutParName_rocksdb(pState, groupId, tbname);
|
||||||
}
|
}
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
|
@ -1107,12 +1108,15 @@ int32_t streamStatePutParName(SStreamState* pState, int64_t groupId, const char
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t streamStateGetParName(SStreamState* pState, int64_t groupId, void** pVal) {
|
int32_t streamStateGetParName(SStreamState* pState, int64_t groupId, void** pVal, bool onlyCache) {
|
||||||
#ifdef USE_ROCKSDB
|
#ifdef USE_ROCKSDB
|
||||||
void* pStr = tSimpleHashGet(pState->parNameMap, &groupId, sizeof(int64_t));
|
void* pStr = tSimpleHashGet(pState->parNameMap, &groupId, sizeof(int64_t));
|
||||||
if (!pStr) {
|
if (!pStr) {
|
||||||
|
if (onlyCache && tSimpleHashGetSize(pState->parNameMap) < MAX_TABLE_NAME_NUM) {
|
||||||
|
return TSDB_CODE_FAILED;
|
||||||
|
}
|
||||||
int32_t code = streamStateGetParName_rocksdb(pState, groupId, pVal);
|
int32_t code = streamStateGetParName_rocksdb(pState, groupId, pVal);
|
||||||
if (code == TSDB_CODE_SUCCESS) {
|
if (code == TSDB_CODE_SUCCESS && tSimpleHashGetSize(pState->parNameMap) < MAX_TABLE_NAME_NUM) {
|
||||||
tSimpleHashPut(pState->parNameMap, &groupId, sizeof(int64_t), *pVal, TSDB_TABLE_NAME_LEN);
|
tSimpleHashPut(pState->parNameMap, &groupId, sizeof(int64_t), *pVal, TSDB_TABLE_NAME_LEN);
|
||||||
}
|
}
|
||||||
return code;
|
return code;
|
||||||
|
|
|
@ -46,7 +46,7 @@ SStreamState *stateCreate(const char *path) {
|
||||||
SStreamMeta *pMeta = streamMetaOpen((path), NULL, NULL, NULL, 0, 0, NULL);
|
SStreamMeta *pMeta = streamMetaOpen((path), NULL, NULL, NULL, 0, 0, NULL);
|
||||||
pTask->pMeta = pMeta;
|
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);
|
ASSERT(p != NULL);
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int32_t level;
|
int32_t level;
|
||||||
int32_t id;
|
int32_t id;
|
||||||
|
int8_t disable; // disable create new file
|
||||||
char *path;
|
char *path;
|
||||||
SDiskSize size;
|
SDiskSize size;
|
||||||
} STfsDisk;
|
} STfsDisk;
|
||||||
|
@ -73,7 +74,7 @@ typedef struct STfs {
|
||||||
SHashObj *hash; // name to did map
|
SHashObj *hash; // name to did map
|
||||||
} STfs;
|
} STfs;
|
||||||
|
|
||||||
STfsDisk *tfsNewDisk(int32_t level, int32_t id, const char *dir);
|
STfsDisk *tfsNewDisk(int32_t level, int32_t id, int8_t disable, const char *dir);
|
||||||
STfsDisk *tfsFreeDisk(STfsDisk *pDisk);
|
STfsDisk *tfsFreeDisk(STfsDisk *pDisk);
|
||||||
int32_t tfsUpdateDiskSize(STfsDisk *pDisk);
|
int32_t tfsUpdateDiskSize(STfsDisk *pDisk);
|
||||||
|
|
||||||
|
|
|
@ -519,6 +519,18 @@ static int32_t tfsCheckAndFormatCfg(STfs *pTfs, SDiskCfg *pCfg) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pCfg->primary < 0 || pCfg->primary > 1) {
|
||||||
|
fError("failed to mount %s to FS since invalid primary %d", pCfg->dir, pCfg->primary);
|
||||||
|
terrno = TSDB_CODE_FS_INVLD_CFG;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pCfg->disable < 0 || pCfg->disable > 1) {
|
||||||
|
fError("failed to mount %s to FS since invalid disable %" PRIi8, pCfg->dir, pCfg->disable);
|
||||||
|
terrno = TSDB_CODE_FS_INVLD_CFG;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
if (pCfg->primary) {
|
if (pCfg->primary) {
|
||||||
if (pCfg->level != 0) {
|
if (pCfg->level != 0) {
|
||||||
fError("failed to mount %s to FS since disk is primary but level %d not 0", pCfg->dir, pCfg->level);
|
fError("failed to mount %s to FS since disk is primary but level %d not 0", pCfg->dir, pCfg->level);
|
||||||
|
@ -595,6 +607,15 @@ static int32_t tfsCheck(STfs *pTfs) {
|
||||||
terrno = TSDB_CODE_FS_NO_MOUNT_AT_TIER;
|
terrno = TSDB_CODE_FS_NO_MOUNT_AT_TIER;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (level == 0) {
|
||||||
|
tfsUpdateTierSize(TFS_TIER_AT(pTfs, level));
|
||||||
|
if (TFS_TIER_AT(pTfs, level)->nAvailDisks == 0) {
|
||||||
|
fError("no disk to create new file at level %d", level);
|
||||||
|
terrno = TSDB_CODE_FS_NO_VALID_DISK;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
#define _DEFAULT_SOURCE
|
#define _DEFAULT_SOURCE
|
||||||
#include "tfsInt.h"
|
#include "tfsInt.h"
|
||||||
|
|
||||||
STfsDisk *tfsNewDisk(int32_t level, int32_t id, const char *path) {
|
STfsDisk *tfsNewDisk(int32_t level, int32_t id, int8_t disable, const char *path) {
|
||||||
STfsDisk *pDisk = taosMemoryCalloc(1, sizeof(STfsDisk));
|
STfsDisk *pDisk = taosMemoryCalloc(1, sizeof(STfsDisk));
|
||||||
if (pDisk == NULL) {
|
if (pDisk == NULL) {
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
@ -32,6 +32,7 @@ STfsDisk *tfsNewDisk(int32_t level, int32_t id, const char *path) {
|
||||||
|
|
||||||
pDisk->level = level;
|
pDisk->level = level;
|
||||||
pDisk->id = id;
|
pDisk->id = id;
|
||||||
|
pDisk->disable = disable;
|
||||||
taosGetDiskSize(pDisk->path, &pDisk->size);
|
taosGetDiskSize(pDisk->path, &pDisk->size);
|
||||||
return pDisk;
|
return pDisk;
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,7 +65,7 @@ STfsDisk *tfsMountDiskToTier(STfsTier *pTier, SDiskCfg *pCfg) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
STfsDisk *pDisk = tfsNewDisk(pCfg->level, id, pCfg->dir);
|
STfsDisk *pDisk = tfsNewDisk(pCfg->level, id, pCfg->disable, pCfg->dir);
|
||||||
if (pDisk == NULL) return NULL;
|
if (pDisk == NULL) return NULL;
|
||||||
|
|
||||||
pTier->disks[id] = pDisk;
|
pTier->disks[id] = pDisk;
|
||||||
|
@ -89,7 +89,7 @@ void tfsUpdateTierSize(STfsTier *pTier) {
|
||||||
size.total += pDisk->size.total;
|
size.total += pDisk->size.total;
|
||||||
size.used += pDisk->size.used;
|
size.used += pDisk->size.used;
|
||||||
size.avail += pDisk->size.avail;
|
size.avail += pDisk->size.avail;
|
||||||
nAvailDisks++;
|
if (pDisk->disable == 0) nAvailDisks++;
|
||||||
}
|
}
|
||||||
|
|
||||||
pTier->size = size;
|
pTier->size = size;
|
||||||
|
@ -118,6 +118,12 @@ int32_t tfsAllocDiskOnTier(STfsTier *pTier) {
|
||||||
|
|
||||||
if (pDisk == NULL) continue;
|
if (pDisk == NULL) continue;
|
||||||
|
|
||||||
|
if (pDisk->disable == 1) {
|
||||||
|
uTrace("disk %s is disabled and skip it, level:%d id:%d disable:%" PRIi8, pDisk->path, pDisk->level, pDisk->id,
|
||||||
|
pDisk->disable);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (pDisk->size.avail < tsMinDiskFreeSize) {
|
if (pDisk->size.avail < tsMinDiskFreeSize) {
|
||||||
uInfo("disk %s is full and skip it, level:%d id:%d free size:%" PRId64 " min free size:%" PRId64, pDisk->path,
|
uInfo("disk %s is full and skip it, level:%d id:%d free size:%" PRId64 " min free size:%" PRId64, pDisk->path,
|
||||||
pDisk->level, pDisk->id, pDisk->size.avail, tsMinDiskFreeSize);
|
pDisk->level, pDisk->id, pDisk->size.avail, tsMinDiskFreeSize);
|
||||||
|
|
|
@ -37,6 +37,7 @@ TEST_F(TfsTest, 01_Open_Close) {
|
||||||
tstrncpy(dCfg.dir, root, TSDB_FILENAME_LEN);
|
tstrncpy(dCfg.dir, root, TSDB_FILENAME_LEN);
|
||||||
dCfg.level = 0;
|
dCfg.level = 0;
|
||||||
dCfg.primary = 1;
|
dCfg.primary = 1;
|
||||||
|
dCfg.disable = 0;
|
||||||
|
|
||||||
taosRemoveDir(root);
|
taosRemoveDir(root);
|
||||||
STfs *pTfs = tfsOpen(&dCfg, 1);
|
STfs *pTfs = tfsOpen(&dCfg, 1);
|
||||||
|
@ -63,6 +64,7 @@ TEST_F(TfsTest, 02_AllocDisk) {
|
||||||
tstrncpy(dCfg.dir, root, TSDB_FILENAME_LEN);
|
tstrncpy(dCfg.dir, root, TSDB_FILENAME_LEN);
|
||||||
dCfg.level = 0;
|
dCfg.level = 0;
|
||||||
dCfg.primary = 1;
|
dCfg.primary = 1;
|
||||||
|
dCfg.disable = 0;
|
||||||
|
|
||||||
taosRemoveDir(root);
|
taosRemoveDir(root);
|
||||||
taosMkDir(root);
|
taosMkDir(root);
|
||||||
|
@ -114,6 +116,7 @@ TEST_F(TfsTest, 03_Dir) {
|
||||||
tstrncpy(dCfg.dir, root, TSDB_FILENAME_LEN);
|
tstrncpy(dCfg.dir, root, TSDB_FILENAME_LEN);
|
||||||
dCfg.level = 0;
|
dCfg.level = 0;
|
||||||
dCfg.primary = 1;
|
dCfg.primary = 1;
|
||||||
|
dCfg.disable = 0;
|
||||||
|
|
||||||
taosRemoveDir(root);
|
taosRemoveDir(root);
|
||||||
taosMkDir(root);
|
taosMkDir(root);
|
||||||
|
@ -330,30 +333,39 @@ TEST_F(TfsTest, 05_MultiDisk) {
|
||||||
tstrncpy(dCfg[0].dir, root01, TSDB_FILENAME_LEN);
|
tstrncpy(dCfg[0].dir, root01, TSDB_FILENAME_LEN);
|
||||||
dCfg[0].level = 0;
|
dCfg[0].level = 0;
|
||||||
dCfg[0].primary = 0;
|
dCfg[0].primary = 0;
|
||||||
|
dCfg[0].disable = 0;
|
||||||
tstrncpy(dCfg[1].dir, root00, TSDB_FILENAME_LEN);
|
tstrncpy(dCfg[1].dir, root00, TSDB_FILENAME_LEN);
|
||||||
dCfg[1].level = 0;
|
dCfg[1].level = 0;
|
||||||
dCfg[1].primary = 0;
|
dCfg[1].primary = 0;
|
||||||
|
dCfg[1].disable = 0;
|
||||||
tstrncpy(dCfg[2].dir, root20, TSDB_FILENAME_LEN);
|
tstrncpy(dCfg[2].dir, root20, TSDB_FILENAME_LEN);
|
||||||
dCfg[2].level = 2;
|
dCfg[2].level = 2;
|
||||||
dCfg[2].primary = 0;
|
dCfg[2].primary = 0;
|
||||||
|
dCfg[2].disable = 0;
|
||||||
tstrncpy(dCfg[3].dir, root21, TSDB_FILENAME_LEN);
|
tstrncpy(dCfg[3].dir, root21, TSDB_FILENAME_LEN);
|
||||||
dCfg[3].level = 2;
|
dCfg[3].level = 2;
|
||||||
dCfg[3].primary = 0;
|
dCfg[3].primary = 0;
|
||||||
|
dCfg[3].disable = 0;
|
||||||
tstrncpy(dCfg[4].dir, root22, TSDB_FILENAME_LEN);
|
tstrncpy(dCfg[4].dir, root22, TSDB_FILENAME_LEN);
|
||||||
dCfg[4].level = 2;
|
dCfg[4].level = 2;
|
||||||
dCfg[4].primary = 0;
|
dCfg[4].primary = 0;
|
||||||
|
dCfg[4].disable = 0;
|
||||||
tstrncpy(dCfg[5].dir, root23, TSDB_FILENAME_LEN);
|
tstrncpy(dCfg[5].dir, root23, TSDB_FILENAME_LEN);
|
||||||
dCfg[5].level = 2;
|
dCfg[5].level = 2;
|
||||||
dCfg[5].primary = 0;
|
dCfg[5].primary = 0;
|
||||||
|
dCfg[5].disable = 0;
|
||||||
tstrncpy(dCfg[6].dir, root10, TSDB_FILENAME_LEN);
|
tstrncpy(dCfg[6].dir, root10, TSDB_FILENAME_LEN);
|
||||||
dCfg[6].level = 1;
|
dCfg[6].level = 1;
|
||||||
dCfg[6].primary = 0;
|
dCfg[6].primary = 0;
|
||||||
|
dCfg[6].disable = 0;
|
||||||
tstrncpy(dCfg[7].dir, root11, TSDB_FILENAME_LEN);
|
tstrncpy(dCfg[7].dir, root11, TSDB_FILENAME_LEN);
|
||||||
dCfg[7].level = 1;
|
dCfg[7].level = 1;
|
||||||
dCfg[7].primary = 0;
|
dCfg[7].primary = 0;
|
||||||
|
dCfg[7].disable = 0;
|
||||||
tstrncpy(dCfg[8].dir, root12, TSDB_FILENAME_LEN);
|
tstrncpy(dCfg[8].dir, root12, TSDB_FILENAME_LEN);
|
||||||
dCfg[8].level = 1;
|
dCfg[8].level = 1;
|
||||||
dCfg[8].primary = 0;
|
dCfg[8].primary = 0;
|
||||||
|
dCfg[8].disable = 0;
|
||||||
|
|
||||||
taosRemoveDir(root00);
|
taosRemoveDir(root00);
|
||||||
taosRemoveDir(root01);
|
taosRemoveDir(root01);
|
||||||
|
|
|
@ -38,11 +38,12 @@ int64_t tsTotalMemoryKB = 0;
|
||||||
char *tsProcPath = NULL;
|
char *tsProcPath = NULL;
|
||||||
|
|
||||||
char tsSIMDEnable = 0;
|
char tsSIMDEnable = 0;
|
||||||
char tsSSE42Enable = 0;
|
|
||||||
char tsAVXEnable = 0;
|
|
||||||
char tsAVX2Enable = 0;
|
|
||||||
char tsFMAEnable = 0;
|
|
||||||
char tsAVX512Enable = 0;
|
char tsAVX512Enable = 0;
|
||||||
|
char tsSSE42Supported = 0;
|
||||||
|
char tsAVXSupported = 0;
|
||||||
|
char tsAVX2Supported = 0;
|
||||||
|
char tsFMASupported = 0;
|
||||||
|
char tsAVX512Supported = 0;
|
||||||
|
|
||||||
void osDefaultInit() {
|
void osDefaultInit() {
|
||||||
taosSeedRand(taosSafeRand());
|
taosSeedRand(taosSafeRand());
|
||||||
|
|
|
@ -250,7 +250,7 @@ void taosGetSystemInfo() {
|
||||||
taosGetCpuCores(&tsNumOfCores, false);
|
taosGetCpuCores(&tsNumOfCores, false);
|
||||||
taosGetTotalMemory(&tsTotalMemoryKB);
|
taosGetTotalMemory(&tsTotalMemoryKB);
|
||||||
taosGetCpuUsage(NULL, NULL);
|
taosGetCpuUsage(NULL, NULL);
|
||||||
taosGetCpuInstructions(&tsSSE42Enable, &tsAVXEnable, &tsAVX2Enable, &tsFMAEnable, &tsAVX512Enable);
|
taosGetCpuInstructions(&tsSSE42Supported, &tsAVXSupported, &tsAVX2Supported, &tsFMASupported, &tsAVX512Supported);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -822,9 +822,9 @@ int32_t tsDecompressTimestampImp(const char *const input, const int32_t nelement
|
||||||
memcpy(output, input + 1, nelements * longBytes);
|
memcpy(output, input + 1, nelements * longBytes);
|
||||||
return nelements * longBytes;
|
return nelements * longBytes;
|
||||||
} else if (input[0] == 1) { // Decompress
|
} else if (input[0] == 1) { // Decompress
|
||||||
if (tsSIMDEnable && tsAVX512Enable) {
|
if (tsSIMDEnable && tsAVX512Supported && tsAVX512Enable) {
|
||||||
tsDecompressTimestampAvx512(input, nelements, output, false);
|
tsDecompressTimestampAvx512(input, nelements, output, false);
|
||||||
} else if (tsSIMDEnable && tsAVX2Enable) {
|
} else if (tsSIMDEnable && tsAVX2Supported) {
|
||||||
tsDecompressTimestampAvx2(input, nelements, output, false);
|
tsDecompressTimestampAvx2(input, nelements, output, false);
|
||||||
} else {
|
} else {
|
||||||
int64_t *ostream = (int64_t *)output;
|
int64_t *ostream = (int64_t *)output;
|
||||||
|
@ -1198,9 +1198,9 @@ int32_t tsDecompressFloatImp(const char *const input, const int32_t nelements, c
|
||||||
return nelements * FLOAT_BYTES;
|
return nelements * FLOAT_BYTES;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tsSIMDEnable && tsAVX2Enable) {
|
if (tsSIMDEnable && tsAVX2Supported) {
|
||||||
tsDecompressFloatImplAvx2(input, nelements, output);
|
tsDecompressFloatImplAvx2(input, nelements, output);
|
||||||
} else if (tsSIMDEnable && tsAVX512Enable) {
|
} else if (tsSIMDEnable && tsAVX512Supported && tsAVX512Enable) {
|
||||||
tsDecompressFloatImplAvx512(input, nelements, output);
|
tsDecompressFloatImplAvx512(input, nelements, output);
|
||||||
} else { // alternative implementation without SIMD instructions.
|
} else { // alternative implementation without SIMD instructions.
|
||||||
tsDecompressFloatHelper(input, nelements, (float *)output);
|
tsDecompressFloatHelper(input, nelements, (float *)output);
|
||||||
|
@ -2713,7 +2713,7 @@ int32_t tsDecompressBigint(void *pIn, int32_t nIn, int32_t nEle, void *pOut, int
|
||||||
int8_t alvl = tsGetCompressL2Level(l2, lvl); \
|
int8_t alvl = tsGetCompressL2Level(l2, lvl); \
|
||||||
return compressL2Dict[l2].comprFn(pIn, nIn, pOut, nOut, type, alvl); \
|
return compressL2Dict[l2].comprFn(pIn, nIn, pOut, nOut, type, alvl); \
|
||||||
} else { \
|
} else { \
|
||||||
uTrace("dencode:%s, dcompress:%s, level:%d, type:%s", "disabled", compressL2Dict[l1].name, lvl, \
|
uTrace("dencode:%s, decompress:%s, level:%d, type:%s", "disabled", compressL2Dict[l1].name, lvl, \
|
||||||
tDataTypes[type].name); \
|
tDataTypes[type].name); \
|
||||||
return compressL2Dict[l2].decomprFn(pIn, nIn, pOut, nOut, type); \
|
return compressL2Dict[l2].decomprFn(pIn, nIn, pOut, nOut, type); \
|
||||||
} \
|
} \
|
||||||
|
@ -2916,8 +2916,11 @@ int32_t tcompressDebug(uint32_t cmprAlg, uint8_t *l1Alg, uint8_t *l2Alg, uint8_t
|
||||||
*level = lvl;
|
*level = lvl;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int8_t tUpdateCompress(uint32_t oldCmpr, uint32_t newCmpr, uint8_t l2Disabled, uint8_t lvlDiabled, uint8_t lvlDefault,
|
int8_t tUpdateCompress(uint32_t oldCmpr, uint32_t newCmpr, uint8_t l2Disabled, uint8_t lvlDiabled, uint8_t lvlDefault,
|
||||||
|
|
||||||
uint32_t *dst) {
|
uint32_t *dst) {
|
||||||
|
int8_t update = 0;
|
||||||
uint8_t ol1 = COMPRESS_L1_TYPE_U32(oldCmpr);
|
uint8_t ol1 = COMPRESS_L1_TYPE_U32(oldCmpr);
|
||||||
uint8_t ol2 = COMPRESS_L2_TYPE_U32(oldCmpr);
|
uint8_t ol2 = COMPRESS_L2_TYPE_U32(oldCmpr);
|
||||||
uint8_t olvl = COMPRESS_L2_TYPE_LEVEL_U32(oldCmpr);
|
uint8_t olvl = COMPRESS_L2_TYPE_LEVEL_U32(oldCmpr);
|
||||||
|
@ -2925,10 +2928,17 @@ int8_t tUpdateCompress(uint32_t oldCmpr, uint32_t newCmpr, uint8_t l2Disabled, u
|
||||||
uint8_t nl1 = COMPRESS_L1_TYPE_U32(newCmpr);
|
uint8_t nl1 = COMPRESS_L1_TYPE_U32(newCmpr);
|
||||||
uint8_t nl2 = COMPRESS_L2_TYPE_U32(newCmpr);
|
uint8_t nl2 = COMPRESS_L2_TYPE_U32(newCmpr);
|
||||||
uint8_t nlvl = COMPRESS_L2_TYPE_LEVEL_U32(newCmpr);
|
uint8_t nlvl = COMPRESS_L2_TYPE_LEVEL_U32(newCmpr);
|
||||||
|
|
||||||
|
// nl1 == 0, not update encode
|
||||||
|
// nl2 == 0, not update compress
|
||||||
|
// nl3 == 0, not update level
|
||||||
if (nl1 != 0 && ol1 != nl1) {
|
if (nl1 != 0 && ol1 != nl1) {
|
||||||
SET_COMPRESS(nl1, ol2, olvl, *dst);
|
SET_COMPRESS(nl1, ol2, olvl, *dst);
|
||||||
return 1;
|
update = 1;
|
||||||
} else if (nl2 != 0 && ol2 != nl2) {
|
ol1 = nl1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nl2 != 0 && ol2 != nl2) {
|
||||||
if (nl2 == l2Disabled) {
|
if (nl2 == l2Disabled) {
|
||||||
SET_COMPRESS(ol1, nl2, lvlDiabled, *dst);
|
SET_COMPRESS(ol1, nl2, lvlDiabled, *dst);
|
||||||
} else {
|
} else {
|
||||||
|
@ -2938,10 +2948,20 @@ int8_t tUpdateCompress(uint32_t oldCmpr, uint32_t newCmpr, uint8_t l2Disabled, u
|
||||||
SET_COMPRESS(ol1, nl2, olvl, *dst);
|
SET_COMPRESS(ol1, nl2, olvl, *dst);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 1;
|
update = 1;
|
||||||
} else if (nlvl != 0 && olvl != nlvl) {
|
ol2 = nl2;
|
||||||
SET_COMPRESS(ol1, ol2, nlvl, *dst);
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
return 0;
|
|
||||||
|
if (nlvl != 0 && olvl != nlvl) {
|
||||||
|
if (update == 0) {
|
||||||
|
if (ol2 == L2_DISABLED) {
|
||||||
|
update = -1;
|
||||||
|
return update;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SET_COMPRESS(ol1, ol2, nlvl, *dst);
|
||||||
|
update = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return update;
|
||||||
}
|
}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue