diff --git a/Jenkinsfile2 b/Jenkinsfile2 index 0177c57538ba782b1d8b1105affb0679b662110b..bb7fa70c57fb7957967b59c04ce908a417ad4b56 100644 --- a/Jenkinsfile2 +++ b/Jenkinsfile2 @@ -313,7 +313,8 @@ def pre_test_build_win() { bat ''' cd %WIN_CONNECTOR_ROOT% python.exe -m pip install --upgrade pip - python -m pip install . + python -m pip uninstall taospy -y + python -m pip install taospy==2.7.6 xcopy /e/y/i/f %WIN_INTERNAL_ROOT%\\debug\\build\\lib\\taos.dll C:\\Windows\\System32 ''' return 1 @@ -331,8 +332,6 @@ def run_win_test() { bat ''' echo "windows test ..." cd %WIN_CONNECTOR_ROOT% - python.exe -m pip install --upgrade pip - python -m pip install . xcopy /e/y/i/f %WIN_INTERNAL_ROOT%\\debug\\build\\lib\\taos.dll C:\\Windows\\System32 ls -l C:\\Windows\\System32\\taos.dll time /t diff --git a/cmake/cmake.version b/cmake/cmake.version index d0d455c73dc3bbb5109fc701855d0efaa7c24db7..d38ac40b90c932b41717d6d16dadc176a842a2b2 100644 --- a/cmake/cmake.version +++ b/cmake/cmake.version @@ -2,7 +2,7 @@ IF (DEFINED VERNUMBER) SET(TD_VER_NUMBER ${VERNUMBER}) ELSE () - SET(TD_VER_NUMBER "3.0.2.6") + SET(TD_VER_NUMBER "3.0.3.0") ENDIF () IF (DEFINED VERCOMPATIBLE) diff --git a/cmake/taosadapter_CMakeLists.txt.in b/cmake/taosadapter_CMakeLists.txt.in index 0ff1371618a31ffd73cefc74abb6c5aad407b031..1c401ae80e0a7a1ec11701c39842f5a0eb1052ce 100644 --- a/cmake/taosadapter_CMakeLists.txt.in +++ b/cmake/taosadapter_CMakeLists.txt.in @@ -2,7 +2,7 @@ # taosadapter ExternalProject_Add(taosadapter GIT_REPOSITORY https://github.com/taosdata/taosadapter.git - GIT_TAG 7920f98 + GIT_TAG d8059ff SOURCE_DIR "${TD_SOURCE_DIR}/tools/taosadapter" BINARY_DIR "" #BUILD_IN_SOURCE TRUE diff --git a/cmake/taostools_CMakeLists.txt.in b/cmake/taostools_CMakeLists.txt.in index aecb8a1750220bb0432d2bc8f5b4c503ccd59022..1d06995380b9ed3c6d2ac58428205978b4edd6cd 100644 --- a/cmake/taostools_CMakeLists.txt.in +++ b/cmake/taostools_CMakeLists.txt.in @@ -2,7 +2,7 @@ # taos-tools ExternalProject_Add(taos-tools GIT_REPOSITORY https://github.com/taosdata/taos-tools.git - GIT_TAG 0111c66 + GIT_TAG 41affde SOURCE_DIR "${TD_SOURCE_DIR}/tools/taos-tools" BINARY_DIR "" #BUILD_IN_SOURCE TRUE diff --git a/docs/en/05-get-started/03-package.md b/docs/en/05-get-started/03-package.md index c70c2589c2ce93c92c8114fbf47a830c506280e7..3282f600ac81fd6a4cc45fb8c09e3c036570cc18 100644 --- a/docs/en/05-get-started/03-package.md +++ b/docs/en/05-get-started/03-package.md @@ -188,7 +188,7 @@ You can use the TDengine CLI to monitor your TDengine deployment and execute ad -After the installation is complete, run `C:\TDengine\taosd.exe` to start TDengine Server. +After the installation is complete, please run `sc start taosd` or run `C:\TDengine\taosd.exe` with administrator privilege to start TDengine Server. ## Command Line Interface (CLI) diff --git a/docs/en/07-develop/07-tmq.mdx b/docs/en/07-develop/07-tmq.mdx index 20bc718fc0739cb3bc7067fc88d04948455a15f8..71abe5905559b2df70977b773b22c2d6cbafcbb0 100644 --- a/docs/en/07-develop/07-tmq.mdx +++ b/docs/en/07-develop/07-tmq.mdx @@ -295,7 +295,7 @@ You configure the following parameters when creating a consumer: | `enable.auto.commit` | boolean | Commit automatically | Specify `true` or `false`. | | `auto.commit.interval.ms` | integer | Interval for automatic commits, in milliseconds | | `enable.heartbeat.background` | boolean | Backend heartbeat; if enabled, the consumer does not go offline even if it has not polled for a long time | | -| `experimental.snapshot.enable` | boolean | Specify whether to consume messages from the WAL or from TSBS | | +| `experimental.snapshot.enable` | boolean | Specify whether to consume messages from TSDB | | | `msg.with.table.name` | boolean | Specify whether to deserialize table names from messages | The method of specifying these parameters depends on the language used: @@ -418,7 +418,7 @@ Python programs use the following parameters: | `enable.auto.commit` | string | Commit automatically | pecify `true` or `false` | | `auto.commit.interval.ms` | string | Interval for automatic commits, in milliseconds | | | `auto.offset.reset` | string | Initial offset for the consumer group | Specify `earliest`, `latest`, or `none`(default) | -| `experimental.snapshot.enable` | string | Specify whether to consume messages from the WAL or from TSDB | Specify `true` or `false` | +| `experimental.snapshot.enable` | string | Specify whether it's allowed to consume messages from the WAL or from TSDB | Specify `true` or `false` | | `enable.heartbeat.background` | string | Backend heartbeat; if enabled, the consumer does not go offline even if it has not polled for a long time | Specify `true` or `false` | diff --git a/docs/en/12-taos-sql/02-database.md b/docs/en/12-taos-sql/02-database.md index 5e8c9aaa929032441459a55015fec8d591d32704..a1c46875aa59b7ce6eb099d4c13a20a1a68e560b 100644 --- a/docs/en/12-taos-sql/02-database.md +++ b/docs/en/12-taos-sql/02-database.md @@ -75,10 +75,10 @@ database_option: { - TABLE_PREFIX:The prefix length in the table name that is ignored when distributing table to vnode based on table name. - TABLE_SUFFIX:The suffix length in the table name that is ignored when distributing table to vnode based on table name. - TSDB_PAGESIZE: The page size of the data storage engine in a vnode. The unit is KB. The default is 4 KB. The range is 1 to 16384, that is, 1 KB to 16 MB. -- WAL_RETENTION_PERIOD: specifies the time after which WAL files are deleted. This parameter is used for data subscription. Enter a time in seconds. The default value of single copy is 0. A value of 0 indicates that each WAL file is deleted immediately after its contents are written to disk. -1: WAL files are never deleted. The default value of multiple copy is 4 days. -- WAL_RETENTION_SIZE: specifies the size at which WAL files are deleted. This parameter is used for data subscription. Enter a size in KB. The default value of single copy is 0. A value of 0 indicates that each WAL file is deleted immediately after its contents are written to disk. -1: WAL files are never deleted. The default value of multiple copy is -1. -- WAL_ROLL_PERIOD: specifies the time after which WAL files are rotated. After this period elapses, a new WAL file is created. The default value of single copy is 0. A value of 0 indicates that a new WAL file is created only after the previous WAL file was written to disk. The default values of multiple copy is 1 day. -- WAL_SEGMENT_SIZE: specifies the maximum size of a WAL file. After the current WAL file reaches this size, a new WAL file is created. The default value is 0. A value of 0 indicates that a new WAL file is created only after the previous WAL file was written to disk. +- WAL_RETENTION_PERIOD: specifies the maximum time of which WAL files are to be kept after consumption. This parameter is used for data subscription. Enter a time in seconds. The default value 0. A value of 0 indicates that WAL files are not required to keep after consumption. -1: the time of WAL files to keep has no upper limit. +- WAL_RETENTION_SIZE: specifies the maximum total size of which WAL files are to be kept after consumption. This parameter is used for data subscription. Enter a size in KB. The default value is 0. A value of 0 indicates that WAL files are not required to keep after consumption. -1: the total size of WAL files to keep has no upper limit. +- WAL_ROLL_PERIOD: specifies the time after which WAL files are rotated. After this period elapses, a new WAL file is created. The default value is 0. A value of 0 indicates that a new WAL file is created only after TSDB data in memory are flushed to disk. +- WAL_SEGMENT_SIZE: specifies the maximum size of a WAL file. After the current WAL file reaches this size, a new WAL file is created. The default value is 0. A value of 0 indicates that a new WAL file is created only after TSDB data in memory are flushed to disk. ### Example Statement diff --git a/docs/en/12-taos-sql/07-tag-index.md b/docs/en/12-taos-sql/07-tag-index.md new file mode 100644 index 0000000000000000000000000000000000000000..cb2a61d3e813ad130476f8f3309d30b7e208a009 --- /dev/null +++ b/docs/en/12-taos-sql/07-tag-index.md @@ -0,0 +1,51 @@ +--- +sidebar_label: Tag Index +title: Tag Index +description: Use Tag Index to Improve Query Performance +--- + +## Introduction + +Prior to TDengine 3.0.3.0 (excluded),only one index is created by default on the first tag of each super talbe, but it's not allowed to dynamically create index on any other tags. From version 3.0.30, you can dynamically create index on any tag of any type. The index created automatically by TDengine is still valid. Query performance can benefit from indexes if you use properly. + +## Syntax + +1. The syntax of creating an index + +```sql +CREATE INDEX index_name ON tbl_name (tagColName) +``` + +In the above statement, `index_name` if the name of the index, `tbl_name` is the name of the super table,`tagColName` is the name of the tag on which the index is being created. `tagColName` can be any type supported by TDengine. + +2. The syntax of drop an index + +```sql +DROP INDEX index_name +``` + +In the above statement, `index_name` is the name of an existing index. If the index doesn't exist, the command would fail but doesn't generate any impact to the system. + +3. The syntax of show indexes in the system + +```sql +SELECT * FROM information_schema.INS_INDEXES +``` + +You can also add filter conditions to limit the results. + +## Detailed Specification + +1. Indexes can improve query performance significantly if they are used properly. The operators supported by tag index include `=`, `>`, `>=`, `<`, `<=`. If you use these operators with tags, indexes can improve query performance significantly. However, for operators not in this scope, indexes don't help. More and more operators will be added in future. + +2. Only one index can be created on each tag, error would be reported if you try to create more than one indexes on same tag. + +3. Each time you can create an index on a single tag, you are not allowed to create indexes on multiple tags together. + +4. The name of each index must be unique across the whole system, regardless of the type of the index, e.g. tag index or sma index. + +5. There is no limit on the number of indexes, but each index may add some burden on the metadata subsystem. So too many indexes may decrease the efficiency of reading or writing metadata and then decrease the system performance. So it's better not to add unnecessary indexes. + +6. You can' create index on a normal table or a child table. + +7. If the unique values of a tag column are too few, it's better not to create index on such tag columns, the benefit would be very small. \ No newline at end of file diff --git a/docs/en/12-taos-sql/12-distinguished.md b/docs/en/12-taos-sql/12-distinguished.md index 5afa81daac6a19b7306207ec0e441e6d086e50d5..3f81b51dd3df2722a295f51230f1b1d23bce934f 100644 --- a/docs/en/12-taos-sql/12-distinguished.md +++ b/docs/en/12-taos-sql/12-distinguished.md @@ -32,15 +32,15 @@ The most common usage of PARTITION BY is partitioning the data in subtables by t ## Windowed Queries -Aggregation by time window is supported in TDengine. For example, in the case where temperature sensors report the temperature every seconds, the average temperature for every 10 minutes can be retrieved by performing a query with a time window. Window related clauses are used to divide the data set to be queried into subsets and then aggregation is performed across the subsets. There are three kinds of windows: time window, status window, and session window. There are two kinds of time windows: sliding window and flip time/tumbling window. The query syntax is as follows: +Aggregation by time window is supported in TDengine. For example, in the case where temperature sensors report the temperature every seconds, the average temperature for every 10 minutes can be retrieved by performing a query with a time window. Window related clauses are used to divide the data set to be queried into subsets and then aggregation is performed across the subsets. There are four kinds of windows: time window, status window, session window, and event window. There are two kinds of time windows: sliding window and flip time/tumbling window. The syntax of window clause is as follows: ```sql -SELECT select_list FROM tb_name - [WHERE where_condition] - [SESSION(ts_col, tol_val)] - [STATE_WINDOW(col)] - [INTERVAL(interval [, offset]) [SLIDING sliding]] - [FILL({NONE | VALUE | PREV | NULL | LINEAR | NEXT})] +window_clause: { + SESSION(ts_col, tol_val) + | STATE_WINDOW(col) + | INTERVAL(interval [, offset]) [SLIDING sliding] [FILL({NONE | VALUE | PREV | NULL | LINEAR | NEXT})] + | EVENT_WINDOW START WITH start_trigger_condition END WITH end_trigger_condition +} ``` The following restrictions apply: @@ -75,6 +75,16 @@ These pseudocolumns occur after the aggregation clause. 5. LINEAR:Fill with the closest non-NULL value, `FILL(LINEAR)` 6. NEXT:Fill with the next non-NULL value, `FILL(NEXT)` +In the above filling modes, except for `NONE` mode, the `fill` clause will be ignored if there is no data in the defined time range, i.e. no data would be filled and the query result would be empty. This behavior is reasonable when the filling mode is `PREV`, `NEXT`, `LINEAR`, because filling can't be performed if there is not any data. For filling modes `NULL` and `VALUE`, however, filling can be performed even though there is not any data, filling or not depends on the choice of user's application. To accomplish the need of this force filling behavior and not break the behavior of existing filling modes, TDengine added two new filling modes since version 3.0.3.0. + +1. NULL_F: Fill `NULL` by force +2. VALUE_F: Fill `VALUE` by force + +The detailed beaviors of `NULL`, `NULL_F`, `VALUE`, and VALUE_F are described below: +- When used with `INTERVAL`: `NULL_F` and `VALUE_F` are filling by force;`NULL` and `VALUE` don't fill by force. The behavior of each filling mode is exactly same as what the name suggests. +- When used with `INTERVAL` in stream processing: `NULL_F` and `NULL` are same, i.e. don't fill by force; `VALUE_F` and `VALUE` and same, i.e. don't fill by force. It's suggested that there is no filling by force in stream processing. +- When used with `INTERP`: `NULL` and `NULL_F` and same, i.e. filling by force; `VALUE` and `VALUE_F` are same, i.e. filling by force. It's suggested that there is always filling by force when used with `INTERP`. + :::info 1. A huge volume of interpolation output may be returned using `FILL`, so it's recommended to specify the time range when using `FILL`. The maximum number of interpolation values that can be returned in a single query is 10,000,000. @@ -146,6 +156,26 @@ If the time interval between two continuous rows are within the time interval sp SELECT COUNT(*), FIRST(ts) FROM temp_tb_1 SESSION(ts, tol_val); ``` +### Event Window + +Event window is determined according to the window start condition and the window close condition. The window is started when `start_trigger_condition` is evaluated to true, the window is closed when `end_trigger_condition` is evaluated to true. `start_trigger_condition` and `end_trigger_condition` can be any conditional expressions supported by TDengine and can include multiple columns. + +There may be only one row of data in an event window, when a row meets both the `start_trigger_condition` and the `end_trigger_condition`. + +The window is treated as invalid or non-existing if the `end_trigger_condition` can't be met. There will be no output in case that a window can't be closed. + +If the event window query is performed on a super table, TDengine consolidates all the data of all child tables into a single timeline then perform event window based query. + +If you want to perform event window based query on the result set of a sub-query, the result set of the sub-query should be arranged in the order of timestamp and include the column of timestamp. + +For example, the diagram below illustrates the event windows generated by the query below: + +```sql +select _wstart, _wend, count(*) from t start with c1 > 0 end with c2 < 10 +``` + +![Event Window Illustration](./event_window.webp) + ### Examples A table of intelligent meters can be created by the SQL statement below: diff --git a/docs/en/12-taos-sql/22-meta.md b/docs/en/12-taos-sql/22-meta.md index 47523ba87c2ac57d4b59cbe12f13f3268550f026..81284aeaedf89044a4a253e845d70e7fd67f4168 100644 --- a/docs/en/12-taos-sql/22-meta.md +++ b/docs/en/12-taos-sql/22-meta.md @@ -179,6 +179,20 @@ Provides information about standard tables and subtables. | 5 | tag_type | BINARY(64) | Tag type | | 6 | tag_value | BINARY(16384) | Tag value | +## INS_COLUMNS + +| # | **列名** | **数据类型** | **说明** | +| --- | :---------: | ------------- | ---------------------- | +| 1 | table_name | BINARY(192) | Table name | +| 2 | db_name | BINARY(64) | Database name | +| 3 | table_type | BINARY(21) | Table type | +| 4 | col_name | BINARY(64) | Column name | +| 5 | col_type | BINARY(32) | Column type | +| 6 | col_length | INT | Column length | +| 7 | col_precision | INT | Column precision | +| 8 | col_scale | INT | Column scale | +| 9 | col_nullable | INT | Column nullable | + ## INS_USERS Provides information about TDengine users. diff --git a/docs/en/12-taos-sql/event_window.webp b/docs/en/12-taos-sql/event_window.webp new file mode 100644 index 0000000000000000000000000000000000000000..0a3a344b03194f245aa879b801fa4edb38f85445 Binary files /dev/null and b/docs/en/12-taos-sql/event_window.webp differ 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 c30379297f7d76a1ee65a5f16d789991df87daf4..1691b8be8b53480199898ab4ec6b5917eba7979f 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 @@ -115,14 +115,41 @@ where `TOKEN` is the string after Base64 encoding of `{username}:{password}`, e. ### HTTP Response Code -| **Response Code** | **Description** | -|-------------------|----------------| -| 200 | Success. (Also used for C interface errors.) | -| 400 | Parameter error | -| 401 | Authentication failure | -| 404 | Interface not found | -| 500 | Internal error | -| 503 | Insufficient system resources | +Starting from `TDengine 3.0.3.0`, `taosAdapter` provides a configuration parameter `httpCodeServerError` to set whether to return a non-200 http status code when the C interface returns an error + +| **Description** | **httpCodeServerError false** | **httpCodeServerError true** | +|--------------------|---------------------------- ------|---------------------------------------| +| taos_errno() returns 0 | 200 | 200 | +| taos_errno() returns non-0 | 200 (except authentication error) | 500 (except authentication error and 400/502 error) | +| Parameter error | 400 (only handle HTTP request URL parameter error) | 400 (handle HTTP request URL parameter error and taosd return error) | +| Authentication error | 401 | 401 | +| Interface does not exist | 404 | 404 | +| Cluster unavailable error | 502 | 502 | +| Insufficient system resources | 503 | 503 | + +The C error codes that return http code 400 are: + +- TSDB_CODE_TSC_SQL_SYNTAX_ERROR ( 0x0216 ) +- TSDB_CODE_TSC_LINE_SYNTAX_ERROR (0x021B) +- TSDB_CODE_PAR_SYNTAX_ERROR (0x2600) +- TSDB_CODE_TDB_TIMESTAMP_OUT_OF_RANGE (0x060B) +- TSDB_CODE_TSC_VALUE_OUT_OF_RANGE (0x0224) +- TSDB_CODE_PAR_INVALID_FILL_TIME_RANGE (0x263B) + +The error code that returns http code 401 are: + +- TSDB_CODE_MND_USER_ALREADY_EXIST (0x0350) +- TSDB_CODE_MND_USER_NOT_EXIST (0x0351) +- TSDB_CODE_MND_INVALID_USER_FORMAT (0x0352) +- TSDB_CODE_MND_INVALID_PASS_FORMAT (0x0353) +- TSDB_CODE_MND_NO_USER_FROM_CONN (0x0354) +- TSDB_CODE_MND_TOO_MANY_USERS (0x0355) +- TSDB_CODE_MND_INVALID_ALTER_OPER (0x0356) +- TSDB_CODE_MND_AUTH_FAILURE (0x0357) + +The error code that returns http code 403 are: + +- TSDB_CODE_RPC_SOMENODE_NOT_CONNECTED (0x0020) ### HTTP body structure @@ -270,7 +297,6 @@ Response body: ```json { - "status": "succ", "code": 0, "desc": "/KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04" } diff --git a/docs/en/14-reference/03-connector/03-cpp.mdx b/docs/en/14-reference/03-connector/03-cpp.mdx index 3bd7b7f4c6ad0c2ca3cf5c05fa72d1b27f714653..b543879b3cf8814d21d0a6f940762c67cc2519b0 100644 --- a/docs/en/14-reference/03-connector/03-cpp.mdx +++ b/docs/en/14-reference/03-connector/03-cpp.mdx @@ -176,6 +176,14 @@ The base API is used to do things like create database connections and provide a Set the current default database to `db`. +- `int taos_get_current_db(TAOS *taos, char *database, int len, int *required)` + + - 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 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. + - `void taos_close(TAOS *taos)` Closes the connection, where `taos` is the handle returned by `taos_connect()`. @@ -404,5 +412,17 @@ In addition to writing data using the SQL method or the parameter binding API, w Note that the timestamp resolution parameter only takes effect when the protocol type is `SML_LINE_PROTOCOL`. For OpenTSDB's text protocol, timestamp resolution follows its official resolution rules - time precision is confirmed by the number of characters contained in the timestamp. - **Supported Versions** - This feature interface is supported from version 2.3.0.0. + schemaless 其他相关的接口 +- `TAOS_RES *taos_schemaless_insert_with_reqid(TAOS *taos, char *lines[], int numLines, int protocol, int precision, int64_t reqid)` +- `TAOS_RES *taos_schemaless_insert_raw(TAOS *taos, char *lines, int len, int32_t *totalRows, int protocol, int precision)` +- `TAOS_RES *taos_schemaless_insert_raw_with_reqid(TAOS *taos, char *lines, int len, int32_t *totalRows, int protocol, int precision, int64_t reqid)` +- `TAOS_RES *taos_schemaless_insert_ttl(TAOS *taos, char *lines[], int numLines, int protocol, int precision, int32_t ttl)` +- `TAOS_RES *taos_schemaless_insert_ttl_with_reqid(TAOS *taos, char *lines[], int numLines, int protocol, int precision, int32_t ttl, int64_t reqid)` +- `TAOS_RES *taos_schemaless_insert_raw_ttl(TAOS *taos, char *lines, int len, int32_t *totalRows, int protocol, int precision, int32_t ttl)` +- `TAOS_RES *taos_schemaless_insert_raw_ttl_with_reqid(TAOS *taos, char *lines, int len, int32_t *totalRows, int protocol, int precision, int32_t ttl, int64_t reqid)` + + **Description** + - The above seven interfaces are extension interfaces, which are mainly used to pass ttl and reqid parameters, and can be used as needed. + - Withing _raw interfaces represent data through the passed parameters lines and len. In order to solve the problem that the original interface data contains '\0' and is truncated. The totalRows pointer returns the number of parsed data rows. + - Withing _ttl interfaces can pass the ttl parameter to control the ttl expiration time of the table. + - Withing _reqid interfaces can track the entire call chain by passing the reqid parameter. diff --git a/docs/en/14-reference/03-connector/07-python.mdx b/docs/en/14-reference/03-connector/07-python.mdx index 34435a7c0d8715556fd321b7fb43aef7b211a773..c885d416c8303ecb95a55b42125de31aa5dcd65a 100644 --- a/docs/en/14-reference/03-connector/07-python.mdx +++ b/docs/en/14-reference/03-connector/07-python.mdx @@ -32,7 +32,7 @@ We recommend using the latest version of `taospy`, regardless of the version of ### Preparation -1. Install Python. The recent taospy package requires Python 3.6+. The earlier versions of taospy require Python 3.7+. The taos-ws-py package requires Python 3.7+. If Python is not available on your system, refer to the [Python BeginnersGuide](https://wiki.python.org/moin/BeginnersGuide/Download) to install it. +1. Install Python. The recent taospy package requires Python 3.6.2+. The earlier versions of taospy require Python 3.7+. The taos-ws-py package requires Python 3.7+. If Python is not available on your system, refer to the [Python BeginnersGuide](https://wiki.python.org/moin/BeginnersGuide/Download) to install it. 2. Install [pip](https://pypi.org/project/pip/). In most cases, the Python installer comes with the pip utility. If not, please refer to [pip documentation](https://pip.pypa.io/en/stable/installation/) to install it. If you use a native connection, you will also need to [Install Client Driver](/reference/connector#Install-Client-Driver). The client install package includes the TDengine client dynamic link library (`libtaos.so` or `taos.dll`) and the TDengine CLI. diff --git a/docs/en/14-reference/03-connector/index.mdx b/docs/en/14-reference/03-connector/index.mdx index 2df73b8592c496ca1e3e715c86a9fbb83420f425..a35d5bc2d1ed4a69f9750a1153d15efe815f674d 100644 --- a/docs/en/14-reference/03-connector/index.mdx +++ b/docs/en/14-reference/03-connector/index.mdx @@ -61,7 +61,7 @@ The different database framework specifications for various programming language | **Connection Management** | Support | Support | Support | Support | Support | Support | | **Regular Query** | Support | Support | Support | Support | Support | Support | | **Parameter Binding** | Not Supported | Not Supported | Support | Support | Not Supported | Support | -| **Subscription (TMQ) ** | Not Supported | Support | Support | Not Supported | Not Supported | Support | +| **Subscription (TMQ) ** | Supported | Support | Support | Not Supported | Not Supported | Support | | **Schemaless** | Not Supported | Not Supported | Not Supported | Not Supported | Not Supported | Not Supported | | **Bulk Pulling (based on WebSocket) ** | Support | Support | Support | Support | Support | Support | | **DataFrame** | Not Supported | Support | Not Supported | Not Supported | Not Supported | Not Supported | diff --git a/docs/en/14-reference/04-taosadapter.md b/docs/en/14-reference/04-taosadapter.md index c1ec97b647c228b7302391f768033792e236c79b..7ab894a1c72651e3568f3effa351b044c397b2dd 100644 --- a/docs/en/14-reference/04-taosadapter.md +++ b/docs/en/14-reference/04-taosadapter.md @@ -58,9 +58,9 @@ Usage of taosAdapter: --collectd.enable enable collectd. Env "TAOS_ADAPTER_COLLECTD_ENABLE" (default true) --collectd.password string collectd password. Env "TAOS_ADAPTER_COLLECTD_PASSWORD" (default "taosdata") --collectd.port int collectd server port. Env "TAOS_ADAPTER_COLLECTD_PORT" (default 6045) + --collectd.ttl int collectd data ttl. Env "TAOS_ADAPTER_COLLECTD_TTL" --collectd.user string collectd user. Env "TAOS_ADAPTER_COLLECTD_USER" (default "root") --collectd.worker int collectd write worker. Env "TAOS_ADAPTER_COLLECTD_WORKER" (default 10) - --collectd.ttl int collectd data ttl. Env "TAOS_ADAPTER_COLLECTD_TTL" (default 0, means no ttl) -c, --config string config path default /etc/taos/taosadapter.toml --cors.allowAllOrigins cors allow all origins. Env "TAOS_ADAPTER_CORS_ALLOW_ALL_ORIGINS" (default true) --cors.allowCredentials cors allow credentials. Env "TAOS_ADAPTER_CORS_ALLOW_Credentials" @@ -68,8 +68,9 @@ Usage of taosAdapter: --cors.allowOrigins stringArray cors allow origins. Env "TAOS_ADAPTER_ALLOW_ORIGINS" --cors.allowWebSockets cors allow WebSockets. Env "TAOS_ADAPTER_CORS_ALLOW_WebSockets" --cors.exposeHeaders stringArray cors expose headers. Env "TAOS_ADAPTER_Expose_Headers" - --debug enable debug mode. Env "TAOS_ADAPTER_DEBUG" + --debug enable debug mode. Env "TAOS_ADAPTER_DEBUG" (default true) --help Print this help message and exit + --httpCodeServerError Use a non-200 http status code when taosd returns an error. Env "TAOS_ADAPTER_HTTP_CODE_SERVER_ERROR" --influxdb.enable enable influxdb. Env "TAOS_ADAPTER_INFLUXDB_ENABLE" (default true) --log.enableRecordHttpSql whether to record http sql. Env "TAOS_ADAPTER_LOG_ENABLE_RECORD_HTTP_SQL" --log.path string log path. Env "TAOS_ADAPTER_LOG_PATH" (default "/var/log/taos") @@ -80,14 +81,17 @@ Usage of taosAdapter: --log.sqlRotationSize string record sql log rotation size(KB MB GB), must be a positive integer. Env "TAOS_ADAPTER_LOG_SQL_ROTATION_SIZE" (default "1GB") --log.sqlRotationTime duration record sql log rotation time. Env "TAOS_ADAPTER_LOG_SQL_ROTATION_TIME" (default 24h0m0s) --logLevel string log level (panic fatal error warn warning info debug trace). Env "TAOS_ADAPTER_LOG_LEVEL" (default "info") - --monitor.collectDuration duration Set monitor duration. Env "TAOS_MONITOR_COLLECT_DURATION" (default 3s) - --monitor.identity string The identity of the current instance, or 'hostname:port' if it is empty. Env "TAOS_MONITOR_IDENTITY" - --monitor.incgroup Whether running in cgroup. Env "TAOS_MONITOR_INCGROUP" - --monitor.password string TDengine password. Env "TAOS_MONITOR_PASSWORD" (default "taosdata") --monitor.pauseAllMemoryThreshold float Memory percentage threshold for pause all. Env "TAOS_MONITOR_PAUSE_ALL_MEMORY_THRESHOLD" (default 80) - --monitor.pauseQueryMemoryThreshold float Memory percentage threshold for pause query. Env "TAOS_MONITOR_PAUSE_QUERY_MEMORY_THRESHOLD" (default 70) - --monitor.user string TDengine user. Env "TAOS_MONITOR_USER" (default "root") - --monitor.writeInterval duration Set write to TDengine interval. Env "TAOS_MONITOR_WRITE_INTERVAL" (default 30s) - --monitor.writeToTD Whether write metrics to TDengine. Env "TAOS_MONITOR_WRITE_TO_TD" + --monitor.collectDuration duration Set monitor duration. Env "TAOS_ADAPTER_MONITOR_COLLECT_DURATION" (default 3s) + --monitor.disable Whether to disable monitoring. Env "TAOS_ADAPTER_MONITOR_DISABLE" + --monitor.disableCollectClientIP Whether to disable collecting clientIP. Env "TAOS_ADAPTER_MONITOR_DISABLE_COLLECT_CLIENT_IP" + --monitor.identity string The identity of the current instance, or 'hostname:port' if it is empty. Env "TAOS_ADAPTER_MONITOR_IDENTITY" + --monitor.incgroup Whether running in cgroup. Env "TAOS_ADAPTER_MONITOR_INCGROUP" + --monitor.password string TDengine password. Env "TAOS_ADAPTER_MONITOR_PASSWORD" (default "taosdata") + --monitor.pauseAllMemoryThreshold float Memory percentage threshold for pause all. Env "TAOS_ADAPTER_MONITOR_PAUSE_ALL_MEMORY_THRESHOLD" (default 80) + --monitor.pauseQueryMemoryThreshold float Memory percentage threshold for pause query. Env "TAOS_ADAPTER_MONITOR_PAUSE_QUERY_MEMORY_THRESHOLD" (default 70) + --monitor.user string TDengine user. Env "TAOS_ADAPTER_MONITOR_USER" (default "root") + --monitor.writeInterval duration Set write to TDengine interval. Env "TAOS_ADAPTER_MONITOR_WRITE_INTERVAL" (default 30s) + --monitor.writeToTD Whether write metrics to TDengine. Env "TAOS_ADAPTER_MONITOR_WRITE_TO_TD" --node_exporter.caCertFile string node_exporter ca cert file path. Env "TAOS_ADAPTER_NODE_EXPORTER_CA_CERT_FILE" --node_exporter.certFile string node_exporter cert file path. Env "TAOS_ADAPTER_NODE_EXPORTER_CERT_FILE" --node_exporter.db string node_exporter db name. Env "TAOS_ADAPTER_NODE_EXPORTER_DB" (default "node_exporter") @@ -100,9 +104,9 @@ Usage of taosAdapter: --node_exporter.keyFile string node_exporter cert key file path. Env "TAOS_ADAPTER_NODE_EXPORTER_KEY_FILE" --node_exporter.password string node_exporter password. Env "TAOS_ADAPTER_NODE_EXPORTER_PASSWORD" (default "taosdata") --node_exporter.responseTimeout duration node_exporter response timeout. Env "TAOS_ADAPTER_NODE_EXPORTER_RESPONSE_TIMEOUT" (default 5s) + --node_exporter.ttl int node_exporter data ttl. Env "TAOS_ADAPTER_NODE_EXPORTER_TTL" --node_exporter.urls strings node_exporter urls. Env "TAOS_ADAPTER_NODE_EXPORTER_URLS" (default [http://localhost:9100]) --node_exporter.user string node_exporter user. Env "TAOS_ADAPTER_NODE_EXPORTER_USER" (default "root") - --node_exporter.ttl int node_exporter data ttl. Env "TAOS_ADAPTER_NODE_EXPORTER_TTL"(default 0, means no ttl) --opentsdb.enable enable opentsdb. Env "TAOS_ADAPTER_OPENTSDB_ENABLE" (default true) --opentsdb_telnet.batchSize int opentsdb_telnet batch size. Env "TAOS_ADAPTER_OPENTSDB_TELNET_BATCH_SIZE" (default 1) --opentsdb_telnet.dbs strings opentsdb_telnet db names. Env "TAOS_ADAPTER_OPENTSDB_TELNET_DBS" (default [opentsdb_telnet,collectd_tsdb,icinga2_tsdb,tcollector_tsdb]) @@ -112,11 +116,11 @@ Usage of taosAdapter: --opentsdb_telnet.password string opentsdb_telnet password. Env "TAOS_ADAPTER_OPENTSDB_TELNET_PASSWORD" (default "taosdata") --opentsdb_telnet.ports ints opentsdb telnet tcp port. Env "TAOS_ADAPTER_OPENTSDB_TELNET_PORTS" (default [6046,6047,6048,6049]) --opentsdb_telnet.tcpKeepAlive enable tcp keep alive. Env "TAOS_ADAPTER_OPENTSDB_TELNET_TCP_KEEP_ALIVE" + --opentsdb_telnet.ttl int opentsdb_telnet data ttl. Env "TAOS_ADAPTER_OPENTSDB_TELNET_TTL" --opentsdb_telnet.user string opentsdb_telnet user. Env "TAOS_ADAPTER_OPENTSDB_TELNET_USER" (default "root") - --opentsdb_telnet.ttl int opentsdb_telnet data ttl. Env "TAOS_ADAPTER_OPENTSDB_TELNET_TTL"(default 0, means no ttl) - --pool.idleTimeout duration Set idle connection timeout. Env "TAOS_ADAPTER_POOL_IDLE_TIMEOUT" (default 1h0m0s) - --pool.maxConnect int max connections to taosd. Env "TAOS_ADAPTER_POOL_MAX_CONNECT" (default 4000) - --pool.maxIdle int max idle connections to taosd. Env "TAOS_ADAPTER_POOL_MAX_IDLE" (default 4000) + --pool.idleTimeout duration Set idle connection timeout. Env "TAOS_ADAPTER_POOL_IDLE_TIMEOUT" + --pool.maxConnect int max connections to taosd. Env "TAOS_ADAPTER_POOL_MAX_CONNECT" + --pool.maxIdle int max idle connections to taosd. Env "TAOS_ADAPTER_POOL_MAX_IDLE" -P, --port int http port. Env "TAOS_ADAPTER_PORT" (default 6041) --prometheus.enable enable prometheus. Env "TAOS_ADAPTER_PROMETHEUS_ENABLE" (default true) --restfulRowLimit int restful returns the maximum number of rows (-1 means no limit). Env "TAOS_ADAPTER_RESTFUL_ROW_LIMIT" (default -1) @@ -133,9 +137,9 @@ Usage of taosAdapter: --statsd.port int statsd server port. Env "TAOS_ADAPTER_STATSD_PORT" (default 6044) --statsd.protocol string statsd protocol [tcp or udp]. Env "TAOS_ADAPTER_STATSD_PROTOCOL" (default "udp") --statsd.tcpKeepAlive enable tcp keep alive. Env "TAOS_ADAPTER_STATSD_TCP_KEEP_ALIVE" + --statsd.ttl int statsd data ttl. Env "TAOS_ADAPTER_STATSD_TTL" --statsd.user string statsd user. Env "TAOS_ADAPTER_STATSD_USER" (default "root") --statsd.worker int statsd write worker. Env "TAOS_ADAPTER_STATSD_WORKER" (default 10) - --statsd.ttl int statsd data ttl. Env "TAOS_ADAPTER_STATSD_TTL" (default 0, means no ttl) --taosConfigDir string load taos client config path. Env "TAOS_ADAPTER_TAOS_CONFIG_FILE" --version Print the version and exit ``` @@ -324,6 +328,10 @@ This parameter controls the number of results returned by the following interfac - `http://:6041/rest/sql` - `http://:6041/prometheus/v1/remote_read/:db` +## Configure http return code + +taosAdapter uses the parameter `httpCodeServerError` to set whether to return a non-200 http status code http status code other than when the C interface returns an error. When set to true, different http status codes will be returned according to the error code returned by C. For details, see [RESTful API](https://docs.tdengine.com/reference/rest-api/) HTTP Response Code chapter. + ## Troubleshooting You can check the taosAdapter running status with the `systemctl status taosadapter` command. diff --git a/docs/en/14-reference/05-taosbenchmark.md b/docs/en/14-reference/05-taosbenchmark.md index 3dd8339ad4e75782ddfd447a6614998d8db01a34..f49424d3ba817be1d338ab78fb5738f859a5a235 100644 --- a/docs/en/14-reference/05-taosbenchmark.md +++ b/docs/en/14-reference/05-taosbenchmark.md @@ -210,6 +210,9 @@ taosBenchmark -A INT,DOUBLE,NCHAR,BINARY\(16\) - **-z/--trying-interval ** : 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 ** : + Specify vgroups number for creating a database, only valid with daemon version 3.0+ + - **-V/--version** : Show version information only. Users should not use it with other parameters. @@ -241,6 +244,14 @@ The parameters listed in this section apply to all function modes. - ** trying_interval ** : Specify interval between keep trying insert. Valid value is a positive number. Only valid when keep trying be enabled. Available with v3.0.9+. +- ** childtable_from and childtable_to ** : specify the child table range to create. The range is [childtable_from, childtable_to). +  +- ** continue_if_fail ** : allow the user to specify the reaction if the insertion failed. + + - "continue_if_fail" : "no" // means taosBenchmark will exit if it fails to insert as default reaction behavior. + - "continue_if_fail" : "yes" // means taosBenchmark will warn the user if it fails to insert but continue to insert the next record. + - "continue_if_fail": "smart" // means taosBenchmark will try to create the non-existent child table if it fails to insert. + #### Database related configuration parameters The parameters related to database creation are configured in `dbinfo` in the json configuration file, as follows. The other parameters correspond to the database parameters specified when `create database` in [../../taos-sql/database]. @@ -392,11 +403,11 @@ See [General Configuration Parameters](#General Configuration Parameters) for de #### Configuration parameters for executing the specified query statement -The configuration parameters for querying the sub-tables or the normal tables are set in `specified_table_query`. +The configuration parameters for querying the specified table (it can be a super table, a sub-table or a normal table) are set in `specified_table_query`. - **query_interval** : The query interval in seconds, the default value is 0. -- **threads**: The number of threads to execute the query SQL, the default value is 1. +- **threads/concurrent**: The number of threads to execute the query SQL, the default value is 1. - **sqls**. - **sql**: the SQL command to be executed. @@ -423,9 +434,9 @@ The configuration parameters of the super table query are set in `super_table_qu #### Configuration parameters for executing the specified subscription statement -The configuration parameters for subscribing to a sub-table or a generic table are set in `specified_table_query`. +The configuration parameters for subscribing to a specified table (it can be a super table, a sub-table or a generic table) are set in `specified_table_query`. -- **threads**: The number of threads to execute SQL, default is 1. +- **threads/concurrent**: The number of threads to execute SQL, default is 1. - **interval**: The time interval to execute the subscription, in seconds, default is 0. diff --git a/docs/en/14-reference/08-taos-shell.md b/docs/en/14-reference/08-taos-shell.md index 7833ac861fea5fb2dfd66ccc9ec2db8f0ddeff3f..e66da7ec1768227d5ec50ce039bd8f794cf90c48 100644 --- a/docs/en/14-reference/08-taos-shell.md +++ b/docs/en/14-reference/08-taos-shell.md @@ -61,12 +61,14 @@ And many more parameters. - -c CONFIGDIR: Specify the directory where configuration file exists. The default is `/etc/taos`, and the default name of the configuration file in this directory is `taos.cfg` - -C: Print the configuration parameters of `taos.cfg` in the default directory or specified by -c - -d DATABASE: Specify the database to use when connecting to the server +- -E dsn: connect to the TDengine Cloud or a server which provides WebSocket connection - -f FILE: Execute the SQL script file in non-interactive mode Note that each SQL statement in the script file must be only one line. - -k: Test the operational status of the server. 0: unavailable; 1: network ok; 2: service ok; 3: service degraded; 4: exiting - -l PKTLEN: Test package size to be used for network testing - -n NETROLE: test scope for network connection test, default is `client`. The value can be `client` or `server`. - -N PKTNUM: Number of packets used for network testing - -r: output the timestamp format as unsigned 64-bits integer (uint64_t in C language) +- -R: Use RESTful mode when connecting - -s COMMAND: execute SQL commands in non-interactive mode - -t: Test the boot status of the server. The statuses of -k apply. - -w DISPLAYWIDTH: Specify the number of columns of the server display. diff --git a/docs/en/14-reference/12-config/index.md b/docs/en/14-reference/12-config/index.md index f20018d5e02f445eff3c6012afe2386af63eff3b..a76074f5078f1273cea06d1404230b8ad389455e 100644 --- a/docs/en/14-reference/12-config/index.md +++ b/docs/en/14-reference/12-config/index.md @@ -599,7 +599,7 @@ The charset that takes effect is UTF-8. | Applicable | Client only | | Meaning | Whether schemaless columns are consistently ordered, depat, discarded since 3.0.3.0| | Value Range | 0: not consistent; 1: consistent. | -| Default | 1 | +| Default | 0 | ## Compress Parameters diff --git a/docs/en/14-reference/13-schemaless/13-schemaless.md b/docs/en/14-reference/13-schemaless/13-schemaless.md index 1099ceabfedeb897ca1eb5006f6986b3500199d1..3f75364081d7ec242d96a30f3adf0861637a06eb 100644 --- a/docs/en/14-reference/13-schemaless/13-schemaless.md +++ b/docs/en/14-reference/13-schemaless/13-schemaless.md @@ -84,7 +84,7 @@ You can configure smlChildTableName in taos.cfg to specify table names, for exam :::tip All processing logic of schemaless will still follow TDengine's underlying restrictions on data structures, such as the total length of each row of data cannot exceed -16KB. See [TDengine SQL Boundary Limits](/taos-sql/limit) for specific constraints in this area. +48KB, and the total length of tag value cannot exceed 16KB. See [TDengine SQL Boundary Limits](/taos-sql/limit) for specific constraints in this area. ::: diff --git a/docs/en/20-third-party/11-kafka.md b/docs/en/20-third-party/11-kafka.md index 0998862b2d75b98fb65ff414d000535b0c8b7ea5..9e322d2a5b0234a24c880a5656a25d35933af845 100644 --- a/docs/en/20-third-party/11-kafka.md +++ b/docs/en/20-third-party/11-kafka.md @@ -77,7 +77,7 @@ Development: false ### Install from source code ``` -git clone https://github.com/taosdata/kafka-connect-tdengine.git +git clone --branch 3.0 https://github.com/taosdata/kafka-connect-tdengine.git cd kafka-connect-tdengine mvn clean package unzip -d $CONFLUENT_HOME/share/java/ target/components/packages/taosdata-kafka-connect-tdengine-*.zip diff --git a/docs/en/28-releases/01-tdengine.md b/docs/en/28-releases/01-tdengine.md index 6a6210806274d5b6e2e8efe12d281e908d2d0c96..088c4ba2dcd5f2e6cd4fce789d9d24db8ab006e8 100644 --- a/docs/en/28-releases/01-tdengine.md +++ b/docs/en/28-releases/01-tdengine.md @@ -10,6 +10,10 @@ For TDengine 2.x installation packages by version, please visit [here](https://w import Release from "/components/ReleaseV3"; +## 3.0.3.0 + + + ## 3.0.2.6 diff --git a/docs/en/28-releases/02-tools.md b/docs/en/28-releases/02-tools.md index 91eb0c9b8d1ee5ed3b0e774c3d2d78e3bd4c03ba..7d45110bb06fcc504f6393b6d6132d5541f98b2c 100644 --- a/docs/en/28-releases/02-tools.md +++ b/docs/en/28-releases/02-tools.md @@ -10,6 +10,14 @@ For other historical version installers, please visit [here](https://www.taosdat import Release from "/components/ReleaseV3"; +## 2.4.9 + + + +## 2.4.8 + + + ## 2.4.6 diff --git a/docs/examples/java/src/main/java/com/taos/example/highvolume/DataBaseMonitor.java b/docs/examples/java/src/main/java/com/taos/example/highvolume/DataBaseMonitor.java index 04b149a4b96441ecfd1b0bdde54c9ed71349cab2..8678f65231153b1e05fb0141cd63272ee6941f9a 100644 --- a/docs/examples/java/src/main/java/com/taos/example/highvolume/DataBaseMonitor.java +++ b/docs/examples/java/src/main/java/com/taos/example/highvolume/DataBaseMonitor.java @@ -36,28 +36,17 @@ public class DataBaseMonitor { stmt.execute("CREATE STABLE test.meters (ts TIMESTAMP, current FLOAT, voltage INT, phase FLOAT) TAGS (location BINARY(64), groupId INT)"); } - public Long count() throws SQLException { - if (!stmt.isClosed()) { - ResultSet result = stmt.executeQuery("SELECT count(*) from test.meters"); + public long count() throws SQLException { + try (ResultSet result = stmt.executeQuery("SELECT count(*) from test.meters")) { result.next(); return result.getLong(1); } - return null; } - /** - * show test.stables; - * - * name | created_time | columns | tags | tables | - * ============================================================================================ - * meters | 2022-07-20 08:39:30.902 | 4 | 2 | 620000 | - */ - public Long getTableCount() throws SQLException { - if (!stmt.isClosed()) { - ResultSet result = stmt.executeQuery("show test.stables"); + public long getTableCount() throws SQLException { + try (ResultSet result = stmt.executeQuery("select count(*) from information_schema.ins_tables where db_name = 'test';")) { result.next(); - return result.getLong(5); + return result.getLong(1); } - return null; } } \ No newline at end of file diff --git a/docs/examples/java/src/main/java/com/taos/example/highvolume/SQLWriter.java b/docs/examples/java/src/main/java/com/taos/example/highvolume/SQLWriter.java index c2989acdbe3d0f56d7451ac86051a55955ce14de..dc820f161c8ae3a49f692b97ba6eaebbda304f90 100644 --- a/docs/examples/java/src/main/java/com/taos/example/highvolume/SQLWriter.java +++ b/docs/examples/java/src/main/java/com/taos/example/highvolume/SQLWriter.java @@ -42,7 +42,7 @@ public class SQLWriter { /** * Maximum SQL length. */ - private int maxSQLLength; + private int maxSQLLength = 800_000; /** * Map from table name to column values. For example: @@ -81,14 +81,6 @@ public class SQLWriter { conn = getConnection(); stmt = conn.createStatement(); stmt.execute("use test"); - ResultSet rs = stmt.executeQuery("show variables"); - while (rs.next()) { - String configName = rs.getString(1); - if ("maxSQLLength".equals(configName)) { - maxSQLLength = Integer.parseInt(rs.getString(2)); - logger.info("maxSQLLength={}", maxSQLLength); - } - } } /** @@ -149,7 +141,7 @@ public class SQLWriter { } catch (SQLException e) { // convert to error code defined in taoserror.h int errorCode = e.getErrorCode() & 0xffff; - if (errorCode == 0x362 || errorCode == 0x218) { + if (errorCode == 0x2603) { // Table does not exist createTables(); executeSQL(sql); diff --git a/docs/zh/05-get-started/03-package.md b/docs/zh/05-get-started/03-package.md index 1fab5185296d9d2e4addc5cd6cb51bdff969919b..af5f1acae6e9958eddc814b9c8307c6a16d255ad 100644 --- a/docs/zh/05-get-started/03-package.md +++ b/docs/zh/05-get-started/03-package.md @@ -186,7 +186,7 @@ Active: inactive (dead) -安装后,在 `C:\TDengine` 目录下,运行 `taosd.exe` 来启动 TDengine 服务进程。 +安装后,可以在拥有管理员权限的 cmd 窗口执行 `sc start taosd` 或在 `C:\TDengine` 目录下,运行 `taosd.exe` 来启动 TDengine 服务进程。 ## TDengine 命令行(CLI) diff --git a/docs/zh/05-get-started/index.md b/docs/zh/05-get-started/index.md index e144c563b97304f6257d3a1989d7caf85d3789aa..62eeb2f1c222ecc85bf6866ff5147ed881dcf005 100644 --- a/docs/zh/05-get-started/index.md +++ b/docs/zh/05-get-started/index.md @@ -19,17 +19,6 @@ import {useCurrentSidebarCategory} from '@docusaurus/theme-common'; ``` -## 学习 TDengine 知识地图 - -TDengine 知识地图中涵盖了 TDengine 的各种知识点,揭示了各概念实体之间的调用关系和数据流向。学习和了解 TDengine 知识地图有助于你快速掌握 TDengine 的知识体系。 - -
-
- -
图 1. TDengine 知识地图
-
-
- ## 加入 TDengine 官方社区 微信扫描以下二维码,学习了解 TDengine 的最新技术,与大家共同交流物联网大数据技术应用、TDengine 使用问题和技巧等话题。 @@ -41,7 +30,7 @@ TDengine 知识地图中涵盖了 TDengine 的各种知识点,揭示了各概 TDengine 微信公众号 -加入“物联网大数据技术群”
与大家进行技术交流 +加入 TDengine 微信群
了解学习最新物联网技术 关注 TDengine 视频号
收看技术直播与教学视频 关注 TDengine 公众号
阅读技术文章与行业案例 diff --git a/docs/zh/08-connector/02-rest-api.mdx b/docs/zh/08-connector/02-rest-api.mdx index f995b9d569a9627294bf17c5bef2a0b0453ba952..a081595bca5f66bff3c60808126516633f92614b 100644 --- a/docs/zh/08-connector/02-rest-api.mdx +++ b/docs/zh/08-connector/02-rest-api.mdx @@ -116,14 +116,41 @@ curl -L -u username:password -d "" :/rest/sql/[db_name][?tz=timez ### HTTP 响应码 -| **response code** | **说明** | -|-------------------|----------------| -| 200 | 正确返回和 C 接口错误返回 | -| 400 | 参数错误返回 | -| 401 | 鉴权失败 | -| 404 | 接口不存在 | -| 500 | 内部错误 | -| 503 | 系统资源不足 | +从 `TDengine 3.0.3.0` 开始 `taosAdapter` 提供配置参数 `httpCodeServerError` 用来设置当 C 接口返回错误时是否返回非 200 的http状态码 + +| **说明** | **httpCodeServerError false** | **httpCodeServerError true** | +|--------------------|-------------------------------|---------------------------------------| +| taos_errno() 返回 0 | 200 | 200 | +| taos_errno() 返回 非0 | 200(除鉴权错误) | 500 (除鉴权错误和 400/502 错误) | +| 参数错误 | 400 (仅处理 HTTP 请求 URL 参数错误) | 400 (处理 HTTP 请求 URL 参数错误和 taosd 返回错误) | +| 鉴权错误 | 401 | 401 | +| 接口不存在 | 404 | 404 | +| 集群不可用错误 | 502 | 502 | +| 系统资源不足 | 503 | 503 | + +返回 400 的 C 错误码为: + +- TSDB_CODE_TSC_SQL_SYNTAX_ERROR ( 0x0216) +- TSDB_CODE_TSC_LINE_SYNTAX_ERROR (0x021B) +- TSDB_CODE_PAR_SYNTAX_ERROR (0x2600) +- TSDB_CODE_TDB_TIMESTAMP_OUT_OF_RANGE (0x060B) +- TSDB_CODE_TSC_VALUE_OUT_OF_RANGE (0x0224) +- TSDB_CODE_PAR_INVALID_FILL_TIME_RANGE (0x263B) + +返回 401 的错误码为: + +- TSDB_CODE_MND_USER_ALREADY_EXIST (0x0350) +- TSDB_CODE_MND_USER_NOT_EXIST ( 0x0351) +- TSDB_CODE_MND_INVALID_USER_FORMAT (0x0352) +- TSDB_CODE_MND_INVALID_PASS_FORMAT (0x0353) +- TSDB_CODE_MND_NO_USER_FROM_CONN (0x0354) +- TSDB_CODE_MND_TOO_MANY_USERS (0x0355) +- TSDB_CODE_MND_INVALID_ALTER_OPER (0x0356) +- TSDB_CODE_MND_AUTH_FAILURE (0x0357) + +返回 403 的错误码为: + +- TSDB_CODE_RPC_SOMENODE_NOT_CONNECTED (0x0020) ### HTTP body 结构 @@ -271,7 +298,6 @@ curl http://192.168.0.1:6041/rest/login/root/taosdata ```json { - "status": "succ", "code": 0, "desc": "/KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04" } diff --git a/docs/zh/08-connector/10-cpp.mdx b/docs/zh/08-connector/10-cpp.mdx index 3ea4b10a96972e13a2a5e7c895a95d045be6ae7d..9c5095f09cce0a833757da377e8c19be7a7e310d 100644 --- a/docs/zh/08-connector/10-cpp.mdx +++ b/docs/zh/08-connector/10-cpp.mdx @@ -263,6 +263,14 @@ int taos_print_row(char *str, TAOS_ROW row, TAOS_FIELD *fields, int num_fields) - `int taos_select_db(TAOS *taos, const char *db)` 将当前的缺省数据库设置为 `db`。 + +- `int taos_get_current_db(TAOS *taos, char *database, int len, int *required)` + + - database,len为用户在外面申请的空间,内部会把当前db赋值到database里。 + - 只要是没有正常把db名赋值到database中(包括截断),返回错误,返回值为-1,然后用户可以通过 taos_errstr(NULL) 来获取错误提示。 + - 如果,database == NULL 或者 len<=0 返回错误,required里保存存储db需要的空间(包含最后的'\0') + - 如果,len 小于 存储db需要的空间(包含最后的'\0'),返回错误,database里赋值截断的数据,以'\0'结尾。 + - 如果,len 大于等于 存储db需要的空间(包含最后的'\0'),返回正常0,database里赋值以'\0‘结尾的db名。 - `void taos_close(TAOS *taos)` @@ -493,5 +501,17 @@ TDengine 的异步 API 均采用非阻塞调用模式。应用程序可以用多 需要注意的是,时间戳分辨率参数只在协议类型为 `SML_LINE_PROTOCOL` 的时候生效。 对于 OpenTSDB 的文本协议,时间戳的解析遵循其官方解析规则 — 按照时间戳包含的字符的数量来确认时间精度。 - **支持版本** - 该功能接口从 2.3.0.0 版本开始支持。 + **schemaless 其他相关的接口** +- `TAOS_RES *taos_schemaless_insert_with_reqid(TAOS *taos, char *lines[], int numLines, int protocol, int precision, int64_t reqid)` +- `TAOS_RES *taos_schemaless_insert_raw(TAOS *taos, char *lines, int len, int32_t *totalRows, int protocol, int precision)` +- `TAOS_RES *taos_schemaless_insert_raw_with_reqid(TAOS *taos, char *lines, int len, int32_t *totalRows, int protocol, int precision, int64_t reqid)` +- `TAOS_RES *taos_schemaless_insert_ttl(TAOS *taos, char *lines[], int numLines, int protocol, int precision, int32_t ttl)` +- `TAOS_RES *taos_schemaless_insert_ttl_with_reqid(TAOS *taos, char *lines[], int numLines, int protocol, int precision, int32_t ttl, int64_t reqid)` +- `TAOS_RES *taos_schemaless_insert_raw_ttl(TAOS *taos, char *lines, int len, int32_t *totalRows, int protocol, int precision, int32_t ttl)` +- `TAOS_RES *taos_schemaless_insert_raw_ttl_with_reqid(TAOS *taos, char *lines, int len, int32_t *totalRows, int protocol, int precision, int32_t ttl, int64_t reqid)` + + **说明** + - 上面这7个接口是扩展接口,主要用于在schemaless写入时传递ttl、reqid参数,可以根据需要使用。 + - 带_raw的接口通过传递的参数lines指针和长度len来表示数据,为了解决原始接口数据包含'\0'而被截断的问题。totalRows指针返回解析出来的数据行数。 + - 带_ttl的接口可以传递ttl参数来控制建表的ttl到期时间。 + - 带_reqid的接口可以通过传递reqid参数来追踪整个的调用链。 diff --git a/docs/zh/08-connector/30-python.mdx b/docs/zh/08-connector/30-python.mdx index 9c88402bb4bb04446e92b8a61597174230eceed3..b57f02ac80c8d8cee8577b1a1d33b22317d7bdef 100644 --- a/docs/zh/08-connector/30-python.mdx +++ b/docs/zh/08-connector/30-python.mdx @@ -32,7 +32,7 @@ Python 连接器的源码托管在 [GitHub](https://github.com/taosdata/taos-con ### 准备 -1. 安装 Python。新近版本 taospy 包要求 Python 3.6+。早期版本 taospy 包要求 Python 3.7+。taos-ws-py 包要求 Python 3.7+。如果系统上还没有 Python 可参考 [Python BeginnersGuide](https://wiki.python.org/moin/BeginnersGuide/Download) 安装。 +1. 安装 Python。新近版本 taospy 包要求 Python 3.6.2+。早期版本 taospy 包要求 Python 3.7+。taos-ws-py 包要求 Python 3.7+。如果系统上还没有 Python 可参考 [Python BeginnersGuide](https://wiki.python.org/moin/BeginnersGuide/Download) 安装。 2. 安装 [pip](https://pypi.org/project/pip/)。大部分情况下 Python 的安装包都自带了 pip 工具, 如果没有请参考 [pip documentation](https://pip.pypa.io/en/stable/installation/) 安装。 3. 如果使用原生连接,还需[安装客户端驱动](../#安装客户端驱动)。客户端软件包含了 TDengine 客户端动态链接库(libtaos.so 或 taos.dll) 和 TDengine CLI。 diff --git a/docs/zh/08-connector/index.md b/docs/zh/08-connector/index.md index f3f0f23b34d0b75b69d8dd866566ac98f306f13f..eb1f3a9a9a728f666f9964ef51795b76991d1fcc 100644 --- a/docs/zh/08-connector/index.md +++ b/docs/zh/08-connector/index.md @@ -60,7 +60,7 @@ TDengine 版本更新往往会增加新的功能特性,列表中的连接器 | **连接管理** | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 | | **普通查询** | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 | | **参数绑定** | 暂不支持 | 暂不支持 | 支持 | 支持 | 暂不支持 | 支持 | -| **数据订阅(TMQ)** | 暂不支持 | 支持 | 支持 | 暂不支持 | 暂不支持 | 支持 | +| **数据订阅(TMQ)** | 支持 | 支持 | 支持 | 暂不支持 | 暂不支持 | 支持 | | **Schemaless** | 暂不支持 | 暂不支持 | 暂不支持 | 暂不支持 | 暂不支持 | 暂不支持 | | **批量拉取(基于 WebSocket)** | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 | | **DataFrame** | 不支持 | 支持 | 不支持 | 不支持 | 不支持 | 不支持 | diff --git a/docs/zh/12-taos-sql/02-database.md b/docs/zh/12-taos-sql/02-database.md index d9ef3b51aa61acec3dfa87d86682033c85b6e455..91ba8fdbfdefe37d0eb42a35ec9bec367cb507df 100644 --- a/docs/zh/12-taos-sql/02-database.md +++ b/docs/zh/12-taos-sql/02-database.md @@ -75,10 +75,10 @@ database_option: { - TABLE_PREFIX:内部存储引擎根据表名分配存储该表数据的 VNODE 时要忽略的前缀的长度。 - TABLE_SUFFIX:内部存储引擎根据表名分配存储该表数据的 VNODE 时要忽略的后缀的长度。 - TSDB_PAGESIZE:一个 VNODE 中时序数据存储引擎的页大小,单位为 KB,默认为 4 KB。范围为 1 到 16384,即 1 KB到 16 MB。 -- WAL_RETENTION_PERIOD:wal 文件的额外保留策略,用于数据订阅。wal 的保存时长,单位为 s。单副本默认为 0,即落盘后立即删除。-1 表示不删除。多副本默认为 4 天。 -- WAL_RETENTION_SIZE:wal 文件的额外保留策略,用于数据订阅。wal 的保存的最大上限,单位为 KB。单副本默认为 0,即落盘后立即删除。多副本默认为-1,表示不删除。 -- WAL_ROLL_PERIOD:wal 文件切换时长,单位为 s。当 wal 文件创建并写入后,经过该时间,会自动创建一个新的 wal 文件。单副本默认为 0,即仅在落盘时创建新文件。多副本默认为 1 天。 -- WAL_SEGMENT_SIZE:wal 单个文件大小,单位为 KB。当前写入文件大小超过上限后会自动创建一个新的 wal 文件。默认为 0,即仅在落盘时创建新文件。 +- WAL_RETENTION_PERIOD:数据订阅已消费WAL日志,WAL文件的最大额外保留的时长策略。单位为 s。默认为 0,表示无需额外保留。-1, 表示额外保留,时间无上限。 +- WAL_RETENTION_SIZE:数据订阅已消费WAL日志,WAL文件的最大额外保留的累计大小策略。单位为 KB。默认为 0,表示无需额外保留。-1, 表示额外保留,累计大小无上限。 +- WAL_ROLL_PERIOD:wal 文件切换时长,单位为 s。当WAL文件创建并写入后,经过该时间,会自动创建一个新的WAL文件。默认为 0,即仅在TSDB落盘时创建新文件。 +- WAL_SEGMENT_SIZE:wal 单个文件大小,单位为 KB。当前写入文件大小超过上限后会自动创建一个新的WAL文件。默认为 0,即仅在TSDB落盘时创建新文件。 ### 创建数据库示例 @@ -194,3 +194,11 @@ BALANCE VGROUP ``` 自动调整集群所有vgroup中的vnode分布,相当于在vnode级别对集群进行数据的负载均衡操作。 + +## 查看数据库工作状态 + +```sql +SHOW db_name.ALIVE; +``` + +查询数据库 db_name 的可用状态,返回值 0:不可用 1:完全可用 2:部分可用(即数据库包含的 VNODE 部分节点可用,部分节点不可用) diff --git a/docs/zh/12-taos-sql/07-tag-index.md b/docs/zh/12-taos-sql/07-tag-index.md new file mode 100644 index 0000000000000000000000000000000000000000..ae16b0b2ec4db26361c4b241fd6188bfe0df9b5e --- /dev/null +++ b/docs/zh/12-taos-sql/07-tag-index.md @@ -0,0 +1,51 @@ +--- +sidebar_label: 标签索引 +title: 标签索引 +description: 使用标签索引提升查询性能 +--- + +## 简介 + +在 TDengine 3.0.3.0 版本之前(不含),默认在第一列 TAG 上建立索引,但不支持给其它列动态添加索引。从 3.0.3.0 版本开始,可以动态地为其它 TAG 列添加索引。对于第一个 TAG 列上自动建立的索引,其在查询中默认生效,且用户无法对其进行任何干预。适当地使用索引能够有效地提升查询性能。 + +## 语法 + +创建索引的语法如下 + +```sql +CREATE INDEX index_name ON tbl_name (tagColName) +``` + +其中 `index_name` 为索引名称, `tbl_name` 为超级表名称,`tagColName` 为要在其上建立索引的 tag 列的名称。`tagColName` 的类型不受限制,即任何类型的 tag 列都可以建立索引。 + +删除索引的语法如下 + +```sql +DROP INDEX index_name +``` + +其中 `index_name` 为已经建立的某个索引的名称,如果该索引不存在则该命令执行失败,但不会对系统产生任何其它影响。 + +查看系统中已经存在的索引 + +```sql +SELECT * FROM information_schema.INS_INDEXES +``` + +也可以为上面的查询语句加上过滤条件以缩小查询范围。 + +## 使用说明 + +1. 索引使用得当能够提升数据过滤的效率,目前支持的过滤算子有 `=`, `>`, `>=`, `<`, `<=`。如果查询过滤条件中使用了这些算子,则索引能够明显提升查询效率。但如果查询过滤条件中使用的是其它算子,则索引起不到作用,查询效率没有变化。未来会逐步添加更多的算子。 + +2. 针对一个 tag 列只能建立一个索引,如果重复创建索引则会报错。 + +3. 每次只能针对一个 tag 列建立一个索引,不能同时对多个 tag 建立索引。 + +4. 整个系统中不管是哪种类型的索引,其名称必须唯一。 + +5. 对索引个数没有限制,但每增加一个索引都会导致系统中的元数据增加,过多的索引会降低元数据存取的效率从而降低整个系统的性能。所以请尽量避免添加不必要的索引。 + +6. 不支持对普通和子表建立索引。 + +7. 如果某个 tag 列的唯一值较少时,不建议对其建立索引,这种情况下收效甚微。 \ No newline at end of file diff --git a/docs/zh/12-taos-sql/12-distinguished.md b/docs/zh/12-taos-sql/12-distinguished.md index d36c852e7975dbe602166d8c7d12027043c2e302..9ef6a7f1ce12069dfd3bf0f27d00e412d0b4d32b 100644 --- a/docs/zh/12-taos-sql/12-distinguished.md +++ b/docs/zh/12-taos-sql/12-distinguished.md @@ -31,15 +31,17 @@ select max(current) from meters partition by location interval(10m) ## 窗口切分查询 -TDengine 支持按时间窗口切分方式进行聚合结果查询,比如温度传感器每秒采集一次数据,但需查询每隔 10 分钟的温度平均值。这种场景下可以使用窗口子句来获得需要的查询结果。窗口子句用于针对查询的数据集合按照窗口切分成为查询子集并进行聚合,窗口包含时间窗口(time window)、状态窗口(status window)、会话窗口(session window)三种窗口。其中时间窗口又可划分为滑动时间窗口和翻转时间窗口。窗口切分查询语法如下: +TDengine 支持按时间窗口切分方式进行聚合结果查询,比如温度传感器每秒采集一次数据,但需查询每隔 10 分钟的温度平均值。这种场景下可以使用窗口子句来获得需要的查询结果。窗口子句用于针对查询的数据集合按照窗口切分成为查询子集并进行聚合,窗口包含时间窗口(time window)、状态窗口(status window)、会话窗口(session window)、条件窗口(event window)四种窗口。其中时间窗口又可划分为滑动时间窗口和翻转时间窗口。 + +窗口子句语法如下: ```sql -SELECT select_list FROM tb_name - [WHERE where_condition] - [SESSION(ts_col, tol_val)] - [STATE_WINDOW(col)] - [INTERVAL(interval [, offset]) [SLIDING sliding]] - [FILL({NONE | VALUE | PREV | NULL | LINEAR | NEXT})] +window_clause: { + SESSION(ts_col, tol_val) + | STATE_WINDOW(col) + | INTERVAL(interval_val [, interval_offset]) [SLIDING (sliding_val)] [FILL(fill_mod_and_val)] + | EVENT_WINDOW START WITH start_trigger_condition END WITH end_trigger_condition +} ``` 在上述语法中的具体限制如下 @@ -67,6 +69,16 @@ FILL 语句指定某一窗口区间数据缺失的情况下的填充模式。填 5. LINEAR 填充:根据前后距离最近的非 NULL 值做线性插值填充。例如:FILL(LINEAR)。 6. NEXT 填充:使用下一个非 NULL 值填充数据。例如:FILL(NEXT)。 +以上填充模式中,除了 NONE 模式默认不填充值之外,其他模式在查询的整个时间范围内如果没有数据 FILL 子句将被忽略,即不产生填充数据,查询结果为空。这种行为在部分模式(PREV、NEXT、LINEAR)下具有合理性,因为在这些模式下没有数据意味着无法产生填充数值。而对另外一些模式(NULL、VALUE)来说,理论上是可以产生填充数值的,至于需不需要输出填充数值,取决于应用的需求。所以为了满足这类需要强制填充数据或 NULL 的应用的需求,同时不破坏现有填充模式的行为兼容性,从 3.0.3.0 版本开始,增加了两种新的填充模式: + +7. NULL_F: 强制填充 NULL 值 +8. VALUE_F: 强制填充 VALUE 值 + +NULL, NULL_F, VALUE, VALUE_F 这几种填充模式针对不同场景区别如下: +- INTERVAL 子句: NULL_F, VALUE_F 为强制填充模式;NULL, VALUE 为非强制模式。在这种模式下下各自的语义与名称相符 +- 流计算中的 INTERVAL 子句:NULL_F 与 NULL 行为相同,均为非强制模式;VALUE_F 与 VALUE 行为相同,均为非强制模式。即流计算中的 INTERVAL 没有强制模式 +- INTERP 子句:NULL 与 NULL_F 行为相同,均为强制模式;VALUE 与 VALUE_F 行为相同,均为强制模式。即 INTERP 中没有非强制模式。 + :::info 1. 使用 FILL 语句的时候可能生成大量的填充输出,务必指定查询的时间区间。针对每次查询,系统可返回不超过 1 千万条具有插值的结果。 @@ -138,6 +150,24 @@ SELECT tbname, _wstart, CASE WHEN voltage >= 205 and voltage <= 235 THEN 1 ELSE SELECT COUNT(*), FIRST(ts) FROM temp_tb_1 SESSION(ts, tol_val); ``` +### 事件窗口 + +事件窗口根据开始条件和结束条件来划定窗口,当start_trigger_condition满足时则窗口开始,直到end_trigger_condition满足时窗口关闭。start_trigger_condition和end_trigger_condition可以是任意 TDengine 支持的条件表达式,且可以包含不同的列。 + +事件窗口可以仅包含一条数据。即当一条数据同时满足start_trigger_condition和end_trigger_condition,且当前不在一个窗口内时,这条数据自己构成了一个窗口。 + +事件窗口无法关闭时,不构成一个窗口,不会被输出。即有数据满足start_trigger_condition,此时窗口打开,但后续数据都不能满足end_trigger_condition,这个窗口无法被关闭,这部分数据不够成一个窗口,不会被输出。 + +如果直接在超级表上进行事件窗口查询,TDengine 会将超级表的数据汇总成一条时间线,然后进行事件窗口的计算。 +如果需要对子查询的结果集进行事件窗口查询,那么子查询的结果集需要满足按时间线输出的要求,且可以输出有效的时间戳列。 + +以下面的 SQL 语句为例,事件窗口切分如图所示: +```sql +select _wstart, _wend, count(*) from t start with c1 > 0 end with c2 < 10 +``` + +![TDengine Database 事件窗口示意图](./event_window.webp) + ### 时间戳伪列 窗口聚合查询结果中,如果 SQL 语句中没有指定输出查询结果中的时间戳列,那么最终结果中不会自动包含窗口的时间列信息。如果需要在结果中输出聚合结果所对应的时间窗口信息,需要在 SELECT 子句中使用时间戳相关的伪列: 时间窗口起始时间 (\_WSTART), 时间窗口结束时间 (\_WEND), 时间窗口持续时间 (\_WDURATION), 以及查询整体窗口相关的伪列: 查询窗口起始时间(\_QSTART) 和查询窗口结束时间(\_QEND)。需要注意的是时间窗口起始时间和结束时间均是闭区间,时间窗口持续时间是数据当前时间分辨率下的数值。例如,如果当前数据库的时间分辨率是毫秒,那么结果中 500 就表示当前时间窗口的持续时间是 500毫秒 (500 ms)。 diff --git a/docs/zh/12-taos-sql/21-node.md b/docs/zh/12-taos-sql/21-node.md index 4116343730eee014047de99291c868b792153cd7..778d699099b3a564d57cbe0d0374dbdcb0fde0dc 100644 --- a/docs/zh/12-taos-sql/21-node.md +++ b/docs/zh/12-taos-sql/21-node.md @@ -119,6 +119,14 @@ DROP QNODE ON DNODE dnode_id; 删除 ID 为 dnode_id 的 DNODE 上的 QNODE,但并不会影响该 dnode 的状态。 +## 查询集群状态 + +```sql +SHOW CLUSTER ALIVE; +``` + +查询当前集群的状态是否可用,返回值: 0:不可用 1:完全可用 2:部分可用(集群中部分节点下线,但其它节点仍可以正常使用) + ## 修改客户端配置 如果将客户端也看作广义的集群的一部分,可以通过如下命令动态修改客户端配置参数。 diff --git a/docs/zh/12-taos-sql/22-meta.md b/docs/zh/12-taos-sql/22-meta.md index 75fb3e563259f43b6025c8cf7e8faff2dc2fa619..1f2e3fb7d5742a01abae8fb9caf13ef090312cdc 100644 --- a/docs/zh/12-taos-sql/22-meta.md +++ b/docs/zh/12-taos-sql/22-meta.md @@ -166,7 +166,7 @@ TDengine 内置了一个名为 `INFORMATION_SCHEMA` 的数据库,提供对数 | 7 | vgroup_id | INT | vgroup id | | 8 | ttl | INT | 表的生命周期。需要注意,`ttl` 为 TDengine 关键字,作为列名使用时需要使用 ` 进行转义。 | | 9 | table_comment | BINARY(1024) | 表注释 | -| 10 | type | BINARY(20) | 表类型 | +| 10 | type | BINARY(21) | 表类型 | ## INS_TAGS @@ -179,6 +179,20 @@ TDengine 内置了一个名为 `INFORMATION_SCHEMA` 的数据库,提供对数 | 5 | tag_type | BINARY(64) | tag 的类型 | | 6 | tag_value | BINARY(16384) | tag 的值 | +## INS_COLUMNS + +| # | **列名** | **数据类型** | **说明** | +| --- | :---------: | ------------- | ---------------------- | +| 1 | table_name | BINARY(192) | 表名 | +| 2 | db_name | BINARY(64) | 该表所在的数据库的名称 | +| 3 | table_type | BINARY(21) | 表类型 | +| 4 | col_name | BINARY(64) | 列 的名称 | +| 5 | col_type | BINARY(32) | 列 的类型 | +| 6 | col_length | INT | 列 的长度 | +| 7 | col_precision | INT | 列 的精度 | +| 8 | col_scale | INT | 列 的比例 | +| 9 | col_nullable | INT | 列 是否可以为空 | + ## INS_USERS 提供系统中创建的用户的相关信息。 diff --git a/docs/zh/12-taos-sql/26-udf.md b/docs/zh/12-taos-sql/26-udf.md index cb349109a7d8758e336ec33ef9d70ece39be61f0..7697944f9a266279d1a13c6d392d8f6f3c16160d 100644 --- a/docs/zh/12-taos-sql/26-udf.md +++ b/docs/zh/12-taos-sql/26-udf.md @@ -41,7 +41,7 @@ CREATE AGGREGATE FUNCTION function_name AS library_path OUTPUTTYPE output_type [ ```sql CREATE AGGREGATE FUNCTION l2norm AS "/home/taos/udf_example/libl2norm.so" OUTPUTTYPE DOUBLE bufsize 8; ``` -关于如何开发自定义函数,请参考 [UDF使用说明](../../develop/udf)。 +关于如何开发自定义函数,请参考 [UDF使用说明](/develop/udf)。 ## 管理 UDF diff --git a/docs/zh/12-taos-sql/event_window.webp b/docs/zh/12-taos-sql/event_window.webp new file mode 100644 index 0000000000000000000000000000000000000000..6d2ac0820433ecb89f3e22f7070b94aa0635c885 Binary files /dev/null and b/docs/zh/12-taos-sql/event_window.webp differ diff --git a/docs/zh/14-reference/04-taosadapter.md b/docs/zh/14-reference/04-taosadapter.md index 5c155bdd6ebe9f1a4a38886f30b753cbda4ab6ab..b8c5f9d647fcf920e454fabbf4da9c527b038a76 100644 --- a/docs/zh/14-reference/04-taosadapter.md +++ b/docs/zh/14-reference/04-taosadapter.md @@ -58,9 +58,9 @@ Usage of taosAdapter: --collectd.enable enable collectd. Env "TAOS_ADAPTER_COLLECTD_ENABLE" (default true) --collectd.password string collectd password. Env "TAOS_ADAPTER_COLLECTD_PASSWORD" (default "taosdata") --collectd.port int collectd server port. Env "TAOS_ADAPTER_COLLECTD_PORT" (default 6045) + --collectd.ttl int collectd data ttl. Env "TAOS_ADAPTER_COLLECTD_TTL" --collectd.user string collectd user. Env "TAOS_ADAPTER_COLLECTD_USER" (default "root") --collectd.worker int collectd write worker. Env "TAOS_ADAPTER_COLLECTD_WORKER" (default 10) - --collectd.ttl int collectd data ttl. Env "TAOS_ADAPTER_COLLECTD_TTL" (default 0, means no ttl) -c, --config string config path default /etc/taos/taosadapter.toml --cors.allowAllOrigins cors allow all origins. Env "TAOS_ADAPTER_CORS_ALLOW_ALL_ORIGINS" (default true) --cors.allowCredentials cors allow credentials. Env "TAOS_ADAPTER_CORS_ALLOW_Credentials" @@ -68,8 +68,9 @@ Usage of taosAdapter: --cors.allowOrigins stringArray cors allow origins. Env "TAOS_ADAPTER_ALLOW_ORIGINS" --cors.allowWebSockets cors allow WebSockets. Env "TAOS_ADAPTER_CORS_ALLOW_WebSockets" --cors.exposeHeaders stringArray cors expose headers. Env "TAOS_ADAPTER_Expose_Headers" - --debug enable debug mode. Env "TAOS_ADAPTER_DEBUG" + --debug enable debug mode. Env "TAOS_ADAPTER_DEBUG" (default true) --help Print this help message and exit + --httpCodeServerError Use a non-200 http status code when taosd returns an error. Env "TAOS_ADAPTER_HTTP_CODE_SERVER_ERROR" --influxdb.enable enable influxdb. Env "TAOS_ADAPTER_INFLUXDB_ENABLE" (default true) --log.enableRecordHttpSql whether to record http sql. Env "TAOS_ADAPTER_LOG_ENABLE_RECORD_HTTP_SQL" --log.path string log path. Env "TAOS_ADAPTER_LOG_PATH" (default "/var/log/taos") @@ -80,14 +81,17 @@ Usage of taosAdapter: --log.sqlRotationSize string record sql log rotation size(KB MB GB), must be a positive integer. Env "TAOS_ADAPTER_LOG_SQL_ROTATION_SIZE" (default "1GB") --log.sqlRotationTime duration record sql log rotation time. Env "TAOS_ADAPTER_LOG_SQL_ROTATION_TIME" (default 24h0m0s) --logLevel string log level (panic fatal error warn warning info debug trace). Env "TAOS_ADAPTER_LOG_LEVEL" (default "info") - --monitor.collectDuration duration Set monitor duration. Env "TAOS_MONITOR_COLLECT_DURATION" (default 3s) - --monitor.identity string The identity of the current instance, or 'hostname:port' if it is empty. Env "TAOS_MONITOR_IDENTITY" - --monitor.incgroup Whether running in cgroup. Env "TAOS_MONITOR_INCGROUP" - --monitor.password string TDengine password. Env "TAOS_MONITOR_PASSWORD" (default "taosdata") --monitor.pauseAllMemoryThreshold float Memory percentage threshold for pause all. Env "TAOS_MONITOR_PAUSE_ALL_MEMORY_THRESHOLD" (default 80) - --monitor.pauseQueryMemoryThreshold float Memory percentage threshold for pause query. Env "TAOS_MONITOR_PAUSE_QUERY_MEMORY_THRESHOLD" (default 70) - --monitor.user string TDengine user. Env "TAOS_MONITOR_USER" (default "root") - --monitor.writeInterval duration Set write to TDengine interval. Env "TAOS_MONITOR_WRITE_INTERVAL" (default 30s) - --monitor.writeToTD Whether write metrics to TDengine. Env "TAOS_MONITOR_WRITE_TO_TD" + --monitor.collectDuration duration Set monitor duration. Env "TAOS_ADAPTER_MONITOR_COLLECT_DURATION" (default 3s) + --monitor.disable Whether to disable monitoring. Env "TAOS_ADAPTER_MONITOR_DISABLE" + --monitor.disableCollectClientIP Whether to disable collecting clientIP. Env "TAOS_ADAPTER_MONITOR_DISABLE_COLLECT_CLIENT_IP" + --monitor.identity string The identity of the current instance, or 'hostname:port' if it is empty. Env "TAOS_ADAPTER_MONITOR_IDENTITY" + --monitor.incgroup Whether running in cgroup. Env "TAOS_ADAPTER_MONITOR_INCGROUP" + --monitor.password string TDengine password. Env "TAOS_ADAPTER_MONITOR_PASSWORD" (default "taosdata") + --monitor.pauseAllMemoryThreshold float Memory percentage threshold for pause all. Env "TAOS_ADAPTER_MONITOR_PAUSE_ALL_MEMORY_THRESHOLD" (default 80) + --monitor.pauseQueryMemoryThreshold float Memory percentage threshold for pause query. Env "TAOS_ADAPTER_MONITOR_PAUSE_QUERY_MEMORY_THRESHOLD" (default 70) + --monitor.user string TDengine user. Env "TAOS_ADAPTER_MONITOR_USER" (default "root") + --monitor.writeInterval duration Set write to TDengine interval. Env "TAOS_ADAPTER_MONITOR_WRITE_INTERVAL" (default 30s) + --monitor.writeToTD Whether write metrics to TDengine. Env "TAOS_ADAPTER_MONITOR_WRITE_TO_TD" --node_exporter.caCertFile string node_exporter ca cert file path. Env "TAOS_ADAPTER_NODE_EXPORTER_CA_CERT_FILE" --node_exporter.certFile string node_exporter cert file path. Env "TAOS_ADAPTER_NODE_EXPORTER_CERT_FILE" --node_exporter.db string node_exporter db name. Env "TAOS_ADAPTER_NODE_EXPORTER_DB" (default "node_exporter") @@ -100,9 +104,9 @@ Usage of taosAdapter: --node_exporter.keyFile string node_exporter cert key file path. Env "TAOS_ADAPTER_NODE_EXPORTER_KEY_FILE" --node_exporter.password string node_exporter password. Env "TAOS_ADAPTER_NODE_EXPORTER_PASSWORD" (default "taosdata") --node_exporter.responseTimeout duration node_exporter response timeout. Env "TAOS_ADAPTER_NODE_EXPORTER_RESPONSE_TIMEOUT" (default 5s) + --node_exporter.ttl int node_exporter data ttl. Env "TAOS_ADAPTER_NODE_EXPORTER_TTL" --node_exporter.urls strings node_exporter urls. Env "TAOS_ADAPTER_NODE_EXPORTER_URLS" (default [http://localhost:9100]) --node_exporter.user string node_exporter user. Env "TAOS_ADAPTER_NODE_EXPORTER_USER" (default "root") - --node_exporter.ttl int node_exporter data ttl. Env "TAOS_ADAPTER_NODE_EXPORTER_TTL"(default 0, means no ttl) --opentsdb.enable enable opentsdb. Env "TAOS_ADAPTER_OPENTSDB_ENABLE" (default true) --opentsdb_telnet.batchSize int opentsdb_telnet batch size. Env "TAOS_ADAPTER_OPENTSDB_TELNET_BATCH_SIZE" (default 1) --opentsdb_telnet.dbs strings opentsdb_telnet db names. Env "TAOS_ADAPTER_OPENTSDB_TELNET_DBS" (default [opentsdb_telnet,collectd_tsdb,icinga2_tsdb,tcollector_tsdb]) @@ -112,11 +116,11 @@ Usage of taosAdapter: --opentsdb_telnet.password string opentsdb_telnet password. Env "TAOS_ADAPTER_OPENTSDB_TELNET_PASSWORD" (default "taosdata") --opentsdb_telnet.ports ints opentsdb telnet tcp port. Env "TAOS_ADAPTER_OPENTSDB_TELNET_PORTS" (default [6046,6047,6048,6049]) --opentsdb_telnet.tcpKeepAlive enable tcp keep alive. Env "TAOS_ADAPTER_OPENTSDB_TELNET_TCP_KEEP_ALIVE" + --opentsdb_telnet.ttl int opentsdb_telnet data ttl. Env "TAOS_ADAPTER_OPENTSDB_TELNET_TTL" --opentsdb_telnet.user string opentsdb_telnet user. Env "TAOS_ADAPTER_OPENTSDB_TELNET_USER" (default "root") - --opentsdb_telnet.ttl int opentsdb_telnet data ttl. Env "TAOS_ADAPTER_OPENTSDB_TELNET_TTL"(default 0, means no ttl) - --pool.idleTimeout duration Set idle connection timeout. Env "TAOS_ADAPTER_POOL_IDLE_TIMEOUT" (default 1h0m0s) - --pool.maxConnect int max connections to taosd. Env "TAOS_ADAPTER_POOL_MAX_CONNECT" (default 4000) - --pool.maxIdle int max idle connections to taosd. Env "TAOS_ADAPTER_POOL_MAX_IDLE" (default 4000) + --pool.idleTimeout duration Set idle connection timeout. Env "TAOS_ADAPTER_POOL_IDLE_TIMEOUT" + --pool.maxConnect int max connections to taosd. Env "TAOS_ADAPTER_POOL_MAX_CONNECT" + --pool.maxIdle int max idle connections to taosd. Env "TAOS_ADAPTER_POOL_MAX_IDLE" -P, --port int http port. Env "TAOS_ADAPTER_PORT" (default 6041) --prometheus.enable enable prometheus. Env "TAOS_ADAPTER_PROMETHEUS_ENABLE" (default true) --restfulRowLimit int restful returns the maximum number of rows (-1 means no limit). Env "TAOS_ADAPTER_RESTFUL_ROW_LIMIT" (default -1) @@ -133,9 +137,9 @@ Usage of taosAdapter: --statsd.port int statsd server port. Env "TAOS_ADAPTER_STATSD_PORT" (default 6044) --statsd.protocol string statsd protocol [tcp or udp]. Env "TAOS_ADAPTER_STATSD_PROTOCOL" (default "udp") --statsd.tcpKeepAlive enable tcp keep alive. Env "TAOS_ADAPTER_STATSD_TCP_KEEP_ALIVE" + --statsd.ttl int statsd data ttl. Env "TAOS_ADAPTER_STATSD_TTL" --statsd.user string statsd user. Env "TAOS_ADAPTER_STATSD_USER" (default "root") --statsd.worker int statsd write worker. Env "TAOS_ADAPTER_STATSD_WORKER" (default 10) - --statsd.ttl int statsd data ttl. Env "TAOS_ADAPTER_STATSD_TTL" (default 0, means no ttl) --taosConfigDir string load taos client config path. Env "TAOS_ADAPTER_TAOS_CONFIG_FILE" --version Print the version and exit ``` @@ -323,6 +327,10 @@ taosAdapter 通过参数 `restfulRowLimit` 来控制结果的返回条数,-1 - `http://:6041/rest/sql` - `http://:6041/prometheus/v1/remote_read/:db` +## 配置 http 返回码 + +taosAdapter 通过参数 `httpCodeServerError` 来设置当 C 接口返回错误时是否返回非 200 的 http 状态码。当设置为 true 时将根据 C 返回的错误码返回不同 http 状态码。具体见 [HTTP 响应码](../../connector/rest-api/#http-响应码)。 + ## 故障解决 您可以通过命令 `systemctl status taosadapter` 来检查 taosAdapter 运行状态。 diff --git a/docs/zh/14-reference/05-taosbenchmark.md b/docs/zh/14-reference/05-taosbenchmark.md index 9091e71d1f9b118660d5f75ef9be5627143393b0..c5d98767f9134c8eeb9bbc1ee2fb887370d9da54 100644 --- a/docs/zh/14-reference/05-taosbenchmark.md +++ b/docs/zh/14-reference/05-taosbenchmark.md @@ -208,6 +208,9 @@ taosBenchmark -A INT,DOUBLE,NCHAR,BINARY\(16\) - ** -z/--trying-interval ** : 失败重试间隔时间,单位为毫秒,仅在 -k 指定重试后有效。需使用 v3.0.9 以上版本。 +- **-v/--vgroups ** : + 创建数据库时指定 vgroups 数,仅对 TDengine v3.0+ 有效。 + - **-V/--version** : 显示版本信息并退出。不能与其它参数混用。 @@ -238,6 +241,13 @@ taosBenchmark -A INT,DOUBLE,NCHAR,BINARY\(16\) - ** keep_trying ** : 失败后进行重试的次数,默认不重试。需使用 v3.0.9 以上版本。 - ** trying_interval ** : 失败重试间隔时间,单位为毫秒,仅在 keep_trying 指定重试后有效。需使用 v3.0.9 以上版本。 +- ** childtable_from 和 childtable_to ** : 指定写入子表范围,开闭区间为 [childtable_from, childtable_to). +  +- ** continue_if_fail ** : 允许用户定义失败后行为 + + “continue_if_fail”:  “no”, 失败 taosBenchmark 自动退出,默认行为 + “continue_if_fail”: “yes”, 失败 taosBenchmark 警告用户,并继续写入 + “continue_if_fail”: “smart”, 如果子表不存在失败,taosBenchmark 会建立子表并继续写入 #### 数据库相关配置参数 @@ -390,11 +400,11 @@ taosBenchmark -A INT,DOUBLE,NCHAR,BINARY\(16\) #### 执行指定查询语句的配置参数 -查询子表或者普通表的配置参数在 `specified_table_query` 中设置。 +查询指定表(可以指定超级表、子表或普通表)的配置参数在 `specified_table_query` 中设置。 - **query_interval** : 查询时间间隔,单位是秒,默认值为 0。 -- **threads** : 执行查询 SQL 的线程数,默认值为 1。 +- **threads/concurrent** : 执行查询 SQL 的线程数,默认值为 1。 - **sqls**: - **sql**: 执行的 SQL 命令,必填。 @@ -421,7 +431,7 @@ taosBenchmark -A INT,DOUBLE,NCHAR,BINARY\(16\) #### 执行指定订阅语句的配置参数 -订阅子表或者普通表的配置参数在 `specified_table_query` 中设置。 +订阅指定表(可以指定超级表、子表或者普通表)的配置参数在 `specified_table_query` 中设置。 - **threads/concurrent** : 执行 SQL 的线程数,默认为 1。 diff --git a/docs/zh/14-reference/07-tdinsight/index.mdx b/docs/zh/14-reference/07-tdinsight/index.mdx index 8ec11378ee7e96f8bea26cd8c7b79dcfe2557c12..8783d47f001249ea74a6f11a7f2709ae318152a0 100644 --- a/docs/zh/14-reference/07-tdinsight/index.mdx +++ b/docs/zh/14-reference/07-tdinsight/index.mdx @@ -46,7 +46,7 @@ sudo apt-get install grafana ### 在 CentOS / RHEL 上安装 Grafana
- + 您可以从官方 YUM 镜像仓库安装。 @@ -140,10 +140,10 @@ Install and configure TDinsight dashboard in Grafana on Ubuntu 18.04/20.04 syste | -n | --tdengine-ds-name | TDENGINE_DS_NAME | TDengine 数据源名称,默认为 TDengine。 | | -a | --tdengine-api | TDENGINE_API | TDengine REST API 端点。默认为`http://127.0.0.1:6041`。 | | -u | --tdengine-user | TDENGINE_USER | TDengine 用户名。 [默认值:root] | -| -p | --tdengine-密码 | TDENGINE_PASSWORD | TDengine 密码。 [默认:taosdata] | +| -p | --tdengine-password | TDENGINE_PASSWORD | TDengine 密码。 [默认:taosdata] | | -i | --tdinsight-uid | TDINSIGHT_DASHBOARD_UID | TDinsight 仪表盘`uid`。 [默认值:tdinsight] | | -t | --tdinsight-title | TDINSIGHT_DASHBOARD_TITLE | TDinsight 仪表盘标题。 [默认:TDinsight] | -| -e | --tdinsight-可编辑 | TDINSIGHT_DASHBOARD_EDITABLE | 如果配置仪表盘可以编辑。 [默认值:false] | +| -e | --tdinsight-editable | TDINSIGHT_DASHBOARD_EDITABLE | 如果配置仪表盘可以编辑。 [默认值:false] | | -E | --external-notifier | EXTERNAL_NOTIFIER | 将外部通知程序 uid 应用于 TDinsight 仪表盘。 | 假设您在主机 `tdengine` 上启动 TDengine 数据库,HTTP API 端口为 `6041`,用户为 `root1`,密码为 `pass5ord`。执行脚本: @@ -175,7 +175,7 @@ sudo ./TDengine.sh -n TDengine-Env1 -a http://another:6041 -u root -p taosdata - 特别地,当您使用 Grafana Cloud 或其他组织时,`-O` 可用于设置组织 ID。 `-G` 可指定 Grafana 插件安装目录。 `-e` 参数将仪表盘设置为可编辑。 - + ### 安装 TDengine 数据源插件 diff --git a/docs/zh/14-reference/08-taos-shell.md b/docs/zh/14-reference/08-taos-shell.md index 5ac5f6f479e52aa7dd9a606a8eeb19e8c11a8a3c..3423cf35bbeb54c526e2bbad7ec3eae230cce07b 100644 --- a/docs/zh/14-reference/08-taos-shell.md +++ b/docs/zh/14-reference/08-taos-shell.md @@ -61,12 +61,14 @@ taos> SET MAX_BINARY_DISPLAY_WIDTH ; - -c CONFIGDIR: 指定配置文件目录,Linux 环境下默认为 `/etc/taos`,该目录下的配置文件默认名称为 `taos.cfg` - -C: 打印 -c 指定的目录中 `taos.cfg` 的配置参数 - -d DATABASE: 指定连接到服务端时使用的数据库 +- -E dsn: 使用 WebSocket DSN 连接云服务或者提供 WebSocket 连接的服务端 - -f FILE: 以非交互模式执行 SQL 脚本文件。文件中一个 SQL 语句只能占一行 - -k: 测试服务端运行状态,0: unavailable,1: network ok,2: service ok,3: service degraded,4: exiting - -l PKTLEN: 网络测试时使用的测试包大小 - -n NETROLE: 网络连接测试时的测试范围,默认为 `client`, 可选值为 `client`、`server` - -N PKTNUM: 网络测试时使用的测试包数量 - -r: 将时间输出出无符号 64 位整数类型(即 C 语音中 uint64_t) +- -R: 使用 RESTful 模式连接服务端 - -s COMMAND: 以非交互模式执行的 SQL 命令 - -t: 测试服务端启动状态,状态同-k - -w DISPLAYWIDTH: 客户端列显示宽度 diff --git a/docs/zh/14-reference/12-config/index.md b/docs/zh/14-reference/12-config/index.md index 4cba66f04f677bdcc9de6a3c79fcc5574e421714..6eeb577ab597baf7d7547d15a5048018ee8ef497 100644 --- a/docs/zh/14-reference/12-config/index.md +++ b/docs/zh/14-reference/12-config/index.md @@ -355,8 +355,6 @@ charset 的有效值是 UTF-8。 | 取值范围 | 0-4096 | | 缺省值 | CPU 核数的 2 倍 | -## 时间相关 | - ## 性能调优 ### numOfCommitThreads @@ -611,7 +609,7 @@ charset 的有效值是 UTF-8。 | 适用范围 | 仅客户端适用 | | 含义 | schemaless 列数据是否顺序一致,从3.0.3.0开始,该配置废弃 | | 值域 | 0:不一致;1: 一致 | -| 缺省值 | 1 | +| 缺省值 | 0 | ## 其他 diff --git a/docs/zh/14-reference/13-schemaless/13-schemaless.md b/docs/zh/14-reference/13-schemaless/13-schemaless.md index 3d0bac25d20953733d842e8057f2c0c24deb831e..e5f232c1fc506a6e37cb128cab129a7fe539d60a 100644 --- a/docs/zh/14-reference/13-schemaless/13-schemaless.md +++ b/docs/zh/14-reference/13-schemaless/13-schemaless.md @@ -87,7 +87,7 @@ st,t1=3,t2=4,t3=t3 c1=3i64,c3="passit",c2=false,c4=4f64 1626006833639000000 :::tip 无模式所有的处理逻辑,仍会遵循 TDengine 对数据结构的底层限制,例如每行数据的总长度不能超过 -16KB。这方面的具体限制约束请参见 [TDengine SQL 边界限制](/taos-sql/limit) +48KB,标签值的总长度不超过16KB。这方面的具体限制约束请参见 [TDengine SQL 边界限制](/taos-sql/limit) ::: diff --git a/docs/zh/20-third-party/11-kafka.md b/docs/zh/20-third-party/11-kafka.md index cc2247f25ebacbc8f5290c2442860f264fad39f1..7fb7738a4f629ccda5dd2aca3c65bf7cb5a90efe 100644 --- a/docs/zh/20-third-party/11-kafka.md +++ b/docs/zh/20-third-party/11-kafka.md @@ -79,7 +79,7 @@ Development: false ### 从源码安装 ``` -git clone https://github.com/taosdata/kafka-connect-tdengine.git +git clone --branch 3.0 https://github.com/taosdata/kafka-connect-tdengine.git cd kafka-connect-tdengine mvn clean package unzip -d $CONFLUENT_HOME/share/java/ target/components/packages/taosdata-kafka-connect-tdengine-*.zip diff --git a/docs/zh/28-releases/01-tdengine.md b/docs/zh/28-releases/01-tdengine.md index c9505d95a58ef03d5d374d952c4b66c3d5e37828..5c8c5edd0519764ec893b551a2dfc934ad44e5c4 100644 --- a/docs/zh/28-releases/01-tdengine.md +++ b/docs/zh/28-releases/01-tdengine.md @@ -10,6 +10,11 @@ TDengine 2.x 各版本安装包请访问[这里](https://www.taosdata.com/all-do import Release from "/components/ReleaseV3"; +## 3.0.3.0 + + + + ## 3.0.2.6 diff --git a/docs/zh/28-releases/02-tools.md b/docs/zh/28-releases/02-tools.md index 69d35f95c85c743b7f0f0ff035c23ed96c26b021..a9c9ea5ac7d153df6353ffebf59c77b7a5c5867b 100644 --- a/docs/zh/28-releases/02-tools.md +++ b/docs/zh/28-releases/02-tools.md @@ -10,6 +10,14 @@ taosTools 各版本安装包下载链接如下: import Release from "/components/ReleaseV3"; +## 2.4.9 + + + +## 2.4.8 + + + ## 2.4.6 diff --git a/examples/lua/build.sh b/examples/lua/build.sh index 1e6fef632ceb828c9e0eca1a02dc4a6654906474..5e856f3e9ef0c18b309c1b6fa66f8c79b7dec2dd 100755 --- a/examples/lua/build.sh +++ b/examples/lua/build.sh @@ -4,5 +4,5 @@ if [ "$lua_header_installed" = "0" ]; then sudo apt install -y liblua5.3-dev fi -gcc -std=c99 lua_connector.c -fPIC -shared -o luaconnector.so -Wall -ltaos -I/usr/include/lua5.3 -I../../include/client +gcc -g -std=c99 lua_connector.c -fPIC -shared -o luaconnector.so -Wall -ltaos -I/usr/include/lua5.3 -I../../include/client diff --git a/examples/lua/lua51/lua_connector51.c b/examples/lua/lua51/lua_connector51.c index 8a9051dd0cb3da0fd82e752132d499a5935be758..c5ef9126a644cae83a730f5d39d501713aff9db5 100644 --- a/examples/lua/lua51/lua_connector51.c +++ b/examples/lua/lua51/lua_connector51.c @@ -67,7 +67,7 @@ static int l_connect(lua_State *L){ taos = taos_connect(host, user,password,database, port); if (taos == NULL) { - printf("failed to connect server, reason:%s\n", taos_errstr(taos)); + //printf("failed to connect server, reason:%s\n", taos_errstr(taos)); lua_pushinteger(L, -1); lua_setfield(L, table_index, "code"); @@ -79,7 +79,7 @@ static int l_connect(lua_State *L){ // printf("success to connect server\n"); lua_pushinteger(L, 0); lua_setfield(L, table_index, "code"); - lua_pushstring(L, taos_errstr(taos)); + lua_pushstring(L, "success"); lua_setfield(L, table_index, "error"); lua_pushlightuserdata(L,taos); lua_setfield(L, table_index, "conn"); diff --git a/examples/lua/lua_connector.c b/examples/lua/lua_connector.c index c3d8bcb99548c787953cd27bcbb90b6c63ee5a4a..5d8226f2623f6451ef77b71dac1a6583ba6c460b 100644 --- a/examples/lua/lua_connector.c +++ b/examples/lua/lua_connector.c @@ -67,8 +67,7 @@ static int l_connect(lua_State *L){ taos = taos_connect(host, user,password,database, port); if (taos == NULL) { - printf("failed to connect server, reason:%s\n", taos_errstr(taos)); - +// printf("failed to connect server, reason:%s\n", taos_errstr(NULL)); lua_pushinteger(L, -1); lua_setfield(L, table_index, "code"); lua_pushstring(L, taos_errstr(taos)); @@ -79,7 +78,7 @@ static int l_connect(lua_State *L){ // printf("success to connect server\n"); lua_pushinteger(L, 0); lua_setfield(L, table_index, "code"); - lua_pushstring(L, taos_errstr(taos)); + lua_pushstring(L, "success"); lua_setfield(L, table_index, "error"); lua_pushlightuserdata(L,taos); lua_setfield(L, table_index, "conn"); diff --git a/include/common/tglobal.h b/include/common/tglobal.h index b35b46021168ed38058f0bdd4a20742125d02204..ac75b8476299a8600ffa298e44b9f95b71640883 100644 --- a/include/common/tglobal.h +++ b/include/common/tglobal.h @@ -74,6 +74,10 @@ extern int32_t tsHeartbeatTimeout; // vnode extern int64_t tsVndCommitMaxIntervalMs; +// mnode +extern int64_t tsMndSdbWriteDelta; +extern int64_t tsMndLogRetention; + // monitor extern bool tsEnableMonitor; extern int32_t tsMonitorInterval; diff --git a/include/common/tmsg.h b/include/common/tmsg.h index cd63f7d27800a89e6903d37740d54a44806e7c19..d9d3c7e2977f7b88b759f9d4cc7bc216b91e06fc 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -66,6 +66,15 @@ extern int32_t tMsgDict[]; typedef uint16_t tmsg_t; +static inline bool tmsgIsValid(tmsg_t type) { + if (type < TDMT_DND_MAX_MSG || type < TDMT_MND_MAX_MSG || type < TDMT_VND_MAX_MSG || type < TDMT_SCH_MAX_MSG || + type < TDMT_STREAM_MAX_MSG || type < TDMT_MON_MAX_MSG || type < TDMT_SYNC_MAX_MSG || type < TDMT_VND_STREAM_MSG || + type < TDMT_VND_TMQ_MSG || type < TDMT_VND_TMQ_MAX_MSG) { + return true; + } else { + return false; + } +} static inline bool vnodeIsMsgBlock(tmsg_t type) { return (type == TDMT_VND_CREATE_TABLE) || (type == TDMT_VND_ALTER_TABLE) || (type == TDMT_VND_DROP_TABLE) || (type == TDMT_VND_UPDATE_TAG_VAL) || (type == TDMT_VND_ALTER_CONFIRM); @@ -603,6 +612,7 @@ typedef struct { char user[TSDB_USER_LEN]; char passwd[TSDB_PASSWORD_LEN]; int64_t startTime; + char sVer[TSDB_VERSION_LEN]; } SConnectReq; int32_t tSerializeSConnectReq(void* buf, int32_t bufLen, SConnectReq* pReq); @@ -835,6 +845,7 @@ typedef struct { int8_t cacheLast; int8_t replications; int32_t sstTrigger; + int32_t minRows; } SAlterDbReq; int32_t tSerializeSAlterDbReq(void* buf, int32_t bufLen, SAlterDbReq* pReq); @@ -929,12 +940,19 @@ typedef struct { int32_t minRows; int32_t maxRows; int32_t walFsyncPeriod; + int16_t hashPrefix; + int16_t hashSuffix; int8_t walLevel; int8_t precision; int8_t compression; int8_t replications; int8_t strict; int8_t cacheLast; + int32_t tsdbPageSize; + int32_t walRetentionPeriod; + int32_t walRollPeriod; + int64_t walRetentionSize; + int64_t walSegmentSize; int32_t numOfRetensions; SArray* pRetensions; int8_t schemaless; @@ -1015,7 +1033,8 @@ int32_t tDeserializeSUserAuthBatchRsp(void* buf, int32_t bufLen, SUserAuthBatchR void tFreeSUserAuthBatchRsp(SUserAuthBatchRsp* pRsp); typedef struct { - char db[TSDB_DB_FNAME_LEN]; + char db[TSDB_DB_FNAME_LEN]; + STimeWindow timeRange; } SCompactDbReq; int32_t tSerializeSCompactDbReq(void* buf, int32_t bufLen, SCompactDbReq* pReq); @@ -1274,9 +1293,10 @@ int32_t tSerializeSDropIdxReq(void* buf, int32_t bufLen, SDropIndexReq* pReq); int32_t tDeserializeSDropIdxReq(void* buf, int32_t bufLen, SDropIndexReq* pReq); typedef struct { - int64_t dbUid; - char db[TSDB_DB_FNAME_LEN]; - int64_t compactStartTime; + int64_t dbUid; + char db[TSDB_DB_FNAME_LEN]; + int64_t compactStartTime; + STimeWindow tw; } SCompactVnodeReq; int32_t tSerializeSCompactVnodeReq(void* buf, int32_t bufLen, SCompactVnodeReq* pReq); @@ -1297,6 +1317,9 @@ typedef struct { int8_t strict; int8_t cacheLast; int64_t reserved[8]; + // 1st modification + int16_t sttTrigger; + int32_t minRows; } SAlterVnodeConfigReq; int32_t tSerializeSAlterVnodeConfigReq(void* buf, int32_t bufLen, SAlterVnodeConfigReq* pReq); @@ -1812,7 +1835,7 @@ typedef struct { #define STREAM_TRIGGER_AT_ONCE 1 #define STREAM_TRIGGER_WINDOW_CLOSE 2 #define STREAM_TRIGGER_MAX_DELAY 3 -#define STREAM_DEFAULT_IGNORE_EXPIRED 0 +#define STREAM_DEFAULT_IGNORE_EXPIRED 1 #define STREAM_FILL_HISTORY_ON 1 #define STREAM_FILL_HISTORY_OFF 0 #define STREAM_DEFAULT_FILL_HISTORY STREAM_FILL_HISTORY_OFF @@ -1904,10 +1927,10 @@ typedef struct { } SMqConsumerLostMsg, SMqConsumerRecoverMsg, SMqConsumerClearMsg; typedef struct { - int64_t consumerId; - char cgroup[TSDB_CGROUP_LEN]; - char clientId[256]; - SArray* topicNames; // SArray + int64_t consumerId; + char cgroup[TSDB_CGROUP_LEN]; + char clientId[256]; + SArray* topicNames; // SArray } SCMSubscribeReq; static FORCE_INLINE int32_t tSerializeSCMSubscribeReq(void** buf, const SCMSubscribeReq* pReq) { @@ -2684,7 +2707,7 @@ typedef struct { char subKey[TSDB_SUBSCRIBE_KEY_LEN]; int8_t subType; int8_t withMeta; - char* qmsg; + char* qmsg; // SubPlanToString int64_t suid; } SMqRebVgReq; diff --git a/include/common/ttokendef.h b/include/common/ttokendef.h index d1a81fd9961d5ed5eedfe30472ff067589042e21..1235dd344736d1245fd6cbc17ae7961554c6317d 100644 --- a/include/common/ttokendef.h +++ b/include/common/ttokendef.h @@ -110,169 +110,169 @@ #define TK_TABLE_SUFFIX 92 #define TK_NK_COLON 93 #define TK_MAX_SPEED 94 -#define TK_TABLE 95 -#define TK_NK_LP 96 -#define TK_NK_RP 97 -#define TK_STABLE 98 -#define TK_ADD 99 -#define TK_COLUMN 100 -#define TK_MODIFY 101 -#define TK_RENAME 102 -#define TK_TAG 103 -#define TK_SET 104 -#define TK_NK_EQ 105 -#define TK_USING 106 -#define TK_TAGS 107 -#define TK_COMMENT 108 -#define TK_BOOL 109 -#define TK_TINYINT 110 -#define TK_SMALLINT 111 -#define TK_INT 112 -#define TK_INTEGER 113 -#define TK_BIGINT 114 -#define TK_FLOAT 115 -#define TK_DOUBLE 116 -#define TK_BINARY 117 -#define TK_TIMESTAMP 118 -#define TK_NCHAR 119 -#define TK_UNSIGNED 120 -#define TK_JSON 121 -#define TK_VARCHAR 122 -#define TK_MEDIUMBLOB 123 -#define TK_BLOB 124 -#define TK_VARBINARY 125 -#define TK_DECIMAL 126 -#define TK_MAX_DELAY 127 -#define TK_WATERMARK 128 -#define TK_ROLLUP 129 -#define TK_TTL 130 -#define TK_SMA 131 -#define TK_DELETE_MARK 132 -#define TK_FIRST 133 -#define TK_LAST 134 -#define TK_SHOW 135 -#define TK_PRIVILEGES 136 -#define TK_DATABASES 137 -#define TK_TABLES 138 -#define TK_STABLES 139 -#define TK_MNODES 140 -#define TK_QNODES 141 -#define TK_FUNCTIONS 142 -#define TK_INDEXES 143 -#define TK_ACCOUNTS 144 -#define TK_APPS 145 -#define TK_CONNECTIONS 146 -#define TK_LICENCES 147 -#define TK_GRANTS 148 -#define TK_QUERIES 149 -#define TK_SCORES 150 -#define TK_TOPICS 151 -#define TK_VARIABLES 152 -#define TK_CLUSTER 153 -#define TK_BNODES 154 -#define TK_SNODES 155 -#define TK_TRANSACTIONS 156 -#define TK_DISTRIBUTED 157 -#define TK_CONSUMERS 158 -#define TK_SUBSCRIPTIONS 159 -#define TK_VNODES 160 -#define TK_ALIVE 161 -#define TK_LIKE 162 -#define TK_TBNAME 163 -#define TK_QTAGS 164 -#define TK_AS 165 -#define TK_INDEX 166 -#define TK_FUNCTION 167 -#define TK_INTERVAL 168 -#define TK_COUNT 169 -#define TK_LAST_ROW 170 -#define TK_TOPIC 171 -#define TK_WITH 172 -#define TK_META 173 -#define TK_CONSUMER 174 -#define TK_GROUP 175 -#define TK_DESC 176 -#define TK_DESCRIBE 177 -#define TK_RESET 178 -#define TK_QUERY 179 -#define TK_CACHE 180 -#define TK_EXPLAIN 181 -#define TK_ANALYZE 182 -#define TK_VERBOSE 183 -#define TK_NK_BOOL 184 -#define TK_RATIO 185 -#define TK_NK_FLOAT 186 -#define TK_OUTPUTTYPE 187 -#define TK_AGGREGATE 188 -#define TK_BUFSIZE 189 -#define TK_LANGUAGE 190 -#define TK_STREAM 191 -#define TK_INTO 192 -#define TK_TRIGGER 193 -#define TK_AT_ONCE 194 -#define TK_WINDOW_CLOSE 195 -#define TK_IGNORE 196 -#define TK_EXPIRED 197 -#define TK_FILL_HISTORY 198 -#define TK_UPDATE 199 -#define TK_SUBTABLE 200 -#define TK_KILL 201 -#define TK_CONNECTION 202 -#define TK_TRANSACTION 203 -#define TK_BALANCE 204 -#define TK_VGROUP 205 -#define TK_MERGE 206 -#define TK_REDISTRIBUTE 207 -#define TK_SPLIT 208 -#define TK_DELETE 209 -#define TK_INSERT 210 -#define TK_NULL 211 -#define TK_NK_QUESTION 212 -#define TK_NK_ARROW 213 -#define TK_ROWTS 214 -#define TK_QSTART 215 -#define TK_QEND 216 -#define TK_QDURATION 217 -#define TK_WSTART 218 -#define TK_WEND 219 -#define TK_WDURATION 220 -#define TK_IROWTS 221 -#define TK_ISFILLED 222 -#define TK_CAST 223 -#define TK_NOW 224 -#define TK_TODAY 225 -#define TK_TIMEZONE 226 -#define TK_CLIENT_VERSION 227 -#define TK_SERVER_VERSION 228 -#define TK_SERVER_STATUS 229 -#define TK_CURRENT_USER 230 -#define TK_CASE 231 -#define TK_END 232 -#define TK_WHEN 233 -#define TK_THEN 234 -#define TK_ELSE 235 -#define TK_BETWEEN 236 -#define TK_IS 237 -#define TK_NK_LT 238 -#define TK_NK_GT 239 -#define TK_NK_LE 240 -#define TK_NK_GE 241 -#define TK_NK_NE 242 -#define TK_MATCH 243 -#define TK_NMATCH 244 -#define TK_CONTAINS 245 -#define TK_IN 246 -#define TK_JOIN 247 -#define TK_INNER 248 -#define TK_SELECT 249 -#define TK_DISTINCT 250 -#define TK_WHERE 251 -#define TK_PARTITION 252 -#define TK_BY 253 -#define TK_SESSION 254 -#define TK_STATE_WINDOW 255 -#define TK_EVENT_WINDOW 256 -#define TK_START 257 +#define TK_START 95 +#define TK_WITH 96 +#define TK_TIMESTAMP 97 +#define TK_END 98 +#define TK_TABLE 99 +#define TK_NK_LP 100 +#define TK_NK_RP 101 +#define TK_STABLE 102 +#define TK_ADD 103 +#define TK_COLUMN 104 +#define TK_MODIFY 105 +#define TK_RENAME 106 +#define TK_TAG 107 +#define TK_SET 108 +#define TK_NK_EQ 109 +#define TK_USING 110 +#define TK_TAGS 111 +#define TK_COMMENT 112 +#define TK_BOOL 113 +#define TK_TINYINT 114 +#define TK_SMALLINT 115 +#define TK_INT 116 +#define TK_INTEGER 117 +#define TK_BIGINT 118 +#define TK_FLOAT 119 +#define TK_DOUBLE 120 +#define TK_BINARY 121 +#define TK_NCHAR 122 +#define TK_UNSIGNED 123 +#define TK_JSON 124 +#define TK_VARCHAR 125 +#define TK_MEDIUMBLOB 126 +#define TK_BLOB 127 +#define TK_VARBINARY 128 +#define TK_DECIMAL 129 +#define TK_MAX_DELAY 130 +#define TK_WATERMARK 131 +#define TK_ROLLUP 132 +#define TK_TTL 133 +#define TK_SMA 134 +#define TK_DELETE_MARK 135 +#define TK_FIRST 136 +#define TK_LAST 137 +#define TK_SHOW 138 +#define TK_PRIVILEGES 139 +#define TK_DATABASES 140 +#define TK_TABLES 141 +#define TK_STABLES 142 +#define TK_MNODES 143 +#define TK_QNODES 144 +#define TK_FUNCTIONS 145 +#define TK_INDEXES 146 +#define TK_ACCOUNTS 147 +#define TK_APPS 148 +#define TK_CONNECTIONS 149 +#define TK_LICENCES 150 +#define TK_GRANTS 151 +#define TK_QUERIES 152 +#define TK_SCORES 153 +#define TK_TOPICS 154 +#define TK_VARIABLES 155 +#define TK_CLUSTER 156 +#define TK_BNODES 157 +#define TK_SNODES 158 +#define TK_TRANSACTIONS 159 +#define TK_DISTRIBUTED 160 +#define TK_CONSUMERS 161 +#define TK_SUBSCRIPTIONS 162 +#define TK_VNODES 163 +#define TK_ALIVE 164 +#define TK_LIKE 165 +#define TK_TBNAME 166 +#define TK_QTAGS 167 +#define TK_AS 168 +#define TK_INDEX 169 +#define TK_FUNCTION 170 +#define TK_INTERVAL 171 +#define TK_COUNT 172 +#define TK_LAST_ROW 173 +#define TK_TOPIC 174 +#define TK_META 175 +#define TK_CONSUMER 176 +#define TK_GROUP 177 +#define TK_DESC 178 +#define TK_DESCRIBE 179 +#define TK_RESET 180 +#define TK_QUERY 181 +#define TK_CACHE 182 +#define TK_EXPLAIN 183 +#define TK_ANALYZE 184 +#define TK_VERBOSE 185 +#define TK_NK_BOOL 186 +#define TK_RATIO 187 +#define TK_NK_FLOAT 188 +#define TK_OUTPUTTYPE 189 +#define TK_AGGREGATE 190 +#define TK_BUFSIZE 191 +#define TK_LANGUAGE 192 +#define TK_STREAM 193 +#define TK_INTO 194 +#define TK_TRIGGER 195 +#define TK_AT_ONCE 196 +#define TK_WINDOW_CLOSE 197 +#define TK_IGNORE 198 +#define TK_EXPIRED 199 +#define TK_FILL_HISTORY 200 +#define TK_UPDATE 201 +#define TK_SUBTABLE 202 +#define TK_KILL 203 +#define TK_CONNECTION 204 +#define TK_TRANSACTION 205 +#define TK_BALANCE 206 +#define TK_VGROUP 207 +#define TK_MERGE 208 +#define TK_REDISTRIBUTE 209 +#define TK_SPLIT 210 +#define TK_DELETE 211 +#define TK_INSERT 212 +#define TK_NULL 213 +#define TK_NK_QUESTION 214 +#define TK_NK_ARROW 215 +#define TK_ROWTS 216 +#define TK_QSTART 217 +#define TK_QEND 218 +#define TK_QDURATION 219 +#define TK_WSTART 220 +#define TK_WEND 221 +#define TK_WDURATION 222 +#define TK_IROWTS 223 +#define TK_ISFILLED 224 +#define TK_CAST 225 +#define TK_NOW 226 +#define TK_TODAY 227 +#define TK_TIMEZONE 228 +#define TK_CLIENT_VERSION 229 +#define TK_SERVER_VERSION 230 +#define TK_SERVER_STATUS 231 +#define TK_CURRENT_USER 232 +#define TK_CASE 233 +#define TK_WHEN 234 +#define TK_THEN 235 +#define TK_ELSE 236 +#define TK_BETWEEN 237 +#define TK_IS 238 +#define TK_NK_LT 239 +#define TK_NK_GT 240 +#define TK_NK_LE 241 +#define TK_NK_GE 242 +#define TK_NK_NE 243 +#define TK_MATCH 244 +#define TK_NMATCH 245 +#define TK_CONTAINS 246 +#define TK_IN 247 +#define TK_JOIN 248 +#define TK_INNER 249 +#define TK_SELECT 250 +#define TK_DISTINCT 251 +#define TK_WHERE 252 +#define TK_PARTITION 253 +#define TK_BY 254 +#define TK_SESSION 255 +#define TK_STATE_WINDOW 256 +#define TK_EVENT_WINDOW 257 #define TK_SLIDING 258 #define TK_FILL 259 #define TK_VALUE 260 diff --git a/include/libs/executor/executor.h b/include/libs/executor/executor.h index 095d2f6d10dbe6faa0460f5532c569b543fb4ac0..c3d20103512ae0ffa34e7dda4157912f184fb181 100644 --- a/include/libs/executor/executor.h +++ b/include/libs/executor/executor.h @@ -219,6 +219,7 @@ int32_t qStreamRecoverFinish(qTaskInfo_t tinfo); int32_t qStreamRestoreParam(qTaskInfo_t tinfo); bool qStreamRecoverScanFinished(qTaskInfo_t tinfo); void qStreamCloseTsdbReader(void* task); +void resetTaskInfo(qTaskInfo_t tinfo); #ifdef __cplusplus } diff --git a/include/libs/function/taosudf.h b/include/libs/function/taosudf.h index 7e5b8406bbf91fa24fd32f71e8e9e5d83defc247..b4daa895fd1a66ae01db72704c37c7a8707a8ace 100644 --- a/include/libs/function/taosudf.h +++ b/include/libs/function/taosudf.h @@ -149,6 +149,8 @@ static FORCE_INLINE int32_t udfColEnsureCapacity(SUdfColumn *pColumn, int32_t ne allocCapacity *= UDF_MEMORY_EXP_GROWTH; } + int32_t existedRows = data->numOfRows; + if (IS_VAR_DATA_TYPE(meta->type)) { char *tmp = (char *)realloc(data->varLenCol.varOffsets, sizeof(int32_t) * allocCapacity); if (tmp == NULL) { @@ -156,6 +158,7 @@ static FORCE_INLINE int32_t udfColEnsureCapacity(SUdfColumn *pColumn, int32_t ne } data->varLenCol.varOffsets = (int32_t *)tmp; data->varLenCol.varOffsetsLen = sizeof(int32_t) * allocCapacity; + memset(&data->varLenCol.varOffsets[existedRows], 0, sizeof(int32_t) * (allocCapacity - existedRows)); // for payload, add data in udfColDataAppend } else { char *tmp = (char *)realloc(data->fixLenCol.nullBitmap, BitmapLen(allocCapacity)); @@ -164,6 +167,9 @@ static FORCE_INLINE int32_t udfColEnsureCapacity(SUdfColumn *pColumn, int32_t ne } data->fixLenCol.nullBitmap = tmp; data->fixLenCol.nullBitmapLen = BitmapLen(allocCapacity); + int32_t oldLen = BitmapLen(existedRows); + memset(&data->fixLenCol.nullBitmap[oldLen], 0, BitmapLen(allocCapacity) - oldLen); + if (meta->type == TSDB_DATA_TYPE_NULL) { return TSDB_CODE_SUCCESS; } @@ -190,6 +196,7 @@ static FORCE_INLINE void udfColDataSetNull(SUdfColumn *pColumn, int32_t row) { udfColDataSetNull_f(pColumn, row); } pColumn->hasNull = true; + pColumn->colData.numOfRows = ((int32_t)(row + 1) > pColumn->colData.numOfRows) ? (int32_t)(row + 1) : pColumn->colData.numOfRows; } static FORCE_INLINE int32_t udfColDataSet(SUdfColumn *pColumn, uint32_t currentRow, const char *pData, bool isNull) { @@ -260,24 +267,21 @@ typedef int32_t (*TUdfAggMergeFunc)(SUdfInterBuf *inputBuf1, SUdfInterBuf *input typedef int32_t (*TUdfAggFinishFunc)(SUdfInterBuf *buf, SUdfInterBuf *resultData); ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct SScriptUdfEnvItem{ +typedef struct SScriptUdfEnvItem { const char *name; const char *value; } SScriptUdfEnvItem; -typedef enum EUdfFuncType { - UDF_FUNC_TYPE_SCALAR = 1, - UDF_FUNC_TYPE_AGG = 2 -} EUdfFuncType; +typedef enum EUdfFuncType { UDF_FUNC_TYPE_SCALAR = 1, UDF_FUNC_TYPE_AGG = 2 } EUdfFuncType; typedef struct SScriptUdfInfo { const char *name; - EUdfFuncType funcType; - int8_t scriptType; - int8_t outputType; - int32_t outputLen; - int32_t bufSize; + EUdfFuncType funcType; + int8_t scriptType; + int8_t outputType; + int32_t outputLen; + int32_t bufSize; const char *path; } SScriptUdfInfo; @@ -294,7 +298,7 @@ typedef int32_t (*TScriptUdfInitFunc)(SScriptUdfInfo *info, void **pUdfCtx); typedef int32_t (*TScriptUdfDestoryFunc)(void *udfCtx); // the following function is for open/close script plugin. -typedef int32_t (*TScriptOpenFunc)(SScriptUdfEnvItem* items, int numItems); +typedef int32_t (*TScriptOpenFunc)(SScriptUdfEnvItem *items, int numItems); typedef int32_t (*TScriptCloseFunc)(); #ifdef __cplusplus diff --git a/include/libs/nodes/cmdnodes.h b/include/libs/nodes/cmdnodes.h index e9d6aca1f9bbaa9da6219e05d63f0c9b67c5096a..fefcc28bc29213d6aad0b9e9f93c9d76193cf4e4 100644 --- a/include/libs/nodes/cmdnodes.h +++ b/include/libs/nodes/cmdnodes.h @@ -41,14 +41,15 @@ extern "C" { #define SHOW_LOCAL_VARIABLES_RESULT_FIELD2_LEN (TSDB_CONFIG_VALUE_LEN + VARSTR_HEADER_SIZE) #define SHOW_ALIVE_RESULT_COLS 1 -#define PRIVILEGE_TYPE_MASK(n) (1 << n) -#define PRIVILEGE_TYPE_ALL PRIVILEGE_TYPE_MASK(0) -#define PRIVILEGE_TYPE_READ PRIVILEGE_TYPE_MASK(1) -#define PRIVILEGE_TYPE_WRITE PRIVILEGE_TYPE_MASK(2) -#define PRIVILEGE_TYPE_SUBSCRIBE PRIVILEGE_TYPE_MASK(3) +#define BIT_FLAG_MASK(n) (1 << n) +#define BIT_FLAG_SET_MASK(val, mask) ((val) |= (mask)) +#define BIT_FLAG_TEST_MASK(val, mask) (((val) & (mask)) != 0) -#define PRIVILEGE_TYPE_TEST_MASK(val, mask) (((val) & (mask)) != 0) +#define PRIVILEGE_TYPE_ALL BIT_FLAG_MASK(0) +#define PRIVILEGE_TYPE_READ BIT_FLAG_MASK(1) +#define PRIVILEGE_TYPE_WRITE BIT_FLAG_MASK(2) +#define PRIVILEGE_TYPE_SUBSCRIBE BIT_FLAG_MASK(3) typedef struct SDatabaseOptions { ENodeType type; @@ -127,6 +128,8 @@ typedef struct STrimDatabaseStmt { typedef struct SCompactDatabaseStmt { ENodeType type; char dbName[TSDB_DB_NAME_LEN]; + SNode* pStart; + SNode* pEnd; } SCompactDatabaseStmt; typedef struct STableOptions { @@ -265,6 +268,7 @@ typedef struct SShowStmt { typedef struct SShowCreateDatabaseStmt { ENodeType type; char dbName[TSDB_DB_NAME_LEN]; + char dbFName[TSDB_DB_FNAME_LEN]; void* pCfg; // SDbCfgInfo } SShowCreateDatabaseStmt; @@ -392,6 +396,15 @@ typedef struct SKillQueryStmt { char queryId[TSDB_QUERY_ID_LEN]; } SKillQueryStmt; +typedef enum EStreamOptionsSetFlag { + SOPT_TRIGGER_TYPE_SET = BIT_FLAG_MASK(0), + SOPT_WATERMARK_SET = BIT_FLAG_MASK(1), + SOPT_DELETE_MARK_SET = BIT_FLAG_MASK(2), + SOPT_FILL_HISTORY_SET = BIT_FLAG_MASK(3), + SOPT_IGNORE_EXPIRED_SET = BIT_FLAG_MASK(4), + SOPT_IGNORE_UPDATE_SET = BIT_FLAG_MASK(5), +} EStreamOptionsSetFlag; + typedef struct SStreamOptions { ENodeType type; int8_t triggerType; @@ -401,6 +414,7 @@ typedef struct SStreamOptions { int8_t fillHistory; int8_t ignoreExpired; int8_t ignoreUpdate; + int64_t setFlag; } SStreamOptions; typedef struct SCreateStreamStmt { diff --git a/include/libs/sync/sync.h b/include/libs/sync/sync.h index 5e37da4f3f57a57c8ebab0fb7537786ea6a642b9..189484d1a6c98f298c5e8e7910cacba12d309b39 100644 --- a/include/libs/sync/sync.h +++ b/include/libs/sync/sync.h @@ -35,7 +35,6 @@ extern "C" { #define SYNC_MAX_RECV_TIME_RANGE_MS 1200 #define SYNC_DEL_WAL_MS (1000 * 60) #define SYNC_ADD_QUORUM_COUNT 3 -#define SYNC_MNODE_LOG_RETENTION 10000 #define SYNC_VNODE_LOG_RETENTION (TSDB_SYNC_LOG_BUFFER_RETENTION + 1) #define SNAPSHOT_MAX_CLOCK_SKEW_MS 1000 * 10 #define SNAPSHOT_WAIT_MS 1000 * 30 diff --git a/include/util/taoserror.h b/include/util/taoserror.h index 29f36f3d0cd85d9d21803eb1d14f39c0d08f8d4e..75b71409a866d7f82c2d8c3521aeddba9830bf19 100644 --- a/include/util/taoserror.h +++ b/include/util/taoserror.h @@ -116,6 +116,7 @@ int32_t* taosGetErrno(); #define TSDB_CODE_NO_DISKSPACE TAOS_DEF_ERROR_CODE(0, 0x012B) #define TSDB_CODE_TIMEOUT_ERROR TAOS_DEF_ERROR_CODE(0, 0x012C) #define TSDB_CODE_MSG_ENCODE_ERROR TAOS_DEF_ERROR_CODE(0, 0x012D) +#define TSDB_CODE_NO_ENOUGH_DISKSPACE TAOS_DEF_ERROR_CODE(0, 0x012E) #define TSDB_CODE_APP_IS_STARTING TAOS_DEF_ERROR_CODE(0, 0x0130) // #define TSDB_CODE_APP_IS_STOPPING TAOS_DEF_ERROR_CODE(0, 0x0131) // @@ -239,6 +240,7 @@ int32_t* taosGetErrno(); #define TSDB_CODE_MND_TOO_MANY_USERS TAOS_DEF_ERROR_CODE(0, 0x0355) #define TSDB_CODE_MND_INVALID_ALTER_OPER TAOS_DEF_ERROR_CODE(0, 0x0356) #define TSDB_CODE_MND_AUTH_FAILURE TAOS_DEF_ERROR_CODE(0, 0x0357) +#define TSDB_CODE_MND_USER_NOT_AVAILABLE TAOS_DEF_ERROR_CODE(0, 0x0358) // mnode-stable-part1 #define TSDB_CODE_MND_STB_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0360) @@ -712,7 +714,7 @@ int32_t* taosGetErrno(); #define TSDB_CODE_UDF_INVALID_BUFSIZE TAOS_DEF_ERROR_CODE(0, 0x2909) #define TSDB_CODE_UDF_INVALID_OUTPUT_TYPE TAOS_DEF_ERROR_CODE(0, 0x290A) #define TSDB_CODE_UDF_SCRIPT_NOT_SUPPORTED TAOS_DEF_ERROR_CODE(0, 0x290B) -#define TSDB_CODE_UDF_FUNC_NOT_IMPLEMENTED TAOS_DEF_ERROR_CODE(0, 0x290C) +#define TSDB_CODE_UDF_FUNC_EXEC_FAILURE TAOS_DEF_ERROR_CODE(0, 0x290C) // sml #define TSDB_CODE_SML_INVALID_PROTOCOL_TYPE TAOS_DEF_ERROR_CODE(0, 0x3000) diff --git a/include/util/tdef.h b/include/util/tdef.h index f2da4096d3ed3457adc1bfa9ba733d8daf4e9dc9..eac783cb256f62b84b5d59bcd17a5d7efc40d68f 100644 --- a/include/util/tdef.h +++ b/include/util/tdef.h @@ -202,7 +202,7 @@ typedef enum ELogicConditionType { #define TSDB_FUNC_NAME_LEN 65 #define TSDB_FUNC_COMMENT_LEN 1024 * 1024 #define TSDB_FUNC_CODE_LEN 10 * 1024 * 1024 -#define TSDB_FUNC_BUF_SIZE 512 +#define TSDB_FUNC_BUF_SIZE 4096 * 64 #define TSDB_FUNC_TYPE_SCALAR 1 #define TSDB_FUNC_TYPE_AGGREGATE 2 #define TSDB_FUNC_SCRIPT_BIN_LIB 0 diff --git a/include/util/tjson.h b/include/util/tjson.h index 6922930c13625e0a5722bc07af1578feee42c7ff..af0b163986e41a10fef13e412dfd508a47364d9c 100644 --- a/include/util/tjson.h +++ b/include/util/tjson.h @@ -25,7 +25,7 @@ extern "C" { #define tjsonGetNumberValue(pJson, pName, val, code) \ do { \ - uint64_t _tmp = 0; \ + int64_t _tmp = 0; \ code = tjsonGetBigIntValue(pJson, pName, &_tmp); \ val = _tmp; \ } while (0) diff --git a/include/util/tutil.h b/include/util/tutil.h index e0801e529507bd3152037e646895f66c6eefa35c..c8f1b29e10878efcddbebe736fa8bd5d107d6060 100644 --- a/include/util/tutil.h +++ b/include/util/tutil.h @@ -29,7 +29,7 @@ extern "C" { int32_t strdequote(char *src); size_t strtrim(char *src); char *strnchr(const char *haystack, char needle, int32_t len, bool skipquote); -TdUcs4* wcsnchr(const TdUcs4* haystack, TdUcs4 needle, size_t len); +TdUcs4 *wcsnchr(const TdUcs4 *haystack, TdUcs4 needle, size_t len); char **strsplit(char *src, const char *delim, int32_t *num); char *strtolower(char *dst, const char *src); @@ -37,11 +37,11 @@ char *strntolower(char *dst, const char *src, int32_t n); char *strntolower_s(char *dst, const char *src, int32_t n); int64_t strnatoi(char *num, int32_t len); -size_t tstrncspn(const char *str, size_t ssize, const char *reject, size_t rsize); -size_t twcsncspn(const TdUcs4 *wcs, size_t size, const TdUcs4 *reject, size_t rsize); +size_t tstrncspn(const char *str, size_t ssize, const char *reject, size_t rsize); +size_t twcsncspn(const TdUcs4 *wcs, size_t size, const TdUcs4 *reject, size_t rsize); -char *strbetween(char *string, char *begin, char *end); -char *paGetToken(char *src, char **token, int32_t *tokenLen); +char *strbetween(char *string, char *begin, char *end); +char *paGetToken(char *src, char **token, int32_t *tokenLen); int32_t taosByteArrayToHexStr(char bytes[], int32_t len, char hexstr[]); int32_t taosHexStrToByteArray(char hexstr[], char bytes[]); @@ -92,12 +92,26 @@ static FORCE_INLINE int32_t taosGetTbHashVal(const char *tbname, int32_t tblen, } } +#define TSDB_CHECK(condition, CODE, LINO, LABEL, ERRNO) \ + if (!(condition)) { \ + (CODE) = (ERRNO); \ + (LINO) = __LINE__; \ + goto LABEL; \ + } + #define TSDB_CHECK_CODE(CODE, LINO, LABEL) \ - if (CODE) { \ - LINO = __LINE__; \ + if ((CODE)) { \ + (LINO) = __LINE__; \ goto LABEL; \ } +#define TSDB_CHECK_NULL(ptr, CODE, LINO, LABEL, ERRNO) \ + if ((ptr) == NULL) { \ + (CODE) = (ERRNO); \ + (LINO) = __LINE__; \ + goto LABEL; \ + } + #ifdef __cplusplus } #endif diff --git a/include/util/tversion.h b/include/util/tversion.h index c924752a01f52f01f2cb40dbc6e16770f23d1ea2..f5c42b2a224d24d2dc2a951ec981de9c878ef0df 100644 --- a/include/util/tversion.h +++ b/include/util/tversion.h @@ -13,8 +13,8 @@ * along with this program. If not, see . */ -#ifndef _TD_UTIL_VERSION_H_ -#define _TD_UTIL_VERSION_H_ +#ifndef _TD_UTIL_TVERSION_H_ +#define _TD_UTIL_TVERSION_H_ #include "os.h" @@ -25,9 +25,11 @@ extern "C" { int32_t taosVersionStrToInt(const char *vstr, int32_t *vint); int32_t taosVersionIntToStr(int32_t vint, char *vstr, int32_t len); int32_t taosCheckVersionCompatible(int32_t clientVer, int32_t serverVer, int32_t comparedSegments); +int32_t taosCheckVersionCompatibleFromStr(const char *pClientVersion, const char *pServerVersion, + int32_t comparedSegments); #ifdef __cplusplus } #endif -#endif /*_TD_UTIL_VERSION_H_*/ +#endif /*_TD_UTIL_TVERSION_H_*/ diff --git a/packaging/tools/install.sh b/packaging/tools/install.sh index 5aeff0e2fac3cde9e381a33719f5ab25722e16f5..2495e177e1b0a8a20ecf6527862cc310c4ef34df 100755 --- a/packaging/tools/install.sh +++ b/packaging/tools/install.sh @@ -34,6 +34,7 @@ benchmarkName="taosBenchmark" dumpName="taosdump" demoName="taosdemo" xname="taosx" +explorerName="${clientName}-explorer" clientName2="taos" serverName2="taosd" @@ -214,6 +215,7 @@ function install_bin() { ${csudo}rm -f ${bin_link_dir}/${benchmarkName} || : ${csudo}rm -f ${bin_link_dir}/${dumpName} || : ${csudo}rm -f ${bin_link_dir}/${xname} || : + ${csudo}rm -f ${bin_link_dir}/${explorerName} || : ${csudo}rm -f ${bin_link_dir}/set_core || : ${csudo}rm -f ${bin_link_dir}/TDinsight.sh || : @@ -228,6 +230,7 @@ function install_bin() { [ -x ${install_main_dir}/bin/${benchmarkName} ] && ${csudo}ln -sf ${install_main_dir}/bin/${benchmarkName} ${bin_link_dir}/${benchmarkName} || : [ -x ${install_main_dir}/bin/${dumpName} ] && ${csudo}ln -s ${install_main_dir}/bin/${dumpName} ${bin_link_dir}/${dumpName} || : [ -x ${install_main_dir}/bin/${xname} ] && ${csudo}ln -s ${install_main_dir}/bin/${xname} ${bin_link_dir}/${xname} || : + [ -x ${install_main_dir}/bin/${explorerName} ] && ${csudo}ln -s ${install_main_dir}/bin/${explorerName} ${bin_link_dir}/${explorerName} || : [ -x ${install_main_dir}/bin/TDinsight.sh ] && ${csudo}ln -s ${install_main_dir}/bin/TDinsight.sh ${bin_link_dir}/TDinsight.sh || : [ -x ${install_main_dir}/bin/remove.sh ] && ${csudo}ln -s ${install_main_dir}/bin/remove.sh ${bin_link_dir}/${uninstallScript} || : [ -x ${install_main_dir}/bin/set_core.sh ] && ${csudo}ln -s ${install_main_dir}/bin/set_core.sh ${bin_link_dir}/set_core || : diff --git a/packaging/tools/make_install.bat b/packaging/tools/make_install.bat index f5ed1cdf666c2442f10b9d45320f4a93a6cdfa6f..41113c9ae45ca73c9623bffff9b921fdf4525f3f 100644 --- a/packaging/tools/make_install.bat +++ b/packaging/tools/make_install.bat @@ -70,6 +70,9 @@ if %Enterprise% == TRUE ( if exist %binary_dir%\\build\\bin\\taosx.exe ( copy %binary_dir%\\build\\bin\\taosx.exe %target_dir% > nul ) + if exist %binary_dir%\\build\\bin\\taos-explorer.exe ( + copy %binary_dir%\\build\\bin\\taos-explorer.exe %target_dir% > nul + ) if exist %binary_dir%\\build\\bin\\tmq_sim.exe ( copy %binary_dir%\\build\\bin\\tmq_sim.exe %target_dir% > nul ) @@ -91,6 +94,9 @@ if %Enterprise% == TRUE ( if exist %binary_dir%\\build\\bin\\create_table.exe ( copy %binary_dir%\\build\\bin\\create_table.exe %target_dir% > nul ) + if exist %binary_dir%\\build\\bin\\*explorer.exe ( + copy %binary_dir%\\build\\bin\\*explorer.exe %target_dir% > nul + ) ) copy %binary_dir%\\build\\bin\\taosd.exe %target_dir% > nul @@ -118,9 +124,18 @@ call :stop_delete call :check_svc taosd call :check_svc taosadapter -copy /y C:\\TDengine\\driver\\taos.dll C:\\Windows\\System32 > nul -if exist C:\\TDengine\\driver\\taosws.dll ( - copy /y C:\\TDengine\\driver\\taosws.dll C:\\Windows\\System32 > nul +if exist c:\\windows\\sysnative ( + echo x86 + copy /y C:\\TDengine\\driver\\taos.dll %windir%\\sysnative > nul + if exist C:\\TDengine\\driver\\taosws.dll ( + copy /y C:\\TDengine\\driver\\taosws.dll %windir%\\sysnative > nul + ) +) else ( + echo x64 + copy /y C:\\TDengine\\driver\\taos.dll C:\\Windows\\System32 > nul + if exist C:\\TDengine\\driver\\taosws.dll ( + copy /y C:\\TDengine\\driver\\taosws.dll C:\\Windows\\System32 > nul + ) ) rem // create services diff --git a/packaging/tools/make_install.sh b/packaging/tools/make_install.sh index 5725560bd61266bf05c2e162652b271382e412c0..87c72c6a7c9985cffa13a112fbfbb5261d228632 100755 --- a/packaging/tools/make_install.sh +++ b/packaging/tools/make_install.sh @@ -200,6 +200,7 @@ function install_bin() { [ -f ${binary_dir}/build/bin/taosadapter ] && ${csudo}cp -r ${binary_dir}/build/bin/taosadapter ${install_main_dir}/bin || : [ -f ${binary_dir}/build/bin/udfd ] && ${csudo}cp -r ${binary_dir}/build/bin/udfd ${install_main_dir}/bin || : [ -f ${binary_dir}/build/bin/taosx ] && ${csudo}cp -r ${binary_dir}/build/bin/taosx ${install_main_dir}/bin || : + [ -f ${binary_dir}/build/bin/*explorer ] && ${csudo}cp -r ${binary_dir}/build/bin/*explorer ${install_main_dir}/bin || : ${csudo}cp -r ${binary_dir}/build/bin/${serverName} ${install_main_dir}/bin || : ${csudo}cp -r ${script_dir}/remove.sh ${install_main_dir}/bin || : @@ -212,6 +213,7 @@ function install_bin() { [ -x ${install_main_dir}/bin/taosdump ] && ${csudo}ln -s ${install_main_dir}/bin/taosdump ${bin_link_dir}/taosdump > /dev/null 2>&1 || : [ -f ${install_main_dir}/bin/taosBenchmark ] && ${csudo}ln -sf ${install_main_dir}/bin/taosBenchmark ${install_main_dir}/bin/taosdemo > /dev/null 2>&1 || : [ -x ${install_main_dir}/bin/taosx ] && ${csudo}ln -s ${install_main_dir}/bin/taosx ${bin_link_dir}/taosx > /dev/null 2>&1 || : + [ -x ${install_main_dir}/bin/*explorer ] && ${csudo}ln -s ${install_main_dir}/bin/*explorer ${bin_link_dir}/*explorer > /dev/null 2>&1 || : [ -x ${install_main_dir}/bin/remove.sh ] && ${csudo}ln -s ${install_main_dir}/bin/remove.sh ${bin_link_dir}/${uninstallScript} > /dev/null 2>&1 || : fi } diff --git a/packaging/tools/makepkg.sh b/packaging/tools/makepkg.sh index 0a34d81b7fa0000ad8924c3968ae897a6f7f43f3..7ad3cf7b0aecf14bb984e98304bb78513bfb077b 100755 --- a/packaging/tools/makepkg.sh +++ b/packaging/tools/makepkg.sh @@ -89,11 +89,13 @@ else ${build_dir}/bin/tdengine-datasource.zip \ ${build_dir}/bin/tdengine-datasource.zip.md5sum" [ -f ${build_dir}/bin/taosx ] && taosx_bin="${build_dir}/bin/taosx" + explorer_bin_files=$(find ${build_dir}/bin/ -name '*-explorer') bin_files="${build_dir}/bin/${serverName} \ ${build_dir}/bin/${clientName} \ ${taostools_bin_files} \ ${taosx_bin} \ + ${explorer_bin_files} \ ${build_dir}/bin/taosadapter \ ${build_dir}/bin/udfd \ ${script_dir}/remove.sh \ diff --git a/packaging/tools/post.sh b/packaging/tools/post.sh index 78eb7f7587a3048071a2d5b14e40bc45429115d1..b2fc488a19bbf2c9425c4a48596326b2c7070dc2 100755 --- a/packaging/tools/post.sh +++ b/packaging/tools/post.sh @@ -185,6 +185,7 @@ function install_bin() { ${csudo}rm -f ${bin_link_dir}/taosdump || : ${csudo}rm -f ${bin_link_dir}/rmtaos || : ${csudo}rm -f ${bin_link_dir}/set_core || : + ${csudo}rm -f ${bin_link_dir}/*explorer || : ${csudo}chmod 0555 ${bin_dir}/* @@ -220,6 +221,9 @@ function install_bin() { if [ -x ${bin_dir}/taoskeeper ]; then ${csudo}ln -sf ${bin_dir}/taoskeeper ${bin_link_dir}/taoskeeper 2>>${install_log_path} || return 1 fi + if [ -x ${bin_dir}/*explorer ]; then + ${csudo}ln -s ${bin_dir}/*explorer ${bin_link_dir}/*explorer 2>>${install_log_path} || return 1 + fi log_print "install bin success" } diff --git a/packaging/tools/remove.sh b/packaging/tools/remove.sh index 9c50c4582db01fab94bb82f1556c3a94df741b1d..2479e48670bacb014c9209c8db11c8b0e09f5889 100755 --- a/packaging/tools/remove.sh +++ b/packaging/tools/remove.sh @@ -119,6 +119,7 @@ function clean_bin() { ${csudo}rm -f ${bin_link_dir}/TDinsight.sh || : ${csudo}rm -f ${bin_link_dir}/taoskeeper || : ${csudo}rm -f ${bin_link_dir}/taosx || : + ${csudo}rm -f ${bin_link_dir}/taos-explorer || : if [ "$verMode" == "cluster" ] && [ "$clientName" != "$clientName2" ]; then ${csudo}rm -f ${bin_link_dir}/${clientName2} || : diff --git a/packaging/tools/tdengine.iss b/packaging/tools/tdengine.iss index 02f412f5d46fcc1ef2627c4dd6378775dd755995..8676fa2c51e891edc4077dfd2b6f9e5888af5f05 100644 --- a/packaging/tools/tdengine.iss +++ b/packaging/tools/tdengine.iss @@ -21,7 +21,7 @@ [Setup] VersionInfoVersion={#MyAppVersion} AppId={{A0F7A93C-79C4-485D-B2B8-F0D03DF42FAB} -AppName={#MyAppName} +AppName={#CusName} AppVersion={#MyAppVersion} ;AppVerName={#MyAppName} {#MyAppVersion} AppPublisher={#MyAppPublisher} @@ -64,8 +64,8 @@ Source: {#MyAppSourceDir}\taosdump.exe; DestDir: "{app}"; DestName: "{#CusPrompt [run] -Filename: {sys}\sc.exe; Parameters: "create taosd start= DEMAND binPath= ""C:\\{#CusName}\\taosd.exe --win_service""" ; Flags: runhidden -Filename: {sys}\sc.exe; Parameters: "create taosadapter start= DEMAND binPath= ""C:\\{#CusName}\\taosadapter.exe""" ; Flags: runhidden +Filename: {sys}\sc.exe; Parameters: "create taosd start= DEMAND binPath= ""C:\\TDengine\\taosd.exe --win_service""" ; Flags: runhidden +Filename: {sys}\sc.exe; Parameters: "create taosadapter start= DEMAND binPath= ""C:\\TDengine\\taosadapter.exe""" ; Flags: runhidden [UninstallRun] RunOnceId: "stoptaosd"; Filename: {sys}\sc.exe; Parameters: "stop taosd" ; Flags: runhidden diff --git a/packaging/tools/windows_before_install.txt b/packaging/tools/windows_before_install.txt index ef783bf10badedc733e87946a323d499b60fc5ac..91cb35d77e788d0705624da14d9e36c75403be3e 100644 --- a/packaging/tools/windows_before_install.txt +++ b/packaging/tools/windows_before_install.txt @@ -1,4 +1,4 @@ -TDengine is a high-efficient, scalable, high-available distributed time-series database, which makes a lot of optimizations on inserting and querying data, which is far more efficient than normal regular databases. So TDengine can meet the high requirements of IOT and other areas on storing and querying a large amount of data. +TDengine is an open-source, cloud-native time-series database optimized for Internet of Things (IoT), Connected Cars, and Industrial IoT. With its built-in caching, stream processing, and data subscription capabilities, TDengine offers a simplified solution for time-series data processing. TDengine will be installed under C:\TDengine, users can modify configuration file C:\TDengine\cfg\taos.cfg, set the log file path or other parameters. To start/stop TDengine with administrator privileges: sc start/stop taosd diff --git a/source/client/inc/clientInt.h b/source/client/inc/clientInt.h index 7cc7a1717a1e975e70552348027dbfb059756618..b10daa9c210ed1a39198a3cf1d0f59ab77be6bee 100644 --- a/source/client/inc/clientInt.h +++ b/source/client/inc/clientInt.h @@ -66,7 +66,8 @@ enum { typedef struct SAppInstInfo SAppInstInfo; typedef struct { - char* key; + char* key; + int32_t idx; // statistics int32_t reportCnt; int32_t connKeyCnt; diff --git a/source/client/inc/clientSml.h b/source/client/inc/clientSml.h index 3dcba673bfa843823561e565ddbe58586d82b774..d8d41d8be6e75c32c7c5da06dbcfca5c508a8b62 100644 --- a/source/client/inc/clientSml.h +++ b/source/client/inc/clientSml.h @@ -190,7 +190,7 @@ typedef struct { // SArray *preLineTagKV; SArray *maxTagKVs; - SArray *preLineColKV; + SArray *masColKVs; SSmlLineInfo preLine; STableMeta *currSTableMeta; diff --git a/source/client/src/clientEnv.c b/source/client/src/clientEnv.c index 79c5baf43d8971d2e4384ddec6ce3c92a14c25bc..e3e20ee85d4de996b664ccbaeed7514a992c9937 100644 --- a/source/client/src/clientEnv.c +++ b/source/client/src/clientEnv.c @@ -159,9 +159,9 @@ void *openTransporter(const char *user, const char *auth, int32_t numOfThread) { rpcInit.retryMaxInterval = tsRedirectMaxPeriod; rpcInit.retryMaxTimouet = tsMaxRetryWaitTime; - int32_t connLimitNum = tsNumOfRpcSessions / (tsNumOfRpcThreads * 5); + int32_t connLimitNum = tsNumOfRpcSessions / (tsNumOfRpcThreads * 3); connLimitNum = TMAX(connLimitNum, 10); - connLimitNum = TMIN(connLimitNum, 500); + connLimitNum = TMIN(connLimitNum, 1000); rpcInit.connLimitNum = connLimitNum; rpcInit.timeToGetConn = tsTimeToGetAvailableConn; diff --git a/source/client/src/clientHb.c b/source/client/src/clientHb.c index b5838386dbf94a3868c286cecc895df8162c33fd..c9c2e7a5f82453035100f2e4a67d806c70a7ff57 100644 --- a/source/client/src/clientHb.c +++ b/source/client/src/clientHb.c @@ -303,8 +303,12 @@ static int32_t hbQueryHbRspHandle(SAppHbMgr *pAppHbMgr, SClientHbRsp *pRsp) { } static int32_t hbAsyncCallBack(void *param, SDataBuf *pMsg, int32_t code) { + if (0 == atomic_load_8(&clientHbMgr.inited)) { + goto _return; + } + static int32_t emptyRspNum = 0; - char *key = (char *)param; + int32_t idx = *(int32_t *)param; SClientHbBatchRsp pRsp = {0}; if (TSDB_CODE_SUCCESS == code) { tDeserializeSClientHbBatchRsp(pMsg->pData, pMsg->len, &pRsp); @@ -319,22 +323,24 @@ static int32_t hbAsyncCallBack(void *param, SDataBuf *pMsg, int32_t code) { int32_t rspNum = taosArrayGetSize(pRsp.rsps); - taosThreadMutexLock(&appInfo.mutex); + taosThreadMutexLock(&clientHbMgr.lock); - SAppInstInfo **pInst = taosHashGet(appInfo.pInstMap, key, strlen(key)); - if (pInst == NULL || NULL == *pInst) { - taosThreadMutexUnlock(&appInfo.mutex); - tscError("cluster not exist, key:%s", key); + SAppHbMgr *pAppHbMgr = taosArrayGetP(clientHbMgr.appHbMgrs, idx); + if (pAppHbMgr == NULL) { + taosThreadMutexUnlock(&clientHbMgr.lock); + tscError("appHbMgr not exist, idx:%d", idx); taosMemoryFree(pMsg->pData); taosMemoryFree(pMsg->pEpSet); tFreeClientHbBatchRsp(&pRsp); return -1; } + SAppInstInfo *pInst = pAppHbMgr->pAppInstInfo; + if (code != 0) { - (*pInst)->onlineDnodes = ((*pInst)->totalDnodes ? 0 : -1); - tscDebug("hb rsp error %s, update server status %d/%d", tstrerror(code), (*pInst)->onlineDnodes, - (*pInst)->totalDnodes); + pInst->onlineDnodes = pInst->totalDnodes ? 0 : -1; + tscDebug("hb rsp error %s, update server status %d/%d", tstrerror(code), pInst->onlineDnodes, + pInst->totalDnodes); } if (rspNum) { @@ -346,15 +352,17 @@ static int32_t hbAsyncCallBack(void *param, SDataBuf *pMsg, int32_t code) { for (int32_t i = 0; i < rspNum; ++i) { SClientHbRsp *rsp = taosArrayGet(pRsp.rsps, i); - code = (*clientHbMgr.rspHandle[rsp->connKey.connType])((*pInst)->pAppHbMgr, rsp); + code = (*clientHbMgr.rspHandle[rsp->connKey.connType])(pAppHbMgr, rsp); if (code) { break; } } - taosThreadMutexUnlock(&appInfo.mutex); + taosThreadMutexUnlock(&clientHbMgr.lock); tFreeClientHbBatchRsp(&pRsp); + +_return: taosMemoryFree(pMsg->pData); taosMemoryFree(pMsg->pEpSet); return code; @@ -788,7 +796,8 @@ static void *hbThreadFunc(void *param) { pInfo->msgInfo.pData = buf; pInfo->msgInfo.len = tlen; pInfo->msgType = TDMT_MND_HEARTBEAT; - pInfo->param = taosStrdup(pAppHbMgr->key); + pInfo->param = taosMemoryMalloc(sizeof(int32_t)); + *(int32_t *)pInfo->param = i; pInfo->paramFreeFp = taosMemoryFree; pInfo->requestId = generateRequestId(); pInfo->requestObjRefId = 0; @@ -874,6 +883,7 @@ SAppHbMgr *appHbMgrInit(SAppInstInfo *pAppInstInfo, char *key) { taosThreadMutexLock(&clientHbMgr.lock); taosArrayPush(clientHbMgr.appHbMgrs, &pAppHbMgr); + pAppHbMgr->idx = taosArrayGetSize(clientHbMgr.appHbMgrs) - 1; taosThreadMutexUnlock(&clientHbMgr.lock); return pAppHbMgr; diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index d19f9dce798b8721e1d576db6ea59d97244e8f22..d5247d4b8aaeeddda1768ecc02b565e26da11446 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -1307,6 +1307,7 @@ static SMsgSendInfo* buildConnectMsg(SRequestObj* pRequest) { tstrncpy(connectReq.app, appInfo.appName, sizeof(connectReq.app)); tstrncpy(connectReq.user, pObj->user, sizeof(connectReq.user)); tstrncpy(connectReq.passwd, pObj->pass, sizeof(connectReq.passwd)); + tstrncpy(connectReq.sVer, version, sizeof(connectReq.sVer)); int32_t contLen = tSerializeSConnectReq(NULL, 0, &connectReq); void* pReq = taosMemoryMalloc(contLen); diff --git a/source/client/src/clientMain.c b/source/client/src/clientMain.c index 025d38e15dcfb50604e11b8260d1b956e0976f26..63db9a679cdd0e312596b891a4a399db133aa00d 100644 --- a/source/client/src/clientMain.c +++ b/source/client/src/clientMain.c @@ -271,6 +271,8 @@ TAOS_ROW taos_fetch_row(TAOS_RES *res) { SReqResultInfo *pResultInfo; if (msg->resIter == -1) { pResultInfo = tmqGetNextResInfo(res, true); + tscDebug("consumer:0x%" PRIx64 ", vgId:%d, numOfRows:%" PRId64 ", total rows:%" PRId64, msg->rsp.head.consumerId, + msg->vgId, pResultInfo->numOfRows, pResultInfo->totalRows); } else { pResultInfo = tmqGetCurResInfo(res); } @@ -281,7 +283,13 @@ TAOS_ROW taos_fetch_row(TAOS_RES *res) { return pResultInfo->row; } else { pResultInfo = tmqGetNextResInfo(res, true); - if (pResultInfo == NULL) return NULL; + if (pResultInfo == NULL) { + return NULL; + } + + tscDebug("consumer:0x%" PRIx64 " vgId:%d, numOfRows:%" PRId64 ", total rows:%" PRId64, msg->rsp.head.consumerId, + msg->vgId, pResultInfo->numOfRows, pResultInfo->totalRows); + doSetOneRowPtr(pResultInfo); pResultInfo->current += 1; return pResultInfo->row; diff --git a/source/client/src/clientMsgHandler.c b/source/client/src/clientMsgHandler.c index 375925d5771eb8066db5ba9fe287995a2d808fe3..21590022b13663f20a28f35565c0f69cdccba9f3 100644 --- a/source/client/src/clientMsgHandler.c +++ b/source/client/src/clientMsgHandler.c @@ -18,10 +18,12 @@ #include "clientLog.h" #include "os.h" #include "query.h" +#include "systable.h" +#include "tdatablock.h" #include "tdef.h" +#include "tglobal.h" #include "tname.h" -#include "tdatablock.h" -#include "systable.h" +#include "tversion.h" static void setErrno(SRequestObj* pRequest, int32_t code) { pRequest->code = code; @@ -47,11 +49,11 @@ int32_t genericRspCallback(void* param, SDataBuf* pMsg, int32_t code) { } int32_t processConnectRsp(void* param, SDataBuf* pMsg, int32_t code) { - SRequestObj *pRequest = acquireRequest(*(int64_t*)param); + SRequestObj* pRequest = acquireRequest(*(int64_t*)param); if (NULL == pRequest) { goto End; } - + if (code != TSDB_CODE_SUCCESS) { setErrno(pRequest, code); tsem_post(&pRequest->body.rspSem); @@ -65,7 +67,7 @@ int32_t processConnectRsp(void* param, SDataBuf* pMsg, int32_t code) { tsem_post(&pRequest->body.rspSem); goto End; } - + SConnectRsp connectRsp = {0}; if (tDeserializeSConnectRsp(pMsg->pData, pMsg->len, &connectRsp) != 0) { code = TSDB_CODE_TSC_INVALID_VERSION; @@ -74,6 +76,12 @@ int32_t processConnectRsp(void* param, SDataBuf* pMsg, int32_t code) { goto End; } + if ((code = taosCheckVersionCompatibleFromStr(version, connectRsp.sVer, 2)) != 0) { + setErrno(pRequest, code); + tsem_post(&pRequest->body.rspSem); + goto End; + } + int32_t now = taosGetTimestampSec(); int32_t delta = abs(now - connectRsp.svrTimestamp); if (delta > timestampDeltaLimit) { @@ -127,14 +135,14 @@ int32_t processConnectRsp(void* param, SDataBuf* pMsg, int32_t code) { tscDebug("0x%" PRIx64 " clusterId:%" PRId64 ", totalConn:%" PRId64, pRequest->requestId, connectRsp.clusterId, pTscObj->pAppInfo->numOfConns); - + tsem_post(&pRequest->body.rspSem); End: if (pRequest) { releaseRequest(pRequest->self); } - + taosMemoryFree(param); taosMemoryFree(pMsg->pEpSet); taosMemoryFree(pMsg->pData); @@ -166,18 +174,18 @@ int32_t processCreateDbRsp(void* param, SDataBuf* pMsg, int32_t code) { struct SCatalog* pCatalog = NULL; int32_t code = catalogGetHandle(pRequest->pTscObj->pAppInfo->clusterId, &pCatalog); if (TSDB_CODE_SUCCESS == code) { - STscObj* pTscObj = pRequest->pTscObj; + STscObj* pTscObj = pRequest->pTscObj; SRequestConnInfo conn = {.pTrans = pTscObj->pAppInfo->pTransporter, .requestId = pRequest->requestId, .requestObjRefId = pRequest->self, .mgmtEps = getEpSet_s(&pTscObj->pAppInfo->mgmtEp)}; - char dbFName[TSDB_DB_FNAME_LEN]; + char dbFName[TSDB_DB_FNAME_LEN]; snprintf(dbFName, sizeof(dbFName) - 1, "%d.%s", pTscObj->acctId, TSDB_INFORMATION_SCHEMA_DB); catalogRefreshDBVgInfo(pCatalog, &conn, dbFName); snprintf(dbFName, sizeof(dbFName) - 1, "%d.%s", pTscObj->acctId, TSDB_PERFORMANCE_SCHEMA_DB); catalogRefreshDBVgInfo(pCatalog, &conn, dbFName); - } + } } if (pRequest->body.queryFp) { @@ -197,7 +205,7 @@ int32_t processUseDbRsp(void* param, SDataBuf* pMsg, int32_t code) { tDeserializeSUseDbRsp(pMsg->pData, pMsg->len, &usedbRsp); struct SCatalog* pCatalog = NULL; - if (usedbRsp.vgVersion >= 0) { // cached in local + if (usedbRsp.vgVersion >= 0) { // cached in local uint64_t clusterId = pRequest->pTscObj->pAppInfo->clusterId; int32_t code1 = catalogGetHandle(clusterId, &pCatalog); if (code1 != TSDB_CODE_SUCCESS) { @@ -289,7 +297,7 @@ int32_t processUseDbRsp(void* param, SDataBuf* pMsg, int32_t code) { } int32_t processCreateSTableRsp(void* param, SDataBuf* pMsg, int32_t code) { - if(pMsg == NULL || param == NULL){ + if (pMsg == NULL || param == NULL) { return TSDB_CODE_TSC_INVALID_INPUT; } SRequestObj* pRequest = param; @@ -344,13 +352,13 @@ int32_t processDropDbRsp(void* param, SDataBuf* pMsg, int32_t code) { int32_t code = catalogGetHandle(pRequest->pTscObj->pAppInfo->clusterId, &pCatalog); if (TSDB_CODE_SUCCESS == code) { catalogRemoveDB(pCatalog, dropdbRsp.db, dropdbRsp.uid); - STscObj* pTscObj = pRequest->pTscObj; + STscObj* pTscObj = pRequest->pTscObj; SRequestConnInfo conn = {.pTrans = pTscObj->pAppInfo->pTransporter, .requestId = pRequest->requestId, .requestObjRefId = pRequest->self, .mgmtEps = getEpSet_s(&pTscObj->pAppInfo->mgmtEp)}; - char dbFName[TSDB_DB_FNAME_LEN]; + char dbFName[TSDB_DB_FNAME_LEN]; snprintf(dbFName, sizeof(dbFName) - 1, "%d.%s", pTscObj->acctId, TSDB_INFORMATION_SCHEMA_DB); catalogRefreshDBVgInfo(pCatalog, &conn, dbFName); snprintf(dbFName, sizeof(dbFName) - 1, "%d.%s", pTscObj->acctId, TSDB_PERFORMANCE_SCHEMA_DB); @@ -474,8 +482,9 @@ static int32_t buildShowVariablesRsp(SArray* pVars, SRetrieveTableRsp** pRsp) { int32_t len = blockEncode(pBlock, (*pRsp)->data, SHOW_VARIABLES_RESULT_COLS); blockDataDestroy(pBlock); - if(len != rspSize - sizeof(SRetrieveTableRsp)){ - uError("buildShowVariablesRsp error, len:%d != rspSize - sizeof(SRetrieveTableRsp):%" PRIu64, len, (uint64_t) (rspSize - sizeof(SRetrieveTableRsp))); + if (len != rspSize - sizeof(SRetrieveTableRsp)) { + uError("buildShowVariablesRsp error, len:%d != rspSize - sizeof(SRetrieveTableRsp):%" PRIu64, len, + (uint64_t)(rspSize - sizeof(SRetrieveTableRsp))); return TSDB_CODE_TSC_INVALID_INPUT; } diff --git a/source/client/src/clientSml.c b/source/client/src/clientSml.c index 6e60f4ba21a78baf947d5a9ccd023bd2a25797c6..885a0019cb64c2f7128f429579813a27f8421de9 100644 --- a/source/client/src/clientSml.c +++ b/source/client/src/clientSml.c @@ -1073,8 +1073,6 @@ void smlDestroyInfo(SSmlHandle *info) { taosArrayDestroy(info->valueJsonArray); taosArrayDestroy(info->preLineTagKV); - taosArrayDestroy(info->maxTagKVs); - taosArrayDestroy(info->preLineColKV); if (!info->dataFormat) { for (int i = 0; i < info->lineNum; i++) { @@ -1117,8 +1115,6 @@ SSmlHandle *smlBuildSmlInfo(TAOS *taos) { info->tagJsonArray = taosArrayInit(8, POINTER_BYTES); info->valueJsonArray = taosArrayInit(8, POINTER_BYTES); info->preLineTagKV = taosArrayInit(8, sizeof(SSmlKv)); - info->maxTagKVs = taosArrayInit(8, sizeof(SSmlKv)); - info->preLineColKV = taosArrayInit(8, sizeof(SSmlKv)); if (NULL == info->pVgHash || NULL == info->childTables || NULL == info->superTables) { uError("create SSmlHandle failed"); @@ -1141,6 +1137,7 @@ static int32_t smlPushCols(SArray *colsArray, SArray *cols) { for (size_t i = 0; i < taosArrayGetSize(cols); i++) { SSmlKv *kv = (SSmlKv *)taosArrayGet(cols, i); taosHashPut(kvHash, kv->key, kv->keyLen, &kv, POINTER_BYTES); + if(terrno == TSDB_CODE_DUP_KEY){return terrno;} } taosArrayPush(colsArray, &kvHash); @@ -1207,6 +1204,7 @@ static int32_t smlParseLineBottom(SSmlHandle *info) { SSmlSTableMeta *meta = smlBuildSTableMeta(info->dataFormat); smlInsertMeta(meta->tagHash, meta->tags, tinfo->tags); + if(terrno == TSDB_CODE_DUP_KEY){return terrno;} smlInsertMeta(meta->colHash, meta->cols, elements->colArray); taosHashPut(info->superTables, elements->measure, elements->measureLen, &meta, POINTER_BYTES); } @@ -1218,6 +1216,12 @@ static int32_t smlParseLineBottom(SSmlHandle *info) { static int32_t smlInsertData(SSmlHandle *info) { int32_t code = TSDB_CODE_SUCCESS; + if(info->pRequest->dbList == NULL){ + info->pRequest->dbList = taosArrayInit(1, TSDB_DB_FNAME_LEN); + } + void* data = taosArrayReserve(info->pRequest->dbList, 1); + memcpy(data, info->pRequest->pDb, TSDB_DB_FNAME_LEN > strlen(info->pRequest->pDb) ? strlen(info->pRequest->pDb) : TSDB_DB_FNAME_LEN); + SSmlTableInfo **oneTable = (SSmlTableInfo **)taosHashIterate(info->childTables, NULL); while (oneTable) { SSmlTableInfo *tableData = *oneTable; @@ -1226,6 +1230,11 @@ static int32_t smlInsertData(SSmlHandle *info) { tstrncpy(pName.dbname, info->pRequest->pDb, sizeof(pName.dbname)); memcpy(pName.tname, tableData->childTableName, strlen(tableData->childTableName)); + if(info->pRequest->tableList == NULL){ + info->pRequest->tableList = taosArrayInit(1, sizeof(SName)); + } + taosArrayPush(info->pRequest->tableList, &pName); + SRequestConnInfo conn = {0}; conn.pTrans = info->taos->pAppInfo->pTransporter; conn.requestId = info->pRequest->requestId; @@ -1427,6 +1436,7 @@ static int smlProcess(SSmlHandle *info, char *lines[], char *rawLine, char *rawL do { code = smlModifyDBSchemas(info); if (code == 0) break; + taosMsleep(200); } while (retryNum++ < taosHashGetSize(info->superTables) * MAX_RETRY_TIMES); if (code != 0) { @@ -1451,62 +1461,75 @@ TAOS_RES *taos_schemaless_insert_inner(TAOS *taos, char *lines[], char *rawLine, terrno = TSDB_CODE_TSC_DISCONNECTED; return NULL; } + SRequestObj *request = NULL; + SSmlHandle *info = NULL; + while(1){ + request = (SRequestObj *)createRequest(*(int64_t *)taos, TSDB_SQL_INSERT, reqid); + if (request == NULL) { + uError("SML:taos_schemaless_insert error request is null"); + return NULL; + } - SRequestObj *request = (SRequestObj *)createRequest(*(int64_t *)taos, TSDB_SQL_INSERT, reqid); - if (request == NULL) { - uError("SML:taos_schemaless_insert error request is null"); - return NULL; - } + info = smlBuildSmlInfo(taos); + if (info == NULL) { + request->code = TSDB_CODE_OUT_OF_MEMORY; + uError("SML:taos_schemaless_insert error SSmlHandle is null"); + return (TAOS_RES *)request; + } + info->pRequest = request; + info->isRawLine = rawLine != NULL; + info->ttl = ttl; + info->precision = precision; + info->protocol = (TSDB_SML_PROTOCOL_TYPE)protocol; + info->msgBuf.buf = info->pRequest->msgBuf; + info->msgBuf.len = ERROR_MSG_BUF_DEFAULT_SIZE; + info->lineNum = numLines; + + SSmlMsgBuf msg = {ERROR_MSG_BUF_DEFAULT_SIZE, request->msgBuf}; + if (request->pDb == NULL) { + request->code = TSDB_CODE_PAR_DB_NOT_SPECIFIED; + smlBuildInvalidDataMsg(&msg, "Database not specified", NULL); + goto end; + } - SSmlHandle *info = smlBuildSmlInfo(taos); - if (info == NULL) { - request->code = TSDB_CODE_OUT_OF_MEMORY; - uError("SML:taos_schemaless_insert error SSmlHandle is null"); - return (TAOS_RES *)request; - } - info->pRequest = request; - info->isRawLine = rawLine != NULL; - info->ttl = ttl; - info->precision = precision; - info->protocol = (TSDB_SML_PROTOCOL_TYPE)protocol; - info->msgBuf.buf = info->pRequest->msgBuf; - info->msgBuf.len = ERROR_MSG_BUF_DEFAULT_SIZE; - info->lineNum = numLines; - - SSmlMsgBuf msg = {ERROR_MSG_BUF_DEFAULT_SIZE, request->msgBuf}; - if (request->pDb == NULL) { - request->code = TSDB_CODE_PAR_DB_NOT_SPECIFIED; - smlBuildInvalidDataMsg(&msg, "Database not specified", NULL); - goto end; - } + if (protocol < TSDB_SML_LINE_PROTOCOL || protocol > TSDB_SML_JSON_PROTOCOL) { + request->code = TSDB_CODE_SML_INVALID_PROTOCOL_TYPE; + smlBuildInvalidDataMsg(&msg, "protocol invalidate", NULL); + goto end; + } - if (protocol < TSDB_SML_LINE_PROTOCOL || protocol > TSDB_SML_JSON_PROTOCOL) { - request->code = TSDB_CODE_SML_INVALID_PROTOCOL_TYPE; - smlBuildInvalidDataMsg(&msg, "protocol invalidate", NULL); - goto end; - } + if (protocol == TSDB_SML_LINE_PROTOCOL && + (precision < TSDB_SML_TIMESTAMP_NOT_CONFIGURED || precision > TSDB_SML_TIMESTAMP_NANO_SECONDS)) { + request->code = TSDB_CODE_SML_INVALID_PRECISION_TYPE; + smlBuildInvalidDataMsg(&msg, "precision invalidate for line protocol", NULL); + goto end; + } - if (protocol == TSDB_SML_LINE_PROTOCOL && - (precision < TSDB_SML_TIMESTAMP_NOT_CONFIGURED || precision > TSDB_SML_TIMESTAMP_NANO_SECONDS)) { - request->code = TSDB_CODE_SML_INVALID_PRECISION_TYPE; - smlBuildInvalidDataMsg(&msg, "precision invalidate for line protocol", NULL); - goto end; - } + if (protocol == TSDB_SML_JSON_PROTOCOL) { + numLines = 1; + } else if (numLines <= 0) { + request->code = TSDB_CODE_SML_INVALID_DATA; + smlBuildInvalidDataMsg(&msg, "line num is invalid", NULL); + goto end; + } - if (protocol == TSDB_SML_JSON_PROTOCOL) { - numLines = 1; - } else if (numLines <= 0) { - request->code = TSDB_CODE_SML_INVALID_DATA; - smlBuildInvalidDataMsg(&msg, "line num is invalid", NULL); - goto end; + code = smlProcess(info, lines, rawLine, rawLineEnd, numLines); + request->code = code; + info->cost.endTime = taosGetTimestampUs(); + info->cost.code = code; + smlPrintStatisticInfo(info); + if(code == TSDB_CODE_TDB_INVALID_TABLE_SCHEMA_VER || code == TSDB_CODE_SDB_OBJ_CREATING){ + refreshMeta(request->pTscObj, request); + uInfo("SML:%"PRIx64" ver is old retry or object is creating code:%d", info->id, code); + smlDestroyInfo(info); + info = NULL; + taos_free_result(request); + request = NULL; + continue; + } + break; } - code = smlProcess(info, lines, rawLine, rawLineEnd, numLines); - request->code = code; - info->cost.endTime = taosGetTimestampUs(); - info->cost.code = code; - smlPrintStatisticInfo(info); - end: smlDestroyInfo(info); return (TAOS_RES *)request; diff --git a/source/client/src/clientSmlJson.c b/source/client/src/clientSmlJson.c index 34f0561d9a34adc4a1b4bc9964cee4d0f6e6a452..4609dd68b04460e27fb5ff63bd30731ac3dd4227 100644 --- a/source/client/src/clientSmlJson.c +++ b/source/client/src/clientSmlJson.c @@ -683,13 +683,10 @@ static int32_t smlParseTagsFromJSON(SSmlHandle *info, cJSON *tags, SSmlLineInfo int cnt = 0; SArray *preLineKV = info->preLineTagKV; - SArray *maxKVs = info->maxTagKVs; - bool isSuperKVInit = true; - SArray *superKV = NULL; if (info->dataFormat) { if (unlikely(!isSameMeasure)) { SSmlSTableMeta **tmp = (SSmlSTableMeta **)taosHashGet(info->superTables, elements->measure, elements->measureLen); - SSmlSTableMeta *sMeta = NULL; + SSmlSTableMeta *sMeta = NULL; if (unlikely(tmp == NULL)) { STableMeta *pTableMeta = smlGetMeta(info, elements->measure, elements->measureLen); if (pTableMeta == NULL) { @@ -700,18 +697,16 @@ static int32_t smlParseTagsFromJSON(SSmlHandle *info, cJSON *tags, SSmlLineInfo sMeta = smlBuildSTableMeta(info->dataFormat); sMeta->tableMeta = pTableMeta; taosHashPut(info->superTables, elements->measure, elements->measureLen, &sMeta, POINTER_BYTES); + for(int i = pTableMeta->tableInfo.numOfColumns; i < pTableMeta->tableInfo.numOfTags + pTableMeta->tableInfo.numOfColumns; i++){ + SSchema *tag = pTableMeta->schema + i; + SSmlKv kv = {.key = tag->name, .keyLen = strlen(tag->name), .type = tag->type, .length = (tag->bytes - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE }; + taosArrayPush(sMeta->tags, &kv); + } tmp = &sMeta; } info->currSTableMeta = (*tmp)->tableMeta; - superKV = (*tmp)->tags; - - if (unlikely(taosArrayGetSize(superKV) == 0)) { - isSuperKVInit = false; - } - taosArrayClear(maxKVs); + info->maxTagKVs = (*tmp)->tags; } - } else { - taosArrayClear(maxKVs); } taosArrayClear(preLineKV); @@ -747,58 +742,21 @@ static int32_t smlParseTagsFromJSON(SSmlHandle *info, cJSON *tags, SSmlLineInfo return TSDB_CODE_SUCCESS; } - if (isSameMeasure) { - if (unlikely(cnt >= taosArrayGetSize(maxKVs))) { - info->dataFormat = false; - info->reRun = true; - return TSDB_CODE_SUCCESS; - } - SSmlKv *maxKV = (SSmlKv *)taosArrayGet(maxKVs, cnt); - if (unlikely(kv.length > maxKV->length)) { - maxKV->length = kv.length; - SSmlSTableMeta **tableMeta = - (SSmlSTableMeta **)taosHashGet(info->superTables, elements->measure, elements->measureLen); - if (unlikely(NULL == tableMeta)) { - uError("SML:0x%" PRIx64 " NULL == tableMeta", info->id); - return TSDB_CODE_SML_INTERNAL_ERROR; - } - - SSmlKv *oldKV = (SSmlKv *)taosArrayGet((*tableMeta)->tags, cnt); - oldKV->length = kv.length; - info->needModifySchema = true; - } - if (unlikely(!IS_SAME_KEY)) { - info->dataFormat = false; - info->reRun = true; - return TSDB_CODE_SUCCESS; - } - } else { - if (isSuperKVInit) { - if (unlikely(cnt >= taosArrayGetSize(superKV))) { - info->dataFormat = false; - info->reRun = true; - return TSDB_CODE_SUCCESS; - } - SSmlKv *maxKV = (SSmlKv *)taosArrayGet(superKV, cnt); - if (unlikely(kv.length > maxKV->length)) { - maxKV->length = kv.length; - } else { - kv.length = maxKV->length; - } - info->needModifySchema = true; - - if (unlikely(!IS_SAME_KEY)) { - info->dataFormat = false; - info->reRun = true; - return TSDB_CODE_SUCCESS; - } - } else { - taosArrayPush(superKV, &kv); - } - taosArrayPush(maxKVs, &kv); + if (unlikely(cnt >= taosArrayGetSize(info->maxTagKVs))) { + info->dataFormat = false; + info->reRun = true; + return TSDB_CODE_SUCCESS; + } + SSmlKv *maxKV = (SSmlKv *)taosArrayGet(info->maxTagKVs, cnt); + if (unlikely(!IS_SAME_KEY)) { + info->dataFormat = false; + info->reRun = true; + return TSDB_CODE_SUCCESS; + } + if (unlikely(kv.length > maxKV->length)) { + maxKV->length = kv.length; + info->needModifySchema = true; } - } else { - taosArrayPush(maxKVs, &kv); } taosArrayPush(preLineKV, &kv); cnt++; @@ -1214,7 +1172,7 @@ static int32_t smlParseJSONString(SSmlHandle *info, char **start, SSmlLineInfo * return TSDB_CODE_INVALID_TIMESTAMP; } else if (elements->timestamp[0] == '{') { char tmp = elements->timestamp[elements->timestampLen]; - elements->cols[elements->timestampLen] = '\0'; + elements->timestamp[elements->timestampLen] = '\0'; cJSON *tsJson = cJSON_Parse(elements->timestamp); ts = smlParseTSFromJSON(info, tsJson); if (unlikely(ts < 0)) { diff --git a/source/client/src/clientSmlLine.c b/source/client/src/clientSmlLine.c index a2f752edb9f9468a8270f1f8ca094221c718fc6c..f5ae077b5d030e90e06685d496cc0b35ea6047c1 100644 --- a/source/client/src/clientSmlLine.c +++ b/source/client/src/clientSmlLine.c @@ -144,13 +144,11 @@ static int32_t smlParseTagKv(SSmlHandle *info, char **sql, char *sqlEnd, SSmlLin int cnt = 0; SArray *preLineKV = info->preLineTagKV; - SArray *maxKVs = info->maxTagKVs; - bool isSuperKVInit = true; - SArray *superKV = NULL; if (info->dataFormat) { if (unlikely(!isSameMeasure)) { SSmlSTableMeta **tmp = (SSmlSTableMeta **)taosHashGet(info->superTables, currElement->measure, currElement->measureLen); + SSmlSTableMeta *sMeta = NULL; if (unlikely(tmp == NULL)) { STableMeta *pTableMeta = smlGetMeta(info, currElement->measure, currElement->measureLen); @@ -162,18 +160,16 @@ static int32_t smlParseTagKv(SSmlHandle *info, char **sql, char *sqlEnd, SSmlLin sMeta = smlBuildSTableMeta(info->dataFormat); sMeta->tableMeta = pTableMeta; taosHashPut(info->superTables, currElement->measure, currElement->measureLen, &sMeta, POINTER_BYTES); + for(int i = pTableMeta->tableInfo.numOfColumns; i < pTableMeta->tableInfo.numOfTags + pTableMeta->tableInfo.numOfColumns; i++){ + SSchema *tag = pTableMeta->schema + i; + SSmlKv kv = {.key = tag->name, .keyLen = strlen(tag->name), .type = tag->type, .length = (tag->bytes - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE }; + taosArrayPush(sMeta->tags, &kv); + } tmp = &sMeta; } info->currSTableMeta = (*tmp)->tableMeta; - superKV = (*tmp)->tags; - - if (unlikely(taosArrayGetSize(superKV) == 0)) { - isSuperKVInit = false; - } - taosArrayClear(maxKVs); + info->maxTagKVs = (*tmp)->tags; } - } else { - taosArrayClear(maxKVs); } taosArrayClear(preLineKV); @@ -252,58 +248,23 @@ static int32_t smlParseTagKv(SSmlHandle *info, char **sql, char *sqlEnd, SSmlLin return TSDB_CODE_SUCCESS; } - if (isSameMeasure) { - if (unlikely(cnt >= taosArrayGetSize(maxKVs))) { - info->dataFormat = false; - info->reRun = true; - return TSDB_CODE_SUCCESS; - } - SSmlKv *maxKV = (SSmlKv *)taosArrayGet(maxKVs, cnt); - if (unlikely(kv.length > maxKV->length)) { - maxKV->length = kv.length; - SSmlSTableMeta **tableMeta = - (SSmlSTableMeta **)taosHashGet(info->superTables, currElement->measure, currElement->measureLen); - if (unlikely(NULL == tableMeta)) { - uError("SML:0x%" PRIx64 " NULL == tableMeta", info->id); - return TSDB_CODE_SML_INTERNAL_ERROR; - } + if (unlikely(cnt >= taosArrayGetSize(info->maxTagKVs))) { + info->dataFormat = false; + info->reRun = true; + return TSDB_CODE_SUCCESS; + } + SSmlKv *maxKV = (SSmlKv *)taosArrayGet(info->maxTagKVs, cnt); - SSmlKv *oldKV = (SSmlKv *)taosArrayGet((*tableMeta)->tags, cnt); - oldKV->length = kv.length; - info->needModifySchema = true; - } - if (unlikely(!IS_SAME_KEY)) { - info->dataFormat = false; - info->reRun = true; - return TSDB_CODE_SUCCESS; - } - } else { - if (isSuperKVInit) { - if (unlikely(cnt >= taosArrayGetSize(superKV))) { - info->dataFormat = false; - info->reRun = true; - return TSDB_CODE_SUCCESS; - } - SSmlKv *maxKV = (SSmlKv *)taosArrayGet(superKV, cnt); - if (unlikely(kv.length > maxKV->length)) { - maxKV->length = kv.length; - } else { - kv.length = maxKV->length; - } - info->needModifySchema = true; + if (unlikely(!IS_SAME_KEY)) { + info->dataFormat = false; + info->reRun = true; + return TSDB_CODE_SUCCESS; + } - if (unlikely(!IS_SAME_KEY)) { - info->dataFormat = false; - info->reRun = true; - return TSDB_CODE_SUCCESS; - } - } else { - taosArrayPush(superKV, &kv); - } - taosArrayPush(maxKVs, &kv); + if (unlikely(kv.length > maxKV->length)) { + maxKV->length = kv.length; + info->needModifySchema = true; } - } else { - taosArrayPush(maxKVs, &kv); } taosArrayPush(preLineKV, &kv); @@ -344,9 +305,6 @@ static int32_t smlParseTagKv(SSmlHandle *info, char **sql, char *sqlEnd, SSmlLin static int32_t smlParseColKv(SSmlHandle *info, char **sql, char *sqlEnd, SSmlLineInfo *currElement, bool isSameMeasure, bool isSameCTable) { int cnt = 0; - SArray *preLineKV = info->preLineColKV; - bool isSuperKVInit = true; - SArray *superKV = NULL; if (info->dataFormat) { if (unlikely(!isSameCTable)) { SSmlTableInfo **oneTable = @@ -361,7 +319,6 @@ static int32_t smlParseColKv(SSmlHandle *info, char **sql, char *sqlEnd, SSmlLin if (unlikely(!isSameMeasure)) { SSmlSTableMeta **tmp = (SSmlSTableMeta **)taosHashGet(info->superTables, currElement->measure, currElement->measureLen); - SSmlSTableMeta *sMeta = NULL; if (unlikely(tmp == NULL)) { STableMeta *pTableMeta = smlGetMeta(info, currElement->measure, currElement->measureLen); if (pTableMeta == NULL) { @@ -369,17 +326,23 @@ static int32_t smlParseColKv(SSmlHandle *info, char **sql, char *sqlEnd, SSmlLin info->reRun = true; return TSDB_CODE_SUCCESS; } - sMeta = smlBuildSTableMeta(info->dataFormat); - sMeta->tableMeta = pTableMeta; - taosHashPut(info->superTables, currElement->measure, currElement->measureLen, &sMeta, POINTER_BYTES); - tmp = &sMeta; + *tmp = smlBuildSTableMeta(info->dataFormat); + (*tmp)->tableMeta = pTableMeta; + taosHashPut(info->superTables, currElement->measure, currElement->measureLen, tmp, POINTER_BYTES); + + for(int i = 0; i < pTableMeta->tableInfo.numOfColumns; i++){ + SSchema *tag = pTableMeta->schema + i; + SSmlKv kv = {.key = tag->name, .keyLen = strlen(tag->name), .type = tag->type }; + if(tag->type == TSDB_DATA_TYPE_NCHAR){ + kv.length = (tag->bytes - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE; + }else if(tag->type == TSDB_DATA_TYPE_BINARY){ + kv.length = tag->bytes - VARSTR_HEADER_SIZE; + } + taosArrayPush((*tmp)->cols, &kv); + } } info->currSTableMeta = (*tmp)->tableMeta; - superKV = (*tmp)->cols; - if (unlikely(taosArrayGetSize(superKV) == 0)) { - isSuperKVInit = false; - } - taosArrayClear(preLineKV); + info->masColKVs = (*tmp)->cols; } } @@ -473,74 +436,31 @@ static int32_t smlParseColKv(SSmlHandle *info, char **sql, char *sqlEnd, SSmlLin // bind data ret = smlBuildCol(info->currTableDataCtx, info->currSTableMeta->schema, &kv, cnt + 1); if (unlikely(ret != TSDB_CODE_SUCCESS)) { - uError("smlBuildCol error, retry"); + uDebug("smlBuildCol error, retry"); + info->dataFormat = false; + info->reRun = true; + return TSDB_CODE_SUCCESS; + } + if (cnt >= taosArrayGetSize(info->masColKVs)) { + info->dataFormat = false; + info->reRun = true; + return TSDB_CODE_SUCCESS; + } + SSmlKv *maxKV = (SSmlKv *)taosArrayGet(info->masColKVs, cnt); + if (kv.type != maxKV->type) { + info->dataFormat = false; + info->reRun = true; + return TSDB_CODE_SUCCESS; + } + if (unlikely(!IS_SAME_KEY)) { info->dataFormat = false; info->reRun = true; return TSDB_CODE_SUCCESS; } - if (isSameMeasure) { - if (cnt >= taosArrayGetSize(preLineKV)) { - info->dataFormat = false; - info->reRun = true; - return TSDB_CODE_SUCCESS; - } - SSmlKv *maxKV = (SSmlKv *)taosArrayGet(preLineKV, cnt); - if (kv.type != maxKV->type) { - info->dataFormat = false; - info->reRun = true; - return TSDB_CODE_SUCCESS; - } - - if (unlikely(IS_VAR_DATA_TYPE(kv.type) && kv.length > maxKV->length)) { - maxKV->length = kv.length; - SSmlSTableMeta **tableMeta = - (SSmlSTableMeta **)taosHashGet(info->superTables, currElement->measure, currElement->measureLen); - if (unlikely(NULL == tableMeta)) { - uError("SML:0x%" PRIx64 " NULL == tableMeta", info->id); - return TSDB_CODE_SML_INTERNAL_ERROR; - } - - SSmlKv *oldKV = (SSmlKv *)taosArrayGet((*tableMeta)->cols, cnt); - oldKV->length = kv.length; - info->needModifySchema = true; - } - if (unlikely(!IS_SAME_KEY)) { - info->dataFormat = false; - info->reRun = true; - return TSDB_CODE_SUCCESS; - } - } else { - if (isSuperKVInit) { - if (unlikely(cnt >= taosArrayGetSize(superKV))) { - info->dataFormat = false; - info->reRun = true; - return TSDB_CODE_SUCCESS; - } - SSmlKv *maxKV = (SSmlKv *)taosArrayGet(superKV, cnt); - if (unlikely(kv.type != maxKV->type)) { - info->dataFormat = false; - info->reRun = true; - return TSDB_CODE_SUCCESS; - } - - if (IS_VAR_DATA_TYPE(kv.type)) { - if (kv.length > maxKV->length) { - maxKV->length = kv.length; - } else { - kv.length = maxKV->length; - } - info->needModifySchema = true; - } - if (unlikely(!IS_SAME_KEY)) { - info->dataFormat = false; - info->reRun = true; - return TSDB_CODE_SUCCESS; - } - } else { - taosArrayPush(superKV, &kv); - } - taosArrayPush(preLineKV, &kv); + if (unlikely(IS_VAR_DATA_TYPE(kv.type) && kv.length > maxKV->length)) { + maxKV->length = kv.length; + info->needModifySchema = true; } } else { if (currElement->colArray == NULL) { @@ -662,8 +582,10 @@ int32_t smlParseInfluxString(SSmlHandle *info, char *sql, char *sqlEnd, SSmlLine .i = ts, .length = (size_t)tDataTypes[TSDB_DATA_TYPE_TIMESTAMP].bytes}; if (info->dataFormat) { - smlBuildCol(info->currTableDataCtx, info->currSTableMeta->schema, &kv, 0); - smlBuildRow(info->currTableDataCtx); + ret = smlBuildCol(info->currTableDataCtx, info->currSTableMeta->schema, &kv, 0); + if(ret != TSDB_CODE_SUCCESS){return ret;} + ret = smlBuildRow(info->currTableDataCtx); + if(ret != TSDB_CODE_SUCCESS){return ret;} clearColValArray(info->currTableDataCtx->pValues); } else { taosArraySet(elements->colArray, 0, &kv); diff --git a/source/client/src/clientSmlTelnet.c b/source/client/src/clientSmlTelnet.c index ab071305fa7777de74546063a1ccfca56b193bc7..ccf79cfc64f462e1818f58cb96216a6b73ea49f2 100644 --- a/source/client/src/clientSmlTelnet.c +++ b/source/client/src/clientSmlTelnet.c @@ -79,13 +79,10 @@ static int32_t smlParseTelnetTags(SSmlHandle *info, char *data, char *sqlEnd, SS int cnt = 0; SArray *preLineKV = info->preLineTagKV; - SArray *maxKVs = info->maxTagKVs; - bool isSuperKVInit = true; - SArray *superKV = NULL; if (info->dataFormat) { if (!isSameMeasure) { SSmlSTableMeta **tmp = (SSmlSTableMeta **)taosHashGet(info->superTables, elements->measure, elements->measureLen); - SSmlSTableMeta *sMeta = NULL; + SSmlSTableMeta *sMeta = NULL; if (unlikely(tmp == NULL)) { STableMeta *pTableMeta = smlGetMeta(info, elements->measure, elements->measureLen); if (pTableMeta == NULL) { @@ -96,18 +93,16 @@ static int32_t smlParseTelnetTags(SSmlHandle *info, char *data, char *sqlEnd, SS sMeta = smlBuildSTableMeta(info->dataFormat); sMeta->tableMeta = pTableMeta; taosHashPut(info->superTables, elements->measure, elements->measureLen, &sMeta, POINTER_BYTES); + for(int i = pTableMeta->tableInfo.numOfColumns; i < pTableMeta->tableInfo.numOfTags + pTableMeta->tableInfo.numOfColumns; i++){ + SSchema *tag = pTableMeta->schema + i; + SSmlKv kv = {.key = tag->name, .keyLen = strlen(tag->name), .type = tag->type, .length = (tag->bytes - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE }; + taosArrayPush(sMeta->tags, &kv); + } tmp = &sMeta; } info->currSTableMeta = (*tmp)->tableMeta; - superKV = (*tmp)->tags; - - if (unlikely(taosArrayGetSize(superKV) == 0)) { - isSuperKVInit = false; - } - taosArrayClear(maxKVs); + info->maxTagKVs = (*tmp)->tags; } - } else { - taosArrayClear(maxKVs); } taosArrayClear(preLineKV); @@ -175,59 +170,21 @@ static int32_t smlParseTelnetTags(SSmlHandle *info, char *data, char *sqlEnd, SS info->reRun = true; return TSDB_CODE_SUCCESS; } - - if (isSameMeasure) { - if (unlikely(cnt >= taosArrayGetSize(maxKVs))) { - info->dataFormat = false; - info->reRun = true; - return TSDB_CODE_SUCCESS; - } - SSmlKv *maxKV = (SSmlKv *)taosArrayGet(maxKVs, cnt); - if (unlikely(kv.length > maxKV->length)) { - maxKV->length = kv.length; - SSmlSTableMeta **tableMeta = - (SSmlSTableMeta **)taosHashGet(info->superTables, elements->measure, elements->measureLen); - if (unlikely(NULL == tableMeta)) { - uError("SML:0x%" PRIx64 " NULL == tableMeta", info->id); - return TSDB_CODE_SML_INTERNAL_ERROR; - } - - SSmlKv *oldKV = (SSmlKv *)taosArrayGet((*tableMeta)->tags, cnt); - oldKV->length = kv.length; - info->needModifySchema = true; - } - if (unlikely(!IS_SAME_KEY)) { - info->dataFormat = false; - info->reRun = true; - return TSDB_CODE_SUCCESS; - } - } else { - if (isSuperKVInit) { - if (unlikely(cnt >= taosArrayGetSize(superKV))) { - info->dataFormat = false; - info->reRun = true; - return TSDB_CODE_SUCCESS; - } - SSmlKv *maxKV = (SSmlKv *)taosArrayGet(superKV, cnt); - if (unlikely(kv.length > maxKV->length)) { - maxKV->length = kv.length; - } else { - kv.length = maxKV->length; - } - info->needModifySchema = true; - - if (unlikely(!IS_SAME_KEY)) { - info->dataFormat = false; - info->reRun = true; - return TSDB_CODE_SUCCESS; - } - } else { - taosArrayPush(superKV, &kv); - } - taosArrayPush(maxKVs, &kv); + if (unlikely(cnt >= taosArrayGetSize(info->maxTagKVs))) { + info->dataFormat = false; + info->reRun = true; + return TSDB_CODE_SUCCESS; + } + SSmlKv *maxKV = (SSmlKv *)taosArrayGet(info->maxTagKVs, cnt); + if (unlikely(!IS_SAME_KEY)) { + info->dataFormat = false; + info->reRun = true; + return TSDB_CODE_SUCCESS; + } + if (unlikely(kv.length > maxKV->length)) { + maxKV->length = kv.length; + info->needModifySchema = true; } - } else { - taosArrayPush(maxKVs, &kv); } taosArrayPush(preLineKV, &kv); cnt++; diff --git a/source/client/src/clientTmq.c b/source/client/src/clientTmq.c index d913b32642578379f7a1e39cfc31d5e528e6e6f1..9f24deff94adf5da052d70987e8b9bc926d3faf0 100644 --- a/source/client/src/clientTmq.c +++ b/source/client/src/clientTmq.c @@ -192,6 +192,7 @@ typedef struct { SMqClientTopic* pTopic; int32_t vgId; tsem_t rspSem; + uint64_t requestId; // request id for debug purpose } SMqPollCbParam; typedef struct { @@ -1054,7 +1055,7 @@ tmq_t* tmq_consumer_new(tmq_conf_t* conf, char* errstr, int32_t errstrLen) { pTmq->hbLiveTimer = taosTmrStart(tmqSendHbReq, 1000, pRefId, tmqMgmt.timer); } - tscInfo("consumer:0x%" PRIx64 " is setup, consumer groupId %s", pTmq->consumerId, pTmq->groupId); + tscInfo("consumer:0x%" PRIx64 " is setup, groupId:%s", pTmq->consumerId, pTmq->groupId); return pTmq; FAIL: @@ -1075,7 +1076,7 @@ int32_t tmq_subscribe(tmq_t* tmq, const tmq_list_t* topic_list) { SCMSubscribeReq req = {0}; int32_t code = 0; - tscDebug("consumer:0x%" PRIx64 " subscribe %d topics", tmq->consumerId, sz); + tscDebug("consumer:0x%" PRIx64 " cgroup:%s, subscribe %d topics", tmq->consumerId, tmq->groupId, sz); req.consumerId = tmq->consumerId; tstrncpy(req.clientId, tmq->clientId, 256); @@ -1161,7 +1162,7 @@ int32_t tmq_subscribe(tmq_t* tmq, const tmq_list_t* topic_list) { int32_t retryCnt = 0; while (TSDB_CODE_MND_CONSUMER_NOT_READY == tmqAskEp(tmq, false)) { - if (retryCnt++ > 10) { + if (retryCnt++ > 40) { goto FAIL; } @@ -1212,30 +1213,39 @@ int32_t tmqPollCb(void* param, SDataBuf* pMsg, int32_t code) { return -1; } - int32_t epoch = pParam->epoch; - int32_t vgId = pParam->vgId; + int32_t epoch = pParam->epoch; + int32_t vgId = pParam->vgId; + uint64_t requestId = pParam->requestId; + taosMemoryFree(pParam); + if (code != 0) { - tscWarn("msg discard from vgId:%d, epoch %d, since %s", vgId, epoch, terrstr()); + tscWarn("consumer:0x%"PRIx64" msg from vgId:%d discarded, epoch %d, since %s, reqId:0x%"PRIx64, tmq->consumerId, vgId, + epoch, tstrerror(code), requestId); + if (pMsg->pData) taosMemoryFree(pMsg->pData); if (pMsg->pEpSet) taosMemoryFree(pMsg->pEpSet); + // in case of consumer mismatch, wait for 500ms and retry if (code == TSDB_CODE_TMQ_CONSUMER_MISMATCH) { + taosMsleep(500); atomic_store_8(&tmq->status, TMQ_CONSUMER_STATUS__RECOVER); - goto CREATE_MSG_FAIL; - } - if (code == TSDB_CODE_TQ_NO_COMMITTED_OFFSET) { + tscDebug("consumer:0x%" PRIx64" wait for the re-balance, wait for 500ms and set status to be RECOVER", tmq->consumerId); + } else if (code == TSDB_CODE_TQ_NO_COMMITTED_OFFSET) { SMqPollRspWrapper* pRspWrapper = taosAllocateQitem(sizeof(SMqPollRspWrapper), DEF_QITEM, 0); if (pRspWrapper == NULL) { - tscWarn("msg discard from vgId:%d, epoch %d since out of memory", vgId, epoch); + tscWarn("consumer:0x%" PRIx64 " msg from vgId:%d discarded, epoch %d since out of memory, reqId:0x%" PRIx64, + tmq->consumerId, vgId, epoch, requestId); goto CREATE_MSG_FAIL; } + pRspWrapper->tmqRspType = TMQ_MSG_TYPE__END_RSP; /*pRspWrapper->vgHandle = pVg;*/ /*pRspWrapper->topicHandle = pTopic;*/ taosWriteQitem(tmq->mqueue, pRspWrapper); tsem_post(&tmq->rspSem); } + goto CREATE_MSG_FAIL; } @@ -1243,8 +1253,9 @@ int32_t tmqPollCb(void* param, SDataBuf* pMsg, int32_t code) { int32_t tmqEpoch = atomic_load_32(&tmq->epoch); if (msgEpoch < tmqEpoch) { // do not write into queue since updating epoch reset - tscWarn("msg discard from vgId:%d since from earlier epoch, rsp epoch %d, current epoch %d", vgId, msgEpoch, - tmqEpoch); + tscWarn("consumer:0x%" PRIx64 " msg discard from vgId:%d since from earlier epoch, rsp epoch %d, current epoch %d, reqId:0x%"PRIx64, + tmq->consumerId, vgId, msgEpoch, tmqEpoch, requestId); + tsem_post(&tmq->rspSem); taosMemoryFree(pMsg->pData); taosMemoryFree(pMsg->pEpSet); @@ -1252,7 +1263,8 @@ int32_t tmqPollCb(void* param, SDataBuf* pMsg, int32_t code) { } if (msgEpoch != tmqEpoch) { - tscWarn("mismatch rsp from vgId:%d, epoch %d, current epoch %d", vgId, msgEpoch, tmqEpoch); + tscWarn("consumer:0x%"PRIx64" mismatch rsp from vgId:%d, epoch %d, current epoch %d, reqId:0x%"PRIx64, tmq->consumerId, vgId, + msgEpoch, tmqEpoch, requestId); } // handle meta rsp @@ -1262,7 +1274,7 @@ int32_t tmqPollCb(void* param, SDataBuf* pMsg, int32_t code) { if (pRspWrapper == NULL) { taosMemoryFree(pMsg->pData); taosMemoryFree(pMsg->pEpSet); - tscWarn("msg discard from vgId:%d, epoch %d since out of memory", vgId, epoch); + tscWarn("consumer:0x%"PRIx64" msg discard from vgId:%d, epoch %d since out of memory", tmq->consumerId, vgId, epoch); goto CREATE_MSG_FAIL; } @@ -1277,10 +1289,9 @@ int32_t tmqPollCb(void* param, SDataBuf* pMsg, int32_t code) { tDecoderClear(&decoder); memcpy(&pRspWrapper->dataRsp, pMsg->pData, sizeof(SMqRspHead)); - tscDebug("consumer:0x%" PRIx64 ", recv poll: vgId:%d, req offset %" PRId64 ", rsp offset %" PRId64 " type %d", + tscDebug("consumer:0x%" PRIx64 " recv poll rsp, vgId:%d, req offset:%" PRId64 ", rsp offset:%" PRId64 " type %d, reqId:0x%"PRIx64, tmq->consumerId, pVg->vgId, pRspWrapper->dataRsp.reqOffset.version, pRspWrapper->dataRsp.rspOffset.version, - rspType); - + rspType, requestId); } else if (rspType == TMQ_MSG_TYPE__POLL_META_RSP) { SDecoder decoder; tDecoderInit(&decoder, POINTER_SHIFT(pMsg->pData, sizeof(SMqRspHead)), pMsg->len - sizeof(SMqRspHead)); @@ -1298,16 +1309,19 @@ int32_t tmqPollCb(void* param, SDataBuf* pMsg, int32_t code) { taosMemoryFree(pMsg->pData); taosMemoryFree(pMsg->pEpSet); - tscDebug("consumer:0x%" PRIx64 ", put poll res into mqueue %p", tmq->consumerId, pRspWrapper); + tscDebug("consumer:0x%" PRIx64 ", put poll res into mqueue, total in queue:%d, reqId:0x%" PRIx64, tmq->consumerId, + tmq->mqueue->numOfItems, requestId); taosWriteQitem(tmq->mqueue, pRspWrapper); tsem_post(&tmq->rspSem); return 0; + CREATE_MSG_FAIL: if (epoch == tmq->epoch) { atomic_store_32(&pVg->vgStatus, TMQ_VG_STATUS__IDLE); } + tsem_post(&tmq->rspSem); return -1; } @@ -1344,7 +1358,7 @@ bool tmqUpdateEp(tmq_t* tmq, int32_t epoch, const SMqAskEpRsp* pRsp) { sprintf(vgKey, "%s:%d", pTopicCur->topicName, pVgCur->vgId); char buf[80]; tFormatOffset(buf, 80, &pVgCur->currentOffset); - tscDebug("consumer:0x%" PRIx64 ", epoch %d vgId:%d vgKey is %s, offset is %s", tmq->consumerId, epoch, + tscDebug("consumer:0x%" PRIx64 ", epoch:%d vgId:%d vgKey:%s, offset:%s", tmq->consumerId, epoch, pVgCur->vgId, vgKey, buf); taosHashPut(pHash, vgKey, strlen(vgKey), &pVgCur->currentOffset, sizeof(STqOffsetVal)); } @@ -1552,7 +1566,7 @@ int32_t tmqAskEp(tmq_t* tmq, bool async) { .handle = NULL, }; - sendInfo->requestId = tmq->consumerId; + sendInfo->requestId = generateRequestId(); sendInfo->requestObjRefId = 0; sendInfo->param = pParam; sendInfo->fp = tmqAskEpCb; @@ -1560,7 +1574,7 @@ int32_t tmqAskEp(tmq_t* tmq, bool async) { SEpSet epSet = getEpSet_s(&tmq->pTscObj->pAppInfo->mgmtEp); tscDebug("consumer:0x%" PRIx64 " ask ep from mnode, async:%d, reqId:0x%" PRIx64, tmq->consumerId, async, - tmq->consumerId); + sendInfo->requestId); int64_t transporterId = 0; asyncSendMsgToServer(tmq->pTscObj->pAppInfo->pTransporter, &epSet, &transporterId, sendInfo); @@ -1674,6 +1688,7 @@ static int32_t doTmqPollImpl(tmq_t* pTmq, SMqClientTopic* pTopic, SMqClientVg* p pParam->pVg = pVg; // pVg may be released,fix it pParam->pTopic = pTopic; pParam->vgId = pVg->vgId; + pParam->requestId = req.reqId; SMsgSendInfo* sendInfo = taosMemoryCalloc(1, sizeof(SMsgSendInfo)); if (sendInfo == NULL) { @@ -1698,7 +1713,7 @@ static int32_t doTmqPollImpl(tmq_t* pTmq, SMqClientTopic* pTopic, SMqClientVg* p char offsetFormatBuf[80]; tFormatOffset(offsetFormatBuf, tListLen(offsetFormatBuf), &pVg->currentOffset); - tscDebug("consumer:0x%" PRIx64 " send poll to %s vgId:%d, epoch %d, req offset:%s, reqId:0x%" PRIx64, + tscDebug("consumer:0x%" PRIx64 " send poll to %s vgId:%d, epoch %d, req:%s, reqId:0x%" PRIx64, pTmq->consumerId, pTopic->topicName, pVg->vgId, pTmq->epoch, offsetFormatBuf, req.reqId); asyncSendMsgToServer(pTmq->pTscObj->pAppInfo->pTransporter, &pVg->epSet, &transporterId, sendInfo); @@ -1722,10 +1737,9 @@ int32_t tmqPollImpl(tmq_t* tmq, int64_t timeout) { int32_t vgStatus = atomic_val_compare_exchange_32(&pVg->vgStatus, TMQ_VG_STATUS__IDLE, TMQ_VG_STATUS__WAIT); if (vgStatus == TMQ_VG_STATUS__WAIT) { int32_t vgSkipCnt = atomic_add_fetch_32(&pVg->vgSkipCnt, 1); - tscDebug("consumer:0x%" PRIx64 " epoch %d wait poll-rsp, skip vgId:%d skip cnt %d", tmq->consumerId, tmq->epoch, + tscTrace("consumer:0x%" PRIx64 " epoch %d wait poll-rsp, skip vgId:%d skip cnt %d", tmq->consumerId, tmq->epoch, pVg->vgId, vgSkipCnt); continue; - /*if (vgSkipCnt < 10000) continue;*/ #if 0 if (skipCnt < 30000) { continue; @@ -1767,7 +1781,7 @@ int32_t tmqHandleNoPollRsp(tmq_t* tmq, SMqRspWrapper* rspWrapper, bool* pReset) } void* tmqHandleAllRsp(tmq_t* tmq, int64_t timeout, bool pollIfReset) { - tscDebug("consumer:0x%" PRIx64 " start to handle the rsp", tmq->consumerId); + tscDebug("consumer:0x%" PRIx64 " start to handle the rsp, total:%d", tmq->consumerId, tmq->qall->numOfItems); while (1) { SMqRspWrapper* rspWrapper = NULL; @@ -1785,25 +1799,32 @@ void* tmqHandleAllRsp(tmq_t* tmq, int64_t timeout, bool pollIfReset) { if (rspWrapper->tmqRspType == TMQ_MSG_TYPE__END_RSP) { taosFreeQitem(rspWrapper); terrno = TSDB_CODE_TQ_NO_COMMITTED_OFFSET; + tscError("consumer:0x%" PRIx64 " unexpected rsp from poll, code:%s", tmq->consumerId, tstrerror(terrno)); return NULL; } else if (rspWrapper->tmqRspType == TMQ_MSG_TYPE__POLL_RSP) { SMqPollRspWrapper* pollRspWrapper = (SMqPollRspWrapper*)rspWrapper; - tscDebug("consumer:0x%" PRIx64 " process poll rsp", tmq->consumerId); + /*atomic_sub_fetch_32(&tmq->readyRequest, 1);*/ int32_t consumerEpoch = atomic_load_32(&tmq->epoch); if (pollRspWrapper->dataRsp.head.epoch == consumerEpoch) { SMqClientVg* pVg = pollRspWrapper->vgHandle; - /*printf("vgId:%d, offset %" PRId64 " up to %" PRId64 "\n", pVg->vgId, pVg->currentOffset, - * rspMsg->msg.rspOffset);*/ pVg->currentOffset = pollRspWrapper->dataRsp.rspOffset; atomic_store_32(&pVg->vgStatus, TMQ_VG_STATUS__IDLE); + if (pollRspWrapper->dataRsp.blockNum == 0) { + tscDebug("consumer:0x%" PRIx64 " empty block received, vgId:%d", tmq->consumerId, pVg->vgId); taosFreeQitem(pollRspWrapper); rspWrapper = NULL; continue; } + // build rsp + char buf[80]; + tFormatOffset(buf, 80, &pVg->currentOffset); SMqRspObj* pRsp = tmqBuildRspFromWrapper(pollRspWrapper); + tscDebug("consumer:0x%" PRIx64 " process poll rsp, vgId:%d, offset:%s, blocks:%d", tmq->consumerId, + pVg->vgId, buf, pollRspWrapper->dataRsp.blockNum); + taosFreeQitem(pollRspWrapper); return pRsp; } else { @@ -1876,6 +1897,8 @@ void* tmqHandleAllRsp(tmq_t* tmq, int64_t timeout, bool pollIfReset) { } } } + + tscDebug("consumer:0x%" PRIx64 " handle the rsp completed", tmq->consumerId); } TAOS_RES* tmq_consumer_poll(tmq_t* tmq, int64_t timeout) { @@ -1896,17 +1919,18 @@ TAOS_RES* tmq_consumer_poll(tmq_t* tmq, int64_t timeout) { // in no topic status, delayed task also need to be processed if (atomic_load_8(&tmq->status) == TMQ_CONSUMER_STATUS__INIT) { tscDebug("consumer:0x%" PRIx64 " poll return since consumer is init", tmq->consumerId); + taosMsleep(500); // sleep for a while return NULL; } if (atomic_load_8(&tmq->status) == TMQ_CONSUMER_STATUS__RECOVER) { int32_t retryCnt = 0; while (TSDB_CODE_MND_CONSUMER_NOT_READY == tmqAskEp(tmq, false)) { - if (retryCnt++ > 10) { + if (retryCnt++ > 40) { return NULL; } - tscDebug("consumer:0x%" PRIx64 " not ready, retry:%d/10 in 500ms", tmq->consumerId, retryCnt); + tscDebug("consumer:0x%" PRIx64 " not ready, retry:%d/40 in 500ms", tmq->consumerId, retryCnt); taosMsleep(500); } } diff --git a/source/client/test/clientTests.cpp b/source/client/test/clientTests.cpp index 59c931d9aa8b30bce9933c322db2bf50c8611093..2f3d60001944365451e312baf48097169f4587bf 100644 --- a/source/client/test/clientTests.cpp +++ b/source/client/test/clientTests.cpp @@ -925,7 +925,7 @@ TEST(clientCase, subscription_test) { // 创建订阅 topics 列表 tmq_list_t* topicList = tmq_list_new(); - tmq_list_append(topicList, "topic_t1"); +// tmq_list_append(topicList, "topic_t1"); // 启动订阅 tmq_subscribe(tmq, topicList); @@ -938,6 +938,8 @@ TEST(clientCase, subscription_test) { int32_t msgCnt = 0; int32_t timeout = 5000; + int32_t count = 0; + while (1) { TAOS_RES* pRes = tmq_consumer_poll(tmq, timeout); if (pRes) { @@ -952,6 +954,11 @@ TEST(clientCase, subscription_test) { printf("db: %s\n", dbName); printf("vgroup id: %d\n", vgroupId); + if (count ++ > 20) { + tmq_unsubscribe(tmq); + break; + } + while (1) { TAOS_ROW row = taos_fetch_row(pRes); if (row == NULL) break; diff --git a/source/common/src/systable.c b/source/common/src/systable.c index 6198f923f4972845784bc57dcf3187c823c0325a..4aa47a381966c225da16a2f48a555833558522de 100644 --- a/source/common/src/systable.c +++ b/source/common/src/systable.c @@ -33,6 +33,7 @@ static const SSysDbTableSchema dnodesSchema[] = { {.name = "support_vnodes", .bytes = 2, .type = TSDB_DATA_TYPE_SMALLINT, .sysInfo = true}, {.name = "status", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true}, {.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP, .sysInfo = true}, + {.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}, }; @@ -42,6 +43,7 @@ static const SSysDbTableSchema mnodesSchema[] = { {.name = "role", .bytes = 12 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true}, {.name = "status", .bytes = 9 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true}, {.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP, .sysInfo = true}, + {.name = "reboot_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP, .sysInfo = true}, }; static const SSysDbTableSchema modulesSchema[] = { diff --git a/source/common/src/tdatablock.c b/source/common/src/tdatablock.c index 88eb3bdb9745dee95b588e16b7b1ff2ffe3eeabf..3c8d394b4396776b03d3557e49aa7d87c29ffccc 100644 --- a/source/common/src/tdatablock.c +++ b/source/common/src/tdatablock.c @@ -2003,7 +2003,7 @@ char* dumpBlockData(SSDataBlock* pDataBlock, const char* flag, char** pDataBuf) switch (pColInfoData->info.type) { case TSDB_DATA_TYPE_TIMESTAMP: memset(pBuf, 0, sizeof(pBuf)); - formatTimestamp(pBuf, *(uint64_t*)var, TSDB_TIME_PRECISION_MILLI); + formatTimestamp(pBuf, *(uint64_t*)var, pColInfoData->info.precision); len += snprintf(dumpBuf + len, size - len, " %25s |", pBuf); if (len >= size - 1) return dumpBuf; break; @@ -2044,8 +2044,8 @@ char* dumpBlockData(SSDataBlock* pDataBlock, const char* flag, char** pDataBuf) if (len >= size - 1) return dumpBuf; break; case TSDB_DATA_TYPE_DOUBLE: - // len += snprintf(dumpBuf + len, size - len, " %15lf |", *(double*)var); - // if (len >= size - 1) return dumpBuf; + len += snprintf(dumpBuf + len, size - len, " %15f |", *(double*)var); + if (len >= size - 1) return dumpBuf; break; case TSDB_DATA_TYPE_BOOL: len += snprintf(dumpBuf + len, size - len, " %15d |", *(bool*)var); diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index 99795fcc794ecf875497abf3bb180cfd92e4919d..8058f9fddd6ee29e2b217f059255190493093378 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -41,8 +41,8 @@ bool tsPrintAuth = false; // queue & threads int32_t tsNumOfRpcThreads = 1; -int32_t tsNumOfRpcSessions = 5000; -int32_t tsTimeToGetAvailableConn = 100000; +int32_t tsNumOfRpcSessions = 10000; +int32_t tsTimeToGetAvailableConn = 500000; int32_t tsNumOfCommitThreads = 2; int32_t tsNumOfTaskQueueThreads = 4; int32_t tsNumOfMnodeQueryThreads = 4; @@ -56,6 +56,7 @@ int32_t tsNumOfQnodeQueryThreads = 4; int32_t tsNumOfQnodeFetchThreads = 1; int32_t tsNumOfSnodeStreamThreads = 4; int32_t tsNumOfSnodeWriteThreads = 1; + // sync raft int32_t tsElectInterval = 25 * 1000; int32_t tsHeartbeatInterval = 1000; @@ -64,6 +65,10 @@ int32_t tsHeartbeatTimeout = 20 * 1000; // vnode int64_t tsVndCommitMaxIntervalMs = 600 * 1000; +// mnode +int64_t tsMndSdbWriteDelta = 200; +int64_t tsMndLogRetention = 2000; + // monitor bool tsEnableMonitor = true; int32_t tsMonitorInterval = 30; @@ -327,6 +332,10 @@ static int32_t taosAddClientCfg(SConfig *pCfg) { if (cfgAddBool(pCfg, "useAdapter", tsUseAdapter, true) != 0) return -1; if (cfgAddBool(pCfg, "crashReporting", tsEnableCrashReport, true) != 0) return -1; + tsNumOfRpcThreads = tsNumOfCores / 2; + tsNumOfRpcThreads = TRANGE(tsNumOfRpcThreads, 2, TSDB_MAX_RPC_THREADS); + if (cfgAddInt32(pCfg, "numOfRpcThreads", tsNumOfRpcThreads, 1, 1024, 0) != 0) return -1; + tsNumOfRpcSessions = TRANGE(tsNumOfRpcSessions, 100, 100000); if (cfgAddInt32(pCfg, "numOfRpcSessions", tsNumOfRpcSessions, 1, 100000, 0) != 0) return -1; @@ -456,6 +465,9 @@ static int32_t taosAddServerCfg(SConfig *pCfg) { if (cfgAddInt64(pCfg, "vndCommitMaxInterval", tsVndCommitMaxIntervalMs, 1000, 1000 * 60 * 60, 0) != 0) return -1; + if (cfgAddInt64(pCfg, "mndSdbWriteDelta", tsMndSdbWriteDelta, 20, 10000, 0) != 0) return -1; + if (cfgAddInt64(pCfg, "mndLogRetention", tsMndLogRetention, 500, 10000, 0) != 0) return -1; + if (cfgAddBool(pCfg, "monitor", tsEnableMonitor, 0) != 0) return -1; if (cfgAddInt32(pCfg, "monitorInterval", tsMonitorInterval, 1, 200000, 0) != 0) return -1; if (cfgAddString(pCfg, "monitorFqdn", tsMonitorFqdn, 0) != 0) return -1; @@ -521,7 +533,6 @@ static int32_t taosUpdateServerCfg(SConfig *pCfg) { pItem = cfgGetItem(tsCfg, "numOfRpcSessions"); if (pItem != NULL && pItem->stype == CFG_STYPE_DEFAULT) { - tsNumOfRpcSessions = 2000; tsNumOfRpcSessions = TRANGE(tsNumOfRpcSessions, 100, 10000); pItem->i32 = tsNumOfRpcSessions; pItem->stype = stype; @@ -529,7 +540,6 @@ static int32_t taosUpdateServerCfg(SConfig *pCfg) { pItem = cfgGetItem(tsCfg, "timeToGetAvailableConn"); if (pItem != NULL && pItem->stype == CFG_STYPE_DEFAULT) { - tsTimeToGetAvailableConn = 1000; tsTimeToGetAvailableConn = TRANGE(tsTimeToGetAvailableConn, 20, 1000000); pItem->i32 = tsTimeToGetAvailableConn; pItem->stype = stype; @@ -717,6 +727,7 @@ static int32_t taosSetClientCfg(SConfig *pCfg) { tsMaxRetryWaitTime = cfgGetItem(pCfg, "maxRetryWaitTime")->i32; + tsNumOfRpcThreads = cfgGetItem(pCfg, "numOfRpcThreads")->i32; tsNumOfRpcSessions = cfgGetItem(pCfg, "numOfRpcSessions")->i32; tsTimeToGetAvailableConn = cfgGetItem(pCfg, "timeToGetAvailableConn")->i32; @@ -803,6 +814,9 @@ static int32_t taosSetServerCfg(SConfig *pCfg) { tsVndCommitMaxIntervalMs = cfgGetItem(pCfg, "vndCommitMaxInterval")->i64; + tsMndSdbWriteDelta = cfgGetItem(pCfg, "mndSdbWriteDelta")->i64; + tsMndLogRetention = cfgGetItem(pCfg, "mndLogRetention")->i64; + tsStartUdfd = cfgGetItem(pCfg, "udf")->bval; tstrncpy(tsUdfdResFuncs, cfgGetItem(pCfg, "udfdResFuncs")->str, sizeof(tsUdfdResFuncs)); tstrncpy(tsUdfdLdLibPath, cfgGetItem(pCfg, "udfdLdLibPath")->str, sizeof(tsUdfdLdLibPath)); @@ -1240,6 +1254,7 @@ int32_t taosCreateLog(const char *logname, int32_t logFileNum, const char *cfgDi taosSetAllDebugFlag(cfgGetItem(pCfg, "debugFlag")->i32, false); if (taosMulModeMkDir(tsLogDir, 0777) != 0) { + terrno = TAOS_SYSTEM_ERROR(errno); uError("failed to create dir:%s since %s", tsLogDir, terrstr()); cfgCleanup(pCfg); return -1; diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index e180959d1e1c73805265e144f7e38882b9ad9e7b..9ad7c72bc0de1d90c16b3a37ef5f5186be46a21d 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -2219,6 +2219,10 @@ int32_t tSerializeSAlterDbReq(void *buf, int32_t bufLen, SAlterDbReq *pReq) { if (tEncodeI8(&encoder, pReq->cacheLast) < 0) return -1; if (tEncodeI8(&encoder, pReq->replications) < 0) return -1; if (tEncodeI32(&encoder, pReq->sstTrigger) < 0) return -1; + + // 1st modification + if (tEncodeI32(&encoder, pReq->minRows) < 0) return -1; + tEndEncode(&encoder); int32_t tlen = encoder.pos; @@ -2246,6 +2250,13 @@ int32_t tDeserializeSAlterDbReq(void *buf, int32_t bufLen, SAlterDbReq *pReq) { if (tDecodeI8(&decoder, &pReq->cacheLast) < 0) return -1; if (tDecodeI8(&decoder, &pReq->replications) < 0) return -1; if (tDecodeI32(&decoder, &pReq->sstTrigger) < 0) return -1; + + // 1st modification + if (!tDecodeIsEnd(&decoder)) { + if (tDecodeI32(&decoder, &pReq->minRows) < 0) return -1; + } else { + pReq->minRows = -1; + } tEndDecode(&decoder); tDecoderClear(&decoder); @@ -2531,6 +2542,8 @@ int32_t tSerializeSCompactDbReq(void *buf, int32_t bufLen, SCompactDbReq *pReq) if (tStartEncode(&encoder) < 0) return -1; if (tEncodeCStr(&encoder, pReq->db) < 0) return -1; + if (tEncodeI64(&encoder, pReq->timeRange.skey) < 0) return -1; + if (tEncodeI64(&encoder, pReq->timeRange.ekey) < 0) return -1; tEndEncode(&encoder); int32_t tlen = encoder.pos; @@ -2544,6 +2557,8 @@ int32_t tDeserializeSCompactDbReq(void *buf, int32_t bufLen, SCompactDbReq *pReq if (tStartDecode(&decoder) < 0) return -1; if (tDecodeCStrTo(&decoder, pReq->db) < 0) return -1; + if (tDecodeI64(&decoder, &pReq->timeRange.skey) < 0) return -1; + if (tDecodeI64(&decoder, &pReq->timeRange.ekey) < 0) return -1; tEndDecode(&decoder); tDecoderClear(&decoder); @@ -2865,12 +2880,19 @@ int32_t tSerializeSDbCfgRsp(void *buf, int32_t bufLen, const SDbCfgRsp *pRsp) { if (tEncodeI32(&encoder, pRsp->minRows) < 0) return -1; if (tEncodeI32(&encoder, pRsp->maxRows) < 0) return -1; if (tEncodeI32(&encoder, pRsp->walFsyncPeriod) < 0) return -1; + if (tEncodeI16(&encoder, pRsp->hashPrefix) < 0) return -1; + if (tEncodeI16(&encoder, pRsp->hashSuffix) < 0) return -1; if (tEncodeI8(&encoder, pRsp->walLevel) < 0) return -1; if (tEncodeI8(&encoder, pRsp->precision) < 0) return -1; if (tEncodeI8(&encoder, pRsp->compression) < 0) return -1; if (tEncodeI8(&encoder, pRsp->replications) < 0) return -1; if (tEncodeI8(&encoder, pRsp->strict) < 0) return -1; if (tEncodeI8(&encoder, pRsp->cacheLast) < 0) return -1; + if (tEncodeI32(&encoder, pRsp->tsdbPageSize) < 0) return -1; + if (tEncodeI32(&encoder, pRsp->walRetentionPeriod) < 0) return -1; + if (tEncodeI32(&encoder, pRsp->walRollPeriod) < 0) return -1; + if (tEncodeI64(&encoder, pRsp->walRetentionSize) < 0) return -1; + if (tEncodeI64(&encoder, pRsp->walSegmentSize) < 0) return -1; if (tEncodeI32(&encoder, pRsp->numOfRetensions) < 0) return -1; for (int32_t i = 0; i < pRsp->numOfRetensions; ++i) { SRetention *pRetension = taosArrayGet(pRsp->pRetensions, i); @@ -2905,12 +2927,19 @@ int32_t tDeserializeSDbCfgRsp(void *buf, int32_t bufLen, SDbCfgRsp *pRsp) { if (tDecodeI32(&decoder, &pRsp->minRows) < 0) return -1; if (tDecodeI32(&decoder, &pRsp->maxRows) < 0) return -1; if (tDecodeI32(&decoder, &pRsp->walFsyncPeriod) < 0) return -1; + if (tDecodeI16(&decoder, &pRsp->hashPrefix) < 0) return -1; + if (tDecodeI16(&decoder, &pRsp->hashSuffix) < 0) return -1; if (tDecodeI8(&decoder, &pRsp->walLevel) < 0) return -1; if (tDecodeI8(&decoder, &pRsp->precision) < 0) return -1; if (tDecodeI8(&decoder, &pRsp->compression) < 0) return -1; if (tDecodeI8(&decoder, &pRsp->replications) < 0) return -1; if (tDecodeI8(&decoder, &pRsp->strict) < 0) return -1; if (tDecodeI8(&decoder, &pRsp->cacheLast) < 0) return -1; + if (tDecodeI32(&decoder, &pRsp->tsdbPageSize) < 0) return -1; + if (tDecodeI32(&decoder, &pRsp->walRetentionPeriod) < 0) return -1; + if (tDecodeI32(&decoder, &pRsp->walRollPeriod) < 0) return -1; + if (tDecodeI64(&decoder, &pRsp->walRetentionSize) < 0) return -1; + if (tDecodeI64(&decoder, &pRsp->walSegmentSize) < 0) return -1; if (tDecodeI32(&decoder, &pRsp->numOfRetensions) < 0) return -1; if (pRsp->numOfRetensions > 0) { pRsp->pRetensions = taosArrayInit(pRsp->numOfRetensions, sizeof(SRetention)); @@ -3723,6 +3752,7 @@ int32_t tSerializeSConnectReq(void *buf, int32_t bufLen, SConnectReq *pReq) { if (tEncodeCStr(&encoder, pReq->user) < 0) return -1; if (tEncodeCStrWithLen(&encoder, pReq->passwd, TSDB_PASSWORD_LEN) < 0) return -1; if (tEncodeI64(&encoder, pReq->startTime) < 0) return -1; + if (tEncodeCStr(&encoder, pReq->sVer) < 0) return -1; tEndEncode(&encoder); int32_t tlen = encoder.pos; @@ -3742,6 +3772,12 @@ int32_t tDeserializeSConnectReq(void *buf, int32_t bufLen, SConnectReq *pReq) { if (tDecodeCStrTo(&decoder, pReq->user) < 0) return -1; if (tDecodeCStrTo(&decoder, pReq->passwd) < 0) return -1; if (tDecodeI64(&decoder, &pReq->startTime) < 0) return -1; + // Check the client version from version 3.0.3.0 + if (tDecodeIsEnd(&decoder)) { + tDecoderClear(&decoder); + return TSDB_CODE_VERSION_NOT_COMPATIBLE; + } + if (tDecodeCStrTo(&decoder, pReq->sVer) < 0) return -1; tEndDecode(&decoder); tDecoderClear(&decoder); @@ -4090,6 +4126,11 @@ int32_t tSerializeSCompactVnodeReq(void *buf, int32_t bufLen, SCompactVnodeReq * if (tEncodeI64(&encoder, pReq->dbUid) < 0) return -1; if (tEncodeCStr(&encoder, pReq->db) < 0) return -1; if (tEncodeI64(&encoder, pReq->compactStartTime) < 0) return -1; + + // 1.1 add tw.skey and tw.ekey + if (tEncodeI64(&encoder, pReq->tw.skey) < 0) return -1; + if (tEncodeI64(&encoder, pReq->tw.ekey) < 0) return -1; + tEndEncode(&encoder); int32_t tlen = encoder.pos; @@ -4102,11 +4143,21 @@ int32_t tDeserializeSCompactVnodeReq(void *buf, int32_t bufLen, SCompactVnodeReq tDecoderInit(&decoder, buf, bufLen); if (tStartDecode(&decoder) < 0) return -1; + if (tDecodeI64(&decoder, &pReq->dbUid) < 0) return -1; if (tDecodeCStrTo(&decoder, pReq->db) < 0) return -1; if (tDecodeI64(&decoder, &pReq->compactStartTime) < 0) return -1; - tEndDecode(&decoder); + // 1.1 + if (tDecodeIsEnd(&decoder)) { + pReq->tw.skey = TSKEY_MIN; + pReq->tw.ekey = TSKEY_MAX; + } else { + if (tDecodeI64(&decoder, &pReq->tw.skey) < 0) return -1; + if (tDecodeI64(&decoder, &pReq->tw.ekey) < 0) return -1; + } + + tEndDecode(&decoder); tDecoderClear(&decoder); return 0; } @@ -4132,6 +4183,11 @@ int32_t tSerializeSAlterVnodeConfigReq(void *buf, int32_t bufLen, SAlterVnodeCon for (int32_t i = 0; i < 8; ++i) { if (tEncodeI64(&encoder, pReq->reserved[i]) < 0) return -1; } + + // 1st modification + if (tEncodeI16(&encoder, pReq->sttTrigger) < 0) return -1; + if (tEncodeI32(&encoder, pReq->minRows) < 0) return -1; + tEndEncode(&encoder); int32_t tlen = encoder.pos; @@ -4161,6 +4217,15 @@ int32_t tDeserializeSAlterVnodeConfigReq(void *buf, int32_t bufLen, SAlterVnodeC if (tDecodeI64(&decoder, &pReq->reserved[i]) < 0) return -1; } + // 1st modification + if (tDecodeIsEnd(&decoder)) { + pReq->sttTrigger = -1; + pReq->minRows = -1; + } else { + if (tDecodeI16(&decoder, &pReq->sttTrigger) < 0) return -1; + if (tDecodeI32(&decoder, &pReq->minRows) < 0) return -1; + } + tEndDecode(&decoder); tDecoderClear(&decoder); return 0; @@ -6570,7 +6635,7 @@ int32_t tFormatOffset(char *buf, int32_t maxLen, const STqOffsetVal *pVal) { } else if (pVal->type == TMQ_OFFSET__LOG) { snprintf(buf, maxLen, "offset(log) ver:%" PRId64, pVal->version); } else if (pVal->type == TMQ_OFFSET__SNAPSHOT_DATA || pVal->type == TMQ_OFFSET__SNAPSHOT_META) { - snprintf(buf, maxLen, "offset(ss data) uid:%" PRId64 ", ts:%" PRId64, pVal->uid, pVal->ts); + snprintf(buf, maxLen, "offset(snapshot) uid:%" PRId64 " ts:%" PRId64, pVal->uid, pVal->ts); } else { ASSERT(0); } diff --git a/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c b/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c index 0724fcc63a227c3ee94e7b4abf2b3b7283e61277..228f301aec7712fce516ddad2d22f4b2823a36b0 100644 --- a/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c +++ b/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c @@ -61,6 +61,16 @@ static void dmProcessStatusRsp(SDnodeMgmt *pMgmt, SRpcMsg *pRsp) { rpcFreeCont(pRsp->pCont); } +void dmEpSetToStr(char *buf, int32_t len, SEpSet *epSet) { + int32_t n = 0; + n += snprintf(buf + n, len - n, "%s", "{"); + for (int i = 0; i < epSet->numOfEps; i++) { + n += snprintf(buf + n, len - n, "%s:%d%s", epSet->eps[i].fqdn, epSet->eps[i].port, + (i + 1 < epSet->numOfEps ? ", " : "")); + } + n += snprintf(buf + n, len - n, "%s", "}"); +} + void dmSendStatusReq(SDnodeMgmt *pMgmt) { SStatusReq req = {0}; @@ -119,11 +129,10 @@ void dmSendStatusReq(SDnodeMgmt *pMgmt) { dmGetMnodeEpSet(pMgmt->pData, &epSet); rpcSendRecv(pMgmt->msgCb.clientRpc, &epSet, &rpcMsg, &rpcRsp); if (rpcRsp.code != 0) { - dError("failed to send status req since %s, numOfEps:%d inUse:%d", tstrerror(rpcRsp.code), epSet.numOfEps, - epSet.inUse); - for (int32_t i = 0; i < epSet.numOfEps; ++i) { - dDebug("index:%d, mnode ep:%s:%u", i, epSet.eps[i].fqdn, epSet.eps[i].port); - } + dmRotateMnodeEpSet(pMgmt->pData); + char tbuf[256]; + dmEpSetToStr(tbuf, sizeof(tbuf), &epSet); + dError("failed to send status req since %s, epSet:%s, inUse:%d", tstrerror(rpcRsp.code), tbuf, epSet.inUse); } dmProcessStatusRsp(pMgmt, &rpcRsp); } diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c b/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c index 5cf408a905fd267ad982d93a409e4859eb691cfb..d7f91b74a8d1827f512b85b2a7e91221306172a3 100644 --- a/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c +++ b/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c @@ -20,6 +20,8 @@ void vmGetVnodeLoads(SVnodeMgmt *pMgmt, SMonVloadInfo *pInfo, bool isReset) { pInfo->pVloads = taosArrayInit(pMgmt->state.totalVnodes, sizeof(SVnodeLoad)); if (pInfo->pVloads == NULL) return; + tfsUpdateSize(pMgmt->pTfs); + taosThreadRwlockRdlock(&pMgmt->lock); void *pIter = taosHashIterate(pMgmt->hash, NULL); diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmInt.c b/source/dnode/mgmt/mgmt_vnode/src/vmInt.c index 8008e5f81031af617a169f1b4414338f71de897e..0524e2713ab4eec96cf4fd5eecf99bfa0968bf4e 100644 --- a/source/dnode/mgmt/mgmt_vnode/src/vmInt.c +++ b/source/dnode/mgmt/mgmt_vnode/src/vmInt.c @@ -124,7 +124,7 @@ void vmCloseVnode(SVnodeMgmt *pMgmt, SVnodeObj *pVnode, bool commitAndRemoveWal) vmFreeQueue(pMgmt, pVnode); if (commitAndRemoveWal) { - dInfo("vgId:%d, commit data", pVnode->vgId); + dInfo("vgId:%d, commit data for vnode split", pVnode->vgId); vnodeSyncCommit(pVnode->pImpl); vnodeBegin(pVnode->pImpl); dInfo("vgId:%d, commit data finished", pVnode->vgId); diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c b/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c index c1b3cde9ea9342ced75f4747881fefae86104af1..7aa1c9f56acc9e1cec882e6a317e0bc0ed2a5eb1 100644 --- a/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c +++ b/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c @@ -192,8 +192,8 @@ static int32_t vmPutMsgToQueue(SVnodeMgmt *pMgmt, SRpcMsg *pMsg, EQueueType qtyp taosWriteQitem(pVnode->pFetchQ, pMsg); break; case WRITE_QUEUE: - if (!osDataSpaceAvailable()) { - terrno = TSDB_CODE_NO_DISKSPACE; + if (!osDataSpaceSufficient()) { + terrno = TSDB_CODE_NO_ENOUGH_DISKSPACE; code = terrno; dError("vgId:%d, msg:%p put into vnode-write queue failed since %s", pVnode->vgId, pMsg, terrstr(code)); break; diff --git a/source/dnode/mgmt/node_util/inc/dmUtil.h b/source/dnode/mgmt/node_util/inc/dmUtil.h index 55ee6d697337456d113ba5eb8c993fe923042f48..cfdea40477b1dae1cabc35e8566c1ff7ad86a148 100644 --- a/source/dnode/mgmt/node_util/inc/dmUtil.h +++ b/source/dnode/mgmt/node_util/inc/dmUtil.h @@ -166,6 +166,7 @@ int32_t dmReadEps(SDnodeData *pData); int32_t dmWriteEps(SDnodeData *pData); void dmUpdateEps(SDnodeData *pData, SArray *pDnodeEps); void dmGetMnodeEpSet(SDnodeData *pData, SEpSet *pEpSet); +void dmRotateMnodeEpSet(SDnodeData *pData); void dmGetMnodeEpSetForRedirect(SDnodeData *pData, SRpcMsg *pMsg, SEpSet *pEpSet); void dmSetMnodeEpSet(SDnodeData *pData, SEpSet *pEpSet); bool dmUpdateDnodeInfo(void *pData, int32_t *dnodeId, int64_t *clusterId, char *fqdn, uint16_t *port); diff --git a/source/dnode/mgmt/node_util/src/dmEps.c b/source/dnode/mgmt/node_util/src/dmEps.c index e9ab8a04609b37593bd5007382b89263ac2de2bb..784d2b425b2ecf46faddea1c1300e5efb2181312 100644 --- a/source/dnode/mgmt/node_util/src/dmEps.c +++ b/source/dnode/mgmt/node_util/src/dmEps.c @@ -325,6 +325,28 @@ void dmGetMnodeEpSet(SDnodeData *pData, SEpSet *pEpSet) { taosThreadRwlockUnlock(&pData->lock); } +static FORCE_INLINE void dmSwapEps(SEp *epLhs, SEp *epRhs) { + SEp epTmp; + + epTmp.port = epLhs->port; + tstrncpy(epTmp.fqdn, epLhs->fqdn, tListLen(epTmp.fqdn)); + + epLhs->port = epRhs->port; + tstrncpy(epLhs->fqdn, epRhs->fqdn, tListLen(epLhs->fqdn)); + + epRhs->port = epTmp.port; + tstrncpy(epRhs->fqdn, epTmp.fqdn, tListLen(epRhs->fqdn)); +} + +void dmRotateMnodeEpSet(SDnodeData *pData) { + taosThreadRwlockRdlock(&pData->lock); + SEpSet *pEpSet = &pData->mnodeEps; + for (int i = 1; i < pEpSet->numOfEps; i++) { + dmSwapEps(&pEpSet->eps[i - 1], &pEpSet->eps[i]); + } + taosThreadRwlockUnlock(&pData->lock); +} + void dmGetMnodeEpSetForRedirect(SDnodeData *pData, SRpcMsg *pMsg, SEpSet *pEpSet) { dmGetMnodeEpSet(pData, pEpSet); dTrace("msg is redirected, handle:%p num:%d use:%d", pMsg->info.handle, pEpSet->numOfEps, pEpSet->inUse); diff --git a/source/dnode/mnode/impl/CMakeLists.txt b/source/dnode/mnode/impl/CMakeLists.txt index 25a4397b7defabb855397862127ee4ecaead0ccd..493ba48601382bdd25ce95b1639708c9f25c202d 100644 --- a/source/dnode/mnode/impl/CMakeLists.txt +++ b/source/dnode/mnode/impl/CMakeLists.txt @@ -2,8 +2,9 @@ aux_source_directory(src MNODE_SRC) IF (TD_PRIVILEGE) ADD_DEFINITIONS(-D_PRIVILEGE) ENDIF () -IF (TD_PRIVILEGE) +IF (TD_ENTERPRISE) LIST(APPEND MNODE_SRC ${TD_ENTERPRISE_DIR}/src/plugins/privilege/src/privilege.c) + LIST(APPEND MNODE_SRC ${TD_ENTERPRISE_DIR}/src/plugins/mnode/src/mndDb.c) ENDIF () add_library(mnode STATIC ${MNODE_SRC}) diff --git a/source/dnode/mnode/impl/inc/mndDb.h b/source/dnode/mnode/impl/inc/mndDb.h index 9edfd9bf3b2e35c30639ad69ee84e3b1446271e3..97d047d7a3db51b0893ad2fd4a45c76cf1ed8424 100644 --- a/source/dnode/mnode/impl/inc/mndDb.h +++ b/source/dnode/mnode/impl/inc/mndDb.h @@ -33,6 +33,8 @@ bool mndIsDbReady(SMnode *pMnode, SDbObj *pDb); SSdbRaw *mndDbActionEncode(SDbObj *pDb); const char *mndGetDbStr(const char *src); +int32_t mndProcessCompactDbReq(SRpcMsg *pReq); + #ifdef __cplusplus } #endif diff --git a/source/dnode/mnode/impl/inc/mndDef.h b/source/dnode/mnode/impl/inc/mndDef.h index ac0c68f652635f49cd8396944fbe1db98e370bb9..ebe96fd740babea9112b3038dec7bb4725e74545 100644 --- a/source/dnode/mnode/impl/inc/mndDef.h +++ b/source/dnode/mnode/impl/inc/mndDef.h @@ -108,7 +108,8 @@ typedef enum { TRN_STAGE_UNDO_ACTION = 3, TRN_STAGE_COMMIT = 4, TRN_STAGE_COMMIT_ACTION = 5, - TRN_STAGE_FINISHED = 6 + TRN_STAGE_FINISHED = 6, + TRN_STAGE_PRE_FINISH = 7 } ETrnStage; typedef enum { @@ -542,7 +543,7 @@ void* tDecodeSMqConsumerObj(const void* buf, SMqConsumerObj* pConsumer typedef struct { int32_t vgId; - char* qmsg; + char* qmsg; // SubPlanToString SEpSet epSet; } SMqVgEp; diff --git a/source/dnode/mnode/impl/inc/mndVgroup.h b/source/dnode/mnode/impl/inc/mndVgroup.h index 51eb24f40235e21a811ef48a172c75ba09b4f396..0229735952e96d4e5e4263c10feb662d05e5fb35 100644 --- a/source/dnode/mnode/impl/inc/mndVgroup.h +++ b/source/dnode/mnode/impl/inc/mndVgroup.h @@ -43,7 +43,8 @@ int32_t mndAddDropVnodeAction(SMnode *, STrans *pTrans, SDbObj *pDb, SVgObj *pVg int32_t mndSetMoveVgroupsInfoToTrans(SMnode *, STrans *pTrans, int32_t dropDnodeId, bool force); int32_t mndBuildAlterVgroupAction(SMnode *pMnode, STrans *pTrans, SDbObj *pOldDb, SDbObj *pNewDb, SVgObj *pVgroup, SArray *pArray); -int32_t mndBuildCompactVgroupAction(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SVgObj *pVgroup, int64_t compactTs); +int32_t mndBuildCompactVgroupAction(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SVgObj *pVgroup, int64_t compactTs, + STimeWindow tw); void *mndBuildCreateVnodeReq(SMnode *, SDnodeObj *pDnode, SDbObj *pDb, SVgObj *pVgroup, int32_t *pContLen); void *mndBuildDropVnodeReq(SMnode *, SDnodeObj *pDnode, SDbObj *pDb, SVgObj *pVgroup, int32_t *pContLen); diff --git a/source/dnode/mnode/impl/src/mndConsumer.c b/source/dnode/mnode/impl/src/mndConsumer.c index 280f3b0eccb4c7d8b8b3929c24d470a05bbff399..f1ef83aca553d682092fe3a7551c8b40aba48f49 100644 --- a/source/dnode/mnode/impl/src/mndConsumer.c +++ b/source/dnode/mnode/impl/src/mndConsumer.c @@ -26,18 +26,18 @@ #define MND_CONSUMER_VER_NUMBER 1 #define MND_CONSUMER_RESERVE_SIZE 64 -#define MND_CONSUMER_LOST_HB_CNT 3 +#define MND_CONSUMER_LOST_HB_CNT 6 #define MND_CONSUMER_LOST_CLEAR_THRESHOLD 43200 -static int8_t mqRebInExecCnt = 0; +static int32_t mqRebInExecCnt = 0; static const char *mndConsumerStatusName(int status); static int32_t mndConsumerActionInsert(SSdb *pSdb, SMqConsumerObj *pConsumer); static int32_t mndConsumerActionDelete(SSdb *pSdb, SMqConsumerObj *pConsumer); -static int32_t mndConsumerActionUpdate(SSdb *pSdb, SMqConsumerObj *pConsumer, SMqConsumerObj *pNewConsumer); +static int32_t mndConsumerActionUpdate(SSdb *pSdb, SMqConsumerObj *pOldConsumer, SMqConsumerObj *pNewConsumer); static int32_t mndProcessConsumerMetaMsg(SRpcMsg *pMsg); -static int32_t mndRetrieveConsumer(SRpcMsg *pMsg, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows); +static int32_t mndRetrieveConsumer(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows); static void mndCancelGetNextConsumer(SMnode *pMnode, void *pIter); static int32_t mndProcessSubscribeReq(SRpcMsg *pMsg); @@ -76,15 +76,36 @@ int32_t mndInitConsumer(SMnode *pMnode) { void mndCleanupConsumer(SMnode *pMnode) {} bool mndRebTryStart() { - int8_t old = atomic_val_compare_exchange_8(&mqRebInExecCnt, 0, 1); + int32_t old = atomic_val_compare_exchange_32(&mqRebInExecCnt, 0, 1); + mInfo("tq timer, rebalance counter old val:%d", old); return old == 0; } -void mndRebEnd() { atomic_sub_fetch_8(&mqRebInExecCnt, 1); } +void mndRebEnd() { + mndRebCntDec(); +} -void mndRebCntInc() { atomic_add_fetch_8(&mqRebInExecCnt, 1); } +void mndRebCntInc() { + int32_t val = atomic_add_fetch_32(&mqRebInExecCnt, 1); + mInfo("rebalance trans start, rebalance counter:%d", val); +} -void mndRebCntDec() { atomic_sub_fetch_8(&mqRebInExecCnt, 1); } +void mndRebCntDec() { + while (1) { + int32_t val = atomic_load_32(&mqRebInExecCnt); + if (val <= 0) { + mError("rebalance trans end, rebalance counter:%d should not be less equalled than 0, ignore counter desc", val); + break; + } + + int32_t newVal = val - 1; + int32_t oldVal = atomic_val_compare_exchange_32(&mqRebInExecCnt, val, newVal); + if (oldVal == val) { + mInfo("rebalance trans end, rebalance counter:%d", newVal); + break; + } + } +} static int32_t mndProcessConsumerLostMsg(SRpcMsg *pMsg) { SMnode *pMnode = pMsg->info.node; @@ -298,6 +319,7 @@ static int32_t mndProcessMqTimerMsg(SRpcMsg *pMsg) { taosRUnLockLatch(&pConsumer->lock); } else if (status == MQ_CONSUMER_STATUS__MODIFY) { taosRLockLatch(&pConsumer->lock); + int32_t newTopicNum = taosArrayGetSize(pConsumer->rebNewTopics); for (int32_t i = 0; i < newTopicNum; i++) { char key[TSDB_SUBSCRIBE_KEY_LEN]; @@ -334,7 +356,7 @@ static int32_t mndProcessMqTimerMsg(SRpcMsg *pMsg) { } else { taosHashCleanup(pRebMsg->rebSubHash); rpcFreeCont(pRebMsg); - mTrace("mq rebalance finished, no modification"); + mInfo("mq rebalance finished, no modification"); mndRebEnd(); } return 0; @@ -611,10 +633,11 @@ int32_t mndProcessSubscribeReq(SRpcMsg *pMsg) { pExistedConsumer = mndAcquireConsumer(pMnode, consumerId); if (pExistedConsumer == NULL) { - mInfo("receive subscribe request from new consumer:0x%" PRIx64" cgroup:%s", consumerId, subscribe.cgroup); + mInfo("receive subscribe request from new consumer:0x%" PRIx64" cgroup:%s, numOfTopics:%d", consumerId, + subscribe.cgroup, (int32_t) taosArrayGetSize(pTopicList)); pConsumerNew = tNewSMqConsumerObj(consumerId, cgroup); - tstrncpy(pConsumerNew->clientId, subscribe.clientId, 256); + tstrncpy(pConsumerNew->clientId, subscribe.clientId, tListLen(pConsumerNew->clientId)); // set the update type pConsumerNew->updateType = CONSUMER_UPDATE__MODIFY; @@ -943,8 +966,9 @@ static int32_t mndConsumerActionUpdate(SSdb *pSdb, SMqConsumerObj *pOldConsumer, pOldConsumer->rebalanceTime = pNewConsumer->upTime; atomic_add_fetch_32(&pOldConsumer->epoch, 1); - mDebug("consumer:0x%" PRIx64 " state %s -> %s, new epoch:%d, reb-time:%" PRId64 ", current topics:%d", - pOldConsumer->consumerId, mndConsumerStatusName(status), mndConsumerStatusName(pOldConsumer->status), + mDebug("consumer:0x%" PRIx64 " state (%d)%s -> (%d)%s, new epoch:%d, reb-time:%" PRId64 ", current topics:%d", + pOldConsumer->consumerId, status, mndConsumerStatusName(status), pOldConsumer->status, + mndConsumerStatusName(pOldConsumer->status), pOldConsumer->epoch, pOldConsumer->rebalanceTime, (int)taosArrayGetSize(pOldConsumer->currentTopics)); } else if (pNewConsumer->updateType == CONSUMER_UPDATE__REMOVE) { /*A(taosArrayGetSize(pNewConsumer->rebNewTopics) == 0);*/ @@ -1002,8 +1026,9 @@ static int32_t mndConsumerActionUpdate(SSdb *pSdb, SMqConsumerObj *pOldConsumer, pOldConsumer->rebalanceTime = pNewConsumer->upTime; atomic_add_fetch_32(&pOldConsumer->epoch, 1); - mDebug("consumer:0x%" PRIx64 " state %s -> %s, new epoch:%d, reb-time:%" PRId64 ", current topics:%d", - pOldConsumer->consumerId, mndConsumerStatusName(status), mndConsumerStatusName(pOldConsumer->status), + mDebug("consumer:0x%" PRIx64 " state %d(%s) -> %d(%s), new epoch:%d, reb-time:%" PRId64 ", current topics:%d", + pOldConsumer->consumerId, status, mndConsumerStatusName(status), pOldConsumer->status, + mndConsumerStatusName(pOldConsumer->status), pOldConsumer->epoch, pOldConsumer->rebalanceTime, (int)taosArrayGetSize(pOldConsumer->currentTopics)); } @@ -1044,7 +1069,6 @@ static int32_t mndRetrieveConsumer(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock * } taosRLockLatch(&pConsumer->lock); - mDebug("showing consumer:0x%" PRIx64, pConsumer->consumerId); int32_t topicSz = taosArrayGetSize(pConsumer->assignedTopics); diff --git a/source/dnode/mnode/impl/src/mndDb.c b/source/dnode/mnode/impl/src/mndDb.c index 3efd8fb24983de5e731f3bb3ea8d35e509fe3763..e848a81d4092ccca8ea31cb54d100ad2ea7ed6a7 100644 --- a/source/dnode/mnode/impl/src/mndDb.c +++ b/source/dnode/mnode/impl/src/mndDb.c @@ -41,12 +41,15 @@ static int32_t mndProcessCreateDbReq(SRpcMsg *pReq); static int32_t mndProcessAlterDbReq(SRpcMsg *pReq); static int32_t mndProcessDropDbReq(SRpcMsg *pReq); static int32_t mndProcessUseDbReq(SRpcMsg *pReq); -static int32_t mndProcessCompactDbReq(SRpcMsg *pReq); static int32_t mndProcessTrimDbReq(SRpcMsg *pReq); static int32_t mndRetrieveDbs(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rowsCapacity); static void mndCancelGetNextDb(SMnode *pMnode, void *pIter); static int32_t mndProcessGetDbCfgReq(SRpcMsg *pReq); +#ifndef TD_ENTERPRISE +int32_t mndProcessCompactDbReq(SRpcMsg *pReq) { return TSDB_CODE_OPS_NOT_SUPPORT; } +#endif + int32_t mndInitDb(SMnode *pMnode) { SSdbTable table = { .sdbType = SDB_DB, @@ -722,6 +725,18 @@ static int32_t mndSetDbCfgFromAlterDbReq(SDbObj *pDb, SAlterDbReq *pAlter) { terrno = 0; } + if (pAlter->sstTrigger > 0 && pAlter->sstTrigger != pDb->cfg.sstTrigger) { + pDb->cfg.sstTrigger = pAlter->sstTrigger; + pDb->vgVersion++; + terrno = 0; + } + + if (pAlter->minRows > 0 && pAlter->minRows != pDb->cfg.minRows) { + pDb->cfg.minRows = pAlter->minRows; + pDb->vgVersion++; + terrno = 0; + } + return terrno; } @@ -884,12 +899,19 @@ static int32_t mndProcessGetDbCfgReq(SRpcMsg *pReq) { cfgRsp.minRows = pDb->cfg.minRows; cfgRsp.maxRows = pDb->cfg.maxRows; cfgRsp.walFsyncPeriod = pDb->cfg.walFsyncPeriod; + cfgRsp.hashPrefix = pDb->cfg.hashPrefix; + cfgRsp.hashSuffix = pDb->cfg.hashSuffix; cfgRsp.walLevel = pDb->cfg.walLevel; cfgRsp.precision = pDb->cfg.precision; cfgRsp.compression = pDb->cfg.compression; cfgRsp.replications = pDb->cfg.replications; cfgRsp.strict = pDb->cfg.strict; cfgRsp.cacheLast = pDb->cfg.cacheLast; + cfgRsp.tsdbPageSize = pDb->cfg.tsdbPageSize; + cfgRsp.walRetentionPeriod = pDb->cfg.walRetentionPeriod; + cfgRsp.walRollPeriod = pDb->cfg.walRollPeriod; + cfgRsp.walRetentionSize = pDb->cfg.walRetentionSize; + cfgRsp.walSegmentSize = pDb->cfg.walSegmentSize; cfgRsp.numOfRetensions = pDb->cfg.numOfRetensions; cfgRsp.pRetensions = pDb->cfg.pRetensions; cfgRsp.schemaless = pDb->cfg.schemaless; @@ -1395,98 +1417,6 @@ int32_t mndValidateDbInfo(SMnode *pMnode, SDbVgVersion *pDbs, int32_t numOfDbs, return 0; } -static int32_t mndSetCompactDbCommitLogs(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, int64_t compactTs) { - SDbObj dbObj = {0}; - memcpy(&dbObj, pDb, sizeof(SDbObj)); - dbObj.compactStartTime = compactTs; - - SSdbRaw *pCommitRaw = mndDbActionEncode(&dbObj); - if (pCommitRaw == NULL) return -1; - if (mndTransAppendCommitlog(pTrans, pCommitRaw) != 0) { - sdbFreeRaw(pCommitRaw); - return -1; - } - - (void)sdbSetRawStatus(pCommitRaw, SDB_STATUS_READY); - return 0; -} - -static int32_t mndSetCompactDbRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, int64_t compactTs) { - SSdb *pSdb = pMnode->pSdb; - void *pIter = NULL; - - while (1) { - SVgObj *pVgroup = NULL; - pIter = sdbFetch(pSdb, SDB_VGROUP, pIter, (void **)&pVgroup); - if (pIter == NULL) break; - - if (mndVgroupInDb(pVgroup, pDb->uid)) { - if (mndBuildCompactVgroupAction(pMnode, pTrans, pDb, pVgroup, compactTs) != 0) { - sdbCancelFetch(pSdb, pIter); - sdbRelease(pSdb, pVgroup); - return -1; - } - } - - sdbRelease(pSdb, pVgroup); - } - - return 0; -} - -static int32_t mndCompactDb(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb) { - int64_t compactTs = taosGetTimestampMs(); - int32_t code = -1; - STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_DB, pReq, "compact-db"); - if (pTrans == NULL) goto _OVER; - - mInfo("trans:%d, used to compact db:%s", pTrans->id, pDb->name); - mndTransSetDbName(pTrans, pDb->name, NULL); - if (mndTrancCheckConflict(pMnode, pTrans) != 0) goto _OVER; - if (mndSetCompactDbCommitLogs(pMnode, pTrans, pDb, compactTs) != 0) goto _OVER; - if (mndSetCompactDbRedoActions(pMnode, pTrans, pDb, compactTs) != 0) goto _OVER; - if (mndTransPrepare(pMnode, pTrans) != 0) goto _OVER; - code = 0; - -_OVER: - mndTransDrop(pTrans); - return code; -} - -static int32_t mndProcessCompactDbReq(SRpcMsg *pReq) { - SMnode *pMnode = pReq->info.node; - int32_t code = -1; - SDbObj *pDb = NULL; - SCompactDbReq compactReq = {0}; - - if (tDeserializeSCompactDbReq(pReq->pCont, pReq->contLen, &compactReq) != 0) { - terrno = TSDB_CODE_INVALID_MSG; - goto _OVER; - } - - mInfo("db:%s, start to compact", compactReq.db); - - pDb = mndAcquireDb(pMnode, compactReq.db); - if (pDb == NULL) { - goto _OVER; - } - - if (mndCheckDbPrivilege(pMnode, pReq->info.conn.user, MND_OPER_COMPACT_DB, pDb) != 0) { - goto _OVER; - } - - code = mndCompactDb(pMnode, pReq, pDb); - if (code == 0) code = TSDB_CODE_ACTION_IN_PROGRESS; - -_OVER: - if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) { - mError("db:%s, failed to process compact db req since %s", compactReq.db, terrstr()); - } - - mndReleaseDb(pMnode, pDb); - return code; -} - static int32_t mndTrimDb(SMnode *pMnode, SDbObj *pDb) { SSdb *pSdb = pMnode->pSdb; SVgObj *pVgroup = NULL; diff --git a/source/dnode/mnode/impl/src/mndDnode.c b/source/dnode/mnode/impl/src/mndDnode.c index 5dd1742e5e9b7946af75105f4dbf5923fc4b4c6d..1d9db37a7d68403781b72b1d8c9d8b43951d0261 100644 --- a/source/dnode/mnode/impl/src/mndDnode.c +++ b/source/dnode/mnode/impl/src/mndDnode.c @@ -1074,6 +1074,9 @@ static int32_t mndRetrieveDnodes(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); colDataSetVal(pColInfo, numOfRows, (const char *)&pDnode->createdTime, false); + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataSetVal(pColInfo, numOfRows, (const char *)&pDnode->rebootTime, false); + char *b = taosMemoryCalloc(VARSTR_HEADER_SIZE + strlen(offlineReason[pDnode->offlineReason]) + 1, 1); STR_TO_VARSTR(b, online ? "" : offlineReason[pDnode->offlineReason]); diff --git a/source/dnode/mnode/impl/src/mndMain.c b/source/dnode/mnode/impl/src/mndMain.c index 53a5548b2f87a5fe2e4318ad052f16f7a1d4ccd9..d83b969e2debfd3848b39c28ca316e4ef9eb3fc1 100644 --- a/source/dnode/mnode/impl/src/mndMain.c +++ b/source/dnode/mnode/impl/src/mndMain.c @@ -344,8 +344,8 @@ static int32_t mndInitWal(SMnode *pMnode) { .fsyncPeriod = 0, .rollPeriod = -1, .segSize = -1, - .retentionPeriod = -1, - .retentionSize = -1, + .retentionPeriod = 0, + .retentionSize = 0, .level = TAOS_WAL_FSYNC, }; @@ -370,7 +370,6 @@ static int32_t mndInitSdb(SMnode *pMnode) { opt.path = pMnode->path; opt.pMnode = pMnode; opt.pWal = pMnode->pWal; - opt.sync = pMnode->syncMgmt.sync; pMnode->pSdb = sdbInit(&opt); if (pMnode->pSdb == NULL) { @@ -552,16 +551,7 @@ void mndPreClose(SMnode *pMnode) { if (pMnode != NULL) { syncLeaderTransfer(pMnode->syncMgmt.sync); syncPreStop(pMnode->syncMgmt.sync); -#if 0 - while (syncSnapshotRecving(pMnode->syncMgmt.sync)) { - mInfo("vgId:1, snapshot is recving"); - taosMsleep(300); - } - while (syncSnapshotSending(pMnode->syncMgmt.sync)) { - mInfo("vgId:1, snapshot is sending"); - taosMsleep(300); - } -#endif + sdbWriteFile(pMnode->pSdb, 0); } } @@ -716,6 +706,9 @@ int32_t mndProcessRpcMsg(SRpcMsg *pMsg) { } else if (code == 0) { mGTrace("msg:%p, successfully processed", pMsg); } else { + if (code == -1) { + code = terrno; + } mGError("msg:%p, failed to process since %s, app:%p type:%s", pMsg, tstrerror(code), pMsg->info.ahandle, TMSG_INFO(pMsg->msgType)); } diff --git a/source/dnode/mnode/impl/src/mndMnode.c b/source/dnode/mnode/impl/src/mndMnode.c index aada00296e994dacedb76fd4595222ba8fc1fd62..50fab447e3c7b8fb85ece7c025059358f6ab9e6f 100644 --- a/source/dnode/mnode/impl/src/mndMnode.c +++ b/source/dnode/mnode/impl/src/mndMnode.c @@ -644,6 +644,9 @@ static int32_t mndRetrieveMnodes(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); colDataSetVal(pColInfo, numOfRows, (const char *)&pObj->createdTime, false); + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataSetVal(pColInfo, numOfRows, (const char *)&pObj->stateStartTime, false); + numOfRows++; sdbRelease(pSdb, pObj); } diff --git a/source/dnode/mnode/impl/src/mndProfile.c b/source/dnode/mnode/impl/src/mndProfile.c index 41dc57f32e19c28f482bbf708847468577bd099b..41dea5073146076e5783f763fbe43c9488c5d12d 100644 --- a/source/dnode/mnode/impl/src/mndProfile.c +++ b/source/dnode/mnode/impl/src/mndProfile.c @@ -24,7 +24,7 @@ #include "mndStb.h" #include "mndUser.h" #include "tglobal.h" -#include "version.h" +#include "tversion.h" typedef struct { uint32_t id; @@ -221,11 +221,18 @@ static int32_t mndProcessConnectReq(SRpcMsg *pReq) { char ip[24] = {0}; const STraceId *trace = &pReq->info.traceId; - if (tDeserializeSConnectReq(pReq->pCont, pReq->contLen, &connReq) != 0) { - terrno = TSDB_CODE_INVALID_MSG; + if ((code = tDeserializeSConnectReq(pReq->pCont, pReq->contLen, &connReq)) != 0) { + terrno = (-1 == code ? TSDB_CODE_INVALID_MSG : code); goto _OVER; } + if ((code = taosCheckVersionCompatibleFromStr(connReq.sVer, version, 2)) != 0) { + terrno = code; + goto _OVER; + } + + code = -1; + taosIp2String(pReq->info.conn.clientIp, ip); if (mndCheckOperPrivilege(pMnode, pReq->info.conn.user, MND_OPER_CONNECT) != 0) { mGError("user:%s, failed to login from %s since %s", pReq->info.conn.user, ip, terrstr()); diff --git a/source/dnode/mnode/impl/src/mndStream.c b/source/dnode/mnode/impl/src/mndStream.c index 2a05511134ef6ca310e9766a61e23366318da1c7..b7f80f6b0e5e84be4806268c9b6c301488a02860 100644 --- a/source/dnode/mnode/impl/src/mndStream.c +++ b/source/dnode/mnode/impl/src/mndStream.c @@ -1223,7 +1223,7 @@ static int32_t mndRetrieveStreamTask(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock // node id pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); - int32_t nodeId = TMAX(pTask->nodeId, 0); + int64_t nodeId = TMAX(pTask->nodeId, 0); colDataSetVal(pColInfo, numOfRows, (const char *)&nodeId, false); // level diff --git a/source/dnode/mnode/impl/src/mndSubscribe.c b/source/dnode/mnode/impl/src/mndSubscribe.c index 8544994c3ec2c0db0b8a559f15b32dc93ee7f16e..4d19110f31ffa9e01a38c4bd60ab375e608a65d4 100644 --- a/source/dnode/mnode/impl/src/mndSubscribe.c +++ b/source/dnode/mnode/impl/src/mndSubscribe.c @@ -224,7 +224,7 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR .pVgEp = pVgEp, }; taosHashPut(pHash, &pVgEp->vgId, sizeof(int32_t), &outputVg, sizeof(SMqRebOutputVg)); - mInfo("sub:%s mq re-balance remove vgId:%d from consumer:%" PRId64, sub, pVgEp->vgId, consumerId); + mInfo("sub:%s mq re-balance remove vgId:%d from consumer:%" PRIx64, sub, pVgEp->vgId, consumerId); } taosArrayDestroy(pConsumerEp->vgs); taosHashRemove(pOutput->pSub->consumerHash, &consumerId, sizeof(int64_t)); @@ -263,7 +263,7 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR imbConsumerNum = totalVgNum % afterRebConsumerNum; } - mInfo("sub:%s mq re-balance %d consumers: at least %d vg each, %d consumer has more vg", sub, + mInfo("sub:%s mq re-balance %d consumers: at least %d vgs each, %d consumers has more vgs", sub, afterRebConsumerNum, minVgCnt, imbConsumerNum); // 4. first scan: remove consumer more than wanted, put to remove hash @@ -296,7 +296,7 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR .pVgEp = pVgEp, }; taosHashPut(pHash, &pVgEp->vgId, sizeof(int32_t), &outputVg, sizeof(SMqRebOutputVg)); - mInfo("sub:%s mq rebalance remove vgId:%d from consumer:%" PRId64 ",(first scan)", sub, pVgEp->vgId, + mInfo("sub:%s mq rebalance remove vgId:%d from consumer:0x%" PRIx64 ",(first scan)", sub, pVgEp->vgId, pConsumerEp->consumerId); } imbCnt++; @@ -311,7 +311,7 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR .pVgEp = pVgEp, }; taosHashPut(pHash, &pVgEp->vgId, sizeof(int32_t), &outputVg, sizeof(SMqRebOutputVg)); - mInfo("sub:%s mq rebalance remove vgId:%d from consumer:%" PRId64 ",(first scan)", sub, pVgEp->vgId, + mInfo("sub:%s mq rebalance remove vgId:%d from consumer:0x%" PRIx64 ",(first scan)", sub, pVgEp->vgId, pConsumerEp->consumerId); } } @@ -329,7 +329,7 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR newConsumerEp.vgs = taosArrayInit(0, sizeof(void *)); taosHashPut(pOutput->pSub->consumerHash, &consumerId, sizeof(int64_t), &newConsumerEp, sizeof(SMqConsumerEp)); taosArrayPush(pOutput->newConsumers, &consumerId); - mInfo("sub:%s mq rebalance add new consumer:%" PRId64, sub, consumerId); + mInfo("sub:%s mq rebalance add new consumer:%" PRIx64, sub, consumerId); } } @@ -357,7 +357,7 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR taosArrayPush(pConsumerEp->vgs, &pRebVg->pVgEp); pRebVg->newConsumerId = pConsumerEp->consumerId; taosArrayPush(pOutput->rebVgs, pRebVg); - mInfo("mq rebalance: add vgId:%d to consumer:%" PRId64 " (second scan) (not enough)", pRebVg->pVgEp->vgId, + mInfo("mq rebalance: add vgId:%d to consumer:%" PRIx64 " (second scan) (not enough)", pRebVg->pVgEp->vgId, pConsumerEp->consumerId); } } @@ -387,12 +387,12 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR taosArrayPush(pConsumerEp->vgs, &pRebVg->pVgEp); pRebVg->newConsumerId = pConsumerEp->consumerId; if (pRebVg->newConsumerId == pRebVg->oldConsumerId) { - mInfo("mq rebalance: skip vg %d for same consumer:%" PRId64 " (second scan)", pRebVg->pVgEp->vgId, + mInfo("mq rebalance: skip vg %d for same consumer:%" PRIx64 " (second scan)", pRebVg->pVgEp->vgId, pConsumerEp->consumerId); continue; } taosArrayPush(pOutput->rebVgs, pRebVg); - mInfo("mq rebalance: add vgId:%d to consumer:%" PRId64 " (second scan) (unassigned)", pRebVg->pVgEp->vgId, + mInfo("mq rebalance: add vgId:%d to consumer:%" PRIx64 " (second scan) (unassigned)", pRebVg->pVgEp->vgId, pConsumerEp->consumerId); } } else { @@ -427,10 +427,10 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR if (pIter == NULL) break; SMqConsumerEp *pConsumerEp = (SMqConsumerEp *)pIter; int32_t sz = taosArrayGetSize(pConsumerEp->vgs); - mInfo("sub:%s mq re-balance final cfg: consumer:0x%" PRId64 " has %d vg", sub, pConsumerEp->consumerId, sz); + mInfo("sub:%s mq re-balance final cfg: consumer:0x%" PRIx64 " has %d vg", sub, pConsumerEp->consumerId, sz); for (int32_t i = 0; i < sz; i++) { SMqVgEp *pVgEp = taosArrayGetP(pConsumerEp->vgs, i); - mInfo("sub:%s mq re-balance final cfg: vg %d to consumer:0x%" PRId64, sub, pVgEp->vgId, + mInfo("sub:%s mq re-balance final cfg: vg %d to consumer:0x%" PRIx64, sub, pVgEp->vgId, pConsumerEp->consumerId); } } @@ -444,7 +444,9 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR static int32_t mndPersistRebResult(SMnode *pMnode, SRpcMsg *pMsg, const SMqRebOutputObj *pOutput) { STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_DB_INSIDE, pMsg, "tmq-reb"); - if (pTrans == NULL) return -1; + if (pTrans == NULL) { + return -1; + } mndTransSetDbName(pTrans, pOutput->pSub->dbName, NULL); if (mndTrancCheckConflict(pMnode, pTrans) != 0) { @@ -591,13 +593,13 @@ static int32_t mndProcessRebalanceReq(SRpcMsg *pMsg) { rebOutput.pSub = mndCreateSubscription(pMnode, pTopic, pRebInfo->key); if (rebOutput.pSub == NULL) { - mError("mq rebalance %s failed create sub since %s, abort", pRebInfo->key, terrstr()); + mError("mq rebalance %s failed create sub since %s, ignore", pRebInfo->key, terrstr()); taosRUnLockLatch(&pTopic->lock); mndReleaseTopic(pMnode, pTopic); continue; } - memcpy(rebOutput.pSub->dbName, pTopic->db, TSDB_DB_FNAME_LEN); + memcpy(rebOutput.pSub->dbName, pTopic->db, TSDB_DB_FNAME_LEN); taosRUnLockLatch(&pTopic->lock); mndReleaseTopic(pMnode, pTopic); @@ -616,9 +618,9 @@ static int32_t mndProcessRebalanceReq(SRpcMsg *pMsg) { // if add more consumer to balanced subscribe, // possibly no vg is changed - + // when each topic is re-balanced, issue an trans to save the results in sdb. if (mndPersistRebResult(pMnode, pMsg, &rebOutput) < 0) { - mError("mq re-balance persist re-balance output error, possibly vnode splitted or dropped"); + mError("mq re-balance persist output error, possibly vnode splitted or dropped"); } taosArrayDestroy(pRebInfo->lostConsumers); @@ -770,7 +772,7 @@ static SSdbRow *mndSubActionDecode(SSdbRaw *pRaw) { if (pSub->unassignedVgs != NULL) { int32_t size = (int32_t)taosArrayGetSize(pSub->unassignedVgs); for (int32_t i = 0; i < size; ++i) { - SMqVgEp *pMqVgEp = taosArrayGet(pSub->unassignedVgs, i); + SMqVgEp *pMqVgEp = (SMqVgEp *)taosArrayGetP(pSub->unassignedVgs, i); tmsgUpdateDnodeEpSet(&pMqVgEp->epSet); } } @@ -780,7 +782,7 @@ static SSdbRow *mndSubActionDecode(SSdbRaw *pRaw) { SMqConsumerEp *pConsumerEp = pIter; int32_t size = (int32_t)taosArrayGetSize(pConsumerEp->vgs); for (int32_t i = 0; i < size; ++i) { - SMqVgEp *pMqVgEp = taosArrayGet(pConsumerEp->vgs, i); + SMqVgEp *pMqVgEp = (SMqVgEp *)taosArrayGetP(pConsumerEp->vgs, i); tmsgUpdateDnodeEpSet(&pMqVgEp->epSet); } pIter = taosHashIterate(pSub->consumerHash, pIter); @@ -1017,7 +1019,7 @@ int32_t mndRetrieveSubscribe(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); colDataSetVal(pColInfo, numOfRows, (const char *)&pConsumerEp->consumerId, false); - mDebug("mnd show subscriptions: topic %s, consumer %" PRId64 " cgroup %s vgid %d", varDataVal(topic), + mDebug("mnd show subscriptions: topic %s, consumer:%" PRIx64 " cgroup %s vgid %d", varDataVal(topic), pConsumerEp->consumerId, varDataVal(cgroup), pVgEp->vgId); // offset diff --git a/source/dnode/mnode/impl/src/mndSync.c b/source/dnode/mnode/impl/src/mndSync.c index f618b8afaea6642f723534934dfe175079738c67..f702d8f14858f13525f893737f02cc40beab8355 100644 --- a/source/dnode/mnode/impl/src/mndSync.c +++ b/source/dnode/mnode/impl/src/mndSync.c @@ -118,12 +118,12 @@ int32_t mndProcessWriteMsg(const SSyncFSM *pFsm, SRpcMsg *pMsg, const SFsmCbMeta transId, pTrans->createdTime, pMgmt->transId); mndTransExecute(pMnode, pTrans, false); mndReleaseTrans(pMnode, pTrans); - // sdbWriteFile(pMnode->pSdb, SDB_WRITE_DELTA); } else { mError("trans:%d, not found while execute in mnode since %s", transId, terrstr()); } } + sdbWriteFile(pMnode->pSdb, tsMndSdbWriteDelta); return 0; } @@ -319,6 +319,7 @@ int32_t mndInitSync(SMnode *pMnode) { mError("failed to open sync since %s", terrstr()); return -1; } + pMnode->pSdb->sync = pMgmt->sync; mInfo("mnode-sync is opened, id:%" PRId64, pMgmt->sync); return 0; diff --git a/source/dnode/mnode/impl/src/mndTrans.c b/source/dnode/mnode/impl/src/mndTrans.c index a34dfff4d6ec679e9ddd450df4efa465ed3fc7eb..39b4252618f33f4cc114eab0116e5617953ac35a 100644 --- a/source/dnode/mnode/impl/src/mndTrans.c +++ b/source/dnode/mnode/impl/src/mndTrans.c @@ -460,6 +460,8 @@ static const char *mndTransStr(ETrnStage stage) { return "commitAction"; case TRN_STAGE_FINISHED: return "finished"; + case TRN_STAGE_PRE_FINISH: + return "pre-finish"; default: return "invalid"; } @@ -503,14 +505,15 @@ static TransCbFp mndTransGetCbFp(ETrnFunc ftype) { } static int32_t mndTransActionInsert(SSdb *pSdb, STrans *pTrans) { - mTrace("trans:%d, perform insert action, row:%p stage:%s", pTrans->id, pTrans, mndTransStr(pTrans->stage)); + mInfo("trans:%d, perform insert action, row:%p stage:%s, callfunc:1, startFunc:%d", pTrans->id, pTrans, mndTransStr(pTrans->stage), + pTrans->startFunc); if (pTrans->startFunc > 0) { TransCbFp fp = mndTransGetCbFp(pTrans->startFunc); if (fp) { (*fp)(pSdb->pMnode, pTrans->param, pTrans->paramLen); } - pTrans->startFunc = 0; + // pTrans->startFunc = 0; } return 0; @@ -546,14 +549,15 @@ static void mndTransDropData(STrans *pTrans) { } static int32_t mndTransActionDelete(SSdb *pSdb, STrans *pTrans, bool callFunc) { - mTrace("trans:%d, perform delete action, row:%p stage:%s callfunc:%d", pTrans->id, pTrans, mndTransStr(pTrans->stage), - callFunc); + mInfo("trans:%d, perform delete action, row:%p stage:%s callfunc:%d, stopFunc:%d", pTrans->id, pTrans, + mndTransStr(pTrans->stage), callFunc, pTrans->stopFunc); + if (pTrans->stopFunc > 0 && callFunc) { TransCbFp fp = mndTransGetCbFp(pTrans->stopFunc); if (fp) { (*fp)(pSdb->pMnode, pTrans->param, pTrans->paramLen); } - pTrans->stopFunc = 0; + // pTrans->stopFunc = 0; } mndTransDropData(pTrans); @@ -572,7 +576,7 @@ static void mndTransUpdateActions(SArray *pOldArray, SArray *pNewArray) { } static int32_t mndTransActionUpdate(SSdb *pSdb, STrans *pOld, STrans *pNew) { - mTrace("trans:%d, perform update action, old row:%p stage:%s create:%" PRId64 ", new row:%p stage:%s create:%" PRId64, + mInfo("trans:%d, perform update action, old row:%p stage:%s create:%" PRId64 ", new row:%p stage:%s create:%" PRId64, pOld->id, pOld, mndTransStr(pOld->stage), pOld->createdTime, pNew, mndTransStr(pNew->stage), pNew->createdTime); @@ -598,10 +602,15 @@ static int32_t mndTransActionUpdate(SSdb *pSdb, STrans *pOld, STrans *pNew) { } if (pOld->stage == TRN_STAGE_ROLLBACK) { - pOld->stage = TRN_STAGE_REDO_ACTION; + pOld->stage = TRN_STAGE_UNDO_ACTION; mTrace("trans:%d, stage from rollback to undoAction since perform update action", pNew->id); } + if (pOld->stage == TRN_STAGE_PRE_FINISH) { + pOld->stage = TRN_STAGE_FINISHED; + mTrace("trans:%d, stage from pre-finish to finished since perform update action", pNew->id); + } + return 0; } @@ -866,6 +875,7 @@ int32_t mndTrancCheckConflict(SMnode *pMnode, STrans *pTrans) { } } + if (mndCheckTransConflict(pMnode, pTrans)) { terrno = TSDB_CODE_MND_TRANS_CONFLICT; mError("trans:%d, failed to prepare since %s", pTrans->id, terrstr()); @@ -931,6 +941,16 @@ static int32_t mndTransRollback(SMnode *pMnode, STrans *pTrans) { return 0; } +static int32_t mndTransPreFinish(SMnode *pMnode, STrans *pTrans) { + mInfo("trans:%d, pre-finish transaction", pTrans->id); + if (mndTransSync(pMnode, pTrans) != 0) { + mError("trans:%d, failed to pre-finish since %s", pTrans->id, terrstr()); + return -1; + } + mInfo("trans:%d, pre-finish finished", pTrans->id); + return 0; +} + static void mndTransSendRpcRsp(SMnode *pMnode, STrans *pTrans) { bool sendRsp = false; int32_t code = pTrans->code; @@ -1437,7 +1457,7 @@ static bool mndTransPerformCommitActionStage(SMnode *pMnode, STrans *pTrans) { if (code == 0) { pTrans->code = 0; - pTrans->stage = TRN_STAGE_FINISHED; + pTrans->stage = TRN_STAGE_FINISHED; // TRN_STAGE_PRE_FINISH is not necessary mInfo("trans:%d, stage from commitAction to finished", pTrans->id); continueExec = true; } else { @@ -1455,8 +1475,8 @@ static bool mndTransPerformUndoActionStage(SMnode *pMnode, STrans *pTrans) { int32_t code = mndTransExecuteUndoActions(pMnode, pTrans); if (code == 0) { - pTrans->stage = TRN_STAGE_FINISHED; - mInfo("trans:%d, stage from undoAction to finished", pTrans->id); + pTrans->stage = TRN_STAGE_PRE_FINISH; + mInfo("trans:%d, stage from undoAction to pre-finish", pTrans->id); continueExec = true; } else if (code == TSDB_CODE_ACTION_IN_PROGRESS) { mInfo("trans:%d, stage keep on undoAction since %s", pTrans->id, tstrerror(code)); @@ -1489,6 +1509,25 @@ static bool mndTransPerformRollbackStage(SMnode *pMnode, STrans *pTrans) { return continueExec; } +static bool mndTransPerfromPreFinishedStage(SMnode *pMnode, STrans *pTrans) { + if (mndCannotExecuteTransAction(pMnode)) return false; + + bool continueExec = true; + int32_t code = mndTransPreFinish(pMnode, pTrans); + + if (code == 0) { + pTrans->stage = TRN_STAGE_FINISHED; + mInfo("trans:%d, stage from pre-finish to finish", pTrans->id); + continueExec = true; + } else { + pTrans->failedTimes++; + mError("trans:%d, stage keep on pre-finish since %s, failedTimes:%d", pTrans->id, terrstr(), pTrans->failedTimes); + continueExec = false; + } + + return continueExec; +} + static bool mndTransPerfromFinishedStage(SMnode *pMnode, STrans *pTrans) { bool continueExec = false; @@ -1545,6 +1584,14 @@ void mndTransExecute(SMnode *pMnode, STrans *pTrans, bool isLeader) { case TRN_STAGE_UNDO_ACTION: continueExec = mndTransPerformUndoActionStage(pMnode, pTrans); break; + case TRN_STAGE_PRE_FINISH: + if (isLeader) { + continueExec = mndTransPerfromPreFinishedStage(pMnode, pTrans); + } else { + mInfo("trans:%d, can not pre-finish since not leader", pTrans->id); + continueExec = false; + } + break; case TRN_STAGE_FINISHED: continueExec = mndTransPerfromFinishedStage(pMnode, pTrans); break; @@ -1645,8 +1692,6 @@ void mndTransPullup(SMnode *pMnode) { } mndReleaseTrans(pMnode, pTrans); } - - sdbWriteFile(pMnode->pSdb, SDB_WRITE_DELTA); taosArrayDestroy(pArray); } diff --git a/source/dnode/mnode/impl/src/mndUser.c b/source/dnode/mnode/impl/src/mndUser.c index 23822c8f208deb9761f66b32d0b0b31fc0f0e55a..92b73aed964ee47f3751ffae84af81ac6f5458de 100644 --- a/source/dnode/mnode/impl/src/mndUser.c +++ b/source/dnode/mnode/impl/src/mndUser.c @@ -337,7 +337,11 @@ SUserObj *mndAcquireUser(SMnode *pMnode, const char *userName) { SSdb *pSdb = pMnode->pSdb; SUserObj *pUser = sdbAcquire(pSdb, SDB_USER, userName); if (pUser == NULL) { - terrno = TSDB_CODE_MND_USER_NOT_EXIST; + if (terrno == TSDB_CODE_SDB_OBJ_NOT_THERE) { + terrno = TSDB_CODE_MND_USER_NOT_EXIST; + } else { + terrno = TSDB_CODE_MND_USER_NOT_AVAILABLE; + } } return pUser; } diff --git a/source/dnode/mnode/impl/src/mndVgroup.c b/source/dnode/mnode/impl/src/mndVgroup.c index b7bcaf41fdfd28f22f0783e182ec297f330d29ba..84e8a9ec4384847173c744a9db8d542702b62306 100644 --- a/source/dnode/mnode/impl/src/mndVgroup.c +++ b/source/dnode/mnode/impl/src/mndVgroup.c @@ -319,6 +319,8 @@ static void *mndBuildAlterVnodeConfigReq(SMnode *pMnode, SDbObj *pDb, SVgObj *pV alterReq.walLevel = pDb->cfg.walLevel; alterReq.strict = pDb->cfg.strict; alterReq.cacheLast = pDb->cfg.cacheLast; + alterReq.sttTrigger = pDb->cfg.sstTrigger; + alterReq.minRows = pDb->cfg.minRows; mInfo("vgId:%d, build alter vnode config req", pVgroup->vgId); int32_t contLen = tSerializeSAlterVnodeConfigReq(NULL, 0, &alterReq); @@ -2209,11 +2211,12 @@ _OVER: bool mndVgroupInDb(SVgObj *pVgroup, int64_t dbUid) { return !pVgroup->isTsma && pVgroup->dbUid == dbUid; } -static void *mndBuildCompactVnodeReq(SMnode *pMnode, SDbObj *pDb, SVgObj *pVgroup, int32_t *pContLen, - int64_t compactTs) { +static void *mndBuildCompactVnodeReq(SMnode *pMnode, SDbObj *pDb, SVgObj *pVgroup, int32_t *pContLen, int64_t compactTs, + STimeWindow tw) { SCompactVnodeReq compactReq = {0}; compactReq.dbUid = pDb->uid; compactReq.compactStartTime = compactTs; + compactReq.tw = tw; tstrncpy(compactReq.db, pDb->name, TSDB_DB_FNAME_LEN); mInfo("vgId:%d, build compact vnode config req", pVgroup->vgId); @@ -2239,13 +2242,13 @@ static void *mndBuildCompactVnodeReq(SMnode *pMnode, SDbObj *pDb, SVgObj *pVgrou return pReq; } -static int32_t mndAddCompactVnodeAction(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SVgObj *pVgroup, - int64_t compactTs) { +static int32_t mndAddCompactVnodeAction(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SVgObj *pVgroup, int64_t compactTs, + STimeWindow tw) { STransAction action = {0}; action.epSet = mndGetVgroupEpset(pMnode, pVgroup); int32_t contLen = 0; - void *pReq = mndBuildCompactVnodeReq(pMnode, pDb, pVgroup, &contLen, compactTs); + void *pReq = mndBuildCompactVnodeReq(pMnode, pDb, pVgroup, &contLen, compactTs, tw); if (pReq == NULL) return -1; action.pCont = pReq; @@ -2260,7 +2263,8 @@ static int32_t mndAddCompactVnodeAction(SMnode *pMnode, STrans *pTrans, SDbObj * return 0; } -int32_t mndBuildCompactVgroupAction(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SVgObj *pVgroup, int64_t compactTs) { - if (mndAddCompactVnodeAction(pMnode, pTrans, pDb, pVgroup, compactTs) != 0) return -1; +int32_t mndBuildCompactVgroupAction(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SVgObj *pVgroup, int64_t compactTs, + STimeWindow tw) { + if (mndAddCompactVnodeAction(pMnode, pTrans, pDb, pVgroup, compactTs, tw) != 0) return -1; return 0; } \ No newline at end of file diff --git a/source/dnode/mnode/impl/test/profile/profile.cpp b/source/dnode/mnode/impl/test/profile/profile.cpp index 2ae113e0514bdec8c5c7c038ee2cbb9497bf2dec..6ab6d364cb6f326e37521815b7b5cf0b8fdc82ef 100644 --- a/source/dnode/mnode/impl/test/profile/profile.cpp +++ b/source/dnode/mnode/impl/test/profile/profile.cpp @@ -32,13 +32,14 @@ TEST_F(MndTestProfile, 01_ConnectMsg) { connectReq.pid = 1234; char passwd[] = "taosdata"; - char secretEncrypt[TSDB_PASSWORD_LEN] = {0}; + char secretEncrypt[TSDB_PASSWORD_LEN + 1] = {0}; taosEncryptPass_c((uint8_t*)passwd, strlen(passwd), secretEncrypt); strcpy(connectReq.app, "mnode_test_profile"); strcpy(connectReq.db, ""); strcpy(connectReq.user, "root"); strcpy(connectReq.passwd, secretEncrypt); + strcpy(connectReq.sVer, version); int32_t contLen = tSerializeSConnectReq(NULL, 0, &connectReq); void* pReq = rpcMallocCont(contLen); @@ -66,7 +67,7 @@ TEST_F(MndTestProfile, 01_ConnectMsg) { TEST_F(MndTestProfile, 02_ConnectMsg_InvalidDB) { char passwd[] = "taosdata"; - char secretEncrypt[TSDB_PASSWORD_LEN] = {0}; + char secretEncrypt[TSDB_PASSWORD_LEN + 1] = {0}; taosEncryptPass_c((uint8_t*)passwd, strlen(passwd), secretEncrypt); SConnectReq connectReq = {0}; @@ -75,6 +76,7 @@ TEST_F(MndTestProfile, 02_ConnectMsg_InvalidDB) { strcpy(connectReq.db, "invalid_db"); strcpy(connectReq.user, "root"); strcpy(connectReq.passwd, secretEncrypt); + strcpy(connectReq.sVer, version); int32_t contLen = tSerializeSConnectReq(NULL, 0, &connectReq); void* pReq = rpcMallocCont(contLen); diff --git a/source/dnode/mnode/impl/test/show/show.cpp b/source/dnode/mnode/impl/test/show/show.cpp index 0ccefa7ca2c265afe299a55b218d46be291c463e..2e67ffa946d68edb8e7f73ef2082ea7a3c8fc734 100644 --- a/source/dnode/mnode/impl/test/show/show.cpp +++ b/source/dnode/mnode/impl/test/show/show.cpp @@ -55,7 +55,7 @@ TEST_F(MndTestShow, 02_ShowMsg_InvalidMsgStart) { TEST_F(MndTestShow, 03_ShowMsg_Conn) { char passwd[] = "taosdata"; - char secretEncrypt[TSDB_PASSWORD_LEN] = {0}; + char secretEncrypt[TSDB_PASSWORD_LEN + 1] = {0}; taosEncryptPass_c((uint8_t*)passwd, strlen(passwd), secretEncrypt); SConnectReq connectReq = {0}; @@ -64,6 +64,7 @@ TEST_F(MndTestShow, 03_ShowMsg_Conn) { strcpy(connectReq.db, ""); strcpy(connectReq.user, "root"); strcpy(connectReq.passwd, secretEncrypt); + strcpy(connectReq.sVer, version); int32_t contLen = tSerializeSConnectReq(NULL, 0, &connectReq); void* pReq = rpcMallocCont(contLen); diff --git a/source/dnode/mnode/sdb/inc/sdb.h b/source/dnode/mnode/sdb/inc/sdb.h index 8d2cec478c8d2b3f81231122a4c6d14065ae959b..e9a9e425e3fd364a1702ca084edd8be4e0b4aeeb 100644 --- a/source/dnode/mnode/sdb/inc/sdb.h +++ b/source/dnode/mnode/sdb/inc/sdb.h @@ -37,8 +37,6 @@ extern "C" { #define mTrace(...) { if (mDebugFlag & DEBUG_TRACE) { taosPrintLog("MND ", DEBUG_TRACE, mDebugFlag, __VA_ARGS__); }} // clang-format on -#define SDB_WRITE_DELTA 20 - #define SDB_GET_VAL(pData, dataPos, val, pos, func, type) \ { \ if (func(pRaw, dataPos, val) != 0) { \ diff --git a/source/dnode/mnode/sdb/src/sdb.c b/source/dnode/mnode/sdb/src/sdb.c index bb8040da0773e83ba494ff0325d8b8a1ddf93c7b..9797dd8337b424fb0118e14222225f1847250b43 100644 --- a/source/dnode/mnode/sdb/src/sdb.c +++ b/source/dnode/mnode/sdb/src/sdb.c @@ -53,7 +53,6 @@ SSdb *sdbInit(SSdbOpt *pOption) { } pSdb->pWal = pOption->pWal; - pSdb->sync = pOption->sync; pSdb->applyIndex = -1; pSdb->applyTerm = -1; pSdb->applyConfig = -1; diff --git a/source/dnode/mnode/sdb/src/sdbFile.c b/source/dnode/mnode/sdb/src/sdbFile.c index c2d27ad713819f43153222626dce945d291c3e15..2e182ec10bcb4833e837ec621d2079fe50b21f4c 100644 --- a/source/dnode/mnode/sdb/src/sdbFile.c +++ b/source/dnode/mnode/sdb/src/sdbFile.c @@ -472,10 +472,7 @@ int32_t sdbWriteFile(SSdb *pSdb, int32_t delta) { taosThreadMutexLock(&pSdb->filelock); if (pSdb->pWal != NULL) { - // code = walBeginSnapshot(pSdb->pWal, pSdb->applyIndex, 0); - if (pSdb->sync == 0) { - code = 0; - } else { + if (pSdb->sync > 0) { code = syncBeginSnapshot(pSdb->sync, pSdb->applyIndex); } } @@ -484,11 +481,7 @@ int32_t sdbWriteFile(SSdb *pSdb, int32_t delta) { } if (code == 0) { if (pSdb->pWal != NULL) { - // code = walEndSnapshot(pSdb->pWal); - - if (pSdb->sync == 0) { - code = 0; - } else { + if (pSdb->sync > 0) { code = syncEndSnapshot(pSdb->sync); } } diff --git a/source/dnode/mnode/sdb/src/sdbHash.c b/source/dnode/mnode/sdb/src/sdbHash.c index cc3dba2e07d64f68c017d1b6377fc81f99cad435..569c78a68c0c560e0272521fd2512089f63ca593 100644 --- a/source/dnode/mnode/sdb/src/sdbHash.c +++ b/source/dnode/mnode/sdb/src/sdbHash.c @@ -160,6 +160,7 @@ static int32_t sdbInsertRow(SSdb *pSdb, SHashObj *hash, SSdbRaw *pRaw, SSdbRow * if (insertFp != NULL) { code = (*insertFp)(pSdb, pRow->pObj); if (code != 0) { + if (terrno == 0) terrno = TSDB_CODE_MND_TRANS_UNKNOW_ERROR; code = terrno; taosHashRemove(hash, pRow->pObj, keySize); sdbFreeRow(pSdb, pRow, false); diff --git a/source/dnode/vnode/CMakeLists.txt b/source/dnode/vnode/CMakeLists.txt index 8b13d8f02b3727563352b505da38595acc4f75b2..8dc3f46ae3d53d4e78c32a168e97defdcb87baf1 100644 --- a/source/dnode/vnode/CMakeLists.txt +++ b/source/dnode/vnode/CMakeLists.txt @@ -14,7 +14,6 @@ target_sources( "src/vnd/vnodeSvr.c" "src/vnd/vnodeSync.c" "src/vnd/vnodeSnapshot.c" - "src/vnd/vnodeCompact.c" "src/vnd/vnodeRetention.c" # meta @@ -53,7 +52,6 @@ target_sources( "src/tsdb/tsdbCacheRead.c" "src/tsdb/tsdbRetention.c" "src/tsdb/tsdbDiskData.c" - "src/tsdb/tsdbCompact.c" "src/tsdb/tsdbMergeTree.c" "src/tsdb/tsdbDataIter.c" @@ -69,10 +67,20 @@ target_sources( "src/tq/tqSnapshot.c" "src/tq/tqOffsetSnapshot.c" ) + +IF (TD_VNODE_PLUGINS) + target_sources( + vnode + PRIVATE + ${TD_ENTERPRISE_DIR}/src/plugins/vnode/src/tsdbCompact.c + ${TD_ENTERPRISE_DIR}/src/plugins/vnode/src/vnodeCompact.c + ) +ENDIF () + target_include_directories( vnode PUBLIC "inc" - PRIVATE "src/inc" + PUBLIC "src/inc" PUBLIC "${TD_SOURCE_DIR}/include/libs/scalar" ) target_link_libraries( diff --git a/source/dnode/vnode/inc/vnode.h b/source/dnode/vnode/inc/vnode.h index acfaccafe27c21aa6bf4074ae8759a76f088bae7..1d14829891c602587f90f7aa38d1eeefb4b7b875 100644 --- a/source/dnode/vnode/inc/vnode.h +++ b/source/dnode/vnode/inc/vnode.h @@ -264,7 +264,7 @@ int32_t tqReaderSetTbUidList(STqReader *pReader, const SArray *tbUidList); int32_t tqReaderAddTbUidList(STqReader *pReader, const SArray *tbUidList); int32_t tqReaderRemoveTbUidList(STqReader *pReader, const SArray *tbUidList); -int32_t tqSeekVer(STqReader *pReader, int64_t ver); +int32_t tqSeekVer(STqReader *pReader, int64_t ver, const char* id); int32_t tqNextBlock(STqReader *pReader, SFetchRet *ret); int32_t tqReaderSetSubmitReq2(STqReader *pReader, void *msgStr, int32_t msgLen, int64_t ver); diff --git a/source/dnode/vnode/src/inc/tq.h b/source/dnode/vnode/src/inc/tq.h index 104e0945ba978815e38f17ecf107ff73c2f2905a..792fed2309e95d89fdf0616cd4f28e9bf58019e6 100644 --- a/source/dnode/vnode/src/inc/tq.h +++ b/source/dnode/vnode/src/inc/tq.h @@ -67,7 +67,7 @@ typedef struct { // tqExec typedef struct { - char* qmsg; + char* qmsg; // SubPlanToString } STqExecCol; typedef struct { diff --git a/source/dnode/vnode/src/inc/tsdb.h b/source/dnode/vnode/src/inc/tsdb.h index 44b7e95f9e43d3037c5171e58ab2fc57b3465b06..b2e1e8ab34f627e17d431e4b0624bfa3166fdd73 100644 --- a/source/dnode/vnode/src/inc/tsdb.h +++ b/source/dnode/vnode/src/inc/tsdb.h @@ -766,6 +766,7 @@ typedef struct SCacheRowsReader { TdThreadMutex readerMutex; SVnode *pVnode; STSchema *pSchema; + STSchema *pCurrSchema; uint64_t uid; uint64_t suid; char **transferBuf; // todo remove it soon @@ -779,6 +780,7 @@ typedef struct SCacheRowsReader { SDataFReader *pDataFReader; SDataFReader *pDataFReaderLast; const char *idstr; + int64_t lastTs; } SCacheRowsReader; typedef struct { diff --git a/source/dnode/vnode/src/inc/vnd.h b/source/dnode/vnode/src/inc/vnd.h index 88cd1d99e1d9fda6dc28479c4c500220ca37ab96..134909090f1c14f2972b98bf00d9d7c0486b5588 100644 --- a/source/dnode/vnode/src/inc/vnd.h +++ b/source/dnode/vnode/src/inc/vnd.h @@ -106,10 +106,6 @@ int32_t vnodeSyncCommit(SVnode* pVnode); int32_t vnodeAsyncCommit(SVnode* pVnode); bool vnodeShouldRollback(SVnode* pVnode); -// vnodeCompact.c -int32_t vnodeAsyncCompact(SVnode* pVnode); -int32_t vnodeSyncCompact(SVnode* pVnode); - // vnodeSync.c int32_t vnodeSyncOpen(SVnode* pVnode, char* path); int32_t vnodeSyncStart(SVnode* pVnode); diff --git a/source/dnode/vnode/src/inc/vnodeInt.h b/source/dnode/vnode/src/inc/vnodeInt.h index c0d017e350c3089755eff9fddeb4ac19353830d1..0dff2420ec4013c251de993c8195273dc29c91ac 100644 --- a/source/dnode/vnode/src/inc/vnodeInt.h +++ b/source/dnode/vnode/src/inc/vnodeInt.h @@ -457,9 +457,10 @@ struct SCommitInfo { }; struct SCompactInfo { - SVnode* pVnode; - int32_t flag; - int64_t commitID; + SVnode* pVnode; + int32_t flag; + int64_t commitID; + STimeWindow tw; }; #ifdef __cplusplus diff --git a/source/dnode/vnode/src/tq/tq.c b/source/dnode/vnode/src/tq/tq.c index c465617975858c6a91bce96c009126e0b1c1580a..5d3350a69a463ade11e51bb731e2041978d600a8 100644 --- a/source/dnode/vnode/src/tq/tq.c +++ b/source/dnode/vnode/src/tq/tq.c @@ -488,7 +488,7 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg) { // 2. check rebalance if (pHandle->consumerId != consumerId) { - tqError("tmq poll: consumer:0x%" PRIx64 " vgId:%d, subkey %s, mismatch for saved handle consumer:0x%" PRIx64, + tqDebug("ERROR tmq poll: consumer:0x%" PRIx64 " vgId:%d, subkey %s, mismatch for saved handle consumer:0x%" PRIx64, consumerId, TD_VID(pTq->pVnode), req.subKey, pHandle->consumerId); terrno = TSDB_CODE_TMQ_CONSUMER_MISMATCH; return -1; @@ -575,7 +575,6 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg) { return -1; } -#if 1 // till now, all data has been rsp to consumer, new data needs to push client once arrived. if (dataRsp.blockNum == 0 && dataRsp.reqOffset.type == TMQ_OFFSET__LOG && dataRsp.reqOffset.version == dataRsp.rspOffset.version) { @@ -597,7 +596,6 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg) { return 0; } } -#endif taosWUnLockLatch(&pTq->pushLock); if (tqSendDataRsp(pTq, pMsg, &req, &dataRsp) < 0) { @@ -613,10 +611,7 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg) { } // for taosx - /*A(pHandle->execHandle.subType != TOPIC_SUB_TYPE__COLUMN);*/ - SMqMetaRsp metaRsp = {0}; - STaosxRsp taosxRsp = {0}; tqInitTaosxRsp(&taosxRsp, &req); @@ -827,6 +822,7 @@ int32_t tqProcessSubscribeReq(STQ* pTq, int64_t sversion, char* msg, int32_t msg pHandle = &tqHandle; /*taosInitRWLatch(&pExec->lock);*/ + uint64_t oldConsumerId = pHandle->consumerId; memcpy(pHandle->subKey, req.subKey, TSDB_SUBSCRIBE_KEY_LEN); pHandle->consumerId = req.newConsumerId; pHandle->epoch = -1; @@ -889,13 +885,16 @@ int32_t tqProcessSubscribeReq(STQ* pTq, int64_t sversion, char* msg, int32_t msg (SSnapContext**)(&handle.sContext)); pHandle->execHandle.task = qCreateQueueExecTaskInfo(NULL, &handle, NULL, NULL); } + taosHashPut(pTq->pHandle, req.subKey, strlen(req.subKey), pHandle, sizeof(STqHandle)); - tqDebug("try to persist handle %s consumer:0x%" PRIx64, req.subKey, pHandle->consumerId); + tqDebug("try to persist handle %s consumer:0x%" PRIx64" , old consumer:0x%"PRIx64, req.subKey, pHandle->consumerId, + oldConsumerId); if (tqMetaSaveHandle(pTq, req.subKey, pHandle) < 0) { return -1; } } else { // TODO handle qmsg and exec modification + tqInfo("update the consumer info, old consumer id:0x%"PRIx64", new Id:0x%"PRIx64, pHandle->consumerId, req.newConsumerId); atomic_store_32(&pHandle->epoch, -1); atomic_store_64(&pHandle->consumerId, req.newConsumerId); atomic_add_fetch_32(&pHandle->epoch, 1); @@ -903,6 +902,7 @@ int32_t tqProcessSubscribeReq(STQ* pTq, int64_t sversion, char* msg, int32_t msg if (pHandle->execHandle.subType == TOPIC_SUB_TYPE__COLUMN) { qStreamCloseTsdbReader(pHandle->execHandle.task); } + if (tqMetaSaveHandle(pTq, req.subKey, pHandle) < 0) { return -1; } @@ -983,11 +983,15 @@ int32_t tqExpandTask(STQ* pTq, SStreamTask* pTask, int64_t ver) { pTask->tbSink.vnode = pTq->pVnode; pTask->tbSink.tbSinkFunc = tqSinkToTablePipeline2; - /*A(pTask->tbSink.pSchemaWrapper);*/ - /*A(pTask->tbSink.pSchemaWrapper->pSchema);*/ + int32_t version = 1; + SMetaInfo info = {0}; + int32_t code = metaGetInfo(pTq->pVnode->pMeta, pTask->tbSink.stbUid, &info, NULL); + if (code == TSDB_CODE_SUCCESS) { + version = info.skmVer; + } pTask->tbSink.pTSchema = - tBuildTSchema(pTask->tbSink.pSchemaWrapper->pSchema, pTask->tbSink.pSchemaWrapper->nCols, 1); + tBuildTSchema(pTask->tbSink.pSchemaWrapper->pSchema, pTask->tbSink.pSchemaWrapper->nCols, version); ASSERT(pTask->tbSink.pTSchema); } diff --git a/source/dnode/vnode/src/tq/tqExec.c b/source/dnode/vnode/src/tq/tqExec.c index 563822864115a671867baac72451d48ecb2418e5..f97c5ce93c7b46c74946d87186f405c2b93101e8 100644 --- a/source/dnode/vnode/src/tq/tqExec.c +++ b/source/dnode/vnode/src/tq/tqExec.c @@ -147,7 +147,7 @@ int32_t tqScanTaosx(STQ* pTq, const STqHandle* pHandle, STaosxRsp* pRsp, SMqMeta } tqDebug("tmqsnap task execute end, get %p", pDataBlock); - if (pDataBlock != NULL) { + if (pDataBlock != NULL && pDataBlock->info.rows > 0) { if (pRsp->withTbName) { if (pOffset->type == TMQ_OFFSET__LOG) { int64_t uid = pExec->pExecReader->lastBlkUid; diff --git a/source/dnode/vnode/src/tq/tqRead.c b/source/dnode/vnode/src/tq/tqRead.c index 5352ebe6d4b5a3aa00e963c951f683def7586813..bf73cca9252b80dae6bd988ce0d78b88e6eca5c7 100644 --- a/source/dnode/vnode/src/tq/tqRead.c +++ b/source/dnode/vnode/src/tq/tqRead.c @@ -290,14 +290,14 @@ void tqCloseReader(STqReader* pReader) { taosMemoryFree(pReader); } -int32_t tqSeekVer(STqReader* pReader, int64_t ver) { +int32_t tqSeekVer(STqReader* pReader, int64_t ver, const char* id) { // todo set the correct vgId - tqDebug("tmq poll: vgId:%d wal seek to version:%"PRId64, 0, ver); + tqDebug("tmq poll: wal seek to version:%"PRId64" %s", ver, id); if (walReadSeekVer(pReader->pWalReader, ver) < 0) { - tqError("tmq poll: wal reader failed to seek to ver:%"PRId64, ver); + tqError("tmq poll: wal reader failed to seek to ver:%"PRId64" code:%s, %s", ver, tstrerror(terrno), id); return -1; } else { - tqDebug("tmq poll: wal reader seek to ver:%"PRId64, ver); + tqDebug("tmq poll: wal reader seek to ver:%"PRId64" %s", ver, id); return 0; } } @@ -307,36 +307,26 @@ int32_t tqNextBlock(STqReader* pReader, SFetchRet* ret) { while (1) { if (!fromProcessedMsg) { - SWalReader* pWalReader = pReader->pWalReader; - - if (walNextValidMsg(pWalReader) < 0) { - pReader->ver = pWalReader->curVersion - (pWalReader->curInvalid | pWalReader->curStopped); + if (walNextValidMsg(pReader->pWalReader) < 0) { +// pReader->ver = pReader->pWalReader->curVersion - pReader->pWalReader->curStopped; + if(pReader->pWalReader->curInvalid == 0){ + pReader->ver = pReader->pWalReader->curVersion - pReader->pWalReader->curStopped; + }else{ + pReader->ver = walGetLastVer(pReader->pWalReader->pWal); + } ret->offset.type = TMQ_OFFSET__LOG; + ret->offset.version = pReader->ver; ret->fetchType = FETCH_TYPE__NONE; - tqDebug("return offset %" PRId64 ", no more valid", ret->offset.version); + tqDebug("return offset %" PRId64 ", no more valid msg in wal", ret->offset.version); return -1; } - void* body = POINTER_SHIFT(pWalReader->pHead->head.body, sizeof(SSubmitReq2Msg)); - int32_t bodyLen = pWalReader->pHead->head.bodyLen - sizeof(SSubmitReq2Msg); - int64_t ver = pWalReader->pHead->head.version; + void* body = POINTER_SHIFT(pReader->pWalReader->pHead->head.body, sizeof(SSubmitReq2Msg)); + int32_t bodyLen = pReader->pWalReader->pHead->head.bodyLen - sizeof(SSubmitReq2Msg); + int64_t ver = pReader->pWalReader->pHead->head.version; - tqDebug("tmq poll: extract submit msg from wal, version:%"PRId64" len:%d", ver, bodyLen); - -#if 0 - if (pWalReader->pHead->head.msgType != TDMT_VND_SUBMIT) { - // TODO do filter - ret->fetchType = FETCH_TYPE__META; - ret->meta = pWalReader->pHead->head.body; - return 0; - } else { -#endif tqReaderSetSubmitReq2(pReader, body, bodyLen, ver); - /*tqReaderSetDataMsg(pReader, body, pWalReader->pHead->head.version);*/ -#if 0 - } -#endif } while (tqNextDataBlock2(pReader)) { diff --git a/source/dnode/vnode/src/tsdb/tsdbCache.c b/source/dnode/vnode/src/tsdb/tsdbCache.c index 79e0ccc3e338a2c58815db448d70ad4f4e5e63bd..58401cdf44cb8a5fd7b741112c3e77c6c8266378 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCache.c +++ b/source/dnode/vnode/src/tsdb/tsdbCache.c @@ -257,9 +257,6 @@ int32_t tsdbCacheInsertLastrow(SLRUCache *pCache, STsdb *pTsdb, tb_uid_t uid, TS SLastCol lastCol = {.ts = keyTs, .colVal = colVal}; if (IS_VAR_DATA_TYPE(colVal.type) && colVal.value.nData > 0) { - SLastCol *pLastCol = (SLastCol *)taosArrayGet(pLast, iCol); - taosMemoryFree(pLastCol->colVal.value.pData); - lastCol.colVal.value.pData = taosMemoryMalloc(colVal.value.nData); if (lastCol.colVal.value.pData == NULL) { terrno = TSDB_CODE_OUT_OF_MEMORY; @@ -378,9 +375,6 @@ int32_t tsdbCacheInsertLast(SLRUCache *pCache, tb_uid_t uid, TSDBROW *row, STsdb SLastCol lastCol = {.ts = keyTs, .colVal = colVal}; if (IS_VAR_DATA_TYPE(colVal.type) && colVal.value.nData > 0) { - SLastCol *pLastCol = (SLastCol *)taosArrayGet(pLast, iCol); - taosMemoryFree(pLastCol->colVal.value.pData); - lastCol.colVal.value.pData = taosMemoryMalloc(colVal.value.nData); if (lastCol.colVal.value.pData == NULL) { terrno = TSDB_CODE_OUT_OF_MEMORY; @@ -512,6 +506,11 @@ static int32_t getTableDelData(STbData *pMem, STbData *pIMem, SDelFReader *pDelR SArray *aDelData) { int32_t code = 0; + if (pDelIdx) { + code = getTableDelDataFromDelIdx(pDelReader, pDelIdx, aDelData); + if (code) goto _err; + } + if (pMem) { code = getTableDelDataFromTbData(pMem, aDelData); if (code) goto _err; @@ -522,11 +521,6 @@ static int32_t getTableDelData(STbData *pMem, STbData *pIMem, SDelFReader *pDelR if (code) goto _err; } - if (pDelIdx) { - code = getTableDelDataFromDelIdx(pDelReader, pDelIdx, aDelData); - if (code) goto _err; - } - _err: return code; } @@ -599,9 +593,10 @@ typedef struct { SMergeTree mergeTree; SMergeTree *pMergeTree; SSttBlockLoadInfo *pLoadInfo; + int64_t lastTs; } SFSLastNextRowIter; -static int32_t getNextRowFromFSLast(void *iter, TSDBROW **ppRow) { +static int32_t getNextRowFromFSLast(void *iter, TSDBROW **ppRow, bool *pIgnoreEarlierTs) { SFSLastNextRowIter *state = (SFSLastNextRowIter *)iter; int32_t code = 0; @@ -647,15 +642,27 @@ static int32_t getNextRowFromFSLast(void *iter, TSDBROW **ppRow) { } state->state = SFSLASTNEXTROW_BLOCKROW; } - case SFSLASTNEXTROW_BLOCKROW: - state->row = tMergeTreeGetRow(&state->mergeTree); - *ppRow = &state->row; - bool hasVal = tMergeTreeNext(&state->mergeTree); + case SFSLASTNEXTROW_BLOCKROW: { + bool hasVal = false; + do { + state->row = tMergeTreeGetRow(&state->mergeTree); + *ppRow = &state->row; + hasVal = tMergeTreeNext(&state->mergeTree); + } while (TSDBROW_TS(&state->row) <= state->lastTs && hasVal); + + if (TSDBROW_TS(&state->row) <= state->lastTs) { + *pIgnoreEarlierTs = true; + state->state = SFSLASTNEXTROW_FILESET; + goto _next_fileset; + } + + *pIgnoreEarlierTs = false; if (!hasVal) { state->state = SFSLASTNEXTROW_FILESET; } return code; + } default: ASSERT(0); break; @@ -728,9 +735,10 @@ typedef struct SFSNextRowIter { int32_t iRow; TSDBROW row; SSttBlockLoadInfo *pLoadInfo; + int64_t lastTs; } SFSNextRowIter; -static int32_t getNextRowFromFS(void *iter, TSDBROW **ppRow) { +static int32_t getNextRowFromFS(void *iter, TSDBROW **ppRow, bool *pIgnoreEarlierTs) { SFSNextRowIter *state = (SFSNextRowIter *)iter; int32_t code = 0; @@ -822,12 +830,14 @@ static int32_t getNextRowFromFS(void *iter, TSDBROW **ppRow) { SDataBlk block = {0}; tDataBlkReset(&block); - // tBlockDataReset(&state->blockData); tBlockDataReset(state->pBlockData); tMapDataGetItemByIdx(&state->blockMap, state->iBlock, &block, tGetDataBlk); - /* code = tsdbReadBlockData(state->pDataFReader, &state->blockIdx, &block, &state->blockData, NULL, NULL); - */ + if (block.maxKey.ts <= state->lastTs) { + *pIgnoreEarlierTs = true; + goto _next_fileset; + } + *pIgnoreEarlierTs = false; tBlockDataReset(state->pBlockData); TABLEID tid = {.suid = state->suid, .uid = state->uid}; code = tBlockDataInit(state->pBlockData, &tid, state->pTSchema, NULL, 0); @@ -937,16 +947,23 @@ typedef struct SMemNextRowIter { SMEMNEXTROWSTATES state; STbData *pMem; // [input] STbDataIter iter; // mem buffer skip list iterator + int64_t lastTs; // bool iterOpened; // TSDBROW *curRow; } SMemNextRowIter; -static int32_t getNextRowFromMem(void *iter, TSDBROW **ppRow) { +static int32_t getNextRowFromMem(void *iter, TSDBROW **ppRow, bool *pIgnoreEarlierTs) { SMemNextRowIter *state = (SMemNextRowIter *)iter; int32_t code = 0; + *pIgnoreEarlierTs = false; switch (state->state) { case SMEMNEXTROW_ENTER: { if (state->pMem != NULL) { + if (state->pMem->maxKey <= state->lastTs) { + *ppRow = NULL; + *pIgnoreEarlierTs = true; + return code; + } tsdbTbDataIterOpen(state->pMem, NULL, 1, &state->iter); TSDBROW *pMemRow = tsdbTbDataIterGet(&state->iter); @@ -1047,13 +1064,14 @@ static bool tsdbKeyDeleted(TSDBKEY *key, SArray *pSkyline, int64_t *iSkyline) { return deleted; } -typedef int32_t (*_next_row_fn_t)(void *iter, TSDBROW **ppRow); +typedef int32_t (*_next_row_fn_t)(void *iter, TSDBROW **ppRow, bool *pIgnoreEarlierTs); typedef int32_t (*_next_row_clear_fn_t)(void *iter); typedef struct { TSDBROW *pRow; bool stop; bool next; + bool ignoreEarlierTs; void *iter; _next_row_fn_t nextRowFn; _next_row_clear_fn_t nextRowClearFn; @@ -1076,7 +1094,7 @@ typedef struct { static int32_t nextRowIterOpen(CacheNextRowIter *pIter, tb_uid_t uid, STsdb *pTsdb, STSchema *pTSchema, tb_uid_t suid, SSttBlockLoadInfo *pLoadInfo, STsdbReadSnap *pReadSnap, SDataFReader **pDataFReader, - SDataFReader **pDataFReaderLast) { + SDataFReader **pDataFReaderLast, int64_t lastTs) { int code = 0; STbData *pMem = NULL; @@ -1137,6 +1155,7 @@ static int32_t nextRowIterOpen(CacheNextRowIter *pIter, tb_uid_t uid, STsdb *pTs pIter->fsLastState.uid = uid; pIter->fsLastState.pLoadInfo = pLoadInfo; pIter->fsLastState.pDataFReader = pDataFReaderLast; + pIter->fsLastState.lastTs = lastTs; pIter->fsState.state = SFSNEXTROW_FS; pIter->fsState.pTsdb = pTsdb; @@ -1147,17 +1166,19 @@ static int32_t nextRowIterOpen(CacheNextRowIter *pIter, tb_uid_t uid, STsdb *pTs pIter->fsState.uid = uid; pIter->fsState.pLoadInfo = pLoadInfo; pIter->fsState.pDataFReader = pDataFReader; + pIter->fsState.lastTs = lastTs; - pIter->input[0] = (TsdbNextRowState){&pIter->memRow, true, false, &pIter->memState, getNextRowFromMem, NULL}; - pIter->input[1] = (TsdbNextRowState){&pIter->imemRow, true, false, &pIter->imemState, getNextRowFromMem, NULL}; - pIter->input[2] = (TsdbNextRowState){&pIter->fsLastRow, false, true, &pIter->fsLastState, getNextRowFromFSLast, - clearNextRowFromFSLast}; + pIter->input[0] = (TsdbNextRowState){&pIter->memRow, true, false, false, &pIter->memState, getNextRowFromMem, NULL}; + pIter->input[1] = (TsdbNextRowState){&pIter->imemRow, true, false, false, &pIter->imemState, getNextRowFromMem, NULL}; + pIter->input[2] = (TsdbNextRowState){ + &pIter->fsLastRow, false, true, false, &pIter->fsLastState, getNextRowFromFSLast, clearNextRowFromFSLast}; pIter->input[3] = - (TsdbNextRowState){&pIter->fsRow, false, true, &pIter->fsState, getNextRowFromFS, clearNextRowFromFS}; + (TsdbNextRowState){&pIter->fsRow, false, true, false, &pIter->fsState, getNextRowFromFS, clearNextRowFromFS}; if (pMem) { pIter->memState.pMem = pMem; pIter->memState.state = SMEMNEXTROW_ENTER; + pIter->memState.lastTs = lastTs; pIter->input[0].stop = false; pIter->input[0].next = true; } @@ -1165,6 +1186,7 @@ static int32_t nextRowIterOpen(CacheNextRowIter *pIter, tb_uid_t uid, STsdb *pTs if (pIMem) { pIter->imemState.pMem = pIMem; pIter->imemState.state = SMEMNEXTROW_ENTER; + pIter->imemState.lastTs = lastTs; pIter->input[1].stop = false; pIter->input[1].next = true; } @@ -1192,12 +1214,12 @@ _err: } // iterate next row non deleted backward ts, version (from high to low) -static int32_t nextRowIterGet(CacheNextRowIter *pIter, TSDBROW **ppRow) { +static int32_t nextRowIterGet(CacheNextRowIter *pIter, TSDBROW **ppRow, bool *pIgnoreEarlierTs) { int code = 0; for (;;) { for (int i = 0; i < 4; ++i) { if (pIter->input[i].next && !pIter->input[i].stop) { - code = pIter->input[i].nextRowFn(pIter->input[i].iter, &pIter->input[i].pRow); + code = pIter->input[i].nextRowFn(pIter->input[i].iter, &pIter->input[i].pRow, &pIter->input[i].ignoreEarlierTs); if (code) goto _err; if (pIter->input[i].pRow == NULL) { @@ -1209,6 +1231,8 @@ static int32_t nextRowIterGet(CacheNextRowIter *pIter, TSDBROW **ppRow) { if (pIter->input[0].stop && pIter->input[1].stop && pIter->input[2].stop && pIter->input[3].stop) { *ppRow = NULL; + *pIgnoreEarlierTs = (pIter->input[0].ignoreEarlierTs || pIter->input[1].ignoreEarlierTs || + pIter->input[2].ignoreEarlierTs || pIter->input[3].ignoreEarlierTs); return code; } @@ -1265,31 +1289,82 @@ _err: return code; } -static int32_t mergeLastRow(tb_uid_t uid, STsdb *pTsdb, bool *dup, SArray **ppColArray, SCacheRowsReader *pr) { - int32_t code = 0; +static int32_t initLastColArray(STSchema *pTSchema, SArray **ppColArray) { + SArray *pColArray = taosArrayInit(pTSchema->numOfCols, sizeof(SLastCol)); + if (NULL == pColArray) { + return TSDB_CODE_OUT_OF_MEMORY; + } + + for (int32_t i = 0; i < pTSchema->numOfCols; ++i) { + SLastCol col = {.ts = 0, .colVal = COL_VAL_NULL(pTSchema->columns[i].colId, pTSchema->columns[i].type)}; + taosArrayPush(pColArray, &col); + } + *ppColArray = pColArray; + return TSDB_CODE_SUCCESS; +} + +static int32_t cloneTSchema(STSchema *pSrc, STSchema **ppDst) { + int32_t len = sizeof(STSchema) + sizeof(STColumn) * pSrc->numOfCols; + *ppDst = taosMemoryMalloc(len); + if (NULL == *ppDst) { + return TSDB_CODE_OUT_OF_MEMORY; + } + memcpy(*ppDst, pSrc, len); + return TSDB_CODE_SUCCESS; +} +static int32_t updateTSchema(int32_t sversion, SCacheRowsReader *pReader, uint64_t uid) { + if (NULL == pReader->pCurrSchema && sversion == pReader->pSchema->version) { + return cloneTSchema(pReader->pSchema, &pReader->pCurrSchema); + } + + if (NULL != pReader->pCurrSchema && sversion == pReader->pCurrSchema->version) { + return TSDB_CODE_SUCCESS; + } + + taosMemoryFreeClear(pReader->pCurrSchema); + return metaGetTbTSchemaEx(pReader->pTsdb->pVnode->pMeta, pReader->suid, uid, sversion, &pReader->pCurrSchema); +} + +static int32_t mergeLastRow(tb_uid_t uid, STsdb *pTsdb, bool *dup, SArray **ppColArray, SCacheRowsReader *pr) { STSchema *pTSchema = pr->pSchema; // metaGetTbTSchema(pTsdb->pVnode->pMeta, uid, -1, 1); - int16_t nCol = pTSchema->numOfCols; + int16_t nLastCol = pTSchema->numOfCols; int16_t iCol = 0; int16_t noneCol = 0; bool setNoneCol = false; - SArray *pColArray = taosArrayInit(nCol, sizeof(SLastCol)); + bool hasRow = false; + bool ignoreEarlierTs = false; + SArray *pColArray = NULL; SColVal *pColVal = &(SColVal){0}; + int32_t code = initLastColArray(pTSchema, &pColArray); + if (TSDB_CODE_SUCCESS != code) { + return code; + } + TSKEY lastRowTs = TSKEY_MAX; CacheNextRowIter iter = {0}; nextRowIterOpen(&iter, uid, pTsdb, pTSchema, pr->suid, pr->pLoadInfo, pr->pReadSnap, &pr->pDataFReader, - &pr->pDataFReaderLast); + &pr->pDataFReaderLast, pr->lastTs); do { TSDBROW *pRow = NULL; - nextRowIterGet(&iter, &pRow); + nextRowIterGet(&iter, &pRow, &ignoreEarlierTs); if (!pRow) { break; } + hasRow = true; + + code = updateTSchema(TSDBROW_SVERSION(pRow), pr, uid); + if (TSDB_CODE_SUCCESS != code) { + goto _err; + } + pTSchema = pr->pCurrSchema; + int16_t nCol = pTSchema->numOfCols; + TSKEY rowTs = TSDBROW_TS(pRow); if (lastRowTs == TSKEY_MAX) { @@ -1297,29 +1372,27 @@ static int32_t mergeLastRow(tb_uid_t uid, STsdb *pTsdb, bool *dup, SArray **ppCo STColumn *pTColumn = &pTSchema->columns[0]; *pColVal = COL_VAL_VALUE(pTColumn->colId, pTColumn->type, (SValue){.val = lastRowTs}); - if (taosArrayPush(pColArray, &(SLastCol){.ts = lastRowTs, .colVal = *pColVal}) == NULL) { - terrno = TSDB_CODE_OUT_OF_MEMORY; - code = TSDB_CODE_OUT_OF_MEMORY; - goto _err; - } + taosArraySet(pColArray, 0, &(SLastCol){.ts = lastRowTs, .colVal = *pColVal}); for (iCol = 1; iCol < nCol; ++iCol) { + if (iCol >= nLastCol) { + break; + } + SLastCol *pCol = taosArrayGet(pColArray, iCol); + if (pCol->colVal.cid != pTSchema->columns[iCol].colId) { + continue; + } tsdbRowGetColVal(pRow, pTSchema, iCol, pColVal); - SLastCol lastCol = {.ts = lastRowTs, .colVal = *pColVal}; + *pCol = (SLastCol){.ts = lastRowTs, .colVal = *pColVal}; if (IS_VAR_DATA_TYPE(pColVal->type) && pColVal->value.nData > 0) { - lastCol.colVal.value.pData = taosMemoryMalloc(lastCol.colVal.value.nData); - if (lastCol.colVal.value.pData == NULL) { + pCol->colVal.value.pData = taosMemoryMalloc(pCol->colVal.value.nData); + if (pCol->colVal.value.pData == NULL) { terrno = TSDB_CODE_OUT_OF_MEMORY; code = TSDB_CODE_OUT_OF_MEMORY; goto _err; } - memcpy(lastCol.colVal.value.pData, pColVal->value.pData, pColVal->value.nData); - } - - if (taosArrayPush(pColArray, &lastCol) == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; - goto _err; + memcpy(pCol->colVal.value.pData, pColVal->value.pData, pColVal->value.nData); } if (COL_VAL_IS_NONE(pColVal) && !setNoneCol) { @@ -1376,6 +1449,14 @@ static int32_t mergeLastRow(tb_uid_t uid, STsdb *pTsdb, bool *dup, SArray **ppCo //*ppColArray = NULL; // taosArrayDestroy(pColArray); //} else { + if (!hasRow) { + if (ignoreEarlierTs) { + taosArrayDestroy(pColArray); + pColArray = NULL; + } else { + taosArrayClear(pColArray); + } + } *ppColArray = pColArray; //} @@ -1391,30 +1472,43 @@ _err: } static int32_t mergeLast(tb_uid_t uid, STsdb *pTsdb, SArray **ppLastArray, SCacheRowsReader *pr) { - int32_t code = 0; - STSchema *pTSchema = pr->pSchema; // metaGetTbTSchema(pTsdb->pVnode->pMeta, uid, -1, 1); - int16_t nCol = pTSchema->numOfCols; - int16_t iCol = 0; + int16_t nLastCol = pTSchema->numOfCols; int16_t noneCol = 0; bool setNoneCol = false; - SArray *pColArray = taosArrayInit(nCol, sizeof(SLastCol)); + bool hasRow = false; + bool ignoreEarlierTs = false; + SArray *pColArray = NULL; SColVal *pColVal = &(SColVal){0}; + int32_t code = initLastColArray(pTSchema, &pColArray); + if (TSDB_CODE_SUCCESS != code) { + return code; + } + TSKEY lastRowTs = TSKEY_MAX; CacheNextRowIter iter = {0}; nextRowIterOpen(&iter, uid, pTsdb, pTSchema, pr->suid, pr->pLoadInfo, pr->pReadSnap, &pr->pDataFReader, - &pr->pDataFReaderLast); + &pr->pDataFReaderLast, pr->lastTs); do { TSDBROW *pRow = NULL; - nextRowIterGet(&iter, &pRow); + nextRowIterGet(&iter, &pRow, &ignoreEarlierTs); if (!pRow) { break; } + hasRow = true; + + code = updateTSchema(TSDBROW_SVERSION(pRow), pr, uid); + if (TSDB_CODE_SUCCESS != code) { + goto _err; + } + pTSchema = pr->pCurrSchema; + int16_t nCol = pTSchema->numOfCols; + TSKEY rowTs = TSDBROW_TS(pRow); if (lastRowTs == TSKEY_MAX) { @@ -1422,28 +1516,27 @@ static int32_t mergeLast(tb_uid_t uid, STsdb *pTsdb, SArray **ppLastArray, SCach STColumn *pTColumn = &pTSchema->columns[0]; *pColVal = COL_VAL_VALUE(pTColumn->colId, pTColumn->type, (SValue){.val = lastRowTs}); - if (taosArrayPush(pColArray, &(SLastCol){.ts = lastRowTs, .colVal = *pColVal}) == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; - goto _err; - } + taosArraySet(pColArray, 0, &(SLastCol){.ts = lastRowTs, .colVal = *pColVal}); - for (iCol = 1; iCol < nCol; ++iCol) { + for (int16_t iCol = 1; iCol < nCol; ++iCol) { + if (iCol >= nLastCol) { + break; + } + SLastCol *pCol = taosArrayGet(pColArray, iCol); + if (pCol->colVal.cid != pTSchema->columns[iCol].colId) { + continue; + } tsdbRowGetColVal(pRow, pTSchema, iCol, pColVal); - SLastCol lastCol = {.ts = lastRowTs, .colVal = *pColVal}; + *pCol = (SLastCol){.ts = lastRowTs, .colVal = *pColVal}; if (IS_VAR_DATA_TYPE(pColVal->type) && pColVal->value.nData > 0) { - lastCol.colVal.value.pData = taosMemoryMalloc(lastCol.colVal.value.nData); - if (lastCol.colVal.value.pData == NULL) { + pCol->colVal.value.pData = taosMemoryMalloc(pCol->colVal.value.nData); + if (pCol->colVal.value.pData == NULL) { terrno = TSDB_CODE_OUT_OF_MEMORY; code = TSDB_CODE_OUT_OF_MEMORY; goto _err; } - memcpy(lastCol.colVal.value.pData, pColVal->value.pData, pColVal->value.nData); - } - - if (taosArrayPush(pColArray, &lastCol) == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; - goto _err; + memcpy(pCol->colVal.value.pData, pColVal->value.pData, pColVal->value.nData); } if (!COL_VAL_IS_VALUE(pColVal) && !setNoneCol) { @@ -1461,10 +1554,16 @@ static int32_t mergeLast(tb_uid_t uid, STsdb *pTsdb, SArray **ppLastArray, SCach // merge into pColArray setNoneCol = false; - for (iCol = noneCol; iCol < nCol; ++iCol) { + for (int16_t iCol = noneCol; iCol < nCol; ++iCol) { + if (iCol >= nLastCol) { + break; + } // high version's column value SLastCol *lastColVal = (SLastCol *)taosArrayGet(pColArray, iCol); - SColVal *tColVal = &lastColVal->colVal; + if (lastColVal->colVal.cid != pTSchema->columns[iCol].colId) { + continue; + } + SColVal *tColVal = &lastColVal->colVal; tsdbRowGetColVal(pRow, pTSchema, iCol, pColVal); if (!COL_VAL_IS_VALUE(tColVal) && COL_VAL_IS_VALUE(pColVal)) { @@ -1494,6 +1593,14 @@ static int32_t mergeLast(tb_uid_t uid, STsdb *pTsdb, SArray **ppLastArray, SCach //*ppLastArray = NULL; // taosArrayDestroy(pColArray); //} else { + if (!hasRow) { + if (ignoreEarlierTs) { + taosArrayDestroy(pColArray); + pColArray = NULL; + } else { + taosArrayClear(pColArray); + } + } *ppLastArray = pColArray; //} @@ -1526,8 +1633,8 @@ int32_t tsdbCacheGetLastrowH(SLRUCache *pCache, tb_uid_t uid, SCacheRowsReader * SArray *pArray = NULL; bool dup = false; // which is always false for now code = mergeLastRow(uid, pTsdb, &dup, &pArray, pr); - // if table's empty or error, set handle NULL and return - if (code < 0 /* || pArray == NULL*/) { + // if table's empty or error or ignore ignore earlier ts, set handle NULL and return + if (code < 0 || pArray == NULL) { if (!dup && pArray) { taosArrayDestroy(pArray); } @@ -1570,8 +1677,8 @@ int32_t tsdbCacheGetLastH(SLRUCache *pCache, tb_uid_t uid, SCacheRowsReader *pr, if (!h) { SArray *pLastArray = NULL; code = mergeLast(uid, pTsdb, &pLastArray, pr); - // if table's empty or error, set handle NULL and return - if (code < 0 /* || pLastArray == NULL*/) { + // if table's empty or error or ignore ignore earlier ts, set handle NULL and return + if (code < 0 || pLastArray == NULL) { taosThreadMutexUnlock(&pTsdb->lruMutex); *handle = NULL; diff --git a/source/dnode/vnode/src/tsdb/tsdbCacheRead.c b/source/dnode/vnode/src/tsdb/tsdbCacheRead.c index 97b13a3c3772e2309a31e6e4d08e159032ff24bc..d9259507032894876ca3dad2e04c31da49054d09 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCacheRead.c +++ b/source/dnode/vnode/src/tsdb/tsdbCacheRead.c @@ -38,16 +38,17 @@ static int32_t saveOneRow(SArray* pRow, SSDataBlock* pBlock, SCacheRowsReader* p *(int64_t*)p->buf = pColVal->ts; allNullRow = false; } else { - int32_t slotId = slotIds[i]; - SLastCol* pColVal = (SLastCol*)taosArrayGet(pRow, slotId); - + int32_t slotId = slotIds[i]; // add check for null value, caused by the modification of table schema (new column added). - if (pColVal == NULL) { + if (slotId >= taosArrayGetSize(pRow)) { p->ts = 0; p->isNull = true; + colDataSetNULL(pColInfoData, numOfRows); continue; } + SLastCol* pColVal = (SLastCol*)taosArrayGet(pRow, slotId); + p->ts = pColVal->ts; p->isNull = !COL_VAL_IS_VALUE(&pColVal->colVal); allNullRow = p->isNull & allNullRow; @@ -79,7 +80,12 @@ static int32_t saveOneRow(SArray* pRow, SSDataBlock* pBlock, SCacheRowsReader* p SLastCol* pColVal = (SLastCol*)taosArrayGet(pRow, 0); colDataSetVal(pColInfoData, numOfRows, (const char*)&pColVal->ts, false); } else { - int32_t slotId = slotIds[i]; + int32_t slotId = slotIds[i]; + // add check for null value, caused by the modification of table schema (new column added). + if (slotId >= taosArrayGetSize(pRow)) { + colDataSetNULL(pColInfoData, numOfRows); + continue; + } SLastCol* pColVal = (SLastCol*)taosArrayGet(pRow, slotId); SColVal* pVal = &pColVal->colVal; @@ -193,6 +199,8 @@ int32_t tsdbCacherowsReaderOpen(void* pVnode, int32_t type, void* pTableIdList, p->idstr = taosStrdup(idstr); taosThreadMutexInit(&p->readerMutex, NULL); + p->lastTs = INT64_MIN; + *pReader = p; return TSDB_CODE_SUCCESS; } @@ -209,6 +217,8 @@ void* tsdbCacherowsReaderClose(void* pReader) { taosMemoryFree(p->pSchema); } + taosMemoryFree(p->pCurrSchema); + destroyLastBlockLoadInfo(p->pLoadInfo); taosMemoryFree((void*)p->idstr); @@ -290,7 +300,8 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32 } for (int32_t j = 0; j < pr->numOfCols; ++j) { - pRes[j] = taosMemoryCalloc(1, sizeof(SFirstLastRes) + pr->pSchema->columns[slotIds[j]].bytes + VARSTR_HEADER_SIZE); + pRes[j] = taosMemoryCalloc( + 1, sizeof(SFirstLastRes) + pr->pSchema->columns[-1 == slotIds[j] ? 0 : slotIds[j]].bytes + VARSTR_HEADER_SIZE); SFirstLastRes* p = (SFirstLastRes*)varDataVal(pRes[j]); p->ts = INT64_MIN; } @@ -303,7 +314,7 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32 for (int32_t i = 0; i < pr->pSchema->numOfCols; ++i) { struct STColumn* pCol = &pr->pSchema->columns[i]; - SLastCol p = {.ts = INT64_MIN, .colVal.type = pCol->type}; + SLastCol p = {.ts = INT64_MIN, .colVal.type = pCol->type, .colVal.flag = CV_FLAG_NULL}; if (IS_VAR_DATA_TYPE(pCol->type)) { p.colVal.value.pData = taosMemoryCalloc(pCol->bytes, sizeof(char)); @@ -338,6 +349,8 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32 } { + bool hasNotNullRow = true; + int64_t minTs = INT64_MAX; for (int32_t k = 0; k < pr->numOfCols; ++k) { int32_t slotId = slotIds[k]; @@ -348,6 +361,7 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32 hasRes = true; p->ts = pCol->ts; p->colVal = pCol->colVal; + minTs = pCol->ts; // only set value for last row query if (HASTYPE(pr->type, CACHESCAN_RETRIEVE_LAST_ROW)) { @@ -364,11 +378,17 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32 if (pColVal->ts > p->ts) { if (!COL_VAL_IS_VALUE(&pColVal->colVal) && HASTYPE(pr->type, CACHESCAN_RETRIEVE_LAST)) { + if (!COL_VAL_IS_VALUE(&p->colVal)) { + hasNotNullRow = false; + } continue; } hasRes = true; p->ts = pColVal->ts; + if (pColVal->ts < minTs && HASTYPE(pr->type, CACHESCAN_RETRIEVE_LAST)) { + minTs = pColVal->ts; + } if (!IS_VAR_DATA_TYPE(pColVal->colVal.type)) { p->colVal = pColVal->colVal; @@ -385,6 +405,10 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32 } } } + + if (hasNotNullRow) { + pr->lastTs = minTs; + } } tsdbCacheRelease(lruCache, h); diff --git a/source/dnode/vnode/src/tsdb/tsdbCompact.c b/source/dnode/vnode/src/tsdb/tsdbCompact.c deleted file mode 100644 index 1cd11a30395f2b6efbca6cff56f6c26bca75d492..0000000000000000000000000000000000000000 --- a/source/dnode/vnode/src/tsdb/tsdbCompact.c +++ /dev/null @@ -1,664 +0,0 @@ -/* - * 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 "tsdb.h" - -extern int32_t tsdbUpdateTableSchema(SMeta *pMeta, int64_t suid, int64_t uid, SSkmInfo *pSkmInfo); -extern int32_t tsdbWriteDataBlock(SDataFWriter *pWriter, SBlockData *pBlockData, SMapData *mDataBlk, int8_t cmprAlg); -extern int32_t tsdbWriteSttBlock(SDataFWriter *pWriter, SBlockData *pBlockData, SArray *aSttBlk, int8_t cmprAlg); - -typedef struct { - STsdb *pTsdb; - int64_t commitID; - int8_t cmprAlg; - int32_t maxRows; - int32_t minRows; - - STsdbFS fs; - - int32_t fid; - TABLEID tbid; - SSkmInfo tbSkm; - - // Tombstone - SDelFReader *pDelFReader; - SArray *aDelIdx; // SArray - SArray *aDelData; // SArray - SArray *aSkyLine; // SArray - int32_t iDelIdx; - int32_t iSkyLine; - TSDBKEY *pDKey; - TSDBKEY dKey; - - // Reader - SDataFReader *pReader; - STsdbDataIter2 *iterList; // list of iterators - STsdbDataIter2 *pIter; - SRBTree rbt; - - // Writer - SDataFWriter *pWriter; - SArray *aBlockIdx; // SArray - SMapData mDataBlk; // SMapData - SArray *aSttBlk; // SArray - SBlockData bData; - SBlockData sData; -} STsdbCompactor; - -static int32_t tsdbAbortCompact(STsdbCompactor *pCompactor) { - int32_t code = 0; - int32_t lino = 0; - - STsdb *pTsdb = pCompactor->pTsdb; - code = tsdbFSRollback(pTsdb); - TSDB_CHECK_CODE(code, lino, _exit); - -_exit: - if (code) { - tsdbError("vgId:%d %s failed at line %d since %s", TD_VID(pTsdb->pVnode), __func__, lino, tstrerror(code)); - } else { - tsdbInfo("vgId:%d %s done", TD_VID(pTsdb->pVnode), __func__); - } - return code; -} - -static int32_t tsdbCompactWriteTableDataStart(STsdbCompactor *pCompactor, TABLEID *pId) { - int32_t code = 0; - int32_t lino = 0; - - pCompactor->tbid = *pId; - - // tombstone - for (;;) { - if (pCompactor->iDelIdx >= taosArrayGetSize(pCompactor->aDelIdx)) { - pCompactor->pDKey = NULL; - break; - } - - SDelIdx *pDelIdx = (SDelIdx *)taosArrayGet(pCompactor->aDelIdx, pCompactor->iDelIdx); - int32_t c = tTABLEIDCmprFn(pDelIdx, &pCompactor->tbid); - if (c < 0) { - pCompactor->iDelIdx++; - } else if (c == 0) { - pCompactor->iDelIdx++; - - code = tsdbReadDelData(pCompactor->pDelFReader, pDelIdx, pCompactor->aDelData); - TSDB_CHECK_CODE(code, lino, _exit); - - code = tsdbBuildDeleteSkyline(pCompactor->aDelData, 0, taosArrayGetSize(pCompactor->aDelData) - 1, - pCompactor->aSkyLine); - TSDB_CHECK_CODE(code, lino, _exit); - - pCompactor->iSkyLine = 0; - if (pCompactor->iSkyLine < taosArrayGetSize(pCompactor->aSkyLine)) { - TSDBKEY *pKey = (TSDBKEY *)taosArrayGet(pCompactor->aSkyLine, pCompactor->iSkyLine); - - pCompactor->dKey.version = 0; - pCompactor->dKey.ts = pKey->ts; - pCompactor->pDKey = &pCompactor->dKey; - } else { - pCompactor->pDKey = NULL; - } - break; - } else { - pCompactor->pDKey = NULL; - break; - } - } - - // writer - code = tsdbUpdateTableSchema(pCompactor->pTsdb->pVnode->pMeta, pId->suid, pId->uid, &pCompactor->tbSkm); - TSDB_CHECK_CODE(code, lino, _exit); - - tMapDataReset(&pCompactor->mDataBlk); - - code = tBlockDataInit(&pCompactor->bData, pId, pCompactor->tbSkm.pTSchema, NULL, 0); - TSDB_CHECK_CODE(code, lino, _exit); - - if (!TABLE_SAME_SCHEMA(pCompactor->sData.suid, pCompactor->sData.uid, pId->suid, pId->uid)) { - if (pCompactor->sData.nRow > 0) { - code = tsdbWriteSttBlock(pCompactor->pWriter, &pCompactor->sData, pCompactor->aSttBlk, pCompactor->cmprAlg); - TSDB_CHECK_CODE(code, lino, _exit); - } - - TABLEID tbid = {.suid = pId->suid, .uid = pId->suid ? 0 : pId->uid}; - code = tBlockDataInit(&pCompactor->sData, &tbid, pCompactor->tbSkm.pTSchema, NULL, 0); - TSDB_CHECK_CODE(code, lino, _exit); - } - -_exit: - if (code) { - tsdbError("vgId:%d %s failed at line %d since %s", TD_VID(pCompactor->pTsdb->pVnode), __func__, lino, - tstrerror(code)); - } else { - tsdbDebug("vgId:%d %s done, suid:%" PRId64 " uid:%" PRId64, TD_VID(pCompactor->pTsdb->pVnode), __func__, pId->suid, - pId->uid); - } - return code; -} - -static int32_t tsdbCompactWriteTableDataEnd(STsdbCompactor *pCompactor) { - int32_t code = 0; - int32_t lino = 0; - - if (pCompactor->bData.nRow > 0) { - if (pCompactor->bData.nRow < pCompactor->minRows) { - for (int32_t iRow = 0; iRow < pCompactor->bData.nRow; iRow++) { - code = tBlockDataAppendRow(&pCompactor->sData, &tsdbRowFromBlockData(&pCompactor->bData, iRow), NULL, - pCompactor->tbid.uid); - TSDB_CHECK_CODE(code, lino, _exit); - - if (pCompactor->sData.nRow >= pCompactor->maxRows) { - code = tsdbWriteSttBlock(pCompactor->pWriter, &pCompactor->sData, pCompactor->aSttBlk, pCompactor->cmprAlg); - TSDB_CHECK_CODE(code, lino, _exit); - } - } - tBlockDataClear(&pCompactor->bData); - } else { - code = tsdbWriteDataBlock(pCompactor->pWriter, &pCompactor->bData, &pCompactor->mDataBlk, pCompactor->cmprAlg); - TSDB_CHECK_CODE(code, lino, _exit); - } - } - - if (pCompactor->mDataBlk.nItem > 0) { - SBlockIdx *pBlockIdx = (SBlockIdx *)taosArrayReserve(pCompactor->aBlockIdx, 1); - if (pBlockIdx == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; - TSDB_CHECK_CODE(code, lino, _exit); - } - - pBlockIdx->suid = pCompactor->tbid.suid; - pBlockIdx->uid = pCompactor->tbid.uid; - - code = tsdbWriteDataBlk(pCompactor->pWriter, &pCompactor->mDataBlk, pBlockIdx); - TSDB_CHECK_CODE(code, lino, _exit); - } - -_exit: - if (code) { - tsdbError("vgId:%d %s failed at line %d since %s", TD_VID(pCompactor->pTsdb->pVnode), __func__, lino, - tstrerror(code)); - } else { - tsdbDebug("vgId:%d %s done, suid:%" PRId64 " uid:%" PRId64, TD_VID(pCompactor->pTsdb->pVnode), __func__, - pCompactor->tbid.suid, pCompactor->tbid.uid); - } - return code; -} - -static bool tsdbCompactRowIsDeleted(STsdbCompactor *pCompactor, TSDBROW *pRow) { - TSDBKEY tKey = TSDBROW_KEY(pRow); - TSDBKEY *aKey = (TSDBKEY *)TARRAY_DATA(pCompactor->aSkyLine); - int32_t nKey = TARRAY_SIZE(pCompactor->aSkyLine); - - if (tKey.ts > pCompactor->pDKey->ts) { - do { - pCompactor->pDKey->version = aKey[pCompactor->iSkyLine].version; - pCompactor->iSkyLine++; - if (pCompactor->iSkyLine < nKey) { - pCompactor->dKey.ts = aKey[pCompactor->iSkyLine].ts; - } else { - if (pCompactor->pDKey->version == 0) { - pCompactor->pDKey = NULL; - return false; - } else { - pCompactor->pDKey->ts = INT64_MAX; - } - } - } while (tKey.ts > pCompactor->pDKey->ts); - } - - if (tKey.ts < pCompactor->pDKey->ts) { - if (tKey.version > pCompactor->pDKey->version) { - return false; - } else { - return true; - } - } else if (tKey.ts == pCompactor->pDKey->ts) { - ASSERT(pCompactor->iSkyLine < nKey); - if (tKey.version > TMAX(pCompactor->pDKey->version, aKey[pCompactor->iSkyLine].version)) { - return false; - } else { - return true; - } - } - - return false; -} - -static int32_t tsdbCompactWriteTableData(STsdbCompactor *pCompactor, SRowInfo *pRowInfo) { - int32_t code = 0; - int32_t lino = 0; - - // start a new table data write if need - if (pRowInfo == NULL || pRowInfo->uid != pCompactor->tbid.uid) { - if (pCompactor->tbid.uid) { - code = tsdbCompactWriteTableDataEnd(pCompactor); - TSDB_CHECK_CODE(code, lino, _exit); - } - - if (pRowInfo == NULL) { - if (pCompactor->sData.nRow > 0) { - code = tsdbWriteSttBlock(pCompactor->pWriter, &pCompactor->sData, pCompactor->aSttBlk, pCompactor->cmprAlg); - TSDB_CHECK_CODE(code, lino, _exit); - } - return code; - } - - code = tsdbCompactWriteTableDataStart(pCompactor, (TABLEID *)pRowInfo); - TSDB_CHECK_CODE(code, lino, _exit); - } - - // check if row is deleted - if (pCompactor->pDKey && tsdbCompactRowIsDeleted(pCompactor, &pRowInfo->row)) goto _exit; - - if (tBlockDataTryUpsertRow(&pCompactor->bData, &pRowInfo->row, pRowInfo->uid) > pCompactor->maxRows) { - code = tsdbWriteDataBlock(pCompactor->pWriter, &pCompactor->bData, &pCompactor->mDataBlk, pCompactor->cmprAlg); - TSDB_CHECK_CODE(code, lino, _exit); - } - - code = tBlockDataUpsertRow(&pCompactor->bData, &pRowInfo->row, NULL, pRowInfo->uid); - TSDB_CHECK_CODE(code, lino, _exit); - -_exit: - if (code) { - tsdbError("vgId:%d %s failed at line %d since %s", TD_VID(pCompactor->pTsdb->pVnode), __func__, lino, - tstrerror(code)); - } else if (pRowInfo) { - tsdbTrace("vgId:%d %s done, suid:%" PRId64 " uid:%" PRId64 " ts:%" PRId64 " version:%" PRId64, - TD_VID(pCompactor->pTsdb->pVnode), __func__, pRowInfo->suid, pRowInfo->uid, TSDBROW_TS(&pRowInfo->row), - TSDBROW_VERSION(&pRowInfo->row)); - } - return code; -} - -static bool tsdbCompactTableIsDropped(STsdbCompactor *pCompactor) { - SMetaInfo info; - - if (pCompactor->pIter->rowInfo.uid == pCompactor->tbid.uid) return false; - if (metaGetInfo(pCompactor->pTsdb->pVnode->pMeta, pCompactor->pIter->rowInfo.uid, &info, NULL)) { - return true; - } - return false; -} -static int32_t tsdbCompactNextRow(STsdbCompactor *pCompactor, SRowInfo **ppRowInfo) { - int32_t code = 0; - int32_t lino = 0; - - for (;;) { - if (pCompactor->pIter) { - code = tsdbDataIterNext2(pCompactor->pIter, NULL); - TSDB_CHECK_CODE(code, lino, _exit); - - if (pCompactor->pIter->rowInfo.suid == 0 && pCompactor->pIter->rowInfo.uid == 0) { - pCompactor->pIter = NULL; - } else { - SRBTreeNode *pNode = tRBTreeMin(&pCompactor->rbt); - if (pNode) { - int32_t c = tsdbDataIterCmprFn(&pCompactor->pIter->rbtn, pNode); - if (c > 0) { - tRBTreePut(&pCompactor->rbt, &pCompactor->pIter->rbtn); - pCompactor->pIter = NULL; - } else if (c == 0) { - ASSERT(0); - } - } - } - } - - if (pCompactor->pIter == NULL) { - SRBTreeNode *pNode = tRBTreeDropMin(&pCompactor->rbt); - if (pNode) { - pCompactor->pIter = TSDB_RBTN_TO_DATA_ITER(pNode); - } - } - - if (pCompactor->pIter) { - if (tsdbCompactTableIsDropped(pCompactor)) { - TABLEID tbid = {.suid = pCompactor->pIter->rowInfo.suid, .uid = pCompactor->pIter->rowInfo.uid}; - tRBTreeClear(&pCompactor->rbt); - for (pCompactor->pIter = pCompactor->iterList; pCompactor->pIter; pCompactor->pIter = pCompactor->pIter->next) { - code = tsdbDataIterNext2(pCompactor->pIter, - &(STsdbFilterInfo){.flag = TSDB_FILTER_FLAG_BY_TABLEID, .tbid = tbid}); - TSDB_CHECK_CODE(code, lino, _exit); - - if (pCompactor->pIter->rowInfo.suid || pCompactor->pIter->rowInfo.uid) { - tRBTreePut(&pCompactor->rbt, &pCompactor->pIter->rbtn); - } - } - } else { - *ppRowInfo = &pCompactor->pIter->rowInfo; - break; - } - } else { - *ppRowInfo = NULL; - break; - } - } - -_exit: - if (code) { - tsdbError("vgId:%d %s failed at line %d since %s", TD_VID(pCompactor->pTsdb->pVnode), __func__, lino, - tstrerror(code)); - } - return code; -} - -static int32_t tsdbCompactFileSetStart(STsdbCompactor *pCompactor, SDFileSet *pSet) { - int32_t code = 0; - int32_t lino = 0; - - pCompactor->fid = pSet->fid; - pCompactor->tbid = (TABLEID){0}; - - /* tombstone */ - pCompactor->iDelIdx = 0; - - /* reader */ - code = tsdbDataFReaderOpen(&pCompactor->pReader, pCompactor->pTsdb, pSet); - TSDB_CHECK_CODE(code, lino, _exit); - - code = tsdbOpenDataFileDataIter(pCompactor->pReader, &pCompactor->pIter); - TSDB_CHECK_CODE(code, lino, _exit); - - tRBTreeCreate(&pCompactor->rbt, tsdbDataIterCmprFn); - if (pCompactor->pIter) { - pCompactor->pIter->next = pCompactor->iterList; - pCompactor->iterList = pCompactor->pIter; - - code = tsdbDataIterNext2(pCompactor->pIter, NULL); - TSDB_CHECK_CODE(code, lino, _exit); - - ASSERT(pCompactor->pIter->rowInfo.suid || pCompactor->pIter->rowInfo.uid); - tRBTreePut(&pCompactor->rbt, &pCompactor->pIter->rbtn); - } - - for (int32_t iStt = 0; iStt < pSet->nSttF; iStt++) { - code = tsdbOpenSttFileDataIter(pCompactor->pReader, iStt, &pCompactor->pIter); - TSDB_CHECK_CODE(code, lino, _exit); - - if (pCompactor->pIter) { - pCompactor->pIter->next = pCompactor->iterList; - pCompactor->iterList = pCompactor->pIter; - - code = tsdbDataIterNext2(pCompactor->pIter, NULL); - TSDB_CHECK_CODE(code, lino, _exit); - - ASSERT(pCompactor->pIter->rowInfo.suid || pCompactor->pIter->rowInfo.uid); - tRBTreePut(&pCompactor->rbt, &pCompactor->pIter->rbtn); - } - } - pCompactor->pIter = NULL; - - /* writer */ - code = tsdbDataFWriterOpen(&pCompactor->pWriter, pCompactor->pTsdb, - &(SDFileSet){.fid = pCompactor->fid, - .diskId = pSet->diskId, - .pHeadF = &(SHeadFile){.commitID = pCompactor->commitID}, - .pDataF = &(SDataFile){.commitID = pCompactor->commitID}, - .pSmaF = &(SSmaFile){.commitID = pCompactor->commitID}, - .nSttF = 1, - .aSttF = {&(SSttFile){.commitID = pCompactor->commitID}}}); - TSDB_CHECK_CODE(code, lino, _exit); - - if (pCompactor->aBlockIdx) { - taosArrayClear(pCompactor->aBlockIdx); - } else if ((pCompactor->aBlockIdx = taosArrayInit(0, sizeof(SBlockIdx))) == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; - TSDB_CHECK_CODE(code, lino, _exit); - } - - tMapDataReset(&pCompactor->mDataBlk); - - if (pCompactor->aSttBlk) { - taosArrayClear(pCompactor->aSttBlk); - } else if ((pCompactor->aSttBlk = taosArrayInit(0, sizeof(SSttBlk))) == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; - TSDB_CHECK_CODE(code, lino, _exit); - } - - tBlockDataReset(&pCompactor->bData); - tBlockDataReset(&pCompactor->sData); - -_exit: - if (code) { - tsdbError("vgId:%d %s failed at line %d since %s, fid:%d", TD_VID(pCompactor->pTsdb->pVnode), __func__, lino, - tstrerror(code), pCompactor->fid); - } else { - tsdbInfo("vgId:%d %s done, fid:%d", TD_VID(pCompactor->pTsdb->pVnode), __func__, pCompactor->fid); - } - return code; -} - -static int32_t tsdbCompactFileSetEnd(STsdbCompactor *pCompactor) { - int32_t code = 0; - int32_t lino = 0; - - ASSERT(pCompactor->bData.nRow == 0); - ASSERT(pCompactor->sData.nRow == 0); - - /* update files */ - code = tsdbWriteSttBlk(pCompactor->pWriter, pCompactor->aSttBlk); - TSDB_CHECK_CODE(code, lino, _exit); - - code = tsdbWriteBlockIdx(pCompactor->pWriter, pCompactor->aBlockIdx); - TSDB_CHECK_CODE(code, lino, _exit); - - code = tsdbUpdateDFileSetHeader(pCompactor->pWriter); - TSDB_CHECK_CODE(code, lino, _exit); - - code = tsdbFSUpsertFSet(&pCompactor->fs, &pCompactor->pWriter->wSet); - TSDB_CHECK_CODE(code, lino, _exit); - - code = tsdbDataFWriterClose(&pCompactor->pWriter, 1); - TSDB_CHECK_CODE(code, lino, _exit); - - code = tsdbDataFReaderClose(&pCompactor->pReader); - TSDB_CHECK_CODE(code, lino, _exit); - - /* do clear */ - while ((pCompactor->pIter = pCompactor->iterList) != NULL) { - pCompactor->iterList = pCompactor->pIter->next; - tsdbCloseDataIter2(pCompactor->pIter); - } - - tBlockDataReset(&pCompactor->bData); - tBlockDataReset(&pCompactor->sData); - -_exit: - if (code) { - tsdbError("vgId:%d %s failed at line %d since %s, fid:%d", TD_VID(pCompactor->pTsdb->pVnode), __func__, lino, - tstrerror(code), pCompactor->fid); - } else { - tsdbInfo("vgId:%d %s done, fid:%d", TD_VID(pCompactor->pTsdb->pVnode), __func__, pCompactor->fid); - } - return code; -} - -static int32_t tsdbCompactFileSet(STsdbCompactor *pCompactor, SDFileSet *pSet) { - int32_t code = 0; - int32_t lino = 0; - - // start compact - code = tsdbCompactFileSetStart(pCompactor, pSet); - TSDB_CHECK_CODE(code, lino, _exit); - - // do compact, end with a NULL row - SRowInfo *pRowInfo; - do { - code = tsdbCompactNextRow(pCompactor, &pRowInfo); - TSDB_CHECK_CODE(code, lino, _exit); - - code = tsdbCompactWriteTableData(pCompactor, pRowInfo); - TSDB_CHECK_CODE(code, lino, _exit); - } while (pRowInfo); - - // end compact - code = tsdbCompactFileSetEnd(pCompactor); - TSDB_CHECK_CODE(code, lino, _exit); - -_exit: - if (code) { - tsdbError("vgId:%d %s failed at line %d since %s, fid:%d", TD_VID(pCompactor->pTsdb->pVnode), __func__, lino, - tstrerror(code), pCompactor->fid); - if (pCompactor->pWriter) tsdbDataFWriterClose(&pCompactor->pWriter, 0); - while ((pCompactor->pIter = pCompactor->iterList)) { - pCompactor->iterList = pCompactor->pIter->next; - tsdbCloseDataIter2(pCompactor->pIter); - } - if (pCompactor->pReader) tsdbDataFReaderClose(&pCompactor->pReader); - } - return code; -} - -static void tsdbEndCompact(STsdbCompactor *pCompactor) { - // writer - tBlockDataDestroy(&pCompactor->sData); - tBlockDataDestroy(&pCompactor->bData); - taosArrayDestroy(pCompactor->aSttBlk); - tMapDataClear(&pCompactor->mDataBlk); - taosArrayDestroy(pCompactor->aBlockIdx); - - // reader - - // tombstone - taosArrayDestroy(pCompactor->aSkyLine); - taosArrayDestroy(pCompactor->aDelData); - taosArrayDestroy(pCompactor->aDelIdx); - - // others - tDestroyTSchema(pCompactor->tbSkm.pTSchema); - tsdbFSDestroy(&pCompactor->fs); - - tsdbInfo("vgId:%d %s done, commit ID:%" PRId64, TD_VID(pCompactor->pTsdb->pVnode), __func__, pCompactor->commitID); -} - -static int32_t tsdbBeginCompact(STsdb *pTsdb, SCompactInfo *pInfo, STsdbCompactor *pCompactor) { - int32_t code = 0; - int32_t lino = 0; - - pCompactor->pTsdb = pTsdb; - pCompactor->commitID = pInfo->commitID; - pCompactor->cmprAlg = pTsdb->pVnode->config.tsdbCfg.compression; - pCompactor->maxRows = pTsdb->pVnode->config.tsdbCfg.maxRows; - pCompactor->minRows = pTsdb->pVnode->config.tsdbCfg.minRows; - pCompactor->fid = INT32_MIN; - - code = tsdbFSCopy(pTsdb, &pCompactor->fs); - TSDB_CHECK_CODE(code, lino, _exit); - - /* tombstone */ - if (pCompactor->fs.pDelFile) { - code = tsdbDelFReaderOpen(&pCompactor->pDelFReader, pCompactor->fs.pDelFile, pTsdb); - TSDB_CHECK_CODE(code, lino, _exit); - - if ((pCompactor->aDelIdx = taosArrayInit(0, sizeof(SDelIdx))) == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; - TSDB_CHECK_CODE(code, lino, _exit); - } - - if ((pCompactor->aDelData = taosArrayInit(0, sizeof(SDelData))) == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; - TSDB_CHECK_CODE(code, lino, _exit); - } - - if ((pCompactor->aSkyLine = taosArrayInit(0, sizeof(TSDBKEY))) == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; - TSDB_CHECK_CODE(code, lino, _exit); - } - - code = tsdbReadDelIdx(pCompactor->pDelFReader, pCompactor->aDelIdx); - TSDB_CHECK_CODE(code, lino, _exit); - } - - /* reader */ - - /* writer */ - code = tBlockDataCreate(&pCompactor->bData); - TSDB_CHECK_CODE(code, lino, _exit); - - code = tBlockDataCreate(&pCompactor->sData); - TSDB_CHECK_CODE(code, lino, _exit); - -_exit: - if (code) { - tsdbError("vgId:%d %s failed at line %d since %s, commit ID:%" PRId64, TD_VID(pTsdb->pVnode), __func__, lino, - tstrerror(code), pCompactor->commitID); - tBlockDataDestroy(&pCompactor->sData); - tBlockDataDestroy(&pCompactor->bData); - if (pCompactor->fs.pDelFile) { - taosArrayDestroy(pCompactor->aSkyLine); - taosArrayDestroy(pCompactor->aDelData); - taosArrayDestroy(pCompactor->aDelIdx); - if (pCompactor->pDelFReader) tsdbDelFReaderClose(&pCompactor->pDelFReader); - } - tsdbFSDestroy(&pCompactor->fs); - } else { - tsdbInfo("vgId:%d %s done, commit ID:%" PRId64, TD_VID(pTsdb->pVnode), __func__, pCompactor->commitID); - } - return code; -} - -int32_t tsdbCompact(STsdb *pTsdb, SCompactInfo *pInfo) { - int32_t code = 0; - - STsdbCompactor *pCompactor = &(STsdbCompactor){0}; - - if ((code = tsdbBeginCompact(pTsdb, pInfo, pCompactor))) return code; - - for (;;) { - SDFileSet *pSet = (SDFileSet *)taosArraySearch(pCompactor->fs.aDFileSet, &(SDFileSet){.fid = pCompactor->fid}, - tDFileSetCmprFn, TD_GT); - if (pSet == NULL) { - pCompactor->fid = INT32_MAX; - break; - } - - if ((code = tsdbCompactFileSet(pCompactor, pSet))) goto _exit; - } - - if ((code = tsdbFSUpsertDelFile(&pCompactor->fs, NULL))) goto _exit; - -_exit: - if (code) { - tsdbAbortCompact(pCompactor); - } else { - tsdbFSPrepareCommit(pTsdb, &pCompactor->fs); - } - tsdbEndCompact(pCompactor); - return code; -} - -int32_t tsdbCommitCompact(STsdb *pTsdb) { - int32_t code = 0; - int32_t lino = 0; - - taosThreadRwlockWrlock(&pTsdb->rwLock); - - code = tsdbFSCommit(pTsdb); - if (code) { - taosThreadRwlockUnlock(&pTsdb->rwLock); - TSDB_CHECK_CODE(code, lino, _exit); - } - - taosThreadRwlockUnlock(&pTsdb->rwLock); - -_exit: - if (code) { - tsdbError("vgId:%d %s failed at line %d since %s", TD_VID(pTsdb->pVnode), __func__, lino, tstrerror(code)); - } else { - tsdbInfo("vgId:%d %s done", TD_VID(pTsdb->pVnode), __func__); - } - return code; -} diff --git a/source/dnode/vnode/src/tsdb/tsdbFS.c b/source/dnode/vnode/src/tsdb/tsdbFS.c index 5519d43012f46dc2e24ad56083ff421d5fcff1c5..b85d8d7746978337710dc93f18b758d1493ecd45 100644 --- a/source/dnode/vnode/src/tsdb/tsdbFS.c +++ b/source/dnode/vnode/src/tsdb/tsdbFS.c @@ -88,6 +88,98 @@ _exit: return code; } +extern int32_t tsdbDelFileToJson(const SDelFile *pDelFile, cJSON *pJson); +extern int32_t tsdbJsonToDelFile(const cJSON *pJson, SDelFile *pDelFile); +extern int32_t tsdbDFileSetToJson(const SDFileSet *pSet, cJSON *pJson); +extern int32_t tsdbJsonToDFileSet(const cJSON *pJson, SDFileSet *pDelFile); + +static int32_t tsdbFSToJsonStr(STsdbFS *pFS, char **ppStr) { + int32_t code = 0; + int32_t lino = 0; + cJSON *pJson; + + ppStr[0] = NULL; + + pJson = cJSON_CreateObject(); + TSDB_CHECK_NULL(pJson, code, lino, _exit, TSDB_CODE_OUT_OF_MEMORY); + + // format version + TSDB_CHECK_NULL(cJSON_AddNumberToObject(pJson, "format", 1), code, lino, _exit, TSDB_CODE_OUT_OF_MEMORY); + + // SDelFile + if (pFS->pDelFile) { + code = tsdbDelFileToJson(pFS->pDelFile, cJSON_AddObjectToObject(pJson, "del")); + TSDB_CHECK_CODE(code, lino, _exit); + } + + // aDFileSet + cJSON *aSetJson = cJSON_AddArrayToObject(pJson, "file set"); + TSDB_CHECK_NULL(aSetJson, code, lino, _exit, TSDB_CODE_OUT_OF_MEMORY); + for (int32_t iSet = 0; iSet < taosArrayGetSize(pFS->aDFileSet); iSet++) { + cJSON *pSetJson = cJSON_CreateObject(); + TSDB_CHECK_NULL(pSetJson, code, lino, _exit, TSDB_CODE_OUT_OF_MEMORY); + + cJSON_AddItemToArray(aSetJson, pSetJson); + + code = tsdbDFileSetToJson(taosArrayGet(pFS->aDFileSet, iSet), pSetJson); + TSDB_CHECK_CODE(code, lino, _exit); + } + + // print + ppStr[0] = cJSON_Print(pJson); + TSDB_CHECK_NULL(ppStr[0], code, lino, _exit, TSDB_CODE_OUT_OF_MEMORY); + +_exit: + cJSON_Delete(pJson); + if (code) tsdbError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); + return code; +} + +static int32_t tsdbJsonStrToFS(const char *pStr, STsdbFS *pFS) { + int32_t code = 0; + int32_t lino; + + cJSON *pJson = cJSON_Parse(pStr); + TSDB_CHECK(pJson, code, lino, _exit, TSDB_CODE_FILE_CORRUPTED); + + const cJSON *pItem; + + // format version + TSDB_CHECK(cJSON_IsNumber(pItem = cJSON_GetObjectItem(pJson, "format")), code, lino, _exit, TSDB_CODE_FILE_CORRUPTED); + + // SDelFile + if (cJSON_IsObject(pItem = cJSON_GetObjectItem(pJson, "del"))) { + pFS->pDelFile = (SDelFile *)taosMemoryCalloc(1, sizeof(SDelFile)); + TSDB_CHECK_NULL(pFS->pDelFile, code, lino, _exit, TSDB_CODE_OUT_OF_MEMORY); + + code = tsdbJsonToDelFile(pItem, pFS->pDelFile); + TSDB_CHECK_CODE(code, lino, _exit); + + pFS->pDelFile->nRef = 1; + } else { + pFS->pDelFile = NULL; + } + + // aDFileSet + taosArrayClear(pFS->aDFileSet); + + const cJSON *pSetJson; + TSDB_CHECK(cJSON_IsArray(pItem = cJSON_GetObjectItem(pJson, "file set")), code, lino, _exit, + TSDB_CODE_FILE_CORRUPTED); + cJSON_ArrayForEach(pSetJson, pItem) { + SDFileSet *pSet = (SDFileSet *)taosArrayReserve(pFS->aDFileSet, 1); + TSDB_CHECK_NULL(pSet, code, lino, _exit, TSDB_CODE_OUT_OF_MEMORY); + + code = tsdbJsonToDFileSet(pSetJson, pSet); + TSDB_CHECK_CODE(code, lino, _exit); + } + +_exit: + cJSON_Delete(pJson); + if (code) tsdbError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); + return code; +} + static int32_t tsdbSaveFSToFile(STsdbFS *pFS, const char *fname) { int32_t code = 0; int32_t lino = 0; @@ -132,6 +224,84 @@ _exit: return code; } +static int32_t tsdbSaveFSToJsonFile(STsdbFS *pFS, const char *fname) { + int32_t code; + int32_t lino; + char *pData; + + code = tsdbFSToJsonStr(pFS, &pData); + if (code) return code; + + TdFilePtr pFD = taosOpenFile(fname, TD_FILE_WRITE | TD_FILE_CREATE | TD_FILE_TRUNC); + if (pFD == NULL) { + code = TAOS_SYSTEM_ERROR(errno); + TSDB_CHECK_CODE(code, lino, _exit); + } + + int64_t n = taosWriteFile(pFD, pData, strlen(pData) + 1); + if (n < 0) { + code = TAOS_SYSTEM_ERROR(errno); + taosCloseFile(&pFD); + TSDB_CHECK_CODE(code, lino, _exit); + } + + if (taosFsyncFile(pFD) < 0) { + code = TAOS_SYSTEM_ERROR(errno); + taosCloseFile(&pFD); + TSDB_CHECK_CODE(code, lino, _exit); + } + + taosCloseFile(&pFD); + +_exit: + taosMemoryFree(pData); + if (code) { + tsdbError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); + } + + return code; +} + +static int32_t tsdbLoadFSFromJsonFile(const char *fname, STsdbFS *pFS) { + int32_t code = 0; + int32_t lino = 0; + char *pData = NULL; + + TdFilePtr pFD = taosOpenFile(fname, TD_FILE_READ); + if (pFD == NULL) { + code = TAOS_SYSTEM_ERROR(errno); + TSDB_CHECK_CODE(code, lino, _exit); + } + + int64_t size; + if (taosFStatFile(pFD, &size, NULL) < 0) { + code = TAOS_SYSTEM_ERROR(errno); + taosCloseFile(&pFD); + TSDB_CHECK_CODE(code, lino, _exit); + } + + if ((pData = taosMemoryMalloc(size)) == NULL) { + code = TSDB_CODE_OUT_OF_MEMORY; + taosCloseFile(&pFD); + TSDB_CHECK_CODE(code, lino, _exit); + } + + if (taosReadFile(pFD, pData, size) < 0) { + code = TAOS_SYSTEM_ERROR(errno); + taosCloseFile(&pFD); + TSDB_CHECK_CODE(code, lino, _exit); + } + + taosCloseFile(&pFD); + + TSDB_CHECK_CODE(code = tsdbJsonStrToFS(pData, pFS), lino, _exit); + +_exit: + if (pData) taosMemoryFree(pData); + if (code) tsdbError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); + return code; +} + int32_t tsdbFSCreate(STsdbFS *pFS) { int32_t code = 0; @@ -269,7 +439,8 @@ int32_t tDFileSetCmprFn(const void *p1, const void *p2) { return 0; } -static void tsdbGetCurrentFName(STsdb *pTsdb, char *current, char *current_t) { +static void tsdbGetCurrentFName(STsdb *pTsdb, char *current, char *current_t, char *current_json, + char *current_json_t) { SVnode *pVnode = pTsdb->pVnode; if (pVnode->pTfs) { if (current) { @@ -280,6 +451,14 @@ static void tsdbGetCurrentFName(STsdb *pTsdb, char *current, char *current_t) { snprintf(current_t, TSDB_FILENAME_LEN - 1, "%s%s%s%sCURRENT.t", tfsGetPrimaryPath(pTsdb->pVnode->pTfs), TD_DIRSEP, pTsdb->path, TD_DIRSEP); } + if (current_json) { + snprintf(current_json, TSDB_FILENAME_LEN - 1, "%s%s%s%scurrent.json", tfsGetPrimaryPath(pTsdb->pVnode->pTfs), + TD_DIRSEP, pTsdb->path, TD_DIRSEP); + } + if (current_json_t) { + snprintf(current_json_t, TSDB_FILENAME_LEN - 1, "%s%s%s%scurrent.json.t", tfsGetPrimaryPath(pTsdb->pVnode->pTfs), + TD_DIRSEP, pTsdb->path, TD_DIRSEP); + } } else { if (current) { snprintf(current, TSDB_FILENAME_LEN - 1, "%s%sCURRENT", pTsdb->path, TD_DIRSEP); @@ -287,6 +466,12 @@ static void tsdbGetCurrentFName(STsdb *pTsdb, char *current, char *current_t) { if (current_t) { snprintf(current_t, TSDB_FILENAME_LEN - 1, "%s%sCURRENT.t", pTsdb->path, TD_DIRSEP); } + if (current_json) { + snprintf(current_json, TSDB_FILENAME_LEN - 1, "%s%scurrent.json", pTsdb->path, TD_DIRSEP); + } + if (current_json_t) { + snprintf(current_json_t, TSDB_FILENAME_LEN - 1, "%s%scurrent.json.t", pTsdb->path, TD_DIRSEP); + } } } @@ -702,20 +887,15 @@ _exit: return code; } -// EXPOSED APIS ==================================================================================== -int32_t tsdbFSCommit(STsdb *pTsdb) { +static int32_t tsdbFSCommitImpl(STsdb *pTsdb, const char *fname, const char *tfname, bool isJson) { int32_t code = 0; int32_t lino = 0; STsdbFS fs = {0}; - char current[TSDB_FILENAME_LEN] = {0}; - char current_t[TSDB_FILENAME_LEN] = {0}; - tsdbGetCurrentFName(pTsdb, current, current_t); - - if (!taosCheckExistFile(current_t)) goto _exit; + if (!taosCheckExistFile(tfname)) goto _exit; // rename the file - if (taosRenameFile(current_t, current) < 0) { + if (taosRenameFile(tfname, fname) < 0) { code = TAOS_SYSTEM_ERROR(errno); TSDB_CHECK_CODE(code, lino, _exit); } @@ -724,7 +904,11 @@ int32_t tsdbFSCommit(STsdb *pTsdb) { code = tsdbFSCreate(&fs); TSDB_CHECK_CODE(code, lino, _exit); - code = tsdbLoadFSFromFile(current, &fs); + if (isJson) { + code = tsdbLoadFSFromJsonFile(fname, &fs); + } else { + code = tsdbLoadFSFromFile(fname, &fs); + } TSDB_CHECK_CODE(code, lino, _exit); // apply file change @@ -739,18 +923,19 @@ _exit: return code; } +// EXPOSED APIS ==================================================================================== +int32_t tsdbFSCommit(STsdb *pTsdb) { + char current_json[TSDB_FILENAME_LEN] = {0}; + char current_json_t[TSDB_FILENAME_LEN] = {0}; + tsdbGetCurrentFName(pTsdb, NULL, NULL, current_json, current_json_t); + return tsdbFSCommitImpl(pTsdb, current_json, current_json_t, true); +} + int32_t tsdbFSRollback(STsdb *pTsdb) { int32_t code = 0; - int32_t lino = 0; - - char current_t[TSDB_FILENAME_LEN] = {0}; - tsdbGetCurrentFName(pTsdb, NULL, current_t); - (void)taosRemoveFile(current_t); - -_exit: - if (code) { - tsdbError("vgId:%d, %s failed at line %d since %s", TD_VID(pTsdb->pVnode), __func__, lino, tstrerror(errno)); - } + char current_json_t[TSDB_FILENAME_LEN] = {0}; + tsdbGetCurrentFName(pTsdb, NULL, NULL, NULL, current_json_t); + (void)taosRemoveFile(current_json_t); return code; } @@ -766,13 +951,33 @@ int32_t tsdbFSOpen(STsdb *pTsdb, int8_t rollback) { // open impl char current[TSDB_FILENAME_LEN] = {0}; char current_t[TSDB_FILENAME_LEN] = {0}; - tsdbGetCurrentFName(pTsdb, current, current_t); + char current_json[TSDB_FILENAME_LEN] = {0}; + char current_json_t[TSDB_FILENAME_LEN] = {0}; + tsdbGetCurrentFName(pTsdb, current, current_t, current_json, current_json_t); if (taosCheckExistFile(current)) { + // CURRENT file exists code = tsdbLoadFSFromFile(current, &pTsdb->fs); TSDB_CHECK_CODE(code, lino, _exit); if (taosCheckExistFile(current_t)) { + if (rollback) { + (void)taosRemoveFile(current_t); + } else { + code = tsdbFSCommitImpl(pTsdb, current, current_t, false); + TSDB_CHECK_CODE(code, lino, _exit); + } + } + + code = tsdbSaveFSToJsonFile(&pTsdb->fs, current_json); + TSDB_CHECK_CODE(code, lino, _exit); + (void)taosRemoveFile(current); + } else if (taosCheckExistFile(current_json)) { + // current.json exists + code = tsdbLoadFSFromJsonFile(current_json, &pTsdb->fs); + TSDB_CHECK_CODE(code, lino, _exit); + + if (taosCheckExistFile(current_json_t)) { if (rollback) { code = tsdbFSRollback(pTsdb); TSDB_CHECK_CODE(code, lino, _exit); @@ -782,11 +987,10 @@ int32_t tsdbFSOpen(STsdb *pTsdb, int8_t rollback) { } } } else { - // empty one - code = tsdbSaveFSToFile(&pTsdb->fs, current); - TSDB_CHECK_CODE(code, lino, _exit); - + // empty TSDB ASSERT(!rollback); + code = tsdbSaveFSToJsonFile(&pTsdb->fs, current_json); + TSDB_CHECK_CODE(code, lino, _exit); } // scan and fix FS @@ -1024,12 +1228,12 @@ _exit: int32_t tsdbFSPrepareCommit(STsdb *pTsdb, STsdbFS *pFSNew) { int32_t code = 0; int32_t lino = 0; - char tfname[TSDB_FILENAME_LEN]; + char current_json_t[TSDB_FILENAME_LEN]; - tsdbGetCurrentFName(pTsdb, NULL, tfname); + tsdbGetCurrentFName(pTsdb, NULL, NULL, NULL, current_json_t); - // gnrt CURRENT.t - code = tsdbSaveFSToFile(pFSNew, tfname); + // generate current.json + code = tsdbSaveFSToJsonFile(pFSNew, current_json_t); TSDB_CHECK_CODE(code, lino, _exit); _exit: diff --git a/source/dnode/vnode/src/tsdb/tsdbFile.c b/source/dnode/vnode/src/tsdb/tsdbFile.c index d91475376b240812b8942227fa85e37cb5671dec..8b2b2caec77f829907d3b81cd51d43e35f856f83 100644 --- a/source/dnode/vnode/src/tsdb/tsdbFile.c +++ b/source/dnode/vnode/src/tsdb/tsdbFile.c @@ -92,11 +92,11 @@ static int32_t tGetSmaFile(uint8_t *p, SSmaFile *pSmaFile) { } // EXPOSED APIS ================================================== -static char* getFileNamePrefix(STsdb *pTsdb, SDiskID did, int32_t fid, uint64_t commitId, char fname[]) { - const char* p1 = tfsGetDiskPath(pTsdb->pVnode->pTfs, did); - int32_t len = strlen(p1); +static char *getFileNamePrefix(STsdb *pTsdb, SDiskID did, int32_t fid, uint64_t commitId, char fname[]) { + const char *p1 = tfsGetDiskPath(pTsdb->pVnode->pTfs, did); + int32_t len = strlen(p1); - char* p = memcpy(fname, p1, len); + char *p = memcpy(fname, p1, len); p += len; *(p++) = TD_DIRSEP[0]; @@ -121,25 +121,25 @@ static char* getFileNamePrefix(STsdb *pTsdb, SDiskID did, int32_t fid, uint64_t } void tsdbHeadFileName(STsdb *pTsdb, SDiskID did, int32_t fid, SHeadFile *pHeadF, char fname[]) { - char* p = getFileNamePrefix(pTsdb, did, fid, pHeadF->commitID, fname); + char *p = getFileNamePrefix(pTsdb, did, fid, pHeadF->commitID, fname); memcpy(p, ".head", 5); p[5] = 0; } void tsdbDataFileName(STsdb *pTsdb, SDiskID did, int32_t fid, SDataFile *pDataF, char fname[]) { - char* p = getFileNamePrefix(pTsdb, did, fid, pDataF->commitID, fname); + char *p = getFileNamePrefix(pTsdb, did, fid, pDataF->commitID, fname); memcpy(p, ".data", 5); p[5] = 0; } void tsdbSttFileName(STsdb *pTsdb, SDiskID did, int32_t fid, SSttFile *pSttF, char fname[]) { - char* p = getFileNamePrefix(pTsdb, did, fid, pSttF->commitID, fname); + char *p = getFileNamePrefix(pTsdb, did, fid, pSttF->commitID, fname); memcpy(p, ".stt", 4); p[4] = 0; } void tsdbSmaFileName(STsdb *pTsdb, SDiskID did, int32_t fid, SSmaFile *pSmaF, char fname[]) { - char* p = getFileNamePrefix(pTsdb, did, fid, pSmaF->commitID, fname); + char *p = getFileNamePrefix(pTsdb, did, fid, pSmaF->commitID, fname); memcpy(p, ".sma", 4); p[4] = 0; } @@ -280,6 +280,272 @@ int32_t tGetDFileSet(uint8_t *p, SDFileSet *pSet) { return n; } +static int32_t tDiskIdToJson(const SDiskID *pDiskId, cJSON *pJson) { + int32_t code = 0; + int32_t lino; + + if (pJson == NULL) return TSDB_CODE_OUT_OF_MEMORY; + + TSDB_CHECK_NULL(cJSON_AddNumberToObject(pJson, "level", pDiskId->level), code, lino, _exit, TSDB_CODE_OUT_OF_MEMORY); + TSDB_CHECK_NULL(cJSON_AddNumberToObject(pJson, "id", pDiskId->id), code, lino, _exit, TSDB_CODE_OUT_OF_MEMORY); + +_exit: + return code; +} +static int32_t tJsonToDiskId(const cJSON *pJson, SDiskID *pDiskId) { + int32_t code = 0; + int32_t lino; + + const cJSON *pItem; + + // level + TSDB_CHECK(cJSON_IsNumber(pItem = cJSON_GetObjectItem(pJson, "level")), code, lino, _exit, TSDB_CODE_FILE_CORRUPTED); + pDiskId->level = (int32_t)pItem->valuedouble; + + // id + TSDB_CHECK(cJSON_IsNumber(pItem = cJSON_GetObjectItem(pJson, "id")), code, lino, _exit, TSDB_CODE_FILE_CORRUPTED); + pDiskId->id = (int32_t)pItem->valuedouble; + +_exit: + return code; +} + +static int32_t tHeadFileToJson(const SHeadFile *pHeadF, cJSON *pJson) { + int32_t code = 0; + int32_t lino; + + if (pJson == NULL) return TSDB_CODE_OUT_OF_MEMORY; + + TSDB_CHECK_NULL(cJSON_AddNumberToObject(pJson, "commit id", pHeadF->commitID), code, lino, _exit, + TSDB_CODE_OUT_OF_MEMORY); + TSDB_CHECK_NULL(cJSON_AddNumberToObject(pJson, "size", pHeadF->size), code, lino, _exit, TSDB_CODE_OUT_OF_MEMORY); + TSDB_CHECK_NULL(cJSON_AddNumberToObject(pJson, "offset", pHeadF->offset), code, lino, _exit, TSDB_CODE_OUT_OF_MEMORY); + +_exit: + return code; +} + +static int32_t tJsonToHeadFile(const cJSON *pJson, SHeadFile *pHeadF) { + int32_t code = 0; + int32_t lino; + + const cJSON *pItem; + + // commit id + TSDB_CHECK(cJSON_IsNumber(pItem = cJSON_GetObjectItem(pJson, "commit id")), code, lino, _exit, + TSDB_CODE_FILE_CORRUPTED); + pHeadF->commitID = (int64_t)pItem->valuedouble; + + // size + TSDB_CHECK(cJSON_IsNumber(pItem = cJSON_GetObjectItem(pJson, "size")), code, lino, _exit, TSDB_CODE_FILE_CORRUPTED); + pHeadF->size = (int64_t)pItem->valuedouble; + + // offset + TSDB_CHECK(cJSON_IsNumber(pItem = cJSON_GetObjectItem(pJson, "offset")), code, lino, _exit, TSDB_CODE_FILE_CORRUPTED); + pHeadF->offset = (int64_t)pItem->valuedouble; + +_exit: + return code; +} + +static int32_t tDataFileToJson(const SDataFile *pDataF, cJSON *pJson) { + int32_t code = 0; + int32_t lino; + + if (pJson == NULL) return TSDB_CODE_OUT_OF_MEMORY; + + TSDB_CHECK_NULL(cJSON_AddNumberToObject(pJson, "commit id", pDataF->commitID), code, lino, _exit, + TSDB_CODE_OUT_OF_MEMORY); + TSDB_CHECK_NULL(cJSON_AddNumberToObject(pJson, "size", pDataF->size), code, lino, _exit, TSDB_CODE_OUT_OF_MEMORY); + +_exit: + return code; +} + +static int32_t tJsonToDataFile(const cJSON *pJson, SDataFile *pDataF) { + int32_t code = 0; + int32_t lino; + + const cJSON *pItem; + + // commit id + TSDB_CHECK(cJSON_IsNumber(pItem = cJSON_GetObjectItem(pJson, "commit id")), code, lino, _exit, + TSDB_CODE_FILE_CORRUPTED); + pDataF->commitID = (int64_t)pItem->valuedouble; + + // size + TSDB_CHECK(cJSON_IsNumber(pItem = cJSON_GetObjectItem(pJson, "size")), code, lino, _exit, TSDB_CODE_FILE_CORRUPTED); + pDataF->size = (int64_t)pItem->valuedouble; + +_exit: + return code; +} + +static int32_t tSmaFileToJson(const SSmaFile *pSmaF, cJSON *pJson) { + int32_t code = 0; + int32_t lino; + + if (pJson == NULL) return TSDB_CODE_OUT_OF_MEMORY; + + TSDB_CHECK_NULL(cJSON_AddNumberToObject(pJson, "commit id", pSmaF->commitID), code, lino, _exit, + TSDB_CODE_OUT_OF_MEMORY); + TSDB_CHECK_NULL(cJSON_AddNumberToObject(pJson, "size", pSmaF->size), code, lino, _exit, TSDB_CODE_OUT_OF_MEMORY); + +_exit: + return code; +} + +static int32_t tJsonToSmaFile(const cJSON *pJson, SSmaFile *pSmaF) { + int32_t code = 0; + int32_t lino; + + // commit id + const cJSON *pItem; + TSDB_CHECK(cJSON_IsNumber(pItem = cJSON_GetObjectItem(pJson, "commit id")), code, lino, _exit, + TSDB_CODE_FILE_CORRUPTED); + pSmaF->commitID = (int64_t)pItem->valuedouble; + + // size + TSDB_CHECK(cJSON_IsNumber(pItem = cJSON_GetObjectItem(pJson, "size")), code, lino, _exit, TSDB_CODE_FILE_CORRUPTED); + pSmaF->size = (int64_t)pItem->valuedouble; + +_exit: + return code; +} + +static int32_t tSttFileToJson(const SSttFile *pSttF, cJSON *pJson) { + int32_t code = 0; + int32_t lino; + + if (pJson == NULL) return TSDB_CODE_OUT_OF_MEMORY; + + TSDB_CHECK_NULL(cJSON_AddNumberToObject(pJson, "commit id", pSttF->commitID), code, lino, _exit, + TSDB_CODE_OUT_OF_MEMORY); + TSDB_CHECK_NULL(cJSON_AddNumberToObject(pJson, "size", pSttF->size), code, lino, _exit, TSDB_CODE_OUT_OF_MEMORY); + TSDB_CHECK_NULL(cJSON_AddNumberToObject(pJson, "offset", pSttF->offset), code, lino, _exit, TSDB_CODE_OUT_OF_MEMORY); + +_exit: + return code; +} + +static int32_t tJsonToSttFile(const cJSON *pJson, SSttFile *pSttF) { + int32_t code = 0; + int32_t lino; + + const cJSON *pItem; + + // commit id + TSDB_CHECK(cJSON_IsNumber(pItem = cJSON_GetObjectItem(pJson, "commit id")), code, lino, _exit, + TSDB_CODE_FILE_CORRUPTED); + pSttF->commitID = (int64_t)pItem->valuedouble; + + // size + TSDB_CHECK(cJSON_IsNumber(pItem = cJSON_GetObjectItem(pJson, "size")), code, lino, _exit, TSDB_CODE_FILE_CORRUPTED); + pSttF->size = (int64_t)pItem->valuedouble; + + // offset + TSDB_CHECK(cJSON_IsNumber(pItem = cJSON_GetObjectItem(pJson, "offset")), code, lino, _exit, TSDB_CODE_FILE_CORRUPTED); + pSttF->offset = (int64_t)pItem->valuedouble; + +_exit: + return code; +} + +int32_t tsdbDFileSetToJson(const SDFileSet *pSet, cJSON *pJson) { + int32_t code = 0; + int32_t lino; + + if (pJson == NULL) return TSDB_CODE_OUT_OF_MEMORY; + + code = tDiskIdToJson(&pSet->diskId, cJSON_AddObjectToObject(pJson, "disk id")); + TSDB_CHECK_CODE(code, lino, _exit); + + TSDB_CHECK_NULL(cJSON_AddNumberToObject(pJson, "fid", pSet->fid), code, lino, _exit, TSDB_CODE_OUT_OF_MEMORY); + + // head + code = tHeadFileToJson(pSet->pHeadF, cJSON_AddObjectToObject(pJson, "head")); + TSDB_CHECK_CODE(code, lino, _exit); + + // data + code = tDataFileToJson(pSet->pDataF, cJSON_AddObjectToObject(pJson, "data")); + TSDB_CHECK_CODE(code, lino, _exit); + + // sma + code = tSmaFileToJson(pSet->pSmaF, cJSON_AddObjectToObject(pJson, "sma")); + TSDB_CHECK_CODE(code, lino, _exit); + + // stt array + cJSON *aSttJson = cJSON_AddArrayToObject(pJson, "stt"); + TSDB_CHECK_NULL(aSttJson, code, lino, _exit, TSDB_CODE_OUT_OF_MEMORY); + for (int32_t iStt = 0; iStt < pSet->nSttF; iStt++) { + cJSON *pSttJson = cJSON_CreateObject(); + TSDB_CHECK_NULL(pSttJson, code, lino, _exit, TSDB_CODE_OUT_OF_MEMORY); + + cJSON_AddItemToArray(aSttJson, pSttJson); + + code = tSttFileToJson(pSet->aSttF[iStt], pSttJson); + TSDB_CHECK_CODE(code, lino, _exit); + } + +_exit: + return code; +} + +int32_t tsdbJsonToDFileSet(const cJSON *pJson, SDFileSet *pSet) { + int32_t code = 0; + int32_t lino; + + const cJSON *pItem; + // disk id + TSDB_CHECK(cJSON_IsObject(pItem = cJSON_GetObjectItem(pJson, "disk id")), code, lino, _exit, + TSDB_CODE_FILE_CORRUPTED); + code = tJsonToDiskId(pItem, &pSet->diskId); + TSDB_CHECK_CODE(code, lino, _exit); + + // fid + TSDB_CHECK(cJSON_IsNumber(pItem = cJSON_GetObjectItem(pJson, "fid")), code, lino, _exit, TSDB_CODE_FILE_CORRUPTED); + pSet->fid = (int32_t)pItem->valuedouble; + + // head + TSDB_CHECK(cJSON_IsObject(pItem = cJSON_GetObjectItem(pJson, "head")), code, lino, _exit, TSDB_CODE_FILE_CORRUPTED); + TSDB_CHECK_NULL(pSet->pHeadF = (SHeadFile *)taosMemoryMalloc(sizeof(SHeadFile)), code, lino, _exit, + TSDB_CODE_OUT_OF_MEMORY); + TSDB_CHECK_CODE(code = tJsonToHeadFile(pItem, pSet->pHeadF), lino, _exit); + pSet->pHeadF->nRef = 1; + + // data + TSDB_CHECK(cJSON_IsObject(pItem = cJSON_GetObjectItem(pJson, "data")), code, lino, _exit, TSDB_CODE_FILE_CORRUPTED); + TSDB_CHECK_NULL(pSet->pDataF = (SDataFile *)taosMemoryMalloc(sizeof(SDataFile)), code, lino, _exit, + TSDB_CODE_OUT_OF_MEMORY); + TSDB_CHECK_CODE(code = tJsonToDataFile(pItem, pSet->pDataF), lino, _exit); + pSet->pDataF->nRef = 1; + + // sma + TSDB_CHECK(cJSON_IsObject(pItem = cJSON_GetObjectItem(pJson, "sma")), code, lino, _exit, TSDB_CODE_FILE_CORRUPTED); + TSDB_CHECK_NULL(pSet->pSmaF = (SSmaFile *)taosMemoryMalloc(sizeof(SSmaFile)), code, lino, _exit, + TSDB_CODE_OUT_OF_MEMORY); + TSDB_CHECK_CODE(code = tJsonToSmaFile(pItem, pSet->pSmaF), lino, _exit); + pSet->pSmaF->nRef = 1; + + // stt array + const cJSON *element; + pSet->nSttF = 0; + TSDB_CHECK(cJSON_IsArray(pItem = cJSON_GetObjectItem(pJson, "stt")), code, lino, _exit, TSDB_CODE_FILE_CORRUPTED); + cJSON_ArrayForEach(element, pItem) { + TSDB_CHECK(cJSON_IsObject(element), code, lino, _exit, TSDB_CODE_FILE_CORRUPTED); + + pSet->aSttF[pSet->nSttF] = (SSttFile *)taosMemoryMalloc(sizeof(SSttFile)); + TSDB_CHECK_NULL(pSet->aSttF[pSet->nSttF], code, lino, _exit, TSDB_CODE_OUT_OF_MEMORY); + TSDB_CHECK_CODE(code = tJsonToSttFile(element, pSet->aSttF[pSet->nSttF]), lino, _exit); + pSet->aSttF[pSet->nSttF]->nRef = 1; + pSet->nSttF++; + } + +_exit: + if (code) tsdbError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); + return code; +} + // SDelFile =============================================== void tsdbDelFileName(STsdb *pTsdb, SDelFile *pFile, char fname[]) { snprintf(fname, TSDB_FILENAME_LEN - 1, "%s%s%s%sv%dver%" PRId64 "%s", tfsGetPrimaryPath(pTsdb->pVnode->pTfs), @@ -305,3 +571,42 @@ int32_t tGetDelFile(uint8_t *p, SDelFile *pDelFile) { return n; } + +int32_t tsdbDelFileToJson(const SDelFile *pDelFile, cJSON *pJson) { + if (pJson == NULL) return TSDB_CODE_OUT_OF_MEMORY; + + int32_t code = 0; + int32_t lino; + + TSDB_CHECK_NULL(cJSON_AddNumberToObject(pJson, "commit id", pDelFile->commitID), code, lino, _exit, + TSDB_CODE_OUT_OF_MEMORY); + TSDB_CHECK_NULL(cJSON_AddNumberToObject(pJson, "size", pDelFile->size), code, lino, _exit, TSDB_CODE_OUT_OF_MEMORY); + TSDB_CHECK_NULL(cJSON_AddNumberToObject(pJson, "offset", pDelFile->offset), code, lino, _exit, + TSDB_CODE_OUT_OF_MEMORY); + +_exit: + return code; +} + +int32_t tsdbJsonToDelFile(const cJSON *pJson, SDelFile *pDelFile) { + int32_t code = 0; + int32_t lino; + + const cJSON *pItem; + + // commit id + TSDB_CHECK(cJSON_IsNumber(pItem = cJSON_GetObjectItem(pJson, "commit id")), code, lino, _exit, + TSDB_CODE_FILE_CORRUPTED); + pDelFile->commitID = cJSON_GetNumberValue(pItem); + + // size + TSDB_CHECK(cJSON_IsNumber(pItem = cJSON_GetObjectItem(pJson, "size")), code, lino, _exit, TSDB_CODE_FILE_CORRUPTED); + pDelFile->size = cJSON_GetNumberValue(pItem); + + // offset + TSDB_CHECK(cJSON_IsNumber(pItem = cJSON_GetObjectItem(pJson, "offset")), code, lino, _exit, TSDB_CODE_FILE_CORRUPTED); + pDelFile->offset = cJSON_GetNumberValue(pItem); + +_exit: + return code; +} \ No newline at end of file diff --git a/source/dnode/vnode/src/tsdb/tsdbMergeTree.c b/source/dnode/vnode/src/tsdb/tsdbMergeTree.c index d4af0422d781f4560abe9ef7fe28353ff99fee0c..d9d60442ffbfd36dfa9b132b4d5f9c714558de7a 100644 --- a/source/dnode/vnode/src/tsdb/tsdbMergeTree.c +++ b/source/dnode/vnode/src/tsdb/tsdbMergeTree.c @@ -404,7 +404,7 @@ void tLDataIterNextBlock(SLDataIter *pIter, const char *idStr) { tsdbDebug("try next last file block:%d from %d, trigger by uid:%" PRIu64 ", file index:%d, %s", pIter->iSttBlk, oldIndex, pIter->uid, pIter->iStt, idStr); } else { - tsdbDebug("no more last block qualified, uid:%" PRIu64 ", file index::%d, %s", pIter->uid, oldIndex, idStr); + tsdbDebug("no more last block qualified, uid:%" PRIu64 ", file index:%d, %s", pIter->uid, oldIndex, idStr); } } diff --git a/source/dnode/vnode/src/tsdb/tsdbRead.c b/source/dnode/vnode/src/tsdb/tsdbRead.c index f18547e2b3e4e210dbeac9e0fffff11ab1d61adc..31153f0832bb83f3b6c68acd0957b4b5171f61da 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRead.c +++ b/source/dnode/vnode/src/tsdb/tsdbRead.c @@ -44,6 +44,7 @@ typedef struct SBlockIndex { typedef struct STableBlockScanInfo { uint64_t uid; TSKEY lastKey; + TSKEY lastKeyInStt; // last accessed key in stt SMapData mapData; // block info (compressed) SArray* pBlockList; // block data index list, SArray SIterInfo iter; // mem buffer skip list iterator @@ -192,7 +193,7 @@ static TSDBROW* getValidMemRow(SIterInfo* pIter, const SArray* pDelList, STsdbRe static int32_t doMergeRowsInFileBlocks(SBlockData* pBlockData, STableBlockScanInfo* pScanInfo, STsdbReader* pReader, SRowMerger* pMerger); static int32_t doMergeRowsInLastBlock(SLastBlockReader* pLastBlockReader, STableBlockScanInfo* pScanInfo, int64_t ts, - SRowMerger* pMerger, SVersionRange* pVerRange); + SRowMerger* pMerger, SVersionRange* pVerRange, const char* id); static int32_t doMergeRowsInBuf(SIterInfo* pIter, uint64_t uid, int64_t ts, SArray* pDelList, SRowMerger* pMerger, STsdbReader* pReader); static int32_t doAppendRowFromTSRow(SSDataBlock* pBlock, STsdbReader* pReader, SRow* pTSRow, @@ -314,11 +315,11 @@ static int32_t ensureBlockScanInfoBuf(SBlockInfoBuf* pBuf, int32_t numOfTables) } if (pBuf->numOfTables > 0) { - STableBlockScanInfo **p = (STableBlockScanInfo**)taosArrayPop(pBuf->pData); + STableBlockScanInfo** p = (STableBlockScanInfo**)taosArrayPop(pBuf->pData); taosMemoryFree(*p); pBuf->numOfTables /= pBuf->numPerBucket; } - + int32_t num = (numOfTables - pBuf->numOfTables) / pBuf->numPerBucket; int32_t remainder = (numOfTables - pBuf->numOfTables) % pBuf->numPerBucket; if (pBuf->pData == NULL) { @@ -402,9 +403,11 @@ static SHashObj* createDataBlockScanInfo(STsdbReader* pTsdbReader, SBlockInfoBuf if (ASCENDING_TRAVERSE(pTsdbReader->order)) { int64_t skey = pTsdbReader->window.skey; pScanInfo->lastKey = (skey > INT64_MIN) ? (skey - 1) : skey; + pScanInfo->lastKeyInStt = skey; } else { int64_t ekey = pTsdbReader->window.ekey; pScanInfo->lastKey = (ekey < INT64_MAX) ? (ekey + 1) : ekey; + pScanInfo->lastKeyInStt = ekey; } taosHashPut(pTableMap, &pScanInfo->uid, sizeof(uint64_t), &pScanInfo, POINTER_BYTES); @@ -1797,21 +1800,18 @@ static bool nextRowFromLastBlocks(SLastBlockReader* pLastBlockReader, STableBloc while (1) { bool hasVal = tMergeTreeNext(&pLastBlockReader->mergeTree); - if (!hasVal) { + if (!hasVal) { // the next value will be the accessed key in stt + pScanInfo->lastKeyInStt += step; return false; } TSDBROW row = tMergeTreeGetRow(&pLastBlockReader->mergeTree); TSDBKEY k = TSDBROW_KEY(&row); - if (hasBeenDropped(pScanInfo->delSkyline, &pScanInfo->lastBlockDelIndex, &k, pLastBlockReader->order, pVerRange)) { - pScanInfo->lastKey = k.ts; - } else { + pScanInfo->lastKeyInStt = k.ts; + + if (!hasBeenDropped(pScanInfo->delSkyline, &pScanInfo->lastBlockDelIndex, &k, pLastBlockReader->order, pVerRange)) { // the qualifed ts may equal to k.ts, only a greater version one. // here we need to fallback one step. - if (pScanInfo->lastKey == k.ts) { - pScanInfo->lastKey -= step; - } - return true; } } @@ -1951,7 +1951,7 @@ static int32_t doMergeBufAndFileRows(STsdbReader* pReader, STableBlockScanInfo* return code; } } - doMergeRowsInLastBlock(pLastBlockReader, pBlockScanInfo, tsLast, &merge, &pReader->verRange); + doMergeRowsInLastBlock(pLastBlockReader, pBlockScanInfo, tsLast, &merge, &pReader->verRange, pReader->idStr); } if (minKey == k.ts) { @@ -1999,7 +1999,7 @@ static int32_t doMergeBufAndFileRows(STsdbReader* pReader, STableBlockScanInfo* return code; } } - doMergeRowsInLastBlock(pLastBlockReader, pBlockScanInfo, tsLast, &merge, &pReader->verRange); + doMergeRowsInLastBlock(pLastBlockReader, pBlockScanInfo, tsLast, &merge, &pReader->verRange, pReader->idStr); } if (minKey == key) { @@ -2052,7 +2052,7 @@ static int32_t doMergeFileBlockAndLastBlock(SLastBlockReader* pLastBlockReader, TSDBROW fRow1 = tMergeTreeGetRow(&pLastBlockReader->mergeTree); tsdbRowMerge(&merge, &fRow1); - doMergeRowsInLastBlock(pLastBlockReader, pBlockScanInfo, tsLastBlock, &merge, &pReader->verRange); + doMergeRowsInLastBlock(pLastBlockReader, pBlockScanInfo, tsLastBlock, &merge, &pReader->verRange, pReader->idStr); code = tsdbRowMergerGetRow(&merge, &pTSRow); if (code != TSDB_CODE_SUCCESS) { @@ -2070,7 +2070,7 @@ static int32_t doMergeFileBlockAndLastBlock(SLastBlockReader* pLastBlockReader, return code; } - doMergeRowsInLastBlock(pLastBlockReader, pBlockScanInfo, tsLastBlock, &merge, &pReader->verRange); + doMergeRowsInLastBlock(pLastBlockReader, pBlockScanInfo, tsLastBlock, &merge, &pReader->verRange, pReader->idStr); // merge with block data if ts == key if (tsLastBlock == pBlockData->aTSKEY[pDumpInfo->rowIndex]) { @@ -2123,7 +2123,7 @@ static int32_t mergeFileBlockAndLastBlock(STsdbReader* pReader, SLastBlockReader TSDBROW fRow1 = tMergeTreeGetRow(&pLastBlockReader->mergeTree); tsdbRowMerge(&merge, &fRow1); - doMergeRowsInLastBlock(pLastBlockReader, pBlockScanInfo, ts, &merge, &pReader->verRange); + doMergeRowsInLastBlock(pLastBlockReader, pBlockScanInfo, ts, &merge, &pReader->verRange, pReader->idStr); code = tsdbRowMergerGetRow(&merge, &pTSRow); if (code != TSDB_CODE_SUCCESS) { @@ -2232,7 +2232,7 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo* } } - doMergeRowsInLastBlock(pLastBlockReader, pBlockScanInfo, tsLast, &merge, &pReader->verRange); + doMergeRowsInLastBlock(pLastBlockReader, pBlockScanInfo, tsLast, &merge, &pReader->verRange, pReader->idStr); } if (minKey == ik.ts) { @@ -2323,7 +2323,7 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo* return code; } } - doMergeRowsInLastBlock(pLastBlockReader, pBlockScanInfo, tsLast, &merge, &pReader->verRange); + doMergeRowsInLastBlock(pLastBlockReader, pBlockScanInfo, tsLast, &merge, &pReader->verRange, pReader->idStr); } if (minKey == key) { @@ -2474,9 +2474,9 @@ static bool initLastBlockReader(SLastBlockReader* pLBlockReader, STableBlockScan int32_t step = ASCENDING_TRAVERSE(pLBlockReader->order) ? 1 : -1; STimeWindow w = pLBlockReader->window; if (ASCENDING_TRAVERSE(pLBlockReader->order)) { - w.skey = pScanInfo->lastKey + step; + w.skey = pScanInfo->lastKeyInStt; } else { - w.ekey = pScanInfo->lastKey + step; + w.ekey = pScanInfo->lastKeyInStt; } tsdbDebug("init last block reader, window:%" PRId64 "-%" PRId64 ", uid:%" PRIu64 ", %s", w.skey, w.ekey, @@ -3514,6 +3514,7 @@ static int32_t checkForNeighborFileBlock(STsdbReader* pReader, STableBlockScanIn CHECK_FILEBLOCK_STATE* state) { SFileBlockDumpInfo* pDumpInfo = &pReader->status.fBlockDumpInfo; SBlockData* pBlockData = &pReader->status.fileBlockData; + bool asc = ASCENDING_TRAVERSE(pReader->order); *state = CHECK_FILEBLOCK_QUIT; int32_t step = ASCENDING_TRAVERSE(pReader->order) ? 1 : -1; @@ -3524,7 +3525,7 @@ static int32_t checkForNeighborFileBlock(STsdbReader* pReader, STableBlockScanIn if (loadNeighbor && (code == TSDB_CODE_SUCCESS)) { pDumpInfo->rowIndex = doMergeRowsInFileBlockImpl(pBlockData, pDumpInfo->rowIndex, key, pMerger, &pReader->verRange, step); - if (pDumpInfo->rowIndex >= pDumpInfo->totalRows) { + if ((pDumpInfo->rowIndex >= pDumpInfo->totalRows && asc) || (pDumpInfo->rowIndex < 0 && !asc)) { *state = CHECK_FILEBLOCK_CONT; } } @@ -3569,13 +3570,16 @@ int32_t doMergeRowsInFileBlocks(SBlockData* pBlockData, STableBlockScanInfo* pSc } int32_t doMergeRowsInLastBlock(SLastBlockReader* pLastBlockReader, STableBlockScanInfo* pScanInfo, int64_t ts, - SRowMerger* pMerger, SVersionRange* pVerRange) { + SRowMerger* pMerger, SVersionRange* pVerRange, const char* idStr) { while (nextRowFromLastBlocks(pLastBlockReader, pScanInfo, pVerRange)) { int64_t next1 = getCurrentKeyInLastBlock(pLastBlockReader); if (next1 == ts) { TSDBROW fRow1 = tMergeTreeGetRow(&pLastBlockReader->mergeTree); tsdbRowMerge(pMerger, &fRow1); } else { + tsdbTrace("uid:%" PRIu64 " last del index:%d, del range:%d, lastKeyInStt:%" PRId64 ", %s", pScanInfo->uid, + pScanInfo->lastBlockDelIndex, (int32_t)taosArrayGetSize(pScanInfo->delSkyline), pScanInfo->lastKeyInStt, + idStr); break; } } @@ -3925,7 +3929,8 @@ int32_t tsdbSetTableList(STsdbReader* pReader, const void* pTableList, int32_t n if (code) { return code; } - pReader->status.uidList.tableUidList = (uint64_t*)taosMemoryRealloc(pReader->status.uidList.tableUidList, sizeof(uint64_t) * num); + pReader->status.uidList.tableUidList = + (uint64_t*)taosMemoryRealloc(pReader->status.uidList.tableUidList, sizeof(uint64_t) * num); } taosHashClear(pReader->status.pTableMap); @@ -3938,6 +3943,17 @@ int32_t tsdbSetTableList(STsdbReader* pReader, const void* pTableList, int32_t n pInfo->uid = pList[i].uid; pUidList->tableUidList[i] = pList[i].uid; + // todo extract method + if (ASCENDING_TRAVERSE(pReader->order)) { + int64_t skey = pReader->window.skey; + pInfo->lastKey = (skey > INT64_MIN) ? (skey - 1) : skey; + pInfo->lastKeyInStt = skey; + } else { + int64_t ekey = pReader->window.ekey; + pInfo->lastKey = (ekey < INT64_MAX) ? (ekey + 1) : ekey; + pInfo->lastKeyInStt = ekey; + } + taosHashPut(pReader->status.pTableMap, &pInfo->uid, sizeof(uint64_t), &pInfo, POINTER_BYTES); } @@ -4723,11 +4739,10 @@ int32_t tsdbReaderReset(STsdbReader* pReader, SQueryTableDataCond* pCond) { } static int32_t getBucketIndex(int32_t startRow, int32_t bucketRange, int32_t numOfRows, int32_t numOfBucket) { - int32_t bucketIndex = ((numOfRows - startRow) / bucketRange); + int32_t bucketIndex = ((numOfRows - startRow) / bucketRange); if (bucketIndex == numOfBucket) { bucketIndex -= 1; } - return bucketIndex; } @@ -4741,6 +4756,7 @@ int32_t tsdbGetFileBlocksDistInfo(STsdbReader* pReader, STableBlockDistInfo* pTa // find the start data block in file + // find the start data block in file tsdbAcquireReader(pReader); if (pReader->suspended) { tsdbReaderResume(pReader); diff --git a/source/dnode/vnode/src/tsdb/tsdbSnapshot.c b/source/dnode/vnode/src/tsdb/tsdbSnapshot.c index 1a98134d70c486259a659cb9771152333835b8c6..aed863d194a98a7ab00f9a599da4cce27b88ef67 100644 --- a/source/dnode/vnode/src/tsdb/tsdbSnapshot.c +++ b/source/dnode/vnode/src/tsdb/tsdbSnapshot.c @@ -198,7 +198,7 @@ static int32_t tsdbSnapCmprData(STsdbSnapReader* pReader, uint8_t** ppData) { ASSERT(pReader->bData.nRow); int32_t aBufN[5] = {0}; - code = tCmprBlockData(&pReader->bData, TWO_STAGE_COMP, NULL, NULL, pReader->aBuf, aBufN); + code = tCmprBlockData(&pReader->bData, NO_COMPRESSION, NULL, NULL, pReader->aBuf, aBufN); if (code) goto _exit; int32_t size = aBufN[0] + aBufN[1] + aBufN[2] + aBufN[3]; @@ -276,7 +276,7 @@ static int32_t tsdbSnapReadTimeSeriesData(STsdbSnapReader* pReader, uint8_t** pp code = tsdbSnapReadNextRow(pReader, &pRowInfo); TSDB_CHECK_CODE(code, lino, _exit); - if (pReader->bData.nRow >= 4096) break; + if (pReader->bData.nRow >= 81920) break; } while (pRowInfo); ASSERT(pReader->bData.nRow > 0); diff --git a/source/dnode/vnode/src/vnd/vnodeCompact.c b/source/dnode/vnode/src/vnd/vnodeCompact.c deleted file mode 100644 index 2b7abee99a01bafb7eb7ffd2a6c88978334e7b78..0000000000000000000000000000000000000000 --- a/source/dnode/vnode/src/vnd/vnodeCompact.c +++ /dev/null @@ -1,120 +0,0 @@ -/* - * 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 "vnd.h" - -extern int32_t tsdbCommitCompact(STsdb *pTsdb); - -static int32_t vnodeCompactTask(void *param) { - int32_t code = 0; - int32_t lino = 0; - - SCompactInfo *pInfo = (SCompactInfo *)param; - SVnode *pVnode = pInfo->pVnode; - - // do compact - code = tsdbCompact(pInfo->pVnode->pTsdb, pInfo); - TSDB_CHECK_CODE(code, lino, _exit); - - // end compact - char dir[TSDB_FILENAME_LEN] = {0}; - if (pVnode->pTfs) { - snprintf(dir, TSDB_FILENAME_LEN, "%s%s%s", tfsGetPrimaryPath(pVnode->pTfs), TD_DIRSEP, pVnode->path); - } else { - snprintf(dir, TSDB_FILENAME_LEN, "%s", pVnode->path); - } - - vnodeCommitInfo(dir); - - tsdbCommitCompact(pVnode->pTsdb); - -_exit: - tsem_post(&pInfo->pVnode->canCommit); - taosMemoryFree(pInfo); - return code; -} -static int32_t vnodePrepareCompact(SVnode *pVnode, SCompactInfo *pInfo) { - int32_t code = 0; - int32_t lino = 0; - - tsem_wait(&pVnode->canCommit); - - pInfo->pVnode = pVnode; - pInfo->flag = 0; - pInfo->commitID = ++pVnode->state.commitID; - - char dir[TSDB_FILENAME_LEN] = {0}; - SVnodeInfo info = {0}; - - if (pVnode->pTfs) { - snprintf(dir, TSDB_FILENAME_LEN, "%s%s%s", tfsGetPrimaryPath(pVnode->pTfs), TD_DIRSEP, pVnode->path); - } else { - snprintf(dir, TSDB_FILENAME_LEN, "%s", pVnode->path); - } - - if (vnodeLoadInfo(dir, &info) < 0) { - code = terrno; - goto _exit; - } - - info.state.commitID = pInfo->commitID; - - if (vnodeSaveInfo(dir, &info) < 0) { - code = terrno; - goto _exit; - } - -_exit: - if (code) { - vError("vgId:%d %s failed at line %d since %s, commit ID:%" PRId64, TD_VID(pVnode), __func__, lino, tstrerror(code), - pVnode->state.commitID); - } else { - vDebug("vgId:%d %s done, commit ID:%" PRId64, TD_VID(pVnode), __func__, pVnode->state.commitID); - } - return code; -} -int32_t vnodeAsyncCompact(SVnode *pVnode) { - int32_t code = 0; - int32_t lino = 0; - - SCompactInfo *pInfo = taosMemoryCalloc(1, sizeof(*pInfo)); - if (pInfo == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; - TSDB_CHECK_CODE(code, lino, _exit); - } - - vnodeAsyncCommit(pVnode); - - code = vnodePrepareCompact(pVnode, pInfo); - TSDB_CHECK_CODE(code, lino, _exit); - - vnodeScheduleTask(vnodeCompactTask, pInfo); - -_exit: - if (code) { - vError("vgId:%d %s failed at line %d since %s", TD_VID(pVnode), __func__, lino, tstrerror(code)); - if (pInfo) taosMemoryFree(pInfo); - } else { - vInfo("vgId:%d %s done", TD_VID(pVnode), __func__); - } - return code; -} - -int32_t vnodeSyncCompact(SVnode *pVnode) { - vnodeAsyncCompact(pVnode); - tsem_wait(&pVnode->canCommit); - tsem_post(&pVnode->canCommit); - return 0; -} \ No newline at end of file diff --git a/source/dnode/vnode/src/vnd/vnodeSvr.c b/source/dnode/vnode/src/vnd/vnodeSvr.c index 192a3615e14c064753bf12f0376b55e7f5b09bb6..45113d55d33621c737639a7bdab3ef60c0879c9b 100644 --- a/source/dnode/vnode/src/vnd/vnodeSvr.c +++ b/source/dnode/vnode/src/vnd/vnodeSvr.c @@ -211,6 +211,11 @@ static int32_t vnodePreProcessSubmitMsg(SVnode *pVnode, SRpcMsg *pMsg) { SDecoder *pCoder = &(SDecoder){0}; + if (taosHton64(((SSubmitReq2Msg *)pMsg->pCont)->version) != 1) { + code = TSDB_CODE_INVALID_MSG; + TSDB_CHECK_CODE(code, lino, _exit); + } + tDecoderInit(pCoder, (uint8_t *)pMsg->pCont + sizeof(SSubmitReq2Msg), pMsg->contLen - sizeof(SSubmitReq2Msg)); if (tStartDecode(pCoder) < 0) { @@ -599,16 +604,10 @@ static int32_t vnodeProcessTrimReq(SVnode *pVnode, int64_t version, void *pReq, vInfo("vgId:%d, trim vnode request will be processed, time:%d", pVnode->config.vgId, trimReq.timestamp); -// process -#if 0 - code = tsdbDoRetention(pVnode->pTsdb, trimReq.timestamp); - if (code) goto _exit; - - code = smaDoRetention(pVnode->pSma, trimReq.timestamp); - if (code) goto _exit; -#else + // process vnodeAsyncRentention(pVnode, trimReq.timestamp); -#endif + tsem_wait(&pVnode->canCommit); + tsem_post(&pVnode->canCommit); _exit: return code; @@ -633,18 +632,7 @@ static int32_t vnodeProcessDropTtlTbReq(SVnode *pVnode, int64_t version, void *p tqUpdateTbUidList(pVnode->pTq, tbUids, false); } -#if 0 - // process - ret = tsdbDoRetention(pVnode->pTsdb, ttlReq.timestamp); - if (ret) goto end; - - ret = smaDoRetention(pVnode->pSma, ttlReq.timestamp); - if (ret) goto end; -#else vnodeAsyncRentention(pVnode, ttlReq.timestamp); - tsem_wait(&pVnode->canCommit); - tsem_post(&pVnode->canCommit); -#endif end: taosArrayDestroy(tbUids); @@ -1228,6 +1216,49 @@ static int32_t vnodeProcessSubmitReq(SVnode *pVnode, int64_t version, void *pReq tDecoderClear(&dc); } + // scan + TSKEY now = taosGetTimestamp(pVnode->config.tsdbCfg.precision); + TSKEY minKey = now - tsTickPerMin[pVnode->config.tsdbCfg.precision] * pVnode->config.tsdbCfg.keep2; + TSKEY maxKey = tsMaxKeyByPrecision[pVnode->config.tsdbCfg.precision]; + for (int32_t i = 0; i < TARRAY_SIZE(pSubmitReq->aSubmitTbData); ++i) { + SSubmitTbData *pSubmitTbData = taosArrayGet(pSubmitReq->aSubmitTbData, i); + + if (pSubmitTbData->pCreateTbReq && pSubmitTbData->pCreateTbReq->uid == 0) { + code = TSDB_CODE_INVALID_MSG; + goto _exit; + } + + if (pSubmitTbData->flags & SUBMIT_REQ_COLUMN_DATA_FORMAT) { + if (TARRAY_SIZE(pSubmitTbData->aCol) <= 0) { + code = TSDB_CODE_INVALID_MSG; + goto _exit; + } + + SColData *pColData = (SColData *)taosArrayGet(pSubmitTbData->aCol, 0); + TSKEY *aKey = (TSKEY *)(pColData->pData); + + for (int32_t iRow = 0; iRow < pColData->nVal; iRow++) { + if (aKey[iRow] < minKey || aKey[iRow] > maxKey || (iRow > 0 && aKey[iRow] <= aKey[iRow - 1])) { + code = TSDB_CODE_INVALID_MSG; + vError("vgId:%d %s failed since %s, version:%" PRId64, TD_VID(pVnode), __func__, tstrerror(terrno), version); + goto _exit; + } + } + + } else { + int32_t nRow = TARRAY_SIZE(pSubmitTbData->aRowP); + SRow **aRow = (SRow **)TARRAY_DATA(pSubmitTbData->aRowP); + + for (int32_t iRow = 0; iRow < nRow; ++iRow) { + if (aRow[iRow]->ts < minKey || aRow[iRow]->ts > maxKey || (iRow > 0 && aRow[iRow]->ts <= aRow[iRow - 1]->ts)) { + code = TSDB_CODE_INVALID_MSG; + vError("vgId:%d %s failed since %s, version:%" PRId64, TD_VID(pVnode), __func__, tstrerror(terrno), version); + goto _exit; + } + } + } + } + for (int32_t i = 0; i < TARRAY_SIZE(pSubmitReq->aSubmitTbData); ++i) { SSubmitTbData *pSubmitTbData = taosArrayGet(pSubmitReq->aSubmitTbData, i); @@ -1510,6 +1541,14 @@ static int32_t vnodeProcessAlterConfigReq(SVnode *pVnode, int64_t version, void } } + if (req.sttTrigger != -1 && req.sttTrigger != pVnode->config.sttTrigger) { + pVnode->config.sttTrigger = req.sttTrigger; + } + + if (req.minRows != -1 && req.minRows != pVnode->config.tsdbCfg.minRows) { + pVnode->config.tsdbCfg.minRows = req.minRows; + } + if (walChanged) { walAlter(pVnode->pWal, &pVnode->config.walCfg); } @@ -1625,7 +1664,7 @@ _err: } static int32_t vnodeProcessDropIndexReq(SVnode *pVnode, int64_t version, void *pReq, int32_t len, SRpcMsg *pRsp) { SDropIndexReq req = {0}; - pRsp->msgType = TDMT_VND_CREATE_INDEX_RSP; + pRsp->msgType = TDMT_VND_DROP_INDEX_RSP; pRsp->code = TSDB_CODE_SUCCESS; pRsp->pCont = NULL; pRsp->contLen = 0; @@ -1634,6 +1673,7 @@ static int32_t vnodeProcessDropIndexReq(SVnode *pVnode, int64_t version, void *p terrno = TSDB_CODE_INVALID_MSG; return -1; } + if (metaDropIndexFromSTable(pVnode->pMeta, version, &req) < 0) { pRsp->code = terrno; return -1; @@ -1641,17 +1681,14 @@ static int32_t vnodeProcessDropIndexReq(SVnode *pVnode, int64_t version, void *p return TSDB_CODE_SUCCESS; } -static int32_t vnodeProcessCompactVnodeReq(SVnode *pVnode, int64_t version, void *pReq, int32_t len, SRpcMsg *pRsp) { - SCompactVnodeReq req = {0}; - if (tDeserializeSCompactVnodeReq(pReq, len, &req) != 0) { - terrno = TSDB_CODE_INVALID_MSG; - return TSDB_CODE_INVALID_MSG; - } - vInfo("vgId:%d, compact msg will be processed, db:%s dbUid:%" PRId64 " compactStartTime:%" PRId64, TD_VID(pVnode), - req.db, req.dbUid, req.compactStartTime); +extern int32_t vnodeProcessCompactVnodeReqImpl(SVnode *pVnode, int64_t version, void *pReq, int32_t len, SRpcMsg *pRsp); - vnodeAsyncCompact(pVnode); - vnodeBegin(pVnode); +static int32_t vnodeProcessCompactVnodeReq(SVnode *pVnode, int64_t version, void *pReq, int32_t len, SRpcMsg *pRsp) { + return vnodeProcessCompactVnodeReqImpl(pVnode, version, pReq, len, pRsp); +} +#ifndef TD_ENTERPRISE +int32_t vnodeProcessCompactVnodeReqImpl(SVnode *pVnode, int64_t version, void *pReq, int32_t len, SRpcMsg *pRsp) { return 0; } +#endif diff --git a/source/dnode/vnode/src/vnd/vnodeSync.c b/source/dnode/vnode/src/vnd/vnodeSync.c index 1e96a76170ca3eb972a9199d41c47e512c11639d..e71b03d2af86c69ac6437094dfbeffe4a6da4faa 100644 --- a/source/dnode/vnode/src/vnd/vnodeSync.c +++ b/source/dnode/vnode/src/vnd/vnodeSync.c @@ -292,7 +292,7 @@ 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, terrstr()); + 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); diff --git a/source/libs/catalog/inc/catalogInt.h b/source/libs/catalog/inc/catalogInt.h index 8fc7df63be2204f872bcf0eca8def42deb819d9e..c4e1fd3078b18d74df3e89a4a9ea2d82f26cef0e 100644 --- a/source/libs/catalog/inc/catalogInt.h +++ b/source/libs/catalog/inc/catalogInt.h @@ -43,6 +43,32 @@ extern "C" { #define CTG_BATCH_FETCH 1 +typedef enum { + CTG_CI_CLUSTER = 0, + CTG_CI_DNODE, + CTG_CI_QNODE, + CTG_CI_DB, + CTG_CI_DB_VGROUP, + CTG_CI_DB_CFG, + CTG_CI_DB_INFO, + CTG_CI_STABLE_META, + CTG_CI_NTABLE_META, + CTG_CI_CTABLE_META, + CTG_CI_SYSTABLE_META, + CTG_CI_OTHERTABLE_META, + CTG_CI_TBL_SMA, + CTG_CI_TBL_CFG, + CTG_CI_INDEX_INFO, + CTG_CI_USER, + CTG_CI_UDF, + CTG_CI_SVR_VER, + CTG_CI_MAX_VALUE, +} CTG_CACHE_ITEM; + +#define CTG_CI_FLAG_LEVEL_GLOBAL (1) +#define CTG_CI_FLAG_LEVEL_CLUSTER (1<<1) +#define CTG_CI_FLAG_LEVEL_DB (1<<2) + enum { CTG_READ = 1, CTG_WRITE, @@ -76,9 +102,9 @@ typedef enum { CTG_TASK_GET_DB_INFO, CTG_TASK_GET_TB_META, CTG_TASK_GET_TB_HASH, - CTG_TASK_GET_TB_INDEX, + CTG_TASK_GET_TB_SMA_INDEX, CTG_TASK_GET_TB_CFG, - CTG_TASK_GET_INDEX, + CTG_TASK_GET_INDEX_INFO, CTG_TASK_GET_UDF, CTG_TASK_GET_USER, CTG_TASK_GET_SVR_VER, @@ -96,9 +122,16 @@ typedef struct SCtgDebug { bool cacheEnable; bool apiEnable; bool metaEnable; + bool statEnable; uint32_t showCachePeriodSec; } SCtgDebug; +typedef struct SCtgCacheStat { + uint64_t cacheNum[CTG_CI_MAX_VALUE]; + uint64_t cacheHit[CTG_CI_MAX_VALUE]; + uint64_t cacheNHit[CTG_CI_MAX_VALUE]; +} SCtgCacheStat; + typedef struct SCtgTbCacheInfo { bool inCache; uint64_t dbId; @@ -191,12 +224,13 @@ typedef struct SCtgVgCache { } SCtgVgCache; typedef struct SCtgDBCache { - SRWLatch dbLock; // RC between destroy tbCache/stbCache and all reads - uint64_t dbId; - int8_t deleted; - SCtgVgCache vgCache; - SHashObj* tbCache; // key:tbname, value:SCtgTbCache - SHashObj* stbCache; // key:suid, value:char* + SRWLatch dbLock; // RC between destroy tbCache/stbCache and all reads + uint64_t dbId; + int8_t deleted; + SCtgVgCache vgCache; + SHashObj* tbCache; // key:tbname, value:SCtgTbCache + SHashObj* stbCache; // key:suid, value:char* + uint64_t dbCacheNum[CTG_CI_MAX_VALUE]; } SCtgDBCache; typedef struct SCtgRentSlot { @@ -223,12 +257,13 @@ typedef struct SCtgUserAuth { } SCtgUserAuth; typedef struct SCatalog { - uint64_t clusterId; - bool stopUpdate; - SHashObj* userCache; // key:user, value:SCtgUserAuth - SHashObj* dbCache; // key:dbname, value:SCtgDBCache - SCtgRentMgmt dbRent; - SCtgRentMgmt stbRent; + uint64_t clusterId; + bool stopUpdate; + SHashObj* userCache; // key:user, value:SCtgUserAuth + SHashObj* dbCache; // key:dbname, value:SCtgDBCache + SCtgRentMgmt dbRent; + SCtgRentMgmt stbRent; + SCtgCacheStat cacheStat; } SCatalog; typedef struct SCtgBatch { @@ -347,25 +382,9 @@ typedef struct SCtgRuntimeStat { uint64_t numOfOpAbort; uint64_t numOfOpEnqueue; uint64_t numOfOpDequeue; + uint64_t numOfOpClearCache; } SCtgRuntimeStat; -typedef struct SCtgCacheStat { - uint64_t numOfCluster; - uint64_t numOfDb; - uint64_t numOfTbl; - uint64_t numOfStb; - uint64_t numOfUser; - uint64_t numOfVgHit; - uint64_t numOfVgMiss; - uint64_t numOfMetaHit; - uint64_t numOfMetaMiss; - uint64_t numOfIndexHit; - uint64_t numOfIndexMiss; - uint64_t numOfUserHit; - uint64_t numOfUserMiss; - uint64_t numOfClear; -} SCtgCacheStat; - typedef struct SCatalogStat { SCtgApiStat api; SCtgRuntimeStat runtime; @@ -472,7 +491,7 @@ typedef struct SCatalogMgmt { SCtgQueue queue; TdThread updateThread; SHashObj* pCluster; // key: clusterId, value: SCatalog* - SCatalogStat stat; + SCatalogStat statInfo; SCatalogCfg cfg; } SCatalogMgmt; @@ -485,6 +504,11 @@ typedef struct SCtgOperation { ctgOpFunc func; } SCtgOperation; +typedef struct SCtgCacheItemInfo { + char *name; + int32_t flag; +} SCtgCacheItemInfo; + #define CTG_AUTH_READ(_t) ((_t) == AUTH_TYPE_READ || (_t) == AUTH_TYPE_READ_OR_WRITE) #define CTG_AUTH_WRITE(_t) ((_t) == AUTH_TYPE_WRITE || (_t) == AUTH_TYPE_READ_OR_WRITE) @@ -495,9 +519,87 @@ typedef struct SCtgOperation { #define CTG_STAT_DEC(_item, _n) atomic_sub_fetch_64(&(_item), _n) #define CTG_STAT_GET(_item) atomic_load_64(&(_item)) -#define CTG_RT_STAT_INC(item, n) (CTG_STAT_INC(gCtgMgmt.stat.runtime.item, n)) -#define CTG_CACHE_STAT_INC(item, n) (CTG_STAT_INC(gCtgMgmt.stat.cache.item, n)) -#define CTG_CACHE_STAT_DEC(item, n) (CTG_STAT_DEC(gCtgMgmt.stat.cache.item, n)) +#define CTG_DB_NUM_INC(_item) dbCache->dbCacheNum[_item] += 1 +#define CTG_DB_NUM_DEC(_item) dbCache->dbCacheNum[_item] -= 1 +#define CTG_DB_NUM_SET(_item) dbCache->dbCacheNum[_item] = 1 +#define CTG_DB_NUM_RESET(_item) dbCache->dbCacheNum[_item] = 0 + +#define CTG_STAT_API_INC(item, n) (CTG_STAT_INC(gCtgMgmt.statInfo.api.item, n)) +#define CTG_STAT_RT_INC(item, n) (CTG_STAT_INC(gCtgMgmt.statInfo.runtime.item, n)) +#define CTG_STAT_NUM_INC(item, n) (CTG_STAT_INC(gCtgMgmt.statInfo.cache.cacheNum[item], n)) +#define CTG_STAT_NUM_DEC(item, n) (CTG_STAT_DEC(gCtgMgmt.statInfo.cache.cacheNum[item], n)) +#define CTG_STAT_HIT_INC(item, n) (CTG_STAT_INC(gCtgMgmt.statInfo.cache.cacheHit[item], n)) +#define CTG_STAT_HIT_DEC(item, n) (CTG_STAT_DEC(gCtgMgmt.statInfo.cache.cacheHit[item], n)) +#define CTG_STAT_NHIT_INC(item, n) (CTG_STAT_INC(gCtgMgmt.statInfo.cache.cacheNHit[item], n)) +#define CTG_STAT_NHIT_DEC(item, n) (CTG_STAT_DEC(gCtgMgmt.statInfo.cache.cacheNHit[item], n)) + +#define CTG_CACHE_NUM_INC(item, n) (CTG_STAT_INC(pCtg->cacheStat.cacheNum[item], n)) +#define CTG_CACHE_NUM_DEC(item, n) (CTG_STAT_DEC(pCtg->cacheStat.cacheNum[item], n)) +#define CTG_CACHE_HIT_INC(item, n) (CTG_STAT_INC(pCtg->cacheStat.cacheHit[item], n)) +#define CTG_CACHE_NHIT_INC(item, n) (CTG_STAT_INC(pCtg->cacheStat.cacheNHit[item], n)) + +#define CTG_META_NUM_INC(type) do { \ + switch (type) { \ + case TSDB_SUPER_TABLE: \ + CTG_DB_NUM_INC(CTG_CI_STABLE_META); \ + break; \ + case TSDB_CHILD_TABLE: \ + CTG_DB_NUM_INC(CTG_CI_CTABLE_META); \ + break; \ + case TSDB_NORMAL_TABLE: \ + CTG_DB_NUM_INC(CTG_CI_NTABLE_META); \ + break; \ + case TSDB_SYSTEM_TABLE: \ + CTG_DB_NUM_INC(CTG_CI_SYSTABLE_META); \ + break; \ + default: \ + CTG_DB_NUM_INC(CTG_CI_OTHERTABLE_META); \ + break; \ + } \ +} while (0) + +#define CTG_META_NUM_DEC(type) do { \ + switch (type) { \ + case TSDB_SUPER_TABLE: \ + CTG_DB_NUM_DEC(CTG_CI_STABLE_META); \ + break; \ + case TSDB_CHILD_TABLE: \ + CTG_DB_NUM_DEC(CTG_CI_CTABLE_META); \ + break; \ + case TSDB_NORMAL_TABLE: \ + CTG_DB_NUM_DEC(CTG_CI_NTABLE_META); \ + break; \ + case TSDB_SYSTEM_TABLE: \ + CTG_DB_NUM_DEC(CTG_CI_SYSTABLE_META); \ + break; \ + default: \ + CTG_DB_NUM_DEC(CTG_CI_OTHERTABLE_META); \ + break; \ + } \ +} while (0) + +#define CTG_META_HIT_INC(type) do { \ + switch (type) { \ + case TSDB_SUPER_TABLE: \ + CTG_CACHE_HIT_INC(CTG_CI_STABLE_META, 1); \ + break; \ + case TSDB_CHILD_TABLE: \ + CTG_CACHE_HIT_INC(CTG_CI_CTABLE_META, 1); \ + break; \ + case TSDB_NORMAL_TABLE: \ + CTG_CACHE_HIT_INC(CTG_CI_NTABLE_META, 1); \ + break; \ + case TSDB_SYSTEM_TABLE: \ + CTG_CACHE_HIT_INC(CTG_CI_SYSTABLE_META, 1); \ + break; \ + default: \ + CTG_CACHE_HIT_INC(CTG_CI_OTHERTABLE_META, 1); \ + break; \ + } \ +} while (0) + +#define CTG_META_NHIT_INC() CTG_CACHE_NHIT_INC(CTG_CI_OTHERTABLE_META, 1) + #define CTG_IS_META_NULL(type) ((type) == META_TYPE_NULL_TABLE) #define CTG_IS_META_CTABLE(type) ((type) == META_TYPE_CTABLE) @@ -682,6 +784,7 @@ typedef struct SCtgOperation { void ctgdShowTableMeta(SCatalog* pCtg, const char* tbName, STableMeta* p); void ctgdShowClusterCache(SCatalog* pCtg); int32_t ctgdShowCacheInfo(void); +int32_t ctgdShowStatInfo(void); int32_t ctgRemoveTbMetaFromCache(SCatalog* pCtg, SName* pTableName, bool syncReq); int32_t ctgGetTbMetaFromCache(SCatalog* pCtg, SCtgTbMetaCtx* ctx, STableMeta** pTableMeta); @@ -806,10 +909,12 @@ int32_t ctgAcquireVgMetaFromCache(SCatalog *pCtg, const char *dbFName, const cha int32_t ctgCopyTbMeta(SCatalog *pCtg, SCtgTbMetaCtx *ctx, SCtgDBCache **pDb, SCtgTbCache **pTb, STableMeta **pTableMeta, char* dbFName); void ctgReleaseVgMetaToCache(SCatalog *pCtg, SCtgDBCache *dbCache, SCtgTbCache *pCache); void ctgReleaseTbMetaToCache(SCatalog *pCtg, SCtgDBCache *dbCache, SCtgTbCache *pCache); +void ctgGetGlobalCacheStat(SCtgCacheStat *pStat); extern SCatalogMgmt gCtgMgmt; extern SCtgDebug gCTGDebug; extern SCtgAsyncFps gCtgAsyncFps[]; +extern SCtgCacheItemInfo gCtgStatItem[CTG_CI_MAX_VALUE]; #ifdef __cplusplus } diff --git a/source/libs/catalog/src/catalog.c b/source/libs/catalog/src/catalog.c index f9a218835ea77d4a20aa1b7ac8086187c995c561..8a56b0889b679b750e7077662dbbc4361e478310 100644 --- a/source/libs/catalog/src/catalog.c +++ b/source/libs/catalog/src/catalog.c @@ -721,10 +721,13 @@ int32_t catalogGetHandle(uint64_t clusterId, SCatalog** catalogHandle) { if (ctg && (*ctg)) { *catalogHandle = *ctg; + CTG_STAT_HIT_INC(CTG_CI_CLUSTER, 1); qDebug("got catalog handle from cache, clusterId:0x%" PRIx64 ", CTG:%p", clusterId, *ctg); CTG_API_LEAVE(TSDB_CODE_SUCCESS); } + CTG_STAT_NHIT_INC(CTG_CI_CLUSTER, 1); + clusterCtg = taosMemoryCalloc(1, sizeof(SCatalog)); if (NULL == clusterCtg) { qError("calloc %d failed", (int32_t)sizeof(SCatalog)); @@ -768,7 +771,7 @@ int32_t catalogGetHandle(uint64_t clusterId, SCatalog** catalogHandle) { *catalogHandle = clusterCtg; - CTG_CACHE_STAT_INC(numOfCluster, 1); + CTG_STAT_NUM_INC(CTG_CI_CLUSTER, 1); CTG_API_LEAVE(TSDB_CODE_SUCCESS); @@ -1301,6 +1304,7 @@ int32_t catalogGetQnodeList(SCatalog* pCtg, SRequestConnInfo* pConn, SArray* pQn CTG_API_LEAVE(TSDB_CODE_CTG_INVALID_INPUT); } + CTG_CACHE_NHIT_INC(CTG_CI_QNODE, 1); CTG_ERR_JRET(ctgGetQnodeListFromMnode(pCtg, pConn, pQnodeList, NULL)); _return: @@ -1316,6 +1320,7 @@ int32_t catalogGetDnodeList(SCatalog* pCtg, SRequestConnInfo* pConn, SArray** pD CTG_API_LEAVE(TSDB_CODE_CTG_INVALID_INPUT); } + CTG_CACHE_NHIT_INC(CTG_CI_DNODE, 1); CTG_ERR_JRET(ctgGetDnodeListFromMnode(pCtg, pConn, pDnodeList, NULL)); _return: @@ -1388,6 +1393,8 @@ int32_t catalogGetDBCfg(SCatalog* pCtg, SRequestConnInfo* pConn, const char* dbF CTG_API_LEAVE(TSDB_CODE_CTG_INVALID_INPUT); } + CTG_CACHE_NHIT_INC(CTG_CI_DB_CFG, 1); + CTG_API_LEAVE(ctgGetDBCfgFromMnode(pCtg, pConn, dbFName, pDbCfg, NULL)); } @@ -1440,6 +1447,8 @@ int32_t catalogGetUdfInfo(SCatalog* pCtg, SRequestConnInfo* pConn, const char* f CTG_API_LEAVE(TSDB_CODE_CTG_INVALID_INPUT); } + CTG_CACHE_NHIT_INC(CTG_CI_UDF, 1); + int32_t code = 0; CTG_ERR_JRET(ctgGetUdfInfoFromMnode(pCtg, pConn, funcName, pInfo, NULL)); @@ -1488,6 +1497,8 @@ int32_t catalogGetServerVersion(SCatalog* pCtg, SRequestConnInfo* pConn, char** CTG_API_LEAVE(TSDB_CODE_CTG_INVALID_INPUT); } + CTG_CACHE_NHIT_INC(CTG_CI_SVR_VER, 1); + int32_t code = 0; CTG_ERR_JRET(ctgGetSvrVerFromMnode(pCtg, pConn, pVersion, NULL)); diff --git a/source/libs/catalog/src/ctgAsync.c b/source/libs/catalog/src/ctgAsync.c index f62e93b82a9374ae751cb9e4b5bbde797d62e200..6c5666193753aea698559937c660022a5650bbbb 100644 --- a/source/libs/catalog/src/ctgAsync.c +++ b/source/libs/catalog/src/ctgAsync.c @@ -241,7 +241,7 @@ int32_t ctgInitGetIndexTask(SCtgJob* pJob, int32_t taskIdx, void* param) { char* name = (char*)param; SCtgTask task = {0}; - task.type = CTG_TASK_GET_INDEX; + task.type = CTG_TASK_GET_INDEX_INFO; task.taskId = taskIdx; task.pJob = pJob; @@ -330,7 +330,7 @@ int32_t ctgInitGetTbIndexTask(SCtgJob* pJob, int32_t taskIdx, void* param) { SName* name = (SName*)param; SCtgTask task = {0}; - task.type = CTG_TASK_GET_TB_INDEX; + task.type = CTG_TASK_GET_TB_SMA_INDEX; task.taskId = taskIdx; task.pJob = pJob; @@ -596,7 +596,7 @@ int32_t ctgInitJob(SCatalog* pCtg, SRequestConnInfo* pConn, SCtgJob** job, const for (int32_t i = 0; i < tbIndexNum; ++i) { SName* name = taosArrayGet(pReq->pTableIndex, i); - CTG_ERR_JRET(ctgInitTask(pJob, CTG_TASK_GET_TB_INDEX, name, NULL)); + CTG_ERR_JRET(ctgInitTask(pJob, CTG_TASK_GET_TB_SMA_INDEX, name, NULL)); } for (int32_t i = 0; i < tbCfgNum; ++i) { @@ -606,7 +606,7 @@ int32_t ctgInitJob(SCatalog* pCtg, SRequestConnInfo* pConn, SCtgJob** job, const for (int32_t i = 0; i < indexNum; ++i) { char* indexName = taosArrayGet(pReq->pIndex, i); - CTG_ERR_JRET(ctgInitTask(pJob, CTG_TASK_GET_INDEX, indexName, NULL)); + CTG_ERR_JRET(ctgInitTask(pJob, CTG_TASK_GET_INDEX_INFO, indexName, NULL)); } for (int32_t i = 0; i < udfNum; ++i) { @@ -1925,6 +1925,8 @@ int32_t ctgLaunchGetTbCfgTask(SCtgTask* pTask) { pMsgCtx->pBatchs = pJob->pBatchs; } + CTG_CACHE_NHIT_INC(CTG_CI_TBL_CFG, 1); + if (pCtx->tbType <= 0) { CTG_ERR_JRET(ctgReadTbTypeFromCache(pCtg, dbFName, pCtx->pName->tname, &pCtx->tbType)); if (pCtx->tbType <= 0) { @@ -1967,6 +1969,7 @@ int32_t ctgLaunchGetQnodeTask(SCtgTask* pTask) { pMsgCtx->pBatchs = pJob->pBatchs; } + CTG_CACHE_NHIT_INC(CTG_CI_QNODE, 1); CTG_ERR_RET(ctgGetQnodeListFromMnode(pCtg, pConn, NULL, pTask)); return TSDB_CODE_SUCCESS; } @@ -1980,6 +1983,7 @@ int32_t ctgLaunchGetDnodeTask(SCtgTask* pTask) { pMsgCtx->pBatchs = pJob->pBatchs; } + CTG_CACHE_NHIT_INC(CTG_CI_DNODE, 1); CTG_ERR_RET(ctgGetDnodeListFromMnode(pCtg, pConn, NULL, pTask)); return TSDB_CODE_SUCCESS; } @@ -1994,6 +1998,8 @@ int32_t ctgLaunchGetDbCfgTask(SCtgTask* pTask) { pMsgCtx->pBatchs = pJob->pBatchs; } + CTG_CACHE_NHIT_INC(CTG_CI_DB_CFG, 1); + CTG_ERR_RET(ctgGetDBCfgFromMnode(pCtg, pConn, pCtx->dbFName, NULL, pTask)); return TSDB_CODE_SUCCESS; @@ -2023,10 +2029,14 @@ int32_t ctgLaunchGetDbInfoTask(SCtgTask* pTask) { pInfo->tbNum = dbCache->vgCache.vgInfo->numOfTable; pInfo->stateTs = dbCache->vgCache.vgInfo->stateTs; + CTG_CACHE_HIT_INC(CTG_CI_DB_INFO, 1); + ctgReleaseVgInfoToCache(pCtg, dbCache); dbCache = NULL; } else { pInfo->vgVer = CTG_DEFAULT_INVALID_VERSION; + + CTG_CACHE_NHIT_INC(CTG_CI_DB_INFO, 1); } CTG_ERR_JRET(ctgHandleTaskEnd(pTask, 0)); @@ -2046,6 +2056,8 @@ int32_t ctgLaunchGetIndexTask(SCtgTask* pTask) { pMsgCtx->pBatchs = pJob->pBatchs; } + CTG_CACHE_NHIT_INC(CTG_CI_INDEX_INFO, 1); + CTG_ERR_RET(ctgGetIndexInfoFromMnode(pCtg, pConn, pCtx->indexFName, NULL, pTask)); return TSDB_CODE_SUCCESS; @@ -2061,6 +2073,8 @@ int32_t ctgLaunchGetUdfTask(SCtgTask* pTask) { pMsgCtx->pBatchs = pJob->pBatchs; } + CTG_CACHE_NHIT_INC(CTG_CI_UDF, 1); + CTG_ERR_RET(ctgGetUdfInfoFromMnode(pCtg, pConn, pCtx->udfName, NULL, pTask)); return TSDB_CODE_SUCCESS; @@ -2104,6 +2118,8 @@ int32_t ctgLaunchGetSvrVerTask(SCtgTask* pTask) { pMsgCtx->pBatchs = pJob->pBatchs; } + CTG_CACHE_NHIT_INC(CTG_CI_SVR_VER, 1); + CTG_ERR_RET(ctgGetSvrVerFromMnode(pCtg, pConn, NULL, pTask)); return TSDB_CODE_SUCCESS; diff --git a/source/libs/catalog/src/ctgCache.c b/source/libs/catalog/src/ctgCache.c index 7ff8afd6a510f16c6a47df25550c9d2dbd0e3543..b0321588651a73da880fa062c9b4e87baa478955 100644 --- a/source/libs/catalog/src/ctgCache.c +++ b/source/libs/catalog/src/ctgCache.c @@ -31,6 +31,28 @@ SCtgOperation gCtgCacheOperation[CTG_OP_MAX] = {{CTG_OP_UPDATE_VGROUP, "update v {CTG_OP_DROP_TB_INDEX, "drop tbIndex", ctgOpDropTbIndex}, {CTG_OP_CLEAR_CACHE, "clear cache", ctgOpClearCache}}; +SCtgCacheItemInfo gCtgStatItem[CTG_CI_MAX_VALUE] = { + {"Cluster ", CTG_CI_FLAG_LEVEL_GLOBAL}, //CTG_CI_CLUSTER + {"Dnode ", CTG_CI_FLAG_LEVEL_CLUSTER}, //CTG_CI_DNODE, + {"Qnode ", CTG_CI_FLAG_LEVEL_CLUSTER}, //CTG_CI_QNODE, + {"DB ", CTG_CI_FLAG_LEVEL_CLUSTER}, //CTG_CI_DB, + {"DbVgroup ", CTG_CI_FLAG_LEVEL_DB}, //CTG_CI_DB_VGROUP, + {"DbCfg ", CTG_CI_FLAG_LEVEL_DB}, //CTG_CI_DB_CFG, + {"DbInfo ", CTG_CI_FLAG_LEVEL_DB}, //CTG_CI_DB_INFO, + {"StbMeta ", CTG_CI_FLAG_LEVEL_DB}, //CTG_CI_STABLE_META, + {"NtbMeta ", CTG_CI_FLAG_LEVEL_DB}, //CTG_CI_NTABLE_META, + {"CtbMeta ", CTG_CI_FLAG_LEVEL_DB}, //CTG_CI_CTABLE_META, + {"SysTblMeta", CTG_CI_FLAG_LEVEL_DB}, //CTG_CI_SYSTABLE_META, + {"OthTblMeta", CTG_CI_FLAG_LEVEL_DB}, //CTG_CI_OTHERTABLE_META, + {"TblSMA ", CTG_CI_FLAG_LEVEL_DB}, //CTG_CI_TBL_SMA, + {"TblCfg ", CTG_CI_FLAG_LEVEL_DB}, //CTG_CI_TBL_CFG, + {"IndexInfo ", CTG_CI_FLAG_LEVEL_DB}, //CTG_CI_INDEX_INFO, + {"User ", CTG_CI_FLAG_LEVEL_CLUSTER}, //CTG_CI_USER, + {"UDF ", CTG_CI_FLAG_LEVEL_CLUSTER}, //CTG_CI_UDF, + {"SvrVer ", CTG_CI_FLAG_LEVEL_CLUSTER} //CTG_CI_SVR_VER, +}; + + int32_t ctgRLockVgInfo(SCatalog *pCtg, SCtgDBCache *dbCache, bool *inCache) { CTG_LOCK(CTG_READ, &dbCache->vgCache.vgLock); @@ -93,6 +115,7 @@ int32_t ctgAcquireDBCacheImpl(SCatalog *pCtg, const char *dbFName, SCtgDBCache * if (NULL == dbCache) { *pCache = NULL; + CTG_CACHE_NHIT_INC(CTG_CI_DB, 1); ctgDebug("db not in cache, dbFName:%s", dbFName); return TSDB_CODE_SUCCESS; } @@ -107,11 +130,13 @@ int32_t ctgAcquireDBCacheImpl(SCatalog *pCtg, const char *dbFName, SCtgDBCache * } *pCache = NULL; + CTG_CACHE_NHIT_INC(CTG_CI_DB, 1); ctgDebug("db is removing from cache, dbFName:%s", dbFName); return TSDB_CODE_SUCCESS; } *pCache = dbCache; + CTG_CACHE_HIT_INC(CTG_CI_DB, 1); return TSDB_CODE_SUCCESS; } @@ -180,7 +205,7 @@ int32_t ctgAcquireVgInfoFromCache(SCatalog *pCtg, const char *dbFName, SCtgDBCac *pCache = dbCache; - CTG_CACHE_STAT_INC(numOfVgHit, 1); + CTG_CACHE_HIT_INC(CTG_CI_DB_VGROUP, 1); ctgDebug("Got db vgInfo from cache, dbFName:%s", dbFName); @@ -194,7 +219,7 @@ _return: *pCache = NULL; - CTG_CACHE_STAT_INC(numOfVgMiss, 1); + CTG_CACHE_NHIT_INC(CTG_CI_DB_VGROUP, 1); return TSDB_CODE_SUCCESS; } @@ -225,7 +250,7 @@ int32_t ctgAcquireTbMetaFromCache(SCatalog *pCtg, char *dbFName, char *tbName, S ctgDebug("tb %s meta got in cache, dbFName:%s", tbName, dbFName); - CTG_CACHE_STAT_INC(numOfMetaHit, 1); + CTG_META_HIT_INC(pCache->pMeta->tableType); return TSDB_CODE_SUCCESS; @@ -233,7 +258,7 @@ _return: ctgReleaseTbMetaToCache(pCtg, dbCache, pCache); - CTG_CACHE_STAT_INC(numOfMetaMiss, 1); + CTG_META_NHIT_INC(); return TSDB_CODE_SUCCESS; } @@ -246,34 +271,34 @@ int32_t ctgAcquireVgMetaFromCache(SCatalog *pCtg, const char *dbFName, const cha ctgAcquireDBCache(pCtg, dbFName, &dbCache); if (NULL == dbCache) { ctgDebug("db %s not in cache", dbFName); - CTG_CACHE_STAT_INC(numOfVgMiss, 1); + CTG_CACHE_NHIT_INC(CTG_CI_DB_VGROUP, 1); goto _return; } ctgRLockVgInfo(pCtg, dbCache, &vgInCache); if (!vgInCache) { ctgDebug("vgInfo of db %s not in cache", dbFName); - CTG_CACHE_STAT_INC(numOfVgMiss, 1); + CTG_CACHE_NHIT_INC(CTG_CI_DB_VGROUP, 1); goto _return; } *pDb = dbCache; - CTG_CACHE_STAT_INC(numOfVgHit, 1); + CTG_CACHE_HIT_INC(CTG_CI_DB_VGROUP, 1); ctgDebug("Got db vgInfo from cache, dbFName:%s", dbFName); tbCache = taosHashAcquire(dbCache->tbCache, tbName, strlen(tbName)); if (NULL == tbCache) { ctgDebug("tb %s not in cache, dbFName:%s", tbName, dbFName); - CTG_CACHE_STAT_INC(numOfMetaMiss, 1); + CTG_META_NHIT_INC(); goto _return; } CTG_LOCK(CTG_READ, &tbCache->metaLock); if (NULL == tbCache->pMeta) { ctgDebug("tb %s meta not in cache, dbFName:%s", tbName, dbFName); - CTG_CACHE_STAT_INC(numOfMetaMiss, 1); + CTG_META_NHIT_INC(); goto _return; } @@ -281,7 +306,7 @@ int32_t ctgAcquireVgMetaFromCache(SCatalog *pCtg, const char *dbFName, const cha ctgDebug("tb %s meta got in cache, dbFName:%s", tbName, dbFName); - CTG_CACHE_STAT_INC(numOfMetaHit, 1); + CTG_META_HIT_INC(tbCache->pMeta->tableType); return TSDB_CODE_SUCCESS; @@ -343,7 +368,7 @@ int32_t ctgAcquireStbMetaFromCache(SCatalog *pCtg, char *dbFName, uint64_t suid, ctgDebug("stb 0x%" PRIx64 " meta got in cache, dbFName:%s", suid, dbFName); - CTG_CACHE_STAT_INC(numOfMetaHit, 1); + CTG_META_HIT_INC(pCache->pMeta->tableType, 1); return TSDB_CODE_SUCCESS; @@ -351,7 +376,7 @@ _return: ctgReleaseTbMetaToCache(pCtg, dbCache, pCache); - CTG_CACHE_STAT_INC(numOfMetaMiss, 1); + CTG_META_NHIT_INC(1); *pDb = NULL; *pTb = NULL; @@ -387,7 +412,7 @@ int32_t ctgAcquireStbMetaFromCache(SCtgDBCache *dbCache, SCatalog *pCtg, char *d ctgDebug("stb 0x%" PRIx64 " meta got in cache, dbFName:%s", suid, dbFName); - CTG_CACHE_STAT_INC(numOfMetaHit, 1); + CTG_META_HIT_INC(pCache->pMeta->tableType); return TSDB_CODE_SUCCESS; @@ -395,7 +420,7 @@ _return: ctgReleaseTbMetaToCache(pCtg, dbCache, pCache); - CTG_CACHE_STAT_INC(numOfMetaMiss, 1); + CTG_META_NHIT_INC(); *pTb = NULL; @@ -429,7 +454,7 @@ int32_t ctgAcquireTbIndexFromCache(SCatalog *pCtg, char *dbFName, char *tbName, ctgDebug("tb %s index got in cache, dbFName:%s", tbName, dbFName); - CTG_CACHE_STAT_INC(numOfIndexHit, 1); + CTG_CACHE_HIT_INC(CTG_CI_TBL_SMA, 1); return TSDB_CODE_SUCCESS; @@ -437,7 +462,7 @@ _return: ctgReleaseTbIndexToCache(pCtg, dbCache, pCache); - CTG_CACHE_STAT_INC(numOfIndexMiss, 1); + CTG_CACHE_NHIT_INC(CTG_CI_TBL_SMA, 1); return TSDB_CODE_SUCCESS; } @@ -702,7 +727,7 @@ int32_t ctgChkAuthFromCache(SCatalog *pCtg, char *user, char *dbFName, AUTH_TYPE *inCache = true; ctgDebug("Got user from cache, user:%s", user); - CTG_CACHE_STAT_INC(numOfUserHit, 1); + CTG_CACHE_HIT_INC(CTG_CI_USER, 1); if (pUser->superUser) { *pass = true; @@ -731,7 +756,7 @@ int32_t ctgChkAuthFromCache(SCatalog *pCtg, char *user, char *dbFName, AUTH_TYPE _return: *inCache = false; - CTG_CACHE_STAT_INC(numOfUserMiss, 1); + CTG_CACHE_NHIT_INC(CTG_CI_USER, 1); return TSDB_CODE_SUCCESS; } @@ -784,7 +809,7 @@ int32_t ctgEnqueue(SCatalog *pCtg, SCtgCacheOperation *operation) { ctgDebug("action [%s] added into queue", opName); CTG_QUEUE_INC(); - CTG_RT_STAT_INC(numOfOpEnqueue, 1); + CTG_STAT_RT_INC(numOfOpEnqueue, 1); tsem_post(&gCtgMgmt.queue.reqSem); @@ -1382,7 +1407,7 @@ int32_t ctgAddNewDBCache(SCatalog *pCtg, const char *dbFName, uint64_t dbId) { CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); } - CTG_CACHE_STAT_INC(numOfDb, 1); + CTG_CACHE_NUM_INC(CTG_CI_DB, 1); SDbVgVersion vgVersion = {.dbId = newDBCache.dbId, .vgVersion = -1, .stateTs = 0}; tstrncpy(vgVersion.dbFName, dbFName, sizeof(vgVersion.dbFName)); @@ -1444,7 +1469,7 @@ int32_t ctgRemoveDBFromCache(SCatalog *pCtg, SCtgDBCache *dbCache, const char *d CTG_ERR_RET(TSDB_CODE_CTG_DB_DROPPED); } - CTG_CACHE_STAT_DEC(numOfDb, 1); + CTG_CACHE_NUM_DEC(CTG_CI_DB, 1); ctgInfo("db removed from cache, dbFName:%s, dbId:0x%" PRIx64, dbFName, dbId); return TSDB_CODE_SUCCESS; @@ -1542,7 +1567,6 @@ int32_t ctgWriteTbMetaToCache(SCatalog *pCtg, SCtgDBCache *dbCache, char *dbFNam if (taosHashRemove(dbCache->stbCache, &orig->suid, sizeof(orig->suid))) { ctgError("stb not exist in stbCache, dbFName:%s, stb:%s, suid:0x%" PRIx64, dbFName, tbName, orig->suid); } else { - CTG_CACHE_STAT_DEC(numOfStb, 1); ctgDebug("stb removed from stbCache, dbFName:%s, stb:%s, suid:0x%" PRIx64, dbFName, tbName, orig->suid); } } @@ -1560,14 +1584,15 @@ int32_t ctgWriteTbMetaToCache(SCatalog *pCtg, SCtgDBCache *dbCache, char *dbFNam pCache = taosHashGet(dbCache->tbCache, tbName, strlen(tbName)); } else { CTG_LOCK(CTG_WRITE, &pCache->metaLock); + if (orig) { + CTG_META_NUM_DEC(origType); + } taosMemoryFree(pCache->pMeta); pCache->pMeta = meta; CTG_UNLOCK(CTG_WRITE, &pCache->metaLock); } - if (NULL == orig) { - CTG_CACHE_STAT_INC(numOfTbl, 1); - } + CTG_META_NUM_INC(pCache->pMeta->tableType); ctgDebug("tbmeta updated to cache, dbFName:%s, tbName:%s, tbType:%d", dbFName, tbName, meta->tableType); ctgdShowTableMeta(pCtg, tbName, meta); @@ -1581,8 +1606,6 @@ int32_t ctgWriteTbMetaToCache(SCatalog *pCtg, SCtgDBCache *dbCache, char *dbFNam CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); } - CTG_CACHE_STAT_INC(numOfStb, 1); - ctgDebug("stb 0x%" PRIx64 " updated to cache, dbFName:%s, tbName:%s, tbType:%d", meta->suid, dbFName, tbName, meta->tableType); @@ -1615,6 +1638,8 @@ int32_t ctgWriteTbIndexToCache(SCatalog *pCtg, SCtgDBCache *dbCache, char *dbFNa CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); } + CTG_DB_NUM_INC(CTG_CI_TBL_SMA); + *index = NULL; ctgDebug("table %s index updated to cache, ver:%d, num:%d", tbName, pIndex->version, (int32_t)taosArrayGetSize(pIndex->pIndex)); @@ -1766,10 +1791,12 @@ int32_t ctgOpUpdateVgroup(SCtgCacheOperation *operation) { } freeVgInfo(vgInfo); + CTG_DB_NUM_RESET(CTG_CI_DB_VGROUP); } vgCache->vgInfo = dbInfo; msg->dbInfo = NULL; + CTG_DB_NUM_SET(CTG_CI_DB_VGROUP); ctgDebug("db vgInfo updated, dbFName:%s, vgVer:%d, stateTs:%" PRId64 ", dbId:0x%" PRIx64, dbFName, vgVersion.vgVersion, vgVersion.stateTs, vgVersion.dbId); @@ -1842,6 +1869,7 @@ int32_t ctgOpDropDbVgroup(SCtgCacheOperation *operation) { freeVgInfo(dbCache->vgCache.vgInfo); dbCache->vgCache.vgInfo = NULL; + CTG_DB_NUM_RESET(CTG_CI_DB_VGROUP); ctgDebug("db vgInfo removed, dbFName:%s", msg->dbFName); ctgWUnlockVgInfo(dbCache); @@ -1911,6 +1939,7 @@ int32_t ctgOpDropStbMeta(SCtgCacheOperation *operation) { int32_t code = 0; SCtgDropStbMetaMsg *msg = operation->data; SCatalog *pCtg = msg->pCtg; + int32_t tblType = 0; if (pCtg->stopUpdate) { goto _return; @@ -1931,8 +1960,6 @@ int32_t ctgOpDropStbMeta(SCtgCacheOperation *operation) { if (taosHashRemove(dbCache->stbCache, &msg->suid, sizeof(msg->suid))) { ctgDebug("stb not exist in stbCache, may be removed, dbFName:%s, stb:%s, suid:0x%" PRIx64, msg->dbFName, msg->stbName, msg->suid); - } else { - CTG_CACHE_STAT_DEC(numOfStb, 1); } SCtgTbCache *pTbCache = taosHashGet(dbCache->tbCache, msg->stbName, strlen(msg->stbName)); @@ -1942,13 +1969,14 @@ int32_t ctgOpDropStbMeta(SCtgCacheOperation *operation) { } CTG_LOCK(CTG_WRITE, &pTbCache->metaLock); + tblType = pTbCache->pMeta->tableType; ctgFreeTbCacheImpl(pTbCache); CTG_UNLOCK(CTG_WRITE, &pTbCache->metaLock); if (taosHashRemove(dbCache->tbCache, msg->stbName, strlen(msg->stbName))) { ctgError("stb not exist in cache, dbFName:%s, stb:%s, suid:0x%" PRIx64, msg->dbFName, msg->stbName, msg->suid); } else { - CTG_CACHE_STAT_DEC(numOfTbl, 1); + CTG_META_NUM_DEC(tblType); } ctgInfo("stb removed from cache, dbFName:%s, stbName:%s, suid:0x%" PRIx64, msg->dbFName, msg->stbName, msg->suid); @@ -1968,6 +1996,7 @@ int32_t ctgOpDropTbMeta(SCtgCacheOperation *operation) { int32_t code = 0; SCtgDropTblMetaMsg *msg = operation->data; SCatalog *pCtg = msg->pCtg; + int32_t tblType = 0; if (pCtg->stopUpdate) { goto _return; @@ -1992,6 +2021,7 @@ int32_t ctgOpDropTbMeta(SCtgCacheOperation *operation) { } CTG_LOCK(CTG_WRITE, &pTbCache->metaLock); + tblType = pTbCache->pMeta->tableType; ctgFreeTbCacheImpl(pTbCache); CTG_UNLOCK(CTG_WRITE, &pTbCache->metaLock); @@ -1999,7 +2029,7 @@ int32_t ctgOpDropTbMeta(SCtgCacheOperation *operation) { ctgError("tb %s not exist in cache, dbFName:%s", msg->tbName, msg->dbFName); CTG_ERR_JRET(TSDB_CODE_CTG_INTERNAL_ERROR); } else { - CTG_CACHE_STAT_DEC(numOfTbl, 1); + CTG_META_NUM_DEC(tblType); } ctgDebug("table %s removed from cache, dbFName:%s", msg->tbName, msg->dbFName); @@ -2037,6 +2067,8 @@ int32_t ctgOpUpdateUser(SCtgCacheOperation *operation) { taosMemoryFreeClear(msg); + CTG_CACHE_NUM_INC(CTG_CI_USER, 1); + return TSDB_CODE_SUCCESS; } @@ -2290,10 +2322,10 @@ void ctgCleanupCacheQueue(void) { ctgDebug("process [%s] operation", gCtgCacheOperation[op->opId].name); (*gCtgCacheOperation[op->opId].func)(op); stopQueue = true; - CTG_RT_STAT_INC(numOfOpDequeue, 1); + CTG_STAT_RT_INC(numOfOpDequeue, 1); } else { ctgFreeCacheOperationData(op); - CTG_RT_STAT_INC(numOfOpAbort, 1); + CTG_STAT_RT_INC(numOfOpAbort, 1); } if (op->syncOp) { @@ -2349,9 +2381,10 @@ void *ctgUpdateThreadFunc(void *param) { taosMemoryFreeClear(operation); } - CTG_RT_STAT_INC(numOfOpDequeue, 1); + CTG_STAT_RT_INC(numOfOpDequeue, 1); ctgdShowCacheInfo(); + ctgdShowStatInfo(); } qInfo("catalog update thread stopped"); @@ -2492,7 +2525,8 @@ int32_t ctgGetTbMetasFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgTbMe ctgDebug("tb %s not in cache, dbFName:%s", pName->tname, dbFName); ctgAddFetch(&ctx->pFetchs, dbIdx, i, fetchIdx, baseResIdx + i, flag); taosArrayPush(ctx->pResList, &(SMetaRes){0}); - + CTG_META_NHIT_INC(); + continue; } @@ -2502,12 +2536,15 @@ int32_t ctgGetTbMetasFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgTbMe ctgDebug("tb %s meta not in cache, dbFName:%s", pName->tname, dbFName); ctgAddFetch(&ctx->pFetchs, dbIdx, i, fetchIdx, baseResIdx + i, flag); taosArrayPush(ctx->pResList, &(SMetaRes){0}); + CTG_META_NHIT_INC(); continue; } STableMeta *tbMeta = pCache->pMeta; + CTG_META_HIT_INC(tbMeta->tableType); + SCtgTbMetaCtx nctx = {0}; nctx.flag = flag; nctx.tbInfo.inCache = true; @@ -2575,8 +2612,9 @@ int32_t ctgGetTbMetasFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgTbMe ctgDebug("stb 0x%" PRIx64 " not in cache, dbFName:%s", pTableMeta->suid, dbFName); ctgAddFetch(&ctx->pFetchs, dbIdx, i, fetchIdx, baseResIdx + i, flag); taosArrayPush(ctx->pResList, &(SMetaRes){0}); - taosMemoryFreeClear(pTableMeta); + + CTG_META_NHIT_INC(); continue; } @@ -2587,8 +2625,9 @@ int32_t ctgGetTbMetasFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgTbMe ctgAddFetch(&ctx->pFetchs, dbIdx, i, fetchIdx, baseResIdx + i, flag); taosArrayPush(ctx->pResList, &(SMetaRes){0}); - taosMemoryFreeClear(pTableMeta); + + CTG_META_NHIT_INC(); continue; } @@ -2602,9 +2641,9 @@ int32_t ctgGetTbMetasFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgTbMe ctgAddFetch(&ctx->pFetchs, dbIdx, i, fetchIdx, baseResIdx + i, flag); taosArrayPush(ctx->pResList, &(SMetaRes){0}); - taosMemoryFreeClear(pTableMeta); + CTG_META_NHIT_INC(); continue; } @@ -2618,9 +2657,9 @@ int32_t ctgGetTbMetasFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgTbMe ctgAddFetch(&ctx->pFetchs, dbIdx, i, fetchIdx, baseResIdx + i, flag); taosArrayPush(ctx->pResList, &(SMetaRes){0}); - taosMemoryFreeClear(pTableMeta); + CTG_META_NHIT_INC(); continue; } @@ -2636,6 +2675,8 @@ int32_t ctgGetTbMetasFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgTbMe CTG_UNLOCK(CTG_READ, &pCache->metaLock); taosHashRelease(dbCache->tbCache, pCache); + CTG_META_HIT_INC(pTableMeta->tableType); + res.pRes = pTableMeta; taosArrayPush(ctx->pResList, &res); diff --git a/source/libs/catalog/src/ctgDbg.c b/source/libs/catalog/src/ctgDbg.c index 6b870232c74bdb09dfd90bbb95a9cae8954f23da..b5d587d257a8d084246efa86ed72e77a723de98c 100644 --- a/source/libs/catalog/src/ctgDbg.c +++ b/source/libs/catalog/src/ctgDbg.c @@ -345,7 +345,7 @@ int32_t ctgdGetOneHandle(SCatalog **pHandle) { int32_t ctgdGetStatNum(char *option, void *res) { if (0 == strcasecmp(option, "runtime.numOfOpDequeue")) { - *(uint64_t *)res = atomic_load_64(&gCtgMgmt.stat.runtime.numOfOpDequeue); + *(uint64_t *)res = atomic_load_64(&gCtgMgmt.statInfo.runtime.numOfOpDequeue); return TSDB_CODE_SUCCESS; } @@ -517,6 +517,27 @@ void ctgdShowClusterCache(SCatalog *pCtg) { ctgDebug("## cluster 0x%" PRIx64 " %p cache Info END ##", pCtg->clusterId, pCtg); } +int32_t ctgdShowStatInfo(void) { + if (!gCTGDebug.statEnable) { + return TSDB_CODE_CTG_OUT_OF_SERVICE; + } + + CTG_API_ENTER(); + + SCtgCacheStat cache; + ctgGetGlobalCacheStat(&cache); + + qDebug("## Global Stat Info %s ##", "begin"); + qDebug("## \t%s \t%s \t%s ##", "Num", "Hit", "Nhit"); + for (int32_t i = 0; i < CTG_CI_MAX_VALUE; ++i) { + qDebug("# %s \t%" PRIu64 " \t%" PRIu64 " \t%" PRIu64 " #", gCtgStatItem[i].name, cache.cacheNum[i], cache.cacheHit[i], cache.cacheNHit[i]); + } + qDebug("## Global Stat Info %s ##", "end"); + + CTG_API_LEAVE(TSDB_CODE_SUCCESS); +} + + int32_t ctgdShowCacheInfo(void) { if (!gCTGDebug.cacheEnable) { return TSDB_CODE_CTG_OUT_OF_SERVICE; diff --git a/source/libs/catalog/src/ctgUtil.c b/source/libs/catalog/src/ctgUtil.c index cd9380778b598080405ca569672e0c7b27d5fc72..a2f2a3d556fea5049e643cdbd7be7e753a89e1db 100644 --- a/source/libs/catalog/src/ctgUtil.c +++ b/source/libs/catalog/src/ctgUtil.c @@ -77,12 +77,12 @@ char* ctgTaskTypeStr(CTG_TASK_TYPE type) { return "[get table meta]"; case CTG_TASK_GET_TB_HASH: return "[get table hash]"; - case CTG_TASK_GET_TB_INDEX: - return "[get table index]"; + case CTG_TASK_GET_TB_SMA_INDEX: + return "[get table sma]"; case CTG_TASK_GET_TB_CFG: return "[get table cfg]"; - case CTG_TASK_GET_INDEX: - return "[get index]"; + case CTG_TASK_GET_INDEX_INFO: + return "[get index info]"; case CTG_TASK_GET_UDF: return "[get udf]"; case CTG_TASK_GET_USER: @@ -203,7 +203,6 @@ void ctgFreeStbMetaCache(SCtgDBCache* dbCache) { int32_t stbNum = taosHashGetSize(dbCache->stbCache); taosHashCleanup(dbCache->stbCache); dbCache->stbCache = NULL; - CTG_CACHE_STAT_DEC(numOfStb, stbNum); } void ctgFreeTbCacheImpl(SCtgTbCache* pCache) { @@ -228,7 +227,6 @@ void ctgFreeTbCache(SCtgDBCache* dbCache) { } taosHashCleanup(dbCache->tbCache); dbCache->tbCache = NULL; - CTG_CACHE_STAT_DEC(numOfTbl, tblNum); } void ctgFreeVgInfoCache(SCtgDBCache* dbCache) { freeVgInfo(dbCache->vgCache.vgInfo); } @@ -260,8 +258,6 @@ void ctgFreeInstDbCache(SHashObj* pDbCache) { } taosHashCleanup(pDbCache); - - CTG_CACHE_STAT_DEC(numOfDb, dbNum); } void ctgFreeInstUserCache(SHashObj* pUserCache) { @@ -280,8 +276,6 @@ void ctgFreeInstUserCache(SHashObj* pUserCache) { } taosHashCleanup(pUserCache); - - CTG_CACHE_STAT_DEC(numOfUser, userNum); } void ctgFreeHandleImpl(SCatalog* pCtg) { @@ -307,7 +301,7 @@ void ctgFreeHandle(SCatalog* pCtg) { ctgFreeInstDbCache(pCtg->dbCache); ctgFreeInstUserCache(pCtg->userCache); - CTG_CACHE_STAT_DEC(numOfCluster, 1); + CTG_STAT_NUM_DEC(CTG_CI_CLUSTER, 1); taosMemoryFree(pCtg); @@ -342,7 +336,9 @@ void ctgClearHandle(SCatalog* pCtg) { ctgError("taosHashInit %d user cache failed", gCtgMgmt.cfg.maxUserCacheNum); } - CTG_CACHE_STAT_INC(numOfClear, 1); + memset(pCtg->cacheStat.cacheNum, 0, sizeof(pCtg->cacheStat.cacheNum)); + + CTG_STAT_RT_INC(numOfOpClearCache, 1); ctgInfo("handle cleared, clusterId:0x%" PRIx64, clusterId); } @@ -501,7 +497,7 @@ void ctgFreeTaskRes(CTG_TASK_TYPE type, void** pRes) { } break; } - case CTG_TASK_GET_TB_INDEX: { + case CTG_TASK_GET_TB_SMA_INDEX: { taosArrayDestroyEx(*pRes, tFreeSTableIndexInfo); *pRes = NULL; break; @@ -516,7 +512,7 @@ void ctgFreeTaskRes(CTG_TASK_TYPE type, void** pRes) { } case CTG_TASK_GET_TB_HASH: case CTG_TASK_GET_DB_INFO: - case CTG_TASK_GET_INDEX: + case CTG_TASK_GET_INDEX_INFO: case CTG_TASK_GET_UDF: case CTG_TASK_GET_USER: case CTG_TASK_GET_SVR_VER: @@ -571,7 +567,7 @@ void ctgFreeSubTaskRes(CTG_TASK_TYPE type, void** pRes) { } break; } - case CTG_TASK_GET_TB_INDEX: { + case CTG_TASK_GET_TB_SMA_INDEX: { taosArrayDestroyEx(*pRes, tFreeSTableIndexInfo); *pRes = NULL; break; @@ -587,7 +583,7 @@ void ctgFreeSubTaskRes(CTG_TASK_TYPE type, void** pRes) { case CTG_TASK_GET_TB_META: case CTG_TASK_GET_DB_INFO: case CTG_TASK_GET_TB_HASH: - case CTG_TASK_GET_INDEX: + case CTG_TASK_GET_INDEX_INFO: case CTG_TASK_GET_UDF: case CTG_TASK_GET_SVR_VER: case CTG_TASK_GET_USER: { @@ -664,7 +660,7 @@ void ctgFreeTaskCtx(SCtgTask* pTask) { taosMemoryFreeClear(pTask->taskCtx); break; } - case CTG_TASK_GET_TB_INDEX: { + case CTG_TASK_GET_TB_SMA_INDEX: { SCtgTbIndexCtx* taskCtx = (SCtgTbIndexCtx*)pTask->taskCtx; taosMemoryFreeClear(taskCtx->pName); taosMemoryFreeClear(pTask->taskCtx); @@ -680,7 +676,7 @@ void ctgFreeTaskCtx(SCtgTask* pTask) { case CTG_TASK_GET_DB_VGROUP: case CTG_TASK_GET_DB_CFG: case CTG_TASK_GET_DB_INFO: - case CTG_TASK_GET_INDEX: + case CTG_TASK_GET_INDEX_INFO: case CTG_TASK_GET_UDF: case CTG_TASK_GET_QNODE: case CTG_TASK_GET_USER: { @@ -1421,3 +1417,69 @@ void catalogFreeMetaData(SMetaData* pData) { taosMemoryFreeClear(pData->pSvrVer); taosMemoryFree(pData); } + +void ctgGetClusterCacheStat(SCatalog* pCtg) { + for (int32_t i = 0; i < CTG_CI_MAX_VALUE; ++i) { + if (0 == (gCtgStatItem[i].flag & CTG_CI_FLAG_LEVEL_DB)) { + continue; + } + + pCtg->cacheStat.cacheNum[i] = 0; + } + + SCtgDBCache *dbCache = NULL; + void *pIter = taosHashIterate(pCtg->dbCache, NULL); + while (pIter) { + dbCache = (SCtgDBCache *)pIter; + + for (int32_t i = 0; i < CTG_CI_MAX_VALUE; ++i) { + if (0 == (gCtgStatItem[i].flag & CTG_CI_FLAG_LEVEL_DB)) { + continue; + } + + pCtg->cacheStat.cacheNum[i] += dbCache->dbCacheNum[i]; + } + + pIter = taosHashIterate(pCtg->dbCache, pIter); + } +} + +void ctgSummaryClusterCacheStat(SCatalog *pCtg) { + for (int32_t i = 0; i < CTG_CI_MAX_VALUE; ++i) { + if (gCtgStatItem[i].flag & CTG_CI_FLAG_LEVEL_GLOBAL) { + continue; + } + + gCtgMgmt.statInfo.cache.cacheNum[i] += pCtg->cacheStat.cacheNum[i]; + gCtgMgmt.statInfo.cache.cacheHit[i] += pCtg->cacheStat.cacheHit[i]; + gCtgMgmt.statInfo.cache.cacheNHit[i] += pCtg->cacheStat.cacheNHit[i]; + } +} + +void ctgGetGlobalCacheStat(SCtgCacheStat *pStat) { + for (int32_t i = 0; i < CTG_CI_MAX_VALUE; ++i) { + if (gCtgStatItem[i].flag & CTG_CI_FLAG_LEVEL_GLOBAL) { + continue; + } + + gCtgMgmt.statInfo.cache.cacheNum[i] = 0; + gCtgMgmt.statInfo.cache.cacheHit[i] = 0; + gCtgMgmt.statInfo.cache.cacheNHit[i] = 0; + } + + SCatalog *pCtg = NULL; + void *pIter = taosHashIterate(gCtgMgmt.pCluster, NULL); + while (pIter) { + pCtg = *(SCatalog **)pIter; + + if (pCtg) { + ctgGetClusterCacheStat(pCtg); + ctgSummaryClusterCacheStat(pCtg); + } + + pIter = taosHashIterate(gCtgMgmt.pCluster, pIter); + } + + memcpy(pStat, &gCtgMgmt.statInfo.cache, sizeof(gCtgMgmt.statInfo.cache)); +} + diff --git a/source/libs/command/src/command.c b/source/libs/command/src/command.c index f88701afe29892dba5ee3b17c463d2b44de9d981..c862a75ed3adaaff3ecb759db9c796f51b2473ce 100644 --- a/source/libs/command/src/command.c +++ b/source/libs/command/src/command.c @@ -248,13 +248,13 @@ static const char* cacheModelStr(int8_t cacheModel) { return TSDB_CACHE_MODEL_NONE_STR; } -static void setCreateDBResultIntoDataBlock(SSDataBlock* pBlock, char* dbFName, SDbCfgInfo* pCfg) { +static void setCreateDBResultIntoDataBlock(SSDataBlock* pBlock, char* dbName, char* dbFName, SDbCfgInfo* pCfg) { blockDataEnsureCapacity(pBlock, 1); pBlock->info.rows = 1; SColumnInfoData* pCol1 = taosArrayGet(pBlock->pDataBlock, 0); char buf1[SHOW_CREATE_DB_RESULT_FIELD1_LEN] = {0}; - STR_TO_VARSTR(buf1, dbFName); + STR_TO_VARSTR(buf1, dbName); colDataSetVal(pCol1, 0, buf1, false); SColumnInfoData* pCol2 = taosArrayGet(pBlock->pDataBlock, 1); @@ -277,16 +277,20 @@ static void setCreateDBResultIntoDataBlock(SSDataBlock* pBlock, char* dbFName, S } char* retentions = buildRetension(pCfg->pRetensions); + int32_t dbFNameLen = strlen(dbFName); + int32_t hashPrefix = (pCfg->hashPrefix > (dbFNameLen + 1)) ? (pCfg->hashPrefix - dbFNameLen - 1) : 0; len += sprintf( buf2 + VARSTR_HEADER_SIZE, "CREATE DATABASE `%s` BUFFER %d CACHESIZE %d CACHEMODEL '%s' COMP %d DURATION %dm " "WAL_FSYNC_PERIOD %d MAXROWS %d MINROWS %d STT_TRIGGER %d KEEP %dm,%dm,%dm PAGES %d PAGESIZE %d PRECISION '%s' REPLICA %d " - "WAL_LEVEL %d VGROUPS %d SINGLE_STABLE %d", - dbFName, pCfg->buffer, pCfg->cacheSize, cacheModelStr(pCfg->cacheLast), pCfg->compression, pCfg->daysPerFile, + "WAL_LEVEL %d VGROUPS %d SINGLE_STABLE %d TABLE_PREFIX %d TABLE_SUFFIX %d TSDB_PAGESIZE %d " + "WAL_RETENTION_PERIOD %d WAL_RETENTION_SIZE %" PRId64 " WAL_ROLL_PERIOD %d WAL_SEGMENT_SIZE %" PRId64, + dbName, pCfg->buffer, pCfg->cacheSize, cacheModelStr(pCfg->cacheLast), pCfg->compression, pCfg->daysPerFile, pCfg->walFsyncPeriod, pCfg->maxRows, pCfg->minRows, pCfg->sstTrigger, pCfg->daysToKeep0, pCfg->daysToKeep1, pCfg->daysToKeep2, pCfg->pages, pCfg->pageSize, prec, pCfg->replications, pCfg->walLevel, pCfg->numOfVgroups, - 1 == pCfg->numOfStables); + 1 == pCfg->numOfStables, hashPrefix, pCfg->hashSuffix, pCfg->tsdbPageSize, pCfg->walRetentionPeriod, + pCfg->walRetentionSize, pCfg->walRollPeriod, pCfg->walSegmentSize); if (retentions) { len += sprintf(buf2 + VARSTR_HEADER_SIZE + len, " RETENTIONS %s", retentions); @@ -404,7 +408,7 @@ static int32_t execShowCreateDatabase(SShowCreateDatabaseStmt* pStmt, SRetrieveT SSDataBlock* pBlock = NULL; int32_t code = buildCreateDBResultDataBlock(&pBlock); if (TSDB_CODE_SUCCESS == code) { - setCreateDBResultIntoDataBlock(pBlock, pStmt->dbName, pStmt->pCfg); + setCreateDBResultIntoDataBlock(pBlock, pStmt->dbName, pStmt->dbFName, pStmt->pCfg); } if (TSDB_CODE_SUCCESS == code) { code = buildRetrieveTableRsp(pBlock, SHOW_CREATE_DB_RESULT_COLS, pRsp); diff --git a/source/libs/executor/inc/executorimpl.h b/source/libs/executor/inc/executorimpl.h index be79054c1b1b5aa40cd566cc1a50553660ec7062..55bf8b37d0272af9bff367b8067b45f841643b4a 100644 --- a/source/libs/executor/inc/executorimpl.h +++ b/source/libs/executor/inc/executorimpl.h @@ -121,7 +121,8 @@ enum { STREAM_RECOVER_STEP__NONE = 0, STREAM_RECOVER_STEP__PREPARE1, STREAM_RECOVER_STEP__PREPARE2, - STREAM_RECOVER_STEP__SCAN, + STREAM_RECOVER_STEP__SCAN1, + STREAM_RECOVER_STEP__SCAN2, }; typedef struct { @@ -881,6 +882,7 @@ SExprInfo* createExpr(SNodeList* pNodeList, int32_t* numOfExprs); void copyResultrowToDataBlock(SExprInfo* pExprInfo, int32_t numOfExprs, SResultRow* pRow, SqlFunctionCtx* pCtx, SSDataBlock* pBlock, const int32_t* rowEntryOffset, SExecTaskInfo* pTaskInfo); void doUpdateNumOfRows(SqlFunctionCtx* pCtx, SResultRow* pRow, int32_t numOfExprs, const int32_t* rowEntryOffset); +void doClearBufferedBlocks(SStreamScanInfo* pInfo); #ifdef __cplusplus } diff --git a/source/libs/executor/src/eventwindowoperator.c b/source/libs/executor/src/eventwindowoperator.c index 49e2d5bc4ac0c85fabd8ffde93aa527bbe3c85e0..559fce52249facc32213789eee9bf2655b36ee16 100644 --- a/source/libs/executor/src/eventwindowoperator.c +++ b/source/libs/executor/src/eventwindowoperator.c @@ -29,7 +29,7 @@ typedef struct SEventWindowOperatorInfo { SWindowRowsSup winSup; int32_t tsSlotId; // primary timestamp column slot id STimeWindowAggSupp twAggSup; - uint64_t groupId; // current group id, used to identify the data block from different groups + uint64_t groupId; // current group id, used to identify the data block from different groups SFilterInfo* pStartCondInfo; SFilterInfo* pEndCondInfo; bool inWindow; @@ -310,6 +310,7 @@ int32_t eventWindowAggImpl(SOperatorInfo* pOperator, SEventWindowOperatorInfo* p pSup->rowEntryInfoOffset, pTaskInfo); pRes->info.rows += pInfo->pRow->numOfRows; + pInfo->pRow->numOfRows = 0; pInfo->inWindow = false; rowIndex += 1; diff --git a/source/libs/executor/src/executil.c b/source/libs/executor/src/executil.c index 9537751ff0f4dccd96ec9d5f045cdd33b350a880..0ac458af495c8f4c3a3f4fd1ce7d982e5459aaf4 100644 --- a/source/libs/executor/src/executil.c +++ b/source/libs/executor/src/executil.c @@ -957,9 +957,7 @@ static int32_t doFilterByTagCond(STableListInfo* pListInfo, SArray* pUidList, SN STUidTagInfo* pInfo = taosArrayGet(pUidTagList, i); taosArrayPush(pUidList, &pInfo->uid); } - terrno = 0; - goto end; } else { if ((condType == FILTER_NO_LOGIC || condType == FILTER_AND) && status != SFLT_NOT_INDEX) { code = metaGetTableTagsByUids(metaHandle, pListInfo->suid, pUidTagList); diff --git a/source/libs/executor/src/executor.c b/source/libs/executor/src/executor.c index c2bf001c86d4af8fffccd544c2b4de70798f870a..ac78ddc23cbbf3fbdcaa3305e4acdebcebc47aa2 100644 --- a/source/libs/executor/src/executor.c +++ b/source/libs/executor/src/executor.c @@ -93,6 +93,23 @@ static int32_t doSetStreamOpOpen(SOperatorInfo* pOperator, char* id) { return 0; } +static void clearStreamBlock(SOperatorInfo* pOperator) { + if (pOperator->operatorType != QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN) { + if (pOperator->numOfDownstream == 1) { + return clearStreamBlock(pOperator->pDownstream[0]); + } + } else { + SStreamScanInfo* pInfo = pOperator->info; + doClearBufferedBlocks(pInfo); + } +} + +void resetTaskInfo(qTaskInfo_t tinfo) { + SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo; + pTaskInfo->code = 0; + clearStreamBlock(pTaskInfo->pRoot); +} + static int32_t doSetStreamBlock(SOperatorInfo* pOperator, void* input, size_t numOfBlocks, int32_t type, char* id) { if (pOperator->operatorType != QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN) { if (pOperator->numOfDownstream == 0) { @@ -608,6 +625,7 @@ int32_t qExecTask(qTaskInfo_t tinfo, SSDataBlock** pRes, uint64_t* useconds) { } if (isTaskKilled(pTaskInfo)) { + clearStreamBlock(pTaskInfo->pRoot); atomic_store_64(&pTaskInfo->owner, 0); qDebug("%s already killed, abort", GET_TASKID(pTaskInfo)); return TSDB_CODE_SUCCESS; @@ -1068,7 +1086,7 @@ int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subT tsdbReaderClose(pTSInfo->base.dataReader); pTSInfo->base.dataReader = NULL; // let's seek to the next version in wal file - if (tqSeekVer(pInfo->tqReader, pOffset->version + 1) < 0) { + if (tqSeekVer(pInfo->tqReader, pOffset->version + 1, pTaskInfo->id.str) < 0) { return -1; } } else if (pOffset->type == TMQ_OFFSET__SNAPSHOT_DATA) { @@ -1092,11 +1110,8 @@ int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subT STableScanInfo* pTableScanInfo = pInfo->pTableScanOp->info; int32_t numOfTables = tableListGetSize(pTaskInfo->pTableInfoList); -#ifndef NDEBUG - qDebug("switch to next table %" PRId64 " (cursor %d), %" PRId64 " rows returned", uid, - pTableScanInfo->currentTable, pInfo->pTableScanOp->resultInfo.totalRows); + qDebug("switch to next table %" PRId64 " ts %" PRId64 "% "PRId64 " rows returned", uid, ts, pInfo->pTableScanOp->resultInfo.totalRows); pInfo->pTableScanOp->resultInfo.totalRows = 0; -#endif bool found = false; for (int32_t i = 0; i < numOfTables; i++) { diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c index 9c85ebae9dac6bcf9197ebe8b2e4c118fb1b5ae4..5a2cdffa9295ebd7db036054b2638c91f5ae10ff 100644 --- a/source/libs/executor/src/executorimpl.c +++ b/source/libs/executor/src/executorimpl.c @@ -1197,16 +1197,11 @@ int32_t doCopyToSDataBlock(SExecTaskInfo* pTaskInfo, SSDataBlock* pBlock, SExprS } if (pBlock->info.rows + pRow->numOfRows > pBlock->info.capacity) { - // expand the result datablock capacity - if (pRow->numOfRows > pBlock->info.capacity) { - blockDataEnsureCapacity(pBlock, pRow->numOfRows); - qDebug("datablock capacity not sufficient, expand to requried:%d, current capacity:%d, %s", pRow->numOfRows, - pBlock->info.capacity, GET_TASKID(pTaskInfo)); + blockDataEnsureCapacity(pBlock, pBlock->info.rows + pRow->numOfRows); + qDebug("datablock capacity not sufficient, expand to required:%d, current capacity:%d, %s", + (pRow->numOfRows+pBlock->info.rows), + pBlock->info.capacity, GET_TASKID(pTaskInfo)); // todo set the pOperator->resultInfo size - } else { - releaseBufPage(pBuf, page); - break; - } } pGroupResInfo->index += 1; diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index e1594b13a8a3c5575c67f0d134e3ef18b2bd53ee..40b9597643cbf0379434a5327871b2ed3483c504 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -945,7 +945,8 @@ SOperatorInfo* createTableSeqScanOperatorInfo(void* pReadHandle, SExecTaskInfo* return pOperator; } -static FORCE_INLINE void doClearBufferedBlocks(SStreamScanInfo* pInfo) { +FORCE_INLINE void doClearBufferedBlocks(SStreamScanInfo* pInfo) { + qDebug("clear buff blocks:%d", (int32_t)taosArrayGetSize(pInfo->pBlockLists)); taosArrayClear(pInfo->pBlockLists); pInfo->validBlockIndex = 0; } @@ -1607,8 +1608,8 @@ static SSDataBlock* doQueueScan(SOperatorInfo* pOperator) { if (pTaskInfo->streamInfo.prepareStatus.type == TMQ_OFFSET__SNAPSHOT_DATA) { SSDataBlock* pResult = doTableScan(pInfo->pTableScanOp); if (pResult && pResult->info.rows > 0) { - qDebug("queue scan tsdb return %d rows min:%" PRId64 " max:%" PRId64, pResult->info.rows, - pResult->info.window.skey, pResult->info.window.ekey); + qDebug("queue scan tsdb return %d rows min:%" PRId64 " max:%" PRId64 " wal curVersion:%" PRId64, pResult->info.rows, + pResult->info.window.skey, pResult->info.window.ekey, pInfo->tqReader->pWalReader->curVersion); pTaskInfo->streamInfo.returned = 1; return pResult; } else { @@ -1618,7 +1619,7 @@ static SSDataBlock* doQueueScan(SOperatorInfo* pOperator) { pTSInfo->base.dataReader = NULL; tqOffsetResetToLog(&pTaskInfo->streamInfo.prepareStatus, pTaskInfo->streamInfo.snapshotVer); qDebug("queue scan tsdb over, switch to wal ver %" PRId64 "", pTaskInfo->streamInfo.snapshotVer + 1); - if (tqSeekVer(pInfo->tqReader, pTaskInfo->streamInfo.snapshotVer + 1) < 0) { + if (tqSeekVer(pInfo->tqReader, pTaskInfo->streamInfo.snapshotVer + 1, pTaskInfo->id.str) < 0) { tqOffsetResetToLog(&pTaskInfo->streamInfo.lastStatus, pTaskInfo->streamInfo.snapshotVer); return NULL; } @@ -1632,8 +1633,12 @@ static SSDataBlock* doQueueScan(SOperatorInfo* pOperator) { while (1) { SFetchRet ret = {0}; if (tqNextBlock(pInfo->tqReader, &ret) < 0) { - qError("failed to get next log block since %s", terrstr()); + // if the end is reached, terrno is 0 + if (terrno != 0) { + qError("failed to get next log block since %s", terrstr()); + } } + if (ret.fetchType == FETCH_TYPE__DATA) { blockDataCleanup(pInfo->pRes); setBlockIntoRes(pInfo, &ret.data, true); @@ -1651,8 +1656,6 @@ static SSDataBlock* doQueueScan(SOperatorInfo* pOperator) { } else if (ret.fetchType == FETCH_TYPE__NONE || (ret.fetchType == FETCH_TYPE__SEP && pOperator->status == OP_EXEC_RECV)) { pTaskInfo->streamInfo.lastStatus = ret.offset; - ASSERT(pTaskInfo->streamInfo.lastStatus.version >= pTaskInfo->streamInfo.prepareStatus.version); - ASSERT(pTaskInfo->streamInfo.lastStatus.version + 1 == pInfo->tqReader->pWalReader->curVersion); char formatBuf[80]; tFormatOffset(formatBuf, 80, &ret.offset); qDebug("queue scan log return null, offset %s", formatBuf); @@ -1660,16 +1663,6 @@ static SSDataBlock* doQueueScan(SOperatorInfo* pOperator) { return NULL; } } -#if 0 - } else if (pTaskInfo->streamInfo.prepareStatus.type == TMQ_OFFSET__SNAPSHOT_DATA) { - SSDataBlock* pResult = doTableScan(pInfo->pTableScanOp); - if (pResult && pResult->info.rows > 0) { - qDebug("stream scan tsdb return %d rows", pResult->info.rows); - return pResult; - } - qDebug("stream scan tsdb return null"); - return NULL; -#endif } else { qError("unexpected streamInfo prepare type: %d", pTaskInfo->streamInfo.prepareStatus.type); return NULL; @@ -1729,9 +1722,9 @@ static void setBlockGroupIdByUid(SStreamScanInfo* pInfo, SSDataBlock* pBlock) { } } -static void doCheckUpdate(SStreamScanInfo* pInfo, TSKEY endKey) { +static void doCheckUpdate(SStreamScanInfo* pInfo, TSKEY endKey, SSDataBlock* pBlock) { if (pInfo->pUpdateInfo) { - checkUpdateData(pInfo, true, pInfo->pRes, true); + checkUpdateData(pInfo, true, pBlock, true); pInfo->twAggSup.maxTs = TMAX(pInfo->twAggSup.maxTs, endKey); if (pInfo->pUpdateDataRes->info.rows > 0) { pInfo->updateResIndex = 0; @@ -1763,11 +1756,13 @@ static SSDataBlock* doStreamScan(SOperatorInfo* pOperator) { pTSInfo->base.cond.endVersion = pTaskInfo->streamInfo.fillHistoryVer1; qDebug("stream recover step 1, from %" PRId64 " to %" PRId64, pTSInfo->base.cond.startVersion, pTSInfo->base.cond.endVersion); + pTaskInfo->streamInfo.recoverStep = STREAM_RECOVER_STEP__SCAN1; } else { pTSInfo->base.cond.startVersion = pTaskInfo->streamInfo.fillHistoryVer1 + 1; pTSInfo->base.cond.endVersion = pTaskInfo->streamInfo.fillHistoryVer2; qDebug("stream recover step 2, from %" PRId64 " to %" PRId64, pTSInfo->base.cond.startVersion, pTSInfo->base.cond.endVersion); + pTaskInfo->streamInfo.recoverStep = STREAM_RECOVER_STEP__SCAN2; } /*resetTableScanInfo(pTSInfo, pWin);*/ @@ -1777,11 +1772,11 @@ static SSDataBlock* doStreamScan(SOperatorInfo* pOperator) { pTSInfo->scanTimes = 0; pTSInfo->currentGroupId = -1; - pTaskInfo->streamInfo.recoverStep = STREAM_RECOVER_STEP__SCAN; pTaskInfo->streamInfo.recoverScanFinished = false; } - if (pTaskInfo->streamInfo.recoverStep == STREAM_RECOVER_STEP__SCAN) { + if (pTaskInfo->streamInfo.recoverStep == STREAM_RECOVER_STEP__SCAN1 || + pTaskInfo->streamInfo.recoverStep == STREAM_RECOVER_STEP__SCAN2) { if (pInfo->blockRecoverContiCnt > 100) { pInfo->blockRecoverTotCnt += pInfo->blockRecoverContiCnt; pInfo->blockRecoverContiCnt = 0; @@ -1794,6 +1789,27 @@ static SSDataBlock* doStreamScan(SOperatorInfo* pOperator) { printDataBlock(pInfo->pRecoverRes, "scan recover"); return pInfo->pRecoverRes; } break; + case STREAM_SCAN_FROM_UPDATERES: { + generateScanRange(pInfo, pInfo->pUpdateDataRes, pInfo->pUpdateRes); + prepareRangeScan(pInfo, pInfo->pUpdateRes, &pInfo->updateResIndex); + pInfo->scanMode = STREAM_SCAN_FROM_DATAREADER_RANGE; + return pInfo->pUpdateRes; + } break; + case STREAM_SCAN_FROM_DATAREADER_RANGE: { + SSDataBlock* pSDB = doRangeScan(pInfo, pInfo->pUpdateRes, pInfo->primaryTsIndex, &pInfo->updateResIndex); + if (pSDB) { + STableScanInfo* pTableScanInfo = pInfo->pTableScanOp->info; + uint64_t version = getReaderMaxVersion(pTableScanInfo->base.dataReader); + updateInfoSetScanRange(pInfo->pUpdateInfo, &pTableScanInfo->base.cond.twindows, pInfo->groupId, version); + pSDB->info.type = pInfo->scanMode == STREAM_SCAN_FROM_DATAREADER_RANGE ? STREAM_NORMAL : STREAM_PULL_DATA; + checkUpdateData(pInfo, true, pSDB, false); + // printDataBlock(pSDB, "stream scan update"); + calBlockTbName(pInfo, pSDB); + return pSDB; + } + blockDataCleanup(pInfo->pUpdateDataRes); + pInfo->scanMode = STREAM_SCAN_FROM_READERHANDLE; + } break; default: break; } @@ -1803,8 +1819,12 @@ static SSDataBlock* doStreamScan(SOperatorInfo* pOperator) { pInfo->blockRecoverContiCnt++; calBlockTbName(pInfo, pInfo->pRecoverRes); if (pInfo->pUpdateInfo) { - TSKEY maxTs = updateInfoFillBlockData(pInfo->pUpdateInfo, pInfo->pRecoverRes, pInfo->primaryTsIndex); - pInfo->twAggSup.maxTs = TMAX(pInfo->twAggSup.maxTs, maxTs); + if (pTaskInfo->streamInfo.recoverStep == STREAM_RECOVER_STEP__SCAN1) { + TSKEY maxTs = updateInfoFillBlockData(pInfo->pUpdateInfo, pInfo->pRecoverRes, pInfo->primaryTsIndex); + pInfo->twAggSup.maxTs = TMAX(pInfo->twAggSup.maxTs, maxTs); + } else { + doCheckUpdate(pInfo, pInfo->pRecoverRes->info.window.ekey, pInfo->pRecoverRes); + } } if (pInfo->pCreateTbRes->info.rows > 0) { pInfo->scanMode = STREAM_SCAN_FROM_RES; @@ -1915,11 +1935,13 @@ FETCH_NEXT_BLOCK: switch (pInfo->scanMode) { case STREAM_SCAN_FROM_RES: { pInfo->scanMode = STREAM_SCAN_FROM_READERHANDLE; - doCheckUpdate(pInfo, pInfo->pRes->info.window.ekey); + doCheckUpdate(pInfo, pInfo->pRes->info.window.ekey, pInfo->pRes); doFilter(pInfo->pRes, pOperator->exprSupp.pFilterInfo, NULL); pInfo->pRes->info.dataLoad = 1; blockDataUpdateTsWindow(pInfo->pRes, pInfo->primaryTsIndex); - return pInfo->pRes; + if (pInfo->pRes->info.rows > 0) { + return pInfo->pRes; + } } break; case STREAM_SCAN_FROM_DELETE_DATA: { generateScanRange(pInfo, pInfo->pUpdateDataRes, pInfo->pUpdateRes); @@ -2014,7 +2036,7 @@ FETCH_NEXT_BLOCK: return pInfo->pCreateTbRes; } - doCheckUpdate(pInfo, pBlockInfo->window.ekey); + doCheckUpdate(pInfo, pBlockInfo->window.ekey, pInfo->pRes); doFilter(pInfo->pRes, pOperator->exprSupp.pFilterInfo, NULL); pInfo->pRes->info.dataLoad = 1; blockDataUpdateTsWindow(pInfo->pRes, pInfo->primaryTsIndex); diff --git a/source/libs/executor/src/timewindowoperator.c b/source/libs/executor/src/timewindowoperator.c index 6411d862ae20ba89b3de24a7c400d934a7a69180..bfdf5ea89b197d6e59f124d627dd3b857c380b99 100644 --- a/source/libs/executor/src/timewindowoperator.c +++ b/source/libs/executor/src/timewindowoperator.c @@ -4805,10 +4805,9 @@ static SSDataBlock* doStreamIntervalAgg(SOperatorInfo* pOperator) { setInverFunction(pSup->pCtx, pOperator->exprSupp.numOfExprs, pBlock->info.type); } + doStreamIntervalAggImpl(pOperator, pBlock, pBlock->info.id.groupId, pInfo->pUpdatedMap); pInfo->twAggSup.maxTs = TMAX(pInfo->twAggSup.maxTs, pBlock->info.window.ekey); pInfo->twAggSup.minTs = TMIN(pInfo->twAggSup.minTs, pBlock->info.window.skey); - - doStreamIntervalAggImpl(pOperator, pBlock, pBlock->info.id.groupId, pInfo->pUpdatedMap); } pOperator->status = OP_RES_TO_RETURN; removeDeleteResults(pInfo->pUpdatedMap, pInfo->pDelWins); diff --git a/source/libs/function/inc/tudfInt.h b/source/libs/function/inc/tudfInt.h index c69d19b8a6187ad1d6817a6b5f8793b0905817e4..27d3b7930f80905f76704250765dc63040d33353 100644 --- a/source/libs/function/inc/tudfInt.h +++ b/source/libs/function/inc/tudfInt.h @@ -41,7 +41,7 @@ typedef struct SUdfSetupRequest { typedef struct SUdfSetupResponse { int64_t udfHandle; int8_t outputType; - int32_t outputLen; + int32_t bytes; int32_t bufSize; } SUdfSetupResponse; diff --git a/source/libs/function/src/builtinsimpl.c b/source/libs/function/src/builtinsimpl.c index f8c339e256da6f2f39626472ec780f622ca32a57..fbc60041b242ed039e873bd5877e3c5c8a4f3828 100644 --- a/source/libs/function/src/builtinsimpl.c +++ b/source/libs/function/src/builtinsimpl.c @@ -1940,6 +1940,7 @@ int32_t apercentileFunctionMerge(SqlFunctionCtx* pCtx) { } if (pInfo->algo != APERCT_ALGO_TDIGEST) { + buildHistogramInfo(pInfo); qDebug("%s after merge, total:%" PRId64 ", numOfEntry:%d, %p", __FUNCTION__, pInfo->pHisto->numOfElems, pInfo->pHisto->numOfEntries, pInfo->pHisto); } @@ -2461,6 +2462,9 @@ static int32_t firstLastFunctionMergeImpl(SqlFunctionCtx* pCtx, bool isFirstQuer int32_t numOfElems = 0; for (int32_t i = start; i < start + pInput->numOfRows; ++i) { + if (colDataIsNull_s(pCol, i)) { + continue; + } char* data = colDataGetData(pCol, i); SFirstLastRes* pInputInfo = (SFirstLastRes*)varDataVal(data); int32_t code = firstLastTransferInfo(pCtx, pInputInfo, pInfo, isFirstQuery, i); diff --git a/source/libs/function/src/tudf.c b/source/libs/function/src/tudf.c index a70dc28b8fdcfc1768e81776597d23bfa92f666f..611344063b9f74526180c8058ecd30a9f601aa72 100644 --- a/source/libs/function/src/tudf.c +++ b/source/libs/function/src/tudf.c @@ -376,7 +376,7 @@ typedef struct SUdfcUvSession { uv_pipe_t *udfUvPipe; int8_t outputType; - int32_t outputLen; + int32_t bytes; int32_t bufSize; char udfName[TSDB_FUNC_NAME_LEN + 1]; @@ -614,7 +614,7 @@ int32_t encodeUdfSetupResponse(void **buf, const SUdfSetupResponse *setupRsp) { int32_t len = 0; len += taosEncodeFixedI64(buf, setupRsp->udfHandle); len += taosEncodeFixedI8(buf, setupRsp->outputType); - len += taosEncodeFixedI32(buf, setupRsp->outputLen); + len += taosEncodeFixedI32(buf, setupRsp->bytes); len += taosEncodeFixedI32(buf, setupRsp->bufSize); return len; } @@ -622,7 +622,7 @@ int32_t encodeUdfSetupResponse(void **buf, const SUdfSetupResponse *setupRsp) { void *decodeUdfSetupResponse(const void *buf, SUdfSetupResponse *setupRsp) { buf = taosDecodeFixedI64(buf, &setupRsp->udfHandle); buf = taosDecodeFixedI8(buf, &setupRsp->outputType); - buf = taosDecodeFixedI32(buf, &setupRsp->outputLen); + buf = taosDecodeFixedI32(buf, &setupRsp->bytes); buf = taosDecodeFixedI32(buf, &setupRsp->bufSize); return (void *)buf; } @@ -808,6 +808,26 @@ int32_t convertDataBlockToUdfDataBlock(SSDataBlock *block, SUdfDataBlock *udfBlo } int32_t convertUdfColumnToDataBlock(SUdfColumn *udfCol, SSDataBlock *block) { + SUdfColumnMeta* meta = &udfCol->colMeta; + + SColumnInfoData colInfoData = createColumnInfoData(meta->type, meta->bytes, 1); + blockDataAppendColInfo(block, &colInfoData); + blockDataEnsureCapacity(block, udfCol->colData.numOfRows); + + SColumnInfoData *col = bdGetColumnInfoData(block, 0); + for (int i = 0; i < udfCol->colData.numOfRows; ++i) { + if (udfColDataIsNull(udfCol, i)) { + colDataSetNULL(col, i); + } else { + char* data = udfColDataGetData(udfCol, i); + colDataSetVal(col, i, data, false); + } + } + block->info.rows = udfCol->colData.numOfRows; + return 0; +} + +int32_t convertUdfColumnToDataBlock2(SUdfColumn *udfCol, SSDataBlock *block) { block->info.rows = udfCol->colData.numOfRows; block->info.hasVarCol = IS_VAR_DATA_TYPE(udfCol->colMeta.type); @@ -899,9 +919,11 @@ int32_t convertDataBlockToScalarParm(SSDataBlock *input, SScalarParam *output) { typedef struct SUdfAggRes { int8_t finalResNum; int8_t interResNum; + int32_t interResBufLen; char *finalResBuf; char *interResBuf; } SUdfAggRes; + void onUdfcPipeClose(uv_handle_t *handle); int32_t udfcGetUdfTaskResultFromUvTask(SClientUdfTask *task, SClientUvTaskNode *uvTask); void udfcAllocateBuffer(uv_handle_t *handle, size_t suggestedSize, uv_buf_t *buf); @@ -1054,9 +1076,9 @@ int32_t callUdfScalarFunc(char *udfName, SScalarParam *input, int32_t numOfCols, fnError("udfc scalar function calculate error. no column data"); code = TSDB_CODE_UDF_INVALID_OUTPUT_TYPE; } else { - if (session->outputType != output->columnData->info.type || session->outputLen != output->columnData->info.bytes) { + if (session->outputType != output->columnData->info.type || session->bytes != output->columnData->info.bytes) { fnError("udfc scalar function calculate error. type mismatch. session type: %d(%d), output type: %d(%d)", - session->outputType, session->outputLen, output->columnData->info.type, output->columnData->info.bytes); + session->outputType, session->bytes, output->columnData->info.type, output->columnData->info.bytes); code = TSDB_CODE_UDF_INVALID_OUTPUT_TYPE; } } @@ -1084,11 +1106,11 @@ bool udfAggInit(struct SqlFunctionCtx *pCtx, struct SResultRowEntryInfo *pResult } SUdfcUvSession *session = (SUdfcUvSession *)handle; SUdfAggRes *udfRes = (SUdfAggRes *)GET_ROWCELL_INTERBUF(pResultCellInfo); - int32_t envSize = sizeof(SUdfAggRes) + session->outputLen + session->bufSize; + int32_t envSize = sizeof(SUdfAggRes) + session->bytes + session->bufSize; memset(udfRes, 0, envSize); udfRes->finalResBuf = (char *)udfRes + sizeof(SUdfAggRes); - udfRes->interResBuf = (char *)udfRes + sizeof(SUdfAggRes) + session->outputLen; + udfRes->interResBuf = (char *)udfRes + sizeof(SUdfAggRes) + session->bytes; SUdfInterBuf buf = {0}; if ((udfCode = doCallUdfAggInit(handle, &buf)) != 0) { @@ -1096,9 +1118,10 @@ bool udfAggInit(struct SqlFunctionCtx *pCtx, struct SResultRowEntryInfo *pResult releaseUdfFuncHandle(pCtx->udfName); return false; } - udfRes->interResNum = buf.numOfResult; if (buf.bufLen <= session->bufSize) { memcpy(udfRes->interResBuf, buf.buf, buf.bufLen); + udfRes->interResBufLen = buf.bufLen; + udfRes->interResNum = buf.numOfResult; } else { fnError("udfc inter buf size %d is greater than function bufSize %d", buf.bufLen, session->bufSize); releaseUdfFuncHandle(pCtx->udfName); @@ -1120,7 +1143,7 @@ int32_t udfAggProcess(struct SqlFunctionCtx *pCtx) { SUdfcUvSession *session = handle; SUdfAggRes *udfRes = (SUdfAggRes *)GET_ROWCELL_INTERBUF(GET_RES_INFO(pCtx)); udfRes->finalResBuf = (char *)udfRes + sizeof(SUdfAggRes); - udfRes->interResBuf = (char *)udfRes + sizeof(SUdfAggRes) + session->outputLen; + udfRes->interResBuf = (char *)udfRes + sizeof(SUdfAggRes) + session->bytes; SInputColumnInfoData *pInput = &pCtx->input; int32_t numOfCols = pInput->numOfInputCols; @@ -1136,7 +1159,7 @@ int32_t udfAggProcess(struct SqlFunctionCtx *pCtx) { SSDataBlock *inputBlock = blockDataExtractBlock(pTempBlock, start, numOfRows); - SUdfInterBuf state = {.buf = udfRes->interResBuf, .bufLen = session->bufSize, .numOfResult = udfRes->interResNum}; + SUdfInterBuf state = {.buf = udfRes->interResBuf, .bufLen = udfRes->interResBufLen, .numOfResult = udfRes->interResNum}; SUdfInterBuf newState = {0}; udfCode = doCallUdfAggProcess(session, inputBlock, &state, &newState); @@ -1144,17 +1167,17 @@ int32_t udfAggProcess(struct SqlFunctionCtx *pCtx) { fnError("udfAggProcess error. code: %d", udfCode); newState.numOfResult = 0; } else { - udfRes->interResNum = newState.numOfResult; if (newState.bufLen <= session->bufSize) { memcpy(udfRes->interResBuf, newState.buf, newState.bufLen); + udfRes->interResBufLen = newState.bufLen; + udfRes->interResNum = newState.numOfResult; } else { fnError("udfc inter buf size %d is greater than function bufSize %d", newState.bufLen, session->bufSize); udfCode = TSDB_CODE_UDF_INVALID_BUFSIZE; } } - if (newState.numOfResult == 1 || state.numOfResult == 1) { - GET_RES_INFO(pCtx)->numOfRes = 1; - } + + GET_RES_INFO(pCtx)->numOfRes = udfRes->interResNum; blockDataDestroy(inputBlock); @@ -1177,10 +1200,10 @@ int32_t udfAggFinalize(struct SqlFunctionCtx *pCtx, SSDataBlock *pBlock) { SUdfcUvSession *session = handle; SUdfAggRes *udfRes = (SUdfAggRes *)GET_ROWCELL_INTERBUF(GET_RES_INFO(pCtx)); udfRes->finalResBuf = (char *)udfRes + sizeof(SUdfAggRes); - udfRes->interResBuf = (char *)udfRes + sizeof(SUdfAggRes) + session->outputLen; + udfRes->interResBuf = (char *)udfRes + sizeof(SUdfAggRes) + session->bytes; SUdfInterBuf resultBuf = {0}; - SUdfInterBuf state = {.buf = udfRes->interResBuf, .bufLen = session->bufSize, .numOfResult = udfRes->interResNum}; + SUdfInterBuf state = {.buf = udfRes->interResBuf, .bufLen = udfRes->interResBufLen, .numOfResult = udfRes->interResNum}; int32_t udfCallCode = 0; udfCallCode = doCallUdfAggFinalize(session, &state, &resultBuf); if (udfCallCode != 0) { @@ -1191,7 +1214,7 @@ int32_t udfAggFinalize(struct SqlFunctionCtx *pCtx, SSDataBlock *pBlock) { udfRes->finalResNum = 0; GET_RES_INFO(pCtx)->numOfRes = 0; } else { - if (resultBuf.bufLen <= session->outputLen) { + if (resultBuf.bufLen <= session->bytes) { memcpy(udfRes->finalResBuf, resultBuf.buf, resultBuf.bufLen); udfRes->finalResNum = resultBuf.numOfResult; GET_RES_INFO(pCtx)->numOfRes = udfRes->finalResNum; @@ -1701,13 +1724,13 @@ int32_t doSetupUdf(char udfName[], UdfcFuncHandle *funcHandle) { SUdfSetupResponse *rsp = &task->_setup.rsp; task->session->severHandle = rsp->udfHandle; task->session->outputType = rsp->outputType; - task->session->outputLen = rsp->outputLen; + task->session->bytes = rsp->bytes; task->session->bufSize = rsp->bufSize; strncpy(task->session->udfName, udfName, TSDB_FUNC_NAME_LEN); if (task->errCode != 0) { fnError("failed to setup udf. udfname: %s, err: %d", udfName, task->errCode) } else { - fnInfo("sucessfully setup udf func handle. udfName: %s, handle: %p", udfName, task->session); + fnInfo("successfully setup udf func handle. udfName: %s, handle: %p", udfName, task->session); *funcHandle = task->session; } int32_t err = task->errCode; diff --git a/source/libs/function/src/udfd.c b/source/libs/function/src/udfd.c index 366e890bd7790d86802cc5f01ced6f993476eea4..cd65cdfda3887de366cc15d9a020bdefe8c566da 100644 --- a/source/libs/function/src/udfd.c +++ b/source/libs/function/src/udfd.c @@ -30,8 +30,9 @@ #include "tmisce.h" // clang-format on -#define MAX_NUM_SCRIPT_PLUGINS 64 -#define MAX_NUM_PLUGIN_FUNCS 9 +#define UDFD_MAX_SCRIPT_PLUGINS 64 +#define UDFD_MAX_SCRIPT_TYPE 1 +#define UDFD_MAX_PLUGIN_FUNCS 9 typedef struct SUdfCPluginCtx { uv_lib_t lib; @@ -126,7 +127,8 @@ int32_t udfdCPluginUdfScalarProc(SUdfDataBlock *block, SUdfColumn *resultCol, vo if (ctx->scalarProcFunc) { return ctx->scalarProcFunc(block, resultCol); } else { - return TSDB_CODE_UDF_FUNC_NOT_IMPLEMENTED; + fnError("udfd c plugin scalar proc not implemented"); + return TSDB_CODE_UDF_FUNC_EXEC_FAILURE; } } @@ -135,7 +137,8 @@ int32_t udfdCPluginUdfAggStart(SUdfInterBuf *buf, void *udfCtx) { if (ctx->aggStartFunc) { return ctx->aggStartFunc(buf); } else { - return TSDB_CODE_UDF_FUNC_NOT_IMPLEMENTED; + fnError("udfd c plugin aggregation start not implemented"); + return TSDB_CODE_UDF_FUNC_EXEC_FAILURE; } return 0; } @@ -145,7 +148,8 @@ int32_t udfdCPluginUdfAggProc(SUdfDataBlock *block, SUdfInterBuf *interBuf, SUdf if (ctx->aggProcFunc) { return ctx->aggProcFunc(block, interBuf, newInterBuf); } else { - return TSDB_CODE_UDF_FUNC_NOT_IMPLEMENTED; + fnError("udfd c plugin aggregation process not implemented"); + return TSDB_CODE_UDF_FUNC_EXEC_FAILURE; } } @@ -155,7 +159,8 @@ int32_t udfdCPluginUdfAggMerge(SUdfInterBuf *inputBuf1, SUdfInterBuf *inputBuf2, if (ctx->aggMergeFunc) { return ctx->aggMergeFunc(inputBuf1, inputBuf2, outputBuf); } else { - return TSDB_CODE_UDF_FUNC_NOT_IMPLEMENTED; + fnError("udfd c plugin aggregation merge not implemented"); + return TSDB_CODE_UDF_FUNC_EXEC_FAILURE; } } @@ -164,7 +169,8 @@ int32_t udfdCPluginUdfAggFinish(SUdfInterBuf *buf, SUdfInterBuf *resultData, voi if (ctx->aggFinishFunc) { return ctx->aggFinishFunc(buf, resultData); } else { - return TSDB_CODE_UDF_FUNC_NOT_IMPLEMENTED; + fnError("udfd c plugin aggregation finish not implemented"); + return TSDB_CODE_UDF_FUNC_EXEC_FAILURE; } return 0; } @@ -205,7 +211,7 @@ typedef struct SUdfdContext { SHashObj *udfsHash; uv_mutex_t scriptPluginsMutex; - SUdfScriptPlugin *scriptPlugins[MAX_NUM_SCRIPT_PLUGINS]; + SUdfScriptPlugin *scriptPlugins[UDFD_MAX_SCRIPT_PLUGINS]; SArray *residentFuncs; @@ -235,7 +241,7 @@ typedef struct SUvUdfWork { struct SUvUdfWork *pWorkNext; } SUvUdfWork; -typedef enum { UDF_STATE_INIT = 0, UDF_STATE_LOADING, UDF_STATE_READY, UDF_STATE_UNLOADING } EUdfState; +typedef enum { UDF_STATE_INIT = 0, UDF_STATE_LOADING, UDF_STATE_READY } EUdfState; typedef struct SUdf { char name[TSDB_FUNC_NAME_LEN + 1]; @@ -344,23 +350,24 @@ int32_t udfdLoadSharedLib(char *libPath, uv_lib_t *pLib, const char *funcName[], return 0; } -void udfdInitializePythonPlugin(SUdfScriptPlugin *plugin) { +int32_t udfdInitializePythonPlugin(SUdfScriptPlugin *plugin) { plugin->scriptType = TSDB_FUNC_SCRIPT_PYTHON; - //todo: windows support + // todo: windows support sprintf(plugin->libPath, "%s", "libtaospyudf.so"); plugin->libLoaded = false; - const char *funcName[MAX_NUM_PLUGIN_FUNCS] = {"pyOpen", "pyClose", "pyUdfInit", - "pyUdfDestroy", "pyUdfScalarProc", "pyUdfAggStart", - "pyUdfAggFinish", "pyUdfAggProc", "pyUdfAggMerge"}; - void **funcs[MAX_NUM_PLUGIN_FUNCS] = { + const char *funcName[UDFD_MAX_PLUGIN_FUNCS] = {"pyOpen", "pyClose", "pyUdfInit", + "pyUdfDestroy", "pyUdfScalarProc", "pyUdfAggStart", + "pyUdfAggFinish", "pyUdfAggProc", "pyUdfAggMerge"}; + void **funcs[UDFD_MAX_PLUGIN_FUNCS] = { (void **)&plugin->openFunc, (void **)&plugin->closeFunc, (void **)&plugin->udfInitFunc, (void **)&plugin->udfDestroyFunc, (void **)&plugin->udfScalarProcFunc, (void **)&plugin->udfAggStartFunc, (void **)&plugin->udfAggFinishFunc, (void **)&plugin->udfAggProcFunc, (void **)&plugin->udfAggMergeFunc}; - int32_t err = udfdLoadSharedLib(plugin->libPath, &plugin->lib, funcName, funcs, MAX_NUM_PLUGIN_FUNCS); + int32_t err = udfdLoadSharedLib(plugin->libPath, &plugin->lib, funcName, funcs, UDFD_MAX_PLUGIN_FUNCS); if (err != 0) { fnError("can not load python plugin. lib path %s", plugin->libPath); - return; + return err; } + if (plugin->openFunc) { int16_t lenPythonPath = strlen(tsUdfdLdLibPath) + strlen(tsTempDir) + 1 + 1; // tsTempDir:tsUdfdLdLibPath char *pythonPath = taosMemoryMalloc(lenPythonPath); @@ -369,12 +376,18 @@ void udfdInitializePythonPlugin(SUdfScriptPlugin *plugin) { #else snprintf(pythonPath, lenPythonPath, "%s:%s", tsTempDir, tsUdfdLdLibPath); #endif - SScriptUdfEnvItem items[] = {{"PYTHONPATH", pythonPath}}; - plugin->openFunc(items, 1); + SScriptUdfEnvItem items[] = {{"PYTHONPATH", pythonPath}, {"LOGDIR", tsLogDir}}; + err = plugin->openFunc(items, 2); taosMemoryFree(pythonPath); } + if (err != 0) { + fnError("udf script python plugin open func failed. error: %d", err); + uv_dlclose(&plugin->lib); + return err; + } plugin->libLoaded = true; - return; + + return 0; } void udfdDeinitCPlugin(SUdfScriptPlugin *plugin) { @@ -412,30 +425,44 @@ void udfdDeinitPythonPlugin(SUdfScriptPlugin *plugin) { plugin->udfAggFinishFunc = NULL; } -void udfdInitScriptPlugins() { - SUdfScriptPlugin *plugin = NULL; +int32_t udfdInitScriptPlugin(int8_t scriptType) { + SUdfScriptPlugin *plugin = taosMemoryCalloc(1, sizeof(SUdfScriptPlugin)); - // Initialize c plugin - plugin = taosMemoryCalloc(1, sizeof(SUdfScriptPlugin)); - udfdInitializeCPlugin(plugin); - global.scriptPlugins[TSDB_FUNC_SCRIPT_BIN_LIB] = plugin; + switch (scriptType) { + case TSDB_FUNC_SCRIPT_BIN_LIB: + udfdInitializeCPlugin(plugin); + break; + case TSDB_FUNC_SCRIPT_PYTHON: { + int32_t err = udfdInitializePythonPlugin(plugin); + if (err != 0) { + taosMemoryFree(plugin); + return err; + } + break; + } + default: + fnError("udf script type %d not supported", scriptType); + taosMemoryFree(plugin); + return TSDB_CODE_UDF_SCRIPT_NOT_SUPPORTED; + } - // Initialize python plugin - plugin = taosMemoryCalloc(1, sizeof(SUdfScriptPlugin)); - udfdInitializePythonPlugin(plugin); - global.scriptPlugins[TSDB_FUNC_SCRIPT_PYTHON] = plugin; - return; + global.scriptPlugins[scriptType] = plugin; + return TSDB_CODE_SUCCESS; } void udfdDeinitScriptPlugins() { SUdfScriptPlugin *plugin = NULL; plugin = global.scriptPlugins[TSDB_FUNC_SCRIPT_PYTHON]; - udfdDeinitPythonPlugin(plugin); - taosMemoryFree(plugin); + if (plugin != NULL) { + udfdDeinitPythonPlugin(plugin); + taosMemoryFree(plugin); + } plugin = global.scriptPlugins[TSDB_FUNC_SCRIPT_BIN_LIB]; - udfdDeinitCPlugin(plugin); - taosMemoryFree(plugin); + if (plugin != NULL) { + udfdDeinitCPlugin(plugin); + taosMemoryFree(plugin); + } return; } @@ -478,6 +505,22 @@ void convertUdf2UdfInfo(SUdf *udf, SScriptUdfInfo *udfInfo) { udfInfo->scriptType = udf->scriptType; } +int32_t udfdRenameUdfFile(SUdf *udf) { + char newPath[PATH_MAX]; + if (udf->scriptType == TSDB_FUNC_SCRIPT_BIN_LIB) { + snprintf(newPath, PATH_MAX, "%s/lib%s.so", tsTempDir, udf->name); + } else if (udf->scriptType == TSDB_FUNC_SCRIPT_PYTHON) { + snprintf(newPath, PATH_MAX, "%s/%s.py", tsTempDir, udf->name); + } else { + return TSDB_CODE_UDF_SCRIPT_NOT_SUPPORTED; + } + int32_t code = taosRenameFile(udf->path, newPath); + if (code == 0) { + sprintf(udf->path, "%s", newPath); + } + return 0; +} + int32_t udfdInitUdf(char *udfName, SUdf *udf) { int32_t err = 0; err = udfdFillUdfInfoFromMNode(global.clientRpc, udfName, udf); @@ -485,19 +528,34 @@ int32_t udfdInitUdf(char *udfName, SUdf *udf) { fnError("can not retrieve udf from mnode. udf name %s", udfName); return TSDB_CODE_UDF_LOAD_UDF_FAILURE; } - // TODO: remove script plugins mutex + if (udf->scriptType > UDFD_MAX_SCRIPT_TYPE) { + fnError("udf name %s script type %d not supported", udfName, udf->scriptType); + return TSDB_CODE_UDF_SCRIPT_NOT_SUPPORTED; + } + uv_mutex_lock(&global.scriptPluginsMutex); SUdfScriptPlugin *scriptPlugin = global.scriptPlugins[udf->scriptType]; if (scriptPlugin == NULL) { - fnError("udf name %s script type %d not supported", udfName, udf->scriptType); - uv_mutex_unlock(&global.scriptPluginsMutex); - return TSDB_CODE_UDF_SCRIPT_NOT_SUPPORTED; + err = udfdInitScriptPlugin(udf->scriptType); + if (err != 0) { + uv_mutex_unlock(&global.scriptPluginsMutex); + return err; + } } uv_mutex_unlock(&global.scriptPluginsMutex); - udf->scriptPlugin = scriptPlugin; + udf->scriptPlugin = global.scriptPlugins[udf->scriptType]; + + udfdRenameUdfFile(udf); + SScriptUdfInfo info = {0}; convertUdf2UdfInfo(udf, &info); - udf->scriptPlugin->udfInitFunc(&info, &udf->scriptUdfCtx); + err = udf->scriptPlugin->udfInitFunc(&info, &udf->scriptUdfCtx); + if (err != 0) { + fnError("udf name %s init failed. error %d", udfName, err); + return err; + } + + fnInfo("udf init succeeded. name %s type %d context %p", udf->name, udf->scriptType, (void*)udf->scriptUdfCtx); return 0; } @@ -519,6 +577,14 @@ SUdf *udfdGetOrCreateUdf(const char *udfName) { uv_cond_init(&udfNew->condReady); udf = udfNew; + udf->resident = false; + for (int32_t i = 0; i < taosArrayGetSize(global.residentFuncs); ++i) { + char *funcName = taosArrayGet(global.residentFuncs, i); + if (strcmp(udfName, funcName) == 0) { + udf->resident = true; + break; + } + } SUdf **pUdf = &udf; taosHashPut(global.udfsHash, udfName, strlen(udfName), pUdf, POINTER_BYTES); uv_mutex_unlock(&global.udfsMutex); @@ -540,20 +606,15 @@ void udfdProcessSetupRequest(SUvUdfWork *uvUdf, SUdfRequest *request) { if (udf->state == UDF_STATE_INIT) { udf->state = UDF_STATE_LOADING; code = udfdInitUdf(setup->udfName, udf); - - udf->resident = false; - for (int32_t i = 0; i < taosArrayGetSize(global.residentFuncs); ++i) { - char *funcName = taosArrayGet(global.residentFuncs, i); - if (strcmp(setup->udfName, funcName) == 0) { - udf->resident = true; - break; - } + if (code == 0) { + udf->state = UDF_STATE_READY; + } else { + udf->state = UDF_STATE_INIT; } - udf->state = UDF_STATE_READY; uv_cond_broadcast(&udf->condReady); uv_mutex_unlock(&udf->lock); } else { - while (udf->state != UDF_STATE_READY) { + while (udf->state == UDF_STATE_LOADING) { uv_cond_wait(&udf->condReady, &udf->lock); } uv_mutex_unlock(&udf->lock); @@ -564,10 +625,10 @@ void udfdProcessSetupRequest(SUvUdfWork *uvUdf, SUdfRequest *request) { SUdfResponse rsp; rsp.seqNum = request->seqNum; rsp.type = request->type; - rsp.code = code; + rsp.code = (code != 0) ? TSDB_CODE_UDF_FUNC_EXEC_FAILURE : 0; rsp.setupRsp.udfHandle = (int64_t)(handle); rsp.setupRsp.outputType = udf->outputType; - rsp.setupRsp.outputLen = udf->outputLen; + rsp.setupRsp.bytes = udf->outputLen; rsp.setupRsp.bufSize = udf->bufSize; int32_t len = encodeUdfResponse(NULL, &rsp); @@ -647,7 +708,7 @@ void udfdProcessCallRequest(SUvUdfWork *uvUdf, SUdfRequest *request) { rsp->seqNum = request->seqNum; rsp->type = request->type; - rsp->code = code; + rsp->code = (code != 0) ? TSDB_CODE_UDF_FUNC_EXEC_FAILURE : 0; subRsp->callType = call->callType; int32_t len = encodeUdfResponse(NULL, rsp); @@ -704,9 +765,11 @@ void udfdProcessTeardownRequest(SUvUdfWork *uvUdf, SUdfRequest *request) { } uv_mutex_unlock(&global.udfsMutex); if (unloadUdf) { + fnInfo("udf teardown. udf name: %s type %d: context %p", udf->name, udf->scriptType, (void*)(udf->scriptUdfCtx)); uv_cond_destroy(&udf->condReady); uv_mutex_destroy(&udf->lock); - udf->scriptPlugin->udfDestroyFunc(udf->scriptUdfCtx); + code = udf->scriptPlugin->udfDestroyFunc(udf->scriptUdfCtx); + fnDebug("udfd destroy function returns %d", code); taosMemoryFree(udf); } taosMemoryFree(handle); @@ -1298,9 +1361,11 @@ int32_t udfdDeinitResidentFuncs() { char *funcName = taosArrayGet(global.residentFuncs, i); SUdf **udfInHash = taosHashGet(global.udfsHash, funcName, strlen(funcName)); if (udfInHash) { - SUdf *udf = *udfInHash; - udf->scriptPlugin->udfDestroyFunc(udf->scriptUdfCtx); + SUdf *udf = *udfInHash; + int32_t code = udf->scriptPlugin->udfDestroyFunc(udf->scriptUdfCtx); + fnDebug("udfd destroy function returns %d", code); taosHashRemove(global.udfsHash, funcName, strlen(funcName)); + taosMemoryFree(udf); } } taosArrayDestroy(global.residentFuncs); @@ -1350,8 +1415,6 @@ int main(int argc, char *argv[]) { return -5; } - udfdInitScriptPlugins(); - udfdInitResidentFuncs(); uv_thread_t mnodeConnectThread; diff --git a/source/libs/function/test/udf1.c b/source/libs/function/test/udf1.c index a395fc99a9a5622a3487c7de9cf04ea8c11f30d2..7798a0bf3d957c03240a1f22914a54d0fdcf5b30 100644 --- a/source/libs/function/test/udf1.c +++ b/source/libs/function/test/udf1.c @@ -14,10 +14,8 @@ DLL_EXPORT int32_t udf1_init() { return 0; } DLL_EXPORT int32_t udf1_destroy() { return 0; } DLL_EXPORT int32_t udf1(SUdfDataBlock *block, SUdfColumn *resultCol) { - SUdfColumnData *resultData = &resultCol->colData; - resultData->numOfRows = block->numOfRows; - for (int32_t i = 0; i < resultData->numOfRows; ++i) { + for (int32_t i = 0; i < block->numOfRows; ++i) { int j = 0; for (; j < block->numOfCols; ++j) { if (udfColDataIsNull(block->udfCols[j], i)) { @@ -37,5 +35,6 @@ DLL_EXPORT int32_t udf1(SUdfDataBlock *block, SUdfColumn *resultCol) { #ifdef WINDOWS Sleep(1); #endif + resultData->numOfRows = block->numOfRows; return 0; -} \ No newline at end of file +} diff --git a/source/libs/nodes/src/nodesUtilFuncs.c b/source/libs/nodes/src/nodesUtilFuncs.c index 024130b5f8eb0689f86fb12e968f54189c5f4dfc..8d6c3288b907e0ee8678f1d6970410bec351b758 100644 --- a/source/libs/nodes/src/nodesUtilFuncs.c +++ b/source/libs/nodes/src/nodesUtilFuncs.c @@ -963,8 +963,6 @@ void nodesDestroyNode(SNode* pNode) { case QUERY_NODE_SHOW_USERS_STMT: case QUERY_NODE_SHOW_LICENCES_STMT: case QUERY_NODE_SHOW_VGROUPS_STMT: - case QUERY_NODE_SHOW_DB_ALIVE_STMT: - case QUERY_NODE_SHOW_CLUSTER_ALIVE_STMT: case QUERY_NODE_SHOW_TOPICS_STMT: case QUERY_NODE_SHOW_CONSUMERS_STMT: case QUERY_NODE_SHOW_CONNECTIONS_STMT: @@ -1464,7 +1462,7 @@ SListCell* nodesListErase(SNodeList* pList, SListCell* pCell) { } void nodesListInsertList(SNodeList* pTarget, SListCell* pPos, SNodeList* pSrc) { - if (NULL == pTarget || NULL == pPos || NULL == pSrc) { + if (NULL == pTarget || NULL == pPos || NULL == pSrc || NULL == pSrc->pHead) { return; } diff --git a/source/libs/parser/inc/parAst.h b/source/libs/parser/inc/parAst.h index 6d36660261fb971704daf0324d59317bb62c6b4e..10d4adf17db22e4a8068a9c702cd1fda933ec6b3 100644 --- a/source/libs/parser/inc/parAst.h +++ b/source/libs/parser/inc/parAst.h @@ -151,7 +151,7 @@ SNode* createDropDatabaseStmt(SAstCreateContext* pCxt, bool ignoreNotExists, STo SNode* createAlterDatabaseStmt(SAstCreateContext* pCxt, SToken* pDbName, SNode* pOptions); SNode* createFlushDatabaseStmt(SAstCreateContext* pCxt, SToken* pDbName); SNode* createTrimDatabaseStmt(SAstCreateContext* pCxt, SToken* pDbName, int32_t maxSpeed); -SNode* createCompactStmt(SAstCreateContext* pCxt, SToken* pDbName); +SNode* createCompactStmt(SAstCreateContext* pCxt, SToken* pDbName, SNode* pStart, SNode* pEnd); SNode* createDefaultTableOptions(SAstCreateContext* pCxt); SNode* createAlterTableOptions(SAstCreateContext* pCxt); SNode* setTableOption(SAstCreateContext* pCxt, SNode* pOptions, ETableOptionType type, void* pVal); @@ -215,6 +215,8 @@ SNode* createCreateFunctionStmt(SAstCreateContext* pCxt, bool ignoreExists, bool const SToken* pLibPath, SDataType dataType, int32_t bufSize, const SToken* pLanguage); SNode* createDropFunctionStmt(SAstCreateContext* pCxt, bool ignoreNotExists, const SToken* pFuncName); SNode* createStreamOptions(SAstCreateContext* pCxt); +SNode* setStreamOptions(SAstCreateContext* pCxt, SNode* pOptions, EStreamOptionsSetFlag setflag, SToken* pToken, + SNode* pNode); SNode* createCreateStreamStmt(SAstCreateContext* pCxt, bool ignoreExists, SToken* pStreamName, SNode* pRealTable, SNode* pOptions, SNodeList* pTags, SNode* pSubtable, SNode* pQuery, SNodeList* pCols); SNode* createDropStreamStmt(SAstCreateContext* pCxt, bool ignoreNotExists, SToken* pStreamName); diff --git a/source/libs/parser/inc/sql.y b/source/libs/parser/inc/sql.y index c1dafef085ba146becfc1fcaa99d471cbb2ea3fd..72a0a70e36da076de10c0939c5560a68c7f9cbdd 100644 --- a/source/libs/parser/inc/sql.y +++ b/source/libs/parser/inc/sql.y @@ -167,7 +167,7 @@ cmd ::= USE db_name(A). cmd ::= ALTER DATABASE db_name(A) alter_db_options(B). { pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &A, B); } cmd ::= FLUSH DATABASE db_name(A). { pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &A); } cmd ::= TRIM DATABASE db_name(A) speed_opt(B). { pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &A, B); } -cmd ::= COMPACT DATABASE db_name(A). { pCxt->pRootNode = createCompactStmt(pCxt, &A); } +cmd ::= COMPACT DATABASE db_name(A) start_opt(B) end_opt(C). { pCxt->pRootNode = createCompactStmt(pCxt, &A, B, C); } %type not_exists_opt { bool } %destructor not_exists_opt { } @@ -236,6 +236,7 @@ alter_db_option(A) ::= REPLICA NK_INTEGER(B). //alter_db_option(A) ::= STRICT NK_STRING(B). { A.type = DB_OPTION_STRICT; A.val = B; } alter_db_option(A) ::= WAL_LEVEL NK_INTEGER(B). { A.type = DB_OPTION_WAL; A.val = B; } alter_db_option(A) ::= STT_TRIGGER NK_INTEGER(B). { A.type = DB_OPTION_STT_TRIGGER; A.val = B; } +alter_db_option(A) ::= MINROWS NK_INTEGER(B). { A.type = DB_OPTION_MINROWS; A.val = B; } %type integer_list { SNodeList* } %destructor integer_list { nodesDestroyList($$); } @@ -259,6 +260,16 @@ retention(A) ::= NK_VARIABLE(B) NK_COLON NK_VARIABLE(C). speed_opt(A) ::= . { A = 0; } speed_opt(A) ::= MAX_SPEED NK_INTEGER(B). { A = taosStr2Int32(B.z, NULL, 10); } +start_opt(A) ::= . { A = NULL; } +start_opt(A) ::= START WITH NK_INTEGER(B). { A = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &B); } +start_opt(A) ::= START WITH NK_STRING(B). { A = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &B); } +start_opt(A) ::= START WITH TIMESTAMP NK_STRING(B). { A = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &B); } + +end_opt(A) ::= . { A = NULL; } +end_opt(A) ::= END WITH NK_INTEGER(B). { A = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &B); } +end_opt(A) ::= END WITH NK_STRING(B). { A = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &B); } +end_opt(A) ::= END WITH TIMESTAMP NK_STRING(B). { A = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &B); } + /************************************************ create/drop table/stable ********************************************/ cmd ::= CREATE TABLE not_exists_opt(A) full_table_name(B) NK_LP column_def_list(C) NK_RP tags_def_opt(D) table_options(E). { pCxt->pRootNode = createCreateTableStmt(pCxt, A, B, C, D, E); } @@ -567,14 +578,14 @@ tag_def_or_ref_opt(A) ::= tags_def(B). tag_def_or_ref_opt(A) ::= TAGS NK_LP col_name_list(B) NK_RP. { A = B; } stream_options(A) ::= . { A = createStreamOptions(pCxt); } -stream_options(A) ::= stream_options(B) TRIGGER AT_ONCE. { ((SStreamOptions*)B)->triggerType = STREAM_TRIGGER_AT_ONCE; A = B; } -stream_options(A) ::= stream_options(B) TRIGGER WINDOW_CLOSE. { ((SStreamOptions*)B)->triggerType = STREAM_TRIGGER_WINDOW_CLOSE; A = B; } -stream_options(A) ::= stream_options(B) TRIGGER MAX_DELAY duration_literal(C). { ((SStreamOptions*)B)->triggerType = STREAM_TRIGGER_MAX_DELAY; ((SStreamOptions*)B)->pDelay = releaseRawExprNode(pCxt, C); A = B; } -stream_options(A) ::= stream_options(B) WATERMARK duration_literal(C). { ((SStreamOptions*)B)->pWatermark = releaseRawExprNode(pCxt, C); A = B; } -stream_options(A) ::= stream_options(B) IGNORE EXPIRED NK_INTEGER(C). { ((SStreamOptions*)B)->ignoreExpired = taosStr2Int8(C.z, NULL, 10); A = B; } -stream_options(A) ::= stream_options(B) FILL_HISTORY NK_INTEGER(C). { ((SStreamOptions*)B)->fillHistory = taosStr2Int8(C.z, NULL, 10); A = B; } -stream_options(A) ::= stream_options(B) DELETE_MARK duration_literal(C). { ((SStreamOptions*)B)->pDeleteMark = releaseRawExprNode(pCxt, C); A = B; } -stream_options(A) ::= stream_options(B) IGNORE UPDATE NK_INTEGER(C). { ((SStreamOptions*)B)->ignoreUpdate = taosStr2Int8(C.z, NULL, 10); A = B; } +stream_options(A) ::= stream_options(B) TRIGGER AT_ONCE(C). { A = setStreamOptions(pCxt, B, SOPT_TRIGGER_TYPE_SET, &C, NULL); } +stream_options(A) ::= stream_options(B) TRIGGER WINDOW_CLOSE(C). { A = setStreamOptions(pCxt, B, SOPT_TRIGGER_TYPE_SET, &C, NULL); } +stream_options(A) ::= stream_options(B) TRIGGER MAX_DELAY(C) duration_literal(D). { A = setStreamOptions(pCxt, B, SOPT_TRIGGER_TYPE_SET, &C, releaseRawExprNode(pCxt, D)); } +stream_options(A) ::= stream_options(B) WATERMARK duration_literal(C). { A = setStreamOptions(pCxt, B, SOPT_WATERMARK_SET, NULL, releaseRawExprNode(pCxt, C)); } +stream_options(A) ::= stream_options(B) IGNORE EXPIRED NK_INTEGER(C). { A = setStreamOptions(pCxt, B, SOPT_IGNORE_EXPIRED_SET, &C, NULL); } +stream_options(A) ::= stream_options(B) FILL_HISTORY NK_INTEGER(C). { A = setStreamOptions(pCxt, B, SOPT_FILL_HISTORY_SET, &C, NULL); } +stream_options(A) ::= stream_options(B) DELETE_MARK duration_literal(C). { A = setStreamOptions(pCxt, B, SOPT_DELETE_MARK_SET, NULL, releaseRawExprNode(pCxt, C)); } +stream_options(A) ::= stream_options(B) IGNORE UPDATE NK_INTEGER(C). { A = setStreamOptions(pCxt, B, SOPT_IGNORE_UPDATE_SET, &C, NULL); } subtable_opt(A) ::= . { A = NULL; } subtable_opt(A) ::= SUBTABLE NK_LP expression(B) NK_RP. { A = releaseRawExprNode(pCxt, B); } diff --git a/source/libs/parser/src/parAstCreater.c b/source/libs/parser/src/parAstCreater.c index bb94e94cbace30a451aada5c98370551de55a778..a761b7a7b08decfefd3c2bfd6c8c974afce0945c 100644 --- a/source/libs/parser/src/parAstCreater.c +++ b/source/libs/parser/src/parAstCreater.c @@ -1105,7 +1105,7 @@ SNode* createTrimDatabaseStmt(SAstCreateContext* pCxt, SToken* pDbName, int32_t return (SNode*)pStmt; } -SNode* createCompactStmt(SAstCreateContext* pCxt, SToken* pDbName) { +SNode* createCompactStmt(SAstCreateContext* pCxt, SToken* pDbName, SNode* pStart, SNode* pEnd) { CHECK_PARSER_STATUS(pCxt); if (!checkDbName(pCxt, pDbName, false)) { return NULL; @@ -1113,6 +1113,8 @@ SNode* createCompactStmt(SAstCreateContext* pCxt, SToken* pDbName) { SCompactDatabaseStmt* pStmt = (SCompactDatabaseStmt*)nodesMakeNode(QUERY_NODE_COMPACT_DATABASE_STMT); CHECK_OUT_OF_MEM(pStmt); COPY_STRING_FORM_ID_TOKEN(pStmt->dbName, pDbName); + pStmt->pStart = pStart; + pStmt->pEnd = pEnd; return (SNode*)pStmt; } @@ -1827,13 +1829,66 @@ SNode* createStreamOptions(SAstCreateContext* pCxt) { CHECK_PARSER_STATUS(pCxt); SStreamOptions* pOptions = (SStreamOptions*)nodesMakeNode(QUERY_NODE_STREAM_OPTIONS); CHECK_OUT_OF_MEM(pOptions); - pOptions->triggerType = STREAM_TRIGGER_AT_ONCE; + pOptions->triggerType = STREAM_TRIGGER_WINDOW_CLOSE; pOptions->fillHistory = STREAM_DEFAULT_FILL_HISTORY; pOptions->ignoreExpired = STREAM_DEFAULT_IGNORE_EXPIRED; pOptions->ignoreUpdate = STREAM_DEFAULT_IGNORE_UPDATE; return (SNode*)pOptions; } +static int8_t getTriggerType(uint32_t tokenType) { + switch (tokenType) { + case TK_AT_ONCE: + return STREAM_TRIGGER_AT_ONCE; + case TK_WINDOW_CLOSE: + return STREAM_TRIGGER_WINDOW_CLOSE; + case TK_MAX_DELAY: + return STREAM_TRIGGER_MAX_DELAY; + default: + break; + } + return STREAM_TRIGGER_WINDOW_CLOSE; +} + +SNode* setStreamOptions(SAstCreateContext* pCxt, SNode* pOptions, EStreamOptionsSetFlag setflag, SToken* pToken, + SNode* pNode) { + SStreamOptions* pStreamOptions = (SStreamOptions*)pOptions; + if (BIT_FLAG_TEST_MASK(setflag, pStreamOptions->setFlag)) { + pCxt->errCode = + generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_SYNTAX_ERROR, "stream options each item is only set once"); + return pOptions; + } + + switch (setflag) { + case SOPT_TRIGGER_TYPE_SET: + pStreamOptions->triggerType = getTriggerType(pToken->type); + if (STREAM_TRIGGER_MAX_DELAY == pStreamOptions->triggerType) { + pStreamOptions->pDelay = pNode; + } + break; + case SOPT_WATERMARK_SET: + pStreamOptions->pWatermark = pNode; + break; + case SOPT_DELETE_MARK_SET: + pStreamOptions->pDeleteMark = pNode; + break; + case SOPT_FILL_HISTORY_SET: + pStreamOptions->fillHistory = taosStr2Int8(pToken->z, NULL, 10); + break; + case SOPT_IGNORE_EXPIRED_SET: + pStreamOptions->ignoreExpired = taosStr2Int8(pToken->z, NULL, 10); + break; + case SOPT_IGNORE_UPDATE_SET: + pStreamOptions->ignoreUpdate = taosStr2Int8(pToken->z, NULL, 10); + break; + default: + break; + } + BIT_FLAG_SET_MASK(pStreamOptions->setFlag, setflag); + + return pOptions; +} + SNode* createCreateStreamStmt(SAstCreateContext* pCxt, bool ignoreExists, SToken* pStreamName, SNode* pRealTable, SNode* pOptions, SNodeList* pTags, SNode* pSubtable, SNode* pQuery, SNodeList* pCols) { CHECK_PARSER_STATUS(pCxt); diff --git a/source/libs/parser/src/parAstParser.c b/source/libs/parser/src/parAstParser.c index 126027c78f0629cf5490cce490cc819fa4e2984f..cd4b455e025c3ff67bd22fddbc6e44936a35fbc3 100644 --- a/source/libs/parser/src/parAstParser.c +++ b/source/libs/parser/src/parAstParser.c @@ -166,7 +166,8 @@ static int32_t collectMetaKeyFromRealTableImpl(SCollectMetaKeyCxt* pCxt, const c code = reserveDnodeRequiredInCache(pCxt->pMetaCache); } if (TSDB_CODE_SUCCESS == code && - (0 == strcmp(pTable, TSDB_INS_TABLE_TAGS) || 0 == strcmp(pTable, TSDB_INS_TABLE_TABLES) || 0 == strcmp(pTable, TSDB_INS_TABLE_COLS)) && + (0 == strcmp(pTable, TSDB_INS_TABLE_TAGS) || 0 == strcmp(pTable, TSDB_INS_TABLE_TABLES) || + 0 == strcmp(pTable, TSDB_INS_TABLE_COLS)) && QUERY_NODE_SELECT_STMT == nodeType(pCxt->pStmt)) { code = collectMetaKeyFromInsTags(pCxt); } @@ -605,6 +606,10 @@ static int32_t collectMetaKeyFromShowSubscriptions(SCollectMetaKeyCxt* pCxt, SSh pCxt->pMetaCache); } +static int32_t collectMetaKeyFromCompactDatabase(SCollectMetaKeyCxt* pCxt, SCompactDatabaseStmt* pStmt) { + return reserveDbCfgInCache(pCxt->pParseCxt->acctId, pStmt->dbName, pCxt->pMetaCache); +} + static int32_t collectMetaKeyFromQuery(SCollectMetaKeyCxt* pCxt, SNode* pStmt) { pCxt->pStmt = pStmt; switch (nodeType(pStmt)) { @@ -636,6 +641,8 @@ static int32_t collectMetaKeyFromQuery(SCollectMetaKeyCxt* pCxt, SNode* pStmt) { return collectMetaKeyFromExplain(pCxt, (SExplainStmt*)pStmt); case QUERY_NODE_DESCRIBE_STMT: return collectMetaKeyFromDescribe(pCxt, (SDescribeStmt*)pStmt); + case QUERY_NODE_COMPACT_DATABASE_STMT: + return collectMetaKeyFromCompactDatabase(pCxt, (SCompactDatabaseStmt*)pStmt); case QUERY_NODE_CREATE_STREAM_STMT: return collectMetaKeyFromCreateStream(pCxt, (SCreateStreamStmt*)pStmt); case QUERY_NODE_SHOW_DNODES_STMT: diff --git a/source/libs/parser/src/parCalcConst.c b/source/libs/parser/src/parCalcConst.c index d4f4949df06a79d7b67806d2c3bb760a45695d2a..b2fc88add1506336869dce1c33c19ff9e077a4d2 100644 --- a/source/libs/parser/src/parCalcConst.c +++ b/source/libs/parser/src/parCalcConst.c @@ -320,6 +320,79 @@ static int32_t calcConstInsert(SCalcConstContext* pCxt, SInsertStmt* pInsert) { return code; } +static SNodeList* getChildProjection(SNode* pStmt) { + switch (nodeType(pStmt)) { + case QUERY_NODE_SELECT_STMT: + return ((SSelectStmt*)pStmt)->pProjectionList; + case QUERY_NODE_SET_OPERATOR: + return ((SSetOperator*)pStmt)->pProjectionList; + default: + break; + } + return NULL; +} + +static void eraseSetOpChildProjection(SSetOperator* pSetOp, int32_t index) { + SNodeList* pLeftProjs = getChildProjection(pSetOp->pLeft); + nodesListErase(pLeftProjs, nodesListGetCell(pLeftProjs, index)); + SNodeList* pRightProjs = getChildProjection(pSetOp->pRight); + nodesListErase(pRightProjs, nodesListGetCell(pRightProjs, index)); +} + +typedef struct SNotRefByOrderByCxt { + SColumnNode* pCol; + bool hasThisCol; +} SNotRefByOrderByCxt; + +static EDealRes notRefByOrderByImpl(SNode* pNode, void* pContext) { + if (QUERY_NODE_COLUMN == nodeType(pNode)) { + SNotRefByOrderByCxt* pCxt = (SNotRefByOrderByCxt*)pContext; + if (nodesEqualNode((SNode*)pCxt->pCol, pNode)) { + pCxt->hasThisCol = true; + return DEAL_RES_END; + } + } + return DEAL_RES_CONTINUE; +} + +static bool notRefByOrderBy(SColumnNode* pCol, SNodeList* pOrderByList) { + SNotRefByOrderByCxt cxt = {.pCol = pCol, .hasThisCol = false}; + nodesWalkExprs(pOrderByList, notRefByOrderByImpl, &cxt); + return !cxt.hasThisCol; +} + +static int32_t calcConstSetOpProjections(SCalcConstContext* pCxt, SSetOperator* pSetOp, bool subquery) { + int32_t index = 0; + SNode* pProj = NULL; + WHERE_EACH(pProj, pSetOp->pProjectionList) { + if (subquery && notRefByOrderBy((SColumnNode*)pProj, pSetOp->pOrderByList) && isUselessCol((SExprNode*)pProj)) { + ERASE_NODE(pSetOp->pProjectionList); + eraseSetOpChildProjection(pSetOp, index); + continue; + } + ++index; + WHERE_NEXT; + } + if (0 == LIST_LENGTH(pSetOp->pProjectionList)) { + return nodesListStrictAppend(pSetOp->pProjectionList, createConstantValue()); + } + return TSDB_CODE_SUCCESS; +} + +static int32_t calcConstSetOperator(SCalcConstContext* pCxt, SSetOperator* pSetOp, bool subquery) { + int32_t code = calcConstSetOpProjections(pCxt, pSetOp, subquery); + if (TSDB_CODE_SUCCESS == code) { + code = calcConstQuery(pCxt, pSetOp->pLeft, false); + } + if (TSDB_CODE_SUCCESS == code) { + code = calcConstQuery(pCxt, pSetOp->pRight, false); + } + if (TSDB_CODE_SUCCESS == code) { + code = calcConstList(pSetOp->pOrderByList); + } + return code; +} + static int32_t calcConstQuery(SCalcConstContext* pCxt, SNode* pStmt, bool subquery) { int32_t code = TSDB_CODE_SUCCESS; switch (nodeType(pStmt)) { @@ -330,11 +403,7 @@ static int32_t calcConstQuery(SCalcConstContext* pCxt, SNode* pStmt, bool subque code = calcConstQuery(pCxt, ((SExplainStmt*)pStmt)->pQuery, subquery); break; case QUERY_NODE_SET_OPERATOR: { - SSetOperator* pSetOp = (SSetOperator*)pStmt; - code = calcConstQuery(pCxt, pSetOp->pLeft, false); - if (TSDB_CODE_SUCCESS == code) { - code = calcConstQuery(pCxt, pSetOp->pRight, false); - } + code = calcConstSetOperator(pCxt, (SSetOperator*)pStmt, subquery); break; } case QUERY_NODE_DELETE_STMT: diff --git a/source/libs/parser/src/parInsertSml.c b/source/libs/parser/src/parInsertSml.c index 4742921d083257b56d7095d0e8aca8fe705900c2..d6c107266950f0c21885f66f3ba4267c191b14f1 100644 --- a/source/libs/parser/src/parInsertSml.c +++ b/source/libs/parser/src/parInsertSml.c @@ -201,6 +201,7 @@ int32_t smlBuildCol(STableDataCxt* pTableCxt, SSchema* schema, void* data, int32 SSmlKv* kv = (SSmlKv*)data; if(kv->keyLen != strlen(pColSchema->name) || memcmp(kv->key, pColSchema->name, kv->keyLen) != 0 || kv->type != pColSchema->type){ ret = TSDB_CODE_SML_INVALID_DATA; + uError("SML smlBuildCol error col not same %s", pColSchema->name); goto end; } if (kv->type == TSDB_DATA_TYPE_NCHAR) { diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index c3816fa854edf9017dae1b4eefe67c4ab8c65a38..74b32c638dded2135e7eff8ff0527801ac8934a8 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -1211,7 +1211,8 @@ static EDealRes translateValueImpl(STranslateContext* pCxt, SValueNode* pVal, SD } else { res = translateNormalValue(pCxt, pVal, targetDt, strict); } - pVal->node.resType = targetDt; + pVal->node.resType.type = targetDt.type; + pVal->node.resType.bytes = targetDt.bytes; pVal->node.resType.scale = pVal->unit; pVal->translate = true; if (!strict && TSDB_DATA_TYPE_UBIGINT == pVal->node.resType.type && pVal->datum.u <= INT64_MAX) { @@ -2499,6 +2500,11 @@ static int32_t translateTable(STranslateContext* pCxt, SNode* pTable) { STempTableNode* pTempTable = (STempTableNode*)pTable; code = translateSubquery(pCxt, pTempTable->pSubquery); if (TSDB_CODE_SUCCESS == code) { + if (QUERY_NODE_SELECT_STMT == nodeType(pTempTable->pSubquery) && + ((SSelectStmt*)pTempTable->pSubquery)->isEmptyResult && isSelectStmt(pCxt->pCurrStmt)) { + ((SSelectStmt*)pCxt->pCurrStmt)->isEmptyResult = true; + } + pTempTable->table.precision = getStmtPrecision(pTempTable->pSubquery); pTempTable->table.singleTable = stmtIsSingleTable(pTempTable->pSubquery); code = addNamespace(pCxt, pTempTable); @@ -2796,6 +2802,10 @@ static int32_t translateOrderBy(STranslateContext* pCxt, SSelectStmt* pSelect) { bool other; int32_t code = translateOrderByPosition(pCxt, pSelect->pProjectionList, pSelect->pOrderByList, &other); if (TSDB_CODE_SUCCESS == code) { + if (0 == LIST_LENGTH(pSelect->pOrderByList)) { + NODES_DESTORY_LIST(pSelect->pOrderByList); + return TSDB_CODE_SUCCESS; + } if (!other) { return TSDB_CODE_SUCCESS; } @@ -2924,6 +2934,9 @@ static int32_t translateSelectList(STranslateContext* pCxt, SSelectStmt* pSelect if (TSDB_CODE_SUCCESS == code) { code = translateFillValues(pCxt, pSelect); } + if (NULL == pSelect->pProjectionList || 0 >= pSelect->pProjectionList->length) { + code = TSDB_CODE_PAR_INVALID_SELECTED_EXPR; + } return code; } @@ -4240,6 +4253,7 @@ static void buildAlterDbReq(STranslateContext* pCxt, SAlterDatabaseStmt* pStmt, pReq->cacheLastSize = pStmt->pOptions->cacheLastSize; pReq->replications = pStmt->pOptions->replica; pReq->sstTrigger = pStmt->pOptions->sstTrigger; + pReq->minRows = pStmt->pOptions->minRowsPerBlock; return; } @@ -5559,7 +5573,8 @@ static int32_t checkCreateTopic(STranslateContext* pCxt, SCreateTopicStmt* pStmt if (QUERY_NODE_SELECT_STMT == nodeType(pStmt->pQuery)) { SSelectStmt* pSelect = (SSelectStmt*)pStmt->pQuery; - if (!pSelect->isDistinct && QUERY_NODE_REAL_TABLE == nodeType(pSelect->pFromTable) && + if (!pSelect->isDistinct && + (NULL != pSelect->pFromTable && QUERY_NODE_REAL_TABLE == nodeType(pSelect->pFromTable)) && NULL == pSelect->pGroupByList && NULL == pSelect->pLimit && NULL == pSelect->pSlimit && NULL == pSelect->pOrderByList && NULL == pSelect->pPartitionByList) { return TSDB_CODE_SUCCESS; @@ -5621,12 +5636,36 @@ static int32_t translateDescribe(STranslateContext* pCxt, SDescribeStmt* pStmt) return refreshGetTableMeta(pCxt, pStmt->dbName, pStmt->tableName, &pStmt->pMeta); } +static int32_t translateCompactRange(STranslateContext* pCxt, SCompactDatabaseStmt* pStmt, SCompactDbReq* pReq) { + SDbCfgInfo dbCfg = {0}; + int32_t code = getDBCfg(pCxt, pStmt->dbName, &dbCfg); + if (TSDB_CODE_SUCCESS == code && NULL != pStmt->pStart) { + ((SValueNode*)pStmt->pStart)->node.resType.precision = dbCfg.precision; + ((SValueNode*)pStmt->pStart)->node.resType.type = TSDB_DATA_TYPE_TIMESTAMP; + code = doTranslateValue(pCxt, (SValueNode*)pStmt->pStart); + } + if (TSDB_CODE_SUCCESS == code && NULL != pStmt->pEnd) { + ((SValueNode*)pStmt->pEnd)->node.resType.precision = dbCfg.precision; + ((SValueNode*)pStmt->pEnd)->node.resType.type = TSDB_DATA_TYPE_TIMESTAMP; + code = doTranslateValue(pCxt, (SValueNode*)pStmt->pEnd); + } + if (TSDB_CODE_SUCCESS == code) { + pReq->timeRange.skey = NULL != pStmt->pStart ? ((SValueNode*)pStmt->pStart)->datum.i : INT64_MIN; + pReq->timeRange.ekey = NULL != pStmt->pEnd ? ((SValueNode*)pStmt->pEnd)->datum.i : INT64_MAX; + } + return code; +} + static int32_t translateCompact(STranslateContext* pCxt, SCompactDatabaseStmt* pStmt) { SCompactDbReq compactReq = {0}; SName name; tNameSetDbName(&name, pCxt->pParseCxt->acctId, pStmt->dbName, strlen(pStmt->dbName)); tNameGetFullDbName(&name, compactReq.db); - return buildCmdMsg(pCxt, TDMT_MND_COMPACT_DB, (FSerializeFunc)tSerializeSCompactDbReq, &compactReq); + int32_t code = translateCompactRange(pCxt, pStmt, &compactReq); + if (TSDB_CODE_SUCCESS == code) { + code = buildCmdMsg(pCxt, TDMT_MND_COMPACT_DB, (FSerializeFunc)tSerializeSCompactDbReq, &compactReq); + } + return code; } static int32_t translateKillConnection(STranslateContext* pCxt, SKillStmt* pStmt) { @@ -6360,6 +6399,7 @@ static int32_t translateCreateFunction(STranslateContext* pCxt, SCreateFunctionS req.funcType = pStmt->isAgg ? TSDB_FUNC_TYPE_AGGREGATE : TSDB_FUNC_TYPE_SCALAR; req.scriptType = pStmt->language; req.outputType = pStmt->outputDt.type; + pStmt->outputDt.bytes = calcTypeBytes(pStmt->outputDt); req.outputLen = pStmt->outputDt.bytes; req.bufSize = pStmt->bufSize; int32_t code = readFromFile(pStmt->libraryPath, &req.codeLen, &req.pCode); @@ -6379,15 +6419,15 @@ static int32_t translateDropFunction(STranslateContext* pCxt, SDropFunctionStmt* static int32_t translateGrant(STranslateContext* pCxt, SGrantStmt* pStmt) { SAlterUserReq req = {0}; - if (PRIVILEGE_TYPE_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_ALL) || - (PRIVILEGE_TYPE_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_READ) && - PRIVILEGE_TYPE_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_WRITE))) { + if (BIT_FLAG_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_ALL) || + (BIT_FLAG_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_READ) && + BIT_FLAG_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_WRITE))) { req.alterType = TSDB_ALTER_USER_ADD_ALL_DB; - } else if (PRIVILEGE_TYPE_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_READ)) { + } else if (BIT_FLAG_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_READ)) { req.alterType = TSDB_ALTER_USER_ADD_READ_DB; - } else if (PRIVILEGE_TYPE_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_WRITE)) { + } else if (BIT_FLAG_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_WRITE)) { req.alterType = TSDB_ALTER_USER_ADD_WRITE_DB; - } else if (PRIVILEGE_TYPE_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_SUBSCRIBE)) { + } else if (BIT_FLAG_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_SUBSCRIBE)) { req.alterType = TSDB_ALTER_USER_ADD_SUBSCRIBE_TOPIC; } strcpy(req.user, pStmt->userName); @@ -6397,15 +6437,15 @@ static int32_t translateGrant(STranslateContext* pCxt, SGrantStmt* pStmt) { static int32_t translateRevoke(STranslateContext* pCxt, SRevokeStmt* pStmt) { SAlterUserReq req = {0}; - if (PRIVILEGE_TYPE_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_ALL) || - (PRIVILEGE_TYPE_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_READ) && - PRIVILEGE_TYPE_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_WRITE))) { + if (BIT_FLAG_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_ALL) || + (BIT_FLAG_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_READ) && + BIT_FLAG_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_WRITE))) { req.alterType = TSDB_ALTER_USER_REMOVE_ALL_DB; - } else if (PRIVILEGE_TYPE_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_READ)) { + } else if (BIT_FLAG_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_READ)) { req.alterType = TSDB_ALTER_USER_REMOVE_READ_DB; - } else if (PRIVILEGE_TYPE_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_WRITE)) { + } else if (BIT_FLAG_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_WRITE)) { req.alterType = TSDB_ALTER_USER_REMOVE_WRITE_DB; - } else if (PRIVILEGE_TYPE_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_SUBSCRIBE)) { + } else if (BIT_FLAG_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_SUBSCRIBE)) { req.alterType = TSDB_ALTER_USER_REMOVE_SUBSCRIBE_TOPIC; } strcpy(req.user, pStmt->userName); @@ -6477,6 +6517,11 @@ static int32_t translateShowCreateDatabase(STranslateContext* pCxt, SShowCreateD if (NULL == pStmt->pCfg) { return TSDB_CODE_OUT_OF_MEMORY; } + + SName name; + tNameSetDbName(&name, pCxt->pParseCxt->acctId, pStmt->dbName, strlen(pStmt->dbName)); + tNameGetFullDbName(&name, pStmt->dbFName); + return getDBCfg(pCxt, pStmt->dbName, (SDbCfgInfo*)pStmt->pCfg); } diff --git a/source/libs/parser/src/sql.c b/source/libs/parser/src/sql.c index b434ba706fcfc12a322c4d629c1faa4148b155e8..457083358d551fa7a1afd777baa585e8a40c0e30 100644 --- a/source/libs/parser/src/sql.c +++ b/source/libs/parser/src/sql.c @@ -104,26 +104,26 @@ #endif /************* Begin control #defines *****************************************/ #define YYCODETYPE unsigned short int -#define YYNOCODE 471 +#define YYNOCODE 473 #define YYACTIONTYPE unsigned short int #define ParseTOKENTYPE SToken typedef union { int yyinit; ParseTOKENTYPE yy0; - SNode* yy140; - EFillMode yy174; - int32_t yy214; - SNodeList* yy220; - int64_t yy303; - bool yy587; - SDataType yy682; - ENullOrder yy697; - EOperatorType yy794; - SAlterOption yy809; - EJoinType yy852; - int8_t yy857; - EOrder yy866; - SToken yy881; + EOperatorType yy62; + SToken yy63; + EOrder yy158; + SNodeList* yy222; + SAlterOption yy233; + int32_t yy332; + int64_t yy393; + EJoinType yy574; + bool yy669; + ENullOrder yy675; + SDataType yy686; + int8_t yy707; + EFillMode yy822; + SNode* yy828; } YYMINORTYPE; #ifndef YYSTACKDEPTH #define YYSTACKDEPTH 100 @@ -139,17 +139,17 @@ typedef union { #define ParseCTX_FETCH #define ParseCTX_STORE #define YYFALLBACK 1 -#define YYNSTATE 745 -#define YYNRULE 565 +#define YYNSTATE 754 +#define YYNRULE 574 #define YYNTOKEN 329 -#define YY_MAX_SHIFT 744 -#define YY_MIN_SHIFTREDUCE 1105 -#define YY_MAX_SHIFTREDUCE 1669 -#define YY_ERROR_ACTION 1670 -#define YY_ACCEPT_ACTION 1671 -#define YY_NO_ACTION 1672 -#define YY_MIN_REDUCE 1673 -#define YY_MAX_REDUCE 2237 +#define YY_MAX_SHIFT 753 +#define YY_MIN_SHIFTREDUCE 1121 +#define YY_MAX_SHIFTREDUCE 1694 +#define YY_ERROR_ACTION 1695 +#define YY_ACCEPT_ACTION 1696 +#define YY_NO_ACTION 1697 +#define YY_MIN_REDUCE 1698 +#define YY_MAX_REDUCE 2271 /************* End control #defines *******************************************/ #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) @@ -216,821 +216,773 @@ typedef union { ** yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ -#define YY_ACTTAB_COUNT (3086) +#define YY_ACTTAB_COUNT (2833) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 483, 384, 484, 1709, 1925, 492, 1818, 484, 1709, 161, - /* 10 */ 35, 289, 45, 43, 1597, 190, 360, 2031, 1829, 178, - /* 20 */ 381, 633, 1446, 38, 37, 1878, 2049, 44, 42, 41, - /* 30 */ 40, 39, 1867, 1527, 386, 1444, 2213, 1873, 1875, 1471, - /* 40 */ 2208, 482, 38, 37, 487, 1715, 44, 42, 41, 40, - /* 50 */ 39, 1673, 2027, 2033, 615, 609, 2212, 2067, 1522, 27, - /* 60 */ 2209, 2211, 489, 644, 18, 612, 65, 2152, 485, 176, - /* 70 */ 2017, 1452, 650, 1946, 633, 131, 130, 129, 128, 127, - /* 80 */ 126, 125, 124, 123, 45, 43, 139, 1472, 1944, 621, - /* 90 */ 348, 1929, 381, 2149, 1446, 194, 14, 48, 341, 619, - /* 100 */ 572, 1880, 2048, 501, 2208, 1527, 2084, 1444, 346, 109, - /* 110 */ 2050, 654, 2052, 2053, 649, 106, 644, 1878, 741, 2214, - /* 120 */ 182, 179, 426, 2137, 2209, 598, 633, 375, 2133, 140, - /* 130 */ 1522, 2036, 83, 1529, 1530, 82, 18, 1819, 1471, 1556, - /* 140 */ 1473, 184, 2031, 1452, 44, 42, 41, 40, 39, 2163, - /* 150 */ 167, 464, 268, 2145, 608, 1781, 133, 607, 61, 1446, - /* 160 */ 2208, 1471, 331, 1502, 1512, 373, 609, 2213, 14, 1528, - /* 170 */ 1531, 2208, 1444, 164, 1803, 596, 182, 2027, 2033, 597, - /* 180 */ 2209, 598, 1829, 2208, 1447, 2067, 1445, 2212, 644, 1910, - /* 190 */ 741, 2209, 2210, 591, 1874, 1875, 1557, 139, 596, 182, - /* 200 */ 1308, 1309, 48, 2209, 598, 1529, 1530, 1601, 1452, 198, - /* 210 */ 197, 1450, 1451, 1471, 1501, 1504, 1505, 1506, 1507, 1508, - /* 220 */ 1509, 1510, 1511, 646, 642, 1520, 1521, 1523, 1524, 1525, - /* 230 */ 1526, 2, 463, 533, 532, 1502, 1512, 688, 634, 590, - /* 240 */ 122, 1528, 1531, 121, 120, 119, 118, 117, 116, 115, - /* 250 */ 114, 113, 132, 712, 710, 741, 1447, 491, 1445, 522, - /* 260 */ 487, 1715, 611, 180, 2145, 2146, 620, 137, 2150, 1827, - /* 270 */ 34, 379, 1551, 1552, 1553, 1554, 1555, 1559, 1560, 1561, - /* 280 */ 1562, 1363, 1364, 1450, 1451, 270, 1501, 1504, 1505, 1506, - /* 290 */ 1507, 1508, 1509, 1510, 1511, 646, 642, 1520, 1521, 1523, - /* 300 */ 1524, 1525, 1526, 2, 1503, 11, 45, 43, 1742, 1471, - /* 310 */ 1946, 185, 1880, 499, 381, 1939, 1446, 1696, 1625, 359, - /* 320 */ 2049, 1447, 372, 1445, 592, 1943, 621, 1527, 1878, 1444, - /* 330 */ 1265, 676, 675, 674, 1269, 673, 1271, 1272, 672, 1274, - /* 340 */ 669, 444, 1280, 666, 1282, 1283, 663, 660, 1450, 1451, - /* 350 */ 443, 2067, 1522, 1695, 1472, 185, 1503, 1470, 18, 651, - /* 360 */ 1157, 2017, 1156, 634, 2017, 1452, 650, 584, 583, 1623, - /* 370 */ 1624, 1626, 1627, 1628, 537, 536, 535, 132, 45, 43, - /* 380 */ 1532, 688, 136, 531, 527, 61, 381, 530, 1446, 1985, - /* 390 */ 14, 1158, 529, 534, 1827, 587, 2048, 2017, 528, 1527, - /* 400 */ 2084, 1444, 1880, 109, 2050, 654, 2052, 2053, 649, 369, - /* 410 */ 644, 1138, 741, 142, 1674, 149, 2108, 2137, 1878, 31, - /* 420 */ 634, 375, 2133, 61, 1522, 38, 37, 1529, 1530, 44, - /* 430 */ 42, 41, 40, 39, 187, 122, 238, 1452, 121, 120, - /* 440 */ 119, 118, 117, 116, 115, 114, 113, 537, 536, 535, - /* 450 */ 1140, 1827, 1143, 1144, 1452, 136, 531, 1502, 1512, 1558, - /* 460 */ 530, 1225, 46, 1528, 1531, 529, 534, 1380, 1381, 38, - /* 470 */ 37, 528, 560, 44, 42, 41, 40, 39, 1447, 86, - /* 480 */ 1445, 593, 588, 581, 741, 38, 37, 246, 271, 44, - /* 490 */ 42, 41, 40, 39, 420, 49, 2010, 1227, 419, 1529, - /* 500 */ 1530, 1537, 1823, 1379, 1382, 1450, 1451, 1471, 1501, 1504, - /* 510 */ 1505, 1506, 1507, 1508, 1509, 1510, 1511, 646, 642, 1520, - /* 520 */ 1521, 1523, 1524, 1525, 1526, 2, 61, 90, 92, 1502, - /* 530 */ 1512, 413, 604, 32, 744, 1528, 1531, 236, 185, 2213, - /* 540 */ 572, 235, 572, 1563, 2208, 1804, 2208, 166, 296, 1685, - /* 550 */ 1447, 679, 1445, 176, 415, 411, 1473, 100, 1636, 2214, - /* 560 */ 182, 2214, 182, 175, 2209, 598, 2209, 598, 620, 734, - /* 570 */ 730, 726, 722, 294, 1613, 1930, 185, 1450, 1451, 1820, - /* 580 */ 1501, 1504, 1505, 1506, 1507, 1508, 1509, 1510, 1511, 646, - /* 590 */ 642, 1520, 1521, 1523, 1524, 1525, 1526, 2, 45, 43, - /* 600 */ 620, 89, 336, 221, 1880, 358, 381, 553, 1446, 86, - /* 610 */ 107, 374, 2049, 287, 1157, 618, 1156, 1939, 171, 1527, - /* 620 */ 1878, 1444, 11, 350, 518, 514, 510, 506, 218, 220, - /* 630 */ 38, 37, 1822, 1659, 44, 42, 41, 40, 39, 700, - /* 640 */ 542, 1694, 1474, 2067, 1522, 1158, 630, 629, 185, 1939, - /* 650 */ 1503, 612, 634, 686, 427, 552, 2017, 1452, 650, 280, - /* 660 */ 281, 41, 40, 39, 279, 87, 54, 428, 216, 234, - /* 670 */ 45, 43, 154, 153, 683, 682, 681, 151, 381, 185, - /* 680 */ 1446, 274, 46, 1827, 545, 2017, 273, 609, 2048, 539, - /* 690 */ 1816, 1527, 2084, 1444, 233, 109, 2050, 654, 2052, 2053, - /* 700 */ 649, 270, 644, 1407, 741, 1812, 241, 179, 634, 2137, - /* 710 */ 1814, 634, 634, 375, 2133, 11, 1522, 9, 139, 1529, - /* 720 */ 1530, 636, 424, 2109, 1880, 425, 434, 1925, 597, 1452, - /* 730 */ 567, 69, 2208, 1693, 68, 2164, 215, 209, 192, 1827, - /* 740 */ 1879, 214, 1827, 1827, 497, 1686, 1925, 596, 182, 1502, - /* 750 */ 1512, 237, 2209, 598, 14, 1528, 1531, 196, 551, 38, - /* 760 */ 37, 207, 605, 44, 42, 41, 40, 39, 33, 353, - /* 770 */ 1447, 549, 1445, 547, 38, 37, 741, 2017, 44, 42, - /* 780 */ 41, 40, 39, 1880, 181, 2145, 2146, 248, 137, 2150, - /* 790 */ 385, 1529, 1530, 1671, 2152, 2011, 1810, 1450, 1451, 1878, - /* 800 */ 1501, 1504, 1505, 1506, 1507, 1508, 1509, 1510, 1511, 646, - /* 810 */ 642, 1520, 1521, 1523, 1524, 1525, 1526, 2, 1420, 1421, - /* 820 */ 2148, 1502, 1512, 334, 2152, 1469, 680, 1528, 1531, 1871, - /* 830 */ 678, 354, 457, 352, 351, 471, 524, 634, 470, 384, - /* 840 */ 526, 572, 1447, 141, 1445, 2208, 2108, 164, 1692, 1691, - /* 850 */ 2147, 449, 61, 440, 684, 472, 1829, 1871, 442, 394, - /* 860 */ 2214, 182, 525, 393, 685, 2209, 598, 1871, 1827, 1450, - /* 870 */ 1451, 1690, 1501, 1504, 1505, 1506, 1507, 1508, 1509, 1510, - /* 880 */ 1511, 646, 642, 1520, 1521, 1523, 1524, 1525, 1526, 2, - /* 890 */ 387, 152, 2017, 2017, 165, 2003, 1689, 634, 164, 309, - /* 900 */ 349, 1739, 1802, 2212, 638, 572, 2109, 1829, 641, 2208, - /* 910 */ 164, 450, 430, 307, 72, 2017, 1594, 71, 303, 1830, - /* 920 */ 701, 1857, 1797, 243, 2214, 182, 8, 1666, 1827, 2209, - /* 930 */ 598, 13, 12, 1143, 1144, 203, 479, 477, 474, 418, - /* 940 */ 2017, 417, 468, 401, 53, 462, 461, 460, 459, 456, - /* 950 */ 455, 454, 453, 452, 448, 447, 446, 445, 333, 437, - /* 960 */ 436, 435, 1688, 432, 431, 347, 416, 718, 717, 716, - /* 970 */ 715, 391, 61, 714, 713, 143, 708, 707, 706, 705, - /* 980 */ 704, 703, 702, 156, 698, 697, 696, 390, 389, 693, - /* 990 */ 692, 691, 690, 689, 38, 37, 1782, 609, 44, 42, - /* 1000 */ 41, 40, 39, 1474, 645, 185, 2017, 1687, 38, 37, - /* 1010 */ 686, 108, 44, 42, 41, 40, 39, 2177, 686, 1684, - /* 1020 */ 73, 1683, 558, 601, 526, 2049, 1665, 1570, 139, 154, - /* 1030 */ 153, 683, 682, 681, 151, 634, 634, 154, 153, 683, - /* 1040 */ 682, 681, 151, 265, 634, 634, 525, 634, 634, 500, - /* 1050 */ 1824, 2017, 80, 79, 423, 1548, 2067, 189, 239, 568, - /* 1060 */ 634, 613, 617, 2017, 651, 2017, 1827, 1827, 572, 2017, - /* 1070 */ 81, 650, 2208, 585, 284, 1827, 1827, 332, 1827, 1827, - /* 1080 */ 409, 219, 407, 403, 399, 396, 416, 2214, 182, 259, - /* 1090 */ 634, 1827, 2209, 598, 183, 2145, 2146, 1682, 137, 2150, - /* 1100 */ 634, 2048, 634, 2049, 631, 2084, 1681, 2035, 109, 2050, - /* 1110 */ 654, 2052, 2053, 649, 632, 644, 290, 1474, 2031, 1680, - /* 1120 */ 2228, 1827, 2137, 1729, 1679, 185, 375, 2133, 392, 634, - /* 1130 */ 1678, 1827, 1677, 1827, 2067, 1590, 2049, 2171, 2157, 1590, - /* 1140 */ 1676, 2017, 651, 388, 51, 538, 3, 2017, 191, 650, - /* 1150 */ 2017, 163, 1805, 2027, 2033, 362, 145, 555, 134, 554, - /* 1160 */ 1827, 2035, 1593, 2017, 644, 1455, 226, 2067, 2017, 224, - /* 1170 */ 600, 1934, 2031, 1454, 2017, 651, 2017, 1722, 228, 2048, - /* 1180 */ 2017, 227, 650, 2084, 2017, 2068, 109, 2050, 654, 2052, - /* 1190 */ 2053, 649, 230, 644, 232, 229, 147, 231, 2228, 540, - /* 1200 */ 2137, 1710, 152, 2049, 375, 2133, 2035, 2027, 2033, 363, - /* 1210 */ 1720, 152, 2048, 63, 63, 2184, 2084, 2031, 644, 109, - /* 1220 */ 2050, 654, 2052, 2053, 649, 252, 644, 152, 1668, 1669, - /* 1230 */ 1868, 2228, 543, 2137, 2067, 378, 377, 375, 2133, 47, - /* 1240 */ 13, 12, 651, 2167, 277, 1460, 610, 2017, 579, 650, - /* 1250 */ 52, 602, 2027, 2033, 376, 1415, 1527, 571, 1453, 2038, - /* 1260 */ 70, 105, 247, 644, 1418, 150, 1622, 1621, 2049, 152, - /* 1270 */ 63, 102, 47, 47, 658, 267, 150, 152, 254, 2048, - /* 1280 */ 616, 1522, 135, 2084, 150, 1187, 109, 2050, 654, 2052, - /* 1290 */ 2053, 649, 1377, 644, 1452, 694, 264, 282, 2228, 2067, - /* 1300 */ 2137, 2049, 1, 4, 375, 2133, 695, 651, 2040, 395, - /* 1310 */ 400, 1400, 2017, 626, 650, 2202, 1458, 1206, 286, 1716, - /* 1320 */ 345, 1188, 1258, 1564, 1457, 1513, 302, 1286, 1204, 1290, - /* 1330 */ 1297, 297, 2067, 195, 429, 1295, 1935, 155, 1474, 433, - /* 1340 */ 651, 640, 466, 438, 2048, 2017, 1469, 650, 2084, 451, - /* 1350 */ 1927, 109, 2050, 654, 2052, 2053, 649, 458, 644, 465, - /* 1360 */ 473, 467, 475, 2228, 476, 2137, 200, 478, 736, 375, - /* 1370 */ 2133, 480, 1475, 481, 490, 1477, 493, 2048, 206, 1472, - /* 1380 */ 2156, 2084, 494, 208, 109, 2050, 654, 2052, 2053, 649, - /* 1390 */ 1476, 644, 495, 1478, 496, 211, 2112, 2049, 2137, 498, - /* 1400 */ 213, 84, 375, 2133, 502, 85, 217, 1461, 1160, 1456, - /* 1410 */ 519, 520, 112, 521, 335, 557, 523, 1994, 1991, 1817, - /* 1420 */ 223, 1990, 559, 88, 1813, 225, 157, 148, 2067, 569, - /* 1430 */ 240, 298, 158, 1815, 1464, 1466, 651, 1811, 159, 160, - /* 1440 */ 563, 2017, 562, 650, 561, 242, 586, 642, 1520, 1521, - /* 1450 */ 1523, 1524, 1525, 1526, 244, 566, 2183, 2168, 2049, 2178, - /* 1460 */ 576, 624, 2182, 582, 364, 7, 589, 2159, 260, 595, - /* 1470 */ 258, 577, 250, 2048, 253, 172, 575, 2084, 261, 574, - /* 1480 */ 109, 2050, 654, 2052, 2053, 649, 606, 644, 603, 2067, - /* 1490 */ 365, 262, 2110, 2231, 2137, 1590, 266, 651, 375, 2133, - /* 1500 */ 2207, 263, 2017, 138, 650, 1473, 614, 2153, 2049, 368, - /* 1510 */ 1940, 1479, 622, 299, 627, 272, 95, 623, 1954, 1953, - /* 1520 */ 1952, 371, 300, 628, 1828, 1872, 97, 60, 99, 101, - /* 1530 */ 2118, 2049, 301, 304, 2048, 293, 737, 50, 2084, 2067, - /* 1540 */ 738, 109, 2050, 654, 2052, 2053, 649, 651, 644, 1798, - /* 1550 */ 328, 337, 2017, 637, 650, 2137, 656, 2009, 740, 375, - /* 1560 */ 2133, 313, 2067, 327, 317, 306, 338, 308, 2008, 2007, - /* 1570 */ 651, 77, 2004, 397, 398, 2017, 1437, 650, 1438, 188, - /* 1580 */ 402, 2049, 2002, 404, 2048, 405, 406, 2001, 2084, 408, - /* 1590 */ 2000, 110, 2050, 654, 2052, 2053, 649, 410, 644, 1999, - /* 1600 */ 412, 1998, 414, 78, 1403, 2137, 1402, 2048, 1966, 2136, - /* 1610 */ 2133, 2084, 2067, 1965, 110, 2050, 654, 2052, 2053, 649, - /* 1620 */ 651, 644, 1964, 421, 422, 2017, 1963, 650, 2137, 1962, - /* 1630 */ 1354, 2049, 639, 2133, 1918, 1917, 1915, 144, 1914, 1913, - /* 1640 */ 1916, 1912, 1911, 1909, 1908, 1907, 193, 439, 2049, 1906, - /* 1650 */ 441, 1920, 1905, 1904, 1903, 1902, 1901, 652, 1900, 1899, - /* 1660 */ 1898, 2084, 2067, 1897, 110, 2050, 654, 2052, 2053, 649, - /* 1670 */ 648, 644, 1896, 1895, 1894, 2017, 1893, 650, 2137, 2067, - /* 1680 */ 1892, 1891, 340, 2133, 1890, 1889, 1888, 651, 146, 1919, - /* 1690 */ 1887, 1886, 2017, 1356, 650, 469, 1882, 1881, 2049, 1885, - /* 1700 */ 1884, 1883, 1745, 1233, 1744, 199, 201, 2048, 1743, 1741, - /* 1710 */ 1705, 2084, 204, 177, 325, 2050, 654, 2052, 2053, 649, - /* 1720 */ 647, 644, 635, 2102, 2048, 202, 75, 1146, 2084, 2067, - /* 1730 */ 2037, 168, 2050, 654, 2052, 2053, 649, 651, 644, 486, - /* 1740 */ 1145, 488, 2017, 1704, 650, 205, 76, 1981, 1973, 1961, - /* 1750 */ 210, 212, 1960, 1938, 1806, 1740, 1738, 503, 1180, 505, - /* 1760 */ 1736, 2049, 504, 507, 508, 1734, 509, 511, 513, 512, - /* 1770 */ 1732, 515, 573, 2174, 2048, 1719, 517, 1718, 2084, 516, - /* 1780 */ 1701, 169, 2050, 654, 2052, 2053, 649, 1808, 644, 1301, - /* 1790 */ 1807, 1730, 2067, 62, 1302, 709, 1224, 1223, 1222, 1221, - /* 1800 */ 651, 222, 711, 1218, 1217, 2017, 1216, 650, 1215, 1723, - /* 1810 */ 355, 356, 1721, 544, 357, 1700, 541, 546, 1699, 1698, - /* 1820 */ 548, 550, 2049, 111, 1980, 1972, 55, 1411, 564, 1425, - /* 1830 */ 1427, 1424, 1429, 599, 2229, 26, 66, 2048, 1959, 1409, - /* 1840 */ 565, 2084, 1957, 361, 110, 2050, 654, 2052, 2053, 649, - /* 1850 */ 570, 644, 162, 2067, 2213, 19, 16, 578, 2137, 580, - /* 1860 */ 58, 651, 20, 2134, 59, 256, 2017, 28, 650, 1638, - /* 1870 */ 245, 251, 2049, 1620, 257, 249, 2038, 170, 5, 255, - /* 1880 */ 30, 64, 29, 21, 17, 1653, 1958, 6, 2049, 57, - /* 1890 */ 1652, 366, 1657, 1656, 1612, 1658, 91, 367, 2048, 1659, - /* 1900 */ 269, 1956, 2084, 2067, 1587, 168, 2050, 654, 2052, 2053, - /* 1910 */ 649, 651, 644, 56, 1586, 173, 2017, 1955, 650, 2067, - /* 1920 */ 1937, 94, 93, 275, 22, 625, 278, 651, 276, 1618, - /* 1930 */ 283, 67, 2017, 1936, 650, 96, 98, 288, 23, 102, - /* 1940 */ 12, 1462, 2087, 643, 1549, 1517, 1515, 2175, 2048, 2049, - /* 1950 */ 1539, 10, 2084, 174, 186, 319, 2050, 654, 2052, 2053, - /* 1960 */ 649, 36, 644, 1514, 2048, 2049, 1538, 285, 2084, 15, - /* 1970 */ 24, 169, 2050, 654, 2052, 2053, 649, 1486, 644, 1494, - /* 1980 */ 2067, 25, 655, 657, 1287, 370, 383, 659, 651, 1284, - /* 1990 */ 661, 662, 1279, 2017, 1281, 650, 2067, 664, 665, 594, - /* 2000 */ 1275, 667, 1273, 670, 648, 668, 671, 1264, 1278, 2017, - /* 2010 */ 103, 650, 677, 1277, 291, 1296, 1292, 104, 1276, 74, - /* 2020 */ 687, 653, 1212, 1178, 2230, 2048, 1211, 2049, 1210, 2084, - /* 2030 */ 1209, 1208, 326, 2050, 654, 2052, 2053, 649, 1207, 644, - /* 2040 */ 1231, 2048, 1205, 1203, 2049, 2084, 1202, 1201, 325, 2050, - /* 2050 */ 654, 2052, 2053, 649, 699, 644, 1199, 2103, 2067, 292, - /* 2060 */ 1198, 1197, 2049, 380, 1196, 1195, 651, 1194, 1193, 1228, - /* 2070 */ 1226, 2017, 1190, 650, 1189, 2067, 1186, 1184, 1185, 1183, - /* 2080 */ 382, 1737, 719, 651, 720, 721, 1735, 723, 2017, 725, - /* 2090 */ 650, 1733, 727, 2067, 1731, 729, 724, 728, 733, 731, - /* 2100 */ 1717, 651, 732, 2048, 735, 1135, 2017, 2084, 650, 1697, - /* 2110 */ 326, 2050, 654, 2052, 2053, 649, 739, 644, 295, 1448, - /* 2120 */ 2048, 305, 742, 743, 2084, 2049, 1672, 326, 2050, 654, - /* 2130 */ 2052, 2053, 649, 1672, 644, 1672, 1672, 1672, 556, 1672, - /* 2140 */ 1672, 1672, 2084, 1672, 1672, 321, 2050, 654, 2052, 2053, - /* 2150 */ 649, 1672, 644, 1672, 1672, 1672, 2067, 1672, 1672, 1672, - /* 2160 */ 1672, 1672, 1672, 1672, 651, 1672, 1672, 1672, 1672, 2017, - /* 2170 */ 1672, 650, 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672, - /* 2180 */ 1672, 1672, 1672, 1672, 1672, 1672, 2049, 1672, 1672, 1672, - /* 2190 */ 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672, - /* 2200 */ 1672, 2048, 1672, 1672, 1672, 2084, 1672, 1672, 310, 2050, - /* 2210 */ 654, 2052, 2053, 649, 1672, 644, 1672, 2067, 1672, 1672, - /* 2220 */ 1672, 2049, 1672, 1672, 1672, 651, 1672, 1672, 1672, 1672, - /* 2230 */ 2017, 1672, 650, 1672, 1672, 1672, 1672, 1672, 1672, 1672, - /* 2240 */ 1672, 1672, 1672, 1672, 2049, 1672, 1672, 1672, 1672, 1672, - /* 2250 */ 1672, 1672, 2067, 1672, 1672, 1672, 1672, 1672, 1672, 1672, - /* 2260 */ 651, 1672, 2048, 1672, 1672, 2017, 2084, 650, 1672, 311, - /* 2270 */ 2050, 654, 2052, 2053, 649, 2067, 644, 1672, 1672, 1672, - /* 2280 */ 1672, 1672, 1672, 651, 1672, 1672, 1672, 1672, 2017, 1672, - /* 2290 */ 650, 1672, 1672, 1672, 1672, 1672, 1672, 2048, 1672, 1672, - /* 2300 */ 1672, 2084, 1672, 1672, 312, 2050, 654, 2052, 2053, 649, - /* 2310 */ 1672, 644, 1672, 2049, 1672, 1672, 1672, 1672, 1672, 1672, - /* 2320 */ 2048, 1672, 1672, 1672, 2084, 1672, 1672, 318, 2050, 654, - /* 2330 */ 2052, 2053, 649, 1672, 644, 1672, 1672, 2049, 1672, 1672, - /* 2340 */ 1672, 1672, 1672, 1672, 2067, 1672, 1672, 1672, 1672, 1672, - /* 2350 */ 1672, 1672, 651, 1672, 1672, 1672, 1672, 2017, 1672, 650, - /* 2360 */ 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672, 2067, 1672, - /* 2370 */ 1672, 1672, 1672, 1672, 1672, 1672, 651, 1672, 1672, 1672, - /* 2380 */ 1672, 2017, 1672, 650, 1672, 1672, 1672, 1672, 1672, 2048, - /* 2390 */ 1672, 1672, 1672, 2084, 1672, 2049, 322, 2050, 654, 2052, - /* 2400 */ 2053, 649, 1672, 644, 1672, 1672, 1672, 1672, 1672, 1672, - /* 2410 */ 1672, 1672, 1672, 2048, 1672, 1672, 2049, 2084, 1672, 1672, - /* 2420 */ 314, 2050, 654, 2052, 2053, 649, 2067, 644, 1672, 1672, - /* 2430 */ 1672, 1672, 1672, 1672, 651, 1672, 1672, 1672, 1672, 2017, - /* 2440 */ 1672, 650, 1672, 1672, 1672, 2049, 1672, 2067, 1672, 1672, - /* 2450 */ 1672, 1672, 1672, 1672, 1672, 651, 1672, 1672, 1672, 1672, - /* 2460 */ 2017, 1672, 650, 1672, 1672, 1672, 1672, 1672, 1672, 1672, - /* 2470 */ 1672, 2048, 1672, 1672, 1672, 2084, 2067, 1672, 323, 2050, - /* 2480 */ 654, 2052, 2053, 649, 651, 644, 1672, 1672, 1672, 2017, - /* 2490 */ 1672, 650, 2048, 1672, 1672, 1672, 2084, 1672, 1672, 315, - /* 2500 */ 2050, 654, 2052, 2053, 649, 1672, 644, 1672, 1672, 1672, - /* 2510 */ 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672, 2049, - /* 2520 */ 1672, 2048, 1672, 1672, 1672, 2084, 1672, 1672, 324, 2050, - /* 2530 */ 654, 2052, 2053, 649, 1672, 644, 1672, 1672, 2049, 1672, - /* 2540 */ 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672, - /* 2550 */ 2067, 1672, 1672, 1672, 2049, 1672, 1672, 1672, 651, 1672, - /* 2560 */ 1672, 1672, 1672, 2017, 1672, 650, 1672, 1672, 1672, 2067, - /* 2570 */ 1672, 1672, 1672, 1672, 1672, 1672, 1672, 651, 1672, 1672, - /* 2580 */ 1672, 1672, 2017, 1672, 650, 2067, 1672, 1672, 1672, 1672, - /* 2590 */ 1672, 1672, 1672, 651, 1672, 2048, 1672, 1672, 2017, 2084, - /* 2600 */ 650, 1672, 316, 2050, 654, 2052, 2053, 649, 1672, 644, - /* 2610 */ 1672, 1672, 1672, 1672, 2048, 1672, 2049, 1672, 2084, 1672, - /* 2620 */ 1672, 329, 2050, 654, 2052, 2053, 649, 1672, 644, 1672, - /* 2630 */ 2048, 1672, 1672, 1672, 2084, 1672, 1672, 330, 2050, 654, - /* 2640 */ 2052, 2053, 649, 1672, 644, 1672, 1672, 2067, 1672, 1672, - /* 2650 */ 1672, 1672, 1672, 1672, 1672, 651, 1672, 1672, 1672, 1672, - /* 2660 */ 2017, 1672, 650, 1672, 1672, 1672, 1672, 1672, 1672, 1672, - /* 2670 */ 1672, 1672, 1672, 1672, 1672, 1672, 1672, 2049, 1672, 1672, - /* 2680 */ 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672, - /* 2690 */ 1672, 1672, 2048, 1672, 1672, 1672, 2084, 1672, 1672, 2061, - /* 2700 */ 2050, 654, 2052, 2053, 649, 1672, 644, 1672, 2067, 1672, - /* 2710 */ 1672, 1672, 1672, 1672, 1672, 1672, 651, 1672, 1672, 1672, - /* 2720 */ 1672, 2017, 1672, 650, 1672, 1672, 1672, 1672, 1672, 1672, - /* 2730 */ 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672, - /* 2740 */ 1672, 1672, 1672, 1672, 1672, 1672, 2049, 1672, 1672, 1672, - /* 2750 */ 1672, 1672, 1672, 2048, 1672, 1672, 1672, 2084, 1672, 1672, - /* 2760 */ 2060, 2050, 654, 2052, 2053, 649, 1672, 644, 1672, 1672, - /* 2770 */ 1672, 1672, 2049, 1672, 1672, 1672, 1672, 2067, 1672, 1672, - /* 2780 */ 1672, 1672, 1672, 1672, 1672, 651, 1672, 1672, 1672, 1672, - /* 2790 */ 2017, 1672, 650, 1672, 1672, 1672, 1672, 1672, 1672, 1672, - /* 2800 */ 1672, 1672, 1672, 2067, 1672, 1672, 1672, 1672, 1672, 1672, - /* 2810 */ 1672, 651, 1672, 1672, 1672, 1672, 2017, 1672, 650, 1672, - /* 2820 */ 1672, 1672, 2048, 1672, 1672, 1672, 2084, 1672, 1672, 2059, - /* 2830 */ 2050, 654, 2052, 2053, 649, 2049, 644, 1672, 1672, 1672, - /* 2840 */ 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672, 2048, 1672, - /* 2850 */ 1672, 1672, 2084, 1672, 2049, 342, 2050, 654, 2052, 2053, - /* 2860 */ 649, 1672, 644, 1672, 1672, 1672, 2067, 1672, 1672, 1672, - /* 2870 */ 1672, 1672, 1672, 1672, 651, 1672, 1672, 1672, 1672, 2017, - /* 2880 */ 1672, 650, 1672, 1672, 1672, 2067, 1672, 1672, 1672, 1672, - /* 2890 */ 1672, 1672, 1672, 651, 1672, 1672, 1672, 1672, 2017, 1672, - /* 2900 */ 650, 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672, - /* 2910 */ 1672, 2048, 1672, 1672, 1672, 2084, 1672, 2049, 343, 2050, - /* 2920 */ 654, 2052, 2053, 649, 1672, 644, 1672, 1672, 1672, 1672, - /* 2930 */ 2048, 1672, 1672, 2049, 2084, 1672, 1672, 339, 2050, 654, - /* 2940 */ 2052, 2053, 649, 1672, 644, 1672, 1672, 1672, 2067, 1672, - /* 2950 */ 1672, 1672, 1672, 1672, 1672, 1672, 651, 1672, 1672, 1672, - /* 2960 */ 1672, 2017, 1672, 650, 2067, 1672, 1672, 1672, 1672, 1672, - /* 2970 */ 1672, 1672, 651, 1672, 1672, 1672, 1672, 2017, 1672, 650, - /* 2980 */ 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672, - /* 2990 */ 1672, 1672, 1672, 2048, 1672, 2049, 1672, 2084, 1672, 1672, - /* 3000 */ 344, 2050, 654, 2052, 2053, 649, 1672, 644, 1672, 652, - /* 3010 */ 1672, 1672, 1672, 2084, 1672, 1672, 321, 2050, 654, 2052, - /* 3020 */ 2053, 649, 1672, 644, 1672, 1672, 2067, 1672, 1672, 1672, - /* 3030 */ 1672, 1672, 1672, 1672, 651, 1672, 1672, 1672, 1672, 2017, - /* 3040 */ 1672, 650, 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672, - /* 3050 */ 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672, - /* 3060 */ 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672, - /* 3070 */ 1672, 2048, 1672, 1672, 1672, 2084, 1672, 1672, 320, 2050, - /* 3080 */ 654, 2052, 2053, 649, 1672, 644, + /* 0 */ 2069, 2247, 1980, 166, 2083, 2242, 491, 2101, 492, 1734, + /* 10 */ 1806, 2065, 45, 43, 1622, 600, 1980, 1978, 630, 2069, + /* 20 */ 385, 2246, 1471, 618, 1496, 2243, 2245, 2083, 376, 2186, + /* 30 */ 2065, 1977, 630, 1552, 2019, 1469, 1837, 2101, 44, 42, + /* 40 */ 41, 40, 39, 430, 642, 621, 2061, 2067, 366, 1173, + /* 50 */ 2051, 1172, 659, 629, 643, 2183, 139, 653, 1547, 2247, + /* 60 */ 2101, 599, 1914, 2242, 18, 2061, 2067, 367, 660, 350, + /* 70 */ 132, 1477, 167, 2051, 1710, 659, 653, 530, 1912, 2246, + /* 80 */ 1174, 240, 2082, 2243, 2244, 333, 2118, 1861, 642, 109, + /* 90 */ 2084, 663, 2086, 2087, 658, 2069, 653, 750, 65, 697, + /* 100 */ 14, 179, 507, 2171, 1973, 2082, 2065, 379, 2167, 2118, + /* 110 */ 45, 43, 168, 2084, 663, 2086, 2087, 658, 385, 653, + /* 120 */ 1471, 184, 270, 2179, 617, 1721, 133, 616, 73, 2197, + /* 130 */ 2242, 1552, 1173, 1469, 1172, 390, 1554, 1555, 1907, 1909, + /* 140 */ 606, 2061, 2067, 380, 2242, 605, 182, 222, 35, 291, + /* 150 */ 2243, 607, 653, 582, 2208, 273, 1547, 1838, 628, 605, + /* 160 */ 182, 642, 18, 1174, 2243, 607, 1527, 1537, 48, 1477, + /* 170 */ 1764, 2051, 1553, 1556, 38, 37, 178, 81, 44, 42, + /* 180 */ 41, 40, 39, 546, 545, 544, 1472, 509, 1470, 1901, + /* 190 */ 536, 136, 540, 176, 61, 750, 539, 61, 14, 92, + /* 200 */ 497, 538, 543, 61, 38, 37, 493, 537, 44, 42, + /* 210 */ 41, 40, 39, 1475, 1476, 1964, 1526, 1529, 1530, 1531, + /* 220 */ 1532, 1533, 1534, 1535, 1536, 655, 651, 1545, 1546, 1548, + /* 230 */ 1549, 1550, 1551, 2, 1554, 1555, 727, 726, 725, 724, + /* 240 */ 395, 48, 723, 722, 143, 717, 716, 715, 714, 713, + /* 250 */ 712, 711, 156, 707, 706, 705, 394, 393, 702, 701, + /* 260 */ 700, 699, 698, 601, 1527, 1537, 596, 1661, 580, 695, + /* 270 */ 1553, 1556, 122, 1583, 1242, 121, 120, 119, 118, 117, + /* 280 */ 116, 115, 114, 113, 1472, 695, 1470, 154, 153, 692, + /* 290 */ 691, 690, 151, 38, 37, 697, 1154, 44, 42, 41, + /* 300 */ 40, 39, 1959, 154, 153, 692, 691, 690, 151, 1696, + /* 310 */ 1244, 1475, 1476, 190, 1526, 1529, 1530, 1531, 1532, 1533, + /* 320 */ 1534, 1535, 1536, 655, 651, 1545, 1546, 1548, 1549, 1550, + /* 330 */ 1551, 2, 11, 45, 43, 1156, 1839, 1159, 1160, 1496, + /* 340 */ 52, 385, 1299, 1471, 185, 32, 1959, 185, 1496, 345, + /* 350 */ 602, 597, 590, 185, 1552, 1588, 1469, 192, 1290, 685, + /* 360 */ 684, 683, 1294, 682, 1296, 1297, 681, 678, 86, 1305, + /* 370 */ 675, 1307, 1308, 672, 669, 1699, 31, 398, 2083, 1547, + /* 380 */ 147, 397, 38, 37, 354, 18, 44, 42, 41, 40, + /* 390 */ 39, 185, 1477, 1856, 1581, 500, 122, 492, 1734, 121, + /* 400 */ 120, 119, 118, 117, 116, 115, 114, 113, 38, 37, + /* 410 */ 629, 2101, 44, 42, 41, 40, 39, 377, 750, 657, + /* 420 */ 1499, 14, 468, 581, 2051, 164, 659, 2242, 61, 388, + /* 430 */ 1495, 45, 43, 1557, 1863, 282, 283, 161, 1959, 385, + /* 440 */ 281, 1471, 2248, 182, 364, 1497, 1863, 2243, 607, 196, + /* 450 */ 1582, 238, 1552, 1912, 1469, 237, 2082, 1554, 1555, 627, + /* 460 */ 2118, 1973, 569, 327, 2084, 663, 2086, 2087, 658, 656, + /* 470 */ 653, 644, 2136, 1698, 38, 37, 11, 1547, 44, 42, + /* 480 */ 41, 40, 39, 198, 197, 1388, 1389, 1527, 1537, 100, + /* 490 */ 1477, 1767, 490, 1553, 1556, 495, 1740, 131, 130, 129, + /* 500 */ 128, 127, 126, 125, 124, 123, 467, 1472, 499, 1470, + /* 510 */ 27, 495, 1740, 1854, 89, 340, 750, 424, 362, 46, + /* 520 */ 562, 423, 34, 383, 1576, 1577, 1578, 1579, 1580, 1584, + /* 530 */ 1585, 1586, 1587, 1720, 1475, 1476, 576, 1526, 1529, 1530, + /* 540 */ 1531, 1532, 1533, 1534, 1535, 1536, 655, 651, 1545, 1546, + /* 550 */ 1548, 1549, 1550, 1551, 2, 1554, 1555, 546, 545, 544, + /* 560 */ 1477, 1333, 1334, 581, 536, 136, 540, 2242, 250, 49, + /* 570 */ 539, 1908, 1909, 1852, 106, 538, 543, 709, 185, 2051, + /* 580 */ 2083, 537, 2248, 182, 2065, 1527, 1537, 2243, 607, 33, + /* 590 */ 140, 1553, 1556, 13, 12, 38, 37, 1836, 1853, 44, + /* 600 */ 42, 41, 40, 39, 688, 1472, 2247, 1470, 542, 541, + /* 610 */ 38, 37, 560, 2101, 44, 42, 41, 40, 39, 2061, + /* 620 */ 2067, 660, 618, 1498, 1944, 558, 2051, 556, 659, 11, + /* 630 */ 653, 9, 1475, 1476, 86, 1526, 1529, 1530, 1531, 1532, + /* 640 */ 1533, 1534, 1535, 1536, 655, 651, 1545, 1546, 1548, 1549, + /* 650 */ 1550, 1551, 2, 45, 43, 139, 248, 2083, 2082, 1857, + /* 660 */ 2070, 385, 2118, 1471, 643, 109, 2084, 663, 2086, 2087, + /* 670 */ 658, 2065, 653, 1497, 1552, 142, 1469, 149, 2142, 2171, + /* 680 */ 187, 38, 37, 379, 2167, 44, 42, 41, 40, 39, + /* 690 */ 2101, 1719, 176, 1595, 1498, 1914, 1754, 1861, 660, 1547, + /* 700 */ 90, 618, 363, 2051, 1684, 659, 2061, 2067, 1718, 695, + /* 710 */ 624, 1912, 1477, 352, 1963, 1650, 357, 653, 547, 185, + /* 720 */ 620, 180, 2179, 2180, 643, 137, 2184, 154, 153, 692, + /* 730 */ 691, 690, 151, 141, 139, 2082, 2142, 2051, 750, 2118, + /* 740 */ 54, 46, 169, 2084, 663, 2086, 2087, 658, 2246, 653, + /* 750 */ 1717, 45, 43, 643, 2051, 689, 581, 1861, 1905, 385, + /* 760 */ 2242, 1471, 593, 592, 1648, 1649, 1651, 1652, 1653, 428, + /* 770 */ 163, 272, 1552, 1850, 1469, 2248, 182, 1554, 1555, 448, + /* 780 */ 2243, 607, 358, 2186, 356, 355, 1861, 532, 447, 1405, + /* 790 */ 1406, 534, 629, 1846, 608, 2263, 2051, 1547, 1848, 2083, + /* 800 */ 181, 2179, 2180, 1716, 137, 2184, 1499, 1527, 1537, 2182, + /* 810 */ 1477, 1844, 533, 1553, 1556, 643, 38, 37, 2186, 643, + /* 820 */ 44, 42, 41, 40, 39, 1404, 1407, 1472, 687, 1470, + /* 830 */ 1914, 132, 2101, 1715, 2037, 429, 750, 373, 535, 14, + /* 840 */ 660, 638, 272, 1973, 2181, 2051, 1912, 659, 1861, 2051, + /* 850 */ 2044, 1691, 1861, 194, 1475, 1476, 1714, 1526, 1529, 1530, + /* 860 */ 1531, 1532, 1533, 1534, 1535, 1536, 655, 651, 1545, 1546, + /* 870 */ 1548, 1549, 1550, 1551, 2, 1554, 1555, 2082, 245, 2051, + /* 880 */ 2045, 2118, 405, 1914, 110, 2084, 663, 2086, 2087, 658, + /* 890 */ 378, 653, 693, 388, 83, 1905, 581, 82, 2171, 1912, + /* 900 */ 2242, 164, 2051, 2168, 606, 1527, 1537, 1496, 2242, 1638, + /* 910 */ 1863, 1553, 1556, 721, 719, 2248, 182, 417, 61, 8, + /* 920 */ 2243, 607, 1253, 605, 182, 1472, 581, 1470, 2243, 607, + /* 930 */ 2242, 1914, 645, 1626, 2143, 1252, 1562, 654, 389, 1496, + /* 940 */ 419, 415, 1496, 1159, 1160, 2248, 182, 1912, 1690, 610, + /* 950 */ 2243, 607, 1475, 1476, 191, 1526, 1529, 1530, 1531, 1532, + /* 960 */ 1533, 1534, 1535, 1536, 655, 651, 1545, 1546, 1548, 1549, + /* 970 */ 1550, 1551, 2, 1499, 336, 165, 1494, 643, 382, 381, + /* 980 */ 311, 567, 647, 461, 2143, 551, 475, 2083, 1485, 474, + /* 990 */ 41, 40, 39, 438, 309, 72, 1619, 477, 71, 1552, + /* 1000 */ 561, 1478, 1711, 422, 444, 421, 476, 2211, 694, 446, + /* 1010 */ 1861, 1905, 1471, 164, 236, 609, 205, 487, 485, 482, + /* 1020 */ 2101, 152, 1864, 618, 1547, 1469, 643, 581, 660, 554, + /* 1030 */ 420, 2242, 391, 2051, 548, 659, 1713, 1477, 643, 235, + /* 1040 */ 164, 534, 453, 1712, 2191, 1615, 2248, 182, 643, 1863, + /* 1050 */ 1914, 2243, 607, 1528, 454, 353, 139, 61, 710, 1861, + /* 1060 */ 1823, 1477, 533, 649, 508, 2082, 1913, 434, 185, 2118, + /* 1070 */ 1807, 1861, 109, 2084, 663, 2086, 2087, 658, 53, 653, + /* 1080 */ 69, 1861, 2051, 68, 2146, 1528, 2171, 750, 1528, 2051, + /* 1090 */ 379, 2167, 1709, 1708, 1480, 108, 472, 1707, 1747, 466, + /* 1100 */ 465, 464, 463, 460, 459, 458, 457, 456, 452, 451, + /* 1110 */ 450, 449, 335, 441, 440, 439, 643, 436, 435, 351, + /* 1120 */ 549, 249, 183, 2179, 2180, 613, 137, 2184, 643, 1615, + /* 1130 */ 305, 643, 1858, 1891, 152, 80, 79, 427, 2051, 2051, + /* 1140 */ 189, 2083, 643, 2051, 241, 239, 1257, 577, 51, 1861, + /* 1150 */ 3, 145, 1486, 134, 1481, 643, 1706, 643, 622, 1256, + /* 1160 */ 334, 1861, 1479, 413, 1861, 411, 407, 403, 400, 420, + /* 1170 */ 1705, 626, 2083, 286, 2101, 1861, 1472, 611, 1470, 1489, + /* 1180 */ 1491, 267, 621, 228, 643, 650, 226, 2051, 1861, 659, + /* 1190 */ 1861, 1440, 651, 1545, 1546, 1548, 1549, 1550, 1551, 643, + /* 1200 */ 640, 431, 2051, 1475, 1476, 2101, 1704, 185, 643, 643, + /* 1210 */ 1703, 1445, 1446, 660, 432, 641, 2051, 1861, 2051, 2082, + /* 1220 */ 659, 479, 2083, 2118, 292, 392, 109, 2084, 663, 2086, + /* 1230 */ 2087, 658, 1861, 653, 230, 1702, 1701, 229, 179, 2083, + /* 1240 */ 2171, 1861, 1861, 1618, 379, 2167, 232, 1483, 234, 231, + /* 1250 */ 2082, 233, 2051, 594, 2118, 2101, 2051, 109, 2084, 663, + /* 1260 */ 2086, 2087, 658, 660, 653, 152, 2198, 1745, 2051, 2262, + /* 1270 */ 659, 2171, 2101, 63, 221, 379, 2167, 564, 63, 563, + /* 1280 */ 660, 2051, 2051, 261, 254, 2051, 2205, 659, 105, 552, + /* 1290 */ 1693, 1694, 2102, 152, 396, 13, 12, 47, 102, 2083, + /* 1300 */ 2082, 279, 70, 2072, 2118, 150, 152, 168, 2084, 663, + /* 1310 */ 2086, 2087, 658, 63, 653, 1482, 1968, 2082, 1735, 2083, + /* 1320 */ 1902, 2118, 1443, 47, 109, 2084, 663, 2086, 2087, 658, + /* 1330 */ 1647, 653, 2101, 2201, 1573, 1646, 2262, 753, 2171, 703, + /* 1340 */ 660, 256, 379, 2167, 619, 2051, 1741, 659, 269, 2209, + /* 1350 */ 625, 298, 2101, 2218, 1402, 614, 2074, 47, 284, 635, + /* 1360 */ 660, 1222, 288, 1283, 667, 2051, 175, 659, 150, 152, + /* 1370 */ 1589, 704, 743, 739, 735, 731, 296, 2082, 266, 135, + /* 1380 */ 1538, 2118, 150, 1203, 109, 2084, 663, 2086, 2087, 658, + /* 1390 */ 1, 653, 4, 1220, 399, 745, 2262, 2082, 2171, 404, + /* 1400 */ 349, 2118, 379, 2167, 109, 2084, 663, 2086, 2087, 658, + /* 1410 */ 1425, 653, 299, 588, 304, 195, 2262, 107, 2171, 1204, + /* 1420 */ 289, 1311, 379, 2167, 433, 1315, 1322, 1499, 2083, 1969, + /* 1430 */ 437, 470, 442, 2236, 1494, 223, 1320, 455, 462, 155, + /* 1440 */ 1961, 469, 480, 471, 481, 478, 483, 200, 2083, 484, + /* 1450 */ 171, 199, 639, 202, 486, 488, 526, 522, 518, 514, + /* 1460 */ 220, 2101, 1500, 489, 1502, 498, 501, 1497, 208, 660, + /* 1470 */ 1501, 502, 210, 503, 2051, 1503, 659, 506, 504, 213, + /* 1480 */ 215, 2101, 1176, 84, 85, 510, 527, 276, 531, 660, + /* 1490 */ 529, 528, 275, 219, 2051, 111, 659, 2028, 2025, 339, + /* 1500 */ 1851, 87, 566, 2024, 218, 88, 2082, 571, 1432, 300, + /* 1510 */ 2118, 243, 568, 109, 2084, 663, 2086, 2087, 658, 148, + /* 1520 */ 653, 242, 2083, 225, 1847, 2262, 2082, 2171, 227, 157, + /* 1530 */ 2118, 379, 2167, 109, 2084, 663, 2086, 2087, 658, 158, + /* 1540 */ 653, 1849, 2190, 1845, 570, 2144, 2083, 2171, 159, 160, + /* 1550 */ 572, 379, 2167, 244, 246, 2101, 578, 2202, 2212, 585, + /* 1560 */ 575, 595, 633, 660, 2217, 252, 255, 591, 2051, 368, + /* 1570 */ 659, 217, 211, 598, 7, 604, 216, 586, 505, 2101, + /* 1580 */ 584, 2216, 583, 265, 615, 369, 1615, 660, 612, 2265, + /* 1590 */ 138, 262, 2051, 1498, 659, 209, 2083, 2193, 2187, 623, + /* 1600 */ 2082, 372, 172, 263, 2118, 1504, 260, 109, 2084, 663, + /* 1610 */ 2086, 2087, 658, 2083, 653, 274, 264, 95, 268, 646, + /* 1620 */ 301, 2171, 1974, 2241, 2082, 379, 2167, 636, 2118, 2101, + /* 1630 */ 631, 110, 2084, 663, 2086, 2087, 658, 660, 653, 302, + /* 1640 */ 637, 632, 2051, 1988, 659, 2171, 2101, 97, 1987, 2170, + /* 1650 */ 2167, 303, 1986, 375, 660, 1862, 60, 2152, 99, 2051, + /* 1660 */ 101, 659, 665, 1906, 746, 1824, 295, 306, 747, 310, + /* 1670 */ 749, 341, 50, 2083, 2082, 315, 2043, 308, 2118, 2042, + /* 1680 */ 342, 321, 2084, 663, 2086, 2087, 658, 329, 653, 330, + /* 1690 */ 319, 2082, 2041, 2083, 77, 2118, 2038, 401, 110, 2084, + /* 1700 */ 663, 2086, 2087, 658, 402, 653, 2101, 1462, 1463, 188, + /* 1710 */ 406, 2036, 2171, 408, 660, 409, 648, 2167, 410, 2051, + /* 1720 */ 2035, 659, 412, 2034, 414, 603, 2101, 2033, 416, 2032, + /* 1730 */ 418, 78, 1428, 1427, 660, 2000, 1999, 1998, 426, 2051, + /* 1740 */ 425, 659, 1997, 1996, 1379, 1952, 1951, 1949, 1948, 144, + /* 1750 */ 1947, 661, 1950, 1946, 1945, 2118, 2083, 1943, 110, 2084, + /* 1760 */ 663, 2086, 2087, 658, 1942, 653, 1941, 193, 443, 1940, + /* 1770 */ 445, 2082, 2171, 1954, 1939, 2118, 344, 2167, 169, 2084, + /* 1780 */ 663, 2086, 2087, 658, 1381, 653, 1938, 1937, 1936, 2101, + /* 1790 */ 1935, 1934, 1933, 1932, 374, 1931, 1930, 660, 1929, 1928, + /* 1800 */ 1927, 1926, 2051, 1925, 659, 146, 1924, 1923, 1922, 1953, + /* 1810 */ 1921, 1920, 1919, 1918, 2083, 1917, 473, 1916, 1915, 1254, + /* 1820 */ 337, 338, 1770, 201, 1258, 1769, 203, 1768, 204, 1250, + /* 1830 */ 1766, 2264, 1730, 177, 2082, 1162, 1729, 1161, 2118, 2083, + /* 1840 */ 2015, 328, 2084, 663, 2086, 2087, 658, 2101, 653, 2007, + /* 1850 */ 1995, 2071, 494, 1994, 1972, 657, 206, 1840, 75, 76, + /* 1860 */ 2051, 214, 659, 496, 207, 212, 1765, 1763, 511, 1761, + /* 1870 */ 515, 1759, 2101, 513, 519, 1757, 517, 384, 1744, 512, + /* 1880 */ 660, 523, 521, 525, 1743, 2051, 516, 659, 1726, 520, + /* 1890 */ 1842, 62, 2082, 1196, 1327, 524, 2118, 1841, 1326, 327, + /* 1900 */ 2084, 663, 2086, 2087, 658, 1241, 653, 1240, 2137, 1239, + /* 1910 */ 1755, 1232, 2083, 1748, 1238, 1237, 1234, 2082, 1233, 1746, + /* 1920 */ 1231, 2118, 359, 360, 328, 2084, 663, 2086, 2087, 658, + /* 1930 */ 718, 653, 550, 2083, 361, 720, 224, 553, 1725, 555, + /* 1940 */ 1724, 557, 1723, 559, 112, 2101, 1450, 2014, 26, 1452, + /* 1950 */ 386, 1449, 1454, 660, 1436, 66, 2006, 573, 2051, 1993, + /* 1960 */ 659, 1434, 2083, 1991, 162, 2247, 2101, 19, 16, 1663, + /* 1970 */ 20, 58, 59, 28, 660, 258, 259, 251, 30, 2051, + /* 1980 */ 64, 659, 17, 2083, 2072, 587, 1678, 21, 5, 6, + /* 1990 */ 2082, 589, 1677, 370, 2118, 2101, 253, 328, 2084, 663, + /* 2000 */ 2086, 2087, 658, 660, 653, 1682, 1645, 170, 2051, 257, + /* 2010 */ 659, 565, 271, 55, 1681, 2118, 2101, 29, 323, 2084, + /* 2020 */ 663, 2086, 2087, 658, 660, 653, 574, 579, 371, 2051, + /* 2030 */ 247, 659, 365, 2083, 1637, 57, 91, 173, 1992, 1990, + /* 2040 */ 2082, 1989, 1683, 1971, 2118, 1684, 1612, 312, 2084, 663, + /* 2050 */ 2086, 2087, 658, 1611, 653, 93, 94, 277, 2083, 96, + /* 2060 */ 22, 2082, 278, 1970, 280, 2118, 2101, 1643, 313, 2084, + /* 2070 */ 663, 2086, 2087, 658, 660, 653, 285, 287, 67, 2051, + /* 2080 */ 290, 659, 98, 102, 23, 1564, 634, 1563, 12, 1487, + /* 2090 */ 1519, 2101, 2121, 2083, 174, 1542, 1540, 652, 10, 660, + /* 2100 */ 36, 186, 1539, 15, 2051, 24, 659, 1574, 1511, 25, + /* 2110 */ 56, 2082, 1312, 662, 666, 2118, 2083, 664, 314, 2084, + /* 2120 */ 663, 2086, 2087, 658, 387, 653, 2101, 668, 670, 1309, + /* 2130 */ 671, 673, 1306, 1300, 660, 674, 2082, 676, 1298, 2051, + /* 2140 */ 2118, 659, 677, 320, 2084, 663, 2086, 2087, 658, 2101, + /* 2150 */ 653, 679, 680, 1289, 293, 103, 104, 660, 1321, 1304, + /* 2160 */ 686, 74, 2051, 1317, 659, 1194, 1248, 1303, 1302, 1301, + /* 2170 */ 696, 2082, 1228, 1227, 2083, 2118, 708, 1226, 324, 2084, + /* 2180 */ 663, 2086, 2087, 658, 1225, 653, 1224, 1223, 1221, 1219, + /* 2190 */ 1218, 1217, 294, 2083, 2082, 1215, 1214, 1213, 2118, 1212, + /* 2200 */ 1211, 316, 2084, 663, 2086, 2087, 658, 2101, 653, 1210, + /* 2210 */ 1245, 1209, 1200, 1243, 1206, 660, 1205, 1202, 1201, 1199, + /* 2220 */ 2051, 1762, 659, 728, 730, 1760, 2101, 732, 729, 1758, + /* 2230 */ 734, 736, 738, 1756, 660, 733, 740, 737, 742, 2051, + /* 2240 */ 1742, 659, 741, 744, 1151, 1722, 297, 748, 1697, 1473, + /* 2250 */ 307, 751, 2082, 1697, 2083, 1697, 2118, 752, 1697, 325, + /* 2260 */ 2084, 663, 2086, 2087, 658, 1697, 653, 1697, 1697, 1697, + /* 2270 */ 1697, 2082, 1697, 1697, 1697, 2118, 1697, 1697, 317, 2084, + /* 2280 */ 663, 2086, 2087, 658, 1697, 653, 1697, 2101, 1697, 1697, + /* 2290 */ 1697, 1697, 1697, 1697, 1697, 660, 1697, 1697, 1697, 1697, + /* 2300 */ 2051, 1697, 659, 1697, 1697, 1697, 1697, 1697, 1697, 1697, + /* 2310 */ 1697, 1697, 2083, 1697, 1697, 1697, 1697, 1697, 1697, 1697, + /* 2320 */ 1697, 1697, 1697, 1697, 1697, 1697, 1697, 1697, 2083, 1697, + /* 2330 */ 1697, 1697, 2082, 1697, 1697, 1697, 2118, 1697, 1697, 326, + /* 2340 */ 2084, 663, 2086, 2087, 658, 2101, 653, 1697, 1697, 1697, + /* 2350 */ 1697, 1697, 1697, 660, 1697, 1697, 1697, 1697, 2051, 1697, + /* 2360 */ 659, 2101, 1697, 1697, 1697, 1697, 1697, 1697, 1697, 660, + /* 2370 */ 1697, 1697, 1697, 1697, 2051, 1697, 659, 1697, 1697, 1697, + /* 2380 */ 1697, 1697, 1697, 1697, 1697, 1697, 1697, 1697, 1697, 1697, + /* 2390 */ 2082, 2083, 1697, 1697, 2118, 1697, 1697, 318, 2084, 663, + /* 2400 */ 2086, 2087, 658, 1697, 653, 1697, 2082, 2083, 1697, 1697, + /* 2410 */ 2118, 1697, 1697, 331, 2084, 663, 2086, 2087, 658, 1697, + /* 2420 */ 653, 1697, 1697, 1697, 2101, 1697, 2083, 1697, 1697, 1697, + /* 2430 */ 1697, 1697, 660, 1697, 1697, 1697, 1697, 2051, 1697, 659, + /* 2440 */ 2101, 1697, 1697, 1697, 1697, 1697, 1697, 1697, 660, 1697, + /* 2450 */ 1697, 1697, 1697, 2051, 1697, 659, 1697, 1697, 1697, 2101, + /* 2460 */ 1697, 1697, 1697, 1697, 1697, 1697, 1697, 660, 1697, 2082, + /* 2470 */ 1697, 1697, 2051, 2118, 659, 1697, 332, 2084, 663, 2086, + /* 2480 */ 2087, 658, 1697, 653, 1697, 2082, 1697, 1697, 1697, 2118, + /* 2490 */ 2083, 1697, 2095, 2084, 663, 2086, 2087, 658, 1697, 653, + /* 2500 */ 1697, 1697, 1697, 1697, 2082, 1697, 1697, 2083, 2118, 1697, + /* 2510 */ 1697, 2094, 2084, 663, 2086, 2087, 658, 1697, 653, 1697, + /* 2520 */ 1697, 1697, 1697, 2101, 1697, 1697, 1697, 1697, 1697, 1697, + /* 2530 */ 1697, 660, 1697, 1697, 1697, 1697, 2051, 1697, 659, 1697, + /* 2540 */ 2101, 1697, 1697, 1697, 1697, 1697, 1697, 1697, 660, 1697, + /* 2550 */ 1697, 1697, 1697, 2051, 1697, 659, 1697, 1697, 1697, 1697, + /* 2560 */ 1697, 1697, 1697, 1697, 1697, 1697, 1697, 2083, 2082, 1697, + /* 2570 */ 1697, 1697, 2118, 1697, 1697, 2093, 2084, 663, 2086, 2087, + /* 2580 */ 658, 1697, 653, 1697, 1697, 2082, 1697, 2083, 1697, 2118, + /* 2590 */ 1697, 1697, 346, 2084, 663, 2086, 2087, 658, 1697, 653, + /* 2600 */ 2101, 1697, 1697, 1697, 1697, 1697, 1697, 1697, 660, 1697, + /* 2610 */ 1697, 1697, 1697, 2051, 1697, 659, 1697, 1697, 1697, 1697, + /* 2620 */ 2101, 1697, 1697, 1697, 1697, 1697, 1697, 1697, 660, 1697, + /* 2630 */ 1697, 1697, 1697, 2051, 1697, 659, 1697, 1697, 1697, 1697, + /* 2640 */ 1697, 1697, 1697, 1697, 1697, 2082, 1697, 1697, 1697, 2118, + /* 2650 */ 1697, 1697, 347, 2084, 663, 2086, 2087, 658, 1697, 653, + /* 2660 */ 1697, 2083, 1697, 1697, 1697, 2082, 1697, 1697, 1697, 2118, + /* 2670 */ 1697, 1697, 343, 2084, 663, 2086, 2087, 658, 2083, 653, + /* 2680 */ 1697, 1697, 1697, 1697, 1697, 1697, 1697, 1697, 1697, 1697, + /* 2690 */ 1697, 1697, 1697, 1697, 2101, 1697, 1697, 1697, 1697, 1697, + /* 2700 */ 1697, 1697, 660, 1697, 1697, 1697, 1697, 2051, 1697, 659, + /* 2710 */ 1697, 2101, 1697, 1697, 1697, 1697, 1697, 1697, 1697, 660, + /* 2720 */ 1697, 1697, 1697, 1697, 2051, 1697, 659, 1697, 1697, 1697, + /* 2730 */ 1697, 1697, 1697, 1697, 1697, 1697, 1697, 1697, 1697, 2082, + /* 2740 */ 2083, 1697, 1697, 2118, 1697, 1697, 348, 2084, 663, 2086, + /* 2750 */ 2087, 658, 1697, 653, 1697, 1697, 661, 1697, 1697, 1697, + /* 2760 */ 2118, 1697, 1697, 323, 2084, 663, 2086, 2087, 658, 1697, + /* 2770 */ 653, 1697, 1697, 2101, 1697, 1697, 1697, 1697, 1697, 1697, + /* 2780 */ 1697, 660, 1697, 1697, 1697, 1697, 2051, 1697, 659, 1697, + /* 2790 */ 1697, 1697, 1697, 1697, 1697, 1697, 1697, 1697, 1697, 1697, + /* 2800 */ 1697, 1697, 1697, 1697, 1697, 1697, 1697, 1697, 1697, 1697, + /* 2810 */ 1697, 1697, 1697, 1697, 1697, 1697, 1697, 1697, 2082, 1697, + /* 2820 */ 1697, 1697, 2118, 1697, 1697, 322, 2084, 663, 2086, 2087, + /* 2830 */ 658, 1697, 653, }; static const YYCODETYPE yy_lookahead[] = { - /* 0 */ 336, 355, 338, 339, 371, 336, 365, 338, 339, 363, - /* 10 */ 430, 431, 12, 13, 14, 382, 370, 376, 372, 362, - /* 20 */ 20, 20, 22, 8, 9, 379, 332, 12, 13, 14, - /* 30 */ 15, 16, 375, 33, 374, 35, 441, 377, 378, 20, - /* 40 */ 445, 337, 8, 9, 340, 341, 12, 13, 14, 15, - /* 50 */ 16, 0, 411, 412, 395, 340, 461, 363, 58, 44, - /* 60 */ 465, 466, 14, 422, 64, 371, 4, 414, 20, 363, - /* 70 */ 376, 71, 378, 378, 20, 24, 25, 26, 27, 28, - /* 80 */ 29, 30, 31, 32, 12, 13, 371, 20, 393, 394, - /* 90 */ 384, 385, 20, 440, 22, 58, 96, 96, 64, 20, - /* 100 */ 441, 363, 408, 63, 445, 33, 412, 35, 370, 415, - /* 110 */ 416, 417, 418, 419, 420, 344, 422, 379, 118, 460, - /* 120 */ 461, 427, 340, 429, 465, 466, 20, 433, 434, 358, - /* 130 */ 58, 365, 95, 133, 134, 98, 64, 366, 20, 105, - /* 140 */ 20, 447, 376, 71, 12, 13, 14, 15, 16, 455, - /* 150 */ 347, 80, 437, 438, 439, 352, 441, 442, 96, 22, - /* 160 */ 445, 20, 380, 163, 164, 355, 340, 441, 96, 169, - /* 170 */ 170, 445, 35, 363, 0, 460, 461, 411, 412, 441, - /* 180 */ 465, 466, 372, 445, 184, 363, 186, 461, 422, 0, - /* 190 */ 118, 465, 466, 371, 377, 378, 162, 371, 460, 461, - /* 200 */ 133, 134, 96, 465, 466, 133, 134, 14, 71, 138, - /* 210 */ 139, 211, 212, 20, 214, 215, 216, 217, 218, 219, + /* 0 */ 367, 443, 380, 347, 332, 447, 336, 365, 338, 339, + /* 10 */ 354, 378, 12, 13, 14, 373, 380, 395, 396, 367, + /* 20 */ 20, 463, 22, 340, 20, 467, 468, 332, 392, 416, + /* 30 */ 378, 395, 396, 33, 361, 35, 0, 365, 12, 13, + /* 40 */ 14, 15, 16, 340, 20, 373, 413, 414, 415, 20, + /* 50 */ 378, 22, 380, 340, 340, 442, 373, 424, 58, 443, + /* 60 */ 365, 419, 365, 447, 64, 413, 414, 415, 373, 372, + /* 70 */ 356, 71, 331, 378, 333, 380, 424, 363, 381, 463, + /* 80 */ 51, 408, 410, 467, 468, 382, 414, 373, 20, 417, + /* 90 */ 418, 419, 420, 421, 422, 367, 424, 97, 4, 63, + /* 100 */ 100, 429, 389, 431, 391, 410, 378, 435, 436, 414, + /* 110 */ 12, 13, 417, 418, 419, 420, 421, 422, 20, 424, + /* 120 */ 22, 449, 439, 440, 441, 332, 443, 444, 111, 457, + /* 130 */ 447, 33, 20, 35, 22, 376, 136, 137, 379, 380, + /* 140 */ 443, 413, 414, 415, 447, 462, 463, 35, 432, 433, + /* 150 */ 467, 468, 424, 458, 459, 58, 58, 0, 20, 462, + /* 160 */ 463, 20, 64, 51, 467, 468, 166, 167, 100, 71, + /* 170 */ 0, 378, 172, 173, 8, 9, 364, 160, 12, 13, + /* 180 */ 14, 15, 16, 66, 67, 68, 186, 63, 188, 377, + /* 190 */ 73, 74, 75, 365, 100, 97, 79, 100, 100, 102, + /* 200 */ 14, 84, 85, 100, 8, 9, 20, 90, 12, 13, + /* 210 */ 14, 15, 16, 213, 214, 387, 216, 217, 218, 219, /* 220 */ 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, - /* 230 */ 230, 231, 161, 349, 350, 163, 164, 63, 340, 417, - /* 240 */ 21, 169, 170, 24, 25, 26, 27, 28, 29, 30, - /* 250 */ 31, 32, 354, 349, 350, 118, 184, 337, 186, 361, - /* 260 */ 340, 341, 436, 437, 438, 439, 340, 441, 442, 371, - /* 270 */ 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, - /* 280 */ 246, 163, 164, 211, 212, 165, 214, 215, 216, 217, - /* 290 */ 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, - /* 300 */ 228, 229, 230, 231, 163, 233, 12, 13, 0, 20, - /* 310 */ 378, 249, 363, 387, 20, 389, 22, 332, 211, 370, - /* 320 */ 332, 184, 390, 186, 20, 393, 394, 33, 379, 35, - /* 330 */ 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, - /* 340 */ 119, 152, 121, 122, 123, 124, 125, 126, 211, 212, - /* 350 */ 161, 363, 58, 332, 20, 249, 163, 20, 64, 371, - /* 360 */ 20, 376, 22, 340, 376, 71, 378, 260, 261, 262, - /* 370 */ 263, 264, 265, 266, 66, 67, 68, 354, 12, 13, - /* 380 */ 14, 63, 74, 75, 361, 96, 20, 79, 22, 359, - /* 390 */ 96, 51, 84, 85, 371, 168, 408, 376, 90, 33, - /* 400 */ 412, 35, 363, 415, 416, 417, 418, 419, 420, 370, - /* 410 */ 422, 4, 118, 425, 0, 427, 428, 429, 379, 2, - /* 420 */ 340, 433, 434, 96, 58, 8, 9, 133, 134, 12, - /* 430 */ 13, 14, 15, 16, 354, 21, 406, 71, 24, 25, - /* 440 */ 26, 27, 28, 29, 30, 31, 32, 66, 67, 68, - /* 450 */ 43, 371, 45, 46, 71, 74, 75, 163, 164, 162, - /* 460 */ 79, 35, 96, 169, 170, 84, 85, 133, 134, 8, - /* 470 */ 9, 90, 107, 12, 13, 14, 15, 16, 184, 346, - /* 480 */ 186, 254, 255, 256, 118, 8, 9, 58, 58, 12, - /* 490 */ 13, 14, 15, 16, 395, 96, 395, 71, 399, 133, - /* 500 */ 134, 14, 369, 169, 170, 211, 212, 20, 214, 215, - /* 510 */ 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, - /* 520 */ 226, 227, 228, 229, 230, 231, 96, 98, 98, 163, - /* 530 */ 164, 179, 44, 236, 19, 169, 170, 128, 249, 3, - /* 540 */ 441, 132, 441, 246, 445, 0, 445, 331, 33, 333, - /* 550 */ 184, 107, 186, 363, 202, 203, 20, 344, 97, 460, - /* 560 */ 461, 460, 461, 48, 465, 466, 465, 466, 340, 54, - /* 570 */ 55, 56, 57, 58, 97, 385, 249, 211, 212, 366, - /* 580 */ 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, - /* 590 */ 224, 225, 226, 227, 228, 229, 230, 231, 12, 13, - /* 600 */ 340, 192, 193, 33, 363, 196, 20, 198, 22, 346, - /* 610 */ 95, 370, 332, 98, 20, 387, 22, 389, 48, 33, - /* 620 */ 379, 35, 233, 360, 54, 55, 56, 57, 58, 35, - /* 630 */ 8, 9, 369, 97, 12, 13, 14, 15, 16, 71, - /* 640 */ 4, 332, 20, 363, 58, 51, 131, 387, 249, 389, - /* 650 */ 163, 371, 340, 108, 22, 19, 376, 71, 378, 127, - /* 660 */ 128, 14, 15, 16, 132, 95, 354, 35, 98, 33, - /* 670 */ 12, 13, 127, 128, 129, 130, 131, 132, 20, 249, - /* 680 */ 22, 166, 96, 371, 48, 376, 171, 340, 408, 53, - /* 690 */ 364, 33, 412, 35, 58, 415, 416, 417, 418, 419, - /* 700 */ 420, 165, 422, 188, 118, 364, 191, 427, 340, 429, - /* 710 */ 364, 340, 340, 433, 434, 233, 58, 235, 371, 133, - /* 720 */ 134, 426, 354, 428, 363, 354, 354, 371, 441, 71, - /* 730 */ 400, 95, 445, 332, 98, 455, 166, 167, 382, 371, - /* 740 */ 379, 171, 371, 371, 174, 333, 371, 460, 461, 163, - /* 750 */ 164, 127, 465, 466, 96, 169, 170, 382, 21, 8, - /* 760 */ 9, 191, 274, 12, 13, 14, 15, 16, 2, 37, - /* 770 */ 184, 34, 186, 36, 8, 9, 118, 376, 12, 13, - /* 780 */ 14, 15, 16, 363, 437, 438, 439, 165, 441, 442, - /* 790 */ 370, 133, 134, 329, 414, 395, 364, 211, 212, 379, - /* 800 */ 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, - /* 810 */ 224, 225, 226, 227, 228, 229, 230, 231, 194, 195, - /* 820 */ 440, 163, 164, 18, 414, 20, 373, 169, 170, 376, - /* 830 */ 364, 99, 27, 101, 102, 30, 104, 340, 33, 355, - /* 840 */ 108, 441, 184, 425, 186, 445, 428, 363, 332, 332, - /* 850 */ 440, 354, 96, 48, 373, 50, 372, 376, 53, 395, - /* 860 */ 460, 461, 130, 399, 373, 465, 466, 376, 371, 211, - /* 870 */ 212, 332, 214, 215, 216, 217, 218, 219, 220, 221, - /* 880 */ 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, - /* 890 */ 355, 44, 376, 376, 18, 0, 332, 340, 363, 23, - /* 900 */ 95, 0, 0, 3, 426, 441, 428, 372, 64, 445, - /* 910 */ 363, 354, 107, 37, 38, 376, 4, 41, 356, 372, - /* 920 */ 351, 359, 353, 364, 460, 461, 39, 176, 371, 465, - /* 930 */ 466, 1, 2, 45, 46, 59, 60, 61, 62, 183, - /* 940 */ 376, 185, 137, 48, 97, 140, 141, 142, 143, 144, - /* 950 */ 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, - /* 960 */ 155, 156, 332, 158, 159, 160, 210, 66, 67, 68, - /* 970 */ 69, 70, 96, 72, 73, 74, 75, 76, 77, 78, - /* 980 */ 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, - /* 990 */ 89, 90, 91, 92, 8, 9, 352, 340, 12, 13, - /* 1000 */ 14, 15, 16, 20, 364, 249, 376, 332, 8, 9, - /* 1010 */ 108, 135, 12, 13, 14, 15, 16, 386, 108, 332, - /* 1020 */ 107, 332, 395, 44, 108, 332, 275, 97, 371, 127, - /* 1030 */ 128, 129, 130, 131, 132, 340, 340, 127, 128, 129, - /* 1040 */ 130, 131, 132, 469, 340, 340, 130, 340, 340, 354, - /* 1050 */ 354, 376, 176, 177, 178, 211, 363, 181, 354, 354, - /* 1060 */ 340, 354, 354, 376, 371, 376, 371, 371, 441, 376, - /* 1070 */ 157, 378, 445, 458, 354, 371, 371, 201, 371, 371, - /* 1080 */ 204, 342, 206, 207, 208, 209, 210, 460, 461, 452, - /* 1090 */ 340, 371, 465, 466, 437, 438, 439, 332, 441, 442, - /* 1100 */ 340, 408, 340, 332, 354, 412, 332, 365, 415, 416, - /* 1110 */ 417, 418, 419, 420, 354, 422, 354, 20, 376, 332, - /* 1120 */ 427, 371, 429, 0, 332, 249, 433, 434, 342, 340, - /* 1130 */ 332, 371, 332, 371, 363, 248, 332, 444, 247, 248, - /* 1140 */ 332, 376, 371, 354, 42, 22, 44, 376, 165, 378, - /* 1150 */ 376, 165, 0, 411, 412, 413, 42, 197, 44, 199, - /* 1160 */ 371, 365, 250, 376, 422, 35, 100, 363, 376, 103, - /* 1170 */ 270, 386, 376, 35, 376, 371, 376, 0, 100, 408, - /* 1180 */ 376, 103, 378, 412, 376, 363, 415, 416, 417, 418, - /* 1190 */ 419, 420, 100, 422, 100, 103, 44, 103, 427, 22, - /* 1200 */ 429, 339, 44, 332, 433, 434, 365, 411, 412, 413, - /* 1210 */ 0, 44, 408, 44, 44, 444, 412, 376, 422, 415, - /* 1220 */ 416, 417, 418, 419, 420, 44, 422, 44, 133, 134, - /* 1230 */ 375, 427, 22, 429, 363, 12, 13, 433, 434, 44, - /* 1240 */ 1, 2, 371, 386, 44, 22, 443, 376, 444, 378, - /* 1250 */ 165, 272, 411, 412, 413, 97, 33, 172, 35, 47, - /* 1260 */ 44, 96, 165, 422, 97, 44, 97, 97, 332, 44, - /* 1270 */ 44, 106, 44, 44, 44, 462, 44, 44, 97, 408, - /* 1280 */ 97, 58, 44, 412, 44, 35, 415, 416, 417, 418, - /* 1290 */ 419, 420, 97, 422, 71, 13, 435, 97, 427, 363, - /* 1300 */ 429, 332, 446, 251, 433, 434, 13, 371, 96, 410, - /* 1310 */ 48, 182, 376, 97, 378, 444, 186, 35, 97, 0, - /* 1320 */ 409, 71, 97, 97, 186, 97, 97, 97, 35, 97, - /* 1330 */ 97, 397, 363, 42, 383, 97, 386, 97, 20, 383, - /* 1340 */ 371, 118, 162, 381, 408, 376, 20, 378, 412, 340, - /* 1350 */ 340, 415, 416, 417, 418, 419, 420, 383, 422, 381, - /* 1360 */ 340, 381, 94, 427, 348, 429, 340, 340, 49, 433, - /* 1370 */ 434, 340, 20, 334, 334, 20, 403, 408, 346, 20, - /* 1380 */ 444, 412, 378, 346, 415, 416, 417, 418, 419, 420, - /* 1390 */ 20, 422, 341, 20, 396, 346, 427, 332, 429, 341, - /* 1400 */ 346, 346, 433, 434, 340, 346, 346, 184, 52, 186, - /* 1410 */ 343, 343, 340, 334, 334, 200, 363, 376, 376, 363, - /* 1420 */ 363, 376, 407, 96, 363, 363, 363, 405, 363, 340, - /* 1430 */ 344, 403, 363, 363, 211, 212, 371, 363, 363, 363, - /* 1440 */ 402, 376, 190, 378, 189, 401, 259, 224, 225, 226, - /* 1450 */ 227, 228, 229, 230, 344, 378, 451, 386, 332, 386, - /* 1460 */ 376, 258, 451, 376, 376, 267, 376, 454, 450, 175, - /* 1470 */ 453, 269, 391, 408, 391, 451, 268, 412, 449, 252, - /* 1480 */ 415, 416, 417, 418, 419, 420, 273, 422, 271, 363, - /* 1490 */ 276, 448, 427, 470, 429, 248, 463, 371, 433, 434, - /* 1500 */ 464, 410, 376, 371, 378, 20, 340, 414, 332, 341, - /* 1510 */ 389, 20, 376, 391, 167, 344, 344, 376, 376, 376, - /* 1520 */ 376, 376, 391, 388, 371, 376, 344, 96, 344, 96, - /* 1530 */ 432, 332, 359, 340, 408, 344, 36, 398, 412, 363, - /* 1540 */ 335, 415, 416, 417, 418, 419, 420, 371, 422, 353, - /* 1550 */ 404, 392, 376, 427, 378, 429, 367, 0, 334, 433, - /* 1560 */ 434, 357, 363, 357, 357, 345, 392, 330, 0, 0, - /* 1570 */ 371, 42, 0, 35, 205, 376, 35, 378, 35, 35, - /* 1580 */ 205, 332, 0, 35, 408, 35, 205, 0, 412, 205, - /* 1590 */ 0, 415, 416, 417, 418, 419, 420, 35, 422, 0, - /* 1600 */ 22, 0, 35, 192, 186, 429, 184, 408, 0, 433, - /* 1610 */ 434, 412, 363, 0, 415, 416, 417, 418, 419, 420, - /* 1620 */ 371, 422, 0, 180, 179, 376, 0, 378, 429, 0, - /* 1630 */ 47, 332, 433, 434, 0, 0, 0, 42, 0, 0, - /* 1640 */ 0, 0, 0, 0, 0, 0, 152, 35, 332, 0, - /* 1650 */ 152, 0, 0, 0, 0, 0, 0, 408, 0, 0, - /* 1660 */ 0, 412, 363, 0, 415, 416, 417, 418, 419, 420, - /* 1670 */ 371, 422, 0, 0, 0, 376, 0, 378, 429, 363, - /* 1680 */ 0, 0, 433, 434, 0, 0, 0, 371, 42, 0, - /* 1690 */ 0, 0, 376, 22, 378, 136, 0, 0, 332, 0, - /* 1700 */ 0, 0, 0, 35, 0, 58, 58, 408, 0, 0, - /* 1710 */ 0, 412, 42, 44, 415, 416, 417, 418, 419, 420, - /* 1720 */ 421, 422, 423, 424, 408, 58, 39, 14, 412, 363, - /* 1730 */ 47, 415, 416, 417, 418, 419, 420, 371, 422, 47, - /* 1740 */ 14, 47, 376, 0, 378, 40, 39, 0, 0, 0, - /* 1750 */ 39, 175, 0, 0, 0, 0, 0, 35, 65, 39, - /* 1760 */ 0, 332, 48, 35, 48, 0, 39, 35, 39, 48, - /* 1770 */ 0, 35, 456, 457, 408, 0, 39, 0, 412, 48, - /* 1780 */ 0, 415, 416, 417, 418, 419, 420, 0, 422, 22, - /* 1790 */ 0, 0, 363, 105, 35, 44, 35, 35, 35, 35, - /* 1800 */ 371, 103, 44, 35, 35, 376, 22, 378, 35, 0, - /* 1810 */ 22, 22, 0, 35, 22, 0, 50, 35, 0, 0, - /* 1820 */ 35, 22, 332, 20, 0, 0, 165, 22, 22, 35, - /* 1830 */ 35, 35, 97, 467, 468, 96, 96, 408, 0, 35, - /* 1840 */ 165, 412, 0, 165, 415, 416, 417, 418, 419, 420, - /* 1850 */ 173, 422, 187, 363, 3, 44, 253, 232, 429, 257, - /* 1860 */ 44, 371, 253, 434, 44, 44, 376, 96, 378, 97, - /* 1870 */ 167, 97, 332, 97, 47, 96, 47, 96, 172, 96, - /* 1880 */ 44, 3, 96, 44, 253, 35, 0, 172, 332, 44, - /* 1890 */ 35, 35, 35, 35, 97, 97, 96, 35, 408, 97, - /* 1900 */ 47, 0, 412, 363, 97, 415, 416, 417, 418, 419, - /* 1910 */ 420, 371, 422, 247, 97, 47, 376, 0, 378, 363, - /* 1920 */ 0, 39, 96, 47, 96, 168, 96, 371, 97, 97, - /* 1930 */ 96, 96, 376, 0, 378, 39, 96, 47, 44, 106, - /* 1940 */ 2, 22, 96, 96, 211, 97, 97, 457, 408, 332, - /* 1950 */ 232, 234, 412, 47, 47, 415, 416, 417, 418, 419, - /* 1960 */ 420, 96, 422, 97, 408, 332, 232, 166, 412, 96, - /* 1970 */ 96, 415, 416, 417, 418, 419, 420, 97, 422, 22, - /* 1980 */ 363, 96, 107, 35, 97, 368, 35, 96, 371, 97, - /* 1990 */ 35, 96, 120, 376, 97, 378, 363, 35, 96, 459, - /* 2000 */ 97, 35, 97, 35, 371, 96, 96, 22, 120, 376, - /* 2010 */ 96, 378, 108, 120, 44, 35, 22, 96, 120, 96, - /* 2020 */ 64, 213, 35, 65, 468, 408, 35, 332, 35, 412, - /* 2030 */ 35, 35, 415, 416, 417, 418, 419, 420, 35, 422, - /* 2040 */ 71, 408, 35, 35, 332, 412, 35, 35, 415, 416, - /* 2050 */ 417, 418, 419, 420, 93, 422, 35, 424, 363, 44, - /* 2060 */ 35, 35, 332, 368, 22, 35, 371, 35, 35, 71, - /* 2070 */ 35, 376, 35, 378, 35, 363, 35, 22, 35, 35, - /* 2080 */ 368, 0, 35, 371, 48, 39, 0, 35, 376, 39, - /* 2090 */ 378, 0, 35, 363, 0, 39, 48, 48, 39, 35, - /* 2100 */ 0, 371, 48, 408, 35, 35, 376, 412, 378, 0, - /* 2110 */ 415, 416, 417, 418, 419, 420, 21, 422, 22, 22, - /* 2120 */ 408, 22, 21, 20, 412, 332, 471, 415, 416, 417, - /* 2130 */ 418, 419, 420, 471, 422, 471, 471, 471, 408, 471, - /* 2140 */ 471, 471, 412, 471, 471, 415, 416, 417, 418, 419, - /* 2150 */ 420, 471, 422, 471, 471, 471, 363, 471, 471, 471, - /* 2160 */ 471, 471, 471, 471, 371, 471, 471, 471, 471, 376, - /* 2170 */ 471, 378, 471, 471, 471, 471, 471, 471, 471, 471, - /* 2180 */ 471, 471, 471, 471, 471, 471, 332, 471, 471, 471, - /* 2190 */ 471, 471, 471, 471, 471, 471, 471, 471, 471, 471, - /* 2200 */ 471, 408, 471, 471, 471, 412, 471, 471, 415, 416, - /* 2210 */ 417, 418, 419, 420, 471, 422, 471, 363, 471, 471, - /* 2220 */ 471, 332, 471, 471, 471, 371, 471, 471, 471, 471, - /* 2230 */ 376, 471, 378, 471, 471, 471, 471, 471, 471, 471, - /* 2240 */ 471, 471, 471, 471, 332, 471, 471, 471, 471, 471, - /* 2250 */ 471, 471, 363, 471, 471, 471, 471, 471, 471, 471, - /* 2260 */ 371, 471, 408, 471, 471, 376, 412, 378, 471, 415, - /* 2270 */ 416, 417, 418, 419, 420, 363, 422, 471, 471, 471, - /* 2280 */ 471, 471, 471, 371, 471, 471, 471, 471, 376, 471, - /* 2290 */ 378, 471, 471, 471, 471, 471, 471, 408, 471, 471, - /* 2300 */ 471, 412, 471, 471, 415, 416, 417, 418, 419, 420, - /* 2310 */ 471, 422, 471, 332, 471, 471, 471, 471, 471, 471, - /* 2320 */ 408, 471, 471, 471, 412, 471, 471, 415, 416, 417, - /* 2330 */ 418, 419, 420, 471, 422, 471, 471, 332, 471, 471, - /* 2340 */ 471, 471, 471, 471, 363, 471, 471, 471, 471, 471, - /* 2350 */ 471, 471, 371, 471, 471, 471, 471, 376, 471, 378, - /* 2360 */ 471, 471, 471, 471, 471, 471, 471, 471, 363, 471, - /* 2370 */ 471, 471, 471, 471, 471, 471, 371, 471, 471, 471, - /* 2380 */ 471, 376, 471, 378, 471, 471, 471, 471, 471, 408, - /* 2390 */ 471, 471, 471, 412, 471, 332, 415, 416, 417, 418, - /* 2400 */ 419, 420, 471, 422, 471, 471, 471, 471, 471, 471, - /* 2410 */ 471, 471, 471, 408, 471, 471, 332, 412, 471, 471, - /* 2420 */ 415, 416, 417, 418, 419, 420, 363, 422, 471, 471, - /* 2430 */ 471, 471, 471, 471, 371, 471, 471, 471, 471, 376, - /* 2440 */ 471, 378, 471, 471, 471, 332, 471, 363, 471, 471, - /* 2450 */ 471, 471, 471, 471, 471, 371, 471, 471, 471, 471, - /* 2460 */ 376, 471, 378, 471, 471, 471, 471, 471, 471, 471, - /* 2470 */ 471, 408, 471, 471, 471, 412, 363, 471, 415, 416, - /* 2480 */ 417, 418, 419, 420, 371, 422, 471, 471, 471, 376, - /* 2490 */ 471, 378, 408, 471, 471, 471, 412, 471, 471, 415, - /* 2500 */ 416, 417, 418, 419, 420, 471, 422, 471, 471, 471, - /* 2510 */ 471, 471, 471, 471, 471, 471, 471, 471, 471, 332, - /* 2520 */ 471, 408, 471, 471, 471, 412, 471, 471, 415, 416, - /* 2530 */ 417, 418, 419, 420, 471, 422, 471, 471, 332, 471, - /* 2540 */ 471, 471, 471, 471, 471, 471, 471, 471, 471, 471, - /* 2550 */ 363, 471, 471, 471, 332, 471, 471, 471, 371, 471, - /* 2560 */ 471, 471, 471, 376, 471, 378, 471, 471, 471, 363, - /* 2570 */ 471, 471, 471, 471, 471, 471, 471, 371, 471, 471, - /* 2580 */ 471, 471, 376, 471, 378, 363, 471, 471, 471, 471, - /* 2590 */ 471, 471, 471, 371, 471, 408, 471, 471, 376, 412, - /* 2600 */ 378, 471, 415, 416, 417, 418, 419, 420, 471, 422, - /* 2610 */ 471, 471, 471, 471, 408, 471, 332, 471, 412, 471, - /* 2620 */ 471, 415, 416, 417, 418, 419, 420, 471, 422, 471, - /* 2630 */ 408, 471, 471, 471, 412, 471, 471, 415, 416, 417, - /* 2640 */ 418, 419, 420, 471, 422, 471, 471, 363, 471, 471, - /* 2650 */ 471, 471, 471, 471, 471, 371, 471, 471, 471, 471, - /* 2660 */ 376, 471, 378, 471, 471, 471, 471, 471, 471, 471, - /* 2670 */ 471, 471, 471, 471, 471, 471, 471, 332, 471, 471, - /* 2680 */ 471, 471, 471, 471, 471, 471, 471, 471, 471, 471, - /* 2690 */ 471, 471, 408, 471, 471, 471, 412, 471, 471, 415, - /* 2700 */ 416, 417, 418, 419, 420, 471, 422, 471, 363, 471, - /* 2710 */ 471, 471, 471, 471, 471, 471, 371, 471, 471, 471, - /* 2720 */ 471, 376, 471, 378, 471, 471, 471, 471, 471, 471, - /* 2730 */ 471, 471, 471, 471, 471, 471, 471, 471, 471, 471, - /* 2740 */ 471, 471, 471, 471, 471, 471, 332, 471, 471, 471, - /* 2750 */ 471, 471, 471, 408, 471, 471, 471, 412, 471, 471, - /* 2760 */ 415, 416, 417, 418, 419, 420, 471, 422, 471, 471, - /* 2770 */ 471, 471, 332, 471, 471, 471, 471, 363, 471, 471, - /* 2780 */ 471, 471, 471, 471, 471, 371, 471, 471, 471, 471, - /* 2790 */ 376, 471, 378, 471, 471, 471, 471, 471, 471, 471, - /* 2800 */ 471, 471, 471, 363, 471, 471, 471, 471, 471, 471, - /* 2810 */ 471, 371, 471, 471, 471, 471, 376, 471, 378, 471, - /* 2820 */ 471, 471, 408, 471, 471, 471, 412, 471, 471, 415, - /* 2830 */ 416, 417, 418, 419, 420, 332, 422, 471, 471, 471, - /* 2840 */ 471, 471, 471, 471, 471, 471, 471, 471, 408, 471, - /* 2850 */ 471, 471, 412, 471, 332, 415, 416, 417, 418, 419, - /* 2860 */ 420, 471, 422, 471, 471, 471, 363, 471, 471, 471, - /* 2870 */ 471, 471, 471, 471, 371, 471, 471, 471, 471, 376, - /* 2880 */ 471, 378, 471, 471, 471, 363, 471, 471, 471, 471, - /* 2890 */ 471, 471, 471, 371, 471, 471, 471, 471, 376, 471, - /* 2900 */ 378, 471, 471, 471, 471, 471, 471, 471, 471, 471, - /* 2910 */ 471, 408, 471, 471, 471, 412, 471, 332, 415, 416, - /* 2920 */ 417, 418, 419, 420, 471, 422, 471, 471, 471, 471, - /* 2930 */ 408, 471, 471, 332, 412, 471, 471, 415, 416, 417, - /* 2940 */ 418, 419, 420, 471, 422, 471, 471, 471, 363, 471, - /* 2950 */ 471, 471, 471, 471, 471, 471, 371, 471, 471, 471, - /* 2960 */ 471, 376, 471, 378, 363, 471, 471, 471, 471, 471, - /* 2970 */ 471, 471, 371, 471, 471, 471, 471, 376, 471, 378, - /* 2980 */ 471, 471, 471, 471, 471, 471, 471, 471, 471, 471, - /* 2990 */ 471, 471, 471, 408, 471, 332, 471, 412, 471, 471, - /* 3000 */ 415, 416, 417, 418, 419, 420, 471, 422, 471, 408, - /* 3010 */ 471, 471, 471, 412, 471, 471, 415, 416, 417, 418, - /* 3020 */ 419, 420, 471, 422, 471, 471, 363, 471, 471, 471, - /* 3030 */ 471, 471, 471, 471, 371, 471, 471, 471, 471, 376, - /* 3040 */ 471, 378, 471, 471, 471, 471, 471, 471, 471, 471, - /* 3050 */ 471, 471, 471, 471, 471, 471, 471, 471, 471, 471, - /* 3060 */ 471, 471, 471, 471, 471, 471, 471, 471, 471, 471, - /* 3070 */ 471, 408, 471, 471, 471, 412, 471, 471, 415, 416, - /* 3080 */ 417, 418, 419, 420, 471, 422, + /* 230 */ 230, 231, 232, 233, 136, 137, 66, 67, 68, 69, + /* 240 */ 70, 100, 72, 73, 74, 75, 76, 77, 78, 79, + /* 250 */ 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, + /* 260 */ 90, 91, 92, 20, 166, 167, 171, 101, 96, 112, + /* 270 */ 172, 173, 21, 165, 35, 24, 25, 26, 27, 28, + /* 280 */ 29, 30, 31, 32, 186, 112, 188, 130, 131, 132, + /* 290 */ 133, 134, 135, 8, 9, 63, 4, 12, 13, 14, + /* 300 */ 15, 16, 373, 130, 131, 132, 133, 134, 135, 329, + /* 310 */ 71, 213, 214, 384, 216, 217, 218, 219, 220, 221, + /* 320 */ 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, + /* 330 */ 232, 233, 234, 12, 13, 43, 0, 45, 46, 20, + /* 340 */ 168, 20, 97, 22, 250, 237, 373, 250, 20, 64, + /* 350 */ 255, 256, 257, 250, 33, 247, 35, 384, 113, 114, + /* 360 */ 115, 116, 117, 118, 119, 120, 121, 122, 346, 124, + /* 370 */ 125, 126, 127, 128, 129, 0, 2, 397, 332, 58, + /* 380 */ 44, 401, 8, 9, 362, 64, 12, 13, 14, 15, + /* 390 */ 16, 250, 71, 371, 109, 336, 21, 338, 339, 24, + /* 400 */ 25, 26, 27, 28, 29, 30, 31, 32, 8, 9, + /* 410 */ 340, 365, 12, 13, 14, 15, 16, 357, 97, 373, + /* 420 */ 20, 100, 80, 443, 378, 365, 380, 447, 100, 357, + /* 430 */ 20, 12, 13, 14, 374, 130, 131, 365, 373, 20, + /* 440 */ 135, 22, 462, 463, 372, 20, 374, 467, 468, 384, + /* 450 */ 165, 131, 33, 381, 35, 135, 410, 136, 137, 389, + /* 460 */ 414, 391, 111, 417, 418, 419, 420, 421, 422, 423, + /* 470 */ 424, 425, 426, 0, 8, 9, 234, 58, 12, 13, + /* 480 */ 14, 15, 16, 141, 142, 166, 167, 166, 167, 344, + /* 490 */ 71, 0, 337, 172, 173, 340, 341, 24, 25, 26, + /* 500 */ 27, 28, 29, 30, 31, 32, 164, 186, 337, 188, + /* 510 */ 44, 340, 341, 368, 194, 195, 97, 397, 198, 100, + /* 520 */ 200, 401, 237, 238, 239, 240, 241, 242, 243, 244, + /* 530 */ 245, 246, 247, 332, 213, 214, 402, 216, 217, 218, + /* 540 */ 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, + /* 550 */ 229, 230, 231, 232, 233, 136, 137, 66, 67, 68, + /* 560 */ 71, 136, 137, 443, 73, 74, 75, 447, 168, 100, + /* 570 */ 79, 379, 380, 367, 344, 84, 85, 71, 250, 378, + /* 580 */ 332, 90, 462, 463, 378, 166, 167, 467, 468, 2, + /* 590 */ 360, 172, 173, 1, 2, 8, 9, 0, 368, 12, + /* 600 */ 13, 14, 15, 16, 111, 186, 3, 188, 351, 352, + /* 610 */ 8, 9, 21, 365, 12, 13, 14, 15, 16, 413, + /* 620 */ 414, 373, 340, 20, 0, 34, 378, 36, 380, 234, + /* 630 */ 424, 236, 213, 214, 346, 216, 217, 218, 219, 220, + /* 640 */ 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, + /* 650 */ 231, 232, 233, 12, 13, 373, 58, 332, 410, 371, + /* 660 */ 367, 20, 414, 22, 340, 417, 418, 419, 420, 421, + /* 670 */ 422, 378, 424, 20, 33, 427, 35, 429, 430, 431, + /* 680 */ 356, 8, 9, 435, 436, 12, 13, 14, 15, 16, + /* 690 */ 365, 332, 365, 101, 20, 365, 0, 373, 373, 58, + /* 700 */ 102, 340, 372, 378, 101, 380, 413, 414, 332, 112, + /* 710 */ 397, 381, 71, 386, 387, 213, 37, 424, 22, 250, + /* 720 */ 438, 439, 440, 441, 340, 443, 444, 130, 131, 132, + /* 730 */ 133, 134, 135, 427, 373, 410, 430, 378, 97, 414, + /* 740 */ 356, 100, 417, 418, 419, 420, 421, 422, 3, 424, + /* 750 */ 332, 12, 13, 340, 378, 375, 443, 373, 378, 20, + /* 760 */ 447, 22, 260, 261, 262, 263, 264, 265, 266, 356, + /* 770 */ 168, 168, 33, 366, 35, 462, 463, 136, 137, 155, + /* 780 */ 467, 468, 103, 416, 105, 106, 373, 108, 164, 136, + /* 790 */ 137, 112, 340, 366, 469, 470, 378, 58, 366, 332, + /* 800 */ 439, 440, 441, 332, 443, 444, 20, 166, 167, 442, + /* 810 */ 71, 366, 133, 172, 173, 340, 8, 9, 416, 340, + /* 820 */ 12, 13, 14, 15, 16, 172, 173, 186, 366, 188, + /* 830 */ 365, 356, 365, 332, 0, 356, 97, 372, 363, 100, + /* 840 */ 373, 389, 168, 391, 442, 378, 381, 380, 373, 378, + /* 850 */ 397, 178, 373, 58, 213, 214, 332, 216, 217, 218, + /* 860 */ 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, + /* 870 */ 229, 230, 231, 232, 233, 136, 137, 410, 366, 378, + /* 880 */ 397, 414, 48, 365, 417, 418, 419, 420, 421, 422, + /* 890 */ 372, 424, 375, 357, 99, 378, 443, 102, 431, 381, + /* 900 */ 447, 365, 378, 436, 443, 166, 167, 20, 447, 101, + /* 910 */ 374, 172, 173, 351, 352, 462, 463, 181, 100, 39, + /* 920 */ 467, 468, 22, 462, 463, 186, 443, 188, 467, 468, + /* 930 */ 447, 365, 428, 14, 430, 35, 14, 366, 372, 20, + /* 940 */ 204, 205, 20, 45, 46, 462, 463, 381, 275, 44, + /* 950 */ 467, 468, 213, 214, 168, 216, 217, 218, 219, 220, + /* 960 */ 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, + /* 970 */ 231, 232, 233, 20, 18, 18, 20, 340, 12, 13, + /* 980 */ 23, 397, 428, 27, 430, 4, 30, 332, 22, 33, + /* 990 */ 14, 15, 16, 356, 37, 38, 4, 97, 41, 33, + /* 1000 */ 19, 35, 333, 185, 48, 187, 50, 388, 375, 53, + /* 1010 */ 373, 378, 22, 365, 33, 270, 59, 60, 61, 62, + /* 1020 */ 365, 44, 374, 340, 58, 35, 340, 443, 373, 48, + /* 1030 */ 212, 447, 357, 378, 53, 380, 332, 71, 340, 58, + /* 1040 */ 365, 112, 356, 332, 248, 249, 462, 463, 340, 374, + /* 1050 */ 365, 467, 468, 166, 356, 99, 373, 100, 353, 373, + /* 1060 */ 355, 71, 133, 97, 356, 410, 381, 111, 250, 414, + /* 1070 */ 354, 373, 417, 418, 419, 420, 421, 422, 101, 424, + /* 1080 */ 99, 373, 378, 102, 429, 166, 431, 97, 166, 378, + /* 1090 */ 435, 436, 332, 332, 35, 138, 140, 332, 0, 143, + /* 1100 */ 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, + /* 1110 */ 154, 155, 156, 157, 158, 159, 340, 161, 162, 163, + /* 1120 */ 22, 168, 439, 440, 441, 44, 443, 444, 340, 249, + /* 1130 */ 358, 340, 356, 361, 44, 178, 179, 180, 378, 378, + /* 1140 */ 183, 332, 340, 378, 356, 130, 22, 356, 42, 373, + /* 1150 */ 44, 42, 186, 44, 188, 340, 332, 340, 356, 35, + /* 1160 */ 203, 373, 35, 206, 373, 208, 209, 210, 211, 212, + /* 1170 */ 332, 356, 332, 356, 365, 373, 186, 272, 188, 213, + /* 1180 */ 214, 471, 373, 104, 340, 64, 107, 378, 373, 380, + /* 1190 */ 373, 101, 226, 227, 228, 229, 230, 231, 232, 340, + /* 1200 */ 356, 22, 378, 213, 214, 365, 332, 250, 340, 340, + /* 1210 */ 332, 196, 197, 373, 35, 356, 378, 373, 378, 410, + /* 1220 */ 380, 97, 332, 414, 356, 356, 417, 418, 419, 420, + /* 1230 */ 421, 422, 373, 424, 104, 332, 332, 107, 429, 332, + /* 1240 */ 431, 373, 373, 251, 435, 436, 104, 188, 104, 107, + /* 1250 */ 410, 107, 378, 460, 414, 365, 378, 417, 418, 419, + /* 1260 */ 420, 421, 422, 373, 424, 44, 457, 0, 378, 429, + /* 1270 */ 380, 431, 365, 44, 342, 435, 436, 199, 44, 201, + /* 1280 */ 373, 378, 378, 454, 44, 378, 446, 380, 100, 22, + /* 1290 */ 136, 137, 365, 44, 342, 1, 2, 44, 110, 332, + /* 1300 */ 410, 44, 44, 47, 414, 44, 44, 417, 418, 419, + /* 1310 */ 420, 421, 422, 44, 424, 188, 388, 410, 339, 332, + /* 1320 */ 377, 414, 101, 44, 417, 418, 419, 420, 421, 422, + /* 1330 */ 101, 424, 365, 388, 213, 101, 429, 19, 431, 13, + /* 1340 */ 373, 101, 435, 436, 445, 378, 0, 380, 464, 459, + /* 1350 */ 101, 33, 365, 446, 101, 274, 100, 44, 101, 101, + /* 1360 */ 373, 35, 101, 101, 44, 378, 48, 380, 44, 44, + /* 1370 */ 101, 13, 54, 55, 56, 57, 58, 410, 437, 44, + /* 1380 */ 101, 414, 44, 35, 417, 418, 419, 420, 421, 422, + /* 1390 */ 448, 424, 252, 35, 412, 49, 429, 410, 431, 48, + /* 1400 */ 411, 414, 435, 436, 417, 418, 419, 420, 421, 422, + /* 1410 */ 184, 424, 399, 446, 101, 42, 429, 99, 431, 71, + /* 1420 */ 102, 101, 435, 436, 385, 101, 101, 20, 332, 388, + /* 1430 */ 385, 165, 383, 446, 20, 33, 101, 340, 385, 101, + /* 1440 */ 340, 383, 98, 383, 350, 95, 94, 340, 332, 348, + /* 1450 */ 48, 349, 134, 340, 340, 340, 54, 55, 56, 57, + /* 1460 */ 58, 365, 20, 334, 20, 334, 405, 20, 346, 373, + /* 1470 */ 20, 380, 346, 341, 378, 20, 380, 341, 398, 346, + /* 1480 */ 346, 365, 52, 346, 346, 340, 343, 169, 365, 373, + /* 1490 */ 334, 343, 174, 346, 378, 340, 380, 378, 378, 334, + /* 1500 */ 365, 99, 202, 378, 102, 100, 410, 192, 190, 405, + /* 1510 */ 414, 193, 409, 417, 418, 419, 420, 421, 422, 407, + /* 1520 */ 424, 344, 332, 365, 365, 429, 410, 431, 365, 365, + /* 1530 */ 414, 435, 436, 417, 418, 419, 420, 421, 422, 365, + /* 1540 */ 424, 365, 446, 365, 191, 429, 332, 431, 365, 365, + /* 1550 */ 404, 435, 436, 403, 344, 365, 340, 388, 388, 378, + /* 1560 */ 380, 259, 258, 373, 453, 393, 393, 378, 378, 378, + /* 1570 */ 380, 169, 170, 378, 267, 177, 174, 269, 176, 365, + /* 1580 */ 268, 453, 253, 412, 273, 276, 249, 373, 271, 472, + /* 1590 */ 373, 452, 378, 20, 380, 193, 332, 456, 416, 340, + /* 1600 */ 410, 341, 453, 451, 414, 20, 455, 417, 418, 419, + /* 1610 */ 420, 421, 422, 332, 424, 344, 450, 344, 465, 429, + /* 1620 */ 393, 431, 391, 466, 410, 435, 436, 170, 414, 365, + /* 1630 */ 378, 417, 418, 419, 420, 421, 422, 373, 424, 393, + /* 1640 */ 390, 378, 378, 378, 380, 431, 365, 344, 378, 435, + /* 1650 */ 436, 361, 378, 378, 373, 373, 100, 434, 344, 378, + /* 1660 */ 100, 380, 369, 378, 36, 355, 344, 340, 335, 330, + /* 1670 */ 334, 394, 400, 332, 410, 359, 0, 345, 414, 0, + /* 1680 */ 394, 417, 418, 419, 420, 421, 422, 359, 424, 406, + /* 1690 */ 359, 410, 0, 332, 42, 414, 0, 35, 417, 418, + /* 1700 */ 419, 420, 421, 422, 207, 424, 365, 35, 35, 35, + /* 1710 */ 207, 0, 431, 35, 373, 35, 435, 436, 207, 378, + /* 1720 */ 0, 380, 207, 0, 35, 461, 365, 0, 22, 0, + /* 1730 */ 35, 194, 188, 186, 373, 0, 0, 0, 181, 378, + /* 1740 */ 182, 380, 0, 0, 47, 0, 0, 0, 0, 42, + /* 1750 */ 0, 410, 0, 0, 0, 414, 332, 0, 417, 418, + /* 1760 */ 419, 420, 421, 422, 0, 424, 0, 155, 35, 0, + /* 1770 */ 155, 410, 431, 0, 0, 414, 435, 436, 417, 418, + /* 1780 */ 419, 420, 421, 422, 22, 424, 0, 0, 0, 365, + /* 1790 */ 0, 0, 0, 0, 370, 0, 0, 373, 0, 0, + /* 1800 */ 0, 0, 378, 0, 380, 42, 0, 0, 0, 0, + /* 1810 */ 0, 0, 0, 0, 332, 0, 139, 0, 0, 22, + /* 1820 */ 96, 96, 0, 58, 22, 0, 58, 0, 58, 35, + /* 1830 */ 0, 470, 0, 44, 410, 14, 0, 14, 414, 332, + /* 1840 */ 0, 417, 418, 419, 420, 421, 422, 365, 424, 0, + /* 1850 */ 0, 47, 47, 0, 0, 373, 42, 0, 39, 39, + /* 1860 */ 378, 177, 380, 47, 40, 39, 0, 0, 35, 0, + /* 1870 */ 35, 0, 365, 39, 35, 0, 39, 370, 0, 48, + /* 1880 */ 373, 35, 39, 39, 0, 378, 48, 380, 0, 48, + /* 1890 */ 0, 109, 410, 65, 35, 48, 414, 0, 22, 417, + /* 1900 */ 418, 419, 420, 421, 422, 35, 424, 35, 426, 35, + /* 1910 */ 0, 22, 332, 0, 35, 35, 35, 410, 35, 0, + /* 1920 */ 35, 414, 22, 22, 417, 418, 419, 420, 421, 422, + /* 1930 */ 44, 424, 50, 332, 22, 44, 107, 35, 0, 35, + /* 1940 */ 0, 35, 0, 22, 20, 365, 35, 0, 100, 35, + /* 1950 */ 370, 35, 101, 373, 22, 100, 0, 22, 378, 0, + /* 1960 */ 380, 35, 332, 0, 189, 3, 365, 44, 254, 101, + /* 1970 */ 254, 44, 44, 100, 373, 44, 47, 100, 44, 378, + /* 1980 */ 3, 380, 254, 332, 47, 98, 35, 44, 96, 96, + /* 1990 */ 410, 95, 35, 35, 414, 365, 101, 417, 418, 419, + /* 2000 */ 420, 421, 422, 373, 424, 35, 101, 100, 378, 100, + /* 2010 */ 380, 410, 47, 168, 35, 414, 365, 100, 417, 418, + /* 2020 */ 419, 420, 421, 422, 373, 424, 168, 175, 35, 378, + /* 2030 */ 170, 380, 168, 332, 101, 44, 100, 47, 0, 0, + /* 2040 */ 410, 0, 101, 0, 414, 101, 101, 417, 418, 419, + /* 2050 */ 420, 421, 422, 101, 424, 100, 39, 47, 332, 39, + /* 2060 */ 100, 410, 101, 0, 100, 414, 365, 101, 417, 418, + /* 2070 */ 419, 420, 421, 422, 373, 424, 100, 169, 100, 378, + /* 2080 */ 47, 380, 100, 110, 44, 98, 171, 98, 2, 22, + /* 2090 */ 22, 365, 100, 332, 47, 101, 101, 100, 235, 373, + /* 2100 */ 100, 47, 101, 100, 378, 100, 380, 213, 101, 100, + /* 2110 */ 248, 410, 101, 215, 35, 414, 332, 111, 417, 418, + /* 2120 */ 419, 420, 421, 422, 35, 424, 365, 100, 35, 101, + /* 2130 */ 100, 35, 101, 101, 373, 100, 410, 35, 101, 378, + /* 2140 */ 414, 380, 100, 417, 418, 419, 420, 421, 422, 365, + /* 2150 */ 424, 35, 100, 22, 44, 100, 100, 373, 35, 123, + /* 2160 */ 112, 100, 378, 22, 380, 65, 71, 123, 123, 123, + /* 2170 */ 64, 410, 35, 35, 332, 414, 93, 35, 417, 418, + /* 2180 */ 419, 420, 421, 422, 35, 424, 35, 35, 35, 35, + /* 2190 */ 35, 35, 44, 332, 410, 35, 35, 35, 414, 22, + /* 2200 */ 35, 417, 418, 419, 420, 421, 422, 365, 424, 35, + /* 2210 */ 71, 35, 22, 35, 35, 373, 35, 35, 35, 35, + /* 2220 */ 378, 0, 380, 35, 39, 0, 365, 35, 48, 0, + /* 2230 */ 39, 35, 39, 0, 373, 48, 35, 48, 39, 378, + /* 2240 */ 0, 380, 48, 35, 35, 0, 22, 21, 473, 22, + /* 2250 */ 22, 21, 410, 473, 332, 473, 414, 20, 473, 417, + /* 2260 */ 418, 419, 420, 421, 422, 473, 424, 473, 473, 473, + /* 2270 */ 473, 410, 473, 473, 473, 414, 473, 473, 417, 418, + /* 2280 */ 419, 420, 421, 422, 473, 424, 473, 365, 473, 473, + /* 2290 */ 473, 473, 473, 473, 473, 373, 473, 473, 473, 473, + /* 2300 */ 378, 473, 380, 473, 473, 473, 473, 473, 473, 473, + /* 2310 */ 473, 473, 332, 473, 473, 473, 473, 473, 473, 473, + /* 2320 */ 473, 473, 473, 473, 473, 473, 473, 473, 332, 473, + /* 2330 */ 473, 473, 410, 473, 473, 473, 414, 473, 473, 417, + /* 2340 */ 418, 419, 420, 421, 422, 365, 424, 473, 473, 473, + /* 2350 */ 473, 473, 473, 373, 473, 473, 473, 473, 378, 473, + /* 2360 */ 380, 365, 473, 473, 473, 473, 473, 473, 473, 373, + /* 2370 */ 473, 473, 473, 473, 378, 473, 380, 473, 473, 473, + /* 2380 */ 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, + /* 2390 */ 410, 332, 473, 473, 414, 473, 473, 417, 418, 419, + /* 2400 */ 420, 421, 422, 473, 424, 473, 410, 332, 473, 473, + /* 2410 */ 414, 473, 473, 417, 418, 419, 420, 421, 422, 473, + /* 2420 */ 424, 473, 473, 473, 365, 473, 332, 473, 473, 473, + /* 2430 */ 473, 473, 373, 473, 473, 473, 473, 378, 473, 380, + /* 2440 */ 365, 473, 473, 473, 473, 473, 473, 473, 373, 473, + /* 2450 */ 473, 473, 473, 378, 473, 380, 473, 473, 473, 365, + /* 2460 */ 473, 473, 473, 473, 473, 473, 473, 373, 473, 410, + /* 2470 */ 473, 473, 378, 414, 380, 473, 417, 418, 419, 420, + /* 2480 */ 421, 422, 473, 424, 473, 410, 473, 473, 473, 414, + /* 2490 */ 332, 473, 417, 418, 419, 420, 421, 422, 473, 424, + /* 2500 */ 473, 473, 473, 473, 410, 473, 473, 332, 414, 473, + /* 2510 */ 473, 417, 418, 419, 420, 421, 422, 473, 424, 473, + /* 2520 */ 473, 473, 473, 365, 473, 473, 473, 473, 473, 473, + /* 2530 */ 473, 373, 473, 473, 473, 473, 378, 473, 380, 473, + /* 2540 */ 365, 473, 473, 473, 473, 473, 473, 473, 373, 473, + /* 2550 */ 473, 473, 473, 378, 473, 380, 473, 473, 473, 473, + /* 2560 */ 473, 473, 473, 473, 473, 473, 473, 332, 410, 473, + /* 2570 */ 473, 473, 414, 473, 473, 417, 418, 419, 420, 421, + /* 2580 */ 422, 473, 424, 473, 473, 410, 473, 332, 473, 414, + /* 2590 */ 473, 473, 417, 418, 419, 420, 421, 422, 473, 424, + /* 2600 */ 365, 473, 473, 473, 473, 473, 473, 473, 373, 473, + /* 2610 */ 473, 473, 473, 378, 473, 380, 473, 473, 473, 473, + /* 2620 */ 365, 473, 473, 473, 473, 473, 473, 473, 373, 473, + /* 2630 */ 473, 473, 473, 378, 473, 380, 473, 473, 473, 473, + /* 2640 */ 473, 473, 473, 473, 473, 410, 473, 473, 473, 414, + /* 2650 */ 473, 473, 417, 418, 419, 420, 421, 422, 473, 424, + /* 2660 */ 473, 332, 473, 473, 473, 410, 473, 473, 473, 414, + /* 2670 */ 473, 473, 417, 418, 419, 420, 421, 422, 332, 424, + /* 2680 */ 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, + /* 2690 */ 473, 473, 473, 473, 365, 473, 473, 473, 473, 473, + /* 2700 */ 473, 473, 373, 473, 473, 473, 473, 378, 473, 380, + /* 2710 */ 473, 365, 473, 473, 473, 473, 473, 473, 473, 373, + /* 2720 */ 473, 473, 473, 473, 378, 473, 380, 473, 473, 473, + /* 2730 */ 473, 473, 473, 473, 473, 473, 473, 473, 473, 410, + /* 2740 */ 332, 473, 473, 414, 473, 473, 417, 418, 419, 420, + /* 2750 */ 421, 422, 473, 424, 473, 473, 410, 473, 473, 473, + /* 2760 */ 414, 473, 473, 417, 418, 419, 420, 421, 422, 473, + /* 2770 */ 424, 473, 473, 365, 473, 473, 473, 473, 473, 473, + /* 2780 */ 473, 373, 473, 473, 473, 473, 378, 473, 380, 473, + /* 2790 */ 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, + /* 2800 */ 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, + /* 2810 */ 473, 473, 473, 473, 473, 473, 473, 473, 410, 473, + /* 2820 */ 473, 473, 414, 473, 473, 417, 418, 419, 420, 421, + /* 2830 */ 422, 473, 424, }; -#define YY_SHIFT_COUNT (744) +#define YY_SHIFT_COUNT (753) #define YY_SHIFT_MIN (0) -#define YY_SHIFT_MAX (2109) +#define YY_SHIFT_MAX (2245) static const unsigned short int yy_shift_ofst[] = { - /* 0 */ 876, 0, 72, 0, 294, 294, 294, 294, 294, 294, - /* 10 */ 294, 294, 294, 294, 294, 366, 586, 586, 658, 586, - /* 20 */ 586, 586, 586, 586, 586, 586, 586, 586, 586, 586, - /* 30 */ 586, 586, 586, 586, 586, 586, 586, 586, 586, 586, - /* 40 */ 586, 586, 586, 586, 586, 586, 586, 586, 106, 289, - /* 50 */ 756, 1, 430, 327, 399, 327, 1, 1, 1223, 1223, - /* 60 */ 1223, 327, 1223, 1223, 62, 327, 19, 334, 54, 54, - /* 70 */ 334, 407, 407, 118, 67, 48, 48, 54, 54, 54, - /* 80 */ 54, 54, 54, 54, 79, 54, 54, 40, 19, 54, - /* 90 */ 54, 304, 54, 19, 54, 79, 54, 79, 19, 54, - /* 100 */ 54, 19, 54, 19, 19, 19, 54, 318, 805, 34, - /* 110 */ 34, 219, 381, 137, 137, 137, 137, 137, 137, 137, - /* 120 */ 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, - /* 130 */ 137, 137, 732, 536, 118, 67, 426, 120, 120, 120, - /* 140 */ 174, 482, 482, 426, 337, 337, 337, 40, 365, 389, - /* 150 */ 19, 383, 19, 383, 383, 444, 568, 221, 221, 221, - /* 160 */ 221, 221, 221, 221, 221, 515, 414, 308, 622, 751, - /* 170 */ 107, 594, 227, 193, 487, 340, 983, 888, 916, 1097, - /* 180 */ 891, 887, 900, 891, 1102, 912, 141, 1052, 1262, 1129, - /* 190 */ 1291, 1318, 1291, 1180, 1326, 1326, 1291, 1180, 1180, 1326, - /* 200 */ 1268, 1326, 1326, 1326, 1352, 1352, 1355, 40, 1359, 40, - /* 210 */ 1370, 1373, 40, 1370, 40, 40, 40, 1326, 40, 1356, - /* 220 */ 1356, 1352, 19, 19, 19, 19, 19, 19, 19, 19, - /* 230 */ 19, 19, 19, 1326, 1352, 383, 383, 383, 1215, 1327, - /* 240 */ 1355, 318, 1252, 1255, 1359, 318, 1326, 1318, 1318, 383, - /* 250 */ 1187, 1203, 383, 1187, 1203, 383, 383, 19, 1198, 1294, - /* 260 */ 1187, 1202, 1208, 1227, 1052, 1214, 1213, 1217, 1247, 337, - /* 270 */ 1485, 1326, 1370, 318, 318, 1491, 1203, 383, 383, 383, - /* 280 */ 383, 383, 1203, 383, 1347, 318, 444, 318, 337, 1431, - /* 290 */ 1433, 383, 568, 1326, 318, 1500, 1352, 3086, 3086, 3086, - /* 300 */ 3086, 3086, 3086, 3086, 3086, 3086, 901, 570, 51, 636, - /* 310 */ 461, 15, 477, 545, 417, 766, 986, 902, 1000, 1000, - /* 320 */ 1000, 1000, 1000, 1000, 1000, 1000, 1000, 910, 409, 132, - /* 330 */ 132, 71, 352, 189, 37, 737, 624, 532, 532, 647, - /* 340 */ 930, 297, 647, 647, 647, 895, 847, 632, 1114, 913, - /* 350 */ 1152, 1066, 1078, 1092, 1094, 1123, 1177, 1210, 960, 1158, - /* 360 */ 1167, 429, 1169, 1170, 1181, 1095, 979, 488, 1085, 1183, - /* 370 */ 1195, 1200, 1216, 1221, 1225, 1239, 1226, 1130, 1138, 844, - /* 380 */ 1228, 1212, 1229, 1230, 1232, 1233, 1238, 1240, 1165, 1282, - /* 390 */ 1293, 1250, 1319, 1557, 1568, 1569, 1529, 1572, 1538, 1369, - /* 400 */ 1541, 1543, 1544, 1375, 1582, 1548, 1550, 1381, 1587, 1384, - /* 410 */ 1590, 1562, 1599, 1578, 1601, 1567, 1411, 1418, 1422, 1608, - /* 420 */ 1613, 1622, 1443, 1445, 1626, 1629, 1583, 1634, 1635, 1636, - /* 430 */ 1595, 1638, 1639, 1640, 1641, 1642, 1643, 1644, 1645, 1494, - /* 440 */ 1612, 1649, 1498, 1651, 1652, 1653, 1654, 1655, 1656, 1658, - /* 450 */ 1659, 1660, 1663, 1672, 1673, 1674, 1676, 1680, 1681, 1646, - /* 460 */ 1684, 1685, 1686, 1689, 1690, 1691, 1671, 1699, 1700, 1701, - /* 470 */ 1559, 1696, 1697, 1702, 1647, 1668, 1704, 1648, 1708, 1667, - /* 480 */ 1709, 1710, 1670, 1687, 1669, 1683, 1713, 1692, 1726, 1694, - /* 490 */ 1743, 1705, 1707, 1747, 1748, 1749, 1711, 1576, 1752, 1753, - /* 500 */ 1754, 1693, 1755, 1756, 1722, 1714, 1720, 1760, 1728, 1716, - /* 510 */ 1727, 1765, 1732, 1721, 1729, 1770, 1736, 1731, 1737, 1775, - /* 520 */ 1777, 1780, 1787, 1688, 1698, 1759, 1767, 1790, 1761, 1762, - /* 530 */ 1763, 1764, 1751, 1758, 1768, 1769, 1784, 1773, 1791, 1788, - /* 540 */ 1809, 1789, 1766, 1812, 1792, 1778, 1815, 1782, 1818, 1785, - /* 550 */ 1819, 1799, 1803, 1794, 1795, 1796, 1735, 1739, 1824, 1661, - /* 560 */ 1740, 1804, 1805, 1825, 1665, 1806, 1675, 1703, 1838, 1842, - /* 570 */ 1678, 1677, 1851, 1811, 1603, 1771, 1772, 1779, 1706, 1625, - /* 580 */ 1715, 1602, 1774, 1816, 1820, 1776, 1781, 1783, 1786, 1797, - /* 590 */ 1821, 1827, 1829, 1800, 1836, 1609, 1798, 1802, 1878, 1839, - /* 600 */ 1631, 1850, 1855, 1856, 1857, 1858, 1862, 1807, 1817, 1853, - /* 610 */ 1666, 1845, 1868, 1886, 1901, 1917, 1920, 1826, 1882, 1683, - /* 620 */ 1876, 1828, 1831, 1832, 1830, 1834, 1757, 1835, 1933, 1896, - /* 630 */ 1801, 1840, 1833, 1683, 1890, 1894, 1718, 1717, 1734, 1938, - /* 640 */ 1919, 1733, 1846, 1848, 1847, 1849, 1865, 1866, 1906, 1873, - /* 650 */ 1874, 1907, 1880, 1957, 1808, 1885, 1875, 1887, 1948, 1951, - /* 660 */ 1891, 1892, 1955, 1895, 1897, 1962, 1902, 1903, 1966, 1909, - /* 670 */ 1905, 1968, 1910, 1872, 1888, 1893, 1898, 1985, 1904, 1914, - /* 680 */ 1970, 1921, 1980, 1923, 1970, 1970, 1994, 1958, 1956, 1987, - /* 690 */ 1991, 1993, 1995, 1996, 2003, 2007, 2008, 2011, 2012, 1969, - /* 700 */ 1961, 2015, 2021, 2025, 2026, 2042, 2030, 2032, 2033, 1998, - /* 710 */ 1751, 2035, 1758, 2037, 2039, 2041, 2043, 2055, 2044, 2081, - /* 720 */ 2047, 2036, 2046, 2086, 2052, 2048, 2050, 2091, 2057, 2049, - /* 730 */ 2056, 2094, 2064, 2054, 2059, 2100, 2069, 2070, 2109, 2096, - /* 740 */ 2095, 2097, 2099, 2101, 2103, + /* 0 */ 957, 0, 98, 0, 321, 321, 321, 321, 321, 321, + /* 10 */ 321, 321, 321, 321, 321, 419, 641, 641, 739, 641, + /* 20 */ 641, 641, 641, 641, 641, 641, 641, 641, 641, 641, + /* 30 */ 641, 641, 641, 641, 641, 641, 641, 641, 641, 641, + /* 40 */ 641, 641, 641, 641, 641, 641, 641, 641, 141, 328, + /* 50 */ 818, 68, 97, 103, 469, 103, 68, 68, 966, 966, + /* 60 */ 966, 103, 966, 966, 94, 103, 4, 653, 24, 24, + /* 70 */ 653, 292, 292, 319, 425, 186, 186, 24, 24, 24, + /* 80 */ 24, 24, 24, 24, 138, 24, 24, 124, 4, 24, + /* 90 */ 24, 243, 24, 4, 24, 138, 24, 138, 4, 24, + /* 100 */ 24, 4, 24, 4, 4, 4, 24, 232, 956, 285, + /* 110 */ 285, 117, 251, 990, 990, 990, 990, 990, 990, 990, + /* 120 */ 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, + /* 130 */ 990, 990, 679, 603, 319, 425, 239, 674, 674, 674, + /* 140 */ 36, 395, 395, 239, 410, 410, 410, 124, 351, 242, + /* 150 */ 4, 489, 4, 489, 489, 493, 506, 245, 245, 245, + /* 160 */ 245, 245, 245, 245, 245, 1318, 491, 375, 400, 673, + /* 170 */ 502, 112, 95, 919, 922, 29, 786, 898, 929, 953, + /* 180 */ 796, 880, 745, 796, 1106, 992, 887, 1140, 1351, 1226, + /* 190 */ 1373, 1407, 1373, 1266, 1414, 1414, 1373, 1266, 1266, 1344, + /* 200 */ 1350, 1414, 1352, 1414, 1414, 1414, 1442, 1442, 1444, 124, + /* 210 */ 1447, 124, 1450, 1455, 124, 1450, 124, 124, 124, 1414, + /* 220 */ 124, 1430, 1430, 1442, 4, 4, 4, 4, 4, 4, + /* 230 */ 4, 4, 4, 4, 4, 1414, 1442, 489, 489, 489, + /* 240 */ 1300, 1405, 1444, 232, 1315, 1353, 1447, 232, 1414, 1407, + /* 250 */ 1407, 489, 1302, 1304, 489, 1302, 1304, 489, 489, 4, + /* 260 */ 1307, 1398, 1302, 1308, 1312, 1329, 1140, 1309, 1311, 1317, + /* 270 */ 1337, 410, 1573, 1414, 1450, 232, 232, 1585, 1304, 489, + /* 280 */ 489, 489, 489, 489, 1304, 489, 1457, 232, 493, 232, + /* 290 */ 410, 1556, 1560, 489, 506, 1414, 232, 1628, 1442, 2833, + /* 300 */ 2833, 2833, 2833, 2833, 2833, 2833, 2833, 2833, 170, 1402, + /* 310 */ 473, 981, 166, 466, 808, 157, 374, 587, 602, 597, + /* 320 */ 196, 196, 196, 196, 196, 196, 196, 196, 196, 173, + /* 330 */ 320, 26, 26, 342, 736, 624, 795, 900, 1124, 591, + /* 340 */ 1015, 305, 305, 976, 592, 108, 976, 976, 976, 834, + /* 350 */ 977, 1179, 1109, 17, 336, 1079, 1130, 1142, 1144, 696, + /* 360 */ 1098, 1267, 1078, 1090, 1221, 598, 1229, 1234, 1240, 1154, + /* 370 */ 905, 1081, 172, 1249, 1253, 1257, 1258, 1261, 1262, 1294, + /* 380 */ 1269, 1059, 1127, 1121, 1279, 1256, 1313, 1320, 1324, 1325, + /* 390 */ 1335, 1338, 1188, 1326, 1358, 1348, 1346, 1676, 1679, 1692, + /* 400 */ 1652, 1696, 1662, 1497, 1672, 1673, 1674, 1503, 1711, 1678, + /* 410 */ 1680, 1511, 1720, 1515, 1723, 1689, 1727, 1706, 1729, 1695, + /* 420 */ 1537, 1544, 1547, 1735, 1736, 1737, 1558, 1557, 1742, 1743, + /* 430 */ 1697, 1745, 1746, 1747, 1707, 1748, 1750, 1752, 1753, 1754, + /* 440 */ 1757, 1764, 1766, 1612, 1733, 1769, 1615, 1773, 1774, 1786, + /* 450 */ 1787, 1788, 1790, 1791, 1792, 1793, 1795, 1796, 1798, 1799, + /* 460 */ 1800, 1801, 1803, 1763, 1806, 1807, 1808, 1809, 1810, 1811, + /* 470 */ 1762, 1812, 1813, 1815, 1677, 1817, 1818, 1797, 1724, 1802, + /* 480 */ 1725, 1822, 1765, 1794, 1825, 1768, 1827, 1770, 1830, 1832, + /* 490 */ 1814, 1819, 1789, 1804, 1821, 1805, 1823, 1816, 1836, 1824, + /* 500 */ 1820, 1840, 1849, 1850, 1826, 1684, 1853, 1854, 1857, 1828, + /* 510 */ 1866, 1867, 1833, 1831, 1834, 1869, 1835, 1838, 1837, 1871, + /* 520 */ 1839, 1841, 1843, 1875, 1846, 1847, 1844, 1878, 1884, 1888, + /* 530 */ 1890, 1782, 1829, 1859, 1876, 1897, 1870, 1872, 1874, 1879, + /* 540 */ 1880, 1886, 1891, 1881, 1883, 1889, 1885, 1910, 1900, 1913, + /* 550 */ 1901, 1882, 1919, 1912, 1902, 1938, 1904, 1940, 1906, 1942, + /* 560 */ 1921, 1924, 1911, 1914, 1916, 1851, 1848, 1947, 1845, 1855, + /* 570 */ 1926, 1932, 1956, 1775, 1935, 1858, 1860, 1959, 1963, 1864, + /* 580 */ 1852, 1962, 1923, 1714, 1873, 1868, 1877, 1892, 1887, 1893, + /* 590 */ 1896, 1895, 1927, 1928, 1905, 1907, 1909, 1917, 1933, 1931, + /* 600 */ 1929, 1937, 1936, 1934, 1716, 1941, 1944, 1977, 1943, 1728, + /* 610 */ 1951, 1957, 1958, 1970, 1979, 1993, 1945, 1952, 1965, 1862, + /* 620 */ 1991, 1990, 2038, 2039, 2041, 2043, 1955, 2017, 1804, 2010, + /* 630 */ 1960, 1961, 1966, 1964, 1976, 1915, 1978, 2063, 2020, 1908, + /* 640 */ 1982, 1973, 1804, 2033, 2040, 1987, 1863, 1989, 2086, 2067, + /* 650 */ 1894, 1992, 1994, 1997, 1995, 2000, 2001, 2047, 2003, 2005, + /* 660 */ 2054, 2007, 2068, 1898, 2009, 2006, 2011, 2079, 2089, 2027, + /* 670 */ 2028, 2093, 2030, 2031, 2096, 2035, 2032, 2102, 2042, 2037, + /* 680 */ 2116, 2052, 2036, 2044, 2045, 2046, 2131, 2048, 2055, 2110, + /* 690 */ 2056, 2123, 2061, 2110, 2110, 2141, 2100, 2106, 2137, 2138, + /* 700 */ 2142, 2149, 2151, 2152, 2153, 2154, 2155, 2156, 2095, 2083, + /* 710 */ 2148, 2160, 2161, 2162, 2177, 2165, 2174, 2176, 2139, 1886, + /* 720 */ 2178, 1891, 2179, 2181, 2182, 2183, 2190, 2184, 2221, 2188, + /* 730 */ 2180, 2185, 2225, 2192, 2187, 2191, 2229, 2196, 2189, 2193, + /* 740 */ 2233, 2201, 2194, 2199, 2240, 2208, 2209, 2245, 2224, 2226, + /* 750 */ 2227, 2228, 2230, 2237, }; -#define YY_REDUCE_COUNT (305) -#define YY_REDUCE_MIN (-420) -#define YY_REDUCE_MAX (2663) +#define YY_REDUCE_COUNT (307) +#define YY_REDUCE_MIN (-442) +#define YY_REDUCE_MAX (2408) static const short yy_reduce_ofst[] = { - /* 0 */ 464, -306, -12, 280, 693, 771, 804, 871, 936, 969, - /* 10 */ 1065, 1126, 1176, 1199, 1249, 1299, 1316, 1366, 1429, 1490, - /* 20 */ 1540, 1556, 1617, 1633, 1695, 1712, 1730, 1793, 1854, 1889, - /* 30 */ 1912, 1981, 2005, 2063, 2084, 2113, 2187, 2206, 2222, 2284, - /* 40 */ 2345, 2414, 2440, 2503, 2522, 2585, 2601, 2663, -285, -262, - /* 50 */ 99, -174, -341, 101, 400, 627, 347, 657, 742, 796, - /* 60 */ 841, 287, -359, -234, -405, -274, -354, -68, -102, 23, - /* 70 */ -305, -336, -331, -294, -340, -296, -80, 80, 312, 368, - /* 80 */ 371, 372, 497, 557, -74, 695, 696, 263, -51, 704, - /* 90 */ 705, -178, 707, 39, 708, 228, 720, 260, -190, 750, - /* 100 */ 760, 241, 762, 484, 420, 535, 789, -229, -218, -420, - /* 110 */ -420, 216, -197, -15, 21, 309, 401, 516, 517, 539, - /* 120 */ 564, 630, 675, 687, 689, 765, 774, 787, 792, 798, - /* 130 */ 800, 808, -343, -347, 190, -183, -116, -347, 380, 410, - /* 140 */ 213, 295, 478, -96, -367, 356, 375, 133, 30, 418, - /* 150 */ 547, 453, 361, 481, 491, 562, 569, 326, 341, 346, - /* 160 */ 432, 466, 559, 640, 466, 330, 412, 644, 631, 574, - /* 170 */ 615, 739, 637, 822, 822, 786, 785, 862, 855, 857, - /* 180 */ 803, 803, 813, 803, 861, 856, 822, 899, 911, 934, - /* 190 */ 951, 950, 956, 962, 1009, 1010, 974, 978, 980, 1020, - /* 200 */ 1016, 1026, 1027, 1031, 1039, 1040, 973, 1032, 1004, 1037, - /* 210 */ 1051, 998, 1049, 1058, 1054, 1055, 1059, 1064, 1060, 1067, - /* 220 */ 1068, 1079, 1053, 1056, 1057, 1061, 1062, 1063, 1069, 1070, - /* 230 */ 1074, 1075, 1076, 1072, 1080, 1041, 1042, 1045, 1015, 1022, - /* 240 */ 1028, 1086, 1038, 1044, 1077, 1110, 1089, 1071, 1073, 1084, - /* 250 */ 1005, 1081, 1087, 1011, 1083, 1088, 1090, 822, 1013, 1017, - /* 260 */ 1024, 1018, 1029, 1043, 1091, 1023, 1036, 1033, 803, 1132, - /* 270 */ 1093, 1166, 1168, 1171, 1172, 1121, 1122, 1136, 1141, 1142, - /* 280 */ 1143, 1144, 1131, 1145, 1135, 1182, 1173, 1184, 1153, 1098, - /* 290 */ 1189, 1149, 1196, 1193, 1191, 1205, 1224, 1139, 1146, 1159, - /* 300 */ 1174, 1204, 1206, 1207, 1220, 1237, + /* 0 */ -20, -328, 248, 809, 840, 907, 967, 987, 1096, 655, + /* 10 */ 1116, 1190, 1214, 1281, 1341, 46, -305, 325, 467, 890, + /* 20 */ 1264, 1361, 1424, 1482, 1507, 1580, 1601, 1630, 1651, 1701, + /* 30 */ 1726, 1761, 1784, 1842, 1861, 1922, 1980, 1996, 2059, 2075, + /* 40 */ 2094, 2158, 2175, 2235, 2255, 2329, 2346, 2408, -317, -303, + /* 50 */ 120, 282, 313, 453, 483, 584, 361, 683, -367, -348, + /* 60 */ -272, 461, 206, 293, -442, -384, 72, -364, -286, 475, + /* 70 */ -378, -330, 59, 327, -241, 155, 171, 324, 384, 413, + /* 80 */ 479, 637, 686, 698, -287, 708, 776, 22, 330, 788, + /* 90 */ 791, -358, 802, 465, 815, 70, 817, 452, 60, 844, + /* 100 */ 859, 518, 868, 536, 566, 675, 869, 230, -297, -284, + /* 110 */ -284, -344, -259, -207, 201, 359, 376, 418, 471, 501, + /* 120 */ 524, 704, 711, 760, 761, 765, 824, 838, 874, 878, + /* 130 */ 903, 904, -188, -387, -172, 192, 257, -387, 367, 402, + /* 140 */ 145, 504, 554, 562, -71, -27, 65, 288, -327, 306, + /* 150 */ 648, 380, 685, 517, 633, 772, 705, 407, 427, 432, + /* 160 */ 445, 462, 512, 571, 462, 134, 716, 669, 619, 710, + /* 170 */ 793, 932, 829, 927, 927, 952, 928, 979, 943, 945, + /* 180 */ 899, 899, 884, 899, 941, 942, 927, 982, 989, 1013, + /* 190 */ 1039, 1041, 1045, 1049, 1097, 1100, 1053, 1058, 1060, 1094, + /* 200 */ 1102, 1107, 1101, 1113, 1114, 1115, 1129, 1131, 1061, 1122, + /* 210 */ 1091, 1126, 1132, 1080, 1133, 1136, 1134, 1137, 1138, 1145, + /* 220 */ 1147, 1143, 1148, 1156, 1123, 1135, 1158, 1159, 1163, 1164, + /* 230 */ 1174, 1176, 1178, 1183, 1184, 1155, 1165, 1119, 1120, 1125, + /* 240 */ 1103, 1112, 1104, 1177, 1146, 1150, 1180, 1210, 1216, 1169, + /* 250 */ 1170, 1181, 1111, 1172, 1189, 1128, 1173, 1191, 1195, 927, + /* 260 */ 1141, 1151, 1149, 1139, 1152, 1166, 1171, 1117, 1157, 1153, + /* 270 */ 899, 1217, 1182, 1259, 1260, 1271, 1273, 1231, 1227, 1252, + /* 280 */ 1263, 1265, 1270, 1274, 1246, 1275, 1250, 1303, 1290, 1314, + /* 290 */ 1282, 1223, 1293, 1285, 1310, 1327, 1322, 1333, 1336, 1272, + /* 300 */ 1283, 1277, 1286, 1316, 1328, 1331, 1332, 1339, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, - /* 10 */ 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, - /* 20 */ 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, - /* 30 */ 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, - /* 40 */ 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, - /* 50 */ 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, - /* 60 */ 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, - /* 70 */ 1670, 1670, 1670, 1928, 1670, 1670, 1670, 1670, 1670, 1670, - /* 80 */ 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1749, 1670, 1670, - /* 90 */ 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, - /* 100 */ 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1747, 1921, 2139, - /* 110 */ 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, - /* 120 */ 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, - /* 130 */ 1670, 1670, 1670, 2151, 1670, 1670, 1670, 2151, 2151, 2151, - /* 140 */ 1747, 2111, 2111, 1670, 1670, 1670, 1670, 1749, 1984, 1670, - /* 150 */ 1670, 1670, 1670, 1670, 1670, 1856, 1670, 1670, 1670, 1670, - /* 160 */ 1670, 1880, 1670, 1670, 1670, 1974, 1670, 1670, 2176, 2232, - /* 170 */ 1670, 1670, 2179, 1670, 1670, 1670, 1933, 1670, 1809, 2166, - /* 180 */ 2143, 2157, 2216, 2144, 2141, 2160, 1670, 2170, 1670, 1967, - /* 190 */ 1926, 1670, 1926, 1923, 1670, 1670, 1926, 1923, 1923, 1670, - /* 200 */ 1800, 1670, 1670, 1670, 1670, 1670, 1670, 1749, 1670, 1749, - /* 210 */ 1670, 1670, 1749, 1670, 1749, 1749, 1749, 1670, 1749, 1727, - /* 220 */ 1727, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, - /* 230 */ 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1996, 1982, - /* 240 */ 1670, 1747, 1978, 1976, 1670, 1747, 1670, 1670, 1670, 1670, - /* 250 */ 2187, 2185, 1670, 2187, 2185, 1670, 1670, 1670, 2201, 2197, - /* 260 */ 2187, 2205, 2203, 2172, 2170, 2235, 2222, 2218, 2157, 1670, - /* 270 */ 1670, 1670, 1670, 1747, 1747, 1670, 2185, 1670, 1670, 1670, - /* 280 */ 1670, 1670, 2185, 1670, 1670, 1747, 1670, 1747, 1670, 1670, - /* 290 */ 1825, 1670, 1670, 1670, 1747, 1702, 1670, 1969, 1987, 1951, - /* 300 */ 1951, 1859, 1859, 1859, 1750, 1675, 1670, 1670, 1670, 1670, - /* 310 */ 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 2200, 2199, - /* 320 */ 2066, 1670, 2115, 2114, 2113, 2104, 2065, 1821, 1670, 2064, - /* 330 */ 2063, 1670, 1670, 1670, 1670, 1670, 1670, 1942, 1941, 2057, - /* 340 */ 1670, 1670, 2058, 2056, 2055, 1670, 1670, 1670, 1670, 1670, - /* 350 */ 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, - /* 360 */ 1670, 1670, 1670, 1670, 1670, 1670, 2219, 2223, 1670, 1670, - /* 370 */ 1670, 1670, 1670, 1670, 1670, 2140, 1670, 1670, 1670, 1670, - /* 380 */ 1670, 2039, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, - /* 390 */ 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, - /* 400 */ 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, - /* 410 */ 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, - /* 420 */ 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, - /* 430 */ 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, - /* 440 */ 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, - /* 450 */ 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, - /* 460 */ 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, - /* 470 */ 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, - /* 480 */ 1670, 1670, 1670, 1670, 1707, 2044, 1670, 1670, 1670, 1670, - /* 490 */ 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, - /* 500 */ 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, - /* 510 */ 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, - /* 520 */ 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, - /* 530 */ 1670, 1670, 1788, 1787, 1670, 1670, 1670, 1670, 1670, 1670, - /* 540 */ 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, - /* 550 */ 1670, 1670, 1670, 1670, 1670, 1670, 2048, 1670, 1670, 1670, - /* 560 */ 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, - /* 570 */ 1670, 1670, 2215, 2173, 1670, 1670, 1670, 1670, 1670, 1670, - /* 580 */ 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, - /* 590 */ 1670, 1670, 2039, 1670, 2198, 1670, 1670, 2213, 1670, 2217, - /* 600 */ 1670, 1670, 1670, 1670, 1670, 1670, 1670, 2150, 2146, 1670, - /* 610 */ 1670, 2142, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 2047, - /* 620 */ 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, - /* 630 */ 1670, 1670, 1670, 2038, 1670, 2101, 1670, 1670, 1670, 2135, - /* 640 */ 1670, 1670, 2086, 1670, 1670, 1670, 1670, 1670, 1670, 1670, - /* 650 */ 1670, 1670, 2048, 1670, 2051, 1670, 1670, 1670, 1670, 1670, - /* 660 */ 1853, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, - /* 670 */ 1670, 1670, 1670, 1838, 1836, 1835, 1834, 1670, 1831, 1670, - /* 680 */ 1866, 1670, 1670, 1670, 1862, 1861, 1670, 1670, 1670, 1670, - /* 690 */ 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, - /* 700 */ 1670, 1768, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, - /* 710 */ 1760, 1670, 1759, 1670, 1670, 1670, 1670, 1670, 1670, 1670, - /* 720 */ 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, - /* 730 */ 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, - /* 740 */ 1670, 1670, 1670, 1670, 1670, + /* 0 */ 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, + /* 10 */ 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, + /* 20 */ 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, + /* 30 */ 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, + /* 40 */ 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, + /* 50 */ 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, + /* 60 */ 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, + /* 70 */ 1695, 1695, 1695, 1962, 1695, 1695, 1695, 1695, 1695, 1695, + /* 80 */ 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1774, 1695, 1695, + /* 90 */ 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, + /* 100 */ 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1772, 1955, 2173, + /* 110 */ 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, + /* 120 */ 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, + /* 130 */ 1695, 1695, 1695, 2185, 1695, 1695, 1695, 2185, 2185, 2185, + /* 140 */ 1772, 2145, 2145, 1695, 1695, 1695, 1695, 1774, 2018, 1695, + /* 150 */ 1695, 1695, 1695, 1695, 1695, 1890, 1695, 1695, 1695, 1695, + /* 160 */ 1695, 1914, 1695, 1695, 1695, 2008, 1695, 1695, 2210, 2266, + /* 170 */ 1695, 1695, 2213, 1695, 1695, 1695, 1967, 1695, 1843, 2200, + /* 180 */ 2177, 2191, 2250, 2178, 2175, 2194, 1695, 2204, 1695, 2001, + /* 190 */ 1960, 1695, 1960, 1957, 1695, 1695, 1960, 1957, 1957, 1832, + /* 200 */ 1828, 1695, 1826, 1695, 1695, 1695, 1695, 1695, 1695, 1774, + /* 210 */ 1695, 1774, 1695, 1695, 1774, 1695, 1774, 1774, 1774, 1695, + /* 220 */ 1774, 1752, 1752, 1695, 1695, 1695, 1695, 1695, 1695, 1695, + /* 230 */ 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, + /* 240 */ 2030, 2016, 1695, 1772, 2012, 2010, 1695, 1772, 1695, 1695, + /* 250 */ 1695, 1695, 2221, 2219, 1695, 2221, 2219, 1695, 1695, 1695, + /* 260 */ 2235, 2231, 2221, 2239, 2237, 2206, 2204, 2269, 2256, 2252, + /* 270 */ 2191, 1695, 1695, 1695, 1695, 1772, 1772, 1695, 2219, 1695, + /* 280 */ 1695, 1695, 1695, 1695, 2219, 1695, 1695, 1772, 1695, 1772, + /* 290 */ 1695, 1695, 1859, 1695, 1695, 1695, 1772, 1727, 1695, 2003, + /* 300 */ 2021, 1985, 1985, 1893, 1893, 1893, 1775, 1700, 1695, 1695, + /* 310 */ 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, + /* 320 */ 2234, 2233, 2100, 1695, 2149, 2148, 2147, 2138, 2099, 1855, + /* 330 */ 1695, 2098, 2097, 1695, 1695, 1695, 1695, 1695, 1695, 1695, + /* 340 */ 1695, 1976, 1975, 2091, 1695, 1695, 2092, 2090, 2089, 1695, + /* 350 */ 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, + /* 360 */ 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, + /* 370 */ 2253, 2257, 1695, 1695, 1695, 1695, 1695, 1695, 1695, 2174, + /* 380 */ 1695, 1695, 1695, 1695, 1695, 2073, 1695, 1695, 1695, 1695, + /* 390 */ 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, + /* 400 */ 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, + /* 410 */ 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, + /* 420 */ 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, + /* 430 */ 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, + /* 440 */ 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, + /* 450 */ 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, + /* 460 */ 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, + /* 470 */ 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, + /* 480 */ 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, + /* 490 */ 1695, 1695, 1732, 2078, 1695, 1695, 1695, 1695, 1695, 1695, + /* 500 */ 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, + /* 510 */ 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, + /* 520 */ 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, + /* 530 */ 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, + /* 540 */ 1695, 1813, 1812, 1695, 1695, 1695, 1695, 1695, 1695, 1695, + /* 550 */ 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, + /* 560 */ 1695, 1695, 1695, 1695, 1695, 2082, 1695, 1695, 1695, 1695, + /* 570 */ 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, + /* 580 */ 1695, 2249, 2207, 1695, 1695, 1695, 1695, 1695, 1695, 1695, + /* 590 */ 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, + /* 600 */ 1695, 2073, 1695, 2232, 1695, 1695, 2247, 1695, 2251, 1695, + /* 610 */ 1695, 1695, 1695, 1695, 1695, 1695, 2184, 2180, 1695, 1695, + /* 620 */ 2176, 1695, 1695, 1695, 1695, 1695, 1695, 1695, 2081, 1695, + /* 630 */ 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, + /* 640 */ 1695, 1695, 2072, 1695, 2135, 1695, 1695, 1695, 2169, 1695, + /* 650 */ 1695, 2120, 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, + /* 660 */ 1695, 2082, 1695, 2085, 1695, 1695, 1695, 1695, 1695, 1887, + /* 670 */ 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, + /* 680 */ 1695, 1695, 1872, 1870, 1869, 1868, 1695, 1865, 1695, 1900, + /* 690 */ 1695, 1695, 1695, 1896, 1895, 1695, 1695, 1695, 1695, 1695, + /* 700 */ 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, + /* 710 */ 1793, 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1785, + /* 720 */ 1695, 1784, 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, + /* 730 */ 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, + /* 740 */ 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, + /* 750 */ 1695, 1695, 1695, 1695, }; /********** End of lemon-generated parsing tables *****************************/ @@ -1145,6 +1097,10 @@ static const YYCODETYPE yyFallback[] = { 0, /* TABLE_SUFFIX => nothing */ 0, /* NK_COLON => nothing */ 0, /* MAX_SPEED => nothing */ + 0, /* START => nothing */ + 0, /* WITH => nothing */ + 0, /* TIMESTAMP => nothing */ + 277, /* END => ABORT */ 0, /* TABLE => nothing */ 0, /* NK_LP => nothing */ 0, /* NK_RP => nothing */ @@ -1168,7 +1124,6 @@ static const YYCODETYPE yyFallback[] = { 0, /* FLOAT => nothing */ 0, /* DOUBLE => nothing */ 0, /* BINARY => nothing */ - 0, /* TIMESTAMP => nothing */ 0, /* NCHAR => nothing */ 0, /* UNSIGNED => nothing */ 0, /* JSON => nothing */ @@ -1222,7 +1177,6 @@ static const YYCODETYPE yyFallback[] = { 0, /* COUNT => nothing */ 0, /* LAST_ROW => nothing */ 0, /* TOPIC => nothing */ - 0, /* WITH => nothing */ 0, /* META => nothing */ 0, /* CONSUMER => nothing */ 0, /* GROUP => nothing */ @@ -1282,7 +1236,6 @@ static const YYCODETYPE yyFallback[] = { 0, /* SERVER_STATUS => nothing */ 0, /* CURRENT_USER => nothing */ 0, /* CASE => nothing */ - 277, /* END => ABORT */ 0, /* WHEN => nothing */ 0, /* THEN => nothing */ 0, /* ELSE => nothing */ @@ -1307,7 +1260,6 @@ static const YYCODETYPE yyFallback[] = { 0, /* SESSION => nothing */ 0, /* STATE_WINDOW => nothing */ 0, /* EVENT_WINDOW => nothing */ - 0, /* START => nothing */ 0, /* SLIDING => nothing */ 0, /* FILL => nothing */ 0, /* VALUE => nothing */ @@ -1561,169 +1513,169 @@ static const char *const yyTokenName[] = { /* 92 */ "TABLE_SUFFIX", /* 93 */ "NK_COLON", /* 94 */ "MAX_SPEED", - /* 95 */ "TABLE", - /* 96 */ "NK_LP", - /* 97 */ "NK_RP", - /* 98 */ "STABLE", - /* 99 */ "ADD", - /* 100 */ "COLUMN", - /* 101 */ "MODIFY", - /* 102 */ "RENAME", - /* 103 */ "TAG", - /* 104 */ "SET", - /* 105 */ "NK_EQ", - /* 106 */ "USING", - /* 107 */ "TAGS", - /* 108 */ "COMMENT", - /* 109 */ "BOOL", - /* 110 */ "TINYINT", - /* 111 */ "SMALLINT", - /* 112 */ "INT", - /* 113 */ "INTEGER", - /* 114 */ "BIGINT", - /* 115 */ "FLOAT", - /* 116 */ "DOUBLE", - /* 117 */ "BINARY", - /* 118 */ "TIMESTAMP", - /* 119 */ "NCHAR", - /* 120 */ "UNSIGNED", - /* 121 */ "JSON", - /* 122 */ "VARCHAR", - /* 123 */ "MEDIUMBLOB", - /* 124 */ "BLOB", - /* 125 */ "VARBINARY", - /* 126 */ "DECIMAL", - /* 127 */ "MAX_DELAY", - /* 128 */ "WATERMARK", - /* 129 */ "ROLLUP", - /* 130 */ "TTL", - /* 131 */ "SMA", - /* 132 */ "DELETE_MARK", - /* 133 */ "FIRST", - /* 134 */ "LAST", - /* 135 */ "SHOW", - /* 136 */ "PRIVILEGES", - /* 137 */ "DATABASES", - /* 138 */ "TABLES", - /* 139 */ "STABLES", - /* 140 */ "MNODES", - /* 141 */ "QNODES", - /* 142 */ "FUNCTIONS", - /* 143 */ "INDEXES", - /* 144 */ "ACCOUNTS", - /* 145 */ "APPS", - /* 146 */ "CONNECTIONS", - /* 147 */ "LICENCES", - /* 148 */ "GRANTS", - /* 149 */ "QUERIES", - /* 150 */ "SCORES", - /* 151 */ "TOPICS", - /* 152 */ "VARIABLES", - /* 153 */ "CLUSTER", - /* 154 */ "BNODES", - /* 155 */ "SNODES", - /* 156 */ "TRANSACTIONS", - /* 157 */ "DISTRIBUTED", - /* 158 */ "CONSUMERS", - /* 159 */ "SUBSCRIPTIONS", - /* 160 */ "VNODES", - /* 161 */ "ALIVE", - /* 162 */ "LIKE", - /* 163 */ "TBNAME", - /* 164 */ "QTAGS", - /* 165 */ "AS", - /* 166 */ "INDEX", - /* 167 */ "FUNCTION", - /* 168 */ "INTERVAL", - /* 169 */ "COUNT", - /* 170 */ "LAST_ROW", - /* 171 */ "TOPIC", - /* 172 */ "WITH", - /* 173 */ "META", - /* 174 */ "CONSUMER", - /* 175 */ "GROUP", - /* 176 */ "DESC", - /* 177 */ "DESCRIBE", - /* 178 */ "RESET", - /* 179 */ "QUERY", - /* 180 */ "CACHE", - /* 181 */ "EXPLAIN", - /* 182 */ "ANALYZE", - /* 183 */ "VERBOSE", - /* 184 */ "NK_BOOL", - /* 185 */ "RATIO", - /* 186 */ "NK_FLOAT", - /* 187 */ "OUTPUTTYPE", - /* 188 */ "AGGREGATE", - /* 189 */ "BUFSIZE", - /* 190 */ "LANGUAGE", - /* 191 */ "STREAM", - /* 192 */ "INTO", - /* 193 */ "TRIGGER", - /* 194 */ "AT_ONCE", - /* 195 */ "WINDOW_CLOSE", - /* 196 */ "IGNORE", - /* 197 */ "EXPIRED", - /* 198 */ "FILL_HISTORY", - /* 199 */ "UPDATE", - /* 200 */ "SUBTABLE", - /* 201 */ "KILL", - /* 202 */ "CONNECTION", - /* 203 */ "TRANSACTION", - /* 204 */ "BALANCE", - /* 205 */ "VGROUP", - /* 206 */ "MERGE", - /* 207 */ "REDISTRIBUTE", - /* 208 */ "SPLIT", - /* 209 */ "DELETE", - /* 210 */ "INSERT", - /* 211 */ "NULL", - /* 212 */ "NK_QUESTION", - /* 213 */ "NK_ARROW", - /* 214 */ "ROWTS", - /* 215 */ "QSTART", - /* 216 */ "QEND", - /* 217 */ "QDURATION", - /* 218 */ "WSTART", - /* 219 */ "WEND", - /* 220 */ "WDURATION", - /* 221 */ "IROWTS", - /* 222 */ "ISFILLED", - /* 223 */ "CAST", - /* 224 */ "NOW", - /* 225 */ "TODAY", - /* 226 */ "TIMEZONE", - /* 227 */ "CLIENT_VERSION", - /* 228 */ "SERVER_VERSION", - /* 229 */ "SERVER_STATUS", - /* 230 */ "CURRENT_USER", - /* 231 */ "CASE", - /* 232 */ "END", - /* 233 */ "WHEN", - /* 234 */ "THEN", - /* 235 */ "ELSE", - /* 236 */ "BETWEEN", - /* 237 */ "IS", - /* 238 */ "NK_LT", - /* 239 */ "NK_GT", - /* 240 */ "NK_LE", - /* 241 */ "NK_GE", - /* 242 */ "NK_NE", - /* 243 */ "MATCH", - /* 244 */ "NMATCH", - /* 245 */ "CONTAINS", - /* 246 */ "IN", - /* 247 */ "JOIN", - /* 248 */ "INNER", - /* 249 */ "SELECT", - /* 250 */ "DISTINCT", - /* 251 */ "WHERE", - /* 252 */ "PARTITION", - /* 253 */ "BY", - /* 254 */ "SESSION", - /* 255 */ "STATE_WINDOW", - /* 256 */ "EVENT_WINDOW", - /* 257 */ "START", + /* 95 */ "START", + /* 96 */ "WITH", + /* 97 */ "TIMESTAMP", + /* 98 */ "END", + /* 99 */ "TABLE", + /* 100 */ "NK_LP", + /* 101 */ "NK_RP", + /* 102 */ "STABLE", + /* 103 */ "ADD", + /* 104 */ "COLUMN", + /* 105 */ "MODIFY", + /* 106 */ "RENAME", + /* 107 */ "TAG", + /* 108 */ "SET", + /* 109 */ "NK_EQ", + /* 110 */ "USING", + /* 111 */ "TAGS", + /* 112 */ "COMMENT", + /* 113 */ "BOOL", + /* 114 */ "TINYINT", + /* 115 */ "SMALLINT", + /* 116 */ "INT", + /* 117 */ "INTEGER", + /* 118 */ "BIGINT", + /* 119 */ "FLOAT", + /* 120 */ "DOUBLE", + /* 121 */ "BINARY", + /* 122 */ "NCHAR", + /* 123 */ "UNSIGNED", + /* 124 */ "JSON", + /* 125 */ "VARCHAR", + /* 126 */ "MEDIUMBLOB", + /* 127 */ "BLOB", + /* 128 */ "VARBINARY", + /* 129 */ "DECIMAL", + /* 130 */ "MAX_DELAY", + /* 131 */ "WATERMARK", + /* 132 */ "ROLLUP", + /* 133 */ "TTL", + /* 134 */ "SMA", + /* 135 */ "DELETE_MARK", + /* 136 */ "FIRST", + /* 137 */ "LAST", + /* 138 */ "SHOW", + /* 139 */ "PRIVILEGES", + /* 140 */ "DATABASES", + /* 141 */ "TABLES", + /* 142 */ "STABLES", + /* 143 */ "MNODES", + /* 144 */ "QNODES", + /* 145 */ "FUNCTIONS", + /* 146 */ "INDEXES", + /* 147 */ "ACCOUNTS", + /* 148 */ "APPS", + /* 149 */ "CONNECTIONS", + /* 150 */ "LICENCES", + /* 151 */ "GRANTS", + /* 152 */ "QUERIES", + /* 153 */ "SCORES", + /* 154 */ "TOPICS", + /* 155 */ "VARIABLES", + /* 156 */ "CLUSTER", + /* 157 */ "BNODES", + /* 158 */ "SNODES", + /* 159 */ "TRANSACTIONS", + /* 160 */ "DISTRIBUTED", + /* 161 */ "CONSUMERS", + /* 162 */ "SUBSCRIPTIONS", + /* 163 */ "VNODES", + /* 164 */ "ALIVE", + /* 165 */ "LIKE", + /* 166 */ "TBNAME", + /* 167 */ "QTAGS", + /* 168 */ "AS", + /* 169 */ "INDEX", + /* 170 */ "FUNCTION", + /* 171 */ "INTERVAL", + /* 172 */ "COUNT", + /* 173 */ "LAST_ROW", + /* 174 */ "TOPIC", + /* 175 */ "META", + /* 176 */ "CONSUMER", + /* 177 */ "GROUP", + /* 178 */ "DESC", + /* 179 */ "DESCRIBE", + /* 180 */ "RESET", + /* 181 */ "QUERY", + /* 182 */ "CACHE", + /* 183 */ "EXPLAIN", + /* 184 */ "ANALYZE", + /* 185 */ "VERBOSE", + /* 186 */ "NK_BOOL", + /* 187 */ "RATIO", + /* 188 */ "NK_FLOAT", + /* 189 */ "OUTPUTTYPE", + /* 190 */ "AGGREGATE", + /* 191 */ "BUFSIZE", + /* 192 */ "LANGUAGE", + /* 193 */ "STREAM", + /* 194 */ "INTO", + /* 195 */ "TRIGGER", + /* 196 */ "AT_ONCE", + /* 197 */ "WINDOW_CLOSE", + /* 198 */ "IGNORE", + /* 199 */ "EXPIRED", + /* 200 */ "FILL_HISTORY", + /* 201 */ "UPDATE", + /* 202 */ "SUBTABLE", + /* 203 */ "KILL", + /* 204 */ "CONNECTION", + /* 205 */ "TRANSACTION", + /* 206 */ "BALANCE", + /* 207 */ "VGROUP", + /* 208 */ "MERGE", + /* 209 */ "REDISTRIBUTE", + /* 210 */ "SPLIT", + /* 211 */ "DELETE", + /* 212 */ "INSERT", + /* 213 */ "NULL", + /* 214 */ "NK_QUESTION", + /* 215 */ "NK_ARROW", + /* 216 */ "ROWTS", + /* 217 */ "QSTART", + /* 218 */ "QEND", + /* 219 */ "QDURATION", + /* 220 */ "WSTART", + /* 221 */ "WEND", + /* 222 */ "WDURATION", + /* 223 */ "IROWTS", + /* 224 */ "ISFILLED", + /* 225 */ "CAST", + /* 226 */ "NOW", + /* 227 */ "TODAY", + /* 228 */ "TIMEZONE", + /* 229 */ "CLIENT_VERSION", + /* 230 */ "SERVER_VERSION", + /* 231 */ "SERVER_STATUS", + /* 232 */ "CURRENT_USER", + /* 233 */ "CASE", + /* 234 */ "WHEN", + /* 235 */ "THEN", + /* 236 */ "ELSE", + /* 237 */ "BETWEEN", + /* 238 */ "IS", + /* 239 */ "NK_LT", + /* 240 */ "NK_GT", + /* 241 */ "NK_LE", + /* 242 */ "NK_GE", + /* 243 */ "NK_NE", + /* 244 */ "MATCH", + /* 245 */ "NMATCH", + /* 246 */ "CONTAINS", + /* 247 */ "IN", + /* 248 */ "JOIN", + /* 249 */ "INNER", + /* 250 */ "SELECT", + /* 251 */ "DISTINCT", + /* 252 */ "WHERE", + /* 253 */ "PARTITION", + /* 254 */ "BY", + /* 255 */ "SESSION", + /* 256 */ "STATE_WINDOW", + /* 257 */ "EVENT_WINDOW", /* 258 */ "SLIDING", /* 259 */ "FILL", /* 260 */ "VALUE", @@ -1815,128 +1767,130 @@ static const char *const yyTokenName[] = { /* 346 */ "exists_opt", /* 347 */ "alter_db_options", /* 348 */ "speed_opt", - /* 349 */ "integer_list", - /* 350 */ "variable_list", - /* 351 */ "retention_list", - /* 352 */ "alter_db_option", - /* 353 */ "retention", - /* 354 */ "full_table_name", - /* 355 */ "column_def_list", - /* 356 */ "tags_def_opt", - /* 357 */ "table_options", - /* 358 */ "multi_create_clause", - /* 359 */ "tags_def", - /* 360 */ "multi_drop_clause", - /* 361 */ "alter_table_clause", - /* 362 */ "alter_table_options", - /* 363 */ "column_name", - /* 364 */ "type_name", - /* 365 */ "signed_literal", - /* 366 */ "create_subtable_clause", - /* 367 */ "specific_cols_opt", - /* 368 */ "expression_list", - /* 369 */ "drop_table_clause", - /* 370 */ "col_name_list", - /* 371 */ "table_name", - /* 372 */ "column_def", - /* 373 */ "duration_list", - /* 374 */ "rollup_func_list", - /* 375 */ "alter_table_option", - /* 376 */ "duration_literal", - /* 377 */ "rollup_func_name", - /* 378 */ "function_name", - /* 379 */ "col_name", - /* 380 */ "db_name_cond_opt", - /* 381 */ "like_pattern_opt", - /* 382 */ "table_name_cond", - /* 383 */ "from_db_opt", - /* 384 */ "tag_list_opt", - /* 385 */ "tag_item", - /* 386 */ "column_alias", - /* 387 */ "full_index_name", - /* 388 */ "index_options", - /* 389 */ "index_name", - /* 390 */ "func_list", - /* 391 */ "sliding_opt", - /* 392 */ "sma_stream_opt", - /* 393 */ "func", - /* 394 */ "sma_func_name", - /* 395 */ "query_or_subquery", - /* 396 */ "cgroup_name", - /* 397 */ "analyze_opt", - /* 398 */ "explain_options", - /* 399 */ "insert_query", - /* 400 */ "agg_func_opt", - /* 401 */ "bufsize_opt", - /* 402 */ "language_opt", - /* 403 */ "stream_name", - /* 404 */ "stream_options", - /* 405 */ "col_list_opt", - /* 406 */ "tag_def_or_ref_opt", - /* 407 */ "subtable_opt", - /* 408 */ "expression", - /* 409 */ "dnode_list", - /* 410 */ "where_clause_opt", - /* 411 */ "signed", - /* 412 */ "literal_func", - /* 413 */ "literal_list", - /* 414 */ "table_alias", - /* 415 */ "expr_or_subquery", - /* 416 */ "pseudo_column", - /* 417 */ "column_reference", - /* 418 */ "function_expression", - /* 419 */ "case_when_expression", - /* 420 */ "star_func", - /* 421 */ "star_func_para_list", - /* 422 */ "noarg_func", - /* 423 */ "other_para_list", - /* 424 */ "star_func_para", - /* 425 */ "when_then_list", - /* 426 */ "case_when_else_opt", - /* 427 */ "common_expression", - /* 428 */ "when_then_expr", - /* 429 */ "predicate", - /* 430 */ "compare_op", - /* 431 */ "in_op", - /* 432 */ "in_predicate_value", - /* 433 */ "boolean_value_expression", - /* 434 */ "boolean_primary", - /* 435 */ "from_clause_opt", - /* 436 */ "table_reference_list", - /* 437 */ "table_reference", - /* 438 */ "table_primary", - /* 439 */ "joined_table", - /* 440 */ "alias_opt", - /* 441 */ "subquery", - /* 442 */ "parenthesized_joined_table", - /* 443 */ "join_type", - /* 444 */ "search_condition", - /* 445 */ "query_specification", - /* 446 */ "set_quantifier_opt", - /* 447 */ "select_list", - /* 448 */ "partition_by_clause_opt", - /* 449 */ "range_opt", - /* 450 */ "every_opt", - /* 451 */ "fill_opt", - /* 452 */ "twindow_clause_opt", - /* 453 */ "group_by_clause_opt", - /* 454 */ "having_clause_opt", - /* 455 */ "select_item", - /* 456 */ "partition_list", - /* 457 */ "partition_item", - /* 458 */ "fill_mode", - /* 459 */ "group_by_list", - /* 460 */ "query_expression", - /* 461 */ "query_simple", - /* 462 */ "order_by_clause_opt", - /* 463 */ "slimit_clause_opt", - /* 464 */ "limit_clause_opt", - /* 465 */ "union_query_expression", - /* 466 */ "query_simple_or_subquery", - /* 467 */ "sort_specification_list", - /* 468 */ "sort_specification", - /* 469 */ "ordering_specification_opt", - /* 470 */ "null_ordering_opt", + /* 349 */ "start_opt", + /* 350 */ "end_opt", + /* 351 */ "integer_list", + /* 352 */ "variable_list", + /* 353 */ "retention_list", + /* 354 */ "alter_db_option", + /* 355 */ "retention", + /* 356 */ "full_table_name", + /* 357 */ "column_def_list", + /* 358 */ "tags_def_opt", + /* 359 */ "table_options", + /* 360 */ "multi_create_clause", + /* 361 */ "tags_def", + /* 362 */ "multi_drop_clause", + /* 363 */ "alter_table_clause", + /* 364 */ "alter_table_options", + /* 365 */ "column_name", + /* 366 */ "type_name", + /* 367 */ "signed_literal", + /* 368 */ "create_subtable_clause", + /* 369 */ "specific_cols_opt", + /* 370 */ "expression_list", + /* 371 */ "drop_table_clause", + /* 372 */ "col_name_list", + /* 373 */ "table_name", + /* 374 */ "column_def", + /* 375 */ "duration_list", + /* 376 */ "rollup_func_list", + /* 377 */ "alter_table_option", + /* 378 */ "duration_literal", + /* 379 */ "rollup_func_name", + /* 380 */ "function_name", + /* 381 */ "col_name", + /* 382 */ "db_name_cond_opt", + /* 383 */ "like_pattern_opt", + /* 384 */ "table_name_cond", + /* 385 */ "from_db_opt", + /* 386 */ "tag_list_opt", + /* 387 */ "tag_item", + /* 388 */ "column_alias", + /* 389 */ "full_index_name", + /* 390 */ "index_options", + /* 391 */ "index_name", + /* 392 */ "func_list", + /* 393 */ "sliding_opt", + /* 394 */ "sma_stream_opt", + /* 395 */ "func", + /* 396 */ "sma_func_name", + /* 397 */ "query_or_subquery", + /* 398 */ "cgroup_name", + /* 399 */ "analyze_opt", + /* 400 */ "explain_options", + /* 401 */ "insert_query", + /* 402 */ "agg_func_opt", + /* 403 */ "bufsize_opt", + /* 404 */ "language_opt", + /* 405 */ "stream_name", + /* 406 */ "stream_options", + /* 407 */ "col_list_opt", + /* 408 */ "tag_def_or_ref_opt", + /* 409 */ "subtable_opt", + /* 410 */ "expression", + /* 411 */ "dnode_list", + /* 412 */ "where_clause_opt", + /* 413 */ "signed", + /* 414 */ "literal_func", + /* 415 */ "literal_list", + /* 416 */ "table_alias", + /* 417 */ "expr_or_subquery", + /* 418 */ "pseudo_column", + /* 419 */ "column_reference", + /* 420 */ "function_expression", + /* 421 */ "case_when_expression", + /* 422 */ "star_func", + /* 423 */ "star_func_para_list", + /* 424 */ "noarg_func", + /* 425 */ "other_para_list", + /* 426 */ "star_func_para", + /* 427 */ "when_then_list", + /* 428 */ "case_when_else_opt", + /* 429 */ "common_expression", + /* 430 */ "when_then_expr", + /* 431 */ "predicate", + /* 432 */ "compare_op", + /* 433 */ "in_op", + /* 434 */ "in_predicate_value", + /* 435 */ "boolean_value_expression", + /* 436 */ "boolean_primary", + /* 437 */ "from_clause_opt", + /* 438 */ "table_reference_list", + /* 439 */ "table_reference", + /* 440 */ "table_primary", + /* 441 */ "joined_table", + /* 442 */ "alias_opt", + /* 443 */ "subquery", + /* 444 */ "parenthesized_joined_table", + /* 445 */ "join_type", + /* 446 */ "search_condition", + /* 447 */ "query_specification", + /* 448 */ "set_quantifier_opt", + /* 449 */ "select_list", + /* 450 */ "partition_by_clause_opt", + /* 451 */ "range_opt", + /* 452 */ "every_opt", + /* 453 */ "fill_opt", + /* 454 */ "twindow_clause_opt", + /* 455 */ "group_by_clause_opt", + /* 456 */ "having_clause_opt", + /* 457 */ "select_item", + /* 458 */ "partition_list", + /* 459 */ "partition_item", + /* 460 */ "fill_mode", + /* 461 */ "group_by_list", + /* 462 */ "query_expression", + /* 463 */ "query_simple", + /* 464 */ "order_by_clause_opt", + /* 465 */ "slimit_clause_opt", + /* 466 */ "limit_clause_opt", + /* 467 */ "union_query_expression", + /* 468 */ "query_simple_or_subquery", + /* 469 */ "sort_specification_list", + /* 470 */ "sort_specification", + /* 471 */ "ordering_specification_opt", + /* 472 */ "null_ordering_opt", }; #endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */ @@ -2016,7 +1970,7 @@ static const char *const yyRuleName[] = { /* 69 */ "cmd ::= ALTER DATABASE db_name alter_db_options", /* 70 */ "cmd ::= FLUSH DATABASE db_name", /* 71 */ "cmd ::= TRIM DATABASE db_name speed_opt", - /* 72 */ "cmd ::= COMPACT DATABASE db_name", + /* 72 */ "cmd ::= COMPACT DATABASE db_name start_opt end_opt", /* 73 */ "not_exists_opt ::= IF NOT EXISTS", /* 74 */ "not_exists_opt ::=", /* 75 */ "exists_opt ::= IF EXISTS", @@ -2064,451 +2018,460 @@ static const char *const yyRuleName[] = { /* 117 */ "alter_db_option ::= REPLICA NK_INTEGER", /* 118 */ "alter_db_option ::= WAL_LEVEL NK_INTEGER", /* 119 */ "alter_db_option ::= STT_TRIGGER NK_INTEGER", - /* 120 */ "integer_list ::= NK_INTEGER", - /* 121 */ "integer_list ::= integer_list NK_COMMA NK_INTEGER", - /* 122 */ "variable_list ::= NK_VARIABLE", - /* 123 */ "variable_list ::= variable_list NK_COMMA NK_VARIABLE", - /* 124 */ "retention_list ::= retention", - /* 125 */ "retention_list ::= retention_list NK_COMMA retention", - /* 126 */ "retention ::= NK_VARIABLE NK_COLON NK_VARIABLE", - /* 127 */ "speed_opt ::=", - /* 128 */ "speed_opt ::= MAX_SPEED NK_INTEGER", - /* 129 */ "cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options", - /* 130 */ "cmd ::= CREATE TABLE multi_create_clause", - /* 131 */ "cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options", - /* 132 */ "cmd ::= DROP TABLE multi_drop_clause", - /* 133 */ "cmd ::= DROP STABLE exists_opt full_table_name", - /* 134 */ "cmd ::= ALTER TABLE alter_table_clause", - /* 135 */ "cmd ::= ALTER STABLE alter_table_clause", - /* 136 */ "alter_table_clause ::= full_table_name alter_table_options", - /* 137 */ "alter_table_clause ::= full_table_name ADD COLUMN column_name type_name", - /* 138 */ "alter_table_clause ::= full_table_name DROP COLUMN column_name", - /* 139 */ "alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name", - /* 140 */ "alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name", - /* 141 */ "alter_table_clause ::= full_table_name ADD TAG column_name type_name", - /* 142 */ "alter_table_clause ::= full_table_name DROP TAG column_name", - /* 143 */ "alter_table_clause ::= full_table_name MODIFY TAG column_name type_name", - /* 144 */ "alter_table_clause ::= full_table_name RENAME TAG column_name column_name", - /* 145 */ "alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal", - /* 146 */ "multi_create_clause ::= create_subtable_clause", - /* 147 */ "multi_create_clause ::= multi_create_clause create_subtable_clause", - /* 148 */ "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", - /* 149 */ "multi_drop_clause ::= drop_table_clause", - /* 150 */ "multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause", - /* 151 */ "drop_table_clause ::= exists_opt full_table_name", - /* 152 */ "specific_cols_opt ::=", - /* 153 */ "specific_cols_opt ::= NK_LP col_name_list NK_RP", - /* 154 */ "full_table_name ::= table_name", - /* 155 */ "full_table_name ::= db_name NK_DOT table_name", - /* 156 */ "column_def_list ::= column_def", - /* 157 */ "column_def_list ::= column_def_list NK_COMMA column_def", - /* 158 */ "column_def ::= column_name type_name", - /* 159 */ "column_def ::= column_name type_name COMMENT NK_STRING", - /* 160 */ "type_name ::= BOOL", - /* 161 */ "type_name ::= TINYINT", - /* 162 */ "type_name ::= SMALLINT", - /* 163 */ "type_name ::= INT", - /* 164 */ "type_name ::= INTEGER", - /* 165 */ "type_name ::= BIGINT", - /* 166 */ "type_name ::= FLOAT", - /* 167 */ "type_name ::= DOUBLE", - /* 168 */ "type_name ::= BINARY NK_LP NK_INTEGER NK_RP", - /* 169 */ "type_name ::= TIMESTAMP", - /* 170 */ "type_name ::= NCHAR NK_LP NK_INTEGER NK_RP", - /* 171 */ "type_name ::= TINYINT UNSIGNED", - /* 172 */ "type_name ::= SMALLINT UNSIGNED", - /* 173 */ "type_name ::= INT UNSIGNED", - /* 174 */ "type_name ::= BIGINT UNSIGNED", - /* 175 */ "type_name ::= JSON", - /* 176 */ "type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP", - /* 177 */ "type_name ::= MEDIUMBLOB", - /* 178 */ "type_name ::= BLOB", - /* 179 */ "type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP", - /* 180 */ "type_name ::= DECIMAL", - /* 181 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP", - /* 182 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP", - /* 183 */ "tags_def_opt ::=", - /* 184 */ "tags_def_opt ::= tags_def", - /* 185 */ "tags_def ::= TAGS NK_LP column_def_list NK_RP", - /* 186 */ "table_options ::=", - /* 187 */ "table_options ::= table_options COMMENT NK_STRING", - /* 188 */ "table_options ::= table_options MAX_DELAY duration_list", - /* 189 */ "table_options ::= table_options WATERMARK duration_list", - /* 190 */ "table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP", - /* 191 */ "table_options ::= table_options TTL NK_INTEGER", - /* 192 */ "table_options ::= table_options SMA NK_LP col_name_list NK_RP", - /* 193 */ "table_options ::= table_options DELETE_MARK duration_list", - /* 194 */ "alter_table_options ::= alter_table_option", - /* 195 */ "alter_table_options ::= alter_table_options alter_table_option", - /* 196 */ "alter_table_option ::= COMMENT NK_STRING", - /* 197 */ "alter_table_option ::= TTL NK_INTEGER", - /* 198 */ "duration_list ::= duration_literal", - /* 199 */ "duration_list ::= duration_list NK_COMMA duration_literal", - /* 200 */ "rollup_func_list ::= rollup_func_name", - /* 201 */ "rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name", - /* 202 */ "rollup_func_name ::= function_name", - /* 203 */ "rollup_func_name ::= FIRST", - /* 204 */ "rollup_func_name ::= LAST", - /* 205 */ "col_name_list ::= col_name", - /* 206 */ "col_name_list ::= col_name_list NK_COMMA col_name", - /* 207 */ "col_name ::= column_name", - /* 208 */ "cmd ::= SHOW DNODES", - /* 209 */ "cmd ::= SHOW USERS", - /* 210 */ "cmd ::= SHOW USER PRIVILEGES", - /* 211 */ "cmd ::= SHOW DATABASES", - /* 212 */ "cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt", - /* 213 */ "cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt", - /* 214 */ "cmd ::= SHOW db_name_cond_opt VGROUPS", - /* 215 */ "cmd ::= SHOW MNODES", - /* 216 */ "cmd ::= SHOW QNODES", - /* 217 */ "cmd ::= SHOW FUNCTIONS", - /* 218 */ "cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt", - /* 219 */ "cmd ::= SHOW STREAMS", - /* 220 */ "cmd ::= SHOW ACCOUNTS", - /* 221 */ "cmd ::= SHOW APPS", - /* 222 */ "cmd ::= SHOW CONNECTIONS", - /* 223 */ "cmd ::= SHOW LICENCES", - /* 224 */ "cmd ::= SHOW GRANTS", - /* 225 */ "cmd ::= SHOW CREATE DATABASE db_name", - /* 226 */ "cmd ::= SHOW CREATE TABLE full_table_name", - /* 227 */ "cmd ::= SHOW CREATE STABLE full_table_name", - /* 228 */ "cmd ::= SHOW QUERIES", - /* 229 */ "cmd ::= SHOW SCORES", - /* 230 */ "cmd ::= SHOW TOPICS", - /* 231 */ "cmd ::= SHOW VARIABLES", - /* 232 */ "cmd ::= SHOW CLUSTER VARIABLES", - /* 233 */ "cmd ::= SHOW LOCAL VARIABLES", - /* 234 */ "cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt", - /* 235 */ "cmd ::= SHOW BNODES", - /* 236 */ "cmd ::= SHOW SNODES", - /* 237 */ "cmd ::= SHOW CLUSTER", - /* 238 */ "cmd ::= SHOW TRANSACTIONS", - /* 239 */ "cmd ::= SHOW TABLE DISTRIBUTED full_table_name", - /* 240 */ "cmd ::= SHOW CONSUMERS", - /* 241 */ "cmd ::= SHOW SUBSCRIPTIONS", - /* 242 */ "cmd ::= SHOW TAGS FROM table_name_cond from_db_opt", - /* 243 */ "cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt", - /* 244 */ "cmd ::= SHOW VNODES NK_INTEGER", - /* 245 */ "cmd ::= SHOW VNODES NK_STRING", - /* 246 */ "cmd ::= SHOW db_name_cond_opt ALIVE", - /* 247 */ "cmd ::= SHOW CLUSTER ALIVE", - /* 248 */ "db_name_cond_opt ::=", - /* 249 */ "db_name_cond_opt ::= db_name NK_DOT", - /* 250 */ "like_pattern_opt ::=", - /* 251 */ "like_pattern_opt ::= LIKE NK_STRING", - /* 252 */ "table_name_cond ::= table_name", - /* 253 */ "from_db_opt ::=", - /* 254 */ "from_db_opt ::= FROM db_name", - /* 255 */ "tag_list_opt ::=", - /* 256 */ "tag_list_opt ::= tag_item", - /* 257 */ "tag_list_opt ::= tag_list_opt NK_COMMA tag_item", - /* 258 */ "tag_item ::= TBNAME", - /* 259 */ "tag_item ::= QTAGS", - /* 260 */ "tag_item ::= column_name", - /* 261 */ "tag_item ::= column_name column_alias", - /* 262 */ "tag_item ::= column_name AS column_alias", - /* 263 */ "cmd ::= CREATE SMA INDEX not_exists_opt full_index_name ON full_table_name index_options", - /* 264 */ "cmd ::= CREATE INDEX not_exists_opt full_index_name ON full_table_name NK_LP col_name_list NK_RP", - /* 265 */ "cmd ::= DROP INDEX exists_opt full_index_name", - /* 266 */ "full_index_name ::= index_name", - /* 267 */ "full_index_name ::= db_name NK_DOT index_name", - /* 268 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt", - /* 269 */ "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", - /* 270 */ "func_list ::= func", - /* 271 */ "func_list ::= func_list NK_COMMA func", - /* 272 */ "func ::= sma_func_name NK_LP expression_list NK_RP", - /* 273 */ "sma_func_name ::= function_name", - /* 274 */ "sma_func_name ::= COUNT", - /* 275 */ "sma_func_name ::= FIRST", - /* 276 */ "sma_func_name ::= LAST", - /* 277 */ "sma_func_name ::= LAST_ROW", - /* 278 */ "sma_stream_opt ::=", - /* 279 */ "sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal", - /* 280 */ "sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal", - /* 281 */ "sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal", - /* 282 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery", - /* 283 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name", - /* 284 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name", - /* 285 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name", - /* 286 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name", - /* 287 */ "cmd ::= DROP TOPIC exists_opt topic_name", - /* 288 */ "cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name", - /* 289 */ "cmd ::= DESC full_table_name", - /* 290 */ "cmd ::= DESCRIBE full_table_name", - /* 291 */ "cmd ::= RESET QUERY CACHE", - /* 292 */ "cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery", - /* 293 */ "cmd ::= EXPLAIN analyze_opt explain_options insert_query", - /* 294 */ "analyze_opt ::=", - /* 295 */ "analyze_opt ::= ANALYZE", - /* 296 */ "explain_options ::=", - /* 297 */ "explain_options ::= explain_options VERBOSE NK_BOOL", - /* 298 */ "explain_options ::= explain_options RATIO NK_FLOAT", - /* 299 */ "cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt", - /* 300 */ "cmd ::= DROP FUNCTION exists_opt function_name", - /* 301 */ "agg_func_opt ::=", - /* 302 */ "agg_func_opt ::= AGGREGATE", - /* 303 */ "bufsize_opt ::=", - /* 304 */ "bufsize_opt ::= BUFSIZE NK_INTEGER", - /* 305 */ "language_opt ::=", - /* 306 */ "language_opt ::= LANGUAGE NK_STRING", - /* 307 */ "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", - /* 308 */ "cmd ::= DROP STREAM exists_opt stream_name", - /* 309 */ "col_list_opt ::=", - /* 310 */ "col_list_opt ::= NK_LP col_name_list NK_RP", - /* 311 */ "tag_def_or_ref_opt ::=", - /* 312 */ "tag_def_or_ref_opt ::= tags_def", - /* 313 */ "tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP", - /* 314 */ "stream_options ::=", - /* 315 */ "stream_options ::= stream_options TRIGGER AT_ONCE", - /* 316 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE", - /* 317 */ "stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal", - /* 318 */ "stream_options ::= stream_options WATERMARK duration_literal", - /* 319 */ "stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER", - /* 320 */ "stream_options ::= stream_options FILL_HISTORY NK_INTEGER", - /* 321 */ "stream_options ::= stream_options DELETE_MARK duration_literal", - /* 322 */ "stream_options ::= stream_options IGNORE UPDATE NK_INTEGER", - /* 323 */ "subtable_opt ::=", - /* 324 */ "subtable_opt ::= SUBTABLE NK_LP expression NK_RP", - /* 325 */ "cmd ::= KILL CONNECTION NK_INTEGER", - /* 326 */ "cmd ::= KILL QUERY NK_STRING", - /* 327 */ "cmd ::= KILL TRANSACTION NK_INTEGER", - /* 328 */ "cmd ::= BALANCE VGROUP", - /* 329 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER", - /* 330 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list", - /* 331 */ "cmd ::= SPLIT VGROUP NK_INTEGER", - /* 332 */ "dnode_list ::= DNODE NK_INTEGER", - /* 333 */ "dnode_list ::= dnode_list DNODE NK_INTEGER", - /* 334 */ "cmd ::= DELETE FROM full_table_name where_clause_opt", - /* 335 */ "cmd ::= query_or_subquery", - /* 336 */ "cmd ::= insert_query", - /* 337 */ "insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery", - /* 338 */ "insert_query ::= INSERT INTO full_table_name query_or_subquery", - /* 339 */ "literal ::= NK_INTEGER", - /* 340 */ "literal ::= NK_FLOAT", - /* 341 */ "literal ::= NK_STRING", - /* 342 */ "literal ::= NK_BOOL", - /* 343 */ "literal ::= TIMESTAMP NK_STRING", - /* 344 */ "literal ::= duration_literal", - /* 345 */ "literal ::= NULL", - /* 346 */ "literal ::= NK_QUESTION", - /* 347 */ "duration_literal ::= NK_VARIABLE", - /* 348 */ "signed ::= NK_INTEGER", - /* 349 */ "signed ::= NK_PLUS NK_INTEGER", - /* 350 */ "signed ::= NK_MINUS NK_INTEGER", - /* 351 */ "signed ::= NK_FLOAT", - /* 352 */ "signed ::= NK_PLUS NK_FLOAT", - /* 353 */ "signed ::= NK_MINUS NK_FLOAT", - /* 354 */ "signed_literal ::= signed", - /* 355 */ "signed_literal ::= NK_STRING", - /* 356 */ "signed_literal ::= NK_BOOL", - /* 357 */ "signed_literal ::= TIMESTAMP NK_STRING", - /* 358 */ "signed_literal ::= duration_literal", - /* 359 */ "signed_literal ::= NULL", - /* 360 */ "signed_literal ::= literal_func", - /* 361 */ "signed_literal ::= NK_QUESTION", - /* 362 */ "literal_list ::= signed_literal", - /* 363 */ "literal_list ::= literal_list NK_COMMA signed_literal", - /* 364 */ "db_name ::= NK_ID", - /* 365 */ "table_name ::= NK_ID", - /* 366 */ "column_name ::= NK_ID", - /* 367 */ "function_name ::= NK_ID", - /* 368 */ "table_alias ::= NK_ID", - /* 369 */ "column_alias ::= NK_ID", - /* 370 */ "user_name ::= NK_ID", - /* 371 */ "topic_name ::= NK_ID", - /* 372 */ "stream_name ::= NK_ID", - /* 373 */ "cgroup_name ::= NK_ID", - /* 374 */ "index_name ::= NK_ID", - /* 375 */ "expr_or_subquery ::= expression", - /* 376 */ "expression ::= literal", - /* 377 */ "expression ::= pseudo_column", - /* 378 */ "expression ::= column_reference", - /* 379 */ "expression ::= function_expression", - /* 380 */ "expression ::= case_when_expression", - /* 381 */ "expression ::= NK_LP expression NK_RP", - /* 382 */ "expression ::= NK_PLUS expr_or_subquery", - /* 383 */ "expression ::= NK_MINUS expr_or_subquery", - /* 384 */ "expression ::= expr_or_subquery NK_PLUS expr_or_subquery", - /* 385 */ "expression ::= expr_or_subquery NK_MINUS expr_or_subquery", - /* 386 */ "expression ::= expr_or_subquery NK_STAR expr_or_subquery", - /* 387 */ "expression ::= expr_or_subquery NK_SLASH expr_or_subquery", - /* 388 */ "expression ::= expr_or_subquery NK_REM expr_or_subquery", - /* 389 */ "expression ::= column_reference NK_ARROW NK_STRING", - /* 390 */ "expression ::= expr_or_subquery NK_BITAND expr_or_subquery", - /* 391 */ "expression ::= expr_or_subquery NK_BITOR expr_or_subquery", - /* 392 */ "expression_list ::= expr_or_subquery", - /* 393 */ "expression_list ::= expression_list NK_COMMA expr_or_subquery", - /* 394 */ "column_reference ::= column_name", - /* 395 */ "column_reference ::= table_name NK_DOT column_name", - /* 396 */ "pseudo_column ::= ROWTS", - /* 397 */ "pseudo_column ::= TBNAME", - /* 398 */ "pseudo_column ::= table_name NK_DOT TBNAME", - /* 399 */ "pseudo_column ::= QSTART", - /* 400 */ "pseudo_column ::= QEND", - /* 401 */ "pseudo_column ::= QDURATION", - /* 402 */ "pseudo_column ::= WSTART", - /* 403 */ "pseudo_column ::= WEND", - /* 404 */ "pseudo_column ::= WDURATION", - /* 405 */ "pseudo_column ::= IROWTS", - /* 406 */ "pseudo_column ::= ISFILLED", - /* 407 */ "pseudo_column ::= QTAGS", - /* 408 */ "function_expression ::= function_name NK_LP expression_list NK_RP", - /* 409 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP", - /* 410 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP", - /* 411 */ "function_expression ::= literal_func", - /* 412 */ "literal_func ::= noarg_func NK_LP NK_RP", - /* 413 */ "literal_func ::= NOW", - /* 414 */ "noarg_func ::= NOW", - /* 415 */ "noarg_func ::= TODAY", - /* 416 */ "noarg_func ::= TIMEZONE", - /* 417 */ "noarg_func ::= DATABASE", - /* 418 */ "noarg_func ::= CLIENT_VERSION", - /* 419 */ "noarg_func ::= SERVER_VERSION", - /* 420 */ "noarg_func ::= SERVER_STATUS", - /* 421 */ "noarg_func ::= CURRENT_USER", - /* 422 */ "noarg_func ::= USER", - /* 423 */ "star_func ::= COUNT", - /* 424 */ "star_func ::= FIRST", - /* 425 */ "star_func ::= LAST", - /* 426 */ "star_func ::= LAST_ROW", - /* 427 */ "star_func_para_list ::= NK_STAR", - /* 428 */ "star_func_para_list ::= other_para_list", - /* 429 */ "other_para_list ::= star_func_para", - /* 430 */ "other_para_list ::= other_para_list NK_COMMA star_func_para", - /* 431 */ "star_func_para ::= expr_or_subquery", - /* 432 */ "star_func_para ::= table_name NK_DOT NK_STAR", - /* 433 */ "case_when_expression ::= CASE when_then_list case_when_else_opt END", - /* 434 */ "case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END", - /* 435 */ "when_then_list ::= when_then_expr", - /* 436 */ "when_then_list ::= when_then_list when_then_expr", - /* 437 */ "when_then_expr ::= WHEN common_expression THEN common_expression", - /* 438 */ "case_when_else_opt ::=", - /* 439 */ "case_when_else_opt ::= ELSE common_expression", - /* 440 */ "predicate ::= expr_or_subquery compare_op expr_or_subquery", - /* 441 */ "predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery", - /* 442 */ "predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery", - /* 443 */ "predicate ::= expr_or_subquery IS NULL", - /* 444 */ "predicate ::= expr_or_subquery IS NOT NULL", - /* 445 */ "predicate ::= expr_or_subquery in_op in_predicate_value", - /* 446 */ "compare_op ::= NK_LT", - /* 447 */ "compare_op ::= NK_GT", - /* 448 */ "compare_op ::= NK_LE", - /* 449 */ "compare_op ::= NK_GE", - /* 450 */ "compare_op ::= NK_NE", - /* 451 */ "compare_op ::= NK_EQ", - /* 452 */ "compare_op ::= LIKE", - /* 453 */ "compare_op ::= NOT LIKE", - /* 454 */ "compare_op ::= MATCH", - /* 455 */ "compare_op ::= NMATCH", - /* 456 */ "compare_op ::= CONTAINS", - /* 457 */ "in_op ::= IN", - /* 458 */ "in_op ::= NOT IN", - /* 459 */ "in_predicate_value ::= NK_LP literal_list NK_RP", - /* 460 */ "boolean_value_expression ::= boolean_primary", - /* 461 */ "boolean_value_expression ::= NOT boolean_primary", - /* 462 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", - /* 463 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", - /* 464 */ "boolean_primary ::= predicate", - /* 465 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", - /* 466 */ "common_expression ::= expr_or_subquery", - /* 467 */ "common_expression ::= boolean_value_expression", - /* 468 */ "from_clause_opt ::=", - /* 469 */ "from_clause_opt ::= FROM table_reference_list", - /* 470 */ "table_reference_list ::= table_reference", - /* 471 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", - /* 472 */ "table_reference ::= table_primary", - /* 473 */ "table_reference ::= joined_table", - /* 474 */ "table_primary ::= table_name alias_opt", - /* 475 */ "table_primary ::= db_name NK_DOT table_name alias_opt", - /* 476 */ "table_primary ::= subquery alias_opt", - /* 477 */ "table_primary ::= parenthesized_joined_table", - /* 478 */ "alias_opt ::=", - /* 479 */ "alias_opt ::= table_alias", - /* 480 */ "alias_opt ::= AS table_alias", - /* 481 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", - /* 482 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", - /* 483 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", - /* 484 */ "join_type ::=", - /* 485 */ "join_type ::= INNER", - /* 486 */ "query_specification ::= SELECT set_quantifier_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", - /* 487 */ "set_quantifier_opt ::=", - /* 488 */ "set_quantifier_opt ::= DISTINCT", - /* 489 */ "set_quantifier_opt ::= ALL", - /* 490 */ "select_list ::= select_item", - /* 491 */ "select_list ::= select_list NK_COMMA select_item", - /* 492 */ "select_item ::= NK_STAR", - /* 493 */ "select_item ::= common_expression", - /* 494 */ "select_item ::= common_expression column_alias", - /* 495 */ "select_item ::= common_expression AS column_alias", - /* 496 */ "select_item ::= table_name NK_DOT NK_STAR", - /* 497 */ "where_clause_opt ::=", - /* 498 */ "where_clause_opt ::= WHERE search_condition", - /* 499 */ "partition_by_clause_opt ::=", - /* 500 */ "partition_by_clause_opt ::= PARTITION BY partition_list", - /* 501 */ "partition_list ::= partition_item", - /* 502 */ "partition_list ::= partition_list NK_COMMA partition_item", - /* 503 */ "partition_item ::= expr_or_subquery", - /* 504 */ "partition_item ::= expr_or_subquery column_alias", - /* 505 */ "partition_item ::= expr_or_subquery AS column_alias", - /* 506 */ "twindow_clause_opt ::=", - /* 507 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP", - /* 508 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP", - /* 509 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt", - /* 510 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt", - /* 511 */ "twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition", - /* 512 */ "sliding_opt ::=", - /* 513 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP", - /* 514 */ "fill_opt ::=", - /* 515 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", - /* 516 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP", - /* 517 */ "fill_opt ::= FILL NK_LP VALUE_F NK_COMMA literal_list NK_RP", - /* 518 */ "fill_mode ::= NONE", - /* 519 */ "fill_mode ::= PREV", - /* 520 */ "fill_mode ::= NULL", - /* 521 */ "fill_mode ::= NULL_F", - /* 522 */ "fill_mode ::= LINEAR", - /* 523 */ "fill_mode ::= NEXT", - /* 524 */ "group_by_clause_opt ::=", - /* 525 */ "group_by_clause_opt ::= GROUP BY group_by_list", - /* 526 */ "group_by_list ::= expr_or_subquery", - /* 527 */ "group_by_list ::= group_by_list NK_COMMA expr_or_subquery", - /* 528 */ "having_clause_opt ::=", - /* 529 */ "having_clause_opt ::= HAVING search_condition", - /* 530 */ "range_opt ::=", - /* 531 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP", - /* 532 */ "every_opt ::=", - /* 533 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP", - /* 534 */ "query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt", - /* 535 */ "query_simple ::= query_specification", - /* 536 */ "query_simple ::= union_query_expression", - /* 537 */ "union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery", - /* 538 */ "union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery", - /* 539 */ "query_simple_or_subquery ::= query_simple", - /* 540 */ "query_simple_or_subquery ::= subquery", - /* 541 */ "query_or_subquery ::= query_expression", - /* 542 */ "query_or_subquery ::= subquery", - /* 543 */ "order_by_clause_opt ::=", - /* 544 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", - /* 545 */ "slimit_clause_opt ::=", - /* 546 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", - /* 547 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", - /* 548 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 549 */ "limit_clause_opt ::=", - /* 550 */ "limit_clause_opt ::= LIMIT NK_INTEGER", - /* 551 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", - /* 552 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 553 */ "subquery ::= NK_LP query_expression NK_RP", - /* 554 */ "subquery ::= NK_LP subquery NK_RP", - /* 555 */ "search_condition ::= common_expression", - /* 556 */ "sort_specification_list ::= sort_specification", - /* 557 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", - /* 558 */ "sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt", - /* 559 */ "ordering_specification_opt ::=", - /* 560 */ "ordering_specification_opt ::= ASC", - /* 561 */ "ordering_specification_opt ::= DESC", - /* 562 */ "null_ordering_opt ::=", - /* 563 */ "null_ordering_opt ::= NULLS FIRST", - /* 564 */ "null_ordering_opt ::= NULLS LAST", + /* 120 */ "alter_db_option ::= MINROWS NK_INTEGER", + /* 121 */ "integer_list ::= NK_INTEGER", + /* 122 */ "integer_list ::= integer_list NK_COMMA NK_INTEGER", + /* 123 */ "variable_list ::= NK_VARIABLE", + /* 124 */ "variable_list ::= variable_list NK_COMMA NK_VARIABLE", + /* 125 */ "retention_list ::= retention", + /* 126 */ "retention_list ::= retention_list NK_COMMA retention", + /* 127 */ "retention ::= NK_VARIABLE NK_COLON NK_VARIABLE", + /* 128 */ "speed_opt ::=", + /* 129 */ "speed_opt ::= MAX_SPEED NK_INTEGER", + /* 130 */ "start_opt ::=", + /* 131 */ "start_opt ::= START WITH NK_INTEGER", + /* 132 */ "start_opt ::= START WITH NK_STRING", + /* 133 */ "start_opt ::= START WITH TIMESTAMP NK_STRING", + /* 134 */ "end_opt ::=", + /* 135 */ "end_opt ::= END WITH NK_INTEGER", + /* 136 */ "end_opt ::= END WITH NK_STRING", + /* 137 */ "end_opt ::= END WITH TIMESTAMP NK_STRING", + /* 138 */ "cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options", + /* 139 */ "cmd ::= CREATE TABLE multi_create_clause", + /* 140 */ "cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options", + /* 141 */ "cmd ::= DROP TABLE multi_drop_clause", + /* 142 */ "cmd ::= DROP STABLE exists_opt full_table_name", + /* 143 */ "cmd ::= ALTER TABLE alter_table_clause", + /* 144 */ "cmd ::= ALTER STABLE alter_table_clause", + /* 145 */ "alter_table_clause ::= full_table_name alter_table_options", + /* 146 */ "alter_table_clause ::= full_table_name ADD COLUMN column_name type_name", + /* 147 */ "alter_table_clause ::= full_table_name DROP COLUMN column_name", + /* 148 */ "alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name", + /* 149 */ "alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name", + /* 150 */ "alter_table_clause ::= full_table_name ADD TAG column_name type_name", + /* 151 */ "alter_table_clause ::= full_table_name DROP TAG column_name", + /* 152 */ "alter_table_clause ::= full_table_name MODIFY TAG column_name type_name", + /* 153 */ "alter_table_clause ::= full_table_name RENAME TAG column_name column_name", + /* 154 */ "alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal", + /* 155 */ "multi_create_clause ::= create_subtable_clause", + /* 156 */ "multi_create_clause ::= multi_create_clause create_subtable_clause", + /* 157 */ "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", + /* 158 */ "multi_drop_clause ::= drop_table_clause", + /* 159 */ "multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause", + /* 160 */ "drop_table_clause ::= exists_opt full_table_name", + /* 161 */ "specific_cols_opt ::=", + /* 162 */ "specific_cols_opt ::= NK_LP col_name_list NK_RP", + /* 163 */ "full_table_name ::= table_name", + /* 164 */ "full_table_name ::= db_name NK_DOT table_name", + /* 165 */ "column_def_list ::= column_def", + /* 166 */ "column_def_list ::= column_def_list NK_COMMA column_def", + /* 167 */ "column_def ::= column_name type_name", + /* 168 */ "column_def ::= column_name type_name COMMENT NK_STRING", + /* 169 */ "type_name ::= BOOL", + /* 170 */ "type_name ::= TINYINT", + /* 171 */ "type_name ::= SMALLINT", + /* 172 */ "type_name ::= INT", + /* 173 */ "type_name ::= INTEGER", + /* 174 */ "type_name ::= BIGINT", + /* 175 */ "type_name ::= FLOAT", + /* 176 */ "type_name ::= DOUBLE", + /* 177 */ "type_name ::= BINARY NK_LP NK_INTEGER NK_RP", + /* 178 */ "type_name ::= TIMESTAMP", + /* 179 */ "type_name ::= NCHAR NK_LP NK_INTEGER NK_RP", + /* 180 */ "type_name ::= TINYINT UNSIGNED", + /* 181 */ "type_name ::= SMALLINT UNSIGNED", + /* 182 */ "type_name ::= INT UNSIGNED", + /* 183 */ "type_name ::= BIGINT UNSIGNED", + /* 184 */ "type_name ::= JSON", + /* 185 */ "type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP", + /* 186 */ "type_name ::= MEDIUMBLOB", + /* 187 */ "type_name ::= BLOB", + /* 188 */ "type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP", + /* 189 */ "type_name ::= DECIMAL", + /* 190 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP", + /* 191 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP", + /* 192 */ "tags_def_opt ::=", + /* 193 */ "tags_def_opt ::= tags_def", + /* 194 */ "tags_def ::= TAGS NK_LP column_def_list NK_RP", + /* 195 */ "table_options ::=", + /* 196 */ "table_options ::= table_options COMMENT NK_STRING", + /* 197 */ "table_options ::= table_options MAX_DELAY duration_list", + /* 198 */ "table_options ::= table_options WATERMARK duration_list", + /* 199 */ "table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP", + /* 200 */ "table_options ::= table_options TTL NK_INTEGER", + /* 201 */ "table_options ::= table_options SMA NK_LP col_name_list NK_RP", + /* 202 */ "table_options ::= table_options DELETE_MARK duration_list", + /* 203 */ "alter_table_options ::= alter_table_option", + /* 204 */ "alter_table_options ::= alter_table_options alter_table_option", + /* 205 */ "alter_table_option ::= COMMENT NK_STRING", + /* 206 */ "alter_table_option ::= TTL NK_INTEGER", + /* 207 */ "duration_list ::= duration_literal", + /* 208 */ "duration_list ::= duration_list NK_COMMA duration_literal", + /* 209 */ "rollup_func_list ::= rollup_func_name", + /* 210 */ "rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name", + /* 211 */ "rollup_func_name ::= function_name", + /* 212 */ "rollup_func_name ::= FIRST", + /* 213 */ "rollup_func_name ::= LAST", + /* 214 */ "col_name_list ::= col_name", + /* 215 */ "col_name_list ::= col_name_list NK_COMMA col_name", + /* 216 */ "col_name ::= column_name", + /* 217 */ "cmd ::= SHOW DNODES", + /* 218 */ "cmd ::= SHOW USERS", + /* 219 */ "cmd ::= SHOW USER PRIVILEGES", + /* 220 */ "cmd ::= SHOW DATABASES", + /* 221 */ "cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt", + /* 222 */ "cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt", + /* 223 */ "cmd ::= SHOW db_name_cond_opt VGROUPS", + /* 224 */ "cmd ::= SHOW MNODES", + /* 225 */ "cmd ::= SHOW QNODES", + /* 226 */ "cmd ::= SHOW FUNCTIONS", + /* 227 */ "cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt", + /* 228 */ "cmd ::= SHOW STREAMS", + /* 229 */ "cmd ::= SHOW ACCOUNTS", + /* 230 */ "cmd ::= SHOW APPS", + /* 231 */ "cmd ::= SHOW CONNECTIONS", + /* 232 */ "cmd ::= SHOW LICENCES", + /* 233 */ "cmd ::= SHOW GRANTS", + /* 234 */ "cmd ::= SHOW CREATE DATABASE db_name", + /* 235 */ "cmd ::= SHOW CREATE TABLE full_table_name", + /* 236 */ "cmd ::= SHOW CREATE STABLE full_table_name", + /* 237 */ "cmd ::= SHOW QUERIES", + /* 238 */ "cmd ::= SHOW SCORES", + /* 239 */ "cmd ::= SHOW TOPICS", + /* 240 */ "cmd ::= SHOW VARIABLES", + /* 241 */ "cmd ::= SHOW CLUSTER VARIABLES", + /* 242 */ "cmd ::= SHOW LOCAL VARIABLES", + /* 243 */ "cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt", + /* 244 */ "cmd ::= SHOW BNODES", + /* 245 */ "cmd ::= SHOW SNODES", + /* 246 */ "cmd ::= SHOW CLUSTER", + /* 247 */ "cmd ::= SHOW TRANSACTIONS", + /* 248 */ "cmd ::= SHOW TABLE DISTRIBUTED full_table_name", + /* 249 */ "cmd ::= SHOW CONSUMERS", + /* 250 */ "cmd ::= SHOW SUBSCRIPTIONS", + /* 251 */ "cmd ::= SHOW TAGS FROM table_name_cond from_db_opt", + /* 252 */ "cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt", + /* 253 */ "cmd ::= SHOW VNODES NK_INTEGER", + /* 254 */ "cmd ::= SHOW VNODES NK_STRING", + /* 255 */ "cmd ::= SHOW db_name_cond_opt ALIVE", + /* 256 */ "cmd ::= SHOW CLUSTER ALIVE", + /* 257 */ "db_name_cond_opt ::=", + /* 258 */ "db_name_cond_opt ::= db_name NK_DOT", + /* 259 */ "like_pattern_opt ::=", + /* 260 */ "like_pattern_opt ::= LIKE NK_STRING", + /* 261 */ "table_name_cond ::= table_name", + /* 262 */ "from_db_opt ::=", + /* 263 */ "from_db_opt ::= FROM db_name", + /* 264 */ "tag_list_opt ::=", + /* 265 */ "tag_list_opt ::= tag_item", + /* 266 */ "tag_list_opt ::= tag_list_opt NK_COMMA tag_item", + /* 267 */ "tag_item ::= TBNAME", + /* 268 */ "tag_item ::= QTAGS", + /* 269 */ "tag_item ::= column_name", + /* 270 */ "tag_item ::= column_name column_alias", + /* 271 */ "tag_item ::= column_name AS column_alias", + /* 272 */ "cmd ::= CREATE SMA INDEX not_exists_opt full_index_name ON full_table_name index_options", + /* 273 */ "cmd ::= CREATE INDEX not_exists_opt full_index_name ON full_table_name NK_LP col_name_list NK_RP", + /* 274 */ "cmd ::= DROP INDEX exists_opt full_index_name", + /* 275 */ "full_index_name ::= index_name", + /* 276 */ "full_index_name ::= db_name NK_DOT index_name", + /* 277 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt", + /* 278 */ "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", + /* 279 */ "func_list ::= func", + /* 280 */ "func_list ::= func_list NK_COMMA func", + /* 281 */ "func ::= sma_func_name NK_LP expression_list NK_RP", + /* 282 */ "sma_func_name ::= function_name", + /* 283 */ "sma_func_name ::= COUNT", + /* 284 */ "sma_func_name ::= FIRST", + /* 285 */ "sma_func_name ::= LAST", + /* 286 */ "sma_func_name ::= LAST_ROW", + /* 287 */ "sma_stream_opt ::=", + /* 288 */ "sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal", + /* 289 */ "sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal", + /* 290 */ "sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal", + /* 291 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery", + /* 292 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name", + /* 293 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name", + /* 294 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name", + /* 295 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name", + /* 296 */ "cmd ::= DROP TOPIC exists_opt topic_name", + /* 297 */ "cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name", + /* 298 */ "cmd ::= DESC full_table_name", + /* 299 */ "cmd ::= DESCRIBE full_table_name", + /* 300 */ "cmd ::= RESET QUERY CACHE", + /* 301 */ "cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery", + /* 302 */ "cmd ::= EXPLAIN analyze_opt explain_options insert_query", + /* 303 */ "analyze_opt ::=", + /* 304 */ "analyze_opt ::= ANALYZE", + /* 305 */ "explain_options ::=", + /* 306 */ "explain_options ::= explain_options VERBOSE NK_BOOL", + /* 307 */ "explain_options ::= explain_options RATIO NK_FLOAT", + /* 308 */ "cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt", + /* 309 */ "cmd ::= DROP FUNCTION exists_opt function_name", + /* 310 */ "agg_func_opt ::=", + /* 311 */ "agg_func_opt ::= AGGREGATE", + /* 312 */ "bufsize_opt ::=", + /* 313 */ "bufsize_opt ::= BUFSIZE NK_INTEGER", + /* 314 */ "language_opt ::=", + /* 315 */ "language_opt ::= LANGUAGE NK_STRING", + /* 316 */ "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", + /* 317 */ "cmd ::= DROP STREAM exists_opt stream_name", + /* 318 */ "col_list_opt ::=", + /* 319 */ "col_list_opt ::= NK_LP col_name_list NK_RP", + /* 320 */ "tag_def_or_ref_opt ::=", + /* 321 */ "tag_def_or_ref_opt ::= tags_def", + /* 322 */ "tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP", + /* 323 */ "stream_options ::=", + /* 324 */ "stream_options ::= stream_options TRIGGER AT_ONCE", + /* 325 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE", + /* 326 */ "stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal", + /* 327 */ "stream_options ::= stream_options WATERMARK duration_literal", + /* 328 */ "stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER", + /* 329 */ "stream_options ::= stream_options FILL_HISTORY NK_INTEGER", + /* 330 */ "stream_options ::= stream_options DELETE_MARK duration_literal", + /* 331 */ "stream_options ::= stream_options IGNORE UPDATE NK_INTEGER", + /* 332 */ "subtable_opt ::=", + /* 333 */ "subtable_opt ::= SUBTABLE NK_LP expression NK_RP", + /* 334 */ "cmd ::= KILL CONNECTION NK_INTEGER", + /* 335 */ "cmd ::= KILL QUERY NK_STRING", + /* 336 */ "cmd ::= KILL TRANSACTION NK_INTEGER", + /* 337 */ "cmd ::= BALANCE VGROUP", + /* 338 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER", + /* 339 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list", + /* 340 */ "cmd ::= SPLIT VGROUP NK_INTEGER", + /* 341 */ "dnode_list ::= DNODE NK_INTEGER", + /* 342 */ "dnode_list ::= dnode_list DNODE NK_INTEGER", + /* 343 */ "cmd ::= DELETE FROM full_table_name where_clause_opt", + /* 344 */ "cmd ::= query_or_subquery", + /* 345 */ "cmd ::= insert_query", + /* 346 */ "insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery", + /* 347 */ "insert_query ::= INSERT INTO full_table_name query_or_subquery", + /* 348 */ "literal ::= NK_INTEGER", + /* 349 */ "literal ::= NK_FLOAT", + /* 350 */ "literal ::= NK_STRING", + /* 351 */ "literal ::= NK_BOOL", + /* 352 */ "literal ::= TIMESTAMP NK_STRING", + /* 353 */ "literal ::= duration_literal", + /* 354 */ "literal ::= NULL", + /* 355 */ "literal ::= NK_QUESTION", + /* 356 */ "duration_literal ::= NK_VARIABLE", + /* 357 */ "signed ::= NK_INTEGER", + /* 358 */ "signed ::= NK_PLUS NK_INTEGER", + /* 359 */ "signed ::= NK_MINUS NK_INTEGER", + /* 360 */ "signed ::= NK_FLOAT", + /* 361 */ "signed ::= NK_PLUS NK_FLOAT", + /* 362 */ "signed ::= NK_MINUS NK_FLOAT", + /* 363 */ "signed_literal ::= signed", + /* 364 */ "signed_literal ::= NK_STRING", + /* 365 */ "signed_literal ::= NK_BOOL", + /* 366 */ "signed_literal ::= TIMESTAMP NK_STRING", + /* 367 */ "signed_literal ::= duration_literal", + /* 368 */ "signed_literal ::= NULL", + /* 369 */ "signed_literal ::= literal_func", + /* 370 */ "signed_literal ::= NK_QUESTION", + /* 371 */ "literal_list ::= signed_literal", + /* 372 */ "literal_list ::= literal_list NK_COMMA signed_literal", + /* 373 */ "db_name ::= NK_ID", + /* 374 */ "table_name ::= NK_ID", + /* 375 */ "column_name ::= NK_ID", + /* 376 */ "function_name ::= NK_ID", + /* 377 */ "table_alias ::= NK_ID", + /* 378 */ "column_alias ::= NK_ID", + /* 379 */ "user_name ::= NK_ID", + /* 380 */ "topic_name ::= NK_ID", + /* 381 */ "stream_name ::= NK_ID", + /* 382 */ "cgroup_name ::= NK_ID", + /* 383 */ "index_name ::= NK_ID", + /* 384 */ "expr_or_subquery ::= expression", + /* 385 */ "expression ::= literal", + /* 386 */ "expression ::= pseudo_column", + /* 387 */ "expression ::= column_reference", + /* 388 */ "expression ::= function_expression", + /* 389 */ "expression ::= case_when_expression", + /* 390 */ "expression ::= NK_LP expression NK_RP", + /* 391 */ "expression ::= NK_PLUS expr_or_subquery", + /* 392 */ "expression ::= NK_MINUS expr_or_subquery", + /* 393 */ "expression ::= expr_or_subquery NK_PLUS expr_or_subquery", + /* 394 */ "expression ::= expr_or_subquery NK_MINUS expr_or_subquery", + /* 395 */ "expression ::= expr_or_subquery NK_STAR expr_or_subquery", + /* 396 */ "expression ::= expr_or_subquery NK_SLASH expr_or_subquery", + /* 397 */ "expression ::= expr_or_subquery NK_REM expr_or_subquery", + /* 398 */ "expression ::= column_reference NK_ARROW NK_STRING", + /* 399 */ "expression ::= expr_or_subquery NK_BITAND expr_or_subquery", + /* 400 */ "expression ::= expr_or_subquery NK_BITOR expr_or_subquery", + /* 401 */ "expression_list ::= expr_or_subquery", + /* 402 */ "expression_list ::= expression_list NK_COMMA expr_or_subquery", + /* 403 */ "column_reference ::= column_name", + /* 404 */ "column_reference ::= table_name NK_DOT column_name", + /* 405 */ "pseudo_column ::= ROWTS", + /* 406 */ "pseudo_column ::= TBNAME", + /* 407 */ "pseudo_column ::= table_name NK_DOT TBNAME", + /* 408 */ "pseudo_column ::= QSTART", + /* 409 */ "pseudo_column ::= QEND", + /* 410 */ "pseudo_column ::= QDURATION", + /* 411 */ "pseudo_column ::= WSTART", + /* 412 */ "pseudo_column ::= WEND", + /* 413 */ "pseudo_column ::= WDURATION", + /* 414 */ "pseudo_column ::= IROWTS", + /* 415 */ "pseudo_column ::= ISFILLED", + /* 416 */ "pseudo_column ::= QTAGS", + /* 417 */ "function_expression ::= function_name NK_LP expression_list NK_RP", + /* 418 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP", + /* 419 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP", + /* 420 */ "function_expression ::= literal_func", + /* 421 */ "literal_func ::= noarg_func NK_LP NK_RP", + /* 422 */ "literal_func ::= NOW", + /* 423 */ "noarg_func ::= NOW", + /* 424 */ "noarg_func ::= TODAY", + /* 425 */ "noarg_func ::= TIMEZONE", + /* 426 */ "noarg_func ::= DATABASE", + /* 427 */ "noarg_func ::= CLIENT_VERSION", + /* 428 */ "noarg_func ::= SERVER_VERSION", + /* 429 */ "noarg_func ::= SERVER_STATUS", + /* 430 */ "noarg_func ::= CURRENT_USER", + /* 431 */ "noarg_func ::= USER", + /* 432 */ "star_func ::= COUNT", + /* 433 */ "star_func ::= FIRST", + /* 434 */ "star_func ::= LAST", + /* 435 */ "star_func ::= LAST_ROW", + /* 436 */ "star_func_para_list ::= NK_STAR", + /* 437 */ "star_func_para_list ::= other_para_list", + /* 438 */ "other_para_list ::= star_func_para", + /* 439 */ "other_para_list ::= other_para_list NK_COMMA star_func_para", + /* 440 */ "star_func_para ::= expr_or_subquery", + /* 441 */ "star_func_para ::= table_name NK_DOT NK_STAR", + /* 442 */ "case_when_expression ::= CASE when_then_list case_when_else_opt END", + /* 443 */ "case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END", + /* 444 */ "when_then_list ::= when_then_expr", + /* 445 */ "when_then_list ::= when_then_list when_then_expr", + /* 446 */ "when_then_expr ::= WHEN common_expression THEN common_expression", + /* 447 */ "case_when_else_opt ::=", + /* 448 */ "case_when_else_opt ::= ELSE common_expression", + /* 449 */ "predicate ::= expr_or_subquery compare_op expr_or_subquery", + /* 450 */ "predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery", + /* 451 */ "predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery", + /* 452 */ "predicate ::= expr_or_subquery IS NULL", + /* 453 */ "predicate ::= expr_or_subquery IS NOT NULL", + /* 454 */ "predicate ::= expr_or_subquery in_op in_predicate_value", + /* 455 */ "compare_op ::= NK_LT", + /* 456 */ "compare_op ::= NK_GT", + /* 457 */ "compare_op ::= NK_LE", + /* 458 */ "compare_op ::= NK_GE", + /* 459 */ "compare_op ::= NK_NE", + /* 460 */ "compare_op ::= NK_EQ", + /* 461 */ "compare_op ::= LIKE", + /* 462 */ "compare_op ::= NOT LIKE", + /* 463 */ "compare_op ::= MATCH", + /* 464 */ "compare_op ::= NMATCH", + /* 465 */ "compare_op ::= CONTAINS", + /* 466 */ "in_op ::= IN", + /* 467 */ "in_op ::= NOT IN", + /* 468 */ "in_predicate_value ::= NK_LP literal_list NK_RP", + /* 469 */ "boolean_value_expression ::= boolean_primary", + /* 470 */ "boolean_value_expression ::= NOT boolean_primary", + /* 471 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", + /* 472 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", + /* 473 */ "boolean_primary ::= predicate", + /* 474 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", + /* 475 */ "common_expression ::= expr_or_subquery", + /* 476 */ "common_expression ::= boolean_value_expression", + /* 477 */ "from_clause_opt ::=", + /* 478 */ "from_clause_opt ::= FROM table_reference_list", + /* 479 */ "table_reference_list ::= table_reference", + /* 480 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", + /* 481 */ "table_reference ::= table_primary", + /* 482 */ "table_reference ::= joined_table", + /* 483 */ "table_primary ::= table_name alias_opt", + /* 484 */ "table_primary ::= db_name NK_DOT table_name alias_opt", + /* 485 */ "table_primary ::= subquery alias_opt", + /* 486 */ "table_primary ::= parenthesized_joined_table", + /* 487 */ "alias_opt ::=", + /* 488 */ "alias_opt ::= table_alias", + /* 489 */ "alias_opt ::= AS table_alias", + /* 490 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", + /* 491 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", + /* 492 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", + /* 493 */ "join_type ::=", + /* 494 */ "join_type ::= INNER", + /* 495 */ "query_specification ::= SELECT set_quantifier_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", + /* 496 */ "set_quantifier_opt ::=", + /* 497 */ "set_quantifier_opt ::= DISTINCT", + /* 498 */ "set_quantifier_opt ::= ALL", + /* 499 */ "select_list ::= select_item", + /* 500 */ "select_list ::= select_list NK_COMMA select_item", + /* 501 */ "select_item ::= NK_STAR", + /* 502 */ "select_item ::= common_expression", + /* 503 */ "select_item ::= common_expression column_alias", + /* 504 */ "select_item ::= common_expression AS column_alias", + /* 505 */ "select_item ::= table_name NK_DOT NK_STAR", + /* 506 */ "where_clause_opt ::=", + /* 507 */ "where_clause_opt ::= WHERE search_condition", + /* 508 */ "partition_by_clause_opt ::=", + /* 509 */ "partition_by_clause_opt ::= PARTITION BY partition_list", + /* 510 */ "partition_list ::= partition_item", + /* 511 */ "partition_list ::= partition_list NK_COMMA partition_item", + /* 512 */ "partition_item ::= expr_or_subquery", + /* 513 */ "partition_item ::= expr_or_subquery column_alias", + /* 514 */ "partition_item ::= expr_or_subquery AS column_alias", + /* 515 */ "twindow_clause_opt ::=", + /* 516 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP", + /* 517 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP", + /* 518 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt", + /* 519 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt", + /* 520 */ "twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition", + /* 521 */ "sliding_opt ::=", + /* 522 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP", + /* 523 */ "fill_opt ::=", + /* 524 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", + /* 525 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP", + /* 526 */ "fill_opt ::= FILL NK_LP VALUE_F NK_COMMA literal_list NK_RP", + /* 527 */ "fill_mode ::= NONE", + /* 528 */ "fill_mode ::= PREV", + /* 529 */ "fill_mode ::= NULL", + /* 530 */ "fill_mode ::= NULL_F", + /* 531 */ "fill_mode ::= LINEAR", + /* 532 */ "fill_mode ::= NEXT", + /* 533 */ "group_by_clause_opt ::=", + /* 534 */ "group_by_clause_opt ::= GROUP BY group_by_list", + /* 535 */ "group_by_list ::= expr_or_subquery", + /* 536 */ "group_by_list ::= group_by_list NK_COMMA expr_or_subquery", + /* 537 */ "having_clause_opt ::=", + /* 538 */ "having_clause_opt ::= HAVING search_condition", + /* 539 */ "range_opt ::=", + /* 540 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP", + /* 541 */ "every_opt ::=", + /* 542 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP", + /* 543 */ "query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt", + /* 544 */ "query_simple ::= query_specification", + /* 545 */ "query_simple ::= union_query_expression", + /* 546 */ "union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery", + /* 547 */ "union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery", + /* 548 */ "query_simple_or_subquery ::= query_simple", + /* 549 */ "query_simple_or_subquery ::= subquery", + /* 550 */ "query_or_subquery ::= query_expression", + /* 551 */ "query_or_subquery ::= subquery", + /* 552 */ "order_by_clause_opt ::=", + /* 553 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", + /* 554 */ "slimit_clause_opt ::=", + /* 555 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", + /* 556 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", + /* 557 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 558 */ "limit_clause_opt ::=", + /* 559 */ "limit_clause_opt ::= LIMIT NK_INTEGER", + /* 560 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", + /* 561 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 562 */ "subquery ::= NK_LP query_expression NK_RP", + /* 563 */ "subquery ::= NK_LP subquery NK_RP", + /* 564 */ "search_condition ::= common_expression", + /* 565 */ "sort_specification_list ::= sort_specification", + /* 566 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", + /* 567 */ "sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt", + /* 568 */ "ordering_specification_opt ::=", + /* 569 */ "ordering_specification_opt ::= ASC", + /* 570 */ "ordering_specification_opt ::= DESC", + /* 571 */ "null_ordering_opt ::=", + /* 572 */ "null_ordering_opt ::= NULLS FIRST", + /* 573 */ "null_ordering_opt ::= NULLS LAST", }; #endif /* NDEBUG */ @@ -2639,82 +2602,84 @@ static void yy_destructor( case 332: /* literal */ case 345: /* db_options */ case 347: /* alter_db_options */ - case 353: /* retention */ - case 354: /* full_table_name */ - case 357: /* table_options */ - case 361: /* alter_table_clause */ - case 362: /* alter_table_options */ - case 365: /* signed_literal */ - case 366: /* create_subtable_clause */ - case 369: /* drop_table_clause */ - case 372: /* column_def */ - case 376: /* duration_literal */ - case 377: /* rollup_func_name */ - case 379: /* col_name */ - case 380: /* db_name_cond_opt */ - case 381: /* like_pattern_opt */ - case 382: /* table_name_cond */ - case 383: /* from_db_opt */ - case 385: /* tag_item */ - case 387: /* full_index_name */ - case 388: /* index_options */ - case 391: /* sliding_opt */ - case 392: /* sma_stream_opt */ - case 393: /* func */ - case 395: /* query_or_subquery */ - case 398: /* explain_options */ - case 399: /* insert_query */ - case 404: /* stream_options */ - case 407: /* subtable_opt */ - case 408: /* expression */ - case 410: /* where_clause_opt */ - case 411: /* signed */ - case 412: /* literal_func */ - case 415: /* expr_or_subquery */ - case 416: /* pseudo_column */ - case 417: /* column_reference */ - case 418: /* function_expression */ - case 419: /* case_when_expression */ - case 424: /* star_func_para */ - case 426: /* case_when_else_opt */ - case 427: /* common_expression */ - case 428: /* when_then_expr */ - case 429: /* predicate */ - case 432: /* in_predicate_value */ - case 433: /* boolean_value_expression */ - case 434: /* boolean_primary */ - case 435: /* from_clause_opt */ - case 436: /* table_reference_list */ - case 437: /* table_reference */ - case 438: /* table_primary */ - case 439: /* joined_table */ - case 441: /* subquery */ - case 442: /* parenthesized_joined_table */ - case 444: /* search_condition */ - case 445: /* query_specification */ - case 449: /* range_opt */ - case 450: /* every_opt */ - case 451: /* fill_opt */ - case 452: /* twindow_clause_opt */ - case 454: /* having_clause_opt */ - case 455: /* select_item */ - case 457: /* partition_item */ - case 460: /* query_expression */ - case 461: /* query_simple */ - case 463: /* slimit_clause_opt */ - case 464: /* limit_clause_opt */ - case 465: /* union_query_expression */ - case 466: /* query_simple_or_subquery */ - case 468: /* sort_specification */ + case 349: /* start_opt */ + case 350: /* end_opt */ + case 355: /* retention */ + case 356: /* full_table_name */ + case 359: /* table_options */ + case 363: /* alter_table_clause */ + case 364: /* alter_table_options */ + case 367: /* signed_literal */ + case 368: /* create_subtable_clause */ + case 371: /* drop_table_clause */ + case 374: /* column_def */ + case 378: /* duration_literal */ + case 379: /* rollup_func_name */ + case 381: /* col_name */ + case 382: /* db_name_cond_opt */ + case 383: /* like_pattern_opt */ + case 384: /* table_name_cond */ + case 385: /* from_db_opt */ + case 387: /* tag_item */ + case 389: /* full_index_name */ + case 390: /* index_options */ + case 393: /* sliding_opt */ + case 394: /* sma_stream_opt */ + case 395: /* func */ + case 397: /* query_or_subquery */ + case 400: /* explain_options */ + case 401: /* insert_query */ + case 406: /* stream_options */ + case 409: /* subtable_opt */ + case 410: /* expression */ + case 412: /* where_clause_opt */ + case 413: /* signed */ + case 414: /* literal_func */ + case 417: /* expr_or_subquery */ + case 418: /* pseudo_column */ + case 419: /* column_reference */ + case 420: /* function_expression */ + case 421: /* case_when_expression */ + case 426: /* star_func_para */ + case 428: /* case_when_else_opt */ + case 429: /* common_expression */ + case 430: /* when_then_expr */ + case 431: /* predicate */ + case 434: /* in_predicate_value */ + case 435: /* boolean_value_expression */ + case 436: /* boolean_primary */ + case 437: /* from_clause_opt */ + case 438: /* table_reference_list */ + case 439: /* table_reference */ + case 440: /* table_primary */ + case 441: /* joined_table */ + case 443: /* subquery */ + case 444: /* parenthesized_joined_table */ + case 446: /* search_condition */ + case 447: /* query_specification */ + case 451: /* range_opt */ + case 452: /* every_opt */ + case 453: /* fill_opt */ + case 454: /* twindow_clause_opt */ + case 456: /* having_clause_opt */ + case 457: /* select_item */ + case 459: /* partition_item */ + case 462: /* query_expression */ + case 463: /* query_simple */ + case 465: /* slimit_clause_opt */ + case 466: /* limit_clause_opt */ + case 467: /* union_query_expression */ + case 468: /* query_simple_or_subquery */ + case 470: /* sort_specification */ { - nodesDestroyNode((yypminor->yy140)); + nodesDestroyNode((yypminor->yy828)); } break; case 330: /* account_options */ case 331: /* alter_account_options */ case 333: /* alter_account_option */ case 348: /* speed_opt */ - case 401: /* bufsize_opt */ + case 403: /* bufsize_opt */ { } @@ -2724,19 +2689,19 @@ static void yy_destructor( case 340: /* db_name */ case 341: /* topic_name */ case 342: /* dnode_endpoint */ - case 363: /* column_name */ - case 371: /* table_name */ - case 378: /* function_name */ - case 386: /* column_alias */ - case 389: /* index_name */ - case 394: /* sma_func_name */ - case 396: /* cgroup_name */ - case 402: /* language_opt */ - case 403: /* stream_name */ - case 414: /* table_alias */ - case 420: /* star_func */ - case 422: /* noarg_func */ - case 440: /* alias_opt */ + case 365: /* column_name */ + case 373: /* table_name */ + case 380: /* function_name */ + case 388: /* column_alias */ + case 391: /* index_name */ + case 396: /* sma_func_name */ + case 398: /* cgroup_name */ + case 404: /* language_opt */ + case 405: /* stream_name */ + case 416: /* table_alias */ + case 422: /* star_func */ + case 424: /* noarg_func */ + case 442: /* alias_opt */ { } @@ -2756,79 +2721,79 @@ static void yy_destructor( case 343: /* force_opt */ case 344: /* not_exists_opt */ case 346: /* exists_opt */ - case 397: /* analyze_opt */ - case 400: /* agg_func_opt */ - case 446: /* set_quantifier_opt */ + case 399: /* analyze_opt */ + case 402: /* agg_func_opt */ + case 448: /* set_quantifier_opt */ { } break; - case 349: /* integer_list */ - case 350: /* variable_list */ - case 351: /* retention_list */ - case 355: /* column_def_list */ - case 356: /* tags_def_opt */ - case 358: /* multi_create_clause */ - case 359: /* tags_def */ - case 360: /* multi_drop_clause */ - case 367: /* specific_cols_opt */ - case 368: /* expression_list */ - case 370: /* col_name_list */ - case 373: /* duration_list */ - case 374: /* rollup_func_list */ - case 384: /* tag_list_opt */ - case 390: /* func_list */ - case 405: /* col_list_opt */ - case 406: /* tag_def_or_ref_opt */ - case 409: /* dnode_list */ - case 413: /* literal_list */ - case 421: /* star_func_para_list */ - case 423: /* other_para_list */ - case 425: /* when_then_list */ - case 447: /* select_list */ - case 448: /* partition_by_clause_opt */ - case 453: /* group_by_clause_opt */ - case 456: /* partition_list */ - case 459: /* group_by_list */ - case 462: /* order_by_clause_opt */ - case 467: /* sort_specification_list */ + case 351: /* integer_list */ + case 352: /* variable_list */ + case 353: /* retention_list */ + case 357: /* column_def_list */ + case 358: /* tags_def_opt */ + case 360: /* multi_create_clause */ + case 361: /* tags_def */ + case 362: /* multi_drop_clause */ + case 369: /* specific_cols_opt */ + case 370: /* expression_list */ + case 372: /* col_name_list */ + case 375: /* duration_list */ + case 376: /* rollup_func_list */ + case 386: /* tag_list_opt */ + case 392: /* func_list */ + case 407: /* col_list_opt */ + case 408: /* tag_def_or_ref_opt */ + case 411: /* dnode_list */ + case 415: /* literal_list */ + case 423: /* star_func_para_list */ + case 425: /* other_para_list */ + case 427: /* when_then_list */ + case 449: /* select_list */ + case 450: /* partition_by_clause_opt */ + case 455: /* group_by_clause_opt */ + case 458: /* partition_list */ + case 461: /* group_by_list */ + case 464: /* order_by_clause_opt */ + case 469: /* sort_specification_list */ { - nodesDestroyList((yypminor->yy220)); + nodesDestroyList((yypminor->yy222)); } break; - case 352: /* alter_db_option */ - case 375: /* alter_table_option */ + case 354: /* alter_db_option */ + case 377: /* alter_table_option */ { } break; - case 364: /* type_name */ + case 366: /* type_name */ { } break; - case 430: /* compare_op */ - case 431: /* in_op */ + case 432: /* compare_op */ + case 433: /* in_op */ { } break; - case 443: /* join_type */ + case 445: /* join_type */ { } break; - case 458: /* fill_mode */ + case 460: /* fill_mode */ { } break; - case 469: /* ordering_specification_opt */ + case 471: /* ordering_specification_opt */ { } break; - case 470: /* null_ordering_opt */ + case 472: /* null_ordering_opt */ { } @@ -3199,7 +3164,7 @@ static const struct { { 329, -4 }, /* (69) cmd ::= ALTER DATABASE db_name alter_db_options */ { 329, -3 }, /* (70) cmd ::= FLUSH DATABASE db_name */ { 329, -4 }, /* (71) cmd ::= TRIM DATABASE db_name speed_opt */ - { 329, -3 }, /* (72) cmd ::= COMPACT DATABASE db_name */ + { 329, -5 }, /* (72) cmd ::= COMPACT DATABASE db_name start_opt end_opt */ { 344, -3 }, /* (73) not_exists_opt ::= IF NOT EXISTS */ { 344, 0 }, /* (74) not_exists_opt ::= */ { 346, -2 }, /* (75) exists_opt ::= IF EXISTS */ @@ -3237,461 +3202,470 @@ static const struct { { 345, -3 }, /* (107) db_options ::= db_options TABLE_SUFFIX NK_INTEGER */ { 347, -1 }, /* (108) alter_db_options ::= alter_db_option */ { 347, -2 }, /* (109) alter_db_options ::= alter_db_options alter_db_option */ - { 352, -2 }, /* (110) alter_db_option ::= BUFFER NK_INTEGER */ - { 352, -2 }, /* (111) alter_db_option ::= CACHEMODEL NK_STRING */ - { 352, -2 }, /* (112) alter_db_option ::= CACHESIZE NK_INTEGER */ - { 352, -2 }, /* (113) alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */ - { 352, -2 }, /* (114) alter_db_option ::= KEEP integer_list */ - { 352, -2 }, /* (115) alter_db_option ::= KEEP variable_list */ - { 352, -2 }, /* (116) alter_db_option ::= PAGES NK_INTEGER */ - { 352, -2 }, /* (117) alter_db_option ::= REPLICA NK_INTEGER */ - { 352, -2 }, /* (118) alter_db_option ::= WAL_LEVEL NK_INTEGER */ - { 352, -2 }, /* (119) alter_db_option ::= STT_TRIGGER NK_INTEGER */ - { 349, -1 }, /* (120) integer_list ::= NK_INTEGER */ - { 349, -3 }, /* (121) integer_list ::= integer_list NK_COMMA NK_INTEGER */ - { 350, -1 }, /* (122) variable_list ::= NK_VARIABLE */ - { 350, -3 }, /* (123) variable_list ::= variable_list NK_COMMA NK_VARIABLE */ - { 351, -1 }, /* (124) retention_list ::= retention */ - { 351, -3 }, /* (125) retention_list ::= retention_list NK_COMMA retention */ - { 353, -3 }, /* (126) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ - { 348, 0 }, /* (127) speed_opt ::= */ - { 348, -2 }, /* (128) speed_opt ::= MAX_SPEED NK_INTEGER */ - { 329, -9 }, /* (129) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ - { 329, -3 }, /* (130) cmd ::= CREATE TABLE multi_create_clause */ - { 329, -9 }, /* (131) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ - { 329, -3 }, /* (132) cmd ::= DROP TABLE multi_drop_clause */ - { 329, -4 }, /* (133) cmd ::= DROP STABLE exists_opt full_table_name */ - { 329, -3 }, /* (134) cmd ::= ALTER TABLE alter_table_clause */ - { 329, -3 }, /* (135) cmd ::= ALTER STABLE alter_table_clause */ - { 361, -2 }, /* (136) alter_table_clause ::= full_table_name alter_table_options */ - { 361, -5 }, /* (137) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ - { 361, -4 }, /* (138) alter_table_clause ::= full_table_name DROP COLUMN column_name */ - { 361, -5 }, /* (139) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ - { 361, -5 }, /* (140) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ - { 361, -5 }, /* (141) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ - { 361, -4 }, /* (142) alter_table_clause ::= full_table_name DROP TAG column_name */ - { 361, -5 }, /* (143) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ - { 361, -5 }, /* (144) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ - { 361, -6 }, /* (145) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ - { 358, -1 }, /* (146) multi_create_clause ::= create_subtable_clause */ - { 358, -2 }, /* (147) multi_create_clause ::= multi_create_clause create_subtable_clause */ - { 366, -10 }, /* (148) 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 */ - { 360, -1 }, /* (149) multi_drop_clause ::= drop_table_clause */ - { 360, -3 }, /* (150) multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ - { 369, -2 }, /* (151) drop_table_clause ::= exists_opt full_table_name */ - { 367, 0 }, /* (152) specific_cols_opt ::= */ - { 367, -3 }, /* (153) specific_cols_opt ::= NK_LP col_name_list NK_RP */ - { 354, -1 }, /* (154) full_table_name ::= table_name */ - { 354, -3 }, /* (155) full_table_name ::= db_name NK_DOT table_name */ - { 355, -1 }, /* (156) column_def_list ::= column_def */ - { 355, -3 }, /* (157) column_def_list ::= column_def_list NK_COMMA column_def */ - { 372, -2 }, /* (158) column_def ::= column_name type_name */ - { 372, -4 }, /* (159) column_def ::= column_name type_name COMMENT NK_STRING */ - { 364, -1 }, /* (160) type_name ::= BOOL */ - { 364, -1 }, /* (161) type_name ::= TINYINT */ - { 364, -1 }, /* (162) type_name ::= SMALLINT */ - { 364, -1 }, /* (163) type_name ::= INT */ - { 364, -1 }, /* (164) type_name ::= INTEGER */ - { 364, -1 }, /* (165) type_name ::= BIGINT */ - { 364, -1 }, /* (166) type_name ::= FLOAT */ - { 364, -1 }, /* (167) type_name ::= DOUBLE */ - { 364, -4 }, /* (168) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ - { 364, -1 }, /* (169) type_name ::= TIMESTAMP */ - { 364, -4 }, /* (170) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ - { 364, -2 }, /* (171) type_name ::= TINYINT UNSIGNED */ - { 364, -2 }, /* (172) type_name ::= SMALLINT UNSIGNED */ - { 364, -2 }, /* (173) type_name ::= INT UNSIGNED */ - { 364, -2 }, /* (174) type_name ::= BIGINT UNSIGNED */ - { 364, -1 }, /* (175) type_name ::= JSON */ - { 364, -4 }, /* (176) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ - { 364, -1 }, /* (177) type_name ::= MEDIUMBLOB */ - { 364, -1 }, /* (178) type_name ::= BLOB */ - { 364, -4 }, /* (179) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ - { 364, -1 }, /* (180) type_name ::= DECIMAL */ - { 364, -4 }, /* (181) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ - { 364, -6 }, /* (182) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ - { 356, 0 }, /* (183) tags_def_opt ::= */ - { 356, -1 }, /* (184) tags_def_opt ::= tags_def */ - { 359, -4 }, /* (185) tags_def ::= TAGS NK_LP column_def_list NK_RP */ - { 357, 0 }, /* (186) table_options ::= */ - { 357, -3 }, /* (187) table_options ::= table_options COMMENT NK_STRING */ - { 357, -3 }, /* (188) table_options ::= table_options MAX_DELAY duration_list */ - { 357, -3 }, /* (189) table_options ::= table_options WATERMARK duration_list */ - { 357, -5 }, /* (190) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ - { 357, -3 }, /* (191) table_options ::= table_options TTL NK_INTEGER */ - { 357, -5 }, /* (192) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ - { 357, -3 }, /* (193) table_options ::= table_options DELETE_MARK duration_list */ - { 362, -1 }, /* (194) alter_table_options ::= alter_table_option */ - { 362, -2 }, /* (195) alter_table_options ::= alter_table_options alter_table_option */ - { 375, -2 }, /* (196) alter_table_option ::= COMMENT NK_STRING */ - { 375, -2 }, /* (197) alter_table_option ::= TTL NK_INTEGER */ - { 373, -1 }, /* (198) duration_list ::= duration_literal */ - { 373, -3 }, /* (199) duration_list ::= duration_list NK_COMMA duration_literal */ - { 374, -1 }, /* (200) rollup_func_list ::= rollup_func_name */ - { 374, -3 }, /* (201) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ - { 377, -1 }, /* (202) rollup_func_name ::= function_name */ - { 377, -1 }, /* (203) rollup_func_name ::= FIRST */ - { 377, -1 }, /* (204) rollup_func_name ::= LAST */ - { 370, -1 }, /* (205) col_name_list ::= col_name */ - { 370, -3 }, /* (206) col_name_list ::= col_name_list NK_COMMA col_name */ - { 379, -1 }, /* (207) col_name ::= column_name */ - { 329, -2 }, /* (208) cmd ::= SHOW DNODES */ - { 329, -2 }, /* (209) cmd ::= SHOW USERS */ - { 329, -3 }, /* (210) cmd ::= SHOW USER PRIVILEGES */ - { 329, -2 }, /* (211) cmd ::= SHOW DATABASES */ - { 329, -4 }, /* (212) cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ - { 329, -4 }, /* (213) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ - { 329, -3 }, /* (214) cmd ::= SHOW db_name_cond_opt VGROUPS */ - { 329, -2 }, /* (215) cmd ::= SHOW MNODES */ - { 329, -2 }, /* (216) cmd ::= SHOW QNODES */ - { 329, -2 }, /* (217) cmd ::= SHOW FUNCTIONS */ - { 329, -5 }, /* (218) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ - { 329, -2 }, /* (219) cmd ::= SHOW STREAMS */ - { 329, -2 }, /* (220) cmd ::= SHOW ACCOUNTS */ - { 329, -2 }, /* (221) cmd ::= SHOW APPS */ - { 329, -2 }, /* (222) cmd ::= SHOW CONNECTIONS */ - { 329, -2 }, /* (223) cmd ::= SHOW LICENCES */ - { 329, -2 }, /* (224) cmd ::= SHOW GRANTS */ - { 329, -4 }, /* (225) cmd ::= SHOW CREATE DATABASE db_name */ - { 329, -4 }, /* (226) cmd ::= SHOW CREATE TABLE full_table_name */ - { 329, -4 }, /* (227) cmd ::= SHOW CREATE STABLE full_table_name */ - { 329, -2 }, /* (228) cmd ::= SHOW QUERIES */ - { 329, -2 }, /* (229) cmd ::= SHOW SCORES */ - { 329, -2 }, /* (230) cmd ::= SHOW TOPICS */ - { 329, -2 }, /* (231) cmd ::= SHOW VARIABLES */ - { 329, -3 }, /* (232) cmd ::= SHOW CLUSTER VARIABLES */ - { 329, -3 }, /* (233) cmd ::= SHOW LOCAL VARIABLES */ - { 329, -5 }, /* (234) cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ - { 329, -2 }, /* (235) cmd ::= SHOW BNODES */ - { 329, -2 }, /* (236) cmd ::= SHOW SNODES */ - { 329, -2 }, /* (237) cmd ::= SHOW CLUSTER */ - { 329, -2 }, /* (238) cmd ::= SHOW TRANSACTIONS */ - { 329, -4 }, /* (239) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ - { 329, -2 }, /* (240) cmd ::= SHOW CONSUMERS */ - { 329, -2 }, /* (241) cmd ::= SHOW SUBSCRIPTIONS */ - { 329, -5 }, /* (242) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ - { 329, -7 }, /* (243) cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ - { 329, -3 }, /* (244) cmd ::= SHOW VNODES NK_INTEGER */ - { 329, -3 }, /* (245) cmd ::= SHOW VNODES NK_STRING */ - { 329, -3 }, /* (246) cmd ::= SHOW db_name_cond_opt ALIVE */ - { 329, -3 }, /* (247) cmd ::= SHOW CLUSTER ALIVE */ - { 380, 0 }, /* (248) db_name_cond_opt ::= */ - { 380, -2 }, /* (249) db_name_cond_opt ::= db_name NK_DOT */ - { 381, 0 }, /* (250) like_pattern_opt ::= */ - { 381, -2 }, /* (251) like_pattern_opt ::= LIKE NK_STRING */ - { 382, -1 }, /* (252) table_name_cond ::= table_name */ - { 383, 0 }, /* (253) from_db_opt ::= */ - { 383, -2 }, /* (254) from_db_opt ::= FROM db_name */ - { 384, 0 }, /* (255) tag_list_opt ::= */ - { 384, -1 }, /* (256) tag_list_opt ::= tag_item */ - { 384, -3 }, /* (257) tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ - { 385, -1 }, /* (258) tag_item ::= TBNAME */ - { 385, -1 }, /* (259) tag_item ::= QTAGS */ - { 385, -1 }, /* (260) tag_item ::= column_name */ - { 385, -2 }, /* (261) tag_item ::= column_name column_alias */ - { 385, -3 }, /* (262) tag_item ::= column_name AS column_alias */ - { 329, -8 }, /* (263) cmd ::= CREATE SMA INDEX not_exists_opt full_index_name ON full_table_name index_options */ - { 329, -9 }, /* (264) cmd ::= CREATE INDEX not_exists_opt full_index_name ON full_table_name NK_LP col_name_list NK_RP */ - { 329, -4 }, /* (265) cmd ::= DROP INDEX exists_opt full_index_name */ - { 387, -1 }, /* (266) full_index_name ::= index_name */ - { 387, -3 }, /* (267) full_index_name ::= db_name NK_DOT index_name */ - { 388, -10 }, /* (268) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ - { 388, -12 }, /* (269) 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 */ - { 390, -1 }, /* (270) func_list ::= func */ - { 390, -3 }, /* (271) func_list ::= func_list NK_COMMA func */ - { 393, -4 }, /* (272) func ::= sma_func_name NK_LP expression_list NK_RP */ - { 394, -1 }, /* (273) sma_func_name ::= function_name */ - { 394, -1 }, /* (274) sma_func_name ::= COUNT */ - { 394, -1 }, /* (275) sma_func_name ::= FIRST */ - { 394, -1 }, /* (276) sma_func_name ::= LAST */ - { 394, -1 }, /* (277) sma_func_name ::= LAST_ROW */ - { 392, 0 }, /* (278) sma_stream_opt ::= */ - { 392, -3 }, /* (279) sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ - { 392, -3 }, /* (280) sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ - { 392, -3 }, /* (281) sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ - { 329, -6 }, /* (282) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ - { 329, -7 }, /* (283) cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ - { 329, -9 }, /* (284) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */ - { 329, -7 }, /* (285) cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ - { 329, -9 }, /* (286) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */ - { 329, -4 }, /* (287) cmd ::= DROP TOPIC exists_opt topic_name */ - { 329, -7 }, /* (288) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ - { 329, -2 }, /* (289) cmd ::= DESC full_table_name */ - { 329, -2 }, /* (290) cmd ::= DESCRIBE full_table_name */ - { 329, -3 }, /* (291) cmd ::= RESET QUERY CACHE */ - { 329, -4 }, /* (292) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ - { 329, -4 }, /* (293) cmd ::= EXPLAIN analyze_opt explain_options insert_query */ - { 397, 0 }, /* (294) analyze_opt ::= */ - { 397, -1 }, /* (295) analyze_opt ::= ANALYZE */ - { 398, 0 }, /* (296) explain_options ::= */ - { 398, -3 }, /* (297) explain_options ::= explain_options VERBOSE NK_BOOL */ - { 398, -3 }, /* (298) explain_options ::= explain_options RATIO NK_FLOAT */ - { 329, -11 }, /* (299) cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */ - { 329, -4 }, /* (300) cmd ::= DROP FUNCTION exists_opt function_name */ - { 400, 0 }, /* (301) agg_func_opt ::= */ - { 400, -1 }, /* (302) agg_func_opt ::= AGGREGATE */ - { 401, 0 }, /* (303) bufsize_opt ::= */ - { 401, -2 }, /* (304) bufsize_opt ::= BUFSIZE NK_INTEGER */ - { 402, 0 }, /* (305) language_opt ::= */ - { 402, -2 }, /* (306) language_opt ::= LANGUAGE NK_STRING */ - { 329, -12 }, /* (307) 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 */ - { 329, -4 }, /* (308) cmd ::= DROP STREAM exists_opt stream_name */ - { 405, 0 }, /* (309) col_list_opt ::= */ - { 405, -3 }, /* (310) col_list_opt ::= NK_LP col_name_list NK_RP */ - { 406, 0 }, /* (311) tag_def_or_ref_opt ::= */ - { 406, -1 }, /* (312) tag_def_or_ref_opt ::= tags_def */ - { 406, -4 }, /* (313) tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */ - { 404, 0 }, /* (314) stream_options ::= */ - { 404, -3 }, /* (315) stream_options ::= stream_options TRIGGER AT_ONCE */ - { 404, -3 }, /* (316) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ - { 404, -4 }, /* (317) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ - { 404, -3 }, /* (318) stream_options ::= stream_options WATERMARK duration_literal */ - { 404, -4 }, /* (319) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ - { 404, -3 }, /* (320) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ - { 404, -3 }, /* (321) stream_options ::= stream_options DELETE_MARK duration_literal */ - { 404, -4 }, /* (322) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ - { 407, 0 }, /* (323) subtable_opt ::= */ - { 407, -4 }, /* (324) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ - { 329, -3 }, /* (325) cmd ::= KILL CONNECTION NK_INTEGER */ - { 329, -3 }, /* (326) cmd ::= KILL QUERY NK_STRING */ - { 329, -3 }, /* (327) cmd ::= KILL TRANSACTION NK_INTEGER */ - { 329, -2 }, /* (328) cmd ::= BALANCE VGROUP */ - { 329, -4 }, /* (329) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ - { 329, -4 }, /* (330) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ - { 329, -3 }, /* (331) cmd ::= SPLIT VGROUP NK_INTEGER */ - { 409, -2 }, /* (332) dnode_list ::= DNODE NK_INTEGER */ - { 409, -3 }, /* (333) dnode_list ::= dnode_list DNODE NK_INTEGER */ - { 329, -4 }, /* (334) cmd ::= DELETE FROM full_table_name where_clause_opt */ - { 329, -1 }, /* (335) cmd ::= query_or_subquery */ - { 329, -1 }, /* (336) cmd ::= insert_query */ - { 399, -7 }, /* (337) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ - { 399, -4 }, /* (338) insert_query ::= INSERT INTO full_table_name query_or_subquery */ - { 332, -1 }, /* (339) literal ::= NK_INTEGER */ - { 332, -1 }, /* (340) literal ::= NK_FLOAT */ - { 332, -1 }, /* (341) literal ::= NK_STRING */ - { 332, -1 }, /* (342) literal ::= NK_BOOL */ - { 332, -2 }, /* (343) literal ::= TIMESTAMP NK_STRING */ - { 332, -1 }, /* (344) literal ::= duration_literal */ - { 332, -1 }, /* (345) literal ::= NULL */ - { 332, -1 }, /* (346) literal ::= NK_QUESTION */ - { 376, -1 }, /* (347) duration_literal ::= NK_VARIABLE */ - { 411, -1 }, /* (348) signed ::= NK_INTEGER */ - { 411, -2 }, /* (349) signed ::= NK_PLUS NK_INTEGER */ - { 411, -2 }, /* (350) signed ::= NK_MINUS NK_INTEGER */ - { 411, -1 }, /* (351) signed ::= NK_FLOAT */ - { 411, -2 }, /* (352) signed ::= NK_PLUS NK_FLOAT */ - { 411, -2 }, /* (353) signed ::= NK_MINUS NK_FLOAT */ - { 365, -1 }, /* (354) signed_literal ::= signed */ - { 365, -1 }, /* (355) signed_literal ::= NK_STRING */ - { 365, -1 }, /* (356) signed_literal ::= NK_BOOL */ - { 365, -2 }, /* (357) signed_literal ::= TIMESTAMP NK_STRING */ - { 365, -1 }, /* (358) signed_literal ::= duration_literal */ - { 365, -1 }, /* (359) signed_literal ::= NULL */ - { 365, -1 }, /* (360) signed_literal ::= literal_func */ - { 365, -1 }, /* (361) signed_literal ::= NK_QUESTION */ - { 413, -1 }, /* (362) literal_list ::= signed_literal */ - { 413, -3 }, /* (363) literal_list ::= literal_list NK_COMMA signed_literal */ - { 340, -1 }, /* (364) db_name ::= NK_ID */ - { 371, -1 }, /* (365) table_name ::= NK_ID */ - { 363, -1 }, /* (366) column_name ::= NK_ID */ - { 378, -1 }, /* (367) function_name ::= NK_ID */ - { 414, -1 }, /* (368) table_alias ::= NK_ID */ - { 386, -1 }, /* (369) column_alias ::= NK_ID */ - { 334, -1 }, /* (370) user_name ::= NK_ID */ - { 341, -1 }, /* (371) topic_name ::= NK_ID */ - { 403, -1 }, /* (372) stream_name ::= NK_ID */ - { 396, -1 }, /* (373) cgroup_name ::= NK_ID */ - { 389, -1 }, /* (374) index_name ::= NK_ID */ - { 415, -1 }, /* (375) expr_or_subquery ::= expression */ - { 408, -1 }, /* (376) expression ::= literal */ - { 408, -1 }, /* (377) expression ::= pseudo_column */ - { 408, -1 }, /* (378) expression ::= column_reference */ - { 408, -1 }, /* (379) expression ::= function_expression */ - { 408, -1 }, /* (380) expression ::= case_when_expression */ - { 408, -3 }, /* (381) expression ::= NK_LP expression NK_RP */ - { 408, -2 }, /* (382) expression ::= NK_PLUS expr_or_subquery */ - { 408, -2 }, /* (383) expression ::= NK_MINUS expr_or_subquery */ - { 408, -3 }, /* (384) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ - { 408, -3 }, /* (385) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ - { 408, -3 }, /* (386) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ - { 408, -3 }, /* (387) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ - { 408, -3 }, /* (388) expression ::= expr_or_subquery NK_REM expr_or_subquery */ - { 408, -3 }, /* (389) expression ::= column_reference NK_ARROW NK_STRING */ - { 408, -3 }, /* (390) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ - { 408, -3 }, /* (391) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ - { 368, -1 }, /* (392) expression_list ::= expr_or_subquery */ - { 368, -3 }, /* (393) expression_list ::= expression_list NK_COMMA expr_or_subquery */ - { 417, -1 }, /* (394) column_reference ::= column_name */ - { 417, -3 }, /* (395) column_reference ::= table_name NK_DOT column_name */ - { 416, -1 }, /* (396) pseudo_column ::= ROWTS */ - { 416, -1 }, /* (397) pseudo_column ::= TBNAME */ - { 416, -3 }, /* (398) pseudo_column ::= table_name NK_DOT TBNAME */ - { 416, -1 }, /* (399) pseudo_column ::= QSTART */ - { 416, -1 }, /* (400) pseudo_column ::= QEND */ - { 416, -1 }, /* (401) pseudo_column ::= QDURATION */ - { 416, -1 }, /* (402) pseudo_column ::= WSTART */ - { 416, -1 }, /* (403) pseudo_column ::= WEND */ - { 416, -1 }, /* (404) pseudo_column ::= WDURATION */ - { 416, -1 }, /* (405) pseudo_column ::= IROWTS */ - { 416, -1 }, /* (406) pseudo_column ::= ISFILLED */ - { 416, -1 }, /* (407) pseudo_column ::= QTAGS */ - { 418, -4 }, /* (408) function_expression ::= function_name NK_LP expression_list NK_RP */ - { 418, -4 }, /* (409) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ - { 418, -6 }, /* (410) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ - { 418, -1 }, /* (411) function_expression ::= literal_func */ - { 412, -3 }, /* (412) literal_func ::= noarg_func NK_LP NK_RP */ - { 412, -1 }, /* (413) literal_func ::= NOW */ - { 422, -1 }, /* (414) noarg_func ::= NOW */ - { 422, -1 }, /* (415) noarg_func ::= TODAY */ - { 422, -1 }, /* (416) noarg_func ::= TIMEZONE */ - { 422, -1 }, /* (417) noarg_func ::= DATABASE */ - { 422, -1 }, /* (418) noarg_func ::= CLIENT_VERSION */ - { 422, -1 }, /* (419) noarg_func ::= SERVER_VERSION */ - { 422, -1 }, /* (420) noarg_func ::= SERVER_STATUS */ - { 422, -1 }, /* (421) noarg_func ::= CURRENT_USER */ - { 422, -1 }, /* (422) noarg_func ::= USER */ - { 420, -1 }, /* (423) star_func ::= COUNT */ - { 420, -1 }, /* (424) star_func ::= FIRST */ - { 420, -1 }, /* (425) star_func ::= LAST */ - { 420, -1 }, /* (426) star_func ::= LAST_ROW */ - { 421, -1 }, /* (427) star_func_para_list ::= NK_STAR */ - { 421, -1 }, /* (428) star_func_para_list ::= other_para_list */ - { 423, -1 }, /* (429) other_para_list ::= star_func_para */ - { 423, -3 }, /* (430) other_para_list ::= other_para_list NK_COMMA star_func_para */ - { 424, -1 }, /* (431) star_func_para ::= expr_or_subquery */ - { 424, -3 }, /* (432) star_func_para ::= table_name NK_DOT NK_STAR */ - { 419, -4 }, /* (433) case_when_expression ::= CASE when_then_list case_when_else_opt END */ - { 419, -5 }, /* (434) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ - { 425, -1 }, /* (435) when_then_list ::= when_then_expr */ - { 425, -2 }, /* (436) when_then_list ::= when_then_list when_then_expr */ - { 428, -4 }, /* (437) when_then_expr ::= WHEN common_expression THEN common_expression */ - { 426, 0 }, /* (438) case_when_else_opt ::= */ - { 426, -2 }, /* (439) case_when_else_opt ::= ELSE common_expression */ - { 429, -3 }, /* (440) predicate ::= expr_or_subquery compare_op expr_or_subquery */ - { 429, -5 }, /* (441) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ - { 429, -6 }, /* (442) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ - { 429, -3 }, /* (443) predicate ::= expr_or_subquery IS NULL */ - { 429, -4 }, /* (444) predicate ::= expr_or_subquery IS NOT NULL */ - { 429, -3 }, /* (445) predicate ::= expr_or_subquery in_op in_predicate_value */ - { 430, -1 }, /* (446) compare_op ::= NK_LT */ - { 430, -1 }, /* (447) compare_op ::= NK_GT */ - { 430, -1 }, /* (448) compare_op ::= NK_LE */ - { 430, -1 }, /* (449) compare_op ::= NK_GE */ - { 430, -1 }, /* (450) compare_op ::= NK_NE */ - { 430, -1 }, /* (451) compare_op ::= NK_EQ */ - { 430, -1 }, /* (452) compare_op ::= LIKE */ - { 430, -2 }, /* (453) compare_op ::= NOT LIKE */ - { 430, -1 }, /* (454) compare_op ::= MATCH */ - { 430, -1 }, /* (455) compare_op ::= NMATCH */ - { 430, -1 }, /* (456) compare_op ::= CONTAINS */ - { 431, -1 }, /* (457) in_op ::= IN */ - { 431, -2 }, /* (458) in_op ::= NOT IN */ - { 432, -3 }, /* (459) in_predicate_value ::= NK_LP literal_list NK_RP */ - { 433, -1 }, /* (460) boolean_value_expression ::= boolean_primary */ - { 433, -2 }, /* (461) boolean_value_expression ::= NOT boolean_primary */ - { 433, -3 }, /* (462) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ - { 433, -3 }, /* (463) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ - { 434, -1 }, /* (464) boolean_primary ::= predicate */ - { 434, -3 }, /* (465) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ - { 427, -1 }, /* (466) common_expression ::= expr_or_subquery */ - { 427, -1 }, /* (467) common_expression ::= boolean_value_expression */ - { 435, 0 }, /* (468) from_clause_opt ::= */ - { 435, -2 }, /* (469) from_clause_opt ::= FROM table_reference_list */ - { 436, -1 }, /* (470) table_reference_list ::= table_reference */ - { 436, -3 }, /* (471) table_reference_list ::= table_reference_list NK_COMMA table_reference */ - { 437, -1 }, /* (472) table_reference ::= table_primary */ - { 437, -1 }, /* (473) table_reference ::= joined_table */ - { 438, -2 }, /* (474) table_primary ::= table_name alias_opt */ - { 438, -4 }, /* (475) table_primary ::= db_name NK_DOT table_name alias_opt */ - { 438, -2 }, /* (476) table_primary ::= subquery alias_opt */ - { 438, -1 }, /* (477) table_primary ::= parenthesized_joined_table */ - { 440, 0 }, /* (478) alias_opt ::= */ - { 440, -1 }, /* (479) alias_opt ::= table_alias */ - { 440, -2 }, /* (480) alias_opt ::= AS table_alias */ - { 442, -3 }, /* (481) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - { 442, -3 }, /* (482) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ - { 439, -6 }, /* (483) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ - { 443, 0 }, /* (484) join_type ::= */ - { 443, -1 }, /* (485) join_type ::= INNER */ - { 445, -12 }, /* (486) query_specification ::= SELECT set_quantifier_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 */ - { 446, 0 }, /* (487) set_quantifier_opt ::= */ - { 446, -1 }, /* (488) set_quantifier_opt ::= DISTINCT */ - { 446, -1 }, /* (489) set_quantifier_opt ::= ALL */ - { 447, -1 }, /* (490) select_list ::= select_item */ - { 447, -3 }, /* (491) select_list ::= select_list NK_COMMA select_item */ - { 455, -1 }, /* (492) select_item ::= NK_STAR */ - { 455, -1 }, /* (493) select_item ::= common_expression */ - { 455, -2 }, /* (494) select_item ::= common_expression column_alias */ - { 455, -3 }, /* (495) select_item ::= common_expression AS column_alias */ - { 455, -3 }, /* (496) select_item ::= table_name NK_DOT NK_STAR */ - { 410, 0 }, /* (497) where_clause_opt ::= */ - { 410, -2 }, /* (498) where_clause_opt ::= WHERE search_condition */ - { 448, 0 }, /* (499) partition_by_clause_opt ::= */ - { 448, -3 }, /* (500) partition_by_clause_opt ::= PARTITION BY partition_list */ - { 456, -1 }, /* (501) partition_list ::= partition_item */ - { 456, -3 }, /* (502) partition_list ::= partition_list NK_COMMA partition_item */ - { 457, -1 }, /* (503) partition_item ::= expr_or_subquery */ - { 457, -2 }, /* (504) partition_item ::= expr_or_subquery column_alias */ - { 457, -3 }, /* (505) partition_item ::= expr_or_subquery AS column_alias */ - { 452, 0 }, /* (506) twindow_clause_opt ::= */ - { 452, -6 }, /* (507) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ - { 452, -4 }, /* (508) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ - { 452, -6 }, /* (509) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ - { 452, -8 }, /* (510) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ - { 452, -7 }, /* (511) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ - { 391, 0 }, /* (512) sliding_opt ::= */ - { 391, -4 }, /* (513) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ - { 451, 0 }, /* (514) fill_opt ::= */ - { 451, -4 }, /* (515) fill_opt ::= FILL NK_LP fill_mode NK_RP */ - { 451, -6 }, /* (516) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ - { 451, -6 }, /* (517) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA literal_list NK_RP */ - { 458, -1 }, /* (518) fill_mode ::= NONE */ - { 458, -1 }, /* (519) fill_mode ::= PREV */ - { 458, -1 }, /* (520) fill_mode ::= NULL */ - { 458, -1 }, /* (521) fill_mode ::= NULL_F */ - { 458, -1 }, /* (522) fill_mode ::= LINEAR */ - { 458, -1 }, /* (523) fill_mode ::= NEXT */ - { 453, 0 }, /* (524) group_by_clause_opt ::= */ - { 453, -3 }, /* (525) group_by_clause_opt ::= GROUP BY group_by_list */ - { 459, -1 }, /* (526) group_by_list ::= expr_or_subquery */ - { 459, -3 }, /* (527) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ - { 454, 0 }, /* (528) having_clause_opt ::= */ - { 454, -2 }, /* (529) having_clause_opt ::= HAVING search_condition */ - { 449, 0 }, /* (530) range_opt ::= */ - { 449, -6 }, /* (531) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ - { 450, 0 }, /* (532) every_opt ::= */ - { 450, -4 }, /* (533) every_opt ::= EVERY NK_LP duration_literal NK_RP */ - { 460, -4 }, /* (534) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ - { 461, -1 }, /* (535) query_simple ::= query_specification */ - { 461, -1 }, /* (536) query_simple ::= union_query_expression */ - { 465, -4 }, /* (537) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ - { 465, -3 }, /* (538) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ - { 466, -1 }, /* (539) query_simple_or_subquery ::= query_simple */ - { 466, -1 }, /* (540) query_simple_or_subquery ::= subquery */ - { 395, -1 }, /* (541) query_or_subquery ::= query_expression */ - { 395, -1 }, /* (542) query_or_subquery ::= subquery */ - { 462, 0 }, /* (543) order_by_clause_opt ::= */ - { 462, -3 }, /* (544) order_by_clause_opt ::= ORDER BY sort_specification_list */ - { 463, 0 }, /* (545) slimit_clause_opt ::= */ - { 463, -2 }, /* (546) slimit_clause_opt ::= SLIMIT NK_INTEGER */ - { 463, -4 }, /* (547) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - { 463, -4 }, /* (548) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - { 464, 0 }, /* (549) limit_clause_opt ::= */ - { 464, -2 }, /* (550) limit_clause_opt ::= LIMIT NK_INTEGER */ - { 464, -4 }, /* (551) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ - { 464, -4 }, /* (552) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - { 441, -3 }, /* (553) subquery ::= NK_LP query_expression NK_RP */ - { 441, -3 }, /* (554) subquery ::= NK_LP subquery NK_RP */ - { 444, -1 }, /* (555) search_condition ::= common_expression */ - { 467, -1 }, /* (556) sort_specification_list ::= sort_specification */ - { 467, -3 }, /* (557) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ - { 468, -3 }, /* (558) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ - { 469, 0 }, /* (559) ordering_specification_opt ::= */ - { 469, -1 }, /* (560) ordering_specification_opt ::= ASC */ - { 469, -1 }, /* (561) ordering_specification_opt ::= DESC */ - { 470, 0 }, /* (562) null_ordering_opt ::= */ - { 470, -2 }, /* (563) null_ordering_opt ::= NULLS FIRST */ - { 470, -2 }, /* (564) null_ordering_opt ::= NULLS LAST */ + { 354, -2 }, /* (110) alter_db_option ::= BUFFER NK_INTEGER */ + { 354, -2 }, /* (111) alter_db_option ::= CACHEMODEL NK_STRING */ + { 354, -2 }, /* (112) alter_db_option ::= CACHESIZE NK_INTEGER */ + { 354, -2 }, /* (113) alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */ + { 354, -2 }, /* (114) alter_db_option ::= KEEP integer_list */ + { 354, -2 }, /* (115) alter_db_option ::= KEEP variable_list */ + { 354, -2 }, /* (116) alter_db_option ::= PAGES NK_INTEGER */ + { 354, -2 }, /* (117) alter_db_option ::= REPLICA NK_INTEGER */ + { 354, -2 }, /* (118) alter_db_option ::= WAL_LEVEL NK_INTEGER */ + { 354, -2 }, /* (119) alter_db_option ::= STT_TRIGGER NK_INTEGER */ + { 354, -2 }, /* (120) alter_db_option ::= MINROWS NK_INTEGER */ + { 351, -1 }, /* (121) integer_list ::= NK_INTEGER */ + { 351, -3 }, /* (122) integer_list ::= integer_list NK_COMMA NK_INTEGER */ + { 352, -1 }, /* (123) variable_list ::= NK_VARIABLE */ + { 352, -3 }, /* (124) variable_list ::= variable_list NK_COMMA NK_VARIABLE */ + { 353, -1 }, /* (125) retention_list ::= retention */ + { 353, -3 }, /* (126) retention_list ::= retention_list NK_COMMA retention */ + { 355, -3 }, /* (127) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ + { 348, 0 }, /* (128) speed_opt ::= */ + { 348, -2 }, /* (129) speed_opt ::= MAX_SPEED NK_INTEGER */ + { 349, 0 }, /* (130) start_opt ::= */ + { 349, -3 }, /* (131) start_opt ::= START WITH NK_INTEGER */ + { 349, -3 }, /* (132) start_opt ::= START WITH NK_STRING */ + { 349, -4 }, /* (133) start_opt ::= START WITH TIMESTAMP NK_STRING */ + { 350, 0 }, /* (134) end_opt ::= */ + { 350, -3 }, /* (135) end_opt ::= END WITH NK_INTEGER */ + { 350, -3 }, /* (136) end_opt ::= END WITH NK_STRING */ + { 350, -4 }, /* (137) end_opt ::= END WITH TIMESTAMP NK_STRING */ + { 329, -9 }, /* (138) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ + { 329, -3 }, /* (139) cmd ::= CREATE TABLE multi_create_clause */ + { 329, -9 }, /* (140) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ + { 329, -3 }, /* (141) cmd ::= DROP TABLE multi_drop_clause */ + { 329, -4 }, /* (142) cmd ::= DROP STABLE exists_opt full_table_name */ + { 329, -3 }, /* (143) cmd ::= ALTER TABLE alter_table_clause */ + { 329, -3 }, /* (144) cmd ::= ALTER STABLE alter_table_clause */ + { 363, -2 }, /* (145) alter_table_clause ::= full_table_name alter_table_options */ + { 363, -5 }, /* (146) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ + { 363, -4 }, /* (147) alter_table_clause ::= full_table_name DROP COLUMN column_name */ + { 363, -5 }, /* (148) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ + { 363, -5 }, /* (149) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ + { 363, -5 }, /* (150) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ + { 363, -4 }, /* (151) alter_table_clause ::= full_table_name DROP TAG column_name */ + { 363, -5 }, /* (152) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ + { 363, -5 }, /* (153) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ + { 363, -6 }, /* (154) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ + { 360, -1 }, /* (155) multi_create_clause ::= create_subtable_clause */ + { 360, -2 }, /* (156) multi_create_clause ::= multi_create_clause create_subtable_clause */ + { 368, -10 }, /* (157) 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 */ + { 362, -1 }, /* (158) multi_drop_clause ::= drop_table_clause */ + { 362, -3 }, /* (159) multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ + { 371, -2 }, /* (160) drop_table_clause ::= exists_opt full_table_name */ + { 369, 0 }, /* (161) specific_cols_opt ::= */ + { 369, -3 }, /* (162) specific_cols_opt ::= NK_LP col_name_list NK_RP */ + { 356, -1 }, /* (163) full_table_name ::= table_name */ + { 356, -3 }, /* (164) full_table_name ::= db_name NK_DOT table_name */ + { 357, -1 }, /* (165) column_def_list ::= column_def */ + { 357, -3 }, /* (166) column_def_list ::= column_def_list NK_COMMA column_def */ + { 374, -2 }, /* (167) column_def ::= column_name type_name */ + { 374, -4 }, /* (168) column_def ::= column_name type_name COMMENT NK_STRING */ + { 366, -1 }, /* (169) type_name ::= BOOL */ + { 366, -1 }, /* (170) type_name ::= TINYINT */ + { 366, -1 }, /* (171) type_name ::= SMALLINT */ + { 366, -1 }, /* (172) type_name ::= INT */ + { 366, -1 }, /* (173) type_name ::= INTEGER */ + { 366, -1 }, /* (174) type_name ::= BIGINT */ + { 366, -1 }, /* (175) type_name ::= FLOAT */ + { 366, -1 }, /* (176) type_name ::= DOUBLE */ + { 366, -4 }, /* (177) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ + { 366, -1 }, /* (178) type_name ::= TIMESTAMP */ + { 366, -4 }, /* (179) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ + { 366, -2 }, /* (180) type_name ::= TINYINT UNSIGNED */ + { 366, -2 }, /* (181) type_name ::= SMALLINT UNSIGNED */ + { 366, -2 }, /* (182) type_name ::= INT UNSIGNED */ + { 366, -2 }, /* (183) type_name ::= BIGINT UNSIGNED */ + { 366, -1 }, /* (184) type_name ::= JSON */ + { 366, -4 }, /* (185) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ + { 366, -1 }, /* (186) type_name ::= MEDIUMBLOB */ + { 366, -1 }, /* (187) type_name ::= BLOB */ + { 366, -4 }, /* (188) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ + { 366, -1 }, /* (189) type_name ::= DECIMAL */ + { 366, -4 }, /* (190) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ + { 366, -6 }, /* (191) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ + { 358, 0 }, /* (192) tags_def_opt ::= */ + { 358, -1 }, /* (193) tags_def_opt ::= tags_def */ + { 361, -4 }, /* (194) tags_def ::= TAGS NK_LP column_def_list NK_RP */ + { 359, 0 }, /* (195) table_options ::= */ + { 359, -3 }, /* (196) table_options ::= table_options COMMENT NK_STRING */ + { 359, -3 }, /* (197) table_options ::= table_options MAX_DELAY duration_list */ + { 359, -3 }, /* (198) table_options ::= table_options WATERMARK duration_list */ + { 359, -5 }, /* (199) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ + { 359, -3 }, /* (200) table_options ::= table_options TTL NK_INTEGER */ + { 359, -5 }, /* (201) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ + { 359, -3 }, /* (202) table_options ::= table_options DELETE_MARK duration_list */ + { 364, -1 }, /* (203) alter_table_options ::= alter_table_option */ + { 364, -2 }, /* (204) alter_table_options ::= alter_table_options alter_table_option */ + { 377, -2 }, /* (205) alter_table_option ::= COMMENT NK_STRING */ + { 377, -2 }, /* (206) alter_table_option ::= TTL NK_INTEGER */ + { 375, -1 }, /* (207) duration_list ::= duration_literal */ + { 375, -3 }, /* (208) duration_list ::= duration_list NK_COMMA duration_literal */ + { 376, -1 }, /* (209) rollup_func_list ::= rollup_func_name */ + { 376, -3 }, /* (210) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ + { 379, -1 }, /* (211) rollup_func_name ::= function_name */ + { 379, -1 }, /* (212) rollup_func_name ::= FIRST */ + { 379, -1 }, /* (213) rollup_func_name ::= LAST */ + { 372, -1 }, /* (214) col_name_list ::= col_name */ + { 372, -3 }, /* (215) col_name_list ::= col_name_list NK_COMMA col_name */ + { 381, -1 }, /* (216) col_name ::= column_name */ + { 329, -2 }, /* (217) cmd ::= SHOW DNODES */ + { 329, -2 }, /* (218) cmd ::= SHOW USERS */ + { 329, -3 }, /* (219) cmd ::= SHOW USER PRIVILEGES */ + { 329, -2 }, /* (220) cmd ::= SHOW DATABASES */ + { 329, -4 }, /* (221) cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ + { 329, -4 }, /* (222) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ + { 329, -3 }, /* (223) cmd ::= SHOW db_name_cond_opt VGROUPS */ + { 329, -2 }, /* (224) cmd ::= SHOW MNODES */ + { 329, -2 }, /* (225) cmd ::= SHOW QNODES */ + { 329, -2 }, /* (226) cmd ::= SHOW FUNCTIONS */ + { 329, -5 }, /* (227) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ + { 329, -2 }, /* (228) cmd ::= SHOW STREAMS */ + { 329, -2 }, /* (229) cmd ::= SHOW ACCOUNTS */ + { 329, -2 }, /* (230) cmd ::= SHOW APPS */ + { 329, -2 }, /* (231) cmd ::= SHOW CONNECTIONS */ + { 329, -2 }, /* (232) cmd ::= SHOW LICENCES */ + { 329, -2 }, /* (233) cmd ::= SHOW GRANTS */ + { 329, -4 }, /* (234) cmd ::= SHOW CREATE DATABASE db_name */ + { 329, -4 }, /* (235) cmd ::= SHOW CREATE TABLE full_table_name */ + { 329, -4 }, /* (236) cmd ::= SHOW CREATE STABLE full_table_name */ + { 329, -2 }, /* (237) cmd ::= SHOW QUERIES */ + { 329, -2 }, /* (238) cmd ::= SHOW SCORES */ + { 329, -2 }, /* (239) cmd ::= SHOW TOPICS */ + { 329, -2 }, /* (240) cmd ::= SHOW VARIABLES */ + { 329, -3 }, /* (241) cmd ::= SHOW CLUSTER VARIABLES */ + { 329, -3 }, /* (242) cmd ::= SHOW LOCAL VARIABLES */ + { 329, -5 }, /* (243) cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ + { 329, -2 }, /* (244) cmd ::= SHOW BNODES */ + { 329, -2 }, /* (245) cmd ::= SHOW SNODES */ + { 329, -2 }, /* (246) cmd ::= SHOW CLUSTER */ + { 329, -2 }, /* (247) cmd ::= SHOW TRANSACTIONS */ + { 329, -4 }, /* (248) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ + { 329, -2 }, /* (249) cmd ::= SHOW CONSUMERS */ + { 329, -2 }, /* (250) cmd ::= SHOW SUBSCRIPTIONS */ + { 329, -5 }, /* (251) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ + { 329, -7 }, /* (252) cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ + { 329, -3 }, /* (253) cmd ::= SHOW VNODES NK_INTEGER */ + { 329, -3 }, /* (254) cmd ::= SHOW VNODES NK_STRING */ + { 329, -3 }, /* (255) cmd ::= SHOW db_name_cond_opt ALIVE */ + { 329, -3 }, /* (256) cmd ::= SHOW CLUSTER ALIVE */ + { 382, 0 }, /* (257) db_name_cond_opt ::= */ + { 382, -2 }, /* (258) db_name_cond_opt ::= db_name NK_DOT */ + { 383, 0 }, /* (259) like_pattern_opt ::= */ + { 383, -2 }, /* (260) like_pattern_opt ::= LIKE NK_STRING */ + { 384, -1 }, /* (261) table_name_cond ::= table_name */ + { 385, 0 }, /* (262) from_db_opt ::= */ + { 385, -2 }, /* (263) from_db_opt ::= FROM db_name */ + { 386, 0 }, /* (264) tag_list_opt ::= */ + { 386, -1 }, /* (265) tag_list_opt ::= tag_item */ + { 386, -3 }, /* (266) tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ + { 387, -1 }, /* (267) tag_item ::= TBNAME */ + { 387, -1 }, /* (268) tag_item ::= QTAGS */ + { 387, -1 }, /* (269) tag_item ::= column_name */ + { 387, -2 }, /* (270) tag_item ::= column_name column_alias */ + { 387, -3 }, /* (271) tag_item ::= column_name AS column_alias */ + { 329, -8 }, /* (272) cmd ::= CREATE SMA INDEX not_exists_opt full_index_name ON full_table_name index_options */ + { 329, -9 }, /* (273) cmd ::= CREATE INDEX not_exists_opt full_index_name ON full_table_name NK_LP col_name_list NK_RP */ + { 329, -4 }, /* (274) cmd ::= DROP INDEX exists_opt full_index_name */ + { 389, -1 }, /* (275) full_index_name ::= index_name */ + { 389, -3 }, /* (276) full_index_name ::= db_name NK_DOT index_name */ + { 390, -10 }, /* (277) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ + { 390, -12 }, /* (278) 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 */ + { 392, -1 }, /* (279) func_list ::= func */ + { 392, -3 }, /* (280) func_list ::= func_list NK_COMMA func */ + { 395, -4 }, /* (281) func ::= sma_func_name NK_LP expression_list NK_RP */ + { 396, -1 }, /* (282) sma_func_name ::= function_name */ + { 396, -1 }, /* (283) sma_func_name ::= COUNT */ + { 396, -1 }, /* (284) sma_func_name ::= FIRST */ + { 396, -1 }, /* (285) sma_func_name ::= LAST */ + { 396, -1 }, /* (286) sma_func_name ::= LAST_ROW */ + { 394, 0 }, /* (287) sma_stream_opt ::= */ + { 394, -3 }, /* (288) sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ + { 394, -3 }, /* (289) sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ + { 394, -3 }, /* (290) sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ + { 329, -6 }, /* (291) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ + { 329, -7 }, /* (292) cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ + { 329, -9 }, /* (293) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */ + { 329, -7 }, /* (294) cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ + { 329, -9 }, /* (295) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */ + { 329, -4 }, /* (296) cmd ::= DROP TOPIC exists_opt topic_name */ + { 329, -7 }, /* (297) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ + { 329, -2 }, /* (298) cmd ::= DESC full_table_name */ + { 329, -2 }, /* (299) cmd ::= DESCRIBE full_table_name */ + { 329, -3 }, /* (300) cmd ::= RESET QUERY CACHE */ + { 329, -4 }, /* (301) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ + { 329, -4 }, /* (302) cmd ::= EXPLAIN analyze_opt explain_options insert_query */ + { 399, 0 }, /* (303) analyze_opt ::= */ + { 399, -1 }, /* (304) analyze_opt ::= ANALYZE */ + { 400, 0 }, /* (305) explain_options ::= */ + { 400, -3 }, /* (306) explain_options ::= explain_options VERBOSE NK_BOOL */ + { 400, -3 }, /* (307) explain_options ::= explain_options RATIO NK_FLOAT */ + { 329, -11 }, /* (308) cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */ + { 329, -4 }, /* (309) cmd ::= DROP FUNCTION exists_opt function_name */ + { 402, 0 }, /* (310) agg_func_opt ::= */ + { 402, -1 }, /* (311) agg_func_opt ::= AGGREGATE */ + { 403, 0 }, /* (312) bufsize_opt ::= */ + { 403, -2 }, /* (313) bufsize_opt ::= BUFSIZE NK_INTEGER */ + { 404, 0 }, /* (314) language_opt ::= */ + { 404, -2 }, /* (315) language_opt ::= LANGUAGE NK_STRING */ + { 329, -12 }, /* (316) 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 */ + { 329, -4 }, /* (317) cmd ::= DROP STREAM exists_opt stream_name */ + { 407, 0 }, /* (318) col_list_opt ::= */ + { 407, -3 }, /* (319) col_list_opt ::= NK_LP col_name_list NK_RP */ + { 408, 0 }, /* (320) tag_def_or_ref_opt ::= */ + { 408, -1 }, /* (321) tag_def_or_ref_opt ::= tags_def */ + { 408, -4 }, /* (322) tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */ + { 406, 0 }, /* (323) stream_options ::= */ + { 406, -3 }, /* (324) stream_options ::= stream_options TRIGGER AT_ONCE */ + { 406, -3 }, /* (325) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ + { 406, -4 }, /* (326) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ + { 406, -3 }, /* (327) stream_options ::= stream_options WATERMARK duration_literal */ + { 406, -4 }, /* (328) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ + { 406, -3 }, /* (329) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ + { 406, -3 }, /* (330) stream_options ::= stream_options DELETE_MARK duration_literal */ + { 406, -4 }, /* (331) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ + { 409, 0 }, /* (332) subtable_opt ::= */ + { 409, -4 }, /* (333) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ + { 329, -3 }, /* (334) cmd ::= KILL CONNECTION NK_INTEGER */ + { 329, -3 }, /* (335) cmd ::= KILL QUERY NK_STRING */ + { 329, -3 }, /* (336) cmd ::= KILL TRANSACTION NK_INTEGER */ + { 329, -2 }, /* (337) cmd ::= BALANCE VGROUP */ + { 329, -4 }, /* (338) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + { 329, -4 }, /* (339) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ + { 329, -3 }, /* (340) cmd ::= SPLIT VGROUP NK_INTEGER */ + { 411, -2 }, /* (341) dnode_list ::= DNODE NK_INTEGER */ + { 411, -3 }, /* (342) dnode_list ::= dnode_list DNODE NK_INTEGER */ + { 329, -4 }, /* (343) cmd ::= DELETE FROM full_table_name where_clause_opt */ + { 329, -1 }, /* (344) cmd ::= query_or_subquery */ + { 329, -1 }, /* (345) cmd ::= insert_query */ + { 401, -7 }, /* (346) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ + { 401, -4 }, /* (347) insert_query ::= INSERT INTO full_table_name query_or_subquery */ + { 332, -1 }, /* (348) literal ::= NK_INTEGER */ + { 332, -1 }, /* (349) literal ::= NK_FLOAT */ + { 332, -1 }, /* (350) literal ::= NK_STRING */ + { 332, -1 }, /* (351) literal ::= NK_BOOL */ + { 332, -2 }, /* (352) literal ::= TIMESTAMP NK_STRING */ + { 332, -1 }, /* (353) literal ::= duration_literal */ + { 332, -1 }, /* (354) literal ::= NULL */ + { 332, -1 }, /* (355) literal ::= NK_QUESTION */ + { 378, -1 }, /* (356) duration_literal ::= NK_VARIABLE */ + { 413, -1 }, /* (357) signed ::= NK_INTEGER */ + { 413, -2 }, /* (358) signed ::= NK_PLUS NK_INTEGER */ + { 413, -2 }, /* (359) signed ::= NK_MINUS NK_INTEGER */ + { 413, -1 }, /* (360) signed ::= NK_FLOAT */ + { 413, -2 }, /* (361) signed ::= NK_PLUS NK_FLOAT */ + { 413, -2 }, /* (362) signed ::= NK_MINUS NK_FLOAT */ + { 367, -1 }, /* (363) signed_literal ::= signed */ + { 367, -1 }, /* (364) signed_literal ::= NK_STRING */ + { 367, -1 }, /* (365) signed_literal ::= NK_BOOL */ + { 367, -2 }, /* (366) signed_literal ::= TIMESTAMP NK_STRING */ + { 367, -1 }, /* (367) signed_literal ::= duration_literal */ + { 367, -1 }, /* (368) signed_literal ::= NULL */ + { 367, -1 }, /* (369) signed_literal ::= literal_func */ + { 367, -1 }, /* (370) signed_literal ::= NK_QUESTION */ + { 415, -1 }, /* (371) literal_list ::= signed_literal */ + { 415, -3 }, /* (372) literal_list ::= literal_list NK_COMMA signed_literal */ + { 340, -1 }, /* (373) db_name ::= NK_ID */ + { 373, -1 }, /* (374) table_name ::= NK_ID */ + { 365, -1 }, /* (375) column_name ::= NK_ID */ + { 380, -1 }, /* (376) function_name ::= NK_ID */ + { 416, -1 }, /* (377) table_alias ::= NK_ID */ + { 388, -1 }, /* (378) column_alias ::= NK_ID */ + { 334, -1 }, /* (379) user_name ::= NK_ID */ + { 341, -1 }, /* (380) topic_name ::= NK_ID */ + { 405, -1 }, /* (381) stream_name ::= NK_ID */ + { 398, -1 }, /* (382) cgroup_name ::= NK_ID */ + { 391, -1 }, /* (383) index_name ::= NK_ID */ + { 417, -1 }, /* (384) expr_or_subquery ::= expression */ + { 410, -1 }, /* (385) expression ::= literal */ + { 410, -1 }, /* (386) expression ::= pseudo_column */ + { 410, -1 }, /* (387) expression ::= column_reference */ + { 410, -1 }, /* (388) expression ::= function_expression */ + { 410, -1 }, /* (389) expression ::= case_when_expression */ + { 410, -3 }, /* (390) expression ::= NK_LP expression NK_RP */ + { 410, -2 }, /* (391) expression ::= NK_PLUS expr_or_subquery */ + { 410, -2 }, /* (392) expression ::= NK_MINUS expr_or_subquery */ + { 410, -3 }, /* (393) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ + { 410, -3 }, /* (394) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ + { 410, -3 }, /* (395) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ + { 410, -3 }, /* (396) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ + { 410, -3 }, /* (397) expression ::= expr_or_subquery NK_REM expr_or_subquery */ + { 410, -3 }, /* (398) expression ::= column_reference NK_ARROW NK_STRING */ + { 410, -3 }, /* (399) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ + { 410, -3 }, /* (400) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ + { 370, -1 }, /* (401) expression_list ::= expr_or_subquery */ + { 370, -3 }, /* (402) expression_list ::= expression_list NK_COMMA expr_or_subquery */ + { 419, -1 }, /* (403) column_reference ::= column_name */ + { 419, -3 }, /* (404) column_reference ::= table_name NK_DOT column_name */ + { 418, -1 }, /* (405) pseudo_column ::= ROWTS */ + { 418, -1 }, /* (406) pseudo_column ::= TBNAME */ + { 418, -3 }, /* (407) pseudo_column ::= table_name NK_DOT TBNAME */ + { 418, -1 }, /* (408) pseudo_column ::= QSTART */ + { 418, -1 }, /* (409) pseudo_column ::= QEND */ + { 418, -1 }, /* (410) pseudo_column ::= QDURATION */ + { 418, -1 }, /* (411) pseudo_column ::= WSTART */ + { 418, -1 }, /* (412) pseudo_column ::= WEND */ + { 418, -1 }, /* (413) pseudo_column ::= WDURATION */ + { 418, -1 }, /* (414) pseudo_column ::= IROWTS */ + { 418, -1 }, /* (415) pseudo_column ::= ISFILLED */ + { 418, -1 }, /* (416) pseudo_column ::= QTAGS */ + { 420, -4 }, /* (417) function_expression ::= function_name NK_LP expression_list NK_RP */ + { 420, -4 }, /* (418) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ + { 420, -6 }, /* (419) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ + { 420, -1 }, /* (420) function_expression ::= literal_func */ + { 414, -3 }, /* (421) literal_func ::= noarg_func NK_LP NK_RP */ + { 414, -1 }, /* (422) literal_func ::= NOW */ + { 424, -1 }, /* (423) noarg_func ::= NOW */ + { 424, -1 }, /* (424) noarg_func ::= TODAY */ + { 424, -1 }, /* (425) noarg_func ::= TIMEZONE */ + { 424, -1 }, /* (426) noarg_func ::= DATABASE */ + { 424, -1 }, /* (427) noarg_func ::= CLIENT_VERSION */ + { 424, -1 }, /* (428) noarg_func ::= SERVER_VERSION */ + { 424, -1 }, /* (429) noarg_func ::= SERVER_STATUS */ + { 424, -1 }, /* (430) noarg_func ::= CURRENT_USER */ + { 424, -1 }, /* (431) noarg_func ::= USER */ + { 422, -1 }, /* (432) star_func ::= COUNT */ + { 422, -1 }, /* (433) star_func ::= FIRST */ + { 422, -1 }, /* (434) star_func ::= LAST */ + { 422, -1 }, /* (435) star_func ::= LAST_ROW */ + { 423, -1 }, /* (436) star_func_para_list ::= NK_STAR */ + { 423, -1 }, /* (437) star_func_para_list ::= other_para_list */ + { 425, -1 }, /* (438) other_para_list ::= star_func_para */ + { 425, -3 }, /* (439) other_para_list ::= other_para_list NK_COMMA star_func_para */ + { 426, -1 }, /* (440) star_func_para ::= expr_or_subquery */ + { 426, -3 }, /* (441) star_func_para ::= table_name NK_DOT NK_STAR */ + { 421, -4 }, /* (442) case_when_expression ::= CASE when_then_list case_when_else_opt END */ + { 421, -5 }, /* (443) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ + { 427, -1 }, /* (444) when_then_list ::= when_then_expr */ + { 427, -2 }, /* (445) when_then_list ::= when_then_list when_then_expr */ + { 430, -4 }, /* (446) when_then_expr ::= WHEN common_expression THEN common_expression */ + { 428, 0 }, /* (447) case_when_else_opt ::= */ + { 428, -2 }, /* (448) case_when_else_opt ::= ELSE common_expression */ + { 431, -3 }, /* (449) predicate ::= expr_or_subquery compare_op expr_or_subquery */ + { 431, -5 }, /* (450) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ + { 431, -6 }, /* (451) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ + { 431, -3 }, /* (452) predicate ::= expr_or_subquery IS NULL */ + { 431, -4 }, /* (453) predicate ::= expr_or_subquery IS NOT NULL */ + { 431, -3 }, /* (454) predicate ::= expr_or_subquery in_op in_predicate_value */ + { 432, -1 }, /* (455) compare_op ::= NK_LT */ + { 432, -1 }, /* (456) compare_op ::= NK_GT */ + { 432, -1 }, /* (457) compare_op ::= NK_LE */ + { 432, -1 }, /* (458) compare_op ::= NK_GE */ + { 432, -1 }, /* (459) compare_op ::= NK_NE */ + { 432, -1 }, /* (460) compare_op ::= NK_EQ */ + { 432, -1 }, /* (461) compare_op ::= LIKE */ + { 432, -2 }, /* (462) compare_op ::= NOT LIKE */ + { 432, -1 }, /* (463) compare_op ::= MATCH */ + { 432, -1 }, /* (464) compare_op ::= NMATCH */ + { 432, -1 }, /* (465) compare_op ::= CONTAINS */ + { 433, -1 }, /* (466) in_op ::= IN */ + { 433, -2 }, /* (467) in_op ::= NOT IN */ + { 434, -3 }, /* (468) in_predicate_value ::= NK_LP literal_list NK_RP */ + { 435, -1 }, /* (469) boolean_value_expression ::= boolean_primary */ + { 435, -2 }, /* (470) boolean_value_expression ::= NOT boolean_primary */ + { 435, -3 }, /* (471) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + { 435, -3 }, /* (472) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + { 436, -1 }, /* (473) boolean_primary ::= predicate */ + { 436, -3 }, /* (474) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ + { 429, -1 }, /* (475) common_expression ::= expr_or_subquery */ + { 429, -1 }, /* (476) common_expression ::= boolean_value_expression */ + { 437, 0 }, /* (477) from_clause_opt ::= */ + { 437, -2 }, /* (478) from_clause_opt ::= FROM table_reference_list */ + { 438, -1 }, /* (479) table_reference_list ::= table_reference */ + { 438, -3 }, /* (480) table_reference_list ::= table_reference_list NK_COMMA table_reference */ + { 439, -1 }, /* (481) table_reference ::= table_primary */ + { 439, -1 }, /* (482) table_reference ::= joined_table */ + { 440, -2 }, /* (483) table_primary ::= table_name alias_opt */ + { 440, -4 }, /* (484) table_primary ::= db_name NK_DOT table_name alias_opt */ + { 440, -2 }, /* (485) table_primary ::= subquery alias_opt */ + { 440, -1 }, /* (486) table_primary ::= parenthesized_joined_table */ + { 442, 0 }, /* (487) alias_opt ::= */ + { 442, -1 }, /* (488) alias_opt ::= table_alias */ + { 442, -2 }, /* (489) alias_opt ::= AS table_alias */ + { 444, -3 }, /* (490) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + { 444, -3 }, /* (491) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ + { 441, -6 }, /* (492) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ + { 445, 0 }, /* (493) join_type ::= */ + { 445, -1 }, /* (494) join_type ::= INNER */ + { 447, -12 }, /* (495) query_specification ::= SELECT set_quantifier_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 */ + { 448, 0 }, /* (496) set_quantifier_opt ::= */ + { 448, -1 }, /* (497) set_quantifier_opt ::= DISTINCT */ + { 448, -1 }, /* (498) set_quantifier_opt ::= ALL */ + { 449, -1 }, /* (499) select_list ::= select_item */ + { 449, -3 }, /* (500) select_list ::= select_list NK_COMMA select_item */ + { 457, -1 }, /* (501) select_item ::= NK_STAR */ + { 457, -1 }, /* (502) select_item ::= common_expression */ + { 457, -2 }, /* (503) select_item ::= common_expression column_alias */ + { 457, -3 }, /* (504) select_item ::= common_expression AS column_alias */ + { 457, -3 }, /* (505) select_item ::= table_name NK_DOT NK_STAR */ + { 412, 0 }, /* (506) where_clause_opt ::= */ + { 412, -2 }, /* (507) where_clause_opt ::= WHERE search_condition */ + { 450, 0 }, /* (508) partition_by_clause_opt ::= */ + { 450, -3 }, /* (509) partition_by_clause_opt ::= PARTITION BY partition_list */ + { 458, -1 }, /* (510) partition_list ::= partition_item */ + { 458, -3 }, /* (511) partition_list ::= partition_list NK_COMMA partition_item */ + { 459, -1 }, /* (512) partition_item ::= expr_or_subquery */ + { 459, -2 }, /* (513) partition_item ::= expr_or_subquery column_alias */ + { 459, -3 }, /* (514) partition_item ::= expr_or_subquery AS column_alias */ + { 454, 0 }, /* (515) twindow_clause_opt ::= */ + { 454, -6 }, /* (516) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ + { 454, -4 }, /* (517) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ + { 454, -6 }, /* (518) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ + { 454, -8 }, /* (519) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ + { 454, -7 }, /* (520) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ + { 393, 0 }, /* (521) sliding_opt ::= */ + { 393, -4 }, /* (522) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ + { 453, 0 }, /* (523) fill_opt ::= */ + { 453, -4 }, /* (524) fill_opt ::= FILL NK_LP fill_mode NK_RP */ + { 453, -6 }, /* (525) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ + { 453, -6 }, /* (526) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA literal_list NK_RP */ + { 460, -1 }, /* (527) fill_mode ::= NONE */ + { 460, -1 }, /* (528) fill_mode ::= PREV */ + { 460, -1 }, /* (529) fill_mode ::= NULL */ + { 460, -1 }, /* (530) fill_mode ::= NULL_F */ + { 460, -1 }, /* (531) fill_mode ::= LINEAR */ + { 460, -1 }, /* (532) fill_mode ::= NEXT */ + { 455, 0 }, /* (533) group_by_clause_opt ::= */ + { 455, -3 }, /* (534) group_by_clause_opt ::= GROUP BY group_by_list */ + { 461, -1 }, /* (535) group_by_list ::= expr_or_subquery */ + { 461, -3 }, /* (536) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ + { 456, 0 }, /* (537) having_clause_opt ::= */ + { 456, -2 }, /* (538) having_clause_opt ::= HAVING search_condition */ + { 451, 0 }, /* (539) range_opt ::= */ + { 451, -6 }, /* (540) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ + { 452, 0 }, /* (541) every_opt ::= */ + { 452, -4 }, /* (542) every_opt ::= EVERY NK_LP duration_literal NK_RP */ + { 462, -4 }, /* (543) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ + { 463, -1 }, /* (544) query_simple ::= query_specification */ + { 463, -1 }, /* (545) query_simple ::= union_query_expression */ + { 467, -4 }, /* (546) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ + { 467, -3 }, /* (547) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ + { 468, -1 }, /* (548) query_simple_or_subquery ::= query_simple */ + { 468, -1 }, /* (549) query_simple_or_subquery ::= subquery */ + { 397, -1 }, /* (550) query_or_subquery ::= query_expression */ + { 397, -1 }, /* (551) query_or_subquery ::= subquery */ + { 464, 0 }, /* (552) order_by_clause_opt ::= */ + { 464, -3 }, /* (553) order_by_clause_opt ::= ORDER BY sort_specification_list */ + { 465, 0 }, /* (554) slimit_clause_opt ::= */ + { 465, -2 }, /* (555) slimit_clause_opt ::= SLIMIT NK_INTEGER */ + { 465, -4 }, /* (556) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + { 465, -4 }, /* (557) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + { 466, 0 }, /* (558) limit_clause_opt ::= */ + { 466, -2 }, /* (559) limit_clause_opt ::= LIMIT NK_INTEGER */ + { 466, -4 }, /* (560) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ + { 466, -4 }, /* (561) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + { 443, -3 }, /* (562) subquery ::= NK_LP query_expression NK_RP */ + { 443, -3 }, /* (563) subquery ::= NK_LP subquery NK_RP */ + { 446, -1 }, /* (564) search_condition ::= common_expression */ + { 469, -1 }, /* (565) sort_specification_list ::= sort_specification */ + { 469, -3 }, /* (566) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ + { 470, -3 }, /* (567) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ + { 471, 0 }, /* (568) ordering_specification_opt ::= */ + { 471, -1 }, /* (569) ordering_specification_opt ::= ASC */ + { 471, -1 }, /* (570) ordering_specification_opt ::= DESC */ + { 472, 0 }, /* (571) null_ordering_opt ::= */ + { 472, -2 }, /* (572) null_ordering_opt ::= NULLS FIRST */ + { 472, -2 }, /* (573) null_ordering_opt ::= NULLS LAST */ }; static void yy_accept(yyParser*); /* Forward Declaration */ @@ -3828,78 +3802,78 @@ static YYACTIONTYPE yy_reduce( yy_destructor(yypParser,332,&yymsp[0].minor); break; case 24: /* cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt */ -{ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-3].minor.yy881, &yymsp[-1].minor.yy0, yymsp[0].minor.yy857); } +{ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-3].minor.yy63, &yymsp[-1].minor.yy0, yymsp[0].minor.yy707); } break; case 25: /* cmd ::= ALTER USER user_name PASS NK_STRING */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy881, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy63, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); } break; case 26: /* cmd ::= ALTER USER user_name ENABLE NK_INTEGER */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy881, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy63, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); } break; case 27: /* cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy881, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy63, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); } break; case 28: /* cmd ::= DROP USER user_name */ -{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy881); } +{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy63); } break; case 29: /* sysinfo_opt ::= */ -{ yymsp[1].minor.yy857 = 1; } +{ yymsp[1].minor.yy707 = 1; } break; case 30: /* sysinfo_opt ::= SYSINFO NK_INTEGER */ -{ yymsp[-1].minor.yy857 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); } +{ yymsp[-1].minor.yy707 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); } break; case 31: /* cmd ::= GRANT privileges ON priv_level TO user_name */ -{ pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-4].minor.yy303, &yymsp[-2].minor.yy881, &yymsp[0].minor.yy881); } +{ pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-4].minor.yy393, &yymsp[-2].minor.yy63, &yymsp[0].minor.yy63); } break; case 32: /* cmd ::= REVOKE privileges ON priv_level FROM user_name */ -{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-4].minor.yy303, &yymsp[-2].minor.yy881, &yymsp[0].minor.yy881); } +{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-4].minor.yy393, &yymsp[-2].minor.yy63, &yymsp[0].minor.yy63); } break; case 33: /* privileges ::= ALL */ -{ yymsp[0].minor.yy303 = PRIVILEGE_TYPE_ALL; } +{ yymsp[0].minor.yy393 = PRIVILEGE_TYPE_ALL; } break; case 34: /* privileges ::= priv_type_list */ case 36: /* priv_type_list ::= priv_type */ yytestcase(yyruleno==36); -{ yylhsminor.yy303 = yymsp[0].minor.yy303; } - yymsp[0].minor.yy303 = yylhsminor.yy303; +{ yylhsminor.yy393 = yymsp[0].minor.yy393; } + yymsp[0].minor.yy393 = yylhsminor.yy393; break; case 35: /* privileges ::= SUBSCRIBE */ -{ yymsp[0].minor.yy303 = PRIVILEGE_TYPE_SUBSCRIBE; } +{ yymsp[0].minor.yy393 = PRIVILEGE_TYPE_SUBSCRIBE; } break; case 37: /* priv_type_list ::= priv_type_list NK_COMMA priv_type */ -{ yylhsminor.yy303 = yymsp[-2].minor.yy303 | yymsp[0].minor.yy303; } - yymsp[-2].minor.yy303 = yylhsminor.yy303; +{ yylhsminor.yy393 = yymsp[-2].minor.yy393 | yymsp[0].minor.yy393; } + yymsp[-2].minor.yy393 = yylhsminor.yy393; break; case 38: /* priv_type ::= READ */ -{ yymsp[0].minor.yy303 = PRIVILEGE_TYPE_READ; } +{ yymsp[0].minor.yy393 = PRIVILEGE_TYPE_READ; } break; case 39: /* priv_type ::= WRITE */ -{ yymsp[0].minor.yy303 = PRIVILEGE_TYPE_WRITE; } +{ yymsp[0].minor.yy393 = PRIVILEGE_TYPE_WRITE; } break; case 40: /* priv_level ::= NK_STAR NK_DOT NK_STAR */ -{ yylhsminor.yy881 = yymsp[-2].minor.yy0; } - yymsp[-2].minor.yy881 = yylhsminor.yy881; +{ yylhsminor.yy63 = yymsp[-2].minor.yy0; } + yymsp[-2].minor.yy63 = yylhsminor.yy63; break; case 41: /* priv_level ::= db_name NK_DOT NK_STAR */ -{ yylhsminor.yy881 = yymsp[-2].minor.yy881; } - yymsp[-2].minor.yy881 = yylhsminor.yy881; +{ yylhsminor.yy63 = yymsp[-2].minor.yy63; } + yymsp[-2].minor.yy63 = yylhsminor.yy63; break; case 42: /* priv_level ::= topic_name */ - case 273: /* sma_func_name ::= function_name */ yytestcase(yyruleno==273); - case 479: /* alias_opt ::= table_alias */ yytestcase(yyruleno==479); -{ yylhsminor.yy881 = yymsp[0].minor.yy881; } - yymsp[0].minor.yy881 = yylhsminor.yy881; + case 282: /* sma_func_name ::= function_name */ yytestcase(yyruleno==282); + case 488: /* alias_opt ::= table_alias */ yytestcase(yyruleno==488); +{ yylhsminor.yy63 = yymsp[0].minor.yy63; } + yymsp[0].minor.yy63 = yylhsminor.yy63; break; case 43: /* cmd ::= CREATE DNODE dnode_endpoint */ -{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy881, NULL); } +{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy63, NULL); } break; case 44: /* cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ -{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy881, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy63, &yymsp[0].minor.yy0); } break; case 45: /* cmd ::= DROP DNODE NK_INTEGER force_opt */ -{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy587); } +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy669); } break; case 46: /* cmd ::= DROP DNODE dnode_endpoint force_opt */ -{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy881, yymsp[0].minor.yy587); } +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy63, yymsp[0].minor.yy669); } break; case 47: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ { pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, NULL); } @@ -3916,50 +3890,50 @@ static YYACTIONTYPE yy_reduce( case 51: /* dnode_endpoint ::= NK_STRING */ case 52: /* dnode_endpoint ::= NK_ID */ yytestcase(yyruleno==52); case 53: /* dnode_endpoint ::= NK_IPTOKEN */ yytestcase(yyruleno==53); - case 274: /* sma_func_name ::= COUNT */ yytestcase(yyruleno==274); - case 275: /* sma_func_name ::= FIRST */ yytestcase(yyruleno==275); - case 276: /* sma_func_name ::= LAST */ yytestcase(yyruleno==276); - case 277: /* sma_func_name ::= LAST_ROW */ yytestcase(yyruleno==277); - case 364: /* db_name ::= NK_ID */ yytestcase(yyruleno==364); - case 365: /* table_name ::= NK_ID */ yytestcase(yyruleno==365); - case 366: /* column_name ::= NK_ID */ yytestcase(yyruleno==366); - case 367: /* function_name ::= NK_ID */ yytestcase(yyruleno==367); - case 368: /* table_alias ::= NK_ID */ yytestcase(yyruleno==368); - case 369: /* column_alias ::= NK_ID */ yytestcase(yyruleno==369); - case 370: /* user_name ::= NK_ID */ yytestcase(yyruleno==370); - case 371: /* topic_name ::= NK_ID */ yytestcase(yyruleno==371); - case 372: /* stream_name ::= NK_ID */ yytestcase(yyruleno==372); - case 373: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==373); - case 374: /* index_name ::= NK_ID */ yytestcase(yyruleno==374); - case 414: /* noarg_func ::= NOW */ yytestcase(yyruleno==414); - case 415: /* noarg_func ::= TODAY */ yytestcase(yyruleno==415); - case 416: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==416); - case 417: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==417); - case 418: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==418); - case 419: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==419); - case 420: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==420); - case 421: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==421); - case 422: /* noarg_func ::= USER */ yytestcase(yyruleno==422); - case 423: /* star_func ::= COUNT */ yytestcase(yyruleno==423); - case 424: /* star_func ::= FIRST */ yytestcase(yyruleno==424); - case 425: /* star_func ::= LAST */ yytestcase(yyruleno==425); - case 426: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==426); -{ yylhsminor.yy881 = yymsp[0].minor.yy0; } - yymsp[0].minor.yy881 = yylhsminor.yy881; + case 283: /* sma_func_name ::= COUNT */ yytestcase(yyruleno==283); + case 284: /* sma_func_name ::= FIRST */ yytestcase(yyruleno==284); + case 285: /* sma_func_name ::= LAST */ yytestcase(yyruleno==285); + case 286: /* sma_func_name ::= LAST_ROW */ yytestcase(yyruleno==286); + case 373: /* db_name ::= NK_ID */ yytestcase(yyruleno==373); + case 374: /* table_name ::= NK_ID */ yytestcase(yyruleno==374); + case 375: /* column_name ::= NK_ID */ yytestcase(yyruleno==375); + case 376: /* function_name ::= NK_ID */ yytestcase(yyruleno==376); + case 377: /* table_alias ::= NK_ID */ yytestcase(yyruleno==377); + case 378: /* column_alias ::= NK_ID */ yytestcase(yyruleno==378); + case 379: /* user_name ::= NK_ID */ yytestcase(yyruleno==379); + case 380: /* topic_name ::= NK_ID */ yytestcase(yyruleno==380); + case 381: /* stream_name ::= NK_ID */ yytestcase(yyruleno==381); + case 382: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==382); + case 383: /* index_name ::= NK_ID */ yytestcase(yyruleno==383); + case 423: /* noarg_func ::= NOW */ yytestcase(yyruleno==423); + case 424: /* noarg_func ::= TODAY */ yytestcase(yyruleno==424); + case 425: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==425); + case 426: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==426); + case 427: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==427); + case 428: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==428); + case 429: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==429); + case 430: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==430); + case 431: /* noarg_func ::= USER */ yytestcase(yyruleno==431); + case 432: /* star_func ::= COUNT */ yytestcase(yyruleno==432); + case 433: /* star_func ::= FIRST */ yytestcase(yyruleno==433); + case 434: /* star_func ::= LAST */ yytestcase(yyruleno==434); + case 435: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==435); +{ yylhsminor.yy63 = yymsp[0].minor.yy0; } + yymsp[0].minor.yy63 = yylhsminor.yy63; break; case 54: /* force_opt ::= */ case 74: /* not_exists_opt ::= */ yytestcase(yyruleno==74); case 76: /* exists_opt ::= */ yytestcase(yyruleno==76); - case 294: /* analyze_opt ::= */ yytestcase(yyruleno==294); - case 301: /* agg_func_opt ::= */ yytestcase(yyruleno==301); - case 487: /* set_quantifier_opt ::= */ yytestcase(yyruleno==487); -{ yymsp[1].minor.yy587 = false; } + case 303: /* analyze_opt ::= */ yytestcase(yyruleno==303); + case 310: /* agg_func_opt ::= */ yytestcase(yyruleno==310); + case 496: /* set_quantifier_opt ::= */ yytestcase(yyruleno==496); +{ yymsp[1].minor.yy669 = false; } break; case 55: /* force_opt ::= FORCE */ - case 295: /* analyze_opt ::= ANALYZE */ yytestcase(yyruleno==295); - case 302: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==302); - case 488: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==488); -{ yymsp[0].minor.yy587 = true; } + case 304: /* analyze_opt ::= ANALYZE */ yytestcase(yyruleno==304); + case 311: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==311); + case 497: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==497); +{ yymsp[0].minor.yy669 = true; } break; case 56: /* cmd ::= ALTER LOCAL NK_STRING */ { pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[0].minor.yy0, NULL); } @@ -3992,1383 +3966,1403 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_MNODE_STMT, &yymsp[0].minor.yy0); } break; case 66: /* cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ -{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy587, &yymsp[-1].minor.yy881, yymsp[0].minor.yy140); } +{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy669, &yymsp[-1].minor.yy63, yymsp[0].minor.yy828); } break; case 67: /* cmd ::= DROP DATABASE exists_opt db_name */ -{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy587, &yymsp[0].minor.yy881); } +{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy669, &yymsp[0].minor.yy63); } break; case 68: /* cmd ::= USE db_name */ -{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy881); } +{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy63); } break; case 69: /* cmd ::= ALTER DATABASE db_name alter_db_options */ -{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy881, yymsp[0].minor.yy140); } +{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy63, yymsp[0].minor.yy828); } break; case 70: /* cmd ::= FLUSH DATABASE db_name */ -{ pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy881); } +{ pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy63); } break; case 71: /* cmd ::= TRIM DATABASE db_name speed_opt */ -{ pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[-1].minor.yy881, yymsp[0].minor.yy214); } +{ pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[-1].minor.yy63, yymsp[0].minor.yy332); } break; - case 72: /* cmd ::= COMPACT DATABASE db_name */ -{ pCxt->pRootNode = createCompactStmt(pCxt, &yymsp[0].minor.yy881); } + case 72: /* cmd ::= COMPACT DATABASE db_name start_opt end_opt */ +{ pCxt->pRootNode = createCompactStmt(pCxt, &yymsp[-2].minor.yy63, yymsp[-1].minor.yy828, yymsp[0].minor.yy828); } break; case 73: /* not_exists_opt ::= IF NOT EXISTS */ -{ yymsp[-2].minor.yy587 = true; } +{ yymsp[-2].minor.yy669 = true; } break; case 75: /* exists_opt ::= IF EXISTS */ -{ yymsp[-1].minor.yy587 = true; } +{ yymsp[-1].minor.yy669 = true; } break; case 77: /* db_options ::= */ -{ yymsp[1].minor.yy140 = createDefaultDatabaseOptions(pCxt); } +{ yymsp[1].minor.yy828 = createDefaultDatabaseOptions(pCxt); } break; case 78: /* db_options ::= db_options BUFFER NK_INTEGER */ -{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; +{ yylhsminor.yy828 = setDatabaseOption(pCxt, yymsp[-2].minor.yy828, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; case 79: /* db_options ::= db_options CACHEMODEL NK_STRING */ -{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_CACHEMODEL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; +{ yylhsminor.yy828 = setDatabaseOption(pCxt, yymsp[-2].minor.yy828, DB_OPTION_CACHEMODEL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; case 80: /* db_options ::= db_options CACHESIZE NK_INTEGER */ -{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_CACHESIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; +{ yylhsminor.yy828 = setDatabaseOption(pCxt, yymsp[-2].minor.yy828, DB_OPTION_CACHESIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; case 81: /* db_options ::= db_options COMP NK_INTEGER */ -{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_COMP, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; +{ yylhsminor.yy828 = setDatabaseOption(pCxt, yymsp[-2].minor.yy828, DB_OPTION_COMP, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; case 82: /* db_options ::= db_options DURATION NK_INTEGER */ case 83: /* db_options ::= db_options DURATION NK_VARIABLE */ yytestcase(yyruleno==83); -{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_DAYS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; +{ yylhsminor.yy828 = setDatabaseOption(pCxt, yymsp[-2].minor.yy828, DB_OPTION_DAYS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; case 84: /* db_options ::= db_options MAXROWS NK_INTEGER */ -{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; +{ yylhsminor.yy828 = setDatabaseOption(pCxt, yymsp[-2].minor.yy828, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; case 85: /* db_options ::= db_options MINROWS NK_INTEGER */ -{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; +{ yylhsminor.yy828 = setDatabaseOption(pCxt, yymsp[-2].minor.yy828, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; case 86: /* db_options ::= db_options KEEP integer_list */ case 87: /* db_options ::= db_options KEEP variable_list */ yytestcase(yyruleno==87); -{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_KEEP, yymsp[0].minor.yy220); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; +{ yylhsminor.yy828 = setDatabaseOption(pCxt, yymsp[-2].minor.yy828, DB_OPTION_KEEP, yymsp[0].minor.yy222); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; case 88: /* db_options ::= db_options PAGES NK_INTEGER */ -{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_PAGES, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; +{ yylhsminor.yy828 = setDatabaseOption(pCxt, yymsp[-2].minor.yy828, DB_OPTION_PAGES, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; case 89: /* db_options ::= db_options PAGESIZE NK_INTEGER */ -{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; +{ yylhsminor.yy828 = setDatabaseOption(pCxt, yymsp[-2].minor.yy828, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; case 90: /* db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */ -{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_TSDB_PAGESIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; +{ yylhsminor.yy828 = setDatabaseOption(pCxt, yymsp[-2].minor.yy828, DB_OPTION_TSDB_PAGESIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; case 91: /* db_options ::= db_options PRECISION NK_STRING */ -{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; +{ yylhsminor.yy828 = setDatabaseOption(pCxt, yymsp[-2].minor.yy828, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; case 92: /* db_options ::= db_options REPLICA NK_INTEGER */ -{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; +{ yylhsminor.yy828 = setDatabaseOption(pCxt, yymsp[-2].minor.yy828, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; case 93: /* db_options ::= db_options VGROUPS NK_INTEGER */ -{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; +{ yylhsminor.yy828 = setDatabaseOption(pCxt, yymsp[-2].minor.yy828, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; case 94: /* db_options ::= db_options SINGLE_STABLE NK_INTEGER */ -{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; +{ yylhsminor.yy828 = setDatabaseOption(pCxt, yymsp[-2].minor.yy828, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; case 95: /* db_options ::= db_options RETENTIONS retention_list */ -{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_RETENTIONS, yymsp[0].minor.yy220); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; +{ yylhsminor.yy828 = setDatabaseOption(pCxt, yymsp[-2].minor.yy828, DB_OPTION_RETENTIONS, yymsp[0].minor.yy222); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; case 96: /* db_options ::= db_options SCHEMALESS NK_INTEGER */ -{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; +{ yylhsminor.yy828 = setDatabaseOption(pCxt, yymsp[-2].minor.yy828, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; case 97: /* db_options ::= db_options WAL_LEVEL NK_INTEGER */ -{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_WAL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; +{ yylhsminor.yy828 = setDatabaseOption(pCxt, yymsp[-2].minor.yy828, DB_OPTION_WAL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; case 98: /* db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */ -{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; +{ yylhsminor.yy828 = setDatabaseOption(pCxt, yymsp[-2].minor.yy828, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; case 99: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */ -{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_WAL_RETENTION_PERIOD, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; +{ yylhsminor.yy828 = setDatabaseOption(pCxt, yymsp[-2].minor.yy828, DB_OPTION_WAL_RETENTION_PERIOD, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; case 100: /* 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.yy140 = setDatabaseOption(pCxt, yymsp[-3].minor.yy140, DB_OPTION_WAL_RETENTION_PERIOD, &t); + yylhsminor.yy828 = setDatabaseOption(pCxt, yymsp[-3].minor.yy828, DB_OPTION_WAL_RETENTION_PERIOD, &t); } - yymsp[-3].minor.yy140 = yylhsminor.yy140; + yymsp[-3].minor.yy828 = yylhsminor.yy828; break; case 101: /* db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */ -{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_WAL_RETENTION_SIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; +{ yylhsminor.yy828 = setDatabaseOption(pCxt, yymsp[-2].minor.yy828, DB_OPTION_WAL_RETENTION_SIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; case 102: /* 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.yy140 = setDatabaseOption(pCxt, yymsp[-3].minor.yy140, DB_OPTION_WAL_RETENTION_SIZE, &t); + yylhsminor.yy828 = setDatabaseOption(pCxt, yymsp[-3].minor.yy828, DB_OPTION_WAL_RETENTION_SIZE, &t); } - yymsp[-3].minor.yy140 = yylhsminor.yy140; + yymsp[-3].minor.yy828 = yylhsminor.yy828; break; case 103: /* db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */ -{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_WAL_ROLL_PERIOD, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; +{ yylhsminor.yy828 = setDatabaseOption(pCxt, yymsp[-2].minor.yy828, DB_OPTION_WAL_ROLL_PERIOD, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; case 104: /* db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */ -{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_WAL_SEGMENT_SIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; +{ yylhsminor.yy828 = setDatabaseOption(pCxt, yymsp[-2].minor.yy828, DB_OPTION_WAL_SEGMENT_SIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; case 105: /* db_options ::= db_options STT_TRIGGER NK_INTEGER */ -{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_STT_TRIGGER, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; +{ yylhsminor.yy828 = setDatabaseOption(pCxt, yymsp[-2].minor.yy828, DB_OPTION_STT_TRIGGER, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; case 106: /* db_options ::= db_options TABLE_PREFIX NK_INTEGER */ -{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_TABLE_PREFIX, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; +{ yylhsminor.yy828 = setDatabaseOption(pCxt, yymsp[-2].minor.yy828, DB_OPTION_TABLE_PREFIX, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; case 107: /* db_options ::= db_options TABLE_SUFFIX NK_INTEGER */ -{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_TABLE_SUFFIX, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; +{ yylhsminor.yy828 = setDatabaseOption(pCxt, yymsp[-2].minor.yy828, DB_OPTION_TABLE_SUFFIX, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; case 108: /* alter_db_options ::= alter_db_option */ -{ yylhsminor.yy140 = createAlterDatabaseOptions(pCxt); yylhsminor.yy140 = setAlterDatabaseOption(pCxt, yylhsminor.yy140, &yymsp[0].minor.yy809); } - yymsp[0].minor.yy140 = yylhsminor.yy140; +{ yylhsminor.yy828 = createAlterDatabaseOptions(pCxt); yylhsminor.yy828 = setAlterDatabaseOption(pCxt, yylhsminor.yy828, &yymsp[0].minor.yy233); } + yymsp[0].minor.yy828 = yylhsminor.yy828; break; case 109: /* alter_db_options ::= alter_db_options alter_db_option */ -{ yylhsminor.yy140 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy140, &yymsp[0].minor.yy809); } - yymsp[-1].minor.yy140 = yylhsminor.yy140; +{ yylhsminor.yy828 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy828, &yymsp[0].minor.yy233); } + yymsp[-1].minor.yy828 = yylhsminor.yy828; break; case 110: /* alter_db_option ::= BUFFER NK_INTEGER */ -{ yymsp[-1].minor.yy809.type = DB_OPTION_BUFFER; yymsp[-1].minor.yy809.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy233.type = DB_OPTION_BUFFER; yymsp[-1].minor.yy233.val = yymsp[0].minor.yy0; } break; case 111: /* alter_db_option ::= CACHEMODEL NK_STRING */ -{ yymsp[-1].minor.yy809.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy809.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy233.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy233.val = yymsp[0].minor.yy0; } break; case 112: /* alter_db_option ::= CACHESIZE NK_INTEGER */ -{ yymsp[-1].minor.yy809.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy809.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy233.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy233.val = yymsp[0].minor.yy0; } break; case 113: /* alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */ -{ yymsp[-1].minor.yy809.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy809.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy233.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy233.val = yymsp[0].minor.yy0; } break; case 114: /* alter_db_option ::= KEEP integer_list */ case 115: /* alter_db_option ::= KEEP variable_list */ yytestcase(yyruleno==115); -{ yymsp[-1].minor.yy809.type = DB_OPTION_KEEP; yymsp[-1].minor.yy809.pList = yymsp[0].minor.yy220; } +{ yymsp[-1].minor.yy233.type = DB_OPTION_KEEP; yymsp[-1].minor.yy233.pList = yymsp[0].minor.yy222; } break; case 116: /* alter_db_option ::= PAGES NK_INTEGER */ -{ yymsp[-1].minor.yy809.type = DB_OPTION_PAGES; yymsp[-1].minor.yy809.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy233.type = DB_OPTION_PAGES; yymsp[-1].minor.yy233.val = yymsp[0].minor.yy0; } break; case 117: /* alter_db_option ::= REPLICA NK_INTEGER */ -{ yymsp[-1].minor.yy809.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy809.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy233.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy233.val = yymsp[0].minor.yy0; } break; case 118: /* alter_db_option ::= WAL_LEVEL NK_INTEGER */ -{ yymsp[-1].minor.yy809.type = DB_OPTION_WAL; yymsp[-1].minor.yy809.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy233.type = DB_OPTION_WAL; yymsp[-1].minor.yy233.val = yymsp[0].minor.yy0; } break; case 119: /* alter_db_option ::= STT_TRIGGER NK_INTEGER */ -{ yymsp[-1].minor.yy809.type = DB_OPTION_STT_TRIGGER; yymsp[-1].minor.yy809.val = yymsp[0].minor.yy0; } - break; - case 120: /* integer_list ::= NK_INTEGER */ -{ yylhsminor.yy220 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy220 = yylhsminor.yy220; - break; - case 121: /* integer_list ::= integer_list NK_COMMA NK_INTEGER */ - case 333: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==333); -{ yylhsminor.yy220 = addNodeToList(pCxt, yymsp[-2].minor.yy220, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy220 = yylhsminor.yy220; - break; - case 122: /* variable_list ::= NK_VARIABLE */ -{ yylhsminor.yy220 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy220 = yylhsminor.yy220; - break; - case 123: /* variable_list ::= variable_list NK_COMMA NK_VARIABLE */ -{ yylhsminor.yy220 = addNodeToList(pCxt, yymsp[-2].minor.yy220, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy220 = yylhsminor.yy220; - break; - case 124: /* retention_list ::= retention */ - case 146: /* multi_create_clause ::= create_subtable_clause */ yytestcase(yyruleno==146); - case 149: /* multi_drop_clause ::= drop_table_clause */ yytestcase(yyruleno==149); - case 156: /* column_def_list ::= column_def */ yytestcase(yyruleno==156); - case 200: /* rollup_func_list ::= rollup_func_name */ yytestcase(yyruleno==200); - case 205: /* col_name_list ::= col_name */ yytestcase(yyruleno==205); - case 256: /* tag_list_opt ::= tag_item */ yytestcase(yyruleno==256); - case 270: /* func_list ::= func */ yytestcase(yyruleno==270); - case 362: /* literal_list ::= signed_literal */ yytestcase(yyruleno==362); - case 429: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==429); - case 435: /* when_then_list ::= when_then_expr */ yytestcase(yyruleno==435); - case 490: /* select_list ::= select_item */ yytestcase(yyruleno==490); - case 501: /* partition_list ::= partition_item */ yytestcase(yyruleno==501); - case 556: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==556); -{ yylhsminor.yy220 = createNodeList(pCxt, yymsp[0].minor.yy140); } - yymsp[0].minor.yy220 = yylhsminor.yy220; - break; - case 125: /* retention_list ::= retention_list NK_COMMA retention */ - case 150: /* multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ yytestcase(yyruleno==150); - case 157: /* column_def_list ::= column_def_list NK_COMMA column_def */ yytestcase(yyruleno==157); - case 201: /* rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ yytestcase(yyruleno==201); - case 206: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==206); - case 257: /* tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ yytestcase(yyruleno==257); - case 271: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==271); - case 363: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==363); - case 430: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==430); - case 491: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==491); - case 502: /* partition_list ::= partition_list NK_COMMA partition_item */ yytestcase(yyruleno==502); - case 557: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==557); -{ yylhsminor.yy220 = addNodeToList(pCxt, yymsp[-2].minor.yy220, yymsp[0].minor.yy140); } - yymsp[-2].minor.yy220 = yylhsminor.yy220; - break; - case 126: /* retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ -{ yylhsminor.yy140 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; - break; - case 127: /* speed_opt ::= */ - case 303: /* bufsize_opt ::= */ yytestcase(yyruleno==303); -{ yymsp[1].minor.yy214 = 0; } - break; - case 128: /* speed_opt ::= MAX_SPEED NK_INTEGER */ - case 304: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ yytestcase(yyruleno==304); -{ yymsp[-1].minor.yy214 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); } - break; - case 129: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ - case 131: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==131); -{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy587, yymsp[-5].minor.yy140, yymsp[-3].minor.yy220, yymsp[-1].minor.yy220, yymsp[0].minor.yy140); } - break; - case 130: /* cmd ::= CREATE TABLE multi_create_clause */ -{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy220); } - break; - case 132: /* cmd ::= DROP TABLE multi_drop_clause */ -{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy220); } - break; - case 133: /* cmd ::= DROP STABLE exists_opt full_table_name */ -{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy587, yymsp[0].minor.yy140); } - break; - case 134: /* cmd ::= ALTER TABLE alter_table_clause */ - case 335: /* cmd ::= query_or_subquery */ yytestcase(yyruleno==335); - case 336: /* cmd ::= insert_query */ yytestcase(yyruleno==336); -{ pCxt->pRootNode = yymsp[0].minor.yy140; } - break; - case 135: /* cmd ::= ALTER STABLE alter_table_clause */ -{ pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy140); } - break; - case 136: /* alter_table_clause ::= full_table_name alter_table_options */ -{ yylhsminor.yy140 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy140, yymsp[0].minor.yy140); } - yymsp[-1].minor.yy140 = yylhsminor.yy140; - break; - case 137: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ -{ yylhsminor.yy140 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy140, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy881, yymsp[0].minor.yy682); } - yymsp[-4].minor.yy140 = yylhsminor.yy140; - break; - case 138: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */ -{ yylhsminor.yy140 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy140, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy881); } - yymsp[-3].minor.yy140 = yylhsminor.yy140; - break; - case 139: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ -{ yylhsminor.yy140 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy140, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy881, yymsp[0].minor.yy682); } - yymsp[-4].minor.yy140 = yylhsminor.yy140; - break; - case 140: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ -{ yylhsminor.yy140 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy140, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy881, &yymsp[0].minor.yy881); } - yymsp[-4].minor.yy140 = yylhsminor.yy140; - break; - case 141: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */ -{ yylhsminor.yy140 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy140, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy881, yymsp[0].minor.yy682); } - yymsp[-4].minor.yy140 = yylhsminor.yy140; - break; - case 142: /* alter_table_clause ::= full_table_name DROP TAG column_name */ -{ yylhsminor.yy140 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy140, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy881); } - yymsp[-3].minor.yy140 = yylhsminor.yy140; - break; - case 143: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ -{ yylhsminor.yy140 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy140, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy881, yymsp[0].minor.yy682); } - yymsp[-4].minor.yy140 = yylhsminor.yy140; - break; - case 144: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ -{ yylhsminor.yy140 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy140, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy881, &yymsp[0].minor.yy881); } - yymsp[-4].minor.yy140 = yylhsminor.yy140; - break; - case 145: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ -{ yylhsminor.yy140 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy140, &yymsp[-2].minor.yy881, yymsp[0].minor.yy140); } - yymsp[-5].minor.yy140 = yylhsminor.yy140; - break; - case 147: /* multi_create_clause ::= multi_create_clause create_subtable_clause */ - case 436: /* when_then_list ::= when_then_list when_then_expr */ yytestcase(yyruleno==436); -{ yylhsminor.yy220 = addNodeToList(pCxt, yymsp[-1].minor.yy220, yymsp[0].minor.yy140); } - yymsp[-1].minor.yy220 = yylhsminor.yy220; +{ yymsp[-1].minor.yy233.type = DB_OPTION_STT_TRIGGER; yymsp[-1].minor.yy233.val = yymsp[0].minor.yy0; } + break; + case 120: /* alter_db_option ::= MINROWS NK_INTEGER */ +{ yymsp[-1].minor.yy233.type = DB_OPTION_MINROWS; yymsp[-1].minor.yy233.val = yymsp[0].minor.yy0; } + break; + case 121: /* integer_list ::= NK_INTEGER */ +{ yylhsminor.yy222 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy222 = yylhsminor.yy222; + break; + case 122: /* integer_list ::= integer_list NK_COMMA NK_INTEGER */ + case 342: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==342); +{ yylhsminor.yy222 = addNodeToList(pCxt, yymsp[-2].minor.yy222, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy222 = yylhsminor.yy222; + break; + case 123: /* variable_list ::= NK_VARIABLE */ +{ yylhsminor.yy222 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy222 = yylhsminor.yy222; + break; + case 124: /* variable_list ::= variable_list NK_COMMA NK_VARIABLE */ +{ yylhsminor.yy222 = addNodeToList(pCxt, yymsp[-2].minor.yy222, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy222 = yylhsminor.yy222; + break; + case 125: /* retention_list ::= retention */ + case 155: /* multi_create_clause ::= create_subtable_clause */ yytestcase(yyruleno==155); + case 158: /* multi_drop_clause ::= drop_table_clause */ yytestcase(yyruleno==158); + case 165: /* column_def_list ::= column_def */ yytestcase(yyruleno==165); + case 209: /* rollup_func_list ::= rollup_func_name */ yytestcase(yyruleno==209); + case 214: /* col_name_list ::= col_name */ yytestcase(yyruleno==214); + case 265: /* tag_list_opt ::= tag_item */ yytestcase(yyruleno==265); + case 279: /* func_list ::= func */ yytestcase(yyruleno==279); + case 371: /* literal_list ::= signed_literal */ yytestcase(yyruleno==371); + case 438: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==438); + case 444: /* when_then_list ::= when_then_expr */ yytestcase(yyruleno==444); + case 499: /* select_list ::= select_item */ yytestcase(yyruleno==499); + case 510: /* partition_list ::= partition_item */ yytestcase(yyruleno==510); + case 565: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==565); +{ yylhsminor.yy222 = createNodeList(pCxt, yymsp[0].minor.yy828); } + yymsp[0].minor.yy222 = yylhsminor.yy222; + break; + case 126: /* retention_list ::= retention_list NK_COMMA retention */ + case 159: /* multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ yytestcase(yyruleno==159); + case 166: /* column_def_list ::= column_def_list NK_COMMA column_def */ yytestcase(yyruleno==166); + case 210: /* rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ yytestcase(yyruleno==210); + case 215: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==215); + case 266: /* tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ yytestcase(yyruleno==266); + case 280: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==280); + case 372: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==372); + case 439: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==439); + case 500: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==500); + case 511: /* partition_list ::= partition_list NK_COMMA partition_item */ yytestcase(yyruleno==511); + case 566: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==566); +{ yylhsminor.yy222 = addNodeToList(pCxt, yymsp[-2].minor.yy222, yymsp[0].minor.yy828); } + yymsp[-2].minor.yy222 = yylhsminor.yy222; + break; + case 127: /* retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ +{ yylhsminor.yy828 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; + break; + case 128: /* speed_opt ::= */ + case 312: /* bufsize_opt ::= */ yytestcase(yyruleno==312); +{ yymsp[1].minor.yy332 = 0; } + break; + case 129: /* speed_opt ::= MAX_SPEED NK_INTEGER */ + case 313: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ yytestcase(yyruleno==313); +{ yymsp[-1].minor.yy332 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); } + break; + case 130: /* start_opt ::= */ + case 134: /* end_opt ::= */ yytestcase(yyruleno==134); + case 259: /* like_pattern_opt ::= */ yytestcase(yyruleno==259); + case 332: /* subtable_opt ::= */ yytestcase(yyruleno==332); + case 447: /* case_when_else_opt ::= */ yytestcase(yyruleno==447); + case 477: /* from_clause_opt ::= */ yytestcase(yyruleno==477); + case 506: /* where_clause_opt ::= */ yytestcase(yyruleno==506); + case 515: /* twindow_clause_opt ::= */ yytestcase(yyruleno==515); + case 521: /* sliding_opt ::= */ yytestcase(yyruleno==521); + case 523: /* fill_opt ::= */ yytestcase(yyruleno==523); + case 537: /* having_clause_opt ::= */ yytestcase(yyruleno==537); + case 539: /* range_opt ::= */ yytestcase(yyruleno==539); + case 541: /* every_opt ::= */ yytestcase(yyruleno==541); + case 554: /* slimit_clause_opt ::= */ yytestcase(yyruleno==554); + case 558: /* limit_clause_opt ::= */ yytestcase(yyruleno==558); +{ yymsp[1].minor.yy828 = NULL; } + break; + case 131: /* start_opt ::= START WITH NK_INTEGER */ + case 135: /* end_opt ::= END WITH NK_INTEGER */ yytestcase(yyruleno==135); +{ yymsp[-2].minor.yy828 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } + break; + case 132: /* start_opt ::= START WITH NK_STRING */ + case 136: /* end_opt ::= END WITH NK_STRING */ yytestcase(yyruleno==136); +{ yymsp[-2].minor.yy828 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } + break; + case 133: /* start_opt ::= START WITH TIMESTAMP NK_STRING */ + case 137: /* end_opt ::= END WITH TIMESTAMP NK_STRING */ yytestcase(yyruleno==137); +{ yymsp[-3].minor.yy828 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } + break; + case 138: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ + case 140: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==140); +{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy669, yymsp[-5].minor.yy828, yymsp[-3].minor.yy222, yymsp[-1].minor.yy222, yymsp[0].minor.yy828); } + break; + case 139: /* cmd ::= CREATE TABLE multi_create_clause */ +{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy222); } + break; + case 141: /* cmd ::= DROP TABLE multi_drop_clause */ +{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy222); } + break; + case 142: /* cmd ::= DROP STABLE exists_opt full_table_name */ +{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy669, yymsp[0].minor.yy828); } + break; + case 143: /* cmd ::= ALTER TABLE alter_table_clause */ + case 344: /* cmd ::= query_or_subquery */ yytestcase(yyruleno==344); + case 345: /* cmd ::= insert_query */ yytestcase(yyruleno==345); +{ pCxt->pRootNode = yymsp[0].minor.yy828; } + break; + case 144: /* cmd ::= ALTER STABLE alter_table_clause */ +{ pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy828); } + break; + case 145: /* alter_table_clause ::= full_table_name alter_table_options */ +{ yylhsminor.yy828 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy828, yymsp[0].minor.yy828); } + yymsp[-1].minor.yy828 = yylhsminor.yy828; + break; + case 146: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ +{ yylhsminor.yy828 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy828, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy63, yymsp[0].minor.yy686); } + yymsp[-4].minor.yy828 = yylhsminor.yy828; + break; + case 147: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */ +{ yylhsminor.yy828 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy828, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy63); } + yymsp[-3].minor.yy828 = yylhsminor.yy828; + break; + case 148: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ +{ yylhsminor.yy828 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy828, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy63, yymsp[0].minor.yy686); } + yymsp[-4].minor.yy828 = yylhsminor.yy828; + break; + case 149: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ +{ yylhsminor.yy828 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy828, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy63, &yymsp[0].minor.yy63); } + yymsp[-4].minor.yy828 = yylhsminor.yy828; + break; + case 150: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */ +{ yylhsminor.yy828 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy828, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy63, yymsp[0].minor.yy686); } + yymsp[-4].minor.yy828 = yylhsminor.yy828; + break; + case 151: /* alter_table_clause ::= full_table_name DROP TAG column_name */ +{ yylhsminor.yy828 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy828, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy63); } + yymsp[-3].minor.yy828 = yylhsminor.yy828; + break; + case 152: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ +{ yylhsminor.yy828 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy828, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy63, yymsp[0].minor.yy686); } + yymsp[-4].minor.yy828 = yylhsminor.yy828; + break; + case 153: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ +{ yylhsminor.yy828 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy828, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy63, &yymsp[0].minor.yy63); } + yymsp[-4].minor.yy828 = yylhsminor.yy828; + break; + case 154: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ +{ yylhsminor.yy828 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy828, &yymsp[-2].minor.yy63, yymsp[0].minor.yy828); } + yymsp[-5].minor.yy828 = yylhsminor.yy828; break; - case 148: /* 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.yy140 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy587, yymsp[-8].minor.yy140, yymsp[-6].minor.yy140, yymsp[-5].minor.yy220, yymsp[-2].minor.yy220, yymsp[0].minor.yy140); } - yymsp[-9].minor.yy140 = yylhsminor.yy140; + case 156: /* multi_create_clause ::= multi_create_clause create_subtable_clause */ + case 445: /* when_then_list ::= when_then_list when_then_expr */ yytestcase(yyruleno==445); +{ yylhsminor.yy222 = addNodeToList(pCxt, yymsp[-1].minor.yy222, yymsp[0].minor.yy828); } + yymsp[-1].minor.yy222 = yylhsminor.yy222; break; - case 151: /* drop_table_clause ::= exists_opt full_table_name */ -{ yylhsminor.yy140 = createDropTableClause(pCxt, yymsp[-1].minor.yy587, yymsp[0].minor.yy140); } - yymsp[-1].minor.yy140 = yylhsminor.yy140; + case 157: /* 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.yy828 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy669, yymsp[-8].minor.yy828, yymsp[-6].minor.yy828, yymsp[-5].minor.yy222, yymsp[-2].minor.yy222, yymsp[0].minor.yy828); } + yymsp[-9].minor.yy828 = yylhsminor.yy828; break; - case 152: /* specific_cols_opt ::= */ - case 183: /* tags_def_opt ::= */ yytestcase(yyruleno==183); - case 255: /* tag_list_opt ::= */ yytestcase(yyruleno==255); - case 309: /* col_list_opt ::= */ yytestcase(yyruleno==309); - case 311: /* tag_def_or_ref_opt ::= */ yytestcase(yyruleno==311); - case 499: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==499); - case 524: /* group_by_clause_opt ::= */ yytestcase(yyruleno==524); - case 543: /* order_by_clause_opt ::= */ yytestcase(yyruleno==543); -{ yymsp[1].minor.yy220 = NULL; } + case 160: /* drop_table_clause ::= exists_opt full_table_name */ +{ yylhsminor.yy828 = createDropTableClause(pCxt, yymsp[-1].minor.yy669, yymsp[0].minor.yy828); } + yymsp[-1].minor.yy828 = yylhsminor.yy828; break; - case 153: /* specific_cols_opt ::= NK_LP col_name_list NK_RP */ - case 310: /* col_list_opt ::= NK_LP col_name_list NK_RP */ yytestcase(yyruleno==310); -{ yymsp[-2].minor.yy220 = yymsp[-1].minor.yy220; } + case 161: /* specific_cols_opt ::= */ + case 192: /* tags_def_opt ::= */ yytestcase(yyruleno==192); + case 264: /* tag_list_opt ::= */ yytestcase(yyruleno==264); + case 318: /* col_list_opt ::= */ yytestcase(yyruleno==318); + case 320: /* tag_def_or_ref_opt ::= */ yytestcase(yyruleno==320); + case 508: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==508); + case 533: /* group_by_clause_opt ::= */ yytestcase(yyruleno==533); + case 552: /* order_by_clause_opt ::= */ yytestcase(yyruleno==552); +{ yymsp[1].minor.yy222 = NULL; } break; - case 154: /* full_table_name ::= table_name */ -{ yylhsminor.yy140 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy881, NULL); } - yymsp[0].minor.yy140 = yylhsminor.yy140; + case 162: /* specific_cols_opt ::= NK_LP col_name_list NK_RP */ + case 319: /* col_list_opt ::= NK_LP col_name_list NK_RP */ yytestcase(yyruleno==319); +{ yymsp[-2].minor.yy222 = yymsp[-1].minor.yy222; } break; - case 155: /* full_table_name ::= db_name NK_DOT table_name */ -{ yylhsminor.yy140 = createRealTableNode(pCxt, &yymsp[-2].minor.yy881, &yymsp[0].minor.yy881, NULL); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 163: /* full_table_name ::= table_name */ +{ yylhsminor.yy828 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy63, NULL); } + yymsp[0].minor.yy828 = yylhsminor.yy828; break; - case 158: /* column_def ::= column_name type_name */ -{ yylhsminor.yy140 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy881, yymsp[0].minor.yy682, NULL); } - yymsp[-1].minor.yy140 = yylhsminor.yy140; + case 164: /* full_table_name ::= db_name NK_DOT table_name */ +{ yylhsminor.yy828 = createRealTableNode(pCxt, &yymsp[-2].minor.yy63, &yymsp[0].minor.yy63, NULL); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; - case 159: /* column_def ::= column_name type_name COMMENT NK_STRING */ -{ yylhsminor.yy140 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy881, yymsp[-2].minor.yy682, &yymsp[0].minor.yy0); } - yymsp[-3].minor.yy140 = yylhsminor.yy140; + case 167: /* column_def ::= column_name type_name */ +{ yylhsminor.yy828 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy63, yymsp[0].minor.yy686, NULL); } + yymsp[-1].minor.yy828 = yylhsminor.yy828; break; - case 160: /* type_name ::= BOOL */ -{ yymsp[0].minor.yy682 = createDataType(TSDB_DATA_TYPE_BOOL); } + case 168: /* column_def ::= column_name type_name COMMENT NK_STRING */ +{ yylhsminor.yy828 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy63, yymsp[-2].minor.yy686, &yymsp[0].minor.yy0); } + yymsp[-3].minor.yy828 = yylhsminor.yy828; break; - case 161: /* type_name ::= TINYINT */ -{ yymsp[0].minor.yy682 = createDataType(TSDB_DATA_TYPE_TINYINT); } + case 169: /* type_name ::= BOOL */ +{ yymsp[0].minor.yy686 = createDataType(TSDB_DATA_TYPE_BOOL); } break; - case 162: /* type_name ::= SMALLINT */ -{ yymsp[0].minor.yy682 = createDataType(TSDB_DATA_TYPE_SMALLINT); } + case 170: /* type_name ::= TINYINT */ +{ yymsp[0].minor.yy686 = createDataType(TSDB_DATA_TYPE_TINYINT); } break; - case 163: /* type_name ::= INT */ - case 164: /* type_name ::= INTEGER */ yytestcase(yyruleno==164); -{ yymsp[0].minor.yy682 = createDataType(TSDB_DATA_TYPE_INT); } + case 171: /* type_name ::= SMALLINT */ +{ yymsp[0].minor.yy686 = createDataType(TSDB_DATA_TYPE_SMALLINT); } break; - case 165: /* type_name ::= BIGINT */ -{ yymsp[0].minor.yy682 = createDataType(TSDB_DATA_TYPE_BIGINT); } + case 172: /* type_name ::= INT */ + case 173: /* type_name ::= INTEGER */ yytestcase(yyruleno==173); +{ yymsp[0].minor.yy686 = createDataType(TSDB_DATA_TYPE_INT); } break; - case 166: /* type_name ::= FLOAT */ -{ yymsp[0].minor.yy682 = createDataType(TSDB_DATA_TYPE_FLOAT); } + case 174: /* type_name ::= BIGINT */ +{ yymsp[0].minor.yy686 = createDataType(TSDB_DATA_TYPE_BIGINT); } break; - case 167: /* type_name ::= DOUBLE */ -{ yymsp[0].minor.yy682 = createDataType(TSDB_DATA_TYPE_DOUBLE); } + case 175: /* type_name ::= FLOAT */ +{ yymsp[0].minor.yy686 = createDataType(TSDB_DATA_TYPE_FLOAT); } break; - case 168: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy682 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } + case 176: /* type_name ::= DOUBLE */ +{ yymsp[0].minor.yy686 = createDataType(TSDB_DATA_TYPE_DOUBLE); } break; - case 169: /* type_name ::= TIMESTAMP */ -{ yymsp[0].minor.yy682 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } + case 177: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy686 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } break; - case 170: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy682 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } + case 178: /* type_name ::= TIMESTAMP */ +{ yymsp[0].minor.yy686 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } break; - case 171: /* type_name ::= TINYINT UNSIGNED */ -{ yymsp[-1].minor.yy682 = createDataType(TSDB_DATA_TYPE_UTINYINT); } + case 179: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy686 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } break; - case 172: /* type_name ::= SMALLINT UNSIGNED */ -{ yymsp[-1].minor.yy682 = createDataType(TSDB_DATA_TYPE_USMALLINT); } + case 180: /* type_name ::= TINYINT UNSIGNED */ +{ yymsp[-1].minor.yy686 = createDataType(TSDB_DATA_TYPE_UTINYINT); } break; - case 173: /* type_name ::= INT UNSIGNED */ -{ yymsp[-1].minor.yy682 = createDataType(TSDB_DATA_TYPE_UINT); } + case 181: /* type_name ::= SMALLINT UNSIGNED */ +{ yymsp[-1].minor.yy686 = createDataType(TSDB_DATA_TYPE_USMALLINT); } break; - case 174: /* type_name ::= BIGINT UNSIGNED */ -{ yymsp[-1].minor.yy682 = createDataType(TSDB_DATA_TYPE_UBIGINT); } + case 182: /* type_name ::= INT UNSIGNED */ +{ yymsp[-1].minor.yy686 = createDataType(TSDB_DATA_TYPE_UINT); } break; - case 175: /* type_name ::= JSON */ -{ yymsp[0].minor.yy682 = createDataType(TSDB_DATA_TYPE_JSON); } + case 183: /* type_name ::= BIGINT UNSIGNED */ +{ yymsp[-1].minor.yy686 = createDataType(TSDB_DATA_TYPE_UBIGINT); } break; - case 176: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy682 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } + case 184: /* type_name ::= JSON */ +{ yymsp[0].minor.yy686 = createDataType(TSDB_DATA_TYPE_JSON); } break; - case 177: /* type_name ::= MEDIUMBLOB */ -{ yymsp[0].minor.yy682 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } + case 185: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy686 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } break; - case 178: /* type_name ::= BLOB */ -{ yymsp[0].minor.yy682 = createDataType(TSDB_DATA_TYPE_BLOB); } + case 186: /* type_name ::= MEDIUMBLOB */ +{ yymsp[0].minor.yy686 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } break; - case 179: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy682 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } + case 187: /* type_name ::= BLOB */ +{ yymsp[0].minor.yy686 = createDataType(TSDB_DATA_TYPE_BLOB); } break; - case 180: /* type_name ::= DECIMAL */ -{ yymsp[0].minor.yy682 = createDataType(TSDB_DATA_TYPE_DECIMAL); } + case 188: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy686 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } break; - case 181: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy682 = createDataType(TSDB_DATA_TYPE_DECIMAL); } + case 189: /* type_name ::= DECIMAL */ +{ yymsp[0].minor.yy686 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; - case 182: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ -{ yymsp[-5].minor.yy682 = createDataType(TSDB_DATA_TYPE_DECIMAL); } + case 190: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy686 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; - case 184: /* tags_def_opt ::= tags_def */ - case 312: /* tag_def_or_ref_opt ::= tags_def */ yytestcase(yyruleno==312); - case 428: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==428); -{ yylhsminor.yy220 = yymsp[0].minor.yy220; } - yymsp[0].minor.yy220 = yylhsminor.yy220; + case 191: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ +{ yymsp[-5].minor.yy686 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; - case 185: /* tags_def ::= TAGS NK_LP column_def_list NK_RP */ - case 313: /* tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */ yytestcase(yyruleno==313); -{ yymsp[-3].minor.yy220 = yymsp[-1].minor.yy220; } + case 193: /* tags_def_opt ::= tags_def */ + case 321: /* tag_def_or_ref_opt ::= tags_def */ yytestcase(yyruleno==321); + case 437: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==437); +{ yylhsminor.yy222 = yymsp[0].minor.yy222; } + yymsp[0].minor.yy222 = yylhsminor.yy222; break; - case 186: /* table_options ::= */ -{ yymsp[1].minor.yy140 = createDefaultTableOptions(pCxt); } + case 194: /* tags_def ::= TAGS NK_LP column_def_list NK_RP */ + case 322: /* tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */ yytestcase(yyruleno==322); +{ yymsp[-3].minor.yy222 = yymsp[-1].minor.yy222; } break; - case 187: /* table_options ::= table_options COMMENT NK_STRING */ -{ yylhsminor.yy140 = setTableOption(pCxt, yymsp[-2].minor.yy140, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 195: /* table_options ::= */ +{ yymsp[1].minor.yy828 = createDefaultTableOptions(pCxt); } break; - case 188: /* table_options ::= table_options MAX_DELAY duration_list */ -{ yylhsminor.yy140 = setTableOption(pCxt, yymsp[-2].minor.yy140, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy220); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 196: /* table_options ::= table_options COMMENT NK_STRING */ +{ yylhsminor.yy828 = setTableOption(pCxt, yymsp[-2].minor.yy828, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; - case 189: /* table_options ::= table_options WATERMARK duration_list */ -{ yylhsminor.yy140 = setTableOption(pCxt, yymsp[-2].minor.yy140, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy220); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 197: /* table_options ::= table_options MAX_DELAY duration_list */ +{ yylhsminor.yy828 = setTableOption(pCxt, yymsp[-2].minor.yy828, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy222); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; - case 190: /* table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ -{ yylhsminor.yy140 = setTableOption(pCxt, yymsp[-4].minor.yy140, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy220); } - yymsp[-4].minor.yy140 = yylhsminor.yy140; + case 198: /* table_options ::= table_options WATERMARK duration_list */ +{ yylhsminor.yy828 = setTableOption(pCxt, yymsp[-2].minor.yy828, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy222); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; - case 191: /* table_options ::= table_options TTL NK_INTEGER */ -{ yylhsminor.yy140 = setTableOption(pCxt, yymsp[-2].minor.yy140, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 199: /* table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ +{ yylhsminor.yy828 = setTableOption(pCxt, yymsp[-4].minor.yy828, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy222); } + yymsp[-4].minor.yy828 = yylhsminor.yy828; break; - case 192: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */ -{ yylhsminor.yy140 = setTableOption(pCxt, yymsp[-4].minor.yy140, TABLE_OPTION_SMA, yymsp[-1].minor.yy220); } - yymsp[-4].minor.yy140 = yylhsminor.yy140; + case 200: /* table_options ::= table_options TTL NK_INTEGER */ +{ yylhsminor.yy828 = setTableOption(pCxt, yymsp[-2].minor.yy828, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; - case 193: /* table_options ::= table_options DELETE_MARK duration_list */ -{ yylhsminor.yy140 = setTableOption(pCxt, yymsp[-2].minor.yy140, TABLE_OPTION_DELETE_MARK, yymsp[0].minor.yy220); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 201: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */ +{ yylhsminor.yy828 = setTableOption(pCxt, yymsp[-4].minor.yy828, TABLE_OPTION_SMA, yymsp[-1].minor.yy222); } + yymsp[-4].minor.yy828 = yylhsminor.yy828; break; - case 194: /* alter_table_options ::= alter_table_option */ -{ yylhsminor.yy140 = createAlterTableOptions(pCxt); yylhsminor.yy140 = setTableOption(pCxt, yylhsminor.yy140, yymsp[0].minor.yy809.type, &yymsp[0].minor.yy809.val); } - yymsp[0].minor.yy140 = yylhsminor.yy140; + case 202: /* table_options ::= table_options DELETE_MARK duration_list */ +{ yylhsminor.yy828 = setTableOption(pCxt, yymsp[-2].minor.yy828, TABLE_OPTION_DELETE_MARK, yymsp[0].minor.yy222); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; - case 195: /* alter_table_options ::= alter_table_options alter_table_option */ -{ yylhsminor.yy140 = setTableOption(pCxt, yymsp[-1].minor.yy140, yymsp[0].minor.yy809.type, &yymsp[0].minor.yy809.val); } - yymsp[-1].minor.yy140 = yylhsminor.yy140; + case 203: /* alter_table_options ::= alter_table_option */ +{ yylhsminor.yy828 = createAlterTableOptions(pCxt); yylhsminor.yy828 = setTableOption(pCxt, yylhsminor.yy828, yymsp[0].minor.yy233.type, &yymsp[0].minor.yy233.val); } + yymsp[0].minor.yy828 = yylhsminor.yy828; break; - case 196: /* alter_table_option ::= COMMENT NK_STRING */ -{ yymsp[-1].minor.yy809.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy809.val = yymsp[0].minor.yy0; } + case 204: /* alter_table_options ::= alter_table_options alter_table_option */ +{ yylhsminor.yy828 = setTableOption(pCxt, yymsp[-1].minor.yy828, yymsp[0].minor.yy233.type, &yymsp[0].minor.yy233.val); } + yymsp[-1].minor.yy828 = yylhsminor.yy828; break; - case 197: /* alter_table_option ::= TTL NK_INTEGER */ -{ yymsp[-1].minor.yy809.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy809.val = yymsp[0].minor.yy0; } + case 205: /* alter_table_option ::= COMMENT NK_STRING */ +{ yymsp[-1].minor.yy233.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy233.val = yymsp[0].minor.yy0; } break; - case 198: /* duration_list ::= duration_literal */ - case 392: /* expression_list ::= expr_or_subquery */ yytestcase(yyruleno==392); -{ yylhsminor.yy220 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy140)); } - yymsp[0].minor.yy220 = yylhsminor.yy220; + case 206: /* alter_table_option ::= TTL NK_INTEGER */ +{ yymsp[-1].minor.yy233.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy233.val = yymsp[0].minor.yy0; } break; - case 199: /* duration_list ::= duration_list NK_COMMA duration_literal */ - case 393: /* expression_list ::= expression_list NK_COMMA expr_or_subquery */ yytestcase(yyruleno==393); -{ yylhsminor.yy220 = addNodeToList(pCxt, yymsp[-2].minor.yy220, releaseRawExprNode(pCxt, yymsp[0].minor.yy140)); } - yymsp[-2].minor.yy220 = yylhsminor.yy220; + case 207: /* duration_list ::= duration_literal */ + case 401: /* expression_list ::= expr_or_subquery */ yytestcase(yyruleno==401); +{ yylhsminor.yy222 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy828)); } + yymsp[0].minor.yy222 = yylhsminor.yy222; break; - case 202: /* rollup_func_name ::= function_name */ -{ yylhsminor.yy140 = createFunctionNode(pCxt, &yymsp[0].minor.yy881, NULL); } - yymsp[0].minor.yy140 = yylhsminor.yy140; + case 208: /* duration_list ::= duration_list NK_COMMA duration_literal */ + case 402: /* expression_list ::= expression_list NK_COMMA expr_or_subquery */ yytestcase(yyruleno==402); +{ yylhsminor.yy222 = addNodeToList(pCxt, yymsp[-2].minor.yy222, releaseRawExprNode(pCxt, yymsp[0].minor.yy828)); } + yymsp[-2].minor.yy222 = yylhsminor.yy222; break; - case 203: /* rollup_func_name ::= FIRST */ - case 204: /* rollup_func_name ::= LAST */ yytestcase(yyruleno==204); - case 259: /* tag_item ::= QTAGS */ yytestcase(yyruleno==259); -{ yylhsminor.yy140 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); } - yymsp[0].minor.yy140 = yylhsminor.yy140; + case 211: /* rollup_func_name ::= function_name */ +{ yylhsminor.yy828 = createFunctionNode(pCxt, &yymsp[0].minor.yy63, NULL); } + yymsp[0].minor.yy828 = yylhsminor.yy828; break; - case 207: /* col_name ::= column_name */ - case 260: /* tag_item ::= column_name */ yytestcase(yyruleno==260); -{ yylhsminor.yy140 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy881); } - yymsp[0].minor.yy140 = yylhsminor.yy140; + case 212: /* rollup_func_name ::= FIRST */ + case 213: /* rollup_func_name ::= LAST */ yytestcase(yyruleno==213); + case 268: /* tag_item ::= QTAGS */ yytestcase(yyruleno==268); +{ yylhsminor.yy828 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); } + yymsp[0].minor.yy828 = yylhsminor.yy828; break; - case 208: /* cmd ::= SHOW DNODES */ + case 216: /* col_name ::= column_name */ + case 269: /* tag_item ::= column_name */ yytestcase(yyruleno==269); +{ yylhsminor.yy828 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy63); } + yymsp[0].minor.yy828 = yylhsminor.yy828; + break; + case 217: /* cmd ::= SHOW DNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DNODES_STMT); } break; - case 209: /* cmd ::= SHOW USERS */ + case 218: /* cmd ::= SHOW USERS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USERS_STMT); } break; - case 210: /* cmd ::= SHOW USER PRIVILEGES */ + case 219: /* cmd ::= SHOW USER PRIVILEGES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USER_PRIVILEGES_STMT); } break; - case 211: /* cmd ::= SHOW DATABASES */ + case 220: /* cmd ::= SHOW DATABASES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT); } break; - case 212: /* cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TABLES_STMT, yymsp[-2].minor.yy140, yymsp[0].minor.yy140, OP_TYPE_LIKE); } + case 221: /* cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TABLES_STMT, yymsp[-2].minor.yy828, yymsp[0].minor.yy828, OP_TYPE_LIKE); } break; - case 213: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy140, yymsp[0].minor.yy140, OP_TYPE_LIKE); } + case 222: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy828, yymsp[0].minor.yy828, OP_TYPE_LIKE); } break; - case 214: /* cmd ::= SHOW db_name_cond_opt VGROUPS */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy140, NULL, OP_TYPE_LIKE); } + case 223: /* cmd ::= SHOW db_name_cond_opt VGROUPS */ +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy828, NULL, OP_TYPE_LIKE); } break; - case 215: /* cmd ::= SHOW MNODES */ + case 224: /* cmd ::= SHOW MNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MNODES_STMT); } break; - case 216: /* cmd ::= SHOW QNODES */ + case 225: /* cmd ::= SHOW QNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QNODES_STMT); } break; - case 217: /* cmd ::= SHOW FUNCTIONS */ + case 226: /* cmd ::= SHOW FUNCTIONS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_FUNCTIONS_STMT); } break; - case 218: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy140, yymsp[-1].minor.yy140, OP_TYPE_EQUAL); } + case 227: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy828, yymsp[-1].minor.yy828, OP_TYPE_EQUAL); } break; - case 219: /* cmd ::= SHOW STREAMS */ + case 228: /* cmd ::= SHOW STREAMS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STREAMS_STMT); } break; - case 220: /* cmd ::= SHOW ACCOUNTS */ + case 229: /* cmd ::= SHOW ACCOUNTS */ { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } break; - case 221: /* cmd ::= SHOW APPS */ + case 230: /* cmd ::= SHOW APPS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_APPS_STMT); } break; - case 222: /* cmd ::= SHOW CONNECTIONS */ + case 231: /* cmd ::= SHOW CONNECTIONS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONNECTIONS_STMT); } break; - case 223: /* cmd ::= SHOW LICENCES */ - case 224: /* cmd ::= SHOW GRANTS */ yytestcase(yyruleno==224); + case 232: /* cmd ::= SHOW LICENCES */ + case 233: /* cmd ::= SHOW GRANTS */ yytestcase(yyruleno==233); { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LICENCES_STMT); } break; - case 225: /* cmd ::= SHOW CREATE DATABASE db_name */ -{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy881); } + case 234: /* cmd ::= SHOW CREATE DATABASE db_name */ +{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy63); } break; - case 226: /* cmd ::= SHOW CREATE TABLE full_table_name */ -{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy140); } + case 235: /* cmd ::= SHOW CREATE TABLE full_table_name */ +{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy828); } break; - case 227: /* cmd ::= SHOW CREATE STABLE full_table_name */ -{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy140); } + case 236: /* cmd ::= SHOW CREATE STABLE full_table_name */ +{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy828); } break; - case 228: /* cmd ::= SHOW QUERIES */ + case 237: /* cmd ::= SHOW QUERIES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QUERIES_STMT); } break; - case 229: /* cmd ::= SHOW SCORES */ + case 238: /* cmd ::= SHOW SCORES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SCORES_STMT); } break; - case 230: /* cmd ::= SHOW TOPICS */ + case 239: /* cmd ::= SHOW TOPICS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TOPICS_STMT); } break; - case 231: /* cmd ::= SHOW VARIABLES */ - case 232: /* cmd ::= SHOW CLUSTER VARIABLES */ yytestcase(yyruleno==232); + case 240: /* cmd ::= SHOW VARIABLES */ + case 241: /* cmd ::= SHOW CLUSTER VARIABLES */ yytestcase(yyruleno==241); { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VARIABLES_STMT); } break; - case 233: /* cmd ::= SHOW LOCAL VARIABLES */ + case 242: /* cmd ::= SHOW LOCAL VARIABLES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LOCAL_VARIABLES_STMT); } break; - case 234: /* 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.yy140); } + case 243: /* 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.yy828); } break; - case 235: /* cmd ::= SHOW BNODES */ + case 244: /* cmd ::= SHOW BNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_BNODES_STMT); } break; - case 236: /* cmd ::= SHOW SNODES */ + case 245: /* cmd ::= SHOW SNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SNODES_STMT); } break; - case 237: /* cmd ::= SHOW CLUSTER */ + case 246: /* cmd ::= SHOW CLUSTER */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CLUSTER_STMT); } break; - case 238: /* cmd ::= SHOW TRANSACTIONS */ + case 247: /* cmd ::= SHOW TRANSACTIONS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TRANSACTIONS_STMT); } break; - case 239: /* cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ -{ pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy140); } + case 248: /* cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ +{ pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy828); } break; - case 240: /* cmd ::= SHOW CONSUMERS */ + case 249: /* cmd ::= SHOW CONSUMERS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONSUMERS_STMT); } break; - case 241: /* cmd ::= SHOW SUBSCRIPTIONS */ + case 250: /* cmd ::= SHOW SUBSCRIPTIONS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SUBSCRIPTIONS_STMT); } break; - case 242: /* cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy140, yymsp[-1].minor.yy140, OP_TYPE_EQUAL); } + case 251: /* cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy828, yymsp[-1].minor.yy828, OP_TYPE_EQUAL); } break; - case 243: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ -{ pCxt->pRootNode = createShowTableTagsStmt(pCxt, yymsp[-1].minor.yy140, yymsp[0].minor.yy140, yymsp[-3].minor.yy220); } + case 252: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ +{ pCxt->pRootNode = createShowTableTagsStmt(pCxt, yymsp[-1].minor.yy828, yymsp[0].minor.yy828, yymsp[-3].minor.yy222); } break; - case 244: /* cmd ::= SHOW VNODES NK_INTEGER */ + case 253: /* cmd ::= SHOW VNODES NK_INTEGER */ { pCxt->pRootNode = createShowVnodesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0), NULL); } break; - case 245: /* cmd ::= SHOW VNODES NK_STRING */ + case 254: /* cmd ::= SHOW VNODES NK_STRING */ { pCxt->pRootNode = createShowVnodesStmt(pCxt, NULL, createValueNode(pCxt, TSDB_DATA_TYPE_VARCHAR, &yymsp[0].minor.yy0)); } break; - case 246: /* cmd ::= SHOW db_name_cond_opt ALIVE */ -{ pCxt->pRootNode = createShowAliveStmt(pCxt, yymsp[-1].minor.yy140, QUERY_NODE_SHOW_DB_ALIVE_STMT); } + case 255: /* cmd ::= SHOW db_name_cond_opt ALIVE */ +{ pCxt->pRootNode = createShowAliveStmt(pCxt, yymsp[-1].minor.yy828, QUERY_NODE_SHOW_DB_ALIVE_STMT); } break; - case 247: /* cmd ::= SHOW CLUSTER ALIVE */ + case 256: /* cmd ::= SHOW CLUSTER ALIVE */ { pCxt->pRootNode = createShowAliveStmt(pCxt, NULL, QUERY_NODE_SHOW_CLUSTER_ALIVE_STMT); } break; - case 248: /* db_name_cond_opt ::= */ - case 253: /* from_db_opt ::= */ yytestcase(yyruleno==253); -{ yymsp[1].minor.yy140 = createDefaultDatabaseCondValue(pCxt); } - break; - case 249: /* db_name_cond_opt ::= db_name NK_DOT */ -{ yylhsminor.yy140 = createIdentifierValueNode(pCxt, &yymsp[-1].minor.yy881); } - yymsp[-1].minor.yy140 = yylhsminor.yy140; + case 257: /* db_name_cond_opt ::= */ + case 262: /* from_db_opt ::= */ yytestcase(yyruleno==262); +{ yymsp[1].minor.yy828 = createDefaultDatabaseCondValue(pCxt); } break; - case 250: /* like_pattern_opt ::= */ - case 323: /* subtable_opt ::= */ yytestcase(yyruleno==323); - case 438: /* case_when_else_opt ::= */ yytestcase(yyruleno==438); - case 468: /* from_clause_opt ::= */ yytestcase(yyruleno==468); - case 497: /* where_clause_opt ::= */ yytestcase(yyruleno==497); - case 506: /* twindow_clause_opt ::= */ yytestcase(yyruleno==506); - case 512: /* sliding_opt ::= */ yytestcase(yyruleno==512); - case 514: /* fill_opt ::= */ yytestcase(yyruleno==514); - case 528: /* having_clause_opt ::= */ yytestcase(yyruleno==528); - case 530: /* range_opt ::= */ yytestcase(yyruleno==530); - case 532: /* every_opt ::= */ yytestcase(yyruleno==532); - case 545: /* slimit_clause_opt ::= */ yytestcase(yyruleno==545); - case 549: /* limit_clause_opt ::= */ yytestcase(yyruleno==549); -{ yymsp[1].minor.yy140 = NULL; } + case 258: /* db_name_cond_opt ::= db_name NK_DOT */ +{ yylhsminor.yy828 = createIdentifierValueNode(pCxt, &yymsp[-1].minor.yy63); } + yymsp[-1].minor.yy828 = yylhsminor.yy828; break; - case 251: /* like_pattern_opt ::= LIKE NK_STRING */ -{ yymsp[-1].minor.yy140 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } + case 260: /* like_pattern_opt ::= LIKE NK_STRING */ +{ yymsp[-1].minor.yy828 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } break; - case 252: /* table_name_cond ::= table_name */ -{ yylhsminor.yy140 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy881); } - yymsp[0].minor.yy140 = yylhsminor.yy140; + case 261: /* table_name_cond ::= table_name */ +{ yylhsminor.yy828 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy63); } + yymsp[0].minor.yy828 = yylhsminor.yy828; break; - case 254: /* from_db_opt ::= FROM db_name */ -{ yymsp[-1].minor.yy140 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy881); } + case 263: /* from_db_opt ::= FROM db_name */ +{ yymsp[-1].minor.yy828 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy63); } break; - case 258: /* tag_item ::= TBNAME */ -{ yylhsminor.yy140 = setProjectionAlias(pCxt, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL), &yymsp[0].minor.yy0); } - yymsp[0].minor.yy140 = yylhsminor.yy140; + case 267: /* tag_item ::= TBNAME */ +{ yylhsminor.yy828 = setProjectionAlias(pCxt, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL), &yymsp[0].minor.yy0); } + yymsp[0].minor.yy828 = yylhsminor.yy828; break; - case 261: /* tag_item ::= column_name column_alias */ -{ yylhsminor.yy140 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy881), &yymsp[0].minor.yy881); } - yymsp[-1].minor.yy140 = yylhsminor.yy140; + case 270: /* tag_item ::= column_name column_alias */ +{ yylhsminor.yy828 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy63), &yymsp[0].minor.yy63); } + yymsp[-1].minor.yy828 = yylhsminor.yy828; break; - case 262: /* tag_item ::= column_name AS column_alias */ -{ yylhsminor.yy140 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-2].minor.yy881), &yymsp[0].minor.yy881); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 271: /* tag_item ::= column_name AS column_alias */ +{ yylhsminor.yy828 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-2].minor.yy63), &yymsp[0].minor.yy63); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; - case 263: /* cmd ::= CREATE SMA INDEX not_exists_opt full_index_name ON full_table_name index_options */ -{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy587, yymsp[-3].minor.yy140, yymsp[-1].minor.yy140, NULL, yymsp[0].minor.yy140); } + case 272: /* cmd ::= CREATE SMA INDEX not_exists_opt full_index_name ON full_table_name index_options */ +{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy669, yymsp[-3].minor.yy828, yymsp[-1].minor.yy828, NULL, yymsp[0].minor.yy828); } break; - case 264: /* cmd ::= CREATE INDEX not_exists_opt full_index_name ON full_table_name NK_LP col_name_list NK_RP */ -{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_NORMAL, yymsp[-6].minor.yy587, yymsp[-5].minor.yy140, yymsp[-3].minor.yy140, yymsp[-1].minor.yy220, NULL); } + case 273: /* cmd ::= CREATE INDEX not_exists_opt full_index_name ON full_table_name NK_LP col_name_list NK_RP */ +{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_NORMAL, yymsp[-6].minor.yy669, yymsp[-5].minor.yy828, yymsp[-3].minor.yy828, yymsp[-1].minor.yy222, NULL); } break; - case 265: /* cmd ::= DROP INDEX exists_opt full_index_name */ -{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy587, yymsp[0].minor.yy140); } + case 274: /* cmd ::= DROP INDEX exists_opt full_index_name */ +{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy669, yymsp[0].minor.yy828); } break; - case 266: /* full_index_name ::= index_name */ -{ yylhsminor.yy140 = createRealTableNodeForIndexName(pCxt, NULL, &yymsp[0].minor.yy881); } - yymsp[0].minor.yy140 = yylhsminor.yy140; + case 275: /* full_index_name ::= index_name */ +{ yylhsminor.yy828 = createRealTableNodeForIndexName(pCxt, NULL, &yymsp[0].minor.yy63); } + yymsp[0].minor.yy828 = yylhsminor.yy828; break; - case 267: /* full_index_name ::= db_name NK_DOT index_name */ -{ yylhsminor.yy140 = createRealTableNodeForIndexName(pCxt, &yymsp[-2].minor.yy881, &yymsp[0].minor.yy881); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 276: /* full_index_name ::= db_name NK_DOT index_name */ +{ yylhsminor.yy828 = createRealTableNodeForIndexName(pCxt, &yymsp[-2].minor.yy63, &yymsp[0].minor.yy63); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; - case 268: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ -{ yymsp[-9].minor.yy140 = createIndexOption(pCxt, yymsp[-7].minor.yy220, releaseRawExprNode(pCxt, yymsp[-3].minor.yy140), NULL, yymsp[-1].minor.yy140, yymsp[0].minor.yy140); } + case 277: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ +{ yymsp[-9].minor.yy828 = createIndexOption(pCxt, yymsp[-7].minor.yy222, releaseRawExprNode(pCxt, yymsp[-3].minor.yy828), NULL, yymsp[-1].minor.yy828, yymsp[0].minor.yy828); } break; - case 269: /* 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.yy140 = createIndexOption(pCxt, yymsp[-9].minor.yy220, releaseRawExprNode(pCxt, yymsp[-5].minor.yy140), releaseRawExprNode(pCxt, yymsp[-3].minor.yy140), yymsp[-1].minor.yy140, yymsp[0].minor.yy140); } + case 278: /* 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.yy828 = createIndexOption(pCxt, yymsp[-9].minor.yy222, releaseRawExprNode(pCxt, yymsp[-5].minor.yy828), releaseRawExprNode(pCxt, yymsp[-3].minor.yy828), yymsp[-1].minor.yy828, yymsp[0].minor.yy828); } break; - case 272: /* func ::= sma_func_name NK_LP expression_list NK_RP */ -{ yylhsminor.yy140 = createFunctionNode(pCxt, &yymsp[-3].minor.yy881, yymsp[-1].minor.yy220); } - yymsp[-3].minor.yy140 = yylhsminor.yy140; + case 281: /* func ::= sma_func_name NK_LP expression_list NK_RP */ +{ yylhsminor.yy828 = createFunctionNode(pCxt, &yymsp[-3].minor.yy63, yymsp[-1].minor.yy222); } + yymsp[-3].minor.yy828 = yylhsminor.yy828; break; - case 278: /* sma_stream_opt ::= */ - case 314: /* stream_options ::= */ yytestcase(yyruleno==314); -{ yymsp[1].minor.yy140 = createStreamOptions(pCxt); } + case 287: /* sma_stream_opt ::= */ + case 323: /* stream_options ::= */ yytestcase(yyruleno==323); +{ yymsp[1].minor.yy828 = createStreamOptions(pCxt); } break; - case 279: /* sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ - case 318: /* stream_options ::= stream_options WATERMARK duration_literal */ yytestcase(yyruleno==318); -{ ((SStreamOptions*)yymsp[-2].minor.yy140)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy140); yylhsminor.yy140 = yymsp[-2].minor.yy140; } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 288: /* sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ +{ ((SStreamOptions*)yymsp[-2].minor.yy828)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy828); yylhsminor.yy828 = yymsp[-2].minor.yy828; } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; - case 280: /* sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ -{ ((SStreamOptions*)yymsp[-2].minor.yy140)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy140); yylhsminor.yy140 = yymsp[-2].minor.yy140; } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 289: /* sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ +{ ((SStreamOptions*)yymsp[-2].minor.yy828)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy828); yylhsminor.yy828 = yymsp[-2].minor.yy828; } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; - case 281: /* sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ - case 321: /* stream_options ::= stream_options DELETE_MARK duration_literal */ yytestcase(yyruleno==321); -{ ((SStreamOptions*)yymsp[-2].minor.yy140)->pDeleteMark = releaseRawExprNode(pCxt, yymsp[0].minor.yy140); yylhsminor.yy140 = yymsp[-2].minor.yy140; } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 290: /* sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ +{ ((SStreamOptions*)yymsp[-2].minor.yy828)->pDeleteMark = releaseRawExprNode(pCxt, yymsp[0].minor.yy828); yylhsminor.yy828 = yymsp[-2].minor.yy828; } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; - case 282: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ -{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy587, &yymsp[-2].minor.yy881, yymsp[0].minor.yy140); } + case 291: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ +{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy669, &yymsp[-2].minor.yy63, yymsp[0].minor.yy828); } break; - case 283: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ -{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy587, &yymsp[-3].minor.yy881, &yymsp[0].minor.yy881, false); } + case 292: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ +{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy669, &yymsp[-3].minor.yy63, &yymsp[0].minor.yy63, false); } break; - case 284: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */ -{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-6].minor.yy587, &yymsp[-5].minor.yy881, &yymsp[0].minor.yy881, true); } + case 293: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */ +{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-6].minor.yy669, &yymsp[-5].minor.yy63, &yymsp[0].minor.yy63, true); } break; - case 285: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ -{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-4].minor.yy587, &yymsp[-3].minor.yy881, yymsp[0].minor.yy140, false); } + case 294: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ +{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-4].minor.yy669, &yymsp[-3].minor.yy63, yymsp[0].minor.yy828, false); } break; - case 286: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */ -{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-6].minor.yy587, &yymsp[-5].minor.yy881, yymsp[0].minor.yy140, true); } + case 295: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */ +{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-6].minor.yy669, &yymsp[-5].minor.yy63, yymsp[0].minor.yy828, true); } break; - case 287: /* cmd ::= DROP TOPIC exists_opt topic_name */ -{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy587, &yymsp[0].minor.yy881); } + case 296: /* cmd ::= DROP TOPIC exists_opt topic_name */ +{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy669, &yymsp[0].minor.yy63); } break; - case 288: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ -{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy587, &yymsp[-2].minor.yy881, &yymsp[0].minor.yy881); } + case 297: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ +{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy669, &yymsp[-2].minor.yy63, &yymsp[0].minor.yy63); } break; - case 289: /* cmd ::= DESC full_table_name */ - case 290: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==290); -{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy140); } + case 298: /* cmd ::= DESC full_table_name */ + case 299: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==299); +{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy828); } break; - case 291: /* cmd ::= RESET QUERY CACHE */ + case 300: /* cmd ::= RESET QUERY CACHE */ { pCxt->pRootNode = createResetQueryCacheStmt(pCxt); } break; - case 292: /* cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ - case 293: /* cmd ::= EXPLAIN analyze_opt explain_options insert_query */ yytestcase(yyruleno==293); -{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy587, yymsp[-1].minor.yy140, yymsp[0].minor.yy140); } + case 301: /* cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ + case 302: /* cmd ::= EXPLAIN analyze_opt explain_options insert_query */ yytestcase(yyruleno==302); +{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy669, yymsp[-1].minor.yy828, yymsp[0].minor.yy828); } + break; + case 305: /* explain_options ::= */ +{ yymsp[1].minor.yy828 = createDefaultExplainOptions(pCxt); } break; - case 296: /* explain_options ::= */ -{ yymsp[1].minor.yy140 = createDefaultExplainOptions(pCxt); } + case 306: /* explain_options ::= explain_options VERBOSE NK_BOOL */ +{ yylhsminor.yy828 = setExplainVerbose(pCxt, yymsp[-2].minor.yy828, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; - case 297: /* explain_options ::= explain_options VERBOSE NK_BOOL */ -{ yylhsminor.yy140 = setExplainVerbose(pCxt, yymsp[-2].minor.yy140, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 307: /* explain_options ::= explain_options RATIO NK_FLOAT */ +{ yylhsminor.yy828 = setExplainRatio(pCxt, yymsp[-2].minor.yy828, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; - case 298: /* explain_options ::= explain_options RATIO NK_FLOAT */ -{ yylhsminor.yy140 = setExplainRatio(pCxt, yymsp[-2].minor.yy140, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 308: /* cmd ::= CREATE 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.yy669, yymsp[-9].minor.yy669, &yymsp[-6].minor.yy63, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy686, yymsp[-1].minor.yy332, &yymsp[0].minor.yy63); } break; - case 299: /* cmd ::= CREATE 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.yy587, yymsp[-9].minor.yy587, &yymsp[-6].minor.yy881, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy682, yymsp[-1].minor.yy214, &yymsp[0].minor.yy881); } + case 309: /* cmd ::= DROP FUNCTION exists_opt function_name */ +{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy669, &yymsp[0].minor.yy63); } break; - case 300: /* cmd ::= DROP FUNCTION exists_opt function_name */ -{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy587, &yymsp[0].minor.yy881); } + case 314: /* language_opt ::= */ +{ yymsp[1].minor.yy63 = nil_token; } break; - case 305: /* language_opt ::= */ -{ yymsp[1].minor.yy881 = nil_token; } + case 315: /* language_opt ::= LANGUAGE NK_STRING */ +{ yymsp[-1].minor.yy63 = yymsp[0].minor.yy0; } break; - case 306: /* language_opt ::= LANGUAGE NK_STRING */ -{ yymsp[-1].minor.yy881 = yymsp[0].minor.yy0; } + case 316: /* 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.yy669, &yymsp[-8].minor.yy63, yymsp[-5].minor.yy828, yymsp[-7].minor.yy828, yymsp[-3].minor.yy222, yymsp[-2].minor.yy828, yymsp[0].minor.yy828, yymsp[-4].minor.yy222); } break; - case 307: /* 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.yy587, &yymsp[-8].minor.yy881, yymsp[-5].minor.yy140, yymsp[-7].minor.yy140, yymsp[-3].minor.yy220, yymsp[-2].minor.yy140, yymsp[0].minor.yy140, yymsp[-4].minor.yy220); } + case 317: /* cmd ::= DROP STREAM exists_opt stream_name */ +{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy669, &yymsp[0].minor.yy63); } break; - case 308: /* cmd ::= DROP STREAM exists_opt stream_name */ -{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy587, &yymsp[0].minor.yy881); } + case 324: /* stream_options ::= stream_options TRIGGER AT_ONCE */ + case 325: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ yytestcase(yyruleno==325); +{ yylhsminor.yy828 = setStreamOptions(pCxt, yymsp[-2].minor.yy828, SOPT_TRIGGER_TYPE_SET, &yymsp[0].minor.yy0, NULL); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; - case 315: /* stream_options ::= stream_options TRIGGER AT_ONCE */ -{ ((SStreamOptions*)yymsp[-2].minor.yy140)->triggerType = STREAM_TRIGGER_AT_ONCE; yylhsminor.yy140 = yymsp[-2].minor.yy140; } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 326: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ +{ yylhsminor.yy828 = setStreamOptions(pCxt, yymsp[-3].minor.yy828, SOPT_TRIGGER_TYPE_SET, &yymsp[-1].minor.yy0, releaseRawExprNode(pCxt, yymsp[0].minor.yy828)); } + yymsp[-3].minor.yy828 = yylhsminor.yy828; break; - case 316: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ -{ ((SStreamOptions*)yymsp[-2].minor.yy140)->triggerType = STREAM_TRIGGER_WINDOW_CLOSE; yylhsminor.yy140 = yymsp[-2].minor.yy140; } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 327: /* stream_options ::= stream_options WATERMARK duration_literal */ +{ yylhsminor.yy828 = setStreamOptions(pCxt, yymsp[-2].minor.yy828, SOPT_WATERMARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy828)); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; - case 317: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ -{ ((SStreamOptions*)yymsp[-3].minor.yy140)->triggerType = STREAM_TRIGGER_MAX_DELAY; ((SStreamOptions*)yymsp[-3].minor.yy140)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy140); yylhsminor.yy140 = yymsp[-3].minor.yy140; } - yymsp[-3].minor.yy140 = yylhsminor.yy140; + case 328: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ +{ yylhsminor.yy828 = setStreamOptions(pCxt, yymsp[-3].minor.yy828, SOPT_IGNORE_EXPIRED_SET, &yymsp[0].minor.yy0, NULL); } + yymsp[-3].minor.yy828 = yylhsminor.yy828; break; - case 319: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ -{ ((SStreamOptions*)yymsp[-3].minor.yy140)->ignoreExpired = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); yylhsminor.yy140 = yymsp[-3].minor.yy140; } - yymsp[-3].minor.yy140 = yylhsminor.yy140; + case 329: /* stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ +{ yylhsminor.yy828 = setStreamOptions(pCxt, yymsp[-2].minor.yy828, SOPT_FILL_HISTORY_SET, &yymsp[0].minor.yy0, NULL); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; - case 320: /* stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ -{ ((SStreamOptions*)yymsp[-2].minor.yy140)->fillHistory = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); yylhsminor.yy140 = yymsp[-2].minor.yy140; } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 330: /* stream_options ::= stream_options DELETE_MARK duration_literal */ +{ yylhsminor.yy828 = setStreamOptions(pCxt, yymsp[-2].minor.yy828, SOPT_DELETE_MARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy828)); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; - case 322: /* stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ -{ ((SStreamOptions*)yymsp[-3].minor.yy140)->ignoreUpdate = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); yylhsminor.yy140 = yymsp[-3].minor.yy140; } - yymsp[-3].minor.yy140 = yylhsminor.yy140; + case 331: /* stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ +{ yylhsminor.yy828 = setStreamOptions(pCxt, yymsp[-3].minor.yy828, SOPT_IGNORE_UPDATE_SET, &yymsp[0].minor.yy0, NULL); } + yymsp[-3].minor.yy828 = yylhsminor.yy828; break; - case 324: /* subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ - case 513: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ yytestcase(yyruleno==513); - case 533: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==533); -{ yymsp[-3].minor.yy140 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy140); } + case 333: /* subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ + case 522: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ yytestcase(yyruleno==522); + case 542: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==542); +{ yymsp[-3].minor.yy828 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy828); } break; - case 325: /* cmd ::= KILL CONNECTION NK_INTEGER */ + case 334: /* cmd ::= KILL CONNECTION NK_INTEGER */ { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_CONNECTION_STMT, &yymsp[0].minor.yy0); } break; - case 326: /* cmd ::= KILL QUERY NK_STRING */ + case 335: /* cmd ::= KILL QUERY NK_STRING */ { pCxt->pRootNode = createKillQueryStmt(pCxt, &yymsp[0].minor.yy0); } break; - case 327: /* cmd ::= KILL TRANSACTION NK_INTEGER */ + case 336: /* cmd ::= KILL TRANSACTION NK_INTEGER */ { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_TRANSACTION_STMT, &yymsp[0].minor.yy0); } break; - case 328: /* cmd ::= BALANCE VGROUP */ + case 337: /* cmd ::= BALANCE VGROUP */ { pCxt->pRootNode = createBalanceVgroupStmt(pCxt); } break; - case 329: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + case 338: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ { pCxt->pRootNode = createMergeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } break; - case 330: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ -{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy220); } + case 339: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ +{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy222); } break; - case 331: /* cmd ::= SPLIT VGROUP NK_INTEGER */ + case 340: /* cmd ::= SPLIT VGROUP NK_INTEGER */ { pCxt->pRootNode = createSplitVgroupStmt(pCxt, &yymsp[0].minor.yy0); } break; - case 332: /* dnode_list ::= DNODE NK_INTEGER */ -{ yymsp[-1].minor.yy220 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - break; - case 334: /* cmd ::= DELETE FROM full_table_name where_clause_opt */ -{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy140, yymsp[0].minor.yy140); } - break; - case 337: /* insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ -{ yymsp[-6].minor.yy140 = createInsertStmt(pCxt, yymsp[-4].minor.yy140, yymsp[-2].minor.yy220, yymsp[0].minor.yy140); } - break; - case 338: /* insert_query ::= INSERT INTO full_table_name query_or_subquery */ -{ yymsp[-3].minor.yy140 = createInsertStmt(pCxt, yymsp[-1].minor.yy140, NULL, yymsp[0].minor.yy140); } - break; - case 339: /* literal ::= NK_INTEGER */ -{ yylhsminor.yy140 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy140 = yylhsminor.yy140; - break; - case 340: /* literal ::= NK_FLOAT */ -{ yylhsminor.yy140 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy140 = yylhsminor.yy140; - break; - case 341: /* literal ::= NK_STRING */ -{ yylhsminor.yy140 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy140 = yylhsminor.yy140; - break; - case 342: /* literal ::= NK_BOOL */ -{ yylhsminor.yy140 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy140 = yylhsminor.yy140; - break; - case 343: /* literal ::= TIMESTAMP NK_STRING */ -{ yylhsminor.yy140 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } - yymsp[-1].minor.yy140 = yylhsminor.yy140; - break; - case 344: /* literal ::= duration_literal */ - case 354: /* signed_literal ::= signed */ yytestcase(yyruleno==354); - case 375: /* expr_or_subquery ::= expression */ yytestcase(yyruleno==375); - case 376: /* expression ::= literal */ yytestcase(yyruleno==376); - case 377: /* expression ::= pseudo_column */ yytestcase(yyruleno==377); - case 378: /* expression ::= column_reference */ yytestcase(yyruleno==378); - case 379: /* expression ::= function_expression */ yytestcase(yyruleno==379); - case 380: /* expression ::= case_when_expression */ yytestcase(yyruleno==380); - case 411: /* function_expression ::= literal_func */ yytestcase(yyruleno==411); - case 460: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==460); - case 464: /* boolean_primary ::= predicate */ yytestcase(yyruleno==464); - case 466: /* common_expression ::= expr_or_subquery */ yytestcase(yyruleno==466); - case 467: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==467); - case 470: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==470); - case 472: /* table_reference ::= table_primary */ yytestcase(yyruleno==472); - case 473: /* table_reference ::= joined_table */ yytestcase(yyruleno==473); - case 477: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==477); - case 535: /* query_simple ::= query_specification */ yytestcase(yyruleno==535); - case 536: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==536); - case 539: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==539); - case 541: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==541); -{ yylhsminor.yy140 = yymsp[0].minor.yy140; } - yymsp[0].minor.yy140 = yylhsminor.yy140; - break; - case 345: /* literal ::= NULL */ -{ yylhsminor.yy140 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy140 = yylhsminor.yy140; - break; - case 346: /* literal ::= NK_QUESTION */ -{ yylhsminor.yy140 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy140 = yylhsminor.yy140; - break; - case 347: /* duration_literal ::= NK_VARIABLE */ -{ yylhsminor.yy140 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy140 = yylhsminor.yy140; - break; - case 348: /* signed ::= NK_INTEGER */ -{ yylhsminor.yy140 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy140 = yylhsminor.yy140; - break; - case 349: /* signed ::= NK_PLUS NK_INTEGER */ -{ yymsp[-1].minor.yy140 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } - break; - case 350: /* signed ::= NK_MINUS NK_INTEGER */ + case 341: /* dnode_list ::= DNODE NK_INTEGER */ +{ yymsp[-1].minor.yy222 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + break; + case 343: /* cmd ::= DELETE FROM full_table_name where_clause_opt */ +{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy828, yymsp[0].minor.yy828); } + break; + case 346: /* insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ +{ yymsp[-6].minor.yy828 = createInsertStmt(pCxt, yymsp[-4].minor.yy828, yymsp[-2].minor.yy222, yymsp[0].minor.yy828); } + break; + case 347: /* insert_query ::= INSERT INTO full_table_name query_or_subquery */ +{ yymsp[-3].minor.yy828 = createInsertStmt(pCxt, yymsp[-1].minor.yy828, NULL, yymsp[0].minor.yy828); } + break; + case 348: /* literal ::= NK_INTEGER */ +{ yylhsminor.yy828 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy828 = yylhsminor.yy828; + break; + case 349: /* literal ::= NK_FLOAT */ +{ yylhsminor.yy828 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy828 = yylhsminor.yy828; + break; + case 350: /* literal ::= NK_STRING */ +{ yylhsminor.yy828 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy828 = yylhsminor.yy828; + break; + case 351: /* literal ::= NK_BOOL */ +{ yylhsminor.yy828 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy828 = yylhsminor.yy828; + break; + case 352: /* literal ::= TIMESTAMP NK_STRING */ +{ yylhsminor.yy828 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } + yymsp[-1].minor.yy828 = yylhsminor.yy828; + break; + case 353: /* literal ::= duration_literal */ + case 363: /* signed_literal ::= signed */ yytestcase(yyruleno==363); + case 384: /* expr_or_subquery ::= expression */ yytestcase(yyruleno==384); + case 385: /* expression ::= literal */ yytestcase(yyruleno==385); + case 386: /* expression ::= pseudo_column */ yytestcase(yyruleno==386); + case 387: /* expression ::= column_reference */ yytestcase(yyruleno==387); + case 388: /* expression ::= function_expression */ yytestcase(yyruleno==388); + case 389: /* expression ::= case_when_expression */ yytestcase(yyruleno==389); + case 420: /* function_expression ::= literal_func */ yytestcase(yyruleno==420); + case 469: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==469); + case 473: /* boolean_primary ::= predicate */ yytestcase(yyruleno==473); + case 475: /* common_expression ::= expr_or_subquery */ yytestcase(yyruleno==475); + case 476: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==476); + case 479: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==479); + case 481: /* table_reference ::= table_primary */ yytestcase(yyruleno==481); + case 482: /* table_reference ::= joined_table */ yytestcase(yyruleno==482); + case 486: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==486); + case 544: /* query_simple ::= query_specification */ yytestcase(yyruleno==544); + case 545: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==545); + case 548: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==548); + case 550: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==550); +{ yylhsminor.yy828 = yymsp[0].minor.yy828; } + yymsp[0].minor.yy828 = yylhsminor.yy828; + break; + case 354: /* literal ::= NULL */ +{ yylhsminor.yy828 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy828 = yylhsminor.yy828; + break; + case 355: /* literal ::= NK_QUESTION */ +{ yylhsminor.yy828 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy828 = yylhsminor.yy828; + break; + case 356: /* duration_literal ::= NK_VARIABLE */ +{ yylhsminor.yy828 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy828 = yylhsminor.yy828; + break; + case 357: /* signed ::= NK_INTEGER */ +{ yylhsminor.yy828 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy828 = yylhsminor.yy828; + break; + case 358: /* signed ::= NK_PLUS NK_INTEGER */ +{ yymsp[-1].minor.yy828 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } + break; + case 359: /* 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.yy140 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); + yylhsminor.yy828 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); } - yymsp[-1].minor.yy140 = yylhsminor.yy140; + yymsp[-1].minor.yy828 = yylhsminor.yy828; break; - case 351: /* signed ::= NK_FLOAT */ -{ yylhsminor.yy140 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy140 = yylhsminor.yy140; + case 360: /* signed ::= NK_FLOAT */ +{ yylhsminor.yy828 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy828 = yylhsminor.yy828; break; - case 352: /* signed ::= NK_PLUS NK_FLOAT */ -{ yymsp[-1].minor.yy140 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } + case 361: /* signed ::= NK_PLUS NK_FLOAT */ +{ yymsp[-1].minor.yy828 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } break; - case 353: /* signed ::= NK_MINUS NK_FLOAT */ + case 362: /* 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.yy140 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); + yylhsminor.yy828 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); } - yymsp[-1].minor.yy140 = yylhsminor.yy140; - break; - case 355: /* signed_literal ::= NK_STRING */ -{ yylhsminor.yy140 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy140 = yylhsminor.yy140; - break; - case 356: /* signed_literal ::= NK_BOOL */ -{ yylhsminor.yy140 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy140 = yylhsminor.yy140; - break; - case 357: /* signed_literal ::= TIMESTAMP NK_STRING */ -{ yymsp[-1].minor.yy140 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } - break; - case 358: /* signed_literal ::= duration_literal */ - case 360: /* signed_literal ::= literal_func */ yytestcase(yyruleno==360); - case 431: /* star_func_para ::= expr_or_subquery */ yytestcase(yyruleno==431); - case 493: /* select_item ::= common_expression */ yytestcase(yyruleno==493); - case 503: /* partition_item ::= expr_or_subquery */ yytestcase(yyruleno==503); - case 540: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==540); - case 542: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==542); - case 555: /* search_condition ::= common_expression */ yytestcase(yyruleno==555); -{ yylhsminor.yy140 = releaseRawExprNode(pCxt, yymsp[0].minor.yy140); } - yymsp[0].minor.yy140 = yylhsminor.yy140; - break; - case 359: /* signed_literal ::= NULL */ -{ yylhsminor.yy140 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy140 = yylhsminor.yy140; - break; - case 361: /* signed_literal ::= NK_QUESTION */ -{ yylhsminor.yy140 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy140 = yylhsminor.yy140; - break; - case 381: /* expression ::= NK_LP expression NK_RP */ - case 465: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==465); - case 554: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==554); -{ yylhsminor.yy140 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy140)); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; - break; - case 382: /* expression ::= NK_PLUS expr_or_subquery */ + yymsp[-1].minor.yy828 = yylhsminor.yy828; + break; + case 364: /* signed_literal ::= NK_STRING */ +{ yylhsminor.yy828 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy828 = yylhsminor.yy828; + break; + case 365: /* signed_literal ::= NK_BOOL */ +{ yylhsminor.yy828 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy828 = yylhsminor.yy828; + break; + case 366: /* signed_literal ::= TIMESTAMP NK_STRING */ +{ yymsp[-1].minor.yy828 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } + break; + case 367: /* signed_literal ::= duration_literal */ + case 369: /* signed_literal ::= literal_func */ yytestcase(yyruleno==369); + case 440: /* star_func_para ::= expr_or_subquery */ yytestcase(yyruleno==440); + case 502: /* select_item ::= common_expression */ yytestcase(yyruleno==502); + case 512: /* partition_item ::= expr_or_subquery */ yytestcase(yyruleno==512); + case 549: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==549); + case 551: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==551); + case 564: /* search_condition ::= common_expression */ yytestcase(yyruleno==564); +{ yylhsminor.yy828 = releaseRawExprNode(pCxt, yymsp[0].minor.yy828); } + yymsp[0].minor.yy828 = yylhsminor.yy828; + break; + case 368: /* signed_literal ::= NULL */ +{ yylhsminor.yy828 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy828 = yylhsminor.yy828; + break; + case 370: /* signed_literal ::= NK_QUESTION */ +{ yylhsminor.yy828 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy828 = yylhsminor.yy828; + break; + case 390: /* expression ::= NK_LP expression NK_RP */ + case 474: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==474); + case 563: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==563); +{ yylhsminor.yy828 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy828)); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; + break; + case 391: /* expression ::= NK_PLUS expr_or_subquery */ { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy140); - yylhsminor.yy140 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy140)); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy828); + yylhsminor.yy828 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy828)); } - yymsp[-1].minor.yy140 = yylhsminor.yy140; + yymsp[-1].minor.yy828 = yylhsminor.yy828; break; - case 383: /* expression ::= NK_MINUS expr_or_subquery */ + case 392: /* expression ::= NK_MINUS expr_or_subquery */ { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy140); - yylhsminor.yy140 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy140), NULL)); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy828); + yylhsminor.yy828 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy828), NULL)); } - yymsp[-1].minor.yy140 = yylhsminor.yy140; + yymsp[-1].minor.yy828 = yylhsminor.yy828; break; - case 384: /* expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ + case 393: /* expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy140); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy140); - yylhsminor.yy140 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy140), releaseRawExprNode(pCxt, yymsp[0].minor.yy140))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy828); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy828); + yylhsminor.yy828 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy828), releaseRawExprNode(pCxt, yymsp[0].minor.yy828))); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; - case 385: /* expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ + case 394: /* expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy140); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy140); - yylhsminor.yy140 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy140), releaseRawExprNode(pCxt, yymsp[0].minor.yy140))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy828); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy828); + yylhsminor.yy828 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy828), releaseRawExprNode(pCxt, yymsp[0].minor.yy828))); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; - case 386: /* expression ::= expr_or_subquery NK_STAR expr_or_subquery */ + case 395: /* expression ::= expr_or_subquery NK_STAR expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy140); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy140); - yylhsminor.yy140 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy140), releaseRawExprNode(pCxt, yymsp[0].minor.yy140))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy828); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy828); + yylhsminor.yy828 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy828), releaseRawExprNode(pCxt, yymsp[0].minor.yy828))); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; - case 387: /* expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ + case 396: /* expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy140); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy140); - yylhsminor.yy140 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy140), releaseRawExprNode(pCxt, yymsp[0].minor.yy140))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy828); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy828); + yylhsminor.yy828 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy828), releaseRawExprNode(pCxt, yymsp[0].minor.yy828))); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; - case 388: /* expression ::= expr_or_subquery NK_REM expr_or_subquery */ + case 397: /* expression ::= expr_or_subquery NK_REM expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy140); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy140); - yylhsminor.yy140 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy140), releaseRawExprNode(pCxt, yymsp[0].minor.yy140))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy828); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy828); + yylhsminor.yy828 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy828), releaseRawExprNode(pCxt, yymsp[0].minor.yy828))); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; - case 389: /* expression ::= column_reference NK_ARROW NK_STRING */ + case 398: /* expression ::= column_reference NK_ARROW NK_STRING */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy140); - yylhsminor.yy140 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy140), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy828); + yylhsminor.yy828 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy828), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0))); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; - case 390: /* expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ + case 399: /* expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy140); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy140); - yylhsminor.yy140 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy140), releaseRawExprNode(pCxt, yymsp[0].minor.yy140))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy828); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy828); + yylhsminor.yy828 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy828), releaseRawExprNode(pCxt, yymsp[0].minor.yy828))); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; - case 391: /* expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ + case 400: /* expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy140); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy140); - yylhsminor.yy140 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy140), releaseRawExprNode(pCxt, yymsp[0].minor.yy140))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy828); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy828); + yylhsminor.yy828 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy828), releaseRawExprNode(pCxt, yymsp[0].minor.yy828))); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; - break; - case 394: /* column_reference ::= column_name */ -{ yylhsminor.yy140 = createRawExprNode(pCxt, &yymsp[0].minor.yy881, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy881)); } - yymsp[0].minor.yy140 = yylhsminor.yy140; - break; - case 395: /* column_reference ::= table_name NK_DOT column_name */ -{ yylhsminor.yy140 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy881, &yymsp[0].minor.yy881, createColumnNode(pCxt, &yymsp[-2].minor.yy881, &yymsp[0].minor.yy881)); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; - break; - case 396: /* pseudo_column ::= ROWTS */ - case 397: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==397); - case 399: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==399); - case 400: /* pseudo_column ::= QEND */ yytestcase(yyruleno==400); - case 401: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==401); - case 402: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==402); - case 403: /* pseudo_column ::= WEND */ yytestcase(yyruleno==403); - case 404: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==404); - case 405: /* pseudo_column ::= IROWTS */ yytestcase(yyruleno==405); - case 406: /* pseudo_column ::= ISFILLED */ yytestcase(yyruleno==406); - case 407: /* pseudo_column ::= QTAGS */ yytestcase(yyruleno==407); - case 413: /* literal_func ::= NOW */ yytestcase(yyruleno==413); -{ yylhsminor.yy140 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } - yymsp[0].minor.yy140 = yylhsminor.yy140; - break; - case 398: /* pseudo_column ::= table_name NK_DOT TBNAME */ -{ yylhsminor.yy140 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy881, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy881)))); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; - break; - case 408: /* function_expression ::= function_name NK_LP expression_list NK_RP */ - case 409: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==409); -{ yylhsminor.yy140 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy881, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy881, yymsp[-1].minor.yy220)); } - yymsp[-3].minor.yy140 = yylhsminor.yy140; - break; - case 410: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ -{ yylhsminor.yy140 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy140), yymsp[-1].minor.yy682)); } - yymsp[-5].minor.yy140 = yylhsminor.yy140; - break; - case 412: /* literal_func ::= noarg_func NK_LP NK_RP */ -{ yylhsminor.yy140 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy881, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy881, NULL)); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; - break; - case 427: /* star_func_para_list ::= NK_STAR */ -{ yylhsminor.yy220 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy220 = yylhsminor.yy220; - break; - case 432: /* star_func_para ::= table_name NK_DOT NK_STAR */ - case 496: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==496); -{ yylhsminor.yy140 = createColumnNode(pCxt, &yymsp[-2].minor.yy881, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; - break; - case 433: /* case_when_expression ::= CASE when_then_list case_when_else_opt END */ -{ yylhsminor.yy140 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, NULL, yymsp[-2].minor.yy220, yymsp[-1].minor.yy140)); } - yymsp[-3].minor.yy140 = yylhsminor.yy140; - break; - case 434: /* case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ -{ yylhsminor.yy140 = createRawExprNodeExt(pCxt, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy140), yymsp[-2].minor.yy220, yymsp[-1].minor.yy140)); } - yymsp[-4].minor.yy140 = yylhsminor.yy140; - break; - case 437: /* when_then_expr ::= WHEN common_expression THEN common_expression */ -{ yymsp[-3].minor.yy140 = createWhenThenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy140), releaseRawExprNode(pCxt, yymsp[0].minor.yy140)); } - break; - case 439: /* case_when_else_opt ::= ELSE common_expression */ -{ yymsp[-1].minor.yy140 = releaseRawExprNode(pCxt, yymsp[0].minor.yy140); } - break; - case 440: /* predicate ::= expr_or_subquery compare_op expr_or_subquery */ - case 445: /* predicate ::= expr_or_subquery in_op in_predicate_value */ yytestcase(yyruleno==445); + yymsp[-2].minor.yy828 = yylhsminor.yy828; + break; + case 403: /* column_reference ::= column_name */ +{ yylhsminor.yy828 = createRawExprNode(pCxt, &yymsp[0].minor.yy63, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy63)); } + yymsp[0].minor.yy828 = yylhsminor.yy828; + break; + case 404: /* column_reference ::= table_name NK_DOT column_name */ +{ yylhsminor.yy828 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy63, &yymsp[0].minor.yy63, createColumnNode(pCxt, &yymsp[-2].minor.yy63, &yymsp[0].minor.yy63)); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; + break; + case 405: /* pseudo_column ::= ROWTS */ + case 406: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==406); + case 408: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==408); + case 409: /* pseudo_column ::= QEND */ yytestcase(yyruleno==409); + case 410: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==410); + case 411: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==411); + case 412: /* pseudo_column ::= WEND */ yytestcase(yyruleno==412); + case 413: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==413); + case 414: /* pseudo_column ::= IROWTS */ yytestcase(yyruleno==414); + case 415: /* pseudo_column ::= ISFILLED */ yytestcase(yyruleno==415); + case 416: /* pseudo_column ::= QTAGS */ yytestcase(yyruleno==416); + case 422: /* literal_func ::= NOW */ yytestcase(yyruleno==422); +{ yylhsminor.yy828 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } + yymsp[0].minor.yy828 = yylhsminor.yy828; + break; + case 407: /* pseudo_column ::= table_name NK_DOT TBNAME */ +{ yylhsminor.yy828 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy63, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy63)))); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; + break; + case 417: /* function_expression ::= function_name NK_LP expression_list NK_RP */ + case 418: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==418); +{ yylhsminor.yy828 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy63, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy63, yymsp[-1].minor.yy222)); } + yymsp[-3].minor.yy828 = yylhsminor.yy828; + break; + case 419: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ +{ yylhsminor.yy828 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy828), yymsp[-1].minor.yy686)); } + yymsp[-5].minor.yy828 = yylhsminor.yy828; + break; + case 421: /* literal_func ::= noarg_func NK_LP NK_RP */ +{ yylhsminor.yy828 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy63, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy63, NULL)); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; + break; + case 436: /* star_func_para_list ::= NK_STAR */ +{ yylhsminor.yy222 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy222 = yylhsminor.yy222; + break; + case 441: /* star_func_para ::= table_name NK_DOT NK_STAR */ + case 505: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==505); +{ yylhsminor.yy828 = createColumnNode(pCxt, &yymsp[-2].minor.yy63, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; + break; + case 442: /* case_when_expression ::= CASE when_then_list case_when_else_opt END */ +{ yylhsminor.yy828 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, NULL, yymsp[-2].minor.yy222, yymsp[-1].minor.yy828)); } + yymsp[-3].minor.yy828 = yylhsminor.yy828; + break; + case 443: /* case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ +{ yylhsminor.yy828 = createRawExprNodeExt(pCxt, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy828), yymsp[-2].minor.yy222, yymsp[-1].minor.yy828)); } + yymsp[-4].minor.yy828 = yylhsminor.yy828; + break; + case 446: /* when_then_expr ::= WHEN common_expression THEN common_expression */ +{ yymsp[-3].minor.yy828 = createWhenThenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy828), releaseRawExprNode(pCxt, yymsp[0].minor.yy828)); } + break; + case 448: /* case_when_else_opt ::= ELSE common_expression */ +{ yymsp[-1].minor.yy828 = releaseRawExprNode(pCxt, yymsp[0].minor.yy828); } + break; + case 449: /* predicate ::= expr_or_subquery compare_op expr_or_subquery */ + case 454: /* predicate ::= expr_or_subquery in_op in_predicate_value */ yytestcase(yyruleno==454); { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy140); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy140); - yylhsminor.yy140 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy794, releaseRawExprNode(pCxt, yymsp[-2].minor.yy140), releaseRawExprNode(pCxt, yymsp[0].minor.yy140))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy828); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy828); + yylhsminor.yy828 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy62, releaseRawExprNode(pCxt, yymsp[-2].minor.yy828), releaseRawExprNode(pCxt, yymsp[0].minor.yy828))); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; - case 441: /* predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ + case 450: /* predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy140); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy140); - yylhsminor.yy140 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy140), releaseRawExprNode(pCxt, yymsp[-2].minor.yy140), releaseRawExprNode(pCxt, yymsp[0].minor.yy140))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy828); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy828); + yylhsminor.yy828 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy828), releaseRawExprNode(pCxt, yymsp[-2].minor.yy828), releaseRawExprNode(pCxt, yymsp[0].minor.yy828))); } - yymsp[-4].minor.yy140 = yylhsminor.yy140; + yymsp[-4].minor.yy828 = yylhsminor.yy828; break; - case 442: /* predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ + case 451: /* predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy140); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy140); - yylhsminor.yy140 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy140), releaseRawExprNode(pCxt, yymsp[-2].minor.yy140), releaseRawExprNode(pCxt, yymsp[0].minor.yy140))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy828); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy828); + yylhsminor.yy828 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy828), releaseRawExprNode(pCxt, yymsp[-2].minor.yy828), releaseRawExprNode(pCxt, yymsp[0].minor.yy828))); } - yymsp[-5].minor.yy140 = yylhsminor.yy140; + yymsp[-5].minor.yy828 = yylhsminor.yy828; break; - case 443: /* predicate ::= expr_or_subquery IS NULL */ + case 452: /* predicate ::= expr_or_subquery IS NULL */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy140); - yylhsminor.yy140 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy140), NULL)); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy828); + yylhsminor.yy828 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy828), NULL)); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; - case 444: /* predicate ::= expr_or_subquery IS NOT NULL */ + case 453: /* predicate ::= expr_or_subquery IS NOT NULL */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy140); - yylhsminor.yy140 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy140), NULL)); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy828); + yylhsminor.yy828 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy828), NULL)); } - yymsp[-3].minor.yy140 = yylhsminor.yy140; + yymsp[-3].minor.yy828 = yylhsminor.yy828; break; - case 446: /* compare_op ::= NK_LT */ -{ yymsp[0].minor.yy794 = OP_TYPE_LOWER_THAN; } + case 455: /* compare_op ::= NK_LT */ +{ yymsp[0].minor.yy62 = OP_TYPE_LOWER_THAN; } break; - case 447: /* compare_op ::= NK_GT */ -{ yymsp[0].minor.yy794 = OP_TYPE_GREATER_THAN; } + case 456: /* compare_op ::= NK_GT */ +{ yymsp[0].minor.yy62 = OP_TYPE_GREATER_THAN; } break; - case 448: /* compare_op ::= NK_LE */ -{ yymsp[0].minor.yy794 = OP_TYPE_LOWER_EQUAL; } + case 457: /* compare_op ::= NK_LE */ +{ yymsp[0].minor.yy62 = OP_TYPE_LOWER_EQUAL; } break; - case 449: /* compare_op ::= NK_GE */ -{ yymsp[0].minor.yy794 = OP_TYPE_GREATER_EQUAL; } + case 458: /* compare_op ::= NK_GE */ +{ yymsp[0].minor.yy62 = OP_TYPE_GREATER_EQUAL; } break; - case 450: /* compare_op ::= NK_NE */ -{ yymsp[0].minor.yy794 = OP_TYPE_NOT_EQUAL; } + case 459: /* compare_op ::= NK_NE */ +{ yymsp[0].minor.yy62 = OP_TYPE_NOT_EQUAL; } break; - case 451: /* compare_op ::= NK_EQ */ -{ yymsp[0].minor.yy794 = OP_TYPE_EQUAL; } + case 460: /* compare_op ::= NK_EQ */ +{ yymsp[0].minor.yy62 = OP_TYPE_EQUAL; } break; - case 452: /* compare_op ::= LIKE */ -{ yymsp[0].minor.yy794 = OP_TYPE_LIKE; } + case 461: /* compare_op ::= LIKE */ +{ yymsp[0].minor.yy62 = OP_TYPE_LIKE; } break; - case 453: /* compare_op ::= NOT LIKE */ -{ yymsp[-1].minor.yy794 = OP_TYPE_NOT_LIKE; } + case 462: /* compare_op ::= NOT LIKE */ +{ yymsp[-1].minor.yy62 = OP_TYPE_NOT_LIKE; } break; - case 454: /* compare_op ::= MATCH */ -{ yymsp[0].minor.yy794 = OP_TYPE_MATCH; } + case 463: /* compare_op ::= MATCH */ +{ yymsp[0].minor.yy62 = OP_TYPE_MATCH; } break; - case 455: /* compare_op ::= NMATCH */ -{ yymsp[0].minor.yy794 = OP_TYPE_NMATCH; } + case 464: /* compare_op ::= NMATCH */ +{ yymsp[0].minor.yy62 = OP_TYPE_NMATCH; } break; - case 456: /* compare_op ::= CONTAINS */ -{ yymsp[0].minor.yy794 = OP_TYPE_JSON_CONTAINS; } + case 465: /* compare_op ::= CONTAINS */ +{ yymsp[0].minor.yy62 = OP_TYPE_JSON_CONTAINS; } break; - case 457: /* in_op ::= IN */ -{ yymsp[0].minor.yy794 = OP_TYPE_IN; } + case 466: /* in_op ::= IN */ +{ yymsp[0].minor.yy62 = OP_TYPE_IN; } break; - case 458: /* in_op ::= NOT IN */ -{ yymsp[-1].minor.yy794 = OP_TYPE_NOT_IN; } + case 467: /* in_op ::= NOT IN */ +{ yymsp[-1].minor.yy62 = OP_TYPE_NOT_IN; } break; - case 459: /* in_predicate_value ::= NK_LP literal_list NK_RP */ -{ yylhsminor.yy140 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy220)); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 468: /* in_predicate_value ::= NK_LP literal_list NK_RP */ +{ yylhsminor.yy828 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy222)); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; - case 461: /* boolean_value_expression ::= NOT boolean_primary */ + case 470: /* boolean_value_expression ::= NOT boolean_primary */ { - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy140); - yylhsminor.yy140 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy140), NULL)); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy828); + yylhsminor.yy828 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy828), NULL)); } - yymsp[-1].minor.yy140 = yylhsminor.yy140; + yymsp[-1].minor.yy828 = yylhsminor.yy828; break; - case 462: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + case 471: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy140); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy140); - yylhsminor.yy140 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy140), releaseRawExprNode(pCxt, yymsp[0].minor.yy140))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy828); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy828); + yylhsminor.yy828 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy828), releaseRawExprNode(pCxt, yymsp[0].minor.yy828))); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; - case 463: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + case 472: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy140); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy140); - yylhsminor.yy140 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy140), releaseRawExprNode(pCxt, yymsp[0].minor.yy140))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy828); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy828); + yylhsminor.yy828 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy828), releaseRawExprNode(pCxt, yymsp[0].minor.yy828))); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; - case 469: /* from_clause_opt ::= FROM table_reference_list */ - case 498: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==498); - case 529: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==529); -{ yymsp[-1].minor.yy140 = yymsp[0].minor.yy140; } + case 478: /* from_clause_opt ::= FROM table_reference_list */ + case 507: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==507); + case 538: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==538); +{ yymsp[-1].minor.yy828 = yymsp[0].minor.yy828; } break; - case 471: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ -{ yylhsminor.yy140 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy140, yymsp[0].minor.yy140, NULL); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 480: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ +{ yylhsminor.yy828 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy828, yymsp[0].minor.yy828, NULL); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; - case 474: /* table_primary ::= table_name alias_opt */ -{ yylhsminor.yy140 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy881, &yymsp[0].minor.yy881); } - yymsp[-1].minor.yy140 = yylhsminor.yy140; + case 483: /* table_primary ::= table_name alias_opt */ +{ yylhsminor.yy828 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy63, &yymsp[0].minor.yy63); } + yymsp[-1].minor.yy828 = yylhsminor.yy828; break; - case 475: /* table_primary ::= db_name NK_DOT table_name alias_opt */ -{ yylhsminor.yy140 = createRealTableNode(pCxt, &yymsp[-3].minor.yy881, &yymsp[-1].minor.yy881, &yymsp[0].minor.yy881); } - yymsp[-3].minor.yy140 = yylhsminor.yy140; + case 484: /* table_primary ::= db_name NK_DOT table_name alias_opt */ +{ yylhsminor.yy828 = createRealTableNode(pCxt, &yymsp[-3].minor.yy63, &yymsp[-1].minor.yy63, &yymsp[0].minor.yy63); } + yymsp[-3].minor.yy828 = yylhsminor.yy828; break; - case 476: /* table_primary ::= subquery alias_opt */ -{ yylhsminor.yy140 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy140), &yymsp[0].minor.yy881); } - yymsp[-1].minor.yy140 = yylhsminor.yy140; + case 485: /* table_primary ::= subquery alias_opt */ +{ yylhsminor.yy828 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy828), &yymsp[0].minor.yy63); } + yymsp[-1].minor.yy828 = yylhsminor.yy828; break; - case 478: /* alias_opt ::= */ -{ yymsp[1].minor.yy881 = nil_token; } + case 487: /* alias_opt ::= */ +{ yymsp[1].minor.yy63 = nil_token; } break; - case 480: /* alias_opt ::= AS table_alias */ -{ yymsp[-1].minor.yy881 = yymsp[0].minor.yy881; } + case 489: /* alias_opt ::= AS table_alias */ +{ yymsp[-1].minor.yy63 = yymsp[0].minor.yy63; } break; - case 481: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - case 482: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==482); -{ yymsp[-2].minor.yy140 = yymsp[-1].minor.yy140; } + case 490: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + case 491: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==491); +{ yymsp[-2].minor.yy828 = yymsp[-1].minor.yy828; } break; - case 483: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ -{ yylhsminor.yy140 = createJoinTableNode(pCxt, yymsp[-4].minor.yy852, yymsp[-5].minor.yy140, yymsp[-2].minor.yy140, yymsp[0].minor.yy140); } - yymsp[-5].minor.yy140 = yylhsminor.yy140; + case 492: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ +{ yylhsminor.yy828 = createJoinTableNode(pCxt, yymsp[-4].minor.yy574, yymsp[-5].minor.yy828, yymsp[-2].minor.yy828, yymsp[0].minor.yy828); } + yymsp[-5].minor.yy828 = yylhsminor.yy828; break; - case 484: /* join_type ::= */ -{ yymsp[1].minor.yy852 = JOIN_TYPE_INNER; } + case 493: /* join_type ::= */ +{ yymsp[1].minor.yy574 = JOIN_TYPE_INNER; } break; - case 485: /* join_type ::= INNER */ -{ yymsp[0].minor.yy852 = JOIN_TYPE_INNER; } + case 494: /* join_type ::= INNER */ +{ yymsp[0].minor.yy574 = JOIN_TYPE_INNER; } break; - case 486: /* query_specification ::= SELECT set_quantifier_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 */ + case 495: /* query_specification ::= SELECT set_quantifier_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[-11].minor.yy140 = createSelectStmt(pCxt, yymsp[-10].minor.yy587, yymsp[-9].minor.yy220, yymsp[-8].minor.yy140); - yymsp[-11].minor.yy140 = addWhereClause(pCxt, yymsp[-11].minor.yy140, yymsp[-7].minor.yy140); - yymsp[-11].minor.yy140 = addPartitionByClause(pCxt, yymsp[-11].minor.yy140, yymsp[-6].minor.yy220); - yymsp[-11].minor.yy140 = addWindowClauseClause(pCxt, yymsp[-11].minor.yy140, yymsp[-2].minor.yy140); - yymsp[-11].minor.yy140 = addGroupByClause(pCxt, yymsp[-11].minor.yy140, yymsp[-1].minor.yy220); - yymsp[-11].minor.yy140 = addHavingClause(pCxt, yymsp[-11].minor.yy140, yymsp[0].minor.yy140); - yymsp[-11].minor.yy140 = addRangeClause(pCxt, yymsp[-11].minor.yy140, yymsp[-5].minor.yy140); - yymsp[-11].minor.yy140 = addEveryClause(pCxt, yymsp[-11].minor.yy140, yymsp[-4].minor.yy140); - yymsp[-11].minor.yy140 = addFillClause(pCxt, yymsp[-11].minor.yy140, yymsp[-3].minor.yy140); + yymsp[-11].minor.yy828 = createSelectStmt(pCxt, yymsp[-10].minor.yy669, yymsp[-9].minor.yy222, yymsp[-8].minor.yy828); + yymsp[-11].minor.yy828 = addWhereClause(pCxt, yymsp[-11].minor.yy828, yymsp[-7].minor.yy828); + yymsp[-11].minor.yy828 = addPartitionByClause(pCxt, yymsp[-11].minor.yy828, yymsp[-6].minor.yy222); + yymsp[-11].minor.yy828 = addWindowClauseClause(pCxt, yymsp[-11].minor.yy828, yymsp[-2].minor.yy828); + yymsp[-11].minor.yy828 = addGroupByClause(pCxt, yymsp[-11].minor.yy828, yymsp[-1].minor.yy222); + yymsp[-11].minor.yy828 = addHavingClause(pCxt, yymsp[-11].minor.yy828, yymsp[0].minor.yy828); + yymsp[-11].minor.yy828 = addRangeClause(pCxt, yymsp[-11].minor.yy828, yymsp[-5].minor.yy828); + yymsp[-11].minor.yy828 = addEveryClause(pCxt, yymsp[-11].minor.yy828, yymsp[-4].minor.yy828); + yymsp[-11].minor.yy828 = addFillClause(pCxt, yymsp[-11].minor.yy828, yymsp[-3].minor.yy828); } break; - case 489: /* set_quantifier_opt ::= ALL */ -{ yymsp[0].minor.yy587 = false; } + case 498: /* set_quantifier_opt ::= ALL */ +{ yymsp[0].minor.yy669 = false; } break; - case 492: /* select_item ::= NK_STAR */ -{ yylhsminor.yy140 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy140 = yylhsminor.yy140; + case 501: /* select_item ::= NK_STAR */ +{ yylhsminor.yy828 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy828 = yylhsminor.yy828; break; - case 494: /* select_item ::= common_expression column_alias */ - case 504: /* partition_item ::= expr_or_subquery column_alias */ yytestcase(yyruleno==504); -{ yylhsminor.yy140 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy140), &yymsp[0].minor.yy881); } - yymsp[-1].minor.yy140 = yylhsminor.yy140; + case 503: /* select_item ::= common_expression column_alias */ + case 513: /* partition_item ::= expr_or_subquery column_alias */ yytestcase(yyruleno==513); +{ yylhsminor.yy828 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy828), &yymsp[0].minor.yy63); } + yymsp[-1].minor.yy828 = yylhsminor.yy828; break; - case 495: /* select_item ::= common_expression AS column_alias */ - case 505: /* partition_item ::= expr_or_subquery AS column_alias */ yytestcase(yyruleno==505); -{ yylhsminor.yy140 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy140), &yymsp[0].minor.yy881); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 504: /* select_item ::= common_expression AS column_alias */ + case 514: /* partition_item ::= expr_or_subquery AS column_alias */ yytestcase(yyruleno==514); +{ yylhsminor.yy828 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy828), &yymsp[0].minor.yy63); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; - case 500: /* partition_by_clause_opt ::= PARTITION BY partition_list */ - case 525: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==525); - case 544: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==544); -{ yymsp[-2].minor.yy220 = yymsp[0].minor.yy220; } + case 509: /* partition_by_clause_opt ::= PARTITION BY partition_list */ + case 534: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==534); + case 553: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==553); +{ yymsp[-2].minor.yy222 = yymsp[0].minor.yy222; } break; - case 507: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ -{ yymsp[-5].minor.yy140 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy140), releaseRawExprNode(pCxt, yymsp[-1].minor.yy140)); } + case 516: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ +{ yymsp[-5].minor.yy828 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy828), releaseRawExprNode(pCxt, yymsp[-1].minor.yy828)); } break; - case 508: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ -{ yymsp[-3].minor.yy140 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy140)); } + case 517: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ +{ yymsp[-3].minor.yy828 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy828)); } break; - case 509: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ -{ yymsp[-5].minor.yy140 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy140), NULL, yymsp[-1].minor.yy140, yymsp[0].minor.yy140); } + case 518: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ +{ yymsp[-5].minor.yy828 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy828), NULL, yymsp[-1].minor.yy828, yymsp[0].minor.yy828); } break; - case 510: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ -{ yymsp[-7].minor.yy140 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy140), releaseRawExprNode(pCxt, yymsp[-3].minor.yy140), yymsp[-1].minor.yy140, yymsp[0].minor.yy140); } + case 519: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ +{ yymsp[-7].minor.yy828 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy828), releaseRawExprNode(pCxt, yymsp[-3].minor.yy828), yymsp[-1].minor.yy828, yymsp[0].minor.yy828); } break; - case 511: /* twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ -{ yymsp[-6].minor.yy140 = createEventWindowNode(pCxt, yymsp[-3].minor.yy140, yymsp[0].minor.yy140); } + case 520: /* twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ +{ yymsp[-6].minor.yy828 = createEventWindowNode(pCxt, yymsp[-3].minor.yy828, yymsp[0].minor.yy828); } break; - case 515: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ -{ yymsp[-3].minor.yy140 = createFillNode(pCxt, yymsp[-1].minor.yy174, NULL); } + case 524: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ +{ yymsp[-3].minor.yy828 = createFillNode(pCxt, yymsp[-1].minor.yy822, NULL); } break; - case 516: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ -{ yymsp[-5].minor.yy140 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy220)); } + case 525: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ +{ yymsp[-5].minor.yy828 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy222)); } break; - case 517: /* fill_opt ::= FILL NK_LP VALUE_F NK_COMMA literal_list NK_RP */ -{ yymsp[-5].minor.yy140 = createFillNode(pCxt, FILL_MODE_VALUE_F, createNodeListNode(pCxt, yymsp[-1].minor.yy220)); } + case 526: /* fill_opt ::= FILL NK_LP VALUE_F NK_COMMA literal_list NK_RP */ +{ yymsp[-5].minor.yy828 = createFillNode(pCxt, FILL_MODE_VALUE_F, createNodeListNode(pCxt, yymsp[-1].minor.yy222)); } break; - case 518: /* fill_mode ::= NONE */ -{ yymsp[0].minor.yy174 = FILL_MODE_NONE; } + case 527: /* fill_mode ::= NONE */ +{ yymsp[0].minor.yy822 = FILL_MODE_NONE; } break; - case 519: /* fill_mode ::= PREV */ -{ yymsp[0].minor.yy174 = FILL_MODE_PREV; } + case 528: /* fill_mode ::= PREV */ +{ yymsp[0].minor.yy822 = FILL_MODE_PREV; } break; - case 520: /* fill_mode ::= NULL */ -{ yymsp[0].minor.yy174 = FILL_MODE_NULL; } + case 529: /* fill_mode ::= NULL */ +{ yymsp[0].minor.yy822 = FILL_MODE_NULL; } break; - case 521: /* fill_mode ::= NULL_F */ -{ yymsp[0].minor.yy174 = FILL_MODE_NULL_F; } + case 530: /* fill_mode ::= NULL_F */ +{ yymsp[0].minor.yy822 = FILL_MODE_NULL_F; } break; - case 522: /* fill_mode ::= LINEAR */ -{ yymsp[0].minor.yy174 = FILL_MODE_LINEAR; } + case 531: /* fill_mode ::= LINEAR */ +{ yymsp[0].minor.yy822 = FILL_MODE_LINEAR; } break; - case 523: /* fill_mode ::= NEXT */ -{ yymsp[0].minor.yy174 = FILL_MODE_NEXT; } + case 532: /* fill_mode ::= NEXT */ +{ yymsp[0].minor.yy822 = FILL_MODE_NEXT; } break; - case 526: /* group_by_list ::= expr_or_subquery */ -{ yylhsminor.yy220 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy140))); } - yymsp[0].minor.yy220 = yylhsminor.yy220; + case 535: /* group_by_list ::= expr_or_subquery */ +{ yylhsminor.yy222 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy828))); } + yymsp[0].minor.yy222 = yylhsminor.yy222; break; - case 527: /* group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ -{ yylhsminor.yy220 = addNodeToList(pCxt, yymsp[-2].minor.yy220, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy140))); } - yymsp[-2].minor.yy220 = yylhsminor.yy220; + case 536: /* group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ +{ yylhsminor.yy222 = addNodeToList(pCxt, yymsp[-2].minor.yy222, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy828))); } + yymsp[-2].minor.yy222 = yylhsminor.yy222; break; - case 531: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ -{ yymsp[-5].minor.yy140 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy140), releaseRawExprNode(pCxt, yymsp[-1].minor.yy140)); } + case 540: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ +{ yymsp[-5].minor.yy828 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy828), releaseRawExprNode(pCxt, yymsp[-1].minor.yy828)); } break; - case 534: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ + case 543: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ { - yylhsminor.yy140 = addOrderByClause(pCxt, yymsp[-3].minor.yy140, yymsp[-2].minor.yy220); - yylhsminor.yy140 = addSlimitClause(pCxt, yylhsminor.yy140, yymsp[-1].minor.yy140); - yylhsminor.yy140 = addLimitClause(pCxt, yylhsminor.yy140, yymsp[0].minor.yy140); + yylhsminor.yy828 = addOrderByClause(pCxt, yymsp[-3].minor.yy828, yymsp[-2].minor.yy222); + yylhsminor.yy828 = addSlimitClause(pCxt, yylhsminor.yy828, yymsp[-1].minor.yy828); + yylhsminor.yy828 = addLimitClause(pCxt, yylhsminor.yy828, yymsp[0].minor.yy828); } - yymsp[-3].minor.yy140 = yylhsminor.yy140; + yymsp[-3].minor.yy828 = yylhsminor.yy828; break; - case 537: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ -{ yylhsminor.yy140 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy140, yymsp[0].minor.yy140); } - yymsp[-3].minor.yy140 = yylhsminor.yy140; + case 546: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ +{ yylhsminor.yy828 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy828, yymsp[0].minor.yy828); } + yymsp[-3].minor.yy828 = yylhsminor.yy828; break; - case 538: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ -{ yylhsminor.yy140 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy140, yymsp[0].minor.yy140); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 547: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ +{ yylhsminor.yy828 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy828, yymsp[0].minor.yy828); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; - case 546: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ - case 550: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==550); -{ yymsp[-1].minor.yy140 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } + case 555: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ + case 559: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==559); +{ yymsp[-1].minor.yy828 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } break; - case 547: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - case 551: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==551); -{ yymsp[-3].minor.yy140 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } + case 556: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + case 560: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==560); +{ yymsp[-3].minor.yy828 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } break; - case 548: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - case 552: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==552); -{ yymsp[-3].minor.yy140 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } + case 557: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + case 561: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==561); +{ yymsp[-3].minor.yy828 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } break; - case 553: /* subquery ::= NK_LP query_expression NK_RP */ -{ yylhsminor.yy140 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy140); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 562: /* subquery ::= NK_LP query_expression NK_RP */ +{ yylhsminor.yy828 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy828); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; - case 558: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ -{ yylhsminor.yy140 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy140), yymsp[-1].minor.yy866, yymsp[0].minor.yy697); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 567: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ +{ yylhsminor.yy828 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy828), yymsp[-1].minor.yy158, yymsp[0].minor.yy675); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; - case 559: /* ordering_specification_opt ::= */ -{ yymsp[1].minor.yy866 = ORDER_ASC; } + case 568: /* ordering_specification_opt ::= */ +{ yymsp[1].minor.yy158 = ORDER_ASC; } break; - case 560: /* ordering_specification_opt ::= ASC */ -{ yymsp[0].minor.yy866 = ORDER_ASC; } + case 569: /* ordering_specification_opt ::= ASC */ +{ yymsp[0].minor.yy158 = ORDER_ASC; } break; - case 561: /* ordering_specification_opt ::= DESC */ -{ yymsp[0].minor.yy866 = ORDER_DESC; } + case 570: /* ordering_specification_opt ::= DESC */ +{ yymsp[0].minor.yy158 = ORDER_DESC; } break; - case 562: /* null_ordering_opt ::= */ -{ yymsp[1].minor.yy697 = NULL_ORDER_DEFAULT; } + case 571: /* null_ordering_opt ::= */ +{ yymsp[1].minor.yy675 = NULL_ORDER_DEFAULT; } break; - case 563: /* null_ordering_opt ::= NULLS FIRST */ -{ yymsp[-1].minor.yy697 = NULL_ORDER_FIRST; } + case 572: /* null_ordering_opt ::= NULLS FIRST */ +{ yymsp[-1].minor.yy675 = NULL_ORDER_FIRST; } break; - case 564: /* null_ordering_opt ::= NULLS LAST */ -{ yymsp[-1].minor.yy697 = NULL_ORDER_LAST; } + case 573: /* null_ordering_opt ::= NULLS LAST */ +{ yymsp[-1].minor.yy675 = NULL_ORDER_LAST; } break; default: break; diff --git a/source/libs/parser/test/mockCatalog.cpp b/source/libs/parser/test/mockCatalog.cpp index c3f6c3ac72c70b799500b1e70cc31b72e585d575..1af214bfb4033502ece07a0f03455f60bd3bed18 100644 --- a/source/libs/parser/test/mockCatalog.cpp +++ b/source/libs/parser/test/mockCatalog.cpp @@ -226,6 +226,7 @@ void generateDatabases(MockCatalogService* mcs) { generateTestTables(g_mockCatalogService.get(), "cache_db"); generateTestStables(g_mockCatalogService.get(), "cache_db"); mcs->createDatabase("rollup_db", true); + mcs->createDatabase("testus", false, 0, TSDB_TIME_PRECISION_NANO); } } // namespace @@ -252,7 +253,8 @@ int32_t __catalogGetCachedTableHashVgroup(SCatalog* pCtg, const SName* pTableNam return code; } -int32_t __catalogGetCachedTableVgMeta(SCatalog* pCtg, const SName* pTableName, SVgroupInfo* pVgroup, STableMeta** pTableMeta) { +int32_t __catalogGetCachedTableVgMeta(SCatalog* pCtg, const SName* pTableName, SVgroupInfo* pVgroup, + STableMeta** pTableMeta) { int32_t code = g_mockCatalogService->catalogGetTableMeta(pTableName, pTableMeta, true); if (code) return code; code = g_mockCatalogService->catalogGetTableHashVgroup(pTableName, pVgroup, true); diff --git a/source/libs/parser/test/mockCatalogService.cpp b/source/libs/parser/test/mockCatalogService.cpp index 71b7c1a678b92f2ba8f7b16db10f55e949af1bbe..4d1ef597d0b5907e05dba6cc9c565d3b5ec7d75c 100644 --- a/source/libs/parser/test/mockCatalogService.cpp +++ b/source/libs/parser/test/mockCatalogService.cpp @@ -346,12 +346,13 @@ class MockCatalogServiceImpl { dnode_.insert(std::make_pair(dnodeId, epSet)); } - void createDatabase(const string& db, bool rollup, int8_t cacheLast) { + void createDatabase(const string& db, bool rollup, int8_t cacheLast, int8_t precision) { SDbCfgInfo cfg = {0}; if (rollup) { cfg.pRetensions = taosArrayInit(TARRAY_MIN_SIZE, sizeof(SRetention)); } cfg.cacheLast = cacheLast; + cfg.precision = precision; dbCfg_.insert(std::make_pair(db, cfg)); } @@ -681,8 +682,8 @@ void MockCatalogService::createDnode(int32_t dnodeId, const string& host, int16_ impl_->createDnode(dnodeId, host, port); } -void MockCatalogService::createDatabase(const string& db, bool rollup, int8_t cacheLast) { - impl_->createDatabase(db, rollup, cacheLast); +void MockCatalogService::createDatabase(const string& db, bool rollup, int8_t cacheLast, int8_t precision) { + impl_->createDatabase(db, rollup, cacheLast, precision); } int32_t MockCatalogService::catalogGetTableMeta(const SName* pTableName, STableMeta** pTableMeta, diff --git a/source/libs/parser/test/mockCatalogService.h b/source/libs/parser/test/mockCatalogService.h index acd7fab8e17e2f9843d8b9beb3848f4f32c64c2b..cc955df2b0ba8e7811a3cd43ddab378b29ecc9fc 100644 --- a/source/libs/parser/test/mockCatalogService.h +++ b/source/libs/parser/test/mockCatalogService.h @@ -65,7 +65,8 @@ class MockCatalogService { void createFunction(const std::string& func, int8_t funcType, int8_t outputType, int32_t outputLen, int32_t bufSize); void createSmaIndex(const SMCreateSmaReq* pReq); void createDnode(int32_t dnodeId, const std::string& host, int16_t port); - void createDatabase(const std::string& db, bool rollup = false, int8_t cacheLast = 0); + void createDatabase(const std::string& db, bool rollup = false, int8_t cacheLast = 0, + int8_t precision = TSDB_TIME_PRECISION_MILLI); int32_t catalogGetTableMeta(const SName* pTableName, STableMeta** pTableMeta, bool onlyCache = false) const; int32_t catalogGetTableHashVgroup(const SName* pTableName, SVgroupInfo* vgInfo, bool onlyCache = false) const; diff --git a/source/libs/parser/test/parAlterToBalanceTest.cpp b/source/libs/parser/test/parAlterToBalanceTest.cpp index bfcf6ec27e7eec142a4a586bc31c61a8690b51a3..4cccfd449c1b33410be910a44ab7f3071839f26f 100644 --- a/source/libs/parser/test/parAlterToBalanceTest.cpp +++ b/source/libs/parser/test/parAlterToBalanceTest.cpp @@ -108,6 +108,7 @@ TEST_F(ParserInitialATest, alterDnode) { * | REPLICA int_value -- todo: enum 1, 3, default 1, unit replica * | WAL_LEVEL int_value -- enum 1, 2, default 1 * | STT_TRIGGER int_value -- rang [1, 16], default 8 + * | MINROWS int_value -- rang [10, 1000], default 100 * } */ TEST_F(ParserInitialATest, alterDatabase) { @@ -133,6 +134,7 @@ TEST_F(ParserInitialATest, alterDatabase) { expect.cacheLastSize = -1; expect.replications = -1; expect.sstTrigger = -1; + expect.minRows = -1; }; auto setAlterDbBuffer = [&](int32_t buffer) { expect.buffer = buffer; }; auto setAlterDbPageSize = [&](int32_t pageSize) { expect.pageSize = pageSize; }; @@ -150,6 +152,7 @@ TEST_F(ParserInitialATest, alterDatabase) { auto setAlterDbCacheModel = [&](int8_t cacheModel) { expect.cacheLast = cacheModel; }; auto setAlterDbReplica = [&](int8_t replications) { expect.replications = replications; }; auto setAlterDbSttTrigger = [&](int8_t sstTrigger) { expect.sstTrigger = sstTrigger; }; + auto setAlterDbMinRows = [&](int32_t minRows) { expect.minRows = minRows; }; setCheckDdlFunc([&](const SQuery* pQuery, ParserStage stage) { ASSERT_EQ(nodeType(pQuery->pRoot), QUERY_NODE_ALTER_DATABASE_STMT); @@ -170,6 +173,7 @@ TEST_F(ParserInitialATest, alterDatabase) { ASSERT_EQ(req.cacheLast, expect.cacheLast); ASSERT_EQ(req.replications, expect.replications); ASSERT_EQ(req.sstTrigger, expect.sstTrigger); + ASSERT_EQ(req.minRows, expect.minRows); }); const int32_t MINUTE_PER_DAY = MILLISECOND_PER_DAY / MILLISECOND_PER_MINUTE; @@ -277,6 +281,15 @@ TEST_F(ParserInitialATest, alterDatabase) { setAlterDbSttTrigger(16); run("ALTER DATABASE test STT_TRIGGER 16"); clearAlterDbReq(); + + initAlterDb("test"); + setAlterDbMinRows(10); + run("ALTER DATABASE test MINROWS 10"); + setAlterDbMinRows(50); + run("ALTER DATABASE test MINROWS 50"); + setAlterDbMinRows(1000); + run("ALTER DATABASE test MINROWS 1000"); + clearAlterDbReq(); } TEST_F(ParserInitialATest, alterDatabaseSemanticCheck) { diff --git a/source/libs/parser/test/parInitialCTest.cpp b/source/libs/parser/test/parInitialCTest.cpp index 19ed7975d026f912e739a0a7c397d88b12f413fa..2dffdae934453bb8f5284c0d3f8972887e898584 100644 --- a/source/libs/parser/test/parInitialCTest.cpp +++ b/source/libs/parser/test/parInitialCTest.cpp @@ -24,12 +24,16 @@ namespace ParserTest { class ParserInitialCTest : public ParserDdlTest {}; /* - * COMPACT DATABASE db_name + * COMPACT DATABASE db_name [START WITH start_time] [END WITH END_time] */ TEST_F(ParserInitialCTest, compact) { SCompactDbReq expect = {0}; - auto setCompactDbReq = [&](const char* pDb) { snprintf(expect.db, sizeof(expect.db), "0.%s", pDb); }; + auto setCompactDbReq = [&](const char* pDb, int64_t start = INT64_MIN, int64_t end = INT64_MAX) { + snprintf(expect.db, sizeof(expect.db), "0.%s", pDb); + expect.timeRange.skey = start; + expect.timeRange.ekey = end; + }; setCheckDdlFunc([&](const SQuery* pQuery, ParserStage stage) { ASSERT_EQ(nodeType(pQuery->pRoot), QUERY_NODE_COMPACT_DATABASE_STMT); @@ -37,10 +41,21 @@ TEST_F(ParserInitialCTest, compact) { SCompactDbReq req = {0}; ASSERT_EQ(tDeserializeSCompactDbReq(pQuery->pCmdMsg->pMsg, pQuery->pCmdMsg->msgLen, &req), TSDB_CODE_SUCCESS); ASSERT_EQ(std::string(req.db), std::string(expect.db)); + ASSERT_EQ(req.timeRange.skey, expect.timeRange.skey); + ASSERT_EQ(req.timeRange.ekey, expect.timeRange.ekey); }); - setCompactDbReq("wxy_db"); - run("COMPACT DATABASE wxy_db"); + setCompactDbReq("test"); + run("COMPACT DATABASE test"); + + setCompactDbReq("test", 1678168883000, 1678255283000); + run("COMPACT DATABASE test START WITH '2023-03-07 14:01:23' END WITH '2023-03-08 14:01:23'"); + + setCompactDbReq("testus", 1673071283000000000); + run("COMPACT DATABASE testus START WITH TIMESTAMP '2023-01-07 14:01:23'"); + + setCompactDbReq("testus", INT64_MIN, 1675749683000000000); + run("COMPACT DATABASE testus END WITH 1675749683000000000"); } /* @@ -797,16 +812,10 @@ TEST_F(ParserInitialCTest, createStream) { snprintf(expect.targetStbFullName, sizeof(expect.targetStbFullName), "0.test.%s", pDstStb); expect.igExists = igExists; expect.sql = taosStrdup(pSql); - expect.createStb = STREAM_CREATE_STABLE_TRUE; - expect.triggerType = STREAM_TRIGGER_AT_ONCE; - expect.maxDelay = 0; - expect.watermark = 0; - expect.fillHistory = STREAM_DEFAULT_FILL_HISTORY; - expect.igExpired = STREAM_DEFAULT_IGNORE_EXPIRED; }; auto setStreamOptions = - [&](int8_t createStb = STREAM_CREATE_STABLE_TRUE, int8_t triggerType = STREAM_TRIGGER_AT_ONCE, + [&](int8_t createStb = STREAM_CREATE_STABLE_TRUE, int8_t triggerType = STREAM_TRIGGER_WINDOW_CLOSE, int64_t maxDelay = 0, int64_t watermark = 0, int8_t igExpired = STREAM_DEFAULT_IGNORE_EXPIRED, int8_t fillHistory = STREAM_DEFAULT_FILL_HISTORY, int8_t igUpdate = STREAM_DEFAULT_IGNORE_UPDATE) { expect.createStb = createStb; @@ -868,6 +877,7 @@ TEST_F(ParserInitialCTest, createStream) { }); setCreateStreamReq("s1", "test", "create stream s1 into st3 as select count(*) from t1 interval(10s)", "st3"); + setStreamOptions(); run("CREATE STREAM s1 INTO st3 AS SELECT COUNT(*) FROM t1 INTERVAL(10S)"); clearCreateStreamReq(); @@ -888,6 +898,7 @@ TEST_F(ParserInitialCTest, createStream) { "st3"); addTag("tname", TSDB_DATA_TYPE_VARCHAR, 10 + VARSTR_HEADER_SIZE); addTag("id", TSDB_DATA_TYPE_INT); + setStreamOptions(); run("CREATE STREAM s1 INTO st3 TAGS(tname VARCHAR(10), id INT) SUBTABLE(CONCAT('new-', tname)) " "AS SELECT _WSTART wstart, COUNT(*) cnt FROM st1 PARTITION BY TBNAME tname, tag1 id INTERVAL(10S)"); clearCreateStreamReq(); diff --git a/source/libs/parser/test/parTestUtil.cpp b/source/libs/parser/test/parTestUtil.cpp index f18dd4f17f67b9d35990d6c326b11b26c3033a47..dfe9fcf96e74175484090d9bbf2b8bfc36ccf53b 100644 --- a/source/libs/parser/test/parTestUtil.cpp +++ b/source/libs/parser/test/parTestUtil.cpp @@ -65,15 +65,16 @@ int32_t getLogLevel() { return g_logLevel; } class ParserTestBaseImpl { public: - ParserTestBaseImpl(ParserTestBase* pBase) : pBase_(pBase), sqlNo_(0), sqlNum_(0) {} + ParserTestBaseImpl(ParserTestBase* pBase) : pBase_(pBase), sqlNo_(0), sqlNum_(0) { + caseEnv_.numOfSkipSql_ = g_skipSql; + caseEnv_.numOfLimitSql_ = g_limitSql; + } void login(const std::string& user) { caseEnv_.user_ = user; } void useDb(const string& acctId, const string& db) { caseEnv_.acctId_ = acctId; caseEnv_.db_ = db; - caseEnv_.numOfSkipSql_ = g_skipSql; - caseEnv_.numOfLimitSql_ = g_limitSql; } void run(const string& sql, int32_t expect, ParserStage checkStage) { diff --git a/source/libs/scalar/src/scalar.c b/source/libs/scalar/src/scalar.c index 25938a7678967a32d2f6f9193f14710a42de61cd..fe01977b2e2803e6797df2bc730177eb28aa6617 100644 --- a/source/libs/scalar/src/scalar.c +++ b/source/libs/scalar/src/scalar.c @@ -59,6 +59,8 @@ int32_t sclCreateColumnInfoData(SDataType *pType, int32_t numOfRows, SScalarPara pParam->columnData = pColumnData; pParam->colAlloced = true; + pParam->numOfRows = numOfRows; + return TSDB_CODE_SUCCESS; } @@ -740,6 +742,10 @@ int32_t sclExecFunction(SFunctionNode *node, SScalarCtx *ctx, SScalarParam *outp SCL_ERR_JRET(code); } + if (rowNum == 0) { + goto _return; + } + code = (*ffpSet.process)(params, paramNum, output); if (code) { sclError("scalar function exec failed, funcId:%d, code:%s", node->funcId, tstrerror(code)); diff --git a/source/libs/scalar/src/sclfunc.c b/source/libs/scalar/src/sclfunc.c index f4c36695742a7f266cee4bee6494b83fd3a96c9a..195a08525c3d502e9cae6ab49c23658bda9f2f24 100644 --- a/source/libs/scalar/src/sclfunc.c +++ b/source/libs/scalar/src/sclfunc.c @@ -1055,9 +1055,9 @@ int32_t toISO8601Function(SScalarParam *pInput, int32_t inputNum, SScalarParam * if (tsDigits == TSDB_TIME_PRECISION_MILLI_DIGITS) { timeVal = timeVal / 1000; } else if (tsDigits == TSDB_TIME_PRECISION_MICRO_DIGITS) { - timeVal = timeVal / (1000 * 1000); + timeVal = timeVal / ((int64_t)(1000 * 1000)); } else if (tsDigits == TSDB_TIME_PRECISION_NANO_DIGITS) { - timeVal = timeVal / (1000 * 1000 * 1000); + timeVal = timeVal / ((int64_t)(1000 * 1000 * 1000)); } else { colDataSetNULL(pOutput->columnData, i); continue; @@ -1317,19 +1317,19 @@ int32_t timeTruncateFunction(SScalarParam *pInput, int32_t inputNum, SScalarPara case 86400000: { /* 1d */ if (tsDigits == TSDB_TIME_PRECISION_MILLI_DIGITS) { if (ignoreTz) { - timeVal = timeVal - (timeVal + offsetFromTz(timezone, 1000)) % (86400L * 1000); + timeVal = timeVal - (timeVal + offsetFromTz(timezone, 1000)) % (((int64_t)86400) * 1000); } else { timeVal = timeVal / 1000 / 86400 * 86400 * 1000; } } else if (tsDigits == TSDB_TIME_PRECISION_MICRO_DIGITS) { if (ignoreTz) { - timeVal = timeVal - (timeVal + offsetFromTz(timezone, 1000000)) % (86400L * 1000000); + timeVal = timeVal - (timeVal + offsetFromTz(timezone, 1000000)) % (((int64_t)86400) * 1000000); } else { timeVal = timeVal / 1000000 / 86400 * 86400 * 1000000; } } else if (tsDigits == TSDB_TIME_PRECISION_NANO_DIGITS) { if (ignoreTz) { - timeVal = timeVal - (timeVal + offsetFromTz(timezone, 1000000000)) % (86400L * 1000000000); + timeVal = timeVal - (timeVal + offsetFromTz(timezone, 1000000000)) % (((int64_t)86400) * 1000000000); } else { timeVal = timeVal / 1000000000 / 86400 * 86400 * 1000000000; } diff --git a/source/libs/scalar/src/sclvector.c b/source/libs/scalar/src/sclvector.c index 3fe016d444854007a6866d70fa3dfa29c0697201..4d803cb6388c75211dcea9db6a0dc353b91c71aa 100644 --- a/source/libs/scalar/src/sclvector.c +++ b/source/libs/scalar/src/sclvector.c @@ -915,6 +915,7 @@ int32_t vectorConvertSingleCol(SScalarParam *input, SScalarParam *output, int32_ SDataType t = {.type = type}; t.bytes = IS_VAR_DATA_TYPE(t.type)? input->columnData->info.bytes:tDataTypes[type].bytes; + t.precision = input->columnData->info.precision; int32_t code = sclCreateColumnInfoData(&t, input->numOfRows, output); if (code != TSDB_CODE_SUCCESS) { diff --git a/source/libs/stream/src/streamDispatch.c b/source/libs/stream/src/streamDispatch.c index f2b1db19e8eb3a15f9edf04d1bbbac3a6c750e0c..7e7c23f98addfae5689093bedb1a86196cd380c9 100644 --- a/source/libs/stream/src/streamDispatch.c +++ b/source/libs/stream/src/streamDispatch.c @@ -278,6 +278,7 @@ int32_t streamDispatchOneRecoverFinishReq(SStreamTask* pTask, const SStreamRecov msg.contLen = tlen + sizeof(SMsgHead); msg.pCont = buf; msg.msgType = TDMT_STREAM_RECOVER_FINISH; + msg.info.noResp = 1; tmsgSendReq(pEpSet, &msg); @@ -522,4 +523,3 @@ FREE: taosFreeQitem(pBlock); return code; } - diff --git a/source/libs/stream/src/streamExec.c b/source/libs/stream/src/streamExec.c index 9226d6ebb8dabc349c333470b0fc2d44396c2c0b..cb9774b584937bc0846a0e761cceda37036b83d4 100644 --- a/source/libs/stream/src/streamExec.c +++ b/source/libs/stream/src/streamExec.c @@ -20,6 +20,11 @@ static int32_t streamTaskExecImpl(SStreamTask* pTask, const void* data, SArray* pRes) { int32_t code; void* exec = pTask->exec.executor; + while(atomic_load_8(&pTask->taskStatus) != TASK_STATUS__NORMAL) { + qError("stream task wait for the end of fill history"); + taosMsleep(2); + continue; + } // set input const SStreamQueueItem* pItem = (const SStreamQueueItem*)data; @@ -58,6 +63,9 @@ static int32_t streamTaskExecImpl(SStreamTask* pTask, const void* data, SArray* SSDataBlock* output = NULL; uint64_t ts = 0; if ((code = qExecTask(exec, &output, &ts)) < 0) { + if (code == TSDB_CODE_QRY_IN_EXEC) { + resetTaskInfo(exec); + } /*ASSERT(false);*/ qError("unexpected stream execution, stream %" PRId64 " task: %d, since %s", pTask->streamId, pTask->taskId, terrstr()); @@ -121,8 +129,7 @@ int32_t streamScanExec(SStreamTask* pTask, int32_t batchSz) { SSDataBlock* output = NULL; uint64_t ts = 0; if (qExecTask(exec, &output, &ts) < 0) { - taosArrayDestroy(pRes); - return -1; + continue; } if (output == NULL) { if (qStreamRecoverScanFinished(exec)) { diff --git a/source/libs/stream/src/streamRecover.c b/source/libs/stream/src/streamRecover.c index 061b211ddfa7045e0121b01d28dc77a581a401d2..87058bf490d43f2cbbd1b18eb8411c034b40a9cd 100644 --- a/source/libs/stream/src/streamRecover.c +++ b/source/libs/stream/src/streamRecover.c @@ -168,7 +168,7 @@ int32_t streamRestoreParam(SStreamTask* pTask) { return qStreamRestoreParam(exec); } int32_t streamSetStatusNormal(SStreamTask* pTask) { - pTask->taskStatus = TASK_STATUS__NORMAL; + atomic_store_8(&pTask->taskStatus, TASK_STATUS__NORMAL); return 0; } diff --git a/source/libs/sync/inc/syncReplication.h b/source/libs/sync/inc/syncReplication.h index f2e240344fc377f90764a5df51a79736e6353ff4..a55fd7ead3359a387494f189af5db8b4317f7054 100644 --- a/source/libs/sync/inc/syncReplication.h +++ b/source/libs/sync/inc/syncReplication.h @@ -51,7 +51,7 @@ int32_t syncNodeHeartbeatPeers(SSyncNode* pSyncNode); int32_t syncNodeSendHeartbeat(SSyncNode* pSyncNode, const SRaftId* pDestId, SRpcMsg* pMsg); int32_t syncNodeReplicate(SSyncNode* pSyncNode); -int32_t syncNodeReplicateOne(SSyncNode* pSyncNode, SRaftId* pDestId, bool snapshot); +int32_t syncNodeReplicateReset(SSyncNode* pSyncNode, SRaftId* pDestId); int32_t syncNodeReplicateWithoutLock(SSyncNode* pNode); int32_t syncNodeSendAppendEntries(SSyncNode* pNode, const SRaftId* destRaftId, SRpcMsg* pRpcMsg); diff --git a/source/libs/sync/src/syncMain.c b/source/libs/sync/src/syncMain.c index b07c05dcfe5ddb20d0b59bf17db37cd6a4c1a359..90f79fd93c7d2371fcafe83ab57ab42deb53e765 100644 --- a/source/libs/sync/src/syncMain.c +++ b/source/libs/sync/src/syncMain.c @@ -285,7 +285,7 @@ int32_t syncBeginSnapshot(int64_t rid, int64_t lastApplyIndex) { if (syncNodeIsMnode(pSyncNode)) { // mnode - logRetention = SYNC_MNODE_LOG_RETENTION; + logRetention = tsMndLogRetention; } else { // vnode if (pSyncNode->replicaNum > 1) { @@ -301,7 +301,7 @@ int32_t syncBeginSnapshot(int64_t rid, int64_t lastApplyIndex) { syncNodeRelease(pSyncNode); return 0; } - logRetention = TMAX(logRetention, lastApplyIndex - pSyncNode->minMatchIndex); + logRetention = TMAX(logRetention, lastApplyIndex - pSyncNode->minMatchIndex + logRetention); } _DEL_WAL: @@ -1082,21 +1082,15 @@ void syncNodePreClose(SSyncNode* pSyncNode) { ASSERT(pSyncNode->pFsm != NULL); ASSERT(pSyncNode->pFsm->FpApplyQueueItems != NULL); - while (1) { - int32_t aqItems = pSyncNode->pFsm->FpApplyQueueItems(pSyncNode->pFsm); - sTrace("vgId:%d, pre close, %d items in apply queue", pSyncNode->vgId, aqItems); - if (aqItems == 0 || aqItems == -1) { - break; - } - taosMsleep(20); - } - // stop elect timer syncNodeStopElectTimer(pSyncNode); // stop heartbeat timer syncNodeStopHeartbeatTimer(pSyncNode); + // stop ping timer + syncNodeStopPingTimer(pSyncNode); + // clean rsp syncRespCleanRsp(pSyncNode->pSyncRespMgr); } @@ -1120,10 +1114,11 @@ void syncNodeClose(SSyncNode* pSyncNode) { if (pSyncNode == NULL) return; sNInfo(pSyncNode, "sync close, node:%p", pSyncNode); + syncRespCleanRsp(pSyncNode->pSyncRespMgr); + syncNodeStopPingTimer(pSyncNode); syncNodeStopElectTimer(pSyncNode); syncNodeStopHeartbeatTimer(pSyncNode); - syncNodeLogReplMgrDestroy(pSyncNode); syncRespMgrDestroy(pSyncNode->pSyncRespMgr); diff --git a/source/libs/sync/src/syncPipeline.c b/source/libs/sync/src/syncPipeline.c index faa44a626c96f0835b0df2885166e15851f0b632..cc1a40a430f4698b18bed863fee5253030308b86 100644 --- a/source/libs/sync/src/syncPipeline.c +++ b/source/libs/sync/src/syncPipeline.c @@ -742,7 +742,8 @@ int32_t syncLogReplMgrProcessReplyAsRecovery(SSyncLogReplMgr* pMgr, SSyncNode* p if (pMsg->matchIndex < pNode->pLogBuf->matchIndex) { term = syncLogReplMgrGetPrevLogTerm(pMgr, pNode, index + 1); - if (term < 0 || (term != pMsg->lastMatchTerm && (index + 1 == firstVer || index == firstVer))) { + if ((index + 1 < firstVer) || (term < 0) || + (term != pMsg->lastMatchTerm && (index + 1 == firstVer || index == firstVer))) { ASSERT(term >= 0 || terrno == TSDB_CODE_WAL_LOG_NOT_EXIST); if (syncNodeStartSnapshot(pNode, &destId) < 0) { sError("vgId:%d, failed to start snapshot for peer dnode:%d", pNode->vgId, DID(&destId)); diff --git a/source/libs/sync/src/syncRaftStore.c b/source/libs/sync/src/syncRaftStore.c index 68e735cf0d7e6689d4724d2439804a1379330f61..bd15567c874d6d2051210ddf5b4c69a65b75bf20 100644 --- a/source/libs/sync/src/syncRaftStore.c +++ b/source/libs/sync/src/syncRaftStore.c @@ -139,7 +139,7 @@ int32_t raftStoreWriteFile(SSyncNode *pNode) { if (taosRenameFile(file, realfile) != 0) goto _OVER; code = 0; - sInfo("vgId:%d, succeed to write raft store file:%s, len:%d", pNode->vgId, realfile, len); + sInfo("vgId:%d, succeed to write raft store file:%s, term:%" PRId64, pNode->vgId, realfile, pStore->currentTerm); _OVER: if (pJson != NULL) tjsonDelete(pJson); diff --git a/source/libs/sync/src/syncReplication.c b/source/libs/sync/src/syncReplication.c index 8cdf821cffa1d76a9985b8d2515a439a7f93cdf7..1d94b288d3a337d23efa5324a32df5f1ca564821 100644 --- a/source/libs/sync/src/syncReplication.c +++ b/source/libs/sync/src/syncReplication.c @@ -48,6 +48,15 @@ int32_t syncNodeMaybeSendAppendEntries(SSyncNode* pSyncNode, const SRaftId* destRaftId, SRpcMsg* pRpcMsg); +int32_t syncNodeReplicateReset(SSyncNode* pNode, SRaftId* pDestId) { + SSyncLogBuffer* pBuf = pNode->pLogBuf; + taosThreadMutexLock(&pBuf->mutex); + SSyncLogReplMgr* pMgr = syncNodeGetLogReplMgr(pNode, pDestId); + syncLogReplMgrReset(pMgr); + taosThreadMutexUnlock(&pBuf->mutex); + return 0; +} + int32_t syncNodeReplicate(SSyncNode* pNode) { SSyncLogBuffer* pBuf = pNode->pLogBuf; taosThreadMutexLock(&pBuf->mutex); diff --git a/source/libs/sync/src/syncSnapshot.c b/source/libs/sync/src/syncSnapshot.c index 381327d4d7ab57976750ab91be305a8ece0e6ca8..413d6adf057ca5447ae31ef07398a9cf24d2a796 100644 --- a/source/libs/sync/src/syncSnapshot.c +++ b/source/libs/sync/src/syncSnapshot.c @@ -992,8 +992,7 @@ int32_t syncNodeOnSnapshotRsp(SSyncNode *pSyncNode, const SRpcMsg *pRpcMsg) { if (pMsg->ack == SYNC_SNAPSHOT_SEQ_END) { syncLogRecvSyncSnapshotRsp(pSyncNode, pMsg, "process seq end"); snapshotSenderStop(pSender, true); - SSyncLogReplMgr *pMgr = syncNodeGetLogReplMgr(pSyncNode, &pMsg->srcId); - syncLogReplMgrReset(pMgr); + syncNodeReplicateReset(pSyncNode, &pMsg->srcId); return 0; } @@ -1018,8 +1017,7 @@ int32_t syncNodeOnSnapshotRsp(SSyncNode *pSyncNode, const SRpcMsg *pRpcMsg) { syncLogRecvSyncSnapshotRsp(pSyncNode, pMsg, "receive error ack"); sSError(pSender, "snapshot sender receive error ack:%d, my seq:%d", pMsg->ack, pSender->seq); snapshotSenderStop(pSender, true); - SSyncLogReplMgr *pMgr = syncNodeGetLogReplMgr(pSyncNode, &pMsg->srcId); - syncLogReplMgrReset(pMgr); + syncNodeReplicateReset(pSyncNode, &pMsg->srcId); return -1; } @@ -1027,8 +1025,6 @@ int32_t syncNodeOnSnapshotRsp(SSyncNode *pSyncNode, const SRpcMsg *pRpcMsg) { _ERROR: snapshotSenderStop(pSender, true); - SSyncLogReplMgr *pMgr = syncNodeGetLogReplMgr(pSyncNode, &pMsg->srcId); - syncLogReplMgrReset(pMgr); - + syncNodeReplicateReset(pSyncNode, &pMsg->srcId); return -1; } diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index 526b4bfc6f7484322266b96a5b1ba84316a24889..50ed9fa61b181ae02fa934da1108a7e7fc130123 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -13,7 +13,6 @@ */ #include "transComm.h" -#include "tutil.h" typedef struct { int32_t numOfConn; @@ -121,6 +120,9 @@ typedef struct SCliThrd { SCliMsg* stopMsg; bool quit; + + int newConnCount; + SHashObj* msgCount; } SCliThrd; typedef struct SCliObj { @@ -675,6 +677,7 @@ static SCliConn* getConnFromPool2(SCliThrd* pThrd, char* key, SCliMsg** pMsg) { } list->numOfConn++; } + tTrace("%s numOfConn: %d, limit: %d", pTransInst->label, list->numOfConn, pTransInst->connLimitNum); return NULL; } @@ -786,7 +789,6 @@ static int32_t specifyConnRef(SCliConn* conn, bool update, int64_t handle) { static void cliAllocRecvBufferCb(uv_handle_t* handle, size_t suggested_size, uv_buf_t* buf) { SCliConn* conn = handle->data; SConnBuffer* pBuf = &conn->readBuf; - tTrace("%s conn %p alloc read buf", CONN_GET_INST_LABEL(conn), conn); transAllocBuffer(pBuf, buf); } static void cliRecvCb(uv_stream_t* handle, ssize_t nread, const uv_buf_t* buf) { @@ -860,10 +862,12 @@ static SCliConn* cliCreateConn(SCliThrd* pThrd) { static void cliDestroyConn(SCliConn* conn, bool clear) { SCliThrd* pThrd = conn->hostThrd; tTrace("%s conn %p remove from conn pool", CONN_GET_INST_LABEL(conn), conn); - + conn->broken = true; QUEUE_REMOVE(&conn->q); QUEUE_INIT(&conn->q); + conn->broken = true; + if (conn->list != NULL) { SConnList* connList = conn->list; connList->list->numOfConn--; @@ -873,6 +877,7 @@ static void cliDestroyConn(SCliConn* conn, bool clear) { connList->list->numOfConn--; } conn->list = NULL; + pThrd->newConnCount--; transReleaseExHandle(transGetRefMgt(), conn->refId); transRemoveExHandle(transGetRefMgt(), conn->refId); @@ -1173,7 +1178,8 @@ static void cliHandleBatchReq(SCliBatch* pBatch, SCliThrd* pThrd) { addr.sin_port = (uint16_t)htons(pList->port); tTrace("%s conn %p try to connect to %s", pTransInst->label, conn, pList->dst); - int32_t fd = taosCreateSocketWithTimeout(TRANS_CONN_TIMEOUT * 4); + pThrd->newConnCount++; + int32_t fd = taosCreateSocketWithTimeout(TRANS_CONN_TIMEOUT * 10); if (fd == -1) { tError("%s conn %p failed to create socket, reason:%s", transLabel(pTransInst), conn, tstrerror(TAOS_SYSTEM_ERROR(errno))); @@ -1230,7 +1236,7 @@ static void cliSendBatchCb(uv_write_t* req, int status) { } else { tDebug("%s conn %p succ to send batch msg, batch size:%d, msgLen:%d", CONN_GET_INST_LABEL(conn), conn, p->wLen, p->batchSize); - if (!uv_is_closing((uv_handle_t*)&conn->stream)) { + if (!uv_is_closing((uv_handle_t*)&conn->stream) && conn->broken == false) { if (nxtBatch != NULL) { conn->pBatch = nxtBatch; cliSendBatch(conn); @@ -1492,6 +1498,21 @@ void cliHandleReq(SCliMsg* pMsg, SCliThrd* pThrd) { return; } + if (rpcDebugFlag & DEBUG_TRACE) { + if (tmsgIsValid(pMsg->msg.msgType)) { + char buf[128] = {0}; + sprintf(buf, "%s", TMSG_INFO(pMsg->msg.msgType)); + int* count = taosHashGet(pThrd->msgCount, buf, sizeof(buf)); + if (NULL == 0) { + int localCount = 1; + taosHashPut(pThrd->msgCount, buf, sizeof(buf), &localCount, sizeof(localCount)); + } else { + int localCount = *count + 1; + taosHashPut(pThrd->msgCount, buf, sizeof(buf), &localCount, sizeof(localCount)); + } + } + } + char* fqdn = EPSET_GET_INUSE_IP(&pMsg->ctx->epSet); uint16_t port = EPSET_GET_INUSE_PORT(&pMsg->ctx->epSet); char addr[TSDB_FQDN_LEN + 64] = {0}; @@ -1546,6 +1567,7 @@ void cliHandleReq(SCliMsg* pMsg, SCliThrd* pThrd) { addr.sin_port = (uint16_t)htons(port); tGTrace("%s conn %p try to connect to %s", pTransInst->label, conn, conn->ip); + pThrd->newConnCount++; int32_t fd = taosCreateSocketWithTimeout(TRANS_CONN_TIMEOUT * 4); if (fd == -1) { tGError("%s conn %p failed to create socket, reason:%s", transLabel(pTransInst), conn, @@ -1735,6 +1757,21 @@ static void cliAsyncCb(uv_async_t* handle) { QUEUE_MOVE(&item->qmsg, &wq); taosThreadMutexUnlock(&item->mtx); + if (rpcDebugFlag & DEBUG_TRACE) { + void* pIter = taosHashIterate(pThrd->msgCount, NULL); + while (pIter != NULL) { + int* count = pIter; + size_t len = 0; + char* key = taosHashGetKey(pIter, &len); + if (*count != 0) { + tDebug("key: %s count: %d", key, *count); + } + + pIter = taosHashIterate(pThrd->msgCount, pIter); + } + tDebug("all conn count: %d", pThrd->newConnCount); + } + int8_t supportBatch = pTransInst->supportBatch; if (supportBatch == 0) { cliNoBatchDealReq(&wq, pThrd); @@ -1969,6 +2006,9 @@ static SCliThrd* createThrdObj(void* trans) { pThrd->batchCache = taosHashInit(8, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK); pThrd->quit = false; + + pThrd->newConnCount = 0; + pThrd->msgCount = taosHashInit(8, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK); return pThrd; } static void destroyThrdObj(SCliThrd* pThrd) { @@ -2014,6 +2054,7 @@ static void destroyThrdObj(SCliThrd* pThrd) { pIter = (void**)taosHashIterate(pThrd->batchCache, pIter); } taosHashCleanup(pThrd->batchCache); + taosHashCleanup(pThrd->msgCount); taosMemoryFree(pThrd); } @@ -2315,7 +2356,20 @@ int cliAppCb(SCliConn* pConn, STransMsg* pResp, SCliMsg* pMsg) { tGTrace("%s conn %p extract epset from msg", CONN_GET_INST_LABEL(pConn), pConn); } } - + if (rpcDebugFlag & DEBUG_TRACE) { + if (tmsgIsValid(pResp->msgType - 1)) { + char buf[128] = {0}; + sprintf(buf, "%s", TMSG_INFO(pResp->msgType - 1)); + int* count = taosHashGet(pThrd->msgCount, buf, sizeof(buf)); + if (NULL == 0) { + int localCount = 0; + taosHashPut(pThrd->msgCount, buf, sizeof(buf), &localCount, sizeof(localCount)); + } else { + int localCount = *count - 1; + taosHashPut(pThrd->msgCount, buf, sizeof(buf), &localCount, sizeof(localCount)); + } + } + } if (pCtx->pSem != NULL) { tGTrace("%s conn %p(sync) handle resp", CONN_GET_INST_LABEL(pConn), pConn); if (pCtx->pRsp == NULL) { diff --git a/source/libs/transport/src/transSvr.c b/source/libs/transport/src/transSvr.c index 04e094ae9a8dc48781b56a59a3693f798aa531c7..28fb474972e86c51a227aa74c713f2fda6b94723 100644 --- a/source/libs/transport/src/transSvr.c +++ b/source/libs/transport/src/transSvr.c @@ -677,14 +677,21 @@ void uvOnAcceptCb(uv_stream_t* stream, int status) { SServerObj* pObj = container_of(stream, SServerObj, server); uv_tcp_t* cli = (uv_tcp_t*)taosMemoryMalloc(sizeof(uv_tcp_t)); - uv_tcp_init(pObj->loop, cli); + if (cli == NULL) return; - if (uv_accept(stream, (uv_stream_t*)cli) == 0) { + int err = uv_tcp_init(pObj->loop, cli); + if (err != 0) { + tError("failed to create tcp: %s", uv_err_name(err)); + taosMemoryFree(cli); + return; + } + err = uv_accept(stream, (uv_stream_t*)cli); + if (err == 0) { #if defined(WINDOWS) || defined(DARWIN) if (pObj->numOfWorkerReady < pObj->numOfThreads) { tError("worker-threads are not ready for all, need %d instead of %d.", pObj->numOfThreads, pObj->numOfWorkerReady); - uv_close((uv_handle_t*)cli, NULL); + uv_close((uv_handle_t*)cli, uvFreeCb); return; } #endif @@ -700,8 +707,10 @@ void uvOnAcceptCb(uv_stream_t* stream, int status) { uv_write2(wr, (uv_stream_t*)&(pObj->pipe[pObj->workerIdx][0]), &buf, 1, (uv_stream_t*)cli, uvOnPipeWriteCb); } else { if (!uv_is_closing((uv_handle_t*)cli)) { - uv_close((uv_handle_t*)cli, NULL); + tError("failed to accept tcp: %s", uv_err_name(err)); + uv_close((uv_handle_t*)cli, uvFreeCb); } else { + tError("failed to accept tcp: %s", uv_err_name(err)); taosMemoryFree(cli); } } diff --git a/source/libs/wal/src/walRead.c b/source/libs/wal/src/walRead.c index 7bfd3df9e0b7dba04d02226223bb88cd84fbda21..3e1e36ccc1e7ac862aaad36ebc4d4a4c0a6a2c62 100644 --- a/source/libs/wal/src/walRead.c +++ b/source/libs/wal/src/walRead.c @@ -200,6 +200,7 @@ int32_t walReadSeekVerImpl(SWalReader *pReader, int64_t ver) { pReader->curVersion, pReader->curInvalid, ver); pReader->curVersion = ver; + pReader->curInvalid = 0; return 0; } @@ -210,8 +211,8 @@ int32_t walReadSeekVer(SWalReader *pReader, int64_t ver) { return 0; } - pReader->curInvalid = 1; - pReader->curVersion = ver; +// pReader->curInvalid = 1; +// pReader->curVersion = ver; if (ver > pWal->vers.lastVer || ver < pWal->vers.firstVer) { wDebug("vgId:%d, invalid index:%" PRId64 ", first index:%" PRId64 ", last index:%" PRId64, pReader->pWal->cfg.vgId, @@ -219,8 +220,8 @@ int32_t walReadSeekVer(SWalReader *pReader, int64_t ver) { terrno = TSDB_CODE_WAL_LOG_NOT_EXIST; return -1; } - if (ver < pWal->vers.snapshotVer) { - } +// if (ver < pWal->vers.snapshotVer) { +// } if (walReadSeekVerImpl(pReader, ver) < 0) { return -1; @@ -239,8 +240,8 @@ static int32_t walFetchHeadNew(SWalReader *pRead, int64_t fetchVer) { if (pRead->curInvalid || pRead->curVersion != fetchVer) { if (walReadSeekVer(pRead, fetchVer) < 0) { - pRead->curVersion = fetchVer; - pRead->curInvalid = 1; +// pRead->curVersion = fetchVer; +// pRead->curInvalid = 1; return -1; } seeked = true; @@ -259,11 +260,11 @@ static int32_t walFetchHeadNew(SWalReader *pRead, int64_t fetchVer) { } else { terrno = TSDB_CODE_WAL_FILE_CORRUPTED; } - pRead->curInvalid = 1; +// pRead->curInvalid = 1; return -1; } } - pRead->curInvalid = 0; +// pRead->curInvalid = 0; return 0; } @@ -295,13 +296,14 @@ static int32_t walFetchBodyNew(SWalReader *pReader) { pReader->pWal->cfg.vgId, pReader->pHead->head.version, ver); terrno = TSDB_CODE_WAL_FILE_CORRUPTED; } - pReader->curInvalid = 1; +// pRead->curInvalid = 1; return -1; } if (walValidBodyCksum(pReader->pHead) != 0) { wError("vgId:%d, wal fetch body error:%" PRId64 ", since body checksum not passed", pReader->pWal->cfg.vgId, ver); - pReader->curInvalid = 1; +// pRead->curInvalid = 1; + terrno = TSDB_CODE_WAL_FILE_CORRUPTED; return -1; } @@ -317,7 +319,7 @@ static int32_t walSkipFetchBodyNew(SWalReader *pRead) { code = taosLSeekFile(pRead->pLogFile, pRead->pHead->head.bodyLen, SEEK_CUR); if (code < 0) { terrno = TAOS_SYSTEM_ERROR(errno); - pRead->curInvalid = 1; +// pRead->curInvalid = 1; return -1; } @@ -345,8 +347,8 @@ int32_t walFetchHead(SWalReader *pRead, int64_t ver, SWalCkHead *pHead) { if (pRead->curInvalid || pRead->curVersion != ver) { code = walReadSeekVer(pRead, ver); if (code < 0) { - pRead->curVersion = ver; - pRead->curInvalid = 1; +// pRead->curVersion = ver; +// pRead->curInvalid = 1; return -1; } seeked = true; @@ -366,7 +368,7 @@ int32_t walFetchHead(SWalReader *pRead, int64_t ver, SWalCkHead *pHead) { } else { terrno = TSDB_CODE_WAL_FILE_CORRUPTED; } - pRead->curInvalid = 1; +// pRead->curInvalid = 1; return -1; } } @@ -379,7 +381,7 @@ int32_t walFetchHead(SWalReader *pRead, int64_t ver, SWalCkHead *pHead) { return -1; } - pRead->curInvalid = 0; +// pRead->curInvalid = 0; return 0; } @@ -394,7 +396,7 @@ int32_t walSkipFetchBody(SWalReader *pRead, const SWalCkHead *pHead) { code = taosLSeekFile(pRead->pLogFile, pHead->head.bodyLen, SEEK_CUR); if (code < 0) { terrno = TAOS_SYSTEM_ERROR(errno); - pRead->curInvalid = 1; +// pRead->curInvalid = 1; return -1; } @@ -433,14 +435,14 @@ int32_t walFetchBody(SWalReader *pRead, SWalCkHead **ppHead) { pRead->pWal->cfg.vgId, pReadHead->version, ver); terrno = TSDB_CODE_WAL_FILE_CORRUPTED; } - pRead->curInvalid = 1; +// pRead->curInvalid = 1; return -1; } if (pReadHead->version != ver) { wError("vgId:%d, wal fetch body error, index:%" PRId64 ", read request index:%" PRId64, pRead->pWal->cfg.vgId, pReadHead->version, ver); - pRead->curInvalid = 1; +// pRead->curInvalid = 1; terrno = TSDB_CODE_WAL_FILE_CORRUPTED; return -1; } @@ -448,7 +450,7 @@ int32_t walFetchBody(SWalReader *pRead, SWalCkHead **ppHead) { if (walValidBodyCksum(*ppHead) != 0) { wError("vgId:%d, wal fetch body error, index:%" PRId64 ", since body checksum not passed", pRead->pWal->cfg.vgId, ver); - pRead->curInvalid = 1; +// pRead->curInvalid = 1; terrno = TSDB_CODE_WAL_FILE_CORRUPTED; return -1; } @@ -544,7 +546,7 @@ int32_t walReadVer(SWalReader *pReader, int64_t ver) { if (pReader->pHead->head.version != ver) { wError("vgId:%d, unexpected wal log, index:%" PRId64 ", read request index:%" PRId64, pReader->pWal->cfg.vgId, pReader->pHead->head.version, ver); - pReader->curInvalid = 1; +// pReader->curInvalid = 1; terrno = TSDB_CODE_WAL_FILE_CORRUPTED; taosThreadMutexUnlock(&pReader->mutex); return -1; @@ -557,7 +559,7 @@ int32_t walReadVer(SWalReader *pReader, int64_t ver) { uint32_t readCkSum = walCalcBodyCksum(pReader->pHead->head.body, pReader->pHead->head.bodyLen); uint32_t logCkSum = pReader->pHead->cksumBody; wError("checksum written into log:%u, checksum calculated:%u", logCkSum, readCkSum); - pReader->curInvalid = 1; +// pReader->curInvalid = 1; terrno = TSDB_CODE_WAL_FILE_CORRUPTED; taosThreadMutexUnlock(&pReader->mutex); return -1; @@ -575,5 +577,6 @@ void walReadReset(SWalReader *pReader) { taosCloseFile(&pReader->pLogFile); pReader->curInvalid = 1; pReader->curFileFirstVer = -1; + pReader->curVersion = -1; taosThreadMutexUnlock(&pReader->mutex); } diff --git a/source/libs/wal/src/walWrite.c b/source/libs/wal/src/walWrite.c index a992c951fab0a5b9d2c0889d3fe4eb8588374ab3..00ad7a3d67ea6118a0ed9d2fe8bd10b988bdd350 100644 --- a/source/libs/wal/src/walWrite.c +++ b/source/libs/wal/src/walWrite.c @@ -328,8 +328,8 @@ int32_t walEndSnapshot(SWal *pWal) { "), new tot size %" PRId64, pWal->cfg.vgId, iter->firstVer, iter->fileSize, iter->closeTs, newTotSize); if (((pWal->cfg.retentionSize == 0) || (pWal->cfg.retentionSize != -1 && newTotSize > pWal->cfg.retentionSize)) || - ((pWal->cfg.retentionPeriod == 0) || - (pWal->cfg.retentionPeriod != -1 && iter->closeTs + pWal->cfg.retentionPeriod > ts))) { + ((pWal->cfg.retentionPeriod == 0) || (pWal->cfg.retentionPeriod != -1 && iter->closeTs != -1 && + iter->closeTs + pWal->cfg.retentionPeriod < ts))) { // delete according to file size or close time wDebug("vgId:%d, check pass", pWal->cfg.vgId); deleteCnt++; @@ -387,20 +387,33 @@ END: int32_t walRollImpl(SWal *pWal) { int32_t code = 0; + if (pWal->pIdxFile != NULL) { + code = taosFsyncFile(pWal->pIdxFile); + if (code != 0) { + terrno = TAOS_SYSTEM_ERROR(errno); + goto END; + } code = taosCloseFile(&pWal->pIdxFile); if (code != 0) { terrno = TAOS_SYSTEM_ERROR(errno); goto END; } } + if (pWal->pLogFile != NULL) { + code = taosFsyncFile(pWal->pLogFile); + if (code != 0) { + terrno = TAOS_SYSTEM_ERROR(errno); + goto END; + } code = taosCloseFile(&pWal->pLogFile); if (code != 0) { terrno = TAOS_SYSTEM_ERROR(errno); goto END; } } + TdFilePtr pIdxFile, pLogFile; // create new file int64_t newFileFirstVer = pWal->vers.lastVer + 1; diff --git a/source/os/src/osMath.c b/source/os/src/osMath.c index b466f89a1d127db23a1618f3455d876f25643f97..0cff0f78a618b5d82f05b55d45e2cc6303a186fd 100644 --- a/source/os/src/osMath.c +++ b/source/os/src/osMath.c @@ -18,20 +18,6 @@ #include #include "talgo.h" -#ifdef WINDOWS -void swapStr(char* j, char* J, int width) { - int i; - char tmp; - for (i = 0; i < width; i++) { - tmp = *j; - *j = *J; - *J = tmp; - j++; - J++; - } -} -#endif - int32_t qsortHelper(const void* p1, const void* p2, const void* param) { __compar_fn_t comparFn = param; return comparFn(p1, p2); @@ -39,7 +25,7 @@ int32_t qsortHelper(const void* p1, const void* p2, const void* param) { // todo refactor: 1) move away; 2) use merge sort instead; 3) qsort is not a stable sort actually. void taosSort(void* base, int64_t sz, int64_t width, __compar_fn_t compar) { -#ifdef _ALPINE +#if defined(WINDOWS) || defined(_ALPINE) void* param = compar; taosqsort(base, sz, width, param, qsortHelper); #else diff --git a/source/os/src/osRand.c b/source/os/src/osRand.c index 4998eb45a4527fd52d9559f5f99fe7f1e5362428..83c36a422d37b0af4b20a20992e79812c1544b02 100644 --- a/source/os/src/osRand.c +++ b/source/os/src/osRand.c @@ -25,7 +25,15 @@ void taosSeedRand(uint32_t seed) { return srand(seed); } -uint32_t taosRand(void) { return rand(); } +uint32_t taosRand(void) { +#ifdef WINDOWS + unsigned int pSeed; + rand_s(&pSeed); + return pSeed; +#else + return rand(); +#endif +} uint32_t taosRandR(uint32_t* pSeed) { #ifdef WINDOWS diff --git a/source/os/src/osSleep.c b/source/os/src/osSleep.c index a2373f952f6a22a7fd34a12b052502c04206598f..f6cc7d608d57b1343a95a5e68bd077b06d6fbfaa 100644 --- a/source/os/src/osSleep.c +++ b/source/os/src/osSleep.c @@ -22,6 +22,7 @@ #endif void taosSsleep(int32_t s) { + if (s < 0) return; #ifdef WINDOWS Sleep(1000 * s); #else @@ -30,6 +31,7 @@ void taosSsleep(int32_t s) { } void taosMsleep(int32_t ms) { + if (ms < 0) return; #ifdef WINDOWS Sleep(ms); #else @@ -38,6 +40,7 @@ void taosMsleep(int32_t ms) { } void taosUsleep(int32_t us) { + if (us < 0) return; #ifdef WINDOWS HANDLE timer; LARGE_INTEGER interval; diff --git a/source/os/src/osString.c b/source/os/src/osString.c index ae4a8a5cada3789c05e09a7b59455b9a38f54df7..0f459b58cd3a31118ac3c37a304449aad3834792 100644 --- a/source/os/src/osString.c +++ b/source/os/src/osString.c @@ -94,21 +94,21 @@ int32_t tasoUcs4Compare(TdUcs4 *f1_ucs4, TdUcs4 *f2_ucs4, int32_t bytes) { return 0; -#if 0 - int32_t ucs4_max_len = bytes + 4; - char *f1_mbs = taosMemoryCalloc(bytes, 1); - char *f2_mbs = taosMemoryCalloc(bytes, 1); - if (taosUcs4ToMbs(f1_ucs4, ucs4_max_len, f1_mbs) < 0) { - return -1; - } - if (taosUcs4ToMbs(f2_ucs4, ucs4_max_len, f2_mbs) < 0) { - return -1; - } - int32_t ret = strcmp(f1_mbs, f2_mbs); - taosMemoryFree(f1_mbs); - taosMemoryFree(f2_mbs); - return ret; -#endif +//#if 0 +// int32_t ucs4_max_len = bytes + 4; +// char *f1_mbs = taosMemoryCalloc(bytes, 1); +// char *f2_mbs = taosMemoryCalloc(bytes, 1); +// if (taosUcs4ToMbs(f1_ucs4, ucs4_max_len, f1_mbs) < 0) { +// return -1; +// } +// if (taosUcs4ToMbs(f2_ucs4, ucs4_max_len, f2_mbs) < 0) { +// return -1; +// } +// int32_t ret = strcmp(f1_mbs, f2_mbs); +// taosMemoryFree(f1_mbs); +// taosMemoryFree(f2_mbs); +// return ret; +//#endif } TdUcs4 *tasoUcs4Copy(TdUcs4 *target_ucs4, TdUcs4 *source_ucs4, int32_t len_ucs4) { diff --git a/source/os/src/osTimer.c b/source/os/src/osTimer.c index 5a57007d1765302994c091bc3f970ef98388e000..b8eb54e10e27adcba5668140936830309327dd3d 100644 --- a/source/os/src/osTimer.c +++ b/source/os/src/osTimer.c @@ -114,27 +114,28 @@ static void *taosProcessAlarmSignal(void *tharg) { taosThreadCleanupPush(taosDeleteTimer, &timerId); - struct itimerspec ts; - ts.it_value.tv_sec = 0; - ts.it_value.tv_nsec = 1000000 * MSECONDS_PER_TICK; - ts.it_interval.tv_sec = 0; - ts.it_interval.tv_nsec = 1000000 * MSECONDS_PER_TICK; - - if (timer_settime(timerId, 0, &ts, NULL)) { - // printf("Failed to init timer"); - return NULL; - } - - int signo; - while (!stopTimer) { - if (sigwait(&sigset, &signo)) { - // printf("Failed to wait signal: number %d", signo); - continue; + do { + struct itimerspec ts; + ts.it_value.tv_sec = 0; + ts.it_value.tv_nsec = 1000000 * MSECONDS_PER_TICK; + ts.it_interval.tv_sec = 0; + ts.it_interval.tv_nsec = 1000000 * MSECONDS_PER_TICK; + + if (timer_settime(timerId, 0, &ts, NULL)) { + // printf("Failed to init timer"); + break; } - /* //printf("Signal handling: number %d ......\n", signo); */ - callback(0); - } + int signo; + while (!stopTimer) { + if (sigwait(&sigset, &signo)) { + // printf("Failed to wait signal: number %d", signo); + continue; + } + /* //printf("Signal handling: number %d ......\n", signo); */ + callback(0); + } + } while (0); taosThreadCleanupPop(1); diff --git a/source/os/test/CMakeLists.txt b/source/os/test/CMakeLists.txt index 21fb2ee630d2d0058ca48f94a1f39c10ce7abe40..fba4d23e3fa5114fa0c4420761dbc0279f9934c4 100644 --- a/source/os/test/CMakeLists.txt +++ b/source/os/test/CMakeLists.txt @@ -17,8 +17,64 @@ INCLUDE_DIRECTORIES(${TD_SOURCE_DIR}/src/util/inc) # osTests add_executable(osTests "osTests.cpp") -target_link_libraries(osTests os util gtest_main) +target_link_libraries(osTests os util gtest_main) add_test( NAME osTests COMMAND osTests +) + +add_executable(osSystemTests "osSystemTests.cpp") +target_link_libraries(osSystemTests os util gtest_main) +add_test( + NAME osSystemTests + COMMAND osSystemTests +) + +add_executable(osMathTests "osMathTests.cpp") +target_link_libraries(osMathTests os util gtest_main) +add_test( + NAME osMathTests + COMMAND osMathTests +) + +add_executable(osSignalTests "osSignalTests.cpp") +target_link_libraries(osSignalTests os util gtest_main) +add_test( + NAME osSignalTests + COMMAND osSignalTests +) + +add_executable(osSleepTests "osSleepTests.cpp") +target_link_libraries(osSleepTests os util gtest_main) +add_test( + NAME osSleepTests + COMMAND osSleepTests +) + +add_executable(osStringTests "osStringTests.cpp") +target_link_libraries(osStringTests os util gtest_main) +add_test( + NAME osStringTests + COMMAND osStringTests +) + +add_executable(osThreadTests "osThreadTests.cpp") +target_link_libraries(osThreadTests os util gtest_main) +add_test( + NAME osThreadTests + COMMAND osThreadTests +) + +add_executable(osTimeTests "osTimeTests.cpp") +target_link_libraries(osTimeTests os util gtest_main) +add_test( + NAME osTimeTests + COMMAND osTimeTests +) + +add_executable(osAtomicTests "osAtomicTests.cpp") +target_link_libraries(osAtomicTests os util gtest_main) +add_test( + NAME osAtomicTests + COMMAND osAtomicTests ) \ No newline at end of file diff --git a/source/os/test/osAtomicTests.cpp b/source/os/test/osAtomicTests.cpp new file mode 100644 index 0000000000000000000000000000000000000000..eebc1574c3b286a249cf051f8c0ad41acb32b39a --- /dev/null +++ b/source/os/test/osAtomicTests.cpp @@ -0,0 +1,115 @@ +/* + * 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 +#include + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wwrite-strings" +#pragma GCC diagnostic ignored "-Wunused-function" +#pragma GCC diagnostic ignored "-Wunused-variable" +#pragma GCC diagnostic ignored "-Wsign-compare" +#pragma GCC diagnostic ignored "-Wsign-compare" +#pragma GCC diagnostic ignored "-Wformat" +#pragma GCC diagnostic ignored "-Wint-to-pointer-cast" +#pragma GCC diagnostic ignored "-Wpointer-arith" + +#include "os.h" +#include "tlog.h" + +TEST(osAtomicTests, Exchange16) { + int16_t value = 123; + int16_t new_value = 456; + int16_t result = atomic_exchange_16(&value, new_value); + EXPECT_EQ(result, 123); + EXPECT_EQ(value, 456); +} + +TEST(osAtomicTests, Exchange32) { + int32_t value = 123; + int32_t new_value = 456; + int32_t result = atomic_exchange_32(&value, new_value); + EXPECT_EQ(result, 123); + EXPECT_EQ(value, 456); +} + +TEST(osAtomicTests, Exchange64) { + int64_t value = 123; + int64_t new_value = 456; + int64_t result = atomic_exchange_64(&value, new_value); + EXPECT_EQ(result, 123); + EXPECT_EQ(value, 456); +} + +TEST(osAtomicTests, ExchangePtr) { + int value1 = 123; + int value2 = 456; + int* ptr = &value1; + int* result = (int*)atomic_exchange_ptr(&ptr, &value2); + EXPECT_EQ(result, &value1); + EXPECT_EQ(*ptr, 456); +} + +TEST(osAtomicTests, ValCompareExchange8) { + int8_t value = 12; + int8_t oldval = 12; + int8_t newval = 45; + int8_t result = atomic_val_compare_exchange_8(&value, oldval, newval); + EXPECT_EQ(result, 12); + EXPECT_EQ(value, 45); + + oldval = 78; + result = atomic_val_compare_exchange_8(&value, oldval, newval); + EXPECT_EQ(result, 45); + EXPECT_EQ(value, 45); +} + +TEST(osAtomicTests, ValCompareExchange16) { + int16_t value = 123; + int16_t oldval = 123; + int16_t newval = 456; + int16_t result = atomic_val_compare_exchange_16(&value, oldval, newval); + EXPECT_EQ(result, 123); + EXPECT_EQ(value, 456); + + oldval = 789; + result = atomic_val_compare_exchange_16(&value, oldval, newval); + EXPECT_EQ(result, 456); + EXPECT_EQ(value, 456); +} + +TEST(osAtomicTests, TestAtomicExchange8) { + volatile int8_t value = 42; + int8_t new_value = 100; + int8_t old_value = atomic_exchange_8(&value, new_value); + EXPECT_EQ(old_value, 42); + EXPECT_EQ(value, new_value); +} + +TEST(osAtomicTests, TestAtomicAddFetch16) { + volatile int16_t value = 42; + int16_t increment = 10; + int16_t new_value = atomic_add_fetch_16(&value, increment); + EXPECT_EQ(new_value, 52); + EXPECT_EQ(value, 52); +} + +//TEST(osAtomicTests, AddFetchPtr) { +// uintptr_t val = 0; +// uintptr_t* ptr = &val; +// uintptr_t ret = atomic_add_fetch_ptr(ptr, 10); +// EXPECT_EQ(ret, 10); +// EXPECT_EQ(val, 10); +//} diff --git a/source/os/test/osMathTests.cpp b/source/os/test/osMathTests.cpp new file mode 100644 index 0000000000000000000000000000000000000000..93c8d1f8da03cc359cd23d5feca712e8b5e6c1f3 --- /dev/null +++ b/source/os/test/osMathTests.cpp @@ -0,0 +1,62 @@ +/* + * 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 +#include + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wwrite-strings" +#pragma GCC diagnostic ignored "-Wunused-function" +#pragma GCC diagnostic ignored "-Wunused-variable" +#pragma GCC diagnostic ignored "-Wsign-compare" +#pragma GCC diagnostic ignored "-Wsign-compare" +#pragma GCC diagnostic ignored "-Wformat" +#pragma GCC diagnostic ignored "-Wint-to-pointer-cast" +#pragma GCC diagnostic ignored "-Wpointer-arith" + +#include "os.h" +#include "tlog.h" + +struct TestStruct { + int a; + float b; +}; + +// Define a custom comparison function for testing +int cmpFunc(const void* a, const void* b) { + const TestStruct* pa = reinterpret_cast(a); + const TestStruct* pb = reinterpret_cast(b); + if (pa->a < pb->a) { + return -1; + } else if (pa->a > pb->a) { + return 1; + } else { + return 0; + } +} + +TEST(osMathTests, taosSort) { + // Create an array of test data + TestStruct arr[] = {{4, 2.5}, {2, 1.5}, {1, 3.5}, {3, 4.5}}; + + // Sort the array using taosSort + taosSort(arr, 4, sizeof(TestStruct), cmpFunc); + + // Check that the array is sorted correctly + EXPECT_EQ(arr[0].a, 1); + EXPECT_EQ(arr[1].a, 2); + EXPECT_EQ(arr[2].a, 3); + EXPECT_EQ(arr[3].a, 4); +} \ No newline at end of file diff --git a/source/os/test/osSignalTests.cpp b/source/os/test/osSignalTests.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f4cc6e9e588fe02aeeaae3f128635e341d024d2d --- /dev/null +++ b/source/os/test/osSignalTests.cpp @@ -0,0 +1,40 @@ +/* + * 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 +#include + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wwrite-strings" +#pragma GCC diagnostic ignored "-Wunused-function" +#pragma GCC diagnostic ignored "-Wunused-variable" +#pragma GCC diagnostic ignored "-Wsign-compare" +#pragma GCC diagnostic ignored "-Wsign-compare" +#pragma GCC diagnostic ignored "-Wformat" +#pragma GCC diagnostic ignored "-Wint-to-pointer-cast" +#pragma GCC diagnostic ignored "-Wpointer-arith" + +#include "os.h" +#include "tlog.h" + +TEST(osSignalTests, taosSetSignal) { + // Set up SIGINT handler using taosSetSignal + //taosSetSignal(SIGINT, sigint_handler); + + // Print PID for testing purposes + // printf("PID: %d\n", getpid()); + + // Wait for signal to be received +} diff --git a/source/os/test/osSleepTests.cpp b/source/os/test/osSleepTests.cpp new file mode 100644 index 0000000000000000000000000000000000000000..5faa837a0ada8d5e0b8485d642c34a08dc1bcec2 --- /dev/null +++ b/source/os/test/osSleepTests.cpp @@ -0,0 +1,63 @@ +/* + * 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 +#include + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wwrite-strings" +#pragma GCC diagnostic ignored "-Wunused-function" +#pragma GCC diagnostic ignored "-Wunused-variable" +#pragma GCC diagnostic ignored "-Wsign-compare" +#pragma GCC diagnostic ignored "-Wsign-compare" +#pragma GCC diagnostic ignored "-Wformat" +#pragma GCC diagnostic ignored "-Wint-to-pointer-cast" +#pragma GCC diagnostic ignored "-Wpointer-arith" + +#include "os.h" +#include "tlog.h" + +TEST(osSleepTests, taosUsleep) { + const int sleep_time1 = 1000; // sleep for 1000 microseconds + taosUsleep(sleep_time1); + + const int sleep_time2 = 0; // sleep for 0 microseconds + taosUsleep(sleep_time2); + + const int sleep_time3 = -1; // sleep for negative time + taosUsleep(sleep_time3); +} + +TEST(osSleepTests, taosSsleep) { + const int sleep_time1 = 1; + taosSsleep(sleep_time1); + + const int sleep_time2 = 0; + taosSsleep(sleep_time2); + + const int sleep_time3 = -1; + taosSsleep(sleep_time3); +} + +TEST(osSleepTests, taosMsleep) { + const int sleep_time1 = 1000; + taosMsleep(sleep_time1); + + const int sleep_time2 = 0; + taosMsleep(sleep_time2); + + const int sleep_time3 = -1; // sleep for negative time + taosMsleep(sleep_time3); +} diff --git a/source/os/test/osStringTests.cpp b/source/os/test/osStringTests.cpp new file mode 100644 index 0000000000000000000000000000000000000000..5e07636b1f81b9db0fb454e501441ae4e5959714 --- /dev/null +++ b/source/os/test/osStringTests.cpp @@ -0,0 +1,113 @@ +/* + * 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 +#include + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wwrite-strings" +#pragma GCC diagnostic ignored "-Wunused-function" +#pragma GCC diagnostic ignored "-Wunused-variable" +#pragma GCC diagnostic ignored "-Wsign-compare" +#pragma GCC diagnostic ignored "-Wsign-compare" +#pragma GCC diagnostic ignored "-Wformat" +#pragma GCC diagnostic ignored "-Wint-to-pointer-cast" +#pragma GCC diagnostic ignored "-Wpointer-arith" + +#include "os.h" +#include "tlog.h" + +#ifdef WINDOWS +TEST(osStringTests, strsepNormalInput) { + char str[] = "This is a test string."; + char * ptr = str; + char * tok = NULL; + const char delim[] = " "; + + while ((tok = strsep(&ptr, delim)) != NULL) { + printf("%s\n", tok); + } + EXPECT_STREQ(tok, nullptr); + EXPECT_EQ(ptr, nullptr); +} + +TEST(osStringTests, strsepEmptyInput) { + char* str = ""; + char* ptr = str; + char* tok = NULL; + const char delim[] = " "; + + while ((tok = strsep(&ptr, delim)) != NULL) { + printf("%s\n", tok); + } + + EXPECT_STREQ(tok, nullptr); + EXPECT_EQ(ptr, nullptr); +} + +TEST(osStringTests, strsepNullInput) { + char * str = NULL; + char * ptr = str; + char * tok = NULL; + const char delim[] = " "; + + while ((tok = strsep(&ptr, delim)) != NULL) { + printf("%s\n", tok); + } + + EXPECT_STREQ(tok, nullptr); + EXPECT_EQ(ptr, nullptr); +} + +TEST(osStringTests, strndupNormalInput) { + const char s[] = "This is a test string."; + int size = strlen(s) + 1; + char * s2 = strndup(s, size); + + EXPECT_STREQ(s, s2); + + free(s2); +} +#endif + +TEST(osStringTests, osUcs4Tests1) { + TdUcs4 f1_ucs4[] = {0x0048, 0x0065, 0x006C, 0x006C, 0x006F, 0x0000}; + TdUcs4 f2_ucs4[] = {0x0048, 0x0065, 0x006C, 0x006C, 0x006F, 0x0000}; + + EXPECT_EQ(tasoUcs4Compare(f1_ucs4, f2_ucs4, sizeof(f1_ucs4)), 0); + + TdUcs4 f3_ucs4[] = {0x0048, 0x0065, 0x006C, 0x006C, 0x006F, 0x0020, 0x0077, + 0x006F, 0x0072, 0x006C, 0x0064, 0x0021, 0x0000}; + TdUcs4 f4_ucs4[] = {0x0048, 0x0065, 0x006C, 0x006C, 0x006F, 0x0000}; + + EXPECT_GT(tasoUcs4Compare(f3_ucs4, f4_ucs4, sizeof(f3_ucs4)), 0); + + TdUcs4 f5_ucs4[] = {0x0048, 0x0065, 0x006C, 0x006C, 0x006F, 0x0000}; + TdUcs4 f6_ucs4[] = {0x0048, 0x0065, 0x006C, 0x006C, 0x006F, 0x0020, 0x0077, + 0x006F, 0x0072, 0x006C, 0x0064, 0x0021, 0x0000}; + + EXPECT_LT(tasoUcs4Compare(f5_ucs4, f6_ucs4, sizeof(f5_ucs4)), 0); +} + +TEST(osStringTests, osUcs4lenTests2) { + TdUcs4 ucs4_1[] = {'H', 'e', 'l', 'l', 'o', '\0'}; + EXPECT_EQ(taosUcs4len(ucs4_1), 5); + + TdUcs4 ucs4_2[] = {'\0'}; + EXPECT_EQ(taosUcs4len(ucs4_2), 0); + + TdUcs4 ucs4_3[] = {'C', 'h', 'i', 'n', 'a', 0x4E2D, 0x6587, '\0'}; + EXPECT_EQ(taosUcs4len(ucs4_3), 7); +} diff --git a/source/os/test/osSystemTests.cpp b/source/os/test/osSystemTests.cpp new file mode 100644 index 0000000000000000000000000000000000000000..dfc92a1b72b8b743a23a3cba1b6e18c66b5b982f --- /dev/null +++ b/source/os/test/osSystemTests.cpp @@ -0,0 +1,41 @@ +/* + * 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 +#include + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wwrite-strings" +#pragma GCC diagnostic ignored "-Wunused-function" +#pragma GCC diagnostic ignored "-Wunused-variable" +#pragma GCC diagnostic ignored "-Wsign-compare" +#pragma GCC diagnostic ignored "-Wsign-compare" +#pragma GCC diagnostic ignored "-Wformat" +#pragma GCC diagnostic ignored "-Wint-to-pointer-cast" +#pragma GCC diagnostic ignored "-Wpointer-arith" + +#include "os.h" +#include "tlog.h" + +TEST(osSystemTest, osSystem1) { + char tmp[4096] = "test"; +#ifdef _TD_DARWIN_64 + taosLogTraceToBuf(tmp, sizeof(tmp), 4); +#elif !defined(WINDOWS) + taosLogTraceToBuf(tmp, sizeof(tmp), 3); +#else + taosLogTraceToBuf(tmp, sizeof(tmp), 8); +#endif +} diff --git a/source/os/test/osThreadTests.cpp b/source/os/test/osThreadTests.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e7fc4f135609b95cb5e13d49f1c5d4a50b8fec6c --- /dev/null +++ b/source/os/test/osThreadTests.cpp @@ -0,0 +1,34 @@ +/* + * 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 +#include + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wwrite-strings" +#pragma GCC diagnostic ignored "-Wunused-function" +#pragma GCC diagnostic ignored "-Wunused-variable" +#pragma GCC diagnostic ignored "-Wsign-compare" +#pragma GCC diagnostic ignored "-Wsign-compare" +#pragma GCC diagnostic ignored "-Wformat" +#pragma GCC diagnostic ignored "-Wint-to-pointer-cast" +#pragma GCC diagnostic ignored "-Wpointer-arith" + +#include "os.h" +#include "tlog.h" + +TEST(osThreadTests, osThreadTests1) { + +} diff --git a/source/os/test/osTimeTests.cpp b/source/os/test/osTimeTests.cpp new file mode 100644 index 0000000000000000000000000000000000000000..366c3fc720f7c1543d1d11bdd69f1d2ae085eb38 --- /dev/null +++ b/source/os/test/osTimeTests.cpp @@ -0,0 +1,48 @@ +/* + * 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 +#include + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wwrite-strings" +#pragma GCC diagnostic ignored "-Wunused-function" +#pragma GCC diagnostic ignored "-Wunused-variable" +#pragma GCC diagnostic ignored "-Wsign-compare" +#pragma GCC diagnostic ignored "-Wsign-compare" +#pragma GCC diagnostic ignored "-Wformat" +#pragma GCC diagnostic ignored "-Wint-to-pointer-cast" +#pragma GCC diagnostic ignored "-Wpointer-arith" + +#include "os.h" +#include "tlog.h" + +TEST(osTimeTests, taosLocalTimeNolock) { + time_t currentTime; + // Test when result is NULL + struct tm* result = taosLocalTimeNolock(NULL, ¤tTime, 0); + // Test when result is not NULL + struct tm expectedTime; + result = taosLocalTimeNolock(&expectedTime, ¤tTime, 1); + EXPECT_EQ(expectedTime.tm_year, result->tm_year); + EXPECT_EQ(expectedTime.tm_mon, result->tm_mon); + EXPECT_EQ(expectedTime.tm_mday, result->tm_mday); + EXPECT_EQ(expectedTime.tm_hour, result->tm_hour); + EXPECT_EQ(expectedTime.tm_min, result->tm_min); + EXPECT_EQ(expectedTime.tm_sec, result->tm_sec); + EXPECT_EQ(expectedTime.tm_wday, result->tm_wday); + EXPECT_EQ(expectedTime.tm_yday, result->tm_yday); + EXPECT_EQ(expectedTime.tm_isdst, result->tm_isdst); +} diff --git a/source/util/src/terror.c b/source/util/src/terror.c index 07c0a204393c6c9b2add2f9f7cfb1992bcb6f74c..1f49f8f8b5861603f6a3b2be1c302f4c64058eb2 100644 --- a/source/util/src/terror.c +++ b/source/util/src/terror.c @@ -94,6 +94,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_NO_AVAIL_DISK, "No available disk") TAOS_DEFINE_ERROR(TSDB_CODE_NOT_FOUND, "Not found") TAOS_DEFINE_ERROR(TSDB_CODE_NO_DISKSPACE, "Out of disk space") TAOS_DEFINE_ERROR(TSDB_CODE_TIMEOUT_ERROR, "Operation timeout") +TAOS_DEFINE_ERROR(TSDB_CODE_NO_ENOUGH_DISKSPACE, "No enough disk space") TAOS_DEFINE_ERROR(TSDB_CODE_APP_IS_STARTING, "Database is starting up") TAOS_DEFINE_ERROR(TSDB_CODE_APP_IS_STOPPING, "Database is closing down") @@ -183,6 +184,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_MND_TOO_MANY_ACCTS, "Too many accounts") TAOS_DEFINE_ERROR(TSDB_CODE_MND_USER_ALREADY_EXIST, "User already exists") TAOS_DEFINE_ERROR(TSDB_CODE_MND_USER_NOT_EXIST, "Invalid user") TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_USER_FORMAT, "Invalid user format") +TAOS_DEFINE_ERROR(TSDB_CODE_MND_USER_NOT_AVAILABLE, "User not available") TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_PASS_FORMAT, "Invalid password format") TAOS_DEFINE_ERROR(TSDB_CODE_MND_NO_USER_FROM_CONN, "Can not get user from conn") TAOS_DEFINE_ERROR(TSDB_CODE_MND_TOO_MANY_USERS, "Too many users") @@ -210,8 +212,8 @@ TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_FUNC_BUFSIZE, "Invalid func bufSize" TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_FUNC_COMMENT, "Invalid func comment") TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_FUNC_RETRIEVE, "Invalid func retrieve msg") -TAOS_DEFINE_ERROR(TSDB_CODE_MND_TAG_INDEX_ALREADY_EXIST, "Tag index already exists") -TAOS_DEFINE_ERROR(TSDB_CODE_MND_TAG_INDEX_NOT_EXIST, "Tag index not exists") +TAOS_DEFINE_ERROR(TSDB_CODE_MND_TAG_INDEX_ALREADY_EXIST, "index already exists") +TAOS_DEFINE_ERROR(TSDB_CODE_MND_TAG_INDEX_NOT_EXIST, "index not exist") // mnode-db @@ -300,9 +302,9 @@ TAOS_DEFINE_ERROR(TSDB_CODE_MND_TOO_MANY_STREAMS, "Too many streams") TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_TARGET_TABLE, "Cannot write the same stable as other stream") // mnode-sma -TAOS_DEFINE_ERROR(TSDB_CODE_MND_SMA_ALREADY_EXIST, "SMA already exists") -TAOS_DEFINE_ERROR(TSDB_CODE_MND_SMA_NOT_EXIST, "SMA does not exist") -TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_SMA_OPTION, "Invalid sma option") +TAOS_DEFINE_ERROR(TSDB_CODE_MND_SMA_ALREADY_EXIST, "index already exists") +TAOS_DEFINE_ERROR(TSDB_CODE_MND_SMA_NOT_EXIST, "index not exist") +TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_SMA_OPTION, "Invalid sma index option") // dnode TAOS_DEFINE_ERROR(TSDB_CODE_DNODE_OFFLINE, "Dnode is offline") @@ -434,7 +436,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_TQ_META_KEY_NOT_IN_TXN, "TQ meta key not in tx TAOS_DEFINE_ERROR(TSDB_CODE_TQ_META_KEY_DUP_IN_TXN, "TQ met key dup in txn") TAOS_DEFINE_ERROR(TSDB_CODE_TQ_GROUP_NOT_SET, "TQ group not exist") TAOS_DEFINE_ERROR(TSDB_CODE_TQ_TABLE_SCHEMA_NOT_FOUND, "TQ table schema not found") -TAOS_DEFINE_ERROR(TSDB_CODE_TQ_NO_COMMITTED_OFFSET, "TQ no commited offset") +TAOS_DEFINE_ERROR(TSDB_CODE_TQ_NO_COMMITTED_OFFSET, "TQ no committed offset") // wal TAOS_DEFINE_ERROR(TSDB_CODE_WAL_FILE_CORRUPTED, "WAL file is corrupted") @@ -583,7 +585,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_UDF_NO_FUNC_HANDLE, "udf no function han TAOS_DEFINE_ERROR(TSDB_CODE_UDF_INVALID_BUFSIZE, "udf invalid bufsize") TAOS_DEFINE_ERROR(TSDB_CODE_UDF_INVALID_OUTPUT_TYPE, "udf invalid output type") TAOS_DEFINE_ERROR(TSDB_CODE_UDF_SCRIPT_NOT_SUPPORTED, "udf program language not supported") -TAOS_DEFINE_ERROR(TSDB_CODE_UDF_FUNC_NOT_IMPLEMENTED, "udf function not implemented") +TAOS_DEFINE_ERROR(TSDB_CODE_UDF_FUNC_EXEC_FAILURE, "udf function execution failure") //schemaless TAOS_DEFINE_ERROR(TSDB_CODE_SML_INVALID_PROTOCOL_TYPE, "Invalid line protocol type") diff --git a/source/util/src/tversion.c b/source/util/src/tversion.c index c70fdc87a6363b1a9fd08bddef3e1b3d0439162e..dc357c61a10df4294f2bc78bcebe514a11aa0879 100644 --- a/source/util/src/tversion.c +++ b/source/util/src/tversion.c @@ -89,3 +89,20 @@ int32_t taosCheckVersionCompatible(int32_t clientVer, int32_t serverVer, int32_t return -1; } } + +int32_t taosCheckVersionCompatibleFromStr(const char *pClientVersion, const char *pServerVersion, + int32_t comparedSegments) { + int32_t clientVersion = 0; + int32_t serverVersion = 0; + int32_t code = taosVersionStrToInt(pClientVersion, &clientVersion); + if (TSDB_CODE_SUCCESS == code) { + code = taosVersionStrToInt(pServerVersion, &serverVersion); + } + if (TSDB_CODE_SUCCESS == code) { + code = taosCheckVersionCompatible(clientVersion, serverVersion, comparedSegments); + } + if (TSDB_CODE_SUCCESS != code) { + code = terrno; + } + return code; +} \ No newline at end of file diff --git a/tests/develop-test/2-query/show_create_db.py b/tests/develop-test/2-query/show_create_db.py index e5a79074ef2a1b9881f230b3eba2011edca517af..5574a59ec2e328f10a215adb3061e5626e28b100 100644 --- a/tests/develop-test/2-query/show_create_db.py +++ b/tests/develop-test/2-query/show_create_db.py @@ -42,17 +42,17 @@ class TDTestCase: tdSql.query('show create database scd;') tdSql.checkRows(1) tdSql.checkData(0, 0, 'scd') - tdSql.checkData(0, 1, "CREATE DATABASE `scd` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 14400m WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 1 KEEP 5256000m,5256000m,5256000m PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0") + tdSql.checkData(0, 1, "CREATE DATABASE `scd` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 14400m WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 1 KEEP 5256000m,5256000m,5256000m PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 0 WAL_RETENTION_SIZE 0 WAL_ROLL_PERIOD 0 WAL_SEGMENT_SIZE 0") tdSql.query('show create database scd2;') tdSql.checkRows(1) tdSql.checkData(0, 0, 'scd2') - tdSql.checkData(0, 1, "CREATE DATABASE `scd2` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 14400m WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 3 KEEP 5256000m,5256000m,5256000m PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0") + tdSql.checkData(0, 1, "CREATE DATABASE `scd2` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 14400m WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 3 KEEP 5256000m,5256000m,5256000m PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 0 WAL_RETENTION_SIZE 0 WAL_ROLL_PERIOD 0 WAL_SEGMENT_SIZE 0") tdSql.query('show create database scd4') tdSql.checkRows(1) tdSql.checkData(0, 0, 'scd4') - tdSql.checkData(0, 1, "CREATE DATABASE `scd4` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 14400m WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 13 KEEP 5256000m,5256000m,5256000m PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0") + tdSql.checkData(0, 1, "CREATE DATABASE `scd4` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 14400m WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 13 KEEP 5256000m,5256000m,5256000m PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 0 WAL_RETENTION_SIZE 0 WAL_ROLL_PERIOD 0 WAL_SEGMENT_SIZE 0") self.restartTaosd(1, dbname='scd') @@ -60,17 +60,17 @@ class TDTestCase: tdSql.query('show create database scd;') tdSql.checkRows(1) tdSql.checkData(0, 0, 'scd') - tdSql.checkData(0, 1, "CREATE DATABASE `scd` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 14400m WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 1 KEEP 5256000m,5256000m,5256000m PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0") + tdSql.checkData(0, 1, "CREATE DATABASE `scd` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 14400m WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 1 KEEP 5256000m,5256000m,5256000m PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 0 WAL_RETENTION_SIZE 0 WAL_ROLL_PERIOD 0 WAL_SEGMENT_SIZE 0") tdSql.query('show create database scd2;') tdSql.checkRows(1) tdSql.checkData(0, 0, 'scd2') - tdSql.checkData(0, 1, "CREATE DATABASE `scd2` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 14400m WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 3 KEEP 5256000m,5256000m,5256000m PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0") + tdSql.checkData(0, 1, "CREATE DATABASE `scd2` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 14400m WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 3 KEEP 5256000m,5256000m,5256000m PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 0 WAL_RETENTION_SIZE 0 WAL_ROLL_PERIOD 0 WAL_SEGMENT_SIZE 0") tdSql.query('show create database scd4') tdSql.checkRows(1) tdSql.checkData(0, 0, 'scd4') - tdSql.checkData(0, 1, "CREATE DATABASE `scd4` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 14400m WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 13 KEEP 5256000m,5256000m,5256000m PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0") + tdSql.checkData(0, 1, "CREATE DATABASE `scd4` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 14400m WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 13 KEEP 5256000m,5256000m,5256000m PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 0 WAL_RETENTION_SIZE 0 WAL_ROLL_PERIOD 0 WAL_SEGMENT_SIZE 0") tdSql.execute('drop database scd') diff --git a/tests/develop-test/5-taos-tools/taosbenchmark/auto_create_table_json.py b/tests/develop-test/5-taos-tools/taosbenchmark/auto_create_table_json.py index a6167158a285d33a225a44d25e0a3c6ecc0e99dc..c4426010e439fcb24774c0322e0e928f0c83a572 100644 --- a/tests/develop-test/5-taos-tools/taosbenchmark/auto_create_table_json.py +++ b/tests/develop-test/5-taos-tools/taosbenchmark/auto_create_table_json.py @@ -31,6 +31,8 @@ class TDTestCase: tdSql.init(conn.cursor()) def getPath(self, tool="taosBenchmark"): + if (platform.system().lower() == 'windows'): + tool = tool + ".exe" selfPath = os.path.dirname(os.path.realpath(__file__)) if ("community" in selfPath): @@ -108,49 +110,49 @@ class TDTestCase: tdLog.info("%s" % cmd) os.system("%s" % cmd) tdSql.execute("reset query cache") - tdSql.query("select count(*) from (select distinct(tbname) from db.stb2)") + tdSql.query("select count(*) from (select distinct(tbname) from stmt_db.stb2)") tdSql.checkData(0, 0, 8) - tdSql.query("select count(*) from db.stb2") + tdSql.query("select count(*) from stmt_db.stb2") tdSql.checkData(0, 0, 160) - tdSql.query("select * from information_schema.ins_databases") - tdSql.checkData(2, 14, "us") + tdSql.query("select * from information_schema.ins_databases where name='stmt_db'") + tdSql.checkData(0, 14, "us") tdSql.execute("reset query cache") - tdSql.query("select count(*) from (select distinct(tbname) from db.`stb2-2`)") + tdSql.query("select count(*) from (select distinct(tbname) from stmt_db.`stb2-2`)") tdSql.checkData(0, 0, 8) - tdSql.query("select count(*) from db.`stb2-2`") + tdSql.query("select count(*) from stmt_db.`stb2-2`") tdSql.checkData(0, 0, 160) cmd = "%s -f ./5-taos-tools/taosbenchmark/json/rest_auto_create_table.json" %binPath tdLog.info("%s" % cmd) os.system("%s" % cmd) tdSql.execute("reset query cache") - tdSql.query("select count(*) from (select distinct(tbname) from db.stb3)") + tdSql.query("select count(*) from (select distinct(tbname) from rest_db.stb3)") tdSql.checkData(0, 0, 8) - tdSql.query("select count(*) from db.stb3") + tdSql.query("select count(*) from rest_db.stb3") tdSql.checkData(0, 0, 160) - tdSql.query("select * from information_schema.ins_databases") - tdSql.checkData(2, 14, "ns") + tdSql.query("select * from information_schema.ins_databases where name='rest_db'") + tdSql.checkData(0, 14, "ns") tdSql.execute("reset query cache") - tdSql.query("select count(*) from (select distinct(tbname) from db.`stb3-2`)") + tdSql.query("select count(*) from (select distinct(tbname) from rest_db.`stb3-2`)") tdSql.checkData(0, 0, 8) - tdSql.query("select count(*) from db.`stb3-2`") + tdSql.query("select count(*) from rest_db.`stb3-2`") tdSql.checkData(0, 0, 160) cmd = "%s -f ./5-taos-tools/taosbenchmark/json/sml_auto_create_table.json" %binPath tdLog.info("%s" % cmd) os.system("%s" % cmd) tdSql.execute("reset query cache") - tdSql.query("select count(*) from (select distinct(tbname) from db.stb4)") + tdSql.query("select count(*) from (select distinct(tbname) from sml_db.stb4)") tdSql.checkData(0, 0, 8) - tdSql.query("select count(*) from db.stb4") + tdSql.query("select count(*) from sml_db.stb4") tdSql.checkData(0, 0, 160) tdSql.execute("reset query cache") - tdSql.query("select count(*) from (select distinct(tbname) from db.`stb4-2`)") + tdSql.query("select count(*) from (select distinct(tbname) from sml_db.`stb4-2`)") tdSql.checkData(0, 0, 8) - tdSql.query("select count(*) from db.`stb4-2`") + tdSql.query("select count(*) from sml_db.`stb4-2`") tdSql.checkData(0, 0, 160) tAdapter.stop() diff --git a/tests/develop-test/5-taos-tools/taosbenchmark/commandline.py b/tests/develop-test/5-taos-tools/taosbenchmark/commandline.py index ba296584ba6e81e2f8db6860240c6535cfc62cbf..b353566b256c796f7c60af8a161fc767099391a4 100644 --- a/tests/develop-test/5-taos-tools/taosbenchmark/commandline.py +++ b/tests/develop-test/5-taos-tools/taosbenchmark/commandline.py @@ -33,6 +33,8 @@ class TDTestCase: tdSql.init(conn.cursor(), logSql) def getPath(self, tool="taosBenchmark"): + if (platform.system().lower() == 'windows'): + tool = tool + ".exe" selfPath = os.path.dirname(os.path.realpath(__file__)) if ("community" in selfPath): diff --git a/tests/develop-test/5-taos-tools/taosbenchmark/custom_col_tag.py b/tests/develop-test/5-taos-tools/taosbenchmark/custom_col_tag.py index 0fb39c210c96d9a5db7b2f4216fe023499002f01..d1a807c201217cd04a9ec348411daa2fab7266f6 100644 --- a/tests/develop-test/5-taos-tools/taosbenchmark/custom_col_tag.py +++ b/tests/develop-test/5-taos-tools/taosbenchmark/custom_col_tag.py @@ -30,6 +30,8 @@ class TDTestCase: tdSql.init(conn.cursor(), logSql) def getPath(self, tool="taosBenchmark"): + if (platform.system().lower() == 'windows'): + tool = tool + ".exe" selfPath = os.path.dirname(os.path.realpath(__file__)) if ("community" in selfPath): diff --git a/tests/develop-test/5-taos-tools/taosbenchmark/default_json.py b/tests/develop-test/5-taos-tools/taosbenchmark/default_json.py index 7599c82483509807d222d73557d3164c35159403..b06b0890ff2b5f671f4d347d1f5f77d305e2f367 100644 --- a/tests/develop-test/5-taos-tools/taosbenchmark/default_json.py +++ b/tests/develop-test/5-taos-tools/taosbenchmark/default_json.py @@ -29,25 +29,23 @@ class TDTestCase: tdSql.init(conn.cursor(), logSql) def getPath(self, tool="taosBenchmark"): + if (platform.system().lower() == 'windows'): + tool = tool + ".exe" selfPath = os.path.dirname(os.path.realpath(__file__)) - if "community" in selfPath: - projPath = selfPath[: selfPath.find("community")] - elif "src" in selfPath: - projPath = selfPath[: selfPath.find("src")] - elif "/tools/" in selfPath: - projPath = selfPath[: selfPath.find("/tools/")] + if ("community" in selfPath): + projPath = selfPath[:selfPath.find("community")] else: - projPath = selfPath[: selfPath.find("tests")] + projPath = selfPath[:selfPath.find("tests")] paths = [] for root, dirs, files in os.walk(projPath): - if (tool) in files: + if ((tool) in files): rootRealPath = os.path.dirname(os.path.realpath(root)) - if "packaging" not in rootRealPath: + if ("packaging" not in rootRealPath): paths.append(os.path.join(root, tool)) break - if len(paths) == 0: + if (len(paths) == 0): tdLog.exit("taosBenchmark not found!") return else: diff --git a/tests/develop-test/5-taos-tools/taosbenchmark/demo.py b/tests/develop-test/5-taos-tools/taosbenchmark/demo.py index 25a8d92f7e9b45e55011d5fe0bb241bb68962340..3f9c2160de24bfc7dde983178bbcef31c1e0c45f 100644 --- a/tests/develop-test/5-taos-tools/taosbenchmark/demo.py +++ b/tests/develop-test/5-taos-tools/taosbenchmark/demo.py @@ -33,6 +33,8 @@ class TDTestCase: tdSql.init(conn.cursor(), logSql) def getPath(self, tool="taosBenchmark"): + if (platform.system().lower() == 'windows'): + tool = tool + ".exe" selfPath = os.path.dirname(os.path.realpath(__file__)) if "community" in selfPath: diff --git a/tests/develop-test/5-taos-tools/taosbenchmark/insert_alltypes_json.py b/tests/develop-test/5-taos-tools/taosbenchmark/insert_alltypes_json.py index 54657995e2b0abcfa80b1b08be0b40b9bf415126..cf76e362e5b8174fccff02615efc8778496e70df 100644 --- a/tests/develop-test/5-taos-tools/taosbenchmark/insert_alltypes_json.py +++ b/tests/develop-test/5-taos-tools/taosbenchmark/insert_alltypes_json.py @@ -30,6 +30,8 @@ class TDTestCase: tdSql.init(conn.cursor(), logSql) def getPath(self, tool="taosBenchmark"): + if (platform.system().lower() == 'windows'): + tool = tool + ".exe" selfPath = os.path.dirname(os.path.realpath(__file__)) if ("community" in selfPath): diff --git a/tests/develop-test/5-taos-tools/taosbenchmark/invalid_commandline.py b/tests/develop-test/5-taos-tools/taosbenchmark/invalid_commandline.py index d706eea068221602e057baa236b1dd671ddd1674..1a7f422123f826bbc4f22426de8c89732215a69e 100644 --- a/tests/develop-test/5-taos-tools/taosbenchmark/invalid_commandline.py +++ b/tests/develop-test/5-taos-tools/taosbenchmark/invalid_commandline.py @@ -30,6 +30,8 @@ class TDTestCase: tdSql.init(conn.cursor(), logSql) def getPath(self, tool="taosBenchmark"): + if (platform.system().lower() == 'windows'): + tool = tool + ".exe" selfPath = os.path.dirname(os.path.realpath(__file__)) if ("community" in selfPath): diff --git a/tests/develop-test/5-taos-tools/taosbenchmark/json/rest_auto_create_table.json b/tests/develop-test/5-taos-tools/taosbenchmark/json/rest_auto_create_table.json index 868ff99842d9f1015e24a17aa91fc45700f036f3..9b99521f52794b94558daef935a8aefbe57b5c6b 100644 --- a/tests/develop-test/5-taos-tools/taosbenchmark/json/rest_auto_create_table.json +++ b/tests/develop-test/5-taos-tools/taosbenchmark/json/rest_auto_create_table.json @@ -15,7 +15,7 @@ "num_of_records_per_req": 10, "databases": [{ "dbinfo": { - "name": "db", + "name": "rest_db", "drop": "yes", "replica": 1, "precision": "ns", diff --git a/tests/develop-test/5-taos-tools/taosbenchmark/json/sml_auto_create_table.json b/tests/develop-test/5-taos-tools/taosbenchmark/json/sml_auto_create_table.json index 1bbeca672b42dfe6b5b48c726fa5b11408ffcaf2..7b87919a6dbebd5f4abc05bb1139f309f23fed6f 100644 --- a/tests/develop-test/5-taos-tools/taosbenchmark/json/sml_auto_create_table.json +++ b/tests/develop-test/5-taos-tools/taosbenchmark/json/sml_auto_create_table.json @@ -15,7 +15,7 @@ "num_of_records_per_req": 10, "databases": [{ "dbinfo": { - "name": "db", + "name": "sml_db", "drop": "yes", "replica": 1, "precision": "ms", diff --git a/tests/develop-test/5-taos-tools/taosbenchmark/json/stmt_auto_create_table.json b/tests/develop-test/5-taos-tools/taosbenchmark/json/stmt_auto_create_table.json index e6e773f6167a42f19074a412527f8ccad5689e9e..baf0384e46d51f802f7dd842b1b49925efd00abc 100644 --- a/tests/develop-test/5-taos-tools/taosbenchmark/json/stmt_auto_create_table.json +++ b/tests/develop-test/5-taos-tools/taosbenchmark/json/stmt_auto_create_table.json @@ -15,7 +15,7 @@ "num_of_records_per_req": 10, "databases": [{ "dbinfo": { - "name": "db", + "name": "stmt_db", "drop": "yes", "replica": 1, "precision": "us", diff --git a/tests/develop-test/5-taos-tools/taosbenchmark/json_tag.py b/tests/develop-test/5-taos-tools/taosbenchmark/json_tag.py index afefabef66ef8b242a98874d5c15442e173f2df9..ea1bc165202c53fa7a714a1b249dfd15a786310f 100644 --- a/tests/develop-test/5-taos-tools/taosbenchmark/json_tag.py +++ b/tests/develop-test/5-taos-tools/taosbenchmark/json_tag.py @@ -30,6 +30,8 @@ class TDTestCase: tdSql.init(conn.cursor(), logSql) def getPath(self, tool="taosBenchmark"): + if (platform.system().lower() == 'windows'): + tool = tool + ".exe" selfPath = os.path.dirname(os.path.realpath(__file__)) if ("community" in selfPath): diff --git a/tests/develop-test/5-taos-tools/taosbenchmark/limit_offset_json.py b/tests/develop-test/5-taos-tools/taosbenchmark/limit_offset_json.py index d95e6741f8af4ee837fe903dbc60fee894bebd7f..a1a77ba0bbf0e2fccfca222b20b30a619627e1bc 100644 --- a/tests/develop-test/5-taos-tools/taosbenchmark/limit_offset_json.py +++ b/tests/develop-test/5-taos-tools/taosbenchmark/limit_offset_json.py @@ -30,6 +30,8 @@ class TDTestCase: tdSql.init(conn.cursor(), logSql) def getPath(self, tool="taosBenchmark"): + if (platform.system().lower() == 'windows'): + tool = tool + ".exe" selfPath = os.path.dirname(os.path.realpath(__file__)) if ("community" in selfPath): diff --git a/tests/develop-test/5-taos-tools/taosbenchmark/query_json.py b/tests/develop-test/5-taos-tools/taosbenchmark/query_json.py index c906f6167526c707f1a065b32dfd65fe5bdc7eac..f300e6520341e5c36ff216f1378f106a9699fce1 100644 --- a/tests/develop-test/5-taos-tools/taosbenchmark/query_json.py +++ b/tests/develop-test/5-taos-tools/taosbenchmark/query_json.py @@ -35,6 +35,8 @@ class TDTestCase: tdSql.init(conn.cursor(), logSql) def getPath(self, tool="taosBenchmark"): + if (platform.system().lower() == 'windows'): + tool = tool + ".exe" selfPath = os.path.dirname(os.path.realpath(__file__)) if ("community" in selfPath): diff --git a/tests/develop-test/5-taos-tools/taosbenchmark/sample_csv_json.py b/tests/develop-test/5-taos-tools/taosbenchmark/sample_csv_json.py index fd79f1e01b4ad28f8dfb75a13d114113ab1604ea..5d4dd794887efd55b5c81b2f6f89a7403c3390ea 100644 --- a/tests/develop-test/5-taos-tools/taosbenchmark/sample_csv_json.py +++ b/tests/develop-test/5-taos-tools/taosbenchmark/sample_csv_json.py @@ -30,6 +30,8 @@ class TDTestCase: tdSql.init(conn.cursor(), logSql) def getPath(self, tool="taosBenchmark"): + if (platform.system().lower() == 'windows'): + tool = tool + ".exe" selfPath = os.path.dirname(os.path.realpath(__file__)) if ("community" in selfPath): diff --git a/tests/develop-test/5-taos-tools/taosbenchmark/sml_interlace.py b/tests/develop-test/5-taos-tools/taosbenchmark/sml_interlace.py index 200a3c0e69bc5b2e6c3b3dd6926885c5ca8d6f8f..3e40dd6a5e69548d20178d12aa7bd0a73ef6f1c2 100644 --- a/tests/develop-test/5-taos-tools/taosbenchmark/sml_interlace.py +++ b/tests/develop-test/5-taos-tools/taosbenchmark/sml_interlace.py @@ -30,6 +30,8 @@ class TDTestCase: tdSql.init(conn.cursor(), logSql) def getPath(self, tool="taosBenchmark"): + if (platform.system().lower() == 'windows'): + tool = tool + ".exe" selfPath = os.path.dirname(os.path.realpath(__file__)) if ("community" in selfPath): diff --git a/tests/develop-test/5-taos-tools/taosbenchmark/sml_json_alltypes.py b/tests/develop-test/5-taos-tools/taosbenchmark/sml_json_alltypes.py index 0d10741331578f678198ad8dac597fe56a6c0709..ff82713ca3d4edf417c45d99f96393fe2cf64de5 100644 --- a/tests/develop-test/5-taos-tools/taosbenchmark/sml_json_alltypes.py +++ b/tests/develop-test/5-taos-tools/taosbenchmark/sml_json_alltypes.py @@ -29,28 +29,23 @@ class TDTestCase: tdSql.init(conn.cursor(), logSql) def getPath(self, tool="taosBenchmark"): + if (platform.system().lower() == 'windows'): + tool = tool + ".exe" selfPath = os.path.dirname(os.path.realpath(__file__)) - if "community" in selfPath: - projPath = selfPath[: selfPath.find("community")] - elif "src" in selfPath: - projPath = selfPath[: selfPath.find("src")] - elif "/tools/" in selfPath: - projPath = selfPath[: selfPath.find("/tools/")] - elif "/tests/" in selfPath: - projPath = selfPath[: selfPath.find("/tests/")] + if ("community" in selfPath): + projPath = selfPath[:selfPath.find("community")] else: - tdLog.info("cannot found %s in path: %s, use system's" % (tool, selfPath)) - projPath = "/usr/local/taos/bin/" + projPath = selfPath[:selfPath.find("tests")] paths = [] - for root, dummy, files in os.walk(projPath): - if (tool) in files: + for root, dirs, files in os.walk(projPath): + if ((tool) in files): rootRealPath = os.path.dirname(os.path.realpath(root)) - if "packaging" not in rootRealPath: + if ("packaging" not in rootRealPath): paths.append(os.path.join(root, tool)) break - if len(paths) == 0: + if (len(paths) == 0): tdLog.exit("taosBenchmark not found!") return else: diff --git a/tests/develop-test/5-taos-tools/taosbenchmark/sml_telnet_alltypes.py b/tests/develop-test/5-taos-tools/taosbenchmark/sml_telnet_alltypes.py index 241c6d63593d9cc5f203e88d7515d1085e446122..e8fa4f81fe234c6415eed425d4a91d90614cb635 100644 --- a/tests/develop-test/5-taos-tools/taosbenchmark/sml_telnet_alltypes.py +++ b/tests/develop-test/5-taos-tools/taosbenchmark/sml_telnet_alltypes.py @@ -30,6 +30,8 @@ class TDTestCase: tdSql.init(conn.cursor(), logSql) def getPath(self, tool="taosBenchmark"): + if (platform.system().lower() == 'windows'): + tool = tool + ".exe" selfPath = os.path.dirname(os.path.realpath(__file__)) if ("community" in selfPath): diff --git a/tests/develop-test/5-taos-tools/taosbenchmark/taosadapter_json.py b/tests/develop-test/5-taos-tools/taosbenchmark/taosadapter_json.py index 4d0adde1922bb62c8987133f14d0b7647c12b504..488bb6f81e7f48a7ce5924be1b0d948eddfd7da8 100644 --- a/tests/develop-test/5-taos-tools/taosbenchmark/taosadapter_json.py +++ b/tests/develop-test/5-taos-tools/taosbenchmark/taosadapter_json.py @@ -31,6 +31,8 @@ class TDTestCase: tdSql.init(conn.cursor(), logSql) def getPath(self, tool="taosBenchmark"): + if (platform.system().lower() == 'windows'): + tool = tool + ".exe" selfPath = os.path.dirname(os.path.realpath(__file__)) if ("community" in selfPath): diff --git a/tests/develop-test/5-taos-tools/taosbenchmark/taosdemoTestQueryWithJson.py b/tests/develop-test/5-taos-tools/taosbenchmark/taosdemoTestQueryWithJson.py index 19500c7dca946f3c0a1887eaa3d4bdcfa35390ef..91ebf1b1df1f5d60068a354f5c4fc10deff70b99 100644 --- a/tests/develop-test/5-taos-tools/taosbenchmark/taosdemoTestQueryWithJson.py +++ b/tests/develop-test/5-taos-tools/taosbenchmark/taosdemoTestQueryWithJson.py @@ -32,30 +32,28 @@ class TDTestCase: tdSql.init(conn.cursor(), logSql) def getPath(self, tool="taosBenchmark"): + if (platform.system().lower() == 'windows'): + tool = tool + ".exe" selfPath = os.path.dirname(os.path.realpath(__file__)) - if "community" in selfPath: - projPath = selfPath[: selfPath.find("community")] - elif "src" in selfPath: - projPath = selfPath[: selfPath.find("src")] - elif "/tools/" in selfPath: - projPath = selfPath[: selfPath.find("/tools/")] - elif "/tests/" in selfPath: - projPath = selfPath[: selfPath.find("/tests/")] + if ("community" in selfPath): + projPath = selfPath[:selfPath.find("community")] else: - tdLog.info("cannot found %s in path: %s, use system's" % (tool, selfPath)) - projPath = "/usr/local/taos/bin/" + projPath = selfPath[:selfPath.find("tests")] paths = [] for root, dirs, files in os.walk(projPath): - if (tool) in files: + if ((tool) in files): rootRealPath = os.path.dirname(os.path.realpath(root)) - if "packaging" not in rootRealPath: + if ("packaging" not in rootRealPath): paths.append(os.path.join(root, tool)) break - if len(paths) == 0: - return "" - return paths[0] + if (len(paths) == 0): + tdLog.exit("taosBenchmark not found!") + return + else: + tdLog.info("taosBenchmark found in %s" % paths[0]) + return paths[0] # 获取taosc接口查询的结果文件中的内容,返回每行数据,并断言数据的第一列内容。 def assertfileDataTaosc(self, filename, expectResult): diff --git a/tests/develop-test/5-taos-tools/taosbenchmark/telnet_tcp.py b/tests/develop-test/5-taos-tools/taosbenchmark/telnet_tcp.py index 23e788916f63d899d3ae3059a8062d54dcf329c6..0392b58aa2df54ebc75dc8647fed7e9bc51dd3f2 100644 --- a/tests/develop-test/5-taos-tools/taosbenchmark/telnet_tcp.py +++ b/tests/develop-test/5-taos-tools/taosbenchmark/telnet_tcp.py @@ -29,27 +29,23 @@ class TDTestCase: tdSql.init(conn.cursor(), logSql) def getPath(self, tool="taosBenchmark"): + if (platform.system().lower() == 'windows'): + tool = tool + ".exe" selfPath = os.path.dirname(os.path.realpath(__file__)) - if "community" in selfPath: - projPath = selfPath[: selfPath.find("community")] - elif "src" in selfPath: - projPath = selfPath[: selfPath.find("src")] - elif "/tools/" in selfPath: - projPath = selfPath[: selfPath.find("/tools/")] - elif "/tests/" in selfPath: - projPath = selfPath[: selfPath.find("/tests/")] + if ("community" in selfPath): + projPath = selfPath[:selfPath.find("community")] else: - tdLog.exit("cannot found %s in path: %s, use system's" % (tool, selfPath)) + projPath = selfPath[:selfPath.find("tests")] paths = [] for root, dirs, files in os.walk(projPath): - if (tool) in files: + if ((tool) in files): rootRealPath = os.path.dirname(os.path.realpath(root)) - if "packaging" not in rootRealPath: + if ("packaging" not in rootRealPath): paths.append(os.path.join(root, tool)) break - if len(paths) == 0: + if (len(paths) == 0): tdLog.exit("taosBenchmark not found!") return else: diff --git a/tests/develop-test/5-taos-tools/taosdump/taosdumpTestInspect.py b/tests/develop-test/5-taos-tools/taosdump/taosdumpTestInspect.py index 1ccbb1f7d659d4ce64ba83475997539d3f9d5845..197f05aac9889181dc5d988bfb27137fed53ea0d 100644 --- a/tests/develop-test/5-taos-tools/taosdump/taosdumpTestInspect.py +++ b/tests/develop-test/5-taos-tools/taosdump/taosdumpTestInspect.py @@ -30,30 +30,28 @@ class TDTestCase: self.tmpdir = "tmp" def getPath(self, tool="taosdump"): + if (platform.system().lower() == 'windows'): + tool = tool + ".exe" selfPath = os.path.dirname(os.path.realpath(__file__)) - if "community" in selfPath: - projPath = selfPath[: selfPath.find("community")] - elif "src" in selfPath: - projPath = selfPath[: selfPath.find("src")] - elif "/tools/" in selfPath: - projPath = selfPath[: selfPath.find("/tools/")] - elif "/tests/" in selfPath: - projPath = selfPath[: selfPath.find("/tests/")] + if ("community" in selfPath): + projPath = selfPath[:selfPath.find("community")] else: - tdLog.info("cannot found %s in path: %s, use system's" % (tool, selfPath)) - projPath = "/usr/local/taos/bin" + projPath = selfPath[:selfPath.find("tests")] paths = [] - for root, dummy, files in os.walk(projPath): - if (tool) in files: + for root, dirs, files in os.walk(projPath): + if ((tool) in files): rootRealPath = os.path.dirname(os.path.realpath(root)) - if "packaging" not in rootRealPath: + if ("packaging" not in rootRealPath): paths.append(os.path.join(root, tool)) break - if len(paths) == 0: - return "" - return paths[0] + if (len(paths) == 0): + tdLog.exit("taosBenchmark not found!") + return + else: + tdLog.info("taosBenchmark found in %s" % paths[0]) + return paths[0] def run(self): tdSql.prepare() diff --git a/tests/develop-test/test.py b/tests/develop-test/test.py index 600925174f358b6a4659b10b66a825cc7e12641d..6b1c63a1c0c4fe9415c921b97beb3dbe336235ce 100644 --- a/tests/develop-test/test.py +++ b/tests/develop-test/test.py @@ -316,9 +316,9 @@ if __name__ == "__main__": print(r) else: pass - if restful: - tAdapter.init(deployPath, masterIp) - tAdapter.stop(force_kill=True) + + tAdapter.init(deployPath, masterIp) + tAdapter.stop(force_kill=True) if dnodeNums == 1: tdDnodes.deploy(1, updateCfgDict) diff --git a/tests/develop-test/win-test-file b/tests/develop-test/win-test-file new file mode 100644 index 0000000000000000000000000000000000000000..e4f3bcf56ee0ea3154232d384e005855b60e3c82 --- /dev/null +++ b/tests/develop-test/win-test-file @@ -0,0 +1,13 @@ +python3 ./test.py -f 2-query/table_count_scan.py +python3 ./test.py -f 2-query/show_create_db.py +python3 ./test.py -f 5-taos-tools/taosbenchmark/auto_create_table_json.py +python3 ./test.py -f 5-taos-tools/taosbenchmark/custom_col_tag.py +python3 ./test.py -f 5-taos-tools/taosbenchmark/default_json.py +python3 ./test.py -f 5-taos-tools/taosbenchmark/demo.py +python3 ./test.py -f 5-taos-tools/taosbenchmark/insert_alltypes_json.py +python3 ./test.py -f 5-taos-tools/taosbenchmark/invalid_commandline.py +python3 ./test.py -f 5-taos-tools/taosbenchmark/json_tag.py +python3 ./test.py -f 5-taos-tools/taosbenchmark/query_json.py +python3 ./test.py -f 5-taos-tools/taosbenchmark/sample_csv_json.py +python3 ./test.py -f 5-taos-tools/taosbenchmark/taosdemoTestQueryWithJson.py -R +python3 ./test.py -f 5-taos-tools/taosbenchmark/telnet_tcp.py -R diff --git a/tests/docs-examples-test/jdbc.sh b/tests/docs-examples-test/jdbc.sh index d71085a40306956ea8d25e9b575c97ae9945df76..4fcc5404b6585ec64383cb8cd341687119698dd6 100644 --- a/tests/docs-examples-test/jdbc.sh +++ b/tests/docs-examples-test/jdbc.sh @@ -6,15 +6,10 @@ cd ../../docs/examples/java mvn clean test > jdbc-out.log 2>&1 tail -n 20 jdbc-out.log - -cases=`grep 'Tests run' jdbc-out.log | awk 'END{print $3}'` -totalJDBCCases=`echo ${cases/%,}` -failed=`grep 'Tests run' jdbc-out.log | awk 'END{print $5}'` -JDBCFailed=`echo ${failed/%,}` -error=`grep 'Tests run' jdbc-out.log | awk 'END{print $7}'` -JDBCError=`echo ${error/%,}` - -totalJDBCFailed=`expr $JDBCFailed + $JDBCError` +totalJDBCCases=`grep 'Tests run' jdbc-out.log | awk -F"[:,]" 'END{ print $2 }'` +failed=`grep 'Tests run' jdbc-out.log | awk -F"[:,]" 'END{ print $4 }'` +error=`grep 'Tests run' jdbc-out.log | awk -F"[:,]" 'END{ print $6 }'` +totalJDBCFailed=`expr $failed + $error` totalJDBCSuccess=`expr $totalJDBCCases - $totalJDBCFailed` if [ "$totalJDBCSuccess" -gt "0" ]; then diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index 9938bba1b26556157bc56d7877b82d1de9bdaf7b..ee86aa771a8324c0975162f91ac1d3ed5c4d9923 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -177,6 +177,7 @@ ,,y,script,./test.sh -f tsim/query/scalarNull.sim ,,y,script,./test.sh -f tsim/query/session.sim ,,y,script,./test.sh -f tsim/query/udf.sim +,,n,script,./test.sh -f tsim/query/udfpy.sim ,,y,script,./test.sh -f tsim/query/udf_with_const.sim ,,y,script,./test.sh -f tsim/query/sys_tbname.sim ,,y,script,./test.sh -f tsim/query/groupby.sim @@ -632,6 +633,8 @@ ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/case_when.py -R ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/blockSMA.py ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/blockSMA.py -R +,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/projectionDesc.py +,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/projectionDesc.py -R ,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/update_data.py ,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/tb_100w_data_order.py ,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/delete_stable.py @@ -655,6 +658,7 @@ ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/csum.py ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/function_diff.py ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/tagFilter.py +,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/projectionDesc.py ,,n,system-test,python3 ./test.py -f 2-query/queryQnode.py ,,y,system-test,./pytest.sh python3 ./test.py -f 6-cluster/5dnode1mnode.py ,,y,system-test,./pytest.sh python3 ./test.py -f 6-cluster/5dnode2mnode.py -N 5 @@ -680,8 +684,8 @@ ,,y,system-test,./pytest.sh python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateStb.py -N 6 -M 3 -n 3 ,,y,system-test,./pytest.sh python3 ./test.py -f 6-cluster/5dnode3mnodeRestartDnodeInsertData.py -N 6 -M 3 ,,y,system-test,./pytest.sh python3 ./test.py -f 6-cluster/5dnode3mnodeRestartDnodeInsertData.py -N 6 -M 3 -n 3 -#,,y,system-test,./pytest.sh python3 ./test.py -f 6-cluster/5dnode3mnodeRestartDnodeInsertDataAsync.py -N 6 -M 3 -#,,y,system-test,./pytest.sh python3 ./test.py -f 6-cluster/5dnode3mnodeRestartDnodeInsertDataAsync.py -N 6 -M 3 -n 3 +,,y,system-test,./pytest.sh python3 ./test.py -f 6-cluster/5dnode3mnodeRestartDnodeInsertDataAsync.py -N 6 -M 3 +,,y,system-test,./pytest.sh python3 ./test.py -f 6-cluster/5dnode3mnodeRestartDnodeInsertDataAsync.py -N 6 -M 3 -n 3 ,,y,system-test,./pytest.sh python3 ./test.py -f 6-cluster/5dnode3mnodeAdd1Ddnoe.py -N 7 -M 3 -C 6 ,,y,system-test,./pytest.sh python3 ./test.py -f 6-cluster/5dnode3mnodeAdd1Ddnoe.py -N 7 -M 3 -C 6 -n 3 @@ -738,7 +742,7 @@ ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqUpdateWithConsume.py -N 3 -n 3 ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqUpdate-multiCtb-snapshot0.py ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqUpdate-multiCtb-snapshot1.py -,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqDelete-1ctb.py +# ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqDelete-1ctb.py ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqDelete-multiCtb.py -N 3 -n 3 ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqDropStb.py ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqDropStbCtb.py @@ -854,6 +858,7 @@ ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/sml.py -Q 2 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/case_when.py -Q 2 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/blockSMA.py -Q 2 +,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/projectionDesc.py -Q 2 ,,y,system-test,./pytest.sh python3 ./test.py -f 99-TDcase/TD-21561.py -Q 2 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/between.py -Q 3 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/distinct.py -Q 3 @@ -952,6 +957,7 @@ ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/interp.py -Q 3 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/case_when.py -Q 3 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/blockSMA.py -Q 3 +,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/projectionDesc.py -Q 3 ,,y,system-test,./pytest.sh python3 ./test.py -f 99-TDcase/TD-21561.py -Q 3 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/between.py -Q 4 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/distinct.py -Q 4 @@ -1070,6 +1076,7 @@ ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/max_min_data.py -Q 3 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/max_min_data.py -Q 4 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/blockSMA.py -Q 4 +,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/projectionDesc.py -Q 4 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/odbc.py ,,y,system-test,./pytest.sh python3 ./test.py -f 99-TDcase/TD-21561.py -Q 4 ,,y,system-test,./pytest.sh python3 ./test.py -f 99-TDcase/TD-20582.py diff --git a/tests/parallel_test/run_case.sh b/tests/parallel_test/run_case.sh index e0b905375ac395089a536b544adbdf1049eeb036..ffc23ba6d2baa83b534532d1eac9cb154d007ecb 100755 --- a/tests/parallel_test/run_case.sh +++ b/tests/parallel_test/run_case.sh @@ -51,6 +51,9 @@ if [ $ent -eq 0 ]; then ln -s /home/TDengine/debug/build/lib/libtaos.so /usr/lib/libtaos.so 2>/dev/null ln -s /home/TDengine/debug/build/lib/libtaos.so /usr/lib/libtaos.so.1 2>/dev/null ln -s /home/TDengine/include/client/taos.h /usr/include/taos.h 2>/dev/null + ln -s /home/TDengine/include/common/taosdef.h /usr/include/taosdef.h 2>/dev/null + ln -s /home/TDengine/include/util/taoserror.h /usr/include/taoserror.h 2>/dev/null + ln -s /home/TDengine/include/libs/function/taosudf.h /usr/include/taosudf.h 2>/dev/null CONTAINER_TESTDIR=/home/TDengine else export PATH=$PATH:/home/TDinternal/debug/build/bin @@ -58,6 +61,9 @@ else ln -s /home/TDinternal/debug/build/lib/libtaos.so /usr/lib/libtaos.so 2>/dev/null ln -s /home/TDinternal/debug/build/lib/libtaos.so /usr/lib/libtaos.so.1 2>/dev/null ln -s /home/TDinternal/community/include/client/taos.h /usr/include/taos.h 2>/dev/null + ln -s /home/TDinternal/community/include/common/taosdef.h /usr/include/taosdef.h 2>/dev/null + ln -s /home/TDinternal/community/include/util/taoserror.h /usr/include/taoserror.h 2>/dev/null + ln -s /home/TDinternal/community/include/libs/function/taosudf.h /usr/include/taosudf.h 2>/dev/null CONTAINER_TESTDIR=/home/TDinternal/community fi mkdir -p /var/lib/taos/subscribe @@ -69,12 +75,19 @@ ulimit -c unlimited md5sum /usr/lib/libtaos.so.1 md5sum /home/TDinternal/debug/build/lib/libtaos.so + +#define taospy 2.7.6 +pip3 list|grep taospy +pip3 uninstall taospy -y +pip3 install taospy==2.7.6 + $TIMEOUT_CMD $cmd RET=$? echo "cmd exit code: $RET" md5sum /usr/lib/libtaos.so.1 md5sum /home/TDinternal/debug/build/lib/libtaos.so + if [ $RET -ne 0 ]; then pwd fi diff --git a/tests/parallel_test/run_container.sh b/tests/parallel_test/run_container.sh index b5deb09341547b7e9c6d85d9e973757578ab2849..8ea2f249c193aefee1bdcb2963fcea0102483568 100755 --- a/tests/parallel_test/run_container.sh +++ b/tests/parallel_test/run_container.sh @@ -130,8 +130,6 @@ docker run \ -v ${SOURCEDIR}:/usr/local/src/ \ -v "$TMP_DIR/thread_volume/$thread_no/sim:${SIM_DIR}" \ -v ${TMP_DIR}/thread_volume/$thread_no/coredump:$coredump_dir \ - -v $WORKDIR/taos-connector-python/taos:/usr/local/lib/python3.8/site-packages/taos:ro \ - -v $WORKDIR/taos-connector-python/taosrest:/usr/local/lib/python3.8/site-packages/taosrest:ro \ --rm --ulimit core=-1 taos_test:v1.0 $CONTAINER_TESTDIR/tests/parallel_test/run_case.sh -d "$exec_dir" -c "$cmd" $extra_param ret=$? exit $ret diff --git a/tests/parallel_test/split_case.sh b/tests/parallel_test/split_case.sh new file mode 100755 index 0000000000000000000000000000000000000000..af601ed9a6a1c4d371e56d94aa45bc56b8715793 --- /dev/null +++ b/tests/parallel_test/split_case.sh @@ -0,0 +1,58 @@ +case_file="cases_temp_file" + +parm_path=$(dirname $0) +parm_path=$(pwd ${parm_path}) +echo "execute path:${parm_path}" +cd ${parm_path} +cp cases.task ${case_file} +sed -i '/^$/d' ${case_file} +sed -i '$a\%%FINISHED%%' ${case_file} + +utest="unit-test" +tsimtest="script" +systest="system-test" +devtest="develop-test" +doctest="docs-examples-test" +rm -rf win-${utest}.log win-${tsimtest}.log win-${systest}.log win-${devtest}.log win-${doctest}.log +rm -rf ${parm_path}/../${utest}/win-test-file ${parm_path}/../${tsimtest}/win-test-file ${parm_path}/../${systest}/win-test-file ${parm_path}/../${devtest}/win-test-file +while read -r line +do + echo "$line"|grep -q "^#" + if [ $? -eq 0 ]; then + continue + fi + exec_dir=$(echo "$line"|cut -d ',' -f4) + case_cmd=$(echo "$line"|cut -d ',' -f5) + if [[ "${exec_dir}" == "${utest}" ]]; then + echo ${case_cmd} >> win-${utest}.log + continue + fi + if [[ "${exec_dir}" == "${tsimtest}" ]]; then + echo ${case_cmd} >> win-${tsimtest}.log + continue + fi + if [[ "${exec_dir}" == "${systest}" ]]; then + if [[ "${case_cmd}" =~ "pytest.sh" ]]; then + case_cmd=$(echo "$case_cmd"|cut -d ' ' -f 2-) + echo ${case_cmd} >> win-${systest}.log + else + echo ${case_cmd} >> win-${systest}.log + fi + continue + fi + if [[ "${exec_dir}" == "${devtest}" ]]; then + echo ${case_cmd} >> win-${devtest}.log + continue + fi + if [[ "${exec_dir}" == "${doctest}" ]]; then + echo ${case_cmd} >> win-${doctest}.log + continue + fi +done < ${case_file} +mv win-${utest}.log ${parm_path}/../${utest}/win-test-file +mv win-${tsimtest}.log ${parm_path}/../${tsimtest}/win-test-file +mv win-${systest}.log ${parm_path}/../${systest}/win-test-file +mv win-${devtest}.log ${parm_path}/../${devtest}/win-test-file + + +rm -rf ${case_file} diff --git a/tests/pytest/util/cases.py b/tests/pytest/util/cases.py index 82aa5523596c8d62557bad7d41d02e1ca897c9a9..4830d2f8b09e2364388f2c3ae1ad24a740de5390 100644 --- a/tests/pytest/util/cases.py +++ b/tests/pytest/util/cases.py @@ -94,14 +94,14 @@ class TDCases: tdLog.notice("total %d Windows test case(s) executed" % (runNum)) - def runOneWindows(self, conn, fileName): + def runOneWindows(self, conn, fileName, replicaVar=1): testModule = self.__dynamicLoadModule(fileName) runNum = 0 for tmp in self.windowsCases: if tmp.name.find(fileName) != -1: case = testModule.TDTestCase() - case.init(conn, self._logSql) + case.init(conn, self._logSql,replicaVar) try: case.run() except Exception as e: diff --git a/tests/pytest/util/dnodes-default.py b/tests/pytest/util/dnodes-default.py index 8da36f30748251f307a9152fd8907bdebc9e1405..6809c1082ca8db3c099f4d047be46104c0dccf5b 100644 --- a/tests/pytest/util/dnodes-default.py +++ b/tests/pytest/util/dnodes-default.py @@ -46,11 +46,11 @@ class TDSimClient: self.path = path def getLogDir(self): - self.logDir = "%s/sim/psim/log" % (self.path) + self.logDir = os.path.join(self.path,"sim","psim","log") return self.logDir def getCfgDir(self): - self.cfgDir = "%s/sim/psim/cfg" % (self.path) + self.cfgDir = os.path.join(self.path,"sim","psim","cfg") return self.cfgDir def setTestCluster(self, value): @@ -65,9 +65,9 @@ class TDSimClient: tdLog.exit(cmd) def deploy(self): - self.logDir = "%s/sim/psim/log" % (self.path) - self.cfgDir = "%s/sim/psim/cfg" % (self.path) - self.cfgPath = "%s/sim/psim/cfg/taos.cfg" % (self.path) + self.logDir = os.path.join(self.path,"sim","psim","log") + self.cfgDir = os.path.join(self.path,"sim","psim","cfg") + self.cfgPath = os.path.join(self.path,"sim","psim","cfg","taos.cfg") cmd = "rm -rf " + self.logDir if os.system(cmd) != 0: @@ -131,11 +131,10 @@ class TDDnode: return totalSize def deploy(self): - self.logDir = "%s/sim/dnode%d/log" % (self.path, self.index) - self.dataDir = "%s/sim/dnode%d/data" % (self.path, self.index) - self.cfgDir = "%s/sim/dnode%d/cfg" % (self.path, self.index) - self.cfgPath = "%s/sim/dnode%d/cfg/taos.cfg" % ( - self.path, self.index) + self.logDir = os.path.join(self.path,"sim","dnode%d" % self.index, "log") + self.dataDir = os.path.join(self.path,"sim","dnode%d" % self.index, "data") + self.cfgDir = os.path.join(self.path,"sim","dnode%d" % self.index, "cfg") + self.cfgPath = os.path.join(self.path,"sim","dnode%d" % self.index, "cfg","taos.cfg") cmd = "rm -rf " + self.dataDir if os.system(cmd) != 0: @@ -325,11 +324,11 @@ class TDDnode: tdLog.exit(cmd) def getDnodeRootDir(self, index): - dnodeRootDir = "%s/sim/psim/dnode%d" % (self.path, index) + dnodeRootDir = os.path.join(self.path,"sim","psim","dnode%d" % index) return dnodeRootDir def getDnodesRootDir(self): - dnodesRootDir = "%s/sim/psim" % (self.path) + dnodesRootDir = os.path.join(self.path,"sim","psim") return dnodesRootDir diff --git a/tests/pytest/util/dnodes-no-random-fail.py b/tests/pytest/util/dnodes-no-random-fail.py index a973f8da52d63aa04ecc3eb4afea47c93419e0c5..0e433e9664ef7ca05652e6fbb03949a9311c0bdf 100644 --- a/tests/pytest/util/dnodes-no-random-fail.py +++ b/tests/pytest/util/dnodes-no-random-fail.py @@ -44,11 +44,11 @@ class TDSimClient: self.path = path def getLogDir(self): - self.logDir = "%s/sim/psim/log" % (self.path) + self.logDir = os.path.join(self.path,"sim","psim","log") return self.logDir def getCfgDir(self): - self.cfgDir = "%s/sim/psim/cfg" % (self.path) + self.cfgDir = os.path.join(self.path,"sim","psim","cfg") return self.cfgDir def setTestCluster(self, value): @@ -63,9 +63,9 @@ class TDSimClient: tdLog.exit(cmd) def deploy(self): - self.logDir = "%s/sim/psim/log" % (self.path) - self.cfgDir = "%s/sim/psim/cfg" % (self.path) - self.cfgPath = "%s/sim/psim/cfg/taos.cfg" % (self.path) + self.logDir = os.path.join(self.path,"sim","psim","log") + self.cfgDir = os.path.join(self.path,"sim","psim","cfg") + self.cfgPath = os.path.join(self.path,"sim","psim","cfg","taos.cfg") cmd = "rm -rf " + self.logDir if os.system(cmd) != 0: @@ -129,11 +129,10 @@ class TDDnode: return totalSize def deploy(self): - self.logDir = "%s/sim/dnode%d/log" % (self.path, self.index) - self.dataDir = "%s/sim/dnode%d/data" % (self.path, self.index) - self.cfgDir = "%s/sim/dnode%d/cfg" % (self.path, self.index) - self.cfgPath = "%s/sim/dnode%d/cfg/taos.cfg" % ( - self.path, self.index) + self.logDir = os.path.join(self.path,"sim","dnode%d" % self.index, "log") + self.dataDir = os.path.join(self.path,"sim","dnode%d" % self.index, "data") + self.cfgDir = os.path.join(self.path,"sim","dnode%d" % self.index, "cfg") + self.cfgPath = os.path.join(self.path,"sim","dnode%d" % self.index, "cfg","taos.cfg") cmd = "rm -rf " + self.dataDir if os.system(cmd) != 0: @@ -323,11 +322,11 @@ class TDDnode: tdLog.exit(cmd) def getDnodeRootDir(self, index): - dnodeRootDir = "%s/sim/psim/dnode%d" % (self.path, index) + dnodeRootDir = os.path.join(self.path,"sim","psim","dnode%d" % index) return dnodeRootDir def getDnodesRootDir(self): - dnodesRootDir = "%s/sim/psim" % (self.path) + dnodesRootDir = os.path.join(self.path,"sim","psim") return dnodesRootDir diff --git a/tests/pytest/util/dnodes-random-fail.py b/tests/pytest/util/dnodes-random-fail.py index 9b653844f880f6f0667c2b96bf9a264c04d5c613..1c527290ec3c0a24b0a0175da104eeca2ffcfdfb 100644 --- a/tests/pytest/util/dnodes-random-fail.py +++ b/tests/pytest/util/dnodes-random-fail.py @@ -41,11 +41,11 @@ class TDSimClient: self.path = path def getLogDir(self): - self.logDir = "%s/sim/psim/log" % (self.path) + self.logDir = os.path.join(self.path,"sim","psim","log") return self.logDir def getCfgDir(self): - self.cfgDir = "%s/sim/psim/cfg" % (self.path) + self.cfgDir = os.path.join(self.path,"sim","psim","cfg") return self.cfgDir def setTestCluster(self, value): @@ -60,9 +60,9 @@ class TDSimClient: tdLog.exit(cmd) def deploy(self): - self.logDir = "%s/sim/psim/log" % (self.path) - self.cfgDir = "%s/sim/psim/cfg" % (self.path) - self.cfgPath = "%s/sim/psim/cfg/taos.cfg" % (self.path) + self.logDir = os.path.join(self.path,"sim","psim","log") + self.cfgDir = os.path.join(self.path,"sim","psim","cfg") + self.cfgPath = os.path.join(self.path,"sim","psim","cfg","taos.cfg") cmd = "rm -rf " + self.logDir if os.system(cmd) != 0: @@ -126,11 +126,10 @@ class TDDnode: return totalSize def deploy(self): - self.logDir = "%s/sim/dnode%d/log" % (self.path, self.index) - self.dataDir = "%s/sim/dnode%d/data" % (self.path, self.index) - self.cfgDir = "%s/sim/dnode%d/cfg" % (self.path, self.index) - self.cfgPath = "%s/sim/dnode%d/cfg/taos.cfg" % ( - self.path, self.index) + self.logDir = os.path.join(self.path,"sim","dnode%d" % self.index, "log") + self.dataDir = os.path.join(self.path,"sim","dnode%d" % self.index, "data") + self.cfgDir = os.path.join(self.path,"sim","dnode%d" % self.index, "cfg") + self.cfgPath = os.path.join(self.path,"sim","dnode%d" % self.index, "cfg","taos.cfg") cmd = "rm -rf " + self.dataDir if os.system(cmd) != 0: @@ -320,11 +319,11 @@ class TDDnode: tdLog.exit(cmd) def getDnodeRootDir(self, index): - dnodeRootDir = "%s/sim/psim/dnode%d" % (self.path, index) + dnodeRootDir = os.path.join(self.path,"sim","psim","dnode%d" % index) return dnodeRootDir def getDnodesRootDir(self): - dnodesRootDir = "%s/sim/psim" % (self.path) + dnodesRootDir = os.path.join(self.path,"sim","psim") return dnodesRootDir diff --git a/tests/pytest/util/dnodes.py b/tests/pytest/util/dnodes.py index ddb3bfaa269e90a3272233181e0b7e3feab5bbab..80ab5baa9a8a23132abf75686ccdc6bebb6d8238 100644 --- a/tests/pytest/util/dnodes.py +++ b/tests/pytest/util/dnodes.py @@ -45,14 +45,16 @@ class TDSimClient: "supportVnodes": "1024", "enableQueryHb": "1", "telemetryReporting": "0", + "tqDebugflag": "135", + "wDebugflag":"135", } def getLogDir(self): - self.logDir = "%s/sim/psim/log" % (self.path) + self.logDir = os.path.join(self.path,"sim","psim","log") return self.logDir def getCfgDir(self): - self.cfgDir = "%s/sim/psim/cfg" % (self.path) + self.cfgDir = os.path.join(self.path,"sim","psim","cfg") return self.cfgDir def setTestCluster(self, value): @@ -67,9 +69,9 @@ class TDSimClient: tdLog.exit(cmd) def deploy(self, *updatecfgDict): - self.logDir = "%s/sim/psim/log" % (self.path) - self.cfgDir = "%s/sim/psim/cfg" % (self.path) - self.cfgPath = "%s/sim/psim/cfg/taos.cfg" % (self.path) + self.logDir = os.path.join(self.path,"sim","psim","log") + self.cfgDir = os.path.join(self.path,"sim","psim","cfg") + self.cfgPath = os.path.join(self.path,"sim","psim","cfg","taos.cfg") cmd = "rm -rf " + self.logDir if os.system(cmd) != 0: @@ -205,11 +207,10 @@ class TDDnode: self.remote_conn.run("python3 ./test.py %s -d %s -e %s"%(valgrindStr,remoteCfgDictStr,execCmdStr)) def deploy(self, *updatecfgDict): - self.logDir = "%s/sim/dnode%d/log" % (self.path, self.index) - self.dataDir = "%s/sim/dnode%d/data" % (self.path, self.index) - self.cfgDir = "%s/sim/dnode%d/cfg" % (self.path, self.index) - self.cfgPath = "%s/sim/dnode%d/cfg/taos.cfg" % ( - self.path, self.index) + self.logDir = os.path.join(self.path,"sim","dnode%d" % self.index, "log") + self.dataDir = os.path.join(self.path,"sim","dnode%d" % self.index, "data") + self.cfgDir = os.path.join(self.path,"sim","dnode%d" % self.index, "cfg") + self.cfgPath = os.path.join(self.path,"sim","dnode%d" % self.index, "cfg","taos.cfg") cmd = "rm -rf " + self.dataDir if os.system(cmd) != 0: @@ -470,20 +471,25 @@ class TDDnode: tdLog.exit("dnode:%d is not deployed" % (self.index)) if self.valgrind == 0: - if self.asan: - asanDir = "%s/sim/asan/dnode%d.asan" % ( - self.path, self.index) - cmd = "nohup %s -c %s > /dev/null 2> %s & " % ( - binPath, self.cfgDir, asanDir) + if platform.system().lower() == 'windows': + cmd = "mintty -h never %s -c %s" % (binPath, self.cfgDir) else: - cmd = "nohup %s -c %s > /dev/null 2>&1 & " % ( - binPath, self.cfgDir) + if self.asan: + asanDir = "%s/sim/asan/dnode%d.asan" % ( + self.path, self.index) + cmd = "nohup %s -c %s > /dev/null 2> %s & " % ( + binPath, self.cfgDir, asanDir) + else: + cmd = "nohup %s -c %s > /dev/null 2>&1 & " % ( + binPath, self.cfgDir) else: valgrindCmdline = "valgrind --log-file=\"%s/../log/valgrind.log\" --tool=memcheck --leak-check=full --show-reachable=no --track-origins=yes --show-leak-kinds=all -v --workaround-gcc296-bugs=yes"%self.cfgDir - - cmd = "nohup %s %s -c %s 2>&1 & " % ( - valgrindCmdline, binPath, self.cfgDir) - + if platform.system().lower() == 'windows': + cmd = "mintty -h never %s %s -c %s" % ( + valgrindCmdline, binPath, self.cfgDir) + else: + cmd = "nohup %s %s -c %s 2>&1 & " % ( + valgrindCmdline, binPath, self.cfgDir) print(cmd) if (self.remoteIP == ""): @@ -566,6 +572,8 @@ class TDDnode: while(processID): if not platform.system().lower() == 'windows' or (onlyKillOnceWindows == 0 and platform.system().lower() == 'windows'): killCmd = "kill -INT %s > /dev/null 2>&1" % processID + if platform.system().lower() == 'windows': + killCmd = "kill -INT %s > nul 2>&1" % processID os.system(killCmd) onlyKillOnceWindows = 1 time.sleep(1) @@ -633,11 +641,11 @@ class TDDnode: tdLog.exit(cmd) def getDnodeRootDir(self, index): - dnodeRootDir = "%s/sim/psim/dnode%d" % (self.path, index) + dnodeRootDir = os.path.join(self.path,"sim","psim","dnode%d" % index) return dnodeRootDir def getDnodesRootDir(self): - dnodesRootDir = "%s/sim/psim" % (self.path) + dnodesRootDir = os.path.join(self.path,"sim","psim") return dnodesRootDir @@ -787,15 +795,21 @@ class TDDnodes: processID = subprocess.check_output(psCmd, shell=True).decode("utf-8").strip() while(processID): print(processID) - if platform.system().lower() == 'windows': - killCmd = "kill -9 %s > nul 2>&1" % processID - else: - killCmd = "kill -9 %s > /dev/null 2>&1" % processID + killCmd = "kill -9 %s > /dev/null 2>&1" % processID + os.system(killCmd) + time.sleep(1) + processID = subprocess.check_output( + psCmd, shell=True).decode("utf-8").strip() + elif platform.system().lower() == 'windows': + psCmd = "for /f %a in ('wmic process where \"name='taosd.exe'\" get processId ^| xargs echo ^| awk '{print $2}' ^&^& echo aa') do @(ps | grep %a | awk '{print $1}' | xargs)" + processID = subprocess.check_output(psCmd, shell=True).decode("utf-8").strip() + while(processID): + print(processID) + killCmd = "kill -9 %s > nul 2>&1" % processID os.system(killCmd) time.sleep(1) processID = subprocess.check_output( psCmd, shell=True).decode("utf-8").strip() - else: psCmd = "ps -ef | grep -w taosd | grep 'root' | grep -v grep| grep -v defunct | awk '{print $2}' | xargs" processID = subprocess.check_output(psCmd, shell=True).decode("utf-8").strip() @@ -807,10 +821,7 @@ class TDDnodes: psCmd = "ps -ef|grep -w taosd| grep -v grep| grep -v defunct | awk '{print $2}' | xargs" processID = subprocess.check_output(psCmd, shell=True).decode("utf-8").strip() while(processID): - if platform.system().lower() == 'windows': - killCmd = "kill -9 %s > nul 2>&1" % processID - else: - killCmd = "kill -9 %s > /dev/null 2>&1" % processID + killCmd = "kill -9 %s > /dev/null 2>&1" % processID os.system(killCmd) time.sleep(1) processID = subprocess.check_output( diff --git a/tests/pytest/util/gettime.py b/tests/pytest/util/gettime.py index 94eed384789b85b746a523c3a0875bf1f5b711ea..d4a5e18dc9e9fb8f3ee032219d05c8a6d53becfb 100644 --- a/tests/pytest/util/gettime.py +++ b/tests/pytest/util/gettime.py @@ -18,6 +18,9 @@ class GetTime: def get_ms_timestamp(self,ts_str): _ts_str = ts_str + if "+" in _ts_str: + timestamp = datetime.fromisoformat(_ts_str) + return int((timestamp-datetime.fromtimestamp(0,timestamp.tzinfo)).total_seconds())*1000+int(timestamp.microsecond / 1000) if " " in ts_str: p = ts_str.split(" ")[1] if len(p) > 15 : diff --git a/tests/pytest/util/taosadapter.py b/tests/pytest/util/taosadapter.py index 79ea86c5bd820c1327cf844b35eb8800fefdfe60..1f1c38672e130f54478d1fed408f2948d2ec892a 100644 --- a/tests/pytest/util/taosadapter.py +++ b/tests/pytest/util/taosadapter.py @@ -1,4 +1,4 @@ -import socket +import requests from fabric2 import Connection from util.log import * from util.common import * @@ -132,9 +132,9 @@ class TAdapter: tdLog.exit(cmd) def deploy(self, *update_cfg_dict): - self.log_dir = f"{self.path}/sim/dnode1/log" - self.cfg_dir = f"{self.path}/sim/dnode1/cfg" - self.cfg_path = f"{self.cfg_dir}/taosadapter.toml" + self.log_dir = os.path.join(self.path,"sim","dnode1","log") + self.cfg_dir = os.path.join(self.path,"sim","dnode1","cfg") + self.cfg_path = os.path.join(self.cfg_dir,"taosadapter.toml") cmd = f"touch {self.cfg_path}" if os.system(cmd) != 0: @@ -162,7 +162,7 @@ class TAdapter: tdLog.info(f"taosadapter found: {bin_path}") if platform.system().lower() == 'windows': - cmd = f"mintty -h never {bin_path} -c {self.cfg_dir}" + cmd = f"mintty -h never {bin_path} -c {self.cfg_path}" else: cmd = f"nohup {bin_path} -c {self.cfg_path} > /dev/null & " @@ -170,7 +170,7 @@ class TAdapter: self.remote_exec(self.taosadapter_cfg_dict, f"tAdapter.deployed=1\ntAdapter.log_dir={self.log_dir}\ntAdapter.cfg_dir={self.cfg_dir}\ntAdapter.start()") self.running = 1 else: - os.system(f"rm -rf {self.log_dir}/taosadapter*") + os.system(f"rm -rf {self.log_dir}{os.sep}taosadapter*") if os.system(cmd) != 0: tdLog.exit(cmd) self.running = 1 @@ -179,22 +179,19 @@ class TAdapter: time.sleep(0.1) taosadapter_port = self.taosadapter_cfg_dict["port"] - s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - s.settimeout(3) - try: - res = s.connect_ex((self.remoteIP, taosadapter_port)) - s.shutdown(2) - if res == 0: - tdLog.info(f"the taosadapter has been started, using port:{taosadapter_port}") - else: - tdLog.info(f"the taosadapter do not started!!!") - except socket.error as e: - tdLog.notice("socket connect error!") - finally: - if s: - s.close() - # tdLog.debug("the taosadapter has been started.") - time.sleep(1) + for i in range(5): + ip = 'localhost' + if self.remoteIP != "": + ip = self.remoteIP + url = f'http://{ip}:{taosadapter_port}/-/ping' + try: + r = requests.get(url) + if r.status_code == 200: + tdLog.info(f"the taosadapter has been started, using port:{taosadapter_port}") + break + except Exception: + tdLog.info(f"the taosadapter do not started!!!") + time.sleep(1) def start_taosadapter(self): """ @@ -228,33 +225,36 @@ class TAdapter: def stop(self, force_kill=False): signal = "-9" if force_kill else "-15" - if self.remoteIP: self.remote_exec(self.taosadapter_cfg_dict, "tAdapter.running=1\ntAdapter.stop()") tdLog.info("stop taosadapter") return - toBeKilled = "taosadapter" - - if self.running != 0: + if platform.system().lower() == 'windows': psCmd = f"ps -ef|grep -w {toBeKilled}| grep -v grep | awk '{{print $2}}'" - # psCmd = f"pgrep {toBeKilled}" processID = subprocess.check_output(psCmd, shell=True).decode("utf-8").strip() - while(processID): - killCmd = "kill %s %s > /dev/null 2>&1" % (signal, processID) + while(processID): + killCmd = "kill %s %s > nul 2>&1" % (signal, processID) os.system(killCmd) time.sleep(1) - processID = subprocess.check_output(psCmd, shell=True).decode("utf-8").strip() - if not platform.system().lower() == 'windows': + processID = subprocess.check_output(psCmd, shell=True).decode("utf-8").strip() + self.running = 0 + tdLog.debug(f"taosadapter is stopped by kill {signal}") + + else: + if self.running != 0: + psCmd = f"ps -ef|grep -w {toBeKilled}| grep -v grep | awk '{{print $2}}'" + processID = subprocess.check_output(psCmd, shell=True).decode("utf-8").strip() + while(processID): + killCmd = "kill %s %s > /dev/null 2>&1" % (signal, processID) + os.system(killCmd) + time.sleep(1) + processID = subprocess.check_output(psCmd, shell=True).decode("utf-8").strip() port = 6041 fuserCmd = f"fuser -k -n tcp {port} > /dev/null" os.system(fuserCmd) - # for port in range(6030, 6041): - # fuserCmd = f"fuser -k -n tcp {port} > /dev/null" - # os.system(fuserCmd) - - self.running = 0 - tdLog.debug(f"taosadapter is stopped by kill {signal}") + self.running = 0 + tdLog.debug(f"taosadapter is stopped by kill {signal}") diff --git a/tests/script/api/insertSameTs.c b/tests/script/api/insertSameTs.c new file mode 100644 index 0000000000000000000000000000000000000000..ff5e4dd154afaf62d6c64d415b80ede1d9cb9b83 --- /dev/null +++ b/tests/script/api/insertSameTs.c @@ -0,0 +1,136 @@ +/* + * 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 . + */ + +// TAOS standard API example. The same syntax as MySQL, but only a subset +// to compile: gcc -o demo demo.c -ltaos + +#include +#include +#include +#include +#include "taos.h" // TAOS header file + +static void queryDB(TAOS *taos, char *command) { + int i; + TAOS_RES *pSql = NULL; + int32_t code = -1; + + for (i = 0; i < 5; i++) { + if (NULL != pSql) { + taos_free_result(pSql); + pSql = NULL; + } + + pSql = taos_query(taos, command); + code = taos_errno(pSql); + if (0 == code) { + break; + } + } + + if (code != 0) { + fprintf(stderr, "Failed to run %s, reason: %s\n", command, taos_errstr(pSql)); + taos_free_result(pSql); + taos_close(taos); + exit(EXIT_FAILURE); + } + + taos_free_result(pSql); +} + +void Test(TAOS *taos, char *qstr); + +int main(int argc, char *argv[]) { + char qstr[1024]; + + // connect to server + if (argc < 2) { + printf("please input server-ip \n"); + return 0; + } + + TAOS *taos = taos_connect(argv[1], "root", "taosdata", NULL, 0); + if (taos == NULL) { + printf("failed to connect to server, reason:%s\n", "null taos"/*taos_errstr(taos)*/); + exit(1); + } + Test(taos, qstr); + taos_close(taos); + taos_cleanup(); +} +void Test(TAOS *taos, char *qstr) { + queryDB(taos, "drop database if exists demo"); + queryDB(taos, "create database demo vgroups 1 minrows 10"); + TAOS_RES *result; + queryDB(taos, "use demo"); + + queryDB(taos, "create table m1 (ts timestamp, ti tinyint, si smallint, i int, bi bigint, f float, d double, b binary(10))"); + printf("success to create table\n"); + + int i = 0; + for (int32_t n = 0; n < 10; ++n) { + for (i = 0; i < 10; ++i) { + int32_t v = n * 10 + i; + sprintf(qstr, "insert into m1 values (%" PRId64 ", %d, %d, %d, %d, %f, %lf, '%s')", (uint64_t)1546300800000, v, v, v, v*10000000, v*1.0, v*2.0, "hello"); + printf("qstr: %s\n", qstr); + + TAOS_RES *result1 = taos_query(taos, qstr); + if (result1 == NULL || taos_errno(result1) != 0) { + printf("failed to insert row, reason:%s\n", taos_errstr(result1)); + taos_free_result(result1); + exit(1); + } else { + printf("insert row: %i\n", v); + } + taos_free_result(result1); + + strcpy(qstr, "flush database demo"); + result1 = taos_query(taos, qstr); + if (result1 == NULL || taos_errno(result1) != 0) { + printf("failed to fluash database, reason:%s\n", taos_errstr(result1)); + taos_free_result(result1); + exit(1); + } + taos_free_result(result1); + } + } + + // query the records + sprintf(qstr, "SELECT * FROM m1 order by ts desc"); + result = taos_query(taos, qstr); + if (result == NULL || taos_errno(result) != 0) { + printf("failed to select, reason:%s\n", taos_errstr(result)); + taos_free_result(result); + exit(1); + } + + TAOS_ROW row; + int rows = 0; + int num_fields = taos_field_count(result); + TAOS_FIELD *fields = taos_fetch_fields(result); + + printf("num_fields = %d\n", num_fields); + printf("select * from table order by ts desc, result:\n"); + // fetch the records row by row + while ((row = taos_fetch_row(result))) { + char temp[1024] = {0}; + rows++; + taos_print_row(temp, row, fields, num_fields); + printf("%s\n", temp); + } + + taos_free_result(result); +} + diff --git a/tests/script/api/makefile b/tests/script/api/makefile index 75a2273f12dc2809ac0cec4fa090caf3231e9ba1..6739794cc8e09025ec18ee92100453edce082f77 100644 --- a/tests/script/api/makefile +++ b/tests/script/api/makefile @@ -14,6 +14,7 @@ exe: gcc $(CFLAGS) ./batchprepare.c -o $(ROOT)batchprepare $(LFLAGS) gcc $(CFLAGS) ./stopquery.c -o $(ROOT)stopquery $(LFLAGS) gcc $(CFLAGS) ./dbTableRoute.c -o $(ROOT)dbTableRoute $(LFLAGS) + gcc $(CFLAGS) ./insertSameTs.c -o $(ROOT)insertSameTs $(LFLAGS) clean: rm $(ROOT)batchprepare diff --git a/tests/script/coverage_test.sh b/tests/script/coverage_test.sh index 3f99dde5442c5f0c9e88b5ea1df37f7a64e54003..a74e6dae737722f04a38f11b3e7c244b57a34441 100755 --- a/tests/script/coverage_test.sh +++ b/tests/script/coverage_test.sh @@ -56,9 +56,9 @@ function buildTDengine() { rm -rf * if [ "$branch" == "3.0" ]; then echo "3.0 =============" - cmake -DCOVER=true -DBUILD_TEST=true -DBUILD_HTTP=false -DBUILD_TOOLS=true .. + cmake -DCOVER=true -DBUILD_TEST=true -DBUILD_HTTP=false -DBUILD_TOOLS=true .. > /dev/null else - cmake -DCOVER=true -DBUILD_TOOLS=true -DBUILD_HTTP=false .. > /dev/null + cmake -DCOVER=true -DBUILD_TEST=true -DBUILD_TOOLS=true -DBUILD_HTTP=false .. > /dev/null fi make -j make install @@ -108,6 +108,19 @@ function runUnitTest() { echo " $TDENGINE_DIR/debug" cd $TDENGINE_DIR/debug ctest -j12 + + echo " $TDENGINE_DIR/tests/script/api" + cd $TDENGINE_DIR/tests/script/api + make clean && make + + stopTaosd + stopTaosadapter + + nohup taosd -c /etc/taos >> /dev/null 2>&1 & + ./batchprepare 127.0.0.1 + ./dbTableRoute 127.0.0.1 + ./stopquery 127.0.0.1 demo t1 + echo "3.0 unit test done" } @@ -115,7 +128,7 @@ function runSimCases() { echo "=== Run sim cases ===" cd $TDENGINE_DIR/tests/script - runCasesOneByOne ../parallel_test/cases.task sim + runCasesOneByOne ../parallel_test/cases.task sim totalSuccess=`grep 'sim success' $TDENGINE_COVERAGE_REPORT | wc -l` if [ "$totalSuccess" -gt "0" ]; then @@ -163,8 +176,8 @@ function runJDBCCases() { stopTaosd stopTaosadapter - taosd -c /etc/taos >> /dev/null 2>&1 & - taosadapter >> /dev/null 2>&1 & + nohup taosd -c /etc/taos >> /dev/null 2>&1 & + nohup taosadapter >> /dev/null 2>&1 & mvn clean test > result.txt 2>&1 summary=`grep "Tests run:" result.txt | tail -n 1` diff --git a/tests/script/sh/bit_and.c b/tests/script/sh/bit_and.c index 2f2e48fdb0882db2a40c9aae019402e031343d13..f3bf71ce946b5b5d62ac6d63de4c2532a799721e 100644 --- a/tests/script/sh/bit_and.c +++ b/tests/script/sh/bit_and.c @@ -1,61 +1,47 @@ -#include -#include #include +#include +#include #include "taosudf.h" +DLL_EXPORT int32_t bit_and_init() { return 0; } -DLL_EXPORT int32_t bit_and_init() { - return 0; -} - -DLL_EXPORT int32_t bit_and_destroy() { - return 0; -} - -DLL_EXPORT int32_t bit_and(SUdfDataBlock* block, SUdfColumn *resultCol) { +DLL_EXPORT int32_t bit_and_destroy() { return 0; } - if (block->numOfCols < 2) { - return TSDB_CODE_UDF_INVALID_INPUT; - } +DLL_EXPORT int32_t bit_and(SUdfDataBlock* block, SUdfColumn* resultCol) { + if (block->numOfCols < 2) { + return TSDB_CODE_UDF_INVALID_INPUT; + } - for (int32_t i = 0; i < block->numOfCols; ++i) { - SUdfColumn* col = block->udfCols[i]; - if (!(col->colMeta.type == TSDB_DATA_TYPE_INT)) { - return TSDB_CODE_UDF_INVALID_INPUT; - } + for (int32_t i = 0; i < block->numOfCols; ++i) { + SUdfColumn* col = block->udfCols[i]; + if (!(col->colMeta.type == TSDB_DATA_TYPE_INT)) { + return TSDB_CODE_UDF_INVALID_INPUT; } + } - SUdfColumnMeta *meta = &resultCol->colMeta; - meta->bytes = 4; - meta->type = TSDB_DATA_TYPE_INT; - meta->scale = 0; - meta->precision = 0; - - - SUdfColumnData *resultData = &resultCol->colData; - - resultData->numOfRows = block->numOfRows; - - for (int32_t i = 0; i < resultData->numOfRows; ++i) { - if (udfColDataIsNull(block->udfCols[0], i)) { - udfColDataSetNull(resultCol, i); - continue; - } - int32_t result = *(int32_t*)udfColDataGetData(block->udfCols[0], i); - int j = 1; - for (; j < block->numOfCols; ++j) { - if (udfColDataIsNull(block->udfCols[j], i)) { - udfColDataSetNull(resultCol, i); - break; - } - - char* colData = udfColDataGetData(block->udfCols[j], i); - result &= *(int32_t*)colData; - } - if (j == block->numOfCols) { - udfColDataSet(resultCol, i, (char*)&result, false); - } + SUdfColumnData* resultData = &resultCol->colData; + for (int32_t i = 0; i < block->numOfRows; ++i) { + if (udfColDataIsNull(block->udfCols[0], i)) { + udfColDataSetNull(resultCol, i); + continue; } - return TSDB_CODE_SUCCESS; + int32_t result = *(int32_t*)udfColDataGetData(block->udfCols[0], i); + int j = 1; + for (; j < block->numOfCols; ++j) { + if (udfColDataIsNull(block->udfCols[j], i)) { + udfColDataSetNull(resultCol, i); + break; + } + + char* colData = udfColDataGetData(block->udfCols[j], i); + result &= *(int32_t*)colData; + } + if (j == block->numOfCols) { + udfColDataSet(resultCol, i, (char*)&result, false); + } + } + resultData->numOfRows = block->numOfRows; + + return TSDB_CODE_SUCCESS; } diff --git a/tests/script/sh/checkValgrind.bat b/tests/script/sh/checkValgrind.bat new file mode 100644 index 0000000000000000000000000000000000000000..cd80750fde70b434e97113be34785c675f4b1211 --- /dev/null +++ b/tests/script/sh/checkValgrind.bat @@ -0,0 +1,2 @@ +@echo off +echo 0 \ No newline at end of file diff --git a/tests/script/sh/deploy.bat b/tests/script/sh/deploy.bat index 38e7022edec2c5dae9053e11934a65e108a75b93..fd76b3007874ef5ccdcbd6cacb5681587cec9a9d 100644 --- a/tests/script/sh/deploy.bat +++ b/tests/script/sh/deploy.bat @@ -54,7 +54,7 @@ if %NODE% == 6 set NODE=7600 if %NODE% == 7 set NODE=7700 if %NODE% == 8 set NODE=7800 -rem set "fqdn=" +set "fqdn=localhost" for /f "skip=1" %%A in ( 'wmic computersystem get caption' ) do if not defined fqdn set "fqdn=%%A" diff --git a/tests/script/sh/exec.bat b/tests/script/sh/exec.bat index 88dd43349ed9d49774faafe827b77126286c741d..75957882922a0bcf20dee10d5824f3c488b0697f 100644 --- a/tests/script/sh/exec.bat +++ b/tests/script/sh/exec.bat @@ -50,7 +50,7 @@ if %EXEC_OPTON% == start ( goto :finish ) echo check taosd online - tail -n +0 %TAOS_LOG% | grep -q "TDengine initialized successfully" || goto :check_online + tail -n +0 %TAOS_LOG% | grep -E "TDengine initialized successfully|from offline to online" || goto :check_online echo finish goto :finish ) diff --git a/tests/script/sh/l2norm.c b/tests/script/sh/l2norm.c index 8ccdffb8d69d1ba27410ad61a74ee3d7ca156be2..0b7f5bf7f6756c11331cae3140a9bf6b5cba024b 100644 --- a/tests/script/sh/l2norm.c +++ b/tests/script/sh/l2norm.c @@ -16,7 +16,7 @@ DLL_EXPORT int32_t l2norm_destroy() { DLL_EXPORT int32_t l2norm_start(SUdfInterBuf *buf) { *(int64_t*)(buf->buf) = 0; buf->bufLen = sizeof(double); - buf->numOfResult = 0; + buf->numOfResult = 1; return 0; } @@ -58,20 +58,11 @@ DLL_EXPORT int32_t l2norm(SUdfDataBlock* block, SUdfInterBuf *interBuf, SUdfInte *(double*)(newInterBuf->buf) = sumSquares; newInterBuf->bufLen = sizeof(double); - - if (interBuf->numOfResult == 0 && numNotNull == 0) { - newInterBuf->numOfResult = 0; - } else { - newInterBuf->numOfResult = 1; - } + newInterBuf->numOfResult = 1; return 0; } DLL_EXPORT int32_t l2norm_finish(SUdfInterBuf* buf, SUdfInterBuf *resultData) { - if (buf->numOfResult == 0) { - resultData->numOfResult = 0; - return 0; - } double sumSquares = *(double*)(buf->buf); *(double*)(resultData->buf) = sqrt(sumSquares); resultData->bufLen = sizeof(double); diff --git a/tests/script/sh/prepare_pyudf.sh b/tests/script/sh/prepare_pyudf.sh new file mode 100755 index 0000000000000000000000000000000000000000..b72f8c9f77f94cf35a6bf1daef93ee773e53acfe --- /dev/null +++ b/tests/script/sh/prepare_pyudf.sh @@ -0,0 +1,16 @@ +#!/bin/bash +set +e + +FILE=/usr/local/lib/libtaospyudf.so +if [ ! -f "$FILE" ]; then + echo "$FILE does not exist." + apt install -y python3 python3-dev python3-venv + /usr/bin/python3 -m venv /udfenv + source /udfenv/bin/activate + pip3 install taospyudf + ldconfig + deactivate +else + echo "show dependencies of $FILE" + ldd $FILE +fi diff --git a/tests/script/sh/pybitand.py b/tests/script/sh/pybitand.py new file mode 100644 index 0000000000000000000000000000000000000000..1df724794ec20c6a133f3800046c897c722a173e --- /dev/null +++ b/tests/script/sh/pybitand.py @@ -0,0 +1,21 @@ +def init(): + pass + +def process(block): + (rows, cols) = block.shape() + result = [] + for i in range(rows): + r = 2 ** 32 - 1 + for j in range(cols): + cell = block.data(i,j) + if cell is None: + result.append(None) + break + else: + r = r & cell + else: + result.append(r) + return result + +def destroy(): + pass diff --git a/tests/script/sh/pyl2norm.py b/tests/script/sh/pyl2norm.py new file mode 100644 index 0000000000000000000000000000000000000000..105f546b7d186f466f4fcad5eca38ecf5ff7b5e1 --- /dev/null +++ b/tests/script/sh/pyl2norm.py @@ -0,0 +1,27 @@ +import json +import math + +def init(): + pass + +def destroy(): + pass + +def start(): + return json.dumps(0.0).encode('utf-8') + +def finish(buf): + sum_squares = json.loads(buf) + result = math.sqrt(sum_squares) + return result + +def reduce(datablock, buf): + (rows, cols) = datablock.shape() + sum_squares = json.loads(buf) + + for i in range(rows): + for j in range(cols): + cell = datablock.data(i,j) + if cell is not None: + sum_squares += cell * cell + return json.dumps(sum_squares).encode('utf-8') diff --git a/tests/script/test-win.bat b/tests/script/test-win.bat new file mode 100644 index 0000000000000000000000000000000000000000..66bef2008d168c4a2286a8068d4d196230164fc9 --- /dev/null +++ b/tests/script/test-win.bat @@ -0,0 +1,67 @@ +@echo off +SETLOCAL EnableDelayedExpansion +for /F "tokens=1,2 delims=#" %%a in ('"prompt #$H#$E# & echo on & for %%b in (1) do rem"') do ( set "DEL=%%a") +set /a a=0 +echo Windows Taosd Full Test +set /a exitNum=0 +rm -rf failed.txt +set caseFile="win-test-file" +if not "%2" == "" ( + set caseFile="%2" +) +for /F "usebackq tokens=*" %%i in (!caseFile!) do ( + set line=%%i + call :CheckSkipCase %%i + if !skipCase! == false ( + if "!line:~,9!" == "./test.sh" ( + set /a a+=1 + echo !a! Processing %%i + call :GetTimeSeconds !time! + set time1=!_timeTemp! + echo Start at !time! + call !line:./test.sh=wtest.bat! > result_!a!.txt 2>error_!a!.txt || set /a errorlevel=8 + if errorlevel 1 ( call :colorEcho 0c "failed" &echo. && set /a exitNum=8 && echo %%i >>failed.txt ) else ( call :colorEcho 0a "Success" &echo. ) + ) + ) +) +exit /b !exitNum! + +:colorEcho +set timeNow=%time% +call :GetTimeSeconds %timeNow% +set time2=%_timeTemp% +set /a interTime=%time2% - %time1% +echo End at %timeNow% , cast %interTime%s +echo off + "%~2" +findstr /v /a:%1 /R "^$" "%~2" nul +del "%~2" > nul 2>&1i +goto :eof + +:GetTimeSeconds +set tt=%1 +set tt=%tt:.= % +set tt=%tt::= % +set tt=%tt: 0= % +set /a index=1 +for %%a in (%tt%) do ( + if !index! EQU 1 ( + set /a hh=%%a + )^ + else if !index! EQU 2 ( + set /a mm=%%a + + )^ + else if !index! EQU 3 ( + set /a ss=%%a + ) + set /a index=index+1 +) +set /a _timeTemp=(%hh%*60+%mm%)*60+%ss% +goto :eof + +:CheckSkipCase +set skipCase=false +@REM if "%*" == "./test.sh -f tsim/query/scalarFunction.sim" ( set skipCase=true ) +echo %* | grep valgrind && set skipCase=true +:goto eof \ No newline at end of file diff --git a/tests/script/tsim/db/alter_option.sim b/tests/script/tsim/db/alter_option.sim index f4392fbca4727a9a8b2adfba3b24ebf2a5c9ed1a..6f568ecdb15aec72415e83d881fb69bbe0fc948a 100644 --- a/tests/script/tsim/db/alter_option.sim +++ b/tests/script/tsim/db/alter_option.sim @@ -285,8 +285,6 @@ sql_error alter database db keep -1 print ============== modify minrows sql_error alter database db minrows 8 -sql_error alter database db minrows 200 -sql_error alter database db minrows 11 sql_error alter database db minrows 8000 sql_error alter database db minrows 8001 diff --git a/tests/script/tsim/dnode/drop_dnode_force.sim b/tests/script/tsim/dnode/drop_dnode_force.sim index 425e5f48b2f278f3ef2f2bad51b25f81b8133fc2..bce51a98887dd4aa9bfe6a4bb444424fdf8b006d 100644 --- a/tests/script/tsim/dnode/drop_dnode_force.sim +++ b/tests/script/tsim/dnode/drop_dnode_force.sim @@ -50,6 +50,21 @@ endi print =============== step2 create database sql create database d1 vgroups 1 replica 3 sql use d1 + +$wt = 0 +stepwt1: + $wt = $wt + 1 + sleep 1000 + if $wt == 200 then + print ====> dnode not ready! + return -1 + endi +sql show transactions +if $rows != 0 then + print wait 1 seconds to alter + goto stepwt1 +endi + sql create table d1.st0 (ts timestamp, i int) tags (j int) sql create table d1.c0 using st0 tags(0) sql create table d1.c1 using st0 tags(1) diff --git a/tests/script/tsim/dnode/drop_dnode_has_multi_vnode_replica3.sim b/tests/script/tsim/dnode/drop_dnode_has_multi_vnode_replica3.sim index 0fa7320ff6cd515452748c6c81e82011eb4f8dcb..ef5001dcee28012ca40d2d09cd933b1e5ee1ec34 100644 --- a/tests/script/tsim/dnode/drop_dnode_has_multi_vnode_replica3.sim +++ b/tests/script/tsim/dnode/drop_dnode_has_multi_vnode_replica3.sim @@ -170,6 +170,20 @@ if $leaderExist != 1 then goto step35 endi +$wt = 0 +stepwt1: + $wt = $wt + 1 + sleep 1000 + if $wt == 200 then + print ====> dnode not ready! + return -1 + endi +sql show transactions +if $rows != 0 then + print wait 1 seconds to alter + goto stepwt1 +endi + print =============== step36: create table sql use d1 sql create table d1.st (ts timestamp, i int) tags (j int) diff --git a/tests/script/tsim/dnode/offline_reason.sim b/tests/script/tsim/dnode/offline_reason.sim index 6b1686dbb4c2a16920c0c71ccc8b5e84371d5b72..8c4d8b47f765f22f07e8f5114797c94dc89c67ca 100644 --- a/tests/script/tsim/dnode/offline_reason.sim +++ b/tests/script/tsim/dnode/offline_reason.sim @@ -8,10 +8,10 @@ sql connect sql create dnode $hostname port 7200 sql select * from information_schema.ins_dnodes -print dnode1 off: $data(1)[6] -print dnode2 off: $data(2)[6] +print dnode1 off: $data(1)[7] +print dnode2 off: $data(2)[7] -if $data(2)[6] != @status not received@ then +if $data(2)[7] != @status not received@ then return -1 endi @@ -50,9 +50,9 @@ step3: return -1 endi sql select * from information_schema.ins_dnodes -print dnode1 off: $data(1)[6] -print dnode2 off: $data(2)[6] -if $data(2)[6] != @status msg timeout@ then +print dnode1 off: $data(1)[7] +print dnode2 off: $data(2)[7] +if $data(2)[7] != @status msg timeout@ then goto step3 endi @@ -77,9 +77,9 @@ step5: endi sql select * from information_schema.ins_dnodes -print dnode1 off: $data(1)[6] -print dnode2 off: $data(3)[6] -if $data(3)[6] != @dnodeId not match@ then +print dnode1 off: $data(1)[7] +print dnode2 off: $data(3)[7] +if $data(3)[7] != @dnodeId not match@ then goto step5 endi @@ -98,10 +98,10 @@ step6: endi sql select * from information_schema.ins_dnodes -print dnode1 off: $data(1)[6] -print dnode2 off: $data(3)[6] -print dnode3 off: $data(4)[6] -if $data(4)[6] != @interval not match@ then +print dnode1 off: $data(1)[7] +print dnode2 off: $data(3)[7] +print dnode3 off: $data(4)[67 +if $data(4)[7] != @interval not match@ then goto step6 endi @@ -120,11 +120,11 @@ step7: endi sql select * from information_schema.ins_dnodes -print dnode1 off: $data(1)[6] -print dnode3 off: $data(3)[6] -print dnode4 off: $data(4)[6] -print dnode5 off: $data(5)[6] -if $data(5)[6] != @locale not match@ then +print dnode1 off: $data(1)[7] +print dnode3 off: $data(3)[7] +print dnode4 off: $data(4)[7] +print dnode5 off: $data(5)[7] +if $data(5)[7] != @locale not match@ then goto step7 endi @@ -143,12 +143,12 @@ step8: endi sql select * from information_schema.ins_dnodes -print dnode1 off: $data(1)[6] -print dnode3 off: $data(3)[6] -print dnode4 off: $data(4)[6] -print dnode5 off: $data(5)[6] -print dnode6 off: $data(6)[6] -if $data(6)[6] != @charset not match@ then +print dnode1 off: $data(1)[7] +print dnode3 off: $data(3)[7] +print dnode4 off: $data(4)[7] +print dnode5 off: $data(5)[7] +print dnode6 off: $data(6)[7] +if $data(6)[7] != @charset not match@ then goto step8 endi diff --git a/tests/script/tsim/parser/sliding.sim b/tests/script/tsim/parser/sliding.sim index b9353e2c61b5d84d74486d1cc458103a7bf4e851..45a49fbc4e28662499ef71bcb1de9859e944b57d 100644 --- a/tests/script/tsim/parser/sliding.sim +++ b/tests/script/tsim/parser/sliding.sim @@ -49,9 +49,23 @@ while $i < $tbNum $nchar = $nchar . $c $nchar = $nchar . ' - sql insert into $tb values ($tstart , $c , $c , $c , $c , $c , $c , $c , $binary , $nchar ) - $tstart = $tstart + 30 - $x = $x + 1 + $next = $tstart + 30 + $f = $x + 1 + $c1 = $f / 100 + $c1 = $c1 * 100 + $c1 = $f - $c1 + + $binary1 = ' . binary + $binary1 = $binary1 . $c1 + $binary1 = $binary1 . ' + + $nchar1 = ' . nchar + $nchar1 = $nchar1 . $c1 + $nchar1 = $nchar1 . ' + + sql insert into $tb values ($tstart , $c , $c , $c , $c , $c , $c , $c , $binary , $nchar ) ($next , $c1 , $c1 , $c1 , $c1 , $c1 , $c1 , $c1 , $binary1 , $nchar1 ) + $tstart = $tstart + 60 + $x = $x + 2 endw $i = $i + 1 diff --git a/tests/script/tsim/query/udfpy.sim b/tests/script/tsim/query/udfpy.sim new file mode 100644 index 0000000000000000000000000000000000000000..7a5aa863cfe3705b110039883e79e5711527700f --- /dev/null +++ b/tests/script/tsim/query/udfpy.sim @@ -0,0 +1,279 @@ +system_content printf %OS% +if $system_content == Windows_NT then + return 0; +endi + +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/cfg.sh -n dnode1 -c udf -v 1 +system sh/exec.sh -n dnode1 -s start +sql connect + +print ======== step1 udf +system sh/compile_udf.sh +system sh/prepare_pyudf.sh +system mkdir -p /tmp/pyudf +system cp sh/pybitand.py /tmp/pyudf/ +system cp sh/pyl2norm.py /tmp/pyudf/ +system ls /tmp/pyudf + +sql create database udf vgroups 3; +sql use udf; +sql select * from information_schema.ins_databases; + +sql create table t (ts timestamp, f int); +sql insert into t values(now, 1)(now+1s, 2); + +system_content printf %OS% +if $system_content == Windows_NT then + return 0; +endi +if $system_content == Windows_NT then + sql create function bit_and as 'C:\\Windows\\Temp\\bitand.dll' outputtype int bufSize 8; + sql create aggregate function l2norm as 'C:\\Windows\\Temp\\l2norm.dll' outputtype double bufSize 8; +else + sql create function bit_and as '/tmp/udf/libbitand.so' outputtype int bufSize 8; + sql create aggregate function l2norm as '/tmp/udf/libl2norm.so' outputtype double bufSize 8; +endi +sql create function pybitand as '/tmp/pyudf/pybitand.py' outputtype int language 'python'; +sql create aggregate function pyl2norm as '/tmp/pyudf/pyl2norm.py' outputtype double bufSize 128 language 'python'; + +sql show functions; +if $rows != 4 then + return -1 +endi +sql select bit_and(f, f) from t; +if $rows != 2 then + return -1 +endi +if $data00 != 1 then + return -1 +endi +if $data10 != 2 then + return -1 +endi + +sql select pybitand(f, f) from t; +if $rows != 2 then + return -1 +endi +if $data00 != 1 then + return -1 +endi +if $data10 != 2 then + return -1 +endi + +sql select l2norm(f) from t; +if $rows != 1 then + print expect 1, actual $rows + return -1 +endi +if $data00 != 2.236067977 then + return -1 +endi + +sql select pyl2norm(f) from t; +if $rows != 1 then + print expect 1, actual $rows + return -1 +endi +if $data00 != 2.236067977 then + return -1 +endi + +sql create table t2 (ts timestamp, f1 int, f2 int); +sql insert into t2 values(now, 0, 0)(now+1s, 1, 1); +sql select bit_and(f1, f2) from t2; +if $rows != 2 then + return -1 +endi +if $data00 != 0 then + return -1 +endi +if $data10 != 1 then + return -1 +endi + +sql select l2norm(f1, f2) from t2; +if $rows != 1 then + return -1 +endi +if $data00 != 1.414213562 then + return -1 +endi + +sql select pybitand(f1, f2) from t2; +if $rows != 2 then + return -1 +endi +if $data00 != 0 then + return -1 +endi +if $data10 != 1 then + return -1 +endi + +sql select pyl2norm(f1, f2) from t2; +if $rows != 1 then + return -1 +endi +if $data00 != 1.414213562 then + return -1 +endi + +sql insert into t2 values(now+2s, 1, null)(now+3s, null, 2); +sql select bit_and(f1, f2) from t2; +print $rows , $data00 , $data10 , $data20 , $data30 +if $rows != 4 then + return -1 +endi +if $data00 != 0 then + return -1 +endi +if $data10 != 1 then + return -1 +endi + +if $data20 != NULL then + return -1 +endi + +if $data30 != NULL then + return -1 +endi + +sql select l2norm(f1, f2) from t2; +print $rows, $data00 +if $rows != 1 then + return -1 +endi +if $data00 != 2.645751311 then + return -1 +endi + +sql select pybitand(f1, f2) from t2; +print $rows , $data00 , $data10 , $data20 , $data30 +if $rows != 4 then + return -1 +endi +if $data00 != 0 then + return -1 +endi +if $data10 != 1 then + return -1 +endi + +if $data20 != NULL then + return -1 +endi + +if $data30 != NULL then + return -1 +endi + +sql select pyl2norm(f1, f2) from t2; +print $rows, $data00 +if $rows != 1 then + return -1 +endi +if $data00 != 2.645751311 then + return -1 +endi + + +sql insert into t2 values(now+4s, 4, 8)(now+5s, 5, 9); +sql select l2norm(f1-f2), l2norm(f1+f2) from t2; +print $rows , $data00 , $data01 +if $rows != 1 then + return -1; +endi +if $data00 != 5.656854249 then + return -1 +endi +if $data01 != 18.547236991 then + return -1 +endi + +sql select l2norm(bit_and(f2, f1)), l2norm(bit_and(f1, f2)) from t2; +print $rows , $data00 , $data01 +if $rows != 1 then + return -1 +endi +if $data00 != 1.414213562 then + return -1 +endi +if $data01 != 1.414213562 then + return -1 +endi + +sql select l2norm(f2) from udf.t2 group by 1-bit_and(f1, f2) order by 1-bit_and(f1,f2); +print $rows , $data00 , $data10 , $data20 +if $rows != 3 then + return -1 +endi +if $data00 != 2.000000000 then + return -1 +endi +if $data10 != 9.055385138 then + return -1 +endi +if $data20 != 8.000000000 then + return -1 +endi + +sql select pyl2norm(f1-f2), pyl2norm(f1+f2) from t2; +print $rows , $data00 , $data01 +if $rows != 1 then + return -1; +endi +if $data00 != 5.656854249 then + return -1 +endi +if $data01 != 18.547236991 then + return -1 +endi + +sql select pyl2norm(pybitand(f2, f1)), pyl2norm(pybitand(f1, f2)) from t2; +print $rows , $data00 , $data01 +if $rows != 1 then + return -1 +endi +if $data00 != 1.414213562 then + return -1 +endi +if $data01 != 1.414213562 then + return -1 +endi + +sql select pyl2norm(f2) from udf.t2 group by 1-pybitand(f1, f2) order by 1-pybitand(f1,f2); +print $rows , $data00 , $data10 , $data20 +if $rows != 3 then + return -1 +endi +if $data00 != 2.000000000 then + return -1 +endi +if $data10 != 9.055385138 then + return -1 +endi +if $data20 != 8.000000000 then + return -1 +endi + + +#sql drop function bit_and; +#sql show functions; +#if $rows != 1 then +# return -1 +#endi +#if $data00 != @l2norm@ then +# return -1 +# endi +#sql drop function l2norm; +#sql show functions; +#if $rows != 0 then +# return -1 +#endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/stream/basic0.sim b/tests/script/tsim/stream/basic0.sim index 8e3e99978b5a877bd6f2f9bb51daf9a05e50140a..68c5894cbff7c6bdfdbd932ece85e6eae324cd28 100644 --- a/tests/script/tsim/stream/basic0.sim +++ b/tests/script/tsim/stream/basic0.sim @@ -48,24 +48,35 @@ sleep 100 #=================================================================== print =============== query data from child table +$loop_count = 0 + +loop0: +sleep 200 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + sql select `_wstart`,`min(k)`,`max(k)`,sum_alias from outstb + print rows: $rows print $data00 $data01 $data02 $data03 if $rows != 1 then - return -1 + goto loop0 endi if $data01 != 234 then - return -1 + goto loop0 endi if $data02 != 234 then - return -1 + goto loop0 endi if $data03 != 234 then print expect 234, actual $data03 - return -1 + goto loop0 endi #=================================================================== @@ -77,23 +88,34 @@ sleep 100 #=================================================================== print =============== query data from child table +$loop_count = 0 + +loop1: +sleep 200 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + sql select `_wstart`,`min(k)`,`max(k)`,sum_alias from outstb + print rows: $rows print $data00 $data01 $data02 $data03 if $rows != 1 then - return -1 + goto loop1 endi if $data01 != -111 then - return -1 + goto loop1 endi if $data02 != 234 then - return -1 + goto loop1 endi if $data03 != 123 then - return -1 + goto loop1 endi #=================================================================== @@ -105,36 +127,46 @@ sleep 100 #=================================================================== print =============== query data from child table +$loop_count = 0 + +loop2: +sleep 200 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + sql select `_wstart`,`min(k)`,`max(k)`,sum_alias from outstb print rows: $rows print $data00 $data01 $data02 $data03 print $data10 $data11 $data12 $data13 if $rows != 2 then - return -1 + goto loop2 endi if $data01 != -111 then - return -1 + goto loop2 endi if $data02 != 234 then - return -1 + goto loop2 endi if $data03 != 123 then - return -1 + goto loop2 endi if $data11 != 789 then - return -1 + goto loop2 endi if $data12 != 789 then - return -1 + goto loop2 endi if $data13 != 789 then - return -1 + goto loop2 endi _OVER: diff --git a/tests/script/tsim/stream/basic1.sim b/tests/script/tsim/stream/basic1.sim index c61c7667f8fef94ea84b7379a4a6fc12cc5b2141..e69875d69f20b01f91ea2b90fd912c84b88d2455 100644 --- a/tests/script/tsim/stream/basic1.sim +++ b/tests/script/tsim/stream/basic1.sim @@ -17,7 +17,7 @@ sql use test; sql create table t1(ts timestamp, a int, b int , c int, d double); -sql create stream streams1 trigger at_once into streamt as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(b) c4, min(c) c5 from t1 interval(10s); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 into streamt as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(b) c4, min(c) c5 from t1 interval(10s); sql insert into t1 values(1648791213000,1,2,3,1.0); sql insert into t1 values(1648791223001,2,2,3,1.1); sql insert into t1 values(1648791233002,3,2,3,2.1); @@ -545,8 +545,8 @@ sql create table t2 using st tags(2,2,2); sql create table t3 using st tags(2,2,2); sql create table t4 using st tags(2,2,2); sql create table t5 using st tags(2,2,2); -sql create stream streams2 trigger at_once into streamt as select _wstart, count(*) c1, sum(a) c3,max(b) c4 from st partition by tbname interval(10s); -sql create stream streams3 trigger at_once into streamt3 as select _wstart, count(*) c1, sum(a) c3,max(b) c4, now c5 from st partition by tbname interval(10s); +sql create stream streams2 trigger at_once IGNORE EXPIRED 0 into streamt as select _wstart, count(*) c1, sum(a) c3,max(b) c4 from st partition by tbname interval(10s); +sql create stream streams3 trigger at_once IGNORE EXPIRED 0 into streamt3 as select _wstart, count(*) c1, sum(a) c3,max(b) c4, now c5 from st partition by tbname interval(10s); sql insert into t1 values(1648791213000,1,1,1,1.0) t2 values(1648791213000,2,2,2,2.0) t3 values(1648791213000,3,3,3,3.0) t4 values(1648791213000,4,4,4,4.0); @@ -667,7 +667,7 @@ sql create database test3 vgroups 1; sql use test3; sql create stable st(ts timestamp, a int, b int , c int) tags(ta int,tb int,tc int); sql create table ts1 using st tags(1,1,1); -sql create stream stream_t3 trigger at_once into streamtST3 as select ts, min(a) c6, a, b, c, ta, tb, tc from ts1 interval(10s) ; +sql create stream stream_t3 trigger at_once IGNORE EXPIRED 0 into streamtST3 as select ts, min(a) c6, a, b, c, ta, tb, tc from ts1 interval(10s) ; sql insert into ts1 values(1648791211000,1,2,3); sleep 50 @@ -701,7 +701,7 @@ endi sql create database test4 vgroups 1; sql use test4; sql create table t1(ts timestamp, a int, b int , c int, d double); -sql create stream streams4 trigger at_once into streamt4 as select _wstart, count(*) c1 from t1 where a > 5 interval(10s); +sql create stream streams4 trigger at_once IGNORE EXPIRED 0 into streamt4 as select _wstart, count(*) c1 from t1 where a > 5 interval(10s); sql insert into t1 values(1648791213000,1,2,3,1.0); $loop_count = 0 @@ -797,8 +797,8 @@ sql create database test5 vgroups 1; sql use test5; sql create stable st(ts timestamp, a int, b int , c int) tags(ta int,tb int,tc int); sql create table ts1 using st tags(1,1,1); -sql create stream streams5 trigger at_once into streamt5 as select count(*), _wstart, _wend, max(a) from ts1 interval(10s) ; -sql create stream streams6 trigger at_once into streamt6 as select count(*), _wstart, _wend, max(a), _wstart as ts from ts1 interval(10s) ; +sql create stream streams5 trigger at_once IGNORE EXPIRED 0 into streamt5 as select count(*), _wstart, _wend, max(a) from ts1 interval(10s) ; +sql create stream streams6 trigger at_once IGNORE EXPIRED 0 into streamt6 as select count(*), _wstart, _wend, max(a), _wstart as ts from ts1 interval(10s) ; sql_error create stream streams7 trigger at_once into streamt7 as select _wstart, count(*), _wstart, _wend, max(a) from ts1 interval(10s) ; sql_error create stream streams8 trigger at_once into streamt8 as select count(*), _wstart, _wstart, _wend, max(a) from ts1 interval(10s) ; @@ -840,7 +840,7 @@ sql create database test7 vgroups 1; sql use test7; sql create stable st(ts timestamp, a int, b int , c int) tags(ta int,tb int,tc int); sql create table ts1 using st tags(1,1,1); -sql create stream streams7 trigger at_once into streamt7 as select _wstart, count(*) from ts1 interval(10s) ; +sql create stream streams7 trigger at_once IGNORE EXPIRED 0 into streamt7 as select _wstart, count(*) from ts1 interval(10s) ; sql insert into ts1 values(1648791211000,1,2,3); sql_error insert into ts1 values(-1648791211000,1,2,3); @@ -887,4 +887,20 @@ if $rows != 1 then goto loop19 endi +print select * from information_schema.ins_stream_tasks; +sql select * from information_schema.ins_stream_tasks; + +if $rows == 0 then + print =====rows=$rows + return -1 +endi + +print select * from information_schema.ins_streams; +sql select * from information_schema.ins_streams; + +if $rows == 0 then + print =====rows=$rows + return -1 +endi + system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/stream/checkStreamSTable1.sim b/tests/script/tsim/stream/checkStreamSTable1.sim new file mode 100644 index 0000000000000000000000000000000000000000..495e1cf35854b4e1f434c793b29091b7ec5b034d --- /dev/null +++ b/tests/script/tsim/stream/checkStreamSTable1.sim @@ -0,0 +1,71 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 + +print ===== step1 + +system sh/exec.sh -n dnode1 -s start +sleep 50 +sql connect + +print ===== step2 + +sql create database test vgroups 4; +sql use test; +sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int); +sql create table t1 using st tags(1,1,1); +sql create table t2 using st tags(2,2,2); +sql create stream streams1 trigger at_once into streamt1 as select _wstart, count(*) c1, count(a) c2 from st interval(1s) ; +sql insert into t1 values(1648791211000,1,2,3); +sql insert into t1 values(1648791212000,2,2,3); + +$loop_count = 0 +loop0: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 1 select * from streamt1; +sql select * from streamt1; + +if $rows != 2 then + print rows=$rows + goto loop0 +endi + +print drop stream streams1 +sql drop stream streams1; + +print alter table streamt1 add column c3 double +sql alter table streamt1 add column c3 double; + +print create stream streams1 trigger at_once into streamt1 as select _wstart, count(*) c1, count(a) c2, avg(b) c3 from st interval(1s) ; +sql create stream streams1 trigger at_once into streamt1 as select _wstart, count(*) c1, count(a) c2, avg(b) c3 from st interval(1s) ; + +sql insert into t2 values(1648791213000,1,2,3); +sql insert into t1 values(1648791214000,1,2,3); + +$loop_count = 0 +loop1: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 2 select * from streamt1; +sql select * from streamt1; + +if $rows != 4 then + print rows=$rows + goto loop1 +endi + +print ======over + +system sh/stop_dnodes.sh diff --git a/tests/script/tsim/stream/deleteInterval.sim b/tests/script/tsim/stream/deleteInterval.sim index 7532b2d5def428d0c83e420c128bdc33f438f392..9540e448d44b4ed21499134e6a6b0e91f29b5020 100644 --- a/tests/script/tsim/stream/deleteInterval.sim +++ b/tests/script/tsim/stream/deleteInterval.sim @@ -16,7 +16,7 @@ sql drop database if exists test; sql create database test vgroups 1; sql use test; sql create table t1(ts timestamp, a int, b int , c int, d double); -sql create stream streams0 trigger at_once into streamt as select _wstart c1, count(*) c2, max(a) c3 from t1 interval(10s); +sql create stream streams0 trigger at_once IGNORE EXPIRED 0 into streamt as select _wstart c1, count(*) c2, max(a) c3 from t1 interval(10s); sql insert into t1 values(1648791213000,NULL,NULL,NULL,NULL); sleep 200 @@ -193,7 +193,7 @@ sql use test2; sql create stable st(ts timestamp, a int, b int, c int, d double) tags(ta int,tb int,tc int); sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -sql create stream streams2 trigger at_once into test.streamt2 as select _wstart c1, count(*) c2, max(a) c3 from st interval(10s); +sql create stream streams2 trigger at_once IGNORE EXPIRED 0 into test.streamt2 as select _wstart c1, count(*) c2, max(a) c3 from st interval(10s); sql insert into t1 values(1648791213000,NULL,NULL,NULL,NULL); sql insert into t2 values(1648791213000,NULL,NULL,NULL,NULL); @@ -419,7 +419,7 @@ sql use test3; sql create stable st(ts timestamp, a int, b int, c int, d double) tags(ta int,tb int,tc int); sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -sql create stream streams3 trigger at_once into test.streamt3 as select _wstart c1, count(*) c2, max(a) c3 from st interval(10s); +sql create stream streams3 trigger at_once IGNORE EXPIRED 0 into test.streamt3 as select _wstart c1, count(*) c2, max(a) c3 from st interval(10s); sql insert into t1 values(1648791213000,NULL,NULL,NULL,NULL); sql insert into t2 values(1648791213000,NULL,NULL,NULL,NULL); diff --git a/tests/script/tsim/stream/deleteSession.sim b/tests/script/tsim/stream/deleteSession.sim index c3c64a597774c490a1491816e0e2175be739828d..364593917835a82f043e3d04439346d8a91f17fd 100644 --- a/tests/script/tsim/stream/deleteSession.sim +++ b/tests/script/tsim/stream/deleteSession.sim @@ -16,7 +16,7 @@ sql drop database if exists test; sql create database test vgroups 1; sql use test; sql create table t1(ts timestamp, a int, b int , c int, d double); -sql create stream streams0 trigger at_once into streamt as select _wstart c1, count(*) c2, max(a) c3 from t1 session(ts, 5s); +sql create stream streams0 trigger at_once IGNORE EXPIRED 0 into streamt as select _wstart c1, count(*) c2, max(a) c3 from t1 session(ts, 5s); sql insert into t1 values(1648791213000,NULL,NULL,NULL,NULL); sleep 200 @@ -191,7 +191,7 @@ sql use test2; sql create stable st(ts timestamp, a int, b int, c int, d double) tags(ta int,tb int,tc int); sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -sql create stream streams2 trigger at_once into test.streamt2 as select _wstart c1, count(*) c2, max(a) c3 from st session(ts,5s); +sql create stream streams2 trigger at_once IGNORE EXPIRED 0 into test.streamt2 as select _wstart c1, count(*) c2, max(a) c3 from st session(ts,5s); sql insert into t1 values(1648791213000,NULL,NULL,NULL,NULL); sql insert into t2 values(1648791213000,NULL,NULL,NULL,NULL); @@ -422,7 +422,7 @@ sql use test3; sql create stable st(ts timestamp, a int, b int, c int, d double) tags(ta int,tb int,tc int); sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -sql create stream streams3 trigger at_once into test.streamt3 as select _wstart c1, count(*) c2, max(a) c3 from st session(ts,5s); +sql create stream streams3 trigger at_once IGNORE EXPIRED 0 into test.streamt3 as select _wstart c1, count(*) c2, max(a) c3 from st session(ts,5s); sql insert into t1 values(1648791210000,1,1,1,NULL); sql insert into t1 values(1648791210001,2,2,2,NULL); @@ -532,8 +532,8 @@ sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int); sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -print create stream streams4 trigger at_once into streamt4 as select _wstart, count(*) c1 from st partition by tbname session(ts, 2s); -sql create stream streams4 trigger at_once into streamt4 as select _wstart, count(*) c1 from st partition by tbname session(ts, 2s); +print create stream streams4 trigger at_once IGNORE EXPIRED 0 into streamt4 as select _wstart, count(*) c1 from st partition by tbname session(ts, 2s); +sql create stream streams4 trigger at_once IGNORE EXPIRED 0 into streamt4 as select _wstart, count(*) c1 from st partition by tbname session(ts, 2s); sql insert into t1 values(1648791210000,1,2,3); sql insert into t1 values(1648791220000,2,2,3); diff --git a/tests/script/tsim/stream/deleteState.sim b/tests/script/tsim/stream/deleteState.sim index 45d9bc3e39e926c459fb210345ba5713a6528867..dd74b73dcefc76f69a19b424b5f544cbf0232559 100644 --- a/tests/script/tsim/stream/deleteState.sim +++ b/tests/script/tsim/stream/deleteState.sim @@ -16,7 +16,7 @@ sql drop database if exists test; sql create database test vgroups 1; sql use test; sql create table t1(ts timestamp, a int, b int , c int, d double); -sql create stream streams0 trigger at_once into streamt as select _wstart c1, count(*) c2, max(b) c3 from t1 state_window(a); +sql create stream streams0 trigger at_once IGNORE EXPIRED 0 into streamt as select _wstart c1, count(*) c2, max(b) c3 from t1 state_window(a); sql insert into t1 values(1648791213000,NULL,NULL,NULL,NULL); sleep 200 @@ -197,8 +197,8 @@ sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int); sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -print create stream streams4 trigger at_once into streamt4 as select _wstart, count(*) c1 from st partition by tbname state_window(c); -sql create stream streams4 trigger at_once into streamt4 as select _wstart, count(*) c1 from st partition by tbname state_window(c); +print create stream streams4 trigger at_once IGNORE EXPIRED 0 into streamt4 as select _wstart, count(*) c1 from st partition by tbname state_window(c); +sql create stream streams4 trigger at_once IGNORE EXPIRED 0 into streamt4 as select _wstart, count(*) c1 from st partition by tbname state_window(c); sql insert into t1 values(1648791210000,1,2,1); sql insert into t1 values(1648791220000,2,2,2); diff --git a/tests/script/tsim/stream/distributeIntervalRetrive0.sim b/tests/script/tsim/stream/distributeIntervalRetrive0.sim index ae2f9afdb5a542c9895820ae7d64bcacdd5f0ebc..529a2a1b309b1351bd0515c2597e327a58d8574f 100644 --- a/tests/script/tsim/stream/distributeIntervalRetrive0.sim +++ b/tests/script/tsim/stream/distributeIntervalRetrive0.sim @@ -44,7 +44,7 @@ sql create table ts1 using st tags(1,1,1); sql create table ts2 using st tags(2,2,2); 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 into streamtST1 as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from st interval(10s); +sql create stream stream_t1 trigger at_once IGNORE EXPIRED 0 into streamtST1 as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from st interval(10s); sleep 1000 @@ -243,7 +243,7 @@ sql use test1; sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int); sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -sql create stream streams1 trigger at_once into streamt1 as select _wstart as c0, count(*) c1, count(a) c2 from st interval(10s) ; +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 into streamt1 as select _wstart as c0, count(*) c1, count(a) c2 from st interval(10s) ; sql insert into t1 values(1648791211000,1,2,3); diff --git a/tests/script/tsim/stream/distributeSession0.sim b/tests/script/tsim/stream/distributeSession0.sim index d752f5c29ce774b07286f44076fbcd415faa9acd..25ac479a38dbd90d2d2dc79ef1c027e709646e30 100644 --- a/tests/script/tsim/stream/distributeSession0.sim +++ b/tests/script/tsim/stream/distributeSession0.sim @@ -39,7 +39,7 @@ sql use test; sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int); sql create table ts1 using st tags(1,1,1); sql create table ts2 using st tags(2,2,2); -sql create stream stream_t1 trigger at_once into streamtST as select _wstart, count(*) c1, sum(a) c2 , max(b) c3 from st session(ts, 10s) ; +sql create stream stream_t1 trigger at_once IGNORE EXPIRED 0 into streamtST as select _wstart, count(*) c1, sum(a) c2 , max(b) c3 from st session(ts, 10s) ; sleep 1000 diff --git a/tests/script/tsim/stream/fillHistoryBasic1.sim b/tests/script/tsim/stream/fillHistoryBasic1.sim index 772a09c0176512ca1617e53cc87e16ec20fb2a4a..e7a8da90e23c6b83bbc0b7beb6f736312f292b89 100644 --- a/tests/script/tsim/stream/fillHistoryBasic1.sim +++ b/tests/script/tsim/stream/fillHistoryBasic1.sim @@ -17,7 +17,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 into streamt as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(b) c4, min(c) c5 from t1 interval(10s); +sql create stream stream1 trigger at_once fill_history 1 IGNORE EXPIRED 0 into streamt as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(b) c4, min(c) c5 from t1 interval(10s); sql insert into t1 values(1648791213000,1,2,3,1.0); sql insert into t1 values(1648791223001,2,2,3,1.1); @@ -479,7 +479,7 @@ sql insert into t1 values(1648791233002,3,2,3,2.1); sql insert into t1 values(1648791243003,4,2,3,3.1); sql insert into t1 values(1648791213004,4,2,3,4.1); -sql create stream stream2 trigger at_once fill_history 1 into streamt as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(b) c4, min(c) c5 from t1 interval(10s); +sql create stream stream2 trigger at_once fill_history 1 IGNORE EXPIRED 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 5000 sql select `_wstart`, c1, c2 ,c3 ,c4, c5 from streamt; diff --git a/tests/script/tsim/stream/fillHistoryBasic2.sim b/tests/script/tsim/stream/fillHistoryBasic2.sim index 3af198259d2c7bb4c5c39af3acd39d222f217d1c..2f6c3ea92d3c374557fcac3b63684022198239a5 100644 --- a/tests/script/tsim/stream/fillHistoryBasic2.sim +++ b/tests/script/tsim/stream/fillHistoryBasic2.sim @@ -79,7 +79,7 @@ sql insert into ts3 values(1648791243005,4,42,3,3.1) (1648791243003,4,2,33,3.1) sql insert into ts4 values(1648791243005,4,42,3,3.1) (1648791243003,4,2,33,3.1) (1648791243006,4,2,3,3.1) (1648791213001,1,52,13,1.0) (1648791223001,22,22,83,1.1) (1648791233004,13,12,13,2.1) ; sql insert into ts3 values(1648791243006,4,2,3,3.1) (1648791213001,1,52,13,1.0) (1648791223001,22,22,83,1.1) ; -sql create stream stream_t1 trigger at_once fill_history 1 watermark 1d into streamtST1 as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(b) c4, min(c) c5 from st interval(10s); +sql create stream stream_t1 trigger at_once fill_history 1 watermark 1d IGNORE EXPIRED 0 into streamtST1 as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(b) c4, min(c) c5 from st interval(10s); sleep 1000 @@ -211,7 +211,7 @@ sql insert into ts1 values(1648791222001,2,2,3); sql insert into ts2 values(1648791211000,1,2,3); sql insert into ts2 values(1648791222001,2,2,3); -sql create stream stream_t2 trigger at_once fill_history 1 watermark 20s into streamtST1 as select _wstart, count(*) c1, count(a) c2 , sum(a) c3 , max(b) c5, min(c) c6 from st interval(10s) ; +sql create stream stream_t2 trigger at_once fill_history 1 watermark 20s IGNORE EXPIRED 0 into streamtST1 as select _wstart, count(*) c1, count(a) c2 , sum(a) c3 , max(b) c5, min(c) c6 from st interval(10s) ; $loop_count = 0 loop2: @@ -241,7 +241,7 @@ sql use test3; sql create stable st(ts timestamp, a int, b int , c int) tags(ta int,tb int,tc int); sql create table ts1 using st tags(1,1,1); sql create table ts2 using st tags(2,2,2); -sql create stream stream_t3 trigger at_once into streamtST3 as select ts, min(a) c6, a, b, c, ta, tb, tc from st interval(10s) ; +sql create stream stream_t3 trigger at_once IGNORE EXPIRED 0 into streamtST3 as select ts, min(a) c6, a, b, c, ta, tb, tc from st interval(10s) ; sql insert into ts1 values(1648791211000,1,2,3); sleep 50 diff --git a/tests/script/tsim/stream/fillHistoryBasic3.sim b/tests/script/tsim/stream/fillHistoryBasic3.sim index db8d6bc2d0ac7ae9b8c5d182b3d6eea63c02c7dd..44d7ee9d9e592ae68703bc707ab0b860444626fc 100644 --- a/tests/script/tsim/stream/fillHistoryBasic3.sim +++ b/tests/script/tsim/stream/fillHistoryBasic3.sim @@ -17,7 +17,7 @@ sql create table t2 using st tags(2,2,2); sql insert into t1 values(1648791213000,NULL,NULL,NULL,NULL); sql insert into t2 values(1648791213000,NULL,NULL,NULL,NULL); -sql create stream streams2 trigger at_once fill_history 1 into test.streamt2 as select _wstart c1, count(*) c2, max(a) c3 from st partition by a interval(10s); +sql create stream streams2 trigger at_once fill_history 1 IGNORE EXPIRED 0 into test.streamt2 as select _wstart c1, count(*) c2, max(a) c3 from st partition by a interval(10s); sleep 3000 diff --git a/tests/script/tsim/stream/fillIntervalDelete0.sim b/tests/script/tsim/stream/fillIntervalDelete0.sim index 1c0647d57b29a044ce8ae3fb4052423768a0d66e..41b018a86222e4a0ba2311f71dc4d19cb8160afc 100644 --- a/tests/script/tsim/stream/fillIntervalDelete0.sim +++ b/tests/script/tsim/stream/fillIntervalDelete0.sim @@ -16,11 +16,11 @@ sql drop database if exists test1; sql create database test1 vgroups 1; sql use test1; sql create table t1(ts timestamp, a int, b int , c int, d double, s varchar(20)); -sql create stream streams1 trigger at_once into streamt1 as select _wstart as ts, max(a), sum(b), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(NULL); -sql create stream streams2 trigger at_once into streamt2 as select _wstart as ts, max(a), sum(b), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(value,100,200,300); -sql create stream streams3 trigger at_once into streamt3 as select _wstart as ts, max(a), sum(b), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(next); -sql create stream streams4 trigger at_once into streamt4 as select _wstart as ts, max(a), sum(b), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(prev); -sql create stream streams5 trigger at_once into streamt5 as select _wstart as ts, max(a), sum(b), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(linear); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 into streamt1 as select _wstart as ts, max(a), sum(b), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(NULL); +sql create stream streams2 trigger at_once IGNORE EXPIRED 0 into streamt2 as select _wstart as ts, max(a), sum(b), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(value,100,200,300); +sql create stream streams3 trigger at_once IGNORE EXPIRED 0 into streamt3 as select _wstart as ts, max(a), sum(b), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(next); +sql create stream streams4 trigger at_once IGNORE EXPIRED 0 into streamt4 as select _wstart as ts, max(a), sum(b), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(prev); +sql create stream streams5 trigger at_once IGNORE EXPIRED 0 into streamt5 as select _wstart as ts, max(a), sum(b), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(linear); sql insert into t1 values(1648791213000,1,1,1,1.0,'aaa'); sleep 200 @@ -256,11 +256,11 @@ sql use test6; sql create stable st(ts timestamp, a int, b int , c int, d double, s varchar(20)) tags(ta int,tb int,tc int); sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(1,1,1); -sql create stream streams6 trigger at_once into streamt6 as select _wstart as ts, max(a), sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(NULL); -sql create stream streams7 trigger at_once into streamt7 as select _wstart as ts, max(a), sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(value,100,200,300); -sql create stream streams8 trigger at_once into streamt8 as select _wstart as ts, max(a), sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(next); -sql create stream streams9 trigger at_once into streamt9 as select _wstart as ts, max(a), sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(prev); -sql create stream streams10 trigger at_once into streamt10 as select _wstart as ts, max(a), sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(linear); +sql create stream streams6 trigger at_once IGNORE EXPIRED 0 into streamt6 as select _wstart as ts, max(a), sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(NULL); +sql create stream streams7 trigger at_once IGNORE EXPIRED 0 into streamt7 as select _wstart as ts, max(a), sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(value,100,200,300); +sql create stream streams8 trigger at_once IGNORE EXPIRED 0 into streamt8 as select _wstart as ts, max(a), sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(next); +sql create stream streams9 trigger at_once IGNORE EXPIRED 0 into streamt9 as select _wstart as ts, max(a), sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(prev); +sql create stream streams10 trigger at_once IGNORE EXPIRED 0 into streamt10 as select _wstart as ts, max(a), sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(linear); sql insert into t1 values(1648791210000,1,1,1,1.0,'aaa'); sql insert into t1 values(1648791217000,1,1,1,1.0,'aaa'); diff --git a/tests/script/tsim/stream/fillIntervalDelete1.sim b/tests/script/tsim/stream/fillIntervalDelete1.sim index 0206b88fdca9d97bd8e2bab6c1812c84f44b98f2..108f5f862dcac8ff3f785d87f959bb530c0da56f 100644 --- a/tests/script/tsim/stream/fillIntervalDelete1.sim +++ b/tests/script/tsim/stream/fillIntervalDelete1.sim @@ -18,11 +18,11 @@ sql drop database if exists test1; sql create database test1 vgroups 1; sql use test1; sql create table t1(ts timestamp, a int, b int , c int, d double, s varchar(20)); -sql create stream streams1 trigger at_once into streamt1 as select _wstart as ts, max(a), sum(b), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(NULL); -sql create stream streams2 trigger at_once into streamt2 as select _wstart as ts, max(a), sum(b), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(value,100,200,300); -sql create stream streams3 trigger at_once into streamt3 as select _wstart as ts, max(a), sum(b), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(next); -sql create stream streams4 trigger at_once into streamt4 as select _wstart as ts, max(a), sum(b), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(prev); -sql create stream streams5 trigger at_once into streamt5 as select _wstart as ts, max(a), sum(b), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(linear); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 into streamt1 as select _wstart as ts, max(a), sum(b), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(NULL); +sql create stream streams2 trigger at_once IGNORE EXPIRED 0 into streamt2 as select _wstart as ts, max(a), sum(b), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(value,100,200,300); +sql create stream streams3 trigger at_once IGNORE EXPIRED 0 into streamt3 as select _wstart as ts, max(a), sum(b), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(next); +sql create stream streams4 trigger at_once IGNORE EXPIRED 0 into streamt4 as select _wstart as ts, max(a), sum(b), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(prev); +sql create stream streams5 trigger at_once IGNORE EXPIRED 0 into streamt5 as select _wstart as ts, max(a), sum(b), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(linear); sql insert into t1 values(1648791210000,0,0,0,0.0,'aaa'); sql insert into t1 values(1648791213000,1,1,1,1.0,'bbb'); @@ -221,11 +221,11 @@ sql use test6; sql create stable st(ts timestamp, a int, b int , c int, d double, s varchar(20)) tags(ta int,tb int,tc int); sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(1,1,1); -sql create stream streams6 trigger at_once into streamt6 as select _wstart as ts, max(a), sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(NULL); -sql create stream streams7 trigger at_once into streamt7 as select _wstart as ts, max(a), sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(value,100,200,300); -sql create stream streams8 trigger at_once into streamt8 as select _wstart as ts, max(a), sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(next); -sql create stream streams9 trigger at_once into streamt9 as select _wstart as ts, max(a), sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(prev); -sql create stream streams10 trigger at_once into streamt10 as select _wstart as ts, max(a), sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(linear); +sql create stream streams6 trigger at_once IGNORE EXPIRED 0 into streamt6 as select _wstart as ts, max(a), sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(NULL); +sql create stream streams7 trigger at_once IGNORE EXPIRED 0 into streamt7 as select _wstart as ts, max(a), sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(value,100,200,300); +sql create stream streams8 trigger at_once IGNORE EXPIRED 0 into streamt8 as select _wstart as ts, max(a), sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(next); +sql create stream streams9 trigger at_once IGNORE EXPIRED 0 into streamt9 as select _wstart as ts, max(a), sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(prev); +sql create stream streams10 trigger at_once IGNORE EXPIRED 0 into streamt10 as select _wstart as ts, max(a), sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(linear); sql insert into t1 values(1648791210000,1,1,1,1.0,'aaa'); sql insert into t1 values(1648791215000,6,8,8,8.0,'bbb'); @@ -353,11 +353,11 @@ sql drop database if exists test7; sql create database test7 vgroups 1; sql use test7; sql create table t1(ts timestamp, a int, b int , c int, d double, s varchar(20)); -sql create stream streams11 trigger at_once into streamt11 as select _wstart as ts, avg(a), count(*), timezone(), to_iso8601(1) from t1 where ts >= 1648791210000 and ts < 1648791240000 interval(1s) fill(NULL); -sql create stream streams12 trigger at_once into streamt12 as select _wstart as ts, avg(a), count(*), timezone(), to_iso8601(1) from t1 where ts >= 1648791210000 and ts < 1648791240000 interval(1s) fill(value,100.0,200); -sql create stream streams13 trigger at_once into streamt13 as select _wstart as ts, avg(a), count(*), timezone(), to_iso8601(1) from t1 where ts >= 1648791210000 and ts < 1648791240000 interval(1s) fill(next); -sql create stream streams14 trigger at_once into streamt14 as select _wstart as ts, avg(a), count(*), timezone(), to_iso8601(1) from t1 where ts >= 1648791210000 and ts < 1648791240000 interval(1s) fill(prev); -sql create stream streams15 trigger at_once into streamt15 as select _wstart as ts, avg(a), count(*), timezone(), to_iso8601(1) from t1 where ts >= 1648791210000 and ts < 1648791240000 interval(1s) fill(linear); +sql create stream streams11 trigger at_once IGNORE EXPIRED 0 into streamt11 as select _wstart as ts, avg(a), count(*), timezone(), to_iso8601(1) from t1 where ts >= 1648791210000 and ts < 1648791240000 interval(1s) fill(NULL); +sql create stream streams12 trigger at_once IGNORE EXPIRED 0 into streamt12 as select _wstart as ts, avg(a), count(*), timezone(), to_iso8601(1) from t1 where ts >= 1648791210000 and ts < 1648791240000 interval(1s) fill(value,100.0,200); +sql create stream streams13 trigger at_once IGNORE EXPIRED 0 into streamt13 as select _wstart as ts, avg(a), count(*), timezone(), to_iso8601(1) from t1 where ts >= 1648791210000 and ts < 1648791240000 interval(1s) fill(next); +sql create stream streams14 trigger at_once IGNORE EXPIRED 0 into streamt14 as select _wstart as ts, avg(a), count(*), timezone(), to_iso8601(1) from t1 where ts >= 1648791210000 and ts < 1648791240000 interval(1s) fill(prev); +sql create stream streams15 trigger at_once IGNORE EXPIRED 0 into streamt15 as select _wstart as ts, avg(a), count(*), timezone(), to_iso8601(1) from t1 where ts >= 1648791210000 and ts < 1648791240000 interval(1s) fill(linear); sql insert into t1 values(1648791210000,1,1,1,1.0,'aaa'); diff --git a/tests/script/tsim/stream/fillIntervalLinear.sim b/tests/script/tsim/stream/fillIntervalLinear.sim index b9f301d81bed7f8fc71a9c4522290c833d46d6ee..3fa369d8d517732ad22fad3582c9aa43e3e127be 100644 --- a/tests/script/tsim/stream/fillIntervalLinear.sim +++ b/tests/script/tsim/stream/fillIntervalLinear.sim @@ -16,7 +16,7 @@ sql drop database if exists test1; sql create database test1 vgroups 1; sql use test1; sql create table t1(ts timestamp, a int, b int , c int, d double, s varchar(20)); -sql create stream streams1 trigger at_once into streamt1 as select _wstart as ts, max(a)+sum(c), avg(b), first(s), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(linear); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 into streamt1 as select _wstart as ts, max(a)+sum(c), avg(b), first(s), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(linear); sql insert into t1 values(1648791213000,4,4,4,4.0,'aaa') (1648791216000,5,5,5,5.0,'bbb'); sql insert into t1 values(1648791210000,1,1,1,1.0,'ccc') (1648791219000,2,2,2,2.0,'ddd') (1648791222000,3,3,3,3.0,'eee'); @@ -205,7 +205,7 @@ sql drop database if exists test2; sql create database test2 vgroups 1; sql use test2; sql create table t1(ts timestamp, a int, b int , c int, d double, s varchar(20)); -sql create stream streams2 trigger at_once into streamt2 as select _wstart as ts, max(a)+sum(c), avg(b), first(s), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(linear); +sql create stream streams2 trigger at_once IGNORE EXPIRED 0 into streamt2 as select _wstart as ts, max(a)+sum(c), avg(b), first(s), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(linear); sql insert into t1 values(1648791210000,1,1,1,1.0,'ccc') (1648791219000,2,2,2,2.0,'ddd') (1648791222000,3,3,3,3.0,'eee'); sql insert into t1 values(1648791213000,4,4,4,4.0,'aaa') (1648791216000,5,5,5,5.0,'bbb'); @@ -393,7 +393,7 @@ sql drop database if exists test3; sql create database test3 vgroups 1; sql use test3; sql create table t1(ts timestamp, a int, b int , c int, d double, s varchar(20)); -sql create stream streams3 trigger at_once into streamt3 as select _wstart as ts, max(a), b+c, s, b+1, 1 from t1 where ts >= 1648791150000 and ts < 1648791261000 interval(1s) fill(linear); +sql create stream streams3 trigger at_once IGNORE EXPIRED 0 into streamt3 as select _wstart as ts, max(a), b+c, s, b+1, 1 from t1 where ts >= 1648791150000 and ts < 1648791261000 interval(1s) fill(linear); sql insert into t1 values(1648791215000,1,1,1,1.0,'aaa'); sql insert into t1 values(1648791217000,2,2,2,2.0,'bbb'); sql insert into t1 values(1648791211000,3,3,3,3.0,'ccc'); diff --git a/tests/script/tsim/stream/fillIntervalPartitionBy.sim b/tests/script/tsim/stream/fillIntervalPartitionBy.sim index 168452fdc8950223a944b1b18e23e0a3dd508873..6a11b9952c9126810d9b6431c36e09ccf7f14894 100644 --- a/tests/script/tsim/stream/fillIntervalPartitionBy.sim +++ b/tests/script/tsim/stream/fillIntervalPartitionBy.sim @@ -18,11 +18,11 @@ sql use test1; sql create stable st(ts timestamp, a int, b int , c int, d double, s varchar(20)) tags(ta int,tb int,tc int); sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -sql create stream streams1 trigger at_once into streamt1 as select _wstart as ts, max(a) c1, sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 partition by ta interval(1s) fill(NULL); -sql create stream streams2 trigger at_once into streamt2 as select _wstart as ts, max(a) c1, sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 partition by ta interval(1s) fill(value,100,200,300); -sql create stream streams3 trigger at_once into streamt3 as select _wstart as ts, max(a) c1, sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 partition by ta interval(1s) fill(next); -sql create stream streams4 trigger at_once into streamt4 as select _wstart as ts, max(a) c1, sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 partition by ta interval(1s) fill(prev); -sql create stream streams5 trigger at_once into streamt5 as select _wstart as ts, max(a) c1, sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 partition by ta interval(1s) fill(linear); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 into streamt1 as select _wstart as ts, max(a) c1, sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 partition by ta interval(1s) fill(NULL); +sql create stream streams2 trigger at_once IGNORE EXPIRED 0 into streamt2 as select _wstart as ts, max(a) c1, sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 partition by ta interval(1s) fill(value,100,200,300); +sql create stream streams3 trigger at_once IGNORE EXPIRED 0 into streamt3 as select _wstart as ts, max(a) c1, sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 partition by ta interval(1s) fill(next); +sql create stream streams4 trigger at_once IGNORE EXPIRED 0 into streamt4 as select _wstart as ts, max(a) c1, sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 partition by ta interval(1s) fill(prev); +sql create stream streams5 trigger at_once IGNORE EXPIRED 0 into streamt5 as select _wstart as ts, max(a) c1, sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 partition by ta interval(1s) fill(linear); sql insert into t1 values(1648791210000,0,0,0,0.0,'aaa'); sql insert into t1 values(1648791213000,1,1,1,1.0,'bbb'); diff --git a/tests/script/tsim/stream/fillIntervalPrevNext.sim b/tests/script/tsim/stream/fillIntervalPrevNext.sim index 99f7dcb5cb03aa9734efae6bfe3429c98c7d9ad8..ec963e1d4a8dd02e8ac1aaa01ac415d82bb2ecfc 100644 --- a/tests/script/tsim/stream/fillIntervalPrevNext.sim +++ b/tests/script/tsim/stream/fillIntervalPrevNext.sim @@ -15,8 +15,8 @@ sql drop database if exists test1; sql create database test1 vgroups 1; sql use test1; sql create table t1(ts timestamp, a int, b int , c int, d double, s varchar(20)); -sql create stream streams1 trigger at_once into streamt1 as select _wstart as ts, count(*) c1, max(b)+sum(a) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(prev); -sql create stream streams2 trigger at_once into streamt2 as select _wstart as ts, count(*) c1, max(a)+min(c), avg(b) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(next); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 into streamt1 as select _wstart as ts, count(*) c1, max(b)+sum(a) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(prev); +sql create stream streams2 trigger at_once IGNORE EXPIRED 0 into streamt2 as select _wstart as ts, count(*) c1, max(a)+min(c), avg(b) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(next); sql insert into t1 values(1648791213000,4,4,4,4.0,'aaa') (1648791215000,5,5,5,5.0,'aaa'); sql insert into t1 values(1648791211000,1,1,1,1.0,'aaa') (1648791217000,2,2,2,2.0,'aaa') (1648791220000,3,3,3,3.0,'aaa'); @@ -263,8 +263,8 @@ sql drop database if exists test5; sql create database test5 vgroups 1; sql use test5; sql create table t1(ts timestamp, a int, b int , c int, d double, s varchar(20)); -sql create stream streams5 trigger at_once into streamt5 as select _wstart as ts, count(*) c1, max(b)+sum(a) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(prev); -sql create stream streams6 trigger at_once into streamt6 as select _wstart as ts, count(*) c1, max(a)+min(c), avg(b) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(next); +sql create stream streams5 trigger at_once IGNORE EXPIRED 0 into streamt5 as select _wstart as ts, count(*) c1, max(b)+sum(a) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(prev); +sql create stream streams6 trigger at_once IGNORE EXPIRED 0 into streamt6 as select _wstart as ts, count(*) c1, max(a)+min(c), avg(b) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(next); sql insert into t1 values(1648791211000,1,1,1,1.0,'aaa') (1648791217000,2,2,2,2.0,'aaa') (1648791220000,3,3,3,3.0,'aaa'); sql insert into t1 values(1648791213000,4,4,4,4.0,'aaa') (1648791215000,5,5,5,5.0,'aaa'); diff --git a/tests/script/tsim/stream/fillIntervalPrevNext1.sim b/tests/script/tsim/stream/fillIntervalPrevNext1.sim index 8058065bcf7d22938ea49221919e794e7a58e933..40ef895c5af3253f7dae61623c6c1b0f5741850d 100644 --- a/tests/script/tsim/stream/fillIntervalPrevNext1.sim +++ b/tests/script/tsim/stream/fillIntervalPrevNext1.sim @@ -16,8 +16,8 @@ sql drop database if exists test7; sql create database test7 vgroups 1; sql use test7; sql create table t1(ts timestamp, a int, b int , c int, d double, s varchar(20)); -sql create stream streams7 trigger at_once into streamt7 as select _wstart as ts, max(a), b+c, s from t1 where ts >= 1648791150000 and ts < 1648791261000 interval(1s) fill(prev); -sql create stream streams8 trigger at_once into streamt8 as select _wstart as ts, max(a), 1, b+1 from t1 where ts >= 1648791150000 and ts < 1648791261000 interval(1s) fill(next); +sql create stream streams7 trigger at_once IGNORE EXPIRED 0 into streamt7 as select _wstart as ts, max(a), b+c, s from t1 where ts >= 1648791150000 and ts < 1648791261000 interval(1s) fill(prev); +sql create stream streams8 trigger at_once IGNORE EXPIRED 0 into streamt8 as select _wstart as ts, max(a), 1, b+1 from t1 where ts >= 1648791150000 and ts < 1648791261000 interval(1s) fill(next); sql insert into t1 values(1648791215000,1,1,1,1.0,'aaa'); sql insert into t1 values(1648791217000,2,2,2,2.0,'bbb'); sql insert into t1 values(1648791211000,3,3,3,3.0,'ccc'); diff --git a/tests/script/tsim/stream/fillIntervalRange.sim b/tests/script/tsim/stream/fillIntervalRange.sim index a0905141f2bed1230abd3f51acc867aed19d1c45..0e0dfb46d88c3102fffc3a467307863ea40fc1a4 100644 --- a/tests/script/tsim/stream/fillIntervalRange.sim +++ b/tests/script/tsim/stream/fillIntervalRange.sim @@ -13,7 +13,7 @@ sql create database test vgroups 1; sql use test; sql create table t1(ts timestamp, a int, b int , c int, d double, s varchar(20));; -sql create stream streams1 trigger at_once into streamt as select _wstart ts, count(*) c1 from t1 interval(1s) fill(NULL); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 into streamt as select _wstart ts, count(*) c1 from t1 interval(1s) fill(NULL); sql insert into t1 values(1648791211000,1,2,3,1.0,'aaa'); sleep 100 sql insert into t1 values(1648795308000,1,2,3,1.0,'aaa'); @@ -126,10 +126,10 @@ sql use test; sql create table t1(ts timestamp, a int, b int , c int, d double, s varchar(20)); print create stream streams1 trigger at_once into streamt as select _wstart ts, max(a) c1 from t1 interval(1s) fill(linear); -sql create stream streams1 trigger at_once into streamt as select _wstart ts, max(a) c1 from t1 interval(1s) fill(linear); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 into streamt as select _wstart ts, max(a) c1 from t1 interval(1s) fill(linear); print create stream streams2 trigger at_once into streamt2 as select _wstart ts, max(a) c1 from t1 interval(1s) fill(prev); -sql create stream streams2 trigger at_once into streamt2 as select _wstart ts, max(a) c1 from t1 interval(1s) fill(prev); +sql create stream streams2 trigger at_once IGNORE EXPIRED 0 into streamt2 as select _wstart ts, max(a) c1 from t1 interval(1s) fill(prev); sql insert into t1 values(1648791211000,1,2,3,1.0,'aaa'); sleep 100 diff --git a/tests/script/tsim/stream/fillIntervalValue.sim b/tests/script/tsim/stream/fillIntervalValue.sim index 2cd419397fdb0230aacd8983c2c5b238e82ab673..b447e9a5594ccd85fc8a164fd9c6aa848c09b168 100644 --- a/tests/script/tsim/stream/fillIntervalValue.sim +++ b/tests/script/tsim/stream/fillIntervalValue.sim @@ -13,8 +13,8 @@ sql create database test vgroups 1; sql use test; sql create table t1(ts timestamp, a int, b int , c int, d double, s varchar(20));; -sql create stream streams1 trigger at_once into streamt as select _wstart ts, count(*) c1 from t1 where ts > 1648791210000 and ts < 1648791413000 interval(10s) fill(value, 100); -sql create stream streams1a trigger at_once into streamta as select _wstart ts, count(*) c1 from t1 where ts > 1648791210000 and ts < 1648791413000 interval(10s) fill(value_f, 100); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 into streamt as select _wstart ts, count(*) c1 from t1 where ts > 1648791210000 and ts < 1648791413000 interval(10s) fill(value, 100); +sql create stream streams1a trigger at_once IGNORE EXPIRED 0 into streamta as select _wstart ts, count(*) c1 from t1 where ts > 1648791210000 and ts < 1648791413000 interval(10s) fill(value_f, 100); sql insert into t1 values(1648791213000,1,2,3,1.0,'aaa'); sleep 100 sql insert into t1 values(1648791233000,1,2,3,1.0,'aaa'); @@ -146,7 +146,7 @@ sql drop database if exists test2; sql create database test2 vgroups 1; sql use test2; sql create table t1(ts timestamp, a int, b int , c int, d double, s varchar(20)); -sql create stream streams2 trigger at_once into streamt2 as select _wstart as ts, count(*) c1, max(b)+sum(a) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(value, 100,200); +sql create stream streams2 trigger at_once IGNORE EXPIRED 0 into streamt2 as select _wstart as ts, count(*) c1, max(b)+sum(a) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(value, 100,200); sql insert into t1 values(1648791211000,1,1,1,1.0,'aaa') (1648791217000,2,2,2,2.0,'aaa') (1648791220000,3,3,3,3.0,'aaa'); sql insert into t1 values(1648791213000,4,4,4,4.0,'aaa') (1648791215000,5,5,5,5.0,'aaa'); @@ -280,7 +280,7 @@ sql drop database if exists test3; sql create database test3 vgroups 1; sql use test3; sql create table t1(ts timestamp, a int, b int , c int, d double, s varchar(20)); -sql create stream streams3 trigger at_once into streamt3 as select _wstart as ts, max(b), a+b, c from t1 where ts >= 1648791200000 and ts < 1648791261000 interval(10s) sliding(3s) fill(value, 100,200,300); +sql create stream streams3 trigger at_once IGNORE EXPIRED 0 into streamt3 as select _wstart as ts, max(b), a+b, c from t1 where ts >= 1648791200000 and ts < 1648791261000 interval(10s) sliding(3s) fill(value, 100,200,300); sql insert into t1 values(1648791220000,1,1,1,1.0,'aaa'); sleep 100 @@ -471,8 +471,8 @@ sql create stable st(ts timestamp,a int,b int,c int, d double, s varchar(20) ) t sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -sql create stream streams4 trigger at_once into streamt4 as select _wstart ts, count(*) c1, concat(tbname, 'aaa') as pname, timezone() from st where ts > 1648791000000 and ts < 1648793000000 partition by tbname interval(10s) fill(NULL); -sql create stream streams4a trigger at_once into streamt4a as select _wstart ts, count(*) c1, concat(tbname, 'aaa') as pname, timezone() from st where ts > 1648791000000 and ts < 1648793000000 partition by tbname interval(10s) fill(NULL_F); +sql create stream streams4 trigger at_once IGNORE EXPIRED 0 into streamt4 as select _wstart ts, count(*) c1, concat(tbname, 'aaa') as pname, timezone() from st where ts > 1648791000000 and ts < 1648793000000 partition by tbname interval(10s) fill(NULL); +sql create stream streams4a trigger at_once IGNORE EXPIRED 0 into streamt4a as select _wstart ts, count(*) c1, concat(tbname, 'aaa') as pname, timezone() from st where ts > 1648791000000 and ts < 1648793000000 partition by tbname interval(10s) fill(NULL_F); sql insert into t1 values(1648791213000,1,2,3,1.0,'aaa'); sql insert into t1 values(1648791233000,1,2,3,1.0,'aaa'); sql insert into t1 values(1648791273000,1,2,3,1.0,'aaa'); diff --git a/tests/script/tsim/stream/ignoreCheckUpdate.sim b/tests/script/tsim/stream/ignoreCheckUpdate.sim index 7f99c534c8d5ffca96f9a394e330c33bf7500afb..2cd0117febdf4baa683489f2c2892dcfbe11f617 100644 --- a/tests/script/tsim/stream/ignoreCheckUpdate.sim +++ b/tests/script/tsim/stream/ignoreCheckUpdate.sim @@ -12,9 +12,9 @@ sql create database test vgroups 1; sql use test; sql create table t1(ts timestamp, a int, b int , c int); -print create stream streams0 trigger at_once ignore update 1 into streamt as select _wstart c1, count(*) c2, max(b) c3 from t1 interval(10s); +print create stream streams0 trigger at_once IGNORE EXPIRED 0 ignore update 1 into streamt as select _wstart c1, count(*) c2, max(b) c3 from t1 interval(10s); -sql create stream streams0 trigger at_once ignore update 1 into streamt as select _wstart c1, count(*) c2, max(b) c3 from t1 interval(10s); +sql create stream streams0 trigger at_once IGNORE EXPIRED 0 ignore update 1 into streamt as select _wstart c1, count(*) c2, max(b) c3 from t1 interval(10s); sql insert into t1 values(1648791213000,1,1,1); sql insert into t1 values(1648791213000,2,2,2); diff --git a/tests/script/tsim/stream/partitionby.sim b/tests/script/tsim/stream/partitionby.sim index bc2c07b951373ae924d836664977dfe5897e845a..e63459e97d42de9ca666e1d7b493923b6155dd30 100644 --- a/tests/script/tsim/stream/partitionby.sim +++ b/tests/script/tsim/stream/partitionby.sim @@ -12,7 +12,7 @@ sql create table ts1 using st tags(1,1,1); sql create table ts2 using st tags(2,2,2); 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 into test0.streamtST1 as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(b) c4, min(c) c5 from st partition by ta,tb,tc interval(10s); +sql create stream stream_t1 trigger at_once IGNORE EXPIRED 0 into test0.streamtST1 as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(b) c4, min(c) c5 from st partition by ta,tb,tc interval(10s); sql insert into ts1 values(1648791213001,1,12,3,1.0); sql insert into ts2 values(1648791213001,1,12,3,1.0); @@ -67,7 +67,7 @@ sql create table ts1 using st tags(1,2,3); sql create table ts2 using st tags(1,3,4); sql create table ts3 using st tags(1,4,5); -sql create stream streams1 trigger at_once into streamt as select _wstart, count(*) c1, count(a) c2 from st partition by ta,tb,tc interval(10s); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 into streamt as select _wstart, count(*) c1, count(a) c2 from st partition by ta,tb,tc interval(10s); sql insert into ts1 values(1648791211000,1,2,3); @@ -98,7 +98,7 @@ sql create stable st(ts timestamp,a int,b int,c int,id int) tags(ta int,tb int,t sql create table ts1 using st tags(1,1,1); sql create table ts2 using st tags(2,2,2); -sql create stream stream_t2 trigger at_once watermark 20s into streamtST as select _wstart, count(*) c1, count(a) c2 , sum(a) c3 , max(b) c5, min(c) c6, max(id) c7 from st partition by ta interval(10s) ; +sql create stream stream_t2 trigger at_once watermark 20s IGNORE EXPIRED 0 into streamtST as select _wstart, count(*) c1, count(a) c2 , sum(a) c3 , max(b) c5, min(c) c6, max(id) c7 from st partition by ta interval(10s) ; sql insert into ts1 values(1648791211000,1,2,3,1); sql insert into ts1 values(1648791222001,2,2,3,2); sql insert into ts2 values(1648791211000,1,2,3,3); diff --git a/tests/script/tsim/stream/partitionby1.sim b/tests/script/tsim/stream/partitionby1.sim index b29666cad7df8178e65f7032948d8b01ebd86855..c8bb25e0dd371331a0a6e42b6ad3ebe956451eba 100644 --- a/tests/script/tsim/stream/partitionby1.sim +++ b/tests/script/tsim/stream/partitionby1.sim @@ -11,7 +11,7 @@ sql create table ts1 using st tags(1,1,1); sql create table ts2 using st tags(2,2,2); 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 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); +sql create stream stream_t1 trigger at_once IGNORE EXPIRED 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); sql insert into ts1 values(1648791213001,1,12,3,1.0); sql insert into ts2 values(1648791213001,1,12,3,1.0); @@ -43,7 +43,7 @@ sql create table ts1 using st tags(1,2,3); sql create table ts2 using st tags(1,3,4); sql create table ts3 using st tags(1,4,5); -sql create stream streams1 trigger at_once into streamt as select _wstart, count(*) c1, count(a) c2 from st partition by tbname interval(10s); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 into streamt as select _wstart, count(*) c1, count(a) c2 from st partition by tbname interval(10s); sql insert into ts1 values(1648791211000,1,2,3); @@ -74,7 +74,7 @@ sql create stable st(ts timestamp,a int,b int,c int,id int) tags(ta int,tb int,t sql create table ts1 using st tags(1,1,1); sql create table ts2 using st tags(2,2,2); -sql create stream stream_t2 trigger at_once into streamtST as select _wstart, count(*) c1, count(a) c2 , sum(a) c3 , max(b) c5, min(c) c6, max(id) c7 from st partition by tbname interval(10s) ; +sql create stream stream_t2 trigger at_once IGNORE EXPIRED 0 into streamtST as select _wstart, count(*) c1, count(a) c2 , sum(a) c3 , max(b) c5, min(c) c6, max(id) c7 from st partition by tbname interval(10s) ; sql insert into ts1 values(1648791211000,1,2,3,1); sql insert into ts1 values(1648791222001,2,2,3,2); sql insert into ts2 values(1648791211000,1,2,3,3); diff --git a/tests/script/tsim/stream/partitionbyColumnInterval.sim b/tests/script/tsim/stream/partitionbyColumnInterval.sim index 2e57e8d699ec1b04a303c4888083a3408130b724..94053990e443229782a34143f95ad6ff594fd6af 100644 --- a/tests/script/tsim/stream/partitionbyColumnInterval.sim +++ b/tests/script/tsim/stream/partitionbyColumnInterval.sim @@ -16,7 +16,7 @@ sql drop database if exists test; sql create database test vgroups 1; sql use test; sql create table t1(ts timestamp, a int, b int , c int, d double); -sql create stream streams0 trigger at_once into streamt as select _wstart c1, count(*) c2, max(a) c3, _group_key(a) c4 from t1 partition by a interval(10s); +sql create stream streams0 trigger at_once IGNORE EXPIRED 0 into streamt as select _wstart c1, count(*) c2, max(a) c3, _group_key(a) c4 from t1 partition by a interval(10s); sql insert into t1 values(1648791213000,NULL,NULL,NULL,NULL); sql insert into t1 values(1648791213000,NULL,NULL,NULL,NULL); @@ -197,7 +197,7 @@ sql drop database if exists test1; sql create database test1 vgroups 1; sql use test1; sql create table t1(ts timestamp, a int, b int , c int, d double); -sql create stream streams1 trigger at_once into streamt1 as select _wstart c1, count(*) c2, max(c) c3, _group_key(a+b) c4 from t1 partition by a+b interval(10s); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 into streamt1 as select _wstart c1, count(*) c2, max(c) c3, _group_key(a+b) c4 from t1 partition by a+b interval(10s); sql insert into t1 values(1648791213000,NULL,NULL,NULL,NULL); sql insert into t1 values(1648791213000,NULL,NULL,NULL,NULL); @@ -284,7 +284,7 @@ sql use test2; sql create stable st(ts timestamp, a int, b int, c int, d double) tags(ta int,tb int,tc int); sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -sql create stream streams2 trigger at_once into test.streamt2 as select _wstart c1, count(*) c2, max(a) c3 from st partition by a interval(10s); +sql create stream streams2 trigger at_once IGNORE EXPIRED 0 into test.streamt2 as select _wstart c1, count(*) c2, max(a) c3 from st partition by a interval(10s); sql insert into t1 values(1648791213000,NULL,NULL,NULL,NULL); sql insert into t1 values(1648791213000,NULL,NULL,NULL,NULL); @@ -481,7 +481,7 @@ sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); sql create table t3 using st tags(2,2,2); sql create table t4 using st tags(2,2,2); -sql create stream streams4 trigger at_once into test.streamt4 as select _wstart c1, count(*) c2, max(a) c3 from st partition by a interval(10s); +sql create stream streams4 trigger at_once IGNORE EXPIRED 0 into test.streamt4 as select _wstart c1, count(*) c2, max(a) c3 from st partition by a interval(10s); sql insert into t1 values(1648791213000,2,2,3,1.0); sql insert into t2 values(1648791213000,2,2,3,1.0); @@ -571,7 +571,7 @@ sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); sql create table t3 using st tags(2,2,2); sql create table t4 using st tags(2,2,2); -sql create stream streams5 trigger at_once into test.streamt5 as select _wstart c1, count(*) c2, max(a) c3 from st partition by a interval(10s); +sql create stream streams5 trigger at_once IGNORE EXPIRED 0 into test.streamt5 as select _wstart c1, count(*) c2, max(a) c3 from st partition by a interval(10s); sql insert into t1 values(1648791213000,1,2,3,1.0); sql insert into t2 values(1648791213000,2,2,3,1.0); diff --git a/tests/script/tsim/stream/partitionbyColumnSession.sim b/tests/script/tsim/stream/partitionbyColumnSession.sim index 1742d52cf03f9a6d2ec159295495cebfbb39aefc..bb3f6015c715bbcb7324cb8153fc081b7794f4bf 100644 --- a/tests/script/tsim/stream/partitionbyColumnSession.sim +++ b/tests/script/tsim/stream/partitionbyColumnSession.sim @@ -16,7 +16,7 @@ sql drop database if exists test; sql create database test vgroups 1; sql use test; sql create table t1(ts timestamp, a int, b int , c int, d double); -sql create stream streams0 trigger at_once into streamt as select _wstart c1, count(*) c2, max(a) c3, _group_key(a) c4 from t1 partition by a session(ts, 5s); +sql create stream streams0 trigger at_once IGNORE EXPIRED 0 into streamt as select _wstart c1, count(*) c2, max(a) c3, _group_key(a) c4 from t1 partition by a session(ts, 5s); sql insert into t1 values(1648791213000,NULL,NULL,NULL,NULL); sql insert into t1 values(1648791213000,NULL,NULL,NULL,NULL); @@ -196,7 +196,7 @@ sql drop database if exists test1; sql create database test1 vgroups 1; sql use test1; sql create table t1(ts timestamp, a int, b int , c int, d double); -sql create stream streams1 trigger at_once into streamt1 as select _wstart c1, count(*) c2, max(c) c3, _group_key(a+b) c4 from t1 partition by a+b session(ts, 5s); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 into streamt1 as select _wstart c1, count(*) c2, max(c) c3, _group_key(a+b) c4 from t1 partition by a+b session(ts, 5s); sql insert into t1 values(1648791213000,NULL,NULL,NULL,NULL); sql insert into t1 values(1648791213000,NULL,NULL,NULL,NULL); @@ -282,7 +282,7 @@ sql use test2; sql create stable st(ts timestamp, a int, b int, c int, d double) tags(ta int,tb int,tc int); sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -sql create stream streams2 trigger at_once into test.streamt2 as select _wstart c1, count(*) c2, max(a) c3 from st partition by a session(ts, 5s); +sql create stream streams2 trigger at_once IGNORE EXPIRED 0 into test.streamt2 as select _wstart c1, count(*) c2, max(a) c3 from st partition by a session(ts, 5s); sql insert into t1 values(1648791213000,NULL,NULL,NULL,NULL); sql insert into t1 values(1648791213000,NULL,NULL,NULL,NULL); @@ -478,7 +478,7 @@ sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); sql create table t3 using st tags(2,2,2); sql create table t4 using st tags(2,2,2); -sql create stream streams4 trigger at_once into test.streamt4 as select _wstart c1, count(*) c2, max(a) c3 from st partition by a session(ts, 5s); +sql create stream streams4 trigger at_once IGNORE EXPIRED 0 into test.streamt4 as select _wstart c1, count(*) c2, max(a) c3 from st partition by a session(ts, 5s); sql insert into t1 values(1648791213000,2,2,3,1.0); sql insert into t2 values(1648791213000,2,2,3,1.0); diff --git a/tests/script/tsim/stream/partitionbyColumnState.sim b/tests/script/tsim/stream/partitionbyColumnState.sim index 75d01b17ec6495be9644ce7e7db401a0147b3a52..62262a490ce739a463142d2b91a5ffecb1fe8f26 100644 --- a/tests/script/tsim/stream/partitionbyColumnState.sim +++ b/tests/script/tsim/stream/partitionbyColumnState.sim @@ -11,7 +11,7 @@ sql drop database if exists test; sql create database test vgroups 1; sql use test; sql create table t1(ts timestamp, a int, b int , c int, d double); -sql create stream streams0 trigger at_once into streamt as select _wstart c1, count(*) c2, max(a) c3, _group_key(a) c4 from t1 partition by a state_window(b); +sql create stream streams0 trigger at_once IGNORE EXPIRED 0 into streamt as select _wstart c1, count(*) c2, max(a) c3, _group_key(a) c4 from t1 partition by a state_window(b); sql insert into t1 values(1648791213000,NULL,NULL,NULL,NULL); sql insert into t1 values(1648791213000,NULL,NULL,NULL,NULL); @@ -191,7 +191,7 @@ sql drop database if exists test1; sql create database test1 vgroups 1; sql use test1; sql create table t1(ts timestamp, a int, b int , c int, d int); -sql create stream streams1 trigger at_once into streamt1 as select _wstart c1, count(*) c2, max(d) c3, _group_key(a+b) c4 from t1 partition by a+b state_window(c); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 into streamt1 as select _wstart c1, count(*) c2, max(d) c3, _group_key(a+b) c4 from t1 partition by a+b state_window(c); sql insert into t1 values(1648791213000,NULL,NULL,NULL,NULL); sql insert into t1 values(1648791213000,NULL,NULL,NULL,NULL); diff --git a/tests/script/tsim/stream/schedSnode.sim b/tests/script/tsim/stream/schedSnode.sim index 2caecf50a202db447b6b45e37ce99cd50ed4ec7f..6a4d6f79bb1fbc11ea8e8da5754e997f6c914955 100644 --- a/tests/script/tsim/stream/schedSnode.sim +++ b/tests/script/tsim/stream/schedSnode.sim @@ -20,7 +20,7 @@ sql create table ts1 using st tags(1,1,1); sql create table ts2 using st tags(2,2,2); 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 into target.streamtST1 as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(b) c4, min(c) c5 from st interval(10s); +sql create stream stream_t1 trigger at_once IGNORE EXPIRED 0 into target.streamtST1 as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(b) c4, min(c) c5 from st interval(10s); sleep 1000 diff --git a/tests/script/tsim/stream/session0.sim b/tests/script/tsim/stream/session0.sim index 5e95428e0a2d34adaf830fc74019e320513d2586..622c5f7c6d4fa2d33e6cbdad9f4270c23009b441 100644 --- a/tests/script/tsim/stream/session0.sim +++ b/tests/script/tsim/stream/session0.sim @@ -17,7 +17,7 @@ sql use test; sql create table t1(ts timestamp, a int, b int , c int, d double,id int); -sql create stream streams1 trigger at_once into streamt as select _wstart, count(*) c1, sum(a), max(a), min(d), stddev(a), last(a), first(d), max(id) s from t1 session(ts,10s); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 into streamt as select _wstart, count(*) c1, sum(a), max(a), min(d), stddev(a), last(a), first(d), max(id) s from t1 session(ts,10s); sql insert into t1 values(1648791213000,NULL,NULL,NULL,NULL,1); sql insert into t1 values(1648791223001,10,2,3,1.1,2); sql insert into t1 values(1648791233002,3,2,3,2.1,3); @@ -179,7 +179,7 @@ endi sql create database test2 vgroups 1; sql use test2; sql create table t2(ts timestamp, a int, b int , c int, d double, id int); -sql create stream streams2 trigger at_once watermark 1d into streamt2 as select _wstart,apercentile(a,30) c1, apercentile(a,70), apercentile(a,20,"t-digest") c2, apercentile(a,60,"t-digest") c3, max(id) c4 from t2 session(ts,10s); +sql create stream streams2 trigger at_once IGNORE EXPIRED 0 watermark 1d into streamt2 as select _wstart,apercentile(a,30) c1, apercentile(a,70), apercentile(a,20,"t-digest") c2, apercentile(a,60,"t-digest") c3, max(id) c4 from t2 session(ts,10s); sql insert into t2 values(1648791213001,1,1,3,1.0,1); sql insert into t2 values(1648791213002,2,2,6,3.4,2); sql insert into t2 values(1648791213003,4,9,3,4.8,3); @@ -229,13 +229,13 @@ endi sql create database test3 vgroups 1; sql use test3; sql create table t1(ts timestamp, a int, b int , c int, d double); -sql create stream streams3 trigger at_once watermark 1d into streamt3 as select _wstart, min(b), a,c from t1 session(ts,10s); -sql create stream streams4 trigger at_once watermark 1d into streamt4 as select _wstart, max(b), a,c from t1 session(ts,10s); -# sql create stream streams5 trigger at_once watermark 1d into streamt5 as select _wstart, top(b,3), a,c from t1 session(ts,10s); -# sql create stream streams6 trigger at_once watermark 1d into streamt6 as select _wstart, bottom(b,3), a,c from t1 session(ts,10s); -# sql create stream streams7 trigger at_once watermark 1d into streamt7 as select _wstart, spread(a), elapsed(ts), hyperloglog(a) from t1 session(ts,10s); -sql create stream streams7 trigger at_once watermark 1d into streamt7 as select _wstart, spread(a), hyperloglog(a) from t1 session(ts,10s); -# sql create stream streams8 trigger at_once watermark 1d into streamt8 as select _wstart, histogram(a,"user_input", "[1,3,5,7]", 1), histogram(a,"user_input", "[1,3,5,7]", 0) from t1 session(ts,10s); +sql create stream streams3 trigger at_once watermark 1d IGNORE EXPIRED 0 into streamt3 as select _wstart, min(b), a,c from t1 session(ts,10s); +sql create stream streams4 trigger at_once watermark 1d IGNORE EXPIRED 0 into streamt4 as select _wstart, max(b), a,c from t1 session(ts,10s); +# sql create stream streams5 trigger at_once watermark 1d IGNORE EXPIRED 0 into streamt5 as select _wstart, top(b,3), a,c from t1 session(ts,10s); +# sql create stream streams6 trigger at_once watermark 1d IGNORE EXPIRED 0 into streamt6 as select _wstart, bottom(b,3), a,c from t1 session(ts,10s); +# sql create stream streams7 trigger at_once watermark 1d IGNORE EXPIRED 0 into streamt7 as select _wstart, spread(a), elapsed(ts), hyperloglog(a) from t1 session(ts,10s); +sql create stream streams7 trigger at_once watermark 1d IGNORE EXPIRED 0 into streamt7 as select _wstart, spread(a), hyperloglog(a) from t1 session(ts,10s); +# sql create stream streams8 trigger at_once watermark 1d IGNORE EXPIRED 0 into streamt8 as select _wstart, histogram(a,"user_input", "[1,3,5,7]", 1), histogram(a,"user_input", "[1,3,5,7]", 0) from t1 session(ts,10s); sql insert into t1 values(1648791213001,1,1,1,1.0); sql insert into t1 values(1648791213002,2,3,2,3.4); sql insert into t1 values(1648791213003,4,9,3,4.8); diff --git a/tests/script/tsim/stream/session1.sim b/tests/script/tsim/stream/session1.sim index f535fd619fbedfa87598569ba7edfde82bd18086..3ad7c6f04ed4bb63878bb3a3503b75e089e08e9f 100644 --- a/tests/script/tsim/stream/session1.sim +++ b/tests/script/tsim/stream/session1.sim @@ -17,7 +17,7 @@ sql use test; sql create table t1(ts timestamp, a int, b int , c int, d double,id int); -sql create stream streams2 trigger at_once into streamt as select _wstart, count(*) c1, sum(a), min(b), max(id) s from t1 session(ts,10s); +sql create stream streams2 trigger at_once IGNORE EXPIRED 0 into streamt as select _wstart, count(*) c1, sum(a), min(b), max(id) s from t1 session(ts,10s); sql insert into t1 values(1648791210000,1,1,1,1.1,1); sql insert into t1 values(1648791220000,2,2,2,2.1,2); sql insert into t1 values(1648791230000,3,3,3,3.1,3); @@ -200,7 +200,7 @@ endi sql create database test1 vgroups 1; sql use test1; sql create table t1(ts timestamp, a int, b int , c int, d double); -sql create stream streams3 trigger at_once into streamt3 as select _wstart, count(*) c1 from t1 where a > 5 session(ts, 5s); +sql create stream streams3 trigger at_once IGNORE EXPIRED 0 into streamt3 as select _wstart, count(*) c1 from t1 where a > 5 session(ts, 5s); sql insert into t1 values(1648791213000,1,2,3,1.0); $loop_count = 0 diff --git a/tests/script/tsim/stream/sliding.sim b/tests/script/tsim/stream/sliding.sim index 8287274cd2a008f264365ea06d049428ae645d2f..e12e3c6686c3d35924f43c1675134ba9a0bff65c 100644 --- a/tests/script/tsim/stream/sliding.sim +++ b/tests/script/tsim/stream/sliding.sim @@ -17,10 +17,10 @@ sql use test; sql create stable st(ts timestamp, a int, b int, c int, d double) tags(ta int,tb int,tc int); sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -sql create stream streams1 trigger at_once into streamt as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from t1 interval(10s) sliding (5s); -sql create stream streams2 trigger at_once watermark 1d into streamt2 as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from t1 interval(10s) sliding (5s); -sql create stream stream_t1 trigger at_once into streamtST as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from st interval(10s) sliding (5s); -sql create stream stream_t2 trigger at_once watermark 1d into streamtST2 as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from st interval(10s) sliding (5s); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 into streamt as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from t1 interval(10s) sliding (5s); +sql create stream streams2 trigger at_once watermark 1d IGNORE EXPIRED 0 into streamt2 as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from t1 interval(10s) sliding (5s); +sql create stream stream_t1 trigger at_once IGNORE EXPIRED 0 into streamtST as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from st interval(10s) sliding (5s); +sql create stream stream_t2 trigger at_once watermark 1d IGNORE EXPIRED 0 into streamtST2 as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from st interval(10s) sliding (5s); sql insert into t1 values(1648791210000,1,2,3,1.0); sql insert into t1 values(1648791216000,2,2,3,1.1); @@ -309,8 +309,8 @@ sql create stable st(ts timestamp, a int, b int, c int, d double) tags(ta int,tb sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -sql create stream streams11 trigger at_once into streamt as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from t1 interval(10s, 5s); -sql create stream streams12 trigger at_once into streamt2 as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from st interval(10s, 5s); +sql create stream streams11 trigger at_once IGNORE EXPIRED 0 into streamt as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from t1 interval(10s, 5s); +sql create stream streams12 trigger at_once IGNORE EXPIRED 0 into streamt2 as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from st interval(10s, 5s); sql insert into t1 values(1648791213000,1,2,3,1.0); sql insert into t1 values(1648791223001,2,2,3,1.1); @@ -442,9 +442,9 @@ sql create stable st(ts timestamp, a int, b int, c int, d double) tags(ta int,tb sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -sql create stream streams21 trigger at_once into streamt as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from t1 interval(10s, 5s); -sql create stream streams22 trigger at_once into streamt2 as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from st interval(10s, 5s); -sql create stream streams23 trigger at_once into streamt3 as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from st interval(20s) sliding(10s); +sql create stream streams21 trigger at_once IGNORE EXPIRED 0 into streamt as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from t1 interval(10s, 5s); +sql create stream streams22 trigger at_once IGNORE EXPIRED 0 into streamt2 as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from st interval(10s, 5s); +sql create stream streams23 trigger at_once IGNORE EXPIRED 0 into streamt3 as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from st interval(20s) sliding(10s); sql insert into t1 values(1648791213000,1,1,1,1.0); sql insert into t1 values(1648791223001,2,2,2,1.1); @@ -683,7 +683,7 @@ sql create stable st(ts timestamp, a int, b int, c int, d double) tags(ta int,tb sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -sql create stream streams4 trigger at_once into streamt4 as select _wstart as ts, count(*),min(a) c1 from st interval(10s) sliding(5s); +sql create stream streams4 trigger at_once IGNORE EXPIRED 0 into streamt4 as select _wstart as ts, count(*),min(a) c1 from st interval(10s) sliding(5s); sql insert into t1 values(1648791213000,1,1,1,1.0); sql insert into t1 values(1648791243000,2,1,1,1.0); diff --git a/tests/script/tsim/stream/state0.sim b/tests/script/tsim/stream/state0.sim index 07abdc0040d962bc6c6b6b0f15996cdf973ab450..d009f742b7311e6b4840e4ed7ccea9e92f9fa6e8 100644 --- a/tests/script/tsim/stream/state0.sim +++ b/tests/script/tsim/stream/state0.sim @@ -17,9 +17,9 @@ sql use test; sql create table t1(ts timestamp, a int, b int , c int, d double, id int); -print create stream streams1 trigger at_once into streamt1 as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(a) c4, min(c) c5, max(id) c from t1 state_window(a); +print create stream streams1 trigger at_once IGNORE EXPIRED 0 into streamt1 as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(a) c4, min(c) c5, max(id) c from t1 state_window(a); -sql create stream streams1 trigger at_once into streamt1 as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(a) c4, min(c) c5, max(id) c from t1 state_window(a); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 into streamt1 as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(a) c4, min(c) c5, max(id) c from t1 state_window(a); sql insert into t1 values(1648791213000,1,2,3,1.0,1); sql insert into t1 values(1648791213000,1,2,3,1.0,2); @@ -453,9 +453,9 @@ sql use test1; sql create table t1(ts timestamp, a int, b int , c int, d double, id int); -print create stream streams2 trigger at_once into streamt1 as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(a) c4, min(c) c5, max(id) c from t1 state_window(a); +print create stream streams2 trigger at_once IGNORE EXPIRED 0 into streamt1 as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(a) c4, min(c) c5, max(id) c from t1 state_window(a); -sql create stream streams2 trigger at_once into streamt1 as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(a) c4, min(c) c5, max(id) c from t1 state_window(a); +sql create stream streams2 trigger at_once IGNORE EXPIRED 0 into streamt1 as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(a) c4, min(c) c5, max(id) c from t1 state_window(a); sql insert into t1 values(1648791212000,2,2,3,1.0,1); sql insert into t1 values(1648791213000,1,2,3,1.0,1); @@ -501,9 +501,9 @@ sql use test3; sql create table t1(ts timestamp, a int, b int , c int, d double, id int); -print create stream streams3 trigger at_once into streamt3 as select _wstart, count(*) c1, sum(b) c3 from t1 state_window(a); +print create stream streams3 trigger at_once IGNORE EXPIRED 0 into streamt3 as select _wstart, count(*) c1, sum(b) c3 from t1 state_window(a); -sql create stream streams3 trigger at_once into streamt3 as select _wstart, count(*) c1, sum(b) c3 from t1 state_window(a); +sql create stream streams3 trigger at_once IGNORE EXPIRED 0 into streamt3 as select _wstart, count(*) c1, sum(b) c3 from t1 state_window(a); sql insert into t1 values(1648791212000,1,2,3,1.0,1); sql insert into t1 values(1648791213000,2,2,3,1.0,1); sql insert into t1 values(1648791214000,3,2,4,1.0,2); @@ -553,9 +553,9 @@ sql create table st (ts timestamp, c1 tinyint, c2 smallint) tags (t1 tinyint) ; sql create table t1 using st tags (-81) ; sql create table t2 using st tags (-81) ; -print create stream if not exists streams4 trigger window_close into streamt4 as select _wstart AS startts, min(c1),count(c1) from t1 state_window(c1); +print create stream if not exists streams4 trigger window_close IGNORE EXPIRED 0 into streamt4 as select _wstart AS startts, min(c1),count(c1) from t1 state_window(c1); -sql create stream if not exists streams4 trigger window_close into streamt4 as select _wstart AS startts, min(c1),count(c1) from t1 state_window(c1); +sql create stream if not exists streams4 trigger window_close IGNORE EXPIRED 0 into streamt4 as select _wstart AS startts, min(c1),count(c1) from t1 state_window(c1); sql insert into t1 (ts, c1) values (1668073288209, 11); sql insert into t1 (ts, c1) values (1668073288210, 11); @@ -742,9 +742,9 @@ sql create table tb (ts timestamp, a int); sql insert into tb values (now + 1m , 1 ); sql create table b (c timestamp, d int, e int , f int, g double); -print create stream streams0 trigger at_once into streamt as select _wstart c1, count(*) c2, max(a) c3 from tb state_window(a); +print create stream streams0 trigger at_once IGNORE EXPIRED 0 into streamt as select _wstart c1, count(*) c2, max(a) c3 from tb state_window(a); -sql create stream streams0 trigger at_once into streamt as select _wstart c1, count(*) c2, max(a) c3 from tb state_window(a); +sql create stream streams0 trigger at_once IGNORE EXPIRED 0 into streamt as select _wstart c1, count(*) c2, max(a) c3 from tb state_window(a); sql insert into b values(1648791213000,NULL,NULL,NULL,NULL); sql select * from streamt order by c1, c2, c3; diff --git a/tests/script/tsim/stream/triggerInterval0.sim b/tests/script/tsim/stream/triggerInterval0.sim index b522dcf035f66c439e8c59a8190d9228ea8dca5c..1c62f689ac3269357cdd39b8e2bb517d4e76e869 100644 --- a/tests/script/tsim/stream/triggerInterval0.sim +++ b/tests/script/tsim/stream/triggerInterval0.sim @@ -15,7 +15,7 @@ print $data00 $data01 $data02 sql use test sql create table t1(ts timestamp, a int, b int , c int, d double); -sql create stream streams1 trigger window_close into streamt as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(b) c4, min(c) c5 from t1 interval(10s); +sql create stream streams1 trigger window_close IGNORE EXPIRED 0 into streamt as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(b) c4, min(c) c5 from t1 interval(10s); sql insert into t1 values(1648791213001,1,2,3,1.0); sleep 300 diff --git a/tests/script/tsim/stream/triggerSession0.sim b/tests/script/tsim/stream/triggerSession0.sim index 4c664cf7c7b9ad8d29b0439066cefc3c130fc25e..81a016be2b2e5781495596a5a42a255b4f48c813 100644 --- a/tests/script/tsim/stream/triggerSession0.sim +++ b/tests/script/tsim/stream/triggerSession0.sim @@ -15,7 +15,7 @@ print $data00 $data01 $data02 sql use test; sql create table t2(ts timestamp, a int, b int , c int, d double); -sql create stream streams2 trigger window_close into streamt2 as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(b) c4, min(c) c5 from t2 session(ts, 10s); +sql create stream streams2 trigger window_close IGNORE EXPIRED 0 into streamt2 as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(b) c4, min(c) c5 from t2 session(ts, 10s); sql insert into t2 values(1648791213000,1,2,3,1.0); sql insert into t2 values(1648791222999,1,2,3,1.0); diff --git a/tests/script/tsim/stream/udTableAndTag0.sim b/tests/script/tsim/stream/udTableAndTag0.sim index 8bf34dc54c222ab54126564a877d5304bcfcf168..e3ab344bbef11e25bb9531e4a4f723b40722abd4 100644 --- a/tests/script/tsim/stream/udTableAndTag0.sim +++ b/tests/script/tsim/stream/udTableAndTag0.sim @@ -20,8 +20,8 @@ sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int); sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -#sql_error create stream streams1 trigger at_once into result.streamt SUBTABLE("aaa") as select _wstart, count(*) c1 from st interval(10s); -sql create stream streams1 trigger at_once into result.streamt SUBTABLE(concat("aaa-", tbname)) as select _wstart, count(*) c1 from st partition by tbname interval(10s); +#sql_error create stream streams1 trigger at_once IGNORE EXPIRED 0 into result.streamt SUBTABLE("aaa") as select _wstart, count(*) c1 from st interval(10s); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 into result.streamt SUBTABLE(concat("aaa-", tbname)) as select _wstart, count(*) c1 from st partition by tbname interval(10s); sql insert into t1 values(1648791213000,1,2,3); sql insert into t2 values(1648791213000,1,2,3); @@ -88,7 +88,7 @@ sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int); sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -sql create stream streams2 trigger at_once into result2.streamt2 TAGS(cc varchar(100)) as select _wstart, count(*) c1 from st partition by concat("tag-", tbname) as cc interval(10s); +sql create stream streams2 trigger at_once IGNORE EXPIRED 0 into result2.streamt2 TAGS(cc varchar(100)) as select _wstart, count(*) c1 from st partition by concat("tag-", tbname) as cc interval(10s); sql insert into t1 values(1648791213000,1,2,3); sql insert into t2 values(1648791213000,1,2,3); @@ -173,7 +173,7 @@ sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int); sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -sql create stream streams3 trigger at_once into result3.streamt3 TAGS(dd varchar(100)) SUBTABLE(concat("tbn-", tbname)) as select _wstart, count(*) c1 from st partition by concat("tag-", tbname) as dd, tbname interval(10s); +sql create stream streams3 trigger at_once IGNORE EXPIRED 0 into result3.streamt3 TAGS(dd varchar(100)) SUBTABLE(concat("tbn-", tbname)) as select _wstart, count(*) c1 from st partition by concat("tag-", tbname) as dd, tbname interval(10s); sql insert into t1 values(1648791213000,1,2,3); sql insert into t2 values(1648791213000,1,2,3); @@ -285,7 +285,7 @@ sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); sql create table t3 using st tags(3,3,3); -sql create stream streams4 trigger at_once into result4.streamt4 TAGS(dd varchar(100)) SUBTABLE(concat("tbn-", tbname)) as select _wstart, count(*) c1 from st partition by concat("tag-", tbname) as dd, tbname interval(10s); +sql create stream streams4 trigger at_once IGNORE EXPIRED 0 into result4.streamt4 TAGS(dd varchar(100)) SUBTABLE(concat("tbn-", tbname)) as select _wstart, count(*) c1 from st partition by concat("tag-", tbname) as dd, tbname interval(10s); sql insert into t1 values(1648791213000,1,1,1) t2 values(1648791213000,2,2,2) t3 values(1648791213000,3,3,3); @@ -404,7 +404,7 @@ sql create table t1 using st tags("1",1,1); sql create table t2 using st tags("2",2,2); sql create table t3 using st tags("3",3,3); -sql create stream streams6 trigger at_once into result6.streamt6 TAGS(dd int) as select _wstart, count(*) c1 from st partition by concat(ta, "0") as dd, tbname interval(10s); +sql create stream streams6 trigger at_once IGNORE EXPIRED 0 into result6.streamt6 TAGS(dd int) as select _wstart, count(*) c1 from st partition by concat(ta, "0") as dd, tbname interval(10s); sql insert into t1 values(1648791213000,1,1,1) t2 values(1648791213000,2,2,2) t3 values(1648791213000,3,3,3); diff --git a/tests/script/tsim/stream/udTableAndTag1.sim b/tests/script/tsim/stream/udTableAndTag1.sim index 4229de2cf0701c47aa12d9a196cb41fe4c39ca31..fbedaa6e4e2bb65d191546edc4b66cbfea5201d6 100644 --- a/tests/script/tsim/stream/udTableAndTag1.sim +++ b/tests/script/tsim/stream/udTableAndTag1.sim @@ -20,8 +20,8 @@ sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int); sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -#sql_error create stream streams1 trigger at_once into result.streamt SUBTABLE("aaa") as select _wstart, count(*) c1 from st interval(10s); -sql create stream streams1 trigger at_once into result.streamt SUBTABLE( concat("aaa-", cast(a as varchar(10) ) ) ) as select _wstart, count(*) c1 from st partition by a interval(10s); +#sql_error create stream streams1 trigger at_once IGNORE EXPIRED 0 into result.streamt SUBTABLE("aaa") as select _wstart, count(*) c1 from st interval(10s); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 into result.streamt SUBTABLE( concat("aaa-", cast(a as varchar(10) ) ) ) as select _wstart, count(*) c1 from st partition by a interval(10s); print ===== insert into 1 sql insert into t1 values(1648791213000,1,2,3); sql insert into t2 values(1648791213000,2,2,3); @@ -87,7 +87,7 @@ sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int); sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -sql create stream streams2 trigger at_once into result2.streamt2 TAGS(cc varchar(100)) as select _wstart, count(*) c1 from st partition by concat("col-", cast(a as varchar(10) ) ) as cc interval(10s); +sql create stream streams2 trigger at_once IGNORE EXPIRED 0 into result2.streamt2 TAGS(cc varchar(100)) as select _wstart, count(*) c1 from st partition by concat("col-", cast(a as varchar(10) ) ) as cc interval(10s); print ===== insert into 2 sql insert into t1 values(1648791213000,1,2,3); sql insert into t2 values(1648791213000,2,2,3); @@ -171,7 +171,7 @@ sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int); sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -sql create stream streams3 trigger at_once into result3.streamt3 TAGS(dd varchar(100)) SUBTABLE(concat("tbn-", cast(a as varchar(10) ) ) ) as select _wstart, count(*) c1 from st partition by concat("col-", cast(a as varchar(10) ) ) as dd, a interval(10s); +sql create stream streams3 trigger at_once IGNORE EXPIRED 0 into result3.streamt3 TAGS(dd varchar(100)) SUBTABLE(concat("tbn-", cast(a as varchar(10) ) ) ) as select _wstart, count(*) c1 from st partition by concat("col-", cast(a as varchar(10) ) ) as dd, a interval(10s); print ===== insert into 3 sql insert into t1 values(1648791213000,1,2,3); sql insert into t2 values(1648791213000,2,2,3); @@ -283,7 +283,7 @@ sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); sql create table t3 using st tags(3,3,3); -sql create stream streams4 trigger at_once into result4.streamt4 TAGS(dd varchar(100)) SUBTABLE(concat("tbn-", dd)) as select _wstart, count(*) c1 from st partition by concat("t", cast(a as varchar(10) ) ) as dd interval(10s); +sql create stream streams4 trigger at_once IGNORE EXPIRED 0 into result4.streamt4 TAGS(dd varchar(100)) SUBTABLE(concat("tbn-", dd)) as select _wstart, count(*) c1 from st partition by concat("t", cast(a as varchar(10) ) ) as dd interval(10s); sql insert into t1 values(1648791213000,1,1,1) t2 values(1648791213000,2,2,2) t3 values(1648791213000,3,3,3); diff --git a/tests/script/tsim/stream/udTableAndTag2.sim b/tests/script/tsim/stream/udTableAndTag2.sim index bacc301ad005d54dadd098a1b88db9ab17427c16..c0e72712df56be2f24f48a7ce1efb681da325b57 100644 --- a/tests/script/tsim/stream/udTableAndTag2.sim +++ b/tests/script/tsim/stream/udTableAndTag2.sim @@ -20,7 +20,7 @@ sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int); sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -sql create stream streams1 trigger at_once into result.streamt SUBTABLE("aaa") as select _wstart, count(*) c1 from st interval(10s); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 into result.streamt SUBTABLE("aaa") as select _wstart, count(*) c1 from st interval(10s); print ===== insert into 1 sql insert into t1 values(1648791213000,1,2,3); sql insert into t2 values(1648791213000,2,2,3); @@ -93,7 +93,7 @@ sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int); sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -sql create stream streams2 trigger at_once into result2.streamt2 TAGS(cc varchar(100)) as select _wstart, count(*) c1 from st interval(10s); +sql create stream streams2 trigger at_once IGNORE EXPIRED 0 into result2.streamt2 TAGS(cc varchar(100)) as select _wstart, count(*) c1 from st interval(10s); print ===== insert into 2 sql insert into t1 values(1648791213000,1,2,3); sql insert into t2 values(1648791213000,2,2,3); @@ -195,7 +195,7 @@ sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int); sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -sql create stream streams3 trigger at_once into result3.streamt3 TAGS(dd varchar(100)) SUBTABLE(concat("tbn-", "1") ) as select _wstart, count(*) c1 from st interval(10s); +sql create stream streams3 trigger at_once IGNORE EXPIRED 0 into result3.streamt3 TAGS(dd varchar(100)) SUBTABLE(concat("tbn-", "1") ) as select _wstart, count(*) c1 from st interval(10s); print ===== insert into 3 sql insert into t1 values(1648791213000,1,2,3); sql insert into t2 values(1648791213000,2,2,3); @@ -305,7 +305,7 @@ sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); sql create table t3 using st tags(3,3,3); -sql create stream streams4 trigger at_once into result4.streamt4 TAGS(dd varchar(100)) SUBTABLE(concat("tbn-", "1")) as select _wstart, count(*) c1 from st interval(10s); +sql create stream streams4 trigger at_once IGNORE EXPIRED 0 into result4.streamt4 TAGS(dd varchar(100)) SUBTABLE(concat("tbn-", "1")) as select _wstart, count(*) c1 from st interval(10s); sql insert into t1 values(1648791213000,1,1,1) t2 values(1648791213000,2,2,2) t3 values(1648791213000,3,3,3); @@ -375,9 +375,9 @@ sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int); sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -sql create stream streams51 trigger at_once into result5.streamt51 SUBTABLE("aaa") as select _wstart, count(*) c1 from st interval(10s); -sql create stream streams52 trigger at_once into result5.streamt52 TAGS(cc varchar(100)) as select _wstart, count(*) c1 from st interval(10s); -sql create stream streams53 trigger at_once into result5.streamt53 TAGS(dd varchar(100)) SUBTABLE(concat("aaa-", "1") ) as select _wstart, count(*) c1 from st interval(10s); +sql create stream streams51 trigger at_once IGNORE EXPIRED 0 into result5.streamt51 SUBTABLE("aaa") as select _wstart, count(*) c1 from st interval(10s); +sql create stream streams52 trigger at_once IGNORE EXPIRED 0 into result5.streamt52 TAGS(cc varchar(100)) as select _wstart, count(*) c1 from st interval(10s); +sql create stream streams53 trigger at_once IGNORE EXPIRED 0 into result5.streamt53 TAGS(dd varchar(100)) SUBTABLE(concat("aaa-", "1") ) as select _wstart, count(*) c1 from st interval(10s); sql insert into t1 values(1648791213000,1,2,3); sql insert into t2 values(1648791213000,2,2,3); diff --git a/tests/script/tsim/sync/3Replica1VgElect.sim b/tests/script/tsim/sync/3Replica1VgElect.sim index f069ff40e597df927d7162d5d628a7d8a50a23ca..aae1b25636b46a738096b93f8325e2d6f8a1306c 100644 --- a/tests/script/tsim/sync/3Replica1VgElect.sim +++ b/tests/script/tsim/sync/3Replica1VgElect.sim @@ -55,7 +55,7 @@ $loop_cnt = 0 check_db_ready: $loop_cnt = $loop_cnt + 1 sleep 200 -if $loop_cnt == 100 then +if $loop_cnt == 500 then print ====> db not ready! return -1 endi diff --git a/tests/script/tsim/tag/tbNameIn.sim b/tests/script/tsim/tag/tbNameIn.sim index 1af4bd6a9e34dbb33298ddcab5c28d0d1b716745..f5119208ba3f091eb7d97cc108dd3e9ba5a65728 100644 --- a/tests/script/tsim/tag/tbNameIn.sim +++ b/tests/script/tsim/tag/tbNameIn.sim @@ -99,4 +99,14 @@ if $rows != 7 then return -1 endi +sql select * from st1 where tbname in('tb1') and tbname in ('tb2'); +if $rows != 0 then + return -1 +endi + +sql select * from st1 where tbname in ('tb1') and tbname != 'tb1'; +if $rows != 0 then + return -1 +endi + system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/tmq/consume.sh b/tests/script/tsim/tmq/consume.sh index 001ce6ae496cc7e5f7b4c5a3bf5b92b0c7cf12b3..f0c9197a5908d2be9d21baa7aca5f193415a29d5 100755 --- a/tests/script/tsim/tmq/consume.sh +++ b/tests/script/tsim/tmq/consume.sh @@ -79,15 +79,15 @@ CFG_DIR=$PRG_DIR/cfg LOG_DIR=$PRG_DIR/log echo "------------------------------------------------------------------------" +echo "TOP_DIR: $TOP_DIR" echo "BUILD_DIR: $BUILD_DIR" echo "SIM_DIR : $SIM_DIR" echo "CFG_DIR : $CFG_DIR" - -echo "PROGRAM: $PROGRAM -echo "CFG_DIR: $CFG_DIR -echo "POLL_DELAY: $POLL_DELAY -echo "DB_NAME: $DB_NAME +echo "PROGRAM: $PROGRAM" +echo "CFG_DIR: $CFG_DIR" +echo "POLL_DELAY: $POLL_DELAY" +echo "DB_NAME: $DB_NAME" echo "------------------------------------------------------------------------" if [ "$EXEC_OPTON" = "start" ]; then diff --git a/tests/script/tsim/trans/create_stb.sim b/tests/script/tsim/trans/create_stb.sim new file mode 100644 index 0000000000000000000000000000000000000000..94041645d570296480b2557a3ec9bb21aca7241f --- /dev/null +++ b/tests/script/tsim/trans/create_stb.sim @@ -0,0 +1,72 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/deploy.sh -n dnode2 -i 2 +system sh/deploy.sh -n dnode3 -i 3 +system sh/deploy.sh -n dnode4 -i 4 +system sh/cfg.sh -n dnode1 -c transPullupInterval -v 1 +system sh/cfg.sh -n dnode2 -c transPullupInterval -v 1 +system sh/cfg.sh -n dnode3 -c transPullupInterval -v 1 +system sh/cfg.sh -n dnode4 -c transPullupInterval -v 1 +system sh/exec.sh -n dnode1 -s start +system sh/exec.sh -n dnode2 -s start +system sh/exec.sh -n dnode3 -s start +system sh/exec.sh -n dnode4 -s start +sql connect + +print =============== step1: create dnodes +sql create dnode $hostname port 7200 +sql create dnode $hostname port 7300 +sql create dnode $hostname port 7400 + +$x = 0 +step1: + $x = $x + 1 + sleep 1000 + if $x == 10 then + return -1 + endi +sql select * from information_schema.ins_dnodes -x step1 +if $data(1)[4] != ready then + goto step1 +endi +if $data(2)[4] != ready then + goto step1 +endi +if $data(3)[4] != ready then + goto step1 +endi + +print =============== step2: create mnode 2 and 3 +sql create mnode on dnode 2 +sql create mnode on dnode 3 +sql create database db vgroups 2 + +print =============== step3: kill dnode4 +system sh/exec.sh -n dnode4 -s stop -x SIGKILL +sql use db +sql_error create table stb (ts timestamp, i int) tags (j int) + +print =============== step4: create database +sql show transactions +if $rows != 1 then + return -1 +endi + +sleep 3000 +system sh/exec.sh -n dnode4 -s start + +$wt = 0 +step4: +$wt = $wt + 1 +sleep 1000 +if $wt == 200 then + print ====> transaction already running + return -1 +endi + +sql show transactions +if $rows != 0 then + print wait 1 seconds to alter + goto step4 +endi + diff --git a/tests/script/win-test-file b/tests/script/win-test-file new file mode 100644 index 0000000000000000000000000000000000000000..2d5a1b3108efb2b884bf7664ff61557f09d2bca5 --- /dev/null +++ b/tests/script/win-test-file @@ -0,0 +1,402 @@ +./test.sh -f tsim/user/basic.sim +./test.sh -f tsim/user/password.sim +./test.sh -f tsim/user/privilege_db.sim +./test.sh -f tsim/user/privilege_sysinfo.sim +./test.sh -f tsim/user/privilege_topic.sim +./test.sh -f tsim/db/alter_option.sim +rem ./test.sh -f tsim/db/alter_replica_13.sim +./test.sh -f tsim/db/alter_replica_31.sim +./test.sh -f tsim/db/basic1.sim +./test.sh -f tsim/db/basic2.sim +./test.sh -f tsim/db/basic3.sim +./test.sh -f tsim/db/basic4.sim +./test.sh -f tsim/db/basic5.sim +./test.sh -f tsim/db/basic6.sim +./test.sh -f tsim/db/commit.sim +./test.sh -f tsim/db/create_all_options.sim +./test.sh -f tsim/db/delete_reuse1.sim +./test.sh -f tsim/db/delete_reuse2.sim +./test.sh -f tsim/db/delete_reusevnode.sim +./test.sh -f tsim/db/delete_reusevnode2.sim +./test.sh -f tsim/db/delete_writing1.sim +./test.sh -f tsim/db/delete_writing2.sim +./test.sh -f tsim/db/error1.sim +./test.sh -f tsim/db/keep.sim +./test.sh -f tsim/db/len.sim +./test.sh -f tsim/db/repeat.sim +./test.sh -f tsim/db/show_create_db.sim +./test.sh -f tsim/db/show_create_table.sim +./test.sh -f tsim/db/tables.sim +./test.sh -f tsim/db/taosdlog.sim +./test.sh -f tsim/dnode/balance_replica1.sim +./test.sh -f tsim/dnode/balance_replica3.sim +./test.sh -f tsim/dnode/balance1.sim +./test.sh -f tsim/dnode/balance2.sim +./test.sh -f tsim/dnode/balance3.sim +./test.sh -f tsim/dnode/balancex.sim +./test.sh -f tsim/dnode/create_dnode.sim +./test.sh -f tsim/dnode/drop_dnode_has_mnode.sim +./test.sh -f tsim/dnode/drop_dnode_has_qnode_snode.sim +./test.sh -f tsim/dnode/drop_dnode_has_vnode_replica1.sim +./test.sh -f tsim/dnode/drop_dnode_has_vnode_replica3.sim +./test.sh -f tsim/dnode/drop_dnode_has_multi_vnode_replica1.sim +./test.sh -f tsim/dnode/drop_dnode_has_multi_vnode_replica3.sim +./test.sh -f tsim/dnode/drop_dnode_force.sim +./test.sh -f tsim/dnode/offline_reason.sim +./test.sh -f tsim/dnode/redistribute_vgroup_replica1.sim +./test.sh -f tsim/dnode/redistribute_vgroup_replica3_v1_leader.sim +./test.sh -f tsim/dnode/redistribute_vgroup_replica3_v1_follower.sim +./test.sh -f tsim/dnode/redistribute_vgroup_replica3_v2.sim +./test.sh -f tsim/dnode/redistribute_vgroup_replica3_v3.sim +./test.sh -f tsim/dnode/vnode_clean.sim +./test.sh -f tsim/dnode/use_dropped_dnode.sim +./test.sh -f tsim/dnode/split_vgroup_replica1.sim +./test.sh -f tsim/dnode/split_vgroup_replica3.sim +./test.sh -f tsim/import/basic.sim +./test.sh -f tsim/import/commit.sim +./test.sh -f tsim/import/large.sim +./test.sh -f tsim/import/replica1.sim +./test.sh -f tsim/insert/backquote.sim +./test.sh -f tsim/insert/basic.sim +./test.sh -f tsim/insert/basic0.sim +./test.sh -f tsim/insert/basic1.sim +./test.sh -f tsim/insert/basic2.sim +./test.sh -f tsim/insert/commit-merge0.sim +./test.sh -f tsim/insert/insert_drop.sim +./test.sh -f tsim/insert/insert_select.sim +./test.sh -f tsim/insert/null.sim +./test.sh -f tsim/insert/query_block1_file.sim +./test.sh -f tsim/insert/query_block1_memory.sim +./test.sh -f tsim/insert/query_block2_file.sim +./test.sh -f tsim/insert/query_block2_memory.sim +./test.sh -f tsim/insert/query_file_memory.sim +./test.sh -f tsim/insert/query_multi_file.sim +./test.sh -f tsim/insert/tcp.sim +./test.sh -f tsim/insert/update0.sim +./test.sh -f tsim/insert/update1_sort_merge.sim +./test.sh -f tsim/insert/update2.sim +./test.sh -f tsim/parser/alter__for_community_version.sim +./test.sh -f tsim/parser/alter_column.sim +./test.sh -f tsim/parser/alter_stable.sim +./test.sh -f tsim/parser/alter.sim +./test.sh -f tsim/parser/alter1.sim +./test.sh -f tsim/parser/auto_create_tb_drop_tb.sim +./test.sh -f tsim/parser/auto_create_tb.sim +./test.sh -f tsim/parser/between_and.sim +./test.sh -f tsim/parser/binary_escapeCharacter.sim +./test.sh -f tsim/parser/col_arithmetic_operation.sim +./test.sh -f tsim/parser/columnValue_bigint.sim +./test.sh -f tsim/parser/columnValue_bool.sim +./test.sh -f tsim/parser/columnValue_double.sim +./test.sh -f tsim/parser/columnValue_float.sim +./test.sh -f tsim/parser/columnValue_int.sim +./test.sh -f tsim/parser/columnValue_smallint.sim +./test.sh -f tsim/parser/columnValue_tinyint.sim +./test.sh -f tsim/parser/columnValue_unsign.sim +./test.sh -f tsim/parser/commit.sim +./test.sh -f tsim/parser/condition.sim +./test.sh -f tsim/parser/constCol.sim +./test.sh -f tsim/parser/create_db.sim +./test.sh -f tsim/parser/create_mt.sim +./test.sh -f tsim/parser/create_tb_with_tag_name.sim +./test.sh -f tsim/parser/create_tb.sim +./test.sh -f tsim/parser/dbtbnameValidate.sim +./test.sh -f tsim/parser/distinct.sim +./test.sh -f tsim/parser/fill_us.sim +./test.sh -f tsim/parser/fill.sim +./test.sh -f tsim/parser/first_last.sim +./test.sh -f tsim/parser/fill_stb.sim +./test.sh -f tsim/parser/interp.sim +./test.sh -f tsim/parser/fourArithmetic-basic.sim +./test.sh -f tsim/parser/function.sim +./test.sh -f tsim/parser/groupby-basic.sim +./test.sh -f tsim/parser/groupby.sim +./test.sh -f tsim/parser/having_child.sim +./test.sh -f tsim/parser/having.sim +./test.sh -f tsim/parser/import_commit1.sim +./test.sh -f tsim/parser/import_commit2.sim +./test.sh -f tsim/parser/import_commit3.sim +./test.sh -f tsim/parser/import_file.sim +./test.sh -f tsim/parser/import.sim +./test.sh -f tsim/parser/insert_multiTbl.sim +./test.sh -f tsim/parser/insert_tb.sim +./test.sh -f tsim/parser/join_manyblocks.sim +./test.sh -f tsim/parser/join_multitables.sim +./test.sh -f tsim/parser/join_multivnode.sim +./test.sh -f tsim/parser/join.sim +./test.sh -f tsim/parser/last_cache.sim +./test.sh -f tsim/parser/last_groupby.sim +./test.sh -f tsim/parser/lastrow.sim +./test.sh -f tsim/parser/lastrow2.sim +./test.sh -f tsim/parser/like.sim +./test.sh -f tsim/parser/limit.sim +./test.sh -f tsim/parser/limit1.sim +./test.sh -f tsim/parser/mixed_blocks.sim +./test.sh -f tsim/parser/nchar.sim +./test.sh -f tsim/parser/nestquery.sim +./test.sh -f tsim/parser/null_char.sim +./test.sh -f tsim/parser/precision_ns.sim +./test.sh -f tsim/parser/projection_limit_offset.sim +./test.sh -f tsim/parser/regex.sim +./test.sh -f tsim/parser/regressiontest.sim +./test.sh -f tsim/parser/select_across_vnodes.sim +./test.sh -f tsim/parser/select_distinct_tag.sim +./test.sh -f tsim/parser/select_from_cache_disk.sim +./test.sh -f tsim/parser/select_with_tags.sim +./test.sh -f tsim/parser/selectResNum.sim +./test.sh -f tsim/parser/set_tag_vals.sim +./test.sh -f tsim/parser/single_row_in_tb.sim +./test.sh -f tsim/parser/sliding.sim +./test.sh -f tsim/parser/slimit_alter_tags.sim +./test.sh -f tsim/parser/slimit.sim +./test.sh -f tsim/parser/slimit1.sim +./test.sh -f tsim/parser/stableOp.sim +./test.sh -f tsim/parser/tags_dynamically_specifiy.sim +./test.sh -f tsim/parser/tags_filter.sim +./test.sh -f tsim/parser/tbnameIn.sim +./test.sh -f tsim/parser/timestamp.sim +./test.sh -f tsim/parser/top_groupby.sim +./test.sh -f tsim/parser/topbot.sim +./test.sh -f tsim/parser/union.sim +./test.sh -f tsim/parser/union_sysinfo.sim +./test.sh -f tsim/parser/where.sim +./test.sh -f tsim/query/tagLikeFilter.sim +./test.sh -f tsim/query/charScalarFunction.sim +./test.sh -f tsim/query/explain.sim +./test.sh -f tsim/query/interval-offset.sim +./test.sh -f tsim/query/interval.sim +./test.sh -f tsim/query/scalarFunction.sim +./test.sh -f tsim/query/scalarNull.sim +./test.sh -f tsim/query/session.sim +./test.sh -f tsim/query/sys_tbname.sim +./test.sh -f tsim/query/groupby.sim +./test.sh -f tsim/query/event.sim +./test.sh -f tsim/query/forceFill.sim +./test.sh -f tsim/query/emptyTsRange.sim +./test.sh -f tsim/query/partitionby.sim +./test.sh -f tsim/qnode/basic1.sim +./test.sh -f tsim/snode/basic1.sim +./test.sh -f tsim/mnode/basic1.sim +./test.sh -f tsim/mnode/basic2.sim +./test.sh -f tsim/mnode/basic3.sim +./test.sh -f tsim/mnode/basic4.sim +./test.sh -f tsim/mnode/basic5.sim +./test.sh -f tsim/show/basic.sim +./test.sh -f tsim/table/autocreate.sim +./test.sh -f tsim/table/basic1.sim +./test.sh -f tsim/table/basic2.sim +./test.sh -f tsim/table/basic3.sim +./test.sh -f tsim/table/bigint.sim +./test.sh -f tsim/table/binary.sim +./test.sh -f tsim/table/bool.sim +./test.sh -f tsim/table/column_name.sim +./test.sh -f tsim/table/column_num.sim +./test.sh -f tsim/table/column_value.sim +./test.sh -f tsim/table/column2.sim +./test.sh -f tsim/table/createmulti.sim +./test.sh -f tsim/table/date.sim +./test.sh -f tsim/table/db.table.sim +./test.sh -f tsim/table/delete_reuse1.sim +./test.sh -f tsim/table/delete_reuse2.sim +./test.sh -f tsim/table/delete_writing.sim +./test.sh -f tsim/table/describe.sim +./test.sh -f tsim/table/double.sim +./test.sh -f tsim/table/float.sim +./test.sh -f tsim/table/hash.sim +./test.sh -f tsim/table/int.sim +./test.sh -f tsim/table/limit.sim +./test.sh -f tsim/table/smallint.sim +./test.sh -f tsim/table/table_len.sim +./test.sh -f tsim/table/table.sim +./test.sh -f tsim/table/tinyint.sim +./test.sh -f tsim/table/vgroup.sim +./test.sh -f tsim/stream/basic0.sim -g +./test.sh -f tsim/stream/basic1.sim +./test.sh -f tsim/stream/basic2.sim +./test.sh -f tsim/stream/drop_stream.sim +./test.sh -f tsim/stream/fillHistoryBasic1.sim +./test.sh -f tsim/stream/fillHistoryBasic2.sim +./test.sh -f tsim/stream/fillHistoryBasic3.sim +./test.sh -f tsim/stream/distributeInterval0.sim +./test.sh -f tsim/stream/distributeIntervalRetrive0.sim +./test.sh -f tsim/stream/distributeSession0.sim +./test.sh -f tsim/stream/session0.sim +./test.sh -f tsim/stream/session1.sim +./test.sh -f tsim/stream/state0.sim +./test.sh -f tsim/stream/triggerInterval0.sim +./test.sh -f tsim/stream/triggerSession0.sim +./test.sh -f tsim/stream/partitionby.sim +./test.sh -f tsim/stream/partitionby1.sim +./test.sh -f tsim/stream/schedSnode.sim +./test.sh -f tsim/stream/windowClose.sim +./test.sh -f tsim/stream/ignoreExpiredData.sim +./test.sh -f tsim/stream/sliding.sim +./test.sh -f tsim/stream/partitionbyColumnInterval.sim +./test.sh -f tsim/stream/partitionbyColumnSession.sim +./test.sh -f tsim/stream/partitionbyColumnState.sim +./test.sh -f tsim/stream/deleteInterval.sim +./test.sh -f tsim/stream/deleteSession.sim +./test.sh -f tsim/stream/deleteState.sim +./test.sh -f tsim/stream/fillIntervalDelete0.sim +./test.sh -f tsim/stream/fillIntervalDelete1.sim +./test.sh -f tsim/stream/fillIntervalLinear.sim +./test.sh -f tsim/stream/fillIntervalPartitionBy.sim +./test.sh -f tsim/stream/fillIntervalPrevNext.sim +./test.sh -f tsim/stream/fillIntervalValue.sim +./test.sh -f tsim/stream/udTableAndTag0.sim +./test.sh -f tsim/stream/udTableAndTag1.sim +./test.sh -f tsim/trans/lossdata1.sim +./test.sh -f tsim/trans/create_db.sim +./test.sh -f tsim/tmq/basic1.sim +./test.sh -f tsim/tmq/basic2.sim +./test.sh -f tsim/tmq/basic3.sim +./test.sh -f tsim/tmq/basic4.sim +./test.sh -f tsim/tmq/basic1Of2Cons.sim +./test.sh -f tsim/tmq/basic2Of2Cons.sim +./test.sh -f tsim/tmq/basic3Of2Cons.sim +./test.sh -f tsim/tmq/basic4Of2Cons.sim +./test.sh -f tsim/tmq/basic2Of2ConsOverlap.sim +./test.sh -f tsim/tmq/topic.sim +./test.sh -f tsim/tmq/snapshot.sim +./test.sh -f tsim/tmq/snapshot1.sim +./test.sh -f tsim/stable/alter_comment.sim +./test.sh -f tsim/stable/alter_count.sim +./test.sh -f tsim/stable/alter_import.sim +./test.sh -f tsim/stable/alter_insert1.sim +./test.sh -f tsim/stable/alter_insert2.sim +./test.sh -f tsim/stable/alter_metrics.sim +./test.sh -f tsim/stable/column_add.sim +./test.sh -f tsim/stable/column_drop.sim +./test.sh -f tsim/stable/column_modify.sim +./test.sh -f tsim/stable/disk.sim +./test.sh -f tsim/stable/dnode3.sim +./test.sh -f tsim/stable/metrics.sim +./test.sh -f tsim/stable/refcount.sim +./test.sh -f tsim/stable/tag_add.sim +./test.sh -f tsim/stable/tag_drop.sim +./test.sh -f tsim/stable/tag_filter.sim +./test.sh -f tsim/stable/tag_modify.sim +./test.sh -f tsim/stable/tag_rename.sim +./test.sh -f tsim/stable/values.sim +./test.sh -f tsim/stable/vnode3.sim +./test.sh -f tsim/stable/metrics_idx.sim +./test.sh -f tsim/sma/drop_sma.sim +./test.sh -f tsim/sma/sma_leak.sim +./test.sh -f tsim/sma/tsmaCreateInsertQuery.sim +./test.sh -f tsim/sma/rsmaCreateInsertQuery.sim +./test.sh -f tsim/sma/rsmaPersistenceRecovery.sim +./test.sh -f tsim/valgrind/checkError1.sim +./test.sh -f tsim/valgrind/checkError2.sim +./test.sh -f tsim/valgrind/checkError3.sim +./test.sh -f tsim/valgrind/checkError4.sim +./test.sh -f tsim/valgrind/checkError5.sim +./test.sh -f tsim/valgrind/checkError6.sim +./test.sh -f tsim/valgrind/checkError7.sim +./test.sh -f tsim/valgrind/checkError8.sim +./test.sh -f tsim/vnode/replica3_basic.sim +./test.sh -f tsim/vnode/replica3_repeat.sim +./test.sh -f tsim/vnode/replica3_vgroup.sim +./test.sh -f tsim/vnode/replica3_many.sim +./test.sh -f tsim/vnode/replica3_import.sim +./test.sh -f tsim/vnode/stable_balance_replica1.sim +./test.sh -f tsim/vnode/stable_dnode2_stop.sim +./test.sh -f tsim/vnode/stable_dnode2.sim +./test.sh -f tsim/vnode/stable_dnode3.sim +./test.sh -f tsim/vnode/stable_replica3_dnode6.sim +./test.sh -f tsim/vnode/stable_replica3_vnode3.sim +./test.sh -f tsim/sync/3Replica1VgElect.sim +./test.sh -f tsim/sync/3Replica5VgElect.sim +./test.sh -f tsim/sync/oneReplica1VgElect.sim +./test.sh -f tsim/sync/oneReplica5VgElect.sim +./test.sh -f tsim/catalog/alterInCurrent.sim +./test.sh -f tsim/scalar/in.sim +./test.sh -f tsim/scalar/scalar.sim +./test.sh -f tsim/scalar/filter.sim +./test.sh -f tsim/scalar/caseWhen.sim +./test.sh -f tsim/scalar/tsConvert.sim +./test.sh -f tsim/alter/cached_schema_after_alter.sim +./test.sh -f tsim/alter/dnode.sim +./test.sh -f tsim/alter/table.sim +./test.sh -f tsim/cache/new_metrics.sim +./test.sh -f tsim/cache/restart_table.sim +./test.sh -f tsim/cache/restart_metrics.sim +./test.sh -f tsim/column/commit.sim +./test.sh -f tsim/column/metrics.sim +./test.sh -f tsim/column/table.sim +./test.sh -f tsim/compress/commitlog.sim +./test.sh -f tsim/compress/compress2.sim +./test.sh -f tsim/compress/compress.sim +./test.sh -f tsim/compress/uncompress.sim +./test.sh -f tsim/compute/avg.sim +./test.sh -f tsim/compute/block_dist.sim +./test.sh -f tsim/compute/bottom.sim +./test.sh -f tsim/compute/count.sim +./test.sh -f tsim/compute/diff.sim +./test.sh -f tsim/compute/diff2.sim +./test.sh -f tsim/compute/first.sim +./test.sh -f tsim/compute/interval.sim +./test.sh -f tsim/compute/last_row.sim +./test.sh -f tsim/compute/last.sim +./test.sh -f tsim/compute/leastsquare.sim +./test.sh -f tsim/compute/max.sim +./test.sh -f tsim/compute/min.sim +./test.sh -f tsim/compute/null.sim +./test.sh -f tsim/compute/percentile.sim +./test.sh -f tsim/compute/stddev.sim +./test.sh -f tsim/compute/sum.sim +./test.sh -f tsim/compute/top.sim +./test.sh -f tsim/field/2.sim +./test.sh -f tsim/field/3.sim +./test.sh -f tsim/field/4.sim +./test.sh -f tsim/field/5.sim +./test.sh -f tsim/field/6.sim +./test.sh -f tsim/field/binary.sim +./test.sh -f tsim/field/bigint.sim +./test.sh -f tsim/field/bool.sim +./test.sh -f tsim/field/double.sim +./test.sh -f tsim/field/float.sim +./test.sh -f tsim/field/int.sim +./test.sh -f tsim/field/single.sim +./test.sh -f tsim/field/smallint.sim +./test.sh -f tsim/field/tinyint.sim +./test.sh -f tsim/field/unsigined_bigint.sim +./test.sh -f tsim/vector/metrics_field.sim +./test.sh -f tsim/vector/metrics_mix.sim +./test.sh -f tsim/vector/metrics_query.sim +./test.sh -f tsim/vector/metrics_tag.sim +./test.sh -f tsim/vector/metrics_time.sim +./test.sh -f tsim/vector/multi.sim +./test.sh -f tsim/vector/single.sim +./test.sh -f tsim/vector/table_field.sim +./test.sh -f tsim/vector/table_mix.sim +./test.sh -f tsim/vector/table_query.sim +./test.sh -f tsim/vector/table_time.sim +./test.sh -f tsim/wal/kill.sim +./test.sh -f tsim/tag/3.sim +./test.sh -f tsim/tag/4.sim +./test.sh -f tsim/tag/5.sim +./test.sh -f tsim/tag/6.sim +./test.sh -f tsim/tag/add.sim +./test.sh -f tsim/tag/bigint.sim +./test.sh -f tsim/tag/binary_binary.sim +./test.sh -f tsim/tag/binary.sim +./test.sh -f tsim/tag/bool_binary.sim +./test.sh -f tsim/tag/bool_int.sim +./test.sh -f tsim/tag/bool.sim +./test.sh -f tsim/tag/change.sim +./test.sh -f tsim/tag/column.sim +./test.sh -f tsim/tag/commit.sim +./test.sh -f tsim/tag/create.sim +./test.sh -f tsim/tag/delete.sim +./test.sh -f tsim/tag/double.sim +./test.sh -f tsim/tag/filter.sim +./test.sh -f tsim/tag/float.sim +./test.sh -f tsim/tag/int_binary.sim +./test.sh -f tsim/tag/int_float.sim +./test.sh -f tsim/tag/int.sim +./test.sh -f tsim/tag/set.sim +./test.sh -f tsim/tag/smallint.sim +./test.sh -f tsim/tag/tinyint.sim +./test.sh -f tsim/tag/drop_tag.sim +./test.sh -f tsim/tag/tbNameIn.sim +./test.sh -f tmp/monitor.sim diff --git a/tests/script/wtest.bat b/tests/script/wtest.bat index f674277df9455d0abac76bc4f214b9c53a62ce91..b642bad285864fd2fd423d0e28c739bc4680bcd0 100644 --- a/tests/script/wtest.bat +++ b/tests/script/wtest.bat @@ -33,7 +33,7 @@ if exist %LOG_DIR% rmdir /s/q %LOG_DIR% if not exist %CFG_DIR% mkdir %CFG_DIR% if not exist %LOG_DIR% mkdir %LOG_DIR% -rem set "fqdn=" +set "fqdn=localhost" for /f "skip=1" %%A in ( 'wmic computersystem get caption' ) do if not defined fqdn set "fqdn=%%A" diff --git a/tests/system-test/0-others/compatibility.py b/tests/system-test/0-others/compatibility.py index a5cded7a6b65cf9fb72374389175274bb7ae7687..d7dd4e20c02e61a4bc1c9ef5bf2ea4327650dcf8 100644 --- a/tests/system-test/0-others/compatibility.py +++ b/tests/system-test/0-others/compatibility.py @@ -3,6 +3,9 @@ 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 * @@ -99,10 +102,14 @@ class TDTestCase: 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" @@ -128,19 +135,18 @@ class TDTestCase: tdLog.printNoPrefix(f"==========step1:prepare and check data in old version-{BASEVERSION}") 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 ") - sleep(3) - - # tdsqlF.query(f"select count(*) from {stb}") - # tdsqlF.checkData(0,0,tableNumbers*recordNumbers1) - os.system("pkill taosd") - self.checkProcessPid("taosd") + 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;" ') + os.system('LD_LIBRARY_PATH=/usr/lib taos -s "use test;show streams;" ') + os.system(f"sed -i 's/\/etc\/taos/{cPath}/' 0-others/tmqBasic.json ") + # os.system("LD_LIBRARY_PATH=/usr/lib taosBenchmark -f 0-others/tmqBasic.json -y ") + os.system('LD_LIBRARY_PATH=/usr/lib taos -s "create topic if not exists tmq_test_topic as select current,voltage,phase from test.meters where voltage <= 106 and current <= 5;" ') + os.system('LD_LIBRARY_PATH=/usr/lib taos -s "use test;show topics;" ') - print(f"start taosd: nohup taosd -c {cPath} & ") - os.system(f" nohup taosd -c {cPath} & " ) - sleep(10) tdLog.info(" LD_LIBRARY_PATH=/usr/lib taosBenchmark -f 0-others/compa4096.json -y ") os.system("LD_LIBRARY_PATH=/usr/lib taosBenchmark -f 0-others/compa4096.json -y") - os.system("pkill taosd") # make sure all the data are saved in disk. + os.system("LD_LIBRARY_PATH=/usr/lib taos -s 'flush database db4096 '") + os.system("pkill taosd") # make sure all the data are saved in disk. self.checkProcessPid("taosd") @@ -161,10 +167,12 @@ class TDTestCase: 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) - os.system(f"taosBenchmark -t {tableNumbers} -n {recordNumbers2} -y ") - tdsql.query(f"select count(*) from {stb}") - tdsql.checkData(0,0,tableNumbers*recordNumbers2) + 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) tdsql.query(f"select count(*) from db4096.stb0") tdsql.checkData(0,0,50000) @@ -183,13 +191,58 @@ class TDTestCase: 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) + print(1) + tdsql=tdCom.newTdSql() tdsql.query("describe information_schema.ins_databases;") qRows=tdsql.queryRows - for i in range(qRows) : - if tdsql.queryResult[i][0]=="retentions" : - return True - else: - return False + 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) + tdsql.query("show streams;") + tdsql.checkRows(2) + 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);") + + 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") diff --git a/tests/system-test/0-others/show.py b/tests/system-test/0-others/show.py index b5d6a0d1a34e570c2ffe0f61d67538f2ec881dfd..3e176fe25162b2053f5d86d83b97bc61e6a354d8 100644 --- a/tests/system-test/0-others/show.py +++ b/tests/system-test/0-others/show.py @@ -11,14 +11,13 @@ # -*- coding: utf-8 -*- - +import re from util.log import * from util.cases import * from util.sql import * from util.common import * from util.sqlset import * - class TDTestCase: def init(self, conn, logSql, replicaVar=1): self.replicaVar = int(replicaVar) @@ -28,10 +27,35 @@ class TDTestCase: self.ins_param_list = ['dnodes','mnodes','qnodes','cluster','functions','users','grants','topics','subscriptions','streams'] self.perf_param = ['apps','connections','consumers','queries','transactions'] self.perf_param_list = ['apps','connections','consumers','queries','trans'] - + self.dbname = "db" + self.vgroups = 10 + self.stbname = f'`{tdCom.getLongName(5)}`' + self.tbname = f'`{tdCom.getLongName(3)}`' + self.db_param = { + "database":f"{self.dbname}", + "buffer":100, + "cachemodel":"'none'", + "cachesize":1, + "comp":2, + "maxrows":1000, + "minrows":200, + "pages":512, + "pagesize":16, + "precision":"'ms'", + "replica":1, + "wal_level":1, + "wal_fsync_period":6000, + "wal_roll_period":0, + "wal_segment_size":1024, + "vgroups":self.vgroups, + "stt_trigger":1, + "tsdb_pagesize":16 + } def ins_check(self): tdSql.prepare() for param in self.ins_param_list: + if param.lower() == 'qnodes': + tdSql.execute('create qnode on dnode 1') tdSql.query(f'show {param}') show_result = tdSql.queryResult tdSql.query(f'select * from information_schema.ins_{param}') @@ -59,11 +83,32 @@ class TDTestCase: tag_sql += f"{k} {v}, " create_stb_sql = f'create stable {stbname} ({column_sql[:-2]}) tags ({tag_sql[:-2]})' return create_stb_sql - def show_sql(self): - tdSql.prepare() - tdSql.execute('use db') - stbname = f'`{tdCom.getLongName(5)}`' - tbname = f'`{tdCom.getLongName(3)}`' + + def set_create_database_sql(self,sql_dict): + create_sql = 'create' + for key,value in sql_dict.items(): + create_sql += f' {key} {value}' + return create_sql + def show_create_sql(self): + create_db_sql = self.set_create_database_sql(self.db_param) + print(create_db_sql) + tdSql.execute(create_db_sql) + tdSql.query(f'show create database {self.dbname}') + tdSql.checkEqual(self.dbname,tdSql.queryResult[0][0]) + for key,value in self.db_param.items(): + if key == 'database': + continue + else: + param = f'{key} {value}' + if param in tdSql.queryResult[0][1].lower(): + tdLog.info(f'show create database check success with {key} {value}') + continue + else: + tdLog.exit(f"show create database check failed with {key} {value}") + tdSql.query('show vnodes 1') + tdSql.checkRows(self.vgroups) + tdSql.execute(f'use {self.dbname}') + column_dict = { '`ts`': 'timestamp', '`col1`': 'tinyint', @@ -98,25 +143,56 @@ class TDTestCase: '`t14`': 'timestamp' } - create_table_sql = self.set_stb_sql(stbname,column_dict,tag_dict) + create_table_sql = self.set_stb_sql(self.stbname,column_dict,tag_dict) tdSql.execute(create_table_sql) - tdSql.query(f'show create table {stbname}') + tdSql.query(f'show create stable {self.stbname}') query_result = tdSql.queryResult tdSql.checkEqual(query_result[0][1].lower(),create_table_sql) - tdSql.execute(f'create table {tbname} using {stbname} tags(1,1,1,1,1,1,1,1,1.000000e+00,1.000000e+00,true,"abc","abc123",0)') + tdSql.execute(f'create table {self.tbname} using {self.stbname} tags(1,1,1,1,1,1,1,1,1.000000e+00,1.000000e+00,true,"abc","abc123",0)') tag_sql = '(' for tag_keys in tag_dict.keys(): tag_sql += f'{tag_keys}, ' tags = f'{tag_sql[:-2]})' - sql = f'create table {tbname} using {stbname} {tags} tags (1, 1, 1, 1, 1, 1, 1, 1, 1.000000e+00, 1.000000e+00, true, "abc", "abc123", 0)' - tdSql.query(f'show create table {tbname}') + sql = f'create table {self.tbname} using {self.stbname} {tags} tags (1, 1, 1, 1, 1, 1, 1, 1, 1.000000e+00, 1.000000e+00, true, "abc", "abc123", 0)' + tdSql.query(f'show create table {self.tbname}') query_result = tdSql.queryResult tdSql.checkEqual(query_result[0][1].lower(),sql) - tdSql.execute('drop database db') + tdSql.execute(f'drop database {self.dbname}') + def check_gitinfo(self): + taosd_gitinfo_sql = '' + tdSql.query('show dnode 1 variables') + for i in tdSql.queryResult: + if i[1].lower() == "gitinfo": + taosd_gitinfo_sql = f"gitinfo: {i[2]}" + taos_gitinfo_sql = '' + tdSql.query('show local variables') + for i in tdSql.queryResult: + if i[0].lower() == "gitinfo": + taos_gitinfo_sql = f"gitinfo: {i[1]}" + taos_info = os.popen('taos -V').read() + taos_gitinfo = re.findall("^gitinfo.*",taos_info,re.M) + tdSql.checkEqual(taos_gitinfo_sql,taos_gitinfo[0]) + taosd_info = os.popen('taosd -V').read() + taosd_gitinfo = re.findall("^gitinfo.*",taosd_info,re.M) + tdSql.checkEqual(taosd_gitinfo_sql,taosd_gitinfo[0]) + + def show_base(self): + for sql in ['dnodes','mnodes','cluster']: + tdSql.query(f'show {sql}') + print(tdSql.queryResult) + tdSql.checkRows(1) + tdSql.query('show grants') + grants_info = tdSql.queryResult + tdSql.query('show licences') + licences_info = tdSql.queryResult + tdSql.checkEqual(grants_info,licences_info) + def run(self): + self.check_gitinfo() + self.show_base() self.ins_check() self.perf_check() - self.show_sql() + self.show_create_sql() def stop(self): tdSql.close() @@ -124,4 +200,3 @@ class TDTestCase: tdCases.addWindows(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase()) - diff --git a/tests/system-test/0-others/sysinfo.py b/tests/system-test/0-others/sysinfo.py index 9ffa6ca9e60e104cebb51fc1a94eacd7aa494773..43a0400f1880ded44bbbaadfa1a3467a8c3d9775 100644 --- a/tests/system-test/0-others/sysinfo.py +++ b/tests/system-test/0-others/sysinfo.py @@ -49,8 +49,6 @@ class TDTestCase: #!for bug tdDnodes.stoptaosd(1) sleep(self.delaytime * 5) - if platform.system().lower() == 'windows': - sleep(10) tdSql.error('select server_status()') def run(self): diff --git a/tests/system-test/0-others/taosdShell.py b/tests/system-test/0-others/taosdShell.py index 2125b5eebe448b4ac044158f7157cd689eaec29e..ce049b851527d5b99e17390083e141c87b8633a9 100644 --- a/tests/system-test/0-others/taosdShell.py +++ b/tests/system-test/0-others/taosdShell.py @@ -4,6 +4,7 @@ import sys import time from datetime import datetime import socket +import psutil import os import platform if platform.system().lower() == 'windows': @@ -67,19 +68,25 @@ class TDTestCase: return buildPath def get_process_pid(self,processname): - #origin artical link:https://blog.csdn.net/weixin_45623536/article/details/122099062 - process_info_list = [] - process = os.popen('ps -A | grep %s'% processname) - process_info = process.read() - for i in process_info.split(' '): - if i != "": - process_info_list.append(i) - print(process_info_list) - if len(process_info_list) != 0 : - pid = int(process_info_list[0]) - else : - pid = 0 - return pid + if platform.system().lower() == 'windows': + pids = psutil.process_iter() + for pid in pids: + if(pid.name() == processname): + return pid.pid + return 0 + else: + process_info_list = [] + process = os.popen('ps -A | grep %s'% processname) + process_info = process.read() + for i in process_info.split(' '): + if i != "": + process_info_list.append(i) + print(process_info_list) + if len(process_info_list) != 0 : + pid = int(process_info_list[0]) + else : + pid = 0 + return pid def checkAndstopPro(self,processName,startAction): i = 1 @@ -88,23 +95,29 @@ class TDTestCase: taosdPid=self.get_process_pid(processName) if taosdPid != 0 and taosdPid != "" : tdLog.info("stop taosd %s ,kill pid :%s "%(startAction,taosdPid)) - os.system("kill -9 %d"%taosdPid) + os.system("kill -9 %d"%taosdPid) break else: tdLog.info( "wait start taosd ,times: %d "%i) time.sleep(1) i+= 1 else : - tdLog.exit("taosd %s is not running "%startAction) + tdLog.exit("taosd %s is not running "%startAction) def taosdCommandStop(self,startAction,taosdCmdRun): processName="taosd" + if platform.system().lower() == 'windows': + processName="taosd.exe" taosdCmd = taosdCmdRun + startAction tdLog.printNoPrefix("%s"%taosdCmd) - logTime=datetime.now().strftime('%Y%m%d_%H%M%S_%f') - os.system(f"nohup {taosdCmd} > {logTime}.log 2>&1 & ") - self.checkAndstopPro(processName,startAction) - os.system(f"rm -rf {logTime}.log") + if platform.system().lower() == 'windows': + cmd = f"mintty -h never {taosdCmd}" + os.system(cmd) + else: + logTime=datetime.now().strftime('%Y%m%d_%H%M%S_%f') + os.system(f"nohup {taosdCmd} > {logTime}.log 2>&1 & ") + self.checkAndstopPro(processName,startAction) + os.system(f"rm -rf {logTime}.log") def taosdCommandExe(self,startAction,taosdCmdRun): @@ -139,7 +152,7 @@ class TDTestCase: tdSql.query("create stream s1 into source_db.output_stb as select _wstart AS startts, min(k), max(k), sum(k) from source_db.stb interval(10m);") - #TD-19944 -Q=3 + #TD-19944 -Q=3 tdsqlN=tdCom.newTdSql() tdsqlN.query("select * from source_db.stb") @@ -186,7 +199,11 @@ class TDTestCase: startAction=" -a jsonFile:./taosdCaseTmp.json" tdLog.printNoPrefix("================================ parameter: %s"%startAction) - os.system("echo \'{\"queryPolicy\":\"3\"}\' > taosdCaseTmp.json") + + if platform.system().lower() == 'windows': + os.system("echo {\"queryPolicy\":\"3\"} > taosdCaseTmp.json") + else: + os.system("echo \'{\"queryPolicy\":\"3\"}\' > taosdCaseTmp.json") self.taosdCommandStop(startAction,taosdCmdRun) startAction = " -a jsonFile:./taosdCaseTmp.json -C " @@ -206,12 +223,12 @@ class TDTestCase: self.taosdCommandStop(startAction,taosdCmdRun) - startAction=" -E taosdCaseTmp/.env" + startAction=f" -E taosdCaseTmp{os.sep}.env" tdLog.printNoPrefix("================================ parameter: %s"%startAction) - os.system(" mkdir -p taosdCaseTmp ") - os.system("echo \'TAOS_QUERY_POLICY=3\' > taosdCaseTmp/.env ") + os.system(" mkdir -p taosdCaseTmp ") + os.system("echo TAOS_QUERY_POLICY=3 > taosdCaseTmp/.env ") self.taosdCommandStop(startAction,taosdCmdRun) - os.system(" rm -rf taosdCaseTmp ") + os.system(" rm -rf taosdCaseTmp ") startAction = " -V" tdLog.printNoPrefix("================================ parameter: %s"%startAction) diff --git a/tests/system-test/0-others/testRoll.py b/tests/system-test/0-others/testRoll.py new file mode 100644 index 0000000000000000000000000000000000000000..56e5b3630afe9c875be74dcbbdce52d024c9a22e --- /dev/null +++ b/tests/system-test/0-others/testRoll.py @@ -0,0 +1,83 @@ +from taos.tmq import Consumer +import taos +import taosrest +import socket + + +def init_tmq_env(db, topic): + conn = taos.connect() + # conn.execute("create dnode test209") + # conn.execute("create dnode test216") + # conn.execute("create mnode on dnode 2") + # conn.execute("create mnode on dnode 3") + + conn.execute("drop topic if exists {}".format(topic)) + conn.execute("drop database if exists {}".format(db)) + conn.execute("create database if not exists {} replica 1 ".format(db)) + conn.select_db(db) + conn.execute( + "create stable if not exists stb1 (ts timestamp, c1 int, c2 float, c3 varchar(16)) tags(t1 int, t3 varchar(16))") + conn.execute("create table if not exists tb1 using stb1 tags(1, 't1')") + conn.execute("create table if not exists tb2 using stb1 tags(2, 't2')") + conn.execute("create table if not exists tb3 using stb1 tags(3, 't3')") + conn.execute("create topic if not exists {} as select ts, c1, c2, c3 from stb1".format(topic)) + conn.execute("insert into tb1 values (now+10s, 1, 1.0, 'tmq test')") + conn.execute("insert into tb2 values (now+100s, 2, 2.0, 'tmq test')") + conn.execute("insert into tb3 values (now+20s, 3, 3.0, 'tmq test')") + conn.execute("insert into tb3 values (now+30s, 4, 4.0, 'tmq test4')") + +def init_tmq_rest_env(db, topic): + host = socket.gethostname() + conn = taosrest.connect(url=f"http://{host}:6041") + + # conn.execute("create dnode test209") + # conn.execute("create dnode test216") + # conn.execute("create mnode on dnode 2") + # conn.execute("create mnode on dnode 3") + + conn.execute("drop topic if exists {}".format(topic)) + conn.execute("drop database if exists {}".format(db)) + conn.execute("create database if not exists {} replica 3 ".format(db)) + conn.select_db(db) + conn.execute( + "create stable if not exists stb1 (ts timestamp, c1 int, c2 float, c3 varchar(16)) tags(t1 int, t3 varchar(16))") + conn.execute("create table if not exists tb1 using stb1 tags(1, 't1')") + conn.execute("create table if not exists tb2 using stb1 tags(2, 't2')") + conn.execute("create table if not exists tb3 using stb1 tags(3, 't3')") + conn.execute("create topic if not exists {} as select ts, c1, c2, c3 from stb1".format(topic)) + conn.execute("insert into tb1 values (now+10s, 1, 1.0, 'tmq test')") + conn.execute("insert into tb2 values (now+100s, 2, 2.0, 'tmq test')") + conn.execute("insert into tb3 values (now+20s, 3, 3.0, 'tmq test')") + conn.execute("insert into tb3 values (now+30s, 4, 4.0, 'tmq test4')") + + + + +if __name__ == '__main__': + conn = taos.connect() + + init_tmq_env("tmq_test", "tmq_test_topic") # init env + # init_tmq_rest_env("tmq_test", "tmq_test_topic") + 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()) \ No newline at end of file diff --git a/tests/system-test/0-others/tmqBasic.json b/tests/system-test/0-others/tmqBasic.json new file mode 100644 index 0000000000000000000000000000000000000000..24e815708aeefcb18452cfd20670aba2e185e589 --- /dev/null +++ b/tests/system-test/0-others/tmqBasic.json @@ -0,0 +1,24 @@ +{ + "filetype": "subscribe", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "confirm_parameter_prompt": "no", + "tmq_info": { + "concurrent": 1, + "poll_delay": 10000, + "group.id": "grpId_0", + "client.id": "clientId", + "auto.offset.reset": "earliest", + "enable.auto.commit": "true", + "auto.commit.interval.ms": 1000, + "enable.heartbeat.background": "true", + "experimental.snapshot.enable": "true", + "msg.with.table.name": "false", + "topic_list": [ + {"name": "tmq_topic_1", "sql": "select current,voltage,phase from test.meters where voltage <= 106 ;"} + ] + } +} \ No newline at end of file diff --git a/tests/system-test/1-insert/database_pre_suf.py b/tests/system-test/1-insert/database_pre_suf.py index 488dfebff50c77d1dd08c6d4e46fdbf3bbe3ea7f..a6ff95ab3ffbea78350e6f7abccbcc8c53c572aa 100755 --- a/tests/system-test/1-insert/database_pre_suf.py +++ b/tests/system-test/1-insert/database_pre_suf.py @@ -108,7 +108,7 @@ class TDTestCase: # create stream - tdSql.execute('''create stream current_stream into stream_max_stable_1 as select _wstart as startts, _wend as wend, max(q_int) as max_int, min(q_bigint) as min_int from stable_1 where ts is not null interval (5s);''') + tdSql.execute('''create stream current_stream trigger at_once IGNORE EXPIRED 0 into stream_max_stable_1 as select _wstart as startts, _wend as wend, max(q_int) as max_int, min(q_bigint) as min_int from stable_1 where ts is not null interval (5s);''') # insert data for i in range(num_random*n): diff --git a/tests/system-test/1-insert/drop.py b/tests/system-test/1-insert/drop.py index c15a9bbc35bc28a8679b3400ff37569e6d7955aa..a8bfea27415a2b89d230e14d95d2c8a2871ade29 100644 --- a/tests/system-test/1-insert/drop.py +++ b/tests/system-test/1-insert/drop.py @@ -138,14 +138,14 @@ class TDTestCase: stream_name = tdCom.getLongName(5,"letters") tdSql.execute(f'create table {stbname} (ts timestamp,c0 int) tags(t0 int)') tdSql.execute(f'create table tb using {stbname} tags(1)') - tdSql.execute(f'create stream {stream_name} into stb as select * from {self.dbname}.{stbname} partition by tbname') + tdSql.execute(f'create stream {stream_name} trigger at_once ignore expired 0 into stb as select * from {self.dbname}.{stbname} partition by tbname') tdSql.query(f'select * from information_schema.ins_streams where stream_name = "{stream_name}"') print(tdSql.queryResult) - tdSql.checkEqual(tdSql.queryResult[0][2],f'create stream {stream_name} into stb as select * from {self.dbname}.{stbname} partition by tbname') + tdSql.checkEqual(tdSql.queryResult[0][2],f'create stream {stream_name} trigger at_once ignore expired 0 into stb as select * from {self.dbname}.{stbname} partition by tbname') tdSql.execute(f'drop stream {stream_name}') - tdSql.execute(f'create stream {stream_name} into stb1 as select * from tb') + tdSql.execute(f'create stream {stream_name} trigger at_once ignore expired 0 into stb1 as select * from tb') tdSql.query(f'select * from information_schema.ins_streams where stream_name = "{stream_name}"') - tdSql.checkEqual(tdSql.queryResult[0][2],f'create stream {stream_name} into stb1 as select * from tb') + tdSql.checkEqual(tdSql.queryResult[0][2],f'create stream {stream_name} trigger at_once ignore expired 0 into stb1 as select * from tb') tdSql.execute(f'drop database {self.dbname}') def run(self): self.drop_ntb_check() diff --git a/tests/system-test/1-insert/mutil_stage.py b/tests/system-test/1-insert/mutil_stage.py index 8780ecc477f6c6a9ec1076967aa27da63eb09f97..970554c6c17f8b50eb9261dfe1da2f307740cbd0 100644 --- a/tests/system-test/1-insert/mutil_stage.py +++ b/tests/system-test/1-insert/mutil_stage.py @@ -75,7 +75,7 @@ class TDTestCase: tdLog.exit(cmd) def cfg_str(self, filename, update_str): - cmd = f'echo "{update_str}" >> {filename}' + cmd = f'echo {update_str} >> {filename}' if os.system(cmd) != 0: tdLog.exit(cmd) @@ -94,41 +94,41 @@ class TDTestCase: def __err_cfg(self): cfg_list = [] err_case1 = [ - f"dataDir {self.taos_data_dir}/{DATA_PRE0}0 {L0} {NON_PRIMARY_DIR}", - f"dataDir {self.taos_data_dir}/{DATA_PRE1}1 {L1} {PRIMARY_DIR}", - f"dataDir {self.taos_data_dir}/{DATA_PRE2}2 {L2} {NON_PRIMARY_DIR}" + f"dataDir {self.taos_data_dir}{os.sep}{DATA_PRE0}0 {L0} {NON_PRIMARY_DIR}", + f"dataDir {self.taos_data_dir}{os.sep}{DATA_PRE1}1 {L1} {PRIMARY_DIR}", + f"dataDir {self.taos_data_dir}{os.sep}{DATA_PRE2}2 {L2} {NON_PRIMARY_DIR}" ] err_case2 = [ - f"dataDir {self.taos_data_dir}/{DATA_PRE0}0 {L0} {NON_PRIMARY_DIR}", - f"dataDir {self.taos_data_dir}/{DATA_PRE1}1 {L1} {NON_PRIMARY_DIR}", - f"dataDir {self.taos_data_dir}/{DATA_PRE2}2 {L2} {PRIMARY_DIR}" + f"dataDir {self.taos_data_dir}{os.sep}{DATA_PRE0}0 {L0} {NON_PRIMARY_DIR}", + f"dataDir {self.taos_data_dir}{os.sep}{DATA_PRE1}1 {L1} {NON_PRIMARY_DIR}", + f"dataDir {self.taos_data_dir}{os.sep}{DATA_PRE2}2 {L2} {PRIMARY_DIR}" ] err_case3 = [ - f"dataDir {self.taos_data_dir}/data33 3 {NON_PRIMARY_DIR}" + f"dataDir {self.taos_data_dir}{os.sep}data33 3 {NON_PRIMARY_DIR}" ] err_case4 = [ - f"dataDir {self.taos_data_dir}/{DATA_PRE0}0 {L0} {NON_PRIMARY_DIR}", - f"dataDir {self.taos_data_dir}/{DATA_PRE1}1 {L1} {NON_PRIMARY_DIR}", - f"dataDir {self.taos_data_dir}/{DATA_PRE2}2 {L2} {NON_PRIMARY_DIR}", - f"dataDir {self.taos_data_dir}/{DATA_PRE2}2 {L1} {NON_PRIMARY_DIR}" + f"dataDir {self.taos_data_dir}{os.sep}{DATA_PRE0}0 {L0} {NON_PRIMARY_DIR}", + f"dataDir {self.taos_data_dir}{os.sep}{DATA_PRE1}1 {L1} {NON_PRIMARY_DIR}", + f"dataDir {self.taos_data_dir}{os.sep}{DATA_PRE2}2 {L2} {NON_PRIMARY_DIR}", + f"dataDir {self.taos_data_dir}{os.sep}{DATA_PRE2}2 {L1} {NON_PRIMARY_DIR}" ] - err_case5 = [f"dataDir {self.taos_data_dir}/{DATA_PRE0}0 {L0} {PRIMARY_DIR}"] + err_case5 = [f"dataDir {self.taos_data_dir}{os.sep}{DATA_PRE0}0 {L0} {PRIMARY_DIR}"] for i in range(16): - err_case5.append(f"dataDir {self.taos_data_dir}/{DATA_PRE0}{i+1} {L0} {NON_PRIMARY_DIR}") + err_case5.append(f"dataDir {self.taos_data_dir}{os.sep}{DATA_PRE0}{i+1} {L0} {NON_PRIMARY_DIR}") err_case6 = [ - f"dataDir {self.taos_data_dir}/{DATA_PRE0}0 {L0} {PRIMARY_DIR}", - f"dataDir {self.taos_data_dir}/{DATA_PRE0}1 {L0} {PRIMARY_DIR}", + f"dataDir {self.taos_data_dir}{os.sep}{DATA_PRE0}0 {L0} {PRIMARY_DIR}", + f"dataDir {self.taos_data_dir}{os.sep}{DATA_PRE0}1 {L0} {PRIMARY_DIR}", ] err_case7 = [ - f"dataDir {self.taos_data_dir}/{DATA_PRE0}0 {L0} {PRIMARY_DIR}", - f"dataDir {self.taos_data_dir}/{DATA_PRE2}2 {L2} {PRIMARY_DIR}", + f"dataDir {self.taos_data_dir}{os.sep}{DATA_PRE0}0 {L0} {PRIMARY_DIR}", + f"dataDir {self.taos_data_dir}{os.sep}{DATA_PRE2}2 {L2} {PRIMARY_DIR}", ] err_case8 = [ - f"dataDir {self.taos_data_dir}/data33 3 {PRIMARY_DIR}" + f"dataDir {self.taos_data_dir}{os.sep}data33 3 {PRIMARY_DIR}" ] err_case9 = [ - f"dataDir {self.taos_data_dir}/data33 -1 {NON_PRIMARY_DIR}" + f"dataDir {self.taos_data_dir}{os.sep}data33 -1 {NON_PRIMARY_DIR}" ] cfg_list.append(err_case1) @@ -147,23 +147,23 @@ class TDTestCase: def __current_cfg(self): cfg_list = [] current_case1 = [ - #f"dataDir {self.taos_data_dir}/{DATA_PRE0}0 {L0} {PRIMARY_DIR}", - f"dataDir {self.taos_data_dir}/{DATA_PRE0}1 {L0} {NON_PRIMARY_DIR}", - f"dataDir {self.taos_data_dir}/{DATA_PRE1}1 {L1} {NON_PRIMARY_DIR}", - f"dataDir {self.taos_data_dir}/{DATA_PRE2}2 {L2} {NON_PRIMARY_DIR}" + #f"dataDir {self.taos_data_dir}{os.sep}{DATA_PRE0}0 {L0} {PRIMARY_DIR}", + f"dataDir {self.taos_data_dir}{os.sep}{DATA_PRE0}1 {L0} {NON_PRIMARY_DIR}", + f"dataDir {self.taos_data_dir}{os.sep}{DATA_PRE1}1 {L1} {NON_PRIMARY_DIR}", + f"dataDir {self.taos_data_dir}{os.sep}{DATA_PRE2}2 {L2} {NON_PRIMARY_DIR}" ] - #current_case2 = [f"dataDir {self.taos_data_dir}/{DATA_PRE0}0 {L0} {PRIMARY_DIR}"] + #current_case2 = [f"dataDir {self.taos_data_dir}{os.sep}{DATA_PRE0}0 {L0} {PRIMARY_DIR}"] current_case2 = [] for i in range(9): - current_case2.append(f"dataDir {self.taos_data_dir}/{DATA_PRE0}{i+1} {L0} {NON_PRIMARY_DIR}") + current_case2.append(f"dataDir {self.taos_data_dir}{os.sep}{DATA_PRE0}{i+1} {L0} {NON_PRIMARY_DIR}") # TD-17773bug current_case3 = [ - #f"dataDir {self.taos_data_dir}/{DATA_PRE0}0 ", - f"dataDir {self.taos_data_dir}/{DATA_PRE0}1 {L0} {NON_PRIMARY_DIR}", - f"dataDir {self.taos_data_dir}/{DATA_PRE1}0 {L1} {NON_PRIMARY_DIR}", - f"dataDir {self.taos_data_dir}/{DATA_PRE2}0 {L2} {NON_PRIMARY_DIR}", + #f"dataDir {self.taos_data_dir}{os.sep}{DATA_PRE0}0 ", + f"dataDir {self.taos_data_dir}{os.sep}{DATA_PRE0}1 {L0} {NON_PRIMARY_DIR}", + f"dataDir {self.taos_data_dir}{os.sep}{DATA_PRE1}0 {L1} {NON_PRIMARY_DIR}", + f"dataDir {self.taos_data_dir}{os.sep}{DATA_PRE2}0 {L2} {NON_PRIMARY_DIR}", ] cfg_list.append(current_case1) cfg_list.append(current_case3) diff --git a/tests/system-test/2-query/cast.py b/tests/system-test/2-query/cast.py index e6542c7c2bc6b91e501098baf45562cadb07b599..2cc7e6a447da2901e6b818c2f9b50195438ce1d5 100644 --- a/tests/system-test/2-query/cast.py +++ b/tests/system-test/2-query/cast.py @@ -567,7 +567,7 @@ class TDTestCase: if data_ct4_c10[i] is None: tdSql.checkData( i, 0, None ) else: - time2str = str(int((data_ct4_c10[i]-datetime.datetime.fromtimestamp(0)).total_seconds()*1000)) + time2str = str(int((data_ct4_c10[i]-datetime.datetime.fromtimestamp(0,data_ct4_c10[i].tzinfo)).total_seconds())*1000+int(data_ct4_c10[i].microsecond / 1000)) tdSql.checkData( i, 0, time2str ) tdSql.query(f"select cast(c10 as nchar(32)) as b from {self.dbname}.t1") for i in range(len(data_t1_c10)): @@ -576,7 +576,7 @@ class TDTestCase: elif i == 10: continue else: - time2str = str(int((data_t1_c10[i]-datetime.datetime.fromtimestamp(0)).total_seconds()*1000)) + time2str = str(int((data_t1_c10[i]-datetime.datetime.fromtimestamp(0,data_t1_c10[i].tzinfo)).total_seconds())*1000+int(data_t1_c10[i].microsecond / 1000)) tdSql.checkData( i, 0, time2str ) tdLog.printNoPrefix("==========step38: cast timestamp to binary, expect no changes ") @@ -585,7 +585,7 @@ class TDTestCase: if data_ct4_c10[i] is None: tdSql.checkData( i, 0, None ) else: - time2str = str(int((data_ct4_c10[i]-datetime.datetime.fromtimestamp(0)).total_seconds()*1000)) + time2str = str(int((data_ct4_c10[i]-datetime.datetime.fromtimestamp(0,data_ct4_c10[i].tzinfo)).total_seconds())*1000+int(data_ct4_c10[i].microsecond / 1000)) tdSql.checkData( i, 0, time2str ) tdSql.query(f"select cast(c10 as binary(32)) as b from {self.dbname}.t1") for i in range(len(data_t1_c10)): @@ -594,7 +594,7 @@ class TDTestCase: elif i == 10: continue else: - time2str = str(int((data_t1_c10[i]-datetime.datetime.fromtimestamp(0)).total_seconds()*1000)) + time2str = str(int((data_t1_c10[i]-datetime.datetime.fromtimestamp(0,data_t1_c10[i].tzinfo)).total_seconds())*1000+int(data_t1_c10[i].microsecond / 1000)) tdSql.checkData( i, 0, time2str ) tdLog.printNoPrefix("==========step39: cast constant operation to bigint, expect change to int ") diff --git a/tests/system-test/2-query/mavg.py b/tests/system-test/2-query/mavg.py index d659a682b10ea9876595c0680d02295774967d15..798d0e290b8bf88ac6c9a6230651d6c44e17c68b 100644 --- a/tests/system-test/2-query/mavg.py +++ b/tests/system-test/2-query/mavg.py @@ -716,8 +716,6 @@ class TDTestCase: tdSql.checkRows(2) # partition by col - tdSql.query(f"select c1 , mavg(c1,3) from {dbname}.stb1 partition by c1") - tdSql.checkRows(0) tdSql.query(f"select c1 , mavg(c1,1) from {dbname}.stb1 partition by c1") tdSql.checkRows(40) tdSql.query(f"select c1, c2, c3, c4, mavg(c1,3) from {dbname}.stb1 partition by tbname ") diff --git a/tests/system-test/2-query/mode.py b/tests/system-test/2-query/mode.py index 72bae552618f7e772481035c079a2d9507045d79..807a1ac394aee9477fdf88120f554685a465f219 100644 --- a/tests/system-test/2-query/mode.py +++ b/tests/system-test/2-query/mode.py @@ -64,61 +64,61 @@ class TDTestCase: tdSql.query(f"select ts,mode(c1) from {dbname}.tb") tdSql.checkRows(1) ts = tdSql.getData(0, 0) - tdSql.checkEqual(ts, datetime.datetime(2022, 12, 31, 1, 1, 36)) + tdSql.checkEqual(ts.astimezone(datetime.timezone.utc), datetime.datetime(2022, 12, 31, 1, 1, 36).astimezone(datetime.timezone.utc)) tdSql.checkData(0, 1, 9) tdSql.query(f"select ts,mode(c2) from {dbname}.tb") tdSql.checkRows(1) ts = tdSql.getData(0, 0) - tdSql.checkEqual(ts, datetime.datetime(2022, 12, 31, 1, 1, 36)) + tdSql.checkEqual(ts.astimezone(datetime.timezone.utc), datetime.datetime(2022, 12, 31, 1, 1, 36).astimezone(datetime.timezone.utc)) tdSql.checkData(0, 1, -99999999999999999) tdSql.query(f"select ts,mode(c3) from {dbname}.tb") tdSql.checkRows(1) ts = tdSql.getData(0, 0) - tdSql.checkEqual(ts, datetime.datetime(2022, 12, 31, 1, 1, 36)) + tdSql.checkEqual(ts.astimezone(datetime.timezone.utc), datetime.datetime(2022, 12, 31, 1, 1, 36).astimezone(datetime.timezone.utc)) tdSql.checkData(0, 1, -999) tdSql.query(f"select ts,mode(c4) from {dbname}.tb") tdSql.checkRows(1) ts = tdSql.getData(0, 0) - tdSql.checkEqual(ts, datetime.datetime(2022, 12, 31, 1, 1, 36)) + tdSql.checkEqual(ts.astimezone(datetime.timezone.utc), datetime.datetime(2022, 12, 31, 1, 1, 36).astimezone(datetime.timezone.utc)) tdSql.checkData(0, 1, -99) tdSql.query(f"select ts,mode(c5) from {dbname}.tb") tdSql.checkRows(1) ts = tdSql.getData(0, 0) - tdSql.checkEqual(ts, datetime.datetime(2022, 12, 31, 1, 1, 36)) + tdSql.checkEqual(ts.astimezone(datetime.timezone.utc), datetime.datetime(2022, 12, 31, 1, 1, 36).astimezone(datetime.timezone.utc)) tdSql.checkData(0, 1, -9.99) tdSql.query(f"select ts,mode(c6) from {dbname}.tb") tdSql.checkRows(1) ts = tdSql.getData(0, 0) - tdSql.checkEqual(ts, datetime.datetime(2022, 12, 31, 1, 1, 36)) + tdSql.checkEqual(ts.astimezone(datetime.timezone.utc), datetime.datetime(2022, 12, 31, 1, 1, 36).astimezone(datetime.timezone.utc)) tdSql.checkData(0, 1, -1e+21) tdSql.query(f"select ts,mode(c7) from {dbname}.tb") tdSql.checkRows(1) ts = tdSql.getData(0, 0) - tdSql.checkEqual(ts, datetime.datetime(2022, 12, 31, 1, 1, 36)) + tdSql.checkEqual(ts.astimezone(datetime.timezone.utc), datetime.datetime(2022, 12, 31, 1, 1, 36).astimezone(datetime.timezone.utc)) tdSql.checkData(0, 1, True) tdSql.query(f"select ts,mode(c8) from {dbname}.tb") tdSql.checkRows(1) ts = tdSql.getData(0, 0) - tdSql.checkEqual(ts, datetime.datetime(2022, 12, 31, 1, 1, 36)) + tdSql.checkEqual(ts.astimezone(datetime.timezone.utc), datetime.datetime(2022, 12, 31, 1, 1, 36).astimezone(datetime.timezone.utc)) tdSql.checkData(0, 1, 'binary9') tdSql.query(f"select ts,mode(c9) from {dbname}.tb") tdSql.checkRows(1) ts = tdSql.getData(0, 0) - tdSql.checkEqual(ts, datetime.datetime(2022, 12, 31, 1, 1, 36)) + tdSql.checkEqual(ts.astimezone(datetime.timezone.utc), datetime.datetime(2022, 12, 31, 1, 1, 36).astimezone(datetime.timezone.utc)) tdSql.checkData(0, 1, 'nchar9') tdSql.query(f"select ts,c3,c5,c8,mode(c1) from {dbname}.tb") tdSql.checkRows(1) ts = tdSql.getData(0, 0) - tdSql.checkEqual(ts, datetime.datetime(2022, 12, 31, 1, 1, 36)) + tdSql.checkEqual(ts.astimezone(datetime.timezone.utc), datetime.datetime(2022, 12, 31, 1, 1, 36).astimezone(datetime.timezone.utc)) tdSql.checkData(0, 1, -999) tdSql.checkData(0, 2, -9.99) tdSql.checkData(0, 3, 'binary9') @@ -128,61 +128,61 @@ class TDTestCase: tdSql.query(f"select ts,mode(c1) from {dbname}.stb") tdSql.checkRows(1) ts = tdSql.getData(0, 0) - tdSql.checkEqual(ts, datetime.datetime(2020, 12, 11, 0, 0, 3)) + tdSql.checkEqual(ts.astimezone(datetime.timezone.utc), datetime.datetime(2020, 12, 11, 0, 0, 3).astimezone(datetime.timezone.utc)) tdSql.checkData(0, 1, 9) tdSql.query(f"select ts,mode(c2) from {dbname}.stb") tdSql.checkRows(1) ts = tdSql.getData(0, 0) - tdSql.checkEqual(ts, datetime.datetime(2020, 12, 11, 0, 0, 3)) + tdSql.checkEqual(ts.astimezone(datetime.timezone.utc), datetime.datetime(2020, 12, 11, 0, 0, 3).astimezone(datetime.timezone.utc)) tdSql.checkData(0, 1, -99999) tdSql.query(f"select ts,mode(c3) from {dbname}.stb") tdSql.checkRows(1) ts = tdSql.getData(0, 0) - tdSql.checkEqual(ts, datetime.datetime(2020, 12, 11, 0, 0, 3)) + tdSql.checkEqual(ts.astimezone(datetime.timezone.utc), datetime.datetime(2020, 12, 11, 0, 0, 3).astimezone(datetime.timezone.utc)) tdSql.checkData(0, 1, -999) tdSql.query(f"select ts,mode(c4) from {dbname}.stb") tdSql.checkRows(1) ts = tdSql.getData(0, 0) - tdSql.checkEqual(ts, datetime.datetime(2020, 12, 11, 0, 0, 2)) + tdSql.checkEqual(ts.astimezone(datetime.timezone.utc), datetime.datetime(2020, 12, 11, 0, 0, 2).astimezone(datetime.timezone.utc)) tdSql.checkData(0, 1, -99) tdSql.query(f"select ts,mode(c5) from {dbname}.stb") tdSql.checkRows(1) ts = tdSql.getData(0, 0) - tdSql.checkEqual(ts, datetime.datetime(2020, 12, 11, 0, 0, 3)) + tdSql.checkEqual(ts.astimezone(datetime.timezone.utc), datetime.datetime(2020, 12, 11, 0, 0, 3).astimezone(datetime.timezone.utc)) tdSql.checkData(0, 1, -9.99) tdSql.query(f"select ts,mode(c6) from {dbname}.stb") tdSql.checkRows(1) ts = tdSql.getData(0, 0) - tdSql.checkEqual(ts, datetime.datetime(2020, 12, 11, 0, 0, 3)) + tdSql.checkEqual(ts.astimezone(datetime.timezone.utc), datetime.datetime(2020, 12, 11, 0, 0, 3).astimezone(datetime.timezone.utc)) tdSql.checkData(0, 1, -99.99) tdSql.query(f"select ts,mode(c7) from {dbname}.stb") tdSql.checkRows(1) ts = tdSql.getData(0, 0) - tdSql.checkEqual(ts, datetime.datetime(2020, 12, 11, 0, 0, 3)) + tdSql.checkEqual(ts.astimezone(datetime.timezone.utc), datetime.datetime(2020, 12, 11, 0, 0, 3).astimezone(datetime.timezone.utc)) tdSql.checkData(0, 1, True) tdSql.query(f"select ts,mode(c8) from {dbname}.stb") tdSql.checkRows(1) ts = tdSql.getData(0, 0) - tdSql.checkEqual(ts, datetime.datetime(2020, 12, 11, 0, 0, 3)) + tdSql.checkEqual(ts.astimezone(datetime.timezone.utc), datetime.datetime(2020, 12, 11, 0, 0, 3).astimezone(datetime.timezone.utc)) tdSql.checkData(0, 1, 'binary9') tdSql.query(f"select ts,mode(c9) from {dbname}.stb") tdSql.checkRows(1) ts = tdSql.getData(0, 0) - tdSql.checkEqual(ts, datetime.datetime(2020, 12, 11, 0, 0, 3)) + tdSql.checkEqual(ts.astimezone(datetime.timezone.utc), datetime.datetime(2020, 12, 11, 0, 0, 3).astimezone(datetime.timezone.utc)) tdSql.checkData(0, 1, 'nchar9') tdSql.query(f"select ts,mode(c1),c3,c5,c8 from {dbname}.stb") tdSql.checkRows(1) ts = tdSql.getData(0, 0) - tdSql.checkEqual(ts, datetime.datetime(2020, 12, 11, 0, 0, 3)) + tdSql.checkEqual(ts.astimezone(datetime.timezone.utc), datetime.datetime(2020, 12, 11, 0, 0, 3).astimezone(datetime.timezone.utc)) tdSql.checkData(0, 1, 9) tdSql.checkData(0, 2, -999) tdSql.checkData(0, 3, -9.99) diff --git a/tests/system-test/2-query/odbc.py b/tests/system-test/2-query/odbc.py index 2325b01c35ebe3544f4dcd304369b07ae0ffbdde..f26f0abda0db5edb6c54261eb7e85f72daaafea2 100644 --- a/tests/system-test/2-query/odbc.py +++ b/tests/system-test/2-query/odbc.py @@ -22,7 +22,7 @@ class TDTestCase: tdSql.execute("insert into db.ctb using db.stb tags(1) (ts, c1) values (now, 1)") tdSql.query("select count(*) from information_schema.ins_columns") - tdSql.checkData(0, 0, 269) + tdSql.checkData(0, 0, 271) tdSql.query("select * from information_schema.ins_columns where table_name = 'ntb'") tdSql.checkRows(14) diff --git a/tests/system-test/2-query/out_of_order.py b/tests/system-test/2-query/out_of_order.py index 148b89fc58ba481ef53d3735ce50a8957ec10278..e07eaed092a0dfac84afbf4d796661e31e273dd5 100644 --- a/tests/system-test/2-query/out_of_order.py +++ b/tests/system-test/2-query/out_of_order.py @@ -35,7 +35,10 @@ class TDTestCase: projPath = selfPath[:selfPath.find("tests")] for root, dirs, files in os.walk(projPath): - if ("taosd" in files): + taosdFileName = "taosd" + if platform.system().lower() == 'windows': + taosdFileName = "taosd.exe" + if (taosdFileName in files): rootRealPath = os.path.dirname(os.path.realpath(root)) if ("packaging" not in rootRealPath): buildPath = root[:len(root)-len("/build/bin")] @@ -52,7 +55,10 @@ class TDTestCase: tdLog.info("taosd found in %s" % buildPath) binPath = buildPath+ "/build/bin/" - os.system("%staosBenchmark -d %s -t %d -n %d -O %d -a %d -b float,double,nchar\(200\),binary\(50\) -T 50 -y " % (binPath,dbname,tables,per_table_num,order,replica)) + cmd = "%staosBenchmark -d %s -t %d -n %d -O %d -a %d -b float,double,nchar\(200\),binary\(50\) -T 50 -y " % (binPath,dbname,tables,per_table_num,order,replica) + if platform.system().lower() == 'windows': + cmd = "%staosBenchmark -d %s -t %d -n %d -O %d -a %d -b float,double,nchar(200),binary(50) -T 50 -y " % (binPath,dbname,tables,per_table_num,order,replica) + os.system(cmd) def sql_base(self,dbname): self.check_sub(dbname) diff --git a/tests/system-test/2-query/projectionDesc.py b/tests/system-test/2-query/projectionDesc.py new file mode 100644 index 0000000000000000000000000000000000000000..1edceaa6f2ced20595132149c8d8f135111ce097 --- /dev/null +++ b/tests/system-test/2-query/projectionDesc.py @@ -0,0 +1,48 @@ +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() + + intData = [] + floatData = [] + + tdSql.execute(f'''create table {dbname}.stb(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double, + col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned) tags(loc nchar(20))''') + tdSql.execute(f"create table {dbname}.stb_1 using {dbname}.stb tags('beijing')") + for n in range(self.batchNum): + for i in range(self.rowNum): + tdSql.execute(f"insert into {dbname}.stb_1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)" + % (self.ts, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1)) + intData.append(i + 1) + floatData.append(i + 0.1) + tdSql.execute(f"flush database {dbname}") + + tdSql.query(f"select * from {dbname}.stb_1 order by ts desc") + tdSql.checkRows(1) + #tdSql.checkData(0,0,1537146000000) + tdSql.checkData(0,1,10) + + tdSql.query(f"select * from {dbname}.stb_1 order by 'aaa' desc") + + 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/queryQnode.py b/tests/system-test/2-query/queryQnode.py index fec553436c04f6b1cca231dc917874de4a883f5f..9c4091d0dfb58c05484f32cfbdd27a55c4b20dbd 100644 --- a/tests/system-test/2-query/queryQnode.py +++ b/tests/system-test/2-query/queryQnode.py @@ -292,9 +292,9 @@ class TDTestCase: maxQnode=tdSql.getData(0,0) tdSql.query("select min(c1) from stb11;") minQnode=tdSql.getData(0,0) - tdSql.query("select c0,c1 from stb11_1 where (c0>1000) union select c0,c1 from stb11_1 where c0>2000;") + tdSql.query("select c0,c1 from(select c0,c1 from stb11_1 where (c0>1000) union select c0,c1 from stb11_1 where c0>2000) order by c0,c1;") unionQnode=tdSql.queryResult - tdSql.query("select c0,c1 from stb11_1 where (c0>1000) union all select c0,c1 from stb11_1 where c0>2000;") + tdSql.query("select c0,c1 from(select c0,c1 from stb11_1 where (c0>1000) union all select c0,c1 from stb11_1 where c0>2000) order by c0,c1;") unionallQnode=tdSql.queryResult # tdSql.query("select * from information_schema.ins_qnodes;") @@ -306,10 +306,10 @@ class TDTestCase: tdSql.checkData(0, 0, "%s"%maxQnode) tdSql.query("select min(c1) from stb11;") tdSql.checkData(0, 0, "%s"%minQnode) - tdSql.query("select c0,c1 from stb11_1 where (c0>1000) union select c0,c1 from stb11_1 where c0>2000;") + tdSql.query("select c0,c1 from(select c0,c1 from stb11_1 where (c0>1000) union select c0,c1 from stb11_1 where c0>2000) order by c0,c1;") unionVnode=tdSql.queryResult assert unionQnode == unionVnode - tdSql.query("select c0,c1 from stb11_1 where (c0>1000) union all select c0,c1 from stb11_1 where c0>2000;") + tdSql.query("select c0,c1 from(select c0,c1 from stb11_1 where (c0>1000) union all select c0,c1 from stb11_1 where c0>2000) order by c0,c1;") unionallVnode=tdSql.queryResult assert unionallQnode == unionallVnode @@ -340,9 +340,9 @@ class TDTestCase: assert maxQnode==tdSql.getData(0,0) tdSql.query("select min(c1) from stb11;") assert minQnode==tdSql.getData(0,0) - tdSql.query("select c0,c1 from stb11_1 where (c0>1000) union select c0,c1 from stb11_1 where c0>2000;") + tdSql.query("select c0,c1 from(select c0,c1 from stb11_1 where (c0>1000) union select c0,c1 from stb11_1 where c0>2000) order by c0,c1;") assert unionQnode==tdSql.queryResult - tdSql.query("select c0,c1 from stb11_1 where (c0>1000) union all select c0,c1 from stb11_1 where c0>2000;") + tdSql.query("select c0,c1 from(select c0,c1 from stb11_1 where (c0>1000) union all select c0,c1 from stb11_1 where c0>2000) order by c0,c1;") assert unionallQnode==tdSql.queryResult # tdSql.query("select * from information_schema.ins_qnodes;") @@ -354,8 +354,8 @@ class TDTestCase: assert maxQnode==tdSql.getData(0,0) tdSql.query("select min(c1) from stb11;") assert minQnode==tdSql.getData(0,0) - tdSql.error("select c0,c1 from stb11_1 where (c0>1000) union select c0,c1 from stb11_1 where c0>2000;") - tdSql.error("select c0,c1 from stb11_1 where (c0>1000) union all select c0,c1 from stb11_1 where c0>2000;") + tdSql.error("select c0,c1 from(select c0,c1 from stb11_1 where (c0>1000) union select c0,c1 from stb11_1 where c0>2000) order by c0,c1;") + tdSql.error("select c0,c1 from(select c0,c1 from stb11_1 where (c0>1000) union all select c0,c1 from stb11_1 where c0>2000) order by c0,c1;") # tdSql.execute("create qnode on dnode %s"%dnodeId) @@ -387,9 +387,9 @@ class TDTestCase: assert maxQnode==tdSql.getData(0,0) tdSql.query("select min(c1) from stb11;") assert minQnode==tdSql.getData(0,0) - tdSql.query("select c0,c1 from stb11_1 where (c0>1000) union select c0,c1 from stb11_1 where c0>2000;") + tdSql.query("select c0,c1 from(select c0,c1 from stb11_1 where (c0>1000) union select c0,c1 from stb11_1 where c0>2000) order by c0,c1;") assert unionQnode==tdSql.queryResult - tdSql.query("select c0,c1 from stb11_1 where (c0>1000) union all select c0,c1 from stb11_1 where c0>2000;") + tdSql.query("select c0,c1 from(select c0,c1 from stb11_1 where (c0>1000) union all select c0,c1 from stb11_1 where c0>2000) order by c0,c1;") assert unionallQnode==tdSql.queryResult queryPolicy=1 @@ -412,9 +412,9 @@ class TDTestCase: assert maxQnode==tdSql.getData(0,0) tdSql.query("select min(c1) from stb11;") assert minQnode==tdSql.getData(0,0) - tdSql.query("select c0,c1 from stb11_1 where (c0>1000) union select c0,c1 from stb11_1 where c0>2000;") + tdSql.query("select c0,c1 from(select c0,c1 from stb11_1 where (c0>1000) union select c0,c1 from stb11_1 where c0>2000) order by c0,c1;") assert unionQnode==tdSql.queryResult - tdSql.query("select c0,c1 from stb11_1 where (c0>1000) union all select c0,c1 from stb11_1 where c0>2000;") + tdSql.query("select c0,c1 from(select c0,c1 from stb11_1 where (c0>1000) union all select c0,c1 from stb11_1 where c0>2000) order by c0,c1;") assert unionallQnode==tdSql.queryResult # test case : queryPolicy = 2 @@ -443,8 +443,8 @@ class TDTestCase: tdSql.execute("use db1;") tdSql.error("select max(c1) from stb10;") tdSql.error("select min(c1) from stb11;") - tdSql.error("select c0,c1 from stb11_1 where (c0>1000) union select c0,c1 from stb11_1 where c0>2000;") - tdSql.error("select c0,c1 from stb11_1 where (c0>1000) union all select c0,c1 from stb11_1 where c0>2000;") + tdSql.error("select c0,c1 from(select c0,c1 from stb11_1 where (c0>1000) union select c0,c1 from stb11_1 where c0>2000) order by c0,c1;") + tdSql.error("select c0,c1 from(select c0,c1 from stb11_1 where (c0>1000) union all select c0,c1 from stb11_1 where c0>2000) order by c0,c1;") tdSql.query("select max(c1) from stb10_0;") tdSql.query("select min(c1) from stb11_0;") @@ -464,9 +464,9 @@ class TDTestCase: maxQnode=tdSql.getData(0,0) tdSql.query("select min(c1) from stb11;") minQnode=tdSql.getData(0,0) - tdSql.query("select c0,c1 from stb11_1 where (c0>1000) union select c0,c1 from stb11_1 where c0>2000;") + tdSql.query("select c0,c1 from(select c0,c1 from stb11_1 where (c0>1000) union select c0,c1 from stb11_1 where c0>2000) order by c0,c1;") unionQnode=tdSql.queryResult - tdSql.query("select c0,c1 from stb11_1 where (c0>1000) union all select c0,c1 from stb11_1 where c0>2000;") + tdSql.query("select c0,c1 from(select c0,c1 from stb11_1 where (c0>1000) union all select c0,c1 from stb11_1 where c0>2000) order by c0,c1;") unionallQnode=tdSql.queryResult # tdSql.query("select * from information_schema.ins_qnodes;") @@ -478,8 +478,8 @@ class TDTestCase: tdSql.error("select max(c1) from stb10;") tdSql.error("select min(c1) from stb11;") - tdSql.error("select c0,c1 from stb11_1 where (c0>1000) union select c0,c1 from stb11_1 where c0>2000;") - tdSql.error("select c0,c1 from stb11_1 where (c0>1000) union all select c0,c1 from stb11_1 where c0>2000;") + tdSql.error("select c0,c1 from(select c0,c1 from stb11_1 where (c0>1000) union select c0,c1 from stb11_1 where c0>2000) order by c0,c1;") + tdSql.error("select c0,c1 from(select c0,c1 from stb11_1 where (c0>1000) union all select c0,c1 from stb11_1 where c0>2000) order by c0,c1;") # run case def run(self): diff --git a/tests/system-test/2-query/tsbsQuery.py b/tests/system-test/2-query/tsbsQuery.py index 106d43ea388ed450766a811a525415c16954555b..4f415550b8e762fd2bb88838f75865e88a77d5c4 100644 --- a/tests/system-test/2-query/tsbsQuery.py +++ b/tests/system-test/2-query/tsbsQuery.py @@ -86,7 +86,7 @@ class TDTestCase: self.ctbNums=ctbNums rowNUms=5000 ts=1451606400000 - tdSql.execute(f"create database {dbname};") + tdSql.execute(f"create database {dbname} cachemodel 'both';") tdSql.execute(f"use {dbname} ") tdSql.execute(f''' create table {stabname1} (ts timestamp,latitude double,longitude double,elevation double,velocity double,heading double,grade double,fuel_consumption double) tags (name binary(30),fleet binary(30),driver binary(30),model binary(30),device_version binary(30),load_capacity double,fuel_capacity double,nominal_fuel_consumption double); diff --git a/tests/system-test/6-cluster/5dnode1mnode.py b/tests/system-test/6-cluster/5dnode1mnode.py index f21fae0d7b9a4908a6112d2f5ea7cc214bd961bf..c17f001f0c3042000fcf4c1c3a82abc0a0fc45ac 100644 --- a/tests/system-test/6-cluster/5dnode1mnode.py +++ b/tests/system-test/6-cluster/5dnode1mnode.py @@ -18,7 +18,10 @@ class MyDnodes(TDDnodes): def __init__(self ,dnodes_lists): super(MyDnodes,self).__init__() self.dnodes = dnodes_lists # dnode must be TDDnode instance - self.simDeployed = False + if platform.system().lower() == 'windows': + self.simDeployed = True + else: + self.simDeployed = False class TDTestCase: noConn = True diff --git a/tests/system-test/6-cluster/5dnode3mnodeDrop.py b/tests/system-test/6-cluster/5dnode3mnodeDrop.py index 9dd3c568054948d7062c2f87f145149509b1b575..c4b30a16f71ba1331fd3f146aa3245375326588e 100644 --- a/tests/system-test/6-cluster/5dnode3mnodeDrop.py +++ b/tests/system-test/6-cluster/5dnode3mnodeDrop.py @@ -19,7 +19,10 @@ class MyDnodes(TDDnodes): def __init__(self ,dnodes_lists): super(MyDnodes,self).__init__() self.dnodes = dnodes_lists # dnode must be TDDnode instance - self.simDeployed = False + if platform.system().lower() == 'windows': + self.simDeployed = True + else: + self.simDeployed = False class TDTestCase: @@ -111,6 +114,8 @@ class TDTestCase: dnode_first_host = dnode.cfgDict["firstEp"].split(":")[0] dnode_first_port = dnode.cfgDict["firstEp"].split(":")[-1] cmd = f" taos -h {dnode_first_host} -P {dnode_first_port} -s ' create dnode \"{dnode_id} \" ' ;" + if platform.system().lower() == 'windows': + cmd = f" taos -h {dnode_first_host} -P {dnode_first_port} -s \"create dnode \\\"{dnode_id}\\\"" tdLog.debug(cmd) if os.system(cmd) != 0: raise Exception("failed to execute system command. cmd: %s" % cmd) diff --git a/tests/system-test/6-cluster/5dnode3mnodeRestartDnodeInsertDataAsync.py b/tests/system-test/6-cluster/5dnode3mnodeRestartDnodeInsertDataAsync.py index 66c2fdd14fd5f9ad5ef4c8944dab481e434a5970..04c69ad6188a657cd37651a01d417d790a9830af 100644 --- a/tests/system-test/6-cluster/5dnode3mnodeRestartDnodeInsertDataAsync.py +++ b/tests/system-test/6-cluster/5dnode3mnodeRestartDnodeInsertDataAsync.py @@ -143,7 +143,8 @@ class TDTestCase: stableName= '%s_%d'%(paraDict['stbName'],i) newTdSql=tdCom.newTdSql() threads.append(threading.Thread(target=clusterComCreate.insert_data, args=(newTdSql, paraDict["dbName"],stableName,paraDict["ctbNum"],paraDict["rowsPerTbl"],paraDict["batchNum"],paraDict["startTs"]))) - threads.append(threading.Thread(target=self.reCreateUser,args=(newTdSql,i,"user","passwd"))) + createTdSql=tdCom.newTdSql() + threads.append(threading.Thread(target=self.reCreateUser,args=(createTdSql,i,"user","passwd"))) for tr in threads: tr.start() diff --git a/tests/system-test/7-tmq/tmqCommon.py b/tests/system-test/7-tmq/tmqCommon.py index 895da95e5d5d8280b9e420b2803681674dab5bc2..1e636e207441e7794f312ffa00e27accde0eccbe 100644 --- a/tests/system-test/7-tmq/tmqCommon.py +++ b/tests/system-test/7-tmq/tmqCommon.py @@ -129,11 +129,16 @@ class TMQCom: def stopTmqSimProcess(self, processorName): psCmd = "unset LD_PRELOAD; ps -ef|grep -w %s|grep -v grep | awk '{print $2}'"%(processorName) + if platform.system().lower() == 'windows': + psCmd = "ps -ef|grep -w %s|grep -v grep | awk '{print $2}'"%(processorName) processID = subprocess.check_output(psCmd, shell=True).decode("utf-8") onlyKillOnceWindows = 0 while(processID): if not platform.system().lower() == 'windows' or (onlyKillOnceWindows == 0 and platform.system().lower() == 'windows'): - killCmd = "unset LD_PRELOAD; kill -INT %s > /dev/null 2>&1" % processID + if platform.system().lower() == 'windows': + killCmd = "kill -INT %s > /dev/nul 2>&1" % processID + else: + killCmd = "unset LD_PRELOAD; kill -INT %s > /dev/null 2>&1" % processID os.system(killCmd) onlyKillOnceWindows = 1 time.sleep(0.2) diff --git a/tests/system-test/7-tmq/tmqConsFromTsdb1-1ctb.py b/tests/system-test/7-tmq/tmqConsFromTsdb1-1ctb.py index 4dcc0b963f8e883326132f5db3bc04a6edd349d1..c11159c6e551d60b90aab16bb7c90e4b26021ac2 100644 --- a/tests/system-test/7-tmq/tmqConsFromTsdb1-1ctb.py +++ b/tests/system-test/7-tmq/tmqConsFromTsdb1-1ctb.py @@ -200,7 +200,7 @@ class TDTestCase: tdLog.info("pkill consume processor") tdCom.killProcessor("tmq_sim") - # time.sleep(10) + time.sleep(10) # reinit consume info, and start tmq_sim, then check consume result tmqCom.initConsumerTable() diff --git a/tests/system-test/7-tmq/tmqConsFromTsdb1-mutilVg-mutilCtb.py b/tests/system-test/7-tmq/tmqConsFromTsdb1-mutilVg-mutilCtb.py index 8ff01444f81c5b5bdb52c3885970faca5b779a1b..439845aa54a6d29c1cd7633e9949da3eaa40cfee 100644 --- a/tests/system-test/7-tmq/tmqConsFromTsdb1-mutilVg-mutilCtb.py +++ b/tests/system-test/7-tmq/tmqConsFromTsdb1-mutilVg-mutilCtb.py @@ -18,8 +18,8 @@ from tmqCommon import * class TDTestCase: def __init__(self): self.vgroups = 4 - self.ctbNum = 3000 - self.rowsPerTbl = 70 + self.ctbNum = 1000 + self.rowsPerTbl = 100 def init(self, conn, logSql, replicaVar=1): self.replicaVar = int(replicaVar) @@ -112,15 +112,15 @@ class TDTestCase: # init consume info, and start tmq_sim, then check consume result tdLog.info("insert consume info to consume processor") consumerId = 3 - expectrowcnt = math.ceil(paraDict["rowsPerTbl"] * paraDict["ctbNum"] / 3) + expectrowcnt = math.ceil(paraDict["rowsPerTbl"] * paraDict["ctbNum"]) topicList = topicNameList[0] ifcheckdata = 1 ifManualCommit = 1 - keyList = 'group.id:cgrp1, enable.auto.commit:true, auto.commit.interval.ms:1000, auto.offset.reset:earliest' + keyList = 'group.id:cgrp3, enable.auto.commit:true, auto.commit.interval.ms:100, auto.offset.reset:earliest' tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit) consumerId = 4 - expectrowcnt = math.ceil(paraDict["rowsPerTbl"] * paraDict["ctbNum"] * 2/3) + expectrowcnt = math.ceil(paraDict["rowsPerTbl"] * paraDict["ctbNum"]) tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit) tdLog.info("start consume processor 0") @@ -131,8 +131,8 @@ class TDTestCase: resultList = tmqCom.selectConsumeResult(expectRows) actConsumeTotalRows = resultList[0] + resultList[1] - if not (totalRowsInserted == actConsumeTotalRows): - tdLog.info("sum of two consume rows: %d should be equal to total inserted rows: %d"%(actConsumeTotalRows, totalRowsInserted)) + tdLog.info("sum of two consume rows: %d should be greater than or equal to total inserted rows: %d"%(actConsumeTotalRows, totalRowsInserted)) + if not (totalRowsInserted <= actConsumeTotalRows): tdLog.exit("%d tmq consume rows error!"%consumerId) time.sleep(10) @@ -188,7 +188,7 @@ class TDTestCase: topicList = topicNameList[0] ifcheckdata = 1 ifManualCommit = 1 - keyList = 'group.id:cgrp1, enable.auto.commit:true, auto.commit.interval.ms:1000, auto.offset.reset:earliest' + keyList = 'group.id:cgrp4, enable.auto.commit:true, auto.commit.interval.ms:100, auto.offset.reset:earliest' tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit) tdLog.info("start consume processor 0") @@ -216,9 +216,9 @@ class TDTestCase: actConsumeTotalRows = resultList[0] - if not (actConsumeTotalRows > 0 and actConsumeTotalRows < totalRowsInserted): - tdLog.info("act consume rows: %d"%(actConsumeTotalRows)) - tdLog.info("and second consume rows should be between 0 and %d"%(totalRowsInserted)) + tdLog.info("act consume rows: %d"%(actConsumeTotalRows)) + tdLog.info("and second consume rows should be between 0 and %d"%(totalRowsInserted)) + if not (actConsumeTotalRows > 0 and actConsumeTotalRows <= totalRowsInserted): tdLog.exit("%d tmq consume rows error!"%consumerId) time.sleep(10) diff --git a/tests/system-test/7-tmq/tmqConsFromTsdb1-mutilVg.py b/tests/system-test/7-tmq/tmqConsFromTsdb1-mutilVg.py index da8ac6c57deaf99d9871134489b290381b570306..53ff020b08abf2b758a6de00984b0cb799528d45 100644 --- a/tests/system-test/7-tmq/tmqConsFromTsdb1-mutilVg.py +++ b/tests/system-test/7-tmq/tmqConsFromTsdb1-mutilVg.py @@ -18,7 +18,7 @@ from tmqCommon import * class TDTestCase: def __init__(self): self.vgroups = 4 - self.ctbNum = 10 + self.ctbNum = 4 self.rowsPerTbl = 10000 def init(self, conn, logSql, replicaVar=1): @@ -41,7 +41,7 @@ class TDTestCase: 'ctbStartIdx': 0, 'ctbNum': 10, 'rowsPerTbl': 10000, - 'batchNum': 10, + 'batchNum': 1000, 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 'pollDelay': 3, 'showMsg': 1, @@ -112,15 +112,15 @@ class TDTestCase: # init consume info, and start tmq_sim, then check consume result tdLog.info("insert consume info to consume processor") consumerId = 3 - expectrowcnt = math.ceil(paraDict["rowsPerTbl"] * paraDict["ctbNum"] / 3) + expectrowcnt = math.ceil(paraDict["rowsPerTbl"] * paraDict["ctbNum"]) topicList = topicNameList[0] ifcheckdata = 1 ifManualCommit = 1 - keyList = 'group.id:cgrp1, enable.auto.commit:true, auto.commit.interval.ms:200, auto.offset.reset:earliest' + keyList = 'group.id:cgrp3, enable.auto.commit:true, auto.commit.interval.ms:200, auto.offset.reset:earliest' tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit) consumerId = 4 - expectrowcnt = math.ceil(paraDict["rowsPerTbl"] * paraDict["ctbNum"] * 2/3) + expectrowcnt = math.ceil(paraDict["rowsPerTbl"] * paraDict["ctbNum"]) tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit) tdLog.info("start consume processor 0") @@ -130,9 +130,9 @@ class TDTestCase: expectRows = 2 resultList = tmqCom.selectConsumeResult(expectRows) actConsumeTotalRows = resultList[0] + resultList[1] - - if not (totalRowsInserted == actConsumeTotalRows): - tdLog.info("sum of two consume rows: %d should be equal to total inserted rows: %d"%(actConsumeTotalRows, totalRowsInserted)) + + tdLog.info("sum of two consume rows: %d should be greater than or equal to total inserted rows: %d"%(actConsumeTotalRows, totalRowsInserted)) + if not (totalRowsInserted <= actConsumeTotalRows): tdLog.exit("%d tmq consume rows error!"%consumerId) time.sleep(10) @@ -188,7 +188,7 @@ class TDTestCase: topicList = topicNameList[0] ifcheckdata = 1 ifManualCommit = 1 - keyList = 'group.id:cgrp1, enable.auto.commit:true, auto.commit.interval.ms:200, auto.offset.reset:earliest' + keyList = 'group.id:cgrp4, 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 0") @@ -216,7 +216,7 @@ class TDTestCase: actConsumeTotalRows = resultList[0] - if not (actConsumeTotalRows > 0 and actConsumeTotalRows < totalRowsInserted): + if not (actConsumeTotalRows > 0 and actConsumeTotalRows <= totalRowsInserted): tdLog.info("act consume rows: %d"%(actConsumeTotalRows)) tdLog.info("and second consume rows should be between 0 and %d"%(totalRowsInserted)) tdLog.exit("%d tmq consume rows error!"%consumerId) diff --git a/tests/system-test/7-tmq/tmqConsFromTsdb1.py b/tests/system-test/7-tmq/tmqConsFromTsdb1.py index b910caf420de5efd6fef315e220920599f946435..4bb6cf463f59519565f43e04e18d7d7902b73108 100644 --- a/tests/system-test/7-tmq/tmqConsFromTsdb1.py +++ b/tests/system-test/7-tmq/tmqConsFromTsdb1.py @@ -41,7 +41,7 @@ class TDTestCase: 'ctbStartIdx': 0, 'ctbNum': 10, 'rowsPerTbl': 10000, - 'batchNum': 10, + 'batchNum': 100, 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 'pollDelay': 3, 'showMsg': 1, @@ -87,7 +87,7 @@ class TDTestCase: 'rowsPerTbl': 10000, 'batchNum': 10, 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 - 'pollDelay': 25, + 'pollDelay': 10, 'showMsg': 1, 'showRow': 1, 'snapshot': 1} @@ -116,7 +116,7 @@ class TDTestCase: topicList = topicNameList[0] ifcheckdata = 1 ifManualCommit = 1 - keyList = 'group.id:cgrp1, enable.auto.commit:true, auto.commit.interval.ms:200, auto.offset.reset:earliest' + keyList = 'group.id:cgrp3, enable.auto.commit:true, auto.commit.interval.ms:200, auto.offset.reset:earliest' tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit) consumerId = 4 @@ -131,8 +131,8 @@ class TDTestCase: resultList = tmqCom.selectConsumeResult(expectRows) actConsumeTotalRows = resultList[0] + resultList[1] + tdLog.info("sum of two consume rows: %d should be equal to total inserted rows: %d"%(actConsumeTotalRows, totalRowsInserted)) if not (totalRowsInserted == actConsumeTotalRows): - tdLog.info("sum of two consume rows: %d should be equal to total inserted rows: %d"%(actConsumeTotalRows, totalRowsInserted)) tdLog.exit("%d tmq consume rows error!"%consumerId) time.sleep(10) @@ -188,7 +188,7 @@ class TDTestCase: topicList = topicNameList[0] ifcheckdata = 1 ifManualCommit = 1 - keyList = 'group.id:cgrp1, enable.auto.commit:true, auto.commit.interval.ms:200, auto.offset.reset:earliest' + keyList = 'group.id:cgrp4, 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 0") @@ -213,12 +213,11 @@ class TDTestCase: expectRows = 1 resultList = tmqCom.selectConsumeResult(expectRows) - actConsumeTotalRows = resultList[0] - if not (actConsumeTotalRows > 0 and actConsumeTotalRows < totalRowsInserted): - tdLog.info("act consume rows: %d"%(actConsumeTotalRows)) - tdLog.info("and second consume rows should be between 0 and %d"%(totalRowsInserted)) + tdLog.info("act consume rows: %d"%(actConsumeTotalRows)) + tdLog.info("and second consume rows should be between 0 and %d"%(totalRowsInserted)) + if not ((actConsumeTotalRows > 0) and (actConsumeTotalRows <= totalRowsInserted)): tdLog.exit("%d tmq consume rows error!"%consumerId) time.sleep(10) diff --git a/tests/system-test/7-tmq/tmqDelete-1ctb.py b/tests/system-test/7-tmq/tmqDelete-1ctb.py index 4b45b1a83410437db56b1b9d89f0af3f55c06b01..b09efdd1e6a67ac0312f45e4277302d177ca34a4 100644 --- a/tests/system-test/7-tmq/tmqDelete-1ctb.py +++ b/tests/system-test/7-tmq/tmqDelete-1ctb.py @@ -80,16 +80,16 @@ class TDTestCase: tdLog.debug("del data ............ [OK]") return - def threadFunctionForDeletaData(self, **paraDict): + def threadFunctionForDeletaData(self, paraDict): # create new connector for new tdSql instance in my thread newTdSql = tdCom.newTdSql() self.delData(newTdSql,paraDict["dbName"],paraDict["ctbPrefix"],paraDict["ctbNum"],paraDict["startTs"],paraDict["endTs"],paraDict["ctbStartIdx"]) return - def asyncDeleteData(self, paraDict): - pThread = threading.Thread(target=self.threadFunctionForDeletaData, kwargs=paraDict) - pThread.start() - return pThread + # def asyncDeleteData(self, paraDict): + # pThread = threading.Thread(target=self.threadFunctionForDeletaData, kwargs=paraDict) + # pThread.start() + # return pThread def tmqCase1(self): tdLog.printNoPrefix("======== test case 1: ") @@ -109,7 +109,7 @@ class TDTestCase: 'batchNum': 3000, 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 'endTs': 0, - 'pollDelay': 5, + 'pollDelay': 15, 'showMsg': 1, 'showRow': 1, 'snapshot': 0} @@ -194,7 +194,7 @@ class TDTestCase: 'rowsPerTbl': 10000, 'batchNum': 5000, 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 - 'pollDelay': 5, + 'pollDelay': 15, 'showMsg': 1, 'showRow': 1, 'snapshot': 0} @@ -296,7 +296,7 @@ class TDTestCase: 'rowsPerTbl': 10000, 'batchNum': 5000, 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 - 'pollDelay': 5, + 'pollDelay': 15, 'showMsg': 1, 'showRow': 1, 'snapshot': 0} @@ -340,7 +340,8 @@ class TDTestCase: # del some data rowsOfDelete = int(self.rowsPerTbl / 4 ) paraDict["endTs"] = paraDict["startTs"] + rowsOfDelete - 1 - pDeleteThread = self.asyncDeleteData(paraDict) + # pDeleteThread = self.asyncDeleteData(paraDict) + self.threadFunctionForDeletaData(paraDict) tdLog.info("start consume processor") tmqCom.startTmqSimProcess(pollDelay=paraDict['pollDelay'],dbName=paraDict["dbName"],showMsg=paraDict['showMsg'], showRow=paraDict['showRow'],snapshot=paraDict['snapshot']) diff --git a/tests/system-test/7-tmq/tmqUpdate-multiCtb-snapshot0.py b/tests/system-test/7-tmq/tmqUpdate-multiCtb-snapshot0.py index daffff44c1cf0dda7c4ecf5ac2dfd3dadfdf5504..e2ba47c3fd1a6280bd3dfdc47030f261ce6c2bc5 100644 --- a/tests/system-test/7-tmq/tmqUpdate-multiCtb-snapshot0.py +++ b/tests/system-test/7-tmq/tmqUpdate-multiCtb-snapshot0.py @@ -128,7 +128,7 @@ class TDTestCase: ifManualCommit = 1 keyList = 'group.id:cgrp1,\ enable.auto.commit:true,\ - auto.commit.interval.ms:1000,\ + auto.commit.interval.ms:200,\ auto.offset.reset:earliest' tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit) diff --git a/tests/system-test/test-win.bat b/tests/system-test/test-win.bat new file mode 100644 index 0000000000000000000000000000000000000000..662adf3987a254c62da0fb68708e7b0d48cdfb21 --- /dev/null +++ b/tests/system-test/test-win.bat @@ -0,0 +1,96 @@ +@echo off +SETLOCAL EnableDelayedExpansion +for /F "tokens=1,2 delims=#" %%a in ('"prompt #$H#$E# & echo on & for %%b in (1) do rem"') do ( set "DEL=%%a") +set /a a=0 +if "%1" == "full" ( + echo Windows Taosd Full Test + set /a exitNum=0 + del /Q /F failed.txt + set caseFile="win-test-file" + if not "%2" == "" ( + set caseFile="%2" + ) + for /F "usebackq tokens=*" %%i in (!caseFile!) do ( + call :CheckSkipCase %%i + if !skipCase! == false ( + set line=%%i + if "!line:~,7!" == "python3" ( + set /a a+=1 + echo !a! Processing %%i + call :GetTimeSeconds !time! + set time1=!_timeTemp! + echo Start at !time! + call %%i ARG1 > result_!a!.txt 2>error_!a!.txt || set errorlevel=8 + if errorlevel 1 ( call :colorEcho 0c "failed" &echo. && set /a exitNum=8 && echo %%i >>failed.txt ) else ( call :colorEcho 0a "Success" &echo. ) + ) + ) + ) + exit /b !exitNum! +) +echo Windows Taosd Test +for /F "usebackq tokens=*" %%i in (win-test-file) do ( + for /f "tokens=1* delims= " %%a in ("%%i") do if not "%%a" == "@REM" ( + set /a a+=1 + set timeNow=!time! + echo !a! Processing %%i + call :GetTimeSeconds !timeNow! + set time1=!_timeTemp! + echo Start at !timeNow! + call %%i ARG1 > result_!a!.txt 2>error_!a!.txt || set errorlevel=8 + if errorlevel 1 ( call :colorEcho 0c "failed" &echo. && echo result: && cat result_!a!.txt && echo error: && cat error_!a!.txt && exit /b 8 ) else ( call :colorEcho 0a "Success" &echo. ) + ) +) +@REM echo Linux Taosd Test +@REM for /F "usebackq tokens=*" %%i in (simpletest.bat) do ( +@REM for /f "tokens=1* delims= " %%a in ("%%i") do if not "%%a" == "@REM" ( +@REM set /a a+=1 +@REM echo !a! Processing %%i +@REM call :GetTimeSeconds !time! +@REM set time1=!_timeTemp! +@REM echo Start at !time! +@REM call %%i ARG1 -m %1 > result_!a!.txt 2>error_!a!.txt +@REM if errorlevel 1 ( call :colorEcho 0c "failed" &echo. && echo result: && cat result_!a!.txt && echo error: && cat error_!a!.txt && exit 8 ) else ( call :colorEcho 0a "Success" &echo. ) +@REM ) +@REM ) +exit /b + +:colorEcho +set timeNow=%time% +call :GetTimeSeconds %timeNow% +set time2=%_timeTemp% +set /a interTime=%time2% - %time1% +echo End at %timeNow% , cast %interTime%s +echo off + "%~2" +findstr /v /a:%1 /R "^$" "%~2" nul +del "%~2" > nul 2>&1i +goto :eof + +:GetTimeSeconds +set tt=%1 +set tt=%tt:.= % +set tt=%tt::= % +set tt=%tt: 0= % +set /a index=1 +for %%a in (%tt%) do ( + if !index! EQU 1 ( + set /a hh=%%a + )^ + else if !index! EQU 2 ( + set /a mm=%%a + + )^ + else if !index! EQU 3 ( + set /a ss=%%a + ) + set /a index=index+1 +) +set /a _timeTemp=(%hh%*60+%mm%)*60+%ss% +goto :eof + +:CheckSkipCase +set skipCase=false +if "%*" == "python3 ./test.py -f 1-insert/insertWithMoreVgroup.py" ( set skipCase=false ) +if "%*" == "python3 ./test.py -f 2-query/queryQnode.py" ( set skipCase=false ) +echo %* | grep "\-R" && set skipCase=true +:goto eof \ No newline at end of file diff --git a/tests/system-test/test.py b/tests/system-test/test.py index 0c62c182f70eda8e20a7c5d91ebe360bfa2475ad..bc7f1d9861c6128de2bcbef00ddd2c77c0df5a33 100644 --- a/tests/system-test/test.py +++ b/tests/system-test/test.py @@ -291,9 +291,9 @@ if __name__ == "__main__": print(r) else: pass - if restful: - tAdapter.init(deployPath, masterIp) - tAdapter.stop(force_kill=True) + # if restful: + tAdapter.init(deployPath, masterIp) + tAdapter.stop(force_kill=True) if dnodeNums == 1 : tdDnodes.deploy(1,updateCfgDict) @@ -306,7 +306,7 @@ if __name__ == "__main__": if queryPolicy != 1: queryPolicy=int(queryPolicy) if restful: - conn = taosrest.connect(url=f"http://{host}:6041") + conn = taosrest.connect(url=f"http://{host}:6041",timezone="utc") else: conn = taos.connect(host,config=tdDnodes.getSimCfgPath()) @@ -343,7 +343,7 @@ if __name__ == "__main__": if not restful: conn = taos.connect(host,config=tdDnodes.getSimCfgPath()) else: - conn = taosrest.connect(url=f"http://{host}:6041") + conn = taosrest.connect(url=f"http://{host}:6041",timezone="utc") # tdLog.info(tdDnodes.getSimCfgPath(),host) if createDnodeNums == 1: createDnodeNums=dnodeNums @@ -359,7 +359,7 @@ if __name__ == "__main__": if queryPolicy != 1: queryPolicy=int(queryPolicy) if restful: - conn = taosrest.connect(url=f"http://{host}:6041") + conn = taosrest.connect(url=f"http://{host}:6041",timezone="utc") else: conn = taos.connect(host,config=tdDnodes.getSimCfgPath()) @@ -382,11 +382,44 @@ if __name__ == "__main__": if not restful: conn = taos.connect(host="%s"%(host), config=tdDnodes.sim.getCfgDir()) else: - conn = taosrest.connect(url=f"http://{host}:6041") - if is_test_framework: - tdCases.runOneWindows(conn, fileName) + conn = taosrest.connect(url=f"http://{host}:6041",timezone="utc") + + if testCluster: + tdLog.info("Procedures for testing cluster") + if fileName == "all": + tdCases.runAllCluster() + else: + tdCases.runOneCluster(fileName) else: - tdCases.runAllWindows(conn) + tdLog.info("Procedures for testing self-deployment") + if not restful: + conn = taos.connect(host,config=tdDnodes.getSimCfgPath()) + else: + conn = taosrest.connect(url=f"http://{host}:6041",timezone="utc") + + if fileName == "all": + tdCases.runAllWindows(conn) + else: + tdCases.runOneWindows(conn, fileName, replicaVar) + + if restart: + if fileName == "all": + tdLog.info("not need to query ") + else: + sp = fileName.rsplit(".", 1) + if len(sp) == 2 and sp[1] == "py": + tdDnodes.stopAll() + tdDnodes.start(1) + time.sleep(1) + if not restful: + conn = taos.connect( host, config=tdDnodes.getSimCfgPath()) + else: + conn = taosrest.connect(url=f"http://{host}:6041",timezone="utc") + tdLog.info("Procedures for tdengine deployed in %s" % (host)) + tdLog.info("query test after taosd restart") + tdCases.runOneWindows(conn, sp[0] + "_" + "restart.py", replicaVar) + else: + tdLog.info("not need to query") else: tdDnodes.setKillValgrind(killValgrind) tdDnodes.init(deployPath, masterIp) @@ -431,7 +464,7 @@ if __name__ == "__main__": if not restful: conn = taos.connect(host,config=tdDnodes.getSimCfgPath()) else: - conn = taosrest.connect(url=f"http://{host}:6041") + conn = taosrest.connect(url=f"http://{host}:6041",timezone="utc") # tdSql.init(conn.cursor()) # tdSql.execute("create qnode on dnode 1") # tdSql.execute('alter local "queryPolicy" "%d"'%queryPolicy) @@ -479,7 +512,7 @@ if __name__ == "__main__": if not restful: conn = taos.connect(host,config=tdDnodes.getSimCfgPath()) else: - conn = taosrest.connect(url=f"http://{host}:6041") + conn = taosrest.connect(url=f"http://{host}:6041",timezone="utc") print(tdDnodes.getSimCfgPath(),host) if createDnodeNums == 1: createDnodeNums=dnodeNums @@ -497,7 +530,7 @@ if __name__ == "__main__": if queryPolicy != 1: queryPolicy=int(queryPolicy) if restful: - conn = taosrest.connect(url=f"http://{host}:6041") + conn = taosrest.connect(url=f"http://{host}:6041",timezone="utc") else: conn = taos.connect(host,config=tdDnodes.getSimCfgPath()) @@ -526,7 +559,7 @@ if __name__ == "__main__": if not restful: conn = taos.connect(host,config=tdDnodes.getSimCfgPath()) else: - conn = taosrest.connect(url=f"http://{host}:6041") + conn = taosrest.connect(url=f"http://{host}:6041",timezone="utc") if fileName == "all": tdCases.runAllLinux(conn) @@ -545,7 +578,7 @@ if __name__ == "__main__": if not restful: conn = taos.connect( host, config=tdDnodes.getSimCfgPath()) else: - conn = taosrest.connect(url=f"http://{host}:6041") + conn = taosrest.connect(url=f"http://{host}:6041",timezone="utc") tdLog.info("Procedures for tdengine deployed in %s" % (host)) tdLog.info("query test after taosd restart") tdCases.runOneLinux(conn, sp[0] + "_" + "restart.py", replicaVar) diff --git a/tests/system-test/win-test-file b/tests/system-test/win-test-file new file mode 100644 index 0000000000000000000000000000000000000000..7e68c40fd8b355d3d3cd40161bb2df09886e8570 --- /dev/null +++ b/tests/system-test/win-test-file @@ -0,0 +1,637 @@ +python3 ./test.py -f 1-insert/database_pre_suf.py +python3 ./test.py -f 0-others/balance_vgroups_r1.py -N 6 +python3 ./test.py -f 0-others/taosShell.py +python3 ./test.py -f 0-others/taosShellError.py +python3 ./test.py -f 0-others/taosShellNetChk.py +python3 ./test.py -f 0-others/telemetry.py +python3 ./test.py -f 0-others/backquote_check.py +python3 ./test.py -f 0-others/taosdMonitor.py +python3 ./test.py -f 0-others/taosdShell.py -N 5 -M 3 -Q 3 +python3 ./test.py -f 0-others/cachemodel.py +python3 ./test.py -f 0-others/sysinfo.py +python3 ./test.py -f 0-others/user_control.py +python3 ./test.py -f 0-others/user_manage.py +python3 ./test.py -f 0-others/fsync.py +python3 ./test.py -f 0-others/compatibility.py +python3 ./test.py -f 0-others/tag_index_basic.py +# python3 ./test.py -f 1-insert/alter_database.py +python3 ./test.py -f 1-insert/influxdb_line_taosc_insert.py +python3 ./test.py -f 1-insert/opentsdb_telnet_line_taosc_insert.py +python3 ./test.py -f 1-insert/opentsdb_json_taosc_insert.py +python3 ./test.py -f 1-insert/test_stmt_muti_insert_query.py +python3 ./test.py -f 1-insert/test_stmt_set_tbname_tag.py +python3 ./test.py -f 1-insert/alter_stable.py +python3 ./test.py -f 1-insert/alter_table.py +python3 ./test.py -f 1-insert/boundary.py +python3 ./test.py -f 1-insert/insertWithMoreVgroup.py +python3 ./test.py -f 1-insert/table_comment.py +python3 ./test.py -f 1-insert/time_range_wise.py +python3 ./test.py -f 1-insert/block_wise.py +python3 ./test.py -f 1-insert/create_retentions.py +python3 ./test.py -f 1-insert/mutil_stage.py +python3 ./test.py -f 1-insert/table_param_ttl.py +python3 ./test.py -f 1-insert/table_param_ttl.py -R +python3 ./test.py -f 1-insert/update_data_muti_rows.py +python3 ./test.py -f 1-insert/db_tb_name_check.py +python3 ./test.py -f 1-insert/InsertFuturets.py +python3 ./test.py -f 0-others/show.py +python3 ./test.py -f 0-others/information_schema.py +python3 ./test.py -f 2-query/abs.py +python3 ./test.py -f 2-query/abs.py -R +python3 ./test.py -f 2-query/and_or_for_byte.py +python3 ./test.py -f 2-query/and_or_for_byte.py -R +python3 ./test.py -f 2-query/apercentile.py +python3 ./test.py -f 2-query/apercentile.py -R +python3 ./test.py -f 2-query/arccos.py +python3 ./test.py -f 2-query/arccos.py -R +python3 ./test.py -f 2-query/arcsin.py +python3 ./test.py -f 2-query/arcsin.py -R +python3 ./test.py -f 2-query/arctan.py +python3 ./test.py -f 2-query/arctan.py -R +python3 ./test.py -f 2-query/avg.py +python3 ./test.py -f 2-query/avg.py -R +python3 ./test.py -f 2-query/between.py +python3 ./test.py -f 2-query/between.py -R +python3 ./test.py -f 2-query/bottom.py +python3 ./test.py -f 2-query/bottom.py -R +python3 ./test.py -f 2-query/cast.py +python3 ./test.py -f 2-query/cast.py -R +python3 ./test.py -f 2-query/ceil.py +python3 ./test.py -f 2-query/ceil.py -R +python3 ./test.py -f 2-query/char_length.py +python3 ./test.py -f 2-query/char_length.py -R +python3 ./test.py -f 2-query/check_tsdb.py +python3 ./test.py -f 2-query/check_tsdb.py -R +python3 ./test.py -f 2-query/concat.py +python3 ./test.py -f 2-query/concat.py -R +python3 ./test.py -f 2-query/concat_ws.py +python3 ./test.py -f 2-query/concat_ws.py -R +python3 ./test.py -f 2-query/concat_ws2.py +python3 ./test.py -f 2-query/concat_ws2.py -R +python3 ./test.py -f 2-query/cos.py +python3 ./test.py -f 2-query/cos.py -R +python3 ./test.py -f 2-query/count_partition.py +python3 ./test.py -f 2-query/count_partition.py -R +python3 ./test.py -f 2-query/count.py +python3 ./test.py -f 2-query/count.py -R +python3 ./test.py -f 2-query/countAlwaysReturnValue.py +python3 ./test.py -f 2-query/countAlwaysReturnValue.py -R +python3 ./test.py -f 2-query/db.py +python3 ./test.py -f 2-query/db.py -N 3 -n 3 -R +python3 ./test.py -f 2-query/diff.py +python3 ./test.py -f 2-query/diff.py -R +python3 ./test.py -f 2-query/distinct.py +python3 ./test.py -f 2-query/distinct.py -R +python3 ./test.py -f 2-query/distribute_agg_apercentile.py +python3 ./test.py -f 2-query/distribute_agg_apercentile.py -R +python3 ./test.py -f 2-query/distribute_agg_avg.py +python3 ./test.py -f 2-query/distribute_agg_avg.py -R +python3 ./test.py -f 2-query/distribute_agg_count.py +python3 ./test.py -f 2-query/distribute_agg_count.py -R +python3 ./test.py -f 2-query/distribute_agg_max.py +python3 ./test.py -f 2-query/distribute_agg_max.py -R +python3 ./test.py -f 2-query/distribute_agg_min.py +python3 ./test.py -f 2-query/distribute_agg_min.py -R +python3 ./test.py -f 2-query/distribute_agg_spread.py +python3 ./test.py -f 2-query/distribute_agg_spread.py -R +python3 ./test.py -f 2-query/distribute_agg_stddev.py +python3 ./test.py -f 2-query/distribute_agg_stddev.py -R +python3 ./test.py -f 2-query/distribute_agg_sum.py +python3 ./test.py -f 2-query/distribute_agg_sum.py -R +python3 ./test.py -f 2-query/explain.py +python3 ./test.py -f 2-query/explain.py -R +python3 ./test.py -f 2-query/first.py +python3 ./test.py -f 2-query/first.py -R +python3 ./test.py -f 2-query/floor.py +python3 ./test.py -f 2-query/floor.py -R +python3 ./test.py -f 2-query/function_null.py +python3 ./test.py -f 2-query/function_null.py -R +python3 ./test.py -f 2-query/function_stateduration.py +python3 ./test.py -f 2-query/function_stateduration.py -R +python3 ./test.py -f 2-query/histogram.py +python3 ./test.py -f 2-query/histogram.py -R +python3 ./test.py -f 2-query/hyperloglog.py +python3 ./test.py -f 2-query/hyperloglog.py -R +python3 ./test.py -f 2-query/interp.py +python3 ./test.py -f 2-query/interp.py -R +python3 ./test.py -f 2-query/irate.py +python3 ./test.py -f 2-query/irate.py -R +python3 ./test.py -f 2-query/join.py +python3 ./test.py -f 2-query/join.py -R +python3 ./test.py -f 2-query/last_row.py +python3 ./test.py -f 2-query/last_row.py -R +python3 ./test.py -f 2-query/last.py +python3 ./test.py -f 2-query/last.py -R +python3 ./test.py -f 2-query/leastsquares.py +python3 ./test.py -f 2-query/leastsquares.py -R +python3 ./test.py -f 2-query/length.py +python3 ./test.py -f 2-query/length.py -R +python3 ./test.py -f 2-query/limit.py +python3 ./test.py -f 2-query/log.py +python3 ./test.py -f 2-query/log.py -R +python3 ./test.py -f 2-query/lower.py +python3 ./test.py -f 2-query/lower.py -R +python3 ./test.py -f 2-query/ltrim.py +python3 ./test.py -f 2-query/ltrim.py -R +python3 ./test.py -f 2-query/mavg.py +python3 ./test.py -f 2-query/mavg.py -R +python3 ./test.py -f 2-query/max_partition.py +python3 ./test.py -f 2-query/max_partition.py -R +python3 ./test.py -f 2-query/max_min_last_interval.py +python3 ./test.py -f 2-query/max.py +python3 ./test.py -f 2-query/max.py -R +python3 ./test.py -f 2-query/min.py +python3 ./test.py -f 2-query/min.py -R +python3 ./test.py -f 2-query/mode.py +python3 ./test.py -f 2-query/mode.py -R +python3 ./test.py -f 2-query/Now.py +python3 ./test.py -f 2-query/Now.py -R +python3 ./test.py -f 2-query/percentile.py +python3 ./test.py -f 2-query/percentile.py -R +python3 ./test.py -f 2-query/pow.py +python3 ./test.py -f 2-query/pow.py -R +python3 ./test.py -f 2-query/query_cols_tags_and_or.py +python3 ./test.py -f 2-query/query_cols_tags_and_or.py -R +python3 ./test.py -f 2-query/round.py +python3 ./test.py -f 2-query/round.py -R +python3 ./test.py -f 2-query/rtrim.py +python3 ./test.py -f 2-query/rtrim.py -R +python3 ./test.py -f 2-query/sample.py +python3 ./test.py -f 2-query/sample.py -R +python3 ./test.py -f 2-query/sin.py +python3 ./test.py -f 2-query/sin.py -R +python3 ./test.py -f 2-query/smaTest.py +python3 ./test.py -f 2-query/smaTest.py -R +python3 ./test.py -f 2-query/sml.py +python3 ./test.py -f 2-query/sml.py -R +python3 ./test.py -f 2-query/spread.py +python3 ./test.py -f 2-query/spread.py -R +python3 ./test.py -f 2-query/sqrt.py +python3 ./test.py -f 2-query/sqrt.py -R +python3 ./test.py -f 2-query/statecount.py +python3 ./test.py -f 2-query/statecount.py -R +python3 ./test.py -f 2-query/stateduration.py +python3 ./test.py -f 2-query/stateduration.py -R +python3 ./test.py -f 2-query/substr.py +python3 ./test.py -f 2-query/substr.py -R +python3 ./test.py -f 2-query/sum.py +python3 ./test.py -f 2-query/sum.py -R +python3 ./test.py -f 2-query/tail.py +python3 ./test.py -f 2-query/tail.py -R +python3 ./test.py -f 2-query/tan.py +python3 ./test.py -f 2-query/tan.py -R +python3 ./test.py -f 2-query/Timediff.py +python3 ./test.py -f 2-query/Timediff.py -R +python3 ./test.py -f 2-query/timetruncate.py +python3 ./test.py -f 2-query/timetruncate.py -R +python3 ./test.py -f 2-query/timezone.py +python3 ./test.py -f 2-query/timezone.py -R +python3 ./test.py -f 2-query/To_iso8601.py +python3 ./test.py -f 2-query/To_iso8601.py -R +python3 ./test.py -f 2-query/To_unixtimestamp.py +python3 ./test.py -f 2-query/To_unixtimestamp.py -R +python3 ./test.py -f 2-query/Today.py +python3 ./test.py -f 2-query/Today.py -R +python3 ./test.py -f 2-query/top.py +python3 ./test.py -f 2-query/top.py -R +python3 ./test.py -f 2-query/tsbsQuery.py +python3 ./test.py -f 2-query/tsbsQuery.py -R +python3 ./test.py -f 2-query/ttl_comment.py +python3 ./test.py -f 2-query/ttl_comment.py -R +python3 ./test.py -f 2-query/twa.py +python3 ./test.py -f 2-query/twa.py -R +python3 ./test.py -f 2-query/union.py +python3 ./test.py -f 2-query/union.py -R +python3 ./test.py -f 2-query/unique.py +python3 ./test.py -f 2-query/unique.py -R +python3 ./test.py -f 2-query/upper.py +python3 ./test.py -f 2-query/upper.py -R +python3 ./test.py -f 2-query/varchar.py +python3 ./test.py -f 2-query/varchar.py -R +python3 ./test.py -f 2-query/case_when.py +python3 ./test.py -f 2-query/case_when.py -R +python3 ./test.py -f 2-query/blockSMA.py +python3 ./test.py -f 2-query/blockSMA.py -R +python3 ./test.py -f 1-insert/update_data.py +python3 ./test.py -f 1-insert/tb_100w_data_order.py +python3 ./test.py -f 1-insert/delete_stable.py +python3 ./test.py -f 1-insert/delete_childtable.py +python3 ./test.py -f 1-insert/delete_normaltable.py +python3 ./test.py -f 1-insert/keep_expired.py +python3 ./test.py -f 1-insert/drop.py +python3 ./test.py -f 1-insert/drop.py -N 3 -M 3 -i False -n 3 +python3 ./test.py -f 2-query/join2.py +python3 ./test.py -f 2-query/union1.py +python3 ./test.py -f 2-query/concat2.py +python3 ./test.py -f 2-query/json_tag.py +python3 ./test.py -f 2-query/nestedQuery.py +python3 ./test.py -f 2-query/nestedQueryInterval.py +python3 ./test.py -f 2-query/nestedQuery_str.py +python3 ./test.py -f 2-query/nestedQuery_math.py +python3 ./test.py -f 2-query/nestedQuery_time.py +python3 ./test.py -f 2-query/stablity.py +python3 ./test.py -f 2-query/stablity_1.py +python3 ./test.py -f 2-query/elapsed.py +python3 ./test.py -f 2-query/csum.py +python3 ./test.py -f 2-query/function_diff.py +python3 ./test.py -f 2-query/tagFilter.py +python3 ./test.py -f 2-query/queryQnode.py +python3 ./test.py -f 6-cluster/5dnode1mnode.py +python3 ./test.py -f 6-cluster/5dnode2mnode.py -N 5 +python3 ./test.py -f 6-cluster/5dnode3mnodeStop.py -N 5 -M 3 +python3 ./test.py -f 6-cluster/5dnode3mnodeStop.py -N 5 -M 3 -i False +python3 ./test.py -f 6-cluster/5dnode3mnodeStop2Follower.py -N 5 -M 3 +python3 ./test.py -f 6-cluster/5dnode3mnodeStop2Follower.py -N 5 -M 3 -i False +python3 ./test.py -f 6-cluster/5dnode3mnodeStopLoop.py -N 5 -M 3 +python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateDb.py -N 6 -M 3 +python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateDb.py -N 6 -M 3 -n 3 +python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateDb.py -N 6 -M 3 +python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateDb.py -N 6 -M 3 -n 3 +python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateDb.py -N 6 -M 3 +python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateDb.py -N 6 -M 3 -n 3 +python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopDnodeModifyMeta.py -N 6 -M 3 +python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopMnodeModifyMeta.py -N 6 -M 3 +python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateStb.py -N 6 -M 3 +python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateStb.py -N 6 -M 3 -n 3 +python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateStb.py -N 6 -M 3 +python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateStb.py -N 6 -M 3 -n 3 +python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateStb.py -N 6 -M 3 +python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateStb.py -N 6 -M 3 -n 3 +python3 ./test.py -f 6-cluster/5dnode3mnodeRestartDnodeInsertData.py -N 6 -M 3 +python3 ./test.py -f 6-cluster/5dnode3mnodeRestartDnodeInsertData.py -N 6 -M 3 -n 3 +python3 ./test.py -f 6-cluster/5dnode3mnodeAdd1Ddnoe.py -N 7 -M 3 -C 6 +python3 ./test.py -f 6-cluster/5dnode3mnodeAdd1Ddnoe.py -N 7 -M 3 -C 6 -n 3 +python3 ./test.py -f 6-cluster/5dnode3mnodeRecreateMnode.py -N 5 -M 3 +python3 ./test.py -f 6-cluster/5dnode3mnodeStopFollowerLeader.py -N 5 -M 3 +python3 ./test.py -f 6-cluster/5dnode3mnodeStop2Follower.py -N 5 -M 3 +python3 ./test.py -f 6-cluster/vnode/4dnode1mnode_basic_createDb_replica1.py -N 4 -M 1 +python3 ./test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica1_insertdatas.py -N 4 -M 1 +python3 ./test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica1_insertdatas_querys.py -N 4 -M 1 +python3 ./test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas.py -N 4 -M 1 +python3 ./test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_querys.py -N 4 -M 1 +python3 ./test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica3_vgroups.py -N 4 -M 1 +python3 ./test.py -f 7-tmq/create_wrong_topic.py +python3 ./test.py -f 7-tmq/dropDbR3ConflictTransaction.py -N 3 +python3 ./test.py -f 7-tmq/basic5.py +python3 ./test.py -f 7-tmq/subscribeDb.py -N 3 -n 3 +python3 ./test.py -f 7-tmq/subscribeDb0.py -N 3 -n 3 +python3 ./test.py -f 7-tmq/subscribeDb1.py +python3 ./test.py -f 7-tmq/subscribeDb2.py +python3 ./test.py -f 7-tmq/subscribeDb3.py +python3 ./test.py -f 7-tmq/subscribeDb4.py +python3 ./test.py -f 7-tmq/subscribeStb.py +python3 ./test.py -f 7-tmq/subscribeStb0.py +python3 ./test.py -f 7-tmq/subscribeStb1.py +python3 ./test.py -f 7-tmq/subscribeStb2.py +python3 ./test.py -f 7-tmq/subscribeStb3.py +python3 ./test.py -f 7-tmq/subscribeStb4.py +python3 ./test.py -f 7-tmq/db.py +python3 ./test.py -f 7-tmq/tmqError.py +python3 ./test.py -f 7-tmq/schema.py +python3 ./test.py -f 7-tmq/stbFilter.py +python3 ./test.py -f 7-tmq/tmqCheckData.py +python3 ./test.py -f 7-tmq/tmqCheckData1.py +python3 ./test.py -f 7-tmq/tmqConsumerGroup.py +python3 ./test.py -f 7-tmq/tmqShow.py +python3 ./test.py -f 7-tmq/tmqAlterSchema.py +python3 ./test.py -f 7-tmq/tmqConsFromTsdb.py -N 3 -n 3 +python3 ./test.py -f 7-tmq/tmqConsFromTsdb1.py -N 3 -n 3 +python3 ./test.py -f 7-tmq/tmqConsFromTsdb-mutilVg.py +python3 ./test.py -f 7-tmq/tmqConsFromTsdb1-mutilVg.py +python3 ./test.py -f 7-tmq/tmqConsFromTsdb-1ctb.py +python3 ./test.py -f 7-tmq/tmqConsFromTsdb1-1ctb.py +python3 ./test.py -f 7-tmq/tmqConsFromTsdb-1ctb-funcNFilter.py +python3 ./test.py -f 7-tmq/tmqConsFromTsdb-mutilVg-mutilCtb-funcNFilter.py +python3 ./test.py -f 7-tmq/tmqConsFromTsdb-mutilVg-mutilCtb.py +python3 ./test.py -f 7-tmq/tmqConsFromTsdb1-1ctb-funcNFilter.py +python3 ./test.py -f 7-tmq/tmqConsFromTsdb1-mutilVg-mutilCtb-funcNFilter.py +python3 ./test.py -f 7-tmq/tmqConsFromTsdb1-mutilVg-mutilCtb.py +python3 ./test.py -f 7-tmq/tmqAutoCreateTbl.py +python3 ./test.py -f 7-tmq/tmqDnodeRestart.py +python3 ./test.py -f 7-tmq/tmqDnodeRestart1.py +python3 ./test.py -f 7-tmq/tmqUpdate-1ctb.py +python3 ./test.py -f 7-tmq/tmqUpdateWithConsume.py -N 3 -n 3 +python3 ./test.py -f 7-tmq/tmqUpdate-multiCtb-snapshot0.py +python3 ./test.py -f 7-tmq/tmqUpdate-multiCtb-snapshot1.py +python3 ./test.py -f 7-tmq/tmqDelete-1ctb.py +python3 ./test.py -f 7-tmq/tmqDelete-multiCtb.py -N 3 -n 3 +python3 ./test.py -f 7-tmq/tmqDropStb.py +python3 ./test.py -f 7-tmq/tmqDropStbCtb.py +python3 ./test.py -f 7-tmq/tmqDropNtb-snapshot0.py +python3 ./test.py -f 7-tmq/tmqDropNtb-snapshot1.py +python3 ./test.py -f 7-tmq/stbTagFilter-1ctb.py +python3 ./test.py -f 7-tmq/dataFromTsdbNWal.py +python3 ./test.py -f 7-tmq/dataFromTsdbNWal-multiCtb.py +python3 ./test.py -f 7-tmq/tmq_taosx.py +python3 ./test.py -f 7-tmq/stbTagFilter-multiCtb.py +python3 ./test.py -f 99-TDcase/TD-19201.py +python3 ./test.py -f 99-TDcase/TD-21561.py +python3 ./test.py -f 7-tmq/tmqSubscribeStb-r3.py -N 5 +python3 ./test.py -f 7-tmq/tmq3mnodeSwitch.py -N 6 -M 3 +python3 ./test.py -f 7-tmq/tmq3mnodeSwitch.py -N 6 -M 3 -n 3 +python3 ./test.py -f 2-query/between.py -Q 2 +python3 ./test.py -f 2-query/distinct.py -Q 2 +python3 ./test.py -f 2-query/varchar.py -Q 2 +python3 ./test.py -f 2-query/ltrim.py -Q 2 +python3 ./test.py -f 2-query/rtrim.py -Q 2 +python3 ./test.py -f 2-query/length.py -Q 2 +python3 ./test.py -f 2-query/char_length.py -Q 2 +python3 ./test.py -f 2-query/upper.py -Q 2 +python3 ./test.py -f 2-query/lower.py -Q 2 +python3 ./test.py -f 2-query/join.py -Q 2 +python3 ./test.py -f 2-query/join2.py -Q 2 +python3 ./test.py -f 2-query/cast.py -Q 2 +python3 ./test.py -f 2-query/substr.py -Q 2 +python3 ./test.py -f 2-query/union.py -Q 2 +python3 ./test.py -f 2-query/union1.py -Q 2 +python3 ./test.py -f 2-query/concat.py -Q 2 +python3 ./test.py -f 2-query/concat2.py -Q 2 +python3 ./test.py -f 2-query/concat_ws.py -Q 2 +python3 ./test.py -f 2-query/concat_ws2.py -Q 2 +python3 ./test.py -f 2-query/check_tsdb.py -Q 2 +python3 ./test.py -f 2-query/spread.py -Q 2 +python3 ./test.py -f 2-query/hyperloglog.py -Q 2 +python3 ./test.py -f 2-query/explain.py -Q 2 +python3 ./test.py -f 2-query/leastsquares.py -Q 2 +python3 ./test.py -f 2-query/timezone.py -Q 2 +python3 ./test.py -f 2-query/Now.py -Q 2 +python3 ./test.py -f 2-query/Today.py -Q 2 +python3 ./test.py -f 2-query/max.py -Q 2 +python3 ./test.py -f 2-query/min.py -Q 2 +python3 ./test.py -f 2-query/mode.py -Q 2 +python3 ./test.py -f 2-query/count.py -Q 2 +python3 ./test.py -f 2-query/countAlwaysReturnValue.py -Q 2 +python3 ./test.py -f 2-query/last.py -Q 2 +python3 ./test.py -f 2-query/first.py -Q 2 +python3 ./test.py -f 2-query/To_iso8601.py -Q 2 +python3 ./test.py -f 2-query/To_unixtimestamp.py -Q 2 +python3 ./test.py -f 2-query/timetruncate.py -Q 2 +python3 ./test.py -f 2-query/diff.py -Q 2 +python3 ./test.py -f 2-query/Timediff.py -Q 2 +python3 ./test.py -f 2-query/json_tag.py -Q 2 +python3 ./test.py -f 2-query/top.py -Q 2 +python3 ./test.py -f 2-query/bottom.py -Q 2 +python3 ./test.py -f 2-query/percentile.py -Q 2 +python3 ./test.py -f 2-query/apercentile.py -Q 2 +python3 ./test.py -f 2-query/abs.py -Q 2 +python3 ./test.py -f 2-query/ceil.py -Q 2 +python3 ./test.py -f 2-query/floor.py -Q 2 +python3 ./test.py -f 2-query/round.py -Q 2 +python3 ./test.py -f 2-query/log.py -Q 2 +python3 ./test.py -f 2-query/pow.py -Q 2 +python3 ./test.py -f 2-query/sqrt.py -Q 2 +python3 ./test.py -f 2-query/sin.py -Q 2 +python3 ./test.py -f 2-query/cos.py -Q 2 +python3 ./test.py -f 2-query/tan.py -Q 2 +python3 ./test.py -f 2-query/arcsin.py -Q 2 +python3 ./test.py -f 2-query/arccos.py -Q 2 +python3 ./test.py -f 2-query/arctan.py -Q 2 +python3 ./test.py -f 2-query/query_cols_tags_and_or.py -Q 2 +python3 ./test.py -f 2-query/interp.py -Q 2 +python3 ./test.py -f 2-query/nestedQuery.py -Q 2 +python3 ./test.py -f 2-query/nestedQueryInterval.py -Q 2 +python3 ./test.py -f 2-query/nestedQuery_str.py -Q 2 +python3 ./test.py -f 2-query/nestedQuery_math.py -Q 2 +python3 ./test.py -f 2-query/nestedQuery_time.py -Q 2 +python3 ./test.py -f 2-query/stablity.py -Q 2 +python3 ./test.py -f 2-query/stablity_1.py -Q 2 +python3 ./test.py -f 2-query/avg.py -Q 2 +python3 ./test.py -f 2-query/elapsed.py -Q 2 +python3 ./test.py -f 2-query/csum.py -Q 2 +python3 ./test.py -f 2-query/mavg.py -Q 2 +python3 ./test.py -f 2-query/sample.py -Q 2 +python3 ./test.py -f 2-query/function_diff.py -Q 2 +python3 ./test.py -f 2-query/unique.py -Q 2 +python3 ./test.py -f 2-query/stateduration.py -Q 2 +python3 ./test.py -f 2-query/function_stateduration.py -Q 2 +python3 ./test.py -f 2-query/statecount.py -Q 2 +python3 ./test.py -f 2-query/tail.py -Q 2 +python3 ./test.py -f 2-query/ttl_comment.py -Q 2 +python3 ./test.py -f 2-query/distribute_agg_count.py -Q 2 +python3 ./test.py -f 2-query/distribute_agg_max.py -Q 2 +python3 ./test.py -f 2-query/distribute_agg_min.py -Q 2 +python3 ./test.py -f 2-query/distribute_agg_sum.py -Q 2 +python3 ./test.py -f 2-query/distribute_agg_spread.py -Q 2 +python3 ./test.py -f 2-query/distribute_agg_apercentile.py -Q 2 +python3 ./test.py -f 2-query/distribute_agg_avg.py -Q 2 +python3 ./test.py -f 2-query/distribute_agg_stddev.py -Q 2 +python3 ./test.py -f 2-query/twa.py -Q 2 +python3 ./test.py -f 2-query/irate.py -Q 2 +python3 ./test.py -f 2-query/function_null.py -Q 2 +python3 ./test.py -f 2-query/count_partition.py -Q 2 +python3 ./test.py -f 2-query/max_partition.py -Q 2 +python3 ./test.py -f 2-query/max_min_last_interval.py -Q 2 +python3 ./test.py -f 2-query/last_row.py -Q 2 +python3 ./test.py -f 2-query/tsbsQuery.py -Q 2 +python3 ./test.py -f 2-query/sml.py -Q 2 +python3 ./test.py -f 2-query/case_when.py -Q 2 +python3 ./test.py -f 2-query/blockSMA.py -Q 2 +python3 ./test.py -f 99-TDcase/TD-21561.py -Q 2 +python3 ./test.py -f 2-query/between.py -Q 3 +python3 ./test.py -f 2-query/distinct.py -Q 3 +python3 ./test.py -f 2-query/varchar.py -Q 3 +python3 ./test.py -f 2-query/ltrim.py -Q 3 +python3 ./test.py -f 2-query/rtrim.py -Q 3 +python3 ./test.py -f 2-query/length.py -Q 3 +python3 ./test.py -f 2-query/char_length.py -Q 3 +python3 ./test.py -f 2-query/upper.py -Q 3 +python3 ./test.py -f 2-query/lower.py -Q 3 +python3 ./test.py -f 2-query/join.py -Q 3 +python3 ./test.py -f 2-query/join2.py -Q 3 +python3 ./test.py -f 2-query/cast.py -Q 3 +python3 ./test.py -f 2-query/substr.py -Q 3 +python3 ./test.py -f 2-query/union.py -Q 3 +python3 ./test.py -f 2-query/union1.py -Q 3 +python3 ./test.py -f 2-query/concat.py -Q 3 +python3 ./test.py -f 2-query/concat2.py -Q 3 +python3 ./test.py -f 2-query/concat_ws.py -Q 3 +python3 ./test.py -f 2-query/concat_ws2.py -Q 3 +python3 ./test.py -f 2-query/check_tsdb.py -Q 3 +python3 ./test.py -f 2-query/spread.py -Q 3 +python3 ./test.py -f 2-query/hyperloglog.py -Q 3 +python3 ./test.py -f 2-query/explain.py -Q 3 +python3 ./test.py -f 2-query/leastsquares.py -Q 3 +python3 ./test.py -f 2-query/timezone.py -Q 3 +python3 ./test.py -f 2-query/Now.py -Q 3 +python3 ./test.py -f 2-query/Today.py -Q 3 +python3 ./test.py -f 2-query/max.py -Q 3 +python3 ./test.py -f 2-query/min.py -Q 3 +python3 ./test.py -f 2-query/mode.py -Q 3 +python3 ./test.py -f 2-query/count.py -Q 3 +python3 ./test.py -f 2-query/countAlwaysReturnValue.py -Q 3 +python3 ./test.py -f 2-query/last.py -Q 3 +python3 ./test.py -f 2-query/first.py -Q 3 +python3 ./test.py -f 2-query/To_iso8601.py -Q 3 +python3 ./test.py -f 2-query/To_unixtimestamp.py -Q 3 +python3 ./test.py -f 2-query/timetruncate.py -Q 3 +python3 ./test.py -f 2-query/diff.py -Q 3 +python3 ./test.py -f 2-query/Timediff.py -Q 3 +python3 ./test.py -f 2-query/json_tag.py -Q 3 +python3 ./test.py -f 2-query/top.py -Q 3 +python3 ./test.py -f 2-query/bottom.py -Q 3 +python3 ./test.py -f 2-query/percentile.py -Q 3 +python3 ./test.py -f 2-query/apercentile.py -Q 3 +python3 ./test.py -f 2-query/abs.py -Q 3 +python3 ./test.py -f 2-query/ceil.py -Q 3 +python3 ./test.py -f 2-query/floor.py -Q 3 +python3 ./test.py -f 2-query/round.py -Q 3 +python3 ./test.py -f 2-query/log.py -Q 3 +python3 ./test.py -f 2-query/pow.py -Q 3 +python3 ./test.py -f 2-query/sqrt.py -Q 3 +python3 ./test.py -f 2-query/sin.py -Q 3 +python3 ./test.py -f 2-query/cos.py -Q 3 +python3 ./test.py -f 2-query/tan.py -Q 3 +python3 ./test.py -f 2-query/arcsin.py -Q 3 +python3 ./test.py -f 2-query/arccos.py -Q 3 +python3 ./test.py -f 2-query/arctan.py -Q 3 +python3 ./test.py -f 2-query/query_cols_tags_and_or.py -Q 3 +python3 ./test.py -f 2-query/nestedQueryInterval.py -Q 3 +python3 ./test.py -f 2-query/stablity.py -Q 3 +python3 ./test.py -f 2-query/stablity_1.py -Q 3 +python3 ./test.py -f 2-query/avg.py -Q 3 +python3 ./test.py -f 2-query/elapsed.py -Q 3 +python3 ./test.py -f 2-query/csum.py -Q 3 +python3 ./test.py -f 2-query/mavg.py -Q 3 +python3 ./test.py -f 2-query/sample.py -Q 3 +python3 ./test.py -f 2-query/function_diff.py -Q 3 +python3 ./test.py -f 2-query/unique.py -Q 3 +python3 ./test.py -f 2-query/stateduration.py -Q 3 +python3 ./test.py -f 2-query/function_stateduration.py -Q 3 +python3 ./test.py -f 2-query/statecount.py -Q 3 +python3 ./test.py -f 2-query/tail.py -Q 3 +python3 ./test.py -f 2-query/ttl_comment.py -Q 3 +python3 ./test.py -f 2-query/distribute_agg_count.py -Q 3 +python3 ./test.py -f 2-query/distribute_agg_max.py -Q 3 +python3 ./test.py -f 2-query/distribute_agg_min.py -Q 3 +python3 ./test.py -f 2-query/distribute_agg_sum.py -Q 3 +python3 ./test.py -f 2-query/distribute_agg_spread.py -Q 3 +python3 ./test.py -f 2-query/distribute_agg_apercentile.py -Q 3 +python3 ./test.py -f 2-query/distribute_agg_avg.py -Q 3 +python3 ./test.py -f 2-query/distribute_agg_stddev.py -Q 3 +python3 ./test.py -f 2-query/twa.py -Q 3 +python3 ./test.py -f 2-query/irate.py -Q 3 +python3 ./test.py -f 2-query/function_null.py -Q 3 +python3 ./test.py -f 2-query/count_partition.py -Q 3 +python3 ./test.py -f 2-query/max_partition.py -Q 3 +python3 ./test.py -f 2-query/max_min_last_interval.py -Q 3 +python3 ./test.py -f 2-query/last_row.py -Q 3 +python3 ./test.py -f 2-query/tsbsQuery.py -Q 3 +python3 ./test.py -f 2-query/sml.py -Q 3 +python3 ./test.py -f 2-query/interp.py -Q 3 +python3 ./test.py -f 2-query/case_when.py -Q 3 +python3 ./test.py -f 2-query/blockSMA.py -Q 3 +python3 ./test.py -f 99-TDcase/TD-21561.py -Q 3 +python3 ./test.py -f 2-query/between.py -Q 4 +python3 ./test.py -f 2-query/distinct.py -Q 4 +python3 ./test.py -f 2-query/varchar.py -Q 4 +python3 ./test.py -f 2-query/ltrim.py -Q 4 +python3 ./test.py -f 2-query/rtrim.py -Q 4 +python3 ./test.py -f 2-query/length.py -Q 4 +python3 ./test.py -f 2-query/char_length.py -Q 4 +python3 ./test.py -f 2-query/upper.py -Q 4 +python3 ./test.py -f 2-query/lower.py -Q 4 +python3 ./test.py -f 2-query/join.py -Q 4 +python3 ./test.py -f 2-query/join2.py -Q 4 +python3 ./test.py -f 2-query/substr.py -Q 4 +python3 ./test.py -f 2-query/union.py -Q 4 +python3 ./test.py -f 2-query/union1.py -Q 4 +python3 ./test.py -f 2-query/concat.py -Q 4 +python3 ./test.py -f 2-query/concat2.py -Q 4 +python3 ./test.py -f 2-query/concat_ws.py -Q 4 +python3 ./test.py -f 2-query/concat_ws2.py -Q 4 +python3 ./test.py -f 2-query/check_tsdb.py -Q 4 +python3 ./test.py -f 2-query/spread.py -Q 4 +python3 ./test.py -f 2-query/hyperloglog.py -Q 4 +python3 ./test.py -f 2-query/explain.py -Q 4 +python3 ./test.py -f 2-query/leastsquares.py -Q 4 +python3 ./test.py -f 2-query/timezone.py -Q 4 +python3 ./test.py -f 2-query/Now.py -Q 4 +python3 ./test.py -f 2-query/Today.py -Q 4 +python3 ./test.py -f 2-query/max.py -Q 4 +python3 ./test.py -f 2-query/min.py -Q 4 +python3 ./test.py -f 2-query/mode.py -Q 4 +python3 ./test.py -f 2-query/count.py -Q 4 +python3 ./test.py -f 2-query/countAlwaysReturnValue.py -Q 4 +python3 ./test.py -f 2-query/last.py -Q 4 +python3 ./test.py -f 2-query/first.py -Q 4 +python3 ./test.py -f 2-query/To_iso8601.py -Q 4 +python3 ./test.py -f 2-query/To_unixtimestamp.py -Q 4 +python3 ./test.py -f 2-query/timetruncate.py -Q 4 +python3 ./test.py -f 2-query/diff.py -Q 4 +python3 ./test.py -f 2-query/Timediff.py -Q 4 +python3 ./test.py -f 2-query/top.py -Q 4 +python3 ./test.py -f 2-query/bottom.py -Q 4 +python3 ./test.py -f 2-query/percentile.py -Q 4 +python3 ./test.py -f 2-query/apercentile.py -Q 4 +python3 ./test.py -f 2-query/abs.py -Q 4 +python3 ./test.py -f 2-query/ceil.py -Q 4 +python3 ./test.py -f 2-query/floor.py -Q 4 +python3 ./test.py -f 2-query/round.py -Q 4 +python3 ./test.py -f 2-query/log.py -Q 4 +python3 ./test.py -f 2-query/pow.py -Q 4 +python3 ./test.py -f 2-query/sqrt.py -Q 4 +python3 ./test.py -f 2-query/sin.py -Q 4 +python3 ./test.py -f 2-query/cos.py -Q 4 +python3 ./test.py -f 2-query/tan.py -Q 4 +python3 ./test.py -f 2-query/arcsin.py -Q 4 +python3 ./test.py -f 2-query/arccos.py -Q 4 +python3 ./test.py -f 2-query/arctan.py -Q 4 +python3 ./test.py -f 2-query/query_cols_tags_and_or.py -Q 4 +python3 ./test.py -f 2-query/nestedQuery.py -Q 4 +python3 ./test.py -f 2-query/nestedQueryInterval.py -Q 4 +python3 ./test.py -f 2-query/nestedQuery_str.py -Q 4 +python3 ./test.py -f 2-query/nestedQuery_math.py -Q 4 +python3 ./test.py -f 2-query/nestedQuery_time.py -Q 4 +python3 ./test.py -f 2-query/avg.py -Q 4 +python3 ./test.py -f 2-query/elapsed.py -Q 4 +python3 ./test.py -f 2-query/csum.py -Q 4 +python3 ./test.py -f 2-query/mavg.py -Q 4 +python3 ./test.py -f 2-query/sample.py -Q 4 +python3 ./test.py -f 2-query/cast.py -Q 4 +python3 ./test.py -f 2-query/function_diff.py -Q 4 +python3 ./test.py -f 2-query/unique.py -Q 4 +python3 ./test.py -f 2-query/tail.py -Q 4 +python3 ./test.py -f 2-query/ttl_comment.py -Q 4 +python3 ./test.py -f 2-query/distribute_agg_count.py -Q 4 +python3 ./test.py -f 2-query/distribute_agg_max.py -Q 4 +python3 ./test.py -f 2-query/distribute_agg_min.py -Q 4 +python3 ./test.py -f 2-query/distribute_agg_sum.py -Q 4 +python3 ./test.py -f 2-query/distribute_agg_spread.py -Q 4 +python3 ./test.py -f 2-query/distribute_agg_apercentile.py -Q 4 +python3 ./test.py -f 2-query/distribute_agg_avg.py -Q 4 +python3 ./test.py -f 2-query/distribute_agg_stddev.py -Q 4 +python3 ./test.py -f 2-query/twa.py -Q 4 +python3 ./test.py -f 2-query/irate.py -Q 4 +python3 ./test.py -f 2-query/function_null.py -Q 4 +python3 ./test.py -f 2-query/count_partition.py -Q 4 +python3 ./test.py -f 2-query/max_partition.py -Q 4 +python3 ./test.py -f 2-query/max_min_last_interval.py -Q 4 +python3 ./test.py -f 2-query/last_row.py -Q 4 +python3 ./test.py -f 2-query/tsbsQuery.py -Q 4 +python3 ./test.py -f 2-query/sml.py -Q 4 +python3 ./test.py -f 2-query/interp.py -Q 4 +python3 ./test.py -f 2-query/case_when.py -Q 4 +python3 ./test.py -f 2-query/insert_select.py +python3 ./test.py -f 2-query/insert_select.py -R +python3 ./test.py -f 2-query/insert_select.py -Q 2 +python3 ./test.py -f 2-query/insert_select.py -Q 3 +python3 ./test.py -f 2-query/insert_select.py -Q 4 +python3 ./test.py -f 2-query/insert_null_none.py +python3 ./test.py -f 2-query/insert_null_none.py -R +python3 ./test.py -f 2-query/insert_null_none.py -Q 2 +python3 ./test.py -f 2-query/insert_null_none.py -Q 3 +python3 ./test.py -f 2-query/insert_null_none.py -Q 4 +python3 ./test.py -f 2-query/out_of_order.py +python3 ./test.py -f 2-query/out_of_order.py -R +python3 ./test.py -f 2-query/out_of_order.py -Q 2 +python3 ./test.py -f 2-query/out_of_order.py -Q 3 +python3 ./test.py -f 2-query/out_of_order.py -Q 4 +python3 ./test.py -f 2-query/max_min_data.py +python3 ./test.py -f 2-query/max_min_data.py -R +python3 ./test.py -f 2-query/max_min_data.py -Q 2 +python3 ./test.py -f 2-query/max_min_data.py -Q 3 +python3 ./test.py -f 2-query/max_min_data.py -Q 4 +python3 ./test.py -f 2-query/blockSMA.py -Q 4 +python3 ./test.py -f 2-query/odbc.py +python3 ./test.py -f 99-TDcase/TD-21561.py -Q 4 +python3 ./test.py -f 99-TDcase/TD-20582.py diff --git a/tests/unit-test/win-test-file b/tests/unit-test/win-test-file new file mode 100644 index 0000000000000000000000000000000000000000..7ddca165e55c15048841effe860d255befc3955f --- /dev/null +++ b/tests/unit-test/win-test-file @@ -0,0 +1 @@ +bash test.sh diff --git a/tools/shell/inc/shellInt.h b/tools/shell/inc/shellInt.h index 113853bd8397fe194d0efc65a55f73f2aa865929..08d4b167ea45ceee5e1f45c220d98ac8d6fed8bd 100644 --- a/tools/shell/inc/shellInt.h +++ b/tools/shell/inc/shellInt.h @@ -83,7 +83,7 @@ typedef struct { const char *clientVersion; char cusName[32]; char promptHeader[32]; - const char* promptContinue; + char promptContinue[32]; const char* osname; int32_t promptSize; char programVersion[256]; diff --git a/tools/shell/src/shellArguments.c b/tools/shell/src/shellArguments.c index 19275cce8228ff280b262c87e044a770f6a6a00d..25c3c76b543a6631f49b8d34594496b24b2ca4d3 100644 --- a/tools/shell/src/shellArguments.c +++ b/tools/shell/src/shellArguments.c @@ -58,8 +58,8 @@ #define SHELL_VERSION "Print program version." #ifdef WEBSOCKET -#define SHELL_DSN "The dsn to use when connecting to cloud server." -#define SHELL_REST "Use restful mode when connecting." +#define SHELL_DSN "Use dsn to connect to the TDengine cloud server or to a remote server which provides WebSocket connection." +#define SHELL_REST "Use RESTful mode when connecting." #define SHELL_TIMEOUT "Set the timeout for websocket query in seconds, default is 10." #endif @@ -126,7 +126,7 @@ static struct argp_option shellOptions[] = { {"pktlen", 'l', "PKTLEN", 0, SHELL_PKT_LEN}, #ifdef WEBSOCKET {"dsn", 'E', "DSN", 0, SHELL_DSN}, - {"restful", 'R', 0, 0, SHELL_REST}, + {"http", 'R', 0, 0, SHELL_REST}, {"timeout", 'T', "SECONDS", 0, SHELL_TIMEOUT}, #endif {"pktnum", 'N', "PKTNUM", 0, SHELL_PKT_NUM}, @@ -411,7 +411,9 @@ int32_t shellParseArgs(int32_t argc, char *argv[]) { "Copyright (c) 2022 by %s, all rights reserved.\r\n\r\n"; strcpy(shell.info.cusName, cusName); sprintf(shell.info.promptHeader, "%s> ", cusPrompt); - shell.info.promptContinue = TAOS_CONSOLE_PROMPT_CONTINUE; + char promptContinueFormat[32] = {0}; + sprintf(promptContinueFormat, "%%%zus> ", strlen(cusPrompt)); + sprintf(shell.info.promptContinue, promptContinueFormat, " "); shell.info.promptSize = strlen(shell.info.promptHeader); snprintf(shell.info.programVersion, sizeof(shell.info.programVersion), "version: %s compatible_version: %s\ngitinfo: %s\nbuildInfo: %s", version, compatible_version, gitinfo, diff --git a/tools/shell/src/shellEngine.c b/tools/shell/src/shellEngine.c index 655fef383e5f6eee40b9b42d4cf59ecf3608d71d..05183a036c2ac6664d0e3a21900f8e47f3310b39 100644 --- a/tools/shell/src/shellEngine.c +++ b/tools/shell/src/shellEngine.c @@ -1048,26 +1048,28 @@ void *shellThreadLoop(void *arg) { taosGetOldTerminalMode(); taosThreadCleanupPush(shellCleanup, NULL); - char *command = taosMemoryMalloc(SHELL_MAX_COMMAND_SIZE); - if (command == NULL) { - printf("failed to malloc command\r\n"); - return NULL; - } - do { - memset(command, 0, SHELL_MAX_COMMAND_SIZE); - taosSetTerminalMode(); - - if (shellReadCommand(command) != 0) { + char *command = taosMemoryMalloc(SHELL_MAX_COMMAND_SIZE); + if (command == NULL) { + printf("failed to malloc command\r\n"); break; } - taosResetTerminalMode(); - } while (shellRunCommand(command, true) == 0); + do { + memset(command, 0, SHELL_MAX_COMMAND_SIZE); + taosSetTerminalMode(); + + if (shellReadCommand(command) != 0) { + break; + } - taosMemoryFreeClear(command); - shellWriteHistory(); - shellExit(); + taosResetTerminalMode(); + } while (shellRunCommand(command, true) == 0); + + taosMemoryFreeClear(command); + shellWriteHistory(); + shellExit(); + } while (0); taosThreadCleanupPop(1); return NULL; diff --git a/utils/test/c/sml_test.c b/utils/test/c/sml_test.c index 1a5f5a64e052111363a32dd24565c61499638b47..73c445417888ba690ebdb9a2886f9f961bb27efd 100644 --- a/utils/test/c/sml_test.c +++ b/utils/test/c/sml_test.c @@ -137,6 +137,8 @@ int smlProcess_json1_Test() { for (int i = 0; i < 1; i++) { taosMemoryFree(sql1[i]); } + ASSERT(code == 0); + const char *sql2[] = { "[{\"metric\":\"sys.cpu.nice\",\"timestamp\":1662344041,\"value\":13,\"tags\":{\"host\":\"web01\",\"dc\":\"lga\"}" @@ -164,6 +166,34 @@ int smlProcess_json1_Test() { taosMemoryFree(sql3[i]); } + ASSERT(code == 0); + + + // TD-22903 + const char *sql4[] = { + "[{\"metric\": \"test_us\", \"timestamp\": {\"value\": 1626006833639, \"type\": \"ms\"}, \"value\": true, \"tags\": {\"t0\": true}}, {\"metric\": \"test_us\", \"timestamp\": {\"value\": 1626006833638, \"type\": \"ms\"}, \"value\": false, \"tags\": {\"t0\": true}}]" + }; + char *sql5[1] = {0}; + for (int i = 0; i < 1; i++) { + sql5[i] = taosMemoryCalloc(1, 1024); + strncpy(sql5[i], sql4[i], 1023); + } + + pRes = taos_schemaless_insert(taos, (char **)sql5, sizeof(sql5) / sizeof(sql5[0]), TSDB_SML_JSON_PROTOCOL, + TSDB_SML_TIMESTAMP_NANO_SECONDS); + code = taos_errno(pRes); + if (code != 0) { + printf("%s result:%s\n", __FUNCTION__, taos_errstr(pRes)); + } else { + printf("%s result:success\n", __FUNCTION__); + } + taos_free_result(pRes); + + for (int i = 0; i < 1; i++) { + taosMemoryFree(sql5[i]); + } + ASSERT(code == 0); + taos_close(taos); return code; @@ -927,6 +957,71 @@ int sml_ts2164_Test() { return code; } +int sml_td22898_Test() { + TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0); + + TAOS_RES *pRes = + taos_query(taos, "CREATE DATABASE IF NOT EXISTS line_test BUFFER 384 MINROWS 1000 PAGES 256 PRECISION 'ns'"); + taos_free_result(pRes); + + const char *sql[] = { + "svlzxdfutx,id=nyavpjyfas,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"binaryTagValue\",t8=L\"ncharTagValue\" c0=t,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"binaryColValue\",c8=L\"ncharColValue\",c9=7u64 1626006833639" + }; + + pRes = taos_query(taos, "use line_test"); + taos_free_result(pRes); + + pRes = taos_schemaless_insert(taos, (char **)sql, sizeof(sql) / sizeof(sql[0]), TSDB_SML_LINE_PROTOCOL, + TSDB_SML_TIMESTAMP_MILLI_SECONDS); + + printf("%s result:%s\n", __FUNCTION__, taos_errstr(pRes)); + int code = taos_errno(pRes); + taos_free_result(pRes); + + const char *sql1[] = { + "svlzxdfutx,id=nyavpjyfas,t0=True,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"tgqkvsws\",t8=L\"ncharTagValue\" c0=f,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"htvnnldm\",c8=L\"ncharColValue\",c9=7u64 1626006833639" + }; + + pRes = taos_schemaless_insert(taos, (char **)sql1, sizeof(sql1) / sizeof(sql1[0]), TSDB_SML_LINE_PROTOCOL, + TSDB_SML_TIMESTAMP_MILLI_SECONDS); + + printf("%s result:%s\n", __FUNCTION__, taos_errstr(pRes)); + code = taos_errno(pRes); + taos_free_result(pRes); + + pRes = taos_query(taos, "select * from svlzxdfutx"); + taos_free_result(pRes); + + taos_close(taos); + + return code; +} + +int sml_td22900_Test() { + TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0); + + TAOS_RES *pRes = + taos_query(taos, "CREATE DATABASE IF NOT EXISTS line_test BUFFER 384 MINROWS 1000 PAGES 256 PRECISION 'ns'"); + taos_free_result(pRes); + + const char *sql[] = { + "qddkgilwfu,id=qddkgilwfu_42383_49198,t0=t,t1=127i8 c4=9223372036854775807i64,c6=11.12345f32,c6=22.123456789f64 1626006833639" + }; + + pRes = taos_query(taos, "use line_test"); + taos_free_result(pRes); + + pRes = taos_schemaless_insert(taos, (char **)sql, sizeof(sql) / sizeof(sql[0]), TSDB_SML_LINE_PROTOCOL, + TSDB_SML_TIMESTAMP_MILLI_SECONDS); + + printf("%s result:%s\n", __FUNCTION__, taos_errstr(pRes)); + int code = taos_errno(pRes); + taos_free_result(pRes); + taos_close(taos); + + return code; +} + int sml_ttl_Test() { TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0); @@ -1106,6 +1201,10 @@ int main(int argc, char *argv[]) { ASSERT(!ret); ret = sml_ts2164_Test(); ASSERT(!ret); + ret = sml_td22898_Test(); + ASSERT(!ret); + ret = sml_td22900_Test(); + ASSERT(ret); ret = smlProcess_influx_Test(); ASSERT(!ret); ret = smlProcess_telnet_Test(); diff --git a/utils/test/c/tmq_taosx_ci.c b/utils/test/c/tmq_taosx_ci.c index 3d458d90c18edeb98ca7955346b0d20b9bca0923..1f25eae366a31b585ca420cc5f289d1cc22c0ecd 100644 --- a/utils/test/c/tmq_taosx_ci.c +++ b/utils/test/c/tmq_taosx_ci.c @@ -409,7 +409,7 @@ int buildStable(TAOS* pConn, TAOS_RES* pRes) { taos_free_result(pRes); pRes = taos_query(pConn, - "create stream meters_summary_s into meters_summary as select _wstart, max(current) as current, " + "create stream meters_summary_s trigger at_once IGNORE EXPIRED 0 into meters_summary as select _wstart, max(current) as current, " "groupid, location from meters partition by groupid, location interval(10m)"); if (taos_errno(pRes) != 0) { printf("failed to create super table meters_summary, reason:%s\n", taos_errstr(pRes)); diff --git a/utils/tsim/src/simExe.c b/utils/tsim/src/simExe.c index d82c948cf7b774703faaa8e70ee7b49bde9f8d12..9dd63d14a28a7f65593703773b1eb1c19d02f5d7 100644 --- a/utils/tsim/src/simExe.c +++ b/utils/tsim/src/simExe.c @@ -37,15 +37,15 @@ void simLogSql(char *sql, bool useSharp) { char *simParseHostName(char *varName) { static char hostName[140]; -#ifdef WINDOWS - hostName[0] = '\"'; - taosGetFqdn(&hostName[1]); - int strEndIndex = strlen(hostName); - hostName[strEndIndex] = '\"'; - hostName[strEndIndex + 1] = '\0'; -#else +//#ifdef WINDOWS +// hostName[0] = '\"'; +// taosGetFqdn(&hostName[1]); +// int strEndIndex = strlen(hostName); +// hostName[strEndIndex] = '\"'; +// hostName[strEndIndex + 1] = '\0'; +//#else sprintf(hostName, "%s", "localhost"); -#endif +//#endif return hostName; } @@ -376,6 +376,20 @@ bool simExecuteRunBackCmd(SScript *script, char *option) { return true; } +void simReplaceDirSep (char *buf){ +#ifdef WINDOWS + int i=0; + while(buf[i] != '\0') + { + if(buf[i] == '/') + { + buf[i] = '\\'; + } + i++; + } +#endif +} + bool simReplaceStr(char *buf, char *src, char *dst) { bool replaced = false; char *begin = strstr(buf, src); @@ -407,9 +421,10 @@ bool simExecuteSystemCmd(SScript *script, char *option) { sprintf(buf, "cd %s; ", simScriptDir); simVisuallizeOption(script, option, buf + strlen(buf)); #else - sprintf(buf, "%s", simScriptDir); + sprintf(buf, "cd %s && ", simScriptDir); simVisuallizeOption(script, option, buf + strlen(buf)); simReplaceStr(buf, ".sh", ".bat"); + simReplaceDirSep(buf); #endif if (useValgrind) { @@ -471,6 +486,8 @@ bool simExecuteSystemContentCmd(SScript *script, char *option) { #ifdef WINDOWS sprintf(buf, "cd %s && ", simScriptDir); simVisuallizeOption(script, option, buf + strlen(buf)); + simReplaceStr(buf, ".sh", ".bat"); + simReplaceDirSep(buf); sprintf(buf1, "%s > %s 2>nul", buf, filename); #else sprintf(buf, "cd %s; ", simScriptDir);