Merge branch '3.0' into fix/m23
This commit is contained in:
commit
6a9f5603af
|
@ -175,6 +175,7 @@ def pre_test_build_mac() {
|
||||||
cd ${WK}/debug
|
cd ${WK}/debug
|
||||||
cmake .. -DBUILD_TEST=true -DBUILD_HTTPS=false
|
cmake .. -DBUILD_TEST=true -DBUILD_HTTPS=false
|
||||||
make -j10
|
make -j10
|
||||||
|
ctest -j10 || exit 7
|
||||||
'''
|
'''
|
||||||
sh '''
|
sh '''
|
||||||
date
|
date
|
||||||
|
@ -429,8 +430,6 @@ pipeline {
|
||||||
rm -rf ${WKC}/debug
|
rm -rf ${WKC}/debug
|
||||||
cd ${WKC}/tests/parallel_test
|
cd ${WKC}/tests/parallel_test
|
||||||
time ./container_build.sh -w ${WKDIR} -t 10 -e
|
time ./container_build.sh -w ${WKDIR} -t 10 -e
|
||||||
rm -f /tmp/cases.task
|
|
||||||
./collect_cases.sh -e
|
|
||||||
'''
|
'''
|
||||||
def extra_param = ""
|
def extra_param = ""
|
||||||
def log_server_file = "/home/log_server.json"
|
def log_server_file = "/home/log_server.json"
|
||||||
|
@ -461,7 +460,7 @@ pipeline {
|
||||||
cd ${WKC}/tests/parallel_test
|
cd ${WKC}/tests/parallel_test
|
||||||
export DEFAULT_RETRY_TIME=2
|
export DEFAULT_RETRY_TIME=2
|
||||||
date
|
date
|
||||||
''' + timeout_cmd + ''' time ./run.sh -e -m /home/m.json -t /tmp/cases.task -b ${BRANCH_NAME}_${BUILD_ID} -l ${WKDIR}/log -o 480 ''' + extra_param + '''
|
''' + timeout_cmd + ''' time ./run.sh -e -m /home/m.json -t cases.task -b ${BRANCH_NAME}_${BUILD_ID} -l ${WKDIR}/log -o 480 ''' + extra_param + '''
|
||||||
'''
|
'''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,13 +65,14 @@ ELSE ()
|
||||||
ENDIF ()
|
ENDIF ()
|
||||||
|
|
||||||
MESSAGE(STATUS "============= compile version parameter information start ============= ")
|
MESSAGE(STATUS "============= compile version parameter information start ============= ")
|
||||||
MESSAGE(STATUS "ver number:" ${TD_VER_NUMBER})
|
MESSAGE(STATUS "version: " ${TD_VER_NUMBER})
|
||||||
MESSAGE(STATUS "compatible ver number:" ${TD_VER_COMPATIBLE})
|
MESSAGE(STATUS "compatible: " ${TD_VER_COMPATIBLE})
|
||||||
MESSAGE(STATUS "communit commit id:" ${TD_VER_GIT})
|
MESSAGE(STATUS "commit id: " ${TD_VER_GIT})
|
||||||
MESSAGE(STATUS "build date:" ${TD_VER_DATE})
|
MESSAGE(STATUS "build date: " ${TD_VER_DATE})
|
||||||
MESSAGE(STATUS "ver type:" ${TD_VER_VERTYPE})
|
MESSAGE(STATUS "build type: " ${CMAKE_BUILD_TYPE})
|
||||||
MESSAGE(STATUS "ver cpu:" ${TD_VER_CPUTYPE})
|
MESSAGE(STATUS "type: " ${TD_VER_VERTYPE})
|
||||||
MESSAGE(STATUS "os type:" ${TD_VER_OSTYPE})
|
MESSAGE(STATUS "cpu: " ${TD_VER_CPUTYPE})
|
||||||
|
MESSAGE(STATUS "os: " ${TD_VER_OSTYPE})
|
||||||
MESSAGE(STATUS "============= compile version parameter information end ============= ")
|
MESSAGE(STATUS "============= compile version parameter information end ============= ")
|
||||||
|
|
||||||
STRING(REPLACE "." "_" TD_LIB_VER_NUMBER ${TD_VER_NUMBER})
|
STRING(REPLACE "." "_" TD_LIB_VER_NUMBER ${TD_VER_NUMBER})
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
# taosadapter
|
# taosadapter
|
||||||
ExternalProject_Add(taosadapter
|
ExternalProject_Add(taosadapter
|
||||||
GIT_REPOSITORY https://github.com/taosdata/taosadapter.git
|
GIT_REPOSITORY https://github.com/taosdata/taosadapter.git
|
||||||
GIT_TAG a11131c
|
GIT_TAG 0d5663d
|
||||||
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taosadapter"
|
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taosadapter"
|
||||||
BINARY_DIR ""
|
BINARY_DIR ""
|
||||||
#BUILD_IN_SOURCE TRUE
|
#BUILD_IN_SOURCE TRUE
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
# taos-tools
|
# taos-tools
|
||||||
ExternalProject_Add(taos-tools
|
ExternalProject_Add(taos-tools
|
||||||
GIT_REPOSITORY https://github.com/taosdata/taos-tools.git
|
GIT_REPOSITORY https://github.com/taosdata/taos-tools.git
|
||||||
GIT_TAG 16eb34f
|
GIT_TAG a921bd4
|
||||||
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taos-tools"
|
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taos-tools"
|
||||||
BINARY_DIR ""
|
BINARY_DIR ""
|
||||||
#BUILD_IN_SOURCE TRUE
|
#BUILD_IN_SOURCE TRUE
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
# taosws-rs
|
# taosws-rs
|
||||||
ExternalProject_Add(taosws-rs
|
ExternalProject_Add(taosws-rs
|
||||||
GIT_REPOSITORY https://github.com/taosdata/taos-connector-rust.git
|
GIT_REPOSITORY https://github.com/taosdata/taos-connector-rust.git
|
||||||
GIT_TAG 0373a70
|
GIT_TAG 38c4599
|
||||||
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taosws-rs"
|
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taosws-rs"
|
||||||
BINARY_DIR ""
|
BINARY_DIR ""
|
||||||
#BUILD_IN_SOURCE TRUE
|
#BUILD_IN_SOURCE TRUE
|
||||||
|
|
|
@ -37,9 +37,9 @@ meters,location=California.LosAngeles,groupid=2 current=13.4,voltage=223,phase=0
|
||||||
- All the data in `tag_set` will be converted to NCHAR type automatically .
|
- All the data in `tag_set` will be converted to NCHAR type automatically .
|
||||||
- Each data in `field_set` must be self-descriptive for its data type. For example 1.2f32 means a value 1.2 of float type. Without the "f" type suffix, it will be treated as type double.
|
- Each data in `field_set` must be self-descriptive for its data type. For example 1.2f32 means a value 1.2 of float type. Without the "f" type suffix, it will be treated as type double.
|
||||||
- Multiple kinds of precision can be used for the `timestamp` field. Time precision can be from nanosecond (ns) to hour (h).
|
- Multiple kinds of precision can be used for the `timestamp` field. Time precision can be from nanosecond (ns) to hour (h).
|
||||||
- You can configure smlChildTableName in taos.cfg to specify table names, for example, `smlChildTableName=tname`. You can insert `st,tname=cpul,t1=4 c1=3 1626006833639000000` and the cpu1 table will be automatically created. Note that if multiple rows have the same tname but different tag_set values, the tag_set of the first row is used to create the table and the others are ignored.
|
- The child table name is created automatically in a rule to guarantee its uniqueness. But you can configure `smlChildTableName` in taos.cfg to specify a tag value as the table names if the tag value is unique globally. For example, if a tag is called `tname` and you set `smlChildTableName=tname` in taos.cfg, when you insert `st,tname=cpu1,t1=4 c1=3 1626006833639000000`, the child table `cpu1` will be created automatically. Note that if multiple rows have the same tname but different tag_set values, the tag_set of the first row is used to create the table and the others are ignored.
|
||||||
- It is assumed that the order of field_set in a supertable is consistent, meaning that the first record contains all fields and subsequent records store fields in the same order. If the order is not consistent, set smlDataFormat in taos.cfg to false. Otherwise, data will be written out of order and a database error will occur.(smlDataFormat in taos.cfg default to false after version of 3.0.1.3)
|
- It is assumed that the order of field_set in a supertable is consistent, meaning that the first record contains all fields and subsequent records store fields in the same order. If the order is not consistent, set smlDataFormat in taos.cfg to false. Otherwise, data will be written out of order and a database error will occur.(smlDataFormat in taos.cfg default to false after version of 3.0.1.3)
|
||||||
:::
|
:::
|
||||||
|
|
||||||
For more details please refer to [InfluxDB Line Protocol](https://docs.influxdata.com/influxdb/v2.0/reference/syntax/line-protocol/) and [TDengine Schemaless](/reference/schemaless/#Schemaless-Line-Protocol)
|
For more details please refer to [InfluxDB Line Protocol](https://docs.influxdata.com/influxdb/v2.0/reference/syntax/line-protocol/) and [TDengine Schemaless](/reference/schemaless/#Schemaless-Line-Protocol)
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ For example:
|
||||||
meters.current 1648432611250 11.3 location=California.LosAngeles groupid=3
|
meters.current 1648432611250 11.3 location=California.LosAngeles groupid=3
|
||||||
```
|
```
|
||||||
|
|
||||||
- The defult child table name is generated by rules.You can configure smlChildTableName in taos.cfg to specify child table names, for example, `smlChildTableName=tname`. You can insert `meters.current 1648432611250 11.3 tname=cpu1 location=California.LosAngeles groupid=3` and the cpu1 table will be automatically created. Note that if multiple rows have the same tname but different tag_set values, the tag_set of the first row is used to create the table and the others are ignored.
|
- The child table name is created automatically in a rule to guarantee its uniqueness. But you can configure `smlChildTableName` in taos.cfg to specify a tag value as the table names if the tag value is unique globally. For example, if a tag is called `tname` and you set `smlChildTableName=tname` in taos.cfg, when you insert `st,tname=cpu1,t1=4 c1=3 1626006833639000000`, the child table `cpu1` will be automatically created. Note that if multiple rows have the same tname but different tag_set values, the tag_set of the first row is used to create the table and the others are ignored.
|
||||||
Please refer to [OpenTSDB Telnet API](http://opentsdb.net/docs/build/html/api_telnet/put.html) for more details.
|
Please refer to [OpenTSDB Telnet API](http://opentsdb.net/docs/build/html/api_telnet/put.html) for more details.
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
|
@ -48,8 +48,8 @@ Please refer to [OpenTSDB HTTP API](http://opentsdb.net/docs/build/html/api_http
|
||||||
|
|
||||||
- In JSON protocol, strings will be converted to NCHAR type and numeric values will be converted to double type.
|
- In JSON protocol, strings will be converted to NCHAR type and numeric values will be converted to double type.
|
||||||
- Only data in array format is accepted and so an array must be used even if there is only one row.
|
- Only data in array format is accepted and so an array must be used even if there is only one row.
|
||||||
- The defult child table name is generated by rules.You can configure smlChildTableName in taos.cfg to specify child table names, for example, `smlChildTableName=tname`. You can insert `"tags": { "host": "web02","dc": "lga","tname":"cpu1"}` and the cpu1 table will be automatically created. Note that if multiple rows have the same tname but different tag_set values, the tag_set of the first row is used to create the table and the others are ignored.
|
- The child table name is created automatically in a rule to guarantee its uniqueness. But you can configure `smlChildTableName` in taos.cfg to specify a tag value as the table names if the tag value is unique globally. For example, if a tag is called `tname` and you set `smlChildTableName=tname` in taos.cfg, when you insert `st,tname=cpu1,t1=4 c1=3 1626006833639000000`, the child table `cpu1` will be automatically created. Note that if multiple rows have the same tname but different tag_set values, the tag_set of the first row is used to create the table and the others are ignored.
|
||||||
:::
|
:::
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
|
|
|
@ -218,9 +218,9 @@ After compiling your function into a DLL, you add it to TDengine. For more infor
|
||||||
|
|
||||||
## Sample Code
|
## Sample Code
|
||||||
|
|
||||||
### Sample scalar function: [bit_and](https://github.com/taosdata/TDengine/blob/develop/tests/script/sh/bit_and.c)
|
### Sample scalar function: [bit_and](https://github.com/taosdata/TDengine/blob/3.0/tests/script/sh/bit_and.c)
|
||||||
|
|
||||||
The bit_add function implements bitwise addition for multiple columns. If there is only one column, the column is returned. The bit_add function ignores null values.
|
The bit_and function implements bitwise addition for multiple columns. If there is only one column, the column is returned. The bit_and function ignores null values.
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary>bit_and.c</summary>
|
<summary>bit_and.c</summary>
|
||||||
|
@ -231,7 +231,7 @@ The bit_add function implements bitwise addition for multiple columns. If there
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
### Sample aggregate function: [l2norm](https://github.com/taosdata/TDengine/blob/develop/tests/script/sh/l2norm.c)
|
### Sample aggregate function: [l2norm](https://github.com/taosdata/TDengine/blob/3.0/tests/script/sh/l2norm.c)
|
||||||
|
|
||||||
The l2norm function finds the second-order norm for all data in the input column. This squares the values, takes a cumulative sum, and finds the square root.
|
The l2norm function finds the second-order norm for all data in the input column. This squares the values, takes a cumulative sum, and finds the square root.
|
||||||
|
|
||||||
|
|
|
@ -7,12 +7,12 @@ title: Table
|
||||||
You create standard tables and subtables with the `CREATE TABLE` statement.
|
You create standard tables and subtables with the `CREATE TABLE` statement.
|
||||||
|
|
||||||
```sql
|
```sql
|
||||||
CREATE TABLE [IF NOT EXISTS] [db_name.]tb_name (create_definition [, create_definitionn] ...) [table_options]
|
CREATE TABLE [IF NOT EXISTS] [db_name.]tb_name (create_definition [, create_definition] ...) [table_options]
|
||||||
|
|
||||||
CREATE TABLE create_subtable_clause
|
CREATE TABLE create_subtable_clause
|
||||||
|
|
||||||
CREATE TABLE [IF NOT EXISTS] [db_name.]tb_name (create_definition [, create_definitionn] ...)
|
CREATE TABLE [IF NOT EXISTS] [db_name.]tb_name (create_definition [, create_definition] ...)
|
||||||
[TAGS (create_definition [, create_definitionn] ...)]
|
[TAGS (create_definition [, create_definition] ...)]
|
||||||
[table_options]
|
[table_options]
|
||||||
|
|
||||||
create_subtable_clause: {
|
create_subtable_clause: {
|
||||||
|
@ -195,4 +195,4 @@ This command is useful in migrating data from one TDengine cluster to another be
|
||||||
|
|
||||||
```
|
```
|
||||||
DESCRIBE [db_name.]tb_name;
|
DESCRIBE [db_name.]tb_name;
|
||||||
```
|
```
|
||||||
|
|
|
@ -6,7 +6,7 @@ title: Supertable
|
||||||
## Create a Supertable
|
## Create a Supertable
|
||||||
|
|
||||||
```sql
|
```sql
|
||||||
CREATE STABLE [IF NOT EXISTS] stb_name (create_definition [, create_definitionn] ...) TAGS (create_definition [, create_definition] ...) [table_options]
|
CREATE STABLE [IF NOT EXISTS] stb_name (create_definition [, create_definition] ...) TAGS (create_definition [, create_definition] ...) [table_options]
|
||||||
|
|
||||||
create_definition:
|
create_definition:
|
||||||
col_name column_definition
|
col_name column_definition
|
||||||
|
|
|
@ -255,7 +255,7 @@ Note: If you include an ORDER BY clause, only one partition can be displayed.
|
||||||
|
|
||||||
Some special query functions can be invoked without `FROM` sub-clause.
|
Some special query functions can be invoked without `FROM` sub-clause.
|
||||||
|
|
||||||
## Obtain Current Database
|
### Obtain Current Database
|
||||||
|
|
||||||
The following SQL statement returns the current database. If a database has not been specified on login or with the `USE` command, a null value is returned.
|
The following SQL statement returns the current database. If a database has not been specified on login or with the `USE` command, a null value is returned.
|
||||||
|
|
||||||
|
@ -270,7 +270,7 @@ SELECT CLIENT_VERSION();
|
||||||
SELECT SERVER_VERSION();
|
SELECT SERVER_VERSION();
|
||||||
```
|
```
|
||||||
|
|
||||||
## Obtain Server Status
|
### Obtain Server Status
|
||||||
|
|
||||||
The following SQL statement returns the status of the TDengine server. An integer indicates that the server is running normally. An error code indicates that an error has occurred. This statement can also detect whether a connection pool or third-party tool is connected to TDengine properly. By using this statement, you can ensure that connections in a pool are not lost due to an incorrect heartbeat detection statement.
|
The following SQL statement returns the status of the TDengine server. An integer indicates that the server is running normally. An error code indicates that an error has occurred. This statement can also detect whether a connection pool or third-party tool is connected to TDengine properly. By using this statement, you can ensure that connections in a pool are not lost due to an incorrect heartbeat detection statement.
|
||||||
|
|
||||||
|
@ -314,6 +314,40 @@ Regular expression filtering is supported only on table names (TBNAME), BINARY t
|
||||||
|
|
||||||
A regular expression string cannot exceed 128 bytes. You can configure this value by modifying the maxRegexStringLen parameter on the TDengine Client. The modified value takes effect when the client is restarted.
|
A regular expression string cannot exceed 128 bytes. You can configure this value by modifying the maxRegexStringLen parameter on the TDengine Client. The modified value takes effect when the client is restarted.
|
||||||
|
|
||||||
|
## CASE Expressions
|
||||||
|
|
||||||
|
### Syntax
|
||||||
|
|
||||||
|
```txt
|
||||||
|
CASE value WHEN compare_value THEN result [WHEN compare_value THEN result ...] [ELSE result] END
|
||||||
|
CASE WHEN condition THEN result [WHEN condition THEN result ...] [ELSE result] END
|
||||||
|
```
|
||||||
|
|
||||||
|
### Description
|
||||||
|
CASE expressions let you use IF ... THEN ... ELSE logic in SQL statements without having to invoke procedures.
|
||||||
|
|
||||||
|
The first CASE syntax returns the `result` for the first `value`=`compare_value` comparison that is true.
|
||||||
|
|
||||||
|
The second syntax returns the `result` for the first `condition` that is true.
|
||||||
|
|
||||||
|
If no comparison or condition is true, the result after ELSE is returned, or NULL if there is no ELSE part.
|
||||||
|
|
||||||
|
The return type of the CASE expression is the result type of the first WHEN WHEN part, and the result type of the other WHEN WHEN parts and ELSE parts can be converted to them, otherwise TDengine will report an error.
|
||||||
|
|
||||||
|
### Examples
|
||||||
|
|
||||||
|
A device has three status codes to display its status. The statements are as follows:
|
||||||
|
|
||||||
|
```sql
|
||||||
|
SELECT CASE dev_status WHEN 1 THEN 'Running' WHEN 2 THEN 'Warning' WHEN 3 THEN 'Downtime' ELSE 'Unknown' END FROM dev_table;
|
||||||
|
```
|
||||||
|
|
||||||
|
The average voltage value of the smart meter is counted. When the voltage is less than 200 or more than 250, it is considered that the statistics is wrong, and the value is corrected to 220. The statement is as follows:
|
||||||
|
|
||||||
|
```sql
|
||||||
|
SELECT AVG(CASE WHEN voltage < 200 or voltage > 250 THEN 220 ELSE voltage END) FROM meters;
|
||||||
|
```
|
||||||
|
|
||||||
## JOIN
|
## JOIN
|
||||||
|
|
||||||
TDengine supports natural joins between supertables, between standard tables, and between subqueries. The difference between natural joins and inner joins is that natural joins require that the fields being joined in the supertables or standard tables must have the same name. Data or tag columns must be joined with the equivalent column in another table.
|
TDengine supports natural joins between supertables, between standard tables, and between subqueries. The difference between natural joins and inner joins is that natural joins require that the fields being joined in the supertables or standard tables must have the same name. Data or tag columns must be joined with the equivalent column in another table.
|
||||||
|
|
|
@ -126,6 +126,12 @@ Only care about the information of the status window when the status is 2. For e
|
||||||
SELECT * FROM (SELECT COUNT(*) AS cnt, FIRST(ts) AS fst, status FROM temp_tb_1 STATE_WINDOW(status)) t WHERE status = 2;
|
SELECT * FROM (SELECT COUNT(*) AS cnt, FIRST(ts) AS fst, status FROM temp_tb_1 STATE_WINDOW(status)) t WHERE status = 2;
|
||||||
```
|
```
|
||||||
|
|
||||||
|
TDengine also supports the use of CASE expressions in state quantities. It can express that the beginning of a state is triggered by meeting a certain condition, and the end of this state is triggered by meeting another condition. For example, if the normal voltage range of the smart meter is 205V to 235V, you can judge whether the circuit is normal by monitoring the voltage.
|
||||||
|
|
||||||
|
```
|
||||||
|
SELECT tbname, _wstart, CASE WHEN voltage >= 205 and voltage <= 235 THEN 1 ELSE 0 END status FROM meters PARTITION BY tbname STATE_WINDOW(CASE WHEN voltage >= 205 and voltage <= 235 THEN 1 ELSE 0 END);
|
||||||
|
```
|
||||||
|
|
||||||
### Session Window
|
### Session Window
|
||||||
|
|
||||||
The primary key, i.e. timestamp, is used to determine which session window a row belongs to. As shown in the figure below, if the limit of time interval for the session window is specified as 12 seconds, then the 6 rows in the figure constitutes 2 time windows, [2019-04-28 14:22:10,2019-04-28 14:22:30] and [2019-04-28 14:23:10,2019-04-28 14:23:30] because the time difference between 2019-04-28 14:22:30 and 2019-04-28 14:23:10 is 40 seconds, which exceeds the time interval limit of 12 seconds.
|
The primary key, i.e. timestamp, is used to determine which session window a row belongs to. As shown in the figure below, if the limit of time interval for the session window is specified as 12 seconds, then the 6 rows in the figure constitutes 2 time windows, [2019-04-28 14:22:10,2019-04-28 14:22:30] and [2019-04-28 14:23:10,2019-04-28 14:23:30] because the time difference between 2019-04-28 14:22:30 and 2019-04-28 14:23:10 is 40 seconds, which exceeds the time interval limit of 12 seconds.
|
||||||
|
|
|
@ -217,7 +217,7 @@ taosBenchmark -A INT,DOUBLE,NCHAR,BINARY\(16\)
|
||||||
The parameters listed in this section apply to all function modes.
|
The parameters listed in this section apply to all function modes.
|
||||||
|
|
||||||
- **filetype** : The function to be tested, with optional values `insert`, `query` and `subscribe`. These correspond to the insert, query, and subscribe functions, respectively. Users can specify only one of these in each configuration file.
|
- **filetype** : The function to be tested, with optional values `insert`, `query` and `subscribe`. These correspond to the insert, query, and subscribe functions, respectively. Users can specify only one of these in each configuration file.
|
||||||
**cfgdir**: specify the TDengine cluster configuration file's directory. The default path is /etc/taos.
|
**cfgdir**: specify the TDengine client configuration file's directory. The default path is /etc/taos.
|
||||||
|
|
||||||
- **host**: Specify the FQDN of the TDengine server to connect. The default value is `localhost`.
|
- **host**: Specify the FQDN of the TDengine server to connect. The default value is `localhost`.
|
||||||
|
|
||||||
|
@ -374,7 +374,11 @@ The configuration parameters for specifying super table tag columns and data col
|
||||||
|
|
||||||
### Query scenario configuration parameters
|
### Query scenario configuration parameters
|
||||||
|
|
||||||
`filetype` must be set to `query` in the query scenario. See [General Configuration Parameters](#General Configuration Parameters) for details of this parameter and other general parameters
|
`filetype` must be set to `query` in the query scenario.
|
||||||
|
|
||||||
|
To control the query scenario by setting `kill_slow_query_threshold` and `kill_slow_query_interval` parameters to kill the execution of slow query statements. Threshold controls exec_usec of query command will be killed by taosBenchmark after the specified time, in seconds; interval controls sleep time to avoid continuous querying of slow queries consuming CPU in seconds.
|
||||||
|
|
||||||
|
See [General Configuration Parameters](#General Configuration Parameters) for details of other general parameters.
|
||||||
|
|
||||||
#### Configuration parameters for executing the specified query statement
|
#### Configuration parameters for executing the specified query statement
|
||||||
|
|
||||||
|
|
|
@ -735,19 +735,17 @@ To prevent system resource from being exhausted by multiple concurrent streams,
|
||||||
| 44 | numOfVnodeQueryThreads | No | Yes |
|
| 44 | numOfVnodeQueryThreads | No | Yes |
|
||||||
| 45 | numOfVnodeStreamThreads | No | Yes |
|
| 45 | numOfVnodeStreamThreads | No | Yes |
|
||||||
| 46 | numOfVnodeFetchThreads | No | Yes |
|
| 46 | numOfVnodeFetchThreads | No | Yes |
|
||||||
| 47 | numOfVnodeWriteThreads | No | Yes |
|
| 47 | numOfVnodeRsmaThreads | No | Yes |
|
||||||
| 48 | numOfVnodeSyncThreads | No | Yes |
|
| 48 | numOfQnodeQueryThreads | No | Yes |
|
||||||
| 49 | numOfVnodeRsmaThreads | No | Yes |
|
| 49 | numOfQnodeFetchThreads | No | Yes |
|
||||||
| 50 | numOfQnodeQueryThreads | No | Yes |
|
| 50 | numOfSnodeSharedThreads | No | Yes |
|
||||||
| 51 | numOfQnodeFetchThreads | No | Yes |
|
| 51 | numOfSnodeUniqueThreads | No | Yes |
|
||||||
| 52 | numOfSnodeSharedThreads | No | Yes |
|
| 52 | rpcQueueMemoryAllowed | No | Yes |
|
||||||
| 53 | numOfSnodeUniqueThreads | No | Yes |
|
| 53 | logDir | Yes | Yes |
|
||||||
| 54 | rpcQueueMemoryAllowed | No | Yes |
|
| 54 | minimalLogDirGB | Yes | Yes |
|
||||||
| 55 | logDir | Yes | Yes |
|
| 55 | numOfLogLines | Yes | Yes |
|
||||||
| 56 | minimalLogDirGB | Yes | Yes |
|
| 56 | asyncLog | Yes | Yes |
|
||||||
| 57 | numOfLogLines | Yes | Yes |
|
| 57 | logKeepDays | Yes | Yes |
|
||||||
| 58 | asyncLog | Yes | Yes |
|
|
||||||
| 59 | logKeepDays | Yes | Yes |
|
|
||||||
| 60 | debugFlag | Yes | Yes |
|
| 60 | debugFlag | Yes | Yes |
|
||||||
| 61 | tmrDebugFlag | Yes | Yes |
|
| 61 | tmrDebugFlag | Yes | Yes |
|
||||||
| 62 | uDebugFlag | Yes | Yes |
|
| 62 | uDebugFlag | Yes | Yes |
|
||||||
|
|
|
@ -6,6 +6,10 @@ description: TDengine release history, Release Notes and download links.
|
||||||
|
|
||||||
import Release from "/components/ReleaseV3";
|
import Release from "/components/ReleaseV3";
|
||||||
|
|
||||||
|
## 3.0.1.6
|
||||||
|
|
||||||
|
<Release type="tdengine" version="3.0.1.6" />
|
||||||
|
|
||||||
## 3.0.1.5
|
## 3.0.1.5
|
||||||
|
|
||||||
<Release type="tdengine" version="3.0.1.5" />
|
<Release type="tdengine" version="3.0.1.5" />
|
||||||
|
|
|
@ -6,6 +6,10 @@ description: taosTools release history, Release Notes, download links.
|
||||||
|
|
||||||
import Release from "/components/ReleaseV3";
|
import Release from "/components/ReleaseV3";
|
||||||
|
|
||||||
|
## 2.2.7
|
||||||
|
|
||||||
|
<Release type="tools" version="2.2.7" />
|
||||||
|
|
||||||
## 2.2.6
|
## 2.2.6
|
||||||
|
|
||||||
<Release type="tools" version="2.2.6" />
|
<Release type="tools" version="2.2.6" />
|
||||||
|
|
|
@ -9,9 +9,10 @@ namespace Examples
|
||||||
{
|
{
|
||||||
string DSN = "ws://root:taosdata@127.0.0.1:6041/test";
|
string DSN = "ws://root:taosdata@127.0.0.1:6041/test";
|
||||||
IntPtr wsConn = LibTaosWS.WSConnectWithDSN(DSN);
|
IntPtr wsConn = LibTaosWS.WSConnectWithDSN(DSN);
|
||||||
|
|
||||||
if (wsConn == IntPtr.Zero)
|
if (wsConn == IntPtr.Zero)
|
||||||
{
|
{
|
||||||
throw new Exception($"get WS connection failed,reason:{LibTaosWS.WSErrorStr(IntPtr.Zero)} code:{LibTaosWS.WSErrorNo(IntPtr.Zero)}");
|
throw new Exception("get WS connection failed");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -13,7 +13,7 @@ namespace Examples
|
||||||
// Assert if connection is validate
|
// Assert if connection is validate
|
||||||
if (wsConn == IntPtr.Zero)
|
if (wsConn == IntPtr.Zero)
|
||||||
{
|
{
|
||||||
throw new Exception($"get WS connection failed,reason:{LibTaosWS.WSErrorStr(IntPtr.Zero)} code:{LibTaosWS.WSErrorNo(IntPtr.Zero)}");
|
throw new Exception("get WS connection failed");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -13,7 +13,7 @@ namespace Examples
|
||||||
IntPtr wsConn = LibTaosWS.WSConnectWithDSN(DSN);
|
IntPtr wsConn = LibTaosWS.WSConnectWithDSN(DSN);
|
||||||
if (wsConn == IntPtr.Zero)
|
if (wsConn == IntPtr.Zero)
|
||||||
{
|
{
|
||||||
throw new Exception($"get WS connection failed,reason:{LibTaosWS.WSErrorStr(IntPtr.Zero)} code:{LibTaosWS.WSErrorNo(IntPtr.Zero)}");
|
throw new Exception("get WS connection failed");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -21,7 +21,7 @@ namespace Examples
|
||||||
IntPtr wsConn = LibTaosWS.WSConnectWithDSN(DSN);
|
IntPtr wsConn = LibTaosWS.WSConnectWithDSN(DSN);
|
||||||
if (wsConn == IntPtr.Zero)
|
if (wsConn == IntPtr.Zero)
|
||||||
{
|
{
|
||||||
throw new Exception($"get WS connection failed,reason:{LibTaosWS.WSErrorStr(IntPtr.Zero)} code:{LibTaosWS.WSErrorNo(IntPtr.Zero)}");
|
throw new Exception($"get WS connection failed");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -38,9 +38,8 @@ meters,location=California.LosAngeles,groupid=2 current=13.4,voltage=223,phase=0
|
||||||
- field_set 中的每个数据项都需要对自身的数据类型进行描述, 比如 1.2f32 代表 FLOAT 类型的数值 1.2, 如果不带类型后缀会被当作 DOUBLE 处理;
|
- field_set 中的每个数据项都需要对自身的数据类型进行描述, 比如 1.2f32 代表 FLOAT 类型的数值 1.2, 如果不带类型后缀会被当作 DOUBLE 处理;
|
||||||
- timestamp 支持多种时间精度。写入数据的时候需要用参数指定时间精度,支持从小时到纳秒的 6 种时间精度。
|
- timestamp 支持多种时间精度。写入数据的时候需要用参数指定时间精度,支持从小时到纳秒的 6 种时间精度。
|
||||||
- 为了提高写入的效率,默认假设同一个超级表中 field_set 的顺序是一样的(第一条数据包含所有的 field,后面的数据按照这个顺序),如果顺序不一样,需要配置参数 smlDataFormat 为 false,否则,数据写入按照相同顺序写入,库中数据会异常。(3.0.1.3 之后的版本 smlDataFormat 默认为 false) [TDengine 无模式写入参考指南](/reference/schemaless/#无模式写入行协议)
|
- 为了提高写入的效率,默认假设同一个超级表中 field_set 的顺序是一样的(第一条数据包含所有的 field,后面的数据按照这个顺序),如果顺序不一样,需要配置参数 smlDataFormat 为 false,否则,数据写入按照相同顺序写入,库中数据会异常。(3.0.1.3 之后的版本 smlDataFormat 默认为 false) [TDengine 无模式写入参考指南](/reference/schemaless/#无模式写入行协议)
|
||||||
- 默认生产的子表名是根据规则生成的唯一 ID 值。为了让用户可以指定生成的表名,可以通过在 taos.cfg 里配置 smlChildTableName 参数来指定。
|
- 默认产生的子表名是根据规则生成的唯一 ID 值。用户也可以通过在 taos.cfg 里配置 smlChildTableName 参数来指定某个标签值作为子表名。该标签值应该具有全局唯一性。举例如下:假设有个标签名为tname, 配置 smlChildTableName=tname, 插入数据为 st,tname=cpu1,t1=4 c1=3 1626006833639000000 则创建的子表名为 cpu1。注意如果多行数据 tname 相同,但是后面的 tag_set 不同,则使用第一行自动建表时指定的 tag_set,其他的行会忽略)。[TDengine 无模式写入参考指南](/reference/schemaless/#无模式写入行协议)
|
||||||
举例如下:配置 smlChildTableName=tname 插入数据为 st,tname=cpu1,t1=4 c1=3 1626006833639000000 则创建的表名为 cpu1,注意如果多行数据 tname 相同,但是后面的 tag_set 不同,则使用第一行自动建表时指定的 tag_set,其他的行会忽略)。[TDengine 无模式写入参考指南](/reference/schemaless/#无模式写入行协议)
|
:::
|
||||||
:::
|
|
||||||
|
|
||||||
要了解更多可参考:[InfluxDB Line 协议官方文档](https://docs.influxdata.com/influxdb/v2.0/reference/syntax/line-protocol/) 和 [TDengine 无模式写入参考指南](/reference/schemaless/#无模式写入行协议)
|
要了解更多可参考:[InfluxDB Line 协议官方文档](https://docs.influxdata.com/influxdb/v2.0/reference/syntax/line-protocol/) 和 [TDengine 无模式写入参考指南](/reference/schemaless/#无模式写入行协议)
|
||||||
|
|
||||||
|
|
|
@ -32,8 +32,7 @@ OpenTSDB 行协议同样采用一行字符串来表示一行数据。OpenTSDB
|
||||||
meters.current 1648432611250 11.3 location=California.LosAngeles groupid=3
|
meters.current 1648432611250 11.3 location=California.LosAngeles groupid=3
|
||||||
```
|
```
|
||||||
|
|
||||||
- 默认生产的子表名是根据规则生成的唯一 ID 值。为了让用户可以指定生成的表名,可以通过在 taos.cfg 里配置 smlChildTableName 参数来指定。
|
- 默认生产的子表名是根据规则生成的唯一 ID 值。用户也可以通过在 taos.cfg 里配置 smlChildTableName 参数来指定某个标签值作为子表名。该标签值应该具有全局唯一性。举例如下:假设有个标签名为tname, 配置 smlChildTableName=tname, 插入数据为 meters.current 1648432611250 11.3 tname=cpu1 location=California.LosAngeles groupid=3 则创建的表名为 cpu1,注意如果多行数据 tname 相同,但是后面的 tag_set 不同,则使用第一行自动建表时指定的 tag_set,其他的行会忽略)。
|
||||||
举例如下:配置 smlChildTableName=tname 插入数据为 meters.current 1648432611250 11.3 tname=cpu1 location=California.LosAngeles groupid=3 则创建的表名为 cpu1,注意如果多行数据 tname 相同,但是后面的 tag_set 不同,则使用第一行自动建表时指定的 tag_set,其他的行会忽略)。
|
|
||||||
参考 [OpenTSDB Telnet API 文档](http://opentsdb.net/docs/build/html/api_telnet/put.html)。
|
参考 [OpenTSDB Telnet API 文档](http://opentsdb.net/docs/build/html/api_telnet/put.html)。
|
||||||
|
|
||||||
## 示例代码
|
## 示例代码
|
||||||
|
|
|
@ -48,9 +48,8 @@ OpenTSDB JSON 格式协议采用一个 JSON 字符串表示一行或多行数据
|
||||||
|
|
||||||
- 对于 JSON 格式协议,TDengine 并不会自动把所有标签转成 NCHAR 类型, 字符串将将转为 NCHAR 类型, 数值将同样转换为 DOUBLE 类型。
|
- 对于 JSON 格式协议,TDengine 并不会自动把所有标签转成 NCHAR 类型, 字符串将将转为 NCHAR 类型, 数值将同样转换为 DOUBLE 类型。
|
||||||
- TDengine 只接收 JSON **数组格式**的字符串,即使一行数据也需要转换成数组形式。
|
- TDengine 只接收 JSON **数组格式**的字符串,即使一行数据也需要转换成数组形式。
|
||||||
- 默认生产的子表名是根据规则生成的唯一 ID 值。为了让用户可以指定生成的表名,可以通过在 taos.cfg 里配置 smlChildTableName 参数来指定。
|
- 默认生成的子表名是根据规则生成的唯一 ID 值。用户也可以通过在 taos.cfg 里配置 smlChildTableName 参数来指定某个标签值作为子表名。该标签值应该具有全局唯一性。举例如下:假设有个标签名为tname, 配置 smlChildTableName=tname, 插入数据为 `"tags": { "host": "web02","dc": "lga","tname":"cpu1"}` 则创建的子表名为 cpu1。注意如果多行数据 tname 相同,但是后面的 tag_set 不同,则使用第一行自动建表时指定的 tag_set,其他的行会忽略)。
|
||||||
举例如下:配置 smlChildTableName=tname 插入数据为 `"tags": { "host": "web02","dc": "lga","tname":"cpu1"}` 则创建的表名为 cpu1,注意如果多行数据 tname 相同,但是后面的 tag_set 不同,则使用第一行自动建表时指定的 tag_set,其他的行会忽略)。
|
:::
|
||||||
:::
|
|
||||||
|
|
||||||
## 示例代码
|
## 示例代码
|
||||||
|
|
||||||
|
|
|
@ -190,3 +190,16 @@ DROP DNODE dnodeId;
|
||||||
dnodeID 是集群自动分配的,不得人工指定。它在生成时是递增的,不会重复。
|
dnodeID 是集群自动分配的,不得人工指定。它在生成时是递增的,不会重复。
|
||||||
|
|
||||||
:::
|
:::
|
||||||
|
|
||||||
|
## 常见问题
|
||||||
|
|
||||||
|
1、建立集群时使用 CREATE DNODE 增加新节点后,新节点始终显示 offline 状态?
|
||||||
|
```sql
|
||||||
|
1)首先要检查增加的新节点上的 taosd 服务是否已经正常启动
|
||||||
|
|
||||||
|
2)如果已经启动,再检查到新节点的网络是否通畅,可以使用 ping fqdn 验证下
|
||||||
|
|
||||||
|
3)如果前面两步都没有问题,这一步要检查新节点做为独立集群在运行了,可以使用 taos -h fqdn 连接上后,show dnodes; 命令查看.
|
||||||
|
如果显示的列表与你主节点上显示的不一致,说明此节点自己单独成立了一个集群,解决的方法是停止新节点上的服务,然后清空新节点上
|
||||||
|
taos.cfg 中配置的 dataDir 目录下的所有文件,重新启动新节点服务即可解决。
|
||||||
|
```
|
||||||
|
|
|
@ -9,12 +9,12 @@ description: 对表的各种管理操作
|
||||||
`CREATE TABLE` 语句用于创建普通表和以超级表为模板创建子表。
|
`CREATE TABLE` 语句用于创建普通表和以超级表为模板创建子表。
|
||||||
|
|
||||||
```sql
|
```sql
|
||||||
CREATE TABLE [IF NOT EXISTS] [db_name.]tb_name (create_definition [, create_definitionn] ...) [table_options]
|
CREATE TABLE [IF NOT EXISTS] [db_name.]tb_name (create_definition [, create_definition] ...) [table_options]
|
||||||
|
|
||||||
CREATE TABLE create_subtable_clause
|
CREATE TABLE create_subtable_clause
|
||||||
|
|
||||||
CREATE TABLE [IF NOT EXISTS] [db_name.]tb_name (create_definition [, create_definitionn] ...)
|
CREATE TABLE [IF NOT EXISTS] [db_name.]tb_name (create_definition [, create_definition] ...)
|
||||||
[TAGS (create_definition [, create_definitionn] ...)]
|
[TAGS (create_definition [, create_definition] ...)]
|
||||||
[table_options]
|
[table_options]
|
||||||
|
|
||||||
create_subtable_clause: {
|
create_subtable_clause: {
|
||||||
|
|
|
@ -7,7 +7,7 @@ description: 对超级表的各种管理操作
|
||||||
## 创建超级表
|
## 创建超级表
|
||||||
|
|
||||||
```sql
|
```sql
|
||||||
CREATE STABLE [IF NOT EXISTS] stb_name (create_definition [, create_definitionn] ...) TAGS (create_definition [, create_definition] ...) [table_options]
|
CREATE STABLE [IF NOT EXISTS] stb_name (create_definition [, create_definition] ...) TAGS (create_definition [, create_definition] ...) [table_options]
|
||||||
|
|
||||||
create_definition:
|
create_definition:
|
||||||
col_name column_definition
|
col_name column_definition
|
||||||
|
|
|
@ -224,7 +224,7 @@ GROUP BY 子句中的表达式可以包含表或视图中的任何列,这些
|
||||||
该子句对行进行分组,但不保证结果集的顺序。若要对分组进行排序,请使用 ORDER BY 子句
|
该子句对行进行分组,但不保证结果集的顺序。若要对分组进行排序,请使用 ORDER BY 子句
|
||||||
|
|
||||||
|
|
||||||
## PARTITON BY
|
## PARTITION BY
|
||||||
|
|
||||||
PARTITION BY 子句是 TDengine 特色语法,按 part_list 对数据进行切分,在每个切分的分片中进行计算。
|
PARTITION BY 子句是 TDengine 特色语法,按 part_list 对数据进行切分,在每个切分的分片中进行计算。
|
||||||
|
|
||||||
|
@ -315,6 +315,39 @@ WHERE (column|tbname) **match/MATCH/nmatch/NMATCH** _regex_
|
||||||
|
|
||||||
正则匹配字符串长度不能超过 128 字节。可以通过参数 _maxRegexStringLen_ 设置和调整最大允许的正则匹配字符串,该参数是客户端配置参数,需要重启才能生效。
|
正则匹配字符串长度不能超过 128 字节。可以通过参数 _maxRegexStringLen_ 设置和调整最大允许的正则匹配字符串,该参数是客户端配置参数,需要重启才能生效。
|
||||||
|
|
||||||
|
## CASE 表达式
|
||||||
|
|
||||||
|
### 语法
|
||||||
|
|
||||||
|
```txt
|
||||||
|
CASE value WHEN compare_value THEN result [WHEN compare_value THEN result ...] [ELSE result] END
|
||||||
|
CASE WHEN condition THEN result [WHEN condition THEN result ...] [ELSE result] END
|
||||||
|
```
|
||||||
|
|
||||||
|
### 说明
|
||||||
|
|
||||||
|
TDengine 通过 CASE 表达式让用户可以在 SQL 语句中使用 IF ... THEN ... ELSE 逻辑。
|
||||||
|
|
||||||
|
第一种 CASE 语法返回第一个 value 等于 compare_value 的 result,如果没有 compare_value 符合,则返回 ELSE 之后的 result,如果没有 ELSE 部分,则返回 NULL。
|
||||||
|
|
||||||
|
第二种语法返回第一个 condition 为真的 result。 如果没有 condition 符合,则返回 ELSE 之后的 result,如果没有 ELSE 部分,则返回 NULL。
|
||||||
|
|
||||||
|
CASE 表达式的返回类型为第一个 WHEN THEN 部分的 result 类型,其余 WHEN THEN 部分和 ELSE 部分,result 类型都需要可以向其转换,否则 TDengine 会报错。
|
||||||
|
|
||||||
|
### 示例
|
||||||
|
|
||||||
|
某设备有三个状态码,显示其状态,语句如下:
|
||||||
|
|
||||||
|
```sql
|
||||||
|
SELECT CASE dev_status WHEN 1 THEN 'Running' WHEN 2 THEN 'Warning' WHEN 3 THEN 'Downtime' ELSE 'Unknown' END FROM dev_table;
|
||||||
|
```
|
||||||
|
|
||||||
|
统计智能电表的电压平均值,当电压小于 200 或大于 250 时认为是统计有误,修正其值为 220,语句如下:
|
||||||
|
|
||||||
|
```sql
|
||||||
|
SELECT AVG(CASE WHEN voltage < 200 or voltage > 250 THEN 220 ELSE voltage END) FROM meters;
|
||||||
|
```
|
||||||
|
|
||||||
## JOIN 子句
|
## JOIN 子句
|
||||||
|
|
||||||
TDengine 支持“普通表与普通表之间”、“超级表与超级表之间”、“子查询与子查询之间” 进行自然连接。自然连接与内连接的主要区别是,自然连接要求参与连接的字段在不同的表/超级表中必须是同名字段。也即,TDengine 在连接关系的表达中,要求必须使用同名数据列/标签列的相等关系。
|
TDengine 支持“普通表与普通表之间”、“超级表与超级表之间”、“子查询与子查询之间” 进行自然连接。自然连接与内连接的主要区别是,自然连接要求参与连接的字段在不同的表/超级表中必须是同名字段。也即,TDengine 在连接关系的表达中,要求必须使用同名数据列/标签列的相等关系。
|
||||||
|
|
|
@ -119,6 +119,12 @@ SELECT COUNT(*), FIRST(ts), status FROM temp_tb_1 STATE_WINDOW(status);
|
||||||
SELECT * FROM (SELECT COUNT(*) AS cnt, FIRST(ts) AS fst, status FROM temp_tb_1 STATE_WINDOW(status)) t WHERE status = 2;
|
SELECT * FROM (SELECT COUNT(*) AS cnt, FIRST(ts) AS fst, status FROM temp_tb_1 STATE_WINDOW(status)) t WHERE status = 2;
|
||||||
```
|
```
|
||||||
|
|
||||||
|
TDengine 还支持将 CASE 表达式用在状态量,可以表达某个状态的开始是由满足某个条件而触发,这个状态的结束是由另外一个条件满足而触发的语义。例如,智能电表的电压正常范围是 205V 到 235V,那么可以通过监控电压来判断电路是否正常。
|
||||||
|
|
||||||
|
```
|
||||||
|
SELECT tbname, _wstart, CASE WHEN voltage >= 205 and voltage <= 235 THEN 1 ELSE 0 END status FROM meters PARTITION BY tbname STATE_WINDOW(CASE WHEN voltage >= 205 and voltage <= 235 THEN 1 ELSE 0 END);
|
||||||
|
```
|
||||||
|
|
||||||
### 会话窗口
|
### 会话窗口
|
||||||
|
|
||||||
会话窗口根据记录的时间戳主键的值来确定是否属于同一个会话。如下图所示,如果设置时间戳的连续的间隔小于等于 12 秒,则以下 6 条记录构成 2 个会话窗口,分别是:[2019-04-28 14:22:10,2019-04-28 14:22:30]和[2019-04-28 14:23:10,2019-04-28 14:23:30]。因为 2019-04-28 14:22:30 与 2019-04-28 14:23:10 之间的时间间隔是 40 秒,超过了连续时间间隔(12 秒)。
|
会话窗口根据记录的时间戳主键的值来确定是否属于同一个会话。如下图所示,如果设置时间戳的连续的间隔小于等于 12 秒,则以下 6 条记录构成 2 个会话窗口,分别是:[2019-04-28 14:22:10,2019-04-28 14:22:30]和[2019-04-28 14:23:10,2019-04-28 14:23:30]。因为 2019-04-28 14:22:30 与 2019-04-28 14:23:10 之间的时间间隔是 40 秒,超过了连续时间间隔(12 秒)。
|
||||||
|
|
|
@ -217,7 +217,7 @@ taosBenchmark -A INT,DOUBLE,NCHAR,BINARY\(16\)
|
||||||
本节所列参数适用于所有功能模式。
|
本节所列参数适用于所有功能模式。
|
||||||
|
|
||||||
- **filetype** : 要测试的功能,可选值为 `insert`, `query` 和 `subscribe`。分别对应插入、查询和订阅功能。每个配置文件中只能指定其中之一。
|
- **filetype** : 要测试的功能,可选值为 `insert`, `query` 和 `subscribe`。分别对应插入、查询和订阅功能。每个配置文件中只能指定其中之一。
|
||||||
- **cfgdir** : TDengine 集群配置文件所在的目录,默认路径是 /etc/taos 。
|
- **cfgdir** : TDengine 客户端配置文件所在的目录,默认路径是 /etc/taos 。
|
||||||
|
|
||||||
- **host** : 指定要连接的 TDengine 服务端的 FQDN,默认值为 localhost。
|
- **host** : 指定要连接的 TDengine 服务端的 FQDN,默认值为 localhost。
|
||||||
|
|
||||||
|
@ -374,7 +374,11 @@ taosBenchmark -A INT,DOUBLE,NCHAR,BINARY\(16\)
|
||||||
|
|
||||||
### 查询场景配置参数
|
### 查询场景配置参数
|
||||||
|
|
||||||
查询场景下 `filetype` 必须设置为 `query`,该参数及其它通用参数详见[通用配置参数](#通用配置参数)
|
查询场景下 `filetype` 必须设置为 `query`。
|
||||||
|
|
||||||
|
查询场景可以通过设置 `kill_slow_query_threshold` 和 `kill_slow_query_interval` 参数来控制杀掉慢查询语句的执行,threshold 控制如果 exec_usec 超过指定时间的查询将被 taosBenchmark 杀掉,单位为秒;interval 控制休眠时间,避免持续查询慢查询消耗 CPU ,单位为秒。
|
||||||
|
|
||||||
|
其它通用参数详见[通用配置参数](#通用配置参数)。
|
||||||
|
|
||||||
#### 执行指定查询语句的配置参数
|
#### 执行指定查询语句的配置参数
|
||||||
|
|
||||||
|
|
|
@ -711,19 +711,17 @@ charset 的有效值是 UTF-8。
|
||||||
| 44 | numOfVnodeQueryThreads | 否 | 是 | |
|
| 44 | numOfVnodeQueryThreads | 否 | 是 | |
|
||||||
| 45 | numOfVnodeStreamThreads | 否 | 是 | |
|
| 45 | numOfVnodeStreamThreads | 否 | 是 | |
|
||||||
| 46 | numOfVnodeFetchThreads | 否 | 是 | |
|
| 46 | numOfVnodeFetchThreads | 否 | 是 | |
|
||||||
| 47 | numOfVnodeWriteThreads | 否 | 是 | |
|
| 47 | numOfVnodeRsmaThreads | 否 | 是 | |
|
||||||
| 48 | numOfVnodeSyncThreads | 否 | 是 | |
|
| 48 | numOfQnodeQueryThreads | 否 | 是 | |
|
||||||
| 49 | numOfVnodeRsmaThreads | 否 | 是 | |
|
| 49 | numOfQnodeFetchThreads | 否 | 是 | |
|
||||||
| 50 | numOfQnodeQueryThreads | 否 | 是 | |
|
| 50 | numOfSnodeSharedThreads | 否 | 是 | |
|
||||||
| 51 | numOfQnodeFetchThreads | 否 | 是 | |
|
| 51 | numOfSnodeUniqueThreads | 否 | 是 | |
|
||||||
| 52 | numOfSnodeSharedThreads | 否 | 是 | |
|
| 52 | rpcQueueMemoryAllowed | 否 | 是 | |
|
||||||
| 53 | numOfSnodeUniqueThreads | 否 | 是 | |
|
| 53 | logDir | 是 | 是 | |
|
||||||
| 54 | rpcQueueMemoryAllowed | 否 | 是 | |
|
| 54 | minimalLogDirGB | 是 | 是 | |
|
||||||
| 55 | logDir | 是 | 是 | |
|
| 55 | numOfLogLines | 是 | 是 | |
|
||||||
| 56 | minimalLogDirGB | 是 | 是 | |
|
| 56 | asyncLog | 是 | 是 | |
|
||||||
| 57 | numOfLogLines | 是 | 是 | |
|
| 57 | logKeepDays | 是 | 是 | |
|
||||||
| 58 | asyncLog | 是 | 是 | |
|
|
||||||
| 59 | logKeepDays | 是 | 是 | |
|
|
||||||
| 60 | debugFlag | 是 | 是 | |
|
| 60 | debugFlag | 是 | 是 | |
|
||||||
| 61 | tmrDebugFlag | 是 | 是 | |
|
| 61 | tmrDebugFlag | 是 | 是 | |
|
||||||
| 62 | uDebugFlag | 是 | 是 | |
|
| 62 | uDebugFlag | 是 | 是 | |
|
||||||
|
|
|
@ -6,6 +6,10 @@ description: TDengine 发布历史、Release Notes 及下载链接
|
||||||
|
|
||||||
import Release from "/components/ReleaseV3";
|
import Release from "/components/ReleaseV3";
|
||||||
|
|
||||||
|
## 3.0.1.6
|
||||||
|
|
||||||
|
<Release type="tdengine" version="3.0.1.6" />
|
||||||
|
|
||||||
## 3.0.1.5
|
## 3.0.1.5
|
||||||
|
|
||||||
<Release type="tdengine" version="3.0.1.5" />
|
<Release type="tdengine" version="3.0.1.5" />
|
||||||
|
|
|
@ -6,6 +6,10 @@ description: taosTools 的发布历史、Release Notes 和下载链接
|
||||||
|
|
||||||
import Release from "/components/ReleaseV3";
|
import Release from "/components/ReleaseV3";
|
||||||
|
|
||||||
|
## 2.2.7
|
||||||
|
|
||||||
|
<Release type="tools" version="2.2.7" />
|
||||||
|
|
||||||
## 2.2.6
|
## 2.2.6
|
||||||
|
|
||||||
<Release type="tools" version="2.2.6" />
|
<Release type="tools" version="2.2.6" />
|
||||||
|
|
|
@ -15,6 +15,7 @@ IF (TD_LINUX)
|
||||||
add_executable(tmq "")
|
add_executable(tmq "")
|
||||||
add_executable(stream_demo "")
|
add_executable(stream_demo "")
|
||||||
add_executable(demoapi "")
|
add_executable(demoapi "")
|
||||||
|
add_executable(api_reqid "")
|
||||||
|
|
||||||
target_sources(tmq
|
target_sources(tmq
|
||||||
PRIVATE
|
PRIVATE
|
||||||
|
@ -31,6 +32,12 @@ IF (TD_LINUX)
|
||||||
"demoapi.c"
|
"demoapi.c"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
target_sources(api_reqid
|
||||||
|
PRIVATE
|
||||||
|
"api_with_reqid_test.c"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
target_link_libraries(tmq
|
target_link_libraries(tmq
|
||||||
taos_static
|
taos_static
|
||||||
)
|
)
|
||||||
|
@ -43,6 +50,11 @@ IF (TD_LINUX)
|
||||||
taos_static
|
taos_static
|
||||||
)
|
)
|
||||||
|
|
||||||
|
target_link_libraries(api_reqid
|
||||||
|
taos_static
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
target_include_directories(tmq
|
target_include_directories(tmq
|
||||||
PUBLIC "${TD_SOURCE_DIR}/include/os"
|
PUBLIC "${TD_SOURCE_DIR}/include/os"
|
||||||
PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/inc"
|
PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/inc"
|
||||||
|
@ -58,9 +70,16 @@ IF (TD_LINUX)
|
||||||
PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/inc"
|
PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/inc"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
target_include_directories(api_reqid
|
||||||
|
PUBLIC "${TD_SOURCE_DIR}/include/client"
|
||||||
|
PUBLIC "${TD_SOURCE_DIR}/include/os"
|
||||||
|
PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/inc"
|
||||||
|
)
|
||||||
|
|
||||||
SET_TARGET_PROPERTIES(tmq PROPERTIES OUTPUT_NAME tmq)
|
SET_TARGET_PROPERTIES(tmq PROPERTIES OUTPUT_NAME tmq)
|
||||||
SET_TARGET_PROPERTIES(stream_demo PROPERTIES OUTPUT_NAME stream_demo)
|
SET_TARGET_PROPERTIES(stream_demo PROPERTIES OUTPUT_NAME stream_demo)
|
||||||
SET_TARGET_PROPERTIES(demoapi PROPERTIES OUTPUT_NAME demoapi)
|
SET_TARGET_PROPERTIES(demoapi PROPERTIES OUTPUT_NAME demoapi)
|
||||||
|
SET_TARGET_PROPERTIES(api_reqid PROPERTIES OUTPUT_NAME api_reqid)
|
||||||
ENDIF ()
|
ENDIF ()
|
||||||
IF (TD_DARWIN)
|
IF (TD_DARWIN)
|
||||||
INCLUDE_DIRECTORIES(. ${TD_SOURCE_DIR}/src/inc ${TD_SOURCE_DIR}/src/client/inc ${TD_SOURCE_DIR}/inc)
|
INCLUDE_DIRECTORIES(. ${TD_SOURCE_DIR}/src/inc ${TD_SOURCE_DIR}/src/client/inc ${TD_SOURCE_DIR}/inc)
|
||||||
|
|
|
@ -0,0 +1,449 @@
|
||||||
|
// sample code to verify all TDengine API
|
||||||
|
// to compile: gcc -o apitest apitest.c -ltaos
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include "taos.h"
|
||||||
|
static int64_t count = 10000;
|
||||||
|
|
||||||
|
int64_t genReqid() {
|
||||||
|
count += 100;
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
static void prepare_data(TAOS* taos) {
|
||||||
|
TAOS_RES* result;
|
||||||
|
result = taos_query_with_reqid(taos, "drop database if exists test;", genReqid());
|
||||||
|
taos_free_result(result);
|
||||||
|
usleep(100000);
|
||||||
|
result = taos_query_with_reqid(taos, "create database test precision 'us';", genReqid());
|
||||||
|
taos_free_result(result);
|
||||||
|
usleep(100000);
|
||||||
|
taos_select_db(taos, "test");
|
||||||
|
|
||||||
|
result = taos_query_with_reqid(taos, "create table meters(ts timestamp, a int) tags(area int);", genReqid());
|
||||||
|
taos_free_result(result);
|
||||||
|
|
||||||
|
result = taos_query_with_reqid(taos, "create table t0 using meters tags(0);", genReqid());
|
||||||
|
taos_free_result(result);
|
||||||
|
result = taos_query_with_reqid(taos, "create table t1 using meters tags(1);", genReqid());
|
||||||
|
taos_free_result(result);
|
||||||
|
result = taos_query_with_reqid(taos, "create table t2 using meters tags(2);", genReqid());
|
||||||
|
taos_free_result(result);
|
||||||
|
result = taos_query_with_reqid(taos, "create table t3 using meters tags(3);", genReqid());
|
||||||
|
taos_free_result(result);
|
||||||
|
result = taos_query_with_reqid(taos, "create table t4 using meters tags(4);", genReqid());
|
||||||
|
taos_free_result(result);
|
||||||
|
result = taos_query_with_reqid(taos, "create table t5 using meters tags(5);", genReqid());
|
||||||
|
taos_free_result(result);
|
||||||
|
result = taos_query_with_reqid(taos, "create table t6 using meters tags(6);", genReqid());
|
||||||
|
taos_free_result(result);
|
||||||
|
result = taos_query_with_reqid(taos, "create table t7 using meters tags(7);", genReqid());
|
||||||
|
taos_free_result(result);
|
||||||
|
result = taos_query_with_reqid(taos, "create table t8 using meters tags(8);", genReqid());
|
||||||
|
taos_free_result(result);
|
||||||
|
result = taos_query(taos, "create table t9 using meters tags(9);");
|
||||||
|
taos_free_result(result);
|
||||||
|
|
||||||
|
result = taos_query_with_reqid(taos,
|
||||||
|
"insert into t0 values('2020-01-01 00:00:00.000', 0)"
|
||||||
|
" ('2020-01-01 00:01:00.000', 0)"
|
||||||
|
" ('2020-01-01 00:02:00.000', 0)"
|
||||||
|
" t1 values('2020-01-01 00:00:00.000', 0)"
|
||||||
|
" ('2020-01-01 00:01:00.000', 0)"
|
||||||
|
" ('2020-01-01 00:02:00.000', 0)"
|
||||||
|
" ('2020-01-01 00:03:00.000', 0)"
|
||||||
|
" t2 values('2020-01-01 00:00:00.000', 0)"
|
||||||
|
" ('2020-01-01 00:01:00.000', 0)"
|
||||||
|
" ('2020-01-01 00:01:01.000', 0)"
|
||||||
|
" ('2020-01-01 00:01:02.000', 0)"
|
||||||
|
" t3 values('2020-01-01 00:01:02.000', 0)"
|
||||||
|
" t4 values('2020-01-01 00:01:02.000', 0)"
|
||||||
|
" t5 values('2020-01-01 00:01:02.000', 0)"
|
||||||
|
" t6 values('2020-01-01 00:01:02.000', 0)"
|
||||||
|
" t7 values('2020-01-01 00:01:02.000', 0)"
|
||||||
|
" t8 values('2020-01-01 00:01:02.000', 0)"
|
||||||
|
" t9 values('2020-01-01 00:01:02.000', 0)",
|
||||||
|
genReqid());
|
||||||
|
int affected = taos_affected_rows(result);
|
||||||
|
if (affected != 18) {
|
||||||
|
printf("\033[31m%d rows affected by last insert statement, but it should be 18\033[0m\n", affected);
|
||||||
|
}
|
||||||
|
taos_free_result(result);
|
||||||
|
// super tables subscription
|
||||||
|
usleep(1000000);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int print_result(TAOS_RES* res, int blockFetch) {
|
||||||
|
TAOS_ROW row = NULL;
|
||||||
|
int num_fields = taos_num_fields(res);
|
||||||
|
TAOS_FIELD* fields = taos_fetch_fields(res);
|
||||||
|
int nRows = 0;
|
||||||
|
|
||||||
|
if (blockFetch) {
|
||||||
|
int rows = 0;
|
||||||
|
while ((rows = taos_fetch_block(res, &row))) {
|
||||||
|
// for (int i = 0; i < rows; i++) {
|
||||||
|
// char temp[256];
|
||||||
|
// taos_print_row(temp, row + i, fields, num_fields);
|
||||||
|
// puts(temp);
|
||||||
|
// }
|
||||||
|
nRows += rows;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
while ((row = taos_fetch_row(res))) {
|
||||||
|
char temp[256] = {0};
|
||||||
|
taos_print_row(temp, row, fields, num_fields);
|
||||||
|
puts(temp);
|
||||||
|
nRows++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("%d rows consumed.\n", nRows);
|
||||||
|
return nRows;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void check_row_count(int line, TAOS_RES* res, int expected) {
|
||||||
|
int actual = print_result(res, expected % 2);
|
||||||
|
if (actual != expected) {
|
||||||
|
printf("\033[31mline %d: row count mismatch, expected: %d, actual: %d\033[0m\n", line, expected, actual);
|
||||||
|
} else {
|
||||||
|
printf("line %d: %d rows consumed as expected\n", line, actual);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void verify_query(TAOS* taos) {
|
||||||
|
prepare_data(taos);
|
||||||
|
|
||||||
|
int code = taos_load_table_info(taos, "t0,t1,t2,t3,t4,t5,t6,t7,t8,t9");
|
||||||
|
if (code != 0) {
|
||||||
|
printf("\033[31mfailed to load table info: 0x%08x\033[0m\n", code);
|
||||||
|
}
|
||||||
|
|
||||||
|
code = taos_validate_sql(taos, "select * from nonexisttable");
|
||||||
|
if (code == 0) {
|
||||||
|
printf("\033[31mimpossible, the table does not exists\033[0m\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
code = taos_validate_sql(taos, "select * from meters");
|
||||||
|
if (code != 0) {
|
||||||
|
printf("\033[31mimpossible, the table does exists: 0x%08x\033[0m\n", code);
|
||||||
|
}
|
||||||
|
|
||||||
|
TAOS_RES* res = taos_query_with_reqid(taos, "select * from meters", genReqid());
|
||||||
|
check_row_count(__LINE__, res, 18);
|
||||||
|
printf("result precision is: %d\n", taos_result_precision(res));
|
||||||
|
int c = taos_field_count(res);
|
||||||
|
printf("field count is: %d\n", c);
|
||||||
|
int* lengths = taos_fetch_lengths(res);
|
||||||
|
for (int i = 0; i < c; i++) {
|
||||||
|
printf("length of column %d is %d\n", i, lengths[i]);
|
||||||
|
}
|
||||||
|
taos_free_result(res);
|
||||||
|
|
||||||
|
res = taos_query_with_reqid(taos, "select * from t0", genReqid());
|
||||||
|
check_row_count(__LINE__, res, 3);
|
||||||
|
taos_free_result(res);
|
||||||
|
|
||||||
|
res = taos_query_with_reqid(taos, "select * from nonexisttable", genReqid());
|
||||||
|
code = taos_errno(res);
|
||||||
|
printf("code=%d, error msg=%s\n", code, taos_errstr(res));
|
||||||
|
taos_free_result(res);
|
||||||
|
|
||||||
|
res = taos_query_with_reqid(taos, "select * from meters", genReqid());
|
||||||
|
taos_stop_query(res);
|
||||||
|
taos_free_result(res);
|
||||||
|
}
|
||||||
|
|
||||||
|
void retrieve_callback(void* param, TAOS_RES* tres, int numOfRows) {
|
||||||
|
if (numOfRows > 0) {
|
||||||
|
printf("%d rows async retrieved\n", numOfRows);
|
||||||
|
taos_fetch_rows_a(tres, retrieve_callback, param);
|
||||||
|
} else {
|
||||||
|
if (numOfRows < 0) {
|
||||||
|
printf("\033[31masync retrieve failed, code: %d\033[0m\n", numOfRows);
|
||||||
|
} else {
|
||||||
|
printf("async retrieve completed\n");
|
||||||
|
}
|
||||||
|
taos_free_result(tres);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void select_callback(void* param, TAOS_RES* tres, int code) {
|
||||||
|
if (code == 0 && tres) {
|
||||||
|
taos_fetch_rows_a(tres, retrieve_callback, param);
|
||||||
|
} else {
|
||||||
|
printf("\033[31masync select failed, code: %d\033[0m\n", code);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void verify_async(TAOS* taos) {
|
||||||
|
prepare_data(taos);
|
||||||
|
taos_query_a_with_reqid(taos, "select * from meters", select_callback, NULL, genReqid());
|
||||||
|
usleep(1000000);
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t verify_schema_less(TAOS* taos) {
|
||||||
|
TAOS_RES* result;
|
||||||
|
result = taos_query_with_reqid(taos, "drop database if exists test;", genReqid());
|
||||||
|
taos_free_result(result);
|
||||||
|
usleep(100000);
|
||||||
|
result = taos_query_with_reqid(taos, "create database test precision 'us' update 1;", genReqid());
|
||||||
|
taos_free_result(result);
|
||||||
|
usleep(100000);
|
||||||
|
|
||||||
|
taos_select_db(taos, "test");
|
||||||
|
result = taos_query_with_reqid(taos, "create stable ste(ts timestamp, f int) tags(t1 bigint)", genReqid());
|
||||||
|
taos_free_result(result);
|
||||||
|
usleep(100000);
|
||||||
|
|
||||||
|
int code = 0;
|
||||||
|
|
||||||
|
char* lines[] = {
|
||||||
|
"st,t1=3i64,t2=4f64,t3=\"t3\" c1=3i64,c3=L\"passit\",c2=false,c4=4f64 1626006833639000000ns",
|
||||||
|
"st,t1=4i64,t3=\"t4\",t2=5f64,t4=5f64 c1=3i64,c3=L\"passitagin\",c2=true,c4=5f64,c5=5f64 1626006833640000000ns",
|
||||||
|
"ste,t2=5f64,t3=L\"ste\" c1=true,c2=4i64,c3=\"iam\" 1626056811823316532ns",
|
||||||
|
"st,t1=4i64,t2=5f64,t3=\"t4\" c1=3i64,c3=L\"passitagain\",c2=true,c4=5f64 1626006833642000000ns",
|
||||||
|
"ste,t2=5f64,t3=L\"ste2\" c3=\"iamszhou\",c4=false 1626056811843316532ns",
|
||||||
|
"ste,t2=5f64,t3=L\"ste2\" c3=\"iamszhou\",c4=false,c5=32i8,c6=64i16,c7=32i32,c8=88.88f32 1626056812843316532ns",
|
||||||
|
"st,t1=4i64,t3=\"t4\",t2=5f64,t4=5f64 c1=3i64,c3=L\"passitagin\",c2=true,c4=5f64,c5=5f64,c6=7u64 "
|
||||||
|
"1626006933640000000ns",
|
||||||
|
"stf,t1=4i64,t3=\"t4\",t2=5f64,t4=5f64 c1=3i64,c3=L\"passitagin\",c2=true,c4=5f64,c5=5f64,c6=7u64 "
|
||||||
|
"1626006933640000000ns",
|
||||||
|
"stf,t1=4i64,t3=\"t4\",t2=5f64,t4=5f64 c1=3i64,c3=L\"passitagin_stf\",c2=false,c5=5f64,c6=7u64 "
|
||||||
|
"1626006933641000000ns"};
|
||||||
|
|
||||||
|
taos_select_db(taos, "test");
|
||||||
|
|
||||||
|
TAOS_RES* res = taos_schemaless_insert_with_reqid(taos, lines, sizeof(lines) / sizeof(char*), TSDB_SML_LINE_PROTOCOL,
|
||||||
|
TSDB_SML_TIMESTAMP_NOT_CONFIGURED, genReqid());
|
||||||
|
if (taos_errno(res) != 0) {
|
||||||
|
printf("failed to insert schema-less data, reason: %s\n", taos_errstr(res));
|
||||||
|
} else {
|
||||||
|
int affectedRow = taos_affected_rows(res);
|
||||||
|
printf("successfully inserted %d rows\n", affectedRow);
|
||||||
|
}
|
||||||
|
taos_free_result(res);
|
||||||
|
|
||||||
|
return (code);
|
||||||
|
}
|
||||||
|
|
||||||
|
void veriry_stmt(TAOS* taos) {
|
||||||
|
TAOS_RES* result = taos_query(taos, "drop database if exists test;");
|
||||||
|
taos_free_result(result);
|
||||||
|
usleep(100000);
|
||||||
|
result = taos_query(taos, "create database test;");
|
||||||
|
|
||||||
|
int code = taos_errno(result);
|
||||||
|
if (code != 0) {
|
||||||
|
printf("\033[31mfailed to create database, reason:%s\033[0m\n", taos_errstr(result));
|
||||||
|
taos_free_result(result);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
taos_free_result(result);
|
||||||
|
|
||||||
|
usleep(100000);
|
||||||
|
taos_select_db(taos, "test");
|
||||||
|
|
||||||
|
// create table
|
||||||
|
const char* sql =
|
||||||
|
"create table m1 (ts timestamp, b bool, v1 tinyint, v2 smallint, v4 int, v8 bigint, f4 float, f8 double, bin "
|
||||||
|
"binary(40), blob nchar(10))";
|
||||||
|
result = taos_query(taos, sql);
|
||||||
|
code = taos_errno(result);
|
||||||
|
if (code != 0) {
|
||||||
|
printf("\033[31mfailed to create table, reason:%s\033[0m\n", taos_errstr(result));
|
||||||
|
taos_free_result(result);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
taos_free_result(result);
|
||||||
|
|
||||||
|
// insert 10 records
|
||||||
|
struct {
|
||||||
|
int64_t ts[10];
|
||||||
|
int8_t b[10];
|
||||||
|
int8_t v1[10];
|
||||||
|
int16_t v2[10];
|
||||||
|
int32_t v4[10];
|
||||||
|
int64_t v8[10];
|
||||||
|
float f4[10];
|
||||||
|
double f8[10];
|
||||||
|
char bin[10][40];
|
||||||
|
char blob[10][80];
|
||||||
|
} v;
|
||||||
|
|
||||||
|
int32_t* t8_len = malloc(sizeof(int32_t) * 10);
|
||||||
|
int32_t* t16_len = malloc(sizeof(int32_t) * 10);
|
||||||
|
int32_t* t32_len = malloc(sizeof(int32_t) * 10);
|
||||||
|
int32_t* t64_len = malloc(sizeof(int32_t) * 10);
|
||||||
|
int32_t* float_len = malloc(sizeof(int32_t) * 10);
|
||||||
|
int32_t* double_len = malloc(sizeof(int32_t) * 10);
|
||||||
|
int32_t* bin_len = malloc(sizeof(int32_t) * 10);
|
||||||
|
int32_t* blob_len = malloc(sizeof(int32_t) * 10);
|
||||||
|
|
||||||
|
TAOS_STMT* stmt = taos_stmt_init_with_reqid(taos, genReqid());
|
||||||
|
TAOS_MULTI_BIND params[10];
|
||||||
|
char is_null[10] = {0};
|
||||||
|
|
||||||
|
params[0].buffer_type = TSDB_DATA_TYPE_TIMESTAMP;
|
||||||
|
params[0].buffer_length = sizeof(v.ts[0]);
|
||||||
|
params[0].buffer = v.ts;
|
||||||
|
params[0].length = t64_len;
|
||||||
|
params[0].is_null = is_null;
|
||||||
|
params[0].num = 10;
|
||||||
|
|
||||||
|
params[1].buffer_type = TSDB_DATA_TYPE_BOOL;
|
||||||
|
params[1].buffer_length = sizeof(v.b[0]);
|
||||||
|
params[1].buffer = v.b;
|
||||||
|
params[1].length = t8_len;
|
||||||
|
params[1].is_null = is_null;
|
||||||
|
params[1].num = 10;
|
||||||
|
|
||||||
|
params[2].buffer_type = TSDB_DATA_TYPE_TINYINT;
|
||||||
|
params[2].buffer_length = sizeof(v.v1[0]);
|
||||||
|
params[2].buffer = v.v1;
|
||||||
|
params[2].length = t8_len;
|
||||||
|
params[2].is_null = is_null;
|
||||||
|
params[2].num = 10;
|
||||||
|
|
||||||
|
params[3].buffer_type = TSDB_DATA_TYPE_SMALLINT;
|
||||||
|
params[3].buffer_length = sizeof(v.v2[0]);
|
||||||
|
params[3].buffer = v.v2;
|
||||||
|
params[3].length = t16_len;
|
||||||
|
params[3].is_null = is_null;
|
||||||
|
params[3].num = 10;
|
||||||
|
|
||||||
|
params[4].buffer_type = TSDB_DATA_TYPE_INT;
|
||||||
|
params[4].buffer_length = sizeof(v.v4[0]);
|
||||||
|
params[4].buffer = v.v4;
|
||||||
|
params[4].length = t32_len;
|
||||||
|
params[4].is_null = is_null;
|
||||||
|
params[4].num = 10;
|
||||||
|
|
||||||
|
params[5].buffer_type = TSDB_DATA_TYPE_BIGINT;
|
||||||
|
params[5].buffer_length = sizeof(v.v8[0]);
|
||||||
|
params[5].buffer = v.v8;
|
||||||
|
params[5].length = t64_len;
|
||||||
|
params[5].is_null = is_null;
|
||||||
|
params[5].num = 10;
|
||||||
|
|
||||||
|
params[6].buffer_type = TSDB_DATA_TYPE_FLOAT;
|
||||||
|
params[6].buffer_length = sizeof(v.f4[0]);
|
||||||
|
params[6].buffer = v.f4;
|
||||||
|
params[6].length = float_len;
|
||||||
|
params[6].is_null = is_null;
|
||||||
|
params[6].num = 10;
|
||||||
|
|
||||||
|
params[7].buffer_type = TSDB_DATA_TYPE_DOUBLE;
|
||||||
|
params[7].buffer_length = sizeof(v.f8[0]);
|
||||||
|
params[7].buffer = v.f8;
|
||||||
|
params[7].length = double_len;
|
||||||
|
params[7].is_null = is_null;
|
||||||
|
params[7].num = 10;
|
||||||
|
|
||||||
|
params[8].buffer_type = TSDB_DATA_TYPE_BINARY;
|
||||||
|
params[8].buffer_length = sizeof(v.bin[0]);
|
||||||
|
params[8].buffer = v.bin;
|
||||||
|
params[8].length = bin_len;
|
||||||
|
params[8].is_null = is_null;
|
||||||
|
params[8].num = 10;
|
||||||
|
|
||||||
|
params[9].buffer_type = TSDB_DATA_TYPE_NCHAR;
|
||||||
|
params[9].buffer_length = sizeof(v.blob[0]);
|
||||||
|
params[9].buffer = v.blob;
|
||||||
|
params[9].length = blob_len;
|
||||||
|
params[9].is_null = is_null;
|
||||||
|
params[9].num = 10;
|
||||||
|
|
||||||
|
sql = "insert into ? (ts, b, v1, v2, v4, v8, f4, f8, bin, blob) values(?,?,?,?,?,?,?,?,?,?)";
|
||||||
|
code = taos_stmt_prepare(stmt, sql, 0);
|
||||||
|
if (code != 0) {
|
||||||
|
printf("\033[31mfailed to execute taos_stmt_prepare. error:%s\033[0m\n", taos_stmt_errstr(stmt));
|
||||||
|
taos_stmt_close(stmt);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
code = taos_stmt_set_tbname(stmt, "m1");
|
||||||
|
if (code != 0) {
|
||||||
|
printf("\033[31mfailed to execute taos_stmt_prepare. error:%s\033[0m\n", taos_stmt_errstr(stmt));
|
||||||
|
taos_stmt_close(stmt);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int64_t ts = 1591060628000;
|
||||||
|
for (int i = 0; i < 10; ++i) {
|
||||||
|
v.ts[i] = ts++;
|
||||||
|
is_null[i] = 0;
|
||||||
|
|
||||||
|
v.b[i] = (int8_t)i % 2;
|
||||||
|
v.v1[i] = (int8_t)i;
|
||||||
|
v.v2[i] = (int16_t)(i * 2);
|
||||||
|
v.v4[i] = (int32_t)(i * 4);
|
||||||
|
v.v8[i] = (int64_t)(i * 8);
|
||||||
|
v.f4[i] = (float)(i * 40);
|
||||||
|
v.f8[i] = (double)(i * 80);
|
||||||
|
for (int j = 0; j < sizeof(v.bin[0]); ++j) {
|
||||||
|
v.bin[i][j] = (char)(i + '0');
|
||||||
|
}
|
||||||
|
strcpy(v.blob[i], "一二三四五六七八九十");
|
||||||
|
|
||||||
|
t8_len[i] = sizeof(int8_t);
|
||||||
|
t16_len[i] = sizeof(int16_t);
|
||||||
|
t32_len[i] = sizeof(int32_t);
|
||||||
|
t64_len[i] = sizeof(int64_t);
|
||||||
|
float_len[i] = sizeof(float);
|
||||||
|
double_len[i] = sizeof(double);
|
||||||
|
bin_len[i] = sizeof(v.bin[0]);
|
||||||
|
blob_len[i] = (int32_t)strlen(v.blob[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
taos_stmt_bind_param_batch(stmt, params);
|
||||||
|
taos_stmt_add_batch(stmt);
|
||||||
|
|
||||||
|
if (taos_stmt_execute(stmt) != 0) {
|
||||||
|
printf("\033[31mfailed to execute insert statement.error:%s\033[0m\n", taos_stmt_errstr(stmt));
|
||||||
|
taos_stmt_close(stmt);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
taos_stmt_close(stmt);
|
||||||
|
|
||||||
|
free(t8_len);
|
||||||
|
free(t16_len);
|
||||||
|
free(t32_len);
|
||||||
|
free(t64_len);
|
||||||
|
free(float_len);
|
||||||
|
free(double_len);
|
||||||
|
free(bin_len);
|
||||||
|
free(blob_len);
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char* argv[]) {
|
||||||
|
const char* host = "127.0.0.1";
|
||||||
|
const char* user = "root";
|
||||||
|
const char* passwd = "taosdata";
|
||||||
|
|
||||||
|
taos_options(TSDB_OPTION_TIMEZONE, "GMT-8");
|
||||||
|
TAOS* taos = taos_connect(host, user, passwd, "", 0);
|
||||||
|
if (taos == NULL) {
|
||||||
|
printf("\033[31mfailed to connect to db, reason:%s\033[0m\n", taos_errstr(taos));
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("************ verify schema-less *************\n");
|
||||||
|
verify_schema_less(taos);
|
||||||
|
|
||||||
|
printf("************ verify query *************\n");
|
||||||
|
verify_query(taos);
|
||||||
|
|
||||||
|
printf("********* verify async query **********\n");
|
||||||
|
verify_async(taos);
|
||||||
|
|
||||||
|
printf("********* verify stmt query **********\n");
|
||||||
|
veriry_stmt(taos);
|
||||||
|
|
||||||
|
printf("done\n");
|
||||||
|
taos_close(taos);
|
||||||
|
taos_cleanup();
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
|
@ -26,7 +26,7 @@ import (
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
_ "github.com/taosdata/driver-go/taosSql"
|
_ "github.com/taosdata/driver-go/v3/taosSql"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -173,7 +173,7 @@ func createDatabase(dbName string, supTblName string) {
|
||||||
time.Sleep(time.Second)
|
time.Sleep(time.Second)
|
||||||
|
|
||||||
// create database
|
// create database
|
||||||
sqlStr = "create database " + dbName + " keep " + strconv.Itoa(configPara.keep) + " days " + strconv.Itoa(configPara.days)
|
sqlStr = "create database " + dbName
|
||||||
_, err = db.Exec(sqlStr)
|
_, err = db.Exec(sqlStr)
|
||||||
checkErr(err, sqlStr)
|
checkErr(err, sqlStr)
|
||||||
|
|
||||||
|
|
|
@ -130,17 +130,16 @@ typedef struct TAOS_VGROUP_HASH_INFO {
|
||||||
int32_t vgId;
|
int32_t vgId;
|
||||||
uint32_t hashBegin;
|
uint32_t hashBegin;
|
||||||
uint32_t hashEnd;
|
uint32_t hashEnd;
|
||||||
} TAOS_VGROUP_HASH_INFO ;
|
} TAOS_VGROUP_HASH_INFO;
|
||||||
|
|
||||||
typedef struct TAOS_DB_ROUTE_INFO {
|
typedef struct TAOS_DB_ROUTE_INFO {
|
||||||
int32_t routeVersion;
|
int32_t routeVersion;
|
||||||
int16_t hashPrefix;
|
int16_t hashPrefix;
|
||||||
int16_t hashSuffix;
|
int16_t hashSuffix;
|
||||||
int8_t hashMethod;
|
int8_t hashMethod;
|
||||||
int32_t vgNum;
|
int32_t vgNum;
|
||||||
TAOS_VGROUP_HASH_INFO *vgHash;
|
TAOS_VGROUP_HASH_INFO *vgHash;
|
||||||
} TAOS_DB_ROUTE_INFO ;
|
} TAOS_DB_ROUTE_INFO;
|
||||||
|
|
||||||
|
|
||||||
DLL_EXPORT void taos_cleanup(void);
|
DLL_EXPORT void taos_cleanup(void);
|
||||||
DLL_EXPORT int taos_options(TSDB_OPTION option, const void *arg, ...);
|
DLL_EXPORT int taos_options(TSDB_OPTION option, const void *arg, ...);
|
||||||
|
@ -153,6 +152,7 @@ DLL_EXPORT void taos_close(TAOS *taos);
|
||||||
const char *taos_data_type(int type);
|
const char *taos_data_type(int type);
|
||||||
|
|
||||||
DLL_EXPORT TAOS_STMT *taos_stmt_init(TAOS *taos);
|
DLL_EXPORT TAOS_STMT *taos_stmt_init(TAOS *taos);
|
||||||
|
DLL_EXPORT TAOS_STMT *taos_stmt_init_with_reqid(TAOS *taos, int64_t reqid);
|
||||||
DLL_EXPORT int taos_stmt_prepare(TAOS_STMT *stmt, const char *sql, unsigned long length);
|
DLL_EXPORT int taos_stmt_prepare(TAOS_STMT *stmt, const char *sql, unsigned long length);
|
||||||
DLL_EXPORT int taos_stmt_set_tbname_tags(TAOS_STMT *stmt, const char *name, TAOS_MULTI_BIND *tags);
|
DLL_EXPORT int taos_stmt_set_tbname_tags(TAOS_STMT *stmt, const char *name, TAOS_MULTI_BIND *tags);
|
||||||
DLL_EXPORT int taos_stmt_set_tbname(TAOS_STMT *stmt, const char *name);
|
DLL_EXPORT int taos_stmt_set_tbname(TAOS_STMT *stmt, const char *name);
|
||||||
|
@ -176,6 +176,7 @@ DLL_EXPORT int taos_stmt_affected_rows(TAOS_STMT *stmt);
|
||||||
DLL_EXPORT int taos_stmt_affected_rows_once(TAOS_STMT *stmt);
|
DLL_EXPORT int taos_stmt_affected_rows_once(TAOS_STMT *stmt);
|
||||||
|
|
||||||
DLL_EXPORT TAOS_RES *taos_query(TAOS *taos, const char *sql);
|
DLL_EXPORT TAOS_RES *taos_query(TAOS *taos, const char *sql);
|
||||||
|
DLL_EXPORT TAOS_RES *taos_query_with_reqid(TAOS *taos, const char *sql, int64_t reqId);
|
||||||
|
|
||||||
DLL_EXPORT TAOS_ROW taos_fetch_row(TAOS_RES *res);
|
DLL_EXPORT TAOS_ROW taos_fetch_row(TAOS_RES *res);
|
||||||
DLL_EXPORT int taos_result_precision(TAOS_RES *res); // get the time precision of result
|
DLL_EXPORT int taos_result_precision(TAOS_RES *res); // get the time precision of result
|
||||||
|
@ -207,17 +208,23 @@ DLL_EXPORT const char *taos_get_client_info();
|
||||||
DLL_EXPORT const char *taos_errstr(TAOS_RES *res);
|
DLL_EXPORT const char *taos_errstr(TAOS_RES *res);
|
||||||
DLL_EXPORT int taos_errno(TAOS_RES *res);
|
DLL_EXPORT int taos_errno(TAOS_RES *res);
|
||||||
|
|
||||||
DLL_EXPORT void taos_query_a(TAOS *taos, const char *sql, __taos_async_fn_t fp, void *param);
|
DLL_EXPORT void taos_query_a(TAOS *taos, const char *sql, __taos_async_fn_t fp, void *param);
|
||||||
DLL_EXPORT void taos_fetch_rows_a(TAOS_RES *res, __taos_async_fn_t fp, void *param);
|
DLL_EXPORT void taos_query_a_with_reqid(TAOS *taos, const char *sql, __taos_async_fn_t fp, void *param, int64_t reqid);
|
||||||
DLL_EXPORT void taos_fetch_raw_block_a(TAOS_RES *res, __taos_async_fn_t fp, void *param);
|
DLL_EXPORT void taos_fetch_rows_a(TAOS_RES *res, __taos_async_fn_t fp, void *param);
|
||||||
|
DLL_EXPORT void taos_fetch_raw_block_a(TAOS_RES *res, __taos_async_fn_t fp, void *param);
|
||||||
DLL_EXPORT const void *taos_get_raw_block(TAOS_RES *res);
|
DLL_EXPORT const void *taos_get_raw_block(TAOS_RES *res);
|
||||||
|
|
||||||
DLL_EXPORT int taos_get_db_route_info(TAOS* taos, const char* db, TAOS_DB_ROUTE_INFO* dbInfo);
|
DLL_EXPORT int taos_get_db_route_info(TAOS *taos, const char *db, TAOS_DB_ROUTE_INFO *dbInfo);
|
||||||
DLL_EXPORT int taos_get_table_vgId(TAOS* taos, const char* db, const char* table, int* vgId);
|
DLL_EXPORT int taos_get_table_vgId(TAOS *taos, const char *db, const char *table, int *vgId);
|
||||||
|
|
||||||
DLL_EXPORT int taos_load_table_info(TAOS *taos, const char *tableNameList);
|
DLL_EXPORT int taos_load_table_info(TAOS *taos, const char *tableNameList);
|
||||||
DLL_EXPORT TAOS_RES *taos_schemaless_insert(TAOS *taos, char *lines[], int numLines, int protocol, int precision);
|
DLL_EXPORT TAOS_RES *taos_schemaless_insert(TAOS *taos, char *lines[], int numLines, int protocol, int precision);
|
||||||
DLL_EXPORT TAOS_RES *taos_schemaless_insert_raw(TAOS* taos, char* lines, int len, int32_t *totalRows, int protocol, int precision);
|
DLL_EXPORT TAOS_RES *taos_schemaless_insert_with_reqid(TAOS *taos, char *lines[], int numLines, int protocol,
|
||||||
|
int precision, int64_t reqid);
|
||||||
|
DLL_EXPORT TAOS_RES *taos_schemaless_insert_raw(TAOS *taos, char *lines, int len, int32_t *totalRows, int protocol,
|
||||||
|
int precision);
|
||||||
|
DLL_EXPORT TAOS_RES *taos_schemaless_insert_raw_with_reqid(TAOS *taos, char *lines, int len, int32_t *totalRows,
|
||||||
|
int protocol, int precision, int64_t reqid);
|
||||||
|
|
||||||
/* --------------------------TMQ INTERFACE------------------------------- */
|
/* --------------------------TMQ INTERFACE------------------------------- */
|
||||||
|
|
||||||
|
|
|
@ -225,13 +225,13 @@ typedef struct SVarColAttr {
|
||||||
// pBlockAgg->numOfNull == info.rows, all data are null
|
// pBlockAgg->numOfNull == info.rows, all data are null
|
||||||
// pBlockAgg->numOfNull == 0, no data are null.
|
// pBlockAgg->numOfNull == 0, no data are null.
|
||||||
typedef struct SColumnInfoData {
|
typedef struct SColumnInfoData {
|
||||||
SColumnInfo info; // column info
|
char* pData; // the corresponding block data in memory
|
||||||
bool hasNull; // if current column data has null value.
|
|
||||||
char* pData; // the corresponding block data in memory
|
|
||||||
union {
|
union {
|
||||||
char* nullbitmap; // bitmap, one bit for each item in the list
|
char* nullbitmap; // bitmap, one bit for each item in the list
|
||||||
SVarColAttr varmeta;
|
SVarColAttr varmeta;
|
||||||
};
|
};
|
||||||
|
SColumnInfo info; // column info
|
||||||
|
bool hasNull; // if current column data has null value.
|
||||||
} SColumnInfoData;
|
} SColumnInfoData;
|
||||||
|
|
||||||
typedef struct SQueryTableDataCond {
|
typedef struct SQueryTableDataCond {
|
||||||
|
|
|
@ -137,6 +137,9 @@ static FORCE_INLINE void colDataAppendNNULL(SColumnInfoData* pColumnInfoData, ui
|
||||||
for (int32_t i = start; i < start + nRows; ++i) {
|
for (int32_t i = start; i < start + nRows; ++i) {
|
||||||
colDataSetNull_f(pColumnInfoData->nullbitmap, i);
|
colDataSetNull_f(pColumnInfoData->nullbitmap, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32_t bytes = pColumnInfoData->info.bytes;
|
||||||
|
memset(pColumnInfoData->pData + start * bytes, 0, nRows * bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
pColumnInfoData->hasNull = true;
|
pColumnInfoData->hasNull = true;
|
||||||
|
@ -215,7 +218,7 @@ size_t blockDataGetSerialMetaSize(uint32_t numOfCols);
|
||||||
int32_t blockDataSort(SSDataBlock* pDataBlock, SArray* pOrderInfo);
|
int32_t blockDataSort(SSDataBlock* pDataBlock, SArray* pOrderInfo);
|
||||||
int32_t blockDataSort_rv(SSDataBlock* pDataBlock, SArray* pOrderInfo, bool nullFirst);
|
int32_t blockDataSort_rv(SSDataBlock* pDataBlock, SArray* pOrderInfo, bool nullFirst);
|
||||||
|
|
||||||
int32_t colInfoDataEnsureCapacity(SColumnInfoData* pColumn, uint32_t numOfRows);
|
int32_t colInfoDataEnsureCapacity(SColumnInfoData* pColumn, uint32_t numOfRows, bool clearPayload);
|
||||||
int32_t blockDataEnsureCapacity(SSDataBlock* pDataBlock, uint32_t numOfRows);
|
int32_t blockDataEnsureCapacity(SSDataBlock* pDataBlock, uint32_t numOfRows);
|
||||||
|
|
||||||
void colInfoDataCleanup(SColumnInfoData* pColumn, uint32_t numOfRows);
|
void colInfoDataCleanup(SColumnInfoData* pColumn, uint32_t numOfRows);
|
||||||
|
@ -241,7 +244,7 @@ int32_t blockDataAppendColInfo(SSDataBlock* pBlock, SColumnInfoData* pColIn
|
||||||
SColumnInfoData createColumnInfoData(int16_t type, int32_t bytes, int16_t colId);
|
SColumnInfoData createColumnInfoData(int16_t type, int32_t bytes, int16_t colId);
|
||||||
SColumnInfoData* bdGetColumnInfoData(const SSDataBlock* pBlock, int32_t index);
|
SColumnInfoData* bdGetColumnInfoData(const SSDataBlock* pBlock, int32_t index);
|
||||||
|
|
||||||
void blockEncode(const SSDataBlock* pBlock, char* data, int32_t* dataLen, int32_t numOfCols, int8_t needCompress);
|
int32_t blockEncode(const SSDataBlock* pBlock, char* data, int32_t numOfCols);
|
||||||
const char* blockDecode(SSDataBlock* pBlock, const char* pData);
|
const char* blockDecode(SSDataBlock* pBlock, const char* pData);
|
||||||
|
|
||||||
void blockDebugShowDataBlock(SSDataBlock* pBlock, const char* flag);
|
void blockDebugShowDataBlock(SSDataBlock* pBlock, const char* flag);
|
||||||
|
|
|
@ -74,9 +74,7 @@ int32_t tTSchemaCreate(int32_t sver, SSchema *pSchema, int32_t nCols, STSchema *
|
||||||
void tTSchemaDestroy(STSchema *pTSchema);
|
void tTSchemaDestroy(STSchema *pTSchema);
|
||||||
|
|
||||||
// SValue ================================
|
// SValue ================================
|
||||||
int32_t tPutValue(uint8_t *p, SValue *pValue, int8_t type);
|
static FORCE_INLINE int32_t tGetValue(uint8_t *p, SValue *pValue, int8_t type);
|
||||||
int32_t tGetValue(uint8_t *p, SValue *pValue, int8_t type);
|
|
||||||
int tValueCmprFn(const SValue *pValue1, const SValue *pValue2, int8_t type);
|
|
||||||
|
|
||||||
// SColVal ================================
|
// SColVal ================================
|
||||||
#define CV_FLAG_VALUE ((int8_t)0x0)
|
#define CV_FLAG_VALUE ((int8_t)0x0)
|
||||||
|
@ -132,8 +130,9 @@ void tColDataInit(SColData *pColData, int16_t cid, int8_t type, int8_t smaOn)
|
||||||
void tColDataClear(SColData *pColData);
|
void tColDataClear(SColData *pColData);
|
||||||
int32_t tColDataAppendValue(SColData *pColData, SColVal *pColVal);
|
int32_t tColDataAppendValue(SColData *pColData, SColVal *pColVal);
|
||||||
void tColDataGetValue(SColData *pColData, int32_t iVal, SColVal *pColVal);
|
void tColDataGetValue(SColData *pColData, int32_t iVal, SColVal *pColVal);
|
||||||
uint8_t tColDataGetBitValue(SColData *pColData, int32_t iVal);
|
uint8_t tColDataGetBitValue(const SColData *pColData, int32_t iVal);
|
||||||
int32_t tColDataCopy(SColData *pColDataSrc, SColData *pColDataDest);
|
int32_t tColDataCopy(SColData *pColDataSrc, SColData *pColDataDest);
|
||||||
|
extern void (*tColDataCalcSMA[])(SColData *pColData, int64_t *sum, int64_t *max, int64_t *min, int16_t *numOfNull);
|
||||||
|
|
||||||
// STRUCT ================================
|
// STRUCT ================================
|
||||||
struct STColumn {
|
struct STColumn {
|
||||||
|
@ -241,13 +240,6 @@ struct STag {
|
||||||
memcpy(varDataVal(x), (str), __len); \
|
memcpy(varDataVal(x), (str), __len); \
|
||||||
} while (0);
|
} while (0);
|
||||||
|
|
||||||
#define STR_TO_NET_VARSTR(x, str) \
|
|
||||||
do { \
|
|
||||||
VarDataLenT __len = (VarDataLenT)strlen(str); \
|
|
||||||
*(VarDataLenT *)(x) = htons(__len); \
|
|
||||||
memcpy(varDataVal(x), (str), __len); \
|
|
||||||
} while (0);
|
|
||||||
|
|
||||||
#define STR_WITH_MAXSIZE_TO_VARSTR(x, str, _maxs) \
|
#define STR_WITH_MAXSIZE_TO_VARSTR(x, str, _maxs) \
|
||||||
do { \
|
do { \
|
||||||
char *_e = stpncpy(varDataVal(x), (str), (_maxs)-VARSTR_HEADER_SIZE); \
|
char *_e = stpncpy(varDataVal(x), (str), (_maxs)-VARSTR_HEADER_SIZE); \
|
||||||
|
@ -289,6 +281,15 @@ void tdResetTSchemaBuilder(STSchemaBuilder *pBuilder, schema_ver_t version)
|
||||||
int32_t tdAddColToSchema(STSchemaBuilder *pBuilder, int8_t type, int8_t flags, col_id_t colId, col_bytes_t bytes);
|
int32_t tdAddColToSchema(STSchemaBuilder *pBuilder, int8_t type, int8_t flags, col_id_t colId, col_bytes_t bytes);
|
||||||
STSchema *tdGetSchemaFromBuilder(STSchemaBuilder *pBuilder);
|
STSchema *tdGetSchemaFromBuilder(STSchemaBuilder *pBuilder);
|
||||||
|
|
||||||
|
static FORCE_INLINE int32_t tGetValue(uint8_t *p, SValue *pValue, int8_t type) {
|
||||||
|
if (IS_VAR_DATA_TYPE(type)) {
|
||||||
|
return tGetBinary(p, &pValue->pData, pValue ? &pValue->nData : NULL);
|
||||||
|
} else {
|
||||||
|
memcpy(&pValue->val, p, tDataTypes[type].bytes);
|
||||||
|
return tDataTypes[type].bytes;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -55,8 +55,6 @@ extern int32_t tsNumOfMnodeReadThreads;
|
||||||
extern int32_t tsNumOfVnodeQueryThreads;
|
extern int32_t tsNumOfVnodeQueryThreads;
|
||||||
extern int32_t tsNumOfVnodeStreamThreads;
|
extern int32_t tsNumOfVnodeStreamThreads;
|
||||||
extern int32_t tsNumOfVnodeFetchThreads;
|
extern int32_t tsNumOfVnodeFetchThreads;
|
||||||
extern int32_t tsNumOfVnodeWriteThreads;
|
|
||||||
extern int32_t tsNumOfVnodeSyncThreads;
|
|
||||||
extern int32_t tsNumOfVnodeRsmaThreads;
|
extern int32_t tsNumOfVnodeRsmaThreads;
|
||||||
extern int32_t tsNumOfQnodeQueryThreads;
|
extern int32_t tsNumOfQnodeQueryThreads;
|
||||||
extern int32_t tsNumOfQnodeFetchThreads;
|
extern int32_t tsNumOfQnodeFetchThreads;
|
||||||
|
@ -137,6 +135,9 @@ extern int32_t tsTtlPushInterval;
|
||||||
extern int32_t tsGrantHBInterval;
|
extern int32_t tsGrantHBInterval;
|
||||||
extern int32_t tsUptimeInterval;
|
extern int32_t tsUptimeInterval;
|
||||||
|
|
||||||
|
extern int32_t tsRpcRetryLimit;
|
||||||
|
extern int32_t tsRpcRetryInterval;
|
||||||
|
|
||||||
//#define NEEDTO_COMPRESSS_MSG(size) (tsCompressMsgSize != -1 && (size) > tsCompressMsgSize)
|
//#define NEEDTO_COMPRESSS_MSG(size) (tsCompressMsgSize != -1 && (size) > tsCompressMsgSize)
|
||||||
|
|
||||||
int32_t taosCreateLog(const char *logname, int32_t logFileNum, const char *cfgDir, const char **envCmd,
|
int32_t taosCreateLog(const char *logname, int32_t logFileNum, const char *cfgDir, const char **envCmd,
|
||||||
|
|
|
@ -190,6 +190,7 @@ typedef struct {
|
||||||
int64_t dbId;
|
int64_t dbId;
|
||||||
int32_t vgVersion;
|
int32_t vgVersion;
|
||||||
int32_t numOfTable; // unit is TSDB_TABLE_NUM_UNIT
|
int32_t numOfTable; // unit is TSDB_TABLE_NUM_UNIT
|
||||||
|
int64_t stateTs;
|
||||||
} SBuildUseDBInput;
|
} SBuildUseDBInput;
|
||||||
|
|
||||||
typedef struct SField {
|
typedef struct SField {
|
||||||
|
@ -297,7 +298,6 @@ typedef struct {
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int32_t code;
|
int32_t code;
|
||||||
int8_t hashMeta;
|
|
||||||
int64_t uid;
|
int64_t uid;
|
||||||
char* tblFName;
|
char* tblFName;
|
||||||
int32_t numOfRows;
|
int32_t numOfRows;
|
||||||
|
@ -839,6 +839,7 @@ typedef struct {
|
||||||
int64_t dbId;
|
int64_t dbId;
|
||||||
int32_t vgVersion;
|
int32_t vgVersion;
|
||||||
int32_t numOfTable; // unit is TSDB_TABLE_NUM_UNIT
|
int32_t numOfTable; // unit is TSDB_TABLE_NUM_UNIT
|
||||||
|
int64_t stateTs; // ms
|
||||||
} SUseDbReq;
|
} SUseDbReq;
|
||||||
|
|
||||||
int32_t tSerializeSUseDbReq(void* buf, int32_t bufLen, SUseDbReq* pReq);
|
int32_t tSerializeSUseDbReq(void* buf, int32_t bufLen, SUseDbReq* pReq);
|
||||||
|
@ -853,6 +854,8 @@ typedef struct {
|
||||||
int16_t hashSuffix;
|
int16_t hashSuffix;
|
||||||
int8_t hashMethod;
|
int8_t hashMethod;
|
||||||
SArray* pVgroupInfos; // Array of SVgroupInfo
|
SArray* pVgroupInfos; // Array of SVgroupInfo
|
||||||
|
int32_t errCode;
|
||||||
|
int64_t stateTs; // ms
|
||||||
} SUseDbRsp;
|
} SUseDbRsp;
|
||||||
|
|
||||||
int32_t tSerializeSUseDbRsp(void* buf, int32_t bufLen, const SUseDbRsp* pRsp);
|
int32_t tSerializeSUseDbRsp(void* buf, int32_t bufLen, const SUseDbRsp* pRsp);
|
||||||
|
@ -1128,6 +1131,7 @@ typedef struct {
|
||||||
SQnodeLoad qload;
|
SQnodeLoad qload;
|
||||||
SClusterCfg clusterCfg;
|
SClusterCfg clusterCfg;
|
||||||
SArray* pVloads; // array of SVnodeLoad
|
SArray* pVloads; // array of SVnodeLoad
|
||||||
|
int32_t statusSeq;
|
||||||
} SStatusReq;
|
} SStatusReq;
|
||||||
|
|
||||||
int32_t tSerializeSStatusReq(void* buf, int32_t bufLen, SStatusReq* pReq);
|
int32_t tSerializeSStatusReq(void* buf, int32_t bufLen, SStatusReq* pReq);
|
||||||
|
@ -1149,6 +1153,7 @@ typedef struct {
|
||||||
int64_t dnodeVer;
|
int64_t dnodeVer;
|
||||||
SDnodeCfg dnodeCfg;
|
SDnodeCfg dnodeCfg;
|
||||||
SArray* pDnodeEps; // Array of SDnodeEp
|
SArray* pDnodeEps; // Array of SDnodeEp
|
||||||
|
int32_t statusSeq;
|
||||||
} SStatusRsp;
|
} SStatusRsp;
|
||||||
|
|
||||||
int32_t tSerializeSStatusRsp(void* buf, int32_t bufLen, SStatusRsp* pRsp);
|
int32_t tSerializeSStatusRsp(void* buf, int32_t bufLen, SStatusRsp* pRsp);
|
||||||
|
@ -1610,6 +1615,7 @@ typedef struct SSubQueryMsg {
|
||||||
int8_t needFetch;
|
int8_t needFetch;
|
||||||
uint32_t sqlLen; // the query sql,
|
uint32_t sqlLen; // the query sql,
|
||||||
uint32_t phyLen;
|
uint32_t phyLen;
|
||||||
|
int32_t msgMask;
|
||||||
char msg[];
|
char msg[];
|
||||||
} SSubQueryMsg;
|
} SSubQueryMsg;
|
||||||
|
|
||||||
|
@ -1800,7 +1806,7 @@ int32_t tDeserializeSCMCreateTopicRsp(void* buf, int32_t bufLen, SCMCreateTopicR
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int64_t consumerId;
|
int64_t consumerId;
|
||||||
} SMqConsumerLostMsg, SMqConsumerRecoverMsg;
|
} SMqConsumerLostMsg, SMqConsumerRecoverMsg, SMqConsumerClearMsg;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int64_t consumerId;
|
int64_t consumerId;
|
||||||
|
@ -3131,7 +3137,8 @@ int32_t tEncodeDeleteRes(SEncoder* pCoder, const SDeleteRes* pRes);
|
||||||
int32_t tDecodeDeleteRes(SDecoder* pCoder, SDeleteRes* pRes);
|
int32_t tDecodeDeleteRes(SDecoder* pCoder, SDeleteRes* pRes);
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int64_t uid;
|
// int64_t uid;
|
||||||
|
char tbname[TSDB_TABLE_NAME_LEN];
|
||||||
int64_t ts;
|
int64_t ts;
|
||||||
} SSingleDeleteReq;
|
} SSingleDeleteReq;
|
||||||
|
|
||||||
|
|
|
@ -149,7 +149,7 @@ enum {
|
||||||
TD_DEF_MSG_TYPE(TDMT_MND_TMQ_DO_REBALANCE, "do-rebalance", SMqDoRebalanceMsg, NULL)
|
TD_DEF_MSG_TYPE(TDMT_MND_TMQ_DO_REBALANCE, "do-rebalance", SMqDoRebalanceMsg, NULL)
|
||||||
TD_DEF_MSG_TYPE(TDMT_MND_TMQ_DROP_CGROUP, "drop-cgroup", SMqDropCGroupReq, SMqDropCGroupRsp)
|
TD_DEF_MSG_TYPE(TDMT_MND_TMQ_DROP_CGROUP, "drop-cgroup", SMqDropCGroupReq, SMqDropCGroupRsp)
|
||||||
TD_DEF_MSG_TYPE(TDMT_MND_UNUSED2, "unused2", NULL, NULL)
|
TD_DEF_MSG_TYPE(TDMT_MND_UNUSED2, "unused2", NULL, NULL)
|
||||||
TD_DEF_MSG_TYPE(TDMT_MND_TMQ_TIMER, "mq-tmr", SMTimerReq, NULL)
|
TD_DEF_MSG_TYPE(TDMT_MND_TMQ_TIMER, "tmq-tmr", SMTimerReq, NULL)
|
||||||
TD_DEF_MSG_TYPE(TDMT_MND_TELEM_TIMER, "telem-tmr", SMTimerReq, SMTimerReq)
|
TD_DEF_MSG_TYPE(TDMT_MND_TELEM_TIMER, "telem-tmr", SMTimerReq, SMTimerReq)
|
||||||
TD_DEF_MSG_TYPE(TDMT_MND_TRANS_TIMER, "trans-tmr", NULL, NULL)
|
TD_DEF_MSG_TYPE(TDMT_MND_TRANS_TIMER, "trans-tmr", NULL, NULL)
|
||||||
TD_DEF_MSG_TYPE(TDMT_MND_TTL_TIMER, "ttl-tmr", NULL, NULL)
|
TD_DEF_MSG_TYPE(TDMT_MND_TTL_TIMER, "ttl-tmr", NULL, NULL)
|
||||||
|
@ -171,6 +171,7 @@ enum {
|
||||||
TD_DEF_MSG_TYPE(TDMT_MND_SHOW_VARIABLES, "show-variables", NULL, NULL)
|
TD_DEF_MSG_TYPE(TDMT_MND_SHOW_VARIABLES, "show-variables", NULL, NULL)
|
||||||
TD_DEF_MSG_TYPE(TDMT_MND_SERVER_VERSION, "server-version", NULL, NULL)
|
TD_DEF_MSG_TYPE(TDMT_MND_SERVER_VERSION, "server-version", NULL, NULL)
|
||||||
TD_DEF_MSG_TYPE(TDMT_MND_UPTIME_TIMER, "uptime-timer", NULL, NULL)
|
TD_DEF_MSG_TYPE(TDMT_MND_UPTIME_TIMER, "uptime-timer", NULL, NULL)
|
||||||
|
TD_DEF_MSG_TYPE(TDMT_MND_TMQ_LOST_CONSUMER_CLEAR, "lost-consumer-clear", NULL, NULL)
|
||||||
TD_DEF_MSG_TYPE(TDMT_MND_MAX_MSG, "mnd-max", NULL, NULL)
|
TD_DEF_MSG_TYPE(TDMT_MND_MAX_MSG, "mnd-max", NULL, NULL)
|
||||||
|
|
||||||
TD_NEW_MSG_SEG(TDMT_VND_MSG)
|
TD_NEW_MSG_SEG(TDMT_VND_MSG)
|
||||||
|
@ -241,6 +242,7 @@ enum {
|
||||||
TD_DEF_MSG_TYPE(TDMT_STREAM_UNUSED1, "stream-unused1", NULL, NULL)
|
TD_DEF_MSG_TYPE(TDMT_STREAM_UNUSED1, "stream-unused1", NULL, NULL)
|
||||||
TD_DEF_MSG_TYPE(TDMT_STREAM_RETRIEVE, "stream-retrieve", NULL, NULL)
|
TD_DEF_MSG_TYPE(TDMT_STREAM_RETRIEVE, "stream-retrieve", NULL, NULL)
|
||||||
TD_DEF_MSG_TYPE(TDMT_STREAM_RECOVER_FINISH, "vnode-stream-finish", NULL, NULL)
|
TD_DEF_MSG_TYPE(TDMT_STREAM_RECOVER_FINISH, "vnode-stream-finish", NULL, NULL)
|
||||||
|
TD_DEF_MSG_TYPE(TDMT_STREAM_TASK_CHECK, "vnode-stream-task-check", NULL, NULL)
|
||||||
TD_DEF_MSG_TYPE(TDMT_STREAM_MAX_MSG, "stream-max", NULL, NULL)
|
TD_DEF_MSG_TYPE(TDMT_STREAM_MAX_MSG, "stream-max", NULL, NULL)
|
||||||
|
|
||||||
TD_NEW_MSG_SEG(TDMT_MON_MSG)
|
TD_NEW_MSG_SEG(TDMT_MON_MSG)
|
||||||
|
@ -262,8 +264,8 @@ enum {
|
||||||
TD_DEF_MSG_TYPE(TDMT_SYNC_UNKNOWN, "sync-unknown", NULL, NULL)
|
TD_DEF_MSG_TYPE(TDMT_SYNC_UNKNOWN, "sync-unknown", NULL, NULL)
|
||||||
TD_DEF_MSG_TYPE(TDMT_SYNC_COMMON_RESPONSE, "sync-common-response", NULL, NULL)
|
TD_DEF_MSG_TYPE(TDMT_SYNC_COMMON_RESPONSE, "sync-common-response", NULL, NULL)
|
||||||
TD_DEF_MSG_TYPE(TDMT_SYNC_APPLY_MSG, "sync-apply-msg", NULL, NULL)
|
TD_DEF_MSG_TYPE(TDMT_SYNC_APPLY_MSG, "sync-apply-msg", NULL, NULL)
|
||||||
TD_DEF_MSG_TYPE(TDMT_SYNC_CONFIG_CHANGE, "sync-config-change", NULL, NULL)
|
TD_DEF_MSG_TYPE(TDMT_SYNC_CONFIG_CHANGE, "sync-config-change", NULL, NULL) // no longer used
|
||||||
TD_DEF_MSG_TYPE(TDMT_SYNC_CONFIG_CHANGE_FINISH, "sync-config-change-finish", NULL, NULL)
|
TD_DEF_MSG_TYPE(TDMT_SYNC_CONFIG_CHANGE_FINISH, "sync-config-change-finish", NULL, NULL) // no longer used
|
||||||
TD_DEF_MSG_TYPE(TDMT_SYNC_SNAPSHOT_SEND, "sync-snapshot-send", NULL, NULL)
|
TD_DEF_MSG_TYPE(TDMT_SYNC_SNAPSHOT_SEND, "sync-snapshot-send", NULL, NULL)
|
||||||
TD_DEF_MSG_TYPE(TDMT_SYNC_SNAPSHOT_RSP, "sync-snapshot-rsp", NULL, NULL)
|
TD_DEF_MSG_TYPE(TDMT_SYNC_SNAPSHOT_RSP, "sync-snapshot-rsp", NULL, NULL)
|
||||||
TD_DEF_MSG_TYPE(TDMT_SYNC_LEADER_TRANSFER, "sync-leader-transfer", NULL, NULL)
|
TD_DEF_MSG_TYPE(TDMT_SYNC_LEADER_TRANSFER, "sync-leader-transfer", NULL, NULL)
|
||||||
|
@ -272,6 +274,8 @@ enum {
|
||||||
TD_DEF_MSG_TYPE(TDMT_SYNC_HEARTBEAT, "sync-heartbeat", NULL, NULL)
|
TD_DEF_MSG_TYPE(TDMT_SYNC_HEARTBEAT, "sync-heartbeat", NULL, NULL)
|
||||||
TD_DEF_MSG_TYPE(TDMT_SYNC_HEARTBEAT_REPLY, "sync-heartbeat-reply", NULL, NULL)
|
TD_DEF_MSG_TYPE(TDMT_SYNC_HEARTBEAT_REPLY, "sync-heartbeat-reply", NULL, NULL)
|
||||||
TD_DEF_MSG_TYPE(TDMT_SYNC_LOCAL_CMD, "sync-local-cmd", NULL, NULL)
|
TD_DEF_MSG_TYPE(TDMT_SYNC_LOCAL_CMD, "sync-local-cmd", NULL, NULL)
|
||||||
|
TD_DEF_MSG_TYPE(TDMT_SYNC_PRE_SNAPSHOT, "sync-pre-snapshot", NULL, NULL)
|
||||||
|
TD_DEF_MSG_TYPE(TDMT_SYNC_PRE_SNAPSHOT_REPLY, "sync-pre-snapshot-reply", NULL, NULL)
|
||||||
TD_DEF_MSG_TYPE(TDMT_SYNC_MAX_MSG, "sync-max", NULL, NULL)
|
TD_DEF_MSG_TYPE(TDMT_SYNC_MAX_MSG, "sync-max", NULL, NULL)
|
||||||
|
|
||||||
TD_NEW_MSG_SEG(TDMT_VND_STREAM_MSG)
|
TD_NEW_MSG_SEG(TDMT_VND_STREAM_MSG)
|
||||||
|
|
|
@ -174,61 +174,61 @@
|
||||||
#define TK_SUBSCRIPTIONS 156
|
#define TK_SUBSCRIPTIONS 156
|
||||||
#define TK_VNODES 157
|
#define TK_VNODES 157
|
||||||
#define TK_LIKE 158
|
#define TK_LIKE 158
|
||||||
#define TK_INDEX 159
|
#define TK_TBNAME 159
|
||||||
#define TK_FUNCTION 160
|
#define TK_QTAGS 160
|
||||||
#define TK_INTERVAL 161
|
#define TK_AS 161
|
||||||
#define TK_TOPIC 162
|
#define TK_INDEX 162
|
||||||
#define TK_AS 163
|
#define TK_FUNCTION 163
|
||||||
#define TK_WITH 164
|
#define TK_INTERVAL 164
|
||||||
#define TK_META 165
|
#define TK_TOPIC 165
|
||||||
#define TK_CONSUMER 166
|
#define TK_WITH 166
|
||||||
#define TK_GROUP 167
|
#define TK_META 167
|
||||||
#define TK_DESC 168
|
#define TK_CONSUMER 168
|
||||||
#define TK_DESCRIBE 169
|
#define TK_GROUP 169
|
||||||
#define TK_RESET 170
|
#define TK_DESC 170
|
||||||
#define TK_QUERY 171
|
#define TK_DESCRIBE 171
|
||||||
#define TK_CACHE 172
|
#define TK_RESET 172
|
||||||
#define TK_EXPLAIN 173
|
#define TK_QUERY 173
|
||||||
#define TK_ANALYZE 174
|
#define TK_CACHE 174
|
||||||
#define TK_VERBOSE 175
|
#define TK_EXPLAIN 175
|
||||||
#define TK_NK_BOOL 176
|
#define TK_ANALYZE 176
|
||||||
#define TK_RATIO 177
|
#define TK_VERBOSE 177
|
||||||
#define TK_NK_FLOAT 178
|
#define TK_NK_BOOL 178
|
||||||
#define TK_OUTPUTTYPE 179
|
#define TK_RATIO 179
|
||||||
#define TK_AGGREGATE 180
|
#define TK_NK_FLOAT 180
|
||||||
#define TK_BUFSIZE 181
|
#define TK_OUTPUTTYPE 181
|
||||||
#define TK_STREAM 182
|
#define TK_AGGREGATE 182
|
||||||
#define TK_INTO 183
|
#define TK_BUFSIZE 183
|
||||||
#define TK_TRIGGER 184
|
#define TK_STREAM 184
|
||||||
#define TK_AT_ONCE 185
|
#define TK_INTO 185
|
||||||
#define TK_WINDOW_CLOSE 186
|
#define TK_TRIGGER 186
|
||||||
#define TK_IGNORE 187
|
#define TK_AT_ONCE 187
|
||||||
#define TK_EXPIRED 188
|
#define TK_WINDOW_CLOSE 188
|
||||||
#define TK_FILL_HISTORY 189
|
#define TK_IGNORE 189
|
||||||
#define TK_SUBTABLE 190
|
#define TK_EXPIRED 190
|
||||||
#define TK_KILL 191
|
#define TK_FILL_HISTORY 191
|
||||||
#define TK_CONNECTION 192
|
#define TK_SUBTABLE 192
|
||||||
#define TK_TRANSACTION 193
|
#define TK_KILL 193
|
||||||
#define TK_BALANCE 194
|
#define TK_CONNECTION 194
|
||||||
#define TK_VGROUP 195
|
#define TK_TRANSACTION 195
|
||||||
#define TK_MERGE 196
|
#define TK_BALANCE 196
|
||||||
#define TK_REDISTRIBUTE 197
|
#define TK_VGROUP 197
|
||||||
#define TK_SPLIT 198
|
#define TK_MERGE 198
|
||||||
#define TK_DELETE 199
|
#define TK_REDISTRIBUTE 199
|
||||||
#define TK_INSERT 200
|
#define TK_SPLIT 200
|
||||||
#define TK_NULL 201
|
#define TK_DELETE 201
|
||||||
#define TK_NK_QUESTION 202
|
#define TK_INSERT 202
|
||||||
#define TK_NK_ARROW 203
|
#define TK_NULL 203
|
||||||
#define TK_ROWTS 204
|
#define TK_NK_QUESTION 204
|
||||||
#define TK_TBNAME 205
|
#define TK_NK_ARROW 205
|
||||||
#define TK_QSTART 206
|
#define TK_ROWTS 206
|
||||||
#define TK_QEND 207
|
#define TK_QSTART 207
|
||||||
#define TK_QDURATION 208
|
#define TK_QEND 208
|
||||||
#define TK_WSTART 209
|
#define TK_QDURATION 209
|
||||||
#define TK_WEND 210
|
#define TK_WSTART 210
|
||||||
#define TK_WDURATION 211
|
#define TK_WEND 211
|
||||||
#define TK_IROWTS 212
|
#define TK_WDURATION 212
|
||||||
#define TK_QTAGS 213
|
#define TK_IROWTS 213
|
||||||
#define TK_CAST 214
|
#define TK_CAST 214
|
||||||
#define TK_NOW 215
|
#define TK_NOW 215
|
||||||
#define TK_TODAY 216
|
#define TK_TODAY 216
|
||||||
|
|
|
@ -56,6 +56,7 @@ typedef struct SDbInfo {
|
||||||
int32_t vgVer;
|
int32_t vgVer;
|
||||||
int32_t tbNum;
|
int32_t tbNum;
|
||||||
int64_t dbId;
|
int64_t dbId;
|
||||||
|
int64_t stateTs;
|
||||||
} SDbInfo;
|
} SDbInfo;
|
||||||
|
|
||||||
typedef struct STablesReq {
|
typedef struct STablesReq {
|
||||||
|
@ -124,6 +125,7 @@ typedef struct SDbVgVersion {
|
||||||
int64_t dbId;
|
int64_t dbId;
|
||||||
int32_t vgVersion;
|
int32_t vgVersion;
|
||||||
int32_t numOfTable; // unit is TSDB_TABLE_NUM_UNIT
|
int32_t numOfTable; // unit is TSDB_TABLE_NUM_UNIT
|
||||||
|
int64_t stateTs;
|
||||||
} SDbVgVersion;
|
} SDbVgVersion;
|
||||||
|
|
||||||
typedef struct STbSVersion {
|
typedef struct STbSVersion {
|
||||||
|
@ -152,7 +154,7 @@ int32_t catalogInit(SCatalogCfg* cfg);
|
||||||
*/
|
*/
|
||||||
int32_t catalogGetHandle(uint64_t clusterId, SCatalog** catalogHandle);
|
int32_t catalogGetHandle(uint64_t clusterId, SCatalog** catalogHandle);
|
||||||
|
|
||||||
int32_t catalogGetDBVgVersion(SCatalog* pCtg, const char* dbFName, int32_t* version, int64_t* dbId, int32_t* tableNum);
|
int32_t catalogGetDBVgVersion(SCatalog* pCtg, const char* dbFName, int32_t* version, int64_t* dbId, int32_t* tableNum, int64_t* stateTs);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a DB's all vgroup info.
|
* Get a DB's all vgroup info.
|
||||||
|
@ -203,13 +205,11 @@ int32_t catalogUpdateTableMeta(SCatalog* pCatalog, STableMetaRsp* rspMsg);
|
||||||
|
|
||||||
int32_t catalogUpdateTableMeta(SCatalog* pCatalog, STableMetaRsp* rspMsg);
|
int32_t catalogUpdateTableMeta(SCatalog* pCatalog, STableMetaRsp* rspMsg);
|
||||||
|
|
||||||
int32_t catalogGetCachedTableMeta(SCatalog* pCtg, SRequestConnInfo* pConn, const SName* pTableName, STableMeta** pTableMeta);
|
int32_t catalogGetCachedTableMeta(SCatalog* pCtg, const SName* pTableName, STableMeta** pTableMeta);
|
||||||
|
|
||||||
int32_t catalogGetCachedSTableMeta(SCatalog* pCtg, SRequestConnInfo* pConn, const SName* pTableName,
|
int32_t catalogGetCachedSTableMeta(SCatalog* pCtg, const SName* pTableName, STableMeta** pTableMeta);
|
||||||
STableMeta** pTableMeta);
|
|
||||||
|
|
||||||
int32_t catalogGetCachedTableHashVgroup(SCatalog* pCtg, SRequestConnInfo* pConn, const SName* pTableName,
|
int32_t catalogGetCachedTableHashVgroup(SCatalog* pCtg, const SName* pTableName, SVgroupInfo* pVgroup, bool* exists);
|
||||||
SVgroupInfo* pVgroup, bool* exists);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Force refresh DB's local cached vgroup info.
|
* Force refresh DB's local cached vgroup info.
|
||||||
|
@ -309,8 +309,8 @@ int32_t catalogGetUdfInfo(SCatalog* pCtg, SRequestConnInfo* pConn, const char* f
|
||||||
int32_t catalogChkAuth(SCatalog* pCtg, SRequestConnInfo* pConn, const char* user, const char* dbFName, AUTH_TYPE type,
|
int32_t catalogChkAuth(SCatalog* pCtg, SRequestConnInfo* pConn, const char* user, const char* dbFName, AUTH_TYPE type,
|
||||||
bool* pass);
|
bool* pass);
|
||||||
|
|
||||||
int32_t catalogChkAuthFromCache(SCatalog* pCtg, SRequestConnInfo* pConn, const char* user, const char* dbFName, AUTH_TYPE type,
|
int32_t catalogChkAuthFromCache(SCatalog* pCtg, const char* user, const char* dbFName, AUTH_TYPE type, bool* pass,
|
||||||
bool* pass, bool* exists);
|
bool* exists);
|
||||||
|
|
||||||
int32_t catalogUpdateUserAuthInfo(SCatalog* pCtg, SGetUserAuthRsp* pAuth);
|
int32_t catalogUpdateUserAuthInfo(SCatalog* pCtg, SGetUserAuthRsp* pAuth);
|
||||||
|
|
||||||
|
@ -326,6 +326,10 @@ SMetaData* catalogCloneMetaData(SMetaData* pData);
|
||||||
|
|
||||||
void catalogFreeMetaData(SMetaData* pData);
|
void catalogFreeMetaData(SMetaData* pData);
|
||||||
|
|
||||||
|
int32_t ctgdEnableDebug(char* option, bool enable);
|
||||||
|
|
||||||
|
int32_t ctgdHandleDbgCommand(char* command);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destroy catalog and relase all resources
|
* Destroy catalog and relase all resources
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -182,7 +182,7 @@ struct SScalarParam {
|
||||||
};
|
};
|
||||||
|
|
||||||
void cleanupResultRowEntry(struct SResultRowEntryInfo *pCell);
|
void cleanupResultRowEntry(struct SResultRowEntryInfo *pCell);
|
||||||
int32_t getNumOfResult(SqlFunctionCtx *pCtx, int32_t num, SSDataBlock *pResBlock);
|
//int32_t getNumOfResult(SqlFunctionCtx *pCtx, int32_t num, SSDataBlock *pResBlock);
|
||||||
bool isRowEntryCompleted(struct SResultRowEntryInfo *pEntry);
|
bool isRowEntryCompleted(struct SResultRowEntryInfo *pEntry);
|
||||||
bool isRowEntryInitialized(struct SResultRowEntryInfo *pEntry);
|
bool isRowEntryInitialized(struct SResultRowEntryInfo *pEntry);
|
||||||
|
|
||||||
|
|
|
@ -224,7 +224,7 @@ int32_t fmGetDistMethod(const SFunctionNode* pFunc, SFunctionNode** pPartialFunc
|
||||||
|
|
||||||
typedef enum EFuncDataRequired {
|
typedef enum EFuncDataRequired {
|
||||||
FUNC_DATA_REQUIRED_DATA_LOAD = 1,
|
FUNC_DATA_REQUIRED_DATA_LOAD = 1,
|
||||||
FUNC_DATA_REQUIRED_STATIS_LOAD,
|
FUNC_DATA_REQUIRED_SMA_LOAD,
|
||||||
FUNC_DATA_REQUIRED_NOT_LOAD,
|
FUNC_DATA_REQUIRED_NOT_LOAD,
|
||||||
FUNC_DATA_REQUIRED_FILTEROUT,
|
FUNC_DATA_REQUIRED_FILTEROUT,
|
||||||
} EFuncDataRequired;
|
} EFuncDataRequired;
|
||||||
|
|
|
@ -284,6 +284,13 @@ typedef struct SShowVnodesStmt {
|
||||||
SNode* pDnodeEndpoint;
|
SNode* pDnodeEndpoint;
|
||||||
} SShowVnodesStmt;
|
} SShowVnodesStmt;
|
||||||
|
|
||||||
|
typedef struct SShowTableTagsStmt {
|
||||||
|
ENodeType type;
|
||||||
|
SNode* pDbName; // SValueNode
|
||||||
|
SNode* pTbName; // SValueNode
|
||||||
|
SNodeList* pTags;
|
||||||
|
} SShowTableTagsStmt;
|
||||||
|
|
||||||
typedef enum EIndexType { INDEX_TYPE_SMA = 1, INDEX_TYPE_FULLTEXT } EIndexType;
|
typedef enum EIndexType { INDEX_TYPE_SMA = 1, INDEX_TYPE_FULLTEXT } EIndexType;
|
||||||
|
|
||||||
typedef struct SIndexOptions {
|
typedef struct SIndexOptions {
|
||||||
|
|
|
@ -297,6 +297,7 @@ typedef struct SSelectStmt {
|
||||||
bool hasStateKey;
|
bool hasStateKey;
|
||||||
bool onlyHasKeepOrderFunc;
|
bool onlyHasKeepOrderFunc;
|
||||||
bool groupSort;
|
bool groupSort;
|
||||||
|
bool tagScan;
|
||||||
} SSelectStmt;
|
} SSelectStmt;
|
||||||
|
|
||||||
typedef enum ESetOperatorType { SET_OP_TYPE_UNION_ALL = 1, SET_OP_TYPE_UNION } ESetOperatorType;
|
typedef enum ESetOperatorType { SET_OP_TYPE_UNION_ALL = 1, SET_OP_TYPE_UNION } ESetOperatorType;
|
||||||
|
@ -354,12 +355,33 @@ typedef struct SVgDataBlocks {
|
||||||
void* pData; // SMsgDesc + SSubmitReq + SSubmitBlk + ...
|
void* pData; // SMsgDesc + SSubmitReq + SSubmitBlk + ...
|
||||||
} SVgDataBlocks;
|
} SVgDataBlocks;
|
||||||
|
|
||||||
|
typedef void (*FFreeDataBlockHash)(SHashObj*);
|
||||||
|
typedef void (*FFreeDataBlockArray)(SArray*);
|
||||||
|
|
||||||
typedef struct SVnodeModifOpStmt {
|
typedef struct SVnodeModifOpStmt {
|
||||||
ENodeType nodeType;
|
ENodeType nodeType;
|
||||||
ENodeType sqlNodeType;
|
ENodeType sqlNodeType;
|
||||||
SArray* pDataBlocks; // data block for each vgroup, SArray<SVgDataBlocks*>.
|
SArray* pDataBlocks; // data block for each vgroup, SArray<SVgDataBlocks*>.
|
||||||
uint32_t insertType; // insert data from [file|sql statement| bound statement]
|
uint32_t insertType; // insert data from [file|sql statement| bound statement]
|
||||||
const char* sql; // current sql statement position
|
const char* pSql; // current sql statement position
|
||||||
|
int32_t totalRowsNum;
|
||||||
|
int32_t totalTbNum;
|
||||||
|
SName targetTableName;
|
||||||
|
SName usingTableName;
|
||||||
|
const char* pBoundCols;
|
||||||
|
struct STableMeta* pTableMeta;
|
||||||
|
SHashObj* pVgroupsHashObj;
|
||||||
|
SHashObj* pTableBlockHashObj;
|
||||||
|
SHashObj* pSubTableHashObj;
|
||||||
|
SHashObj* pTableNameHashObj;
|
||||||
|
SHashObj* pDbFNameHashObj;
|
||||||
|
SArray* pVgDataBlocks;
|
||||||
|
SVCreateTbReq createTblReq;
|
||||||
|
TdFilePtr fp;
|
||||||
|
FFreeDataBlockHash freeHashFunc;
|
||||||
|
FFreeDataBlockArray freeArrayFunc;
|
||||||
|
bool usingTableProcessing;
|
||||||
|
bool fileProcessing;
|
||||||
} SVnodeModifOpStmt;
|
} SVnodeModifOpStmt;
|
||||||
|
|
||||||
typedef struct SExplainOptions {
|
typedef struct SExplainOptions {
|
||||||
|
@ -389,24 +411,32 @@ typedef enum EQueryExecMode {
|
||||||
QUERY_EXEC_MODE_EMPTY_RESULT
|
QUERY_EXEC_MODE_EMPTY_RESULT
|
||||||
} EQueryExecMode;
|
} EQueryExecMode;
|
||||||
|
|
||||||
|
typedef enum EQueryExecStage {
|
||||||
|
QUERY_EXEC_STAGE_PARSE = 1,
|
||||||
|
QUERY_EXEC_STAGE_ANALYSE,
|
||||||
|
QUERY_EXEC_STAGE_SCHEDULE,
|
||||||
|
QUERY_EXEC_STAGE_END
|
||||||
|
} EQueryExecStage;
|
||||||
|
|
||||||
typedef struct SQuery {
|
typedef struct SQuery {
|
||||||
ENodeType type;
|
ENodeType type;
|
||||||
EQueryExecMode execMode;
|
EQueryExecStage execStage;
|
||||||
bool haveResultSet;
|
EQueryExecMode execMode;
|
||||||
SNode* pRoot;
|
bool haveResultSet;
|
||||||
int32_t numOfResCols;
|
SNode* pRoot;
|
||||||
SSchema* pResSchema;
|
int32_t numOfResCols;
|
||||||
int8_t precision;
|
SSchema* pResSchema;
|
||||||
SCmdMsgInfo* pCmdMsg;
|
int8_t precision;
|
||||||
int32_t msgType;
|
SCmdMsgInfo* pCmdMsg;
|
||||||
SArray* pTargetTableList;
|
int32_t msgType;
|
||||||
SArray* pTableList;
|
SArray* pTargetTableList;
|
||||||
SArray* pDbList;
|
SArray* pTableList;
|
||||||
bool showRewrite;
|
SArray* pDbList;
|
||||||
int32_t placeholderNum;
|
bool showRewrite;
|
||||||
SArray* pPlaceholderValues;
|
int32_t placeholderNum;
|
||||||
SNode* pPrepareRoot;
|
SArray* pPlaceholderValues;
|
||||||
bool stableQuery;
|
SNode* pPrepareRoot;
|
||||||
|
bool stableQuery;
|
||||||
} SQuery;
|
} SQuery;
|
||||||
|
|
||||||
void nodesWalkSelectStmt(SSelectStmt* pSelect, ESqlClause clause, FNodeWalker walker, void* pContext);
|
void nodesWalkSelectStmt(SSelectStmt* pSelect, ESqlClause clause, FNodeWalker walker, void* pContext);
|
||||||
|
|
|
@ -64,8 +64,6 @@ typedef struct SParseContext {
|
||||||
SArray* pTableMetaPos; // sql table pos => catalog data pos
|
SArray* pTableMetaPos; // sql table pos => catalog data pos
|
||||||
SArray* pTableVgroupPos; // sql table pos => catalog data pos
|
SArray* pTableVgroupPos; // sql table pos => catalog data pos
|
||||||
int64_t allocatorId;
|
int64_t allocatorId;
|
||||||
bool needMultiParse;
|
|
||||||
SParseCsvCxt csvCxt;
|
|
||||||
} SParseContext;
|
} SParseContext;
|
||||||
|
|
||||||
int32_t qParseSql(SParseContext* pCxt, SQuery** pQuery);
|
int32_t qParseSql(SParseContext* pCxt, SQuery** pQuery);
|
||||||
|
@ -75,6 +73,8 @@ bool qIsInsertValuesSql(const char* pStr, size_t length);
|
||||||
int32_t qParseSqlSyntax(SParseContext* pCxt, SQuery** pQuery, struct SCatalogReq* pCatalogReq);
|
int32_t qParseSqlSyntax(SParseContext* pCxt, SQuery** pQuery, struct SCatalogReq* pCatalogReq);
|
||||||
int32_t qAnalyseSqlSemantic(SParseContext* pCxt, const struct SCatalogReq* pCatalogReq,
|
int32_t qAnalyseSqlSemantic(SParseContext* pCxt, const struct SCatalogReq* pCatalogReq,
|
||||||
const struct SMetaData* pMetaData, SQuery* pQuery);
|
const struct SMetaData* pMetaData, SQuery* pQuery);
|
||||||
|
int32_t qContinueParseSql(SParseContext* pCxt, struct SCatalogReq* pCatalogReq, const struct SMetaData* pMetaData,
|
||||||
|
SQuery* pQuery);
|
||||||
|
|
||||||
void qDestroyParseContext(SParseContext* pCxt);
|
void qDestroyParseContext(SParseContext* pCxt);
|
||||||
|
|
||||||
|
|
|
@ -57,6 +57,10 @@ typedef enum {
|
||||||
#define QUERY_RSP_POLICY_DELAY 0
|
#define QUERY_RSP_POLICY_DELAY 0
|
||||||
#define QUERY_RSP_POLICY_QUICK 1
|
#define QUERY_RSP_POLICY_QUICK 1
|
||||||
|
|
||||||
|
#define QUERY_MSG_MASK_SHOW_REWRITE() (1 << 0)
|
||||||
|
#define TEST_SHOW_REWRITE_MASK(m) (((m) & QUERY_MSG_MASK_SHOW_REWRITE()) != 0)
|
||||||
|
|
||||||
|
|
||||||
typedef struct STableComInfo {
|
typedef struct STableComInfo {
|
||||||
uint8_t numOfTags; // the number of tags in schema
|
uint8_t numOfTags; // the number of tags in schema
|
||||||
uint8_t precision; // the number of precision
|
uint8_t precision; // the number of precision
|
||||||
|
@ -123,6 +127,7 @@ typedef struct SDBVgInfo {
|
||||||
int16_t hashSuffix;
|
int16_t hashSuffix;
|
||||||
int8_t hashMethod;
|
int8_t hashMethod;
|
||||||
int32_t numOfTable; // DB's table num, unit is TSDB_TABLE_NUM_UNIT
|
int32_t numOfTable; // DB's table num, unit is TSDB_TABLE_NUM_UNIT
|
||||||
|
int64_t stateTs;
|
||||||
SHashObj* vgHash; // key:vgId, value:SVgroupInfo
|
SHashObj* vgHash; // key:vgId, value:SVgroupInfo
|
||||||
} SDBVgInfo;
|
} SDBVgInfo;
|
||||||
|
|
||||||
|
@ -199,6 +204,8 @@ int32_t taosAsyncExec(__async_exec_fn_t execFn, void* execParam, int32_t* code);
|
||||||
|
|
||||||
void destroySendMsgInfo(SMsgSendInfo* pMsgBody);
|
void destroySendMsgInfo(SMsgSendInfo* pMsgBody);
|
||||||
|
|
||||||
|
void destroyAhandle(void* ahandle);
|
||||||
|
|
||||||
int32_t asyncSendMsgToServerExt(void* pTransporter, SEpSet* epSet, int64_t* pTransporterId, SMsgSendInfo* pInfo,
|
int32_t asyncSendMsgToServerExt(void* pTransporter, SEpSet* epSet, int64_t* pTransporterId, SMsgSendInfo* pInfo,
|
||||||
bool persistHandle, void* ctx);
|
bool persistHandle, void* ctx);
|
||||||
|
|
||||||
|
@ -242,13 +249,13 @@ extern int32_t (*queryProcessMsgRsp[TDMT_MAX])(void* output, char* msg, int32_t
|
||||||
#define SET_META_TYPE_BOTH_TABLE(t) (t) = META_TYPE_BOTH_TABLE
|
#define SET_META_TYPE_BOTH_TABLE(t) (t) = META_TYPE_BOTH_TABLE
|
||||||
|
|
||||||
#define NEED_CLIENT_RM_TBLMETA_ERROR(_code) \
|
#define NEED_CLIENT_RM_TBLMETA_ERROR(_code) \
|
||||||
((_code) == TSDB_CODE_PAR_TABLE_NOT_EXIST || (_code) == TSDB_CODE_VND_TB_NOT_EXIST || \
|
((_code) == TSDB_CODE_PAR_TABLE_NOT_EXIST || (_code) == TSDB_CODE_TDB_TABLE_NOT_EXIST || \
|
||||||
(_code) == TSDB_CODE_PAR_INVALID_COLUMNS_NUM || (_code) == TSDB_CODE_PAR_INVALID_COLUMN || \
|
(_code) == TSDB_CODE_PAR_INVALID_COLUMNS_NUM || (_code) == TSDB_CODE_PAR_INVALID_COLUMN || \
|
||||||
(_code) == TSDB_CODE_PAR_TAGS_NOT_MATCHED || (_code) == TSDB_CODE_PAR_VALUE_TOO_LONG || \
|
(_code) == TSDB_CODE_PAR_TAGS_NOT_MATCHED || (_code) == TSDB_CODE_PAR_VALUE_TOO_LONG || \
|
||||||
(_code) == TSDB_CODE_PAR_INVALID_DROP_COL || ((_code) == TSDB_CODE_TDB_INVALID_TABLE_ID))
|
(_code) == TSDB_CODE_PAR_INVALID_DROP_COL || ((_code) == TSDB_CODE_TDB_INVALID_TABLE_ID))
|
||||||
#define NEED_CLIENT_REFRESH_VG_ERROR(_code) \
|
#define NEED_CLIENT_REFRESH_VG_ERROR(_code) \
|
||||||
((_code) == TSDB_CODE_VND_HASH_MISMATCH || (_code) == TSDB_CODE_VND_INVALID_VGROUP_ID)
|
((_code) == TSDB_CODE_VND_HASH_MISMATCH || (_code) == TSDB_CODE_VND_INVALID_VGROUP_ID)
|
||||||
#define NEED_CLIENT_REFRESH_TBLMETA_ERROR(_code) ((_code) == TSDB_CODE_TDB_TABLE_RECREATED)
|
#define NEED_CLIENT_REFRESH_TBLMETA_ERROR(_code) ((_code) == TSDB_CODE_TDB_INVALID_TABLE_SCHEMA_VER)
|
||||||
#define NEED_CLIENT_HANDLE_ERROR(_code) \
|
#define NEED_CLIENT_HANDLE_ERROR(_code) \
|
||||||
(NEED_CLIENT_RM_TBLMETA_ERROR(_code) || NEED_CLIENT_REFRESH_VG_ERROR(_code) || \
|
(NEED_CLIENT_RM_TBLMETA_ERROR(_code) || NEED_CLIENT_REFRESH_VG_ERROR(_code) || \
|
||||||
NEED_CLIENT_REFRESH_TBLMETA_ERROR(_code))
|
NEED_CLIENT_REFRESH_TBLMETA_ERROR(_code))
|
||||||
|
|
|
@ -76,7 +76,7 @@ int32_t qWorkerInit(int8_t nodeType, int32_t nodeId, void **qWorkerMgmt, const S
|
||||||
|
|
||||||
int32_t qWorkerAbortPreprocessQueryMsg(void *qWorkerMgmt, SRpcMsg *pMsg);
|
int32_t qWorkerAbortPreprocessQueryMsg(void *qWorkerMgmt, SRpcMsg *pMsg);
|
||||||
|
|
||||||
int32_t qWorkerPreprocessQueryMsg(void *qWorkerMgmt, SRpcMsg *pMsg);
|
int32_t qWorkerPreprocessQueryMsg(void *qWorkerMgmt, SRpcMsg *pMsg, bool chkGrant);
|
||||||
|
|
||||||
int32_t qWorkerProcessQueryMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg, int64_t ts);
|
int32_t qWorkerProcessQueryMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg, int64_t ts);
|
||||||
|
|
||||||
|
|
|
@ -60,19 +60,19 @@ int32_t streamStateDel(SStreamState* pState, const SWinKey* key);
|
||||||
int32_t streamStateClear(SStreamState* pState);
|
int32_t streamStateClear(SStreamState* pState);
|
||||||
void streamStateSetNumber(SStreamState* pState, int32_t number);
|
void streamStateSetNumber(SStreamState* pState, int32_t number);
|
||||||
|
|
||||||
int32_t streamStateSessionAddIfNotExist(SStreamState* pState, SSessionKey* key, void** pVal, int32_t* pVLen);
|
int32_t streamStateSessionAddIfNotExist(SStreamState* pState, SSessionKey* key, TSKEY gap, void** pVal, int32_t* pVLen);
|
||||||
int32_t streamStateSessionPut(SStreamState* pState, const SSessionKey* key, const void* value, int32_t vLen);
|
int32_t streamStateSessionPut(SStreamState* pState, const SSessionKey* key, const void* value, int32_t vLen);
|
||||||
int32_t streamStateSessionGet(SStreamState* pState, SSessionKey* key, void** pVal, int32_t* pVLen);
|
int32_t streamStateSessionGet(SStreamState* pState, SSessionKey* key, void** pVal, int32_t* pVLen);
|
||||||
int32_t streamStateSessionDel(SStreamState* pState, const SSessionKey* key);
|
int32_t streamStateSessionDel(SStreamState* pState, const SSessionKey* key);
|
||||||
int32_t streamStateSessionClear(SStreamState* pState);
|
int32_t streamStateSessionClear(SStreamState* pState);
|
||||||
int32_t streamStateSessionGetKVByCur(SStreamStateCur* pCur, SSessionKey* pKey, const void** pVal, int32_t* pVLen);
|
int32_t streamStateSessionGetKVByCur(SStreamStateCur* pCur, SSessionKey* pKey, void** pVal, int32_t* pVLen);
|
||||||
int32_t streamStateStateAddIfNotExist(SStreamState* pState, SSessionKey* key, char* pKeyData, int32_t keyDataLen,
|
int32_t streamStateStateAddIfNotExist(SStreamState* pState, SSessionKey* key, char* pKeyData, int32_t keyDataLen,
|
||||||
state_key_cmpr_fn fn, void** pVal, int32_t* pVLen);
|
state_key_cmpr_fn fn, void** pVal, int32_t* pVLen);
|
||||||
int32_t streamStateSessionGetKey(SStreamState* pState, const SSessionKey* key, SSessionKey* curKey);
|
int32_t streamStateSessionGetKeyByRange(SStreamState* pState, const SSessionKey* range, SSessionKey* curKey);
|
||||||
|
|
||||||
SStreamStateCur* streamStateSessionSeekKeyNext(SStreamState* pState, const SSessionKey* key);
|
SStreamStateCur* streamStateSessionSeekKeyNext(SStreamState* pState, const SSessionKey* key);
|
||||||
SStreamStateCur* streamStateSessionSeekKeyCurrentPrev(SStreamState* pState, const SSessionKey* key);
|
SStreamStateCur* streamStateSessionSeekKeyCurrentPrev(SStreamState* pState, const SSessionKey* key);
|
||||||
SStreamStateCur* streamStateSessionGetCur(SStreamState* pState, const SSessionKey* key);
|
SStreamStateCur* streamStateSessionSeekKeyCurrentNext(SStreamState* pState, const SSessionKey* key);
|
||||||
|
|
||||||
int32_t streamStateFillPut(SStreamState* pState, const SWinKey* key, const void* value, int32_t vLen);
|
int32_t streamStateFillPut(SStreamState* pState, const SWinKey* key, const void* value, int32_t vLen);
|
||||||
int32_t streamStateFillGet(SStreamState* pState, const SWinKey* key, void** pVal, int32_t* pVLen);
|
int32_t streamStateFillGet(SStreamState* pState, const SWinKey* key, void** pVal, int32_t* pVLen);
|
||||||
|
@ -99,7 +99,9 @@ int32_t streamStateSeekLast(SStreamState* pState, SStreamStateCur* pCur);
|
||||||
int32_t streamStateCurNext(SStreamState* pState, SStreamStateCur* pCur);
|
int32_t streamStateCurNext(SStreamState* pState, SStreamStateCur* pCur);
|
||||||
int32_t streamStateCurPrev(SStreamState* pState, SStreamStateCur* pCur);
|
int32_t streamStateCurPrev(SStreamState* pState, SStreamStateCur* pCur);
|
||||||
|
|
||||||
// char* streamStateSessionDump(SStreamState* pState);
|
#if 0
|
||||||
|
char* streamStateSessionDump(SStreamState* pState);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ enum {
|
||||||
TASK_STATUS__DROPPING,
|
TASK_STATUS__DROPPING,
|
||||||
TASK_STATUS__FAIL,
|
TASK_STATUS__FAIL,
|
||||||
TASK_STATUS__STOP,
|
TASK_STATUS__STOP,
|
||||||
TASK_STATUS__RECOVER_DOWNSTREAM,
|
TASK_STATUS__WAIT_DOWNSTREAM,
|
||||||
TASK_STATUS__RECOVER_PREPARE,
|
TASK_STATUS__RECOVER_PREPARE,
|
||||||
TASK_STATUS__RECOVER1,
|
TASK_STATUS__RECOVER1,
|
||||||
TASK_STATUS__RECOVER2,
|
TASK_STATUS__RECOVER2,
|
||||||
|
@ -317,6 +317,8 @@ typedef struct SStreamTask {
|
||||||
int8_t inputStatus;
|
int8_t inputStatus;
|
||||||
int8_t outputStatus;
|
int8_t outputStatus;
|
||||||
|
|
||||||
|
// STaosQueue* inputQueue1;
|
||||||
|
// STaosQall* inputQall;
|
||||||
SStreamQueue* inputQueue;
|
SStreamQueue* inputQueue;
|
||||||
SStreamQueue* outputQueue;
|
SStreamQueue* outputQueue;
|
||||||
|
|
||||||
|
@ -332,7 +334,10 @@ typedef struct SStreamTask {
|
||||||
SStreamState* pState;
|
SStreamState* pState;
|
||||||
|
|
||||||
// do not serialize
|
// do not serialize
|
||||||
int32_t recoverWaitingChild;
|
int32_t recoverTryingDownstream;
|
||||||
|
int32_t recoverWaitingUpstream;
|
||||||
|
int64_t checkReqId;
|
||||||
|
SArray* checkReqIds; // shuffle
|
||||||
|
|
||||||
} SStreamTask;
|
} SStreamTask;
|
||||||
|
|
||||||
|
@ -418,7 +423,10 @@ typedef struct {
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int64_t streamId;
|
int64_t streamId;
|
||||||
int32_t taskId;
|
int32_t upstreamNodeId;
|
||||||
|
int32_t upstreamTaskId;
|
||||||
|
int32_t downstreamNodeId;
|
||||||
|
int32_t downstreamTaskId;
|
||||||
int8_t inputStatus;
|
int8_t inputStatus;
|
||||||
} SStreamDispatchRsp;
|
} SStreamDispatchRsp;
|
||||||
|
|
||||||
|
@ -440,6 +448,27 @@ typedef struct {
|
||||||
int32_t rspToTaskId;
|
int32_t rspToTaskId;
|
||||||
} SStreamRetrieveRsp;
|
} SStreamRetrieveRsp;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int64_t reqId;
|
||||||
|
int64_t streamId;
|
||||||
|
int32_t upstreamNodeId;
|
||||||
|
int32_t upstreamTaskId;
|
||||||
|
int32_t downstreamNodeId;
|
||||||
|
int32_t downstreamTaskId;
|
||||||
|
int32_t childId;
|
||||||
|
} SStreamTaskCheckReq;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int64_t reqId;
|
||||||
|
int64_t streamId;
|
||||||
|
int32_t upstreamNodeId;
|
||||||
|
int32_t upstreamTaskId;
|
||||||
|
int32_t downstreamNodeId;
|
||||||
|
int32_t downstreamTaskId;
|
||||||
|
int32_t childId;
|
||||||
|
int8_t status;
|
||||||
|
} SStreamTaskCheckRsp;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
SMsgHead msgHead;
|
SMsgHead msgHead;
|
||||||
int64_t streamId;
|
int64_t streamId;
|
||||||
|
@ -455,47 +484,6 @@ typedef struct {
|
||||||
int32_t tEncodeSStreamRecoverFinishReq(SEncoder* pEncoder, const SStreamRecoverFinishReq* pReq);
|
int32_t tEncodeSStreamRecoverFinishReq(SEncoder* pEncoder, const SStreamRecoverFinishReq* pReq);
|
||||||
int32_t tDecodeSStreamRecoverFinishReq(SDecoder* pDecoder, SStreamRecoverFinishReq* pReq);
|
int32_t tDecodeSStreamRecoverFinishReq(SDecoder* pDecoder, SStreamRecoverFinishReq* pReq);
|
||||||
|
|
||||||
#if 0
|
|
||||||
typedef struct {
|
|
||||||
int64_t streamId;
|
|
||||||
int32_t taskId;
|
|
||||||
int32_t upstreamTaskId;
|
|
||||||
int32_t upstreamNodeId;
|
|
||||||
} SStreamTaskRecoverReq;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
int64_t streamId;
|
|
||||||
int32_t rspTaskId;
|
|
||||||
int32_t reqTaskId;
|
|
||||||
int8_t inputStatus;
|
|
||||||
} SStreamTaskRecoverRsp;
|
|
||||||
|
|
||||||
int32_t tEncodeStreamTaskRecoverReq(SEncoder* pEncoder, const SStreamTaskRecoverReq* pReq);
|
|
||||||
int32_t tDecodeStreamTaskRecoverReq(SDecoder* pDecoder, SStreamTaskRecoverReq* pReq);
|
|
||||||
|
|
||||||
int32_t tEncodeStreamTaskRecoverRsp(SEncoder* pEncoder, const SStreamTaskRecoverRsp* pRsp);
|
|
||||||
int32_t tDecodeStreamTaskRecoverRsp(SDecoder* pDecoder, SStreamTaskRecoverRsp* pRsp);
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
int64_t streamId;
|
|
||||||
int32_t taskId;
|
|
||||||
} SMStreamTaskRecoverReq;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
int64_t streamId;
|
|
||||||
int32_t taskId;
|
|
||||||
} SMStreamTaskRecoverRsp;
|
|
||||||
|
|
||||||
int32_t tEncodeSMStreamTaskRecoverReq(SEncoder* pEncoder, const SMStreamTaskRecoverReq* pReq);
|
|
||||||
int32_t tDecodeSMStreamTaskRecoverReq(SDecoder* pDecoder, SMStreamTaskRecoverReq* pReq);
|
|
||||||
|
|
||||||
int32_t tEncodeSMStreamTaskRecoverRsp(SEncoder* pEncoder, const SMStreamTaskRecoverRsp* pRsp);
|
|
||||||
int32_t tDecodeSMStreamTaskRecoverRsp(SDecoder* pDecoder, SMStreamTaskRecoverRsp* pRsp);
|
|
||||||
|
|
||||||
int32_t streamProcessRecoverReq(SStreamTask* pTask, SStreamTaskRecoverReq* pReq, SRpcMsg* pMsg);
|
|
||||||
int32_t streamProcessRecoverRsp(SStreamTask* pTask, SStreamTaskRecoverRsp* pRsp);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int64_t streamId;
|
int64_t streamId;
|
||||||
int32_t downstreamTaskId;
|
int32_t downstreamTaskId;
|
||||||
|
@ -509,20 +497,18 @@ typedef struct {
|
||||||
SArray* checkpointVer; // SArray<SStreamCheckpointInfo>
|
SArray* checkpointVer; // SArray<SStreamCheckpointInfo>
|
||||||
} SStreamRecoverDownstreamRsp;
|
} SStreamRecoverDownstreamRsp;
|
||||||
|
|
||||||
|
int32_t tEncodeSStreamTaskCheckReq(SEncoder* pEncoder, const SStreamTaskCheckReq* pReq);
|
||||||
|
int32_t tDecodeSStreamTaskCheckReq(SDecoder* pDecoder, SStreamTaskCheckReq* pReq);
|
||||||
|
|
||||||
|
int32_t tEncodeSStreamTaskCheckRsp(SEncoder* pEncoder, const SStreamTaskCheckRsp* pRsp);
|
||||||
|
int32_t tDecodeSStreamTaskCheckRsp(SDecoder* pDecoder, SStreamTaskCheckRsp* pRsp);
|
||||||
|
|
||||||
int32_t tEncodeSStreamTaskRecoverReq(SEncoder* pEncoder, const SStreamRecoverDownstreamReq* pReq);
|
int32_t tEncodeSStreamTaskRecoverReq(SEncoder* pEncoder, const SStreamRecoverDownstreamReq* pReq);
|
||||||
int32_t tDecodeSStreamTaskRecoverReq(SDecoder* pDecoder, SStreamRecoverDownstreamReq* pReq);
|
int32_t tDecodeSStreamTaskRecoverReq(SDecoder* pDecoder, SStreamRecoverDownstreamReq* pReq);
|
||||||
|
|
||||||
int32_t tEncodeSStreamTaskRecoverRsp(SEncoder* pEncoder, const SStreamRecoverDownstreamRsp* pRsp);
|
int32_t tEncodeSStreamTaskRecoverRsp(SEncoder* pEncoder, const SStreamRecoverDownstreamRsp* pRsp);
|
||||||
int32_t tDecodeSStreamTaskRecoverRsp(SDecoder* pDecoder, SStreamRecoverDownstreamRsp* pRsp);
|
int32_t tDecodeSStreamTaskRecoverRsp(SDecoder* pDecoder, SStreamRecoverDownstreamRsp* pRsp);
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
int64_t streamId;
|
|
||||||
int32_t taskId;
|
|
||||||
int32_t waitingRspCnt;
|
|
||||||
int32_t totReq;
|
|
||||||
SArray* info; // SArray<SArray<SStreamCheckpointInfo>*>
|
|
||||||
} SStreamRecoverStatus;
|
|
||||||
|
|
||||||
int32_t tDecodeStreamDispatchReq(SDecoder* pDecoder, SStreamDispatchReq* pReq);
|
int32_t tDecodeStreamDispatchReq(SDecoder* pDecoder, SStreamDispatchReq* pReq);
|
||||||
int32_t tDecodeStreamRetrieveReq(SDecoder* pDecoder, SStreamRetrieveReq* pReq);
|
int32_t tDecodeStreamRetrieveReq(SDecoder* pDecoder, SStreamRetrieveReq* pReq);
|
||||||
void tDeleteStreamRetrieveReq(SStreamRetrieveReq* pReq);
|
void tDeleteStreamRetrieveReq(SStreamRetrieveReq* pReq);
|
||||||
|
@ -533,7 +519,7 @@ int32_t streamSetupTrigger(SStreamTask* pTask);
|
||||||
|
|
||||||
int32_t streamProcessRunReq(SStreamTask* pTask);
|
int32_t streamProcessRunReq(SStreamTask* pTask);
|
||||||
int32_t streamProcessDispatchReq(SStreamTask* pTask, SStreamDispatchReq* pReq, SRpcMsg* pMsg, bool exec);
|
int32_t streamProcessDispatchReq(SStreamTask* pTask, SStreamDispatchReq* pReq, SRpcMsg* pMsg, bool exec);
|
||||||
int32_t streamProcessDispatchRsp(SStreamTask* pTask, SStreamDispatchRsp* pRsp);
|
int32_t streamProcessDispatchRsp(SStreamTask* pTask, SStreamDispatchRsp* pRsp, int32_t code);
|
||||||
|
|
||||||
int32_t streamProcessRetrieveReq(SStreamTask* pTask, SStreamRetrieveReq* pReq, SRpcMsg* pMsg);
|
int32_t streamProcessRetrieveReq(SStreamTask* pTask, SStreamRetrieveReq* pReq, SRpcMsg* pMsg);
|
||||||
int32_t streamProcessRetrieveRsp(SStreamTask* pTask, SStreamRetrieveRsp* pRsp);
|
int32_t streamProcessRetrieveRsp(SStreamTask* pTask, SStreamRetrieveRsp* pRsp);
|
||||||
|
@ -544,6 +530,10 @@ int32_t streamSchedExec(SStreamTask* pTask);
|
||||||
int32_t streamScanExec(SStreamTask* pTask, int32_t batchSz);
|
int32_t streamScanExec(SStreamTask* pTask, int32_t batchSz);
|
||||||
|
|
||||||
// recover and fill history
|
// recover and fill history
|
||||||
|
int32_t streamTaskCheckDownstream(SStreamTask* pTask, int64_t version);
|
||||||
|
int32_t streamTaskLaunchRecover(SStreamTask* pTask, int64_t version);
|
||||||
|
int32_t streamProcessTaskCheckReq(SStreamTask* pTask, const SStreamTaskCheckReq* pReq);
|
||||||
|
int32_t streamProcessTaskCheckRsp(SStreamTask* pTask, const SStreamTaskCheckRsp* pRsp, int64_t version);
|
||||||
// common
|
// common
|
||||||
int32_t streamSetParamForRecover(SStreamTask* pTask);
|
int32_t streamSetParamForRecover(SStreamTask* pTask);
|
||||||
int32_t streamRestoreParam(SStreamTask* pTask);
|
int32_t streamRestoreParam(SStreamTask* pTask);
|
||||||
|
|
|
@ -25,8 +25,6 @@ extern "C" {
|
||||||
#include "tlrucache.h"
|
#include "tlrucache.h"
|
||||||
#include "tmsgcb.h"
|
#include "tmsgcb.h"
|
||||||
|
|
||||||
extern bool gRaftDetailLog;
|
|
||||||
|
|
||||||
#define SYNC_RESP_TTL_MS 10000000
|
#define SYNC_RESP_TTL_MS 10000000
|
||||||
#define SYNC_SPEED_UP_HB_TIMER 400
|
#define SYNC_SPEED_UP_HB_TIMER 400
|
||||||
#define SYNC_SPEED_UP_AFTER_MS (1000 * 20)
|
#define SYNC_SPEED_UP_AFTER_MS (1000 * 20)
|
||||||
|
@ -39,6 +37,7 @@ extern bool gRaftDetailLog;
|
||||||
#define SYNC_ADD_QUORUM_COUNT 3
|
#define SYNC_ADD_QUORUM_COUNT 3
|
||||||
#define SYNC_MNODE_LOG_RETENTION 10000
|
#define SYNC_MNODE_LOG_RETENTION 10000
|
||||||
#define SYNC_VNODE_LOG_RETENTION 100
|
#define SYNC_VNODE_LOG_RETENTION 100
|
||||||
|
#define SNAPSHOT_MAX_CLOCK_SKEW_MS 1000 * 10
|
||||||
|
|
||||||
#define SYNC_APPEND_ENTRIES_TIMEOUT_MS 10000
|
#define SYNC_APPEND_ENTRIES_TIMEOUT_MS 10000
|
||||||
|
|
||||||
|
@ -132,13 +131,15 @@ typedef struct SSnapshotMeta {
|
||||||
typedef struct SSyncFSM {
|
typedef struct SSyncFSM {
|
||||||
void* data;
|
void* data;
|
||||||
|
|
||||||
void (*FpCommitCb)(const struct SSyncFSM* pFsm, const SRpcMsg* pMsg, const SFsmCbMeta *pMeta);
|
void (*FpCommitCb)(const struct SSyncFSM* pFsm, const SRpcMsg* pMsg, const SFsmCbMeta* pMeta);
|
||||||
void (*FpPreCommitCb)(const struct SSyncFSM* pFsm, const SRpcMsg* pMsg, const SFsmCbMeta* pMeta);
|
void (*FpPreCommitCb)(const struct SSyncFSM* pFsm, const SRpcMsg* pMsg, const SFsmCbMeta* pMeta);
|
||||||
void (*FpRollBackCb)(const struct SSyncFSM* pFsm, const SRpcMsg* pMsg, const SFsmCbMeta* pMeta);
|
void (*FpRollBackCb)(const struct SSyncFSM* pFsm, const SRpcMsg* pMsg, const SFsmCbMeta* pMeta);
|
||||||
|
|
||||||
void (*FpRestoreFinishCb)(const struct SSyncFSM* pFsm);
|
void (*FpRestoreFinishCb)(const struct SSyncFSM* pFsm);
|
||||||
void (*FpReConfigCb)(const struct SSyncFSM* pFsm, const SRpcMsg* pMsg, const SReConfigCbMeta* pMeta);
|
void (*FpReConfigCb)(const struct SSyncFSM* pFsm, const SRpcMsg* pMsg, const SReConfigCbMeta* pMeta);
|
||||||
void (*FpLeaderTransferCb)(const struct SSyncFSM* pFsm, const SRpcMsg* pMsg, const SFsmCbMeta* pMeta);
|
void (*FpLeaderTransferCb)(const struct SSyncFSM* pFsm, const SRpcMsg* pMsg, const SFsmCbMeta* pMeta);
|
||||||
|
bool (*FpApplyQueueEmptyCb)(const struct SSyncFSM* pFsm);
|
||||||
|
int32_t (*FpApplyQueueItems)(const struct SSyncFSM* pFsm);
|
||||||
|
|
||||||
void (*FpBecomeLeaderCb)(const struct SSyncFSM* pFsm);
|
void (*FpBecomeLeaderCb)(const struct SSyncFSM* pFsm);
|
||||||
void (*FpBecomeFollowerCb)(const struct SSyncFSM* pFsm);
|
void (*FpBecomeFollowerCb)(const struct SSyncFSM* pFsm);
|
||||||
|
@ -202,37 +203,29 @@ typedef struct SSyncInfo {
|
||||||
int32_t (*syncEqCtrlMsg)(const SMsgCb* msgcb, SRpcMsg* pMsg);
|
int32_t (*syncEqCtrlMsg)(const SMsgCb* msgcb, SRpcMsg* pMsg);
|
||||||
} SSyncInfo;
|
} SSyncInfo;
|
||||||
|
|
||||||
int32_t syncInit();
|
typedef struct SSyncState {
|
||||||
void syncCleanUp();
|
ESyncState state;
|
||||||
bool syncIsInit();
|
bool restored;
|
||||||
int64_t syncOpen(SSyncInfo* pSyncInfo);
|
} SSyncState;
|
||||||
void syncStart(int64_t rid);
|
|
||||||
void syncStop(int64_t rid);
|
|
||||||
ESyncState syncGetMyRole(int64_t rid);
|
|
||||||
bool syncIsReady(int64_t rid);
|
|
||||||
const char* syncGetMyRoleStr(int64_t rid);
|
|
||||||
bool syncRestoreFinish(int64_t rid);
|
|
||||||
SyncTerm syncGetMyTerm(int64_t rid);
|
|
||||||
SyncIndex syncGetLastIndex(int64_t rid);
|
|
||||||
SyncIndex syncGetCommitIndex(int64_t rid);
|
|
||||||
SyncGroupId syncGetVgId(int64_t rid);
|
|
||||||
void syncGetEpSet(int64_t rid, SEpSet* pEpSet);
|
|
||||||
void syncGetRetryEpSet(int64_t rid, SEpSet* pEpSet);
|
|
||||||
int32_t syncPropose(int64_t rid, SRpcMsg* pMsg, bool isWeak);
|
|
||||||
// int32_t syncProposeBatch(int64_t rid, SRpcMsg** pMsgPArr, bool* pIsWeakArr, int32_t arrSize);
|
|
||||||
const char* syncStr(ESyncState state);
|
|
||||||
bool syncIsRestoreFinish(int64_t rid);
|
|
||||||
int32_t syncGetSnapshotByIndex(int64_t rid, SyncIndex index, SSnapshot* pSnapshot);
|
|
||||||
|
|
||||||
|
int32_t syncInit();
|
||||||
|
void syncCleanUp();
|
||||||
|
int64_t syncOpen(SSyncInfo* pSyncInfo);
|
||||||
|
void syncStart(int64_t rid);
|
||||||
|
void syncStop(int64_t rid);
|
||||||
|
void syncPreStop(int64_t rid);
|
||||||
|
int32_t syncPropose(int64_t rid, SRpcMsg* pMsg, bool isWeak);
|
||||||
|
int32_t syncProcessMsg(int64_t rid, SRpcMsg* pMsg);
|
||||||
int32_t syncReconfig(int64_t rid, SSyncCfg* pCfg);
|
int32_t syncReconfig(int64_t rid, SSyncCfg* pCfg);
|
||||||
int32_t syncLeaderTransfer(int64_t rid);
|
|
||||||
int32_t syncBeginSnapshot(int64_t rid, int64_t lastApplyIndex);
|
int32_t syncBeginSnapshot(int64_t rid, int64_t lastApplyIndex);
|
||||||
int32_t syncEndSnapshot(int64_t rid);
|
int32_t syncEndSnapshot(int64_t rid);
|
||||||
|
int32_t syncLeaderTransfer(int64_t rid);
|
||||||
int32_t syncStepDown(int64_t rid, SyncTerm newTerm);
|
int32_t syncStepDown(int64_t rid, SyncTerm newTerm);
|
||||||
|
bool syncIsReadyForRead(int64_t rid);
|
||||||
|
|
||||||
int32_t syncProcessMsg(int64_t rid, SRpcMsg* pMsg);
|
SSyncState syncGetState(int64_t rid);
|
||||||
|
void syncGetRetryEpSet(int64_t rid, SEpSet* pEpSet);
|
||||||
const char* syncUtilState2String(ESyncState state);
|
const char* syncStr(ESyncState state);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,15 +72,18 @@ typedef struct SRpcMsg {
|
||||||
typedef void (*RpcCfp)(void *parent, SRpcMsg *, SEpSet *epset);
|
typedef void (*RpcCfp)(void *parent, SRpcMsg *, SEpSet *epset);
|
||||||
typedef bool (*RpcRfp)(int32_t code, tmsg_t msgType);
|
typedef bool (*RpcRfp)(int32_t code, tmsg_t msgType);
|
||||||
typedef bool (*RpcTfp)(int32_t code, tmsg_t msgType);
|
typedef bool (*RpcTfp)(int32_t code, tmsg_t msgType);
|
||||||
|
typedef void (*RpcDfp)(void *ahandle);
|
||||||
|
|
||||||
typedef struct SRpcInit {
|
typedef struct SRpcInit {
|
||||||
char localFqdn[TSDB_FQDN_LEN];
|
char localFqdn[TSDB_FQDN_LEN];
|
||||||
uint16_t localPort; // local port
|
uint16_t localPort; // local port
|
||||||
char *label; // for debug purpose
|
char *label; // for debug purpose
|
||||||
int32_t numOfThreads; // number of threads to handle connections
|
int32_t numOfThreads; // number of threads to handle connections
|
||||||
int32_t sessions; // number of sessions allowed
|
int32_t sessions; // number of sessions allowed
|
||||||
int8_t connType; // TAOS_CONN_UDP, TAOS_CONN_TCPC, TAOS_CONN_TCPS
|
int8_t connType; // TAOS_CONN_UDP, TAOS_CONN_TCPC, TAOS_CONN_TCPS
|
||||||
int32_t idleTime; // milliseconds, 0 means idle timer is disabled
|
int32_t idleTime; // milliseconds, 0 means idle timer is disabled
|
||||||
|
int32_t retryLimit; // retry limit
|
||||||
|
int32_t retryInterval; // retry interval ms
|
||||||
|
|
||||||
int32_t compressSize; // -1: no compress, 0 : all data compressed, size: compress data if larger than size
|
int32_t compressSize; // -1: no compress, 0 : all data compressed, size: compress data if larger than size
|
||||||
int8_t encryption; // encrypt or not
|
int8_t encryption; // encrypt or not
|
||||||
|
@ -97,6 +100,9 @@ typedef struct SRpcInit {
|
||||||
// set up timeout for particular msg
|
// set up timeout for particular msg
|
||||||
RpcTfp tfp;
|
RpcTfp tfp;
|
||||||
|
|
||||||
|
// destroy client ahandle;
|
||||||
|
RpcDfp dfp;
|
||||||
|
|
||||||
void *parent;
|
void *parent;
|
||||||
} SRpcInit;
|
} SRpcInit;
|
||||||
|
|
||||||
|
|
|
@ -244,16 +244,6 @@ void syslog(int unused, const char *format, ...);
|
||||||
#define TD_CHARSET_LEN 64
|
#define TD_CHARSET_LEN 64
|
||||||
#define TD_TIMEZONE_LEN 96
|
#define TD_TIMEZONE_LEN 96
|
||||||
|
|
||||||
#ifdef WINDOWS
|
|
||||||
#define TD_PATH_MAX 260
|
|
||||||
#elif defined(PATH_MAX)
|
|
||||||
#define TD_PATH_MAX PATH_MAX
|
|
||||||
#elif defined(_XOPEN_PATH_MAX)
|
|
||||||
#define TD_PATH_MAX _XOPEN_PATH_MAX
|
|
||||||
#else
|
|
||||||
#define TD_PATH_MAX _POSIX_PATH_MAX
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -42,6 +42,16 @@ extern "C" {
|
||||||
#define PATH_MAX 256
|
#define PATH_MAX 256
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef WINDOWS
|
||||||
|
#define TD_PATH_MAX _MAX_PATH
|
||||||
|
#elif defined(PATH_MAX)
|
||||||
|
#define TD_PATH_MAX PATH_MAX
|
||||||
|
#elif defined(_XOPEN_PATH_MAX)
|
||||||
|
#define TD_PATH_MAX _XOPEN_PATH_MAX
|
||||||
|
#else
|
||||||
|
#define TD_PATH_MAX _POSIX_PATH_MAX
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef struct TdFile *TdFilePtr;
|
typedef struct TdFile *TdFilePtr;
|
||||||
|
|
||||||
#define TD_FILE_CREATE 0x0001
|
#define TD_FILE_CREATE 0x0001
|
||||||
|
|
|
@ -91,6 +91,7 @@ int32_t* taosGetErrno();
|
||||||
#define TSDB_CODE_MSG_DECODE_ERROR TAOS_DEF_ERROR_CODE(0, 0x0128)
|
#define TSDB_CODE_MSG_DECODE_ERROR TAOS_DEF_ERROR_CODE(0, 0x0128)
|
||||||
#define TSDB_CODE_NO_AVAIL_DISK TAOS_DEF_ERROR_CODE(0, 0x0129)
|
#define TSDB_CODE_NO_AVAIL_DISK TAOS_DEF_ERROR_CODE(0, 0x0129)
|
||||||
#define TSDB_CODE_NOT_FOUND TAOS_DEF_ERROR_CODE(0, 0x012A)
|
#define TSDB_CODE_NOT_FOUND TAOS_DEF_ERROR_CODE(0, 0x012A)
|
||||||
|
#define TSDB_CODE_NO_DISKSPACE TAOS_DEF_ERROR_CODE(0, 0x012B)
|
||||||
|
|
||||||
//client
|
//client
|
||||||
#define TSDB_CODE_TSC_INVALID_OPERATION TAOS_DEF_ERROR_CODE(0, 0x0200)
|
#define TSDB_CODE_TSC_INVALID_OPERATION TAOS_DEF_ERROR_CODE(0, 0x0200)
|
||||||
|
@ -106,7 +107,6 @@ int32_t* taosGetErrno();
|
||||||
#define TSDB_CODE_TSC_INVALID_TABLE_ID_LENGTH TAOS_DEF_ERROR_CODE(0, 0x020A)
|
#define TSDB_CODE_TSC_INVALID_TABLE_ID_LENGTH TAOS_DEF_ERROR_CODE(0, 0x020A)
|
||||||
#define TSDB_CODE_TSC_INVALID_CONNECTION TAOS_DEF_ERROR_CODE(0, 0x020B)
|
#define TSDB_CODE_TSC_INVALID_CONNECTION TAOS_DEF_ERROR_CODE(0, 0x020B)
|
||||||
#define TSDB_CODE_TSC_OUT_OF_MEMORY TAOS_DEF_ERROR_CODE(0, 0x020C)
|
#define TSDB_CODE_TSC_OUT_OF_MEMORY TAOS_DEF_ERROR_CODE(0, 0x020C)
|
||||||
#define TSDB_CODE_TSC_NO_DISKSPACE TAOS_DEF_ERROR_CODE(0, 0x020D)
|
|
||||||
#define TSDB_CODE_TSC_QUERY_CACHE_ERASED TAOS_DEF_ERROR_CODE(0, 0x020E)
|
#define TSDB_CODE_TSC_QUERY_CACHE_ERASED TAOS_DEF_ERROR_CODE(0, 0x020E)
|
||||||
#define TSDB_CODE_TSC_QUERY_CANCELLED TAOS_DEF_ERROR_CODE(0, 0x020F)
|
#define TSDB_CODE_TSC_QUERY_CANCELLED TAOS_DEF_ERROR_CODE(0, 0x020F)
|
||||||
#define TSDB_CODE_TSC_SORTED_RES_TOO_MANY TAOS_DEF_ERROR_CODE(0, 0x0210)
|
#define TSDB_CODE_TSC_SORTED_RES_TOO_MANY TAOS_DEF_ERROR_CODE(0, 0x0210)
|
||||||
|
@ -154,7 +154,7 @@ int32_t* taosGetErrno();
|
||||||
|
|
||||||
// mnode-sdb
|
// mnode-sdb
|
||||||
#define TSDB_CODE_SDB_OBJ_ALREADY_THERE TAOS_DEF_ERROR_CODE(0, 0x0320)
|
#define TSDB_CODE_SDB_OBJ_ALREADY_THERE TAOS_DEF_ERROR_CODE(0, 0x0320)
|
||||||
#define TSDB_CODE_SDB_APP_ERROR TAOS_DEF_ERROR_CODE(0, 0x0321)
|
#define TSDB_CODE_SDB_APP_ERROR TAOS_DEF_ERROR_CODE(0, 0x0321) // internal
|
||||||
#define TSDB_CODE_SDB_INVALID_TABLE_TYPE TAOS_DEF_ERROR_CODE(0, 0x0322)
|
#define TSDB_CODE_SDB_INVALID_TABLE_TYPE TAOS_DEF_ERROR_CODE(0, 0x0322)
|
||||||
#define TSDB_CODE_SDB_OBJ_NOT_THERE TAOS_DEF_ERROR_CODE(0, 0x0323)
|
#define TSDB_CODE_SDB_OBJ_NOT_THERE TAOS_DEF_ERROR_CODE(0, 0x0323)
|
||||||
#define TSDB_CODE_SDB_INVALID_KEY_TYPE TAOS_DEF_ERROR_CODE(0, 0x0325)
|
#define TSDB_CODE_SDB_INVALID_KEY_TYPE TAOS_DEF_ERROR_CODE(0, 0x0325)
|
||||||
|
@ -218,14 +218,24 @@ int32_t* taosGetErrno();
|
||||||
|
|
||||||
// mnode-db
|
// mnode-db
|
||||||
#define TSDB_CODE_MND_DB_NOT_SELECTED TAOS_DEF_ERROR_CODE(0, 0x0380)
|
#define TSDB_CODE_MND_DB_NOT_SELECTED TAOS_DEF_ERROR_CODE(0, 0x0380)
|
||||||
#define TSDB_CODE_MND_DB_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0381)
|
#define TSDB_CODE_MND_DB_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0381) //
|
||||||
#define TSDB_CODE_MND_INVALID_DB_OPTION TAOS_DEF_ERROR_CODE(0, 0x0382)
|
#define TSDB_CODE_MND_INVALID_DB_OPTION TAOS_DEF_ERROR_CODE(0, 0x0382) //
|
||||||
#define TSDB_CODE_MND_INVALID_DB TAOS_DEF_ERROR_CODE(0, 0x0383)
|
#define TSDB_CODE_MND_INVALID_DB TAOS_DEF_ERROR_CODE(0, 0x0383)
|
||||||
|
// #define TSDB_CODE_MND_MONITOR_DB_FORBIDDEN TAOS_DEF_ERROR_CODE(0, 0x0384) // 2.x
|
||||||
#define TSDB_CODE_MND_TOO_MANY_DATABASES TAOS_DEF_ERROR_CODE(0, 0x0385)
|
#define TSDB_CODE_MND_TOO_MANY_DATABASES TAOS_DEF_ERROR_CODE(0, 0x0385)
|
||||||
#define TSDB_CODE_MND_DB_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0388)
|
#define TSDB_CODE_MND_DB_IN_DROPPING TAOS_DEF_ERROR_CODE(0, 0x0386) //
|
||||||
#define TSDB_CODE_MND_INVALID_DB_ACCT TAOS_DEF_ERROR_CODE(0, 0x0389)
|
// #define TSDB_CODE_MND_VGROUP_NOT_READY TAOS_DEF_ERROR_CODE(0, 0x0387) // 2.x
|
||||||
#define TSDB_CODE_MND_DB_OPTION_UNCHANGED TAOS_DEF_ERROR_CODE(0, 0x038A)
|
#define TSDB_CODE_MND_DB_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0388) //
|
||||||
|
#define TSDB_CODE_MND_INVALID_DB_ACCT TAOS_DEF_ERROR_CODE(0, 0x0389) // internal
|
||||||
|
#define TSDB_CODE_MND_DB_OPTION_UNCHANGED TAOS_DEF_ERROR_CODE(0, 0x038A) //
|
||||||
#define TSDB_CODE_MND_DB_INDEX_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x038B)
|
#define TSDB_CODE_MND_DB_INDEX_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x038B)
|
||||||
|
// #define TSDB_CODE_MND_INVALID_DB_OPTION_DAYS TAOS_DEF_ERROR_CODE(0, 0x0390) // 2.x
|
||||||
|
// #define TSDB_CODE_MND_INVALID_DB_OPTION_KEEP TAOS_DEF_ERROR_CODE(0, 0x0391) // 2.x
|
||||||
|
// #define TSDB_CODE_MND_INVALID_TOPIC TAOS_DEF_ERROR_CODE(0, 0x0392) // 2.x
|
||||||
|
// #define TSDB_CODE_MND_INVALID_TOPIC_OPTION TAOS_DEF_ERROR_CODE(0, 0x0393) // 2.x
|
||||||
|
// #define TSDB_CODE_MND_INVALID_TOPIC_PARTITONSTAOS_DEF_ERROR_CODE(0, 0x0394) // 2.x
|
||||||
|
// #define TSDB_CODE_MND_TOPIC_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0395) // 2.x
|
||||||
|
#define TSDB_CODE_MND_DB_IN_CREATING TAOS_DEF_ERROR_CODE(0, 0x0396) //
|
||||||
#define TSDB_CODE_MND_INVALID_SYS_TABLENAME TAOS_DEF_ERROR_CODE(0, 0x039A)
|
#define TSDB_CODE_MND_INVALID_SYS_TABLENAME TAOS_DEF_ERROR_CODE(0, 0x039A)
|
||||||
|
|
||||||
// mnode-node
|
// mnode-node
|
||||||
|
@ -305,34 +315,14 @@ int32_t* taosGetErrno();
|
||||||
#define TSDB_CODE_NODE_NOT_DEPLOYED TAOS_DEF_ERROR_CODE(0, 0x040A)
|
#define TSDB_CODE_NODE_NOT_DEPLOYED TAOS_DEF_ERROR_CODE(0, 0x040A)
|
||||||
|
|
||||||
// vnode
|
// vnode
|
||||||
#define TSDB_CODE_VND_ACTION_IN_PROGRESS TAOS_DEF_ERROR_CODE(0, 0x0500)
|
|
||||||
#define TSDB_CODE_VND_MSG_NOT_PROCESSED TAOS_DEF_ERROR_CODE(0, 0x0501)
|
|
||||||
#define TSDB_CODE_VND_ACTION_NEED_REPROCESSED TAOS_DEF_ERROR_CODE(0, 0x0502)
|
|
||||||
#define TSDB_CODE_VND_INVALID_VGROUP_ID TAOS_DEF_ERROR_CODE(0, 0x0503)
|
#define TSDB_CODE_VND_INVALID_VGROUP_ID TAOS_DEF_ERROR_CODE(0, 0x0503)
|
||||||
#define TSDB_CODE_VND_INIT_FAILED TAOS_DEF_ERROR_CODE(0, 0x0504)
|
|
||||||
#define TSDB_CODE_VND_NO_DISKSPACE TAOS_DEF_ERROR_CODE(0, 0x0505)
|
|
||||||
#define TSDB_CODE_VND_NO_DISK_PERMISSIONS TAOS_DEF_ERROR_CODE(0, 0x0506)
|
|
||||||
#define TSDB_CODE_VND_NO_SUCH_FILE_OR_DIR TAOS_DEF_ERROR_CODE(0, 0x0507)
|
|
||||||
#define TSDB_CODE_VND_OUT_OF_MEMORY TAOS_DEF_ERROR_CODE(0, 0x0508)
|
|
||||||
#define TSDB_CODE_VND_APP_ERROR TAOS_DEF_ERROR_CODE(0, 0x0509)
|
|
||||||
#define TSDB_CODE_VND_IS_FLOWCTRL TAOS_DEF_ERROR_CODE(0, 0x050C)
|
|
||||||
#define TSDB_CODE_VND_IS_DROPPING TAOS_DEF_ERROR_CODE(0, 0x050D)
|
|
||||||
#define TSDB_CODE_VND_IS_UPDATING TAOS_DEF_ERROR_CODE(0, 0x050E)
|
|
||||||
#define TSDB_CODE_VND_IS_CLOSING TAOS_DEF_ERROR_CODE(0, 0x0510)
|
|
||||||
#define TSDB_CODE_VND_NOT_SYNCED TAOS_DEF_ERROR_CODE(0, 0x0511)
|
|
||||||
#define TSDB_CODE_VND_NO_WRITE_AUTH TAOS_DEF_ERROR_CODE(0, 0x0512)
|
#define TSDB_CODE_VND_NO_WRITE_AUTH TAOS_DEF_ERROR_CODE(0, 0x0512)
|
||||||
#define TSDB_CODE_VND_IS_SYNCING TAOS_DEF_ERROR_CODE(0, 0x0513)
|
|
||||||
#define TSDB_CODE_VND_INVALID_TSDB_STATE TAOS_DEF_ERROR_CODE(0, 0x0514)
|
|
||||||
#define TSDB_CODE_VND_TB_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0520)
|
|
||||||
#define TSDB_CODE_VND_SMA_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0521)
|
|
||||||
#define TSDB_CODE_VND_HASH_MISMATCH TAOS_DEF_ERROR_CODE(0, 0x0522)
|
#define TSDB_CODE_VND_HASH_MISMATCH TAOS_DEF_ERROR_CODE(0, 0x0522)
|
||||||
#define TSDB_CODE_VND_TABLE_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0523)
|
|
||||||
#define TSDB_CODE_VND_INVALID_TABLE_ACTION TAOS_DEF_ERROR_CODE(0, 0x0524)
|
#define TSDB_CODE_VND_INVALID_TABLE_ACTION TAOS_DEF_ERROR_CODE(0, 0x0524)
|
||||||
#define TSDB_CODE_VND_COL_ALREADY_EXISTS TAOS_DEF_ERROR_CODE(0, 0x0525)
|
#define TSDB_CODE_VND_COL_ALREADY_EXISTS TAOS_DEF_ERROR_CODE(0, 0x0525)
|
||||||
#define TSDB_CODE_VND_TABLE_COL_NOT_EXISTS TAOS_DEF_ERROR_CODE(0, 0x0526)
|
#define TSDB_CODE_VND_COL_NOT_EXISTS TAOS_DEF_ERROR_CODE(0, 0x0526)
|
||||||
#define TSDB_CODE_VND_COL_SUBSCRIBED TAOS_DEF_ERROR_CODE(0, 0x0527)
|
#define TSDB_CODE_VND_COL_SUBSCRIBED TAOS_DEF_ERROR_CODE(0, 0x0527)
|
||||||
#define TSDB_CODE_VND_INVALID_CFG_FILE TAOS_DEF_ERROR_CODE(0, 0x0528)
|
#define TSDB_CODE_VND_NO_AVAIL_BUFPOOL TAOS_DEF_ERROR_CODE(0, 0x0528)
|
||||||
#define TSDB_CODE_VND_INVALID_TERM_FILE TAOS_DEF_ERROR_CODE(0, 0x0529)
|
|
||||||
|
|
||||||
// tsdb
|
// tsdb
|
||||||
#define TSDB_CODE_TDB_INVALID_TABLE_ID TAOS_DEF_ERROR_CODE(0, 0x0600)
|
#define TSDB_CODE_TDB_INVALID_TABLE_ID TAOS_DEF_ERROR_CODE(0, 0x0600)
|
||||||
|
@ -341,7 +331,6 @@ int32_t* taosGetErrno();
|
||||||
#define TSDB_CODE_TDB_TABLE_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0603)
|
#define TSDB_CODE_TDB_TABLE_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0603)
|
||||||
#define TSDB_CODE_TDB_INVALID_CONFIG TAOS_DEF_ERROR_CODE(0, 0x0604)
|
#define TSDB_CODE_TDB_INVALID_CONFIG TAOS_DEF_ERROR_CODE(0, 0x0604)
|
||||||
#define TSDB_CODE_TDB_INIT_FAILED TAOS_DEF_ERROR_CODE(0, 0x0605)
|
#define TSDB_CODE_TDB_INIT_FAILED TAOS_DEF_ERROR_CODE(0, 0x0605)
|
||||||
#define TSDB_CODE_TDB_NO_DISKSPACE TAOS_DEF_ERROR_CODE(0, 0x0606)
|
|
||||||
#define TSDB_CODE_TDB_NO_DISK_PERMISSIONS TAOS_DEF_ERROR_CODE(0, 0x0607)
|
#define TSDB_CODE_TDB_NO_DISK_PERMISSIONS TAOS_DEF_ERROR_CODE(0, 0x0607)
|
||||||
#define TSDB_CODE_TDB_FILE_CORRUPTED TAOS_DEF_ERROR_CODE(0, 0x0608)
|
#define TSDB_CODE_TDB_FILE_CORRUPTED TAOS_DEF_ERROR_CODE(0, 0x0608)
|
||||||
#define TSDB_CODE_TDB_OUT_OF_MEMORY TAOS_DEF_ERROR_CODE(0, 0x0609)
|
#define TSDB_CODE_TDB_OUT_OF_MEMORY TAOS_DEF_ERROR_CODE(0, 0x0609)
|
||||||
|
@ -361,13 +350,12 @@ int32_t* taosGetErrno();
|
||||||
#define TSDB_CODE_TDB_TABLE_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0618)
|
#define TSDB_CODE_TDB_TABLE_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0618)
|
||||||
#define TSDB_CODE_TDB_STB_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0619)
|
#define TSDB_CODE_TDB_STB_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0619)
|
||||||
#define TSDB_CODE_TDB_STB_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x061A)
|
#define TSDB_CODE_TDB_STB_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x061A)
|
||||||
#define TSDB_CODE_TDB_TABLE_RECREATED TAOS_DEF_ERROR_CODE(0, 0x061B)
|
#define TSDB_CODE_TDB_INVALID_TABLE_SCHEMA_VER TAOS_DEF_ERROR_CODE(0, 0x061B)
|
||||||
#define TSDB_CODE_TDB_TDB_ENV_OPEN_ERROR TAOS_DEF_ERROR_CODE(0, 0x061C)
|
#define TSDB_CODE_TDB_TDB_ENV_OPEN_ERROR TAOS_DEF_ERROR_CODE(0, 0x061C)
|
||||||
|
|
||||||
// query
|
// query
|
||||||
#define TSDB_CODE_QRY_INVALID_QHANDLE TAOS_DEF_ERROR_CODE(0, 0x0700)
|
#define TSDB_CODE_QRY_INVALID_QHANDLE TAOS_DEF_ERROR_CODE(0, 0x0700)
|
||||||
#define TSDB_CODE_QRY_INVALID_MSG TAOS_DEF_ERROR_CODE(0, 0x0701)
|
#define TSDB_CODE_QRY_INVALID_MSG TAOS_DEF_ERROR_CODE(0, 0x0701)
|
||||||
#define TSDB_CODE_QRY_NO_DISKSPACE TAOS_DEF_ERROR_CODE(0, 0x0702)
|
|
||||||
#define TSDB_CODE_QRY_OUT_OF_MEMORY TAOS_DEF_ERROR_CODE(0, 0x0703)
|
#define TSDB_CODE_QRY_OUT_OF_MEMORY TAOS_DEF_ERROR_CODE(0, 0x0703)
|
||||||
#define TSDB_CODE_QRY_APP_ERROR TAOS_DEF_ERROR_CODE(0, 0x0704)
|
#define TSDB_CODE_QRY_APP_ERROR TAOS_DEF_ERROR_CODE(0, 0x0704)
|
||||||
#define TSDB_CODE_QRY_DUP_JOIN_KEY TAOS_DEF_ERROR_CODE(0, 0x0705)
|
#define TSDB_CODE_QRY_DUP_JOIN_KEY TAOS_DEF_ERROR_CODE(0, 0x0705)
|
||||||
|
@ -420,7 +408,7 @@ int32_t* taosGetErrno();
|
||||||
#define TSDB_CODE_SYN_NOT_LEADER TAOS_DEF_ERROR_CODE(0, 0x090C)
|
#define TSDB_CODE_SYN_NOT_LEADER TAOS_DEF_ERROR_CODE(0, 0x090C)
|
||||||
#define TSDB_CODE_SYN_ONE_REPLICA TAOS_DEF_ERROR_CODE(0, 0x090D)
|
#define TSDB_CODE_SYN_ONE_REPLICA TAOS_DEF_ERROR_CODE(0, 0x090D)
|
||||||
#define TSDB_CODE_SYN_NOT_IN_NEW_CONFIG TAOS_DEF_ERROR_CODE(0, 0x090E)
|
#define TSDB_CODE_SYN_NOT_IN_NEW_CONFIG TAOS_DEF_ERROR_CODE(0, 0x090E)
|
||||||
#define TSDB_CODE_SYN_NEW_CONFIG_ERROR TAOS_DEF_ERROR_CODE(0, 0x090F)
|
#define TSDB_CODE_SYN_NEW_CONFIG_ERROR TAOS_DEF_ERROR_CODE(0, 0x090F) // internal
|
||||||
#define TSDB_CODE_SYN_RECONFIG_NOT_READY TAOS_DEF_ERROR_CODE(0, 0x0910)
|
#define TSDB_CODE_SYN_RECONFIG_NOT_READY TAOS_DEF_ERROR_CODE(0, 0x0910)
|
||||||
#define TSDB_CODE_SYN_PROPOSE_NOT_READY TAOS_DEF_ERROR_CODE(0, 0x0911)
|
#define TSDB_CODE_SYN_PROPOSE_NOT_READY TAOS_DEF_ERROR_CODE(0, 0x0911)
|
||||||
#define TSDB_CODE_SYN_STANDBY_NOT_READY TAOS_DEF_ERROR_CODE(0, 0x0912)
|
#define TSDB_CODE_SYN_STANDBY_NOT_READY TAOS_DEF_ERROR_CODE(0, 0x0912)
|
||||||
|
@ -430,7 +418,6 @@ int32_t* taosGetErrno();
|
||||||
// tq
|
// tq
|
||||||
#define TSDB_CODE_TQ_INVALID_CONFIG TAOS_DEF_ERROR_CODE(0, 0x0A00)
|
#define TSDB_CODE_TQ_INVALID_CONFIG TAOS_DEF_ERROR_CODE(0, 0x0A00)
|
||||||
#define TSDB_CODE_TQ_INIT_FAILED TAOS_DEF_ERROR_CODE(0, 0x0A01)
|
#define TSDB_CODE_TQ_INIT_FAILED TAOS_DEF_ERROR_CODE(0, 0x0A01)
|
||||||
#define TSDB_CODE_TQ_NO_DISKSPACE TAOS_DEF_ERROR_CODE(0, 0x0A02)
|
|
||||||
#define TSDB_CODE_TQ_NO_DISK_PERMISSIONS TAOS_DEF_ERROR_CODE(0, 0x0A03)
|
#define TSDB_CODE_TQ_NO_DISK_PERMISSIONS TAOS_DEF_ERROR_CODE(0, 0x0A03)
|
||||||
#define TSDB_CODE_TQ_FILE_CORRUPTED TAOS_DEF_ERROR_CODE(0, 0x0A04)
|
#define TSDB_CODE_TQ_FILE_CORRUPTED TAOS_DEF_ERROR_CODE(0, 0x0A04)
|
||||||
#define TSDB_CODE_TQ_OUT_OF_MEMORY TAOS_DEF_ERROR_CODE(0, 0x0A05)
|
#define TSDB_CODE_TQ_OUT_OF_MEMORY TAOS_DEF_ERROR_CODE(0, 0x0A05)
|
||||||
|
@ -635,9 +622,12 @@ int32_t* taosGetErrno();
|
||||||
#define TSDB_CODE_TMQ_CONSUMER_MISMATCH TAOS_DEF_ERROR_CODE(0, 0x4001)
|
#define TSDB_CODE_TMQ_CONSUMER_MISMATCH TAOS_DEF_ERROR_CODE(0, 0x4001)
|
||||||
#define TSDB_CODE_TMQ_CONSUMER_CLOSED TAOS_DEF_ERROR_CODE(0, 0x4002)
|
#define TSDB_CODE_TMQ_CONSUMER_CLOSED TAOS_DEF_ERROR_CODE(0, 0x4002)
|
||||||
|
|
||||||
|
// stream
|
||||||
|
#define TSDB_CODE_STREAM_TASK_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x4100)
|
||||||
|
|
||||||
// TDLite
|
// TDLite
|
||||||
#define TSDB_CODE_TDLITE_IVLD_OPEN_FLAGS TAOS_DEF_ERROR_CODE(0, 0x4100)
|
#define TSDB_CODE_TDLITE_IVLD_OPEN_FLAGS TAOS_DEF_ERROR_CODE(0, 0x5100)
|
||||||
#define TSDB_CODE_TDLITE_IVLD_OPEN_DIR TAOS_DEF_ERROR_CODE(0, 0x4101)
|
#define TSDB_CODE_TDLITE_IVLD_OPEN_DIR TAOS_DEF_ERROR_CODE(0, 0x5101)
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ extern "C" {
|
||||||
|
|
||||||
#define TSKEY int64_t
|
#define TSKEY int64_t
|
||||||
#define TSKEY_MIN INT64_MIN
|
#define TSKEY_MIN INT64_MIN
|
||||||
#define TSKEY_MAX (INT64_MAX - 1)
|
#define TSKEY_MAX INT64_MAX
|
||||||
#define TSKEY_INITIAL_VAL TSKEY_MIN
|
#define TSKEY_INITIAL_VAL TSKEY_MIN
|
||||||
|
|
||||||
#define TD_VER_MAX UINT64_MAX // TODO: use the real max version from query handle
|
#define TD_VER_MAX UINT64_MAX // TODO: use the real max version from query handle
|
||||||
|
@ -290,7 +290,7 @@ typedef enum ELogicConditionType {
|
||||||
#define TSDB_DEFAULT_VN_PER_DB 2
|
#define TSDB_DEFAULT_VN_PER_DB 2
|
||||||
#define TSDB_MIN_BUFFER_PER_VNODE 3 // unit MB
|
#define TSDB_MIN_BUFFER_PER_VNODE 3 // unit MB
|
||||||
#define TSDB_MAX_BUFFER_PER_VNODE 16384 // unit MB
|
#define TSDB_MAX_BUFFER_PER_VNODE 16384 // unit MB
|
||||||
#define TSDB_DEFAULT_BUFFER_PER_VNODE 96
|
#define TSDB_DEFAULT_BUFFER_PER_VNODE 256
|
||||||
#define TSDB_MIN_PAGES_PER_VNODE 64
|
#define TSDB_MIN_PAGES_PER_VNODE 64
|
||||||
#define TSDB_MAX_PAGES_PER_VNODE (INT32_MAX - 1)
|
#define TSDB_MAX_PAGES_PER_VNODE (INT32_MAX - 1)
|
||||||
#define TSDB_DEFAULT_PAGES_PER_VNODE 256
|
#define TSDB_DEFAULT_PAGES_PER_VNODE 256
|
||||||
|
|
|
@ -59,6 +59,47 @@ typedef enum {
|
||||||
typedef void (*FItem)(SQueueInfo *pInfo, void *pItem);
|
typedef void (*FItem)(SQueueInfo *pInfo, void *pItem);
|
||||||
typedef void (*FItems)(SQueueInfo *pInfo, STaosQall *qall, int32_t numOfItems);
|
typedef void (*FItems)(SQueueInfo *pInfo, STaosQall *qall, int32_t numOfItems);
|
||||||
|
|
||||||
|
typedef struct STaosQnode STaosQnode;
|
||||||
|
|
||||||
|
typedef struct STaosQnode {
|
||||||
|
STaosQnode *next;
|
||||||
|
STaosQueue *queue;
|
||||||
|
int64_t timestamp;
|
||||||
|
int32_t size;
|
||||||
|
int8_t itype;
|
||||||
|
int8_t reserved[3];
|
||||||
|
char item[];
|
||||||
|
} STaosQnode;
|
||||||
|
|
||||||
|
typedef struct STaosQueue {
|
||||||
|
STaosQnode *head;
|
||||||
|
STaosQnode *tail;
|
||||||
|
STaosQueue *next; // for queue set
|
||||||
|
STaosQset *qset; // for queue set
|
||||||
|
void *ahandle; // for queue set
|
||||||
|
FItem itemFp;
|
||||||
|
FItems itemsFp;
|
||||||
|
TdThreadMutex mutex;
|
||||||
|
int64_t memOfItems;
|
||||||
|
int32_t numOfItems;
|
||||||
|
int64_t threadId;
|
||||||
|
} STaosQueue;
|
||||||
|
|
||||||
|
typedef struct STaosQset {
|
||||||
|
STaosQueue *head;
|
||||||
|
STaosQueue *current;
|
||||||
|
TdThreadMutex mutex;
|
||||||
|
tsem_t sem;
|
||||||
|
int32_t numOfQueues;
|
||||||
|
int32_t numOfItems;
|
||||||
|
} STaosQset;
|
||||||
|
|
||||||
|
typedef struct STaosQall {
|
||||||
|
STaosQnode *current;
|
||||||
|
STaosQnode *start;
|
||||||
|
int32_t numOfItems;
|
||||||
|
} STaosQall;
|
||||||
|
|
||||||
STaosQueue *taosOpenQueue();
|
STaosQueue *taosOpenQueue();
|
||||||
void taosCloseQueue(STaosQueue *queue);
|
void taosCloseQueue(STaosQueue *queue);
|
||||||
void taosSetQueueFp(STaosQueue *queue, FItem itemFp, FItems itemsFp);
|
void taosSetQueueFp(STaosQueue *queue, FItem itemFp, FItems itemsFp);
|
||||||
|
|
|
@ -26,8 +26,9 @@ typedef struct SQWorkerPool SQWorkerPool;
|
||||||
typedef struct SWWorkerPool SWWorkerPool;
|
typedef struct SWWorkerPool SWWorkerPool;
|
||||||
|
|
||||||
typedef struct SQWorker {
|
typedef struct SQWorker {
|
||||||
int32_t id; // worker ID
|
int32_t id; // worker id
|
||||||
TdThread thread; // thread
|
int64_t pid; // thread pid
|
||||||
|
TdThread thread; // thread id
|
||||||
SQWorkerPool *pool;
|
SQWorkerPool *pool;
|
||||||
} SQWorker;
|
} SQWorker;
|
||||||
|
|
||||||
|
@ -43,9 +44,10 @@ typedef struct SQWorkerPool {
|
||||||
|
|
||||||
typedef struct SWWorker {
|
typedef struct SWWorker {
|
||||||
int32_t id; // worker id
|
int32_t id; // worker id
|
||||||
TdThread thread; // thread
|
int64_t pid; // thread pid
|
||||||
|
TdThread thread; // thread id
|
||||||
STaosQall *qall;
|
STaosQall *qall;
|
||||||
STaosQset *qset; // queue set
|
STaosQset *qset;
|
||||||
SWWorkerPool *pool;
|
SWWorkerPool *pool;
|
||||||
} SWWorker;
|
} SWWorker;
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ def sync_source(branch_name) {
|
||||||
git branch
|
git branch
|
||||||
git pull || git pull
|
git pull || git pull
|
||||||
git log | head -n 20
|
git log | head -n 20
|
||||||
git submodule update --init --recursive
|
git clean -fxd
|
||||||
'''
|
'''
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
@ -37,19 +37,24 @@ def build_run() {
|
||||||
pipeline {
|
pipeline {
|
||||||
agent none
|
agent none
|
||||||
parameters {
|
parameters {
|
||||||
|
choice(
|
||||||
|
name: 'sourcePath',
|
||||||
|
choices: ['nas','web'],
|
||||||
|
description: 'choice which way to download the installation pacakge;web is Office Web and nas means taos nas server '
|
||||||
|
)
|
||||||
string (
|
string (
|
||||||
name:'version',
|
name:'version',
|
||||||
defaultValue:'3.0.0.1',
|
defaultValue:'3.0.1.6',
|
||||||
description: 'release version number,eg: 3.0.0.1 or 3.0.0.'
|
description: 'release version number,eg: 3.0.0.1 or 3.0.0.'
|
||||||
)
|
)
|
||||||
string (
|
string (
|
||||||
name:'baseVersion',
|
name:'baseVersion',
|
||||||
defaultValue:'3.0.0.1',
|
defaultValue:'3.0.1.6',
|
||||||
description: 'This number of baseVerison is generally not modified.Now it is 3.0.0.1'
|
description: 'This number of baseVerison is generally not modified.Now it is 3.0.0.1'
|
||||||
)
|
)
|
||||||
string (
|
string (
|
||||||
name:'toolsVersion',
|
name:'toolsVersion',
|
||||||
defaultValue:'2.1.2',
|
defaultValue:'2.2.7',
|
||||||
description: 'This number of baseVerison is generally not modified.Now it is 3.0.0.1'
|
description: 'This number of baseVerison is generally not modified.Now it is 3.0.0.1'
|
||||||
)
|
)
|
||||||
string (
|
string (
|
||||||
|
@ -62,7 +67,7 @@ pipeline {
|
||||||
WORK_DIR = '/var/lib/jenkins/workspace'
|
WORK_DIR = '/var/lib/jenkins/workspace'
|
||||||
TDINTERNAL_ROOT_DIR = '/var/lib/jenkins/workspace/TDinternal'
|
TDINTERNAL_ROOT_DIR = '/var/lib/jenkins/workspace/TDinternal'
|
||||||
TDENGINE_ROOT_DIR = '/var/lib/jenkins/workspace/TDinternal/community'
|
TDENGINE_ROOT_DIR = '/var/lib/jenkins/workspace/TDinternal/community'
|
||||||
BRANCH_NAME = 'test/chr/TD-14699'
|
BRANCH_NAME = '3.0'
|
||||||
|
|
||||||
TD_SERVER_TAR = "TDengine-server-${version}-Linux-x64.tar.gz"
|
TD_SERVER_TAR = "TDengine-server-${version}-Linux-x64.tar.gz"
|
||||||
BASE_TD_SERVER_TAR = "TDengine-server-${baseVersion}-Linux-x64.tar.gz"
|
BASE_TD_SERVER_TAR = "TDengine-server-${baseVersion}-Linux-x64.tar.gz"
|
||||||
|
@ -104,17 +109,17 @@ pipeline {
|
||||||
sync_source("${BRANCH_NAME}")
|
sync_source("${BRANCH_NAME}")
|
||||||
sh '''
|
sh '''
|
||||||
cd ${TDENGINE_ROOT_DIR}/packaging
|
cd ${TDENGINE_ROOT_DIR}/packaging
|
||||||
bash testpackage.sh ${TD_SERVER_TAR} ${version} ${BASE_TD_SERVER_TAR} ${baseVersion} server
|
bash testpackage.sh ${TD_SERVER_TAR} ${version} ${BASE_TD_SERVER_TAR} ${baseVersion} server ${sourcePath}
|
||||||
python3 checkPackageRuning.py
|
python3 checkPackageRuning.py
|
||||||
'''
|
'''
|
||||||
sh '''
|
sh '''
|
||||||
cd ${TDENGINE_ROOT_DIR}/packaging
|
cd ${TDENGINE_ROOT_DIR}/packaging
|
||||||
bash testpackage.sh ${TD_SERVER_LITE_TAR} ${version} ${BASE_TD_SERVER_LITE_TAR} ${baseVersion} server
|
bash testpackage.sh ${TD_SERVER_LITE_TAR} ${version} ${BASE_TD_SERVER_LITE_TAR} ${baseVersion} server ${sourcePath}
|
||||||
python3 checkPackageRuning.py
|
python3 checkPackageRuning.py
|
||||||
'''
|
'''
|
||||||
sh '''
|
sh '''
|
||||||
cd ${TDENGINE_ROOT_DIR}/packaging
|
cd ${TDENGINE_ROOT_DIR}/packaging
|
||||||
bash testpackage.sh ${TD_SERVER_DEB} ${version} ${BASE_TD_SERVER_TAR} ${baseVersion} server
|
bash testpackage.sh ${TD_SERVER_DEB} ${version} ${BASE_TD_SERVER_TAR} ${baseVersion} server ${sourcePath}
|
||||||
python3 checkPackageRuning.py
|
python3 checkPackageRuning.py
|
||||||
'''
|
'''
|
||||||
}
|
}
|
||||||
|
@ -127,17 +132,17 @@ pipeline {
|
||||||
sync_source("${BRANCH_NAME}")
|
sync_source("${BRANCH_NAME}")
|
||||||
sh '''
|
sh '''
|
||||||
cd ${TDENGINE_ROOT_DIR}/packaging
|
cd ${TDENGINE_ROOT_DIR}/packaging
|
||||||
bash testpackage.sh ${TD_SERVER_TAR} ${version} ${BASE_TD_SERVER_TAR} ${baseVersion} server
|
bash testpackage.sh ${TD_SERVER_TAR} ${version} ${BASE_TD_SERVER_TAR} ${baseVersion} server ${sourcePath}
|
||||||
python3 checkPackageRuning.py
|
python3 checkPackageRuning.py
|
||||||
'''
|
'''
|
||||||
sh '''
|
sh '''
|
||||||
cd ${TDENGINE_ROOT_DIR}/packaging
|
cd ${TDENGINE_ROOT_DIR}/packaging
|
||||||
bash testpackage.sh ${TD_SERVER_LITE_TAR} ${version} ${BASE_TD_SERVER_LITE_TAR} ${baseVersion} server
|
bash testpackage.sh ${TD_SERVER_LITE_TAR} ${version} ${BASE_TD_SERVER_LITE_TAR} ${baseVersion} server ${sourcePath}
|
||||||
python3 checkPackageRuning.py
|
python3 checkPackageRuning.py
|
||||||
'''
|
'''
|
||||||
sh '''
|
sh '''
|
||||||
cd ${TDENGINE_ROOT_DIR}/packaging
|
cd ${TDENGINE_ROOT_DIR}/packaging
|
||||||
bash testpackage.sh ${TD_SERVER_DEB} ${version} ${BASE_TD_SERVER_TAR} ${baseVersion} server
|
bash testpackage.sh ${TD_SERVER_DEB} ${version} ${BASE_TD_SERVER_TAR} ${baseVersion} server ${sourcePath}
|
||||||
python3 checkPackageRuning.py
|
python3 checkPackageRuning.py
|
||||||
dpkg -r tdengine
|
dpkg -r tdengine
|
||||||
'''
|
'''
|
||||||
|
@ -152,17 +157,17 @@ pipeline {
|
||||||
sync_source("${BRANCH_NAME}")
|
sync_source("${BRANCH_NAME}")
|
||||||
sh '''
|
sh '''
|
||||||
cd ${TDENGINE_ROOT_DIR}/packaging
|
cd ${TDENGINE_ROOT_DIR}/packaging
|
||||||
bash testpackage.sh ${TD_SERVER_TAR} ${version} ${BASE_TD_SERVER_TAR} ${baseVersion} server
|
bash testpackage.sh ${TD_SERVER_TAR} ${version} ${BASE_TD_SERVER_TAR} ${baseVersion} server ${sourcePath}
|
||||||
python3 checkPackageRuning.py
|
python3 checkPackageRuning.py
|
||||||
'''
|
'''
|
||||||
sh '''
|
sh '''
|
||||||
cd ${TDENGINE_ROOT_DIR}/packaging
|
cd ${TDENGINE_ROOT_DIR}/packaging
|
||||||
bash testpackage.sh ${TD_SERVER_LITE_TAR} ${version} ${BASE_TD_SERVER_LITE_TAR} ${baseVersion} server
|
bash testpackage.sh ${TD_SERVER_LITE_TAR} ${version} ${BASE_TD_SERVER_LITE_TAR} ${baseVersion} server ${sourcePath}
|
||||||
python3 checkPackageRuning.py
|
python3 checkPackageRuning.py
|
||||||
'''
|
'''
|
||||||
sh '''
|
sh '''
|
||||||
cd ${TDENGINE_ROOT_DIR}/packaging
|
cd ${TDENGINE_ROOT_DIR}/packaging
|
||||||
bash testpackage.sh ${TD_SERVER_RPM} ${version} ${BASE_TD_SERVER_TAR} ${baseVersion} server
|
bash testpackage.sh ${TD_SERVER_RPM} ${version} ${BASE_TD_SERVER_TAR} ${baseVersion} server ${sourcePath}
|
||||||
python3 checkPackageRuning.py
|
python3 checkPackageRuning.py
|
||||||
'''
|
'''
|
||||||
}
|
}
|
||||||
|
@ -175,17 +180,17 @@ pipeline {
|
||||||
sync_source("${BRANCH_NAME}")
|
sync_source("${BRANCH_NAME}")
|
||||||
sh '''
|
sh '''
|
||||||
cd ${TDENGINE_ROOT_DIR}/packaging
|
cd ${TDENGINE_ROOT_DIR}/packaging
|
||||||
bash testpackage.sh ${TD_SERVER_TAR} ${version} ${BASE_TD_SERVER_TAR} ${baseVersion} server
|
bash testpackage.sh ${TD_SERVER_TAR} ${version} ${BASE_TD_SERVER_TAR} ${baseVersion} server ${sourcePath}
|
||||||
python3 checkPackageRuning.py
|
python3 checkPackageRuning.py
|
||||||
'''
|
'''
|
||||||
sh '''
|
sh '''
|
||||||
cd ${TDENGINE_ROOT_DIR}/packaging
|
cd ${TDENGINE_ROOT_DIR}/packaging
|
||||||
bash testpackage.sh ${TD_SERVER_LITE_TAR} ${version} ${BASE_TD_SERVER_LITE_TAR} ${baseVersion} server
|
bash testpackage.sh ${TD_SERVER_LITE_TAR} ${version} ${BASE_TD_SERVER_LITE_TAR} ${baseVersion} server ${sourcePath}
|
||||||
python3 checkPackageRuning.py
|
python3 checkPackageRuning.py
|
||||||
'''
|
'''
|
||||||
sh '''
|
sh '''
|
||||||
cd ${TDENGINE_ROOT_DIR}/packaging
|
cd ${TDENGINE_ROOT_DIR}/packaging
|
||||||
bash testpackage.sh ${TD_SERVER_RPM} ${version} ${BASE_TD_SERVER_TAR} ${baseVersion} server
|
bash testpackage.sh ${TD_SERVER_RPM} ${version} ${BASE_TD_SERVER_TAR} ${baseVersion} server ${sourcePath}
|
||||||
python3 checkPackageRuning.py
|
python3 checkPackageRuning.py
|
||||||
sudo rpm -e tdengine
|
sudo rpm -e tdengine
|
||||||
'''
|
'''
|
||||||
|
@ -199,7 +204,7 @@ pipeline {
|
||||||
sync_source("${BRANCH_NAME}")
|
sync_source("${BRANCH_NAME}")
|
||||||
sh '''
|
sh '''
|
||||||
cd ${TDENGINE_ROOT_DIR}/packaging
|
cd ${TDENGINE_ROOT_DIR}/packaging
|
||||||
bash testpackage.sh ${TD_SERVER_ARM_TAR} ${version} ${BASE_TD_SERVER_ARM_TAR} ${baseVersion} server
|
bash testpackage.sh ${TD_SERVER_ARM_TAR} ${version} ${BASE_TD_SERVER_ARM_TAR} ${baseVersion} server ${sourcePath}
|
||||||
python3 checkPackageRuning.py
|
python3 checkPackageRuning.py
|
||||||
'''
|
'''
|
||||||
}
|
}
|
||||||
|
@ -215,7 +220,7 @@ pipeline {
|
||||||
timeout(time: 30, unit: 'MINUTES'){
|
timeout(time: 30, unit: 'MINUTES'){
|
||||||
sh '''
|
sh '''
|
||||||
cd ${TDENGINE_ROOT_DIR}/packaging
|
cd ${TDENGINE_ROOT_DIR}/packaging
|
||||||
bash testpackage.sh ${TD_CLIENT_TAR} ${version} ${BASE_TD_CLIENT_TAR} ${baseVersion} client
|
bash testpackage.sh ${TD_CLIENT_TAR} ${version} ${BASE_TD_CLIENT_TAR} ${baseVersion} client ${sourcePath}
|
||||||
python3 checkPackageRuning.py 192.168.0.21
|
python3 checkPackageRuning.py 192.168.0.21
|
||||||
'''
|
'''
|
||||||
}
|
}
|
||||||
|
@ -227,7 +232,7 @@ pipeline {
|
||||||
timeout(time: 30, unit: 'MINUTES'){
|
timeout(time: 30, unit: 'MINUTES'){
|
||||||
sh '''
|
sh '''
|
||||||
cd ${TDENGINE_ROOT_DIR}/packaging
|
cd ${TDENGINE_ROOT_DIR}/packaging
|
||||||
bash testpackage.sh ${TD_CLIENT_LITE_TAR} ${version} ${BASE_TD_CLIENT_LITE_TAR} ${baseVersion} client
|
bash testpackage.sh ${TD_CLIENT_LITE_TAR} ${version} ${BASE_TD_CLIENT_LITE_TAR} ${baseVersion} client ${sourcePath}
|
||||||
python3 checkPackageRuning.py 192.168.0.24
|
python3 checkPackageRuning.py 192.168.0.24
|
||||||
'''
|
'''
|
||||||
}
|
}
|
||||||
|
@ -241,7 +246,7 @@ pipeline {
|
||||||
timeout(time: 30, unit: 'MINUTES'){
|
timeout(time: 30, unit: 'MINUTES'){
|
||||||
sh '''
|
sh '''
|
||||||
cd ${TDENGINE_ROOT_DIR}/packaging
|
cd ${TDENGINE_ROOT_DIR}/packaging
|
||||||
bash testpackage.sh ${TD_CLIENT_ARM_TAR} ${version} ${BASE_TD_CLIENT_ARM_TAR} ${baseVersion} client
|
bash testpackage.sh ${TD_CLIENT_ARM_TAR} ${version} ${BASE_TD_CLIENT_ARM_TAR} ${baseVersion} client ${sourcePath}
|
||||||
python3 checkPackageRuning.py 192.168.0.21
|
python3 checkPackageRuning.py 192.168.0.21
|
||||||
'''
|
'''
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ if not exist %work_dir%\debug\ver-%2-x86 (
|
||||||
md %work_dir%\debug\ver-%2-x86
|
md %work_dir%\debug\ver-%2-x86
|
||||||
)
|
)
|
||||||
cd %work_dir%\debug\ver-%2-x64
|
cd %work_dir%\debug\ver-%2-x64
|
||||||
call vcvarsall.bat x64
|
rem #call vcvarsall.bat x64
|
||||||
cmake ../../ -G "NMake Makefiles JOM" -DCMAKE_MAKE_PROGRAM=jom -DBUILD_TOOLS=true -DWEBSOCKET=true -DBUILD_HTTP=false -DBUILD_TEST=false -DVERNUMBER=%2 -DCPUTYPE=x64
|
cmake ../../ -G "NMake Makefiles JOM" -DCMAKE_MAKE_PROGRAM=jom -DBUILD_TOOLS=true -DWEBSOCKET=true -DBUILD_HTTP=false -DBUILD_TEST=false -DVERNUMBER=%2 -DCPUTYPE=x64
|
||||||
cmake --build .
|
cmake --build .
|
||||||
rd /s /Q C:\TDengine
|
rd /s /Q C:\TDengine
|
||||||
|
|
|
@ -6,6 +6,8 @@ version=$2
|
||||||
originPackageName=$3
|
originPackageName=$3
|
||||||
originversion=$4
|
originversion=$4
|
||||||
testFile=$5
|
testFile=$5
|
||||||
|
# sourcePath:web/nas
|
||||||
|
sourcePath=$6
|
||||||
subFile="taos.tar.gz"
|
subFile="taos.tar.gz"
|
||||||
|
|
||||||
# Color setting
|
# Color setting
|
||||||
|
@ -67,16 +69,27 @@ fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function wgetFile {
|
function wgetFile {
|
||||||
|
|
||||||
file=$1
|
file=$1
|
||||||
|
versionPath=$2
|
||||||
if [ ! -f ${file} ];then
|
sourceP=$3
|
||||||
echoColor BD "wget https://www.taosdata.com/assets-download/3.0/${file}"
|
nasServerIP="192.168.1.131"
|
||||||
wget https://www.taosdata.com/assets-download/3.0/${file}
|
packagePath="/nas/TDengine/v${versionPath}/community"
|
||||||
else
|
if [ -f ${file} ];then
|
||||||
echoColor YD "${file} already exists "
|
echoColor YD "${file} already exists ,it will delete it and download it again "
|
||||||
|
rm -rf ${file}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ ${sourceP} = 'web' ];then
|
||||||
|
echoColor BD "====download====:wget https://www.taosdata.com/assets-download/3.0/${file}"
|
||||||
|
wget https://www.taosdata.com/assets-download/3.0/${file}
|
||||||
|
elif [ ${sourceP} = 'nas' ];then
|
||||||
|
echoColor BD "====download====:scp root@${nasServerIP}:${packagePath}/${file} ."
|
||||||
|
scp root@${nasServerIP}:${packagePath}/${file} .
|
||||||
|
fi
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function newPath {
|
function newPath {
|
||||||
|
@ -138,8 +151,9 @@ if [ -d ${installPath}/${tdPath} ] ;then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echoColor G "===== download installPackage ====="
|
echoColor G "===== download installPackage ====="
|
||||||
cd ${installPath} && wgetFile ${packgeName}
|
cd ${installPath} && wgetFile ${packgeName} ${version} ${sourcePath}
|
||||||
cd ${oriInstallPath} && wgetFile ${originPackageName}
|
cd ${oriInstallPath} && wgetFile ${originPackageName} ${originversion} ${sourcePath}
|
||||||
|
|
||||||
|
|
||||||
cd ${installPath}
|
cd ${installPath}
|
||||||
cp -r ${scriptDir}/debRpmAutoInstall.sh .
|
cp -r ${scriptDir}/debRpmAutoInstall.sh .
|
||||||
|
@ -189,7 +203,7 @@ elif [[ ${packgeName} =~ "tar" ]];then
|
||||||
cd ${oriInstallPath}
|
cd ${oriInstallPath}
|
||||||
if [ ! -f {originPackageName} ];then
|
if [ ! -f {originPackageName} ];then
|
||||||
echoColor YD "download base installPackage"
|
echoColor YD "download base installPackage"
|
||||||
wgetFile ${originPackageName}
|
wgetFile ${originPackageName} ${originversion} ${sourcePath}
|
||||||
fi
|
fi
|
||||||
echoColor YD "unzip the base installation package"
|
echoColor YD "unzip the base installation package"
|
||||||
echoColor BD "tar -xf ${originPackageName}" && tar -xf ${originPackageName}
|
echoColor BD "tar -xf ${originPackageName}" && tar -xf ${originPackageName}
|
||||||
|
@ -211,7 +225,8 @@ elif [[ ${packgeName} =~ "tar" ]];then
|
||||||
|
|
||||||
if [ ${diffNumbers} != 0 ];then
|
if [ ${diffNumbers} != 0 ];then
|
||||||
echoColor R "The number and names of files is different from the previous installation package"
|
echoColor R "The number and names of files is different from the previous installation package"
|
||||||
echoColor Y `cat ${installPath}/diffFile.log`
|
diffLog=`cat ${installPath}/diffFile.log`
|
||||||
|
echoColor Y "${diffLog}"
|
||||||
exit -1
|
exit -1
|
||||||
else
|
else
|
||||||
echoColor G "The number and names of files are the same as previous installation packages"
|
echoColor G "The number and names of files are the same as previous installation packages"
|
||||||
|
@ -233,14 +248,19 @@ cd ${installPath}
|
||||||
if [[ ${packgeName} =~ "Lite" ]] || ([[ ${packgeName} =~ "x64" ]] && [[ ${packgeName} =~ "client" ]]) || ([[ ${packgeName} =~ "deb" ]] && [[ ${packgeName} =~ "server" ]]) || ([[ ${packgeName} =~ "rpm" ]] && [[ ${packgeName} =~ "server" ]]) ;then
|
if [[ ${packgeName} =~ "Lite" ]] || ([[ ${packgeName} =~ "x64" ]] && [[ ${packgeName} =~ "client" ]]) || ([[ ${packgeName} =~ "deb" ]] && [[ ${packgeName} =~ "server" ]]) || ([[ ${packgeName} =~ "rpm" ]] && [[ ${packgeName} =~ "server" ]]) ;then
|
||||||
echoColor G "===== install taos-tools when package is lite or client ====="
|
echoColor G "===== install taos-tools when package is lite or client ====="
|
||||||
cd ${installPath}
|
cd ${installPath}
|
||||||
wgetFile taosTools-2.1.3-Linux-x64.tar.gz .
|
if [ ! -f "taosTools-2.1.3-Linux-x64.tar.gz " ];then
|
||||||
tar xf taosTools-2.1.3-Linux-x64.tar.gz
|
wgetFile taosTools-2.1.3-Linux-x64.tar.gz v2.1.3 web
|
||||||
|
tar xf taosTools-2.1.3-Linux-x64.tar.gz
|
||||||
|
fi
|
||||||
cd taosTools-2.1.3 && bash install-taostools.sh
|
cd taosTools-2.1.3 && bash install-taostools.sh
|
||||||
elif ([[ ${packgeName} =~ "arm64" ]] && [[ ${packgeName} =~ "client" ]]);then
|
elif ([[ ${packgeName} =~ "arm64" ]] && [[ ${packgeName} =~ "client" ]]);then
|
||||||
echoColor G "===== install taos-tools arm when package is arm64-client ====="
|
echoColor G "===== install taos-tools arm when package is arm64-client ====="
|
||||||
cd ${installPath}
|
cd ${installPath}
|
||||||
wgetFile taosTools-2.1.3-Linux-arm64.tar.gz .
|
if [ ! -f "taosTools-2.1.3-Linux-x64.tar.gz " ];then
|
||||||
tar xf taosTools-2.1.3-Linux-arm64.tar.gz
|
wgetFile taosTools-2.1.3-Linux-x64.tar.gz v2.1.3 web
|
||||||
|
tar xf taosTools-2.1.3-Linux-arm64.tar.gz
|
||||||
|
fi
|
||||||
|
|
||||||
cd taosTools-2.1.3 && bash install-taostools.sh
|
cd taosTools-2.1.3 && bash install-taostools.sh
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
@echo off
|
@echo off
|
||||||
|
|
||||||
|
for /F %%a in ('echo prompt $E ^| cmd') do set "ESC=%%a"
|
||||||
|
|
||||||
goto %1
|
goto %1
|
||||||
:needAdmin
|
:needAdmin
|
||||||
|
|
||||||
|
@ -11,59 +14,94 @@ set binary_dir=%3
|
||||||
set binary_dir=%binary_dir:/=\\%
|
set binary_dir=%binary_dir:/=\\%
|
||||||
set osType=%4
|
set osType=%4
|
||||||
set verNumber=%5
|
set verNumber=%5
|
||||||
set tagert_dir=C:\\TDengine
|
set target_dir=C:\\TDengine
|
||||||
|
|
||||||
if not exist %tagert_dir% (
|
if not exist %target_dir% (
|
||||||
mkdir %tagert_dir%
|
mkdir %target_dir%
|
||||||
)
|
)
|
||||||
if not exist %tagert_dir%\\cfg (
|
if not exist %target_dir%\\cfg (
|
||||||
mkdir %tagert_dir%\\cfg
|
mkdir %target_dir%\\cfg
|
||||||
)
|
)
|
||||||
if not exist %tagert_dir%\\include (
|
if not exist %target_dir%\\include (
|
||||||
mkdir %tagert_dir%\\include
|
mkdir %target_dir%\\include
|
||||||
)
|
)
|
||||||
if not exist %tagert_dir%\\driver (
|
if not exist %target_dir%\\driver (
|
||||||
mkdir %tagert_dir%\\driver
|
mkdir %target_dir%\\driver
|
||||||
)
|
)
|
||||||
if not exist C:\\TDengine\\cfg\\taos.cfg (
|
if not exist C:\\TDengine\\cfg\\taos.cfg (
|
||||||
copy %source_dir%\\packaging\\cfg\\taos.cfg %tagert_dir%\\cfg\\taos.cfg > nul
|
copy %source_dir%\\packaging\\cfg\\taos.cfg %target_dir%\\cfg\\taos.cfg > nul
|
||||||
)
|
)
|
||||||
|
|
||||||
if exist %binary_dir%\\test\\cfg\\taosadapter.toml (
|
if exist %binary_dir%\\test\\cfg\\taosadapter.toml (
|
||||||
if not exist %tagert_dir%\\cfg\\taosadapter.toml (
|
if not exist %target_dir%\\cfg\\taosadapter.toml (
|
||||||
copy %binary_dir%\\test\\cfg\\taosadapter.toml %tagert_dir%\\cfg\\taosadapter.toml > nul
|
copy %binary_dir%\\test\\cfg\\taosadapter.toml %target_dir%\\cfg\\taosadapter.toml > nul
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
copy %source_dir%\\include\\client\\taos.h %tagert_dir%\\include > nul
|
copy %source_dir%\\include\\client\\taos.h %target_dir%\\include > nul
|
||||||
copy %source_dir%\\include\\util\\taoserror.h %tagert_dir%\\include > nul
|
copy %source_dir%\\include\\util\\taoserror.h %target_dir%\\include > nul
|
||||||
copy %source_dir%\\include\\libs\\function\\taosudf.h %tagert_dir%\\include > nul
|
copy %source_dir%\\include\\libs\\function\\taosudf.h %target_dir%\\include > nul
|
||||||
copy %binary_dir%\\build\\lib\\taos.lib %tagert_dir%\\driver > nul
|
copy %binary_dir%\\build\\lib\\taos.lib %target_dir%\\driver > nul
|
||||||
copy %binary_dir%\\build\\lib\\taos_static.lib %tagert_dir%\\driver > nul
|
copy %binary_dir%\\build\\lib\\taos_static.lib %target_dir%\\driver > nul
|
||||||
copy %binary_dir%\\build\\lib\\taos.dll %tagert_dir%\\driver > nul
|
copy %binary_dir%\\build\\lib\\taos.dll %target_dir%\\driver > nul
|
||||||
copy %binary_dir%\\build\\bin\\taos.exe %tagert_dir% > nul
|
copy %binary_dir%\\build\\bin\\taos.exe %target_dir% > nul
|
||||||
copy %binary_dir%\\build\\bin\\taosd.exe %tagert_dir% > nul
|
|
||||||
copy %binary_dir%\\build\\bin\\udfd.exe %tagert_dir% > nul
|
|
||||||
if exist %binary_dir%\\build\\bin\\taosBenchmark.exe (
|
if exist %binary_dir%\\build\\bin\\taosBenchmark.exe (
|
||||||
copy %binary_dir%\\build\\bin\\taosBenchmark.exe %tagert_dir% > nul
|
copy %binary_dir%\\build\\bin\\taosBenchmark.exe %target_dir% > nul
|
||||||
)
|
)
|
||||||
if exist %binary_dir%\\build\\lib\\taosws.dll.lib (
|
if exist %binary_dir%\\build\\lib\\taosws.dll.lib (
|
||||||
copy %binary_dir%\\build\\lib\\taosws.dll.lib %tagert_dir%\\driver > nul
|
copy %binary_dir%\\build\\lib\\taosws.dll.lib %target_dir%\\driver > nul
|
||||||
)
|
)
|
||||||
if exist %binary_dir%\\build\\lib\\taosws.dll (
|
if exist %binary_dir%\\build\\lib\\taosws.dll (
|
||||||
copy %binary_dir%\\build\\lib\\taosws.dll %tagert_dir%\\driver > nul
|
copy %binary_dir%\\build\\lib\\taosws.dll %target_dir%\\driver > nul
|
||||||
copy %source_dir%\\tools\\taosws-rs\\target\\release\\taosws.h %tagert_dir%\\include > nul
|
copy %source_dir%\\tools\\taosws-rs\\target\\release\\taosws.h %target_dir%\\include > nul
|
||||||
)
|
)
|
||||||
if exist %binary_dir%\\build\\bin\\taosdump.exe (
|
if exist %binary_dir%\\build\\bin\\taosdump.exe (
|
||||||
copy %binary_dir%\\build\\bin\\taosdump.exe %tagert_dir% > nul
|
copy %binary_dir%\\build\\bin\\taosdump.exe %target_dir% > nul
|
||||||
)
|
|
||||||
if exist %binary_dir%\\build\\bin\\taosadapter.exe (
|
|
||||||
copy %binary_dir%\\build\\bin\\taosadapter.exe %tagert_dir% > nul
|
|
||||||
)
|
)
|
||||||
|
|
||||||
mshta vbscript:createobject("shell.application").shellexecute("%~s0",":hasAdmin","","runas",1)(window.close)&& echo To start/stop TDengine with administrator privileges: sc start/stop taosd &goto :eof
|
copy %binary_dir%\\build\\bin\\taosd.exe %target_dir% > nul
|
||||||
|
copy %binary_dir%\\build\\bin\\udfd.exe %target_dir% > nul
|
||||||
|
|
||||||
|
if exist %binary_dir%\\build\\bin\\taosadapter.exe (
|
||||||
|
copy %binary_dir%\\build\\bin\\taosadapter.exe %target_dir% > nul
|
||||||
|
)
|
||||||
|
|
||||||
|
mshta vbscript:createobject("shell.application").shellexecute("%~s0",":hasAdmin","","runas",1)(window.close)
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo Please manually remove C:\TDengine from your system PATH environment after you remove TDengine software
|
||||||
|
echo.
|
||||||
|
echo To start/stop TDengine with administrator privileges: %ESC%[92msc start/stop taosd %ESC%[0m
|
||||||
|
|
||||||
|
if exist %binary_dir%\\build\\bin\\taosadapter.exe (
|
||||||
|
echo To start/stop taosAdapter with administrator privileges: %ESC%[92msc start/stop taosadapter %ESC%[0m
|
||||||
|
)
|
||||||
|
|
||||||
|
goto :eof
|
||||||
|
|
||||||
:hasAdmin
|
:hasAdmin
|
||||||
|
|
||||||
|
sc query "taosd" && sc stop taosd && sc delete taosd
|
||||||
|
sc query "taosadapter" && sc stop taosadapter && sc delete taosd
|
||||||
|
|
||||||
copy /y C:\\TDengine\\driver\\taos.dll C:\\Windows\\System32 > nul
|
copy /y C:\\TDengine\\driver\\taos.dll C:\\Windows\\System32 > nul
|
||||||
if exist C:\\TDengine\\driver\\taosws.dll (
|
if exist C:\\TDengine\\driver\\taosws.dll (
|
||||||
copy /y C:\\TDengine\\driver\\taosws.dll C:\\Windows\\System32 > nul
|
copy /y C:\\TDengine\\driver\\taosws.dll C:\\Windows\\System32 > nul
|
||||||
)
|
)
|
||||||
|
|
||||||
sc query "taosd" >nul || sc create "taosd" binPath= "C:\\TDengine\\taosd.exe --win_service" start= DEMAND
|
sc query "taosd" >nul || sc create "taosd" binPath= "C:\\TDengine\\taosd.exe --win_service" start= DEMAND
|
||||||
|
sc query "taosadapter" >nul || sc create "taosadapter" binPath= "C:\\TDengine\\taosadapter.exe" start= DEMAND
|
||||||
|
|
||||||
|
set "env=HKLM\System\CurrentControlSet\Control\Session Manager\Environment"
|
||||||
|
for /f "tokens=2*" %%I in ('reg query "%env%" /v Path ^| findstr /i "\<Path\>"') do (
|
||||||
|
|
||||||
|
rem // make addition persistent through reboots
|
||||||
|
reg add "%env%" /f /v Path /t REG_EXPAND_SZ /d "%%J;C:\TDengine"
|
||||||
|
|
||||||
|
rem // apply change to the current process
|
||||||
|
for %%a in ("%%J;C:\TDengine") do path %%~a
|
||||||
|
)
|
||||||
|
|
||||||
|
rem // use setx to set a temporary throwaway value to trigger a WM_SETTINGCHANGE
|
||||||
|
rem // applies change to new console windows without requiring a reboot
|
||||||
|
(setx /m foo bar & reg delete "%env%" /f /v foo) >NUL 2>NUL
|
||||||
|
|
||||||
|
|
|
@ -60,6 +60,29 @@ Source: {#MyAppSourceDir}{#MyAppIncludeName}; DestDir: "{app}\include"; Flags: i
|
||||||
Source: {#MyAppSourceDir}{#MyAppExeName}; DestDir: "{app}"; Excludes: {#MyAppExcludeSource} ; Flags: igNoreversion recursesubdirs createallsubdirs
|
Source: {#MyAppSourceDir}{#MyAppExeName}; DestDir: "{app}"; Excludes: {#MyAppExcludeSource} ; Flags: igNoreversion recursesubdirs createallsubdirs
|
||||||
Source: {#MyAppSourceDir}{#MyAppTaosdemoExeName}; DestDir: "{app}"; Flags: igNoreversion recursesubdirs createallsubdirs
|
Source: {#MyAppSourceDir}{#MyAppTaosdemoExeName}; DestDir: "{app}"; Flags: igNoreversion recursesubdirs createallsubdirs
|
||||||
|
|
||||||
|
|
||||||
|
[Registry]
|
||||||
|
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; \
|
||||||
|
ValueType: expandsz; ValueName: "Path"; ValueData: "{olddata};C:\TDengine"; \
|
||||||
|
Check: NeedsAddPath('C:\TDengine')
|
||||||
|
|
||||||
|
[Code]
|
||||||
|
function NeedsAddPath(Param: string): boolean;
|
||||||
|
var
|
||||||
|
OrigPath: string;
|
||||||
|
begin
|
||||||
|
if not RegQueryStringValue(HKEY_LOCAL_MACHINE,
|
||||||
|
'SYSTEM\CurrentControlSet\Control\Session Manager\Environment',
|
||||||
|
'Path', OrigPath)
|
||||||
|
then begin
|
||||||
|
Result := True;
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
{ look for the path with leading and trailing semicolon }
|
||||||
|
{ Pos() returns 0 if not found }
|
||||||
|
Result := Pos(';' + Param + ';', ';' + OrigPath + ';') = 0;
|
||||||
|
end;
|
||||||
|
|
||||||
[UninstallDelete]
|
[UninstallDelete]
|
||||||
Name: {app}\driver; Type: filesandordirs
|
Name: {app}\driver; Type: filesandordirs
|
||||||
Name: {app}\connector; Type: filesandordirs
|
Name: {app}\connector; Type: filesandordirs
|
||||||
|
|
|
@ -271,7 +271,11 @@ int32_t transferTableNameList(const char* tbList, int32_t acctId, char* dbName,
|
||||||
void syncCatalogFn(SMetaData* pResult, void* param, int32_t code);
|
void syncCatalogFn(SMetaData* pResult, void* param, int32_t code);
|
||||||
|
|
||||||
TAOS_RES* taosQueryImpl(TAOS* taos, const char* sql, bool validateOnly);
|
TAOS_RES* taosQueryImpl(TAOS* taos, const char* sql, bool validateOnly);
|
||||||
void taosAsyncQueryImpl(uint64_t connId, const char* sql, __taos_async_fn_t fp, void* param, bool validateOnly);
|
TAOS_RES* taosQueryImplWithReqid(TAOS* taos, const char* sql, bool validateOnly, int64_t reqid);
|
||||||
|
|
||||||
|
void taosAsyncQueryImpl(uint64_t connId, const char* sql, __taos_async_fn_t fp, void* param, bool validateOnly);
|
||||||
|
void taosAsyncQueryImplWithReqid(uint64_t connId, const char* sql, __taos_async_fn_t fp, void* param, bool validateOnly,
|
||||||
|
int64_t reqid);
|
||||||
|
|
||||||
int32_t getVersion1BlockMetaSize(const char* p, int32_t numOfCols);
|
int32_t getVersion1BlockMetaSize(const char* p, int32_t numOfCols);
|
||||||
|
|
||||||
|
@ -318,10 +322,11 @@ void* createTscObj(const char* user, const char* auth, const char* db, int32_
|
||||||
void destroyTscObj(void* pObj);
|
void destroyTscObj(void* pObj);
|
||||||
STscObj* acquireTscObj(int64_t rid);
|
STscObj* acquireTscObj(int64_t rid);
|
||||||
int32_t releaseTscObj(int64_t rid);
|
int32_t releaseTscObj(int64_t rid);
|
||||||
|
void destroyAppInst(SAppInstInfo* pAppInfo);
|
||||||
|
|
||||||
uint64_t generateRequestId();
|
uint64_t generateRequestId();
|
||||||
|
|
||||||
void* createRequest(uint64_t connId, int32_t type);
|
void* createRequest(uint64_t connId, int32_t type, int64_t reqid);
|
||||||
void destroyRequest(SRequestObj* pRequest);
|
void destroyRequest(SRequestObj* pRequest);
|
||||||
SRequestObj* acquireRequest(int64_t rid);
|
SRequestObj* acquireRequest(int64_t rid);
|
||||||
int32_t releaseRequest(int64_t rid);
|
int32_t releaseRequest(int64_t rid);
|
||||||
|
@ -352,7 +357,7 @@ int32_t parseSql(SRequestObj* pRequest, bool topicQuery, SQuery** pQuery, SStmtC
|
||||||
int32_t getPlan(SRequestObj* pRequest, SQuery* pQuery, SQueryPlan** pPlan, SArray* pNodeList);
|
int32_t getPlan(SRequestObj* pRequest, SQuery* pQuery, SQueryPlan** pPlan, SArray* pNodeList);
|
||||||
|
|
||||||
int32_t buildRequest(uint64_t connId, const char* sql, int sqlLen, void* param, bool validateSql,
|
int32_t buildRequest(uint64_t connId, const char* sql, int sqlLen, void* param, bool validateSql,
|
||||||
SRequestObj** pRequest);
|
SRequestObj** pRequest, int64_t reqid);
|
||||||
|
|
||||||
void taos_close_internal(void* taos);
|
void taos_close_internal(void* taos);
|
||||||
|
|
||||||
|
@ -379,7 +384,6 @@ void hbMgrInitMqHbRspHandle();
|
||||||
typedef struct SSqlCallbackWrapper {
|
typedef struct SSqlCallbackWrapper {
|
||||||
SParseContext* pParseCtx;
|
SParseContext* pParseCtx;
|
||||||
SCatalogReq* pCatalogReq;
|
SCatalogReq* pCatalogReq;
|
||||||
SMetaData* pResultMeta;
|
|
||||||
SRequestObj* pRequest;
|
SRequestObj* pRequest;
|
||||||
} SSqlCallbackWrapper;
|
} SSqlCallbackWrapper;
|
||||||
|
|
||||||
|
@ -393,7 +397,7 @@ int32_t removeMeta(STscObj* pTscObj, SArray* tbList);
|
||||||
int32_t handleAlterTbExecRes(void* res, struct SCatalog* pCatalog);
|
int32_t handleAlterTbExecRes(void* res, struct SCatalog* pCatalog);
|
||||||
int32_t handleCreateTbExecRes(void* res, SCatalog* pCatalog);
|
int32_t handleCreateTbExecRes(void* res, SCatalog* pCatalog);
|
||||||
bool qnodeRequired(SRequestObj* pRequest);
|
bool qnodeRequired(SRequestObj* pRequest);
|
||||||
int32_t continueInsertFromCsv(SSqlCallbackWrapper* pWrapper, SRequestObj* pRequest);
|
void continueInsertFromCsv(SSqlCallbackWrapper* pWrapper, SRequestObj* pRequest);
|
||||||
void destorySqlCallbackWrapper(SSqlCallbackWrapper* pWrapper);
|
void destorySqlCallbackWrapper(SSqlCallbackWrapper* pWrapper);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -39,6 +39,7 @@ typedef enum {
|
||||||
STMT_BIND_COL,
|
STMT_BIND_COL,
|
||||||
STMT_ADD_BATCH,
|
STMT_ADD_BATCH,
|
||||||
STMT_EXECUTE,
|
STMT_EXECUTE,
|
||||||
|
STMT_MAX,
|
||||||
} STMT_STATUS;
|
} STMT_STATUS;
|
||||||
|
|
||||||
typedef struct SStmtTableCache {
|
typedef struct SStmtTableCache {
|
||||||
|
@ -94,12 +95,25 @@ typedef struct STscStmt {
|
||||||
STscObj *taos;
|
STscObj *taos;
|
||||||
SCatalog *pCatalog;
|
SCatalog *pCatalog;
|
||||||
int32_t affectedRows;
|
int32_t affectedRows;
|
||||||
|
uint32_t seqId;
|
||||||
|
uint32_t seqIds[STMT_MAX];
|
||||||
|
|
||||||
SStmtSQLInfo sql;
|
SStmtSQLInfo sql;
|
||||||
SStmtExecInfo exec;
|
SStmtExecInfo exec;
|
||||||
SStmtBindInfo bInfo;
|
SStmtBindInfo bInfo;
|
||||||
|
|
||||||
|
int64_t reqid;
|
||||||
} STscStmt;
|
} STscStmt;
|
||||||
|
|
||||||
|
extern char *gStmtStatusStr[];
|
||||||
|
|
||||||
|
#define STMT_LOG_SEQ(n) \
|
||||||
|
do { \
|
||||||
|
(pStmt)->seqId++; \
|
||||||
|
(pStmt)->seqIds[n]++; \
|
||||||
|
STMT_DLOG("the %dth:%d %s", (pStmt)->seqIds[n], (pStmt)->seqId, gStmtStatusStr[n]); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
#define STMT_STATUS_NE(S) (pStmt->sql.status != STMT_##S)
|
#define STMT_STATUS_NE(S) (pStmt->sql.status != STMT_##S)
|
||||||
#define STMT_STATUS_EQ(S) (pStmt->sql.status == STMT_##S)
|
#define STMT_STATUS_EQ(S) (pStmt->sql.status == STMT_##S)
|
||||||
|
|
||||||
|
@ -128,7 +142,13 @@ typedef struct STscStmt {
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
TAOS_STMT *stmtInit(STscObj *taos);
|
#define STMT_ELOG(param, ...) qError("stmt:%p " param, pStmt, __VA_ARGS__)
|
||||||
|
#define STMT_DLOG(param, ...) qDebug("stmt:%p " param, pStmt, __VA_ARGS__)
|
||||||
|
|
||||||
|
#define STMT_ELOG_E(param) qError("stmt:%p " param, pStmt)
|
||||||
|
#define STMT_DLOG_E(param) qDebug("stmt:%p " param, pStmt)
|
||||||
|
|
||||||
|
TAOS_STMT *stmtInit(STscObj *taos, int64_t reqid);
|
||||||
int stmtClose(TAOS_STMT *stmt);
|
int stmtClose(TAOS_STMT *stmt);
|
||||||
int stmtExec(TAOS_STMT *stmt);
|
int stmtExec(TAOS_STMT *stmt);
|
||||||
const char *stmtErrstr(TAOS_STMT *stmt);
|
const char *stmtErrstr(TAOS_STMT *stmt);
|
||||||
|
|
|
@ -77,19 +77,19 @@ static void deregisterRequest(SRequestObj *pRequest) {
|
||||||
pRequest->self, pTscObj->id, pRequest->requestId, duration / 1000.0, num, currentInst);
|
pRequest->self, pTscObj->id, pRequest->requestId, duration / 1000.0, num, currentInst);
|
||||||
|
|
||||||
if (QUERY_NODE_VNODE_MODIF_STMT == pRequest->stmtType) {
|
if (QUERY_NODE_VNODE_MODIF_STMT == pRequest->stmtType) {
|
||||||
// tscPerf("insert duration %" PRId64 "us: syntax:%" PRId64 "us, ctg:%" PRId64 "us, semantic:%" PRId64
|
// tscPerf("insert duration %" PRId64 "us: syntax:%" PRId64 "us, ctg:%" PRId64 "us, semantic:%" PRId64
|
||||||
// "us, exec:%" PRId64 "us",
|
// "us, exec:%" PRId64 "us",
|
||||||
// duration, pRequest->metric.syntaxEnd - pRequest->metric.syntaxStart,
|
// duration, pRequest->metric.syntaxEnd - pRequest->metric.syntaxStart,
|
||||||
// pRequest->metric.ctgEnd - pRequest->metric.ctgStart, pRequest->metric.semanticEnd - pRequest->metric.ctgEnd,
|
// pRequest->metric.ctgEnd - pRequest->metric.ctgStart, pRequest->metric.semanticEnd -
|
||||||
// pRequest->metric.execEnd - pRequest->metric.semanticEnd);
|
// pRequest->metric.ctgEnd, pRequest->metric.execEnd - pRequest->metric.semanticEnd);
|
||||||
atomic_add_fetch_64((int64_t *)&pActivity->insertElapsedTime, duration);
|
atomic_add_fetch_64((int64_t *)&pActivity->insertElapsedTime, duration);
|
||||||
} else if (QUERY_NODE_SELECT_STMT == pRequest->stmtType) {
|
} else if (QUERY_NODE_SELECT_STMT == pRequest->stmtType) {
|
||||||
// tscPerf("select duration %" PRId64 "us: syntax:%" PRId64 "us, ctg:%" PRId64 "us, semantic:%" PRId64
|
// tscPerf("select duration %" PRId64 "us: syntax:%" PRId64 "us, ctg:%" PRId64 "us, semantic:%" PRId64
|
||||||
// "us, planner:%" PRId64 "us, exec:%" PRId64 "us, reqId:0x%" PRIx64,
|
// "us, planner:%" PRId64 "us, exec:%" PRId64 "us, reqId:0x%" PRIx64,
|
||||||
// duration, pRequest->metric.syntaxEnd - pRequest->metric.syntaxStart,
|
// duration, pRequest->metric.syntaxEnd - pRequest->metric.syntaxStart,
|
||||||
// pRequest->metric.ctgEnd - pRequest->metric.ctgStart, pRequest->metric.semanticEnd - pRequest->metric.ctgEnd,
|
// pRequest->metric.ctgEnd - pRequest->metric.ctgStart, pRequest->metric.semanticEnd -
|
||||||
// pRequest->metric.planEnd - pRequest->metric.semanticEnd,
|
// pRequest->metric.ctgEnd, pRequest->metric.planEnd - pRequest->metric.semanticEnd,
|
||||||
// pRequest->metric.resultReady - pRequest->metric.planEnd, pRequest->requestId);
|
// pRequest->metric.resultReady - pRequest->metric.planEnd, pRequest->requestId);
|
||||||
|
|
||||||
atomic_add_fetch_64((int64_t *)&pActivity->queryElapsedTime, duration);
|
atomic_add_fetch_64((int64_t *)&pActivity->queryElapsedTime, duration);
|
||||||
}
|
}
|
||||||
|
@ -140,12 +140,15 @@ void *openTransporter(const char *user, const char *auth, int32_t numOfThread) {
|
||||||
rpcInit.numOfThreads = numOfThread;
|
rpcInit.numOfThreads = numOfThread;
|
||||||
rpcInit.cfp = processMsgFromServer;
|
rpcInit.cfp = processMsgFromServer;
|
||||||
rpcInit.rfp = clientRpcRfp;
|
rpcInit.rfp = clientRpcRfp;
|
||||||
// rpcInit.tfp = clientRpcTfp;
|
|
||||||
rpcInit.sessions = 1024;
|
rpcInit.sessions = 1024;
|
||||||
rpcInit.connType = TAOS_CONN_CLIENT;
|
rpcInit.connType = TAOS_CONN_CLIENT;
|
||||||
rpcInit.user = (char *)user;
|
rpcInit.user = (char *)user;
|
||||||
rpcInit.idleTime = tsShellActivityTimer * 1000;
|
rpcInit.idleTime = tsShellActivityTimer * 1000;
|
||||||
rpcInit.compressSize = tsCompressMsgSize;
|
rpcInit.compressSize = tsCompressMsgSize;
|
||||||
|
rpcInit.dfp = destroyAhandle;
|
||||||
|
rpcInit.retryLimit = tsRpcRetryLimit;
|
||||||
|
rpcInit.retryInterval = tsRpcRetryInterval;
|
||||||
|
|
||||||
void *pDnodeConn = rpcOpen(&rpcInit);
|
void *pDnodeConn = rpcOpen(&rpcInit);
|
||||||
if (pDnodeConn == NULL) {
|
if (pDnodeConn == NULL) {
|
||||||
tscError("failed to init connection to server");
|
tscError("failed to init connection to server");
|
||||||
|
@ -271,7 +274,7 @@ STscObj *acquireTscObj(int64_t rid) { return (STscObj *)taosAcquireRef(clientCon
|
||||||
|
|
||||||
int32_t releaseTscObj(int64_t rid) { return taosReleaseRef(clientConnRefPool, rid); }
|
int32_t releaseTscObj(int64_t rid) { return taosReleaseRef(clientConnRefPool, rid); }
|
||||||
|
|
||||||
void *createRequest(uint64_t connId, int32_t type) {
|
void *createRequest(uint64_t connId, int32_t type, int64_t reqid) {
|
||||||
SRequestObj *pRequest = (SRequestObj *)taosMemoryCalloc(1, sizeof(SRequestObj));
|
SRequestObj *pRequest = (SRequestObj *)taosMemoryCalloc(1, sizeof(SRequestObj));
|
||||||
if (NULL == pRequest) {
|
if (NULL == pRequest) {
|
||||||
terrno = TSDB_CODE_TSC_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_TSC_OUT_OF_MEMORY;
|
||||||
|
@ -286,7 +289,7 @@ void *createRequest(uint64_t connId, int32_t type) {
|
||||||
}
|
}
|
||||||
|
|
||||||
pRequest->resType = RES_TYPE__QUERY;
|
pRequest->resType = RES_TYPE__QUERY;
|
||||||
pRequest->requestId = generateRequestId();
|
pRequest->requestId = reqid == 0 ? generateRequestId() : reqid;
|
||||||
pRequest->metric.start = taosGetTimestampUs();
|
pRequest->metric.start = taosGetTimestampUs();
|
||||||
|
|
||||||
pRequest->body.resInfo.convertUcs4 = true; // convert ucs4 by default
|
pRequest->body.resInfo.convertUcs4 = true; // convert ucs4 by default
|
||||||
|
|
|
@ -61,7 +61,7 @@ static int32_t hbProcessDBInfoRsp(void *value, int32_t valueLen, struct SCatalog
|
||||||
int32_t numOfBatchs = taosArrayGetSize(batchUseRsp.pArray);
|
int32_t numOfBatchs = taosArrayGetSize(batchUseRsp.pArray);
|
||||||
for (int32_t i = 0; i < numOfBatchs; ++i) {
|
for (int32_t i = 0; i < numOfBatchs; ++i) {
|
||||||
SUseDbRsp *rsp = taosArrayGet(batchUseRsp.pArray, i);
|
SUseDbRsp *rsp = taosArrayGet(batchUseRsp.pArray, i);
|
||||||
tscDebug("hb db rsp, db:%s, vgVersion:%d, uid:%" PRIx64, rsp->db, rsp->vgVersion, rsp->uid);
|
tscDebug("hb db rsp, db:%s, vgVersion:%d, stateTs:%" PRId64 ", uid:%" PRIx64, rsp->db, rsp->vgVersion, rsp->stateTs, rsp->uid);
|
||||||
|
|
||||||
if (rsp->vgVersion < 0) {
|
if (rsp->vgVersion < 0) {
|
||||||
code = catalogRemoveDB(pCatalog, rsp->db, rsp->uid);
|
code = catalogRemoveDB(pCatalog, rsp->db, rsp->uid);
|
||||||
|
@ -72,6 +72,7 @@ static int32_t hbProcessDBInfoRsp(void *value, int32_t valueLen, struct SCatalog
|
||||||
}
|
}
|
||||||
|
|
||||||
vgInfo->vgVersion = rsp->vgVersion;
|
vgInfo->vgVersion = rsp->vgVersion;
|
||||||
|
vgInfo->stateTs = rsp->stateTs;
|
||||||
vgInfo->hashMethod = rsp->hashMethod;
|
vgInfo->hashMethod = rsp->hashMethod;
|
||||||
vgInfo->hashPrefix = rsp->hashPrefix;
|
vgInfo->hashPrefix = rsp->hashPrefix;
|
||||||
vgInfo->hashSuffix = rsp->hashSuffix;
|
vgInfo->hashSuffix = rsp->hashSuffix;
|
||||||
|
@ -486,6 +487,7 @@ int32_t hbGetExpiredDBInfo(SClientHbKey *connKey, struct SCatalog *pCatalog, SCl
|
||||||
db->dbId = htobe64(db->dbId);
|
db->dbId = htobe64(db->dbId);
|
||||||
db->vgVersion = htonl(db->vgVersion);
|
db->vgVersion = htonl(db->vgVersion);
|
||||||
db->numOfTable = htonl(db->numOfTable);
|
db->numOfTable = htonl(db->numOfTable);
|
||||||
|
db->stateTs = htobe64(db->stateTs);
|
||||||
}
|
}
|
||||||
|
|
||||||
SKv kv = {
|
SKv kv = {
|
||||||
|
|
|
@ -133,6 +133,12 @@ STscObj* taos_connect_internal(const char* ip, const char* user, const char* pas
|
||||||
taosThreadMutexInit(&p->qnodeMutex, NULL);
|
taosThreadMutexInit(&p->qnodeMutex, NULL);
|
||||||
p->pTransporter = openTransporter(user, secretEncrypt, tsNumOfCores);
|
p->pTransporter = openTransporter(user, secretEncrypt, tsNumOfCores);
|
||||||
p->pAppHbMgr = appHbMgrInit(p, key);
|
p->pAppHbMgr = appHbMgrInit(p, key);
|
||||||
|
if (NULL == p->pAppHbMgr) {
|
||||||
|
destroyAppInst(p);
|
||||||
|
taosThreadMutexUnlock(&appInfo.mutex);
|
||||||
|
taosMemoryFreeClear(key);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
taosHashPut(appInfo.pInstMap, key, strlen(key), &p, POINTER_BYTES);
|
taosHashPut(appInfo.pInstMap, key, strlen(key), &p, POINTER_BYTES);
|
||||||
p->instKey = key;
|
p->instKey = key;
|
||||||
key = NULL;
|
key = NULL;
|
||||||
|
@ -148,8 +154,8 @@ STscObj* taos_connect_internal(const char* ip, const char* user, const char* pas
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t buildRequest(uint64_t connId, const char* sql, int sqlLen, void* param, bool validateSql,
|
int32_t buildRequest(uint64_t connId, const char* sql, int sqlLen, void* param, bool validateSql,
|
||||||
SRequestObj** pRequest) {
|
SRequestObj** pRequest, int64_t reqid) {
|
||||||
*pRequest = createRequest(connId, TSDB_SQL_SELECT);
|
*pRequest = createRequest(connId, TSDB_SQL_SELECT, reqid);
|
||||||
if (*pRequest == NULL) {
|
if (*pRequest == NULL) {
|
||||||
tscError("failed to malloc sqlObj, %s", sql);
|
tscError("failed to malloc sqlObj, %s", sql);
|
||||||
return terrno;
|
return terrno;
|
||||||
|
@ -867,6 +873,10 @@ int32_t handleQueryExecRsp(SRequestObj* pRequest) {
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool incompletaFileParsing(SNode* pStmt) {
|
||||||
|
return QUERY_NODE_VNODE_MODIF_STMT != nodeType(pStmt) ? false : ((SVnodeModifOpStmt*)pStmt)->fileProcessing;
|
||||||
|
}
|
||||||
|
|
||||||
// todo refacto the error code mgmt
|
// todo refacto the error code mgmt
|
||||||
void schedulerExecCb(SExecResult* pResult, void* param, int32_t code) {
|
void schedulerExecCb(SExecResult* pResult, void* param, int32_t code) {
|
||||||
SSqlCallbackWrapper* pWrapper = param;
|
SSqlCallbackWrapper* pWrapper = param;
|
||||||
|
@ -921,11 +931,10 @@ void schedulerExecCb(SExecResult* pResult, void* param, int32_t code) {
|
||||||
pRequest->code = code1;
|
pRequest->code = code1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pRequest->code == TSDB_CODE_SUCCESS && NULL != pWrapper->pParseCtx && pWrapper->pParseCtx->needMultiParse) {
|
if (pRequest->code == TSDB_CODE_SUCCESS && NULL != pRequest->pQuery &&
|
||||||
code = continueInsertFromCsv(pWrapper, pRequest);
|
incompletaFileParsing(pRequest->pQuery->pRoot)) {
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
continueInsertFromCsv(pWrapper, pRequest);
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
destorySqlCallbackWrapper(pWrapper);
|
destorySqlCallbackWrapper(pWrapper);
|
||||||
|
@ -1049,7 +1058,9 @@ static int32_t asyncExecSchQuery(SRequestObj* pRequest, SQuery* pQuery, SMetaDat
|
||||||
}
|
}
|
||||||
if (TSDB_CODE_SUCCESS == code && !pRequest->validateOnly) {
|
if (TSDB_CODE_SUCCESS == code && !pRequest->validateOnly) {
|
||||||
SArray* pNodeList = NULL;
|
SArray* pNodeList = NULL;
|
||||||
buildAsyncExecNodeList(pRequest, &pNodeList, pMnodeList, pResultMeta);
|
if (QUERY_NODE_VNODE_MODIF_STMT != nodeType(pQuery->pRoot)) {
|
||||||
|
buildAsyncExecNodeList(pRequest, &pNodeList, pMnodeList, pResultMeta);
|
||||||
|
}
|
||||||
|
|
||||||
SRequestConnInfo conn = {.pTrans = getAppInfo(pRequest)->pTransporter,
|
SRequestConnInfo conn = {.pTrans = getAppInfo(pRequest)->pTransporter,
|
||||||
.requestId = pRequest->requestId,
|
.requestId = pRequest->requestId,
|
||||||
|
@ -1224,7 +1235,7 @@ STscObj* taosConnectImpl(const char* user, const char* auth, const char* db, __t
|
||||||
return pTscObj;
|
return pTscObj;
|
||||||
}
|
}
|
||||||
|
|
||||||
SRequestObj* pRequest = createRequest(pTscObj->id, TDMT_MND_CONNECT);
|
SRequestObj* pRequest = createRequest(pTscObj->id, TDMT_MND_CONNECT, 0);
|
||||||
if (pRequest == NULL) {
|
if (pRequest == NULL) {
|
||||||
destroyTscObj(pTscObj);
|
destroyTscObj(pTscObj);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -1266,7 +1277,9 @@ static SMsgSendInfo* buildConnectMsg(SRequestObj* pRequest) {
|
||||||
pMsgSendInfo->requestObjRefId = pRequest->self;
|
pMsgSendInfo->requestObjRefId = pRequest->self;
|
||||||
pMsgSendInfo->requestId = pRequest->requestId;
|
pMsgSendInfo->requestId = pRequest->requestId;
|
||||||
pMsgSendInfo->fp = getMsgRspHandle(pMsgSendInfo->msgType);
|
pMsgSendInfo->fp = getMsgRspHandle(pMsgSendInfo->msgType);
|
||||||
pMsgSendInfo->param = pRequest;
|
pMsgSendInfo->param = taosMemoryCalloc(1, sizeof(pRequest->self));
|
||||||
|
|
||||||
|
*(int64_t*)pMsgSendInfo->param = pRequest->self;
|
||||||
|
|
||||||
SConnectReq connectReq = {0};
|
SConnectReq connectReq = {0};
|
||||||
STscObj* pObj = pRequest->pTscObj;
|
STscObj* pObj = pRequest->pTscObj;
|
||||||
|
@ -1958,6 +1971,8 @@ TSDB_SERVER_STATUS taos_check_server_status(const char* fqdn, int port, char* de
|
||||||
rpcInit.idleTime = tsShellActivityTimer * 1000;
|
rpcInit.idleTime = tsShellActivityTimer * 1000;
|
||||||
rpcInit.compressSize = tsCompressMsgSize;
|
rpcInit.compressSize = tsCompressMsgSize;
|
||||||
rpcInit.user = "_dnd";
|
rpcInit.user = "_dnd";
|
||||||
|
rpcInit.retryLimit = tsRpcRetryLimit;
|
||||||
|
rpcInit.retryInterval = tsRpcRetryInterval;
|
||||||
|
|
||||||
clientRpc = rpcOpen(&rpcInit);
|
clientRpc = rpcOpen(&rpcInit);
|
||||||
if (clientRpc == NULL) {
|
if (clientRpc == NULL) {
|
||||||
|
@ -2226,7 +2241,37 @@ void taosAsyncQueryImpl(uint64_t connId, const char* sql, __taos_async_fn_t fp,
|
||||||
}
|
}
|
||||||
|
|
||||||
SRequestObj* pRequest = NULL;
|
SRequestObj* pRequest = NULL;
|
||||||
int32_t code = buildRequest(connId, sql, sqlLen, param, validateOnly, &pRequest);
|
int32_t code = buildRequest(connId, sql, sqlLen, param, validateOnly, &pRequest, 0);
|
||||||
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
|
terrno = code;
|
||||||
|
fp(param, NULL, terrno);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
pRequest->body.queryFp = fp;
|
||||||
|
doAsyncQuery(pRequest, false);
|
||||||
|
}
|
||||||
|
void taosAsyncQueryImplWithReqid(uint64_t connId, const char* sql, __taos_async_fn_t fp, void* param, bool validateOnly,
|
||||||
|
int64_t reqid) {
|
||||||
|
if (sql == NULL || NULL == fp) {
|
||||||
|
terrno = TSDB_CODE_INVALID_PARA;
|
||||||
|
if (fp) {
|
||||||
|
fp(param, NULL, terrno);
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t sqlLen = strlen(sql);
|
||||||
|
if (sqlLen > (size_t)TSDB_MAX_ALLOWED_SQL_LEN) {
|
||||||
|
tscError("sql string exceeds max length:%d", TSDB_MAX_ALLOWED_SQL_LEN);
|
||||||
|
terrno = TSDB_CODE_TSC_EXCEED_SQL_LIMIT;
|
||||||
|
fp(param, NULL, terrno);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
SRequestObj* pRequest = NULL;
|
||||||
|
int32_t code = buildRequest(connId, sql, sqlLen, param, validateOnly, &pRequest, reqid);
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
terrno = code;
|
terrno = code;
|
||||||
fp(param, NULL, terrno);
|
fp(param, NULL, terrno);
|
||||||
|
@ -2253,3 +2298,20 @@ TAOS_RES* taosQueryImpl(TAOS* taos, const char* sql, bool validateOnly) {
|
||||||
}
|
}
|
||||||
return param->pRequest;
|
return param->pRequest;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TAOS_RES* taosQueryImplWithReqid(TAOS* taos, const char* sql, bool validateOnly, int64_t reqid) {
|
||||||
|
if (NULL == taos) {
|
||||||
|
terrno = TSDB_CODE_TSC_DISCONNECTED;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
SSyncQueryParam* param = taosMemoryCalloc(1, sizeof(SSyncQueryParam));
|
||||||
|
tsem_init(¶m->sem, 0, 0);
|
||||||
|
|
||||||
|
taosAsyncQueryImplWithReqid(*(int64_t*)taos, sql, syncQueryFn, param, validateOnly, reqid);
|
||||||
|
tsem_wait(¶m->sem);
|
||||||
|
if (param->pRequest != NULL) {
|
||||||
|
param->pRequest->syncQuery = true;
|
||||||
|
}
|
||||||
|
return param->pRequest;
|
||||||
|
}
|
||||||
|
|
|
@ -248,6 +248,9 @@ TAOS_FIELD *taos_fetch_fields(TAOS_RES *res) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TAOS_RES *taos_query(TAOS *taos, const char *sql) { return taosQueryImpl(taos, sql, false); }
|
TAOS_RES *taos_query(TAOS *taos, const char *sql) { return taosQueryImpl(taos, sql, false); }
|
||||||
|
TAOS_RES *taos_query_with_reqid(TAOS *taos, const char *sql, int64_t reqid) {
|
||||||
|
return taosQueryImplWithReqid(taos, sql, false, reqid);
|
||||||
|
}
|
||||||
|
|
||||||
TAOS_ROW taos_fetch_row(TAOS_RES *res) {
|
TAOS_ROW taos_fetch_row(TAOS_RES *res) {
|
||||||
if (res == NULL) {
|
if (res == NULL) {
|
||||||
|
@ -286,7 +289,8 @@ TAOS_ROW taos_fetch_row(TAOS_RES *res) {
|
||||||
return NULL;
|
return NULL;
|
||||||
} else {
|
} else {
|
||||||
// assert to avoid un-initialization error
|
// assert to avoid un-initialization error
|
||||||
ASSERT(0);
|
tscError("invalid result passed to taos_fetch_row");
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -682,11 +686,10 @@ void destorySqlCallbackWrapper(SSqlCallbackWrapper *pWrapper) {
|
||||||
}
|
}
|
||||||
destoryCatalogReq(pWrapper->pCatalogReq);
|
destoryCatalogReq(pWrapper->pCatalogReq);
|
||||||
qDestroyParseContext(pWrapper->pParseCtx);
|
qDestroyParseContext(pWrapper->pParseCtx);
|
||||||
catalogFreeMetaData(pWrapper->pResultMeta);
|
|
||||||
taosMemoryFree(pWrapper);
|
taosMemoryFree(pWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
void retrieveMetaCallback(SMetaData *pResultMeta, void *param, int32_t code) {
|
static void doAsyncQueryFromAnalyse(SMetaData *pResultMeta, void *param, int32_t code) {
|
||||||
SSqlCallbackWrapper *pWrapper = (SSqlCallbackWrapper *)param;
|
SSqlCallbackWrapper *pWrapper = (SSqlCallbackWrapper *)param;
|
||||||
SRequestObj *pRequest = pWrapper->pRequest;
|
SRequestObj *pRequest = pWrapper->pRequest;
|
||||||
SQuery *pQuery = pRequest->pQuery;
|
SQuery *pQuery = pRequest->pQuery;
|
||||||
|
@ -704,13 +707,6 @@ void retrieveMetaCallback(SMetaData *pResultMeta, void *param, int32_t code) {
|
||||||
|
|
||||||
pRequest->metric.semanticEnd = taosGetTimestampUs();
|
pRequest->metric.semanticEnd = taosGetTimestampUs();
|
||||||
|
|
||||||
if (code == TSDB_CODE_SUCCESS && pWrapper->pParseCtx->needMultiParse) {
|
|
||||||
pWrapper->pResultMeta = catalogCloneMetaData(pResultMeta);
|
|
||||||
if (NULL == pWrapper->pResultMeta) {
|
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (code == TSDB_CODE_SUCCESS) {
|
if (code == TSDB_CODE_SUCCESS) {
|
||||||
if (pQuery->haveResultSet) {
|
if (pQuery->haveResultSet) {
|
||||||
setResSchemaInfo(&pRequest->body.resInfo, pQuery->pResSchema, pQuery->numOfResCols);
|
setResSchemaInfo(&pRequest->body.resInfo, pQuery->pResSchema, pQuery->numOfResCols);
|
||||||
|
@ -747,14 +743,83 @@ void retrieveMetaCallback(SMetaData *pResultMeta, void *param, int32_t code) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t continueInsertFromCsv(SSqlCallbackWrapper *pWrapper, SRequestObj *pRequest) {
|
static int32_t getAllMetaAsync(SSqlCallbackWrapper *pWrapper, catalogCallback fp) {
|
||||||
qDestroyQuery(pRequest->pQuery);
|
SRequestConnInfo conn = {.pTrans = pWrapper->pParseCtx->pTransporter,
|
||||||
pRequest->pQuery = (SQuery *)nodesMakeNode(QUERY_NODE_QUERY);
|
.requestId = pWrapper->pParseCtx->requestId,
|
||||||
if (NULL == pRequest->pQuery) {
|
.requestObjRefId = pWrapper->pParseCtx->requestRid,
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
.mgmtEps = pWrapper->pParseCtx->mgmtEpSet};
|
||||||
|
|
||||||
|
pWrapper->pRequest->metric.ctgStart = taosGetTimestampUs();
|
||||||
|
|
||||||
|
return catalogAsyncGetAllMeta(pWrapper->pParseCtx->pCatalog, &conn, pWrapper->pCatalogReq, fp, pWrapper,
|
||||||
|
&pWrapper->pRequest->body.queryJob);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void doAsyncQueryFromParse(SMetaData *pResultMeta, void *param, int32_t code);
|
||||||
|
|
||||||
|
static int32_t phaseAsyncQuery(SSqlCallbackWrapper *pWrapper) {
|
||||||
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
|
switch (pWrapper->pRequest->pQuery->execStage) {
|
||||||
|
case QUERY_EXEC_STAGE_PARSE: {
|
||||||
|
// continue parse after get metadata
|
||||||
|
code = getAllMetaAsync(pWrapper, doAsyncQueryFromParse);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case QUERY_EXEC_STAGE_ANALYSE: {
|
||||||
|
// analysis after get metadata
|
||||||
|
code = getAllMetaAsync(pWrapper, doAsyncQueryFromAnalyse);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case QUERY_EXEC_STAGE_SCHEDULE: {
|
||||||
|
launchAsyncQuery(pWrapper->pRequest, pWrapper->pRequest->pQuery, NULL, pWrapper);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void doAsyncQueryFromParse(SMetaData *pResultMeta, void *param, int32_t code) {
|
||||||
|
SSqlCallbackWrapper *pWrapper = (SSqlCallbackWrapper *)param;
|
||||||
|
SRequestObj *pRequest = pWrapper->pRequest;
|
||||||
|
SQuery *pQuery = pRequest->pQuery;
|
||||||
|
|
||||||
|
pRequest->metric.ctgEnd = taosGetTimestampUs();
|
||||||
|
qDebug("0x%" PRIx64 " start to continue parse, reqId:0x%" PRIx64, pRequest->self, pRequest->requestId);
|
||||||
|
|
||||||
|
if (code == TSDB_CODE_SUCCESS) {
|
||||||
|
code = qContinueParseSql(pWrapper->pParseCtx, pWrapper->pCatalogReq, pResultMeta, pQuery);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
|
code = phaseAsyncQuery(pWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (TSDB_CODE_SUCCESS != code) {
|
||||||
|
tscError("0x%" PRIx64 " error happens, code:%d - %s, reqId:0x%" PRIx64, pWrapper->pRequest->self, code,
|
||||||
|
tstrerror(code), pWrapper->pRequest->requestId);
|
||||||
|
destorySqlCallbackWrapper(pWrapper);
|
||||||
|
terrno = code;
|
||||||
|
pRequest->code = code;
|
||||||
|
pRequest->body.queryFp(pRequest->body.param, pRequest, code);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void continueInsertFromCsv(SSqlCallbackWrapper *pWrapper, SRequestObj *pRequest) {
|
||||||
|
int32_t code = qParseSqlSyntax(pWrapper->pParseCtx, &pRequest->pQuery, pWrapper->pCatalogReq);
|
||||||
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
|
code = phaseAsyncQuery(pWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (TSDB_CODE_SUCCESS != code) {
|
||||||
|
tscError("0x%" PRIx64 " error happens, code:%d - %s, reqId:0x%" PRIx64, pWrapper->pRequest->self, code,
|
||||||
|
tstrerror(code), pWrapper->pRequest->requestId);
|
||||||
|
destorySqlCallbackWrapper(pWrapper);
|
||||||
|
terrno = code;
|
||||||
|
pWrapper->pRequest->code = code;
|
||||||
|
pWrapper->pRequest->body.queryFp(pWrapper->pRequest->body.param, pWrapper->pRequest, code);
|
||||||
}
|
}
|
||||||
retrieveMetaCallback(pWrapper->pResultMeta, pWrapper, TSDB_CODE_SUCCESS);
|
|
||||||
return TSDB_CODE_SUCCESS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void taos_query_a(TAOS *taos, const char *sql, __taos_async_fn_t fp, void *param) {
|
void taos_query_a(TAOS *taos, const char *sql, __taos_async_fn_t fp, void *param) {
|
||||||
|
@ -762,6 +827,11 @@ void taos_query_a(TAOS *taos, const char *sql, __taos_async_fn_t fp, void *param
|
||||||
taosAsyncQueryImpl(connId, sql, fp, param, false);
|
taosAsyncQueryImpl(connId, sql, fp, param, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void taos_query_a_with_reqid(TAOS *taos, const char *sql, __taos_async_fn_t fp, void *param, int64_t reqid) {
|
||||||
|
int64_t connId = *(int64_t *)taos;
|
||||||
|
taosAsyncQueryImplWithReqid(connId, sql, fp, param, false, reqid);
|
||||||
|
}
|
||||||
|
|
||||||
int32_t createParseContext(const SRequestObj *pRequest, SParseContext **pCxt) {
|
int32_t createParseContext(const SRequestObj *pRequest, SParseContext **pCxt) {
|
||||||
const STscObj *pTscObj = pRequest->pTscObj;
|
const STscObj *pTscObj = pRequest->pTscObj;
|
||||||
|
|
||||||
|
@ -836,26 +906,16 @@ void doAsyncQuery(SRequestObj *pRequest, bool updateMetaForce) {
|
||||||
|
|
||||||
if (TSDB_CODE_SUCCESS == code && !updateMetaForce) {
|
if (TSDB_CODE_SUCCESS == code && !updateMetaForce) {
|
||||||
SAppClusterSummary *pActivity = &pTscObj->pAppInfo->summary;
|
SAppClusterSummary *pActivity = &pTscObj->pAppInfo->summary;
|
||||||
if (NULL == pRequest->pQuery->pRoot) {
|
if (QUERY_NODE_INSERT_STMT == nodeType(pRequest->pQuery->pRoot)) {
|
||||||
atomic_add_fetch_64((int64_t *)&pActivity->numOfInsertsReq, 1);
|
atomic_add_fetch_64((int64_t *)&pActivity->numOfInsertsReq, 1);
|
||||||
} else if (QUERY_NODE_SELECT_STMT == pRequest->pQuery->pRoot->type) {
|
} else if (QUERY_NODE_SELECT_STMT == nodeType(pRequest->pQuery->pRoot)) {
|
||||||
atomic_add_fetch_64((int64_t *)&pActivity->numOfQueryReq, 1);
|
atomic_add_fetch_64((int64_t *)&pActivity->numOfQueryReq, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
SRequestConnInfo conn = {.pTrans = pWrapper->pParseCtx->pTransporter,
|
phaseAsyncQuery(pWrapper);
|
||||||
.requestId = pWrapper->pParseCtx->requestId,
|
} else {
|
||||||
.requestObjRefId = pWrapper->pParseCtx->requestRid,
|
|
||||||
.mgmtEps = pWrapper->pParseCtx->mgmtEpSet};
|
|
||||||
|
|
||||||
pRequest->metric.ctgStart = taosGetTimestampUs();
|
|
||||||
|
|
||||||
code = catalogAsyncGetAllMeta(pWrapper->pParseCtx->pCatalog, &conn, pWrapper->pCatalogReq, retrieveMetaCallback,
|
|
||||||
pWrapper, &pRequest->body.queryJob);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (TSDB_CODE_SUCCESS != code) {
|
|
||||||
tscError("0x%" PRIx64 " error happens, code:%d - %s, reqId:0x%" PRIx64, pRequest->self, code, tstrerror(code),
|
tscError("0x%" PRIx64 " error happens, code:%d - %s, reqId:0x%" PRIx64, pRequest->self, code, tstrerror(code),
|
||||||
pRequest->requestId);
|
pRequest->requestId);
|
||||||
destorySqlCallbackWrapper(pWrapper);
|
destorySqlCallbackWrapper(pWrapper);
|
||||||
|
@ -930,7 +990,7 @@ void taos_fetch_rows_a(TAOS_RES *res, __taos_async_fn_t fp, void *param) {
|
||||||
// all data has returned to App already, no need to try again
|
// all data has returned to App already, no need to try again
|
||||||
if (pResultInfo->completed) {
|
if (pResultInfo->completed) {
|
||||||
// it is a local executed query, no need to do async fetch
|
// it is a local executed query, no need to do async fetch
|
||||||
if (QUERY_EXEC_MODE_LOCAL == pRequest->body.execMode) {
|
if (QUERY_EXEC_MODE_SCHEDULE != pRequest->body.execMode) {
|
||||||
if (pResultInfo->localResultFetched) {
|
if (pResultInfo->localResultFetched) {
|
||||||
pResultInfo->numOfRows = 0;
|
pResultInfo->numOfRows = 0;
|
||||||
pResultInfo->current = 0;
|
pResultInfo->current = 0;
|
||||||
|
@ -991,7 +1051,7 @@ int taos_get_db_route_info(TAOS *taos, const char *db, TAOS_DB_ROUTE_INFO *dbInf
|
||||||
int64_t connId = *(int64_t *)taos;
|
int64_t connId = *(int64_t *)taos;
|
||||||
SRequestObj *pRequest = NULL;
|
SRequestObj *pRequest = NULL;
|
||||||
char *sql = "taos_get_db_route_info";
|
char *sql = "taos_get_db_route_info";
|
||||||
int32_t code = buildRequest(connId, sql, strlen(sql), NULL, false, &pRequest);
|
int32_t code = buildRequest(connId, sql, strlen(sql), NULL, false, &pRequest, 0);
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
terrno = code;
|
terrno = code;
|
||||||
return terrno;
|
return terrno;
|
||||||
|
@ -1040,7 +1100,7 @@ int taos_get_table_vgId(TAOS *taos, const char *db, const char *table, int *vgId
|
||||||
int64_t connId = *(int64_t *)taos;
|
int64_t connId = *(int64_t *)taos;
|
||||||
SRequestObj *pRequest = NULL;
|
SRequestObj *pRequest = NULL;
|
||||||
char *sql = "taos_get_table_vgId";
|
char *sql = "taos_get_table_vgId";
|
||||||
int32_t code = buildRequest(connId, sql, strlen(sql), NULL, false, &pRequest);
|
int32_t code = buildRequest(connId, sql, strlen(sql), NULL, false, &pRequest, 0);
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
return terrno;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
@ -1101,7 +1161,7 @@ int taos_load_table_info(TAOS *taos, const char *tableNameList) {
|
||||||
}
|
}
|
||||||
|
|
||||||
char *sql = "taos_load_table_info";
|
char *sql = "taos_load_table_info";
|
||||||
code = buildRequest(connId, sql, strlen(sql), NULL, false, &pRequest);
|
code = buildRequest(connId, sql, strlen(sql), NULL, false, &pRequest, 0);
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
terrno = code;
|
terrno = code;
|
||||||
goto _return;
|
goto _return;
|
||||||
|
@ -1146,7 +1206,22 @@ TAOS_STMT *taos_stmt_init(TAOS *taos) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
TAOS_STMT *pStmt = stmtInit(pObj);
|
TAOS_STMT *pStmt = stmtInit(pObj, 0);
|
||||||
|
|
||||||
|
releaseTscObj(*(int64_t *)taos);
|
||||||
|
|
||||||
|
return pStmt;
|
||||||
|
}
|
||||||
|
|
||||||
|
TAOS_STMT *taos_stmt_init_with_reqid(TAOS *taos, int64_t reqid) {
|
||||||
|
STscObj *pObj = acquireTscObj(*(int64_t *)taos);
|
||||||
|
if (NULL == pObj) {
|
||||||
|
tscError("invalid parameter for %s", __FUNCTION__);
|
||||||
|
terrno = TSDB_CODE_TSC_DISCONNECTED;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
TAOS_STMT *pStmt = stmtInit(pObj, reqid);
|
||||||
|
|
||||||
releaseTscObj(*(int64_t *)taos);
|
releaseTscObj(*(int64_t *)taos);
|
||||||
|
|
||||||
|
|
|
@ -45,8 +45,13 @@ int32_t genericRspCallback(void* param, SDataBuf* pMsg, int32_t code) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t processConnectRsp(void* param, SDataBuf* pMsg, int32_t code) {
|
int32_t processConnectRsp(void* param, SDataBuf* pMsg, int32_t code) {
|
||||||
SRequestObj* pRequest = param;
|
SRequestObj *pRequest = acquireRequest(*(int64_t*)param);
|
||||||
|
if (NULL == pRequest) {
|
||||||
|
setErrno(pRequest, TSDB_CODE_TSC_DISCONNECTED);
|
||||||
|
tsem_post(&pRequest->body.rspSem);
|
||||||
|
goto End;
|
||||||
|
}
|
||||||
|
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
setErrno(pRequest, code);
|
setErrno(pRequest, code);
|
||||||
tsem_post(&pRequest->body.rspSem);
|
tsem_post(&pRequest->body.rspSem);
|
||||||
|
@ -55,6 +60,12 @@ int32_t processConnectRsp(void* param, SDataBuf* pMsg, int32_t code) {
|
||||||
|
|
||||||
STscObj* pTscObj = pRequest->pTscObj;
|
STscObj* pTscObj = pRequest->pTscObj;
|
||||||
|
|
||||||
|
if (NULL == pTscObj->pAppInfo || NULL == pTscObj->pAppInfo->pAppHbMgr) {
|
||||||
|
setErrno(pRequest, TSDB_CODE_TSC_DISCONNECTED);
|
||||||
|
tsem_post(&pRequest->body.rspSem);
|
||||||
|
goto End;
|
||||||
|
}
|
||||||
|
|
||||||
SConnectRsp connectRsp = {0};
|
SConnectRsp connectRsp = {0};
|
||||||
if (tDeserializeSConnectRsp(pMsg->pData, pMsg->len, &connectRsp) != 0) {
|
if (tDeserializeSConnectRsp(pMsg->pData, pMsg->len, &connectRsp) != 0) {
|
||||||
code = TSDB_CODE_TSC_INVALID_VERSION;
|
code = TSDB_CODE_TSC_INVALID_VERSION;
|
||||||
|
@ -115,10 +126,15 @@ int32_t processConnectRsp(void* param, SDataBuf* pMsg, int32_t code) {
|
||||||
|
|
||||||
tscDebug("0x%" PRIx64 " clusterId:%" PRId64 ", totalConn:%" PRId64, pRequest->requestId, connectRsp.clusterId,
|
tscDebug("0x%" PRIx64 " clusterId:%" PRId64 ", totalConn:%" PRId64, pRequest->requestId, connectRsp.clusterId,
|
||||||
pTscObj->pAppInfo->numOfConns);
|
pTscObj->pAppInfo->numOfConns);
|
||||||
|
|
||||||
tsem_post(&pRequest->body.rspSem);
|
tsem_post(&pRequest->body.rspSem);
|
||||||
End:
|
End:
|
||||||
|
|
||||||
|
if (pRequest) {
|
||||||
|
releaseRequest(pRequest->self);
|
||||||
|
}
|
||||||
|
|
||||||
|
taosMemoryFree(param);
|
||||||
taosMemoryFree(pMsg->pEpSet);
|
taosMemoryFree(pMsg->pEpSet);
|
||||||
taosMemoryFree(pMsg->pData);
|
taosMemoryFree(pMsg->pData);
|
||||||
return code;
|
return code;
|
||||||
|
@ -159,12 +175,13 @@ int32_t processCreateDbRsp(void* param, SDataBuf* pMsg, int32_t code) {
|
||||||
int32_t processUseDbRsp(void* param, SDataBuf* pMsg, int32_t code) {
|
int32_t processUseDbRsp(void* param, SDataBuf* pMsg, int32_t code) {
|
||||||
SRequestObj* pRequest = param;
|
SRequestObj* pRequest = param;
|
||||||
|
|
||||||
if (TSDB_CODE_MND_DB_NOT_EXIST == code) {
|
if (TSDB_CODE_MND_DB_NOT_EXIST == code || TSDB_CODE_MND_DB_IN_CREATING == code ||
|
||||||
|
TSDB_CODE_MND_DB_IN_DROPPING == code) {
|
||||||
SUseDbRsp usedbRsp = {0};
|
SUseDbRsp usedbRsp = {0};
|
||||||
tDeserializeSUseDbRsp(pMsg->pData, pMsg->len, &usedbRsp);
|
tDeserializeSUseDbRsp(pMsg->pData, pMsg->len, &usedbRsp);
|
||||||
struct SCatalog* pCatalog = NULL;
|
struct SCatalog* pCatalog = NULL;
|
||||||
|
|
||||||
if (usedbRsp.vgVersion >= 0) {
|
if (usedbRsp.vgVersion >= 0) { // cached in local
|
||||||
uint64_t clusterId = pRequest->pTscObj->pAppInfo->clusterId;
|
uint64_t clusterId = pRequest->pTscObj->pAppInfo->clusterId;
|
||||||
int32_t code1 = catalogGetHandle(clusterId, &pCatalog);
|
int32_t code1 = catalogGetHandle(clusterId, &pCatalog);
|
||||||
if (code1 != TSDB_CODE_SUCCESS) {
|
if (code1 != TSDB_CODE_SUCCESS) {
|
||||||
|
@ -196,7 +213,20 @@ int32_t processUseDbRsp(void* param, SDataBuf* pMsg, int32_t code) {
|
||||||
tDeserializeSUseDbRsp(pMsg->pData, pMsg->len, &usedbRsp);
|
tDeserializeSUseDbRsp(pMsg->pData, pMsg->len, &usedbRsp);
|
||||||
|
|
||||||
if (strlen(usedbRsp.db) == 0) {
|
if (strlen(usedbRsp.db) == 0) {
|
||||||
return TSDB_CODE_MND_DB_NOT_EXIST;
|
if (usedbRsp.errCode != 0) {
|
||||||
|
return usedbRsp.errCode;
|
||||||
|
} else {
|
||||||
|
return TSDB_CODE_APP_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tscTrace("db:%s, usedbRsp received, numOfVgroups:%d", usedbRsp.db, usedbRsp.vgNum);
|
||||||
|
for (int32_t i = 0; i < usedbRsp.vgNum; ++i) {
|
||||||
|
SVgroupInfo* pInfo = taosArrayGet(usedbRsp.pVgroupInfos, i);
|
||||||
|
tscTrace("vgId:%d, numOfEps:%d inUse:%d ", pInfo->vgId, pInfo->epSet.numOfEps, pInfo->epSet.inUse);
|
||||||
|
for (int32_t j = 0; j < pInfo->epSet.numOfEps; ++j) {
|
||||||
|
tscTrace("vgId:%d, index:%d epset:%s:%u", pInfo->vgId, j, pInfo->epSet.eps[j].fqdn, pInfo->epSet.eps[j].port);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SName name = {0};
|
SName name = {0};
|
||||||
|
@ -412,8 +442,7 @@ static int32_t buildShowVariablesRsp(SArray* pVars, SRetrieveTableRsp** pRsp) {
|
||||||
(*pRsp)->numOfRows = htonl(pBlock->info.rows);
|
(*pRsp)->numOfRows = htonl(pBlock->info.rows);
|
||||||
(*pRsp)->numOfCols = htonl(SHOW_VARIABLES_RESULT_COLS);
|
(*pRsp)->numOfCols = htonl(SHOW_VARIABLES_RESULT_COLS);
|
||||||
|
|
||||||
int32_t len = 0;
|
int32_t len = blockEncode(pBlock, (*pRsp)->data, SHOW_VARIABLES_RESULT_COLS);
|
||||||
blockEncode(pBlock, (*pRsp)->data, &len, SHOW_VARIABLES_RESULT_COLS, false);
|
|
||||||
ASSERT(len == rspSize - sizeof(SRetrieveTableRsp));
|
ASSERT(len == rspSize - sizeof(SRetrieveTableRsp));
|
||||||
|
|
||||||
blockDataDestroy(pBlock);
|
blockDataDestroy(pBlock);
|
||||||
|
|
|
@ -410,7 +410,7 @@ static char* processAlterTable(SMqMetaRsp* metaRsp) {
|
||||||
SDecoder decoder = {0};
|
SDecoder decoder = {0};
|
||||||
SVAlterTbReq vAlterTbReq = {0};
|
SVAlterTbReq vAlterTbReq = {0};
|
||||||
char* string = NULL;
|
char* string = NULL;
|
||||||
cJSON* json = NULL;
|
cJSON* json = NULL;
|
||||||
|
|
||||||
// decode
|
// decode
|
||||||
void* data = POINTER_SHIFT(metaRsp->metaRsp, sizeof(SMsgHead));
|
void* data = POINTER_SHIFT(metaRsp->metaRsp, sizeof(SMsgHead));
|
||||||
|
@ -525,7 +525,7 @@ static char* processDropSTable(SMqMetaRsp* metaRsp) {
|
||||||
SDecoder decoder = {0};
|
SDecoder decoder = {0};
|
||||||
SVDropStbReq req = {0};
|
SVDropStbReq req = {0};
|
||||||
char* string = NULL;
|
char* string = NULL;
|
||||||
cJSON* json = NULL;
|
cJSON* json = NULL;
|
||||||
|
|
||||||
// decode
|
// decode
|
||||||
void* data = POINTER_SHIFT(metaRsp->metaRsp, sizeof(SMsgHead));
|
void* data = POINTER_SHIFT(metaRsp->metaRsp, sizeof(SMsgHead));
|
||||||
|
@ -558,7 +558,7 @@ static char* processDropTable(SMqMetaRsp* metaRsp) {
|
||||||
SDecoder decoder = {0};
|
SDecoder decoder = {0};
|
||||||
SVDropTbBatchReq req = {0};
|
SVDropTbBatchReq req = {0};
|
||||||
char* string = NULL;
|
char* string = NULL;
|
||||||
cJSON* json = NULL;
|
cJSON* json = NULL;
|
||||||
|
|
||||||
// decode
|
// decode
|
||||||
void* data = POINTER_SHIFT(metaRsp->metaRsp, sizeof(SMsgHead));
|
void* data = POINTER_SHIFT(metaRsp->metaRsp, sizeof(SMsgHead));
|
||||||
|
@ -603,7 +603,7 @@ static int32_t taosCreateStb(TAOS* taos, void* meta, int32_t metaLen) {
|
||||||
int32_t code = TSDB_CODE_SUCCESS;
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
SRequestObj* pRequest = NULL;
|
SRequestObj* pRequest = NULL;
|
||||||
|
|
||||||
code = buildRequest(*(int64_t*)taos, "", 0, NULL, false, &pRequest);
|
code = buildRequest(*(int64_t*)taos, "", 0, NULL, false, &pRequest, 0);
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
@ -692,7 +692,7 @@ static int32_t taosDropStb(TAOS* taos, void* meta, int32_t metaLen) {
|
||||||
int32_t code = TSDB_CODE_SUCCESS;
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
SRequestObj* pRequest = NULL;
|
SRequestObj* pRequest = NULL;
|
||||||
|
|
||||||
code = buildRequest(*(int64_t*)taos, "", 0, NULL, false, &pRequest);
|
code = buildRequest(*(int64_t*)taos, "", 0, NULL, false, &pRequest, 0);
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
@ -773,7 +773,7 @@ static int32_t taosCreateTable(TAOS* taos, void* meta, int32_t metaLen) {
|
||||||
SQuery* pQuery = NULL;
|
SQuery* pQuery = NULL;
|
||||||
SHashObj* pVgroupHashmap = NULL;
|
SHashObj* pVgroupHashmap = NULL;
|
||||||
|
|
||||||
code = buildRequest(*(int64_t*)taos, "", 0, NULL, false, &pRequest);
|
code = buildRequest(*(int64_t*)taos, "", 0, NULL, false, &pRequest, 0);
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
@ -926,7 +926,7 @@ static int32_t taosDropTable(TAOS* taos, void* meta, int32_t metaLen) {
|
||||||
SQuery* pQuery = NULL;
|
SQuery* pQuery = NULL;
|
||||||
SHashObj* pVgroupHashmap = NULL;
|
SHashObj* pVgroupHashmap = NULL;
|
||||||
|
|
||||||
code = buildRequest(*(int64_t*)taos, "", 0, NULL, false, &pRequest);
|
code = buildRequest(*(int64_t*)taos, "", 0, NULL, false, &pRequest, 0);
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
@ -1097,7 +1097,7 @@ static int32_t taosAlterTable(TAOS* taos, void* meta, int32_t metaLen) {
|
||||||
SArray* pArray = NULL;
|
SArray* pArray = NULL;
|
||||||
SVgDataBlocks* pVgData = NULL;
|
SVgDataBlocks* pVgData = NULL;
|
||||||
|
|
||||||
code = buildRequest(*(int64_t*)taos, "", 0, NULL, false, &pRequest);
|
code = buildRequest(*(int64_t*)taos, "", 0, NULL, false, &pRequest, 0);
|
||||||
|
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
goto end;
|
goto end;
|
||||||
|
@ -1181,7 +1181,7 @@ static int32_t taosAlterTable(TAOS* taos, void* meta, int32_t metaLen) {
|
||||||
pVgData = NULL;
|
pVgData = NULL;
|
||||||
pArray = NULL;
|
pArray = NULL;
|
||||||
code = pRequest->code;
|
code = pRequest->code;
|
||||||
if (code == TSDB_CODE_VND_TABLE_NOT_EXIST) {
|
if (code == TSDB_CODE_TDB_TABLE_NOT_EXIST) {
|
||||||
code = TSDB_CODE_SUCCESS;
|
code = TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1217,7 +1217,7 @@ int taos_write_raw_block(TAOS* taos, int rows, char* pData, const char* tbname)
|
||||||
SQuery* pQuery = NULL;
|
SQuery* pQuery = NULL;
|
||||||
SSubmitReq* subReq = NULL;
|
SSubmitReq* subReq = NULL;
|
||||||
|
|
||||||
SRequestObj* pRequest = (SRequestObj*)createRequest(*(int64_t*)taos, TSDB_SQL_INSERT);
|
SRequestObj* pRequest = (SRequestObj*)createRequest(*(int64_t*)taos, TSDB_SQL_INSERT, 0);
|
||||||
if (!pRequest) {
|
if (!pRequest) {
|
||||||
uError("WriteRaw:createRequest error request is null");
|
uError("WriteRaw:createRequest error request is null");
|
||||||
code = terrno;
|
code = terrno;
|
||||||
|
@ -1281,7 +1281,7 @@ int taos_write_raw_block(TAOS* taos, int rows, char* pData, const char* tbname)
|
||||||
int32_t schemaLen = 0;
|
int32_t schemaLen = 0;
|
||||||
int32_t submitLen = sizeof(SSubmitBlk) + schemaLen + rows * extendedRowSize;
|
int32_t submitLen = sizeof(SSubmitBlk) + schemaLen + rows * extendedRowSize;
|
||||||
|
|
||||||
int32_t totalLen = sizeof(SSubmitReq) + submitLen;
|
int32_t totalLen = sizeof(SSubmitReq) + submitLen;
|
||||||
subReq = taosMemoryCalloc(1, totalLen);
|
subReq = taosMemoryCalloc(1, totalLen);
|
||||||
SSubmitBlk* blk = POINTER_SHIFT(subReq, sizeof(SSubmitReq));
|
SSubmitBlk* blk = POINTER_SHIFT(subReq, sizeof(SSubmitReq));
|
||||||
void* blkSchema = POINTER_SHIFT(blk, sizeof(SSubmitBlk));
|
void* blkSchema = POINTER_SHIFT(blk, sizeof(SSubmitBlk));
|
||||||
|
@ -1407,7 +1407,7 @@ static int32_t tmqWriteRawDataImpl(TAOS* taos, void* data, int32_t dataLen) {
|
||||||
STableMeta* pTableMeta = NULL;
|
STableMeta* pTableMeta = NULL;
|
||||||
|
|
||||||
terrno = TSDB_CODE_SUCCESS;
|
terrno = TSDB_CODE_SUCCESS;
|
||||||
SRequestObj* pRequest = (SRequestObj*)createRequest(*(int64_t*)taos, TSDB_SQL_INSERT);
|
SRequestObj* pRequest = (SRequestObj*)createRequest(*(int64_t*)taos, TSDB_SQL_INSERT, 0);
|
||||||
if (!pRequest) {
|
if (!pRequest) {
|
||||||
uError("WriteRaw:createRequest error request is null");
|
uError("WriteRaw:createRequest error request is null");
|
||||||
return terrno;
|
return terrno;
|
||||||
|
@ -1674,7 +1674,7 @@ static int32_t tmqWriteRawMetaDataImpl(TAOS* taos, void* data, int32_t dataLen)
|
||||||
STableMeta* pTableMeta = NULL;
|
STableMeta* pTableMeta = NULL;
|
||||||
|
|
||||||
terrno = TSDB_CODE_SUCCESS;
|
terrno = TSDB_CODE_SUCCESS;
|
||||||
SRequestObj* pRequest = (SRequestObj*)createRequest(*(int64_t*)taos, TSDB_SQL_INSERT);
|
SRequestObj* pRequest = (SRequestObj*)createRequest(*(int64_t*)taos, TSDB_SQL_INSERT, 0);
|
||||||
if (!pRequest) {
|
if (!pRequest) {
|
||||||
uError("WriteRaw:createRequest error request is null");
|
uError("WriteRaw:createRequest error request is null");
|
||||||
return terrno;
|
return terrno;
|
||||||
|
|
|
@ -28,12 +28,12 @@
|
||||||
#define QUOTE '"'
|
#define QUOTE '"'
|
||||||
#define SLASH '\\'
|
#define SLASH '\\'
|
||||||
|
|
||||||
#define JUMP_SPACE(sql, sqlEnd) \
|
#define JUMP_SPACE(sql, sqlEnd) \
|
||||||
while (sql < sqlEnd) { \
|
while (sql < sqlEnd) { \
|
||||||
if (*sql == SPACE) \
|
if (*sql == SPACE) \
|
||||||
sql++; \
|
sql++; \
|
||||||
else \
|
else \
|
||||||
break; \
|
break; \
|
||||||
}
|
}
|
||||||
// comma ,
|
// comma ,
|
||||||
#define IS_SLASH_COMMA(sql) (*(sql) == COMMA && *((sql)-1) == SLASH)
|
#define IS_SLASH_COMMA(sql) (*(sql) == COMMA && *((sql)-1) == SLASH)
|
||||||
|
@ -353,7 +353,7 @@ static int32_t smlSendMetaMsg(SSmlHandle *info, SName *pName, SArray *pColumns,
|
||||||
pReq.numOfTags = taosArrayGetSize(pTags);
|
pReq.numOfTags = taosArrayGetSize(pTags);
|
||||||
pReq.pTags = pTags;
|
pReq.pTags = pTags;
|
||||||
|
|
||||||
code = buildRequest(info->taos->id, "", 0, NULL, false, &pRequest);
|
code = buildRequest(info->taos->id, "", 0, NULL, false, &pRequest, 0);
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
@ -1010,9 +1010,9 @@ static void smlParseTelnetElement(const char **sql, const char *sqlEnd, const ch
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t smlParseTelnetTags(const char *data, const char *sqlEnd, SArray *cols, char *childTableName, SHashObj *dumplicateKey,
|
static int32_t smlParseTelnetTags(const char *data, const char *sqlEnd, SArray *cols, char *childTableName,
|
||||||
SSmlMsgBuf *msg) {
|
SHashObj *dumplicateKey, SSmlMsgBuf *msg) {
|
||||||
if(!cols) return TSDB_CODE_OUT_OF_MEMORY;
|
if (!cols) return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
const char *sql = data;
|
const char *sql = data;
|
||||||
size_t childTableNameLen = strlen(tsSmlChildTableName);
|
size_t childTableNameLen = strlen(tsSmlChildTableName);
|
||||||
while (sql < sqlEnd) {
|
while (sql < sqlEnd) {
|
||||||
|
@ -1093,7 +1093,8 @@ static int32_t smlParseTelnetTags(const char *data, const char *sqlEnd, SArray *
|
||||||
}
|
}
|
||||||
|
|
||||||
// format: <metric> <timestamp> <value> <tagk_1>=<tagv_1>[ <tagk_n>=<tagv_n>]
|
// format: <metric> <timestamp> <value> <tagk_1>=<tagv_1>[ <tagk_n>=<tagv_n>]
|
||||||
static int32_t smlParseTelnetString(SSmlHandle *info, const char *sql, const char *sqlEnd, SSmlTableInfo *tinfo, SArray *cols) {
|
static int32_t smlParseTelnetString(SSmlHandle *info, const char *sql, const char *sqlEnd, SSmlTableInfo *tinfo,
|
||||||
|
SArray *cols) {
|
||||||
if (!sql) return TSDB_CODE_SML_INVALID_DATA;
|
if (!sql) return TSDB_CODE_SML_INVALID_DATA;
|
||||||
|
|
||||||
// parse metric
|
// parse metric
|
||||||
|
@ -1372,19 +1373,19 @@ static int32_t smlKvTimeArrayCompare(const void *key1, const void *key2) {
|
||||||
static int32_t smlKvTimeHashCompare(const void *key1, const void *key2) {
|
static int32_t smlKvTimeHashCompare(const void *key1, const void *key2) {
|
||||||
SHashObj *s1 = *(SHashObj **)key1;
|
SHashObj *s1 = *(SHashObj **)key1;
|
||||||
SHashObj *s2 = *(SHashObj **)key2;
|
SHashObj *s2 = *(SHashObj **)key2;
|
||||||
SSmlKv **kv1pp = (SSmlKv **)taosHashGet(s1, TS, TS_LEN);
|
SSmlKv **kv1pp = (SSmlKv **)taosHashGet(s1, TS, TS_LEN);
|
||||||
SSmlKv **kv2pp = (SSmlKv **)taosHashGet(s2, TS, TS_LEN);
|
SSmlKv **kv2pp = (SSmlKv **)taosHashGet(s2, TS, TS_LEN);
|
||||||
if(!kv1pp || !kv2pp){
|
if (!kv1pp || !kv2pp) {
|
||||||
uError("smlKvTimeHashCompare kv is null");
|
uError("smlKvTimeHashCompare kv is null");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
SSmlKv *kv1 = *kv1pp;
|
SSmlKv *kv1 = *kv1pp;
|
||||||
SSmlKv *kv2 = *kv2pp;
|
SSmlKv *kv2 = *kv2pp;
|
||||||
if(!kv1 || kv1->type != TSDB_DATA_TYPE_TIMESTAMP){
|
if (!kv1 || kv1->type != TSDB_DATA_TYPE_TIMESTAMP) {
|
||||||
uError("smlKvTimeHashCompare kv1");
|
uError("smlKvTimeHashCompare kv1");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if(!kv2 || kv2->type != TSDB_DATA_TYPE_TIMESTAMP){
|
if (!kv2 || kv2->type != TSDB_DATA_TYPE_TIMESTAMP) {
|
||||||
uError("smlKvTimeHashCompare kv2");
|
uError("smlKvTimeHashCompare kv2");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -1947,7 +1948,7 @@ static int32_t smlParseValueFromJSON(cJSON *root, SSmlKv *kv) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t smlParseColsFromJSON(cJSON *root, SArray *cols) {
|
static int32_t smlParseColsFromJSON(cJSON *root, SArray *cols) {
|
||||||
if(!cols) return TSDB_CODE_OUT_OF_MEMORY;
|
if (!cols) return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
cJSON *metricVal = cJSON_GetObjectItem(root, "value");
|
cJSON *metricVal = cJSON_GetObjectItem(root, "value");
|
||||||
if (metricVal == NULL) {
|
if (metricVal == NULL) {
|
||||||
return TSDB_CODE_TSC_INVALID_JSON;
|
return TSDB_CODE_TSC_INVALID_JSON;
|
||||||
|
@ -1971,7 +1972,7 @@ static int32_t smlParseColsFromJSON(cJSON *root, SArray *cols) {
|
||||||
static int32_t smlParseTagsFromJSON(cJSON *root, SArray *pKVs, char *childTableName, SHashObj *dumplicateKey,
|
static int32_t smlParseTagsFromJSON(cJSON *root, SArray *pKVs, char *childTableName, SHashObj *dumplicateKey,
|
||||||
SSmlMsgBuf *msg) {
|
SSmlMsgBuf *msg) {
|
||||||
int32_t ret = TSDB_CODE_SUCCESS;
|
int32_t ret = TSDB_CODE_SUCCESS;
|
||||||
if (!pKVs){
|
if (!pKVs) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
cJSON *tags = cJSON_GetObjectItem(root, "tags");
|
cJSON *tags = cJSON_GetObjectItem(root, "tags");
|
||||||
|
@ -2204,7 +2205,7 @@ static int32_t smlParseTelnetLine(SSmlHandle *info, void *data, const int len) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (info->protocol == TSDB_SML_TELNET_PROTOCOL) {
|
if (info->protocol == TSDB_SML_TELNET_PROTOCOL) {
|
||||||
ret = smlParseTelnetString(info, (const char *)data, (char*)data + len, tinfo, cols);
|
ret = smlParseTelnetString(info, (const char *)data, (char *)data + len, tinfo, cols);
|
||||||
} else if (info->protocol == TSDB_SML_JSON_PROTOCOL) {
|
} else if (info->protocol == TSDB_SML_JSON_PROTOCOL) {
|
||||||
ret = smlParseJSONString(info, (cJSON *)data, tinfo, cols);
|
ret = smlParseJSONString(info, (cJSON *)data, tinfo, cols);
|
||||||
} else {
|
} else {
|
||||||
|
@ -2384,16 +2385,16 @@ static void smlPrintStatisticInfo(SSmlHandle *info) {
|
||||||
info->cost.endTime - info->cost.insertRpcTime, info->cost.endTime - info->cost.parseTime);
|
info->cost.endTime - info->cost.insertRpcTime, info->cost.endTime - info->cost.parseTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t smlParseLine(SSmlHandle *info, char *lines[], char* rawLine, char* rawLineEnd, int numLines) {
|
static int32_t smlParseLine(SSmlHandle *info, char *lines[], char *rawLine, char *rawLineEnd, int numLines) {
|
||||||
int32_t code = TSDB_CODE_SUCCESS;
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
if (info->protocol == TSDB_SML_JSON_PROTOCOL) {
|
if (info->protocol == TSDB_SML_JSON_PROTOCOL) {
|
||||||
if(lines){
|
if (lines) {
|
||||||
code = smlParseJSON(info, *lines);
|
code = smlParseJSON(info, *lines);
|
||||||
}else if(rawLine){
|
} else if (rawLine) {
|
||||||
code = smlParseJSON(info, rawLine);
|
code = smlParseJSON(info, rawLine);
|
||||||
}
|
}
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
uError("SML:0x%" PRIx64 " smlParseJSON failed:%s", info->id, lines?*lines:rawLine);
|
uError("SML:0x%" PRIx64 " smlParseJSON failed:%s", info->id, lines ? *lines : rawLine);
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
return code;
|
return code;
|
||||||
|
@ -2401,19 +2402,19 @@ static int32_t smlParseLine(SSmlHandle *info, char *lines[], char* rawLine, char
|
||||||
|
|
||||||
for (int32_t i = 0; i < numLines; ++i) {
|
for (int32_t i = 0; i < numLines; ++i) {
|
||||||
char *tmp = NULL;
|
char *tmp = NULL;
|
||||||
int len = 0;
|
int len = 0;
|
||||||
if(lines){
|
if (lines) {
|
||||||
tmp = lines[i];
|
tmp = lines[i];
|
||||||
len = strlen(tmp);
|
len = strlen(tmp);
|
||||||
}else if(rawLine){
|
} else if (rawLine) {
|
||||||
tmp = rawLine;
|
tmp = rawLine;
|
||||||
while(rawLine < rawLineEnd){
|
while (rawLine < rawLineEnd) {
|
||||||
if(*(rawLine++) == '\n'){
|
if (*(rawLine++) == '\n') {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
len++;
|
len++;
|
||||||
}
|
}
|
||||||
if(info->protocol == TSDB_SML_LINE_PROTOCOL && tmp[0] == '#'){ // this line is comment
|
if (info->protocol == TSDB_SML_LINE_PROTOCOL && tmp[0] == '#') { // this line is comment
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2433,7 +2434,7 @@ static int32_t smlParseLine(SSmlHandle *info, char *lines[], char* rawLine, char
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int smlProcess(SSmlHandle *info, char *lines[], char* rawLine, char* rawLineEnd, int numLines) {
|
static int smlProcess(SSmlHandle *info, char *lines[], char *rawLine, char *rawLineEnd, int numLines) {
|
||||||
int32_t code = TSDB_CODE_SUCCESS;
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
int32_t retryNum = 0;
|
int32_t retryNum = 0;
|
||||||
|
|
||||||
|
@ -2532,8 +2533,8 @@ static void smlInsertCallback(void *param, void *res, int32_t code) {
|
||||||
smlDestroyInfo(info);
|
smlDestroyInfo(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TAOS_RES *taos_schemaless_insert_inner(SRequestObj *request, char *lines[], char *rawLine, char *rawLineEnd,
|
||||||
TAOS_RES *taos_schemaless_insert_inner(SRequestObj *request, char *lines[], char *rawLine, char *rawLineEnd, int numLines, int protocol, int precision) {
|
int numLines, int protocol, int precision) {
|
||||||
int batchs = 0;
|
int batchs = 0;
|
||||||
STscObj *pTscObj = request->pTscObj;
|
STscObj *pTscObj = request->pTscObj;
|
||||||
|
|
||||||
|
@ -2581,7 +2582,7 @@ TAOS_RES *taos_schemaless_insert_inner(SRequestObj *request, char *lines[], char
|
||||||
batchs = ceil(((double)numLines) / LINE_BATCH);
|
batchs = ceil(((double)numLines) / LINE_BATCH);
|
||||||
params.total = batchs;
|
params.total = batchs;
|
||||||
for (int i = 0; i < batchs; ++i) {
|
for (int i = 0; i < batchs; ++i) {
|
||||||
SRequestObj *req = (SRequestObj *)createRequest(pTscObj->id, TSDB_SQL_INSERT);
|
SRequestObj *req = (SRequestObj *)createRequest(pTscObj->id, TSDB_SQL_INSERT, 0);
|
||||||
if (!req) {
|
if (!req) {
|
||||||
request->code = TSDB_CODE_OUT_OF_MEMORY;
|
request->code = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
uError("SML:taos_schemaless_insert error request is null");
|
uError("SML:taos_schemaless_insert error request is null");
|
||||||
|
@ -2608,16 +2609,16 @@ TAOS_RES *taos_schemaless_insert_inner(SRequestObj *request, char *lines[], char
|
||||||
info->pRequest->body.queryFp = smlInsertCallback;
|
info->pRequest->body.queryFp = smlInsertCallback;
|
||||||
info->pRequest->body.param = info;
|
info->pRequest->body.param = info;
|
||||||
int32_t code = smlProcess(info, lines, rawLine, rawLineEnd, perBatch);
|
int32_t code = smlProcess(info, lines, rawLine, rawLineEnd, perBatch);
|
||||||
if(lines){
|
if (lines) {
|
||||||
lines += perBatch;
|
lines += perBatch;
|
||||||
}
|
}
|
||||||
if(rawLine){
|
if (rawLine) {
|
||||||
int num = 0;
|
int num = 0;
|
||||||
while(rawLine < rawLineEnd){
|
while (rawLine < rawLineEnd) {
|
||||||
if(*(rawLine++) == '\n'){
|
if (*(rawLine++) == '\n') {
|
||||||
num++;
|
num++;
|
||||||
}
|
}
|
||||||
if(num == perBatch){
|
if (num == perBatch) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2628,7 +2629,7 @@ TAOS_RES *taos_schemaless_insert_inner(SRequestObj *request, char *lines[], char
|
||||||
}
|
}
|
||||||
tsem_wait(¶ms.sem);
|
tsem_wait(¶ms.sem);
|
||||||
|
|
||||||
end:
|
end:
|
||||||
taosThreadSpinDestroy(¶ms.lock);
|
taosThreadSpinDestroy(¶ms.lock);
|
||||||
tsem_destroy(¶ms.sem);
|
tsem_destroy(¶ms.sem);
|
||||||
// ((STscObj *)taos)->schemalessType = 0;
|
// ((STscObj *)taos)->schemalessType = 0;
|
||||||
|
@ -2653,9 +2654,7 @@ TAOS_RES *taos_schemaless_insert_inner(SRequestObj *request, char *lines[], char
|
||||||
* 0 - influxDB line protocol
|
* 0 - influxDB line protocol
|
||||||
* 1 - OpenTSDB telnet line protocol
|
* 1 - OpenTSDB telnet line protocol
|
||||||
* 2 - OpenTSDB JSON format protocol
|
* 2 - OpenTSDB JSON format protocol
|
||||||
* @return return zero for successful insertion. Otherwise return none-zero error code of
|
* @return TAOS_RES
|
||||||
* failure reason.
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
TAOS_RES *taos_schemaless_insert(TAOS *taos, char *lines[], int numLines, int protocol, int precision) {
|
TAOS_RES *taos_schemaless_insert(TAOS *taos, char *lines[], int numLines, int protocol, int precision) {
|
||||||
|
@ -2664,7 +2663,7 @@ TAOS_RES *taos_schemaless_insert(TAOS *taos, char *lines[], int numLines, int pr
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
SRequestObj *request = (SRequestObj *)createRequest(*(int64_t *)taos, TSDB_SQL_INSERT);
|
SRequestObj *request = (SRequestObj *)createRequest(*(int64_t *)taos, TSDB_SQL_INSERT, 0);
|
||||||
if (!request) {
|
if (!request) {
|
||||||
uError("SML:taos_schemaless_insert error request is null");
|
uError("SML:taos_schemaless_insert error request is null");
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -2680,13 +2679,37 @@ TAOS_RES *taos_schemaless_insert(TAOS *taos, char *lines[], int numLines, int pr
|
||||||
return taos_schemaless_insert_inner(request, lines, NULL, NULL, numLines, protocol, precision);
|
return taos_schemaless_insert_inner(request, lines, NULL, NULL, numLines, protocol, precision);
|
||||||
}
|
}
|
||||||
|
|
||||||
TAOS_RES *taos_schemaless_insert_raw(TAOS* taos, char* lines, int len, int32_t *totalRows, int protocol, int precision){
|
TAOS_RES *taos_schemaless_insert_with_reqid(TAOS *taos, char *lines[], int numLines, int protocol, int precision,
|
||||||
|
int64_t reqid) {
|
||||||
if (NULL == taos) {
|
if (NULL == taos) {
|
||||||
terrno = TSDB_CODE_TSC_DISCONNECTED;
|
terrno = TSDB_CODE_TSC_DISCONNECTED;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
SRequestObj *request = (SRequestObj *)createRequest(*(int64_t *)taos, TSDB_SQL_INSERT);
|
SRequestObj *request = (SRequestObj *)createRequest(*(int64_t *)taos, TSDB_SQL_INSERT, reqid);
|
||||||
|
if (!request) {
|
||||||
|
uError("SML:taos_schemaless_insert error request is null");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!lines) {
|
||||||
|
SSmlMsgBuf msg = {ERROR_MSG_BUF_DEFAULT_SIZE, request->msgBuf};
|
||||||
|
request->code = TSDB_CODE_SML_INVALID_DATA;
|
||||||
|
smlBuildInvalidDataMsg(&msg, "lines is null", NULL);
|
||||||
|
return (TAOS_RES *)request;
|
||||||
|
}
|
||||||
|
|
||||||
|
return taos_schemaless_insert_inner(request, lines, NULL, NULL, numLines, protocol, precision);
|
||||||
|
}
|
||||||
|
|
||||||
|
TAOS_RES *taos_schemaless_insert_raw(TAOS *taos, char *lines, int len, int32_t *totalRows, int protocol,
|
||||||
|
int precision) {
|
||||||
|
if (NULL == taos) {
|
||||||
|
terrno = TSDB_CODE_TSC_DISCONNECTED;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
SRequestObj *request = (SRequestObj *)createRequest(*(int64_t *)taos, TSDB_SQL_INSERT, 0);
|
||||||
if (!request) {
|
if (!request) {
|
||||||
uError("SML:taos_schemaless_insert error request is null");
|
uError("SML:taos_schemaless_insert error request is null");
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -2702,10 +2725,45 @@ TAOS_RES *taos_schemaless_insert_raw(TAOS* taos, char* lines, int len, int32_t *
|
||||||
int numLines = 0;
|
int numLines = 0;
|
||||||
*totalRows = 0;
|
*totalRows = 0;
|
||||||
char *tmp = lines;
|
char *tmp = lines;
|
||||||
for(int i = 0; i < len; i++){
|
for (int i = 0; i < len; i++) {
|
||||||
if(lines[i] == '\n' || i == len - 1){
|
if (lines[i] == '\n' || i == len - 1) {
|
||||||
numLines++;
|
numLines++;
|
||||||
if(tmp[0] != '#' || protocol != TSDB_SML_LINE_PROTOCOL){ //ignore comment
|
if (tmp[0] != '#' || protocol != TSDB_SML_LINE_PROTOCOL) { // ignore comment
|
||||||
|
(*totalRows)++;
|
||||||
|
}
|
||||||
|
tmp = lines + i + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return taos_schemaless_insert_inner(request, NULL, lines, lines + len, numLines, protocol, precision);
|
||||||
|
}
|
||||||
|
|
||||||
|
TAOS_RES *taos_schemaless_insert_raw_with_reqid(TAOS *taos, char *lines, int len, int32_t *totalRows, int protocol,
|
||||||
|
int precision, int64_t reqid) {
|
||||||
|
if (NULL == taos) {
|
||||||
|
terrno = TSDB_CODE_TSC_DISCONNECTED;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
SRequestObj *request = (SRequestObj *)createRequest(*(int64_t *)taos, TSDB_SQL_INSERT, reqid);
|
||||||
|
if (!request) {
|
||||||
|
uError("SML:taos_schemaless_insert error request is null");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!lines || len <= 0) {
|
||||||
|
SSmlMsgBuf msg = {ERROR_MSG_BUF_DEFAULT_SIZE, request->msgBuf};
|
||||||
|
request->code = TSDB_CODE_SML_INVALID_DATA;
|
||||||
|
smlBuildInvalidDataMsg(&msg, "lines is null", NULL);
|
||||||
|
return (TAOS_RES *)request;
|
||||||
|
}
|
||||||
|
|
||||||
|
int numLines = 0;
|
||||||
|
*totalRows = 0;
|
||||||
|
char *tmp = lines;
|
||||||
|
for (int i = 0; i < len; i++) {
|
||||||
|
if (lines[i] == '\n' || i == len - 1) {
|
||||||
|
numLines++;
|
||||||
|
if (tmp[0] != '#' || protocol != TSDB_SML_LINE_PROTOCOL) { // ignore comment
|
||||||
(*totalRows)++;
|
(*totalRows)++;
|
||||||
}
|
}
|
||||||
tmp = lines + i + 1;
|
tmp = lines + i + 1;
|
||||||
|
|
|
@ -5,11 +5,18 @@
|
||||||
|
|
||||||
#include "clientStmt.h"
|
#include "clientStmt.h"
|
||||||
|
|
||||||
|
char* gStmtStatusStr[] = {"unknown", "init", "prepare", "settbname", "settags",
|
||||||
|
"fetchFields", "bind", "bindCol", "addBatch", "exec"};
|
||||||
|
|
||||||
static int32_t stmtCreateRequest(STscStmt* pStmt) {
|
static int32_t stmtCreateRequest(STscStmt* pStmt) {
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
|
|
||||||
if (pStmt->exec.pRequest == NULL) {
|
if (pStmt->exec.pRequest == NULL) {
|
||||||
code = buildRequest(pStmt->taos->id, pStmt->sql.sqlStr, pStmt->sql.sqlLen, NULL, false, &pStmt->exec.pRequest);
|
code = buildRequest(pStmt->taos->id, pStmt->sql.sqlStr, pStmt->sql.sqlLen, NULL, false, &pStmt->exec.pRequest,
|
||||||
|
pStmt->reqid);
|
||||||
|
if (pStmt->reqid != 0) {
|
||||||
|
pStmt->reqid++;
|
||||||
|
}
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
pStmt->exec.pRequest->syncQuery = true;
|
pStmt->exec.pRequest->syncQuery = true;
|
||||||
}
|
}
|
||||||
|
@ -21,6 +28,10 @@ static int32_t stmtCreateRequest(STscStmt* pStmt) {
|
||||||
int32_t stmtSwitchStatus(STscStmt* pStmt, STMT_STATUS newStatus) {
|
int32_t stmtSwitchStatus(STscStmt* pStmt, STMT_STATUS newStatus) {
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
|
|
||||||
|
if (newStatus >= STMT_INIT && newStatus < STMT_MAX) {
|
||||||
|
STMT_LOG_SEQ(newStatus);
|
||||||
|
}
|
||||||
|
|
||||||
switch (newStatus) {
|
switch (newStatus) {
|
||||||
case STMT_PREPARE:
|
case STMT_PREPARE:
|
||||||
break;
|
break;
|
||||||
|
@ -201,10 +212,10 @@ int32_t stmtCacheBlock(STscStmt* pStmt) {
|
||||||
}
|
}
|
||||||
|
|
||||||
STableDataBlocks** pSrc = taosHashGet(pStmt->exec.pBlockHash, pStmt->bInfo.tbFName, strlen(pStmt->bInfo.tbFName));
|
STableDataBlocks** pSrc = taosHashGet(pStmt->exec.pBlockHash, pStmt->bInfo.tbFName, strlen(pStmt->bInfo.tbFName));
|
||||||
if(!pSrc){
|
if (!pSrc) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
STableDataBlocks* pDst = NULL;
|
STableDataBlocks* pDst = NULL;
|
||||||
|
|
||||||
STMT_ERR_RET(qCloneStmtDataBlock(&pDst, *pSrc));
|
STMT_ERR_RET(qCloneStmtDataBlock(&pDst, *pSrc));
|
||||||
|
|
||||||
|
@ -507,7 +518,7 @@ int32_t stmtResetStmt(STscStmt* pStmt) {
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
TAOS_STMT* stmtInit(STscObj* taos) {
|
TAOS_STMT* stmtInit(STscObj* taos, int64_t reqid) {
|
||||||
STscObj* pObj = (STscObj*)taos;
|
STscObj* pObj = (STscObj*)taos;
|
||||||
STscStmt* pStmt = NULL;
|
STscStmt* pStmt = NULL;
|
||||||
|
|
||||||
|
@ -527,6 +538,11 @@ TAOS_STMT* stmtInit(STscObj* taos) {
|
||||||
pStmt->taos = pObj;
|
pStmt->taos = pObj;
|
||||||
pStmt->bInfo.needParse = true;
|
pStmt->bInfo.needParse = true;
|
||||||
pStmt->sql.status = STMT_INIT;
|
pStmt->sql.status = STMT_INIT;
|
||||||
|
pStmt->reqid = reqid;
|
||||||
|
|
||||||
|
STMT_LOG_SEQ(STMT_INIT);
|
||||||
|
|
||||||
|
tscDebug("stmt:%p initialized", pStmt);
|
||||||
|
|
||||||
return pStmt;
|
return pStmt;
|
||||||
}
|
}
|
||||||
|
@ -534,7 +550,7 @@ TAOS_STMT* stmtInit(STscObj* taos) {
|
||||||
int stmtPrepare(TAOS_STMT* stmt, const char* sql, unsigned long length) {
|
int stmtPrepare(TAOS_STMT* stmt, const char* sql, unsigned long length) {
|
||||||
STscStmt* pStmt = (STscStmt*)stmt;
|
STscStmt* pStmt = (STscStmt*)stmt;
|
||||||
|
|
||||||
tscDebug("stmt start to prepare");
|
STMT_DLOG_E("start to prepare");
|
||||||
|
|
||||||
if (pStmt->sql.status >= STMT_PREPARE) {
|
if (pStmt->sql.status >= STMT_PREPARE) {
|
||||||
STMT_ERR_RET(stmtResetStmt(pStmt));
|
STMT_ERR_RET(stmtResetStmt(pStmt));
|
||||||
|
@ -555,7 +571,7 @@ int stmtPrepare(TAOS_STMT* stmt, const char* sql, unsigned long length) {
|
||||||
int stmtSetTbName(TAOS_STMT* stmt, const char* tbName) {
|
int stmtSetTbName(TAOS_STMT* stmt, const char* tbName) {
|
||||||
STscStmt* pStmt = (STscStmt*)stmt;
|
STscStmt* pStmt = (STscStmt*)stmt;
|
||||||
|
|
||||||
tscDebug("stmt start to set tbName: %s", tbName);
|
STMT_DLOG("start to set tbName: %s", tbName);
|
||||||
|
|
||||||
STMT_ERR_RET(stmtSwitchStatus(pStmt, STMT_SETTBNAME));
|
STMT_ERR_RET(stmtSwitchStatus(pStmt, STMT_SETTBNAME));
|
||||||
|
|
||||||
|
@ -587,7 +603,7 @@ int stmtSetTbName(TAOS_STMT* stmt, const char* tbName) {
|
||||||
int stmtSetTbTags(TAOS_STMT* stmt, TAOS_MULTI_BIND* tags) {
|
int stmtSetTbTags(TAOS_STMT* stmt, TAOS_MULTI_BIND* tags) {
|
||||||
STscStmt* pStmt = (STscStmt*)stmt;
|
STscStmt* pStmt = (STscStmt*)stmt;
|
||||||
|
|
||||||
tscDebug("stmt start to set tbTags");
|
STMT_DLOG_E("start to set tbTags");
|
||||||
|
|
||||||
STMT_ERR_RET(stmtSwitchStatus(pStmt, STMT_SETTAGS));
|
STMT_ERR_RET(stmtSwitchStatus(pStmt, STMT_SETTAGS));
|
||||||
|
|
||||||
|
@ -649,7 +665,7 @@ int stmtFetchColFields(STscStmt* pStmt, int32_t* fieldNum, TAOS_FIELD_E** fields
|
||||||
int stmtBindBatch(TAOS_STMT* stmt, TAOS_MULTI_BIND* bind, int32_t colIdx) {
|
int stmtBindBatch(TAOS_STMT* stmt, TAOS_MULTI_BIND* bind, int32_t colIdx) {
|
||||||
STscStmt* pStmt = (STscStmt*)stmt;
|
STscStmt* pStmt = (STscStmt*)stmt;
|
||||||
|
|
||||||
tscDebug("start to bind stmt data, colIdx: %d", colIdx);
|
STMT_DLOG("start to bind stmt data, colIdx: %d", colIdx);
|
||||||
|
|
||||||
STMT_ERR_RET(stmtSwitchStatus(pStmt, STMT_BIND));
|
STMT_ERR_RET(stmtSwitchStatus(pStmt, STMT_BIND));
|
||||||
|
|
||||||
|
@ -743,7 +759,7 @@ int stmtBindBatch(TAOS_STMT* stmt, TAOS_MULTI_BIND* bind, int32_t colIdx) {
|
||||||
int stmtAddBatch(TAOS_STMT* stmt) {
|
int stmtAddBatch(TAOS_STMT* stmt) {
|
||||||
STscStmt* pStmt = (STscStmt*)stmt;
|
STscStmt* pStmt = (STscStmt*)stmt;
|
||||||
|
|
||||||
tscDebug("stmt start to add batch");
|
STMT_DLOG_E("start to add batch");
|
||||||
|
|
||||||
STMT_ERR_RET(stmtSwitchStatus(pStmt, STMT_ADD_BATCH));
|
STMT_ERR_RET(stmtSwitchStatus(pStmt, STMT_ADD_BATCH));
|
||||||
|
|
||||||
|
@ -756,8 +772,7 @@ int stmtUpdateTableUid(STscStmt* pStmt, SSubmitRsp* pRsp) {
|
||||||
tscDebug("stmt start to update tbUid, blockNum: %d", pRsp->nBlocks);
|
tscDebug("stmt start to update tbUid, blockNum: %d", pRsp->nBlocks);
|
||||||
|
|
||||||
if (pRsp->nBlocks <= 0) {
|
if (pRsp->nBlocks <= 0) {
|
||||||
tscError("invalid submit resp block number %d", pRsp->nBlocks);
|
return TSDB_CODE_SUCCESS;
|
||||||
STMT_ERR_RET(TSDB_CODE_TSC_APP_ERROR);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t keyLen = 0;
|
size_t keyLen = 0;
|
||||||
|
@ -810,7 +825,7 @@ int stmtExec(TAOS_STMT* stmt) {
|
||||||
SSubmitRsp* pRsp = NULL;
|
SSubmitRsp* pRsp = NULL;
|
||||||
bool autoCreateTbl = pStmt->exec.autoCreateTbl;
|
bool autoCreateTbl = pStmt->exec.autoCreateTbl;
|
||||||
|
|
||||||
tscDebug("stmt start to exec");
|
STMT_DLOG_E("start to exec");
|
||||||
|
|
||||||
STMT_ERR_RET(stmtSwitchStatus(pStmt, STMT_EXECUTE));
|
STMT_ERR_RET(stmtSwitchStatus(pStmt, STMT_EXECUTE));
|
||||||
|
|
||||||
|
@ -885,6 +900,8 @@ int stmtAffectedRowsOnce(TAOS_STMT* stmt) { return ((STscStmt*)stmt)->exec.affec
|
||||||
int stmtIsInsert(TAOS_STMT* stmt, int* insert) {
|
int stmtIsInsert(TAOS_STMT* stmt, int* insert) {
|
||||||
STscStmt* pStmt = (STscStmt*)stmt;
|
STscStmt* pStmt = (STscStmt*)stmt;
|
||||||
|
|
||||||
|
STMT_DLOG_E("start is insert");
|
||||||
|
|
||||||
if (pStmt->sql.type) {
|
if (pStmt->sql.type) {
|
||||||
*insert = (STMT_TYPE_INSERT == pStmt->sql.type || STMT_TYPE_MULTI_INSERT == pStmt->sql.type);
|
*insert = (STMT_TYPE_INSERT == pStmt->sql.type || STMT_TYPE_MULTI_INSERT == pStmt->sql.type);
|
||||||
} else {
|
} else {
|
||||||
|
@ -897,6 +914,8 @@ int stmtIsInsert(TAOS_STMT* stmt, int* insert) {
|
||||||
int stmtGetTagFields(TAOS_STMT* stmt, int* nums, TAOS_FIELD_E** fields) {
|
int stmtGetTagFields(TAOS_STMT* stmt, int* nums, TAOS_FIELD_E** fields) {
|
||||||
STscStmt* pStmt = (STscStmt*)stmt;
|
STscStmt* pStmt = (STscStmt*)stmt;
|
||||||
|
|
||||||
|
STMT_DLOG_E("start to get tag fields");
|
||||||
|
|
||||||
if (STMT_TYPE_QUERY == pStmt->sql.type) {
|
if (STMT_TYPE_QUERY == pStmt->sql.type) {
|
||||||
STMT_RET(TSDB_CODE_TSC_STMT_API_ERROR);
|
STMT_RET(TSDB_CODE_TSC_STMT_API_ERROR);
|
||||||
}
|
}
|
||||||
|
@ -927,6 +946,8 @@ int stmtGetTagFields(TAOS_STMT* stmt, int* nums, TAOS_FIELD_E** fields) {
|
||||||
int stmtGetColFields(TAOS_STMT* stmt, int* nums, TAOS_FIELD_E** fields) {
|
int stmtGetColFields(TAOS_STMT* stmt, int* nums, TAOS_FIELD_E** fields) {
|
||||||
STscStmt* pStmt = (STscStmt*)stmt;
|
STscStmt* pStmt = (STscStmt*)stmt;
|
||||||
|
|
||||||
|
STMT_DLOG_E("start to get col fields");
|
||||||
|
|
||||||
if (STMT_TYPE_QUERY == pStmt->sql.type) {
|
if (STMT_TYPE_QUERY == pStmt->sql.type) {
|
||||||
STMT_RET(TSDB_CODE_TSC_STMT_API_ERROR);
|
STMT_RET(TSDB_CODE_TSC_STMT_API_ERROR);
|
||||||
}
|
}
|
||||||
|
@ -957,6 +978,8 @@ int stmtGetColFields(TAOS_STMT* stmt, int* nums, TAOS_FIELD_E** fields) {
|
||||||
int stmtGetParamNum(TAOS_STMT* stmt, int* nums) {
|
int stmtGetParamNum(TAOS_STMT* stmt, int* nums) {
|
||||||
STscStmt* pStmt = (STscStmt*)stmt;
|
STscStmt* pStmt = (STscStmt*)stmt;
|
||||||
|
|
||||||
|
STMT_DLOG_E("start to get param num");
|
||||||
|
|
||||||
STMT_ERR_RET(stmtSwitchStatus(pStmt, STMT_FETCH_FIELDS));
|
STMT_ERR_RET(stmtSwitchStatus(pStmt, STMT_FETCH_FIELDS));
|
||||||
|
|
||||||
if (pStmt->bInfo.needParse && pStmt->sql.runTimes && pStmt->sql.type > 0 &&
|
if (pStmt->bInfo.needParse && pStmt->sql.runTimes && pStmt->sql.type > 0 &&
|
||||||
|
@ -986,6 +1009,8 @@ int stmtGetParamNum(TAOS_STMT* stmt, int* nums) {
|
||||||
int stmtGetParam(TAOS_STMT* stmt, int idx, int* type, int* bytes) {
|
int stmtGetParam(TAOS_STMT* stmt, int idx, int* type, int* bytes) {
|
||||||
STscStmt* pStmt = (STscStmt*)stmt;
|
STscStmt* pStmt = (STscStmt*)stmt;
|
||||||
|
|
||||||
|
STMT_DLOG_E("start to get param");
|
||||||
|
|
||||||
if (STMT_TYPE_QUERY == pStmt->sql.type) {
|
if (STMT_TYPE_QUERY == pStmt->sql.type) {
|
||||||
STMT_RET(TSDB_CODE_TSC_STMT_API_ERROR);
|
STMT_RET(TSDB_CODE_TSC_STMT_API_ERROR);
|
||||||
}
|
}
|
||||||
|
@ -1028,6 +1053,8 @@ int stmtGetParam(TAOS_STMT* stmt, int idx, int* type, int* bytes) {
|
||||||
TAOS_RES* stmtUseResult(TAOS_STMT* stmt) {
|
TAOS_RES* stmtUseResult(TAOS_STMT* stmt) {
|
||||||
STscStmt* pStmt = (STscStmt*)stmt;
|
STscStmt* pStmt = (STscStmt*)stmt;
|
||||||
|
|
||||||
|
STMT_DLOG_E("start to use result");
|
||||||
|
|
||||||
if (STMT_TYPE_QUERY != pStmt->sql.type) {
|
if (STMT_TYPE_QUERY != pStmt->sql.type) {
|
||||||
tscError("useResult only for query statement");
|
tscError("useResult only for query statement");
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -1649,7 +1649,7 @@ void* tmqHandleAllRsp(tmq_t* tmq, int64_t timeout, bool pollIfReset) {
|
||||||
taosFreeQitem(pollRspWrapper);
|
taosFreeQitem(pollRspWrapper);
|
||||||
return pRsp;
|
return pRsp;
|
||||||
} else {
|
} else {
|
||||||
tscDebug("msg discard since epoch mismatch: msg epoch %d, consumer epoch %d\n",
|
tscDebug("msg discard since epoch mismatch: msg epoch %d, consumer epoch %d",
|
||||||
pollRspWrapper->dataRsp.head.epoch, consumerEpoch);
|
pollRspWrapper->dataRsp.head.epoch, consumerEpoch);
|
||||||
taosFreeQitem(pollRspWrapper);
|
taosFreeQitem(pollRspWrapper);
|
||||||
}
|
}
|
||||||
|
@ -1667,7 +1667,7 @@ void* tmqHandleAllRsp(tmq_t* tmq, int64_t timeout, bool pollIfReset) {
|
||||||
taosFreeQitem(pollRspWrapper);
|
taosFreeQitem(pollRspWrapper);
|
||||||
return pRsp;
|
return pRsp;
|
||||||
} else {
|
} else {
|
||||||
tscDebug("msg discard since epoch mismatch: msg epoch %d, consumer epoch %d\n",
|
tscDebug("msg discard since epoch mismatch: msg epoch %d, consumer epoch %d",
|
||||||
pollRspWrapper->metaRsp.head.epoch, consumerEpoch);
|
pollRspWrapper->metaRsp.head.epoch, consumerEpoch);
|
||||||
taosFreeQitem(pollRspWrapper);
|
taosFreeQitem(pollRspWrapper);
|
||||||
}
|
}
|
||||||
|
@ -1756,7 +1756,7 @@ TAOS_RES* tmq_consumer_poll(tmq_t* tmq, int64_t timeout) {
|
||||||
|
|
||||||
rspObj = tmqHandleAllRsp(tmq, timeout, false);
|
rspObj = tmqHandleAllRsp(tmq, timeout, false);
|
||||||
if (rspObj) {
|
if (rspObj) {
|
||||||
tscDebug("consumer:%" PRId64 ", return rsp", tmq->consumerId);
|
tscDebug("consumer:%" PRId64 ", return rsp %p", tmq->consumerId, rspObj);
|
||||||
return (TAOS_RES*)rspObj;
|
return (TAOS_RES*)rspObj;
|
||||||
} else if (terrno == TSDB_CODE_TQ_NO_COMMITTED_OFFSET) {
|
} else if (terrno == TSDB_CODE_TQ_NO_COMMITTED_OFFSET) {
|
||||||
tscDebug("consumer:%" PRId64 ", return null since no committed offset", tmq->consumerId);
|
tscDebug("consumer:%" PRId64 ", return null since no committed offset", tmq->consumerId);
|
||||||
|
|
|
@ -112,7 +112,7 @@ void createNewTable(TAOS* pConn, int32_t index) {
|
||||||
}
|
}
|
||||||
taos_free_result(pRes);
|
taos_free_result(pRes);
|
||||||
|
|
||||||
for(int32_t i = 0; i < 10000; i += 20) {
|
for(int32_t i = 0; i < 20; i += 20) {
|
||||||
char sql[1024] = {0};
|
char sql[1024] = {0};
|
||||||
sprintf(sql,
|
sprintf(sql,
|
||||||
"insert into tu%d values(now+%da, %d)(now+%da, %d)(now+%da, %d)(now+%da, %d)"
|
"insert into tu%d values(now+%da, %d)(now+%da, %d)(now+%da, %d)(now+%da, %d)"
|
||||||
|
@ -692,6 +692,7 @@ TEST(testCase, insert_test) {
|
||||||
taos_free_result(pRes);
|
taos_free_result(pRes);
|
||||||
taos_close(pConn);
|
taos_close(pConn);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
TEST(testCase, projection_query_tables) {
|
TEST(testCase, projection_query_tables) {
|
||||||
TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
|
TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
|
||||||
|
@ -703,7 +704,7 @@ TEST(testCase, projection_query_tables) {
|
||||||
// }
|
// }
|
||||||
// taos_free_result(pRes);
|
// taos_free_result(pRes);
|
||||||
|
|
||||||
TAOS_RES* pRes = taos_query(pConn, "use benchmarkcpu");
|
TAOS_RES* pRes = taos_query(pConn, "use abc2");
|
||||||
taos_free_result(pRes);
|
taos_free_result(pRes);
|
||||||
|
|
||||||
pRes = taos_query(pConn, "create stable st1 (ts timestamp, k int) tags(a int)");
|
pRes = taos_query(pConn, "create stable st1 (ts timestamp, k int) tags(a int)");
|
||||||
|
@ -725,7 +726,7 @@ TEST(testCase, projection_query_tables) {
|
||||||
}
|
}
|
||||||
taos_free_result(pRes);
|
taos_free_result(pRes);
|
||||||
|
|
||||||
for (int32_t i = 0; i < 2; ++i) {
|
for (int32_t i = 0; i < 200000; ++i) {
|
||||||
printf("create table :%d\n", i);
|
printf("create table :%d\n", i);
|
||||||
createNewTable(pConn, i);
|
createNewTable(pConn, i);
|
||||||
}
|
}
|
||||||
|
@ -750,7 +751,9 @@ TEST(testCase, projection_query_tables) {
|
||||||
taos_free_result(pRes);
|
taos_free_result(pRes);
|
||||||
taos_close(pConn);
|
taos_close(pConn);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
|
||||||
TEST(testCase, tsbs_perf_test) {
|
TEST(testCase, tsbs_perf_test) {
|
||||||
TdThread qid[20] = {0};
|
TdThread qid[20] = {0};
|
||||||
|
@ -761,7 +764,7 @@ TEST(testCase, tsbs_perf_test) {
|
||||||
getchar();
|
getchar();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
TEST(testCase, projection_query_stables) {
|
TEST(testCase, projection_query_stables) {
|
||||||
TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
|
TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
|
||||||
ASSERT_NE(pConn, nullptr);
|
ASSERT_NE(pConn, nullptr);
|
||||||
|
|
|
@ -246,7 +246,7 @@ int32_t colDataMergeCol(SColumnInfoData* pColumnInfoData, int32_t numOfRow1, int
|
||||||
uint32_t finalNumOfRows = numOfRow1 + numOfRow2;
|
uint32_t finalNumOfRows = numOfRow1 + numOfRow2;
|
||||||
if (IS_VAR_DATA_TYPE(pColumnInfoData->info.type)) {
|
if (IS_VAR_DATA_TYPE(pColumnInfoData->info.type)) {
|
||||||
// Handle the bitmap
|
// Handle the bitmap
|
||||||
if (finalNumOfRows > *capacity || (numOfRow1 == 0 && pColumnInfoData->info.bytes != 0)) {
|
if (finalNumOfRows > (*capacity)) {
|
||||||
char* p = taosMemoryRealloc(pColumnInfoData->varmeta.offset, sizeof(int32_t) * (numOfRow1 + numOfRow2));
|
char* p = taosMemoryRealloc(pColumnInfoData->varmeta.offset, sizeof(int32_t) * (numOfRow1 + numOfRow2));
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
@ -280,16 +280,14 @@ int32_t colDataMergeCol(SColumnInfoData* pColumnInfoData, int32_t numOfRow1, int
|
||||||
memcpy(pColumnInfoData->pData + oldLen, pSource->pData, len);
|
memcpy(pColumnInfoData->pData + oldLen, pSource->pData, len);
|
||||||
pColumnInfoData->varmeta.length = len + oldLen;
|
pColumnInfoData->varmeta.length = len + oldLen;
|
||||||
} else {
|
} else {
|
||||||
if (finalNumOfRows > *capacity || (numOfRow1 == 0 && pColumnInfoData->info.bytes != 0)) {
|
if (finalNumOfRows > (*capacity)) {
|
||||||
// all data may be null, when the pColumnInfoData->info.type == 0, bytes == 0;
|
// all data may be null, when the pColumnInfoData->info.type == 0, bytes == 0;
|
||||||
// ASSERT(finalNumOfRows * pColumnInfoData->info.bytes);
|
|
||||||
char* tmp = taosMemoryRealloc(pColumnInfoData->pData, finalNumOfRows * pColumnInfoData->info.bytes);
|
char* tmp = taosMemoryRealloc(pColumnInfoData->pData, finalNumOfRows * pColumnInfoData->info.bytes);
|
||||||
if (tmp == NULL) {
|
if (tmp == NULL) {
|
||||||
return TSDB_CODE_VND_OUT_OF_MEMORY;
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
pColumnInfoData->pData = tmp;
|
pColumnInfoData->pData = tmp;
|
||||||
|
|
||||||
if (BitmapLen(numOfRow1) < BitmapLen(finalNumOfRows)) {
|
if (BitmapLen(numOfRow1) < BitmapLen(finalNumOfRows)) {
|
||||||
char* btmp = taosMemoryRealloc(pColumnInfoData->nullbitmap, BitmapLen(finalNumOfRows));
|
char* btmp = taosMemoryRealloc(pColumnInfoData->nullbitmap, BitmapLen(finalNumOfRows));
|
||||||
uint32_t extend = BitmapLen(finalNumOfRows) - BitmapLen(numOfRow1);
|
uint32_t extend = BitmapLen(finalNumOfRows) - BitmapLen(numOfRow1);
|
||||||
|
@ -823,7 +821,7 @@ static int32_t blockDataAssign(SColumnInfoData* pCols, const SSDataBlock* pDataB
|
||||||
}
|
}
|
||||||
|
|
||||||
static SColumnInfoData* createHelpColInfoData(const SSDataBlock* pDataBlock) {
|
static SColumnInfoData* createHelpColInfoData(const SSDataBlock* pDataBlock) {
|
||||||
int32_t rows = pDataBlock->info.rows;
|
int32_t rows = pDataBlock->info.capacity;
|
||||||
size_t numOfCols = taosArrayGetSize(pDataBlock->pDataBlock);
|
size_t numOfCols = taosArrayGetSize(pDataBlock->pDataBlock);
|
||||||
|
|
||||||
SColumnInfoData* pCols = taosMemoryCalloc(numOfCols, sizeof(SColumnInfoData));
|
SColumnInfoData* pCols = taosMemoryCalloc(numOfCols, sizeof(SColumnInfoData));
|
||||||
|
@ -1126,26 +1124,28 @@ int32_t blockDataSort_rv(SSDataBlock* pDataBlock, SArray* pOrderInfo, bool nullF
|
||||||
}
|
}
|
||||||
|
|
||||||
void blockDataCleanup(SSDataBlock* pDataBlock) {
|
void blockDataCleanup(SSDataBlock* pDataBlock) {
|
||||||
pDataBlock->info.rows = 0;
|
SDataBlockInfo* pInfo = &pDataBlock->info;
|
||||||
pDataBlock->info.groupId = 0;
|
|
||||||
|
|
||||||
pDataBlock->info.window.ekey = 0;
|
pInfo->rows = 0;
|
||||||
pDataBlock->info.window.skey = 0;
|
pInfo->groupId = 0;
|
||||||
|
pInfo->window.ekey = 0;
|
||||||
|
pInfo->window.skey = 0;
|
||||||
|
|
||||||
if (pDataBlock->info.capacity == 0) {
|
if (pInfo->capacity == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t numOfCols = taosArrayGetSize(pDataBlock->pDataBlock);
|
size_t numOfCols = taosArrayGetSize(pDataBlock->pDataBlock);
|
||||||
for (int32_t i = 0; i < numOfCols; ++i) {
|
for (int32_t i = 0; i < numOfCols; ++i) {
|
||||||
SColumnInfoData* p = taosArrayGet(pDataBlock->pDataBlock, i);
|
SColumnInfoData* p = taosArrayGet(pDataBlock->pDataBlock, i);
|
||||||
colInfoDataCleanup(p, pDataBlock->info.capacity);
|
colInfoDataCleanup(p, pInfo->capacity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t doEnsureCapacity(SColumnInfoData* pColumn, const SDataBlockInfo* pBlockInfo, uint32_t numOfRows) {
|
// todo temporarily disable it
|
||||||
ASSERT(numOfRows > 0 && pBlockInfo->capacity >= pBlockInfo->rows);
|
static int32_t doEnsureCapacity(SColumnInfoData* pColumn, const SDataBlockInfo* pBlockInfo, uint32_t numOfRows, bool clearPayload) {
|
||||||
if (numOfRows < pBlockInfo->capacity) {
|
ASSERT(numOfRows > 0 /*&& pBlockInfo->capacity >= pBlockInfo->rows*/);
|
||||||
|
if (numOfRows <= pBlockInfo->capacity) {
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1172,18 +1172,16 @@ static int32_t doEnsureCapacity(SColumnInfoData* pColumn, const SDataBlockInfo*
|
||||||
pColumn->nullbitmap = tmp;
|
pColumn->nullbitmap = tmp;
|
||||||
memset(&pColumn->nullbitmap[oldLen], 0, BitmapLen(numOfRows) - oldLen);
|
memset(&pColumn->nullbitmap[oldLen], 0, BitmapLen(numOfRows) - oldLen);
|
||||||
|
|
||||||
if (pColumn->info.type == TSDB_DATA_TYPE_NULL) {
|
ASSERT(pColumn->info.bytes);
|
||||||
return TSDB_CODE_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
assert(pColumn->info.bytes);
|
|
||||||
tmp = taosMemoryRealloc(pColumn->pData, numOfRows * pColumn->info.bytes);
|
tmp = taosMemoryRealloc(pColumn->pData, numOfRows * pColumn->info.bytes);
|
||||||
if (tmp == NULL) {
|
if (tmp == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(tmp + pColumn->info.bytes * existedRows, 0, pColumn->info.bytes * (numOfRows - existedRows));
|
|
||||||
pColumn->pData = tmp;
|
pColumn->pData = tmp;
|
||||||
|
if (clearPayload) {
|
||||||
|
memset(tmp + pColumn->info.bytes * existedRows, 0, pColumn->info.bytes * (numOfRows - existedRows));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
|
@ -1191,6 +1189,7 @@ static int32_t doEnsureCapacity(SColumnInfoData* pColumn, const SDataBlockInfo*
|
||||||
|
|
||||||
void colInfoDataCleanup(SColumnInfoData* pColumn, uint32_t numOfRows) {
|
void colInfoDataCleanup(SColumnInfoData* pColumn, uint32_t numOfRows) {
|
||||||
pColumn->hasNull = false;
|
pColumn->hasNull = false;
|
||||||
|
|
||||||
if (IS_VAR_DATA_TYPE(pColumn->info.type)) {
|
if (IS_VAR_DATA_TYPE(pColumn->info.type)) {
|
||||||
pColumn->varmeta.length = 0;
|
pColumn->varmeta.length = 0;
|
||||||
if (pColumn->varmeta.offset != NULL) {
|
if (pColumn->varmeta.offset != NULL) {
|
||||||
|
@ -1203,30 +1202,27 @@ void colInfoDataCleanup(SColumnInfoData* pColumn, uint32_t numOfRows) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t colInfoDataEnsureCapacity(SColumnInfoData* pColumn, uint32_t numOfRows) {
|
int32_t colInfoDataEnsureCapacity(SColumnInfoData* pColumn, uint32_t numOfRows, bool clearPayload) {
|
||||||
SDataBlockInfo info = {0};
|
SDataBlockInfo info = {0};
|
||||||
return doEnsureCapacity(pColumn, &info, numOfRows);
|
return doEnsureCapacity(pColumn, &info, numOfRows, clearPayload);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t blockDataEnsureCapacity(SSDataBlock* pDataBlock, uint32_t numOfRows) {
|
int32_t blockDataEnsureCapacity(SSDataBlock* pDataBlock, uint32_t numOfRows) {
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
if (numOfRows == 0) {
|
if (numOfRows == 0 || numOfRows <= pDataBlock->info.capacity) {
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pDataBlock->info.capacity < numOfRows) {
|
|
||||||
pDataBlock->info.capacity = numOfRows;
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t numOfCols = taosArrayGetSize(pDataBlock->pDataBlock);
|
size_t numOfCols = taosArrayGetSize(pDataBlock->pDataBlock);
|
||||||
for (int32_t i = 0; i < numOfCols; ++i) {
|
for (int32_t i = 0; i < numOfCols; ++i) {
|
||||||
SColumnInfoData* p = taosArrayGet(pDataBlock->pDataBlock, i);
|
SColumnInfoData* p = taosArrayGet(pDataBlock->pDataBlock, i);
|
||||||
code = doEnsureCapacity(p, &pDataBlock->info, numOfRows);
|
code = doEnsureCapacity(p, &pDataBlock->info, numOfRows, true);
|
||||||
if (code) {
|
if (code) {
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pDataBlock->info.capacity = numOfRows;
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1913,6 +1909,22 @@ char* dumpBlockData(SSDataBlock* pDataBlock, const char* flag, char** pDataBuf)
|
||||||
len += snprintf(dumpBuf + len, size - len, " %25s |", pBuf);
|
len += snprintf(dumpBuf + len, size - len, " %25s |", pBuf);
|
||||||
if (len >= size - 1) return dumpBuf;
|
if (len >= size - 1) return dumpBuf;
|
||||||
break;
|
break;
|
||||||
|
case TSDB_DATA_TYPE_TINYINT:
|
||||||
|
len += snprintf(dumpBuf + len, size - len, " %15d |", *(int8_t*)var);
|
||||||
|
if (len >= size - 1) return dumpBuf;
|
||||||
|
break;
|
||||||
|
case TSDB_DATA_TYPE_UTINYINT:
|
||||||
|
len += snprintf(dumpBuf + len, size - len, " %15d |", *(uint8_t*)var);
|
||||||
|
if (len >= size - 1) return dumpBuf;
|
||||||
|
break;
|
||||||
|
case TSDB_DATA_TYPE_SMALLINT:
|
||||||
|
len += snprintf(dumpBuf + len, size - len, " %15d |", *(int16_t*)var);
|
||||||
|
if (len >= size - 1) return dumpBuf;
|
||||||
|
break;
|
||||||
|
case TSDB_DATA_TYPE_USMALLINT:
|
||||||
|
len += snprintf(dumpBuf + len, size - len, " %15d |", *(uint16_t*)var);
|
||||||
|
if (len >= size - 1) return dumpBuf;
|
||||||
|
break;
|
||||||
case TSDB_DATA_TYPE_INT:
|
case TSDB_DATA_TYPE_INT:
|
||||||
len += snprintf(dumpBuf + len, size - len, " %15d |", *(int32_t*)var);
|
len += snprintf(dumpBuf + len, size - len, " %15d |", *(int32_t*)var);
|
||||||
if (len >= size - 1) return dumpBuf;
|
if (len >= size - 1) return dumpBuf;
|
||||||
|
@ -2185,7 +2197,9 @@ char* buildCtbNameByGroupId(const char* stbFullName, uint64_t groupId) {
|
||||||
return rname.ctbShortName;
|
return rname.ctbShortName;
|
||||||
}
|
}
|
||||||
|
|
||||||
void blockEncode(const SSDataBlock* pBlock, char* data, int32_t* dataLen, int32_t numOfCols, int8_t needCompress) {
|
int32_t blockEncode(const SSDataBlock* pBlock, char* data, int32_t numOfCols) {
|
||||||
|
int32_t dataLen = 0;
|
||||||
|
|
||||||
// todo extract method
|
// todo extract method
|
||||||
int32_t* version = (int32_t*)data;
|
int32_t* version = (int32_t*)data;
|
||||||
*version = 1;
|
*version = 1;
|
||||||
|
@ -2226,7 +2240,7 @@ void blockEncode(const SSDataBlock* pBlock, char* data, int32_t* dataLen, int32_
|
||||||
int32_t* colSizes = (int32_t*)data;
|
int32_t* colSizes = (int32_t*)data;
|
||||||
data += numOfCols * sizeof(int32_t);
|
data += numOfCols * sizeof(int32_t);
|
||||||
|
|
||||||
*dataLen = blockDataGetSerialMetaSize(numOfCols);
|
dataLen = blockDataGetSerialMetaSize(numOfCols);
|
||||||
|
|
||||||
int32_t numOfRows = pBlock->info.rows;
|
int32_t numOfRows = pBlock->info.rows;
|
||||||
for (int32_t col = 0; col < numOfCols; ++col) {
|
for (int32_t col = 0; col < numOfCols; ++col) {
|
||||||
|
@ -2243,26 +2257,23 @@ void blockEncode(const SSDataBlock* pBlock, char* data, int32_t* dataLen, int32_
|
||||||
}
|
}
|
||||||
|
|
||||||
data += metaSize;
|
data += metaSize;
|
||||||
(*dataLen) += metaSize;
|
dataLen += metaSize;
|
||||||
|
|
||||||
if (needCompress) {
|
colSizes[col] = colDataGetLength(pColRes, numOfRows);
|
||||||
colSizes[col] = blockCompressColData(pColRes, numOfRows, data, needCompress);
|
dataLen += colSizes[col];
|
||||||
data += colSizes[col];
|
memmove(data, pColRes->pData, colSizes[col]);
|
||||||
(*dataLen) += colSizes[col];
|
data += colSizes[col];
|
||||||
} else {
|
|
||||||
colSizes[col] = colDataGetLength(pColRes, numOfRows);
|
|
||||||
(*dataLen) += colSizes[col];
|
|
||||||
memmove(data, pColRes->pData, colSizes[col]);
|
|
||||||
data += colSizes[col];
|
|
||||||
}
|
|
||||||
|
|
||||||
colSizes[col] = htonl(colSizes[col]);
|
colSizes[col] = htonl(colSizes[col]);
|
||||||
}
|
}
|
||||||
|
|
||||||
*actualLen = *dataLen;
|
*actualLen = dataLen;
|
||||||
*groupId = pBlock->info.groupId;
|
*groupId = pBlock->info.groupId;
|
||||||
ASSERT(*dataLen > 0);
|
ASSERT(dataLen > 0);
|
||||||
uDebug("build data block, actualLen:%d, rows:%d, cols:%d", *dataLen, *rows, *cols);
|
|
||||||
|
uDebug("build data block, actualLen:%d, rows:%d, cols:%d", dataLen, *rows, *cols);
|
||||||
|
|
||||||
|
return dataLen;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* blockDecode(SSDataBlock* pBlock, const char* pData) {
|
const char* blockDecode(SSDataBlock* pBlock, const char* pData) {
|
||||||
|
|
|
@ -56,7 +56,7 @@ typedef struct {
|
||||||
#define TSROW_IS_KV_ROW(r) ((r)->flags & TSROW_KV_ROW)
|
#define TSROW_IS_KV_ROW(r) ((r)->flags & TSROW_KV_ROW)
|
||||||
|
|
||||||
// SValue
|
// SValue
|
||||||
int32_t tPutValue(uint8_t *p, SValue *pValue, int8_t type) {
|
static FORCE_INLINE int32_t tPutValue(uint8_t *p, SValue *pValue, int8_t type) {
|
||||||
if (IS_VAR_DATA_TYPE(type)) {
|
if (IS_VAR_DATA_TYPE(type)) {
|
||||||
return tPutBinary(p, pValue->pData, pValue->nData);
|
return tPutBinary(p, pValue->pData, pValue->nData);
|
||||||
} else {
|
} else {
|
||||||
|
@ -65,20 +65,6 @@ int32_t tPutValue(uint8_t *p, SValue *pValue, int8_t type) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tGetValue(uint8_t *p, SValue *pValue, int8_t type) {
|
|
||||||
if (IS_VAR_DATA_TYPE(type)) {
|
|
||||||
return tGetBinary(p, &pValue->pData, pValue ? &pValue->nData : NULL);
|
|
||||||
} else {
|
|
||||||
memcpy(&pValue->val, p, tDataTypes[type].bytes);
|
|
||||||
return tDataTypes[type].bytes;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int tValueCmprFn(const SValue *pValue1, const SValue *pValue2, int8_t type) {
|
|
||||||
// TODO
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// STSRow2 ========================================================================
|
// STSRow2 ========================================================================
|
||||||
static void setBitMap(uint8_t *pb, uint8_t v, int32_t idx, uint8_t flags) {
|
static void setBitMap(uint8_t *pb, uint8_t v, int32_t idx, uint8_t flags) {
|
||||||
if (pb) {
|
if (pb) {
|
||||||
|
@ -923,7 +909,7 @@ char *tTagValToData(const STagVal *value, bool isJson) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool tTagGet(const STag *pTag, STagVal *pTagVal) {
|
bool tTagGet(const STag *pTag, STagVal *pTagVal) {
|
||||||
if(!pTag || !pTagVal){
|
if (!pTag || !pTagVal) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1164,31 +1150,27 @@ static FORCE_INLINE int32_t tColDataPutValue(SColData *pColData, SColVal *pColVa
|
||||||
ASSERT(pColData->nData == tDataTypes[pColData->type].bytes * pColData->nVal);
|
ASSERT(pColData->nData == tDataTypes[pColData->type].bytes * pColData->nVal);
|
||||||
code = tRealloc(&pColData->pData, pColData->nData + tDataTypes[pColData->type].bytes);
|
code = tRealloc(&pColData->pData, pColData->nData + tDataTypes[pColData->type].bytes);
|
||||||
if (code) goto _exit;
|
if (code) goto _exit;
|
||||||
pColData->nData += tPutValue(pColData->pData + pColData->nData, &pColVal->value, pColVal->type);
|
memcpy(pColData->pData + pColData->nData, &pColVal->value.val, tDataTypes[pColData->type].bytes);
|
||||||
|
pColData->nData += tDataTypes[pColData->type].bytes;
|
||||||
}
|
}
|
||||||
|
pColData->nVal++;
|
||||||
|
|
||||||
_exit:
|
_exit:
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
static FORCE_INLINE int32_t tColDataAppendValue00(SColData *pColData, SColVal *pColVal) {
|
static FORCE_INLINE int32_t tColDataAppendValue00(SColData *pColData, SColVal *pColVal) {
|
||||||
int32_t code = 0;
|
|
||||||
pColData->flag = HAS_VALUE;
|
pColData->flag = HAS_VALUE;
|
||||||
code = tColDataPutValue(pColData, pColVal);
|
return tColDataPutValue(pColData, pColVal);
|
||||||
if (code) return code;
|
|
||||||
pColData->nVal++;
|
|
||||||
return code;
|
|
||||||
}
|
}
|
||||||
static FORCE_INLINE int32_t tColDataAppendValue01(SColData *pColData, SColVal *pColVal) {
|
static FORCE_INLINE int32_t tColDataAppendValue01(SColData *pColData, SColVal *pColVal) {
|
||||||
int32_t code = 0;
|
|
||||||
pColData->flag = HAS_NONE;
|
pColData->flag = HAS_NONE;
|
||||||
pColData->nVal++;
|
pColData->nVal++;
|
||||||
return code;
|
return 0;
|
||||||
}
|
}
|
||||||
static FORCE_INLINE int32_t tColDataAppendValue02(SColData *pColData, SColVal *pColVal) {
|
static FORCE_INLINE int32_t tColDataAppendValue02(SColData *pColData, SColVal *pColVal) {
|
||||||
int32_t code = 0;
|
|
||||||
pColData->flag = HAS_NULL;
|
pColData->flag = HAS_NULL;
|
||||||
pColData->nVal++;
|
pColData->nVal++;
|
||||||
return code;
|
return 0;
|
||||||
}
|
}
|
||||||
static FORCE_INLINE int32_t tColDataAppendValue10(SColData *pColData, SColVal *pColVal) {
|
static FORCE_INLINE int32_t tColDataAppendValue10(SColData *pColData, SColVal *pColVal) {
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
|
@ -1216,16 +1198,11 @@ static FORCE_INLINE int32_t tColDataAppendValue10(SColData *pColData, SColVal *p
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
code = tColDataPutValue(pColData, pColVal);
|
return tColDataPutValue(pColData, pColVal);
|
||||||
if (code) return code;
|
|
||||||
pColData->nVal++;
|
|
||||||
|
|
||||||
return code;
|
|
||||||
}
|
}
|
||||||
static FORCE_INLINE int32_t tColDataAppendValue11(SColData *pColData, SColVal *pColVal) {
|
static FORCE_INLINE int32_t tColDataAppendValue11(SColData *pColData, SColVal *pColVal) {
|
||||||
int32_t code = 0;
|
|
||||||
pColData->nVal++;
|
pColData->nVal++;
|
||||||
return code;
|
return 0;
|
||||||
}
|
}
|
||||||
static FORCE_INLINE int32_t tColDataAppendValue12(SColData *pColData, SColVal *pColVal) {
|
static FORCE_INLINE int32_t tColDataAppendValue12(SColData *pColData, SColVal *pColVal) {
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
|
@ -1268,11 +1245,7 @@ static FORCE_INLINE int32_t tColDataAppendValue20(SColData *pColData, SColVal *p
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
code = tColDataPutValue(pColData, pColVal);
|
return tColDataPutValue(pColData, pColVal);
|
||||||
if (code) return code;
|
|
||||||
pColData->nVal++;
|
|
||||||
|
|
||||||
return code;
|
|
||||||
}
|
}
|
||||||
static FORCE_INLINE int32_t tColDataAppendValue21(SColData *pColData, SColVal *pColVal) {
|
static FORCE_INLINE int32_t tColDataAppendValue21(SColData *pColData, SColVal *pColVal) {
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
|
@ -1290,9 +1263,8 @@ static FORCE_INLINE int32_t tColDataAppendValue21(SColData *pColData, SColVal *p
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
static FORCE_INLINE int32_t tColDataAppendValue22(SColData *pColData, SColVal *pColVal) {
|
static FORCE_INLINE int32_t tColDataAppendValue22(SColData *pColData, SColVal *pColVal) {
|
||||||
int32_t code = 0;
|
|
||||||
pColData->nVal++;
|
pColData->nVal++;
|
||||||
return code;
|
return 0;
|
||||||
}
|
}
|
||||||
static FORCE_INLINE int32_t tColDataAppendValue30(SColData *pColData, SColVal *pColVal) {
|
static FORCE_INLINE int32_t tColDataAppendValue30(SColData *pColData, SColVal *pColVal) {
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
|
@ -1325,11 +1297,7 @@ static FORCE_INLINE int32_t tColDataAppendValue30(SColData *pColData, SColVal *p
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
code = tColDataPutValue(pColData, pColVal);
|
return tColDataPutValue(pColData, pColVal);
|
||||||
if (code) return code;
|
|
||||||
pColData->nVal++;
|
|
||||||
|
|
||||||
return code;
|
|
||||||
}
|
}
|
||||||
static FORCE_INLINE int32_t tColDataAppendValue31(SColData *pColData, SColVal *pColVal) {
|
static FORCE_INLINE int32_t tColDataAppendValue31(SColData *pColData, SColVal *pColVal) {
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
|
@ -1353,15 +1321,7 @@ static FORCE_INLINE int32_t tColDataAppendValue32(SColData *pColData, SColVal *p
|
||||||
|
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
static FORCE_INLINE int32_t tColDataAppendValue40(SColData *pColData, SColVal *pColVal) {
|
#define tColDataAppendValue40 tColDataPutValue
|
||||||
int32_t code = 0;
|
|
||||||
|
|
||||||
code = tColDataPutValue(pColData, pColVal);
|
|
||||||
if (code) return code;
|
|
||||||
pColData->nVal++;
|
|
||||||
|
|
||||||
return code;
|
|
||||||
}
|
|
||||||
static FORCE_INLINE int32_t tColDataAppendValue41(SColData *pColData, SColVal *pColVal) {
|
static FORCE_INLINE int32_t tColDataAppendValue41(SColData *pColData, SColVal *pColVal) {
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
|
|
||||||
|
@ -1374,12 +1334,7 @@ static FORCE_INLINE int32_t tColDataAppendValue41(SColData *pColData, SColVal *p
|
||||||
memset(pColData->pBitMap, 255, nBit);
|
memset(pColData->pBitMap, 255, nBit);
|
||||||
SET_BIT1(pColData->pBitMap, pColData->nVal, 0);
|
SET_BIT1(pColData->pBitMap, pColData->nVal, 0);
|
||||||
|
|
||||||
code = tColDataPutValue(pColData, pColVal);
|
return tColDataPutValue(pColData, pColVal);
|
||||||
if (code) return code;
|
|
||||||
|
|
||||||
pColData->nVal++;
|
|
||||||
|
|
||||||
return code;
|
|
||||||
}
|
}
|
||||||
static FORCE_INLINE int32_t tColDataAppendValue42(SColData *pColData, SColVal *pColVal) {
|
static FORCE_INLINE int32_t tColDataAppendValue42(SColData *pColData, SColVal *pColVal) {
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
|
@ -1393,12 +1348,7 @@ static FORCE_INLINE int32_t tColDataAppendValue42(SColData *pColData, SColVal *p
|
||||||
memset(pColData->pBitMap, 255, nBit);
|
memset(pColData->pBitMap, 255, nBit);
|
||||||
SET_BIT1(pColData->pBitMap, pColData->nVal, 0);
|
SET_BIT1(pColData->pBitMap, pColData->nVal, 0);
|
||||||
|
|
||||||
code = tColDataPutValue(pColData, pColVal);
|
return tColDataPutValue(pColData, pColVal);
|
||||||
if (code) return code;
|
|
||||||
|
|
||||||
pColData->nVal++;
|
|
||||||
|
|
||||||
return code;
|
|
||||||
}
|
}
|
||||||
static FORCE_INLINE int32_t tColDataAppendValue50(SColData *pColData, SColVal *pColVal) {
|
static FORCE_INLINE int32_t tColDataAppendValue50(SColData *pColData, SColVal *pColVal) {
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
|
@ -1408,12 +1358,7 @@ static FORCE_INLINE int32_t tColDataAppendValue50(SColData *pColData, SColVal *p
|
||||||
|
|
||||||
SET_BIT1(pColData->pBitMap, pColData->nVal, 1);
|
SET_BIT1(pColData->pBitMap, pColData->nVal, 1);
|
||||||
|
|
||||||
code = tColDataPutValue(pColData, pColVal);
|
return tColDataPutValue(pColData, pColVal);
|
||||||
if (code) return code;
|
|
||||||
|
|
||||||
pColData->nVal++;
|
|
||||||
|
|
||||||
return code;
|
|
||||||
}
|
}
|
||||||
static FORCE_INLINE int32_t tColDataAppendValue51(SColData *pColData, SColVal *pColVal) {
|
static FORCE_INLINE int32_t tColDataAppendValue51(SColData *pColData, SColVal *pColVal) {
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
|
@ -1423,12 +1368,7 @@ static FORCE_INLINE int32_t tColDataAppendValue51(SColData *pColData, SColVal *p
|
||||||
|
|
||||||
SET_BIT1(pColData->pBitMap, pColData->nVal, 0);
|
SET_BIT1(pColData->pBitMap, pColData->nVal, 0);
|
||||||
|
|
||||||
code = tColDataPutValue(pColData, pColVal);
|
return tColDataPutValue(pColData, pColVal);
|
||||||
if (code) return code;
|
|
||||||
|
|
||||||
pColData->nVal++;
|
|
||||||
|
|
||||||
return code;
|
|
||||||
}
|
}
|
||||||
static FORCE_INLINE int32_t tColDataAppendValue52(SColData *pColData, SColVal *pColVal) {
|
static FORCE_INLINE int32_t tColDataAppendValue52(SColData *pColData, SColVal *pColVal) {
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
|
@ -1447,12 +1387,7 @@ static FORCE_INLINE int32_t tColDataAppendValue52(SColData *pColData, SColVal *p
|
||||||
tFree(pColData->pBitMap);
|
tFree(pColData->pBitMap);
|
||||||
pColData->pBitMap = pBitMap;
|
pColData->pBitMap = pBitMap;
|
||||||
|
|
||||||
code = tColDataPutValue(pColData, pColVal);
|
return tColDataPutValue(pColData, pColVal);
|
||||||
if (code) return code;
|
|
||||||
|
|
||||||
pColData->nVal++;
|
|
||||||
|
|
||||||
return code;
|
|
||||||
}
|
}
|
||||||
static FORCE_INLINE int32_t tColDataAppendValue60(SColData *pColData, SColVal *pColVal) {
|
static FORCE_INLINE int32_t tColDataAppendValue60(SColData *pColData, SColVal *pColVal) {
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
|
@ -1461,12 +1396,7 @@ static FORCE_INLINE int32_t tColDataAppendValue60(SColData *pColData, SColVal *p
|
||||||
if (code) return code;
|
if (code) return code;
|
||||||
SET_BIT1(pColData->pBitMap, pColData->nVal, 1);
|
SET_BIT1(pColData->pBitMap, pColData->nVal, 1);
|
||||||
|
|
||||||
code = tColDataPutValue(pColData, pColVal);
|
return tColDataPutValue(pColData, pColVal);
|
||||||
if (code) return code;
|
|
||||||
|
|
||||||
pColData->nVal++;
|
|
||||||
|
|
||||||
return code;
|
|
||||||
}
|
}
|
||||||
static FORCE_INLINE int32_t tColDataAppendValue61(SColData *pColData, SColVal *pColVal) {
|
static FORCE_INLINE int32_t tColDataAppendValue61(SColData *pColData, SColVal *pColVal) {
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
|
@ -1485,12 +1415,7 @@ static FORCE_INLINE int32_t tColDataAppendValue61(SColData *pColData, SColVal *p
|
||||||
tFree(pColData->pBitMap);
|
tFree(pColData->pBitMap);
|
||||||
pColData->pBitMap = pBitMap;
|
pColData->pBitMap = pBitMap;
|
||||||
|
|
||||||
code = tColDataPutValue(pColData, pColVal);
|
return tColDataPutValue(pColData, pColVal);
|
||||||
if (code) return code;
|
|
||||||
|
|
||||||
pColData->nVal++;
|
|
||||||
|
|
||||||
return code;
|
|
||||||
}
|
}
|
||||||
static FORCE_INLINE int32_t tColDataAppendValue62(SColData *pColData, SColVal *pColVal) {
|
static FORCE_INLINE int32_t tColDataAppendValue62(SColData *pColData, SColVal *pColVal) {
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
|
@ -1499,12 +1424,7 @@ static FORCE_INLINE int32_t tColDataAppendValue62(SColData *pColData, SColVal *p
|
||||||
if (code) return code;
|
if (code) return code;
|
||||||
SET_BIT1(pColData->pBitMap, pColData->nVal, 0);
|
SET_BIT1(pColData->pBitMap, pColData->nVal, 0);
|
||||||
|
|
||||||
code = tColDataPutValue(pColData, pColVal);
|
return tColDataPutValue(pColData, pColVal);
|
||||||
if (code) return code;
|
|
||||||
|
|
||||||
pColData->nVal++;
|
|
||||||
|
|
||||||
return code;
|
|
||||||
}
|
}
|
||||||
static FORCE_INLINE int32_t tColDataAppendValue70(SColData *pColData, SColVal *pColVal) {
|
static FORCE_INLINE int32_t tColDataAppendValue70(SColData *pColData, SColVal *pColVal) {
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
|
@ -1513,12 +1433,7 @@ static FORCE_INLINE int32_t tColDataAppendValue70(SColData *pColData, SColVal *p
|
||||||
if (code) return code;
|
if (code) return code;
|
||||||
SET_BIT2(pColData->pBitMap, pColData->nVal, 2);
|
SET_BIT2(pColData->pBitMap, pColData->nVal, 2);
|
||||||
|
|
||||||
code = tColDataPutValue(pColData, pColVal);
|
return tColDataPutValue(pColData, pColVal);
|
||||||
if (code) return code;
|
|
||||||
|
|
||||||
pColData->nVal++;
|
|
||||||
|
|
||||||
return code;
|
|
||||||
}
|
}
|
||||||
static FORCE_INLINE int32_t tColDataAppendValue71(SColData *pColData, SColVal *pColVal) {
|
static FORCE_INLINE int32_t tColDataAppendValue71(SColData *pColData, SColVal *pColVal) {
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
|
@ -1527,12 +1442,7 @@ static FORCE_INLINE int32_t tColDataAppendValue71(SColData *pColData, SColVal *p
|
||||||
if (code) return code;
|
if (code) return code;
|
||||||
SET_BIT2(pColData->pBitMap, pColData->nVal, 0);
|
SET_BIT2(pColData->pBitMap, pColData->nVal, 0);
|
||||||
|
|
||||||
code = tColDataPutValue(pColData, pColVal);
|
return tColDataPutValue(pColData, pColVal);
|
||||||
if (code) return code;
|
|
||||||
|
|
||||||
pColData->nVal++;
|
|
||||||
|
|
||||||
return code;
|
|
||||||
}
|
}
|
||||||
static FORCE_INLINE int32_t tColDataAppendValue72(SColData *pColData, SColVal *pColVal) {
|
static FORCE_INLINE int32_t tColDataAppendValue72(SColData *pColData, SColVal *pColVal) {
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
|
@ -1541,12 +1451,7 @@ static FORCE_INLINE int32_t tColDataAppendValue72(SColData *pColData, SColVal *p
|
||||||
if (code) return code;
|
if (code) return code;
|
||||||
SET_BIT2(pColData->pBitMap, pColData->nVal, 1);
|
SET_BIT2(pColData->pBitMap, pColData->nVal, 1);
|
||||||
|
|
||||||
code = tColDataPutValue(pColData, pColVal);
|
return tColDataPutValue(pColData, pColVal);
|
||||||
if (code) return code;
|
|
||||||
|
|
||||||
pColData->nVal++;
|
|
||||||
|
|
||||||
return code;
|
|
||||||
}
|
}
|
||||||
static int32_t (*tColDataAppendValueImpl[8][3])(SColData *pColData, SColVal *pColVal) = {
|
static int32_t (*tColDataAppendValueImpl[8][3])(SColData *pColData, SColVal *pColVal) = {
|
||||||
{tColDataAppendValue00, tColDataAppendValue01, tColDataAppendValue02}, // 0
|
{tColDataAppendValue00, tColDataAppendValue01, tColDataAppendValue02}, // 0
|
||||||
|
@ -1652,7 +1557,7 @@ void tColDataGetValue(SColData *pColData, int32_t iVal, SColVal *pColVal) {
|
||||||
tColDataGetValueImpl[pColData->flag](pColData, iVal, pColVal);
|
tColDataGetValueImpl[pColData->flag](pColData, iVal, pColVal);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t tColDataGetBitValue(SColData *pColData, int32_t iVal) {
|
uint8_t tColDataGetBitValue(const SColData *pColData, int32_t iVal) {
|
||||||
uint8_t v;
|
uint8_t v;
|
||||||
switch (pColData->flag) {
|
switch (pColData->flag) {
|
||||||
case HAS_NONE:
|
case HAS_NONE:
|
||||||
|
@ -1723,3 +1628,385 @@ int32_t tColDataCopy(SColData *pColDataSrc, SColData *pColDataDest) {
|
||||||
_exit:
|
_exit:
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define CALC_SUM_MAX_MIN(SUM, MAX, MIN, VAL) \
|
||||||
|
do { \
|
||||||
|
(SUM) += (VAL); \
|
||||||
|
if ((MAX) < (VAL)) (MAX) = (VAL); \
|
||||||
|
if ((MIN) > (VAL)) (MIN) = (VAL); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
static FORCE_INLINE void tColDataCalcSMABool(SColData *pColData, int64_t *sum, int64_t *max, int64_t *min,
|
||||||
|
int16_t *numOfNull) {
|
||||||
|
*sum = 0;
|
||||||
|
*max = 0;
|
||||||
|
*min = 1;
|
||||||
|
*numOfNull = 0;
|
||||||
|
|
||||||
|
int8_t val;
|
||||||
|
if (HAS_VALUE == pColData->flag) {
|
||||||
|
for (int32_t iVal = 0; iVal < pColData->nVal; iVal++) {
|
||||||
|
val = ((int8_t *)pColData->pData)[iVal] ? 1 : 0;
|
||||||
|
CALC_SUM_MAX_MIN(*sum, *max, *min, val);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (int32_t iVal = 0; iVal < pColData->nVal; iVal++) {
|
||||||
|
switch (tColDataGetBitValue(pColData, iVal)) {
|
||||||
|
case 0:
|
||||||
|
case 1:
|
||||||
|
(*numOfNull)++;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
val = ((int8_t *)pColData->pData)[iVal] ? 1 : 0;
|
||||||
|
CALC_SUM_MAX_MIN(*sum, *max, *min, val);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
ASSERT(0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static FORCE_INLINE void tColDataCalcSMATinyInt(SColData *pColData, int64_t *sum, int64_t *max, int64_t *min,
|
||||||
|
int16_t *numOfNull) {
|
||||||
|
*sum = 0;
|
||||||
|
*max = INT8_MIN;
|
||||||
|
*min = INT8_MAX;
|
||||||
|
*numOfNull = 0;
|
||||||
|
|
||||||
|
int8_t val;
|
||||||
|
if (HAS_VALUE == pColData->flag) {
|
||||||
|
for (int32_t iVal = 0; iVal < pColData->nVal; iVal++) {
|
||||||
|
val = ((int8_t *)pColData->pData)[iVal];
|
||||||
|
CALC_SUM_MAX_MIN(*sum, *max, *min, val);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (int32_t iVal = 0; iVal < pColData->nVal; iVal++) {
|
||||||
|
switch (tColDataGetBitValue(pColData, iVal)) {
|
||||||
|
case 0:
|
||||||
|
case 1:
|
||||||
|
(*numOfNull)++;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
val = ((int8_t *)pColData->pData)[iVal];
|
||||||
|
CALC_SUM_MAX_MIN(*sum, *max, *min, val);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
ASSERT(0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static FORCE_INLINE void tColDataCalcSMATinySmallInt(SColData *pColData, int64_t *sum, int64_t *max, int64_t *min,
|
||||||
|
int16_t *numOfNull) {
|
||||||
|
*sum = 0;
|
||||||
|
*max = INT16_MIN;
|
||||||
|
*min = INT16_MAX;
|
||||||
|
*numOfNull = 0;
|
||||||
|
|
||||||
|
int16_t val;
|
||||||
|
if (HAS_VALUE == pColData->flag) {
|
||||||
|
for (int32_t iVal = 0; iVal < pColData->nVal; iVal++) {
|
||||||
|
val = ((int16_t *)pColData->pData)[iVal];
|
||||||
|
CALC_SUM_MAX_MIN(*sum, *max, *min, val);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (int32_t iVal = 0; iVal < pColData->nVal; iVal++) {
|
||||||
|
switch (tColDataGetBitValue(pColData, iVal)) {
|
||||||
|
case 0:
|
||||||
|
case 1:
|
||||||
|
(*numOfNull)++;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
val = ((int16_t *)pColData->pData)[iVal];
|
||||||
|
CALC_SUM_MAX_MIN(*sum, *max, *min, val);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
ASSERT(0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static FORCE_INLINE void tColDataCalcSMAInt(SColData *pColData, int64_t *sum, int64_t *max, int64_t *min,
|
||||||
|
int16_t *numOfNull) {
|
||||||
|
*sum = 0;
|
||||||
|
*max = INT32_MIN;
|
||||||
|
*min = INT32_MAX;
|
||||||
|
*numOfNull = 0;
|
||||||
|
|
||||||
|
int32_t val;
|
||||||
|
if (HAS_VALUE == pColData->flag) {
|
||||||
|
for (int32_t iVal = 0; iVal < pColData->nVal; iVal++) {
|
||||||
|
val = ((int32_t *)pColData->pData)[iVal];
|
||||||
|
CALC_SUM_MAX_MIN(*sum, *max, *min, val);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (int32_t iVal = 0; iVal < pColData->nVal; iVal++) {
|
||||||
|
switch (tColDataGetBitValue(pColData, iVal)) {
|
||||||
|
case 0:
|
||||||
|
case 1:
|
||||||
|
(*numOfNull)++;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
val = ((int32_t *)pColData->pData)[iVal];
|
||||||
|
CALC_SUM_MAX_MIN(*sum, *max, *min, val);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
ASSERT(0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static FORCE_INLINE void tColDataCalcSMABigInt(SColData *pColData, int64_t *sum, int64_t *max, int64_t *min,
|
||||||
|
int16_t *numOfNull) {
|
||||||
|
*sum = 0;
|
||||||
|
*max = INT64_MIN;
|
||||||
|
*min = INT64_MAX;
|
||||||
|
*numOfNull = 0;
|
||||||
|
|
||||||
|
int64_t val;
|
||||||
|
if (HAS_VALUE == pColData->flag) {
|
||||||
|
for (int32_t iVal = 0; iVal < pColData->nVal; iVal++) {
|
||||||
|
val = ((int64_t *)pColData->pData)[iVal];
|
||||||
|
CALC_SUM_MAX_MIN(*sum, *max, *min, val);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (int32_t iVal = 0; iVal < pColData->nVal; iVal++) {
|
||||||
|
switch (tColDataGetBitValue(pColData, iVal)) {
|
||||||
|
case 0:
|
||||||
|
case 1:
|
||||||
|
(*numOfNull)++;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
val = ((int64_t *)pColData->pData)[iVal];
|
||||||
|
CALC_SUM_MAX_MIN(*sum, *max, *min, val);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
ASSERT(0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static FORCE_INLINE void tColDataCalcSMAFloat(SColData *pColData, int64_t *sum, int64_t *max, int64_t *min,
|
||||||
|
int16_t *numOfNull) {
|
||||||
|
*(double *)sum = 0;
|
||||||
|
*(double *)max = -FLT_MAX;
|
||||||
|
*(double *)min = FLT_MAX;
|
||||||
|
*numOfNull = 0;
|
||||||
|
|
||||||
|
float val;
|
||||||
|
if (HAS_VALUE == pColData->flag) {
|
||||||
|
for (int32_t iVal = 0; iVal < pColData->nVal; iVal++) {
|
||||||
|
val = ((float *)pColData->pData)[iVal];
|
||||||
|
CALC_SUM_MAX_MIN(*(double *)sum, *(double *)max, *(double *)min, val);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (int32_t iVal = 0; iVal < pColData->nVal; iVal++) {
|
||||||
|
switch (tColDataGetBitValue(pColData, iVal)) {
|
||||||
|
case 0:
|
||||||
|
case 1:
|
||||||
|
(*numOfNull)++;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
val = ((float *)pColData->pData)[iVal];
|
||||||
|
CALC_SUM_MAX_MIN(*(double *)sum, *(double *)max, *(double *)min, val);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
ASSERT(0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static FORCE_INLINE void tColDataCalcSMADouble(SColData *pColData, int64_t *sum, int64_t *max, int64_t *min,
|
||||||
|
int16_t *numOfNull) {
|
||||||
|
*(double *)sum = 0;
|
||||||
|
*(double *)max = -DBL_MAX;
|
||||||
|
*(double *)min = DBL_MAX;
|
||||||
|
*numOfNull = 0;
|
||||||
|
|
||||||
|
double val;
|
||||||
|
if (HAS_VALUE == pColData->flag) {
|
||||||
|
for (int32_t iVal = 0; iVal < pColData->nVal; iVal++) {
|
||||||
|
val = ((double *)pColData->pData)[iVal];
|
||||||
|
CALC_SUM_MAX_MIN(*(double *)sum, *(double *)max, *(double *)min, val);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (int32_t iVal = 0; iVal < pColData->nVal; iVal++) {
|
||||||
|
switch (tColDataGetBitValue(pColData, iVal)) {
|
||||||
|
case 0:
|
||||||
|
case 1:
|
||||||
|
(*numOfNull)++;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
val = ((double *)pColData->pData)[iVal];
|
||||||
|
CALC_SUM_MAX_MIN(*(double *)sum, *(double *)max, *(double *)min, val);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
ASSERT(0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static FORCE_INLINE void tColDataCalcSMAUTinyInt(SColData *pColData, int64_t *sum, int64_t *max, int64_t *min,
|
||||||
|
int16_t *numOfNull) {
|
||||||
|
*(uint64_t *)sum = 0;
|
||||||
|
*(uint64_t *)max = 0;
|
||||||
|
*(uint64_t *)min = UINT8_MAX;
|
||||||
|
*numOfNull = 0;
|
||||||
|
|
||||||
|
uint8_t val;
|
||||||
|
if (HAS_VALUE == pColData->flag) {
|
||||||
|
for (int32_t iVal = 0; iVal < pColData->nVal; iVal++) {
|
||||||
|
val = ((uint8_t *)pColData->pData)[iVal];
|
||||||
|
CALC_SUM_MAX_MIN(*(uint64_t *)sum, *(uint64_t *)max, *(uint64_t *)min, val);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (int32_t iVal = 0; iVal < pColData->nVal; iVal++) {
|
||||||
|
switch (tColDataGetBitValue(pColData, iVal)) {
|
||||||
|
case 0:
|
||||||
|
case 1:
|
||||||
|
(*numOfNull)++;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
val = ((uint8_t *)pColData->pData)[iVal];
|
||||||
|
CALC_SUM_MAX_MIN(*(uint64_t *)sum, *(uint64_t *)max, *(uint64_t *)min, val);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
ASSERT(0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static FORCE_INLINE void tColDataCalcSMATinyUSmallInt(SColData *pColData, int64_t *sum, int64_t *max, int64_t *min,
|
||||||
|
int16_t *numOfNull) {
|
||||||
|
*(uint64_t *)sum = 0;
|
||||||
|
*(uint64_t *)max = 0;
|
||||||
|
*(uint64_t *)min = UINT16_MAX;
|
||||||
|
*numOfNull = 0;
|
||||||
|
|
||||||
|
uint16_t val;
|
||||||
|
if (HAS_VALUE == pColData->flag) {
|
||||||
|
for (int32_t iVal = 0; iVal < pColData->nVal; iVal++) {
|
||||||
|
val = ((uint16_t *)pColData->pData)[iVal];
|
||||||
|
CALC_SUM_MAX_MIN(*(uint64_t *)sum, *(uint64_t *)max, *(uint64_t *)min, val);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (int32_t iVal = 0; iVal < pColData->nVal; iVal++) {
|
||||||
|
switch (tColDataGetBitValue(pColData, iVal)) {
|
||||||
|
case 0:
|
||||||
|
case 1:
|
||||||
|
(*numOfNull)++;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
val = ((uint16_t *)pColData->pData)[iVal];
|
||||||
|
CALC_SUM_MAX_MIN(*(uint64_t *)sum, *(uint64_t *)max, *(uint64_t *)min, val);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
ASSERT(0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static FORCE_INLINE void tColDataCalcSMAUInt(SColData *pColData, int64_t *sum, int64_t *max, int64_t *min,
|
||||||
|
int16_t *numOfNull) {
|
||||||
|
*(uint64_t *)sum = 0;
|
||||||
|
*(uint64_t *)max = 0;
|
||||||
|
*(uint64_t *)min = UINT32_MAX;
|
||||||
|
*numOfNull = 0;
|
||||||
|
|
||||||
|
uint32_t val;
|
||||||
|
if (HAS_VALUE == pColData->flag) {
|
||||||
|
for (int32_t iVal = 0; iVal < pColData->nVal; iVal++) {
|
||||||
|
val = ((uint32_t *)pColData->pData)[iVal];
|
||||||
|
CALC_SUM_MAX_MIN(*(uint64_t *)sum, *(uint64_t *)max, *(uint64_t *)min, val);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (int32_t iVal = 0; iVal < pColData->nVal; iVal++) {
|
||||||
|
switch (tColDataGetBitValue(pColData, iVal)) {
|
||||||
|
case 0:
|
||||||
|
case 1:
|
||||||
|
(*numOfNull)++;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
val = ((uint32_t *)pColData->pData)[iVal];
|
||||||
|
CALC_SUM_MAX_MIN(*(uint64_t *)sum, *(uint64_t *)max, *(uint64_t *)min, val);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
ASSERT(0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static FORCE_INLINE void tColDataCalcSMAUBigInt(SColData *pColData, int64_t *sum, int64_t *max, int64_t *min,
|
||||||
|
int16_t *numOfNull) {
|
||||||
|
*(uint64_t *)sum = 0;
|
||||||
|
*(uint64_t *)max = 0;
|
||||||
|
*(uint64_t *)min = UINT64_MAX;
|
||||||
|
*numOfNull = 0;
|
||||||
|
|
||||||
|
uint64_t val;
|
||||||
|
if (HAS_VALUE == pColData->flag) {
|
||||||
|
for (int32_t iVal = 0; iVal < pColData->nVal; iVal++) {
|
||||||
|
val = ((uint64_t *)pColData->pData)[iVal];
|
||||||
|
CALC_SUM_MAX_MIN(*(uint64_t *)sum, *(uint64_t *)max, *(uint64_t *)min, val);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (int32_t iVal = 0; iVal < pColData->nVal; iVal++) {
|
||||||
|
switch (tColDataGetBitValue(pColData, iVal)) {
|
||||||
|
case 0:
|
||||||
|
case 1:
|
||||||
|
(*numOfNull)++;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
val = ((uint64_t *)pColData->pData)[iVal];
|
||||||
|
CALC_SUM_MAX_MIN(*(uint64_t *)sum, *(uint64_t *)max, *(uint64_t *)min, val);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
ASSERT(0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void (*tColDataCalcSMA[])(SColData *pColData, int64_t *sum, int64_t *max, int64_t *min, int16_t *numOfNull) = {
|
||||||
|
NULL,
|
||||||
|
tColDataCalcSMABool, // TSDB_DATA_TYPE_BOOL
|
||||||
|
tColDataCalcSMATinyInt, // TSDB_DATA_TYPE_TINYINT
|
||||||
|
tColDataCalcSMATinySmallInt, // TSDB_DATA_TYPE_SMALLINT
|
||||||
|
tColDataCalcSMAInt, // TSDB_DATA_TYPE_INT
|
||||||
|
tColDataCalcSMABigInt, // TSDB_DATA_TYPE_BIGINT
|
||||||
|
tColDataCalcSMAFloat, // TSDB_DATA_TYPE_FLOAT
|
||||||
|
tColDataCalcSMADouble, // TSDB_DATA_TYPE_DOUBLE
|
||||||
|
NULL, // TSDB_DATA_TYPE_VARCHAR
|
||||||
|
tColDataCalcSMABigInt, // TSDB_DATA_TYPE_TIMESTAMP
|
||||||
|
NULL, // TSDB_DATA_TYPE_NCHAR
|
||||||
|
tColDataCalcSMAUTinyInt, // TSDB_DATA_TYPE_UTINYINT
|
||||||
|
tColDataCalcSMATinyUSmallInt, // TSDB_DATA_TYPE_USMALLINT
|
||||||
|
tColDataCalcSMAUInt, // TSDB_DATA_TYPE_UINT
|
||||||
|
tColDataCalcSMAUBigInt, // TSDB_DATA_TYPE_UBIGINT
|
||||||
|
NULL, // TSDB_DATA_TYPE_JSON
|
||||||
|
NULL, // TSDB_DATA_TYPE_VARBINARY
|
||||||
|
NULL, // TSDB_DATA_TYPE_DECIMAL
|
||||||
|
NULL, // TSDB_DATA_TYPE_BLOB
|
||||||
|
NULL // TSDB_DATA_TYPE_MEDIUMBLOB
|
||||||
|
};
|
||||||
|
|
|
@ -50,8 +50,6 @@ int32_t tsNumOfMnodeReadThreads = 1;
|
||||||
int32_t tsNumOfVnodeQueryThreads = 4;
|
int32_t tsNumOfVnodeQueryThreads = 4;
|
||||||
int32_t tsNumOfVnodeStreamThreads = 2;
|
int32_t tsNumOfVnodeStreamThreads = 2;
|
||||||
int32_t tsNumOfVnodeFetchThreads = 4;
|
int32_t tsNumOfVnodeFetchThreads = 4;
|
||||||
int32_t tsNumOfVnodeWriteThreads = 2;
|
|
||||||
int32_t tsNumOfVnodeSyncThreads = 2;
|
|
||||||
int32_t tsNumOfVnodeRsmaThreads = 2;
|
int32_t tsNumOfVnodeRsmaThreads = 2;
|
||||||
int32_t tsNumOfQnodeQueryThreads = 4;
|
int32_t tsNumOfQnodeQueryThreads = 4;
|
||||||
int32_t tsNumOfQnodeFetchThreads = 1;
|
int32_t tsNumOfQnodeFetchThreads = 1;
|
||||||
|
@ -165,10 +163,12 @@ int32_t tsMqRebalanceInterval = 2;
|
||||||
int32_t tsTtlUnit = 86400;
|
int32_t tsTtlUnit = 86400;
|
||||||
int32_t tsTtlPushInterval = 86400;
|
int32_t tsTtlPushInterval = 86400;
|
||||||
int32_t tsGrantHBInterval = 60;
|
int32_t tsGrantHBInterval = 60;
|
||||||
int32_t tsUptimeInterval = 300; // seconds
|
int32_t tsUptimeInterval = 300; // seconds
|
||||||
char tsUdfdResFuncs[512] = ""; // udfd resident funcs that teardown when udfd exits
|
char tsUdfdResFuncs[512] = ""; // udfd resident funcs that teardown when udfd exits
|
||||||
char tsUdfdLdLibPath[512] = "";
|
char tsUdfdLdLibPath[512] = "";
|
||||||
|
|
||||||
|
int32_t tsRpcRetryLimit = 100;
|
||||||
|
int32_t tsRpcRetryInterval = 15;
|
||||||
#ifndef _STORAGE
|
#ifndef _STORAGE
|
||||||
int32_t taosSetTfsCfg(SConfig *pCfg) {
|
int32_t taosSetTfsCfg(SConfig *pCfg) {
|
||||||
SConfigItem *pItem = cfgGetItem(pCfg, "dataDir");
|
SConfigItem *pItem = cfgGetItem(pCfg, "dataDir");
|
||||||
|
@ -299,6 +299,8 @@ static int32_t taosAddClientCfg(SConfig *pCfg) {
|
||||||
if (cfgAddString(pCfg, "smlTagName", tsSmlTagName, 1) != 0) return -1;
|
if (cfgAddString(pCfg, "smlTagName", tsSmlTagName, 1) != 0) return -1;
|
||||||
if (cfgAddBool(pCfg, "smlDataFormat", tsSmlDataFormat, 1) != 0) return -1;
|
if (cfgAddBool(pCfg, "smlDataFormat", tsSmlDataFormat, 1) != 0) return -1;
|
||||||
if (cfgAddInt32(pCfg, "maxMemUsedByInsert", tsMaxMemUsedByInsert, 1, INT32_MAX, true) != 0) return -1;
|
if (cfgAddInt32(pCfg, "maxMemUsedByInsert", tsMaxMemUsedByInsert, 1, INT32_MAX, true) != 0) return -1;
|
||||||
|
if (cfgAddInt32(pCfg, "rpcRetryLimit", tsRpcRetryLimit, 1, 100000, 0) != 0) return -1;
|
||||||
|
if (cfgAddInt32(pCfg, "rpcRetryInterval", tsRpcRetryInterval, 1, 100000, 0) != 0) return -1;
|
||||||
|
|
||||||
tsNumOfTaskQueueThreads = tsNumOfCores / 2;
|
tsNumOfTaskQueueThreads = tsNumOfCores / 2;
|
||||||
tsNumOfTaskQueueThreads = TMAX(tsNumOfTaskQueueThreads, 4);
|
tsNumOfTaskQueueThreads = TMAX(tsNumOfTaskQueueThreads, 4);
|
||||||
|
@ -374,14 +376,6 @@ static int32_t taosAddServerCfg(SConfig *pCfg) {
|
||||||
tsNumOfVnodeFetchThreads = TMAX(tsNumOfVnodeFetchThreads, 4);
|
tsNumOfVnodeFetchThreads = TMAX(tsNumOfVnodeFetchThreads, 4);
|
||||||
if (cfgAddInt32(pCfg, "numOfVnodeFetchThreads", tsNumOfVnodeFetchThreads, 4, 1024, 0) != 0) return -1;
|
if (cfgAddInt32(pCfg, "numOfVnodeFetchThreads", tsNumOfVnodeFetchThreads, 4, 1024, 0) != 0) return -1;
|
||||||
|
|
||||||
tsNumOfVnodeWriteThreads = tsNumOfCores;
|
|
||||||
tsNumOfVnodeWriteThreads = TMAX(tsNumOfVnodeWriteThreads, 1);
|
|
||||||
if (cfgAddInt32(pCfg, "numOfVnodeWriteThreads", tsNumOfVnodeWriteThreads, 1, 1024, 0) != 0) return -1;
|
|
||||||
|
|
||||||
tsNumOfVnodeSyncThreads = tsNumOfCores * 2;
|
|
||||||
tsNumOfVnodeSyncThreads = TMAX(tsNumOfVnodeSyncThreads, 16);
|
|
||||||
if (cfgAddInt32(pCfg, "numOfVnodeSyncThreads", tsNumOfVnodeSyncThreads, 1, 1024, 0) != 0) return -1;
|
|
||||||
|
|
||||||
tsNumOfVnodeRsmaThreads = tsNumOfCores;
|
tsNumOfVnodeRsmaThreads = tsNumOfCores;
|
||||||
tsNumOfVnodeRsmaThreads = TMAX(tsNumOfVnodeRsmaThreads, 4);
|
tsNumOfVnodeRsmaThreads = TMAX(tsNumOfVnodeRsmaThreads, 4);
|
||||||
if (cfgAddInt32(pCfg, "numOfVnodeRsmaThreads", tsNumOfVnodeRsmaThreads, 1, 1024, 0) != 0) return -1;
|
if (cfgAddInt32(pCfg, "numOfVnodeRsmaThreads", tsNumOfVnodeRsmaThreads, 1, 1024, 0) != 0) return -1;
|
||||||
|
@ -432,6 +426,10 @@ static int32_t taosAddServerCfg(SConfig *pCfg) {
|
||||||
if (cfgAddBool(pCfg, "udf", tsStartUdfd, 0) != 0) return -1;
|
if (cfgAddBool(pCfg, "udf", tsStartUdfd, 0) != 0) return -1;
|
||||||
if (cfgAddString(pCfg, "udfdResFuncs", tsUdfdResFuncs, 0) != 0) return -1;
|
if (cfgAddString(pCfg, "udfdResFuncs", tsUdfdResFuncs, 0) != 0) return -1;
|
||||||
if (cfgAddString(pCfg, "udfdLdLibPath", tsUdfdLdLibPath, 0) != 0) return -1;
|
if (cfgAddString(pCfg, "udfdLdLibPath", tsUdfdLdLibPath, 0) != 0) return -1;
|
||||||
|
|
||||||
|
if (cfgAddInt32(pCfg, "rpcRetryLimit", tsRpcRetryLimit, 1, 100000, 0) != 0) return -1;
|
||||||
|
if (cfgAddInt32(pCfg, "rpcRetryInterval", tsRpcRetryInterval, 1, 100000, 0) != 0) return -1;
|
||||||
|
|
||||||
GRANT_CFG_ADD;
|
GRANT_CFG_ADD;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -506,22 +504,6 @@ static int32_t taosUpdateServerCfg(SConfig *pCfg) {
|
||||||
pItem->stype = stype;
|
pItem->stype = stype;
|
||||||
}
|
}
|
||||||
|
|
||||||
pItem = cfgGetItem(tsCfg, "numOfVnodeWriteThreads");
|
|
||||||
if (pItem != NULL && pItem->stype == CFG_STYPE_DEFAULT) {
|
|
||||||
tsNumOfVnodeWriteThreads = numOfCores;
|
|
||||||
tsNumOfVnodeWriteThreads = TMAX(tsNumOfVnodeWriteThreads, 1);
|
|
||||||
pItem->i32 = tsNumOfVnodeWriteThreads;
|
|
||||||
pItem->stype = stype;
|
|
||||||
}
|
|
||||||
|
|
||||||
pItem = cfgGetItem(tsCfg, "numOfVnodeSyncThreads");
|
|
||||||
if (pItem != NULL && pItem->stype == CFG_STYPE_DEFAULT) {
|
|
||||||
tsNumOfVnodeSyncThreads = numOfCores * 2;
|
|
||||||
tsNumOfVnodeSyncThreads = TMAX(tsNumOfVnodeSyncThreads, 16);
|
|
||||||
pItem->i32 = tsNumOfVnodeSyncThreads;
|
|
||||||
pItem->stype = stype;
|
|
||||||
}
|
|
||||||
|
|
||||||
pItem = cfgGetItem(tsCfg, "numOfVnodeRsmaThreads");
|
pItem = cfgGetItem(tsCfg, "numOfVnodeRsmaThreads");
|
||||||
if (pItem != NULL && pItem->stype == CFG_STYPE_DEFAULT) {
|
if (pItem != NULL && pItem->stype == CFG_STYPE_DEFAULT) {
|
||||||
tsNumOfVnodeRsmaThreads = numOfCores;
|
tsNumOfVnodeRsmaThreads = numOfCores;
|
||||||
|
@ -660,6 +642,9 @@ static int32_t taosSetClientCfg(SConfig *pCfg) {
|
||||||
tsQueryNodeChunkSize = cfgGetItem(pCfg, "queryNodeChunkSize")->i32;
|
tsQueryNodeChunkSize = cfgGetItem(pCfg, "queryNodeChunkSize")->i32;
|
||||||
tsQueryUseNodeAllocator = cfgGetItem(pCfg, "queryUseNodeAllocator")->bval;
|
tsQueryUseNodeAllocator = cfgGetItem(pCfg, "queryUseNodeAllocator")->bval;
|
||||||
tsKeepColumnName = cfgGetItem(pCfg, "keepColumnName")->bval;
|
tsKeepColumnName = cfgGetItem(pCfg, "keepColumnName")->bval;
|
||||||
|
|
||||||
|
tsRpcRetryLimit = cfgGetItem(pCfg, "rpcRetryLimit")->i32;
|
||||||
|
tsRpcRetryInterval = cfgGetItem(pCfg, "rpcRetryInterval")->i32;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -699,8 +684,6 @@ static int32_t taosSetServerCfg(SConfig *pCfg) {
|
||||||
tsNumOfVnodeQueryThreads = cfgGetItem(pCfg, "numOfVnodeQueryThreads")->i32;
|
tsNumOfVnodeQueryThreads = cfgGetItem(pCfg, "numOfVnodeQueryThreads")->i32;
|
||||||
tsNumOfVnodeStreamThreads = cfgGetItem(pCfg, "numOfVnodeStreamThreads")->i32;
|
tsNumOfVnodeStreamThreads = cfgGetItem(pCfg, "numOfVnodeStreamThreads")->i32;
|
||||||
tsNumOfVnodeFetchThreads = cfgGetItem(pCfg, "numOfVnodeFetchThreads")->i32;
|
tsNumOfVnodeFetchThreads = cfgGetItem(pCfg, "numOfVnodeFetchThreads")->i32;
|
||||||
tsNumOfVnodeWriteThreads = cfgGetItem(pCfg, "numOfVnodeWriteThreads")->i32;
|
|
||||||
tsNumOfVnodeSyncThreads = cfgGetItem(pCfg, "numOfVnodeSyncThreads")->i32;
|
|
||||||
tsNumOfVnodeRsmaThreads = cfgGetItem(pCfg, "numOfVnodeRsmaThreads")->i32;
|
tsNumOfVnodeRsmaThreads = cfgGetItem(pCfg, "numOfVnodeRsmaThreads")->i32;
|
||||||
tsNumOfQnodeQueryThreads = cfgGetItem(pCfg, "numOfQnodeQueryThreads")->i32;
|
tsNumOfQnodeQueryThreads = cfgGetItem(pCfg, "numOfQnodeQueryThreads")->i32;
|
||||||
// tsNumOfQnodeFetchThreads = cfgGetItem(pCfg, "numOfQnodeFetchThreads")->i32;
|
// tsNumOfQnodeFetchThreads = cfgGetItem(pCfg, "numOfQnodeFetchThreads")->i32;
|
||||||
|
@ -736,6 +719,9 @@ static int32_t taosSetServerCfg(SConfig *pCfg) {
|
||||||
if (tsQueryBufferSize >= 0) {
|
if (tsQueryBufferSize >= 0) {
|
||||||
tsQueryBufferSizeBytes = tsQueryBufferSize * 1048576UL;
|
tsQueryBufferSizeBytes = tsQueryBufferSize * 1048576UL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tsRpcRetryLimit = cfgGetItem(pCfg, "rpcRetryLimit")->i32;
|
||||||
|
tsRpcRetryInterval = cfgGetItem(pCfg, "rpcRetryInterval")->i32;
|
||||||
GRANT_CFG_GET;
|
GRANT_CFG_GET;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -786,6 +772,9 @@ int32_t taosSetCfg(SConfig *pCfg, char *name) {
|
||||||
case 'd': {
|
case 'd': {
|
||||||
if (strcasecmp("dDebugFlag", name) == 0) {
|
if (strcasecmp("dDebugFlag", name) == 0) {
|
||||||
dDebugFlag = cfgGetItem(pCfg, "dDebugFlag")->i32;
|
dDebugFlag = cfgGetItem(pCfg, "dDebugFlag")->i32;
|
||||||
|
} else if (strcasecmp("debugFlag", name) == 0) {
|
||||||
|
int32_t flag = cfgGetItem(pCfg, "debugFlag")->i32;
|
||||||
|
taosSetAllDebugFlag(flag, true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -943,10 +932,6 @@ int32_t taosSetCfg(SConfig *pCfg, char *name) {
|
||||||
} else if (strcasecmp("numOfVnodeFetchThreads", name) == 0) {
|
} else if (strcasecmp("numOfVnodeFetchThreads", name) == 0) {
|
||||||
tsNumOfVnodeFetchThreads = cfgGetItem(pCfg, "numOfVnodeFetchThreads")->i32;
|
tsNumOfVnodeFetchThreads = cfgGetItem(pCfg, "numOfVnodeFetchThreads")->i32;
|
||||||
*/
|
*/
|
||||||
} else if (strcasecmp("numOfVnodeWriteThreads", name) == 0) {
|
|
||||||
tsNumOfVnodeWriteThreads = cfgGetItem(pCfg, "numOfVnodeWriteThreads")->i32;
|
|
||||||
} else if (strcasecmp("numOfVnodeSyncThreads", name) == 0) {
|
|
||||||
tsNumOfVnodeSyncThreads = cfgGetItem(pCfg, "numOfVnodeSyncThreads")->i32;
|
|
||||||
} else if (strcasecmp("numOfVnodeRsmaThreads", name) == 0) {
|
} else if (strcasecmp("numOfVnodeRsmaThreads", name) == 0) {
|
||||||
tsNumOfVnodeRsmaThreads = cfgGetItem(pCfg, "numOfVnodeRsmaThreads")->i32;
|
tsNumOfVnodeRsmaThreads = cfgGetItem(pCfg, "numOfVnodeRsmaThreads")->i32;
|
||||||
} else if (strcasecmp("numOfQnodeQueryThreads", name) == 0) {
|
} else if (strcasecmp("numOfQnodeQueryThreads", name) == 0) {
|
||||||
|
|
|
@ -1020,6 +1020,7 @@ int32_t tSerializeSStatusReq(void *buf, int32_t bufLen, SStatusReq *pReq) {
|
||||||
if (tEncodeI64(&encoder, pReq->qload.timeInQueryQueue) < 0) return -1;
|
if (tEncodeI64(&encoder, pReq->qload.timeInQueryQueue) < 0) return -1;
|
||||||
if (tEncodeI64(&encoder, pReq->qload.timeInFetchQueue) < 0) return -1;
|
if (tEncodeI64(&encoder, pReq->qload.timeInFetchQueue) < 0) return -1;
|
||||||
|
|
||||||
|
if (tEncodeI32(&encoder, pReq->statusSeq) < 0) return -1;
|
||||||
tEndEncode(&encoder);
|
tEndEncode(&encoder);
|
||||||
|
|
||||||
int32_t tlen = encoder.pos;
|
int32_t tlen = encoder.pos;
|
||||||
|
@ -1095,6 +1096,7 @@ int32_t tDeserializeSStatusReq(void *buf, int32_t bufLen, SStatusReq *pReq) {
|
||||||
if (tDecodeI64(&decoder, &pReq->qload.timeInQueryQueue) < 0) return -1;
|
if (tDecodeI64(&decoder, &pReq->qload.timeInQueryQueue) < 0) return -1;
|
||||||
if (tDecodeI64(&decoder, &pReq->qload.timeInFetchQueue) < 0) return -1;
|
if (tDecodeI64(&decoder, &pReq->qload.timeInFetchQueue) < 0) return -1;
|
||||||
|
|
||||||
|
if (tDecodeI32(&decoder, &pReq->statusSeq) < 0) return -1;
|
||||||
tEndDecode(&decoder);
|
tEndDecode(&decoder);
|
||||||
tDecoderClear(&decoder);
|
tDecoderClear(&decoder);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1126,6 +1128,7 @@ int32_t tSerializeSStatusRsp(void *buf, int32_t bufLen, SStatusRsp *pRsp) {
|
||||||
if (tEncodeU16(&encoder, pDnodeEp->ep.port) < 0) return -1;
|
if (tEncodeU16(&encoder, pDnodeEp->ep.port) < 0) return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (tEncodeI32(&encoder, pRsp->statusSeq) < 0) return -1;
|
||||||
tEndEncode(&encoder);
|
tEndEncode(&encoder);
|
||||||
|
|
||||||
int32_t tlen = encoder.pos;
|
int32_t tlen = encoder.pos;
|
||||||
|
@ -1167,6 +1170,7 @@ int32_t tDeserializeSStatusRsp(void *buf, int32_t bufLen, SStatusRsp *pRsp) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (tDecodeI32(&decoder, &pRsp->statusSeq) < 0) return -1;
|
||||||
tEndDecode(&decoder);
|
tEndDecode(&decoder);
|
||||||
tDecoderClear(&decoder);
|
tDecoderClear(&decoder);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -2234,6 +2238,7 @@ int32_t tSerializeSUseDbReq(void *buf, int32_t bufLen, SUseDbReq *pReq) {
|
||||||
if (tEncodeI64(&encoder, pReq->dbId) < 0) return -1;
|
if (tEncodeI64(&encoder, pReq->dbId) < 0) return -1;
|
||||||
if (tEncodeI32(&encoder, pReq->vgVersion) < 0) return -1;
|
if (tEncodeI32(&encoder, pReq->vgVersion) < 0) return -1;
|
||||||
if (tEncodeI32(&encoder, pReq->numOfTable) < 0) return -1;
|
if (tEncodeI32(&encoder, pReq->numOfTable) < 0) return -1;
|
||||||
|
if (tEncodeI64(&encoder, pReq->stateTs) < 0) return -1;
|
||||||
tEndEncode(&encoder);
|
tEndEncode(&encoder);
|
||||||
|
|
||||||
int32_t tlen = encoder.pos;
|
int32_t tlen = encoder.pos;
|
||||||
|
@ -2250,6 +2255,7 @@ int32_t tDeserializeSUseDbReq(void *buf, int32_t bufLen, SUseDbReq *pReq) {
|
||||||
if (tDecodeI64(&decoder, &pReq->dbId) < 0) return -1;
|
if (tDecodeI64(&decoder, &pReq->dbId) < 0) return -1;
|
||||||
if (tDecodeI32(&decoder, &pReq->vgVersion) < 0) return -1;
|
if (tDecodeI32(&decoder, &pReq->vgVersion) < 0) return -1;
|
||||||
if (tDecodeI32(&decoder, &pReq->numOfTable) < 0) return -1;
|
if (tDecodeI32(&decoder, &pReq->numOfTable) < 0) return -1;
|
||||||
|
if (tDecodeI64(&decoder, &pReq->stateTs) < 0) return -1;
|
||||||
tEndDecode(&decoder);
|
tEndDecode(&decoder);
|
||||||
|
|
||||||
tDecoderClear(&decoder);
|
tDecoderClear(&decoder);
|
||||||
|
@ -2485,6 +2491,8 @@ int32_t tSerializeSUseDbRspImp(SEncoder *pEncoder, const SUseDbRsp *pRsp) {
|
||||||
if (tEncodeI32(pEncoder, pVgInfo->numOfTable) < 0) return -1;
|
if (tEncodeI32(pEncoder, pVgInfo->numOfTable) < 0) return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (tEncodeI32(pEncoder, pRsp->errCode) < 0) return -1;
|
||||||
|
if (tEncodeI64(pEncoder, pRsp->stateTs) < 0) return -1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2549,6 +2557,8 @@ int32_t tDeserializeSUseDbRspImp(SDecoder *pDecoder, SUseDbRsp *pRsp) {
|
||||||
taosArrayPush(pRsp->pVgroupInfos, &vgInfo);
|
taosArrayPush(pRsp->pVgroupInfos, &vgInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (tDecodeI32(pDecoder, &pRsp->errCode) < 0) return -1;
|
||||||
|
if (tDecodeI64(pDecoder, &pRsp->stateTs) < 0) return -1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5432,9 +5442,12 @@ static int32_t tEncodeSSubmitBlkRsp(SEncoder *pEncoder, const SSubmitBlkRsp *pBl
|
||||||
if (tStartEncode(pEncoder) < 0) return -1;
|
if (tStartEncode(pEncoder) < 0) return -1;
|
||||||
|
|
||||||
if (tEncodeI32(pEncoder, pBlock->code) < 0) return -1;
|
if (tEncodeI32(pEncoder, pBlock->code) < 0) return -1;
|
||||||
if (tEncodeI8(pEncoder, pBlock->hashMeta) < 0) return -1;
|
|
||||||
if (tEncodeI64(pEncoder, pBlock->uid) < 0) return -1;
|
if (tEncodeI64(pEncoder, pBlock->uid) < 0) return -1;
|
||||||
if (tEncodeCStr(pEncoder, pBlock->tblFName) < 0) return -1;
|
if (pBlock->tblFName) {
|
||||||
|
if (tEncodeCStr(pEncoder, pBlock->tblFName) < 0) return -1;
|
||||||
|
} else {
|
||||||
|
if (tEncodeCStr(pEncoder, "") < 0) return -1;
|
||||||
|
}
|
||||||
if (tEncodeI32v(pEncoder, pBlock->numOfRows) < 0) return -1;
|
if (tEncodeI32v(pEncoder, pBlock->numOfRows) < 0) return -1;
|
||||||
if (tEncodeI32v(pEncoder, pBlock->affectedRows) < 0) return -1;
|
if (tEncodeI32v(pEncoder, pBlock->affectedRows) < 0) return -1;
|
||||||
if (tEncodeI64v(pEncoder, pBlock->sver) < 0) return -1;
|
if (tEncodeI64v(pEncoder, pBlock->sver) < 0) return -1;
|
||||||
|
@ -5451,7 +5464,6 @@ static int32_t tDecodeSSubmitBlkRsp(SDecoder *pDecoder, SSubmitBlkRsp *pBlock) {
|
||||||
if (tStartDecode(pDecoder) < 0) return -1;
|
if (tStartDecode(pDecoder) < 0) return -1;
|
||||||
|
|
||||||
if (tDecodeI32(pDecoder, &pBlock->code) < 0) return -1;
|
if (tDecodeI32(pDecoder, &pBlock->code) < 0) return -1;
|
||||||
if (tDecodeI8(pDecoder, &pBlock->hashMeta) < 0) return -1;
|
|
||||||
if (tDecodeI64(pDecoder, &pBlock->uid) < 0) return -1;
|
if (tDecodeI64(pDecoder, &pBlock->uid) < 0) return -1;
|
||||||
pBlock->tblFName = taosMemoryCalloc(TSDB_TABLE_FNAME_LEN, 1);
|
pBlock->tblFName = taosMemoryCalloc(TSDB_TABLE_FNAME_LEN, 1);
|
||||||
if (NULL == pBlock->tblFName) return -1;
|
if (NULL == pBlock->tblFName) return -1;
|
||||||
|
@ -6123,13 +6135,13 @@ void tDeleteSTaosxRsp(STaosxRsp *pRsp) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tEncodeSSingleDeleteReq(SEncoder *pEncoder, const SSingleDeleteReq *pReq) {
|
int32_t tEncodeSSingleDeleteReq(SEncoder *pEncoder, const SSingleDeleteReq *pReq) {
|
||||||
if (tEncodeI64(pEncoder, pReq->uid) < 0) return -1;
|
if (tEncodeCStr(pEncoder, pReq->tbname) < 0) return -1;
|
||||||
if (tEncodeI64(pEncoder, pReq->ts) < 0) return -1;
|
if (tEncodeI64(pEncoder, pReq->ts) < 0) return -1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tDecodeSSingleDeleteReq(SDecoder *pDecoder, SSingleDeleteReq *pReq) {
|
int32_t tDecodeSSingleDeleteReq(SDecoder *pDecoder, SSingleDeleteReq *pReq) {
|
||||||
if (tDecodeI64(pDecoder, &pReq->uid) < 0) return -1;
|
if (tDecodeCStrTo(pDecoder, pReq->tbname) < 0) return -1;
|
||||||
if (tDecodeI64(pDecoder, &pReq->ts) < 0) return -1;
|
if (tDecodeI64(pDecoder, &pReq->ts) < 0) return -1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,8 +73,8 @@ void tdSCellValPrint(SCellVal *pVal, int8_t colType) {
|
||||||
} else if (tdValTypeIsNone(pVal->valType)) {
|
} else if (tdValTypeIsNone(pVal->valType)) {
|
||||||
printf("NONE ");
|
printf("NONE ");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(!pVal->val) {
|
if (!pVal->val) {
|
||||||
ASSERT(0);
|
ASSERT(0);
|
||||||
printf("BadVal ");
|
printf("BadVal ");
|
||||||
return;
|
return;
|
||||||
|
@ -1065,8 +1065,8 @@ void tdSTSRowIterInit(STSRowIter *pIter, STSchema *pSchema) {
|
||||||
|
|
||||||
void tTSRowGetVal(STSRow *pRow, STSchema *pTSchema, int16_t iCol, SColVal *pColVal) {
|
void tTSRowGetVal(STSRow *pRow, STSchema *pTSchema, int16_t iCol, SColVal *pColVal) {
|
||||||
STColumn *pTColumn = &pTSchema->columns[iCol];
|
STColumn *pTColumn = &pTSchema->columns[iCol];
|
||||||
SCellVal cv;
|
SCellVal cv = {0};
|
||||||
SValue value;
|
SValue value = {0};
|
||||||
|
|
||||||
ASSERT((pTColumn->colId == PRIMARYKEY_TIMESTAMP_COL_ID) || (iCol > 0));
|
ASSERT((pTColumn->colId == PRIMARYKEY_TIMESTAMP_COL_ID) || (iCol > 0));
|
||||||
|
|
||||||
|
@ -1083,13 +1083,15 @@ void tTSRowGetVal(STSRow *pRow, STSchema *pTSchema, int16_t iCol, SColVal *pColV
|
||||||
} else if (tdValTypeIsNull(cv.valType)) {
|
} else if (tdValTypeIsNull(cv.valType)) {
|
||||||
*pColVal = COL_VAL_NULL(pTColumn->colId, pTColumn->type);
|
*pColVal = COL_VAL_NULL(pTColumn->colId, pTColumn->type);
|
||||||
} else {
|
} else {
|
||||||
if (IS_VAR_DATA_TYPE(pTColumn->type)) {
|
pColVal->cid = pTColumn->colId;
|
||||||
value.nData = varDataLen(cv.val);
|
pColVal->type = pTColumn->type;
|
||||||
value.pData = varDataVal(cv.val);
|
pColVal->flag = CV_FLAG_VALUE;
|
||||||
} else {
|
|
||||||
tGetValue(cv.val, &value, pTColumn->type);
|
|
||||||
}
|
|
||||||
|
|
||||||
*pColVal = COL_VAL_VALUE(pTColumn->colId, pTColumn->type, value);
|
if (IS_VAR_DATA_TYPE(pTColumn->type)) {
|
||||||
|
pColVal->value.nData = varDataLen(cv.val);
|
||||||
|
pColVal->value.pData = varDataVal(cv.val);
|
||||||
|
} else {
|
||||||
|
memcpy(&pColVal->value.val, cv.val, tDataTypes[pTColumn->type].bytes);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -31,7 +31,7 @@ static int32_t STSBufUpdateHeader(STSBuf* pTSBuf, STSBufFileHeader* pHeader);
|
||||||
*/
|
*/
|
||||||
STSBuf* tsBufCreate(bool autoDelete, int32_t order) {
|
STSBuf* tsBufCreate(bool autoDelete, int32_t order) {
|
||||||
if (!osTempSpaceAvailable()) {
|
if (!osTempSpaceAvailable()) {
|
||||||
terrno = TSDB_CODE_TSC_NO_DISKSPACE;
|
terrno = TSDB_CODE_NO_DISKSPACE;
|
||||||
// tscError("tmp file created failed since %s", terrstr());
|
// tscError("tmp file created failed since %s", terrstr());
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,6 +36,7 @@ typedef struct SDnodeMgmt {
|
||||||
GetVnodeLoadsFp getVnodeLoadsFp;
|
GetVnodeLoadsFp getVnodeLoadsFp;
|
||||||
GetMnodeLoadsFp getMnodeLoadsFp;
|
GetMnodeLoadsFp getMnodeLoadsFp;
|
||||||
GetQnodeLoadsFp getQnodeLoadsFp;
|
GetQnodeLoadsFp getQnodeLoadsFp;
|
||||||
|
int32_t statusSeq;
|
||||||
} SDnodeMgmt;
|
} SDnodeMgmt;
|
||||||
|
|
||||||
// dmHandle.c
|
// dmHandle.c
|
||||||
|
|
|
@ -32,9 +32,13 @@ static void dmUpdateDnodeCfg(SDnodeMgmt *pMgmt, SDnodeCfg *pCfg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dmProcessStatusRsp(SDnodeMgmt *pMgmt, SRpcMsg *pRsp) {
|
static void dmProcessStatusRsp(SDnodeMgmt *pMgmt, SRpcMsg *pRsp) {
|
||||||
|
const STraceId *trace = &pRsp->info.traceId;
|
||||||
|
dGTrace("status rsp received from mnode, statusSeq:%d code:0x%x", pMgmt->statusSeq, pRsp->code);
|
||||||
|
|
||||||
if (pRsp->code != 0) {
|
if (pRsp->code != 0) {
|
||||||
if (pRsp->code == TSDB_CODE_MND_DNODE_NOT_EXIST && !pMgmt->pData->dropped && pMgmt->pData->dnodeId > 0) {
|
if (pRsp->code == TSDB_CODE_MND_DNODE_NOT_EXIST && !pMgmt->pData->dropped && pMgmt->pData->dnodeId > 0) {
|
||||||
dInfo("dnode:%d, set to dropped since not exist in mnode", pMgmt->pData->dnodeId);
|
dGInfo("dnode:%d, set to dropped since not exist in mnode, statusSeq:%d", pMgmt->pData->dnodeId,
|
||||||
|
pMgmt->statusSeq);
|
||||||
pMgmt->pData->dropped = 1;
|
pMgmt->pData->dropped = 1;
|
||||||
dmWriteEps(pMgmt->pData);
|
dmWriteEps(pMgmt->pData);
|
||||||
}
|
}
|
||||||
|
@ -42,9 +46,9 @@ static void dmProcessStatusRsp(SDnodeMgmt *pMgmt, SRpcMsg *pRsp) {
|
||||||
SStatusRsp statusRsp = {0};
|
SStatusRsp statusRsp = {0};
|
||||||
if (pRsp->pCont != NULL && pRsp->contLen > 0 &&
|
if (pRsp->pCont != NULL && pRsp->contLen > 0 &&
|
||||||
tDeserializeSStatusRsp(pRsp->pCont, pRsp->contLen, &statusRsp) == 0) {
|
tDeserializeSStatusRsp(pRsp->pCont, pRsp->contLen, &statusRsp) == 0) {
|
||||||
dTrace("status msg received from mnode, dnodeVer:%" PRId64 " saved:%" PRId64, statusRsp.dnodeVer,
|
|
||||||
pMgmt->pData->dnodeVer);
|
|
||||||
if (pMgmt->pData->dnodeVer != statusRsp.dnodeVer) {
|
if (pMgmt->pData->dnodeVer != statusRsp.dnodeVer) {
|
||||||
|
dGInfo("status rsp received from mnode, statusSeq:%d:%d dnodeVer:%" PRId64 ":%" PRId64, pMgmt->statusSeq,
|
||||||
|
statusRsp.statusSeq, pMgmt->pData->dnodeVer, statusRsp.dnodeVer);
|
||||||
pMgmt->pData->dnodeVer = statusRsp.dnodeVer;
|
pMgmt->pData->dnodeVer = statusRsp.dnodeVer;
|
||||||
dmUpdateDnodeCfg(pMgmt, &statusRsp.dnodeCfg);
|
dmUpdateDnodeCfg(pMgmt, &statusRsp.dnodeCfg);
|
||||||
dmUpdateEps(pMgmt->pData, statusRsp.pDnodeEps);
|
dmUpdateEps(pMgmt->pData, statusRsp.pDnodeEps);
|
||||||
|
@ -91,6 +95,9 @@ void dmSendStatusReq(SDnodeMgmt *pMgmt) {
|
||||||
|
|
||||||
(*pMgmt->getQnodeLoadsFp)(&req.qload);
|
(*pMgmt->getQnodeLoadsFp)(&req.qload);
|
||||||
|
|
||||||
|
pMgmt->statusSeq++;
|
||||||
|
req.statusSeq = pMgmt->statusSeq;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSStatusReq(NULL, 0, &req);
|
int32_t contLen = tSerializeSStatusReq(NULL, 0, &req);
|
||||||
void *pHead = rpcMallocCont(contLen);
|
void *pHead = rpcMallocCont(contLen);
|
||||||
tSerializeSStatusReq(pHead, contLen, &req);
|
tSerializeSStatusReq(pHead, contLen, &req);
|
||||||
|
@ -99,13 +106,13 @@ void dmSendStatusReq(SDnodeMgmt *pMgmt) {
|
||||||
SRpcMsg rpcMsg = {.pCont = pHead, .contLen = contLen, .msgType = TDMT_MND_STATUS, .info.ahandle = (void *)0x9527};
|
SRpcMsg rpcMsg = {.pCont = pHead, .contLen = contLen, .msgType = TDMT_MND_STATUS, .info.ahandle = (void *)0x9527};
|
||||||
SRpcMsg rpcRsp = {0};
|
SRpcMsg rpcRsp = {0};
|
||||||
|
|
||||||
dTrace("send status msg to mnode, dnodeVer:%" PRId64, req.dnodeVer);
|
dTrace("send status req to mnode, dnodeVer:%" PRId64 " statusSeq:%d", req.dnodeVer, req.statusSeq);
|
||||||
|
|
||||||
SEpSet epSet = {0};
|
SEpSet epSet = {0};
|
||||||
dmGetMnodeEpSet(pMgmt->pData, &epSet);
|
dmGetMnodeEpSet(pMgmt->pData, &epSet);
|
||||||
rpcSendRecv(pMgmt->msgCb.clientRpc, &epSet, &rpcMsg, &rpcRsp);
|
rpcSendRecv(pMgmt->msgCb.clientRpc, &epSet, &rpcMsg, &rpcRsp);
|
||||||
if (rpcRsp.code != 0) {
|
if (rpcRsp.code != 0) {
|
||||||
dError("failed to send status msg since %s, numOfEps:%d inUse:%d", tstrerror(rpcRsp.code), epSet.numOfEps,
|
dError("failed to send status req since %s, numOfEps:%d inUse:%d", tstrerror(rpcRsp.code), epSet.numOfEps,
|
||||||
epSet.inUse);
|
epSet.inUse);
|
||||||
for (int32_t i = 0; i < epSet.numOfEps; ++i) {
|
for (int32_t i = 0; i < epSet.numOfEps; ++i) {
|
||||||
dDebug("index:%d, mnode ep:%s:%u", i, epSet.eps[i].fqdn, epSet.eps[i].port);
|
dDebug("index:%d, mnode ep:%s:%u", i, epSet.eps[i].fqdn, epSet.eps[i].port);
|
||||||
|
@ -300,8 +307,7 @@ int32_t dmProcessRetrieve(SDnodeMgmt *pMgmt, SRpcMsg *pMsg) {
|
||||||
pStart += sizeof(SSysTableSchema);
|
pStart += sizeof(SSysTableSchema);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t len = 0;
|
int32_t len = blockEncode(pBlock, pStart, numOfCols);
|
||||||
blockEncode(pBlock, pStart, &len, numOfCols, false);
|
|
||||||
|
|
||||||
pRsp->numOfRows = htonl(pBlock->info.rows);
|
pRsp->numOfRows = htonl(pBlock->info.rows);
|
||||||
pRsp->precision = TSDB_TIME_PRECISION_MILLI; // millisecond time precision
|
pRsp->precision = TSDB_TIME_PRECISION_MILLI; // millisecond time precision
|
||||||
|
|
|
@ -91,7 +91,7 @@ SArray *mmGetMsgHandles() {
|
||||||
if (dmSetMgmtHandle(pArray, TDMT_DND_DROP_SNODE_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
if (dmSetMgmtHandle(pArray, TDMT_DND_DROP_SNODE_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
||||||
if (dmSetMgmtHandle(pArray, TDMT_DND_CREATE_VNODE_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
if (dmSetMgmtHandle(pArray, TDMT_DND_CREATE_VNODE_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
||||||
if (dmSetMgmtHandle(pArray, TDMT_DND_DROP_VNODE_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
if (dmSetMgmtHandle(pArray, TDMT_DND_DROP_VNODE_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
||||||
if (dmSetMgmtHandle(pArray, TDMT_DND_CONFIG_DNODE_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
if (dmSetMgmtHandle(pArray, TDMT_DND_CONFIG_DNODE_RSP, mmPutMsgToReadQueue, 0) == NULL) goto _OVER;
|
||||||
|
|
||||||
if (dmSetMgmtHandle(pArray, TDMT_MND_CONNECT, mmPutMsgToReadQueue, 0) == NULL) goto _OVER;
|
if (dmSetMgmtHandle(pArray, TDMT_MND_CONNECT, mmPutMsgToReadQueue, 0) == NULL) goto _OVER;
|
||||||
if (dmSetMgmtHandle(pArray, TDMT_MND_CREATE_ACCT, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
if (dmSetMgmtHandle(pArray, TDMT_MND_CREATE_ACCT, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
||||||
|
@ -102,7 +102,7 @@ SArray *mmGetMsgHandles() {
|
||||||
if (dmSetMgmtHandle(pArray, TDMT_MND_DROP_USER, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
if (dmSetMgmtHandle(pArray, TDMT_MND_DROP_USER, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
||||||
if (dmSetMgmtHandle(pArray, TDMT_MND_GET_USER_AUTH, mmPutMsgToReadQueue, 0) == NULL) goto _OVER;
|
if (dmSetMgmtHandle(pArray, TDMT_MND_GET_USER_AUTH, mmPutMsgToReadQueue, 0) == NULL) goto _OVER;
|
||||||
if (dmSetMgmtHandle(pArray, TDMT_MND_CREATE_DNODE, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
if (dmSetMgmtHandle(pArray, TDMT_MND_CREATE_DNODE, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
||||||
if (dmSetMgmtHandle(pArray, TDMT_MND_CONFIG_DNODE, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
if (dmSetMgmtHandle(pArray, TDMT_MND_CONFIG_DNODE, mmPutMsgToReadQueue, 0) == NULL) goto _OVER;
|
||||||
if (dmSetMgmtHandle(pArray, TDMT_MND_DROP_DNODE, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
if (dmSetMgmtHandle(pArray, TDMT_MND_DROP_DNODE, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
||||||
if (dmSetMgmtHandle(pArray, TDMT_MND_CREATE_MNODE, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
if (dmSetMgmtHandle(pArray, TDMT_MND_CREATE_MNODE, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
||||||
if (dmSetMgmtHandle(pArray, TDMT_MND_ALTER_MNODE, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
if (dmSetMgmtHandle(pArray, TDMT_MND_ALTER_MNODE, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
||||||
|
@ -116,7 +116,7 @@ SArray *mmGetMsgHandles() {
|
||||||
if (dmSetMgmtHandle(pArray, TDMT_MND_DROP_SNODE, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
if (dmSetMgmtHandle(pArray, TDMT_MND_DROP_SNODE, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
||||||
if (dmSetMgmtHandle(pArray, TDMT_MND_CREATE_DB, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
if (dmSetMgmtHandle(pArray, TDMT_MND_CREATE_DB, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
||||||
if (dmSetMgmtHandle(pArray, TDMT_MND_DROP_DB, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
if (dmSetMgmtHandle(pArray, TDMT_MND_DROP_DB, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
||||||
if (dmSetMgmtHandle(pArray, TDMT_MND_USE_DB, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
if (dmSetMgmtHandle(pArray, TDMT_MND_USE_DB, mmPutMsgToReadQueue, 0) == NULL) goto _OVER;
|
||||||
if (dmSetMgmtHandle(pArray, TDMT_MND_ALTER_DB, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
if (dmSetMgmtHandle(pArray, TDMT_MND_ALTER_DB, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
||||||
if (dmSetMgmtHandle(pArray, TDMT_MND_COMPACT_DB, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
if (dmSetMgmtHandle(pArray, TDMT_MND_COMPACT_DB, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
||||||
if (dmSetMgmtHandle(pArray, TDMT_MND_TRIM_DB, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
if (dmSetMgmtHandle(pArray, TDMT_MND_TRIM_DB, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
||||||
|
@ -127,7 +127,7 @@ SArray *mmGetMsgHandles() {
|
||||||
if (dmSetMgmtHandle(pArray, TDMT_MND_SPLIT_VGROUP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
if (dmSetMgmtHandle(pArray, TDMT_MND_SPLIT_VGROUP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
||||||
if (dmSetMgmtHandle(pArray, TDMT_MND_BALANCE_VGROUP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
if (dmSetMgmtHandle(pArray, TDMT_MND_BALANCE_VGROUP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
||||||
if (dmSetMgmtHandle(pArray, TDMT_MND_CREATE_FUNC, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
if (dmSetMgmtHandle(pArray, TDMT_MND_CREATE_FUNC, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
||||||
if (dmSetMgmtHandle(pArray, TDMT_MND_RETRIEVE_FUNC, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
if (dmSetMgmtHandle(pArray, TDMT_MND_RETRIEVE_FUNC, mmPutMsgToReadQueue, 0) == NULL) goto _OVER;
|
||||||
if (dmSetMgmtHandle(pArray, TDMT_MND_DROP_FUNC, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
if (dmSetMgmtHandle(pArray, TDMT_MND_DROP_FUNC, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
||||||
if (dmSetMgmtHandle(pArray, TDMT_MND_CREATE_STB, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
if (dmSetMgmtHandle(pArray, TDMT_MND_CREATE_STB, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
||||||
if (dmSetMgmtHandle(pArray, TDMT_MND_ALTER_STB, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
if (dmSetMgmtHandle(pArray, TDMT_MND_ALTER_STB, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
||||||
|
@ -151,7 +151,7 @@ SArray *mmGetMsgHandles() {
|
||||||
if (dmSetMgmtHandle(pArray, TDMT_MND_KILL_TRANS, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
if (dmSetMgmtHandle(pArray, TDMT_MND_KILL_TRANS, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
||||||
if (dmSetMgmtHandle(pArray, TDMT_MND_KILL_QUERY, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
if (dmSetMgmtHandle(pArray, TDMT_MND_KILL_QUERY, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
||||||
if (dmSetMgmtHandle(pArray, TDMT_MND_KILL_CONN, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
if (dmSetMgmtHandle(pArray, TDMT_MND_KILL_CONN, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
||||||
if (dmSetMgmtHandle(pArray, TDMT_MND_HEARTBEAT, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
if (dmSetMgmtHandle(pArray, TDMT_MND_HEARTBEAT, mmPutMsgToReadQueue, 0) == NULL) goto _OVER;
|
||||||
if (dmSetMgmtHandle(pArray, TDMT_MND_STATUS, mmPutMsgToReadQueue, 0) == NULL) goto _OVER;
|
if (dmSetMgmtHandle(pArray, TDMT_MND_STATUS, mmPutMsgToReadQueue, 0) == NULL) goto _OVER;
|
||||||
if (dmSetMgmtHandle(pArray, TDMT_MND_SYSTABLE_RETRIEVE, mmPutMsgToReadQueue, 0) == NULL) goto _OVER;
|
if (dmSetMgmtHandle(pArray, TDMT_MND_SYSTABLE_RETRIEVE, mmPutMsgToReadQueue, 0) == NULL) goto _OVER;
|
||||||
if (dmSetMgmtHandle(pArray, TDMT_MND_AUTH, mmPutMsgToReadQueue, 0) == NULL) goto _OVER;
|
if (dmSetMgmtHandle(pArray, TDMT_MND_AUTH, mmPutMsgToReadQueue, 0) == NULL) goto _OVER;
|
||||||
|
@ -195,6 +195,8 @@ SArray *mmGetMsgHandles() {
|
||||||
if (dmSetMgmtHandle(pArray, TDMT_SYNC_APPEND_ENTRIES_REPLY, mmPutMsgToSyncQueue, 1) == NULL) goto _OVER;
|
if (dmSetMgmtHandle(pArray, TDMT_SYNC_APPEND_ENTRIES_REPLY, mmPutMsgToSyncQueue, 1) == NULL) goto _OVER;
|
||||||
if (dmSetMgmtHandle(pArray, TDMT_SYNC_SNAPSHOT_SEND, mmPutMsgToSyncQueue, 1) == NULL) goto _OVER;
|
if (dmSetMgmtHandle(pArray, TDMT_SYNC_SNAPSHOT_SEND, mmPutMsgToSyncQueue, 1) == NULL) goto _OVER;
|
||||||
if (dmSetMgmtHandle(pArray, TDMT_SYNC_SNAPSHOT_RSP, mmPutMsgToSyncQueue, 1) == NULL) goto _OVER;
|
if (dmSetMgmtHandle(pArray, TDMT_SYNC_SNAPSHOT_RSP, mmPutMsgToSyncQueue, 1) == NULL) goto _OVER;
|
||||||
|
if (dmSetMgmtHandle(pArray, TDMT_SYNC_PRE_SNAPSHOT, mmPutMsgToSyncQueue, 1) == NULL) goto _OVER;
|
||||||
|
if (dmSetMgmtHandle(pArray, TDMT_SYNC_PRE_SNAPSHOT_REPLY, mmPutMsgToSyncQueue, 1) == NULL) goto _OVER;
|
||||||
|
|
||||||
if (dmSetMgmtHandle(pArray, TDMT_SYNC_HEARTBEAT, mmPutMsgToSyncCtrlQueue, 1) == NULL) goto _OVER;
|
if (dmSetMgmtHandle(pArray, TDMT_SYNC_HEARTBEAT, mmPutMsgToSyncCtrlQueue, 1) == NULL) goto _OVER;
|
||||||
if (dmSetMgmtHandle(pArray, TDMT_SYNC_HEARTBEAT_REPLY, mmPutMsgToSyncCtrlQueue, 1) == NULL) goto _OVER;
|
if (dmSetMgmtHandle(pArray, TDMT_SYNC_HEARTBEAT_REPLY, mmPutMsgToSyncCtrlQueue, 1) == NULL) goto _OVER;
|
||||||
|
|
|
@ -58,7 +58,11 @@ static void smProcessStreamQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) {
|
||||||
dTrace("msg:%p, get from snode-stream queue", pMsg);
|
dTrace("msg:%p, get from snode-stream queue", pMsg);
|
||||||
int32_t code = sndProcessStreamMsg(pMgmt->pSnode, pMsg);
|
int32_t code = sndProcessStreamMsg(pMgmt->pSnode, pMsg);
|
||||||
if (code < 0) {
|
if (code < 0) {
|
||||||
dGError("snd, msg:%p failed to process stream since %s", pMsg, terrstr(code));
|
if (pMsg) {
|
||||||
|
dGError("snd, msg:%p failed to process stream msg %s since %s", pMsg, TMSG_INFO(pMsg->msgType), terrstr(code));
|
||||||
|
} else {
|
||||||
|
dGError("snd, msg:%p failed to process stream empty msg since %s", pMsg, terrstr(code));
|
||||||
|
}
|
||||||
smSendRsp(pMsg, terrno);
|
smSendRsp(pMsg, terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,6 +140,9 @@ int32_t smPutMsgToQueue(SSnodeMgmt *pMgmt, EQueueType qtype, SRpcMsg *pRpc) {
|
||||||
if (pSnode == NULL) {
|
if (pSnode == NULL) {
|
||||||
dError("snode: msg:%p failed to put into vnode queue since %s, type:%s qtype:%d", pMsg, terrstr(),
|
dError("snode: msg:%p failed to put into vnode queue since %s, type:%s qtype:%d", pMsg, terrstr(),
|
||||||
TMSG_INFO(pMsg->msgType), qtype);
|
TMSG_INFO(pMsg->msgType), qtype);
|
||||||
|
taosFreeQitem(pMsg);
|
||||||
|
rpcFreeCont(pRpc->pCont);
|
||||||
|
pRpc->pCont = NULL;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,10 +33,6 @@ typedef struct SVnodeMgmt {
|
||||||
SQWorkerPool queryPool;
|
SQWorkerPool queryPool;
|
||||||
SQWorkerPool streamPool;
|
SQWorkerPool streamPool;
|
||||||
SWWorkerPool fetchPool;
|
SWWorkerPool fetchPool;
|
||||||
SWWorkerPool syncPool;
|
|
||||||
SWWorkerPool syncCtrlPool;
|
|
||||||
SWWorkerPool writePool;
|
|
||||||
SWWorkerPool applyPool;
|
|
||||||
SSingleWorker mgmtWorker;
|
SSingleWorker mgmtWorker;
|
||||||
SHashObj *hash;
|
SHashObj *hash;
|
||||||
TdThreadRwlock lock;
|
TdThreadRwlock lock;
|
||||||
|
@ -52,19 +48,19 @@ typedef struct {
|
||||||
} SWrapperCfg;
|
} SWrapperCfg;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int32_t vgId;
|
int32_t vgId;
|
||||||
int32_t vgVersion;
|
int32_t vgVersion;
|
||||||
int32_t refCount;
|
int32_t refCount;
|
||||||
int8_t dropped;
|
int8_t dropped;
|
||||||
char *path;
|
char *path;
|
||||||
SVnode *pImpl;
|
SVnode *pImpl;
|
||||||
STaosQueue *pWriteQ;
|
SMultiWorker pWriteW;
|
||||||
STaosQueue *pSyncQ;
|
SMultiWorker pSyncW;
|
||||||
STaosQueue *pSyncCtrlQ;
|
SMultiWorker pSyncCtrlW;
|
||||||
STaosQueue *pApplyQ;
|
SMultiWorker pApplyW;
|
||||||
STaosQueue *pQueryQ;
|
STaosQueue *pQueryQ;
|
||||||
STaosQueue *pStreamQ;
|
STaosQueue *pStreamQ;
|
||||||
STaosQueue *pFetchQ;
|
STaosQueue *pFetchQ;
|
||||||
} SVnodeObj;
|
} SVnodeObj;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
|
@ -191,6 +191,16 @@ int32_t vmProcessCreateVnodeReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) {
|
||||||
dInfo("vgId:%d, replica:%d id:%d fqdn:%s port:%u", req.vgId, i, req.replicas[i].id, req.replicas[i].fqdn,
|
dInfo("vgId:%d, replica:%d id:%d fqdn:%s port:%u", req.vgId, i, req.replicas[i].id, req.replicas[i].fqdn,
|
||||||
req.replicas[i].port);
|
req.replicas[i].port);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SReplica *pReplica = &req.replicas[req.selfIndex];
|
||||||
|
if (pReplica->id != pMgmt->pData->dnodeId || pReplica->port != tsServerPort ||
|
||||||
|
strcmp(pReplica->fqdn, tsLocalFqdn) != 0) {
|
||||||
|
terrno = TSDB_CODE_INVALID_MSG;
|
||||||
|
dError("vgId:%d, dnodeId:%d ep:%s:%u not matched with local dnode", req.vgId, pReplica->id, pReplica->fqdn,
|
||||||
|
pReplica->port);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
vmGenerateVnodeCfg(&req, &vnodeCfg);
|
vmGenerateVnodeCfg(&req, &vnodeCfg);
|
||||||
|
|
||||||
if (vmTsmaAdjustDays(&vnodeCfg, &req) < 0) {
|
if (vmTsmaAdjustDays(&vnodeCfg, &req) < 0) {
|
||||||
|
@ -285,6 +295,15 @@ int32_t vmProcessAlterVnodeReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SReplica *pReplica = &alterReq.replicas[alterReq.selfIndex];
|
||||||
|
if (pReplica->id != pMgmt->pData->dnodeId || pReplica->port != tsServerPort ||
|
||||||
|
strcmp(pReplica->fqdn, tsLocalFqdn) != 0) {
|
||||||
|
terrno = TSDB_CODE_INVALID_MSG;
|
||||||
|
dError("vgId:%d, dnodeId:%d ep:%s:%u not matched with local dnode", alterReq.vgId, pReplica->id, pReplica->fqdn,
|
||||||
|
pReplica->port);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
SVnodeObj *pVnode = vmAcquireVnode(pMgmt, vgId);
|
SVnodeObj *pVnode = vmAcquireVnode(pMgmt, vgId);
|
||||||
if (pVnode == NULL) {
|
if (pVnode == NULL) {
|
||||||
dError("vgId:%d, failed to alter replica since %s", vgId, terrstr());
|
dError("vgId:%d, failed to alter replica since %s", vgId, terrstr());
|
||||||
|
@ -341,6 +360,12 @@ int32_t vmProcessDropVnodeReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) {
|
||||||
int32_t vgId = dropReq.vgId;
|
int32_t vgId = dropReq.vgId;
|
||||||
dDebug("vgId:%d, start to drop vnode", vgId);
|
dDebug("vgId:%d, start to drop vnode", vgId);
|
||||||
|
|
||||||
|
if (dropReq.dnodeId != pMgmt->pData->dnodeId) {
|
||||||
|
terrno = TSDB_CODE_INVALID_MSG;
|
||||||
|
dError("vgId:%d, dnodeId:%d not matched with local dnode", dropReq.vgId, dropReq.dnodeId);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
SVnodeObj *pVnode = vmAcquireVnode(pMgmt, vgId);
|
SVnodeObj *pVnode = vmAcquireVnode(pMgmt, vgId);
|
||||||
if (pVnode == NULL) {
|
if (pVnode == NULL) {
|
||||||
dDebug("vgId:%d, failed to drop since %s", vgId, terrstr());
|
dDebug("vgId:%d, failed to drop since %s", vgId, terrstr());
|
||||||
|
@ -403,7 +428,6 @@ SArray *vmGetMsgHandles() {
|
||||||
if (dmSetMgmtHandle(pArray, TDMT_VND_COMMIT, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
if (dmSetMgmtHandle(pArray, TDMT_VND_COMMIT, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
||||||
if (dmSetMgmtHandle(pArray, TDMT_SCH_QUERY_HEARTBEAT, vmPutMsgToFetchQueue, 0) == NULL) goto _OVER;
|
if (dmSetMgmtHandle(pArray, TDMT_SCH_QUERY_HEARTBEAT, vmPutMsgToFetchQueue, 0) == NULL) goto _OVER;
|
||||||
|
|
||||||
if (dmSetMgmtHandle(pArray, TDMT_VND_STREAM_TRIGGER, vmPutMsgToStreamQueue, 0) == NULL) goto _OVER;
|
|
||||||
if (dmSetMgmtHandle(pArray, TDMT_STREAM_TASK_DROP, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
if (dmSetMgmtHandle(pArray, TDMT_STREAM_TASK_DROP, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
||||||
if (dmSetMgmtHandle(pArray, TDMT_STREAM_TASK_DEPLOY, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
if (dmSetMgmtHandle(pArray, TDMT_STREAM_TASK_DEPLOY, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
||||||
if (dmSetMgmtHandle(pArray, TDMT_STREAM_TASK_RUN, vmPutMsgToStreamQueue, 0) == NULL) goto _OVER;
|
if (dmSetMgmtHandle(pArray, TDMT_STREAM_TASK_RUN, vmPutMsgToStreamQueue, 0) == NULL) goto _OVER;
|
||||||
|
@ -412,6 +436,9 @@ SArray *vmGetMsgHandles() {
|
||||||
if (dmSetMgmtHandle(pArray, TDMT_STREAM_RETRIEVE, vmPutMsgToStreamQueue, 0) == NULL) goto _OVER;
|
if (dmSetMgmtHandle(pArray, TDMT_STREAM_RETRIEVE, vmPutMsgToStreamQueue, 0) == NULL) goto _OVER;
|
||||||
if (dmSetMgmtHandle(pArray, TDMT_STREAM_RETRIEVE_RSP, vmPutMsgToStreamQueue, 0) == NULL) goto _OVER;
|
if (dmSetMgmtHandle(pArray, TDMT_STREAM_RETRIEVE_RSP, vmPutMsgToStreamQueue, 0) == NULL) goto _OVER;
|
||||||
if (dmSetMgmtHandle(pArray, TDMT_STREAM_RECOVER_FINISH, vmPutMsgToStreamQueue, 0) == NULL) goto _OVER;
|
if (dmSetMgmtHandle(pArray, TDMT_STREAM_RECOVER_FINISH, vmPutMsgToStreamQueue, 0) == NULL) goto _OVER;
|
||||||
|
if (dmSetMgmtHandle(pArray, TDMT_STREAM_TASK_CHECK, vmPutMsgToStreamQueue, 0) == NULL) goto _OVER;
|
||||||
|
if (dmSetMgmtHandle(pArray, TDMT_STREAM_TASK_CHECK_RSP, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
||||||
|
if (dmSetMgmtHandle(pArray, TDMT_VND_STREAM_TRIGGER, vmPutMsgToStreamQueue, 0) == NULL) goto _OVER;
|
||||||
|
|
||||||
if (dmSetMgmtHandle(pArray, TDMT_VND_ALTER_REPLICA, vmPutMsgToMgmtQueue, 0) == NULL) goto _OVER;
|
if (dmSetMgmtHandle(pArray, TDMT_VND_ALTER_REPLICA, vmPutMsgToMgmtQueue, 0) == NULL) goto _OVER;
|
||||||
if (dmSetMgmtHandle(pArray, TDMT_VND_ALTER_CONFIG, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
if (dmSetMgmtHandle(pArray, TDMT_VND_ALTER_CONFIG, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
||||||
|
@ -435,6 +462,9 @@ SArray *vmGetMsgHandles() {
|
||||||
if (dmSetMgmtHandle(pArray, TDMT_SYNC_APPEND_ENTRIES_REPLY, vmPutMsgToSyncQueue, 0) == NULL) goto _OVER;
|
if (dmSetMgmtHandle(pArray, TDMT_SYNC_APPEND_ENTRIES_REPLY, vmPutMsgToSyncQueue, 0) == NULL) goto _OVER;
|
||||||
if (dmSetMgmtHandle(pArray, TDMT_SYNC_SNAPSHOT_SEND, vmPutMsgToSyncQueue, 0) == NULL) goto _OVER;
|
if (dmSetMgmtHandle(pArray, TDMT_SYNC_SNAPSHOT_SEND, vmPutMsgToSyncQueue, 0) == NULL) goto _OVER;
|
||||||
if (dmSetMgmtHandle(pArray, TDMT_SYNC_SNAPSHOT_RSP, vmPutMsgToSyncQueue, 0) == NULL) goto _OVER;
|
if (dmSetMgmtHandle(pArray, TDMT_SYNC_SNAPSHOT_RSP, vmPutMsgToSyncQueue, 0) == NULL) goto _OVER;
|
||||||
|
if (dmSetMgmtHandle(pArray, TDMT_SYNC_PRE_SNAPSHOT, vmPutMsgToSyncQueue, 0) == NULL) goto _OVER;
|
||||||
|
if (dmSetMgmtHandle(pArray, TDMT_SYNC_PRE_SNAPSHOT_REPLY, vmPutMsgToSyncQueue, 0) == NULL) goto _OVER;
|
||||||
|
|
||||||
if (dmSetMgmtHandle(pArray, TDMT_SYNC_HEARTBEAT, vmPutMsgToSyncCtrlQueue, 0) == NULL) goto _OVER;
|
if (dmSetMgmtHandle(pArray, TDMT_SYNC_HEARTBEAT, vmPutMsgToSyncCtrlQueue, 0) == NULL) goto _OVER;
|
||||||
if (dmSetMgmtHandle(pArray, TDMT_SYNC_HEARTBEAT_REPLY, vmPutMsgToSyncCtrlQueue, 0) == NULL) goto _OVER;
|
if (dmSetMgmtHandle(pArray, TDMT_SYNC_HEARTBEAT_REPLY, vmPutMsgToSyncCtrlQueue, 0) == NULL) goto _OVER;
|
||||||
|
|
||||||
|
|
|
@ -79,29 +79,49 @@ int32_t vmOpenVnode(SVnodeMgmt *pMgmt, SWrapperCfg *pCfg, SVnode *pImpl) {
|
||||||
void vmCloseVnode(SVnodeMgmt *pMgmt, SVnodeObj *pVnode) {
|
void vmCloseVnode(SVnodeMgmt *pMgmt, SVnodeObj *pVnode) {
|
||||||
char path[TSDB_FILENAME_LEN] = {0};
|
char path[TSDB_FILENAME_LEN] = {0};
|
||||||
|
|
||||||
vnodePreClose(pVnode->pImpl);
|
|
||||||
|
|
||||||
taosThreadRwlockWrlock(&pMgmt->lock);
|
taosThreadRwlockWrlock(&pMgmt->lock);
|
||||||
taosHashRemove(pMgmt->hash, &pVnode->vgId, sizeof(int32_t));
|
taosHashRemove(pMgmt->hash, &pVnode->vgId, sizeof(int32_t));
|
||||||
taosThreadRwlockUnlock(&pMgmt->lock);
|
taosThreadRwlockUnlock(&pMgmt->lock);
|
||||||
vmReleaseVnode(pMgmt, pVnode);
|
vmReleaseVnode(pMgmt, pVnode);
|
||||||
|
|
||||||
dTrace("vgId:%d, wait for vnode ref become 0", pVnode->vgId);
|
dInfo("vgId:%d, pre close", pVnode->vgId);
|
||||||
while (pVnode->refCount > 0) taosMsleep(10);
|
vnodePreClose(pVnode->pImpl);
|
||||||
dTrace("vgId:%d, wait for vnode queue is empty", pVnode->vgId);
|
|
||||||
|
|
||||||
while (!taosQueueEmpty(pVnode->pWriteQ)) taosMsleep(10);
|
dInfo("vgId:%d, wait for vnode ref become 0", pVnode->vgId);
|
||||||
while (!taosQueueEmpty(pVnode->pSyncQ)) taosMsleep(10);
|
while (pVnode->refCount > 0) taosMsleep(10);
|
||||||
while (!taosQueueEmpty(pVnode->pApplyQ)) taosMsleep(10);
|
|
||||||
|
dInfo("vgId:%d, wait for vnode write queue:%p is empty, thread:%08" PRId64, pVnode->vgId, pVnode->pWriteW.queue,
|
||||||
|
pVnode->pWriteW.queue->threadId);
|
||||||
|
tMultiWorkerCleanup(&pVnode->pWriteW);
|
||||||
|
|
||||||
|
dInfo("vgId:%d, wait for vnode sync queue:%p is empty, thread:%08" PRId64, pVnode->vgId, pVnode->pSyncW.queue,
|
||||||
|
pVnode->pSyncW.queue->threadId);
|
||||||
|
tMultiWorkerCleanup(&pVnode->pSyncW);
|
||||||
|
|
||||||
|
dInfo("vgId:%d, wait for vnode sync ctrl queue:%p is empty, thread:%08" PRId64, pVnode->vgId,
|
||||||
|
pVnode->pSyncCtrlW.queue, pVnode->pSyncCtrlW.queue->threadId);
|
||||||
|
tMultiWorkerCleanup(&pVnode->pSyncCtrlW);
|
||||||
|
|
||||||
|
dInfo("vgId:%d, wait for vnode apply queue:%p is empty, thread:%08" PRId64, pVnode->vgId, pVnode->pApplyW.queue,
|
||||||
|
pVnode->pApplyW.queue->threadId);
|
||||||
|
tMultiWorkerCleanup(&pVnode->pApplyW);
|
||||||
|
|
||||||
|
dInfo("vgId:%d, wait for vnode query queue:%p is empty", pVnode->vgId, pVnode->pQueryQ);
|
||||||
while (!taosQueueEmpty(pVnode->pQueryQ)) taosMsleep(10);
|
while (!taosQueueEmpty(pVnode->pQueryQ)) taosMsleep(10);
|
||||||
|
|
||||||
|
dInfo("vgId:%d, wait for vnode fetch queue:%p is empty, thread:%08" PRId64, pVnode->vgId, pVnode->pFetchQ,
|
||||||
|
pVnode->pFetchQ->threadId);
|
||||||
while (!taosQueueEmpty(pVnode->pFetchQ)) taosMsleep(10);
|
while (!taosQueueEmpty(pVnode->pFetchQ)) taosMsleep(10);
|
||||||
|
|
||||||
|
dInfo("vgId:%d, wait for vnode stream queue:%p is empty", pVnode->vgId, pVnode->pStreamQ);
|
||||||
while (!taosQueueEmpty(pVnode->pStreamQ)) taosMsleep(10);
|
while (!taosQueueEmpty(pVnode->pStreamQ)) taosMsleep(10);
|
||||||
dTrace("vgId:%d, vnode queue is empty", pVnode->vgId);
|
|
||||||
|
dInfo("vgId:%d, all vnode queues is empty", pVnode->vgId);
|
||||||
|
|
||||||
vmFreeQueue(pMgmt, pVnode);
|
vmFreeQueue(pMgmt, pVnode);
|
||||||
vnodeClose(pVnode->pImpl);
|
vnodeClose(pVnode->pImpl);
|
||||||
pVnode->pImpl = NULL;
|
pVnode->pImpl = NULL;
|
||||||
dDebug("vgId:%d, vnode is closed", pVnode->vgId);
|
dInfo("vgId:%d, vnode is closed", pVnode->vgId);
|
||||||
|
|
||||||
if (pVnode->dropped) {
|
if (pVnode->dropped) {
|
||||||
dInfo("vgId:%d, vnode is destroyed, dropped:%d", pVnode->vgId, pVnode->dropped);
|
dInfo("vgId:%d, vnode is destroyed, dropped:%d", pVnode->vgId, pVnode->dropped);
|
||||||
|
|
|
@ -86,7 +86,12 @@ static void vmProcessStreamQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) {
|
||||||
int32_t code = vnodeProcessFetchMsg(pVnode->pImpl, pMsg, pInfo);
|
int32_t code = vnodeProcessFetchMsg(pVnode->pImpl, pMsg, pInfo);
|
||||||
if (code != 0) {
|
if (code != 0) {
|
||||||
if (terrno != 0) code = terrno;
|
if (terrno != 0) code = terrno;
|
||||||
dGError("vgId:%d, msg:%p failed to process stream since %s", pVnode->vgId, pMsg, terrstr(code));
|
if (pMsg) {
|
||||||
|
dGError("vgId:%d, msg:%p failed to process stream msg %s since %s", pVnode->vgId, pMsg, TMSG_INFO(pMsg->msgType),
|
||||||
|
terrstr(code));
|
||||||
|
} else {
|
||||||
|
dGError("vgId:%d, msg:%p failed to process stream empty msg since %s", pVnode->vgId, pMsg, terrstr(code));
|
||||||
|
}
|
||||||
vmSendRsp(pMsg, code);
|
vmSendRsp(pMsg, code);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -150,12 +155,10 @@ static int32_t vmPutMsgToQueue(SVnodeMgmt *pMgmt, SRpcMsg *pMsg, EQueueType qtyp
|
||||||
|
|
||||||
switch (qtype) {
|
switch (qtype) {
|
||||||
case QUERY_QUEUE:
|
case QUERY_QUEUE:
|
||||||
if ((pMsg->msgType == TDMT_SCH_QUERY) && (grantCheck(TSDB_GRANT_TIME) != TSDB_CODE_SUCCESS)) {
|
code = vnodePreprocessQueryMsg(pVnode->pImpl, pMsg);
|
||||||
terrno = TSDB_CODE_GRANT_EXPIRED;
|
if (code) {
|
||||||
code = terrno;
|
dError("vgId:%d, msg:%p preprocess query msg failed since %s", pVnode->vgId, pMsg, terrstr(code));
|
||||||
dDebug("vgId:%d, msg:%p put into vnode-query queue failed since %s", pVnode->vgId, pMsg, terrstr(code));
|
|
||||||
} else {
|
} else {
|
||||||
vnodePreprocessQueryMsg(pVnode->pImpl, pMsg);
|
|
||||||
dGTrace("vgId:%d, msg:%p put into vnode-query queue", pVnode->vgId, pMsg);
|
dGTrace("vgId:%d, msg:%p put into vnode-query queue", pVnode->vgId, pMsg);
|
||||||
taosWriteQitem(pVnode->pQueryQ, pMsg);
|
taosWriteQitem(pVnode->pQueryQ, pMsg);
|
||||||
}
|
}
|
||||||
|
@ -174,7 +177,7 @@ static int32_t vmPutMsgToQueue(SVnodeMgmt *pMgmt, SRpcMsg *pMsg, EQueueType qtyp
|
||||||
break;
|
break;
|
||||||
case WRITE_QUEUE:
|
case WRITE_QUEUE:
|
||||||
if (!osDataSpaceAvailable()) {
|
if (!osDataSpaceAvailable()) {
|
||||||
terrno = TSDB_CODE_VND_NO_DISKSPACE;
|
terrno = TSDB_CODE_NO_DISKSPACE;
|
||||||
code = terrno;
|
code = terrno;
|
||||||
dError("vgId:%d, msg:%p put into vnode-write queue failed since %s", pVnode->vgId, pMsg, terrstr(code));
|
dError("vgId:%d, msg:%p put into vnode-write queue failed since %s", pVnode->vgId, pMsg, terrstr(code));
|
||||||
} else if ((pMsg->msgType == TDMT_VND_SUBMIT) && (grantCheck(TSDB_GRANT_STORAGE) != TSDB_CODE_SUCCESS)) {
|
} else if ((pMsg->msgType == TDMT_VND_SUBMIT) && (grantCheck(TSDB_GRANT_STORAGE) != TSDB_CODE_SUCCESS)) {
|
||||||
|
@ -183,30 +186,20 @@ static int32_t vmPutMsgToQueue(SVnodeMgmt *pMgmt, SRpcMsg *pMsg, EQueueType qtyp
|
||||||
dDebug("vgId:%d, msg:%p put into vnode-write queue failed since %s", pVnode->vgId, pMsg, terrstr(code));
|
dDebug("vgId:%d, msg:%p put into vnode-write queue failed since %s", pVnode->vgId, pMsg, terrstr(code));
|
||||||
} else {
|
} else {
|
||||||
dGTrace("vgId:%d, msg:%p put into vnode-write queue", pVnode->vgId, pMsg);
|
dGTrace("vgId:%d, msg:%p put into vnode-write queue", pVnode->vgId, pMsg);
|
||||||
taosWriteQitem(pVnode->pWriteQ, pMsg);
|
taosWriteQitem(pVnode->pWriteW.queue, pMsg);
|
||||||
#if 0 // tests for batch writes
|
|
||||||
if (pMsg->msgType == TDMT_VND_CREATE_TABLE) {
|
|
||||||
SRpcMsg *pDup = taosAllocateQitem(sizeof(SRpcMsg), RPC_QITEM);
|
|
||||||
memcpy(pDup, pMsg, sizeof(SRpcMsg));
|
|
||||||
pDup->pCont = rpcMallocCont(pMsg->contLen);
|
|
||||||
memcpy(pDup->pCont, pMsg->pCont, pMsg->contLen);
|
|
||||||
pDup->info.handle = NULL;
|
|
||||||
taosWriteQitem(pVnode->pWriteQ, pDup);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SYNC_QUEUE:
|
case SYNC_QUEUE:
|
||||||
dGTrace("vgId:%d, msg:%p put into vnode-sync queue", pVnode->vgId, pMsg);
|
dGTrace("vgId:%d, msg:%p put into vnode-sync queue", pVnode->vgId, pMsg);
|
||||||
taosWriteQitem(pVnode->pSyncQ, pMsg);
|
taosWriteQitem(pVnode->pSyncW.queue, pMsg);
|
||||||
break;
|
break;
|
||||||
case SYNC_CTRL_QUEUE:
|
case SYNC_CTRL_QUEUE:
|
||||||
dGTrace("vgId:%d, msg:%p put into vnode-sync-ctrl queue", pVnode->vgId, pMsg);
|
dGTrace("vgId:%d, msg:%p put into vnode-sync-ctrl queue", pVnode->vgId, pMsg);
|
||||||
taosWriteQitem(pVnode->pSyncCtrlQ, pMsg);
|
taosWriteQitem(pVnode->pSyncCtrlW.queue, pMsg);
|
||||||
break;
|
break;
|
||||||
case APPLY_QUEUE:
|
case APPLY_QUEUE:
|
||||||
dGTrace("vgId:%d, msg:%p put into vnode-apply queue", pVnode->vgId, pMsg);
|
dGTrace("vgId:%d, msg:%p put into vnode-apply queue", pVnode->vgId, pMsg);
|
||||||
taosWriteQitem(pVnode->pApplyQ, pMsg);
|
taosWriteQitem(pVnode->pApplyW.queue, pMsg);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
code = -1;
|
code = -1;
|
||||||
|
@ -218,7 +211,9 @@ static int32_t vmPutMsgToQueue(SVnodeMgmt *pMgmt, SRpcMsg *pMsg, EQueueType qtyp
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t vmPutMsgToSyncCtrlQueue(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) { return vmPutMsgToQueue(pMgmt, pMsg, SYNC_CTRL_QUEUE); }
|
int32_t vmPutMsgToSyncCtrlQueue(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) {
|
||||||
|
return vmPutMsgToQueue(pMgmt, pMsg, SYNC_CTRL_QUEUE);
|
||||||
|
}
|
||||||
|
|
||||||
int32_t vmPutMsgToSyncQueue(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) { return vmPutMsgToQueue(pMgmt, pMsg, SYNC_QUEUE); }
|
int32_t vmPutMsgToSyncQueue(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) { return vmPutMsgToQueue(pMgmt, pMsg, SYNC_QUEUE); }
|
||||||
|
|
||||||
|
@ -269,13 +264,13 @@ int32_t vmGetQueueSize(SVnodeMgmt *pMgmt, int32_t vgId, EQueueType qtype) {
|
||||||
if (pVnode != NULL) {
|
if (pVnode != NULL) {
|
||||||
switch (qtype) {
|
switch (qtype) {
|
||||||
case WRITE_QUEUE:
|
case WRITE_QUEUE:
|
||||||
size = taosQueueItemSize(pVnode->pWriteQ);
|
size = taosQueueItemSize(pVnode->pWriteW.queue);
|
||||||
break;
|
break;
|
||||||
case SYNC_QUEUE:
|
case SYNC_QUEUE:
|
||||||
size = taosQueueItemSize(pVnode->pSyncQ);
|
size = taosQueueItemSize(pVnode->pSyncW.queue);
|
||||||
break;
|
break;
|
||||||
case APPLY_QUEUE:
|
case APPLY_QUEUE:
|
||||||
size = taosQueueItemSize(pVnode->pApplyQ);
|
size = taosQueueItemSize(pVnode->pApplyW.queue);
|
||||||
break;
|
break;
|
||||||
case QUERY_QUEUE:
|
case QUERY_QUEUE:
|
||||||
size = taosQueueItemSize(pVnode->pQueryQ);
|
size = taosQueueItemSize(pVnode->pQueryQ);
|
||||||
|
@ -299,40 +294,44 @@ int32_t vmGetQueueSize(SVnodeMgmt *pMgmt, int32_t vgId, EQueueType qtype) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t vmAllocQueue(SVnodeMgmt *pMgmt, SVnodeObj *pVnode) {
|
int32_t vmAllocQueue(SVnodeMgmt *pMgmt, SVnodeObj *pVnode) {
|
||||||
pVnode->pWriteQ = tWWorkerAllocQueue(&pMgmt->writePool, pVnode->pImpl, (FItems)vnodeProposeWriteMsg);
|
SMultiWorkerCfg wcfg = {.max = 1, .name = "vnode-write", .fp = (FItems)vnodeProposeWriteMsg, .param = pVnode->pImpl};
|
||||||
pVnode->pSyncQ = tWWorkerAllocQueue(&pMgmt->syncPool, pVnode, (FItems)vmProcessSyncQueue);
|
SMultiWorkerCfg scfg = {.max = 1, .name = "vnode-sync", .fp = (FItems)vmProcessSyncQueue, .param = pVnode};
|
||||||
pVnode->pSyncCtrlQ = tWWorkerAllocQueue(&pMgmt->syncCtrlPool, pVnode, (FItems)vmProcessSyncQueue);
|
SMultiWorkerCfg sccfg = {.max = 1, .name = "vnode-sync-ctrl", .fp = (FItems)vmProcessSyncQueue, .param = pVnode};
|
||||||
pVnode->pApplyQ = tWWorkerAllocQueue(&pMgmt->applyPool, pVnode->pImpl, (FItems)vnodeApplyWriteMsg);
|
SMultiWorkerCfg acfg = {.max = 1, .name = "vnode-apply", .fp = (FItems)vnodeApplyWriteMsg, .param = pVnode->pImpl};
|
||||||
|
(void)tMultiWorkerInit(&pVnode->pWriteW, &wcfg);
|
||||||
|
(void)tMultiWorkerInit(&pVnode->pSyncW, &scfg);
|
||||||
|
(void)tMultiWorkerInit(&pVnode->pSyncCtrlW, &sccfg);
|
||||||
|
(void)tMultiWorkerInit(&pVnode->pApplyW, &acfg);
|
||||||
|
|
||||||
pVnode->pQueryQ = tQWorkerAllocQueue(&pMgmt->queryPool, pVnode, (FItem)vmProcessQueryQueue);
|
pVnode->pQueryQ = tQWorkerAllocQueue(&pMgmt->queryPool, pVnode, (FItem)vmProcessQueryQueue);
|
||||||
pVnode->pStreamQ = tQWorkerAllocQueue(&pMgmt->streamPool, pVnode, (FItem)vmProcessStreamQueue);
|
pVnode->pStreamQ = tQWorkerAllocQueue(&pMgmt->streamPool, pVnode, (FItem)vmProcessStreamQueue);
|
||||||
pVnode->pFetchQ = tWWorkerAllocQueue(&pMgmt->fetchPool, pVnode, (FItems)vmProcessFetchQueue);
|
pVnode->pFetchQ = tWWorkerAllocQueue(&pMgmt->fetchPool, pVnode, (FItems)vmProcessFetchQueue);
|
||||||
|
|
||||||
if (pVnode->pWriteQ == NULL || pVnode->pSyncQ == NULL || pVnode->pApplyQ == NULL || pVnode->pQueryQ == NULL ||
|
if (pVnode->pWriteW.queue == NULL || pVnode->pSyncW.queue == NULL || pVnode->pSyncCtrlW.queue == NULL ||
|
||||||
pVnode->pStreamQ == NULL || pVnode->pFetchQ == NULL) {
|
pVnode->pApplyW.queue == NULL || pVnode->pQueryQ == NULL || pVnode->pStreamQ == NULL || pVnode->pFetchQ == NULL) {
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
dDebug("vgId:%d, write-queue:%p is alloced", pVnode->vgId, pVnode->pWriteQ);
|
dInfo("vgId:%d, write-queue:%p is alloced, thread:%08" PRId64, pVnode->vgId, pVnode->pWriteW.queue,
|
||||||
dDebug("vgId:%d, sync-queue:%p is alloced", pVnode->vgId, pVnode->pSyncQ);
|
pVnode->pWriteW.queue->threadId);
|
||||||
dDebug("vgId:%d, apply-queue:%p is alloced", pVnode->vgId, pVnode->pApplyQ);
|
dInfo("vgId:%d, sync-queue:%p is alloced, thread:%08" PRId64, pVnode->vgId, pVnode->pSyncW.queue,
|
||||||
dDebug("vgId:%d, query-queue:%p is alloced", pVnode->vgId, pVnode->pQueryQ);
|
pVnode->pSyncW.queue->threadId);
|
||||||
dDebug("vgId:%d, stream-queue:%p is alloced", pVnode->vgId, pVnode->pStreamQ);
|
dInfo("vgId:%d, sync-ctrl-queue:%p is alloced, thread:%08" PRId64, pVnode->vgId, pVnode->pSyncCtrlW.queue,
|
||||||
dDebug("vgId:%d, fetch-queue:%p is alloced", pVnode->vgId, pVnode->pFetchQ);
|
pVnode->pSyncCtrlW.queue->threadId);
|
||||||
|
dInfo("vgId:%d, apply-queue:%p is alloced, thread:%08" PRId64, pVnode->vgId, pVnode->pApplyW.queue,
|
||||||
|
pVnode->pApplyW.queue->threadId);
|
||||||
|
dInfo("vgId:%d, query-queue:%p is alloced", pVnode->vgId, pVnode->pQueryQ);
|
||||||
|
dInfo("vgId:%d, fetch-queue:%p is alloced, thread:%08" PRId64, pVnode->vgId, pVnode->pFetchQ,
|
||||||
|
pVnode->pFetchQ->threadId);
|
||||||
|
dInfo("vgId:%d, stream-queue:%p is alloced", pVnode->vgId, pVnode->pStreamQ);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void vmFreeQueue(SVnodeMgmt *pMgmt, SVnodeObj *pVnode) {
|
void vmFreeQueue(SVnodeMgmt *pMgmt, SVnodeObj *pVnode) {
|
||||||
tWWorkerFreeQueue(&pMgmt->writePool, pVnode->pWriteQ);
|
|
||||||
tWWorkerFreeQueue(&pMgmt->applyPool, pVnode->pApplyQ);
|
|
||||||
tWWorkerFreeQueue(&pMgmt->syncPool, pVnode->pSyncQ);
|
|
||||||
tWWorkerFreeQueue(&pMgmt->syncCtrlPool, pVnode->pSyncCtrlQ);
|
|
||||||
tQWorkerFreeQueue(&pMgmt->queryPool, pVnode->pQueryQ);
|
tQWorkerFreeQueue(&pMgmt->queryPool, pVnode->pQueryQ);
|
||||||
tQWorkerFreeQueue(&pMgmt->streamPool, pVnode->pStreamQ);
|
tQWorkerFreeQueue(&pMgmt->streamPool, pVnode->pStreamQ);
|
||||||
tWWorkerFreeQueue(&pMgmt->fetchPool, pVnode->pFetchQ);
|
tWWorkerFreeQueue(&pMgmt->fetchPool, pVnode->pFetchQ);
|
||||||
pVnode->pWriteQ = NULL;
|
|
||||||
pVnode->pSyncQ = NULL;
|
|
||||||
pVnode->pApplyQ = NULL;
|
|
||||||
pVnode->pQueryQ = NULL;
|
pVnode->pQueryQ = NULL;
|
||||||
pVnode->pStreamQ = NULL;
|
pVnode->pStreamQ = NULL;
|
||||||
pVnode->pFetchQ = NULL;
|
pVnode->pFetchQ = NULL;
|
||||||
|
@ -357,26 +356,6 @@ int32_t vmStartWorker(SVnodeMgmt *pMgmt) {
|
||||||
pFPool->max = tsNumOfVnodeFetchThreads;
|
pFPool->max = tsNumOfVnodeFetchThreads;
|
||||||
if (tWWorkerInit(pFPool) != 0) return -1;
|
if (tWWorkerInit(pFPool) != 0) return -1;
|
||||||
|
|
||||||
SWWorkerPool *pWPool = &pMgmt->writePool;
|
|
||||||
pWPool->name = "vnode-write";
|
|
||||||
pWPool->max = tsNumOfVnodeWriteThreads;
|
|
||||||
if (tWWorkerInit(pWPool) != 0) return -1;
|
|
||||||
|
|
||||||
SWWorkerPool *pAPool = &pMgmt->applyPool;
|
|
||||||
pAPool->name = "vnode-apply";
|
|
||||||
pAPool->max = tsNumOfVnodeWriteThreads;
|
|
||||||
if (tWWorkerInit(pAPool) != 0) return -1;
|
|
||||||
|
|
||||||
SWWorkerPool *pSPool = &pMgmt->syncPool;
|
|
||||||
pSPool->name = "vnode-sync";
|
|
||||||
pSPool->max = tsNumOfVnodeSyncThreads;
|
|
||||||
if (tWWorkerInit(pSPool) != 0) return -1;
|
|
||||||
|
|
||||||
SWWorkerPool *pSCPool = &pMgmt->syncCtrlPool;
|
|
||||||
pSCPool->name = "vnode-sync-ctrl";
|
|
||||||
pSCPool->max = tsNumOfVnodeSyncThreads;
|
|
||||||
if (tWWorkerInit(pSCPool) != 0) return -1;
|
|
||||||
|
|
||||||
SSingleWorkerCfg mgmtCfg = {
|
SSingleWorkerCfg mgmtCfg = {
|
||||||
.min = 1,
|
.min = 1,
|
||||||
.max = 1,
|
.max = 1,
|
||||||
|
@ -391,10 +370,6 @@ int32_t vmStartWorker(SVnodeMgmt *pMgmt) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void vmStopWorker(SVnodeMgmt *pMgmt) {
|
void vmStopWorker(SVnodeMgmt *pMgmt) {
|
||||||
tWWorkerCleanup(&pMgmt->writePool);
|
|
||||||
tWWorkerCleanup(&pMgmt->applyPool);
|
|
||||||
tWWorkerCleanup(&pMgmt->syncPool);
|
|
||||||
tWWorkerCleanup(&pMgmt->syncCtrlPool);
|
|
||||||
tQWorkerCleanup(&pMgmt->queryPool);
|
tQWorkerCleanup(&pMgmt->queryPool);
|
||||||
tQWorkerCleanup(&pMgmt->streamPool);
|
tQWorkerCleanup(&pMgmt->streamPool);
|
||||||
tWWorkerCleanup(&pMgmt->fetchPool);
|
tWWorkerCleanup(&pMgmt->fetchPool);
|
||||||
|
|
|
@ -71,17 +71,17 @@ static bool dmCheckDiskSpace() {
|
||||||
bool ret = true;
|
bool ret = true;
|
||||||
if (!osDataSpaceAvailable()) {
|
if (!osDataSpaceAvailable()) {
|
||||||
dError("data disk space unavailable, i.e. %s", tsDataDir);
|
dError("data disk space unavailable, i.e. %s", tsDataDir);
|
||||||
terrno = TSDB_CODE_VND_NO_DISKSPACE;
|
terrno = TSDB_CODE_NO_DISKSPACE;
|
||||||
ret = false;
|
ret = false;
|
||||||
}
|
}
|
||||||
if (!osLogSpaceAvailable()) {
|
if (!osLogSpaceAvailable()) {
|
||||||
dError("log disk space unavailable, i.e. %s", tsLogDir);
|
dError("log disk space unavailable, i.e. %s", tsLogDir);
|
||||||
terrno = TSDB_CODE_VND_NO_DISKSPACE;
|
terrno = TSDB_CODE_NO_DISKSPACE;
|
||||||
ret = false;
|
ret = false;
|
||||||
}
|
}
|
||||||
if (!osTempSpaceAvailable()) {
|
if (!osTempSpaceAvailable()) {
|
||||||
dError("temp disk space unavailable, i.e. %s", tsTempDir);
|
dError("temp disk space unavailable, i.e. %s", tsTempDir);
|
||||||
terrno = TSDB_CODE_VND_NO_DISKSPACE;
|
terrno = TSDB_CODE_NO_DISKSPACE;
|
||||||
ret = false;
|
ret = false;
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -105,6 +105,7 @@ static void dmProcessRpcMsg(SDnode *pDnode, SRpcMsg *pRpc, SEpSet *pEpSet) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsReq(pRpc) && pRpc->pCont == NULL) {
|
if (IsReq(pRpc) && pRpc->pCont == NULL) {
|
||||||
|
dGError("msg:%p, type:%s pCont is NULL", pRpc, TMSG_INFO(pRpc->msgType));
|
||||||
terrno = TSDB_CODE_INVALID_MSG_LEN;
|
terrno = TSDB_CODE_INVALID_MSG_LEN;
|
||||||
goto _OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
@ -133,6 +134,7 @@ static void dmProcessRpcMsg(SDnode *pDnode, SRpcMsg *pRpc, SEpSet *pEpSet) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
dGError("msg:%p, type:%s contLen is 0", pRpc, TMSG_INFO(pRpc->msgType));
|
||||||
terrno = TSDB_CODE_INVALID_MSG_LEN;
|
terrno = TSDB_CODE_INVALID_MSG_LEN;
|
||||||
goto _OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
@ -155,7 +157,11 @@ static void dmProcessRpcMsg(SDnode *pDnode, SRpcMsg *pRpc, SEpSet *pEpSet) {
|
||||||
_OVER:
|
_OVER:
|
||||||
if (code != 0) {
|
if (code != 0) {
|
||||||
if (terrno != 0) code = terrno;
|
if (terrno != 0) code = terrno;
|
||||||
dGTrace("msg:%p, failed to process since %s", pMsg, terrstr());
|
if (pMsg) {
|
||||||
|
dGTrace("msg:%p, failed to process %s since %s", pMsg, TMSG_INFO(pMsg->msgType), terrstr());
|
||||||
|
} else {
|
||||||
|
dGTrace("msg:%p, failed to process empty msg since %s", pMsg, terrstr());
|
||||||
|
}
|
||||||
|
|
||||||
if (IsReq(pRpc)) {
|
if (IsReq(pRpc)) {
|
||||||
SRpcMsg rsp = {.code = code, .info = pRpc->info};
|
SRpcMsg rsp = {.code = code, .info = pRpc->info};
|
||||||
|
@ -252,6 +258,8 @@ int32_t dmInitClient(SDnode *pDnode) {
|
||||||
rpcInit.parent = pDnode;
|
rpcInit.parent = pDnode;
|
||||||
rpcInit.rfp = rpcRfp;
|
rpcInit.rfp = rpcRfp;
|
||||||
rpcInit.compressSize = tsCompressMsgSize;
|
rpcInit.compressSize = tsCompressMsgSize;
|
||||||
|
rpcInit.retryLimit = tsRpcRetryLimit;
|
||||||
|
rpcInit.retryInterval = tsRpcRetryInterval;
|
||||||
|
|
||||||
pTrans->clientRpc = rpcOpen(&rpcInit);
|
pTrans->clientRpc = rpcOpen(&rpcInit);
|
||||||
if (pTrans->clientRpc == NULL) {
|
if (pTrans->clientRpc == NULL) {
|
||||||
|
|
|
@ -44,6 +44,7 @@ SSdbRaw *mndConsumerActionEncode(SMqConsumerObj *pConsumer);
|
||||||
SSdbRow *mndConsumerActionDecode(SSdbRaw *pRaw);
|
SSdbRow *mndConsumerActionDecode(SSdbRaw *pRaw);
|
||||||
|
|
||||||
int32_t mndSetConsumerCommitLogs(SMnode *pMnode, STrans *pTrans, SMqConsumerObj *pConsumer);
|
int32_t mndSetConsumerCommitLogs(SMnode *pMnode, STrans *pTrans, SMqConsumerObj *pConsumer);
|
||||||
|
int32_t mndSetConsumerDropLogs(SMnode *pMnode, STrans *pTrans, SMqConsumerObj *pConsumer);
|
||||||
|
|
||||||
bool mndRebTryStart();
|
bool mndRebTryStart();
|
||||||
void mndRebEnd();
|
void mndRebEnd();
|
||||||
|
|
|
@ -321,6 +321,7 @@ typedef struct {
|
||||||
int32_t vgVersion;
|
int32_t vgVersion;
|
||||||
SDbCfg cfg;
|
SDbCfg cfg;
|
||||||
SRWLatch lock;
|
SRWLatch lock;
|
||||||
|
int64_t stateTs;
|
||||||
} SDbObj;
|
} SDbObj;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
|
@ -32,7 +32,8 @@
|
||||||
#define MND_CONSUMER_VER_NUMBER 1
|
#define MND_CONSUMER_VER_NUMBER 1
|
||||||
#define MND_CONSUMER_RESERVE_SIZE 64
|
#define MND_CONSUMER_RESERVE_SIZE 64
|
||||||
|
|
||||||
#define MND_CONSUMER_LOST_HB_CNT 3
|
#define MND_CONSUMER_LOST_HB_CNT 3
|
||||||
|
#define MND_CONSUMER_LOST_CLEAR_THRESHOLD 43200
|
||||||
|
|
||||||
static int8_t mqRebInExecCnt = 0;
|
static int8_t mqRebInExecCnt = 0;
|
||||||
|
|
||||||
|
@ -50,6 +51,7 @@ static int32_t mndProcessAskEpReq(SRpcMsg *pMsg);
|
||||||
static int32_t mndProcessMqHbReq(SRpcMsg *pMsg);
|
static int32_t mndProcessMqHbReq(SRpcMsg *pMsg);
|
||||||
static int32_t mndProcessMqTimerMsg(SRpcMsg *pMsg);
|
static int32_t mndProcessMqTimerMsg(SRpcMsg *pMsg);
|
||||||
static int32_t mndProcessConsumerLostMsg(SRpcMsg *pMsg);
|
static int32_t mndProcessConsumerLostMsg(SRpcMsg *pMsg);
|
||||||
|
static int32_t mndProcessConsumerClearMsg(SRpcMsg *pMsg);
|
||||||
static int32_t mndProcessConsumerRecoverMsg(SRpcMsg *pMsg);
|
static int32_t mndProcessConsumerRecoverMsg(SRpcMsg *pMsg);
|
||||||
|
|
||||||
int32_t mndInitConsumer(SMnode *pMnode) {
|
int32_t mndInitConsumer(SMnode *pMnode) {
|
||||||
|
@ -69,6 +71,7 @@ int32_t mndInitConsumer(SMnode *pMnode) {
|
||||||
mndSetMsgHandle(pMnode, TDMT_MND_TMQ_TIMER, mndProcessMqTimerMsg);
|
mndSetMsgHandle(pMnode, TDMT_MND_TMQ_TIMER, mndProcessMqTimerMsg);
|
||||||
mndSetMsgHandle(pMnode, TDMT_MND_TMQ_CONSUMER_LOST, mndProcessConsumerLostMsg);
|
mndSetMsgHandle(pMnode, TDMT_MND_TMQ_CONSUMER_LOST, mndProcessConsumerLostMsg);
|
||||||
mndSetMsgHandle(pMnode, TDMT_MND_TMQ_CONSUMER_RECOVER, mndProcessConsumerRecoverMsg);
|
mndSetMsgHandle(pMnode, TDMT_MND_TMQ_CONSUMER_RECOVER, mndProcessConsumerRecoverMsg);
|
||||||
|
mndSetMsgHandle(pMnode, TDMT_MND_TMQ_LOST_CONSUMER_CLEAR, mndProcessConsumerClearMsg);
|
||||||
|
|
||||||
mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_CONSUMERS, mndRetrieveConsumer);
|
mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_CONSUMERS, mndRetrieveConsumer);
|
||||||
mndAddShowFreeIterHandle(pMnode, TSDB_MGMT_TABLE_CONSUMERS, mndCancelGetNextConsumer);
|
mndAddShowFreeIterHandle(pMnode, TSDB_MGMT_TABLE_CONSUMERS, mndCancelGetNextConsumer);
|
||||||
|
@ -162,6 +165,43 @@ FAIL:
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int32_t mndProcessConsumerClearMsg(SRpcMsg *pMsg) {
|
||||||
|
SMnode *pMnode = pMsg->info.node;
|
||||||
|
SMqConsumerClearMsg *pClearMsg = pMsg->pCont;
|
||||||
|
SMqConsumerObj *pConsumer = mndAcquireConsumer(pMnode, pClearMsg->consumerId);
|
||||||
|
if (pConsumer == NULL) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
mInfo("receive consumer clear msg, consumer id %" PRId64 ", status %s", pClearMsg->consumerId,
|
||||||
|
mndConsumerStatusName(pConsumer->status));
|
||||||
|
|
||||||
|
if (pConsumer->status != MQ_CONSUMER_STATUS__LOST_REBD) {
|
||||||
|
mndReleaseConsumer(pMnode, pConsumer);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
SMqConsumerObj *pConsumerNew = tNewSMqConsumerObj(pConsumer->consumerId, pConsumer->cgroup);
|
||||||
|
pConsumerNew->updateType = CONSUMER_UPDATE__LOST;
|
||||||
|
|
||||||
|
mndReleaseConsumer(pMnode, pConsumer);
|
||||||
|
|
||||||
|
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pMsg, "clear-csm");
|
||||||
|
if (pTrans == NULL) goto FAIL;
|
||||||
|
if (mndSetConsumerDropLogs(pMnode, pTrans, pConsumerNew) != 0) goto FAIL;
|
||||||
|
if (mndTransPrepare(pMnode, pTrans) != 0) goto FAIL;
|
||||||
|
|
||||||
|
tDeleteSMqConsumerObj(pConsumerNew);
|
||||||
|
taosMemoryFree(pConsumerNew);
|
||||||
|
mndTransDrop(pTrans);
|
||||||
|
return 0;
|
||||||
|
FAIL:
|
||||||
|
tDeleteSMqConsumerObj(pConsumerNew);
|
||||||
|
taosMemoryFree(pConsumerNew);
|
||||||
|
mndTransDrop(pTrans);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
static SMqRebInfo *mndGetOrCreateRebSub(SHashObj *pHash, const char *key) {
|
static SMqRebInfo *mndGetOrCreateRebSub(SHashObj *pHash, const char *key) {
|
||||||
SMqRebInfo *pRebInfo = taosHashGet(pHash, key, strlen(key) + 1);
|
SMqRebInfo *pRebInfo = taosHashGet(pHash, key, strlen(key) + 1);
|
||||||
if (pRebInfo == NULL) {
|
if (pRebInfo == NULL) {
|
||||||
|
@ -206,15 +246,28 @@ static int32_t mndProcessMqTimerMsg(SRpcMsg *pMsg) {
|
||||||
SMqConsumerLostMsg *pLostMsg = rpcMallocCont(sizeof(SMqConsumerLostMsg));
|
SMqConsumerLostMsg *pLostMsg = rpcMallocCont(sizeof(SMqConsumerLostMsg));
|
||||||
|
|
||||||
pLostMsg->consumerId = pConsumer->consumerId;
|
pLostMsg->consumerId = pConsumer->consumerId;
|
||||||
SRpcMsg pRpcMsg = {
|
SRpcMsg rpcMsg = {
|
||||||
.msgType = TDMT_MND_TMQ_CONSUMER_LOST,
|
.msgType = TDMT_MND_TMQ_CONSUMER_LOST,
|
||||||
.pCont = pLostMsg,
|
.pCont = pLostMsg,
|
||||||
.contLen = sizeof(SMqConsumerLostMsg),
|
.contLen = sizeof(SMqConsumerLostMsg),
|
||||||
};
|
};
|
||||||
tmsgPutToQueue(&pMnode->msgCb, WRITE_QUEUE, &pRpcMsg);
|
tmsgPutToQueue(&pMnode->msgCb, WRITE_QUEUE, &rpcMsg);
|
||||||
}
|
}
|
||||||
if (status == MQ_CONSUMER_STATUS__LOST_REBD || status == MQ_CONSUMER_STATUS__READY) {
|
|
||||||
|
if (status == MQ_CONSUMER_STATUS__READY) {
|
||||||
// do nothing
|
// do nothing
|
||||||
|
} else if (status == MQ_CONSUMER_STATUS__LOST_REBD) {
|
||||||
|
if (hbStatus > MND_CONSUMER_LOST_CLEAR_THRESHOLD) {
|
||||||
|
SMqConsumerClearMsg *pClearMsg = rpcMallocCont(sizeof(SMqConsumerClearMsg));
|
||||||
|
|
||||||
|
pClearMsg->consumerId = pConsumer->consumerId;
|
||||||
|
SRpcMsg rpcMsg = {
|
||||||
|
.msgType = TDMT_MND_TMQ_LOST_CONSUMER_CLEAR,
|
||||||
|
.pCont = pClearMsg,
|
||||||
|
.contLen = sizeof(SMqConsumerClearMsg),
|
||||||
|
};
|
||||||
|
tmsgPutToQueue(&pMnode->msgCb, WRITE_QUEUE, &rpcMsg);
|
||||||
|
}
|
||||||
} else if (status == MQ_CONSUMER_STATUS__LOST) {
|
} else if (status == MQ_CONSUMER_STATUS__LOST) {
|
||||||
taosRLockLatch(&pConsumer->lock);
|
taosRLockLatch(&pConsumer->lock);
|
||||||
int32_t topicNum = taosArrayGetSize(pConsumer->currentTopics);
|
int32_t topicNum = taosArrayGetSize(pConsumer->currentTopics);
|
||||||
|
@ -444,6 +497,14 @@ FAIL:
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32_t mndSetConsumerDropLogs(SMnode *pMnode, STrans *pTrans, SMqConsumerObj *pConsumer) {
|
||||||
|
SSdbRaw *pCommitRaw = mndConsumerActionEncode(pConsumer);
|
||||||
|
if (pCommitRaw == NULL) return -1;
|
||||||
|
if (mndTransAppendCommitlog(pTrans, pCommitRaw) != 0) return -1;
|
||||||
|
if (sdbSetRawStatus(pCommitRaw, SDB_STATUS_DROPPED) != 0) return -1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int32_t mndSetConsumerCommitLogs(SMnode *pMnode, STrans *pTrans, SMqConsumerObj *pConsumer) {
|
int32_t mndSetConsumerCommitLogs(SMnode *pMnode, STrans *pTrans, SMqConsumerObj *pConsumer) {
|
||||||
SSdbRaw *pCommitRaw = mndConsumerActionEncode(pConsumer);
|
SSdbRaw *pCommitRaw = mndConsumerActionEncode(pConsumer);
|
||||||
if (pCommitRaw == NULL) return -1;
|
if (pCommitRaw == NULL) return -1;
|
||||||
|
|
|
@ -285,8 +285,17 @@ static inline int32_t mndGetGlobalVgroupVersion(SMnode *pMnode) {
|
||||||
SDbObj *mndAcquireDb(SMnode *pMnode, const char *db) {
|
SDbObj *mndAcquireDb(SMnode *pMnode, const char *db) {
|
||||||
SSdb *pSdb = pMnode->pSdb;
|
SSdb *pSdb = pMnode->pSdb;
|
||||||
SDbObj *pDb = sdbAcquire(pSdb, SDB_DB, db);
|
SDbObj *pDb = sdbAcquire(pSdb, SDB_DB, db);
|
||||||
if (pDb == NULL && terrno == TSDB_CODE_SDB_OBJ_NOT_THERE) {
|
if (pDb == NULL) {
|
||||||
terrno = TSDB_CODE_MND_DB_NOT_EXIST;
|
if (terrno == TSDB_CODE_SDB_OBJ_NOT_THERE) {
|
||||||
|
terrno = TSDB_CODE_MND_DB_NOT_EXIST;
|
||||||
|
} else if (terrno == TSDB_CODE_SDB_OBJ_CREATING) {
|
||||||
|
terrno = TSDB_CODE_MND_DB_IN_CREATING;
|
||||||
|
} else if (terrno == TSDB_CODE_SDB_OBJ_DROPPING) {
|
||||||
|
terrno = TSDB_CODE_MND_DB_IN_DROPPING;
|
||||||
|
} else {
|
||||||
|
terrno = TSDB_CODE_APP_ERROR;
|
||||||
|
mFatal("db:%s, failed to acquire db since %s", db, terrstr());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return pDb;
|
return pDb;
|
||||||
}
|
}
|
||||||
|
@ -594,16 +603,22 @@ static int32_t mndProcessCreateDbReq(SRpcMsg *pReq) {
|
||||||
terrno = TSDB_CODE_MND_DB_ALREADY_EXIST;
|
terrno = TSDB_CODE_MND_DB_ALREADY_EXIST;
|
||||||
goto _OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
} else if (terrno == TSDB_CODE_SDB_OBJ_CREATING) {
|
} else {
|
||||||
if (mndSetRpcInfoForDbTrans(pMnode, pReq, MND_OPER_CREATE_DB, createReq.db) == 0) {
|
if (terrno == TSDB_CODE_MND_DB_IN_CREATING) {
|
||||||
mInfo("db:%s, is creating and response after trans finished", createReq.db);
|
if (mndSetRpcInfoForDbTrans(pMnode, pReq, MND_OPER_CREATE_DB, createReq.db) == 0) {
|
||||||
code = TSDB_CODE_ACTION_IN_PROGRESS;
|
mInfo("db:%s, is creating and createdb response after trans finished", createReq.db);
|
||||||
|
code = TSDB_CODE_ACTION_IN_PROGRESS;
|
||||||
|
goto _OVER;
|
||||||
|
} else {
|
||||||
|
goto _OVER;
|
||||||
|
}
|
||||||
|
} else if (terrno == TSDB_CODE_MND_DB_IN_DROPPING) {
|
||||||
goto _OVER;
|
goto _OVER;
|
||||||
} else {
|
} else if (terrno == TSDB_CODE_MND_DB_NOT_EXIST) {
|
||||||
|
// continue
|
||||||
|
} else { // TSDB_CODE_APP_ERROR
|
||||||
goto _OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
} else if (terrno != TSDB_CODE_MND_DB_NOT_EXIST) {
|
|
||||||
goto _OVER;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pUser = mndAcquireUser(pMnode, pReq->info.conn.user);
|
pUser = mndAcquireUser(pMnode, pReq->info.conn.user);
|
||||||
|
@ -786,7 +801,6 @@ static int32_t mndProcessAlterDbReq(SRpcMsg *pReq) {
|
||||||
|
|
||||||
pDb = mndAcquireDb(pMnode, alterReq.db);
|
pDb = mndAcquireDb(pMnode, alterReq.db);
|
||||||
if (pDb == NULL) {
|
if (pDb == NULL) {
|
||||||
terrno = TSDB_CODE_MND_DB_NOT_EXIST;
|
|
||||||
goto _OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -836,7 +850,6 @@ static int32_t mndProcessGetDbCfgReq(SRpcMsg *pReq) {
|
||||||
|
|
||||||
pDb = mndAcquireDb(pMnode, cfgReq.db);
|
pDb = mndAcquireDb(pMnode, cfgReq.db);
|
||||||
if (pDb == NULL) {
|
if (pDb == NULL) {
|
||||||
terrno = TSDB_CODE_MND_DB_NOT_EXIST;
|
|
||||||
goto _OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1066,11 +1079,8 @@ static int32_t mndProcessDropDbReq(SRpcMsg *pReq) {
|
||||||
if (pDb == NULL) {
|
if (pDb == NULL) {
|
||||||
if (dropReq.ignoreNotExists) {
|
if (dropReq.ignoreNotExists) {
|
||||||
code = mndBuildDropDbRsp(pDb, &pReq->info.rspLen, &pReq->info.rsp, true);
|
code = mndBuildDropDbRsp(pDb, &pReq->info.rspLen, &pReq->info.rsp, true);
|
||||||
goto _OVER;
|
|
||||||
} else {
|
|
||||||
terrno = TSDB_CODE_MND_DB_NOT_EXIST;
|
|
||||||
goto _OVER;
|
|
||||||
}
|
}
|
||||||
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mndCheckDbPrivilege(pMnode, pReq->info.conn.user, MND_OPER_DROP_DB, pDb) != 0) {
|
if (mndCheckDbPrivilege(pMnode, pReq->info.conn.user, MND_OPER_DROP_DB, pDb) != 0) {
|
||||||
|
@ -1165,13 +1175,14 @@ int32_t mndExtractDbInfo(SMnode *pMnode, SDbObj *pDb, SUseDbRsp *pRsp, const SUs
|
||||||
|
|
||||||
int32_t numOfTable = mndGetDBTableNum(pDb, pMnode);
|
int32_t numOfTable = mndGetDBTableNum(pDb, pMnode);
|
||||||
|
|
||||||
if (pReq == NULL || pReq->vgVersion < pDb->vgVersion || pReq->dbId != pDb->uid || numOfTable != pReq->numOfTable) {
|
if (pReq == NULL || pReq->vgVersion < pDb->vgVersion || pReq->dbId != pDb->uid || numOfTable != pReq->numOfTable || pReq->stateTs < pDb->stateTs) {
|
||||||
mndBuildDBVgroupInfo(pDb, pMnode, pRsp->pVgroupInfos);
|
mndBuildDBVgroupInfo(pDb, pMnode, pRsp->pVgroupInfos);
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(pRsp->db, pDb->name, TSDB_DB_FNAME_LEN);
|
memcpy(pRsp->db, pDb->name, TSDB_DB_FNAME_LEN);
|
||||||
pRsp->uid = pDb->uid;
|
pRsp->uid = pDb->uid;
|
||||||
pRsp->vgVersion = pDb->vgVersion;
|
pRsp->vgVersion = pDb->vgVersion;
|
||||||
|
pRsp->stateTs = pDb->stateTs;
|
||||||
pRsp->vgNum = taosArrayGetSize(pRsp->pVgroupInfos);
|
pRsp->vgNum = taosArrayGetSize(pRsp->pVgroupInfos);
|
||||||
pRsp->hashMethod = pDb->cfg.hashMethod;
|
pRsp->hashMethod = pDb->cfg.hashMethod;
|
||||||
pRsp->hashPrefix = pDb->cfg.hashPrefix;
|
pRsp->hashPrefix = pDb->cfg.hashPrefix;
|
||||||
|
@ -1197,10 +1208,7 @@ static int32_t mndProcessUseDbReq(SRpcMsg *pReq) {
|
||||||
int32_t vgVersion = mndGetGlobalVgroupVersion(pMnode);
|
int32_t vgVersion = mndGetGlobalVgroupVersion(pMnode);
|
||||||
if (usedbReq.vgVersion < vgVersion) {
|
if (usedbReq.vgVersion < vgVersion) {
|
||||||
usedbRsp.pVgroupInfos = taosArrayInit(10, sizeof(SVgroupInfo));
|
usedbRsp.pVgroupInfos = taosArrayInit(10, sizeof(SVgroupInfo));
|
||||||
if (usedbRsp.pVgroupInfos == NULL) {
|
if (usedbRsp.pVgroupInfos == NULL) goto _OVER;
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
|
||||||
goto _OVER;
|
|
||||||
}
|
|
||||||
|
|
||||||
mndBuildDBVgroupInfo(NULL, pMnode, usedbRsp.pVgroupInfos);
|
mndBuildDBVgroupInfo(NULL, pMnode, usedbRsp.pVgroupInfos);
|
||||||
usedbRsp.vgVersion = vgVersion++;
|
usedbRsp.vgVersion = vgVersion++;
|
||||||
|
@ -1209,16 +1217,21 @@ static int32_t mndProcessUseDbReq(SRpcMsg *pReq) {
|
||||||
}
|
}
|
||||||
usedbRsp.vgNum = taosArrayGetSize(usedbRsp.pVgroupInfos);
|
usedbRsp.vgNum = taosArrayGetSize(usedbRsp.pVgroupInfos);
|
||||||
code = 0;
|
code = 0;
|
||||||
|
|
||||||
// no jump, need to construct rsp
|
|
||||||
} else {
|
} else {
|
||||||
pDb = mndAcquireDb(pMnode, usedbReq.db);
|
pDb = mndAcquireDb(pMnode, usedbReq.db);
|
||||||
if (pDb == NULL) {
|
if (pDb == NULL) {
|
||||||
terrno = TSDB_CODE_MND_DB_NOT_EXIST;
|
|
||||||
|
|
||||||
memcpy(usedbRsp.db, usedbReq.db, TSDB_DB_FNAME_LEN);
|
memcpy(usedbRsp.db, usedbReq.db, TSDB_DB_FNAME_LEN);
|
||||||
usedbRsp.uid = usedbReq.dbId;
|
usedbRsp.uid = usedbReq.dbId;
|
||||||
usedbRsp.vgVersion = usedbReq.vgVersion;
|
usedbRsp.vgVersion = usedbReq.vgVersion;
|
||||||
|
usedbRsp.errCode = terrno;
|
||||||
|
|
||||||
|
if (terrno == TSDB_CODE_MND_DB_IN_CREATING) {
|
||||||
|
if (mndSetRpcInfoForDbTrans(pMnode, pReq, MND_OPER_CREATE_DB, usedbReq.db) == 0) {
|
||||||
|
mInfo("db:%s, is creating and usedb response after trans finished", usedbReq.db);
|
||||||
|
code = TSDB_CODE_ACTION_IN_PROGRESS;
|
||||||
|
goto _OVER;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
mError("db:%s, failed to process use db req since %s", usedbReq.db, terrstr());
|
mError("db:%s, failed to process use db req since %s", usedbReq.db, terrstr());
|
||||||
} else {
|
} else {
|
||||||
|
@ -1230,6 +1243,8 @@ static int32_t mndProcessUseDbReq(SRpcMsg *pReq) {
|
||||||
goto _OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mDebug("db:%s, process usedb req vgVersion:%d stateTs:%" PRId64 ", rsp vgVersion:%d stateTs:%" PRId64,
|
||||||
|
usedbReq.db, usedbReq.vgVersion, usedbReq.stateTs, usedbRsp.vgVersion, usedbRsp.stateTs);
|
||||||
code = 0;
|
code = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1248,7 +1263,7 @@ static int32_t mndProcessUseDbReq(SRpcMsg *pReq) {
|
||||||
pReq->info.rspLen = contLen;
|
pReq->info.rspLen = contLen;
|
||||||
|
|
||||||
_OVER:
|
_OVER:
|
||||||
if (code != 0) {
|
if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) {
|
||||||
mError("db:%s, failed to process use db req since %s", usedbReq.db, terrstr());
|
mError("db:%s, failed to process use db req since %s", usedbReq.db, terrstr());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1268,12 +1283,31 @@ int32_t mndValidateDbInfo(SMnode *pMnode, SDbVgVersion *pDbs, int32_t numOfDbs,
|
||||||
|
|
||||||
for (int32_t i = 0; i < numOfDbs; ++i) {
|
for (int32_t i = 0; i < numOfDbs; ++i) {
|
||||||
SDbVgVersion *pDbVgVersion = &pDbs[i];
|
SDbVgVersion *pDbVgVersion = &pDbs[i];
|
||||||
pDbVgVersion->dbId = htobe64(pDbVgVersion->dbId);
|
pDbVgVersion->dbId = be64toh(pDbVgVersion->dbId);
|
||||||
pDbVgVersion->vgVersion = htonl(pDbVgVersion->vgVersion);
|
pDbVgVersion->vgVersion = htonl(pDbVgVersion->vgVersion);
|
||||||
pDbVgVersion->numOfTable = htonl(pDbVgVersion->numOfTable);
|
pDbVgVersion->numOfTable = htonl(pDbVgVersion->numOfTable);
|
||||||
|
pDbVgVersion->stateTs = be64toh(pDbVgVersion->stateTs);
|
||||||
|
|
||||||
SUseDbRsp usedbRsp = {0};
|
SUseDbRsp usedbRsp = {0};
|
||||||
|
|
||||||
|
if ((0 == strcasecmp(pDbVgVersion->dbFName, TSDB_INFORMATION_SCHEMA_DB) || (0 == strcasecmp(pDbVgVersion->dbFName, TSDB_PERFORMANCE_SCHEMA_DB)))) {
|
||||||
|
memcpy(usedbRsp.db, pDbVgVersion->dbFName, TSDB_DB_FNAME_LEN);
|
||||||
|
int32_t vgVersion = mndGetGlobalVgroupVersion(pMnode);
|
||||||
|
if (pDbVgVersion->vgVersion < vgVersion) {
|
||||||
|
usedbRsp.pVgroupInfos = taosArrayInit(10, sizeof(SVgroupInfo));
|
||||||
|
|
||||||
|
mndBuildDBVgroupInfo(NULL, pMnode, usedbRsp.pVgroupInfos);
|
||||||
|
usedbRsp.vgVersion = vgVersion++;
|
||||||
|
} else {
|
||||||
|
usedbRsp.vgVersion = pDbVgVersion->vgVersion;
|
||||||
|
}
|
||||||
|
usedbRsp.vgNum = taosArrayGetSize(usedbRsp.pVgroupInfos);
|
||||||
|
|
||||||
|
taosArrayPush(batchUseRsp.pArray, &usedbRsp);
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
SDbObj *pDb = mndAcquireDb(pMnode, pDbVgVersion->dbFName);
|
SDbObj *pDb = mndAcquireDb(pMnode, pDbVgVersion->dbFName);
|
||||||
if (pDb == NULL) {
|
if (pDb == NULL) {
|
||||||
mTrace("db:%s, no exist", pDbVgVersion->dbFName);
|
mTrace("db:%s, no exist", pDbVgVersion->dbFName);
|
||||||
|
@ -1286,13 +1320,19 @@ int32_t mndValidateDbInfo(SMnode *pMnode, SDbVgVersion *pDbs, int32_t numOfDbs,
|
||||||
|
|
||||||
int32_t numOfTable = mndGetDBTableNum(pDb, pMnode);
|
int32_t numOfTable = mndGetDBTableNum(pDb, pMnode);
|
||||||
|
|
||||||
if (pDbVgVersion->vgVersion >= pDb->vgVersion && numOfTable == pDbVgVersion->numOfTable) {
|
if (pDbVgVersion->vgVersion >= pDb->vgVersion && numOfTable == pDbVgVersion->numOfTable &&
|
||||||
mInfo("db:%s, version and numOfTable not changed", pDbVgVersion->dbFName);
|
pDbVgVersion->stateTs == pDb->stateTs) {
|
||||||
|
mTrace("db:%s, valid dbinfo, vgVersion:%d stateTs:%" PRId64
|
||||||
|
" numOfTables:%d, not changed vgVersion:%d stateTs:%" PRId64 " numOfTables:%d",
|
||||||
|
pDbVgVersion->dbFName, pDbVgVersion->vgVersion, pDbVgVersion->stateTs, pDbVgVersion->numOfTable,
|
||||||
|
pDb->vgVersion, pDb->stateTs, numOfTable);
|
||||||
mndReleaseDb(pMnode, pDb);
|
mndReleaseDb(pMnode, pDb);
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
mInfo("db:%s, vgroup version changed from %d to %d", pDbVgVersion->dbFName, pDbVgVersion->vgVersion,
|
mInfo("db:%s, valid dbinfo, vgVersion:%d stateTs:%" PRId64
|
||||||
pDb->vgVersion);
|
" numOfTables:%d, changed to vgVersion:%d stateTs:%" PRId64 " numOfTables:%d",
|
||||||
|
pDbVgVersion->dbFName, pDbVgVersion->vgVersion, pDbVgVersion->stateTs, pDbVgVersion->numOfTable,
|
||||||
|
pDb->vgVersion, pDb->stateTs, numOfTable);
|
||||||
}
|
}
|
||||||
|
|
||||||
usedbRsp.pVgroupInfos = taosArrayInit(pDb->cfg.numOfVgroups, sizeof(SVgroupInfo));
|
usedbRsp.pVgroupInfos = taosArrayInit(pDb->cfg.numOfVgroups, sizeof(SVgroupInfo));
|
||||||
|
@ -1306,6 +1346,7 @@ int32_t mndValidateDbInfo(SMnode *pMnode, SDbVgVersion *pDbs, int32_t numOfDbs,
|
||||||
memcpy(usedbRsp.db, pDb->name, TSDB_DB_FNAME_LEN);
|
memcpy(usedbRsp.db, pDb->name, TSDB_DB_FNAME_LEN);
|
||||||
usedbRsp.uid = pDb->uid;
|
usedbRsp.uid = pDb->uid;
|
||||||
usedbRsp.vgVersion = pDb->vgVersion;
|
usedbRsp.vgVersion = pDb->vgVersion;
|
||||||
|
usedbRsp.stateTs = pDb->stateTs;
|
||||||
usedbRsp.vgNum = (int32_t)taosArrayGetSize(usedbRsp.pVgroupInfos);
|
usedbRsp.vgNum = (int32_t)taosArrayGetSize(usedbRsp.pVgroupInfos);
|
||||||
usedbRsp.hashMethod = pDb->cfg.hashMethod;
|
usedbRsp.hashMethod = pDb->cfg.hashMethod;
|
||||||
usedbRsp.hashPrefix = pDb->cfg.hashPrefix;
|
usedbRsp.hashPrefix = pDb->cfg.hashPrefix;
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue