diff --git a/Jenkinsfile2 b/Jenkinsfile2
index d3fc05a1d2..e9372ab686 100644
--- a/Jenkinsfile2
+++ b/Jenkinsfile2
@@ -306,7 +306,7 @@ def pre_test_build_win() {
cd %WIN_CONNECTOR_ROOT%
python.exe -m pip install --upgrade pip
python -m pip uninstall taospy -y
- python -m pip install taospy==2.7.12
+ python -m pip install taospy==2.7.13
python -m pip uninstall taos-ws-py -y
python -m pip install taos-ws-py==0.3.1
xcopy /e/y/i/f %WIN_INTERNAL_ROOT%\\debug\\build\\lib\\taos.dll C:\\Windows\\System32
diff --git a/README-CN.md b/README-CN.md
index 4931c0177e..06ac087859 100644
--- a/README-CN.md
+++ b/README-CN.md
@@ -12,7 +12,7 @@
[](https://travis-ci.org/taosdata/TDengine)
[](https://ci.appveyor.com/project/sangshuduo/tdengine-2n8ge/branch/master)
-[](https://coveralls.io/github/taosdata/TDengine?branch=develop)
+[](https://coveralls.io/github/taosdata/TDengine?branch=3.0)
[](https://bestpractices.coreinfrastructure.org/projects/4201)
简体中文 | [English](README.md) | [TDengine 云服务](https://cloud.taosdata.com/?utm_medium=cn&utm_source=github) | 很多职位正在热招中,请看[这里](https://www.taosdata.com/cn/careers/)
diff --git a/README.md b/README.md
index 31d3a8bf67..e390b5e764 100644
--- a/README.md
+++ b/README.md
@@ -12,7 +12,7 @@
[](https://cloud.drone.io/taosdata/TDengine)
[](https://ci.appveyor.com/project/sangshuduo/tdengine-2n8ge/branch/master)
-[](https://coveralls.io/github/taosdata/TDengine?branch=develop)
+[](https://coveralls.io/github/taosdata/TDengine?branch=3.0)
[](https://bestpractices.coreinfrastructure.org/projects/4201)
[](https://twitter.com/tdenginedb)
diff --git a/cmake/ssl_CMakeLists.txt.in b/cmake/ssl_CMakeLists.txt.in
index fe176498a5..4778ea76e0 100644
--- a/cmake/ssl_CMakeLists.txt.in
+++ b/cmake/ssl_CMakeLists.txt.in
@@ -1,6 +1,6 @@
# openssl
ExternalProject_Add(openssl
- URL https://www.openssl.org/source/openssl-3.1.3.tar.gz
+ URL https://github.com/openssl/openssl/releases/download/openssl-3.1.3/openssl-3.1.3.tar.gz
URL_HASH SHA256=f0316a2ebd89e7f2352976445458689f80302093788c466692fb2a188b2eacf6
DOWNLOAD_NO_PROGRESS 1
DOWNLOAD_DIR "${TD_CONTRIB_DIR}/deps-download"
diff --git a/docs/en/07-develop/03-insert-data/50-opentsdb-json.mdx b/docs/en/07-develop/03-insert-data/50-opentsdb-json.mdx
index a40b5f264d..fc54421daf 100644
--- a/docs/en/07-develop/03-insert-data/50-opentsdb-json.mdx
+++ b/docs/en/07-develop/03-insert-data/50-opentsdb-json.mdx
@@ -101,7 +101,7 @@ Query OK, 2 row(s) in set (0.004076s)
## Query Examples
-If you want query the data of "tags": {"location": "California.LosAngeles", "groupid": 1}, here is the query SQL:
+If you want query the data of "tags": {"location": "California.LosAngeles", "groupid": 1}, here is the query SQL:
```sql
SELECT * FROM `meters_current` WHERE location = "California.LosAngeles" AND groupid = 3;
diff --git a/docs/en/07-develop/04-query-data/index.mdx b/docs/en/07-develop/04-query-data/index.mdx
index e44161d397..8e21fd325c 100644
--- a/docs/en/07-develop/04-query-data/index.mdx
+++ b/docs/en/07-develop/04-query-data/index.mdx
@@ -22,7 +22,7 @@ import CAsync from "./_c_async.mdx";
SQL is used by TDengine as its query language. Application programs can send SQL statements to TDengine through REST API or client libraries. TDengine's CLI `taos` can also be used to execute ad hoc SQL queries. Here is the list of major query functionalities supported by TDengine:
- Query on single column or multiple columns
-- Filter on tags or data columns: >, <, =, <\>, like
+- Filter on tags or data columns: >, <, =, <>, like
- Grouping of results: `Group By` - Sorting of results: `Order By` - Limit the number of results: `Limit/Offset`
- Windowed aggregate queries for time windows (interval), session windows (session), and state windows (state_window)
- Arithmetic on columns of numeric types or aggregate results
@@ -159,7 +159,7 @@ In the section describing [Insert](../insert-data/sql-writing), a database named
:::note
1. With either REST connection or native connection, the above sample code works well.
-2. Please note that `use db` can't be used in case of REST connection because it's stateless. You can specify the database name by either the REST endpoint's parameter or . in the SQL command.
+2. Please note that `use db` can't be used in case of REST connection because it's stateless. You can specify the database name by either the REST endpoint's parameter or <db_name>.<table_name> in the SQL command.
:::
diff --git a/docs/en/07-develop/09-udf.md b/docs/en/07-develop/09-udf.md
index 9471efc761..f99e98929d 100644
--- a/docs/en/07-develop/09-udf.md
+++ b/docs/en/07-develop/09-udf.md
@@ -104,7 +104,7 @@ Replace `aggfn` with the name of your function.
### UDF Interface Definition in C
-There are strict naming conventions for interface functions. The names of the start, finish, init, and destroy interfaces must be _start, _finish, _init, and _destroy, respectively. Replace `scalarfn`, `aggfn`, and `udf` with the name of your user-defined function.
+There are strict naming conventions for interface functions. The names of the start, finish, init, and destroy interfaces must be <udf-name>_start, <udf-name>_finish, <udf-name>_init, and <udf-name>_destroy, respectively. Replace `scalarfn`, `aggfn`, and `udf` with the name of your user-defined function.
Interface functions return a value that indicates whether the operation was successful. If an operation fails, the interface function returns an error code. Otherwise, it returns TSDB_CODE_SUCCESS. The error codes are defined in `taoserror.h` and in the common API error codes in `taos.h`. For example, TSDB_CODE_UDF_INVALID_INPUT indicates invalid input. TSDB_CODE_OUT_OF_MEMORY indicates insufficient memory.
@@ -194,7 +194,7 @@ typedef struct SUdfInterBuf {
```
The data structure is described as follows:
-- The SUdfDataBlock block includes the number of rows (numOfRows) and the number of columns (numCols). udfCols[i] (0 <= i <= numCols-1) indicates that each column is of type SUdfColumn.
+- The SUdfDataBlock block includes the number of rows (numOfRows) and the number of columns (numCols). udfCols[i] (0 <= i <= numCols-1) indicates that each column is of type SUdfColumn.
- SUdfColumn includes the definition of the data type of the column (colMeta) and the data in the column (colData).
- The member definitions of SUdfColumnMeta are the same as the data type definitions in `taos.h`.
- The data in SUdfColumnData can become longer. varLenCol indicates variable-length data, and fixLenCol indicates fixed-length data.
diff --git a/docs/en/08-client-libraries/03-cpp.mdx b/docs/en/08-client-libraries/03-cpp.mdx
index 80014ef3bf..59c5af9c03 100644
--- a/docs/en/08-client-libraries/03-cpp.mdx
+++ b/docs/en/08-client-libraries/03-cpp.mdx
@@ -186,7 +186,7 @@ The base API is used to do things like create database connections and provide a
- The variables database and len are applied by the user outside and allocated space. The current database name and length will be assigned to database and len.
- As long as the db name is not assigned to the database normally (including truncation), an error will be returned with the return value of -1, and then the user can use taos_errstr(NULL) to get error message.
- - If database==NULL or len<=0, returns an error, the space required to store the db (including the last '\0') in the variable required
+ - If database==NULL or len<=0, returns an error, the space required to store the db (including the last '\0') in the variable required
- If len is less than the space required to store the db (including the last '\0'), an error is returned. The truncated data assigned in the database ends with '\0'.
- If len is greater than or equal to the space required to store the db (including the last '\0'), return normal 0, and assign the db name ending with '\0' in the database.
diff --git a/docs/en/08-client-libraries/06-rust.mdx b/docs/en/08-client-libraries/06-rust.mdx
index 8fa5c946aa..ff4c1bf92b 100644
--- a/docs/en/08-client-libraries/06-rust.mdx
+++ b/docs/en/08-client-libraries/06-rust.mdx
@@ -69,7 +69,7 @@ TDengine currently supports timestamp, number, character, Boolean type, and the
| SMALLINT | i16 |
| TINYINT | i8 |
| BOOL | bool |
-| BINARY | Vec |
+| BINARY | Vec<u8> |
| NCHAR | String |
| JSON | serde_json::Value |
diff --git a/docs/en/08-client-libraries/07-python.mdx b/docs/en/08-client-libraries/07-python.mdx
index 4a06c42c12..aacfd0fe53 100644
--- a/docs/en/08-client-libraries/07-python.mdx
+++ b/docs/en/08-client-libraries/07-python.mdx
@@ -315,7 +315,7 @@ The `connect()` function returns a `taos.TaosConnection` instance. In client-sid
All arguments to the `connect()` function are optional keyword arguments. The following are the connection parameters specified.
-- `url`: The URL of taosAdapter REST service. The default is .
+- `url`: The URL of taosAdapter REST service. The default is `http://localhost:6041`.
- `user`: TDengine user name. The default is `root`.
- `password`: TDengine user password. The default is `taosdata`.
- `timeout`: HTTP request timeout. Enter a value in seconds. The default is `socket._GLOBAL_DEFAULT_TIMEOUT`. Usually, no configuration is needed.
diff --git a/docs/en/08-client-libraries/80-php.mdx b/docs/en/08-client-libraries/80-php.mdx
index ccaa2f8d55..a83391c19c 100644
--- a/docs/en/08-client-libraries/80-php.mdx
+++ b/docs/en/08-client-libraries/80-php.mdx
@@ -8,7 +8,7 @@ description: This document describes the TDengine PHP client library.
PHP client library relies on TDengine client driver.
-Project Repository:
+Project Repository: [https://github.com/Yurunsoft/php-tdengine](https://github.com/Yurunsoft/php-tdengine)
After TDengine client or server is installed, `taos.h` is located at:
diff --git a/docs/en/12-taos-sql/01-data-type.md b/docs/en/12-taos-sql/01-data-type.md
index 020eb27cfe..065daf2ecd 100644
--- a/docs/en/12-taos-sql/01-data-type.md
+++ b/docs/en/12-taos-sql/01-data-type.md
@@ -68,14 +68,14 @@ TDengine supports a variety of constants:
| # | **Syntax** | **Type** | **Description** |
| --- | :-----------------------------------------------: | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| 1 | [{+ \| -}]123 | BIGINT | Integer literals are of type BIGINT. Data that exceeds the length of the BIGINT type is truncated. |
+| 1 | [+ \| -]123 | BIGINT | Integer literals are of type BIGINT. Data that exceeds the length of the BIGINT type is truncated. |
| 2 | 123.45 | DOUBLE | Floating-point literals are of type DOUBLE. Numeric values will be determined as integer or float type according to whether there is decimal point or whether scientific notation is used. |
| 3 | 1.2E3 | DOUBLE | Literals in scientific notation are of type DOUBLE. |
| 4 | 'abc' | BINARY | Content enclosed in single quotation marks is of type BINARY. The size of a BINARY is the size of the string in bytes. A literal single quote inside the string must be escaped with a backslash `\'`. |
| 5 | 'abc' | BINARY | Content enclosed in double quotation marks is of type BINARY. The size of a BINARY is the size of the string in bytes. A literal double quote inside the string must be escaped with a backslash `\"`. |
-| 6 | TIMESTAMP {'literal' \| "literal"} | TIMESTAMP | The TIMESTAMP keyword indicates that the following string literal is interpreted as a timestamp. The string must be in YYYY-MM-DD HH:mm:ss.MS format. The precision is inherited from the database configuration. |
-| 7 | {TRUE \| FALSE} | BOOL | Boolean literals are of type BOOL. |
-| 8 | {'' \| "" \| '\t' \| "\t" \| ' ' \| " " \| NULL } | -- | The preceding characters indicate null literals. These can be used with any data type. |
+| 6 | TIMESTAMP ['literal' \| "literal"] | TIMESTAMP | The TIMESTAMP keyword indicates that the following string literal is interpreted as a timestamp. The string must be in YYYY-MM-DD HH:mm:ss.MS format. The precision is inherited from the database configuration. |
+| 7 | [TRUE \| FALSE] | BOOL | Boolean literals are of type BOOL. |
+| 8 | ['' \| "" \| '\t' \| "\t" \| ' ' \| " " \| NULL ] | -- | The preceding characters indicate null literals. These can be used with any data type. |
:::note
Numeric values will be determined as integer or float type according to whether there is decimal point or whether scientific notation is used, so attention must be paid to avoid overflow. For example, 9999999999999999999 will be considered as overflow because it exceeds the upper limit of long integer, but 9999999999999999999.0 will be considered as a legal float number.
diff --git a/docs/en/12-taos-sql/02-database.md b/docs/en/12-taos-sql/02-database.md
index ccf340b511..f49a9c6881 100644
--- a/docs/en/12-taos-sql/02-database.md
+++ b/docs/en/12-taos-sql/02-database.md
@@ -56,7 +56,7 @@ database_option: {
- WAL_FSYNC_PERIOD: specifies the interval (in milliseconds) at which data is written from the WAL to disk. This parameter takes effect only when the WAL parameter is set to 2. The default value is 3000. Enter a value between 0 and 180000. The value 0 indicates that incoming data is immediately written to disk.
- MAXROWS: specifies the maximum number of rows recorded in a block. The default value is 4096.
- MINROWS: specifies the minimum number of rows recorded in a block. The default value is 100.
-- KEEP: specifies the time for which data is retained. Enter a value between 1 and 365000. The default value is 3650. The value of the KEEP parameter must be greater than or equal to three times of the value of the DURATION parameter. TDengine automatically deletes data that is older than the value of the KEEP parameter. You can use m (minutes), h (hours), and d (days) as the unit, for example KEEP 100h or KEEP 10d. If you do not include a unit, d is used by default. TDengine Enterprise supports [Tiered Storage](https://docs.tdengine.com/tdinternal/arch/#tiered-storage) function, thus multiple KEEP values (comma separated and up to 3 values supported, and meet keep 0 <= keep 1 <= keep 2, e.g. KEEP 100h,100d,3650d) are supported; TDengine OSS does not support Tiered Storage function (although multiple keep values are configured, they do not take effect, only the maximum keep value is used as KEEP).
+- KEEP: specifies the time for which data is retained. Enter a value between 1 and 365000. The default value is 3650. The value of the KEEP parameter must be greater than or equal to three times of the value of the DURATION parameter. TDengine automatically deletes data that is older than the value of the KEEP parameter. You can use m (minutes), h (hours), and d (days) as the unit, for example KEEP 100h or KEEP 10d. If you do not include a unit, d is used by default. TDengine Enterprise supports [Tiered Storage](https://docs.tdengine.com/tdinternal/arch/#tiered-storage) function, thus multiple KEEP values (comma separated and up to 3 values supported, and meet keep 0 <= keep 1 <= keep 2, e.g. KEEP 100h,100d,3650d) are supported; TDengine OSS does not support Tiered Storage function (although multiple keep values are configured, they do not take effect, only the maximum keep value is used as KEEP).
- PAGES: specifies the number of pages in the metadata storage engine cache on each vnode. Enter a value greater than or equal to 64. The default value is 256. The space occupied by metadata storage on each vnode is equal to the product of the values of the PAGESIZE and PAGES parameters. The space occupied by default is 1 MB.
- PAGESIZE: specifies the size (in KB) of each page in the metadata storage engine cache on each vnode. The default value is 4. Enter a value between 1 and 16384.
- PRECISION: specifies the precision at which a database records timestamps. Enter ms for milliseconds, us for microseconds, or ns for nanoseconds. The default value is ms.
diff --git a/docs/en/12-taos-sql/10-function.md b/docs/en/12-taos-sql/10-function.md
index 851ef86b67..b4f1cf65da 100644
--- a/docs/en/12-taos-sql/10-function.md
+++ b/docs/en/12-taos-sql/10-function.md
@@ -491,6 +491,8 @@ TO_CHAR(ts, format_str_literal)
**Description**: Convert a ts column to string as the format specified
+**Version**: Since ver-3.2.2.0
+
**Return value type**: VARCHAR
**Applicable column types**: TIMESTAMP
@@ -550,6 +552,8 @@ TO_TIMESTAMP(ts_str_literal, format_str_literal)
**Description**: Convert a formated timestamp string to a timestamp
+**Version**: Since ver-3.2.2.0
+
**Return value type**: TIMESTAMP
**Applicable column types**: VARCHAR
@@ -877,11 +881,11 @@ HISTOGRAM(expr, bin_type, bin_description, normalized)
- "user_input": "[1, 3, 5, 7]":
User specified bin values.
- - "linear_bin": "{"start": 0.0, "width": 5.0, "count": 5, "infinity": true}"
+ - "linear_bin": "{"start": 0.0, "width": 5.0, "count": 5, "infinity": true}"
"start" - bin starting point. "width" - bin offset. "count" - number of bins generated. "infinity" - whether to add (-inf, inf) as start/end point in generated set of bins.
The above "linear_bin" descriptor generates a set of bins: [-inf, 0.0, 5.0, 10.0, 15.0, 20.0, +inf].
- - "log_bin": "{"start":1.0, "factor": 2.0, "count": 5, "infinity": true}"
+ - "log_bin": "{"start":1.0, "factor": 2.0, "count": 5, "infinity": true}"
"start" - bin starting point. "factor" - exponential factor of bin offset. "count" - number of bins generated. "infinity" - whether to add (-inf, inf) as start/end point in generated range of bins.
The above "linear_bin" descriptor generates a set of bins: [-inf, 1.0, 2.0, 4.0, 8.0, 16.0, +inf].
- normalized: setting to 1/0 to turn on/off result normalization. Valid values are 0 or 1.
@@ -977,7 +981,7 @@ ignore_null_values: {
- `INTERP` is used to get the value that matches the specified time slice from a column. If no such value exists an interpolation value will be returned based on `FILL` parameter.
- The input data of `INTERP` is the value of the specified column and a `where` clause can be used to filter the original data. If no `where` condition is specified then all original data is the input.
- `INTERP` must be used along with `RANGE`, `EVERY`, `FILL` keywords.
-- The output time range of `INTERP` is specified by `RANGE(timestamp1,timestamp2)` parameter, with timestamp1 <= timestamp2. timestamp1 is the starting point of the output time range. timestamp2 is the ending point of the output time range.
+- The output time range of `INTERP` is specified by `RANGE(timestamp1,timestamp2)` parameter, with timestamp1 <= timestamp2. timestamp1 is the starting point of the output time range. timestamp2 is the ending point of the output time range.
- The number of rows in the result set of `INTERP` is determined by the parameter `EVERY(time_unit)`. Starting from timestamp1, one interpolation is performed for every time interval specified `time_unit` parameter. The parameter `time_unit` must be an integer, with no quotes, with a time unit of: a(millisecond)), s(second), m(minute), h(hour), d(day), or w(week). For example, `EVERY(500a)` will interpolate every 500 milliseconds.
- Interpolation is performed based on `FILL` parameter. For more information about FILL clause, see [FILL Clause](../distinguished/#fill-clause).
- When only one timestamp value is specified in `RANGE` clause, `INTERP` is used to generate interpolation at this point in time. In this case, `EVERY` clause can be omitted. For example, SELECT INTERP(col) FROM tb RANGE('2023-01-01 00:00:00') FILL(linear).
diff --git a/docs/en/12-taos-sql/14-stream.md b/docs/en/12-taos-sql/14-stream.md
index c8be1753a2..6f2343d347 100644
--- a/docs/en/12-taos-sql/14-stream.md
+++ b/docs/en/12-taos-sql/14-stream.md
@@ -67,7 +67,7 @@ If a stream is created with PARTITION BY clause and SUBTABLE clause, the name of
CREATE STREAM avg_vol_s INTO avg_vol SUBTABLE(CONCAT('new-', tname)) AS SELECT _wstart, count(*), avg(voltage) FROM meters PARTITION BY tbname tname INTERVAL(1m);
```
-IN PARTITION clause, 'tbname', representing each subtable name of source supertable, is given alias 'tname'. And 'tname' is used in SUBTABLE clause. In SUBTABLE clause, each auto created subtable will concat 'new-' and source subtable name as their name. Other expressions are also allowed in SUBTABLE clause, but the output type must be varchar.
+IN PARTITION clause, 'tbname', representing each subtable name of source supertable, is given alias 'tname'. And 'tname' is used in SUBTABLE clause. In SUBTABLE clause, each auto created subtable will concat 'new-' and source subtable name as their name(Starting from 3.2.3.0, in order to avoid the expression in subtable being unable to distinguish between different subtables, add '_groupId' to the end of subtable name).
If the output length exceeds the limitation of TDengine(192), the name will be truncated. If the generated name is occupied by some other table, the creation and writing of the new subtable will be failed.
diff --git a/docs/en/12-taos-sql/16-operators.md b/docs/en/12-taos-sql/16-operators.md
index ce8ab8a03c..26c937b351 100644
--- a/docs/en/12-taos-sql/16-operators.md
+++ b/docs/en/12-taos-sql/16-operators.md
@@ -35,9 +35,9 @@ TDengine supports the `UNION` and `UNION ALL` operations. UNION ALL collects all
| # | **Operator** | **Supported Data Types** | **Description** |
| --- | :---------------: | -------------------------------------------------------------------- | -------------------- |
| 1 | = | All types except BLOB, MEDIUMBLOB, and JSON | Equal to |
-| 2 | <\>, != | All types except BLOB, MEDIUMBLOB, and JSON; the primary key (timestamp) is also not supported | Not equal to |
-| 3 | \>, < | All types except BLOB, MEDIUMBLOB, and JSON | Greater than and less than |
-| 4 | \>=, <= | All types except BLOB, MEDIUMBLOB, and JSON | Greater than or equal to and less than or equal to |
+| 2 | <>, != | All types except BLOB, MEDIUMBLOB, and JSON; the primary key (timestamp) is also not supported | Not equal to |
+| 3 | >, < | All types except BLOB, MEDIUMBLOB, and JSON | Greater than and less than |
+| 4 | >=, <= | All types except BLOB, MEDIUMBLOB, and JSON | Greater than or equal to and less than or equal to |
| 5 | IS [NOT] NULL | All types | Indicates whether the value is null |
| 6 | [NOT] BETWEEN AND | All types except BLOB, MEDIUMBLOB, JSON and GEOMETRY | Closed interval comparison |
| 7 | IN | All types except BLOB, MEDIUMBLOB, and JSON; the primary key (timestamp) is also not supported | Equal to any value in the list |
diff --git a/docs/en/12-taos-sql/18-escape.md b/docs/en/12-taos-sql/18-escape.md
index a44b21db43..2d067b2ad9 100644
--- a/docs/en/12-taos-sql/18-escape.md
+++ b/docs/en/12-taos-sql/18-escape.md
@@ -7,14 +7,14 @@ description: This document describes the usage of escape characters in TDengine.
| Escape Character | **Actual Meaning** |
| :--------------: | ------------------------ |
-| `\'` | Single quote ' |
-| `\"` | Double quote " |
-| \n | Line Break |
-| \r | Carriage Return |
-| \t | tab |
-| `\\` | Back Slash \ |
-| `\%` | % see below for details |
-| `\_` | \_ see below for details |
+| `\'` | Single quote `'` |
+| `\"` | Double quote `"` |
+| `\n` | Line Break |
+| `\r` | Carriage Return |
+| `\t` | tab |
+| `\\` | Back Slash `\ ` |
+| `\%` | `%` see below for details |
+| `\_` | `_` see below for details |
## Restrictions
@@ -22,5 +22,5 @@ description: This document describes the usage of escape characters in TDengine.
- Identifier without ``: Error will be returned because identifier must be constituted of digits, ASCII characters or underscore and can't be started with digits
- Identifier quoted with ``: Original content is kept, no escaping
2. If there are escape characters in values
- - The escape characters will be escaped as the above table. If the escape character doesn't match any supported one, the escape character "\" will be ignored.
- - "%" and "\_" are used as wildcards in `like`. `\%` and `\_` should be used to represent literal "%" and "\_" in `like`,. If `\%` and `\_` are used out of `like` context, the evaluation result is "`\%`"and "`\_`", instead of "%" and "\_".
+ - The escape characters will be escaped as the above table. If the escape character doesn't match any supported one, the escape character `\ ` will be ignored(`\x` remaining).
+ - `%` and `_` are used as wildcards in `like`. `\%` and `\_` should be used to represent literal `%` and `_` in `like`. If `\%` and `\_` are used out of `like` context, the evaluation result is `\%` and `\_`, instead of `%` and `_`.
diff --git a/docs/en/12-taos-sql/29-changes.md b/docs/en/12-taos-sql/29-changes.md
index bbb52db4d9..a269e675d1 100644
--- a/docs/en/12-taos-sql/29-changes.md
+++ b/docs/en/12-taos-sql/29-changes.md
@@ -71,7 +71,7 @@ The following data types can be used in the schema for standard tables.
| 44 | SHOW STREAMS | Modified | This statement previously showed continuous queries. The continuous query feature has been replaced with the stream processing feature. This statement now shows streams that have been created.
| 45 | SHOW SUBSCRIPTIONS | Added | Shows all subscriptions in the current database.
| 46 | SHOW TABLES | Modified | Only shows table names.
-| 47 | SHOW TABLE DISTRIBUTED | Added | Shows how table data is distributed. This replaces the `SELECT _block_dist() FROM { tb_name | stb_name }` command.
+| 47 | SHOW TABLE DISTRIBUTED | Added | Shows how table data is distributed. This replaces the `SELECT _block_dist() FROM { tb_name | stb_name }` command.
| 48 | SHOW TOPICS | Added | Shows all subscribed topics in the current database.
| 49 | SHOW TRANSACTIONS | Added | Shows all running transactions in the system.
| 50 | SHOW DNODE VARIABLES | Added | Shows the configuration of the specified dnode.
diff --git a/docs/en/13-operation/17-diagnose.md b/docs/en/13-operation/17-diagnose.md
index 33a0a8c28c..6cf8b1da1d 100644
--- a/docs/en/13-operation/17-diagnose.md
+++ b/docs/en/13-operation/17-diagnose.md
@@ -15,7 +15,7 @@ Diagnostic steps:
2. On the server side, execute command `taos -n server -P -l ` to monitor the port range starting from the port specified by `-P` parameter with the role of "server".
3. On the client side, execute command `taos -n client -h -P -l ` to send a testing package to the specified server and port.
--l : The size of the testing package, in bytes. The value range is [11, 64,000] and default value is 1,000.
+-l <pktlen>: The size of the testing package, in bytes. The value range is [11, 64,000] and default value is 1,000.
Please note that the package length must be same in the above 2 commands executed on server side and client side respectively.
Output of the server side for the example is below:
@@ -63,7 +63,7 @@ Once this parameter is set to 135 or 143, the log file grows very quickly especi
## Client Log
-An independent log file, named as "taoslog+" is generated for each client program, i.e. a client process. The parameter `debugFlag` is used to control the log level. The default value is 131. For debugging and tracing, it needs to be set to either 135 or 143 respectively.
+An independent log file, named as "taoslog+<seq num>" is generated for each client program, i.e. a client process. The parameter `debugFlag` is used to control the log level. The default value is 131. For debugging and tracing, it needs to be set to either 135 or 143 respectively.
The default value of `debugFlag` is also 131 and only logs at level of INFO/ERROR/WARNING are recorded. As stated above, for debugging and tracing, it needs to be changed to 135 or 143 respectively, so that logs at DEBUG or TRACE level can be recorded.
diff --git a/docs/en/14-reference/02-rest-api/02-rest-api.mdx b/docs/en/14-reference/02-rest-api/02-rest-api.mdx
index 76dc3b6b58..405b154d1d 100644
--- a/docs/en/14-reference/02-rest-api/02-rest-api.mdx
+++ b/docs/en/14-reference/02-rest-api/02-rest-api.mdx
@@ -81,7 +81,7 @@ Parameter Description:
:::note
-URL Encoding. Make sure that parameters are properly encoded. For example, when specifying a timezone you must properly encode special characters. ?tz=Etc/GMT+10 will not work because the <+> plus symbol is recognized as a space in the url. It's best practice to encode all special characters in a parameter. Instead use ?tz=Etc%2FGMT%2B10 for the parameter.
+URL Encoding. Make sure that parameters are properly encoded. For example, when specifying a timezone you must properly encode special characters. ?tz=Etc/GMT+10 will not work because the + plus symbol is recognized as a space in the url. It's best practice to encode all special characters in a parameter. Instead use ?tz=Etc%2FGMT%2B10 for the parameter.
:::
diff --git a/docs/en/14-reference/04-taosadapter.md b/docs/en/14-reference/04-taosadapter.md
index a9330d21c7..c21a2d3a3f 100644
--- a/docs/en/14-reference/04-taosadapter.md
+++ b/docs/en/14-reference/04-taosadapter.md
@@ -166,8 +166,8 @@ See [example/config/taosadapter.toml](https://github.com/taosdata/taosadapter/bl
- Compatible with InfluxDB v1 write interface
[https://docs.influxdata.com/influxdb/v2.0/reference/api/influxdb-1x/write/](https://docs.influxdata.com/influxdb/v2.0/reference/api/influxdb-1x/write/)
- Compatible with OpenTSDB JSON and telnet format writes
- -
- -
+ - [http://opentsdb.net/docs/build/html/api_http/put.html](http://opentsdb.net/docs/build/html/api_http/put.html)
+ - [http://opentsdb.net/docs/build/html/api_telnet/put.html](http://opentsdb.net/docs/build/html/api_telnet/put.html)
- Seamless connection to collectd
collectd is a system statistics collection daemon, please visit [https://collectd.org/](https://collectd.org/) for more information.
- Seamless connection with StatsD
diff --git a/docs/en/14-reference/05-taosbenchmark.md b/docs/en/14-reference/05-taosbenchmark.md
index 4744e143fc..2f953b1f8c 100644
--- a/docs/en/14-reference/05-taosbenchmark.md
+++ b/docs/en/14-reference/05-taosbenchmark.md
@@ -94,67 +94,67 @@ taosBenchmark -f
## Command-line argument in detail
-- **-f/--file ** :
+- **-f/--file <json file>** :
specify the configuration file to use. This file includes All parameters. Users should not use this parameter with other parameters on the command-line. There is no default value.
-- **-c/--config-dir ** :
+- **-c/--config-dir <dir>** :
specify the directory where the TDengine cluster configuration file. The default path is `/etc/taos`.
-- **-h/--host ** :
+- **-h/--host <host>** :
Specify the FQDN of the TDengine server to connect to. The default value is localhost.
-- **-P/--port ** :
+- **-P/--port <port>** :
The port number of the TDengine server to connect to, the default value is 6030.
-- **-I/--interface ** :
+- **-I/--interface <insertMode>** :
Insert mode. Options are taosc, rest, stmt, sml, sml-rest, corresponding to normal write, restful interface writing, parameter binding interface writing, schemaless interface writing, RESTful schemaless interface writing (provided by taosAdapter). The default value is taosc.
-- **-u/--user ** :
+- **-u/--user <user>** :
User name to connect to the TDengine server. Default is root.
- **-U/--supplement-insert ** :
Supplementally insert data without create database and table, optional, default is off.
-- **-p/--password ** :
+- **-p/--password <passwd>** :
The default password to connect to the TDengine server is `taosdata`.
-- **-o/--output ** :
+- **-o/--output <file>** :
specify the path of the result output file, the default value is `. /output.txt`.
-- **-T/--thread ** :
+- **-T/--thread <threadNum>** :
The number of threads to insert data. Default is 8.
-- **-B/--interlace-rows ** :
+- **-B/--interlace-rows <rowNum>** :
Enables interleaved insertion mode and specifies the number of rows of data to be inserted into each child table. Interleaved insertion mode means inserting the number of rows specified by this parameter into each sub-table and repeating the process until all sub-tables have been inserted. The default value is 0, i.e., data is inserted into one sub-table before the next sub-table is inserted.
-- **-i/--insert-interval ** :
+- **-i/--insert-interval <timeInterval>** :
Specify the insert interval in `ms` for interleaved insert mode. The default value is 0. It only works if `-B/--interlace-rows` is greater than 0. After inserting interlaced rows for each child table, the data insertion thread will wait for the interval specified by this value before proceeding to the next round of writes.
-- **-r/--rec-per-req ** :
+- **-r/--rec-per-req <rowNum>** :
Writing the number of rows of records per request to TDengine, the default value is 30000.
-- **-t/--tables ** :
+- **-t/--tables <tableNum>** :
Specify the number of sub-tables. The default is 10000.
-- **-S/--timestampstep ** :
+- **-S/--timestampstep <stepLength>** :
Timestamp step for inserting data in each child table in ms, default is 1.
-- **-n/--records ** :
+- **-n/--records <recordNum>** :
The default value of the number of records inserted in each sub-table is 10000.
-- **-d/--database ** :
+- **-d/--database <dbName>** :
The name of the database used, the default value is `test`.
-- **-b/--data-type ** :
+- **-b/--data-type <colType>** :
specify the type of the data columns of the super table. It defaults to three columns of type FLOAT, INT, and FLOAT if not used.
-- **-l/--columns ** :
+- **-l/--columns <colNum>** :
specify the number of columns in the super table. If both this parameter and `-b/--data-type` is set, the final result number of columns is the greater of the two. If the number specified by this parameter is greater than the number of columns specified by `-b/--data-type`, the unspecified column type defaults to INT, for example: `-l 5 -b float,double`, then the final column is `FLOAT,DOUBLE,INT,INT,INT`. If the number of columns specified is less than or equal to the number of columns specified by `-b/--data-type`, then the result is the column and type specified by `-b/--data-type`, e.g.: `-l 3 -b float,double,float,bigint`. The last column is `FLOAT,DOUBLE, FLOAT,BIGINT`.
-- **-L/--partial-col-num ** :
+- **-L/--partial-col-num <colNum> ** :
Specify first numbers of columns has data. Rest of columns' data are NULL. Default is all columns have data.
-- **-A/--tag-type ** :
+- **-A/--tag-type <tagType>** :
The tag column type of the super table. nchar and binary types can both set the length, for example:
```
@@ -168,10 +168,10 @@ Note: In some shells, such as bash, "()" needs to be escaped, so the above comma
taosBenchmark -A INT,DOUBLE,NCHAR,BINARY\(16\)
```
-- **-w/--binwidth **:
+- **-w/--binwidth <length>**:
specify the default length for nchar and binary types. The default value is 64.
-- **-m/--table-prefix ** :
+- **-m/--table-prefix <tablePrefix>** :
The prefix of the sub-table name, the default value is "d".
- **-E/--escape-character** :
@@ -192,25 +192,25 @@ taosBenchmark -A INT,DOUBLE,NCHAR,BINARY\(16\)
- **-y/--answer-yes** :
Switch parameter that requires the user to confirm at the prompt to continue. The default value is false.
-- **-O/--disorder ** :
+- **-O/--disorder <Percentage>** :
Specify the percentage probability of disordered data, with a value range of [0,50]. The default is 0, i.e., there is no disordered data.
-- **-R/--disorder-range ** :
+- **-R/--disorder-range <timeRange>** :
Specify the timestamp range for the disordered data. It leads the resulting disorder timestamp as the ordered timestamp minus a random value in this range. Valid only if the percentage of disordered data specified by `-O/--disorder` is greater than 0.
-- **-F/--prepared_rand ** :
+- **-F/--prepared_rand <Num>** :
Specify the number of unique values in the generated random data. A value of 1 means that all data are equal. The default value is 10000.
-- **-a/--replica ** :
+- **-a/--replica <replicaNum>** :
Specify the number of replicas when creating the database. The default value is 1.
-- **-k/--keep-trying ** :
+- **-k/--keep-trying <NUMBER>** :
Keep trying if failed to insert, default is no. Available with v3.0.9+.
-- **-z/--trying-interval ** :
+- **-z/--trying-interval <NUMBER&;gt;** :
Specify interval between keep trying insert. Valid value is a positive number. Only valid when keep trying be enabled. Available with v3.0.9+.
-- **-v/--vgroups ** :
+- **-v/--vgroups <NUMBER>** :
Specify vgroups number for creating a database, only valid with daemon version 3.0+
- **-V/--version** :
@@ -226,7 +226,7 @@ taosBenchmark -A INT,DOUBLE,NCHAR,BINARY\(16\)
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.
-**cfgdir**: specify the TDengine client 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`.
diff --git a/docs/en/14-reference/12-config/index.md b/docs/en/14-reference/12-config/index.md
index 65c48f9190..af88978603 100755
--- a/docs/en/14-reference/12-config/index.md
+++ b/docs/en/14-reference/12-config/index.md
@@ -226,9 +226,10 @@ Please note the `taoskeeper` needs to be installed and running to create the `lo
| Attribute | Description |
| ------------- | --------------------------------------------------------------------------------------------------------------- |
| Applicable | Client only |
-| Meaning | When the Last, First, LastRow function is queried, whether the returned column name contains the function name. |
-| Value Range | 0 means including the function name, 1 means not including the function name. |
-| Default Value | 0 |
+| Meaning | When the Last, First, and LastRow functions are queried and no alias is specified, the alias is automatically set to the column name (excluding the function name). Therefore, if the order by clause refers to the column name, it will automatically refer to the function corresponding to the column. |
+| Value Range | 1 means automatically setting the alias to the column name (excluding the function name), 0 means not automatically setting the alias. |
+| Default Value | 0 |
+| Notes | When multiple of the above functions act on the same column at the same time and no alias is specified, if the order by clause refers to the column name, column selection ambiguous will occur because the aliases of multiple columns are the same. |
## Locale Parameters
@@ -288,7 +289,7 @@ A specific type "nchar" is provided in TDengine to store non-ASCII characters su
The characters input on the client side are encoded using the default system encoding, which is UTF-8 on Linux/macOS, or GB18030 or GBK on some systems in Chinese, POSIX in docker, CP936 on Windows in Chinese. The encoding of the operating system in use must be set correctly so that the characters in nchar type can be converted to UCS4-LE.
-The locale definition standard on Linux/macOS is: \_., for example, in "zh_CN.UTF-8", "zh" means Chinese, "CN" means China mainland, "UTF-8" means charset. The charset indicates how to display the characters. On Linux/macOS, the charset can be set by locale in the system. On Windows system another configuration parameter `charset` must be used to configure charset because the locale used on Windows is not POSIX standard. Of course, `charset` can also be used on Linux/macOS to specify the charset.
+The locale definition standard on Linux/macOS is: <Language>\_<Region>.<charset>, for example, in "zh_CN.UTF-8", "zh" means Chinese, "CN" means China mainland, "UTF-8" means charset. The charset indicates how to display the characters. On Linux/macOS, the charset can be set by locale in the system. On Windows system another configuration parameter `charset` must be used to configure charset because the locale used on Windows is not POSIX standard. Of course, `charset` can also be used on Linux/macOS to specify the charset.
:::
diff --git a/docs/en/14-reference/13-schemaless/13-schemaless.md b/docs/en/14-reference/13-schemaless/13-schemaless.md
index 9b001ee79c..4a259f100c 100644
--- a/docs/en/14-reference/13-schemaless/13-schemaless.md
+++ b/docs/en/14-reference/13-schemaless/13-schemaless.md
@@ -84,18 +84,22 @@ Schemaless writes process row data according to the following principles.
1. You can use the following rules to generate the subtable names: first, combine the measurement name and the key and value of the label into the next string:
-```json
-"measurement,tag_key1=tag_value1,tag_key2=tag_value2"
-```
+ ```json
+ "measurement,tag_key1=tag_value1,tag_key2=tag_value2"
+ ```
-:::tip
-Note that tag_key1, tag_key2 are not the original order of the tags entered by the user but the result of using the tag names in ascending order of the strings. Therefore, tag_key1 is not the first tag entered in the line protocol.
-The string's MD5 hash value "md5_val" is calculated after the ranking is completed. The calculation result is then combined with the string to generate the table name: "t_md5_val". "t\_" is a fixed prefix that every table generated by this mapping relationship has.
-:::
+ :::tip
+ Note that tag_key1, tag_key2 are not the original order of the tags entered by the user but the result of using the tag names in ascending order of the strings. Therefore, tag_key1 is not the first tag entered in the line protocol.
+ The string's MD5 hash value "md5_val" is calculated after the ranking is completed. The calculation result is then combined with the string to generate the table name: "t_md5_val". "t\_" is a fixed prefix that every table generated by this mapping relationship has.
+ :::
-If you do not want to use an automatically generated table name, there are two ways to specify sub table names, the first one has a higher priority.
-You can configure smlAutoChildTableNameDelimiter in taos.cfg(except for `@ # space \r \t \n`), for example, `smlAutoChildTableNameDelimiter=tname`. You can insert `st,t0=cpul,t1=4 c1=3 1626006833639000000` and the table name will be cpu1-4.
-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.
+ If you do not want to use an automatically generated table name, there are two ways to specify sub table names(the first one has a higher priority).
+
+ 1. You can configure smlAutoChildTableNameDelimiter in taos.cfg(except for `@ # space \r \t \n`).
+ 1. For example, `smlAutoChildTableNameDelimiter=tname`. You can insert `st,t0=cpul,t1=4 c1=3 1626006833639000000` and the table name will be cpu1-4.
+
+ 2. You can configure smlChildTableName in taos.cfg to specify table names.
+ 2. 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.
2. If the super table obtained by parsing the line protocol does not exist, this super table is created.
**Important:** Manually creating supertables for schemaless writing is not supported. Schemaless writing creates appropriate supertables automatically.
diff --git a/docs/en/14-reference/_collectd.mdx b/docs/en/14-reference/_collectd.mdx
index ce88328098..9dd2f08b1c 100644
--- a/docs/en/14-reference/_collectd.mdx
+++ b/docs/en/14-reference/_collectd.mdx
@@ -36,7 +36,7 @@ LoadPlugin network
```
-where fills in the server's domain name or IP address running taosAdapter. fills in the port that taosAdapter uses to receive collectd data (default is 6045).
+where <taosAdapter's host> fills in the server's domain name or IP address running taosAdapter. <port for collectd direct> fills in the port that taosAdapter uses to receive collectd data (default is 6045).
An example is as follows.
@@ -62,7 +62,7 @@ LoadPlugin write_tsdb
```
-Where is the domain name or IP address of the server running taosAdapter. Fill in the data that taosAdapter uses to receive the collectd write_tsdb plugin (default is 6047).
+Where <taosAdapter's host> is the domain name or IP address of the server running taosAdapter. <port for collectd write_tsdb plugin> Fill in the data that taosAdapter uses to receive the collectd write_tsdb plugin (default is 6047).
```text
LoadPlugin write_tsdb
diff --git a/docs/en/14-reference/_icinga2.mdx b/docs/en/14-reference/_icinga2.mdx
index 0a2bf52c27..2afcbf52eb 100644
--- a/docs/en/14-reference/_icinga2.mdx
+++ b/docs/en/14-reference/_icinga2.mdx
@@ -26,7 +26,7 @@ The default database name written by the taosAdapter is `icinga2`. You can also
### Configure icinga3
- Enable opentsdb-writer for icinga2 (refer to the link https://icinga.com/docs/icinga-2/latest/doc/14-features/#opentsdb-writer)
-- Modify the configuration file `/etc/icinga2/features-enabled/opentsdb.conf` by filling in as the domain name or IP address of the server running taosAdapter and as the corresponding port on which taosAdapter supports receiving icinga2 data (default is 6048)
+- Modify the configuration file `/etc/icinga2/features-enabled/opentsdb.conf` by filling in <taosAdapter's host> as the domain name or IP address of the server running taosAdapter and <port for icinga2> as the corresponding port on which taosAdapter supports receiving icinga2 data (default is 6048)
```
object OpenTsdbWriter "opentsdb" {
diff --git a/docs/en/14-reference/_prometheus.mdx b/docs/en/14-reference/_prometheus.mdx
index 0940e4adb2..29317be6ea 100644
--- a/docs/en/14-reference/_prometheus.mdx
+++ b/docs/en/14-reference/_prometheus.mdx
@@ -9,8 +9,8 @@ Point the `remote_read url` and `remote_write url` to the domain name or IP addr
### Configure Basic authentication
-- username:
-- password:
+- username: TDengine's username
+- password: TDengine's password
### Example configuration of remote_write and remote_read related sections in prometheus.yml file
diff --git a/docs/en/14-reference/_statsd.mdx b/docs/en/14-reference/_statsd.mdx
index b15c9640db..d839385ccd 100644
--- a/docs/en/14-reference/_statsd.mdx
+++ b/docs/en/14-reference/_statsd.mdx
@@ -31,7 +31,7 @@ The default database name written by taosAdapter is `statsd`. To specify a diffe
### Configuring StatsD
-To use StatsD, you need to download its [source code](https://github.com/statsd/statsd). Please refer to the example file `exampleConfig.js` in the root directory of the source download to modify the configuration file. In , please fill in the domain name or IP address of the server running taosAdapter, and , please fill in the port where taosAdapter receives StatsD data (default is 6044).
+To use StatsD, you need to download its [source code](https://github.com/statsd/statsd). Please refer to the example file `exampleConfig.js` in the root directory of the source download to modify the configuration file. In <taosAdapter's host>, please fill in the domain name or IP address of the server running taosAdapter, and <port for StatsD>, please fill in the port where taosAdapter receives StatsD data (default is 6044).
```
backends section add ". /backends/repeater"
diff --git a/docs/en/14-reference/_telegraf.mdx b/docs/en/14-reference/_telegraf.mdx
index bcf1a0893f..4c15ceaaaa 100644
--- a/docs/en/14-reference/_telegraf.mdx
+++ b/docs/en/14-reference/_telegraf.mdx
@@ -10,7 +10,7 @@ In the Telegraf configuration file (default location `/etc/telegraf/telegraf.con
...
```
-Where please fill in the server's domain name or IP address running the taosAdapter service. please fill in the port of the REST service (default is 6041). and please fill in the actual configuration of the currently running TDengine. And please fill in the database name where you want to store Telegraf data in TDengine.
+Where <taosAdapter's host> please fill in the server's domain name or IP address running the taosAdapter service. <REST service port> please fill in the port of the REST service (default is 6041). <TDengine's username> and <TDengine's password> please fill in the actual configuration of the currently running TDengine. And <database name> please fill in the database name where you want to store Telegraf data in TDengine.
An example is as follows.
diff --git a/docs/en/20-third-party/01-grafana.mdx b/docs/en/20-third-party/01-grafana.mdx
index f7d1a2db7e..75614d159f 100644
--- a/docs/en/20-third-party/01-grafana.mdx
+++ b/docs/en/20-third-party/01-grafana.mdx
@@ -23,7 +23,7 @@ Record these values:
## Installing Grafana
-TDengine currently supports Grafana versions 7.5 and above. Users can go to the Grafana official website to download the installation package and execute the installation according to the current operating system. The download address is as follows: .
+TDengine currently supports Grafana versions 7.5 and above. Users can go to the Grafana official website to download the installation package and execute the installation according to the current operating system. The download address is as follows: [https://grafana.com/grafana/download](https://grafana.com/grafana/download).
## Configuring Grafana
@@ -59,7 +59,7 @@ bash -c "$(curl -fsSL \
-p taosdata
```
-Restart Grafana service and open Grafana in web-browser, usually .
+Restart Grafana service and open Grafana in web-browser, usually `http://localhost:3000`.
Save the script and type `./install.sh --help` for the full usage of the script.
@@ -181,7 +181,7 @@ You can setup a zero-configuration stack for TDengine + Grafana by [docker-compo
3. Start TDengine and Grafana services: `docker-compose up -d`.
-Open Grafana , and you can add dashboard with TDengine now.
+Open Grafana (http://localhost:3000), and you can add dashboard with TDengine now.
@@ -202,7 +202,7 @@ As shown above, select the `TDengine` data source in the `Query` and enter the c
:::note
-Since the REST connection because is stateless. Grafana plugin can use . in the SQL command to specify the database name.
+Since the REST connection because is stateless. Grafana plugin can use <db_name>.<table_name> in the SQL command to specify the database name.
:::
diff --git a/docs/en/20-third-party/11-kafka.md b/docs/en/20-third-party/11-kafka.md
index 42266d232c..344db06322 100644
--- a/docs/en/20-third-party/11-kafka.md
+++ b/docs/en/20-third-party/11-kafka.md
@@ -345,7 +345,7 @@ The following configuration items apply to TDengine Sink Connector and TDengine
### TDengine Sink Connector specific configuration
1. `connection.database`: The name of the target database. If the specified database does not exist, it will be created automatically. The time precision used for automatic library building is nanoseconds. The default value is null. When it is NULL, refer to the description of the `connection.database.prefix` parameter for the naming rules of the target database
-2. `connection.database.prefix`: When `connection.database` is null, the prefix of the target database. Can contain placeholder '${topic}'. For example, kafka_${topic}, for topic 'orders' will be written to database 'kafka_orders'. Default null. When null, the name of the target database is the same as the name of the topic.
+2. `connection.database.prefix`: When `connection.database` is null, the prefix of the target database. Can contain placeholder '${topic}'. For example, kafka_${topic}, for topic 'orders' will be written to database 'kafka_orders'. Default null. When null, the name of the target database is the same as the name of the topic.
3. `batch.size`: Write the number of records in each batch in batches. When the data received by the sink connector at one time is larger than this value, it will be written in some batches.
4. `max.retries`: The maximum number of retries when an error occurs. Defaults to 1.
5. `retry.backoff.ms`: The time interval for retry when sending an error. The unit is milliseconds. The default is 3000.
@@ -370,12 +370,12 @@ The following configuration items apply to TDengine Sink Connector and TDengine
## Other notes
-1. To use Kafka Connect, refer to .
+1. To use Kafka Connect, refer to [https://kafka.apache.org/documentation/#connect](https://kafka.apache.org/documentation/#connect).
## Feedback
-
+[https://github.com/taosdata/kafka-connect-tdengine/issues](https://github.com/taosdata/kafka-connect-tdengine/issues)
## Reference
-1. For more information, see
+1. For more information, see [https://kafka.apache.org/documentation/](https://kafka.apache.org/documentation/).
diff --git a/docs/zh/12-taos-sql/10-function.md b/docs/zh/12-taos-sql/10-function.md
index 66322d55f1..0482022d95 100644
--- a/docs/zh/12-taos-sql/10-function.md
+++ b/docs/zh/12-taos-sql/10-function.md
@@ -491,6 +491,8 @@ TO_CHAR(ts, format_str_literal)
**功能说明**: 将timestamp类型按照指定格式转换为字符串
+**版本**: ver-3.2.2.0
+
**返回结果数据类型**: VARCHAR
**应用字段**: TIMESTAMP
@@ -550,6 +552,8 @@ TO_TIMESTAMP(ts_str_literal, format_str_literal)
**功能说明**: 将字符串按照指定格式转化为时间戳.
+**版本**: ver-3.2.2.0
+
**返回结果数据类型**: TIMESTAMP
**应用字段**: VARCHAR
diff --git a/docs/zh/12-taos-sql/14-stream.md b/docs/zh/12-taos-sql/14-stream.md
index 929cf9ee4e..979fc436b9 100644
--- a/docs/zh/12-taos-sql/14-stream.md
+++ b/docs/zh/12-taos-sql/14-stream.md
@@ -34,7 +34,7 @@ subquery: SELECT select_list
stb_name 是保存计算结果的超级表的表名,如果该超级表不存在,会自动创建;如果已存在,则检查列的schema信息。详见 写入已存在的超级表
-TAGS 字句定义了流计算中创建TAG的规则,可以为每个partition对应的子表生成自定义的TAG值,详见 自定义TAG
+TAGS 子句定义了流计算中创建TAG的规则,可以为每个partition对应的子表生成自定义的TAG值,详见 自定义TAG
```sql
create_definition:
col_name column_definition
@@ -77,7 +77,7 @@ SELECT _wstart, count(*), avg(voltage) FROM meters PARTITION BY tbname INTERVAL(
CREATE STREAM avg_vol_s INTO avg_vol SUBTABLE(CONCAT('new-', tname)) AS SELECT _wstart, count(*), avg(voltage) FROM meters PARTITION BY tbname tname INTERVAL(1m);
```
-PARTITION 子句中,为 tbname 定义了一个别名 tname, 在PARTITION 子句中的别名可以用于 SUBTABLE 子句中的表达式计算,在上述示例中,流新创建的子表将以前缀 'new-' 连接原表名作为表名。
+PARTITION 子句中,为 tbname 定义了一个别名 tname, 在PARTITION 子句中的别名可以用于 SUBTABLE 子句中的表达式计算,在上述示例中,流新创建的子表将以前缀 'new-' 连接原表名作为表名(从3.2.3.0开始,为了避免 sutable 中的表达式无法区分各个子表,即误将多个相同时间线写入一个子表,在指定的子表名后面加上 _groupId)。
注意,子表名的长度若超过 TDengine 的限制,将被截断。若要生成的子表名已经存在于另一超级表,由于 TDengine 的子表名是唯一的,因此对应新子表的创建以及数据的写入将会失败。
@@ -212,8 +212,8 @@ CREATE STREAM streams2 trigger at_once INTO st1 TAGS(cc varchar(100)) as select
PARTITION 子句中,为 concat("tag-", tbname)定义了一个别名cc, 对应超级表st1的自定义TAG的名字。在上述示例中,流新创建的子表的TAG将以前缀 'new-' 连接原表名作为TAG的值。
会对TAG信息进行如下检查
-1.检查tag的schema信息是否匹配,对于不匹配的,则自动进行数据类型转换,当前只有数据长度大于4096byte时才报错,其余场景都能进行类型转换。
-2.检查tag的个数是否相同,如果不同,需要显示的指定超级表与subquery的tag的对应关系,否则报错;如果相同,可以指定对应关系,也可以不指定,不指定则按位置顺序对应。
+1. 检查tag的schema信息是否匹配,对于不匹配的,则自动进行数据类型转换,当前只有数据长度大于4096byte时才报错,其余场景都能进行类型转换。
+2. 检查tag的个数是否相同,如果不同,需要显示的指定超级表与subquery的tag的对应关系,否则报错;如果相同,可以指定对应关系,也可以不指定,不指定则按位置顺序对应。
## 清理中间状态
diff --git a/docs/zh/12-taos-sql/18-escape.md b/docs/zh/12-taos-sql/18-escape.md
index 5e0d292d39..81e4179042 100644
--- a/docs/zh/12-taos-sql/18-escape.md
+++ b/docs/zh/12-taos-sql/18-escape.md
@@ -8,16 +8,15 @@ description: TDengine 中使用转义字符的详细规则
| 字符序列 | **代表的字符** |
| :------: | -------------- |
-| `\'` | 单引号' |
-| `\"` | 双引号" |
-| \n | 换行符 |
-| \r | 回车符 |
-| \t | tab 符 |
-| `\\` | 斜杠\ |
-| `\%` | % 规则见下 |
-| `\_` | \_ 规则见下 |
+| `\'` | 单引号`'` |
+| `\"` | 双引号`"` |
+| `\n` | 换行符 |
+| `\r` | 回车符 |
+| `\t` | tab 符 |
+| `\\` | 斜杠 `\ ` |
+| `\%` | `%` 规则见下 |
+| `\_` | `_` 规则见下 |
-:::
## 转义字符使用规则
@@ -25,5 +24,5 @@ description: TDengine 中使用转义字符的详细规则
1. 普通标识符: 直接提示错误的标识符,因为标识符规定必须是数字、字母和下划线,并且不能以数字开头。
2. 反引号``标识符: 保持原样,不转义
2. 数据里有转义字符
- 1. 遇到上面定义的转义字符会转义(%和\_见下面说明),如果没有匹配的转义字符会忽略掉转义符\。
- 2. 对于%和\_,因为在 like 里这两个字符是通配符,所以在模式匹配 like 里用`\%`%和`\_`表示字符里本身的%和\_,如果在 like 模式匹配上下文之外使用`\%`或`\_`,则它们的计算结果为字符串`\%`和`\_`,而不是%和\_。
+ 1. 遇到上面定义的转义字符会转义(`%`和`_`见下面说明),如果没有匹配的转义字符会忽略掉转义符`\ `(`\x`保持原样)。
+ 2. 对于`%`和`_`,因为在`like`里这两个字符是通配符,所以在模式匹配`like`里用`\%`和`\_`表示字符里本身的`%`和`_`,如果在`like`模式匹配上下文之外使用`\%`或`\_`,则它们的计算结果为字符串`\%`和`\_`,而不是`%`和`_`。
diff --git a/docs/zh/14-reference/12-config/index.md b/docs/zh/14-reference/12-config/index.md
index 27a9618107..4d47f0771c 100755
--- a/docs/zh/14-reference/12-config/index.md
+++ b/docs/zh/14-reference/12-config/index.md
@@ -215,9 +215,10 @@ taos -C
| 属性 | 说明 |
| -------- | ----------------------------------------------------------- |
| 适用范围 | 仅客户端适用 |
-| 含义 | Last、First、LastRow 函数查询时,返回的列名是否包含函数名。 |
-| 取值范围 | 0 表示包含函数名,1 表示不包含函数名。 |
-| 缺省值 | 0 |
+| 含义 | Last、First、LastRow 函数查询且未指定别名时,自动设置别名为列名(不含函数名),因此 order by 子句如果引用了该列名将自动引用该列对应的函数 |
+| 取值范围 | 1 表示自动设置别名为列名(不包含函数名), 0 表示不自动设置别名。 |
+| 缺省值 | 0 |
+| 补充说明 | 当同时出现多个上述函数作用于同一列且未指定别名时,如果 order by 子句引用了该列名,将会因为多列别名相同引发列选择冲突|
### countAlwaysReturnValue
diff --git a/docs/zh/14-reference/13-schemaless/13-schemaless.md b/docs/zh/14-reference/13-schemaless/13-schemaless.md
index 723531676c..47737ab7ee 100644
--- a/docs/zh/14-reference/13-schemaless/13-schemaless.md
+++ b/docs/zh/14-reference/13-schemaless/13-schemaless.md
@@ -87,19 +87,20 @@ st,t1=3,t2=4,t3=t3 c1=3i64,c3="passit",c2=false,c4=4f64 1626006833639000000
1. 将使用如下规则来生成子表名:首先将 measurement 的名称和标签的 key 和 value 组合成为如下的字符串
-```json
-"measurement,tag_key1=tag_value1,tag_key2=tag_value2"
-```
+ ```json
+ "measurement,tag_key1=tag_value1,tag_key2=tag_value2"
+ ```
-:::tip
-需要注意的是,这里的 tag_key1, tag_key2 并不是用户输入的标签的原始顺序,而是使用了标签名称按照字符串升序排列后的结果。所以,tag_key1 并不是在行协议中输入的第一个标签。
-排列完成以后计算该字符串的 MD5 散列值 "md5_val"。然后将计算的结果与字符串组合生成表名:“t_md5_val”。其中的 “t_” 是固定的前缀,每个通过该映射关系自动生成的表都具有该前缀。
-:::tip
-如果不想用自动生成的表名,有两种指定子表名的方式,第一种优先级更高:
-通过在taos.cfg里配置 smlAutoChildTableNameDelimiter 参数来指定(`@ # 空格 回车 换行 制表符`除外)。
-举例如下:配置 smlAutoChildTableNameDelimiter=- 插入数据为 st,t0=cpu1,t1=4 c1=3 1626006833639000000 则创建的表名为 cpu1-4。
-通过在taos.cfg里配置 smlChildTableName 参数来指定。
-举例如下:配置 smlChildTableName=tname 插入数据为 st,tname=cpu1,t1=4 c1=3 1626006833639000000 则创建的表名为 cpu1,注意如果多行数据 tname 相同,但是后面的 tag_set 不同,则使用第一行自动建表时指定的 tag_set,其他的行会忽略)。
+ :::tip
+ 需要注意的是,这里的 tag_key1, tag_key2 并不是用户输入的标签的原始顺序,而是使用了标签名称按照字符串升序排列后的结果。所以,tag_key1 并不是在行协议中输入的第一个标签。
+ 排列完成以后计算该字符串的 MD5 散列值 "md5_val"。然后将计算的结果与字符串组合生成表名:“t_md5_val”。其中的 “t_” 是固定的前缀,每个通过该映射关系自动生成的表都具有该前缀。
+ :::tip
+
+ 如果不想用自动生成的表名,有两种指定子表名的方式(第一种优先级更高)。
+ 1. 通过在taos.cfg里配置 smlAutoChildTableNameDelimiter 参数来指定(`@ # 空格 回车 换行 制表符`除外)。
+ 1. 举例如下:配置 smlAutoChildTableNameDelimiter=- 插入数据为 st,t0=cpu1,t1=4 c1=3 1626006833639000000 则创建的表名为 cpu1-4。
+ 2. 通过在taos.cfg里配置 smlChildTableName 参数来指定。
+ 1. 举例如下:配置 smlChildTableName=tname 插入数据为 st,tname=cpu1,t1=4 c1=3 1626006833639000000 则创建的表名为 cpu1,注意如果多行数据 tname 相同,但是后面的 tag_set 不同,则使用第一行自动建表时指定的 tag_set,其他的行会忽略。
2. 如果解析行协议获得的超级表不存在,则会创建这个超级表(不建议手动创建超级表,不然插入数据可能异常)。
3. 如果解析行协议获得子表不存在,则 Schemaless 会按照步骤 1 或 2 确定的子表名来创建子表。
diff --git a/include/common/systable.h b/include/common/systable.h
index 92e7915424..37593144d8 100644
--- a/include/common/systable.h
+++ b/include/common/systable.h
@@ -52,6 +52,9 @@ extern "C" {
#define TSDB_INS_TABLE_VIEWS "ins_views"
#define TSDB_INS_TABLE_COMPACTS "ins_compacts"
#define TSDB_INS_TABLE_COMPACT_DETAILS "ins_compact_details"
+#define TSDB_INS_TABLE_GRANTS_FULL "ins_grants_full"
+#define TSDB_INS_TABLE_GRANTS_LOGS "ins_grants_logs"
+#define TSDB_INS_TABLE_MACHINES "ins_machines"
#define TSDB_PERFORMANCE_SCHEMA_DB "performance_schema"
#define TSDB_PERFS_TABLE_SMAS "perf_smas"
diff --git a/include/common/tcommon.h b/include/common/tcommon.h
index addb02cd7d..7e7e9b0481 100644
--- a/include/common/tcommon.h
+++ b/include/common/tcommon.h
@@ -207,6 +207,7 @@ typedef struct SDataBlockInfo {
int16_t hasVarCol;
int16_t dataLoad; // denote if the data is loaded or not
uint8_t scanFlag;
+ bool blankFill;
// TODO: optimize and remove following
int64_t version; // used for stream, and need serialization
diff --git a/include/common/tgrant.h b/include/common/tgrant.h
index f06fca8014..dbca2ac90c 100644
--- a/include/common/tgrant.h
+++ b/include/common/tgrant.h
@@ -22,15 +22,14 @@ extern "C" {
#include "os.h"
#include "taoserror.h"
-#ifdef GRANTS_CFG
-#include "tgrantCfg.h"
-#endif
+#include "tdef.h"
#ifndef GRANTS_COL_MAX_LEN
#define GRANTS_COL_MAX_LEN 196
#endif
#define GRANT_HEART_BEAT_MIN 2
+#define GRANT_ACTIVE_CODE "activeCode"
typedef enum {
TSDB_GRANT_ALL,
@@ -48,13 +47,34 @@ typedef enum {
TSDB_GRANT_CPU_CORES,
TSDB_GRANT_STABLE,
TSDB_GRANT_TABLE,
+ TSDB_GRANT_SUBSCRIPTION,
+ TSDB_GRANT_AUDIT,
+ TSDB_GRANT_CSV,
+ TSDB_GRANT_MULTI_TIER,
+ TSDB_GRANT_BACKUP_RESTORE,
} EGrantType;
int32_t grantCheck(EGrantType grant);
+char* tGetMachineId();
+#ifndef TD_UNIQ_GRANT
int32_t grantAlterActiveCode(int32_t did, const char* old, const char* newer, char* out, int8_t type);
+#endif
-#ifndef GRANTS_CFG
+// #ifndef GRANTS_CFG
#ifdef TD_ENTERPRISE
+#ifdef TD_UNIQ_GRANT
+#define GRANTS_SCHEMA \
+ static const SSysDbTableSchema grantsSchema[] = { \
+ {.name = "version", .bytes = 9 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
+ {.name = "expire_time", .bytes = 19 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
+ {.name = "service_time", .bytes = 19 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
+ {.name = "expired", .bytes = 5 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
+ {.name = "state", .bytes = 21 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
+ {.name = "timeseries", .bytes = 21 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
+ {.name = "dnodes", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
+ {.name = "cpu_cores", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
+ }
+#else
#define GRANTS_SCHEMA \
static const SSysDbTableSchema grantsSchema[] = { \
{.name = "version", .bytes = 9 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
@@ -78,33 +98,28 @@ int32_t grantAlterActiveCode(int32_t did, const char* old, const char* newer, ch
{.name = "influxdb", .bytes = GRANTS_COL_MAX_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
{.name = "mqtt", .bytes = GRANTS_COL_MAX_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
}
+#endif
#else
-#define GRANTS_SCHEMA \
- static const SSysDbTableSchema grantsSchema[] = { \
- {.name = "version", .bytes = 9 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
- {.name = "expire_time", .bytes = 19 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
- {.name = "expired", .bytes = 5 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
- {.name = "storage", .bytes = 21 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
- {.name = "timeseries", .bytes = 21 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
- {.name = "databases", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
- {.name = "users", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
- {.name = "accounts", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
- {.name = "dnodes", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
- {.name = "connections", .bytes = 11 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
- {.name = "streams", .bytes = 9 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
- {.name = "cpu_cores", .bytes = 9 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
- {.name = "speed", .bytes = 9 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
- {.name = "querytime", .bytes = 9 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
+#define GRANTS_SCHEMA \
+ static const SSysDbTableSchema grantsSchema[] = { \
+ {.name = "version", .bytes = 9 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
+ {.name = "expire_time", .bytes = 19 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
+ {.name = "service_time", .bytes = 19 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
+ {.name = "expired", .bytes = 5 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
+ {.name = "state", .bytes = 21 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
+ {.name = "timeseries", .bytes = 21 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
+ {.name = "dnodes", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
+ {.name = "cpu_cores", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
}
#endif
-#define GRANT_CFG_ADD
-#define GRANT_CFG_SET
-#define GRANT_CFG_GET
-#define GRANT_CFG_CHECK
-#define GRANT_CFG_SKIP
-#define GRANT_CFG_DECLARE
-#define GRANT_CFG_EXTERN
-#endif
+// #define GRANT_CFG_ADD
+// #define GRANT_CFG_SET
+// #define GRANT_CFG_GET
+// #define GRANT_CFG_CHECK
+// #define GRANT_CFG_SKIP
+// #define GRANT_CFG_DECLARE
+// #define GRANT_CFG_EXTERN
+// #endif
#ifdef __cplusplus
}
diff --git a/include/common/tmisce.h b/include/common/tmisce.h
index 3d1afcd21f..afb33c733a 100644
--- a/include/common/tmisce.h
+++ b/include/common/tmisce.h
@@ -47,10 +47,11 @@ typedef struct SCorEpSet {
int32_t taosGetFqdnPortFromEp(const char* ep, SEp* pEp);
void addEpIntoEpSet(SEpSet* pEpSet, const char* fqdn, uint16_t port);
-bool isEpsetEqual(const SEpSet* s1, const SEpSet* s2);
-void epsetAssign(SEpSet* dst, const SEpSet* pSrc);
-void updateEpSet_s(SCorEpSet* pEpSet, SEpSet* pNewEpSet);
-SEpSet getEpSet_s(SCorEpSet* pEpSet);
+bool isEpsetEqual(const SEpSet* s1, const SEpSet* s2);
+void epsetAssign(SEpSet* dst, const SEpSet* pSrc);
+void updateEpSet_s(SCorEpSet* pEpSet, SEpSet* pNewEpSet);
+SEpSet getEpSet_s(SCorEpSet* pEpSet);
+void epsetSort(SEpSet* pEpSet);
#ifdef __cplusplus
}
diff --git a/include/common/tmsg.h b/include/common/tmsg.h
index 20f64c1f79..7115819dd1 100644
--- a/include/common/tmsg.h
+++ b/include/common/tmsg.h
@@ -147,6 +147,9 @@ typedef enum _mgmt_table {
TSDB_MGMT_TABLE_VIEWS,
TSDB_MGMT_TABLE_COMPACT,
TSDB_MGMT_TABLE_COMPACT_DETAIL,
+ TSDB_MGMT_TABLE_GRANTS_FULL,
+ TSDB_MGMT_TABLE_GRANTS_LOGS,
+ TSDB_MGMT_TABLE_MACHINES,
TSDB_MGMT_TABLE_MAX,
} EShowType;
@@ -298,7 +301,8 @@ typedef enum ENodeType {
QUERY_NODE_SYNCDB_STMT,
QUERY_NODE_GRANT_STMT,
QUERY_NODE_REVOKE_STMT,
- // placeholder for [152, 180]
+ QUERY_NODE_ALTER_CLUSTER_STMT,
+ // placeholder for [153, 180]
QUERY_NODE_SHOW_CREATE_VIEW_STMT = 181,
QUERY_NODE_SHOW_CREATE_DATABASE_STMT,
QUERY_NODE_SHOW_CREATE_TABLE_STMT,
@@ -359,6 +363,9 @@ typedef enum ENodeType {
QUERY_NODE_SHOW_VIEWS_STMT,
QUERY_NODE_SHOW_COMPACTS_STMT,
QUERY_NODE_SHOW_COMPACT_DETAILS_STMT,
+ QUERY_NODE_SHOW_GRANTS_FULL_STMT,
+ QUERY_NODE_SHOW_GRANTS_LOGS_STMT,
+ QUERY_NODE_SHOW_CLUSTER_MACHINES_STMT,
// logic plan node
QUERY_NODE_LOGIC_PLAN_SCAN = 1000,
@@ -1558,9 +1565,11 @@ typedef struct {
int64_t updateTime;
float numOfCores;
int32_t numOfSupportVnodes;
+ int32_t numOfDiskCfg;
int64_t memTotal;
int64_t memAvail;
char dnodeEp[TSDB_EP_LEN];
+ char machineId[TSDB_MACHINE_ID_LEN + 1];
SMnodeLoad mload;
SQnodeLoad qload;
SClusterCfg clusterCfg;
@@ -1601,6 +1610,7 @@ typedef struct {
SEp ep;
char active[TSDB_ACTIVE_KEY_LEN];
char connActive[TSDB_CONN_ACTIVE_KEY_LEN];
+ char machineId[TSDB_MACHINE_ID_LEN + 1];
} SDnodeInfo;
typedef struct {
@@ -1976,6 +1986,14 @@ typedef struct {
char data[];
} SRetrieveTableRsp;
+typedef struct {
+ int64_t version;
+ int64_t numOfRows;
+ int8_t compressed;
+ int8_t precision;
+ char data[];
+} SRetrieveTableRspForTmq;
+
typedef struct {
int64_t handle;
int64_t useconds;
@@ -2024,6 +2042,17 @@ int32_t tSerializeSExplainRsp(void* buf, int32_t bufLen, SExplainRsp* pRsp);
int32_t tDeserializeSExplainRsp(void* buf, int32_t bufLen, SExplainRsp* pRsp);
void tFreeSExplainRsp(SExplainRsp* pRsp);
+typedef struct {
+ char config[TSDB_DNODE_CONFIG_LEN];
+ char value[TSDB_CLUSTER_VALUE_LEN];
+ int32_t sqlLen;
+ char* sql;
+} SMCfgClusterReq;
+
+int32_t tSerializeSMCfgClusterReq(void* buf, int32_t bufLen, SMCfgClusterReq* pReq);
+int32_t tDeserializeSMCfgClusterReq(void* buf, int32_t bufLen, SMCfgClusterReq* pReq);
+void tFreeSMCfgClusterReq(SMCfgClusterReq* pReq);
+
typedef struct {
char fqdn[TSDB_FQDN_LEN]; // end point, hostname:port
int32_t port;
@@ -3324,7 +3353,7 @@ typedef struct {
SMsgHead head;
int64_t streamId;
int32_t taskId;
-} SVPauseStreamTaskReq, SVResetStreamTaskReq, SVDropHTaskReq;
+} SVPauseStreamTaskReq, SVResetStreamTaskReq;
typedef struct {
int8_t reserved;
@@ -3747,7 +3776,12 @@ typedef struct {
} SMqHbReq;
typedef struct {
- int8_t reserved;
+ char topic[TSDB_TOPIC_FNAME_LEN];
+ int8_t noPrivilege;
+} STopicPrivilege;
+
+typedef struct {
+ SArray* topicPrivileges; // SArray
} SMqHbRsp;
typedef struct {
@@ -3766,18 +3800,6 @@ typedef struct {
SVCreateTbReq cTbReq;
} SVSubmitBlk;
-typedef struct {
- int32_t flags;
- int32_t nBlocks;
- union {
- SArray* pArray;
- SVSubmitBlk* pBlocks;
- };
-} SVSubmitReq;
-
-int32_t tEncodeSVSubmitReq(SEncoder* pCoder, const SVSubmitReq* pReq);
-int32_t tDecodeSVSubmitReq(SDecoder* pCoder, SVSubmitReq* pReq);
-
typedef struct {
SMsgHead header;
uint64_t sId;
@@ -3886,6 +3908,10 @@ int32_t tSerializeSMqHbReq(void* buf, int32_t bufLen, SMqHbReq* pReq);
int32_t tDeserializeSMqHbReq(void* buf, int32_t bufLen, SMqHbReq* pReq);
int32_t tDeatroySMqHbReq(SMqHbReq* pReq);
+int32_t tSerializeSMqHbRsp(void* buf, int32_t bufLen, SMqHbRsp* pRsp);
+int32_t tDeserializeSMqHbRsp(void* buf, int32_t bufLen, SMqHbRsp* pRsp);
+int32_t tDeatroySMqHbRsp(SMqHbRsp* pRsp);
+
int32_t tSerializeSMqSeekReq(void* buf, int32_t bufLen, SMqSeekReq* pReq);
int32_t tDeserializeSMqSeekReq(void* buf, int32_t bufLen, SMqSeekReq* pReq);
diff --git a/include/common/tmsgdef.h b/include/common/tmsgdef.h
index 24ad5abded..dc5cb24564 100644
--- a/include/common/tmsgdef.h
+++ b/include/common/tmsgdef.h
@@ -217,6 +217,8 @@
TD_DEF_MSG_TYPE(TDMT_MND_VIEW_META, "view-meta", NULL, NULL)
TD_DEF_MSG_TYPE(TDMT_MND_KILL_COMPACT, "kill-compact", SKillCompactReq, NULL)
TD_DEF_MSG_TYPE(TDMT_MND_COMPACT_TIMER, "compact-tmr", NULL, NULL)
+ TD_DEF_MSG_TYPE(TDMT_MND_STREAM_REQ_CHKPT, "stream-req-checkpoint", NULL, NULL)
+ TD_DEF_MSG_TYPE(TDMT_MND_CONFIG_CLUSTER, "config-cluster", NULL, NULL)
TD_DEF_MSG_TYPE(TDMT_MND_MAX_MSG, "mnd-max", NULL, NULL)
TD_CLOSE_MSG_SEG(TDMT_END_MND_MSG)
@@ -301,7 +303,6 @@
TD_DEF_MSG_TYPE(TDMT_STREAM_TASK_PAUSE, "stream-task-pause", NULL, NULL)
TD_DEF_MSG_TYPE(TDMT_STREAM_TASK_RESUME, "stream-task-resume", NULL, NULL)
TD_DEF_MSG_TYPE(TDMT_STREAM_TASK_STOP, "stream-task-stop", NULL, NULL)
- TD_DEF_MSG_TYPE(TDMT_STREAM_HTASK_DROP, "stream-htask-drop", NULL, NULL)
TD_DEF_MSG_TYPE(TDMT_STREAM_MAX_MSG, "stream-max", NULL, NULL)
TD_CLOSE_MSG_SEG(TDMT_END_STREAM_MSG)
@@ -337,13 +338,13 @@
TD_DEF_MSG_TYPE(TDMT_SYNC_LOCAL_CMD, "sync-local-cmd", NULL, NULL)
TD_DEF_MSG_TYPE(TDMT_SYNC_PREP_SNAPSHOT, "sync-prep-snapshot", NULL, NULL)
TD_DEF_MSG_TYPE(TDMT_SYNC_PREP_SNAPSHOT_REPLY, "sync-prep-snapshot-reply", NULL, NULL)
- TD_DEF_MSG_TYPE(TDMT_SYNC_MAX_MSG, "sync-max", NULL, NULL)
+ TD_DEF_MSG_TYPE(TDMT_SYNC_UNUSED_CODE, "sync-unused", NULL, NULL)
TD_DEF_MSG_TYPE(TDMT_SYNC_FORCE_FOLLOWER, "sync-force-become-follower", NULL, NULL)
+ TD_DEF_MSG_TYPE(TDMT_SYNC_MAX_MSG, "sync-max", NULL, NULL)
TD_CLOSE_MSG_SEG(TDMT_END_SYNC_MSG)
TD_NEW_MSG_SEG(TDMT_VND_STREAM_MSG) //7 << 8
TD_DEF_MSG_TYPE(TDMT_VND_STREAM_SCAN_HISTORY, "vnode-stream-scan-history", NULL, NULL)
- TD_DEF_MSG_TYPE(TDMT_VND_STREAM_SCAN_HISTORY_FINISH, "vnode-stream-scan-history-finish", NULL, NULL)
TD_DEF_MSG_TYPE(TDMT_VND_STREAM_CHECK_POINT_SOURCE, "vnode-stream-checkpoint-source", NULL, NULL)
TD_DEF_MSG_TYPE(TDMT_VND_STREAM_TASK_UPDATE, "vnode-stream-update", NULL, NULL)
TD_DEF_MSG_TYPE(TDMT_VND_STREAM_TASK_RESET, "vnode-stream-reset", NULL, NULL)
diff --git a/include/common/ttokendef.h b/include/common/ttokendef.h
index 445fe0737b..5f0538ce17 100644
--- a/include/common/ttokendef.h
+++ b/include/common/ttokendef.h
@@ -74,295 +74,298 @@
#define TK_NK_IPTOKEN 55
#define TK_FORCE 56
#define TK_UNSAFE 57
-#define TK_LOCAL 58
-#define TK_QNODE 59
-#define TK_BNODE 60
-#define TK_SNODE 61
-#define TK_MNODE 62
-#define TK_VNODE 63
-#define TK_DATABASE 64
-#define TK_USE 65
-#define TK_FLUSH 66
-#define TK_TRIM 67
-#define TK_COMPACT 68
-#define TK_IF 69
-#define TK_NOT 70
-#define TK_EXISTS 71
-#define TK_BUFFER 72
-#define TK_CACHEMODEL 73
-#define TK_CACHESIZE 74
-#define TK_COMP 75
-#define TK_DURATION 76
-#define TK_NK_VARIABLE 77
-#define TK_MAXROWS 78
-#define TK_MINROWS 79
-#define TK_KEEP 80
-#define TK_PAGES 81
-#define TK_PAGESIZE 82
-#define TK_TSDB_PAGESIZE 83
-#define TK_PRECISION 84
-#define TK_REPLICA 85
-#define TK_VGROUPS 86
-#define TK_SINGLE_STABLE 87
-#define TK_RETENTIONS 88
-#define TK_SCHEMALESS 89
-#define TK_WAL_LEVEL 90
-#define TK_WAL_FSYNC_PERIOD 91
-#define TK_WAL_RETENTION_PERIOD 92
-#define TK_WAL_RETENTION_SIZE 93
-#define TK_WAL_ROLL_PERIOD 94
-#define TK_WAL_SEGMENT_SIZE 95
-#define TK_STT_TRIGGER 96
-#define TK_TABLE_PREFIX 97
-#define TK_TABLE_SUFFIX 98
-#define TK_KEEP_TIME_OFFSET 99
-#define TK_NK_COLON 100
-#define TK_BWLIMIT 101
-#define TK_START 102
-#define TK_TIMESTAMP 103
-#define TK_END 104
-#define TK_TABLE 105
-#define TK_NK_LP 106
-#define TK_NK_RP 107
-#define TK_STABLE 108
-#define TK_COLUMN 109
-#define TK_MODIFY 110
-#define TK_RENAME 111
-#define TK_TAG 112
-#define TK_SET 113
-#define TK_NK_EQ 114
-#define TK_USING 115
-#define TK_TAGS 116
-#define TK_BOOL 117
-#define TK_TINYINT 118
-#define TK_SMALLINT 119
-#define TK_INT 120
-#define TK_INTEGER 121
-#define TK_BIGINT 122
-#define TK_FLOAT 123
-#define TK_DOUBLE 124
-#define TK_BINARY 125
-#define TK_NCHAR 126
-#define TK_UNSIGNED 127
-#define TK_JSON 128
-#define TK_VARCHAR 129
-#define TK_MEDIUMBLOB 130
-#define TK_BLOB 131
-#define TK_VARBINARY 132
-#define TK_GEOMETRY 133
-#define TK_DECIMAL 134
-#define TK_COMMENT 135
-#define TK_MAX_DELAY 136
-#define TK_WATERMARK 137
-#define TK_ROLLUP 138
-#define TK_TTL 139
-#define TK_SMA 140
-#define TK_DELETE_MARK 141
-#define TK_FIRST 142
-#define TK_LAST 143
-#define TK_SHOW 144
-#define TK_PRIVILEGES 145
-#define TK_DATABASES 146
-#define TK_TABLES 147
-#define TK_STABLES 148
-#define TK_MNODES 149
-#define TK_QNODES 150
-#define TK_FUNCTIONS 151
-#define TK_INDEXES 152
-#define TK_ACCOUNTS 153
-#define TK_APPS 154
-#define TK_CONNECTIONS 155
-#define TK_LICENCES 156
-#define TK_GRANTS 157
-#define TK_QUERIES 158
-#define TK_SCORES 159
-#define TK_TOPICS 160
-#define TK_VARIABLES 161
-#define TK_CLUSTER 162
-#define TK_BNODES 163
-#define TK_SNODES 164
-#define TK_TRANSACTIONS 165
-#define TK_DISTRIBUTED 166
-#define TK_CONSUMERS 167
-#define TK_SUBSCRIPTIONS 168
-#define TK_VNODES 169
-#define TK_ALIVE 170
-#define TK_VIEWS 171
-#define TK_VIEW 172
-#define TK_COMPACTS 173
-#define TK_NORMAL 174
-#define TK_CHILD 175
-#define TK_LIKE 176
-#define TK_TBNAME 177
-#define TK_QTAGS 178
-#define TK_AS 179
-#define TK_SYSTEM 180
-#define TK_INDEX 181
-#define TK_FUNCTION 182
-#define TK_INTERVAL 183
-#define TK_COUNT 184
-#define TK_LAST_ROW 185
-#define TK_META 186
-#define TK_ONLY 187
-#define TK_TOPIC 188
-#define TK_CONSUMER 189
-#define TK_GROUP 190
-#define TK_DESC 191
-#define TK_DESCRIBE 192
-#define TK_RESET 193
-#define TK_QUERY 194
-#define TK_CACHE 195
-#define TK_EXPLAIN 196
-#define TK_ANALYZE 197
-#define TK_VERBOSE 198
-#define TK_NK_BOOL 199
-#define TK_RATIO 200
-#define TK_NK_FLOAT 201
-#define TK_OUTPUTTYPE 202
-#define TK_AGGREGATE 203
-#define TK_BUFSIZE 204
-#define TK_LANGUAGE 205
-#define TK_REPLACE 206
-#define TK_STREAM 207
-#define TK_INTO 208
-#define TK_PAUSE 209
-#define TK_RESUME 210
-#define TK_TRIGGER 211
-#define TK_AT_ONCE 212
-#define TK_WINDOW_CLOSE 213
-#define TK_IGNORE 214
-#define TK_EXPIRED 215
-#define TK_FILL_HISTORY 216
-#define TK_UPDATE 217
-#define TK_SUBTABLE 218
-#define TK_UNTREATED 219
-#define TK_KILL 220
-#define TK_CONNECTION 221
-#define TK_TRANSACTION 222
-#define TK_BALANCE 223
-#define TK_VGROUP 224
-#define TK_LEADER 225
-#define TK_MERGE 226
-#define TK_REDISTRIBUTE 227
-#define TK_SPLIT 228
-#define TK_DELETE 229
-#define TK_INSERT 230
-#define TK_NULL 231
-#define TK_NK_QUESTION 232
-#define TK_NK_ALIAS 233
-#define TK_NK_ARROW 234
-#define TK_ROWTS 235
-#define TK_QSTART 236
-#define TK_QEND 237
-#define TK_QDURATION 238
-#define TK_WSTART 239
-#define TK_WEND 240
-#define TK_WDURATION 241
-#define TK_IROWTS 242
-#define TK_ISFILLED 243
-#define TK_CAST 244
-#define TK_NOW 245
-#define TK_TODAY 246
-#define TK_TIMEZONE 247
-#define TK_CLIENT_VERSION 248
-#define TK_SERVER_VERSION 249
-#define TK_SERVER_STATUS 250
-#define TK_CURRENT_USER 251
-#define TK_CASE 252
-#define TK_WHEN 253
-#define TK_THEN 254
-#define TK_ELSE 255
-#define TK_BETWEEN 256
-#define TK_IS 257
-#define TK_NK_LT 258
-#define TK_NK_GT 259
-#define TK_NK_LE 260
-#define TK_NK_GE 261
-#define TK_NK_NE 262
-#define TK_MATCH 263
-#define TK_NMATCH 264
-#define TK_CONTAINS 265
-#define TK_IN 266
-#define TK_JOIN 267
-#define TK_INNER 268
-#define TK_SELECT 269
-#define TK_NK_HINT 270
-#define TK_DISTINCT 271
-#define TK_WHERE 272
-#define TK_PARTITION 273
-#define TK_BY 274
-#define TK_SESSION 275
-#define TK_STATE_WINDOW 276
-#define TK_EVENT_WINDOW 277
-#define TK_SLIDING 278
-#define TK_FILL 279
-#define TK_VALUE 280
-#define TK_VALUE_F 281
-#define TK_NONE 282
-#define TK_PREV 283
-#define TK_NULL_F 284
-#define TK_LINEAR 285
-#define TK_NEXT 286
-#define TK_HAVING 287
-#define TK_RANGE 288
-#define TK_EVERY 289
-#define TK_ORDER 290
-#define TK_SLIMIT 291
-#define TK_SOFFSET 292
-#define TK_LIMIT 293
-#define TK_OFFSET 294
-#define TK_ASC 295
-#define TK_NULLS 296
-#define TK_ABORT 297
-#define TK_AFTER 298
-#define TK_ATTACH 299
-#define TK_BEFORE 300
-#define TK_BEGIN 301
-#define TK_BITAND 302
-#define TK_BITNOT 303
-#define TK_BITOR 304
-#define TK_BLOCKS 305
-#define TK_CHANGE 306
-#define TK_COMMA 307
-#define TK_CONCAT 308
-#define TK_CONFLICT 309
-#define TK_COPY 310
-#define TK_DEFERRED 311
-#define TK_DELIMITERS 312
-#define TK_DETACH 313
-#define TK_DIVIDE 314
-#define TK_DOT 315
-#define TK_EACH 316
-#define TK_FAIL 317
-#define TK_FILE 318
-#define TK_FOR 319
-#define TK_GLOB 320
-#define TK_ID 321
-#define TK_IMMEDIATE 322
-#define TK_IMPORT 323
-#define TK_INITIALLY 324
-#define TK_INSTEAD 325
-#define TK_ISNULL 326
-#define TK_KEY 327
-#define TK_MODULES 328
-#define TK_NK_BITNOT 329
-#define TK_NK_SEMI 330
-#define TK_NOTNULL 331
-#define TK_OF 332
-#define TK_PLUS 333
-#define TK_PRIVILEGE 334
-#define TK_RAISE 335
-#define TK_RESTRICT 336
-#define TK_ROW 337
-#define TK_SEMI 338
-#define TK_STAR 339
-#define TK_STATEMENT 340
-#define TK_STRICT 341
-#define TK_STRING 342
-#define TK_TIMES 343
-#define TK_VALUES 344
-#define TK_VARIABLE 345
-#define TK_WAL 346
+#define TK_CLUSTER 58
+#define TK_LOCAL 59
+#define TK_QNODE 60
+#define TK_BNODE 61
+#define TK_SNODE 62
+#define TK_MNODE 63
+#define TK_VNODE 64
+#define TK_DATABASE 65
+#define TK_USE 66
+#define TK_FLUSH 67
+#define TK_TRIM 68
+#define TK_COMPACT 69
+#define TK_IF 70
+#define TK_NOT 71
+#define TK_EXISTS 72
+#define TK_BUFFER 73
+#define TK_CACHEMODEL 74
+#define TK_CACHESIZE 75
+#define TK_COMP 76
+#define TK_DURATION 77
+#define TK_NK_VARIABLE 78
+#define TK_MAXROWS 79
+#define TK_MINROWS 80
+#define TK_KEEP 81
+#define TK_PAGES 82
+#define TK_PAGESIZE 83
+#define TK_TSDB_PAGESIZE 84
+#define TK_PRECISION 85
+#define TK_REPLICA 86
+#define TK_VGROUPS 87
+#define TK_SINGLE_STABLE 88
+#define TK_RETENTIONS 89
+#define TK_SCHEMALESS 90
+#define TK_WAL_LEVEL 91
+#define TK_WAL_FSYNC_PERIOD 92
+#define TK_WAL_RETENTION_PERIOD 93
+#define TK_WAL_RETENTION_SIZE 94
+#define TK_WAL_ROLL_PERIOD 95
+#define TK_WAL_SEGMENT_SIZE 96
+#define TK_STT_TRIGGER 97
+#define TK_TABLE_PREFIX 98
+#define TK_TABLE_SUFFIX 99
+#define TK_KEEP_TIME_OFFSET 100
+#define TK_NK_COLON 101
+#define TK_BWLIMIT 102
+#define TK_START 103
+#define TK_TIMESTAMP 104
+#define TK_END 105
+#define TK_TABLE 106
+#define TK_NK_LP 107
+#define TK_NK_RP 108
+#define TK_STABLE 109
+#define TK_COLUMN 110
+#define TK_MODIFY 111
+#define TK_RENAME 112
+#define TK_TAG 113
+#define TK_SET 114
+#define TK_NK_EQ 115
+#define TK_USING 116
+#define TK_TAGS 117
+#define TK_BOOL 118
+#define TK_TINYINT 119
+#define TK_SMALLINT 120
+#define TK_INT 121
+#define TK_INTEGER 122
+#define TK_BIGINT 123
+#define TK_FLOAT 124
+#define TK_DOUBLE 125
+#define TK_BINARY 126
+#define TK_NCHAR 127
+#define TK_UNSIGNED 128
+#define TK_JSON 129
+#define TK_VARCHAR 130
+#define TK_MEDIUMBLOB 131
+#define TK_BLOB 132
+#define TK_VARBINARY 133
+#define TK_GEOMETRY 134
+#define TK_DECIMAL 135
+#define TK_COMMENT 136
+#define TK_MAX_DELAY 137
+#define TK_WATERMARK 138
+#define TK_ROLLUP 139
+#define TK_TTL 140
+#define TK_SMA 141
+#define TK_DELETE_MARK 142
+#define TK_FIRST 143
+#define TK_LAST 144
+#define TK_SHOW 145
+#define TK_PRIVILEGES 146
+#define TK_DATABASES 147
+#define TK_TABLES 148
+#define TK_STABLES 149
+#define TK_MNODES 150
+#define TK_QNODES 151
+#define TK_FUNCTIONS 152
+#define TK_INDEXES 153
+#define TK_ACCOUNTS 154
+#define TK_APPS 155
+#define TK_CONNECTIONS 156
+#define TK_LICENCES 157
+#define TK_GRANTS 158
+#define TK_FULL 159
+#define TK_LOGS 160
+#define TK_MACHINES 161
+#define TK_QUERIES 162
+#define TK_SCORES 163
+#define TK_TOPICS 164
+#define TK_VARIABLES 165
+#define TK_BNODES 166
+#define TK_SNODES 167
+#define TK_TRANSACTIONS 168
+#define TK_DISTRIBUTED 169
+#define TK_CONSUMERS 170
+#define TK_SUBSCRIPTIONS 171
+#define TK_VNODES 172
+#define TK_ALIVE 173
+#define TK_VIEWS 174
+#define TK_VIEW 175
+#define TK_COMPACTS 176
+#define TK_NORMAL 177
+#define TK_CHILD 178
+#define TK_LIKE 179
+#define TK_TBNAME 180
+#define TK_QTAGS 181
+#define TK_AS 182
+#define TK_SYSTEM 183
+#define TK_INDEX 184
+#define TK_FUNCTION 185
+#define TK_INTERVAL 186
+#define TK_COUNT 187
+#define TK_LAST_ROW 188
+#define TK_META 189
+#define TK_ONLY 190
+#define TK_TOPIC 191
+#define TK_CONSUMER 192
+#define TK_GROUP 193
+#define TK_DESC 194
+#define TK_DESCRIBE 195
+#define TK_RESET 196
+#define TK_QUERY 197
+#define TK_CACHE 198
+#define TK_EXPLAIN 199
+#define TK_ANALYZE 200
+#define TK_VERBOSE 201
+#define TK_NK_BOOL 202
+#define TK_RATIO 203
+#define TK_NK_FLOAT 204
+#define TK_OUTPUTTYPE 205
+#define TK_AGGREGATE 206
+#define TK_BUFSIZE 207
+#define TK_LANGUAGE 208
+#define TK_REPLACE 209
+#define TK_STREAM 210
+#define TK_INTO 211
+#define TK_PAUSE 212
+#define TK_RESUME 213
+#define TK_TRIGGER 214
+#define TK_AT_ONCE 215
+#define TK_WINDOW_CLOSE 216
+#define TK_IGNORE 217
+#define TK_EXPIRED 218
+#define TK_FILL_HISTORY 219
+#define TK_UPDATE 220
+#define TK_SUBTABLE 221
+#define TK_UNTREATED 222
+#define TK_KILL 223
+#define TK_CONNECTION 224
+#define TK_TRANSACTION 225
+#define TK_BALANCE 226
+#define TK_VGROUP 227
+#define TK_LEADER 228
+#define TK_MERGE 229
+#define TK_REDISTRIBUTE 230
+#define TK_SPLIT 231
+#define TK_DELETE 232
+#define TK_INSERT 233
+#define TK_NULL 234
+#define TK_NK_QUESTION 235
+#define TK_NK_ALIAS 236
+#define TK_NK_ARROW 237
+#define TK_ROWTS 238
+#define TK_QSTART 239
+#define TK_QEND 240
+#define TK_QDURATION 241
+#define TK_WSTART 242
+#define TK_WEND 243
+#define TK_WDURATION 244
+#define TK_IROWTS 245
+#define TK_ISFILLED 246
+#define TK_CAST 247
+#define TK_NOW 248
+#define TK_TODAY 249
+#define TK_TIMEZONE 250
+#define TK_CLIENT_VERSION 251
+#define TK_SERVER_VERSION 252
+#define TK_SERVER_STATUS 253
+#define TK_CURRENT_USER 254
+#define TK_CASE 255
+#define TK_WHEN 256
+#define TK_THEN 257
+#define TK_ELSE 258
+#define TK_BETWEEN 259
+#define TK_IS 260
+#define TK_NK_LT 261
+#define TK_NK_GT 262
+#define TK_NK_LE 263
+#define TK_NK_GE 264
+#define TK_NK_NE 265
+#define TK_MATCH 266
+#define TK_NMATCH 267
+#define TK_CONTAINS 268
+#define TK_IN 269
+#define TK_JOIN 270
+#define TK_INNER 271
+#define TK_SELECT 272
+#define TK_NK_HINT 273
+#define TK_DISTINCT 274
+#define TK_WHERE 275
+#define TK_PARTITION 276
+#define TK_BY 277
+#define TK_SESSION 278
+#define TK_STATE_WINDOW 279
+#define TK_EVENT_WINDOW 280
+#define TK_SLIDING 281
+#define TK_FILL 282
+#define TK_VALUE 283
+#define TK_VALUE_F 284
+#define TK_NONE 285
+#define TK_PREV 286
+#define TK_NULL_F 287
+#define TK_LINEAR 288
+#define TK_NEXT 289
+#define TK_HAVING 290
+#define TK_RANGE 291
+#define TK_EVERY 292
+#define TK_ORDER 293
+#define TK_SLIMIT 294
+#define TK_SOFFSET 295
+#define TK_LIMIT 296
+#define TK_OFFSET 297
+#define TK_ASC 298
+#define TK_NULLS 299
+#define TK_ABORT 300
+#define TK_AFTER 301
+#define TK_ATTACH 302
+#define TK_BEFORE 303
+#define TK_BEGIN 304
+#define TK_BITAND 305
+#define TK_BITNOT 306
+#define TK_BITOR 307
+#define TK_BLOCKS 308
+#define TK_CHANGE 309
+#define TK_COMMA 310
+#define TK_CONCAT 311
+#define TK_CONFLICT 312
+#define TK_COPY 313
+#define TK_DEFERRED 314
+#define TK_DELIMITERS 315
+#define TK_DETACH 316
+#define TK_DIVIDE 317
+#define TK_DOT 318
+#define TK_EACH 319
+#define TK_FAIL 320
+#define TK_FILE 321
+#define TK_FOR 322
+#define TK_GLOB 323
+#define TK_ID 324
+#define TK_IMMEDIATE 325
+#define TK_IMPORT 326
+#define TK_INITIALLY 327
+#define TK_INSTEAD 328
+#define TK_ISNULL 329
+#define TK_KEY 330
+#define TK_MODULES 331
+#define TK_NK_BITNOT 332
+#define TK_NK_SEMI 333
+#define TK_NOTNULL 334
+#define TK_OF 335
+#define TK_PLUS 336
+#define TK_PRIVILEGE 337
+#define TK_RAISE 338
+#define TK_RESTRICT 339
+#define TK_ROW 340
+#define TK_SEMI 341
+#define TK_STAR 342
+#define TK_STATEMENT 343
+#define TK_STRICT 344
+#define TK_STRING 345
+#define TK_TIMES 346
+#define TK_VALUES 347
+#define TK_VARIABLE 348
+#define TK_WAL 349
#define TK_NK_SPACE 600
#define TK_NK_COMMENT 601
diff --git a/include/dnode/vnode/tqCommon.h b/include/dnode/vnode/tqCommon.h
index 50458d684f..dc145819ca 100644
--- a/include/dnode/vnode/tqCommon.h
+++ b/include/dnode/vnode/tqCommon.h
@@ -23,8 +23,6 @@ int32_t tqStreamTaskProcessUpdateReq(SStreamMeta* pMeta, SMsgCb* cb, SRpcMsg* pM
int32_t tqStreamTaskProcessDispatchReq(SStreamMeta* pMeta, SRpcMsg* pMsg);
int32_t tqStreamTaskProcessDispatchRsp(SStreamMeta* pMeta, SRpcMsg* pMsg);
int32_t tqStreamTaskProcessRetrieveReq(SStreamMeta* pMeta, SRpcMsg* pMsg);
-int32_t tqStreamTaskProcessScanHistoryFinishReq(SStreamMeta* pMeta, SRpcMsg* pMsg);
-int32_t tqStreamTaskProcessScanHistoryFinishRsp(SStreamMeta* pMeta, SRpcMsg* pMsg);
int32_t tqStreamTaskProcessCheckReq(SStreamMeta* pMeta, SRpcMsg* pMsg);
int32_t tqStreamTaskProcessCheckRsp(SStreamMeta* pMeta, SRpcMsg* pMsg, bool isLeader);
int32_t tqStreamTaskProcessCheckpointReadyMsg(SStreamMeta* pMeta, SRpcMsg* pMsg);
diff --git a/include/libs/executor/executor.h b/include/libs/executor/executor.h
index be11d04ff8..f78b7a3126 100644
--- a/include/libs/executor/executor.h
+++ b/include/libs/executor/executor.h
@@ -210,7 +210,6 @@ void* qExtractReaderFromStreamScanner(void* scanner);
int32_t qExtractStreamScanner(qTaskInfo_t tinfo, void** scanner);
int32_t qSetStreamOperatorOptionForScanHistory(qTaskInfo_t tinfo);
-int32_t qResetStreamOperatorOptionForScanHistory(qTaskInfo_t tinfo);
int32_t qStreamSourceScanParamForHistoryScanStep1(qTaskInfo_t tinfo, SVersionRange *pVerRange, STimeWindow* pWindow);
int32_t qStreamSourceScanParamForHistoryScanStep2(qTaskInfo_t tinfo, SVersionRange *pVerRange, STimeWindow* pWindow);
int32_t qStreamRecoverFinish(qTaskInfo_t tinfo);
diff --git a/include/libs/function/function.h b/include/libs/function/function.h
index 8863201094..0fa84c99c6 100644
--- a/include/libs/function/function.h
+++ b/include/libs/function/function.h
@@ -114,6 +114,7 @@ typedef struct SInputColumnInfoData {
int32_t totalRows; // total rows in current columnar data
int32_t startRowIndex; // handle started row index
int64_t numOfRows; // the number of rows needs to be handled
+ bool blankFill; // fill blank data to block for empty table
int32_t numOfInputCols; // PTS is not included
bool colDataSMAIsSet; // if agg is set or not
SColumnInfoData *pPTS; // primary timestamp column
diff --git a/include/libs/nodes/cmdnodes.h b/include/libs/nodes/cmdnodes.h
index 6aa1796963..9a12d7b98f 100644
--- a/include/libs/nodes/cmdnodes.h
+++ b/include/libs/nodes/cmdnodes.h
@@ -420,6 +420,12 @@ typedef struct SDropCGroupStmt {
bool ignoreNotExists;
} SDropCGroupStmt;
+typedef struct SAlterClusterStmt {
+ ENodeType type;
+ char config[TSDB_DNODE_CONFIG_LEN];
+ char value[TSDB_CLUSTER_VALUE_LEN];
+} SAlterClusterStmt;
+
typedef struct SAlterLocalStmt {
ENodeType type;
char config[TSDB_DNODE_CONFIG_LEN];
diff --git a/include/libs/parser/parser.h b/include/libs/parser/parser.h
index 177607b178..bb206b5a02 100644
--- a/include/libs/parser/parser.h
+++ b/include/libs/parser/parser.h
@@ -150,7 +150,7 @@ int32_t smlBindData(SQuery* handle, bool dataFormat, SArray* tags, SArray* colsS
STableMeta* pTableMeta, char* tableName, const char* sTableName, int32_t sTableNameLen, int32_t ttl,
char* msgBuf, int32_t msgBufLen);
int32_t smlBuildOutput(SQuery* handle, SHashObj* pVgHash);
-int rawBlockBindData(SQuery *query, STableMeta* pTableMeta, void* data, SVCreateTbReq* pCreateTb, TAOS_FIELD *fields, int numFields, bool needChangeLength);
+int rawBlockBindData(SQuery *query, STableMeta* pTableMeta, void* data, SVCreateTbReq** pCreateTb, TAOS_FIELD *fields, int numFields, bool needChangeLength);
int32_t rewriteToVnodeModifyOpStmt(SQuery* pQuery, SArray* pBufArray);
SArray* serializeVgroupsCreateTableBatch(SHashObj* pVgroupHashmap);
diff --git a/include/libs/stream/tstream.h b/include/libs/stream/tstream.h
index c1131a62a4..3fb9819c9d 100644
--- a/include/libs/stream/tstream.h
+++ b/include/libs/stream/tstream.h
@@ -324,12 +324,13 @@ typedef struct SStreamStatus {
int8_t taskStatus;
int8_t downstreamReady; // downstream tasks are all ready now, if this flag is set
int8_t schedStatus;
- int32_t schedIdleTime; // idle time before invoke again
- int64_t lastExecTs; // last exec time stamp
int8_t statusBackup;
- bool appendTranstateBlock; // has append the transfer state data block already
- int32_t timerActive; // timer is active
+ int32_t schedIdleTime; // idle time before invoke again
+ int32_t timerActive; // timer is active
+ int64_t lastExecTs; // last exec time stamp
int32_t inScanHistorySentinel;
+ bool appendTranstateBlock; // has append the transfer state data block already
+ bool supplementaryWalscan; // complete the supplementary wal scan or not
} SStreamStatus;
typedef struct SDataRange {
@@ -462,7 +463,6 @@ struct SStreamTask {
struct SStreamMeta* pMeta;
SSHashObj* pNameMap;
void* pBackend;
- int64_t backendRefId;
char reserve[256];
};
@@ -629,17 +629,7 @@ typedef struct {
int8_t igUntreated;
} SStreamScanHistoryReq;
-typedef struct {
- int64_t streamId;
- int32_t upstreamTaskId;
- int32_t downstreamTaskId;
- int32_t upstreamNodeId;
- int32_t childId;
-} SStreamScanHistoryFinishReq;
-
-int32_t tEncodeStreamScanHistoryFinishReq(SEncoder* pEncoder, const SStreamScanHistoryFinishReq* pReq);
-int32_t tDecodeStreamScanHistoryFinishReq(SDecoder* pDecoder, SStreamScanHistoryFinishReq* pReq);
-
+// mndTrigger: denote if this checkpoint is triggered by mnode or as requested from tasks when transfer-state finished
typedef struct {
int64_t streamId;
int64_t checkpointId;
@@ -648,6 +638,7 @@ typedef struct {
SEpSet mgmtEps;
int32_t mnodeId;
int32_t transId;
+ int8_t mndTrigger;
int64_t expireTime;
} SStreamCheckpointSourceReq;
@@ -712,17 +703,6 @@ int32_t tEncodeStreamHbMsg(SEncoder* pEncoder, const SStreamHbMsg* pRsp);
int32_t tDecodeStreamHbMsg(SDecoder* pDecoder, SStreamHbMsg* pRsp);
void streamMetaClearHbMsg(SStreamHbMsg* pMsg);
-typedef struct {
- int64_t streamId;
- int32_t upstreamTaskId;
- int32_t upstreamNodeId;
- int32_t downstreamId;
- int32_t downstreamNode;
-} SStreamCompleteHistoryMsg;
-
-int32_t tEncodeCompleteHistoryDataMsg(SEncoder* pEncoder, const SStreamCompleteHistoryMsg* pReq);
-int32_t tDecodeCompleteHistoryDataMsg(SDecoder* pDecoder, SStreamCompleteHistoryMsg* pReq);
-
typedef struct SNodeUpdateInfo {
int32_t nodeId;
SEpSet prevEp;
@@ -769,6 +749,15 @@ int32_t tDecodeStreamDispatchReq(SDecoder* pDecoder, SStreamDispatchReq* pReq);
int32_t tDecodeStreamRetrieveReq(SDecoder* pDecoder, SStreamRetrieveReq* pReq);
void tDeleteStreamDispatchReq(SStreamDispatchReq* pReq);
+typedef struct SStreamTaskCheckpointReq {
+ int64_t streamId;
+ int32_t taskId;
+ int32_t nodeId;
+} SStreamTaskCheckpointReq;
+
+int32_t tEncodeStreamTaskCheckpointReq(SEncoder* pEncoder, const SStreamTaskCheckpointReq* pReq);
+int32_t tDecodeStreamTaskCheckpointReq(SDecoder* pDecoder, SStreamTaskCheckpointReq* pReq);
+
int32_t streamSetupScheduleTrigger(SStreamTask* pTask);
int32_t streamProcessDispatchMsg(SStreamTask* pTask, SStreamDispatchReq* pReq, SRpcMsg* pMsg);
@@ -786,11 +775,12 @@ bool streamTaskShouldPause(const SStreamTask* pStatus);
bool streamTaskIsIdle(const SStreamTask* pTask);
bool streamTaskReadyToRun(const SStreamTask* pTask, char** pStatus);
-char* createStreamTaskIdStr(int64_t streamId, int32_t taskId);
+char* createStreamTaskIdStr(int64_t streamId, int32_t taskId);
SStreamTaskState* streamTaskGetStatus(const SStreamTask* pTask);
-const char* streamTaskGetStatusStr(ETaskStatus status);
-void streamTaskResetStatus(SStreamTask* pTask);
-void streamTaskSetStatusReady(SStreamTask* pTask);
+const char* streamTaskGetStatusStr(ETaskStatus status);
+void streamTaskResetStatus(SStreamTask* pTask);
+void streamTaskSetStatusReady(SStreamTask* pTask);
+ETaskStatus streamTaskGetPrevStatus(const SStreamTask* pTask);
void initRpcMsg(SRpcMsg* pMsg, int32_t msgType, void* pCont, int32_t contLen);
@@ -805,10 +795,9 @@ bool streamTaskIsAllUpstreamClosed(SStreamTask* pTask);
bool streamTaskSetSchedStatusWait(SStreamTask* pTask);
int8_t streamTaskSetSchedStatusActive(SStreamTask* pTask);
int8_t streamTaskSetSchedStatusInactive(SStreamTask* pTask);
-int32_t streamTaskClearHTaskAttr(SStreamTask* pTask);
+int32_t streamTaskClearHTaskAttr(SStreamTask* pTask, bool metaLock);
int32_t streamTaskHandleEvent(SStreamTaskSM* pSM, EStreamTaskEvent event);
-int32_t streamTaskHandleEventAsync(SStreamTaskSM* pSM, EStreamTaskEvent event, void* pFn);
int32_t streamTaskOnHandleEventSuccess(SStreamTaskSM* pSM, EStreamTaskEvent event);
void streamTaskRestoreStatus(SStreamTask* pTask);
@@ -817,7 +806,6 @@ int32_t streamSendCheckRsp(const SStreamMeta* pMeta, const SStreamTaskCheckReq*
SRpcHandleInfo* pRpcInfo, int32_t taskId);
int32_t streamProcessCheckRsp(SStreamTask* pTask, const SStreamTaskCheckRsp* pRsp);
int32_t streamLaunchFillHistoryTask(SStreamTask* pTask);
-int32_t streamTaskScanHistoryDataComplete(SStreamTask* pTask);
int32_t streamStartScanHistoryAsync(SStreamTask* pTask, int8_t igUntreated);
int32_t streamReExecScanHistoryFuture(SStreamTask* pTask, int32_t idleDuration);
bool streamHistoryTaskSetVerRangeStep2(SStreamTask* pTask, int64_t latestVer);
@@ -838,6 +826,7 @@ void streamTaskCloseUpstreamInput(SStreamTask* pTask, int32_t taskId);
void streamTaskOpenAllUpstreamInput(SStreamTask* pTask);
int32_t streamTaskSetDb(SStreamMeta* pMeta, void* pTask, char* key);
bool streamTaskIsSinkTask(const SStreamTask* pTask);
+int32_t streamTaskSendCheckpointReq(SStreamTask* pTask);
void streamTaskStatusInit(STaskStatusEntry* pEntry, const SStreamTask* pTask);
void streamTaskStatusCopy(STaskStatusEntry* pDst, const STaskStatusEntry* pSrc);
@@ -846,11 +835,6 @@ void streamTaskStatusCopy(STaskStatusEntry* pDst, const STaskStatusEntry* pSrc);
int32_t streamSetParamForStreamScannerStep1(SStreamTask* pTask, SVersionRange* pVerRange, STimeWindow* pWindow);
int32_t streamSetParamForStreamScannerStep2(SStreamTask* pTask, SVersionRange* pVerRange, STimeWindow* pWindow);
SScanhistoryDataInfo streamScanHistoryData(SStreamTask* pTask, int64_t st);
-int32_t streamDispatchScanHistoryFinishMsg(SStreamTask* pTask);
-
-// agg level
-int32_t streamProcessScanHistoryFinishReq(SStreamTask* pTask, SStreamScanHistoryFinishReq* pReq, SRpcHandleInfo* pInfo);
-int32_t streamProcessScanHistoryFinishRsp(SStreamTask* pTask);
// stream task meta
void streamMetaInit();
@@ -865,6 +849,7 @@ int32_t streamMetaGetNumOfTasks(SStreamMeta* pMeta);
SStreamTask* streamMetaAcquireTaskNoLock(SStreamMeta* pMeta, int64_t streamId, int32_t taskId);
SStreamTask* streamMetaAcquireTask(SStreamMeta* pMeta, int64_t streamId, int32_t taskId);
void streamMetaReleaseTask(SStreamMeta* pMeta, SStreamTask* pTask);
+SStreamTask* streamMetaAcquireOneTask(SStreamTask* pTask);
void streamMetaClear(SStreamMeta* pMeta);
void streamMetaInitBackend(SStreamMeta* pMeta);
int32_t streamMetaCommit(SStreamMeta* pMeta);
diff --git a/include/os/osDef.h b/include/os/osDef.h
index 1a831f2e86..335b151cac 100644
--- a/include/os/osDef.h
+++ b/include/os/osDef.h
@@ -222,6 +222,10 @@ void syslog(int unused, const char *format, ...);
do { \
prctl(PR_SET_NAME, (name)); \
} while (0)
+#define getThreadName(name) \
+ do { \
+ prctl(PR_GET_NAME, (name)); \
+ } while (0)
#endif
#else
// Windows
diff --git a/include/util/taoserror.h b/include/util/taoserror.h
index b5389e60d3..94fe80b901 100644
--- a/include/util/taoserror.h
+++ b/include/util/taoserror.h
@@ -126,6 +126,7 @@ int32_t* taosGetErrno();
#define TSDB_CODE_IP_NOT_IN_WHITE_LIST TAOS_DEF_ERROR_CODE(0, 0x0134)
#define TSDB_CODE_FAILED_TO_CONNECT_S3 TAOS_DEF_ERROR_CODE(0, 0x0135)
+#define TSDB_CODE_MSG_PREPROCESSED TAOS_DEF_ERROR_CODE(0, 0x0136) // internal
//client
#define TSDB_CODE_TSC_INVALID_OPERATION TAOS_DEF_ERROR_CODE(0, 0x0200)
@@ -413,6 +414,7 @@ int32_t* taosGetErrno();
#define TSDB_CODE_MNODE_ONLY_TWO_MNODE TAOS_DEF_ERROR_CODE(0, 0x0414) // internal
#define TSDB_CODE_MNODE_NO_NEED_RESTORE TAOS_DEF_ERROR_CODE(0, 0x0415) // internal
#define TSDB_CODE_DNODE_ONLY_USE_WHEN_OFFLINE TAOS_DEF_ERROR_CODE(0, 0x0416)
+#define TSDB_CODE_DNODE_NO_MACHINE_CODE TAOS_DEF_ERROR_CODE(0, 0x0417)
// mnode-sma
#define TSDB_CODE_MND_SMA_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0480)
@@ -521,6 +523,7 @@ int32_t* taosGetErrno();
#define TSDB_CODE_QRY_INVALID_INPUT TAOS_DEF_ERROR_CODE(0, 0x070F)
// #define TSDB_CODE_QRY_INVALID_SCHEMA_VERSION TAOS_DEF_ERROR_CODE(0, 0x0710) // 2.x
// #define TSDB_CODE_QRY_RESULT_TOO_LARGE TAOS_DEF_ERROR_CODE(0, 0x0711) // 2.x
+#define TSDB_CODE_QRY_INVALID_WINDOW_CONDITION TAOS_DEF_ERROR_CODE(0, 0x0712)
#define TSDB_CODE_QRY_SCH_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0720)
#define TSDB_CODE_QRY_TASK_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0721)
#define TSDB_CODE_QRY_TASK_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0722)
@@ -529,7 +532,7 @@ int32_t* taosGetErrno();
#define TSDB_CODE_QRY_TASK_DROPPED TAOS_DEF_ERROR_CODE(0, 0x0725)
#define TSDB_CODE_QRY_TASK_CANCELLING TAOS_DEF_ERROR_CODE(0, 0x0726)
#define TSDB_CODE_QRY_TASK_DROPPING TAOS_DEF_ERROR_CODE(0, 0x0727)
-#define TSDB_CODE_QRY_DUPLICATTED_OPERATION TAOS_DEF_ERROR_CODE(0, 0x0728)
+#define TSDB_CODE_QRY_DUPLICATED_OPERATION TAOS_DEF_ERROR_CODE(0, 0x0728)
#define TSDB_CODE_QRY_TASK_MSG_ERROR TAOS_DEF_ERROR_CODE(0, 0x0729)
#define TSDB_CODE_QRY_JOB_FREED TAOS_DEF_ERROR_CODE(0, 0x072A)
#define TSDB_CODE_QRY_TASK_STATUS_ERROR TAOS_DEF_ERROR_CODE(0, 0x072B)
@@ -552,7 +555,7 @@ int32_t* taosGetErrno();
#define TSDB_CODE_GRANT_STREAM_LIMITED TAOS_DEF_ERROR_CODE(0, 0x0807)
#define TSDB_CODE_GRANT_SPEED_LIMITED TAOS_DEF_ERROR_CODE(0, 0x0808)
#define TSDB_CODE_GRANT_STORAGE_LIMITED TAOS_DEF_ERROR_CODE(0, 0x0809)
-#define TSDB_CODE_GRANT_QUERYTIME_LIMITED TAOS_DEF_ERROR_CODE(0, 0x080A)
+#define TSDB_CODE_GRANT_SUBSCRIPTION_LIMITED TAOS_DEF_ERROR_CODE(0, 0x080A)
#define TSDB_CODE_GRANT_CPU_LIMITED TAOS_DEF_ERROR_CODE(0, 0x080B)
#define TSDB_CODE_GRANT_STABLE_LIMITED TAOS_DEF_ERROR_CODE(0, 0x080C)
#define TSDB_CODE_GRANT_TABLE_LIMITED TAOS_DEF_ERROR_CODE(0, 0x080D)
@@ -561,8 +564,19 @@ int32_t* taosGetErrno();
#define TSDB_CODE_GRANT_PAR_DEC_IVLD_KEY TAOS_DEF_ERROR_CODE(0, 0x0810)
#define TSDB_CODE_GRANT_PAR_DEC_IVLD_KLEN TAOS_DEF_ERROR_CODE(0, 0x0811)
#define TSDB_CODE_GRANT_GEN_IVLD_KEY TAOS_DEF_ERROR_CODE(0, 0x0812)
-#define TSDB_CODE_GRANT_GEN_APP_LIMIT TAOS_DEF_ERROR_CODE(0, 0x0813)
+#define TSDB_CODE_GRANT_GEN_ACTIVE_LEN TAOS_DEF_ERROR_CODE(0, 0x0813)
#define TSDB_CODE_GRANT_GEN_ENC_IVLD_KLEN TAOS_DEF_ERROR_CODE(0, 0x0814)
+#define TSDB_CODE_GRANT_PAR_IVLD_DIST TAOS_DEF_ERROR_CODE(0, 0x0815)
+#define TSDB_CODE_GRANT_UNLICENSED_CLUSTER TAOS_DEF_ERROR_CODE(0, 0x0816)
+#define TSDB_CODE_GRANT_LACK_OF_BASIC TAOS_DEF_ERROR_CODE(0, 0x0817)
+#define TSDB_CODE_GRANT_OBJ_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0818)
+#define TSDB_CODE_GRANT_LAST_ACTIVE_NOT_FOUND TAOS_DEF_ERROR_CODE(0, 0x0819)
+#define TSDB_CODE_GRANT_MACHINES_MISMATCH TAOS_DEF_ERROR_CODE(0, 0x0820)
+#define TSDB_CODE_GRANT_OPT_EXPIRE_TOO_LARGE TAOS_DEF_ERROR_CODE(0, 0x0821)
+#define TSDB_CODE_GRANT_DUPLICATED_ACTIVE TAOS_DEF_ERROR_CODE(0, 0x0822)
+#define TSDB_CODE_GRANT_VIEW_LIMITED TAOS_DEF_ERROR_CODE(0, 0x0823)
+#define TSDB_CODE_GRANT_CSV_LIMITED TAOS_DEF_ERROR_CODE(0, 0x0824)
+#define TSDB_CODE_GRANT_AUDIT_LIMITED TAOS_DEF_ERROR_CODE(0, 0x0825)
// sync
// #define TSDB_CODE_SYN_INVALID_CONFIG TAOS_DEF_ERROR_CODE(0, 0x0900) // 2.x
diff --git a/include/util/tbase58.h b/include/util/tbase58.h
new file mode 100644
index 0000000000..e1b03f8a8f
--- /dev/null
+++ b/include/util/tbase58.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2019 TAOS Data, Inc.
+ *
+ * This program is free software: you can use, redistribute, and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3
+ * or later ("AGPL"), as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+#ifndef _TD_UTIL_BASE58_H_
+#define _TD_UTIL_BASE58_H_
+
+#include "os.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+uint8_t *base58_decode(const char *value, size_t inlen, int32_t *outlen);
+char *base58_encode(const uint8_t *value, int32_t vlen);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*_TD_UTIL_BASE58_H_*/
\ No newline at end of file
diff --git a/include/util/tdef.h b/include/util/tdef.h
index aee20514ad..4698d50e67 100644
--- a/include/util/tdef.h
+++ b/include/util/tdef.h
@@ -264,6 +264,7 @@ typedef enum ELogicConditionType {
#define TSDB_JOB_STATUS_LEN 32
#define TSDB_CLUSTER_ID_LEN 40
+#define TSDB_MACHINE_ID_LEN 24
#define TSDB_FQDN_LEN 128
#define TSDB_EP_LEN (TSDB_FQDN_LEN + 6)
#define TSDB_IPv4ADDR_LEN 16
@@ -285,6 +286,8 @@ typedef enum ELogicConditionType {
#define TSDB_DNODE_CONFIG_LEN 128
#define TSDB_DNODE_VALUE_LEN 256
+#define TSDB_CLUSTER_VALUE_LEN 1000
+
#define TSDB_ACTIVE_KEY_LEN 109
#define TSDB_CONN_ACTIVE_KEY_LEN 255
diff --git a/source/client/inc/clientInt.h b/source/client/inc/clientInt.h
index a6d5039be7..f73d121b15 100644
--- a/source/client/inc/clientInt.h
+++ b/source/client/inc/clientInt.h
@@ -155,6 +155,7 @@ typedef struct STscObj {
int8_t biMode;
int32_t acctId;
uint32_t connId;
+ int32_t appHbMgrIdx;
int64_t id; // ref ID returned by taosAddRef
TdThreadMutex mutex; // used to protect the operation on db
int32_t numOfReqs; // number of sqlObj bound to this connection
@@ -298,6 +299,8 @@ void doSetOneRowPtr(SReqResultInfo* pResultInfo);
void setResPrecision(SReqResultInfo* pResInfo, int32_t precision);
int32_t setQueryResultFromRsp(SReqResultInfo* pResultInfo, const SRetrieveTableRsp* pRsp, bool convertUcs4,
bool freeAfterUse);
+int32_t setResultDataPtr(SReqResultInfo* pResultInfo, TAOS_FIELD* pFields, int32_t numOfCols, int32_t numOfRows,
+ bool convertUcs4);
void setResSchemaInfo(SReqResultInfo* pResInfo, const SSchema* pSchema, int32_t numOfCols);
void doFreeReqResultInfo(SReqResultInfo* pResInfo);
int32_t transferTableNameList(const char* tbList, int32_t acctId, char* dbName, SArray** pReq);
diff --git a/source/client/src/clientEnv.c b/source/client/src/clientEnv.c
index b6c5701915..f1e9e36433 100644
--- a/source/client/src/clientEnv.c
+++ b/source/client/src/clientEnv.c
@@ -283,6 +283,7 @@ void *createTscObj(const char *user, const char *auth, const char *db, int32_t c
pObj->connType = connType;
pObj->pAppInfo = pAppInfo;
+ pObj->appHbMgrIdx = pAppInfo->pAppHbMgr->idx;
tstrncpy(pObj->user, user, sizeof(pObj->user));
memcpy(pObj->pass, auth, TSDB_PASSWORD_LEN);
diff --git a/source/client/src/clientHb.c b/source/client/src/clientHb.c
index b3d9a9ced5..63a65d7c95 100644
--- a/source/client/src/clientHb.c
+++ b/source/client/src/clientHb.c
@@ -30,7 +30,7 @@ typedef struct {
};
} SHbParam;
-static SClientHbMgr clientHbMgr = {0};
+SClientHbMgr clientHbMgr = {0};
static int32_t hbCreateThread();
static void hbStopThread();
@@ -1294,9 +1294,8 @@ void hbMgrCleanUp() {
taosThreadMutexLock(&clientHbMgr.lock);
appHbMgrCleanup();
- taosArrayDestroy(clientHbMgr.appHbMgrs);
+ clientHbMgr.appHbMgrs = taosArrayDestroy(clientHbMgr.appHbMgrs);
taosThreadMutexUnlock(&clientHbMgr.lock);
- clientHbMgr.appHbMgrs = NULL;
}
int hbRegisterConnImpl(SAppHbMgr *pAppHbMgr, SClientHbKey connKey, int64_t clusterId) {
@@ -1335,19 +1334,18 @@ int hbRegisterConn(SAppHbMgr *pAppHbMgr, int64_t tscRefId, int64_t clusterId, in
}
void hbDeregisterConn(STscObj *pTscObj, SClientHbKey connKey) {
- SAppHbMgr *pAppHbMgr = pTscObj->pAppInfo->pAppHbMgr;
- SClientHbReq *pReq = taosHashAcquire(pAppHbMgr->activeInfo, &connKey, sizeof(SClientHbKey));
- if (pReq) {
- tFreeClientHbReq(pReq);
- taosHashRemove(pAppHbMgr->activeInfo, &connKey, sizeof(SClientHbKey));
- taosHashRelease(pAppHbMgr->activeInfo, pReq);
+ taosThreadMutexLock(&clientHbMgr.lock);
+ SAppHbMgr *pAppHbMgr = taosArrayGetP(clientHbMgr.appHbMgrs, pTscObj->appHbMgrIdx);
+ if (pAppHbMgr) {
+ SClientHbReq *pReq = taosHashAcquire(pAppHbMgr->activeInfo, &connKey, sizeof(SClientHbKey));
+ if (pReq) {
+ tFreeClientHbReq(pReq);
+ taosHashRemove(pAppHbMgr->activeInfo, &connKey, sizeof(SClientHbKey));
+ taosHashRelease(pAppHbMgr->activeInfo, pReq);
+ atomic_sub_fetch_32(&pAppHbMgr->connKeyCnt, 1);
+ }
}
-
- if (NULL == pReq) {
- return;
- }
-
- atomic_sub_fetch_32(&pAppHbMgr->connKeyCnt, 1);
+ taosThreadMutexUnlock(&clientHbMgr.lock);
}
// set heart beat thread quit mode , if quicByKill 1 then kill thread else quit from inner
diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c
index d4f89d6b54..9800d233e9 100644
--- a/source/client/src/clientImpl.c
+++ b/source/client/src/clientImpl.c
@@ -1795,6 +1795,7 @@ int32_t getVersion1BlockMetaSize(const char* p, int32_t numOfCols) {
static int32_t estimateJsonLen(SReqResultInfo* pResultInfo, int32_t numOfCols, int32_t numOfRows) {
char* p = (char*)pResultInfo->pData;
+ int32_t blockVersion = *(int32_t*)p;
// | version | total length | total rows | total columns | flag seg| block group id | column schema | each column
// length |
@@ -1810,7 +1811,7 @@ static int32_t estimateJsonLen(SReqResultInfo* pResultInfo, int32_t numOfCols, i
char* pStart = p + len;
for (int32_t i = 0; i < numOfCols; ++i) {
- int32_t colLen = htonl(colLength[i]);
+ int32_t colLen = (blockVersion == 1) ? htonl(colLength[i]) : colLength[i];
if (pResultInfo->fields[i].type == TSDB_DATA_TYPE_JSON) {
int32_t* offset = (int32_t*)pStart;
@@ -1873,6 +1874,7 @@ static int32_t doConvertJson(SReqResultInfo* pResultInfo, int32_t numOfCols, int
tscDebug("start to convert form json format string");
char* p = (char*)pResultInfo->pData;
+ int32_t blockVersion = *(int32_t*)p;
int32_t dataLen = estimateJsonLen(pResultInfo, numOfCols, numOfRows);
if (dataLen <= 0) {
return TSDB_CODE_TSC_INTERNAL_ERROR;
@@ -1908,8 +1910,8 @@ static int32_t doConvertJson(SReqResultInfo* pResultInfo, int32_t numOfCols, int
char* pStart = p;
char* pStart1 = p1;
for (int32_t i = 0; i < numOfCols; ++i) {
- int32_t colLen = htonl(colLength[i]);
- int32_t colLen1 = htonl(colLength1[i]);
+ int32_t colLen = (blockVersion == 1) ? htonl(colLength[i]) : colLength[i];
+ int32_t colLen1 = (blockVersion == 1) ? htonl(colLength1[i]) : colLength1[i];
if (ASSERT(colLen < dataLen)) {
tscError("doConvertJson error: colLen:%d >= dataLen:%d", colLen, dataLen);
return TSDB_CODE_TSC_INTERNAL_ERROR;
@@ -1968,7 +1970,7 @@ static int32_t doConvertJson(SReqResultInfo* pResultInfo, int32_t numOfCols, int
}
colLen1 = len;
totalLen += colLen1;
- colLength1[i] = htonl(len);
+ colLength1[i] = (blockVersion == 1) ? htonl(len) : len;
} else if (IS_VAR_DATA_TYPE(pResultInfo->fields[i].type)) {
len = numOfRows * sizeof(int32_t);
memcpy(pStart1, pStart, len);
@@ -2057,7 +2059,9 @@ int32_t setResultDataPtr(SReqResultInfo* pResultInfo, TAOS_FIELD* pFields, int32
char* pStart = p;
for (int32_t i = 0; i < numOfCols; ++i) {
- colLength[i] = htonl(colLength[i]);
+ if(blockVersion == 1){
+ colLength[i] = htonl(colLength[i]);
+ }
if (colLength[i] >= dataLen) {
tscError("invalid colLength %d, dataLen %d", colLength[i], dataLen);
return TSDB_CODE_TSC_INTERNAL_ERROR;
diff --git a/source/client/src/clientMsgHandler.c b/source/client/src/clientMsgHandler.c
index e0cedb9924..324b99022b 100644
--- a/source/client/src/clientMsgHandler.c
+++ b/source/client/src/clientMsgHandler.c
@@ -26,6 +26,8 @@
#include "tname.h"
#include "tversion.h"
+extern SClientHbMgr clientHbMgr;
+
static void setErrno(SRequestObj* pRequest, int32_t code) {
pRequest->code = code;
terrno = code;
@@ -63,8 +65,9 @@ int32_t processConnectRsp(void* param, SDataBuf* pMsg, int32_t code) {
STscObj* pTscObj = pRequest->pTscObj;
- if (NULL == pTscObj->pAppInfo || NULL == pTscObj->pAppInfo->pAppHbMgr) {
- setErrno(pRequest, TSDB_CODE_TSC_DISCONNECTED);
+ if (NULL == pTscObj->pAppInfo) {
+ code = TSDB_CODE_TSC_DISCONNECTED;
+ setErrno(pRequest, code);
tsem_post(&pRequest->body.rspSem);
goto End;
}
@@ -95,7 +98,8 @@ int32_t processConnectRsp(void* param, SDataBuf* pMsg, int32_t code) {
}
if (connectRsp.epSet.numOfEps == 0) {
- setErrno(pRequest, TSDB_CODE_APP_ERROR);
+ code = TSDB_CODE_APP_ERROR;
+ setErrno(pRequest, code);
tsem_post(&pRequest->body.rspSem);
goto End;
}
@@ -142,7 +146,18 @@ int32_t processConnectRsp(void* param, SDataBuf* pMsg, int32_t code) {
pTscObj->authVer = connectRsp.authVer;
pTscObj->whiteListInfo.ver = connectRsp.whiteListVer;
- hbRegisterConn(pTscObj->pAppInfo->pAppHbMgr, pTscObj->id, connectRsp.clusterId, connectRsp.connType);
+ taosThreadMutexLock(&clientHbMgr.lock);
+ SAppHbMgr* pAppHbMgr = taosArrayGetP(clientHbMgr.appHbMgrs, pTscObj->appHbMgrIdx);
+ if (pAppHbMgr) {
+ hbRegisterConn(pAppHbMgr, pTscObj->id, connectRsp.clusterId, connectRsp.connType);
+ } else {
+ taosThreadMutexUnlock(&clientHbMgr.lock);
+ code = TSDB_CODE_TSC_DISCONNECTED;
+ setErrno(pRequest, code);
+ tsem_post(&pRequest->body.rspSem);
+ goto End;
+ }
+ taosThreadMutexUnlock(&clientHbMgr.lock);
tscDebug("0x%" PRIx64 " clusterId:%" PRId64 ", totalConn:%" PRId64, pRequest->requestId, connectRsp.clusterId,
pTscObj->pAppInfo->numOfConns);
diff --git a/source/client/src/clientRawBlockWrite.c b/source/client/src/clientRawBlockWrite.c
index 1f9d3c6d8c..1ea3eaf219 100644
--- a/source/client/src/clientRawBlockWrite.c
+++ b/source/client/src/clientRawBlockWrite.c
@@ -955,7 +955,6 @@ static int32_t taosCreateTable(TAOS* taos, void* meta, int32_t metaLen) {
if (code != TSDB_CODE_SUCCESS) {
goto end;
}
- taosArrayPush(pRequest->tableList, &pName);
pCreateReq->flags |= TD_CREATE_IF_NOT_EXISTS;
// change tag cid to new cid
@@ -966,6 +965,12 @@ static int32_t taosCreateTable(TAOS* taos, void* meta, int32_t metaLen) {
// pCreateReq->ctb.suid = processSuid(pCreateReq->ctb.suid, pRequest->pDb);
toName(pTscObj->acctId, pRequest->pDb, pCreateReq->ctb.stbName, &sName);
code = catalogGetTableMeta(pCatalog, &conn, &sName, &pTableMeta);
+ if (code == TSDB_CODE_PAR_TABLE_NOT_EXIST) {
+ code = TSDB_CODE_SUCCESS;
+ taosMemoryFreeClear(pTableMeta);
+ continue;
+ }
+
if (code != TSDB_CODE_SUCCESS) {
goto end;
}
@@ -983,6 +988,7 @@ static int32_t taosCreateTable(TAOS* taos, void* meta, int32_t metaLen) {
}
taosMemoryFreeClear(pTableMeta);
}
+ taosArrayPush(pRequest->tableList, &pName);
SVgroupCreateTableBatch* pTableBatch = taosHashGet(pVgroupHashmap, &pInfo.vgId, sizeof(pInfo.vgId));
if (pTableBatch == NULL) {
@@ -999,6 +1005,9 @@ static int32_t taosCreateTable(TAOS* taos, void* meta, int32_t metaLen) {
}
}
+ if (taosHashGetSize(pVgroupHashmap) == 0) {
+ goto end;
+ }
SArray* pBufArray = serializeVgroupsCreateTableBatch(pVgroupHashmap);
if (NULL == pBufArray) {
code = TSDB_CODE_OUT_OF_MEMORY;
@@ -1553,6 +1562,18 @@ end:
return code;
}
+static void* getRawDataFromRes(void *pRetrieve){
+ void* rawData = NULL;
+ // deal with compatibility
+ if(*(int64_t*)pRetrieve == 0){
+ rawData = ((SRetrieveTableRsp*)pRetrieve)->data;
+ }else if(*(int64_t*)pRetrieve == 1){
+ rawData = ((SRetrieveTableRspForTmq*)pRetrieve)->data;
+ }
+ ASSERT(rawData != NULL);
+ return rawData;
+}
+
static int32_t tmqWriteRawDataImpl(TAOS* taos, void* data, int32_t dataLen) {
if(taos == NULL || data == NULL){
terrno = TSDB_CODE_INVALID_PARA;
@@ -1607,7 +1628,7 @@ static int32_t tmqWriteRawDataImpl(TAOS* taos, void* data, int32_t dataLen) {
}
pVgHash = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), true, HASH_NO_LOCK);
while (++rspObj.resIter < rspObj.rsp.blockNum) {
- SRetrieveTableRsp* pRetrieve = (SRetrieveTableRsp*)taosArrayGetP(rspObj.rsp.blockData, rspObj.resIter);
+ void* pRetrieve = taosArrayGetP(rspObj.rsp.blockData, rspObj.resIter);
if (!rspObj.rsp.withSchema) {
goto end;
}
@@ -1653,7 +1674,8 @@ static int32_t tmqWriteRawDataImpl(TAOS* taos, void* data, int32_t dataLen) {
fields[i].bytes = pSW->pSchema[i].bytes;
tstrncpy(fields[i].name, pSW->pSchema[i].name, tListLen(pSW->pSchema[i].name));
}
- code = rawBlockBindData(pQuery, pTableMeta, pRetrieve->data, NULL, fields, pSW->nCols, true);
+ void* rawData = getRawDataFromRes(pRetrieve);
+ code = rawBlockBindData(pQuery, pTableMeta, rawData, NULL, fields, pSW->nCols, true);
taosMemoryFree(fields);
if (code != TSDB_CODE_SUCCESS) {
goto end;
@@ -1737,7 +1759,7 @@ static int32_t tmqWriteRawMetaDataImpl(TAOS* taos, void* data, int32_t dataLen)
uDebug(LOG_ID_TAG" write raw metadata block num:%d", LOG_ID_VALUE, rspObj.rsp.blockNum);
while (++rspObj.resIter < rspObj.rsp.blockNum) {
- SRetrieveTableRsp* pRetrieve = (SRetrieveTableRsp*)taosArrayGetP(rspObj.rsp.blockData, rspObj.resIter);
+ void* pRetrieve = taosArrayGetP(rspObj.rsp.blockData, rspObj.resIter);
if (!rspObj.rsp.withSchema) {
goto end;
}
@@ -1824,12 +1846,12 @@ static int32_t tmqWriteRawMetaDataImpl(TAOS* taos, void* data, int32_t dataLen)
fields[i].bytes = pSW->pSchema[i].bytes;
tstrncpy(fields[i].name, pSW->pSchema[i].name, tListLen(pSW->pSchema[i].name));
}
- code = rawBlockBindData(pQuery, pTableMeta, pRetrieve->data, pCreateReqDst, fields, pSW->nCols, true);
+ void* rawData = getRawDataFromRes(pRetrieve);
+ code = rawBlockBindData(pQuery, pTableMeta, rawData, &pCreateReqDst, fields, pSW->nCols, true);
taosMemoryFree(fields);
if (code != TSDB_CODE_SUCCESS) {
goto end;
}
- pCreateReqDst = NULL;
taosMemoryFreeClear(pTableMeta);
}
diff --git a/source/client/src/clientStmt.c b/source/client/src/clientStmt.c
index 8ac9550aca..36a3e50aef 100644
--- a/source/client/src/clientStmt.c
+++ b/source/client/src/clientStmt.c
@@ -406,10 +406,6 @@ int32_t stmtGetFromCache(STscStmt* pStmt) {
if (NULL == pStmt->sql.pTableCache || taosHashGetSize(pStmt->sql.pTableCache) <= 0) {
if (pStmt->bInfo.inExecCache) {
- if (ASSERT(taosHashGetSize(pStmt->exec.pBlockHash) == 1)) {
- tscError("stmtGetFromCache error");
- return TSDB_CODE_TSC_STMT_CACHE_ERROR;
- }
pStmt->bInfo.needParse = false;
tscDebug("reuse stmt block for tb %s in execBlock", pStmt->bInfo.tbFName);
return TSDB_CODE_SUCCESS;
diff --git a/source/client/src/clientTmq.c b/source/client/src/clientTmq.c
index 28e269ee10..8b424a7bf7 100644
--- a/source/client/src/clientTmq.c
+++ b/source/client/src/clientTmq.c
@@ -155,6 +155,7 @@ typedef struct {
char db[TSDB_DB_FNAME_LEN];
SArray* vgs; // SArray
SSchemaWrapper schema;
+ int8_t noPrivilege;
} SMqClientTopic;
typedef struct {
@@ -739,6 +740,29 @@ void tmqAssignDelayedCommitTask(void* param, void* tmrId) {
int32_t tmqHbCb(void* param, SDataBuf* pMsg, int32_t code) {
if (pMsg) {
+ SMqHbRsp rsp = {0};
+ tDeserializeSMqHbRsp(pMsg->pData, pMsg->len, &rsp);
+
+ int64_t refId = *(int64_t*)param;
+ tmq_t* tmq = taosAcquireRef(tmqMgmt.rsetId, refId);
+ if (tmq != NULL) {
+ taosWLockLatch(&tmq->lock);
+ for(int32_t i = 0; i < taosArrayGetSize(rsp.topicPrivileges); i++){
+ STopicPrivilege* privilege = taosArrayGet(rsp.topicPrivileges, i);
+ if(privilege->noPrivilege == 1){
+ int32_t topicNumCur = taosArrayGetSize(tmq->clientTopics);
+ for (int32_t j = 0; j < topicNumCur; j++) {
+ SMqClientTopic* pTopicCur = taosArrayGet(tmq->clientTopics, j);
+ if(strcmp(pTopicCur->topicName, privilege->topic) == 0){
+ tscInfo("consumer:0x%" PRIx64 ", has no privilege, topic:%s", tmq->consumerId, privilege->topic);
+ pTopicCur->noPrivilege = 1;
+ }
+ }
+ }
+ }
+ taosWUnLockLatch(&tmq->lock);
+ }
+ tDeatroySMqHbRsp(&rsp);
taosMemoryFree(pMsg->pData);
taosMemoryFree(pMsg->pEpSet);
}
@@ -809,7 +833,9 @@ void tmqSendHbReq(void* param, void* tmrId) {
sendInfo->requestId = generateRequestId();
sendInfo->requestObjRefId = 0;
- sendInfo->param = NULL;
+ sendInfo->paramFreeFp = taosMemoryFree;
+ sendInfo->param = taosMemoryMalloc(sizeof(int64_t));
+ *(int64_t *)sendInfo->param = refId;
sendInfo->fp = tmqHbCb;
sendInfo->msgType = TDMT_MND_TMQ_HB;
@@ -1577,16 +1603,24 @@ SMqRspObj* tmqBuildRspFromWrapper(SMqPollRspWrapper* pWrapper, SMqClientVg* pVg,
pRspObj->resInfo.totalRows = 0;
pRspObj->resInfo.precision = TSDB_TIME_PRECISION_MILLI;
- if (!pWrapper->dataRsp.withSchema) {
- setResSchemaInfo(&pRspObj->resInfo, pWrapper->topicHandle->schema.pSchema, pWrapper->topicHandle->schema.nCols);
+ bool needTransformSchema = !pRspObj->rsp.withSchema;
+ if (!pRspObj->rsp.withSchema) { // withSchema is false if subscribe subquery, true if subscribe db or stable
+ pRspObj->rsp.withSchema = true;
+ pRspObj->rsp.blockSchema = taosArrayInit(pRspObj->rsp.blockNum, sizeof(void*));
}
-
- // extract the rows in this data packet
+ // extract the rows in this data packet
for (int32_t i = 0; i < pRspObj->rsp.blockNum; ++i) {
- SRetrieveTableRsp* pRetrieve = (SRetrieveTableRsp*)taosArrayGetP(pRspObj->rsp.blockData, i);
+ SRetrieveTableRspForTmq* pRetrieve = (SRetrieveTableRspForTmq*)taosArrayGetP(pRspObj->rsp.blockData, i);
int64_t rows = htobe64(pRetrieve->numOfRows);
pVg->numOfRows += rows;
(*numOfRows) += rows;
+
+ if (needTransformSchema) { //withSchema is false if subscribe subquery, true if subscribe db or stable
+ SSchemaWrapper *schema = tCloneSSchemaWrapper(&pWrapper->topicHandle->schema);
+ if(schema){
+ taosArrayPush(pRspObj->rsp.blockSchema, &schema);
+ }
+ }
}
return pRspObj;
@@ -1603,13 +1637,10 @@ SMqTaosxRspObj* tmqBuildTaosxRspFromWrapper(SMqPollRspWrapper* pWrapper, SMqClie
pRspObj->resInfo.totalRows = 0;
pRspObj->resInfo.precision = TSDB_TIME_PRECISION_MILLI;
- if (!pWrapper->taosxRsp.withSchema) {
- setResSchemaInfo(&pRspObj->resInfo, pWrapper->topicHandle->schema.pSchema, pWrapper->topicHandle->schema.nCols);
- }
// extract the rows in this data packet
for (int32_t i = 0; i < pRspObj->rsp.blockNum; ++i) {
- SRetrieveTableRsp* pRetrieve = (SRetrieveTableRsp*)taosArrayGetP(pRspObj->rsp.blockData, i);
+ SRetrieveTableRspForTmq* pRetrieve = (SRetrieveTableRspForTmq*)taosArrayGetP(pRspObj->rsp.blockData, i);
int64_t rows = htobe64(pRetrieve->numOfRows);
pVg->numOfRows += rows;
(*numOfRows) += rows;
@@ -1700,7 +1731,10 @@ static int32_t tmqPollImpl(tmq_t* tmq, int64_t timeout) {
for (int i = 0; i < numOfTopics; i++) {
SMqClientTopic* pTopic = taosArrayGet(tmq->clientTopics, i);
int32_t numOfVg = taosArrayGetSize(pTopic->vgs);
-
+ if(pTopic->noPrivilege){
+ tscDebug("consumer:0x%" PRIx64 " has no privilegr for topic:%s", tmq->consumerId, pTopic->topicName);
+ continue;
+ }
for (int j = 0; j < numOfVg; j++) {
SMqClientVg* pVg = taosArrayGet(pTopic->vgs, j);
if (taosGetTimestampMs() - pVg->emptyBlockReceiveTs < EMPTY_BLOCK_POLL_IDLE_DURATION) { // less than 10ms
@@ -2548,7 +2582,7 @@ SReqResultInfo* tmqGetNextResInfo(TAOS_RES* res, bool convertUcs4) {
pRspObj->resIter++;
if (pRspObj->resIter < pRspObj->rsp.blockNum) {
- SRetrieveTableRsp* pRetrieve = (SRetrieveTableRsp*)taosArrayGetP(pRspObj->rsp.blockData, pRspObj->resIter);
+ SRetrieveTableRspForTmq* pRetrieveTmq = (SRetrieveTableRspForTmq*)taosArrayGetP(pRspObj->rsp.blockData, pRspObj->resIter);
if (pRspObj->rsp.withSchema) {
SSchemaWrapper* pSW = (SSchemaWrapper*)taosArrayGetP(pRspObj->rsp.blockSchema, pRspObj->resIter);
setResSchemaInfo(&pRspObj->resInfo, pSW->pSchema, pSW->nCols);
@@ -2559,7 +2593,16 @@ SReqResultInfo* tmqGetNextResInfo(TAOS_RES* res, bool convertUcs4) {
taosMemoryFreeClear(pRspObj->resInfo.convertJson);
}
- setQueryResultFromRsp(&pRspObj->resInfo, pRetrieve, convertUcs4, false);
+ pRspObj->resInfo.pData = (void*)pRetrieveTmq->data;
+ pRspObj->resInfo.numOfRows = htobe64(pRetrieveTmq->numOfRows);
+ pRspObj->resInfo.current = 0;
+ pRspObj->resInfo.precision = pRetrieveTmq->precision;
+
+ // TODO handle the compressed case
+ pRspObj->resInfo.totalRows += pRspObj->resInfo.numOfRows;
+ setResultDataPtr(&pRspObj->resInfo, pRspObj->resInfo.fields, pRspObj->resInfo.numOfCols, pRspObj->resInfo.numOfRows,
+ convertUcs4);
+
return &pRspObj->resInfo;
}
diff --git a/source/common/src/systable.c b/source/common/src/systable.c
index 75a54a0cd5..77083d0425 100644
--- a/source/common/src/systable.c
+++ b/source/common/src/systable.c
@@ -37,8 +37,7 @@ static const SSysDbTableSchema dnodesSchema[] = {
{.name = "reboot_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP, .sysInfo = true},
{.name = "note", .bytes = 256 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
#ifdef TD_ENTERPRISE
- {.name = "active_code", .bytes = TSDB_ACTIVE_KEY_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
- {.name = "c_active_code", .bytes = TSDB_CONN_ACTIVE_KEY_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
+ {.name = "machine_id", .bytes = TSDB_MACHINE_ID_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
#endif
};
@@ -349,6 +348,24 @@ static const SSysDbTableSchema userCompactsDetailSchema[] = {
{.name = "start_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP, .sysInfo = false},
};
+static const SSysDbTableSchema useGrantsFullSchema[] = {
+ {.name = "grant_name", .bytes = 32 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
+ {.name = "display_name", .bytes = 256 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
+ {.name = "expire", .bytes = 32 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
+ {.name = "limits", .bytes = 512 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
+};
+
+static const SSysDbTableSchema useGrantsLogsSchema[] = {
+ {.name = "state", .bytes = 1536 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
+ {.name = "active", .bytes = 512 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
+ {.name = "machine", .bytes = 9088 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
+};
+
+static const SSysDbTableSchema useMachinesSchema[] = {
+ {.name = "id", .bytes = TSDB_CLUSTER_ID_LEN + 1 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false},
+ {.name = "machine", .bytes = 6016 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false},
+};
+
static const SSysTableMeta infosMeta[] = {
{TSDB_INS_TABLE_DNODES, dnodesSchema, tListLen(dnodesSchema), true},
{TSDB_INS_TABLE_MNODES, mnodesSchema, tListLen(mnodesSchema), true},
@@ -378,6 +395,9 @@ static const SSysTableMeta infosMeta[] = {
{TSDB_INS_TABLE_VIEWS, userViewsSchema, tListLen(userViewsSchema), false},
{TSDB_INS_TABLE_COMPACTS, userCompactsSchema, tListLen(userCompactsSchema), false},
{TSDB_INS_TABLE_COMPACT_DETAILS, userCompactsDetailSchema, tListLen(userCompactsDetailSchema), false},
+ {TSDB_INS_TABLE_GRANTS_FULL, useGrantsFullSchema, tListLen(useGrantsFullSchema), false},
+ {TSDB_INS_TABLE_GRANTS_LOGS, useGrantsLogsSchema, tListLen(useGrantsLogsSchema), false},
+ {TSDB_INS_TABLE_MACHINES, useMachinesSchema, tListLen(useMachinesSchema), false},
};
static const SSysDbTableSchema connectionsSchema[] = {
diff --git a/source/common/src/tdatablock.c b/source/common/src/tdatablock.c
index f0d1630480..5382259899 100644
--- a/source/common/src/tdatablock.c
+++ b/source/common/src/tdatablock.c
@@ -2196,7 +2196,7 @@ int32_t blockEncode(const SSDataBlock* pBlock, char* data, int32_t numOfCols) {
// todo extract method
int32_t* version = (int32_t*)data;
- *version = 1;
+ *version = 2;
data += sizeof(int32_t);
int32_t* actualLen = (int32_t*)data;
@@ -2277,7 +2277,7 @@ int32_t blockEncode(const SSDataBlock* pBlock, char* data, int32_t numOfCols) {
data += colSizes[col];
}
- colSizes[col] = htonl(colSizes[col]);
+// colSizes[col] = htonl(colSizes[col]);
// uError("blockEncode col bytes:%d, type:%d, size:%d, htonl size:%d", pColRes->info.bytes, pColRes->info.type,
// htonl(colSizes[col]), colSizes[col]);
}
@@ -2293,7 +2293,6 @@ const char* blockDecode(SSDataBlock* pBlock, const char* pData) {
int32_t version = *(int32_t*)pStart;
pStart += sizeof(int32_t);
- ASSERT(version == 1);
// total length sizeof(int32_t)
int32_t dataLen = *(int32_t*)pStart;
@@ -2339,7 +2338,9 @@ const char* blockDecode(SSDataBlock* pBlock, const char* pData) {
pStart += sizeof(int32_t) * numOfCols;
for (int32_t i = 0; i < numOfCols; ++i) {
- colLen[i] = htonl(colLen[i]);
+ if(version == 1){
+ colLen[i] = htonl(colLen[i]);
+ }
ASSERT(colLen[i] >= 0);
SColumnInfoData* pColInfoData = taosArrayGet(pBlock->pDataBlock, i);
diff --git a/source/common/src/tdataformat.c b/source/common/src/tdataformat.c
index 02dfbfebfe..b98c89542a 100644
--- a/source/common/src/tdataformat.c
+++ b/source/common/src/tdataformat.c
@@ -24,6 +24,7 @@ static int32_t (*tColDataAppendValueImpl[8][3])(SColData *pColData, uint8_t *pDa
static int32_t (*tColDataUpdateValueImpl[8][3])(SColData *pColData, uint8_t *pData, uint32_t nData, bool forward);
// SBuffer ================================
+#ifdef BUILD_NO_CALL
void tBufferDestroy(SBuffer *pBuffer) {
tFree(pBuffer->pBuf);
pBuffer->pBuf = NULL;
@@ -55,7 +56,7 @@ int32_t tBufferReserve(SBuffer *pBuffer, int64_t nData, void **ppData) {
return code;
}
-
+#endif
// ================================
static int32_t tGetTagVal(uint8_t *p, STagVal *pTagVal, int8_t isJson);
@@ -1148,6 +1149,7 @@ static int tTagValJsonCmprFn(const void *p1, const void *p2) {
return strcmp(((STagVal *)p1)[0].pKey, ((STagVal *)p2)[0].pKey);
}
+#ifdef TD_DEBUG_PRINT_TAG
static void debugPrintTagVal(int8_t type, const void *val, int32_t vlen, const char *tag, int32_t ln) {
switch (type) {
case TSDB_DATA_TYPE_VARBINARY:
@@ -1239,6 +1241,7 @@ void debugPrintSTag(STag *pTag, const char *tag, int32_t ln) {
}
printf("\n");
}
+#endif
static int32_t tPutTagVal(uint8_t *p, STagVal *pTagVal, int8_t isJson) {
int32_t n = 0;
@@ -2576,6 +2579,7 @@ _exit:
return code;
}
+#ifdef BUILD_NO_CALL
static int32_t tColDataSwapValue(SColData *pColData, int32_t i, int32_t j) {
int32_t code = 0;
@@ -2658,6 +2662,7 @@ static void tColDataSwap(SColData *pColData, int32_t i, int32_t j) {
break;
}
}
+#endif
static int32_t tColDataCopyRowCell(SColData *pFromColData, int32_t iFromRow, SColData *pToColData, int32_t iToRow) {
int32_t code = TSDB_CODE_SUCCESS;
diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c
index 144c145214..0610261d5c 100644
--- a/source/common/src/tglobal.c
+++ b/source/common/src/tglobal.c
@@ -27,7 +27,7 @@
#include "cus_name.h"
#endif
-GRANT_CFG_DECLARE;
+// GRANT_CFG_DECLARE;
SConfig *tsCfg = NULL;
@@ -58,7 +58,7 @@ int32_t tsNumOfMnodeQueryThreads = 4;
int32_t tsNumOfMnodeFetchThreads = 1;
int32_t tsNumOfMnodeReadThreads = 1;
int32_t tsNumOfVnodeQueryThreads = 4;
-float tsRatioOfVnodeStreamThreads = 1.0;
+float tsRatioOfVnodeStreamThreads = 0.5F;
int32_t tsNumOfVnodeFetchThreads = 4;
int32_t tsNumOfVnodeRsmaThreads = 2;
int32_t tsNumOfQnodeQueryThreads = 4;
@@ -623,7 +623,7 @@ static int32_t taosAddServerCfg(SConfig *pCfg) {
0)
return -1;
- if (cfgAddFloat(pCfg, "ratioOfVnodeStreamThreads", tsRatioOfVnodeStreamThreads, 0.01, 10, CFG_SCOPE_SERVER,
+ if (cfgAddFloat(pCfg, "ratioOfVnodeStreamThreads", tsRatioOfVnodeStreamThreads, 0.01, 4, CFG_SCOPE_SERVER,
CFG_DYN_NONE) != 0)
return -1;
@@ -807,7 +807,7 @@ static int32_t taosAddServerCfg(SConfig *pCfg) {
if (cfgAddBool(pCfg, "experimental", tsExperimental, CFG_SCOPE_BOTH, CFG_DYN_BOTH) != 0) return -1;
- GRANT_CFG_ADD;
+ // GRANT_CFG_ADD;
return 0;
}
@@ -1234,7 +1234,7 @@ static int32_t taosSetServerCfg(SConfig *pCfg) {
tsExperimental = cfgGetItem(pCfg, "experimental")->bval;
- GRANT_CFG_GET;
+ // GRANT_CFG_GET;
return 0;
}
diff --git a/source/common/src/tgrant.c b/source/common/src/tgrant.c
index 74a59fd580..f212d71362 100644
--- a/source/common/src/tgrant.c
+++ b/source/common/src/tgrant.c
@@ -18,6 +18,6 @@
#ifndef _GRANT
-int32_t grantCheck(EGrantType grant) { return TSDB_CODE_SUCCESS; }
+int32_t grantCheck(EGrantType grant) {return TSDB_CODE_SUCCESS;}
#endif
\ No newline at end of file
diff --git a/source/common/src/tmisce.c b/source/common/src/tmisce.c
index 95a5c27cf1..1606b45eed 100644
--- a/source/common/src/tmisce.c
+++ b/source/common/src/tmisce.c
@@ -15,11 +15,8 @@
#define _DEFAULT_SOURCE
#include "tmisce.h"
-#include "tjson.h"
#include "tglobal.h"
-#include "tlog.h"
-#include "tname.h"
-
+#include "tjson.h"
int32_t taosGetFqdnPortFromEp(const char* ep, SEp* pEp) {
pEp->port = 0;
memset(pEp->fqdn, 0, TSDB_FQDN_LEN);
@@ -63,7 +60,7 @@ bool isEpsetEqual(const SEpSet* s1, const SEpSet* s2) {
void epsetAssign(SEpSet* pDst, const SEpSet* pSrc) {
if (pSrc == NULL || pDst == NULL) {
- return;
+ return;
}
pDst->inUse = pSrc->inUse;
@@ -73,6 +70,47 @@ void epsetAssign(SEpSet* pDst, const SEpSet* pSrc) {
tstrncpy(pDst->eps[i].fqdn, pSrc->eps[i].fqdn, tListLen(pSrc->eps[i].fqdn));
}
}
+void epAssign(SEp* pDst, SEp* pSrc) {
+ if (pSrc == NULL || pDst == NULL) {
+ return;
+ }
+ memset(pDst->fqdn, 0, tListLen(pSrc->fqdn));
+ tstrncpy(pDst->fqdn, pSrc->fqdn, tListLen(pSrc->fqdn));
+ pDst->port = pSrc->port;
+}
+void epsetSort(SEpSet* pDst) {
+ if (pDst->numOfEps <= 1) {
+ return;
+ }
+ int validIdx = false;
+ SEp ep = {0};
+ if (pDst->inUse >= 0 && pDst->inUse < pDst->numOfEps) {
+ validIdx = true;
+ epAssign(&ep, &pDst->eps[pDst->inUse]);
+ }
+
+ for (int i = 0; i < pDst->numOfEps - 1; i++) {
+ for (int j = 0; j < pDst->numOfEps - 1 - i; j++) {
+ SEp* f = &pDst->eps[j];
+ SEp* s = &pDst->eps[j + 1];
+ int cmp = strncmp(f->fqdn, s->fqdn, sizeof(f->fqdn));
+ if (cmp > 0 || (cmp == 0 && f->port > s->port)) {
+ SEp ep = {0};
+ epAssign(&ep, f);
+ epAssign(f, s);
+ epAssign(s, &ep);
+ }
+ }
+ }
+ if (validIdx == true)
+ for (int i = 0; i < pDst->numOfEps; i++) {
+ int cmp = strncmp(ep.fqdn, pDst->eps[i].fqdn, sizeof(ep.fqdn));
+ if (cmp == 0 && ep.port == pDst->eps[i].port) {
+ pDst->inUse = i;
+ break;
+ }
+ }
+}
void updateEpSet_s(SCorEpSet* pEpSet, SEpSet* pNewEpSet) {
taosCorBeginWrite(&pEpSet->version);
diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c
index c9e2908e8a..de505ab3d2 100644
--- a/source/common/src/tmsg.c
+++ b/source/common/src/tmsg.c
@@ -1163,9 +1163,11 @@ int32_t tSerializeSStatusReq(void *buf, int32_t bufLen, SStatusReq *pReq) {
if (tEncodeI64(&encoder, pReq->updateTime) < 0) return -1;
if (tEncodeFloat(&encoder, pReq->numOfCores) < 0) return -1;
if (tEncodeI32(&encoder, pReq->numOfSupportVnodes) < 0) return -1;
+ if (tEncodeI32v(&encoder, pReq->numOfDiskCfg) < 0) return -1;
if (tEncodeI64(&encoder, pReq->memTotal) < 0) return -1;
if (tEncodeI64(&encoder, pReq->memAvail) < 0) return -1;
if (tEncodeCStr(&encoder, pReq->dnodeEp) < 0) return -1;
+ if (tEncodeCStr(&encoder, pReq->machineId) < 0) return -1;
// cluster cfg
if (tEncodeI32(&encoder, pReq->clusterCfg.statusInterval) < 0) return -1;
@@ -1253,9 +1255,11 @@ int32_t tDeserializeSStatusReq(void *buf, int32_t bufLen, SStatusReq *pReq) {
if (tDecodeI64(&decoder, &pReq->updateTime) < 0) return -1;
if (tDecodeFloat(&decoder, &pReq->numOfCores) < 0) return -1;
if (tDecodeI32(&decoder, &pReq->numOfSupportVnodes) < 0) return -1;
+ if (tDecodeI32v(&decoder, &pReq->numOfDiskCfg) < 0) return -1;
if (tDecodeI64(&decoder, &pReq->memTotal) < 0) return -1;
if (tDecodeI64(&decoder, &pReq->memAvail) < 0) return -1;
if (tDecodeCStrTo(&decoder, pReq->dnodeEp) < 0) return -1;
+ if (tDecodeCStrTo(&decoder, pReq->machineId) < 0) return -1;
// cluster cfg
if (tDecodeI32(&decoder, &pReq->clusterCfg.statusInterval) < 0) return -1;
@@ -2266,6 +2270,37 @@ int32_t tDeserializeSGetUserWhiteListRsp(void *buf, int32_t bufLen, SGetUserWhit
void tFreeSGetUserWhiteListRsp(SGetUserWhiteListRsp *pRsp) { taosMemoryFree(pRsp->pWhiteLists); }
+int32_t tSerializeSMCfgClusterReq(void *buf, int32_t bufLen, SMCfgClusterReq *pReq) {
+ SEncoder encoder = {0};
+ tEncoderInit(&encoder, buf, bufLen);
+
+ if (tStartEncode(&encoder) < 0) return -1;
+ if (tEncodeCStr(&encoder, pReq->config) < 0) return -1;
+ if (tEncodeCStr(&encoder, pReq->value) < 0) return -1;
+ ENCODESQL();
+ tEndEncode(&encoder);
+
+ int32_t tlen = encoder.pos;
+ tEncoderClear(&encoder);
+ return tlen;
+}
+
+int32_t tDeserializeSMCfgClusterReq(void *buf, int32_t bufLen, SMCfgClusterReq *pReq) {
+ SDecoder decoder = {0};
+ tDecoderInit(&decoder, buf, bufLen);
+
+ if (tStartDecode(&decoder) < 0) return -1;
+ if (tDecodeCStrTo(&decoder, pReq->config) < 0) return -1;
+ if (tDecodeCStrTo(&decoder, pReq->value) < 0) return -1;
+ DECODESQL();
+ tEndDecode(&decoder);
+
+ tDecoderClear(&decoder);
+ return 0;
+}
+
+void tFreeSMCfgClusterReq(SMCfgClusterReq *pReq) { FREESQL(); }
+
int32_t tSerializeSCreateDropMQSNodeReq(void *buf, int32_t bufLen, SMCreateQnodeReq *pReq) {
SEncoder encoder = {0};
tEncoderInit(&encoder, buf, bufLen);
@@ -6139,6 +6174,55 @@ int32_t tDeserializeSMqAskEpReq(void *buf, int32_t bufLen, SMqAskEpReq *pReq) {
return 0;
}
+int32_t tDeatroySMqHbRsp(SMqHbRsp *pRsp) {
+ taosArrayDestroy(pRsp->topicPrivileges);
+ return 0;
+}
+
+int32_t tSerializeSMqHbRsp(void *buf, int32_t bufLen, SMqHbRsp *pRsp) {
+ SEncoder encoder = {0};
+ tEncoderInit(&encoder, buf, bufLen);
+ if (tStartEncode(&encoder) < 0) return -1;
+
+ int32_t sz = taosArrayGetSize(pRsp->topicPrivileges);
+ if (tEncodeI32(&encoder, sz) < 0) return -1;
+ for (int32_t i = 0; i < sz; ++i) {
+ STopicPrivilege *privilege = (STopicPrivilege *)taosArrayGet(pRsp->topicPrivileges, i);
+ if (tEncodeCStr(&encoder, privilege->topic) < 0) return -1;
+ if (tEncodeI8(&encoder, privilege->noPrivilege) < 0) return -1;
+ }
+
+ tEndEncode(&encoder);
+
+ int32_t tlen = encoder.pos;
+ tEncoderClear(&encoder);
+
+ return tlen;
+}
+
+int32_t tDeserializeSMqHbRsp(void *buf, int32_t bufLen, SMqHbRsp *pRsp) {
+ SDecoder decoder = {0};
+ tDecoderInit(&decoder, (char *)buf, bufLen);
+
+ if (tStartDecode(&decoder) < 0) return -1;
+
+ int32_t sz = 0;
+ if (tDecodeI32(&decoder, &sz) < 0) return -1;
+ if (sz > 0) {
+ pRsp->topicPrivileges = taosArrayInit(sz, sizeof(STopicPrivilege));
+ if (NULL == pRsp->topicPrivileges) return -1;
+ for (int32_t i = 0; i < sz; ++i) {
+ STopicPrivilege *data = taosArrayReserve(pRsp->topicPrivileges, 1);
+ if (tDecodeCStrTo(&decoder, data->topic) < 0) return -1;
+ if (tDecodeI8(&decoder, &data->noPrivilege) < 0) return -1;
+ }
+ }
+ tEndDecode(&decoder);
+
+ tDecoderClear(&decoder);
+ return 0;
+}
+
int32_t tDeatroySMqHbReq(SMqHbReq *pReq) {
for (int i = 0; i < taosArrayGetSize(pReq->topics); i++) {
TopicOffsetRows *vgs = taosArrayGet(pReq->topics, i);
@@ -6194,7 +6278,7 @@ int32_t tDeserializeSMqHbReq(void *buf, int32_t bufLen, SMqHbReq *pReq) {
if (NULL == pReq->topics) return -1;
for (int32_t i = 0; i < sz; ++i) {
TopicOffsetRows *data = taosArrayReserve(pReq->topics, 1);
- tDecodeCStrTo(&decoder, data->topicName);
+ if (tDecodeCStrTo(&decoder, data->topicName) < 0) return -1;
int32_t szVgs = 0;
if (tDecodeI32(&decoder, &szVgs) < 0) return -1;
if (szVgs > 0) {
@@ -7753,36 +7837,6 @@ static int32_t tDecodeSVSubmitBlk(SDecoder *pCoder, SVSubmitBlk *pBlock, int32_t
return 0;
}
-int32_t tEncodeSVSubmitReq(SEncoder *pCoder, const SVSubmitReq *pReq) {
- int32_t nBlocks = taosArrayGetSize(pReq->pArray);
-
- if (tStartEncode(pCoder) < 0) return -1;
-
- if (tEncodeI32v(pCoder, pReq->flags) < 0) return -1;
- if (tEncodeI32v(pCoder, nBlocks) < 0) return -1;
- for (int32_t iBlock = 0; iBlock < nBlocks; iBlock++) {
- if (tEncodeSVSubmitBlk(pCoder, (SVSubmitBlk *)taosArrayGet(pReq->pArray, iBlock), pReq->flags) < 0) return -1;
- }
-
- tEndEncode(pCoder);
- return 0;
-}
-
-int32_t tDecodeSVSubmitReq(SDecoder *pCoder, SVSubmitReq *pReq) {
- if (tStartDecode(pCoder) < 0) return -1;
-
- if (tDecodeI32v(pCoder, &pReq->flags) < 0) return -1;
- if (tDecodeI32v(pCoder, &pReq->nBlocks) < 0) return -1;
- pReq->pBlocks = tDecoderMalloc(pCoder, sizeof(SVSubmitBlk) * pReq->nBlocks);
- if (pReq->pBlocks == NULL) return -1;
- for (int32_t iBlock = 0; iBlock < pReq->nBlocks; iBlock++) {
- if (tDecodeSVSubmitBlk(pCoder, pReq->pBlocks + iBlock, pReq->flags) < 0) return -1;
- }
-
- tEndDecode(pCoder);
- return 0;
-}
-
static int32_t tEncodeSSubmitBlkRsp(SEncoder *pEncoder, const SSubmitBlkRsp *pBlock) {
if (tStartEncode(pEncoder) < 0) return -1;
diff --git a/source/common/test/commonTests.cpp b/source/common/test/commonTests.cpp
index 9f7ee165ac..8e0e50165f 100644
--- a/source/common/test/commonTests.cpp
+++ b/source/common/test/commonTests.cpp
@@ -12,9 +12,10 @@
#include "tcommon.h"
#include "tdatablock.h"
#include "tdef.h"
-#include "tvariant.h"
+#include "tmisce.h"
#include "ttime.h"
#include "ttokendef.h"
+#include "tvariant.h"
namespace {
//
@@ -25,11 +26,10 @@ int main(int argc, char** argv) {
return RUN_ALL_TESTS();
}
-
TEST(testCase, toUIntegerEx_test) {
uint64_t val = 0;
- char* s = "123";
+ char* s = "123";
int32_t ret = toUIntegerEx(s, strlen(s), TK_NK_INTEGER, &val);
ASSERT_EQ(ret, 0);
ASSERT_EQ(val, 123);
@@ -59,7 +59,7 @@ TEST(testCase, toUIntegerEx_test) {
ASSERT_EQ(val, 18699);
s = "-1";
- ret = toUIntegerEx(s, strlen(s),TK_NK_INTEGER, &val);
+ ret = toUIntegerEx(s, strlen(s), TK_NK_INTEGER, &val);
ASSERT_EQ(ret, -1);
s = "-0b10010";
@@ -103,7 +103,7 @@ TEST(testCase, toUIntegerEx_test) {
TEST(testCase, toIntegerEx_test) {
int64_t val = 0;
- char* s = "123";
+ char* s = "123";
int32_t ret = toIntegerEx(s, strlen(s), TK_NK_INTEGER, &val);
ASSERT_EQ(ret, 0);
ASSERT_EQ(val, 123);
@@ -166,7 +166,7 @@ TEST(testCase, toIntegerEx_test) {
s = "-9223372036854775808";
ret = toIntegerEx(s, strlen(s), TK_NK_INTEGER, &val);
ASSERT_EQ(ret, 0);
- ASSERT_EQ(val, -9223372036854775808);
+ // ASSERT_EQ(val, -9223372036854775808);
// out of range
s = "9323372036854775807";
@@ -186,7 +186,7 @@ TEST(testCase, toIntegerEx_test) {
TEST(testCase, toInteger_test) {
int64_t val = 0;
- char* s = "123";
+ char* s = "123";
int32_t ret = toInteger(s, strlen(s), 10, &val);
ASSERT_EQ(ret, 0);
ASSERT_EQ(val, 123);
@@ -223,10 +223,10 @@ TEST(testCase, toInteger_test) {
s = "-9223372036854775808";
ret = toInteger(s, strlen(s), 10, &val);
ASSERT_EQ(ret, 0);
- ASSERT_EQ(val, -9223372036854775808);
+ // ASSERT_EQ(val, -9223372036854775808);
// out of range
- s = "9323372036854775807";
+ s = "9323372036854775807";
ret = toInteger(s, strlen(s), 10, &val);
ASSERT_EQ(ret, -1);
@@ -418,9 +418,10 @@ void check_tm(const STm* tm, int32_t y, int32_t mon, int32_t d, int32_t h, int32
ASSERT_EQ(tm->fsec, fsec);
}
-void test_timestamp_tm_conversion(int64_t ts, int32_t precision, int32_t y, int32_t mon, int32_t d, int32_t h, int32_t m, int32_t s, int64_t fsec) {
- int64_t ts_tmp;
- char buf[128] = {0};
+void test_timestamp_tm_conversion(int64_t ts, int32_t precision, int32_t y, int32_t mon, int32_t d, int32_t h,
+ int32_t m, int32_t s, int64_t fsec) {
+ int64_t ts_tmp;
+ char buf[128] = {0};
struct STm tm;
taosFormatUtcTime(buf, 128, ts, precision);
printf("formated ts of %ld, precision: %d is: %s\n", ts, precision, buf);
@@ -457,7 +458,7 @@ TEST(timeTest, timestamp2tm) {
test_timestamp_tm_conversion(ts, TSDB_TIME_PRECISION_MILLI, 1970 - 1900, 0 /* mon start from 0*/, 1, 8, 0, 0,
000000000L);
- ts = -62198784343000; // milliseconds before epoch, Friday, January 1, -0001 12:00:00 AM GMT+08:06
+ ts = -62198784343000; // milliseconds before epoch, Friday, January 1, -0001 12:00:00 AM GMT+08:06
test_timestamp_tm_conversion(ts, TSDB_TIME_PRECISION_MILLI, -1 - 1900, 0 /* mon start from 0*/, 1,
0 /* hour start from 0*/, 0, 0, 000000000L);
}
@@ -472,7 +473,7 @@ void test_ts2char(int64_t ts, const char* format, int32_t precison, const char*
TEST(timeTest, ts2char) {
osDefaultInit();
if (tsTimezone != TdEastZone8) GTEST_SKIP();
- int64_t ts;
+ int64_t ts;
const char* format = "YYYY-MM-DD";
ts = 0;
test_ts2char(ts, format, TSDB_TIME_PRECISION_MILLI, "1970-01-01");
@@ -493,12 +494,13 @@ TEST(timeTest, ts2char) {
"2023-023-23-3-2023-023-23-3-年-OCTOBER -OCT-October -Oct-october "
"-oct-月-286-13-6-286-13-6-FRIDAY -Friday -friday -日");
#endif
- ts = 1697182085123L; // Friday, October 13, 2023 3:28:05.123 PM GMT+08:00
+ ts = 1697182085123L; // Friday, October 13, 2023 3:28:05.123 PM GMT+08:00
test_ts2char(ts, "HH24:hh24:HH12:hh12:HH:hh:MI:mi:SS:ss:MS:ms:US:us:NS:ns:PM:AM:pm:am", TSDB_TIME_PRECISION_MILLI,
"15:15:03:03:03:03:28:28:05:05:123:123:123000:123000:123000000:123000000:PM:PM:pm:pm");
// double quotes normal output
- test_ts2char(ts, "\\\"HH24:hh24:HH12:hh12:HH:hh:MI:mi:SS:ss:MS:ms:US:us:NS:ns:PM:AM:pm:am\\\"", TSDB_TIME_PRECISION_MILLI,
+ test_ts2char(ts, "\\\"HH24:hh24:HH12:hh12:HH:hh:MI:mi:SS:ss:MS:ms:US:us:NS:ns:PM:AM:pm:am\\\"",
+ TSDB_TIME_PRECISION_MILLI,
"\"15:15:03:03:03:03:28:28:05:05:123:123:123000:123000:123000000:123000000:PM:PM:pm:pm\"");
test_ts2char(ts, "\\\"HH24:hh24:HH12:hh12:HH:hh:MI:mi:SS:ss:MS:ms:US:us:NS:ns:PM:AM:pm:am", TSDB_TIME_PRECISION_MILLI,
"\"15:15:03:03:03:03:28:28:05:05:123:123:123000:123000:123000000:123000000:PM:PM:pm:pm");
@@ -506,14 +508,18 @@ TEST(timeTest, ts2char) {
test_ts2char(ts, "\"HH24:hh24:HH12:hh12:HH:hh:MI:mi:SS:ss:MS:ms:US:us:NS:ns:PM:AM:pm:am", TSDB_TIME_PRECISION_MILLI,
"HH24:hh24:HH12:hh12:HH:hh:MI:mi:SS:ss:MS:ms:US:us:NS:ns:PM:AM:pm:am");
test_ts2char(ts, "yyyy-mm-dd hh24:mi:ss.nsamaaa", TSDB_TIME_PRECISION_MILLI, "2023-10-13 15:28:05.123000000pmaaa");
- test_ts2char(ts, "aaa--yyyy-mm-dd hh24:mi:ss.nsamaaa", TSDB_TIME_PRECISION_MILLI, "aaa--2023-10-13 15:28:05.123000000pmaaa");
- test_ts2char(ts, "add--yyyy-mm-dd hh24:mi:ss.nsamaaa", TSDB_TIME_PRECISION_MILLI, "a13--2023-10-13 15:28:05.123000000pmaaa");
+ test_ts2char(ts, "aaa--yyyy-mm-dd hh24:mi:ss.nsamaaa", TSDB_TIME_PRECISION_MILLI,
+ "aaa--2023-10-13 15:28:05.123000000pmaaa");
+ test_ts2char(ts, "add--yyyy-mm-dd hh24:mi:ss.nsamaaa", TSDB_TIME_PRECISION_MILLI,
+ "a13--2023-10-13 15:28:05.123000000pmaaa");
ts = 1693946405000;
- test_ts2char(ts, "Day, Month dd, YYYY hh24:mi:ss AM TZH:tzh", TSDB_TIME_PRECISION_MILLI, "Wednesday, September 06, 2023 04:40:05 AM +08:+08");
+ test_ts2char(ts, "Day, Month dd, YYYY hh24:mi:ss AM TZH:tzh", TSDB_TIME_PRECISION_MILLI,
+ "Wednesday, September 06, 2023 04:40:05 AM +08:+08");
- ts = -62198784343000; // milliseconds before epoch, Friday, January 1, -0001 12:00:00 AM GMT+08:06
- test_ts2char(ts, "Day, Month dd, YYYY hh12:mi:ss AM", TSDB_TIME_PRECISION_MILLI, "Friday , January 01, -001 12:00:00 AM");
+ ts = -62198784343000; // milliseconds before epoch, Friday, January 1, -0001 12:00:00 AM GMT+08:06
+ test_ts2char(ts, "Day, Month dd, YYYY hh12:mi:ss AM", TSDB_TIME_PRECISION_MILLI,
+ "Friday , January 01, -001 12:00:00 AM");
}
TEST(timeTest, char2ts) {
@@ -609,7 +615,7 @@ TEST(timeTest, char2ts) {
ASSERT_EQ(-1, TEST_char2ts("yyyyMMdd ", &ts, TSDB_TIME_PRECISION_MICRO, "2100/2/1"));
// nothing to be converted to dd
ASSERT_EQ(0, TEST_char2ts("yyyyMMdd ", &ts, TSDB_TIME_PRECISION_MICRO, "210012"));
- ASSERT_EQ(ts, 4131273600000000LL); // 2100-12-1
+ ASSERT_EQ(ts, 4131273600000000LL); // 2100-12-1
ASSERT_EQ(-1, TEST_char2ts("yyyyMMdd ", &ts, TSDB_TIME_PRECISION_MICRO, "21001"));
ASSERT_EQ(-1, TEST_char2ts("yyyyMM-dd ", &ts, TSDB_TIME_PRECISION_MICRO, "23a1-1"));
@@ -635,8 +641,55 @@ TEST(timeTest, char2ts) {
ASSERT_EQ(0, TEST_char2ts("yyyy年 MM/ddTZH", &ts, TSDB_TIME_PRECISION_MICRO, "1970年 1/1+0"));
ASSERT_EQ(ts, 0);
ASSERT_EQ(0, TEST_char2ts("yyyy年 a a a MM/ddTZH", &ts, TSDB_TIME_PRECISION_MICRO, "1970年 a a a 1/1+0"));
- ASSERT_EQ(0, TEST_char2ts("yyyy年 a a a a a a a a a a a a a a a MM/ddTZH", &ts, TSDB_TIME_PRECISION_MICRO, "1970年 a "));
+ ASSERT_EQ(0, TEST_char2ts("yyyy年 a a a a a a a a a a a a a a a MM/ddTZH", &ts, TSDB_TIME_PRECISION_MICRO,
+ "1970年 a "));
ASSERT_EQ(-3, TEST_char2ts("yyyy-mm-DDD", &ts, TSDB_TIME_PRECISION_MILLI, "1970-01-001"));
}
+TEST(timeTest, epSet) {
+ {
+ SEpSet ep = {0};
+ addEpIntoEpSet(&ep, "local", 14);
+ addEpIntoEpSet(&ep, "aocal", 13);
+ addEpIntoEpSet(&ep, "abcal", 12);
+ addEpIntoEpSet(&ep, "abcaleb", 11);
+ epsetSort(&ep);
+ ASSERT_EQ(strcmp(ep.eps[0].fqdn, "abcal"), 0);
+ ASSERT_EQ(ep.eps[0].port, 12);
+
+ ASSERT_EQ(strcmp(ep.eps[1].fqdn, "abcaleb"), 0);
+ ASSERT_EQ(ep.eps[1].port, 11);
+
+ ASSERT_EQ(strcmp(ep.eps[2].fqdn, "aocal"), 0);
+ ASSERT_EQ(ep.eps[2].port, 13);
+
+ ASSERT_EQ(strcmp(ep.eps[3].fqdn, "local"), 0);
+ ASSERT_EQ(ep.eps[3].port, 14);
+ }
+ {
+ SEpSet ep = {0};
+ addEpIntoEpSet(&ep, "local", 14);
+ addEpIntoEpSet(&ep, "local", 13);
+ addEpIntoEpSet(&ep, "local", 12);
+ addEpIntoEpSet(&ep, "local", 11);
+ epsetSort(&ep);
+ ASSERT_EQ(strcmp(ep.eps[0].fqdn, "local"), 0);
+ ASSERT_EQ(ep.eps[0].port, 11);
+
+ ASSERT_EQ(strcmp(ep.eps[0].fqdn, "local"), 0);
+ ASSERT_EQ(ep.eps[1].port, 12);
+
+ ASSERT_EQ(strcmp(ep.eps[0].fqdn, "local"), 0);
+ ASSERT_EQ(ep.eps[2].port, 13);
+
+ ASSERT_EQ(strcmp(ep.eps[0].fqdn, "local"), 0);
+ ASSERT_EQ(ep.eps[3].port, 14);
+ }
+ {
+ SEpSet ep = {0};
+ addEpIntoEpSet(&ep, "local", 14);
+ epsetSort(&ep);
+ ASSERT_EQ(ep.numOfEps, 1);
+ }
+}
#pragma GCC diagnostic pop
diff --git a/source/dnode/mgmt/exe/dmMain.c b/source/dnode/mgmt/exe/dmMain.c
index 756ac8167e..1508d88def 100644
--- a/source/dnode/mgmt/exe/dmMain.c
+++ b/source/dnode/mgmt/exe/dmMain.c
@@ -169,11 +169,29 @@ static int32_t dmParseArgs(int32_t argc, char const *argv[]) {
return -1;
}
} else if (strcmp(argv[i], "-a") == 0) {
- tstrncpy(global.apolloUrl, argv[++i], PATH_MAX);
+ if(i < argc - 1) {
+ if (strlen(argv[++i]) >= PATH_MAX) {
+ printf("apollo url overflow");
+ return -1;
+ }
+ tstrncpy(global.apolloUrl, argv[i], PATH_MAX);
+ } else {
+ printf("'-a' requires a parameter\n");
+ return -1;
+ }
} else if (strcmp(argv[i], "-s") == 0) {
global.dumpSdb = true;
} else if (strcmp(argv[i], "-E") == 0) {
- tstrncpy(global.envFile, argv[++i], PATH_MAX);
+ if(i < argc - 1) {
+ if (strlen(argv[++i]) >= PATH_MAX) {
+ printf("env file path overflow");
+ return -1;
+ }
+ tstrncpy(global.envFile, argv[i], PATH_MAX);
+ } else {
+ printf("'-E' requires a parameter\n");
+ return -1;
+ }
} else if (strcmp(argv[i], "-k") == 0) {
global.generateGrant = true;
} else if (strcmp(argv[i], "-C") == 0) {
diff --git a/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c b/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c
index 14853009e0..a3a29f6f77 100644
--- a/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c
+++ b/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c
@@ -114,9 +114,15 @@ void dmSendStatusReq(SDnodeMgmt *pMgmt) {
req.updateTime = pMgmt->pData->updateTime;
req.numOfCores = tsNumOfCores;
req.numOfSupportVnodes = tsNumOfSupportVnodes;
+ req.numOfDiskCfg = tsDiskCfgNum;
req.memTotal = tsTotalMemoryKB * 1024;
req.memAvail = req.memTotal - tsRpcQueueMemoryAllowed - 16 * 1024 * 1024;
tstrncpy(req.dnodeEp, tsLocalEp, TSDB_EP_LEN);
+ char *machine = tGetMachineId();
+ if (machine) {
+ tstrncpy(req.machineId, machine, TSDB_MACHINE_ID_LEN + 1);
+ taosMemoryFreeClear(machine);
+ }
req.clusterCfg.statusInterval = tsStatusInterval;
req.clusterCfg.checkTime = 0;
@@ -319,7 +325,7 @@ int32_t dmAppendVariablesToBlock(SSDataBlock *pBlock, int32_t dnodeId) {
for (int32_t i = 0, c = 0; i < numOfCfg; ++i, c = 0) {
SConfigItem *pItem = taosArrayGet(tsCfg->array, i);
- GRANT_CFG_SKIP;
+ // GRANT_CFG_SKIP;
SColumnInfoData *pColInfo = taosArrayGet(pBlock->pDataBlock, c++);
colDataSetVal(pColInfo, i, (const char *)&dnodeId, false);
@@ -429,7 +435,7 @@ SArray *dmGetMsgHandles() {
if (dmSetMgmtHandle(pArray, TDMT_DND_CONFIG_DNODE, dmPutNodeMsgToMgmtQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_DND_SERVER_STATUS, dmPutNodeMsgToMgmtQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_DND_SYSTABLE_RETRIEVE, dmPutNodeMsgToMgmtQueue, 0) == NULL) goto _OVER;
- if (dmSetMgmtHandle(pArray, TDMT_DND_ALTER_MNODE_TYPE, dmPutNodeMsgToMgmtQueue, 0) == NULL) goto _OVER;
+ if (dmSetMgmtHandle(pArray, TDMT_DND_ALTER_MNODE_TYPE, dmPutNodeMsgToMgmtQueue, 0) == NULL) goto _OVER;
// Requests handled by MNODE
if (dmSetMgmtHandle(pArray, TDMT_MND_GRANT, dmPutNodeMsgToMgmtQueue, 0) == NULL) goto _OVER;
diff --git a/source/dnode/mgmt/mgmt_mnode/src/mmHandle.c b/source/dnode/mgmt/mgmt_mnode/src/mmHandle.c
index 0fb246e945..531e6f4b3d 100644
--- a/source/dnode/mgmt/mgmt_mnode/src/mmHandle.c
+++ b/source/dnode/mgmt/mgmt_mnode/src/mmHandle.c
@@ -163,7 +163,6 @@ SArray *mmGetMsgHandles() {
if (dmSetMgmtHandle(pArray, TDMT_MND_DROP_STREAM, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_MND_PAUSE_STREAM, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_MND_RESUME_STREAM, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
- if (dmSetMgmtHandle(pArray, TDMT_MND_GRANT_RSP, mmPutMsgToReadQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_MND_RETRIEVE_IP_WHITE, mmPutMsgToReadQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_MND_GET_USER_WHITELIST, mmPutMsgToReadQueue, 0) == NULL) goto _OVER;
@@ -193,6 +192,7 @@ SArray *mmGetMsgHandles() {
if (dmSetMgmtHandle(pArray, TDMT_MND_DROP_VIEW, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_MND_VIEW_META, mmPutMsgToReadQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_MND_KILL_COMPACT, mmPutMsgToReadQueue, 0) == NULL) goto _OVER;
+ if (dmSetMgmtHandle(pArray, TDMT_MND_CONFIG_CLUSTER, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_VND_QUERY_COMPACT_PROGRESS_RSP, mmPutMsgToReadQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_SCH_QUERY, mmPutMsgToQueryQueue, 1) == NULL) goto _OVER;
@@ -223,6 +223,7 @@ SArray *mmGetMsgHandles() {
if (dmSetMgmtHandle(pArray, TDMT_VND_STREAM_TASK_UPDATE_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_VND_STREAM_TASK_RESET_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_MND_STREAM_HEARTBEAT, mmPutMsgToReadQueue, 0) == NULL) goto _OVER;
+ if (dmSetMgmtHandle(pArray, TDMT_MND_STREAM_REQ_CHKPT, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_VND_KILL_COMPACT_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_VND_ALTER_CONFIG_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
diff --git a/source/dnode/mgmt/mgmt_snode/src/smHandle.c b/source/dnode/mgmt/mgmt_snode/src/smHandle.c
index 444739e461..1488df3cb1 100644
--- a/source/dnode/mgmt/mgmt_snode/src/smHandle.c
+++ b/source/dnode/mgmt/mgmt_snode/src/smHandle.c
@@ -84,11 +84,8 @@ SArray *smGetMsgHandles() {
if (dmSetMgmtHandle(pArray, TDMT_STREAM_TASK_PAUSE, smPutNodeMsgToMgmtQueue, 1) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_STREAM_TASK_RESUME, smPutNodeMsgToMgmtQueue, 1) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_STREAM_TASK_STOP, smPutNodeMsgToMgmtQueue, 1) == NULL) goto _OVER;
- if (dmSetMgmtHandle(pArray, TDMT_STREAM_HTASK_DROP, smPutNodeMsgToMgmtQueue, 1) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_VND_STREAM_TASK_CHECK, smPutNodeMsgToStreamQueue, 1) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_VND_STREAM_TASK_CHECK_RSP, smPutNodeMsgToStreamQueue, 1) == NULL) goto _OVER;
- if (dmSetMgmtHandle(pArray, TDMT_VND_STREAM_SCAN_HISTORY_FINISH, smPutNodeMsgToStreamQueue, 1) == NULL) goto _OVER;
- if (dmSetMgmtHandle(pArray, TDMT_VND_STREAM_SCAN_HISTORY_FINISH_RSP, smPutNodeMsgToStreamQueue, 1) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_STREAM_TASK_CHECKPOINT_READY, smPutNodeMsgToStreamQueue, 1) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_VND_STREAM_TASK_RESET, smPutNodeMsgToMgmtQueue, 1) == NULL) goto _OVER;
diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c b/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c
index 9438f953a9..a2f0b7aced 100644
--- a/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c
+++ b/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c
@@ -828,14 +828,11 @@ SArray *vmGetMsgHandles() {
if (dmSetMgmtHandle(pArray, TDMT_STREAM_TASK_DISPATCH_RSP, 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_VND_STREAM_SCAN_HISTORY_FINISH, vmPutMsgToStreamQueue, 0) == NULL) goto _OVER;
- if (dmSetMgmtHandle(pArray, TDMT_VND_STREAM_SCAN_HISTORY_FINISH_RSP, vmPutMsgToStreamQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_VND_STREAM_TASK_CHECK, vmPutMsgToStreamQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_VND_STREAM_TASK_CHECK_RSP, vmPutMsgToStreamQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_STREAM_TASK_PAUSE, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_STREAM_TASK_RESUME, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_STREAM_TASK_STOP, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
- if (dmSetMgmtHandle(pArray, TDMT_STREAM_HTASK_DROP, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_VND_STREAM_CHECK_POINT_SOURCE, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_STREAM_TASK_CHECKPOINT_READY, vmPutMsgToStreamQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_VND_STREAM_TASK_UPDATE, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
diff --git a/source/dnode/mgmt/node_mgmt/inc/dmMgmt.h b/source/dnode/mgmt/node_mgmt/inc/dmMgmt.h
index cb3395dcc2..bc6a4652e7 100644
--- a/source/dnode/mgmt/node_mgmt/inc/dmMgmt.h
+++ b/source/dnode/mgmt/node_mgmt/inc/dmMgmt.h
@@ -72,7 +72,6 @@ typedef struct SUdfdData {
int32_t dnodeId;
} SUdfdData;
-#ifndef TD_MODULE_OPTIMIZE
typedef struct SDnode {
int8_t once;
bool stop;
@@ -86,21 +85,6 @@ typedef struct SDnode {
SMgmtWrapper wrappers[NODE_END];
SDnodeTrans trans;
} SDnode;
-#else
-typedef struct SDnode {
- int8_t once;
- bool stop;
- EDndRunStatus status;
- SStartupInfo startup;
- SDnodeTrans trans;
- SUdfdData udfdData;
- TdThreadMutex mutex;
- TdFilePtr lockfile;
- SDnodeData data;
- STfs *pTfs;
- SMgmtWrapper wrappers[NODE_END];
-} SDnode;
-#endif
// dmEnv.c
SDnode *dmInstance();
@@ -115,12 +99,7 @@ int32_t dmMarkWrapper(SMgmtWrapper *pWrapper);
void dmReleaseWrapper(SMgmtWrapper *pWrapper);
int32_t dmInitVars(SDnode *pDnode);
void dmClearVars(SDnode *pDnode);
-#ifdef TD_MODULE_OPTIMIZE
-int32_t dmInitModule(SDnode *pDnode, SMgmtWrapper *wrappers);
-bool dmRequireNode(SDnode *pDnode, SMgmtWrapper *pWrapper);
-#else
-int32_t dmInitModule(SDnode *pDnode);
-#endif
+int32_t dmInitModule(SDnode *pDnode);
SMgmtInputOpt dmBuildMgmtInputOpt(SMgmtWrapper *pWrapper);
void dmSetStatus(SDnode *pDnode, EDndRunStatus stype);
void dmProcessServerStartupStatus(SDnode *pDnode, SRpcMsg *pMsg);
@@ -143,11 +122,7 @@ void dmCleanupClient(SDnode *pDnode);
void dmCleanupStatusClient(SDnode *pDnode);
void dmCleanupSyncClient(SDnode *pDnode);
SMsgCb dmGetMsgcb(SDnode *pDnode);
-#ifdef TD_MODULE_OPTIMIZE
-int32_t dmInitMsgHandle(SDnode *pDnode, SMgmtWrapper *wrappers);
-#else
int32_t dmInitMsgHandle(SDnode *pDnode);
-#endif
int32_t dmProcessNodeMsg(SMgmtWrapper *pWrapper, SRpcMsg *pMsg);
// dmMonitor.c
diff --git a/source/dnode/mgmt/node_mgmt/src/dmMgmt.c b/source/dnode/mgmt/node_mgmt/src/dmMgmt.c
index 1a222a3fd4..6cbf31b15f 100644
--- a/source/dnode/mgmt/node_mgmt/src/dmMgmt.c
+++ b/source/dnode/mgmt/node_mgmt/src/dmMgmt.c
@@ -24,7 +24,6 @@
#include "tglobal.h"
#endif
-#ifndef TD_MODULE_OPTIMIZE
static bool dmRequireNode(SDnode *pDnode, SMgmtWrapper *pWrapper) {
SMgmtInputOpt input = dmBuildMgmtInputOpt(pWrapper);
@@ -38,7 +37,6 @@ static bool dmRequireNode(SDnode *pDnode, SMgmtWrapper *pWrapper) {
return required;
}
-#endif
int32_t dmInitDnode(SDnode *pDnode) {
dDebug("start to create dnode");
@@ -81,15 +79,9 @@ int32_t dmInitDnode(SDnode *pDnode) {
if (pDnode->lockfile == NULL) {
goto _OVER;
}
-#ifdef TD_MODULE_OPTIMIZE
- if (dmInitModule(pDnode, pDnode->wrappers) != 0) {
- goto _OVER;
- }
-#else
if (dmInitModule(pDnode) != 0) {
goto _OVER;
}
-#endif
indexInit(tsNumOfCommitThreads);
streamMetaInit();
diff --git a/source/dnode/mgmt/node_mgmt/src/dmTransport.c b/source/dnode/mgmt/node_mgmt/src/dmTransport.c
index 3b7ecce77c..1a31f08801 100644
--- a/source/dnode/mgmt/node_mgmt/src/dmTransport.c
+++ b/source/dnode/mgmt/node_mgmt/src/dmTransport.c
@@ -251,33 +251,6 @@ _OVER:
dmReleaseWrapper(pWrapper);
}
-#ifdef TD_MODULE_OPTIMIZE
-int32_t dmInitMsgHandle(SDnode *pDnode, SMgmtWrapper *wrappers) {
- SDnodeTrans *pTrans = &pDnode->trans;
-
- for (EDndNodeType ntype = DNODE; ntype < NODE_END; ++ntype) {
- SMgmtWrapper *pWrapper = wrappers + ntype;
- SArray *pArray = (*pWrapper->func.getHandlesFp)();
- if (pArray == NULL) return -1;
-
- for (int32_t i = 0; i < taosArrayGetSize(pArray); ++i) {
- SMgmtHandle *pMgmt = taosArrayGet(pArray, i);
- SDnodeHandle *pHandle = &pTrans->msgHandles[TMSG_INDEX(pMgmt->msgType)];
- if (pMgmt->needCheckVgId) {
- pHandle->needCheckVgId = pMgmt->needCheckVgId;
- }
- if (!pMgmt->needCheckVgId) {
- pHandle->defaultNtype = ntype;
- }
- pWrapper->msgFps[TMSG_INDEX(pMgmt->msgType)] = pMgmt->msgFp;
- }
-
- taosArrayDestroy(pArray);
- }
-
- return 0;
-}
-#else
int32_t dmInitMsgHandle(SDnode *pDnode) {
SDnodeTrans *pTrans = &pDnode->trans;
@@ -303,7 +276,6 @@ int32_t dmInitMsgHandle(SDnode *pDnode) {
return 0;
}
-#endif
static inline int32_t dmSendReq(const SEpSet *pEpSet, SRpcMsg *pMsg) {
SDnode *pDnode = dmInstance();
@@ -350,7 +322,7 @@ static bool rpcRfp(int32_t code, tmsg_t msgType) {
code == TSDB_CODE_SYN_RESTORING || code == TSDB_CODE_VND_STOPPED || code == TSDB_CODE_APP_IS_STARTING ||
code == TSDB_CODE_APP_IS_STOPPING) {
if (msgType == TDMT_SCH_QUERY || msgType == TDMT_SCH_MERGE_QUERY || msgType == TDMT_SCH_FETCH ||
- msgType == TDMT_SCH_MERGE_FETCH || msgType == TDMT_SCH_TASK_NOTIFY) {
+ msgType == TDMT_SCH_MERGE_FETCH || msgType == TDMT_SCH_TASK_NOTIFY || msgType == TDMT_VND_DROP_TTL_TABLE) {
return false;
}
return true;
diff --git a/source/dnode/mgmt/node_util/src/dmEps.c b/source/dnode/mgmt/node_util/src/dmEps.c
index bee77528bd..20245c806b 100644
--- a/source/dnode/mgmt/node_util/src/dmEps.c
+++ b/source/dnode/mgmt/node_util/src/dmEps.c
@@ -223,7 +223,7 @@ int32_t dmWriteEps(SDnodeData *pData) {
terrno = TSDB_CODE_OUT_OF_MEMORY;
- if((code == dmInitDndInfo(pData)) != 0) goto _OVER;
+ if ((code == dmInitDndInfo(pData)) != 0) goto _OVER;
pJson = tjsonCreateObject();
if (pJson == NULL) goto _OVER;
pData->engineVer = tsVersion;
@@ -289,6 +289,7 @@ static void dmResetEps(SDnodeData *pData, SArray *dnodeEps) {
pData->mnodeEps.eps[mIndex] = pDnodeEp->ep;
mIndex++;
}
+ epsetSort(&pData->mnodeEps);
for (int32_t i = 0; i < numOfEps; i++) {
SDnodeEp *pDnodeEp = taosArrayGet(dnodeEps, i);
diff --git a/source/dnode/mnode/impl/inc/mndDef.h b/source/dnode/mnode/impl/inc/mndDef.h
index 8b50465b5f..23cb89d49c 100644
--- a/source/dnode/mnode/impl/inc/mndDef.h
+++ b/source/dnode/mnode/impl/inc/mndDef.h
@@ -76,6 +76,7 @@ typedef enum {
MND_OPER_DROP_TOPIC,
MND_OPER_CREATE_VIEW,
MND_OPER_DROP_VIEW,
+ MND_OPER_CONFIG_CLUSTER,
} EOperType;
typedef enum {
@@ -204,6 +205,7 @@ typedef struct {
int32_t numOfVnodes;
int32_t numOfOtherNodes;
int32_t numOfSupportVnodes;
+ int32_t numOfDiskCfg;
float numOfCores;
int64_t memTotal;
int64_t memAvail;
@@ -214,6 +216,7 @@ typedef struct {
char ep[TSDB_EP_LEN];
char active[TSDB_ACTIVE_KEY_LEN];
char connActive[TSDB_CONN_ACTIVE_KEY_LEN];
+ char machineId[TSDB_MACHINE_ID_LEN + 1];
} SDnodeObj;
typedef struct {
@@ -709,13 +712,6 @@ int32_t tEncodeSStreamObj(SEncoder* pEncoder, const SStreamObj* pObj);
int32_t tDecodeSStreamObj(SDecoder* pDecoder, SStreamObj* pObj, int32_t sver);
void tFreeStreamObj(SStreamObj* pObj);
-// typedef struct {
-// char streamName[TSDB_STREAM_FNAME_LEN];
-// int64_t uid;
-// int64_t streamUid;
-// SArray* childInfo; // SArray
-// } SStreamCheckpointObj;
-
#define VIEW_TYPE_UPDATABLE (1 << 0)
#define VIEW_TYPE_MATERIALIZED (1 << 1)
@@ -762,6 +758,77 @@ typedef struct {
SArray* compactDetail;
} SCompactObj;
+// SGrantLogObj
+typedef enum {
+ GRANT_STATE_INIT = 0,
+ GRANT_STATE_UNGRANTED = 1,
+ GRANT_STATE_GRANTED = 2,
+ GRANT_STATE_EXPIRED = 3,
+ GRANT_STATE_REVOKED = 4,
+ GRANT_STATE_MAX,
+} EGrantState;
+
+typedef enum {
+ GRANT_STATE_REASON_INIT = 0,
+ GRANT_STATE_REASON_ALTER = 1, // alter activeCode 'revoked' or 'xxx'
+ GRANT_STATE_REASON_MISMATCH = 2, // dnode machine mismatch
+ GRANT_STATE_REASON_EXPIRE = 3, // expire
+ GRANT_STATE_REASON_MAX,
+} EGrantStateReason;
+
+#define GRANT_STATE_NUM 30
+#define GRANT_ACTIVE_NUM 10
+#define GRANT_ACTIVE_HEAD_LEN 30
+
+typedef struct {
+ union {
+ int64_t u0;
+ struct {
+ int64_t ts : 40;
+ int64_t lastState : 4;
+ int64_t state : 4;
+ int64_t reason : 8;
+ int64_t reserve : 8;
+ };
+ };
+} SGrantState;
+
+typedef struct {
+ union {
+ int64_t u0;
+ struct {
+ int64_t ts : 40;
+ int64_t reserve : 24;
+ };
+ };
+ char active[GRANT_ACTIVE_HEAD_LEN + 1];
+} SGrantActive;
+
+typedef struct {
+ union {
+ int64_t u0;
+ struct {
+ int64_t ts : 40;
+ int64_t id : 24;
+ };
+ };
+ char machine[TSDB_MACHINE_ID_LEN + 1];
+} SGrantMachine;
+
+typedef struct {
+ int32_t id;
+ int8_t nStates;
+ int8_t nActives;
+ int64_t createTime;
+ int64_t updateTime;
+ int64_t upgradeTime;
+ SGrantState states[GRANT_STATE_NUM];
+ SGrantActive actives[GRANT_ACTIVE_NUM];
+ char* active;
+ SArray* pMachines; // SGrantMachine
+ SRWLatch lock;
+} SGrantLogObj;
+
#ifdef __cplusplus
}
#endif
diff --git a/source/dnode/mnode/impl/inc/mndGrant.h b/source/dnode/mnode/impl/inc/mndGrant.h
index 88f118cb8f..82b3260860 100644
--- a/source/dnode/mnode/impl/inc/mndGrant.h
+++ b/source/dnode/mnode/impl/inc/mndGrant.h
@@ -13,8 +13,8 @@
* along with this program. If not, see .
*/
-#ifndef TDENGINE_GTANT_H
-#define TDENGINE_GTANT_H
+#ifndef _TD_MND_GRANT_H_
+#define _TD_MND_GRANT_H_
#ifdef __cplusplus
"C" {
@@ -29,6 +29,26 @@
void grantAdd(EGrantType grant, uint64_t value);
void grantRestore(EGrantType grant, uint64_t value);
+#ifdef TD_ENTERPRISE
+ SSdbRaw *mndGrantActionEncode(SGrantLogObj * pGrant);
+ SSdbRow *mndGrantActionDecode(SSdbRaw * pRaw);
+ int32_t mndGrantActionInsert(SSdb * pSdb, SGrantLogObj * pGrant);
+ int32_t mndGrantActionDelete(SSdb * pSdb, SGrantLogObj * pGrant);
+ int32_t mndGrantActionUpdate(SSdb * pSdb, SGrantLogObj * pOldGrant, SGrantLogObj * pNewGrant);
+
+#ifdef TD_UNIQ_GRANT
+ int32_t grantAlterActiveCode(SMnode * pMnode, SGrantLogObj * pObj, const char *oldActive, const char *newActive,
+ char **mergeActive);
+#endif
+
+ int32_t mndProcessConfigGrantReq(SMnode * pMnode, SRpcMsg * pReq, SMCfgClusterReq * pCfg);
+ int32_t mndProcessUpdGrantLog(SMnode * pMnode, SRpcMsg * pReq, SArray * pMachines, SGrantState * pState);
+
+ int32_t mndGrantGetLastState(SMnode * pMnode, SGrantState * pState);
+ SGrantLogObj *mndAcquireGrant(SMnode * pMnode, void **ppIter);
+ void mndReleaseGrant(SMnode * pMnode, SGrantLogObj * pGrant, void *pIter);
+#endif
+
#ifdef __cplusplus
}
#endif
diff --git a/source/dnode/mnode/impl/inc/mndPrivilege.h b/source/dnode/mnode/impl/inc/mndPrivilege.h
index 4a8fb20715..6f74ea3b36 100644
--- a/source/dnode/mnode/impl/inc/mndPrivilege.h
+++ b/source/dnode/mnode/impl/inc/mndPrivilege.h
@@ -30,7 +30,6 @@ int32_t mndCheckDbPrivilege(SMnode *pMnode, const char *user, EOperType operType
int32_t mndCheckDbPrivilegeByName(SMnode *pMnode, const char *user, EOperType operType, const char *dbname);
int32_t mndCheckViewPrivilege(SMnode *pMnode, const char *user, EOperType operType, const char *pViewFName);
int32_t mndCheckTopicPrivilege(SMnode *pMnode, const char *user, EOperType operType, SMqTopicObj *pTopic);
-int32_t mndCheckTopicPrivilegeByName(SMnode *pMnode, const char *user, EOperType operType, const char *topicName);
int32_t mndCheckShowPrivilege(SMnode *pMnode, const char *user, EShowType showType, const char *dbname);
int32_t mndCheckAlterUserPrivilege(SUserObj *pOperUser, SUserObj *pUser, SAlterUserReq *pAlter);
int32_t mndSetUserAuthRsp(SMnode *pMnode, SUserObj *pUser, SGetUserAuthRsp *pRsp);
diff --git a/source/dnode/mnode/impl/inc/mndStream.h b/source/dnode/mnode/impl/inc/mndStream.h
index 58a4c92d3e..372612274f 100644
--- a/source/dnode/mnode/impl/inc/mndStream.h
+++ b/source/dnode/mnode/impl/inc/mndStream.h
@@ -17,22 +17,39 @@
#define _TD_MND_STREAM_H_
#include "mndInt.h"
+#include "mndTrans.h"
#ifdef __cplusplus
extern "C" {
#endif
+#define MND_STREAM_RESERVE_SIZE 64
+#define MND_STREAM_VER_NUMBER 4
+
+#define MND_STREAM_CREATE_NAME "stream-create"
+#define MND_STREAM_CHECKPOINT_NAME "stream-checkpoint"
+#define MND_STREAM_PAUSE_NAME "stream-pause"
+#define MND_STREAM_RESUME_NAME "stream-resume"
+#define MND_STREAM_DROP_NAME "stream-drop"
+#define MND_STREAM_TASK_RESET_NAME "stream-task-reset"
+#define MND_STREAM_TASK_UPDATE_NAME "stream-task-update"
+
typedef struct SStreamTransInfo {
int64_t startTime;
- int64_t streamUid;
+ int64_t streamId;
const char *name;
int32_t transId;
} SStreamTransInfo;
+typedef struct SVgroupChangeInfo {
+ SHashObj *pDBMap;
+ SArray *pUpdateNodeList; // SArray
+} SVgroupChangeInfo;
+
// time to generated the checkpoint, if now() - checkpointTs >= tsCheckpointInterval, this checkpoint will be discard
// to avoid too many checkpoints for a taskk in the waiting list
typedef struct SCheckpointCandEntry {
- char * pName;
+ char *pName;
int64_t streamId;
int64_t checkpointTs;
int64_t checkpointId;
@@ -50,36 +67,63 @@ typedef struct SStreamExecInfo {
SHashObj *pTaskMap;
SArray *pTaskList;
TdThreadMutex lock;
+ SHashObj *pTransferStateStreams;
} SStreamExecInfo;
-#define MND_STREAM_CREATE_NAME "stream-create"
-#define MND_STREAM_CHECKPOINT_NAME "stream-checkpoint"
-#define MND_STREAM_PAUSE_NAME "stream-pause"
-#define MND_STREAM_RESUME_NAME "stream-resume"
-#define MND_STREAM_DROP_NAME "stream-drop"
-#define MND_STREAM_TASK_RESET_NAME "stream-task-reset"
-#define MND_STREAM_TASK_UPDATE_NAME "stream-task-update"
+extern SStreamExecInfo execInfo;
+typedef struct SStreamTaskIter SStreamTaskIter;
-extern SStreamExecInfo execInfo;
+typedef struct SNodeEntry {
+ int32_t nodeId;
+ bool stageUpdated; // the stage has been updated due to the leader/follower change or node reboot.
+ SEpSet epset; // compare the epset to identify the vgroup tranferring between different dnodes.
+ int64_t hbTimestamp; // second
+} SNodeEntry;
+
+typedef struct SOrphanTask {
+ int64_t streamId;
+ int32_t taskId;
+ int32_t nodeId;
+} SOrphanTask;
int32_t mndInitStream(SMnode *pMnode);
void mndCleanupStream(SMnode *pMnode);
SStreamObj *mndAcquireStream(SMnode *pMnode, char *streamName);
void mndReleaseStream(SMnode *pMnode, SStreamObj *pStream);
int32_t mndDropStreamByDb(SMnode *pMnode, STrans *pTrans, SDbObj *pDb);
-int32_t mndPersistStream(SMnode *pMnode, STrans *pTrans, SStreamObj *pStream);
+int32_t mndPersistStream(STrans *pTrans, SStreamObj *pStream);
+int32_t mndStreamRegisterTrans(STrans *pTrans, const char *pTransName, int64_t streamId);
+int32_t mndAddtoCheckpointWaitingList(SStreamObj *pStream, int64_t checkpointId);
+bool mndStreamTransConflictCheck(SMnode *pMnode, int64_t streamId, const char *pTransName, bool lock);
+int32_t mndStreamGetRelTrans(SMnode *pMnode, int64_t streamId);
-int32_t mndStreamRegisterTrans(STrans* pTrans, const char* pTransName, int64_t streamUid);
-int32_t mndAddtoCheckpointWaitingList(SStreamObj *pStream, int64_t checkpointId);
-bool mndStreamTransConflictCheck(SMnode *pMnode, int64_t streamUid, const char *pTransName, bool lock);
-int32_t mndStreamGetRelTrans(SMnode *pMnode, int64_t streamUid);
+int32_t mndGetNumOfStreams(SMnode *pMnode, char *dbName, int32_t *pNumOfStreams);
+int32_t mndGetNumOfStreamTasks(const SStreamObj *pStream);
+SArray *mndTakeVgroupSnapshot(SMnode *pMnode, bool *allReady);
+void mndKillTransImpl(SMnode *pMnode, int32_t transId, const char *pDbName);
+int32_t setTransAction(STrans *pTrans, void *pCont, int32_t contLen, int32_t msgType, const SEpSet *pEpset,
+ int32_t retryCode);
+STrans *doCreateTrans(SMnode *pMnode, SStreamObj *pStream, SRpcMsg *pReq, const char *name, const char *pMsg);
+int32_t mndPersistTransLog(SStreamObj *pStream, STrans *pTrans, int32_t status);
+SSdbRaw *mndStreamActionEncode(SStreamObj *pStream);
+void killAllCheckpointTrans(SMnode *pMnode, SVgroupChangeInfo *pChangeInfo);
+int32_t mndStreamSetUpdateEpsetAction(SStreamObj *pStream, SVgroupChangeInfo *pInfo, STrans *pTrans);
-// for sma
-// TODO refactor
-int32_t mndDropStreamTasks(SMnode *pMnode, STrans *pTrans, SStreamObj *pStream);
-int32_t mndPersistDropStreamLog(SMnode *pMnode, STrans *pTrans, SStreamObj *pStream);
+SStreamObj *mndGetStreamObj(SMnode *pMnode, int64_t streamId);
+int32_t extractNodeEpset(SMnode *pMnode, SEpSet *pEpSet, bool *hasEpset, int32_t taskId, int32_t nodeId);
+int32_t mndProcessStreamHb(SRpcMsg *pReq);
+void saveStreamTasksInfo(SStreamObj *pStream, SStreamExecInfo *pExecNode);
+int32_t initStreamNodeList(SMnode *pMnode);
+int32_t mndStreamSetResumeAction(STrans *pTrans, SMnode *pMnode, SStreamObj *pStream, int8_t igUntreated);
+int32_t mndStreamSetPauseAction(SMnode *pMnode, STrans *pTrans, SStreamObj *pStream);
+int32_t mndStreamSetDropAction(SMnode *pMnode, STrans *pTrans, SStreamObj *pStream);
+int32_t mndStreamSetDropActionFromList(SMnode *pMnode, STrans *pTrans, SArray *pList);
+int32_t mndStreamSetResetTaskAction(SMnode *pMnode, STrans *pTrans, SStreamObj *pStream);
-int32_t mndGetNumOfStreams(SMnode *pMnode, char *dbName, int32_t *pNumOfStreams);
+SStreamTaskIter *createStreamTaskIter(SStreamObj *pStream);
+void destroyStreamTaskIter(SStreamTaskIter *pIter);
+bool streamTaskIterNextTask(SStreamTaskIter *pIter);
+SStreamTask *streamTaskIterGetCurrent(SStreamTaskIter *pIter);
#ifdef __cplusplus
}
diff --git a/source/dnode/mnode/impl/src/mndCluster.c b/source/dnode/mnode/impl/src/mndCluster.c
index 4c799e1e1e..1a55a161bf 100644
--- a/source/dnode/mnode/impl/src/mndCluster.c
+++ b/source/dnode/mnode/impl/src/mndCluster.c
@@ -14,7 +14,10 @@
*/
#define _DEFAULT_SOURCE
+#include "audit.h"
#include "mndCluster.h"
+#include "mndGrant.h"
+#include "mndPrivilege.h"
#include "mndShow.h"
#include "mndTrans.h"
@@ -31,6 +34,8 @@ static int32_t mndCreateDefaultCluster(SMnode *pMnode);
static int32_t mndRetrieveClusters(SRpcMsg *pMsg, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows);
static void mndCancelGetNextCluster(SMnode *pMnode, void *pIter);
static int32_t mndProcessUptimeTimer(SRpcMsg *pReq);
+static int32_t mndProcessConfigClusterReq(SRpcMsg *pReq);
+static int32_t mndProcessConfigClusterRsp(SRpcMsg *pReq);
int32_t mndInitCluster(SMnode *pMnode) {
SSdbTable table = {
@@ -45,6 +50,8 @@ int32_t mndInitCluster(SMnode *pMnode) {
};
mndSetMsgHandle(pMnode, TDMT_MND_UPTIME_TIMER, mndProcessUptimeTimer);
+ mndSetMsgHandle(pMnode, TDMT_MND_CONFIG_CLUSTER, mndProcessConfigClusterReq);
+ mndSetMsgHandle(pMnode, TDMT_MND_CONFIG_CLUSTER_RSP, mndProcessConfigClusterRsp);
mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_CLUSTER, mndRetrieveClusters);
mndAddShowFreeIterHandle(pMnode, TSDB_MGMT_TABLE_CLUSTER, mndCancelGetNextCluster);
@@ -147,6 +154,7 @@ static SSdbRaw *mndClusterActionEncode(SClusterObj *pCluster) {
SDB_SET_BINARY(pRaw, dataPos, pCluster->name, TSDB_CLUSTER_ID_LEN, _OVER)
SDB_SET_INT32(pRaw, dataPos, pCluster->upTime, _OVER)
SDB_SET_RESERVE(pRaw, dataPos, CLUSTER_RESERVE_SIZE, _OVER)
+ SDB_SET_DATALEN(pRaw, dataPos, _OVER);
terrno = 0;
@@ -164,7 +172,7 @@ _OVER:
static SSdbRow *mndClusterActionDecode(SSdbRaw *pRaw) {
terrno = TSDB_CODE_OUT_OF_MEMORY;
SClusterObj *pCluster = NULL;
- SSdbRow *pRow = NULL;
+ SSdbRow *pRow = NULL;
int8_t sver = 0;
if (sdbGetRawSoftVer(pRaw, &sver) != 0) goto _OVER;
@@ -359,3 +367,62 @@ static int32_t mndProcessUptimeTimer(SRpcMsg *pReq) {
mndTransDrop(pTrans);
return 0;
}
+
+int32_t mndProcessConfigClusterReq(SRpcMsg *pReq) {
+ int32_t code = 0;
+ SMnode *pMnode = pReq->info.node;
+ SMCfgClusterReq cfgReq = {0};
+ if (tDeserializeSMCfgClusterReq(pReq->pCont, pReq->contLen, &cfgReq) != 0) {
+ terrno = TSDB_CODE_INVALID_MSG;
+ return -1;
+ }
+
+ mInfo("cluster: start to config, option:%s, value:%s", cfgReq.config, cfgReq.value);
+ if (mndCheckOperPrivilege(pMnode, pReq->info.conn.user, MND_OPER_CONFIG_CLUSTER) != 0) {
+ code = terrno != 0 ? terrno : TSDB_CODE_MND_NO_RIGHTS;
+ goto _exit;
+ }
+
+ SClusterObj clusterObj = {0};
+ void *pIter = NULL;
+ SClusterObj *pCluster = mndAcquireCluster(pMnode, &pIter);
+ if (!pCluster || pCluster->id <= 0) {
+ code = TSDB_CODE_APP_IS_STARTING;
+ if (pCluster) mndReleaseCluster(pMnode, pCluster, pIter);
+ goto _exit;
+ }
+ memcpy(&clusterObj, pCluster, sizeof(SClusterObj));
+ mndReleaseCluster(pMnode, pCluster, pIter);
+
+ if (strncmp(cfgReq.config, GRANT_ACTIVE_CODE, TSDB_DNODE_CONFIG_LEN) == 0) {
+#ifdef TD_ENTERPRISE
+ if (0 != (code = mndProcessConfigGrantReq(pMnode, pReq, &cfgReq))) {
+ goto _exit;
+ }
+#else
+ code = TSDB_CODE_OPS_NOT_SUPPORT;
+ goto _exit;
+#endif
+ } else {
+ code = TSDB_CODE_OPS_NOT_SUPPORT;
+ goto _exit;
+ }
+
+ { // audit
+ auditRecord(pReq, pMnode->clusterId, "alterCluster", "", "", cfgReq.sql, cfgReq.sqlLen);
+ }
+_exit:
+ tFreeSMCfgClusterReq(&cfgReq);
+ if (code != 0) {
+ terrno = code;
+ mError("cluster: failed to config:%s %s since %s", cfgReq.config, cfgReq.value, terrstr());
+ } else {
+ mInfo("cluster: success to config:%s %s", cfgReq.config, cfgReq.value);
+ }
+ return code;
+}
+
+int32_t mndProcessConfigClusterRsp(SRpcMsg *pRsp) {
+ mInfo("config rsp from cluster");
+ return 0;
+}
\ No newline at end of file
diff --git a/source/dnode/mnode/impl/src/mndCompact.c b/source/dnode/mnode/impl/src/mndCompact.c
index 101022a44f..4e71684372 100644
--- a/source/dnode/mnode/impl/src/mndCompact.c
+++ b/source/dnode/mnode/impl/src/mndCompact.c
@@ -599,7 +599,8 @@ static int32_t mndSaveCompactProgress(SMnode *pMnode, int32_t compactId) {
pDetail->compactId, pDetail->vgId, pDetail->dnodeId, pDetail->numberFileset, pDetail->finished,
pDetail->newNumberFileset, pDetail->newFinished);
- if(pDetail->numberFileset < pDetail->newNumberFileset || pDetail->finished < pDetail->newFinished)
+ //these 2 number will jump back after dnode restart, so < is not used here
+ if(pDetail->numberFileset != pDetail->newNumberFileset || pDetail->finished != pDetail->newFinished)
needSave = true;
}
diff --git a/source/dnode/mnode/impl/src/mndConsumer.c b/source/dnode/mnode/impl/src/mndConsumer.c
index 4db000287c..3ce548a4f6 100644
--- a/source/dnode/mnode/impl/src/mndConsumer.c
+++ b/source/dnode/mnode/impl/src/mndConsumer.c
@@ -102,7 +102,13 @@ static int32_t validateTopics(STrans *pTrans, const SArray *pTopicList, SMnode *
}
if (mndCheckTopicPrivilege(pMnode, pUser, MND_OPER_SUBSCRIBE, pTopic) != 0) {
- code = -1;
+ code = TSDB_CODE_MND_NO_RIGHTS;
+ terrno = TSDB_CODE_MND_NO_RIGHTS;
+ goto FAILED;
+ }
+
+ if ((terrno = grantCheck(TSDB_GRANT_SUBSCRIPTION)) < 0) {
+ code = terrno;
goto FAILED;
}
@@ -220,22 +226,53 @@ FAIL:
return -1;
}
+static int32_t checkPrivilege(SMnode *pMnode, SMqConsumerObj *pConsumer, SMqHbRsp *rsp, char* user){
+ rsp->topicPrivileges = taosArrayInit(taosArrayGetSize(pConsumer->currentTopics), sizeof(STopicPrivilege));
+ if(rsp->topicPrivileges == NULL){
+ terrno = TSDB_CODE_OUT_OF_MEMORY;
+ return terrno;
+ }
+ for(int32_t i = 0; i < taosArrayGetSize(pConsumer->currentTopics); i++){
+ char *topic = taosArrayGetP(pConsumer->currentTopics, i);
+ SMqTopicObj* pTopic = mndAcquireTopic(pMnode, topic);
+ if (pTopic == NULL) { // terrno has been set by callee function
+ continue;
+ }
+ STopicPrivilege *data = taosArrayReserve(rsp->topicPrivileges, 1);
+ strcpy(data->topic, topic);
+ if (mndCheckTopicPrivilege(pMnode, user, MND_OPER_SUBSCRIBE, pTopic) != 0 || grantCheck(TSDB_GRANT_SUBSCRIPTION) < 0) {
+ data->noPrivilege = 1;
+ } else{
+ data->noPrivilege = 0;
+ }
+ mndReleaseTopic(pMnode, pTopic);
+ }
+ return 0;
+}
+
static int32_t mndProcessMqHbReq(SRpcMsg *pMsg) {
int32_t code = 0;
SMnode *pMnode = pMsg->info.node;
SMqHbReq req = {0};
+ SMqHbRsp rsp = {0};
+ SMqConsumerObj *pConsumer = NULL;
- if ((code = tDeserializeSMqHbReq(pMsg->pCont, pMsg->contLen, &req)) < 0) {
+ if (tDeserializeSMqHbReq(pMsg->pCont, pMsg->contLen, &req) < 0) {
terrno = TSDB_CODE_OUT_OF_MEMORY;
+ code = TSDB_CODE_OUT_OF_MEMORY;
goto end;
}
int64_t consumerId = req.consumerId;
- SMqConsumerObj *pConsumer = mndAcquireConsumer(pMnode, consumerId);
+ pConsumer = mndAcquireConsumer(pMnode, consumerId);
if (pConsumer == NULL) {
mError("consumer:0x%" PRIx64 " not exist", consumerId);
terrno = TSDB_CODE_MND_CONSUMER_NOT_EXIST;
- code = -1;
+ code = TSDB_CODE_MND_CONSUMER_NOT_EXIST;
+ goto end;
+ }
+ code = checkPrivilege(pMnode, pConsumer, &rsp, pMsg->info.conn.user);
+ if(code != 0){
goto end;
}
@@ -280,9 +317,22 @@ static int32_t mndProcessMqHbReq(SRpcMsg *pMsg) {
mndReleaseSubscribe(pMnode, pSub);
}
- mndReleaseConsumer(pMnode, pConsumer);
+ // encode rsp
+ int32_t tlen = tSerializeSMqHbRsp(NULL, 0, &rsp);
+ void *buf = rpcMallocCont(tlen);
+ if (buf == NULL) {
+ terrno = TSDB_CODE_OUT_OF_MEMORY;
+ code = TSDB_CODE_OUT_OF_MEMORY;
+ goto end;
+ }
+
+ tSerializeSMqHbRsp(buf, tlen, &rsp);
+ pMsg->info.rsp = buf;
+ pMsg->info.rspLen = tlen;
end:
+ tDeatroySMqHbRsp(&rsp);
+ mndReleaseConsumer(pMnode, pConsumer);
tDeatroySMqHbReq(&req);
return code;
}
@@ -499,6 +549,12 @@ static void freeItem(void *param) {
int32_t mndProcessSubscribeReq(SRpcMsg *pMsg) {
SMnode *pMnode = pMsg->info.node;
char *msgStr = pMsg->pCont;
+ int32_t code = -1;
+
+ if ((terrno = grantCheck(TSDB_GRANT_SUBSCRIPTION)) < 0) {
+ code = terrno;
+ return code;
+ }
SCMSubscribeReq subscribe = {0};
tDeserializeSCMSubscribeReq(msgStr, &subscribe);
@@ -509,7 +565,7 @@ int32_t mndProcessSubscribeReq(SRpcMsg *pMsg) {
SMqConsumerObj *pConsumerNew = NULL;
STrans *pTrans = NULL;
- int32_t code = -1;
+
SArray *pTopicList = subscribe.topicNames;
taosArraySort(pTopicList, taosArrayCompareString);
taosArrayRemoveDuplicate(pTopicList, taosArrayCompareString, freeItem);
@@ -525,7 +581,7 @@ int32_t mndProcessSubscribeReq(SRpcMsg *pMsg) {
}
// check topic existence
- pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_NOTHING, pMsg, "subscribe");
+ pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_TOPIC_INSIDE, pMsg, "subscribe");
if (pTrans == NULL) {
goto _over;
}
diff --git a/source/dnode/mnode/impl/src/mndDef.c b/source/dnode/mnode/impl/src/mndDef.c
index d01daee5a7..172c3952ad 100644
--- a/source/dnode/mnode/impl/src/mndDef.c
+++ b/source/dnode/mnode/impl/src/mndDef.c
@@ -17,6 +17,8 @@
#include "mndDef.h"
#include "mndConsumer.h"
+static void *freeStreamTasks(SArray *pTaskLevel);
+
int32_t tEncodeSStreamObj(SEncoder *pEncoder, const SStreamObj *pObj) {
if (tStartEncode(pEncoder) < 0) return -1;
if (tEncodeCStr(pEncoder, pObj->name) < 0) return -1;
@@ -121,11 +123,18 @@ int32_t tDecodeSStreamObj(SDecoder *pDecoder, SStreamObj *pObj, int32_t sver) {
if (tDecodeCStrAlloc(pDecoder, &pObj->ast) < 0) return -1;
if (tDecodeCStrAlloc(pDecoder, &pObj->physicalPlan) < 0) return -1;
- pObj->tasks = NULL;
+ if (pObj->tasks != NULL) {
+ pObj->tasks = freeStreamTasks(pObj->tasks);
+ }
+
int32_t sz;
- if (tDecodeI32(pDecoder, &sz) < 0) return -1;
+ if (tDecodeI32(pDecoder, &sz) < 0) {
+ return -1;
+ }
+
if (sz != 0) {
pObj->tasks = taosArrayInit(sz, sizeof(void *));
+
for (int32_t i = 0; i < sz; i++) {
int32_t innerSz;
if (tDecodeI32(pDecoder, &innerSz) < 0) return -1;
@@ -165,8 +174,9 @@ int32_t tDecodeSStreamObj(SDecoder *pDecoder, SStreamObj *pObj, int32_t sver) {
return 0;
}
-static void *freeStreamTasks(SArray *pTaskLevel) {
+void *freeStreamTasks(SArray *pTaskLevel) {
int32_t numOfLevel = taosArrayGetSize(pTaskLevel);
+
for (int32_t i = 0; i < numOfLevel; i++) {
SArray *pLevel = taosArrayGetP(pTaskLevel, i);
int32_t taskSz = taosArrayGetSize(pLevel);
diff --git a/source/dnode/mnode/impl/src/mndDnode.c b/source/dnode/mnode/impl/src/mndDnode.c
index 6585e70533..f4a712e85f 100644
--- a/source/dnode/mnode/impl/src/mndDnode.c
+++ b/source/dnode/mnode/impl/src/mndDnode.c
@@ -136,6 +136,16 @@ static int32_t mndCreateDefaultDnode(SMnode *pMnode) {
tstrncpy(dnodeObj.fqdn, tsLocalFqdn, TSDB_FQDN_LEN);
dnodeObj.fqdn[TSDB_FQDN_LEN - 1] = 0;
snprintf(dnodeObj.ep, TSDB_EP_LEN - 1, "%s:%u", tsLocalFqdn, tsServerPort);
+ char *machineId = tGetMachineId();
+ if (machineId) {
+ memcpy(dnodeObj.machineId, machineId, TSDB_MACHINE_ID_LEN);
+ taosMemoryFreeClear(machineId);
+ } else {
+#ifdef TD_UNIQ_GRANT
+ terrno = TSDB_CODE_DNODE_NO_MACHINE_CODE;
+ goto _OVER;
+#endif
+ }
pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_GLOBAL, NULL, "create-dnode");
if (pTrans == NULL) goto _OVER;
@@ -402,6 +412,7 @@ void mndGetDnodeData(SMnode *pMnode, SArray *pDnodeInfo) {
tstrncpy(dInfo.ep.fqdn, pDnode->fqdn, TSDB_FQDN_LEN);
tstrncpy(dInfo.active, pDnode->active, TSDB_ACTIVE_KEY_LEN);
tstrncpy(dInfo.connActive, pDnode->connActive, TSDB_CONN_ACTIVE_KEY_LEN);
+ tstrncpy(dInfo.machineId, pDnode->machineId, TSDB_MACHINE_ID_LEN + 1);
sdbRelease(pSdb, pDnode);
if (mndIsMnode(pMnode, pDnode->id)) {
dInfo.isMnode = 1;
@@ -657,8 +668,12 @@ static int32_t mndProcessStatusReq(SRpcMsg *pReq) {
pDnode->rebootTime = statusReq.rebootTime;
pDnode->numOfCores = statusReq.numOfCores;
pDnode->numOfSupportVnodes = statusReq.numOfSupportVnodes;
+ pDnode->numOfDiskCfg = statusReq.numOfDiskCfg;
pDnode->memAvail = statusReq.memAvail;
pDnode->memTotal = statusReq.memTotal;
+ if (pDnode->machineId[0] == 0 && statusReq.machineId[0] != 0) {
+ tstrncpy(pDnode->machineId, statusReq.machineId, TSDB_MACHINE_ID_LEN + 1);
+ }
SStatusRsp statusRsp = {0};
statusRsp.statusSeq++;
@@ -761,109 +776,6 @@ _OVER:
return code;
}
-static int32_t mndConfigDnode(SMnode *pMnode, SRpcMsg *pReq, SMCfgDnodeReq *pCfgReq, int8_t action) {
- SSdbRaw *pRaw = NULL;
- STrans *pTrans = NULL;
- SDnodeObj *pDnode = NULL;
- SArray *failRecord = NULL;
- bool cfgAll = pCfgReq->dnodeId == -1;
- int32_t cfgAllErr = 0;
- int32_t iter = 0;
-
- SSdb *pSdb = pMnode->pSdb;
- void *pIter = NULL;
- while (1) {
- if (cfgAll) {
- pIter = sdbFetch(pSdb, SDB_DNODE, pIter, (void **)&pDnode);
- if (pIter == NULL) break;
- ++iter;
- } else if (!(pDnode = mndAcquireDnode(pMnode, pCfgReq->dnodeId))) {
- goto _OVER;
- }
-
- SDnodeObj tmpDnode = *pDnode;
- if (action == DND_ACTIVE_CODE) {
- if (grantAlterActiveCode(pDnode->id, pDnode->active, pCfgReq->value, tmpDnode.active, 0) != 0) {
- if (TSDB_CODE_DUP_KEY != terrno) {
- mError("dnode:%d, config dnode:%d, app:%p config:%s value:%s failed since %s", pDnode->id, pCfgReq->dnodeId,
- pReq->info.ahandle, pCfgReq->config, pCfgReq->value, terrstr());
- if (cfgAll) { // alter all dnodes:
- if (!failRecord) failRecord = taosArrayInit(1, sizeof(int32_t));
- if (failRecord) taosArrayPush(failRecord, &pDnode->id);
- if (0 == cfgAllErr) cfgAllErr = terrno; // output 1st terrno.
- }
- } else {
- terrno = 0; // no action for dup active code
- }
- if (cfgAll) continue;
- goto _OVER;
- }
- } else if (action == DND_CONN_ACTIVE_CODE) {
- if (grantAlterActiveCode(pDnode->id, pDnode->connActive, pCfgReq->value, tmpDnode.connActive, 1) != 0) {
- if (TSDB_CODE_DUP_KEY != terrno) {
- mError("dnode:%d, config dnode:%d, app:%p config:%s value:%s failed since %s", pDnode->id, pCfgReq->dnodeId,
- pReq->info.ahandle, pCfgReq->config, pCfgReq->value, terrstr());
- if (cfgAll) {
- if (!failRecord) failRecord = taosArrayInit(1, sizeof(int32_t));
- if (failRecord) taosArrayPush(failRecord, &pDnode->id);
- if (0 == cfgAllErr) cfgAllErr = terrno;
- }
- } else {
- terrno = 0;
- }
- if (cfgAll) continue;
- goto _OVER;
- }
- } else {
- terrno = TSDB_CODE_INVALID_CFG;
- goto _OVER;
- }
-
- if (!pTrans) {
- pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_GLOBAL, pReq, "config-dnode");
- if (!pTrans) goto _OVER;
- if (mndTrancCheckConflict(pMnode, pTrans) != 0) goto _OVER;
- }
-
- pRaw = mndDnodeActionEncode(&tmpDnode);
- if (pRaw == NULL || mndTransAppendCommitlog(pTrans, pRaw) != 0) goto _OVER;
- (void)sdbSetRawStatus(pRaw, SDB_STATUS_READY);
- pRaw = NULL;
-
- mInfo("dnode:%d, config dnode:%d, app:%p config:%s value:%s", pDnode->id, pCfgReq->dnodeId, pReq->info.ahandle,
- pCfgReq->config, pCfgReq->value);
-
- if (cfgAll) {
- sdbRelease(pSdb, pDnode);
- pDnode = NULL;
- } else {
- break;
- }
- }
-
- if (pTrans && mndTransPrepare(pMnode, pTrans) != 0) goto _OVER;
- tsGrantHBInterval = TMIN(TMAX(5, iter / 2), 30);
- terrno = 0;
-
-_OVER:
- if (cfgAll) {
- sdbRelease(pSdb, pDnode);
- if (cfgAllErr != 0) terrno = cfgAllErr;
- int32_t nFail = taosArrayGetSize(failRecord);
- if (nFail > 0) {
- mError("config dnode, cfg:%d, app:%p config:%s value:%s. total:%d, fail:%d", pCfgReq->dnodeId, pReq->info.ahandle,
- pCfgReq->config, pCfgReq->value, iter, nFail);
- }
- } else {
- mndReleaseDnode(pMnode, pDnode);
- }
- sdbCancelFetch(pSdb, pIter);
- mndTransDrop(pTrans);
- sdbFreeRaw(pRaw);
- taosArrayDestroy(failRecord);
- return terrno;
-}
-
static int32_t mndProcessDnodeListReq(SRpcMsg *pReq) {
SMnode *pMnode = pReq->info.node;
SSdb *pSdb = pMnode->pSdb;
@@ -1013,8 +925,10 @@ static int32_t mndProcessCreateDnodeReq(SRpcMsg *pReq) {
}
code = mndCreateDnode(pMnode, pReq, &createReq);
- if (code == 0) code = TSDB_CODE_ACTION_IN_PROGRESS;
- tsGrantHBInterval = 5;
+ if (code == 0) {
+ code = TSDB_CODE_ACTION_IN_PROGRESS;
+ tsGrantHBInterval = 5;
+ }
char obj[200] = {0};
sprintf(obj, "%s:%d", createReq.fqdn, createReq.port);
@@ -1310,34 +1224,6 @@ static int32_t mndProcessConfigDnodeReq(SRpcMsg *pReq) {
strcpy(dcfgReq.config, "supportvnodes");
snprintf(dcfgReq.value, TSDB_DNODE_VALUE_LEN, "%d", flag);
- } else if (strncasecmp(cfgReq.config, "activeCode", 10) == 0 || strncasecmp(cfgReq.config, "cActiveCode", 11) == 0) {
- int8_t opt = strncasecmp(cfgReq.config, "a", 1) == 0 ? DND_ACTIVE_CODE : DND_CONN_ACTIVE_CODE;
- int8_t index = opt == DND_ACTIVE_CODE ? 10 : 11;
- if (' ' != cfgReq.config[index] && 0 != cfgReq.config[index]) {
- mError("dnode:%d, failed to config activeCode since invalid conf:%s", cfgReq.dnodeId, cfgReq.config);
- terrno = TSDB_CODE_INVALID_CFG;
- goto _err_out;
- }
- int32_t vlen = strlen(cfgReq.value);
- if (vlen > 0 && ((opt == DND_ACTIVE_CODE && vlen != (TSDB_ACTIVE_KEY_LEN - 1)) ||
- (opt == DND_CONN_ACTIVE_CODE &&
- (vlen > (TSDB_CONN_ACTIVE_KEY_LEN - 1) || vlen < (TSDB_ACTIVE_KEY_LEN - 1))))) {
- mError("dnode:%d, failed to config activeCode since invalid vlen:%d. conf:%s, val:%s", cfgReq.dnodeId, vlen,
- cfgReq.config, cfgReq.value);
- terrno = TSDB_CODE_INVALID_CFG;
- goto _err_out;
- }
-
- strcpy(dcfgReq.config, opt == DND_ACTIVE_CODE ? "activeCode" : "cActiveCode");
- snprintf(dcfgReq.value, TSDB_DNODE_VALUE_LEN, "%s", cfgReq.value);
-
- if (mndConfigDnode(pMnode, pReq, &cfgReq, opt) != 0) {
- mError("dnode:%d, failed to config activeCode since %s", cfgReq.dnodeId, terrstr());
- terrno = TSDB_CODE_INVALID_CFG;
- goto _err_out;
- }
- tFreeSMCfgDnodeReq(&cfgReq);
- return 0;
} else if (strncasecmp(cfgReq.config, "s3blocksize", 11) == 0) {
int32_t optLen = strlen("s3blocksize");
int32_t flag = -1;
@@ -1497,11 +1383,7 @@ static int32_t mndRetrieveDnodes(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB
taosMemoryFreeClear(b);
#ifdef TD_ENTERPRISE
- STR_TO_VARSTR(buf, pDnode->active);
- pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
- colDataSetVal(pColInfo, numOfRows, buf, false);
-
- STR_TO_VARSTR(buf, pDnode->connActive);
+ STR_TO_VARSTR(buf, pDnode->machineId);
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
colDataSetVal(pColInfo, numOfRows, buf, false);
#endif
diff --git a/source/dnode/mnode/impl/src/mndDump.c b/source/dnode/mnode/impl/src/mndDump.c
index c68b11d184..00e72fb329 100644
--- a/source/dnode/mnode/impl/src/mndDump.c
+++ b/source/dnode/mnode/impl/src/mndDump.c
@@ -545,6 +545,7 @@ void dumpHeader(SSdb *pSdb, SJson *json) {
SJson *maxIdsJson = tjsonCreateObject();
tjsonAddItemToObject(json, "maxIds", maxIdsJson);
for (int32_t i = 0; i < SDB_MAX; ++i) {
+ if(i == 5) continue;
int64_t maxId = 0;
if (i < SDB_MAX) {
maxId = pSdb->maxId[i];
diff --git a/source/dnode/mnode/impl/src/mndGrant.c b/source/dnode/mnode/impl/src/mndGrant.c
index c4e1894263..47227bfc8a 100644
--- a/source/dnode/mnode/impl/src/mndGrant.c
+++ b/source/dnode/mnode/impl/src/mndGrant.c
@@ -19,6 +19,15 @@
#ifndef _GRANT
+#define GRANT_ITEM_SHOW(display) \
+ do { \
+ cols++; \
+ pColInfo = taosArrayGet(pBlock->pDataBlock, cols); \
+ src = (display); \
+ STR_WITH_MAXSIZE_TO_VARSTR(tmp, src, 32); \
+ colDataSetVal(pColInfo, numOfRows, tmp, false); \
+ } while (0)
+
static int32_t mndRetrieveGrant(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows) {
int32_t numOfRows = 0;
int32_t cols = 0;
@@ -31,95 +40,32 @@ static int32_t mndRetrieveGrant(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBl
STR_WITH_MAXSIZE_TO_VARSTR(tmp, src, 32);
colDataSetVal(pColInfo, numOfRows, tmp, false);
- cols++;
- pColInfo = taosArrayGet(pBlock->pDataBlock, cols);
- src = "unlimited";
- STR_WITH_MAXSIZE_TO_VARSTR(tmp, src, 32);
- colDataSetVal(pColInfo, numOfRows, tmp, false);
+ GRANT_ITEM_SHOW("unlimited");
+ GRANT_ITEM_SHOW("limited");
+ GRANT_ITEM_SHOW("false");
+ GRANT_ITEM_SHOW("ungranted");
+ GRANT_ITEM_SHOW("unlimited");
+ GRANT_ITEM_SHOW("unlimited");
+ GRANT_ITEM_SHOW("unlimited");
- cols++;
- pColInfo = taosArrayGet(pBlock->pDataBlock, cols);
- src = "false";
- STR_WITH_MAXSIZE_TO_VARSTR(tmp, src, 32);
- colDataSetVal(pColInfo, numOfRows, tmp, false);
-
- cols++;
- pColInfo = taosArrayGet(pBlock->pDataBlock, cols);
- src = "unlimited";
- STR_WITH_MAXSIZE_TO_VARSTR(tmp, src, 32);
- colDataSetVal(pColInfo, numOfRows, tmp, false);
-
- cols++;
- pColInfo = taosArrayGet(pBlock->pDataBlock, cols);
- src = "unlimited";
- STR_WITH_MAXSIZE_TO_VARSTR(tmp, src, 32);
- colDataSetVal(pColInfo, numOfRows, tmp, false);
-
- cols++;
- pColInfo = taosArrayGet(pBlock->pDataBlock, cols);
- src = "unlimited";
- STR_WITH_MAXSIZE_TO_VARSTR(tmp, src, 32);
- colDataSetVal(pColInfo, numOfRows, tmp, false);
-
- cols++;
- pColInfo = taosArrayGet(pBlock->pDataBlock, cols);
- src = "unlimited";
- STR_WITH_MAXSIZE_TO_VARSTR(tmp, src, 32);
- colDataSetVal(pColInfo, numOfRows, tmp, false);
-
- cols++;
- pColInfo = taosArrayGet(pBlock->pDataBlock, cols);
- src = "unlimited";
- STR_WITH_MAXSIZE_TO_VARSTR(tmp, src, 32);
- colDataSetVal(pColInfo, numOfRows, tmp, false);
-
- cols++;
- pColInfo = taosArrayGet(pBlock->pDataBlock, cols);
- src = "unlimited";
- STR_WITH_MAXSIZE_TO_VARSTR(tmp, src, 32);
- colDataSetVal(pColInfo, numOfRows, tmp, false);
-
- cols++;
- pColInfo = taosArrayGet(pBlock->pDataBlock, cols);
- src = "unlimited";
- STR_WITH_MAXSIZE_TO_VARSTR(tmp, src, 32);
- colDataSetVal(pColInfo, numOfRows, tmp, false);
-
- cols++;
- pColInfo = taosArrayGet(pBlock->pDataBlock, cols);
- src = "unlimited";
- STR_WITH_MAXSIZE_TO_VARSTR(tmp, src, 32);
- colDataSetVal(pColInfo, numOfRows, tmp, false);
-
- cols++;
- pColInfo = taosArrayGet(pBlock->pDataBlock, cols);
- src = "unlimited";
- STR_WITH_MAXSIZE_TO_VARSTR(tmp, src, 32);
- colDataSetVal(pColInfo, numOfRows, tmp, false);
-
- cols++;
- pColInfo = taosArrayGet(pBlock->pDataBlock, cols);
- src = "unlimited";
- STR_WITH_MAXSIZE_TO_VARSTR(tmp, src, 32);
- colDataSetVal(pColInfo, numOfRows, tmp, false);
-
- cols++;
- pColInfo = taosArrayGet(pBlock->pDataBlock, cols);
- src = "unlimited";
- STR_WITH_MAXSIZE_TO_VARSTR(tmp, src, 32);
- colDataSetVal(pColInfo, numOfRows, tmp, false);
-
- numOfRows++;
+ ++numOfRows;
}
pShow->numOfRows += numOfRows;
return numOfRows;
}
+static int32_t mndRetrieveGrantFull(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows) { return 0; }
+static int32_t mndRetrieveGrantLogs(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows) { return 0; }
+static int32_t mndRetrieveMachines(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows) { return 0; }
+
static int32_t mndProcessGrantHB(SRpcMsg *pReq) { return TSDB_CODE_SUCCESS; }
int32_t mndInitGrant(SMnode *pMnode) {
mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_GRANTS, mndRetrieveGrant);
+ mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_GRANTS_FULL, mndRetrieveGrantFull);
+ mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_GRANTS_LOGS, mndRetrieveGrantLogs);
+ mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_MACHINES, mndRetrieveMachines);
mndSetMsgHandle(pMnode, TDMT_MND_GRANT_HB_TIMER, mndProcessGrantHB);
return 0;
}
@@ -129,12 +75,17 @@ void grantParseParameter() { mError("can't parsed parameter k"); }
void grantReset(SMnode *pMnode, EGrantType grant, uint64_t value) {}
void grantAdd(EGrantType grant, uint64_t value) {}
void grantRestore(EGrantType grant, uint64_t value) {}
+// char *tGetMachineId() { return NULL; };
int32_t dmProcessGrantReq(void *pInfo, SRpcMsg *pMsg) { return TSDB_CODE_SUCCESS; }
int32_t dmProcessGrantNotify(void *pInfo, SRpcMsg *pMsg) { return TSDB_CODE_SUCCESS; }
-int32_t grantAlterActiveCode(int32_t did, const char *old, const char *new, char *out, int8_t type) {
- return TSDB_CODE_SUCCESS;
-}
#endif
void mndGenerateMachineCode() { grantParseParameter(); }
+
+#ifndef TD_UNIQ_GRANT
+#ifdef TD_ENTERPRISE
+int32_t mndProcessConfigGrantReq(SMnode *pMnode, SRpcMsg *pReq, SMCfgClusterReq *pCfg) { return 0; }
+#endif
+char *tGetMachineId() { return NULL; };
+#endif
diff --git a/source/dnode/mnode/impl/src/mndMain.c b/source/dnode/mnode/impl/src/mndMain.c
index 75d527bc6c..a39e9e93c6 100644
--- a/source/dnode/mnode/impl/src/mndMain.c
+++ b/source/dnode/mnode/impl/src/mndMain.c
@@ -193,7 +193,7 @@ static void mndPullupGrant(SMnode *pMnode) {
if (pReq != NULL) {
SRpcMsg rpcMsg = {
.msgType = TDMT_MND_GRANT_HB_TIMER, .pCont = pReq, .contLen = contLen, .info.ahandle = (void *)0x9527};
- tmsgPutToQueue(&pMnode->msgCb, READ_QUEUE, &rpcMsg);
+ tmsgPutToQueue(&pMnode->msgCb, WRITE_QUEUE, &rpcMsg);
}
}
@@ -767,7 +767,7 @@ _OVER:
pMsg->msgType == TDMT_MND_TRIM_DB_TIMER || pMsg->msgType == TDMT_MND_UPTIME_TIMER ||
pMsg->msgType == TDMT_MND_COMPACT_TIMER || pMsg->msgType == TDMT_MND_NODECHECK_TIMER ||
pMsg->msgType == TDMT_MND_GRANT_HB_TIMER || pMsg->msgType == TDMT_MND_STREAM_CHECKPOINT_CANDIDITATE ||
- pMsg->msgType == TDMT_MND_STREAM_CHECKPOINT_TIMER) {
+ pMsg->msgType == TDMT_MND_STREAM_CHECKPOINT_TIMER || pMsg->msgType == TDMT_MND_STREAM_REQ_CHKPT) {
mTrace("timer not process since mnode restored:%d stopped:%d, sync restored:%d role:%s ", pMnode->restored,
pMnode->stopped, state.restored, syncStr(state.state));
return -1;
diff --git a/source/dnode/mnode/impl/src/mndMnode.c b/source/dnode/mnode/impl/src/mndMnode.c
index 5a09072577..af6ae8c5a0 100644
--- a/source/dnode/mnode/impl/src/mndMnode.c
+++ b/source/dnode/mnode/impl/src/mndMnode.c
@@ -15,6 +15,7 @@
#define _DEFAULT_SOURCE
#include "mndMnode.h"
+#include "audit.h"
#include "mndCluster.h"
#include "mndDnode.h"
#include "mndPrivilege.h"
@@ -22,7 +23,6 @@
#include "mndSync.h"
#include "mndTrans.h"
#include "tmisce.h"
-#include "audit.h"
#define MNODE_VER_NUMBER 2
#define MNODE_RESERVE_SIZE 64
@@ -168,7 +168,7 @@ static SSdbRow *mndMnodeActionDecode(SSdbRaw *pRaw) {
SDB_GET_INT32(pRaw, dataPos, &pObj->id, _OVER)
SDB_GET_INT64(pRaw, dataPos, &pObj->createdTime, _OVER)
SDB_GET_INT64(pRaw, dataPos, &pObj->updateTime, _OVER)
- if(sver >=2){
+ if (sver >= 2) {
SDB_GET_INT32(pRaw, dataPos, &pObj->role, _OVER)
SDB_GET_INT64(pRaw, dataPos, &pObj->lastIndex, _OVER)
}
@@ -251,6 +251,7 @@ void mndGetMnodeEpSet(SMnode *pMnode, SEpSet *pEpSet) {
pEpSet->inUse = pEpSet->numOfEps;
} else {
pEpSet->inUse = (pEpSet->numOfEps + 1) % totalMnodes;
+ // pEpSet->inUse = 0;
}
}
if (pObj->pDnode != NULL) {
@@ -266,6 +267,7 @@ void mndGetMnodeEpSet(SMnode *pMnode, SEpSet *pEpSet) {
if (pEpSet->inUse >= pEpSet->numOfEps) {
pEpSet->inUse = 0;
}
+ epsetSort(pEpSet);
}
static int32_t mndSetCreateMnodeRedoLogs(SMnode *pMnode, STrans *pTrans, SMnodeObj *pObj) {
@@ -320,8 +322,8 @@ static int32_t mndBuildCreateMnodeRedoAction(STrans *pTrans, SDCreateMnodeReq *p
return 0;
}
-static int32_t mndBuildAlterMnodeTypeRedoAction(STrans *pTrans,
- SDAlterMnodeTypeReq *pAlterMnodeTypeReq, SEpSet *pAlterMnodeTypeEpSet) {
+static int32_t mndBuildAlterMnodeTypeRedoAction(STrans *pTrans, SDAlterMnodeTypeReq *pAlterMnodeTypeReq,
+ SEpSet *pAlterMnodeTypeEpSet) {
int32_t contLen = tSerializeSDCreateMnodeReq(NULL, 0, pAlterMnodeTypeReq);
void *pReq = taosMemoryMalloc(contLen);
tSerializeSDCreateMnodeReq(pReq, contLen, pAlterMnodeTypeReq);
@@ -396,13 +398,12 @@ static int32_t mndSetCreateMnodeRedoActions(SMnode *pMnode, STrans *pTrans, SDno
pIter = sdbFetch(pSdb, SDB_MNODE, pIter, (void **)&pMObj);
if (pIter == NULL) break;
- if(pMObj->role == TAOS_SYNC_ROLE_VOTER){
+ if (pMObj->role == TAOS_SYNC_ROLE_VOTER) {
createReq.replicas[numOfReplicas].id = pMObj->id;
createReq.replicas[numOfReplicas].port = pMObj->pDnode->port;
memcpy(createReq.replicas[numOfReplicas].fqdn, pMObj->pDnode->fqdn, TSDB_FQDN_LEN);
numOfReplicas++;
- }
- else{
+ } else {
createReq.learnerReplicas[numOfLearnerReplicas].id = pMObj->id;
createReq.learnerReplicas[numOfLearnerReplicas].port = pMObj->pDnode->port;
memcpy(createReq.learnerReplicas[numOfLearnerReplicas].fqdn, pMObj->pDnode->fqdn, TSDB_FQDN_LEN);
@@ -441,18 +442,17 @@ int32_t mndSetRestoreCreateMnodeRedoActions(SMnode *pMnode, STrans *pTrans, SDno
pIter = sdbFetch(pSdb, SDB_MNODE, pIter, (void **)&pMObj);
if (pIter == NULL) break;
- if(pMObj->id == pDnode->id) {
+ if (pMObj->id == pDnode->id) {
sdbRelease(pSdb, pMObj);
continue;
}
- if(pMObj->role == TAOS_SYNC_ROLE_VOTER){
+ if (pMObj->role == TAOS_SYNC_ROLE_VOTER) {
createReq.replicas[createReq.replica].id = pMObj->id;
createReq.replicas[createReq.replica].port = pMObj->pDnode->port;
memcpy(createReq.replicas[createReq.replica].fqdn, pMObj->pDnode->fqdn, TSDB_FQDN_LEN);
createReq.replica++;
- }
- else{
+ } else {
createReq.learnerReplicas[createReq.learnerReplica].id = pMObj->id;
createReq.learnerReplicas[createReq.learnerReplica].port = pMObj->pDnode->port;
memcpy(createReq.learnerReplicas[createReq.learnerReplica].fqdn, pMObj->pDnode->fqdn, TSDB_FQDN_LEN);
@@ -480,23 +480,22 @@ int32_t mndSetRestoreCreateMnodeRedoActions(SMnode *pMnode, STrans *pTrans, SDno
}
static int32_t mndSetAlterMnodeTypeRedoActions(SMnode *pMnode, STrans *pTrans, SDnodeObj *pDnode, SMnodeObj *pObj) {
- SSdb *pSdb = pMnode->pSdb;
- void *pIter = NULL;
- SDAlterMnodeTypeReq alterReq = {0};
- SEpSet createEpset = {0};
+ SSdb *pSdb = pMnode->pSdb;
+ void *pIter = NULL;
+ SDAlterMnodeTypeReq alterReq = {0};
+ SEpSet createEpset = {0};
while (1) {
SMnodeObj *pMObj = NULL;
pIter = sdbFetch(pSdb, SDB_MNODE, pIter, (void **)&pMObj);
if (pIter == NULL) break;
- if(pMObj->role == TAOS_SYNC_ROLE_VOTER){
+ if (pMObj->role == TAOS_SYNC_ROLE_VOTER) {
alterReq.replicas[alterReq.replica].id = pMObj->id;
alterReq.replicas[alterReq.replica].port = pMObj->pDnode->port;
memcpy(alterReq.replicas[alterReq.replica].fqdn, pMObj->pDnode->fqdn, TSDB_FQDN_LEN);
alterReq.replica++;
- }
- else{
+ } else {
alterReq.learnerReplicas[alterReq.learnerReplica].id = pMObj->id;
alterReq.learnerReplicas[alterReq.learnerReplica].port = pMObj->pDnode->port;
memcpy(alterReq.learnerReplicas[alterReq.learnerReplica].fqdn, pMObj->pDnode->fqdn, TSDB_FQDN_LEN);
@@ -524,28 +523,27 @@ static int32_t mndSetAlterMnodeTypeRedoActions(SMnode *pMnode, STrans *pTrans, S
}
int32_t mndSetRestoreAlterMnodeTypeRedoActions(SMnode *pMnode, STrans *pTrans, SDnodeObj *pDnode, SMnodeObj *pObj) {
- SSdb *pSdb = pMnode->pSdb;
- void *pIter = NULL;
- SDAlterMnodeTypeReq alterReq = {0};
- SEpSet createEpset = {0};
+ SSdb *pSdb = pMnode->pSdb;
+ void *pIter = NULL;
+ SDAlterMnodeTypeReq alterReq = {0};
+ SEpSet createEpset = {0};
while (1) {
SMnodeObj *pMObj = NULL;
pIter = sdbFetch(pSdb, SDB_MNODE, pIter, (void **)&pMObj);
if (pIter == NULL) break;
- if(pMObj->id == pDnode->id) {
+ if (pMObj->id == pDnode->id) {
sdbRelease(pSdb, pMObj);
continue;
}
- if(pMObj->role == TAOS_SYNC_ROLE_VOTER){
+ if (pMObj->role == TAOS_SYNC_ROLE_VOTER) {
alterReq.replicas[alterReq.replica].id = pMObj->id;
alterReq.replicas[alterReq.replica].port = pMObj->pDnode->port;
memcpy(alterReq.replicas[alterReq.replica].fqdn, pMObj->pDnode->fqdn, TSDB_FQDN_LEN);
alterReq.replica++;
- }
- else{
+ } else {
alterReq.learnerReplicas[alterReq.learnerReplica].id = pMObj->id;
alterReq.learnerReplicas[alterReq.learnerReplica].port = pMObj->pDnode->port;
memcpy(alterReq.learnerReplicas[alterReq.learnerReplica].fqdn, pMObj->pDnode->fqdn, TSDB_FQDN_LEN);
@@ -959,8 +957,11 @@ static void mndReloadSyncConfig(SMnode *pMnode) {
void *pIter = NULL;
int32_t updatingMnodes = 0;
int32_t readyMnodes = 0;
- SSyncCfg cfg = {.myIndex = -1, .lastIndex = 0,};
- SyncIndex maxIndex = 0;
+ SSyncCfg cfg = {
+ .myIndex = -1,
+ .lastIndex = 0,
+ };
+ SyncIndex maxIndex = 0;
while (1) {
pIter = sdbFetchAll(pSdb, SDB_MNODE, pIter, (void **)&pObj, &objStatus, false);
@@ -986,17 +987,17 @@ static void mndReloadSyncConfig(SMnode *pMnode) {
if (pObj->pDnode->id == pMnode->selfDnodeId) {
cfg.myIndex = cfg.totalReplicaNum;
}
- if(pNode->nodeRole == TAOS_SYNC_ROLE_VOTER){
+ if (pNode->nodeRole == TAOS_SYNC_ROLE_VOTER) {
cfg.replicaNum++;
}
cfg.totalReplicaNum++;
- if(pObj->lastIndex > cfg.lastIndex){
+ if (pObj->lastIndex > cfg.lastIndex) {
cfg.lastIndex = pObj->lastIndex;
}
}
if (objStatus == SDB_STATUS_DROPPING) {
- if(pObj->lastIndex > cfg.lastIndex){
+ if (pObj->lastIndex > cfg.lastIndex) {
cfg.lastIndex = pObj->lastIndex;
}
}
@@ -1006,10 +1007,10 @@ static void mndReloadSyncConfig(SMnode *pMnode) {
sdbReleaseLock(pSdb, pObj, false);
}
- //if (readyMnodes <= 0 || updatingMnodes <= 0) {
- // mInfo("vgId:1, mnode sync not reconfig since readyMnodes:%d updatingMnodes:%d", readyMnodes, updatingMnodes);
- // return;
- //}
+ // if (readyMnodes <= 0 || updatingMnodes <= 0) {
+ // mInfo("vgId:1, mnode sync not reconfig since readyMnodes:%d updatingMnodes:%d", readyMnodes, updatingMnodes);
+ // return;
+ // }
if (cfg.myIndex == -1) {
#if 1
@@ -1023,8 +1024,8 @@ static void mndReloadSyncConfig(SMnode *pMnode) {
}
if (pMnode->syncMgmt.sync > 0) {
- mInfo("vgId:1, mnode sync reconfig, totalReplica:%d replica:%d myIndex:%d",
- cfg.totalReplicaNum, cfg.replicaNum, cfg.myIndex);
+ mInfo("vgId:1, mnode sync reconfig, totalReplica:%d replica:%d myIndex:%d", cfg.totalReplicaNum, cfg.replicaNum,
+ cfg.myIndex);
for (int32_t i = 0; i < cfg.totalReplicaNum; ++i) {
SNodeInfo *pNode = &cfg.nodeInfo[i];
diff --git a/source/dnode/mnode/impl/src/mndPrivilege.c b/source/dnode/mnode/impl/src/mndPrivilege.c
index d4c0a6b36b..13a80cb1a6 100644
--- a/source/dnode/mnode/impl/src/mndPrivilege.c
+++ b/source/dnode/mnode/impl/src/mndPrivilege.c
@@ -30,9 +30,6 @@ int32_t mndCheckDbPrivilegeByName(SMnode *pMnode, const char *user, EOperType op
}
int32_t mndCheckTopicPrivilege(SMnode *pMnode, const char *user, EOperType operType, SMqTopicObj *pTopic) { return 0; }
-int32_t mndCheckTopicPrivilegeByName(SMnode *pMnode, const char *user, EOperType operType, const char *topicName) {
- return 0;
-}
int32_t mndSetUserWhiteListRsp(SMnode *pMnode, SUserObj *pUser, SGetUserWhiteListRsp *pWhiteListRsp) {
diff --git a/source/dnode/mnode/impl/src/mndShow.c b/source/dnode/mnode/impl/src/mndShow.c
index 8e7e72aa0e..f887d05d37 100644
--- a/source/dnode/mnode/impl/src/mndShow.c
+++ b/source/dnode/mnode/impl/src/mndShow.c
@@ -123,6 +123,12 @@ static int32_t convertToRetrieveType(char *name, int32_t len) {
type = TSDB_MGMT_TABLE_COMPACT;
} else if (strncasecmp(name, TSDB_INS_TABLE_COMPACT_DETAILS, len) == 0) {
type = TSDB_MGMT_TABLE_COMPACT_DETAIL;
+ } else if (strncasecmp(name, TSDB_INS_TABLE_GRANTS_FULL, len) == 0) {
+ type = TSDB_MGMT_TABLE_GRANTS_FULL;
+ } else if (strncasecmp(name, TSDB_INS_TABLE_GRANTS_LOGS, len) == 0) {
+ type = TSDB_MGMT_TABLE_GRANTS_LOGS;
+ } else if (strncasecmp(name, TSDB_INS_TABLE_MACHINES, len) == 0) {
+ type = TSDB_MGMT_TABLE_MACHINES;
} else {
mError("invalid show name:%s len:%d", name, len);
}
diff --git a/source/dnode/mnode/impl/src/mndSma.c b/source/dnode/mnode/impl/src/mndSma.c
index 34ea7109d0..d30eebc1fa 100644
--- a/source/dnode/mnode/impl/src/mndSma.c
+++ b/source/dnode/mnode/impl/src/mndSma.c
@@ -640,7 +640,7 @@ static int32_t mndCreateSma(SMnode *pMnode, SRpcMsg *pReq, SMCreateSmaReq *pCrea
if (mndSetUpdateSmaStbCommitLogs(pMnode, pTrans, pStb) != 0) goto _OVER;
if (mndSetCreateSmaVgroupRedoActions(pMnode, pTrans, pDb, &streamObj.fixedSinkVg, &smaObj) != 0) goto _OVER;
if (mndScheduleStream(pMnode, &streamObj, 1685959190000) != 0) goto _OVER;
- if (mndPersistStream(pMnode, pTrans, &streamObj) != 0) goto _OVER;
+ if (mndPersistStream(pTrans, &streamObj) != 0) goto _OVER;
if (mndTransPrepare(pMnode, pTrans) != 0) goto _OVER;
mInfo("sma:%s, uid:%" PRIi64 " create on stb:%" PRIi64 ", dstSuid:%" PRIi64 " dstTb:%s dstVg:%d", pCreate->name,
@@ -866,14 +866,14 @@ static int32_t mndDropSma(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SSmaObj *p
sdbRelease(pMnode->pSdb, pStream);
goto _OVER;
} else {
- if (mndDropStreamTasks(pMnode, pTrans, pStream) < 0) {
+ if (mndStreamSetDropAction(pMnode, pTrans, pStream) < 0) {
mError("stream:%s, failed to drop task since %s", pStream->name, terrstr());
sdbRelease(pMnode->pSdb, pStream);
goto _OVER;
}
// drop stream
- if (mndPersistDropStreamLog(pMnode, pTrans, pStream) < 0) {
+ if (mndPersistTransLog(pStream, pTrans, SDB_STATUS_DROPPED) < 0) {
mError("stream:%s, failed to drop log since %s", pStream->name, terrstr());
sdbRelease(pMnode->pSdb, pStream);
goto _OVER;
@@ -918,13 +918,13 @@ int32_t mndDropSmasByStb(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SStbObj *p
SStreamObj *pStream = mndAcquireStream(pMnode, streamName);
if (pStream != NULL && pStream->smaId == pSma->uid) {
- if (mndDropStreamTasks(pMnode, pTrans, pStream) < 0) {
+ if (mndStreamSetDropAction(pMnode, pTrans, pStream) < 0) {
mError("stream:%s, failed to drop task since %s", pStream->name, terrstr());
mndReleaseStream(pMnode, pStream);
goto _OVER;
}
- if (mndPersistDropStreamLog(pMnode, pTrans, pStream) < 0) {
+ if (mndPersistTransLog(pStream, pTrans, SDB_STATUS_DROPPED) < 0) {
mndReleaseStream(pMnode, pStream);
goto _OVER;
}
diff --git a/source/dnode/mnode/impl/src/mndStream.c b/source/dnode/mnode/impl/src/mndStream.c
index 6c58fb746b..25ad008465 100644
--- a/source/dnode/mnode/impl/src/mndStream.c
+++ b/source/dnode/mnode/impl/src/mndStream.c
@@ -27,21 +27,11 @@
#include "tmisce.h"
#include "tname.h"
-#define MND_STREAM_VER_NUMBER 4
-#define MND_STREAM_RESERVE_SIZE 64
#define MND_STREAM_MAX_NUM 60
-typedef struct SNodeEntry {
- int32_t nodeId;
- bool stageUpdated; // the stage has been updated due to the leader/follower change or node reboot.
- SEpSet epset; // compare the epset to identify the vgroup tranferring between different dnodes.
- int64_t hbTimestamp; // second
-} SNodeEntry;
-
-typedef struct SVgroupChangeInfo {
- SHashObj *pDBMap;
- SArray *pUpdateNodeList; // SArray
-} SVgroupChangeInfo;
+typedef struct SMStreamNodeCheckMsg {
+ int8_t placeHolder; // // to fix windows compile error, define place holder
+} SMStreamNodeCheckMsg;
static int32_t mndNodeCheckSentinel = 0;
SStreamExecInfo execInfo;
@@ -54,39 +44,26 @@ static int32_t mndProcessDropStreamReq(SRpcMsg *pReq);
static int32_t mndProcessStreamCheckpointTmr(SRpcMsg *pReq);
static int32_t mndProcessStreamDoCheckpoint(SRpcMsg *pReq);
static int32_t mndProcessStreamCheckpointInCandid(SRpcMsg *pReq);
-static int32_t mndProcessStreamHb(SRpcMsg *pReq);
static int32_t mndRetrieveStream(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows);
static void mndCancelGetNextStream(SMnode *pMnode, void *pIter);
static int32_t mndRetrieveStreamTask(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows);
static void mndCancelGetNextStreamTask(SMnode *pMnode, void *pIter);
static int32_t mndProcessPauseStreamReq(SRpcMsg *pReq);
static int32_t mndProcessResumeStreamReq(SRpcMsg *pReq);
-static int32_t mndBuildStreamCheckpointSourceReq2(void **pBuf, int32_t *pLen, int32_t nodeId, int64_t checkpointId,
- int64_t streamId, int32_t taskId, int32_t transId);
+static int32_t mndBuildStreamCheckpointSourceReq(void **pBuf, int32_t *pLen, int32_t nodeId, int64_t checkpointId,
+ int64_t streamId, int32_t taskId, int32_t transId, int8_t mndTrigger);
static int32_t mndProcessNodeCheck(SRpcMsg *pReq);
static int32_t mndProcessNodeCheckReq(SRpcMsg *pMsg);
static SArray *extractNodeListFromStream(SMnode *pMnode);
-static SArray *mndTakeVgroupSnapshot(SMnode *pMnode, bool *allReady);
-
-static SStreamObj *mndGetStreamObj(SMnode *pMnode, int64_t streamId);
+static int32_t mndProcessStreamReqCheckpoint(SRpcMsg *pReq);
static SVgroupChangeInfo mndFindChangedNodeInfo(SMnode *pMnode, const SArray *pPrevNodeList, const SArray *pNodeList);
-static STrans *doCreateTrans(SMnode *pMnode, SStreamObj *pStream, SRpcMsg *pReq, const char *name, const char *pMsg);
-static int32_t mndPersistTransLog(SStreamObj *pStream, STrans *pTrans);
-static void initTransAction(STransAction *pAction, void *pCont, int32_t contLen, int32_t msgType, const SEpSet *pEpset,
- int32_t retryCode);
-static int32_t createStreamUpdateTrans(SStreamObj *pStream, SVgroupChangeInfo *pInfo, STrans *pTrans);
-static void removeStreamTasksInBuf(SStreamObj *pStream, SStreamExecInfo *pExecNode);
-static void saveStreamTasksInfo(SStreamObj *pStream, SStreamExecInfo *pExecNode);
-static int32_t removeExpirednodeEntryAndTask(SArray *pNodeSnapshot);
-static int32_t doKillCheckpointTrans(SMnode *pMnode, const char *pDbName, size_t len);
-static void killTransImpl(SMnode *pMnode, int32_t transId, const char *pDbName);
-
-static int32_t setNodeEpsetExpiredFlag(const SArray *pNodeList);
-static void freeCheckpointCandEntry(void *);
-
-static SSdbRaw *mndStreamActionEncode(SStreamObj *pStream);
+static void removeStreamTasksInBuf(SStreamObj *pStream, SStreamExecInfo *pExecNode);
+static int32_t removeExpirednodeEntryAndTask(SArray *pNodeSnapshot);
+static int32_t doKillCheckpointTrans(SMnode *pMnode, const char *pDbName, size_t len);
+static void freeCheckpointCandEntry(void *);
+static void freeTaskList(void *param);
static SSdbRow *mndStreamActionDecode(SSdbRaw *pRaw);
SSdbRaw *mndStreamSeqActionEncode(SStreamObj *pStream);
@@ -130,6 +107,7 @@ int32_t mndInitStream(SMnode *pMnode) {
mndSetMsgHandle(pMnode, TDMT_VND_STREAM_CHECK_POINT_SOURCE_RSP, mndTransProcessRsp);
mndSetMsgHandle(pMnode, TDMT_MND_STREAM_CHECKPOINT_TIMER, mndProcessStreamCheckpointTmr);
mndSetMsgHandle(pMnode, TDMT_MND_STREAM_BEGIN_CHECKPOINT, mndProcessStreamDoCheckpoint);
+ mndSetMsgHandle(pMnode, TDMT_MND_STREAM_REQ_CHKPT, mndProcessStreamReqCheckpoint);
mndSetMsgHandle(pMnode, TDMT_MND_STREAM_CHECKPOINT_CANDIDITATE, mndProcessStreamCheckpointInCandid);
mndSetMsgHandle(pMnode, TDMT_MND_STREAM_HEARTBEAT, mndProcessStreamHb);
mndSetMsgHandle(pMnode, TDMT_STREAM_TASK_REPORT_CHECKPOINT, mndTransProcessRsp);
@@ -150,7 +128,10 @@ int32_t mndInitStream(SMnode *pMnode) {
execInfo.pTaskMap = taosHashInit(64, fn, true, HASH_NO_LOCK);
execInfo.transMgmt.pDBTrans = taosHashInit(32, fn, true, HASH_NO_LOCK);
execInfo.transMgmt.pWaitingList = taosHashInit(32, fn, true, HASH_NO_LOCK);
+ execInfo.pTransferStateStreams = taosHashInit(32, fn, true, HASH_NO_LOCK);
+
taosHashSetFreeFp(execInfo.transMgmt.pWaitingList, freeCheckpointCandEntry);
+ taosHashSetFreeFp(execInfo.pTransferStateStreams, freeTaskList);
if (sdbSetTable(pMnode->pSdb, table) != 0) {
return -1;
@@ -166,64 +147,19 @@ void mndCleanupStream(SMnode *pMnode) {
taosHashCleanup(execInfo.pTaskMap);
taosHashCleanup(execInfo.transMgmt.pDBTrans);
taosHashCleanup(execInfo.transMgmt.pWaitingList);
+ taosHashCleanup(execInfo.pTransferStateStreams);
taosThreadMutexDestroy(&execInfo.lock);
mDebug("mnd stream exec info cleanup");
}
-SSdbRaw *mndStreamActionEncode(SStreamObj *pStream) {
- terrno = TSDB_CODE_OUT_OF_MEMORY;
- void *buf = NULL;
-
- SEncoder encoder;
- tEncoderInit(&encoder, NULL, 0);
- if (tEncodeSStreamObj(&encoder, pStream) < 0) {
- tEncoderClear(&encoder);
- goto STREAM_ENCODE_OVER;
- }
- int32_t tlen = encoder.pos;
- tEncoderClear(&encoder);
-
- int32_t size = sizeof(int32_t) + tlen + MND_STREAM_RESERVE_SIZE;
- SSdbRaw *pRaw = sdbAllocRaw(SDB_STREAM, MND_STREAM_VER_NUMBER, size);
- if (pRaw == NULL) goto STREAM_ENCODE_OVER;
-
- buf = taosMemoryMalloc(tlen);
- if (buf == NULL) goto STREAM_ENCODE_OVER;
-
- tEncoderInit(&encoder, buf, tlen);
- if (tEncodeSStreamObj(&encoder, pStream) < 0) {
- tEncoderClear(&encoder);
- goto STREAM_ENCODE_OVER;
- }
- tEncoderClear(&encoder);
-
- int32_t dataPos = 0;
- SDB_SET_INT32(pRaw, dataPos, tlen, STREAM_ENCODE_OVER);
- SDB_SET_BINARY(pRaw, dataPos, buf, tlen, STREAM_ENCODE_OVER);
- SDB_SET_DATALEN(pRaw, dataPos, STREAM_ENCODE_OVER);
-
- terrno = TSDB_CODE_SUCCESS;
-
-STREAM_ENCODE_OVER:
- taosMemoryFreeClear(buf);
- if (terrno != TSDB_CODE_SUCCESS) {
- mError("stream:%s, failed to encode to raw:%p since %s", pStream->name, pRaw, terrstr());
- sdbFreeRaw(pRaw);
- return NULL;
- }
-
- mTrace("stream:%s, encode to raw:%p, row:%p, checkpoint:%" PRId64 "", pStream->name, pRaw, pStream,
- pStream->checkpointId);
- return pRaw;
-}
-
SSdbRow *mndStreamActionDecode(SSdbRaw *pRaw) {
terrno = TSDB_CODE_OUT_OF_MEMORY;
+
SSdbRow *pRow = NULL;
SStreamObj *pStream = NULL;
void *buf = NULL;
+ int8_t sver = 0;
- int8_t sver = 0;
if (sdbGetRawSoftVer(pRaw, &sver) != 0) {
goto STREAM_DECODE_OVER;
}
@@ -235,16 +171,24 @@ SSdbRow *mndStreamActionDecode(SSdbRaw *pRaw) {
}
pRow = sdbAllocRow(sizeof(SStreamObj));
- if (pRow == NULL) goto STREAM_DECODE_OVER;
+ if (pRow == NULL) {
+ goto STREAM_DECODE_OVER;
+ }
pStream = sdbGetRowObj(pRow);
- if (pStream == NULL) goto STREAM_DECODE_OVER;
+ if (pStream == NULL) {
+ goto STREAM_DECODE_OVER;
+ }
int32_t tlen;
int32_t dataPos = 0;
SDB_GET_INT32(pRaw, dataPos, &tlen, STREAM_DECODE_OVER);
+
buf = taosMemoryMalloc(tlen + 1);
- if (buf == NULL) goto STREAM_DECODE_OVER;
+ if (buf == NULL) {
+ goto STREAM_DECODE_OVER;
+ }
+
SDB_GET_BINARY(pRaw, dataPos, buf, tlen, STREAM_DECODE_OVER);
SDecoder decoder;
@@ -260,13 +204,13 @@ SSdbRow *mndStreamActionDecode(SSdbRaw *pRaw) {
STREAM_DECODE_OVER:
taosMemoryFreeClear(buf);
if (terrno != TSDB_CODE_SUCCESS) {
- mError("stream:%s, failed to decode from raw:%p since %s", pStream == NULL ? "null" : pStream->name, pRaw,
- terrstr());
+ char* p = (pStream == NULL) ? "null" : pStream->name;
+ mError("stream:%s, failed to decode from raw:%p since %s", p, pRaw, terrstr());
taosMemoryFreeClear(pRow);
return NULL;
}
- mTrace("stream:%s, decode from raw:%p, row:%p, checkpoint:%" PRId64 "", pStream->name, pRaw, pStream,
+ mTrace("stream:%s, decode from raw:%p, row:%p, checkpoint:%" PRId64, pStream->name, pRaw, pStream,
pStream->checkpointId);
return pRow;
}
@@ -523,10 +467,8 @@ int32_t mndPersistTaskDeployReq(STrans *pTrans, SStreamTask *pTask) {
tEncodeStreamTask(&encoder, pTask);
tEncoderClear(&encoder);
- STransAction action = {0};
- action.mTraceId = pTrans->mTraceId;
- initTransAction(&action, buf, tlen, TDMT_STREAM_TASK_DEPLOY, &pTask->info.epSet, 0);
- if (mndTransAppendRedoAction(pTrans, &action) != 0) {
+ int32_t code = setTransAction(pTrans, buf, tlen, TDMT_STREAM_TASK_DEPLOY, &pTask->info.epSet, 0);
+ if (code != 0) {
taosMemoryFree(buf);
return -1;
}
@@ -534,23 +476,21 @@ int32_t mndPersistTaskDeployReq(STrans *pTrans, SStreamTask *pTask) {
return 0;
}
-int32_t mndPersistStreamTasks(SMnode *pMnode, STrans *pTrans, SStreamObj *pStream) {
- int32_t level = taosArrayGetSize(pStream->tasks);
- for (int32_t i = 0; i < level; i++) {
- SArray *pLevel = taosArrayGetP(pStream->tasks, i);
-
- int32_t numOfTasks = taosArrayGetSize(pLevel);
- for (int32_t j = 0; j < numOfTasks; j++) {
- SStreamTask *pTask = taosArrayGetP(pLevel, j);
- if (mndPersistTaskDeployReq(pTrans, pTask) < 0) {
- return -1;
- }
+int32_t mndPersistStreamTasks(STrans *pTrans, SStreamObj *pStream) {
+ SStreamTaskIter *pIter = createStreamTaskIter(pStream);
+ while (streamTaskIterNextTask(pIter)) {
+ SStreamTask *pTask = streamTaskIterGetCurrent(pIter);
+ if (mndPersistTaskDeployReq(pTrans, pTask) < 0) {
+ destroyStreamTaskIter(pIter);
+ return -1;
}
}
+ destroyStreamTaskIter(pIter);
+
// persistent stream task for already stored ts data
if (pStream->conf.fillHistory) {
- level = taosArrayGetSize(pStream->pHTasksList);
+ int32_t level = taosArrayGetSize(pStream->pHTasksList);
for (int32_t i = 0; i < level; i++) {
SArray *pLevel = taosArrayGetP(pStream->pHTasksList, i);
@@ -568,30 +508,12 @@ int32_t mndPersistStreamTasks(SMnode *pMnode, STrans *pTrans, SStreamObj *pStrea
return 0;
}
-int32_t mndPersistStream(SMnode *pMnode, STrans *pTrans, SStreamObj *pStream) {
- if (mndPersistStreamTasks(pMnode, pTrans, pStream) < 0) {
+int32_t mndPersistStream(STrans *pTrans, SStreamObj *pStream) {
+ if (mndPersistStreamTasks(pTrans, pStream) < 0) {
return -1;
}
- SSdbRaw *pCommitRaw = mndStreamActionEncode(pStream);
- if (pCommitRaw == NULL || mndTransAppendCommitlog(pTrans, pCommitRaw) != 0) {
- mError("trans:%d, failed to append commit log since %s", pTrans->id, terrstr());
- return -1;
- }
-
- (void)sdbSetRawStatus(pCommitRaw, SDB_STATUS_READY);
- return 0;
-}
-
-int32_t mndPersistDropStreamLog(SMnode *pMnode, STrans *pTrans, SStreamObj *pStream) {
- SSdbRaw *pCommitRaw = mndStreamActionEncode(pStream);
- if (pCommitRaw == NULL || mndTransAppendCommitlog(pTrans, pCommitRaw) != 0) {
- mError("trans:%d, failed to append commit log since %s", pTrans->id, terrstr());
- return -1;
- }
-
- (void)sdbSetRawStatus(pCommitRaw, SDB_STATUS_DROPPED);
- return 0;
+ return mndPersistTransLog(pStream, pTrans, SDB_STATUS_READY);
}
static int32_t mndCreateStbForStream(SMnode *pMnode, STrans *pTrans, const SStreamObj *pStream, const char *user) {
@@ -685,92 +607,6 @@ _OVER:
return -1;
}
-static int32_t extractNodeEpset(SMnode *pMnode, SEpSet *pEpSet, bool *hasEpset, int32_t taskId, int32_t nodeId) {
- *hasEpset = false;
-
- pEpSet->numOfEps = 0;
- if (nodeId == SNODE_HANDLE) {
- SSnodeObj *pObj = NULL;
- void *pIter = NULL;
-
- pIter = sdbFetch(pMnode->pSdb, SDB_SNODE, pIter, (void **)&pObj);
- if (pIter != NULL) {
- addEpIntoEpSet(pEpSet, pObj->pDnode->fqdn, pObj->pDnode->port);
- sdbRelease(pMnode->pSdb, pObj);
- sdbCancelFetch(pMnode->pSdb, pIter);
- *hasEpset = true;
- return TSDB_CODE_SUCCESS;
- } else {
- mError("failed to acquire snode epset");
- return TSDB_CODE_INVALID_PARA;
- }
- } else {
- SVgObj *pVgObj = mndAcquireVgroup(pMnode, nodeId);
- if (pVgObj != NULL) {
- SEpSet epset = mndGetVgroupEpset(pMnode, pVgObj);
- mndReleaseVgroup(pMnode, pVgObj);
-
- epsetAssign(pEpSet, &epset);
- *hasEpset = true;
- return TSDB_CODE_SUCCESS;
- } else {
- mDebug("orphaned task:0x%x need to be dropped, nodeId:%d, no redo action", taskId, nodeId);
- return TSDB_CODE_SUCCESS;
- }
- }
-}
-
-static int32_t mndPersistTaskDropReq(SMnode *pMnode, STrans *pTrans, SStreamTask *pTask) {
- SVDropStreamTaskReq *pReq = taosMemoryCalloc(1, sizeof(SVDropStreamTaskReq));
- if (pReq == NULL) {
- terrno = TSDB_CODE_OUT_OF_MEMORY;
- return -1;
- }
-
- pReq->head.vgId = htonl(pTask->info.nodeId);
- pReq->taskId = pTask->id.taskId;
- pReq->streamId = pTask->id.streamId;
-
- STransAction action = {0};
- SEpSet epset = {0};
- bool hasEpset = false;
-
- int32_t code = extractNodeEpset(pMnode, &epset, &hasEpset, pTask->id.taskId, pTask->info.nodeId);
- if (code != TSDB_CODE_SUCCESS) {
- terrno = code;
- return -1;
- }
-
- // no valid epset, return directly without redoAction
- if (!hasEpset) {
- return TSDB_CODE_SUCCESS;
- }
-
- // The epset of nodeId of this task may have been expired now, let's use the newest epset from mnode.
- initTransAction(&action, pReq, sizeof(SVDropStreamTaskReq), TDMT_STREAM_TASK_DROP, &epset, 0);
- if (mndTransAppendRedoAction(pTrans, &action) != 0) {
- taosMemoryFree(pReq);
- return -1;
- }
-
- return 0;
-}
-
-int32_t mndDropStreamTasks(SMnode *pMnode, STrans *pTrans, SStreamObj *pStream) {
- int32_t lv = taosArrayGetSize(pStream->tasks);
- for (int32_t i = 0; i < lv; i++) {
- SArray *pTasks = taosArrayGetP(pStream->tasks, i);
- int32_t sz = taosArrayGetSize(pTasks);
- for (int32_t j = 0; j < sz; j++) {
- SStreamTask *pTask = taosArrayGetP(pTasks, j);
- if (mndPersistTaskDropReq(pMnode, pTrans, pTask) < 0) {
- return -1;
- }
- }
- }
- return 0;
-}
-
static int32_t checkForNumOfStreams(SMnode *pMnode, SStreamObj *pStreamObj) { // check for number of existed tasks
int32_t numOfStream = 0;
SStreamObj *pStream = NULL;
@@ -809,6 +645,10 @@ static int32_t mndProcessCreateStreamReq(SRpcMsg *pReq) {
int32_t sqlLen = 0;
terrno = TSDB_CODE_SUCCESS;
+ if ((terrno = grantCheck(TSDB_GRANT_STREAMS)) < 0) {
+ goto _OVER;
+ }
+
SCMCreateStreamReq createStreamReq = {0};
if (tDeserializeSCMCreateStreamReq(pReq->pCont, pReq->contLen, &createStreamReq) != 0) {
terrno = TSDB_CODE_INVALID_MSG;
@@ -856,17 +696,8 @@ static int32_t mndProcessCreateStreamReq(SRpcMsg *pReq) {
goto _OVER;
}
- STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pReq, MND_STREAM_CREATE_NAME);
+ STrans *pTrans = doCreateTrans(pMnode, &streamObj, pReq, MND_STREAM_CREATE_NAME, "create stream tasks on dnodes");
if (pTrans == NULL) {
- mError("stream:%s, failed to create since %s", createStreamReq.name, terrstr());
- goto _OVER;
- }
-
- mInfo("trans:%d, used to create stream:%s", pTrans->id, createStreamReq.name);
-
- mndTransSetDbName(pTrans, createStreamReq.sourceDB, streamObj.targetSTbName);
- if (mndTransCheckConflict(pMnode, pTrans) != 0) {
- mndTransDrop(pTrans);
goto _OVER;
}
@@ -886,7 +717,7 @@ static int32_t mndProcessCreateStreamReq(SRpcMsg *pReq) {
}
// add stream to trans
- if (mndPersistStream(pMnode, pTrans, &streamObj) < 0) {
+ if (mndPersistStream(pTrans, &streamObj) < 0) {
mError("stream:%s, failed to schedule since %s", createStreamReq.name, terrstr());
mndTransDrop(pTrans);
goto _OVER;
@@ -912,6 +743,7 @@ static int32_t mndProcessCreateStreamReq(SRpcMsg *pReq) {
mndTransDrop(pTrans);
taosThreadMutexLock(&execInfo.lock);
+
mDebug("stream tasks register into node list");
saveStreamTasksInfo(&streamObj, &execInfo);
taosThreadMutexUnlock(&execInfo.lock);
@@ -981,24 +813,9 @@ static int32_t mndProcessStreamCheckpointTmr(SRpcMsg *pReq) {
return 0;
}
-static int32_t mndProcessStreamRemainChkptTmr(SRpcMsg *pReq) {
- SMnode *pMnode = pReq->info.node;
- SSdb *pSdb = pMnode->pSdb;
- if (sdbGetSize(pSdb, SDB_STREAM) <= 0) {
- return 0;
- }
-
- SMStreamDoCheckpointMsg *pMsg = rpcMallocCont(sizeof(SMStreamDoCheckpointMsg));
- pMsg->checkpointId = 0;
-
- int32_t size = sizeof(SMStreamDoCheckpointMsg);
- SRpcMsg rpcMsg = {.msgType = TDMT_MND_STREAM_CHECKPOINT_CANDIDITATE, .pCont = pMsg, .contLen = size};
- tmsgPutToQueue(&pMnode->msgCb, WRITE_QUEUE, &rpcMsg);
- return 0;
-}
-
-static int32_t mndBuildStreamCheckpointSourceReq2(void **pBuf, int32_t *pLen, int32_t nodeId, int64_t checkpointId,
- int64_t streamId, int32_t taskId, int32_t transId) {
+static int32_t mndBuildStreamCheckpointSourceReq(void **pBuf, int32_t *pLen, int32_t nodeId, int64_t checkpointId,
+ int64_t streamId, int32_t taskId, int32_t transId,
+ int8_t mndTrigger) {
SStreamCheckpointSourceReq req = {0};
req.checkpointId = checkpointId;
req.nodeId = nodeId;
@@ -1006,6 +823,7 @@ static int32_t mndBuildStreamCheckpointSourceReq2(void **pBuf, int32_t *pLen, in
req.streamId = streamId; // pTask->id.streamId;
req.taskId = taskId; // pTask->id.taskId;
req.transId = transId;
+ req.mndTrigger = mndTrigger;
int32_t code;
int32_t blen;
@@ -1041,14 +859,43 @@ static int32_t mndBuildStreamCheckpointSourceReq2(void **pBuf, int32_t *pLen, in
return 0;
}
-static int32_t mndProcessStreamCheckpointTrans(SMnode *pMnode, SStreamObj *pStream, int64_t checkpointId) {
- int32_t code = -1;
- int64_t timestampMs = taosGetTimestampMs();
- if (timestampMs - pStream->checkpointFreq < tsStreamCheckpointInterval * 1000) {
+static int32_t doSetCheckpointAction(SMnode *pMnode, STrans *pTrans, SStreamTask *pTask, int64_t checkpointId,
+ int8_t mndTrigger) {
+ void *buf;
+ int32_t tlen;
+ if (mndBuildStreamCheckpointSourceReq(&buf, &tlen, pTask->info.nodeId, checkpointId, pTask->id.streamId,
+ pTask->id.taskId, pTrans->id, mndTrigger) < 0) {
+ taosMemoryFree(buf);
return -1;
}
- bool conflict = mndStreamTransConflictCheck(pMnode, pStream->uid, MND_STREAM_CHECKPOINT_NAME, true);
+ SEpSet epset = {0};
+ bool hasEpset = false;
+ int32_t code = extractNodeEpset(pMnode, &epset, &hasEpset, pTask->id.taskId, pTask->info.nodeId);
+ if (code != TSDB_CODE_SUCCESS || !hasEpset) {
+ taosMemoryFree(buf);
+ return -1;
+ }
+
+ code = setTransAction(pTrans, buf, tlen, TDMT_VND_STREAM_CHECK_POINT_SOURCE, &epset, TSDB_CODE_SYN_PROPOSE_NOT_READY);
+ if (code != 0) {
+ taosMemoryFree(buf);
+ }
+
+ return code;
+}
+
+static int32_t mndProcessStreamCheckpointTrans(SMnode *pMnode, SStreamObj *pStream, int64_t checkpointId,
+ int8_t mndTrigger, bool lock) {
+ int32_t code = -1;
+ int64_t ts = taosGetTimestampMs();
+ if (mndTrigger == 1 && (ts - pStream->checkpointFreq < tsStreamCheckpointInterval * 1000)) {
+// mWarn("checkpoint interval less than the threshold, ignore it");
+ return -1;
+ }
+
+
+ bool conflict = mndStreamTransConflictCheck(pMnode, pStream->uid, MND_STREAM_CHECKPOINT_NAME, lock);
if (conflict) {
mndAddtoCheckpointWaitingList(pStream, checkpointId);
mWarn("checkpoint conflict with other trans in %s, ignore the checkpoint for stream:%s %" PRIx64, pStream->sourceDb,
@@ -1056,28 +903,22 @@ static int32_t mndProcessStreamCheckpointTrans(SMnode *pMnode, SStreamObj *pStre
return -1;
}
- STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_NOTHING, NULL, MND_STREAM_CHECKPOINT_NAME);
+ STrans *pTrans = doCreateTrans(pMnode, pStream, NULL, MND_STREAM_CHECKPOINT_NAME, "gen checkpoint for stream");
if (pTrans == NULL) {
- return -1;
- }
-
- mndStreamRegisterTrans(pTrans, MND_STREAM_CHECKPOINT_NAME, pStream->uid);
-
- mndTransSetDbName(pTrans, pStream->sourceDb, pStream->targetSTbName);
- if (mndTrancCheckConflict(pMnode, pTrans) != 0) {
mError("failed to checkpoint of stream name%s, checkpointId: %" PRId64 ", reason:%s", pStream->name, checkpointId,
tstrerror(TSDB_CODE_MND_TRANS_CONFLICT));
goto _ERR;
}
+ mndStreamRegisterTrans(pTrans, MND_STREAM_CHECKPOINT_NAME, pStream->uid);
mDebug("start to trigger checkpoint for stream:%s, checkpoint: %" PRId64 "", pStream->name, checkpointId);
taosWLockLatch(&pStream->lock);
pStream->currentTick = 1;
// 1. redo action: broadcast checkpoint source msg for all source vg
- int32_t totLevel = taosArrayGetSize(pStream->tasks);
- for (int32_t i = 0; i < totLevel; i++) {
+ int32_t totalLevel = taosArrayGetSize(pStream->tasks);
+ for (int32_t i = 0; i < totalLevel; i++) {
SArray *pLevel = taosArrayGetP(pStream->tasks, i);
SStreamTask *p = taosArrayGetP(pLevel, 0);
@@ -1085,29 +926,9 @@ static int32_t mndProcessStreamCheckpointTrans(SMnode *pMnode, SStreamObj *pStre
int32_t sz = taosArrayGetSize(pLevel);
for (int32_t j = 0; j < sz; j++) {
SStreamTask *pTask = taosArrayGetP(pLevel, j);
+ code = doSetCheckpointAction(pMnode, pTrans, pTask, checkpointId, mndTrigger);
- SVgObj *pVgObj = mndAcquireVgroup(pMnode, pTask->info.nodeId);
- if (pVgObj == NULL) {
- taosWUnLockLatch(&pStream->lock);
- goto _ERR;
- }
-
- void *buf;
- int32_t tlen;
- if (mndBuildStreamCheckpointSourceReq2(&buf, &tlen, pTask->info.nodeId, checkpointId, pTask->id.streamId,
- pTask->id.taskId, pTrans->id) < 0) {
- mndReleaseVgroup(pMnode, pVgObj);
- taosWUnLockLatch(&pStream->lock);
- goto _ERR;
- }
-
- STransAction act = {0};
- SEpSet epset = mndGetVgroupEpset(pMnode, pVgObj);
- mndReleaseVgroup(pMnode, pVgObj);
-
- initTransAction(&act, buf, tlen, TDMT_VND_STREAM_CHECK_POINT_SOURCE, &epset, TSDB_CODE_SYN_PROPOSE_NOT_READY);
- if (mndTransAppendRedoAction(pTrans, &act) != 0) {
- taosMemoryFree(buf);
+ if (code != TSDB_CODE_SUCCESS) {
taosWUnLockLatch(&pStream->lock);
goto _ERR;
}
@@ -1124,12 +945,12 @@ static int32_t mndProcessStreamCheckpointTrans(SMnode *pMnode, SStreamObj *pStre
pStream->version = pStream->version + 1;
taosWUnLockLatch(&pStream->lock);
- if ((code = mndPersistTransLog(pStream, pTrans)) != TSDB_CODE_SUCCESS) {
+ if ((code = mndPersistTransLog(pStream, pTrans, SDB_STATUS_READY)) != TSDB_CODE_SUCCESS) {
return code;
}
if ((code = mndTransPrepare(pMnode, pTrans)) != TSDB_CODE_SUCCESS) {
- mError("failed to prepare trans rebalance since %s", terrstr());
+ mError("failed to prepare checkpoint trans since %s", terrstr());
goto _ERR;
}
@@ -1139,81 +960,7 @@ _ERR:
return code;
}
-static int32_t mndAddStreamCheckpointToTrans(STrans *pTrans, SStreamObj *pStream, SMnode *pMnode, int64_t chkptId) {
- taosWLockLatch(&pStream->lock);
-
- int32_t totLevel = taosArrayGetSize(pStream->tasks);
- for (int32_t i = 0; i < totLevel; i++) {
- SArray *pLevel = taosArrayGetP(pStream->tasks, i);
- SStreamTask *pTask = taosArrayGetP(pLevel, 0);
-
- if (pTask->info.taskLevel == TASK_LEVEL__SOURCE) {
- int32_t sz = taosArrayGetSize(pLevel);
- for (int32_t j = 0; j < sz; j++) {
- pTask = taosArrayGetP(pLevel, j);
- if (pTask->info.fillHistory == 1) {
- continue;
- }
- /*A(pTask->info.nodeId > 0);*/
- SVgObj *pVgObj = mndAcquireVgroup(pMnode, pTask->info.nodeId);
- if (pVgObj == NULL) {
- taosWUnLockLatch(&pStream->lock);
- return -1;
- }
-
- void *buf;
- int32_t tlen;
- if (mndBuildStreamCheckpointSourceReq2(&buf, &tlen, pTask->info.nodeId, chkptId, pTask->id.streamId,
- pTask->id.taskId, pTrans->id) < 0) {
- mndReleaseVgroup(pMnode, pVgObj);
- taosWUnLockLatch(&pStream->lock);
- return -1;
- }
-
- STransAction action = {0};
- SEpSet epset = mndGetVgroupEpset(pMnode, pVgObj);
- mndReleaseVgroup(pMnode, pVgObj);
-
- initTransAction(&action, buf, tlen, TDMT_VND_STREAM_CHECK_POINT_SOURCE, &epset,
- TSDB_CODE_SYN_PROPOSE_NOT_READY);
-
- if (mndTransAppendRedoAction(pTrans, &action) != 0) {
- taosMemoryFree(buf);
- taosWUnLockLatch(&pStream->lock);
- return -1;
- }
- }
- }
- }
-
- pStream->checkpointId = chkptId;
- pStream->checkpointFreq = taosGetTimestampMs();
- pStream->currentTick = 0;
-
- // 3. commit log: stream checkpoint info
- pStream->version = pStream->version + 1;
-
- taosWUnLockLatch(&pStream->lock);
-
- SSdbRaw *pCommitRaw = mndStreamActionEncode(pStream);
- if (pCommitRaw == NULL) {
- mError("failed to prepare trans rebalance since %s", terrstr());
- return -1;
- }
- if (mndTransAppendCommitlog(pTrans, pCommitRaw) != 0) {
- sdbFreeRaw(pCommitRaw);
- mError("failed to prepare trans rebalance since %s", terrstr());
- return -1;
- }
- if (sdbSetRawStatus(pCommitRaw, SDB_STATUS_READY) != 0) {
- sdbFreeRaw(pCommitRaw);
- mError("failed to prepare trans rebalance since %s", terrstr());
- return -1;
- }
- return 0;
-}
-
-static int32_t initStreamNodeList(SMnode *pMnode) {
+int32_t initStreamNodeList(SMnode *pMnode) {
if (execInfo.pNodeList == NULL || (taosArrayGetSize(execInfo.pNodeList) == 0)) {
execInfo.pNodeList = taosArrayDestroy(execInfo.pNodeList);
execInfo.pNodeList = extractNodeListFromStream(pMnode);
@@ -1288,7 +1035,7 @@ static int32_t mndCheckNodeStatus(SMnode *pMnode) {
if (pEntry->status != TASK_STATUS__READY) {
mDebug("s-task:0x%" PRIx64 "-0x%x (nodeId:%d) status:%s not ready, checkpoint msg not issued",
- pEntry->id.streamId, (int32_t)pEntry->id.taskId, 0, streamTaskGetStatusStr(pEntry->status));
+ pEntry->id.streamId, (int32_t)pEntry->id.taskId, pEntry->nodeId, streamTaskGetStatusStr(pEntry->status));
ready = false;
break;
}
@@ -1309,9 +1056,10 @@ static int32_t mndProcessStreamDoCheckpoint(SRpcMsg *pReq) {
return code;
}
+ // make sure the time interval between two consecutive checkpoint trans is long enough
SMStreamDoCheckpointMsg *pMsg = (SMStreamDoCheckpointMsg *)pReq->pCont;
while ((pIter = sdbFetch(pSdb, SDB_STREAM, pIter, (void **)&pStream)) != NULL) {
- code = mndProcessStreamCheckpointTrans(pMnode, pStream, pMsg->checkpointId);
+ code = mndProcessStreamCheckpointTrans(pMnode, pStream, pMsg->checkpointId, 1, true);
sdbRelease(pSdb, pStream);
if (code == -1) {
break;
@@ -1348,7 +1096,7 @@ static int32_t mndProcessStreamCheckpointInCandid(SRpcMsg *pReq) {
mDebug("start to launch checkpoint for stream:%s %" PRIx64 " in candidate list", pEntry->pName, pEntry->streamId);
- code = mndProcessStreamCheckpointTrans(pMnode, ps, pEntry->checkpointId);
+ code = mndProcessStreamCheckpointTrans(pMnode, ps, pEntry->checkpointId, 1, true);
mndReleaseStream(pMnode, ps);
if (code == TSDB_CODE_SUCCESS) {
@@ -1408,7 +1156,7 @@ static int32_t mndProcessDropStreamReq(SRpcMsg *pReq) {
return -1;
}
- STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_NOTHING, pReq, MND_STREAM_DROP_NAME);
+ STrans* pTrans = doCreateTrans(pMnode, pStream, pReq, MND_STREAM_DROP_NAME, "drop stream");
if (pTrans == NULL) {
mError("stream:%s, failed to drop since %s", dropReq.name, terrstr());
sdbRelease(pMnode->pSdb, pStream);
@@ -1416,20 +1164,10 @@ static int32_t mndProcessDropStreamReq(SRpcMsg *pReq) {
return -1;
}
- mInfo("trans:%d used to drop stream:%s", pTrans->id, dropReq.name);
-
- mndTransSetDbName(pTrans, pStream->sourceDb, pStream->targetSTbName);
- if (mndTransCheckConflict(pMnode, pTrans) != 0) {
- sdbRelease(pMnode->pSdb, pStream);
- mndTransDrop(pTrans);
- tFreeMDropStreamReq(&dropReq);
- return -1;
- }
-
int32_t code = mndStreamRegisterTrans(pTrans, MND_STREAM_DROP_NAME, pStream->uid);
// drop all tasks
- if (mndDropStreamTasks(pMnode, pTrans, pStream) < 0) {
+ if (mndStreamSetDropAction(pMnode, pTrans, pStream) < 0) {
mError("stream:%s, failed to drop task since %s", dropReq.name, terrstr());
sdbRelease(pMnode->pSdb, pStream);
mndTransDrop(pTrans);
@@ -1438,7 +1176,7 @@ static int32_t mndProcessDropStreamReq(SRpcMsg *pReq) {
}
// drop stream
- if (mndPersistDropStreamLog(pMnode, pTrans, pStream) < 0) {
+ if (mndPersistTransLog(pStream, pTrans, SDB_STATUS_DROPPED) < 0) {
sdbRelease(pMnode->pSdb, pStream);
mndTransDrop(pTrans);
tFreeMDropStreamReq(&dropReq);
@@ -1457,7 +1195,7 @@ static int32_t mndProcessDropStreamReq(SRpcMsg *pReq) {
int32_t transId = mndStreamGetRelTrans(pMnode, pStream->uid);
if (transId != 0) {
mDebug("drop active related transId:%d due to stream:%s dropped", transId, pStream->name);
- killTransImpl(pMnode, transId, pStream->sourceDb);
+ mndKillTransImpl(pMnode, transId, pStream->sourceDb);
}
removeStreamTasksInBuf(pStream, &execInfo);
@@ -1493,7 +1231,7 @@ int32_t mndDropStreamByDb(SMnode *pMnode, STrans *pTrans, SDbObj *pDb) {
return -1;
} else {
#if 0
- if (mndDropStreamTasks(pMnode, pTrans, pStream) < 0) {
+ if (mndStreamSetDropAction(pMnode, pTrans, pStream) < 0) {
mError("stream:%s, failed to drop task since %s", pStream->name, terrstr());
sdbRelease(pMnode->pSdb, pStream);
sdbCancelFetch(pSdb, pIter);
@@ -1505,13 +1243,13 @@ int32_t mndDropStreamByDb(SMnode *pMnode, STrans *pTrans, SDbObj *pDb) {
int32_t transId = mndStreamGetRelTrans(pMnode, pStream->uid);
if (transId != 0) {
mDebug("drop active related transId:%d due to stream:%s dropped", transId, pStream->name);
- killTransImpl(pMnode, transId, pStream->sourceDb);
+ mndKillTransImpl(pMnode, transId, pStream->sourceDb);
}
// drop the stream obj in execInfo
removeStreamTasksInBuf(pStream, &execInfo);
- if (mndPersistDropStreamLog(pMnode, pTrans, pStream) < 0) {
+ if (mndPersistTransLog(pStream, pTrans, SDB_STATUS_DROPPED) < 0) {
sdbRelease(pSdb, pStream);
sdbCancelFetch(pSdb, pIter);
return -1;
@@ -1752,18 +1490,6 @@ static int32_t setTaskAttrInResBlock(SStreamObj *pStream, SStreamTask *pTask, SS
return TSDB_CODE_SUCCESS;
}
-static int32_t getNumOfTasks(SArray *pTaskList) {
- int32_t numOfLevels = taosArrayGetSize(pTaskList);
-
- int32_t count = 0;
- for (int32_t i = 0; i < numOfLevels; i++) {
- SArray *pLevel = taosArrayGetP(pTaskList, i);
- count += taosArrayGetSize(pLevel);
- }
-
- return count;
-}
-
static int32_t mndRetrieveStreamTask(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rowsCapacity) {
SMnode *pMnode = pReq->info.node;
SSdb *pSdb = pMnode->pSdb;
@@ -1779,27 +1505,25 @@ static int32_t mndRetrieveStreamTask(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock
// lock
taosRLockLatch(&pStream->lock);
- int32_t count = getNumOfTasks(pStream->tasks);
+ int32_t count = mndGetNumOfStreamTasks(pStream);
if (numOfRows + count > rowsCapacity) {
blockDataEnsureCapacity(pBlock, numOfRows + count);
}
// add row for each task
- for (int32_t i = 0; i < taosArrayGetSize(pStream->tasks); i++) {
- SArray *pLevel = taosArrayGetP(pStream->tasks, i);
+ SStreamTaskIter *pIter = createStreamTaskIter(pStream);
+ while (streamTaskIterNextTask(pIter)) {
+ SStreamTask *pTask = streamTaskIterGetCurrent(pIter);
- int32_t numOfLevels = taosArrayGetSize(pLevel);
- for (int32_t j = 0; j < numOfLevels; j++) {
- SStreamTask *pTask = taosArrayGetP(pLevel, j);
- int32_t code = setTaskAttrInResBlock(pStream, pTask, pBlock, numOfRows);
- if (code == TSDB_CODE_SUCCESS) {
- numOfRows++;
- }
+ int32_t code = setTaskAttrInResBlock(pStream, pTask, pBlock, numOfRows);
+ if (code == TSDB_CODE_SUCCESS) {
+ numOfRows++;
}
}
- // unlock
+ destroyStreamTaskIter(pIter);
taosRUnLockLatch(&pStream->lock);
+
sdbRelease(pSdb, pStream);
}
@@ -1812,83 +1536,6 @@ static void mndCancelGetNextStreamTask(SMnode *pMnode, void *pIter) {
sdbCancelFetch(pSdb, pIter);
}
-static int32_t mndPauseStreamTask(SMnode *pMnode, STrans *pTrans, SStreamTask *pTask) {
- SVPauseStreamTaskReq *pReq = taosMemoryCalloc(1, sizeof(SVPauseStreamTaskReq));
- if (pReq == NULL) {
- mError("failed to malloc in pause stream, size:%" PRIzu ", code:%s", sizeof(SVPauseStreamTaskReq),
- tstrerror(TSDB_CODE_OUT_OF_MEMORY));
- terrno = TSDB_CODE_OUT_OF_MEMORY;
- return -1;
- }
-
- pReq->head.vgId = htonl(pTask->info.nodeId);
- pReq->taskId = pTask->id.taskId;
- pReq->streamId = pTask->id.streamId;
-
- SEpSet epset = {0};
- mDebug("pause node:%d, epset:%d", pTask->info.nodeId, epset.numOfEps);
- bool hasEpset = false;
- int32_t code = extractNodeEpset(pMnode, &epset, &hasEpset, pTask->id.taskId, pTask->info.nodeId);
- if (code != TSDB_CODE_SUCCESS) {
- terrno = code;
- taosMemoryFree(pReq);
- return -1;
- }
-
- // no valid epset, return directly without redoAction
- if (!hasEpset) {
- taosMemoryFree(pReq);
- return TSDB_CODE_SUCCESS;
- }
-
- STransAction action = {0};
- initTransAction(&action, pReq, sizeof(SVPauseStreamTaskReq), TDMT_STREAM_TASK_PAUSE, &epset, 0);
- if (mndTransAppendRedoAction(pTrans, &action) != 0) {
- taosMemoryFree(pReq);
- return -1;
- }
- return 0;
-}
-
-int32_t mndPauseAllStreamTasks(SMnode *pMnode, STrans *pTrans, SStreamObj *pStream) {
- SArray *tasks = pStream->tasks;
-
- int32_t size = taosArrayGetSize(tasks);
- for (int32_t i = 0; i < size; i++) {
- SArray *pTasks = taosArrayGetP(tasks, i);
- int32_t sz = taosArrayGetSize(pTasks);
- for (int32_t j = 0; j < sz; j++) {
- SStreamTask *pTask = taosArrayGetP(pTasks, j);
- if (mndPauseStreamTask(pMnode, pTrans, pTask) < 0) {
- return -1;
- }
-
- if (atomic_load_8(&pTask->status.taskStatus) != TASK_STATUS__PAUSE) {
- atomic_store_8(&pTask->status.statusBackup, pTask->status.taskStatus);
- atomic_store_8(&pTask->status.taskStatus, TASK_STATUS__PAUSE);
- }
- }
- }
- return 0;
-}
-
-static int32_t mndPersistStreamLog(STrans *pTrans, SStreamObj *pStream, int8_t status) {
- // SStreamObj streamObj = {0};
- // memcpy(streamObj.name, pStream->name, TSDB_STREAM_FNAME_LEN);
- taosWLockLatch(&pStream->lock);
- pStream->status = status;
- SSdbRaw *pCommitRaw = mndStreamActionEncode(pStream);
-
- taosWUnLockLatch(&pStream->lock);
- if (pCommitRaw == NULL) return -1;
- if (mndTransAppendCommitlog(pTrans, pCommitRaw) != 0) {
- mError("stream trans:%d, failed to append commit log since %s", pTrans->id, terrstr());
- return -1;
- }
- (void)sdbSetRawStatus(pCommitRaw, SDB_STATUS_READY);
- return 0;
-}
-
static int32_t mndProcessPauseStreamReq(SRpcMsg *pReq) {
SMnode *pMnode = pReq->info.node;
SStreamObj *pStream = NULL;
@@ -1903,9 +1550,10 @@ static int32_t mndProcessPauseStreamReq(SRpcMsg *pReq) {
if (pStream == NULL) {
if (pauseReq.igNotExists) {
- mInfo("stream:%s, not exist, if exist is set", pauseReq.name);
+ mInfo("stream:%s, not exist, not pause stream", pauseReq.name);
return 0;
} else {
+ mError("stream:%s not exist, failed to pause stream", pauseReq.name);
terrno = TSDB_CODE_MND_STREAM_NOT_EXIST;
return -1;
}
@@ -1934,26 +1582,17 @@ static int32_t mndProcessPauseStreamReq(SRpcMsg *pReq) {
return -1;
}
- STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_NOTHING, pReq, MND_STREAM_PAUSE_NAME);
+ STrans* pTrans = doCreateTrans(pMnode, pStream, pReq, MND_STREAM_PAUSE_NAME, "pause the stream");
if (pTrans == NULL) {
mError("stream:%s failed to pause stream since %s", pauseReq.name, terrstr());
sdbRelease(pMnode->pSdb, pStream);
return -1;
}
- mInfo("trans:%d, used to pause stream:%s", pTrans->id, pauseReq.name);
-
- mndTransSetDbName(pTrans, pStream->sourceDb, pStream->targetSTbName);
- if (mndTransCheckConflict(pMnode, pTrans) != 0) {
- sdbRelease(pMnode->pSdb, pStream);
- mndTransDrop(pTrans);
- return -1;
- }
-
int32_t code = mndStreamRegisterTrans(pTrans, MND_STREAM_PAUSE_NAME, pStream->uid);
// if nodeUpdate happened, not send pause trans
- if (mndPauseAllStreamTasks(pMnode, pTrans, pStream) < 0) {
+ if (mndStreamSetPauseAction(pMnode, pTrans, pStream) < 0) {
mError("stream:%s, failed to pause task since %s", pauseReq.name, terrstr());
sdbRelease(pMnode->pSdb, pStream);
mndTransDrop(pTrans);
@@ -1961,12 +1600,18 @@ static int32_t mndProcessPauseStreamReq(SRpcMsg *pReq) {
}
// pause stream
- if (mndPersistStreamLog(pTrans, pStream, STREAM_STATUS__PAUSE) < 0) {
+ taosWLockLatch(&pStream->lock);
+ pStream->status = STREAM_STATUS__PAUSE;
+ if (mndPersistTransLog(pStream, pTrans,SDB_STATUS_READY) < 0) {
+ taosWUnLockLatch(&pStream->lock);
+
sdbRelease(pMnode->pSdb, pStream);
mndTransDrop(pTrans);
return -1;
}
+ taosWUnLockLatch(&pStream->lock);
+
if (mndTransPrepare(pMnode, pTrans) != 0) {
mError("trans:%d, failed to prepare pause stream trans since %s", pTrans->id, terrstr());
sdbRelease(pMnode->pSdb, pStream);
@@ -1980,75 +1625,30 @@ static int32_t mndProcessPauseStreamReq(SRpcMsg *pReq) {
return TSDB_CODE_ACTION_IN_PROGRESS;
}
-static int32_t mndResumeStreamTask(STrans *pTrans, SMnode *pMnode, SStreamTask *pTask, int8_t igUntreated) {
- SVResumeStreamTaskReq *pReq = taosMemoryCalloc(1, sizeof(SVResumeStreamTaskReq));
- if (pReq == NULL) {
- mError("failed to malloc in resume stream, size:%" PRIzu ", code:%s", sizeof(SVResumeStreamTaskReq),
- tstrerror(TSDB_CODE_OUT_OF_MEMORY));
- terrno = TSDB_CODE_OUT_OF_MEMORY;
- return -1;
- }
-
- pReq->head.vgId = htonl(pTask->info.nodeId);
- pReq->taskId = pTask->id.taskId;
- pReq->streamId = pTask->id.streamId;
- pReq->igUntreated = igUntreated;
-
- SEpSet epset = {0};
- bool hasEpset = false;
- int32_t code = extractNodeEpset(pMnode, &epset, &hasEpset, pTask->id.taskId, pTask->info.nodeId);
- if (code != TSDB_CODE_SUCCESS) {
- terrno = code;
- taosMemoryFree(pReq);
- return -1;
- }
-
- STransAction action = {0};
- initTransAction(&action, pReq, sizeof(SVResumeStreamTaskReq), TDMT_STREAM_TASK_RESUME, &epset, 0);
- if (mndTransAppendRedoAction(pTrans, &action) != 0) {
- taosMemoryFree(pReq);
- return -1;
- }
- return 0;
-}
-
-int32_t mndResumeAllStreamTasks(STrans *pTrans, SMnode *pMnode, SStreamObj *pStream, int8_t igUntreated) {
- int32_t size = taosArrayGetSize(pStream->tasks);
- for (int32_t i = 0; i < size; i++) {
- SArray *pTasks = taosArrayGetP(pStream->tasks, i);
- int32_t sz = taosArrayGetSize(pTasks);
- for (int32_t j = 0; j < sz; j++) {
- SStreamTask *pTask = taosArrayGetP(pTasks, j);
- if (mndResumeStreamTask(pTrans, pMnode, pTask, igUntreated) < 0) {
- return -1;
- }
-
- if (atomic_load_8(&pTask->status.taskStatus) == TASK_STATUS__PAUSE) {
- atomic_store_8(&pTask->status.taskStatus, pTask->status.statusBackup);
- }
- }
- }
- return 0;
-}
-
static int32_t mndProcessResumeStreamReq(SRpcMsg *pReq) {
SMnode *pMnode = pReq->info.node;
SStreamObj *pStream = NULL;
- SMResumeStreamReq pauseReq = {0};
- if (tDeserializeSMResumeStreamReq(pReq->pCont, pReq->contLen, &pauseReq) < 0) {
+ if(grantCheck(TSDB_GRANT_STREAMS) < 0){
+ terrno = TSDB_CODE_GRANT_EXPIRED;
+ return -1;
+ }
+
+ SMResumeStreamReq resumeReq = {0};
+ if (tDeserializeSMResumeStreamReq(pReq->pCont, pReq->contLen, &resumeReq) < 0) {
terrno = TSDB_CODE_INVALID_MSG;
return -1;
}
- pStream = mndAcquireStream(pMnode, pauseReq.name);
+ pStream = mndAcquireStream(pMnode, resumeReq.name);
if (pStream == NULL) {
- if (pauseReq.igNotExists) {
- mInfo("stream:%s, not exist, if exist is set", pauseReq.name);
+ if (resumeReq.igNotExists) {
+ mInfo("stream:%s not exist, not resume stream", resumeReq.name);
sdbRelease(pMnode->pSdb, pStream);
return 0;
} else {
+ mError("stream:%s not exist, failed to resume stream", resumeReq.name);
terrno = TSDB_CODE_MND_STREAM_NOT_EXIST;
return -1;
}
@@ -2071,39 +1671,35 @@ static int32_t mndProcessResumeStreamReq(SRpcMsg *pReq) {
return -1;
}
- STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_NOTHING, pReq, MND_STREAM_RESUME_NAME);
+ STrans* pTrans = doCreateTrans(pMnode, pStream, pReq, MND_STREAM_RESUME_NAME, "resume the stream");
if (pTrans == NULL) {
- mError("stream:%s, failed to resume stream since %s", pauseReq.name, terrstr());
+ mError("stream:%s, failed to resume stream since %s", resumeReq.name, terrstr());
sdbRelease(pMnode->pSdb, pStream);
return -1;
}
- mInfo("trans:%d used to resume stream:%s", pTrans->id, pauseReq.name);
-
- mndTransSetDbName(pTrans, pStream->sourceDb, pStream->targetSTbName);
- if (mndTransCheckConflict(pMnode, pTrans) != 0) {
- sdbRelease(pMnode->pSdb, pStream);
- mndTransDrop(pTrans);
- return -1;
- }
-
int32_t code = mndStreamRegisterTrans(pTrans, MND_STREAM_RESUME_NAME, pStream->uid);
- // resume all tasks
- if (mndResumeAllStreamTasks(pTrans, pMnode, pStream, pauseReq.igUntreated) < 0) {
- mError("stream:%s, failed to drop task since %s", pauseReq.name, terrstr());
+ // set the resume action
+ if (mndStreamSetResumeAction(pTrans, pMnode, pStream, resumeReq.igUntreated) < 0) {
+ mError("stream:%s, failed to drop task since %s", resumeReq.name, terrstr());
sdbRelease(pMnode->pSdb, pStream);
mndTransDrop(pTrans);
return -1;
}
// resume stream
- if (mndPersistStreamLog(pTrans, pStream, STREAM_STATUS__NORMAL) < 0) {
+ taosWLockLatch(&pStream->lock);
+ pStream->status = STREAM_STATUS__NORMAL;
+ if (mndPersistTransLog(pStream, pTrans, SDB_STATUS_READY) < 0) {
+ taosWUnLockLatch(&pStream->lock);
+
sdbRelease(pMnode->pSdb, pStream);
mndTransDrop(pTrans);
return -1;
}
+ taosWUnLockLatch(&pStream->lock);
if (mndTransPrepare(pMnode, pTrans) != 0) {
mError("trans:%d, failed to prepare pause stream trans since %s", pTrans->id, terrstr());
sdbRelease(pMnode->pSdb, pStream);
@@ -2117,125 +1713,6 @@ static int32_t mndProcessResumeStreamReq(SRpcMsg *pReq) {
return TSDB_CODE_ACTION_IN_PROGRESS;
}
-static void initNodeUpdateMsg(SStreamTaskNodeUpdateMsg *pMsg, const SVgroupChangeInfo *pInfo, SStreamTaskId *pId,
- int32_t transId) {
- pMsg->streamId = pId->streamId;
- pMsg->taskId = pId->taskId;
- pMsg->transId = transId;
- pMsg->pNodeList = taosArrayInit(taosArrayGetSize(pInfo->pUpdateNodeList), sizeof(SNodeUpdateInfo));
- taosArrayAddAll(pMsg->pNodeList, pInfo->pUpdateNodeList);
-}
-
-static int32_t doBuildStreamTaskUpdateMsg(void **pBuf, int32_t *pLen, SVgroupChangeInfo *pInfo, int32_t nodeId,
- SStreamTaskId *pId, int32_t transId) {
- SStreamTaskNodeUpdateMsg req = {0};
- initNodeUpdateMsg(&req, pInfo, pId, transId);
-
- int32_t code = 0;
- int32_t blen;
-
- tEncodeSize(tEncodeStreamTaskUpdateMsg, &req, blen, code);
- if (code < 0) {
- terrno = TSDB_CODE_OUT_OF_MEMORY;
- taosArrayDestroy(req.pNodeList);
- return -1;
- }
-
- int32_t tlen = sizeof(SMsgHead) + blen;
-
- void *buf = taosMemoryMalloc(tlen);
- if (buf == NULL) {
- terrno = TSDB_CODE_OUT_OF_MEMORY;
- taosArrayDestroy(req.pNodeList);
- return -1;
- }
-
- void *abuf = POINTER_SHIFT(buf, sizeof(SMsgHead));
- SEncoder encoder;
- tEncoderInit(&encoder, abuf, tlen);
- tEncodeStreamTaskUpdateMsg(&encoder, &req);
-
- SMsgHead *pMsgHead = (SMsgHead *)buf;
- pMsgHead->contLen = htonl(tlen);
- pMsgHead->vgId = htonl(nodeId);
-
- tEncoderClear(&encoder);
-
- *pBuf = buf;
- *pLen = tlen;
-
- taosArrayDestroy(req.pNodeList);
- return TSDB_CODE_SUCCESS;
-}
-
-int32_t mndPersistTransLog(SStreamObj *pStream, STrans *pTrans) {
- SSdbRaw *pCommitRaw = mndStreamActionEncode(pStream);
- if (pCommitRaw == NULL) {
- mError("failed to encode stream since %s", terrstr());
- mndTransDrop(pTrans);
- return -1;
- }
-
- if (mndTransAppendCommitlog(pTrans, pCommitRaw) != 0) {
- mError("stream trans:%d, failed to append commit log since %s", pTrans->id, terrstr());
- sdbFreeRaw(pCommitRaw);
- mndTransDrop(pTrans);
- return -1;
- }
-
- if (sdbSetRawStatus(pCommitRaw, SDB_STATUS_READY) != 0) {
- mError("stream trans:%d failed to set raw status since %s", pTrans->id, terrstr());
- sdbFreeRaw(pCommitRaw);
- mndTransDrop(pTrans);
- return -1;
- }
-
- return 0;
-}
-
-void initTransAction(STransAction *pAction, void *pCont, int32_t contLen, int32_t msgType, const SEpSet *pEpset,
- int32_t retryCode) {
- pAction->epSet = *pEpset;
- pAction->contLen = contLen;
- pAction->pCont = pCont;
- pAction->msgType = msgType;
- pAction->retryCode = retryCode;
-}
-
-// todo extract method: traverse stream tasks
-// build trans to update the epset
-static int32_t createStreamUpdateTrans(SStreamObj *pStream, SVgroupChangeInfo *pInfo, STrans *pTrans) {
- mDebug("start to build stream:0x%" PRIx64 " tasks epset update", pStream->uid);
-
- taosWLockLatch(&pStream->lock);
- int32_t numOfLevels = taosArrayGetSize(pStream->tasks);
-
- for (int32_t j = 0; j < numOfLevels; ++j) {
- SArray *pLevel = taosArrayGetP(pStream->tasks, j);
-
- int32_t numOfTasks = taosArrayGetSize(pLevel);
- for (int32_t k = 0; k < numOfTasks; ++k) {
- SStreamTask *pTask = taosArrayGetP(pLevel, k);
-
- void *pBuf = NULL;
- int32_t len = 0;
- streamTaskUpdateEpsetInfo(pTask, pInfo->pUpdateNodeList);
- doBuildStreamTaskUpdateMsg(&pBuf, &len, pInfo, pTask->info.nodeId, &pTask->id, pTrans->id);
-
- STransAction action = {0};
- initTransAction(&action, pBuf, len, TDMT_VND_STREAM_TASK_UPDATE, &pTask->info.epSet, 0);
- if (mndTransAppendRedoAction(pTrans, &action) != 0) {
- taosMemoryFree(pBuf);
- taosWUnLockLatch(&pStream->lock);
- return -1;
- }
- }
- }
-
- taosWUnLockLatch(&pStream->lock);
- return 0;
-}
-
static bool isNodeEpsetChanged(const SEpSet *pPrevEpset, const SEpSet *pCurrent) {
const SEp *pEp = GET_ACTIVE_EP(pPrevEpset);
const SEp *p = GET_ACTIVE_EP(pCurrent);
@@ -2295,69 +1772,6 @@ static SVgroupChangeInfo mndFindChangedNodeInfo(SMnode *pMnode, const SArray *pP
return info;
}
-static SArray *mndTakeVgroupSnapshot(SMnode *pMnode, bool *allReady) {
- SSdb *pSdb = pMnode->pSdb;
- void *pIter = NULL;
- SVgObj *pVgroup = NULL;
-
- *allReady = true;
- SArray *pVgroupListSnapshot = taosArrayInit(4, sizeof(SNodeEntry));
-
- while (1) {
- pIter = sdbFetch(pSdb, SDB_VGROUP, pIter, (void **)&pVgroup);
- if (pIter == NULL) {
- break;
- }
-
- SNodeEntry entry = {.nodeId = pVgroup->vgId, .hbTimestamp = pVgroup->updateTime};
- entry.epset = mndGetVgroupEpset(pMnode, pVgroup);
-
- // if not all ready till now, no need to check the remaining vgroups.
- if (*allReady) {
- for (int32_t i = 0; i < pVgroup->replica; ++i) {
- if (!pVgroup->vnodeGid[i].syncRestore) {
- mInfo("vgId:%d not restored, not ready for checkpoint or other operations", pVgroup->vgId);
- *allReady = false;
- break;
- }
-
- ESyncState state = pVgroup->vnodeGid[i].syncState;
- if (state == TAOS_SYNC_STATE_OFFLINE || state == TAOS_SYNC_STATE_ERROR) {
- mInfo("vgId:%d offline/err, not ready for checkpoint or other operations", pVgroup->vgId);
- *allReady = false;
- break;
- }
- }
- }
-
- char buf[256] = {0};
- EPSET_TO_STR(&entry.epset, buf);
- mDebug("take node snapshot, nodeId:%d %s", entry.nodeId, buf);
- taosArrayPush(pVgroupListSnapshot, &entry);
- sdbRelease(pSdb, pVgroup);
- }
-
- SSnodeObj *pObj = NULL;
- while (1) {
- pIter = sdbFetch(pSdb, SDB_SNODE, pIter, (void **)&pObj);
- if (pIter == NULL) {
- break;
- }
-
- SNodeEntry entry = {0};
- addEpIntoEpSet(&entry.epset, pObj->pDnode->fqdn, pObj->pDnode->port);
- entry.nodeId = SNODE_HANDLE;
-
- char buf[256] = {0};
- EPSET_TO_STR(&entry.epset, buf);
- mDebug("take snode snapshot, nodeId:%d %s", entry.nodeId, buf);
- taosArrayPush(pVgroupListSnapshot, &entry);
- sdbRelease(pSdb, pObj);
- }
-
- return pVgroupListSnapshot;
-}
-
static int32_t mndProcessVgroupChange(SMnode *pMnode, SVgroupChangeInfo *pChangeInfo) {
SSdb *pSdb = pMnode->pSdb;
SStreamObj *pStream = NULL;
@@ -2396,7 +1810,7 @@ static int32_t mndProcessVgroupChange(SMnode *pMnode, SVgroupChangeInfo *pChange
return terrno;
}
- mndStreamRegisterTrans(pTrans, MND_STREAM_TASK_RESET_NAME, pStream->uid);
+ mndStreamRegisterTrans(pTrans, MND_STREAM_TASK_UPDATE_NAME, pStream->uid);
}
void *p = taosHashGet(pChangeInfo->pDBMap, pStream->targetDb, strlen(pStream->targetDb));
@@ -2410,7 +1824,7 @@ static int32_t mndProcessVgroupChange(SMnode *pMnode, SVgroupChangeInfo *pChange
mDebug("stream:0x%" PRIx64 " %s involved node changed, create update trans, transId:%d", pStream->uid,
pStream->name, pTrans->id);
- int32_t code = createStreamUpdateTrans(pStream, pChangeInfo, pTrans);
+ int32_t code = mndStreamSetUpdateEpsetAction(pStream, pChangeInfo, pTrans);
// todo: not continue, drop all and retry again
if (code != TSDB_CODE_SUCCESS) {
@@ -2420,7 +1834,7 @@ static int32_t mndProcessVgroupChange(SMnode *pMnode, SVgroupChangeInfo *pChange
continue;
}
- code = mndPersistTransLog(pStream, pTrans);
+ code = mndPersistTransLog(pStream, pTrans, SDB_STATUS_READY);
sdbRelease(pSdb, pStream);
if (code != TSDB_CODE_SUCCESS) {
@@ -2454,22 +1868,19 @@ static SArray *extractNodeListFromStream(SMnode *pMnode) {
}
taosWLockLatch(&pStream->lock);
- int32_t numOfLevels = taosArrayGetSize(pStream->tasks);
- for (int32_t j = 0; j < numOfLevels; ++j) {
- SArray *pLevel = taosArrayGetP(pStream->tasks, j);
+ SStreamTaskIter *pTaskIter = createStreamTaskIter(pStream);
+ while (streamTaskIterNextTask(pTaskIter)) {
+ SStreamTask *pTask = streamTaskIterGetCurrent(pTaskIter);
- int32_t numOfTasks = taosArrayGetSize(pLevel);
- for (int32_t k = 0; k < numOfTasks; ++k) {
- SStreamTask *pTask = taosArrayGetP(pLevel, k);
-
- SNodeEntry entry = {.hbTimestamp = -1, .nodeId = pTask->info.nodeId};
- epsetAssign(&entry.epset, &pTask->info.epSet);
- taosHashPut(pHash, &entry.nodeId, sizeof(entry.nodeId), &entry, sizeof(entry));
- }
+ SNodeEntry entry = {.hbTimestamp = -1, .nodeId = pTask->info.nodeId};
+ epsetAssign(&entry.epset, &pTask->info.epSet);
+ taosHashPut(pHash, &entry.nodeId, sizeof(entry.nodeId), &entry, sizeof(entry));
}
+ destroyStreamTaskIter(pTaskIter);
taosWUnLockLatch(&pStream->lock);
+
sdbRelease(pSdb, pStream);
}
@@ -2490,22 +1901,6 @@ static SArray *extractNodeListFromStream(SMnode *pMnode) {
return plist;
}
-static void doExtractTasksFromStream(SMnode *pMnode) {
- SSdb *pSdb = pMnode->pSdb;
- SStreamObj *pStream = NULL;
- void *pIter = NULL;
-
- while (1) {
- pIter = sdbFetch(pSdb, SDB_STREAM, pIter, (void **)&pStream);
- if (pIter == NULL) {
- break;
- }
-
- saveStreamTasksInfo(pStream, &execInfo);
- sdbRelease(pSdb, pStream);
- }
-}
-
static int32_t doRemoveTasks(SStreamExecInfo *pExecNode, STaskId *pRemovedId) {
void *p = taosHashGet(pExecNode->pTaskMap, pRemovedId, sizeof(*pRemovedId));
if (p == NULL) {
@@ -2586,26 +1981,6 @@ int32_t removeExpirednodeEntryAndTask(SArray *pNodeSnapshot) {
return 0;
}
-// kill all trans in the dst DB
-static void killAllCheckpointTrans(SMnode *pMnode, SVgroupChangeInfo *pChangeInfo) {
- mDebug("start to clear checkpoints in all Dbs");
-
- void *pIter = NULL;
- while ((pIter = taosHashIterate(pChangeInfo->pDBMap, pIter)) != NULL) {
- char *pDb = (char *)pIter;
-
- size_t len = 0;
- void *pKey = taosHashGetKey(pDb, &len);
- char *p = strndup(pKey, len);
-
- mDebug("clear checkpoint trans in Db:%s", p);
- doKillCheckpointTrans(pMnode, pKey, len);
- taosMemoryFree(p);
- }
-
- mDebug("complete clear checkpoints in Dbs");
-}
-
// this function runs by only one thread, so it is not multi-thread safe
static int32_t mndProcessNodeCheckReq(SRpcMsg *pMsg) {
int32_t code = 0;
@@ -2675,10 +2050,6 @@ static int32_t mndProcessNodeCheckReq(SRpcMsg *pMsg) {
return 0;
}
-typedef struct SMStreamNodeCheckMsg {
- int8_t placeHolder; // // to fix windows compile error, define place holder
-} SMStreamNodeCheckMsg;
-
static int32_t mndProcessNodeCheck(SRpcMsg *pReq) {
SMnode *pMnode = pReq->info.node;
SSdb *pSdb = pMnode->pSdb;
@@ -2695,477 +2066,136 @@ static int32_t mndProcessNodeCheck(SRpcMsg *pReq) {
}
void saveStreamTasksInfo(SStreamObj *pStream, SStreamExecInfo *pExecNode) {
- int32_t level = taosArrayGetSize(pStream->tasks);
+ SStreamTaskIter *pIter = createStreamTaskIter(pStream);
+ while (streamTaskIterNextTask(pIter)) {
+ SStreamTask *pTask = streamTaskIterGetCurrent(pIter);
- for (int32_t i = 0; i < level; i++) {
- SArray *pLevel = taosArrayGetP(pStream->tasks, i);
+ STaskId id = {.streamId = pTask->id.streamId, .taskId = pTask->id.taskId};
+ void *p = taosHashGet(pExecNode->pTaskMap, &id, sizeof(id));
+ if (p == NULL) {
+ STaskStatusEntry entry = {0};
+ streamTaskStatusInit(&entry, pTask);
- int32_t numOfTasks = taosArrayGetSize(pLevel);
- for (int32_t j = 0; j < numOfTasks; j++) {
- SStreamTask *pTask = taosArrayGetP(pLevel, j);
-
- STaskId id = {.streamId = pTask->id.streamId, .taskId = pTask->id.taskId};
- void *p = taosHashGet(pExecNode->pTaskMap, &id, sizeof(id));
- if (p == NULL) {
- STaskStatusEntry entry = {0};
- streamTaskStatusInit(&entry, pTask);
-
- taosHashPut(pExecNode->pTaskMap, &id, sizeof(id), &entry, sizeof(entry));
- taosArrayPush(pExecNode->pTaskList, &id);
- mInfo("s-task:0x%x add into task buffer, total:%d", (int32_t)entry.id.taskId,
- (int32_t)taosArrayGetSize(pExecNode->pTaskList));
- }
+ taosHashPut(pExecNode->pTaskMap, &id, sizeof(id), &entry, sizeof(entry));
+ taosArrayPush(pExecNode->pTaskList, &id);
+ mInfo("s-task:0x%x add into task buffer, total:%d", (int32_t)entry.id.taskId,
+ (int32_t)taosArrayGetSize(pExecNode->pTaskList));
}
}
+
+ destroyStreamTaskIter(pIter);
}
void removeStreamTasksInBuf(SStreamObj *pStream, SStreamExecInfo *pExecNode) {
- int32_t level = taosArrayGetSize(pStream->tasks);
- for (int32_t i = 0; i < level; i++) {
- SArray *pLevel = taosArrayGetP(pStream->tasks, i);
+ SStreamTaskIter *pIter = createStreamTaskIter(pStream);
+ while (streamTaskIterNextTask(pIter)) {
+ SStreamTask *pTask = streamTaskIterGetCurrent(pIter);
- int32_t numOfTasks = taosArrayGetSize(pLevel);
- for (int32_t j = 0; j < numOfTasks; j++) {
- SStreamTask *pTask = taosArrayGetP(pLevel, j);
+ STaskId id = {.streamId = pTask->id.streamId, .taskId = pTask->id.taskId};
+ void *p = taosHashGet(pExecNode->pTaskMap, &id, sizeof(id));
+ if (p != NULL) {
+ taosHashRemove(pExecNode->pTaskMap, &id, sizeof(id));
- STaskId id = {.streamId = pTask->id.streamId, .taskId = pTask->id.taskId};
- void *p = taosHashGet(pExecNode->pTaskMap, &id, sizeof(id));
- if (p != NULL) {
- taosHashRemove(pExecNode->pTaskMap, &id, sizeof(id));
+ for (int32_t k = 0; k < taosArrayGetSize(pExecNode->pTaskList); ++k) {
+ STaskId *pId = taosArrayGet(pExecNode->pTaskList, k);
+ if (pId->taskId == id.taskId && pId->streamId == id.streamId) {
+ taosArrayRemove(pExecNode->pTaskList, k);
- for (int32_t k = 0; k < taosArrayGetSize(pExecNode->pTaskList); ++k) {
- STaskId *pId = taosArrayGet(pExecNode->pTaskList, k);
- if (pId->taskId == id.taskId && pId->streamId == id.streamId) {
- taosArrayRemove(pExecNode->pTaskList, k);
-
- int32_t num = taosArrayGetSize(pExecNode->pTaskList);
- mInfo("s-task:0x%x removed from buffer, remain:%d", (int32_t)id.taskId, num);
- break;
- }
+ int32_t num = taosArrayGetSize(pExecNode->pTaskList);
+ mInfo("s-task:0x%x removed from buffer, remain:%d", (int32_t)id.taskId, num);
+ break;
}
}
}
}
+ destroyStreamTaskIter(pIter);
ASSERT(taosHashGetSize(pExecNode->pTaskMap) == taosArrayGetSize(pExecNode->pTaskList));
}
-STrans *doCreateTrans(SMnode *pMnode, SStreamObj *pStream, SRpcMsg *pReq, const char *name, const char *pMsg) {
- STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_NOTHING, pReq, name);
- if (pTrans == NULL) {
- mError("failed to build trans:%s, reason: %s", name, tstrerror(TSDB_CODE_OUT_OF_MEMORY));
- terrno = TSDB_CODE_OUT_OF_MEMORY;
- return NULL;
- }
-
- mDebug("s-task:0x%" PRIx64 " start to build trans %s", pStream->uid, pMsg);
-
- mndTransSetDbName(pTrans, pStream->sourceDb, pStream->targetSTbName);
- if (mndTransCheckConflict(pMnode, pTrans) != 0) {
- terrno = TSDB_CODE_MND_TRANS_CONFLICT;
- mError("failed to build trans:%s for stream:0x%" PRIx64 " code:%s", name, pStream->uid, tstrerror(terrno));
- mndTransDrop(pTrans);
- return NULL;
- }
-
- terrno = 0;
- return pTrans;
-}
-
-int32_t createStreamResetStatusTrans(SMnode *pMnode, SStreamObj *pStream) {
- STrans *pTrans = doCreateTrans(pMnode, pStream, NULL, MND_STREAM_TASK_RESET_NAME, " reset from failed checkpoint");
- if (pTrans == NULL) {
- return terrno;
- }
-
- taosWLockLatch(&pStream->lock);
- int32_t numOfLevels = taosArrayGetSize(pStream->tasks);
-
- for (int32_t j = 0; j < numOfLevels; ++j) {
- SArray *pLevel = taosArrayGetP(pStream->tasks, j);
-
- int32_t numOfTasks = taosArrayGetSize(pLevel);
- for (int32_t k = 0; k < numOfTasks; ++k) {
- SStreamTask *pTask = taosArrayGetP(pLevel, k);
-
- // todo extract method, with pause stream task
- SVResetStreamTaskReq *pReq = taosMemoryCalloc(1, sizeof(SVResetStreamTaskReq));
- if (pReq == NULL) {
- terrno = TSDB_CODE_OUT_OF_MEMORY;
- mError("failed to malloc in reset stream, size:%" PRIzu ", code:%s", sizeof(SVResetStreamTaskReq),
- tstrerror(TSDB_CODE_OUT_OF_MEMORY));
- taosWUnLockLatch(&pStream->lock);
- return terrno;
- }
-
- pReq->head.vgId = htonl(pTask->info.nodeId);
- pReq->taskId = pTask->id.taskId;
- pReq->streamId = pTask->id.streamId;
-
- SEpSet epset = {0};
- bool hasEpset = false;
- int32_t code = extractNodeEpset(pMnode, &epset, &hasEpset, pTask->id.taskId, pTask->info.nodeId);
- if (code != TSDB_CODE_SUCCESS) {
- taosMemoryFree(pReq);
- continue;
- }
-
- if (!hasEpset) {
- taosMemoryFree(pReq);
- continue;
- }
-
- STransAction action = {0};
- initTransAction(&action, pReq, sizeof(SVResetStreamTaskReq), TDMT_VND_STREAM_TASK_RESET, &epset, 0);
- if (mndTransAppendRedoAction(pTrans, &action) != 0) {
- taosMemoryFree(pReq);
- taosWUnLockLatch(&pStream->lock);
- mndTransDrop(pTrans);
- return terrno;
- }
- }
- }
-
- taosWUnLockLatch(&pStream->lock);
-
- int32_t code = mndPersistTransLog(pStream, pTrans);
- if (code != TSDB_CODE_SUCCESS) {
- sdbRelease(pMnode->pSdb, pStream);
- return -1;
- }
-
- if (mndTransPrepare(pMnode, pTrans) != 0) {
- mError("trans:%d, failed to prepare update stream trans since %s", pTrans->id, terrstr());
- sdbRelease(pMnode->pSdb, pStream);
- mndTransDrop(pTrans);
- return -1;
- }
-
- sdbRelease(pMnode->pSdb, pStream);
- mndTransDrop(pTrans);
-
- return TSDB_CODE_ACTION_IN_PROGRESS;
-}
-
-void killTransImpl(SMnode *pMnode, int32_t transId, const char *pDbName) {
- STrans *pTrans = mndAcquireTrans(pMnode, transId);
- if (pTrans != NULL) {
- mInfo("kill active transId:%d in Db:%s", transId, pDbName);
- mndKillTrans(pMnode, pTrans);
- mndReleaseTrans(pMnode, pTrans);
- } else {
- mError("failed to acquire trans in Db:%s, transId:%d", pDbName, transId);
- }
-}
-
-int32_t doKillCheckpointTrans(SMnode *pMnode, const char *pDBName, size_t len) {
- // data in the hash table will be removed automatically, no need to remove it here.
- SStreamTransInfo *pTransInfo = taosHashGet(execInfo.transMgmt.pDBTrans, pDBName, len);
- if (pTransInfo == NULL) {
- return TSDB_CODE_SUCCESS;
- }
-
- // not checkpoint trans, ignore
- if (strcmp(pTransInfo->name, MND_STREAM_CHECKPOINT_NAME) != 0) {
- mDebug("not checkpoint trans, not kill it, name:%s, transId:%d", pTransInfo->name, pTransInfo->transId);
- return TSDB_CODE_SUCCESS;
- }
-
- char *pDupDBName = strndup(pDBName, len);
- killTransImpl(pMnode, pTransInfo->transId, pDupDBName);
- taosMemoryFree(pDupDBName);
-
- return TSDB_CODE_SUCCESS;
-}
-
-static int32_t mndResetStatusFromCheckpoint(SMnode *pMnode, int64_t streamId, int32_t transId) {
- int32_t code = TSDB_CODE_SUCCESS;
- killTransImpl(pMnode, transId, "");
-
- SStreamObj *pStream = mndGetStreamObj(pMnode, streamId);
- if (pStream == NULL) {
- code = TSDB_CODE_STREAM_TASK_NOT_EXIST;
- mError("failed to acquire the streamObj:0x%" PRIx64 " to reset checkpoint, may have been dropped", pStream->uid);
- } else {
- bool conflict = mndStreamTransConflictCheck(pMnode, pStream->uid, MND_STREAM_TASK_RESET_NAME, false);
- if (conflict) {
- mError("stream:%s other trans exists in DB:%s, dstTable:%s failed to start reset-status trans", pStream->name,
- pStream->sourceDb, pStream->targetSTbName);
- } else {
- mDebug("stream:%s (0x%" PRIx64 ") reset checkpoint procedure, transId:%d, create reset trans", pStream->name,
- pStream->uid, transId);
- code = createStreamResetStatusTrans(pMnode, pStream);
- mndReleaseStream(pMnode, pStream);
- }
- }
-
- return code;
-}
-
-static SStreamTask *mndGetStreamTask(STaskId *pId, SStreamObj *pStream) {
- for (int32_t i = 0; i < taosArrayGetSize(pStream->tasks); i++) {
- SArray *pLevel = taosArrayGetP(pStream->tasks, i);
-
- int32_t numOfLevels = taosArrayGetSize(pLevel);
- for (int32_t j = 0; j < numOfLevels; j++) {
- SStreamTask *pTask = taosArrayGetP(pLevel, j);
- if (pTask->id.taskId == pId->taskId) {
- return pTask;
- }
- }
- }
-
- return NULL;
-}
-
-// static bool needDropRelatedFillhistoryTask(STaskStatusEntry *pTaskEntry, SStreamExecInfo *pExecNode) {
-// if (pTaskEntry->status == TASK_STATUS__STREAM_SCAN_HISTORY && pTaskEntry->statusLastDuration >= 10) {
-// if (!pTaskEntry->inputQChanging && pTaskEntry->inputQUnchangeCounter > 10) {
-// int32_t numOfReady = 0;
-// int32_t numOfTotal = 0;
-// for (int32_t k = 0; k < taosArrayGetSize(pExecNode->pTaskList); ++k) {
-// STaskId *pId = taosArrayGet(pExecNode->pTaskList, k);
-// if (pTaskEntry->id.streamId == pId->streamId) {
-// numOfTotal++;
-//
-// if (pTaskEntry->id.taskId != pId->taskId) {
-// STaskStatusEntry *pEntry = taosHashGet(execInfo.pTaskMap, pId, sizeof(*pId));
-// if (pEntry->status == TASK_STATUS__READY) {
-// numOfReady++;
-// }
-// }
-// }
-// }
-//
-// if (numOfReady > 0) {
-// mDebug("stream:0x%" PRIx64
-// " %d tasks are ready, %d tasks in stream-scan-history for more than 50s, drop related fill-history
-// task", pTaskEntry->id.streamId, numOfReady, numOfTotal - numOfReady);
-// return true;
-// } else {
-// return false;
-// }
-// }
-// }
-//
-// return false;
-// }
-
-// currently only handle the sink task
-// 1. sink task, drop related fill-history task msg is missing
-// 2. other tasks are in ready state for at least 3 * hb_interval
-static int32_t mndDropRelatedFillhistoryTask(SMnode *pMnode, STaskStatusEntry *pTaskEntry, SStreamObj *pStream) {
- SStreamTask *pTask = mndGetStreamTask(&pTaskEntry->id, pStream);
- if (pTask == NULL) {
- mError("failed to get the stream task:0x%x, may have been dropped", (int32_t)pTaskEntry->id.taskId);
- return -1;
- }
-
- SVDropHTaskReq *pReq = rpcMallocCont(sizeof(SVDropHTaskReq));
- if (pReq == NULL) {
- mError("failed to malloc in drop related fill-history task, size:%" PRIzu ", code:%s", sizeof(SVDropHTaskReq),
- tstrerror(TSDB_CODE_OUT_OF_MEMORY));
- terrno = TSDB_CODE_OUT_OF_MEMORY;
- return -1;
- }
-
- pReq->head.vgId = htonl(pTask->info.nodeId);
- pReq->taskId = pTask->id.taskId;
- pReq->streamId = pTask->id.streamId;
-
- SRpcMsg msg = {.info.noResp = 1};
-
- initRpcMsg(&msg, TDMT_STREAM_HTASK_DROP, pReq, sizeof(SVDropHTaskReq));
-
- mDebug("build and send drop related fill-history task for task:0x%x", pTask->id.taskId);
-
- SEpSet epset = {0};
- bool hasEpset = false;
- int32_t code = extractNodeEpset(pMnode, &epset, &hasEpset, pTask->id.taskId, pTask->info.nodeId);
- if (code != TSDB_CODE_SUCCESS) {
- return code;
- }
-
- if (hasEpset) {
- tmsgSendReq(&epset, &msg);
- }
-
- return TSDB_CODE_SUCCESS;
-}
-
-int32_t setNodeEpsetExpiredFlag(const SArray *pNodeList) {
- int32_t num = taosArrayGetSize(pNodeList);
- mInfo("set node expired for %d nodes", num);
-
- for (int k = 0; k < num; ++k) {
- int32_t *pVgId = taosArrayGet(pNodeList, k);
- mInfo("set node expired for nodeId:%d, total:%d", *pVgId, num);
-
- int32_t numOfNodes = taosArrayGetSize(execInfo.pNodeList);
- for (int i = 0; i < numOfNodes; ++i) {
- SNodeEntry *pNodeEntry = taosArrayGet(execInfo.pNodeList, i);
-
- if (pNodeEntry->nodeId == *pVgId) {
- mInfo("vgId:%d expired for some stream tasks, needs update nodeEp", *pVgId);
- pNodeEntry->stageUpdated = true;
- break;
- }
- }
- }
-
- return TSDB_CODE_SUCCESS;
-}
-
-static void updateStageInfo(STaskStatusEntry *pTaskEntry, int64_t stage) {
- int32_t numOfNodes = taosArrayGetSize(execInfo.pNodeList);
- for (int32_t j = 0; j < numOfNodes; ++j) {
- SNodeEntry *pNodeEntry = taosArrayGet(execInfo.pNodeList, j);
- if (pNodeEntry->nodeId == pTaskEntry->nodeId) {
- mInfo("vgId:%d stage updated from %" PRId64 " to %" PRId64 ", nodeUpdate trigger by s-task:0x%" PRIx64,
- pTaskEntry->nodeId, pTaskEntry->stage, stage, pTaskEntry->id.taskId);
-
- pNodeEntry->stageUpdated = true;
- pTaskEntry->stage = stage;
- break;
- }
- }
-}
-
-int32_t mndProcessStreamHb(SRpcMsg *pReq) {
- SMnode *pMnode = pReq->info.node;
- SStreamHbMsg req = {0};
-
- bool checkpointFailed = false;
- int64_t checkpointId = 0;
- int64_t streamId = 0;
- int32_t transId = 0;
-
- SDecoder decoder = {0};
- tDecoderInit(&decoder, pReq->pCont, pReq->contLen);
-
- if (tDecodeStreamHbMsg(&decoder, &req) < 0) {
- streamMetaClearHbMsg(&req);
- tDecoderClear(&decoder);
- terrno = TSDB_CODE_INVALID_MSG;
- return -1;
- }
- tDecoderClear(&decoder);
-
- mTrace("receive stream-meta hb from vgId:%d, active numOfTasks:%d", req.vgId, req.numOfTasks);
-
- taosThreadMutexLock(&execInfo.lock);
-
- // extract stream task list
- int32_t numOfExisted = taosHashGetSize(execInfo.pTaskMap);
- if (numOfExisted == 0) {
- doExtractTasksFromStream(pMnode);
- }
-
- initStreamNodeList(pMnode);
-
- int32_t numOfUpdated = taosArrayGetSize(req.pUpdateNodes);
- if (numOfUpdated > 0) {
- mDebug("%d stream node(s) need updated from report of hbMsg(vgId:%d)", numOfUpdated, req.vgId);
- setNodeEpsetExpiredFlag(req.pUpdateNodes);
- }
-
- bool snodeChanged = false;
- for (int32_t i = 0; i < req.numOfTasks; ++i) {
- STaskStatusEntry *p = taosArrayGet(req.pTaskStatus, i);
-
- STaskStatusEntry *pTaskEntry = taosHashGet(execInfo.pTaskMap, &p->id, sizeof(p->id));
- if (pTaskEntry == NULL) {
- mError("s-task:0x%" PRIx64 " not found in mnode task list", p->id.taskId);
- continue;
- }
-
- if (pTaskEntry->stage != p->stage && pTaskEntry->stage != -1) {
- updateStageInfo(pTaskEntry, p->stage);
- if (pTaskEntry->nodeId == SNODE_HANDLE) {
- snodeChanged = true;
- }
- } else {
- // task is idle for more than 50 sec.
- if (fabs(pTaskEntry->inputQUsed - p->inputQUsed) <= DBL_EPSILON) {
- if (!pTaskEntry->inputQChanging) {
- pTaskEntry->inputQUnchangeCounter++;
- } else {
- pTaskEntry->inputQChanging = false;
- }
- } else {
- pTaskEntry->inputQChanging = true;
- pTaskEntry->inputQUnchangeCounter = 0;
- }
-
- streamTaskStatusCopy(pTaskEntry, p);
- if (p->checkpointId != 0) {
- if (checkpointId != 0) {
- ASSERT(checkpointId == p->checkpointId);
- } else {
- checkpointId = p->checkpointId;
- }
-
- if (p->checkpointFailed) {
- mError("stream task:0x%" PRIx64 " checkpointId:%" PRIx64 " transId:%d failed, kill it", p->id.taskId,
- p->checkpointId, p->chkpointTransId);
-
- checkpointFailed = p->checkpointFailed;
- streamId = p->id.streamId;
- transId = p->chkpointTransId;
- }
- }
- }
-
- if (p->status == pTaskEntry->status) {
- pTaskEntry->statusLastDuration++;
- } else {
- pTaskEntry->status = p->status;
- pTaskEntry->statusLastDuration = 0;
- }
-
- if (p->status != TASK_STATUS__READY) {
- mDebug("received s-task:0x%" PRIx64 " not in ready status:%s", p->id.taskId, streamTaskGetStatusStr(p->status));
- }
- }
-
- // current checkpoint is failed, rollback from the checkpoint trans
- // kill the checkpoint trans and then set all tasks status to be normal
- if (checkpointFailed && checkpointId != 0) {
- bool allReady = true;
- SArray *p = mndTakeVgroupSnapshot(pMnode, &allReady);
- taosArrayDestroy(p);
-
- if (allReady || snodeChanged) {
- // if the execInfo.activeCheckpoint == 0, the checkpoint is restoring from wal
- mInfo("checkpointId:%" PRId64 " failed, issue task-reset trans to reset all tasks status", checkpointId);
- mndResetStatusFromCheckpoint(pMnode, streamId, transId);
- } else {
- mInfo("not all vgroups are ready, wait for next HB from stream tasks to reset the task status");
- }
- }
-
- taosThreadMutexUnlock(&execInfo.lock);
- streamMetaClearHbMsg(&req);
-
- return TSDB_CODE_SUCCESS;
-}
-
void freeCheckpointCandEntry(void *param) {
SCheckpointCandEntry *pEntry = param;
taosMemoryFreeClear(pEntry->pName);
}
-SStreamObj *mndGetStreamObj(SMnode *pMnode, int64_t streamId) {
- void *pIter = NULL;
- SSdb *pSdb = pMnode->pSdb;
- SStreamObj *pStream = NULL;
+void freeTaskList(void* param) {
+ SArray** pList = (SArray **)param;
+ taosArrayDestroy(*pList);
+}
- while ((pIter = sdbFetch(pSdb, SDB_STREAM, pIter, (void **)&pStream)) != NULL) {
- if (pStream->uid == streamId) {
- sdbCancelFetch(pSdb, pIter);
- return pStream;
+static void doAddTaskId(SArray* pList, int32_t taskId, int64_t uid, int32_t numOfTotal) {
+ int32_t num = taosArrayGetSize(pList);
+ for(int32_t i = 0; i < num; ++i) {
+ int32_t* pId = taosArrayGet(pList, i);
+ if (taskId == *pId) {
+ return;
}
}
- return NULL;
+ taosArrayPush(pList, &taskId);
+
+ int32_t numOfTasks = taosArrayGetSize(pList);
+ mDebug("stream:0x%" PRIx64 " receive %d reqs for checkpoint, remain:%d", uid, numOfTasks, numOfTotal - numOfTasks);
}
+
+int32_t mndProcessStreamReqCheckpoint(SRpcMsg *pReq) {
+ SMnode *pMnode = pReq->info.node;
+ SStreamTaskCheckpointReq req = {0};
+
+ SDecoder decoder = {0};
+ tDecoderInit(&decoder, pReq->pCont, pReq->contLen);
+
+ if (tDecodeStreamTaskCheckpointReq(&decoder, &req)) {
+ tDecoderClear(&decoder);
+ terrno = TSDB_CODE_INVALID_MSG;
+ mError("invalid task checkpoint req msg received");
+ return -1;
+ }
+ tDecoderClear(&decoder);
+
+ mDebug("receive stream task checkpoint req msg, vgId:%d, s-task:0x%x", req.nodeId, req.taskId);
+
+ // register to the stream task done map, if all tasks has sent this kinds of message, start the checkpoint trans.
+ taosThreadMutexLock(&execInfo.lock);
+
+ SStreamObj *pStream = mndGetStreamObj(pMnode, req.streamId);
+ if (pStream == NULL) {
+ mError("failed to find the stream:0x%"PRIx64" not handle the checkpoint req", req.streamId);
+ terrno = TSDB_CODE_MND_STREAM_NOT_EXIST;
+ taosThreadMutexUnlock(&execInfo.lock);
+
+ return -1;
+ }
+
+ int32_t numOfTasks = mndGetNumOfStreamTasks(pStream);
+ SArray **pReqTaskList = (SArray**)taosHashGet(execInfo.pTransferStateStreams, &req.streamId, sizeof(req.streamId));
+ if (pReqTaskList == NULL) {
+ SArray *pList = taosArrayInit(4, sizeof(int32_t));
+ doAddTaskId(pList, req.taskId, pStream->uid, numOfTasks);
+ taosHashPut(execInfo.pTransferStateStreams, &req.streamId, sizeof(int64_t), &pList, sizeof(void *));
+
+ pReqTaskList = (SArray**)taosHashGet(execInfo.pTransferStateStreams, &req.streamId, sizeof(req.streamId));
+ } else {
+ doAddTaskId(*pReqTaskList, req.taskId, pStream->uid, numOfTasks);
+ }
+
+ int32_t total = taosArrayGetSize(*pReqTaskList);
+ if (total == numOfTasks) { // all tasks has send the reqs
+ int64_t checkpointId = mndStreamGenChkpId(pMnode);
+ mDebug("stream:0x%" PRIx64 " all tasks req, start checkpointId:%" PRId64, pStream->uid, checkpointId);
+
+ // TODO:handle error
+ int32_t code = mndProcessStreamCheckpointTrans(pMnode, pStream, checkpointId, 0, false);
+
+ // remove this entry
+ taosHashRemove(execInfo.pTransferStateStreams, &req.streamId, sizeof(int64_t));
+
+ int32_t numOfStreams = taosHashGetSize(execInfo.pTransferStateStreams);
+ mDebug("stream:0x%" PRIx64 " removed, remain streams:%d fill-history not completed", pStream->uid, numOfStreams);
+ }
+
+ mndReleaseStream(pMnode, pStream);
+ taosThreadMutexUnlock(&execInfo.lock);
+
+ return 0;
+}
\ No newline at end of file
diff --git a/source/dnode/mnode/impl/src/mndStreamHb.c b/source/dnode/mnode/impl/src/mndStreamHb.c
new file mode 100644
index 0000000000..4426ab0672
--- /dev/null
+++ b/source/dnode/mnode/impl/src/mndStreamHb.c
@@ -0,0 +1,349 @@
+/*
+ * Copyright (c) 2019 TAOS Data, Inc.
+ *
+ * This program is free software: you can use, redistribute, and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3
+ * or later ("AGPL"), as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+#include "mndStream.h"
+#include "mndTrans.h"
+
+typedef struct SFailedCheckpointInfo {
+ int64_t streamUid;
+ int64_t checkpointId;
+ int32_t transId;
+} SFailedCheckpointInfo;
+
+static void doExtractTasksFromStream(SMnode *pMnode) {
+ SSdb *pSdb = pMnode->pSdb;
+ SStreamObj *pStream = NULL;
+ void *pIter = NULL;
+
+ while (1) {
+ pIter = sdbFetch(pSdb, SDB_STREAM, pIter, (void **)&pStream);
+ if (pIter == NULL) {
+ break;
+ }
+
+ saveStreamTasksInfo(pStream, &execInfo);
+ sdbRelease(pSdb, pStream);
+ }
+}
+
+static void updateStageInfo(STaskStatusEntry *pTaskEntry, int64_t stage) {
+ int32_t numOfNodes = taosArrayGetSize(execInfo.pNodeList);
+ for (int32_t j = 0; j < numOfNodes; ++j) {
+ SNodeEntry *pNodeEntry = taosArrayGet(execInfo.pNodeList, j);
+ if (pNodeEntry->nodeId == pTaskEntry->nodeId) {
+ mInfo("vgId:%d stage updated from %" PRId64 " to %" PRId64 ", nodeUpdate trigger by s-task:0x%" PRIx64,
+ pTaskEntry->nodeId, pTaskEntry->stage, stage, pTaskEntry->id.taskId);
+
+ pNodeEntry->stageUpdated = true;
+ pTaskEntry->stage = stage;
+ break;
+ }
+ }
+}
+
+static void addIntoCheckpointList(SArray* pList, const SFailedCheckpointInfo* pInfo) {
+ int32_t num = taosArrayGetSize(pList);
+ for(int32_t i = 0; i < num; ++i) {
+ SFailedCheckpointInfo* p = taosArrayGet(pList, i);
+ if (p->transId == pInfo->transId) {
+ return;
+ }
+ }
+
+ taosArrayPush(pList, pInfo);
+}
+
+int32_t createStreamResetStatusTrans(SMnode *pMnode, SStreamObj *pStream) {
+ STrans *pTrans = doCreateTrans(pMnode, pStream, NULL, MND_STREAM_TASK_RESET_NAME, " reset from failed checkpoint");
+ if (pTrans == NULL) {
+ return terrno;
+ }
+
+ /*int32_t code = */mndStreamRegisterTrans(pTrans, MND_STREAM_TASK_RESET_NAME, pStream->uid);
+ int32_t code = mndStreamSetResetTaskAction(pMnode, pTrans, pStream);
+ if (code != 0) {
+ sdbRelease(pMnode->pSdb, pStream);
+ mndTransDrop(pTrans);
+ return code;
+ }
+
+ code = mndPersistTransLog(pStream, pTrans, SDB_STATUS_READY);
+ if (code != TSDB_CODE_SUCCESS) {
+ sdbRelease(pMnode->pSdb, pStream);
+ mndTransDrop(pTrans);
+ return -1;
+ }
+
+ if (mndTransPrepare(pMnode, pTrans) != 0) {
+ mError("trans:%d, failed to prepare update stream trans since %s", pTrans->id, terrstr());
+ sdbRelease(pMnode->pSdb, pStream);
+ mndTransDrop(pTrans);
+ return -1;
+ }
+
+ sdbRelease(pMnode->pSdb, pStream);
+ mndTransDrop(pTrans);
+
+ return TSDB_CODE_ACTION_IN_PROGRESS;
+}
+
+static int32_t mndResetStatusFromCheckpoint(SMnode *pMnode, int64_t streamId, int32_t transId) {
+ int32_t code = TSDB_CODE_SUCCESS;
+ mndKillTransImpl(pMnode, transId, "");
+
+ SStreamObj *pStream = mndGetStreamObj(pMnode, streamId);
+ if (pStream == NULL) {
+ code = TSDB_CODE_STREAM_TASK_NOT_EXIST;
+ mError("failed to acquire the streamObj:0x%" PRIx64 " to reset checkpoint, may have been dropped", pStream->uid);
+ } else {
+ bool conflict = mndStreamTransConflictCheck(pMnode, pStream->uid, MND_STREAM_TASK_RESET_NAME, false);
+ if (conflict) {
+ mError("stream:%s other trans exists in DB:%s, dstTable:%s failed to start reset-status trans", pStream->name,
+ pStream->sourceDb, pStream->targetSTbName);
+ } else {
+ mDebug("stream:%s (0x%" PRIx64 ") reset checkpoint procedure, transId:%d, create reset trans", pStream->name,
+ pStream->uid, transId);
+ code = createStreamResetStatusTrans(pMnode, pStream);
+ }
+ }
+
+ mndReleaseStream(pMnode, pStream);
+ return code;
+}
+
+static int32_t setNodeEpsetExpiredFlag(const SArray *pNodeList) {
+ int32_t num = taosArrayGetSize(pNodeList);
+ mInfo("set node expired for %d nodes", num);
+
+ for (int k = 0; k < num; ++k) {
+ int32_t *pVgId = taosArrayGet(pNodeList, k);
+ mInfo("set node expired for nodeId:%d, total:%d", *pVgId, num);
+
+ int32_t numOfNodes = taosArrayGetSize(execInfo.pNodeList);
+ for (int i = 0; i < numOfNodes; ++i) {
+ SNodeEntry *pNodeEntry = taosArrayGet(execInfo.pNodeList, i);
+
+ if (pNodeEntry->nodeId == *pVgId) {
+ mInfo("vgId:%d expired for some stream tasks, needs update nodeEp", *pVgId);
+ pNodeEntry->stageUpdated = true;
+ break;
+ }
+ }
+ }
+
+ return TSDB_CODE_SUCCESS;
+}
+
+static int32_t mndDropOrphanTasks(SMnode* pMnode, SArray* pList) {
+ SOrphanTask* pTask = taosArrayGet(pList, 0);
+
+ // check if it is conflict with other trans in both sourceDb and targetDb.
+ bool conflict = mndStreamTransConflictCheck(pMnode, pTask->streamId, MND_STREAM_DROP_NAME, false);
+ if (conflict) {
+ return -1;
+ }
+
+ SStreamObj dummyObj = {.uid = pTask->streamId, .sourceDb = "", .targetSTbName = ""};
+ STrans* pTrans = doCreateTrans(pMnode, &dummyObj, NULL, MND_STREAM_DROP_NAME, "drop stream");
+ if (pTrans == NULL) {
+ mError("failed to create trans to drop orphan tasks since %s", terrstr());
+ return -1;
+ }
+
+ int32_t code = mndStreamRegisterTrans(pTrans, MND_STREAM_DROP_NAME, pTask->streamId);
+
+ // drop all tasks
+ if (mndStreamSetDropActionFromList(pMnode, pTrans, pList) < 0) {
+ mError("failed to create trans to drop orphan tasks since %s", terrstr());
+ mndTransDrop(pTrans);
+ return -1;
+ }
+
+ // drop stream
+ if (mndPersistTransLog(&dummyObj, pTrans, SDB_STATUS_DROPPED) < 0) {
+ mndTransDrop(pTrans);
+ return -1;
+ }
+
+ if (mndTransPrepare(pMnode, pTrans) != 0) {
+ mError("trans:%d, failed to prepare drop stream trans since %s", pTrans->id, terrstr());
+ mndTransDrop(pTrans);
+ return -1;
+ }
+ mndTransDrop(pTrans);
+ return 0;
+}
+
+int32_t suspendAllStreams(SMnode *pMnode, SRpcHandleInfo* info){
+ SSdb *pSdb = pMnode->pSdb;
+ SStreamObj *pStream = NULL;
+ void* pIter = NULL;
+ while(1) {
+ pIter = sdbFetch(pSdb, SDB_STREAM, pIter, (void **)&pStream);
+ if (pIter == NULL) break;
+
+ if(pStream->status != STREAM_STATUS__PAUSE){
+ SMPauseStreamReq reqPause = {0};
+ strcpy(reqPause.name, pStream->name);
+ reqPause.igNotExists = 1;
+
+ int32_t contLen = tSerializeSMPauseStreamReq(NULL, 0, &reqPause);
+ void * pHead = rpcMallocCont(contLen);
+ tSerializeSMPauseStreamReq(pHead, contLen, &reqPause);
+
+ SRpcMsg rpcMsg = {
+ .msgType = TDMT_MND_PAUSE_STREAM,
+ .pCont = pHead,
+ .contLen = contLen,
+ .info = *info,
+ };
+
+ tmsgPutToQueue(&pMnode->msgCb, WRITE_QUEUE, &rpcMsg);
+ mInfo("receive pause stream:%s, %s, %p, because grant expired", pStream->name, reqPause.name, reqPause.name);
+ }
+
+ sdbRelease(pSdb, pStream);
+ }
+ return 0;
+}
+
+int32_t mndProcessStreamHb(SRpcMsg *pReq) {
+ SMnode *pMnode = pReq->info.node;
+ SStreamHbMsg req = {0};
+ SArray *pFailedTasks = taosArrayInit(4, sizeof(SFailedCheckpointInfo));
+ SArray *pOrphanTasks = taosArrayInit(3, sizeof(SOrphanTask));
+
+ if(grantCheck(TSDB_GRANT_STREAMS) < 0){
+ if(suspendAllStreams(pMnode, &pReq->info) < 0){
+ return -1;
+ }
+ }
+
+ SDecoder decoder = {0};
+ tDecoderInit(&decoder, pReq->pCont, pReq->contLen);
+
+ if (tDecodeStreamHbMsg(&decoder, &req) < 0) {
+ streamMetaClearHbMsg(&req);
+ tDecoderClear(&decoder);
+ terrno = TSDB_CODE_INVALID_MSG;
+ return -1;
+ }
+ tDecoderClear(&decoder);
+
+ mTrace("receive stream-meta hb from vgId:%d, active numOfTasks:%d", req.vgId, req.numOfTasks);
+
+ taosThreadMutexLock(&execInfo.lock);
+
+ // extract stream task list
+ if (taosHashGetSize(execInfo.pTaskMap) == 0) {
+ doExtractTasksFromStream(pMnode);
+ }
+
+ initStreamNodeList(pMnode);
+
+ int32_t numOfUpdated = taosArrayGetSize(req.pUpdateNodes);
+ if (numOfUpdated > 0) {
+ mDebug("%d stream node(s) need updated from report of hbMsg(vgId:%d)", numOfUpdated, req.vgId);
+ setNodeEpsetExpiredFlag(req.pUpdateNodes);
+ }
+
+ bool snodeChanged = false;
+ for (int32_t i = 0; i < req.numOfTasks; ++i) {
+ STaskStatusEntry *p = taosArrayGet(req.pTaskStatus, i);
+
+ STaskStatusEntry *pTaskEntry = taosHashGet(execInfo.pTaskMap, &p->id, sizeof(p->id));
+ if (pTaskEntry == NULL) {
+ mError("s-task:0x%" PRIx64 " not found in mnode task list", p->id.taskId);
+
+ SOrphanTask oTask = {.streamId = p->id.streamId, .taskId = p->id.taskId, .nodeId = p->nodeId};
+ taosArrayPush(pOrphanTasks, &oTask);
+ continue;
+ }
+
+ if (pTaskEntry->stage != p->stage && pTaskEntry->stage != -1) {
+ updateStageInfo(pTaskEntry, p->stage);
+ if (pTaskEntry->nodeId == SNODE_HANDLE) {
+ snodeChanged = true;
+ }
+ } else {
+ // task is idle for more than 50 sec.
+ if (fabs(pTaskEntry->inputQUsed - p->inputQUsed) <= DBL_EPSILON) {
+ if (!pTaskEntry->inputQChanging) {
+ pTaskEntry->inputQUnchangeCounter++;
+ } else {
+ pTaskEntry->inputQChanging = false;
+ }
+ } else {
+ pTaskEntry->inputQChanging = true;
+ pTaskEntry->inputQUnchangeCounter = 0;
+ }
+
+ streamTaskStatusCopy(pTaskEntry, p);
+ if ((p->checkpointId != 0) && p->checkpointFailed) {
+ mError("stream task:0x%" PRIx64 " checkpointId:%" PRIx64 " transId:%d failed, kill it", p->id.taskId,
+ p->checkpointId, p->chkpointTransId);
+
+ SFailedCheckpointInfo info = {
+ .transId = p->chkpointTransId, .checkpointId = p->checkpointId, .streamUid = p->id.streamId};
+ addIntoCheckpointList(pFailedTasks, &info);
+ }
+ }
+
+ if (p->status == pTaskEntry->status) {
+ pTaskEntry->statusLastDuration++;
+ } else {
+ pTaskEntry->status = p->status;
+ pTaskEntry->statusLastDuration = 0;
+ }
+
+ if (p->status != TASK_STATUS__READY) {
+ mDebug("received s-task:0x%" PRIx64 " not in ready status:%s", p->id.taskId, streamTaskGetStatusStr(p->status));
+ }
+ }
+
+ // current checkpoint is failed, rollback from the checkpoint trans
+ // kill the checkpoint trans and then set all tasks status to be normal
+ if (taosArrayGetSize(pFailedTasks) > 0) {
+ bool allReady = true;
+ SArray *p = mndTakeVgroupSnapshot(pMnode, &allReady);
+ taosArrayDestroy(p);
+
+ if (allReady || snodeChanged) {
+ // if the execInfo.activeCheckpoint == 0, the checkpoint is restoring from wal
+ for(int32_t i = 0; i < taosArrayGetSize(pFailedTasks); ++i) {
+ SFailedCheckpointInfo *pInfo = taosArrayGet(pFailedTasks, i);
+ mInfo("checkpointId:%" PRId64 " transId:%d failed, issue task-reset trans to reset all tasks status",
+ pInfo->checkpointId, pInfo->transId);
+
+ mndResetStatusFromCheckpoint(pMnode, pInfo->streamUid, pInfo->transId);
+ }
+ } else {
+ mInfo("not all vgroups are ready, wait for next HB from stream tasks to reset the task status");
+ }
+ }
+
+ // handle the orphan tasks that are invalid but not removed in some vnodes or snode due to some unknown errors.
+ if (taosArrayGetSize(pOrphanTasks) > 0) {
+ mndDropOrphanTasks(pMnode, pOrphanTasks);
+ }
+
+ taosThreadMutexUnlock(&execInfo.lock);
+ streamMetaClearHbMsg(&req);
+
+ taosArrayDestroy(pFailedTasks);
+ taosArrayDestroy(pOrphanTasks);
+
+ return TSDB_CODE_SUCCESS;
+}
diff --git a/source/dnode/mnode/impl/src/mndStreamTrans.c b/source/dnode/mnode/impl/src/mndStreamTrans.c
index a6dd1c4856..5bfd3933b5 100644
--- a/source/dnode/mnode/impl/src/mndStreamTrans.c
+++ b/source/dnode/mnode/impl/src/mndStreamTrans.c
@@ -23,10 +23,10 @@ typedef struct SKeyInfo {
static int32_t clearFinishedTrans(SMnode* pMnode);
-int32_t mndStreamRegisterTrans(STrans* pTrans, const char* pTransName, int64_t streamUid) {
+int32_t mndStreamRegisterTrans(STrans* pTrans, const char* pTransName, int64_t streamId) {
SStreamTransInfo info = {
- .transId = pTrans->id, .startTime = taosGetTimestampMs(), .name = pTransName, .streamUid = streamUid};
- taosHashPut(execInfo.transMgmt.pDBTrans, &streamUid, sizeof(streamUid), &info, sizeof(SStreamTransInfo));
+ .transId = pTrans->id, .startTime = taosGetTimestampMs(), .name = pTransName, .streamId = streamId};
+ taosHashPut(execInfo.transMgmt.pDBTrans, &streamId, sizeof(streamId), &info, sizeof(SStreamTransInfo));
return 0;
}
@@ -65,7 +65,7 @@ int32_t clearFinishedTrans(SMnode* pMnode) {
return 0;
}
-bool mndStreamTransConflictCheck(SMnode* pMnode, int64_t streamUid, const char* pTransName, bool lock) {
+bool mndStreamTransConflictCheck(SMnode* pMnode, int64_t streamId, const char* pTransName, bool lock) {
if (lock) {
taosThreadMutexLock(&execInfo.lock);
}
@@ -80,7 +80,7 @@ bool mndStreamTransConflictCheck(SMnode* pMnode, int64_t streamUid, const char*
clearFinishedTrans(pMnode);
- SStreamTransInfo *pEntry = taosHashGet(execInfo.transMgmt.pDBTrans, &streamUid, sizeof(streamUid));
+ SStreamTransInfo *pEntry = taosHashGet(execInfo.transMgmt.pDBTrans, &streamId, sizeof(streamId));
if (pEntry != NULL) {
SStreamTransInfo tInfo = *pEntry;
@@ -90,7 +90,7 @@ bool mndStreamTransConflictCheck(SMnode* pMnode, int64_t streamUid, const char*
if (strcmp(tInfo.name, MND_STREAM_CHECKPOINT_NAME) == 0) {
if ((strcmp(pTransName, MND_STREAM_DROP_NAME) != 0) && (strcmp(pTransName, MND_STREAM_TASK_RESET_NAME) != 0)) {
- mWarn("conflict with other transId:%d streamUid:0x%" PRIx64 ", trans:%s", tInfo.transId, tInfo.streamUid,
+ mWarn("conflict with other transId:%d streamUid:0x%" PRIx64 ", trans:%s", tInfo.transId, tInfo.streamId,
tInfo.name);
terrno = TSDB_CODE_MND_TRANS_CONFLICT;
return true;
@@ -99,13 +99,13 @@ bool mndStreamTransConflictCheck(SMnode* pMnode, int64_t streamUid, const char*
}
} else if ((strcmp(tInfo.name, MND_STREAM_CREATE_NAME) == 0) || (strcmp(tInfo.name, MND_STREAM_DROP_NAME) == 0) ||
(strcmp(tInfo.name, MND_STREAM_TASK_RESET_NAME) == 0)) {
- mWarn("conflict with other transId:%d streamUid:0x%" PRIx64 ", trans:%s", tInfo.transId, tInfo.streamUid,
+ mWarn("conflict with other transId:%d streamUid:0x%" PRIx64 ", trans:%s", tInfo.transId, tInfo.streamId,
tInfo.name);
terrno = TSDB_CODE_MND_TRANS_CONFLICT;
return true;
}
} else {
- mDebug("stream:0x%"PRIx64" no conflict trans existed, continue create trans", streamUid);
+ mDebug("stream:0x%"PRIx64" no conflict trans existed, continue create trans", streamId);
}
if (lock) {
@@ -160,3 +160,145 @@ int32_t mndAddtoCheckpointWaitingList(SStreamObj* pStream, int64_t checkpointId)
return TSDB_CODE_SUCCESS;
}
+
+STrans *doCreateTrans(SMnode *pMnode, SStreamObj *pStream, SRpcMsg *pReq, const char *name, const char *pMsg) {
+ STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_NOTHING, pReq, name);
+ if (pTrans == NULL) {
+ mError("failed to build trans:%s, reason: %s", name, tstrerror(TSDB_CODE_OUT_OF_MEMORY));
+ terrno = TSDB_CODE_OUT_OF_MEMORY;
+ return NULL;
+ }
+
+ mInfo("s-task:0x%" PRIx64 " start to build trans %s, transId:%d", pStream->uid, pMsg, pTrans->id);
+
+ mndTransSetDbName(pTrans, pStream->sourceDb, pStream->targetSTbName);
+ if (mndTransCheckConflict(pMnode, pTrans) != 0) {
+ terrno = TSDB_CODE_MND_TRANS_CONFLICT;
+ mError("failed to build trans:%s for stream:0x%" PRIx64 " code:%s", name, pStream->uid, tstrerror(terrno));
+ mndTransDrop(pTrans);
+ return NULL;
+ }
+
+ terrno = 0;
+ return pTrans;
+}
+
+SSdbRaw *mndStreamActionEncode(SStreamObj *pStream) {
+ terrno = TSDB_CODE_OUT_OF_MEMORY;
+ void *buf = NULL;
+
+ SEncoder encoder;
+ tEncoderInit(&encoder, NULL, 0);
+ if (tEncodeSStreamObj(&encoder, pStream) < 0) {
+ tEncoderClear(&encoder);
+ goto STREAM_ENCODE_OVER;
+ }
+ int32_t tlen = encoder.pos;
+ tEncoderClear(&encoder);
+
+ int32_t size = sizeof(int32_t) + tlen + MND_STREAM_RESERVE_SIZE;
+ SSdbRaw *pRaw = sdbAllocRaw(SDB_STREAM, MND_STREAM_VER_NUMBER, size);
+ if (pRaw == NULL) goto STREAM_ENCODE_OVER;
+
+ buf = taosMemoryMalloc(tlen);
+ if (buf == NULL) goto STREAM_ENCODE_OVER;
+
+ tEncoderInit(&encoder, buf, tlen);
+ if (tEncodeSStreamObj(&encoder, pStream) < 0) {
+ tEncoderClear(&encoder);
+ goto STREAM_ENCODE_OVER;
+ }
+ tEncoderClear(&encoder);
+
+ int32_t dataPos = 0;
+ SDB_SET_INT32(pRaw, dataPos, tlen, STREAM_ENCODE_OVER);
+ SDB_SET_BINARY(pRaw, dataPos, buf, tlen, STREAM_ENCODE_OVER);
+ SDB_SET_DATALEN(pRaw, dataPos, STREAM_ENCODE_OVER);
+
+ terrno = TSDB_CODE_SUCCESS;
+
+ STREAM_ENCODE_OVER:
+ taosMemoryFreeClear(buf);
+ if (terrno != TSDB_CODE_SUCCESS) {
+ mError("stream:%s, failed to encode to raw:%p since %s", pStream->name, pRaw, terrstr());
+ sdbFreeRaw(pRaw);
+ return NULL;
+ }
+
+ mTrace("stream:%s, encode to raw:%p, row:%p, checkpoint:%" PRId64 "", pStream->name, pRaw, pStream,
+ pStream->checkpointId);
+ return pRaw;
+}
+
+int32_t mndPersistTransLog(SStreamObj *pStream, STrans *pTrans, int32_t status) {
+ SSdbRaw *pCommitRaw = mndStreamActionEncode(pStream);
+ if (pCommitRaw == NULL) {
+ mError("failed to encode stream since %s", terrstr());
+ mndTransDrop(pTrans);
+ return -1;
+ }
+
+ if (mndTransAppendCommitlog(pTrans, pCommitRaw) != 0) {
+ mError("stream trans:%d, failed to append commit log since %s", pTrans->id, terrstr());
+ sdbFreeRaw(pCommitRaw);
+ mndTransDrop(pTrans);
+ return -1;
+ }
+
+ if (sdbSetRawStatus(pCommitRaw, status) != 0) {
+ mError("stream trans:%d failed to set raw status:%d since %s", pTrans->id, status, terrstr());
+ sdbFreeRaw(pCommitRaw);
+ mndTransDrop(pTrans);
+ return -1;
+ }
+
+ return 0;
+}
+
+int32_t setTransAction(STrans *pTrans, void *pCont, int32_t contLen, int32_t msgType, const SEpSet *pEpset,
+ int32_t retryCode) {
+ STransAction action = {.epSet = *pEpset, .contLen = contLen, .pCont = pCont, .msgType = msgType, .retryCode = retryCode};
+ return mndTransAppendRedoAction(pTrans, &action);
+}
+
+int32_t doKillCheckpointTrans(SMnode *pMnode, const char *pDBName, size_t len) {
+ // data in the hash table will be removed automatically, no need to remove it here.
+ SStreamTransInfo *pTransInfo = taosHashGet(execInfo.transMgmt.pDBTrans, pDBName, len);
+ if (pTransInfo == NULL) {
+ return TSDB_CODE_SUCCESS;
+ }
+
+ // not checkpoint trans, ignore
+ if (strcmp(pTransInfo->name, MND_STREAM_CHECKPOINT_NAME) != 0) {
+ mDebug("not checkpoint trans, not kill it, name:%s, transId:%d", pTransInfo->name, pTransInfo->transId);
+ return TSDB_CODE_SUCCESS;
+ }
+
+ char *pDupDBName = strndup(pDBName, len);
+ mndKillTransImpl(pMnode, pTransInfo->transId, pDupDBName);
+ taosMemoryFree(pDupDBName);
+
+ return TSDB_CODE_SUCCESS;
+}
+
+// kill all trans in the dst DB
+void killAllCheckpointTrans(SMnode *pMnode, SVgroupChangeInfo *pChangeInfo) {
+ mDebug("start to clear checkpoints in all Dbs");
+
+ void *pIter = NULL;
+ while ((pIter = taosHashIterate(pChangeInfo->pDBMap, pIter)) != NULL) {
+ char *pDb = (char *)pIter;
+
+ size_t len = 0;
+ void *pKey = taosHashGetKey(pDb, &len);
+ char *p = strndup(pKey, len);
+
+ mDebug("clear checkpoint trans in Db:%s", p);
+ doKillCheckpointTrans(pMnode, pKey, len);
+ taosMemoryFree(p);
+ }
+
+ mDebug("complete clear checkpoints in Dbs");
+}
+
+
diff --git a/source/dnode/mnode/impl/src/mndStreamUtil.c b/source/dnode/mnode/impl/src/mndStreamUtil.c
new file mode 100644
index 0000000000..235c604b27
--- /dev/null
+++ b/source/dnode/mnode/impl/src/mndStreamUtil.c
@@ -0,0 +1,545 @@
+/*
+ * Copyright (c) 2019 TAOS Data, Inc.
+ *
+ * This program is free software: you can use, redistribute, and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3
+ * or later ("AGPL"), as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+#include "mndStream.h"
+#include "mndTrans.h"
+#include "tmisce.h"
+#include "mndVgroup.h"
+
+struct SStreamTaskIter {
+ SStreamObj *pStream;
+ int32_t level;
+ int32_t ordinalIndex;
+ int32_t totalLevel;
+ SStreamTask *pTask;
+};
+
+SStreamTaskIter* createStreamTaskIter(SStreamObj* pStream) {
+ SStreamTaskIter* pIter = taosMemoryCalloc(1, sizeof(SStreamTaskIter));
+ if (pIter == NULL) {
+ terrno = TSDB_CODE_OUT_OF_MEMORY;
+ return NULL;
+ }
+
+ pIter->level = -1;
+ pIter->ordinalIndex = 0;
+ pIter->pStream = pStream;
+ pIter->totalLevel = taosArrayGetSize(pStream->tasks);
+ pIter->pTask = NULL;
+
+ return pIter;
+}
+
+bool streamTaskIterNextTask(SStreamTaskIter* pIter) {
+ if (pIter->level >= pIter->totalLevel) {
+ pIter->pTask = NULL;
+ return false;
+ }
+
+ if (pIter->level == -1) {
+ pIter->level += 1;
+ }
+
+ while(pIter->level < pIter->totalLevel) {
+ SArray *pList = taosArrayGetP(pIter->pStream->tasks, pIter->level);
+ if (pIter->ordinalIndex >= taosArrayGetSize(pList)) {
+ pIter->level += 1;
+ pIter->ordinalIndex = 0;
+ pIter->pTask = NULL;
+ continue;
+ }
+
+ pIter->pTask = taosArrayGetP(pList, pIter->ordinalIndex);
+ pIter->ordinalIndex += 1;
+ return true;
+ }
+
+ pIter->pTask = NULL;
+ return false;
+}
+
+SStreamTask* streamTaskIterGetCurrent(SStreamTaskIter* pIter) {
+ return pIter->pTask;
+}
+
+void destroyStreamTaskIter(SStreamTaskIter* pIter) {
+ taosMemoryFree(pIter);
+}
+
+SArray *mndTakeVgroupSnapshot(SMnode *pMnode, bool *allReady) {
+ SSdb *pSdb = pMnode->pSdb;
+ void *pIter = NULL;
+ SVgObj *pVgroup = NULL;
+
+ *allReady = true;
+ SArray *pVgroupListSnapshot = taosArrayInit(4, sizeof(SNodeEntry));
+
+ while (1) {
+ pIter = sdbFetch(pSdb, SDB_VGROUP, pIter, (void **)&pVgroup);
+ if (pIter == NULL) {
+ break;
+ }
+
+ SNodeEntry entry = {.nodeId = pVgroup->vgId, .hbTimestamp = pVgroup->updateTime};
+ entry.epset = mndGetVgroupEpset(pMnode, pVgroup);
+
+ // if not all ready till now, no need to check the remaining vgroups.
+ if (*allReady) {
+ for (int32_t i = 0; i < pVgroup->replica; ++i) {
+ if (!pVgroup->vnodeGid[i].syncRestore) {
+ mInfo("vgId:%d not restored, not ready for checkpoint or other operations", pVgroup->vgId);
+ *allReady = false;
+ break;
+ }
+
+ ESyncState state = pVgroup->vnodeGid[i].syncState;
+ if (state == TAOS_SYNC_STATE_OFFLINE || state == TAOS_SYNC_STATE_ERROR) {
+ mInfo("vgId:%d offline/err, not ready for checkpoint or other operations", pVgroup->vgId);
+ *allReady = false;
+ break;
+ }
+ }
+ }
+
+ char buf[256] = {0};
+ EPSET_TO_STR(&entry.epset, buf);
+ mDebug("take node snapshot, nodeId:%d %s", entry.nodeId, buf);
+ taosArrayPush(pVgroupListSnapshot, &entry);
+ sdbRelease(pSdb, pVgroup);
+ }
+
+ SSnodeObj *pObj = NULL;
+ while (1) {
+ pIter = sdbFetch(pSdb, SDB_SNODE, pIter, (void **)&pObj);
+ if (pIter == NULL) {
+ break;
+ }
+
+ SNodeEntry entry = {0};
+ addEpIntoEpSet(&entry.epset, pObj->pDnode->fqdn, pObj->pDnode->port);
+ entry.nodeId = SNODE_HANDLE;
+
+ char buf[256] = {0};
+ EPSET_TO_STR(&entry.epset, buf);
+ mDebug("take snode snapshot, nodeId:%d %s", entry.nodeId, buf);
+ taosArrayPush(pVgroupListSnapshot, &entry);
+ sdbRelease(pSdb, pObj);
+ }
+
+ return pVgroupListSnapshot;
+}
+
+SStreamObj *mndGetStreamObj(SMnode *pMnode, int64_t streamId) {
+ void *pIter = NULL;
+ SSdb *pSdb = pMnode->pSdb;
+ SStreamObj *pStream = NULL;
+
+ while ((pIter = sdbFetch(pSdb, SDB_STREAM, pIter, (void **)&pStream)) != NULL) {
+ if (pStream->uid == streamId) {
+ sdbCancelFetch(pSdb, pIter);
+ return pStream;
+ }
+ sdbRelease(pSdb, pStream);
+ }
+
+ return NULL;
+}
+
+void mndKillTransImpl(SMnode *pMnode, int32_t transId, const char *pDbName) {
+ STrans *pTrans = mndAcquireTrans(pMnode, transId);
+ if (pTrans != NULL) {
+ mInfo("kill active transId:%d in Db:%s", transId, pDbName);
+ mndKillTrans(pMnode, pTrans);
+ mndReleaseTrans(pMnode, pTrans);
+ } else {
+ mError("failed to acquire trans in Db:%s, transId:%d", pDbName, transId);
+ }
+}
+
+int32_t extractNodeEpset(SMnode *pMnode, SEpSet *pEpSet, bool *hasEpset, int32_t taskId, int32_t nodeId) {
+ *hasEpset = false;
+
+ pEpSet->numOfEps = 0;
+ if (nodeId == SNODE_HANDLE) {
+ SSnodeObj *pObj = NULL;
+ void *pIter = NULL;
+
+ pIter = sdbFetch(pMnode->pSdb, SDB_SNODE, pIter, (void **)&pObj);
+ if (pIter != NULL) {
+ addEpIntoEpSet(pEpSet, pObj->pDnode->fqdn, pObj->pDnode->port);
+ sdbRelease(pMnode->pSdb, pObj);
+ sdbCancelFetch(pMnode->pSdb, pIter);
+ *hasEpset = true;
+ return TSDB_CODE_SUCCESS;
+ } else {
+ mError("failed to acquire snode epset");
+ return TSDB_CODE_INVALID_PARA;
+ }
+ } else {
+ SVgObj *pVgObj = mndAcquireVgroup(pMnode, nodeId);
+ if (pVgObj != NULL) {
+ SEpSet epset = mndGetVgroupEpset(pMnode, pVgObj);
+ mndReleaseVgroup(pMnode, pVgObj);
+
+ epsetAssign(pEpSet, &epset);
+ *hasEpset = true;
+ return TSDB_CODE_SUCCESS;
+ } else {
+ mDebug("orphaned task:0x%x need to be dropped, nodeId:%d, no redo action", taskId, nodeId);
+ return TSDB_CODE_SUCCESS;
+ }
+ }
+}
+
+static int32_t doSetResumeAction(STrans *pTrans, SMnode *pMnode, SStreamTask *pTask, int8_t igUntreated) {
+ SVResumeStreamTaskReq *pReq = taosMemoryCalloc(1, sizeof(SVResumeStreamTaskReq));
+ if (pReq == NULL) {
+ mError("failed to malloc in resume stream, size:%" PRIzu ", code:%s", sizeof(SVResumeStreamTaskReq),
+ tstrerror(TSDB_CODE_OUT_OF_MEMORY));
+ terrno = TSDB_CODE_OUT_OF_MEMORY;
+ return -1;
+ }
+
+ pReq->head.vgId = htonl(pTask->info.nodeId);
+ pReq->taskId = pTask->id.taskId;
+ pReq->streamId = pTask->id.streamId;
+ pReq->igUntreated = igUntreated;
+
+ SEpSet epset = {0};
+ bool hasEpset = false;
+ int32_t code = extractNodeEpset(pMnode, &epset, &hasEpset, pTask->id.taskId, pTask->info.nodeId);
+ if (code != TSDB_CODE_SUCCESS || (!hasEpset)) {
+ terrno = code;
+ taosMemoryFree(pReq);
+ return -1;
+ }
+
+ code = setTransAction(pTrans, pReq, sizeof(SVResumeStreamTaskReq), TDMT_STREAM_TASK_RESUME, &epset, 0);
+ if (code != 0) {
+ taosMemoryFree(pReq);
+ return -1;
+ }
+ return 0;
+}
+
+SStreamTask *mndGetStreamTask(STaskId *pId, SStreamObj *pStream) {
+ SStreamTaskIter *pIter = createStreamTaskIter(pStream);
+ while (streamTaskIterNextTask(pIter)) {
+ SStreamTask *pTask = streamTaskIterGetCurrent(pIter);
+ if (pTask->id.taskId == pId->taskId) {
+ destroyStreamTaskIter(pIter);
+ return pTask;
+ }
+ }
+
+ destroyStreamTaskIter(pIter);
+ return NULL;
+}
+
+int32_t mndGetNumOfStreamTasks(const SStreamObj *pStream) {
+ int32_t num = 0;
+ for(int32_t i = 0; i < taosArrayGetSize(pStream->tasks); ++i) {
+ SArray* pLevel = taosArrayGetP(pStream->tasks, i);
+ num += taosArrayGetSize(pLevel);
+ }
+
+ return num;
+}
+
+int32_t mndStreamSetResumeAction(STrans *pTrans, SMnode *pMnode, SStreamObj *pStream, int8_t igUntreated) {
+ SStreamTaskIter *pIter = createStreamTaskIter(pStream);
+
+ while (streamTaskIterNextTask(pIter)) {
+ SStreamTask *pTask = streamTaskIterGetCurrent(pIter);
+ if (doSetResumeAction(pTrans, pMnode, pTask, igUntreated) < 0) {
+ destroyStreamTaskIter(pIter);
+ return -1;
+ }
+
+ if (atomic_load_8(&pTask->status.taskStatus) == TASK_STATUS__PAUSE) {
+ atomic_store_8(&pTask->status.taskStatus, pTask->status.statusBackup);
+ }
+ }
+ destroyStreamTaskIter(pIter);
+ return 0;
+}
+
+static int32_t doSetPauseAction(SMnode *pMnode, STrans *pTrans, SStreamTask *pTask) {
+ SVPauseStreamTaskReq *pReq = taosMemoryCalloc(1, sizeof(SVPauseStreamTaskReq));
+ if (pReq == NULL) {
+ mError("failed to malloc in pause stream, size:%" PRIzu ", code:%s", sizeof(SVPauseStreamTaskReq),
+ tstrerror(TSDB_CODE_OUT_OF_MEMORY));
+ terrno = TSDB_CODE_OUT_OF_MEMORY;
+ return -1;
+ }
+
+ pReq->head.vgId = htonl(pTask->info.nodeId);
+ pReq->taskId = pTask->id.taskId;
+ pReq->streamId = pTask->id.streamId;
+
+ SEpSet epset = {0};
+ bool hasEpset = false;
+ int32_t code = extractNodeEpset(pMnode, &epset, &hasEpset, pTask->id.taskId, pTask->info.nodeId);
+ if (code != TSDB_CODE_SUCCESS || !hasEpset) {
+ terrno = code;
+ taosMemoryFree(pReq);
+ return code;
+ }
+
+ mDebug("pause node:%d, epset:%d", pTask->info.nodeId, epset.numOfEps);
+ code = setTransAction(pTrans, pReq, sizeof(SVPauseStreamTaskReq), TDMT_STREAM_TASK_PAUSE, &epset, 0);
+ if (code != 0) {
+ taosMemoryFree(pReq);
+ return -1;
+ }
+ return 0;
+}
+
+int32_t mndStreamSetPauseAction(SMnode *pMnode, STrans *pTrans, SStreamObj *pStream) {
+ SStreamTaskIter *pIter = createStreamTaskIter(pStream);
+
+ while (streamTaskIterNextTask(pIter)) {
+ SStreamTask *pTask = streamTaskIterGetCurrent(pIter);
+ if (doSetPauseAction(pMnode, pTrans, pTask) < 0) {
+ destroyStreamTaskIter(pIter);
+ return -1;
+ }
+
+ if (atomic_load_8(&pTask->status.taskStatus) != TASK_STATUS__PAUSE) {
+ atomic_store_8(&pTask->status.statusBackup, pTask->status.taskStatus);
+ atomic_store_8(&pTask->status.taskStatus, TASK_STATUS__PAUSE);
+ }
+ }
+
+ destroyStreamTaskIter(pIter);
+ return 0;
+}
+
+static int32_t doSetDropAction(SMnode *pMnode, STrans *pTrans, SStreamTask *pTask) {
+ SVDropStreamTaskReq *pReq = taosMemoryCalloc(1, sizeof(SVDropStreamTaskReq));
+ if (pReq == NULL) {
+ terrno = TSDB_CODE_OUT_OF_MEMORY;
+ return -1;
+ }
+
+ pReq->head.vgId = htonl(pTask->info.nodeId);
+ pReq->taskId = pTask->id.taskId;
+ pReq->streamId = pTask->id.streamId;
+
+ SEpSet epset = {0};
+ bool hasEpset = false;
+ int32_t code = extractNodeEpset(pMnode, &epset, &hasEpset, pTask->id.taskId, pTask->info.nodeId);
+ if (code != TSDB_CODE_SUCCESS || !hasEpset) { // no valid epset, return directly without redoAction
+ terrno = code;
+ return -1;
+ }
+
+ // The epset of nodeId of this task may have been expired now, let's use the newest epset from mnode.
+ code = setTransAction(pTrans, pReq, sizeof(SVDropStreamTaskReq), TDMT_STREAM_TASK_DROP, &epset, 0);
+ if (code != 0) {
+ taosMemoryFree(pReq);
+ return -1;
+ }
+
+ return 0;
+}
+
+int32_t mndStreamSetDropAction(SMnode *pMnode, STrans *pTrans, SStreamObj *pStream) {
+ SStreamTaskIter *pIter = createStreamTaskIter(pStream);
+
+ while(streamTaskIterNextTask(pIter)) {
+ SStreamTask *pTask = streamTaskIterGetCurrent(pIter);
+ if (doSetDropAction(pMnode, pTrans, pTask) < 0) {
+ destroyStreamTaskIter(pIter);
+ return -1;
+ }
+ }
+ destroyStreamTaskIter(pIter);
+ return 0;
+}
+
+static int32_t doSetDropActionFromId(SMnode *pMnode, STrans *pTrans, SOrphanTask* pTask) {
+ SVDropStreamTaskReq *pReq = taosMemoryCalloc(1, sizeof(SVDropStreamTaskReq));
+ if (pReq == NULL) {
+ terrno = TSDB_CODE_OUT_OF_MEMORY;
+ return -1;
+ }
+
+ pReq->head.vgId = htonl(pTask->nodeId);
+ pReq->taskId = pTask->taskId;
+ pReq->streamId = pTask->streamId;
+
+ SEpSet epset = {0};
+ bool hasEpset = false;
+ int32_t code = extractNodeEpset(pMnode, &epset, &hasEpset, pTask->taskId, pTask->nodeId);
+ if (code != TSDB_CODE_SUCCESS || (!hasEpset)) { // no valid epset, return directly without redoAction
+ terrno = code;
+ taosMemoryFree(pReq);
+ return -1;
+ }
+
+ // The epset of nodeId of this task may have been expired now, let's use the newest epset from mnode.
+ code = setTransAction(pTrans, pReq, sizeof(SVDropStreamTaskReq), TDMT_STREAM_TASK_DROP, &epset, 0);
+ if (code != 0) {
+ taosMemoryFree(pReq);
+ return -1;
+ }
+
+ return 0;
+}
+
+int32_t mndStreamSetDropActionFromList(SMnode *pMnode, STrans *pTrans, SArray* pList) {
+ for(int32_t i = 0; i < taosArrayGetSize(pList); ++i) {
+ SOrphanTask* pTask = taosArrayGet(pList, i);
+ mDebug("add drop task:0x%x action to drop orphan task", pTask->taskId);
+ doSetDropActionFromId(pMnode, pTrans, pTask);
+ }
+ return 0;
+}
+
+static void initNodeUpdateMsg(SStreamTaskNodeUpdateMsg *pMsg, const SVgroupChangeInfo *pInfo, SStreamTaskId *pId,
+ int32_t transId) {
+ pMsg->streamId = pId->streamId;
+ pMsg->taskId = pId->taskId;
+ pMsg->transId = transId;
+ pMsg->pNodeList = taosArrayInit(taosArrayGetSize(pInfo->pUpdateNodeList), sizeof(SNodeUpdateInfo));
+ taosArrayAddAll(pMsg->pNodeList, pInfo->pUpdateNodeList);
+}
+
+static int32_t doBuildStreamTaskUpdateMsg(void **pBuf, int32_t *pLen, SVgroupChangeInfo *pInfo, int32_t nodeId,
+ SStreamTaskId *pId, int32_t transId) {
+ SStreamTaskNodeUpdateMsg req = {0};
+ initNodeUpdateMsg(&req, pInfo, pId, transId);
+
+ int32_t code = 0;
+ int32_t blen;
+
+ tEncodeSize(tEncodeStreamTaskUpdateMsg, &req, blen, code);
+ if (code < 0) {
+ terrno = TSDB_CODE_OUT_OF_MEMORY;
+ taosArrayDestroy(req.pNodeList);
+ return -1;
+ }
+
+ int32_t tlen = sizeof(SMsgHead) + blen;
+
+ void *buf = taosMemoryMalloc(tlen);
+ if (buf == NULL) {
+ terrno = TSDB_CODE_OUT_OF_MEMORY;
+ taosArrayDestroy(req.pNodeList);
+ return -1;
+ }
+
+ void *abuf = POINTER_SHIFT(buf, sizeof(SMsgHead));
+ SEncoder encoder;
+ tEncoderInit(&encoder, abuf, tlen);
+ tEncodeStreamTaskUpdateMsg(&encoder, &req);
+
+ SMsgHead *pMsgHead = (SMsgHead *)buf;
+ pMsgHead->contLen = htonl(tlen);
+ pMsgHead->vgId = htonl(nodeId);
+
+ tEncoderClear(&encoder);
+
+ *pBuf = buf;
+ *pLen = tlen;
+
+ taosArrayDestroy(req.pNodeList);
+ return TSDB_CODE_SUCCESS;
+}
+
+static int32_t doSetUpdateTaskAction(STrans *pTrans, SStreamTask *pTask, SVgroupChangeInfo *pInfo) {
+ void *pBuf = NULL;
+ int32_t len = 0;
+ streamTaskUpdateEpsetInfo(pTask, pInfo->pUpdateNodeList);
+
+ doBuildStreamTaskUpdateMsg(&pBuf, &len, pInfo, pTask->info.nodeId, &pTask->id, pTrans->id);
+
+ int32_t code = setTransAction(pTrans, pBuf, len, TDMT_VND_STREAM_TASK_UPDATE, &pTask->info.epSet, 0);
+ if (code != TSDB_CODE_SUCCESS) {
+ taosMemoryFree(pBuf);
+ }
+
+ return code;
+}
+
+// build trans to update the epset
+int32_t mndStreamSetUpdateEpsetAction(SStreamObj *pStream, SVgroupChangeInfo *pInfo, STrans *pTrans) {
+ mDebug("stream:0x%" PRIx64 " set tasks epset update action", pStream->uid);
+ taosWLockLatch(&pStream->lock);
+
+ SStreamTaskIter *pIter = createStreamTaskIter(pStream);
+ while (streamTaskIterNextTask(pIter)) {
+ SStreamTask *pTask = streamTaskIterGetCurrent(pIter);
+ int32_t code = doSetUpdateTaskAction(pTrans, pTask, pInfo);
+ if (code != TSDB_CODE_SUCCESS) {
+ destroyStreamTaskIter(pIter);
+ taosWUnLockLatch(&pStream->lock);
+ return -1;
+ }
+ }
+
+ destroyStreamTaskIter(pIter);
+ taosWUnLockLatch(&pStream->lock);
+ return 0;
+}
+
+static int32_t doSetResetAction(SMnode *pMnode, STrans *pTrans, SStreamTask *pTask) {
+ SVResetStreamTaskReq *pReq = taosMemoryCalloc(1, sizeof(SVResetStreamTaskReq));
+ if (pReq == NULL) {
+ terrno = TSDB_CODE_OUT_OF_MEMORY;
+ mError("failed to malloc in reset stream, size:%" PRIzu ", code:%s", sizeof(SVResetStreamTaskReq),
+ tstrerror(TSDB_CODE_OUT_OF_MEMORY));
+ return terrno;
+ }
+
+ pReq->head.vgId = htonl(pTask->info.nodeId);
+ pReq->taskId = pTask->id.taskId;
+ pReq->streamId = pTask->id.streamId;
+
+ SEpSet epset = {0};
+ bool hasEpset = false;
+ int32_t code = extractNodeEpset(pMnode, &epset, &hasEpset, pTask->id.taskId, pTask->info.nodeId);
+ if (code != TSDB_CODE_SUCCESS || !hasEpset) {
+ taosMemoryFree(pReq);
+ return code;
+ }
+
+ code = setTransAction(pTrans, pReq, sizeof(SVResetStreamTaskReq), TDMT_VND_STREAM_TASK_RESET, &epset, 0);
+ if (code != TSDB_CODE_SUCCESS) {
+ taosMemoryFree(pReq);
+ }
+
+ return code;
+}
+
+int32_t mndStreamSetResetTaskAction(SMnode *pMnode, STrans *pTrans, SStreamObj *pStream) {
+ taosWLockLatch(&pStream->lock);
+
+ SStreamTaskIter *pIter = createStreamTaskIter(pStream);
+ while (streamTaskIterNextTask(pIter)) {
+ SStreamTask *pTask = streamTaskIterGetCurrent(pIter);
+ int32_t code = doSetResetAction(pMnode, pTrans, pTask);
+ if (code != TSDB_CODE_SUCCESS) {
+ destroyStreamTaskIter(pIter);
+ taosWUnLockLatch(&pStream->lock);
+ return -1;
+ }
+ }
+
+ destroyStreamTaskIter(pIter);
+ taosWUnLockLatch(&pStream->lock);
+ return 0;
+}
diff --git a/source/dnode/mnode/impl/src/mndTrans.c b/source/dnode/mnode/impl/src/mndTrans.c
index 9075f0145c..1adc4ed4bf 100644
--- a/source/dnode/mnode/impl/src/mndTrans.c
+++ b/source/dnode/mnode/impl/src/mndTrans.c
@@ -599,6 +599,8 @@ STrans *mndTransCreate(SMnode *pMnode, ETrnPolicy policy, ETrnConflct conflict,
pTrans->originRpcType = pReq->msgType;
}
+ mInfo("trans:%d, create transaction:%s, origin:%s", pTrans->id, pTrans->opername, opername);
+
mTrace("trans:%d, local object is created, data:%p", pTrans->id, pTrans);
return pTrans;
}
@@ -845,6 +847,8 @@ int32_t mndTransCheckConflict(SMnode *pMnode, STrans *pTrans) {
}
int32_t mndTransPrepare(SMnode *pMnode, STrans *pTrans) {
+ if(pTrans == NULL) return -1;
+
if (mndTransCheckConflict(pMnode, pTrans) != 0) {
return -1;
}
diff --git a/source/dnode/mnode/impl/src/mndUser.c b/source/dnode/mnode/impl/src/mndUser.c
index 0e3b544508..5e5a3626a4 100644
--- a/source/dnode/mnode/impl/src/mndUser.c
+++ b/source/dnode/mnode/impl/src/mndUser.c
@@ -1925,6 +1925,7 @@ static int32_t mndProcessAlterUserPrivilegesReq(SAlterUserReq *pAlterReq, SMnode
return -1;
}
taosHashPut(pNewUser->topics, pTopic->name, len, pTopic->name, TSDB_TOPIC_FNAME_LEN);
+ mndReleaseTopic(pMnode, pTopic);
}
if (ALTER_USER_DEL_SUBSCRIBE_TOPIC_PRIV(pAlterReq->alterType, pAlterReq->privileges)) {
@@ -1935,6 +1936,7 @@ static int32_t mndProcessAlterUserPrivilegesReq(SAlterUserReq *pAlterReq, SMnode
return -1;
}
taosHashRemove(pNewUser->topics, pAlterReq->objname, len);
+ mndReleaseTopic(pMnode, pTopic);
}
return TSDB_CODE_SUCCESS;
diff --git a/source/dnode/mnode/impl/src/mndVgroup.c b/source/dnode/mnode/impl/src/mndVgroup.c
index 1055aa0874..a5df9ad820 100644
--- a/source/dnode/mnode/impl/src/mndVgroup.c
+++ b/source/dnode/mnode/impl/src/mndVgroup.c
@@ -877,6 +877,7 @@ SEpSet mndGetVgroupEpset(SMnode *pMnode, const SVgObj *pVgroup) {
addEpIntoEpSet(&epset, pDnode->fqdn, pDnode->port);
mndReleaseDnode(pMnode, pDnode);
}
+ epsetSort(&epset);
return epset;
}
diff --git a/source/dnode/mnode/sdb/inc/sdb.h b/source/dnode/mnode/sdb/inc/sdb.h
index e1beaaa910..9d1125dad2 100644
--- a/source/dnode/mnode/sdb/inc/sdb.h
+++ b/source/dnode/mnode/sdb/inc/sdb.h
@@ -152,7 +152,8 @@ typedef enum {
SDB_STREAM_SEQ = 23,
SDB_COMPACT = 24,
SDB_COMPACT_DETAIL = 25,
- SDB_MAX = 26
+ SDB_GRANT = 26, // grant log
+ SDB_MAX = 27
} ESdbType;
typedef struct SSdbRaw {
diff --git a/source/dnode/mnode/sdb/src/sdbHash.c b/source/dnode/mnode/sdb/src/sdbHash.c
index 1d2e2de17d..df228c1fcc 100644
--- a/source/dnode/mnode/sdb/src/sdbHash.c
+++ b/source/dnode/mnode/sdb/src/sdbHash.c
@@ -64,6 +64,8 @@ const char *sdbTableName(ESdbType type) {
return "idx";
case SDB_VIEW:
return "view";
+ case SDB_STREAM_SEQ:
+ return "stream_seq";
case SDB_COMPACT:
return "compact";
case SDB_COMPACT_DETAIL:
diff --git a/source/dnode/snode/src/snode.c b/source/dnode/snode/src/snode.c
index 4284b0838e..f173c327c7 100644
--- a/source/dnode/snode/src/snode.c
+++ b/source/dnode/snode/src/snode.c
@@ -171,10 +171,6 @@ int32_t sndProcessStreamMsg(SSnode *pSnode, SRpcMsg *pMsg) {
return tqStreamTaskProcessRetrieveReq(pSnode->pMeta, pMsg);
case TDMT_STREAM_RETRIEVE_RSP: // 1036
break;
- case TDMT_VND_STREAM_SCAN_HISTORY_FINISH:
- return tqStreamTaskProcessScanHistoryFinishReq(pSnode->pMeta, pMsg);
- case TDMT_VND_STREAM_SCAN_HISTORY_FINISH_RSP:
- return tqStreamTaskProcessScanHistoryFinishRsp(pSnode->pMeta, pMsg);
case TDMT_VND_STREAM_TASK_CHECK:
return tqStreamTaskProcessCheckReq(pSnode->pMeta, pMsg);
case TDMT_VND_STREAM_TASK_CHECK_RSP:
diff --git a/source/dnode/vnode/src/inc/vnodeInt.h b/source/dnode/vnode/src/inc/vnodeInt.h
index c1a4754b62..23f79158c3 100644
--- a/source/dnode/vnode/src/inc/vnodeInt.h
+++ b/source/dnode/vnode/src/inc/vnodeInt.h
@@ -235,7 +235,6 @@ int32_t tqProcessTaskCheckPointSourceReq(STQ* pTq, SRpcMsg* pMsg, SRpcMsg* pRsp)
int32_t tqProcessTaskCheckpointReadyMsg(STQ* pTq, SRpcMsg* pMsg);
int32_t tqProcessTaskUpdateReq(STQ* pTq, SRpcMsg* pMsg);
int32_t tqProcessTaskResetReq(STQ* pTq, SRpcMsg* pMsg);
-int32_t tqProcessTaskDropHTask(STQ* pTq, SRpcMsg* pMsg);
int32_t tqExpandTask(STQ* pTq, SStreamTask* pTask, int64_t ver);
int32_t tqScanWal(STQ* pTq);
@@ -268,8 +267,6 @@ int32_t tqProcessTaskDispatchRsp(STQ* pTq, SRpcMsg* pMsg);
int32_t tqProcessTaskRetrieveReq(STQ* pTq, SRpcMsg* pMsg);
int32_t tqProcessTaskRetrieveRsp(STQ* pTq, SRpcMsg* pMsg);
int32_t tqProcessTaskScanHistory(STQ* pTq, SRpcMsg* pMsg);
-int32_t tqProcessTaskScanHistoryFinishReq(STQ* pTq, SRpcMsg* pMsg);
-int32_t tqProcessTaskScanHistoryFinishRsp(STQ* pTq, SRpcMsg* pMsg);
// sma
int32_t smaInit();
diff --git a/source/dnode/vnode/src/tq/tq.c b/source/dnode/vnode/src/tq/tq.c
index 9ae4fa5e19..1ade1c8c41 100644
--- a/source/dnode/vnode/src/tq/tq.c
+++ b/source/dnode/vnode/src/tq/tq.c
@@ -835,8 +835,8 @@ int32_t tqExpandTask(STQ* pTq, SStreamTask* pTask, int64_t nextProcessVer) {
SCheckpointInfo* pChkInfo = &pTask->chkInfo;
// checkpoint ver is the kept version, handled data should be the next version.
- if (pTask->chkInfo.checkpointId != 0) {
- pTask->chkInfo.nextProcessVer = pTask->chkInfo.checkpointVer + 1;
+ if (pChkInfo->checkpointId != 0) {
+ pChkInfo->nextProcessVer = pChkInfo->checkpointVer + 1;
tqInfo("s-task:%s restore from the checkpointId:%" PRId64 " ver:%" PRId64 " currentVer:%" PRId64, pTask->id.idStr,
pChkInfo->checkpointId, pChkInfo->checkpointVer, pChkInfo->nextProcessVer);
}
@@ -886,7 +886,8 @@ static void doStartFillhistoryStep2(SStreamTask* pTask, SStreamTask* pStreamTask
pTask->execInfo.step2Start = taosGetTimestampMs();
if (done) {
- qDebug("s-task:%s scan-history from WAL stage(step 2) ended, elapsed time:%.2fs", id, 0.0);
+ qDebug("s-task:%s scan wal(step 2) verRange:%" PRId64 "-%" PRId64 " ended, elapsed time:%.2fs", id, pRange->minVer,
+ pRange->maxVer, 0.0);
streamTaskPutTranstateIntoInputQ(pTask);
streamExecTask(pTask); // exec directly
} else {
@@ -1042,15 +1043,6 @@ int32_t tqProcessTaskScanHistory(STQ* pTq, SRpcMsg* pMsg) {
return code;
}
-// only the agg tasks and the sink tasks will receive this message from upstream tasks
-int32_t tqProcessTaskScanHistoryFinishReq(STQ* pTq, SRpcMsg* pMsg) {
- return tqStreamTaskProcessScanHistoryFinishReq(pTq->pStreamMeta, pMsg);
-}
-
-int32_t tqProcessTaskScanHistoryFinishRsp(STQ* pTq, SRpcMsg* pMsg) {
- return tqStreamTaskProcessScanHistoryFinishRsp(pTq->pStreamMeta, pMsg);
-}
-
int32_t tqProcessTaskRunReq(STQ* pTq, SRpcMsg* pMsg) {
SStreamTaskRunReq* pReq = pMsg->pCont;
@@ -1141,8 +1133,7 @@ int32_t tqProcessTaskCheckPointSourceReq(STQ* pTq, SRpcMsg* pMsg, SRpcMsg* pRsp)
SStreamTask* pTask = streamMetaAcquireTask(pMeta, req.streamId, req.taskId);
if (pTask == NULL) {
- tqError("vgId:%d failed to find s-task:0x%x, ignore checkpoint msg. it may have been destroyed already", vgId,
- req.taskId);
+ tqError("vgId:%d failed to find s-task:0x%x, ignore checkpoint msg. it may have been destroyed", vgId, req.taskId);
SRpcMsg rsp = {0};
buildCheckpointSourceRsp(&req, &pMsg->info, &rsp, 0);
tmsgSendRsp(&rsp); // error occurs
@@ -1169,18 +1160,22 @@ int32_t tqProcessTaskCheckPointSourceReq(STQ* pTq, SRpcMsg* pMsg, SRpcMsg* pRsp)
taosThreadMutexLock(&pTask->lock);
ETaskStatus status = streamTaskGetStatus(pTask)->state;
- if (status == TASK_STATUS__HALT || status == TASK_STATUS__PAUSE) {
- tqError("s-task:%s not ready for checkpoint, since it is halt, ignore this checkpoint:%" PRId64 ", set it failure",
- pTask->id.idStr, req.checkpointId);
+ if (req.mndTrigger == 1) {
+ if (status == TASK_STATUS__HALT || status == TASK_STATUS__PAUSE) {
+ tqError("s-task:%s not ready for checkpoint, since it is halt, ignore checkpoint:%" PRId64 ", set it failure",
+ pTask->id.idStr, req.checkpointId);
- taosThreadMutexUnlock(&pTask->lock);
- streamMetaReleaseTask(pMeta, pTask);
+ taosThreadMutexUnlock(&pTask->lock);
+ streamMetaReleaseTask(pMeta, pTask);
- SRpcMsg rsp = {0};
- buildCheckpointSourceRsp(&req, &pMsg->info, &rsp, 0);
- tmsgSendRsp(&rsp); // error occurs
+ SRpcMsg rsp = {0};
+ buildCheckpointSourceRsp(&req, &pMsg->info, &rsp, 0);
+ tmsgSendRsp(&rsp); // error occurs
- return TSDB_CODE_SUCCESS;
+ return TSDB_CODE_SUCCESS;
+ }
+ } else {
+ ASSERT(status == TASK_STATUS__HALT);
}
// check if the checkpoint msg already sent or not.
@@ -1198,16 +1193,8 @@ int32_t tqProcessTaskCheckPointSourceReq(STQ* pTq, SRpcMsg* pMsg, SRpcMsg* pRsp)
streamProcessCheckpointSourceReq(pTask, &req);
taosThreadMutexUnlock(&pTask->lock);
- int32_t total = 0;
- streamMetaWLock(pMeta);
-
- // set the initial value for generating check point
- // set the mgmt epset info according to the checkout source msg from mnode, todo update mgmt epset if needed
- total = pMeta->numOfStreamTasks;
- streamMetaWUnLock(pMeta);
-
- qInfo("s-task:%s (vgId:%d) level:%d receive checkpoint-source msg chkpt:%" PRId64 ", total checkpoint reqs:%d",
- pTask->id.idStr, vgId, pTask->info.taskLevel, req.checkpointId, total);
+ qInfo("s-task:%s (vgId:%d) level:%d receive checkpoint-source msg chkpt:%" PRId64 ", transId:%d",
+ pTask->id.idStr, vgId, pTask->info.taskLevel, req.checkpointId, req.transId);
code = streamAddCheckpointSourceRspMsg(&req, &pMsg->info, pTask, 1);
if (code != TSDB_CODE_SUCCESS) {
@@ -1233,35 +1220,3 @@ int32_t tqProcessTaskUpdateReq(STQ* pTq, SRpcMsg* pMsg) {
int32_t tqProcessTaskResetReq(STQ* pTq, SRpcMsg* pMsg) {
return tqStreamTaskProcessTaskResetReq(pTq->pStreamMeta, pMsg);
}
-
-// NOTE: here we may receive this message more than once, so need to handle this case
-int32_t tqProcessTaskDropHTask(STQ* pTq, SRpcMsg* pMsg) {
- SVDropHTaskReq* pReq = (SVDropHTaskReq*)pMsg->pCont;
-
- SStreamMeta* pMeta = pTq->pStreamMeta;
- SStreamTask* pTask = streamMetaAcquireTask(pMeta, pReq->streamId, pReq->taskId);
- if (pTask == NULL) {
- tqError("vgId:%d process drop fill-history task req, failed to acquire task:0x%x, it may have been dropped already",
- pMeta->vgId, pReq->taskId);
- return TSDB_CODE_SUCCESS;
- }
-
- tqDebug("s-task:%s receive drop fill-history msg from mnode", pTask->id.idStr);
- if (pTask->hTaskInfo.id.taskId == 0) {
- tqError("vgId:%d s-task:%s not have related fill-history task", pMeta->vgId, pTask->id.idStr);
- streamMetaReleaseTask(pMeta, pTask);
- return TSDB_CODE_SUCCESS;
- }
-
- taosThreadMutexLock(&pTask->lock);
- SStreamTaskId id = {.streamId = pTask->hTaskInfo.id.streamId, .taskId = pTask->hTaskInfo.id.taskId};
- streamBuildAndSendDropTaskMsg(pTask->pMsgCb, pMeta->vgId, &id);
- taosThreadMutexUnlock(&pTask->lock);
-
- // clear the scheduler status
- streamTaskSetSchedStatusInactive(pTask);
- tqDebug("s-task:%s set scheduler status:%d after drop fill-history task", pTask->id.idStr, pTask->status.schedStatus);
- streamMetaReleaseTask(pMeta, pTask);
- return TSDB_CODE_SUCCESS;
-}
-
diff --git a/source/dnode/vnode/src/tq/tqRead.c b/source/dnode/vnode/src/tq/tqRead.c
index 0b05573aae..383a636f71 100644
--- a/source/dnode/vnode/src/tq/tqRead.c
+++ b/source/dnode/vnode/src/tq/tqRead.c
@@ -465,7 +465,7 @@ bool tqNextBlockImpl(STqReader* pReader, const char* idstr) {
int32_t numOfBlocks = taosArrayGetSize(pReader->submit.aSubmitTbData);
while (pReader->nextBlk < numOfBlocks) {
tqDebug("try next data block, len:%d ver:%" PRId64 " index:%d/%d, %s", pReader->msg.msgLen, pReader->msg.ver,
- pReader->nextBlk, numOfBlocks, idstr);
+ (pReader->nextBlk + 1), numOfBlocks, idstr);
SSubmitTbData* pSubmitTbData = taosArrayGet(pReader->submit.aSubmitTbData, pReader->nextBlk);
if (pReader->tbIdHash == NULL) {
diff --git a/source/dnode/vnode/src/tq/tqScan.c b/source/dnode/vnode/src/tq/tqScan.c
index 01866ef893..5432637482 100644
--- a/source/dnode/vnode/src/tq/tqScan.c
+++ b/source/dnode/vnode/src/tq/tqScan.c
@@ -16,21 +16,20 @@
#include "tq.h"
int32_t tqAddBlockDataToRsp(const SSDataBlock* pBlock, SMqDataRsp* pRsp, int32_t numOfCols, int8_t precision) {
- int32_t dataStrLen = sizeof(SRetrieveTableRsp) + blockGetEncodeSize(pBlock);
+ int32_t dataStrLen = sizeof(SRetrieveTableRspForTmq) + blockGetEncodeSize(pBlock);
void* buf = taosMemoryCalloc(1, dataStrLen);
if (buf == NULL) {
return TSDB_CODE_OUT_OF_MEMORY;
}
- SRetrieveTableRsp* pRetrieve = (SRetrieveTableRsp*)buf;
- pRetrieve->useconds = 0;
+ SRetrieveTableRspForTmq* pRetrieve = (SRetrieveTableRspForTmq*)buf;
+ pRetrieve->version = 1;
pRetrieve->precision = precision;
pRetrieve->compressed = 0;
- pRetrieve->completed = 1;
pRetrieve->numOfRows = htobe64((int64_t)pBlock->info.rows);
int32_t actualLen = blockEncode(pBlock, pRetrieve->data, numOfCols);
- actualLen += sizeof(SRetrieveTableRsp);
+ actualLen += sizeof(SRetrieveTableRspForTmq);
taosArrayPush(pRsp->blockDataLen, &actualLen);
taosArrayPush(pRsp->blockData, &buf);
diff --git a/source/dnode/vnode/src/tq/tqStreamTask.c b/source/dnode/vnode/src/tq/tqStreamTask.c
index cdb5cc26f8..280c110711 100644
--- a/source/dnode/vnode/src/tq/tqStreamTask.c
+++ b/source/dnode/vnode/src/tq/tqStreamTask.c
@@ -23,7 +23,7 @@ static int32_t doScanWalForAllTasks(SStreamMeta* pStreamMeta, bool* pScanIdle);
static int32_t setWalReaderStartOffset(SStreamTask* pTask, int32_t vgId);
static bool handleFillhistoryScanComplete(SStreamTask* pTask, int64_t ver);
static bool taskReadyForDataFromWal(SStreamTask* pTask);
-static bool doPutDataIntoInputQFromWal(SStreamTask* pTask, int64_t maxVer, int32_t* numOfItems);
+static bool doPutDataIntoInputQ(SStreamTask* pTask, int64_t maxVer, int32_t* numOfItems);
static int32_t tqScanWalInFuture(STQ* pTq, int32_t numOfTasks, int32_t idleDuration);
// extract data blocks(submit/delete) from WAL, and add them into the input queue for all the sources tasks.
@@ -300,21 +300,21 @@ bool taskReadyForDataFromWal(SStreamTask* pTask) {
return true;
}
-bool doPutDataIntoInputQFromWal(SStreamTask* pTask, int64_t maxVer, int32_t* numOfItems) {
+bool doPutDataIntoInputQ(SStreamTask* pTask, int64_t maxVer, int32_t* numOfItems) {
const char* id = pTask->id.idStr;
int32_t numOfNewItems = 0;
- while(1) {
+ while (1) {
if ((pTask->info.fillHistory == 1) && pTask->status.appendTranstateBlock) {
*numOfItems += numOfNewItems;
return numOfNewItems > 0;
}
SStreamQueueItem* pItem = NULL;
- int32_t code = extractMsgFromWal(pTask->exec.pWalReader, (void**)&pItem, maxVer, id);
+ int32_t code = extractMsgFromWal(pTask->exec.pWalReader, (void**)&pItem, maxVer, id);
if (code != TSDB_CODE_SUCCESS || pItem == NULL) { // failed, continue
int64_t currentVer = walReaderGetCurrentVer(pTask->exec.pWalReader);
- bool itemInFillhistory = handleFillhistoryScanComplete(pTask, currentVer);
+ bool itemInFillhistory = handleFillhistoryScanComplete(pTask, currentVer);
if (itemInFillhistory) {
numOfNewItems += 1;
}
@@ -334,7 +334,9 @@ bool doPutDataIntoInputQFromWal(SStreamTask* pTask, int64_t maxVer, int32_t* num
break;
}
} else {
- tqError("s-task:%s append input queue failed, code: too many items, ver:%" PRId64, id, pTask->chkInfo.nextProcessVer);
+ walReaderSeekVer(pTask->exec.pWalReader, pTask->chkInfo.nextProcessVer);
+ tqError("s-task:%s append input queue failed, code:too many items, ver:%" PRId64, id,
+ pTask->chkInfo.nextProcessVer);
break;
}
}
@@ -399,7 +401,7 @@ int32_t doScanWalForAllTasks(SStreamMeta* pStreamMeta, bool* pScanIdle) {
continue;
}
- bool hasNewData = doPutDataIntoInputQFromWal(pTask, maxVer, &numOfItems);
+ bool hasNewData = doPutDataIntoInputQ(pTask, maxVer, &numOfItems);
taosThreadMutexUnlock(&pTask->lock);
if ((numOfItems > 0) || hasNewData) {
diff --git a/source/dnode/vnode/src/tqCommon/tqCommon.c b/source/dnode/vnode/src/tqCommon/tqCommon.c
index 437c61f666..f5c844f1e9 100644
--- a/source/dnode/vnode/src/tqCommon/tqCommon.c
+++ b/source/dnode/vnode/src/tqCommon/tqCommon.c
@@ -338,74 +338,6 @@ int32_t tqStreamTaskProcessRetrieveReq(SStreamMeta* pMeta, SRpcMsg* pMsg) {
return code;
}
-int32_t tqStreamTaskProcessScanHistoryFinishReq(SStreamMeta* pMeta, SRpcMsg* pMsg) {
- char* msg = POINTER_SHIFT(pMsg->pCont, sizeof(SMsgHead));
- int32_t msgLen = pMsg->contLen - sizeof(SMsgHead);
-
- // deserialize
- SStreamScanHistoryFinishReq req = {0};
-
- SDecoder decoder;
- tDecoderInit(&decoder, (uint8_t*)msg, msgLen);
- tDecodeStreamScanHistoryFinishReq(&decoder, &req);
- tDecoderClear(&decoder);
-
- SStreamTask* pTask = streamMetaAcquireTask(pMeta, req.streamId, req.downstreamTaskId);
- if (pTask == NULL) {
- tqError("vgId:%d process scan history finish msg, failed to find task:0x%x, it may be destroyed", pMeta->vgId,
- req.downstreamTaskId);
- return -1;
- }
-
- tqDebug("s-task:%s receive scan-history finish msg from task:0x%x", pTask->id.idStr, req.upstreamTaskId);
-
- int32_t code = streamProcessScanHistoryFinishReq(pTask, &req, &pMsg->info);
- streamMetaReleaseTask(pMeta, pTask);
- return code;
-}
-
-int32_t tqStreamTaskProcessScanHistoryFinishRsp(SStreamMeta* pMeta, SRpcMsg* pMsg) {
- int32_t code = TSDB_CODE_SUCCESS;
- char* msg = POINTER_SHIFT(pMsg->pCont, sizeof(SMsgHead));
- int32_t msgLen = pMsg->contLen - sizeof(SMsgHead);
-
- // deserialize
- SStreamCompleteHistoryMsg req = {0};
-
- SDecoder decoder;
- tDecoderInit(&decoder, (uint8_t*)msg, msgLen);
- tDecodeCompleteHistoryDataMsg(&decoder, &req);
- tDecoderClear(&decoder);
-
- if (pMeta->role == NODE_ROLE_FOLLOWER) {
- tqError("s-task:0x%x (vgId:%d) not handle the scan-history finish rsp, since it becomes follower",
- req.upstreamTaskId, pMeta->vgId);
- return TASK_DOWNSTREAM_NOT_LEADER;
- }
-
- SStreamTask* pTask = streamMetaAcquireTask(pMeta, req.streamId, req.upstreamTaskId);
- if (pTask == NULL) {
- tqError("vgId:%d process scan history finish rsp, failed to find task:0x%x, it may be destroyed", pMeta->vgId,
- req.upstreamTaskId);
- return -1;
- }
-
- int32_t remain = atomic_sub_fetch_32(&pTask->notReadyTasks, 1);
- if (remain > 0) {
- tqDebug("s-task:%s scan-history finish rsp received from downstream task:0x%x, unfinished remain:%d",
- pTask->id.idStr, req.downstreamId, remain);
- } else {
- tqDebug(
- "s-task:%s scan-history finish rsp received from downstream task:0x%x, all downstream tasks rsp scan-history "
- "completed msg",
- pTask->id.idStr, req.downstreamId);
- code = streamProcessScanHistoryFinishRsp(pTask);
- }
-
- streamMetaReleaseTask(pMeta, pTask);
- return code;
-}
-
int32_t tqStreamTaskProcessCheckReq(SStreamMeta* pMeta, SRpcMsg* pMsg) {
char* msgStr = pMsg->pCont;
char* msgBody = POINTER_SHIFT(msgStr, sizeof(SMsgHead));
@@ -673,7 +605,8 @@ int32_t tqStreamTaskProcessDropReq(SStreamMeta* pMeta, char* msg, int32_t msgLen
if (HAS_RELATED_FILLHISTORY_TASK(pTask)) {
STaskId* pHTaskId = &pTask->hTaskInfo.id;
streamMetaUnregisterTask(pMeta, pHTaskId->streamId, pHTaskId->taskId);
- tqDebug("vgId:%d drop fill-history task:0x%x dropped firstly", vgId, (int32_t)pHTaskId->taskId);
+ tqDebug("s-task:0x%x vgId:%d drop fill-history task:0x%x firstly", pReq->taskId, vgId,
+ (int32_t)pHTaskId->taskId);
}
streamMetaReleaseTask(pMeta, pTask);
}
diff --git a/source/dnode/vnode/src/tsdb/tsdbCache.c b/source/dnode/vnode/src/tsdb/tsdbCache.c
index d86219542f..cc0bf2b774 100644
--- a/source/dnode/vnode/src/tsdb/tsdbCache.c
+++ b/source/dnode/vnode/src/tsdb/tsdbCache.c
@@ -941,7 +941,7 @@ static int32_t tsdbCacheLoadFromRaw(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArr
}
if(lastrowTmpIndexArray != NULL) {
- mergeLastCid(uid, pTsdb, &lastrowTmpColArray, pr, lastrowColIds, lastrowIndex, lastrowSlotIds);
+ mergeLastRowCid(uid, pTsdb, &lastrowTmpColArray, pr, lastrowColIds, lastrowIndex, lastrowSlotIds);
for(int i = 0; i < taosArrayGetSize(lastrowTmpColArray); i++) {
taosArrayInsert(pTmpColArray, *(int32_t*)taosArrayGet(lastrowTmpIndexArray, i), taosArrayGet(lastrowTmpColArray, i));
}
diff --git a/source/dnode/vnode/src/vnd/vnodeCommit.c b/source/dnode/vnode/src/vnd/vnodeCommit.c
index c8cd167393..645f2620dc 100644
--- a/source/dnode/vnode/src/vnd/vnodeCommit.c
+++ b/source/dnode/vnode/src/vnd/vnodeCommit.c
@@ -157,7 +157,8 @@ int vnodeShouldCommit(SVnode *pVnode, bool atExit) {
taosThreadMutexLock(&pVnode->mutex);
if (pVnode->inUse && diskAvail) {
needCommit = (pVnode->inUse->size > pVnode->inUse->node.size) ||
- (atExit && (pVnode->inUse->size > 0 || pVnode->pMeta->changed));
+ (atExit && (pVnode->inUse->size > 0 || pVnode->pMeta->changed ||
+ pVnode->state.applied - pVnode->state.committed > 4096));
}
taosThreadMutexUnlock(&pVnode->mutex);
return needCommit;
diff --git a/source/dnode/vnode/src/vnd/vnodeSvr.c b/source/dnode/vnode/src/vnd/vnodeSvr.c
index db807d000b..3ec6adee41 100644
--- a/source/dnode/vnode/src/vnd/vnodeSvr.c
+++ b/source/dnode/vnode/src/vnd/vnodeSvr.c
@@ -183,6 +183,11 @@ static int32_t vnodePreProcessDropTtlMsg(SVnode *pVnode, SRpcMsg *pMsg) {
ttlReq.pTbUids = tbUids;
}
+ if (ttlReq.nUids == 0) {
+ code = TSDB_CODE_MSG_PREPROCESSED;
+ TSDB_CHECK_CODE(code, lino, _exit);
+ }
+
{ // prepare new content
int32_t reqLenNew = tSerializeSVDropTtlTableReq(NULL, 0, &ttlReq);
int32_t contLenNew = reqLenNew + sizeof(SMsgHead);
@@ -207,7 +212,7 @@ static int32_t vnodePreProcessDropTtlMsg(SVnode *pVnode, SRpcMsg *pMsg) {
_exit:
taosArrayDestroy(tbUids);
- if (code) {
+ if (code && code != TSDB_CODE_MSG_PREPROCESSED) {
vError("vgId:%d, %s:%d failed to preprocess drop ttl request since %s, msg type:%s", TD_VID(pVnode), __func__, lino,
tstrerror(code), TMSG_INFO(pMsg->msgType));
} else {
@@ -464,7 +469,7 @@ int32_t vnodePreProcessWriteMsg(SVnode *pVnode, SRpcMsg *pMsg) {
break;
}
- if (code) {
+ if (code && code != TSDB_CODE_MSG_PREPROCESSED) {
vError("vgId:%d, failed to preprocess write request since %s, msg type:%s", TD_VID(pVnode), tstrerror(code),
TMSG_INFO(pMsg->msgType));
}
@@ -595,11 +600,6 @@ int32_t vnodeProcessWriteMsg(SVnode *pVnode, SRpcMsg *pMsg, int64_t ver, SRpcMsg
tqProcessTaskResetReq(pVnode->pTq, pMsg);
}
} break;
- case TDMT_STREAM_HTASK_DROP: {
- if (pVnode->restored && vnodeIsLeader(pVnode)) {
- tqProcessTaskDropHTask(pVnode->pTq, pMsg);
- }
- } break;
case TDMT_VND_ALTER_CONFIRM:
needCommit = pVnode->config.hashChange;
if (vnodeProcessAlterConfirmReq(pVnode, ver, pReq, len, pRsp) < 0) {
@@ -789,10 +789,6 @@ int32_t vnodeProcessStreamMsg(SVnode *pVnode, SRpcMsg *pMsg, SQueueInfo *pInfo)
return tqProcessTaskRetrieveRsp(pVnode->pTq, pMsg);
case TDMT_VND_STREAM_SCAN_HISTORY:
return tqProcessTaskScanHistory(pVnode->pTq, pMsg);
- case TDMT_VND_STREAM_SCAN_HISTORY_FINISH:
- return tqProcessTaskScanHistoryFinishReq(pVnode->pTq, pMsg);
- case TDMT_VND_STREAM_SCAN_HISTORY_FINISH_RSP:
- return tqProcessTaskScanHistoryFinishRsp(pVnode->pTq, pMsg);
case TDMT_STREAM_TASK_CHECKPOINT_READY:
return tqProcessTaskCheckpointReadyMsg(pVnode->pTq, pMsg);
default:
diff --git a/source/dnode/vnode/src/vnd/vnodeSync.c b/source/dnode/vnode/src/vnd/vnodeSync.c
index 8844e358d5..5f4b7b8442 100644
--- a/source/dnode/vnode/src/vnd/vnodeSync.c
+++ b/source/dnode/vnode/src/vnd/vnodeSync.c
@@ -95,6 +95,11 @@ static void inline vnodeHandleWriteMsg(SVnode *pVnode, SRpcMsg *pMsg) {
static void vnodeHandleProposeError(SVnode *pVnode, SRpcMsg *pMsg, int32_t code) {
if (code == TSDB_CODE_SYN_NOT_LEADER || code == TSDB_CODE_SYN_RESTORING) {
vnodeRedirectRpcMsg(pVnode, pMsg, code);
+ } else if (code == TSDB_CODE_MSG_PREPROCESSED) {
+ SRpcMsg rsp = {.code = TSDB_CODE_SUCCESS, .info = pMsg->info};
+ if (rsp.info.handle != NULL) {
+ tmsgSendRsp(&rsp);
+ }
} else {
const STraceId *trace = &pMsg->info.traceId;
vGError("vgId:%d, msg:%p failed to propose since %s, code:0x%x", pVnode->config.vgId, pMsg, tstrerror(code), code);
@@ -297,8 +302,10 @@ void vnodeProposeWriteMsg(SQueueInfo *pInfo, STaosQall *qall, int32_t numOfMsgs)
code = vnodePreProcessWriteMsg(pVnode, pMsg);
if (code != 0) {
- vGError("vgId:%d, msg:%p failed to pre-process since %s", vgId, pMsg, tstrerror(code));
- if (terrno != 0) code = terrno;
+ if (code != TSDB_CODE_MSG_PREPROCESSED) {
+ vGError("vgId:%d, msg:%p failed to pre-process since %s", vgId, pMsg, tstrerror(code));
+ if (terrno != 0) code = terrno;
+ }
vnodeHandleProposeError(pVnode, pMsg, code);
rpcFreeCont(pMsg->pCont);
taosFreeQitem(pMsg);
@@ -759,7 +766,7 @@ void vnodeSyncCheckTimeout(SVnode *pVnode) {
vError("vgId:%d, failed to propose since timeout and post block, start:%d cur:%d delta:%d seq:%" PRId64,
pVnode->config.vgId, pVnode->blockSec, curSec, delta, pVnode->blockSeq);
if (syncSendTimeoutRsp(pVnode->sync, pVnode->blockSeq) != 0) {
-#if 0
+#if 0
SRpcMsg rpcMsg = {.code = TSDB_CODE_SYN_TIMEOUT, .info = pVnode->blockInfo};
vError("send timeout response since its applyed, seq:%" PRId64 " handle:%p ahandle:%p", pVnode->blockSeq,
rpcMsg.info.handle, rpcMsg.info.ahandle);
diff --git a/source/libs/command/src/command.c b/source/libs/command/src/command.c
index 6bae0e1022..c45a8931d2 100644
--- a/source/libs/command/src/command.c
+++ b/source/libs/command/src/command.c
@@ -886,7 +886,7 @@ int32_t setLocalVariablesResultIntoDataBlock(SSDataBlock* pBlock) {
for (int32_t i = 0, c = 0; i < numOfCfg; ++i, c = 0) {
SConfigItem* pItem = taosArrayGet(tsCfg->array, i);
- GRANT_CFG_SKIP;
+ // GRANT_CFG_SKIP;
char name[TSDB_CONFIG_OPTION_LEN + VARSTR_HEADER_SIZE] = {0};
STR_WITH_MAXSIZE_TO_VARSTR(name, pItem->name, TSDB_CONFIG_OPTION_LEN + VARSTR_HEADER_SIZE);
diff --git a/source/libs/executor/inc/executorInt.h b/source/libs/executor/inc/executorInt.h
index 097b8d0136..46d7588604 100644
--- a/source/libs/executor/inc/executorInt.h
+++ b/source/libs/executor/inc/executorInt.h
@@ -273,7 +273,8 @@ typedef struct STableScanInfo {
SSampleExecInfo sample; // sample execution info
int32_t tableStartIndex; // current group scan start
int32_t tableEndIndex; // current group scan end
- int32_t currentGroupIndex; // current group index of groupOffset
+ int32_t currentGroupId;
+ int32_t currentTable;
int8_t scanMode;
int8_t assignBlockUid;
uint8_t countState; // empty table count state
diff --git a/source/libs/executor/inc/tsort.h b/source/libs/executor/inc/tsort.h
index 365acf2bff..436d1cefb8 100644
--- a/source/libs/executor/inc/tsort.h
+++ b/source/libs/executor/inc/tsort.h
@@ -204,6 +204,10 @@ void tsortSetAbortCheckFn(SSortHandle* pHandle, bool (*checkFn)(void* param), vo
*/
int32_t tsortCompAndBuildKeys(const SArray* pSortCols, char* keyBuf, int32_t* keyLen, const STupleHandle* pTuple);
+/**
+ * @brief set the merge limit reached callback. it calls mergeLimitReached param with tableUid and param
+*/
+void tsortSetMergeLimitReachedFp(SSortHandle* pHandle, void (*mergeLimitReached)(uint64_t tableUid, void* param), void* param);
#ifdef __cplusplus
}
#endif
diff --git a/source/libs/executor/src/executil.c b/source/libs/executor/src/executil.c
index 9c60432478..8bd83ee0fb 100644
--- a/source/libs/executor/src/executil.c
+++ b/source/libs/executor/src/executil.c
@@ -646,10 +646,6 @@ int32_t getColInfoResultForGroupby(void* pVnode, SNodeList* group, STableListInf
}
}
- if (initRemainGroups) {
- pTableListInfo->numOfOuputGroups = taosHashGetSize(pTableListInfo->remainGroups);
- }
-
if (tsTagFilterCache) {
tableList = taosArrayDup(pTableListInfo->pTableList, NULL);
pAPI->metaFn.metaPutTbGroupToCache(pVnode, pTableListInfo->idInfo.suid, context.digest, tListLen(context.digest),
@@ -1862,7 +1858,7 @@ STimeWindow getActiveTimeWindow(SDiskbasedBuf* pBuf, SResultRowInfo* pResultRowI
STimeWindow w = {0};
if (pResultRowInfo->cur.pageId == -1) { // the first window, from the previous stored value
getInitialStartTimeWindow(pInterval, ts, &w, (order == TSDB_ORDER_ASC));
- w.ekey = taosTimeAdd(w.skey, pInterval->interval, pInterval->intervalUnit, pInterval->precision) - 1;
+ w.ekey = taosTimeGetIntervalEnd(w.skey, pInterval);
return w;
}
@@ -2142,6 +2138,8 @@ int32_t buildGroupIdMapForAllTables(STableListInfo* pTableListInfo, SReadHandle*
pTableListInfo->numOfOuputGroups = numOfTables;
} else if (groupByTbname && pScanNode->groupOrderScan){
pTableListInfo->numOfOuputGroups = numOfTables;
+ } else if (groupByTbname && tsCountAlwaysReturnValue && ((STableScanPhysiNode*)pScanNode)->needCountEmptyTable) {
+ pTableListInfo->numOfOuputGroups = numOfTables;
} else {
pTableListInfo->numOfOuputGroups = 1;
}
@@ -2159,6 +2157,8 @@ int32_t buildGroupIdMapForAllTables(STableListInfo* pTableListInfo, SReadHandle*
return code;
}
+ if (pScanNode->groupOrderScan) pTableListInfo->numOfOuputGroups = taosArrayGetSize(pTableListInfo->pTableList);
+
if (groupSort || pScanNode->groupOrderScan) {
code = sortTableGroup(pTableListInfo);
}
diff --git a/source/libs/executor/src/executor.c b/source/libs/executor/src/executor.c
index 0d1adc4308..6bca18c0b9 100644
--- a/source/libs/executor/src/executor.c
+++ b/source/libs/executor/src/executor.c
@@ -1027,57 +1027,6 @@ int32_t qSetStreamOperatorOptionForScanHistory(qTaskInfo_t tinfo) {
return 0;
}
-int32_t qResetStreamOperatorOptionForScanHistory(qTaskInfo_t tinfo) {
- SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo;
- SOperatorInfo* pOperator = pTaskInfo->pRoot;
-
- while (1) {
- int32_t type = pOperator->operatorType;
- if (type == QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERVAL || type == QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_INTERVAL ||
- type == QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_INTERVAL) {
- SStreamIntervalOperatorInfo* pInfo = pOperator->info;
- STimeWindowAggSupp* pSup = &pInfo->twAggSup;
-
- pSup->calTriggerSaved = 0;
- pSup->deleteMarkSaved = 0;
- qInfo("reset stream param for interval: %d, %" PRId64, pSup->calTrigger, pSup->deleteMark);
-
- } else if (type == QUERY_NODE_PHYSICAL_PLAN_STREAM_SESSION ||
- type == QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_SESSION ||
- type == QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_SESSION) {
- SStreamSessionAggOperatorInfo* pInfo = pOperator->info;
- STimeWindowAggSupp* pSup = &pInfo->twAggSup;
-
- pSup->calTriggerSaved = 0;
- pSup->deleteMarkSaved = 0;
- qInfo("reset stream param for session: %d, %" PRId64, pSup->calTrigger, pSup->deleteMark);
-
- } else if (type == QUERY_NODE_PHYSICAL_PLAN_STREAM_STATE) {
- SStreamStateAggOperatorInfo* pInfo = pOperator->info;
- STimeWindowAggSupp* pSup = &pInfo->twAggSup;
-
- pSup->calTriggerSaved = 0;
- pSup->deleteMarkSaved = 0;
- qInfo("reset stream param for state: %d, %" PRId64, pSup->calTrigger, pSup->deleteMark);
-
- } else if (type == QUERY_NODE_PHYSICAL_PLAN_STREAM_EVENT) {
- SStreamEventAggOperatorInfo* pInfo = pOperator->info;
- STimeWindowAggSupp* pSup = &pInfo->twAggSup;
-
- pSup->calTriggerSaved = 0;
- pSup->deleteMarkSaved = 0;
- qInfo("save stream param for state: %d, %" PRId64, pSup->calTrigger, pSup->deleteMark);
- }
-
- // iterate operator tree
- if (pOperator->numOfDownstream != 1 || pOperator->pDownstream[0] == NULL) {
- return 0;
- } else {
- pOperator = pOperator->pDownstream[0];
- }
- }
-}
-
int32_t qRestoreStreamOperatorOption(qTaskInfo_t tinfo) {
SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo;
const char* id = GET_TASKID(pTaskInfo);
@@ -1131,7 +1080,7 @@ bool qStreamScanhistoryFinished(qTaskInfo_t tinfo) {
int32_t qStreamInfoResetTimewindowFilter(qTaskInfo_t tinfo) {
SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo;
- STimeWindow* pWindow = &pTaskInfo->streamInfo.fillHistoryWindow;
+ STimeWindow* pWindow = &pTaskInfo->streamInfo.fillHistoryWindow;
qDebug("%s remove timeWindow filter:%" PRId64 "-%" PRId64 ", set new window:%" PRId64 "-%" PRId64,
GET_TASKID(pTaskInfo), pWindow->skey, pWindow->ekey, INT64_MIN, INT64_MAX);
@@ -1264,7 +1213,7 @@ int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subT
STableKeyInfo* pTableInfo = tableListGetInfo(pTableListInfo, 0);
uid = pTableInfo->uid;
ts = INT64_MIN;
- pScanInfo->tableEndIndex = 0;
+ pScanInfo->currentTable = 0;
} else {
taosRUnLockLatch(&pTaskInfo->lock);
qError("no table in table list, %s", id);
@@ -1278,16 +1227,16 @@ int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subT
pInfo->pTableScanOp->resultInfo.totalRows = 0;
// start from current accessed position
- // we cannot start from the pScanInfo->tableEndIndex, since the commit offset may cause the rollback of the start
+ // we cannot start from the pScanInfo->currentTable, since the commit offset may cause the rollback of the start
// position, let's find it from the beginning.
index = tableListFind(pTableListInfo, uid, 0);
taosRUnLockLatch(&pTaskInfo->lock);
if (index >= 0) {
- pScanInfo->tableEndIndex = index;
+ pScanInfo->currentTable = index;
} else {
qError("vgId:%d uid:%" PRIu64 " not found in table list, total:%d, index:%d %s", pTaskInfo->id.vgId, uid,
- numOfTables, pScanInfo->tableEndIndex, id);
+ numOfTables, pScanInfo->currentTable, id);
terrno = TSDB_CODE_PAR_INTERNAL_ERROR;
return -1;
}
@@ -1310,12 +1259,12 @@ int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subT
}
qDebug("tsdb reader created with offset(snapshot) uid:%" PRId64 " ts:%" PRId64 " table index:%d, total:%d, %s",
- uid, pScanBaseInfo->cond.twindows.skey, pScanInfo->tableEndIndex, numOfTables, id);
+ uid, pScanBaseInfo->cond.twindows.skey, pScanInfo->currentTable, numOfTables, id);
} else {
pTaskInfo->storageAPI.tsdReader.tsdSetQueryTableList(pScanBaseInfo->dataReader, &keyInfo, 1);
pTaskInfo->storageAPI.tsdReader.tsdReaderResetStatus(pScanBaseInfo->dataReader, &pScanBaseInfo->cond);
qDebug("tsdb reader offset seek snapshot to uid:%" PRId64 " ts %" PRId64 " table index:%d numOfTable:%d, %s",
- uid, pScanBaseInfo->cond.twindows.skey, pScanInfo->tableEndIndex, numOfTables, id);
+ uid, pScanBaseInfo->cond.twindows.skey, pScanInfo->currentTable, numOfTables, id);
}
// restore the key value
diff --git a/source/libs/executor/src/executorInt.c b/source/libs/executor/src/executorInt.c
index ff4d3d0d27..76dc622cfd 100644
--- a/source/libs/executor/src/executorInt.c
+++ b/source/libs/executor/src/executorInt.c
@@ -311,6 +311,7 @@ static int32_t doSetInputDataBlock(SExprSupp* pExprSup, SSDataBlock* pBlock, int
pInput->totalRows = pBlock->info.rows;
pInput->numOfRows = pBlock->info.rows;
pInput->startRowIndex = 0;
+ pInput->blankFill = pBlock->info.blankFill;
// NOTE: the last parameter is the primary timestamp column
// todo: refactor this
@@ -325,6 +326,7 @@ static int32_t doSetInputDataBlock(SExprSupp* pExprSup, SSDataBlock* pBlock, int
pInput->totalRows = pBlock->info.rows;
pInput->numOfRows = pBlock->info.rows;
pInput->startRowIndex = 0;
+ pInput->blankFill = pBlock->info.blankFill;
code = doCreateConstantValColumnInfo(pInput, pFuncParam, j, pBlock->info.rows);
if (code != TSDB_CODE_SUCCESS) {
diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c
index b60731a286..dfe206c717 100644
--- a/source/libs/executor/src/scanoperator.c
+++ b/source/libs/executor/src/scanoperator.c
@@ -657,33 +657,19 @@ void setTbNameColData(const SSDataBlock* pBlock, SColumnInfoData* pColInfoData,
static void initNextGroupScan(STableScanInfo* pInfo, STableKeyInfo** pKeyInfo, int32_t* size) {
- pInfo->tableStartIndex = pInfo->tableEndIndex + 1;
+ tableListGetGroupList(pInfo->base.pTableListInfo, pInfo->currentGroupId, pKeyInfo, size);
- STableListInfo* pTableListInfo = pInfo->base.pTableListInfo;
- int32_t numOfTables = tableListGetSize(pTableListInfo);
- STableKeyInfo* pStart = (STableKeyInfo*)tableListGetInfo(pTableListInfo, pInfo->tableStartIndex);
+ pInfo->tableStartIndex = TARRAY_ELEM_IDX(pInfo->base.pTableListInfo->pTableList, *pKeyInfo);
- if (pTableListInfo->oneTableForEachGroup) {
- pInfo->tableEndIndex = pInfo->tableStartIndex;
- } else if (pTableListInfo->groupOffset) {
- pInfo->currentGroupIndex++;
- if (pInfo->currentGroupIndex + 1 < pTableListInfo->numOfOuputGroups) {
- pInfo->tableEndIndex = pTableListInfo->groupOffset[pInfo->currentGroupIndex + 1] - 1;
- } else {
- pInfo->tableEndIndex = numOfTables - 1;
- }
- } else {
- pInfo->tableEndIndex = numOfTables - 1;
- }
+ pInfo->tableEndIndex = (pInfo->tableStartIndex + (*size) - 1);
+
+ pInfo->pResBlock->info.blankFill = false;
if (!pInfo->needCountEmptyTable) {
pInfo->countState = TABLE_COUNT_STATE_END;
} else {
pInfo->countState = TABLE_COUNT_STATE_SCAN;
}
-
- *pKeyInfo = pStart;
- *size = pInfo->tableEndIndex - pInfo->tableStartIndex + 1;
}
void markGroupProcessed(STableScanInfo* pInfo, uint64_t groupId) {
@@ -703,6 +689,7 @@ static SSDataBlock* getOneRowResultBlock(SExecTaskInfo* pTaskInfo, STableScanBas
pBlock->info.rows = 1;
pBlock->info.id.uid = tbInfo->uid;
pBlock->info.id.groupId = tbInfo->groupId;
+ pBlock->info.blankFill = true;
// only one row: set all col data to null & hasNull
int32_t col_num = blockDataGetNumOfCols(pBlock);
@@ -712,7 +699,7 @@ static SSDataBlock* getOneRowResultBlock(SExecTaskInfo* pTaskInfo, STableScanBas
}
// set tag/tbname
- doSetTagColumnData(pBase, pBlock, pTaskInfo, pBlock->info.rows);
+ doSetTagColumnData(pBase, pBlock, pTaskInfo, 1);
return pBlock;
}
@@ -939,7 +926,7 @@ static SSDataBlock* startNextGroupScan(SOperatorInfo* pOperator) {
SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
SStorageAPI* pAPI = &pTaskInfo->storageAPI;
int32_t numOfTables = tableListGetSize(pInfo->base.pTableListInfo);
- if (pInfo->tableEndIndex + 1 >= numOfTables) {
+ if ((++pInfo->currentGroupId) >= tableListGetOutputGroups(pInfo->base.pTableListInfo)) {
setOperatorCompleted(pOperator);
if (pOperator->dynamicTask) {
taosArrayClear(pInfo->base.pTableListInfo->pTableList);
@@ -978,13 +965,14 @@ static SSDataBlock* groupSeqTableScan(SOperatorInfo* pOperator) {
int32_t num = 0;
STableKeyInfo* pList = NULL;
- if (pInfo->tableEndIndex == -1) {
+ if (pInfo->currentGroupId == -1) {
int32_t numOfTables = tableListGetSize(pInfo->base.pTableListInfo);
- if (pInfo->tableEndIndex + 1 == numOfTables) {
+ if ((++pInfo->currentGroupId) >= tableListGetOutputGroups(pInfo->base.pTableListInfo)) {
setOperatorCompleted(pOperator);
return NULL;
}
-
+
+
initNextGroupScan(pInfo, &pList, &num);
ASSERT(pInfo->base.dataReader == NULL);
@@ -1034,7 +1022,7 @@ static SSDataBlock* doTableScan(SOperatorInfo* pOperator) {
T_LONG_JMP(pTaskInfo->env, code);
}
if (pOperator->status == OP_EXEC_DONE) {
- pInfo->tableEndIndex = -1;
+ pInfo->currentGroupId = -1;
pOperator->status = OP_OPENED;
SSDataBlock* result = NULL;
while (true) {
@@ -1059,23 +1047,23 @@ static SSDataBlock* doTableScan(SOperatorInfo* pOperator) {
}
// if no data, switch to next table and continue scan
- pInfo->tableEndIndex++;
+ pInfo->currentTable++;
taosRLockLatch(&pTaskInfo->lock);
numOfTables = tableListGetSize(pInfo->base.pTableListInfo);
- if (pInfo->tableEndIndex >= numOfTables) {
+ if (pInfo->currentTable >= numOfTables) {
qDebug("all table checked in table list, total:%d, return NULL, %s", numOfTables, GET_TASKID(pTaskInfo));
taosRUnLockLatch(&pTaskInfo->lock);
return NULL;
}
- tInfo = *(STableKeyInfo*)tableListGetInfo(pInfo->base.pTableListInfo, pInfo->tableEndIndex);
+ tInfo = *(STableKeyInfo*)tableListGetInfo(pInfo->base.pTableListInfo, pInfo->currentTable);
taosRUnLockLatch(&pTaskInfo->lock);
pAPI->tsdReader.tsdSetQueryTableList(pInfo->base.dataReader, &tInfo, 1);
qDebug("set uid:%" PRIu64 " into scanner, total tables:%d, index:%d/%d %s", tInfo.uid, numOfTables,
- pInfo->tableEndIndex, numOfTables, GET_TASKID(pTaskInfo));
+ pInfo->currentTable, numOfTables, GET_TASKID(pTaskInfo));
pAPI->tsdReader.tsdReaderResetStatus(pInfo->base.dataReader, &pInfo->base.cond);
pInfo->scanTimes = 0;
@@ -1167,9 +1155,10 @@ SOperatorInfo* createTableScanOperatorInfo(STableScanPhysiNode* pTableScanNode,
if (code != TSDB_CODE_SUCCESS) {
goto _error;
}
+
+ pInfo->currentGroupId = -1;
pInfo->tableEndIndex = -1;
- pInfo->currentGroupIndex = -1;
pInfo->assignBlockUid = pTableScanNode->assignBlockUid;
pInfo->hasGroupByTag = pTableScanNode->pGroupTags ? true : false;
@@ -1265,6 +1254,7 @@ void resetTableScanInfo(STableScanInfo* pTableScanInfo, STimeWindow* pWin, uint6
pTableScanInfo->base.cond.startVersion = 0;
pTableScanInfo->base.cond.endVersion = ver;
pTableScanInfo->scanTimes = 0;
+ pTableScanInfo->currentGroupId = -1;
pTableScanInfo->tableEndIndex = -1;
pTableScanInfo->base.readerAPI.tsdReaderClose(pTableScanInfo->base.dataReader);
pTableScanInfo->base.dataReader = NULL;
@@ -2156,7 +2146,7 @@ static SSDataBlock* doStreamScan(SOperatorInfo* pOperator) {
pTSInfo->base.cond.startVersion = pStreamInfo->fillHistoryVer.minVer;
pTSInfo->base.cond.endVersion = pStreamInfo->fillHistoryVer.maxVer;
pTSInfo->base.cond.twindows = pStreamInfo->fillHistoryWindow;
- qDebug("stream recover step2, verRange:%" PRId64 " - %" PRId64 ", window:%" PRId64 "-%" PRId64 ", %s",
+ qDebug("stream scan step2 (scan wal), verRange:%" PRId64 " - %" PRId64 ", window:%" PRId64 "-%" PRId64 ", %s",
pTSInfo->base.cond.startVersion, pTSInfo->base.cond.endVersion, pTSInfo->base.cond.twindows.skey,
pTSInfo->base.cond.twindows.ekey, id);
pStreamInfo->recoverStep = STREAM_RECOVER_STEP__NONE;
@@ -2168,7 +2158,7 @@ static SSDataBlock* doStreamScan(SOperatorInfo* pOperator) {
pInfo->pTableScanOp->status = OP_OPENED;
pTSInfo->scanTimes = 0;
- pTSInfo->tableEndIndex = -1;
+ pTSInfo->currentGroupId = -1;
}
if (pStreamInfo->recoverStep == STREAM_RECOVER_STEP__SCAN1) {
@@ -3325,26 +3315,16 @@ _error:
return NULL;
}
-static int32_t tableMergeScanDoSkipTable(STableMergeScanInfo* pInfo, SSDataBlock* pBlock) {
- int64_t nRows = 0;
- void* pNum = tSimpleHashGet(pInfo->mTableNumRows, &pBlock->info.id.uid, sizeof(pBlock->info.id.uid));
- if (pNum == NULL) {
- nRows = pBlock->info.rows;
- tSimpleHashPut(pInfo->mTableNumRows, &pBlock->info.id.uid, sizeof(pBlock->info.id.uid), &nRows, sizeof(nRows));
- } else {
- *(int64_t*)pNum = *(int64_t*)pNum + pBlock->info.rows;
- nRows = *(int64_t*)pNum;
- }
-
- if (nRows >= pInfo->mergeLimit) {
- if (pInfo->mSkipTables == NULL) {
+static void tableMergeScanDoSkipTable(uint64_t uid, void* pTableMergeScanInfo) {
+ STableMergeScanInfo* pInfo = pTableMergeScanInfo;
+ if (pInfo->mSkipTables == NULL) {
pInfo->mSkipTables = taosHashInit(pInfo->tableEndIndex - pInfo->tableStartIndex + 1,
taosGetDefaultHashFunction(TSDB_DATA_TYPE_UBIGINT), false, HASH_NO_LOCK);
- }
- int bSkip = 1;
- taosHashPut(pInfo->mSkipTables, &pBlock->info.id.uid, sizeof(pBlock->info.id.uid), &bSkip, sizeof(bSkip));
}
- return TSDB_CODE_SUCCESS;
+ int bSkip = 1;
+ if (pInfo->mSkipTables != NULL) {
+ taosHashPut(pInfo->mSkipTables, &uid, sizeof(uid), &bSkip, sizeof(bSkip));
+ }
}
static void doGetBlockForTableMergeScan(SOperatorInfo* pOperator, bool* pFinished, bool* pSkipped) {
@@ -3460,10 +3440,6 @@ static SSDataBlock* getBlockForTableMergeScan(void* param) {
}
pBlock->info.id.groupId = tableListGetTableGroupId(pInfo->base.pTableListInfo, pBlock->info.id.uid);
- if (pInfo->mergeLimit != -1) {
- tableMergeScanDoSkipTable(pInfo, pBlock);
- }
-
pOperator->resultInfo.totalRows += pBlock->info.rows;
pInfo->base.readRecorder.elapsedTime += (taosGetTimestampUs() - st) / 1000.0;
return pBlock;
@@ -3530,6 +3506,7 @@ int32_t startDurationForGroupTableMergeScan(SOperatorInfo* pOperator) {
pInfo->pSortInputBlock, pTaskInfo->id.str, 0, 0, 0);
tsortSetMergeLimit(pInfo->pSortHandle, pInfo->mergeLimit);
+ tsortSetMergeLimitReachedFp(pInfo->pSortHandle, tableMergeScanDoSkipTable, pInfo);
tsortSetAbortCheckFn(pInfo->pSortHandle, isTaskKilled, pOperator->pTaskInfo);
tsortSetFetchRawDataFp(pInfo->pSortHandle, getBlockForTableMergeScan, NULL, NULL);
@@ -3661,7 +3638,7 @@ SSDataBlock* getSortedTableMergeScanBlockData(SSortHandle* pHandle, SSDataBlock*
terrno = TSDB_CODE_TSC_QUERY_CANCELLED;
T_LONG_JMP(pOperator->pTaskInfo->env, terrno);
}
-
+
bool limitReached = applyLimitOffset(&pInfo->limitInfo, pResBlock, pTaskInfo);
qDebug("%s get sorted row block, rows:%" PRId64 ", limit:%" PRId64, GET_TASKID(pTaskInfo), pResBlock->info.rows,
pInfo->limitInfo.numOfOutputRows);
@@ -3757,8 +3734,6 @@ void destroyTableMergeScanOperatorInfo(void* param) {
taosArrayDestroy(pTableScanInfo->sortSourceParams);
tsortDestroySortHandle(pTableScanInfo->pSortHandle);
pTableScanInfo->pSortHandle = NULL;
- tSimpleHashCleanup(pTableScanInfo->mTableNumRows);
- pTableScanInfo->mTableNumRows = NULL;
taosHashCleanup(pTableScanInfo->mSkipTables);
pTableScanInfo->mSkipTables = NULL;
destroyTableScanBase(&pTableScanInfo->base, &pTableScanInfo->base.readerAPI);
@@ -3850,8 +3825,7 @@ SOperatorInfo* createTableMergeScanOperatorInfo(STableScanPhysiNode* pTableScanN
pInfo->pSortInfo = generateSortByTsInfo(pInfo->base.matchInfo.pList, pInfo->base.cond.order);
pInfo->pSortInputBlock = createOneDataBlock(pInfo->pResBlock, false);
initLimitInfo(pTableScanNode->scan.node.pLimit, pTableScanNode->scan.node.pSlimit, &pInfo->limitInfo);
- pInfo->mTableNumRows = tSimpleHashInit(1024,
- taosGetDefaultHashFunction(TSDB_DATA_TYPE_UBIGINT));
+
pInfo->mergeLimit = -1;
bool hasLimit = pInfo->limitInfo.limit.limit != -1 || pInfo->limitInfo.limit.offset != -1;
if (hasLimit) {
diff --git a/source/libs/executor/src/timewindowoperator.c b/source/libs/executor/src/timewindowoperator.c
index b86253a8d1..57c038e75a 100644
--- a/source/libs/executor/src/timewindowoperator.c
+++ b/source/libs/executor/src/timewindowoperator.c
@@ -30,6 +30,7 @@
typedef struct SSessionAggOperatorInfo {
SOptrBasicInfo binfo;
SAggSupporter aggSup;
+ SExprSupp scalarSupp; // supporter for perform scalar function
SGroupResInfo groupResInfo;
SWindowRowsSup winSup;
bool reptScan; // next round scan
@@ -1407,6 +1408,10 @@ static SSDataBlock* doSessionWindowAgg(SOperatorInfo* pOperator) {
}
pBInfo->pRes->info.scanFlag = pBlock->info.scanFlag;
+ if (pInfo->scalarSupp.pExprInfo != NULL) {
+ SExprSupp* pExprSup = &pInfo->scalarSupp;
+ projectApplyFunctions(pExprSup->pExprInfo, pBlock, pBlock, pExprSup->pCtx, pExprSup->numOfExprs, NULL);
+ }
// the pDataBlock are always the same one, no need to call this again
setInputDataBlock(pSup, pBlock, order, MAIN_SCAN, true);
blockDataUpdateTsWindow(pBlock, pInfo->tsSlotId);
@@ -1531,6 +1536,8 @@ void destroySWindowOperatorInfo(void* param) {
colDataDestroy(&pInfo->twAggSup.timeWindowData);
cleanupAggSup(&pInfo->aggSup);
+ cleanupExprSupp(&pInfo->scalarSupp);
+
cleanupGroupResInfo(&pInfo->groupResInfo);
taosMemoryFreeClear(param);
}
@@ -1570,6 +1577,16 @@ SOperatorInfo* createSessionAggOperatorInfo(SOperatorInfo* downstream, SSessionW
pInfo->reptScan = false;
pInfo->binfo.inputTsOrder = pSessionNode->window.node.inputTsOrder;
pInfo->binfo.outputTsOrder = pSessionNode->window.node.outputTsOrder;
+
+ if (pSessionNode->window.pExprs != NULL) {
+ int32_t numOfScalar = 0;
+ SExprInfo* pScalarExprInfo = createExprInfo(pSessionNode->window.pExprs, NULL, &numOfScalar);
+ code = initExprSupp(&pInfo->scalarSupp, pScalarExprInfo, numOfScalar, &pTaskInfo->storageAPI.functionStore);
+ if (code != TSDB_CODE_SUCCESS) {
+ goto _error;
+ }
+ }
+
code = filterInitFromNode((SNode*)pSessionNode->window.node.pConditions, &pOperator->exprSupp.pFilterInfo, 0);
if (code != TSDB_CODE_SUCCESS) {
goto _error;
diff --git a/source/libs/executor/src/tsort.c b/source/libs/executor/src/tsort.c
index ee1d831a24..3559e57ebc 100644
--- a/source/libs/executor/src/tsort.c
+++ b/source/libs/executor/src/tsort.c
@@ -75,6 +75,9 @@ struct SSortHandle {
bool (*abortCheckFn)(void* param);
void* abortCheckParam;
+
+ void (*mergeLimitReachedFn)(uint64_t tableUid, void* param);
+ void* mergeLimitReachedParam;
};
void tsortSetSingleTableMerge(SSortHandle* pHandle) {
@@ -885,7 +888,7 @@ static int32_t appendDataBlockToPageBuf(SSortHandle* pHandle, SSDataBlock* blk,
int32_t size = blockDataGetSize(blk) + sizeof(int32_t) + taosArrayGetSize(blk->pDataBlock) * sizeof(int32_t);
ASSERT(size <= getBufPageSize(pHandle->pBuf));
-
+
blockDataToBuf(pPage, blk);
setBufPageDirty(pPage, true);
@@ -1040,6 +1043,39 @@ static int32_t sortBlocksToExtSource(SSortHandle* pHandle, SArray* aBlk, SBlockO
return 0;
}
+static SSDataBlock* getRowsBlockWithinMergeLimit(const SSortHandle* pHandle, SSHashObj* mTableNumRows, SSDataBlock* pOrigBlk, bool* pExtractedBlock) {
+ int64_t nRows = 0;
+ int64_t prevRows = 0;
+ void* pNum = tSimpleHashGet(mTableNumRows, &pOrigBlk->info.id.uid, sizeof(pOrigBlk->info.id.uid));
+ if (pNum == NULL) {
+ prevRows = 0;
+ nRows = pOrigBlk->info.rows;
+ tSimpleHashPut(mTableNumRows, &pOrigBlk->info.id.uid, sizeof(pOrigBlk->info.id.uid), &nRows, sizeof(nRows));
+ } else {
+ prevRows = *(int64_t*)pNum;
+ *(int64_t*)pNum = *(int64_t*)pNum + pOrigBlk->info.rows;
+ nRows = *(int64_t*)pNum;
+ }
+
+ int64_t keepRows = pOrigBlk->info.rows;
+ if (nRows >= pHandle->mergeLimit) {
+ if (pHandle->mergeLimitReachedFn) {
+ pHandle->mergeLimitReachedFn(pOrigBlk->info.id.uid, pHandle->mergeLimitReachedParam);
+ }
+ keepRows = pHandle->mergeLimit - prevRows;
+ }
+
+ SSDataBlock* pBlock = NULL;
+ if (keepRows != pOrigBlk->info.rows) {
+ pBlock = blockDataExtractBlock(pOrigBlk, 0, keepRows);
+ *pExtractedBlock = true;
+ } else {
+ *pExtractedBlock = false;
+ pBlock = pOrigBlk;
+ }
+ return pBlock;
+}
+
static int32_t createBlocksMergeSortInitialSources(SSortHandle* pHandle) {
SBlockOrderInfo* pOrder = taosArrayGet(pHandle->pSortInfo, 0);
size_t nSrc = taosArrayGetSize(pHandle->pOrderedSource);
@@ -1062,10 +1098,18 @@ static int32_t createBlocksMergeSortInitialSources(SSortHandle* pHandle) {
pHandle->currMergeLimitTs = INT64_MIN;
}
+ SSHashObj* mTableNumRows = tSimpleHashInit(8192, taosGetDefaultHashFunction(TSDB_DATA_TYPE_UBIGINT));
SArray* aBlkSort = taosArrayInit(8, POINTER_BYTES);
SSHashObj* mUidBlk = tSimpleHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_UBIGINT));
while (1) {
SSDataBlock* pBlk = pHandle->fetchfp(pSrc->param);
+
+ int64_t p = taosGetTimestampUs();
+ bool bExtractedBlock = false;
+ if (pBlk != NULL && pHandle->mergeLimit > 0) {
+ pBlk = getRowsBlockWithinMergeLimit(pHandle, mTableNumRows, pBlk, &bExtractedBlock);
+ }
+
if (pBlk != NULL) {
SColumnInfoData* tsCol = taosArrayGet(pBlk->pDataBlock, pOrder->slotId);
int64_t firstRowTs = *(int64_t*)tsCol->pData;
@@ -1074,6 +1118,7 @@ static int32_t createBlocksMergeSortInitialSources(SSortHandle* pHandle) {
continue;
}
}
+
if (pBlk != NULL) {
szSort += blockDataGetSize(pBlk);
@@ -1081,8 +1126,11 @@ static int32_t createBlocksMergeSortInitialSources(SSortHandle* pHandle) {
if (ppBlk != NULL) {
SSDataBlock* tBlk = *(SSDataBlock**)(ppBlk);
blockDataMerge(tBlk, pBlk);
+ if (bExtractedBlock) {
+ blockDataDestroy(pBlk);
+ }
} else {
- SSDataBlock* tBlk = createOneDataBlock(pBlk, true);
+ SSDataBlock* tBlk = (bExtractedBlock) ? pBlk : createOneDataBlock(pBlk, true);
tSimpleHashPut(mUidBlk, &pBlk->info.id.uid, sizeof(pBlk->info.id.uid), &tBlk, POINTER_BYTES);
taosArrayPush(aBlkSort, &tBlk);
}
@@ -1091,7 +1139,6 @@ static int32_t createBlocksMergeSortInitialSources(SSortHandle* pHandle) {
if ((pBlk != NULL && szSort > maxBufSize) || (pBlk == NULL && szSort > 0)) {
tSimpleHashClear(mUidBlk);
- int64_t p = taosGetTimestampUs();
code = sortBlocksToExtSource(pHandle, aBlkSort, pOrder, aExtSrc);
if (code != TSDB_CODE_SUCCESS) {
tSimpleHashCleanup(mUidBlk);
@@ -1131,7 +1178,7 @@ static int32_t createBlocksMergeSortInitialSources(SSortHandle* pHandle) {
taosArrayAddAll(pHandle->pOrderedSource, aExtSrc);
}
taosArrayDestroy(aExtSrc);
-
+ tSimpleHashCleanup(mTableNumRows);
pHandle->type = SORT_SINGLESOURCE_SORT;
return TSDB_CODE_SUCCESS;
}
@@ -1287,7 +1334,6 @@ static bool tsortOpenForBufMergeSort(SSortHandle* pHandle) {
int32_t tsortClose(SSortHandle* pHandle) {
atomic_val_compare_exchange_8(&pHandle->closed, 0, 1);
- taosMsleep(10);
return TSDB_CODE_SUCCESS;
}
@@ -1610,3 +1656,8 @@ int32_t tsortCompAndBuildKeys(const SArray* pSortCols, char* keyBuf, int32_t* ke
}
return ret;
}
+
+void tsortSetMergeLimitReachedFp(SSortHandle* pHandle, void (*mergeLimitReachedCb)(uint64_t tableUid, void* param), void* param) {
+ pHandle->mergeLimitReachedFn = mergeLimitReachedCb;
+ pHandle->mergeLimitReachedParam = param;
+}
diff --git a/source/libs/executor/test/timewindowTest.cpp b/source/libs/executor/test/timewindowTest.cpp
index 3639bf15e1..7ccbf0b10f 100644
--- a/source/libs/executor/test/timewindowTest.cpp
+++ b/source/libs/executor/test/timewindowTest.cpp
@@ -19,6 +19,7 @@
#include "thash.h"
#include "tsimplehash.h"
#include "executor.h"
+#include "executorInt.h"
#include "ttime.h"
#pragma GCC diagnostic push
@@ -186,4 +187,20 @@ TEST(testCase, timewindow_natural) {
ASSERT_EQ(w3.skey, w4.skey);
ASSERT_EQ(w3.ekey, w4.ekey);
}
+
+
+TEST(testCase, timewindow_active) {
+ osSetTimezone("CST");
+ int32_t precision = TSDB_TIME_PRECISION_MILLI;
+ int64_t offset = (int64_t)2*365*24*60*60*1000;
+ SInterval interval = createInterval(10, 10, offset, 'y', 'y', 0, precision);
+ SResultRowInfo dumyInfo = {0};
+ dumyInfo.cur.pageId = -1;
+ int64_t key = (int64_t)1609430400*1000; // 2021-01-01
+ STimeWindow win = getActiveTimeWindow(NULL, &dumyInfo, key, &interval, TSDB_ORDER_ASC);
+ printTimeWindow(&win, precision, key);
+ printf("%ld win %ld, %ld\n", key, win.skey, win.ekey);
+ ASSERT_EQ(win.skey, 1325376000000);
+ ASSERT_EQ(win.ekey, 1640908799999);
+}
#pragma GCC diagnostic pop
\ No newline at end of file
diff --git a/source/libs/function/src/builtins.c b/source/libs/function/src/builtins.c
index 79b2e6fb73..1238401a47 100644
--- a/source/libs/function/src/builtins.c
+++ b/source/libs/function/src/builtins.c
@@ -1319,10 +1319,13 @@ static bool validateStateOper(const SValueNode* pVal) {
if (TSDB_DATA_TYPE_BINARY != pVal->node.resType.type) {
return false;
}
- return (
- 0 == strncasecmp(varDataVal(pVal->datum.p), "GT", 2) || 0 == strncasecmp(varDataVal(pVal->datum.p), "GE", 2) ||
- 0 == strncasecmp(varDataVal(pVal->datum.p), "LT", 2) || 0 == strncasecmp(varDataVal(pVal->datum.p), "LE", 2) ||
- 0 == strncasecmp(varDataVal(pVal->datum.p), "EQ", 2) || 0 == strncasecmp(varDataVal(pVal->datum.p), "NE", 2));
+ if (strlen(varDataVal(pVal->datum.p)) == 2) {
+ return (
+ 0 == strncasecmp(varDataVal(pVal->datum.p), "GT", 2) || 0 == strncasecmp(varDataVal(pVal->datum.p), "GE", 2) ||
+ 0 == strncasecmp(varDataVal(pVal->datum.p), "LT", 2) || 0 == strncasecmp(varDataVal(pVal->datum.p), "LE", 2) ||
+ 0 == strncasecmp(varDataVal(pVal->datum.p), "EQ", 2) || 0 == strncasecmp(varDataVal(pVal->datum.p), "NE", 2));
+ }
+ return false;
}
static int32_t translateStateCount(SFunctionNode* pFunc, char* pErrBuf, int32_t len) {
@@ -3752,7 +3755,11 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
.translateFunc = translateTbUidColumn,
.getEnvFunc = NULL,
.initFunc = NULL,
+#ifdef BUILD_NO_CALL
.sprocessFunc = qTbUidFunction,
+#else
+ .sprocessFunc = NULL,
+#endif
.finalizeFunc = NULL
},
{
@@ -3762,7 +3769,11 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
.translateFunc = translateVgIdColumn,
.getEnvFunc = NULL,
.initFunc = NULL,
+#ifdef BUILD_NO_CALL
.sprocessFunc = qVgIdFunction,
+#else
+ .sprocessFunc = NULL,
+#endif
.finalizeFunc = NULL
},
{
diff --git a/source/libs/function/src/builtinsimpl.c b/source/libs/function/src/builtinsimpl.c
index 000f634fe5..5ab6d5e075 100644
--- a/source/libs/function/src/builtinsimpl.c
+++ b/source/libs/function/src/builtinsimpl.c
@@ -499,6 +499,9 @@ static int64_t getNumOfElems(SqlFunctionCtx* pCtx) {
*/
SInputColumnInfoData* pInput = &pCtx->input;
SColumnInfoData* pInputCol = pInput->pData[0];
+ if(1 == pInput->numOfRows && pInput->blankFill) {
+ return 0;
+ }
if (pInput->colDataSMAIsSet && pInput->totalRows == pInput->numOfRows) {
numOfElem = pInput->numOfRows - pInput->pColumnDataAgg[0]->numOfNull;
} else {
@@ -6022,7 +6025,7 @@ int32_t groupKeyFunction(SqlFunctionCtx* pCtx) {
goto _group_key_over;
}
- if (colDataIsNull_s(pInputCol, startIndex)) {
+ if (pInputCol->pData == NULL || colDataIsNull_s(pInputCol, startIndex)) {
pInfo->isNull = true;
pInfo->hasResult = true;
goto _group_key_over;
diff --git a/source/libs/nodes/src/nodesCodeFuncs.c b/source/libs/nodes/src/nodesCodeFuncs.c
index efb637f17e..08ac5fd8c6 100644
--- a/source/libs/nodes/src/nodesCodeFuncs.c
+++ b/source/libs/nodes/src/nodesCodeFuncs.c
@@ -193,6 +193,8 @@ const char* nodesNodeName(ENodeType type) {
return "GrantStmt";
case QUERY_NODE_REVOKE_STMT:
return "RevokeStmt";
+ case QUERY_NODE_ALTER_CLUSTER_STMT:
+ return "AlterClusterStmt";
case QUERY_NODE_SHOW_DNODES_STMT:
return "ShowDnodesStmt";
case QUERY_NODE_SHOW_MNODES_STMT:
@@ -262,7 +264,13 @@ const char* nodesNodeName(ENodeType type) {
case QUERY_NODE_SHOW_COMPACTS_STMT:
return "ShowCompactsStmt";
case QUERY_NODE_SHOW_COMPACT_DETAILS_STMT:
- return "ShowCompactDetailsStmt";
+ return "ShowCompactDetailsStmt";
+ case QUERY_NODE_SHOW_GRANTS_FULL_STMT:
+ return "ShowGrantsFullStmt";
+ case QUERY_NODE_SHOW_GRANTS_LOGS_STMT:
+ return "ShowGrantsLogsStmt";
+ case QUERY_NODE_SHOW_CLUSTER_MACHINES_STMT:
+ return "ShowClusterMachinesStmt";
case QUERY_NODE_DELETE_STMT:
return "DeleteStmt";
case QUERY_NODE_INSERT_STMT:
@@ -6164,6 +6172,31 @@ static int32_t jsonToDropConsumerGroupStmt(const SJson* pJson, void* pObj) {
return code;
}
+static const char* jkAlterClusterStmtConfig = "Config";
+static const char* jkAlterClusterStmtValue = "Value";
+
+static int32_t alterClusterStmtToJson(const void* pObj, SJson* pJson) {
+ const SAlterClusterStmt* pNode = (const SAlterClusterStmt*)pObj;
+
+ int32_t code = tjsonAddStringToObject(pJson, jkAlterClusterStmtConfig, pNode->config);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonAddStringToObject(pJson, jkAlterClusterStmtValue, pNode->value);
+ }
+
+ return code;
+}
+
+static int32_t jsonToAlterClusterStmt(const SJson* pJson, void* pObj) {
+ SAlterClusterStmt* pNode = (SAlterClusterStmt*)pObj;
+
+ int32_t code = tjsonGetStringValue(pJson, jkAlterClusterStmtConfig, pNode->config);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonGetStringValue(pJson, jkAlterClusterStmtValue, pNode->value);
+ }
+
+ return code;
+}
+
static const char* jkAlterLocalStmtConfig = "Config";
static const char* jkAlterLocalStmtValue = "Value";
@@ -6561,6 +6594,18 @@ static int32_t showVariablesStmtToJson(const void* pObj, SJson* pJson) { return
static int32_t jsonToShowVariablesStmt(const SJson* pJson, void* pObj) { return jsonToShowStmt(pJson, pObj); }
+static int32_t showGrantsFullStmtToJson(const void* pObj, SJson* pJson) { return showStmtToJson(pObj, pJson); }
+
+static int32_t jsonToShowGrantsFullStmt(const SJson* pJson, void* pObj) { return jsonToShowStmt(pJson, pObj); }
+
+static int32_t showGrantsLogsStmtToJson(const void* pObj, SJson* pJson) { return showStmtToJson(pObj, pJson); }
+
+static int32_t showClusterMachinesStmtToJson(const void* pObj, SJson* pJson) { return showStmtToJson(pObj, pJson); }
+
+static int32_t jsonToShowGrantsLogsStmt(const SJson* pJson, void* pObj) { return jsonToShowStmt(pJson, pObj); }
+
+static int32_t jsonToShowClusterMachinesStmt(const SJson* pJson, void* pObj) { return jsonToShowStmt(pJson, pObj); }
+
static const char* jkShowDnodeVariablesStmtDnodeId = "DnodeId";
static const char* jkShowDnodeVariablesStmtLikePattern = "LikePattern";
@@ -7016,6 +7061,8 @@ static int32_t specificNodeToJson(const void* pObj, SJson* pJson) {
return grantStmtToJson(pObj, pJson);
case QUERY_NODE_REVOKE_STMT:
return revokeStmtToJson(pObj, pJson);
+ case QUERY_NODE_ALTER_CLUSTER_STMT:
+ return alterClusterStmtToJson(pObj, pJson);
case QUERY_NODE_SHOW_DNODES_STMT:
return showDnodesStmtToJson(pObj, pJson);
case QUERY_NODE_SHOW_MNODES_STMT:
@@ -7046,6 +7093,12 @@ static int32_t specificNodeToJson(const void* pObj, SJson* pJson) {
return showConsumersStmtToJson(pObj, pJson);
case QUERY_NODE_SHOW_VARIABLES_STMT:
return showVariablesStmtToJson(pObj, pJson);
+ case QUERY_NODE_SHOW_GRANTS_FULL_STMT:
+ return showGrantsFullStmtToJson(pObj, pJson);
+ case QUERY_NODE_SHOW_GRANTS_LOGS_STMT:
+ return showGrantsLogsStmtToJson(pObj, pJson);
+ case QUERY_NODE_SHOW_CLUSTER_MACHINES_STMT:
+ return showClusterMachinesStmtToJson(pObj, pJson);
case QUERY_NODE_SHOW_DNODE_VARIABLES_STMT:
return showDnodeVariablesStmtToJson(pObj, pJson);
case QUERY_NODE_SHOW_TRANSACTIONS_STMT:
@@ -7340,6 +7393,8 @@ static int32_t jsonToSpecificNode(const SJson* pJson, void* pObj) {
return jsonToGrantStmt(pJson, pObj);
case QUERY_NODE_REVOKE_STMT:
return jsonToRevokeStmt(pJson, pObj);
+ case QUERY_NODE_ALTER_CLUSTER_STMT:
+ return jsonToAlterClusterStmt(pJson, pObj);
case QUERY_NODE_SHOW_DNODES_STMT:
return jsonToShowDnodesStmt(pJson, pObj);
case QUERY_NODE_SHOW_MNODES_STMT:
@@ -7370,6 +7425,12 @@ static int32_t jsonToSpecificNode(const SJson* pJson, void* pObj) {
return jsonToShowConsumersStmt(pJson, pObj);
case QUERY_NODE_SHOW_VARIABLES_STMT:
return jsonToShowVariablesStmt(pJson, pObj);
+ case QUERY_NODE_SHOW_GRANTS_FULL_STMT:
+ return jsonToShowGrantsFullStmt(pJson, pObj);
+ case QUERY_NODE_SHOW_GRANTS_LOGS_STMT:
+ return jsonToShowGrantsLogsStmt(pJson, pObj);
+ case QUERY_NODE_SHOW_CLUSTER_MACHINES_STMT:
+ return jsonToShowClusterMachinesStmt(pJson, pObj);
case QUERY_NODE_SHOW_DNODE_VARIABLES_STMT:
return jsonToShowDnodeVariablesStmt(pJson, pObj);
case QUERY_NODE_SHOW_TRANSACTIONS_STMT:
diff --git a/source/libs/nodes/src/nodesTraverseFuncs.c b/source/libs/nodes/src/nodesTraverseFuncs.c
index b3623a4b0a..8b44e478c0 100644
--- a/source/libs/nodes/src/nodesTraverseFuncs.c
+++ b/source/libs/nodes/src/nodesTraverseFuncs.c
@@ -214,14 +214,15 @@ void nodesWalkExprsPostOrder(SNodeList* pList, FNodeWalker walker, void* pContex
(void)walkExprs(pList, TRAVERSAL_POSTORDER, walker, pContext);
}
-static void checkParamIsFunc(SFunctionNode *pFunc) {
+static void checkParamIsFunc(SFunctionNode* pFunc) {
int32_t numOfParams = LIST_LENGTH(pFunc->pParameterList);
- if (numOfParams > 1) {
- for (int32_t i = 0; i < numOfParams; ++i) {
- SNode* pPara = nodesListGetNode(pFunc->pParameterList, i);
- if (nodeType(pPara) == QUERY_NODE_FUNCTION) {
- ((SFunctionNode *)pPara)->node.asParam = true;
- }
+ for (int32_t i = 0; i < numOfParams; ++i) {
+ SNode* pPara = nodesListGetNode(pFunc->pParameterList, i);
+ if (numOfParams > 1 && nodeType(pPara) == QUERY_NODE_FUNCTION) {
+ ((SFunctionNode*)pPara)->node.asParam = true;
+ }
+ if (nodeType(pPara) == QUERY_NODE_COLUMN) {
+ ((SColumnNode*)pPara)->node.asParam = true;
}
}
}
diff --git a/source/libs/nodes/src/nodesUtilFuncs.c b/source/libs/nodes/src/nodesUtilFuncs.c
index e746649add..2d9aecf725 100644
--- a/source/libs/nodes/src/nodesUtilFuncs.c
+++ b/source/libs/nodes/src/nodesUtilFuncs.c
@@ -409,6 +409,8 @@ SNode* nodesMakeNode(ENodeType type) {
return makeNode(type, sizeof(SGrantStmt));
case QUERY_NODE_REVOKE_STMT:
return makeNode(type, sizeof(SRevokeStmt));
+ case QUERY_NODE_ALTER_CLUSTER_STMT:
+ return makeNode(type, sizeof(SAlterClusterStmt));
case QUERY_NODE_SHOW_DNODES_STMT:
case QUERY_NODE_SHOW_MNODES_STMT:
case QUERY_NODE_SHOW_MODULES_STMT:
@@ -439,6 +441,9 @@ SNode* nodesMakeNode(ENodeType type) {
case QUERY_NODE_SHOW_TAGS_STMT:
case QUERY_NODE_SHOW_USER_PRIVILEGES_STMT:
case QUERY_NODE_SHOW_VIEWS_STMT:
+ case QUERY_NODE_SHOW_GRANTS_FULL_STMT:
+ case QUERY_NODE_SHOW_GRANTS_LOGS_STMT:
+ case QUERY_NODE_SHOW_CLUSTER_MACHINES_STMT:
return makeNode(type, sizeof(SShowStmt));
case QUERY_NODE_SHOW_TABLE_TAGS_STMT:
return makeNode(type, sizeof(SShowTableTagsStmt));
@@ -1048,6 +1053,8 @@ void nodesDestroyNode(SNode* pNode) {
case QUERY_NODE_REVOKE_STMT:
nodesDestroyNode(((SRevokeStmt*)pNode)->pTagCond);
break;
+ case QUERY_NODE_ALTER_CLUSTER_STMT: // no pointer field
+ break;
case QUERY_NODE_SHOW_DNODES_STMT:
case QUERY_NODE_SHOW_MNODES_STMT:
case QUERY_NODE_SHOW_MODULES_STMT:
@@ -1077,7 +1084,10 @@ void nodesDestroyNode(SNode* pNode) {
case QUERY_NODE_SHOW_SUBSCRIPTIONS_STMT:
case QUERY_NODE_SHOW_TAGS_STMT:
case QUERY_NODE_SHOW_USER_PRIVILEGES_STMT:
- case QUERY_NODE_SHOW_VIEWS_STMT: {
+ case QUERY_NODE_SHOW_VIEWS_STMT:
+ case QUERY_NODE_SHOW_GRANTS_FULL_STMT:
+ case QUERY_NODE_SHOW_GRANTS_LOGS_STMT:
+ case QUERY_NODE_SHOW_CLUSTER_MACHINES_STMT: {
SShowStmt* pStmt = (SShowStmt*)pNode;
nodesDestroyNode(pStmt->pDbName);
nodesDestroyNode(pStmt->pTbName);
diff --git a/source/libs/parser/inc/parAst.h b/source/libs/parser/inc/parAst.h
index c3f2a53f7b..8b45ed6f66 100644
--- a/source/libs/parser/inc/parAst.h
+++ b/source/libs/parser/inc/parAst.h
@@ -225,6 +225,7 @@ SNode* createCreateTopicStmtUseTable(SAstCreateContext* pCxt, bool ignoreExists,
int8_t withMeta, SNode* pWhere);
SNode* createDropTopicStmt(SAstCreateContext* pCxt, bool ignoreNotExists, SToken* pTopicName);
SNode* createDropCGroupStmt(SAstCreateContext* pCxt, bool ignoreNotExists, SToken* pCGroupId, SToken* pTopicName);
+SNode* createAlterClusterStmt(SAstCreateContext* pCxt, const SToken* pConfig, const SToken* pValue);
SNode* createAlterLocalStmt(SAstCreateContext* pCxt, const SToken* pConfig, const SToken* pValue);
SNode* createDefaultExplainOptions(SAstCreateContext* pCxt);
SNode* setExplainVerbose(SAstCreateContext* pCxt, SNode* pOptions, const SToken* pVal);
diff --git a/source/libs/parser/inc/sql.y b/source/libs/parser/inc/sql.y
index 0479fce255..d2d120fa93 100755
--- a/source/libs/parser/inc/sql.y
+++ b/source/libs/parser/inc/sql.y
@@ -172,6 +172,10 @@ force_opt(A) ::= FORCE.
%destructor unsafe_opt { }
unsafe_opt(A) ::= UNSAFE. { A = true; }
+/************************************************ alter cluster *********************************************************/
+cmd ::= ALTER CLUSTER NK_STRING(A). { pCxt->pRootNode = createAlterClusterStmt(pCxt, &A, NULL); }
+cmd ::= ALTER CLUSTER NK_STRING(A) NK_STRING(B). { pCxt->pRootNode = createAlterClusterStmt(pCxt, &A, &B); }
+
/************************************************ alter local *********************************************************/
cmd ::= ALTER LOCAL NK_STRING(A). { pCxt->pRootNode = createAlterLocalStmt(pCxt, &A, NULL); }
cmd ::= ALTER LOCAL NK_STRING(A) NK_STRING(B). { pCxt->pRootNode = createAlterLocalStmt(pCxt, &A, &B); }
@@ -483,6 +487,9 @@ cmd ::= SHOW APPS.
cmd ::= SHOW CONNECTIONS. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONNECTIONS_STMT); }
cmd ::= SHOW LICENCES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LICENCES_STMT); }
cmd ::= SHOW GRANTS. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LICENCES_STMT); }
+cmd ::= SHOW GRANTS FULL. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_GRANTS_FULL_STMT); }
+cmd ::= SHOW GRANTS LOGS. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_GRANTS_LOGS_STMT); }
+cmd ::= SHOW CLUSTER MACHINES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CLUSTER_MACHINES_STMT); }
cmd ::= SHOW CREATE DATABASE db_name(A). { pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &A); }
cmd ::= SHOW CREATE TABLE full_table_name(A). { pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, A); }
cmd ::= SHOW CREATE STABLE full_table_name(A). { pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, A); }
diff --git a/source/libs/parser/src/parAstCreater.c b/source/libs/parser/src/parAstCreater.c
index 8e89ae1f53..689153010a 100644
--- a/source/libs/parser/src/parAstCreater.c
+++ b/source/libs/parser/src/parAstCreater.c
@@ -2187,6 +2187,17 @@ SNode* createDropCGroupStmt(SAstCreateContext* pCxt, bool ignoreNotExists, SToke
return (SNode*)pStmt;
}
+SNode* createAlterClusterStmt(SAstCreateContext* pCxt, const SToken* pConfig, const SToken* pValue) {
+ CHECK_PARSER_STATUS(pCxt);
+ SAlterClusterStmt* pStmt = (SAlterClusterStmt*)nodesMakeNode(QUERY_NODE_ALTER_CLUSTER_STMT);
+ CHECK_OUT_OF_MEM(pStmt);
+ trimString(pConfig->z, pConfig->n, pStmt->config, sizeof(pStmt->config));
+ if (NULL != pValue) {
+ trimString(pValue->z, pValue->n, pStmt->value, sizeof(pStmt->value));
+ }
+ return (SNode*)pStmt;
+}
+
SNode* createAlterLocalStmt(SAstCreateContext* pCxt, const SToken* pConfig, const SToken* pValue) {
CHECK_PARSER_STATUS(pCxt);
SAlterLocalStmt* pStmt = (SAlterLocalStmt*)nodesMakeNode(QUERY_NODE_ALTER_LOCAL_STMT);
diff --git a/source/libs/parser/src/parAstParser.c b/source/libs/parser/src/parAstParser.c
index be272228fe..9b34672418 100644
--- a/source/libs/parser/src/parAstParser.c
+++ b/source/libs/parser/src/parAstParser.c
@@ -619,6 +619,21 @@ static int32_t collectMetaKeyFromShowCompactDetails(SCollectMetaKeyCxt* pCxt, SS
return code;
}
+static int32_t collectMetaKeyFromShowGrantsFull(SCollectMetaKeyCxt* pCxt, SShowStmt* pStmt) {
+ return reserveTableMetaInCache(pCxt->pParseCxt->acctId, TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_GRANTS_FULL,
+ pCxt->pMetaCache);
+}
+
+static int32_t collectMetaKeyFromShowGrantsLogs(SCollectMetaKeyCxt* pCxt, SShowStmt* pStmt) {
+ return reserveTableMetaInCache(pCxt->pParseCxt->acctId, TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_GRANTS_LOGS,
+ pCxt->pMetaCache);
+}
+
+static int32_t collectMetaKeyFromShowClusterMachines(SCollectMetaKeyCxt* pCxt, SShowStmt* pStmt) {
+ return reserveTableMetaInCache(pCxt->pParseCxt->acctId, TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_MACHINES,
+ pCxt->pMetaCache);
+}
+
static int32_t collectMetaKeyFromShowCreateDatabase(SCollectMetaKeyCxt* pCxt, SShowCreateDatabaseStmt* pStmt) {
return reserveDbCfgInCache(pCxt->pParseCxt->acctId, pStmt->dbName, pCxt->pMetaCache);
}
@@ -839,6 +854,12 @@ static int32_t collectMetaKeyFromQuery(SCollectMetaKeyCxt* pCxt, SNode* pStmt) {
return collectMetaKeyFromShowCompacts(pCxt, (SShowStmt*)pStmt);
case QUERY_NODE_SHOW_COMPACT_DETAILS_STMT:
return collectMetaKeyFromShowCompactDetails(pCxt, (SShowStmt*)pStmt);
+ case QUERY_NODE_SHOW_GRANTS_FULL_STMT:
+ return collectMetaKeyFromShowGrantsFull(pCxt, (SShowStmt*)pStmt);
+ case QUERY_NODE_SHOW_GRANTS_LOGS_STMT:
+ return collectMetaKeyFromShowGrantsLogs(pCxt, (SShowStmt*)pStmt);
+ case QUERY_NODE_SHOW_CLUSTER_MACHINES_STMT:
+ return collectMetaKeyFromShowClusterMachines(pCxt, (SShowStmt*)pStmt);
case QUERY_NODE_SHOW_CREATE_DATABASE_STMT:
return collectMetaKeyFromShowCreateDatabase(pCxt, (SShowCreateDatabaseStmt*)pStmt);
case QUERY_NODE_SHOW_CREATE_TABLE_STMT:
diff --git a/source/libs/parser/src/parAuthenticator.c b/source/libs/parser/src/parAuthenticator.c
index 033991f351..c2cd4786db 100644
--- a/source/libs/parser/src/parAuthenticator.c
+++ b/source/libs/parser/src/parAuthenticator.c
@@ -349,6 +349,9 @@ static int32_t authQuery(SAuthCxt* pCxt, SNode* pStmt) {
case QUERY_NODE_SHOW_TABLE_DISTRIBUTED_STMT:
case QUERY_NODE_SHOW_VNODES_STMT:
case QUERY_NODE_SHOW_SCORES_STMT:
+ case QUERY_NODE_SHOW_GRANTS_FULL_STMT:
+ case QUERY_NODE_SHOW_GRANTS_LOGS_STMT:
+ case QUERY_NODE_SHOW_CLUSTER_MACHINES_STMT:
return !pCxt->pParseCxt->enableSysInfo ? TSDB_CODE_PAR_PERMISSION_DENIED : TSDB_CODE_SUCCESS;
case QUERY_NODE_SHOW_TABLES_STMT:
case QUERY_NODE_SHOW_STABLES_STMT:
diff --git a/source/libs/parser/src/parInsertSql.c b/source/libs/parser/src/parInsertSql.c
index 1994ddb437..512dfdaef2 100644
--- a/source/libs/parser/src/parInsertSql.c
+++ b/source/libs/parser/src/parInsertSql.c
@@ -440,14 +440,14 @@ static int32_t parseVarbinary(SToken* pToken, uint8_t **pData, uint32_t *nData,
return TSDB_CODE_PAR_INVALID_VARBINARY;
}
- if(isHex(pToken->z, pToken->n)){
- if(!isValidateHex(pToken->z, pToken->n)){
+ if(isHex(pToken->z + 1, pToken->n - 2)){
+ if(!isValidateHex(pToken->z + 1, pToken->n - 2)){
return TSDB_CODE_PAR_INVALID_VARBINARY;
}
void* data = NULL;
uint32_t size = 0;
- if(taosHex2Ascii(pToken->z, pToken->n, &data, &size) < 0){
+ if(taosHex2Ascii(pToken->z + 1, pToken->n - 2, &data, &size) < 0){
return TSDB_CODE_OUT_OF_MEMORY;
}
@@ -458,11 +458,13 @@ static int32_t parseVarbinary(SToken* pToken, uint8_t **pData, uint32_t *nData,
*pData = data;
*nData = size;
}else{
- if (pToken->n + VARSTR_HEADER_SIZE > bytes) {
+ *pData = taosMemoryCalloc(1, pToken->n);
+ int32_t len = trimString(pToken->z, pToken->n, *pData, pToken->n);
+ *nData = len;
+
+ if (*nData + VARSTR_HEADER_SIZE > bytes) {
return TSDB_CODE_PAR_VALUE_TOO_LONG;
}
- *pData = taosStrdup(pToken->z);
- *nData = pToken->n;
}
return TSDB_CODE_SUCCESS;
}
@@ -753,7 +755,7 @@ static int32_t buildCreateTbReq(SVnodeModifyOpStmt* pStmt, STag* pTag, SArray* p
return TSDB_CODE_SUCCESS;
}
-static int32_t checkAndTrimValue(SToken* pToken, char* tmpTokenBuf, SMsgBuf* pMsgBuf) {
+static int32_t checkAndTrimValue(SToken* pToken, char* tmpTokenBuf, SMsgBuf* pMsgBuf, int8_t type) {
if ((pToken->type != TK_NOW && pToken->type != TK_TODAY && pToken->type != TK_NK_INTEGER &&
pToken->type != TK_NK_STRING && pToken->type != TK_NK_FLOAT && pToken->type != TK_NK_BOOL &&
pToken->type != TK_NULL && pToken->type != TK_NK_HEX && pToken->type != TK_NK_OCT &&
@@ -763,7 +765,7 @@ static int32_t checkAndTrimValue(SToken* pToken, char* tmpTokenBuf, SMsgBuf* pMs
}
// Remove quotation marks
- if (TK_NK_STRING == pToken->type) {
+ if (TK_NK_STRING == pToken->type && type != TSDB_DATA_TYPE_VARBINARY) {
if (pToken->n >= TSDB_MAX_BYTES_PER_ROW) {
return buildSyntaxErrMsg(pMsgBuf, "too long string", pToken->z);
}
@@ -935,7 +937,7 @@ static int32_t parseTagsClauseImpl(SInsertParseContext* pCxt, SVnodeModifyOpStmt
SSchema* pTagSchema = &pSchema[pCxt->tags.pColIndex[i]];
isJson = pTagSchema->type == TSDB_DATA_TYPE_JSON;
- code = checkAndTrimValue(&token, pCxt->tmpTokenBuf, &pCxt->msg);
+ code = checkAndTrimValue(&token, pCxt->tmpTokenBuf, &pCxt->msg, pTagSchema->type);
if (TK_NK_VARIABLE == token.type) {
code = buildSyntaxErrMsg(&pCxt->msg, "not expected tags values ", token.z);
}
@@ -1631,7 +1633,7 @@ static int32_t parseValueTokenImpl(SInsertParseContext* pCxt, const char** pSql,
static int32_t parseValueToken(SInsertParseContext* pCxt, const char** pSql, SToken* pToken, SSchema* pSchema,
int16_t timePrec, SColVal* pVal) {
- int32_t code = checkAndTrimValue(pToken, pCxt->tmpTokenBuf, &pCxt->msg);
+ int32_t code = checkAndTrimValue(pToken, pCxt->tmpTokenBuf, &pCxt->msg, pSchema->type);
if (TSDB_CODE_SUCCESS == code && isNullValue(pSchema->type, pToken)) {
if (TSDB_DATA_TYPE_TIMESTAMP == pSchema->type && PRIMARYKEY_TIMESTAMP_COL_ID == pSchema->colId) {
return buildSyntaxErrMsg(&pCxt->msg, "primary timestamp should not be null", pToken->z);
@@ -1691,7 +1693,7 @@ typedef union SRowsDataContext{
static int32_t parseTbnameToken(SInsertParseContext* pCxt, SStbRowsDataContext* pStbRowsCxt, SToken* pToken, bool* pFoundCtbName) {
*pFoundCtbName = false;
- int32_t code = checkAndTrimValue(pToken, pCxt->tmpTokenBuf, &pCxt->msg);
+ int32_t code = checkAndTrimValue(pToken, pCxt->tmpTokenBuf, &pCxt->msg, TSDB_DATA_TYPE_BINARY);
if (TK_NK_VARIABLE == pToken->type) {
code = buildInvalidOperationMsg(&pCxt->msg, "not expected tbname");
}
@@ -1731,7 +1733,7 @@ static int32_t processCtbTagsAfterCtbName(SInsertParseContext* pCxt, SVnodeModif
for (int32_t i = 0; code == TSDB_CODE_SUCCESS && i < numOfTagTokens; ++i) {
SToken* pTagToken = (SToken*)(tagTokens + i);
SSchema* pTagSchema = tagSchemas[i];
- code = checkAndTrimValue(pTagToken, pCxt->tmpTokenBuf, &pCxt->msg);
+ code = checkAndTrimValue(pTagToken, pCxt->tmpTokenBuf, &pCxt->msg, pTagSchema->type);
if (TK_NK_VARIABLE == pTagToken->type) {
code = buildInvalidOperationMsg(&pCxt->msg, "not expected tag");
}
@@ -1790,7 +1792,7 @@ static int32_t doGetStbRowValues(SInsertParseContext* pCxt, SVnodeModifyOpStmt*
tagSchemas[(*pNumOfTagTokens)] = (SSchema*)pTagSchema;
++(*pNumOfTagTokens);
} else {
- code = checkAndTrimValue(pToken, pCxt->tmpTokenBuf, &pCxt->msg);
+ code = checkAndTrimValue(pToken, pCxt->tmpTokenBuf, &pCxt->msg, pTagSchema->type);
if (TK_NK_VARIABLE == pToken->type) {
code = buildInvalidOperationMsg(&pCxt->msg, "not expected row value");
}
diff --git a/source/libs/parser/src/parInsertUtil.c b/source/libs/parser/src/parInsertUtil.c
index a924ed68b0..6b655bfae6 100644
--- a/source/libs/parser/src/parInsertUtil.c
+++ b/source/libs/parser/src/parInsertUtil.c
@@ -247,13 +247,13 @@ static int32_t createTableDataCxt(STableMeta* pTableMeta, SVCreateTbReq** pCreat
if (NULL == pTableCxt->pData) {
code = TSDB_CODE_OUT_OF_MEMORY;
} else {
- pTableCxt->pData->flags = NULL != *pCreateTbReq ? SUBMIT_REQ_AUTO_CREATE_TABLE : 0;
+ pTableCxt->pData->flags = (pCreateTbReq != NULL && NULL != *pCreateTbReq) ? SUBMIT_REQ_AUTO_CREATE_TABLE : 0;
pTableCxt->pData->flags |= colMode ? SUBMIT_REQ_COLUMN_DATA_FORMAT : 0;
pTableCxt->pData->suid = pTableMeta->suid;
pTableCxt->pData->uid = pTableMeta->uid;
pTableCxt->pData->sver = pTableMeta->sversion;
- pTableCxt->pData->pCreateTbReq = *pCreateTbReq;
- *pCreateTbReq = NULL;
+ pTableCxt->pData->pCreateTbReq = pCreateTbReq != NULL ? *pCreateTbReq : NULL;
+ if(pCreateTbReq != NULL) *pCreateTbReq = NULL;
if (pTableCxt->pData->flags & SUBMIT_REQ_COLUMN_DATA_FORMAT) {
pTableCxt->pData->aCol = taosArrayInit(128, sizeof(SColData));
if (NULL == pTableCxt->pData->aCol) {
@@ -640,12 +640,12 @@ static bool findFileds(SSchema* pSchema, TAOS_FIELD* fields, int numFields) {
return false;
}
-int rawBlockBindData(SQuery* query, STableMeta* pTableMeta, void* data, SVCreateTbReq* pCreateTb, TAOS_FIELD* tFields,
+int rawBlockBindData(SQuery* query, STableMeta* pTableMeta, void* data, SVCreateTbReq** pCreateTb, TAOS_FIELD* tFields,
int numFields, bool needChangeLength) {
void* tmp = taosHashGet(((SVnodeModifyOpStmt*)(query->pRoot))->pTableBlockHashObj, &pTableMeta->uid, sizeof(pTableMeta->uid));
STableDataCxt* pTableCxt = NULL;
int ret = insGetTableDataCxt(((SVnodeModifyOpStmt*)(query->pRoot))->pTableBlockHashObj, &pTableMeta->uid,
- sizeof(pTableMeta->uid), pTableMeta, &pCreateTb, &pTableCxt, true, false);
+ sizeof(pTableMeta->uid), pTableMeta, pCreateTb, &pTableCxt, true, false);
if (ret != TSDB_CODE_SUCCESS) {
uError("insGetTableDataCxt error");
goto end;
@@ -662,6 +662,7 @@ int rawBlockBindData(SQuery* query, STableMeta* pTableMeta, void* data, SVCreate
char* p = (char*)data;
// | version | total length | total rows | total columns | flag seg| block group id | column schema | each column
// length |
+ int32_t version = *(int32_t*)data;
p += sizeof(int32_t);
p += sizeof(int32_t);
@@ -717,7 +718,7 @@ int rawBlockBindData(SQuery* query, STableMeta* pTableMeta, void* data, SVCreate
goto end;
}
fields += sizeof(int8_t) + sizeof(int32_t);
- if (needChangeLength) {
+ if (needChangeLength && version == 1) {
pStart += htonl(colLength[j]);
} else {
pStart += colLength[j];
@@ -748,7 +749,7 @@ int rawBlockBindData(SQuery* query, STableMeta* pTableMeta, void* data, SVCreate
goto end;
}
fields += sizeof(int8_t) + sizeof(int32_t);
- if (needChangeLength) {
+ if (needChangeLength && version == 1) {
pStart += htonl(colLength[i]);
} else {
pStart += colLength[i];
diff --git a/source/libs/parser/src/parTokenizer.c b/source/libs/parser/src/parTokenizer.c
index 072892fe7f..0777835def 100644
--- a/source/libs/parser/src/parTokenizer.c
+++ b/source/libs/parser/src/parTokenizer.c
@@ -109,6 +109,9 @@ static SKeyword keywordTable[] = {
{"GEOMETRY", TK_GEOMETRY},
{"GRANT", TK_GRANT},
{"GRANTS", TK_GRANTS},
+ {"FULL", TK_FULL},
+ {"LOGS", TK_LOGS},
+ {"MACHINES", TK_MACHINES},
{"GROUP", TK_GROUP},
{"HAVING", TK_HAVING},
{"HOST", TK_HOST},
diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c
index 70e4744644..6e94826def 100644
--- a/source/libs/parser/src/parTranslater.c
+++ b/source/libs/parser/src/parTranslater.c
@@ -268,7 +268,25 @@ static const SSysTableShowAdapter sysTableShowAdapter[] = {
.pTableName = TSDB_INS_TABLE_COMPACT_DETAILS,
.numOfShowCols = 1,
.pShowCols = {"*"}
- },
+ },
+ { .showType = QUERY_NODE_SHOW_GRANTS_FULL_STMT,
+ .pDbName = TSDB_INFORMATION_SCHEMA_DB,
+ .pTableName = TSDB_INS_TABLE_GRANTS_FULL,
+ .numOfShowCols = 1,
+ .pShowCols = {"*"}
+ },
+ { .showType = QUERY_NODE_SHOW_GRANTS_LOGS_STMT,
+ .pDbName = TSDB_INFORMATION_SCHEMA_DB,
+ .pTableName = TSDB_INS_TABLE_GRANTS_LOGS,
+ .numOfShowCols = 1,
+ .pShowCols = {"*"}
+ },
+ { .showType = QUERY_NODE_SHOW_CLUSTER_MACHINES_STMT,
+ .pDbName = TSDB_INFORMATION_SCHEMA_DB,
+ .pTableName = TSDB_INS_TABLE_MACHINES,
+ .numOfShowCols = 1,
+ .pShowCols = {"*"}
+ },
};
// clang-format on
@@ -1323,7 +1341,7 @@ static EDealRes translateColumn(STranslateContext* pCxt, SColumnNode** pCol) {
res = translateColumnWithPrefix(pCxt, pCol);
} else {
bool found = false;
- if (SQL_CLAUSE_ORDER_BY == pCxt->currClause) {
+ if (SQL_CLAUSE_ORDER_BY == pCxt->currClause && !(*pCol)->node.asParam) {
res = translateColumnUseAlias(pCxt, pCol, &found);
}
if (DEAL_RES_ERROR != res && !found) {
@@ -1333,6 +1351,10 @@ static EDealRes translateColumn(STranslateContext* pCxt, SColumnNode** pCol) {
res = translateColumnWithoutPrefix(pCxt, pCol);
}
}
+ if(SQL_CLAUSE_ORDER_BY == pCxt->currClause && !(*pCol)->node.asParam
+ && res != DEAL_RES_CONTINUE && res != DEAL_RES_END) {
+ res = translateColumnUseAlias(pCxt, pCol, &found);
+ }
}
return res;
}
@@ -3981,6 +4003,42 @@ static int32_t translateSpecificWindow(STranslateContext* pCxt, SSelectStmt* pSe
return TSDB_CODE_SUCCESS;
}
+static EDealRes collectWindowsPseudocolumns(SNode* pNode, void* pContext) {
+ SNodeList* pCols = (SNodeList*)pContext;
+ if (QUERY_NODE_FUNCTION == nodeType(pNode)) {
+ SFunctionNode* pFunc = (SFunctionNode*)pNode;
+ if (FUNCTION_TYPE_WSTART == pFunc->funcType || FUNCTION_TYPE_WEND == pFunc->funcType ||
+ FUNCTION_TYPE_WDURATION == pFunc->funcType) {
+ nodesListStrictAppend(pCols, nodesCloneNode(pNode));
+ }
+ }
+ return DEAL_RES_CONTINUE;
+}
+
+static int32_t checkWindowsConditonValid(SNode* pNode) {
+ int32_t code = TSDB_CODE_SUCCESS;
+ if(QUERY_NODE_EVENT_WINDOW != nodeType(pNode)) return code;
+
+ SEventWindowNode* pEventWindowNode = (SEventWindowNode*)pNode;
+ SNodeList* pCols = nodesMakeList();
+ if (NULL == pCols) {
+ return TSDB_CODE_OUT_OF_MEMORY;
+ }
+ nodesWalkExpr(pEventWindowNode->pStartCond, collectWindowsPseudocolumns, pCols);
+ if (pCols->length > 0) {
+ code = TSDB_CODE_QRY_INVALID_WINDOW_CONDITION;
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ nodesWalkExpr(pEventWindowNode->pEndCond, collectWindowsPseudocolumns, pCols);
+ if (pCols->length > 0) {
+ code = TSDB_CODE_QRY_INVALID_WINDOW_CONDITION;
+ }
+ }
+
+ nodesDestroyList(pCols);
+ return code;
+}
+
static int32_t translateWindow(STranslateContext* pCxt, SSelectStmt* pSelect) {
if (NULL == pSelect->pWindow) {
return TSDB_CODE_SUCCESS;
@@ -3994,6 +4052,9 @@ static int32_t translateWindow(STranslateContext* pCxt, SSelectStmt* pSelect) {
if (TSDB_CODE_SUCCESS == code) {
code = translateSpecificWindow(pCxt, pSelect);
}
+ if (TSDB_CODE_SUCCESS == code) {
+ code = checkWindowsConditonValid(pSelect->pWindow);
+ }
return code;
}
@@ -4515,6 +4576,9 @@ static EDealRes replaceOrderByAliasImpl(SNode** pNode, void* pContext) {
FOREACH(pProject, pProjectionList) {
SExprNode* pExpr = (SExprNode*)pProject;
if (0 == strcmp(((SColumnRefNode*)*pNode)->colName, pExpr->userAlias) && nodeType(*pNode) == nodeType(pProject)) {
+ if (QUERY_NODE_COLUMN == nodeType(pProject) && !nodesEqualNode(*pNode, pProject)) {
+ continue;
+ }
SNode* pNew = nodesCloneNode(pProject);
if (NULL == pNew) {
pCxt->pTranslateCxt->errCode = TSDB_CODE_OUT_OF_MEMORY;
@@ -5543,6 +5607,11 @@ static int32_t fillCmdSql(STranslateContext* pCxt, int16_t msgType, void* pReq)
FILL_CMD_SQL(sql, sqlLen, pCmdReq, SMDropStreamReq, pReq);
break;
}
+
+ case TDMT_MND_CONFIG_CLUSTER: {
+ FILL_CMD_SQL(sql, sqlLen, pCmdReq, SMCfgClusterReq, pReq);
+ break;
+ }
default: {
break;
}
@@ -6762,6 +6831,16 @@ static int32_t translateRestoreDnode(STranslateContext* pCxt, SRestoreComponentN
return code;
}
+static int32_t translateAlterCluster(STranslateContext* pCxt, SAlterClusterStmt* pStmt) {
+ SMCfgClusterReq cfgReq = {0};
+ strcpy(cfgReq.config, pStmt->config);
+ strcpy(cfgReq.value, pStmt->value);
+
+ int32_t code = buildCmdMsg(pCxt, TDMT_MND_CONFIG_CLUSTER, (FSerializeFunc)tSerializeSMCfgClusterReq, &cfgReq);
+ tFreeSMCfgClusterReq(&cfgReq);
+ return code;
+}
+
static int32_t getSmaIndexDstVgId(STranslateContext* pCxt, const char* pDbName, const char* pTableName,
int32_t* pVgId) {
SVgroupInfo vg = {0};
@@ -8781,6 +8860,9 @@ static int32_t translateQuery(STranslateContext* pCxt, SNode* pNode) {
case QUERY_NODE_COMPACT_DATABASE_STMT:
code = translateCompact(pCxt, (SCompactDatabaseStmt*)pNode);
break;
+ case QUERY_NODE_ALTER_CLUSTER_STMT:
+ code = translateAlterCluster(pCxt, (SAlterClusterStmt*)pNode);
+ break;
case QUERY_NODE_KILL_CONNECTION_STMT:
code = translateKillConnection(pCxt, (SKillStmt*)pNode);
break;
@@ -10627,6 +10709,9 @@ static int32_t rewriteQuery(STranslateContext* pCxt, SQuery* pQuery) {
case QUERY_NODE_SHOW_TAGS_STMT:
case QUERY_NODE_SHOW_USER_PRIVILEGES_STMT:
case QUERY_NODE_SHOW_VIEWS_STMT:
+ case QUERY_NODE_SHOW_GRANTS_FULL_STMT:
+ case QUERY_NODE_SHOW_GRANTS_LOGS_STMT:
+ case QUERY_NODE_SHOW_CLUSTER_MACHINES_STMT:
code = rewriteShow(pCxt, pQuery);
break;
case QUERY_NODE_SHOW_VGROUPS_STMT:
diff --git a/source/libs/parser/src/sql.c b/source/libs/parser/src/sql.c
index 66258ba3a9..25862bb079 100644
--- a/source/libs/parser/src/sql.c
+++ b/source/libs/parser/src/sql.c
@@ -1,5 +1,3 @@
-/* This file is automatically generated by Lemon from input grammar
-** source file "sql.y". */
/*
** 2000-05-29
**
@@ -24,8 +22,9 @@
** The following is the concatenation of all %include directives from the
** input grammar file:
*/
+#include
+#include
/************ Begin %include sections from the grammar ************************/
-#line 11 "sql.y"
#include
#include
@@ -42,359 +41,12 @@
#include "parAst.h"
#define YYSTACKDEPTH 0
-#line 46 "sql.c"
/**************** End of %include directives **********************************/
-/* These constants specify the various numeric values for terminal symbols.
-***************** Begin token definitions *************************************/
-#ifndef TK_OR
-#define TK_OR 1
-#define TK_AND 2
-#define TK_UNION 3
-#define TK_ALL 4
-#define TK_MINUS 5
-#define TK_EXCEPT 6
-#define TK_INTERSECT 7
-#define TK_NK_BITAND 8
-#define TK_NK_BITOR 9
-#define TK_NK_LSHIFT 10
-#define TK_NK_RSHIFT 11
-#define TK_NK_PLUS 12
-#define TK_NK_MINUS 13
-#define TK_NK_STAR 14
-#define TK_NK_SLASH 15
-#define TK_NK_REM 16
-#define TK_NK_CONCAT 17
-#define TK_CREATE 18
-#define TK_ACCOUNT 19
-#define TK_NK_ID 20
-#define TK_PASS 21
-#define TK_NK_STRING 22
-#define TK_ALTER 23
-#define TK_PPS 24
-#define TK_TSERIES 25
-#define TK_STORAGE 26
-#define TK_STREAMS 27
-#define TK_QTIME 28
-#define TK_DBS 29
-#define TK_USERS 30
-#define TK_CONNS 31
-#define TK_STATE 32
-#define TK_NK_COMMA 33
-#define TK_HOST 34
-#define TK_USER 35
-#define TK_ENABLE 36
-#define TK_NK_INTEGER 37
-#define TK_SYSINFO 38
-#define TK_ADD 39
-#define TK_DROP 40
-#define TK_GRANT 41
-#define TK_ON 42
-#define TK_TO 43
-#define TK_REVOKE 44
-#define TK_FROM 45
-#define TK_SUBSCRIBE 46
-#define TK_READ 47
-#define TK_WRITE 48
-#define TK_NK_DOT 49
-#define TK_WITH 50
-#define TK_DNODE 51
-#define TK_PORT 52
-#define TK_DNODES 53
-#define TK_RESTORE 54
-#define TK_NK_IPTOKEN 55
-#define TK_FORCE 56
-#define TK_UNSAFE 57
-#define TK_LOCAL 58
-#define TK_QNODE 59
-#define TK_BNODE 60
-#define TK_SNODE 61
-#define TK_MNODE 62
-#define TK_VNODE 63
-#define TK_DATABASE 64
-#define TK_USE 65
-#define TK_FLUSH 66
-#define TK_TRIM 67
-#define TK_COMPACT 68
-#define TK_IF 69
-#define TK_NOT 70
-#define TK_EXISTS 71
-#define TK_BUFFER 72
-#define TK_CACHEMODEL 73
-#define TK_CACHESIZE 74
-#define TK_COMP 75
-#define TK_DURATION 76
-#define TK_NK_VARIABLE 77
-#define TK_MAXROWS 78
-#define TK_MINROWS 79
-#define TK_KEEP 80
-#define TK_PAGES 81
-#define TK_PAGESIZE 82
-#define TK_TSDB_PAGESIZE 83
-#define TK_PRECISION 84
-#define TK_REPLICA 85
-#define TK_VGROUPS 86
-#define TK_SINGLE_STABLE 87
-#define TK_RETENTIONS 88
-#define TK_SCHEMALESS 89
-#define TK_WAL_LEVEL 90
-#define TK_WAL_FSYNC_PERIOD 91
-#define TK_WAL_RETENTION_PERIOD 92
-#define TK_WAL_RETENTION_SIZE 93
-#define TK_WAL_ROLL_PERIOD 94
-#define TK_WAL_SEGMENT_SIZE 95
-#define TK_STT_TRIGGER 96
-#define TK_TABLE_PREFIX 97
-#define TK_TABLE_SUFFIX 98
-#define TK_KEEP_TIME_OFFSET 99
-#define TK_NK_COLON 100
-#define TK_BWLIMIT 101
-#define TK_START 102
-#define TK_TIMESTAMP 103
-#define TK_END 104
-#define TK_TABLE 105
-#define TK_NK_LP 106
-#define TK_NK_RP 107
-#define TK_STABLE 108
-#define TK_COLUMN 109
-#define TK_MODIFY 110
-#define TK_RENAME 111
-#define TK_TAG 112
-#define TK_SET 113
-#define TK_NK_EQ 114
-#define TK_USING 115
-#define TK_TAGS 116
-#define TK_BOOL 117
-#define TK_TINYINT 118
-#define TK_SMALLINT 119
-#define TK_INT 120
-#define TK_INTEGER 121
-#define TK_BIGINT 122
-#define TK_FLOAT 123
-#define TK_DOUBLE 124
-#define TK_BINARY 125
-#define TK_NCHAR 126
-#define TK_UNSIGNED 127
-#define TK_JSON 128
-#define TK_VARCHAR 129
-#define TK_MEDIUMBLOB 130
-#define TK_BLOB 131
-#define TK_VARBINARY 132
-#define TK_GEOMETRY 133
-#define TK_DECIMAL 134
-#define TK_COMMENT 135
-#define TK_MAX_DELAY 136
-#define TK_WATERMARK 137
-#define TK_ROLLUP 138
-#define TK_TTL 139
-#define TK_SMA 140
-#define TK_DELETE_MARK 141
-#define TK_FIRST 142
-#define TK_LAST 143
-#define TK_SHOW 144
-#define TK_PRIVILEGES 145
-#define TK_DATABASES 146
-#define TK_TABLES 147
-#define TK_STABLES 148
-#define TK_MNODES 149
-#define TK_QNODES 150
-#define TK_FUNCTIONS 151
-#define TK_INDEXES 152
-#define TK_ACCOUNTS 153
-#define TK_APPS 154
-#define TK_CONNECTIONS 155
-#define TK_LICENCES 156
-#define TK_GRANTS 157
-#define TK_QUERIES 158
-#define TK_SCORES 159
-#define TK_TOPICS 160
-#define TK_VARIABLES 161
-#define TK_CLUSTER 162
-#define TK_BNODES 163
-#define TK_SNODES 164
-#define TK_TRANSACTIONS 165
-#define TK_DISTRIBUTED 166
-#define TK_CONSUMERS 167
-#define TK_SUBSCRIPTIONS 168
-#define TK_VNODES 169
-#define TK_ALIVE 170
-#define TK_VIEWS 171
-#define TK_VIEW 172
-#define TK_COMPACTS 173
-#define TK_NORMAL 174
-#define TK_CHILD 175
-#define TK_LIKE 176
-#define TK_TBNAME 177
-#define TK_QTAGS 178
-#define TK_AS 179
-#define TK_SYSTEM 180
-#define TK_INDEX 181
-#define TK_FUNCTION 182
-#define TK_INTERVAL 183
-#define TK_COUNT 184
-#define TK_LAST_ROW 185
-#define TK_META 186
-#define TK_ONLY 187
-#define TK_TOPIC 188
-#define TK_CONSUMER 189
-#define TK_GROUP 190
-#define TK_DESC 191
-#define TK_DESCRIBE 192
-#define TK_RESET 193
-#define TK_QUERY 194
-#define TK_CACHE 195
-#define TK_EXPLAIN 196
-#define TK_ANALYZE 197
-#define TK_VERBOSE 198
-#define TK_NK_BOOL 199
-#define TK_RATIO 200
-#define TK_NK_FLOAT 201
-#define TK_OUTPUTTYPE 202
-#define TK_AGGREGATE 203
-#define TK_BUFSIZE 204
-#define TK_LANGUAGE 205
-#define TK_REPLACE 206
-#define TK_STREAM 207
-#define TK_INTO 208
-#define TK_PAUSE 209
-#define TK_RESUME 210
-#define TK_TRIGGER 211
-#define TK_AT_ONCE 212
-#define TK_WINDOW_CLOSE 213
-#define TK_IGNORE 214
-#define TK_EXPIRED 215
-#define TK_FILL_HISTORY 216
-#define TK_UPDATE 217
-#define TK_SUBTABLE 218
-#define TK_UNTREATED 219
-#define TK_KILL 220
-#define TK_CONNECTION 221
-#define TK_TRANSACTION 222
-#define TK_BALANCE 223
-#define TK_VGROUP 224
-#define TK_LEADER 225
-#define TK_MERGE 226
-#define TK_REDISTRIBUTE 227
-#define TK_SPLIT 228
-#define TK_DELETE 229
-#define TK_INSERT 230
-#define TK_NULL 231
-#define TK_NK_QUESTION 232
-#define TK_NK_ALIAS 233
-#define TK_NK_ARROW 234
-#define TK_ROWTS 235
-#define TK_QSTART 236
-#define TK_QEND 237
-#define TK_QDURATION 238
-#define TK_WSTART 239
-#define TK_WEND 240
-#define TK_WDURATION 241
-#define TK_IROWTS 242
-#define TK_ISFILLED 243
-#define TK_CAST 244
-#define TK_NOW 245
-#define TK_TODAY 246
-#define TK_TIMEZONE 247
-#define TK_CLIENT_VERSION 248
-#define TK_SERVER_VERSION 249
-#define TK_SERVER_STATUS 250
-#define TK_CURRENT_USER 251
-#define TK_CASE 252
-#define TK_WHEN 253
-#define TK_THEN 254
-#define TK_ELSE 255
-#define TK_BETWEEN 256
-#define TK_IS 257
-#define TK_NK_LT 258
-#define TK_NK_GT 259
-#define TK_NK_LE 260
-#define TK_NK_GE 261
-#define TK_NK_NE 262
-#define TK_MATCH 263
-#define TK_NMATCH 264
-#define TK_CONTAINS 265
-#define TK_IN 266
-#define TK_JOIN 267
-#define TK_INNER 268
-#define TK_SELECT 269
-#define TK_NK_HINT 270
-#define TK_DISTINCT 271
-#define TK_WHERE 272
-#define TK_PARTITION 273
-#define TK_BY 274
-#define TK_SESSION 275
-#define TK_STATE_WINDOW 276
-#define TK_EVENT_WINDOW 277
-#define TK_SLIDING 278
-#define TK_FILL 279
-#define TK_VALUE 280
-#define TK_VALUE_F 281
-#define TK_NONE 282
-#define TK_PREV 283
-#define TK_NULL_F 284
-#define TK_LINEAR 285
-#define TK_NEXT 286
-#define TK_HAVING 287
-#define TK_RANGE 288
-#define TK_EVERY 289
-#define TK_ORDER 290
-#define TK_SLIMIT 291
-#define TK_SOFFSET 292
-#define TK_LIMIT 293
-#define TK_OFFSET 294
-#define TK_ASC 295
-#define TK_NULLS 296
-#define TK_ABORT 297
-#define TK_AFTER 298
-#define TK_ATTACH 299
-#define TK_BEFORE 300
-#define TK_BEGIN 301
-#define TK_BITAND 302
-#define TK_BITNOT 303
-#define TK_BITOR 304
-#define TK_BLOCKS 305
-#define TK_CHANGE 306
-#define TK_COMMA 307
-#define TK_CONCAT 308
-#define TK_CONFLICT 309
-#define TK_COPY 310
-#define TK_DEFERRED 311
-#define TK_DELIMITERS 312
-#define TK_DETACH 313
-#define TK_DIVIDE 314
-#define TK_DOT 315
-#define TK_EACH 316
-#define TK_FAIL 317
-#define TK_FILE 318
-#define TK_FOR 319
-#define TK_GLOB 320
-#define TK_ID 321
-#define TK_IMMEDIATE 322
-#define TK_IMPORT 323
-#define TK_INITIALLY 324
-#define TK_INSTEAD 325
-#define TK_ISNULL 326
-#define TK_KEY 327
-#define TK_MODULES 328
-#define TK_NK_BITNOT 329
-#define TK_NK_SEMI 330
-#define TK_NOTNULL 331
-#define TK_OF 332
-#define TK_PLUS 333
-#define TK_PRIVILEGE 334
-#define TK_RAISE 335
-#define TK_RESTRICT 336
-#define TK_ROW 337
-#define TK_SEMI 338
-#define TK_STAR 339
-#define TK_STATEMENT 340
-#define TK_STRICT 341
-#define TK_STRING 342
-#define TK_TIMES 343
-#define TK_VALUES 344
-#define TK_VARIABLE 345
-#define TK_WAL 346
-#endif
-/**************** End token definitions ***************************************/
+/* These constants specify the various numeric values for terminal symbols
+** in a format understandable to "makeheaders". This section is blank unless
+** "lemon" is run with the "-m" command-line option.
+***************** Begin makeheaders token definitions *************************/
+/**************** End makeheaders token definitions ***************************/
/* The next sections is a series of control #defines.
** various aspects of the generated parser.
@@ -452,29 +104,29 @@
#endif
/************* Begin control #defines *****************************************/
#define YYCODETYPE unsigned short int
-#define YYNOCODE 508
+#define YYNOCODE 511
#define YYACTIONTYPE unsigned short int
#define ParseTOKENTYPE SToken
typedef union {
int yyinit;
ParseTOKENTYPE yy0;
- SNodeList* yy88;
- int32_t yy92;
- SAlterOption yy117;
- SShowTablesOption yy133;
- ENullOrder yy153;
- int64_t yy221;
- SNode* yy232;
- STokenPair yy241;
- EFillMode yy246;
- int8_t yy279;
- EShowKind yy281;
- SDataType yy400;
- EJoinType yy436;
- EOperatorType yy708;
- EOrder yy834;
- bool yy985;
- SToken yy993;
+ EOperatorType yy30;
+ EJoinType yy246;
+ int64_t yy277;
+ ENullOrder yy361;
+ STokenPair yy483;
+ SNode* yy490;
+ SNodeList* yy502;
+ SAlterOption yy529;
+ SToken yy561;
+ EShowKind yy579;
+ EFillMode yy718;
+ int32_t yy774;
+ SDataType yy826;
+ bool yy845;
+ EOrder yy876;
+ SShowTablesOption yy961;
+ int8_t yy1013;
} YYMINORTYPE;
#ifndef YYSTACKDEPTH
#define YYSTACKDEPTH 100
@@ -490,18 +142,18 @@ typedef union {
#define ParseCTX_FETCH
#define ParseCTX_STORE
#define YYFALLBACK 1
-#define YYNSTATE 840
-#define YYNRULE 642
-#define YYNRULE_WITH_ACTION 642
-#define YYNTOKEN 347
-#define YY_MAX_SHIFT 839
-#define YY_MIN_SHIFTREDUCE 1242
-#define YY_MAX_SHIFTREDUCE 1883
-#define YY_ERROR_ACTION 1884
-#define YY_ACCEPT_ACTION 1885
-#define YY_NO_ACTION 1886
-#define YY_MIN_REDUCE 1887
-#define YY_MAX_REDUCE 2528
+#define YYNSTATE 846
+#define YYNRULE 647
+#define YYNRULE_WITH_ACTION 647
+#define YYNTOKEN 350
+#define YY_MAX_SHIFT 845
+#define YY_MIN_SHIFTREDUCE 1248
+#define YY_MAX_SHIFTREDUCE 1894
+#define YY_ERROR_ACTION 1895
+#define YY_ACCEPT_ACTION 1896
+#define YY_NO_ACTION 1897
+#define YY_MIN_REDUCE 1898
+#define YY_MAX_REDUCE 2544
/************* End control #defines *******************************************/
#define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])))
@@ -568,874 +220,879 @@ typedef union {
** yy_default[] Default action for each state.
**
*********** Begin parsing tables **********************************************/
-#define YY_ACTTAB_COUNT (3071)
+#define YY_ACTTAB_COUNT (3083)
static const YYACTIONTYPE yy_action[] = {
- /* 0 */ 409, 561, 197, 418, 562, 1930, 569, 2064, 171, 562,
- /* 10 */ 1930, 168, 48, 46, 1807, 2210, 2077, 34, 397, 2077,
- /* 20 */ 415, 471, 1648, 41, 40, 1673, 2126, 47, 45, 44,
- /* 30 */ 43, 42, 36, 2208, 712, 1733, 1971, 1646, 41, 40,
- /* 40 */ 38, 320, 47, 45, 44, 43, 42, 2330, 41, 40,
- /* 50 */ 480, 2186, 47, 45, 44, 43, 42, 704, 146, 1674,
- /* 60 */ 707, 184, 2122, 2123, 1728, 1888, 528, 526, 420, 365,
- /* 70 */ 19, 2121, 2123, 217, 41, 40, 173, 1654, 47, 45,
- /* 80 */ 44, 43, 42, 383, 2014, 2190, 127, 95, 2348, 126,
- /* 90 */ 125, 124, 123, 122, 121, 120, 119, 118, 1673, 219,
- /* 100 */ 2296, 237, 741, 836, 385, 564, 15, 1938, 811, 810,
- /* 110 */ 809, 808, 427, 2070, 807, 806, 151, 801, 800, 799,
- /* 120 */ 798, 797, 796, 795, 150, 789, 788, 787, 426, 425,
- /* 130 */ 784, 783, 782, 183, 182, 781, 692, 486, 2186, 2499,
- /* 140 */ 1648, 2329, 1735, 1736, 2367, 686, 184, 114, 2331, 745,
- /* 150 */ 2333, 2334, 740, 148, 735, 1646, 2391, 691, 203, 186,
- /* 160 */ 581, 2420, 2500, 693, 1282, 411, 2416, 300, 2428, 703,
- /* 170 */ 2191, 138, 702, 2348, 2499, 704, 146, 1708, 1718, 2435,
- /* 180 */ 205, 1479, 1480, 1289, 1734, 1737, 221, 724, 2450, 2128,
- /* 190 */ 1674, 724, 691, 203, 2210, 1654, 381, 2500, 693, 1649,
- /* 200 */ 174, 1647, 1899, 2504, 2126, 2432, 1284, 1287, 1288, 408,
- /* 210 */ 41, 40, 2207, 712, 47, 45, 44, 43, 42, 127,
- /* 220 */ 1676, 836, 126, 125, 124, 123, 122, 121, 120, 119,
- /* 230 */ 118, 1652, 1653, 1705, 685, 1707, 1710, 1711, 1712, 1713,
- /* 240 */ 1714, 1715, 1716, 1717, 737, 733, 1726, 1727, 1729, 1730,
- /* 250 */ 1731, 1732, 2, 48, 46, 1547, 1548, 1880, 364, 682,
- /* 260 */ 1671, 415, 1308, 1648, 1307, 514, 2186, 512, 1830, 2330,
- /* 270 */ 531, 724, 375, 51, 692, 530, 1733, 2499, 1646, 142,
- /* 280 */ 2306, 650, 742, 1831, 706, 201, 2428, 2429, 272, 144,
- /* 290 */ 2433, 494, 271, 532, 2066, 691, 203, 1309, 496, 2504,
- /* 300 */ 2500, 693, 2499, 112, 2310, 1728, 1887, 1873, 474, 566,
- /* 310 */ 2348, 19, 1567, 1568, 226, 563, 1762, 1649, 1654, 1647,
- /* 320 */ 147, 2503, 2296, 1829, 741, 2500, 2502, 2330, 2067, 196,
- /* 330 */ 136, 135, 134, 133, 132, 131, 130, 129, 128, 608,
- /* 340 */ 742, 2115, 1940, 607, 836, 384, 687, 15, 2312, 1652,
- /* 350 */ 1653, 688, 683, 676, 1566, 1569, 482, 51, 735, 98,
- /* 360 */ 578, 1879, 370, 2329, 2051, 395, 2367, 641, 2348, 175,
- /* 370 */ 2331, 745, 2333, 2334, 740, 577, 735, 666, 1763, 302,
- /* 380 */ 2296, 106, 741, 1735, 1736, 1910, 2197, 2176, 1958, 519,
- /* 390 */ 518, 517, 516, 511, 510, 509, 508, 507, 502, 501,
- /* 400 */ 500, 499, 367, 491, 490, 489, 2068, 484, 483, 382,
- /* 410 */ 624, 668, 2461, 475, 1535, 1536, 579, 2203, 1708, 1718,
- /* 420 */ 1554, 2329, 1673, 648, 2367, 1734, 1737, 114, 2331, 745,
- /* 430 */ 2333, 2334, 740, 780, 735, 1676, 304, 639, 2296, 2519,
- /* 440 */ 1649, 2420, 1647, 41, 40, 411, 2416, 47, 45, 44,
- /* 450 */ 43, 42, 637, 1654, 635, 269, 268, 2289, 37, 413,
- /* 460 */ 1757, 1758, 1759, 1760, 1761, 1765, 1766, 1767, 1768, 780,
- /* 470 */ 311, 312, 1652, 1653, 1705, 310, 1707, 1710, 1711, 1712,
- /* 480 */ 1713, 1714, 1715, 1716, 1717, 737, 733, 1726, 1727, 1729,
- /* 490 */ 1730, 1731, 1732, 2, 12, 48, 46, 255, 239, 2330,
- /* 500 */ 1673, 1399, 564, 415, 1938, 1648, 61, 667, 63, 1909,
- /* 510 */ 2499, 63, 742, 178, 664, 12, 1398, 68, 1733, 558,
- /* 520 */ 1646, 598, 594, 590, 586, 223, 254, 556, 2505, 203,
- /* 530 */ 552, 548, 1908, 2500, 693, 2330, 159, 623, 622, 621,
- /* 540 */ 2348, 651, 1849, 522, 613, 143, 617, 1728, 707, 651,
- /* 550 */ 616, 2052, 2296, 19, 741, 615, 620, 391, 390, 1705,
- /* 560 */ 1654, 614, 2296, 3, 610, 2504, 90, 96, 2499, 89,
- /* 570 */ 252, 1311, 1312, 41, 40, 54, 2348, 47, 45, 44,
- /* 580 */ 43, 42, 533, 424, 423, 2296, 836, 2503, 2296, 15,
- /* 590 */ 741, 2500, 2501, 2329, 302, 1308, 2367, 1307, 30, 114,
- /* 600 */ 2331, 745, 2333, 2334, 740, 227, 735, 2306, 1655, 149,
- /* 610 */ 55, 156, 2391, 2420, 1811, 571, 2249, 411, 2416, 63,
- /* 620 */ 1673, 2315, 771, 653, 2249, 1735, 1736, 521, 520, 2329,
- /* 630 */ 1309, 2310, 2367, 88, 242, 114, 2331, 745, 2333, 2334,
- /* 640 */ 740, 2128, 735, 251, 244, 600, 599, 186, 396, 2420,
- /* 650 */ 249, 575, 325, 411, 2416, 2435, 2126, 1709, 41, 40,
- /* 660 */ 1708, 1718, 47, 45, 44, 43, 42, 1734, 1737, 241,
- /* 670 */ 699, 304, 1850, 1743, 304, 2312, 2451, 1974, 2159, 1673,
- /* 680 */ 1444, 2431, 1649, 2060, 1647, 735, 778, 161, 160, 775,
- /* 690 */ 774, 773, 158, 52, 1435, 770, 769, 768, 1439, 767,
- /* 700 */ 1441, 1442, 766, 763, 171, 1450, 760, 1452, 1453, 757,
- /* 710 */ 754, 751, 2078, 1706, 1652, 1653, 1705, 99, 1707, 1710,
- /* 720 */ 1711, 1712, 1713, 1714, 1715, 1716, 1717, 737, 733, 1726,
- /* 730 */ 1727, 1729, 1730, 1731, 1732, 2, 48, 46, 1738, 2062,
- /* 740 */ 2330, 44, 43, 42, 415, 2128, 1648, 1907, 1595, 623,
- /* 750 */ 622, 621, 405, 742, 1838, 2458, 613, 143, 617, 1733,
- /* 760 */ 2126, 1646, 616, 725, 2075, 725, 2075, 615, 620, 391,
- /* 770 */ 390, 2330, 1658, 614, 725, 2075, 610, 1709, 1885, 2050,
- /* 780 */ 9, 2348, 304, 137, 742, 137, 2471, 2058, 1728, 12,
- /* 790 */ 604, 10, 609, 2296, 208, 741, 602, 601, 448, 2435,
- /* 800 */ 2296, 1654, 1906, 679, 678, 1836, 1837, 1839, 1840, 1841,
- /* 810 */ 464, 2079, 2348, 41, 40, 463, 2128, 47, 45, 44,
- /* 820 */ 43, 42, 1291, 410, 2296, 2430, 741, 836, 1672, 170,
- /* 830 */ 49, 2126, 280, 1706, 2329, 1905, 1709, 2367, 2330, 498,
- /* 840 */ 114, 2331, 745, 2333, 2334, 740, 2128, 735, 497, 725,
- /* 850 */ 2075, 739, 2519, 419, 2420, 2296, 304, 430, 411, 2416,
- /* 860 */ 667, 2126, 429, 2499, 2503, 2329, 1735, 1736, 2367, 56,
- /* 870 */ 736, 114, 2331, 745, 2333, 2334, 740, 2290, 735, 2348,
- /* 880 */ 95, 2505, 203, 2519, 1904, 2420, 2500, 693, 2296, 411,
- /* 890 */ 2416, 2296, 1706, 741, 778, 161, 160, 775, 774, 773,
- /* 900 */ 158, 1708, 1718, 704, 146, 418, 2071, 667, 1734, 1737,
- /* 910 */ 2499, 2128, 1823, 171, 778, 161, 160, 775, 774, 773,
- /* 920 */ 158, 2077, 2317, 1649, 452, 1647, 711, 667, 2505, 203,
- /* 930 */ 2499, 700, 2329, 2500, 693, 2367, 1949, 2296, 356, 2331,
- /* 940 */ 745, 2333, 2334, 740, 738, 735, 726, 2385, 2505, 203,
- /* 950 */ 1764, 454, 450, 2500, 693, 1652, 1653, 1705, 626, 1707,
- /* 960 */ 1710, 1711, 1712, 1713, 1714, 1715, 1716, 1717, 737, 733,
- /* 970 */ 1726, 1727, 1729, 1730, 1731, 1732, 2, 48, 46, 2319,
- /* 980 */ 2330, 725, 2075, 1403, 646, 415, 1387, 1648, 1903, 649,
- /* 990 */ 725, 2075, 727, 742, 2392, 674, 725, 2075, 1402, 273,
- /* 1000 */ 1733, 468, 1646, 421, 725, 2075, 1796, 839, 619, 618,
- /* 1010 */ 469, 171, 2330, 202, 2428, 2429, 488, 144, 2433, 2077,
- /* 1020 */ 2169, 2348, 2306, 327, 275, 742, 1389, 2492, 1657, 1728,
- /* 1030 */ 35, 725, 2075, 2296, 667, 741, 2314, 2499, 1804, 193,
- /* 1040 */ 1769, 2296, 1654, 725, 2075, 284, 2310, 827, 823, 819,
- /* 1050 */ 815, 503, 324, 2348, 791, 2505, 203, 2258, 725, 2075,
- /* 1060 */ 2500, 693, 478, 504, 535, 2296, 2015, 741, 836, 704,
- /* 1070 */ 146, 49, 1902, 628, 2329, 1616, 1617, 2367, 505, 1677,
- /* 1080 */ 114, 2331, 745, 2333, 2334, 740, 652, 735, 640, 100,
- /* 1090 */ 2312, 412, 2519, 113, 2420, 1677, 318, 1673, 411, 2416,
- /* 1100 */ 735, 725, 2075, 2277, 270, 1900, 2329, 1735, 1736, 2367,
- /* 1110 */ 1289, 274, 114, 2331, 745, 2333, 2334, 740, 793, 735,
- /* 1120 */ 631, 580, 1677, 696, 2519, 2296, 2420, 625, 721, 794,
- /* 1130 */ 411, 2416, 2036, 267, 1287, 1288, 667, 805, 803, 2499,
- /* 1140 */ 41, 40, 1708, 1718, 47, 45, 44, 43, 42, 1734,
- /* 1150 */ 1737, 695, 1677, 389, 388, 725, 2075, 2505, 203, 729,
- /* 1160 */ 159, 2392, 2500, 693, 1649, 772, 1647, 2128, 2119, 307,
- /* 1170 */ 1901, 725, 2075, 2128, 72, 2072, 306, 71, 111, 204,
- /* 1180 */ 2428, 2429, 720, 144, 2433, 14, 13, 108, 2127, 708,
- /* 1190 */ 63, 283, 1660, 1898, 1897, 277, 1652, 1653, 1705, 1896,
- /* 1200 */ 1707, 1710, 1711, 1712, 1713, 1714, 1715, 1716, 1717, 737,
- /* 1210 */ 733, 1726, 1727, 1729, 1730, 1731, 1732, 2, 48, 46,
- /* 1220 */ 725, 2075, 2330, 2296, 387, 386, 415, 606, 1648, 47,
- /* 1230 */ 45, 44, 43, 42, 1611, 742, 1895, 2439, 194, 667,
- /* 1240 */ 710, 1733, 2499, 1646, 725, 2075, 2296, 2296, 1894, 608,
- /* 1250 */ 1893, 1892, 2296, 607, 725, 2075, 725, 2075, 725, 2075,
- /* 1260 */ 2505, 203, 2280, 2348, 315, 2500, 693, 725, 2075, 776,
- /* 1270 */ 1728, 76, 2119, 732, 722, 2296, 723, 741, 321, 1891,
- /* 1280 */ 1890, 198, 462, 1654, 461, 777, 2464, 422, 2119, 2296,
- /* 1290 */ 334, 1776, 1678, 2105, 1915, 831, 260, 2440, 1796, 258,
- /* 1300 */ 643, 2296, 642, 2296, 2296, 1803, 139, 50, 1678, 836,
- /* 1310 */ 1706, 199, 15, 437, 460, 1656, 2329, 2330, 86, 2367,
- /* 1320 */ 611, 87, 114, 2331, 745, 2333, 2334, 740, 210, 735,
- /* 1330 */ 742, 2053, 2296, 2296, 2519, 1678, 2420, 424, 423, 262,
- /* 1340 */ 411, 2416, 261, 264, 1384, 612, 263, 1662, 1735, 1736,
- /* 1350 */ 680, 266, 1947, 304, 265, 785, 159, 1342, 2348, 50,
- /* 1360 */ 1733, 786, 1655, 297, 152, 1678, 50, 1882, 1883, 1382,
- /* 1370 */ 2296, 141, 741, 2349, 629, 291, 14, 13, 2012, 1361,
- /* 1380 */ 1941, 1719, 697, 1708, 1718, 1359, 2011, 187, 159, 1728,
- /* 1390 */ 1734, 1737, 50, 309, 75, 2195, 157, 1343, 159, 66,
- /* 1400 */ 50, 749, 1654, 157, 159, 1649, 140, 1647, 1931, 2454,
- /* 1410 */ 157, 2329, 677, 401, 2367, 684, 714, 114, 2331, 745,
- /* 1420 */ 2333, 2334, 740, 398, 735, 2196, 428, 1937, 731, 2395,
- /* 1430 */ 1614, 2420, 829, 1835, 1754, 411, 2416, 1652, 1653, 1705,
- /* 1440 */ 1834, 1707, 1710, 1711, 1712, 1713, 1714, 1715, 1716, 1717,
- /* 1450 */ 737, 733, 1726, 1727, 1729, 1730, 1731, 1732, 2, 2116,
- /* 1460 */ 172, 289, 709, 705, 660, 341, 1564, 313, 717, 2455,
- /* 1470 */ 317, 2465, 1429, 1770, 333, 1457, 299, 1461, 1468, 1659,
- /* 1480 */ 1466, 296, 338, 74, 162, 303, 73, 2037, 5, 431,
- /* 1490 */ 436, 379, 444, 445, 1681, 455, 366, 211, 1588, 456,
- /* 1500 */ 2330, 212, 214, 458, 1671, 328, 472, 235, 543, 541,
- /* 1510 */ 538, 1672, 479, 742, 225, 485, 481, 487, 492, 524,
- /* 1520 */ 506, 523, 513, 2188, 1663, 515, 1658, 525, 536, 537,
- /* 1530 */ 534, 229, 230, 539, 232, 540, 542, 544, 1679, 4,
- /* 1540 */ 559, 2348, 560, 567, 240, 568, 570, 92, 63, 1674,
- /* 1550 */ 572, 243, 1680, 2296, 573, 741, 1666, 1668, 1682, 576,
- /* 1560 */ 246, 574, 248, 1683, 93, 2204, 582, 94, 253, 603,
- /* 1570 */ 733, 1726, 1727, 1729, 1730, 1731, 1732, 632, 360, 633,
- /* 1580 */ 116, 2267, 2264, 605, 2263, 2065, 64, 645, 97, 257,
- /* 1590 */ 2061, 259, 164, 165, 2329, 647, 2063, 2367, 2059, 166,
- /* 1600 */ 114, 2331, 745, 2333, 2334, 740, 167, 735, 153, 329,
- /* 1610 */ 276, 1675, 2393, 655, 2420, 654, 659, 656, 411, 2416,
- /* 1620 */ 281, 662, 671, 681, 2470, 715, 2330, 2469, 8, 2442,
- /* 1630 */ 690, 290, 293, 84, 83, 467, 402, 292, 216, 742,
- /* 1640 */ 661, 286, 288, 179, 279, 672, 2250, 669, 294, 295,
- /* 1650 */ 670, 459, 457, 1796, 145, 2522, 1676, 701, 1801, 1,
- /* 1660 */ 2330, 2498, 363, 698, 1799, 446, 298, 2348, 443, 439,
- /* 1670 */ 435, 432, 460, 742, 305, 190, 2436, 154, 330, 2296,
- /* 1680 */ 713, 741, 2218, 2217, 331, 2216, 407, 718, 719, 332,
- /* 1690 */ 155, 105, 206, 2076, 62, 2401, 107, 2120, 747, 335,
- /* 1700 */ 1266, 2348, 833, 323, 830, 163, 835, 359, 371, 372,
- /* 1710 */ 2288, 304, 344, 2296, 53, 741, 337, 2287, 2286, 81,
- /* 1720 */ 2329, 358, 2281, 2367, 348, 433, 114, 2331, 745, 2333,
- /* 1730 */ 2334, 740, 434, 735, 2330, 339, 1639, 1640, 728, 209,
- /* 1740 */ 2420, 438, 2279, 440, 411, 2416, 441, 742, 442, 1638,
- /* 1750 */ 2278, 2276, 380, 447, 2329, 2275, 449, 2367, 2274, 451,
- /* 1760 */ 115, 2331, 745, 2333, 2334, 740, 2273, 735, 2330, 453,
- /* 1770 */ 1627, 2254, 213, 2253, 2420, 2348, 215, 1591, 2419, 2416,
- /* 1780 */ 82, 742, 1590, 2231, 2230, 2229, 466, 2296, 465, 741,
- /* 1790 */ 2228, 2227, 2178, 470, 1534, 2175, 473, 2174, 2168, 476,
- /* 1800 */ 477, 2330, 2165, 218, 2164, 85, 2163, 2162, 2167, 2348,
- /* 1810 */ 220, 2166, 2161, 2160, 742, 2158, 2157, 2156, 222, 493,
- /* 1820 */ 2155, 2296, 495, 741, 2171, 2154, 2153, 2152, 2329, 224,
- /* 1830 */ 2139, 2367, 2151, 2150, 115, 2331, 745, 2333, 2334, 740,
- /* 1840 */ 2173, 735, 2348, 2149, 2148, 2147, 2146, 2145, 2420, 527,
- /* 1850 */ 91, 2138, 730, 2416, 2296, 2144, 741, 2143, 2142, 2141,
- /* 1860 */ 2140, 2137, 743, 2136, 2172, 2367, 2170, 2135, 115, 2331,
- /* 1870 */ 745, 2333, 2334, 740, 2134, 735, 1540, 2330, 2133, 2132,
- /* 1880 */ 228, 2131, 2420, 529, 2130, 2129, 374, 2416, 368, 369,
- /* 1890 */ 742, 1400, 1404, 1977, 1976, 2329, 1975, 1973, 2367, 231,
- /* 1900 */ 233, 176, 2331, 745, 2333, 2334, 740, 2330, 735, 1970,
- /* 1910 */ 1396, 1969, 234, 545, 549, 1962, 546, 547, 2348, 550,
- /* 1920 */ 742, 1951, 551, 553, 1926, 555, 557, 1290, 185, 1925,
- /* 1930 */ 2296, 2252, 741, 554, 78, 236, 2248, 2316, 2238, 2226,
- /* 1940 */ 195, 2225, 238, 79, 245, 2202, 247, 565, 2348, 250,
- /* 1950 */ 2054, 1972, 1968, 583, 584, 694, 2520, 1966, 588, 585,
- /* 1960 */ 2296, 589, 741, 587, 1964, 591, 1961, 593, 1946, 592,
- /* 1970 */ 595, 2329, 597, 596, 2367, 1335, 1944, 115, 2331, 745,
- /* 1980 */ 2333, 2334, 740, 1945, 735, 2330, 1943, 1922, 2056, 1472,
- /* 1990 */ 1473, 2420, 2055, 1386, 802, 1385, 2417, 1383, 742, 1381,
- /* 2000 */ 1380, 2329, 2330, 804, 2367, 1959, 1379, 175, 2331, 745,
- /* 2010 */ 2333, 2334, 740, 1372, 735, 742, 1378, 256, 1377, 2330,
- /* 2020 */ 392, 1374, 65, 1950, 393, 627, 2348, 1373, 1948, 394,
- /* 2030 */ 1371, 399, 742, 630, 1921, 1920, 1919, 634, 2296, 1918,
- /* 2040 */ 741, 636, 1917, 2348, 638, 117, 1621, 1623, 400, 1620,
- /* 2050 */ 2462, 1625, 29, 2251, 69, 2296, 1601, 741, 2247, 1599,
- /* 2060 */ 2348, 1597, 278, 2237, 169, 657, 2224, 2223, 2504, 6,
- /* 2070 */ 17, 20, 2296, 21, 741, 23, 7, 31, 673, 2329,
- /* 2080 */ 1852, 285, 2367, 22, 2330, 357, 2331, 745, 2333, 2334,
- /* 2090 */ 740, 57, 735, 58, 189, 177, 2329, 742, 200, 2367,
- /* 2100 */ 2317, 287, 357, 2331, 745, 2333, 2334, 740, 675, 735,
- /* 2110 */ 1833, 658, 33, 2329, 2330, 1822, 2367, 282, 1872, 350,
- /* 2120 */ 2331, 745, 2333, 2334, 740, 2348, 735, 742, 1576, 663,
- /* 2130 */ 67, 24, 1867, 1575, 1873, 188, 32, 2296, 80, 741,
- /* 2140 */ 1866, 665, 403, 1871, 1870, 18, 404, 60, 1793, 301,
- /* 2150 */ 180, 1792, 2222, 2201, 101, 2348, 2200, 102, 25, 103,
- /* 2160 */ 406, 308, 1828, 191, 26, 689, 314, 2296, 716, 741,
- /* 2170 */ 70, 108, 319, 1745, 104, 1744, 316, 59, 2329, 2330,
- /* 2180 */ 13, 2367, 1664, 2370, 176, 2331, 745, 2333, 2334, 740,
- /* 2190 */ 1755, 735, 739, 1723, 11, 734, 181, 1721, 39, 2330,
- /* 2200 */ 1720, 1690, 16, 192, 1698, 27, 748, 746, 2329, 1458,
- /* 2210 */ 28, 2367, 742, 417, 357, 2331, 745, 2333, 2334, 740,
- /* 2220 */ 2348, 735, 2330, 1455, 750, 752, 753, 755, 1454, 1451,
- /* 2230 */ 756, 744, 2296, 758, 741, 742, 759, 2330, 761, 2521,
- /* 2240 */ 2348, 1445, 762, 764, 1443, 414, 1449, 765, 109, 322,
- /* 2250 */ 742, 110, 2296, 1448, 741, 1447, 2330, 1467, 1463, 1446,
- /* 2260 */ 1333, 77, 779, 2348, 1368, 1365, 1364, 1363, 416, 742,
- /* 2270 */ 1394, 1362, 1360, 2329, 1358, 2296, 2367, 741, 2348, 356,
- /* 2280 */ 2331, 745, 2333, 2334, 740, 1357, 735, 1356, 2386, 1393,
- /* 2290 */ 2296, 790, 741, 2329, 792, 207, 2367, 2348, 1354, 357,
- /* 2300 */ 2331, 745, 2333, 2334, 740, 1353, 735, 1352, 1351, 2296,
- /* 2310 */ 1350, 741, 1349, 1967, 1348, 1390, 2329, 1388, 1345, 2367,
- /* 2320 */ 1344, 1341, 357, 2331, 745, 2333, 2334, 740, 1339, 735,
- /* 2330 */ 2330, 644, 1340, 1338, 2367, 812, 813, 352, 2331, 745,
- /* 2340 */ 2333, 2334, 740, 742, 735, 814, 1965, 816, 817, 2330,
- /* 2350 */ 2329, 818, 1963, 2367, 820, 821, 342, 2331, 745, 2333,
- /* 2360 */ 2334, 740, 742, 735, 822, 2330, 1960, 824, 826, 825,
- /* 2370 */ 1942, 2348, 828, 1279, 1916, 1267, 832, 326, 742, 834,
- /* 2380 */ 1886, 1650, 336, 2296, 837, 741, 1886, 838, 1886, 1886,
- /* 2390 */ 2348, 1886, 1886, 1886, 1886, 1886, 1886, 1886, 1886, 1886,
- /* 2400 */ 1886, 1886, 2296, 1886, 741, 1886, 2348, 1886, 1886, 1886,
- /* 2410 */ 1886, 1886, 1886, 1886, 1886, 1886, 1886, 1886, 2296, 1886,
- /* 2420 */ 741, 1886, 1886, 2330, 2329, 1886, 1886, 2367, 1886, 1886,
- /* 2430 */ 340, 2331, 745, 2333, 2334, 740, 742, 735, 1886, 1886,
- /* 2440 */ 1886, 1886, 1886, 2329, 1886, 1886, 2367, 2330, 1886, 343,
- /* 2450 */ 2331, 745, 2333, 2334, 740, 1886, 735, 1886, 1886, 2329,
- /* 2460 */ 742, 1886, 2367, 1886, 2348, 349, 2331, 745, 2333, 2334,
- /* 2470 */ 740, 1886, 735, 1886, 1886, 1886, 2296, 1886, 741, 1886,
- /* 2480 */ 1886, 1886, 1886, 1886, 1886, 1886, 1886, 1886, 2348, 1886,
- /* 2490 */ 2330, 1886, 1886, 1886, 1886, 1886, 1886, 1886, 1886, 1886,
- /* 2500 */ 2296, 1886, 741, 742, 1886, 1886, 1886, 1886, 1886, 1886,
- /* 2510 */ 1886, 1886, 1886, 1886, 1886, 1886, 2330, 2329, 1886, 1886,
- /* 2520 */ 2367, 1886, 1886, 353, 2331, 745, 2333, 2334, 740, 742,
- /* 2530 */ 735, 2348, 1886, 1886, 1886, 1886, 1886, 1886, 1886, 1886,
- /* 2540 */ 1886, 2329, 1886, 2296, 2367, 741, 1886, 345, 2331, 745,
- /* 2550 */ 2333, 2334, 740, 1886, 735, 1886, 1886, 2348, 1886, 2330,
- /* 2560 */ 1886, 1886, 1886, 1886, 1886, 1886, 1886, 1886, 1886, 2296,
- /* 2570 */ 1886, 741, 742, 1886, 1886, 1886, 1886, 1886, 1886, 1886,
- /* 2580 */ 1886, 1886, 1886, 2330, 2329, 1886, 1886, 2367, 1886, 1886,
- /* 2590 */ 354, 2331, 745, 2333, 2334, 740, 742, 735, 1886, 1886,
- /* 2600 */ 2348, 1886, 1886, 1886, 1886, 1886, 1886, 1886, 1886, 1886,
- /* 2610 */ 2329, 1886, 2296, 2367, 741, 1886, 346, 2331, 745, 2333,
- /* 2620 */ 2334, 740, 1886, 735, 2348, 1886, 2330, 1886, 1886, 1886,
- /* 2630 */ 1886, 1886, 1886, 1886, 1886, 1886, 2296, 1886, 741, 742,
- /* 2640 */ 1886, 2330, 1886, 1886, 1886, 1886, 1886, 1886, 1886, 1886,
- /* 2650 */ 1886, 1886, 1886, 2329, 742, 1886, 2367, 2330, 1886, 355,
- /* 2660 */ 2331, 745, 2333, 2334, 740, 1886, 735, 2348, 1886, 1886,
- /* 2670 */ 742, 1886, 1886, 1886, 1886, 1886, 1886, 2329, 1886, 2296,
- /* 2680 */ 2367, 741, 2348, 347, 2331, 745, 2333, 2334, 740, 1886,
- /* 2690 */ 735, 1886, 1886, 1886, 2296, 1886, 741, 1886, 2348, 1886,
- /* 2700 */ 1886, 1886, 1886, 1886, 1886, 1886, 1886, 1886, 1886, 1886,
- /* 2710 */ 2296, 1886, 741, 1886, 1886, 1886, 1886, 1886, 1886, 1886,
- /* 2720 */ 2329, 1886, 1886, 2367, 1886, 1886, 361, 2331, 745, 2333,
- /* 2730 */ 2334, 740, 1886, 735, 2330, 2329, 1886, 1886, 2367, 1886,
- /* 2740 */ 1886, 362, 2331, 745, 2333, 2334, 740, 742, 735, 1886,
- /* 2750 */ 1886, 2329, 1886, 2330, 2367, 1886, 1886, 2342, 2331, 745,
- /* 2760 */ 2333, 2334, 740, 1886, 735, 1886, 742, 1886, 1886, 2330,
- /* 2770 */ 1886, 1886, 1886, 1886, 1886, 2348, 1886, 1886, 1886, 1886,
- /* 2780 */ 1886, 1886, 742, 1886, 1886, 1886, 1886, 2296, 1886, 741,
- /* 2790 */ 1886, 1886, 1886, 1886, 2348, 1886, 1886, 1886, 1886, 1886,
- /* 2800 */ 1886, 1886, 1886, 1886, 1886, 1886, 2296, 1886, 741, 1886,
- /* 2810 */ 2348, 1886, 1886, 1886, 1886, 1886, 1886, 1886, 1886, 1886,
- /* 2820 */ 1886, 1886, 2296, 1886, 741, 1886, 1886, 2330, 2329, 1886,
- /* 2830 */ 1886, 2367, 1886, 1886, 2341, 2331, 745, 2333, 2334, 740,
- /* 2840 */ 742, 735, 1886, 1886, 1886, 1886, 1886, 2329, 1886, 1886,
- /* 2850 */ 2367, 2330, 1886, 2340, 2331, 745, 2333, 2334, 740, 1886,
- /* 2860 */ 735, 1886, 1886, 2329, 742, 1886, 2367, 1886, 2348, 376,
- /* 2870 */ 2331, 745, 2333, 2334, 740, 1886, 735, 1886, 1886, 1886,
- /* 2880 */ 2296, 1886, 741, 1886, 1886, 1886, 1886, 1886, 1886, 1886,
- /* 2890 */ 1886, 1886, 2348, 1886, 2330, 1886, 1886, 1886, 1886, 1886,
- /* 2900 */ 1886, 1886, 1886, 1886, 2296, 1886, 741, 742, 1886, 1886,
- /* 2910 */ 1886, 1886, 1886, 1886, 1886, 1886, 1886, 1886, 1886, 1886,
- /* 2920 */ 2330, 2329, 1886, 1886, 2367, 1886, 1886, 377, 2331, 745,
- /* 2930 */ 2333, 2334, 740, 742, 735, 2348, 1886, 1886, 1886, 1886,
- /* 2940 */ 1886, 1886, 1886, 1886, 1886, 2329, 1886, 2296, 2367, 741,
- /* 2950 */ 1886, 373, 2331, 745, 2333, 2334, 740, 1886, 735, 1886,
- /* 2960 */ 1886, 2348, 1886, 2330, 1886, 1886, 1886, 1886, 1886, 1886,
- /* 2970 */ 1886, 1886, 1886, 2296, 1886, 741, 742, 1886, 1886, 1886,
- /* 2980 */ 1886, 1886, 1886, 1886, 1886, 1886, 1886, 1886, 2329, 1886,
- /* 2990 */ 1886, 2367, 1886, 1886, 378, 2331, 745, 2333, 2334, 740,
- /* 3000 */ 1886, 735, 1886, 1886, 2348, 1886, 1886, 1886, 1886, 1886,
- /* 3010 */ 1886, 1886, 1886, 1886, 743, 1886, 2296, 2367, 741, 1886,
- /* 3020 */ 352, 2331, 745, 2333, 2334, 740, 1886, 735, 1886, 1886,
- /* 3030 */ 1886, 1886, 1886, 1886, 1886, 1886, 1886, 1886, 1886, 1886,
- /* 3040 */ 1886, 1886, 1886, 1886, 1886, 1886, 1886, 1886, 1886, 1886,
- /* 3050 */ 1886, 1886, 1886, 1886, 1886, 1886, 1886, 2329, 1886, 1886,
- /* 3060 */ 2367, 1886, 1886, 351, 2331, 745, 2333, 2334, 740, 1886,
- /* 3070 */ 735,
+ /* 0 */ 1921, 2322, 565, 2077, 466, 566, 1941, 14, 13, 465,
+ /* 10 */ 2175, 2305, 48, 46, 1818, 2330, 2520, 34, 411, 2515,
+ /* 20 */ 417, 1684, 1659, 41, 40, 2326, 171, 47, 45, 44,
+ /* 30 */ 43, 42, 2073, 645, 2090, 1744, 1984, 1657, 2519, 731,
+ /* 40 */ 2088, 698, 2516, 2518, 2515, 2346, 38, 320, 643, 582,
+ /* 50 */ 641, 269, 268, 2312, 673, 710, 146, 2515, 713, 137,
+ /* 60 */ 112, 673, 697, 203, 2515, 1739, 608, 2516, 699, 2328,
+ /* 70 */ 414, 19, 174, 2226, 1910, 2521, 203, 147, 1665, 741,
+ /* 80 */ 2516, 699, 2521, 203, 2226, 2080, 2364, 2516, 699, 41,
+ /* 90 */ 40, 2224, 718, 47, 45, 44, 43, 42, 2312, 410,
+ /* 100 */ 747, 585, 2223, 718, 842, 583, 2219, 15, 473, 817,
+ /* 110 */ 816, 815, 814, 429, 1787, 813, 812, 151, 807, 806,
+ /* 120 */ 805, 804, 803, 802, 801, 150, 795, 794, 793, 428,
+ /* 130 */ 427, 790, 789, 788, 183, 182, 787, 2064, 1314, 2345,
+ /* 140 */ 1313, 63, 2383, 1746, 1747, 114, 2347, 751, 2349, 2350,
+ /* 150 */ 746, 730, 741, 532, 530, 142, 366, 186, 573, 2436,
+ /* 160 */ 217, 566, 1941, 413, 2432, 300, 2444, 709, 570, 138,
+ /* 170 */ 708, 509, 2515, 1315, 567, 508, 184, 2141, 205, 2520,
+ /* 180 */ 1719, 1729, 2515, 507, 382, 656, 2466, 1745, 1748, 1860,
+ /* 190 */ 697, 203, 2139, 710, 146, 2516, 699, 1898, 384, 688,
+ /* 200 */ 2206, 2519, 1660, 63, 1658, 2516, 2517, 786, 196, 710,
+ /* 210 */ 146, 41, 40, 731, 2088, 47, 45, 44, 43, 42,
+ /* 220 */ 2128, 136, 135, 134, 133, 132, 131, 130, 129, 128,
+ /* 230 */ 730, 482, 2202, 208, 1663, 1664, 1716, 52, 1718, 1721,
+ /* 240 */ 1722, 1723, 1724, 1725, 1726, 1727, 1728, 743, 739, 1737,
+ /* 250 */ 1738, 1740, 1741, 1742, 1743, 2, 48, 46, 581, 2520,
+ /* 260 */ 1685, 364, 698, 1682, 417, 2515, 1659, 731, 2088, 99,
+ /* 270 */ 516, 237, 2346, 535, 376, 568, 1687, 1949, 534, 1744,
+ /* 280 */ 219, 1657, 692, 697, 203, 745, 272, 56, 2516, 699,
+ /* 290 */ 271, 694, 689, 682, 496, 450, 536, 464, 1687, 463,
+ /* 300 */ 1606, 365, 498, 202, 2444, 2445, 304, 144, 2449, 1739,
+ /* 310 */ 2364, 657, 476, 2364, 1684, 19, 1452, 51, 1773, 204,
+ /* 320 */ 2444, 2445, 1665, 144, 2449, 2312, 68, 747, 3, 462,
+ /* 330 */ 1443, 776, 775, 774, 1447, 773, 1449, 1450, 772, 769,
+ /* 340 */ 54, 1458, 766, 1460, 1461, 763, 760, 757, 842, 385,
+ /* 350 */ 1684, 15, 784, 161, 160, 781, 780, 779, 158, 98,
+ /* 360 */ 484, 1987, 371, 2451, 1884, 397, 2345, 647, 304, 2383,
+ /* 370 */ 2185, 691, 356, 2347, 751, 2349, 2350, 746, 744, 741,
+ /* 380 */ 732, 2401, 1774, 1578, 1579, 575, 2265, 1746, 1747, 2448,
+ /* 390 */ 2213, 2192, 1920, 523, 522, 521, 520, 515, 514, 513,
+ /* 400 */ 512, 368, 304, 710, 146, 502, 501, 500, 499, 493,
+ /* 410 */ 492, 491, 480, 486, 485, 383, 797, 731, 2088, 477,
+ /* 420 */ 1546, 1547, 173, 454, 1719, 1729, 1565, 1577, 1580, 63,
+ /* 430 */ 2027, 1745, 1748, 1297, 627, 626, 625, 137, 302, 1683,
+ /* 440 */ 730, 617, 143, 621, 613, 2312, 1660, 620, 1658, 184,
+ /* 450 */ 456, 452, 619, 624, 392, 391, 488, 2202, 618, 1684,
+ /* 460 */ 302, 614, 37, 415, 1768, 1769, 1770, 1771, 1772, 1776,
+ /* 470 */ 1777, 1778, 1779, 2207, 1558, 1559, 390, 389, 1663, 1664,
+ /* 480 */ 1716, 799, 1718, 1721, 1722, 1723, 1724, 1725, 1726, 1727,
+ /* 490 */ 1728, 743, 739, 1737, 1738, 1740, 1741, 1742, 1743, 2,
+ /* 500 */ 12, 48, 46, 2346, 738, 221, 2135, 2136, 2322, 417,
+ /* 510 */ 1720, 1659, 712, 201, 2444, 2445, 748, 144, 2449, 239,
+ /* 520 */ 159, 1685, 2079, 568, 1744, 1949, 1657, 51, 12, 36,
+ /* 530 */ 10, 2322, 2326, 95, 2346, 41, 40, 731, 2088, 47,
+ /* 540 */ 45, 44, 43, 42, 2364, 2331, 63, 713, 388, 387,
+ /* 550 */ 386, 610, 731, 2088, 1739, 2326, 2312, 470, 747, 2083,
+ /* 560 */ 19, 627, 626, 625, 731, 2088, 1717, 1665, 617, 143,
+ /* 570 */ 621, 693, 471, 612, 620, 2364, 2328, 611, 2519, 619,
+ /* 580 */ 624, 392, 391, 2141, 490, 618, 741, 2312, 614, 747,
+ /* 590 */ 398, 604, 603, 842, 304, 55, 15, 2345, 2139, 2328,
+ /* 600 */ 2383, 2346, 786, 114, 2347, 751, 2349, 2350, 746, 741,
+ /* 610 */ 741, 1317, 1318, 149, 748, 156, 2407, 2436, 9, 41,
+ /* 620 */ 40, 413, 2432, 47, 45, 44, 43, 42, 2345, 654,
+ /* 630 */ 1896, 2383, 1746, 1747, 114, 2347, 751, 2349, 2350, 746,
+ /* 640 */ 2274, 741, 2364, 1822, 1487, 1488, 186, 657, 2436, 1684,
+ /* 650 */ 518, 2202, 413, 2432, 2312, 127, 747, 1899, 126, 125,
+ /* 660 */ 124, 123, 122, 121, 120, 119, 118, 1765, 422, 1719,
+ /* 670 */ 1729, 2134, 2136, 1754, 2451, 2467, 1745, 1748, 127, 1684,
+ /* 680 */ 12, 126, 125, 124, 123, 122, 121, 120, 119, 118,
+ /* 690 */ 672, 1660, 304, 1658, 274, 2345, 731, 2088, 2383, 226,
+ /* 700 */ 2447, 114, 2347, 751, 2349, 2350, 746, 1919, 741, 432,
+ /* 710 */ 420, 304, 777, 2411, 431, 2436, 503, 159, 171, 413,
+ /* 720 */ 2432, 659, 2265, 1663, 1664, 1716, 2090, 1718, 1721, 1722,
+ /* 730 */ 1723, 1724, 1725, 1726, 1727, 1728, 743, 739, 1737, 1738,
+ /* 740 */ 1740, 1741, 1742, 1743, 2, 48, 46, 1749, 2346, 420,
+ /* 750 */ 426, 425, 634, 417, 1407, 1659, 1841, 168, 423, 673,
+ /* 760 */ 2312, 748, 2515, 1951, 399, 2090, 171, 646, 1744, 1406,
+ /* 770 */ 1657, 1842, 2139, 2159, 2090, 1666, 731, 2088, 2346, 106,
+ /* 780 */ 2521, 203, 95, 270, 1775, 2516, 699, 1716, 1314, 2364,
+ /* 790 */ 1313, 748, 1622, 2474, 223, 2141, 504, 1688, 1739, 637,
+ /* 800 */ 1395, 2312, 407, 747, 2081, 1891, 631, 629, 2084, 1720,
+ /* 810 */ 2139, 1665, 1840, 267, 47, 45, 44, 43, 42, 2364,
+ /* 820 */ 41, 40, 61, 1315, 47, 45, 44, 43, 42, 526,
+ /* 830 */ 670, 2312, 1688, 747, 1688, 90, 537, 842, 89, 1720,
+ /* 840 */ 49, 1397, 2345, 731, 2088, 2383, 2346, 1807, 114, 2347,
+ /* 850 */ 751, 2349, 2350, 746, 72, 741, 1659, 71, 1665, 748,
+ /* 860 */ 2535, 2487, 2436, 505, 35, 1717, 413, 2432, 701, 731,
+ /* 870 */ 2088, 1657, 2345, 1849, 1780, 2383, 1746, 1747, 114, 2347,
+ /* 880 */ 751, 2349, 2350, 746, 273, 741, 1918, 2364, 2065, 584,
+ /* 890 */ 2535, 227, 2436, 2141, 562, 1717, 413, 2432, 1815, 2312,
+ /* 900 */ 412, 747, 334, 560, 88, 2118, 556, 552, 2139, 1890,
+ /* 910 */ 731, 2088, 1665, 1719, 1729, 525, 524, 1917, 325, 1411,
+ /* 920 */ 1745, 1748, 685, 684, 1847, 1848, 1850, 1851, 1852, 2141,
+ /* 930 */ 2085, 1295, 511, 510, 1410, 1660, 421, 1658, 842, 2312,
+ /* 940 */ 2345, 612, 1669, 2383, 2139, 611, 114, 2347, 751, 2349,
+ /* 950 */ 2350, 746, 1916, 741, 1915, 1293, 1294, 1914, 2535, 194,
+ /* 960 */ 2436, 2075, 1627, 1628, 413, 2432, 2071, 1663, 1664, 1716,
+ /* 970 */ 2312, 1718, 1721, 1722, 1723, 1724, 1725, 1726, 1727, 1728,
+ /* 980 */ 743, 739, 1737, 1738, 1740, 1741, 1742, 1743, 2, 48,
+ /* 990 */ 46, 2346, 606, 605, 199, 2063, 198, 417, 733, 1659,
+ /* 1000 */ 2408, 539, 623, 622, 748, 2312, 680, 2312, 800, 2092,
+ /* 1010 */ 2312, 2049, 1744, 1689, 1657, 41, 40, 731, 2088, 47,
+ /* 1020 */ 45, 44, 43, 42, 784, 161, 160, 781, 780, 779,
+ /* 1030 */ 158, 171, 2364, 44, 43, 42, 1660, 275, 1658, 2091,
+ /* 1040 */ 30, 2451, 1739, 280, 2312, 1688, 747, 1913, 1689, 1684,
+ /* 1050 */ 1689, 311, 312, 41, 40, 1665, 310, 47, 45, 44,
+ /* 1060 */ 43, 42, 731, 2088, 1288, 1912, 2293, 2446, 1663, 1664,
+ /* 1070 */ 41, 40, 1909, 2346, 47, 45, 44, 43, 42, 731,
+ /* 1080 */ 2088, 842, 283, 1295, 49, 2345, 748, 148, 2383, 2346,
+ /* 1090 */ 2407, 114, 2347, 751, 2349, 2350, 746, 2141, 741, 716,
+ /* 1100 */ 2312, 702, 748, 2535, 2508, 2436, 1290, 1293, 1294, 413,
+ /* 1110 */ 2432, 735, 717, 2408, 2364, 1861, 811, 809, 2312, 401,
+ /* 1120 */ 1746, 1747, 2066, 731, 2088, 2312, 2312, 197, 747, 1908,
+ /* 1130 */ 2364, 784, 161, 160, 781, 780, 779, 158, 742, 2141,
+ /* 1140 */ 731, 2088, 2312, 315, 747, 76, 731, 2088, 2141, 731,
+ /* 1150 */ 2088, 731, 2088, 1834, 726, 152, 1907, 1719, 1729, 778,
+ /* 1160 */ 424, 1906, 2132, 2140, 1745, 1748, 728, 2345, 1814, 729,
+ /* 1170 */ 2383, 321, 2028, 357, 2347, 751, 2349, 2350, 746, 1660,
+ /* 1180 */ 741, 1658, 2312, 2345, 1905, 1904, 2383, 2456, 1807, 114,
+ /* 1190 */ 2347, 751, 2349, 2350, 746, 1911, 741, 87, 2306, 1903,
+ /* 1200 */ 652, 2535, 782, 2436, 1902, 2132, 1901, 413, 2432, 2312,
+ /* 1210 */ 284, 1663, 1664, 1716, 2312, 1718, 1721, 1722, 1723, 1724,
+ /* 1220 */ 1725, 1726, 1727, 1728, 743, 739, 1737, 1738, 1740, 1741,
+ /* 1230 */ 1742, 1743, 2, 48, 46, 139, 783, 2312, 2312, 2132,
+ /* 1240 */ 1971, 417, 615, 1659, 170, 1926, 837, 86, 673, 2296,
+ /* 1250 */ 673, 2515, 2312, 2515, 100, 2346, 1744, 2312, 1657, 2312,
+ /* 1260 */ 616, 1689, 628, 255, 260, 1717, 1392, 258, 748, 2521,
+ /* 1270 */ 203, 2521, 203, 1969, 2516, 699, 2516, 699, 262, 178,
+ /* 1280 */ 264, 261, 266, 263, 1390, 265, 1739, 1960, 602, 598,
+ /* 1290 */ 594, 590, 1958, 254, 210, 630, 2364, 41, 40, 1665,
+ /* 1300 */ 439, 47, 45, 44, 43, 42, 2480, 159, 2312, 632,
+ /* 1310 */ 747, 649, 705, 648, 635, 50, 50, 2333, 172, 187,
+ /* 1320 */ 1893, 1894, 1668, 340, 159, 842, 14, 13, 15, 50,
+ /* 1330 */ 309, 75, 2346, 297, 96, 686, 1667, 252, 1350, 658,
+ /* 1340 */ 338, 74, 157, 159, 73, 748, 66, 2455, 791, 2345,
+ /* 1350 */ 792, 141, 2383, 50, 367, 175, 2347, 751, 2349, 2350,
+ /* 1360 */ 746, 111, 741, 703, 1746, 1747, 235, 547, 545, 542,
+ /* 1370 */ 108, 291, 1369, 2364, 1367, 2335, 2025, 714, 2365, 1351,
+ /* 1380 */ 2024, 2211, 1625, 50, 1942, 2312, 2470, 747, 683, 673,
+ /* 1390 */ 1846, 1845, 2515, 403, 289, 690, 400, 674, 2477, 715,
+ /* 1400 */ 720, 1719, 1729, 242, 1575, 313, 723, 63, 1745, 1748,
+ /* 1410 */ 2521, 203, 251, 244, 1948, 2516, 699, 317, 1437, 249,
+ /* 1420 */ 579, 1781, 430, 1660, 2212, 1658, 2345, 673, 1730, 2383,
+ /* 1430 */ 2515, 1952, 114, 2347, 751, 2349, 2350, 746, 241, 741,
+ /* 1440 */ 755, 157, 2129, 159, 2535, 64, 2436, 140, 2521, 203,
+ /* 1450 */ 413, 2432, 157, 2516, 699, 1663, 1664, 1716, 333, 1718,
+ /* 1460 */ 1721, 1722, 1723, 1724, 1725, 1726, 1727, 1728, 743, 739,
+ /* 1470 */ 1737, 1738, 1740, 1741, 1742, 1743, 2, 666, 2471, 296,
+ /* 1480 */ 2481, 426, 425, 835, 2346, 711, 303, 299, 2050, 1671,
+ /* 1490 */ 5, 1673, 438, 433, 84, 83, 469, 748, 380, 216,
+ /* 1500 */ 446, 1692, 447, 1670, 1744, 458, 1666, 457, 212, 214,
+ /* 1510 */ 460, 2346, 461, 459, 1599, 1465, 1469, 211, 1476, 328,
+ /* 1520 */ 1682, 474, 1474, 363, 748, 2364, 448, 162, 1683, 445,
+ /* 1530 */ 441, 437, 434, 462, 1739, 481, 225, 2312, 483, 747,
+ /* 1540 */ 487, 489, 528, 506, 494, 517, 2204, 1665, 519, 527,
+ /* 1550 */ 529, 540, 2364, 541, 538, 230, 543, 229, 544, 232,
+ /* 1560 */ 546, 548, 1690, 563, 2312, 4, 747, 571, 564, 572,
+ /* 1570 */ 574, 240, 304, 737, 92, 1685, 706, 243, 2345, 576,
+ /* 1580 */ 2346, 2383, 1691, 577, 114, 2347, 751, 2349, 2350, 746,
+ /* 1590 */ 1693, 741, 578, 748, 246, 1694, 2409, 580, 2436, 248,
+ /* 1600 */ 93, 586, 413, 2432, 607, 2345, 2220, 94, 2383, 253,
+ /* 1610 */ 360, 114, 2347, 751, 2349, 2350, 746, 609, 741, 638,
+ /* 1620 */ 116, 2364, 639, 734, 2283, 2436, 2078, 651, 257, 413,
+ /* 1630 */ 2432, 2074, 259, 2312, 653, 747, 164, 165, 2076, 2072,
+ /* 1640 */ 97, 153, 166, 276, 167, 2280, 1686, 2279, 661, 329,
+ /* 1650 */ 2266, 662, 660, 281, 279, 687, 2486, 721, 668, 665,
+ /* 1660 */ 8, 667, 677, 2485, 696, 675, 404, 678, 676, 2458,
+ /* 1670 */ 2538, 1674, 294, 1669, 2345, 290, 179, 2383, 707, 293,
+ /* 1680 */ 115, 2347, 751, 2349, 2350, 746, 286, 741, 288, 295,
+ /* 1690 */ 292, 2514, 704, 1807, 2436, 2346, 655, 145, 2435, 2432,
+ /* 1700 */ 1687, 1812, 298, 1677, 1679, 2452, 1810, 1, 748, 719,
+ /* 1710 */ 190, 305, 154, 2234, 845, 724, 155, 739, 1737, 1738,
+ /* 1720 */ 1740, 1741, 1742, 1743, 2233, 2232, 330, 2346, 331, 409,
+ /* 1730 */ 327, 725, 105, 2133, 2089, 332, 2364, 62, 107, 2417,
+ /* 1740 */ 748, 206, 1272, 335, 753, 839, 193, 836, 2312, 841,
+ /* 1750 */ 747, 323, 163, 372, 53, 833, 829, 825, 821, 359,
+ /* 1760 */ 324, 373, 2346, 339, 2304, 337, 2303, 2302, 2364, 344,
+ /* 1770 */ 81, 358, 348, 2297, 435, 748, 436, 1650, 1651, 209,
+ /* 1780 */ 2312, 440, 747, 2295, 442, 443, 444, 1649, 2294, 2345,
+ /* 1790 */ 381, 2292, 2383, 449, 2291, 115, 2347, 751, 2349, 2350,
+ /* 1800 */ 746, 113, 741, 2364, 318, 451, 2290, 453, 2289, 2436,
+ /* 1810 */ 1638, 455, 2270, 736, 2432, 2312, 213, 747, 2269, 215,
+ /* 1820 */ 1602, 749, 82, 1601, 2383, 2247, 2246, 115, 2347, 751,
+ /* 1830 */ 2349, 2350, 746, 2245, 741, 2346, 727, 467, 468, 2244,
+ /* 1840 */ 2243, 2436, 2194, 2191, 472, 375, 2432, 1545, 748, 2190,
+ /* 1850 */ 475, 2184, 479, 478, 2181, 2180, 2345, 2179, 2346, 2383,
+ /* 1860 */ 218, 2178, 176, 2347, 751, 2349, 2350, 746, 85, 741,
+ /* 1870 */ 2183, 748, 2182, 220, 2177, 2176, 2364, 2174, 2346, 307,
+ /* 1880 */ 222, 495, 2171, 497, 2169, 2168, 306, 2173, 2312, 2172,
+ /* 1890 */ 747, 748, 2167, 2346, 2166, 2189, 2165, 2164, 2163, 2364,
+ /* 1900 */ 2187, 2170, 2162, 2161, 2160, 277, 748, 2158, 2157, 2156,
+ /* 1910 */ 2155, 2312, 2154, 747, 224, 2152, 700, 2536, 2153, 2364,
+ /* 1920 */ 2151, 91, 2150, 2149, 402, 2188, 2186, 2148, 2147, 2345,
+ /* 1930 */ 2146, 2312, 2383, 747, 2364, 115, 2347, 751, 2349, 2350,
+ /* 1940 */ 746, 1551, 741, 2145, 228, 2144, 2312, 531, 747, 2436,
+ /* 1950 */ 533, 2143, 2345, 2142, 2433, 2383, 1408, 1412, 175, 2347,
+ /* 1960 */ 751, 2349, 2350, 746, 1990, 741, 369, 370, 1404, 1989,
+ /* 1970 */ 231, 233, 2345, 1988, 1986, 2383, 234, 1983, 357, 2347,
+ /* 1980 */ 751, 2349, 2350, 746, 549, 741, 551, 2345, 1982, 2346,
+ /* 1990 */ 2383, 550, 553, 350, 2347, 751, 2349, 2350, 746, 554,
+ /* 2000 */ 741, 2478, 748, 555, 1975, 557, 1962, 558, 559, 561,
+ /* 2010 */ 1937, 185, 236, 78, 2332, 1296, 1936, 2268, 79, 195,
+ /* 2020 */ 2264, 2254, 238, 2242, 569, 2346, 245, 247, 2241, 250,
+ /* 2030 */ 2364, 2218, 2067, 1985, 1343, 1981, 587, 588, 748, 695,
+ /* 2040 */ 589, 1979, 2312, 592, 747, 591, 1977, 593, 595, 597,
+ /* 2050 */ 1974, 596, 599, 600, 601, 1957, 1955, 2346, 1956, 1954,
+ /* 2060 */ 1933, 2069, 1481, 256, 65, 1480, 2364, 1394, 1972, 1380,
+ /* 2070 */ 745, 408, 2068, 1393, 1391, 1389, 1388, 1387, 2312, 1386,
+ /* 2080 */ 747, 1385, 808, 2345, 810, 1382, 2383, 393, 1970, 176,
+ /* 2090 */ 2347, 751, 2349, 2350, 746, 394, 741, 1961, 2364, 1381,
+ /* 2100 */ 1379, 395, 1959, 396, 1932, 633, 636, 1931, 1930, 1929,
+ /* 2110 */ 2312, 640, 747, 642, 1928, 644, 117, 1632, 2267, 2345,
+ /* 2120 */ 1634, 1631, 2383, 57, 278, 357, 2347, 751, 2349, 2350,
+ /* 2130 */ 746, 29, 741, 69, 2346, 1636, 2263, 1608, 1612, 58,
+ /* 2140 */ 2253, 1610, 663, 169, 2537, 664, 2240, 748, 2239, 669,
+ /* 2150 */ 2346, 2345, 2520, 1863, 2383, 20, 17, 356, 2347, 751,
+ /* 2160 */ 2349, 2350, 746, 748, 741, 1587, 2402, 282, 2346, 1586,
+ /* 2170 */ 671, 31, 21, 285, 6, 2364, 679, 7, 287, 200,
+ /* 2180 */ 416, 748, 2333, 22, 177, 681, 1844, 2312, 189, 747,
+ /* 2190 */ 33, 2364, 188, 32, 67, 24, 418, 1833, 80, 2238,
+ /* 2200 */ 1883, 23, 1884, 2312, 1878, 747, 1877, 405, 1882, 2364,
+ /* 2210 */ 18, 1881, 406, 1804, 1803, 301, 59, 60, 2217, 101,
+ /* 2220 */ 102, 2312, 180, 747, 25, 2216, 108, 103, 2345, 308,
+ /* 2230 */ 191, 2383, 314, 2346, 357, 2347, 751, 2349, 2350, 746,
+ /* 2240 */ 1839, 741, 70, 722, 2345, 104, 748, 2383, 26, 319,
+ /* 2250 */ 357, 2347, 751, 2349, 2350, 746, 1756, 741, 1755, 13,
+ /* 2260 */ 11, 1675, 650, 1766, 1734, 2383, 2386, 2346, 352, 2347,
+ /* 2270 */ 751, 2349, 2350, 746, 2364, 741, 1732, 181, 192, 316,
+ /* 2280 */ 748, 1709, 752, 740, 39, 754, 2312, 1731, 747, 1701,
+ /* 2290 */ 2346, 750, 1457, 16, 27, 28, 1341, 1466, 419, 756,
+ /* 2300 */ 758, 1463, 759, 748, 1462, 761, 1459, 764, 2364, 762,
+ /* 2310 */ 765, 767, 1453, 768, 770, 1451, 771, 109, 1456, 322,
+ /* 2320 */ 2312, 110, 747, 77, 1475, 1455, 1471, 2345, 1376, 1454,
+ /* 2330 */ 2383, 2364, 1373, 342, 2347, 751, 2349, 2350, 746, 1372,
+ /* 2340 */ 741, 207, 785, 2312, 1371, 747, 1370, 2346, 1368, 1366,
+ /* 2350 */ 1365, 1364, 796, 798, 1402, 1362, 1401, 1361, 1360, 1359,
+ /* 2360 */ 748, 2345, 1358, 1357, 2383, 1356, 1398, 341, 2347, 751,
+ /* 2370 */ 2349, 2350, 746, 1396, 741, 1353, 1352, 1349, 1348, 1347,
+ /* 2380 */ 1346, 1980, 818, 819, 2345, 823, 820, 2383, 2364, 1978,
+ /* 2390 */ 343, 2347, 751, 2349, 2350, 746, 822, 741, 824, 1976,
+ /* 2400 */ 2312, 826, 747, 827, 828, 1973, 830, 832, 1953, 831,
+ /* 2410 */ 834, 1285, 1927, 1273, 326, 838, 840, 1897, 1661, 336,
+ /* 2420 */ 2346, 843, 844, 1897, 1897, 1897, 1897, 1897, 1897, 1897,
+ /* 2430 */ 1897, 1897, 1897, 748, 1897, 1897, 1897, 1897, 1897, 1897,
+ /* 2440 */ 2346, 2345, 1897, 1897, 2383, 1897, 1897, 349, 2347, 751,
+ /* 2450 */ 2349, 2350, 746, 748, 741, 1897, 1897, 1897, 1897, 1897,
+ /* 2460 */ 1897, 2364, 1897, 1897, 1897, 1897, 1897, 1897, 1897, 1897,
+ /* 2470 */ 1897, 1897, 1897, 2312, 1897, 747, 1897, 1897, 1897, 1897,
+ /* 2480 */ 1897, 2364, 1897, 1897, 1897, 1897, 1897, 1897, 1897, 1897,
+ /* 2490 */ 1897, 1897, 1897, 2312, 1897, 747, 1897, 1897, 2346, 1897,
+ /* 2500 */ 1897, 1897, 1897, 1897, 1897, 1897, 1897, 1897, 1897, 1897,
+ /* 2510 */ 1897, 748, 1897, 2346, 2345, 1897, 1897, 2383, 1897, 1897,
+ /* 2520 */ 353, 2347, 751, 2349, 2350, 746, 748, 741, 1897, 1897,
+ /* 2530 */ 1897, 1897, 1897, 1897, 2345, 2346, 1897, 2383, 1897, 2364,
+ /* 2540 */ 345, 2347, 751, 2349, 2350, 746, 1897, 741, 748, 1897,
+ /* 2550 */ 1897, 2312, 1897, 747, 2364, 1897, 1897, 1897, 1897, 1897,
+ /* 2560 */ 1897, 1897, 1897, 1897, 1897, 1897, 2312, 1897, 747, 1897,
+ /* 2570 */ 1897, 1897, 1897, 1897, 1897, 1897, 2364, 1897, 1897, 1897,
+ /* 2580 */ 1897, 1897, 1897, 1897, 1897, 1897, 1897, 1897, 2312, 1897,
+ /* 2590 */ 747, 1897, 2345, 2346, 1897, 2383, 1897, 1897, 354, 2347,
+ /* 2600 */ 751, 2349, 2350, 746, 1897, 741, 748, 2345, 2346, 1897,
+ /* 2610 */ 2383, 1897, 1897, 346, 2347, 751, 2349, 2350, 746, 1897,
+ /* 2620 */ 741, 748, 1897, 1897, 1897, 1897, 1897, 1897, 2346, 2345,
+ /* 2630 */ 1897, 1897, 2383, 1897, 2364, 355, 2347, 751, 2349, 2350,
+ /* 2640 */ 746, 748, 741, 1897, 1897, 1897, 2312, 1897, 747, 2364,
+ /* 2650 */ 1897, 1897, 1897, 1897, 1897, 1897, 1897, 1897, 1897, 1897,
+ /* 2660 */ 1897, 2312, 1897, 747, 1897, 1897, 1897, 1897, 1897, 2364,
+ /* 2670 */ 1897, 1897, 1897, 1897, 1897, 1897, 1897, 1897, 1897, 1897,
+ /* 2680 */ 1897, 2312, 1897, 747, 1897, 1897, 1897, 2345, 1897, 1897,
+ /* 2690 */ 2383, 1897, 1897, 347, 2347, 751, 2349, 2350, 746, 1897,
+ /* 2700 */ 741, 2346, 2345, 1897, 1897, 2383, 1897, 1897, 361, 2347,
+ /* 2710 */ 751, 2349, 2350, 746, 748, 741, 1897, 1897, 1897, 1897,
+ /* 2720 */ 1897, 2346, 2345, 1897, 1897, 2383, 1897, 1897, 362, 2347,
+ /* 2730 */ 751, 2349, 2350, 746, 748, 741, 1897, 1897, 2346, 1897,
+ /* 2740 */ 1897, 1897, 2364, 1897, 1897, 1897, 1897, 1897, 1897, 1897,
+ /* 2750 */ 1897, 748, 1897, 1897, 2312, 1897, 747, 1897, 1897, 1897,
+ /* 2760 */ 1897, 1897, 2364, 1897, 1897, 1897, 1897, 1897, 1897, 1897,
+ /* 2770 */ 1897, 1897, 1897, 1897, 2312, 1897, 747, 1897, 1897, 2364,
+ /* 2780 */ 1897, 1897, 1897, 1897, 1897, 1897, 1897, 1897, 1897, 1897,
+ /* 2790 */ 1897, 2312, 1897, 747, 1897, 2345, 1897, 1897, 2383, 1897,
+ /* 2800 */ 1897, 2358, 2347, 751, 2349, 2350, 746, 2346, 741, 1897,
+ /* 2810 */ 1897, 1897, 1897, 1897, 1897, 2345, 1897, 1897, 2383, 1897,
+ /* 2820 */ 748, 2357, 2347, 751, 2349, 2350, 746, 1897, 741, 1897,
+ /* 2830 */ 1897, 1897, 2345, 1897, 1897, 2383, 1897, 1897, 2356, 2347,
+ /* 2840 */ 751, 2349, 2350, 746, 1897, 741, 1897, 1897, 2364, 1897,
+ /* 2850 */ 1897, 1897, 1897, 1897, 1897, 1897, 1897, 1897, 1897, 1897,
+ /* 2860 */ 2312, 1897, 747, 1897, 1897, 2346, 1897, 1897, 1897, 1897,
+ /* 2870 */ 1897, 1897, 1897, 1897, 1897, 1897, 1897, 1897, 748, 1897,
+ /* 2880 */ 2346, 1897, 1897, 1897, 1897, 1897, 1897, 1897, 1897, 1897,
+ /* 2890 */ 1897, 1897, 1897, 748, 1897, 1897, 1897, 1897, 1897, 1897,
+ /* 2900 */ 1897, 2345, 2346, 1897, 2383, 1897, 2364, 377, 2347, 751,
+ /* 2910 */ 2349, 2350, 746, 1897, 741, 748, 1897, 1897, 2312, 1897,
+ /* 2920 */ 747, 2364, 1897, 1897, 1897, 1897, 1897, 1897, 1897, 1897,
+ /* 2930 */ 1897, 1897, 1897, 2312, 1897, 747, 1897, 1897, 1897, 1897,
+ /* 2940 */ 1897, 1897, 1897, 2364, 1897, 1897, 1897, 1897, 1897, 1897,
+ /* 2950 */ 1897, 1897, 1897, 1897, 1897, 2312, 1897, 747, 1897, 2345,
+ /* 2960 */ 2346, 1897, 2383, 1897, 1897, 378, 2347, 751, 2349, 2350,
+ /* 2970 */ 746, 1897, 741, 748, 2345, 2346, 1897, 2383, 1897, 1897,
+ /* 2980 */ 374, 2347, 751, 2349, 2350, 746, 1897, 741, 748, 1897,
+ /* 2990 */ 1897, 1897, 1897, 1897, 1897, 1897, 2345, 1897, 1897, 2383,
+ /* 3000 */ 1897, 2364, 379, 2347, 751, 2349, 2350, 746, 1897, 741,
+ /* 3010 */ 1897, 1897, 1897, 2312, 1897, 747, 2364, 1897, 1897, 1897,
+ /* 3020 */ 1897, 1897, 1897, 1897, 1897, 1897, 1897, 1897, 2312, 1897,
+ /* 3030 */ 747, 1897, 1897, 1897, 1897, 1897, 1897, 1897, 1897, 1897,
+ /* 3040 */ 1897, 1897, 1897, 1897, 1897, 1897, 1897, 1897, 1897, 1897,
+ /* 3050 */ 1897, 1897, 1897, 1897, 749, 1897, 1897, 2383, 1897, 1897,
+ /* 3060 */ 352, 2347, 751, 2349, 2350, 746, 1897, 741, 1897, 2345,
+ /* 3070 */ 1897, 1897, 2383, 1897, 1897, 351, 2347, 751, 2349, 2350,
+ /* 3080 */ 746, 1897, 741,
};
static const YYCODETYPE yy_lookahead[] = {
- /* 0 */ 383, 357, 432, 383, 360, 361, 357, 392, 391, 360,
- /* 10 */ 361, 391, 12, 13, 14, 405, 399, 2, 398, 399,
- /* 20 */ 20, 362, 22, 8, 9, 20, 406, 12, 13, 14,
- /* 30 */ 15, 16, 2, 423, 424, 35, 0, 37, 8, 9,
- /* 40 */ 465, 466, 12, 13, 14, 15, 16, 350, 8, 9,
- /* 50 */ 362, 363, 12, 13, 14, 15, 16, 362, 363, 20,
- /* 60 */ 363, 391, 404, 405, 64, 0, 407, 408, 401, 410,
- /* 70 */ 70, 404, 405, 414, 8, 9, 372, 77, 12, 13,
- /* 80 */ 14, 15, 16, 413, 380, 415, 21, 371, 391, 24,
- /* 90 */ 25, 26, 27, 28, 29, 30, 31, 32, 20, 411,
- /* 100 */ 403, 358, 405, 103, 388, 362, 106, 364, 72, 73,
- /* 110 */ 74, 75, 76, 397, 78, 79, 80, 81, 82, 83,
+ /* 0 */ 353, 382, 360, 395, 429, 363, 364, 1, 2, 434,
+ /* 10 */ 0, 429, 12, 13, 14, 396, 479, 2, 386, 482,
+ /* 20 */ 20, 20, 22, 8, 9, 406, 394, 12, 13, 14,
+ /* 30 */ 15, 16, 395, 21, 402, 35, 0, 37, 501, 365,
+ /* 40 */ 366, 479, 505, 506, 482, 353, 468, 469, 36, 365,
+ /* 50 */ 38, 39, 40, 406, 479, 365, 366, 482, 366, 385,
+ /* 60 */ 372, 479, 500, 501, 482, 65, 392, 505, 506, 450,
+ /* 70 */ 451, 71, 352, 408, 354, 500, 501, 389, 78, 460,
+ /* 80 */ 505, 506, 500, 501, 408, 397, 394, 505, 506, 8,
+ /* 90 */ 9, 426, 427, 12, 13, 14, 15, 16, 406, 423,
+ /* 100 */ 408, 70, 426, 427, 104, 421, 422, 107, 365, 73,
+ /* 110 */ 74, 75, 76, 77, 108, 79, 80, 81, 82, 83,
/* 120 */ 84, 85, 86, 87, 88, 89, 90, 91, 92, 93,
- /* 130 */ 94, 95, 96, 97, 98, 99, 476, 362, 363, 479,
- /* 140 */ 22, 444, 142, 143, 447, 363, 391, 450, 451, 452,
- /* 150 */ 453, 454, 455, 460, 457, 37, 463, 497, 498, 462,
- /* 160 */ 69, 464, 502, 503, 4, 468, 469, 472, 473, 474,
- /* 170 */ 415, 476, 477, 391, 479, 362, 363, 177, 178, 449,
- /* 180 */ 483, 142, 143, 23, 184, 185, 411, 20, 491, 391,
- /* 190 */ 20, 20, 497, 498, 405, 77, 398, 502, 503, 199,
- /* 200 */ 349, 201, 351, 3, 406, 475, 46, 47, 48, 420,
- /* 210 */ 8, 9, 423, 424, 12, 13, 14, 15, 16, 21,
- /* 220 */ 20, 103, 24, 25, 26, 27, 28, 29, 30, 31,
- /* 230 */ 32, 231, 232, 233, 452, 235, 236, 237, 238, 239,
+ /* 130 */ 94, 95, 96, 97, 98, 99, 100, 0, 20, 447,
+ /* 140 */ 22, 107, 450, 143, 144, 453, 454, 455, 456, 457,
+ /* 150 */ 458, 20, 460, 410, 411, 37, 413, 465, 360, 467,
+ /* 160 */ 417, 363, 364, 471, 472, 475, 476, 477, 14, 479,
+ /* 170 */ 480, 161, 482, 55, 20, 165, 394, 394, 486, 479,
+ /* 180 */ 180, 181, 482, 173, 401, 20, 494, 187, 188, 108,
+ /* 190 */ 500, 501, 409, 365, 366, 505, 506, 0, 416, 186,
+ /* 200 */ 418, 501, 202, 107, 204, 505, 506, 70, 393, 365,
+ /* 210 */ 366, 8, 9, 365, 366, 12, 13, 14, 15, 16,
+ /* 220 */ 405, 24, 25, 26, 27, 28, 29, 30, 31, 32,
+ /* 230 */ 20, 365, 366, 385, 234, 235, 236, 107, 238, 239,
/* 240 */ 240, 241, 242, 243, 244, 245, 246, 247, 248, 249,
- /* 250 */ 250, 251, 252, 12, 13, 177, 178, 191, 18, 183,
- /* 260 */ 20, 20, 20, 22, 22, 362, 363, 27, 22, 350,
- /* 270 */ 30, 20, 70, 106, 476, 35, 35, 479, 37, 37,
- /* 280 */ 379, 20, 363, 37, 471, 472, 473, 474, 137, 476,
- /* 290 */ 477, 51, 141, 53, 393, 497, 498, 55, 58, 476,
- /* 300 */ 502, 503, 479, 369, 403, 64, 0, 107, 68, 14,
- /* 310 */ 391, 70, 142, 143, 411, 20, 114, 199, 77, 201,
- /* 320 */ 386, 498, 403, 77, 405, 502, 503, 350, 394, 390,
- /* 330 */ 24, 25, 26, 27, 28, 29, 30, 31, 32, 135,
- /* 340 */ 363, 402, 365, 139, 103, 105, 20, 106, 447, 231,
- /* 350 */ 232, 275, 276, 277, 184, 185, 116, 106, 457, 208,
- /* 360 */ 362, 295, 211, 444, 0, 214, 447, 216, 391, 450,
- /* 370 */ 451, 452, 453, 454, 455, 20, 457, 50, 176, 179,
- /* 380 */ 403, 369, 405, 142, 143, 350, 146, 147, 0, 149,
- /* 390 */ 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
- /* 400 */ 160, 161, 162, 163, 164, 165, 394, 167, 168, 169,
- /* 410 */ 22, 492, 493, 173, 174, 175, 418, 419, 177, 178,
- /* 420 */ 180, 444, 20, 116, 447, 184, 185, 450, 451, 452,
- /* 430 */ 453, 454, 455, 69, 457, 20, 269, 21, 403, 462,
- /* 440 */ 199, 464, 201, 8, 9, 468, 469, 12, 13, 14,
- /* 450 */ 15, 16, 36, 77, 38, 39, 40, 426, 256, 257,
- /* 460 */ 258, 259, 260, 261, 262, 263, 264, 265, 266, 69,
- /* 470 */ 136, 137, 231, 232, 233, 141, 235, 236, 237, 238,
- /* 480 */ 239, 240, 241, 242, 243, 244, 245, 246, 247, 248,
- /* 490 */ 249, 250, 251, 252, 253, 12, 13, 35, 358, 350,
- /* 500 */ 20, 22, 362, 20, 364, 22, 179, 476, 106, 350,
- /* 510 */ 479, 106, 363, 51, 187, 253, 37, 4, 35, 51,
- /* 520 */ 37, 59, 60, 61, 62, 64, 64, 59, 497, 498,
- /* 530 */ 62, 63, 350, 502, 503, 350, 33, 72, 73, 74,
- /* 540 */ 391, 362, 107, 86, 79, 80, 81, 64, 363, 362,
- /* 550 */ 85, 0, 403, 70, 405, 90, 91, 92, 93, 233,
- /* 560 */ 77, 96, 403, 33, 99, 476, 105, 105, 479, 108,
- /* 570 */ 108, 56, 57, 8, 9, 45, 391, 12, 13, 14,
- /* 580 */ 15, 16, 103, 12, 13, 403, 103, 498, 403, 106,
- /* 590 */ 405, 502, 503, 444, 179, 20, 447, 22, 33, 450,
- /* 600 */ 451, 452, 453, 454, 455, 148, 457, 379, 37, 460,
- /* 610 */ 107, 462, 463, 464, 14, 436, 437, 468, 469, 106,
- /* 620 */ 20, 393, 116, 436, 437, 142, 143, 170, 171, 444,
- /* 630 */ 55, 403, 447, 172, 172, 450, 451, 452, 453, 454,
- /* 640 */ 455, 391, 457, 181, 182, 367, 368, 462, 398, 464,
- /* 650 */ 188, 189, 34, 468, 469, 449, 406, 177, 8, 9,
- /* 660 */ 177, 178, 12, 13, 14, 15, 16, 184, 185, 207,
- /* 670 */ 33, 269, 107, 14, 269, 447, 491, 0, 0, 20,
- /* 680 */ 103, 475, 199, 392, 201, 457, 135, 136, 137, 138,
- /* 690 */ 139, 140, 141, 106, 117, 118, 119, 120, 121, 122,
- /* 700 */ 123, 124, 125, 126, 391, 128, 129, 130, 131, 132,
- /* 710 */ 133, 134, 399, 233, 231, 232, 233, 172, 235, 236,
- /* 720 */ 237, 238, 239, 240, 241, 242, 243, 244, 245, 246,
- /* 730 */ 247, 248, 249, 250, 251, 252, 12, 13, 14, 392,
- /* 740 */ 350, 14, 15, 16, 20, 391, 22, 350, 203, 72,
- /* 750 */ 73, 74, 398, 363, 231, 365, 79, 80, 81, 35,
- /* 760 */ 406, 37, 85, 362, 363, 362, 363, 90, 91, 92,
- /* 770 */ 93, 350, 201, 96, 362, 363, 99, 177, 347, 0,
- /* 780 */ 42, 391, 269, 382, 363, 382, 365, 392, 64, 253,
- /* 790 */ 389, 255, 389, 403, 382, 405, 367, 368, 68, 449,
- /* 800 */ 403, 77, 350, 280, 281, 282, 283, 284, 285, 286,
- /* 810 */ 426, 392, 391, 8, 9, 431, 391, 12, 13, 14,
- /* 820 */ 15, 16, 14, 398, 403, 475, 405, 103, 20, 179,
- /* 830 */ 106, 406, 392, 233, 444, 350, 177, 447, 350, 161,
- /* 840 */ 450, 451, 452, 453, 454, 455, 391, 457, 170, 362,
- /* 850 */ 363, 363, 462, 398, 464, 403, 269, 426, 468, 469,
- /* 860 */ 476, 406, 431, 479, 3, 444, 142, 143, 447, 382,
- /* 870 */ 392, 450, 451, 452, 453, 454, 455, 426, 457, 391,
- /* 880 */ 371, 497, 498, 462, 350, 464, 502, 503, 403, 468,
- /* 890 */ 469, 403, 233, 405, 135, 136, 137, 138, 139, 140,
- /* 900 */ 141, 177, 178, 362, 363, 383, 397, 476, 184, 185,
- /* 910 */ 479, 391, 107, 391, 135, 136, 137, 138, 139, 140,
- /* 920 */ 141, 399, 49, 199, 194, 201, 406, 476, 497, 498,
- /* 930 */ 479, 294, 444, 502, 503, 447, 0, 403, 450, 451,
- /* 940 */ 452, 453, 454, 455, 456, 457, 458, 459, 497, 498,
- /* 950 */ 176, 221, 222, 502, 503, 231, 232, 233, 22, 235,
- /* 960 */ 236, 237, 238, 239, 240, 241, 242, 243, 244, 245,
- /* 970 */ 246, 247, 248, 249, 250, 251, 252, 12, 13, 106,
- /* 980 */ 350, 362, 363, 22, 426, 20, 37, 22, 350, 1,
- /* 990 */ 362, 363, 461, 363, 463, 365, 362, 363, 37, 136,
- /* 1000 */ 35, 382, 37, 383, 362, 363, 268, 19, 376, 377,
- /* 1010 */ 382, 391, 350, 472, 473, 474, 382, 476, 477, 399,
- /* 1020 */ 0, 391, 379, 35, 382, 363, 77, 365, 37, 64,
- /* 1030 */ 256, 362, 363, 403, 476, 405, 393, 479, 4, 51,
- /* 1040 */ 266, 403, 77, 362, 363, 64, 403, 59, 60, 61,
- /* 1050 */ 62, 382, 64, 391, 13, 497, 498, 387, 362, 363,
- /* 1060 */ 502, 503, 42, 382, 103, 403, 380, 405, 103, 362,
- /* 1070 */ 363, 106, 350, 4, 444, 212, 213, 447, 382, 20,
- /* 1080 */ 450, 451, 452, 453, 454, 455, 426, 457, 19, 108,
- /* 1090 */ 447, 448, 462, 105, 464, 20, 108, 20, 468, 469,
- /* 1100 */ 457, 362, 363, 0, 35, 351, 444, 142, 143, 447,
- /* 1110 */ 23, 441, 450, 451, 452, 453, 454, 455, 77, 457,
- /* 1120 */ 51, 382, 20, 33, 462, 403, 464, 58, 140, 378,
- /* 1130 */ 468, 469, 381, 64, 47, 48, 476, 376, 377, 479,
- /* 1140 */ 8, 9, 177, 178, 12, 13, 14, 15, 16, 184,
- /* 1150 */ 185, 290, 20, 39, 40, 362, 363, 497, 498, 461,
- /* 1160 */ 33, 463, 502, 503, 199, 400, 201, 391, 403, 181,
- /* 1170 */ 350, 362, 363, 391, 105, 382, 188, 108, 106, 472,
- /* 1180 */ 473, 474, 406, 476, 477, 1, 2, 115, 406, 426,
- /* 1190 */ 106, 382, 201, 350, 350, 207, 231, 232, 233, 350,
- /* 1200 */ 235, 236, 237, 238, 239, 240, 241, 242, 243, 244,
- /* 1210 */ 245, 246, 247, 248, 249, 250, 251, 252, 12, 13,
- /* 1220 */ 362, 363, 350, 403, 110, 111, 20, 113, 22, 12,
- /* 1230 */ 13, 14, 15, 16, 107, 363, 350, 365, 179, 476,
- /* 1240 */ 382, 35, 479, 37, 362, 363, 403, 403, 350, 135,
- /* 1250 */ 350, 350, 403, 139, 362, 363, 362, 363, 362, 363,
- /* 1260 */ 497, 498, 0, 391, 382, 502, 503, 362, 363, 400,
- /* 1270 */ 64, 116, 403, 70, 382, 403, 382, 405, 382, 350,
- /* 1280 */ 350, 179, 198, 77, 200, 400, 416, 382, 403, 403,
- /* 1290 */ 384, 107, 233, 387, 353, 354, 109, 267, 268, 112,
- /* 1300 */ 215, 403, 217, 403, 403, 271, 33, 33, 233, 103,
- /* 1310 */ 233, 179, 106, 51, 230, 37, 444, 350, 45, 447,
- /* 1320 */ 13, 166, 450, 451, 452, 453, 454, 455, 225, 457,
- /* 1330 */ 363, 0, 403, 403, 462, 233, 464, 12, 13, 109,
- /* 1340 */ 468, 469, 112, 109, 37, 13, 112, 22, 142, 143,
- /* 1350 */ 495, 109, 0, 269, 112, 13, 33, 37, 391, 33,
- /* 1360 */ 35, 13, 37, 506, 33, 233, 33, 142, 143, 37,
- /* 1370 */ 403, 366, 405, 391, 22, 488, 1, 2, 379, 37,
- /* 1380 */ 0, 107, 292, 177, 178, 37, 379, 33, 33, 64,
- /* 1390 */ 184, 185, 33, 33, 33, 416, 33, 77, 33, 33,
- /* 1400 */ 33, 33, 77, 33, 33, 199, 33, 201, 361, 416,
- /* 1410 */ 33, 444, 494, 494, 447, 494, 494, 450, 451, 452,
- /* 1420 */ 453, 454, 455, 425, 457, 416, 366, 363, 103, 462,
- /* 1430 */ 107, 464, 52, 107, 231, 468, 469, 231, 232, 233,
- /* 1440 */ 107, 235, 236, 237, 238, 239, 240, 241, 242, 243,
- /* 1450 */ 244, 245, 246, 247, 248, 249, 250, 251, 252, 402,
- /* 1460 */ 18, 107, 107, 478, 433, 23, 107, 107, 107, 416,
- /* 1470 */ 107, 416, 107, 107, 107, 107, 499, 107, 107, 201,
- /* 1480 */ 107, 470, 40, 41, 107, 481, 44, 381, 272, 427,
- /* 1490 */ 51, 446, 42, 445, 20, 214, 54, 443, 197, 438,
- /* 1500 */ 350, 371, 371, 438, 20, 429, 362, 65, 66, 67,
- /* 1510 */ 68, 20, 363, 363, 45, 363, 412, 412, 409, 176,
- /* 1520 */ 362, 409, 363, 362, 199, 412, 201, 409, 104, 375,
- /* 1530 */ 102, 374, 362, 101, 362, 373, 362, 362, 20, 50,
- /* 1540 */ 355, 391, 359, 355, 371, 359, 438, 371, 106, 20,
- /* 1550 */ 405, 371, 20, 403, 364, 405, 231, 232, 20, 364,
- /* 1560 */ 371, 428, 371, 20, 371, 419, 362, 371, 371, 355,
- /* 1570 */ 245, 246, 247, 248, 249, 250, 251, 353, 355, 353,
- /* 1580 */ 362, 403, 403, 391, 403, 391, 144, 218, 106, 391,
- /* 1590 */ 391, 391, 391, 391, 444, 442, 391, 447, 391, 391,
- /* 1600 */ 450, 451, 452, 453, 454, 455, 391, 457, 440, 438,
- /* 1610 */ 369, 20, 462, 205, 464, 204, 405, 435, 468, 469,
- /* 1620 */ 369, 362, 403, 279, 487, 278, 350, 487, 287, 490,
- /* 1630 */ 190, 489, 485, 191, 192, 193, 296, 486, 196, 363,
- /* 1640 */ 427, 421, 421, 487, 434, 289, 437, 273, 484, 427,
- /* 1650 */ 288, 209, 210, 268, 363, 507, 20, 293, 116, 482,
- /* 1660 */ 350, 501, 220, 291, 270, 223, 500, 391, 226, 227,
- /* 1670 */ 228, 229, 230, 363, 369, 364, 449, 369, 421, 403,
- /* 1680 */ 403, 405, 403, 403, 421, 403, 403, 182, 417, 387,
- /* 1690 */ 369, 369, 480, 363, 106, 467, 106, 403, 395, 362,
- /* 1700 */ 22, 391, 352, 369, 38, 356, 355, 439, 422, 422,
- /* 1710 */ 0, 269, 385, 403, 430, 405, 370, 0, 0, 45,
- /* 1720 */ 444, 385, 0, 447, 385, 37, 450, 451, 452, 453,
- /* 1730 */ 454, 455, 224, 457, 350, 348, 37, 37, 462, 37,
- /* 1740 */ 464, 224, 0, 37, 468, 469, 37, 363, 224, 37,
- /* 1750 */ 0, 0, 224, 37, 444, 0, 37, 447, 0, 22,
- /* 1760 */ 450, 451, 452, 453, 454, 455, 0, 457, 350, 37,
- /* 1770 */ 219, 0, 207, 0, 464, 391, 207, 201, 468, 469,
- /* 1780 */ 208, 363, 199, 0, 0, 0, 194, 403, 195, 405,
- /* 1790 */ 0, 0, 147, 49, 49, 0, 37, 0, 0, 37,
- /* 1800 */ 51, 350, 0, 49, 0, 45, 0, 0, 0, 391,
- /* 1810 */ 49, 0, 0, 0, 363, 0, 0, 0, 161, 37,
- /* 1820 */ 0, 403, 161, 405, 0, 0, 0, 0, 444, 49,
- /* 1830 */ 0, 447, 0, 0, 450, 451, 452, 453, 454, 455,
- /* 1840 */ 0, 457, 391, 0, 0, 0, 0, 0, 464, 146,
- /* 1850 */ 45, 0, 468, 469, 403, 0, 405, 0, 0, 0,
- /* 1860 */ 0, 0, 444, 0, 0, 447, 0, 0, 450, 451,
- /* 1870 */ 452, 453, 454, 455, 0, 457, 22, 350, 0, 0,
- /* 1880 */ 147, 0, 464, 145, 0, 0, 468, 469, 50, 50,
- /* 1890 */ 363, 22, 22, 0, 0, 444, 0, 0, 447, 64,
- /* 1900 */ 64, 450, 451, 452, 453, 454, 455, 350, 457, 0,
- /* 1910 */ 37, 0, 64, 37, 37, 0, 51, 42, 391, 51,
- /* 1920 */ 363, 0, 42, 37, 0, 42, 37, 14, 33, 0,
- /* 1930 */ 403, 0, 405, 51, 42, 45, 0, 49, 0, 0,
- /* 1940 */ 49, 0, 43, 42, 42, 0, 190, 49, 391, 49,
- /* 1950 */ 0, 0, 0, 37, 51, 504, 505, 0, 51, 42,
- /* 1960 */ 403, 42, 405, 37, 0, 37, 0, 42, 0, 51,
- /* 1970 */ 37, 444, 42, 51, 447, 71, 0, 450, 451, 452,
- /* 1980 */ 453, 454, 455, 0, 457, 350, 0, 0, 0, 22,
- /* 1990 */ 37, 464, 0, 37, 33, 37, 469, 37, 363, 37,
- /* 2000 */ 37, 444, 350, 33, 447, 0, 37, 450, 451, 452,
- /* 2010 */ 453, 454, 455, 22, 457, 363, 37, 112, 37, 350,
- /* 2020 */ 22, 37, 114, 0, 22, 53, 391, 37, 0, 22,
- /* 2030 */ 37, 396, 363, 37, 0, 0, 0, 37, 403, 0,
- /* 2040 */ 405, 37, 0, 391, 22, 20, 37, 37, 396, 37,
- /* 2050 */ 493, 107, 106, 0, 106, 403, 206, 405, 0, 22,
- /* 2060 */ 391, 37, 49, 0, 202, 22, 0, 0, 3, 50,
- /* 2070 */ 274, 33, 403, 33, 405, 274, 50, 106, 104, 444,
- /* 2080 */ 107, 106, 447, 33, 350, 450, 451, 452, 453, 454,
- /* 2090 */ 455, 179, 457, 179, 33, 106, 444, 363, 49, 447,
- /* 2100 */ 49, 107, 450, 451, 452, 453, 454, 455, 102, 457,
- /* 2110 */ 107, 179, 33, 444, 350, 107, 447, 182, 107, 450,
- /* 2120 */ 451, 452, 453, 454, 455, 391, 457, 363, 179, 186,
- /* 2130 */ 3, 33, 37, 179, 107, 106, 106, 403, 106, 405,
- /* 2140 */ 37, 186, 37, 37, 37, 274, 37, 33, 107, 49,
- /* 2150 */ 49, 107, 0, 0, 106, 391, 0, 42, 106, 42,
- /* 2160 */ 396, 107, 107, 106, 33, 496, 106, 403, 183, 405,
- /* 2170 */ 106, 115, 49, 104, 106, 104, 181, 267, 444, 350,
- /* 2180 */ 2, 447, 22, 106, 450, 451, 452, 453, 454, 455,
- /* 2190 */ 231, 457, 363, 107, 254, 106, 49, 107, 106, 350,
- /* 2200 */ 107, 107, 106, 49, 22, 106, 37, 116, 444, 107,
- /* 2210 */ 106, 447, 363, 37, 450, 451, 452, 453, 454, 455,
- /* 2220 */ 391, 457, 350, 107, 106, 37, 106, 37, 107, 107,
- /* 2230 */ 106, 234, 403, 37, 405, 363, 106, 350, 37, 505,
- /* 2240 */ 391, 107, 106, 37, 107, 396, 127, 106, 106, 33,
- /* 2250 */ 363, 106, 403, 127, 405, 127, 350, 37, 22, 127,
- /* 2260 */ 71, 106, 70, 391, 37, 37, 37, 37, 396, 363,
- /* 2270 */ 77, 37, 37, 444, 37, 403, 447, 405, 391, 450,
- /* 2280 */ 451, 452, 453, 454, 455, 37, 457, 37, 459, 77,
- /* 2290 */ 403, 100, 405, 444, 100, 33, 447, 391, 37, 450,
- /* 2300 */ 451, 452, 453, 454, 455, 37, 457, 37, 22, 403,
- /* 2310 */ 37, 405, 37, 0, 37, 77, 444, 37, 37, 447,
- /* 2320 */ 37, 37, 450, 451, 452, 453, 454, 455, 22, 457,
- /* 2330 */ 350, 444, 37, 37, 447, 37, 51, 450, 451, 452,
- /* 2340 */ 453, 454, 455, 363, 457, 42, 0, 37, 51, 350,
- /* 2350 */ 444, 42, 0, 447, 37, 51, 450, 451, 452, 453,
- /* 2360 */ 454, 455, 363, 457, 42, 350, 0, 37, 42, 51,
- /* 2370 */ 0, 391, 37, 37, 0, 22, 33, 22, 363, 21,
- /* 2380 */ 508, 22, 22, 403, 21, 405, 508, 20, 508, 508,
- /* 2390 */ 391, 508, 508, 508, 508, 508, 508, 508, 508, 508,
- /* 2400 */ 508, 508, 403, 508, 405, 508, 391, 508, 508, 508,
- /* 2410 */ 508, 508, 508, 508, 508, 508, 508, 508, 403, 508,
- /* 2420 */ 405, 508, 508, 350, 444, 508, 508, 447, 508, 508,
- /* 2430 */ 450, 451, 452, 453, 454, 455, 363, 457, 508, 508,
- /* 2440 */ 508, 508, 508, 444, 508, 508, 447, 350, 508, 450,
- /* 2450 */ 451, 452, 453, 454, 455, 508, 457, 508, 508, 444,
- /* 2460 */ 363, 508, 447, 508, 391, 450, 451, 452, 453, 454,
- /* 2470 */ 455, 508, 457, 508, 508, 508, 403, 508, 405, 508,
- /* 2480 */ 508, 508, 508, 508, 508, 508, 508, 508, 391, 508,
- /* 2490 */ 350, 508, 508, 508, 508, 508, 508, 508, 508, 508,
- /* 2500 */ 403, 508, 405, 363, 508, 508, 508, 508, 508, 508,
- /* 2510 */ 508, 508, 508, 508, 508, 508, 350, 444, 508, 508,
- /* 2520 */ 447, 508, 508, 450, 451, 452, 453, 454, 455, 363,
- /* 2530 */ 457, 391, 508, 508, 508, 508, 508, 508, 508, 508,
- /* 2540 */ 508, 444, 508, 403, 447, 405, 508, 450, 451, 452,
- /* 2550 */ 453, 454, 455, 508, 457, 508, 508, 391, 508, 350,
- /* 2560 */ 508, 508, 508, 508, 508, 508, 508, 508, 508, 403,
- /* 2570 */ 508, 405, 363, 508, 508, 508, 508, 508, 508, 508,
- /* 2580 */ 508, 508, 508, 350, 444, 508, 508, 447, 508, 508,
- /* 2590 */ 450, 451, 452, 453, 454, 455, 363, 457, 508, 508,
- /* 2600 */ 391, 508, 508, 508, 508, 508, 508, 508, 508, 508,
- /* 2610 */ 444, 508, 403, 447, 405, 508, 450, 451, 452, 453,
- /* 2620 */ 454, 455, 508, 457, 391, 508, 350, 508, 508, 508,
- /* 2630 */ 508, 508, 508, 508, 508, 508, 403, 508, 405, 363,
- /* 2640 */ 508, 350, 508, 508, 508, 508, 508, 508, 508, 508,
- /* 2650 */ 508, 508, 508, 444, 363, 508, 447, 350, 508, 450,
- /* 2660 */ 451, 452, 453, 454, 455, 508, 457, 391, 508, 508,
- /* 2670 */ 363, 508, 508, 508, 508, 508, 508, 444, 508, 403,
- /* 2680 */ 447, 405, 391, 450, 451, 452, 453, 454, 455, 508,
- /* 2690 */ 457, 508, 508, 508, 403, 508, 405, 508, 391, 508,
- /* 2700 */ 508, 508, 508, 508, 508, 508, 508, 508, 508, 508,
- /* 2710 */ 403, 508, 405, 508, 508, 508, 508, 508, 508, 508,
- /* 2720 */ 444, 508, 508, 447, 508, 508, 450, 451, 452, 453,
- /* 2730 */ 454, 455, 508, 457, 350, 444, 508, 508, 447, 508,
- /* 2740 */ 508, 450, 451, 452, 453, 454, 455, 363, 457, 508,
- /* 2750 */ 508, 444, 508, 350, 447, 508, 508, 450, 451, 452,
- /* 2760 */ 453, 454, 455, 508, 457, 508, 363, 508, 508, 350,
- /* 2770 */ 508, 508, 508, 508, 508, 391, 508, 508, 508, 508,
- /* 2780 */ 508, 508, 363, 508, 508, 508, 508, 403, 508, 405,
- /* 2790 */ 508, 508, 508, 508, 391, 508, 508, 508, 508, 508,
- /* 2800 */ 508, 508, 508, 508, 508, 508, 403, 508, 405, 508,
- /* 2810 */ 391, 508, 508, 508, 508, 508, 508, 508, 508, 508,
- /* 2820 */ 508, 508, 403, 508, 405, 508, 508, 350, 444, 508,
- /* 2830 */ 508, 447, 508, 508, 450, 451, 452, 453, 454, 455,
- /* 2840 */ 363, 457, 508, 508, 508, 508, 508, 444, 508, 508,
- /* 2850 */ 447, 350, 508, 450, 451, 452, 453, 454, 455, 508,
- /* 2860 */ 457, 508, 508, 444, 363, 508, 447, 508, 391, 450,
- /* 2870 */ 451, 452, 453, 454, 455, 508, 457, 508, 508, 508,
- /* 2880 */ 403, 508, 405, 508, 508, 508, 508, 508, 508, 508,
- /* 2890 */ 508, 508, 391, 508, 350, 508, 508, 508, 508, 508,
- /* 2900 */ 508, 508, 508, 508, 403, 508, 405, 363, 508, 508,
- /* 2910 */ 508, 508, 508, 508, 508, 508, 508, 508, 508, 508,
- /* 2920 */ 350, 444, 508, 508, 447, 508, 508, 450, 451, 452,
- /* 2930 */ 453, 454, 455, 363, 457, 391, 508, 508, 508, 508,
- /* 2940 */ 508, 508, 508, 508, 508, 444, 508, 403, 447, 405,
- /* 2950 */ 508, 450, 451, 452, 453, 454, 455, 508, 457, 508,
- /* 2960 */ 508, 391, 508, 350, 508, 508, 508, 508, 508, 508,
- /* 2970 */ 508, 508, 508, 403, 508, 405, 363, 508, 508, 508,
- /* 2980 */ 508, 508, 508, 508, 508, 508, 508, 508, 444, 508,
- /* 2990 */ 508, 447, 508, 508, 450, 451, 452, 453, 454, 455,
- /* 3000 */ 508, 457, 508, 508, 391, 508, 508, 508, 508, 508,
- /* 3010 */ 508, 508, 508, 508, 444, 508, 403, 447, 405, 508,
- /* 3020 */ 450, 451, 452, 453, 454, 455, 508, 457, 508, 508,
- /* 3030 */ 508, 508, 508, 508, 508, 508, 508, 508, 508, 508,
- /* 3040 */ 508, 508, 508, 508, 508, 508, 508, 508, 508, 508,
- /* 3050 */ 508, 508, 508, 508, 508, 508, 508, 444, 508, 508,
- /* 3060 */ 447, 508, 508, 450, 451, 452, 453, 454, 455, 508,
- /* 3070 */ 457, 347, 347, 347, 347, 347, 347, 347, 347, 347,
- /* 3080 */ 347, 347, 347, 347, 347, 347, 347, 347, 347, 347,
- /* 3090 */ 347, 347, 347, 347, 347, 347, 347, 347, 347, 347,
- /* 3100 */ 347, 347, 347, 347, 347, 347, 347, 347, 347, 347,
- /* 3110 */ 347, 347, 347, 347, 347, 347, 347, 347, 347, 347,
- /* 3120 */ 347, 347, 347, 347, 347, 347, 347, 347, 347, 347,
- /* 3130 */ 347, 347, 347, 347, 347, 347, 347, 347, 347, 347,
- /* 3140 */ 347, 347, 347, 347, 347, 347, 347, 347, 347, 347,
- /* 3150 */ 347, 347, 347, 347, 347, 347, 347, 347, 347, 347,
- /* 3160 */ 347, 347, 347, 347, 347, 347, 347, 347, 347, 347,
- /* 3170 */ 347, 347, 347, 347, 347, 347, 347, 347, 347, 347,
- /* 3180 */ 347, 347, 347, 347, 347, 347, 347, 347, 347, 347,
- /* 3190 */ 347, 347, 347, 347, 347, 347, 347, 347, 347, 347,
- /* 3200 */ 347, 347, 347, 347, 347, 347, 347, 347, 347, 347,
- /* 3210 */ 347, 347, 347, 347, 347, 347, 347, 347, 347, 347,
- /* 3220 */ 347, 347, 347, 347, 347, 347, 347, 347, 347, 347,
- /* 3230 */ 347, 347, 347, 347, 347, 347, 347, 347, 347, 347,
- /* 3240 */ 347, 347, 347, 347, 347, 347, 347, 347, 347, 347,
- /* 3250 */ 347, 347, 347, 347, 347, 347, 347, 347, 347, 347,
- /* 3260 */ 347, 347, 347, 347, 347, 347, 347, 347, 347, 347,
- /* 3270 */ 347, 347, 347, 347, 347, 347, 347, 347, 347, 347,
- /* 3280 */ 347, 347, 347, 347, 347, 347, 347, 347, 347, 347,
- /* 3290 */ 347, 347, 347, 347, 347, 347, 347, 347, 347, 347,
- /* 3300 */ 347, 347, 347, 347, 347, 347, 347, 347, 347, 347,
- /* 3310 */ 347, 347, 347, 347, 347, 347, 347, 347, 347, 347,
- /* 3320 */ 347, 347, 347, 347, 347, 347, 347, 347, 347, 347,
- /* 3330 */ 347, 347, 347, 347, 347, 347, 347, 347, 347, 347,
- /* 3340 */ 347, 347, 347, 347, 347, 347, 347, 347, 347, 347,
- /* 3350 */ 347, 347, 347, 347, 347, 347, 347, 347, 347, 347,
- /* 3360 */ 347, 347, 347, 347, 347, 347, 347, 347, 347, 347,
- /* 3370 */ 347, 347, 347, 347, 347, 347, 347, 347, 347, 347,
- /* 3380 */ 347, 347, 347, 347, 347, 347, 347, 347, 347, 347,
- /* 3390 */ 347, 347, 347, 347, 347, 347, 347, 347, 347, 347,
- /* 3400 */ 347, 347, 347, 347, 347, 347, 347, 347, 347, 347,
- /* 3410 */ 347, 347, 347, 347, 347, 347, 347, 347,
+ /* 250 */ 250, 251, 252, 253, 254, 255, 12, 13, 20, 3,
+ /* 260 */ 20, 18, 479, 20, 20, 482, 22, 365, 366, 175,
+ /* 270 */ 27, 361, 353, 30, 71, 365, 20, 367, 35, 35,
+ /* 280 */ 414, 37, 366, 500, 501, 366, 138, 385, 505, 506,
+ /* 290 */ 142, 278, 279, 280, 51, 69, 53, 201, 20, 203,
+ /* 300 */ 206, 58, 59, 475, 476, 477, 272, 479, 480, 65,
+ /* 310 */ 394, 365, 69, 394, 20, 71, 104, 107, 115, 475,
+ /* 320 */ 476, 477, 78, 479, 480, 406, 4, 408, 33, 233,
+ /* 330 */ 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
+ /* 340 */ 45, 129, 130, 131, 132, 133, 134, 135, 104, 106,
+ /* 350 */ 20, 107, 136, 137, 138, 139, 140, 141, 142, 211,
+ /* 360 */ 117, 0, 214, 452, 108, 217, 447, 219, 272, 450,
+ /* 370 */ 0, 455, 453, 454, 455, 456, 457, 458, 459, 460,
+ /* 380 */ 461, 462, 179, 143, 144, 439, 440, 143, 144, 478,
+ /* 390 */ 147, 148, 353, 150, 151, 152, 153, 154, 155, 156,
+ /* 400 */ 157, 158, 272, 365, 366, 162, 163, 164, 165, 166,
+ /* 410 */ 167, 168, 42, 170, 171, 172, 13, 365, 366, 176,
+ /* 420 */ 177, 178, 375, 197, 180, 181, 183, 187, 188, 107,
+ /* 430 */ 383, 187, 188, 14, 73, 74, 75, 385, 182, 20,
+ /* 440 */ 20, 80, 81, 82, 392, 406, 202, 86, 204, 394,
+ /* 450 */ 224, 225, 91, 92, 93, 94, 365, 366, 97, 20,
+ /* 460 */ 182, 100, 259, 260, 261, 262, 263, 264, 265, 266,
+ /* 470 */ 267, 268, 269, 418, 180, 181, 39, 40, 234, 235,
+ /* 480 */ 236, 78, 238, 239, 240, 241, 242, 243, 244, 245,
+ /* 490 */ 246, 247, 248, 249, 250, 251, 252, 253, 254, 255,
+ /* 500 */ 256, 12, 13, 353, 71, 414, 407, 408, 382, 20,
+ /* 510 */ 180, 22, 474, 475, 476, 477, 366, 479, 480, 361,
+ /* 520 */ 33, 20, 396, 365, 35, 367, 37, 107, 256, 2,
+ /* 530 */ 258, 382, 406, 374, 353, 8, 9, 365, 366, 12,
+ /* 540 */ 13, 14, 15, 16, 394, 396, 107, 366, 111, 112,
+ /* 550 */ 391, 114, 365, 366, 65, 406, 406, 385, 408, 400,
+ /* 560 */ 71, 73, 74, 75, 365, 366, 236, 78, 80, 81,
+ /* 570 */ 82, 20, 385, 136, 86, 394, 450, 140, 3, 91,
+ /* 580 */ 92, 93, 94, 394, 385, 97, 460, 406, 100, 408,
+ /* 590 */ 401, 370, 371, 104, 272, 108, 107, 447, 409, 450,
+ /* 600 */ 450, 353, 70, 453, 454, 455, 456, 457, 458, 460,
+ /* 610 */ 460, 56, 57, 463, 366, 465, 466, 467, 42, 8,
+ /* 620 */ 9, 471, 472, 12, 13, 14, 15, 16, 447, 117,
+ /* 630 */ 350, 450, 143, 144, 453, 454, 455, 456, 457, 458,
+ /* 640 */ 390, 460, 394, 14, 143, 144, 465, 365, 467, 20,
+ /* 650 */ 365, 366, 471, 472, 406, 21, 408, 0, 24, 25,
+ /* 660 */ 26, 27, 28, 29, 30, 31, 32, 234, 404, 180,
+ /* 670 */ 181, 407, 408, 14, 452, 494, 187, 188, 21, 20,
+ /* 680 */ 256, 24, 25, 26, 27, 28, 29, 30, 31, 32,
+ /* 690 */ 50, 202, 272, 204, 444, 447, 365, 366, 450, 414,
+ /* 700 */ 478, 453, 454, 455, 456, 457, 458, 353, 460, 429,
+ /* 710 */ 386, 272, 117, 465, 434, 467, 385, 33, 394, 471,
+ /* 720 */ 472, 439, 440, 234, 235, 236, 402, 238, 239, 240,
+ /* 730 */ 241, 242, 243, 244, 245, 246, 247, 248, 249, 250,
+ /* 740 */ 251, 252, 253, 254, 255, 12, 13, 14, 353, 386,
+ /* 750 */ 12, 13, 4, 20, 22, 22, 22, 394, 386, 479,
+ /* 760 */ 406, 366, 482, 368, 401, 402, 394, 19, 35, 37,
+ /* 770 */ 37, 37, 409, 0, 402, 37, 365, 366, 353, 372,
+ /* 780 */ 500, 501, 374, 35, 179, 505, 506, 236, 20, 394,
+ /* 790 */ 22, 366, 108, 368, 65, 394, 385, 20, 65, 51,
+ /* 800 */ 37, 406, 401, 408, 397, 194, 58, 59, 400, 180,
+ /* 810 */ 409, 78, 78, 65, 12, 13, 14, 15, 16, 394,
+ /* 820 */ 8, 9, 182, 55, 12, 13, 14, 15, 16, 87,
+ /* 830 */ 190, 406, 20, 408, 20, 106, 104, 104, 109, 180,
+ /* 840 */ 107, 78, 447, 365, 366, 450, 353, 271, 453, 454,
+ /* 850 */ 455, 456, 457, 458, 106, 460, 22, 109, 78, 366,
+ /* 860 */ 465, 368, 467, 385, 259, 236, 471, 472, 293, 365,
+ /* 870 */ 366, 37, 447, 234, 269, 450, 143, 144, 453, 454,
+ /* 880 */ 455, 456, 457, 458, 137, 460, 353, 394, 0, 385,
+ /* 890 */ 465, 149, 467, 394, 51, 236, 471, 472, 4, 406,
+ /* 900 */ 401, 408, 387, 60, 175, 390, 63, 64, 409, 298,
+ /* 910 */ 365, 366, 78, 180, 181, 173, 174, 353, 34, 22,
+ /* 920 */ 187, 188, 283, 284, 285, 286, 287, 288, 289, 394,
+ /* 930 */ 385, 23, 159, 160, 37, 202, 401, 204, 104, 406,
+ /* 940 */ 447, 136, 204, 450, 409, 140, 453, 454, 455, 456,
+ /* 950 */ 457, 458, 353, 460, 353, 47, 48, 353, 465, 182,
+ /* 960 */ 467, 395, 215, 216, 471, 472, 395, 234, 235, 236,
+ /* 970 */ 406, 238, 239, 240, 241, 242, 243, 244, 245, 246,
+ /* 980 */ 247, 248, 249, 250, 251, 252, 253, 254, 255, 12,
+ /* 990 */ 13, 353, 370, 371, 182, 0, 182, 20, 464, 22,
+ /* 1000 */ 466, 104, 379, 380, 366, 406, 368, 406, 381, 395,
+ /* 1010 */ 406, 384, 35, 236, 37, 8, 9, 365, 366, 12,
+ /* 1020 */ 13, 14, 15, 16, 136, 137, 138, 139, 140, 141,
+ /* 1030 */ 142, 394, 394, 14, 15, 16, 202, 385, 204, 402,
+ /* 1040 */ 33, 452, 65, 395, 406, 20, 408, 353, 236, 20,
+ /* 1050 */ 236, 137, 138, 8, 9, 78, 142, 12, 13, 14,
+ /* 1060 */ 15, 16, 365, 366, 4, 353, 0, 478, 234, 235,
+ /* 1070 */ 8, 9, 353, 353, 12, 13, 14, 15, 16, 365,
+ /* 1080 */ 366, 104, 385, 23, 107, 447, 366, 463, 450, 353,
+ /* 1090 */ 466, 453, 454, 455, 456, 457, 458, 394, 460, 385,
+ /* 1100 */ 406, 33, 366, 465, 368, 467, 46, 47, 48, 471,
+ /* 1110 */ 472, 464, 409, 466, 394, 108, 379, 380, 406, 399,
+ /* 1120 */ 143, 144, 0, 365, 366, 406, 406, 435, 408, 353,
+ /* 1130 */ 394, 136, 137, 138, 139, 140, 141, 142, 395, 394,
+ /* 1140 */ 365, 366, 406, 385, 408, 117, 365, 366, 394, 365,
+ /* 1150 */ 366, 365, 366, 108, 409, 33, 353, 180, 181, 403,
+ /* 1160 */ 385, 353, 406, 409, 187, 188, 385, 447, 274, 385,
+ /* 1170 */ 450, 385, 383, 453, 454, 455, 456, 457, 458, 202,
+ /* 1180 */ 460, 204, 406, 447, 353, 353, 450, 270, 271, 453,
+ /* 1190 */ 454, 455, 456, 457, 458, 354, 460, 169, 429, 353,
+ /* 1200 */ 429, 465, 403, 467, 353, 406, 353, 471, 472, 406,
+ /* 1210 */ 65, 234, 235, 236, 406, 238, 239, 240, 241, 242,
+ /* 1220 */ 243, 244, 245, 246, 247, 248, 249, 250, 251, 252,
+ /* 1230 */ 253, 254, 255, 12, 13, 33, 403, 406, 406, 406,
+ /* 1240 */ 0, 20, 13, 22, 182, 356, 357, 45, 479, 0,
+ /* 1250 */ 479, 482, 406, 482, 109, 353, 35, 406, 37, 406,
+ /* 1260 */ 13, 236, 22, 35, 110, 236, 37, 113, 366, 500,
+ /* 1270 */ 501, 500, 501, 0, 505, 506, 505, 506, 110, 51,
+ /* 1280 */ 110, 113, 110, 113, 37, 113, 65, 0, 60, 61,
+ /* 1290 */ 62, 63, 0, 65, 228, 22, 394, 8, 9, 78,
+ /* 1300 */ 51, 12, 13, 14, 15, 16, 419, 33, 406, 22,
+ /* 1310 */ 408, 218, 33, 220, 22, 33, 33, 49, 18, 33,
+ /* 1320 */ 143, 144, 37, 23, 33, 104, 1, 2, 107, 33,
+ /* 1330 */ 33, 33, 353, 509, 106, 498, 37, 109, 37, 429,
+ /* 1340 */ 40, 41, 33, 33, 44, 366, 33, 368, 13, 447,
+ /* 1350 */ 13, 369, 450, 33, 54, 453, 454, 455, 456, 457,
+ /* 1360 */ 458, 107, 460, 295, 143, 144, 66, 67, 68, 69,
+ /* 1370 */ 116, 491, 37, 394, 37, 107, 382, 429, 394, 78,
+ /* 1380 */ 382, 419, 108, 33, 364, 406, 419, 408, 497, 479,
+ /* 1390 */ 108, 108, 482, 497, 108, 497, 428, 495, 496, 108,
+ /* 1400 */ 497, 180, 181, 175, 108, 108, 108, 107, 187, 188,
+ /* 1410 */ 500, 501, 184, 185, 366, 505, 506, 108, 108, 191,
+ /* 1420 */ 192, 108, 369, 202, 419, 204, 447, 479, 108, 450,
+ /* 1430 */ 482, 0, 453, 454, 455, 456, 457, 458, 210, 460,
+ /* 1440 */ 33, 33, 405, 33, 465, 145, 467, 33, 500, 501,
+ /* 1450 */ 471, 472, 33, 505, 506, 234, 235, 236, 108, 238,
+ /* 1460 */ 239, 240, 241, 242, 243, 244, 245, 246, 247, 248,
+ /* 1470 */ 249, 250, 251, 252, 253, 254, 255, 436, 419, 473,
+ /* 1480 */ 419, 12, 13, 52, 353, 481, 484, 502, 384, 204,
+ /* 1490 */ 275, 22, 51, 430, 194, 195, 196, 366, 449, 199,
+ /* 1500 */ 42, 20, 448, 204, 35, 441, 37, 217, 374, 374,
+ /* 1510 */ 441, 353, 212, 213, 200, 108, 108, 446, 108, 432,
+ /* 1520 */ 20, 365, 108, 223, 366, 394, 226, 108, 20, 229,
+ /* 1530 */ 230, 231, 232, 233, 65, 366, 45, 406, 415, 408,
+ /* 1540 */ 366, 415, 179, 365, 412, 366, 365, 78, 415, 412,
+ /* 1550 */ 412, 105, 394, 378, 103, 365, 102, 377, 376, 365,
+ /* 1560 */ 365, 365, 20, 358, 406, 50, 408, 358, 362, 362,
+ /* 1570 */ 441, 374, 272, 104, 374, 20, 297, 374, 447, 408,
+ /* 1580 */ 353, 450, 20, 367, 453, 454, 455, 456, 457, 458,
+ /* 1590 */ 20, 460, 431, 366, 374, 20, 465, 367, 467, 374,
+ /* 1600 */ 374, 365, 471, 472, 358, 447, 422, 374, 450, 374,
+ /* 1610 */ 358, 453, 454, 455, 456, 457, 458, 394, 460, 356,
+ /* 1620 */ 365, 394, 356, 465, 406, 467, 394, 221, 394, 471,
+ /* 1630 */ 472, 394, 394, 406, 445, 408, 394, 394, 394, 394,
+ /* 1640 */ 107, 443, 394, 372, 394, 406, 20, 406, 208, 441,
+ /* 1650 */ 440, 438, 207, 372, 437, 282, 490, 281, 365, 408,
+ /* 1660 */ 290, 430, 406, 490, 193, 276, 299, 292, 291, 493,
+ /* 1670 */ 510, 202, 487, 204, 447, 492, 490, 450, 296, 488,
+ /* 1680 */ 453, 454, 455, 456, 457, 458, 424, 460, 424, 430,
+ /* 1690 */ 489, 504, 294, 271, 467, 353, 1, 366, 471, 472,
+ /* 1700 */ 20, 117, 503, 234, 235, 452, 273, 485, 366, 406,
+ /* 1710 */ 367, 372, 372, 406, 19, 185, 372, 248, 249, 250,
+ /* 1720 */ 251, 252, 253, 254, 406, 406, 424, 353, 424, 406,
+ /* 1730 */ 35, 420, 372, 406, 366, 390, 394, 107, 107, 470,
+ /* 1740 */ 366, 483, 22, 365, 398, 355, 51, 38, 406, 358,
+ /* 1750 */ 408, 372, 359, 425, 433, 60, 61, 62, 63, 442,
+ /* 1760 */ 65, 425, 353, 351, 0, 373, 0, 0, 394, 388,
+ /* 1770 */ 45, 388, 388, 0, 37, 366, 227, 37, 37, 37,
+ /* 1780 */ 406, 227, 408, 0, 37, 37, 227, 37, 0, 447,
+ /* 1790 */ 227, 0, 450, 37, 0, 453, 454, 455, 456, 457,
+ /* 1800 */ 458, 106, 460, 394, 109, 37, 0, 22, 0, 467,
+ /* 1810 */ 222, 37, 0, 471, 472, 406, 210, 408, 0, 210,
+ /* 1820 */ 204, 447, 211, 202, 450, 0, 0, 453, 454, 455,
+ /* 1830 */ 456, 457, 458, 0, 460, 353, 141, 198, 197, 0,
+ /* 1840 */ 0, 467, 148, 0, 49, 471, 472, 49, 366, 0,
+ /* 1850 */ 37, 0, 51, 37, 0, 0, 447, 0, 353, 450,
+ /* 1860 */ 49, 0, 453, 454, 455, 456, 457, 458, 45, 460,
+ /* 1870 */ 0, 366, 0, 49, 0, 0, 394, 0, 353, 184,
+ /* 1880 */ 165, 37, 0, 165, 0, 0, 191, 0, 406, 0,
+ /* 1890 */ 408, 366, 0, 353, 0, 0, 0, 0, 0, 394,
+ /* 1900 */ 0, 0, 0, 0, 0, 210, 366, 0, 0, 0,
+ /* 1910 */ 0, 406, 0, 408, 49, 0, 507, 508, 0, 394,
+ /* 1920 */ 0, 45, 0, 0, 399, 0, 0, 0, 0, 447,
+ /* 1930 */ 0, 406, 450, 408, 394, 453, 454, 455, 456, 457,
+ /* 1940 */ 458, 22, 460, 0, 148, 0, 406, 147, 408, 467,
+ /* 1950 */ 146, 0, 447, 0, 472, 450, 22, 22, 453, 454,
+ /* 1960 */ 455, 456, 457, 458, 0, 460, 50, 50, 37, 0,
+ /* 1970 */ 65, 65, 447, 0, 0, 450, 65, 0, 453, 454,
+ /* 1980 */ 455, 456, 457, 458, 37, 460, 42, 447, 0, 353,
+ /* 1990 */ 450, 51, 37, 453, 454, 455, 456, 457, 458, 51,
+ /* 2000 */ 460, 496, 366, 42, 0, 37, 0, 51, 42, 37,
+ /* 2010 */ 0, 33, 45, 42, 49, 14, 0, 0, 42, 49,
+ /* 2020 */ 0, 0, 43, 0, 49, 353, 42, 193, 0, 49,
+ /* 2030 */ 394, 0, 0, 0, 72, 0, 37, 51, 366, 499,
+ /* 2040 */ 42, 0, 406, 51, 408, 37, 0, 42, 37, 42,
+ /* 2050 */ 0, 51, 37, 51, 42, 0, 0, 353, 0, 0,
+ /* 2060 */ 0, 0, 37, 113, 115, 22, 394, 37, 0, 22,
+ /* 2070 */ 366, 399, 0, 37, 37, 37, 37, 37, 406, 37,
+ /* 2080 */ 408, 37, 33, 447, 33, 37, 450, 22, 0, 453,
+ /* 2090 */ 454, 455, 456, 457, 458, 22, 460, 0, 394, 37,
+ /* 2100 */ 37, 22, 0, 22, 0, 53, 37, 0, 0, 0,
+ /* 2110 */ 406, 37, 408, 37, 0, 22, 20, 37, 0, 447,
+ /* 2120 */ 37, 37, 450, 182, 49, 453, 454, 455, 456, 457,
+ /* 2130 */ 458, 107, 460, 107, 353, 108, 0, 37, 209, 182,
+ /* 2140 */ 0, 22, 22, 205, 508, 182, 0, 366, 0, 189,
+ /* 2150 */ 353, 447, 3, 108, 450, 33, 277, 453, 454, 455,
+ /* 2160 */ 456, 457, 458, 366, 460, 182, 462, 185, 353, 182,
+ /* 2170 */ 189, 107, 33, 107, 50, 394, 105, 50, 108, 49,
+ /* 2180 */ 399, 366, 49, 33, 107, 103, 108, 406, 33, 408,
+ /* 2190 */ 33, 394, 107, 107, 3, 33, 399, 108, 107, 0,
+ /* 2200 */ 108, 277, 108, 406, 37, 408, 37, 37, 37, 394,
+ /* 2210 */ 277, 37, 37, 108, 108, 49, 270, 33, 0, 107,
+ /* 2220 */ 42, 406, 49, 408, 107, 0, 116, 42, 447, 108,
+ /* 2230 */ 107, 450, 107, 353, 453, 454, 455, 456, 457, 458,
+ /* 2240 */ 108, 460, 107, 186, 447, 107, 366, 450, 33, 49,
+ /* 2250 */ 453, 454, 455, 456, 457, 458, 105, 460, 105, 2,
+ /* 2260 */ 257, 22, 447, 234, 108, 450, 107, 353, 453, 454,
+ /* 2270 */ 455, 456, 457, 458, 394, 460, 108, 49, 49, 184,
+ /* 2280 */ 366, 22, 117, 107, 107, 37, 406, 108, 408, 108,
+ /* 2290 */ 353, 237, 128, 107, 107, 107, 72, 108, 37, 107,
+ /* 2300 */ 37, 108, 107, 366, 108, 37, 108, 37, 394, 107,
+ /* 2310 */ 107, 37, 108, 107, 37, 108, 107, 107, 128, 33,
+ /* 2320 */ 406, 107, 408, 107, 37, 128, 22, 447, 37, 128,
+ /* 2330 */ 450, 394, 37, 453, 454, 455, 456, 457, 458, 37,
+ /* 2340 */ 460, 33, 71, 406, 37, 408, 37, 353, 37, 37,
+ /* 2350 */ 37, 37, 101, 101, 78, 37, 78, 37, 37, 22,
+ /* 2360 */ 366, 447, 37, 37, 450, 37, 78, 453, 454, 455,
+ /* 2370 */ 456, 457, 458, 37, 460, 37, 37, 37, 37, 22,
+ /* 2380 */ 37, 0, 37, 51, 447, 51, 42, 450, 394, 0,
+ /* 2390 */ 453, 454, 455, 456, 457, 458, 37, 460, 42, 0,
+ /* 2400 */ 406, 37, 408, 51, 42, 0, 37, 42, 0, 51,
+ /* 2410 */ 37, 37, 0, 22, 22, 33, 21, 511, 22, 22,
+ /* 2420 */ 353, 21, 20, 511, 511, 511, 511, 511, 511, 511,
+ /* 2430 */ 511, 511, 511, 366, 511, 511, 511, 511, 511, 511,
+ /* 2440 */ 353, 447, 511, 511, 450, 511, 511, 453, 454, 455,
+ /* 2450 */ 456, 457, 458, 366, 460, 511, 511, 511, 511, 511,
+ /* 2460 */ 511, 394, 511, 511, 511, 511, 511, 511, 511, 511,
+ /* 2470 */ 511, 511, 511, 406, 511, 408, 511, 511, 511, 511,
+ /* 2480 */ 511, 394, 511, 511, 511, 511, 511, 511, 511, 511,
+ /* 2490 */ 511, 511, 511, 406, 511, 408, 511, 511, 353, 511,
+ /* 2500 */ 511, 511, 511, 511, 511, 511, 511, 511, 511, 511,
+ /* 2510 */ 511, 366, 511, 353, 447, 511, 511, 450, 511, 511,
+ /* 2520 */ 453, 454, 455, 456, 457, 458, 366, 460, 511, 511,
+ /* 2530 */ 511, 511, 511, 511, 447, 353, 511, 450, 511, 394,
+ /* 2540 */ 453, 454, 455, 456, 457, 458, 511, 460, 366, 511,
+ /* 2550 */ 511, 406, 511, 408, 394, 511, 511, 511, 511, 511,
+ /* 2560 */ 511, 511, 511, 511, 511, 511, 406, 511, 408, 511,
+ /* 2570 */ 511, 511, 511, 511, 511, 511, 394, 511, 511, 511,
+ /* 2580 */ 511, 511, 511, 511, 511, 511, 511, 511, 406, 511,
+ /* 2590 */ 408, 511, 447, 353, 511, 450, 511, 511, 453, 454,
+ /* 2600 */ 455, 456, 457, 458, 511, 460, 366, 447, 353, 511,
+ /* 2610 */ 450, 511, 511, 453, 454, 455, 456, 457, 458, 511,
+ /* 2620 */ 460, 366, 511, 511, 511, 511, 511, 511, 353, 447,
+ /* 2630 */ 511, 511, 450, 511, 394, 453, 454, 455, 456, 457,
+ /* 2640 */ 458, 366, 460, 511, 511, 511, 406, 511, 408, 394,
+ /* 2650 */ 511, 511, 511, 511, 511, 511, 511, 511, 511, 511,
+ /* 2660 */ 511, 406, 511, 408, 511, 511, 511, 511, 511, 394,
+ /* 2670 */ 511, 511, 511, 511, 511, 511, 511, 511, 511, 511,
+ /* 2680 */ 511, 406, 511, 408, 511, 511, 511, 447, 511, 511,
+ /* 2690 */ 450, 511, 511, 453, 454, 455, 456, 457, 458, 511,
+ /* 2700 */ 460, 353, 447, 511, 511, 450, 511, 511, 453, 454,
+ /* 2710 */ 455, 456, 457, 458, 366, 460, 511, 511, 511, 511,
+ /* 2720 */ 511, 353, 447, 511, 511, 450, 511, 511, 453, 454,
+ /* 2730 */ 455, 456, 457, 458, 366, 460, 511, 511, 353, 511,
+ /* 2740 */ 511, 511, 394, 511, 511, 511, 511, 511, 511, 511,
+ /* 2750 */ 511, 366, 511, 511, 406, 511, 408, 511, 511, 511,
+ /* 2760 */ 511, 511, 394, 511, 511, 511, 511, 511, 511, 511,
+ /* 2770 */ 511, 511, 511, 511, 406, 511, 408, 511, 511, 394,
+ /* 2780 */ 511, 511, 511, 511, 511, 511, 511, 511, 511, 511,
+ /* 2790 */ 511, 406, 511, 408, 511, 447, 511, 511, 450, 511,
+ /* 2800 */ 511, 453, 454, 455, 456, 457, 458, 353, 460, 511,
+ /* 2810 */ 511, 511, 511, 511, 511, 447, 511, 511, 450, 511,
+ /* 2820 */ 366, 453, 454, 455, 456, 457, 458, 511, 460, 511,
+ /* 2830 */ 511, 511, 447, 511, 511, 450, 511, 511, 453, 454,
+ /* 2840 */ 455, 456, 457, 458, 511, 460, 511, 511, 394, 511,
+ /* 2850 */ 511, 511, 511, 511, 511, 511, 511, 511, 511, 511,
+ /* 2860 */ 406, 511, 408, 511, 511, 353, 511, 511, 511, 511,
+ /* 2870 */ 511, 511, 511, 511, 511, 511, 511, 511, 366, 511,
+ /* 2880 */ 353, 511, 511, 511, 511, 511, 511, 511, 511, 511,
+ /* 2890 */ 511, 511, 511, 366, 511, 511, 511, 511, 511, 511,
+ /* 2900 */ 511, 447, 353, 511, 450, 511, 394, 453, 454, 455,
+ /* 2910 */ 456, 457, 458, 511, 460, 366, 511, 511, 406, 511,
+ /* 2920 */ 408, 394, 511, 511, 511, 511, 511, 511, 511, 511,
+ /* 2930 */ 511, 511, 511, 406, 511, 408, 511, 511, 511, 511,
+ /* 2940 */ 511, 511, 511, 394, 511, 511, 511, 511, 511, 511,
+ /* 2950 */ 511, 511, 511, 511, 511, 406, 511, 408, 511, 447,
+ /* 2960 */ 353, 511, 450, 511, 511, 453, 454, 455, 456, 457,
+ /* 2970 */ 458, 511, 460, 366, 447, 353, 511, 450, 511, 511,
+ /* 2980 */ 453, 454, 455, 456, 457, 458, 511, 460, 366, 511,
+ /* 2990 */ 511, 511, 511, 511, 511, 511, 447, 511, 511, 450,
+ /* 3000 */ 511, 394, 453, 454, 455, 456, 457, 458, 511, 460,
+ /* 3010 */ 511, 511, 511, 406, 511, 408, 394, 511, 511, 511,
+ /* 3020 */ 511, 511, 511, 511, 511, 511, 511, 511, 406, 511,
+ /* 3030 */ 408, 511, 511, 511, 511, 511, 511, 511, 511, 511,
+ /* 3040 */ 511, 511, 511, 511, 511, 511, 511, 511, 511, 511,
+ /* 3050 */ 511, 511, 511, 511, 447, 511, 511, 450, 511, 511,
+ /* 3060 */ 453, 454, 455, 456, 457, 458, 511, 460, 511, 447,
+ /* 3070 */ 511, 511, 450, 511, 511, 453, 454, 455, 456, 457,
+ /* 3080 */ 458, 511, 460, 350, 350, 350, 350, 350, 350, 350,
+ /* 3090 */ 350, 350, 350, 350, 350, 350, 350, 350, 350, 350,
+ /* 3100 */ 350, 350, 350, 350, 350, 350, 350, 350, 350, 350,
+ /* 3110 */ 350, 350, 350, 350, 350, 350, 350, 350, 350, 350,
+ /* 3120 */ 350, 350, 350, 350, 350, 350, 350, 350, 350, 350,
+ /* 3130 */ 350, 350, 350, 350, 350, 350, 350, 350, 350, 350,
+ /* 3140 */ 350, 350, 350, 350, 350, 350, 350, 350, 350, 350,
+ /* 3150 */ 350, 350, 350, 350, 350, 350, 350, 350, 350, 350,
+ /* 3160 */ 350, 350, 350, 350, 350, 350, 350, 350, 350, 350,
+ /* 3170 */ 350, 350, 350, 350, 350, 350, 350, 350, 350, 350,
+ /* 3180 */ 350, 350, 350, 350, 350, 350, 350, 350, 350, 350,
+ /* 3190 */ 350, 350, 350, 350, 350, 350, 350, 350, 350, 350,
+ /* 3200 */ 350, 350, 350, 350, 350, 350, 350, 350, 350, 350,
+ /* 3210 */ 350, 350, 350, 350, 350, 350, 350, 350, 350, 350,
+ /* 3220 */ 350, 350, 350, 350, 350, 350, 350, 350, 350, 350,
+ /* 3230 */ 350, 350, 350, 350, 350, 350, 350, 350, 350, 350,
+ /* 3240 */ 350, 350, 350, 350, 350, 350, 350, 350, 350, 350,
+ /* 3250 */ 350, 350, 350, 350, 350, 350, 350, 350, 350, 350,
+ /* 3260 */ 350, 350, 350, 350, 350, 350, 350, 350, 350, 350,
+ /* 3270 */ 350, 350, 350, 350, 350, 350, 350, 350, 350, 350,
+ /* 3280 */ 350, 350, 350, 350, 350, 350, 350, 350, 350, 350,
+ /* 3290 */ 350, 350, 350, 350, 350, 350, 350, 350, 350, 350,
+ /* 3300 */ 350, 350, 350, 350, 350, 350, 350, 350, 350, 350,
+ /* 3310 */ 350, 350, 350, 350, 350, 350, 350, 350, 350, 350,
+ /* 3320 */ 350, 350, 350, 350, 350, 350, 350, 350, 350, 350,
+ /* 3330 */ 350, 350, 350, 350, 350, 350, 350, 350, 350, 350,
+ /* 3340 */ 350, 350, 350, 350, 350, 350, 350, 350, 350, 350,
+ /* 3350 */ 350, 350, 350, 350, 350, 350, 350, 350, 350, 350,
+ /* 3360 */ 350, 350, 350, 350, 350, 350, 350, 350, 350, 350,
+ /* 3370 */ 350, 350, 350, 350, 350, 350, 350, 350, 350, 350,
+ /* 3380 */ 350, 350, 350, 350, 350, 350, 350, 350, 350, 350,
+ /* 3390 */ 350, 350, 350, 350, 350, 350, 350, 350, 350, 350,
+ /* 3400 */ 350, 350, 350, 350, 350, 350, 350, 350, 350, 350,
+ /* 3410 */ 350, 350, 350, 350, 350, 350, 350, 350, 350, 350,
+ /* 3420 */ 350, 350, 350, 350, 350, 350, 350, 350, 350, 350,
+ /* 3430 */ 350, 350, 350,
};
-#define YY_SHIFT_COUNT (839)
+#define YY_SHIFT_COUNT (845)
#define YY_SHIFT_MIN (0)
-#define YY_SHIFT_MAX (2374)
+#define YY_SHIFT_MAX (2412)
static const unsigned short int yy_shift_ofst[] = {
- /* 0 */ 1442, 0, 241, 0, 483, 483, 483, 483, 483, 483,
- /* 10 */ 483, 483, 483, 483, 483, 483, 724, 965, 965, 1206,
- /* 20 */ 965, 965, 965, 965, 965, 965, 965, 965, 965, 965,
- /* 30 */ 965, 965, 965, 965, 965, 965, 965, 965, 965, 965,
- /* 40 */ 965, 965, 965, 965, 965, 965, 965, 965, 965, 965,
- /* 50 */ 965, 167, 402, 1084, 251, 405, 587, 405, 405, 251,
- /* 60 */ 251, 405, 1325, 405, 240, 1325, 1325, 513, 405, 5,
- /* 70 */ 170, 171, 171, 160, 160, 170, 78, 39, 295, 295,
- /* 80 */ 326, 171, 171, 171, 171, 171, 171, 171, 171, 171,
- /* 90 */ 171, 171, 261, 355, 171, 171, 91, 5, 171, 261,
- /* 100 */ 171, 5, 171, 171, 5, 171, 171, 5, 171, 5,
- /* 110 */ 5, 5, 171, 400, 202, 202, 465, 198, 118, 118,
- /* 120 */ 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
- /* 130 */ 118, 118, 118, 118, 118, 118, 118, 1114, 200, 78,
- /* 140 */ 39, 515, 515, 949, 415, 415, 415, 364, 536, 536,
- /* 150 */ 1041, 949, 91, 307, 5, 5, 262, 5, 376, 5,
- /* 160 */ 376, 376, 506, 618, 577, 577, 577, 577, 577, 577,
- /* 170 */ 577, 577, 988, 677, 65, 1132, 66, 523, 242, 76,
- /* 180 */ 600, 659, 571, 571, 1059, 1087, 1102, 246, 246, 246,
- /* 190 */ 327, 246, 480, 575, 1075, 808, 204, 545, 1075, 1075,
- /* 200 */ 1077, 1030, 738, 861, 1030, 530, 1034, 1041, 1216, 1439,
- /* 210 */ 1450, 1474, 1281, 91, 1474, 91, 1301, 1484, 1491, 1469,
- /* 220 */ 1491, 1469, 1343, 1484, 1491, 1484, 1469, 1343, 1343, 1424,
- /* 230 */ 1428, 1484, 1432, 1484, 1484, 1484, 1518, 1489, 1518, 1489,
- /* 240 */ 1474, 91, 91, 1529, 91, 1532, 1538, 91, 1532, 91,
- /* 250 */ 1543, 91, 91, 1484, 91, 1518, 5, 5, 5, 5,
- /* 260 */ 5, 5, 5, 5, 5, 5, 5, 1484, 618, 618,
- /* 270 */ 1518, 376, 376, 376, 1369, 1482, 1474, 400, 1591, 1408,
- /* 280 */ 1411, 1529, 400, 1216, 1484, 376, 1344, 1347, 1344, 1347,
- /* 290 */ 1341, 1440, 1344, 1356, 1362, 1374, 1216, 1340, 1364, 1372,
- /* 300 */ 1385, 1491, 1636, 1542, 1394, 1532, 400, 400, 1347, 376,
- /* 310 */ 376, 376, 376, 1347, 376, 1505, 400, 506, 400, 1491,
- /* 320 */ 1588, 1590, 376, 1484, 400, 1678, 1666, 1518, 3071, 3071,
- /* 330 */ 3071, 3071, 3071, 3071, 3071, 3071, 3071, 36, 462, 306,
- /* 340 */ 565, 1069, 435, 805, 551, 15, 30, 650, 779, 40,
- /* 350 */ 40, 40, 40, 40, 40, 40, 40, 40, 759, 151,
- /* 360 */ 416, 1217, 1217, 730, 461, 457, 468, 678, 479, 961,
- /* 370 */ 863, 334, 334, 727, 1184, 774, 727, 727, 727, 1262,
- /* 380 */ 1103, 503, 1020, 1273, 1155, 1331, 1187, 1230, 1234, 1242,
- /* 390 */ 1307, 1332, 388, 936, 1352, 1085, 1127, 1323, 981, 1326,
- /* 400 */ 1333, 1354, 1225, 1090, 637, 1355, 1359, 1360, 1361, 1363,
- /* 410 */ 1365, 1375, 1366, 1203, 1274, 873, 1367, 1368, 1370, 1371,
- /* 420 */ 1373, 1377, 1072, 991, 1278, 1342, 1348, 1320, 1380, 1710,
- /* 430 */ 1717, 1718, 1674, 1722, 1688, 1508, 1699, 1700, 1702, 1517,
- /* 440 */ 1742, 1706, 1709, 1524, 1712, 1750, 1528, 1751, 1716, 1755,
- /* 450 */ 1719, 1758, 1737, 1766, 1732, 1551, 1771, 1565, 1773, 1569,
- /* 460 */ 1572, 1576, 1583, 1783, 1784, 1785, 1593, 1592, 1790, 1791,
- /* 470 */ 1645, 1744, 1745, 1795, 1759, 1797, 1798, 1762, 1749, 1802,
- /* 480 */ 1754, 1804, 1760, 1806, 1807, 1808, 1761, 1811, 1812, 1813,
- /* 490 */ 1815, 1816, 1817, 1657, 1782, 1820, 1661, 1824, 1825, 1826,
- /* 500 */ 1827, 1832, 1833, 1840, 1843, 1844, 1845, 1846, 1847, 1855,
- /* 510 */ 1857, 1858, 1859, 1860, 1780, 1830, 1805, 1851, 1861, 1863,
- /* 520 */ 1864, 1866, 1867, 1874, 1854, 1878, 1733, 1879, 1703, 1881,
- /* 530 */ 1738, 1884, 1885, 1869, 1838, 1870, 1839, 1893, 1835, 1873,
- /* 540 */ 1894, 1836, 1896, 1848, 1897, 1909, 1876, 1865, 1875, 1911,
- /* 550 */ 1877, 1868, 1880, 1915, 1886, 1882, 1883, 1921, 1889, 1924,
- /* 560 */ 1890, 1892, 1895, 1888, 1891, 1913, 1898, 1929, 1899, 1901,
- /* 570 */ 1931, 1936, 1938, 1939, 1902, 1756, 1941, 1888, 1900, 1945,
- /* 580 */ 1950, 1904, 1951, 1952, 1916, 1903, 1917, 1957, 1926, 1907,
- /* 590 */ 1919, 1964, 1928, 1918, 1925, 1966, 1933, 1922, 1930, 1968,
- /* 600 */ 1976, 1983, 1986, 1987, 1988, 1908, 1905, 1953, 1967, 1992,
- /* 610 */ 1956, 1958, 1960, 1962, 1963, 1969, 1979, 1981, 1961, 1970,
- /* 620 */ 1984, 1990, 1991, 1993, 2005, 1998, 2023, 2002, 1972, 2028,
- /* 630 */ 2007, 1996, 2034, 2035, 2036, 2000, 2039, 2004, 2042, 2022,
- /* 640 */ 2025, 2009, 2010, 2012, 1944, 1946, 2053, 1912, 1948, 1850,
- /* 650 */ 1888, 2013, 2058, 1914, 2024, 2037, 2063, 1862, 2043, 1932,
- /* 660 */ 1935, 2066, 2067, 1949, 1943, 1954, 1955, 2065, 2038, 1796,
- /* 670 */ 1971, 1973, 1975, 2019, 1974, 2026, 2006, 1994, 2040, 2050,
- /* 680 */ 2003, 1989, 2029, 2030, 2008, 2061, 2049, 2051, 2032, 2079,
- /* 690 */ 1801, 2011, 2027, 2127, 2098, 1871, 2095, 2103, 2105, 2106,
- /* 700 */ 2107, 2109, 2041, 2044, 2100, 1910, 2114, 2101, 2152, 2153,
- /* 710 */ 2048, 2115, 2052, 2054, 2055, 2057, 2060, 1985, 2064, 2156,
- /* 720 */ 2117, 1995, 2068, 2056, 1888, 2123, 2131, 2069, 1940, 2071,
- /* 730 */ 2178, 2160, 1959, 2077, 2086, 2089, 2090, 2092, 2093, 2147,
- /* 740 */ 2096, 2099, 2154, 2094, 2182, 1997, 2104, 2091, 2102, 2169,
- /* 750 */ 2176, 2118, 2116, 2188, 2120, 2121, 2190, 2124, 2122, 2196,
- /* 760 */ 2130, 2134, 2201, 2136, 2137, 2206, 2141, 2119, 2126, 2128,
- /* 770 */ 2132, 2142, 2216, 2145, 2220, 2155, 2216, 2216, 2236, 2189,
- /* 780 */ 2192, 2227, 2228, 2229, 2230, 2234, 2235, 2237, 2248, 2250,
- /* 790 */ 2193, 2191, 2212, 2194, 2262, 2261, 2268, 2270, 2286, 2273,
- /* 800 */ 2275, 2277, 2238, 1961, 2280, 1970, 2281, 2283, 2284, 2295,
- /* 810 */ 2306, 2296, 2313, 2298, 2285, 2303, 2346, 2310, 2297, 2309,
- /* 820 */ 2352, 2317, 2304, 2322, 2366, 2330, 2318, 2326, 2370, 2335,
- /* 830 */ 2336, 2374, 2353, 2343, 2355, 2358, 2359, 2360, 2363, 2367,
+ /* 0 */ 1300, 0, 244, 0, 489, 489, 489, 489, 489, 489,
+ /* 10 */ 489, 489, 489, 489, 489, 489, 733, 977, 977, 1221,
+ /* 20 */ 977, 977, 977, 977, 977, 977, 977, 977, 977, 977,
+ /* 30 */ 977, 977, 977, 977, 977, 977, 977, 977, 977, 977,
+ /* 40 */ 977, 977, 977, 977, 977, 977, 977, 977, 977, 977,
+ /* 50 */ 977, 420, 439, 96, 210, 34, 130, 34, 34, 210,
+ /* 60 */ 210, 34, 1469, 34, 243, 1469, 1469, 322, 34, 1,
+ /* 70 */ 240, 131, 131, 1060, 1060, 240, 294, 501, 154, 154,
+ /* 80 */ 551, 131, 131, 131, 131, 131, 131, 131, 131, 131,
+ /* 90 */ 131, 131, 165, 238, 131, 131, 31, 1, 131, 165,
+ /* 100 */ 131, 1, 131, 131, 1, 131, 131, 1, 131, 1,
+ /* 110 */ 1, 1, 131, 532, 203, 203, 488, 634, 834, 834,
+ /* 120 */ 834, 834, 834, 834, 834, 834, 834, 834, 834, 834,
+ /* 130 */ 834, 834, 834, 834, 834, 834, 834, 437, 256, 294,
+ /* 140 */ 501, 555, 555, 763, 278, 278, 278, 137, 272, 272,
+ /* 150 */ 403, 763, 31, 512, 1, 1, 424, 1, 780, 1,
+ /* 160 */ 780, 780, 595, 884, 212, 212, 212, 212, 212, 212,
+ /* 170 */ 212, 212, 1695, 361, 657, 812, 611, 639, 118, 13,
+ /* 180 */ 629, 659, 738, 738, 777, 908, 814, 734, 734, 734,
+ /* 190 */ 640, 734, 330, 768, 1025, 419, 805, 94, 1025, 1025,
+ /* 200 */ 1029, 917, 576, 575, 917, 295, 894, 403, 1215, 1441,
+ /* 210 */ 1458, 1481, 1290, 31, 1481, 31, 1314, 1500, 1508, 1491,
+ /* 220 */ 1508, 1491, 1363, 1500, 1508, 1500, 1491, 1363, 1363, 1446,
+ /* 230 */ 1451, 1500, 1454, 1500, 1500, 1500, 1542, 1515, 1542, 1515,
+ /* 240 */ 1481, 31, 31, 1555, 31, 1562, 1570, 31, 1562, 31,
+ /* 250 */ 1575, 31, 31, 1500, 31, 1542, 1, 1, 1, 1,
+ /* 260 */ 1, 1, 1, 1, 1, 1, 1, 1500, 884, 884,
+ /* 270 */ 1542, 780, 780, 780, 1406, 1533, 1481, 532, 1626, 1440,
+ /* 280 */ 1445, 1555, 532, 1215, 1500, 780, 1373, 1376, 1373, 1376,
+ /* 290 */ 1370, 1471, 1373, 1375, 1377, 1389, 1215, 1367, 1382, 1398,
+ /* 300 */ 1422, 1508, 1680, 1584, 1433, 1562, 532, 532, 1376, 780,
+ /* 310 */ 780, 780, 780, 1376, 780, 1530, 532, 595, 532, 1508,
+ /* 320 */ 1630, 1631, 780, 1500, 532, 1720, 1709, 1542, 3083, 3083,
+ /* 330 */ 3083, 3083, 3083, 3083, 3083, 3083, 3083, 36, 1228, 197,
+ /* 340 */ 748, 1007, 81, 1045, 888, 15, 527, 1062, 995, 1289,
+ /* 350 */ 1289, 1289, 1289, 1289, 1289, 1289, 1289, 1289, 216, 148,
+ /* 360 */ 12, 802, 802, 226, 729, 10, 742, 843, 773, 732,
+ /* 370 */ 897, 747, 914, 914, 1019, 6, 605, 1019, 1019, 1019,
+ /* 380 */ 1249, 1066, 487, 370, 1202, 1028, 1122, 1154, 1168, 1170,
+ /* 390 */ 1172, 1229, 1247, 1240, 1273, 1287, 1292, 1093, 684, 1274,
+ /* 400 */ 1145, 1282, 1283, 1286, 1177, 1068, 1279, 1291, 1296, 1297,
+ /* 410 */ 1298, 1309, 1310, 1325, 1313, 433, 1320, 1268, 1350, 1407,
+ /* 420 */ 1408, 1410, 1414, 1419, 1254, 1285, 1299, 1335, 1337, 1301,
+ /* 430 */ 1431, 1764, 1766, 1767, 1725, 1773, 1737, 1549, 1740, 1741,
+ /* 440 */ 1742, 1554, 1783, 1747, 1748, 1559, 1750, 1788, 1563, 1791,
+ /* 450 */ 1756, 1794, 1768, 1806, 1785, 1808, 1774, 1588, 1812, 1606,
+ /* 460 */ 1818, 1609, 1611, 1616, 1621, 1825, 1826, 1833, 1639, 1641,
+ /* 470 */ 1839, 1840, 1694, 1795, 1798, 1843, 1813, 1849, 1851, 1816,
+ /* 480 */ 1801, 1854, 1811, 1855, 1823, 1857, 1861, 1870, 1824, 1872,
+ /* 490 */ 1874, 1875, 1877, 1887, 1889, 1715, 1844, 1882, 1718, 1884,
+ /* 500 */ 1885, 1892, 1894, 1895, 1896, 1897, 1898, 1900, 1901, 1902,
+ /* 510 */ 1903, 1904, 1907, 1908, 1909, 1910, 1912, 1918, 1865, 1915,
+ /* 520 */ 1876, 1920, 1922, 1923, 1925, 1926, 1927, 1928, 1919, 1930,
+ /* 530 */ 1796, 1943, 1800, 1945, 1804, 1951, 1953, 1934, 1916, 1935,
+ /* 540 */ 1917, 1964, 1905, 1931, 1969, 1906, 1973, 1911, 1974, 1977,
+ /* 550 */ 1947, 1940, 1944, 1988, 1955, 1948, 1961, 2004, 1968, 1956,
+ /* 560 */ 1966, 2006, 1972, 2010, 1967, 1971, 1978, 1965, 1970, 2001,
+ /* 570 */ 1975, 2016, 1979, 1976, 2017, 2020, 2021, 2023, 1984, 1834,
+ /* 580 */ 2028, 1965, 1980, 2031, 2032, 1962, 2033, 2035, 1999, 1986,
+ /* 590 */ 1998, 2041, 2008, 1992, 2005, 2046, 2011, 2000, 2007, 2050,
+ /* 600 */ 2015, 2002, 2012, 2055, 2056, 2058, 2059, 2060, 2061, 1949,
+ /* 610 */ 1950, 2025, 2043, 2072, 2030, 2036, 2037, 2038, 2039, 2040,
+ /* 620 */ 2042, 2044, 2049, 2051, 2048, 2062, 2047, 2063, 2068, 2065,
+ /* 630 */ 2088, 2073, 2097, 2079, 2052, 2102, 2081, 2069, 2104, 2107,
+ /* 640 */ 2108, 2074, 2109, 2076, 2114, 2093, 2096, 2080, 2083, 2084,
+ /* 650 */ 2027, 2024, 2118, 1941, 2026, 1929, 1965, 2075, 2136, 1957,
+ /* 660 */ 2100, 2119, 2140, 1938, 2120, 1963, 1982, 2146, 2148, 1983,
+ /* 670 */ 1960, 1987, 1981, 2149, 2122, 1879, 2064, 2045, 2066, 2124,
+ /* 680 */ 2071, 2127, 2082, 2070, 2139, 2150, 2078, 2077, 2085, 2086,
+ /* 690 */ 2089, 2155, 2130, 2133, 2091, 2157, 1924, 2092, 2094, 2191,
+ /* 700 */ 2162, 1933, 2167, 2169, 2170, 2171, 2174, 2175, 2105, 2106,
+ /* 710 */ 2166, 1946, 2184, 2173, 2199, 2218, 2112, 2178, 2117, 2121,
+ /* 720 */ 2132, 2123, 2125, 2057, 2135, 2225, 2185, 2095, 2138, 2110,
+ /* 730 */ 1965, 2200, 2215, 2151, 2003, 2153, 2257, 2239, 2029, 2159,
+ /* 740 */ 2156, 2176, 2168, 2177, 2179, 2228, 2186, 2187, 2229, 2181,
+ /* 750 */ 2259, 2054, 2188, 2165, 2189, 2248, 2261, 2192, 2193, 2263,
+ /* 760 */ 2195, 2196, 2268, 2202, 2198, 2270, 2203, 2204, 2274, 2206,
+ /* 770 */ 2207, 2277, 2209, 2164, 2190, 2197, 2201, 2210, 2286, 2214,
+ /* 780 */ 2287, 2216, 2286, 2286, 2304, 2224, 2271, 2291, 2295, 2302,
+ /* 790 */ 2307, 2309, 2311, 2312, 2313, 2314, 2276, 2251, 2278, 2252,
+ /* 800 */ 2308, 2318, 2320, 2321, 2337, 2325, 2326, 2328, 2288, 2049,
+ /* 810 */ 2336, 2051, 2338, 2339, 2340, 2341, 2357, 2343, 2381, 2345,
+ /* 820 */ 2332, 2344, 2389, 2359, 2334, 2356, 2399, 2364, 2352, 2362,
+ /* 830 */ 2405, 2369, 2358, 2365, 2408, 2373, 2374, 2412, 2391, 2382,
+ /* 840 */ 2392, 2395, 2396, 2397, 2400, 2402,
};
#define YY_REDUCE_COUNT (336)
-#define YY_REDUCE_MIN (-430)
-#define YY_REDUCE_MAX (2613)
+#define YY_REDUCE_MIN (-463)
+#define YY_REDUCE_MAX (2622)
static const short yy_reduce_ofst[] = {
- /* 0 */ 431, -303, 149, 185, -23, 390, 421, 630, 662, 872,
- /* 10 */ 967, 1150, 1276, 1310, 1384, 1418, 488, -81, 1451, 1527,
- /* 20 */ 1557, 1635, 1652, 1669, 1734, 1764, 1829, 1849, 1872, 1887,
- /* 30 */ 1906, 1980, 1999, 2015, 2073, 2097, 2140, 2166, 2209, 2233,
- /* 40 */ 2276, 2291, 2307, 2384, 2403, 2419, 2477, 2501, 2544, 2570,
- /* 50 */ 2613, -305, -202, 384, -187, 31, 451, 558, 660, 541,
- /* 60 */ 707, 763, 643, -340, -341, -99, 228, -177, 89, -380,
- /* 70 */ -211, 401, 403, -356, -351, -390, -330, -333, -257, 140,
- /* 80 */ -218, 412, 487, 619, 628, -312, -225, 634, 669, 681,
- /* 90 */ 696, -97, 179, -2, 739, 793, -284, 250, 642, 187,
- /* 100 */ 809, 354, 858, 882, -383, 892, 894, 425, 896, 522,
- /* 110 */ 455, 620, 905, -66, -425, -425, -296, -149, 35, 159,
- /* 120 */ 182, 397, 452, 485, 534, 638, 722, 820, 843, 844,
- /* 130 */ 849, 886, 898, 900, 901, 929, 930, -61, -270, -245,
- /* 140 */ -342, 278, 429, 632, -270, 206, 350, 12, 531, 698,
- /* 150 */ 751, 761, 509, 670, 520, 776, -307, 313, 765, 782,
- /* 160 */ 869, 885, 906, 941, -385, 291, 347, 395, 419, 440,
- /* 170 */ 478, 419, -430, 686, 754, 870, 857, 855, 1005, 887,
- /* 180 */ 982, 982, 999, 1007, 979, 1047, 993, 918, 919, 921,
- /* 190 */ 998, 922, 982, 1060, 1009, 1064, 1057, 1031, 1053, 1055,
- /* 200 */ 982, 985, 985, 977, 985, 1011, 1004, 1106, 1062, 1045,
- /* 210 */ 1048, 1061, 1054, 1130, 1065, 1131, 1076, 1144, 1149, 1104,
- /* 220 */ 1152, 1105, 1109, 1158, 1159, 1161, 1113, 1112, 1118, 1154,
- /* 230 */ 1157, 1170, 1162, 1172, 1174, 1175, 1185, 1183, 1188, 1186,
- /* 240 */ 1108, 1173, 1176, 1145, 1180, 1190, 1133, 1189, 1195, 1191,
- /* 250 */ 1146, 1193, 1196, 1204, 1197, 1214, 1192, 1194, 1198, 1199,
- /* 260 */ 1200, 1201, 1202, 1205, 1207, 1208, 1215, 1218, 1224, 1226,
- /* 270 */ 1223, 1178, 1179, 1181, 1153, 1168, 1171, 1241, 1209, 1182,
- /* 280 */ 1210, 1211, 1251, 1213, 1259, 1219, 1137, 1220, 1140, 1221,
- /* 290 */ 1139, 1142, 1156, 1151, 1147, 1164, 1222, 1148, 1160, 1166,
- /* 300 */ 985, 1291, 1227, 1177, 1212, 1311, 1305, 1308, 1257, 1277,
- /* 310 */ 1279, 1280, 1282, 1263, 1283, 1271, 1321, 1302, 1322, 1330,
- /* 320 */ 1228, 1303, 1294, 1337, 1334, 1350, 1349, 1351, 1284, 1268,
- /* 330 */ 1286, 1287, 1327, 1336, 1339, 1346, 1387,
+ /* 0 */ 280, -308, 150, 181, 395, 425, 493, 638, 736, 979,
+ /* 10 */ 248, 1131, 1158, 1227, 1342, 1374, -81, 902, 1409, 1482,
+ /* 20 */ 1505, 720, 1525, 1540, 1636, 1672, 1704, 1781, 1797, 1815,
+ /* 30 */ 1880, 1914, 1937, 1994, 2067, 2087, 2145, 2160, 2182, 2240,
+ /* 40 */ 2255, 2275, 2348, 2368, 2385, 2454, 2512, 2527, 2549, 2607,
+ /* 50 */ 2622, -310, -217, -425, 38, -418, 769, 771, 910, -172,
+ /* 60 */ -156, 948, -381, -438, -257, 126, 149, -463, -300, 363,
+ /* 70 */ -324, -326, 52, -358, -202, -335, -218, 264, -90, 158,
+ /* 80 */ -84, -152, -98, 172, 187, -134, 91, 199, 331, 411,
+ /* 90 */ 478, 285, -54, -316, 504, 545, 159, 189, 652, 282,
+ /* 100 */ 697, 401, 714, 758, -368, 781, 784, 499, 786, 324,
+ /* 110 */ 535, 372, 775, -312, -422, -422, 47, -280, -353, 39,
+ /* 120 */ 354, 533, 564, 599, 601, 604, 694, 712, 719, 776,
+ /* 130 */ 803, 808, 831, 832, 846, 851, 853, -185, -89, 55,
+ /* 140 */ 99, 221, 622, 623, -89, 222, 589, 407, 534, 647,
+ /* 150 */ 627, 737, 408, 250, 703, 745, 624, 637, 756, 754,
+ /* 160 */ 799, 833, 515, 889, -392, -363, 566, 571, 614, 648,
+ /* 170 */ 743, 614, 692, 789, 841, 887, 824, 837, 982, 880,
+ /* 180 */ 984, 984, 994, 998, 962, 1020, 967, 891, 896, 898,
+ /* 190 */ 968, 903, 984, 1053, 1005, 1048, 1037, 1041, 1059, 1061,
+ /* 200 */ 984, 1004, 1004, 985, 1004, 1006, 1002, 1104, 1063, 1049,
+ /* 210 */ 1054, 1064, 1071, 1134, 1069, 1135, 1087, 1156, 1169, 1123,
+ /* 220 */ 1174, 1126, 1132, 1178, 1179, 1181, 1133, 1137, 1138, 1175,
+ /* 230 */ 1180, 1190, 1182, 1194, 1195, 1196, 1205, 1206, 1209, 1207,
+ /* 240 */ 1129, 1197, 1200, 1171, 1203, 1216, 1161, 1220, 1230, 1225,
+ /* 250 */ 1184, 1226, 1233, 1236, 1235, 1246, 1223, 1232, 1234, 1237,
+ /* 260 */ 1238, 1242, 1243, 1244, 1245, 1248, 1250, 1255, 1263, 1266,
+ /* 270 */ 1252, 1218, 1239, 1241, 1189, 1198, 1208, 1271, 1210, 1213,
+ /* 280 */ 1217, 1251, 1281, 1231, 1293, 1256, 1166, 1262, 1173, 1264,
+ /* 290 */ 1176, 1183, 1186, 1201, 1191, 1185, 1259, 1160, 1187, 1199,
+ /* 300 */ 1004, 1331, 1253, 1222, 1258, 1343, 1339, 1340, 1302, 1303,
+ /* 310 */ 1307, 1318, 1319, 1304, 1323, 1311, 1344, 1345, 1360, 1368,
+ /* 320 */ 1269, 1346, 1327, 1378, 1379, 1390, 1393, 1391, 1321, 1317,
+ /* 330 */ 1328, 1336, 1381, 1383, 1384, 1392, 1412,
};
static const YYACTIONTYPE yy_default[] = {
- /* 0 */ 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884,
- /* 10 */ 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884,
- /* 20 */ 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884,
- /* 30 */ 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884,
- /* 40 */ 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884,
- /* 50 */ 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884,
- /* 60 */ 1884, 2219, 1884, 1884, 2182, 1884, 1884, 1884, 1884, 1884,
- /* 70 */ 1884, 1884, 1884, 1884, 1884, 1884, 2189, 1884, 1884, 1884,
- /* 80 */ 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884,
- /* 90 */ 1884, 1884, 1884, 1884, 1884, 1884, 1981, 1884, 1884, 1884,
- /* 100 */ 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884,
- /* 110 */ 1884, 1884, 1884, 1979, 2422, 1884, 1884, 1884, 1884, 1884,
- /* 120 */ 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884,
- /* 130 */ 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 2434, 1884,
- /* 140 */ 1884, 1955, 1955, 1884, 2434, 2434, 2434, 1979, 2394, 2394,
- /* 150 */ 1884, 1884, 1981, 2257, 1884, 1884, 1884, 1884, 1884, 1884,
- /* 160 */ 1884, 1884, 2104, 1914, 1884, 1884, 1884, 1884, 2128, 1884,
- /* 170 */ 1884, 1884, 2245, 1884, 1884, 2463, 2523, 1884, 1884, 2466,
- /* 180 */ 1884, 1884, 1884, 1884, 2194, 1884, 2453, 1884, 1884, 1884,
- /* 190 */ 1884, 1884, 1884, 1884, 1884, 1884, 2057, 2239, 1884, 1884,
- /* 200 */ 1884, 2426, 2440, 2507, 2427, 2424, 2447, 1884, 2457, 1884,
- /* 210 */ 2282, 1884, 2271, 1981, 1884, 1981, 2232, 2177, 1884, 2187,
- /* 220 */ 1884, 2187, 2184, 1884, 1884, 1884, 2187, 2184, 2184, 2046,
- /* 230 */ 2042, 1884, 2040, 1884, 1884, 1884, 1884, 1939, 1884, 1939,
- /* 240 */ 1884, 1981, 1981, 1884, 1981, 1884, 1884, 1981, 1884, 1981,
- /* 250 */ 1884, 1981, 1981, 1884, 1981, 1884, 1884, 1884, 1884, 1884,
- /* 260 */ 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884,
- /* 270 */ 1884, 1884, 1884, 1884, 2269, 2255, 1884, 1979, 1884, 2243,
- /* 280 */ 2241, 1884, 1979, 2457, 1884, 1884, 2477, 2472, 2477, 2472,
- /* 290 */ 2491, 2487, 2477, 2496, 2493, 2459, 2457, 2526, 2513, 2509,
- /* 300 */ 2440, 1884, 1884, 2445, 2443, 1884, 1979, 1979, 2472, 1884,
- /* 310 */ 1884, 1884, 1884, 2472, 1884, 1884, 1979, 1884, 1979, 1884,
- /* 320 */ 1884, 2073, 1884, 1884, 1979, 1884, 1923, 1884, 2234, 2260,
- /* 330 */ 2215, 2215, 2107, 2107, 2107, 1982, 1889, 1884, 1884, 1884,
- /* 340 */ 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 2490,
- /* 350 */ 2489, 2347, 1884, 2398, 2397, 2396, 2387, 2346, 2069, 1884,
- /* 360 */ 1884, 2345, 2344, 1884, 1884, 1884, 1884, 1884, 1884, 1884,
- /* 370 */ 1884, 2206, 2205, 2338, 1884, 1884, 2339, 2337, 2336, 1884,
- /* 380 */ 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884,
- /* 390 */ 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884,
- /* 400 */ 1884, 1884, 1884, 2510, 2514, 1884, 1884, 1884, 1884, 1884,
- /* 410 */ 1884, 2423, 1884, 1884, 1884, 2318, 1884, 1884, 1884, 1884,
- /* 420 */ 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884,
- /* 430 */ 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884,
- /* 440 */ 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884,
- /* 450 */ 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884,
- /* 460 */ 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884,
- /* 470 */ 2183, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884,
- /* 480 */ 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884,
- /* 490 */ 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884,
- /* 500 */ 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884,
- /* 510 */ 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884,
- /* 520 */ 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884,
- /* 530 */ 2198, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884,
- /* 540 */ 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884,
- /* 550 */ 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884,
- /* 560 */ 1884, 1884, 1928, 2325, 1884, 1884, 1884, 1884, 1884, 1884,
- /* 570 */ 1884, 1884, 1884, 1884, 1884, 1884, 1884, 2328, 1884, 1884,
- /* 580 */ 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884,
- /* 590 */ 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884,
- /* 600 */ 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884,
- /* 610 */ 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 2021, 2020,
- /* 620 */ 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884,
- /* 630 */ 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884,
- /* 640 */ 1884, 1884, 1884, 1884, 2329, 1884, 1884, 1884, 1884, 1884,
- /* 650 */ 2320, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884,
- /* 660 */ 1884, 1884, 1884, 1884, 1884, 1884, 1884, 2506, 2460, 1884,
- /* 670 */ 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884,
- /* 680 */ 1884, 1884, 1884, 1884, 1884, 1884, 1884, 2318, 1884, 2488,
- /* 690 */ 1884, 1884, 2504, 1884, 2508, 1884, 1884, 1884, 1884, 1884,
- /* 700 */ 1884, 1884, 2433, 2429, 1884, 1884, 2425, 1884, 1884, 1884,
- /* 710 */ 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884,
- /* 720 */ 1884, 1884, 1884, 1884, 2317, 1884, 2384, 1884, 1884, 1884,
- /* 730 */ 2418, 1884, 1884, 2369, 1884, 1884, 1884, 1884, 1884, 1884,
- /* 740 */ 1884, 1884, 1884, 2329, 1884, 2332, 1884, 1884, 1884, 1884,
- /* 750 */ 1884, 2101, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884,
- /* 760 */ 1884, 1884, 1884, 1884, 1884, 1884, 1884, 2085, 2083, 2082,
- /* 770 */ 2081, 1884, 2114, 1884, 1884, 1884, 2110, 2109, 1884, 1884,
- /* 780 */ 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884,
- /* 790 */ 1884, 1884, 1884, 1884, 2000, 1884, 1884, 1884, 1884, 1884,
- /* 800 */ 1884, 1884, 1884, 1992, 1884, 1991, 1884, 1884, 1884, 1884,
- /* 810 */ 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884,
- /* 820 */ 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884,
- /* 830 */ 1884, 1884, 1884, 1913, 1884, 1884, 1884, 1884, 1884, 1884,
+ /* 0 */ 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895,
+ /* 10 */ 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895,
+ /* 20 */ 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895,
+ /* 30 */ 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895,
+ /* 40 */ 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895,
+ /* 50 */ 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895,
+ /* 60 */ 1895, 2235, 1895, 1895, 2198, 1895, 1895, 1895, 1895, 1895,
+ /* 70 */ 1895, 1895, 1895, 1895, 1895, 1895, 2205, 1895, 1895, 1895,
+ /* 80 */ 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895,
+ /* 90 */ 1895, 1895, 1895, 1895, 1895, 1895, 1994, 1895, 1895, 1895,
+ /* 100 */ 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895,
+ /* 110 */ 1895, 1895, 1895, 1992, 2438, 1895, 1895, 1895, 1895, 1895,
+ /* 120 */ 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895,
+ /* 130 */ 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 2450, 1895,
+ /* 140 */ 1895, 1966, 1966, 1895, 2450, 2450, 2450, 1992, 2410, 2410,
+ /* 150 */ 1895, 1895, 1994, 2273, 1895, 1895, 1895, 1895, 1895, 1895,
+ /* 160 */ 1895, 1895, 2117, 1925, 1895, 1895, 1895, 1895, 2141, 1895,
+ /* 170 */ 1895, 1895, 2261, 1895, 1895, 2479, 2539, 1895, 1895, 2482,
+ /* 180 */ 1895, 1895, 1895, 1895, 2210, 1895, 2469, 1895, 1895, 1895,
+ /* 190 */ 1895, 1895, 1895, 1895, 1895, 1895, 2070, 2255, 1895, 1895,
+ /* 200 */ 1895, 2442, 2456, 2523, 2443, 2440, 2463, 1895, 2473, 1895,
+ /* 210 */ 2298, 1895, 2287, 1994, 1895, 1994, 2248, 2193, 1895, 2203,
+ /* 220 */ 1895, 2203, 2200, 1895, 1895, 1895, 2203, 2200, 2200, 2059,
+ /* 230 */ 2055, 1895, 2053, 1895, 1895, 1895, 1895, 1950, 1895, 1950,
+ /* 240 */ 1895, 1994, 1994, 1895, 1994, 1895, 1895, 1994, 1895, 1994,
+ /* 250 */ 1895, 1994, 1994, 1895, 1994, 1895, 1895, 1895, 1895, 1895,
+ /* 260 */ 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895,
+ /* 270 */ 1895, 1895, 1895, 1895, 2285, 2271, 1895, 1992, 1895, 2259,
+ /* 280 */ 2257, 1895, 1992, 2473, 1895, 1895, 2493, 2488, 2493, 2488,
+ /* 290 */ 2507, 2503, 2493, 2512, 2509, 2475, 2473, 2542, 2529, 2525,
+ /* 300 */ 2456, 1895, 1895, 2461, 2459, 1895, 1992, 1992, 2488, 1895,
+ /* 310 */ 1895, 1895, 1895, 2488, 1895, 1895, 1992, 1895, 1992, 1895,
+ /* 320 */ 1895, 2086, 1895, 1895, 1992, 1895, 1934, 1895, 2250, 2276,
+ /* 330 */ 2231, 2231, 2120, 2120, 2120, 1995, 1900, 1895, 1895, 1895,
+ /* 340 */ 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 2506,
+ /* 350 */ 2505, 2363, 1895, 2414, 2413, 2412, 2403, 2362, 2082, 1895,
+ /* 360 */ 1895, 2361, 2360, 1895, 1895, 1895, 1895, 1895, 1895, 1895,
+ /* 370 */ 1895, 1895, 2222, 2221, 2354, 1895, 1895, 2355, 2353, 2352,
+ /* 380 */ 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895,
+ /* 390 */ 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895,
+ /* 400 */ 1895, 1895, 1895, 1895, 1895, 2526, 2530, 1895, 1895, 1895,
+ /* 410 */ 1895, 1895, 1895, 2439, 1895, 1895, 1895, 2334, 1895, 1895,
+ /* 420 */ 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895,
+ /* 430 */ 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895,
+ /* 440 */ 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895,
+ /* 450 */ 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895,
+ /* 460 */ 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895,
+ /* 470 */ 1895, 1895, 2199, 1895, 1895, 1895, 1895, 1895, 1895, 1895,
+ /* 480 */ 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895,
+ /* 490 */ 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895,
+ /* 500 */ 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895,
+ /* 510 */ 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895,
+ /* 520 */ 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895,
+ /* 530 */ 1895, 1895, 1895, 1895, 2214, 1895, 1895, 1895, 1895, 1895,
+ /* 540 */ 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895,
+ /* 550 */ 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895,
+ /* 560 */ 1895, 1895, 1895, 1895, 1895, 1895, 1939, 2341, 1895, 1895,
+ /* 570 */ 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895,
+ /* 580 */ 1895, 2344, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895,
+ /* 590 */ 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895,
+ /* 600 */ 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895,
+ /* 610 */ 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895,
+ /* 620 */ 1895, 1895, 2034, 2033, 1895, 1895, 1895, 1895, 1895, 1895,
+ /* 630 */ 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895,
+ /* 640 */ 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895,
+ /* 650 */ 2345, 1895, 1895, 1895, 1895, 1895, 2336, 1895, 1895, 1895,
+ /* 660 */ 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895,
+ /* 670 */ 1895, 1895, 1895, 2522, 2476, 1895, 1895, 1895, 1895, 1895,
+ /* 680 */ 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895,
+ /* 690 */ 1895, 1895, 1895, 2334, 1895, 2504, 1895, 1895, 2520, 1895,
+ /* 700 */ 2524, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 2449, 2445,
+ /* 710 */ 1895, 1895, 2441, 1895, 1895, 1895, 1895, 1895, 1895, 1895,
+ /* 720 */ 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895,
+ /* 730 */ 2333, 1895, 2400, 1895, 1895, 1895, 2434, 1895, 1895, 2385,
+ /* 740 */ 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 2345,
+ /* 750 */ 1895, 2348, 1895, 1895, 1895, 1895, 1895, 2114, 1895, 1895,
+ /* 760 */ 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895,
+ /* 770 */ 1895, 1895, 1895, 2098, 2096, 2095, 2094, 1895, 2127, 1895,
+ /* 780 */ 1895, 1895, 2123, 2122, 1895, 1895, 1895, 1895, 1895, 1895,
+ /* 790 */ 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895,
+ /* 800 */ 2013, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 2005,
+ /* 810 */ 1895, 2004, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895,
+ /* 820 */ 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895,
+ /* 830 */ 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1924,
+ /* 840 */ 1895, 1895, 1895, 1895, 1895, 1895,
};
/********** End of lemon-generated parsing tables *****************************/
@@ -1513,6 +1170,7 @@ static const YYCODETYPE yyFallback[] = {
0, /* NK_IPTOKEN => nothing */
0, /* FORCE => nothing */
0, /* UNSAFE => nothing */
+ 0, /* CLUSTER => nothing */
0, /* LOCAL => nothing */
0, /* QNODE => nothing */
0, /* BNODE => nothing */
@@ -1559,7 +1217,7 @@ static const YYCODETYPE yyFallback[] = {
0, /* BWLIMIT => nothing */
0, /* START => nothing */
0, /* TIMESTAMP => nothing */
- 297, /* END => ABORT */
+ 300, /* END => ABORT */
0, /* TABLE => nothing */
0, /* NK_LP => nothing */
0, /* NK_RP => nothing */
@@ -1613,11 +1271,13 @@ static const YYCODETYPE yyFallback[] = {
0, /* CONNECTIONS => nothing */
0, /* LICENCES => nothing */
0, /* GRANTS => nothing */
+ 0, /* FULL => nothing */
+ 0, /* LOGS => nothing */
+ 0, /* MACHINES => nothing */
0, /* QUERIES => nothing */
0, /* SCORES => nothing */
0, /* TOPICS => nothing */
0, /* VARIABLES => nothing */
- 0, /* CLUSTER => nothing */
0, /* BNODES => nothing */
0, /* SNODES => nothing */
0, /* TRANSACTIONS => nothing */
@@ -1627,7 +1287,7 @@ static const YYCODETYPE yyFallback[] = {
0, /* VNODES => nothing */
0, /* ALIVE => nothing */
0, /* VIEWS => nothing */
- 297, /* VIEW => ABORT */
+ 300, /* VIEW => ABORT */
0, /* COMPACTS => nothing */
0, /* NORMAL => nothing */
0, /* CHILD => nothing */
@@ -1753,55 +1413,55 @@ static const YYCODETYPE yyFallback[] = {
0, /* ASC => nothing */
0, /* NULLS => nothing */
0, /* ABORT => nothing */
- 297, /* AFTER => ABORT */
- 297, /* ATTACH => ABORT */
- 297, /* BEFORE => ABORT */
- 297, /* BEGIN => ABORT */
- 297, /* BITAND => ABORT */
- 297, /* BITNOT => ABORT */
- 297, /* BITOR => ABORT */
- 297, /* BLOCKS => ABORT */
- 297, /* CHANGE => ABORT */
- 297, /* COMMA => ABORT */
- 297, /* CONCAT => ABORT */
- 297, /* CONFLICT => ABORT */
- 297, /* COPY => ABORT */
- 297, /* DEFERRED => ABORT */
- 297, /* DELIMITERS => ABORT */
- 297, /* DETACH => ABORT */
- 297, /* DIVIDE => ABORT */
- 297, /* DOT => ABORT */
- 297, /* EACH => ABORT */
- 297, /* FAIL => ABORT */
- 297, /* FILE => ABORT */
- 297, /* FOR => ABORT */
- 297, /* GLOB => ABORT */
- 297, /* ID => ABORT */
- 297, /* IMMEDIATE => ABORT */
- 297, /* IMPORT => ABORT */
- 297, /* INITIALLY => ABORT */
- 297, /* INSTEAD => ABORT */
- 297, /* ISNULL => ABORT */
- 297, /* KEY => ABORT */
- 297, /* MODULES => ABORT */
- 297, /* NK_BITNOT => ABORT */
- 297, /* NK_SEMI => ABORT */
- 297, /* NOTNULL => ABORT */
- 297, /* OF => ABORT */
- 297, /* PLUS => ABORT */
- 297, /* PRIVILEGE => ABORT */
- 297, /* RAISE => ABORT */
- 297, /* RESTRICT => ABORT */
- 297, /* ROW => ABORT */
- 297, /* SEMI => ABORT */
- 297, /* STAR => ABORT */
- 297, /* STATEMENT => ABORT */
- 297, /* STRICT => ABORT */
- 297, /* STRING => ABORT */
- 297, /* TIMES => ABORT */
- 297, /* VALUES => ABORT */
- 297, /* VARIABLE => ABORT */
- 297, /* WAL => ABORT */
+ 300, /* AFTER => ABORT */
+ 300, /* ATTACH => ABORT */
+ 300, /* BEFORE => ABORT */
+ 300, /* BEGIN => ABORT */
+ 300, /* BITAND => ABORT */
+ 300, /* BITNOT => ABORT */
+ 300, /* BITOR => ABORT */
+ 300, /* BLOCKS => ABORT */
+ 300, /* CHANGE => ABORT */
+ 300, /* COMMA => ABORT */
+ 300, /* CONCAT => ABORT */
+ 300, /* CONFLICT => ABORT */
+ 300, /* COPY => ABORT */
+ 300, /* DEFERRED => ABORT */
+ 300, /* DELIMITERS => ABORT */
+ 300, /* DETACH => ABORT */
+ 300, /* DIVIDE => ABORT */
+ 300, /* DOT => ABORT */
+ 300, /* EACH => ABORT */
+ 300, /* FAIL => ABORT */
+ 300, /* FILE => ABORT */
+ 300, /* FOR => ABORT */
+ 300, /* GLOB => ABORT */
+ 300, /* ID => ABORT */
+ 300, /* IMMEDIATE => ABORT */
+ 300, /* IMPORT => ABORT */
+ 300, /* INITIALLY => ABORT */
+ 300, /* INSTEAD => ABORT */
+ 300, /* ISNULL => ABORT */
+ 300, /* KEY => ABORT */
+ 300, /* MODULES => ABORT */
+ 300, /* NK_BITNOT => ABORT */
+ 300, /* NK_SEMI => ABORT */
+ 300, /* NOTNULL => ABORT */
+ 300, /* OF => ABORT */
+ 300, /* PLUS => ABORT */
+ 300, /* PRIVILEGE => ABORT */
+ 300, /* RAISE => ABORT */
+ 300, /* RESTRICT => ABORT */
+ 300, /* ROW => ABORT */
+ 300, /* SEMI => ABORT */
+ 300, /* STAR => ABORT */
+ 300, /* STATEMENT => ABORT */
+ 300, /* STRICT => ABORT */
+ 300, /* STRING => ABORT */
+ 300, /* TIMES => ABORT */
+ 300, /* VALUES => ABORT */
+ 300, /* VARIABLE => ABORT */
+ 300, /* WAL => ABORT */
};
#endif /* YYFALLBACK */
@@ -1853,7 +1513,6 @@ struct yyParser {
};
typedef struct yyParser yyParser;
-#include
#ifndef NDEBUG
#include
static FILE *yyTraceFILE = 0;
@@ -1948,456 +1607,459 @@ static const char *const yyTokenName[] = {
/* 55 */ "NK_IPTOKEN",
/* 56 */ "FORCE",
/* 57 */ "UNSAFE",
- /* 58 */ "LOCAL",
- /* 59 */ "QNODE",
- /* 60 */ "BNODE",
- /* 61 */ "SNODE",
- /* 62 */ "MNODE",
- /* 63 */ "VNODE",
- /* 64 */ "DATABASE",
- /* 65 */ "USE",
- /* 66 */ "FLUSH",
- /* 67 */ "TRIM",
- /* 68 */ "COMPACT",
- /* 69 */ "IF",
- /* 70 */ "NOT",
- /* 71 */ "EXISTS",
- /* 72 */ "BUFFER",
- /* 73 */ "CACHEMODEL",
- /* 74 */ "CACHESIZE",
- /* 75 */ "COMP",
- /* 76 */ "DURATION",
- /* 77 */ "NK_VARIABLE",
- /* 78 */ "MAXROWS",
- /* 79 */ "MINROWS",
- /* 80 */ "KEEP",
- /* 81 */ "PAGES",
- /* 82 */ "PAGESIZE",
- /* 83 */ "TSDB_PAGESIZE",
- /* 84 */ "PRECISION",
- /* 85 */ "REPLICA",
- /* 86 */ "VGROUPS",
- /* 87 */ "SINGLE_STABLE",
- /* 88 */ "RETENTIONS",
- /* 89 */ "SCHEMALESS",
- /* 90 */ "WAL_LEVEL",
- /* 91 */ "WAL_FSYNC_PERIOD",
- /* 92 */ "WAL_RETENTION_PERIOD",
- /* 93 */ "WAL_RETENTION_SIZE",
- /* 94 */ "WAL_ROLL_PERIOD",
- /* 95 */ "WAL_SEGMENT_SIZE",
- /* 96 */ "STT_TRIGGER",
- /* 97 */ "TABLE_PREFIX",
- /* 98 */ "TABLE_SUFFIX",
- /* 99 */ "KEEP_TIME_OFFSET",
- /* 100 */ "NK_COLON",
- /* 101 */ "BWLIMIT",
- /* 102 */ "START",
- /* 103 */ "TIMESTAMP",
- /* 104 */ "END",
- /* 105 */ "TABLE",
- /* 106 */ "NK_LP",
- /* 107 */ "NK_RP",
- /* 108 */ "STABLE",
- /* 109 */ "COLUMN",
- /* 110 */ "MODIFY",
- /* 111 */ "RENAME",
- /* 112 */ "TAG",
- /* 113 */ "SET",
- /* 114 */ "NK_EQ",
- /* 115 */ "USING",
- /* 116 */ "TAGS",
- /* 117 */ "BOOL",
- /* 118 */ "TINYINT",
- /* 119 */ "SMALLINT",
- /* 120 */ "INT",
- /* 121 */ "INTEGER",
- /* 122 */ "BIGINT",
- /* 123 */ "FLOAT",
- /* 124 */ "DOUBLE",
- /* 125 */ "BINARY",
- /* 126 */ "NCHAR",
- /* 127 */ "UNSIGNED",
- /* 128 */ "JSON",
- /* 129 */ "VARCHAR",
- /* 130 */ "MEDIUMBLOB",
- /* 131 */ "BLOB",
- /* 132 */ "VARBINARY",
- /* 133 */ "GEOMETRY",
- /* 134 */ "DECIMAL",
- /* 135 */ "COMMENT",
- /* 136 */ "MAX_DELAY",
- /* 137 */ "WATERMARK",
- /* 138 */ "ROLLUP",
- /* 139 */ "TTL",
- /* 140 */ "SMA",
- /* 141 */ "DELETE_MARK",
- /* 142 */ "FIRST",
- /* 143 */ "LAST",
- /* 144 */ "SHOW",
- /* 145 */ "PRIVILEGES",
- /* 146 */ "DATABASES",
- /* 147 */ "TABLES",
- /* 148 */ "STABLES",
- /* 149 */ "MNODES",
- /* 150 */ "QNODES",
- /* 151 */ "FUNCTIONS",
- /* 152 */ "INDEXES",
- /* 153 */ "ACCOUNTS",
- /* 154 */ "APPS",
- /* 155 */ "CONNECTIONS",
- /* 156 */ "LICENCES",
- /* 157 */ "GRANTS",
- /* 158 */ "QUERIES",
- /* 159 */ "SCORES",
- /* 160 */ "TOPICS",
- /* 161 */ "VARIABLES",
- /* 162 */ "CLUSTER",
- /* 163 */ "BNODES",
- /* 164 */ "SNODES",
- /* 165 */ "TRANSACTIONS",
- /* 166 */ "DISTRIBUTED",
- /* 167 */ "CONSUMERS",
- /* 168 */ "SUBSCRIPTIONS",
- /* 169 */ "VNODES",
- /* 170 */ "ALIVE",
- /* 171 */ "VIEWS",
- /* 172 */ "VIEW",
- /* 173 */ "COMPACTS",
- /* 174 */ "NORMAL",
- /* 175 */ "CHILD",
- /* 176 */ "LIKE",
- /* 177 */ "TBNAME",
- /* 178 */ "QTAGS",
- /* 179 */ "AS",
- /* 180 */ "SYSTEM",
- /* 181 */ "INDEX",
- /* 182 */ "FUNCTION",
- /* 183 */ "INTERVAL",
- /* 184 */ "COUNT",
- /* 185 */ "LAST_ROW",
- /* 186 */ "META",
- /* 187 */ "ONLY",
- /* 188 */ "TOPIC",
- /* 189 */ "CONSUMER",
- /* 190 */ "GROUP",
- /* 191 */ "DESC",
- /* 192 */ "DESCRIBE",
- /* 193 */ "RESET",
- /* 194 */ "QUERY",
- /* 195 */ "CACHE",
- /* 196 */ "EXPLAIN",
- /* 197 */ "ANALYZE",
- /* 198 */ "VERBOSE",
- /* 199 */ "NK_BOOL",
- /* 200 */ "RATIO",
- /* 201 */ "NK_FLOAT",
- /* 202 */ "OUTPUTTYPE",
- /* 203 */ "AGGREGATE",
- /* 204 */ "BUFSIZE",
- /* 205 */ "LANGUAGE",
- /* 206 */ "REPLACE",
- /* 207 */ "STREAM",
- /* 208 */ "INTO",
- /* 209 */ "PAUSE",
- /* 210 */ "RESUME",
- /* 211 */ "TRIGGER",
- /* 212 */ "AT_ONCE",
- /* 213 */ "WINDOW_CLOSE",
- /* 214 */ "IGNORE",
- /* 215 */ "EXPIRED",
- /* 216 */ "FILL_HISTORY",
- /* 217 */ "UPDATE",
- /* 218 */ "SUBTABLE",
- /* 219 */ "UNTREATED",
- /* 220 */ "KILL",
- /* 221 */ "CONNECTION",
- /* 222 */ "TRANSACTION",
- /* 223 */ "BALANCE",
- /* 224 */ "VGROUP",
- /* 225 */ "LEADER",
- /* 226 */ "MERGE",
- /* 227 */ "REDISTRIBUTE",
- /* 228 */ "SPLIT",
- /* 229 */ "DELETE",
- /* 230 */ "INSERT",
- /* 231 */ "NULL",
- /* 232 */ "NK_QUESTION",
- /* 233 */ "NK_ALIAS",
- /* 234 */ "NK_ARROW",
- /* 235 */ "ROWTS",
- /* 236 */ "QSTART",
- /* 237 */ "QEND",
- /* 238 */ "QDURATION",
- /* 239 */ "WSTART",
- /* 240 */ "WEND",
- /* 241 */ "WDURATION",
- /* 242 */ "IROWTS",
- /* 243 */ "ISFILLED",
- /* 244 */ "CAST",
- /* 245 */ "NOW",
- /* 246 */ "TODAY",
- /* 247 */ "TIMEZONE",
- /* 248 */ "CLIENT_VERSION",
- /* 249 */ "SERVER_VERSION",
- /* 250 */ "SERVER_STATUS",
- /* 251 */ "CURRENT_USER",
- /* 252 */ "CASE",
- /* 253 */ "WHEN",
- /* 254 */ "THEN",
- /* 255 */ "ELSE",
- /* 256 */ "BETWEEN",
- /* 257 */ "IS",
- /* 258 */ "NK_LT",
- /* 259 */ "NK_GT",
- /* 260 */ "NK_LE",
- /* 261 */ "NK_GE",
- /* 262 */ "NK_NE",
- /* 263 */ "MATCH",
- /* 264 */ "NMATCH",
- /* 265 */ "CONTAINS",
- /* 266 */ "IN",
- /* 267 */ "JOIN",
- /* 268 */ "INNER",
- /* 269 */ "SELECT",
- /* 270 */ "NK_HINT",
- /* 271 */ "DISTINCT",
- /* 272 */ "WHERE",
- /* 273 */ "PARTITION",
- /* 274 */ "BY",
- /* 275 */ "SESSION",
- /* 276 */ "STATE_WINDOW",
- /* 277 */ "EVENT_WINDOW",
- /* 278 */ "SLIDING",
- /* 279 */ "FILL",
- /* 280 */ "VALUE",
- /* 281 */ "VALUE_F",
- /* 282 */ "NONE",
- /* 283 */ "PREV",
- /* 284 */ "NULL_F",
- /* 285 */ "LINEAR",
- /* 286 */ "NEXT",
- /* 287 */ "HAVING",
- /* 288 */ "RANGE",
- /* 289 */ "EVERY",
- /* 290 */ "ORDER",
- /* 291 */ "SLIMIT",
- /* 292 */ "SOFFSET",
- /* 293 */ "LIMIT",
- /* 294 */ "OFFSET",
- /* 295 */ "ASC",
- /* 296 */ "NULLS",
- /* 297 */ "ABORT",
- /* 298 */ "AFTER",
- /* 299 */ "ATTACH",
- /* 300 */ "BEFORE",
- /* 301 */ "BEGIN",
- /* 302 */ "BITAND",
- /* 303 */ "BITNOT",
- /* 304 */ "BITOR",
- /* 305 */ "BLOCKS",
- /* 306 */ "CHANGE",
- /* 307 */ "COMMA",
- /* 308 */ "CONCAT",
- /* 309 */ "CONFLICT",
- /* 310 */ "COPY",
- /* 311 */ "DEFERRED",
- /* 312 */ "DELIMITERS",
- /* 313 */ "DETACH",
- /* 314 */ "DIVIDE",
- /* 315 */ "DOT",
- /* 316 */ "EACH",
- /* 317 */ "FAIL",
- /* 318 */ "FILE",
- /* 319 */ "FOR",
- /* 320 */ "GLOB",
- /* 321 */ "ID",
- /* 322 */ "IMMEDIATE",
- /* 323 */ "IMPORT",
- /* 324 */ "INITIALLY",
- /* 325 */ "INSTEAD",
- /* 326 */ "ISNULL",
- /* 327 */ "KEY",
- /* 328 */ "MODULES",
- /* 329 */ "NK_BITNOT",
- /* 330 */ "NK_SEMI",
- /* 331 */ "NOTNULL",
- /* 332 */ "OF",
- /* 333 */ "PLUS",
- /* 334 */ "PRIVILEGE",
- /* 335 */ "RAISE",
- /* 336 */ "RESTRICT",
- /* 337 */ "ROW",
- /* 338 */ "SEMI",
- /* 339 */ "STAR",
- /* 340 */ "STATEMENT",
- /* 341 */ "STRICT",
- /* 342 */ "STRING",
- /* 343 */ "TIMES",
- /* 344 */ "VALUES",
- /* 345 */ "VARIABLE",
- /* 346 */ "WAL",
- /* 347 */ "cmd",
- /* 348 */ "account_options",
- /* 349 */ "alter_account_options",
- /* 350 */ "literal",
- /* 351 */ "alter_account_option",
- /* 352 */ "ip_range_list",
- /* 353 */ "white_list",
- /* 354 */ "white_list_opt",
- /* 355 */ "user_name",
- /* 356 */ "sysinfo_opt",
- /* 357 */ "privileges",
- /* 358 */ "priv_level",
- /* 359 */ "with_opt",
- /* 360 */ "priv_type_list",
- /* 361 */ "priv_type",
- /* 362 */ "db_name",
- /* 363 */ "table_name",
- /* 364 */ "topic_name",
- /* 365 */ "search_condition",
- /* 366 */ "dnode_endpoint",
- /* 367 */ "force_opt",
- /* 368 */ "unsafe_opt",
- /* 369 */ "not_exists_opt",
- /* 370 */ "db_options",
- /* 371 */ "exists_opt",
- /* 372 */ "alter_db_options",
- /* 373 */ "speed_opt",
- /* 374 */ "start_opt",
- /* 375 */ "end_opt",
- /* 376 */ "integer_list",
- /* 377 */ "variable_list",
- /* 378 */ "retention_list",
- /* 379 */ "signed",
- /* 380 */ "alter_db_option",
- /* 381 */ "retention",
- /* 382 */ "full_table_name",
- /* 383 */ "column_def_list",
- /* 384 */ "tags_def_opt",
- /* 385 */ "table_options",
- /* 386 */ "multi_create_clause",
- /* 387 */ "tags_def",
- /* 388 */ "multi_drop_clause",
- /* 389 */ "alter_table_clause",
- /* 390 */ "alter_table_options",
- /* 391 */ "column_name",
- /* 392 */ "type_name",
- /* 393 */ "signed_literal",
- /* 394 */ "create_subtable_clause",
- /* 395 */ "specific_cols_opt",
- /* 396 */ "expression_list",
- /* 397 */ "drop_table_clause",
- /* 398 */ "col_name_list",
- /* 399 */ "column_def",
- /* 400 */ "duration_list",
- /* 401 */ "rollup_func_list",
- /* 402 */ "alter_table_option",
- /* 403 */ "duration_literal",
- /* 404 */ "rollup_func_name",
- /* 405 */ "function_name",
- /* 406 */ "col_name",
- /* 407 */ "db_kind_opt",
- /* 408 */ "table_kind_db_name_cond_opt",
- /* 409 */ "like_pattern_opt",
- /* 410 */ "db_name_cond_opt",
- /* 411 */ "table_name_cond",
- /* 412 */ "from_db_opt",
- /* 413 */ "tag_list_opt",
- /* 414 */ "table_kind",
- /* 415 */ "tag_item",
- /* 416 */ "column_alias",
- /* 417 */ "index_options",
- /* 418 */ "full_index_name",
- /* 419 */ "index_name",
- /* 420 */ "func_list",
- /* 421 */ "sliding_opt",
- /* 422 */ "sma_stream_opt",
- /* 423 */ "func",
- /* 424 */ "sma_func_name",
- /* 425 */ "with_meta",
- /* 426 */ "query_or_subquery",
- /* 427 */ "where_clause_opt",
- /* 428 */ "cgroup_name",
- /* 429 */ "analyze_opt",
- /* 430 */ "explain_options",
- /* 431 */ "insert_query",
- /* 432 */ "or_replace_opt",
- /* 433 */ "agg_func_opt",
- /* 434 */ "bufsize_opt",
- /* 435 */ "language_opt",
- /* 436 */ "full_view_name",
- /* 437 */ "view_name",
- /* 438 */ "stream_name",
- /* 439 */ "stream_options",
- /* 440 */ "col_list_opt",
- /* 441 */ "tag_def_or_ref_opt",
- /* 442 */ "subtable_opt",
- /* 443 */ "ignore_opt",
- /* 444 */ "expression",
- /* 445 */ "on_vgroup_id",
- /* 446 */ "dnode_list",
- /* 447 */ "literal_func",
- /* 448 */ "literal_list",
- /* 449 */ "table_alias",
- /* 450 */ "expr_or_subquery",
- /* 451 */ "pseudo_column",
- /* 452 */ "column_reference",
- /* 453 */ "function_expression",
- /* 454 */ "case_when_expression",
- /* 455 */ "star_func",
- /* 456 */ "star_func_para_list",
- /* 457 */ "noarg_func",
- /* 458 */ "other_para_list",
- /* 459 */ "star_func_para",
- /* 460 */ "when_then_list",
- /* 461 */ "case_when_else_opt",
- /* 462 */ "common_expression",
- /* 463 */ "when_then_expr",
- /* 464 */ "predicate",
- /* 465 */ "compare_op",
- /* 466 */ "in_op",
- /* 467 */ "in_predicate_value",
- /* 468 */ "boolean_value_expression",
- /* 469 */ "boolean_primary",
- /* 470 */ "from_clause_opt",
- /* 471 */ "table_reference_list",
- /* 472 */ "table_reference",
- /* 473 */ "table_primary",
- /* 474 */ "joined_table",
- /* 475 */ "alias_opt",
- /* 476 */ "subquery",
- /* 477 */ "parenthesized_joined_table",
- /* 478 */ "join_type",
- /* 479 */ "query_specification",
- /* 480 */ "hint_list",
- /* 481 */ "set_quantifier_opt",
- /* 482 */ "tag_mode_opt",
- /* 483 */ "select_list",
- /* 484 */ "partition_by_clause_opt",
- /* 485 */ "range_opt",
- /* 486 */ "every_opt",
- /* 487 */ "fill_opt",
- /* 488 */ "twindow_clause_opt",
- /* 489 */ "group_by_clause_opt",
- /* 490 */ "having_clause_opt",
- /* 491 */ "select_item",
- /* 492 */ "partition_list",
- /* 493 */ "partition_item",
- /* 494 */ "interval_sliding_duration_literal",
- /* 495 */ "fill_mode",
- /* 496 */ "group_by_list",
- /* 497 */ "query_expression",
- /* 498 */ "query_simple",
- /* 499 */ "order_by_clause_opt",
- /* 500 */ "slimit_clause_opt",
- /* 501 */ "limit_clause_opt",
- /* 502 */ "union_query_expression",
- /* 503 */ "query_simple_or_subquery",
- /* 504 */ "sort_specification_list",
- /* 505 */ "sort_specification",
- /* 506 */ "ordering_specification_opt",
- /* 507 */ "null_ordering_opt",
+ /* 58 */ "CLUSTER",
+ /* 59 */ "LOCAL",
+ /* 60 */ "QNODE",
+ /* 61 */ "BNODE",
+ /* 62 */ "SNODE",
+ /* 63 */ "MNODE",
+ /* 64 */ "VNODE",
+ /* 65 */ "DATABASE",
+ /* 66 */ "USE",
+ /* 67 */ "FLUSH",
+ /* 68 */ "TRIM",
+ /* 69 */ "COMPACT",
+ /* 70 */ "IF",
+ /* 71 */ "NOT",
+ /* 72 */ "EXISTS",
+ /* 73 */ "BUFFER",
+ /* 74 */ "CACHEMODEL",
+ /* 75 */ "CACHESIZE",
+ /* 76 */ "COMP",
+ /* 77 */ "DURATION",
+ /* 78 */ "NK_VARIABLE",
+ /* 79 */ "MAXROWS",
+ /* 80 */ "MINROWS",
+ /* 81 */ "KEEP",
+ /* 82 */ "PAGES",
+ /* 83 */ "PAGESIZE",
+ /* 84 */ "TSDB_PAGESIZE",
+ /* 85 */ "PRECISION",
+ /* 86 */ "REPLICA",
+ /* 87 */ "VGROUPS",
+ /* 88 */ "SINGLE_STABLE",
+ /* 89 */ "RETENTIONS",
+ /* 90 */ "SCHEMALESS",
+ /* 91 */ "WAL_LEVEL",
+ /* 92 */ "WAL_FSYNC_PERIOD",
+ /* 93 */ "WAL_RETENTION_PERIOD",
+ /* 94 */ "WAL_RETENTION_SIZE",
+ /* 95 */ "WAL_ROLL_PERIOD",
+ /* 96 */ "WAL_SEGMENT_SIZE",
+ /* 97 */ "STT_TRIGGER",
+ /* 98 */ "TABLE_PREFIX",
+ /* 99 */ "TABLE_SUFFIX",
+ /* 100 */ "KEEP_TIME_OFFSET",
+ /* 101 */ "NK_COLON",
+ /* 102 */ "BWLIMIT",
+ /* 103 */ "START",
+ /* 104 */ "TIMESTAMP",
+ /* 105 */ "END",
+ /* 106 */ "TABLE",
+ /* 107 */ "NK_LP",
+ /* 108 */ "NK_RP",
+ /* 109 */ "STABLE",
+ /* 110 */ "COLUMN",
+ /* 111 */ "MODIFY",
+ /* 112 */ "RENAME",
+ /* 113 */ "TAG",
+ /* 114 */ "SET",
+ /* 115 */ "NK_EQ",
+ /* 116 */ "USING",
+ /* 117 */ "TAGS",
+ /* 118 */ "BOOL",
+ /* 119 */ "TINYINT",
+ /* 120 */ "SMALLINT",
+ /* 121 */ "INT",
+ /* 122 */ "INTEGER",
+ /* 123 */ "BIGINT",
+ /* 124 */ "FLOAT",
+ /* 125 */ "DOUBLE",
+ /* 126 */ "BINARY",
+ /* 127 */ "NCHAR",
+ /* 128 */ "UNSIGNED",
+ /* 129 */ "JSON",
+ /* 130 */ "VARCHAR",
+ /* 131 */ "MEDIUMBLOB",
+ /* 132 */ "BLOB",
+ /* 133 */ "VARBINARY",
+ /* 134 */ "GEOMETRY",
+ /* 135 */ "DECIMAL",
+ /* 136 */ "COMMENT",
+ /* 137 */ "MAX_DELAY",
+ /* 138 */ "WATERMARK",
+ /* 139 */ "ROLLUP",
+ /* 140 */ "TTL",
+ /* 141 */ "SMA",
+ /* 142 */ "DELETE_MARK",
+ /* 143 */ "FIRST",
+ /* 144 */ "LAST",
+ /* 145 */ "SHOW",
+ /* 146 */ "PRIVILEGES",
+ /* 147 */ "DATABASES",
+ /* 148 */ "TABLES",
+ /* 149 */ "STABLES",
+ /* 150 */ "MNODES",
+ /* 151 */ "QNODES",
+ /* 152 */ "FUNCTIONS",
+ /* 153 */ "INDEXES",
+ /* 154 */ "ACCOUNTS",
+ /* 155 */ "APPS",
+ /* 156 */ "CONNECTIONS",
+ /* 157 */ "LICENCES",
+ /* 158 */ "GRANTS",
+ /* 159 */ "FULL",
+ /* 160 */ "LOGS",
+ /* 161 */ "MACHINES",
+ /* 162 */ "QUERIES",
+ /* 163 */ "SCORES",
+ /* 164 */ "TOPICS",
+ /* 165 */ "VARIABLES",
+ /* 166 */ "BNODES",
+ /* 167 */ "SNODES",
+ /* 168 */ "TRANSACTIONS",
+ /* 169 */ "DISTRIBUTED",
+ /* 170 */ "CONSUMERS",
+ /* 171 */ "SUBSCRIPTIONS",
+ /* 172 */ "VNODES",
+ /* 173 */ "ALIVE",
+ /* 174 */ "VIEWS",
+ /* 175 */ "VIEW",
+ /* 176 */ "COMPACTS",
+ /* 177 */ "NORMAL",
+ /* 178 */ "CHILD",
+ /* 179 */ "LIKE",
+ /* 180 */ "TBNAME",
+ /* 181 */ "QTAGS",
+ /* 182 */ "AS",
+ /* 183 */ "SYSTEM",
+ /* 184 */ "INDEX",
+ /* 185 */ "FUNCTION",
+ /* 186 */ "INTERVAL",
+ /* 187 */ "COUNT",
+ /* 188 */ "LAST_ROW",
+ /* 189 */ "META",
+ /* 190 */ "ONLY",
+ /* 191 */ "TOPIC",
+ /* 192 */ "CONSUMER",
+ /* 193 */ "GROUP",
+ /* 194 */ "DESC",
+ /* 195 */ "DESCRIBE",
+ /* 196 */ "RESET",
+ /* 197 */ "QUERY",
+ /* 198 */ "CACHE",
+ /* 199 */ "EXPLAIN",
+ /* 200 */ "ANALYZE",
+ /* 201 */ "VERBOSE",
+ /* 202 */ "NK_BOOL",
+ /* 203 */ "RATIO",
+ /* 204 */ "NK_FLOAT",
+ /* 205 */ "OUTPUTTYPE",
+ /* 206 */ "AGGREGATE",
+ /* 207 */ "BUFSIZE",
+ /* 208 */ "LANGUAGE",
+ /* 209 */ "REPLACE",
+ /* 210 */ "STREAM",
+ /* 211 */ "INTO",
+ /* 212 */ "PAUSE",
+ /* 213 */ "RESUME",
+ /* 214 */ "TRIGGER",
+ /* 215 */ "AT_ONCE",
+ /* 216 */ "WINDOW_CLOSE",
+ /* 217 */ "IGNORE",
+ /* 218 */ "EXPIRED",
+ /* 219 */ "FILL_HISTORY",
+ /* 220 */ "UPDATE",
+ /* 221 */ "SUBTABLE",
+ /* 222 */ "UNTREATED",
+ /* 223 */ "KILL",
+ /* 224 */ "CONNECTION",
+ /* 225 */ "TRANSACTION",
+ /* 226 */ "BALANCE",
+ /* 227 */ "VGROUP",
+ /* 228 */ "LEADER",
+ /* 229 */ "MERGE",
+ /* 230 */ "REDISTRIBUTE",
+ /* 231 */ "SPLIT",
+ /* 232 */ "DELETE",
+ /* 233 */ "INSERT",
+ /* 234 */ "NULL",
+ /* 235 */ "NK_QUESTION",
+ /* 236 */ "NK_ALIAS",
+ /* 237 */ "NK_ARROW",
+ /* 238 */ "ROWTS",
+ /* 239 */ "QSTART",
+ /* 240 */ "QEND",
+ /* 241 */ "QDURATION",
+ /* 242 */ "WSTART",
+ /* 243 */ "WEND",
+ /* 244 */ "WDURATION",
+ /* 245 */ "IROWTS",
+ /* 246 */ "ISFILLED",
+ /* 247 */ "CAST",
+ /* 248 */ "NOW",
+ /* 249 */ "TODAY",
+ /* 250 */ "TIMEZONE",
+ /* 251 */ "CLIENT_VERSION",
+ /* 252 */ "SERVER_VERSION",
+ /* 253 */ "SERVER_STATUS",
+ /* 254 */ "CURRENT_USER",
+ /* 255 */ "CASE",
+ /* 256 */ "WHEN",
+ /* 257 */ "THEN",
+ /* 258 */ "ELSE",
+ /* 259 */ "BETWEEN",
+ /* 260 */ "IS",
+ /* 261 */ "NK_LT",
+ /* 262 */ "NK_GT",
+ /* 263 */ "NK_LE",
+ /* 264 */ "NK_GE",
+ /* 265 */ "NK_NE",
+ /* 266 */ "MATCH",
+ /* 267 */ "NMATCH",
+ /* 268 */ "CONTAINS",
+ /* 269 */ "IN",
+ /* 270 */ "JOIN",
+ /* 271 */ "INNER",
+ /* 272 */ "SELECT",
+ /* 273 */ "NK_HINT",
+ /* 274 */ "DISTINCT",
+ /* 275 */ "WHERE",
+ /* 276 */ "PARTITION",
+ /* 277 */ "BY",
+ /* 278 */ "SESSION",
+ /* 279 */ "STATE_WINDOW",
+ /* 280 */ "EVENT_WINDOW",
+ /* 281 */ "SLIDING",
+ /* 282 */ "FILL",
+ /* 283 */ "VALUE",
+ /* 284 */ "VALUE_F",
+ /* 285 */ "NONE",
+ /* 286 */ "PREV",
+ /* 287 */ "NULL_F",
+ /* 288 */ "LINEAR",
+ /* 289 */ "NEXT",
+ /* 290 */ "HAVING",
+ /* 291 */ "RANGE",
+ /* 292 */ "EVERY",
+ /* 293 */ "ORDER",
+ /* 294 */ "SLIMIT",
+ /* 295 */ "SOFFSET",
+ /* 296 */ "LIMIT",
+ /* 297 */ "OFFSET",
+ /* 298 */ "ASC",
+ /* 299 */ "NULLS",
+ /* 300 */ "ABORT",
+ /* 301 */ "AFTER",
+ /* 302 */ "ATTACH",
+ /* 303 */ "BEFORE",
+ /* 304 */ "BEGIN",
+ /* 305 */ "BITAND",
+ /* 306 */ "BITNOT",
+ /* 307 */ "BITOR",
+ /* 308 */ "BLOCKS",
+ /* 309 */ "CHANGE",
+ /* 310 */ "COMMA",
+ /* 311 */ "CONCAT",
+ /* 312 */ "CONFLICT",
+ /* 313 */ "COPY",
+ /* 314 */ "DEFERRED",
+ /* 315 */ "DELIMITERS",
+ /* 316 */ "DETACH",
+ /* 317 */ "DIVIDE",
+ /* 318 */ "DOT",
+ /* 319 */ "EACH",
+ /* 320 */ "FAIL",
+ /* 321 */ "FILE",
+ /* 322 */ "FOR",
+ /* 323 */ "GLOB",
+ /* 324 */ "ID",
+ /* 325 */ "IMMEDIATE",
+ /* 326 */ "IMPORT",
+ /* 327 */ "INITIALLY",
+ /* 328 */ "INSTEAD",
+ /* 329 */ "ISNULL",
+ /* 330 */ "KEY",
+ /* 331 */ "MODULES",
+ /* 332 */ "NK_BITNOT",
+ /* 333 */ "NK_SEMI",
+ /* 334 */ "NOTNULL",
+ /* 335 */ "OF",
+ /* 336 */ "PLUS",
+ /* 337 */ "PRIVILEGE",
+ /* 338 */ "RAISE",
+ /* 339 */ "RESTRICT",
+ /* 340 */ "ROW",
+ /* 341 */ "SEMI",
+ /* 342 */ "STAR",
+ /* 343 */ "STATEMENT",
+ /* 344 */ "STRICT",
+ /* 345 */ "STRING",
+ /* 346 */ "TIMES",
+ /* 347 */ "VALUES",
+ /* 348 */ "VARIABLE",
+ /* 349 */ "WAL",
+ /* 350 */ "cmd",
+ /* 351 */ "account_options",
+ /* 352 */ "alter_account_options",
+ /* 353 */ "literal",
+ /* 354 */ "alter_account_option",
+ /* 355 */ "ip_range_list",
+ /* 356 */ "white_list",
+ /* 357 */ "white_list_opt",
+ /* 358 */ "user_name",
+ /* 359 */ "sysinfo_opt",
+ /* 360 */ "privileges",
+ /* 361 */ "priv_level",
+ /* 362 */ "with_opt",
+ /* 363 */ "priv_type_list",
+ /* 364 */ "priv_type",
+ /* 365 */ "db_name",
+ /* 366 */ "table_name",
+ /* 367 */ "topic_name",
+ /* 368 */ "search_condition",
+ /* 369 */ "dnode_endpoint",
+ /* 370 */ "force_opt",
+ /* 371 */ "unsafe_opt",
+ /* 372 */ "not_exists_opt",
+ /* 373 */ "db_options",
+ /* 374 */ "exists_opt",
+ /* 375 */ "alter_db_options",
+ /* 376 */ "speed_opt",
+ /* 377 */ "start_opt",
+ /* 378 */ "end_opt",
+ /* 379 */ "integer_list",
+ /* 380 */ "variable_list",
+ /* 381 */ "retention_list",
+ /* 382 */ "signed",
+ /* 383 */ "alter_db_option",
+ /* 384 */ "retention",
+ /* 385 */ "full_table_name",
+ /* 386 */ "column_def_list",
+ /* 387 */ "tags_def_opt",
+ /* 388 */ "table_options",
+ /* 389 */ "multi_create_clause",
+ /* 390 */ "tags_def",
+ /* 391 */ "multi_drop_clause",
+ /* 392 */ "alter_table_clause",
+ /* 393 */ "alter_table_options",
+ /* 394 */ "column_name",
+ /* 395 */ "type_name",
+ /* 396 */ "signed_literal",
+ /* 397 */ "create_subtable_clause",
+ /* 398 */ "specific_cols_opt",
+ /* 399 */ "expression_list",
+ /* 400 */ "drop_table_clause",
+ /* 401 */ "col_name_list",
+ /* 402 */ "column_def",
+ /* 403 */ "duration_list",
+ /* 404 */ "rollup_func_list",
+ /* 405 */ "alter_table_option",
+ /* 406 */ "duration_literal",
+ /* 407 */ "rollup_func_name",
+ /* 408 */ "function_name",
+ /* 409 */ "col_name",
+ /* 410 */ "db_kind_opt",
+ /* 411 */ "table_kind_db_name_cond_opt",
+ /* 412 */ "like_pattern_opt",
+ /* 413 */ "db_name_cond_opt",
+ /* 414 */ "table_name_cond",
+ /* 415 */ "from_db_opt",
+ /* 416 */ "tag_list_opt",
+ /* 417 */ "table_kind",
+ /* 418 */ "tag_item",
+ /* 419 */ "column_alias",
+ /* 420 */ "index_options",
+ /* 421 */ "full_index_name",
+ /* 422 */ "index_name",
+ /* 423 */ "func_list",
+ /* 424 */ "sliding_opt",
+ /* 425 */ "sma_stream_opt",
+ /* 426 */ "func",
+ /* 427 */ "sma_func_name",
+ /* 428 */ "with_meta",
+ /* 429 */ "query_or_subquery",
+ /* 430 */ "where_clause_opt",
+ /* 431 */ "cgroup_name",
+ /* 432 */ "analyze_opt",
+ /* 433 */ "explain_options",
+ /* 434 */ "insert_query",
+ /* 435 */ "or_replace_opt",
+ /* 436 */ "agg_func_opt",
+ /* 437 */ "bufsize_opt",
+ /* 438 */ "language_opt",
+ /* 439 */ "full_view_name",
+ /* 440 */ "view_name",
+ /* 441 */ "stream_name",
+ /* 442 */ "stream_options",
+ /* 443 */ "col_list_opt",
+ /* 444 */ "tag_def_or_ref_opt",
+ /* 445 */ "subtable_opt",
+ /* 446 */ "ignore_opt",
+ /* 447 */ "expression",
+ /* 448 */ "on_vgroup_id",
+ /* 449 */ "dnode_list",
+ /* 450 */ "literal_func",
+ /* 451 */ "literal_list",
+ /* 452 */ "table_alias",
+ /* 453 */ "expr_or_subquery",
+ /* 454 */ "pseudo_column",
+ /* 455 */ "column_reference",
+ /* 456 */ "function_expression",
+ /* 457 */ "case_when_expression",
+ /* 458 */ "star_func",
+ /* 459 */ "star_func_para_list",
+ /* 460 */ "noarg_func",
+ /* 461 */ "other_para_list",
+ /* 462 */ "star_func_para",
+ /* 463 */ "when_then_list",
+ /* 464 */ "case_when_else_opt",
+ /* 465 */ "common_expression",
+ /* 466 */ "when_then_expr",
+ /* 467 */ "predicate",
+ /* 468 */ "compare_op",
+ /* 469 */ "in_op",
+ /* 470 */ "in_predicate_value",
+ /* 471 */ "boolean_value_expression",
+ /* 472 */ "boolean_primary",
+ /* 473 */ "from_clause_opt",
+ /* 474 */ "table_reference_list",
+ /* 475 */ "table_reference",
+ /* 476 */ "table_primary",
+ /* 477 */ "joined_table",
+ /* 478 */ "alias_opt",
+ /* 479 */ "subquery",
+ /* 480 */ "parenthesized_joined_table",
+ /* 481 */ "join_type",
+ /* 482 */ "query_specification",
+ /* 483 */ "hint_list",
+ /* 484 */ "set_quantifier_opt",
+ /* 485 */ "tag_mode_opt",
+ /* 486 */ "select_list",
+ /* 487 */ "partition_by_clause_opt",
+ /* 488 */ "range_opt",
+ /* 489 */ "every_opt",
+ /* 490 */ "fill_opt",
+ /* 491 */ "twindow_clause_opt",
+ /* 492 */ "group_by_clause_opt",
+ /* 493 */ "having_clause_opt",
+ /* 494 */ "select_item",
+ /* 495 */ "partition_list",
+ /* 496 */ "partition_item",
+ /* 497 */ "interval_sliding_duration_literal",
+ /* 498 */ "fill_mode",
+ /* 499 */ "group_by_list",
+ /* 500 */ "query_expression",
+ /* 501 */ "query_simple",
+ /* 502 */ "order_by_clause_opt",
+ /* 503 */ "slimit_clause_opt",
+ /* 504 */ "limit_clause_opt",
+ /* 505 */ "union_query_expression",
+ /* 506 */ "query_simple_or_subquery",
+ /* 507 */ "sort_specification_list",
+ /* 508 */ "sort_specification",
+ /* 509 */ "ordering_specification_opt",
+ /* 510 */ "null_ordering_opt",
};
#endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */
@@ -2476,577 +2138,582 @@ static const char *const yyRuleName[] = {
/* 68 */ "force_opt ::=",
/* 69 */ "force_opt ::= FORCE",
/* 70 */ "unsafe_opt ::= UNSAFE",
- /* 71 */ "cmd ::= ALTER LOCAL NK_STRING",
- /* 72 */ "cmd ::= ALTER LOCAL NK_STRING NK_STRING",
- /* 73 */ "cmd ::= CREATE QNODE ON DNODE NK_INTEGER",
- /* 74 */ "cmd ::= DROP QNODE ON DNODE NK_INTEGER",
- /* 75 */ "cmd ::= RESTORE QNODE ON DNODE NK_INTEGER",
- /* 76 */ "cmd ::= CREATE BNODE ON DNODE NK_INTEGER",
- /* 77 */ "cmd ::= DROP BNODE ON DNODE NK_INTEGER",
- /* 78 */ "cmd ::= CREATE SNODE ON DNODE NK_INTEGER",
- /* 79 */ "cmd ::= DROP SNODE ON DNODE NK_INTEGER",
- /* 80 */ "cmd ::= CREATE MNODE ON DNODE NK_INTEGER",
- /* 81 */ "cmd ::= DROP MNODE ON DNODE NK_INTEGER",
- /* 82 */ "cmd ::= RESTORE MNODE ON DNODE NK_INTEGER",
- /* 83 */ "cmd ::= RESTORE VNODE ON DNODE NK_INTEGER",
- /* 84 */ "cmd ::= CREATE DATABASE not_exists_opt db_name db_options",
- /* 85 */ "cmd ::= DROP DATABASE exists_opt db_name",
- /* 86 */ "cmd ::= USE db_name",
- /* 87 */ "cmd ::= ALTER DATABASE db_name alter_db_options",
- /* 88 */ "cmd ::= FLUSH DATABASE db_name",
- /* 89 */ "cmd ::= TRIM DATABASE db_name speed_opt",
- /* 90 */ "cmd ::= COMPACT DATABASE db_name start_opt end_opt",
- /* 91 */ "not_exists_opt ::= IF NOT EXISTS",
- /* 92 */ "not_exists_opt ::=",
- /* 93 */ "exists_opt ::= IF EXISTS",
- /* 94 */ "exists_opt ::=",
- /* 95 */ "db_options ::=",
- /* 96 */ "db_options ::= db_options BUFFER NK_INTEGER",
- /* 97 */ "db_options ::= db_options CACHEMODEL NK_STRING",
- /* 98 */ "db_options ::= db_options CACHESIZE NK_INTEGER",
- /* 99 */ "db_options ::= db_options COMP NK_INTEGER",
- /* 100 */ "db_options ::= db_options DURATION NK_INTEGER",
- /* 101 */ "db_options ::= db_options DURATION NK_VARIABLE",
- /* 102 */ "db_options ::= db_options MAXROWS NK_INTEGER",
- /* 103 */ "db_options ::= db_options MINROWS NK_INTEGER",
- /* 104 */ "db_options ::= db_options KEEP integer_list",
- /* 105 */ "db_options ::= db_options KEEP variable_list",
- /* 106 */ "db_options ::= db_options PAGES NK_INTEGER",
- /* 107 */ "db_options ::= db_options PAGESIZE NK_INTEGER",
- /* 108 */ "db_options ::= db_options TSDB_PAGESIZE NK_INTEGER",
- /* 109 */ "db_options ::= db_options PRECISION NK_STRING",
- /* 110 */ "db_options ::= db_options REPLICA NK_INTEGER",
- /* 111 */ "db_options ::= db_options VGROUPS NK_INTEGER",
- /* 112 */ "db_options ::= db_options SINGLE_STABLE NK_INTEGER",
- /* 113 */ "db_options ::= db_options RETENTIONS retention_list",
- /* 114 */ "db_options ::= db_options SCHEMALESS NK_INTEGER",
- /* 115 */ "db_options ::= db_options WAL_LEVEL NK_INTEGER",
- /* 116 */ "db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER",
- /* 117 */ "db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER",
- /* 118 */ "db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER",
- /* 119 */ "db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER",
- /* 120 */ "db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER",
- /* 121 */ "db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER",
- /* 122 */ "db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER",
- /* 123 */ "db_options ::= db_options STT_TRIGGER NK_INTEGER",
- /* 124 */ "db_options ::= db_options TABLE_PREFIX signed",
- /* 125 */ "db_options ::= db_options TABLE_SUFFIX signed",
- /* 126 */ "db_options ::= db_options KEEP_TIME_OFFSET NK_INTEGER",
- /* 127 */ "alter_db_options ::= alter_db_option",
- /* 128 */ "alter_db_options ::= alter_db_options alter_db_option",
- /* 129 */ "alter_db_option ::= BUFFER NK_INTEGER",
- /* 130 */ "alter_db_option ::= CACHEMODEL NK_STRING",
- /* 131 */ "alter_db_option ::= CACHESIZE NK_INTEGER",
- /* 132 */ "alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER",
- /* 133 */ "alter_db_option ::= KEEP integer_list",
- /* 134 */ "alter_db_option ::= KEEP variable_list",
- /* 135 */ "alter_db_option ::= PAGES NK_INTEGER",
- /* 136 */ "alter_db_option ::= REPLICA NK_INTEGER",
- /* 137 */ "alter_db_option ::= WAL_LEVEL NK_INTEGER",
- /* 138 */ "alter_db_option ::= STT_TRIGGER NK_INTEGER",
- /* 139 */ "alter_db_option ::= MINROWS NK_INTEGER",
- /* 140 */ "alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER",
- /* 141 */ "alter_db_option ::= WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER",
- /* 142 */ "alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER",
- /* 143 */ "alter_db_option ::= WAL_RETENTION_SIZE NK_MINUS NK_INTEGER",
- /* 144 */ "alter_db_option ::= KEEP_TIME_OFFSET NK_INTEGER",
- /* 145 */ "integer_list ::= NK_INTEGER",
- /* 146 */ "integer_list ::= integer_list NK_COMMA NK_INTEGER",
- /* 147 */ "variable_list ::= NK_VARIABLE",
- /* 148 */ "variable_list ::= variable_list NK_COMMA NK_VARIABLE",
- /* 149 */ "retention_list ::= retention",
- /* 150 */ "retention_list ::= retention_list NK_COMMA retention",
- /* 151 */ "retention ::= NK_VARIABLE NK_COLON NK_VARIABLE",
- /* 152 */ "retention ::= NK_MINUS NK_COLON NK_VARIABLE",
- /* 153 */ "speed_opt ::=",
- /* 154 */ "speed_opt ::= BWLIMIT NK_INTEGER",
- /* 155 */ "start_opt ::=",
- /* 156 */ "start_opt ::= START WITH NK_INTEGER",
- /* 157 */ "start_opt ::= START WITH NK_STRING",
- /* 158 */ "start_opt ::= START WITH TIMESTAMP NK_STRING",
- /* 159 */ "end_opt ::=",
- /* 160 */ "end_opt ::= END WITH NK_INTEGER",
- /* 161 */ "end_opt ::= END WITH NK_STRING",
- /* 162 */ "end_opt ::= END WITH TIMESTAMP NK_STRING",
- /* 163 */ "cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options",
- /* 164 */ "cmd ::= CREATE TABLE multi_create_clause",
- /* 165 */ "cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options",
- /* 166 */ "cmd ::= DROP TABLE multi_drop_clause",
- /* 167 */ "cmd ::= DROP STABLE exists_opt full_table_name",
- /* 168 */ "cmd ::= ALTER TABLE alter_table_clause",
- /* 169 */ "cmd ::= ALTER STABLE alter_table_clause",
- /* 170 */ "alter_table_clause ::= full_table_name alter_table_options",
- /* 171 */ "alter_table_clause ::= full_table_name ADD COLUMN column_name type_name",
- /* 172 */ "alter_table_clause ::= full_table_name DROP COLUMN column_name",
- /* 173 */ "alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name",
- /* 174 */ "alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name",
- /* 175 */ "alter_table_clause ::= full_table_name ADD TAG column_name type_name",
- /* 176 */ "alter_table_clause ::= full_table_name DROP TAG column_name",
- /* 177 */ "alter_table_clause ::= full_table_name MODIFY TAG column_name type_name",
- /* 178 */ "alter_table_clause ::= full_table_name RENAME TAG column_name column_name",
- /* 179 */ "alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal",
- /* 180 */ "multi_create_clause ::= create_subtable_clause",
- /* 181 */ "multi_create_clause ::= multi_create_clause create_subtable_clause",
- /* 182 */ "create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP expression_list NK_RP table_options",
- /* 183 */ "multi_drop_clause ::= drop_table_clause",
- /* 184 */ "multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause",
- /* 185 */ "drop_table_clause ::= exists_opt full_table_name",
- /* 186 */ "specific_cols_opt ::=",
- /* 187 */ "specific_cols_opt ::= NK_LP col_name_list NK_RP",
- /* 188 */ "full_table_name ::= table_name",
- /* 189 */ "full_table_name ::= db_name NK_DOT table_name",
- /* 190 */ "column_def_list ::= column_def",
- /* 191 */ "column_def_list ::= column_def_list NK_COMMA column_def",
- /* 192 */ "column_def ::= column_name type_name",
- /* 193 */ "type_name ::= BOOL",
- /* 194 */ "type_name ::= TINYINT",
- /* 195 */ "type_name ::= SMALLINT",
- /* 196 */ "type_name ::= INT",
- /* 197 */ "type_name ::= INTEGER",
- /* 198 */ "type_name ::= BIGINT",
- /* 199 */ "type_name ::= FLOAT",
- /* 200 */ "type_name ::= DOUBLE",
- /* 201 */ "type_name ::= BINARY NK_LP NK_INTEGER NK_RP",
- /* 202 */ "type_name ::= TIMESTAMP",
- /* 203 */ "type_name ::= NCHAR NK_LP NK_INTEGER NK_RP",
- /* 204 */ "type_name ::= TINYINT UNSIGNED",
- /* 205 */ "type_name ::= SMALLINT UNSIGNED",
- /* 206 */ "type_name ::= INT UNSIGNED",
- /* 207 */ "type_name ::= BIGINT UNSIGNED",
- /* 208 */ "type_name ::= JSON",
- /* 209 */ "type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP",
- /* 210 */ "type_name ::= MEDIUMBLOB",
- /* 211 */ "type_name ::= BLOB",
- /* 212 */ "type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP",
- /* 213 */ "type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP",
- /* 214 */ "type_name ::= DECIMAL",
- /* 215 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP",
- /* 216 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP",
- /* 217 */ "tags_def_opt ::=",
- /* 218 */ "tags_def_opt ::= tags_def",
- /* 219 */ "tags_def ::= TAGS NK_LP column_def_list NK_RP",
- /* 220 */ "table_options ::=",
- /* 221 */ "table_options ::= table_options COMMENT NK_STRING",
- /* 222 */ "table_options ::= table_options MAX_DELAY duration_list",
- /* 223 */ "table_options ::= table_options WATERMARK duration_list",
- /* 224 */ "table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP",
- /* 225 */ "table_options ::= table_options TTL NK_INTEGER",
- /* 226 */ "table_options ::= table_options SMA NK_LP col_name_list NK_RP",
- /* 227 */ "table_options ::= table_options DELETE_MARK duration_list",
- /* 228 */ "alter_table_options ::= alter_table_option",
- /* 229 */ "alter_table_options ::= alter_table_options alter_table_option",
- /* 230 */ "alter_table_option ::= COMMENT NK_STRING",
- /* 231 */ "alter_table_option ::= TTL NK_INTEGER",
- /* 232 */ "duration_list ::= duration_literal",
- /* 233 */ "duration_list ::= duration_list NK_COMMA duration_literal",
- /* 234 */ "rollup_func_list ::= rollup_func_name",
- /* 235 */ "rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name",
- /* 236 */ "rollup_func_name ::= function_name",
- /* 237 */ "rollup_func_name ::= FIRST",
- /* 238 */ "rollup_func_name ::= LAST",
- /* 239 */ "col_name_list ::= col_name",
- /* 240 */ "col_name_list ::= col_name_list NK_COMMA col_name",
- /* 241 */ "col_name ::= column_name",
- /* 242 */ "cmd ::= SHOW DNODES",
- /* 243 */ "cmd ::= SHOW USERS",
- /* 244 */ "cmd ::= SHOW USER PRIVILEGES",
- /* 245 */ "cmd ::= SHOW db_kind_opt DATABASES",
- /* 246 */ "cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt",
- /* 247 */ "cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt",
- /* 248 */ "cmd ::= SHOW db_name_cond_opt VGROUPS",
- /* 249 */ "cmd ::= SHOW MNODES",
- /* 250 */ "cmd ::= SHOW QNODES",
- /* 251 */ "cmd ::= SHOW FUNCTIONS",
- /* 252 */ "cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt",
- /* 253 */ "cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name",
- /* 254 */ "cmd ::= SHOW STREAMS",
- /* 255 */ "cmd ::= SHOW ACCOUNTS",
- /* 256 */ "cmd ::= SHOW APPS",
- /* 257 */ "cmd ::= SHOW CONNECTIONS",
- /* 258 */ "cmd ::= SHOW LICENCES",
- /* 259 */ "cmd ::= SHOW GRANTS",
- /* 260 */ "cmd ::= SHOW CREATE DATABASE db_name",
- /* 261 */ "cmd ::= SHOW CREATE TABLE full_table_name",
- /* 262 */ "cmd ::= SHOW CREATE STABLE full_table_name",
- /* 263 */ "cmd ::= SHOW QUERIES",
- /* 264 */ "cmd ::= SHOW SCORES",
- /* 265 */ "cmd ::= SHOW TOPICS",
- /* 266 */ "cmd ::= SHOW VARIABLES",
- /* 267 */ "cmd ::= SHOW CLUSTER VARIABLES",
- /* 268 */ "cmd ::= SHOW LOCAL VARIABLES",
- /* 269 */ "cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt",
- /* 270 */ "cmd ::= SHOW BNODES",
- /* 271 */ "cmd ::= SHOW SNODES",
- /* 272 */ "cmd ::= SHOW CLUSTER",
- /* 273 */ "cmd ::= SHOW TRANSACTIONS",
- /* 274 */ "cmd ::= SHOW TABLE DISTRIBUTED full_table_name",
- /* 275 */ "cmd ::= SHOW CONSUMERS",
- /* 276 */ "cmd ::= SHOW SUBSCRIPTIONS",
- /* 277 */ "cmd ::= SHOW TAGS FROM table_name_cond from_db_opt",
- /* 278 */ "cmd ::= SHOW TAGS FROM db_name NK_DOT table_name",
- /* 279 */ "cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt",
- /* 280 */ "cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name",
- /* 281 */ "cmd ::= SHOW VNODES ON DNODE NK_INTEGER",
- /* 282 */ "cmd ::= SHOW VNODES",
- /* 283 */ "cmd ::= SHOW db_name_cond_opt ALIVE",
- /* 284 */ "cmd ::= SHOW CLUSTER ALIVE",
- /* 285 */ "cmd ::= SHOW db_name_cond_opt VIEWS",
- /* 286 */ "cmd ::= SHOW CREATE VIEW full_table_name",
- /* 287 */ "cmd ::= SHOW COMPACTS",
- /* 288 */ "cmd ::= SHOW COMPACT NK_INTEGER",
- /* 289 */ "table_kind_db_name_cond_opt ::=",
- /* 290 */ "table_kind_db_name_cond_opt ::= table_kind",
- /* 291 */ "table_kind_db_name_cond_opt ::= db_name NK_DOT",
- /* 292 */ "table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT",
- /* 293 */ "table_kind ::= NORMAL",
- /* 294 */ "table_kind ::= CHILD",
- /* 295 */ "db_name_cond_opt ::=",
- /* 296 */ "db_name_cond_opt ::= db_name NK_DOT",
- /* 297 */ "like_pattern_opt ::=",
- /* 298 */ "like_pattern_opt ::= LIKE NK_STRING",
- /* 299 */ "table_name_cond ::= table_name",
- /* 300 */ "from_db_opt ::=",
- /* 301 */ "from_db_opt ::= FROM db_name",
- /* 302 */ "tag_list_opt ::=",
- /* 303 */ "tag_list_opt ::= tag_item",
- /* 304 */ "tag_list_opt ::= tag_list_opt NK_COMMA tag_item",
- /* 305 */ "tag_item ::= TBNAME",
- /* 306 */ "tag_item ::= QTAGS",
- /* 307 */ "tag_item ::= column_name",
- /* 308 */ "tag_item ::= column_name column_alias",
- /* 309 */ "tag_item ::= column_name AS column_alias",
- /* 310 */ "db_kind_opt ::=",
- /* 311 */ "db_kind_opt ::= USER",
- /* 312 */ "db_kind_opt ::= SYSTEM",
- /* 313 */ "cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options",
- /* 314 */ "cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP",
- /* 315 */ "cmd ::= DROP INDEX exists_opt full_index_name",
- /* 316 */ "full_index_name ::= index_name",
- /* 317 */ "full_index_name ::= db_name NK_DOT index_name",
- /* 318 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt",
- /* 319 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt",
- /* 320 */ "func_list ::= func",
- /* 321 */ "func_list ::= func_list NK_COMMA func",
- /* 322 */ "func ::= sma_func_name NK_LP expression_list NK_RP",
- /* 323 */ "sma_func_name ::= function_name",
- /* 324 */ "sma_func_name ::= COUNT",
- /* 325 */ "sma_func_name ::= FIRST",
- /* 326 */ "sma_func_name ::= LAST",
- /* 327 */ "sma_func_name ::= LAST_ROW",
- /* 328 */ "sma_stream_opt ::=",
- /* 329 */ "sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal",
- /* 330 */ "sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal",
- /* 331 */ "sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal",
- /* 332 */ "with_meta ::= AS",
- /* 333 */ "with_meta ::= WITH META AS",
- /* 334 */ "with_meta ::= ONLY META AS",
- /* 335 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery",
- /* 336 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name",
- /* 337 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt",
- /* 338 */ "cmd ::= DROP TOPIC exists_opt topic_name",
- /* 339 */ "cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name",
- /* 340 */ "cmd ::= DESC full_table_name",
- /* 341 */ "cmd ::= DESCRIBE full_table_name",
- /* 342 */ "cmd ::= RESET QUERY CACHE",
- /* 343 */ "cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery",
- /* 344 */ "cmd ::= EXPLAIN analyze_opt explain_options insert_query",
- /* 345 */ "analyze_opt ::=",
- /* 346 */ "analyze_opt ::= ANALYZE",
- /* 347 */ "explain_options ::=",
- /* 348 */ "explain_options ::= explain_options VERBOSE NK_BOOL",
- /* 349 */ "explain_options ::= explain_options RATIO NK_FLOAT",
- /* 350 */ "cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt",
- /* 351 */ "cmd ::= DROP FUNCTION exists_opt function_name",
- /* 352 */ "agg_func_opt ::=",
- /* 353 */ "agg_func_opt ::= AGGREGATE",
- /* 354 */ "bufsize_opt ::=",
- /* 355 */ "bufsize_opt ::= BUFSIZE NK_INTEGER",
- /* 356 */ "language_opt ::=",
- /* 357 */ "language_opt ::= LANGUAGE NK_STRING",
- /* 358 */ "or_replace_opt ::=",
- /* 359 */ "or_replace_opt ::= OR REPLACE",
- /* 360 */ "cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery",
- /* 361 */ "cmd ::= DROP VIEW exists_opt full_view_name",
- /* 362 */ "full_view_name ::= view_name",
- /* 363 */ "full_view_name ::= db_name NK_DOT view_name",
- /* 364 */ "cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery",
- /* 365 */ "cmd ::= DROP STREAM exists_opt stream_name",
- /* 366 */ "cmd ::= PAUSE STREAM exists_opt stream_name",
- /* 367 */ "cmd ::= RESUME STREAM exists_opt ignore_opt stream_name",
- /* 368 */ "col_list_opt ::=",
- /* 369 */ "col_list_opt ::= NK_LP col_name_list NK_RP",
- /* 370 */ "tag_def_or_ref_opt ::=",
- /* 371 */ "tag_def_or_ref_opt ::= tags_def",
- /* 372 */ "tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP",
- /* 373 */ "stream_options ::=",
- /* 374 */ "stream_options ::= stream_options TRIGGER AT_ONCE",
- /* 375 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE",
- /* 376 */ "stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal",
- /* 377 */ "stream_options ::= stream_options WATERMARK duration_literal",
- /* 378 */ "stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER",
- /* 379 */ "stream_options ::= stream_options FILL_HISTORY NK_INTEGER",
- /* 380 */ "stream_options ::= stream_options DELETE_MARK duration_literal",
- /* 381 */ "stream_options ::= stream_options IGNORE UPDATE NK_INTEGER",
- /* 382 */ "subtable_opt ::=",
- /* 383 */ "subtable_opt ::= SUBTABLE NK_LP expression NK_RP",
- /* 384 */ "ignore_opt ::=",
- /* 385 */ "ignore_opt ::= IGNORE UNTREATED",
- /* 386 */ "cmd ::= KILL CONNECTION NK_INTEGER",
- /* 387 */ "cmd ::= KILL QUERY NK_STRING",
- /* 388 */ "cmd ::= KILL TRANSACTION NK_INTEGER",
- /* 389 */ "cmd ::= KILL COMPACT NK_INTEGER",
- /* 390 */ "cmd ::= BALANCE VGROUP",
- /* 391 */ "cmd ::= BALANCE VGROUP LEADER on_vgroup_id",
- /* 392 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER",
- /* 393 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list",
- /* 394 */ "cmd ::= SPLIT VGROUP NK_INTEGER",
- /* 395 */ "on_vgroup_id ::=",
- /* 396 */ "on_vgroup_id ::= ON NK_INTEGER",
- /* 397 */ "dnode_list ::= DNODE NK_INTEGER",
- /* 398 */ "dnode_list ::= dnode_list DNODE NK_INTEGER",
- /* 399 */ "cmd ::= DELETE FROM full_table_name where_clause_opt",
- /* 400 */ "cmd ::= query_or_subquery",
- /* 401 */ "cmd ::= insert_query",
- /* 402 */ "insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery",
- /* 403 */ "insert_query ::= INSERT INTO full_table_name query_or_subquery",
- /* 404 */ "literal ::= NK_INTEGER",
- /* 405 */ "literal ::= NK_FLOAT",
- /* 406 */ "literal ::= NK_STRING",
- /* 407 */ "literal ::= NK_BOOL",
- /* 408 */ "literal ::= TIMESTAMP NK_STRING",
- /* 409 */ "literal ::= duration_literal",
- /* 410 */ "literal ::= NULL",
- /* 411 */ "literal ::= NK_QUESTION",
- /* 412 */ "duration_literal ::= NK_VARIABLE",
- /* 413 */ "signed ::= NK_INTEGER",
- /* 414 */ "signed ::= NK_PLUS NK_INTEGER",
- /* 415 */ "signed ::= NK_MINUS NK_INTEGER",
- /* 416 */ "signed ::= NK_FLOAT",
- /* 417 */ "signed ::= NK_PLUS NK_FLOAT",
- /* 418 */ "signed ::= NK_MINUS NK_FLOAT",
- /* 419 */ "signed_literal ::= signed",
- /* 420 */ "signed_literal ::= NK_STRING",
- /* 421 */ "signed_literal ::= NK_BOOL",
- /* 422 */ "signed_literal ::= TIMESTAMP NK_STRING",
- /* 423 */ "signed_literal ::= duration_literal",
- /* 424 */ "signed_literal ::= NULL",
- /* 425 */ "signed_literal ::= literal_func",
- /* 426 */ "signed_literal ::= NK_QUESTION",
- /* 427 */ "literal_list ::= signed_literal",
- /* 428 */ "literal_list ::= literal_list NK_COMMA signed_literal",
- /* 429 */ "db_name ::= NK_ID",
- /* 430 */ "table_name ::= NK_ID",
- /* 431 */ "column_name ::= NK_ID",
- /* 432 */ "function_name ::= NK_ID",
- /* 433 */ "view_name ::= NK_ID",
- /* 434 */ "table_alias ::= NK_ID",
- /* 435 */ "column_alias ::= NK_ID",
- /* 436 */ "column_alias ::= NK_ALIAS",
- /* 437 */ "user_name ::= NK_ID",
- /* 438 */ "topic_name ::= NK_ID",
- /* 439 */ "stream_name ::= NK_ID",
- /* 440 */ "cgroup_name ::= NK_ID",
- /* 441 */ "index_name ::= NK_ID",
- /* 442 */ "expr_or_subquery ::= expression",
- /* 443 */ "expression ::= literal",
- /* 444 */ "expression ::= pseudo_column",
- /* 445 */ "expression ::= column_reference",
- /* 446 */ "expression ::= function_expression",
- /* 447 */ "expression ::= case_when_expression",
- /* 448 */ "expression ::= NK_LP expression NK_RP",
- /* 449 */ "expression ::= NK_PLUS expr_or_subquery",
- /* 450 */ "expression ::= NK_MINUS expr_or_subquery",
- /* 451 */ "expression ::= expr_or_subquery NK_PLUS expr_or_subquery",
- /* 452 */ "expression ::= expr_or_subquery NK_MINUS expr_or_subquery",
- /* 453 */ "expression ::= expr_or_subquery NK_STAR expr_or_subquery",
- /* 454 */ "expression ::= expr_or_subquery NK_SLASH expr_or_subquery",
- /* 455 */ "expression ::= expr_or_subquery NK_REM expr_or_subquery",
- /* 456 */ "expression ::= column_reference NK_ARROW NK_STRING",
- /* 457 */ "expression ::= expr_or_subquery NK_BITAND expr_or_subquery",
- /* 458 */ "expression ::= expr_or_subquery NK_BITOR expr_or_subquery",
- /* 459 */ "expression_list ::= expr_or_subquery",
- /* 460 */ "expression_list ::= expression_list NK_COMMA expr_or_subquery",
- /* 461 */ "column_reference ::= column_name",
- /* 462 */ "column_reference ::= table_name NK_DOT column_name",
- /* 463 */ "column_reference ::= NK_ALIAS",
- /* 464 */ "column_reference ::= table_name NK_DOT NK_ALIAS",
- /* 465 */ "pseudo_column ::= ROWTS",
- /* 466 */ "pseudo_column ::= TBNAME",
- /* 467 */ "pseudo_column ::= table_name NK_DOT TBNAME",
- /* 468 */ "pseudo_column ::= QSTART",
- /* 469 */ "pseudo_column ::= QEND",
- /* 470 */ "pseudo_column ::= QDURATION",
- /* 471 */ "pseudo_column ::= WSTART",
- /* 472 */ "pseudo_column ::= WEND",
- /* 473 */ "pseudo_column ::= WDURATION",
- /* 474 */ "pseudo_column ::= IROWTS",
- /* 475 */ "pseudo_column ::= ISFILLED",
- /* 476 */ "pseudo_column ::= QTAGS",
- /* 477 */ "function_expression ::= function_name NK_LP expression_list NK_RP",
- /* 478 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP",
- /* 479 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP",
- /* 480 */ "function_expression ::= literal_func",
- /* 481 */ "literal_func ::= noarg_func NK_LP NK_RP",
- /* 482 */ "literal_func ::= NOW",
- /* 483 */ "noarg_func ::= NOW",
- /* 484 */ "noarg_func ::= TODAY",
- /* 485 */ "noarg_func ::= TIMEZONE",
- /* 486 */ "noarg_func ::= DATABASE",
- /* 487 */ "noarg_func ::= CLIENT_VERSION",
- /* 488 */ "noarg_func ::= SERVER_VERSION",
- /* 489 */ "noarg_func ::= SERVER_STATUS",
- /* 490 */ "noarg_func ::= CURRENT_USER",
- /* 491 */ "noarg_func ::= USER",
- /* 492 */ "star_func ::= COUNT",
- /* 493 */ "star_func ::= FIRST",
- /* 494 */ "star_func ::= LAST",
- /* 495 */ "star_func ::= LAST_ROW",
- /* 496 */ "star_func_para_list ::= NK_STAR",
- /* 497 */ "star_func_para_list ::= other_para_list",
- /* 498 */ "other_para_list ::= star_func_para",
- /* 499 */ "other_para_list ::= other_para_list NK_COMMA star_func_para",
- /* 500 */ "star_func_para ::= expr_or_subquery",
- /* 501 */ "star_func_para ::= table_name NK_DOT NK_STAR",
- /* 502 */ "case_when_expression ::= CASE when_then_list case_when_else_opt END",
- /* 503 */ "case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END",
- /* 504 */ "when_then_list ::= when_then_expr",
- /* 505 */ "when_then_list ::= when_then_list when_then_expr",
- /* 506 */ "when_then_expr ::= WHEN common_expression THEN common_expression",
- /* 507 */ "case_when_else_opt ::=",
- /* 508 */ "case_when_else_opt ::= ELSE common_expression",
- /* 509 */ "predicate ::= expr_or_subquery compare_op expr_or_subquery",
- /* 510 */ "predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery",
- /* 511 */ "predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery",
- /* 512 */ "predicate ::= expr_or_subquery IS NULL",
- /* 513 */ "predicate ::= expr_or_subquery IS NOT NULL",
- /* 514 */ "predicate ::= expr_or_subquery in_op in_predicate_value",
- /* 515 */ "compare_op ::= NK_LT",
- /* 516 */ "compare_op ::= NK_GT",
- /* 517 */ "compare_op ::= NK_LE",
- /* 518 */ "compare_op ::= NK_GE",
- /* 519 */ "compare_op ::= NK_NE",
- /* 520 */ "compare_op ::= NK_EQ",
- /* 521 */ "compare_op ::= LIKE",
- /* 522 */ "compare_op ::= NOT LIKE",
- /* 523 */ "compare_op ::= MATCH",
- /* 524 */ "compare_op ::= NMATCH",
- /* 525 */ "compare_op ::= CONTAINS",
- /* 526 */ "in_op ::= IN",
- /* 527 */ "in_op ::= NOT IN",
- /* 528 */ "in_predicate_value ::= NK_LP literal_list NK_RP",
- /* 529 */ "boolean_value_expression ::= boolean_primary",
- /* 530 */ "boolean_value_expression ::= NOT boolean_primary",
- /* 531 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression",
- /* 532 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression",
- /* 533 */ "boolean_primary ::= predicate",
- /* 534 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP",
- /* 535 */ "common_expression ::= expr_or_subquery",
- /* 536 */ "common_expression ::= boolean_value_expression",
- /* 537 */ "from_clause_opt ::=",
- /* 538 */ "from_clause_opt ::= FROM table_reference_list",
- /* 539 */ "table_reference_list ::= table_reference",
- /* 540 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference",
- /* 541 */ "table_reference ::= table_primary",
- /* 542 */ "table_reference ::= joined_table",
- /* 543 */ "table_primary ::= table_name alias_opt",
- /* 544 */ "table_primary ::= db_name NK_DOT table_name alias_opt",
- /* 545 */ "table_primary ::= subquery alias_opt",
- /* 546 */ "table_primary ::= parenthesized_joined_table",
- /* 547 */ "alias_opt ::=",
- /* 548 */ "alias_opt ::= table_alias",
- /* 549 */ "alias_opt ::= AS table_alias",
- /* 550 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP",
- /* 551 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP",
- /* 552 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition",
- /* 553 */ "join_type ::=",
- /* 554 */ "join_type ::= INNER",
- /* 555 */ "query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt",
- /* 556 */ "hint_list ::=",
- /* 557 */ "hint_list ::= NK_HINT",
- /* 558 */ "tag_mode_opt ::=",
- /* 559 */ "tag_mode_opt ::= TAGS",
- /* 560 */ "set_quantifier_opt ::=",
- /* 561 */ "set_quantifier_opt ::= DISTINCT",
- /* 562 */ "set_quantifier_opt ::= ALL",
- /* 563 */ "select_list ::= select_item",
- /* 564 */ "select_list ::= select_list NK_COMMA select_item",
- /* 565 */ "select_item ::= NK_STAR",
- /* 566 */ "select_item ::= common_expression",
- /* 567 */ "select_item ::= common_expression column_alias",
- /* 568 */ "select_item ::= common_expression AS column_alias",
- /* 569 */ "select_item ::= table_name NK_DOT NK_STAR",
- /* 570 */ "where_clause_opt ::=",
- /* 571 */ "where_clause_opt ::= WHERE search_condition",
- /* 572 */ "partition_by_clause_opt ::=",
- /* 573 */ "partition_by_clause_opt ::= PARTITION BY partition_list",
- /* 574 */ "partition_list ::= partition_item",
- /* 575 */ "partition_list ::= partition_list NK_COMMA partition_item",
- /* 576 */ "partition_item ::= expr_or_subquery",
- /* 577 */ "partition_item ::= expr_or_subquery column_alias",
- /* 578 */ "partition_item ::= expr_or_subquery AS column_alias",
- /* 579 */ "twindow_clause_opt ::=",
- /* 580 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP",
- /* 581 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP",
- /* 582 */ "twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt",
- /* 583 */ "twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt",
- /* 584 */ "twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition",
- /* 585 */ "sliding_opt ::=",
- /* 586 */ "sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP",
- /* 587 */ "interval_sliding_duration_literal ::= NK_VARIABLE",
- /* 588 */ "interval_sliding_duration_literal ::= NK_STRING",
- /* 589 */ "interval_sliding_duration_literal ::= NK_INTEGER",
- /* 590 */ "fill_opt ::=",
- /* 591 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP",
- /* 592 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP",
- /* 593 */ "fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP",
- /* 594 */ "fill_mode ::= NONE",
- /* 595 */ "fill_mode ::= PREV",
- /* 596 */ "fill_mode ::= NULL",
- /* 597 */ "fill_mode ::= NULL_F",
- /* 598 */ "fill_mode ::= LINEAR",
- /* 599 */ "fill_mode ::= NEXT",
- /* 600 */ "group_by_clause_opt ::=",
- /* 601 */ "group_by_clause_opt ::= GROUP BY group_by_list",
- /* 602 */ "group_by_list ::= expr_or_subquery",
- /* 603 */ "group_by_list ::= group_by_list NK_COMMA expr_or_subquery",
- /* 604 */ "having_clause_opt ::=",
- /* 605 */ "having_clause_opt ::= HAVING search_condition",
- /* 606 */ "range_opt ::=",
- /* 607 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP",
- /* 608 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_RP",
- /* 609 */ "every_opt ::=",
- /* 610 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP",
- /* 611 */ "query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt",
- /* 612 */ "query_simple ::= query_specification",
- /* 613 */ "query_simple ::= union_query_expression",
- /* 614 */ "union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery",
- /* 615 */ "union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery",
- /* 616 */ "query_simple_or_subquery ::= query_simple",
- /* 617 */ "query_simple_or_subquery ::= subquery",
- /* 618 */ "query_or_subquery ::= query_expression",
- /* 619 */ "query_or_subquery ::= subquery",
- /* 620 */ "order_by_clause_opt ::=",
- /* 621 */ "order_by_clause_opt ::= ORDER BY sort_specification_list",
- /* 622 */ "slimit_clause_opt ::=",
- /* 623 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER",
- /* 624 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER",
- /* 625 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER",
- /* 626 */ "limit_clause_opt ::=",
- /* 627 */ "limit_clause_opt ::= LIMIT NK_INTEGER",
- /* 628 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER",
- /* 629 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER",
- /* 630 */ "subquery ::= NK_LP query_expression NK_RP",
- /* 631 */ "subquery ::= NK_LP subquery NK_RP",
- /* 632 */ "search_condition ::= common_expression",
- /* 633 */ "sort_specification_list ::= sort_specification",
- /* 634 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification",
- /* 635 */ "sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt",
- /* 636 */ "ordering_specification_opt ::=",
- /* 637 */ "ordering_specification_opt ::= ASC",
- /* 638 */ "ordering_specification_opt ::= DESC",
- /* 639 */ "null_ordering_opt ::=",
- /* 640 */ "null_ordering_opt ::= NULLS FIRST",
- /* 641 */ "null_ordering_opt ::= NULLS LAST",
+ /* 71 */ "cmd ::= ALTER CLUSTER NK_STRING",
+ /* 72 */ "cmd ::= ALTER CLUSTER NK_STRING NK_STRING",
+ /* 73 */ "cmd ::= ALTER LOCAL NK_STRING",
+ /* 74 */ "cmd ::= ALTER LOCAL NK_STRING NK_STRING",
+ /* 75 */ "cmd ::= CREATE QNODE ON DNODE NK_INTEGER",
+ /* 76 */ "cmd ::= DROP QNODE ON DNODE NK_INTEGER",
+ /* 77 */ "cmd ::= RESTORE QNODE ON DNODE NK_INTEGER",
+ /* 78 */ "cmd ::= CREATE BNODE ON DNODE NK_INTEGER",
+ /* 79 */ "cmd ::= DROP BNODE ON DNODE NK_INTEGER",
+ /* 80 */ "cmd ::= CREATE SNODE ON DNODE NK_INTEGER",
+ /* 81 */ "cmd ::= DROP SNODE ON DNODE NK_INTEGER",
+ /* 82 */ "cmd ::= CREATE MNODE ON DNODE NK_INTEGER",
+ /* 83 */ "cmd ::= DROP MNODE ON DNODE NK_INTEGER",
+ /* 84 */ "cmd ::= RESTORE MNODE ON DNODE NK_INTEGER",
+ /* 85 */ "cmd ::= RESTORE VNODE ON DNODE NK_INTEGER",
+ /* 86 */ "cmd ::= CREATE DATABASE not_exists_opt db_name db_options",
+ /* 87 */ "cmd ::= DROP DATABASE exists_opt db_name",
+ /* 88 */ "cmd ::= USE db_name",
+ /* 89 */ "cmd ::= ALTER DATABASE db_name alter_db_options",
+ /* 90 */ "cmd ::= FLUSH DATABASE db_name",
+ /* 91 */ "cmd ::= TRIM DATABASE db_name speed_opt",
+ /* 92 */ "cmd ::= COMPACT DATABASE db_name start_opt end_opt",
+ /* 93 */ "not_exists_opt ::= IF NOT EXISTS",
+ /* 94 */ "not_exists_opt ::=",
+ /* 95 */ "exists_opt ::= IF EXISTS",
+ /* 96 */ "exists_opt ::=",
+ /* 97 */ "db_options ::=",
+ /* 98 */ "db_options ::= db_options BUFFER NK_INTEGER",
+ /* 99 */ "db_options ::= db_options CACHEMODEL NK_STRING",
+ /* 100 */ "db_options ::= db_options CACHESIZE NK_INTEGER",
+ /* 101 */ "db_options ::= db_options COMP NK_INTEGER",
+ /* 102 */ "db_options ::= db_options DURATION NK_INTEGER",
+ /* 103 */ "db_options ::= db_options DURATION NK_VARIABLE",
+ /* 104 */ "db_options ::= db_options MAXROWS NK_INTEGER",
+ /* 105 */ "db_options ::= db_options MINROWS NK_INTEGER",
+ /* 106 */ "db_options ::= db_options KEEP integer_list",
+ /* 107 */ "db_options ::= db_options KEEP variable_list",
+ /* 108 */ "db_options ::= db_options PAGES NK_INTEGER",
+ /* 109 */ "db_options ::= db_options PAGESIZE NK_INTEGER",
+ /* 110 */ "db_options ::= db_options TSDB_PAGESIZE NK_INTEGER",
+ /* 111 */ "db_options ::= db_options PRECISION NK_STRING",
+ /* 112 */ "db_options ::= db_options REPLICA NK_INTEGER",
+ /* 113 */ "db_options ::= db_options VGROUPS NK_INTEGER",
+ /* 114 */ "db_options ::= db_options SINGLE_STABLE NK_INTEGER",
+ /* 115 */ "db_options ::= db_options RETENTIONS retention_list",
+ /* 116 */ "db_options ::= db_options SCHEMALESS NK_INTEGER",
+ /* 117 */ "db_options ::= db_options WAL_LEVEL NK_INTEGER",
+ /* 118 */ "db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER",
+ /* 119 */ "db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER",
+ /* 120 */ "db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER",
+ /* 121 */ "db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER",
+ /* 122 */ "db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER",
+ /* 123 */ "db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER",
+ /* 124 */ "db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER",
+ /* 125 */ "db_options ::= db_options STT_TRIGGER NK_INTEGER",
+ /* 126 */ "db_options ::= db_options TABLE_PREFIX signed",
+ /* 127 */ "db_options ::= db_options TABLE_SUFFIX signed",
+ /* 128 */ "db_options ::= db_options KEEP_TIME_OFFSET NK_INTEGER",
+ /* 129 */ "alter_db_options ::= alter_db_option",
+ /* 130 */ "alter_db_options ::= alter_db_options alter_db_option",
+ /* 131 */ "alter_db_option ::= BUFFER NK_INTEGER",
+ /* 132 */ "alter_db_option ::= CACHEMODEL NK_STRING",
+ /* 133 */ "alter_db_option ::= CACHESIZE NK_INTEGER",
+ /* 134 */ "alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER",
+ /* 135 */ "alter_db_option ::= KEEP integer_list",
+ /* 136 */ "alter_db_option ::= KEEP variable_list",
+ /* 137 */ "alter_db_option ::= PAGES NK_INTEGER",
+ /* 138 */ "alter_db_option ::= REPLICA NK_INTEGER",
+ /* 139 */ "alter_db_option ::= WAL_LEVEL NK_INTEGER",
+ /* 140 */ "alter_db_option ::= STT_TRIGGER NK_INTEGER",
+ /* 141 */ "alter_db_option ::= MINROWS NK_INTEGER",
+ /* 142 */ "alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER",
+ /* 143 */ "alter_db_option ::= WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER",
+ /* 144 */ "alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER",
+ /* 145 */ "alter_db_option ::= WAL_RETENTION_SIZE NK_MINUS NK_INTEGER",
+ /* 146 */ "alter_db_option ::= KEEP_TIME_OFFSET NK_INTEGER",
+ /* 147 */ "integer_list ::= NK_INTEGER",
+ /* 148 */ "integer_list ::= integer_list NK_COMMA NK_INTEGER",
+ /* 149 */ "variable_list ::= NK_VARIABLE",
+ /* 150 */ "variable_list ::= variable_list NK_COMMA NK_VARIABLE",
+ /* 151 */ "retention_list ::= retention",
+ /* 152 */ "retention_list ::= retention_list NK_COMMA retention",
+ /* 153 */ "retention ::= NK_VARIABLE NK_COLON NK_VARIABLE",
+ /* 154 */ "retention ::= NK_MINUS NK_COLON NK_VARIABLE",
+ /* 155 */ "speed_opt ::=",
+ /* 156 */ "speed_opt ::= BWLIMIT NK_INTEGER",
+ /* 157 */ "start_opt ::=",
+ /* 158 */ "start_opt ::= START WITH NK_INTEGER",
+ /* 159 */ "start_opt ::= START WITH NK_STRING",
+ /* 160 */ "start_opt ::= START WITH TIMESTAMP NK_STRING",
+ /* 161 */ "end_opt ::=",
+ /* 162 */ "end_opt ::= END WITH NK_INTEGER",
+ /* 163 */ "end_opt ::= END WITH NK_STRING",
+ /* 164 */ "end_opt ::= END WITH TIMESTAMP NK_STRING",
+ /* 165 */ "cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options",
+ /* 166 */ "cmd ::= CREATE TABLE multi_create_clause",
+ /* 167 */ "cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options",
+ /* 168 */ "cmd ::= DROP TABLE multi_drop_clause",
+ /* 169 */ "cmd ::= DROP STABLE exists_opt full_table_name",
+ /* 170 */ "cmd ::= ALTER TABLE alter_table_clause",
+ /* 171 */ "cmd ::= ALTER STABLE alter_table_clause",
+ /* 172 */ "alter_table_clause ::= full_table_name alter_table_options",
+ /* 173 */ "alter_table_clause ::= full_table_name ADD COLUMN column_name type_name",
+ /* 174 */ "alter_table_clause ::= full_table_name DROP COLUMN column_name",
+ /* 175 */ "alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name",
+ /* 176 */ "alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name",
+ /* 177 */ "alter_table_clause ::= full_table_name ADD TAG column_name type_name",
+ /* 178 */ "alter_table_clause ::= full_table_name DROP TAG column_name",
+ /* 179 */ "alter_table_clause ::= full_table_name MODIFY TAG column_name type_name",
+ /* 180 */ "alter_table_clause ::= full_table_name RENAME TAG column_name column_name",
+ /* 181 */ "alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal",
+ /* 182 */ "multi_create_clause ::= create_subtable_clause",
+ /* 183 */ "multi_create_clause ::= multi_create_clause create_subtable_clause",
+ /* 184 */ "create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP expression_list NK_RP table_options",
+ /* 185 */ "multi_drop_clause ::= drop_table_clause",
+ /* 186 */ "multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause",
+ /* 187 */ "drop_table_clause ::= exists_opt full_table_name",
+ /* 188 */ "specific_cols_opt ::=",
+ /* 189 */ "specific_cols_opt ::= NK_LP col_name_list NK_RP",
+ /* 190 */ "full_table_name ::= table_name",
+ /* 191 */ "full_table_name ::= db_name NK_DOT table_name",
+ /* 192 */ "column_def_list ::= column_def",
+ /* 193 */ "column_def_list ::= column_def_list NK_COMMA column_def",
+ /* 194 */ "column_def ::= column_name type_name",
+ /* 195 */ "type_name ::= BOOL",
+ /* 196 */ "type_name ::= TINYINT",
+ /* 197 */ "type_name ::= SMALLINT",
+ /* 198 */ "type_name ::= INT",
+ /* 199 */ "type_name ::= INTEGER",
+ /* 200 */ "type_name ::= BIGINT",
+ /* 201 */ "type_name ::= FLOAT",
+ /* 202 */ "type_name ::= DOUBLE",
+ /* 203 */ "type_name ::= BINARY NK_LP NK_INTEGER NK_RP",
+ /* 204 */ "type_name ::= TIMESTAMP",
+ /* 205 */ "type_name ::= NCHAR NK_LP NK_INTEGER NK_RP",
+ /* 206 */ "type_name ::= TINYINT UNSIGNED",
+ /* 207 */ "type_name ::= SMALLINT UNSIGNED",
+ /* 208 */ "type_name ::= INT UNSIGNED",
+ /* 209 */ "type_name ::= BIGINT UNSIGNED",
+ /* 210 */ "type_name ::= JSON",
+ /* 211 */ "type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP",
+ /* 212 */ "type_name ::= MEDIUMBLOB",
+ /* 213 */ "type_name ::= BLOB",
+ /* 214 */ "type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP",
+ /* 215 */ "type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP",
+ /* 216 */ "type_name ::= DECIMAL",
+ /* 217 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP",
+ /* 218 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP",
+ /* 219 */ "tags_def_opt ::=",
+ /* 220 */ "tags_def_opt ::= tags_def",
+ /* 221 */ "tags_def ::= TAGS NK_LP column_def_list NK_RP",
+ /* 222 */ "table_options ::=",
+ /* 223 */ "table_options ::= table_options COMMENT NK_STRING",
+ /* 224 */ "table_options ::= table_options MAX_DELAY duration_list",
+ /* 225 */ "table_options ::= table_options WATERMARK duration_list",
+ /* 226 */ "table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP",
+ /* 227 */ "table_options ::= table_options TTL NK_INTEGER",
+ /* 228 */ "table_options ::= table_options SMA NK_LP col_name_list NK_RP",
+ /* 229 */ "table_options ::= table_options DELETE_MARK duration_list",
+ /* 230 */ "alter_table_options ::= alter_table_option",
+ /* 231 */ "alter_table_options ::= alter_table_options alter_table_option",
+ /* 232 */ "alter_table_option ::= COMMENT NK_STRING",
+ /* 233 */ "alter_table_option ::= TTL NK_INTEGER",
+ /* 234 */ "duration_list ::= duration_literal",
+ /* 235 */ "duration_list ::= duration_list NK_COMMA duration_literal",
+ /* 236 */ "rollup_func_list ::= rollup_func_name",
+ /* 237 */ "rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name",
+ /* 238 */ "rollup_func_name ::= function_name",
+ /* 239 */ "rollup_func_name ::= FIRST",
+ /* 240 */ "rollup_func_name ::= LAST",
+ /* 241 */ "col_name_list ::= col_name",
+ /* 242 */ "col_name_list ::= col_name_list NK_COMMA col_name",
+ /* 243 */ "col_name ::= column_name",
+ /* 244 */ "cmd ::= SHOW DNODES",
+ /* 245 */ "cmd ::= SHOW USERS",
+ /* 246 */ "cmd ::= SHOW USER PRIVILEGES",
+ /* 247 */ "cmd ::= SHOW db_kind_opt DATABASES",
+ /* 248 */ "cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt",
+ /* 249 */ "cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt",
+ /* 250 */ "cmd ::= SHOW db_name_cond_opt VGROUPS",
+ /* 251 */ "cmd ::= SHOW MNODES",
+ /* 252 */ "cmd ::= SHOW QNODES",
+ /* 253 */ "cmd ::= SHOW FUNCTIONS",
+ /* 254 */ "cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt",
+ /* 255 */ "cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name",
+ /* 256 */ "cmd ::= SHOW STREAMS",
+ /* 257 */ "cmd ::= SHOW ACCOUNTS",
+ /* 258 */ "cmd ::= SHOW APPS",
+ /* 259 */ "cmd ::= SHOW CONNECTIONS",
+ /* 260 */ "cmd ::= SHOW LICENCES",
+ /* 261 */ "cmd ::= SHOW GRANTS",
+ /* 262 */ "cmd ::= SHOW GRANTS FULL",
+ /* 263 */ "cmd ::= SHOW GRANTS LOGS",
+ /* 264 */ "cmd ::= SHOW CLUSTER MACHINES",
+ /* 265 */ "cmd ::= SHOW CREATE DATABASE db_name",
+ /* 266 */ "cmd ::= SHOW CREATE TABLE full_table_name",
+ /* 267 */ "cmd ::= SHOW CREATE STABLE full_table_name",
+ /* 268 */ "cmd ::= SHOW QUERIES",
+ /* 269 */ "cmd ::= SHOW SCORES",
+ /* 270 */ "cmd ::= SHOW TOPICS",
+ /* 271 */ "cmd ::= SHOW VARIABLES",
+ /* 272 */ "cmd ::= SHOW CLUSTER VARIABLES",
+ /* 273 */ "cmd ::= SHOW LOCAL VARIABLES",
+ /* 274 */ "cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt",
+ /* 275 */ "cmd ::= SHOW BNODES",
+ /* 276 */ "cmd ::= SHOW SNODES",
+ /* 277 */ "cmd ::= SHOW CLUSTER",
+ /* 278 */ "cmd ::= SHOW TRANSACTIONS",
+ /* 279 */ "cmd ::= SHOW TABLE DISTRIBUTED full_table_name",
+ /* 280 */ "cmd ::= SHOW CONSUMERS",
+ /* 281 */ "cmd ::= SHOW SUBSCRIPTIONS",
+ /* 282 */ "cmd ::= SHOW TAGS FROM table_name_cond from_db_opt",
+ /* 283 */ "cmd ::= SHOW TAGS FROM db_name NK_DOT table_name",
+ /* 284 */ "cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt",
+ /* 285 */ "cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name",
+ /* 286 */ "cmd ::= SHOW VNODES ON DNODE NK_INTEGER",
+ /* 287 */ "cmd ::= SHOW VNODES",
+ /* 288 */ "cmd ::= SHOW db_name_cond_opt ALIVE",
+ /* 289 */ "cmd ::= SHOW CLUSTER ALIVE",
+ /* 290 */ "cmd ::= SHOW db_name_cond_opt VIEWS",
+ /* 291 */ "cmd ::= SHOW CREATE VIEW full_table_name",
+ /* 292 */ "cmd ::= SHOW COMPACTS",
+ /* 293 */ "cmd ::= SHOW COMPACT NK_INTEGER",
+ /* 294 */ "table_kind_db_name_cond_opt ::=",
+ /* 295 */ "table_kind_db_name_cond_opt ::= table_kind",
+ /* 296 */ "table_kind_db_name_cond_opt ::= db_name NK_DOT",
+ /* 297 */ "table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT",
+ /* 298 */ "table_kind ::= NORMAL",
+ /* 299 */ "table_kind ::= CHILD",
+ /* 300 */ "db_name_cond_opt ::=",
+ /* 301 */ "db_name_cond_opt ::= db_name NK_DOT",
+ /* 302 */ "like_pattern_opt ::=",
+ /* 303 */ "like_pattern_opt ::= LIKE NK_STRING",
+ /* 304 */ "table_name_cond ::= table_name",
+ /* 305 */ "from_db_opt ::=",
+ /* 306 */ "from_db_opt ::= FROM db_name",
+ /* 307 */ "tag_list_opt ::=",
+ /* 308 */ "tag_list_opt ::= tag_item",
+ /* 309 */ "tag_list_opt ::= tag_list_opt NK_COMMA tag_item",
+ /* 310 */ "tag_item ::= TBNAME",
+ /* 311 */ "tag_item ::= QTAGS",
+ /* 312 */ "tag_item ::= column_name",
+ /* 313 */ "tag_item ::= column_name column_alias",
+ /* 314 */ "tag_item ::= column_name AS column_alias",
+ /* 315 */ "db_kind_opt ::=",
+ /* 316 */ "db_kind_opt ::= USER",
+ /* 317 */ "db_kind_opt ::= SYSTEM",
+ /* 318 */ "cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options",
+ /* 319 */ "cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP",
+ /* 320 */ "cmd ::= DROP INDEX exists_opt full_index_name",
+ /* 321 */ "full_index_name ::= index_name",
+ /* 322 */ "full_index_name ::= db_name NK_DOT index_name",
+ /* 323 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt",
+ /* 324 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt",
+ /* 325 */ "func_list ::= func",
+ /* 326 */ "func_list ::= func_list NK_COMMA func",
+ /* 327 */ "func ::= sma_func_name NK_LP expression_list NK_RP",
+ /* 328 */ "sma_func_name ::= function_name",
+ /* 329 */ "sma_func_name ::= COUNT",
+ /* 330 */ "sma_func_name ::= FIRST",
+ /* 331 */ "sma_func_name ::= LAST",
+ /* 332 */ "sma_func_name ::= LAST_ROW",
+ /* 333 */ "sma_stream_opt ::=",
+ /* 334 */ "sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal",
+ /* 335 */ "sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal",
+ /* 336 */ "sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal",
+ /* 337 */ "with_meta ::= AS",
+ /* 338 */ "with_meta ::= WITH META AS",
+ /* 339 */ "with_meta ::= ONLY META AS",
+ /* 340 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery",
+ /* 341 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name",
+ /* 342 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt",
+ /* 343 */ "cmd ::= DROP TOPIC exists_opt topic_name",
+ /* 344 */ "cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name",
+ /* 345 */ "cmd ::= DESC full_table_name",
+ /* 346 */ "cmd ::= DESCRIBE full_table_name",
+ /* 347 */ "cmd ::= RESET QUERY CACHE",
+ /* 348 */ "cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery",
+ /* 349 */ "cmd ::= EXPLAIN analyze_opt explain_options insert_query",
+ /* 350 */ "analyze_opt ::=",
+ /* 351 */ "analyze_opt ::= ANALYZE",
+ /* 352 */ "explain_options ::=",
+ /* 353 */ "explain_options ::= explain_options VERBOSE NK_BOOL",
+ /* 354 */ "explain_options ::= explain_options RATIO NK_FLOAT",
+ /* 355 */ "cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt",
+ /* 356 */ "cmd ::= DROP FUNCTION exists_opt function_name",
+ /* 357 */ "agg_func_opt ::=",
+ /* 358 */ "agg_func_opt ::= AGGREGATE",
+ /* 359 */ "bufsize_opt ::=",
+ /* 360 */ "bufsize_opt ::= BUFSIZE NK_INTEGER",
+ /* 361 */ "language_opt ::=",
+ /* 362 */ "language_opt ::= LANGUAGE NK_STRING",
+ /* 363 */ "or_replace_opt ::=",
+ /* 364 */ "or_replace_opt ::= OR REPLACE",
+ /* 365 */ "cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery",
+ /* 366 */ "cmd ::= DROP VIEW exists_opt full_view_name",
+ /* 367 */ "full_view_name ::= view_name",
+ /* 368 */ "full_view_name ::= db_name NK_DOT view_name",
+ /* 369 */ "cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery",
+ /* 370 */ "cmd ::= DROP STREAM exists_opt stream_name",
+ /* 371 */ "cmd ::= PAUSE STREAM exists_opt stream_name",
+ /* 372 */ "cmd ::= RESUME STREAM exists_opt ignore_opt stream_name",
+ /* 373 */ "col_list_opt ::=",
+ /* 374 */ "col_list_opt ::= NK_LP col_name_list NK_RP",
+ /* 375 */ "tag_def_or_ref_opt ::=",
+ /* 376 */ "tag_def_or_ref_opt ::= tags_def",
+ /* 377 */ "tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP",
+ /* 378 */ "stream_options ::=",
+ /* 379 */ "stream_options ::= stream_options TRIGGER AT_ONCE",
+ /* 380 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE",
+ /* 381 */ "stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal",
+ /* 382 */ "stream_options ::= stream_options WATERMARK duration_literal",
+ /* 383 */ "stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER",
+ /* 384 */ "stream_options ::= stream_options FILL_HISTORY NK_INTEGER",
+ /* 385 */ "stream_options ::= stream_options DELETE_MARK duration_literal",
+ /* 386 */ "stream_options ::= stream_options IGNORE UPDATE NK_INTEGER",
+ /* 387 */ "subtable_opt ::=",
+ /* 388 */ "subtable_opt ::= SUBTABLE NK_LP expression NK_RP",
+ /* 389 */ "ignore_opt ::=",
+ /* 390 */ "ignore_opt ::= IGNORE UNTREATED",
+ /* 391 */ "cmd ::= KILL CONNECTION NK_INTEGER",
+ /* 392 */ "cmd ::= KILL QUERY NK_STRING",
+ /* 393 */ "cmd ::= KILL TRANSACTION NK_INTEGER",
+ /* 394 */ "cmd ::= KILL COMPACT NK_INTEGER",
+ /* 395 */ "cmd ::= BALANCE VGROUP",
+ /* 396 */ "cmd ::= BALANCE VGROUP LEADER on_vgroup_id",
+ /* 397 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER",
+ /* 398 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list",
+ /* 399 */ "cmd ::= SPLIT VGROUP NK_INTEGER",
+ /* 400 */ "on_vgroup_id ::=",
+ /* 401 */ "on_vgroup_id ::= ON NK_INTEGER",
+ /* 402 */ "dnode_list ::= DNODE NK_INTEGER",
+ /* 403 */ "dnode_list ::= dnode_list DNODE NK_INTEGER",
+ /* 404 */ "cmd ::= DELETE FROM full_table_name where_clause_opt",
+ /* 405 */ "cmd ::= query_or_subquery",
+ /* 406 */ "cmd ::= insert_query",
+ /* 407 */ "insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery",
+ /* 408 */ "insert_query ::= INSERT INTO full_table_name query_or_subquery",
+ /* 409 */ "literal ::= NK_INTEGER",
+ /* 410 */ "literal ::= NK_FLOAT",
+ /* 411 */ "literal ::= NK_STRING",
+ /* 412 */ "literal ::= NK_BOOL",
+ /* 413 */ "literal ::= TIMESTAMP NK_STRING",
+ /* 414 */ "literal ::= duration_literal",
+ /* 415 */ "literal ::= NULL",
+ /* 416 */ "literal ::= NK_QUESTION",
+ /* 417 */ "duration_literal ::= NK_VARIABLE",
+ /* 418 */ "signed ::= NK_INTEGER",
+ /* 419 */ "signed ::= NK_PLUS NK_INTEGER",
+ /* 420 */ "signed ::= NK_MINUS NK_INTEGER",
+ /* 421 */ "signed ::= NK_FLOAT",
+ /* 422 */ "signed ::= NK_PLUS NK_FLOAT",
+ /* 423 */ "signed ::= NK_MINUS NK_FLOAT",
+ /* 424 */ "signed_literal ::= signed",
+ /* 425 */ "signed_literal ::= NK_STRING",
+ /* 426 */ "signed_literal ::= NK_BOOL",
+ /* 427 */ "signed_literal ::= TIMESTAMP NK_STRING",
+ /* 428 */ "signed_literal ::= duration_literal",
+ /* 429 */ "signed_literal ::= NULL",
+ /* 430 */ "signed_literal ::= literal_func",
+ /* 431 */ "signed_literal ::= NK_QUESTION",
+ /* 432 */ "literal_list ::= signed_literal",
+ /* 433 */ "literal_list ::= literal_list NK_COMMA signed_literal",
+ /* 434 */ "db_name ::= NK_ID",
+ /* 435 */ "table_name ::= NK_ID",
+ /* 436 */ "column_name ::= NK_ID",
+ /* 437 */ "function_name ::= NK_ID",
+ /* 438 */ "view_name ::= NK_ID",
+ /* 439 */ "table_alias ::= NK_ID",
+ /* 440 */ "column_alias ::= NK_ID",
+ /* 441 */ "column_alias ::= NK_ALIAS",
+ /* 442 */ "user_name ::= NK_ID",
+ /* 443 */ "topic_name ::= NK_ID",
+ /* 444 */ "stream_name ::= NK_ID",
+ /* 445 */ "cgroup_name ::= NK_ID",
+ /* 446 */ "index_name ::= NK_ID",
+ /* 447 */ "expr_or_subquery ::= expression",
+ /* 448 */ "expression ::= literal",
+ /* 449 */ "expression ::= pseudo_column",
+ /* 450 */ "expression ::= column_reference",
+ /* 451 */ "expression ::= function_expression",
+ /* 452 */ "expression ::= case_when_expression",
+ /* 453 */ "expression ::= NK_LP expression NK_RP",
+ /* 454 */ "expression ::= NK_PLUS expr_or_subquery",
+ /* 455 */ "expression ::= NK_MINUS expr_or_subquery",
+ /* 456 */ "expression ::= expr_or_subquery NK_PLUS expr_or_subquery",
+ /* 457 */ "expression ::= expr_or_subquery NK_MINUS expr_or_subquery",
+ /* 458 */ "expression ::= expr_or_subquery NK_STAR expr_or_subquery",
+ /* 459 */ "expression ::= expr_or_subquery NK_SLASH expr_or_subquery",
+ /* 460 */ "expression ::= expr_or_subquery NK_REM expr_or_subquery",
+ /* 461 */ "expression ::= column_reference NK_ARROW NK_STRING",
+ /* 462 */ "expression ::= expr_or_subquery NK_BITAND expr_or_subquery",
+ /* 463 */ "expression ::= expr_or_subquery NK_BITOR expr_or_subquery",
+ /* 464 */ "expression_list ::= expr_or_subquery",
+ /* 465 */ "expression_list ::= expression_list NK_COMMA expr_or_subquery",
+ /* 466 */ "column_reference ::= column_name",
+ /* 467 */ "column_reference ::= table_name NK_DOT column_name",
+ /* 468 */ "column_reference ::= NK_ALIAS",
+ /* 469 */ "column_reference ::= table_name NK_DOT NK_ALIAS",
+ /* 470 */ "pseudo_column ::= ROWTS",
+ /* 471 */ "pseudo_column ::= TBNAME",
+ /* 472 */ "pseudo_column ::= table_name NK_DOT TBNAME",
+ /* 473 */ "pseudo_column ::= QSTART",
+ /* 474 */ "pseudo_column ::= QEND",
+ /* 475 */ "pseudo_column ::= QDURATION",
+ /* 476 */ "pseudo_column ::= WSTART",
+ /* 477 */ "pseudo_column ::= WEND",
+ /* 478 */ "pseudo_column ::= WDURATION",
+ /* 479 */ "pseudo_column ::= IROWTS",
+ /* 480 */ "pseudo_column ::= ISFILLED",
+ /* 481 */ "pseudo_column ::= QTAGS",
+ /* 482 */ "function_expression ::= function_name NK_LP expression_list NK_RP",
+ /* 483 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP",
+ /* 484 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP",
+ /* 485 */ "function_expression ::= literal_func",
+ /* 486 */ "literal_func ::= noarg_func NK_LP NK_RP",
+ /* 487 */ "literal_func ::= NOW",
+ /* 488 */ "noarg_func ::= NOW",
+ /* 489 */ "noarg_func ::= TODAY",
+ /* 490 */ "noarg_func ::= TIMEZONE",
+ /* 491 */ "noarg_func ::= DATABASE",
+ /* 492 */ "noarg_func ::= CLIENT_VERSION",
+ /* 493 */ "noarg_func ::= SERVER_VERSION",
+ /* 494 */ "noarg_func ::= SERVER_STATUS",
+ /* 495 */ "noarg_func ::= CURRENT_USER",
+ /* 496 */ "noarg_func ::= USER",
+ /* 497 */ "star_func ::= COUNT",
+ /* 498 */ "star_func ::= FIRST",
+ /* 499 */ "star_func ::= LAST",
+ /* 500 */ "star_func ::= LAST_ROW",
+ /* 501 */ "star_func_para_list ::= NK_STAR",
+ /* 502 */ "star_func_para_list ::= other_para_list",
+ /* 503 */ "other_para_list ::= star_func_para",
+ /* 504 */ "other_para_list ::= other_para_list NK_COMMA star_func_para",
+ /* 505 */ "star_func_para ::= expr_or_subquery",
+ /* 506 */ "star_func_para ::= table_name NK_DOT NK_STAR",
+ /* 507 */ "case_when_expression ::= CASE when_then_list case_when_else_opt END",
+ /* 508 */ "case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END",
+ /* 509 */ "when_then_list ::= when_then_expr",
+ /* 510 */ "when_then_list ::= when_then_list when_then_expr",
+ /* 511 */ "when_then_expr ::= WHEN common_expression THEN common_expression",
+ /* 512 */ "case_when_else_opt ::=",
+ /* 513 */ "case_when_else_opt ::= ELSE common_expression",
+ /* 514 */ "predicate ::= expr_or_subquery compare_op expr_or_subquery",
+ /* 515 */ "predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery",
+ /* 516 */ "predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery",
+ /* 517 */ "predicate ::= expr_or_subquery IS NULL",
+ /* 518 */ "predicate ::= expr_or_subquery IS NOT NULL",
+ /* 519 */ "predicate ::= expr_or_subquery in_op in_predicate_value",
+ /* 520 */ "compare_op ::= NK_LT",
+ /* 521 */ "compare_op ::= NK_GT",
+ /* 522 */ "compare_op ::= NK_LE",
+ /* 523 */ "compare_op ::= NK_GE",
+ /* 524 */ "compare_op ::= NK_NE",
+ /* 525 */ "compare_op ::= NK_EQ",
+ /* 526 */ "compare_op ::= LIKE",
+ /* 527 */ "compare_op ::= NOT LIKE",
+ /* 528 */ "compare_op ::= MATCH",
+ /* 529 */ "compare_op ::= NMATCH",
+ /* 530 */ "compare_op ::= CONTAINS",
+ /* 531 */ "in_op ::= IN",
+ /* 532 */ "in_op ::= NOT IN",
+ /* 533 */ "in_predicate_value ::= NK_LP literal_list NK_RP",
+ /* 534 */ "boolean_value_expression ::= boolean_primary",
+ /* 535 */ "boolean_value_expression ::= NOT boolean_primary",
+ /* 536 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression",
+ /* 537 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression",
+ /* 538 */ "boolean_primary ::= predicate",
+ /* 539 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP",
+ /* 540 */ "common_expression ::= expr_or_subquery",
+ /* 541 */ "common_expression ::= boolean_value_expression",
+ /* 542 */ "from_clause_opt ::=",
+ /* 543 */ "from_clause_opt ::= FROM table_reference_list",
+ /* 544 */ "table_reference_list ::= table_reference",
+ /* 545 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference",
+ /* 546 */ "table_reference ::= table_primary",
+ /* 547 */ "table_reference ::= joined_table",
+ /* 548 */ "table_primary ::= table_name alias_opt",
+ /* 549 */ "table_primary ::= db_name NK_DOT table_name alias_opt",
+ /* 550 */ "table_primary ::= subquery alias_opt",
+ /* 551 */ "table_primary ::= parenthesized_joined_table",
+ /* 552 */ "alias_opt ::=",
+ /* 553 */ "alias_opt ::= table_alias",
+ /* 554 */ "alias_opt ::= AS table_alias",
+ /* 555 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP",
+ /* 556 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP",
+ /* 557 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition",
+ /* 558 */ "join_type ::=",
+ /* 559 */ "join_type ::= INNER",
+ /* 560 */ "query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt",
+ /* 561 */ "hint_list ::=",
+ /* 562 */ "hint_list ::= NK_HINT",
+ /* 563 */ "tag_mode_opt ::=",
+ /* 564 */ "tag_mode_opt ::= TAGS",
+ /* 565 */ "set_quantifier_opt ::=",
+ /* 566 */ "set_quantifier_opt ::= DISTINCT",
+ /* 567 */ "set_quantifier_opt ::= ALL",
+ /* 568 */ "select_list ::= select_item",
+ /* 569 */ "select_list ::= select_list NK_COMMA select_item",
+ /* 570 */ "select_item ::= NK_STAR",
+ /* 571 */ "select_item ::= common_expression",
+ /* 572 */ "select_item ::= common_expression column_alias",
+ /* 573 */ "select_item ::= common_expression AS column_alias",
+ /* 574 */ "select_item ::= table_name NK_DOT NK_STAR",
+ /* 575 */ "where_clause_opt ::=",
+ /* 576 */ "where_clause_opt ::= WHERE search_condition",
+ /* 577 */ "partition_by_clause_opt ::=",
+ /* 578 */ "partition_by_clause_opt ::= PARTITION BY partition_list",
+ /* 579 */ "partition_list ::= partition_item",
+ /* 580 */ "partition_list ::= partition_list NK_COMMA partition_item",
+ /* 581 */ "partition_item ::= expr_or_subquery",
+ /* 582 */ "partition_item ::= expr_or_subquery column_alias",
+ /* 583 */ "partition_item ::= expr_or_subquery AS column_alias",
+ /* 584 */ "twindow_clause_opt ::=",
+ /* 585 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP",
+ /* 586 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP",
+ /* 587 */ "twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt",
+ /* 588 */ "twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt",
+ /* 589 */ "twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition",
+ /* 590 */ "sliding_opt ::=",
+ /* 591 */ "sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP",
+ /* 592 */ "interval_sliding_duration_literal ::= NK_VARIABLE",
+ /* 593 */ "interval_sliding_duration_literal ::= NK_STRING",
+ /* 594 */ "interval_sliding_duration_literal ::= NK_INTEGER",
+ /* 595 */ "fill_opt ::=",
+ /* 596 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP",
+ /* 597 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP",
+ /* 598 */ "fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP",
+ /* 599 */ "fill_mode ::= NONE",
+ /* 600 */ "fill_mode ::= PREV",
+ /* 601 */ "fill_mode ::= NULL",
+ /* 602 */ "fill_mode ::= NULL_F",
+ /* 603 */ "fill_mode ::= LINEAR",
+ /* 604 */ "fill_mode ::= NEXT",
+ /* 605 */ "group_by_clause_opt ::=",
+ /* 606 */ "group_by_clause_opt ::= GROUP BY group_by_list",
+ /* 607 */ "group_by_list ::= expr_or_subquery",
+ /* 608 */ "group_by_list ::= group_by_list NK_COMMA expr_or_subquery",
+ /* 609 */ "having_clause_opt ::=",
+ /* 610 */ "having_clause_opt ::= HAVING search_condition",
+ /* 611 */ "range_opt ::=",
+ /* 612 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP",
+ /* 613 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_RP",
+ /* 614 */ "every_opt ::=",
+ /* 615 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP",
+ /* 616 */ "query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt",
+ /* 617 */ "query_simple ::= query_specification",
+ /* 618 */ "query_simple ::= union_query_expression",
+ /* 619 */ "union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery",
+ /* 620 */ "union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery",
+ /* 621 */ "query_simple_or_subquery ::= query_simple",
+ /* 622 */ "query_simple_or_subquery ::= subquery",
+ /* 623 */ "query_or_subquery ::= query_expression",
+ /* 624 */ "query_or_subquery ::= subquery",
+ /* 625 */ "order_by_clause_opt ::=",
+ /* 626 */ "order_by_clause_opt ::= ORDER BY sort_specification_list",
+ /* 627 */ "slimit_clause_opt ::=",
+ /* 628 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER",
+ /* 629 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER",
+ /* 630 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER",
+ /* 631 */ "limit_clause_opt ::=",
+ /* 632 */ "limit_clause_opt ::= LIMIT NK_INTEGER",
+ /* 633 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER",
+ /* 634 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER",
+ /* 635 */ "subquery ::= NK_LP query_expression NK_RP",
+ /* 636 */ "subquery ::= NK_LP subquery NK_RP",
+ /* 637 */ "search_condition ::= common_expression",
+ /* 638 */ "sort_specification_list ::= sort_specification",
+ /* 639 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification",
+ /* 640 */ "sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt",
+ /* 641 */ "ordering_specification_opt ::=",
+ /* 642 */ "ordering_specification_opt ::= ASC",
+ /* 643 */ "ordering_specification_opt ::= DESC",
+ /* 644 */ "null_ordering_opt ::=",
+ /* 645 */ "null_ordering_opt ::= NULLS FIRST",
+ /* 646 */ "null_ordering_opt ::= NULLS LAST",
};
#endif /* NDEBUG */
@@ -3173,267 +2840,233 @@ static void yy_destructor(
*/
/********* Begin destructor definitions ***************************************/
/* Default NON-TERMINAL Destructor */
- case 347: /* cmd */
- case 350: /* literal */
- case 359: /* with_opt */
- case 365: /* search_condition */
- case 370: /* db_options */
- case 372: /* alter_db_options */
- case 374: /* start_opt */
- case 375: /* end_opt */
- case 379: /* signed */
- case 381: /* retention */
- case 382: /* full_table_name */
- case 385: /* table_options */
- case 389: /* alter_table_clause */
- case 390: /* alter_table_options */
- case 393: /* signed_literal */
- case 394: /* create_subtable_clause */
- case 397: /* drop_table_clause */
- case 399: /* column_def */
- case 403: /* duration_literal */
- case 404: /* rollup_func_name */
- case 406: /* col_name */
- case 409: /* like_pattern_opt */
- case 410: /* db_name_cond_opt */
- case 411: /* table_name_cond */
- case 412: /* from_db_opt */
- case 415: /* tag_item */
- case 417: /* index_options */
- case 418: /* full_index_name */
- case 421: /* sliding_opt */
- case 422: /* sma_stream_opt */
- case 423: /* func */
- case 426: /* query_or_subquery */
- case 427: /* where_clause_opt */
- case 430: /* explain_options */
- case 431: /* insert_query */
- case 436: /* full_view_name */
- case 439: /* stream_options */
- case 442: /* subtable_opt */
- case 444: /* expression */
- case 447: /* literal_func */
- case 450: /* expr_or_subquery */
- case 451: /* pseudo_column */
- case 452: /* column_reference */
- case 453: /* function_expression */
- case 454: /* case_when_expression */
- case 459: /* star_func_para */
- case 461: /* case_when_else_opt */
- case 462: /* common_expression */
- case 463: /* when_then_expr */
- case 464: /* predicate */
- case 467: /* in_predicate_value */
- case 468: /* boolean_value_expression */
- case 469: /* boolean_primary */
- case 470: /* from_clause_opt */
- case 471: /* table_reference_list */
- case 472: /* table_reference */
- case 473: /* table_primary */
- case 474: /* joined_table */
- case 476: /* subquery */
- case 477: /* parenthesized_joined_table */
- case 479: /* query_specification */
- case 485: /* range_opt */
- case 486: /* every_opt */
- case 487: /* fill_opt */
- case 488: /* twindow_clause_opt */
- case 490: /* having_clause_opt */
- case 491: /* select_item */
- case 493: /* partition_item */
- case 494: /* interval_sliding_duration_literal */
- case 497: /* query_expression */
- case 498: /* query_simple */
- case 500: /* slimit_clause_opt */
- case 501: /* limit_clause_opt */
- case 502: /* union_query_expression */
- case 503: /* query_simple_or_subquery */
- case 505: /* sort_specification */
+ case 350: /* cmd */
+ case 353: /* literal */
+ case 362: /* with_opt */
+ case 368: /* search_condition */
+ case 373: /* db_options */
+ case 375: /* alter_db_options */
+ case 377: /* start_opt */
+ case 378: /* end_opt */
+ case 382: /* signed */
+ case 384: /* retention */
+ case 385: /* full_table_name */
+ case 388: /* table_options */
+ case 392: /* alter_table_clause */
+ case 393: /* alter_table_options */
+ case 396: /* signed_literal */
+ case 397: /* create_subtable_clause */
+ case 400: /* drop_table_clause */
+ case 402: /* column_def */
+ case 406: /* duration_literal */
+ case 407: /* rollup_func_name */
+ case 409: /* col_name */
+ case 412: /* like_pattern_opt */
+ case 413: /* db_name_cond_opt */
+ case 414: /* table_name_cond */
+ case 415: /* from_db_opt */
+ case 418: /* tag_item */
+ case 420: /* index_options */
+ case 421: /* full_index_name */
+ case 424: /* sliding_opt */
+ case 425: /* sma_stream_opt */
+ case 426: /* func */
+ case 429: /* query_or_subquery */
+ case 430: /* where_clause_opt */
+ case 433: /* explain_options */
+ case 434: /* insert_query */
+ case 439: /* full_view_name */
+ case 442: /* stream_options */
+ case 445: /* subtable_opt */
+ case 447: /* expression */
+ case 450: /* literal_func */
+ case 453: /* expr_or_subquery */
+ case 454: /* pseudo_column */
+ case 455: /* column_reference */
+ case 456: /* function_expression */
+ case 457: /* case_when_expression */
+ case 462: /* star_func_para */
+ case 464: /* case_when_else_opt */
+ case 465: /* common_expression */
+ case 466: /* when_then_expr */
+ case 467: /* predicate */
+ case 470: /* in_predicate_value */
+ case 471: /* boolean_value_expression */
+ case 472: /* boolean_primary */
+ case 473: /* from_clause_opt */
+ case 474: /* table_reference_list */
+ case 475: /* table_reference */
+ case 476: /* table_primary */
+ case 477: /* joined_table */
+ case 479: /* subquery */
+ case 480: /* parenthesized_joined_table */
+ case 482: /* query_specification */
+ case 488: /* range_opt */
+ case 489: /* every_opt */
+ case 490: /* fill_opt */
+ case 491: /* twindow_clause_opt */
+ case 493: /* having_clause_opt */
+ case 494: /* select_item */
+ case 496: /* partition_item */
+ case 497: /* interval_sliding_duration_literal */
+ case 500: /* query_expression */
+ case 501: /* query_simple */
+ case 503: /* slimit_clause_opt */
+ case 504: /* limit_clause_opt */
+ case 505: /* union_query_expression */
+ case 506: /* query_simple_or_subquery */
+ case 508: /* sort_specification */
{
-#line 7 "sql.y"
- nodesDestroyNode((yypminor->yy232));
-#line 3255 "sql.c"
+ nodesDestroyNode((yypminor->yy490));
}
break;
- case 348: /* account_options */
- case 349: /* alter_account_options */
- case 351: /* alter_account_option */
- case 373: /* speed_opt */
- case 425: /* with_meta */
- case 434: /* bufsize_opt */
+ case 351: /* account_options */
+ case 352: /* alter_account_options */
+ case 354: /* alter_account_option */
+ case 376: /* speed_opt */
+ case 428: /* with_meta */
+ case 437: /* bufsize_opt */
{
-#line 54 "sql.y"
-#line 3267 "sql.c"
}
break;
- case 352: /* ip_range_list */
- case 353: /* white_list */
- case 354: /* white_list_opt */
- case 376: /* integer_list */
- case 377: /* variable_list */
- case 378: /* retention_list */
- case 383: /* column_def_list */
- case 384: /* tags_def_opt */
- case 386: /* multi_create_clause */
- case 387: /* tags_def */
- case 388: /* multi_drop_clause */
- case 395: /* specific_cols_opt */
- case 396: /* expression_list */
- case 398: /* col_name_list */
- case 400: /* duration_list */
- case 401: /* rollup_func_list */
- case 413: /* tag_list_opt */
- case 420: /* func_list */
- case 440: /* col_list_opt */
- case 441: /* tag_def_or_ref_opt */
- case 446: /* dnode_list */
- case 448: /* literal_list */
- case 456: /* star_func_para_list */
- case 458: /* other_para_list */
- case 460: /* when_then_list */
- case 480: /* hint_list */
- case 483: /* select_list */
- case 484: /* partition_by_clause_opt */
- case 489: /* group_by_clause_opt */
- case 492: /* partition_list */
- case 496: /* group_by_list */
- case 499: /* order_by_clause_opt */
- case 504: /* sort_specification_list */
+ case 355: /* ip_range_list */
+ case 356: /* white_list */
+ case 357: /* white_list_opt */
+ case 379: /* integer_list */
+ case 380: /* variable_list */
+ case 381: /* retention_list */
+ case 386: /* column_def_list */
+ case 387: /* tags_def_opt */
+ case 389: /* multi_create_clause */
+ case 390: /* tags_def */
+ case 391: /* multi_drop_clause */
+ case 398: /* specific_cols_opt */
+ case 399: /* expression_list */
+ case 401: /* col_name_list */
+ case 403: /* duration_list */
+ case 404: /* rollup_func_list */
+ case 416: /* tag_list_opt */
+ case 423: /* func_list */
+ case 443: /* col_list_opt */
+ case 444: /* tag_def_or_ref_opt */
+ case 449: /* dnode_list */
+ case 451: /* literal_list */
+ case 459: /* star_func_para_list */
+ case 461: /* other_para_list */
+ case 463: /* when_then_list */
+ case 483: /* hint_list */
+ case 486: /* select_list */
+ case 487: /* partition_by_clause_opt */
+ case 492: /* group_by_clause_opt */
+ case 495: /* partition_list */
+ case 499: /* group_by_list */
+ case 502: /* order_by_clause_opt */
+ case 507: /* sort_specification_list */
{
-#line 85 "sql.y"
- nodesDestroyList((yypminor->yy88));
-#line 3306 "sql.c"
+ nodesDestroyList((yypminor->yy502));
}
break;
- case 355: /* user_name */
- case 362: /* db_name */
- case 363: /* table_name */
- case 364: /* topic_name */
- case 366: /* dnode_endpoint */
- case 391: /* column_name */
- case 405: /* function_name */
- case 416: /* column_alias */
- case 419: /* index_name */
- case 424: /* sma_func_name */
- case 428: /* cgroup_name */
- case 435: /* language_opt */
- case 437: /* view_name */
- case 438: /* stream_name */
- case 445: /* on_vgroup_id */
- case 449: /* table_alias */
- case 455: /* star_func */
- case 457: /* noarg_func */
- case 475: /* alias_opt */
+ case 358: /* user_name */
+ case 365: /* db_name */
+ case 366: /* table_name */
+ case 367: /* topic_name */
+ case 369: /* dnode_endpoint */
+ case 394: /* column_name */
+ case 408: /* function_name */
+ case 419: /* column_alias */
+ case 422: /* index_name */
+ case 427: /* sma_func_name */
+ case 431: /* cgroup_name */
+ case 438: /* language_opt */
+ case 440: /* view_name */
+ case 441: /* stream_name */
+ case 448: /* on_vgroup_id */
+ case 452: /* table_alias */
+ case 458: /* star_func */
+ case 460: /* noarg_func */
+ case 478: /* alias_opt */
{
-#line 812 "sql.y"
-#line 3331 "sql.c"
}
break;
- case 356: /* sysinfo_opt */
+ case 359: /* sysinfo_opt */
{
-#line 112 "sql.y"
-#line 3338 "sql.c"
}
break;
- case 357: /* privileges */
- case 360: /* priv_type_list */
- case 361: /* priv_type */
+ case 360: /* privileges */
+ case 363: /* priv_type_list */
+ case 364: /* priv_type */
{
-#line 121 "sql.y"
-#line 3347 "sql.c"
}
break;
- case 358: /* priv_level */
+ case 361: /* priv_level */
{
-#line 138 "sql.y"
-#line 3354 "sql.c"
}
break;
- case 367: /* force_opt */
- case 368: /* unsafe_opt */
- case 369: /* not_exists_opt */
- case 371: /* exists_opt */
- case 429: /* analyze_opt */
- case 432: /* or_replace_opt */
- case 433: /* agg_func_opt */
- case 443: /* ignore_opt */
- case 481: /* set_quantifier_opt */
- case 482: /* tag_mode_opt */
+ case 370: /* force_opt */
+ case 371: /* unsafe_opt */
+ case 372: /* not_exists_opt */
+ case 374: /* exists_opt */
+ case 432: /* analyze_opt */
+ case 435: /* or_replace_opt */
+ case 436: /* agg_func_opt */
+ case 446: /* ignore_opt */
+ case 484: /* set_quantifier_opt */
+ case 485: /* tag_mode_opt */
{
-#line 167 "sql.y"
-#line 3370 "sql.c"
}
break;
- case 380: /* alter_db_option */
- case 402: /* alter_table_option */
+ case 383: /* alter_db_option */
+ case 405: /* alter_table_option */
{
-#line 265 "sql.y"
-#line 3378 "sql.c"
}
break;
- case 392: /* type_name */
+ case 395: /* type_name */
{
-#line 388 "sql.y"
-#line 3385 "sql.c"
}
break;
- case 407: /* db_kind_opt */
- case 414: /* table_kind */
+ case 410: /* db_kind_opt */
+ case 417: /* table_kind */
{
-#line 553 "sql.y"
-#line 3393 "sql.c"
}
break;
- case 408: /* table_kind_db_name_cond_opt */
+ case 411: /* table_kind_db_name_cond_opt */
{
-#line 518 "sql.y"
-#line 3400 "sql.c"
}
break;
- case 465: /* compare_op */
- case 466: /* in_op */
+ case 468: /* compare_op */
+ case 469: /* in_op */
{
-#line 1002 "sql.y"
-#line 3408 "sql.c"
}
break;
- case 478: /* join_type */
+ case 481: /* join_type */
{
-#line 1078 "sql.y"
-#line 3415 "sql.c"
}
break;
- case 495: /* fill_mode */
+ case 498: /* fill_mode */
{
-#line 1169 "sql.y"
-#line 3422 "sql.c"
}
break;
- case 506: /* ordering_specification_opt */
+ case 509: /* ordering_specification_opt */
{
-#line 1254 "sql.y"
-#line 3429 "sql.c"
}
break;
- case 507: /* null_ordering_opt */
+ case 510: /* null_ordering_opt */
{
-#line 1260 "sql.y"
-#line 3436 "sql.c"
}
break;
/********* End destructor definitions *****************************************/
@@ -3600,7 +3233,7 @@ static YYACTIONTYPE yy_find_shift_action(
#endif /* YYWILDCARD */
return yy_default[stateno];
}else{
- assert( i>=0 && i<(int)(sizeof(yy_action)/sizeof(yy_action[0])) );
+ assert( i>=0 && iyytos;
+#ifndef NDEBUG
+ if( yyTraceFILE && yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ){
+ yysize = yyRuleInfoNRhs[yyruleno];
+ if( yysize ){
+ fprintf(yyTraceFILE, "%sReduce %d [%s]%s, pop back to state %d.\n",
+ yyTracePrompt,
+ yyruleno, yyRuleName[yyruleno],
+ yyrulenoyytos - yypParser->yystack)>yypParser->yyhwm ){
+ yypParser->yyhwm++;
+ assert( yypParser->yyhwm == (int)(yypParser->yytos - yypParser->yystack));
+ }
+#endif
+#if YYSTACKDEPTH>0
+ if( yypParser->yytos>=yypParser->yystackEnd ){
+ yyStackOverflow(yypParser);
+ /* The call to yyStackOverflow() above pops the stack until it is
+ ** empty, causing the main parser loop to exit. So the return value
+ ** is never used and does not matter. */
+ return 0;
+ }
+#else
+ if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz-1] ){
+ if( yyGrowStack(yypParser) ){
+ yyStackOverflow(yypParser);
+ /* The call to yyStackOverflow() above pops the stack until it is
+ ** empty, causing the main parser loop to exit. So the return value
+ ** is never used and does not matter. */
+ return 0;
+ }
+ yymsp = yypParser->yytos;
+ }
+#endif
+ }
switch( yyruleno ){
/* Beginning here are the reduction cases. A typical example
@@ -5053,21 +4744,15 @@ static YYACTIONTYPE yy_reduce(
/********** Begin reduce actions **********************************************/
YYMINORTYPE yylhsminor;
case 0: /* cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */
-#line 50 "sql.y"
{ pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); }
-#line 5058 "sql.c"
- yy_destructor(yypParser,348,&yymsp[0].minor);
+ yy_destructor(yypParser,351,&yymsp[0].minor);
break;
case 1: /* cmd ::= ALTER ACCOUNT NK_ID alter_account_options */
-#line 51 "sql.y"
{ pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); }
-#line 5064 "sql.c"
- yy_destructor(yypParser,349,&yymsp[0].minor);
+ yy_destructor(yypParser,352,&yymsp[0].minor);
break;
case 2: /* account_options ::= */
-#line 55 "sql.y"
{ }
-#line 5070 "sql.c"
break;
case 3: /* account_options ::= account_options PPS literal */
case 4: /* account_options ::= account_options TSERIES literal */ yytestcase(yyruleno==4);
@@ -5078,26 +4763,20 @@ static YYACTIONTYPE yy_reduce(
case 9: /* account_options ::= account_options USERS literal */ yytestcase(yyruleno==9);
case 10: /* account_options ::= account_options CONNS literal */ yytestcase(yyruleno==10);
case 11: /* account_options ::= account_options STATE literal */ yytestcase(yyruleno==11);
-{ yy_destructor(yypParser,348,&yymsp[-2].minor);
-#line 56 "sql.y"
+{ yy_destructor(yypParser,351,&yymsp[-2].minor);
{ }
-#line 5084 "sql.c"
- yy_destructor(yypParser,350,&yymsp[0].minor);
+ yy_destructor(yypParser,353,&yymsp[0].minor);
}
break;
case 12: /* alter_account_options ::= alter_account_option */
-{ yy_destructor(yypParser,351,&yymsp[0].minor);
-#line 68 "sql.y"
+{ yy_destructor(yypParser,354,&yymsp[0].minor);
{ }
-#line 5092 "sql.c"
}
break;
case 13: /* alter_account_options ::= alter_account_options alter_account_option */
-{ yy_destructor(yypParser,349,&yymsp[-1].minor);
-#line 69 "sql.y"
+{ yy_destructor(yypParser,352,&yymsp[-1].minor);
{ }
-#line 5099 "sql.c"
- yy_destructor(yypParser,351,&yymsp[0].minor);
+ yy_destructor(yypParser,354,&yymsp[0].minor);
}
break;
case 14: /* alter_account_option ::= PASS literal */
@@ -5110,2633 +4789,1786 @@ static YYACTIONTYPE yy_reduce(
case 21: /* alter_account_option ::= USERS literal */ yytestcase(yyruleno==21);
case 22: /* alter_account_option ::= CONNS literal */ yytestcase(yyruleno==22);
case 23: /* alter_account_option ::= STATE literal */ yytestcase(yyruleno==23);
-#line 73 "sql.y"
{ }
-#line 5115 "sql.c"
- yy_destructor(yypParser,350,&yymsp[0].minor);
+ yy_destructor(yypParser,353,&yymsp[0].minor);
break;
case 24: /* ip_range_list ::= NK_STRING */
-#line 86 "sql.y"
-{ yylhsminor.yy88 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); }
-#line 5121 "sql.c"
- yymsp[0].minor.yy88 = yylhsminor.yy88;
+{ yylhsminor.yy502 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy502 = yylhsminor.yy502;
break;
case 25: /* ip_range_list ::= ip_range_list NK_COMMA NK_STRING */
-#line 87 "sql.y"
-{ yylhsminor.yy88 = addNodeToList(pCxt, yymsp[-2].minor.yy88, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); }
-#line 5127 "sql.c"
- yymsp[-2].minor.yy88 = yylhsminor.yy88;
+{ yylhsminor.yy502 = addNodeToList(pCxt, yymsp[-2].minor.yy502, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); }
+ yymsp[-2].minor.yy502 = yylhsminor.yy502;
break;
case 26: /* white_list ::= HOST ip_range_list */
-#line 91 "sql.y"
-{ yymsp[-1].minor.yy88 = yymsp[0].minor.yy88; }
-#line 5133 "sql.c"
+{ yymsp[-1].minor.yy502 = yymsp[0].minor.yy502; }
break;
case 27: /* white_list_opt ::= */
- case 186: /* specific_cols_opt ::= */ yytestcase(yyruleno==186);
- case 217: /* tags_def_opt ::= */ yytestcase(yyruleno==217);
- case 302: /* tag_list_opt ::= */ yytestcase(yyruleno==302);
- case 368: /* col_list_opt ::= */ yytestcase(yyruleno==368);
- case 370: /* tag_def_or_ref_opt ::= */ yytestcase(yyruleno==370);
- case 572: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==572);
- case 600: /* group_by_clause_opt ::= */ yytestcase(yyruleno==600);
- case 620: /* order_by_clause_opt ::= */ yytestcase(yyruleno==620);
-#line 95 "sql.y"
-{ yymsp[1].minor.yy88 = NULL; }
-#line 5146 "sql.c"
+ case 188: /* specific_cols_opt ::= */ yytestcase(yyruleno==188);
+ case 219: /* tags_def_opt ::= */ yytestcase(yyruleno==219);
+ case 307: /* tag_list_opt ::= */ yytestcase(yyruleno==307);
+ case 373: /* col_list_opt ::= */ yytestcase(yyruleno==373);
+ case 375: /* tag_def_or_ref_opt ::= */ yytestcase(yyruleno==375);
+ case 577: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==577);
+ case 605: /* group_by_clause_opt ::= */ yytestcase(yyruleno==605);
+ case 625: /* order_by_clause_opt ::= */ yytestcase(yyruleno==625);
+{ yymsp[1].minor.yy502 = NULL; }
break;
case 28: /* white_list_opt ::= white_list */
- case 218: /* tags_def_opt ::= tags_def */ yytestcase(yyruleno==218);
- case 371: /* tag_def_or_ref_opt ::= tags_def */ yytestcase(yyruleno==371);
- case 497: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==497);
-#line 96 "sql.y"
-{ yylhsminor.yy88 = yymsp[0].minor.yy88; }
-#line 5154 "sql.c"
- yymsp[0].minor.yy88 = yylhsminor.yy88;
+ case 220: /* tags_def_opt ::= tags_def */ yytestcase(yyruleno==220);
+ case 376: /* tag_def_or_ref_opt ::= tags_def */ yytestcase(yyruleno==376);
+ case 502: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==502);
+{ yylhsminor.yy502 = yymsp[0].minor.yy502; }
+ yymsp[0].minor.yy502 = yylhsminor.yy502;
break;
case 29: /* cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt white_list_opt */
-#line 100 "sql.y"
{
- pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-4].minor.yy993, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy279);
- pCxt->pRootNode = addCreateUserStmtWhiteList(pCxt, pCxt->pRootNode, yymsp[0].minor.yy88);
+ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-4].minor.yy561, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy1013);
+ pCxt->pRootNode = addCreateUserStmtWhiteList(pCxt, pCxt->pRootNode, yymsp[0].minor.yy502);
}
-#line 5163 "sql.c"
break;
case 30: /* cmd ::= ALTER USER user_name PASS NK_STRING */
-#line 104 "sql.y"
-{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy993, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); }
-#line 5168 "sql.c"
+{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy561, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); }
break;
case 31: /* cmd ::= ALTER USER user_name ENABLE NK_INTEGER */
-#line 105 "sql.y"
-{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy993, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); }
-#line 5173 "sql.c"
+{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy561, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); }
break;
case 32: /* cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */
-#line 106 "sql.y"
-{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy993, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); }
-#line 5178 "sql.c"
+{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy561, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); }
break;
case 33: /* cmd ::= ALTER USER user_name ADD white_list */
-#line 107 "sql.y"
-{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy993, TSDB_ALTER_USER_ADD_WHITE_LIST, yymsp[0].minor.yy88); }
-#line 5183 "sql.c"
+{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy561, TSDB_ALTER_USER_ADD_WHITE_LIST, yymsp[0].minor.yy502); }
break;
case 34: /* cmd ::= ALTER USER user_name DROP white_list */
-#line 108 "sql.y"
-{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy993, TSDB_ALTER_USER_DROP_WHITE_LIST, yymsp[0].minor.yy88); }
-#line 5188 "sql.c"
+{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy561, TSDB_ALTER_USER_DROP_WHITE_LIST, yymsp[0].minor.yy502); }
break;
case 35: /* cmd ::= DROP USER user_name */
-#line 109 "sql.y"
-{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy993); }
-#line 5193 "sql.c"
+{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy561); }
break;
case 36: /* sysinfo_opt ::= */
-#line 113 "sql.y"
-{ yymsp[1].minor.yy279 = 1; }
-#line 5198 "sql.c"
+{ yymsp[1].minor.yy1013 = 1; }
break;
case 37: /* sysinfo_opt ::= SYSINFO NK_INTEGER */
-#line 114 "sql.y"
-{ yymsp[-1].minor.yy279 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); }
-#line 5203 "sql.c"
+{ yymsp[-1].minor.yy1013 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); }
break;
case 38: /* cmd ::= GRANT privileges ON priv_level with_opt TO user_name */
-#line 117 "sql.y"
-{ pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-5].minor.yy221, &yymsp[-3].minor.yy241, &yymsp[0].minor.yy993, yymsp[-2].minor.yy232); }
-#line 5208 "sql.c"
+{ pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-5].minor.yy277, &yymsp[-3].minor.yy483, &yymsp[0].minor.yy561, yymsp[-2].minor.yy490); }
break;
case 39: /* cmd ::= REVOKE privileges ON priv_level with_opt FROM user_name */
-#line 118 "sql.y"
-{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-5].minor.yy221, &yymsp[-3].minor.yy241, &yymsp[0].minor.yy993, yymsp[-2].minor.yy232); }
-#line 5213 "sql.c"
+{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-5].minor.yy277, &yymsp[-3].minor.yy483, &yymsp[0].minor.yy561, yymsp[-2].minor.yy490); }
break;
case 40: /* privileges ::= ALL */
-#line 122 "sql.y"
-{ yymsp[0].minor.yy221 = PRIVILEGE_TYPE_ALL; }
-#line 5218 "sql.c"
+{ yymsp[0].minor.yy277 = PRIVILEGE_TYPE_ALL; }
break;
case 41: /* privileges ::= priv_type_list */
case 43: /* priv_type_list ::= priv_type */ yytestcase(yyruleno==43);
-#line 123 "sql.y"
-{ yylhsminor.yy221 = yymsp[0].minor.yy221; }
-#line 5224 "sql.c"
- yymsp[0].minor.yy221 = yylhsminor.yy221;
+{ yylhsminor.yy277 = yymsp[0].minor.yy277; }
+ yymsp[0].minor.yy277 = yylhsminor.yy277;
break;
case 42: /* privileges ::= SUBSCRIBE */
-#line 124 "sql.y"
-{ yymsp[0].minor.yy221 = PRIVILEGE_TYPE_SUBSCRIBE; }
-#line 5230 "sql.c"
+{ yymsp[0].minor.yy277 = PRIVILEGE_TYPE_SUBSCRIBE; }
break;
case 44: /* priv_type_list ::= priv_type_list NK_COMMA priv_type */
-#line 129 "sql.y"
-{ yylhsminor.yy221 = yymsp[-2].minor.yy221 | yymsp[0].minor.yy221; }
-#line 5235 "sql.c"
- yymsp[-2].minor.yy221 = yylhsminor.yy221;
+{ yylhsminor.yy277 = yymsp[-2].minor.yy277 | yymsp[0].minor.yy277; }
+ yymsp[-2].minor.yy277 = yylhsminor.yy277;
break;
case 45: /* priv_type ::= READ */
-#line 133 "sql.y"
-{ yymsp[0].minor.yy221 = PRIVILEGE_TYPE_READ; }
-#line 5241 "sql.c"
+{ yymsp[0].minor.yy277 = PRIVILEGE_TYPE_READ; }
break;
case 46: /* priv_type ::= WRITE */
-#line 134 "sql.y"
-{ yymsp[0].minor.yy221 = PRIVILEGE_TYPE_WRITE; }
-#line 5246 "sql.c"
+{ yymsp[0].minor.yy277 = PRIVILEGE_TYPE_WRITE; }
break;
case 47: /* priv_type ::= ALTER */
-#line 135 "sql.y"
-{ yymsp[0].minor.yy221 = PRIVILEGE_TYPE_ALTER; }
-#line 5251 "sql.c"
+{ yymsp[0].minor.yy277 = PRIVILEGE_TYPE_ALTER; }
break;
case 48: /* priv_level ::= NK_STAR NK_DOT NK_STAR */
-#line 139 "sql.y"
-{ yylhsminor.yy241.first = yymsp[-2].minor.yy0; yylhsminor.yy241.second = yymsp[0].minor.yy0; }
-#line 5256 "sql.c"
- yymsp[-2].minor.yy241 = yylhsminor.yy241;
+{ yylhsminor.yy483.first = yymsp[-2].minor.yy0; yylhsminor.yy483.second = yymsp[0].minor.yy0; }
+ yymsp[-2].minor.yy483 = yylhsminor.yy483;
break;
case 49: /* priv_level ::= db_name NK_DOT NK_STAR */
-#line 140 "sql.y"
-{ yylhsminor.yy241.first = yymsp[-2].minor.yy993; yylhsminor.yy241.second = yymsp[0].minor.yy0; }
-#line 5262 "sql.c"
- yymsp[-2].minor.yy241 = yylhsminor.yy241;
+{ yylhsminor.yy483.first = yymsp[-2].minor.yy561; yylhsminor.yy483.second = yymsp[0].minor.yy0; }
+ yymsp[-2].minor.yy483 = yylhsminor.yy483;
break;
case 50: /* priv_level ::= db_name NK_DOT table_name */
-#line 141 "sql.y"
-{ yylhsminor.yy241.first = yymsp[-2].minor.yy993; yylhsminor.yy241.second = yymsp[0].minor.yy993; }
-#line 5268 "sql.c"
- yymsp[-2].minor.yy241 = yylhsminor.yy241;
+{ yylhsminor.yy483.first = yymsp[-2].minor.yy561; yylhsminor.yy483.second = yymsp[0].minor.yy561; }
+ yymsp[-2].minor.yy483 = yylhsminor.yy483;
break;
case 51: /* priv_level ::= topic_name */
-#line 142 "sql.y"
-{ yylhsminor.yy241.first = yymsp[0].minor.yy993; yylhsminor.yy241.second = nil_token; }
-#line 5274 "sql.c"
- yymsp[0].minor.yy241 = yylhsminor.yy241;
+{ yylhsminor.yy483.first = yymsp[0].minor.yy561; yylhsminor.yy483.second = nil_token; }
+ yymsp[0].minor.yy483 = yylhsminor.yy483;
break;
case 52: /* with_opt ::= */
- case 155: /* start_opt ::= */ yytestcase(yyruleno==155);
- case 159: /* end_opt ::= */ yytestcase(yyruleno==159);
- case 297: /* like_pattern_opt ::= */ yytestcase(yyruleno==297);
- case 382: /* subtable_opt ::= */ yytestcase(yyruleno==382);
- case 507: /* case_when_else_opt ::= */ yytestcase(yyruleno==507);
- case 537: /* from_clause_opt ::= */ yytestcase(yyruleno==537);
- case 570: /* where_clause_opt ::= */ yytestcase(yyruleno==570);
- case 579: /* twindow_clause_opt ::= */ yytestcase(yyruleno==579);
- case 585: /* sliding_opt ::= */ yytestcase(yyruleno==585);
- case 590: /* fill_opt ::= */ yytestcase(yyruleno==590);
- case 604: /* having_clause_opt ::= */ yytestcase(yyruleno==604);
- case 606: /* range_opt ::= */ yytestcase(yyruleno==606);
- case 609: /* every_opt ::= */ yytestcase(yyruleno==609);
- case 622: /* slimit_clause_opt ::= */ yytestcase(yyruleno==622);
- case 626: /* limit_clause_opt ::= */ yytestcase(yyruleno==626);
-#line 144 "sql.y"
-{ yymsp[1].minor.yy232 = NULL; }
-#line 5295 "sql.c"
+ case 157: /* start_opt ::= */ yytestcase(yyruleno==157);
+ case 161: /* end_opt ::= */ yytestcase(yyruleno==161);
+ case 302: /* like_pattern_opt ::= */ yytestcase(yyruleno==302);
+ case 387: /* subtable_opt ::= */ yytestcase(yyruleno==387);
+ case 512: /* case_when_else_opt ::= */ yytestcase(yyruleno==512);
+ case 542: /* from_clause_opt ::= */ yytestcase(yyruleno==542);
+ case 575: /* where_clause_opt ::= */ yytestcase(yyruleno==575);
+ case 584: /* twindow_clause_opt ::= */ yytestcase(yyruleno==584);
+ case 590: /* sliding_opt ::= */ yytestcase(yyruleno==590);
+ case 595: /* fill_opt ::= */ yytestcase(yyruleno==595);
+ case 609: /* having_clause_opt ::= */ yytestcase(yyruleno==609);
+ case 611: /* range_opt ::= */ yytestcase(yyruleno==611);
+ case 614: /* every_opt ::= */ yytestcase(yyruleno==614);
+ case 627: /* slimit_clause_opt ::= */ yytestcase(yyruleno==627);
+ case 631: /* limit_clause_opt ::= */ yytestcase(yyruleno==631);
+{ yymsp[1].minor.yy490 = NULL; }
break;
case 53: /* with_opt ::= WITH search_condition */
- case 538: /* from_clause_opt ::= FROM table_reference_list */ yytestcase(yyruleno==538);
- case 571: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==571);
- case 605: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==605);
-#line 145 "sql.y"
-{ yymsp[-1].minor.yy232 = yymsp[0].minor.yy232; }
-#line 5303 "sql.c"
+ case 543: /* from_clause_opt ::= FROM table_reference_list */ yytestcase(yyruleno==543);
+ case 576: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==576);
+ case 610: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==610);
+{ yymsp[-1].minor.yy490 = yymsp[0].minor.yy490; }
break;
case 54: /* cmd ::= CREATE DNODE dnode_endpoint */
-#line 148 "sql.y"
-{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy993, NULL); }
-#line 5308 "sql.c"
+{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy561, NULL); }
break;
case 55: /* cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */
-#line 149 "sql.y"
-{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy993, &yymsp[0].minor.yy0); }
-#line 5313 "sql.c"
+{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy561, &yymsp[0].minor.yy0); }
break;
case 56: /* cmd ::= DROP DNODE NK_INTEGER force_opt */
-#line 150 "sql.y"
-{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy985, false); }
-#line 5318 "sql.c"
+{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy845, false); }
break;
case 57: /* cmd ::= DROP DNODE dnode_endpoint force_opt */
-#line 151 "sql.y"
-{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy993, yymsp[0].minor.yy985, false); }
-#line 5323 "sql.c"
+{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy561, yymsp[0].minor.yy845, false); }
break;
case 58: /* cmd ::= DROP DNODE NK_INTEGER unsafe_opt */
-#line 152 "sql.y"
-{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, false, yymsp[0].minor.yy985); }
-#line 5328 "sql.c"
+{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, false, yymsp[0].minor.yy845); }
break;
case 59: /* cmd ::= DROP DNODE dnode_endpoint unsafe_opt */
-#line 153 "sql.y"
-{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy993, false, yymsp[0].minor.yy985); }
-#line 5333 "sql.c"
+{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy561, false, yymsp[0].minor.yy845); }
break;
case 60: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING */
-#line 154 "sql.y"
{ pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, NULL); }
-#line 5338 "sql.c"
break;
case 61: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */
-#line 155 "sql.y"
{ pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-2].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); }
-#line 5343 "sql.c"
break;
case 62: /* cmd ::= ALTER ALL DNODES NK_STRING */
-#line 156 "sql.y"
{ pCxt->pRootNode = createAlterDnodeStmt(pCxt, NULL, &yymsp[0].minor.yy0, NULL); }
-#line 5348 "sql.c"
break;
case 63: /* cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */
-#line 157 "sql.y"
{ pCxt->pRootNode = createAlterDnodeStmt(pCxt, NULL, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); }
-#line 5353 "sql.c"
break;
case 64: /* cmd ::= RESTORE DNODE NK_INTEGER */
-#line 158 "sql.y"
{ pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_DNODE_STMT, &yymsp[0].minor.yy0); }
-#line 5358 "sql.c"
break;
case 65: /* dnode_endpoint ::= NK_STRING */
case 66: /* dnode_endpoint ::= NK_ID */ yytestcase(yyruleno==66);
case 67: /* dnode_endpoint ::= NK_IPTOKEN */ yytestcase(yyruleno==67);
- case 324: /* sma_func_name ::= COUNT */ yytestcase(yyruleno==324);
- case 325: /* sma_func_name ::= FIRST */ yytestcase(yyruleno==325);
- case 326: /* sma_func_name ::= LAST */ yytestcase(yyruleno==326);
- case 327: /* sma_func_name ::= LAST_ROW */ yytestcase(yyruleno==327);
- case 429: /* db_name ::= NK_ID */ yytestcase(yyruleno==429);
- case 430: /* table_name ::= NK_ID */ yytestcase(yyruleno==430);
- case 431: /* column_name ::= NK_ID */ yytestcase(yyruleno==431);
- case 432: /* function_name ::= NK_ID */ yytestcase(yyruleno==432);
- case 433: /* view_name ::= NK_ID */ yytestcase(yyruleno==433);
- case 434: /* table_alias ::= NK_ID */ yytestcase(yyruleno==434);
- case 435: /* column_alias ::= NK_ID */ yytestcase(yyruleno==435);
- case 436: /* column_alias ::= NK_ALIAS */ yytestcase(yyruleno==436);
- case 437: /* user_name ::= NK_ID */ yytestcase(yyruleno==437);
- case 438: /* topic_name ::= NK_ID */ yytestcase(yyruleno==438);
- case 439: /* stream_name ::= NK_ID */ yytestcase(yyruleno==439);
- case 440: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==440);
- case 441: /* index_name ::= NK_ID */ yytestcase(yyruleno==441);
- case 483: /* noarg_func ::= NOW */ yytestcase(yyruleno==483);
- case 484: /* noarg_func ::= TODAY */ yytestcase(yyruleno==484);
- case 485: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==485);
- case 486: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==486);
- case 487: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==487);
- case 488: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==488);
- case 489: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==489);
- case 490: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==490);
- case 491: /* noarg_func ::= USER */ yytestcase(yyruleno==491);
- case 492: /* star_func ::= COUNT */ yytestcase(yyruleno==492);
- case 493: /* star_func ::= FIRST */ yytestcase(yyruleno==493);
- case 494: /* star_func ::= LAST */ yytestcase(yyruleno==494);
- case 495: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==495);
-#line 162 "sql.y"
-{ yylhsminor.yy993 = yymsp[0].minor.yy0; }
-#line 5395 "sql.c"
- yymsp[0].minor.yy993 = yylhsminor.yy993;
+ case 329: /* sma_func_name ::= COUNT */ yytestcase(yyruleno==329);
+ case 330: /* sma_func_name ::= FIRST */ yytestcase(yyruleno==330);
+ case 331: /* sma_func_name ::= LAST */ yytestcase(yyruleno==331);
+ case 332: /* sma_func_name ::= LAST_ROW */ yytestcase(yyruleno==332);
+ case 434: /* db_name ::= NK_ID */ yytestcase(yyruleno==434);
+ case 435: /* table_name ::= NK_ID */ yytestcase(yyruleno==435);
+ case 436: /* column_name ::= NK_ID */ yytestcase(yyruleno==436);
+ case 437: /* function_name ::= NK_ID */ yytestcase(yyruleno==437);
+ case 438: /* view_name ::= NK_ID */ yytestcase(yyruleno==438);
+ case 439: /* table_alias ::= NK_ID */ yytestcase(yyruleno==439);
+ case 440: /* column_alias ::= NK_ID */ yytestcase(yyruleno==440);
+ case 441: /* column_alias ::= NK_ALIAS */ yytestcase(yyruleno==441);
+ case 442: /* user_name ::= NK_ID */ yytestcase(yyruleno==442);
+ case 443: /* topic_name ::= NK_ID */ yytestcase(yyruleno==443);
+ case 444: /* stream_name ::= NK_ID */ yytestcase(yyruleno==444);
+ case 445: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==445);
+ case 446: /* index_name ::= NK_ID */ yytestcase(yyruleno==446);
+ case 488: /* noarg_func ::= NOW */ yytestcase(yyruleno==488);
+ case 489: /* noarg_func ::= TODAY */ yytestcase(yyruleno==489);
+ case 490: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==490);
+ case 491: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==491);
+ case 492: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==492);
+ case 493: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==493);
+ case 494: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==494);
+ case 495: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==495);
+ case 496: /* noarg_func ::= USER */ yytestcase(yyruleno==496);
+ case 497: /* star_func ::= COUNT */ yytestcase(yyruleno==497);
+ case 498: /* star_func ::= FIRST */ yytestcase(yyruleno==498);
+ case 499: /* star_func ::= LAST */ yytestcase(yyruleno==499);
+ case 500: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==500);
+{ yylhsminor.yy561 = yymsp[0].minor.yy0; }
+ yymsp[0].minor.yy561 = yylhsminor.yy561;
break;
case 68: /* force_opt ::= */
- case 92: /* not_exists_opt ::= */ yytestcase(yyruleno==92);
- case 94: /* exists_opt ::= */ yytestcase(yyruleno==94);
- case 345: /* analyze_opt ::= */ yytestcase(yyruleno==345);
- case 352: /* agg_func_opt ::= */ yytestcase(yyruleno==352);
- case 358: /* or_replace_opt ::= */ yytestcase(yyruleno==358);
- case 384: /* ignore_opt ::= */ yytestcase(yyruleno==384);
- case 558: /* tag_mode_opt ::= */ yytestcase(yyruleno==558);
- case 560: /* set_quantifier_opt ::= */ yytestcase(yyruleno==560);
-#line 168 "sql.y"
-{ yymsp[1].minor.yy985 = false; }
-#line 5409 "sql.c"
+ case 94: /* not_exists_opt ::= */ yytestcase(yyruleno==94);
+ case 96: /* exists_opt ::= */ yytestcase(yyruleno==96);
+ case 350: /* analyze_opt ::= */ yytestcase(yyruleno==350);
+ case 357: /* agg_func_opt ::= */ yytestcase(yyruleno==357);
+ case 363: /* or_replace_opt ::= */ yytestcase(yyruleno==363);
+ case 389: /* ignore_opt ::= */ yytestcase(yyruleno==389);
+ case 563: /* tag_mode_opt ::= */ yytestcase(yyruleno==563);
+ case 565: /* set_quantifier_opt ::= */ yytestcase(yyruleno==565);
+{ yymsp[1].minor.yy845 = false; }
break;
case 69: /* force_opt ::= FORCE */
case 70: /* unsafe_opt ::= UNSAFE */ yytestcase(yyruleno==70);
- case 346: /* analyze_opt ::= ANALYZE */ yytestcase(yyruleno==346);
- case 353: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==353);
- case 559: /* tag_mode_opt ::= TAGS */ yytestcase(yyruleno==559);
- case 561: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==561);
-#line 169 "sql.y"
-{ yymsp[0].minor.yy985 = true; }
-#line 5419 "sql.c"
+ case 351: /* analyze_opt ::= ANALYZE */ yytestcase(yyruleno==351);
+ case 358: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==358);
+ case 564: /* tag_mode_opt ::= TAGS */ yytestcase(yyruleno==564);
+ case 566: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==566);
+{ yymsp[0].minor.yy845 = true; }
break;
- case 71: /* cmd ::= ALTER LOCAL NK_STRING */
-#line 176 "sql.y"
+ case 71: /* cmd ::= ALTER CLUSTER NK_STRING */
+{ pCxt->pRootNode = createAlterClusterStmt(pCxt, &yymsp[0].minor.yy0, NULL); }
+ break;
+ case 72: /* cmd ::= ALTER CLUSTER NK_STRING NK_STRING */
+{ pCxt->pRootNode = createAlterClusterStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); }
+ break;
+ case 73: /* cmd ::= ALTER LOCAL NK_STRING */
{ pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[0].minor.yy0, NULL); }
-#line 5424 "sql.c"
break;
- case 72: /* cmd ::= ALTER LOCAL NK_STRING NK_STRING */
-#line 177 "sql.y"
+ case 74: /* cmd ::= ALTER LOCAL NK_STRING NK_STRING */
{ pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); }
-#line 5429 "sql.c"
break;
- case 73: /* cmd ::= CREATE QNODE ON DNODE NK_INTEGER */
-#line 180 "sql.y"
+ case 75: /* cmd ::= CREATE QNODE ON DNODE NK_INTEGER */
{ pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_QNODE_STMT, &yymsp[0].minor.yy0); }
-#line 5434 "sql.c"
break;
- case 74: /* cmd ::= DROP QNODE ON DNODE NK_INTEGER */
-#line 181 "sql.y"
+ case 76: /* cmd ::= DROP QNODE ON DNODE NK_INTEGER */
{ pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_QNODE_STMT, &yymsp[0].minor.yy0); }
-#line 5439 "sql.c"
break;
- case 75: /* cmd ::= RESTORE QNODE ON DNODE NK_INTEGER */
-#line 182 "sql.y"
+ case 77: /* cmd ::= RESTORE QNODE ON DNODE NK_INTEGER */
{ pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_QNODE_STMT, &yymsp[0].minor.yy0); }
-#line 5444 "sql.c"
break;
- case 76: /* cmd ::= CREATE BNODE ON DNODE NK_INTEGER */
-#line 185 "sql.y"
+ case 78: /* cmd ::= CREATE BNODE ON DNODE NK_INTEGER */
{ pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_BNODE_STMT, &yymsp[0].minor.yy0); }
-#line 5449 "sql.c"
break;
- case 77: /* cmd ::= DROP BNODE ON DNODE NK_INTEGER */
-#line 186 "sql.y"
+ case 79: /* cmd ::= DROP BNODE ON DNODE NK_INTEGER */
{ pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_BNODE_STMT, &yymsp[0].minor.yy0); }
-#line 5454 "sql.c"
break;
- case 78: /* cmd ::= CREATE SNODE ON DNODE NK_INTEGER */
-#line 189 "sql.y"
+ case 80: /* cmd ::= CREATE SNODE ON DNODE NK_INTEGER */
{ pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_SNODE_STMT, &yymsp[0].minor.yy0); }
-#line 5459 "sql.c"
break;
- case 79: /* cmd ::= DROP SNODE ON DNODE NK_INTEGER */
-#line 190 "sql.y"
+ case 81: /* cmd ::= DROP SNODE ON DNODE NK_INTEGER */
{ pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_SNODE_STMT, &yymsp[0].minor.yy0); }
-#line 5464 "sql.c"
break;
- case 80: /* cmd ::= CREATE MNODE ON DNODE NK_INTEGER */
-#line 193 "sql.y"
+ case 82: /* cmd ::= CREATE MNODE ON DNODE NK_INTEGER */
{ pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_MNODE_STMT, &yymsp[0].minor.yy0); }
-#line 5469 "sql.c"
break;
- case 81: /* cmd ::= DROP MNODE ON DNODE NK_INTEGER */
-#line 194 "sql.y"
+ case 83: /* cmd ::= DROP MNODE ON DNODE NK_INTEGER */
{ pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_MNODE_STMT, &yymsp[0].minor.yy0); }
-#line 5474 "sql.c"
break;
- case 82: /* cmd ::= RESTORE MNODE ON DNODE NK_INTEGER */
-#line 195 "sql.y"
+ case 84: /* cmd ::= RESTORE MNODE ON DNODE NK_INTEGER */
{ pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_MNODE_STMT, &yymsp[0].minor.yy0); }
-#line 5479 "sql.c"
break;
- case 83: /* cmd ::= RESTORE VNODE ON DNODE NK_INTEGER */
-#line 198 "sql.y"
+ case 85: /* cmd ::= RESTORE VNODE ON DNODE NK_INTEGER */
{ pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_VNODE_STMT, &yymsp[0].minor.yy0); }
-#line 5484 "sql.c"
break;
- case 84: /* cmd ::= CREATE DATABASE not_exists_opt db_name db_options */
-#line 201 "sql.y"
-{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy985, &yymsp[-1].minor.yy993, yymsp[0].minor.yy232); }
-#line 5489 "sql.c"
+ case 86: /* cmd ::= CREATE DATABASE not_exists_opt db_name db_options */
+{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy845, &yymsp[-1].minor.yy561, yymsp[0].minor.yy490); }
break;
- case 85: /* cmd ::= DROP DATABASE exists_opt db_name */
-#line 202 "sql.y"
-{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy985, &yymsp[0].minor.yy993); }
-#line 5494 "sql.c"
+ case 87: /* cmd ::= DROP DATABASE exists_opt db_name */
+{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy845, &yymsp[0].minor.yy561); }
break;
- case 86: /* cmd ::= USE db_name */
-#line 203 "sql.y"
-{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy993); }
-#line 5499 "sql.c"
+ case 88: /* cmd ::= USE db_name */
+{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy561); }
break;
- case 87: /* cmd ::= ALTER DATABASE db_name alter_db_options */
-#line 204 "sql.y"
-{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy993, yymsp[0].minor.yy232); }
-#line 5504 "sql.c"
+ case 89: /* cmd ::= ALTER DATABASE db_name alter_db_options */
+{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy561, yymsp[0].minor.yy490); }
break;
- case 88: /* cmd ::= FLUSH DATABASE db_name */
-#line 205 "sql.y"
-{ pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy993); }
-#line 5509 "sql.c"
+ case 90: /* cmd ::= FLUSH DATABASE db_name */
+{ pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy561); }
break;
- case 89: /* cmd ::= TRIM DATABASE db_name speed_opt */
-#line 206 "sql.y"
-{ pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[-1].minor.yy993, yymsp[0].minor.yy92); }
-#line 5514 "sql.c"
+ case 91: /* cmd ::= TRIM DATABASE db_name speed_opt */
+{ pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[-1].minor.yy561, yymsp[0].minor.yy774); }
break;
- case 90: /* cmd ::= COMPACT DATABASE db_name start_opt end_opt */
-#line 207 "sql.y"
-{ pCxt->pRootNode = createCompactStmt(pCxt, &yymsp[-2].minor.yy993, yymsp[-1].minor.yy232, yymsp[0].minor.yy232); }
-#line 5519 "sql.c"
+ case 92: /* cmd ::= COMPACT DATABASE db_name start_opt end_opt */
+{ pCxt->pRootNode = createCompactStmt(pCxt, &yymsp[-2].minor.yy561, yymsp[-1].minor.yy490, yymsp[0].minor.yy490); }
break;
- case 91: /* not_exists_opt ::= IF NOT EXISTS */
-#line 211 "sql.y"
-{ yymsp[-2].minor.yy985 = true; }
-#line 5524 "sql.c"
+ case 93: /* not_exists_opt ::= IF NOT EXISTS */
+{ yymsp[-2].minor.yy845 = true; }
break;
- case 93: /* exists_opt ::= IF EXISTS */
- case 359: /* or_replace_opt ::= OR REPLACE */ yytestcase(yyruleno==359);
- case 385: /* ignore_opt ::= IGNORE UNTREATED */ yytestcase(yyruleno==385);
-#line 216 "sql.y"
-{ yymsp[-1].minor.yy985 = true; }
-#line 5531 "sql.c"
+ case 95: /* exists_opt ::= IF EXISTS */
+ case 364: /* or_replace_opt ::= OR REPLACE */ yytestcase(yyruleno==364);
+ case 390: /* ignore_opt ::= IGNORE UNTREATED */ yytestcase(yyruleno==390);
+{ yymsp[-1].minor.yy845 = true; }
break;
- case 95: /* db_options ::= */
-#line 219 "sql.y"
-{ yymsp[1].minor.yy232 = createDefaultDatabaseOptions(pCxt); }
-#line 5536 "sql.c"
+ case 97: /* db_options ::= */
+{ yymsp[1].minor.yy490 = createDefaultDatabaseOptions(pCxt); }
break;
- case 96: /* db_options ::= db_options BUFFER NK_INTEGER */
-#line 220 "sql.y"
-{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); }
-#line 5541 "sql.c"
- yymsp[-2].minor.yy232 = yylhsminor.yy232;
+ case 98: /* db_options ::= db_options BUFFER NK_INTEGER */
+{ yylhsminor.yy490 = setDatabaseOption(pCxt, yymsp[-2].minor.yy490, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy490 = yylhsminor.yy490;
break;
- case 97: /* db_options ::= db_options CACHEMODEL NK_STRING */
-#line 221 "sql.y"
-{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_CACHEMODEL, &yymsp[0].minor.yy0); }
-#line 5547 "sql.c"
- yymsp[-2].minor.yy232 = yylhsminor.yy232;
+ case 99: /* db_options ::= db_options CACHEMODEL NK_STRING */
+{ yylhsminor.yy490 = setDatabaseOption(pCxt, yymsp[-2].minor.yy490, DB_OPTION_CACHEMODEL, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy490 = yylhsminor.yy490;
break;
- case 98: /* db_options ::= db_options CACHESIZE NK_INTEGER */
-#line 222 "sql.y"
-{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_CACHESIZE, &yymsp[0].minor.yy0); }
-#line 5553 "sql.c"
- yymsp[-2].minor.yy232 = yylhsminor.yy232;
+ case 100: /* db_options ::= db_options CACHESIZE NK_INTEGER */
+{ yylhsminor.yy490 = setDatabaseOption(pCxt, yymsp[-2].minor.yy490, DB_OPTION_CACHESIZE, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy490 = yylhsminor.yy490;
break;
- case 99: /* db_options ::= db_options COMP NK_INTEGER */
-#line 223 "sql.y"
-{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_COMP, &yymsp[0].minor.yy0); }
-#line 5559 "sql.c"
- yymsp[-2].minor.yy232 = yylhsminor.yy232;
+ case 101: /* db_options ::= db_options COMP NK_INTEGER */
+{ yylhsminor.yy490 = setDatabaseOption(pCxt, yymsp[-2].minor.yy490, DB_OPTION_COMP, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy490 = yylhsminor.yy490;
break;
- case 100: /* db_options ::= db_options DURATION NK_INTEGER */
- case 101: /* db_options ::= db_options DURATION NK_VARIABLE */ yytestcase(yyruleno==101);
-#line 224 "sql.y"
-{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_DAYS, &yymsp[0].minor.yy0); }
-#line 5566 "sql.c"
- yymsp[-2].minor.yy232 = yylhsminor.yy232;
+ case 102: /* db_options ::= db_options DURATION NK_INTEGER */
+ case 103: /* db_options ::= db_options DURATION NK_VARIABLE */ yytestcase(yyruleno==103);
+{ yylhsminor.yy490 = setDatabaseOption(pCxt, yymsp[-2].minor.yy490, DB_OPTION_DAYS, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy490 = yylhsminor.yy490;
break;
- case 102: /* db_options ::= db_options MAXROWS NK_INTEGER */
-#line 226 "sql.y"
-{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); }
-#line 5572 "sql.c"
- yymsp[-2].minor.yy232 = yylhsminor.yy232;
+ case 104: /* db_options ::= db_options MAXROWS NK_INTEGER */
+{ yylhsminor.yy490 = setDatabaseOption(pCxt, yymsp[-2].minor.yy490, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy490 = yylhsminor.yy490;
break;
- case 103: /* db_options ::= db_options MINROWS NK_INTEGER */
-#line 227 "sql.y"
-{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); }
-#line 5578 "sql.c"
- yymsp[-2].minor.yy232 = yylhsminor.yy232;
+ case 105: /* db_options ::= db_options MINROWS NK_INTEGER */
+{ yylhsminor.yy490 = setDatabaseOption(pCxt, yymsp[-2].minor.yy490, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy490 = yylhsminor.yy490;
break;
- case 104: /* db_options ::= db_options KEEP integer_list */
- case 105: /* db_options ::= db_options KEEP variable_list */ yytestcase(yyruleno==105);
-#line 228 "sql.y"
-{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_KEEP, yymsp[0].minor.yy88); }
-#line 5585 "sql.c"
- yymsp[-2].minor.yy232 = yylhsminor.yy232;
+ case 106: /* db_options ::= db_options KEEP integer_list */
+ case 107: /* db_options ::= db_options KEEP variable_list */ yytestcase(yyruleno==107);
+{ yylhsminor.yy490 = setDatabaseOption(pCxt, yymsp[-2].minor.yy490, DB_OPTION_KEEP, yymsp[0].minor.yy502); }
+ yymsp[-2].minor.yy490 = yylhsminor.yy490;
break;
- case 106: /* db_options ::= db_options PAGES NK_INTEGER */
-#line 230 "sql.y"
-{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_PAGES, &yymsp[0].minor.yy0); }
-#line 5591 "sql.c"
- yymsp[-2].minor.yy232 = yylhsminor.yy232;
+ case 108: /* db_options ::= db_options PAGES NK_INTEGER */
+{ yylhsminor.yy490 = setDatabaseOption(pCxt, yymsp[-2].minor.yy490, DB_OPTION_PAGES, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy490 = yylhsminor.yy490;
break;
- case 107: /* db_options ::= db_options PAGESIZE NK_INTEGER */
-#line 231 "sql.y"
-{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); }
-#line 5597 "sql.c"
- yymsp[-2].minor.yy232 = yylhsminor.yy232;
+ case 109: /* db_options ::= db_options PAGESIZE NK_INTEGER */
+{ yylhsminor.yy490 = setDatabaseOption(pCxt, yymsp[-2].minor.yy490, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy490 = yylhsminor.yy490;
break;
- case 108: /* db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */
-#line 232 "sql.y"
-{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_TSDB_PAGESIZE, &yymsp[0].minor.yy0); }
-#line 5603 "sql.c"
- yymsp[-2].minor.yy232 = yylhsminor.yy232;
+ case 110: /* db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */
+{ yylhsminor.yy490 = setDatabaseOption(pCxt, yymsp[-2].minor.yy490, DB_OPTION_TSDB_PAGESIZE, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy490 = yylhsminor.yy490;
break;
- case 109: /* db_options ::= db_options PRECISION NK_STRING */
-#line 233 "sql.y"
-{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); }
-#line 5609 "sql.c"
- yymsp[-2].minor.yy232 = yylhsminor.yy232;
+ case 111: /* db_options ::= db_options PRECISION NK_STRING */
+{ yylhsminor.yy490 = setDatabaseOption(pCxt, yymsp[-2].minor.yy490, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy490 = yylhsminor.yy490;
break;
- case 110: /* db_options ::= db_options REPLICA NK_INTEGER */
-#line 234 "sql.y"
-{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); }
-#line 5615 "sql.c"
- yymsp[-2].minor.yy232 = yylhsminor.yy232;
+ case 112: /* db_options ::= db_options REPLICA NK_INTEGER */
+{ yylhsminor.yy490 = setDatabaseOption(pCxt, yymsp[-2].minor.yy490, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy490 = yylhsminor.yy490;
break;
- case 111: /* db_options ::= db_options VGROUPS NK_INTEGER */
-#line 236 "sql.y"
-{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); }
-#line 5621 "sql.c"
- yymsp[-2].minor.yy232 = yylhsminor.yy232;
+ case 113: /* db_options ::= db_options VGROUPS NK_INTEGER */
+{ yylhsminor.yy490 = setDatabaseOption(pCxt, yymsp[-2].minor.yy490, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy490 = yylhsminor.yy490;
break;
- case 112: /* db_options ::= db_options SINGLE_STABLE NK_INTEGER */
-#line 237 "sql.y"
-{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); }
-#line 5627 "sql.c"
- yymsp[-2].minor.yy232 = yylhsminor.yy232;
+ case 114: /* db_options ::= db_options SINGLE_STABLE NK_INTEGER */
+{ yylhsminor.yy490 = setDatabaseOption(pCxt, yymsp[-2].minor.yy490, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy490 = yylhsminor.yy490;
break;
- case 113: /* db_options ::= db_options RETENTIONS retention_list */
-#line 238 "sql.y"
-{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_RETENTIONS, yymsp[0].minor.yy88); }
-#line 5633 "sql.c"
- yymsp[-2].minor.yy232 = yylhsminor.yy232;
+ case 115: /* db_options ::= db_options RETENTIONS retention_list */
+{ yylhsminor.yy490 = setDatabaseOption(pCxt, yymsp[-2].minor.yy490, DB_OPTION_RETENTIONS, yymsp[0].minor.yy502); }
+ yymsp[-2].minor.yy490 = yylhsminor.yy490;
break;
- case 114: /* db_options ::= db_options SCHEMALESS NK_INTEGER */
-#line 239 "sql.y"
-{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); }
-#line 5639 "sql.c"
- yymsp[-2].minor.yy232 = yylhsminor.yy232;
+ case 116: /* db_options ::= db_options SCHEMALESS NK_INTEGER */
+{ yylhsminor.yy490 = setDatabaseOption(pCxt, yymsp[-2].minor.yy490, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy490 = yylhsminor.yy490;
break;
- case 115: /* db_options ::= db_options WAL_LEVEL NK_INTEGER */
-#line 240 "sql.y"
-{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_WAL, &yymsp[0].minor.yy0); }
-#line 5645 "sql.c"
- yymsp[-2].minor.yy232 = yylhsminor.yy232;
+ case 117: /* db_options ::= db_options WAL_LEVEL NK_INTEGER */
+{ yylhsminor.yy490 = setDatabaseOption(pCxt, yymsp[-2].minor.yy490, DB_OPTION_WAL, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy490 = yylhsminor.yy490;
break;
- case 116: /* db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */
-#line 241 "sql.y"
-{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); }
-#line 5651 "sql.c"
- yymsp[-2].minor.yy232 = yylhsminor.yy232;
+ case 118: /* db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */
+{ yylhsminor.yy490 = setDatabaseOption(pCxt, yymsp[-2].minor.yy490, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy490 = yylhsminor.yy490;
break;
- case 117: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */
-#line 242 "sql.y"
-{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_WAL_RETENTION_PERIOD, &yymsp[0].minor.yy0); }
-#line 5657 "sql.c"
- yymsp[-2].minor.yy232 = yylhsminor.yy232;
+ case 119: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */
+{ yylhsminor.yy490 = setDatabaseOption(pCxt, yymsp[-2].minor.yy490, DB_OPTION_WAL_RETENTION_PERIOD, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy490 = yylhsminor.yy490;
break;
- case 118: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */
-#line 243 "sql.y"
+ case 120: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */
{
SToken t = yymsp[-1].minor.yy0;
t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z;
- yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-3].minor.yy232, DB_OPTION_WAL_RETENTION_PERIOD, &t);
+ yylhsminor.yy490 = setDatabaseOption(pCxt, yymsp[-3].minor.yy490, DB_OPTION_WAL_RETENTION_PERIOD, &t);
}
-#line 5667 "sql.c"
- yymsp[-3].minor.yy232 = yylhsminor.yy232;
+ yymsp[-3].minor.yy490 = yylhsminor.yy490;
break;
- case 119: /* db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */
-#line 248 "sql.y"
-{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_WAL_RETENTION_SIZE, &yymsp[0].minor.yy0); }
-#line 5673 "sql.c"
- yymsp[-2].minor.yy232 = yylhsminor.yy232;
+ case 121: /* db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */
+{ yylhsminor.yy490 = setDatabaseOption(pCxt, yymsp[-2].minor.yy490, DB_OPTION_WAL_RETENTION_SIZE, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy490 = yylhsminor.yy490;
break;
- case 120: /* db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */
-#line 249 "sql.y"
+ case 122: /* db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */
{
SToken t = yymsp[-1].minor.yy0;
t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z;
- yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-3].minor.yy232, DB_OPTION_WAL_RETENTION_SIZE, &t);
+ yylhsminor.yy490 = setDatabaseOption(pCxt, yymsp[-3].minor.yy490, DB_OPTION_WAL_RETENTION_SIZE, &t);
}
-#line 5683 "sql.c"
- yymsp[-3].minor.yy232 = yylhsminor.yy232;
+ yymsp[-3].minor.yy490 = yylhsminor.yy490;
break;
- case 121: /* db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */
-#line 254 "sql.y"
-{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_WAL_ROLL_PERIOD, &yymsp[0].minor.yy0); }
-#line 5689 "sql.c"
- yymsp[-2].minor.yy232 = yylhsminor.yy232;
+ case 123: /* db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */
+{ yylhsminor.yy490 = setDatabaseOption(pCxt, yymsp[-2].minor.yy490, DB_OPTION_WAL_ROLL_PERIOD, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy490 = yylhsminor.yy490;
break;
- case 122: /* db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */
-#line 255 "sql.y"
-{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_WAL_SEGMENT_SIZE, &yymsp[0].minor.yy0); }
-#line 5695 "sql.c"
- yymsp[-2].minor.yy232 = yylhsminor.yy232;
+ case 124: /* db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */
+{ yylhsminor.yy490 = setDatabaseOption(pCxt, yymsp[-2].minor.yy490, DB_OPTION_WAL_SEGMENT_SIZE, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy490 = yylhsminor.yy490;
break;
- case 123: /* db_options ::= db_options STT_TRIGGER NK_INTEGER */
-#line 256 "sql.y"
-{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_STT_TRIGGER, &yymsp[0].minor.yy0); }
-#line 5701 "sql.c"
- yymsp[-2].minor.yy232 = yylhsminor.yy232;
+ case 125: /* db_options ::= db_options STT_TRIGGER NK_INTEGER */
+{ yylhsminor.yy490 = setDatabaseOption(pCxt, yymsp[-2].minor.yy490, DB_OPTION_STT_TRIGGER, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy490 = yylhsminor.yy490;
break;
- case 124: /* db_options ::= db_options TABLE_PREFIX signed */
-#line 257 "sql.y"
-{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_TABLE_PREFIX, yymsp[0].minor.yy232); }
-#line 5707 "sql.c"
- yymsp[-2].minor.yy232 = yylhsminor.yy232;
+ case 126: /* db_options ::= db_options TABLE_PREFIX signed */
+{ yylhsminor.yy490 = setDatabaseOption(pCxt, yymsp[-2].minor.yy490, DB_OPTION_TABLE_PREFIX, yymsp[0].minor.yy490); }
+ yymsp[-2].minor.yy490 = yylhsminor.yy490;
break;
- case 125: /* db_options ::= db_options TABLE_SUFFIX signed */
-#line 258 "sql.y"
-{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_TABLE_SUFFIX, yymsp[0].minor.yy232); }
-#line 5713 "sql.c"
- yymsp[-2].minor.yy232 = yylhsminor.yy232;
+ case 127: /* db_options ::= db_options TABLE_SUFFIX signed */
+{ yylhsminor.yy490 = setDatabaseOption(pCxt, yymsp[-2].minor.yy490, DB_OPTION_TABLE_SUFFIX, yymsp[0].minor.yy490); }
+ yymsp[-2].minor.yy490 = yylhsminor.yy490;
break;
- case 126: /* db_options ::= db_options KEEP_TIME_OFFSET NK_INTEGER */
-#line 259 "sql.y"
-{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_KEEP_TIME_OFFSET, &yymsp[0].minor.yy0); }
-#line 5719 "sql.c"
- yymsp[-2].minor.yy232 = yylhsminor.yy232;
+ case 128: /* db_options ::= db_options KEEP_TIME_OFFSET NK_INTEGER */
+{ yylhsminor.yy490 = setDatabaseOption(pCxt, yymsp[-2].minor.yy490, DB_OPTION_KEEP_TIME_OFFSET, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy490 = yylhsminor.yy490;
break;
- case 127: /* alter_db_options ::= alter_db_option */
-#line 261 "sql.y"
-{ yylhsminor.yy232 = createAlterDatabaseOptions(pCxt); yylhsminor.yy232 = setAlterDatabaseOption(pCxt, yylhsminor.yy232, &yymsp[0].minor.yy117); }
-#line 5725 "sql.c"
- yymsp[0].minor.yy232 = yylhsminor.yy232;
+ case 129: /* alter_db_options ::= alter_db_option */
+{ yylhsminor.yy490 = createAlterDatabaseOptions(pCxt); yylhsminor.yy490 = setAlterDatabaseOption(pCxt, yylhsminor.yy490, &yymsp[0].minor.yy529); }
+ yymsp[0].minor.yy490 = yylhsminor.yy490;
break;
- case 128: /* alter_db_options ::= alter_db_options alter_db_option */
-#line 262 "sql.y"
-{ yylhsminor.yy232 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy232, &yymsp[0].minor.yy117); }
-#line 5731 "sql.c"
- yymsp[-1].minor.yy232 = yylhsminor.yy232;
+ case 130: /* alter_db_options ::= alter_db_options alter_db_option */
+{ yylhsminor.yy490 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy490, &yymsp[0].minor.yy529); }
+ yymsp[-1].minor.yy490 = yylhsminor.yy490;
break;
- case 129: /* alter_db_option ::= BUFFER NK_INTEGER */
-#line 266 "sql.y"
-{ yymsp[-1].minor.yy117.type = DB_OPTION_BUFFER; yymsp[-1].minor.yy117.val = yymsp[0].minor.yy0; }
-#line 5737 "sql.c"
+ case 131: /* alter_db_option ::= BUFFER NK_INTEGER */
+{ yymsp[-1].minor.yy529.type = DB_OPTION_BUFFER; yymsp[-1].minor.yy529.val = yymsp[0].minor.yy0; }
break;
- case 130: /* alter_db_option ::= CACHEMODEL NK_STRING */
-#line 267 "sql.y"
-{ yymsp[-1].minor.yy117.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy117.val = yymsp[0].minor.yy0; }
-#line 5742 "sql.c"
+ case 132: /* alter_db_option ::= CACHEMODEL NK_STRING */
+{ yymsp[-1].minor.yy529.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy529.val = yymsp[0].minor.yy0; }
break;
- case 131: /* alter_db_option ::= CACHESIZE NK_INTEGER */
-#line 268 "sql.y"
-{ yymsp[-1].minor.yy117.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy117.val = yymsp[0].minor.yy0; }
-#line 5747 "sql.c"
+ case 133: /* alter_db_option ::= CACHESIZE NK_INTEGER */
+{ yymsp[-1].minor.yy529.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy529.val = yymsp[0].minor.yy0; }
break;
- case 132: /* alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */
-#line 269 "sql.y"
-{ yymsp[-1].minor.yy117.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy117.val = yymsp[0].minor.yy0; }
-#line 5752 "sql.c"
+ case 134: /* alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */
+{ yymsp[-1].minor.yy529.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy529.val = yymsp[0].minor.yy0; }
break;
- case 133: /* alter_db_option ::= KEEP integer_list */
- case 134: /* alter_db_option ::= KEEP variable_list */ yytestcase(yyruleno==134);
-#line 270 "sql.y"
-{ yymsp[-1].minor.yy117.type = DB_OPTION_KEEP; yymsp[-1].minor.yy117.pList = yymsp[0].minor.yy88; }
-#line 5758 "sql.c"
+ case 135: /* alter_db_option ::= KEEP integer_list */
+ case 136: /* alter_db_option ::= KEEP variable_list */ yytestcase(yyruleno==136);
+{ yymsp[-1].minor.yy529.type = DB_OPTION_KEEP; yymsp[-1].minor.yy529.pList = yymsp[0].minor.yy502; }
break;
- case 135: /* alter_db_option ::= PAGES NK_INTEGER */
-#line 272 "sql.y"
-{ yymsp[-1].minor.yy117.type = DB_OPTION_PAGES; yymsp[-1].minor.yy117.val = yymsp[0].minor.yy0; }
-#line 5763 "sql.c"
+ case 137: /* alter_db_option ::= PAGES NK_INTEGER */
+{ yymsp[-1].minor.yy529.type = DB_OPTION_PAGES; yymsp[-1].minor.yy529.val = yymsp[0].minor.yy0; }
break;
- case 136: /* alter_db_option ::= REPLICA NK_INTEGER */
-#line 273 "sql.y"
-{ yymsp[-1].minor.yy117.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy117.val = yymsp[0].minor.yy0; }
-#line 5768 "sql.c"
+ case 138: /* alter_db_option ::= REPLICA NK_INTEGER */
+{ yymsp[-1].minor.yy529.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy529.val = yymsp[0].minor.yy0; }
break;
- case 137: /* alter_db_option ::= WAL_LEVEL NK_INTEGER */
-#line 275 "sql.y"
-{ yymsp[-1].minor.yy117.type = DB_OPTION_WAL; yymsp[-1].minor.yy117.val = yymsp[0].minor.yy0; }
-#line 5773 "sql.c"
+ case 139: /* alter_db_option ::= WAL_LEVEL NK_INTEGER */
+{ yymsp[-1].minor.yy529.type = DB_OPTION_WAL; yymsp[-1].minor.yy529.val = yymsp[0].minor.yy0; }
break;
- case 138: /* alter_db_option ::= STT_TRIGGER NK_INTEGER */
-#line 276 "sql.y"
-{ yymsp[-1].minor.yy117.type = DB_OPTION_STT_TRIGGER; yymsp[-1].minor.yy117.val = yymsp[0].minor.yy0; }
-#line 5778 "sql.c"
+ case 140: /* alter_db_option ::= STT_TRIGGER NK_INTEGER */
+{ yymsp[-1].minor.yy529.type = DB_OPTION_STT_TRIGGER; yymsp[-1].minor.yy529.val = yymsp[0].minor.yy0; }
break;
- case 139: /* alter_db_option ::= MINROWS NK_INTEGER */
-#line 277 "sql.y"
-{ yymsp[-1].minor.yy117.type = DB_OPTION_MINROWS; yymsp[-1].minor.yy117.val = yymsp[0].minor.yy0; }
-#line 5783 "sql.c"
+ case 141: /* alter_db_option ::= MINROWS NK_INTEGER */
+{ yymsp[-1].minor.yy529.type = DB_OPTION_MINROWS; yymsp[-1].minor.yy529.val = yymsp[0].minor.yy0; }
break;
- case 140: /* alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER */
-#line 278 "sql.y"
-{ yymsp[-1].minor.yy117.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-1].minor.yy117.val = yymsp[0].minor.yy0; }
-#line 5788 "sql.c"
+ case 142: /* alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER */
+{ yymsp[-1].minor.yy529.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-1].minor.yy529.val = yymsp[0].minor.yy0; }
break;
- case 141: /* alter_db_option ::= WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */
-#line 279 "sql.y"
+ case 143: /* alter_db_option ::= WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */
{
SToken t = yymsp[-1].minor.yy0;
t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z;
- yymsp[-2].minor.yy117.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-2].minor.yy117.val = t;
+ yymsp[-2].minor.yy529.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-2].minor.yy529.val = t;
}
-#line 5797 "sql.c"
break;
- case 142: /* alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER */
-#line 284 "sql.y"
-{ yymsp[-1].minor.yy117.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-1].minor.yy117.val = yymsp[0].minor.yy0; }
-#line 5802 "sql.c"
+ case 144: /* alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER */
+{ yymsp[-1].minor.yy529.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-1].minor.yy529.val = yymsp[0].minor.yy0; }
break;
- case 143: /* alter_db_option ::= WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */
-#line 285 "sql.y"
+ case 145: /* alter_db_option ::= WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */
{
SToken t = yymsp[-1].minor.yy0;
t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z;
- yymsp[-2].minor.yy117.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-2].minor.yy117.val = t;
+ yymsp[-2].minor.yy529.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-2].minor.yy529.val = t;
}
-#line 5811 "sql.c"
- break;
- case 144: /* alter_db_option ::= KEEP_TIME_OFFSET NK_INTEGER */
-#line 290 "sql.y"
-{ yymsp[-1].minor.yy117.type = DB_OPTION_KEEP_TIME_OFFSET; yymsp[-1].minor.yy117.val = yymsp[0].minor.yy0; }
-#line 5816 "sql.c"
- break;
- case 145: /* integer_list ::= NK_INTEGER */
-#line 294 "sql.y"
-{ yylhsminor.yy88 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
-#line 5821 "sql.c"
- yymsp[0].minor.yy88 = yylhsminor.yy88;
- break;
- case 146: /* integer_list ::= integer_list NK_COMMA NK_INTEGER */
- case 398: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==398);
-#line 295 "sql.y"
-{ yylhsminor.yy88 = addNodeToList(pCxt, yymsp[-2].minor.yy88, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
-#line 5828 "sql.c"
- yymsp[-2].minor.yy88 = yylhsminor.yy88;
- break;
- case 147: /* variable_list ::= NK_VARIABLE */
-#line 299 "sql.y"
-{ yylhsminor.yy88 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
-#line 5834 "sql.c"
- yymsp[0].minor.yy88 = yylhsminor.yy88;
- break;
- case 148: /* variable_list ::= variable_list NK_COMMA NK_VARIABLE */
-#line 300 "sql.y"
-{ yylhsminor.yy88 = addNodeToList(pCxt, yymsp[-2].minor.yy88, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
-#line 5840 "sql.c"
- yymsp[-2].minor.yy88 = yylhsminor.yy88;
- break;
- case 149: /* retention_list ::= retention */
- case 180: /* multi_create_clause ::= create_subtable_clause */ yytestcase(yyruleno==180);
- case 183: /* multi_drop_clause ::= drop_table_clause */ yytestcase(yyruleno==183);
- case 190: /* column_def_list ::= column_def */ yytestcase(yyruleno==190);
- case 234: /* rollup_func_list ::= rollup_func_name */ yytestcase(yyruleno==234);
- case 239: /* col_name_list ::= col_name */ yytestcase(yyruleno==239);
- case 303: /* tag_list_opt ::= tag_item */ yytestcase(yyruleno==303);
- case 320: /* func_list ::= func */ yytestcase(yyruleno==320);
- case 427: /* literal_list ::= signed_literal */ yytestcase(yyruleno==427);
- case 498: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==498);
- case 504: /* when_then_list ::= when_then_expr */ yytestcase(yyruleno==504);
- case 563: /* select_list ::= select_item */ yytestcase(yyruleno==563);
- case 574: /* partition_list ::= partition_item */ yytestcase(yyruleno==574);
- case 633: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==633);
-#line 304 "sql.y"
-{ yylhsminor.yy88 = createNodeList(pCxt, yymsp[0].minor.yy232); }
-#line 5859 "sql.c"
- yymsp[0].minor.yy88 = yylhsminor.yy88;
- break;
- case 150: /* retention_list ::= retention_list NK_COMMA retention */
- case 184: /* multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ yytestcase(yyruleno==184);
- case 191: /* column_def_list ::= column_def_list NK_COMMA column_def */ yytestcase(yyruleno==191);
- case 235: /* rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ yytestcase(yyruleno==235);
- case 240: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==240);
- case 304: /* tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ yytestcase(yyruleno==304);
- case 321: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==321);
- case 428: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==428);
- case 499: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==499);
- case 564: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==564);
- case 575: /* partition_list ::= partition_list NK_COMMA partition_item */ yytestcase(yyruleno==575);
- case 634: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==634);
-#line 305 "sql.y"
-{ yylhsminor.yy88 = addNodeToList(pCxt, yymsp[-2].minor.yy88, yymsp[0].minor.yy232); }
-#line 5876 "sql.c"
- yymsp[-2].minor.yy88 = yylhsminor.yy88;
- break;
- case 151: /* retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */
- case 152: /* retention ::= NK_MINUS NK_COLON NK_VARIABLE */ yytestcase(yyruleno==152);
-#line 307 "sql.y"
-{ yylhsminor.yy232 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
-#line 5883 "sql.c"
- yymsp[-2].minor.yy232 = yylhsminor.yy232;
- break;
- case 153: /* speed_opt ::= */
- case 354: /* bufsize_opt ::= */ yytestcase(yyruleno==354);
-#line 312 "sql.y"
-{ yymsp[1].minor.yy92 = 0; }
-#line 5890 "sql.c"
- break;
- case 154: /* speed_opt ::= BWLIMIT NK_INTEGER */
- case 355: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ yytestcase(yyruleno==355);
-#line 313 "sql.y"
-{ yymsp[-1].minor.yy92 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); }
-#line 5896 "sql.c"
- break;
- case 156: /* start_opt ::= START WITH NK_INTEGER */
- case 160: /* end_opt ::= END WITH NK_INTEGER */ yytestcase(yyruleno==160);
-#line 316 "sql.y"
-{ yymsp[-2].minor.yy232 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); }
-#line 5902 "sql.c"
- break;
- case 157: /* start_opt ::= START WITH NK_STRING */
- case 161: /* end_opt ::= END WITH NK_STRING */ yytestcase(yyruleno==161);
-#line 317 "sql.y"
-{ yymsp[-2].minor.yy232 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); }
-#line 5908 "sql.c"
- break;
- case 158: /* start_opt ::= START WITH TIMESTAMP NK_STRING */
- case 162: /* end_opt ::= END WITH TIMESTAMP NK_STRING */ yytestcase(yyruleno==162);
-#line 318 "sql.y"
-{ yymsp[-3].minor.yy232 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); }
-#line 5914 "sql.c"
- break;
- case 163: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */
- case 165: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==165);
-#line 327 "sql.y"
-{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy985, yymsp[-5].minor.yy232, yymsp[-3].minor.yy88, yymsp[-1].minor.yy88, yymsp[0].minor.yy232); }
-#line 5920 "sql.c"
- break;
- case 164: /* cmd ::= CREATE TABLE multi_create_clause */
-#line 328 "sql.y"
-{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy88); }
-#line 5925 "sql.c"
- break;
- case 166: /* cmd ::= DROP TABLE multi_drop_clause */
-#line 331 "sql.y"
-{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy88); }
-#line 5930 "sql.c"
- break;
- case 167: /* cmd ::= DROP STABLE exists_opt full_table_name */
-#line 332 "sql.y"
-{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy985, yymsp[0].minor.yy232); }
-#line 5935 "sql.c"
- break;
- case 168: /* cmd ::= ALTER TABLE alter_table_clause */
- case 400: /* cmd ::= query_or_subquery */ yytestcase(yyruleno==400);
- case 401: /* cmd ::= insert_query */ yytestcase(yyruleno==401);
-#line 334 "sql.y"
-{ pCxt->pRootNode = yymsp[0].minor.yy232; }
-#line 5942 "sql.c"
- break;
- case 169: /* cmd ::= ALTER STABLE alter_table_clause */
-#line 335 "sql.y"
-{ pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy232); }
-#line 5947 "sql.c"
- break;
- case 170: /* alter_table_clause ::= full_table_name alter_table_options */
-#line 337 "sql.y"
-{ yylhsminor.yy232 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy232, yymsp[0].minor.yy232); }
-#line 5952 "sql.c"
- yymsp[-1].minor.yy232 = yylhsminor.yy232;
- break;
- case 171: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */
-#line 339 "sql.y"
-{ yylhsminor.yy232 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy232, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy993, yymsp[0].minor.yy400); }
-#line 5958 "sql.c"
- yymsp[-4].minor.yy232 = yylhsminor.yy232;
- break;
- case 172: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */
-#line 340 "sql.y"
-{ yylhsminor.yy232 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy232, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy993); }
-#line 5964 "sql.c"
- yymsp[-3].minor.yy232 = yylhsminor.yy232;
- break;
- case 173: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */
-#line 342 "sql.y"
-{ yylhsminor.yy232 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy232, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy993, yymsp[0].minor.yy400); }
-#line 5970 "sql.c"
- yymsp[-4].minor.yy232 = yylhsminor.yy232;
- break;
- case 174: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */
-#line 344 "sql.y"
-{ yylhsminor.yy232 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy232, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy993, &yymsp[0].minor.yy993); }
-#line 5976 "sql.c"
- yymsp[-4].minor.yy232 = yylhsminor.yy232;
- break;
- case 175: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */
-#line 346 "sql.y"
-{ yylhsminor.yy232 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy232, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy993, yymsp[0].minor.yy400); }
-#line 5982 "sql.c"
- yymsp[-4].minor.yy232 = yylhsminor.yy232;
- break;
- case 176: /* alter_table_clause ::= full_table_name DROP TAG column_name */
-#line 347 "sql.y"
-{ yylhsminor.yy232 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy232, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy993); }
-#line 5988 "sql.c"
- yymsp[-3].minor.yy232 = yylhsminor.yy232;
- break;
- case 177: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */
-#line 349 "sql.y"
-{ yylhsminor.yy232 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy232, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy993, yymsp[0].minor.yy400); }
-#line 5994 "sql.c"
- yymsp[-4].minor.yy232 = yylhsminor.yy232;
- break;
- case 178: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */
-#line 351 "sql.y"
-{ yylhsminor.yy232 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy232, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy993, &yymsp[0].minor.yy993); }
-#line 6000 "sql.c"
- yymsp[-4].minor.yy232 = yylhsminor.yy232;
- break;
- case 179: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */
-#line 353 "sql.y"
-{ yylhsminor.yy232 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy232, &yymsp[-2].minor.yy993, yymsp[0].minor.yy232); }
-#line 6006 "sql.c"
- yymsp[-5].minor.yy232 = yylhsminor.yy232;
- break;
- case 181: /* multi_create_clause ::= multi_create_clause create_subtable_clause */
- case 505: /* when_then_list ::= when_then_list when_then_expr */ yytestcase(yyruleno==505);
-#line 358 "sql.y"
-{ yylhsminor.yy88 = addNodeToList(pCxt, yymsp[-1].minor.yy88, yymsp[0].minor.yy232); }
-#line 6013 "sql.c"
- yymsp[-1].minor.yy88 = yylhsminor.yy88;
- break;
- case 182: /* create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP expression_list NK_RP table_options */
-#line 362 "sql.y"
-{ yylhsminor.yy232 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy985, yymsp[-8].minor.yy232, yymsp[-6].minor.yy232, yymsp[-5].minor.yy88, yymsp[-2].minor.yy88, yymsp[0].minor.yy232); }
-#line 6019 "sql.c"
- yymsp[-9].minor.yy232 = yylhsminor.yy232;
- break;
- case 185: /* drop_table_clause ::= exists_opt full_table_name */
-#line 369 "sql.y"
-{ yylhsminor.yy232 = createDropTableClause(pCxt, yymsp[-1].minor.yy985, yymsp[0].minor.yy232); }
-#line 6025 "sql.c"
- yymsp[-1].minor.yy232 = yylhsminor.yy232;
- break;
- case 187: /* specific_cols_opt ::= NK_LP col_name_list NK_RP */
- case 369: /* col_list_opt ::= NK_LP col_name_list NK_RP */ yytestcase(yyruleno==369);
-#line 374 "sql.y"
-{ yymsp[-2].minor.yy88 = yymsp[-1].minor.yy88; }
-#line 6032 "sql.c"
- break;
- case 188: /* full_table_name ::= table_name */
-#line 376 "sql.y"
-{ yylhsminor.yy232 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy993, NULL); }
-#line 6037 "sql.c"
- yymsp[0].minor.yy232 = yylhsminor.yy232;
- break;
- case 189: /* full_table_name ::= db_name NK_DOT table_name */
-#line 377 "sql.y"
-{ yylhsminor.yy232 = createRealTableNode(pCxt, &yymsp[-2].minor.yy993, &yymsp[0].minor.yy993, NULL); }
-#line 6043 "sql.c"
- yymsp[-2].minor.yy232 = yylhsminor.yy232;
- break;
- case 192: /* column_def ::= column_name type_name */
-#line 384 "sql.y"
-{ yylhsminor.yy232 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy993, yymsp[0].minor.yy400, NULL); }
-#line 6049 "sql.c"
- yymsp[-1].minor.yy232 = yylhsminor.yy232;
- break;
- case 193: /* type_name ::= BOOL */
-#line 389 "sql.y"
-{ yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_BOOL); }
-#line 6055 "sql.c"
- break;
- case 194: /* type_name ::= TINYINT */
-#line 390 "sql.y"
-{ yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_TINYINT); }
-#line 6060 "sql.c"
- break;
- case 195: /* type_name ::= SMALLINT */
-#line 391 "sql.y"
-{ yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_SMALLINT); }
-#line 6065 "sql.c"
- break;
- case 196: /* type_name ::= INT */
- case 197: /* type_name ::= INTEGER */ yytestcase(yyruleno==197);
-#line 392 "sql.y"
-{ yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_INT); }
-#line 6071 "sql.c"
- break;
- case 198: /* type_name ::= BIGINT */
-#line 394 "sql.y"
-{ yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_BIGINT); }
-#line 6076 "sql.c"
- break;
- case 199: /* type_name ::= FLOAT */
-#line 395 "sql.y"
-{ yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_FLOAT); }
-#line 6081 "sql.c"
- break;
- case 200: /* type_name ::= DOUBLE */
-#line 396 "sql.y"
-{ yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_DOUBLE); }
-#line 6086 "sql.c"
- break;
- case 201: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */
-#line 397 "sql.y"
-{ yymsp[-3].minor.yy400 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); }
-#line 6091 "sql.c"
- break;
- case 202: /* type_name ::= TIMESTAMP */
-#line 398 "sql.y"
-{ yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); }
-#line 6096 "sql.c"
- break;
- case 203: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */
-#line 399 "sql.y"
-{ yymsp[-3].minor.yy400 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); }
-#line 6101 "sql.c"
- break;
- case 204: /* type_name ::= TINYINT UNSIGNED */
-#line 400 "sql.y"
-{ yymsp[-1].minor.yy400 = createDataType(TSDB_DATA_TYPE_UTINYINT); }
-#line 6106 "sql.c"
- break;
- case 205: /* type_name ::= SMALLINT UNSIGNED */
-#line 401 "sql.y"
-{ yymsp[-1].minor.yy400 = createDataType(TSDB_DATA_TYPE_USMALLINT); }
-#line 6111 "sql.c"
- break;
- case 206: /* type_name ::= INT UNSIGNED */
-#line 402 "sql.y"
-{ yymsp[-1].minor.yy400 = createDataType(TSDB_DATA_TYPE_UINT); }
-#line 6116 "sql.c"
- break;
- case 207: /* type_name ::= BIGINT UNSIGNED */
-#line 403 "sql.y"
-{ yymsp[-1].minor.yy400 = createDataType(TSDB_DATA_TYPE_UBIGINT); }
-#line 6121 "sql.c"
- break;
- case 208: /* type_name ::= JSON */
-#line 404 "sql.y"
-{ yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_JSON); }
-#line 6126 "sql.c"
- break;
- case 209: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */
-#line 405 "sql.y"
-{ yymsp[-3].minor.yy400 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); }
-#line 6131 "sql.c"
- break;
- case 210: /* type_name ::= MEDIUMBLOB */
-#line 406 "sql.y"
-{ yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); }
-#line 6136 "sql.c"
- break;
- case 211: /* type_name ::= BLOB */
-#line 407 "sql.y"
-{ yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_BLOB); }
-#line 6141 "sql.c"
- break;
- case 212: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */
-#line 408 "sql.y"
-{ yymsp[-3].minor.yy400 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); }
-#line 6146 "sql.c"
- break;
- case 213: /* type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */
-#line 409 "sql.y"
-{ yymsp[-3].minor.yy400 = createVarLenDataType(TSDB_DATA_TYPE_GEOMETRY, &yymsp[-1].minor.yy0); }
-#line 6151 "sql.c"
- break;
- case 214: /* type_name ::= DECIMAL */
-#line 410 "sql.y"
-{ yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
-#line 6156 "sql.c"
- break;
- case 215: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */
-#line 411 "sql.y"
-{ yymsp[-3].minor.yy400 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
-#line 6161 "sql.c"
- break;
- case 216: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */
-#line 412 "sql.y"
-{ yymsp[-5].minor.yy400 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
-#line 6166 "sql.c"
- break;
- case 219: /* tags_def ::= TAGS NK_LP column_def_list NK_RP */
- case 372: /* tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */ yytestcase(yyruleno==372);
-#line 421 "sql.y"
-{ yymsp[-3].minor.yy88 = yymsp[-1].minor.yy88; }
-#line 6172 "sql.c"
- break;
- case 220: /* table_options ::= */
-#line 423 "sql.y"
-{ yymsp[1].minor.yy232 = createDefaultTableOptions(pCxt); }
-#line 6177 "sql.c"
- break;
- case 221: /* table_options ::= table_options COMMENT NK_STRING */
-#line 424 "sql.y"
-{ yylhsminor.yy232 = setTableOption(pCxt, yymsp[-2].minor.yy232, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); }
-#line 6182 "sql.c"
- yymsp[-2].minor.yy232 = yylhsminor.yy232;
- break;
- case 222: /* table_options ::= table_options MAX_DELAY duration_list */
-#line 425 "sql.y"
-{ yylhsminor.yy232 = setTableOption(pCxt, yymsp[-2].minor.yy232, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy88); }
-#line 6188 "sql.c"
- yymsp[-2].minor.yy232 = yylhsminor.yy232;
- break;
- case 223: /* table_options ::= table_options WATERMARK duration_list */
-#line 426 "sql.y"
-{ yylhsminor.yy232 = setTableOption(pCxt, yymsp[-2].minor.yy232, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy88); }
-#line 6194 "sql.c"
- yymsp[-2].minor.yy232 = yylhsminor.yy232;
- break;
- case 224: /* table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */
-#line 427 "sql.y"
-{ yylhsminor.yy232 = setTableOption(pCxt, yymsp[-4].minor.yy232, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy88); }
-#line 6200 "sql.c"
- yymsp[-4].minor.yy232 = yylhsminor.yy232;
- break;
- case 225: /* table_options ::= table_options TTL NK_INTEGER */
-#line 428 "sql.y"
-{ yylhsminor.yy232 = setTableOption(pCxt, yymsp[-2].minor.yy232, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); }
-#line 6206 "sql.c"
- yymsp[-2].minor.yy232 = yylhsminor.yy232;
- break;
- case 226: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */
-#line 429 "sql.y"
-{ yylhsminor.yy232 = setTableOption(pCxt, yymsp[-4].minor.yy232, TABLE_OPTION_SMA, yymsp[-1].minor.yy88); }
-#line 6212 "sql.c"
- yymsp[-4].minor.yy232 = yylhsminor.yy232;
- break;
- case 227: /* table_options ::= table_options DELETE_MARK duration_list */
-#line 430 "sql.y"
-{ yylhsminor.yy232 = setTableOption(pCxt, yymsp[-2].minor.yy232, TABLE_OPTION_DELETE_MARK, yymsp[0].minor.yy88); }
-#line 6218 "sql.c"
- yymsp[-2].minor.yy232 = yylhsminor.yy232;
- break;
- case 228: /* alter_table_options ::= alter_table_option */
-#line 432 "sql.y"
-{ yylhsminor.yy232 = createAlterTableOptions(pCxt); yylhsminor.yy232 = setTableOption(pCxt, yylhsminor.yy232, yymsp[0].minor.yy117.type, &yymsp[0].minor.yy117.val); }
-#line 6224 "sql.c"
- yymsp[0].minor.yy232 = yylhsminor.yy232;
- break;
- case 229: /* alter_table_options ::= alter_table_options alter_table_option */
-#line 433 "sql.y"
-{ yylhsminor.yy232 = setTableOption(pCxt, yymsp[-1].minor.yy232, yymsp[0].minor.yy117.type, &yymsp[0].minor.yy117.val); }
-#line 6230 "sql.c"
- yymsp[-1].minor.yy232 = yylhsminor.yy232;
- break;
- case 230: /* alter_table_option ::= COMMENT NK_STRING */
-#line 437 "sql.y"
-{ yymsp[-1].minor.yy117.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy117.val = yymsp[0].minor.yy0; }
-#line 6236 "sql.c"
- break;
- case 231: /* alter_table_option ::= TTL NK_INTEGER */
-#line 438 "sql.y"
-{ yymsp[-1].minor.yy117.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy117.val = yymsp[0].minor.yy0; }
-#line 6241 "sql.c"
- break;
- case 232: /* duration_list ::= duration_literal */
- case 459: /* expression_list ::= expr_or_subquery */ yytestcase(yyruleno==459);
-#line 442 "sql.y"
-{ yylhsminor.yy88 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy232)); }
-#line 6247 "sql.c"
- yymsp[0].minor.yy88 = yylhsminor.yy88;
- break;
- case 233: /* duration_list ::= duration_list NK_COMMA duration_literal */
- case 460: /* expression_list ::= expression_list NK_COMMA expr_or_subquery */ yytestcase(yyruleno==460);
-#line 443 "sql.y"
-{ yylhsminor.yy88 = addNodeToList(pCxt, yymsp[-2].minor.yy88, releaseRawExprNode(pCxt, yymsp[0].minor.yy232)); }
-#line 6254 "sql.c"
- yymsp[-2].minor.yy88 = yylhsminor.yy88;
- break;
- case 236: /* rollup_func_name ::= function_name */
-#line 450 "sql.y"
-{ yylhsminor.yy232 = createFunctionNode(pCxt, &yymsp[0].minor.yy993, NULL); }
-#line 6260 "sql.c"
- yymsp[0].minor.yy232 = yylhsminor.yy232;
- break;
- case 237: /* rollup_func_name ::= FIRST */
- case 238: /* rollup_func_name ::= LAST */ yytestcase(yyruleno==238);
- case 306: /* tag_item ::= QTAGS */ yytestcase(yyruleno==306);
-#line 451 "sql.y"
-{ yylhsminor.yy232 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); }
-#line 6268 "sql.c"
- yymsp[0].minor.yy232 = yylhsminor.yy232;
- break;
- case 241: /* col_name ::= column_name */
- case 307: /* tag_item ::= column_name */ yytestcase(yyruleno==307);
-#line 459 "sql.y"
-{ yylhsminor.yy232 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy993); }
-#line 6275 "sql.c"
- yymsp[0].minor.yy232 = yylhsminor.yy232;
- break;
- case 242: /* cmd ::= SHOW DNODES */
-#line 462 "sql.y"
+ break;
+ case 146: /* alter_db_option ::= KEEP_TIME_OFFSET NK_INTEGER */
+{ yymsp[-1].minor.yy529.type = DB_OPTION_KEEP_TIME_OFFSET; yymsp[-1].minor.yy529.val = yymsp[0].minor.yy0; }
+ break;
+ case 147: /* integer_list ::= NK_INTEGER */
+{ yylhsminor.yy502 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy502 = yylhsminor.yy502;
+ break;
+ case 148: /* integer_list ::= integer_list NK_COMMA NK_INTEGER */
+ case 403: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==403);
+{ yylhsminor.yy502 = addNodeToList(pCxt, yymsp[-2].minor.yy502, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
+ yymsp[-2].minor.yy502 = yylhsminor.yy502;
+ break;
+ case 149: /* variable_list ::= NK_VARIABLE */
+{ yylhsminor.yy502 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy502 = yylhsminor.yy502;
+ break;
+ case 150: /* variable_list ::= variable_list NK_COMMA NK_VARIABLE */
+{ yylhsminor.yy502 = addNodeToList(pCxt, yymsp[-2].minor.yy502, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
+ yymsp[-2].minor.yy502 = yylhsminor.yy502;
+ break;
+ case 151: /* retention_list ::= retention */
+ case 182: /* multi_create_clause ::= create_subtable_clause */ yytestcase(yyruleno==182);
+ case 185: /* multi_drop_clause ::= drop_table_clause */ yytestcase(yyruleno==185);
+ case 192: /* column_def_list ::= column_def */ yytestcase(yyruleno==192);
+ case 236: /* rollup_func_list ::= rollup_func_name */ yytestcase(yyruleno==236);
+ case 241: /* col_name_list ::= col_name */ yytestcase(yyruleno==241);
+ case 308: /* tag_list_opt ::= tag_item */ yytestcase(yyruleno==308);
+ case 325: /* func_list ::= func */ yytestcase(yyruleno==325);
+ case 432: /* literal_list ::= signed_literal */ yytestcase(yyruleno==432);
+ case 503: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==503);
+ case 509: /* when_then_list ::= when_then_expr */ yytestcase(yyruleno==509);
+ case 568: /* select_list ::= select_item */ yytestcase(yyruleno==568);
+ case 579: /* partition_list ::= partition_item */ yytestcase(yyruleno==579);
+ case 638: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==638);
+{ yylhsminor.yy502 = createNodeList(pCxt, yymsp[0].minor.yy490); }
+ yymsp[0].minor.yy502 = yylhsminor.yy502;
+ break;
+ case 152: /* retention_list ::= retention_list NK_COMMA retention */
+ case 186: /* multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ yytestcase(yyruleno==186);
+ case 193: /* column_def_list ::= column_def_list NK_COMMA column_def */ yytestcase(yyruleno==193);
+ case 237: /* rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ yytestcase(yyruleno==237);
+ case 242: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==242);
+ case 309: /* tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ yytestcase(yyruleno==309);
+ case 326: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==326);
+ case 433: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==433);
+ case 504: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==504);
+ case 569: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==569);
+ case 580: /* partition_list ::= partition_list NK_COMMA partition_item */ yytestcase(yyruleno==580);
+ case 639: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==639);
+{ yylhsminor.yy502 = addNodeToList(pCxt, yymsp[-2].minor.yy502, yymsp[0].minor.yy490); }
+ yymsp[-2].minor.yy502 = yylhsminor.yy502;
+ break;
+ case 153: /* retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */
+ case 154: /* retention ::= NK_MINUS NK_COLON NK_VARIABLE */ yytestcase(yyruleno==154);
+{ yylhsminor.yy490 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
+ yymsp[-2].minor.yy490 = yylhsminor.yy490;
+ break;
+ case 155: /* speed_opt ::= */
+ case 359: /* bufsize_opt ::= */ yytestcase(yyruleno==359);
+{ yymsp[1].minor.yy774 = 0; }
+ break;
+ case 156: /* speed_opt ::= BWLIMIT NK_INTEGER */
+ case 360: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ yytestcase(yyruleno==360);
+{ yymsp[-1].minor.yy774 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); }
+ break;
+ case 158: /* start_opt ::= START WITH NK_INTEGER */
+ case 162: /* end_opt ::= END WITH NK_INTEGER */ yytestcase(yyruleno==162);
+{ yymsp[-2].minor.yy490 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); }
+ break;
+ case 159: /* start_opt ::= START WITH NK_STRING */
+ case 163: /* end_opt ::= END WITH NK_STRING */ yytestcase(yyruleno==163);
+{ yymsp[-2].minor.yy490 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); }
+ break;
+ case 160: /* start_opt ::= START WITH TIMESTAMP NK_STRING */
+ case 164: /* end_opt ::= END WITH TIMESTAMP NK_STRING */ yytestcase(yyruleno==164);
+{ yymsp[-3].minor.yy490 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); }
+ break;
+ case 165: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */
+ case 167: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==167);
+{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy845, yymsp[-5].minor.yy490, yymsp[-3].minor.yy502, yymsp[-1].minor.yy502, yymsp[0].minor.yy490); }
+ break;
+ case 166: /* cmd ::= CREATE TABLE multi_create_clause */
+{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy502); }
+ break;
+ case 168: /* cmd ::= DROP TABLE multi_drop_clause */
+{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy502); }
+ break;
+ case 169: /* cmd ::= DROP STABLE exists_opt full_table_name */
+{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy845, yymsp[0].minor.yy490); }
+ break;
+ case 170: /* cmd ::= ALTER TABLE alter_table_clause */
+ case 405: /* cmd ::= query_or_subquery */ yytestcase(yyruleno==405);
+ case 406: /* cmd ::= insert_query */ yytestcase(yyruleno==406);
+{ pCxt->pRootNode = yymsp[0].minor.yy490; }
+ break;
+ case 171: /* cmd ::= ALTER STABLE alter_table_clause */
+{ pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy490); }
+ break;
+ case 172: /* alter_table_clause ::= full_table_name alter_table_options */
+{ yylhsminor.yy490 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy490, yymsp[0].minor.yy490); }
+ yymsp[-1].minor.yy490 = yylhsminor.yy490;
+ break;
+ case 173: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */
+{ yylhsminor.yy490 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy490, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy561, yymsp[0].minor.yy826); }
+ yymsp[-4].minor.yy490 = yylhsminor.yy490;
+ break;
+ case 174: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */
+{ yylhsminor.yy490 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy490, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy561); }
+ yymsp[-3].minor.yy490 = yylhsminor.yy490;
+ break;
+ case 175: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */
+{ yylhsminor.yy490 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy490, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy561, yymsp[0].minor.yy826); }
+ yymsp[-4].minor.yy490 = yylhsminor.yy490;
+ break;
+ case 176: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */
+{ yylhsminor.yy490 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy490, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy561, &yymsp[0].minor.yy561); }
+ yymsp[-4].minor.yy490 = yylhsminor.yy490;
+ break;
+ case 177: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */
+{ yylhsminor.yy490 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy490, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy561, yymsp[0].minor.yy826); }
+ yymsp[-4].minor.yy490 = yylhsminor.yy490;
+ break;
+ case 178: /* alter_table_clause ::= full_table_name DROP TAG column_name */
+{ yylhsminor.yy490 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy490, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy561); }
+ yymsp[-3].minor.yy490 = yylhsminor.yy490;
+ break;
+ case 179: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */
+{ yylhsminor.yy490 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy490, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy561, yymsp[0].minor.yy826); }
+ yymsp[-4].minor.yy490 = yylhsminor.yy490;
+ break;
+ case 180: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */
+{ yylhsminor.yy490 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy490, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy561, &yymsp[0].minor.yy561); }
+ yymsp[-4].minor.yy490 = yylhsminor.yy490;
+ break;
+ case 181: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */
+{ yylhsminor.yy490 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy490, &yymsp[-2].minor.yy561, yymsp[0].minor.yy490); }
+ yymsp[-5].minor.yy490 = yylhsminor.yy490;
+ break;
+ case 183: /* multi_create_clause ::= multi_create_clause create_subtable_clause */
+ case 510: /* when_then_list ::= when_then_list when_then_expr */ yytestcase(yyruleno==510);
+{ yylhsminor.yy502 = addNodeToList(pCxt, yymsp[-1].minor.yy502, yymsp[0].minor.yy490); }
+ yymsp[-1].minor.yy502 = yylhsminor.yy502;
+ break;
+ case 184: /* create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP expression_list NK_RP table_options */
+{ yylhsminor.yy490 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy845, yymsp[-8].minor.yy490, yymsp[-6].minor.yy490, yymsp[-5].minor.yy502, yymsp[-2].minor.yy502, yymsp[0].minor.yy490); }
+ yymsp[-9].minor.yy490 = yylhsminor.yy490;
+ break;
+ case 187: /* drop_table_clause ::= exists_opt full_table_name */
+{ yylhsminor.yy490 = createDropTableClause(pCxt, yymsp[-1].minor.yy845, yymsp[0].minor.yy490); }
+ yymsp[-1].minor.yy490 = yylhsminor.yy490;
+ break;
+ case 189: /* specific_cols_opt ::= NK_LP col_name_list NK_RP */
+ case 374: /* col_list_opt ::= NK_LP col_name_list NK_RP */ yytestcase(yyruleno==374);
+{ yymsp[-2].minor.yy502 = yymsp[-1].minor.yy502; }
+ break;
+ case 190: /* full_table_name ::= table_name */
+{ yylhsminor.yy490 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy561, NULL); }
+ yymsp[0].minor.yy490 = yylhsminor.yy490;
+ break;
+ case 191: /* full_table_name ::= db_name NK_DOT table_name */
+{ yylhsminor.yy490 = createRealTableNode(pCxt, &yymsp[-2].minor.yy561, &yymsp[0].minor.yy561, NULL); }
+ yymsp[-2].minor.yy490 = yylhsminor.yy490;
+ break;
+ case 194: /* column_def ::= column_name type_name */
+{ yylhsminor.yy490 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy561, yymsp[0].minor.yy826, NULL); }
+ yymsp[-1].minor.yy490 = yylhsminor.yy490;
+ break;
+ case 195: /* type_name ::= BOOL */
+{ yymsp[0].minor.yy826 = createDataType(TSDB_DATA_TYPE_BOOL); }
+ break;
+ case 196: /* type_name ::= TINYINT */
+{ yymsp[0].minor.yy826 = createDataType(TSDB_DATA_TYPE_TINYINT); }
+ break;
+ case 197: /* type_name ::= SMALLINT */
+{ yymsp[0].minor.yy826 = createDataType(TSDB_DATA_TYPE_SMALLINT); }
+ break;
+ case 198: /* type_name ::= INT */
+ case 199: /* type_name ::= INTEGER */ yytestcase(yyruleno==199);
+{ yymsp[0].minor.yy826 = createDataType(TSDB_DATA_TYPE_INT); }
+ break;
+ case 200: /* type_name ::= BIGINT */
+{ yymsp[0].minor.yy826 = createDataType(TSDB_DATA_TYPE_BIGINT); }
+ break;
+ case 201: /* type_name ::= FLOAT */
+{ yymsp[0].minor.yy826 = createDataType(TSDB_DATA_TYPE_FLOAT); }
+ break;
+ case 202: /* type_name ::= DOUBLE */
+{ yymsp[0].minor.yy826 = createDataType(TSDB_DATA_TYPE_DOUBLE); }
+ break;
+ case 203: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */
+{ yymsp[-3].minor.yy826 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); }
+ break;
+ case 204: /* type_name ::= TIMESTAMP */
+{ yymsp[0].minor.yy826 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); }
+ break;
+ case 205: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */
+{ yymsp[-3].minor.yy826 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); }
+ break;
+ case 206: /* type_name ::= TINYINT UNSIGNED */
+{ yymsp[-1].minor.yy826 = createDataType(TSDB_DATA_TYPE_UTINYINT); }
+ break;
+ case 207: /* type_name ::= SMALLINT UNSIGNED */
+{ yymsp[-1].minor.yy826 = createDataType(TSDB_DATA_TYPE_USMALLINT); }
+ break;
+ case 208: /* type_name ::= INT UNSIGNED */
+{ yymsp[-1].minor.yy826 = createDataType(TSDB_DATA_TYPE_UINT); }
+ break;
+ case 209: /* type_name ::= BIGINT UNSIGNED */
+{ yymsp[-1].minor.yy826 = createDataType(TSDB_DATA_TYPE_UBIGINT); }
+ break;
+ case 210: /* type_name ::= JSON */
+{ yymsp[0].minor.yy826 = createDataType(TSDB_DATA_TYPE_JSON); }
+ break;
+ case 211: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */
+{ yymsp[-3].minor.yy826 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); }
+ break;
+ case 212: /* type_name ::= MEDIUMBLOB */
+{ yymsp[0].minor.yy826 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); }
+ break;
+ case 213: /* type_name ::= BLOB */
+{ yymsp[0].minor.yy826 = createDataType(TSDB_DATA_TYPE_BLOB); }
+ break;
+ case 214: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */
+{ yymsp[-3].minor.yy826 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); }
+ break;
+ case 215: /* type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */
+{ yymsp[-3].minor.yy826 = createVarLenDataType(TSDB_DATA_TYPE_GEOMETRY, &yymsp[-1].minor.yy0); }
+ break;
+ case 216: /* type_name ::= DECIMAL */
+{ yymsp[0].minor.yy826 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
+ break;
+ case 217: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */
+{ yymsp[-3].minor.yy826 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
+ break;
+ case 218: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */
+{ yymsp[-5].minor.yy826 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
+ break;
+ case 221: /* tags_def ::= TAGS NK_LP column_def_list NK_RP */
+ case 377: /* tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */ yytestcase(yyruleno==377);
+{ yymsp[-3].minor.yy502 = yymsp[-1].minor.yy502; }
+ break;
+ case 222: /* table_options ::= */
+{ yymsp[1].minor.yy490 = createDefaultTableOptions(pCxt); }
+ break;
+ case 223: /* table_options ::= table_options COMMENT NK_STRING */
+{ yylhsminor.yy490 = setTableOption(pCxt, yymsp[-2].minor.yy490, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy490 = yylhsminor.yy490;
+ break;
+ case 224: /* table_options ::= table_options MAX_DELAY duration_list */
+{ yylhsminor.yy490 = setTableOption(pCxt, yymsp[-2].minor.yy490, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy502); }
+ yymsp[-2].minor.yy490 = yylhsminor.yy490;
+ break;
+ case 225: /* table_options ::= table_options WATERMARK duration_list */
+{ yylhsminor.yy490 = setTableOption(pCxt, yymsp[-2].minor.yy490, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy502); }
+ yymsp[-2].minor.yy490 = yylhsminor.yy490;
+ break;
+ case 226: /* table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */
+{ yylhsminor.yy490 = setTableOption(pCxt, yymsp[-4].minor.yy490, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy502); }
+ yymsp[-4].minor.yy490 = yylhsminor.yy490;
+ break;
+ case 227: /* table_options ::= table_options TTL NK_INTEGER */
+{ yylhsminor.yy490 = setTableOption(pCxt, yymsp[-2].minor.yy490, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy490 = yylhsminor.yy490;
+ break;
+ case 228: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */
+{ yylhsminor.yy490 = setTableOption(pCxt, yymsp[-4].minor.yy490, TABLE_OPTION_SMA, yymsp[-1].minor.yy502); }
+ yymsp[-4].minor.yy490 = yylhsminor.yy490;
+ break;
+ case 229: /* table_options ::= table_options DELETE_MARK duration_list */
+{ yylhsminor.yy490 = setTableOption(pCxt, yymsp[-2].minor.yy490, TABLE_OPTION_DELETE_MARK, yymsp[0].minor.yy502); }
+ yymsp[-2].minor.yy490 = yylhsminor.yy490;
+ break;
+ case 230: /* alter_table_options ::= alter_table_option */
+{ yylhsminor.yy490 = createAlterTableOptions(pCxt); yylhsminor.yy490 = setTableOption(pCxt, yylhsminor.yy490, yymsp[0].minor.yy529.type, &yymsp[0].minor.yy529.val); }
+ yymsp[0].minor.yy490 = yylhsminor.yy490;
+ break;
+ case 231: /* alter_table_options ::= alter_table_options alter_table_option */
+{ yylhsminor.yy490 = setTableOption(pCxt, yymsp[-1].minor.yy490, yymsp[0].minor.yy529.type, &yymsp[0].minor.yy529.val); }
+ yymsp[-1].minor.yy490 = yylhsminor.yy490;
+ break;
+ case 232: /* alter_table_option ::= COMMENT NK_STRING */
+{ yymsp[-1].minor.yy529.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy529.val = yymsp[0].minor.yy0; }
+ break;
+ case 233: /* alter_table_option ::= TTL NK_INTEGER */
+{ yymsp[-1].minor.yy529.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy529.val = yymsp[0].minor.yy0; }
+ break;
+ case 234: /* duration_list ::= duration_literal */
+ case 464: /* expression_list ::= expr_or_subquery */ yytestcase(yyruleno==464);
+{ yylhsminor.yy502 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy490)); }
+ yymsp[0].minor.yy502 = yylhsminor.yy502;
+ break;
+ case 235: /* duration_list ::= duration_list NK_COMMA duration_literal */
+ case 465: /* expression_list ::= expression_list NK_COMMA expr_or_subquery */ yytestcase(yyruleno==465);
+{ yylhsminor.yy502 = addNodeToList(pCxt, yymsp[-2].minor.yy502, releaseRawExprNode(pCxt, yymsp[0].minor.yy490)); }
+ yymsp[-2].minor.yy502 = yylhsminor.yy502;
+ break;
+ case 238: /* rollup_func_name ::= function_name */
+{ yylhsminor.yy490 = createFunctionNode(pCxt, &yymsp[0].minor.yy561, NULL); }
+ yymsp[0].minor.yy490 = yylhsminor.yy490;
+ break;
+ case 239: /* rollup_func_name ::= FIRST */
+ case 240: /* rollup_func_name ::= LAST */ yytestcase(yyruleno==240);
+ case 311: /* tag_item ::= QTAGS */ yytestcase(yyruleno==311);
+{ yylhsminor.yy490 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); }
+ yymsp[0].minor.yy490 = yylhsminor.yy490;
+ break;
+ case 243: /* col_name ::= column_name */
+ case 312: /* tag_item ::= column_name */ yytestcase(yyruleno==312);
+{ yylhsminor.yy490 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy561); }
+ yymsp[0].minor.yy490 = yylhsminor.yy490;
+ break;
+ case 244: /* cmd ::= SHOW DNODES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DNODES_STMT); }
-#line 6281 "sql.c"
break;
- case 243: /* cmd ::= SHOW USERS */
-#line 463 "sql.y"
+ case 245: /* cmd ::= SHOW USERS */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USERS_STMT); }
-#line 6286 "sql.c"
break;
- case 244: /* cmd ::= SHOW USER PRIVILEGES */
-#line 464 "sql.y"
+ case 246: /* cmd ::= SHOW USER PRIVILEGES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USER_PRIVILEGES_STMT); }
-#line 6291 "sql.c"
break;
- case 245: /* cmd ::= SHOW db_kind_opt DATABASES */
-#line 465 "sql.y"
+ case 247: /* cmd ::= SHOW db_kind_opt DATABASES */
{
pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT);
- setShowKind(pCxt, pCxt->pRootNode, yymsp[-1].minor.yy281);
+ setShowKind(pCxt, pCxt->pRootNode, yymsp[-1].minor.yy579);
}
-#line 6299 "sql.c"
break;
- case 246: /* cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt */
-#line 469 "sql.y"
+ case 248: /* cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt */
{
- pCxt->pRootNode = createShowTablesStmt(pCxt, yymsp[-2].minor.yy133, yymsp[0].minor.yy232, OP_TYPE_LIKE);
+ pCxt->pRootNode = createShowTablesStmt(pCxt, yymsp[-2].minor.yy961, yymsp[0].minor.yy490, OP_TYPE_LIKE);
}
-#line 6306 "sql.c"
break;
- case 247: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */
-#line 472 "sql.y"
-{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy232, yymsp[0].minor.yy232, OP_TYPE_LIKE); }
-#line 6311 "sql.c"
+ case 249: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */
+{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy490, yymsp[0].minor.yy490, OP_TYPE_LIKE); }
break;
- case 248: /* cmd ::= SHOW db_name_cond_opt VGROUPS */
-#line 473 "sql.y"
-{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy232, NULL, OP_TYPE_LIKE); }
-#line 6316 "sql.c"
+ case 250: /* cmd ::= SHOW db_name_cond_opt VGROUPS */
+{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy490, NULL, OP_TYPE_LIKE); }
break;
- case 249: /* cmd ::= SHOW MNODES */
-#line 474 "sql.y"
+ case 251: /* cmd ::= SHOW MNODES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MNODES_STMT); }
-#line 6321 "sql.c"
break;
- case 250: /* cmd ::= SHOW QNODES */
-#line 476 "sql.y"
+ case 252: /* cmd ::= SHOW QNODES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QNODES_STMT); }
-#line 6326 "sql.c"
break;
- case 251: /* cmd ::= SHOW FUNCTIONS */
-#line 477 "sql.y"
+ case 253: /* cmd ::= SHOW FUNCTIONS */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_FUNCTIONS_STMT); }
-#line 6331 "sql.c"
break;
- case 252: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */
-#line 478 "sql.y"
-{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy232, yymsp[-1].minor.yy232, OP_TYPE_EQUAL); }
-#line 6336 "sql.c"
+ case 254: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */
+{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy490, yymsp[-1].minor.yy490, OP_TYPE_EQUAL); }
break;
- case 253: /* cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */
-#line 479 "sql.y"
-{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy993), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy993), OP_TYPE_EQUAL); }
-#line 6341 "sql.c"
+ case 255: /* cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */
+{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy561), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy561), OP_TYPE_EQUAL); }
break;
- case 254: /* cmd ::= SHOW STREAMS */
-#line 480 "sql.y"
+ case 256: /* cmd ::= SHOW STREAMS */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STREAMS_STMT); }
-#line 6346 "sql.c"
break;
- case 255: /* cmd ::= SHOW ACCOUNTS */
-#line 481 "sql.y"
+ case 257: /* cmd ::= SHOW ACCOUNTS */
{ pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); }
-#line 6351 "sql.c"
break;
- case 256: /* cmd ::= SHOW APPS */
-#line 482 "sql.y"
+ case 258: /* cmd ::= SHOW APPS */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_APPS_STMT); }
-#line 6356 "sql.c"
break;
- case 257: /* cmd ::= SHOW CONNECTIONS */
-#line 483 "sql.y"
+ case 259: /* cmd ::= SHOW CONNECTIONS */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONNECTIONS_STMT); }
-#line 6361 "sql.c"
break;
- case 258: /* cmd ::= SHOW LICENCES */
- case 259: /* cmd ::= SHOW GRANTS */ yytestcase(yyruleno==259);
-#line 484 "sql.y"
+ case 260: /* cmd ::= SHOW LICENCES */
+ case 261: /* cmd ::= SHOW GRANTS */ yytestcase(yyruleno==261);
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LICENCES_STMT); }
-#line 6367 "sql.c"
break;
- case 260: /* cmd ::= SHOW CREATE DATABASE db_name */
-#line 486 "sql.y"
-{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy993); }
-#line 6372 "sql.c"
+ case 262: /* cmd ::= SHOW GRANTS FULL */
+{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_GRANTS_FULL_STMT); }
break;
- case 261: /* cmd ::= SHOW CREATE TABLE full_table_name */
-#line 487 "sql.y"
-{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy232); }
-#line 6377 "sql.c"
+ case 263: /* cmd ::= SHOW GRANTS LOGS */
+{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_GRANTS_LOGS_STMT); }
break;
- case 262: /* cmd ::= SHOW CREATE STABLE full_table_name */
-#line 488 "sql.y"
-{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy232); }
-#line 6382 "sql.c"
+ case 264: /* cmd ::= SHOW CLUSTER MACHINES */
+{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CLUSTER_MACHINES_STMT); }
break;
- case 263: /* cmd ::= SHOW QUERIES */
-#line 489 "sql.y"
+ case 265: /* cmd ::= SHOW CREATE DATABASE db_name */
+{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy561); }
+ break;
+ case 266: /* cmd ::= SHOW CREATE TABLE full_table_name */
+{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy490); }
+ break;
+ case 267: /* cmd ::= SHOW CREATE STABLE full_table_name */
+{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy490); }
+ break;
+ case 268: /* cmd ::= SHOW QUERIES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QUERIES_STMT); }
-#line 6387 "sql.c"
break;
- case 264: /* cmd ::= SHOW SCORES */
-#line 490 "sql.y"
+ case 269: /* cmd ::= SHOW SCORES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SCORES_STMT); }
-#line 6392 "sql.c"
break;
- case 265: /* cmd ::= SHOW TOPICS */
-#line 491 "sql.y"
+ case 270: /* cmd ::= SHOW TOPICS */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TOPICS_STMT); }
-#line 6397 "sql.c"
break;
- case 266: /* cmd ::= SHOW VARIABLES */
- case 267: /* cmd ::= SHOW CLUSTER VARIABLES */ yytestcase(yyruleno==267);
-#line 492 "sql.y"
+ case 271: /* cmd ::= SHOW VARIABLES */
+ case 272: /* cmd ::= SHOW CLUSTER VARIABLES */ yytestcase(yyruleno==272);
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VARIABLES_STMT); }
-#line 6403 "sql.c"
break;
- case 268: /* cmd ::= SHOW LOCAL VARIABLES */
-#line 494 "sql.y"
+ case 273: /* cmd ::= SHOW LOCAL VARIABLES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LOCAL_VARIABLES_STMT); }
-#line 6408 "sql.c"
break;
- case 269: /* cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */
-#line 495 "sql.y"
-{ pCxt->pRootNode = createShowDnodeVariablesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[-2].minor.yy0), yymsp[0].minor.yy232); }
-#line 6413 "sql.c"
+ case 274: /* cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */
+{ pCxt->pRootNode = createShowDnodeVariablesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[-2].minor.yy0), yymsp[0].minor.yy490); }
break;
- case 270: /* cmd ::= SHOW BNODES */
-#line 496 "sql.y"
+ case 275: /* cmd ::= SHOW BNODES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_BNODES_STMT); }
-#line 6418 "sql.c"
break;
- case 271: /* cmd ::= SHOW SNODES */
-#line 497 "sql.y"
+ case 276: /* cmd ::= SHOW SNODES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SNODES_STMT); }
-#line 6423 "sql.c"
break;
- case 272: /* cmd ::= SHOW CLUSTER */
-#line 498 "sql.y"
+ case 277: /* cmd ::= SHOW CLUSTER */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CLUSTER_STMT); }
-#line 6428 "sql.c"
break;
- case 273: /* cmd ::= SHOW TRANSACTIONS */
-#line 499 "sql.y"
+ case 278: /* cmd ::= SHOW TRANSACTIONS */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TRANSACTIONS_STMT); }
-#line 6433 "sql.c"
break;
- case 274: /* cmd ::= SHOW TABLE DISTRIBUTED full_table_name */
-#line 500 "sql.y"
-{ pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy232); }
-#line 6438 "sql.c"
+ case 279: /* cmd ::= SHOW TABLE DISTRIBUTED full_table_name */
+{ pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy490); }
break;
- case 275: /* cmd ::= SHOW CONSUMERS */
-#line 501 "sql.y"
+ case 280: /* cmd ::= SHOW CONSUMERS */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONSUMERS_STMT); }
-#line 6443 "sql.c"
break;
- case 276: /* cmd ::= SHOW SUBSCRIPTIONS */
-#line 502 "sql.y"
+ case 281: /* cmd ::= SHOW SUBSCRIPTIONS */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SUBSCRIPTIONS_STMT); }
-#line 6448 "sql.c"
break;
- case 277: /* cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */
-#line 503 "sql.y"
-{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy232, yymsp[-1].minor.yy232, OP_TYPE_EQUAL); }
-#line 6453 "sql.c"
+ case 282: /* cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */
+{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy490, yymsp[-1].minor.yy490, OP_TYPE_EQUAL); }
break;
- case 278: /* cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */
-#line 504 "sql.y"
-{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy993), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy993), OP_TYPE_EQUAL); }
-#line 6458 "sql.c"
+ case 283: /* cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */
+{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy561), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy561), OP_TYPE_EQUAL); }
break;
- case 279: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */
-#line 505 "sql.y"
-{ pCxt->pRootNode = createShowTableTagsStmt(pCxt, yymsp[-1].minor.yy232, yymsp[0].minor.yy232, yymsp[-3].minor.yy88); }
-#line 6463 "sql.c"
+ case 284: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */
+{ pCxt->pRootNode = createShowTableTagsStmt(pCxt, yymsp[-1].minor.yy490, yymsp[0].minor.yy490, yymsp[-3].minor.yy502); }
break;
- case 280: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */
-#line 506 "sql.y"
-{ pCxt->pRootNode = createShowTableTagsStmt(pCxt, createIdentifierValueNode(pCxt, &yymsp[0].minor.yy993), createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy993), yymsp[-4].minor.yy88); }
-#line 6468 "sql.c"
+ case 285: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */
+{ pCxt->pRootNode = createShowTableTagsStmt(pCxt, createIdentifierValueNode(pCxt, &yymsp[0].minor.yy561), createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy561), yymsp[-4].minor.yy502); }
break;
- case 281: /* cmd ::= SHOW VNODES ON DNODE NK_INTEGER */
-#line 507 "sql.y"
+ case 286: /* cmd ::= SHOW VNODES ON DNODE NK_INTEGER */
{ pCxt->pRootNode = createShowVnodesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0), NULL); }
-#line 6473 "sql.c"
break;
- case 282: /* cmd ::= SHOW VNODES */
-#line 508 "sql.y"
+ case 287: /* cmd ::= SHOW VNODES */
{ pCxt->pRootNode = createShowVnodesStmt(pCxt, NULL, NULL); }
-#line 6478 "sql.c"
break;
- case 283: /* cmd ::= SHOW db_name_cond_opt ALIVE */
-#line 510 "sql.y"
-{ pCxt->pRootNode = createShowAliveStmt(pCxt, yymsp[-1].minor.yy232, QUERY_NODE_SHOW_DB_ALIVE_STMT); }
-#line 6483 "sql.c"
+ case 288: /* cmd ::= SHOW db_name_cond_opt ALIVE */
+{ pCxt->pRootNode = createShowAliveStmt(pCxt, yymsp[-1].minor.yy490, QUERY_NODE_SHOW_DB_ALIVE_STMT); }
break;
- case 284: /* cmd ::= SHOW CLUSTER ALIVE */
-#line 511 "sql.y"
+ case 289: /* cmd ::= SHOW CLUSTER ALIVE */
{ pCxt->pRootNode = createShowAliveStmt(pCxt, NULL, QUERY_NODE_SHOW_CLUSTER_ALIVE_STMT); }
-#line 6488 "sql.c"
break;
- case 285: /* cmd ::= SHOW db_name_cond_opt VIEWS */
-#line 512 "sql.y"
-{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VIEWS_STMT, yymsp[-1].minor.yy232, NULL, OP_TYPE_LIKE); }
-#line 6493 "sql.c"
+ case 290: /* cmd ::= SHOW db_name_cond_opt VIEWS */
+{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VIEWS_STMT, yymsp[-1].minor.yy490, NULL, OP_TYPE_LIKE); }
break;
- case 286: /* cmd ::= SHOW CREATE VIEW full_table_name */
-#line 513 "sql.y"
-{ pCxt->pRootNode = createShowCreateViewStmt(pCxt, QUERY_NODE_SHOW_CREATE_VIEW_STMT, yymsp[0].minor.yy232); }
-#line 6498 "sql.c"
+ case 291: /* cmd ::= SHOW CREATE VIEW full_table_name */
+{ pCxt->pRootNode = createShowCreateViewStmt(pCxt, QUERY_NODE_SHOW_CREATE_VIEW_STMT, yymsp[0].minor.yy490); }
break;
- case 287: /* cmd ::= SHOW COMPACTS */
-#line 514 "sql.y"
+ case 292: /* cmd ::= SHOW COMPACTS */
{ pCxt->pRootNode = createShowCompactsStmt(pCxt, QUERY_NODE_SHOW_COMPACTS_STMT); }
-#line 6503 "sql.c"
break;
- case 288: /* cmd ::= SHOW COMPACT NK_INTEGER */
-#line 515 "sql.y"
+ case 293: /* cmd ::= SHOW COMPACT NK_INTEGER */
{ pCxt->pRootNode = createShowCompactDetailsStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
-#line 6508 "sql.c"
break;
- case 289: /* table_kind_db_name_cond_opt ::= */
-#line 519 "sql.y"
-{ yymsp[1].minor.yy133.kind = SHOW_KIND_ALL; yymsp[1].minor.yy133.dbName = nil_token; }
-#line 6513 "sql.c"
+ case 294: /* table_kind_db_name_cond_opt ::= */
+{ yymsp[1].minor.yy961.kind = SHOW_KIND_ALL; yymsp[1].minor.yy961.dbName = nil_token; }
break;
- case 290: /* table_kind_db_name_cond_opt ::= table_kind */
-#line 520 "sql.y"
-{ yylhsminor.yy133.kind = yymsp[0].minor.yy281; yylhsminor.yy133.dbName = nil_token; }
-#line 6518 "sql.c"
- yymsp[0].minor.yy133 = yylhsminor.yy133;
+ case 295: /* table_kind_db_name_cond_opt ::= table_kind */
+{ yylhsminor.yy961.kind = yymsp[0].minor.yy579; yylhsminor.yy961.dbName = nil_token; }
+ yymsp[0].minor.yy961 = yylhsminor.yy961;
break;
- case 291: /* table_kind_db_name_cond_opt ::= db_name NK_DOT */
-#line 521 "sql.y"
-{ yylhsminor.yy133.kind = SHOW_KIND_ALL; yylhsminor.yy133.dbName = yymsp[-1].minor.yy993; }
-#line 6524 "sql.c"
- yymsp[-1].minor.yy133 = yylhsminor.yy133;
+ case 296: /* table_kind_db_name_cond_opt ::= db_name NK_DOT */
+{ yylhsminor.yy961.kind = SHOW_KIND_ALL; yylhsminor.yy961.dbName = yymsp[-1].minor.yy561; }
+ yymsp[-1].minor.yy961 = yylhsminor.yy961;
break;
- case 292: /* table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT */
-#line 522 "sql.y"
-{ yylhsminor.yy133.kind = yymsp[-2].minor.yy281; yylhsminor.yy133.dbName = yymsp[-1].minor.yy993; }
-#line 6530 "sql.c"
- yymsp[-2].minor.yy133 = yylhsminor.yy133;
+ case 297: /* table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT */
+{ yylhsminor.yy961.kind = yymsp[-2].minor.yy579; yylhsminor.yy961.dbName = yymsp[-1].minor.yy561; }
+ yymsp[-2].minor.yy961 = yylhsminor.yy961;
break;
- case 293: /* table_kind ::= NORMAL */
-#line 526 "sql.y"
-{ yymsp[0].minor.yy281 = SHOW_KIND_TABLES_NORMAL; }
-#line 6536 "sql.c"
+ case 298: /* table_kind ::= NORMAL */
+{ yymsp[0].minor.yy579 = SHOW_KIND_TABLES_NORMAL; }
break;
- case 294: /* table_kind ::= CHILD */
-#line 527 "sql.y"
-{ yymsp[0].minor.yy281 = SHOW_KIND_TABLES_CHILD; }
-#line 6541 "sql.c"
+ case 299: /* table_kind ::= CHILD */
+{ yymsp[0].minor.yy579 = SHOW_KIND_TABLES_CHILD; }
break;
- case 295: /* db_name_cond_opt ::= */
- case 300: /* from_db_opt ::= */ yytestcase(yyruleno==300);
-#line 529 "sql.y"
-{ yymsp[1].minor.yy232 = createDefaultDatabaseCondValue(pCxt); }
-#line 6547 "sql.c"
+ case 300: /* db_name_cond_opt ::= */
+ case 305: /* from_db_opt ::= */ yytestcase(yyruleno==305);
+{ yymsp[1].minor.yy490 = createDefaultDatabaseCondValue(pCxt); }
break;
- case 296: /* db_name_cond_opt ::= db_name NK_DOT */
-#line 530 "sql.y"
-{ yylhsminor.yy232 = createIdentifierValueNode(pCxt, &yymsp[-1].minor.yy993); }
-#line 6552 "sql.c"
- yymsp[-1].minor.yy232 = yylhsminor.yy232;
+ case 301: /* db_name_cond_opt ::= db_name NK_DOT */
+{ yylhsminor.yy490 = createIdentifierValueNode(pCxt, &yymsp[-1].minor.yy561); }
+ yymsp[-1].minor.yy490 = yylhsminor.yy490;
break;
- case 298: /* like_pattern_opt ::= LIKE NK_STRING */
-#line 533 "sql.y"
-{ yymsp[-1].minor.yy232 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); }
-#line 6558 "sql.c"
+ case 303: /* like_pattern_opt ::= LIKE NK_STRING */
+{ yymsp[-1].minor.yy490 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); }
break;
- case 299: /* table_name_cond ::= table_name */
-#line 535 "sql.y"
-{ yylhsminor.yy232 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy993); }
-#line 6563 "sql.c"
- yymsp[0].minor.yy232 = yylhsminor.yy232;
+ case 304: /* table_name_cond ::= table_name */
+{ yylhsminor.yy490 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy561); }
+ yymsp[0].minor.yy490 = yylhsminor.yy490;
break;
- case 301: /* from_db_opt ::= FROM db_name */
-#line 538 "sql.y"
-{ yymsp[-1].minor.yy232 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy993); }
-#line 6569 "sql.c"
+ case 306: /* from_db_opt ::= FROM db_name */
+{ yymsp[-1].minor.yy490 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy561); }
break;
- case 305: /* tag_item ::= TBNAME */
-#line 546 "sql.y"
-{ yylhsminor.yy232 = setProjectionAlias(pCxt, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL), &yymsp[0].minor.yy0); }
-#line 6574 "sql.c"
- yymsp[0].minor.yy232 = yylhsminor.yy232;
+ case 310: /* tag_item ::= TBNAME */
+{ yylhsminor.yy490 = setProjectionAlias(pCxt, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL), &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy490 = yylhsminor.yy490;
break;
- case 308: /* tag_item ::= column_name column_alias */
-#line 549 "sql.y"
-{ yylhsminor.yy232 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy993), &yymsp[0].minor.yy993); }
-#line 6580 "sql.c"
- yymsp[-1].minor.yy232 = yylhsminor.yy232;
+ case 313: /* tag_item ::= column_name column_alias */
+{ yylhsminor.yy490 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy561), &yymsp[0].minor.yy561); }
+ yymsp[-1].minor.yy490 = yylhsminor.yy490;
break;
- case 309: /* tag_item ::= column_name AS column_alias */
-#line 550 "sql.y"
-{ yylhsminor.yy232 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-2].minor.yy993), &yymsp[0].minor.yy993); }
-#line 6586 "sql.c"
- yymsp[-2].minor.yy232 = yylhsminor.yy232;
+ case 314: /* tag_item ::= column_name AS column_alias */
+{ yylhsminor.yy490 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-2].minor.yy561), &yymsp[0].minor.yy561); }
+ yymsp[-2].minor.yy490 = yylhsminor.yy490;
break;
- case 310: /* db_kind_opt ::= */
-#line 554 "sql.y"
-{ yymsp[1].minor.yy281 = SHOW_KIND_ALL; }
-#line 6592 "sql.c"
+ case 315: /* db_kind_opt ::= */
+{ yymsp[1].minor.yy579 = SHOW_KIND_ALL; }
break;
- case 311: /* db_kind_opt ::= USER */
-#line 555 "sql.y"
-{ yymsp[0].minor.yy281 = SHOW_KIND_DATABASES_USER; }
-#line 6597 "sql.c"
+ case 316: /* db_kind_opt ::= USER */
+{ yymsp[0].minor.yy579 = SHOW_KIND_DATABASES_USER; }
break;
- case 312: /* db_kind_opt ::= SYSTEM */
-#line 556 "sql.y"
-{ yymsp[0].minor.yy281 = SHOW_KIND_DATABASES_SYSTEM; }
-#line 6602 "sql.c"
+ case 317: /* db_kind_opt ::= SYSTEM */
+{ yymsp[0].minor.yy579 = SHOW_KIND_DATABASES_SYSTEM; }
break;
- case 313: /* cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options */
-#line 560 "sql.y"
-{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy985, yymsp[-3].minor.yy232, yymsp[-1].minor.yy232, NULL, yymsp[0].minor.yy232); }
-#line 6607 "sql.c"
+ case 318: /* cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options */
+{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy845, yymsp[-3].minor.yy490, yymsp[-1].minor.yy490, NULL, yymsp[0].minor.yy490); }
break;
- case 314: /* cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP */
-#line 562 "sql.y"
-{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_NORMAL, yymsp[-6].minor.yy985, yymsp[-5].minor.yy232, yymsp[-3].minor.yy232, yymsp[-1].minor.yy88, NULL); }
-#line 6612 "sql.c"
+ case 319: /* cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP */
+{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_NORMAL, yymsp[-6].minor.yy845, yymsp[-5].minor.yy490, yymsp[-3].minor.yy490, yymsp[-1].minor.yy502, NULL); }
break;
- case 315: /* cmd ::= DROP INDEX exists_opt full_index_name */
-#line 563 "sql.y"
-{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy985, yymsp[0].minor.yy232); }
-#line 6617 "sql.c"
+ case 320: /* cmd ::= DROP INDEX exists_opt full_index_name */
+{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy845, yymsp[0].minor.yy490); }
break;
- case 316: /* full_index_name ::= index_name */
-#line 565 "sql.y"
-{ yylhsminor.yy232 = createRealTableNodeForIndexName(pCxt, NULL, &yymsp[0].minor.yy993); }
-#line 6622 "sql.c"
- yymsp[0].minor.yy232 = yylhsminor.yy232;
+ case 321: /* full_index_name ::= index_name */
+{ yylhsminor.yy490 = createRealTableNodeForIndexName(pCxt, NULL, &yymsp[0].minor.yy561); }
+ yymsp[0].minor.yy490 = yylhsminor.yy490;
break;
- case 317: /* full_index_name ::= db_name NK_DOT index_name */
-#line 566 "sql.y"
-{ yylhsminor.yy232 = createRealTableNodeForIndexName(pCxt, &yymsp[-2].minor.yy993, &yymsp[0].minor.yy993); }
-#line 6628 "sql.c"
- yymsp[-2].minor.yy232 = yylhsminor.yy232;
+ case 322: /* full_index_name ::= db_name NK_DOT index_name */
+{ yylhsminor.yy490 = createRealTableNodeForIndexName(pCxt, &yymsp[-2].minor.yy561, &yymsp[0].minor.yy561); }
+ yymsp[-2].minor.yy490 = yylhsminor.yy490;
break;
- case 318: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */
-#line 569 "sql.y"
-{ yymsp[-9].minor.yy232 = createIndexOption(pCxt, yymsp[-7].minor.yy88, releaseRawExprNode(pCxt, yymsp[-3].minor.yy232), NULL, yymsp[-1].minor.yy232, yymsp[0].minor.yy232); }
-#line 6634 "sql.c"
+ case 323: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */
+{ yymsp[-9].minor.yy490 = createIndexOption(pCxt, yymsp[-7].minor.yy502, releaseRawExprNode(pCxt, yymsp[-3].minor.yy490), NULL, yymsp[-1].minor.yy490, yymsp[0].minor.yy490); }
break;
- case 319: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt */
-#line 572 "sql.y"
-{ yymsp[-11].minor.yy232 = createIndexOption(pCxt, yymsp[-9].minor.yy88, releaseRawExprNode(pCxt, yymsp[-5].minor.yy232), releaseRawExprNode(pCxt, yymsp[-3].minor.yy232), yymsp[-1].minor.yy232, yymsp[0].minor.yy232); }
-#line 6639 "sql.c"
+ case 324: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt */
+{ yymsp[-11].minor.yy490 = createIndexOption(pCxt, yymsp[-9].minor.yy502, releaseRawExprNode(pCxt, yymsp[-5].minor.yy490), releaseRawExprNode(pCxt, yymsp[-3].minor.yy490), yymsp[-1].minor.yy490, yymsp[0].minor.yy490); }
break;
- case 322: /* func ::= sma_func_name NK_LP expression_list NK_RP */
-#line 579 "sql.y"
-{ yylhsminor.yy232 = createFunctionNode(pCxt, &yymsp[-3].minor.yy993, yymsp[-1].minor.yy88); }
-#line 6644 "sql.c"
- yymsp[-3].minor.yy232 = yylhsminor.yy232;
+ case 327: /* func ::= sma_func_name NK_LP expression_list NK_RP */
+{ yylhsminor.yy490 = createFunctionNode(pCxt, &yymsp[-3].minor.yy561, yymsp[-1].minor.yy502); }
+ yymsp[-3].minor.yy490 = yylhsminor.yy490;
break;
- case 323: /* sma_func_name ::= function_name */
- case 548: /* alias_opt ::= table_alias */ yytestcase(yyruleno==548);
-#line 583 "sql.y"
-{ yylhsminor.yy993 = yymsp[0].minor.yy993; }
-#line 6651 "sql.c"
- yymsp[0].minor.yy993 = yylhsminor.yy993;
+ case 328: /* sma_func_name ::= function_name */
+ case 553: /* alias_opt ::= table_alias */ yytestcase(yyruleno==553);
+{ yylhsminor.yy561 = yymsp[0].minor.yy561; }
+ yymsp[0].minor.yy561 = yylhsminor.yy561;
break;
- case 328: /* sma_stream_opt ::= */
- case 373: /* stream_options ::= */ yytestcase(yyruleno==373);
-#line 589 "sql.y"
-{ yymsp[1].minor.yy232 = createStreamOptions(pCxt); }
-#line 6658 "sql.c"
+ case 333: /* sma_stream_opt ::= */
+ case 378: /* stream_options ::= */ yytestcase(yyruleno==378);
+{ yymsp[1].minor.yy490 = createStreamOptions(pCxt); }
break;
- case 329: /* sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */
-#line 590 "sql.y"
-{ ((SStreamOptions*)yymsp[-2].minor.yy232)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy232); yylhsminor.yy232 = yymsp[-2].minor.yy232; }
-#line 6663 "sql.c"
- yymsp[-2].minor.yy232 = yylhsminor.yy232;
+ case 334: /* sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */
+{ ((SStreamOptions*)yymsp[-2].minor.yy490)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy490); yylhsminor.yy490 = yymsp[-2].minor.yy490; }
+ yymsp[-2].minor.yy490 = yylhsminor.yy490;
break;
- case 330: /* sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */
-#line 591 "sql.y"
-{ ((SStreamOptions*)yymsp[-2].minor.yy232)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy232); yylhsminor.yy232 = yymsp[-2].minor.yy232; }
-#line 6669 "sql.c"
- yymsp[-2].minor.yy232 = yylhsminor.yy232;
+ case 335: /* sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */
+{ ((SStreamOptions*)yymsp[-2].minor.yy490)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy490); yylhsminor.yy490 = yymsp[-2].minor.yy490; }
+ yymsp[-2].minor.yy490 = yylhsminor.yy490;
break;
- case 331: /* sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */
-#line 592 "sql.y"
-{ ((SStreamOptions*)yymsp[-2].minor.yy232)->pDeleteMark = releaseRawExprNode(pCxt, yymsp[0].minor.yy232); yylhsminor.yy232 = yymsp[-2].minor.yy232; }
-#line 6675 "sql.c"
- yymsp[-2].minor.yy232 = yylhsminor.yy232;
+ case 336: /* sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */
+{ ((SStreamOptions*)yymsp[-2].minor.yy490)->pDeleteMark = releaseRawExprNode(pCxt, yymsp[0].minor.yy490); yylhsminor.yy490 = yymsp[-2].minor.yy490; }
+ yymsp[-2].minor.yy490 = yylhsminor.yy490;
break;
- case 332: /* with_meta ::= AS */
-#line 597 "sql.y"
-{ yymsp[0].minor.yy92 = 0; }
-#line 6681 "sql.c"
+ case 337: /* with_meta ::= AS */
+{ yymsp[0].minor.yy774 = 0; }
break;
- case 333: /* with_meta ::= WITH META AS */
-#line 598 "sql.y"
-{ yymsp[-2].minor.yy92 = 1; }
-#line 6686 "sql.c"
+ case 338: /* with_meta ::= WITH META AS */
+{ yymsp[-2].minor.yy774 = 1; }
break;
- case 334: /* with_meta ::= ONLY META AS */
-#line 599 "sql.y"
-{ yymsp[-2].minor.yy92 = 2; }
-#line 6691 "sql.c"
+ case 339: /* with_meta ::= ONLY META AS */
+{ yymsp[-2].minor.yy774 = 2; }
break;
- case 335: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */
-#line 601 "sql.y"
-{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy985, &yymsp[-2].minor.yy993, yymsp[0].minor.yy232); }
-#line 6696 "sql.c"
+ case 340: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */
+{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy845, &yymsp[-2].minor.yy561, yymsp[0].minor.yy490); }
break;
- case 336: /* cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */
-#line 603 "sql.y"
-{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy985, &yymsp[-3].minor.yy993, &yymsp[0].minor.yy993, yymsp[-2].minor.yy92); }
-#line 6701 "sql.c"
+ case 341: /* cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */
+{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy845, &yymsp[-3].minor.yy561, &yymsp[0].minor.yy561, yymsp[-2].minor.yy774); }
break;
- case 337: /* cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */
-#line 605 "sql.y"
-{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-5].minor.yy985, &yymsp[-4].minor.yy993, yymsp[-1].minor.yy232, yymsp[-3].minor.yy92, yymsp[0].minor.yy232); }
-#line 6706 "sql.c"
+ case 342: /* cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */
+{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-5].minor.yy845, &yymsp[-4].minor.yy561, yymsp[-1].minor.yy490, yymsp[-3].minor.yy774, yymsp[0].minor.yy490); }
break;
- case 338: /* cmd ::= DROP TOPIC exists_opt topic_name */
-#line 607 "sql.y"
-{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy985, &yymsp[0].minor.yy993); }
-#line 6711 "sql.c"
+ case 343: /* cmd ::= DROP TOPIC exists_opt topic_name */
+{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy845, &yymsp[0].minor.yy561); }
break;
- case 339: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */
-#line 608 "sql.y"
-{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy985, &yymsp[-2].minor.yy993, &yymsp[0].minor.yy993); }
-#line 6716 "sql.c"
+ case 344: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */
+{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy845, &yymsp[-2].minor.yy561, &yymsp[0].minor.yy561); }
break;
- case 340: /* cmd ::= DESC full_table_name */
- case 341: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==341);
-#line 611 "sql.y"
-{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy232); }
-#line 6722 "sql.c"
+ case 345: /* cmd ::= DESC full_table_name */
+ case 346: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==346);
+{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy490); }
break;
- case 342: /* cmd ::= RESET QUERY CACHE */
-#line 615 "sql.y"
+ case 347: /* cmd ::= RESET QUERY CACHE */
{ pCxt->pRootNode = createResetQueryCacheStmt(pCxt); }
-#line 6727 "sql.c"
break;
- case 343: /* cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */
- case 344: /* cmd ::= EXPLAIN analyze_opt explain_options insert_query */ yytestcase(yyruleno==344);
-#line 618 "sql.y"
-{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy985, yymsp[-1].minor.yy232, yymsp[0].minor.yy232); }
-#line 6733 "sql.c"
+ case 348: /* cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */
+ case 349: /* cmd ::= EXPLAIN analyze_opt explain_options insert_query */ yytestcase(yyruleno==349);
+{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy845, yymsp[-1].minor.yy490, yymsp[0].minor.yy490); }
break;
- case 347: /* explain_options ::= */
-#line 626 "sql.y"
-{ yymsp[1].minor.yy232 = createDefaultExplainOptions(pCxt); }
-#line 6738 "sql.c"
+ case 352: /* explain_options ::= */
+{ yymsp[1].minor.yy490 = createDefaultExplainOptions(pCxt); }
break;
- case 348: /* explain_options ::= explain_options VERBOSE NK_BOOL */
-#line 627 "sql.y"
-{ yylhsminor.yy232 = setExplainVerbose(pCxt, yymsp[-2].minor.yy232, &yymsp[0].minor.yy0); }
-#line 6743 "sql.c"
- yymsp[-2].minor.yy232 = yylhsminor.yy232;
+ case 353: /* explain_options ::= explain_options VERBOSE NK_BOOL */
+{ yylhsminor.yy490 = setExplainVerbose(pCxt, yymsp[-2].minor.yy490, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy490 = yylhsminor.yy490;
break;
- case 349: /* explain_options ::= explain_options RATIO NK_FLOAT */
-#line 628 "sql.y"
-{ yylhsminor.yy232 = setExplainRatio(pCxt, yymsp[-2].minor.yy232, &yymsp[0].minor.yy0); }
-#line 6749 "sql.c"
- yymsp[-2].minor.yy232 = yylhsminor.yy232;
+ case 354: /* explain_options ::= explain_options RATIO NK_FLOAT */
+{ yylhsminor.yy490 = setExplainRatio(pCxt, yymsp[-2].minor.yy490, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy490 = yylhsminor.yy490;
break;
- case 350: /* cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */
-#line 633 "sql.y"
-{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-7].minor.yy985, yymsp[-9].minor.yy985, &yymsp[-6].minor.yy993, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy400, yymsp[-1].minor.yy92, &yymsp[0].minor.yy993, yymsp[-10].minor.yy985); }
-#line 6755 "sql.c"
+ case 355: /* cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */
+{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-7].minor.yy845, yymsp[-9].minor.yy845, &yymsp[-6].minor.yy561, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy826, yymsp[-1].minor.yy774, &yymsp[0].minor.yy561, yymsp[-10].minor.yy845); }
break;
- case 351: /* cmd ::= DROP FUNCTION exists_opt function_name */
-#line 634 "sql.y"
-{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy985, &yymsp[0].minor.yy993); }
-#line 6760 "sql.c"
+ case 356: /* cmd ::= DROP FUNCTION exists_opt function_name */
+{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy845, &yymsp[0].minor.yy561); }
break;
- case 356: /* language_opt ::= */
- case 395: /* on_vgroup_id ::= */ yytestcase(yyruleno==395);
-#line 648 "sql.y"
-{ yymsp[1].minor.yy993 = nil_token; }
-#line 6766 "sql.c"
+ case 361: /* language_opt ::= */
+ case 400: /* on_vgroup_id ::= */ yytestcase(yyruleno==400);
+{ yymsp[1].minor.yy561 = nil_token; }
break;
- case 357: /* language_opt ::= LANGUAGE NK_STRING */
- case 396: /* on_vgroup_id ::= ON NK_INTEGER */ yytestcase(yyruleno==396);
-#line 649 "sql.y"
-{ yymsp[-1].minor.yy993 = yymsp[0].minor.yy0; }
-#line 6772 "sql.c"
+ case 362: /* language_opt ::= LANGUAGE NK_STRING */
+ case 401: /* on_vgroup_id ::= ON NK_INTEGER */ yytestcase(yyruleno==401);
+{ yymsp[-1].minor.yy561 = yymsp[0].minor.yy0; }
break;
- case 360: /* cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery */
-#line 658 "sql.y"
-{ pCxt->pRootNode = createCreateViewStmt(pCxt, yymsp[-4].minor.yy985, yymsp[-2].minor.yy232, &yymsp[-1].minor.yy0, yymsp[0].minor.yy232); }
-#line 6777 "sql.c"
+ case 365: /* cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery */
+{ pCxt->pRootNode = createCreateViewStmt(pCxt, yymsp[-4].minor.yy845, yymsp[-2].minor.yy490, &yymsp[-1].minor.yy0, yymsp[0].minor.yy490); }
break;
- case 361: /* cmd ::= DROP VIEW exists_opt full_view_name */
-#line 659 "sql.y"
-{ pCxt->pRootNode = createDropViewStmt(pCxt, yymsp[-1].minor.yy985, yymsp[0].minor.yy232); }
-#line 6782 "sql.c"
+ case 366: /* cmd ::= DROP VIEW exists_opt full_view_name */
+{ pCxt->pRootNode = createDropViewStmt(pCxt, yymsp[-1].minor.yy845, yymsp[0].minor.yy490); }
break;
- case 362: /* full_view_name ::= view_name */
-#line 661 "sql.y"
-{ yylhsminor.yy232 = createViewNode(pCxt, NULL, &yymsp[0].minor.yy993); }
-#line 6787 "sql.c"
- yymsp[0].minor.yy232 = yylhsminor.yy232;
+ case 367: /* full_view_name ::= view_name */
+{ yylhsminor.yy490 = createViewNode(pCxt, NULL, &yymsp[0].minor.yy561); }
+ yymsp[0].minor.yy490 = yylhsminor.yy490;
break;
- case 363: /* full_view_name ::= db_name NK_DOT view_name */
-#line 662 "sql.y"
-{ yylhsminor.yy232 = createViewNode(pCxt, &yymsp[-2].minor.yy993, &yymsp[0].minor.yy993); }
-#line 6793 "sql.c"
- yymsp[-2].minor.yy232 = yylhsminor.yy232;
+ case 368: /* full_view_name ::= db_name NK_DOT view_name */
+{ yylhsminor.yy490 = createViewNode(pCxt, &yymsp[-2].minor.yy561, &yymsp[0].minor.yy561); }
+ yymsp[-2].minor.yy490 = yylhsminor.yy490;
break;
- case 364: /* cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */
-#line 667 "sql.y"
-{ pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-9].minor.yy985, &yymsp[-8].minor.yy993, yymsp[-5].minor.yy232, yymsp[-7].minor.yy232, yymsp[-3].minor.yy88, yymsp[-2].minor.yy232, yymsp[0].minor.yy232, yymsp[-4].minor.yy88); }
-#line 6799 "sql.c"
+ case 369: /* cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */
+{ pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-9].minor.yy845, &yymsp[-8].minor.yy561, yymsp[-5].minor.yy490, yymsp[-7].minor.yy490, yymsp[-3].minor.yy502, yymsp[-2].minor.yy490, yymsp[0].minor.yy490, yymsp[-4].minor.yy502); }
break;
- case 365: /* cmd ::= DROP STREAM exists_opt stream_name */
-#line 668 "sql.y"
-{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy985, &yymsp[0].minor.yy993); }
-#line 6804 "sql.c"
+ case 370: /* cmd ::= DROP STREAM exists_opt stream_name */
+{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy845, &yymsp[0].minor.yy561); }
break;
- case 366: /* cmd ::= PAUSE STREAM exists_opt stream_name */
-#line 669 "sql.y"
-{ pCxt->pRootNode = createPauseStreamStmt(pCxt, yymsp[-1].minor.yy985, &yymsp[0].minor.yy993); }
-#line 6809 "sql.c"
+ case 371: /* cmd ::= PAUSE STREAM exists_opt stream_name */
+{ pCxt->pRootNode = createPauseStreamStmt(pCxt, yymsp[-1].minor.yy845, &yymsp[0].minor.yy561); }
break;
- case 367: /* cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */
-#line 670 "sql.y"
-{ pCxt->pRootNode = createResumeStreamStmt(pCxt, yymsp[-2].minor.yy985, yymsp[-1].minor.yy985, &yymsp[0].minor.yy993); }
-#line 6814 "sql.c"
+ case 372: /* cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */
+{ pCxt->pRootNode = createResumeStreamStmt(pCxt, yymsp[-2].minor.yy845, yymsp[-1].minor.yy845, &yymsp[0].minor.yy561); }
break;
- case 374: /* stream_options ::= stream_options TRIGGER AT_ONCE */
- case 375: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ yytestcase(yyruleno==375);
-#line 684 "sql.y"
-{ yylhsminor.yy232 = setStreamOptions(pCxt, yymsp[-2].minor.yy232, SOPT_TRIGGER_TYPE_SET, &yymsp[0].minor.yy0, NULL); }
-#line 6820 "sql.c"
- yymsp[-2].minor.yy232 = yylhsminor.yy232;
+ case 379: /* stream_options ::= stream_options TRIGGER AT_ONCE */
+ case 380: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ yytestcase(yyruleno==380);
+{ yylhsminor.yy490 = setStreamOptions(pCxt, yymsp[-2].minor.yy490, SOPT_TRIGGER_TYPE_SET, &yymsp[0].minor.yy0, NULL); }
+ yymsp[-2].minor.yy490 = yylhsminor.yy490;
break;
- case 376: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */
-#line 686 "sql.y"
-{ yylhsminor.yy232 = setStreamOptions(pCxt, yymsp[-3].minor.yy232, SOPT_TRIGGER_TYPE_SET, &yymsp[-1].minor.yy0, releaseRawExprNode(pCxt, yymsp[0].minor.yy232)); }
-#line 6826 "sql.c"
- yymsp[-3].minor.yy232 = yylhsminor.yy232;
+ case 381: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */
+{ yylhsminor.yy490 = setStreamOptions(pCxt, yymsp[-3].minor.yy490, SOPT_TRIGGER_TYPE_SET, &yymsp[-1].minor.yy0, releaseRawExprNode(pCxt, yymsp[0].minor.yy490)); }
+ yymsp[-3].minor.yy490 = yylhsminor.yy490;
break;
- case 377: /* stream_options ::= stream_options WATERMARK duration_literal */
-#line 687 "sql.y"
-{ yylhsminor.yy232 = setStreamOptions(pCxt, yymsp[-2].minor.yy232, SOPT_WATERMARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy232)); }
-#line 6832 "sql.c"
- yymsp[-2].minor.yy232 = yylhsminor.yy232;
+ case 382: /* stream_options ::= stream_options WATERMARK duration_literal */
+{ yylhsminor.yy490 = setStreamOptions(pCxt, yymsp[-2].minor.yy490, SOPT_WATERMARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy490)); }
+ yymsp[-2].minor.yy490 = yylhsminor.yy490;
break;
- case 378: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */
-#line 688 "sql.y"
-{ yylhsminor.yy232 = setStreamOptions(pCxt, yymsp[-3].minor.yy232, SOPT_IGNORE_EXPIRED_SET, &yymsp[0].minor.yy0, NULL); }
-#line 6838 "sql.c"
- yymsp[-3].minor.yy232 = yylhsminor.yy232;
+ case 383: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */
+{ yylhsminor.yy490 = setStreamOptions(pCxt, yymsp[-3].minor.yy490, SOPT_IGNORE_EXPIRED_SET, &yymsp[0].minor.yy0, NULL); }
+ yymsp[-3].minor.yy490 = yylhsminor.yy490;
break;
- case 379: /* stream_options ::= stream_options FILL_HISTORY NK_INTEGER */
-#line 689 "sql.y"
-{ yylhsminor.yy232 = setStreamOptions(pCxt, yymsp[-2].minor.yy232, SOPT_FILL_HISTORY_SET, &yymsp[0].minor.yy0, NULL); }
-#line 6844 "sql.c"
- yymsp[-2].minor.yy232 = yylhsminor.yy232;
+ case 384: /* stream_options ::= stream_options FILL_HISTORY NK_INTEGER */
+{ yylhsminor.yy490 = setStreamOptions(pCxt, yymsp[-2].minor.yy490, SOPT_FILL_HISTORY_SET, &yymsp[0].minor.yy0, NULL); }
+ yymsp[-2].minor.yy490 = yylhsminor.yy490;
break;
- case 380: /* stream_options ::= stream_options DELETE_MARK duration_literal */
-#line 690 "sql.y"
-{ yylhsminor.yy232 = setStreamOptions(pCxt, yymsp[-2].minor.yy232, SOPT_DELETE_MARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy232)); }
-#line 6850 "sql.c"
- yymsp[-2].minor.yy232 = yylhsminor.yy232;
+ case 385: /* stream_options ::= stream_options DELETE_MARK duration_literal */
+{ yylhsminor.yy490 = setStreamOptions(pCxt, yymsp[-2].minor.yy490, SOPT_DELETE_MARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy490)); }
+ yymsp[-2].minor.yy490 = yylhsminor.yy490;
break;
- case 381: /* stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */
-#line 691 "sql.y"
-{ yylhsminor.yy232 = setStreamOptions(pCxt, yymsp[-3].minor.yy232, SOPT_IGNORE_UPDATE_SET, &yymsp[0].minor.yy0, NULL); }
-#line 6856 "sql.c"
- yymsp[-3].minor.yy232 = yylhsminor.yy232;
+ case 386: /* stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */
+{ yylhsminor.yy490 = setStreamOptions(pCxt, yymsp[-3].minor.yy490, SOPT_IGNORE_UPDATE_SET, &yymsp[0].minor.yy0, NULL); }
+ yymsp[-3].minor.yy490 = yylhsminor.yy490;
break;
- case 383: /* subtable_opt ::= SUBTABLE NK_LP expression NK_RP */
- case 586: /* sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ yytestcase(yyruleno==586);
- case 610: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==610);
-#line 694 "sql.y"
-{ yymsp[-3].minor.yy232 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy232); }
-#line 6864 "sql.c"
+ case 388: /* subtable_opt ::= SUBTABLE NK_LP expression NK_RP */
+ case 591: /* sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ yytestcase(yyruleno==591);
+ case 615: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==615);
+{ yymsp[-3].minor.yy490 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy490); }
break;
- case 386: /* cmd ::= KILL CONNECTION NK_INTEGER */
-#line 702 "sql.y"
+ case 391: /* cmd ::= KILL CONNECTION NK_INTEGER */
{ pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_CONNECTION_STMT, &yymsp[0].minor.yy0); }
-#line 6869 "sql.c"
break;
- case 387: /* cmd ::= KILL QUERY NK_STRING */
-#line 703 "sql.y"
+ case 392: /* cmd ::= KILL QUERY NK_STRING */
{ pCxt->pRootNode = createKillQueryStmt(pCxt, &yymsp[0].minor.yy0); }
-#line 6874 "sql.c"
break;
- case 388: /* cmd ::= KILL TRANSACTION NK_INTEGER */
-#line 704 "sql.y"
+ case 393: /* cmd ::= KILL TRANSACTION NK_INTEGER */
{ pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_TRANSACTION_STMT, &yymsp[0].minor.yy0); }
-#line 6879 "sql.c"
break;
- case 389: /* cmd ::= KILL COMPACT NK_INTEGER */
-#line 705 "sql.y"
+ case 394: /* cmd ::= KILL COMPACT NK_INTEGER */
{ pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_COMPACT_STMT, &yymsp[0].minor.yy0); }
-#line 6884 "sql.c"
break;
- case 390: /* cmd ::= BALANCE VGROUP */
-#line 708 "sql.y"
+ case 395: /* cmd ::= BALANCE VGROUP */
{ pCxt->pRootNode = createBalanceVgroupStmt(pCxt); }
-#line 6889 "sql.c"
break;
- case 391: /* cmd ::= BALANCE VGROUP LEADER on_vgroup_id */
-#line 709 "sql.y"
-{ pCxt->pRootNode = createBalanceVgroupLeaderStmt(pCxt, &yymsp[0].minor.yy993); }
-#line 6894 "sql.c"
+ case 396: /* cmd ::= BALANCE VGROUP LEADER on_vgroup_id */
+{ pCxt->pRootNode = createBalanceVgroupLeaderStmt(pCxt, &yymsp[0].minor.yy561); }
break;
- case 392: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */
-#line 710 "sql.y"
+ case 397: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */
{ pCxt->pRootNode = createMergeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); }
-#line 6899 "sql.c"
break;
- case 393: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */
-#line 711 "sql.y"
-{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy88); }
-#line 6904 "sql.c"
+ case 398: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */
+{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy502); }
break;
- case 394: /* cmd ::= SPLIT VGROUP NK_INTEGER */
-#line 712 "sql.y"
+ case 399: /* cmd ::= SPLIT VGROUP NK_INTEGER */
{ pCxt->pRootNode = createSplitVgroupStmt(pCxt, &yymsp[0].minor.yy0); }
-#line 6909 "sql.c"
break;
- case 397: /* dnode_list ::= DNODE NK_INTEGER */
-#line 721 "sql.y"
-{ yymsp[-1].minor.yy88 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
-#line 6914 "sql.c"
+ case 402: /* dnode_list ::= DNODE NK_INTEGER */
+{ yymsp[-1].minor.yy502 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
break;
- case 399: /* cmd ::= DELETE FROM full_table_name where_clause_opt */
-#line 728 "sql.y"
-{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy232, yymsp[0].minor.yy232); }
-#line 6919 "sql.c"
+ case 404: /* cmd ::= DELETE FROM full_table_name where_clause_opt */
+{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy490, yymsp[0].minor.yy490); }
break;
- case 402: /* insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */
-#line 737 "sql.y"
-{ yymsp[-6].minor.yy232 = createInsertStmt(pCxt, yymsp[-4].minor.yy232, yymsp[-2].minor.yy88, yymsp[0].minor.yy232); }
-#line 6924 "sql.c"
+ case 407: /* insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */
+{ yymsp[-6].minor.yy490 = createInsertStmt(pCxt, yymsp[-4].minor.yy490, yymsp[-2].minor.yy502, yymsp[0].minor.yy490); }
break;
- case 403: /* insert_query ::= INSERT INTO full_table_name query_or_subquery */
-#line 738 "sql.y"
-{ yymsp[-3].minor.yy232 = createInsertStmt(pCxt, yymsp[-1].minor.yy232, NULL, yymsp[0].minor.yy232); }
-#line 6929 "sql.c"
+ case 408: /* insert_query ::= INSERT INTO full_table_name query_or_subquery */
+{ yymsp[-3].minor.yy490 = createInsertStmt(pCxt, yymsp[-1].minor.yy490, NULL, yymsp[0].minor.yy490); }
break;
- case 404: /* literal ::= NK_INTEGER */
-#line 741 "sql.y"
-{ yylhsminor.yy232 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); }
-#line 6934 "sql.c"
- yymsp[0].minor.yy232 = yylhsminor.yy232;
+ case 409: /* literal ::= NK_INTEGER */
+{ yylhsminor.yy490 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy490 = yylhsminor.yy490;
break;
- case 405: /* literal ::= NK_FLOAT */
-#line 742 "sql.y"
-{ yylhsminor.yy232 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); }
-#line 6940 "sql.c"
- yymsp[0].minor.yy232 = yylhsminor.yy232;
+ case 410: /* literal ::= NK_FLOAT */
+{ yylhsminor.yy490 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy490 = yylhsminor.yy490;
break;
- case 406: /* literal ::= NK_STRING */
-#line 743 "sql.y"
-{ yylhsminor.yy232 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); }
-#line 6946 "sql.c"
- yymsp[0].minor.yy232 = yylhsminor.yy232;
+ case 411: /* literal ::= NK_STRING */
+{ yylhsminor.yy490 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy490 = yylhsminor.yy490;
break;
- case 407: /* literal ::= NK_BOOL */
-#line 744 "sql.y"
-{ yylhsminor.yy232 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); }
-#line 6952 "sql.c"
- yymsp[0].minor.yy232 = yylhsminor.yy232;
+ case 412: /* literal ::= NK_BOOL */
+{ yylhsminor.yy490 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy490 = yylhsminor.yy490;
break;
- case 408: /* literal ::= TIMESTAMP NK_STRING */
-#line 745 "sql.y"
-{ yylhsminor.yy232 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); }
-#line 6958 "sql.c"
- yymsp[-1].minor.yy232 = yylhsminor.yy232;
+ case 413: /* literal ::= TIMESTAMP NK_STRING */
+{ yylhsminor.yy490 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); }
+ yymsp[-1].minor.yy490 = yylhsminor.yy490;
break;
- case 409: /* literal ::= duration_literal */
- case 419: /* signed_literal ::= signed */ yytestcase(yyruleno==419);
- case 442: /* expr_or_subquery ::= expression */ yytestcase(yyruleno==442);
- case 443: /* expression ::= literal */ yytestcase(yyruleno==443);
- case 445: /* expression ::= column_reference */ yytestcase(yyruleno==445);
- case 446: /* expression ::= function_expression */ yytestcase(yyruleno==446);
- case 447: /* expression ::= case_when_expression */ yytestcase(yyruleno==447);
- case 480: /* function_expression ::= literal_func */ yytestcase(yyruleno==480);
- case 529: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==529);
- case 533: /* boolean_primary ::= predicate */ yytestcase(yyruleno==533);
- case 535: /* common_expression ::= expr_or_subquery */ yytestcase(yyruleno==535);
- case 536: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==536);
- case 539: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==539);
- case 541: /* table_reference ::= table_primary */ yytestcase(yyruleno==541);
- case 542: /* table_reference ::= joined_table */ yytestcase(yyruleno==542);
- case 546: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==546);
- case 612: /* query_simple ::= query_specification */ yytestcase(yyruleno==612);
- case 613: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==613);
- case 616: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==616);
- case 618: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==618);
-#line 746 "sql.y"
-{ yylhsminor.yy232 = yymsp[0].minor.yy232; }
-#line 6983 "sql.c"
- yymsp[0].minor.yy232 = yylhsminor.yy232;
+ case 414: /* literal ::= duration_literal */
+ case 424: /* signed_literal ::= signed */ yytestcase(yyruleno==424);
+ case 447: /* expr_or_subquery ::= expression */ yytestcase(yyruleno==447);
+ case 448: /* expression ::= literal */ yytestcase(yyruleno==448);
+ case 450: /* expression ::= column_reference */ yytestcase(yyruleno==450);
+ case 451: /* expression ::= function_expression */ yytestcase(yyruleno==451);
+ case 452: /* expression ::= case_when_expression */ yytestcase(yyruleno==452);
+ case 485: /* function_expression ::= literal_func */ yytestcase(yyruleno==485);
+ case 534: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==534);
+ case 538: /* boolean_primary ::= predicate */ yytestcase(yyruleno==538);
+ case 540: /* common_expression ::= expr_or_subquery */ yytestcase(yyruleno==540);
+ case 541: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==541);
+ case 544: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==544);
+ case 546: /* table_reference ::= table_primary */ yytestcase(yyruleno==546);
+ case 547: /* table_reference ::= joined_table */ yytestcase(yyruleno==547);
+ case 551: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==551);
+ case 617: /* query_simple ::= query_specification */ yytestcase(yyruleno==617);
+ case 618: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==618);
+ case 621: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==621);
+ case 623: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==623);
+{ yylhsminor.yy490 = yymsp[0].minor.yy490; }
+ yymsp[0].minor.yy490 = yylhsminor.yy490;
break;
- case 410: /* literal ::= NULL */
-#line 747 "sql.y"
-{ yylhsminor.yy232 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); }
-#line 6989 "sql.c"
- yymsp[0].minor.yy232 = yylhsminor.yy232;
+ case 415: /* literal ::= NULL */
+{ yylhsminor.yy490 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy490 = yylhsminor.yy490;
break;
- case 411: /* literal ::= NK_QUESTION */
-#line 748 "sql.y"
-{ yylhsminor.yy232 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); }
-#line 6995 "sql.c"
- yymsp[0].minor.yy232 = yylhsminor.yy232;
+ case 416: /* literal ::= NK_QUESTION */
+{ yylhsminor.yy490 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy490 = yylhsminor.yy490;
break;
- case 412: /* duration_literal ::= NK_VARIABLE */
- case 587: /* interval_sliding_duration_literal ::= NK_VARIABLE */ yytestcase(yyruleno==587);
- case 588: /* interval_sliding_duration_literal ::= NK_STRING */ yytestcase(yyruleno==588);
- case 589: /* interval_sliding_duration_literal ::= NK_INTEGER */ yytestcase(yyruleno==589);
-#line 750 "sql.y"
-{ yylhsminor.yy232 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
-#line 7004 "sql.c"
- yymsp[0].minor.yy232 = yylhsminor.yy232;
+ case 417: /* duration_literal ::= NK_VARIABLE */
+ case 592: /* interval_sliding_duration_literal ::= NK_VARIABLE */ yytestcase(yyruleno==592);
+ case 593: /* interval_sliding_duration_literal ::= NK_STRING */ yytestcase(yyruleno==593);
+ case 594: /* interval_sliding_duration_literal ::= NK_INTEGER */ yytestcase(yyruleno==594);
+{ yylhsminor.yy490 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy490 = yylhsminor.yy490;
break;
- case 413: /* signed ::= NK_INTEGER */
-#line 752 "sql.y"
-{ yylhsminor.yy232 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); }
-#line 7010 "sql.c"
- yymsp[0].minor.yy232 = yylhsminor.yy232;
+ case 418: /* signed ::= NK_INTEGER */
+{ yylhsminor.yy490 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy490 = yylhsminor.yy490;
break;
- case 414: /* signed ::= NK_PLUS NK_INTEGER */
-#line 753 "sql.y"
-{ yymsp[-1].minor.yy232 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); }
-#line 7016 "sql.c"
+ case 419: /* signed ::= NK_PLUS NK_INTEGER */
+{ yymsp[-1].minor.yy490 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); }
break;
- case 415: /* signed ::= NK_MINUS NK_INTEGER */
-#line 754 "sql.y"
+ case 420: /* signed ::= NK_MINUS NK_INTEGER */
{
SToken t = yymsp[-1].minor.yy0;
t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z;
- yylhsminor.yy232 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t);
+ yylhsminor.yy490 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t);
}
-#line 7025 "sql.c"
- yymsp[-1].minor.yy232 = yylhsminor.yy232;
+ yymsp[-1].minor.yy490 = yylhsminor.yy490;
break;
- case 416: /* signed ::= NK_FLOAT */
-#line 759 "sql.y"
-{ yylhsminor.yy232 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); }
-#line 7031 "sql.c"
- yymsp[0].minor.yy232 = yylhsminor.yy232;
+ case 421: /* signed ::= NK_FLOAT */
+{ yylhsminor.yy490 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy490 = yylhsminor.yy490;
break;
- case 417: /* signed ::= NK_PLUS NK_FLOAT */
-#line 760 "sql.y"
-{ yymsp[-1].minor.yy232 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); }
-#line 7037 "sql.c"
+ case 422: /* signed ::= NK_PLUS NK_FLOAT */
+{ yymsp[-1].minor.yy490 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); }
break;
- case 418: /* signed ::= NK_MINUS NK_FLOAT */
-#line 761 "sql.y"
+ case 423: /* signed ::= NK_MINUS NK_FLOAT */
{
SToken t = yymsp[-1].minor.yy0;
t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z;
- yylhsminor.yy232 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t);
+ yylhsminor.yy490 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t);
}
-#line 7046 "sql.c"
- yymsp[-1].minor.yy232 = yylhsminor.yy232;
+ yymsp[-1].minor.yy490 = yylhsminor.yy490;
break;
- case 420: /* signed_literal ::= NK_STRING */
-#line 768 "sql.y"
-{ yylhsminor.yy232 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); }
-#line 7052 "sql.c"
- yymsp[0].minor.yy232 = yylhsminor.yy232;
+ case 425: /* signed_literal ::= NK_STRING */
+{ yylhsminor.yy490 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy490 = yylhsminor.yy490;
break;
- case 421: /* signed_literal ::= NK_BOOL */
-#line 769 "sql.y"
-{ yylhsminor.yy232 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); }
-#line 7058 "sql.c"
- yymsp[0].minor.yy232 = yylhsminor.yy232;
+ case 426: /* signed_literal ::= NK_BOOL */
+{ yylhsminor.yy490 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy490 = yylhsminor.yy490;
break;
- case 422: /* signed_literal ::= TIMESTAMP NK_STRING */
-#line 770 "sql.y"
-{ yymsp[-1].minor.yy232 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); }
-#line 7064 "sql.c"
+ case 427: /* signed_literal ::= TIMESTAMP NK_STRING */
+{ yymsp[-1].minor.yy490 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); }
break;
- case 423: /* signed_literal ::= duration_literal */
- case 425: /* signed_literal ::= literal_func */ yytestcase(yyruleno==425);
- case 500: /* star_func_para ::= expr_or_subquery */ yytestcase(yyruleno==500);
- case 566: /* select_item ::= common_expression */ yytestcase(yyruleno==566);
- case 576: /* partition_item ::= expr_or_subquery */ yytestcase(yyruleno==576);
- case 617: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==617);
- case 619: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==619);
- case 632: /* search_condition ::= common_expression */ yytestcase(yyruleno==632);
-#line 771 "sql.y"
-{ yylhsminor.yy232 = releaseRawExprNode(pCxt, yymsp[0].minor.yy232); }
-#line 7076 "sql.c"
- yymsp[0].minor.yy232 = yylhsminor.yy232;
+ case 428: /* signed_literal ::= duration_literal */
+ case 430: /* signed_literal ::= literal_func */ yytestcase(yyruleno==430);
+ case 505: /* star_func_para ::= expr_or_subquery */ yytestcase(yyruleno==505);
+ case 571: /* select_item ::= common_expression */ yytestcase(yyruleno==571);
+ case 581: /* partition_item ::= expr_or_subquery */ yytestcase(yyruleno==581);
+ case 622: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==622);
+ case 624: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==624);
+ case 637: /* search_condition ::= common_expression */ yytestcase(yyruleno==637);
+{ yylhsminor.yy490 = releaseRawExprNode(pCxt, yymsp[0].minor.yy490); }
+ yymsp[0].minor.yy490 = yylhsminor.yy490;
break;
- case 424: /* signed_literal ::= NULL */
-#line 772 "sql.y"
-{ yylhsminor.yy232 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); }
-#line 7082 "sql.c"
- yymsp[0].minor.yy232 = yylhsminor.yy232;
+ case 429: /* signed_literal ::= NULL */
+{ yylhsminor.yy490 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy490 = yylhsminor.yy490;
break;
- case 426: /* signed_literal ::= NK_QUESTION */
-#line 774 "sql.y"
-{ yylhsminor.yy232 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); }
-#line 7088 "sql.c"
- yymsp[0].minor.yy232 = yylhsminor.yy232;
+ case 431: /* signed_literal ::= NK_QUESTION */
+{ yylhsminor.yy490 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy490 = yylhsminor.yy490;
break;
- case 444: /* expression ::= pseudo_column */
-#line 836 "sql.y"
-{ yylhsminor.yy232 = yymsp[0].minor.yy232; setRawExprNodeIsPseudoColumn(pCxt, yylhsminor.yy232, true); }
-#line 7094 "sql.c"
- yymsp[0].minor.yy232 = yylhsminor.yy232;
+ case 449: /* expression ::= pseudo_column */
+{ yylhsminor.yy490 = yymsp[0].minor.yy490; setRawExprNodeIsPseudoColumn(pCxt, yylhsminor.yy490, true); }
+ yymsp[0].minor.yy490 = yylhsminor.yy490;
break;
- case 448: /* expression ::= NK_LP expression NK_RP */
- case 534: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==534);
- case 631: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==631);
-#line 840 "sql.y"
-{ yylhsminor.yy232 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy232)); }
-#line 7102 "sql.c"
- yymsp[-2].minor.yy232 = yylhsminor.yy232;
+ case 453: /* expression ::= NK_LP expression NK_RP */
+ case 539: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==539);
+ case 636: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==636);
+{ yylhsminor.yy490 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy490)); }
+ yymsp[-2].minor.yy490 = yylhsminor.yy490;
break;
- case 449: /* expression ::= NK_PLUS expr_or_subquery */
-#line 841 "sql.y"
+ case 454: /* expression ::= NK_PLUS expr_or_subquery */
{
- SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy232);
- yylhsminor.yy232 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy232));
+ SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy490);
+ yylhsminor.yy490 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy490));
}
-#line 7111 "sql.c"
- yymsp[-1].minor.yy232 = yylhsminor.yy232;
+ yymsp[-1].minor.yy490 = yylhsminor.yy490;
break;
- case 450: /* expression ::= NK_MINUS expr_or_subquery */
-#line 845 "sql.y"
+ case 455: /* expression ::= NK_MINUS expr_or_subquery */
{
- SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy232);
- yylhsminor.yy232 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy232), NULL));
+ SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy490);
+ yylhsminor.yy490 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy490), NULL));
}
-#line 7120 "sql.c"
- yymsp[-1].minor.yy232 = yylhsminor.yy232;
+ yymsp[-1].minor.yy490 = yylhsminor.yy490;
break;
- case 451: /* expression ::= expr_or_subquery NK_PLUS expr_or_subquery */
-#line 849 "sql.y"
+ case 456: /* expression ::= expr_or_subquery NK_PLUS expr_or_subquery */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy232);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy232);
- yylhsminor.yy232 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy232), releaseRawExprNode(pCxt, yymsp[0].minor.yy232)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy490);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy490);
+ yylhsminor.yy490 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy490), releaseRawExprNode(pCxt, yymsp[0].minor.yy490)));
}
-#line 7130 "sql.c"
- yymsp[-2].minor.yy232 = yylhsminor.yy232;
+ yymsp[-2].minor.yy490 = yylhsminor.yy490;
break;
- case 452: /* expression ::= expr_or_subquery NK_MINUS expr_or_subquery */
-#line 854 "sql.y"
+ case 457: /* expression ::= expr_or_subquery NK_MINUS expr_or_subquery */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy232);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy232);
- yylhsminor.yy232 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy232), releaseRawExprNode(pCxt, yymsp[0].minor.yy232)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy490);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy490);
+ yylhsminor.yy490 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy490), releaseRawExprNode(pCxt, yymsp[0].minor.yy490)));
}
-#line 7140 "sql.c"
- yymsp[-2].minor.yy232 = yylhsminor.yy232;
+ yymsp[-2].minor.yy490 = yylhsminor.yy490;
break;
- case 453: /* expression ::= expr_or_subquery NK_STAR expr_or_subquery */
-#line 859 "sql.y"
+ case 458: /* expression ::= expr_or_subquery NK_STAR expr_or_subquery */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy232);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy232);
- yylhsminor.yy232 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy232), releaseRawExprNode(pCxt, yymsp[0].minor.yy232)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy490);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy490);
+ yylhsminor.yy490 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy490), releaseRawExprNode(pCxt, yymsp[0].minor.yy490)));
}
-#line 7150 "sql.c"
- yymsp[-2].minor.yy232 = yylhsminor.yy232;
+ yymsp[-2].minor.yy490 = yylhsminor.yy490;
break;
- case 454: /* expression ::= expr_or_subquery NK_SLASH expr_or_subquery */
-#line 864 "sql.y"
+ case 459: /* expression ::= expr_or_subquery NK_SLASH expr_or_subquery */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy232);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy232);
- yylhsminor.yy232 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy232), releaseRawExprNode(pCxt, yymsp[0].minor.yy232)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy490);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy490);
+ yylhsminor.yy490 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy490), releaseRawExprNode(pCxt, yymsp[0].minor.yy490)));
}
-#line 7160 "sql.c"
- yymsp[-2].minor.yy232 = yylhsminor.yy232;
+ yymsp[-2].minor.yy490 = yylhsminor.yy490;
break;
- case 455: /* expression ::= expr_or_subquery NK_REM expr_or_subquery */
-#line 869 "sql.y"
+ case 460: /* expression ::= expr_or_subquery NK_REM expr_or_subquery */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy232);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy232);
- yylhsminor.yy232 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy232), releaseRawExprNode(pCxt, yymsp[0].minor.yy232)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy490);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy490);
+ yylhsminor.yy490 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy490), releaseRawExprNode(pCxt, yymsp[0].minor.yy490)));
}
-#line 7170 "sql.c"
- yymsp[-2].minor.yy232 = yylhsminor.yy232;
+ yymsp[-2].minor.yy490 = yylhsminor.yy490;
break;
- case 456: /* expression ::= column_reference NK_ARROW NK_STRING */
-#line 874 "sql.y"
+ case 461: /* expression ::= column_reference NK_ARROW NK_STRING */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy232);
- yylhsminor.yy232 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy232), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy490);
+ yylhsminor.yy490 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy490), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)));
}
-#line 7179 "sql.c"
- yymsp[-2].minor.yy232 = yylhsminor.yy232;
+ yymsp[-2].minor.yy490 = yylhsminor.yy490;
break;
- case 457: /* expression ::= expr_or_subquery NK_BITAND expr_or_subquery */
-#line 878 "sql.y"
+ case 462: /* expression ::= expr_or_subquery NK_BITAND expr_or_subquery */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy232);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy232);
- yylhsminor.yy232 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy232), releaseRawExprNode(pCxt, yymsp[0].minor.yy232)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy490);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy490);
+ yylhsminor.yy490 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy490), releaseRawExprNode(pCxt, yymsp[0].minor.yy490)));
}
-#line 7189 "sql.c"
- yymsp[-2].minor.yy232 = yylhsminor.yy232;
+ yymsp[-2].minor.yy490 = yylhsminor.yy490;
break;
- case 458: /* expression ::= expr_or_subquery NK_BITOR expr_or_subquery */
-#line 883 "sql.y"
+ case 463: /* expression ::= expr_or_subquery NK_BITOR expr_or_subquery */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy232);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy232);
- yylhsminor.yy232 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy232), releaseRawExprNode(pCxt, yymsp[0].minor.yy232)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy490);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy490);
+ yylhsminor.yy490 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy490), releaseRawExprNode(pCxt, yymsp[0].minor.yy490)));
}
-#line 7199 "sql.c"
- yymsp[-2].minor.yy232 = yylhsminor.yy232;
+ yymsp[-2].minor.yy490 = yylhsminor.yy490;
break;
- case 461: /* column_reference ::= column_name */
-#line 894 "sql.y"
-{ yylhsminor.yy232 = createRawExprNode(pCxt, &yymsp[0].minor.yy993, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy993)); }
-#line 7205 "sql.c"
- yymsp[0].minor.yy232 = yylhsminor.yy232;
+ case 466: /* column_reference ::= column_name */
+{ yylhsminor.yy490 = createRawExprNode(pCxt, &yymsp[0].minor.yy561, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy561)); }
+ yymsp[0].minor.yy490 = yylhsminor.yy490;
break;
- case 462: /* column_reference ::= table_name NK_DOT column_name */
-#line 895 "sql.y"
-{ yylhsminor.yy232 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy993, &yymsp[0].minor.yy993, createColumnNode(pCxt, &yymsp[-2].minor.yy993, &yymsp[0].minor.yy993)); }
-#line 7211 "sql.c"
- yymsp[-2].minor.yy232 = yylhsminor.yy232;
+ case 467: /* column_reference ::= table_name NK_DOT column_name */
+{ yylhsminor.yy490 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy561, &yymsp[0].minor.yy561, createColumnNode(pCxt, &yymsp[-2].minor.yy561, &yymsp[0].minor.yy561)); }
+ yymsp[-2].minor.yy490 = yylhsminor.yy490;
break;
- case 463: /* column_reference ::= NK_ALIAS */
-#line 896 "sql.y"
-{ yylhsminor.yy232 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); }
-#line 7217 "sql.c"
- yymsp[0].minor.yy232 = yylhsminor.yy232;
+ case 468: /* column_reference ::= NK_ALIAS */
+{ yylhsminor.yy490 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy490 = yylhsminor.yy490;
break;
- case 464: /* column_reference ::= table_name NK_DOT NK_ALIAS */
-#line 897 "sql.y"
-{ yylhsminor.yy232 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy993, &yymsp[0].minor.yy0, createColumnNode(pCxt, &yymsp[-2].minor.yy993, &yymsp[0].minor.yy0)); }
-#line 7223 "sql.c"
- yymsp[-2].minor.yy232 = yylhsminor.yy232;
+ case 469: /* column_reference ::= table_name NK_DOT NK_ALIAS */
+{ yylhsminor.yy490 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy561, &yymsp[0].minor.yy0, createColumnNode(pCxt, &yymsp[-2].minor.yy561, &yymsp[0].minor.yy0)); }
+ yymsp[-2].minor.yy490 = yylhsminor.yy490;
break;
- case 465: /* pseudo_column ::= ROWTS */
- case 466: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==466);
- case 468: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==468);
- case 469: /* pseudo_column ::= QEND */ yytestcase(yyruleno==469);
- case 470: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==470);
- case 471: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==471);
- case 472: /* pseudo_column ::= WEND */ yytestcase(yyruleno==472);
- case 473: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==473);
- case 474: /* pseudo_column ::= IROWTS */ yytestcase(yyruleno==474);
- case 475: /* pseudo_column ::= ISFILLED */ yytestcase(yyruleno==475);
- case 476: /* pseudo_column ::= QTAGS */ yytestcase(yyruleno==476);
- case 482: /* literal_func ::= NOW */ yytestcase(yyruleno==482);
-#line 899 "sql.y"
-{ yylhsminor.yy232 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); }
-#line 7240 "sql.c"
- yymsp[0].minor.yy232 = yylhsminor.yy232;
+ case 470: /* pseudo_column ::= ROWTS */
+ case 471: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==471);
+ case 473: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==473);
+ case 474: /* pseudo_column ::= QEND */ yytestcase(yyruleno==474);
+ case 475: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==475);
+ case 476: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==476);
+ case 477: /* pseudo_column ::= WEND */ yytestcase(yyruleno==477);
+ case 478: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==478);
+ case 479: /* pseudo_column ::= IROWTS */ yytestcase(yyruleno==479);
+ case 480: /* pseudo_column ::= ISFILLED */ yytestcase(yyruleno==480);
+ case 481: /* pseudo_column ::= QTAGS */ yytestcase(yyruleno==481);
+ case 487: /* literal_func ::= NOW */ yytestcase(yyruleno==487);
+{ yylhsminor.yy490 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); }
+ yymsp[0].minor.yy490 = yylhsminor.yy490;
break;
- case 467: /* pseudo_column ::= table_name NK_DOT TBNAME */
-#line 901 "sql.y"
-{ yylhsminor.yy232 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy993, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy993)))); }
-#line 7246 "sql.c"
- yymsp[-2].minor.yy232 = yylhsminor.yy232;
+ case 472: /* pseudo_column ::= table_name NK_DOT TBNAME */
+{ yylhsminor.yy490 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy561, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy561)))); }
+ yymsp[-2].minor.yy490 = yylhsminor.yy490;
break;
- case 477: /* function_expression ::= function_name NK_LP expression_list NK_RP */
- case 478: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==478);
-#line 912 "sql.y"
-{ yylhsminor.yy232 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy993, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy993, yymsp[-1].minor.yy88)); }
-#line 7253 "sql.c"
- yymsp[-3].minor.yy232 = yylhsminor.yy232;
+ case 482: /* function_expression ::= function_name NK_LP expression_list NK_RP */
+ case 483: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==483);
+{ yylhsminor.yy490 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy561, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy561, yymsp[-1].minor.yy502)); }
+ yymsp[-3].minor.yy490 = yylhsminor.yy490;
break;
- case 479: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */
-#line 915 "sql.y"
-{ yylhsminor.yy232 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy232), yymsp[-1].minor.yy400)); }
-#line 7259 "sql.c"
- yymsp[-5].minor.yy232 = yylhsminor.yy232;
+ case 484: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */
+{ yylhsminor.yy490 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy490), yymsp[-1].minor.yy826)); }
+ yymsp[-5].minor.yy490 = yylhsminor.yy490;
break;
- case 481: /* literal_func ::= noarg_func NK_LP NK_RP */
-#line 918 "sql.y"
-{ yylhsminor.yy232 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy993, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy993, NULL)); }
-#line 7265 "sql.c"
- yymsp[-2].minor.yy232 = yylhsminor.yy232;
+ case 486: /* literal_func ::= noarg_func NK_LP NK_RP */
+{ yylhsminor.yy490 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy561, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy561, NULL)); }
+ yymsp[-2].minor.yy490 = yylhsminor.yy490;
break;
- case 496: /* star_func_para_list ::= NK_STAR */
-#line 942 "sql.y"
-{ yylhsminor.yy88 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); }
-#line 7271 "sql.c"
- yymsp[0].minor.yy88 = yylhsminor.yy88;
+ case 501: /* star_func_para_list ::= NK_STAR */
+{ yylhsminor.yy502 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy502 = yylhsminor.yy502;
break;
- case 501: /* star_func_para ::= table_name NK_DOT NK_STAR */
- case 569: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==569);
-#line 951 "sql.y"
-{ yylhsminor.yy232 = createColumnNode(pCxt, &yymsp[-2].minor.yy993, &yymsp[0].minor.yy0); }
-#line 7278 "sql.c"
- yymsp[-2].minor.yy232 = yylhsminor.yy232;
+ case 506: /* star_func_para ::= table_name NK_DOT NK_STAR */
+ case 574: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==574);
+{ yylhsminor.yy490 = createColumnNode(pCxt, &yymsp[-2].minor.yy561, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy490 = yylhsminor.yy490;
break;
- case 502: /* case_when_expression ::= CASE when_then_list case_when_else_opt END */
-#line 954 "sql.y"
-{ yylhsminor.yy232 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, NULL, yymsp[-2].minor.yy88, yymsp[-1].minor.yy232)); }
-#line 7284 "sql.c"
- yymsp[-3].minor.yy232 = yylhsminor.yy232;
+ case 507: /* case_when_expression ::= CASE when_then_list case_when_else_opt END */
+{ yylhsminor.yy490 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, NULL, yymsp[-2].minor.yy502, yymsp[-1].minor.yy490)); }
+ yymsp[-3].minor.yy490 = yylhsminor.yy490;
break;
- case 503: /* case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */
-#line 956 "sql.y"
-{ yylhsminor.yy232 = createRawExprNodeExt(pCxt, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy232), yymsp[-2].minor.yy88, yymsp[-1].minor.yy232)); }
-#line 7290 "sql.c"
- yymsp[-4].minor.yy232 = yylhsminor.yy232;
+ case 508: /* case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */
+{ yylhsminor.yy490 = createRawExprNodeExt(pCxt, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy490), yymsp[-2].minor.yy502, yymsp[-1].minor.yy490)); }
+ yymsp[-4].minor.yy490 = yylhsminor.yy490;
break;
- case 506: /* when_then_expr ::= WHEN common_expression THEN common_expression */
-#line 963 "sql.y"
-{ yymsp[-3].minor.yy232 = createWhenThenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy232), releaseRawExprNode(pCxt, yymsp[0].minor.yy232)); }
-#line 7296 "sql.c"
+ case 511: /* when_then_expr ::= WHEN common_expression THEN common_expression */
+{ yymsp[-3].minor.yy490 = createWhenThenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy490), releaseRawExprNode(pCxt, yymsp[0].minor.yy490)); }
break;
- case 508: /* case_when_else_opt ::= ELSE common_expression */
-#line 966 "sql.y"
-{ yymsp[-1].minor.yy232 = releaseRawExprNode(pCxt, yymsp[0].minor.yy232); }
-#line 7301 "sql.c"
+ case 513: /* case_when_else_opt ::= ELSE common_expression */
+{ yymsp[-1].minor.yy490 = releaseRawExprNode(pCxt, yymsp[0].minor.yy490); }
break;
- case 509: /* predicate ::= expr_or_subquery compare_op expr_or_subquery */
- case 514: /* predicate ::= expr_or_subquery in_op in_predicate_value */ yytestcase(yyruleno==514);
-#line 969 "sql.y"
+ case 514: /* predicate ::= expr_or_subquery compare_op expr_or_subquery */
+ case 519: /* predicate ::= expr_or_subquery in_op in_predicate_value */ yytestcase(yyruleno==519);
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy232);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy232);
- yylhsminor.yy232 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy708, releaseRawExprNode(pCxt, yymsp[-2].minor.yy232), releaseRawExprNode(pCxt, yymsp[0].minor.yy232)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy490);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy490);
+ yylhsminor.yy490 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy30, releaseRawExprNode(pCxt, yymsp[-2].minor.yy490), releaseRawExprNode(pCxt, yymsp[0].minor.yy490)));
}
-#line 7311 "sql.c"
- yymsp[-2].minor.yy232 = yylhsminor.yy232;
+ yymsp[-2].minor.yy490 = yylhsminor.yy490;
break;
- case 510: /* predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */
-#line 976 "sql.y"
+ case 515: /* predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy232);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy232);
- yylhsminor.yy232 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy232), releaseRawExprNode(pCxt, yymsp[-2].minor.yy232), releaseRawExprNode(pCxt, yymsp[0].minor.yy232)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy490);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy490);
+ yylhsminor.yy490 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy490), releaseRawExprNode(pCxt, yymsp[-2].minor.yy490), releaseRawExprNode(pCxt, yymsp[0].minor.yy490)));
}
-#line 7321 "sql.c"
- yymsp[-4].minor.yy232 = yylhsminor.yy232;
+ yymsp[-4].minor.yy490 = yylhsminor.yy490;
break;
- case 511: /* predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */
-#line 982 "sql.y"
+ case 516: /* predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy232);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy232);
- yylhsminor.yy232 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy232), releaseRawExprNode(pCxt, yymsp[-2].minor.yy232), releaseRawExprNode(pCxt, yymsp[0].minor.yy232)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy490);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy490);
+ yylhsminor.yy490 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy490), releaseRawExprNode(pCxt, yymsp[-2].minor.yy490), releaseRawExprNode(pCxt, yymsp[0].minor.yy490)));
}
-#line 7331 "sql.c"
- yymsp[-5].minor.yy232 = yylhsminor.yy232;
+ yymsp[-5].minor.yy490 = yylhsminor.yy490;
break;
- case 512: /* predicate ::= expr_or_subquery IS NULL */
-#line 987 "sql.y"
+ case 517: /* predicate ::= expr_or_subquery IS NULL */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy232);
- yylhsminor.yy232 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy232), NULL));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy490);
+ yylhsminor.yy490 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy490), NULL));
}
-#line 7340 "sql.c"
- yymsp[-2].minor.yy232 = yylhsminor.yy232;
+ yymsp[-2].minor.yy490 = yylhsminor.yy490;
break;
- case 513: /* predicate ::= expr_or_subquery IS NOT NULL */
-#line 991 "sql.y"
+ case 518: /* predicate ::= expr_or_subquery IS NOT NULL */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy232);
- yylhsminor.yy232 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy232), NULL));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy490);
+ yylhsminor.yy490 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy490), NULL));
}
-#line 7349 "sql.c"
- yymsp[-3].minor.yy232 = yylhsminor.yy232;
+ yymsp[-3].minor.yy490 = yylhsminor.yy490;
break;
- case 515: /* compare_op ::= NK_LT */
-#line 1003 "sql.y"
-{ yymsp[0].minor.yy708 = OP_TYPE_LOWER_THAN; }
-#line 7355 "sql.c"
+ case 520: /* compare_op ::= NK_LT */
+{ yymsp[0].minor.yy30 = OP_TYPE_LOWER_THAN; }
break;
- case 516: /* compare_op ::= NK_GT */
-#line 1004 "sql.y"
-{ yymsp[0].minor.yy708 = OP_TYPE_GREATER_THAN; }
-#line 7360 "sql.c"
+ case 521: /* compare_op ::= NK_GT */
+{ yymsp[0].minor.yy30 = OP_TYPE_GREATER_THAN; }
break;
- case 517: /* compare_op ::= NK_LE */
-#line 1005 "sql.y"
-{ yymsp[0].minor.yy708 = OP_TYPE_LOWER_EQUAL; }
-#line 7365 "sql.c"
+ case 522: /* compare_op ::= NK_LE */
+{ yymsp[0].minor.yy30 = OP_TYPE_LOWER_EQUAL; }
break;
- case 518: /* compare_op ::= NK_GE */
-#line 1006 "sql.y"
-{ yymsp[0].minor.yy708 = OP_TYPE_GREATER_EQUAL; }
-#line 7370 "sql.c"
+ case 523: /* compare_op ::= NK_GE */
+{ yymsp[0].minor.yy30 = OP_TYPE_GREATER_EQUAL; }
break;
- case 519: /* compare_op ::= NK_NE */
-#line 1007 "sql.y"
-{ yymsp[0].minor.yy708 = OP_TYPE_NOT_EQUAL; }
-#line 7375 "sql.c"
+ case 524: /* compare_op ::= NK_NE */
+{ yymsp[0].minor.yy30 = OP_TYPE_NOT_EQUAL; }
break;
- case 520: /* compare_op ::= NK_EQ */
-#line 1008 "sql.y"
-{ yymsp[0].minor.yy708 = OP_TYPE_EQUAL; }
-#line 7380 "sql.c"
+ case 525: /* compare_op ::= NK_EQ */
+{ yymsp[0].minor.yy30 = OP_TYPE_EQUAL; }
break;
- case 521: /* compare_op ::= LIKE */
-#line 1009 "sql.y"
-{ yymsp[0].minor.yy708 = OP_TYPE_LIKE; }
-#line 7385 "sql.c"
+ case 526: /* compare_op ::= LIKE */
+{ yymsp[0].minor.yy30 = OP_TYPE_LIKE; }
break;
- case 522: /* compare_op ::= NOT LIKE */
-#line 1010 "sql.y"
-{ yymsp[-1].minor.yy708 = OP_TYPE_NOT_LIKE; }
-#line 7390 "sql.c"
+ case 527: /* compare_op ::= NOT LIKE */
+{ yymsp[-1].minor.yy30 = OP_TYPE_NOT_LIKE; }
break;
- case 523: /* compare_op ::= MATCH */
-#line 1011 "sql.y"
-{ yymsp[0].minor.yy708 = OP_TYPE_MATCH; }
-#line 7395 "sql.c"
+ case 528: /* compare_op ::= MATCH */
+{ yymsp[0].minor.yy30 = OP_TYPE_MATCH; }
break;
- case 524: /* compare_op ::= NMATCH */
-#line 1012 "sql.y"
-{ yymsp[0].minor.yy708 = OP_TYPE_NMATCH; }
-#line 7400 "sql.c"
+ case 529: /* compare_op ::= NMATCH */
+{ yymsp[0].minor.yy30 = OP_TYPE_NMATCH; }
break;
- case 525: /* compare_op ::= CONTAINS */
-#line 1013 "sql.y"
-{ yymsp[0].minor.yy708 = OP_TYPE_JSON_CONTAINS; }
-#line 7405 "sql.c"
+ case 530: /* compare_op ::= CONTAINS */
+{ yymsp[0].minor.yy30 = OP_TYPE_JSON_CONTAINS; }
break;
- case 526: /* in_op ::= IN */
-#line 1017 "sql.y"
-{ yymsp[0].minor.yy708 = OP_TYPE_IN; }
-#line 7410 "sql.c"
+ case 531: /* in_op ::= IN */
+{ yymsp[0].minor.yy30 = OP_TYPE_IN; }
break;
- case 527: /* in_op ::= NOT IN */
-#line 1018 "sql.y"
-{ yymsp[-1].minor.yy708 = OP_TYPE_NOT_IN; }
-#line 7415 "sql.c"
+ case 532: /* in_op ::= NOT IN */
+{ yymsp[-1].minor.yy30 = OP_TYPE_NOT_IN; }
break;
- case 528: /* in_predicate_value ::= NK_LP literal_list NK_RP */
-#line 1020 "sql.y"
-{ yylhsminor.yy232 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy88)); }
-#line 7420 "sql.c"
- yymsp[-2].minor.yy232 = yylhsminor.yy232;
+ case 533: /* in_predicate_value ::= NK_LP literal_list NK_RP */
+{ yylhsminor.yy490 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy502)); }
+ yymsp[-2].minor.yy490 = yylhsminor.yy490;
break;
- case 530: /* boolean_value_expression ::= NOT boolean_primary */
-#line 1024 "sql.y"
+ case 535: /* boolean_value_expression ::= NOT boolean_primary */
{
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy232);
- yylhsminor.yy232 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy232), NULL));
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy490);
+ yylhsminor.yy490 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy490), NULL));
}
-#line 7429 "sql.c"
- yymsp[-1].minor.yy232 = yylhsminor.yy232;
+ yymsp[-1].minor.yy490 = yylhsminor.yy490;
break;
- case 531: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */
-#line 1029 "sql.y"
+ case 536: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy232);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy232);
- yylhsminor.yy232 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy232), releaseRawExprNode(pCxt, yymsp[0].minor.yy232)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy490);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy490);
+ yylhsminor.yy490 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy490), releaseRawExprNode(pCxt, yymsp[0].minor.yy490)));
}
-#line 7439 "sql.c"
- yymsp[-2].minor.yy232 = yylhsminor.yy232;
+ yymsp[-2].minor.yy490 = yylhsminor.yy490;
break;
- case 532: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */
-#line 1035 "sql.y"
+ case 537: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy232);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy232);
- yylhsminor.yy232 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy232), releaseRawExprNode(pCxt, yymsp[0].minor.yy232)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy490);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy490);
+ yylhsminor.yy490 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy490), releaseRawExprNode(pCxt, yymsp[0].minor.yy490)));
}
-#line 7449 "sql.c"
- yymsp[-2].minor.yy232 = yylhsminor.yy232;
+ yymsp[-2].minor.yy490 = yylhsminor.yy490;
break;
- case 540: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */
-#line 1053 "sql.y"
-{ yylhsminor.yy232 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy232, yymsp[0].minor.yy232, NULL); }
-#line 7455 "sql.c"
- yymsp[-2].minor.yy232 = yylhsminor.yy232;
+ case 545: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */
+{ yylhsminor.yy490 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy490, yymsp[0].minor.yy490, NULL); }
+ yymsp[-2].minor.yy490 = yylhsminor.yy490;
break;
- case 543: /* table_primary ::= table_name alias_opt */
-#line 1059 "sql.y"
-{ yylhsminor.yy232 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy993, &yymsp[0].minor.yy993); }
-#line 7461 "sql.c"
- yymsp[-1].minor.yy232 = yylhsminor.yy232;
+ case 548: /* table_primary ::= table_name alias_opt */
+{ yylhsminor.yy490 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy561, &yymsp[0].minor.yy561); }
+ yymsp[-1].minor.yy490 = yylhsminor.yy490;
break;
- case 544: /* table_primary ::= db_name NK_DOT table_name alias_opt */
-#line 1060 "sql.y"
-{ yylhsminor.yy232 = createRealTableNode(pCxt, &yymsp[-3].minor.yy993, &yymsp[-1].minor.yy993, &yymsp[0].minor.yy993); }
-#line 7467 "sql.c"
- yymsp[-3].minor.yy232 = yylhsminor.yy232;
+ case 549: /* table_primary ::= db_name NK_DOT table_name alias_opt */
+{ yylhsminor.yy490 = createRealTableNode(pCxt, &yymsp[-3].minor.yy561, &yymsp[-1].minor.yy561, &yymsp[0].minor.yy561); }
+ yymsp[-3].minor.yy490 = yylhsminor.yy490;
break;
- case 545: /* table_primary ::= subquery alias_opt */
-#line 1061 "sql.y"
-{ yylhsminor.yy232 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy232), &yymsp[0].minor.yy993); }
-#line 7473 "sql.c"
- yymsp[-1].minor.yy232 = yylhsminor.yy232;
+ case 550: /* table_primary ::= subquery alias_opt */
+{ yylhsminor.yy490 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy490), &yymsp[0].minor.yy561); }
+ yymsp[-1].minor.yy490 = yylhsminor.yy490;
break;
- case 547: /* alias_opt ::= */
-#line 1066 "sql.y"
-{ yymsp[1].minor.yy993 = nil_token; }
-#line 7479 "sql.c"
+ case 552: /* alias_opt ::= */
+{ yymsp[1].minor.yy561 = nil_token; }
break;
- case 549: /* alias_opt ::= AS table_alias */
-#line 1068 "sql.y"
-{ yymsp[-1].minor.yy993 = yymsp[0].minor.yy993; }
-#line 7484 "sql.c"
+ case 554: /* alias_opt ::= AS table_alias */
+{ yymsp[-1].minor.yy561 = yymsp[0].minor.yy561; }
break;
- case 550: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */
- case 551: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==551);
-#line 1070 "sql.y"
-{ yymsp[-2].minor.yy232 = yymsp[-1].minor.yy232; }
-#line 7490 "sql.c"
+ case 555: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */
+ case 556: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==556);
+{ yymsp[-2].minor.yy490 = yymsp[-1].minor.yy490; }
break;
- case 552: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */
-#line 1075 "sql.y"
-{ yylhsminor.yy232 = createJoinTableNode(pCxt, yymsp[-4].minor.yy436, yymsp[-5].minor.yy232, yymsp[-2].minor.yy232, yymsp[0].minor.yy232); }
-#line 7495 "sql.c"
- yymsp[-5].minor.yy232 = yylhsminor.yy232;
+ case 557: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */
+{ yylhsminor.yy490 = createJoinTableNode(pCxt, yymsp[-4].minor.yy246, yymsp[-5].minor.yy490, yymsp[-2].minor.yy490, yymsp[0].minor.yy490); }
+ yymsp[-5].minor.yy490 = yylhsminor.yy490;
break;
- case 553: /* join_type ::= */
-#line 1079 "sql.y"
-{ yymsp[1].minor.yy436 = JOIN_TYPE_INNER; }
-#line 7501 "sql.c"
+ case 558: /* join_type ::= */
+{ yymsp[1].minor.yy246 = JOIN_TYPE_INNER; }
break;
- case 554: /* join_type ::= INNER */
-#line 1080 "sql.y"
-{ yymsp[0].minor.yy436 = JOIN_TYPE_INNER; }
-#line 7506 "sql.c"
+ case 559: /* join_type ::= INNER */
+{ yymsp[0].minor.yy246 = JOIN_TYPE_INNER; }
break;
- case 555: /* query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */
-#line 1086 "sql.y"
+ case 560: /* query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */
{
- yymsp[-13].minor.yy232 = createSelectStmt(pCxt, yymsp[-11].minor.yy985, yymsp[-9].minor.yy88, yymsp[-8].minor.yy232, yymsp[-12].minor.yy88);
- yymsp[-13].minor.yy232 = setSelectStmtTagMode(pCxt, yymsp[-13].minor.yy232, yymsp[-10].minor.yy985);
- yymsp[-13].minor.yy232 = addWhereClause(pCxt, yymsp[-13].minor.yy232, yymsp[-7].minor.yy232);
- yymsp[-13].minor.yy232 = addPartitionByClause(pCxt, yymsp[-13].minor.yy232, yymsp[-6].minor.yy88);
- yymsp[-13].minor.yy232 = addWindowClauseClause(pCxt, yymsp[-13].minor.yy232, yymsp[-2].minor.yy232);
- yymsp[-13].minor.yy232 = addGroupByClause(pCxt, yymsp[-13].minor.yy232, yymsp[-1].minor.yy88);
- yymsp[-13].minor.yy232 = addHavingClause(pCxt, yymsp[-13].minor.yy232, yymsp[0].minor.yy232);
- yymsp[-13].minor.yy232 = addRangeClause(pCxt, yymsp[-13].minor.yy232, yymsp[-5].minor.yy232);
- yymsp[-13].minor.yy232 = addEveryClause(pCxt, yymsp[-13].minor.yy232, yymsp[-4].minor.yy232);
- yymsp[-13].minor.yy232 = addFillClause(pCxt, yymsp[-13].minor.yy232, yymsp[-3].minor.yy232);
+ yymsp[-13].minor.yy490 = createSelectStmt(pCxt, yymsp[-11].minor.yy845, yymsp[-9].minor.yy502, yymsp[-8].minor.yy490, yymsp[-12].minor.yy502);
+ yymsp[-13].minor.yy490 = setSelectStmtTagMode(pCxt, yymsp[-13].minor.yy490, yymsp[-10].minor.yy845);
+ yymsp[-13].minor.yy490 = addWhereClause(pCxt, yymsp[-13].minor.yy490, yymsp[-7].minor.yy490);
+ yymsp[-13].minor.yy490 = addPartitionByClause(pCxt, yymsp[-13].minor.yy490, yymsp[-6].minor.yy502);
+ yymsp[-13].minor.yy490 = addWindowClauseClause(pCxt, yymsp[-13].minor.yy490, yymsp[-2].minor.yy490);
+ yymsp[-13].minor.yy490 = addGroupByClause(pCxt, yymsp[-13].minor.yy490, yymsp[-1].minor.yy502);
+ yymsp[-13].minor.yy490 = addHavingClause(pCxt, yymsp[-13].minor.yy490, yymsp[0].minor.yy490);
+ yymsp[-13].minor.yy490 = addRangeClause(pCxt, yymsp[-13].minor.yy490, yymsp[-5].minor.yy490);
+ yymsp[-13].minor.yy490 = addEveryClause(pCxt, yymsp[-13].minor.yy490, yymsp[-4].minor.yy490);
+ yymsp[-13].minor.yy490 = addFillClause(pCxt, yymsp[-13].minor.yy490, yymsp[-3].minor.yy490);
}
-#line 7522 "sql.c"
break;
- case 556: /* hint_list ::= */
-#line 1101 "sql.y"
-{ yymsp[1].minor.yy88 = createHintNodeList(pCxt, NULL); }
-#line 7527 "sql.c"
+ case 561: /* hint_list ::= */
+{ yymsp[1].minor.yy502 = createHintNodeList(pCxt, NULL); }
break;
- case 557: /* hint_list ::= NK_HINT */
-#line 1102 "sql.y"
-{ yylhsminor.yy88 = createHintNodeList(pCxt, &yymsp[0].minor.yy0); }
-#line 7532 "sql.c"
- yymsp[0].minor.yy88 = yylhsminor.yy88;
+ case 562: /* hint_list ::= NK_HINT */
+{ yylhsminor.yy502 = createHintNodeList(pCxt, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy502 = yylhsminor.yy502;
break;
- case 562: /* set_quantifier_opt ::= ALL */
-#line 1113 "sql.y"
-{ yymsp[0].minor.yy985 = false; }
-#line 7538 "sql.c"
+ case 567: /* set_quantifier_opt ::= ALL */
+{ yymsp[0].minor.yy845 = false; }
break;
- case 565: /* select_item ::= NK_STAR */
-#line 1120 "sql.y"
-{ yylhsminor.yy232 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); }
-#line 7543 "sql.c"
- yymsp[0].minor.yy232 = yylhsminor.yy232;
+ case 570: /* select_item ::= NK_STAR */
+{ yylhsminor.yy490 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy490 = yylhsminor.yy490;
break;
- case 567: /* select_item ::= common_expression column_alias */
- case 577: /* partition_item ::= expr_or_subquery column_alias */ yytestcase(yyruleno==577);
-#line 1122 "sql.y"
-{ yylhsminor.yy232 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy232), &yymsp[0].minor.yy993); }
-#line 7550 "sql.c"
- yymsp[-1].minor.yy232 = yylhsminor.yy232;
+ case 572: /* select_item ::= common_expression column_alias */
+ case 582: /* partition_item ::= expr_or_subquery column_alias */ yytestcase(yyruleno==582);
+{ yylhsminor.yy490 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy490), &yymsp[0].minor.yy561); }
+ yymsp[-1].minor.yy490 = yylhsminor.yy490;
break;
- case 568: /* select_item ::= common_expression AS column_alias */
- case 578: /* partition_item ::= expr_or_subquery AS column_alias */ yytestcase(yyruleno==578);
-#line 1123 "sql.y"
-{ yylhsminor.yy232 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy232), &yymsp[0].minor.yy993); }
-#line 7557 "sql.c"
- yymsp[-2].minor.yy232 = yylhsminor.yy232;
+ case 573: /* select_item ::= common_expression AS column_alias */
+ case 583: /* partition_item ::= expr_or_subquery AS column_alias */ yytestcase(yyruleno==583);
+{ yylhsminor.yy490 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy490), &yymsp[0].minor.yy561); }
+ yymsp[-2].minor.yy490 = yylhsminor.yy490;
break;
- case 573: /* partition_by_clause_opt ::= PARTITION BY partition_list */
- case 601: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==601);
- case 621: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==621);
-#line 1132 "sql.y"
-{ yymsp[-2].minor.yy88 = yymsp[0].minor.yy88; }
-#line 7565 "sql.c"
+ case 578: /* partition_by_clause_opt ::= PARTITION BY partition_list */
+ case 606: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==606);
+ case 626: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==626);
+{ yymsp[-2].minor.yy502 = yymsp[0].minor.yy502; }
break;
- case 580: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */
-#line 1145 "sql.y"
-{ yymsp[-5].minor.yy232 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy232), releaseRawExprNode(pCxt, yymsp[-1].minor.yy232)); }
-#line 7570 "sql.c"
+ case 585: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */
+{ yymsp[-5].minor.yy490 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy490), releaseRawExprNode(pCxt, yymsp[-1].minor.yy490)); }
break;
- case 581: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */
-#line 1146 "sql.y"
-{ yymsp[-3].minor.yy232 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy232)); }
-#line 7575 "sql.c"
+ case 586: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */
+{ yymsp[-3].minor.yy490 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy490)); }
break;
- case 582: /* twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */
-#line 1148 "sql.y"
-{ yymsp[-5].minor.yy232 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy232), NULL, yymsp[-1].minor.yy232, yymsp[0].minor.yy232); }
-#line 7580 "sql.c"
+ case 587: /* twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */
+{ yymsp[-5].minor.yy490 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy490), NULL, yymsp[-1].minor.yy490, yymsp[0].minor.yy490); }
break;
- case 583: /* twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */
-#line 1152 "sql.y"
-{ yymsp[-7].minor.yy232 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy232), releaseRawExprNode(pCxt, yymsp[-3].minor.yy232), yymsp[-1].minor.yy232, yymsp[0].minor.yy232); }
-#line 7585 "sql.c"
+ case 588: /* twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */
+{ yymsp[-7].minor.yy490 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy490), releaseRawExprNode(pCxt, yymsp[-3].minor.yy490), yymsp[-1].minor.yy490, yymsp[0].minor.yy490); }
break;
- case 584: /* twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */
-#line 1154 "sql.y"
-{ yymsp[-6].minor.yy232 = createEventWindowNode(pCxt, yymsp[-3].minor.yy232, yymsp[0].minor.yy232); }
-#line 7590 "sql.c"
+ case 589: /* twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */
+{ yymsp[-6].minor.yy490 = createEventWindowNode(pCxt, yymsp[-3].minor.yy490, yymsp[0].minor.yy490); }
break;
- case 591: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */
-#line 1164 "sql.y"
-{ yymsp[-3].minor.yy232 = createFillNode(pCxt, yymsp[-1].minor.yy246, NULL); }
-#line 7595 "sql.c"
+ case 596: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */
+{ yymsp[-3].minor.yy490 = createFillNode(pCxt, yymsp[-1].minor.yy718, NULL); }
break;
- case 592: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */
-#line 1165 "sql.y"
-{ yymsp[-5].minor.yy232 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy88)); }
-#line 7600 "sql.c"
+ case 597: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */
+{ yymsp[-5].minor.yy490 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy502)); }
break;
- case 593: /* fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */
-#line 1166 "sql.y"
-{ yymsp[-5].minor.yy232 = createFillNode(pCxt, FILL_MODE_VALUE_F, createNodeListNode(pCxt, yymsp[-1].minor.yy88)); }
-#line 7605 "sql.c"
+ case 598: /* fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */
+{ yymsp[-5].minor.yy490 = createFillNode(pCxt, FILL_MODE_VALUE_F, createNodeListNode(pCxt, yymsp[-1].minor.yy502)); }
break;
- case 594: /* fill_mode ::= NONE */
-#line 1170 "sql.y"
-{ yymsp[0].minor.yy246 = FILL_MODE_NONE; }
-#line 7610 "sql.c"
+ case 599: /* fill_mode ::= NONE */
+{ yymsp[0].minor.yy718 = FILL_MODE_NONE; }
break;
- case 595: /* fill_mode ::= PREV */
-#line 1171 "sql.y"
-{ yymsp[0].minor.yy246 = FILL_MODE_PREV; }
-#line 7615 "sql.c"
+ case 600: /* fill_mode ::= PREV */
+{ yymsp[0].minor.yy718 = FILL_MODE_PREV; }
break;
- case 596: /* fill_mode ::= NULL */
-#line 1172 "sql.y"
-{ yymsp[0].minor.yy246 = FILL_MODE_NULL; }
-#line 7620 "sql.c"
+ case 601: /* fill_mode ::= NULL */
+{ yymsp[0].minor.yy718 = FILL_MODE_NULL; }
break;
- case 597: /* fill_mode ::= NULL_F */
-#line 1173 "sql.y"
-{ yymsp[0].minor.yy246 = FILL_MODE_NULL_F; }
-#line 7625 "sql.c"
+ case 602: /* fill_mode ::= NULL_F */
+{ yymsp[0].minor.yy718 = FILL_MODE_NULL_F; }
break;
- case 598: /* fill_mode ::= LINEAR */
-#line 1174 "sql.y"
-{ yymsp[0].minor.yy246 = FILL_MODE_LINEAR; }
-#line 7630 "sql.c"
+ case 603: /* fill_mode ::= LINEAR */
+{ yymsp[0].minor.yy718 = FILL_MODE_LINEAR; }
break;
- case 599: /* fill_mode ::= NEXT */
-#line 1175 "sql.y"
-{ yymsp[0].minor.yy246 = FILL_MODE_NEXT; }
-#line 7635 "sql.c"
+ case 604: /* fill_mode ::= NEXT */
+{ yymsp[0].minor.yy718 = FILL_MODE_NEXT; }
break;
- case 602: /* group_by_list ::= expr_or_subquery */
-#line 1184 "sql.y"
-{ yylhsminor.yy88 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy232))); }
-#line 7640 "sql.c"
- yymsp[0].minor.yy88 = yylhsminor.yy88;
+ case 607: /* group_by_list ::= expr_or_subquery */
+{ yylhsminor.yy502 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy490))); }
+ yymsp[0].minor.yy502 = yylhsminor.yy502;
break;
- case 603: /* group_by_list ::= group_by_list NK_COMMA expr_or_subquery */
-#line 1185 "sql.y"
-{ yylhsminor.yy88 = addNodeToList(pCxt, yymsp[-2].minor.yy88, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy232))); }
-#line 7646 "sql.c"
- yymsp[-2].minor.yy88 = yylhsminor.yy88;
+ case 608: /* group_by_list ::= group_by_list NK_COMMA expr_or_subquery */
+{ yylhsminor.yy502 = addNodeToList(pCxt, yymsp[-2].minor.yy502, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy490))); }
+ yymsp[-2].minor.yy502 = yylhsminor.yy502;
break;
- case 607: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */
-#line 1192 "sql.y"
-{ yymsp[-5].minor.yy232 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy232), releaseRawExprNode(pCxt, yymsp[-1].minor.yy232)); }
-#line 7652 "sql.c"
+ case 612: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */
+{ yymsp[-5].minor.yy490 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy490), releaseRawExprNode(pCxt, yymsp[-1].minor.yy490)); }
break;
- case 608: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */
-#line 1194 "sql.y"
-{ yymsp[-3].minor.yy232 = createInterpTimePoint(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy232)); }
-#line 7657 "sql.c"
+ case 613: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */
+{ yymsp[-3].minor.yy490 = createInterpTimePoint(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy490)); }
break;
- case 611: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */
-#line 1201 "sql.y"
+ case 616: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */
{
- yylhsminor.yy232 = addOrderByClause(pCxt, yymsp[-3].minor.yy232, yymsp[-2].minor.yy88);
- yylhsminor.yy232 = addSlimitClause(pCxt, yylhsminor.yy232, yymsp[-1].minor.yy232);
- yylhsminor.yy232 = addLimitClause(pCxt, yylhsminor.yy232, yymsp[0].minor.yy232);
+ yylhsminor.yy490 = addOrderByClause(pCxt, yymsp[-3].minor.yy490, yymsp[-2].minor.yy502);
+ yylhsminor.yy490 = addSlimitClause(pCxt, yylhsminor.yy490, yymsp[-1].minor.yy490);
+ yylhsminor.yy490 = addLimitClause(pCxt, yylhsminor.yy490, yymsp[0].minor.yy490);
}
-#line 7666 "sql.c"
- yymsp[-3].minor.yy232 = yylhsminor.yy232;
+ yymsp[-3].minor.yy490 = yylhsminor.yy490;
break;
- case 614: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */
-#line 1211 "sql.y"
-{ yylhsminor.yy232 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy232, yymsp[0].minor.yy232); }
-#line 7672 "sql.c"
- yymsp[-3].minor.yy232 = yylhsminor.yy232;
+ case 619: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */
+{ yylhsminor.yy490 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy490, yymsp[0].minor.yy490); }
+ yymsp[-3].minor.yy490 = yylhsminor.yy490;
break;
- case 615: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */
-#line 1213 "sql.y"
-{ yylhsminor.yy232 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy232, yymsp[0].minor.yy232); }
-#line 7678 "sql.c"
- yymsp[-2].minor.yy232 = yylhsminor.yy232;
+ case 620: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */
+{ yylhsminor.yy490 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy490, yymsp[0].minor.yy490); }
+ yymsp[-2].minor.yy490 = yylhsminor.yy490;
break;
- case 623: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */
- case 627: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==627);
-#line 1227 "sql.y"
-{ yymsp[-1].minor.yy232 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); }
-#line 7685 "sql.c"
+ case 628: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */
+ case 632: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==632);
+{ yymsp[-1].minor.yy490 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); }
break;
- case 624: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
- case 628: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==628);
-#line 1228 "sql.y"
-{ yymsp[-3].minor.yy232 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); }
-#line 7691 "sql.c"
+ case 629: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
+ case 633: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==633);
+{ yymsp[-3].minor.yy490 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); }
break;
- case 625: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
- case 629: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==629);
-#line 1229 "sql.y"
-{ yymsp[-3].minor.yy232 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); }
-#line 7697 "sql.c"
+ case 630: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
+ case 634: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==634);
+{ yymsp[-3].minor.yy490 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); }
break;
- case 630: /* subquery ::= NK_LP query_expression NK_RP */
-#line 1237 "sql.y"
-{ yylhsminor.yy232 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy232); }
-#line 7702 "sql.c"
- yymsp[-2].minor.yy232 = yylhsminor.yy232;
+ case 635: /* subquery ::= NK_LP query_expression NK_RP */
+{ yylhsminor.yy490 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy490); }
+ yymsp[-2].minor.yy490 = yylhsminor.yy490;
break;
- case 635: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */
-#line 1251 "sql.y"
-{ yylhsminor.yy232 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy232), yymsp[-1].minor.yy834, yymsp[0].minor.yy153); }
-#line 7708 "sql.c"
- yymsp[-2].minor.yy232 = yylhsminor.yy232;
+ case 640: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */
+{ yylhsminor.yy490 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy490), yymsp[-1].minor.yy876, yymsp[0].minor.yy361); }
+ yymsp[-2].minor.yy490 = yylhsminor.yy490;
break;
- case 636: /* ordering_specification_opt ::= */
-#line 1255 "sql.y"
-{ yymsp[1].minor.yy834 = ORDER_ASC; }
-#line 7714 "sql.c"
+ case 641: /* ordering_specification_opt ::= */
+{ yymsp[1].minor.yy876 = ORDER_ASC; }
break;
- case 637: /* ordering_specification_opt ::= ASC */
-#line 1256 "sql.y"
-{ yymsp[0].minor.yy834 = ORDER_ASC; }
-#line 7719 "sql.c"
+ case 642: /* ordering_specification_opt ::= ASC */
+{ yymsp[0].minor.yy876 = ORDER_ASC; }
break;
- case 638: /* ordering_specification_opt ::= DESC */
-#line 1257 "sql.y"
-{ yymsp[0].minor.yy834 = ORDER_DESC; }
-#line 7724 "sql.c"
+ case 643: /* ordering_specification_opt ::= DESC */
+{ yymsp[0].minor.yy876 = ORDER_DESC; }
break;
- case 639: /* null_ordering_opt ::= */
-#line 1261 "sql.y"
-{ yymsp[1].minor.yy153 = NULL_ORDER_DEFAULT; }
-#line 7729 "sql.c"
+ case 644: /* null_ordering_opt ::= */
+{ yymsp[1].minor.yy361 = NULL_ORDER_DEFAULT; }
break;
- case 640: /* null_ordering_opt ::= NULLS FIRST */
-#line 1262 "sql.y"
-{ yymsp[-1].minor.yy153 = NULL_ORDER_FIRST; }
-#line 7734 "sql.c"
+ case 645: /* null_ordering_opt ::= NULLS FIRST */
+{ yymsp[-1].minor.yy361 = NULL_ORDER_FIRST; }
break;
- case 641: /* null_ordering_opt ::= NULLS LAST */
-#line 1263 "sql.y"
-{ yymsp[-1].minor.yy153 = NULL_ORDER_LAST; }
-#line 7739 "sql.c"
+ case 646: /* null_ordering_opt ::= NULLS LAST */
+{ yymsp[-1].minor.yy361 = NULL_ORDER_LAST; }
break;
default:
break;
@@ -7798,7 +6630,6 @@ static void yy_syntax_error(
ParseCTX_FETCH
#define TOKEN yyminor
/************ Begin %syntax_error code ****************************************/
-#line 29 "sql.y"
if (TSDB_CODE_SUCCESS == pCxt->errCode) {
if(TOKEN.z) {
@@ -7809,7 +6640,6 @@ static void yy_syntax_error(
} else if (TSDB_CODE_PAR_DB_NOT_SPECIFIED == pCxt->errCode && TK_NK_FLOAT == TOKEN.type) {
pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_SYNTAX_ERROR, TOKEN.z);
}
-#line 7812 "sql.c"
/************ End %syntax_error code ******************************************/
ParseARG_STORE /* Suppress warning about unused %extra_argument variable */
ParseCTX_STORE
@@ -7895,56 +6725,12 @@ void Parse(
}
#endif
- while(1){ /* Exit by "break" */
- assert( yypParser->yytos>=yypParser->yystack );
+ do{
assert( yyact==yypParser->yytos->stateno );
yyact = yy_find_shift_action((YYCODETYPE)yymajor,yyact);
if( yyact >= YY_MIN_REDUCE ){
- unsigned int yyruleno = yyact - YY_MIN_REDUCE; /* Reduce by this rule */
-#ifndef NDEBUG
- assert( yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) );
- if( yyTraceFILE ){
- int yysize = yyRuleInfoNRhs[yyruleno];
- if( yysize ){
- fprintf(yyTraceFILE, "%sReduce %d [%s]%s, pop back to state %d.\n",
- yyTracePrompt,
- yyruleno, yyRuleName[yyruleno],
- yyrulenoyytos[yysize].stateno);
- }else{
- fprintf(yyTraceFILE, "%sReduce %d [%s]%s.\n",
- yyTracePrompt, yyruleno, yyRuleName[yyruleno],
- yyrulenoyytos - yypParser->yystack)>yypParser->yyhwm ){
- yypParser->yyhwm++;
- assert( yypParser->yyhwm ==
- (int)(yypParser->yytos - yypParser->yystack));
- }
-#endif
-#if YYSTACKDEPTH>0
- if( yypParser->yytos>=yypParser->yystackEnd ){
- yyStackOverflow(yypParser);
- break;
- }
-#else
- if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz-1] ){
- if( yyGrowStack(yypParser) ){
- yyStackOverflow(yypParser);
- break;
- }
- }
-#endif
- }
- yyact = yy_reduce(yypParser,yyruleno,yymajor,yyminor ParseCTX_PARAM);
+ yyact = yy_reduce(yypParser,yyact-YY_MIN_REDUCE,yymajor,
+ yyminor ParseCTX_PARAM);
}else if( yyact <= YY_MAX_SHIFTREDUCE ){
yy_shift(yypParser,yyact,(YYCODETYPE)yymajor,yyminor);
#ifndef YYNOERRORRECOVERY
@@ -8000,13 +6786,14 @@ void Parse(
yy_destructor(yypParser, (YYCODETYPE)yymajor, &yyminorunion);
yymajor = YYNOCODE;
}else{
- while( yypParser->yytos > yypParser->yystack ){
- yyact = yy_find_reduce_action(yypParser->yytos->stateno,
- YYERRORSYMBOL);
- if( yyact<=YY_MAX_SHIFTREDUCE ) break;
+ while( yypParser->yytos >= yypParser->yystack
+ && (yyact = yy_find_reduce_action(
+ yypParser->yytos->stateno,
+ YYERRORSYMBOL)) > YY_MAX_SHIFTREDUCE
+ ){
yy_pop_parser_stack(yypParser);
}
- if( yypParser->yytos <= yypParser->yystack || yymajor==0 ){
+ if( yypParser->yytos < yypParser->yystack || yymajor==0 ){
yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion);
yy_parse_failed(yypParser);
#ifndef YYNOERRORRECOVERY
@@ -8056,7 +6843,7 @@ void Parse(
break;
#endif
}
- }
+ }while( yypParser->yytos>yypParser->yystack );
#ifndef NDEBUG
if( yyTraceFILE ){
yyStackEntry *i;
diff --git a/source/libs/planner/src/planOptimizer.c b/source/libs/planner/src/planOptimizer.c
index dfb9343cc8..af9ec93f65 100644
--- a/source/libs/planner/src/planOptimizer.c
+++ b/source/libs/planner/src/planOptimizer.c
@@ -338,6 +338,7 @@ static void scanPathOptSetScanOrder(EScanOrder scanOrder, SScanLogicNode* pScan)
if (pScan->sortPrimaryKey || pScan->scanSeq[0] > 1 || pScan->scanSeq[1] > 1) {
return;
}
+ pScan->node.outputTsOrder = (SCAN_ORDER_ASC == scanOrder) ? ORDER_ASC : ORDER_DESC;
switch (scanOrder) {
case SCAN_ORDER_ASC:
pScan->scanSeq[0] = 1;
@@ -1450,6 +1451,132 @@ static int32_t sortPrimaryKeyOptimize(SOptimizeContext* pCxt, SLogicSubplan* pLo
return sortPrimaryKeyOptimizeImpl(pCxt, pLogicSubplan, pSort);
}
+static int32_t sortForJoinOptimizeImpl(SOptimizeContext* pCxt, SLogicSubplan* pLogicSubplan, SJoinLogicNode* pJoin) {
+ SLogicNode* pLeft = (SLogicNode*)nodesListGetNode(pJoin->node.pChildren, 0);
+ SLogicNode* pRight = (SLogicNode*)nodesListGetNode(pJoin->node.pChildren, 1);
+ SScanLogicNode* pScan = NULL;
+
+ if (QUERY_NODE_LOGIC_PLAN_SCAN == nodeType(pLeft) && ((SScanLogicNode*)pLeft)->node.outputTsOrder != SCAN_ORDER_BOTH) {
+ pScan = (SScanLogicNode*)pLeft;
+ } else if (QUERY_NODE_LOGIC_PLAN_SCAN == nodeType(pRight) && ((SScanLogicNode*)pRight)->node.outputTsOrder != SCAN_ORDER_BOTH) {
+ pScan = (SScanLogicNode*)pRight;
+ }
+
+ if (NULL != pScan) {
+ switch (pScan->node.outputTsOrder) {
+ case SCAN_ORDER_ASC:
+ pScan->scanSeq[0] = 0;
+ pScan->scanSeq[1] = 1;
+ pScan->node.outputTsOrder = ORDER_DESC;
+ goto _return;
+ case SCAN_ORDER_DESC:
+ pScan->scanSeq[0] = 1;
+ pScan->scanSeq[1] = 0;
+ pScan->node.outputTsOrder = ORDER_ASC;
+ goto _return;
+ default:
+ break;
+ }
+ }
+
+ if (QUERY_NODE_OPERATOR != nodeType(pJoin->pPrimKeyEqCond)) {
+ return TSDB_CODE_PLAN_INTERNAL_ERROR;
+ }
+
+ bool res = false;
+ SOperatorNode* pOp = (SOperatorNode*)pJoin->pPrimKeyEqCond;
+ if (QUERY_NODE_COLUMN != nodeType(pOp->pLeft) || QUERY_NODE_COLUMN != nodeType(pOp->pRight)) {
+ return TSDB_CODE_PLAN_INTERNAL_ERROR;
+ }
+
+ SNode* pOrderByNode = NULL;
+ SSHashObj* pLeftTables = NULL;
+ collectTableAliasFromNodes(nodesListGetNode(pJoin->node.pChildren, 0), &pLeftTables);
+
+ if (NULL != tSimpleHashGet(pLeftTables, ((SColumnNode*)pOp->pLeft)->tableAlias, strlen(((SColumnNode*)pOp->pLeft)->tableAlias))) {
+ pOrderByNode = pOp->pLeft;
+ } else if (NULL != tSimpleHashGet(pLeftTables, ((SColumnNode*)pOp->pRight)->tableAlias, strlen(((SColumnNode*)pOp->pRight)->tableAlias))) {
+ pOrderByNode = pOp->pRight;
+ }
+
+ tSimpleHashCleanup(pLeftTables);
+
+ if (NULL == pOrderByNode) {
+ return TSDB_CODE_PLAN_INTERNAL_ERROR;
+ }
+
+ SSortLogicNode* pSort = (SSortLogicNode*)nodesMakeNode(QUERY_NODE_LOGIC_PLAN_SORT);
+ if (NULL == pSort) {
+ return TSDB_CODE_OUT_OF_MEMORY;
+ }
+
+ pSort->node.outputTsOrder = (ORDER_ASC == pLeft->outputTsOrder) ? ORDER_DESC : ORDER_ASC;
+ pSort->groupSort = false;
+ SOrderByExprNode* pOrder = (SOrderByExprNode*)nodesMakeNode(QUERY_NODE_ORDER_BY_EXPR);
+ if (NULL == pOrder) {
+ nodesDestroyNode((SNode *)pSort);
+ return TSDB_CODE_OUT_OF_MEMORY;
+ }
+
+ nodesListMakeAppend(&pSort->pSortKeys, (SNode*)pOrder);
+ pOrder->order = (ORDER_ASC == pLeft->outputTsOrder) ? ORDER_DESC : ORDER_ASC;
+ pOrder->pExpr = nodesCloneNode(pOrderByNode);
+ pOrder->nullOrder = (ORDER_ASC == pOrder->order) ? NULL_ORDER_FIRST : NULL_ORDER_LAST;
+ if (!pOrder->pExpr) {
+ nodesDestroyNode((SNode *)pSort);
+ return TSDB_CODE_OUT_OF_MEMORY;
+ }
+
+ pLeft->pParent = (SLogicNode*)pSort;
+ nodesListMakeAppend(&pSort->node.pChildren, (SNode*)pLeft);
+ pJoin->node.pChildren->pHead->pNode = (SNode*)pSort;
+ pSort->node.pParent = (SLogicNode*)pJoin;;
+
+_return:
+
+ pCxt->optimized = true;
+
+ return TSDB_CODE_SUCCESS;
+}
+
+
+static bool sortForJoinOptMayBeOptimized(SLogicNode* pNode) {
+ if (QUERY_NODE_LOGIC_PLAN_JOIN != nodeType(pNode)) {
+ return false;
+ }
+
+ SJoinLogicNode* pJoin = (SJoinLogicNode*)pNode;
+ if (pNode->pChildren->length != 2 || !pJoin->hasSubQuery || pJoin->isLowLevelJoin) {
+ return false;
+ }
+
+ SLogicNode* pLeft = (SLogicNode*)nodesListGetNode(pJoin->node.pChildren, 0);
+ SLogicNode* pRight = (SLogicNode*)nodesListGetNode(pJoin->node.pChildren, 1);
+
+ if (ORDER_ASC != pLeft->outputTsOrder && ORDER_DESC != pLeft->outputTsOrder) {
+ return false;
+ }
+ if (ORDER_ASC != pRight->outputTsOrder && ORDER_DESC != pRight->outputTsOrder) {
+ return false;
+ }
+
+ if (pLeft->outputTsOrder == pRight->outputTsOrder) {
+ return false;
+ }
+
+ return true;
+}
+
+
+static int32_t sortForJoinOptimize(SOptimizeContext* pCxt, SLogicSubplan* pLogicSubplan) {
+ SJoinLogicNode* pJoin = (SJoinLogicNode*)optFindPossibleNode(pLogicSubplan->pNode, sortForJoinOptMayBeOptimized);
+ if (NULL == pJoin) {
+ return TSDB_CODE_SUCCESS;
+ }
+ return sortForJoinOptimizeImpl(pCxt, pLogicSubplan, pJoin);
+}
+
+
static bool smaIndexOptMayBeOptimized(SLogicNode* pNode) {
if (QUERY_NODE_LOGIC_PLAN_SCAN != nodeType(pNode) || NULL == pNode->pParent ||
QUERY_NODE_LOGIC_PLAN_WINDOW != nodeType(pNode->pParent) ||
@@ -4197,6 +4324,7 @@ static const SOptimizeRule optimizeRuleSet[] = {
{.pName = "StableJoin", .optimizeFunc = stableJoinOptimize},
{.pName = "sortNonPriKeyOptimize", .optimizeFunc = sortNonPriKeyOptimize},
{.pName = "SortPrimaryKey", .optimizeFunc = sortPrimaryKeyOptimize},
+ {.pName = "SortForjoin", .optimizeFunc = sortForJoinOptimize},
{.pName = "SmaIndex", .optimizeFunc = smaIndexOptimize},
{.pName = "PushDownLimit", .optimizeFunc = pushDownLimitOptimize},
{.pName = "PartitionTags", .optimizeFunc = partTagsOptimize},
diff --git a/source/libs/planner/src/planSpliter.c b/source/libs/planner/src/planSpliter.c
index 3e9c261446..4099f2be42 100644
--- a/source/libs/planner/src/planSpliter.c
+++ b/source/libs/planner/src/planSpliter.c
@@ -1172,9 +1172,8 @@ static int32_t stbSplCreateMergeKeys(SNodeList* pSortKeys, SNodeList* pTargets,
SNode* pTarget = NULL;
bool found = false;
FOREACH(pTarget, pTargets) {
- if ((QUERY_NODE_COLUMN == nodeType(pSortExpr) && nodesEqualNode((SNode*)pSortExpr, pTarget))
- // || (0 == strcmp(pSortExpr->aliasName, ((SColumnNode*)pTarget)->colName))
- ) {
+ if ((QUERY_NODE_COLUMN == nodeType(pSortExpr) && nodesEqualNode((SNode*)pSortExpr, pTarget)) ||
+ (0 == strcmp(pSortExpr->aliasName, ((SColumnNode*)pTarget)->colName))) {
code = nodesListMakeStrictAppend(&pMergeKeys, stbSplCreateOrderByExpr(pSortKey, pTarget));
if (TSDB_CODE_SUCCESS != code) {
break;
diff --git a/source/libs/qworker/src/qworker.c b/source/libs/qworker/src/qworker.c
index 7376aa3a9c..5246eab115 100644
--- a/source/libs/qworker/src/qworker.c
+++ b/source/libs/qworker/src/qworker.c
@@ -543,7 +543,7 @@ int32_t qwHandlePrePhaseEvents(QW_FPARAMS_DEF, int8_t phase, SQWPhaseInput *inpu
if (QW_EVENT_RECEIVED(ctx, QW_EVENT_FETCH)) {
QW_TASK_WLOG("last fetch still not processed, phase:%s", qwPhaseStr(phase));
- QW_ERR_JRET(TSDB_CODE_QRY_DUPLICATTED_OPERATION);
+ QW_ERR_JRET(TSDB_CODE_QRY_DUPLICATED_OPERATION);
}
if (ctx->rspCode) {
@@ -972,7 +972,7 @@ int32_t qwProcessDrop(QW_FPARAMS_DEF, SQWMsg *qwMsg) {
if (QW_EVENT_RECEIVED(ctx, QW_EVENT_DROP)) {
QW_TASK_WLOG_E("task already dropping");
- QW_ERR_JRET(TSDB_CODE_QRY_DUPLICATTED_OPERATION);
+ QW_ERR_JRET(TSDB_CODE_QRY_DUPLICATED_OPERATION);
}
if (QW_QUERY_RUNNING(ctx)) {
diff --git a/source/libs/scalar/src/sclfunc.c b/source/libs/scalar/src/sclfunc.c
index 2e44c75c17..26552f25b4 100644
--- a/source/libs/scalar/src/sclfunc.c
+++ b/source/libs/scalar/src/sclfunc.c
@@ -1788,6 +1788,7 @@ bool getTimePseudoFuncEnv(SFunctionNode *UNUSED_PARAM(pFunc), SFuncExecEnv *pEnv
return true;
}
+#ifdef BUILD_NO_CALL
int32_t qStartTsFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput) {
colDataSetInt64(pOutput->columnData, pOutput->numOfRows, (int64_t *)colDataGetData(pInput->columnData, 0));
return TSDB_CODE_SUCCESS;
@@ -1797,6 +1798,7 @@ int32_t qEndTsFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOu
colDataSetInt64(pOutput->columnData, pOutput->numOfRows, (int64_t *)colDataGetData(pInput->columnData, 1));
return TSDB_CODE_SUCCESS;
}
+#endif
int32_t winDurFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput) {
colDataSetInt64(pOutput->columnData, pOutput->numOfRows, (int64_t *)colDataGetData(pInput->columnData, 2));
@@ -1824,7 +1826,7 @@ int32_t qTbnameFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pO
pOutput->numOfRows += pInput->numOfRows;
return TSDB_CODE_SUCCESS;
}
-
+#ifdef BUILD_NO_CALL
int32_t qTbUidFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput) {
char* p = colDataGetNumData(pInput->columnData, 0);
@@ -1848,7 +1850,7 @@ int32_t qVgIdFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOut
pOutput->numOfRows += pInput->numOfRows;
return TSDB_CODE_SUCCESS;
}
-
+#endif
/** Aggregation functions **/
int32_t countScalarFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput) {
diff --git a/source/libs/scheduler/src/schJob.c b/source/libs/scheduler/src/schJob.c
index b565619e75..6e312f0e6f 100644
--- a/source/libs/scheduler/src/schJob.c
+++ b/source/libs/scheduler/src/schJob.c
@@ -386,10 +386,13 @@ _return:
int32_t schDumpJobExecRes(SSchJob *pJob, SExecResult *pRes) {
pRes->code = atomic_load_32(&pJob->errCode);
pRes->numOfRows = pJob->resNumOfRows;
+
+ SCH_LOCK(SCH_WRITE, &pJob->resLock);
pRes->res = pJob->execRes.res;
pRes->msgType = pJob->execRes.msgType;
pRes->numOfBytes = pJob->execRes.numOfBytes;
pJob->execRes.res = NULL;
+ SCH_UNLOCK(SCH_WRITE, &pJob->resLock);
SCH_JOB_DLOG("execRes dumped, code: %s", tstrerror(pRes->code));
diff --git a/source/libs/stream/inc/streamInt.h b/source/libs/stream/inc/streamInt.h
index 3e4919d60d..b0cde1da44 100644
--- a/source/libs/stream/inc/streamInt.h
+++ b/source/libs/stream/inc/streamInt.h
@@ -123,8 +123,6 @@ int32_t streamTaskInitTokenBucket(STokenBucket* pBucket, int32_t numCap, int32_t
STaskId streamTaskGetTaskId(const SStreamTask* pTask);
void streamTaskInitForLaunchHTask(SHistoryTaskInfo* pInfo);
void streamTaskSetRetryInfoForLaunch(SHistoryTaskInfo* pInfo);
-int32_t streamTaskBuildScanhistoryRspMsg(SStreamTask* pTask, SStreamScanHistoryFinishReq* pReq, void** pBuffer,
- int32_t* pLen);
int32_t streamTaskFillHistoryFinished(SStreamTask* pTask);
void streamClearChkptReadyMsg(SStreamTask* pTask);
@@ -134,10 +132,7 @@ int32_t streamQueueItemGetSize(const SStreamQueueItem* pItem);
void streamQueueItemIncSize(const SStreamQueueItem* pItem, int32_t size);
const char* streamQueueItemGetTypeStr(int32_t type);
SStreamQueueItem* streamQueueMergeQueueItem(SStreamQueueItem* dst, SStreamQueueItem* pElem);
-
-int32_t streamAddEndScanHistoryMsg(SStreamTask* pTask, SRpcHandleInfo* pRpcInfo, SStreamScanHistoryFinishReq* pReq);
-int32_t streamNotifyUpstreamContinue(SStreamTask* pTask);
-int32_t streamTransferStateToStreamTask(SStreamTask* pTask);
+int32_t streamTransferStateToStreamTask(SStreamTask* pTask);
SStreamQueue* streamQueueOpen(int64_t cap);
void streamQueueClose(SStreamQueue* pQueue, int32_t taskId);
diff --git a/source/libs/stream/inc/streamsm.h b/source/libs/stream/inc/streamsm.h
index abdafc0240..22e1c4497b 100644
--- a/source/libs/stream/inc/streamsm.h
+++ b/source/libs/stream/inc/streamsm.h
@@ -56,13 +56,6 @@ struct SStreamTaskSM {
SArray* pWaitingEventList;
};
-typedef struct SStreamEventInfo {
- EStreamTaskEvent event;
- const char* name;
-} SStreamEventInfo;
-
-// SStreamTaskSM* streamCreateStateMachine(SStreamTask* pTask);
-// void* streamDestroyStateMachine(SStreamTaskSM* pSM);
#ifdef __cplusplus
}
#endif
diff --git a/source/libs/stream/src/streamBackendRocksdb.c b/source/libs/stream/src/streamBackendRocksdb.c
index bcf289a019..acec9b7da9 100644
--- a/source/libs/stream/src/streamBackendRocksdb.c
+++ b/source/libs/stream/src/streamBackendRocksdb.c
@@ -1768,8 +1768,8 @@ void taskDbInitOpt(STaskDbWrapper* pTaskDb) {
rocksdb_options_set_recycle_log_file_num(opts, 6);
rocksdb_options_set_max_write_buffer_number(opts, 3);
rocksdb_options_set_info_log_level(opts, 1);
- rocksdb_options_set_db_write_buffer_size(opts, 64 << 20);
- rocksdb_options_set_write_buffer_size(opts, 32 << 20);
+ rocksdb_options_set_db_write_buffer_size(opts, 256 << 20);
+ rocksdb_options_set_write_buffer_size(opts, 128 << 20);
rocksdb_options_set_atomic_flush(opts, 1);
pTaskDb->dbOpt = opts;
@@ -1780,6 +1780,7 @@ void taskDbInitOpt(STaskDbWrapper* pTaskDb) {
rocksdb_options_set_compaction_filter_factory(pTaskDb->dbOpt, pTaskDb->filterFactory);
pTaskDb->readOpt = rocksdb_readoptions_create();
pTaskDb->writeOpt = rocksdb_writeoptions_create();
+ rocksdb_writeoptions_disable_WAL(pTaskDb->writeOpt, 1);
size_t nCf = sizeof(ginitDict) / sizeof(ginitDict[0]);
pTaskDb->pCf = taosMemoryCalloc(nCf, sizeof(rocksdb_column_family_handle_t*));
diff --git a/source/libs/stream/src/streamCheckpoint.c b/source/libs/stream/src/streamCheckpoint.c
index eb50efadeb..50a010d779 100644
--- a/source/libs/stream/src/streamCheckpoint.c
+++ b/source/libs/stream/src/streamCheckpoint.c
@@ -36,6 +36,7 @@ int32_t tEncodeStreamCheckpointSourceReq(SEncoder* pEncoder, const SStreamCheckp
if (tEncodeI32(pEncoder, pReq->mnodeId) < 0) return -1;
if (tEncodeI64(pEncoder, pReq->expireTime) < 0) return -1;
if (tEncodeI32(pEncoder, pReq->transId) < 0) return -1;
+ if (tEncodeI8(pEncoder, pReq->mndTrigger) < 0) return -1;
tEndEncode(pEncoder);
return pEncoder->pos;
}
@@ -50,6 +51,7 @@ int32_t tDecodeStreamCheckpointSourceReq(SDecoder* pDecoder, SStreamCheckpointSo
if (tDecodeI32(pDecoder, &pReq->mnodeId) < 0) return -1;
if (tDecodeI64(pDecoder, &pReq->expireTime) < 0) return -1;
if (tDecodeI32(pDecoder, &pReq->transId) < 0) return -1;
+ if (tDecodeI8(pDecoder, &pReq->mndTrigger) < 0) return -1;
tEndDecode(pDecoder);
return 0;
}
@@ -151,7 +153,8 @@ int32_t streamProcessCheckpointSourceReq(SStreamTask* pTask, SStreamCheckpointSo
// todo this status may not be set here.
// 1. set task status to be prepared for check point, no data are allowed to put into inputQ.
- streamTaskHandleEvent(pTask->status.pSM, TASK_EVENT_GEN_CHECKPOINT);
+ int32_t code = streamTaskHandleEvent(pTask->status.pSM, TASK_EVENT_GEN_CHECKPOINT);
+ ASSERT(code == TSDB_CODE_SUCCESS);
pTask->chkInfo.transId = pReq->transId;
pTask->chkInfo.checkpointingId = pReq->checkpointId;
@@ -160,8 +163,7 @@ int32_t streamProcessCheckpointSourceReq(SStreamTask* pTask, SStreamCheckpointSo
pTask->execInfo.checkpoint += 1;
// 2. Put the checkpoint block into inputQ, to make sure all blocks with less version have been handled by this task
- int32_t code = appendCheckpointIntoInputQ(pTask, STREAM_INPUT__CHECKPOINT_TRIGGER);
- return code;
+ return appendCheckpointIntoInputQ(pTask, STREAM_INPUT__CHECKPOINT_TRIGGER);
}
static int32_t continueDispatchCheckpointBlock(SStreamDataBlock* pBlock, SStreamTask* pTask) {
@@ -315,8 +317,9 @@ int32_t streamSaveTaskCheckpointInfo(SStreamTask* p, int64_t checkpointId) {
pCKInfo->checkpointVer = pCKInfo->processedVer;
streamTaskClearCheckInfo(p, false);
- code = streamTaskHandleEvent(p->status.pSM, TASK_EVENT_CHECKPOINT_DONE);
taosThreadMutexUnlock(&p->lock);
+
+ code = streamTaskHandleEvent(p->status.pSM, TASK_EVENT_CHECKPOINT_DONE);
} else {
stDebug("s-task:%s vgId:%d status:%s not keep the checkpoint metaInfo, checkpoint:%" PRId64 " failed", id, vgId,
pStatus->name, pCKInfo->checkpointingId);
@@ -459,6 +462,7 @@ int32_t streamTaskBuildCheckpoint(SStreamTask* pTask) {
int64_t startTs = pTask->chkInfo.startTs;
int64_t ckId = pTask->chkInfo.checkpointingId;
const char* id = pTask->id.idStr;
+ bool dropRelHTask = (streamTaskGetPrevStatus(pTask) == TASK_STATUS__HALT);
// sink task do not need to save the status, and generated the checkpoint
if (pTask->info.taskLevel != TASK_LEVEL__SINK) {
@@ -497,6 +501,21 @@ int32_t streamTaskBuildCheckpoint(SStreamTask* pTask) {
}
}
+ if ((code == TSDB_CODE_SUCCESS) && dropRelHTask) {
+ // transferred from the halt status, it is done the fill-history procedure and finish with the checkpoint
+ // free it and remove fill-history task from disk meta-store
+ taosThreadMutexLock(&pTask->lock);
+ if (HAS_RELATED_FILLHISTORY_TASK(pTask)) {
+ SStreamTaskId hTaskId = {.streamId = pTask->hTaskInfo.id.streamId, .taskId = pTask->hTaskInfo.id.taskId};
+
+ stDebug("s-task:%s fill-history finish checkpoint done, drop related fill-history task:0x%x", id, hTaskId.taskId);
+ streamBuildAndSendDropTaskMsg(pTask->pMsgCb, pTask->pMeta->vgId, &hTaskId);
+ } else {
+ stWarn("s-task:%s related fill-history task:0x%x is erased", id, (int32_t)pTask->hTaskInfo.id.taskId);
+ }
+ taosThreadMutexUnlock(&pTask->lock);
+ }
+
// clear the checkpoint info if failed
if (code != TSDB_CODE_SUCCESS) {
taosThreadMutexLock(&pTask->lock);
diff --git a/source/libs/stream/src/streamDispatch.c b/source/libs/stream/src/streamDispatch.c
index 62b18f970e..98d9a29c87 100644
--- a/source/libs/stream/src/streamDispatch.c
+++ b/source/libs/stream/src/streamDispatch.c
@@ -34,9 +34,6 @@ static int32_t doSendDispatchMsg(SStreamTask* pTask, const SStreamDispatchReq* p
static int32_t streamAddBlockIntoDispatchMsg(const SSDataBlock* pBlock, SStreamDispatchReq* pReq);
static int32_t streamSearchAndAddBlock(SStreamTask* pTask, SStreamDispatchReq* pReqs, SSDataBlock* pDataBlock,
int32_t vgSz, int64_t groupId);
-static int32_t doDispatchScanHistoryFinishMsg(SStreamTask* pTask, const SStreamScanHistoryFinishReq* pReq, int32_t vgId,
- SEpSet* pEpSet);
-
static int32_t tInitStreamDispatchReq(SStreamDispatchReq* pReq, const SStreamTask* pTask, int32_t vgId,
int32_t numOfBlocks, int64_t dstTaskId, int32_t type);
@@ -698,41 +695,6 @@ int32_t streamDispatchStreamBlock(SStreamTask* pTask) {
return TSDB_CODE_SUCCESS;
}
-int32_t streamDispatchScanHistoryFinishMsg(SStreamTask* pTask) {
- SStreamScanHistoryFinishReq req = {
- .streamId = pTask->id.streamId,
- .childId = pTask->info.selfChildId,
- .upstreamTaskId = pTask->id.taskId,
- .upstreamNodeId = pTask->pMeta->vgId,
- };
-
- // serialize
- if (pTask->outputInfo.type == TASK_OUTPUT__FIXED_DISPATCH) {
- req.downstreamTaskId = pTask->outputInfo.fixedDispatcher.taskId;
- pTask->notReadyTasks = 1;
- doDispatchScanHistoryFinishMsg(pTask, &req, pTask->outputInfo.fixedDispatcher.nodeId,
- &pTask->outputInfo.fixedDispatcher.epSet);
- } else if (pTask->outputInfo.type == TASK_OUTPUT__SHUFFLE_DISPATCH) {
- SArray* vgInfo = pTask->outputInfo.shuffleDispatcher.dbInfo.pVgroupInfos;
- int32_t numOfVgs = taosArrayGetSize(vgInfo);
- pTask->notReadyTasks = numOfVgs;
-
- SStreamTaskState* pState = streamTaskGetStatus(pTask);
- stDebug("s-task:%s send scan-history data complete msg to downstream (shuffle-dispatch) %d tasks, status:%s",
- pTask->id.idStr, numOfVgs, pState->name);
- for (int32_t i = 0; i < numOfVgs; i++) {
- SVgroupInfo* pVgInfo = taosArrayGet(vgInfo, i);
- req.downstreamTaskId = pVgInfo->taskId;
- doDispatchScanHistoryFinishMsg(pTask, &req, pVgInfo->vgId, &pVgInfo->epSet);
- }
- } else {
- stDebug("s-task:%s no downstream tasks, invoke scan-history finish rsp directly", pTask->id.idStr);
- streamProcessScanHistoryFinishRsp(pTask);
- }
-
- return 0;
-}
-
// this function is usually invoked by sink/agg task
int32_t streamTaskSendCheckpointReadyMsg(SStreamTask* pTask) {
int32_t num = taosArrayGetSize(pTask->pReadyMsgList);
@@ -804,48 +766,6 @@ int32_t streamAddBlockIntoDispatchMsg(const SSDataBlock* pBlock, SStreamDispatch
return 0;
}
-int32_t doDispatchScanHistoryFinishMsg(SStreamTask* pTask, const SStreamScanHistoryFinishReq* pReq, int32_t vgId,
- SEpSet* pEpSet) {
- void* buf = NULL;
- int32_t code = -1;
- SRpcMsg msg = {0};
-
- int32_t tlen;
- tEncodeSize(tEncodeStreamScanHistoryFinishReq, pReq, tlen, code);
- if (code < 0) {
- return -1;
- }
-
- buf = rpcMallocCont(sizeof(SMsgHead) + tlen);
- if (buf == NULL) {
- terrno = TSDB_CODE_OUT_OF_MEMORY;
- return -1;
- }
-
- ((SMsgHead*)buf)->vgId = htonl(vgId);
- void* abuf = POINTER_SHIFT(buf, sizeof(SMsgHead));
-
- SEncoder encoder;
- tEncoderInit(&encoder, abuf, tlen);
- if ((code = tEncodeStreamScanHistoryFinishReq(&encoder, pReq)) < 0) {
- if (buf) {
- rpcFreeCont(buf);
- }
- return code;
- }
-
- tEncoderClear(&encoder);
-
- initRpcMsg(&msg, TDMT_VND_STREAM_SCAN_HISTORY_FINISH, buf, tlen + sizeof(SMsgHead));
-
- tmsgSendReq(pEpSet, &msg);
-
- SStreamTaskState* pState = streamTaskGetStatus(pTask);
- stDebug("s-task:%s status:%s dispatch scan-history finish msg to taskId:0x%x (vgId:%d)", pTask->id.idStr, pState->name,
- pReq->downstreamTaskId, vgId);
- return 0;
-}
-
int32_t doSendDispatchMsg(SStreamTask* pTask, const SStreamDispatchReq* pReq, int32_t vgId, SEpSet* pEpSet) {
void* buf = NULL;
int32_t code = -1;
@@ -1011,109 +931,6 @@ void streamClearChkptReadyMsg(SStreamTask* pTask) {
taosArrayClear(pTask->pReadyMsgList);
}
-int32_t tEncodeCompleteHistoryDataMsg(SEncoder* pEncoder, const SStreamCompleteHistoryMsg* pReq) {
- if (tStartEncode(pEncoder) < 0) return -1;
- if (tEncodeI64(pEncoder, pReq->streamId) < 0) return -1;
- if (tEncodeI32(pEncoder, pReq->downstreamId) < 0) return -1;
- if (tEncodeI32(pEncoder, pReq->downstreamNode) < 0) return -1;
- if (tEncodeI32(pEncoder, pReq->upstreamTaskId) < 0) return -1;
- if (tEncodeI32(pEncoder, pReq->upstreamNodeId) < 0) return -1;
- tEndEncode(pEncoder);
- return pEncoder->pos;
-}
-
-int32_t tDecodeCompleteHistoryDataMsg(SDecoder* pDecoder, SStreamCompleteHistoryMsg* pRsp) {
- if (tStartDecode(pDecoder) < 0) return -1;
- if (tDecodeI64(pDecoder, &pRsp->streamId) < 0) return -1;
- if (tDecodeI32(pDecoder, &pRsp->downstreamId) < 0) return -1;
- if (tDecodeI32(pDecoder, &pRsp->downstreamNode) < 0) return -1;
- if (tDecodeI32(pDecoder, &pRsp->upstreamTaskId) < 0) return -1;
- if (tDecodeI32(pDecoder, &pRsp->upstreamNodeId) < 0) return -1;
- tEndDecode(pDecoder);
- return 0;
-}
-
-int32_t streamTaskBuildScanhistoryRspMsg(SStreamTask* pTask, SStreamScanHistoryFinishReq* pReq, void** pBuffer,
- int32_t* pLen) {
- int32_t len = 0;
- int32_t code = 0;
- SEncoder encoder;
-
- SStreamCompleteHistoryMsg msg = {
- .streamId = pReq->streamId,
- .upstreamTaskId = pReq->upstreamTaskId,
- .upstreamNodeId = pReq->upstreamNodeId,
- .downstreamId = pReq->downstreamTaskId,
- .downstreamNode = pTask->pMeta->vgId,
- };
-
- tEncodeSize(tEncodeCompleteHistoryDataMsg, &msg, len, code);
- if (code < 0) {
- return code;
- }
-
- void* pBuf = rpcMallocCont(sizeof(SMsgHead) + len);
- if (pBuf == NULL) {
- return TSDB_CODE_OUT_OF_MEMORY;
- }
-
- ((SMsgHead*)pBuf)->vgId = htonl(pReq->upstreamNodeId);
-
- void* abuf = POINTER_SHIFT(pBuf, sizeof(SMsgHead));
-
- tEncoderInit(&encoder, (uint8_t*)abuf, len);
- tEncodeCompleteHistoryDataMsg(&encoder, &msg);
- tEncoderClear(&encoder);
-
- *pBuffer = pBuf;
- *pLen = len;
- return 0;
-}
-
-int32_t streamAddEndScanHistoryMsg(SStreamTask* pTask, SRpcHandleInfo* pRpcInfo, SStreamScanHistoryFinishReq* pReq) {
- void* pBuf = NULL;
- int32_t len = 0;
-
- streamTaskBuildScanhistoryRspMsg(pTask, pReq, &pBuf, &len);
- SStreamChildEpInfo* pInfo = streamTaskGetUpstreamTaskEpInfo(pTask, pReq->upstreamTaskId);
-
- SStreamContinueExecInfo info = {.taskId = pReq->upstreamTaskId, .epset = pInfo->epSet};
- initRpcMsg(&info.msg, 0, pBuf, sizeof(SMsgHead) + len);
- info.msg.info = *pRpcInfo;
-
- taosThreadMutexLock(&pTask->lock);
-
- if (pTask->pRspMsgList == NULL) {
- pTask->pRspMsgList = taosArrayInit(4, sizeof(SStreamContinueExecInfo));
- }
- taosArrayPush(pTask->pRspMsgList, &info);
- taosThreadMutexUnlock(&pTask->lock);
-
- int32_t num = taosArrayGetSize(pTask->pRspMsgList);
- stDebug("s-task:%s add scan-history finish rsp msg for task:0x%x, total:%d", pTask->id.idStr, pReq->upstreamTaskId,
- num);
- return TSDB_CODE_SUCCESS;
-}
-
-int32_t streamNotifyUpstreamContinue(SStreamTask* pTask) {
- ASSERT(pTask->info.taskLevel == TASK_LEVEL__AGG || pTask->info.taskLevel == TASK_LEVEL__SINK);
-
- const char* id = pTask->id.idStr;
- int32_t level = pTask->info.taskLevel;
-
- int32_t num = taosArrayGetSize(pTask->pRspMsgList);
- for (int32_t i = 0; i < num; ++i) {
- SStreamContinueExecInfo* pInfo = taosArrayGet(pTask->pRspMsgList, i);
- tmsgSendRsp(&pInfo->msg);
-
- stDebug("s-task:%s level:%d notify upstream:0x%x continuing handle data in WAL", id, level, pInfo->taskId);
- }
-
- taosArrayClear(pTask->pRspMsgList);
- stDebug("s-task:%s level:%d continue process msg sent to all %d upstreams", id, level, num);
- return 0;
-}
-
// this message has been sent successfully, let's try next one.
static int32_t handleDispatchSuccessRsp(SStreamTask* pTask, int32_t downstreamId) {
stDebug("s-task:%s destroy dispatch msg:%p", pTask->id.idStr, pTask->msgInfo.pData);
diff --git a/source/libs/stream/src/streamExec.c b/source/libs/stream/src/streamExec.c
index cc88a33638..748da3ec4f 100644
--- a/source/libs/stream/src/streamExec.c
+++ b/source/libs/stream/src/streamExec.c
@@ -340,7 +340,7 @@ int32_t streamDoTransferStateToStreamTask(SStreamTask* pTask) {
} else {
double el = (taosGetTimestampMs() - pTask->execInfo.step2Start) / 1000.;
stDebug(
- "s-task:%s fill-history task end, scal wal elapsed time:%.2fSec,update related stream task:%s info, transfer "
+ "s-task:%s fill-history task end, scan wal elapsed time:%.2fSec,update related stream task:%s info, transfer "
"exec state",
id, el, pStreamTask->id.idStr);
}
@@ -380,56 +380,35 @@ int32_t streamDoTransferStateToStreamTask(SStreamTask* pTask) {
return TSDB_CODE_STREAM_TASK_IVLD_STATUS;
}
+ // 1. expand the query time window for stream task of WAL scanner
if (pStreamTask->info.taskLevel == TASK_LEVEL__SOURCE) {
// update the scan data range for source task.
stDebug("s-task:%s level:%d stream task window %" PRId64 " - %" PRId64 " update to %" PRId64 " - %" PRId64
", status:%s, sched-status:%d",
pStreamTask->id.idStr, TASK_LEVEL__SOURCE, pTimeWindow->skey, pTimeWindow->ekey, INT64_MIN,
pTimeWindow->ekey, p, pStreamTask->status.schedStatus);
- } else {
- stDebug("s-task:%s no need to update time window for non-source task", pStreamTask->id.idStr);
- }
- // 1. expand the query time window for stream task of WAL scanner
- if (pStreamTask->info.taskLevel == TASK_LEVEL__SOURCE) {
pTimeWindow->skey = INT64_MIN;
qStreamInfoResetTimewindowFilter(pStreamTask->exec.pExecutor);
+ stDebug("s-task:%s after exceed the threshold:%" PRId64 " and then update the window filter",
+ pStreamTask->id.idStr, pStreamTask->dataRange.range.maxVer);
} else {
- stDebug("s-task:%s non-source task no need to reset filter window", pStreamTask->id.idStr);
+ stDebug("s-task:%s no need to update/reset filter time window for non-source tasks", pStreamTask->id.idStr);
}
// 2. transfer the ownership of executor state
streamTaskReleaseState(pTask);
streamTaskReloadState(pStreamTask);
- // 3. resume the state of stream task, after this function, the stream task will run immediately.
- streamTaskResume(pStreamTask);
+ // 3. send msg to mnode to launch a checkpoint to keep the state for current stream
+ streamTaskSendCheckpointReq(pStreamTask);
- stDebug("s-task:%s fill-history task set status to be dropping, save the state into disk", id);
-
- // 4. free it and remove fill-history task from disk meta-store
- streamBuildAndSendDropTaskMsg(pTask->pMsgCb, pMeta->vgId, &pTask->id);
-
- // 5. assign the status to the value that will be kept in disk
+ // 4. assign the status to the value that will be kept in disk
pStreamTask->status.taskStatus = streamTaskGetStatus(pStreamTask)->state;
- // 6. open the inputQ for all upstream tasks
+ // 5. open the inputQ for all upstream tasks
streamTaskOpenAllUpstreamInput(pStreamTask);
- // 7. add empty delete block
- if ((pStreamTask->info.taskLevel == TASK_LEVEL__SOURCE) && taosQueueEmpty(pStreamTask->inputq.queue->pQueue)) {
- SStreamRefDataBlock* pItem = taosAllocateQitem(sizeof(SStreamRefDataBlock), DEF_QITEM, 0);
-
- SSDataBlock* pDelBlock = createSpecialDataBlock(STREAM_DELETE_DATA);
- pDelBlock->info.rows = 0;
- pDelBlock->info.version = 0;
- pItem->type = STREAM_INPUT__REF_DATA_BLOCK;
- pItem->pBlock = pDelBlock;
- int32_t code = streamTaskPutDataIntoInputQ(pStreamTask, (SStreamQueueItem*)pItem);
- stDebug("s-task:%s append dummy delete block,res:%d", pStreamTask->id.idStr, code);
- }
-
- streamSchedExec(pStreamTask);
streamMetaReleaseTask(pMeta, pStreamTask);
return TSDB_CODE_SUCCESS;
}
@@ -447,14 +426,24 @@ int32_t streamTransferStateToStreamTask(SStreamTask* pTask) {
if (level == TASK_LEVEL__AGG || level == TASK_LEVEL__SOURCE) { // do transfer task operator states.
code = streamDoTransferStateToStreamTask(pTask);
- } else { // drop fill-history task and open inputQ of sink task
+ } else { // no state transfer for sink tasks, and drop fill-history task, followed by opening inputQ of sink task.
SStreamTask* pStreamTask = streamMetaAcquireTask(pMeta, pTask->streamTaskId.streamId, pTask->streamTaskId.taskId);
if (pStreamTask != NULL) {
+ // halt the related stream sink task
+ code = streamTaskHandleEvent(pStreamTask->status.pSM, TASK_EVENT_HALT);
+ if (code != TSDB_CODE_SUCCESS) {
+ stError("s-task:%s halt stream task:%s failed, code:%s not transfer state to stream task", pTask->id.idStr,
+ pStreamTask->id.idStr, tstrerror(code));
+ streamMetaReleaseTask(pMeta, pStreamTask);
+ return code;
+ } else {
+ stDebug("s-task:%s halt by related fill-history task:%s", pStreamTask->id.idStr, pTask->id.idStr);
+ }
+
streamTaskOpenAllUpstreamInput(pStreamTask);
+ streamTaskSendCheckpointReq(pStreamTask);
streamMetaReleaseTask(pMeta, pStreamTask);
}
-
- streamBuildAndSendDropTaskMsg(pTask->pMsgCb, pMeta->vgId, &pTask->id);
}
return code;
@@ -718,7 +707,8 @@ bool streamTaskReadyToRun(const SStreamTask* pTask, char** pStatus) {
return (st == TASK_STATUS__READY || st == TASK_STATUS__SCAN_HISTORY || st == TASK_STATUS__CK ||
st == TASK_STATUS__PAUSE || st == TASK_STATUS__HALT);
} else {
- return (st == TASK_STATUS__READY || st == TASK_STATUS__SCAN_HISTORY || st == TASK_STATUS__CK);
+ return (st == TASK_STATUS__READY || st == TASK_STATUS__SCAN_HISTORY || st == TASK_STATUS__CK ||
+ st == TASK_STATUS__HALT);
}
}
@@ -771,8 +761,7 @@ static int32_t schedTaskInFuture(SStreamTask* pTask) {
pTask->status.schedIdleTime, ref);
// add one ref count for task
- // todo this may be failed, and add ref may be failed.
- SStreamTask* pAddRefTask = streamMetaAcquireTask(pTask->pMeta, pTask->id.streamId, pTask->id.taskId);
+ /*SStreamTask* pAddRefTask = */streamMetaAcquireOneTask(pTask);
if (pTask->schedInfo.pIdleTimer == NULL) {
pTask->schedInfo.pIdleTimer = taosTmrStart(doStreamExecTaskHelper, pTask->status.schedIdleTime, pTask, streamTimer);
@@ -788,29 +777,31 @@ int32_t streamResumeTask(SStreamTask* pTask) {
const char* id = pTask->id.idStr;
while (1) {
- /*int32_t code = */doStreamExecTask(pTask);
+ /*int32_t code = */ doStreamExecTask(pTask);
+
+ // check if continue
taosThreadMutexLock(&pTask->lock);
- // check if this task needs to be idle for a while
- if (pTask->status.schedIdleTime > 0) {
- schedTaskInFuture(pTask);
-
+ int32_t numOfItems = streamQueueGetNumOfItems(pTask->inputq.queue);
+ if ((numOfItems == 0) || streamTaskShouldStop(pTask) || streamTaskShouldPause(pTask)) {
+ atomic_store_8(&pTask->status.schedStatus, TASK_SCHED_STATUS__INACTIVE);
+ clearTaskSchedInfo(pTask);
taosThreadMutexUnlock(&pTask->lock);
+
setLastExecTs(pTask, taosGetTimestampMs());
+
+ char* p = streamTaskGetStatus(pTask)->name;
+ stDebug("s-task:%s exec completed, status:%s, sched-status:%d, lastExecTs:%" PRId64, id, p,
+ pTask->status.schedStatus, pTask->status.lastExecTs);
+
return 0;
} else {
- int32_t numOfItems = streamQueueGetNumOfItems(pTask->inputq.queue);
+ // check if this task needs to be idle for a while
+ if (pTask->status.schedIdleTime > 0) {
+ schedTaskInFuture(pTask);
- if ((numOfItems == 0) || streamTaskShouldStop(pTask) || streamTaskShouldPause(pTask)) {
- atomic_store_8(&pTask->status.schedStatus, TASK_SCHED_STATUS__INACTIVE);
taosThreadMutexUnlock(&pTask->lock);
-
setLastExecTs(pTask, taosGetTimestampMs());
-
- char* p = streamTaskGetStatus(pTask)->name;
- stDebug("s-task:%s exec completed, status:%s, sched-status:%d, lastExecTs:%" PRId64, id, p,
- pTask->status.schedStatus, pTask->status.lastExecTs);
-
return 0;
}
}
diff --git a/source/libs/stream/src/streamMeta.c b/source/libs/stream/src/streamMeta.c
index 6e35e39a0a..5e53a921b9 100644
--- a/source/libs/stream/src/streamMeta.c
+++ b/source/libs/stream/src/streamMeta.c
@@ -257,8 +257,6 @@ int32_t streamTaskSetDb(SStreamMeta* pMeta, void* arg, char* key) {
STaskDbWrapper* pBackend = *ppBackend;
pBackend->pMeta = pMeta;
-
- pTask->backendRefId = pBackend->refId;
pTask->pBackend = pBackend;
taosThreadMutexUnlock(&pMeta->backendMutex);
@@ -283,7 +281,6 @@ int32_t streamTaskSetDb(SStreamMeta* pMeta, void* arg, char* key) {
}
int64_t tref = taosAddRef(taskDbWrapperId, pBackend);
- pTask->backendRefId = tref;
pTask->pBackend = pBackend;
pBackend->refId = tref;
pBackend->pTask = pTask;
@@ -467,7 +464,6 @@ void streamMetaClear(SStreamMeta* pMeta) {
}
taosRemoveRef(streamBackendId, pMeta->streamBackendRid);
-
taosHashClear(pMeta->pTasksMap);
taosArrayClear(pMeta->pTaskList);
@@ -505,7 +501,9 @@ void streamMetaCloseImpl(void* arg) {
return;
}
+ streamMetaWLock(pMeta);
streamMetaClear(pMeta);
+ streamMetaWUnLock(pMeta);
tdbAbort(pMeta->db, pMeta->txn);
tdbTbClose(pMeta->pTaskDb);
@@ -519,7 +517,6 @@ void streamMetaCloseImpl(void* arg) {
taosHashCleanup(pMeta->pTasksMap);
taosHashCleanup(pMeta->pTaskDbUnique);
taosHashCleanup(pMeta->pUpdateTaskSet);
- // taosHashCleanup(pMeta->pTaskBackendUnique);
taosHashCleanup(pMeta->updateInfo.pTasks);
taosHashCleanup(pMeta->startInfo.pReadyTaskSet);
taosHashCleanup(pMeta->startInfo.pFailedTaskSet);
@@ -534,6 +531,8 @@ void streamMetaCloseImpl(void* arg) {
bkdMgtDestroy(pMeta->bkdChkptMgt);
pMeta->role = NODE_ROLE_UNINIT;
+ taosThreadRwlockDestroy(&pMeta->lock);
+
taosMemoryFree(pMeta);
stDebug("end to close stream meta");
}
@@ -647,6 +646,12 @@ SStreamTask* streamMetaAcquireTask(SStreamMeta* pMeta, int64_t streamId, int32_t
return p;
}
+SStreamTask* streamMetaAcquireOneTask(SStreamTask* pTask) {
+ int32_t ref = atomic_add_fetch_32(&pTask->refCnt, 1);
+ stTrace("s-task:%s acquire task, ref:%d", pTask->id.idStr, ref);
+ return pTask;
+}
+
void streamMetaReleaseTask(SStreamMeta* UNUSED_PARAM(pMeta), SStreamTask* pTask) {
int32_t ref = atomic_sub_fetch_32(&pTask->refCnt, 1);
if (ref > 0) {
@@ -724,14 +729,16 @@ int32_t streamMetaUnregisterTask(SStreamMeta* pMeta, int64_t streamId, int32_t t
pTask = *ppTask;
// it is an fill-history task, remove the related stream task's id that points to it
+ atomic_sub_fetch_32(&pMeta->numOfStreamTasks, 1);
if (pTask->info.fillHistory == 1) {
- streamTaskClearHTaskAttr(pTask);
- } else {
- atomic_sub_fetch_32(&pMeta->numOfStreamTasks, 1);
+ streamTaskClearHTaskAttr(pTask, false);
}
taosHashRemove(pMeta->pTasksMap, &id, sizeof(id));
doRemoveIdFromList(pMeta, (int32_t)taosArrayGetSize(pMeta->pTaskList), &pTask->id);
+ streamMetaRemoveTask(pMeta, &id);
+
+ streamMetaWUnLock(pMeta);
ASSERT(pTask->status.timerActive == 0);
@@ -742,13 +749,12 @@ int32_t streamMetaUnregisterTask(SStreamMeta* pMeta, int64_t streamId, int32_t t
streamMetaReleaseTask(pMeta, pTask);
}
- streamMetaRemoveTask(pMeta, &id);
streamMetaReleaseTask(pMeta, pTask);
} else {
stDebug("vgId:%d failed to find the task:0x%x, it may have been dropped already", pMeta->vgId, taskId);
+ streamMetaWUnLock(pMeta);
}
- streamMetaWUnLock(pMeta);
return 0;
}
@@ -1269,11 +1275,11 @@ void streamMetaNotifyClose(SStreamMeta* pMeta) {
// wait for the stream meta hb function stopping
if (pMeta->role == NODE_ROLE_LEADER) {
-// pMeta->pHbInfo->stopFlag = STREAM_META_WILL_STOP;
-// while (pMeta->pHbInfo->stopFlag != STREAM_META_OK_TO_STOP) {
-// taosMsleep(100);
-// stDebug("vgId:%d wait for meta to stop timer", pMeta->vgId);
-// }
+ pMeta->pHbInfo->stopFlag = STREAM_META_WILL_STOP;
+ while (pMeta->pHbInfo->stopFlag != STREAM_META_OK_TO_STOP) {
+ taosMsleep(100);
+ stDebug("vgId:%d wait for meta to stop timer", pMeta->vgId);
+ }
}
stDebug("vgId:%d start to check all tasks", vgId);
@@ -1316,7 +1322,7 @@ void streamMetaRUnLock(SStreamMeta* pMeta) {
if (code != TSDB_CODE_SUCCESS) {
stError("vgId:%d meta-runlock failed, code:%d", pMeta->vgId, code);
} else {
-// stDebug("vgId:%d meta-runlock completed", pMeta->vgId);
+// stTrace("vgId:%d meta-runlock completed", pMeta->vgId);
}
}
diff --git a/source/libs/stream/src/streamSessionState.c b/source/libs/stream/src/streamSessionState.c
index 2cb77c60dc..1f991d309f 100644
--- a/source/libs/stream/src/streamSessionState.c
+++ b/source/libs/stream/src/streamSessionState.c
@@ -90,6 +90,7 @@ SRowBuffPos* createSessionWinBuff(SStreamFileState* pFileState, SSessionKey* pKe
SRowBuffPos* pNewPos = getNewRowPosForWrite(pFileState);
memcpy(pNewPos->pKey, pKey, sizeof(SSessionKey));
pNewPos->needFree = true;
+ pNewPos->beFlushed = true;
memcpy(pNewPos->pRowBuff, p, *pVLen);
taosMemoryFree(p);
return pNewPos;
@@ -217,6 +218,7 @@ int32_t getSessionFlushedBuff(SStreamFileState* pFileState, SSessionKey* pKey, v
SRowBuffPos* pNewPos = getNewRowPosForWrite(pFileState);
memcpy(pNewPos->pKey, pKey, sizeof(SSessionKey));
pNewPos->needFree = true;
+ pNewPos->beFlushed = true;
void* pBuff = NULL;
int32_t code = streamStateSessionGet_rocksdb(getStateFileStore(pFileState), pKey, &pBuff, pVLen);
if (code != TSDB_CODE_SUCCESS) {
@@ -307,6 +309,7 @@ int32_t allocSessioncWinBuffByNextPosition(SStreamFileState* pFileState, SStream
}
pNewPos = getNewRowPosForWrite(pFileState);
pNewPos->needFree = true;
+ pNewPos->beFlushed = true;
}
_end:
@@ -482,6 +485,7 @@ int32_t sessionWinStateGetKVByCur(SStreamStateCur* pCur, SSessionKey* pKey, void
SRowBuffPos* pNewPos = getNewRowPosForWrite(pCur->pStreamFileState);
memcpy(pNewPos->pKey, pKey, sizeof(SSessionKey));
pNewPos->needFree = true;
+ pNewPos->beFlushed = true;
memcpy(pNewPos->pRowBuff, pData, *pVLen);
(*pVal) = pNewPos;
}
diff --git a/source/libs/stream/src/streamStart.c b/source/libs/stream/src/streamStart.c
index 5e1566c1e1..2f5bca8ed9 100644
--- a/source/libs/stream/src/streamStart.c
+++ b/source/libs/stream/src/streamStart.c
@@ -385,7 +385,6 @@ int32_t streamTaskOnScanhistoryTaskReady(SStreamTask* pTask) {
void doProcessDownstreamReadyRsp(SStreamTask* pTask) {
EStreamTaskEvent event = (pTask->info.fillHistory == 0) ? TASK_EVENT_INIT : TASK_EVENT_INIT_SCANHIST;
-
streamTaskOnHandleEventSuccess(pTask->status.pSM, event);
int64_t initTs = pTask->execInfo.init;
@@ -592,108 +591,6 @@ int32_t streamTaskPutTranstateIntoInputQ(SStreamTask* pTask) {
return TSDB_CODE_SUCCESS;
}
-int32_t streamAggUpstreamScanHistoryFinish(SStreamTask* pTask) {
- void* exec = pTask->exec.pExecutor;
- if (pTask->info.fillHistory && qRestoreStreamOperatorOption(exec) < 0) {
- return -1;
- }
-
- if (qStreamRecoverFinish(exec) < 0) {
- return -1;
- }
- return 0;
-}
-
-int32_t streamProcessScanHistoryFinishReq(SStreamTask* pTask, SStreamScanHistoryFinishReq* pReq,
- SRpcHandleInfo* pRpcInfo) {
- int32_t taskLevel = pTask->info.taskLevel;
- ASSERT(taskLevel == TASK_LEVEL__AGG || taskLevel == TASK_LEVEL__SINK);
-
- const char* id = pTask->id.idStr;
- SStreamTaskState* p = streamTaskGetStatus(pTask);
-
- if (p->state != TASK_STATUS__SCAN_HISTORY) {
- stError("s-task:%s not in scan-history status, status:%s return upstream:0x%x scan-history finish directly", id,
- p->name, pReq->upstreamTaskId);
-
- void* pBuf = NULL;
- int32_t len = 0;
- streamTaskBuildScanhistoryRspMsg(pTask, pReq, &pBuf, &len);
-
- SRpcMsg msg = {.info = *pRpcInfo};
- initRpcMsg(&msg, 0, pBuf, sizeof(SMsgHead) + len);
-
- tmsgSendRsp(&msg);
- stDebug("s-task:%s level:%d notify upstream:0x%x(vgId:%d) to continue process data in WAL", id, taskLevel,
- pReq->upstreamTaskId, pReq->upstreamNodeId);
- return 0;
- }
-
- // sink tasks do not send end of scan history msg to its upstream, which is agg task.
- streamAddEndScanHistoryMsg(pTask, pRpcInfo, pReq);
-
- int32_t left = atomic_sub_fetch_32(&pTask->numOfWaitingUpstream, 1);
- ASSERT(left >= 0);
-
- if (left == 0) {
- int32_t numOfTasks = taosArrayGetSize(pTask->upstreamInfo.pList);
- if (taskLevel == TASK_LEVEL__AGG) {
- stDebug(
- "s-task:%s all %d upstream tasks finish scan-history data, set param for agg task for stream data processing "
- "and send rsp to all upstream tasks",
- id, numOfTasks);
- streamAggUpstreamScanHistoryFinish(pTask);
- } else {
- stDebug("s-task:%s all %d upstream task(s) finish scan-history data, and rsp to all upstream tasks", id,
- numOfTasks);
- }
-
- // all upstream tasks have completed the scan-history task in the stream time window, let's start to extract data
- // from the WAL files, which contains the real time stream data.
- streamNotifyUpstreamContinue(pTask);
-
- // mnode will not send the pause/resume message to the sink task, so no need to enable the pause for sink tasks.
- if (taskLevel == TASK_LEVEL__AGG) {
- /*int32_t code = */ streamTaskScanHistoryDataComplete(pTask);
- } else { // for sink task, set normal
- streamTaskHandleEvent(pTask->status.pSM, TASK_EVENT_SCANHIST_DONE);
- }
- } else {
- stDebug("s-task:%s receive scan-history data finish msg from upstream:0x%x(index:%d), unfinished:%d", id,
- pReq->upstreamTaskId, pReq->childId, left);
- }
-
- return 0;
-}
-
-int32_t streamProcessScanHistoryFinishRsp(SStreamTask* pTask) {
- ETaskStatus status = streamTaskGetStatus(pTask)->state;
-
- // task restart now, not handle the scan-history finish rsp
- if (status == TASK_STATUS__UNINIT) {
- return TSDB_CODE_INVALID_MSG;
- }
-
- ASSERT(status == TASK_STATUS__SCAN_HISTORY/* || status == TASK_STATUS__STREAM_SCAN_HISTORY*/);
- SStreamMeta* pMeta = pTask->pMeta;
-
- // execute in the scan history complete call back msg, ready to process data from inputQ
- int32_t code = streamTaskHandleEvent(pTask->status.pSM, TASK_EVENT_SCANHIST_DONE);
- streamTaskSetSchedStatusInactive(pTask);
-
- streamMetaWLock(pMeta);
- streamMetaSaveTask(pMeta, pTask);
- streamMetaCommit(pMeta);
- streamMetaWUnLock(pMeta);
-
- // for source tasks, let's continue execute.
- if (pTask->info.taskLevel == TASK_LEVEL__SOURCE) {
- streamSchedExec(pTask);
- }
-
- return TSDB_CODE_SUCCESS;
-}
-
static void checkFillhistoryTaskStatus(SStreamTask* pTask, SStreamTask* pHTask) {
SDataRange* pRange = &pHTask->dataRange;
@@ -946,29 +843,6 @@ int32_t streamLaunchFillHistoryTask(SStreamTask* pTask) {
}
}
-int32_t streamTaskScanHistoryDataComplete(SStreamTask* pTask) {
- if (streamTaskGetStatus(pTask)->state == TASK_STATUS__DROPPING) {
- return 0;
- }
-
- // restore param
- int32_t code = 0;
- if (pTask->info.fillHistory) {
- code = streamRestoreParam(pTask);
- if (code < 0) {
- return -1;
- }
- }
-
- // dispatch scan-history finish req to all related downstream task
- code = streamDispatchScanHistoryFinishMsg(pTask);
- if (code < 0) {
- return -1;
- }
-
- return 0;
-}
-
int32_t streamTaskFillHistoryFinished(SStreamTask* pTask) {
void* exec = pTask->exec.pExecutor;
return qStreamInfoResetTimewindowFilter(exec);
@@ -1054,24 +928,20 @@ int32_t tDecodeStreamTaskCheckRsp(SDecoder* pDecoder, SStreamTaskCheckRsp* pRsp)
return 0;
}
-int32_t tEncodeStreamScanHistoryFinishReq(SEncoder* pEncoder, const SStreamScanHistoryFinishReq* pReq) {
+int32_t tEncodeStreamTaskCheckpointReq(SEncoder* pEncoder, const SStreamTaskCheckpointReq* pReq) {
if (tStartEncode(pEncoder) < 0) return -1;
if (tEncodeI64(pEncoder, pReq->streamId) < 0) return -1;
- if (tEncodeI32(pEncoder, pReq->upstreamTaskId) < 0) return -1;
- if (tEncodeI32(pEncoder, pReq->upstreamNodeId) < 0) return -1;
- if (tEncodeI32(pEncoder, pReq->downstreamTaskId) < 0) return -1;
- if (tEncodeI32(pEncoder, pReq->childId) < 0) return -1;
+ if (tEncodeI32(pEncoder, pReq->taskId) < 0) return -1;
+ if (tEncodeI32(pEncoder, pReq->nodeId) < 0) return -1;
tEndEncode(pEncoder);
- return pEncoder->pos;
+ return 0;
}
-int32_t tDecodeStreamScanHistoryFinishReq(SDecoder* pDecoder, SStreamScanHistoryFinishReq* pReq) {
+int32_t tDecodeStreamTaskCheckpointReq(SDecoder* pDecoder, SStreamTaskCheckpointReq* pReq) {
if (tStartDecode(pDecoder) < 0) return -1;
if (tDecodeI64(pDecoder, &pReq->streamId) < 0) return -1;
- if (tDecodeI32(pDecoder, &pReq->upstreamTaskId) < 0) return -1;
- if (tDecodeI32(pDecoder, &pReq->upstreamNodeId) < 0) return -1;
- if (tDecodeI32(pDecoder, &pReq->downstreamTaskId) < 0) return -1;
- if (tDecodeI32(pDecoder, &pReq->childId) < 0) return -1;
+ if (tDecodeI32(pDecoder, &pReq->taskId) < 0) return -1;
+ if (tDecodeI32(pDecoder, &pReq->nodeId) < 0) return -1;
tEndDecode(pDecoder);
return 0;
}
@@ -1118,4 +988,3 @@ void streamTaskSetRangeStreamCalc(SStreamTask* pTask) {
streamSetParamForStreamScannerStep2(pTask, &verRange, &win);
}
}
-
diff --git a/source/libs/stream/src/streamState.c b/source/libs/stream/src/streamState.c
index 19b7359981..e370312338 100644
--- a/source/libs/stream/src/streamState.c
+++ b/source/libs/stream/src/streamState.c
@@ -670,7 +670,6 @@ void streamStateFreeCur(SStreamStateCur* pCur) {
if (!pCur) {
return;
}
- qDebug("streamStateFreeCur");
streamStateResetCur(pCur);
taosMemoryFree(pCur);
}
@@ -698,6 +697,7 @@ int32_t streamStateSessionPut(SStreamState* pState, const SSessionKey* key, void
stDebug("===stream===save skey:%" PRId64 ", ekey:%" PRId64 ", groupId:%" PRIu64 ".code:%d", key->win.skey,
key->win.ekey, key->groupId, code);
} else {
+ pos->beFlushed = false;
code = putSessionWinResultBuff(pState->pFileState, value);
}
}
diff --git a/source/libs/stream/src/streamTask.c b/source/libs/stream/src/streamTask.c
index de448d78f0..8c50c73693 100644
--- a/source/libs/stream/src/streamTask.c
+++ b/source/libs/stream/src/streamTask.c
@@ -733,20 +733,30 @@ int8_t streamTaskSetSchedStatusInactive(SStreamTask* pTask) {
return status;
}
-int32_t streamTaskClearHTaskAttr(SStreamTask* pTask) {
- SStreamMeta* pMeta = pTask->pMeta;
+int32_t streamTaskClearHTaskAttr(SStreamTask* pTask, bool metaLock) {
+ SStreamMeta* pMeta = pTask->pMeta;
+ STaskId sTaskId = {.streamId = pTask->streamTaskId.streamId, .taskId = pTask->streamTaskId.taskId};
if (pTask->info.fillHistory == 0) {
- return TSDB_CODE_SUCCESS;
+ return 0;
}
- STaskId sTaskId = {.streamId = pTask->streamTaskId.streamId, .taskId = pTask->streamTaskId.taskId};
- SStreamTask** ppStreamTask = (SStreamTask**)taosHashGet(pMeta->pTasksMap, &sTaskId, sizeof(sTaskId));
+ if (metaLock) {
+ streamMetaWLock(pTask->pMeta);
+ }
+ SStreamTask** ppStreamTask = (SStreamTask**)taosHashGet(pMeta->pTasksMap, &sTaskId, sizeof(sTaskId));
if (ppStreamTask != NULL) {
- CLEAR_RELATED_FILLHISTORY_TASK((*ppStreamTask));
- streamMetaSaveTask(pMeta, *ppStreamTask);
stDebug("s-task:%s clear the related stream task:0x%x attr to fill-history task", pTask->id.idStr,
(int32_t)sTaskId.taskId);
+
+ taosThreadMutexLock(&(*ppStreamTask)->lock);
+ CLEAR_RELATED_FILLHISTORY_TASK((*ppStreamTask));
+ streamMetaSaveTask(pMeta, *ppStreamTask);
+ taosThreadMutexUnlock(&(*ppStreamTask)->lock);
+ }
+
+ if (metaLock) {
+ streamMetaWUnLock(pTask->pMeta);
}
return TSDB_CODE_SUCCESS;
@@ -852,3 +862,41 @@ void streamTaskResume(SStreamTask* pTask) {
bool streamTaskIsSinkTask(const SStreamTask* pTask) {
return pTask->info.taskLevel == TASK_LEVEL__SINK;
}
+
+int32_t streamTaskSendCheckpointReq(SStreamTask* pTask) {
+ int32_t code;
+ int32_t tlen = 0;
+ int32_t vgId = pTask->pMeta->vgId;
+ const char* id = pTask->id.idStr;
+
+ SStreamTaskCheckpointReq req = {.streamId = pTask->id.streamId, .taskId = pTask->id.taskId, .nodeId = vgId};
+ tEncodeSize(tEncodeStreamTaskCheckpointReq, &req, tlen, code);
+ if (code < 0) {
+ stError("s-task:%s vgId:%d encode stream task req checkpoint failed, code:%s", id, vgId, tstrerror(code));
+ return -1;
+ }
+
+ void* buf = rpcMallocCont(tlen);
+ if (buf == NULL) {
+ stError("s-task:%s vgId:%d encode stream task req checkpoint msg failed, code:%s", id, vgId,
+ tstrerror(TSDB_CODE_OUT_OF_MEMORY));
+ return -1;
+ }
+
+ SEncoder encoder;
+ tEncoderInit(&encoder, buf, tlen);
+ if ((code = tEncodeStreamTaskCheckpointReq(&encoder, &req)) < 0) {
+ rpcFreeCont(buf);
+ stError("s-task:%s vgId:%d encode stream task req checkpoint msg failed, code:%s", id, vgId, tstrerror(code));
+ return -1;
+ }
+ tEncoderClear(&encoder);
+
+ SRpcMsg msg = {.info.noResp = 1};
+ initRpcMsg(&msg, TDMT_MND_STREAM_REQ_CHKPT, buf, tlen);
+
+ stDebug("s-task:%s vgId:%d build and send task checkpoint req", id, vgId);
+
+ tmsgSendReq(&pTask->info.mnodeEpset, &msg);
+ return 0;
+}
diff --git a/source/libs/stream/src/streamTaskSm.c b/source/libs/stream/src/streamTaskSm.c
index f0dcc75c4c..1671d78ed2 100644
--- a/source/libs/stream/src/streamTaskSm.c
+++ b/source/libs/stream/src/streamTaskSm.c
@@ -31,9 +31,13 @@ SStreamTaskState StreamTaskStatusList[9] = {
{.state = TASK_STATUS__HALT, .name = "halt"},
{.state = TASK_STATUS__PAUSE, .name = "paused"},
{.state = TASK_STATUS__CK, .name = "checkpoint"},
-// {.state = TASK_STATUS__STREAM_SCAN_HISTORY, .name = "stream-scan-history"},
};
+typedef struct SStreamEventInfo {
+ EStreamTaskEvent event;
+ const char* name;
+} SStreamEventInfo;
+
SStreamEventInfo StreamTaskEventList[12] = {
{.event = 0, .name = ""}, // dummy event, place holder
{.event = TASK_EVENT_INIT, .name = "initialize"},
@@ -94,7 +98,9 @@ int32_t streamTaskSendTransSuccessMsg(SStreamTask* pTask) {
}
int32_t streamTaskKeepCurrentVerInWal(SStreamTask* pTask) {
- ASSERT(HAS_RELATED_FILLHISTORY_TASK(pTask));
+ if (!HAS_RELATED_FILLHISTORY_TASK(pTask)) {
+ stError("s-task:%s no related fill-history task, since it may have been dropped already", pTask->id.idStr);
+ }
if (pTask->info.taskLevel == TASK_LEVEL__SOURCE) {
pTask->hTaskInfo.haltVer = walReaderGetCurrentVer(pTask->exec.pWalReader);
@@ -402,6 +408,10 @@ SStreamTaskState* streamTaskGetStatus(const SStreamTask* pTask) {
return &pTask->status.pSM->current; // copy one obj in case of multi-thread environment
}
+ETaskStatus streamTaskGetPrevStatus(const SStreamTask* pTask) {
+ return pTask->status.pSM->prev.state.state;
+}
+
const char* streamTaskGetStatusStr(ETaskStatus status) {
return StreamTaskStatusList[status].name;
}
@@ -497,6 +507,8 @@ void doInitStateTransferTable(void) {
// checkpoint related event
trans = createStateTransform(TASK_STATUS__READY, TASK_STATUS__CK, TASK_EVENT_GEN_CHECKPOINT, NULL, streamTaskDoCheckpoint, NULL, true);
taosArrayPush(streamTaskSMTrans, &trans);
+ trans = createStateTransform(TASK_STATUS__HALT, TASK_STATUS__CK, TASK_EVENT_GEN_CHECKPOINT, NULL, streamTaskDoCheckpoint, NULL, true);
+ taosArrayPush(streamTaskSMTrans, &trans);
trans = createStateTransform(TASK_STATUS__CK, TASK_STATUS__READY, TASK_EVENT_CHECKPOINT_DONE, NULL, NULL, NULL, true);
taosArrayPush(streamTaskSMTrans, &trans);
diff --git a/source/libs/sync/src/syncMain.c b/source/libs/sync/src/syncMain.c
index ff6401cba8..edaf59f9db 100644
--- a/source/libs/sync/src/syncMain.c
+++ b/source/libs/sync/src/syncMain.c
@@ -36,6 +36,7 @@
#include "syncUtil.h"
#include "syncVoteMgr.h"
#include "tglobal.h"
+#include "tmisce.h"
#include "tref.h"
static void syncNodeEqPingTimer(void* param, void* tmrId);
@@ -106,7 +107,7 @@ _err:
return -1;
}
-int32_t syncNodeGetConfig(int64_t rid, SSyncCfg *cfg){
+int32_t syncNodeGetConfig(int64_t rid, SSyncCfg* cfg) {
SSyncNode* pSyncNode = syncNodeAcquire(rid);
if (pSyncNode == NULL) {
@@ -546,7 +547,7 @@ SSyncState syncGetState(int64_t rid) {
state.progress = -1;
}
sDebug("vgId:%d, learner progress state, commitIndex:%" PRId64 " totalIndex:%" PRId64 ", "
- "progress:%lf, progress:%d",
+ "progress:%lf, progress:%d",
pSyncNode->vgId,
pSyncNode->pLogBuf->commitIndex, pSyncNode->pLogBuf->totalIndex, progress, state.progress);
*/
@@ -579,17 +580,21 @@ void syncGetRetryEpSet(int64_t rid, SEpSet* pEpSet) {
SSyncNode* pSyncNode = syncNodeAcquire(rid);
if (pSyncNode == NULL) return;
+ int j = 0;
for (int32_t i = 0; i < pSyncNode->raftCfg.cfg.totalReplicaNum; ++i) {
if (pSyncNode->raftCfg.cfg.nodeInfo[i].nodeRole == TAOS_SYNC_ROLE_LEARNER) continue;
- SEp* pEp = &pEpSet->eps[i];
+ SEp* pEp = &pEpSet->eps[j];
tstrncpy(pEp->fqdn, pSyncNode->raftCfg.cfg.nodeInfo[i].nodeFqdn, TSDB_FQDN_LEN);
pEp->port = (pSyncNode->raftCfg.cfg.nodeInfo)[i].nodePort;
pEpSet->numOfEps++;
sDebug("vgId:%d, sync get retry epset, index:%d %s:%d", pSyncNode->vgId, i, pEp->fqdn, pEp->port);
+ j++;
}
if (pEpSet->numOfEps > 0) {
pEpSet->inUse = (pSyncNode->raftCfg.cfg.myIndex + 1) % pEpSet->numOfEps;
+ // pEpSet->inUse = 0;
}
+ epsetSort(pEpSet);
sInfo("vgId:%d, sync get retry epset numOfEps:%d inUse:%d", pSyncNode->vgId, pEpSet->numOfEps, pEpSet->inUse);
syncNodeRelease(pSyncNode);
@@ -614,7 +619,7 @@ int32_t syncCheckMember(int64_t rid) {
return -1;
}
- if(pSyncNode->myNodeInfo.nodeRole == TAOS_SYNC_ROLE_LEARNER){
+ if (pSyncNode->myNodeInfo.nodeRole == TAOS_SYNC_ROLE_LEARNER) {
return -1;
}
@@ -682,24 +687,24 @@ int32_t syncNodePropose(SSyncNode* pSyncNode, SRpcMsg* pMsg, bool isWeak, int64_
}
// optimized one replica
- if (syncNodeIsOptimizedOneReplica(pSyncNode, pMsg)) {
+ if (syncNodeIsOptimizedOneReplica(pSyncNode, pMsg)) {
SyncIndex retIndex;
int32_t code = syncNodeOnClientRequest(pSyncNode, pMsg, &retIndex);
if (code >= 0) {
pMsg->info.conn.applyIndex = retIndex;
pMsg->info.conn.applyTerm = raftStoreGetTerm(pSyncNode);
- //after raft member change, need to handle 1->2 switching point
- //at this point, need to switch entry handling thread
- if(pSyncNode->replicaNum == 1){
+ // after raft member change, need to handle 1->2 switching point
+ // at this point, need to switch entry handling thread
+ if (pSyncNode->replicaNum == 1) {
sTrace("vgId:%d, propose optimized msg, index:%" PRId64 " type:%s", pSyncNode->vgId, retIndex,
- TMSG_INFO(pMsg->msgType));
+ TMSG_INFO(pMsg->msgType));
return 1;
- }
- else{
- sTrace("vgId:%d, propose optimized msg, return to normal, index:%" PRId64 " type:%s, "
- "handle:%p", pSyncNode->vgId, retIndex,
- TMSG_INFO(pMsg->msgType), pMsg->info.handle);
+ } else {
+ sTrace("vgId:%d, propose optimized msg, return to normal, index:%" PRId64
+ " type:%s, "
+ "handle:%p",
+ pSyncNode->vgId, retIndex, TMSG_INFO(pMsg->msgType), pMsg->info.handle);
return 0;
}
} else {
@@ -844,7 +849,7 @@ SSyncNode* syncNodeOpen(SSyncInfo* pSyncInfo, int32_t vnodeVersion) {
goto _error;
}
- if(vnodeVersion > pSyncNode->raftCfg.cfg.changeVersion){
+ if (vnodeVersion > pSyncNode->raftCfg.cfg.changeVersion) {
if (pSyncInfo->syncCfg.totalReplicaNum > 0 && syncIsConfigChanged(&pSyncNode->raftCfg.cfg, &pSyncInfo->syncCfg)) {
sInfo("vgId:%d, use sync config from input options and write to cfg file", pSyncNode->vgId);
pSyncNode->raftCfg.cfg = pSyncInfo->syncCfg;
@@ -856,15 +861,13 @@ SSyncNode* syncNodeOpen(SSyncInfo* pSyncInfo, int32_t vnodeVersion) {
sInfo("vgId:%d, use sync config from sync cfg file", pSyncNode->vgId);
pSyncInfo->syncCfg = pSyncNode->raftCfg.cfg;
}
- }
- else{
- sInfo("vgId:%d, skip save sync cfg file since request ver:%d <= file ver:%d",
- pSyncNode->vgId, vnodeVersion, pSyncInfo->syncCfg.changeVersion);
+ } else {
+ sInfo("vgId:%d, skip save sync cfg file since request ver:%d <= file ver:%d", pSyncNode->vgId, vnodeVersion,
+ pSyncInfo->syncCfg.changeVersion);
}
}
-
- // init by SSyncInfo
+ // init by SSyncInfo
pSyncNode->vgId = pSyncInfo->vgId;
SSyncCfg* pCfg = &pSyncNode->raftCfg.cfg;
bool updated = false;
@@ -879,7 +882,7 @@ SSyncNode* syncNodeOpen(SSyncInfo* pSyncInfo, int32_t vnodeVersion) {
pNode->nodeId, pNode->clusterId);
}
- if(vnodeVersion > pSyncInfo->syncCfg.changeVersion){
+ if (vnodeVersion > pSyncInfo->syncCfg.changeVersion) {
if (updated) {
sInfo("vgId:%d, save config info since dnode info changed", pSyncNode->vgId);
if (syncWriteCfgFile(pSyncNode) != 0) {
@@ -888,7 +891,7 @@ SSyncNode* syncNodeOpen(SSyncInfo* pSyncInfo, int32_t vnodeVersion) {
}
}
}
-
+
pSyncNode->pWal = pSyncInfo->pWal;
pSyncNode->msgcb = pSyncInfo->msgcb;
pSyncNode->syncSendMSg = pSyncInfo->syncSendMSg;
@@ -2335,47 +2338,49 @@ int32_t syncCacheEntry(SSyncLogStore* pLogStore, SSyncRaftEntry* pEntry, LRUHand
return code;
}
-void syncBuildConfigFromReq(SAlterVnodeReplicaReq *pReq, SSyncCfg *cfg){//TODO SAlterVnodeReplicaReq name is proper?
+void syncBuildConfigFromReq(SAlterVnodeReplicaReq* pReq, SSyncCfg* cfg) { // TODO SAlterVnodeReplicaReq name is proper?
cfg->replicaNum = 0;
cfg->totalReplicaNum = 0;
for (int i = 0; i < pReq->replica; ++i) {
- SNodeInfo *pNode = &cfg->nodeInfo[i];
+ SNodeInfo* pNode = &cfg->nodeInfo[i];
pNode->nodeId = pReq->replicas[i].id;
pNode->nodePort = pReq->replicas[i].port;
tstrncpy(pNode->nodeFqdn, pReq->replicas[i].fqdn, sizeof(pNode->nodeFqdn));
pNode->nodeRole = TAOS_SYNC_ROLE_VOTER;
(void)tmsgUpdateDnodeInfo(&pNode->nodeId, &pNode->clusterId, pNode->nodeFqdn, &pNode->nodePort);
- sInfo("vgId:%d, replica:%d ep:%s:%u dnode:%d nodeRole:%d", pReq->vgId, i, pNode->nodeFqdn, pNode->nodePort, pNode->nodeId, pNode->nodeRole);
+ sInfo("vgId:%d, replica:%d ep:%s:%u dnode:%d nodeRole:%d", pReq->vgId, i, pNode->nodeFqdn, pNode->nodePort,
+ pNode->nodeId, pNode->nodeRole);
cfg->replicaNum++;
}
- if(pReq->selfIndex != -1){
+ if (pReq->selfIndex != -1) {
cfg->myIndex = pReq->selfIndex;
}
for (int i = cfg->replicaNum; i < pReq->replica + pReq->learnerReplica; ++i) {
- SNodeInfo *pNode = &cfg->nodeInfo[i];
+ SNodeInfo* pNode = &cfg->nodeInfo[i];
pNode->nodeId = pReq->learnerReplicas[cfg->totalReplicaNum].id;
pNode->nodePort = pReq->learnerReplicas[cfg->totalReplicaNum].port;
pNode->nodeRole = TAOS_SYNC_ROLE_LEARNER;
tstrncpy(pNode->nodeFqdn, pReq->learnerReplicas[cfg->totalReplicaNum].fqdn, sizeof(pNode->nodeFqdn));
(void)tmsgUpdateDnodeInfo(&pNode->nodeId, &pNode->clusterId, pNode->nodeFqdn, &pNode->nodePort);
- sInfo("vgId:%d, replica:%d ep:%s:%u dnode:%d nodeRole:%d", pReq->vgId, i, pNode->nodeFqdn, pNode->nodePort, pNode->nodeId, pNode->nodeRole);
+ sInfo("vgId:%d, replica:%d ep:%s:%u dnode:%d nodeRole:%d", pReq->vgId, i, pNode->nodeFqdn, pNode->nodePort,
+ pNode->nodeId, pNode->nodeRole);
cfg->totalReplicaNum++;
}
cfg->totalReplicaNum += pReq->replica;
- if(pReq->learnerSelfIndex != -1){
+ if (pReq->learnerSelfIndex != -1) {
cfg->myIndex = pReq->replica + pReq->learnerSelfIndex;
}
cfg->changeVersion = pReq->changeVersion;
}
-int32_t syncNodeCheckChangeConfig(SSyncNode* ths, SSyncRaftEntry* pEntry){
- if(pEntry->originalRpcType != TDMT_SYNC_CONFIG_CHANGE){
+int32_t syncNodeCheckChangeConfig(SSyncNode* ths, SSyncRaftEntry* pEntry) {
+ if (pEntry->originalRpcType != TDMT_SYNC_CONFIG_CHANGE) {
return -1;
}
- SMsgHead *head = (SMsgHead *)pEntry->data;
- void *pReq = POINTER_SHIFT(head, sizeof(SMsgHead));
+ SMsgHead* head = (SMsgHead*)pEntry->data;
+ void* pReq = POINTER_SHIFT(head, sizeof(SMsgHead));
SAlterVnodeTypeReq req = {0};
if (tDeserializeSAlterVnodeReplicaReq(pReq, head->contLen, &req) != 0) {
@@ -2386,17 +2391,17 @@ int32_t syncNodeCheckChangeConfig(SSyncNode* ths, SSyncRaftEntry* pEntry){
SSyncCfg cfg = {0};
syncBuildConfigFromReq(&req, &cfg);
- if(cfg.totalReplicaNum >= 1 && ths->state == TAOS_SYNC_STATE_LEADER){
+ if (cfg.totalReplicaNum >= 1 && ths->state == TAOS_SYNC_STATE_LEADER) {
bool incfg = false;
- for(int32_t j = 0; j < cfg.totalReplicaNum; ++j){
- if(strcmp(ths->myNodeInfo.nodeFqdn, cfg.nodeInfo[j].nodeFqdn) == 0
- && ths->myNodeInfo.nodePort == cfg.nodeInfo[j].nodePort){
+ for (int32_t j = 0; j < cfg.totalReplicaNum; ++j) {
+ if (strcmp(ths->myNodeInfo.nodeFqdn, cfg.nodeInfo[j].nodeFqdn) == 0 &&
+ ths->myNodeInfo.nodePort == cfg.nodeInfo[j].nodePort) {
incfg = true;
break;
}
}
- if(!incfg){
+ if (!incfg) {
SyncTerm currentTerm = raftStoreGetTerm(ths);
syncNodeStepDown(ths, currentTerm);
return 1;
@@ -2405,26 +2410,25 @@ int32_t syncNodeCheckChangeConfig(SSyncNode* ths, SSyncRaftEntry* pEntry){
return 0;
}
-void syncNodeLogConfigInfo(SSyncNode* ths, SSyncCfg *cfg, char *str){
- sInfo("vgId:%d, %s. SyncNode, replicaNum:%d, peersNum:%d, lastConfigIndex:%" PRId64 ", changeVersion:%d, "
- "restoreFinish:%d",
- ths->vgId, str,
- ths->replicaNum, ths->peersNum, ths->raftCfg.lastConfigIndex, ths->raftCfg.cfg.changeVersion,
+void syncNodeLogConfigInfo(SSyncNode* ths, SSyncCfg* cfg, char* str) {
+ sInfo("vgId:%d, %s. SyncNode, replicaNum:%d, peersNum:%d, lastConfigIndex:%" PRId64
+ ", changeVersion:%d, "
+ "restoreFinish:%d",
+ ths->vgId, str, ths->replicaNum, ths->peersNum, ths->raftCfg.lastConfigIndex, ths->raftCfg.cfg.changeVersion,
ths->restoreFinish);
- sInfo("vgId:%d, %s, myNodeInfo, clusterId:%" PRId64 ", nodeId:%d, Fqdn:%s, port:%d, role:%d",
- ths->vgId, str, ths->myNodeInfo.clusterId, ths->myNodeInfo.nodeId, ths->myNodeInfo.nodeFqdn,
- ths->myNodeInfo.nodePort, ths->myNodeInfo.nodeRole);
+ sInfo("vgId:%d, %s, myNodeInfo, clusterId:%" PRId64 ", nodeId:%d, Fqdn:%s, port:%d, role:%d", ths->vgId, str,
+ ths->myNodeInfo.clusterId, ths->myNodeInfo.nodeId, ths->myNodeInfo.nodeFqdn, ths->myNodeInfo.nodePort,
+ ths->myNodeInfo.nodeRole);
- for (int32_t i = 0; i < ths->peersNum; ++i){
- sInfo("vgId:%d, %s, peersNodeInfo%d, clusterId:%" PRId64 ", nodeId:%d, Fqdn:%s, port:%d, role:%d",
- ths->vgId, str, i, ths->peersNodeInfo[i].clusterId,
- ths->peersNodeInfo[i].nodeId, ths->peersNodeInfo[i].nodeFqdn,
- ths->peersNodeInfo[i].nodePort, ths->peersNodeInfo[i].nodeRole);
+ for (int32_t i = 0; i < ths->peersNum; ++i) {
+ sInfo("vgId:%d, %s, peersNodeInfo%d, clusterId:%" PRId64 ", nodeId:%d, Fqdn:%s, port:%d, role:%d", ths->vgId, str,
+ i, ths->peersNodeInfo[i].clusterId, ths->peersNodeInfo[i].nodeId, ths->peersNodeInfo[i].nodeFqdn,
+ ths->peersNodeInfo[i].nodePort, ths->peersNodeInfo[i].nodeRole);
}
- for (int32_t i = 0; i < ths->peersNum; ++i){
- char buf[256];
+ for (int32_t i = 0; i < ths->peersNum; ++i) {
+ char buf[256];
int32_t len = 256;
int32_t n = 0;
n += snprintf(buf + n, len - n, "%s", "{");
@@ -2434,37 +2438,33 @@ void syncNodeLogConfigInfo(SSyncNode* ths, SSyncCfg *cfg, char *str){
}
n += snprintf(buf + n, len - n, "%s", "}");
- sInfo("vgId:%d, %s, peersEpset%d, %s, inUse:%d",
- ths->vgId, str, i, buf, ths->peersEpset->inUse);
+ sInfo("vgId:%d, %s, peersEpset%d, %s, inUse:%d", ths->vgId, str, i, buf, ths->peersEpset->inUse);
}
- for (int32_t i = 0; i < ths->peersNum; ++i){
- sInfo("vgId:%d, %s, peersId%d, addr:%"PRId64,
- ths->vgId, str, i, ths->peersId[i].addr);
+ for (int32_t i = 0; i < ths->peersNum; ++i) {
+ sInfo("vgId:%d, %s, peersId%d, addr:%" PRId64, ths->vgId, str, i, ths->peersId[i].addr);
}
- for (int32_t i = 0; i < ths->raftCfg.cfg.totalReplicaNum; ++i){
- sInfo("vgId:%d, %s, nodeInfo%d, clusterId:%" PRId64 ", nodeId:%d, Fqdn:%s, port:%d, role:%d",
- ths->vgId, str, i, ths->raftCfg.cfg.nodeInfo[i].clusterId,
- ths->raftCfg.cfg.nodeInfo[i].nodeId, ths->raftCfg.cfg.nodeInfo[i].nodeFqdn,
- ths->raftCfg.cfg.nodeInfo[i].nodePort, ths->raftCfg.cfg.nodeInfo[i].nodeRole);
+ for (int32_t i = 0; i < ths->raftCfg.cfg.totalReplicaNum; ++i) {
+ sInfo("vgId:%d, %s, nodeInfo%d, clusterId:%" PRId64 ", nodeId:%d, Fqdn:%s, port:%d, role:%d", ths->vgId, str, i,
+ ths->raftCfg.cfg.nodeInfo[i].clusterId, ths->raftCfg.cfg.nodeInfo[i].nodeId,
+ ths->raftCfg.cfg.nodeInfo[i].nodeFqdn, ths->raftCfg.cfg.nodeInfo[i].nodePort,
+ ths->raftCfg.cfg.nodeInfo[i].nodeRole);
}
- for (int32_t i = 0; i < ths->raftCfg.cfg.totalReplicaNum; ++i){
- sInfo("vgId:%d, %s, replicasId%d, addr:%" PRId64,
- ths->vgId, str, i, ths->replicasId[i].addr);
+ for (int32_t i = 0; i < ths->raftCfg.cfg.totalReplicaNum; ++i) {
+ sInfo("vgId:%d, %s, replicasId%d, addr:%" PRId64, ths->vgId, str, i, ths->replicasId[i].addr);
}
-
}
-int32_t syncNodeRebuildPeerAndCfg(SSyncNode* ths, SSyncCfg *cfg){
+int32_t syncNodeRebuildPeerAndCfg(SSyncNode* ths, SSyncCfg* cfg) {
int32_t i = 0;
- //change peersNodeInfo
+ // change peersNodeInfo
i = 0;
- for(int32_t j = 0; j < cfg->totalReplicaNum; ++j){
- if(!(strcmp(ths->myNodeInfo.nodeFqdn, cfg->nodeInfo[j].nodeFqdn) == 0
- && ths->myNodeInfo.nodePort == cfg->nodeInfo[j].nodePort)){
+ for (int32_t j = 0; j < cfg->totalReplicaNum; ++j) {
+ if (!(strcmp(ths->myNodeInfo.nodeFqdn, cfg->nodeInfo[j].nodeFqdn) == 0 &&
+ ths->myNodeInfo.nodePort == cfg->nodeInfo[j].nodePort)) {
ths->peersNodeInfo[i].nodeRole = cfg->nodeInfo[j].nodeRole;
ths->peersNodeInfo[i].clusterId = cfg->nodeInfo[j].clusterId;
tstrncpy(ths->peersNodeInfo[i].nodeFqdn, cfg->nodeInfo[j].nodeFqdn, TSDB_FQDN_LEN);
@@ -2483,11 +2483,11 @@ int32_t syncNodeRebuildPeerAndCfg(SSyncNode* ths, SSyncCfg *cfg){
}
ths->peersNum = i;
- //change cfg nodeInfo
+ // change cfg nodeInfo
ths->raftCfg.cfg.replicaNum = 0;
i = 0;
- for(int32_t j = 0; j < cfg->totalReplicaNum; ++j) {
- if(cfg->nodeInfo[j].nodeRole == TAOS_SYNC_ROLE_VOTER){
+ for (int32_t j = 0; j < cfg->totalReplicaNum; ++j) {
+ if (cfg->nodeInfo[j].nodeRole == TAOS_SYNC_ROLE_VOTER) {
ths->raftCfg.cfg.replicaNum++;
}
ths->raftCfg.cfg.nodeInfo[i].nodeRole = cfg->nodeInfo[j].nodeRole;
@@ -2495,9 +2495,9 @@ int32_t syncNodeRebuildPeerAndCfg(SSyncNode* ths, SSyncCfg *cfg){
tstrncpy(ths->raftCfg.cfg.nodeInfo[i].nodeFqdn, cfg->nodeInfo[j].nodeFqdn, TSDB_FQDN_LEN);
ths->raftCfg.cfg.nodeInfo[i].nodeId = cfg->nodeInfo[j].nodeId;
ths->raftCfg.cfg.nodeInfo[i].nodePort = cfg->nodeInfo[j].nodePort;
- if((strcmp(ths->myNodeInfo.nodeFqdn, cfg->nodeInfo[j].nodeFqdn) == 0
- && ths->myNodeInfo.nodePort == cfg->nodeInfo[j].nodePort)){
- ths->raftCfg.cfg.myIndex = i;
+ if ((strcmp(ths->myNodeInfo.nodeFqdn, cfg->nodeInfo[j].nodeFqdn) == 0 &&
+ ths->myNodeInfo.nodePort == cfg->nodeInfo[j].nodePort)) {
+ ths->raftCfg.cfg.myIndex = i;
}
i++;
}
@@ -2506,26 +2506,26 @@ int32_t syncNodeRebuildPeerAndCfg(SSyncNode* ths, SSyncCfg *cfg){
return 0;
}
-void syncNodeChangePeerAndCfgToVoter(SSyncNode* ths, SSyncCfg *cfg){
- //change peersNodeInfo
+void syncNodeChangePeerAndCfgToVoter(SSyncNode* ths, SSyncCfg* cfg) {
+ // change peersNodeInfo
for (int32_t i = 0; i < ths->peersNum; ++i) {
- for(int32_t j = 0; j < cfg->totalReplicaNum; ++j){
- if(strcmp(ths->peersNodeInfo[i].nodeFqdn, cfg->nodeInfo[j].nodeFqdn) == 0
- && ths->peersNodeInfo[i].nodePort == cfg->nodeInfo[j].nodePort){
- if(cfg->nodeInfo[j].nodeRole == TAOS_SYNC_ROLE_VOTER){
+ for (int32_t j = 0; j < cfg->totalReplicaNum; ++j) {
+ if (strcmp(ths->peersNodeInfo[i].nodeFqdn, cfg->nodeInfo[j].nodeFqdn) == 0 &&
+ ths->peersNodeInfo[i].nodePort == cfg->nodeInfo[j].nodePort) {
+ if (cfg->nodeInfo[j].nodeRole == TAOS_SYNC_ROLE_VOTER) {
ths->peersNodeInfo[i].nodeRole = TAOS_SYNC_ROLE_VOTER;
}
}
}
}
- //change cfg nodeInfo
+ // change cfg nodeInfo
ths->raftCfg.cfg.replicaNum = 0;
for (int32_t i = 0; i < ths->raftCfg.cfg.totalReplicaNum; ++i) {
- for(int32_t j = 0; j < cfg->totalReplicaNum; ++j){
- if(strcmp(ths->raftCfg.cfg.nodeInfo[i].nodeFqdn, cfg->nodeInfo[j].nodeFqdn) == 0
- && ths->raftCfg.cfg.nodeInfo[i].nodePort == cfg->nodeInfo[j].nodePort){
- if(cfg->nodeInfo[j].nodeRole == TAOS_SYNC_ROLE_VOTER){
+ for (int32_t j = 0; j < cfg->totalReplicaNum; ++j) {
+ if (strcmp(ths->raftCfg.cfg.nodeInfo[i].nodeFqdn, cfg->nodeInfo[j].nodeFqdn) == 0 &&
+ ths->raftCfg.cfg.nodeInfo[i].nodePort == cfg->nodeInfo[j].nodePort) {
+ if (cfg->nodeInfo[j].nodeRole == TAOS_SYNC_ROLE_VOTER) {
ths->raftCfg.cfg.nodeInfo[i].nodeRole = TAOS_SYNC_ROLE_VOTER;
ths->raftCfg.cfg.replicaNum++;
}
@@ -2534,8 +2534,8 @@ void syncNodeChangePeerAndCfgToVoter(SSyncNode* ths, SSyncCfg *cfg){
}
}
-int32_t syncNodeRebuildAndCopyIfExist(SSyncNode* ths, int32_t oldtotalReplicaNum){
- //1.rebuild replicasId, remove deleted one
+int32_t syncNodeRebuildAndCopyIfExist(SSyncNode* ths, int32_t oldtotalReplicaNum) {
+ // 1.rebuild replicasId, remove deleted one
SRaftId oldReplicasId[TSDB_MAX_REPLICA + TSDB_MAX_LEARNER_REPLICA];
memcpy(oldReplicasId, ths->replicasId, sizeof(oldReplicasId));
@@ -2545,9 +2545,8 @@ int32_t syncNodeRebuildAndCopyIfExist(SSyncNode* ths, int32_t oldtotalReplicaNum
syncUtilNodeInfo2RaftId(&ths->raftCfg.cfg.nodeInfo[i], ths->vgId, &ths->replicasId[i]);
}
-
- //2.rebuild MatchIndex, remove deleted one
- SSyncIndexMgr *oldIndex = ths->pMatchIndex;
+ // 2.rebuild MatchIndex, remove deleted one
+ SSyncIndexMgr* oldIndex = ths->pMatchIndex;
ths->pMatchIndex = syncIndexMgrCreate(ths);
@@ -2555,9 +2554,8 @@ int32_t syncNodeRebuildAndCopyIfExist(SSyncNode* ths, int32_t oldtotalReplicaNum
syncIndexMgrDestroy(oldIndex);
-
- //3.rebuild NextIndex, remove deleted one
- SSyncIndexMgr *oldNextIndex = ths->pNextIndex;
+ // 3.rebuild NextIndex, remove deleted one
+ SSyncIndexMgr* oldNextIndex = ths->pNextIndex;
ths->pNextIndex = syncIndexMgrCreate(ths);
@@ -2565,17 +2563,15 @@ int32_t syncNodeRebuildAndCopyIfExist(SSyncNode* ths, int32_t oldtotalReplicaNum
syncIndexMgrDestroy(oldNextIndex);
-
- //4.rebuild pVotesGranted, pVotesRespond, no need to keep old vote state, only rebuild
+ // 4.rebuild pVotesGranted, pVotesRespond, no need to keep old vote state, only rebuild
voteGrantedUpdate(ths->pVotesGranted, ths);
votesRespondUpdate(ths->pVotesRespond, ths);
-
- //5.rebuild logReplMgr
- for(int i = 0; i < oldtotalReplicaNum; ++i){
- sDebug("vgId:%d, old logReplMgrs i:%d, peerId:%d, restoreed:%d, [%" PRId64 " %" PRId64 ", %" PRId64 ")", ths->vgId, i,
- ths->logReplMgrs[i]->peerId, ths->logReplMgrs[i]->restored, ths->logReplMgrs[i]->startIndex,
- ths->logReplMgrs[i]->matchIndex, ths->logReplMgrs[i]->endIndex);
+ // 5.rebuild logReplMgr
+ for (int i = 0; i < oldtotalReplicaNum; ++i) {
+ sDebug("vgId:%d, old logReplMgrs i:%d, peerId:%d, restoreed:%d, [%" PRId64 " %" PRId64 ", %" PRId64 ")", ths->vgId,
+ i, ths->logReplMgrs[i]->peerId, ths->logReplMgrs[i]->restored, ths->logReplMgrs[i]->startIndex,
+ ths->logReplMgrs[i]->matchIndex, ths->logReplMgrs[i]->endIndex);
}
SSyncLogReplMgr* oldLogReplMgrs = NULL;
@@ -2584,32 +2580,32 @@ int32_t syncNodeRebuildAndCopyIfExist(SSyncNode* ths, int32_t oldtotalReplicaNum
if (NULL == oldLogReplMgrs) return -1;
memset(oldLogReplMgrs, 0, length);
- for(int i = 0; i < oldtotalReplicaNum; i++){
+ for (int i = 0; i < oldtotalReplicaNum; i++) {
oldLogReplMgrs[i] = *(ths->logReplMgrs[i]);
}
syncNodeLogReplDestroy(ths);
syncNodeLogReplInit(ths);
- for(int i = 0; i < ths->totalReplicaNum; ++i){
- for(int j = 0; j < oldtotalReplicaNum; j++){
+ for (int i = 0; i < ths->totalReplicaNum; ++i) {
+ for (int j = 0; j < oldtotalReplicaNum; j++) {
if (syncUtilSameId(&ths->replicasId[i], &oldReplicasId[j])) {
*(ths->logReplMgrs[i]) = oldLogReplMgrs[j];
ths->logReplMgrs[i]->peerId = i;
}
- }
- }
-
- for(int i = 0; i < ths->totalReplicaNum; ++i){
- sDebug("vgId:%d, new logReplMgrs i:%d, peerId:%d, restoreed:%d, [%" PRId64 " %" PRId64 ", %" PRId64 ")" , ths->vgId, i,
- ths->logReplMgrs[i]->peerId, ths->logReplMgrs[i]->restored, ths->logReplMgrs[i]->startIndex,
- ths->logReplMgrs[i]->matchIndex, ths->logReplMgrs[i]->endIndex);
+ }
}
- //6.rebuild sender
- for(int i = 0; i < oldtotalReplicaNum; ++i){
- sDebug("vgId:%d, old sender i:%d, replicaIndex:%d, lastSendTime:%" PRId64,
- ths->vgId, i, ths->senders[i]->replicaIndex, ths->senders[i]->lastSendTime)
+ for (int i = 0; i < ths->totalReplicaNum; ++i) {
+ sDebug("vgId:%d, new logReplMgrs i:%d, peerId:%d, restoreed:%d, [%" PRId64 " %" PRId64 ", %" PRId64 ")", ths->vgId,
+ i, ths->logReplMgrs[i]->peerId, ths->logReplMgrs[i]->restored, ths->logReplMgrs[i]->startIndex,
+ ths->logReplMgrs[i]->matchIndex, ths->logReplMgrs[i]->endIndex);
+ }
+
+ // 6.rebuild sender
+ for (int i = 0; i < oldtotalReplicaNum; ++i) {
+ sDebug("vgId:%d, old sender i:%d, replicaIndex:%d, lastSendTime:%" PRId64, ths->vgId, i,
+ ths->senders[i]->replicaIndex, ths->senders[i]->lastSendTime)
}
for (int32_t i = 0; i < TSDB_MAX_REPLICA + TSDB_MAX_LEARNER_REPLICA; ++i) {
@@ -2633,13 +2629,12 @@ int32_t syncNodeRebuildAndCopyIfExist(SSyncNode* ths, int32_t oldtotalReplicaNum
sSDebug(pSender, "snapshot sender create while open sync node, data:%p", pSender);
}
- for(int i = 0; i < ths->totalReplicaNum; i++){
- sDebug("vgId:%d, new sender i:%d, replicaIndex:%d, lastSendTime:%" PRId64,
- ths->vgId, i, ths->senders[i]->replicaIndex, ths->senders[i]->lastSendTime)
+ for (int i = 0; i < ths->totalReplicaNum; i++) {
+ sDebug("vgId:%d, new sender i:%d, replicaIndex:%d, lastSendTime:%" PRId64, ths->vgId, i,
+ ths->senders[i]->replicaIndex, ths->senders[i]->lastSendTime)
}
-
- //7.rebuild synctimer
+ // 7.rebuild synctimer
syncNodeStopHeartbeatTimer(ths);
for (int32_t i = 0; i < TSDB_MAX_REPLICA + TSDB_MAX_LEARNER_REPLICA; ++i) {
@@ -2648,16 +2643,15 @@ int32_t syncNodeRebuildAndCopyIfExist(SSyncNode* ths, int32_t oldtotalReplicaNum
syncNodeStartHeartbeatTimer(ths);
-
- //8.rebuild peerStates
+ // 8.rebuild peerStates
SPeerState oldState[TSDB_MAX_REPLICA + TSDB_MAX_LEARNER_REPLICA] = {0};
- for(int i = 0; i < TSDB_MAX_REPLICA + TSDB_MAX_LEARNER_REPLICA; i++){
+ for (int i = 0; i < TSDB_MAX_REPLICA + TSDB_MAX_LEARNER_REPLICA; i++) {
oldState[i] = ths->peerStates[i];
}
- for(int i = 0; i < ths->totalReplicaNum; i++){
- for(int j = 0; j < oldtotalReplicaNum; j++){
- if (syncUtilSameId(&ths->replicasId[i], &oldReplicasId[j])){
+ for (int i = 0; i < ths->totalReplicaNum; i++) {
+ for (int j = 0; j < oldtotalReplicaNum; j++) {
+ if (syncUtilSameId(&ths->replicasId[i], &oldReplicasId[j])) {
ths->peerStates[i] = oldState[j];
}
}
@@ -2668,32 +2662,32 @@ int32_t syncNodeRebuildAndCopyIfExist(SSyncNode* ths, int32_t oldtotalReplicaNum
return 0;
}
-void syncNodeChangeToVoter(SSyncNode* ths){
- //replicasId, only need to change replicaNum when 1->3
+void syncNodeChangeToVoter(SSyncNode* ths) {
+ // replicasId, only need to change replicaNum when 1->3
ths->replicaNum = ths->raftCfg.cfg.replicaNum;
sDebug("vgId:%d, totalReplicaNum:%d", ths->vgId, ths->totalReplicaNum);
- for (int32_t i = 0; i < ths->totalReplicaNum; ++i){
+ for (int32_t i = 0; i < ths->totalReplicaNum; ++i) {
sDebug("vgId:%d, i:%d, replicaId.addr:%" PRIx64, ths->vgId, i, ths->replicasId[i].addr);
}
- //pMatchIndex, pNextIndex, only need to change replicaNum when 1->3
+ // pMatchIndex, pNextIndex, only need to change replicaNum when 1->3
ths->pMatchIndex->replicaNum = ths->raftCfg.cfg.replicaNum;
ths->pNextIndex->replicaNum = ths->raftCfg.cfg.replicaNum;
sDebug("vgId:%d, pMatchIndex->totalReplicaNum:%d", ths->vgId, ths->pMatchIndex->totalReplicaNum);
- for (int32_t i = 0; i < ths->pMatchIndex->totalReplicaNum; ++i){
+ for (int32_t i = 0; i < ths->pMatchIndex->totalReplicaNum; ++i) {
sDebug("vgId:%d, i:%d, match.index:%" PRId64, ths->vgId, i, ths->pMatchIndex->index[i]);
}
- //pVotesGranted, pVotesRespond
+ // pVotesGranted, pVotesRespond
voteGrantedUpdate(ths->pVotesGranted, ths);
votesRespondUpdate(ths->pVotesRespond, ths);
- //logRepMgrs
- //no need to change logRepMgrs when 1->3
+ // logRepMgrs
+ // no need to change logRepMgrs when 1->3
}
-void syncNodeResetPeerAndCfg(SSyncNode* ths){
+void syncNodeResetPeerAndCfg(SSyncNode* ths) {
SNodeInfo node = {0};
for (int32_t i = 0; i < ths->peersNum; ++i) {
memcpy(&ths->peersNodeInfo[i], &node, sizeof(SNodeInfo));
@@ -2704,13 +2698,13 @@ void syncNodeResetPeerAndCfg(SSyncNode* ths){
}
}
-int32_t syncNodeChangeConfig(SSyncNode* ths, SSyncRaftEntry* pEntry, char* str){
- if(pEntry->originalRpcType != TDMT_SYNC_CONFIG_CHANGE){
+int32_t syncNodeChangeConfig(SSyncNode* ths, SSyncRaftEntry* pEntry, char* str) {
+ if (pEntry->originalRpcType != TDMT_SYNC_CONFIG_CHANGE) {
return -1;
}
- SMsgHead *head = (SMsgHead *)pEntry->data;
- void *pReq = POINTER_SHIFT(head, sizeof(SMsgHead));
+ SMsgHead* head = (SMsgHead*)pEntry->data;
+ void* pReq = POINTER_SHIFT(head, sizeof(SMsgHead));
SAlterVnodeTypeReq req = {0};
if (tDeserializeSAlterVnodeReplicaReq(pReq, head->contLen, &req) != 0) {
@@ -2719,141 +2713,143 @@ int32_t syncNodeChangeConfig(SSyncNode* ths, SSyncRaftEntry* pEntry, char* str){
}
SSyncCfg cfg = {0};
- syncBuildConfigFromReq(&req, &cfg);
+ syncBuildConfigFromReq(&req, &cfg);
- if(cfg.changeVersion <= ths->raftCfg.cfg.changeVersion){
- sInfo("vgId:%d, skip conf change entry since lower version. "
- "this entry, index:%" PRId64 ", term:%" PRId64 ", totalReplicaNum:%d, changeVersion:%d; "
- "current node, replicaNum:%d, peersNum:%d, lastConfigIndex:%" PRId64", changeVersion:%d",
- ths->vgId,
- pEntry->index, pEntry->term, cfg.totalReplicaNum, cfg.changeVersion,
- ths->replicaNum, ths->peersNum, ths->raftCfg.lastConfigIndex, ths->raftCfg.cfg.changeVersion);
+ if (cfg.changeVersion <= ths->raftCfg.cfg.changeVersion) {
+ sInfo(
+ "vgId:%d, skip conf change entry since lower version. "
+ "this entry, index:%" PRId64 ", term:%" PRId64
+ ", totalReplicaNum:%d, changeVersion:%d; "
+ "current node, replicaNum:%d, peersNum:%d, lastConfigIndex:%" PRId64 ", changeVersion:%d",
+ ths->vgId, pEntry->index, pEntry->term, cfg.totalReplicaNum, cfg.changeVersion, ths->replicaNum, ths->peersNum,
+ ths->raftCfg.lastConfigIndex, ths->raftCfg.cfg.changeVersion);
return 0;
}
- if(strcmp(str, "Commit") == 0){
- sInfo("vgId:%d, change config from %s. "
- "this, i:%" PRId64 ", trNum:%d, vers:%d; "
- "node, rNum:%d, pNum:%d, trNum:%d, "
- "buffer: [%" PRId64 " %" PRId64 " %" PRId64 ", %" PRId64 "), "
- "cond:(next i:%" PRId64 ", t:%" PRId64 " ==%s)",
- ths->vgId, str, pEntry->index - 1, cfg.totalReplicaNum, cfg.changeVersion,
- ths->replicaNum, ths->peersNum, ths->totalReplicaNum,
- ths->pLogBuf->startIndex, ths->pLogBuf->commitIndex, ths->pLogBuf->matchIndex, ths->pLogBuf->endIndex,
- pEntry->index, pEntry->term, TMSG_INFO(pEntry->originalRpcType));
- }
- else{
- sInfo("vgId:%d, change config from %s. "
- "this, i:%" PRId64 ", t:%" PRId64 ", trNum:%d, vers:%d; "
- "node, rNum:%d, pNum:%d, trNum:%d, "
- "buffer: [%" PRId64 " %" PRId64 " %" PRId64 ", %" PRId64 "), "
- "cond:(pre i:%" PRId64 "==ci:%" PRId64 ", bci:%" PRId64 ")",
- ths->vgId, str, pEntry->index, pEntry->term, cfg.totalReplicaNum, cfg.changeVersion,
- ths->replicaNum, ths->peersNum, ths->totalReplicaNum,
- ths->pLogBuf->startIndex, ths->pLogBuf->commitIndex, ths->pLogBuf->matchIndex, ths->pLogBuf->endIndex,
- pEntry->index -1, ths->commitIndex, ths->pLogBuf->commitIndex);
+ if (strcmp(str, "Commit") == 0) {
+ sInfo(
+ "vgId:%d, change config from %s. "
+ "this, i:%" PRId64
+ ", trNum:%d, vers:%d; "
+ "node, rNum:%d, pNum:%d, trNum:%d, "
+ "buffer: [%" PRId64 " %" PRId64 " %" PRId64 ", %" PRId64
+ "), "
+ "cond:(next i:%" PRId64 ", t:%" PRId64 " ==%s)",
+ ths->vgId, str, pEntry->index - 1, cfg.totalReplicaNum, cfg.changeVersion, ths->replicaNum, ths->peersNum,
+ ths->totalReplicaNum, ths->pLogBuf->startIndex, ths->pLogBuf->commitIndex, ths->pLogBuf->matchIndex,
+ ths->pLogBuf->endIndex, pEntry->index, pEntry->term, TMSG_INFO(pEntry->originalRpcType));
+ } else {
+ sInfo(
+ "vgId:%d, change config from %s. "
+ "this, i:%" PRId64 ", t:%" PRId64
+ ", trNum:%d, vers:%d; "
+ "node, rNum:%d, pNum:%d, trNum:%d, "
+ "buffer: [%" PRId64 " %" PRId64 " %" PRId64 ", %" PRId64
+ "), "
+ "cond:(pre i:%" PRId64 "==ci:%" PRId64 ", bci:%" PRId64 ")",
+ ths->vgId, str, pEntry->index, pEntry->term, cfg.totalReplicaNum, cfg.changeVersion, ths->replicaNum,
+ ths->peersNum, ths->totalReplicaNum, ths->pLogBuf->startIndex, ths->pLogBuf->commitIndex,
+ ths->pLogBuf->matchIndex, ths->pLogBuf->endIndex, pEntry->index - 1, ths->commitIndex,
+ ths->pLogBuf->commitIndex);
}
syncNodeLogConfigInfo(ths, &cfg, "before config change");
-
+
int32_t oldTotalReplicaNum = ths->totalReplicaNum;
- if(cfg.totalReplicaNum == 1 || cfg.totalReplicaNum == 2){//remove replica
-
+ if (cfg.totalReplicaNum == 1 || cfg.totalReplicaNum == 2) { // remove replica
+
bool incfg = false;
- for(int32_t j = 0; j < cfg.totalReplicaNum; ++j){
- if(strcmp(ths->myNodeInfo.nodeFqdn, cfg.nodeInfo[j].nodeFqdn) == 0
- && ths->myNodeInfo.nodePort == cfg.nodeInfo[j].nodePort){
+ for (int32_t j = 0; j < cfg.totalReplicaNum; ++j) {
+ if (strcmp(ths->myNodeInfo.nodeFqdn, cfg.nodeInfo[j].nodeFqdn) == 0 &&
+ ths->myNodeInfo.nodePort == cfg.nodeInfo[j].nodePort) {
incfg = true;
break;
}
}
- if(incfg){//remove other
+ if (incfg) { // remove other
syncNodeResetPeerAndCfg(ths);
- //no need to change myNodeInfo
+ // no need to change myNodeInfo
- if(syncNodeRebuildPeerAndCfg(ths, &cfg) != 0){
- return -1;
- };
-
- if(syncNodeRebuildAndCopyIfExist(ths, oldTotalReplicaNum) != 0){
+ if (syncNodeRebuildPeerAndCfg(ths, &cfg) != 0) {
return -1;
};
- }
- else{//remove myself
- //no need to do anything actually, to change the following to reduce distruptive server chance
+
+ if (syncNodeRebuildAndCopyIfExist(ths, oldTotalReplicaNum) != 0) {
+ return -1;
+ };
+ } else { // remove myself
+ // no need to do anything actually, to change the following to reduce distruptive server chance
syncNodeResetPeerAndCfg(ths);
- //change myNodeInfo
+ // change myNodeInfo
ths->myNodeInfo.nodeRole = TAOS_SYNC_ROLE_LEARNER;
- //change peer and cfg
+ // change peer and cfg
ths->peersNum = 0;
memcpy(&ths->raftCfg.cfg.nodeInfo[0], &ths->myNodeInfo, sizeof(SNodeInfo));
ths->raftCfg.cfg.replicaNum = 0;
ths->raftCfg.cfg.totalReplicaNum = 1;
- //change other
- if(syncNodeRebuildAndCopyIfExist(ths, oldTotalReplicaNum) != 0){
+ // change other
+ if (syncNodeRebuildAndCopyIfExist(ths, oldTotalReplicaNum) != 0) {
return -1;
}
- //change state
+ // change state
ths->state = TAOS_SYNC_STATE_LEARNER;
}
- ths->restoreFinish = false;
- }
- else{//add replica, or change replica type
- if(ths->totalReplicaNum == 3){ //change replica type
- sInfo("vgId:%d, begin change replica type", ths->vgId);
+ ths->restoreFinish = false;
+ } else { // add replica, or change replica type
+ if (ths->totalReplicaNum == 3) { // change replica type
+ sInfo("vgId:%d, begin change replica type", ths->vgId);
- //change myNodeInfo
- for(int32_t j = 0; j < cfg.totalReplicaNum; ++j){
- if(strcmp(ths->myNodeInfo.nodeFqdn, cfg.nodeInfo[j].nodeFqdn) == 0
- && ths->myNodeInfo.nodePort == cfg.nodeInfo[j].nodePort){
- if(cfg.nodeInfo[j].nodeRole == TAOS_SYNC_ROLE_VOTER){
+ // change myNodeInfo
+ for (int32_t j = 0; j < cfg.totalReplicaNum; ++j) {
+ if (strcmp(ths->myNodeInfo.nodeFqdn, cfg.nodeInfo[j].nodeFqdn) == 0 &&
+ ths->myNodeInfo.nodePort == cfg.nodeInfo[j].nodePort) {
+ if (cfg.nodeInfo[j].nodeRole == TAOS_SYNC_ROLE_VOTER) {
ths->myNodeInfo.nodeRole = TAOS_SYNC_ROLE_VOTER;
}
}
}
-
- //change peer and cfg
+
+ // change peer and cfg
syncNodeChangePeerAndCfgToVoter(ths, &cfg);
- //change other
+ // change other
syncNodeChangeToVoter(ths);
- //change state
- if(ths->state ==TAOS_SYNC_STATE_LEARNER){
- if(ths->myNodeInfo.nodeRole == TAOS_SYNC_ROLE_VOTER ){
+ // change state
+ if (ths->state == TAOS_SYNC_STATE_LEARNER) {
+ if (ths->myNodeInfo.nodeRole == TAOS_SYNC_ROLE_VOTER) {
ths->state = TAOS_SYNC_STATE_FOLLOWER;
}
}
- ths->restoreFinish = false;
- }
- else{//add replica
+ ths->restoreFinish = false;
+ } else { // add replica
sInfo("vgId:%d, begin add replica", ths->vgId);
- //no need to change myNodeInfo
+ // no need to change myNodeInfo
- //change peer and cfg
- if(syncNodeRebuildPeerAndCfg(ths, &cfg) != 0){
+ // change peer and cfg
+ if (syncNodeRebuildPeerAndCfg(ths, &cfg) != 0) {
return -1;
};
- //change other
- if(syncNodeRebuildAndCopyIfExist(ths, oldTotalReplicaNum) != 0){
+ // change other
+ if (syncNodeRebuildAndCopyIfExist(ths, oldTotalReplicaNum) != 0) {
return -1;
};
- //no need to change state
+ // no need to change state
- if(ths->myNodeInfo.nodeRole == TAOS_SYNC_ROLE_LEARNER){
+ if (ths->myNodeInfo.nodeRole == TAOS_SYNC_ROLE_LEARNER) {
ths->restoreFinish = false;
}
}
@@ -2867,7 +2863,7 @@ int32_t syncNodeChangeConfig(SSyncNode* ths, SSyncRaftEntry* pEntry, char* str){
syncNodeLogConfigInfo(ths, &cfg, "after config change");
- if(syncWriteCfgFile(ths) != 0){
+ if (syncWriteCfgFile(ths) != 0) {
sError("vgId:%d, failed to create sync cfg file", ths->vgId);
return -1;
};
@@ -2896,7 +2892,7 @@ int32_t syncNodeAppend(SSyncNode* ths, SSyncRaftEntry* pEntry) {
code = 0;
_out:;
// proceed match index, with replicating on needed
- SyncIndex matchIndex = syncLogBufferProceed(ths->pLogBuf, ths, NULL, "Append");
+ SyncIndex matchIndex = syncLogBufferProceed(ths->pLogBuf, ths, NULL, "Append");
sTrace("vgId:%d, append raft entry. index:%" PRId64 ", term:%" PRId64 " pBuf: [%" PRId64 " %" PRId64 " %" PRId64
", %" PRId64 ")",
@@ -2927,7 +2923,7 @@ bool syncNodeHeartbeatReplyTimeout(SSyncNode* pSyncNode) {
int32_t toCount = 0;
int64_t tsNow = taosGetTimestampMs();
for (int32_t i = 0; i < pSyncNode->peersNum; ++i) {
- if(pSyncNode->peersNodeInfo[i].nodeRole == TAOS_SYNC_ROLE_LEARNER){
+ if (pSyncNode->peersNodeInfo[i].nodeRole == TAOS_SYNC_ROLE_LEARNER) {
continue;
}
int64_t recvTime = syncIndexMgrGetRecvTime(pSyncNode->pMatchIndex, &(pSyncNode->peersId[i]));
@@ -3191,9 +3187,9 @@ int32_t syncNodeOnClientRequest(SSyncNode* ths, SRpcMsg* pMsg, SyncIndex* pRetIn
pEntry = syncEntryBuildFromRpcMsg(pMsg, term, index);
}
- //1->2, config change is add in write thread, and will continue in sync thread
- //need save message for it
- if(pMsg->msgType == TDMT_SYNC_CONFIG_CHANGE){
+ // 1->2, config change is add in write thread, and will continue in sync thread
+ // need save message for it
+ if (pMsg->msgType == TDMT_SYNC_CONFIG_CHANGE) {
SRespStub stub = {.createTime = taosGetTimestampMs(), .rpcMsg = *pMsg};
uint64_t seqNum = syncRespMgrAdd(ths->pSyncRespMgr, &stub);
pEntry->seqNum = seqNum;
@@ -3209,21 +3205,21 @@ int32_t syncNodeOnClientRequest(SSyncNode* ths, SRpcMsg* pMsg, SyncIndex* pRetIn
(*pRetIndex) = index;
}
- if(pEntry->originalRpcType == TDMT_SYNC_CONFIG_CHANGE){
+ if (pEntry->originalRpcType == TDMT_SYNC_CONFIG_CHANGE) {
int32_t code = syncNodeCheckChangeConfig(ths, pEntry);
- if(code < 0){
+ if (code < 0) {
sError("vgId:%d, failed to check change config since %s.", ths->vgId, terrstr());
syncEntryDestroy(pEntry);
pEntry = NULL;
return -1;
}
-
- if(code > 0){
+
+ if (code > 0) {
SRpcMsg rsp = {.code = pMsg->code, .info = pMsg->info};
(void)syncRespMgrGetAndDel(ths->pSyncRespMgr, pEntry->seqNum, &rsp.info);
if (rsp.info.handle != NULL) {
tmsgSendRsp(&rsp);
- }
+ }
syncEntryDestroy(pEntry);
pEntry = NULL;
return -1;
diff --git a/source/libs/transport/src/transSvr.c b/source/libs/transport/src/transSvr.c
index 362d38b505..b324ca5f91 100644
--- a/source/libs/transport/src/transSvr.c
+++ b/source/libs/transport/src/transSvr.c
@@ -159,7 +159,7 @@ static void uvStartSendResp(SSvrMsg* msg);
static void uvNotifyLinkBrokenToApp(SSvrConn* conn);
-static FORCE_INLINE void destroySmsg(SSvrMsg* smsg);
+static FORCE_INLINE void destroySmsg(SSvrMsg* smsg);
static FORCE_INLINE SSvrConn* createConn(void* hThrd);
static FORCE_INLINE void destroyConn(SSvrConn* conn, bool clear /*clear handle or not*/);
static FORCE_INLINE void destroyConnRegArg(SSvrConn* conn);
@@ -1382,7 +1382,7 @@ void uvHandleUpdate(SSvrMsg* msg, SWorkThrd* thrd) {
tFreeSUpdateIpWhiteReq(req);
taosMemoryFree(req);
} else {
- tInfo("ip-white-list disable on trans");
+ tDebug("ip-white-list disable on trans");
thrd->enableIpWhiteList = 0;
}
taosMemoryFree(msg);
diff --git a/source/libs/wal/src/walRead.c b/source/libs/wal/src/walRead.c
index 6748d161ae..3854e90901 100644
--- a/source/libs/wal/src/walRead.c
+++ b/source/libs/wal/src/walRead.c
@@ -305,7 +305,7 @@ int32_t walFetchHead(SWalReader *pRead, int64_t ver) {
}
int32_t walSkipFetchBody(SWalReader *pRead) {
- wDebug("vgId:%d, skip fetch body:%" PRId64 ", first:%" PRId64 ", commit:%" PRId64 ", last:%" PRId64
+ wDebug("vgId:%d, skip:%" PRId64 ", first:%" PRId64 ", commit:%" PRId64 ", last:%" PRId64
", applied:%" PRId64 ", 0x%" PRIx64,
pRead->pWal->cfg.vgId, pRead->pHead->head.version, pRead->pWal->vers.firstVer, pRead->pWal->vers.commitVer,
pRead->pWal->vers.lastVer, pRead->pWal->vers.appliedVer, pRead->readerId);
diff --git a/source/os/src/osTime.c b/source/os/src/osTime.c
index e506ee603b..9cad1dd6ef 100644
--- a/source/os/src/osTime.c
+++ b/source/os/src/osTime.c
@@ -37,9 +37,6 @@
// This magic number is the number of 100 nanosecond intervals since January 1, 1601 (UTC)
// until 00:00:00 January 1, 1970
static const uint64_t TIMEEPOCH = ((uint64_t)116444736000000000ULL);
-// This magic number is the number of 100 nanosecond intervals since January 1, 1601 (UTC)
-// until 00:00:00 January 1, 1900
-static const uint64_t TIMEEPOCH1900 = ((uint64_t)116445024000000000ULL);
/*
* We do not implement alternate representations. However, we always
@@ -360,6 +357,7 @@ int32_t taosGetTimeOfDay(struct timeval *tv) {
t.QuadPart -= TIMEEPOCH;
tv->tv_sec = t.QuadPart / 10000000;
tv->tv_usec = (t.QuadPart % 10000000) / 10;
+ return 0;
#else
return gettimeofday(tv, NULL);
#endif
@@ -482,33 +480,51 @@ struct tm *taosLocalTime(const time_t *timep, struct tm *result, char *buf) {
sprintf(buf, "NaN");
}
return NULL;
- }
+ } else if (*timep < 0) {
+ SYSTEMTIME ss, s;
+ FILETIME ff, f;
- SYSTEMTIME s;
- FILETIME f;
- LARGE_INTEGER offset;
- struct tm tm1;
- time_t tt = 0;
- if (localtime_s(&tm1, &tt) != 0) {
- if (buf != NULL) {
- sprintf(buf, "NaN");
+ LARGE_INTEGER offset;
+ struct tm tm1;
+ time_t tt = 0;
+ if (localtime_s(&tm1, &tt) != 0) {
+ if (buf != NULL) {
+ sprintf(buf, "NaN");
+ }
+ return NULL;
+ }
+ ss.wYear = tm1.tm_year + 1900;
+ ss.wMonth = tm1.tm_mon + 1;
+ ss.wDay = tm1.tm_mday;
+ ss.wHour = tm1.tm_hour;
+ ss.wMinute = tm1.tm_min;
+ ss.wSecond = tm1.tm_sec;
+ ss.wMilliseconds = 0;
+ SystemTimeToFileTime(&ss, &ff);
+ offset.QuadPart = ff.dwHighDateTime;
+ offset.QuadPart <<= 32;
+ offset.QuadPart |= ff.dwLowDateTime;
+ offset.QuadPart += *timep * 10000000;
+ f.dwLowDateTime = offset.QuadPart & 0xffffffff;
+ f.dwHighDateTime = (offset.QuadPart >> 32) & 0xffffffff;
+ FileTimeToSystemTime(&f, &s);
+ result->tm_sec = s.wSecond;
+ result->tm_min = s.wMinute;
+ result->tm_hour = s.wHour;
+ result->tm_mday = s.wDay;
+ result->tm_mon = s.wMonth - 1;
+ result->tm_year = s.wYear - 1900;
+ result->tm_wday = s.wDayOfWeek;
+ result->tm_yday = 0;
+ result->tm_isdst = 0;
+ } else {
+ if (localtime_s(result, timep) != 0) {
+ if (buf != NULL) {
+ sprintf(buf, "NaN");
+ }
+ return NULL;
}
- return NULL;
}
- offset.QuadPart = TIMEEPOCH1900;
- offset.QuadPart += *timep * 10000000;
- f.dwLowDateTime = offset.QuadPart & 0xffffffff;
- f.dwHighDateTime = (offset.QuadPart >> 32) & 0xffffffff;
- FileTimeToSystemTime(&f, &s);
- result->tm_sec = s.wSecond;
- result->tm_min = s.wMinute;
- result->tm_hour = s.wHour;
- result->tm_mday = s.wDay;
- result->tm_mon = s.wMonth - 1;
- result->tm_year = s.wYear - 1900;
- result->tm_wday = s.wDayOfWeek;
- result->tm_yday = 0;
- result->tm_isdst = 0;
#else
res = localtime_r(timep, result);
if (res == NULL && buf != NULL) {
diff --git a/source/os/src/osTimezone.c b/source/os/src/osTimezone.c
index 4280490c68..72f7dda41c 100644
--- a/source/os/src/osTimezone.c
+++ b/source/os/src/osTimezone.c
@@ -740,6 +740,8 @@ char *tz_win[554][2] = {{"Asia/Shanghai", "China Standard Time"},
#include
#endif
+static int isdst_now = 0;
+
void taosSetSystemTimezone(const char *inTimezoneStr, char *outTimezoneStr, int8_t *outDaylight,
enum TdTimezone *tsTimezone) {
if (inTimezoneStr == NULL || inTimezoneStr[0] == 0) return;
@@ -805,19 +807,19 @@ void taosSetSystemTimezone(const char *inTimezoneStr, char *outTimezoneStr, int8
tzset();
int32_t tz = (int32_t)((-timezone * MILLISECOND_PER_SECOND) / MILLISECOND_PER_HOUR);
*tsTimezone = tz;
- tz += daylight;
+ tz += isdst_now;
- sprintf(outTimezoneStr, "%s (%s, %s%02d00)", buf, tzname[daylight], tz >= 0 ? "+" : "-", abs(tz));
- *outDaylight = daylight;
+ sprintf(outTimezoneStr, "%s (%s, %s%02d00)", buf, tzname[isdst_now], tz >= 0 ? "+" : "-", abs(tz));
+ *outDaylight = isdst_now;
#else
setenv("TZ", buf, 1);
tzset();
int32_t tz = (int32_t)((-timezone * MILLISECOND_PER_SECOND) / MILLISECOND_PER_HOUR);
*tsTimezone = tz;
- tz += daylight;
- sprintf(outTimezoneStr, "%s (%s, %s%02d00)", buf, tzname[daylight], tz >= 0 ? "+" : "-", abs(tz));
- *outDaylight = daylight;
+ tz += isdst_now;
+ sprintf(outTimezoneStr, "%s (%s, %s%02d00)", buf, tzname[isdst_now], tz >= 0 ? "+" : "-", abs(tz));
+ *outDaylight = isdst_now;
#endif
@@ -895,6 +897,7 @@ void taosGetSystemTimezone(char *outTimezoneStr, enum TdTimezone *tsTimezone) {
struct tm tm1;
taosLocalTime(&tx1, &tm1, NULL);
daylight = tm1.tm_isdst;
+ isdst_now = tm1.tm_isdst;
/*
* format example:
@@ -1009,6 +1012,7 @@ void taosGetSystemTimezone(char *outTimezoneStr, enum TdTimezone *tsTimezone) {
time_t tx1 = taosGetTimestampSec();
struct tm tm1;
taosLocalTime(&tx1, &tm1, NULL);
+ isdst_now = tm1.tm_isdst;
/*
* format example:
diff --git a/source/util/src/tbase58.c b/source/util/src/tbase58.c
new file mode 100644
index 0000000000..fa3ecadd14
--- /dev/null
+++ b/source/util/src/tbase58.c
@@ -0,0 +1,144 @@
+/*
+ * Copyright (c) 2019 TAOS Data, Inc.
+ *
+ * This program is free software: you can use, redistribute, and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3
+ * or later ("AGPL"), as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+#define _DEFAULT_SOURCE
+#include "tbase58.h"
+#include
+#include
+
+#define BASE_BUF_SIZE 256
+static const char *basis_58 = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
+
+char *base58_encode(const uint8_t *value, int32_t vlen) {
+ const uint8_t *pb = value;
+ const uint8_t *pe = pb + vlen;
+ uint8_t buf[BASE_BUF_SIZE] = {0};
+ uint8_t *pbuf = &buf[0];
+ bool bfree = false;
+ int32_t nz = 0, size = 0, len = 0;
+
+ while (pb != pe && *pb == 0) {
+ ++pb;
+ ++nz;
+ }
+
+ size = (pe - pb) * 69 / 50 + 1;
+ if (size > BASE_BUF_SIZE) {
+ if (!(pbuf = taosMemoryCalloc(1, size))) {
+ terrno = TSDB_CODE_OUT_OF_MEMORY;
+ return NULL;
+ }
+ bfree = true;
+ }
+
+ while (pb != pe) {
+ int32_t num = *pb;
+ int32_t i = 0;
+ for (int32_t j = (int32_t)size - 1; (num != 0 || i < len) && j >= 0; --j, ++i) {
+ num += ((int32_t)buf[j]) << 8;
+ pbuf[j] = num % 58;
+ num /= 58;
+ }
+ len = i;
+ ++pb;
+ }
+
+ const uint8_t *pi = pbuf + (size - len);
+ while (pi != pbuf + size && *pi == 0) ++pi;
+ uint8_t *result = taosMemoryCalloc(1, size + 1);
+ if (!result) {
+ terrno = TSDB_CODE_OUT_OF_MEMORY;
+ if (bfree) taosMemoryFree(pbuf);
+ return NULL;
+ }
+ memset(result, '1', nz);
+ while (pi != pbuf + size) result[nz++] = basis_58[*pi++];
+
+ if (bfree) taosMemoryFree(pbuf);
+ return result;
+}
+
+static const signed char index_58[256] = {
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8,
+ -1, -1, -1, -1, -1, -1, -1, 9, 10, 11, 12, 13, 14, 15, 16, -1, 17, 18, 19, 20, 21, -1, 22, 23, 24, 25, 26, 27, 28,
+ 29, 30, 31, 32, -1, -1, -1, -1, -1, -1, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, -1, 44, 45, 46, 47, 48, 49, 50,
+ 51, 52, 53, 54, 55, 56, 57, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1};
+
+uint8_t *base58_decode(const char *value, size_t inlen, int32_t *outlen) {
+ const char *pe = value + inlen;
+ uint8_t buf[BASE_BUF_SIZE] = {0};
+ uint8_t *pbuf = &buf[0];
+ bool bfree = false;
+ int32_t nz = 0, size = 0, len = 0;
+
+ while (*value && isspace(*value)) ++value;
+ while (*value == '1') {
+ ++nz;
+ ++value;
+ }
+
+ size = (int32_t)(pe - value) * 733 / 1000 + 1;
+ if (size > BASE_BUF_SIZE) {
+ if (!(pbuf = taosMemoryCalloc(1, size))) {
+ terrno = TSDB_CODE_OUT_OF_MEMORY;
+ return NULL;
+ }
+ bfree = true;
+ }
+
+ while (*value && !isspace(*value)) {
+ int32_t num = index_58[(uint8_t)*value];
+ if (num == -1) {
+ if (bfree) taosMemoryFree(pbuf);
+ return NULL;
+ }
+ int32_t i = 0;
+ for (int32_t j = size - 1; (num != 0 || i < len) && (j >= 0); --j, ++i) {
+ num += (int32_t)pbuf[j] * 58;
+ pbuf[j] = num & 255;
+ num >>= 8;
+ }
+ len = i;
+ ++value;
+ }
+
+ while (isspace(*value)) ++value;
+ if (*value != 0) {
+ if (bfree) taosMemoryFree(pbuf);
+ return NULL;
+ }
+ const uint8_t *it = pbuf + (size - len);
+ while (it != pbuf + size && *it == 0) ++it;
+
+ uint8_t *result = taosMemoryCalloc(1, size + 1);
+ if (!result) {
+ if (bfree) taosMemoryFree(pbuf);
+ terrno = TSDB_CODE_OUT_OF_MEMORY;
+ return NULL;
+ }
+
+ memset(result, 0, nz);
+ while (it != pbuf + size) result[nz++] = *it++;
+
+ if (outlen) *outlen = nz;
+
+ if (bfree) taosMemoryFree(pbuf);
+ return result;
+}
\ No newline at end of file
diff --git a/source/util/src/tbase64.c b/source/util/src/tbase64.c
index a2f4ddbc51..f6f12fef97 100644
--- a/source/util/src/tbase64.c
+++ b/source/util/src/tbase64.c
@@ -15,6 +15,8 @@
#define _DEFAULT_SOURCE
#include "tbase64.h"
+#include
+#include
static char basis_64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
diff --git a/source/util/src/tcache.c b/source/util/src/tcache.c
index 11f8df4c93..0a7842194e 100644
--- a/source/util/src/tcache.c
+++ b/source/util/src/tcache.c
@@ -994,6 +994,12 @@ void *taosCacheIterGetKey(const SCacheIter *pIter, size_t *len) {
}
void taosCacheDestroyIter(SCacheIter *pIter) {
+ for (int32_t i = 0; i < pIter->numOfObj; ++i) {
+ if (!pIter->pCurrent[i]) continue;
+ char *p = pIter->pCurrent[i]->data;
+ taosCacheRelease(pIter->pCacheObj, (void **)&p, false);
+ pIter->pCurrent[i] = NULL;
+ }
taosMemoryFreeClear(pIter->pCurrent);
taosMemoryFreeClear(pIter);
}
diff --git a/source/util/src/tconfig.c b/source/util/src/tconfig.c
index d656f0c14e..ad3c766510 100644
--- a/source/util/src/tconfig.c
+++ b/source/util/src/tconfig.c
@@ -336,7 +336,7 @@ static int32_t cfgUpdateDebugFlagItem(SConfig *pCfg, const char *name, bool rese
}
int32_t cfgSetItem(SConfig *pCfg, const char *name, const char *value, ECfgSrcType stype) {
- GRANT_CFG_SET;
+ // GRANT_CFG_SET;
SConfigItem *pItem = cfgGetItem(pCfg, name);
if (pItem == NULL) {
terrno = TSDB_CODE_CFG_NOT_FOUND;
diff --git a/source/util/src/tdes.c b/source/util/src/tdes.c
index 0e0193a123..a4da08630e 100644
--- a/source/util/src/tdes.c
+++ b/source/util/src/tdes.c
@@ -48,6 +48,10 @@ char* taosDesImp(uint8_t* key, char* src, uint32_t len, int32_t process_mode) {
key_set key_sets[17];
memset(key_sets, 0, sizeof(key_sets));
char* dest = taosMemoryCalloc(len + 1, 1);
+ if (!dest) {
+ terrno = TSDB_CODE_OUT_OF_MEMORY;
+ return NULL;
+ }
generate_sub_keys(key, key_sets);
for (uint32_t block_count = 0; block_count < number_of_blocks; block_count++) {
@@ -61,7 +65,10 @@ char* taosDesImp(uint8_t* key, char* src, uint32_t len, int32_t process_mode) {
}
char* taosDesEncode(int64_t key, char* src, int32_t len) {
- if (len % 8 != 0) return NULL;
+ if (len % 8 != 0) {
+ terrno = TSDB_CODE_INVALID_PARA;
+ return NULL;
+ }
uint8_t* keyStr = (uint8_t*)(&key);
return taosDesImp(keyStr, src, len, ENCRYPTION_MODE);
}
diff --git a/source/util/src/terror.c b/source/util/src/terror.c
index 79b9e9bbed..9fcca86744 100644
--- a/source/util/src/terror.c
+++ b/source/util/src/terror.c
@@ -103,6 +103,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_INVALID_DATA_FMT, "Invalid data format")
TAOS_DEFINE_ERROR(TSDB_CODE_INVALID_CFG_VALUE, "Invalid configuration value")
TAOS_DEFINE_ERROR(TSDB_CODE_IP_NOT_IN_WHITE_LIST, "Not allowed to connect")
TAOS_DEFINE_ERROR(TSDB_CODE_FAILED_TO_CONNECT_S3, "Failed to connect to s3 server")
+TAOS_DEFINE_ERROR(TSDB_CODE_MSG_PREPROCESSED, "Message has been processed in preprocess")
//client
TAOS_DEFINE_ERROR(TSDB_CODE_TSC_INVALID_OPERATION, "Invalid operation")
@@ -345,6 +346,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_MNODE_ALREADY_IS_VOTER, "Mnode already is a le
TAOS_DEFINE_ERROR(TSDB_CODE_MNODE_ONLY_TWO_MNODE, "Only two mnodes exist")
TAOS_DEFINE_ERROR(TSDB_CODE_MNODE_NO_NEED_RESTORE, "No need to restore on this dnode")
TAOS_DEFINE_ERROR(TSDB_CODE_DNODE_ONLY_USE_WHEN_OFFLINE, "Please use this command when the dnode is offline")
+TAOS_DEFINE_ERROR(TSDB_CODE_DNODE_NO_MACHINE_CODE, "Dnode can not get machine code")
// vnode
TAOS_DEFINE_ERROR(TSDB_CODE_VND_INVALID_VGROUP_ID, "Vnode is closed or removed")
@@ -416,7 +418,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_QRY_TASK_CANCELLED, "Task cancelled")
TAOS_DEFINE_ERROR(TSDB_CODE_QRY_TASK_DROPPED, "Task dropped")
TAOS_DEFINE_ERROR(TSDB_CODE_QRY_TASK_CANCELLING, "Task cancelling")
TAOS_DEFINE_ERROR(TSDB_CODE_QRY_TASK_DROPPING, "Task dropping")
-TAOS_DEFINE_ERROR(TSDB_CODE_QRY_DUPLICATTED_OPERATION, "Duplicatted operation")
+TAOS_DEFINE_ERROR(TSDB_CODE_QRY_DUPLICATED_OPERATION, "Duplicated operation")
TAOS_DEFINE_ERROR(TSDB_CODE_QRY_TASK_MSG_ERROR, "Task message error")
TAOS_DEFINE_ERROR(TSDB_CODE_QRY_JOB_FREED, "Job already freed")
TAOS_DEFINE_ERROR(TSDB_CODE_QRY_TASK_STATUS_ERROR, "Task status error")
@@ -426,30 +428,42 @@ TAOS_DEFINE_ERROR(TSDB_CODE_QRY_JSON_IN_GROUP_ERROR, "Json not support in g
TAOS_DEFINE_ERROR(TSDB_CODE_QRY_JOB_NOT_EXIST, "Job not exist")
TAOS_DEFINE_ERROR(TSDB_CODE_QRY_QWORKER_QUIT, "Vnode/Qnode is quitting")
TAOS_DEFINE_ERROR(TSDB_CODE_QRY_GEO_NOT_SUPPORT_ERROR, "Geometry not support in this operator")
+TAOS_DEFINE_ERROR(TSDB_CODE_QRY_INVALID_WINDOW_CONDITION, "The time pseudo column is illegally used in the condition of the event window.")
TAOS_DEFINE_ERROR(TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR, "Executor internal error")
// grant
TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_EXPIRED, "License expired")
-TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_DNODE_LIMITED, "DNode creation limited by license")
-TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_ACCT_LIMITED, "Account creation limited by license")
-TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_TIMESERIES_LIMITED, "Time series limited by license")
-TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_DB_LIMITED, "DB creation limited by license")
-TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_USER_LIMITED, "User creation limited by license")
-TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_CONN_LIMITED, "Conn creation limited by license")
-TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_STREAM_LIMITED, "Stream creation limited by license")
-TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_SPEED_LIMITED, "Write speed limited by license")
-TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_STORAGE_LIMITED, "Storage capacity limited by license")
-TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_QUERYTIME_LIMITED, "Query time limited by license")
-TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_CPU_LIMITED, "CPU cores limited by license")
-TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_STABLE_LIMITED, "STable creation limited by license")
-TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_TABLE_LIMITED, "Table creation limited by license")
+TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_DNODE_LIMITED, "Number of dnodes has reached the licensed upper limit")
+TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_ACCT_LIMITED, "Number of accounts has reached the licensed upper limit")
+TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_TIMESERIES_LIMITED, "Number of time series has reached the licensed upper limit")
+TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_DB_LIMITED, "Number of DBs has reached the licensed upper limit")
+TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_USER_LIMITED, "Number of users has reached the licensed upper limit")
+TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_CONN_LIMITED, "Number of connections has reached the licensed upper limit")
+TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_STREAM_LIMITED, "Number of streams has reached the licensed upper limit")
+TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_SPEED_LIMITED, "Write speed has reached the licensed upper limit")
+TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_STORAGE_LIMITED, "Storage capacity has reached the licensed upper limit")
+TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_SUBSCRIPTION_LIMITED, "Number of subscriptions has reached the licensed upper limit")
+TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_CPU_LIMITED, "Number of CPU cores has reached the licensed upper limit")
+TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_STABLE_LIMITED, "Number of stables has reached the licensed upper limit")
+TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_TABLE_LIMITED, "Number of tables has reached the licensed upper limit")
TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_PAR_IVLD_ACTIVE, "Invalid active code")
TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_PAR_IVLD_KEY, "Invalid key to parse active code")
TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_PAR_DEC_IVLD_KEY, "Invalid key to decode active code")
TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_PAR_DEC_IVLD_KLEN, "Invalid klen to decode active code")
TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_GEN_IVLD_KEY, "Invalid key to gen active code")
-TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_GEN_APP_LIMIT, "Limited app num to gen active code")
+TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_GEN_ACTIVE_LEN, "Exceeded active len to gen active code")
TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_GEN_ENC_IVLD_KLEN, "Invalid klen to encode active code")
+TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_PAR_IVLD_DIST, "Invalid dist to parse active code")
+TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_UNLICENSED_CLUSTER, "Illegal operation, the license is being used by an unlicensed cluster")
+TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_LACK_OF_BASIC, "Lack of basic functions in active code")
+TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_OBJ_NOT_EXIST, "Grant object not exist")
+TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_LAST_ACTIVE_NOT_FOUND, "The historial active code does not match")
+TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_MACHINES_MISMATCH, "Cluster machines mismatch with active code")
+TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_OPT_EXPIRE_TOO_LARGE, "Expire time of optional grant item is too large")
+TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_DUPLICATED_ACTIVE, "The active code can't be activated repeatedly")
+TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_VIEW_LIMITED, "Number of view has reached the licensed upper limit")
+TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_CSV_LIMITED, "Csv has reached the licensed upper limit")
+TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_AUDIT_LIMITED, "Audit has reached the licensed upper limit")
// sync
TAOS_DEFINE_ERROR(TSDB_CODE_SYN_TIMEOUT, "Sync timeout")
@@ -592,7 +606,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_PAR_WINDOW_NOT_ALLOWED_FUNC, "Window not allowed"
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_STREAM_NOT_ALLOWED_FUNC, "Stream not allowed")
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_GROUP_BY_NOT_ALLOWED_FUNC, "Group by not allowd")
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_INTERP_CLAUSE, "Invalid interp clause")
-TAOS_DEFINE_ERROR(TSDB_CODE_PAR_NO_VALID_FUNC_IN_WIN, "Not valid function ion window")
+TAOS_DEFINE_ERROR(TSDB_CODE_PAR_NO_VALID_FUNC_IN_WIN, "Not valid function in window")
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_ONLY_SUPPORT_SINGLE_TABLE, "Only support single table")
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_SMA_INDEX, "Invalid sma index")
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_SELECTED_EXPR, "Invalid SELECTed expression")
diff --git a/source/util/src/tlog.c b/source/util/src/tlog.c
index bd6c37a7b5..505ce61eca 100644
--- a/source/util/src/tlog.c
+++ b/source/util/src/tlog.c
@@ -573,6 +573,9 @@ void taosPrintSlowLog(const char *format, ...) {
len += vsnprintf(buffer + len, LOG_MAX_LINE_DUMP_BUFFER_SIZE - 2 - len, format, argpointer);
va_end(argpointer);
+ if (len < 0 || len > LOG_MAX_LINE_DUMP_BUFFER_SIZE - 2) {
+ len = LOG_MAX_LINE_DUMP_BUFFER_SIZE - 2;
+ }
buffer[len++] = '\n';
buffer[len] = 0;
diff --git a/source/util/src/tqueue.c b/source/util/src/tqueue.c
index 1dfdd637b6..2cc13be6ba 100644
--- a/source/util/src/tqueue.c
+++ b/source/util/src/tqueue.c
@@ -159,6 +159,7 @@ void taosFreeQitem(void *pItem) {
int32_t taosWriteQitem(STaosQueue *queue, void *pItem) {
int32_t code = 0;
STaosQnode *pNode = (STaosQnode *)(((char *)pItem) - sizeof(STaosQnode));
+ pNode->timestamp = taosGetTimestampUs();
pNode->next = NULL;
taosThreadMutexLock(&queue->mutex);
@@ -464,6 +465,7 @@ int32_t taosReadAllQitemsFromQset(STaosQset *qset, STaosQall *qall, SQueueInfo *
qinfo->ahandle = queue->ahandle;
qinfo->fp = queue->itemsFp;
qinfo->queue = queue;
+ qinfo->timestamp = queue->head->timestamp;
queue->head = NULL;
queue->tail = NULL;
@@ -489,8 +491,8 @@ int32_t taosReadAllQitemsFromQset(STaosQset *qset, STaosQall *qall, SQueueInfo *
int32_t taosQallItemSize(STaosQall *qall) { return qall->numOfItems; }
int64_t taosQallMemSize(STaosQall *qall) { return qall->memOfItems; }
-int64_t taosQallUnAccessedItemSize(STaosQall *qall) {return qall->unAccessedNumOfItems;}
-int64_t taosQallUnAccessedMemSize(STaosQall *qall) {return qall->unAccessMemOfItems;}
+int64_t taosQallUnAccessedItemSize(STaosQall *qall) { return qall->unAccessedNumOfItems; }
+int64_t taosQallUnAccessedMemSize(STaosQall *qall) { return qall->unAccessMemOfItems; }
void taosResetQitems(STaosQall *qall) { qall->current = qall->start; }
int32_t taosGetQueueNumber(STaosQset *qset) { return qset->numOfQueues; }
diff --git a/source/util/src/tworker.c b/source/util/src/tworker.c
index 57dc60e539..c4b3271c65 100644
--- a/source/util/src/tworker.c
+++ b/source/util/src/tworker.c
@@ -15,10 +15,12 @@
#define _DEFAULT_SOURCE
#include "tworker.h"
-#include "tgeosctx.h"
#include "taoserror.h"
+#include "tgeosctx.h"
#include "tlog.h"
+#define QUEUE_THRESHOLD 1000 * 1000
+
typedef void *(*ThreadFp)(void *param);
int32_t tQWorkerInit(SQWorkerPool *pool) {
@@ -84,6 +86,13 @@ static void *tQWorkerThreadFp(SQueueWorker *worker) {
break;
}
+ if (qinfo.timestamp != 0) {
+ int64_t cost = taosGetTimestampUs() - qinfo.timestamp;
+ if (cost > QUEUE_THRESHOLD) {
+ uWarn("worker:%s,message has been queued for too long, cost: %" PRId64 "s", pool->name, cost);
+ }
+ }
+
if (qinfo.fp != NULL) {
qinfo.workerId = worker->id;
qinfo.threadNum = pool->num;
@@ -198,6 +207,13 @@ static void *tAutoQWorkerThreadFp(SQueueWorker *worker) {
break;
}
+ if (qinfo.timestamp != 0) {
+ int64_t cost = taosGetTimestampUs() - qinfo.timestamp;
+ if (cost > QUEUE_THRESHOLD) {
+ uWarn("worker:%s,message has been queued for too long, cost: %" PRId64 "s", pool->name, cost);
+ }
+ }
+
if (qinfo.fp != NULL) {
qinfo.workerId = worker->id;
qinfo.threadNum = taosArrayGetSize(pool->workers);
@@ -221,7 +237,7 @@ STaosQueue *tAutoQWorkerAllocQueue(SAutoQWorkerPool *pool, void *ahandle, FItem
int32_t queueNum = taosGetQueueNumber(pool->qset);
int32_t curWorkerNum = taosArrayGetSize(pool->workers);
int32_t dstWorkerNum = ceilf(queueNum * pool->ratio);
- if (dstWorkerNum < 1) dstWorkerNum = 1;
+ if (dstWorkerNum < 2) dstWorkerNum = 2;
// spawn a thread to process queue
while (curWorkerNum < dstWorkerNum) {
@@ -338,6 +354,13 @@ static void *tWWorkerThreadFp(SWWorker *worker) {
break;
}
+ if (qinfo.timestamp != 0) {
+ int64_t cost = taosGetTimestampUs() - qinfo.timestamp;
+ if (cost > QUEUE_THRESHOLD) {
+ uWarn("worker:%s,message has been queued for too long, cost: %" PRId64 "s", pool->name, cost);
+ }
+ }
+
if (qinfo.fp != NULL) {
qinfo.workerId = worker->id;
qinfo.threadNum = pool->num;
diff --git a/tests/army/community/cluster/incSnapshot.py b/tests/army/community/cluster/incSnapshot.py
new file mode 100644
index 0000000000..d309bae72c
--- /dev/null
+++ b/tests/army/community/cluster/incSnapshot.py
@@ -0,0 +1,106 @@
+import taos
+import sys
+import os
+import subprocess
+import glob
+import shutil
+import time
+
+from frame.log import *
+from frame.cases import *
+from frame.sql import *
+from frame.srvCtl import *
+from frame.caseBase import *
+from frame import *
+from frame.autogen import *
+# from frame.server.dnodes import *
+# from frame.server.cluster import *
+
+
+class TDTestCase(TBase):
+
+ def init(self, conn, logSql, replicaVar=3):
+ super(TDTestCase, self).init(conn, logSql, replicaVar=3, db="snapshot", checkColName="c1")
+ self.valgrind = 0
+ self.childtable_count = 10
+ # tdSql.init(conn.cursor())
+ tdSql.init(conn.cursor(), logSql) # output sql.txt file
+
+ def run(self):
+ tdSql.prepare()
+ autoGen = AutoGen()
+ autoGen.create_db(self.db, 2, 3)
+ tdSql.execute(f"use {self.db}")
+ autoGen.create_stable(self.stb, 5, 10, 8, 8)
+ autoGen.create_child(self.stb, "d", self.childtable_count)
+ autoGen.insert_data(1000)
+ tdSql.execute(f"flush database {self.db}")
+ sc.dnodeStop(3)
+ # clusterDnodes.stoptaosd(1)
+ # clusterDnodes.starttaosd(3)
+ # time.sleep(5)
+ # clusterDnodes.stoptaosd(2)
+ # clusterDnodes.starttaosd(1)
+ # time.sleep(5)
+ autoGen.insert_data(5000, True)
+ tdSql.execute(f"flush database {self.db}")
+
+ # sql = 'show vnodes;'
+ # while True:
+ # bFinish = True
+ # param_list = tdSql.query(sql, row_tag=True)
+ # for param in param_list:
+ # if param[3] == 'leading' or param[3] == 'following':
+ # bFinish = False
+ # break
+ # if bFinish:
+ # break
+ self.snapshotAgg()
+ time.sleep(10)
+ sc.dnodeStopAll()
+ for i in range(1, 4):
+ path = clusterDnodes.getDnodeDir(i)
+ dnodesRootDir = os.path.join(path,"data","vnode", "vnode*")
+ dirs = glob.glob(dnodesRootDir)
+ for dir in dirs:
+ if os.path.isdir(dir):
+ tdLog.debug("delete dir: %s " % (dnodesRootDir))
+ self.remove_directory(os.path.join(dir, "wal"))
+
+ sc.dnodeStart(1)
+ sc.dnodeStart(2)
+ sc.dnodeStart(3)
+ sql = "show vnodes;"
+ time.sleep(10)
+ while True:
+ bFinish = True
+ param_list = tdSql.query(sql, row_tag=True)
+ for param in param_list:
+ if param[3] == 'offline':
+ tdLog.exit(
+ "dnode synchronous fail dnode id: %d, vgroup id:%d status offline" % (param[0], param[1]))
+ if param[3] == 'leading' or param[3] == 'following':
+ bFinish = False
+ break
+ if bFinish:
+ break
+
+ self.timestamp_step = 1
+ self.insert_rows = 6000
+ self.checkInsertCorrect()
+ self.checkAggCorrect()
+
+ def remove_directory(self, directory):
+ try:
+ shutil.rmtree(directory)
+ tdLog.debug("delete dir: %s " % (directory))
+ except OSError as e:
+ tdLog.exit("delete fail dir: %s " % (directory))
+
+ def stop(self):
+ tdSql.close()
+ tdLog.success(f"{__file__} successfully executed")
+
+
+tdCases.addLinux(__file__, TDTestCase())
+tdCases.addWindows(__file__, TDTestCase())
diff --git a/tests/army/community/cluster/splitVgroupByLearner.json b/tests/army/community/cluster/splitVgroupByLearner.json
new file mode 100644
index 0000000000..d02cf50fda
--- /dev/null
+++ b/tests/army/community/cluster/splitVgroupByLearner.json
@@ -0,0 +1,62 @@
+{
+ "filetype": "insert",
+ "cfgdir": "/etc/taos",
+ "host": "127.0.0.1",
+ "port": 6030,
+ "user": "root",
+ "password": "taosdata",
+ "connection_pool_size": 8,
+ "num_of_records_per_req": 3000,
+ "prepared_rand": 3000,
+ "thread_count": 2,
+ "create_table_thread_count": 1,
+ "confirm_parameter_prompt": "no",
+ "continue_if_fail": "yes",
+ "databases": [
+ {
+ "dbinfo": {
+ "name": "db",
+ "drop": "yes",
+ "vgroups": 2,
+ "replica": 3,
+ "duration":"1d",
+ "wal_retention_period": 1,
+ "wal_retention_size": 1,
+ "keep": "3d,6d,30d"
+ },
+ "super_tables": [
+ {
+ "name": "stb",
+ "child_table_exists": "no",
+ "childtable_count": 10,
+ "insert_rows": 100000000,
+ "childtable_prefix": "d",
+ "insert_mode": "taosc",
+ "timestamp_step": 10000,
+ "start_timestamp":"now-12d",
+ "columns": [
+ { "type": "bool", "name": "bc"},
+ { "type": "float", "name": "fc" },
+ { "type": "double", "name": "dc"},
+ { "type": "tinyint", "name": "ti"},
+ { "type": "smallint", "name": "si" },
+ { "type": "int", "name": "ic" },
+ { "type": "bigint", "name": "bi" },
+ { "type": "utinyint", "name": "uti"},
+ { "type": "usmallint", "name": "usi"},
+ { "type": "uint", "name": "ui" },
+ { "type": "ubigint", "name": "ubi"},
+ { "type": "binary", "name": "bin", "len": 16},
+ { "type": "nchar", "name": "nch", "len": 32}
+ ],
+ "tags": [
+ {"type": "tinyint", "name": "groupid","max": 10,"min": 1},
+ {"name": "location","type": "binary", "len": 16, "values":
+ ["San Francisco", "Los Angles", "San Diego", "San Jose", "Palo Alto", "Campbell", "Mountain View","Sunnyvale", "Santa Clara", "Cupertino"]
+ }
+ ]
+ }
+ ]
+ }
+ ]
+}
diff --git a/tests/army/community/cluster/splitVgroupByLearner.py b/tests/army/community/cluster/splitVgroupByLearner.py
new file mode 100644
index 0000000000..5f75db2db5
--- /dev/null
+++ b/tests/army/community/cluster/splitVgroupByLearner.py
@@ -0,0 +1,133 @@
+###################################################################
+# Copyright (c) 2016 by TAOS Technologies, Inc.
+# All rights reserved.
+#
+# This file is proprietary and confidential to TAOS Technologies.
+# No part of this file may be reproduced, stored, transmitted,
+# disclosed or used in any form or by any means other than as
+# expressly provided by the written permission from Jianhui Tao
+#
+###################################################################
+
+# -*- coding: utf-8 -*-
+
+import sys
+import time
+import random
+
+import taos
+import frame
+import frame.etool
+import json
+import threading
+
+from frame.log import *
+from frame.cases import *
+from frame.sql import *
+from frame.caseBase import *
+from frame import *
+from frame.autogen import *
+from frame.srvCtl import *
+
+
+class TDTestCase(TBase):
+
+ def init(self, conn, logSql, replicaVar=1):
+ tdLog.debug(f"start to init {__file__}")
+ self.replicaVar = int(replicaVar)
+ tdSql.init(conn.cursor(), logSql) # output sql.txt file
+ self.configJsonFile('splitVgroupByLearner.json', 'db', 1, 1, 'splitVgroupByLearner.json', 100000)
+
+ def configJsonFile(self, fileName, dbName, vgroups, replica, newFileName='', insert_rows=100000,
+ timestamp_step=10000):
+ tdLog.debug(f"configJsonFile {fileName}")
+ filePath = etool.curFile(__file__, fileName)
+ with open(filePath, 'r') as f:
+ data = json.load(f)
+
+ if len(newFileName) == 0:
+ newFileName = fileName
+
+ data['databases'][0]['dbinfo']['name'] = dbName
+ data['databases'][0]['dbinfo']['vgroups'] = vgroups
+ data['databases'][0]['dbinfo']['replica'] = replica
+ data['databases'][0]['super_tables'][0]['insert_rows'] = insert_rows
+ data['databases'][0]['super_tables'][0]['timestamp_step'] = timestamp_step
+ json_data = json.dumps(data)
+ filePath = etool.curFile(__file__, newFileName)
+ with open(filePath, "w") as file:
+ file.write(json_data)
+
+ tdLog.debug(f"configJsonFile {json_data}")
+
+ def splitVgroupThread(self, configFile, event):
+ # self.insertData(configFile)
+ event.wait()
+ time.sleep(5)
+ tdLog.debug("splitVgroupThread start")
+ tdSql.execute('ALTER DATABASE db REPLICA 3')
+ time.sleep(5)
+ tdSql.execute('use db')
+ rowLen = tdSql.query('show vgroups')
+ if rowLen > 0:
+ vgroupId = tdSql.getData(0, 0)
+ tdLog.debug(f"splitVgroupThread vgroupId:{vgroupId}")
+ tdSql.execute(f"split vgroup {vgroupId}")
+ else:
+ tdLog.exit("get vgroupId fail!")
+ # self.configJsonFile(configFile, 'db1', 1, 1, configFile, 100000000)
+ # self.insertData(configFile)
+
+ def dnodeNodeStopThread(self, event):
+ event.wait()
+ tdLog.debug("dnodeNodeStopThread start")
+ time.sleep(10)
+ on = 2
+ for i in range(5):
+ if i % 2 == 0:
+ on = 2
+ else:
+ on = 3
+ sc.dnodeStop(on)
+ time.sleep(5)
+ sc.dnodeStart(on)
+ time.sleep(5)
+
+ def dbInsertThread(self, configFile, event):
+ tdLog.debug(f"dbInsertThread start {configFile}")
+ self.insertData(configFile)
+
+ event.set()
+ tdLog.debug(f"dbInsertThread first end {event}")
+ self.configJsonFile(configFile, 'db', 2, 3, configFile, 100000)
+ self.insertData(configFile)
+
+ def insertData(self, configFile):
+ tdLog.info(f"insert data.")
+ # taosBenchmark run
+ jfile = etool.curFile(__file__, configFile)
+ etool.benchMark(json=jfile)
+
+ # run
+ def run(self):
+ tdLog.debug(f"start to excute {__file__}")
+ event = threading.Event()
+ t1 = threading.Thread(target=self.splitVgroupThread, args=('splitVgroupByLearner.json', event))
+ t2 = threading.Thread(target=self.dbInsertThread, args=('splitVgroupByLearner.json', event))
+ t3 = threading.Thread(target=self.dnodeNodeStopThread, args=(event))
+ t1.start()
+ t2.start()
+ t3.start()
+ tdLog.debug("threading started!!!!!")
+ t1.join()
+ t2.join()
+ t3.join()
+ tdLog.success(f"{__file__} successfully executed")
+
+ def stop(self):
+ tdSql.close()
+ tdLog.success(f"{__file__} successfully executed")
+
+
+tdCases.addLinux(__file__, TDTestCase())
+tdCases.addWindows(__file__, TDTestCase())
\ No newline at end of file
diff --git a/tests/army/community/cmdline/fullopt.py b/tests/army/community/cmdline/fullopt.py
index 39d1d581ed..d1d4421018 100644
--- a/tests/army/community/cmdline/fullopt.py
+++ b/tests/army/community/cmdline/fullopt.py
@@ -91,8 +91,7 @@ class TDTestCase(TBase):
# -C
etool.exeBinFile("taosd", "-C")
# -k
- rets = etool.runBinFile("taosd", "-C")
- self.checkListNotEmpty(rets)
+ etool.exeBinFile("taosd", "-k", False)
# -V
rets = etool.runBinFile("taosd", "-V")
self.checkListNotEmpty(rets)
diff --git a/tests/army/community/query/cquery_basic.json b/tests/army/community/query/cquery_basic.json
new file mode 100644
index 0000000000..5a57d59d93
--- /dev/null
+++ b/tests/army/community/query/cquery_basic.json
@@ -0,0 +1,61 @@
+{
+ "filetype": "insert",
+ "cfgdir": "/etc/taos",
+ "host": "127.0.0.1",
+ "port": 6030,
+ "user": "root",
+ "password": "taosdata",
+ "connection_pool_size": 8,
+ "num_of_records_per_req": 4000,
+ "prepared_rand": 10000,
+ "thread_count": 3,
+ "create_table_thread_count": 1,
+ "confirm_parameter_prompt": "no",
+ "databases": [
+ {
+ "dbinfo": {
+ "name": "db",
+ "drop": "no",
+ "vgroups": 3,
+ "replica": 3,
+ "duration":"3d",
+ "wal_retention_period": 1,
+ "wal_retention_size": 1,
+ "stt_trigger": 1
+ },
+ "super_tables": [
+ {
+ "name": "stb",
+ "child_table_exists": "yes",
+ "childtable_count": 6,
+ "insert_rows": 50000,
+ "childtable_prefix": "d",
+ "insert_mode": "taosc",
+ "timestamp_step": 60000,
+ "start_timestamp":1700000000000,
+ "columns": [
+ { "type": "bool", "name": "bc"},
+ { "type": "float", "name": "fc" },
+ { "type": "double", "name": "dc"},
+ { "type": "tinyint", "name": "ti"},
+ { "type": "smallint", "name": "si" },
+ { "type": "int", "name": "ic" },
+ { "type": "bigint", "name": "bi" },
+ { "type": "utinyint", "name": "uti"},
+ { "type": "usmallint", "name": "usi"},
+ { "type": "uint", "name": "ui" },
+ { "type": "ubigint", "name": "ubi"},
+ { "type": "binary", "name": "bin", "len": 8},
+ { "type": "nchar", "name": "nch", "len": 16}
+ ],
+ "tags": [
+ {"type": "tinyint", "name": "groupid","max": 10,"min": 1},
+ {"name": "location","type": "binary", "len": 16, "values":
+ ["San Francisco", "Los Angles", "San Diego", "San Jose", "Palo Alto", "Campbell", "Mountain View","Sunnyvale", "Santa Clara", "Cupertino"]
+ }
+ ]
+ }
+ ]
+ }
+ ]
+}
diff --git a/tests/army/community/query/fill/fill_desc.py b/tests/army/community/query/fill/fill_desc.py
new file mode 100644
index 0000000000..bec29c49fd
--- /dev/null
+++ b/tests/army/community/query/fill/fill_desc.py
@@ -0,0 +1,67 @@
+import taos
+import sys
+
+from frame.log import *
+from frame.cases import *
+from frame.sql import *
+from frame.caseBase import *
+from frame import *
+
+class TDTestCase(TBase):
+
+ def init(self, conn, logSql, replicaVar=1):
+ self.replicaVar = int(replicaVar)
+ tdLog.debug(f"start to excute {__file__}")
+ #tdSql.init(conn.cursor())
+ tdSql.init(conn.cursor(), logSql) # output sql.txt file
+
+ def run(self):
+ dbname = "db"
+ stbname = "ocloud_point"
+ tbname = "ocloud_point_170658_3837620225_1701134595725266945"
+
+ tdSql.prepare()
+
+ tdLog.printNoPrefix("==========step1:create table")
+
+ tdSql.execute(
+ f'''create stable if not exists {dbname}.{stbname}
+ (wstart timestamp, point_value float) tags (location binary(64), groupId int)
+ '''
+ )
+
+ tdSql.execute(
+ f'''create table if not exists {dbname}.{tbname} using {dbname}.{stbname} tags("California.SanFrancisco", 2)'''
+ )
+
+ sqls = []
+ for i in range(35, 41):
+ if i == 38 or i == 40:
+ sqls.append(f"insert into {dbname}.{tbname} values('2023-12-26 10:{i}:00.000', null)")
+ else:
+ sqls.append(f"insert into {dbname}.{tbname} values('2023-12-26 10:{i}:00.000', 5.0)")
+
+ # sqls.append(f"insert into {dbname}.{tbname} values('2023-12-26 10:36:00.000', 5.0)")
+ # sqls.append(f"insert into {dbname}.{tbname} values('2023-12-26 10:37:00.000', 5.0)")
+ # sqls.append(f"insert into {dbname}.{tbname} values('2023-12-26 10:38:00.000', null)")
+ # sqls.append(f"insert into {dbname}.{tbname} values('2023-12-26 10:39:00.000', 5.0)")
+ # sqls.append(f"insert into {dbname}.{tbname} values('2023-12-26 10:40:00.000', null)")
+
+
+ tdSql.executes(sqls)
+
+ tdLog.printNoPrefix("==========step3:fill data")
+
+ sql = f"select first(point_value) as pointValue from {dbname}.{tbname} where wstart between '2023-12-26 10:35:00' and '2023-12-26 10:40:00' interval(1M) fill(prev) order by wstart desc limit 100"
+ data = []
+ for i in range(6):
+ row = [5]
+ data.append(row)
+ tdSql.checkDataMem(sql, data)
+
+ def stop(self):
+ tdSql.close()
+ tdLog.success(f"{__file__} successfully executed")
+
+tdCases.addLinux(__file__, TDTestCase())
+tdCases.addWindows(__file__, TDTestCase())
diff --git a/tests/army/community/query/function/test_func_elapsed.py b/tests/army/community/query/function/test_func_elapsed.py
new file mode 100644
index 0000000000..283b66fc3b
--- /dev/null
+++ b/tests/army/community/query/function/test_func_elapsed.py
@@ -0,0 +1,447 @@
+from frame.log import *
+from frame.cases import *
+from frame.sql import *
+from frame.caseBase import *
+from frame import *
+from frame.eos import *
+
+
+class TDTestCase(TBase):
+ """Verify the elapsed function
+ """
+ def init(self, conn, logSql, replicaVar=1):
+ self.replicaVar = int(replicaVar)
+ tdLog.debug("start to execute %s" % __file__)
+ tdSql.init(conn.cursor())
+ self.dbname = 'db'
+ self.table_dic = {
+ "super_table": ["st1", "st2", "st_empty"],
+ "child_table": ["ct1_1", "ct1_2", "ct1_empty", "ct2_1", "ct2_2", "ct2_empty"],
+ "tags_value": [("2023-03-01 15:00:00", 1, 'bj'), ("2023-03-01 15:10:00", 2, 'sh'), ("2023-03-01 15:20:00", 3, 'sz'), ("2023-03-01 15:00:00", 4, 'gz'), ("2023-03-01 15:10:00", 5, 'cd'), ("2023-03-01 15:20:00", 6, 'hz')],
+ "common_table": ["t1", "t2", "t_empty"]
+ }
+ self.start_ts = 1677654000000 # 2023-03-01 15:00:00.000
+ self.row_num = 100
+
+ def prepareData(self):
+ # db
+ tdSql.execute(f"create database {self.dbname};")
+ tdSql.execute(f"use {self.dbname};")
+ tdLog.debug(f"Create database {self.dbname}")
+
+ # commont table
+ for common_table in self.table_dic["common_table"]:
+ tdSql.execute(f"create table {common_table} (ts timestamp, c_ts timestamp, c_int int, c_bigint bigint, c_double double, c_nchar nchar(16));")
+ tdLog.debug("Create common table %s" % common_table)
+
+ # super table
+ for super_table in self.table_dic["super_table"]:
+ tdSql.execute(f"create stable {super_table} (ts timestamp, c_ts timestamp, c_int int, c_bigint bigint, c_double double, c_nchar nchar(16)) tags (t1 timestamp, t2 int, t3 binary(16));")
+ tdLog.debug("Create super table %s" % super_table)
+
+ # child table
+ for i in range(len(self.table_dic["child_table"])):
+ if self.table_dic["child_table"][i].startswith("ct1"):
+ tdSql.execute("create table {} using {} tags('{}', {}, '{}');".format(self.table_dic["child_table"][i], "st1", self.table_dic["tags_value"][i][0], self.table_dic["tags_value"][i][1], self.table_dic["tags_value"][i][2]))
+ elif self.table_dic["child_table"][i].startswith("ct2"):
+ tdSql.execute("create table {} using {} tags('{}', {}, '{}');".format(self.table_dic["child_table"][i], "st2", self.table_dic["tags_value"][i][0], self.table_dic["tags_value"][i][1], self.table_dic["tags_value"][i][2]))
+
+ # insert data
+ table_list = ["t1", "t2", "ct1_1", "ct1_2", "ct2_1", "ct2_2"]
+ for t in table_list:
+ sql = "insert into {} values".format(t)
+ for i in range(self.row_num):
+ sql += "({}, {}, {}, {}, {}, '{}'),".format(self.start_ts + i * 1000, self.start_ts + i * 1000, 32767+i, 65535+i, i, t + str(i))
+ sql += ";"
+ tdSql.execute(sql)
+ tdLog.debug("Insert data into table %s" % t)
+
+ def test_normal_query(self):
+ # only one timestamp
+ tdSql.query("select elapsed(ts) from t1 group by c_ts;")
+ tdSql.checkRows(self.row_num)
+ tdSql.checkData(0, 0, 0)
+
+ tdSql.query("select elapsed(ts, 1m) from t1 group by c_ts;")
+ tdSql.checkRows(self.row_num)
+ tdSql.checkData(0, 0, 0)
+
+ # child table with group by
+ tdSql.query("select elapsed(ts) from ct1_2 group by tbname;")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, 99000)
+
+ # empty super table
+ tdSql.query("select elapsed(ts, 1s) from st_empty group by tbname;")
+ tdSql.checkRows(0)
+
+ # empty child table
+ tdSql.query("select elapsed(ts, 1s) from ct1_empty group by tbname;")
+ tdSql.checkRows(0)
+
+ # empty common table
+ tdSql.query("select elapsed(ts, 1s) from t_empty group by tbname;")
+ tdSql.checkRows(0)
+
+ # unit as second
+ tdSql.query("select elapsed(ts, 1s) from st2 group by tbname;")
+ tdSql.checkRows(2)
+ tdSql.checkData(0, 0, 99)
+
+ # unit as minute
+ tdSql.query("select elapsed(ts, 1m) from st2 group by tbname;")
+ tdSql.checkRows(2)
+ tdSql.checkData(0, 0, 1.65)
+
+ # unit as hour
+ tdSql.query("select elapsed(ts, 1h) from st2 group by tbname;")
+ tdSql.checkRows(2)
+ tdSql.checkData(0, 0, 0.0275)
+
+ def test_query_with_filter(self):
+ end_ts = 1677654000000 + 1000 * 99
+ query_list = [
+ {
+ "sql": "select elapsed(ts, 1s) from st1 where ts >= 1677654000000 group by tbname;",
+ "res": [(99.0, ), (99.0, )]
+ },
+ {
+ "sql": "select elapsed(ts, 1s) from st1 where ts >= 1677654000000 and c_ts >= 1677654000000 group by tbname;",
+ "res": [(99.0, ), (99.0, )]
+ },
+ {
+ "sql": "select elapsed(ts, 1s) from st1 where ts >= 1677654000000 and c_ts >= 1677654000000 and t1='2023-03-01 15:10:00.000' group by tbname;",
+ "res": [(99.0, )]
+ },
+ {
+ "sql": "select elapsed(ts, 1s) from st_empty where ts >= 1677654000000 and c_ts >= 1677654000000 and t1='2023-03-01 15:10:00.000' group by tbname;",
+ "res": []
+ },
+ {
+ "sql": "select elapsed(ts, 1s) from ct1_1 where ts >= 1677654000000 group by tbname;",
+ "res": [(99.0, )]
+ },
+ {
+ "sql": "select elapsed(ts, 1s) from ct1_2 where ts >= 1677654000000 and c_ts >= 1677654000000 group by tbname;",
+ "res": [(99.0, )]
+ },
+ {
+ "sql": "select elapsed(ts, 1s) from ct1_empty where ts >= 1677654000000 and c_ts >= 1677654000000 group by tbname;",
+ "res": []
+ },
+ {
+ "sql": "select elapsed(ts, 1s) from t1 where ts >= 1677654000000 group by tbname;",
+ "res": [(99.0, )]
+ },
+ {
+ "sql": "select elapsed(ts, 1s) from t2 where ts >= 1677654000000 and c_ts >= 1677654000000 group by tbname;",
+ "res": [(99.0, )]
+ },
+ {
+ "sql": "select elapsed(ts, 1s) from t_empty where ts >= 1677654000000 and c_ts >= 1677654000000 group by tbname;",
+ "res": []
+ },
+ {
+ "sql": "select elapsed(ts, 1s) from st2 where ts >= 1677654000000 and c_ts > {} group by tbname;".format(end_ts),
+ "res": []
+ },
+ {
+ "sql": "select elapsed(ts, 1s) from st2 where ts >= 1677654000000 and c_ts > {} and t1='2023-03-01 15:10:00' group by tbname;".format(end_ts),
+ "res": []
+ },
+ {
+ "sql": "select elapsed(ts, 1s) from st2 where ts >= 1677654000000 and c_int < 1 group by tbname;",
+ "res": []
+ },
+ {
+ "sql": "select elapsed(ts, 1s) from st2 where ts >= 1677654000000 and c_int >= 1 and t1='2023-03-01 15:10:00' group by tbname;",
+ "res": [(99,)]
+ },
+ {
+ "sql": "select elapsed(ts, 1s) from st2 where ts >= 1677654000000 and c_int <> 1 and t1='2023-03-01 15:10:00' group by tbname;",
+ "res": [(99,)]
+ },
+ {
+ "sql": "select elapsed(ts, 1s) from st2 where ts >= 1677654000000 and c_nchar like 'ct2_%' and t1='2023-03-01 15:10:00' group by tbname;",
+ "res": [(99,)]
+ },
+ {
+ "sql": "select elapsed(ts, 1s) from st2 where ts >= 1677654000000 and c_nchar like 'ct1_%' and t1='2023-03-01 15:10:00' group by tbname;",
+ "res": []
+ },
+ {
+ "sql": "select elapsed(ts, 1s) from st2 where ts >= 1677654000000 and c_nchar match '^ct2_' and t1='2023-03-01 15:10:00' group by tbname;",
+ "res": [(99,)]
+ },
+ {
+ "sql": "select elapsed(ts, 1s) from st2 where ts >= 1677654000000 and c_nchar nmatch '^ct1_' and t1='2023-03-01 15:10:00' group by tbname;",
+ "res": [(99,)]
+ },
+ {
+ "sql": "select elapsed(ts, 1s) from st2 where ts >= 1677654000000 and t3 like 'g%' group by tbname;",
+ "res": [(99,)]
+ }
+ ]
+ sql_list = []
+ res_list = []
+ for item in query_list:
+ sql_list.append(item["sql"])
+ res_list.append(item["res"])
+ tdSql.queryAndCheckResult(sql_list, res_list)
+
+ def test_query_with_other_function(self):
+ query_list = [
+ {
+ "sql": "select avg(c_int), count(*), elapsed(ts, 1s), leastsquares(c_int, 0, 1), spread(c_bigint), sum(c_int), hyperloglog(c_int) from st1;",
+ "res": [(32816.5, 200, 99.0, '{slop:0.499962, intercept:32766.753731}', 99.0, 6563300, 100)]
+ },
+ {
+ "sql": "select twa(c_int) * elapsed(ts, 1s) from ct1_1;",
+ "res": [(3.248833500000000e+06,)]
+ }
+ ]
+ sql_list = []
+ res_list = []
+ for item in query_list:
+ sql_list.append(item["sql"])
+ res_list.append(item["res"])
+ tdSql.queryAndCheckResult(sql_list, res_list)
+
+ def test_query_with_join(self):
+ query_list = [
+ {
+ "sql": "select elapsed(st1.ts, 1s) from st1, st2 where st1.ts = st2.ts;",
+ "res": [(99,)]
+ },
+ {
+ "sql": "select elapsed(st1.ts, 1s) from st1, st_empty where st1.ts = st_empty.ts and st1.c_ts = st_empty.c_ts;",
+ "res": []
+ },
+ {
+ "sql": "select elapsed(st1.ts, 1s) from st1, ct1_1 where st1.ts = ct1_1.ts;",
+ "res": [(99,)]
+ },
+ {
+ "sql": "select elapsed(ct1.ts, 1s) from ct1_1 ct1, ct1_2 ct2 where ct1.ts = ct2.ts;",
+ "res": [(99,)]
+ },
+ {
+ "sql": "select elapsed(ct1.ts, 1s) from ct1_1 ct1, ct1_empty ct2 where ct1.ts = ct2.ts;",
+ "res": []
+ },
+ {
+ "sql": "select elapsed(st1.ts, 1s) from st1, ct1_empty where st1.ts = ct1_empty.ts;",
+ "res": []
+ },
+ {
+ "sql": "select elapsed(st1.ts, 1s) from st1, t1 where st1.ts = t1.ts;",
+ "res": [(99,)]
+ },
+ {
+ "sql": "select elapsed(st1.ts, 1s) from st1, t_empty where st1.ts = t_empty.ts;",
+ "res": []
+ },
+ {
+ "sql": "select elapsed(ct1.ts, 1s) from ct1_1 ct1, t1 t2 where ct1.ts = t2.ts;",
+ "res": [(99,)]
+ },
+ {
+ "sql": "select elapsed(ct1.ts, 1s) from ct1_1 ct1, t_empty t2 where ct1.ts = t2.ts;",
+ "res": []
+ },
+ {
+ "sql": "select elapsed(st1.ts, 1s) from st1, st2, st_empty where st1.ts=st2.ts and st2.ts=st_empty.ts;",
+ "res": []
+ }
+ ]
+ sql_list = []
+ res_list = []
+ for item in query_list:
+ sql_list.append(item["sql"])
+ res_list.append(item["res"])
+ tdSql.queryAndCheckResult(sql_list, res_list)
+
+ def test_query_with_union(self):
+ query_list = [
+ {
+ "sql": "select elapsed(ts, 1s) from st1 union select elapsed(ts, 1s) from st2;",
+ "res": [(99,)]
+ },
+ {
+ "sql": "select elapsed(ts, 1s) from st1 union all select elapsed(ts, 1s) from st2;",
+ "res": [(99,),(99,)]
+ },
+ {
+ "sql": "select elapsed(ts, 1s) from st1 union all select elapsed(ts, 1s) from st_empty;",
+ "res": [(99,)]
+ },
+ {
+ "sql": "select elapsed(ts, 1s) from ct1_1 union all select elapsed(ts, 1s) from ct1_2;",
+ "res": [(99,),(99,)]
+ },
+ {
+ "sql": "select elapsed(ts, 1s) from ct1_1 union select elapsed(ts, 1s) from ct1_2;",
+ "res": [(99,)]
+ },
+ {
+ "sql": "select elapsed(ts, 1s) from ct1_1 union select elapsed(ts, 1s) from ct1_empty;",
+ "res": [(99,)]
+ },
+ {
+ "sql": "select elapsed(ts, 1s) from st1 where ts < '2023-03-01 15:05:00.000' union select elapsed(ts, 1s) from ct1_1 where ts >= '2023-03-01 15:01:00.000';",
+ "res": [(39,),(99,)]
+ },
+ {
+ "sql": "select elapsed(ts, 1s) from ct1_empty union select elapsed(ts, 1s) from t_empty;",
+ "res": []
+ },
+ {
+ "sql": "select elapsed(ts, 1s) from st1 group by tbname union select elapsed(ts, 1s) from st2 group by tbname;",
+ "res": [(99,)]
+ },
+ {
+ "sql": "select elapsed(ts, 1s) from st1 group by tbname union all select elapsed(ts, 1s) from st2 group by tbname;",
+ "res": [(99,),(99,),(99,),(99,)]
+ },
+ {
+ "sql": "select elapsed(ts, 1s) from st_empty group by tbname union all select elapsed(ts, 1s) from st2 group by tbname;",
+ "res": [(99,),(99,)]
+ },
+ {
+ "sql": "select elapsed(ts, 1s) from t1 where ts between '2023-03-01 15:00:00.000' and '2023-03-01 15:01:40.000' interval(10s) fill(next) union select elapsed(ts, 1s) from st2 where ts between '2023-03-01 15:00:00.000' and '2023-03-01 15:01:49.000' interval(5s) fill(prev);",
+ "res": [(9,), (None,), (4,), (5,),(10,)]
+ },
+ {
+ "sql": "select elapsed(ts, 1s) from st1 group by tbname union select elapsed(ts, 1s) from st2 group by tbname union select elapsed(ts, 1s) from st_empty group by tbname;",
+ "res": [(99,)]
+ }
+ ]
+ sql_list = []
+ res_list = []
+ for item in query_list:
+ sql_list.append(item["sql"])
+ res_list.append(item["res"])
+ tdSql.queryAndCheckResult(sql_list, res_list)
+
+ def test_query_with_window(self):
+ query_list = [
+ {
+ "sql": "select elapsed(ts, 1s) from st1 where ts between '2023-03-01 15:00:00.000' and '2023-03-01 15:00:20.000' interval(10s) fill(next);",
+ "res": [(10,),(10,)()]
+ },
+ {
+ "sql": "select elapsed(ts, 1s) from (select * from st1 where ts between '2023-03-01 15:00:00.000' and '2023-03-01 15:01:20.000' and c_int > 100) where ts >= '2023-03-01 15:01:00.000' and ts < '2023-03-01 15:02:00.000' interval(10s) fill(prev);",
+ "res": [(10,)(10,)(),(),(),()]
+ },
+ {
+ "sql": "select elapsed(ts, 1s) from st1 where ts between '2023-03-01 15:00:00.000' and '2023-03-01 15:00:20.000' session(ts, 2s);",
+ "res": [(20,)]
+ },
+ {
+ "sql": "select elapsed(ts, 1s) from st_empty where ts between '2023-03-01 15:00:00.000' and '2023-03-01 15:00:20.000' session(ts, 2s);",
+ "res": []
+ }
+ ]
+ sql_list = []
+ res_list = []
+ for item in query_list:
+ sql_list.append(item["sql"])
+ res_list.append(item["res"])
+ tdSql.queryAndCheckResult(sql_list, res_list)
+
+ def test_nested_query(self):
+ query_list = [
+ {
+ "sql": "select elapsed(ts, 1s) from (select * from st1 where c_int > 10 and ts between '2023-03-01 15:00:00.000' and '2023-03-01 15:01:40.000');",
+ "res": [(99,)]
+ },
+ {
+ "sql": "select sum(v) from (select elapsed(ts, 1s) as v from st1 where ts between '2023-03-01 15:00:00.000' and '2023-03-01 15:00:20.000' interval(10s) fill(next));",
+ "res": [(20,)]
+ },
+ {
+ "sql": "select avg(v) from (select elapsed(ts, 1s) as v from st2 group by tbname order by v);",
+ "res": [(99,)]
+ },
+ {
+ "sql": "select elapsed(ts, 1s) from (select * from st1 where ts between '2023-03-01 15:00:00.000' and '2023-03-01 15:01:40.000') where c_int > 10;",
+ "res": [(99,)]
+ },
+ {
+ "sql": "select elapsed(ts, 1s) from (select * from st1 where c_int > 10 and ts between '2023-03-01 15:00:00.000' and '2023-03-01 15:01:40.000') where c_int < 20;",
+ "res": []
+ }
+ ]
+ sql_list = []
+ res_list = []
+ for item in query_list:
+ sql_list.append(item["sql"])
+ res_list.append(item["res"])
+ tdSql.queryAndCheckResult(sql_list, res_list)
+
+ def test_abnormal_query(self):
+ # incorrect parameter
+ table_list = self.table_dic["super_table"] + self.table_dic["child_table"] + self.table_dic["common_table"]
+ incorrect_parameter_list = ["()", "(null)", "(*)", "(c_ts)", "(c_ts, 1s)", "(c_int)", "(c_bigint)", "(c_double)", "(c_nchar)", "(ts, null)",
+ "(ts, *)", "(2024-01-09 17:00:00)", "(2024-01-09 17:00:00, 1s)", "(t1)", "(t1, 1s)", "(t2)", "(t3)"]
+ for table in table_list:
+ for param in incorrect_parameter_list:
+ if table.startswith("st"):
+ tdSql.error("select elapsed{} from {} group by tbname order by ts;".format(param, table))
+ else:
+ tdSql.error("select elapsed{} from {};".format(param, table))
+ tdSql.error("select elapsed{} from {} group by ".format(param, table))
+
+ # query with unsupported function, like leastsquares、diff、derivative、top、bottom、last_row、interp
+ unsupported_sql_list = [
+ "select elapsed(leastsquares(c_int, 1, 2)) from st1 group by tbname;",
+ "select elapsed(diff(ts)) from st1;",
+ "select elapsed(derivative(ts, 1s, 1)) from st1 group by tbname order by ts;",
+ "select elapsed(top(ts, 5)) from st1 group by tbname order by ts;",
+ "select top(elapsed(ts), 5) from st1 group by tbname order by ts;",
+ "select elapsed(bottom(ts)) from st1 group by tbname order by ts;",
+ "select bottom(elapsed(ts)) from st1 group by tbname order by ts;",
+ "select elapsed(last_row(ts)) from st1 group by tbname order by ts;",
+ "select elapsed(interp(ts, 0)) from st1 group by tbname order by ts;"
+ ]
+ tdSql.errors(unsupported_sql_list)
+
+ # nested aggregate function
+ nested_sql_list = [
+ "select avg(elapsed(ts, 1s)) from st1 group by tbname order by ts;",
+ "select elapsed(avg(ts), 1s) from st1 group by tbname order by ts;",
+ "select elapsed(sum(ts), 1s) from st1 group by tbname order by ts;",
+ "select elapsed(count(ts), 1s) from st1 group by tbname order by ts;",
+ "select elapsed(min(ts), 1s) from st1 group by tbname order by ts;",
+ "select elapsed(max(ts), 1s) from st1 group by tbname order by ts;",
+ "select elapsed(first(ts), 1s) from st1 group by tbname order by ts;",
+ "select elapsed(last(ts), 1s) from st1 group by tbname order by ts;"
+ ]
+ tdSql.errors(nested_sql_list)
+
+ # other error
+ other_sql_list = [
+ "select elapsed(ts, 1s) from t1 where ts between '2023-03-01 15:00:00.000' and '2023-03-01 15:01:40.000' interval(10s) fill(next) union select elapsed(ts, 1s) from st2 where ts between '2023-03-01 15:00:00.000' and '2023-03-01 15:01:49.000' interval(5s) fill(prev) group by tbname;",
+ "select elapsed(time ,1s) from (select elapsed(ts,1s) time from st1);",
+ "select elapsed(ts , 1s) from (select elapsed(ts, 1s) ts from st2);",
+ "select elapsed(time, 1s) from (select elapsed(ts, 1s) time from st1 group by tbname);",
+ "select elapsed(ts , 1s) from (select elapsed(ts, 1s) ts from st2 group by tbname);",
+ "select elapsed(ts, 1s) from (select * from st1 where ts between '2023-03-01 15:00:00.000' and '2023-03-01 15:01:40.000' interval(10s) fill(next)) where c_int > 10;"
+ ]
+ tdSql.errors(other_sql_list)
+
+ def run(self):
+ self.prepareData()
+ self.test_normal_query()
+ self.test_query_with_filter()
+ self.test_query_with_other_function()
+ self.test_query_with_join()
+ self.test_query_with_union()
+ self.test_abnormal_query()
+
+ def stop(self):
+ tdSql.close()
+ tdLog.success("%s successfully executed" % __file__)
+
+tdCases.addWindows(__file__, TDTestCase())
+tdCases.addLinux(__file__, TDTestCase())
diff --git a/tests/army/community/query/query_basic.json b/tests/army/community/query/query_basic.json
index c6a3482cd4..d8d47266f9 100644
--- a/tests/army/community/query/query_basic.json
+++ b/tests/army/community/query/query_basic.json
@@ -32,7 +32,7 @@
"childtable_prefix": "d",
"insert_mode": "taosc",
"timestamp_step": 30000,
- "start_timestamp":"2023-10-01 10:00:00",
+ "start_timestamp":1700000000000,
"columns": [
{ "type": "bool", "name": "bc"},
{ "type": "float", "name": "fc" },
diff --git a/tests/army/community/query/query_basic.py b/tests/army/community/query/query_basic.py
index 90916a1c6c..bfe88e483e 100644
--- a/tests/army/community/query/query_basic.py
+++ b/tests/army/community/query/query_basic.py
@@ -34,23 +34,170 @@ class TDTestCase(TBase):
"querySmaOptimize": "1"
}
+
def insertData(self):
tdLog.info(f"insert data.")
# taosBenchmark run
jfile = etool.curFile(__file__, "query_basic.json")
- etool.benchMark(json=jfile)
+ etool.benchMark(json = jfile)
tdSql.execute(f"use {self.db}")
tdSql.execute("select database();")
- # set insert data information
+ # come from query_basic.json
self.childtable_count = 6
self.insert_rows = 100000
self.timestamp_step = 30000
+ self.start_timestamp = 1700000000000
+
+ # write again disorder
+ self.flushDb()
+ jfile = etool.curFile(__file__, "cquery_basic.json")
+ etool.benchMark(json = jfile)
+
+
+ def genTime(self, preCnt, cnt):
+ start = self.start_timestamp + preCnt * self.timestamp_step
+ end = start + self.timestamp_step * cnt
+ return (start, end)
+
+
+ def doWindowQuery(self):
+ pre = f"select count(ts) from {self.stb} "
+ # case1 operator "in" "and" is same
+ cnt = 6000
+ s,e = self.genTime(12000, cnt)
+ sql1 = f"{pre} where ts between {s} and {e} "
+ sql2 = f"{pre} where ts >= {s} and ts <={e} "
+ expectCnt = (cnt + 1) * self.childtable_count
+ tdSql.checkFirstValue(sql1, expectCnt)
+ tdSql.checkFirstValue(sql2, expectCnt)
+
+ # case2 no overloap "or" left
+ cnt1 = 120
+ s1, e1 = self.genTime(4000, cnt1)
+ cnt2 = 3000
+ s2, e2 = self.genTime(10000, cnt2)
+ sql = f"{pre} where (ts >= {s1} and ts < {e1}) or (ts >= {s2} and ts < {e2})"
+ expectCnt = (cnt1 + cnt2) * self.childtable_count
+ tdSql.checkFirstValue(sql, expectCnt)
+
+ # case3 overloap "or" right
+ cnt1 = 300
+ s1, e1 = self.genTime(17000, cnt1)
+ cnt2 = 8000
+ s2, e2 = self.genTime(70000, cnt2)
+ sql = f"{pre} where (ts > {s1} and ts <= {e1}) or (ts > {s2} and ts <= {e2})"
+ expectCnt = (cnt1 + cnt2) * self.childtable_count
+ tdSql.checkFirstValue(sql, expectCnt)
+
+ # case4 overloap "or"
+ cnt1 = 1000
+ s1, e1 = self.genTime(9000, cnt1)
+ cnt2 = 1000
+ s2, e2 = self.genTime(9000 + 500 , cnt2)
+ sql = f"{pre} where (ts > {s1} and ts <= {e1}) or (ts > {s2} and ts <= {e2})"
+ expectCnt = (cnt1 + 500) * self.childtable_count # expect=1500
+ tdSql.checkFirstValue(sql, expectCnt)
+
+ # case5 overloap "or" boundary hollow->solid
+ cnt1 = 3000
+ s1, e1 = self.genTime(45000, cnt1)
+ cnt2 = 2000
+ s2, e2 = self.genTime(45000 + cnt1 , cnt2)
+ sql = f"{pre} where (ts > {s1} and ts <= {e1}) or (ts > {s2} and ts <= {e2})"
+ expectCnt = (cnt1+cnt2) * self.childtable_count
+ tdSql.checkFirstValue(sql, expectCnt)
+
+ # case6 overloap "or" boundary solid->solid
+ cnt1 = 300
+ s1, e1 = self.genTime(55000, cnt1)
+ cnt2 = 500
+ s2, e2 = self.genTime(55000 + cnt1 , cnt2)
+ sql = f"{pre} where (ts >= {s1} and ts <= {e1}) or (ts >= {s2} and ts <= {e2})"
+ expectCnt = (cnt1+cnt2+1) * self.childtable_count
+ tdSql.checkFirstValue(sql, expectCnt)
+
+ # case7 overloap "and"
+ cnt1 = 1000
+ s1, e1 = self.genTime(40000, cnt1)
+ cnt2 = 1000
+ s2, e2 = self.genTime(40000 + 500 , cnt2)
+ sql = f"{pre} where (ts > {s1} and ts <= {e1}) and (ts > {s2} and ts <= {e2})"
+ expectCnt = cnt1/2 * self.childtable_count
+ tdSql.checkFirstValue(sql, expectCnt)
+
+ # case8 overloap "and" boundary hollow->solid solid->hollow
+ cnt1 = 3000
+ s1, e1 = self.genTime(45000, cnt1)
+ cnt2 = 2000
+ s2, e2 = self.genTime(45000 + cnt1 , cnt2)
+ sql = f"{pre} where (ts > {s1} and ts <= {e1}) and (ts >= {s2} and ts < {e2})"
+ expectCnt = 1 * self.childtable_count
+ tdSql.checkFirstValue(sql, expectCnt)
+
+ # case9 no overloap "and"
+ cnt1 = 6000
+ s1, e1 = self.genTime(20000, cnt1)
+ cnt2 = 300
+ s2, e2 = self.genTime(70000, cnt2)
+ sql = f"{pre} where (ts > {s1} and ts <= {e1}) and (ts >= {s2} and ts <= {e2})"
+ expectCnt = 0
+ tdSql.checkFirstValue(sql, expectCnt)
+
+ # case10 cnt1 contain cnt2 and
+ cnt1 = 5000
+ s1, e1 = self.genTime(25000, cnt1)
+ cnt2 = 400
+ s2, e2 = self.genTime(28000, cnt2)
+ sql = f"{pre} where (ts > {s1} and ts <= {e1}) and (ts >= {s2} and ts < {e2})"
+ expectCnt = cnt2 * self.childtable_count
+ tdSql.checkFirstValue(sql, expectCnt)
+
+
+ def queryMax(self, colname):
+ sql = f"select max({colname}) from {self.stb}"
+ tdSql.query(sql)
+ return tdSql.getData(0, 0)
+
+
+ def checkMax(self):
+ # max for tsdbRetrieveDatablockSMA2 coverage
+ colname = "ui"
+ max = self.queryMax(colname)
+
+ # insert over max
+ sql = f"insert into d0(ts, {colname}) values"
+ for i in range(1, 5):
+ sql += f" (now + {i}s, {max+i})"
+ tdSql.execute(sql)
+ self.flushDb()
+
+ expectMax = max + 4
+ for i in range(1, 5):
+ realMax = self.queryMax(colname)
+ if realMax != expectMax:
+ tdLog.exit(f"Max value not expect. expect:{expectMax} real:{realMax}")
+
+ # query ts list
+ sql = f"select ts from d0 where ui={expectMax}"
+ tdSql.query(sql)
+ tss = tdSql.getColData(0)
+ for ts in tss:
+ # delete
+ sql = f"delete from d0 where ts = '{ts}'"
+ tdSql.execute(sql)
+ expectMax -= 1
+
+ self.checkInsertCorrect()
def doQuery(self):
tdLog.info(f"do query.")
-
+ self.doWindowQuery()
+
+ # max
+ self.checkMax()
+
# __group_key
sql = f"select count(*),_group_key(uti),uti from {self.stb} partition by uti"
tdSql.query(sql)
@@ -76,6 +223,201 @@ class TDTestCase(TBase):
sql2 = "select bi from stb where bi is not null order by bi desc limit 10;"
self.checkSameResult(sql1, sql2)
+ # distributed expect values
+ expects = {
+ "Block_Rows" : 6*100000,
+ "Total_Tables" : 6,
+ "Total_Vgroups" : 3
+ }
+ self.waitTransactionZero()
+ reals = self.getDistributed(self.stb)
+ for k in expects.keys():
+ v = expects[k]
+ if int(reals[k]) != v:
+ tdLog.exit(f"distribute {k} expect: {v} real: {reals[k]}")
+
+ def checkNull(self):
+ # abs unique concat_ws
+ ts = self.start_timestamp + 1
+ sql = f"insert into {self.db}.d0(ts) values({ts})"
+ tdSql.execute(sql)
+ sql = f'''select abs(fc),
+ unique(ic),
+ concat_ws(',',bin,nch),
+ timetruncate(bi,1s,0),
+ timediff(ic,bi,1s),
+ to_timestamp(nch,'yyyy-mm-dd hh:mi:ss.ms.us.ns')
+ from {self.db}.d0 where ts={ts}'''
+ tdSql.query(sql)
+ tdSql.checkData(0, 0, "None")
+ tdSql.checkData(0, 1, "None")
+ tdSql.checkData(0, 2, "None")
+ tdSql.checkData(0, 3, "None")
+ tdSql.checkData(0, 4, "None")
+
+
+ # substr from 0 start
+ sql1 = f"select substr(bin,1) from {self.db}.d0 order by ts desc limit 100"
+ sql2 = f"select bin from {self.db}.d0 order by ts desc limit 100"
+ self.checkSameResult(sql1, sql2)
+ #substr error input pos is zero
+ sql = f"select substr(bin,0,3) from {self.db}.d0 order by ts desc limit 100"
+ tdSql.error(sql)
+
+ # cast
+ nch = 99
+ sql = f"insert into {self.db}.d0(ts, nch) values({ts}, '{nch}')"
+ tdSql.execute(sql)
+ sql = f"select cast(nch as tinyint), \
+ cast(nch as tinyint unsigned), \
+ cast(nch as smallint), \
+ cast(nch as smallint unsigned), \
+ cast(nch as int unsigned), \
+ cast(nch as bigint unsigned), \
+ cast(nch as float), \
+ cast(nch as double), \
+ cast(nch as bool) \
+ from {self.db}.d0 where ts={ts}"
+ row = [nch, nch, nch, nch, nch, nch, nch, nch, True]
+ tdSql.checkDataMem(sql, [row])
+
+ # cast string is zero
+ ts += 1
+ sql = f"insert into {self.db}.d0(ts, nch) values({ts}, 'abcd')"
+ tdSql.execute(sql)
+ sql = f"select cast(nch as tinyint) from {self.db}.d0 where ts={ts}"
+ tdSql.checkFirstValue(sql, 0)
+
+ # iso8601
+ sql = f'select ts,to_iso8601(ts,"Z"),to_iso8601(ts,"+08"),to_iso8601(ts,"-08") from {self.db}.d0 where ts={self.start_timestamp}'
+ row = ['2023-11-15 06:13:20.000','2023-11-14T22:13:20.000Z','2023-11-15T06:13:20.000+08','2023-11-14T14:13:20.000-08']
+ tdSql.checkDataMem(sql, [row])
+
+ # constant expr funciton
+
+ # count
+ sql = f"select count(1),count(null) from {self.db}.d0"
+ tdSql.checkDataMem(sql, [[self.insert_rows+2, 0]])
+
+ row = [10, 11.0, "None", 2]
+ # sum
+ sql = "select sum(1+9),sum(1.1 + 9.9),sum(null),sum(4/2);"
+ tdSql.checkDataMem(sql, [row])
+ # min
+ sql = "select min(1+9),min(1.1 + 9.9),min(null),min(4/2);"
+ tdSql.checkDataMem(sql, [row])
+ # max
+ sql = "select max(1+9),max(1.1 + 9.9),max(null),max(4/2);"
+ tdSql.checkDataMem(sql, [row])
+ # avg
+ sql = "select avg(1+9),avg(1.1 + 9.9),avg(null),avg(4/2);"
+ tdSql.checkDataMem(sql, [row])
+ # stddev
+ sql = "select stddev(1+9),stddev(1.1 + 9.9),stddev(null),stddev(4/2);"
+ tdSql.checkDataMem(sql, [[0, 0.0, "None", 0]])
+ # leastsquares
+ sql = "select leastsquares(100,2,1), leastsquares(100.2,2.1,1);"
+ tdSql.query(sql)
+ # derivative
+ sql = "select derivative(190999,38.3,1);"
+ tdSql.checkFirstValue(sql, 0.0)
+ # irate
+ sql = "select irate(0);"
+ tdSql.checkFirstValue(sql, 0.0)
+ # diff
+ sql = "select diff(0);"
+ tdSql.checkFirstValue(sql, 0.0)
+ # twa
+ sql = "select twa(10);"
+ tdSql.checkFirstValue(sql, 10.0)
+ # mavg
+ sql = "select mavg(5,10);"
+ tdSql.checkFirstValue(sql, 5)
+ # mavg
+ sql = "select mavg(5,10);"
+ tdSql.checkFirstValue(sql, 5)
+ # mavg
+ sql = "select csum(4+9);"
+ tdSql.checkFirstValue(sql, 13)
+ # tail
+ sql = "select tail(1+9,1),tail(1.1 + 9.9,2),tail(null,3),tail(8/4,3);"
+ tdSql.error(sql)
+ sql = "select tail(4+9, 3);"
+ tdSql.checkFirstValue(sql, 13)
+ sql = "select tail(null, 1);"
+ tdSql.checkFirstValue(sql, "None")
+ # top
+ sql = "select top(4+9, 3);"
+ tdSql.checkFirstValue(sql, 13)
+ sql = "select top(9.9, 3);"
+ tdSql.checkFirstValue(sql, 9.9)
+ sql = "select top(null, 1);"
+ tdSql.error(sql)
+ # bottom
+ sql = "select bottom(4+9, 3);"
+ tdSql.checkFirstValue(sql, 13)
+ sql = "select bottom(9.9, 3);"
+ tdSql.checkFirstValue(sql, 9.9)
+
+ ops = ['GE', 'GT', 'LE', 'LT', 'EQ', 'NE']
+ vals = [-1, -1, 1, 1, -1, 1]
+ cnt = len(ops)
+ for i in range(cnt):
+ # statecount
+ sql = f"select statecount(99,'{ops[i]}',100);"
+ tdSql.checkFirstValue(sql, vals[i])
+ sql = f"select statecount(9.9,'{ops[i]}',11.1);"
+ tdSql.checkFirstValue(sql, vals[i])
+ # stateduration
+ sql = f"select stateduration(99,'{ops[i]}',100,1s);"
+ #tdSql.checkFirstValue(sql, vals[i]) bug need fix
+ tdSql.execute(sql)
+ sql = f"select stateduration(9.9,'{ops[i]}',11.1,1s);"
+ #tdSql.checkFirstValue(sql, vals[i]) bug need fix
+ tdSql.execute(sql)
+ sql = "select statecount(9,'EQAAAA',10);"
+ tdSql.error(sql)
+
+ # histogram check crash
+ sqls = [
+ 'select histogram(200,"user_input","[10, 50, 200]",0);',
+ 'select histogram(22.2,"user_input","[1.01, 5.01, 200.1]",0);',
+ 'select histogram(200,"linear_bin",\'{"start": 0.0,"width": 5.0, "count": 5, "infinity": true}\',0)',
+ 'select histogram(200.2,"linear_bin",\'{"start": 0.0,"width": 5.01, "count": 5, "infinity": true}\',0)',
+ 'select histogram(200,"log_bin",\'{"start":1.0, "factor": 2.0, "count": 5, "infinity": true}\',0)',
+ 'select histogram(200.2,"log_bin",\'{"start":1.0, "factor": 2.0, "count": 5, "infinity": true}\',0)'
+ ]
+ tdSql.executes(sqls)
+ # errors check
+ sql = 'select histogram(200.2,"log_bin",\'start":1.0, "factor: 2.0, "count": 5, "infinity": true}\',0)'
+ tdSql.error(sql)
+ sql = 'select histogram("200.2","log_bin",\'start":1.0, "factor: 2.0, "count": 5, "infinity": true}\',0)'
+ tdSql.error(sql)
+
+ # first last
+ sql = "select first(100-90-1),last(2*5),first(11.1),last(22.2)"
+ tdSql.checkDataMem(sql, [[9, 10, 11.1, 22.2]])
+
+ # sample
+ sql = "select sample(6, 1);"
+ tdSql.checkFirstValue(sql, 6)
+
+ # spread
+ sql = "select spread(12);"
+ tdSql.checkFirstValue(sql, 0)
+
+ # percentile
+ sql = "select percentile(10.1,100);"
+ tdSql.checkFirstValue(sql, 10.1)
+ sql = "select percentile(10, 0);"
+ tdSql.checkFirstValue(sql, 10)
+ sql = "select percentile(100, 60, 70, 80);"
+ tdSql.execute(sql)
+
+ # apercentile
+ sql = "select apercentile(10.1,100);"
+ tdSql.checkFirstValue(sql, 10.1)
+
# run
def run(self):
tdLog.debug(f"start to excute {__file__}")
@@ -92,6 +434,9 @@ class TDTestCase(TBase):
# do action
self.doQuery()
+ # check null
+ self.checkNull()
+
tdLog.success(f"{__file__} successfully executed")
diff --git a/tests/army/enterprise/s3/s3_basic.py b/tests/army/enterprise/s3/s3_basic.py
index 976ad85747..a1a945a304 100644
--- a/tests/army/enterprise/s3/s3_basic.py
+++ b/tests/army/enterprise/s3/s3_basic.py
@@ -128,7 +128,7 @@ class TDTestCase(TBase):
self.checkInsertCorrect()
# check stream correct and drop stream
- self.checkStreamCorrect()
+ # self.checkStreamCorrect()
# drop stream
self.dropStream(self.sname)
diff --git a/tests/army/frame/autogen.py b/tests/army/frame/autogen.py
index 1e041f633d..d1f02e7865 100644
--- a/tests/army/frame/autogen.py
+++ b/tests/army/frame/autogen.py
@@ -162,14 +162,19 @@ class AutoGen:
tdLog.info(f" insert data i={i}")
values = ""
- tdLog.info(f" insert child data {child_name} finished, insert rows={cnt}")
+ tdLog.info(f" insert child data {child_name} finished, insert rows={cnt}")
+ return ts
- # insert data
- def insert_data(self, cnt):
+ def insert_data(self, cnt, bContinue=False):
+ if not bContinue:
+ self.ts = 1600000000000
+
+ currTs = 1600000000000
for i in range(self.child_cnt):
name = f"{self.child_name}{i}"
- self.insert_data_child(name, cnt, self.batch_size, 1)
+ currTs = self.insert_data_child(name, cnt, self.batch_size, 1)
+ self.ts = currTs
tdLog.info(f" insert data ok, child table={self.child_cnt} insert rows={cnt}")
# insert same timestamp to all childs
diff --git a/tests/army/frame/caseBase.py b/tests/army/frame/caseBase.py
index b1500b69e1..2959cf54a1 100644
--- a/tests/army/frame/caseBase.py
+++ b/tests/army/frame/caseBase.py
@@ -29,7 +29,7 @@ class TBase:
#
# init
- def init(self, conn, logSql, replicaVar=1):
+ def init(self, conn, logSql, replicaVar=1, db="db", stb="stb", checkColName="ic"):
# save param
self.replicaVar = int(replicaVar)
tdSql.init(conn.cursor(), True)
@@ -41,14 +41,14 @@ class TBase:
self.mLevelDisk = 0
# test case information
- self.db = "db"
- self.stb = "stb"
+ self.db = db
+ self.stb = stb
# sql
- self.sqlSum = f"select sum(ic) from {self.stb}"
- self.sqlMax = f"select max(ic) from {self.stb}"
- self.sqlMin = f"select min(ic) from {self.stb}"
- self.sqlAvg = f"select avg(ic) from {self.stb}"
+ self.sqlSum = f"select sum({checkColName}) from {self.stb}"
+ self.sqlMax = f"select max({checkColName}) from {self.stb}"
+ self.sqlMin = f"select min({checkColName}) from {self.stb}"
+ self.sqlAvg = f"select avg({checkColName}) from {self.stb}"
self.sqlFirst = f"select first(ts) from {self.stb}"
self.sqlLast = f"select last(ts) from {self.stb}"
@@ -136,7 +136,7 @@ class TBase:
tdSql.checkAgg(sql, self.childtable_count)
# check step
- sql = f"select * from (select diff(ts) as dif from {self.stb} partition by tbname) where dif != {self.timestamp_step}"
+ sql = f"select * from (select diff(ts) as dif from {self.stb} partition by tbname order by ts desc) where dif != {self.timestamp_step}"
tdSql.query(sql)
tdSql.checkRows(0)
@@ -229,9 +229,9 @@ class TBase:
#
# get vgroups
- def getVGroup(self, db_name):
+ def getVGroup(self, dbName):
vgidList = []
- sql = f"select vgroup_id from information_schema.ins_vgroups where db_name='{db_name}'"
+ sql = f"select vgroup_id from information_schema.ins_vgroups where db_name='{dbName}'"
res = tdSql.getResult(sql)
rows = len(res)
for i in range(rows):
@@ -239,6 +239,29 @@ class TBase:
return vgidList
+ # get distributed rows
+ def getDistributed(self, tbName):
+ sql = f"show table distributed {tbName}"
+ tdSql.query(sql)
+ dics = {}
+ i = 0
+ for i in range(tdSql.getRows()):
+ row = tdSql.getData(i, 0)
+ #print(row)
+ row = row.replace('[', '').replace(']', '')
+ #print(row)
+ items = row.split(' ')
+ #print(items)
+ for item in items:
+ #print(item)
+ v = item.split('=')
+ #print(v)
+ if len(v) == 2:
+ dics[v[0]] = v[1]
+ if i > 5:
+ break
+ print(dics)
+ return dics
#
@@ -269,3 +292,15 @@ class TBase:
if len(lists) == 0:
tdLog.exit(f"list is empty {tips}")
+
+#
+# str util
+#
+ # covert list to sql format string
+ def listSql(self, lists, sepa = ","):
+ strs = ""
+ for ls in lists:
+ if strs != "":
+ strs += sepa
+ strs += f"'{ls}'"
+ return strs
\ No newline at end of file
diff --git a/tests/army/frame/server/cluster.py b/tests/army/frame/server/cluster.py
index aba2d2e630..d514bfd9d5 100644
--- a/tests/army/frame/server/cluster.py
+++ b/tests/army/frame/server/cluster.py
@@ -13,23 +13,25 @@ from frame.common import *
class ClusterDnodes(TDDnodes):
"""rewrite TDDnodes and make MyDdnodes as TDDnodes child class"""
- def __init__(self ,dnodes_lists):
-
+ def __init__(self):
super(ClusterDnodes,self).__init__()
- self.dnodes = dnodes_lists # dnode must be TDDnode instance
self.simDeployed = False
self.testCluster = False
self.valgrind = 0
self.killValgrind = 1
+ def init(self, dnodes_lists, deployPath, masterIp):
+ self.dnodes = dnodes_lists # dnode must be TDDnode instance
+ super(ClusterDnodes, self).init(deployPath, masterIp)
+ self.model = "cluster"
+clusterDnodes = ClusterDnodes()
class ConfigureyCluster:
"""This will create defined number of dnodes and create a cluster.
at the same time, it will return TDDnodes list: dnodes, """
hostname = socket.gethostname()
-
def __init__(self):
- self.dnodes = []
+ self.dnodes = []
self.dnodeNums = 5
self.independent = True
self.startPort = 6030
diff --git a/tests/army/frame/server/dnodes.py b/tests/army/frame/server/dnodes.py
index a22e1cbff7..cd2b89acbd 100644
--- a/tests/army/frame/server/dnodes.py
+++ b/tests/army/frame/server/dnodes.py
@@ -47,6 +47,7 @@ class TDDnodes:
self.valgrind = 0
self.asan = False
self.killValgrind = 0
+ self.model = "single"
def init(self, path, remoteIP = ""):
binPath = self.dnodes[0].getPath() + "/../../../"
@@ -251,6 +252,11 @@ class TDDnodes:
dnodesRootDir = "%s/sim" % (self.path)
return dnodesRootDir
+ def getDnodeDir(self, index):
+ self.check(index)
+ dnodesDir = "%s/sim/dnode%d" % (self.path, index)
+ return dnodesDir
+
def getSimCfgPath(self):
return self.sim.getCfgDir()
@@ -263,6 +269,14 @@ class TDDnodes:
def getAsan(self):
return self.asan
+ def getModel(self):
+ return self.model
+
+ def getDnodeCfgPath(self, index):
+ self.check(index)
+ return self.dnodes[index - 1].cfgPath
+
+
def setLevelDisk(self, level, disk):
for i in range(len(self.dnodes)):
self.dnodes[i].level = int(level)
diff --git a/tests/army/frame/sql.py b/tests/army/frame/sql.py
index 8b7538321d..dd31d6da9a 100644
--- a/tests/army/frame/sql.py
+++ b/tests/army/frame/sql.py
@@ -83,6 +83,49 @@ class TDSql:
# do execute
#
+ def errors(self, sql_list, expected_error_id_list=None, expected_error_info_list=None):
+ """Execute the sql query and check the error info, expected error id or info should keep the same order with sql list,
+ expected_error_id_list or expected_error_info_list is None, then the error info will not be checked.
+ :param sql_list: the sql list to be executed.
+ :param expected_error_id: the expected error number.
+ :param expected_error_info: the expected error info.
+ :return: None
+ """
+ try:
+ if len(sql_list) > 0:
+ for i in range(len(sql_list)):
+ if expected_error_id_list and expected_error_info_list:
+ self.error(sql_list[i], expected_error_id_list[i], expected_error_info_list[i])
+ elif expected_error_id_list:
+ self.error(sql_list[i], expectedErrno=expected_error_id_list[i])
+ elif expected_error_info_list:
+ self.error(sql_list[i], expectErrInfo=expected_error_info_list[i])
+ else:
+ self.error(sql_list[i])
+ else:
+ tdLog.exit("sql list is empty")
+ except Exception as ex:
+ tdLog.exit("Failed to execute sql list: %s, error: %s" % (sql_list, ex))
+
+ def queryAndCheckResult(self, sql_list, expect_result_list):
+ """Execute the sql query and check the result.
+ :param sql_list: the sql list to be executed.
+ :param expect_result_list: the expected result list.
+ :return: None
+ """
+ try:
+ for index in range(len(sql_list)):
+ self.query(sql_list[index])
+ if len(expect_result_list[index]) == 0:
+ self.checkRows(0)
+ else:
+ self.checkRows(len(expect_result_list[index]))
+ for row in range(len(expect_result_list[index])):
+ for col in range(len(expect_result_list[index][row])):
+ self.checkData(row, col, expect_result_list[index][row][col])
+ except Exception as ex:
+ raise(ex)
+
def query(self, sql, row_tag=None, queryTimes=10, count_expected_res=None):
self.sql = sql
i=1
@@ -211,8 +254,6 @@ class TDSql:
tdLog.info("sql:%s, expected expectErrInfo %s occured" % (sql, expectErrInfo))
else:
tdLog.exit("%s(%d) failed: sql:%s, expectErrInfo %s occured, but not expected errno %s" % (caller.filename, caller.lineno, sql, self.error_info, expectErrInfo))
- else:
- tdLog.info("sql:%s, expect error occured" % (sql))
return self.error_info
@@ -223,6 +264,12 @@ class TDSql:
def getData(self, row, col):
self.checkRowCol(row, col)
return self.res[row][col]
+
+ def getColData(self, col):
+ colDatas = []
+ for i in range(self.queryRows):
+ colDatas.append(self.res[i][col])
+ return colDatas
def getResult(self, sql):
self.sql = sql
@@ -353,7 +400,14 @@ class TDSql:
args = (caller.filename, caller.lineno, self.sql, row, col, self.res[row][col], data)
tdLog.exit("%s(%d) failed: sql:%s row:%d col:%d data:%s != expect:%s" % args)
else:
- if self.res[row][col].astimezone(datetime.timezone.utc) == _parse_datetime(data).astimezone(datetime.timezone.utc):
+ print(f"{self.res[row][col]}")
+ real = self.res[row][col]
+ if real is None:
+ # none
+ if str(real) == data:
+ if(show):
+ tdLog.info("check successfully")
+ elif real.astimezone(datetime.timezone.utc) == _parse_datetime(data).astimezone(datetime.timezone.utc):
# tdLog.info(f"sql:{self.sql}, row:{row} col:{col} data:{self.res[row][col]} == expect:{data}")
if(show):
tdLog.info("check successfully")
@@ -441,6 +495,49 @@ class TDSql:
if(show):
tdLog.info("check successfully")
+ def checkDataMem(self, sql, mem):
+ self.query(sql)
+ if not isinstance(mem, list):
+ caller = inspect.getframeinfo(inspect.stack()[1][0])
+ args = (caller.filename, caller.lineno, self.sql)
+ tdLog.exit("%s(%d) failed: sql:%s, expect data is error, must is array[][]" % args)
+
+ if len(mem) != self.queryRows:
+ caller = inspect.getframeinfo(inspect.stack()[1][0])
+ args = (caller.filename, caller.lineno, self.sql, len(mem), self.queryRows)
+ tdLog.exit("%s(%d) failed: sql:%s, row:%d is larger than queryRows:%d" % args)
+ # row, col, data
+ for row, rowData in enumerate(mem):
+ for col, colData in enumerate(rowData):
+ self.checkData(row, col, colData)
+ tdLog.info("check successfully")
+
+ def checkDataCsv(self, sql, csvfilePath):
+ if not isinstance(csvfilePath, str) or len(csvfilePath) == 0:
+ caller = inspect.getframeinfo(inspect.stack()[1][0])
+ args = (caller.filename, caller.lineno, self.sql, csvfilePath)
+ tdLog.exit("%s(%d) failed: sql:%s, expect csvfile path error:%s" % args)
+
+ tdLog.info("read csvfile read begin")
+ data = []
+ try:
+ with open(csvfilePath) as csvfile:
+ csv_reader = csv.reader(csvfile) # csv.reader read csvfile\
+ # header = next(csv_reader) # Read the header of each column in the first row
+ for row in csv_reader: # csv file save to data
+ data.append(row)
+ except FileNotFoundError:
+ caller = inspect.getframeinfo(inspect.stack()[1][0])
+ args = (caller.filename, caller.lineno, self.sql, csvfilePath)
+ tdLog.exit("%s(%d) failed: sql:%s, expect csvfile not find error:%s" % args)
+ except Exception as e:
+ caller = inspect.getframeinfo(inspect.stack()[1][0])
+ args = (caller.filename, caller.lineno, self.sql, csvfilePath, str(e))
+ tdLog.exit("%s(%d) failed: sql:%s, expect csvfile path:%s, read error:%s" % args)
+
+ tdLog.info("read csvfile read successfully")
+ self.checkDataMem(sql, data)
+
# return true or false replace exit, no print out
def checkRowColNoExit(self, row, col):
caller = inspect.getframeinfo(inspect.stack()[2][0])
diff --git a/tests/army/frame/srvCtl.py b/tests/army/frame/srvCtl.py
index c01ea33578..091856056b 100644
--- a/tests/army/frame/srvCtl.py
+++ b/tests/army/frame/srvCtl.py
@@ -18,6 +18,7 @@ import datetime
from frame.server.dnode import *
from frame.server.dnodes import *
+from frame.server.cluster import *
class srvCtl:
@@ -34,19 +35,32 @@ class srvCtl:
# start
def dnodeStart(self, idx):
+ if clusterDnodes.getModel() == 'cluster':
+ return clusterDnodes.starttaosd(idx)
+
return tdDnodes.starttaosd(idx)
# stop
def dnodeStop(self, idx):
+ if clusterDnodes.getModel() == 'cluster':
+ return clusterDnodes.stoptaosd(idx)
+
return tdDnodes.stoptaosd(idx)
+ def dnodeStopAll(self):
+ if clusterDnodes.getModel() == 'cluster':
+ return clusterDnodes.stopAll()
+ return tdDnodes.stopAll()
#
# about path
#
# get cluster root path like /root/TDinternal/sim/
def clusterRootPath(self):
+ if clusterDnodes.getModel() == 'cluster':
+ return clusterDnodes.getDnodesRootDir()
+
return tdDnodes.getDnodesRootDir()
# return dnode data files list
@@ -60,7 +74,9 @@ class srvCtl:
# taos.cfg position
def dnodeCfgPath(self, idx):
- return tdDnodes.dnodes[idx-1].cfgPath
+ if clusterDnodes.getModel() == 'cluster':
+ return clusterDnodes.getDnodeCfgPath(idx)
+ return tdDnodes.getDnodeCfgPath(idx)
sc = srvCtl()
\ No newline at end of file
diff --git a/tests/army/test.py b/tests/army/test.py
index a94fefe0be..5ff1c7bdf5 100644
--- a/tests/army/test.py
+++ b/tests/army/test.py
@@ -405,15 +405,15 @@ if __name__ == "__main__":
else :
tdLog.debug("create an cluster with %s nodes and make %s dnode as independent mnode"%(dnodeNums,mnodeNums))
dnodeslist = cluster.configure_cluster(dnodeNums=dnodeNums, mnodeNums=mnodeNums, independentMnode=independentMnode, level=level, disk=disk)
- tdDnodes = ClusterDnodes(dnodeslist)
- tdDnodes.init(deployPath, masterIp)
- tdDnodes.setTestCluster(testCluster)
- tdDnodes.setValgrind(valgrind)
- tdDnodes.stopAll()
- for dnode in tdDnodes.dnodes:
- tdDnodes.deploy(dnode.index, updateCfgDict)
- for dnode in tdDnodes.dnodes:
- tdDnodes.starttaosd(dnode.index)
+ clusterDnodes.init(dnodeslist, deployPath, masterIp)
+ clusterDnodes.setTestCluster(testCluster)
+ clusterDnodes.setValgrind(valgrind)
+ clusterDnodes.setAsan(asan)
+ clusterDnodes.stopAll()
+ for dnode in clusterDnodes.dnodes:
+ clusterDnodes.deploy(dnode.index, updateCfgDict)
+ for dnode in clusterDnodes.dnodes:
+ clusterDnodes.starttaosd(dnode.index)
tdCases.logSql(logSql)
if restful or websocket:
@@ -580,16 +580,15 @@ if __name__ == "__main__":
print(independentMnode,"independentMnode valuse")
# create dnode list
dnodeslist = cluster.configure_cluster(dnodeNums=dnodeNums, mnodeNums=mnodeNums, independentMnode=independentMnode, level=level, disk=disk)
- tdDnodes = ClusterDnodes(dnodeslist)
- tdDnodes.init(deployPath, masterIp)
- tdDnodes.setTestCluster(testCluster)
- tdDnodes.setValgrind(valgrind)
- tdDnodes.setAsan(asan)
- tdDnodes.stopAll()
- for dnode in tdDnodes.dnodes:
- tdDnodes.deploy(dnode.index,updateCfgDict)
- for dnode in tdDnodes.dnodes:
- tdDnodes.starttaosd(dnode.index)
+ clusterDnodes.init(dnodeslist, deployPath, masterIp)
+ clusterDnodes.setTestCluster(testCluster)
+ clusterDnodes.setValgrind(valgrind)
+ clusterDnodes.setAsan(asan)
+ clusterDnodes.stopAll()
+ for dnode in clusterDnodes.dnodes:
+ clusterDnodes.deploy(dnode.index,updateCfgDict)
+ for dnode in clusterDnodes.dnodes:
+ clusterDnodes.starttaosd(dnode.index)
tdCases.logSql(logSql)
if restful or websocket:
diff --git a/tests/develop-test/2-query/table_count_scan.py b/tests/develop-test/2-query/table_count_scan.py
index 40d2e2a887..09b34a97d0 100644
--- a/tests/develop-test/2-query/table_count_scan.py
+++ b/tests/develop-test/2-query/table_count_scan.py
@@ -65,7 +65,7 @@ class TDTestCase:
tdSql.query('select count(*),db_name, stable_name from information_schema.ins_tables group by db_name, stable_name;')
tdSql.checkRows(3)
- tdSql.checkData(0, 0, 26)
+ tdSql.checkData(0, 0, 29)
tdSql.checkData(0, 1, 'information_schema')
tdSql.checkData(0, 2, None)
tdSql.checkData(1, 0, 3)
@@ -77,7 +77,7 @@ class TDTestCase:
tdSql.query('select count(1) v,db_name, stable_name from information_schema.ins_tables group by db_name, stable_name order by v desc;')
tdSql.checkRows(3)
- tdSql.checkData(0, 0, 26)
+ tdSql.checkData(0, 0, 29)
tdSql.checkData(0, 1, 'information_schema')
tdSql.checkData(0, 2, None)
tdSql.checkData(1, 0, 5)
@@ -93,7 +93,7 @@ class TDTestCase:
tdSql.checkData(1, 1, 'performance_schema')
tdSql.checkData(0, 0, 3)
tdSql.checkData(0, 1, 'tbl_count')
- tdSql.checkData(2, 0, 26)
+ tdSql.checkData(2, 0, 29)
tdSql.checkData(2, 1, 'information_schema')
tdSql.query("select count(*) from information_schema.ins_tables where db_name='tbl_count'")
@@ -106,7 +106,7 @@ class TDTestCase:
tdSql.query('select count(*) from information_schema.ins_tables')
tdSql.checkRows(1)
- tdSql.checkData(0, 0, 34)
+ tdSql.checkData(0, 0, 37)
tdSql.execute('create table stba (ts timestamp, c1 bool, c2 tinyint, c3 smallint, c4 int, c5 bigint, c6 float, c7 double, c8 binary(10), c9 nchar(10), c10 tinyint unsigned, c11 smallint unsigned, c12 int unsigned, c13 bigint unsigned) TAGS(t1 int, t2 binary(10), t3 double);')
@@ -189,7 +189,7 @@ class TDTestCase:
tdSql.checkData(2, 0, 5)
tdSql.checkData(2, 1, 'performance_schema')
tdSql.checkData(2, 2, None)
- tdSql.checkData(3, 0, 26)
+ tdSql.checkData(3, 0, 29)
tdSql.checkData(3, 1, 'information_schema')
tdSql.checkData(3, 2, None)
@@ -204,7 +204,7 @@ class TDTestCase:
tdSql.checkData(2, 0, 5)
tdSql.checkData(2, 1, 'performance_schema')
tdSql.checkData(2, 2, None)
- tdSql.checkData(3, 0, 26)
+ tdSql.checkData(3, 0, 29)
tdSql.checkData(3, 1, 'information_schema')
tdSql.checkData(3, 2, None)
@@ -215,7 +215,7 @@ class TDTestCase:
tdSql.checkData(0, 1, 'tbl_count')
tdSql.checkData(1, 0, 5)
tdSql.checkData(1, 1, 'performance_schema')
- tdSql.checkData(2, 0, 26)
+ tdSql.checkData(2, 0, 29)
tdSql.checkData(2, 1, 'information_schema')
tdSql.query("select count(*) from information_schema.ins_tables where db_name='tbl_count'")
@@ -228,7 +228,7 @@ class TDTestCase:
tdSql.query('select count(*) from information_schema.ins_tables')
tdSql.checkRows(1)
- tdSql.checkData(0, 0, 35)
+ tdSql.checkData(0, 0, 38)
tdSql.execute('drop database tbl_count')
diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task
index 1e99b219e0..4522ab09c1 100644
--- a/tests/parallel_test/cases.task
+++ b/tests/parallel_test/cases.task
@@ -17,7 +17,11 @@ fi
,,y,army,./pytest.sh python3 ./test.py -f enterprise/multi-level/mlevel_basic.py -N 3 -L 3 -D 2
,,y,army,./pytest.sh python3 ./test.py -f enterprise/s3/s3_basic.py -L 3 -D 1
,,y,army,./pytest.sh python3 ./test.py -f community/cluster/snapshot.py -N 3 -L 3 -D 2
+,,y,army,./pytest.sh python3 ./test.py -f community/query/function/test_func_elapsed.py
+,,y,army,./pytest.sh python3 ./test.py -f community/query/fill/fill_desc.py -N 3 -L 3 -D 2
+,,y,army,./pytest.sh python3 ./test.py -f community/cluster/incSnapshot.py -N 3 -L 3 -D 2
,,y,army,./pytest.sh python3 ./test.py -f community/query/query_basic.py -N 3
+,,y,army,./pytest.sh python3 ./test.py -f community/cluster/splitVgroupByLearner.py -N 3
,,n,army,python3 ./test.py -f community/cmdline/fullopt.py
#
@@ -43,6 +47,7 @@ fi
#,,n,system-test,python3 ./test.py -f 8-stream/snode_restart.py -N 4
,,n,system-test,python3 ./test.py -f 8-stream/snode_restart_with_checkpoint.py -N 4
+,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/partition_expr.py
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/project_group.py
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/tbname_vgroup.py
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/count_interval.py
@@ -224,6 +229,7 @@ fi
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqSubscribeStb-r3.py -N 5
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmq3mnodeSwitch.py -N 6 -M 3 -i True
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmq3mnodeSwitch.py -N 6 -M 3 -n 3 -i True
+,,y,system-test,./pytest.sh python3 test.py -f 7-tmq/tmqVnodeTransform.py -N 2 -n 1
,,y,system-test,./pytest.sh python3 test.py -f 7-tmq/tmqVnodeTransform-stb.py -N 2 -n 1
,,y,system-test,./pytest.sh python3 test.py -f 7-tmq/tmqVnodeTransform-stb.py -N 6 -n 3
#,,y,system-test,./pytest.sh python3 test.py -f 7-tmq/tmqVnodeTransform-db.py -N 6 -n 3
@@ -231,10 +237,14 @@ fi
,,y,system-test,./pytest.sh python3 test.py -f 7-tmq/tmqVnodeSplit-stb-select-duplicatedata.py -N 3 -n 3
,,y,system-test,./pytest.sh python3 test.py -f 7-tmq/tmqVnodeSplit-stb-select-duplicatedata-false.py -N 3 -n 3
,,y,system-test,./pytest.sh python3 test.py -f 7-tmq/tmqVnodeSplit-stb-select.py -N 3 -n 3
+,,y,system-test,./pytest.sh python3 test.py -f 7-tmq/tmqVnodeSplit-stb-select-false.py -N 3 -n 3
,,y,system-test,./pytest.sh python3 test.py -f 7-tmq/tmqVnodeSplit-stb.py -N 3 -n 3
+,,y,system-test,./pytest.sh python3 test.py -f 7-tmq/tmqVnodeSplit-stb-false.py -N 3 -n 3
,,y,system-test,./pytest.sh python3 test.py -f 7-tmq/tmqVnodeSplit-column.py -N 3 -n 3
+,,y,system-test,./pytest.sh python3 test.py -f 7-tmq/tmqVnodeSplit-column-false.py -N 3 -n 3
,,y,system-test,./pytest.sh python3 test.py -f 7-tmq/tmqVnodeSplit-db.py -N 3 -n 3
-e
+,,y,system-test,./pytest.sh python3 test.py -f 7-tmq/tmqVnodeSplit-db-false.py -N 3 -n 3
+
,,y,system-test,./pytest.sh python3 test.py -f 7-tmq/tmqVnodeReplicate.py -M 3 -N 3 -n 3
,,y,system-test,./pytest.sh python3 ./test.py -f 99-TDcase/TD-19201.py
,,y,system-test,./pytest.sh python3 ./test.py -f 99-TDcase/TD-21561.py
@@ -282,6 +292,7 @@ e
,,n,system-test,python3 ./test.py -f 0-others/timeRangeWise.py -N 3
,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/delete_check.py
,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/test_hot_refresh_configurations.py
+,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/subscribe_stream_privilege.py
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/insert_double.py
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/alter_database.py
@@ -1108,6 +1119,7 @@ e
,,y,script,./test.sh -f tsim/query/udf_with_const.sim
,,y,script,./test.sh -f tsim/query/join_interval.sim
,,y,script,./test.sh -f tsim/query/join_pk.sim
+,,y,script,./test.sh -f tsim/query/join_order.sim
,,y,script,./test.sh -f tsim/query/count_spread.sim
,,y,script,./test.sh -f tsim/query/unionall_as_table.sim
,,y,script,./test.sh -f tsim/query/multi_order_by.sim
diff --git a/tests/parallel_test/run_case.sh b/tests/parallel_test/run_case.sh
index 7c80ecdbb7..7429c9976b 100755
--- a/tests/parallel_test/run_case.sh
+++ b/tests/parallel_test/run_case.sh
@@ -79,7 +79,7 @@ md5sum /home/TDinternal/debug/build/lib/libtaos.so
#define taospy 2.7.10
pip3 list|grep taospy
pip3 uninstall taospy -y
-pip3 install --default-timeout=120 taospy==2.7.12
+pip3 install --default-timeout=120 taospy==2.7.13
#define taos-ws-py 0.3.1
pip3 list|grep taos-ws-py
diff --git a/tests/pytest/util/common.py b/tests/pytest/util/common.py
index c4885747d1..61cb770a10 100644
--- a/tests/pytest/util/common.py
+++ b/tests/pytest/util/common.py
@@ -139,7 +139,7 @@ class TDCom:
self.stream_suffix = "_stream"
self.range_count = 5
self.default_interval = 5
- self.stream_timeout = 12
+ self.stream_timeout = 60
self.create_stream_sleep = 0.5
self.record_history_ts = str()
self.precision = "ms"
@@ -1688,8 +1688,8 @@ class TDCom:
res1 = self.round_handle(res1)
res2 = self.round_handle(res2)
if latency < self.stream_timeout:
- latency += 0.2
- time.sleep(0.2)
+ latency += 0.5
+ time.sleep(0.5)
else:
if latency == 0:
return False
diff --git a/tests/pytest/util/sql.py b/tests/pytest/util/sql.py
index 62af9a1af9..92074161b6 100644
--- a/tests/pytest/util/sql.py
+++ b/tests/pytest/util/sql.py
@@ -97,7 +97,24 @@ class TDSql:
i+=1
time.sleep(1)
pass
-
+
+ def no_error(self, sql):
+ caller = inspect.getframeinfo(inspect.stack()[1][0])
+ expectErrOccurred = False
+
+ try:
+ self.cursor.execute(sql)
+ except BaseException as e:
+ expectErrOccurred = True
+ self.errno = e.errno
+ error_info = repr(e)
+ self.error_info = ','.join(error_info[error_info.index('(') + 1:-1].split(",")[:-1]).replace("'", "")
+
+ if expectErrOccurred:
+ tdLog.exit("%s(%d) failed: sql:%s, unexpect error '%s' occurred" % (caller.filename, caller.lineno, sql, self.error_info))
+ else:
+ tdLog.info("sql:%s, check passed, no ErrInfo occurred" % (sql))
+
def error(self, sql, expectedErrno = None, expectErrInfo = None, fullMatched = True):
caller = inspect.getframeinfo(inspect.stack()[1][0])
expectErrNotOccured = True
@@ -126,9 +143,9 @@ class TDSql:
if expectErrInfo != None:
if expectErrInfo == self.error_info:
- tdLog.info("sql:%s, expected expectErrInfo '%s' occured" % (sql, expectErrInfo))
+ tdLog.info("sql:%s, expected ErrInfo '%s' occured" % (sql, expectErrInfo))
else:
- tdLog.exit("%s(%d) failed: sql:%s, expectErrInfo '%s' occured, but not expected expectErrInfo '%s'" % (caller.filename, caller.lineno, sql, self.error_info, expectErrInfo))
+ tdLog.exit("%s(%d) failed: sql:%s, ErrInfo '%s' occured, but not expected ErrInfo '%s'" % (caller.filename, caller.lineno, sql, self.error_info, expectErrInfo))
else:
if expectedErrno != None:
if expectedErrno in self.errno:
@@ -138,9 +155,9 @@ class TDSql:
if expectErrInfo != None:
if expectErrInfo in self.error_info:
- tdLog.info("sql:%s, expected expectErrInfo '%s' occured" % (sql, expectErrInfo))
+ tdLog.info("sql:%s, expected ErrInfo '%s' occured" % (sql, expectErrInfo))
else:
- tdLog.exit("%s(%d) failed: sql:%s, expectErrInfo %s occured, but not expected expectErrInfo '%s'" % (caller.filename, caller.lineno, sql, self.error_info, expectErrInfo))
+ tdLog.exit("%s(%d) failed: sql:%s, ErrInfo %s occured, but not expected ErrInfo '%s'" % (caller.filename, caller.lineno, sql, self.error_info, expectErrInfo))
return self.error_info
diff --git a/tests/script/coverage_test.sh b/tests/script/coverage_test.sh
index c5e0c31f83..d8f1999b26 100644
--- a/tests/script/coverage_test.sh
+++ b/tests/script/coverage_test.sh
@@ -219,7 +219,7 @@ function lcovFunc {
# generate result
echo "generate result"
- lcov -l --branch-coverage --function-coverage coverage.info | tee -a $TDENGINE_COVERAGE_REPORT
+ lcov -l coverage.info --branch-coverage --function-coverage | tee -a $TDENGINE_COVERAGE_REPORT
sed -i 's/\/root\/TDengine\/sql.c/\/root\/TDengine\/source\/libs\/parser\/inc\/sql.c/g' coverage.info
sed -i 's/\/root\/TDengine\/sql.y/\/root\/TDengine\/source\/libs\/parser\/inc\/sql.y/g' coverage.info
@@ -289,4 +289,4 @@ lcovFunc
stopTaosd
date >> $WORK_DIR/cron.log
-echo "End of Coverage Test" | tee -a $WORK_DIR/cron.log
\ No newline at end of file
+echo "End of Coverage Test" | tee -a $WORK_DIR/cron.log
diff --git a/tests/script/tsim/parser/limit_stb.sim b/tests/script/tsim/parser/limit_stb.sim
index 7d6aff3b51..2e8f029260 100644
--- a/tests/script/tsim/parser/limit_stb.sim
+++ b/tests/script/tsim/parser/limit_stb.sim
@@ -129,6 +129,7 @@ endi
$offset = $tbNum * $rowNum
$offset = $offset - 1
+print select * from $stb order by ts limit 2 offset $offset
sql select * from $stb order by ts limit 2 offset $offset
if $rows != 1 then
return -1
diff --git a/tests/script/tsim/query/join_order.sim b/tests/script/tsim/query/join_order.sim
new file mode 100644
index 0000000000..bd772ff407
--- /dev/null
+++ b/tests/script/tsim/query/join_order.sim
@@ -0,0 +1,51 @@
+system sh/stop_dnodes.sh
+system sh/deploy.sh -n dnode1 -i 1
+system sh/exec.sh -n dnode1 -s start
+sql connect
+
+sql drop database if exists db1;
+sql create database db1 vgroups 1;
+sql use db1;
+sql create stable sta (ts timestamp, col1 int) tags(t1 int);
+sql create table tba1 using sta tags(1);
+
+sql insert into tba1 values ('2023-11-17 16:29:00', 1);
+sql insert into tba1 values ('2023-11-17 16:29:02', 3);
+sql insert into tba1 values ('2023-11-17 16:29:03', 4);
+sql insert into tba1 values ('2023-11-17 16:29:04', 5);
+
+
+sql select a.*,b.* from tba1 a, (select * from tba1 order by ts) b where a.ts=b.ts;
+if $rows != 4 then
+ return -1
+endi
+sql select a.*,b.* from (select * from tba1 order by ts) a, tba1 b where a.ts=b.ts;
+if $rows != 4 then
+ return -1
+endi
+sql select a.*,b.* from tba1 a, (select * from tba1 order by ts desc) b where a.ts=b.ts;
+if $rows != 4 then
+ return -1
+endi
+sql select a.*,b.* from (select * from tba1 order by ts desc) a, tba1 b where a.ts=b.ts;
+if $rows != 4 then
+ return -1
+endi
+sql select a.*,b.* from (select * from tba1 order by ts) a, (select * from tba1 order by ts) b where a.ts=b.ts;
+if $rows != 4 then
+ return -1
+endi
+sql select a.*,b.* from (select * from tba1 order by ts desc) a, (select * from tba1 order by ts desc) b where a.ts=b.ts;
+if $rows != 4 then
+ return -1
+endi
+sql select a.*,b.* from (select * from tba1 order by ts) a, (select * from tba1 order by ts desc) b where a.ts=b.ts;
+if $rows != 4 then
+ return -1
+endi
+sql select a.*,b.* from (select * from tba1 order by ts desc) a, (select * from tba1 order by ts) b where a.ts=b.ts;
+if $rows != 4 then
+ return -1
+endi
+
+system sh/exec.sh -n dnode1 -s stop -x SIGINT
diff --git a/tests/script/tsim/query/sys_tbname.sim b/tests/script/tsim/query/sys_tbname.sim
index 8bf0fb4700..9069ad949c 100644
--- a/tests/script/tsim/query/sys_tbname.sim
+++ b/tests/script/tsim/query/sys_tbname.sim
@@ -58,7 +58,7 @@ endi
sql select tbname from information_schema.ins_tables;
print $rows $data00
-if $rows != 35 then
+if $rows != 38 then
return -1
endi
if $data00 != @ins_tables@ then
diff --git a/tests/script/tsim/query/tableCount.sim b/tests/script/tsim/query/tableCount.sim
index 315a39e56d..573e134133 100644
--- a/tests/script/tsim/query/tableCount.sim
+++ b/tests/script/tsim/query/tableCount.sim
@@ -53,7 +53,7 @@ sql select stable_name,count(table_name) from information_schema.ins_tables grou
if $rows != 3 then
return -1
endi
-if $data01 != 32 then
+if $data01 != 35 then
return -1
endi
if $data11 != 10 then
@@ -72,7 +72,7 @@ endi
if $data11 != 5 then
return -1
endi
-if $data21 != 26 then
+if $data21 != 29 then
return -1
endi
if $data31 != 5 then
@@ -97,7 +97,7 @@ endi
if $data42 != 3 then
return -1
endi
-if $data52 != 26 then
+if $data52 != 29 then
return -1
endi
if $data62 != 5 then
diff --git a/tests/script/tsim/stream/fillHistoryBasic1.sim b/tests/script/tsim/stream/fillHistoryBasic1.sim
index da7969dd31..d2417a73ab 100644
--- a/tests/script/tsim/stream/fillHistoryBasic1.sim
+++ b/tests/script/tsim/stream/fillHistoryBasic1.sim
@@ -18,6 +18,7 @@ sql use test;
sql create table t1(ts timestamp, a int, b int , c int, d double);
sql create stream stream1 trigger at_once fill_history 1 IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(b) c4, min(c) c5 from t1 interval(10s);
+sleep 1000
sql insert into t1 values(1648791213000,1,2,3,1.0);
sql insert into t1 values(1648791223001,2,2,3,1.1);
@@ -224,53 +225,53 @@ endi
# row 2
if $data21 != 1 then
- print ======$data21
+ print ======$data21, expect 1
goto loop01
endi
if $data22 != 1 then
- print ======$data22
+ print ======$data22 , expect 1
goto loop01
endi
if $data23 != 3 then
- print ======$data23
+ print ======$data23 , expect 3
goto loop01
endi
if $data24 != 2 then
- print ======$data24
+ print ======$data24 , expect 2
goto loop01
endi
if $data25 != 3 then
- print ======$data25
+ print ======$data25 , expect 3
goto loop01
endi
# row 3
if $data31 != 1 then
- print ======$data31
+ print ======$data31 , expect 1
goto loop01
endi
if $data32 != 1 then
- print ======$data32
+ print ======$data32 , expect 1
goto loop01
endi
if $data33 != 4 then
- print ======$data33
+ print ======$data33 , expect 4
goto loop01
endi
if $data34 != 2 then
- print ======$data34
+ print ======$data34 , expect 2
goto loop01
endi
if $data35 != 3 then
- print ======$data35
+ print ======$data35 , expect 3
goto loop01
endi
diff --git a/tests/script/tsim/stream/partitionby1.sim b/tests/script/tsim/stream/partitionby1.sim
index d92aecb3a6..24c588d410 100644
--- a/tests/script/tsim/stream/partitionby1.sim
+++ b/tests/script/tsim/stream/partitionby1.sim
@@ -13,6 +13,8 @@ sql create table ts3 using st tags(3,2,2);
sql create table ts4 using st tags(4,2,2);
sql create stream stream_t1 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamtST1 as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(b) c4, min(c) c5 from st partition by tbname interval(10s);
+sleep 1000
+
sql insert into ts1 values(1648791213001,1,12,3,1.0);
sql insert into ts2 values(1648791213001,1,12,3,1.0);
diff --git a/tests/system-test/0-others/com_alltypedata.json b/tests/system-test/0-others/com_alltypedata.json
new file mode 100644
index 0000000000..0e6d8e3a07
--- /dev/null
+++ b/tests/system-test/0-others/com_alltypedata.json
@@ -0,0 +1,81 @@
+{
+ "filetype": "insert",
+ "cfgdir": "/etc/taos",
+ "host": "127.0.0.1",
+ "port": 6030,
+ "user": "root",
+ "password": "taosdata",
+ "connection_pool_size": 8,
+ "num_of_records_per_req": 2000,
+ "thread_count": 2,
+ "create_table_thread_count": 10,
+ "result_file": "./insert_res_mix.txt",
+ "confirm_parameter_prompt": "no",
+ "insert_interval": 0,
+ "check_sql": "yes",
+ "continue_if_fail": "yes",
+ "databases": [
+ {
+ "dbinfo": {
+ "name": "curdb",
+ "drop": "yes",
+ "vgroups": 2,
+ "replica": 1,
+ "precision": "ms",
+ "stt_trigger": 8,
+ "minRows": 100,
+ "maxRows": 4096
+ },
+ "super_tables": [
+ {
+ "name": "meters",
+ "child_table_exists": "no",
+ "childtable_count": 5,
+ "insert_rows": 100000,
+ "childtable_prefix": "d",
+ "insert_mode": "taosc",
+ "insert_interval": 0,
+ "timestamp_step": 1000,
+ "start_timestamp":"2022-09-01 10:00:00",
+ "disorder_ratio": 60,
+ "update_ratio": 70,
+ "delete_ratio": 30,
+ "disorder_fill_interval": 300,
+ "update_fill_interval": 25,
+ "generate_row_rule": 2,
+ "columns": [
+ { "type": "bool", "name": "bc"},
+ { "type": "float", "name": "fc", "max": 1, "min": 0 },
+ { "type": "double", "name": "dc", "max": 1, "min": 0 },
+ { "type": "tinyint", "name": "ti", "max": 100, "min": 0 },
+ { "type": "smallint", "name": "si", "max": 100, "min": 0 },
+ { "type": "int", "name": "ic", "max": 100, "min": 0 },
+ { "type": "bigint", "name": "bi", "max": 100, "min": 0 },
+ { "type": "utinyint", "name": "uti", "max": 100, "min": 0 },
+ { "type": "usmallint", "name": "usi", "max": 100, "min": 0 },
+ { "type": "uint", "name": "ui", "max": 100, "min": 0 },
+ { "type": "ubigint", "name": "ubi", "max": 100, "min": 0 },
+ { "type": "binary", "name": "bin", "len": 32},
+ { "type": "nchar", "name": "nch", "len": 64}
+ ],
+ "tags": [
+ {
+ "type": "tinyint",
+ "name": "groupid",
+ "max": 10,
+ "min": 1
+ },
+ {
+ "name": "location",
+ "type": "binary",
+ "len": 16,
+ "values": ["San Francisco", "Los Angles", "San Diego",
+ "San Jose", "Palo Alto", "Campbell", "Mountain View",
+ "Sunnyvale", "Santa Clara", "Cupertino"]
+ }
+ ]
+ }
+ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/tests/system-test/0-others/compatibility.py b/tests/system-test/0-others/compatibility.py
index d54c676c0d..c936cf1ae4 100644
--- a/tests/system-test/0-others/compatibility.py
+++ b/tests/system-test/0-others/compatibility.py
@@ -152,6 +152,13 @@ class TDTestCase:
tdLog.info(f" LD_LIBRARY_PATH=/usr/lib taosBenchmark -t {tableNumbers} -n {recordNumbers1} -y ")
os.system(f"LD_LIBRARY_PATH=/usr/lib taosBenchmark -t {tableNumbers} -n {recordNumbers1} -y ")
os.system("LD_LIBRARY_PATH=/usr/lib taos -s 'flush database test '")
+ os.system("LD_LIBRARY_PATH=/usr/lib taosBenchmark -f 0-others/com_alltypedata.json -y")
+ os.system("LD_LIBRARY_PATH=/usr/lib taos -s 'flush database curdb '")
+ os.system("LD_LIBRARY_PATH=/usr/lib taos -s 'select count(*) from curdb.meters '")
+ os.system("LD_LIBRARY_PATH=/usr/lib taos -s 'select sum(fc) from curdb.meters '")
+ os.system("LD_LIBRARY_PATH=/usr/lib taos -s 'select avg(ic) from curdb.meters '")
+ os.system("LD_LIBRARY_PATH=/usr/lib taos -s 'select min(ui) from curdb.meters '")
+ os.system("LD_LIBRARY_PATH=/usr/lib taos -s 'select max(bi) from curdb.meters '")
# os.system(f"LD_LIBRARY_PATH=/usr/lib taos -s 'use test;create stream current_stream into current_stream_output_stb as select _wstart as `start`, _wend as wend, max(current) as max_current from meters where voltage <= 220 interval (5s);' ")
# os.system('LD_LIBRARY_PATH=/usr/lib taos -s "use test;create stream power_stream into power_stream_output_stb as select ts, concat_ws(\\".\\", location, tbname) as meter_location, current*voltage*cos(phase) as active_power, current*voltage*sin(phase) as reactive_power from meters partition by tbname;" ')
diff --git a/tests/system-test/0-others/compatibility_coverage.py b/tests/system-test/0-others/compatibility_coverage.py
new file mode 100644
index 0000000000..6eccf78c5a
--- /dev/null
+++ b/tests/system-test/0-others/compatibility_coverage.py
@@ -0,0 +1,275 @@
+from urllib.parse import uses_relative
+import taos
+import sys
+import os
+import time
+import platform
+import inspect
+from taos.tmq import Consumer
+
+from pathlib import Path
+from util.log import *
+from util.sql import *
+from util.cases import *
+from util.dnodes import *
+from util.dnodes import TDDnodes
+from util.dnodes import TDDnode
+from util.cluster import *
+import subprocess
+
+BASEVERSION = "3.0.2.3"
+class TDTestCase:
+ def caseDescription(self):
+ f'''
+ 3.0 data compatibility test
+ case1: basedata version is {BASEVERSION}
+ '''
+ return
+
+ def init(self, conn, logSql, replicaVar=1):
+ self.replicaVar = int(replicaVar)
+ tdLog.debug(f"start to excute {__file__}")
+ tdSql.init(conn.cursor())
+ self.deletedDataSql= '''drop database if exists deldata;create database deldata duration 300 stt_trigger 1; ;use deldata;
+ create table deldata.stb1 (ts timestamp, c1 int, c2 bigint, c3 smallint, c4 tinyint, c5 float, c6 double, c7 bool, c8 binary(16),c9 nchar(32), c10 timestamp) tags (t1 int);
+ create table deldata.ct1 using deldata.stb1 tags ( 1 );
+ insert into deldata.ct1 values ( now()-0s, 0, 0, 0, 0, 0.0, 0.0, 0, 'binary0', 'nchar0', now()+0a ) ( now()-10s, 1, 11111, 111, 11, 1.11, 11.11, 1, 'binary1', 'nchar1', now()+1a ) ( now()-20s, 2, 22222, 222, 22, 2.22, 22.22, 0, 'binary2', 'nchar2', now()+2a ) ( now()-30s, 3, 33333, 333, 33, 3.33, 33.33, 1, 'binary3', 'nchar3', now()+3a );
+ select avg(c1) from deldata.ct1;
+ delete from deldata.stb1;
+ flush database deldata;
+ insert into deldata.ct1 values ( now()-0s, 0, 0, 0, 0, 0.0, 0.0, 0, 'binary0', 'nchar0', now()+0a ) ( now()-10s, 1, 11111, 111, 11, 1.11, 11.11, 1, 'binary1', 'nchar1', now()+1a ) ( now()-20s, 2, 22222, 222, 22, 2.22, 22.22, 0, 'binary2', 'nchar2', now()+2a ) ( now()-30s, 3, 33333, 333, 33, 3.33, 33.33, 1, 'binary3', 'nchar3', now()+3a );
+ delete from deldata.ct1;
+ insert into deldata.ct1 values ( now()-0s, 0, 0, 0, 0, 0.0, 0.0, 0, 'binary0', 'nchar0', now()+0a );
+ flush database deldata;'''
+ def checkProcessPid(self,processName):
+ i=0
+ while i<60:
+ print(f"wait stop {processName}")
+ processPid = subprocess.getstatusoutput(f'ps aux|grep {processName} |grep -v "grep"|awk \'{{print $2}}\'')[1]
+ print(f"times:{i},{processName}-pid:{processPid}")
+ if(processPid == ""):
+ break
+ i += 1
+ sleep(1)
+ else:
+ print(f'this processName is not stoped in 60s')
+
+
+ def getBuildPath(self):
+ selfPath = os.path.dirname(os.path.realpath(__file__))
+
+ if ("community" in selfPath):
+ projPath = selfPath[:selfPath.find("community")]
+ else:
+ projPath = selfPath[:selfPath.find("tests")]
+
+ self.projPath = projPath
+ for root, dirs, files in os.walk(projPath):
+ if ("taosd" in files or "taosd.exe" in files):
+ rootRealPath = os.path.dirname(os.path.realpath(root))
+ if ("packaging" not in rootRealPath):
+ buildPath = root[:len(root)-len("/build/bin")]
+ break
+ return buildPath
+
+ def getCfgPath(self):
+ buildPath = self.getBuildPath()
+ selfPath = os.path.dirname(os.path.realpath(__file__))
+
+ if ("community" in selfPath):
+ cfgPath = buildPath + "/../sim/dnode1/cfg/"
+ else:
+ cfgPath = buildPath + "/../sim/dnode1/cfg/"
+
+ return cfgPath
+
+ def installTaosd(self,bPath,cPath):
+ # os.system(f"rmtaos && mkdir -p {self.getBuildPath()}/build/lib/temp && mv {self.getBuildPath()}/build/lib/libtaos.so* {self.getBuildPath()}/build/lib/temp/ ")
+ # os.system(f" mv {bPath}/build {bPath}/build_bak ")
+ # os.system(f"mv {self.getBuildPath()}/build/lib/libtaos.so {self.getBuildPath()}/build/lib/libtaos.so_bak ")
+ # os.system(f"mv {self.getBuildPath()}/build/lib/libtaos.so.1 {self.getBuildPath()}/build/lib/libtaos.so.1_bak ")
+
+ packagePath = "/usr/local/src/"
+ dataPath = cPath + "/../data/"
+ if platform.system() == "Linux" and platform.machine() == "aarch64":
+ packageName = "TDengine-server-"+ BASEVERSION + "-Linux-arm64.tar.gz"
+ else:
+ packageName = "TDengine-server-"+ BASEVERSION + "-Linux-x64.tar.gz"
+ packageTPath = packageName.split("-Linux-")[0]
+ my_file = Path(f"{packagePath}/{packageName}")
+ if not my_file.exists():
+ print(f"{packageName} is not exists")
+ tdLog.info(f"cd {packagePath} && wget https://www.tdengine.com/assets-download/3.0/{packageName}")
+ os.system(f"cd {packagePath} && wget https://www.tdengine.com/assets-download/3.0/{packageName}")
+ else:
+ print(f"{packageName} has been exists")
+ os.system(f" cd {packagePath} && tar xvf {packageName} && cd {packageTPath} && ./install.sh -e no " )
+ tdDnodes.stop(1)
+ print(f"start taosd: rm -rf {dataPath}/* && nohup taosd -c {cPath} & ")
+ os.system(f"rm -rf {dataPath}/* && nohup taosd -c {cPath} & " )
+ sleep(5)
+
+
+ def buildTaosd(self,bPath):
+ # os.system(f"mv {bPath}/build_bak {bPath}/build ")
+ os.system(f" cd {bPath} ")
+
+ def is_list_same_as_ordered_list(self,unordered_list, ordered_list):
+ sorted_list = sorted(unordered_list)
+ return sorted_list == ordered_list
+
+ def run(self):
+ scriptsPath = os.path.dirname(os.path.realpath(__file__))
+ distro_id = distro.id()
+ if distro_id == "alpine":
+ tdLog.info(f"alpine skip compatibility test")
+ return True
+ if platform.system().lower() == 'windows':
+ tdLog.info(f"Windows skip compatibility test")
+ return True
+ bPath = self.getBuildPath()
+ cPath = self.getCfgPath()
+ dbname = "test"
+ stb = f"{dbname}.meters"
+ os.system("echo 'debugFlag 143' > /etc/taos/taos.cfg ")
+ tableNumbers=100
+ recordNumbers1=100
+ recordNumbers2=1000
+
+ # tdsqlF=tdCom.newTdSql()
+ # print(tdsqlF)
+ # tdsqlF.query(f"SELECT SERVER_VERSION();")
+ # print(tdsqlF.query(f"SELECT SERVER_VERSION();"))
+ # oldServerVersion=tdsqlF.queryResult[0][0]
+ # tdLog.info(f"Base server version is {oldServerVersion}")
+ # tdsqlF.query(f"SELECT CLIENT_VERSION();")
+ # # the oldClientVersion can't be updated in the same python process,so the version is new compiled verison
+ # oldClientVersion=tdsqlF.queryResult[0][0]
+ # tdLog.info(f"Base client version is {oldClientVersion}")
+ # baseVersion = "3.0.1.8"
+
+ tdLog.printNoPrefix(f"==========step1:prepare and check data in old version-{BASEVERSION}")
+ os.system(f"rm -rf {cPath}/../data")
+ print(self.projPath)
+ # this data file is special for coverage test in 192.168.1.96
+ os.system(f"cp -r {self.projPath}/../comp_testdata/data/ {self.projPath}/community/sim/dnode1")
+ tdDnodes.stop(1)
+ tdDnodes.start(1)
+
+
+ tdsql=tdCom.newTdSql()
+ tdsql.query(f"SELECT SERVER_VERSION();")
+ nowServerVersion=tdsql.queryResult[0][0]
+ tdLog.printNoPrefix(f"==========step3:prepare and check data in new version-{nowServerVersion}")
+ tdsql.query(f"select count(*) from {stb}")
+ tdsql.checkData(0,0,tableNumbers*recordNumbers1)
+ # tdsql.query("show streams;")
+ # os.system(f"taosBenchmark -t {tableNumbers} -n {recordNumbers2} -y ")
+ # tdsql.query("show streams;")
+ # tdsql.query(f"select count(*) from {stb}")
+ # tdsql.checkData(0,0,tableNumbers*recordNumbers2)
+
+ # checkout db4096
+ tdsql.query("select count(*) from db4096.stb0")
+ tdsql.checkData(0,0,50000)
+
+ # checkout deleted data
+ tdsql.execute("insert into deldata.ct1 values ( now()-0s, 0, 0, 0, 0, 0.0, 0.0, 0, 'binary0', 'nchar0', now()+0a ) ( now()-10s, 1, 11111, 111, 11, 1.11, 11.11, 1, 'binary1', 'nchar1', now()+1a ) ( now()-20s, 2, 22222, 222, 22, 2.22, 22.22, 0, 'binary2', 'nchar2', now()+2a ) ( now()-30s, 3, 33333, 333, 33, 3.33, 33.33, 1, 'binary3', 'nchar3', now()+3a );")
+ tdsql.execute("flush database deldata;")
+ tdsql.query("select avg(c1) from deldata.ct1;")
+
+
+ tdsql=tdCom.newTdSql()
+ tdLog.printNoPrefix("==========step4:verify backticks in taos Sql-TD18542")
+ tdsql.execute("drop database if exists db")
+ tdsql.execute("create database db")
+ tdsql.execute("use db")
+ tdsql.execute("create stable db.stb1 (ts timestamp, c1 int) tags (t1 int);")
+ tdsql.execute("insert into db.ct1 using db.stb1 TAGS(1) values(now(),11);")
+ tdsql.error(" insert into `db.ct2` using db.stb1 TAGS(9) values(now(),11);")
+ tdsql.error(" insert into db.`db.ct2` using db.stb1 TAGS(9) values(now(),11);")
+ tdsql.execute("insert into `db`.ct3 using db.stb1 TAGS(3) values(now(),13);")
+ tdsql.query("select * from db.ct3")
+ tdsql.checkData(0,1,13)
+ tdsql.execute("insert into db.`ct4` using db.stb1 TAGS(4) values(now(),14);")
+ tdsql.query("select * from db.ct4")
+ tdsql.checkData(0,1,14)
+
+ #check retentions
+ tdsql=tdCom.newTdSql()
+ tdsql.query("describe information_schema.ins_databases;")
+ qRows=tdsql.queryRows
+ comFlag=True
+ j=0
+ while comFlag:
+ for i in range(qRows) :
+ if tdsql.queryResult[i][0] == "retentions" :
+ print("parameters include retentions")
+ comFlag=False
+ break
+ else :
+ comFlag=True
+ j=j+1
+ if j == qRows:
+ print("parameters don't include retentions")
+ caller = inspect.getframeinfo(inspect.stack()[0][0])
+ args = (caller.filename, caller.lineno)
+ tdLog.exit("%s(%d) failed" % args)
+
+ # check stream
+ tdsql.query("show streams;")
+ tdsql.checkRows(0)
+
+ #check TS-3131
+ tdsql.query("select *,tbname from d0.almlog where mcid='m0103';")
+ tdsql.checkRows(6)
+ expectList = [0,3003,20031,20032,20033,30031]
+ resultList = []
+ for i in range(6):
+ resultList.append(tdsql.queryResult[i][3])
+ print(resultList)
+ if self.is_list_same_as_ordered_list(resultList,expectList):
+ print("The unordered list is the same as the ordered list.")
+ else:
+ tdLog.exit("The unordered list is not the same as the ordered list.")
+ tdsql.execute("insert into test.d80 values (now+1s, 11, 103, 0.21);")
+ tdsql.execute("insert into test.d9 values (now+5s, 4.3, 104, 0.4);")
+
+
+ # check tmq
+ conn = taos.connect()
+
+ consumer = Consumer(
+ {
+ "group.id": "tg75",
+ "client.id": "124",
+ "td.connect.user": "root",
+ "td.connect.pass": "taosdata",
+ "enable.auto.commit": "true",
+ "experimental.snapshot.enable": "true",
+ }
+ )
+ consumer.subscribe(["tmq_test_topic"])
+
+ while True:
+ res = consumer.poll(10)
+ if not res:
+ break
+ err = res.error()
+ if err is not None:
+ raise err
+ val = res.value()
+
+ for block in val:
+ print(block.fetchall())
+ tdsql.query("show topics;")
+ tdsql.checkRows(1)
+
+
+ def stop(self):
+ tdSql.close()
+ tdLog.success(f"{__file__} successfully executed")
+
+
+tdCases.addLinux(__file__, TDTestCase())
+tdCases.addWindows(__file__, TDTestCase())
diff --git a/tests/system-test/0-others/information_schema.py b/tests/system-test/0-others/information_schema.py
index 20305bf4c1..79d010cd7d 100644
--- a/tests/system-test/0-others/information_schema.py
+++ b/tests/system-test/0-others/information_schema.py
@@ -58,7 +58,7 @@ class TDTestCase:
self.ins_list = ['ins_dnodes','ins_mnodes','ins_qnodes','ins_snodes','ins_cluster','ins_databases','ins_functions',\
'ins_indexes','ins_stables','ins_tables','ins_tags','ins_columns','ins_users','ins_grants','ins_vgroups','ins_configs','ins_dnode_variables',\
'ins_topics','ins_subscriptions','ins_streams','ins_stream_tasks','ins_vnodes','ins_user_privileges','ins_views',
- 'ins_compacts', 'ins_compact_details']
+ 'ins_compacts', 'ins_compact_details', 'ins_grants_full','ins_grants_logs', 'ins_machines']
self.perf_list = ['perf_connections','perf_queries','perf_consumers','perf_trans','perf_apps']
def insert_data(self,column_dict,tbname,row_num):
insert_sql = self.setsql.set_insertsql(column_dict,tbname,self.binary_str,self.nchar_str)
@@ -218,7 +218,7 @@ class TDTestCase:
tdSql.checkEqual(20470,len(tdSql.queryResult))
tdSql.query("select * from information_schema.ins_columns where db_name ='information_schema'")
- tdSql.checkEqual(219, len(tdSql.queryResult))
+ tdSql.checkEqual(True, len(tdSql.queryResult) in range(215, 230))
tdSql.query("select * from information_schema.ins_columns where db_name ='performance_schema'")
tdSql.checkEqual(54, len(tdSql.queryResult))
@@ -229,8 +229,7 @@ class TDTestCase:
tdSql.query(f'select * from information_schema.ins_dnodes')
result = tdSql.queryResult
tdSql.checkEqual(result[0][0],1)
- tdSql.checkEqual(result[0][8],"")
- tdSql.checkEqual(result[0][9],"")
+ tdSql.checkEqual(True, len(result[0][8]) in (0,24))
self.str107 = 'Hc7VCc+'
for t in range (10):
self.str107 += 'tP+2soIXpP'
@@ -247,11 +246,9 @@ class TDTestCase:
tdSql.error('alter dnode 1 "activeCode" "' + self.str109 + '"')
tdSql.error('alter all dnodes "activeCode" "' + self.str510 + '"')
tdSql.query(f'select * from information_schema.ins_dnodes')
- tdSql.checkEqual(tdSql.queryResult[0][8],"")
- tdSql.execute('alter dnode 1 "activeCode" ""')
- tdSql.query(f'select active_code,c_active_code from information_schema.ins_dnodes')
- tdSql.checkEqual(tdSql.queryResult[0][0],"")
- tdSql.checkEqual(tdSql.queryResult[0][1],'')
+ tdSql.checkEqual(True, len(result[0][8]) in (0,24))
+ tdSql.error('alter dnode 1 "activeCode" ""')
+ tdSql.error(f'select active_code,c_active_code from information_schema.ins_dnodes')
tdSql.error('alter dnode 1 "cActiveCode" "a"')
tdSql.error('alter dnode 1 "cActiveCode" "' + self.str107 + '"')
tdSql.error('alter dnode 1 "cActiveCode" "' + self.str256 + '"')
@@ -260,15 +257,11 @@ class TDTestCase:
tdSql.error('alter all dnodes "cActiveCode" "' + self.str257 + '"')
tdSql.error('alter all dnodes "cActiveCode" "' + self.str254 + '"')
tdSql.error('alter dnode 1 "cActiveCode" "' + self.str510 + '"')
- tdSql.query(f'select active_code,c_active_code from information_schema.ins_dnodes')
- tdSql.checkEqual(tdSql.queryResult[0][0],"")
- tdSql.checkEqual(tdSql.queryResult[0][1],"")
+ tdSql.error(f'select active_code,c_active_code from information_schema.ins_dnodes')
tdSql.error('alter dnode 1 "cActiveCode" "' + self.str109 + '"')
tdSql.query(f'show dnodes')
- tdSql.checkEqual(tdSql.queryResult[0][9],"")
- tdSql.execute('alter all dnodes "cActiveCode" ""')
- tdSql.query(f'select c_active_code from information_schema.ins_dnodes')
- tdSql.checkEqual(tdSql.queryResult[0][0],'')
+ tdSql.error(f'select c_active_code from information_schema.ins_dnodes')
+ tdSql.error('alter all dnodes "cActiveCode" ""')
def run(self):
self.prepare_data()
diff --git a/tests/system-test/0-others/subscribe_stream_privilege.py b/tests/system-test/0-others/subscribe_stream_privilege.py
new file mode 100644
index 0000000000..b477af9f57
--- /dev/null
+++ b/tests/system-test/0-others/subscribe_stream_privilege.py
@@ -0,0 +1,184 @@
+###################################################################
+# Copyright (c) 2016 by TAOS Technologies, Inc.
+# All rights reserved.
+#
+# This file is proprietary and confidential to TAOS Technologies.
+# No part of this file may be reproduced, stored, transmitted,
+# disclosed or used in any form or by any means other than as
+# expressly provided by the written permission from Jianhui Tao
+#
+###################################################################
+
+# -*- coding: utf-8 -*-
+import time
+
+import taos
+from taos.tmq import *
+from util.cases import *
+from util.common import *
+from util.log import *
+from util.sql import *
+from util.sqlset import *
+
+
+class TDTestCase:
+ clientCfgDict = {'debugFlag': 135}
+ updatecfgDict = {'debugFlag': 143, 'clientCfg':clientCfgDict}
+ def init(self, conn, logSql, replicaVar=1):
+ self.replicaVar = int(replicaVar)
+ tdLog.debug("start to execute %s" % __file__)
+ tdSql.init(conn.cursor())
+ self.setsql = TDSetSql()
+ self.stbname = 'stb'
+ self.user_name = 'test'
+ self.binary_length = 20 # the length of binary for column_dict
+ self.nchar_length = 20 # the length of nchar for column_dict
+ self.dbnames = ['db1']
+ self.column_dict = {
+ 'ts': 'timestamp',
+ 'col1': 'float',
+ 'col2': 'int',
+ 'col3': 'float',
+ }
+
+ self.tag_dict = {
+ 't1': 'int',
+ 't2': f'binary({self.binary_length})'
+ }
+
+ self.tag_list = [
+ f'1, "Beijing"',
+ f'2, "Shanghai"',
+ f'3, "Guangzhou"',
+ f'4, "Shenzhen"'
+ ]
+
+ self.values_list = [
+ f'now, 9.1, 200, 0.3'
+ ]
+
+ self.tbnum = 4
+ self.topic_name = 'topic1'
+
+
+ def prepare_data(self):
+ for db in self.dbnames:
+ tdSql.execute(f"create database {db} vgroups 1")
+ tdSql.execute(f"use {db}")
+ tdSql.execute(self.setsql.set_create_stable_sql(self.stbname, self.column_dict, self.tag_dict))
+ for i in range(self.tbnum):
+ tdSql.execute(f'create table {self.stbname}_{i} using {self.stbname} tags({self.tag_list[i]})')
+ for j in self.values_list:
+ tdSql.execute(f'insert into {self.stbname}_{i} values({j})')
+
+ def checkUserPrivileges(self, rowCnt):
+ tdSql.query("show user privileges")
+ tdSql.checkRows(rowCnt)
+
+ def streamTest(self):
+ tdSql.execute("create stream s1 trigger at_once fill_history 1 into so1 as select ts,abs(col2) from stb partition by tbname")
+ time.sleep(2)
+ tdSql.query("select * from so1")
+ tdSql.checkRows(4)
+ tdSql.execute("insert into stb_0(ts,col2) values(now, 332)")
+ time.sleep(2)
+ tdSql.query("select * from so1")
+ tdSql.checkRows(5)
+
+ time.sleep(2)
+ tdSql.query("select * from information_schema.ins_stream_tasks")
+ tdSql.checkData(0, 5, 'ready')
+
+ print(time.time())
+ while 1:
+ t = time.time()
+ if t > 1706254434 :
+ break
+ else:
+ print("time:%d" %(t))
+ time.sleep(1)
+
+
+ tdSql.error("create stream s11 trigger at_once fill_history 1 into so1 as select ts,abs(col2) from stb partition by tbname")
+
+ time.sleep(10)
+ tdSql.query("select * from information_schema.ins_stream_tasks")
+ tdSql.checkData(0, 5, 'paused')
+ tdSql.execute("insert into stb_0(ts,col2) values(now, 3232)")
+ tdSql.query("select * from so1")
+ tdSql.checkRows(5)
+
+ tdSql.error("resume stream s1")
+
+ def consumeTest(self):
+ consumer_dict = {
+ "group.id": "g1",
+ "td.connect.user": self.user_name,
+ "td.connect.pass": "test",
+ "auto.offset.reset": "earliest"
+ }
+ consumer = Consumer(consumer_dict)
+
+ tdLog.debug("test subscribe topic created by other user")
+ exceptOccured = False
+ try:
+ consumer.subscribe([self.topic_name])
+ except TmqError:
+ exceptOccured = True
+
+ if not exceptOccured:
+ tdLog.exit(f"has no privilege, should except")
+
+ self.checkUserPrivileges(1)
+ tdLog.debug("test subscribe topic privilege granted by other user")
+ tdSql.execute(f'grant subscribe on {self.topic_name} to {self.user_name}')
+ self.checkUserPrivileges(2)
+
+ exceptOccured = False
+ try:
+ consumer.subscribe([self.topic_name])
+ except TmqError:
+ exceptOccured = True
+
+ if exceptOccured:
+ tdLog.exit(f"has privilege, should not except")
+
+ cnt = 0
+ try:
+ while True:
+ res = consumer.poll(1)
+ cnt += 1
+ if cnt == 1:
+ if not res:
+ tdLog.exit(f"grant privilege, should get res")
+ elif cnt == 2:
+ if res:
+ tdLog.exit(f"revoke privilege, should get NULL")
+ else:
+ break
+
+ tdLog.debug("test subscribe topic privilege revoked by other user")
+ tdSql.execute(f'revoke subscribe on {self.topic_name} from {self.user_name}')
+ self.checkUserPrivileges(1)
+ time.sleep(5)
+
+ finally:
+ consumer.close()
+
+ def create_user(self):
+ tdSql.execute(f'create topic {self.topic_name} as database {self.dbnames[0]}')
+ tdSql.execute(f'create user {self.user_name} pass "test"')
+
+ def run(self):
+ self.prepare_data()
+ self.create_user()
+ self.consumeTest()
+ # self.streamTest()
+
+ def stop(self):
+ tdSql.close()
+ tdLog.success("%s successfully executed" % __file__)
+
+
+tdCases.addWindows(__file__, TDTestCase())
+tdCases.addLinux(__file__, TDTestCase())
\ No newline at end of file
diff --git a/tests/system-test/1-insert/alter_database.py b/tests/system-test/1-insert/alter_database.py
index 6a831b88ff..d83813bf3a 100644
--- a/tests/system-test/1-insert/alter_database.py
+++ b/tests/system-test/1-insert/alter_database.py
@@ -19,12 +19,12 @@ class TDTestCase:
tdSql.init(conn.cursor(), logSql)
self.buffer_boundary = [3, 4097, 8193, 12289, 16384]
# remove the value > free_memory, 70% is the weight to calculate the max value
- if platform.system() == "Linux" and platform.machine() == "aarch64":
- mem = psutil.virtual_memory()
- free_memory = mem.free * 0.7 / 1024 / 1024
- for item in self.buffer_boundary:
- if item > free_memory:
- self.buffer_boundary.remove(item)
+ # if platform.system() == "Linux" and platform.machine() == "aarch64":
+ # mem = psutil.virtual_memory()
+ # free_memory = mem.free * 0.7 / 1024 / 1024
+ # for item in self.buffer_boundary:
+ # if item > free_memory:
+ # self.buffer_boundary.remove(item)
self.buffer_error = [self.buffer_boundary[0] -
1, self.buffer_boundary[-1]+1]
@@ -34,11 +34,14 @@ class TDTestCase:
def alter_buffer(self):
tdSql.execute('create database db')
- for buffer in self.buffer_boundary:
- tdSql.execute(f'alter database db buffer {buffer}')
- tdSql.query(
- 'select * from information_schema.ins_databases where name = "db"')
- tdSql.checkEqual(tdSql.queryResult[0][8], buffer)
+ if platform.system() == "Linux" and platform.machine() == "aarch64":
+ tdLog.debug("Skip check points for Linux aarch64 due to environment settings")
+ else:
+ for buffer in self.buffer_boundary:
+ tdSql.execute(f'alter database db buffer {buffer}')
+ tdSql.query(
+ 'select * from information_schema.ins_databases where name = "db"')
+ tdSql.checkEqual(tdSql.queryResult[0][8], buffer)
tdSql.execute('drop database db')
tdSql.execute('create database db vgroups 10')
for buffer in self.buffer_error:
diff --git a/tests/system-test/1-insert/precisionNS.py b/tests/system-test/1-insert/precisionNS.py
index 11d79180a9..84e1218d0d 100644
--- a/tests/system-test/1-insert/precisionNS.py
+++ b/tests/system-test/1-insert/precisionNS.py
@@ -224,6 +224,40 @@ class TDTestCase:
sql = f"select timediff(ts - {val}b, ts1) from st "
self.checkExpect(sql, val)
+ # timetruncate check
+ sql = '''select ts,timetruncate(ts,1u),
+ timetruncate(ts,1b),
+ timetruncate(ts,1m),
+ timetruncate(ts,1h),
+ timetruncate(ts,1w)
+ from t0 order by ts desc limit 1;'''
+ tdSql.query(sql)
+ tdSql.checkData(0,1, "2023-03-28 18:40:00.000009000")
+ tdSql.checkData(0,2, "2023-03-28 18:40:00.000009999")
+ tdSql.checkData(0,3, "2023-03-28 18:40:00.000000000")
+ tdSql.checkData(0,4, "2023-03-28 18:00:00.000000000")
+ tdSql.checkData(0,5, "2023-03-23 00:00:00.000000000")
+
+ # timediff
+ sql = '''select ts,timediff(ts,ts+1b,1b),
+ timediff(ts,ts+1u,1u),
+ timediff(ts,ts+1a,1a),
+ timediff(ts,ts+1s,1s),
+ timediff(ts,ts+1m,1m),
+ timediff(ts,ts+1h,1h),
+ timediff(ts,ts+1d,1d),
+ timediff(ts,ts+1w,1w)
+ from t0 order by ts desc limit 1;'''
+ tdSql.query(sql)
+ tdSql.checkData(0,1, 1)
+ tdSql.checkData(0,2, 1)
+ tdSql.checkData(0,3, 1)
+ tdSql.checkData(0,4, 1)
+ tdSql.checkData(0,5, 1)
+ tdSql.checkData(0,6, 1)
+ tdSql.checkData(0,7, 1)
+ tdSql.checkData(0,8, 1)
+
# init
def init(self, conn, logSql, replicaVar=1):
seed = time.time() % 10000
diff --git a/tests/system-test/1-insert/precisionUS.py b/tests/system-test/1-insert/precisionUS.py
index d634149297..7eab452811 100644
--- a/tests/system-test/1-insert/precisionUS.py
+++ b/tests/system-test/1-insert/precisionUS.py
@@ -218,6 +218,20 @@ class TDTestCase:
sql = f"select count(ts) from st where timediff(ts - {val}{uint}, ts1) = {usval} "
self.checkExpect(sql, expectVal)
+ # timetruncate check
+ sql = '''select ts,timetruncate(ts,1a),
+ timetruncate(ts,1s),
+ timetruncate(ts,1m),
+ timetruncate(ts,1h),
+ timetruncate(ts,1w)
+ from t0 order by ts desc limit 1;'''
+ tdSql.query(sql)
+ tdSql.checkData(0,1, "2023-03-28 18:40:00.009000")
+ tdSql.checkData(0,2, "2023-03-28 18:40:00.000000")
+ tdSql.checkData(0,3, "2023-03-28 18:40:00.000000")
+ tdSql.checkData(0,4, "2023-03-28 18:00:00.000000")
+ tdSql.checkData(0,5, "2023-03-23 00:00:00.000000")
+
# init
def init(self, conn, logSql, replicaVar=1):
seed = time.time() % 10000
diff --git a/tests/system-test/2-query/group_partition.py b/tests/system-test/2-query/group_partition.py
index e228351f0e..a20b124c33 100644
--- a/tests/system-test/2-query/group_partition.py
+++ b/tests/system-test/2-query/group_partition.py
@@ -168,8 +168,37 @@ class TDTestCase:
tdSql.query(f"select tbname, count(*) from {self.dbname}.{self.stable} partition by tbname event_window start with c1 >= 0 end with c2 = 9;")
tdSql.checkRows(nonempty_tb_num)
+ def test_event_window(self, nonempty_tb_num):
+ tdSql.query(f"select tbname, count(*) from {self.dbname}.{self.stable} partition by tbname event_window start with c1 >= 0 end with c2 = 9 and 1=1;")
+ tdSql.checkRows(nonempty_tb_num)
+
+ tdSql.query(f"select tbname, count(*) from {self.dbname}.{self.stable} partition by tbname event_window start with c1 >= 0 end with c2 = 9 and 1=0;")
+ tdSql.checkRows(0)
+
+ tdSql.query(f"select tbname, count(*) from {self.dbname}.{self.stable} partition by tbname event_window start with c1 >= 0 end with c2 = 9 and tbname='sub_{self.stable}_0';")
+ tdSql.checkRows(1)
+
+ tdSql.query(f"select tbname, count(*) from {self.dbname}.{self.stable} partition by tbname event_window start with c1 >= 0 end with c2 = 9 and t2=0;")
+ tdSql.checkRows(1)
+
+ tdSql.query(f"select tbname, count(*) from {self.dbname}.{self.stable} partition by tbname event_window start with c1 >= 0 end with c2 = 9 and _rowts>0;")
+ tdSql.checkRows(nonempty_tb_num)
+
+ tdSql.query(f"select tbname, count(*) from {self.dbname}.{self.stable} partition by tbname event_window start with c1 >= 0 end with c2 = 9 and _qstart>0;")
+ tdSql.checkRows(0)
+ tdSql.query(f"select tbname, count(*) from {self.dbname}.{self.stable} partition by tbname event_window start with c1 >= 0 end with c2 = 9 and _qstart<0;")
+ tdSql.checkRows(0)
+ tdSql.query(f"select tbname, count(*) from {self.dbname}.{self.stable} partition by tbname event_window start with c1 >= 0 end with c2 = 9 and _qstart<_qend;")
+ tdSql.checkRows(0)
+
+ tdSql.error(f"select tbname, count(*) from {self.dbname}.{self.stable} partition by tbname event_window start with c1 >= 0 end with c2 = 9 and _wstart= 0 end with c2 = 9 and _wstart - q_start > 0;")
+ tdSql.error(f"select tbname, count(*) from {self.dbname}.{self.stable} partition by tbname event_window start with c1 >= 0 end with c2 = 9 and _irowts>0;")
+ tdSql.error(f"select tbname, count(*) from {self.dbname}.{self.stable} partition by tbname event_window start with c1 >= 0 and _wduration > 5s end with c2 = 9;")
+ tdSql.error(f"select tbname, count(*) from {self.dbname}.{self.stable} partition by tbname event_window start with c1 >= 0 end with c2 = 9 and _wstart > 1299845454;")
+ tdSql.error(f"select tbname, count(*) from {self.dbname}.{self.stable} partition by tbname event_window start with c1 >= 0 end with c2 = 9 and _wduration + 1s > 5s;")
+ tdSql.error(f"select tbname, count(*) from {self.dbname}.{self.stable} partition by tbname event_window start with c1 >= 0 end with c2 = 9 and count(*) > 10;")
-
def test_error(self):
tdSql.error(f"select * from {self.dbname}.{self.stable} group by t2")
tdSql.error(f"select t2, count(*) from {self.dbname}.{self.stable} group by t2 where t2 = 1")
@@ -197,6 +226,7 @@ class TDTestCase:
self.test_multi_group_key(self.tb_nums, nonempty_tb_num)
self.test_multi_agg(self.tb_nums, nonempty_tb_num)
self.test_window(nonempty_tb_num)
+ self.test_event_window(nonempty_tb_num)
## test old version before changed
# self.test_groupby('group', 0, 0)
diff --git a/tests/system-test/2-query/last_row.py b/tests/system-test/2-query/last_row.py
index 6469b3ea54..0744b3bae5 100644
--- a/tests/system-test/2-query/last_row.py
+++ b/tests/system-test/2-query/last_row.py
@@ -861,11 +861,56 @@ class TDTestCase:
self.support_super_table_test()
+ def initLastRowDelayTest(self, dbname="db"):
+ tdSql.execute(f"drop database if exists {dbname} ")
+ create_db_sql = f"create database if not exists {dbname} keep 3650 duration 1000 cachemodel 'NONE' REPLICA 1"
+ tdSql.execute(create_db_sql)
+
+ time.sleep(3)
+ tdSql.execute(f"use {dbname}")
+ tdSql.execute(f'create stable {dbname}.st(ts timestamp, v_int int, v_float float) TAGS (ctname varchar(32))')
+
+ tdSql.execute(f"create table {dbname}.ct1 using {dbname}.st tags('ct1')")
+ tdSql.execute(f"create table {dbname}.ct2 using {dbname}.st tags('ct2')")
+
+ tdSql.execute(f"insert into {dbname}.st(tbname,ts,v_float, v_int) values('ct1',1630000000000,86,86)")
+ tdSql.execute(f"insert into {dbname}.st(tbname,ts,v_float, v_int) values('ct1',1630000021255,59,59)")
+ tdSql.execute(f'flush database {dbname}')
+ tdSql.execute(f'select last(*) from {dbname}.st')
+ tdSql.execute(f'select last_row(*) from {dbname}.st')
+ tdSql.execute(f"insert into {dbname}.st(tbname,ts) values('ct1',1630000091255)")
+ tdSql.execute(f'flush database {dbname}')
+ tdSql.execute(f'select last(*) from {dbname}.st')
+ tdSql.execute(f'select last_row(*) from {dbname}.st')
+ tdSql.execute(f'alter database {dbname} cachemodel "both"')
+ tdSql.query(f'select last(*) from {dbname}.st')
+ tdSql.checkData(0 , 1 , 59)
+
+ tdSql.query(f'select last_row(*) from {dbname}.st')
+ tdSql.checkData(0 , 1 , None)
+ tdSql.checkData(0 , 2 , None)
+
+ tdLog.printNoPrefix("========== delay test init success ==============")
+
+ def lastRowDelayTest(self, dbname="db"):
+ tdLog.printNoPrefix("========== delay test start ==============")
+
+ tdSql.execute(f"use {dbname}")
+
+ tdSql.query(f'select last(*) from {dbname}.st')
+ tdSql.checkData(0 , 1 , 59)
+
+ tdSql.query(f'select last_row(*) from {dbname}.st')
+ tdSql.checkData(0 , 1 , None)
+ tdSql.checkData(0 , 2 , None)
+
def run(self): # sourcery skip: extract-duplicate-method, remove-redundant-fstring
# tdSql.prepare()
tdLog.printNoPrefix("==========step1:create table ==============")
+ self.initLastRowDelayTest("DELAYTEST")
+
# cache_last 0
self.prepare_datas("'NONE' ")
self.prepare_tag_datas("'NONE'")
@@ -890,6 +935,8 @@ class TDTestCase:
self.insert_datas_and_check_abs(self.tb_nums,self.row_nums,self.time_step,"'BOTH'")
self.basic_query()
+ self.lastRowDelayTest("DELAYTEST")
+
def stop(self):
tdSql.close()
diff --git a/tests/system-test/2-query/orderBy.py b/tests/system-test/2-query/orderBy.py
index dedc57eab3..af1ddadc39 100644
--- a/tests/system-test/2-query/orderBy.py
+++ b/tests/system-test/2-query/orderBy.py
@@ -278,19 +278,19 @@ class TDTestCase:
def queryOrderByAgg(self):
- tdSql.query("SELECT COUNT(*) FROM t1 order by COUNT(*)")
+ tdSql.no_error("SELECT COUNT(*) FROM t1 order by COUNT(*)")
- tdSql.query("SELECT COUNT(*) FROM t1 order by last(c2)")
+ tdSql.no_error("SELECT COUNT(*) FROM t1 order by last(c2)")
- tdSql.query("SELECT c1 FROM t1 order by last(ts)")
+ tdSql.no_error("SELECT c1 FROM t1 order by last(ts)")
- tdSql.query("SELECT ts FROM t1 order by last(ts)")
+ tdSql.no_error("SELECT ts FROM t1 order by last(ts)")
- tdSql.query("SELECT last(ts), ts, c1 FROM t1 order by 2")
+ tdSql.no_error("SELECT last(ts), ts, c1 FROM t1 order by 2")
- tdSql.query("SELECT ts, last(ts) FROM t1 order by last(ts)")
+ tdSql.no_error("SELECT ts, last(ts) FROM t1 order by last(ts)")
- tdSql.query(f"SELECT * FROM t1 order by last(ts)")
+ tdSql.no_error(f"SELECT * FROM t1 order by last(ts)")
tdSql.query(f"SELECT last(ts) as t2, ts FROM t1 order by 1")
tdSql.checkRows(1)
@@ -302,6 +302,56 @@ class TDTestCase:
tdSql.error(f"SELECT last(ts) as t2, ts FROM t1 order by last(t2)")
+ tdSql.execute(f"alter local 'keepColumnName' '1'")
+ tdSql.no_error(f"SELECT last(ts), first(ts) FROM t1 order by last(ts)")
+ tdSql.no_error(f"SELECT last(c1), first(c1) FROM t1 order by last(c1)")
+ tdSql.error(f"SELECT last(ts) as t, first(ts) as t FROM t1 order by last(t)")
+
+ def queryOrderByAmbiguousName(self):
+ tdSql.error(sql="select c1 as name, c2 as name, c3 from t1 order by name", expectErrInfo='ambiguous',
+ fullMatched=False)
+
+ tdSql.error(sql="select c1, c2 as c1, c3 from t1 order by c1", expectErrInfo='ambiguous', fullMatched=False)
+
+ tdSql.error(sql='select last(ts), last(c1) as name ,last(c2) as name,last(c3) from t1 order by name',
+ expectErrInfo='ambiguous', fullMatched=False)
+
+ tdSql.no_error("select c1 as name, c2 as c1, c3 from t1 order by c1")
+
+ tdSql.no_error('select c1 as name from (select c1, c2 as name from st) order by name')
+
+ def queryOrderBySameCol(self):
+ tdLog.info("query OrderBy same col ....")
+ tdSql.execute(f"create stable sta (ts timestamp, col1 int) tags(t1 int);")
+ tdSql.execute(f"create table tba1 using sta tags(1);")
+ tdSql.execute(f"create table tba2 using sta tags(2);")
+
+ pd = datetime.datetime.now()
+ ts = int(datetime.datetime.timestamp(pd)*1000*1000)
+ tdSql.execute(f"insert into tba1 values ({ts}, 1);")
+ tdSql.execute(f"insert into tba1 values ({ts+2}, 3);")
+ tdSql.execute(f"insert into tba1 values ({ts+3}, 4);")
+ tdSql.execute(f"insert into tba1 values ({ts+4}, 5);")
+ tdSql.execute(f"insert into tba2 values ({ts}, 2);")
+ tdSql.execute(f"insert into tba2 values ({ts+1}, 3);")
+ tdSql.execute(f"insert into tba2 values ({ts+3}, 5);")
+ tdSql.execute(f"insert into tba2 values ({ts+5}, 7);")
+ tdSql.query(f"select a.col1, b.col1 from sta a inner join sta b on a.ts = b.ts and a.ts < {ts+2} order by a.col1, b.col1;")
+ tdSql.checkData(0, 0, 1)
+ tdSql.checkData(0, 1, 1)
+ tdSql.checkData(1, 0, 1)
+ tdSql.checkData(1, 1, 2)
+ tdSql.query(f"select a.col1, b.col1 from sta a inner join sta b on a.ts = b.ts and a.ts < {ts+2} order by a.col1, b.col1 desc;")
+ tdSql.checkData(0, 0, 1)
+ tdSql.checkData(0, 1, 2)
+ tdSql.checkData(1, 0, 1)
+ tdSql.checkData(1, 1, 1)
+
+ tdSql.query(f"select a.col1, b.col1 from sta a inner join sta b on a.ts = b.ts and a.ts < {ts+2} order by a.col1 desc, b.col1 desc;")
+ tdSql.checkData(1, 0, 2)
+ tdSql.checkData(1, 1, 2)
+ tdSql.checkData(2, 0, 2)
+ tdSql.checkData(2, 1, 1)
# run
def run(self):
@@ -317,6 +367,10 @@ class TDTestCase:
# agg
self.queryOrderByAgg()
+ # td-28332
+ self.queryOrderByAmbiguousName()
+
+ self.queryOrderBySameCol()
# stop
def stop(self):
diff --git a/tests/system-test/2-query/partition_expr.py b/tests/system-test/2-query/partition_expr.py
new file mode 100644
index 0000000000..c03d7eccb3
--- /dev/null
+++ b/tests/system-test/2-query/partition_expr.py
@@ -0,0 +1,35 @@
+from wsgiref.headers import tspecials
+from util.log import *
+from util.cases import *
+from util.sql import *
+import numpy as np
+
+
+class TDTestCase:
+ def init(self, conn, logSql, replicaVar=1):
+ self.replicaVar = int(replicaVar)
+ tdLog.debug("start to execute %s" % __file__)
+ tdSql.init(conn.cursor())
+
+ self.rowNum = 10
+ self.batchNum = 5
+ self.ts = 1537146000000
+
+ def run(self):
+ dbname = "db"
+ tdSql.prepare()
+
+ tdSql.execute(f'''create table sta(ts timestamp, f int, col2 bigint) tags(tg1 int, tg2 binary(20))''')
+ tdSql.execute(f"create table sta1 using sta tags(1, 'a')")
+ tdSql.execute(f"insert into sta1 values(1537146000001, 11, 110)")
+ tdSql.execute(f"insert into sta1 values(1537146000002, 12, 120)")
+ tdSql.execute(f"insert into sta1 values(1537146000003, 13, 130)")
+
+ tdSql.query("select _wstart, f+100, count(*) from db.sta partition by f+100 session(ts, 1a) order by _wstart");
+ tdSql.checkData(0, 1, 111.0)
+ def stop(self):
+ tdSql.close()
+ tdLog.success("%s successfully executed" % __file__)
+
+tdCases.addWindows(__file__, TDTestCase())
+tdCases.addLinux(__file__, TDTestCase())
diff --git a/tests/system-test/2-query/select_null.py b/tests/system-test/2-query/select_null.py
index 8411a33a1f..682a98ad19 100755
--- a/tests/system-test/2-query/select_null.py
+++ b/tests/system-test/2-query/select_null.py
@@ -24,7 +24,8 @@ from util.dnodes import tdDnodes
from util.dnodes import *
class TDTestCase:
-
+ updatecfgDict = {'debugflag':0,'stdebugFlag': 143 ,"tqDebugflag":135}
+
def init(self, conn, logSql, replicaVar):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
diff --git a/tests/system-test/2-query/statecount.py b/tests/system-test/2-query/statecount.py
index f76e153014..006215956b 100644
--- a/tests/system-test/2-query/statecount.py
+++ b/tests/system-test/2-query/statecount.py
@@ -103,6 +103,10 @@ class TDTestCase:
f"select statecount(c1 ,'GT',1) , min(c1) from {dbname}.t1",
f"select statecount(c1 ,'GT',1) , spread(c1) from {dbname}.t1",
f"select statecount(c1 ,'GT',1) , diff(c1) from {dbname}.t1",
+ f"select statecount(c1 ,'GTA',1) , diff(c1) from {dbname}.t1",
+ f"select statecount(c1 ,'EQA',1) , diff(c1) from {dbname}.t1",
+ f"select statecount(c1 ,'',1) , diff(c1) from {dbname}.t1",
+ f"select statecount(c1 ,'E',1) , diff(c1) from {dbname}.t1",
]
for error_sql in error_sql_lists:
tdSql.error(error_sql)
diff --git a/tests/system-test/2-query/td-28068.py b/tests/system-test/2-query/td-28068.py
index d77e012d9a..0dfaf8e126 100644
--- a/tests/system-test/2-query/td-28068.py
+++ b/tests/system-test/2-query/td-28068.py
@@ -20,9 +20,10 @@ class TDTestCase:
tdSql.execute("insert into td_28068.ct4 using td_28068.st (branch, scenario) tags ('3.1', 'scenario2') values (now(), 'query1', 9,10);")
def run(self):
- tdSql.error('select last(ts) as ts, last(branch) as branch, last(scenario) as scenario, last(test_case) as test_case from td_28068.st group by branch, scenario order by last(branch);')
- tdSql.error('select last(ts) as ts, last(branch) as branch1, last(scenario) as scenario, last(test_case) as test_case from td_28068.st group by branch, scenario order by last(branch), last(scenario); ')
-
+ tdSql.query('select last(ts) as ts, last(branch) as branch, last(scenario) as scenario, last(test_case) as test_case from td_28068.st group by branch, scenario order by last(branch);')
+ tdSql.checkRows(4)
+ tdSql.query('select last(ts) as ts, last(branch) as branch1, last(scenario) as scenario, last(test_case) as test_case from td_28068.st group by branch, scenario order by last(branch), last(scenario); ')
+ tdSql.checkRows(4)
tdSql.query('select last(ts) as ts, last(branch) as branch1, last(scenario) as scenario, last(test_case) as test_case from td_28068.st group by branch, scenario order by last(branch); ')
tdSql.checkRows(4)
diff --git a/tests/system-test/2-query/test_ts4382.py b/tests/system-test/2-query/test_ts4382.py
index 50ec67ed23..9b2b3770b9 100644
--- a/tests/system-test/2-query/test_ts4382.py
+++ b/tests/system-test/2-query/test_ts4382.py
@@ -1,5 +1,5 @@
import random
-import string
+import itertools
from util.log import *
from util.cases import *
from util.sql import *
@@ -15,56 +15,510 @@ class TDTestCase:
self.replicaVar = int(replicaVar)
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
- self.dbname = 'db'
- self.stbname = 'st'
- self.ctbname_list = ["ct1", "ct2"]
- self.tag_value_list = ['{"instance":"100"}', '{"instance":"200"}']
+
+ self.metadata_dic = {
+ "db_tag_json": {
+ "supertables": [
+ {
+ "name": "st",
+ "child_table_num": 2,
+ "columns": [
+ {
+ "name": "ts",
+ "type": "timestamp"
+ },
+ {
+ "name": "col1",
+ "type": "int"
+ }
+ ],
+ "tags": [
+ {
+ "name": "t1",
+ "type": "json"
+ }
+ ]
+ }
+ ]
+ },
+ "db": {
+ "supertables": [
+ {
+ "name": "st1",
+ "child_table_num": 2,
+ "columns": [
+ {
+ "name": "ts",
+ "type": "timestamp"
+ },
+ {
+ "name": "col1",
+ "type": "int"
+ },
+ {
+ "name": "col2",
+ "type": "bigint"
+ },
+ {
+ "name": "col3",
+ "type": "float"
+ },
+ {
+ "name": "col4",
+ "type": "double"
+ },
+ {
+ "name": "col5",
+ "type": "bool"
+ },
+ {
+ "name": "col6",
+ "type": "binary(16)"
+ },
+ {
+ "name": "col7",
+ "type": "nchar(16)"
+ },
+ {
+ "name": "col8",
+ "type": "geometry(512)"
+ },
+ {
+ "name": "col9",
+ "type": "varbinary(32)"
+ }
+ ],
+ "tags": [
+ {
+ "name": "t1",
+ "type": "timestamp"
+ },
+ {
+ "name": "t2",
+ "type": "int"
+ },
+ {
+ "name": "t3",
+ "type": "bigint"
+ },
+ {
+ "name": "t4",
+ "type": "float"
+ },
+ {
+ "name": "t5",
+ "type": "double"
+ },
+ {
+ "name": "t6",
+ "type": "bool"
+ },
+ {
+ "name": "t7",
+ "type": "binary(16)"
+ },
+ {
+ "name": "t8",
+ "type": "nchar(16)"
+ },
+ {
+ "name": "t9",
+ "type": "geometry(512)"
+ },
+ {
+ "name": "t10",
+ "type": "varbinary(32)"
+ }
+ ]
+ },
+ {
+ "name": "st2",
+ "child_table_num": 2,
+ "columns": [
+ {
+ "name": "ts",
+ "type": "timestamp"
+ },
+ {
+ "name": "col1",
+ "type": "int"
+ },
+ {
+ "name": "col2",
+ "type": "bigint"
+ },
+ {
+ "name": "col3",
+ "type": "float"
+ },
+ {
+ "name": "col4",
+ "type": "double"
+ },
+ {
+ "name": "col5",
+ "type": "bool"
+ },
+ {
+ "name": "col6",
+ "type": "binary(16)"
+ },
+ {
+ "name": "col7",
+ "type": "nchar(16)"
+ },
+ {
+ "name": "col8",
+ "type": "geometry(512)"
+ },
+ {
+ "name": "col9",
+ "type": "varbinary(32)"
+ }
+ ],
+ "tags": [
+ {
+ "name": "t1",
+ "type": "timestamp"
+ },
+ {
+ "name": "t2",
+ "type": "int"
+ },
+ {
+ "name": "t3",
+ "type": "bigint"
+ },
+ {
+ "name": "t4",
+ "type": "float"
+ },
+ {
+ "name": "t5",
+ "type": "double"
+ },
+ {
+ "name": "t6",
+ "type": "bool"
+ },
+ {
+ "name": "t7",
+ "type": "binary(16)"
+ },
+ {
+ "name": "t8",
+ "type": "nchar(16)"
+ },
+ {
+ "name": "t9",
+ "type": "geometry(512)"
+ },
+ {
+ "name": "t10",
+ "type": "varbinary(32)"
+ }
+ ]
+ }
+ ]
+ }
+ }
def prepareData(self):
- # db
- tdSql.execute("create database {};".format(self.dbname))
- tdSql.execute("use {};".format(self.dbname))
- tdLog.debug("Create database %s" % self.dbname)
+ for db in self.metadata_dic.keys():
+ if db == "db_tag_json":
+ # db
+ tdSql.execute(f"create database {db};")
+ tdSql.execute(f"use {db};")
+ tdLog.debug(f"Create database {db}")
- # super table
- tdSql.execute("create table {} (ts timestamp, col1 int) tags (t1 json);".format(self.stbname))
- tdLog.debug("Create super table %s" % self.stbname)
+ # super table
+ for item in self.metadata_dic[db]["supertables"]:
+ sql = f"create table {item['name']} ("
+ for column in item["columns"]:
+ sql += f"{column['name']} {column['type']},"
+ sql = sql[:-1] + ") tags ("
+ for tag in item["tags"]:
+ sql += f"{tag['name']} {tag['type']},"
+ sql = sql[:-1] + ");"
+ tdLog.debug(sql)
+ tdSql.execute(sql)
+ tdLog.debug(f"Create super table {item['name']}")
- # child table
- for i in range(len(self.ctbname_list)):
- tdSql.execute("create table {} using {} tags('{}');".format(self.ctbname_list[i], self.stbname, self.tag_value_list[i]))
- tdLog.debug("Create child table %s" % self.ctbname_list)
+ # child table
+ tag_value_list = ['{"instance":"100"}', '{"instance":"200"}']
+ for i in range(item["child_table_num"]):
+ tdSql.execute(f"create table {'ct' + str(i+1)} using {item['name']} tags('{tag_value_list[i]}');")
+ tdLog.debug(f"Create child table {'ct' + str(i+1)} successfully")
- # insert data
- tdSql.execute("insert into {} values(now, 1)(now+1s, 2)".format(self.ctbname_list[0]))
- tdSql.execute("insert into {} values(now, null)(now+1s, null)".format(self.ctbname_list[1]))
+ # insert data
+ if i == 0:
+ tdSql.execute(f"insert into {'ct' + str(i+1)} values(now, 1)(now+1s, 2)")
+ elif i == 1:
+ tdSql.execute(f"insert into {'ct' + str(i+1)} values(now, null)(now+1s, null)")
+ elif db == "db":
+ # create database db_empty
+ tdSql.execute("create database db_empty;")
+ tdSql.execute("use db_empty;")
+ tdLog.debug("Create database db_empty successfully")
+
+ # super table
+ for item in self.metadata_dic[db]["supertables"]:
+ sql = f"create table {item['name']} ("
+ for column in item["columns"]:
+ sql += f"{column['name']} {column['type']},"
+ sql = sql[:-1] + ") tags ("
+ for tag in item["tags"]:
+ sql += f"{tag['name']} {tag['type']},"
+ sql = sql[:-1] + ");"
+ tdLog.debug(sql)
+ tdSql.execute(sql)
+ tdLog.debug(f"Create super table {item['name']}")
+
+ # child table
+ tag_value_list = [['2024-01-01 12:00:00.000', 1, 1111111111111, 1.11, 111111.1111, True, 'aaa', 'beijing', 'POINT (3.000000 6.000000)', '0x7661726331'],['2024-01-02 12:00:00.000', 2, 2222222222222, 2.22, 222222.2222, False, 'bbb', 'shanghai', 'LINESTRING (1.000000 1.000000, 2.000000 2.000000, 5.000000 5.000000)', '0x7f829000']]
+ for i in range(item["child_table_num"]):
+ sql = f"create table {'ct' + (str(i+1) if item['name'] == 'st1' else str(i+3))} using {item['name']} tags("
+ for tag in tag_value_list[i]:
+ if type(tag) == str:
+ sql += f"'{tag}',"
+ else:
+ sql += f"{tag},"
+ sql = sql[:-1] + ");"
+ tdSql.execute(sql)
+ tdLog.debug(f"Create child table {'ct' + (str(i+1) if item['name'] == 'st1' else str(i+3))} successfully")
+
+ # create database db_with_data
+ tdSql.execute("create database db_with_data;")
+ tdSql.execute("use db_with_data;")
+ tdLog.debug("Create database db_with_data successfully")
+
+ # super table
+ for item in self.metadata_dic[db]["supertables"]:
+ sql = f"create table {item['name']} ("
+ for column in item["columns"]:
+ sql += f"{column['name']} {column['type']},"
+ sql = sql[:-1] + ") tags ("
+ for tag in item["tags"]:
+ sql += f"{tag['name']} {tag['type']},"
+ sql = sql[:-1] + ");"
+ tdLog.debug(sql)
+ tdSql.execute(sql)
+ tdLog.debug(f"Create super table {item['name']}")
+
+ # child table
+ tag_value_list = [['2024-01-01 12:00:00.000', 1, 1111111111111, 1.11, 111111.1111, True, 'aaa', 'beijing', 'POINT (3.000000 6.000000)', '0x7661726331'],['2024-01-02 12:00:00.000', 2, 2222222222222, 2.22, 222222.2222, False, 'bbb', 'shanghai', 'LINESTRING (1.000000 1.000000, 2.000000 2.000000, 5.000000 5.000000)', '0x7f829000']]
+ for i in range(item["child_table_num"]):
+ sql = f"create table {'ct' + (str(i+1) if item['name'] == 'st1' else str(i+3))} using {item['name']} tags("
+ for tag in tag_value_list[i]:
+ if type(tag) == str:
+ sql += f"'{tag}',"
+ else:
+ sql += f"{tag},"
+ sql = sql[:-1] + ");"
+ tdSql.execute(sql)
+ tdLog.debug(f"Create child table {'ct' + (str(i+1) if item['name'] == 'st1' else str(i+3))} successfully")
+
+ # insert into data
+ start_ts = 1677654000000 # 2023-03-01 15:00:00.000
+ sql = "insert into {} values".format("ct" + (str(i+1) if item["name"] == "st1" else str(i+3)))
+ binary_vlist = ["ccc", "ddd", "eee", "fff"]
+ nchar_vlist = ["guangzhou", "tianjing", "shenzhen", "hangzhou"]
+ geometry_vlist = ["POINT (4.0 8.0)", "POINT (3.0 5.0)", "LINESTRING (1.000000 1.000000, 2.000000 2.000000, 5.000000 5.000000)", "POLYGON ((3.000000 6.000000, 5.000000 6.000000, 5.000000 8.000000, 3.000000 8.000000, 3.000000 6.000000))"]
+ varbinary_vlist = ["0x7661726332", "0x7661726333", "0x7661726334", "0x7661726335"]
+ st_index = i if item["name"] == "st1" else (i+2)
+ for i in range(100):
+ sql += f"({start_ts + 1000 * i}, {str(i+1)}, {str(i+1)}, {str(i+1)}, {str(i+1)}, {True if i % 2 == 0 else False}, '{binary_vlist[st_index % 4]}', '{nchar_vlist[st_index % 4]}', '{geometry_vlist[st_index % 4]}', '{varbinary_vlist[st_index % 4]}')"
+ tdSql.execute(sql)
+ tdLog.debug(f"Insert into data into child table {'ct' + (str(i+1) if item['name'] == 'st1' else str(i+3))} successfully")
+
+ def test_tag_json(self):
+ tdSql.execute("use db_tag_json;")
+
+ # super table query with correct tag name of json type
+ tdSql.query("select to_char(ts, 'yyyy-mm-dd hh24:mi:ss') as time, irate(col1) from st group by to_char(ts, 'yyyy-mm-dd hh24:mi:ss'), t1->'instance' order by time;")
+ tdSql.checkRows(2)
+
+ # child table query with incorrect tag name of json type
+ tdSql.query("select to_char(ts, 'yyyy-mm-dd hh24:mi:ss') as time, irate(col1) from ct1 group by to_char(ts, 'yyyy-mm-dd hh24:mi:ss'), t1->'name' order by time;")
+ tdSql.checkRows(0)
+
+ # child table query with null value
+ tdSql.query("select ts, avg(col1) from ct2 group by ts, t1->'name' order by ts;")
+ tdSql.checkRows(2)
+
+ def test_db_empty(self):
+ tdSql.execute("use db_empty;")
+ table_list = ["st1", "ct1"]
+ column_list = ["col1", "col2", "col3", "col4", "col5"]
+ tag_list = ["t2", "t3", "t4", "t5", "t6"]
+ operator_list = ["+", "-", "*", "/"]
+ fun_list = ["avg", "count", "sum", "spread"]
+
+ # two columns with arithmetic operation
+ for table in table_list:
+ for columns in list(itertools.combinations(column_list + tag_list, 2)):
+ operator = random.choice(operator_list)
+ sql = f"select ({columns[0]} {operator} {columns[1]}) as total from {table};"
+ tdSql.query(sql)
+ tdSql.checkRows(0)
+
+ # aggregation function
+ for table in table_list:
+ for columns in list(itertools.combinations(column_list[:-1] + tag_list[:-1], 2)):
+ fun = random.sample(fun_list, 2)
+ sql = f"select ({fun[0]}({columns[0]}) + {fun[1]}({columns[1]})) as total from {table};"
+ tdSql.query(sql)
+ if "count" in fun:
+ # default config 'countAlwaysReturnValue' as 0
+ tdSql.checkRows(1)
+ else:
+ tdSql.checkRows(0)
+
+ # join
+ table_list = ["st1", "st2", "ct1", "ct2", "ct3", "ct4"]
+ column_list = ["col1", "col2", "col3", "col4", "col5"]
+ tag_list = ["t2", "t3", "t4", "t5", "t6"]
+ where_list = ["col1 > 100", "col2 < 237883294", "col3 >= 163.23", "col4 <= 674324.2374898237", "col5=true", "col6='aaa'",
+ "col7='beijing'", "col8!='POINT (3.000000 6.000000)'", "col9='0x7661726331'"]
+ for table in list(itertools.combinations(table_list,2)):
+ where = random.choice(where_list)
+ column = random.choice(column_list)
+ tag = random.choice(tag_list)
+ sql = f"select ({table[0] + '.' + column} + {table[1] + '.' + tag}) total from {table[0]} join {table[1]} on {table[0]+ '.ts=' + table[1] + '.ts'} where {table[0] + '.' + where};"
+ tdSql.query(sql)
+ tdSql.checkRows(0)
+
+ # group by
+ value_fun_list = ["sum(col1+col2)", "avg(col3+col4)", "count(col6+col7)", "stddev(col2+col4)", "spread(col2+col3)"]
+ group_by_list = ["tbname", "t1", "t2", "t3", "t4", "t5", "t6", "t7", "t8", "t9", "t10"]
+ for table in table_list:
+ value_fun = random.choice(value_fun_list)
+ where = random.choice(where_list)
+ group_by = random.choice(group_by_list)
+ sql = f"select {value_fun} from {table} where {where} group by {group_by};"
+ tdSql.query(sql)
+ # default config 'countAlwaysReturnValue' as 0
+ if "count" in value_fun and "st" in table:
+ tdSql.checkRows(2)
+ elif "count" in value_fun and "ct" in table:
+ tdSql.checkRows(1)
+ else:
+ tdSql.checkRows(0)
+
+ # window query
+ for table in table_list:
+ tag = random.choice(tag_list)
+ if "st" in table:
+ sql = f"select _wstart, {tag}, avg(col3+col4) from {table} where ts between '2024-03-01' and '2024-03-02' partition by {tag} interval(10s) sliding(5s) fill(linear);"
+ elif "ct" in table:
+ sql = f"select _wstart, sum(col1+col2) from {table} where ts between '2024-03-01' and '2024-03-02' partition by {tag} interval(10s) sliding(5s) fill(next);"
+ tdSql.query(sql)
+ tdSql.checkRows(0)
+
+ # nested query
+ for table in table_list:
+ sql_list = [
+ "select (col1 + col2) from (select sum(col1) as col1, avg(col2) as col2 from {} where col1 > 100 and ts between '2024-03-01' and '2024-03-02' group by tbname);".format(table),
+ "select last(ts), avg(col2 - col3) from (select first(ts) as ts, sum(col2) as col2, last(col3) as col3 from {} where col9 != 'abc' partition by tbname interval(10s) sliding(5s));".format(table),
+ "select elapsed(ts, 1s), sum(c1 + c2) from (select * from (select ts, (col1+col2) as c1, (col3 * col4) as c2, tbname from {} where col1 > 100 and ts between '2024-03-01' and '2024-03-02')) group by tbname;".format(table)
+ ]
+ for sql in sql_list:
+ tdSql.query(sql)
+ tdSql.checkRows(0)
+
+ # drop column/tag
+ del_column_tag_list = ["col1", "t1"]
+ error_sql_list = [
+ "select first(t1), sum(col1) from st1 group by tbname;",
+ "select last(ts), avg(col1) from st1 group by tbname;",
+ "select count(col1) from (select * from st1 where ts between '2024-03-01' and '2024-03-02' and col1 > 100) group by tbname;",
+ ]
+ for item in del_column_tag_list:
+ if "col" in item:
+ sql = f"alter table st1 drop column {item};"
+ elif "t" in item:
+ sql = f"alter table st1 drop tag {item};"
+ tdSql.execute(sql)
+ tdLog.debug("Delete {} successfully".format(str(del_column_tag_list)))
+
+ for table in table_list:
+ for sql in error_sql_list:
+ tdSql.error(sql)
+
+ # modify column for common table
+ tdSql.execute("create table t1 (ts timestamp, col1 int, col2 bigint, col3 float, col4 double, col5 bool, col6 binary(16), col7 nchar(16), col8 geometry(512), col9 varbinary(32));")
+ tdSql.execute("insert into t1 values(now, 1, 1111111111111, 1.11, 111111.1111, True, 'aaa', 'beijing', 'POINT (3.000000 6.000000)', '0x7661726331');")
+ tdSql.execute("alter table t1 rename column col1 col11;")
+ tdSql.error("select col1 from t1 where ts <= now and col3=1.11;")
+ tdSql.query("select col11 from t1 where ts <= now and col3=1.11;")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, 1)
+
+ def test_db_with_data(self):
+ tdSql.execute("use db_with_data;")
+
+ sql_list = [
+ "select pow(col1, null) from st1 where ts > now;",
+ "select pow(null, col1) from st1 where ts > now;",
+ "select log(null, col2) from st1 where col1 > 1000;",
+ "select log(col2, null) from st1 where col1 > 1000;",
+ "select avg(col1 + t2) from ct1 where ts between '2025-03-01' and '2025-03-02' and t2 < 0;",
+ "select char_length(col6) from st1 where ts > now;",
+ "select concat(col6, col7) from st1 where ts > now;",
+ "select char_length(concat(col6, col7)) from st1 where ts > now;",
+ "select rtrim(ltrim(concat(col6, col7))) from st1 where ts > now;",
+ "select lower(rtrim(ltrim(concat(col6, col7)))) from st1 where ts > now;",
+ "select upper(rtrim(ltrim(concat(col6, col7)))) from st1 where ts > now;",
+ "select substr(rtrim(ltrim(concat(col6, col7))), 1, 10) from st1 where ts > now;",
+ "select avg(col1 - col2) as v from st1 where ts between '2022-03-01' and '2022-03-02';",
+ "select avg(col1 * col3) as v from st1 where ts between '2022-03-01' and '2022-03-02' and col1 > 100 group by tbname;",
+ "select sum(col1 / col4) as cv, avg(t2 + t3) as tv from st1 where ts between '2022-03-01' and '2022-03-02' and col1 > 100 group by tbname;",
+ "select sum(v1+v2) from (select first(ts) as time, avg(col1+col2) as v1, max(col3) as v2 from st1 where ts > now group by (col1+col2) order by (col1+col2));",
+ "select first(ts), count(*), avg(col2 * t3) from (select ts, col1, col2, col3, t1, t2, t3, tbname from st1 where ts between '2022-03-01' and '2022-03-02' and col1 > 100) group by tbname;",
+ "select cast(t8 as nchar(32)), sum(col1), avg(col2) from st1 where ts > now group by cast(t8 as nchar(32));",
+ "select to_char(time, 'yyyy-mm-dd'), sum(v2 - v1) from (select first(ts) as time, avg(col2 + col3) as v1, max(col4) as v2 from st1 where ts < now group by (col2+col3) order by (col2+col3)) where time > now group by to_char(time, 'yyyy-mm-dd');",
+ "select count(time) * sum(v) from (select to_iso8601(ts, '+00:00') as time, abs(col1+col2) as v, tbname from st1 where ts between '2023-03-01' and '2023-03-02' and col1 > 100) group by tbname;",
+ "select avg(v) from (select apercentile(col1, 50) as v from st1 where ts between '2023-03-01' and '2023-03-02' group by tbname) where v > 50;",
+ ]
+ for sql in sql_list:
+ tdSql.query(sql)
+ tdSql.checkRows(0)
+
+ tdSql.query("select total / v from (select elapsed(ts, 1s) as v, sum(col1) as total from st1 where ts between '2023-03-01' and '2023-03-02' interval(10s) fill(next));")
+ tdSql.checkRows(8641)
+ tdSql.checkData(0, 0, 11)
+
+ tdSql.query("select to_char(time, 'yyyy-mm-dd'), sum(v2 - v1) from (select first(ts) as time, avg(col2 + col3) as v1, max(col4) as v2 from st1 where ts < now group by (col2+col3) order by (col2+col3)) group by to_char(time, 'yyyy-mm-dd');")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2023-03-01')
+ tdSql.checkData(0, 1, -5050)
+
+ tdSql.query("select avg(v) from (select apercentile(col1, 50) as v from st1 where ts between '2023-03-01' and '2023-03-02' group by tbname) group by (50 -v);")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, 50)
+
+ # drop or modify column/tag
+ tdSql.execute("alter stable st1 drop column col7;")
+ tdLog.debug("Drop column col7 successfully")
+ tdSql.error("select count(*) from (select upper(col7) from st1);")
+
+ tdSql.execute("alter stable st1 drop column col8;")
+ tdLog.debug("Drop column col8 successfully")
+ tdSql.error("select last(ts), avg(col1) from (select *, tbname from st1 where col8='POINT (3.0 6.0)') group by tbname;")
+
+ tdSql.execute("alter stable st1 rename tag t8 t88;")
+ tdLog.debug("Rename tag t8 to t88 successfully")
+ tdSql.error("select count(*) from st1 t1, (select * from st1 where t8 is not null order by ts limit 10) t2 where t1.ts=t2.ts;")
+
+ tdSql.execute("alter stable st1 rename tag t9 t99;")
+ tdLog.debug("Rename tag t9 to t99 successfully")
+ tdSql.error("select count(*) from st1 t1, (select * from st1 where t9='POINT (4.0 8.0)' limit 5) t2 where t1.ts=t2.ts;")
def run(self):
self.prepareData()
- sql_list = [
- # super table query with correct tag name of json type
- {
- "sql": "select to_char(ts, 'yyyy-mm-dd hh24:mi:ss') as time, irate(col1) from st group by to_char(ts, 'yyyy-mm-dd hh24:mi:ss'), t1->'instance' order by time;",
- "result_check": "0.0"
- },
- # child table query with incorrect tag name of json type
- {
- "sql": "select to_char(ts, 'yyyy-mm-dd hh24:mi:ss') as time, irate(col1) from ct1 group by to_char(ts, 'yyyy-mm-dd hh24:mi:ss'), t1->'name' order by time;",
- "result_check": "None"
- },
- # child table query with null value
- {
- "sql": "select ts, avg(col1) from ct2 group by ts, t1->'name' order by ts;",
- "result_check": "None"
- }
- ]
- for sql_dic in sql_list:
- tdSql.query(sql_dic["sql"])
- tdLog.debug("execute sql: %s" % sql_dic["sql"])
- for item in [row[1] for row in tdSql.queryResult]:
- if sql_dic["result_check"] in str(item):
- tdLog.debug("Check query result of '{}' successfully".format(sql_dic["sql"]))
- break
+ self.test_tag_json()
+ self.test_db_empty()
+ self.test_db_with_data()
def stop(self):
tdSql.close()
@@ -72,4 +526,3 @@ class TDTestCase:
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())
-
diff --git a/tests/system-test/6-cluster/clusterCommonCreate.py b/tests/system-test/6-cluster/clusterCommonCreate.py
index a06c1233d8..cb8a9bc9e2 100644
--- a/tests/system-test/6-cluster/clusterCommonCreate.py
+++ b/tests/system-test/6-cluster/clusterCommonCreate.py
@@ -215,7 +215,10 @@ class ClusterComCreate:
return
def alterStbMetaData(self,tsql,dbName,stbName,ctbNum,rowsPerTbl,batchNum,startTs=None):
+
tdLog.debug("alter Stb column ............")
+ tdLog.debug(f"describe {dbName}.{stbName} ")
+ tsql.execute(f"describe {dbName}.{stbName} ;")
tdLog.debug(f"ALTER STABLE {dbName}.{stbName} MODIFY COLUMN c3 binary(20);")
tsql.execute(f" ALTER STABLE {dbName}.{stbName} MODIFY COLUMN c3 binary(20);")
tdLog.debug(f"ALTER STABLE {dbName}.{stbName} ADD COLUMN c4 DOUBLE;")
diff --git a/tests/system-test/7-tmq/tmqCheckData1.py b/tests/system-test/7-tmq/tmqCheckData1.py
index 1209c2812c..f443ce5b1e 100644
--- a/tests/system-test/7-tmq/tmqCheckData1.py
+++ b/tests/system-test/7-tmq/tmqCheckData1.py
@@ -51,7 +51,8 @@ class TDTestCase:
tdCom.create_ctable(tdSql, dbname=paraDict["dbName"],stbname=paraDict["stbName"],tag_elm_list=paraDict['tagSchema'],count=paraDict["ctbNum"], default_ctbname_prefix=paraDict['ctbPrefix'])
tdLog.info("insert data")
tmqCom.insert_data(tdSql,paraDict["dbName"],paraDict["ctbPrefix"],paraDict["ctbNum"],paraDict["rowsPerTbl"],paraDict["batchNum"],paraDict["startTs"])
-
+ tdSql.execute("insert into ctb0 values(now,1,'');")
+
tdLog.info("create topics from stb with filter")
queryString = "select ts,c1,c2 from %s.%s" %(paraDict['dbName'], paraDict['stbName'])
sqlString = "create topic %s as stable %s.%s" %(topicNameList[0], paraDict["dbName"],paraDict["stbName"])
diff --git a/tests/system-test/7-tmq/tmqDropConsumer.py b/tests/system-test/7-tmq/tmqDropConsumer.py
index 5208d14069..953e9314f1 100644
--- a/tests/system-test/7-tmq/tmqDropConsumer.py
+++ b/tests/system-test/7-tmq/tmqDropConsumer.py
@@ -12,7 +12,8 @@ sys.path.append("./7-tmq")
from tmqCommon import *
class TDTestCase:
- # updatecfgDict = {'debugFlag': 135}
+ clientCfgDict = {'debugFlag': 135}
+ updatecfgDict = {'debugFlag': 135, 'clientCfg':clientCfgDict}
def __init__(self):
self.vgroups = 2
diff --git a/tests/system-test/7-tmq/tmqParamsTest.py b/tests/system-test/7-tmq/tmqParamsTest.py
index 0e9e8f989f..9286b69278 100644
--- a/tests/system-test/7-tmq/tmqParamsTest.py
+++ b/tests/system-test/7-tmq/tmqParamsTest.py
@@ -11,7 +11,9 @@ sys.path.append("./7-tmq")
from tmqCommon import *
class TDTestCase:
- updatecfgDict = {'debugFlag': 135}
+ clientCfgDict = {'debugFlag': 135}
+ updatecfgDict = {'debugFlag': 135, 'clientCfg':clientCfgDict}
+
def init(self, conn, logSql, replicaVar=1):
self.replicaVar = int(replicaVar)
tdLog.debug(f"start to excute {__file__}")
diff --git a/tests/system-test/7-tmq/tmqVnodeSplit-column-false.py b/tests/system-test/7-tmq/tmqVnodeSplit-column-false.py
new file mode 100644
index 0000000000..6ef28a4e77
--- /dev/null
+++ b/tests/system-test/7-tmq/tmqVnodeSplit-column-false.py
@@ -0,0 +1,217 @@
+
+import taos
+import sys
+import time
+import socket
+import os
+import threading
+import math
+
+from util.log import *
+from util.sql import *
+from util.cases import *
+from util.dnodes import *
+from util.common import *
+from util.cluster import *
+sys.path.append("./7-tmq")
+from tmqCommon import *
+sys.path.append("./6-cluster")
+from clusterCommonCreate import *
+from clusterCommonCheck import clusterComCheck
+
+class TDTestCase:
+ def __init__(self):
+ self.vgroups = 1
+ self.ctbNum = 10
+ self.rowsPerTbl = 1000
+
+ def init(self, conn, logSql, replicaVar=1):
+ self.replicaVar = int(replicaVar)
+ tdLog.debug(f"start to excute {__file__}")
+ tdSql.init(conn.cursor(), True)
+
+ def getDataPath(self):
+ selfPath = tdCom.getBuildPath()
+
+ return selfPath + '/../sim/dnode%d/data/vnode/vnode%d/wal/*';
+
+ def prepareTestEnv(self):
+ tdLog.printNoPrefix("======== prepare test env include database, stable, ctables, and insert data: ")
+ paraDict = {'dbName': 'dbt',
+ 'dropFlag': 1,
+ 'event': '',
+ 'vgroups': 1,
+ 'stbName': 'stb',
+ 'colPrefix': 'c',
+ 'tagPrefix': 't',
+ 'colSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1},{'type': 'TIMESTAMP', 'count':1}],
+ 'tagSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1}],
+ 'ctbPrefix': 'ctb',
+ 'ctbStartIdx': 0,
+ 'ctbNum': 10,
+ 'rowsPerTbl': 1000,
+ 'batchNum': 10,
+ 'startTs': 1640966400000, # 2022-01-01 00:00:00.000
+ 'pollDelay': 60,
+ 'showMsg': 1,
+ 'showRow': 1,
+ 'snapshot': 0}
+
+ paraDict['vgroups'] = self.vgroups
+ paraDict['ctbNum'] = self.ctbNum
+ paraDict['rowsPerTbl'] = self.rowsPerTbl
+
+ tdCom.drop_all_db()
+ tmqCom.initConsumerTable()
+ tdCom.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], wal_retention_period=36000,vgroups=paraDict["vgroups"],replica=self.replicaVar)
+ tdLog.info("create stb")
+ tmqCom.create_stable(tdSql, dbName=paraDict["dbName"],stbName=paraDict["stbName"])
+ return
+
+ def restartAndRemoveWal(self, deleteWal):
+ tdDnodes = cluster.dnodes
+ tdSql.query("select * from information_schema.ins_vnodes")
+ for result in tdSql.queryResult:
+ if result[2] == 'dbt':
+ tdLog.debug("dnode is %d"%(result[0]))
+ dnodeId = result[0]
+ vnodeId = result[1]
+
+ tdDnodes[dnodeId - 1].stoptaosd()
+ time.sleep(1)
+ dataPath = self.getDataPath()
+ dataPath = dataPath%(dnodeId,vnodeId)
+ tdLog.debug("dataPath:%s"%dataPath)
+ if deleteWal:
+ if os.system('rm -rf ' + dataPath) != 0:
+ tdLog.exit("rm error")
+
+ tdDnodes[dnodeId - 1].starttaosd()
+ time.sleep(1)
+ break
+ tdLog.debug("restart dnode ok")
+
+ def splitVgroups(self):
+ tdSql.query("select * from information_schema.ins_vnodes")
+ vnodeId = 0
+ for result in tdSql.queryResult:
+ if result[2] == 'dbt':
+ vnodeId = result[1]
+ tdLog.debug("vnode is %d"%(vnodeId))
+ break
+ splitSql = "split vgroup %d" %(vnodeId)
+ tdLog.debug("splitSql:%s"%(splitSql))
+ tdSql.query(splitSql)
+ tdLog.debug("splitSql ok")
+
+ def tmqCase1(self, deleteWal=False):
+ tdLog.printNoPrefix("======== test case 1: ")
+ paraDict = {'dbName': 'dbt',
+ 'dropFlag': 1,
+ 'event': '',
+ 'vgroups': 1,
+ 'stbName': 'stb',
+ 'colPrefix': 'c',
+ 'tagPrefix': 't',
+ 'colSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1},{'type': 'TIMESTAMP', 'count':1}],
+ 'tagSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1}],
+ 'ctbPrefix': 'ctb1',
+ 'ctbStartIdx': 0,
+ 'ctbNum': 10,
+ 'rowsPerTbl': 1000,
+ 'batchNum': 10,
+ 'startTs': 1640966400000, # 2022-01-01 00:00:00.000
+ 'pollDelay': 180,
+ 'showMsg': 1,
+ 'showRow': 1,
+ 'snapshot': 0}
+
+ paraDict['vgroups'] = self.vgroups
+ paraDict['ctbNum'] = self.ctbNum
+ paraDict['rowsPerTbl'] = self.rowsPerTbl
+
+ topicNameList = ['topic1']
+ # expectRowsList = []
+ tmqCom.initConsumerTable()
+
+ tdLog.info("create topics from stb with filter")
+ queryString = "select * from %s.%s where c2 >= 0 "%(paraDict['dbName'], paraDict['stbName'])
+ # sqlString = "create topic %s as stable %s" %(topicNameList[0], paraDict['stbName'])
+ sqlString = "create topic %s as %s" %(topicNameList[0], queryString)
+ tdLog.info("create topic sql: %s"%sqlString)
+ tdSql.execute(sqlString)
+ # tdSql.query(queryString)
+ # expectRowsList.append(tdSql.getRows())
+
+ # init consume info, and start tmq_sim, then check consume result
+ tdLog.info("insert consume info to consume processor")
+ consumerId = 0
+ expectrowcnt = paraDict["rowsPerTbl"] * paraDict["ctbNum"] * 2
+ topicList = topicNameList[0]
+ ifcheckdata = 1
+ ifManualCommit = 1
+ keyList = 'group.id:cgrp1, enable.auto.commit:true, auto.commit.interval.ms:200, auto.offset.reset:earliest'
+ tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit)
+
+ tdLog.info("start consume processor")
+ tmqCom.startTmqSimProcess(pollDelay=paraDict['pollDelay'],dbName=paraDict["dbName"],showMsg=paraDict['showMsg'], showRow=paraDict['showRow'],snapshot=paraDict['snapshot'])
+ tdLog.info("wait the consume result")
+
+ tdLog.info("create ctb1")
+ tmqCom.create_ctable(tdSql, dbName=paraDict["dbName"],stbName=paraDict["stbName"],ctbPrefix=paraDict['ctbPrefix'],
+ ctbNum=paraDict["ctbNum"],ctbStartIdx=paraDict['ctbStartIdx'])
+
+ tdLog.info("create ctb2")
+ paraDict2 = paraDict.copy()
+ paraDict2['ctbPrefix'] = "ctb2"
+ tmqCom.create_ctable(tdSql, dbName=paraDict["dbName"],stbName=paraDict["stbName"],ctbPrefix=paraDict2['ctbPrefix'],
+ ctbNum=paraDict["ctbNum"],ctbStartIdx=paraDict['ctbStartIdx'])
+
+ tdLog.info("insert ctb1 data")
+ pInsertThread = tmqCom.asyncInsertDataByInterlace(paraDict)
+
+ tmqCom.getStartConsumeNotifyFromTmqsim()
+ tmqCom.getStartCommitNotifyFromTmqsim()
+
+ #restart dnode & remove wal
+ self.restartAndRemoveWal(deleteWal)
+
+ # split vgroup
+ self.splitVgroups()
+
+
+ tdLog.info("insert ctb2 data")
+ pInsertThread1 = tmqCom.asyncInsertDataByInterlace(paraDict2)
+ pInsertThread.join()
+ pInsertThread1.join()
+
+ expectRows = 1
+ resultList = tmqCom.selectConsumeResult(expectRows)
+
+ if expectrowcnt / 2 > resultList[0]:
+ tdLog.info("expect consume rows: %d, act consume rows: %d"%(expectrowcnt / 2, resultList[0]))
+ tdLog.exit("%d tmq consume rows error!"%consumerId)
+
+ # tmqCom.checkFileContent(consumerId, queryString)
+
+ time.sleep(2)
+ for i in range(len(topicNameList)):
+ tdSql.query("drop topic %s"%topicNameList[i])
+
+ if deleteWal == True:
+ clusterComCheck.check_vgroups_status(vgroup_numbers=2,db_replica=self.replicaVar,db_name="dbt",count_number=240)
+
+ tdLog.printNoPrefix("======== test case 1 end ...... ")
+
+ def run(self):
+ self.prepareTestEnv()
+ self.tmqCase1(False)
+
+ def stop(self):
+ tdSql.close()
+ tdLog.success(f"{__file__} successfully executed")
+
+event = threading.Event()
+
+tdCases.addLinux(__file__, TDTestCase())
+tdCases.addWindows(__file__, TDTestCase())
diff --git a/tests/system-test/7-tmq/tmqVnodeSplit-column.py b/tests/system-test/7-tmq/tmqVnodeSplit-column.py
index 74213c4536..8987cf5251 100644
--- a/tests/system-test/7-tmq/tmqVnodeSplit-column.py
+++ b/tests/system-test/7-tmq/tmqVnodeSplit-column.py
@@ -206,8 +206,6 @@ class TDTestCase:
def run(self):
self.prepareTestEnv()
self.tmqCase1(True)
- self.prepareTestEnv()
- self.tmqCase1(False)
def stop(self):
tdSql.close()
diff --git a/tests/system-test/7-tmq/tmqVnodeSplit-db-false.py b/tests/system-test/7-tmq/tmqVnodeSplit-db-false.py
new file mode 100644
index 0000000000..bad9e09da5
--- /dev/null
+++ b/tests/system-test/7-tmq/tmqVnodeSplit-db-false.py
@@ -0,0 +1,218 @@
+
+import taos
+import sys
+import time
+import socket
+import os
+import threading
+import math
+
+from util.log import *
+from util.sql import *
+from util.cases import *
+from util.dnodes import *
+from util.common import *
+from util.cluster import *
+sys.path.append("./7-tmq")
+from tmqCommon import *
+sys.path.append("./6-cluster")
+from clusterCommonCreate import *
+from clusterCommonCheck import clusterComCheck
+
+class TDTestCase:
+ def __init__(self):
+ self.vgroups = 1
+ self.ctbNum = 10
+ self.rowsPerTbl = 1000
+
+ def init(self, conn, logSql, replicaVar=1):
+ self.replicaVar = int(replicaVar)
+ tdLog.debug(f"start to excute {__file__}")
+ tdSql.init(conn.cursor(), True)
+
+ def getDataPath(self):
+ selfPath = tdCom.getBuildPath()
+
+ return selfPath + '/../sim/dnode%d/data/vnode/vnode%d/wal/*';
+
+ def prepareTestEnv(self):
+ tdLog.printNoPrefix("======== prepare test env include database, stable, ctables, and insert data: ")
+ paraDict = {'dbName': 'dbt',
+ 'dropFlag': 1,
+ 'event': '',
+ 'vgroups': 1,
+ 'stbName': 'stb',
+ 'colPrefix': 'c',
+ 'tagPrefix': 't',
+ 'colSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1},{'type': 'TIMESTAMP', 'count':1}],
+ 'tagSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1}],
+ 'ctbPrefix': 'ctb',
+ 'ctbStartIdx': 0,
+ 'ctbNum': 10,
+ 'rowsPerTbl': 1000,
+ 'batchNum': 10,
+ 'startTs': 1640966400000, # 2022-01-01 00:00:00.000
+ 'pollDelay': 180,
+ 'showMsg': 1,
+ 'showRow': 1,
+ 'snapshot': 0}
+
+ paraDict['vgroups'] = self.vgroups
+ paraDict['ctbNum'] = self.ctbNum
+ paraDict['rowsPerTbl'] = self.rowsPerTbl
+
+ tdCom.drop_all_db()
+ tmqCom.initConsumerTable()
+ tdCom.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], wal_retention_period=36000,vgroups=paraDict["vgroups"],replica=self.replicaVar)
+ tdLog.info("create stb")
+ tmqCom.create_stable(tdSql, dbName=paraDict["dbName"],stbName=paraDict["stbName"])
+ return
+
+ def restartAndRemoveWal(self, deleteWal):
+ tdDnodes = cluster.dnodes
+ tdSql.query("select * from information_schema.ins_vnodes")
+ for result in tdSql.queryResult:
+ if result[2] == 'dbt':
+ tdLog.debug("dnode is %d"%(result[0]))
+ dnodeId = result[0]
+ vnodeId = result[1]
+
+ tdDnodes[dnodeId - 1].stoptaosd()
+ time.sleep(1)
+ dataPath = self.getDataPath()
+ dataPath = dataPath%(dnodeId,vnodeId)
+ tdLog.debug("dataPath:%s"%dataPath)
+ if deleteWal:
+ if os.system('rm -rf ' + dataPath) != 0:
+ tdLog.exit("rm error")
+
+ tdDnodes[dnodeId - 1].starttaosd()
+ time.sleep(1)
+ break
+ tdLog.debug("restart dnode ok")
+
+ def splitVgroups(self):
+ tdSql.query("select * from information_schema.ins_vnodes")
+ vnodeId = 0
+ for result in tdSql.queryResult:
+ if result[2] == 'dbt':
+ vnodeId = result[1]
+ tdLog.debug("vnode is %d"%(vnodeId))
+ break
+ splitSql = "split vgroup %d" %(vnodeId)
+ tdLog.debug("splitSql:%s"%(splitSql))
+ tdSql.query(splitSql)
+ tdLog.debug("splitSql ok")
+
+ def tmqCase1(self, deleteWal=False):
+ tdLog.printNoPrefix("======== test case 1: ")
+ paraDict = {'dbName': 'dbt',
+ 'dropFlag': 1,
+ 'event': '',
+ 'vgroups': 1,
+ 'stbName': 'stb',
+ 'colPrefix': 'c',
+ 'tagPrefix': 't',
+ 'colSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1},{'type': 'TIMESTAMP', 'count':1}],
+ 'tagSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1}],
+ 'ctbPrefix': 'ctb1',
+ 'ctbStartIdx': 0,
+ 'ctbNum': 10,
+ 'rowsPerTbl': 1000,
+ 'batchNum': 10,
+ 'startTs': 1640966400000, # 2022-01-01 00:00:00.000
+ 'pollDelay': 60,
+ 'showMsg': 1,
+ 'showRow': 1,
+ 'snapshot': 0}
+
+ paraDict['vgroups'] = self.vgroups
+ paraDict['ctbNum'] = self.ctbNum
+ paraDict['rowsPerTbl'] = self.rowsPerTbl
+
+ topicNameList = ['topic1']
+ # expectRowsList = []
+ tmqCom.initConsumerTable()
+
+ tdLog.info("create topics from db")
+ queryString = "database %s"%(paraDict['dbName'])
+ # sqlString = "create topic %s as stable %s" %(topicNameList[0], paraDict['stbName'])
+ sqlString = "create topic %s as %s" %(topicNameList[0], queryString)
+ tdLog.info("create topic sql: %s"%sqlString)
+ tdSql.execute(sqlString)
+ # tdSql.query(queryString)
+ # expectRowsList.append(tdSql.getRows())
+
+ # init consume info, and start tmq_sim, then check consume result
+ tdLog.info("insert consume info to consume processor")
+ consumerId = 0
+ expectrowcnt = paraDict["rowsPerTbl"] * paraDict["ctbNum"] * 2
+ topicList = topicNameList[0]
+ ifcheckdata = 1
+ ifManualCommit = 1
+ keyList = 'group.id:cgrp1, enable.auto.commit:true, auto.commit.interval.ms:200, auto.offset.reset:earliest'
+ tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit)
+
+ tdLog.info("start consume processor")
+ tmqCom.startTmqSimProcess(pollDelay=paraDict['pollDelay'],dbName=paraDict["dbName"],showMsg=paraDict['showMsg'], showRow=paraDict['showRow'],snapshot=paraDict['snapshot'])
+ tdLog.info("wait the consume result")
+
+ tdLog.info("create ctb1")
+ tmqCom.create_ctable(tdSql, dbName=paraDict["dbName"],stbName=paraDict["stbName"],ctbPrefix=paraDict['ctbPrefix'],
+ ctbNum=paraDict["ctbNum"],ctbStartIdx=paraDict['ctbStartIdx'])
+
+ tdLog.info("create ctb2")
+ paraDict2 = paraDict.copy()
+
+ paraDict2['ctbPrefix'] = "ctb2"
+ tmqCom.create_ctable(tdSql, dbName=paraDict["dbName"],stbName=paraDict["stbName"],ctbPrefix=paraDict2['ctbPrefix'],
+ ctbNum=paraDict["ctbNum"],ctbStartIdx=paraDict['ctbStartIdx'])
+
+ tdLog.info("insert ctb1 data")
+ pInsertThread = tmqCom.asyncInsertDataByInterlace(paraDict)
+
+ tmqCom.getStartConsumeNotifyFromTmqsim()
+ tmqCom.getStartCommitNotifyFromTmqsim()
+
+ #restart dnode & remove wal
+ self.restartAndRemoveWal(deleteWal)
+
+ # split vgroup
+ self.splitVgroups()
+
+
+ tdLog.info("insert ctb2 data")
+ pInsertThread1 = tmqCom.asyncInsertDataByInterlace(paraDict2)
+ pInsertThread.join()
+ pInsertThread1.join()
+
+ expectRows = 1
+ resultList = tmqCom.selectConsumeResult(expectRows)
+
+ if expectrowcnt / 2 > resultList[0]:
+ tdLog.info("expect consume rows: %d, act consume rows: %d"%(expectrowcnt / 2, resultList[0]))
+ tdLog.exit("%d tmq consume rows error!"%consumerId)
+
+ # tmqCom.checkFileContent(consumerId, queryString)
+
+ time.sleep(2)
+ for i in range(len(topicNameList)):
+ tdSql.query("drop topic %s"%topicNameList[i])
+
+ if deleteWal == True:
+ clusterComCheck.check_vgroups_status(vgroup_numbers=2,db_replica=self.replicaVar,db_name="dbt",count_number=240)
+
+ tdLog.printNoPrefix("======== test case 1 end ...... ")
+
+ def run(self):
+ self.prepareTestEnv()
+ self.tmqCase1(False)
+
+ def stop(self):
+ tdSql.close()
+ tdLog.success(f"{__file__} successfully executed")
+
+event = threading.Event()
+
+tdCases.addLinux(__file__, TDTestCase())
+tdCases.addWindows(__file__, TDTestCase())
diff --git a/tests/system-test/7-tmq/tmqVnodeSplit-db.py b/tests/system-test/7-tmq/tmqVnodeSplit-db.py
index b9eac4b692..a9fb1c2d4b 100644
--- a/tests/system-test/7-tmq/tmqVnodeSplit-db.py
+++ b/tests/system-test/7-tmq/tmqVnodeSplit-db.py
@@ -207,8 +207,6 @@ class TDTestCase:
def run(self):
self.prepareTestEnv()
self.tmqCase1(True)
- self.prepareTestEnv()
- self.tmqCase1(False)
def stop(self):
tdSql.close()
diff --git a/tests/system-test/7-tmq/tmqVnodeSplit-stb-false.py b/tests/system-test/7-tmq/tmqVnodeSplit-stb-false.py
index 384959c52b..1e8b90d11e 100644
--- a/tests/system-test/7-tmq/tmqVnodeSplit-stb-false.py
+++ b/tests/system-test/7-tmq/tmqVnodeSplit-stb-false.py
@@ -54,7 +54,7 @@ class TDTestCase:
'rowsPerTbl': 1000,
'batchNum': 10,
'startTs': 1640966400000, # 2022-01-01 00:00:00.000
- 'pollDelay': 60,
+ 'pollDelay': 180,
'showMsg': 1,
'showRow': 1,
'snapshot': 0}
diff --git a/tests/system-test/7-tmq/tmqVnodeSplit-stb-select-duplicatedata-false.py b/tests/system-test/7-tmq/tmqVnodeSplit-stb-select-duplicatedata-false.py
index f6b523e5f4..3965168fa7 100644
--- a/tests/system-test/7-tmq/tmqVnodeSplit-stb-select-duplicatedata-false.py
+++ b/tests/system-test/7-tmq/tmqVnodeSplit-stb-select-duplicatedata-false.py
@@ -123,7 +123,7 @@ class TDTestCase:
'rowsPerTbl': 1000,
'batchNum': 10,
'startTs': 1640966400000, # 2022-01-01 00:00:00.000
- 'pollDelay': 120,
+ 'pollDelay': 180,
'showMsg': 1,
'showRow': 1,
'snapshot': 0}
diff --git a/tests/system-test/7-tmq/tmqVnodeTransform.py b/tests/system-test/7-tmq/tmqVnodeTransform.py
index 811b72c35f..c2b002ead6 100644
--- a/tests/system-test/7-tmq/tmqVnodeTransform.py
+++ b/tests/system-test/7-tmq/tmqVnodeTransform.py
@@ -186,7 +186,7 @@ class TDTestCase:
tmqCom.getStartCommitNotifyFromTmqsim()
#restart dnode & remove wal
- # self.restartAndRemoveWal()
+ self.restartAndRemoveWal()
# redistribute vgroup
self.redistributeVgroups();
@@ -235,7 +235,7 @@ class TDTestCase:
tdSql.execute(sqlString)
tdSql.query("flush database %s"%(paraDict['dbName']))
#restart dnode & remove wal
- # self.restartAndRemoveWal()
+ self.restartAndRemoveWal()
# redistribute vgroup
self.redistributeVgroups();
@@ -313,7 +313,7 @@ class TDTestCase:
time.sleep(5)
#restart dnode & remove wal
- # self.restartAndRemoveWal()
+ self.restartAndRemoveWal()
# redistribute vgroup
self.redistributeVgroups()
diff --git a/tests/system-test/8-stream/scalar_function.py b/tests/system-test/8-stream/scalar_function.py
index eda643f661..90257df252 100644
--- a/tests/system-test/8-stream/scalar_function.py
+++ b/tests/system-test/8-stream/scalar_function.py
@@ -6,8 +6,8 @@ from util.cases import *
from util.common import *
class TDTestCase:
- updatecfgDict = {'vdebugFlag': 143, 'qdebugflag':135, 'tqdebugflag':135, 'udebugflag':135, 'rpcdebugflag':135,
- 'asynclog': 0, 'stdebugflag':135}
+ updatecfgDict = {'debugFlag':0, 'vdebugFlag': 143, 'qdebugflag':135, 'tqdebugflag':135, 'udebugflag':135, 'rpcdebugflag':135,
+ 'asynclog': 0, 'stdebugflag':143}
def init(self, conn, logSql, replicaVar=1):
self.replicaVar = int(replicaVar)
tdLog.debug("start to execute %s" % __file__)
diff --git a/utils/test/c/varbinary_test.c b/utils/test/c/varbinary_test.c
index 522a820fe8..47bacf629b 100644
--- a/utils/test/c/varbinary_test.c
+++ b/utils/test/c/varbinary_test.c
@@ -85,7 +85,6 @@ void varbinary_sql_test() {
// test insert
pRes = taos_query(taos, "insert into tb2 using stb tags (2, 'tb2_bin1', 093) values (now + 2s, 'nchar1', 892, 0.3)");
- printf("error:%s", taos_errstr(pRes));
ASSERT(taos_errno(pRes) != 0);
pRes = taos_query(taos, "insert into tb3 using stb tags (3, 'tb3_bin1', 0x7f829) values (now + 3s, 'nchar1', 0x7f829, 0.3)");
@@ -322,6 +321,60 @@ void varbinary_sql_test() {
printf("%s result %s\n", __FUNCTION__, taos_errstr(pRes));
taos_free_result(pRes);
+ // test insert string value '\x'
+ pRes = taos_query(taos, "insert into tb5 using stb tags (5, 'tb5_bin1', '\\\\xg') values (now + 4s, 'nchar1', '\\\\xg', 0.3)");
+ taos_free_result(pRes);
+
+ pRes = taos_query(taos, "select c2,t3 from stb where t3 = '\\x5C7867'");
+ while ((row = taos_fetch_row(pRes)) != NULL) {
+ int32_t* length = taos_fetch_lengths(pRes);
+ void* data = NULL;
+ uint32_t size = 0;
+ if(taosAscii2Hex(row[0], length[0], &data, &size) < 0){
+ ASSERT(0);
+ }
+
+ ASSERT(memcmp(data, "\\x5C7867", size) == 0);
+ taosMemoryFree(data);
+
+ if(taosAscii2Hex(row[1], length[1], &data, &size) < 0){
+ ASSERT(0);
+ }
+
+ ASSERT(memcmp(data, "\\x5C7867", size) == 0);
+ taosMemoryFree(data);
+ }
+ taos_free_result(pRes);
+
+ // test insert
+ char tmp [65517*2+3] = {0};
+ tmp[0] = '\\';
+ tmp[1] = 'x';
+ memset(tmp + 2, 48, 65517*2);
+
+ char sql[65517*2+3 + 256] = {0};
+
+ pRes = taos_query(taos, "create stable stb1 (ts timestamp, c2 varbinary(65517)) tags (t1 int, t2 binary(8), t3 varbinary(8))");
+ taos_free_result(pRes);
+
+ sprintf(sql, "insert into tb6 using stb1 tags (6, 'tb6_bin1', '\\\\xg') values (now + 4s, '%s')", tmp);
+ pRes = taos_query(taos, sql);
+ taos_free_result(pRes);
+
+ pRes = taos_query(taos, "select c2 from tb6");
+ while ((row = taos_fetch_row(pRes)) != NULL) {
+ int32_t* length = taos_fetch_lengths(pRes);
+ void* data = NULL;
+ uint32_t size = 0;
+ if(taosAscii2Hex(row[0], length[0], &data, &size) < 0){
+ ASSERT(0);
+ }
+
+ ASSERT(memcmp(data, tmp, size) == 0);
+ taosMemoryFree(data);
+ }
+ taos_free_result(pRes);
+
taos_close(taos);
}