diff --git a/docs/en/07-develop/07-tmq.mdx b/docs/en/07-develop/07-tmq.mdx
index d951923de5..578f38e73d 100644
--- a/docs/en/07-develop/07-tmq.mdx
+++ b/docs/en/07-develop/07-tmq.mdx
@@ -105,6 +105,12 @@ class Consumer:
def poll(self, timeout: float = 1.0):
pass
+ def assignment(self):
+ pass
+
+ def poll(self, timeout: float = 1.0):
+ pass
+
def close(self):
pass
diff --git a/docs/en/12-taos-sql/06-select.md b/docs/en/12-taos-sql/06-select.md
index ea0d7abc16..b28d5acb18 100644
--- a/docs/en/12-taos-sql/06-select.md
+++ b/docs/en/12-taos-sql/06-select.md
@@ -55,7 +55,7 @@ window_clause: {
| INTERVAL(interval_val [, interval_offset]) [SLIDING (sliding_val)] [WATERMARK(watermark_val)] [FILL(fill_mod_and_val)]
interp_clause:
- RANGE(ts_val, ts_val) EVERY(every_val) FILL(fill_mod_and_val)
+ RANGE(ts_val [, ts_val]) EVERY(every_val) FILL(fill_mod_and_val)
partition_by_clause:
PARTITION BY expr [, expr] ...
diff --git a/docs/en/12-taos-sql/10-function.md b/docs/en/12-taos-sql/10-function.md
index b469da8f55..b517bcb3cc 100644
--- a/docs/en/12-taos-sql/10-function.md
+++ b/docs/en/12-taos-sql/10-function.md
@@ -889,9 +889,10 @@ ignore_null_values: {
- `INTERP` is used to get the value that matches the specified time slice from a column. If no such value exists an interpolation value will be returned based on `FILL` parameter.
- The input data of `INTERP` is the value of the specified column and a `where` clause can be used to filter the original data. If no `where` condition is specified then all original data is the input.
- `INTERP` must be used along with `RANGE`, `EVERY`, `FILL` keywords.
-- The output time range of `INTERP` is specified by `RANGE(timestamp1,timestamp2)` parameter, with timestamp1 <= timestamp2. timestamp1 is the starting point of the output time range and must be specified. timestamp2 is the ending point of the output time range and must be specified.
+- The output time range of `INTERP` is specified by `RANGE(timestamp1,timestamp2)` parameter, with timestamp1 <= timestamp2. timestamp1 is the starting point of the output time range. timestamp2 is the ending point of the output time range.
- The number of rows in the result set of `INTERP` is determined by the parameter `EVERY(time_unit)`. Starting from timestamp1, one interpolation is performed for every time interval specified `time_unit` parameter. The parameter `time_unit` must be an integer, with no quotes, with a time unit of: a(millisecond)), s(second), m(minute), h(hour), d(day), or w(week). For example, `EVERY(500a)` will interpolate every 500 milliseconds.
- Interpolation is performed based on `FILL` parameter. For more information about FILL clause, see [FILL Clause](../distinguished/#fill-clause).
+- When only one timestamp value is specified in `RANGE` clause, `INTERP` is used to generate interpolation at this point in time. In this case, `EVERY` clause can be omitted. For example, SELECT INTERP(col) FROM tb RANGE('2023-01-01 00:00:00') FILL(linear).
- `INTERP` can be applied to supertable by interpolating primary key sorted data of all its childtables. It can also be used with `partition by tbname` when applied to supertable to generate interpolation on each single timeline.
- Pseudocolumn `_irowts` can be used along with `INTERP` to return the timestamps associated with interpolation points(support after version 3.0.2.0).
- Pseudocolumn `_isfilled` can be used along with `INTERP` to indicate whether the results are original records or data points generated by interpolation algorithm(support after version 3.0.3.0).
@@ -902,7 +903,7 @@ ignore_null_values: {
- We want to downsample every 1 hour and use a linear fill for missing values. Note the order in which the "partition by" clause and the "range", "every" and "fill" parameters are used.
```sql
-SELECT _irowts,INTERP(current) FROM test.meters PARTITION BY TBNAME RANGE('2017-07-22 00:00:00','2017-07-24 12:25:00') EVERY(1h) FILL(LINEAR)
+SELECT _irowts,INTERP(current) FROM test.meters PARTITION BY TBNAME RANGE('2017-07-22 00:00:00','2017-07-24 12:25:00') EVERY(1h) FILL(LINEAR)
```
### LAST
diff --git a/docs/en/14-reference/03-connector/07-python.mdx b/docs/en/14-reference/03-connector/07-python.mdx
index b263af8ea6..6bd02644d4 100644
--- a/docs/en/14-reference/03-connector/07-python.mdx
+++ b/docs/en/14-reference/03-connector/07-python.mdx
@@ -453,6 +453,170 @@ As the way to connect introduced above but add `req_id` argument.
+### Subscription
+
+Connector support data subscription. For more information about subscroption, please refer to [Data Subscription](../../../develop/tmq/).
+
+
+
+
+The `consumer` in the connector contains the subscription api.
+
+#### Create Consumer
+
+The syntax for creating a consumer is `consumer = Consumer(configs)`. For more subscription api parameters, please refer to [Data Subscription](../../../develop/tmq/).
+
+```python
+from taos.tmq import Consumer
+
+consumer = Consumer({"group.id": "local", "td.connect.ip": "127.0.0.1"})
+```
+
+#### Subscribe topics
+
+The `subscribe` function is used to subscribe to a list of topics.
+
+```python
+consumer.subscribe(['topic1', 'topic2'])
+```
+
+#### Consume
+
+The `poll` function is used to consume data in tmq. The parameter of the `poll` function is a value of type float representing the timeout in seconds. It returns a `Message` before timing out, or `None` on timing out. You have to handle error messages in response data.
+
+```python
+while True:
+ res = consumer.poll(1)
+ if not res:
+ continue
+ err = res.error()
+ if err is not None:
+ raise err
+ val = res.value()
+
+ for block in val:
+ print(block.fetchall())
+```
+
+#### assignment
+
+The `assignment` function is used to get the assignment of the topic.
+
+```python
+assignments = consumer.assignment()
+```
+
+#### Seek
+
+The `seek` function is used to reset the assignment of the topic.
+
+```python
+tp = TopicPartition(topic='topic1', partition=0, offset=0)
+consumer.seek(tp)
+```
+
+#### After consuming data
+
+You should unsubscribe to the topics and close the consumer after consuming.
+
+```python
+consumer.unsubscribe()
+consumer.close()
+```
+
+#### Tmq subscription example
+
+```python
+{{#include docs/examples/python/tmq_example.py}}
+```
+
+#### assignment and seek example
+
+```python
+{{#include docs/examples/python/tmq_assignment_example.py:taos_get_assignment_and_seek_demo}}
+```
+
+
+
+
+
+In addition to native connections, the connector also supports subscriptions via websockets.
+
+#### Create Consumer
+
+The syntax for creating a consumer is "consumer = consumer = Consumer(conf=configs)". You need to specify that the `td.connect.websocket.scheme` parameter is set to "ws" in the configuration. For more subscription api parameters, please refer to [Data Subscription](../../../develop/tmq/#create-a-consumer).
+
+```python
+import taosws
+
+consumer = taosws.(conf={"group.id": "local", "td.connect.websocket.scheme": "ws"})
+```
+
+#### subscribe topics
+
+The `subscribe` function is used to subscribe to a list of topics.
+
+```python
+consumer.subscribe(['topic1', 'topic2'])
+```
+
+#### Consume
+
+The `poll` function is used to consume data in tmq. The parameter of the `poll` function is a value of type float representing the timeout in seconds. It returns a `Message` before timing out, or `None` on timing out. You have to handle error messages in response data.
+
+```python
+while True:
+ res = consumer.poll(timeout=1.0)
+ if not res:
+ continue
+ err = res.error()
+ if err is not None:
+ raise err
+ for block in message:
+ for row in block:
+ print(row)
+```
+
+#### assignment
+
+The `assignment` function is used to get the assignment of the topic.
+
+```python
+assignments = consumer.assignment()
+```
+
+#### Seek
+
+The `seek` function is used to reset the assignment of the topic.
+
+```python
+consumer.seek(topic='topic1', partition=0, offset=0)
+```
+
+#### After consuming data
+
+You should unsubscribe to the topics and close the consumer after consuming.
+
+```python
+consumer.unsubscribe()
+consumer.close()
+```
+
+#### Subscription example
+
+```python
+{{#include docs/examples/python/tmq_websocket_example.py}}
+```
+
+#### Assignment and seek example
+
+```python
+{{#include docs/examples/python/tmq_websocket_assgnment_example.py:taosws_get_assignment_and_seek_demo}}
+```
+
+
+
+
### Schemaless Insert
Connector support schemaless insert.
@@ -507,7 +671,8 @@ Insert with req_id argument
| Example program links | Example program content |
| ------------------------------------------------------------------------------------------------------------- | ------------------- ---- |
-| [bind_multi.py](https://github.com/taosdata/taos-connector-python/blob/main/examples/bind-multi.py) | parameter binding, bind multiple rows at once |
+| [bind_multi.py](https://github.com/taosdata/taos-connector-python/blob/main/examples/bind-multi.py) | parameter binding,
+bind multiple rows at once |
| [bind_row.py](https://github.com/taosdata/taos-connector-python/blob/main/examples/bind-row.py) | bind_row.py
| [insert_lines.py](https://github.com/taosdata/taos-connector-python/blob/main/examples/insert-lines.py) | InfluxDB line protocol writing |
| [json_tag.py](https://github.com/taosdata/taos-connector-python/blob/main/examples/json-tag.py) | Use JSON type tags |
diff --git a/docs/examples/python/tmq_assignment_example.py b/docs/examples/python/tmq_assignment_example.py
new file mode 100644
index 0000000000..a07347a9b9
--- /dev/null
+++ b/docs/examples/python/tmq_assignment_example.py
@@ -0,0 +1,58 @@
+import taos
+from taos.tmq import Consumer
+import taosws
+
+
+def prepare():
+ conn = taos.connect()
+ conn.execute("drop topic if exists tmq_assignment_demo_topic")
+ conn.execute("drop database if exists tmq_assignment_demo_db")
+ conn.execute("create database if not exists tmq_assignment_demo_db wal_retention_period 3600")
+ conn.select_db("tmq_assignment_demo_db")
+ conn.execute(
+ "create table if not exists tmq_assignment_demo_table (ts timestamp, c1 int, c2 float, c3 binary(10)) tags(t1 int)")
+ conn.execute(
+ "create topic if not exists tmq_assignment_demo_topic as select ts, c1, c2, c3 from tmq_assignment_demo_table")
+ conn.execute("insert into d0 using tmq_assignment_demo_table tags (0) values (now-2s, 1, 1.0, 'tmq test')")
+ conn.execute("insert into d0 using tmq_assignment_demo_table tags (0) values (now-1s, 2, 2.0, 'tmq test')")
+ conn.execute("insert into d0 using tmq_assignment_demo_table tags (0) values (now, 3, 3.0, 'tmq test')")
+
+
+def taos_get_assignment_and_seek_demo():
+ prepare()
+ consumer = Consumer(
+ {
+ "group.id": "0",
+ # should disable snapshot,
+ # otherwise it will cause invalid params error
+ "experimental.snapshot.enable": "false",
+ }
+ )
+ consumer.subscribe(["tmq_assignment_demo_topic"])
+
+ # get topic assignment
+ assignments = consumer.assignment()
+ for assignment in assignments:
+ print(assignment)
+
+ # poll
+ consumer.poll(1)
+ consumer.poll(1)
+
+ # get topic assignment again
+ after_pool_assignments = consumer.assignment()
+ for assignment in after_pool_assignments:
+ print(assignment)
+
+ # seek to the beginning
+ for assignment in assignments:
+ consumer.seek(assignment)
+
+ # now the assignment should be the same as before poll
+ assignments = consumer.assignment()
+ for assignment in assignments:
+ print(assignment)
+
+
+if __name__ == '__main__':
+ taosws_get_assignment_and_seek_demo()
diff --git a/docs/examples/python/tmq_websocket_assgnment_example.py b/docs/examples/python/tmq_websocket_assgnment_example.py
new file mode 100644
index 0000000000..0f8e4a2804
--- /dev/null
+++ b/docs/examples/python/tmq_websocket_assgnment_example.py
@@ -0,0 +1,57 @@
+import taos
+import taosws
+
+
+def prepare():
+ conn = taos.connect()
+ conn.execute("drop topic if exists tmq_assignment_demo_topic")
+ conn.execute("drop database if exists tmq_assignment_demo_db")
+ conn.execute("create database if not exists tmq_assignment_demo_db wal_retention_period 3600")
+ conn.select_db("tmq_assignment_demo_db")
+ conn.execute(
+ "create table if not exists tmq_assignment_demo_table (ts timestamp, c1 int, c2 float, c3 binary(10)) tags(t1 int)")
+ conn.execute(
+ "create topic if not exists tmq_assignment_demo_topic as select ts, c1, c2, c3 from tmq_assignment_demo_table")
+ conn.execute("insert into d0 using tmq_assignment_demo_table tags (0) values (now-2s, 1, 1.0, 'tmq test')")
+ conn.execute("insert into d0 using tmq_assignment_demo_table tags (0) values (now-1s, 2, 2.0, 'tmq test')")
+ conn.execute("insert into d0 using tmq_assignment_demo_table tags (0) values (now, 3, 3.0, 'tmq test')")
+
+
+def taosws_get_assignment_and_seek_demo():
+ prepare()
+ consumer = taosws.Consumer(conf={
+ "td.connect.websocket.scheme": "ws",
+ # should disable snapshot,
+ # otherwise it will cause invalid params error
+ "experimental.snapshot.enable": "false",
+ "group.id": "0",
+ })
+ consumer.subscribe(["tmq_assignment_demo_topic"])
+
+ # get topic assignment
+ assignments = consumer.assignment()
+ for assignment in assignments:
+ print(assignment.to_string())
+
+ # poll
+ consumer.poll(1)
+ consumer.poll(1)
+
+ # get topic assignment again
+ after_poll_assignments = consumer.assignment()
+ for assignment in after_poll_assignments:
+ print(assignment.to_string())
+
+ # seek to the beginning
+ for assignment in assignments:
+ for a in assignment.assignments():
+ consumer.seek(assignment.topic(), a.vg_id(), a.offset())
+
+ # now the assignment should be the same as before poll
+ assignments = consumer.assignment()
+ for assignment in assignments:
+ print(assignment.to_string())
+
+
+if __name__ == '__main__':
+ taosws_get_assignment_and_seek_demo()
diff --git a/docs/zh/07-develop/07-tmq.mdx b/docs/zh/07-develop/07-tmq.mdx
index bfea926f53..a87a1f64f8 100644
--- a/docs/zh/07-develop/07-tmq.mdx
+++ b/docs/zh/07-develop/07-tmq.mdx
@@ -105,6 +105,12 @@ class Consumer:
def poll(self, timeout: float = 1.0):
pass
+ def assignment(self):
+ pass
+
+ def seek(self, partition):
+ pass
+
def close(self):
pass
diff --git a/docs/zh/08-connector/30-python.mdx b/docs/zh/08-connector/30-python.mdx
index 1037d66f17..10fb2238ee 100644
--- a/docs/zh/08-connector/30-python.mdx
+++ b/docs/zh/08-connector/30-python.mdx
@@ -456,27 +456,169 @@ TaosCursor 类使用原生连接进行写入、查询操作。在客户端多线
### 数据订阅
-连接器支持数据订阅功能,数据订阅功能请参考 [数据订阅](../../develop/tmq/)。
+连接器支持数据订阅功能,数据订阅功能请参考 [数据订阅文档](../../develop/tmq/)。
-`Consumer` 提供了 Python 连接器订阅 TMQ 数据的 API,相关 API 定义请参考 [数据订阅文档](../../develop/tmq/#%E4%B8%BB%E8%A6%81%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84%E5%92%8C-api)。
+`Consumer` 提供了 Python 连接器订阅 TMQ 数据的 API。
+
+#### 创建 Consumer
+
+创建 Consumer 语法为 `consumer = Consumer(configs)`,参数定义请参考 [数据订阅文档](../../develop/tmq/#%E5%88%9B%E5%BB%BA%E6%B6%88%E8%B4%B9%E8%80%85-consumer)。
+
+```python
+from taos.tmq import Consumer
+
+consumer = Consumer({"group.id": "local", "td.connect.ip": "127.0.0.1"})
+```
+
+#### 订阅 topics
+
+Comsumer API 的 `subscribe` 方法用于订阅 topics,consumer 支持同时订阅多个 topic。
+
+```python
+consumer.subscribe(['topic1', 'topic2'])
+```
+
+#### 消费数据
+
+Consumer API 的 `poll` 方法用于消费数据,`poll` 方法接收一个 float 类型的超时时间,超时时间单位为秒(s),`poll` 方法在超时之前返回一条 Message 类型的数据或超时返回 `None`。消费者必须通过 Message 的 `error()` 方法校验返回数据的 error 信息。
+
+```python
+while True:
+ res = consumer.poll(1)
+ if not res:
+ continue
+ err = res.error()
+ if err is not None:
+ raise err
+ val = res.value()
+
+ for block in val:
+ print(block.fetchall())
+```
+
+#### 获取消费进度
+
+Consumer API 的 `assignment` 方法用于获取 Consumer 订阅的所有 topic 的消费进度,返回结果类型为 TopicPartition 列表。
+
+```python
+assignments = consumer.assignment()
+```
+
+#### 重置消费进度
+
+Consumer API 的 `seek` 方法用于重置 Consumer 的消费进度到指定位置,方法参数类型为 TopicPartition。
+
+```python
+tp = TopicPartition(topic='topic1', partition=0, offset=0)
+consumer.seek(tp)
+```
+
+#### 结束消费
+
+消费结束后,应当取消订阅,并关闭 Consumer。
+
+```python
+consumer.unsubscribe()
+consumer.close()
+```
+
+#### tmq 订阅示例代码
```python
{{#include docs/examples/python/tmq_example.py}}
```
+#### 获取和重置消费进度示例代码
+
+```python
+{{#include docs/examples/python/tmq_assignment_example.py:taos_get_assignment_and_seek_demo}}
+```
+
-除了原生的连接方式,Python 连接器还支持通过 websocket 订阅 TMQ 数据。
+除了原生的连接方式,Python 连接器还支持通过 websocket 订阅 TMQ 数据,使用 websocket 方式订阅 TMQ 数据需要安装 `taos-ws-py`。
+
+taosws `Consumer` API 提供了基于 Websocket 订阅 TMQ 数据的 API。
+
+#### 创建 Consumer
+
+创建 Consumer 语法为 `consumer = Consumer(conf=configs)`,使用时需要指定 `td.connect.websocket.scheme` 参数值为 "ws",参数定义请参考 [数据订阅文档](../../develop/tmq/#%E5%88%9B%E5%BB%BA%E6%B6%88%E8%B4%B9%E8%80%85-consumer)。
+
+```python
+import taosws
+
+consumer = taosws.(conf={"group.id": "local", "td.connect.websocket.scheme": "ws"})
+```
+
+#### 订阅 topics
+
+Comsumer API 的 `subscribe` 方法用于订阅 topics,consumer 支持同时订阅多个 topic。
+
+```python
+consumer.subscribe(['topic1', 'topic2'])
+```
+
+#### 消费数据
+
+Consumer API 的 `poll` 方法用于消费数据,`poll` 方法接收一个 float 类型的超时时间,超时时间单位为秒(s),`poll` 方法在超时之前返回一条 Message 类型的数据或超时返回 `None`。消费者必须通过 Message 的 `error()` 方法校验返回数据的 error 信息。
+
+```python
+while True:
+ res = consumer.poll(timeout=1.0)
+ if not res:
+ continue
+ err = res.error()
+ if err is not None:
+ raise err
+ for block in message:
+ for row in block:
+ print(row)
+```
+
+#### 获取消费进度
+
+Consumer API 的 `assignment` 方法用于获取 Consumer 订阅的所有 topic 的消费进度,返回结果类型为 TopicPartition 列表。
+
+```python
+assignments = consumer.assignment()
+```
+
+#### 重置消费进度
+
+Consumer API 的 `seek` 方法用于重置 Consumer 的消费进度到指定位置。
+
+```python
+consumer.seek(topic='topic1', partition=0, offset=0)
+```
+
+#### 结束消费
+
+消费结束后,应当取消订阅,并关闭 Consumer。
+
+```python
+consumer.unsubscribe()
+consumer.close()
+```
+
+#### tmq 订阅示例代码
```python
{{#include docs/examples/python/tmq_websocket_example.py}}
```
+连接器提供了 `assignment` 接口,用于获取 topic assignment 的功能,可以查询订阅的 topic 的消费进度,并提供 `seek` 接口,用于重置 topic 的消费进度。
+
+#### 获取和重置消费进度示例代码
+
+```python
+{{#include docs/examples/python/tmq_websocket_assgnment_example.py:taosws_get_assignment_and_seek_demo}}
+```
+
diff --git a/docs/zh/12-taos-sql/06-select.md b/docs/zh/12-taos-sql/06-select.md
index 870df73471..5bc67755f0 100644
--- a/docs/zh/12-taos-sql/06-select.md
+++ b/docs/zh/12-taos-sql/06-select.md
@@ -55,7 +55,7 @@ window_clause: {
| INTERVAL(interval_val [, interval_offset]) [SLIDING (sliding_val)] [WATERMARK(watermark_val)] [FILL(fill_mod_and_val)]
interp_clause:
- RANGE(ts_val, ts_val) EVERY(every_val) FILL(fill_mod_and_val)
+ RANGE(ts_val [, ts_val]) EVERY(every_val) FILL(fill_mod_and_val)
partition_by_clause:
PARTITION BY expr [, expr] ...
diff --git a/docs/zh/12-taos-sql/10-function.md b/docs/zh/12-taos-sql/10-function.md
index b4785dc5e6..416d41614d 100644
--- a/docs/zh/12-taos-sql/10-function.md
+++ b/docs/zh/12-taos-sql/10-function.md
@@ -890,9 +890,10 @@ ignore_null_values: {
- INTERP 用于在指定时间断面获取指定列的记录值,如果该时间断面不存在符合条件的行数据,那么会根据 FILL 参数的设定进行插值。
- INTERP 的输入数据为指定列的数据,可以通过条件语句(where 子句)来对原始列数据进行过滤,如果没有指定过滤条件则输入为全部数据。
- INTERP 需要同时与 RANGE,EVERY 和 FILL 关键字一起使用。
-- INTERP 的输出时间范围根据 RANGE(timestamp1,timestamp2)字段来指定,需满足 timestamp1 <= timestamp2。其中 timestamp1(必选值)为输出时间范围的起始值,即如果 timestamp1 时刻符合插值条件则 timestamp1 为输出的第一条记录,timestamp2(必选值)为输出时间范围的结束值,即输出的最后一条记录的 timestamp 不能大于 timestamp2。
+- INTERP 的输出时间范围根据 RANGE(timestamp1, timestamp2)字段来指定,需满足 timestamp1 <= timestamp2。其中 timestamp1 为输出时间范围的起始值,即如果 timestamp1 时刻符合插值条件则 timestamp1 为输出的第一条记录,timestamp2 为输出时间范围的结束值,即输出的最后一条记录的 timestamp 不能大于 timestamp2。
- INTERP 根据 EVERY(time_unit) 字段来确定输出时间范围内的结果条数,即从 timestamp1 开始每隔固定长度的时间(time_unit 值)进行插值,time_unit 可取值时间单位:1a(毫秒),1s(秒),1m(分),1h(小时),1d(天),1w(周)。例如 EVERY(500a) 将对于指定数据每500毫秒间隔进行一次插值.
- INTERP 根据 FILL 字段来决定在每个符合输出条件的时刻如何进行插值。关于 FILL 子句如何使用请参考 [FILL 子句](../distinguished/#fill-子句)
+- INTERP 可以在 RANGE 字段中只指定唯一的时间戳对单个时间点进行插值,在这种情况下,EVERY 字段可以省略。例如:SELECT INTERP(col) FROM tb RANGE('2023-01-01 00:00:00') FILL(linear).
- INTERP 作用于超级表时, 会将该超级表下的所有子表数据按照主键列排序后进行插值计算,也可以搭配 PARTITION BY tbname 使用,将结果强制规约到单个时间线。
- INTERP 可以与伪列 _irowts 一起使用,返回插值点所对应的时间戳(3.0.2.0版本以后支持)。
- INTERP 可以与伪列 _isfilled 一起使用,显示返回结果是否为原始记录或插值算法产生的数据(3.0.3.0版本以后支持)。
diff --git a/include/common/tdatablock.h b/include/common/tdatablock.h
index 53fc07c3f3..6cb7d88523 100644
--- a/include/common/tdatablock.h
+++ b/include/common/tdatablock.h
@@ -248,6 +248,7 @@ int32_t buildSubmitReqFromDataBlock(SSubmitReq2** pReq, const SSDataBlock* pData
tb_uid_t suid);
char* buildCtbNameByGroupId(const char* stbName, uint64_t groupId);
+int32_t buildCtbNameByGroupIdImpl(const char* stbName, uint64_t groupId, char* pBuf);
static FORCE_INLINE int32_t blockGetEncodeSize(const SSDataBlock* pBlock) {
return blockDataGetSerialMetaSize(taosArrayGetSize(pBlock->pDataBlock)) + blockDataGetSize(pBlock);
diff --git a/include/common/tmsg.h b/include/common/tmsg.h
index d78e771fcf..7c5182d76c 100644
--- a/include/common/tmsg.h
+++ b/include/common/tmsg.h
@@ -1975,6 +1975,7 @@ typedef struct {
SArray* fillNullCols; // array of SColLocation
int64_t deleteMark;
int8_t igUpdate;
+ int64_t lastTs;
} SCMCreateStreamReq;
typedef struct {
@@ -2033,6 +2034,11 @@ typedef struct {
char cgroup[TSDB_CGROUP_LEN];
char clientId[256];
SArray* topicNames; // SArray
+
+ int8_t withTbName;
+ int8_t autoCommit;
+ int32_t autoCommitInterval;
+ int8_t resetOffsetCfg;
} SCMSubscribeReq;
static FORCE_INLINE int32_t tSerializeSCMSubscribeReq(void** buf, const SCMSubscribeReq* pReq) {
@@ -2047,6 +2053,12 @@ static FORCE_INLINE int32_t tSerializeSCMSubscribeReq(void** buf, const SCMSubsc
for (int32_t i = 0; i < topicNum; i++) {
tlen += taosEncodeString(buf, (char*)taosArrayGetP(pReq->topicNames, i));
}
+
+ tlen += taosEncodeFixedI8(buf, pReq->withTbName);
+ tlen += taosEncodeFixedI8(buf, pReq->autoCommit);
+ tlen += taosEncodeFixedI32(buf, pReq->autoCommitInterval);
+ tlen += taosEncodeFixedI8(buf, pReq->resetOffsetCfg);
+
return tlen;
}
@@ -2064,6 +2076,11 @@ static FORCE_INLINE void* tDeserializeSCMSubscribeReq(void* buf, SCMSubscribeReq
buf = taosDecodeString(buf, &name);
taosArrayPush(pReq->topicNames, &name);
}
+
+ buf = taosDecodeFixedI8(buf, &pReq->withTbName);
+ buf = taosDecodeFixedI8(buf, &pReq->autoCommit);
+ buf = taosDecodeFixedI32(buf, &pReq->autoCommitInterval);
+ buf = taosDecodeFixedI8(buf, &pReq->resetOffsetCfg);
return buf;
}
@@ -2455,15 +2472,6 @@ typedef struct {
char cgroup[TSDB_CGROUP_LEN];
} SMqAskEpReq;
-typedef struct {
- int64_t consumerId;
- int32_t epoch;
-} SMqHbReq;
-
-typedef struct {
- int8_t reserved;
-} SMqHbRsp;
-
typedef struct {
int32_t key;
int32_t valueLen;
@@ -2487,6 +2495,7 @@ typedef struct {
int64_t stime; // timestamp precision ms
int64_t reqRid;
bool stableQuery;
+ bool isSubQuery;
char fqdn[TSDB_FQDN_LEN];
int32_t subPlanNum;
SArray* subDesc; // SArray
@@ -2891,7 +2900,7 @@ int32_t tDecodeSMqCMCommitOffsetReq(SDecoder* decoder, SMqCMCommitOffsetReq* pRe
// tqOffset
enum {
TMQ_OFFSET__RESET_NONE = -3,
- TMQ_OFFSET__RESET_EARLIEAST = -2,
+ TMQ_OFFSET__RESET_EARLIEST = -2,
TMQ_OFFSET__RESET_LATEST = -1,
TMQ_OFFSET__LOG = 1,
TMQ_OFFSET__SNAPSHOT_DATA = 2,
@@ -3354,6 +3363,28 @@ static FORCE_INLINE void tDeleteSMqAskEpRsp(SMqAskEpRsp* pRsp) {
taosArrayDestroyEx(pRsp->topics, (FDelete)tDeleteMqSubTopicEp);
}
+typedef struct {
+ int32_t vgId;
+ STqOffsetVal offset;
+ int64_t rows;
+}OffsetRows;
+
+typedef struct{
+ char topicName[TSDB_TOPIC_FNAME_LEN];
+ SArray* offsetRows;
+}TopicOffsetRows;
+
+typedef struct {
+ int64_t consumerId;
+ int32_t epoch;
+ SArray* topics;
+} SMqHbReq;
+
+typedef struct {
+ int8_t reserved;
+} SMqHbRsp;
+
+
#define TD_AUTO_CREATE_TABLE 0x1
typedef struct {
int64_t suid;
@@ -3478,10 +3509,8 @@ int32_t tSerializeSMqAskEpReq(void* buf, int32_t bufLen, SMqAskEpReq* pReq);
int32_t tDeserializeSMqAskEpReq(void* buf, int32_t bufLen, SMqAskEpReq* pReq);
int32_t tSerializeSMqHbReq(void* buf, int32_t bufLen, SMqHbReq* pReq);
int32_t tDeserializeSMqHbReq(void* buf, int32_t bufLen, SMqHbReq* pReq);
-int32_t tSerializeSMqAskEpReq(void* buf, int32_t bufLen, SMqAskEpReq* pReq);
-int32_t tDeserializeSMqAskEpReq(void* buf, int32_t bufLen, SMqAskEpReq* pReq);
-int32_t tSerializeSMqHbReq(void* buf, int32_t bufLen, SMqHbReq* pReq);
-int32_t tDeserializeSMqHbReq(void* buf, int32_t bufLen, SMqHbReq* pReq);
+int32_t tDeatroySMqHbReq(SMqHbReq* pReq);
+
#define SUBMIT_REQ_AUTO_CREATE_TABLE 0x1
#define SUBMIT_REQ_COLUMN_DATA_FORMAT 0x2
diff --git a/include/common/tmsgdef.h b/include/common/tmsgdef.h
index db076838f2..2cf8eacdac 100644
--- a/include/common/tmsgdef.h
+++ b/include/common/tmsgdef.h
@@ -150,7 +150,7 @@ enum {
TD_DEF_MSG_TYPE(TDMT_MND_TMQ_HB, "consumer-hb", NULL, NULL)
TD_DEF_MSG_TYPE(TDMT_MND_TMQ_DO_REBALANCE, "do-rebalance", SMqDoRebalanceMsg, NULL)
TD_DEF_MSG_TYPE(TDMT_MND_TMQ_DROP_CGROUP, "drop-cgroup", SMqDropCGroupReq, SMqDropCGroupRsp)
- TD_DEF_MSG_TYPE(TDMT_MND_UNUSED2, "unused2", NULL, NULL)
+ TD_DEF_MSG_TYPE(TDMT_MND_CREATE_VG, "create-vg", NULL, NULL)
TD_DEF_MSG_TYPE(TDMT_MND_TMQ_TIMER, "tmq-tmr", SMTimerReq, NULL)
TD_DEF_MSG_TYPE(TDMT_MND_TELEM_TIMER, "telem-tmr", SMTimerReq, SMTimerReq)
TD_DEF_MSG_TYPE(TDMT_MND_TRANS_TIMER, "trans-tmr", NULL, NULL)
diff --git a/include/libs/catalog/catalog.h b/include/libs/catalog/catalog.h
index 9300deeb9a..7a7a13b285 100644
--- a/include/libs/catalog/catalog.h
+++ b/include/libs/catalog/catalog.h
@@ -87,6 +87,7 @@ typedef struct SCatalogReq {
bool dNodeRequired; // valid dnode
bool svrVerRequired;
bool forceUpdate;
+ bool cloned;
} SCatalogReq;
typedef struct SMetaRes {
diff --git a/include/libs/executor/storageapi.h b/include/libs/executor/storageapi.h
index 4cfbf2c2fa..e2944d13da 100644
--- a/include/libs/executor/storageapi.h
+++ b/include/libs/executor/storageapi.h
@@ -16,13 +16,13 @@
#ifndef TDENGINE_STORAGEAPI_H
#define TDENGINE_STORAGEAPI_H
-#include "tsimplehash.h"
-#include "tscalablebf.h"
-#include "taosdef.h"
-#include "tmsg.h"
-#include "tcommon.h"
-#include "index.h"
#include "function.h"
+#include "index.h"
+#include "taosdef.h"
+#include "tcommon.h"
+#include "tmsg.h"
+#include "tscalablebf.h"
+#include "tsimplehash.h"
#ifdef __cplusplus
extern "C" {
@@ -46,7 +46,7 @@ typedef struct SMetaEntry {
int8_t type;
int8_t flags; // TODO: need refactor?
tb_uid_t uid;
- char * name;
+ char* name;
union {
struct {
SSchemaWrapper schemaRow;
@@ -57,43 +57,45 @@ typedef struct SMetaEntry {
int64_t ctime;
int32_t ttlDays;
int32_t commentLen;
- char * comment;
+ char* comment;
tb_uid_t suid;
- uint8_t *pTags;
+ uint8_t* pTags;
} ctbEntry;
struct {
int64_t ctime;
int32_t ttlDays;
int32_t commentLen;
- char * comment;
+ char* comment;
int32_t ncid; // next column id
SSchemaWrapper schemaRow;
} ntbEntry;
struct {
- STSma *tsma;
+ STSma* tsma;
} smaEntry;
};
- uint8_t *pBuf;
+ uint8_t* pBuf;
} SMetaEntry;
typedef struct SMetaReader {
- int32_t flags;
- void * pMeta;
- SDecoder coder;
- SMetaEntry me;
- void * pBuf;
- int32_t szBuf;
- struct SStoreMeta* pAPI;
+ int32_t flags;
+ void* pMeta;
+ SDecoder coder;
+ SMetaEntry me;
+ void* pBuf;
+ int32_t szBuf;
+ struct SStoreMeta* pAPI;
} SMetaReader;
typedef struct SMTbCursor {
- void * pDbc;
- void * pKey;
- void * pVal;
+ void* pMeta;
+ void* pDbc;
+ void* pKey;
+ void* pVal;
int32_t kLen;
int32_t vLen;
SMetaReader mr;
+ int8_t paused;
} SMTbCursor;
typedef struct SRowBuffPos {
@@ -107,22 +109,22 @@ typedef struct SRowBuffPos {
typedef struct SMetaTableInfo {
int64_t suid;
int64_t uid;
- SSchemaWrapper *schema;
+ SSchemaWrapper* schema;
char tbName[TSDB_TABLE_NAME_LEN];
} SMetaTableInfo;
typedef struct SSnapContext {
- SMeta * pMeta; // todo remove it
- int64_t snapVersion;
- void * pCur;
- int64_t suid;
- int8_t subType;
- SHashObj * idVersion;
- SHashObj * suidInfo;
- SArray * idList;
- int32_t index;
- bool withMeta;
- bool queryMeta; // true-get meta, false-get data
+ SMeta* pMeta; // todo remove it
+ int64_t snapVersion;
+ void* pCur;
+ int64_t suid;
+ int8_t subType;
+ SHashObj* idVersion;
+ SHashObj* suidInfo;
+ SArray* idList;
+ int32_t index;
+ bool withMeta;
+ bool queryMeta; // true-get meta, false-get data
} SSnapContext;
typedef struct {
@@ -139,10 +141,9 @@ typedef struct {
// int32_t tqReaderSeek(STqReader *pReader, int64_t ver, const char *id);
// bool tqNextBlockInWal(STqReader* pReader, const char* idstr);
// bool tqNextBlockImpl(STqReader *pReader, const char* idstr);
-// int32_t getTableInfoFromSnapshot(SSnapContext *ctx, void **pBuf, int32_t *contLen, int16_t *type, int64_t *uid);
-// SMetaTableInfo getMetaTableInfoFromSnapshot(SSnapContext *ctx);
-// int32_t setForSnapShot(SSnapContext *ctx, int64_t uid);
-// int32_t destroySnapContext(SSnapContext *ctx);
+// int32_t getTableInfoFromSnapshot(SSnapContext *ctx, void **pBuf, int32_t *contLen, int16_t *type, int64_t
+// *uid); SMetaTableInfo getMetaTableInfoFromSnapshot(SSnapContext *ctx); int32_t setForSnapShot(SSnapContext
+// *ctx, int64_t uid); int32_t destroySnapContext(SSnapContext *ctx);
// clang-format off
/*-------------------------------------------------new api format---------------------------------------------------*/
@@ -219,16 +220,16 @@ typedef struct SStoreTqReader {
bool (*tqReaderIsQueriedTable)();
bool (*tqReaderCurrentBlockConsumed)();
- struct SWalReader *(*tqReaderGetWalReader)(); // todo remove it
- int32_t (*tqReaderRetrieveTaosXBlock)(); // todo remove it
+ struct SWalReader* (*tqReaderGetWalReader)(); // todo remove it
+ int32_t (*tqReaderRetrieveTaosXBlock)(); // todo remove it
int32_t (*tqReaderSetSubmitMsg)(); // todo remove it
bool (*tqReaderNextBlockFilterOut)();
} SStoreTqReader;
typedef struct SStoreSnapshotFn {
- int32_t (*createSnapshot)(SSnapContext *ctx, int64_t uid);
- int32_t (*destroySnapshot)(SSnapContext *ctx);
+ int32_t (*createSnapshot)(SSnapContext* ctx, int64_t uid);
+ int32_t (*destroySnapshot)(SSnapContext* ctx);
SMetaTableInfo (*getMetaTableInfoFromSnapshot)(SSnapContext* ctx);
int32_t (*getTableInfoFromSnapshot)(SSnapContext* ctx, void** pBuf, int32_t* contLen, int16_t* type, int64_t* uid);
} SStoreSnapshotFn;
@@ -252,42 +253,54 @@ int32_t metaUidFilterCachePut(SMeta *pMeta, uint64_t suid, const void *pKey, in
int32_t payloadLen, double selectivityRatio);
tb_uid_t metaGetTableEntryUidByName(SMeta *pMeta, const char *name);
int32_t metaGetCachedTbGroup(SMeta* pMeta, tb_uid_t suid, const uint8_t* pKey, int32_t keyLen, SArray** pList);
-int32_t metaPutTbGroupToCache(SMeta* pMeta, uint64_t suid, const void* pKey, int32_t keyLen, void* pPayload, int32_t payloadLen);
+int32_t metaPutTbGroupToCache(SMeta* pMeta, uint64_t suid, const void* pKey, int32_t keyLen, void* pPayload, int32_t
+payloadLen);
*/
typedef struct SStoreMeta {
- SMTbCursor *(*openTableMetaCursor)(void *pVnode); // metaOpenTbCursor
- void (*closeTableMetaCursor)(SMTbCursor *pTbCur); // metaCloseTbCursor
- int32_t (*cursorNext)(SMTbCursor *pTbCur, ETableType jumpTableType); // metaTbCursorNext
- int32_t (*cursorPrev)(SMTbCursor *pTbCur, ETableType jumpTableType); // metaTbCursorPrev
+ SMTbCursor* (*openTableMetaCursor)(void* pVnode); // metaOpenTbCursor
+ void (*closeTableMetaCursor)(SMTbCursor* pTbCur); // metaCloseTbCursor
+ void (*pauseTableMetaCursor)(SMTbCursor* pTbCur); // metaPauseTbCursor
+ void (*resumeTableMetaCursor)(SMTbCursor* pTbCur, int8_t first); // metaResumeTbCursor
+ int32_t (*cursorNext)(SMTbCursor* pTbCur, ETableType jumpTableType); // metaTbCursorNext
+ int32_t (*cursorPrev)(SMTbCursor* pTbCur, ETableType jumpTableType); // metaTbCursorPrev
- int32_t (*getTableTags)(void *pVnode, uint64_t suid, SArray *uidList);
- int32_t (*getTableTagsByUid)(void *pVnode, int64_t suid, SArray *uidList);
- const void *(*extractTagVal)(const void *tag, int16_t type, STagVal *tagVal); // todo remove it
+ int32_t (*getTableTags)(void* pVnode, uint64_t suid, SArray* uidList);
+ int32_t (*getTableTagsByUid)(void* pVnode, int64_t suid, SArray* uidList);
+ const void* (*extractTagVal)(const void* tag, int16_t type, STagVal* tagVal); // todo remove it
- int32_t (*getTableUidByName)(void *pVnode, char *tbName, uint64_t *uid);
- int32_t (*getTableTypeByName)(void *pVnode, char *tbName, ETableType *tbType);
- int32_t (*getTableNameByUid)(void *pVnode, uint64_t uid, char *tbName);
- bool (*isTableExisted)(void *pVnode, tb_uid_t uid);
+ int32_t (*getTableUidByName)(void* pVnode, char* tbName, uint64_t* uid);
+ int32_t (*getTableTypeByName)(void* pVnode, char* tbName, ETableType* tbType);
+ int32_t (*getTableNameByUid)(void* pVnode, uint64_t uid, char* tbName);
+ bool (*isTableExisted)(void* pVnode, tb_uid_t uid);
- int32_t (*metaGetCachedTbGroup)(void* pVnode, tb_uid_t suid, const uint8_t* pKey, int32_t keyLen, SArray** pList);
- int32_t (*metaPutTbGroupToCache)(void* pVnode, uint64_t suid, const void* pKey, int32_t keyLen, void* pPayload, int32_t payloadLen);
+ int32_t (*metaGetCachedTbGroup)(void* pVnode, tb_uid_t suid, const uint8_t* pKey, int32_t keyLen, SArray** pList);
+ int32_t (*metaPutTbGroupToCache)(void* pVnode, uint64_t suid, const void* pKey, int32_t keyLen, void* pPayload,
+ int32_t payloadLen);
- int32_t (*getCachedTableList)(void* pVnode, tb_uid_t suid, const uint8_t* pKey, int32_t keyLen, SArray* pList1, bool* acquireRes);
- int32_t (*putCachedTableList)(void* pVnode, uint64_t suid, const void* pKey, int32_t keyLen, void* pPayload, int32_t payloadLen, double selectivityRatio);
+ int32_t (*getCachedTableList)(void* pVnode, tb_uid_t suid, const uint8_t* pKey, int32_t keyLen, SArray* pList1,
+ bool* acquireRes);
+ int32_t (*putCachedTableList)(void* pVnode, uint64_t suid, const void* pKey, int32_t keyLen, void* pPayload,
+ int32_t payloadLen, double selectivityRatio);
- void *(*storeGetIndexInfo)();
- void *(*getInvertIndex)(void* pVnode);
- int32_t (*getChildTableList)(void *pVnode, int64_t suid, SArray *list); // support filter and non-filter cases. [vnodeGetCtbIdList & vnodeGetCtbIdListByFilter]
- int32_t (*storeGetTableList)(void* pVnode, int8_t type, SArray* pList); // vnodeGetStbIdList & vnodeGetAllTableList
- void *storeGetVersionRange;
- void *storeGetLastTimestamp;
+ void* (*storeGetIndexInfo)();
+ void* (*getInvertIndex)(void* pVnode);
+ int32_t (*getChildTableList)(
+ void* pVnode, int64_t suid,
+ SArray* list); // support filter and non-filter cases. [vnodeGetCtbIdList & vnodeGetCtbIdListByFilter]
+ int32_t (*storeGetTableList)(void* pVnode, int8_t type, SArray* pList); // vnodeGetStbIdList & vnodeGetAllTableList
+ void* storeGetVersionRange;
+ void* storeGetLastTimestamp;
- int32_t (*getTableSchema)(void *pVnode, int64_t uid, STSchema **pSchema, int64_t *suid); // tsdbGetTableSchema
+ int32_t (*getTableSchema)(void* pVnode, int64_t uid, STSchema** pSchema, int64_t* suid); // tsdbGetTableSchema
// db name, vgId, numOfTables, numOfSTables
- int32_t (*getNumOfChildTables)(void* pVnode, int64_t uid, int64_t* numOfTables); // int32_t metaGetStbStats(SMeta *pMeta, int64_t uid, SMetaStbStats *pInfo);
- void (*getBasicInfo)(void *pVnode, const char **dbname, int32_t *vgId, int64_t* numOfTables, int64_t* numOfNormalTables);// vnodeGetInfo(void *pVnode, const char **dbname, int32_t *vgId) & metaGetTbNum(SMeta *pMeta) & metaGetNtbNum(SMeta *pMeta);
+ int32_t (*getNumOfChildTables)(
+ void* pVnode, int64_t uid,
+ int64_t* numOfTables); // int32_t metaGetStbStats(SMeta *pMeta, int64_t uid, SMetaStbStats *pInfo);
+ void (*getBasicInfo)(void* pVnode, const char** dbname, int32_t* vgId, int64_t* numOfTables,
+ int64_t* numOfNormalTables); // vnodeGetInfo(void *pVnode, const char **dbname, int32_t *vgId) &
+ // metaGetTbNum(SMeta *pMeta) & metaGetNtbNum(SMeta *pMeta);
int64_t (*getNumOfRowsInMem)(void* pVnode);
/**
@@ -298,24 +311,24 @@ int32_t vnodeGetStbIdList(void *pVnode, int64_t suid, SArray *list);
} SStoreMeta;
typedef struct SStoreMetaReader {
- void (*initReader)(SMetaReader *pReader, void *pVnode, int32_t flags, SStoreMeta* pAPI);
- void (*clearReader)(SMetaReader *pReader);
- void (*readerReleaseLock)(SMetaReader *pReader);
- int32_t (*getTableEntryByUid)(SMetaReader *pReader, tb_uid_t uid);
- int32_t (*getTableEntryByName)(SMetaReader *pReader, const char *name);
- int32_t (*getEntryGetUidCache)(SMetaReader *pReader, tb_uid_t uid);
+ void (*initReader)(SMetaReader* pReader, void* pVnode, int32_t flags, SStoreMeta* pAPI);
+ void (*clearReader)(SMetaReader* pReader);
+ void (*readerReleaseLock)(SMetaReader* pReader);
+ int32_t (*getTableEntryByUid)(SMetaReader* pReader, tb_uid_t uid);
+ int32_t (*getTableEntryByName)(SMetaReader* pReader, const char* name);
+ int32_t (*getEntryGetUidCache)(SMetaReader* pReader, tb_uid_t uid);
} SStoreMetaReader;
typedef struct SUpdateInfo {
- SArray *pTsBuckets;
+ SArray* pTsBuckets;
uint64_t numBuckets;
- SArray *pTsSBFs;
+ SArray* pTsSBFs;
uint64_t numSBFs;
int64_t interval;
int64_t watermark;
TSKEY minTS;
- SScalableBf *pCloseWinSBF;
- SHashObj *pMap;
+ SScalableBf* pCloseWinSBF;
+ SHashObj* pMap;
uint64_t maxDataVersion;
} SUpdateInfo;
@@ -334,15 +347,15 @@ typedef struct SStateStore {
int32_t (*streamStateAddIfNotExist)(SStreamState* pState, const SWinKey* key, void** pVal, int32_t* pVLen);
int32_t (*streamStateReleaseBuf)(SStreamState* pState, const SWinKey* key, void* pVal);
- void (*streamStateFreeVal)(void* val);
+ void (*streamStateFreeVal)(void* val);
int32_t (*streamStatePut)(SStreamState* pState, const SWinKey* key, const void* value, int32_t vLen);
int32_t (*streamStateGet)(SStreamState* pState, const SWinKey* key, void** pVal, int32_t* pVLen);
- bool (*streamStateCheck)(SStreamState* pState, const SWinKey* key);
+ bool (*streamStateCheck)(SStreamState* pState, const SWinKey* key);
int32_t (*streamStateGetByPos)(SStreamState* pState, void* pos, void** pVal);
int32_t (*streamStateDel)(SStreamState* pState, const SWinKey* key);
int32_t (*streamStateClear)(SStreamState* pState);
- void (*streamStateSetNumber)(SStreamState* pState, int32_t number);
+ void (*streamStateSetNumber)(SStreamState* pState, int32_t number);
int32_t (*streamStateSaveInfo)(SStreamState* pState, void* pKey, int32_t keyLen, void* pVal, int32_t vLen);
int32_t (*streamStateGetInfo)(SStreamState* pState, void* pKey, int32_t keyLen, void** pVal, int32_t* pLen);
@@ -353,36 +366,37 @@ typedef struct SStateStore {
int32_t (*streamStateCurNext)(SStreamState* pState, SStreamStateCur* pCur);
int32_t (*streamStateCurPrev)(SStreamState* pState, SStreamStateCur* pCur);
- SStreamStateCur* (*streamStateGetAndCheckCur)(SStreamState* pState, SWinKey* key);
- SStreamStateCur* (*streamStateSeekKeyNext)(SStreamState* pState, const SWinKey* key);
- SStreamStateCur* (*streamStateFillSeekKeyNext)(SStreamState* pState, const SWinKey* key);
- SStreamStateCur* (*streamStateFillSeekKeyPrev)(SStreamState* pState, const SWinKey* key);
- void (*streamStateFreeCur)(SStreamStateCur* pCur);
+ SStreamStateCur* (*streamStateGetAndCheckCur)(SStreamState* pState, SWinKey* key);
+ SStreamStateCur* (*streamStateSeekKeyNext)(SStreamState* pState, const SWinKey* key);
+ SStreamStateCur* (*streamStateFillSeekKeyNext)(SStreamState* pState, const SWinKey* key);
+ SStreamStateCur* (*streamStateFillSeekKeyPrev)(SStreamState* pState, const SWinKey* key);
+ void (*streamStateFreeCur)(SStreamStateCur* pCur);
int32_t (*streamStateGetGroupKVByCur)(SStreamStateCur* pCur, SWinKey* pKey, const void** pVal, int32_t* pVLen);
int32_t (*streamStateGetKVByCur)(SStreamStateCur* pCur, SWinKey* pKey, const void** pVal, int32_t* pVLen);
- int32_t (*streamStateSessionAddIfNotExist)(SStreamState* pState, SSessionKey* key, TSKEY gap, void** pVal, int32_t* pVLen);
+ int32_t (*streamStateSessionAddIfNotExist)(SStreamState* pState, SSessionKey* key, TSKEY gap, void** pVal,
+ int32_t* pVLen);
int32_t (*streamStateSessionPut)(SStreamState* pState, const SSessionKey* key, const void* value, int32_t vLen);
int32_t (*streamStateSessionGet)(SStreamState* pState, SSessionKey* key, void** pVal, int32_t* pVLen);
int32_t (*streamStateSessionDel)(SStreamState* pState, const SSessionKey* key);
int32_t (*streamStateSessionClear)(SStreamState* pState);
int32_t (*streamStateSessionGetKVByCur)(SStreamStateCur* pCur, SSessionKey* pKey, void** pVal, int32_t* pVLen);
int32_t (*streamStateStateAddIfNotExist)(SStreamState* pState, SSessionKey* key, char* pKeyData, int32_t keyDataLen,
- state_key_cmpr_fn fn, void** pVal, int32_t* pVLen);
+ state_key_cmpr_fn fn, void** pVal, int32_t* pVLen);
int32_t (*streamStateSessionGetKeyByRange)(SStreamState* pState, const SSessionKey* range, SSessionKey* curKey);
- SUpdateInfo* (*updateInfoInit)(int64_t interval, int32_t precision, int64_t watermark);
- TSKEY (*updateInfoFillBlockData)(SUpdateInfo *pInfo, SSDataBlock *pBlock, int32_t primaryTsCol);
- bool (*updateInfoIsUpdated)(SUpdateInfo *pInfo, uint64_t tableId, TSKEY ts);
- bool (*updateInfoIsTableInserted)(SUpdateInfo *pInfo, int64_t tbUid);
- void (*updateInfoDestroy)(SUpdateInfo *pInfo);
+ SUpdateInfo* (*updateInfoInit)(int64_t interval, int32_t precision, int64_t watermark);
+ TSKEY (*updateInfoFillBlockData)(SUpdateInfo* pInfo, SSDataBlock* pBlock, int32_t primaryTsCol);
+ bool (*updateInfoIsUpdated)(SUpdateInfo* pInfo, uint64_t tableId, TSKEY ts);
+ bool (*updateInfoIsTableInserted)(SUpdateInfo* pInfo, int64_t tbUid);
+ void (*updateInfoDestroy)(SUpdateInfo* pInfo);
- SUpdateInfo* (*updateInfoInitP)(SInterval *pInterval, int64_t watermark);
- void (*updateInfoAddCloseWindowSBF)(SUpdateInfo *pInfo);
- void (*updateInfoDestoryColseWinSBF)(SUpdateInfo *pInfo);
- int32_t (*updateInfoSerialize)(void *buf, int32_t bufLen, const SUpdateInfo *pInfo);
- int32_t (*updateInfoDeserialize)(void *buf, int32_t bufLen, SUpdateInfo *pInfo);
+ SUpdateInfo* (*updateInfoInitP)(SInterval* pInterval, int64_t watermark);
+ void (*updateInfoAddCloseWindowSBF)(SUpdateInfo* pInfo);
+ void (*updateInfoDestoryColseWinSBF)(SUpdateInfo* pInfo);
+ int32_t (*updateInfoSerialize)(void* buf, int32_t bufLen, const SUpdateInfo* pInfo);
+ int32_t (*updateInfoDeserialize)(void* buf, int32_t bufLen, SUpdateInfo* pInfo);
SStreamStateCur* (*streamStateSessionSeekKeyNext)(SStreamState* pState, const SSessionKey* key);
SStreamStateCur* (*streamStateSessionSeekKeyCurrentPrev)(SStreamState* pState, const SSessionKey* key);
@@ -396,11 +410,11 @@ typedef struct SStateStore {
bool (*needClearDiskBuff)(struct SStreamFileState* pFileState);
SStreamState* (*streamStateOpen)(char* path, void* pTask, bool specPath, int32_t szPage, int32_t pages);
- void (*streamStateClose)(SStreamState* pState, bool remove);
- int32_t (*streamStateBegin)(SStreamState* pState);
- int32_t (*streamStateCommit)(SStreamState* pState);
- void (*streamStateDestroy)(SStreamState* pState, bool remove);
- int32_t (*streamStateDeleteCheckPoint)(SStreamState* pState, TSKEY mark);
+ void (*streamStateClose)(SStreamState* pState, bool remove);
+ int32_t (*streamStateBegin)(SStreamState* pState);
+ int32_t (*streamStateCommit)(SStreamState* pState);
+ void (*streamStateDestroy)(SStreamState* pState, bool remove);
+ int32_t (*streamStateDeleteCheckPoint)(SStreamState* pState, TSKEY mark);
} SStateStore;
typedef struct SStorageAPI {
diff --git a/include/libs/function/functionMgt.h b/include/libs/function/functionMgt.h
index f0c9cffd0f..55af50e0bc 100644
--- a/include/libs/function/functionMgt.h
+++ b/include/libs/function/functionMgt.h
@@ -233,6 +233,7 @@ bool fmIsGroupKeyFunc(int32_t funcId);
bool fmIsBlockDistFunc(int32_t funcId);
void getLastCacheDataType(SDataType* pType);
+SFunctionNode* createFunction(const char* pName, SNodeList* pParameterList);
int32_t fmGetDistMethod(const SFunctionNode* pFunc, SFunctionNode** pPartialFunc, SFunctionNode** pMergeFunc);
diff --git a/include/libs/nodes/cmdnodes.h b/include/libs/nodes/cmdnodes.h
index c8ce9634f5..3a36601b11 100644
--- a/include/libs/nodes/cmdnodes.h
+++ b/include/libs/nodes/cmdnodes.h
@@ -425,16 +425,18 @@ typedef struct SStreamOptions {
} SStreamOptions;
typedef struct SCreateStreamStmt {
- ENodeType type;
- char streamName[TSDB_TABLE_NAME_LEN];
- char targetDbName[TSDB_DB_NAME_LEN];
- char targetTabName[TSDB_TABLE_NAME_LEN];
- bool ignoreExists;
- SStreamOptions* pOptions;
- SNode* pQuery;
- SNodeList* pTags;
- SNode* pSubtable;
- SNodeList* pCols;
+ ENodeType type;
+ char streamName[TSDB_TABLE_NAME_LEN];
+ char targetDbName[TSDB_DB_NAME_LEN];
+ char targetTabName[TSDB_TABLE_NAME_LEN];
+ bool ignoreExists;
+ SStreamOptions* pOptions;
+ SNode* pQuery;
+ SNode* pPrevQuery;
+ SNodeList* pTags;
+ SNode* pSubtable;
+ SNodeList* pCols;
+ SCMCreateStreamReq* pReq;
} SCreateStreamStmt;
typedef struct SDropStreamStmt {
diff --git a/include/libs/nodes/nodes.h b/include/libs/nodes/nodes.h
index 4002999104..2319643b09 100644
--- a/include/libs/nodes/nodes.h
+++ b/include/libs/nodes/nodes.h
@@ -328,6 +328,8 @@ void nodesListInsertList(SNodeList* pTarget, SListCell* pPos, SNodeList* p
SNode* nodesListGetNode(SNodeList* pList, int32_t index);
SListCell* nodesListGetCell(SNodeList* pList, int32_t index);
void nodesDestroyList(SNodeList* pList);
+bool nodesListMatch(const SNodeList* pList, const SNodeList* pSubList);
+
// Only clear the linked list structure, without releasing the elements inside
void nodesClearList(SNodeList* pList);
@@ -346,6 +348,7 @@ void nodesRewriteExprPostOrder(SNode** pNode, FNodeRewriter rewriter, void* pCon
void nodesRewriteExprsPostOrder(SNodeList* pList, FNodeRewriter rewriter, void* pContext);
bool nodesEqualNode(const SNode* a, const SNode* b);
+bool nodesMatchNode(const SNode* pSub, const SNode* pNode);
SNode* nodesCloneNode(const SNode* pNode);
SNodeList* nodesCloneList(const SNodeList* pList);
diff --git a/include/libs/nodes/plannodes.h b/include/libs/nodes/plannodes.h
index 02459ed951..f44b622cc0 100644
--- a/include/libs/nodes/plannodes.h
+++ b/include/libs/nodes/plannodes.h
@@ -617,6 +617,7 @@ typedef struct SQueryPlan {
int32_t numOfSubplans;
SNodeList* pSubplans; // Element is SNodeListNode. The execution level of subplan, starting from 0.
SExplainInfo explainInfo;
+ void* pPostPlan;
} SQueryPlan;
const char* dataOrderStr(EDataOrderLevel order);
diff --git a/include/libs/nodes/querynodes.h b/include/libs/nodes/querynodes.h
index 9569cfe055..f570698395 100644
--- a/include/libs/nodes/querynodes.h
+++ b/include/libs/nodes/querynodes.h
@@ -241,6 +241,12 @@ typedef enum EFillMode {
FILL_MODE_NEXT
} EFillMode;
+typedef enum ETimeLineMode {
+ TIME_LINE_NONE = 1,
+ TIME_LINE_MULTI,
+ TIME_LINE_GLOBAL,
+} ETimeLineMode;
+
typedef struct SFillNode {
ENodeType type; // QUERY_NODE_FILL
EFillMode mode;
@@ -263,50 +269,50 @@ typedef struct SCaseWhenNode {
} SCaseWhenNode;
typedef struct SSelectStmt {
- ENodeType type; // QUERY_NODE_SELECT_STMT
- bool isDistinct;
- SNodeList* pProjectionList;
- SNode* pFromTable;
- SNode* pWhere;
- SNodeList* pPartitionByList;
- SNodeList* pTags; // for create stream
- SNode* pSubtable; // for create stream
- SNode* pWindow;
- SNodeList* pGroupByList; // SGroupingSetNode
- SNode* pHaving;
- SNode* pRange;
- SNode* pEvery;
- SNode* pFill;
- SNodeList* pOrderByList; // SOrderByExprNode
- SLimitNode* pLimit;
- SLimitNode* pSlimit;
- STimeWindow timeRange;
- char stmtName[TSDB_TABLE_NAME_LEN];
- uint8_t precision;
- int32_t selectFuncNum;
- int32_t returnRows; // EFuncReturnRows
- bool isEmptyResult;
- bool isTimeLineResult;
- bool isSubquery;
- bool hasAggFuncs;
- bool hasRepeatScanFuncs;
- bool hasIndefiniteRowsFunc;
- bool hasMultiRowsFunc;
- bool hasSelectFunc;
- bool hasSelectValFunc;
- bool hasOtherVectorFunc;
- bool hasUniqueFunc;
- bool hasTailFunc;
- bool hasInterpFunc;
- bool hasInterpPseudoColFunc;
- bool hasLastRowFunc;
- bool hasLastFunc;
- bool hasTimeLineFunc;
- bool hasUdaf;
- bool hasStateKey;
- bool onlyHasKeepOrderFunc;
- bool groupSort;
- bool tagScan;
+ ENodeType type; // QUERY_NODE_SELECT_STMT
+ bool isDistinct;
+ SNodeList* pProjectionList;
+ SNode* pFromTable;
+ SNode* pWhere;
+ SNodeList* pPartitionByList;
+ SNodeList* pTags; // for create stream
+ SNode* pSubtable; // for create stream
+ SNode* pWindow;
+ SNodeList* pGroupByList; // SGroupingSetNode
+ SNode* pHaving;
+ SNode* pRange;
+ SNode* pEvery;
+ SNode* pFill;
+ SNodeList* pOrderByList; // SOrderByExprNode
+ SLimitNode* pLimit;
+ SLimitNode* pSlimit;
+ STimeWindow timeRange;
+ char stmtName[TSDB_TABLE_NAME_LEN];
+ uint8_t precision;
+ int32_t selectFuncNum;
+ int32_t returnRows; // EFuncReturnRows
+ ETimeLineMode timeLineResMode;
+ bool isEmptyResult;
+ bool isSubquery;
+ bool hasAggFuncs;
+ bool hasRepeatScanFuncs;
+ bool hasIndefiniteRowsFunc;
+ bool hasMultiRowsFunc;
+ bool hasSelectFunc;
+ bool hasSelectValFunc;
+ bool hasOtherVectorFunc;
+ bool hasUniqueFunc;
+ bool hasTailFunc;
+ bool hasInterpFunc;
+ bool hasInterpPseudoColFunc;
+ bool hasLastRowFunc;
+ bool hasLastFunc;
+ bool hasTimeLineFunc;
+ bool hasUdaf;
+ bool hasStateKey;
+ bool onlyHasKeepOrderFunc;
+ bool groupSort;
+ bool tagScan;
} SSelectStmt;
typedef enum ESetOperatorType { SET_OP_TYPE_UNION_ALL = 1, SET_OP_TYPE_UNION } ESetOperatorType;
@@ -321,6 +327,7 @@ typedef struct SSetOperator {
SNode* pLimit;
char stmtName[TSDB_TABLE_NAME_LEN];
uint8_t precision;
+ ETimeLineMode timeLineResMode;
} SSetOperator;
typedef enum ESqlClause {
@@ -434,7 +441,9 @@ typedef struct SQuery {
EQueryExecStage execStage;
EQueryExecMode execMode;
bool haveResultSet;
+ SNode* pPrevRoot;
SNode* pRoot;
+ SNode* pPostRoot;
int32_t numOfResCols;
SSchema* pResSchema;
int8_t precision;
diff --git a/include/libs/parser/parser.h b/include/libs/parser/parser.h
index 94fb6824d2..f253b47e50 100644
--- a/include/libs/parser/parser.h
+++ b/include/libs/parser/parser.h
@@ -74,6 +74,7 @@ int32_t qAnalyseSqlSemantic(SParseContext* pCxt, const struct SCatalogReq* pCata
const struct SMetaData* pMetaData, SQuery* pQuery);
int32_t qContinueParseSql(SParseContext* pCxt, struct SCatalogReq* pCatalogReq, const struct SMetaData* pMetaData,
SQuery* pQuery);
+int32_t qContinueParsePostQuery(SParseContext* pCxt, SQuery* pQuery, void** pResRow);
void qDestroyParseContext(SParseContext* pCxt);
diff --git a/include/libs/planner/planner.h b/include/libs/planner/planner.h
index 41c0e98084..1b523c0323 100644
--- a/include/libs/planner/planner.h
+++ b/include/libs/planner/planner.h
@@ -52,6 +52,7 @@ int32_t qCreateQueryPlan(SPlanContext* pCxt, SQueryPlan** pPlan, SArray* pExecNo
// @groupId id of a group of datasource subplans of this @pSubplan
// @pSource one execution location of this group of datasource subplans
int32_t qSetSubplanExecutionNode(SSubplan* pSubplan, int32_t groupId, SDownstreamSourceNode* pSource);
+int32_t qContinuePlanPostQuery(void *pPostPlan);
void qClearSubplanExecutionNode(SSubplan* pSubplan);
diff --git a/include/libs/stream/tstream.h b/include/libs/stream/tstream.h
index 3222a125dd..73c88fae8d 100644
--- a/include/libs/stream/tstream.h
+++ b/include/libs/stream/tstream.h
@@ -327,6 +327,7 @@ struct SStreamTask {
int64_t checkpointingId;
int32_t checkpointAlignCnt;
struct SStreamMeta* pMeta;
+ SSHashObj* pNameMap;
};
// meta
diff --git a/include/libs/sync/sync.h b/include/libs/sync/sync.h
index e86a4f9690..2a0a4b0f63 100644
--- a/include/libs/sync/sync.h
+++ b/include/libs/sync/sync.h
@@ -154,14 +154,14 @@ typedef struct SSnapshotMeta {
typedef struct SSyncFSM {
void* data;
- int32_t (*FpCommitCb)(const struct SSyncFSM* pFsm, SRpcMsg* pMsg, const SFsmCbMeta* pMeta);
+ int32_t (*FpCommitCb)(const struct SSyncFSM* pFsm, SRpcMsg* pMsg, SFsmCbMeta* pMeta);
SyncIndex (*FpAppliedIndexCb)(const struct SSyncFSM* pFsm);
- int32_t (*FpPreCommitCb)(const struct SSyncFSM* pFsm, SRpcMsg* pMsg, const SFsmCbMeta* pMeta);
- void (*FpRollBackCb)(const struct SSyncFSM* pFsm, SRpcMsg* pMsg, const SFsmCbMeta* pMeta);
+ int32_t (*FpPreCommitCb)(const struct SSyncFSM* pFsm, SRpcMsg* pMsg, SFsmCbMeta* pMeta);
+ void (*FpRollBackCb)(const struct SSyncFSM* pFsm, SRpcMsg* pMsg, SFsmCbMeta* pMeta);
void (*FpRestoreFinishCb)(const struct SSyncFSM* pFsm, const SyncIndex commitIdx);
- void (*FpReConfigCb)(const struct SSyncFSM* pFsm, SRpcMsg* pMsg, const SReConfigCbMeta* pMeta);
- void (*FpLeaderTransferCb)(const struct SSyncFSM* pFsm, SRpcMsg* pMsg, const SFsmCbMeta* pMeta);
+ void (*FpReConfigCb)(const struct SSyncFSM* pFsm, SRpcMsg* pMsg, SReConfigCbMeta* pMeta);
+ void (*FpLeaderTransferCb)(const struct SSyncFSM* pFsm, SRpcMsg* pMsg, SFsmCbMeta* pMeta);
bool (*FpApplyQueueEmptyCb)(const struct SSyncFSM* pFsm);
int32_t (*FpApplyQueueItems)(const struct SSyncFSM* pFsm);
diff --git a/include/libs/wal/wal.h b/include/libs/wal/wal.h
index 1aa08ff802..47230bc95c 100644
--- a/include/libs/wal/wal.h
+++ b/include/libs/wal/wal.h
@@ -214,7 +214,7 @@ int32_t walSkipFetchBody(SWalReader *pRead, const SWalCkHead *pHead);
void walRefFirstVer(SWal *, SWalRef *);
void walRefLastVer(SWal *, SWalRef *);
-SWalRef *walRefCommittedVer(SWal *);
+void walRefCommitVer(SWal *, SWalRef *);
SWalRef *walOpenRef(SWal *);
void walCloseRef(SWal *pWal, int64_t refId);
diff --git a/include/util/talgo.h b/include/util/talgo.h
index f9d51c4b5b..7c92c0fe87 100644
--- a/include/util/talgo.h
+++ b/include/util/talgo.h
@@ -31,7 +31,7 @@ typedef void *(*__array_item_dup_fn_t)(void *);
typedef void (*FDelete)(void *);
typedef int32_t (*FEncode)(void **buf, const void *dst);
-typedef void *(*FDecode)(const void *buf, void *dst);
+typedef void *(*FDecode)(const void *buf, void *dst, int8_t sver);
#define TD_EQ 0x1
#define TD_GT 0x2
diff --git a/include/util/taoserror.h b/include/util/taoserror.h
index 9e5229870e..889ee41a29 100644
--- a/include/util/taoserror.h
+++ b/include/util/taoserror.h
@@ -345,7 +345,7 @@ int32_t* taosGetErrno();
#define TSDB_CODE_MND_TRANS_CLOG_IS_NULL TAOS_DEF_ERROR_CODE(0, 0x03D4)
#define TSDB_CODE_MND_TRANS_NETWORK_UNAVAILL TAOS_DEF_ERROR_CODE(0, 0x03D5)
#define TSDB_CODE_MND_LAST_TRANS_NOT_FINISHED TAOS_DEF_ERROR_CODE(0, 0x03D6) //internal
-#define TSDB_CODE_MND_TRNAS_SYNC_TIMEOUT TAOS_DEF_ERROR_CODE(0, 0x03D7)
+#define TSDB_CODE_MND_TRANS_SYNC_TIMEOUT TAOS_DEF_ERROR_CODE(0, 0x03D7)
#define TSDB_CODE_MND_TRANS_UNKNOW_ERROR TAOS_DEF_ERROR_CODE(0, 0x03DF)
// mnode-mq
diff --git a/include/util/tarray.h b/include/util/tarray.h
index 4bf24b46b9..a93c695370 100644
--- a/include/util/tarray.h
+++ b/include/util/tarray.h
@@ -244,7 +244,7 @@ int32_t taosArraySearchIdx(const SArray* pArray, const void* key, __compar_fn_t
void taosArraySortPWithExt(SArray* pArray, __ext_compar_fn_t fn, const void* param);
int32_t taosEncodeArray(void** buf, const SArray* pArray, FEncode encode);
-void* taosDecodeArray(const void* buf, SArray** pArray, FDecode decode, int32_t dataSz);
+void* taosDecodeArray(const void* buf, SArray** pArray, FDecode decode, int32_t dataSz, int8_t sver);
#ifdef __cplusplus
}
diff --git a/include/util/tdef.h b/include/util/tdef.h
index 0b0569e2d1..69b012ecea 100644
--- a/include/util/tdef.h
+++ b/include/util/tdef.h
@@ -32,7 +32,7 @@ extern "C" {
#define TD_VER_MAX UINT64_MAX // TODO: use the real max version from query handle
// Bytes for each type.
-extern const int32_t TYPE_BYTES[17];
+extern const int32_t TYPE_BYTES[21];
// TODO: replace and remove code below
#define CHAR_BYTES sizeof(char)
@@ -195,6 +195,7 @@ typedef enum ELogicConditionType {
#define TSDB_TABLE_NAME_LEN 193 // it is a null-terminated string
#define TSDB_TOPIC_NAME_LEN 193 // it is a null-terminated string
#define TSDB_CGROUP_LEN 193 // it is a null-terminated string
+#define TSDB_OFFSET_LEN 64 // it is a null-terminated string
#define TSDB_USER_CGROUP_LEN (TSDB_USER_LEN + TSDB_CGROUP_LEN) // it is a null-terminated string
#define TSDB_STREAM_NAME_LEN 193 // it is a null-terminated string
#define TSDB_DB_NAME_LEN 65
diff --git a/source/client/inc/clientInt.h b/source/client/inc/clientInt.h
index 18891bb932..fa444779f3 100644
--- a/source/client/inc/clientInt.h
+++ b/source/client/inc/clientInt.h
@@ -227,6 +227,12 @@ typedef struct {
STaosxRsp rsp;
} SMqTaosxRspObj;
+typedef struct SReqRelInfo {
+ uint64_t userRefId;
+ uint64_t prevRefId;
+ uint64_t nextRefId;
+} SReqRelInfo;
+
typedef struct SRequestObj {
int8_t resType; // query or tmq
uint64_t requestId;
@@ -250,10 +256,14 @@ typedef struct SRequestObj {
bool validateOnly; // todo refactor
bool killed;
bool inRetry;
+ bool isSubReq;
uint32_t prevCode; // previous error code: todo refactor, add update flag for catalog
uint32_t retry;
int64_t allocatorRefId;
SQuery* pQuery;
+ void* pPostPlan;
+ SReqRelInfo relation;
+ void* pWrapper;
} SRequestObj;
typedef struct SSyncQueryParam {
@@ -279,6 +289,7 @@ TAOS_RES* taosQueryImplWithReqid(TAOS* taos, const char* sql, bool validateOnly,
void taosAsyncQueryImpl(uint64_t connId, const char* sql, __taos_async_fn_t fp, void* param, bool validateOnly);
void taosAsyncQueryImplWithReqid(uint64_t connId, const char* sql, __taos_async_fn_t fp, void* param, bool validateOnly,
int64_t reqid);
+void taosAsyncFetchImpl(SRequestObj *pRequest, __taos_async_fn_t fp, void *param);
int32_t getVersion1BlockMetaSize(const char* p, int32_t numOfCols);
@@ -368,6 +379,7 @@ typedef struct SSqlCallbackWrapper {
SParseContext* pParseCtx;
SCatalogReq* pCatalogReq;
SRequestObj* pRequest;
+ void* pPlanInfo;
} SSqlCallbackWrapper;
SRequestObj* launchQueryImpl(SRequestObj* pRequest, SQuery* pQuery, bool keepQuery, void** res);
@@ -382,6 +394,12 @@ int32_t handleCreateTbExecRes(void* res, SCatalog* pCatalog);
bool qnodeRequired(SRequestObj* pRequest);
void continueInsertFromCsv(SSqlCallbackWrapper* pWrapper, SRequestObj* pRequest);
void destorySqlCallbackWrapper(SSqlCallbackWrapper* pWrapper);
+void handleQueryAnslyseRes(SSqlCallbackWrapper *pWrapper, SMetaData *pResultMeta, int32_t code);
+void restartAsyncQuery(SRequestObj *pRequest, int32_t code);
+int32_t buildPreviousRequest(SRequestObj *pRequest, const char* sql, SRequestObj** pNewRequest);
+int32_t prepareAndParseSqlSyntax(SSqlCallbackWrapper **ppWrapper, SRequestObj *pRequest, bool updateMetaForce);
+void returnToUser(SRequestObj* pRequest);
+void stopAllQueries(SRequestObj *pRequest);
#ifdef __cplusplus
}
diff --git a/source/client/src/clientEnv.c b/source/client/src/clientEnv.c
index 045642c2c2..c64bbfbdb6 100644
--- a/source/client/src/clientEnv.c
+++ b/source/client/src/clientEnv.c
@@ -358,6 +358,49 @@ int32_t releaseRequest(int64_t rid) { return taosReleaseRef(clientReqRefPool, ri
int32_t removeRequest(int64_t rid) { return taosRemoveRef(clientReqRefPool, rid); }
+
+void destroySubRequests(SRequestObj *pRequest) {
+ int32_t reqIdx = -1;
+ SRequestObj *pReqList[16] = {NULL};
+ uint64_t tmpRefId = 0;
+
+ if (pRequest->relation.userRefId && pRequest->relation.userRefId != pRequest->self) {
+ return;
+ }
+
+ SRequestObj* pTmp = pRequest;
+ while (pTmp->relation.prevRefId) {
+ tmpRefId = pTmp->relation.prevRefId;
+ pTmp = acquireRequest(tmpRefId);
+ if (pTmp) {
+ pReqList[++reqIdx] = pTmp;
+ releaseRequest(tmpRefId);
+ } else {
+ tscError("0x%" PRIx64 ", prev req ref 0x%" PRIx64 " is not there, reqId:0x%" PRIx64, pTmp->self,
+ tmpRefId, pTmp->requestId);
+ break;
+ }
+ }
+
+ for (int32_t i = reqIdx; i >= 0; i--) {
+ removeRequest(pReqList[i]->self);
+ }
+
+ tmpRefId = pRequest->relation.nextRefId;
+ while (tmpRefId) {
+ pTmp = acquireRequest(tmpRefId);
+ if (pTmp) {
+ tmpRefId = pTmp->relation.nextRefId;
+ removeRequest(pTmp->self);
+ releaseRequest(pTmp->self);
+ } else {
+ tscError("0x%" PRIx64 " is not there", tmpRefId);
+ break;
+ }
+ }
+}
+
+
void doDestroyRequest(void *p) {
if (NULL == p) {
return;
@@ -368,10 +411,14 @@ void doDestroyRequest(void *p) {
uint64_t reqId = pRequest->requestId;
tscTrace("begin to destroy request %" PRIx64 " p:%p", reqId, pRequest);
+ destroySubRequests(pRequest);
+
taosHashRemove(pRequest->pTscObj->pRequests, &pRequest->self, sizeof(pRequest->self));
schedulerFreeJob(&pRequest->body.queryJob, 0);
+ destorySqlCallbackWrapper(pRequest->pWrapper);
+
taosMemoryFreeClear(pRequest->msgBuf);
taosMemoryFreeClear(pRequest->pDb);
@@ -412,6 +459,63 @@ void destroyRequest(SRequestObj *pRequest) {
removeRequest(pRequest->self);
}
+void taosStopQueryImpl(SRequestObj *pRequest) {
+ pRequest->killed = true;
+
+ // It is not a query, no need to stop.
+ if (NULL == pRequest->pQuery || QUERY_EXEC_MODE_SCHEDULE != pRequest->pQuery->execMode) {
+ tscDebug("request 0x%" PRIx64 " no need to be killed since not query", pRequest->requestId);
+ return;
+ }
+
+ schedulerFreeJob(&pRequest->body.queryJob, TSDB_CODE_TSC_QUERY_KILLED);
+ tscDebug("request %" PRIx64 " killed", pRequest->requestId);
+}
+
+void stopAllQueries(SRequestObj *pRequest) {
+ int32_t reqIdx = -1;
+ SRequestObj *pReqList[16] = {NULL};
+ uint64_t tmpRefId = 0;
+
+ if (pRequest->relation.userRefId && pRequest->relation.userRefId != pRequest->self) {
+ return;
+ }
+
+ SRequestObj* pTmp = pRequest;
+ while (pTmp->relation.prevRefId) {
+ tmpRefId = pTmp->relation.prevRefId;
+ pTmp = acquireRequest(tmpRefId);
+ if (pTmp) {
+ pReqList[++reqIdx] = pTmp;
+ releaseRequest(tmpRefId);
+ } else {
+ tscError("0x%" PRIx64 ", prev req ref 0x%" PRIx64 " is not there, reqId:0x%" PRIx64, pTmp->self,
+ tmpRefId, pTmp->requestId);
+ break;
+ }
+ }
+
+ for (int32_t i = reqIdx; i >= 0; i--) {
+ taosStopQueryImpl(pReqList[i]);
+ }
+
+ taosStopQueryImpl(pRequest);
+
+ tmpRefId = pRequest->relation.nextRefId;
+ while (tmpRefId) {
+ pTmp = acquireRequest(tmpRefId);
+ if (pTmp) {
+ tmpRefId = pTmp->relation.nextRefId;
+ taosStopQueryImpl(pTmp);
+ releaseRequest(pTmp->self);
+ } else {
+ tscError("0x%" PRIx64 " is not there", tmpRefId);
+ break;
+ }
+ }
+}
+
+
void crashReportThreadFuncUnexpectedStopped(void) { atomic_store_32(&clientStop, -1); }
static void *tscCrashReportThreadFp(void *param) {
diff --git a/source/client/src/clientHb.c b/source/client/src/clientHb.c
index 2dddfec2bd..cbfa48b322 100644
--- a/source/client/src/clientHb.c
+++ b/source/client/src/clientHb.c
@@ -464,6 +464,7 @@ int32_t hbBuildQueryDesc(SQueryHbReqBasic *hbBasic, STscObj *pObj) {
desc.useconds = now - pRequest->metric.start;
desc.reqRid = pRequest->self;
desc.stableQuery = pRequest->stableQuery;
+ desc.isSubQuery = pRequest->isSubReq;
taosGetFqdn(desc.fqdn);
desc.subPlanNum = pRequest->body.subplanNum;
diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c
index 5963e419e1..2a73156e8a 100644
--- a/source/client/src/clientImpl.c
+++ b/source/client/src/clientImpl.c
@@ -237,6 +237,17 @@ int32_t buildRequest(uint64_t connId, const char* sql, int sqlLen, void* param,
return TSDB_CODE_SUCCESS;
}
+int32_t buildPreviousRequest(SRequestObj *pRequest, const char* sql, SRequestObj** pNewRequest) {
+ int32_t code = buildRequest(pRequest->pTscObj->id, sql, strlen(sql), pRequest, pRequest->validateOnly, pNewRequest, 0);
+ if (TSDB_CODE_SUCCESS == code) {
+ pRequest->relation.prevRefId = (*pNewRequest)->self;
+ (*pNewRequest)->relation.nextRefId = pRequest->self;
+ (*pNewRequest)->relation.userRefId = pRequest->self;
+ (*pNewRequest)->isSubReq = true;
+ }
+ return code;
+}
+
int32_t parseSql(SRequestObj* pRequest, bool topicQuery, SQuery** pQuery, SStmtCallback* pStmtCb) {
STscObj* pTscObj = pRequest->pTscObj;
@@ -878,6 +889,81 @@ static bool incompletaFileParsing(SNode* pStmt) {
return QUERY_NODE_VNODE_MODIFY_STMT != nodeType(pStmt) ? false : ((SVnodeModifyOpStmt*)pStmt)->fileProcessing;
}
+void continuePostSubQuery(SRequestObj* pRequest, TAOS_ROW row) {
+ SSqlCallbackWrapper* pWrapper = pRequest->pWrapper;
+ int32_t code = nodesAcquireAllocator(pWrapper->pParseCtx->allocatorId);
+ if (TSDB_CODE_SUCCESS == code) {
+ int64_t analyseStart = taosGetTimestampUs();
+ code = qContinueParsePostQuery(pWrapper->pParseCtx, pRequest->pQuery, (void**)row);
+ pRequest->metric.analyseCostUs += taosGetTimestampUs() - analyseStart;
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = qContinuePlanPostQuery(pRequest->pPostPlan);
+ }
+ nodesReleaseAllocator(pWrapper->pParseCtx->allocatorId);
+
+ handleQueryAnslyseRes(pWrapper, NULL, code);
+}
+
+void returnToUser(SRequestObj* pRequest) {
+ if (pRequest->relation.userRefId == pRequest->self || 0 == pRequest->relation.userRefId) {
+ // return to client
+ pRequest->body.queryFp(pRequest->body.param, pRequest, pRequest->code);
+ return;
+ }
+
+ SRequestObj* pUserReq = acquireRequest(pRequest->relation.userRefId);
+ if (pUserReq) {
+ pUserReq->code = pRequest->code;
+ // return to client
+ pUserReq->body.queryFp(pUserReq->body.param, pUserReq, pUserReq->code);
+ releaseRequest(pRequest->relation.userRefId);
+ return;
+ } else {
+ tscError("0x%" PRIx64 ", user ref 0x%" PRIx64 " is not there, reqId:0x%" PRIx64, pRequest->self,
+ pRequest->relation.userRefId, pRequest->requestId);
+ }
+}
+
+void postSubQueryFetchCb(void* param, TAOS_RES* res, int32_t rowNum) {
+ SRequestObj* pRequest = (SRequestObj*)res;
+ if (pRequest->code) {
+ returnToUser(pRequest);
+ return;
+ }
+
+ TAOS_ROW row = NULL;
+ if (rowNum > 0) {
+ row = taos_fetch_row(res); // for single row only now
+ }
+
+ SRequestObj* pNextReq = acquireRequest(pRequest->relation.nextRefId);
+ if (pNextReq) {
+ continuePostSubQuery(pNextReq, row);
+ releaseRequest(pRequest->relation.nextRefId);
+ } else {
+ tscError("0x%" PRIx64 ", next req ref 0x%" PRIx64 " is not there, reqId:0x%" PRIx64, pRequest->self,
+ pRequest->relation.nextRefId, pRequest->requestId);
+ }
+}
+
+void handlePostSubQuery(SSqlCallbackWrapper* pWrapper) {
+ SRequestObj* pRequest = pWrapper->pRequest;
+ if (TD_RES_QUERY(pRequest)) {
+ taosAsyncFetchImpl(pRequest, postSubQueryFetchCb, pWrapper);
+ return;
+ }
+
+ SRequestObj* pNextReq = acquireRequest(pRequest->relation.nextRefId);
+ if (pNextReq) {
+ continuePostSubQuery(pNextReq, NULL);
+ releaseRequest(pRequest->relation.nextRefId);
+ } else {
+ tscError("0x%" PRIx64 ", next req ref 0x%" PRIx64 " is not there, reqId:0x%" PRIx64, pRequest->self,
+ pRequest->relation.nextRefId, pRequest->requestId);
+ }
+}
+
// todo refacto the error code mgmt
void schedulerExecCb(SExecResult* pResult, void* param, int32_t code) {
SSqlCallbackWrapper* pWrapper = param;
@@ -912,12 +998,7 @@ void schedulerExecCb(SExecResult* pResult, void* param, int32_t code) {
if (code != TSDB_CODE_SUCCESS && NEED_CLIENT_HANDLE_ERROR(code) && pRequest->sqlstr != NULL) {
tscDebug("0x%" PRIx64 " client retry to handle the error, code:%s, tryCount:%d, reqId:0x%" PRIx64, pRequest->self,
tstrerror(code), pRequest->retry, pRequest->requestId);
- pRequest->prevCode = code;
- schedulerFreeJob(&pRequest->body.queryJob, 0);
- qDestroyQuery(pRequest->pQuery);
- pRequest->pQuery = NULL;
- destorySqlCallbackWrapper(pWrapper);
- doAsyncQuery(pRequest, true);
+ restartAsyncQuery(pRequest, code);
return;
}
@@ -938,10 +1019,15 @@ void schedulerExecCb(SExecResult* pResult, void* param, int32_t code) {
return;
}
- destorySqlCallbackWrapper(pWrapper);
+ if (pRequest->relation.nextRefId) {
+ handlePostSubQuery(pWrapper);
+ } else {
+ destorySqlCallbackWrapper(pWrapper);
+ pRequest->pWrapper = NULL;
- // return to client
- pRequest->body.queryFp(pRequest->body.param, pRequest, code);
+ // return to client
+ pRequest->body.queryFp(pRequest->body.param, pRequest, code);
+ }
}
SRequestObj* launchQueryImpl(SRequestObj* pRequest, SQuery* pQuery, bool keepQuery, void** res) {
@@ -1049,6 +1135,7 @@ static int32_t asyncExecSchQuery(SRequestObj* pRequest, SQuery* pQuery, SMetaDat
pRequest->requestId);
} else {
pRequest->body.subplanNum = pDag->numOfSubplans;
+ TSWAP(pRequest->pPostPlan, pDag->pPostPlan);
}
pRequest->metric.execStart = taosGetTimestampUs();
@@ -1084,6 +1171,7 @@ static int32_t asyncExecSchQuery(SRequestObj* pRequest, SQuery* pQuery, SMetaDat
tscDebug("0x%" PRIx64 " plan not executed, code:%s 0x%" PRIx64, pRequest->self, tstrerror(code),
pRequest->requestId);
destorySqlCallbackWrapper(pWrapper);
+ pRequest->pWrapper = NULL;
if (TSDB_CODE_SUCCESS != code) {
pRequest->code = terrno;
}
@@ -1103,6 +1191,7 @@ void launchAsyncQuery(SRequestObj* pRequest, SQuery* pQuery, SMetaData* pResultM
pRequest->body.execMode = pQuery->execMode;
if (QUERY_EXEC_MODE_SCHEDULE != pRequest->body.execMode) {
destorySqlCallbackWrapper(pWrapper);
+ pRequest->pWrapper = NULL;
}
if (pQuery->pRoot && !pRequest->inRetry) {
@@ -2402,3 +2491,90 @@ TAOS_RES* taosQueryImplWithReqid(TAOS* taos, const char* sql, bool validateOnly,
return pRequest;
}
+
+
+static void fetchCallback(void *pResult, void *param, int32_t code) {
+ SRequestObj *pRequest = (SRequestObj *)param;
+
+ SReqResultInfo *pResultInfo = &pRequest->body.resInfo;
+
+ tscDebug("0x%" PRIx64 " enter scheduler fetch cb, code:%d - %s, reqId:0x%" PRIx64, pRequest->self, code,
+ tstrerror(code), pRequest->requestId);
+
+ pResultInfo->pData = pResult;
+ pResultInfo->numOfRows = 0;
+
+ if (code != TSDB_CODE_SUCCESS) {
+ pRequest->code = code;
+ taosMemoryFreeClear(pResultInfo->pData);
+ pRequest->body.fetchFp(pRequest->body.param, pRequest, 0);
+ return;
+ }
+
+ if (pRequest->code != TSDB_CODE_SUCCESS) {
+ taosMemoryFreeClear(pResultInfo->pData);
+ pRequest->body.fetchFp(pRequest->body.param, pRequest, 0);
+ return;
+ }
+
+ pRequest->code =
+ setQueryResultFromRsp(pResultInfo, (const SRetrieveTableRsp *)pResultInfo->pData, pResultInfo->convertUcs4, true);
+ if (pRequest->code != TSDB_CODE_SUCCESS) {
+ pResultInfo->numOfRows = 0;
+ pRequest->code = code;
+ tscError("0x%" PRIx64 " fetch results failed, code:%s, reqId:0x%" PRIx64, pRequest->self, tstrerror(code),
+ pRequest->requestId);
+ } else {
+ tscDebug("0x%" PRIx64 " fetch results, numOfRows:%" PRId64 " total Rows:%" PRId64 ", complete:%d, reqId:0x%" PRIx64,
+ pRequest->self, pResultInfo->numOfRows, pResultInfo->totalRows, pResultInfo->completed,
+ pRequest->requestId);
+
+ STscObj *pTscObj = pRequest->pTscObj;
+ SAppClusterSummary *pActivity = &pTscObj->pAppInfo->summary;
+ atomic_add_fetch_64((int64_t *)&pActivity->fetchBytes, pRequest->body.resInfo.payloadLen);
+ }
+
+ pRequest->body.fetchFp(pRequest->body.param, pRequest, pResultInfo->numOfRows);
+}
+
+void taosAsyncFetchImpl(SRequestObj *pRequest, __taos_async_fn_t fp, void *param) {
+ pRequest->body.fetchFp = fp;
+ pRequest->body.param = param;
+
+ SReqResultInfo *pResultInfo = &pRequest->body.resInfo;
+
+ // this query has no results or error exists, return directly
+ if (taos_num_fields(pRequest) == 0 || pRequest->code != TSDB_CODE_SUCCESS) {
+ pResultInfo->numOfRows = 0;
+ pRequest->body.fetchFp(param, pRequest, pResultInfo->numOfRows);
+ return;
+ }
+
+ // all data has returned to App already, no need to try again
+ if (pResultInfo->completed) {
+ // it is a local executed query, no need to do async fetch
+ if (QUERY_EXEC_MODE_SCHEDULE != pRequest->body.execMode) {
+ if (pResultInfo->localResultFetched) {
+ pResultInfo->numOfRows = 0;
+ pResultInfo->current = 0;
+ } else {
+ pResultInfo->localResultFetched = true;
+ }
+ } else {
+ pResultInfo->numOfRows = 0;
+ }
+
+ pRequest->body.fetchFp(param, pRequest, pResultInfo->numOfRows);
+ return;
+ }
+
+ SSchedulerReq req = {
+ .syncReq = false,
+ .fetchFp = fetchCallback,
+ .cbParam = pRequest,
+ };
+
+ schedulerFetchRows(pRequest->body.queryJob, &req);
+}
+
+
diff --git a/source/client/src/clientMain.c b/source/client/src/clientMain.c
index 63a4e5d2e5..7573fd5968 100644
--- a/source/client/src/clientMain.c
+++ b/source/client/src/clientMain.c
@@ -563,22 +563,13 @@ int taos_select_db(TAOS *taos, const char *db) {
return code;
}
+
void taos_stop_query(TAOS_RES *res) {
if (res == NULL || TD_RES_TMQ(res) || TD_RES_TMQ_META(res) || TD_RES_TMQ_METADATA(res)) {
return;
}
- SRequestObj *pRequest = (SRequestObj *)res;
- pRequest->killed = true;
-
- // It is not a query, no need to stop.
- if (NULL == pRequest->pQuery || QUERY_EXEC_MODE_SCHEDULE != pRequest->pQuery->execMode) {
- tscDebug("request 0x%" PRIx64 " no need to be killed since not query", pRequest->requestId);
- return;
- }
-
- schedulerFreeJob(&pRequest->body.queryJob, TSDB_CODE_TSC_QUERY_KILLED);
- tscDebug("request %" PRIx64 " killed", pRequest->requestId);
+ stopAllQueries((SRequestObj*)res);
}
bool taos_is_null(TAOS_RES *res, int32_t row, int32_t col) {
@@ -774,8 +765,13 @@ static void destoryCatalogReq(SCatalogReq *pCatalogReq) {
taosArrayDestroy(pCatalogReq->pDbVgroup);
taosArrayDestroy(pCatalogReq->pDbCfg);
taosArrayDestroy(pCatalogReq->pDbInfo);
- taosArrayDestroyEx(pCatalogReq->pTableMeta, destoryTablesReq);
- taosArrayDestroyEx(pCatalogReq->pTableHash, destoryTablesReq);
+ if (pCatalogReq->cloned) {
+ taosArrayDestroy(pCatalogReq->pTableMeta);
+ taosArrayDestroy(pCatalogReq->pTableHash);
+ } else {
+ taosArrayDestroyEx(pCatalogReq->pTableMeta, destoryTablesReq);
+ taosArrayDestroyEx(pCatalogReq->pTableHash, destoryTablesReq);
+ }
taosArrayDestroy(pCatalogReq->pUdf);
taosArrayDestroy(pCatalogReq->pIndex);
taosArrayDestroy(pCatalogReq->pUser);
@@ -794,26 +790,108 @@ void destorySqlCallbackWrapper(SSqlCallbackWrapper *pWrapper) {
taosMemoryFree(pWrapper);
}
+void destroyCtxInRequest(SRequestObj* pRequest) {
+ schedulerFreeJob(&pRequest->body.queryJob, 0);
+ qDestroyQuery(pRequest->pQuery);
+ pRequest->pQuery = NULL;
+ destorySqlCallbackWrapper(pRequest->pWrapper);
+ pRequest->pWrapper = NULL;
+}
+
+
static void doAsyncQueryFromAnalyse(SMetaData *pResultMeta, void *param, int32_t code) {
SSqlCallbackWrapper *pWrapper = (SSqlCallbackWrapper *)param;
SRequestObj *pRequest = pWrapper->pRequest;
SQuery *pQuery = pRequest->pQuery;
- int64_t analyseStart = taosGetTimestampUs();
- pRequest->metric.ctgCostUs = analyseStart - pRequest->metric.ctgStart;
qDebug("0x%" PRIx64 " start to semantic analysis, reqId:0x%" PRIx64, pRequest->self, pRequest->requestId);
- if (code == TSDB_CODE_SUCCESS) {
+ int64_t analyseStart = taosGetTimestampUs();
+ pRequest->metric.ctgCostUs = analyseStart - pRequest->metric.ctgStart;
+
+ if (TSDB_CODE_SUCCESS == code) {
code = qAnalyseSqlSemantic(pWrapper->pParseCtx, pWrapper->pCatalogReq, pResultMeta, pQuery);
+ }
+
+ pRequest->metric.analyseCostUs += taosGetTimestampUs() - analyseStart;
+
+ handleQueryAnslyseRes(pWrapper, pResultMeta, code);
+}
+
+int32_t cloneCatalogReq(SCatalogReq* * ppTarget, SCatalogReq* pSrc) {
+ int32_t code = TSDB_CODE_SUCCESS;
+ SCatalogReq* pTarget = taosMemoryCalloc(1, sizeof(SCatalogReq));
+ if (pTarget == NULL) {
+ code = TSDB_CODE_OUT_OF_MEMORY;
+ } else {
+ pTarget->pDbVgroup = taosArrayDup(pSrc->pDbVgroup, NULL);
+ pTarget->pDbCfg = taosArrayDup(pSrc->pDbCfg, NULL);
+ pTarget->pDbInfo = taosArrayDup(pSrc->pDbInfo, NULL);
+ pTarget->pTableMeta = taosArrayDup(pSrc->pTableMeta, NULL);
+ pTarget->pTableHash = taosArrayDup(pSrc->pTableHash, NULL);
+ pTarget->pUdf = taosArrayDup(pSrc->pUdf, NULL);
+ pTarget->pIndex = taosArrayDup(pSrc->pIndex, NULL);
+ pTarget->pUser = taosArrayDup(pSrc->pUser, NULL);
+ pTarget->pTableIndex = taosArrayDup(pSrc->pTableIndex, NULL);
+ pTarget->pTableCfg = taosArrayDup(pSrc->pTableCfg, NULL);
+ pTarget->pTableTag = taosArrayDup(pSrc->pTableTag, NULL);
+ pTarget->qNodeRequired = pSrc->qNodeRequired;
+ pTarget->dNodeRequired = pSrc->dNodeRequired;
+ pTarget->svrVerRequired = pSrc->svrVerRequired;
+ pTarget->forceUpdate = pSrc->forceUpdate;
+ pTarget->cloned = true;
+
+ *ppTarget = pTarget;
+ }
+
+ return code;
+}
+
+
+void handleSubQueryFromAnalyse(SSqlCallbackWrapper *pWrapper, SMetaData *pResultMeta, SNode* pRoot) {
+ SRequestObj* pNewRequest = NULL;
+ SSqlCallbackWrapper* pNewWrapper = NULL;
+ int32_t code = buildPreviousRequest(pWrapper->pRequest, pWrapper->pRequest->sqlstr, &pNewRequest);
+ if (code) {
+ handleQueryAnslyseRes(pWrapper, pResultMeta, code);
+ return;
+ }
+
+ pNewRequest->pQuery = (SQuery*)nodesMakeNode(QUERY_NODE_QUERY);
+ if (NULL == pNewRequest->pQuery) {
+ code = TSDB_CODE_OUT_OF_MEMORY;
+ } else {
+ pNewRequest->pQuery->pRoot = pRoot;
+ pRoot = NULL;
+ pNewRequest->pQuery->execStage = QUERY_EXEC_STAGE_ANALYSE;
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = prepareAndParseSqlSyntax(&pNewWrapper, pNewRequest, false);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = cloneCatalogReq(&pNewWrapper->pCatalogReq, pWrapper->pCatalogReq);
+ }
+ doAsyncQueryFromAnalyse(pResultMeta, pNewWrapper, code);
+ nodesDestroyNode(pRoot);
+}
+
+void handleQueryAnslyseRes(SSqlCallbackWrapper *pWrapper, SMetaData *pResultMeta, int32_t code) {
+ SRequestObj *pRequest = pWrapper->pRequest;
+ SQuery *pQuery = pRequest->pQuery;
+
+ if (code == TSDB_CODE_SUCCESS && pQuery->pPrevRoot) {
+ SNode* prevRoot = pQuery->pPrevRoot;
+ pQuery->pPrevRoot = NULL;
+ handleSubQueryFromAnalyse(pWrapper, pResultMeta, prevRoot);
+ return;
+ }
+
+ if (code == TSDB_CODE_SUCCESS) {
pRequest->stableQuery = pQuery->stableQuery;
if (pQuery->pRoot) {
pRequest->stmtType = pQuery->pRoot->type;
}
- }
- pRequest->metric.analyseCostUs = taosGetTimestampUs() - analyseStart;
-
- if (code == TSDB_CODE_SUCCESS) {
if (pQuery->haveResultSet) {
setResSchemaInfo(&pRequest->body.resInfo, pQuery->pResSchema, pQuery->numOfResCols);
setResPrecision(&pRequest->body.resInfo, pQuery->precision);
@@ -826,14 +904,14 @@ static void doAsyncQueryFromAnalyse(SMetaData *pResultMeta, void *param, int32_t
launchAsyncQuery(pRequest, pQuery, pResultMeta, pWrapper);
} else {
destorySqlCallbackWrapper(pWrapper);
+ pRequest->pWrapper = NULL;
qDestroyQuery(pRequest->pQuery);
pRequest->pQuery = NULL;
if (NEED_CLIENT_HANDLE_ERROR(code)) {
tscDebug("0x%" PRIx64 " client retry to handle the error, code:%d - %s, tryCount:%d, reqId:0x%" PRIx64,
pRequest->self, code, tstrerror(code), pRequest->retry, pRequest->requestId);
- pRequest->prevCode = code;
- doAsyncQuery(pRequest, true);
+ restartAsyncQuery(pRequest, code);
return;
}
@@ -841,7 +919,7 @@ static void doAsyncQueryFromAnalyse(SMetaData *pResultMeta, void *param, int32_t
tscError("0x%" PRIx64 " error occurs, code:%s, return to user app, reqId:0x%" PRIx64, pRequest->self,
tstrerror(code), pRequest->requestId);
pRequest->code = code;
- pRequest->body.queryFp(pRequest->body.param, pRequest, code);
+ returnToUser(pRequest);
}
}
@@ -904,6 +982,7 @@ static void doAsyncQueryFromParse(SMetaData *pResultMeta, void *param, int32_t c
tscError("0x%" PRIx64 " error happens, code:%d - %s, reqId:0x%" PRIx64, pWrapper->pRequest->self, code,
tstrerror(code), pWrapper->pRequest->requestId);
destorySqlCallbackWrapper(pWrapper);
+ pRequest->pWrapper = NULL;
terrno = code;
pRequest->code = code;
pRequest->body.queryFp(pRequest->body.param, pRequest, code);
@@ -920,6 +999,7 @@ void continueInsertFromCsv(SSqlCallbackWrapper *pWrapper, SRequestObj *pRequest)
tscError("0x%" PRIx64 " error happens, code:%d - %s, reqId:0x%" PRIx64, pWrapper->pRequest->self, code,
tstrerror(code), pWrapper->pRequest->requestId);
destorySqlCallbackWrapper(pWrapper);
+ pRequest->pWrapper = NULL;
terrno = code;
pRequest->code = code;
pRequest->body.queryFp(pRequest->body.param, pRequest, code);
@@ -967,27 +1047,16 @@ int32_t createParseContext(const SRequestObj *pRequest, SParseContext **pCxt) {
return TSDB_CODE_SUCCESS;
}
-void doAsyncQuery(SRequestObj *pRequest, bool updateMetaForce) {
+int32_t prepareAndParseSqlSyntax(SSqlCallbackWrapper **ppWrapper, SRequestObj *pRequest, bool updateMetaForce) {
+ int32_t code = TSDB_CODE_SUCCESS;
STscObj *pTscObj = pRequest->pTscObj;
- SSqlCallbackWrapper *pWrapper = NULL;
- int32_t code = TSDB_CODE_SUCCESS;
-
- if (pRequest->retry++ > REQUEST_TOTAL_EXEC_TIMES) {
- code = pRequest->prevCode;
- terrno = code;
- pRequest->code = code;
- tscDebug("call sync query cb with code: %s", tstrerror(code));
- pRequest->body.queryFp(pRequest->body.param, pRequest, code);
- return;
- }
-
- if (TSDB_CODE_SUCCESS == code) {
- pWrapper = taosMemoryCalloc(1, sizeof(SSqlCallbackWrapper));
- if (pWrapper == NULL) {
- code = TSDB_CODE_OUT_OF_MEMORY;
- } else {
- pWrapper->pRequest = pRequest;
- }
+ SSqlCallbackWrapper *pWrapper = taosMemoryCalloc(1, sizeof(SSqlCallbackWrapper));
+ if (pWrapper == NULL) {
+ code = TSDB_CODE_OUT_OF_MEMORY;
+ } else {
+ pWrapper->pRequest = pRequest;
+ pRequest->pWrapper = pWrapper;
+ *ppWrapper = pWrapper;
}
if (TSDB_CODE_SUCCESS == code) {
@@ -999,7 +1068,7 @@ void doAsyncQuery(SRequestObj *pRequest, bool updateMetaForce) {
code = catalogGetHandle(pTscObj->pAppInfo->clusterId, &pWrapper->pParseCtx->pCatalog);
}
- if (TSDB_CODE_SUCCESS == code) {
+ if (TSDB_CODE_SUCCESS == code && NULL == pRequest->pQuery) {
int64_t syntaxStart = taosGetTimestampUs();
pWrapper->pCatalogReq = taosMemoryCalloc(1, sizeof(SCatalogReq));
@@ -1014,6 +1083,27 @@ void doAsyncQuery(SRequestObj *pRequest, bool updateMetaForce) {
pRequest->metric.parseCostUs += taosGetTimestampUs() - syntaxStart;
}
+ return code;
+}
+
+
+void doAsyncQuery(SRequestObj *pRequest, bool updateMetaForce) {
+ SSqlCallbackWrapper *pWrapper = NULL;
+ int32_t code = TSDB_CODE_SUCCESS;
+
+ if (pRequest->retry++ > REQUEST_TOTAL_EXEC_TIMES) {
+ code = pRequest->prevCode;
+ terrno = code;
+ pRequest->code = code;
+ tscDebug("call sync query cb with code: %s", tstrerror(code));
+ pRequest->body.queryFp(pRequest->body.param, pRequest, code);
+ return;
+ }
+
+ if (TSDB_CODE_SUCCESS == code) {
+ code = prepareAndParseSqlSyntax(&pWrapper, pRequest, updateMetaForce);
+ }
+
if (TSDB_CODE_SUCCESS == code) {
pRequest->stmtType = pRequest->pQuery->pRoot->type;
code = phaseAsyncQuery(pWrapper);
@@ -1023,6 +1113,7 @@ void doAsyncQuery(SRequestObj *pRequest, bool updateMetaForce) {
tscError("0x%" PRIx64 " error happens, code:%d - %s, reqId:0x%" PRIx64, pRequest->self, code, tstrerror(code),
pRequest->requestId);
destorySqlCallbackWrapper(pWrapper);
+ pRequest->pWrapper = NULL;
qDestroyQuery(pRequest->pQuery);
pRequest->pQuery = NULL;
@@ -1040,48 +1131,57 @@ void doAsyncQuery(SRequestObj *pRequest, bool updateMetaForce) {
}
}
-static void fetchCallback(void *pResult, void *param, int32_t code) {
- SRequestObj *pRequest = (SRequestObj *)param;
-
- SReqResultInfo *pResultInfo = &pRequest->body.resInfo;
-
- tscDebug("0x%" PRIx64 " enter scheduler fetch cb, code:%d - %s, reqId:0x%" PRIx64, pRequest->self, code,
- tstrerror(code), pRequest->requestId);
-
- pResultInfo->pData = pResult;
- pResultInfo->numOfRows = 0;
-
- if (code != TSDB_CODE_SUCCESS) {
- pRequest->code = code;
- taosMemoryFreeClear(pResultInfo->pData);
- pRequest->body.fetchFp(pRequest->body.param, pRequest, 0);
- return;
+void restartAsyncQuery(SRequestObj *pRequest, int32_t code) {
+ int32_t reqIdx = 0;
+ SRequestObj *pReqList[16] = {NULL};
+ SRequestObj *pUserReq = NULL;
+ pReqList[0] = pRequest;
+ uint64_t tmpRefId = 0;
+ SRequestObj* pTmp = pRequest;
+ while (pTmp->relation.prevRefId) {
+ tmpRefId = pTmp->relation.prevRefId;
+ pTmp = acquireRequest(tmpRefId);
+ if (pTmp) {
+ pReqList[++reqIdx] = pTmp;
+ releaseRequest(tmpRefId);
+ } else {
+ tscError("0x%" PRIx64 ", prev req ref 0x%" PRIx64 " is not there, reqId:0x%" PRIx64, pTmp->self,
+ tmpRefId, pTmp->requestId);
+ break;
+ }
}
- if (pRequest->code != TSDB_CODE_SUCCESS) {
- taosMemoryFreeClear(pResultInfo->pData);
- pRequest->body.fetchFp(pRequest->body.param, pRequest, 0);
- return;
+ tmpRefId = pRequest->relation.nextRefId;
+ while (tmpRefId) {
+ pTmp = acquireRequest(tmpRefId);
+ if (pTmp) {
+ tmpRefId = pTmp->relation.nextRefId;
+ removeRequest(pTmp->self);
+ releaseRequest(pTmp->self);
+ } else {
+ tscError("0x%" PRIx64 " is not there", tmpRefId);
+ break;
+ }
}
- pRequest->code =
- setQueryResultFromRsp(pResultInfo, (const SRetrieveTableRsp *)pResultInfo->pData, pResultInfo->convertUcs4, true);
- if (pRequest->code != TSDB_CODE_SUCCESS) {
- pResultInfo->numOfRows = 0;
- pRequest->code = code;
- tscError("0x%" PRIx64 " fetch results failed, code:%s, reqId:0x%" PRIx64, pRequest->self, tstrerror(code),
- pRequest->requestId);
+ for (int32_t i = reqIdx; i >= 0; i--) {
+ destroyCtxInRequest(pReqList[i]);
+ if (pReqList[i]->relation.userRefId == pReqList[i]->self || 0 == pReqList[i]->relation.userRefId) {
+ pUserReq = pReqList[i];
+ } else {
+ removeRequest(pReqList[i]->self);
+ }
+ }
+
+ if (pUserReq) {
+ pUserReq->prevCode = code;
+ memset(&pUserReq->relation, 0, sizeof(pUserReq->relation));
} else {
- tscDebug("0x%" PRIx64 " fetch results, numOfRows:%" PRId64 " total Rows:%" PRId64 ", complete:%d, reqId:0x%" PRIx64,
- pRequest->self, pResultInfo->numOfRows, pResultInfo->totalRows, pResultInfo->completed,
- pRequest->requestId);
-
- STscObj *pTscObj = pRequest->pTscObj;
- SAppClusterSummary *pActivity = &pTscObj->pAppInfo->summary;
- atomic_add_fetch_64((int64_t *)&pActivity->fetchBytes, pRequest->body.resInfo.payloadLen);
+ tscError("user req is missing");
+ return;
}
- pRequest->body.fetchFp(pRequest->body.param, pRequest, pResultInfo->numOfRows);
+ doAsyncQuery(pUserReq, true);
}
void taos_fetch_rows_a(TAOS_RES *res, __taos_async_fn_t fp, void *param) {
@@ -1095,43 +1195,8 @@ void taos_fetch_rows_a(TAOS_RES *res, __taos_async_fn_t fp, void *param) {
}
SRequestObj *pRequest = res;
- pRequest->body.fetchFp = fp;
- pRequest->body.param = param;
- SReqResultInfo *pResultInfo = &pRequest->body.resInfo;
-
- // this query has no results or error exists, return directly
- if (taos_num_fields(pRequest) == 0 || pRequest->code != TSDB_CODE_SUCCESS) {
- pResultInfo->numOfRows = 0;
- pRequest->body.fetchFp(param, pRequest, pResultInfo->numOfRows);
- return;
- }
-
- // all data has returned to App already, no need to try again
- if (pResultInfo->completed) {
- // it is a local executed query, no need to do async fetch
- if (QUERY_EXEC_MODE_SCHEDULE != pRequest->body.execMode) {
- if (pResultInfo->localResultFetched) {
- pResultInfo->numOfRows = 0;
- pResultInfo->current = 0;
- } else {
- pResultInfo->localResultFetched = true;
- }
- } else {
- pResultInfo->numOfRows = 0;
- }
-
- pRequest->body.fetchFp(param, pRequest, pResultInfo->numOfRows);
- return;
- }
-
- SSchedulerReq req = {
- .syncReq = false,
- .fetchFp = fetchCallback,
- .cbParam = pRequest,
- };
-
- schedulerFetchRows(pRequest->body.queryJob, &req);
+ taosAsyncFetchImpl(pRequest, fp, param);
}
void taos_fetch_raw_block_a(TAOS_RES *res, __taos_async_fn_t fp, void *param) {
diff --git a/source/client/src/clientMsgHandler.c b/source/client/src/clientMsgHandler.c
index 6d53f2b4c5..d6fdb29b59 100644
--- a/source/client/src/clientMsgHandler.c
+++ b/source/client/src/clientMsgHandler.c
@@ -77,6 +77,7 @@ int32_t processConnectRsp(void* param, SDataBuf* pMsg, int32_t code) {
}
if ((code = taosCheckVersionCompatibleFromStr(version, connectRsp.sVer, 3)) != 0) {
+ tscError("version not compatible. client version: %s, server version: %s", version, connectRsp.sVer);
setErrno(pRequest, code);
tsem_post(&pRequest->body.rspSem);
goto End;
diff --git a/source/client/src/clientTmq.c b/source/client/src/clientTmq.c
index e1b2b9c48b..e7927cd0ae 100644
--- a/source/client/src/clientTmq.c
+++ b/source/client/src/clientTmq.c
@@ -82,7 +82,7 @@ struct tmq_t {
int8_t useSnapshot;
int8_t autoCommit;
int32_t autoCommitInterval;
- int32_t resetOffsetCfg;
+ int8_t resetOffsetCfg;
uint64_t consumerId;
bool hbBgEnable;
tmq_commit_cb* commitCb;
@@ -99,6 +99,7 @@ struct tmq_t {
// poll info
int64_t pollCnt;
int64_t totalRows;
+ bool needReportOffsetRows;
// timer
tmr_h hbLiveTimer;
@@ -264,7 +265,7 @@ tmq_conf_t* tmq_conf_new() {
conf->withTbName = false;
conf->autoCommit = true;
conf->autoCommitInterval = DEFAULT_AUTO_COMMIT_INTERVAL;
- conf->resetOffset = TMQ_OFFSET__RESET_EARLIEAST;
+ conf->resetOffset = TMQ_OFFSET__RESET_EARLIEST;
conf->hbBgEnable = true;
return conf;
@@ -318,7 +319,7 @@ tmq_conf_res_t tmq_conf_set(tmq_conf_t* conf, const char* key, const char* value
conf->resetOffset = TMQ_OFFSET__RESET_NONE;
return TMQ_CONF_OK;
} else if (strcasecmp(value, "earliest") == 0) {
- conf->resetOffset = TMQ_OFFSET__RESET_EARLIEAST;
+ conf->resetOffset = TMQ_OFFSET__RESET_EARLIEST;
return TMQ_CONF_OK;
} else if (strcasecmp(value, "latest") == 0) {
conf->resetOffset = TMQ_OFFSET__RESET_LATEST;
@@ -357,7 +358,7 @@ tmq_conf_res_t tmq_conf_set(tmq_conf_t* conf, const char* key, const char* value
return TMQ_CONF_OK;
}
- if (strcasecmp(key, "enable.heartbeat.background") == 0) {
+// if (strcasecmp(key, "enable.heartbeat.background") == 0) {
// if (strcasecmp(value, "true") == 0) {
// conf->hbBgEnable = true;
// return TMQ_CONF_OK;
@@ -365,10 +366,10 @@ tmq_conf_res_t tmq_conf_set(tmq_conf_t* conf, const char* key, const char* value
// conf->hbBgEnable = false;
// return TMQ_CONF_OK;
// } else {
- tscError("the default value of enable.heartbeat.background is true, can not be seted");
- return TMQ_CONF_INVALID;
+// tscError("the default value of enable.heartbeat.background is true, can not be seted");
+// return TMQ_CONF_INVALID;
// }
- }
+// }
if (strcasecmp(key, "td.connect.ip") == 0) {
conf->ip = taosStrdup(value);
@@ -422,30 +423,30 @@ char** tmq_list_to_c_array(const tmq_list_t* list) {
return container->pData;
}
-static SMqClientVg* foundClientVg(SArray* pTopicList, const char* pName, int32_t vgId, int32_t* index,
- int32_t* numOfVgroups) {
- int32_t numOfTopics = taosArrayGetSize(pTopicList);
- *index = -1;
- *numOfVgroups = 0;
-
- for (int32_t i = 0; i < numOfTopics; ++i) {
- SMqClientTopic* pTopic = taosArrayGet(pTopicList, i);
- if (strcmp(pTopic->topicName, pName) != 0) {
- continue;
- }
-
- *numOfVgroups = taosArrayGetSize(pTopic->vgs);
- for (int32_t j = 0; j < (*numOfVgroups); ++j) {
- SMqClientVg* pClientVg = taosArrayGet(pTopic->vgs, j);
- if (pClientVg->vgId == vgId) {
- *index = j;
- return pClientVg;
- }
- }
- }
-
- return NULL;
-}
+//static SMqClientVg* foundClientVg(SArray* pTopicList, const char* pName, int32_t vgId, int32_t* index,
+// int32_t* numOfVgroups) {
+// int32_t numOfTopics = taosArrayGetSize(pTopicList);
+// *index = -1;
+// *numOfVgroups = 0;
+//
+// for (int32_t i = 0; i < numOfTopics; ++i) {
+// SMqClientTopic* pTopic = taosArrayGet(pTopicList, i);
+// if (strcmp(pTopic->topicName, pName) != 0) {
+// continue;
+// }
+//
+// *numOfVgroups = taosArrayGetSize(pTopic->vgs);
+// for (int32_t j = 0; j < (*numOfVgroups); ++j) {
+// SMqClientVg* pClientVg = taosArrayGet(pTopic->vgs, j);
+// if (pClientVg->vgId == vgId) {
+// *index = j;
+// return pClientVg;
+// }
+// }
+// }
+//
+// return NULL;
+//}
// Two problems do not need to be addressed here
// 1. update to of epset. the response of poll request will automatically handle this problem
@@ -567,12 +568,12 @@ static int32_t doSendCommitMsg(tmq_t* tmq, SMqClientVg* pVg, const char* pTopicN
atomic_add_fetch_32(&pParamSet->totalRspNum, 1);
SEp* pEp = GET_ACTIVE_EP(&pVg->epSet);
- char offsetBuf[80] = {0};
+ char offsetBuf[TSDB_OFFSET_LEN] = {0};
tFormatOffset(offsetBuf, tListLen(offsetBuf), &pOffset->offset.val);
- char commitBuf[80] = {0};
+ char commitBuf[TSDB_OFFSET_LEN] = {0};
tFormatOffset(commitBuf, tListLen(commitBuf), &pVg->offsetInfo.committedOffset);
- tscDebug("consumer:0x%" PRIx64 " topic:%s on vgId:%d send offset:%s prev:%s, ep:%s:%d, ordinal:%d/%d, req:0x%" PRIx64,
+ tscInfo("consumer:0x%" PRIx64 " topic:%s on vgId:%d send offset:%s prev:%s, ep:%s:%d, ordinal:%d/%d, req:0x%" PRIx64,
tmq->consumerId, pOffset->offset.subKey, pVg->vgId, offsetBuf, commitBuf, pEp->fqdn, pEp->port, index + 1,
totalVgroups, pMsgSendInfo->requestId);
@@ -796,6 +797,27 @@ void tmqSendHbReq(void* param, void* tmrId) {
SMqHbReq req = {0};
req.consumerId = tmq->consumerId;
req.epoch = tmq->epoch;
+ if(tmq->needReportOffsetRows){
+ req.topics = taosArrayInit(taosArrayGetSize(tmq->clientTopics), sizeof(TopicOffsetRows));
+ for(int i = 0; i < taosArrayGetSize(tmq->clientTopics); i++){
+ SMqClientTopic* pTopic = taosArrayGet(tmq->clientTopics, i);
+ int32_t numOfVgroups = taosArrayGetSize(pTopic->vgs);
+ TopicOffsetRows* data = taosArrayReserve(req.topics, 1);
+ strcpy(data->topicName, pTopic->topicName);
+ data->offsetRows = taosArrayInit(numOfVgroups, sizeof(OffsetRows));
+ for(int j = 0; j < numOfVgroups; j++){
+ SMqClientVg* pVg = taosArrayGet(pTopic->vgs, j);
+ OffsetRows* offRows = taosArrayReserve(data->offsetRows, 1);
+ offRows->vgId = pVg->vgId;
+ offRows->rows = pVg->numOfRows;
+ offRows->offset = pVg->offsetInfo.committedOffset;
+ char buf[TSDB_OFFSET_LEN] = {0};
+ tFormatOffset(buf, TSDB_OFFSET_LEN, &offRows->offset);
+ tscInfo("report offset: vgId:%d, offset:%s, rows:%"PRId64, offRows->vgId, buf, offRows->rows);
+ }
+ }
+ tmq->needReportOffsetRows = false;
+ }
int32_t tlen = tSerializeSMqHbReq(NULL, 0, &req);
if (tlen < 0) {
@@ -835,13 +857,14 @@ void tmqSendHbReq(void* param, void* tmrId) {
asyncSendMsgToServer(tmq->pTscObj->pAppInfo->pTransporter, &epSet, &transporterId, sendInfo);
OVER:
+ tDeatroySMqHbReq(&req);
taosTmrReset(tmqSendHbReq, 1000, param, tmqMgmt.timer, &tmq->hbLiveTimer);
taosReleaseRef(tmqMgmt.rsetId, refId);
}
static void defaultCommitCbFn(tmq_t* pTmq, int32_t code, void* param) {
if (code != 0) {
- tscDebug("consumer:0x%" PRIx64 ", failed to commit offset, code:%s", pTmq->consumerId, tstrerror(code));
+ tscError("consumer:0x%" PRIx64 ", failed to commit offset, code:%s", pTmq->consumerId, tstrerror(code));
}
}
@@ -969,6 +992,14 @@ int32_t tmq_subscription(tmq_t* tmq, tmq_list_t** topics) {
}
int32_t tmq_unsubscribe(tmq_t* tmq) {
+ if (tmq->autoCommit) {
+ int32_t rsp = tmq_commit_sync(tmq, NULL);
+ if (rsp != 0) {
+ return rsp;
+ }
+ }
+ taosSsleep(2); // sleep 2s for hb to send offset and rows to server
+
int32_t rsp;
int32_t retryCnt = 0;
tmq_list_t* lst = tmq_list_new();
@@ -1063,6 +1094,7 @@ tmq_t* tmq_consumer_new(tmq_conf_t* conf, char* errstr, int32_t errstrLen) {
pTmq->status = TMQ_CONSUMER_STATUS__INIT;
pTmq->pollCnt = 0;
pTmq->epoch = 0;
+ pTmq->needReportOffsetRows = true;
// set conf
strcpy(pTmq->clientId, conf->clientId);
@@ -1107,7 +1139,7 @@ tmq_t* tmq_consumer_new(tmq_conf_t* conf, char* errstr, int32_t errstrLen) {
pTmq->hbLiveTimer = taosTmrStart(tmqSendHbReq, 1000, pRefId, tmqMgmt.timer);
}
- char buf[80] = {0};
+ char buf[TSDB_OFFSET_LEN] = {0};
STqOffsetVal offset = {.type = pTmq->resetOffsetCfg};
tFormatOffset(buf, tListLen(buf), &offset);
tscInfo("consumer:0x%" PRIx64 " is setup, refId:%" PRId64
@@ -1123,7 +1155,7 @@ _failed:
}
int32_t tmq_subscribe(tmq_t* tmq, const tmq_list_t* topic_list) {
- const int32_t MAX_RETRY_COUNT = 120 * 60; // let's wait for 2 mins at most
+ const int32_t MAX_RETRY_COUNT = 120 * 2; // let's wait for 2 mins at most
const SArray* container = &topic_list->container;
int32_t sz = taosArrayGetSize(container);
void* buf = NULL;
@@ -1131,7 +1163,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 " cgroup:%s, subscribe %d topics", tmq->consumerId, tmq->groupId, sz);
+ tscInfo("consumer:0x%" PRIx64 " cgroup:%s, subscribe %d topics", tmq->consumerId, tmq->groupId, sz);
req.consumerId = tmq->consumerId;
tstrncpy(req.clientId, tmq->clientId, 256);
@@ -1143,6 +1175,11 @@ int32_t tmq_subscribe(tmq_t* tmq, const tmq_list_t* topic_list) {
goto FAIL;
}
+ req.withTbName = tmq->withTbName;
+ req.autoCommit = tmq->autoCommit;
+ req.autoCommitInterval = tmq->autoCommitInterval;
+ req.resetOffsetCfg = tmq->resetOffsetCfg;
+
for (int32_t i = 0; i < sz; i++) {
char* topic = taosArrayGetP(container, i);
@@ -1154,7 +1191,7 @@ int32_t tmq_subscribe(tmq_t* tmq, const tmq_list_t* topic_list) {
}
tNameExtractFullName(&name, topicFName);
- tscDebug("consumer:0x%" PRIx64 " subscribe topic:%s", tmq->consumerId, topicFName);
+ tscInfo("consumer:0x%" PRIx64 " subscribe topic:%s", tmq->consumerId, topicFName);
taosArrayPush(req.topicNames, &topicFName);
}
@@ -1215,7 +1252,7 @@ int32_t tmq_subscribe(tmq_t* tmq, const tmq_list_t* topic_list) {
goto FAIL;
}
- tscDebug("consumer:0x%" PRIx64 ", mnd not ready for subscribe, retry:%d in 500ms", tmq->consumerId, retryCnt);
+ tscInfo("consumer:0x%" PRIx64 ", mnd not ready for subscribe, retry:%d in 500ms", tmq->consumerId, retryCnt);
taosMsleep(500);
}
@@ -1375,8 +1412,8 @@ int32_t tmqPollCb(void* param, SDataBuf* pMsg, int32_t code) {
tDecoderClear(&decoder);
memcpy(&pRspWrapper->dataRsp, pMsg->pData, sizeof(SMqRspHead));
- char buf[80];
- tFormatOffset(buf, 80, &pRspWrapper->dataRsp.rspOffset);
+ char buf[TSDB_OFFSET_LEN];
+ tFormatOffset(buf, TSDB_OFFSET_LEN, &pRspWrapper->dataRsp.rspOffset);
tscDebug("consumer:0x%" PRIx64 " recv poll rsp, vgId:%d, req ver:%" PRId64 ", rsp:%s type %d, reqId:0x%" PRIx64,
tmq->consumerId, vgId, pRspWrapper->dataRsp.reqOffset.version, buf, rspType, requestId);
} else if (rspType == TMQ_MSG_TYPE__POLL_META_RSP) {
@@ -1442,7 +1479,7 @@ static void initClientTopicFromRsp(SMqClientTopic* pTopic, SMqSubTopicEp* pTopic
tstrncpy(pTopic->topicName, pTopicEp->topic, TSDB_TOPIC_FNAME_LEN);
tstrncpy(pTopic->db, pTopicEp->db, TSDB_DB_FNAME_LEN);
- tscDebug("consumer:0x%" PRIx64 ", update topic:%s, new numOfVgs:%d", tmq->consumerId, pTopic->topicName, vgNumGet);
+ tscInfo("consumer:0x%" PRIx64 ", update topic:%s, new numOfVgs:%d", tmq->consumerId, pTopic->topicName, vgNumGet);
pTopic->vgs = taosArrayInit(vgNumGet, sizeof(SMqClientVg));
for (int32_t j = 0; j < vgNumGet; j++) {
@@ -1495,7 +1532,7 @@ static bool doUpdateLocalEp(tmq_t* tmq, int32_t epoch, const SMqAskEpRsp* pRsp)
int32_t topicNumGet = taosArrayGetSize(pRsp->topics);
char vgKey[TSDB_TOPIC_FNAME_LEN + 22];
- tscDebug("consumer:0x%" PRIx64 " update ep epoch from %d to epoch %d, incoming topics:%d, existed topics:%d",
+ tscInfo("consumer:0x%" PRIx64 " update ep epoch from %d to epoch %d, incoming topics:%d, existed topics:%d",
tmq->consumerId, tmq->epoch, epoch, topicNumGet, topicNumCur);
if (epoch <= tmq->epoch) {
return false;
@@ -1518,14 +1555,14 @@ static bool doUpdateLocalEp(tmq_t* tmq, int32_t epoch, const SMqAskEpRsp* pRsp)
SMqClientTopic* pTopicCur = taosArrayGet(tmq->clientTopics, i);
if (pTopicCur->vgs) {
int32_t vgNumCur = taosArrayGetSize(pTopicCur->vgs);
- tscDebug("consumer:0x%" PRIx64 ", current vg num: %d", tmq->consumerId, vgNumCur);
+ tscInfo("consumer:0x%" PRIx64 ", current vg num: %d", tmq->consumerId, vgNumCur);
for (int32_t j = 0; j < vgNumCur; j++) {
SMqClientVg* pVgCur = taosArrayGet(pTopicCur->vgs, j);
makeTopicVgroupKey(vgKey, pTopicCur->topicName, pVgCur->vgId);
- char buf[80];
- tFormatOffset(buf, 80, &pVgCur->offsetInfo.currentOffset);
- tscDebug("consumer:0x%" PRIx64 ", epoch:%d vgId:%d vgKey:%s, offset:%s", tmq->consumerId, epoch, pVgCur->vgId,
+ char buf[TSDB_OFFSET_LEN];
+ tFormatOffset(buf, TSDB_OFFSET_LEN, &pVgCur->offsetInfo.currentOffset);
+ tscInfo("consumer:0x%" PRIx64 ", epoch:%d vgId:%d vgKey:%s, offset:%s", tmq->consumerId, epoch, pVgCur->vgId,
vgKey, buf);
SVgroupSaveInfo info = {.offset = pVgCur->offsetInfo.currentOffset, .numOfRows = pVgCur->numOfRows};
@@ -1555,7 +1592,7 @@ static bool doUpdateLocalEp(tmq_t* tmq, int32_t epoch, const SMqAskEpRsp* pRsp)
atomic_store_8(&tmq->status, flag);
atomic_store_32(&tmq->epoch, epoch);
- tscDebug("consumer:0x%" PRIx64 " update topic info completed", tmq->consumerId);
+ tscInfo("consumer:0x%" PRIx64 " update topic info completed", tmq->consumerId);
return set;
}
@@ -1591,7 +1628,7 @@ int32_t askEpCallbackFn(void* param, SDataBuf* pMsg, int32_t code) {
SMqRspHead* head = pMsg->pData;
int32_t epoch = atomic_load_32(&tmq->epoch);
if (head->epoch <= epoch) {
- tscDebug("consumer:0x%" PRIx64 ", recv ep, msg epoch %d, current epoch %d, no need to update local ep",
+ tscInfo("consumer:0x%" PRIx64 ", recv ep, msg epoch %d, current epoch %d, no need to update local ep",
tmq->consumerId, head->epoch, epoch);
if (tmq->status == TMQ_CONSUMER_STATUS__RECOVER) {
@@ -1603,7 +1640,7 @@ int32_t askEpCallbackFn(void* param, SDataBuf* pMsg, int32_t code) {
}
} else {
- tscDebug("consumer:0x%" PRIx64 ", recv ep, msg epoch %d, current epoch %d, update local ep", tmq->consumerId,
+ tscInfo("consumer:0x%" PRIx64 ", recv ep, msg epoch %d, current epoch %d, update local ep", tmq->consumerId,
head->epoch, epoch);
}
@@ -1673,7 +1710,7 @@ SMqRspObj* tmqBuildRspFromWrapper(SMqPollRspWrapper* pWrapper, SMqClientVg* pVg,
return pRspObj;
}
-SMqTaosxRspObj* tmqBuildTaosxRspFromWrapper(SMqPollRspWrapper* pWrapper) {
+SMqTaosxRspObj* tmqBuildTaosxRspFromWrapper(SMqPollRspWrapper* pWrapper, SMqClientVg* pVg, int64_t* numOfRows) {
SMqTaosxRspObj* pRspObj = taosMemoryCalloc(1, sizeof(SMqTaosxRspObj));
pRspObj->resType = RES_TYPE__TMQ_METADATA;
tstrncpy(pRspObj->topic, pWrapper->topicHandle->topicName, TSDB_TOPIC_FNAME_LEN);
@@ -1688,6 +1725,13 @@ SMqTaosxRspObj* tmqBuildTaosxRspFromWrapper(SMqPollRspWrapper* pWrapper) {
setResSchemaInfo(&pRspObj->resInfo, pWrapper->topicHandle->schema.pSchema, pWrapper->topicHandle->schema.nCols);
}
+ // extract the rows in this data packet
+ for (int32_t i = 0; i < pRspObj->rsp.blockNum; ++i) {
+ SRetrieveTableRsp* pRetrieve = (SRetrieveTableRsp*)taosArrayGetP(pRspObj->rsp.blockData, i);
+ int64_t rows = htobe64(pRetrieve->numOfRows);
+ pVg->numOfRows += rows;
+ (*numOfRows) += rows;
+ }
return pRspObj;
}
@@ -1745,7 +1789,7 @@ static int32_t doTmqPollImpl(tmq_t* pTmq, SMqClientTopic* pTopic, SMqClientVg* p
sendInfo->msgType = TDMT_VND_TMQ_CONSUME;
int64_t transporterId = 0;
- char offsetFormatBuf[80];
+ char offsetFormatBuf[TSDB_OFFSET_LEN];
tFormatOffset(offsetFormatBuf, tListLen(offsetFormatBuf), &pVg->offsetInfo.currentOffset);
tscDebug("consumer:0x%" PRIx64 " send poll to %s vgId:%d, epoch %d, req:%s, reqId:0x%" PRIx64, pTmq->consumerId,
@@ -1882,8 +1926,8 @@ static void* tmqHandleAllRsp(tmq_t* tmq, int64_t timeout, bool pollIfReset) {
pVg->offsetInfo.walVerEnd = pDataRsp->head.walever;
pVg->receivedInfoFromVnode = true;
- char buf[80];
- tFormatOffset(buf, 80, &pDataRsp->rspOffset);
+ char buf[TSDB_OFFSET_LEN];
+ tFormatOffset(buf, TSDB_OFFSET_LEN, &pDataRsp->rspOffset);
if (pDataRsp->blockNum == 0) {
tscDebug("consumer:0x%" PRIx64 " empty block received, vgId:%d, offset:%s, vg total:%" PRId64
" total:%" PRId64 " reqId:0x%" PRIx64,
@@ -1985,13 +2029,13 @@ static void* tmqHandleAllRsp(tmq_t* tmq, int64_t timeout, bool pollIfReset) {
if (pollRspWrapper->taosxRsp.createTableNum == 0) {
pRsp = tmqBuildRspFromWrapper(pollRspWrapper, pVg, &numOfRows);
} else {
- pRsp = tmqBuildTaosxRspFromWrapper(pollRspWrapper);
+ pRsp = tmqBuildTaosxRspFromWrapper(pollRspWrapper, pVg, &numOfRows);
}
tmq->totalRows += numOfRows;
- char buf[80];
- tFormatOffset(buf, 80, &pVg->offsetInfo.currentOffset);
+ char buf[TSDB_OFFSET_LEN];
+ tFormatOffset(buf, TSDB_OFFSET_LEN, &pVg->offsetInfo.currentOffset);
tscDebug("consumer:0x%" PRIx64 " process taosx poll rsp, vgId:%d, offset:%s, blocks:%d, rows:%" PRId64
", vg total:%" PRId64 " total:%" PRId64 " reqId:0x%" PRIx64,
tmq->consumerId, pVg->vgId, buf, pollRspWrapper->dataRsp.blockNum, numOfRows, pVg->numOfRows,
@@ -2024,12 +2068,12 @@ TAOS_RES* tmq_consumer_poll(tmq_t* tmq, int64_t timeout) {
void* rspObj;
int64_t startTime = taosGetTimestampMs();
- tscDebug("consumer:0x%" PRIx64 " start to poll at %" PRId64 ", timeout:%" PRId64, tmq->consumerId, startTime,
+ tscInfo("consumer:0x%" PRIx64 " start to poll at %" PRId64 ", timeout:%" PRId64, tmq->consumerId, startTime,
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);
+ tscInfo("consumer:0x%" PRIx64 " poll return since consumer is init", tmq->consumerId);
taosMsleep(500); // sleep for a while
return NULL;
}
@@ -2041,7 +2085,7 @@ TAOS_RES* tmq_consumer_poll(tmq_t* tmq, int64_t timeout) {
return NULL;
}
- tscDebug("consumer:0x%" PRIx64 " not ready, retry:%d/40 in 500ms", tmq->consumerId, retryCnt);
+ tscInfo("consumer:0x%" PRIx64 " not ready, retry:%d/40 in 500ms", tmq->consumerId, retryCnt);
taosMsleep(500);
}
}
@@ -2050,7 +2094,7 @@ TAOS_RES* tmq_consumer_poll(tmq_t* tmq, int64_t timeout) {
tmqHandleAllDelayedTask(tmq);
if (tmqPollImpl(tmq, timeout) < 0) {
- tscDebug("consumer:0x%" PRIx64 " return due to poll error", tmq->consumerId);
+ tscError("consumer:0x%" PRIx64 " return due to poll error", tmq->consumerId);
}
rspObj = tmqHandleAllRsp(tmq, timeout, false);
@@ -2058,7 +2102,7 @@ TAOS_RES* tmq_consumer_poll(tmq_t* tmq, int64_t timeout) {
tscDebug("consumer:0x%" PRIx64 " return rsp %p", tmq->consumerId, rspObj);
return (TAOS_RES*)rspObj;
} else if (terrno == TSDB_CODE_TQ_NO_COMMITTED_OFFSET) {
- tscDebug("consumer:0x%" PRIx64 " return null since no committed offset", tmq->consumerId);
+ tscInfo("consumer:0x%" PRIx64 " return null since no committed offset", tmq->consumerId);
return NULL;
}
@@ -2066,7 +2110,7 @@ TAOS_RES* tmq_consumer_poll(tmq_t* tmq, int64_t timeout) {
int64_t currentTime = taosGetTimestampMs();
int64_t elapsedTime = currentTime - startTime;
if (elapsedTime > timeout) {
- tscDebug("consumer:0x%" PRIx64 " (epoch %d) timeout, no rsp, start time %" PRId64 ", current time %" PRId64,
+ tscInfo("consumer:0x%" PRIx64 " (epoch %d) timeout, no rsp, start time %" PRId64 ", current time %" PRId64,
tmq->consumerId, tmq->epoch, startTime, currentTime);
return NULL;
}
@@ -2099,7 +2143,7 @@ static void displayConsumeStatistics(const tmq_t* pTmq) {
}
int32_t tmq_consumer_close(tmq_t* tmq) {
- tscDebug("consumer:0x%" PRIx64 " start to close consumer, status:%d", tmq->consumerId, tmq->status);
+ tscInfo("consumer:0x%" PRIx64 " start to close consumer, status:%d", tmq->consumerId, tmq->status);
displayConsumeStatistics(tmq);
if (tmq->status == TMQ_CONSUMER_STATUS__READY) {
@@ -2110,6 +2154,7 @@ int32_t tmq_consumer_close(tmq_t* tmq) {
return rsp;
}
}
+ taosSsleep(2); // sleep 2s for hb to send offset and rows to server
int32_t retryCnt = 0;
tmq_list_t* lst = tmq_list_new();
@@ -2125,7 +2170,7 @@ int32_t tmq_consumer_close(tmq_t* tmq) {
tmq_list_destroy(lst);
} else {
- tscWarn("consumer:0x%" PRIx64 " not in ready state, close it directly", tmq->consumerId);
+ tscInfo("consumer:0x%" PRIx64 " not in ready state, close it directly", tmq->consumerId);
}
taosRemoveRef(tmqMgmt.rsetId, tmq->refId);
@@ -2388,7 +2433,7 @@ void asyncAskEp(tmq_t* pTmq, __tmq_askep_fn_t askEpFn, void* param) {
sendInfo->msgType = TDMT_MND_TMQ_ASK_EP;
SEpSet epSet = getEpSet_s(&pTmq->pTscObj->pAppInfo->mgmtEp);
- tscDebug("consumer:0x%" PRIx64 " ask ep from mnode, reqId:0x%" PRIx64, pTmq->consumerId, sendInfo->requestId);
+ tscInfo("consumer:0x%" PRIx64 " ask ep from mnode, reqId:0x%" PRIx64, pTmq->consumerId, sendInfo->requestId);
int64_t transporterId = 0;
asyncSendMsgToServer(pTmq->pTscObj->pAppInfo->pTransporter, &epSet, &transporterId, sendInfo);
@@ -2411,6 +2456,7 @@ int32_t tmqCommitDone(SMqCommitCbParamSet* pParamSet) {
// if no more waiting rsp
pParamSet->callbackFn(tmq, pParamSet->code, pParamSet->userParam);
taosMemoryFree(pParamSet);
+ tmq->needReportOffsetRows = true;
taosReleaseRef(tmqMgmt.rsetId, refId);
return 0;
@@ -2608,10 +2654,10 @@ int32_t tmq_get_topic_assignment(tmq_t* tmq, const char* pTopicName, tmq_topic_a
sendInfo->msgType = TDMT_VND_TMQ_VG_WALINFO;
int64_t transporterId = 0;
- char offsetFormatBuf[80];
+ char offsetFormatBuf[TSDB_OFFSET_LEN];
tFormatOffset(offsetFormatBuf, tListLen(offsetFormatBuf), &pClientVg->offsetInfo.currentOffset);
- tscDebug("consumer:0x%" PRIx64 " %s retrieve wal info vgId:%d, epoch %d, req:%s, reqId:0x%" PRIx64,
+ tscInfo("consumer:0x%" PRIx64 " %s retrieve wal info vgId:%d, epoch %d, req:%s, reqId:0x%" PRIx64,
tmq->consumerId, pTopic->topicName, pClientVg->vgId, tmq->epoch, offsetFormatBuf, req.reqId);
asyncSendMsgToServer(tmq->pTscObj->pAppInfo->pTransporter, &pClientVg->epSet, &transporterId, sendInfo);
}
@@ -2645,10 +2691,10 @@ int32_t tmq_get_topic_assignment(tmq_t* tmq, const char* pTopicName, tmq_topic_a
pOffsetInfo->currentOffset.type = TMQ_OFFSET__LOG;
- char offsetBuf[80] = {0};
+ char offsetBuf[TSDB_OFFSET_LEN] = {0};
tFormatOffset(offsetBuf, tListLen(offsetBuf), &pOffsetInfo->currentOffset);
- tscDebug("vgId:%d offset is update to:%s", p->vgId, offsetBuf);
+ tscInfo("vgId:%d offset is update to:%s", p->vgId, offsetBuf);
pOffsetInfo->walVerBegin = p->begin;
pOffsetInfo->walVerEnd = p->end;
@@ -2727,7 +2773,7 @@ int32_t tmq_offset_seek(tmq_t* tmq, const char* pTopicName, int32_t vgId, int64_
SMqRspObj rspObj = {.resType = RES_TYPE__TMQ, .vgId = pVg->vgId};
tstrncpy(rspObj.topic, tname, tListLen(rspObj.topic));
- tscDebug("consumer:0x%" PRIx64 " seek to %" PRId64 " on vgId:%d", tmq->consumerId, offset, pVg->vgId);
+ tscInfo("consumer:0x%" PRIx64 " seek to %" PRId64 " on vgId:%d", tmq->consumerId, offset, pVg->vgId);
SSyncCommitInfo* pInfo = taosMemoryMalloc(sizeof(SSyncCommitInfo));
if (pInfo == NULL) {
diff --git a/source/common/src/systable.c b/source/common/src/systable.c
index bb0e882fcd..7cd33955c1 100644
--- a/source/common/src/systable.c
+++ b/source/common/src/systable.c
@@ -291,6 +291,8 @@ static const SSysDbTableSchema subscriptionSchema[] = {
{.name = "consumer_group", .bytes = TSDB_CGROUP_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY, .sysInfo = false},
{.name = "vgroup_id", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = false},
{.name = "consumer_id", .bytes = 8, .type = TSDB_DATA_TYPE_BIGINT, .sysInfo = false},
+ {.name = "offset", .bytes = TSDB_OFFSET_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY, .sysInfo = false},
+ {.name = "rows", .bytes = 8, .type = TSDB_DATA_TYPE_BIGINT, .sysInfo = false},
};
static const SSysDbTableSchema vnodesSchema[] = {
@@ -359,6 +361,7 @@ static const SSysDbTableSchema consumerSchema[] = {
{.name = "up_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP, .sysInfo = false},
{.name = "subscribe_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP, .sysInfo = false},
{.name = "rebalance_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP, .sysInfo = false},
+ {.name = "parameters", .bytes = 64 + TSDB_OFFSET_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY, .sysInfo = false},
};
static const SSysDbTableSchema offsetSchema[] = {
@@ -381,6 +384,7 @@ static const SSysDbTableSchema querySchema[] = {
{.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP, .sysInfo = false},
{.name = "exec_usec", .bytes = 8, .type = TSDB_DATA_TYPE_BIGINT, .sysInfo = false},
{.name = "stable_query", .bytes = 1, .type = TSDB_DATA_TYPE_BOOL, .sysInfo = false},
+ {.name = "sub_query", .bytes = 1, .type = TSDB_DATA_TYPE_BOOL, .sysInfo = false},
{.name = "sub_num", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = false},
{.name = "sub_status", .bytes = TSDB_SHOW_SUBQUERY_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false},
{.name = "sql", .bytes = TSDB_SHOW_SQL_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false},
diff --git a/source/common/src/tdatablock.c b/source/common/src/tdatablock.c
index d06f9beb7f..79b730721e 100644
--- a/source/common/src/tdatablock.c
+++ b/source/common/src/tdatablock.c
@@ -2482,19 +2482,31 @@ _end:
}
char* buildCtbNameByGroupId(const char* stbFullName, uint64_t groupId) {
- if (stbFullName[0] == 0) {
+ char* pBuf = taosMemoryCalloc(1, TSDB_TABLE_NAME_LEN + 1);
+ if (!pBuf) {
return NULL;
}
+ int32_t code = buildCtbNameByGroupIdImpl(stbFullName, groupId, pBuf);
+ if (code != TSDB_CODE_SUCCESS) {
+ taosMemoryFree(pBuf);
+ return NULL;
+ }
+ return pBuf;
+}
+
+int32_t buildCtbNameByGroupIdImpl(const char* stbFullName, uint64_t groupId, char* cname) {
+ if (stbFullName[0] == 0) {
+ return TSDB_CODE_FAILED;
+ }
SArray* tags = taosArrayInit(0, sizeof(SSmlKv));
if (tags == NULL) {
- return NULL;
+ return TSDB_CODE_FAILED;
}
- void* cname = taosMemoryCalloc(1, TSDB_TABLE_NAME_LEN + 1);
if (cname == NULL) {
taosArrayDestroy(tags);
- return NULL;
+ return TSDB_CODE_FAILED;
}
SSmlKv pTag = {.key = "group_id",
@@ -2516,9 +2528,9 @@ char* buildCtbNameByGroupId(const char* stbFullName, uint64_t groupId) {
taosArrayDestroy(tags);
if ((rname.ctbShortName && rname.ctbShortName[0]) == 0) {
- return NULL;
+ return TSDB_CODE_FAILED;
}
- return rname.ctbShortName;
+ return TSDB_CODE_SUCCESS;
}
int32_t blockEncode(const SSDataBlock* pBlock, char* data, int32_t numOfCols) {
diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c
index dd64538f3d..9a027366ef 100644
--- a/source/common/src/tglobal.c
+++ b/source/common/src/tglobal.c
@@ -493,6 +493,7 @@ static int32_t taosAddServerCfg(SConfig *pCfg) {
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, "skipGrant", tsMndSkipGrant, 0) != 0) return -1;
if (cfgAddBool(pCfg, "monitor", tsEnableMonitor, 0) != 0) return -1;
if (cfgAddInt32(pCfg, "monitorInterval", tsMonitorInterval, 1, 200000, 0) != 0) return -1;
@@ -892,6 +893,7 @@ static int32_t taosSetServerCfg(SConfig *pCfg) {
tsMndSdbWriteDelta = cfgGetItem(pCfg, "mndSdbWriteDelta")->i64;
tsMndLogRetention = cfgGetItem(pCfg, "mndLogRetention")->i64;
+ tsMndSkipGrant = cfgGetItem(pCfg, "skipGrant")->bval;
tsStartUdfd = cfgGetItem(pCfg, "udf")->bval;
tstrncpy(tsUdfdResFuncs, cfgGetItem(pCfg, "udfdResFuncs")->str, sizeof(tsUdfdResFuncs));
diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c
index ac035e0a2b..4cc6b34ca2 100644
--- a/source/common/src/tmsg.c
+++ b/source/common/src/tmsg.c
@@ -224,6 +224,7 @@ static int32_t tSerializeSClientHbReq(SEncoder *pEncoder, const SClientHbReq *pR
if (tEncodeI64(pEncoder, desc->stime) < 0) return -1;
if (tEncodeI64(pEncoder, desc->reqRid) < 0) return -1;
if (tEncodeI8(pEncoder, desc->stableQuery) < 0) return -1;
+ if (tEncodeI8(pEncoder, desc->isSubQuery) < 0) return -1;
if (tEncodeCStr(pEncoder, desc->fqdn) < 0) return -1;
if (tEncodeI32(pEncoder, desc->subPlanNum) < 0) return -1;
@@ -291,6 +292,7 @@ static int32_t tDeserializeSClientHbReq(SDecoder *pDecoder, SClientHbReq *pReq)
if (tDecodeI64(pDecoder, &desc.stime) < 0) return -1;
if (tDecodeI64(pDecoder, &desc.reqRid) < 0) return -1;
if (tDecodeI8(pDecoder, (int8_t *)&desc.stableQuery) < 0) return -1;
+ if (tDecodeI8(pDecoder, (int8_t *)&desc.isSubQuery) < 0) return -1;
if (tDecodeCStrTo(pDecoder, desc.fqdn) < 0) return -1;
if (tDecodeI32(pDecoder, &desc.subPlanNum) < 0) return -1;
@@ -5338,6 +5340,15 @@ int32_t tDeserializeSMqAskEpReq(void *buf, int32_t bufLen, SMqAskEpReq *pReq) {
return 0;
}
+int32_t tDeatroySMqHbReq(SMqHbReq* pReq){
+ for(int i = 0; i < taosArrayGetSize(pReq->topics); i++){
+ TopicOffsetRows* vgs = taosArrayGet(pReq->topics, i);
+ if(vgs) taosArrayDestroy(vgs->offsetRows);
+ }
+ taosArrayDestroy(pReq->topics);
+ return 0;
+}
+
int32_t tSerializeSMqHbReq(void *buf, int32_t bufLen, SMqHbReq *pReq) {
SEncoder encoder = {0};
tEncoderInit(&encoder, buf, bufLen);
@@ -5346,6 +5357,21 @@ int32_t tSerializeSMqHbReq(void *buf, int32_t bufLen, SMqHbReq *pReq) {
if (tEncodeI64(&encoder, pReq->consumerId) < 0) return -1;
if (tEncodeI32(&encoder, pReq->epoch) < 0) return -1;
+ int32_t sz = taosArrayGetSize(pReq->topics);
+ if (tEncodeI32(&encoder, sz) < 0) return -1;
+ for (int32_t i = 0; i < sz; ++i) {
+ TopicOffsetRows* vgs = (TopicOffsetRows*)taosArrayGet(pReq->topics, i);
+ if (tEncodeCStr(&encoder, vgs->topicName) < 0) return -1;
+ int32_t szVgs = taosArrayGetSize(vgs->offsetRows);
+ if (tEncodeI32(&encoder, szVgs) < 0) return -1;
+ for (int32_t j = 0; j < szVgs; ++j) {
+ OffsetRows *offRows = taosArrayGet(vgs->offsetRows, j);
+ if (tEncodeI32(&encoder, offRows->vgId) < 0) return -1;
+ if (tEncodeI64(&encoder, offRows->rows) < 0) return -1;
+ if (tEncodeSTqOffsetVal(&encoder, &offRows->offset) < 0) return -1;
+ }
+ }
+
tEndEncode(&encoder);
int32_t tlen = encoder.pos;
@@ -5362,7 +5388,28 @@ int32_t tDeserializeSMqHbReq(void *buf, int32_t bufLen, SMqHbReq *pReq) {
if (tDecodeI64(&decoder, &pReq->consumerId) < 0) return -1;
if (tDecodeI32(&decoder, &pReq->epoch) < 0) return -1;
-
+ int32_t sz = 0;
+ if (tDecodeI32(&decoder, &sz) < 0) return -1;
+ if(sz > 0){
+ pReq->topics = taosArrayInit(sz, sizeof(TopicOffsetRows));
+ if (NULL == pReq->topics) return -1;
+ for (int32_t i = 0; i < sz; ++i) {
+ TopicOffsetRows* data = taosArrayReserve(pReq->topics, 1);
+ tDecodeCStrTo(&decoder, data->topicName);
+ int32_t szVgs = 0;
+ if (tDecodeI32(&decoder, &szVgs) < 0) return -1;
+ if(szVgs > 0){
+ data->offsetRows = taosArrayInit(szVgs, sizeof(OffsetRows));
+ if (NULL == data->offsetRows) return -1;
+ for (int32_t j= 0; j < szVgs; ++j) {
+ OffsetRows* offRows = taosArrayReserve(data->offsetRows, 1);
+ if (tDecodeI32(&decoder, &offRows->vgId) < 0) return -1;
+ if (tDecodeI64(&decoder, &offRows->rows) < 0) return -1;
+ if (tDecodeSTqOffsetVal(&decoder, &offRows->offset) < 0) return -1;
+ }
+ }
+ }
+ }
tEndDecode(&decoder);
tDecoderClear(&decoder);
@@ -6122,6 +6169,7 @@ int32_t tSerializeSCMCreateStreamReq(void *buf, int32_t bufLen, const SCMCreateS
}
if (tEncodeI64(&encoder, pReq->deleteMark) < 0) return -1;
if (tEncodeI8(&encoder, pReq->igUpdate) < 0) return -1;
+ if (tEncodeI64(&encoder, pReq->lastTs) < 0) return -1;
tEndEncode(&encoder);
@@ -6207,6 +6255,7 @@ int32_t tDeserializeSCMCreateStreamReq(void *buf, int32_t bufLen, SCMCreateStrea
if (tDecodeI64(&decoder, &pReq->deleteMark) < 0) return -1;
if (tDecodeI8(&decoder, &pReq->igUpdate) < 0) return -1;
+ if (tDecodeI64(&decoder, &pReq->lastTs) < 0) return -1;
tEndDecode(&decoder);
@@ -6273,6 +6322,9 @@ int32_t tDeserializeSMRecoverStreamReq(void *buf, int32_t bufLen, SMRecoverStrea
}
void tFreeSCMCreateStreamReq(SCMCreateStreamReq *pReq) {
+ if (NULL == pReq) {
+ return;
+ }
taosArrayDestroy(pReq->pTags);
taosMemoryFreeClear(pReq->sql);
taosMemoryFreeClear(pReq->ast);
@@ -7086,15 +7138,15 @@ int32_t tDecodeSTqOffsetVal(SDecoder *pDecoder, STqOffsetVal *pOffsetVal) {
int32_t tFormatOffset(char *buf, int32_t maxLen, const STqOffsetVal *pVal) {
if (pVal->type == TMQ_OFFSET__RESET_NONE) {
- snprintf(buf, maxLen, "offset(reset to none)");
- } else if (pVal->type == TMQ_OFFSET__RESET_EARLIEAST) {
- snprintf(buf, maxLen, "offset(reset to earlieast)");
+ snprintf(buf, maxLen, "none");
+ } else if (pVal->type == TMQ_OFFSET__RESET_EARLIEST) {
+ snprintf(buf, maxLen, "earliest");
} else if (pVal->type == TMQ_OFFSET__RESET_LATEST) {
- snprintf(buf, maxLen, "offset(reset to latest)");
+ snprintf(buf, maxLen, "latest");
} else if (pVal->type == TMQ_OFFSET__LOG) {
- snprintf(buf, maxLen, "offset(log) ver:%" PRId64, pVal->version);
+ snprintf(buf, maxLen, "log:%" PRId64, pVal->version);
} else if (pVal->type == TMQ_OFFSET__SNAPSHOT_DATA || pVal->type == TMQ_OFFSET__SNAPSHOT_META) {
- snprintf(buf, maxLen, "offset(snapshot) uid:%" PRId64 " ts:%" PRId64, pVal->uid, pVal->ts);
+ snprintf(buf, maxLen, "snapshot:%" PRId64 "|%" PRId64, pVal->uid, pVal->ts);
} else {
return TSDB_CODE_INVALID_PARA;
}
@@ -7112,7 +7164,7 @@ bool tOffsetEqual(const STqOffsetVal *pLeft, const STqOffsetVal *pRight) {
return pLeft->uid == pRight->uid;
} else {
ASSERT(0);
- /*ASSERT(pLeft->type == TMQ_OFFSET__RESET_NONE || pLeft->type == TMQ_OFFSET__RESET_EARLIEAST ||*/
+ /*ASSERT(pLeft->type == TMQ_OFFSET__RESET_NONE || pLeft->type == TMQ_OFFSET__RESET_EARLIEST ||*/
/*pLeft->type == TMQ_OFFSET__RESET_LATEST);*/
/*return true;*/
}
diff --git a/source/common/src/ttypes.c b/source/common/src/ttypes.c
index 33b972594e..39255cff3a 100644
--- a/source/common/src/ttypes.c
+++ b/source/common/src/ttypes.c
@@ -17,7 +17,7 @@
#include "ttypes.h"
#include "tcompression.h"
-const int32_t TYPE_BYTES[17] = {
+const int32_t TYPE_BYTES[21] = {
-1, // TSDB_DATA_TYPE_NULL
CHAR_BYTES, // TSDB_DATA_TYPE_BOOL
CHAR_BYTES, // TSDB_DATA_TYPE_TINYINT
@@ -34,6 +34,10 @@ const int32_t TYPE_BYTES[17] = {
INT_BYTES, // TSDB_DATA_TYPE_UINT
sizeof(uint64_t), // TSDB_DATA_TYPE_UBIGINT
TSDB_MAX_JSON_TAG_LEN, // TSDB_DATA_TYPE_JSON
+ TSDB_MAX_TAGS_LEN, // TSDB_DATA_TYPE_VARBINARY: placeholder, not implemented
+ TSDB_MAX_TAGS_LEN, // TSDB_DATA_TYPE_DECIMAL: placeholder, not implemented
+ TSDB_MAX_TAGS_LEN, // TSDB_DATA_TYPE_BLOB: placeholder, not implemented
+ TSDB_MAX_TAGS_LEN, // TSDB_DATA_TYPE_MEDIUMBLOB: placeholder, not implemented
sizeof(VarDataOffsetT), // TSDB_DATA_TYPE_GEOMETRY
};
@@ -57,6 +61,10 @@ tDataTypeDescriptor tDataTypes[TSDB_DATA_TYPE_MAX] = {
{TSDB_DATA_TYPE_UINT, 12, INT_BYTES, "INT UNSIGNED", 0, UINT32_MAX, tsCompressInt, tsDecompressInt},
{TSDB_DATA_TYPE_UBIGINT, 15, LONG_BYTES, "BIGINT UNSIGNED", 0, UINT64_MAX, tsCompressBigint, tsDecompressBigint},
{TSDB_DATA_TYPE_JSON, 4, TSDB_MAX_JSON_TAG_LEN, "JSON", 0, 0, tsCompressString, tsDecompressString},
+ {TSDB_DATA_TYPE_VARBINARY, 9, 1, "VARBINARY", 0, 0, NULL, NULL}, // placeholder, not implemented
+ {TSDB_DATA_TYPE_DECIMAL, 7, 1, "DECIMAL", 0, 0, NULL, NULL}, // placeholder, not implemented
+ {TSDB_DATA_TYPE_BLOB, 4, 1, "BLOB", 0, 0, NULL, NULL}, // placeholder, not implemented
+ {TSDB_DATA_TYPE_MEDIUMBLOB, 10, 1, "MEDIUMBLOB", 0, 0, NULL, NULL}, // placeholder, not implemented
{TSDB_DATA_TYPE_GEOMETRY, 8, 1, "GEOMETRY", 0, 0, tsCompressString, tsDecompressString},
};
diff --git a/source/dnode/mgmt/mgmt_mnode/src/mmHandle.c b/source/dnode/mgmt/mgmt_mnode/src/mmHandle.c
index 7f8f6a48fa..d975eb1cd1 100644
--- a/source/dnode/mgmt/mgmt_mnode/src/mmHandle.c
+++ b/source/dnode/mgmt/mgmt_mnode/src/mmHandle.c
@@ -163,7 +163,7 @@ SArray *mmGetMsgHandles() {
if (dmSetMgmtHandle(pArray, TDMT_MND_TMQ_DROP_TOPIC, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_MND_TMQ_SUBSCRIBE, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_MND_TMQ_ASK_EP, mmPutMsgToReadQueue, 0) == NULL) goto _OVER;
- if (dmSetMgmtHandle(pArray, TDMT_MND_TMQ_HB, mmPutMsgToReadQueue, 0) == NULL) goto _OVER;
+ if (dmSetMgmtHandle(pArray, TDMT_MND_TMQ_HB, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_MND_TMQ_DROP_CGROUP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_MND_TMQ_DROP_CGROUP_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_MND_KILL_TRANS, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c b/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c
index 0c5c14b65c..513cadc814 100644
--- a/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c
+++ b/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c
@@ -265,6 +265,7 @@ int32_t vmProcessCreateVnodeReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) {
snprintf(path, TSDB_FILENAME_LEN, "vnode%svnode%d", TD_DIRSEP, vnodeCfg.vgId);
+#if 0
if (pMgmt->pTfs) {
if (tfsDirExistAt(pMgmt->pTfs, path, (SDiskID){0})) {
terrno = TSDB_CODE_VND_DIR_ALREADY_EXIST;
@@ -278,8 +279,9 @@ int32_t vmProcessCreateVnodeReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) {
return -1;
}
}
+#endif
-if (vnodeCreate(path, &vnodeCfg, pMgmt->pTfs) < 0) {
+ if (vnodeCreate(path, &vnodeCfg, pMgmt->pTfs) < 0) {
tFreeSCreateVnodeReq(&req);
dError("vgId:%d, failed to create vnode since %s", req.vgId, terrstr());
code = terrno;
diff --git a/source/dnode/mnode/impl/inc/mndDef.h b/source/dnode/mnode/impl/inc/mndDef.h
index 82b714e6eb..44bd8f74c8 100644
--- a/source/dnode/mnode/impl/inc/mndDef.h
+++ b/source/dnode/mnode/impl/inc/mndDef.h
@@ -108,7 +108,7 @@ typedef enum {
TRN_STAGE_UNDO_ACTION = 3,
TRN_STAGE_COMMIT = 4,
TRN_STAGE_COMMIT_ACTION = 5,
- TRN_STAGE_FINISHED = 6,
+ TRN_STAGE_FINISH = 6,
TRN_STAGE_PRE_FINISH = 7
} ETrnStage;
@@ -157,6 +157,7 @@ typedef struct {
void* rpcRsp;
int32_t rpcRspLen;
int32_t redoActionPos;
+ SArray* prepareActions;
SArray* redoActions;
SArray* undoActions;
SArray* commitActions;
@@ -550,33 +551,39 @@ typedef struct {
int64_t upTime;
int64_t subscribeTime;
int64_t rebalanceTime;
+
+ int8_t withTbName;
+ int8_t autoCommit;
+ int32_t autoCommitInterval;
+ int32_t resetOffsetCfg;
} SMqConsumerObj;
SMqConsumerObj* tNewSMqConsumerObj(int64_t consumerId, char cgroup[TSDB_CGROUP_LEN]);
void tDeleteSMqConsumerObj(SMqConsumerObj* pConsumer);
int32_t tEncodeSMqConsumerObj(void** buf, const SMqConsumerObj* pConsumer);
-void* tDecodeSMqConsumerObj(const void* buf, SMqConsumerObj* pConsumer);
+void* tDecodeSMqConsumerObj(const void* buf, SMqConsumerObj* pConsumer, int8_t sver);
typedef struct {
int32_t vgId;
- char* qmsg; // SubPlanToString
+// char* qmsg; // SubPlanToString
SEpSet epSet;
} SMqVgEp;
SMqVgEp* tCloneSMqVgEp(const SMqVgEp* pVgEp);
void tDeleteSMqVgEp(SMqVgEp* pVgEp);
int32_t tEncodeSMqVgEp(void** buf, const SMqVgEp* pVgEp);
-void* tDecodeSMqVgEp(const void* buf, SMqVgEp* pVgEp);
+void* tDecodeSMqVgEp(const void* buf, SMqVgEp* pVgEp, int8_t sver);
typedef struct {
int64_t consumerId; // -1 for unassigned
SArray* vgs; // SArray
+ SArray* offsetRows; // SArray
} SMqConsumerEp;
-SMqConsumerEp* tCloneSMqConsumerEp(const SMqConsumerEp* pEp);
-void tDeleteSMqConsumerEp(void* pEp);
+//SMqConsumerEp* tCloneSMqConsumerEp(const SMqConsumerEp* pEp);
+//void tDeleteSMqConsumerEp(void* pEp);
int32_t tEncodeSMqConsumerEp(void** buf, const SMqConsumerEp* pEp);
-void* tDecodeSMqConsumerEp(const void* buf, SMqConsumerEp* pEp);
+void* tDecodeSMqConsumerEp(const void* buf, SMqConsumerEp* pEp, int8_t sver);
typedef struct {
char key[TSDB_SUBSCRIBE_KEY_LEN];
@@ -588,14 +595,16 @@ typedef struct {
int64_t stbUid;
SHashObj* consumerHash; // consumerId -> SMqConsumerEp
SArray* unassignedVgs; // SArray
+ SArray* offsetRows;
char dbName[TSDB_DB_FNAME_LEN];
+ char* qmsg; // SubPlanToString
} SMqSubscribeObj;
SMqSubscribeObj* tNewSubscribeObj(const char key[TSDB_SUBSCRIBE_KEY_LEN]);
SMqSubscribeObj* tCloneSubscribeObj(const SMqSubscribeObj* pSub);
void tDeleteSubscribeObj(SMqSubscribeObj* pSub);
int32_t tEncodeSubscribeObj(void** buf, const SMqSubscribeObj* pSub);
-void* tDecodeSubscribeObj(const void* buf, SMqSubscribeObj* pSub);
+void* tDecodeSubscribeObj(const void* buf, SMqSubscribeObj* pSub, int8_t sver);
typedef struct {
int32_t epoch;
@@ -687,12 +696,12 @@ int32_t tEncodeSStreamObj(SEncoder* pEncoder, const SStreamObj* pObj);
int32_t tDecodeSStreamObj(SDecoder* pDecoder, SStreamObj* pObj, int32_t sver);
void tFreeStreamObj(SStreamObj* pObj);
-typedef struct {
- char streamName[TSDB_STREAM_FNAME_LEN];
- int64_t uid;
- int64_t streamUid;
- SArray* childInfo; // SArray
-} SStreamCheckpointObj;
+//typedef struct {
+// char streamName[TSDB_STREAM_FNAME_LEN];
+// int64_t uid;
+// int64_t streamUid;
+// SArray* childInfo; // SArray
+//} SStreamCheckpointObj;
#ifdef __cplusplus
}
diff --git a/source/dnode/mnode/impl/inc/mndTrans.h b/source/dnode/mnode/impl/inc/mndTrans.h
index 03434573c4..625546aa55 100644
--- a/source/dnode/mnode/impl/inc/mndTrans.h
+++ b/source/dnode/mnode/impl/inc/mndTrans.h
@@ -70,6 +70,7 @@ int32_t mndTransAppendRedolog(STrans *pTrans, SSdbRaw *pRaw);
int32_t mndTransAppendUndolog(STrans *pTrans, SSdbRaw *pRaw);
int32_t mndTransAppendCommitlog(STrans *pTrans, SSdbRaw *pRaw);
int32_t mndTransAppendNullLog(STrans *pTrans);
+int32_t mndTransAppendPrepareAction(STrans *pTrans, STransAction *pAction);
int32_t mndTransAppendRedoAction(STrans *pTrans, STransAction *pAction);
int32_t mndTransAppendUndoAction(STrans *pTrans, STransAction *pAction);
void mndTransSetRpcRsp(STrans *pTrans, void *pCont, int32_t contLen);
@@ -78,15 +79,23 @@ void mndTransSetDbName(STrans *pTrans, const char *dbname, const char *stbnam
void mndTransSetSerial(STrans *pTrans);
void mndTransSetParallel(STrans *pTrans);
void mndTransSetOper(STrans *pTrans, EOperType oper);
-int32_t mndTrancCheckConflict(SMnode *pMnode, STrans *pTrans);
-
+int32_t mndTransCheckConflict(SMnode *pMnode, STrans *pTrans);
+static int32_t mndTrancCheckConflict(SMnode *pMnode, STrans *pTrans) {
+ return mndTransCheckConflict(pMnode, pTrans);
+}
int32_t mndTransPrepare(SMnode *pMnode, STrans *pTrans);
int32_t mndTransProcessRsp(SRpcMsg *pRsp);
void mndTransPullup(SMnode *pMnode);
int32_t mndKillTrans(SMnode *pMnode, STrans *pTrans);
-void mndTransExecute(SMnode *pMnode, STrans *pTrans, bool isLeader);
+void mndTransExecute(SMnode *pMnode, STrans *pTrans);
+void mndTransRefresh(SMnode *pMnode, STrans *pTrans);
int32_t mndSetRpcInfoForDbTrans(SMnode *pMnode, SRpcMsg *pMsg, EOperType oper, const char *dbname);
+SSdbRaw *mndTransEncode(STrans *pTrans);
+SSdbRow *mndTransDecode(SSdbRaw *pRaw);
+void mndTransDropData(STrans *pTrans);
+
+bool mndTransPerformPrepareStage(SMnode *pMnode, STrans *pTrans);
#ifdef __cplusplus
}
#endif
diff --git a/source/dnode/mnode/impl/inc/mndUser.h b/source/dnode/mnode/impl/inc/mndUser.h
index aa7f97f087..93ae38e554 100644
--- a/source/dnode/mnode/impl/inc/mndUser.h
+++ b/source/dnode/mnode/impl/inc/mndUser.h
@@ -40,6 +40,8 @@ int32_t mndValidateUserPassInfo(SMnode *pMnode, SUserPassVersion *pUsers, int3
int32_t mndUserRemoveDb(SMnode *pMnode, STrans *pTrans, char *db);
int32_t mndUserRemoveTopic(SMnode *pMnode, STrans *pTrans, char *topic);
+int32_t mndUserDupObj(SUserObj *pUser, SUserObj *pNew);
+void mndUserFreeObj(SUserObj *pUser);
#ifdef __cplusplus
}
#endif
diff --git a/source/dnode/mnode/impl/inc/mndVgroup.h b/source/dnode/mnode/impl/inc/mndVgroup.h
index 0cd1228f25..7c2f8b5b65 100644
--- a/source/dnode/mnode/impl/inc/mndVgroup.h
+++ b/source/dnode/mnode/impl/inc/mndVgroup.h
@@ -27,6 +27,7 @@ void mndCleanupVgroup(SMnode *pMnode);
SVgObj *mndAcquireVgroup(SMnode *pMnode, int32_t vgId);
void mndReleaseVgroup(SMnode *pMnode, SVgObj *pVgroup);
SSdbRaw *mndVgroupActionEncode(SVgObj *pVgroup);
+SSdbRow *mndVgroupActionDecode(SSdbRaw *pRaw);
SEpSet mndGetVgroupEpset(SMnode *pMnode, const SVgObj *pVgroup);
int32_t mndGetVnodesNum(SMnode *pMnode, int32_t dnodeId);
void mndSortVnodeGid(SVgObj *pVgroup);
@@ -36,6 +37,7 @@ int64_t mndGetVgroupMemory(SMnode *pMnode, SDbObj *pDb, SVgObj *pVgroup);
SArray *mndBuildDnodesArray(SMnode *, int32_t exceptDnodeId);
int32_t mndAllocSmaVgroup(SMnode *, SDbObj *pDb, SVgObj *pVgroup);
int32_t mndAllocVgroup(SMnode *, SDbObj *pDb, SVgObj **ppVgroups);
+int32_t mndAddPrepareNewVgAction(SMnode *, STrans *pTrans, SVgObj *pVg);
int32_t mndAddCreateVnodeAction(SMnode *, STrans *pTrans, SDbObj *pDb, SVgObj *pVgroup, SVnodeGid *pVgid);
int32_t mndAddAlterVnodeConfirmAction(SMnode *, STrans *pTrans, SDbObj *pDb, SVgObj *pVgroup);
int32_t mndAddAlterVnodeAction(SMnode *, STrans *pTrans, SDbObj *pDb, SVgObj *pVgroup, tmsg_t msgType);
diff --git a/source/dnode/mnode/impl/src/mndConsumer.c b/source/dnode/mnode/impl/src/mndConsumer.c
index 117c1082a5..4dded61ce3 100644
--- a/source/dnode/mnode/impl/src/mndConsumer.c
+++ b/source/dnode/mnode/impl/src/mndConsumer.c
@@ -23,7 +23,7 @@
#include "tcompare.h"
#include "tname.h"
-#define MND_CONSUMER_VER_NUMBER 1
+#define MND_CONSUMER_VER_NUMBER 2
#define MND_CONSUMER_RESERVE_SIZE 64
#define MND_CONSUMER_LOST_HB_CNT 6
@@ -391,12 +391,13 @@ static int32_t mndProcessMqTimerMsg(SRpcMsg *pMsg) {
}
static int32_t mndProcessMqHbReq(SRpcMsg *pMsg) {
+ int32_t code = 0;
SMnode *pMnode = pMsg->info.node;
SMqHbReq req = {0};
- if (tDeserializeSMqHbReq(pMsg->pCont, pMsg->contLen, &req) < 0) {
+ if ((code = tDeserializeSMqHbReq(pMsg->pCont, pMsg->contLen, &req)) < 0) {
terrno = TSDB_CODE_OUT_OF_MEMORY;
- return -1;
+ goto end;
}
int64_t consumerId = req.consumerId;
@@ -404,7 +405,8 @@ static int32_t mndProcessMqHbReq(SRpcMsg *pMsg) {
if (pConsumer == NULL) {
mError("consumer:0x%" PRIx64 " not exist", consumerId);
terrno = TSDB_CODE_MND_CONSUMER_NOT_EXIST;
- return -1;
+ code = -1;
+ goto end;
}
atomic_store_32(&pConsumer->hbStatus, 0);
@@ -424,9 +426,28 @@ static int32_t mndProcessMqHbReq(SRpcMsg *pMsg) {
tmsgPutToQueue(&pMnode->msgCb, WRITE_QUEUE, &pRpcMsg);
}
+ for(int i = 0; i < taosArrayGetSize(req.topics); i++){
+ TopicOffsetRows* data = taosArrayGet(req.topics, i);
+ mDebug("heartbeat report offset rows.%s:%s", pConsumer->cgroup, data->topicName);
+
+ SMqSubscribeObj *pSub = mndAcquireSubscribe(pMnode, pConsumer->cgroup, data->topicName);
+ taosWLockLatch(&pSub->lock);
+ SMqConsumerEp *pConsumerEp = taosHashGet(pSub->consumerHash, &consumerId, sizeof(int64_t));
+ if(pConsumerEp){
+ taosArrayDestroy(pConsumerEp->offsetRows);
+ pConsumerEp->offsetRows = data->offsetRows;
+ data->offsetRows = NULL;
+ }
+ taosWUnLockLatch(&pSub->lock);
+
+ mndReleaseSubscribe(pMnode, pSub);
+ }
+
mndReleaseConsumer(pMnode, pConsumer);
- return 0;
+end:
+ tDeatroySMqHbReq(&req);
+ return code;
}
static int32_t mndProcessAskEpReq(SRpcMsg *pMsg) {
@@ -644,7 +665,7 @@ int32_t mndProcessSubscribeReq(SRpcMsg *pMsg) {
SCMSubscribeReq subscribe = {0};
tDeserializeSCMSubscribeReq(msgStr, &subscribe);
- uint64_t consumerId = subscribe.consumerId;
+ int64_t consumerId = subscribe.consumerId;
char *cgroup = subscribe.cgroup;
SMqConsumerObj *pExistedConsumer = NULL;
SMqConsumerObj *pConsumerNew = NULL;
@@ -675,6 +696,11 @@ int32_t mndProcessSubscribeReq(SRpcMsg *pMsg) {
pConsumerNew = tNewSMqConsumerObj(consumerId, cgroup);
tstrncpy(pConsumerNew->clientId, subscribe.clientId, tListLen(pConsumerNew->clientId));
+ pConsumerNew->withTbName = subscribe.withTbName;
+ pConsumerNew->autoCommit = subscribe.autoCommit;
+ pConsumerNew->autoCommitInterval = subscribe.autoCommitInterval;
+ pConsumerNew->resetOffsetCfg = subscribe.resetOffsetCfg;
+
// set the update type
pConsumerNew->updateType = CONSUMER_UPDATE__REBALANCE;
taosArrayDestroy(pConsumerNew->assignedTopics);
@@ -822,7 +848,7 @@ SSdbRow *mndConsumerActionDecode(SSdbRaw *pRaw) {
goto CM_DECODE_OVER;
}
- if (sver != MND_CONSUMER_VER_NUMBER) {
+ if (sver < 1 || sver > MND_CONSUMER_VER_NUMBER) {
terrno = TSDB_CODE_SDB_INVALID_DATA_VER;
goto CM_DECODE_OVER;
}
@@ -849,7 +875,7 @@ SSdbRow *mndConsumerActionDecode(SSdbRaw *pRaw) {
SDB_GET_BINARY(pRaw, dataPos, buf, len, CM_DECODE_OVER);
SDB_GET_RESERVE(pRaw, dataPos, MND_CONSUMER_RESERVE_SIZE, CM_DECODE_OVER);
- if (tDecodeSMqConsumerObj(buf, pConsumer) == NULL) {
+ if (tDecodeSMqConsumerObj(buf, pConsumer, sver) == NULL) {
terrno = TSDB_CODE_OUT_OF_MEMORY; // TODO set correct error code
goto CM_DECODE_OVER;
}
@@ -1159,6 +1185,17 @@ static int32_t mndRetrieveConsumer(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
colDataSetVal(pColInfo, numOfRows, (const char *)&pConsumer->rebalanceTime, pConsumer->rebalanceTime == 0);
+ char buf[TSDB_OFFSET_LEN] = {0};
+ STqOffsetVal pVal = {.type = pConsumer->resetOffsetCfg};
+ tFormatOffset(buf, TSDB_OFFSET_LEN, &pVal);
+
+ char parasStr[64 + TSDB_OFFSET_LEN + VARSTR_HEADER_SIZE] = {0};
+ sprintf(varDataVal(parasStr), "tbname:%d,commit:%d,interval:%d,reset:%s", pConsumer->withTbName, pConsumer->autoCommit, pConsumer->autoCommitInterval, buf);
+ varDataSetLen(parasStr, strlen(varDataVal(parasStr)));
+
+ pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
+ colDataSetVal(pColInfo, numOfRows, (const char *)parasStr, false);
+
numOfRows++;
}
diff --git a/source/dnode/mnode/impl/src/mndDb.c b/source/dnode/mnode/impl/src/mndDb.c
index c6586e0396..47619f89ce 100644
--- a/source/dnode/mnode/impl/src/mndDb.c
+++ b/source/dnode/mnode/impl/src/mndDb.c
@@ -414,6 +414,13 @@ static void mndSetDefaultDbCfg(SDbCfg *pCfg) {
if (pCfg->tsdbPageSize <= 0) pCfg->tsdbPageSize = TSDB_DEFAULT_TSDB_PAGESIZE;
}
+static int32_t mndSetPrepareNewVgActions(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SVgObj *pVgroups) {
+ for (int32_t v = 0; v < pDb->cfg.numOfVgroups; ++v) {
+ if (mndAddPrepareNewVgAction(pMnode, pTrans, (pVgroups + v)) != 0) return -1;
+ }
+ return 0;
+}
+
static int32_t mndSetCreateDbRedoLogs(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SVgObj *pVgroups) {
SSdbRaw *pDbRaw = mndDbActionEncode(pDb);
if (pDbRaw == NULL) return -1;
@@ -424,7 +431,7 @@ static int32_t mndSetCreateDbRedoLogs(SMnode *pMnode, STrans *pTrans, SDbObj *pD
SSdbRaw *pVgRaw = mndVgroupActionEncode(pVgroups + v);
if (pVgRaw == NULL) return -1;
if (mndTransAppendRedolog(pTrans, pVgRaw) != 0) return -1;
- if (sdbSetRawStatus(pVgRaw, SDB_STATUS_CREATING) != 0) return -1;
+ if (sdbSetRawStatus(pVgRaw, SDB_STATUS_UPDATE) != 0) return -1;
}
return 0;
@@ -446,7 +453,8 @@ static int32_t mndSetCreateDbUndoLogs(SMnode *pMnode, STrans *pTrans, SDbObj *pD
return 0;
}
-static int32_t mndSetCreateDbCommitLogs(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SVgObj *pVgroups) {
+static int32_t mndSetCreateDbCommitLogs(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SVgObj *pVgroups,
+ SUserObj *pUserDuped) {
SSdbRaw *pDbRaw = mndDbActionEncode(pDb);
if (pDbRaw == NULL) return -1;
if (mndTransAppendCommitlog(pTrans, pDbRaw) != 0) return -1;
@@ -459,6 +467,13 @@ static int32_t mndSetCreateDbCommitLogs(SMnode *pMnode, STrans *pTrans, SDbObj *
if (sdbSetRawStatus(pVgRaw, SDB_STATUS_READY) != 0) return -1;
}
+ if (pUserDuped) {
+ SSdbRaw *pUserRaw = mndUserActionEncode(pUserDuped);
+ if (pUserRaw == NULL) return -1;
+ if (mndTransAppendCommitlog(pTrans, pUserRaw) != 0) return -1;
+ if (sdbSetRawStatus(pUserRaw, SDB_STATUS_READY) != 0) return -1;
+ }
+
return 0;
}
@@ -565,6 +580,15 @@ static int32_t mndCreateDb(SMnode *pMnode, SRpcMsg *pReq, SCreateDbReq *pCreate,
return -1;
}
+ // add database privileges for user
+ SUserObj newUserObj = {0}, *pNewUserDuped = NULL;
+ if (!pUser->superUser) {
+ if (mndUserDupObj(pUser, &newUserObj) != 0) goto _OVER;
+ taosHashPut(newUserObj.readDbs, dbObj.name, strlen(dbObj.name) + 1, dbObj.name, TSDB_FILENAME_LEN);
+ taosHashPut(newUserObj.writeDbs, dbObj.name, strlen(dbObj.name) + 1, dbObj.name, TSDB_FILENAME_LEN);
+ pNewUserDuped = &newUserObj;
+ }
+
int32_t code = -1;
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_DB, pReq, "create-db");
if (pTrans == NULL) goto _OVER;
@@ -572,12 +596,13 @@ static int32_t mndCreateDb(SMnode *pMnode, SRpcMsg *pReq, SCreateDbReq *pCreate,
mInfo("trans:%d, used to create db:%s", pTrans->id, pCreate->db);
mndTransSetDbName(pTrans, dbObj.name, NULL);
- if (mndTrancCheckConflict(pMnode, pTrans) != 0) goto _OVER;
+ if (mndTransCheckConflict(pMnode, pTrans) != 0) goto _OVER;
mndTransSetOper(pTrans, MND_OPER_CREATE_DB);
+ if (mndSetPrepareNewVgActions(pMnode, pTrans, &dbObj, pVgroups) != 0) goto _OVER;
if (mndSetCreateDbRedoLogs(pMnode, pTrans, &dbObj, pVgroups) != 0) goto _OVER;
if (mndSetCreateDbUndoLogs(pMnode, pTrans, &dbObj, pVgroups) != 0) goto _OVER;
- if (mndSetCreateDbCommitLogs(pMnode, pTrans, &dbObj, pVgroups) != 0) goto _OVER;
+ if (mndSetCreateDbCommitLogs(pMnode, pTrans, &dbObj, pVgroups, pNewUserDuped) != 0) goto _OVER;
if (mndSetCreateDbRedoActions(pMnode, pTrans, &dbObj, pVgroups) != 0) goto _OVER;
if (mndSetCreateDbUndoActions(pMnode, pTrans, &dbObj, pVgroups) != 0) goto _OVER;
if (mndTransPrepare(pMnode, pTrans) != 0) goto _OVER;
@@ -586,6 +611,7 @@ static int32_t mndCreateDb(SMnode *pMnode, SRpcMsg *pReq, SCreateDbReq *pCreate,
_OVER:
taosMemoryFree(pVgroups);
+ mndUserFreeObj(&newUserObj);
mndTransDrop(pTrans);
return code;
}
@@ -814,7 +840,7 @@ static int32_t mndAlterDb(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pOld, SDbObj *p
int32_t code = -1;
mndTransSetDbName(pTrans, pOld->name, NULL);
- if (mndTrancCheckConflict(pMnode, pTrans) != 0) goto _OVER;
+ if (mndTransCheckConflict(pMnode, pTrans) != 0) goto _OVER;
if (mndSetAlterDbRedoLogs(pMnode, pTrans, pOld, pNew) != 0) goto _OVER;
if (mndSetAlterDbCommitLogs(pMnode, pTrans, pOld, pNew) != 0) goto _OVER;
@@ -1111,7 +1137,7 @@ static int32_t mndDropDb(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb) {
mInfo("trans:%d start to drop db:%s", pTrans->id, pDb->name);
mndTransSetDbName(pTrans, pDb->name, NULL);
- if (mndTrancCheckConflict(pMnode, pTrans) != 0) {
+ if (mndTransCheckConflict(pMnode, pTrans) != 0) {
goto _OVER;
}
diff --git a/source/dnode/mnode/impl/src/mndDef.c b/source/dnode/mnode/impl/src/mndDef.c
index 6dab018236..09c4053f93 100644
--- a/source/dnode/mnode/impl/src/mndDef.c
+++ b/source/dnode/mnode/impl/src/mndDef.c
@@ -187,14 +187,14 @@ SMqVgEp *tCloneSMqVgEp(const SMqVgEp *pVgEp) {
SMqVgEp *pVgEpNew = taosMemoryMalloc(sizeof(SMqVgEp));
if (pVgEpNew == NULL) return NULL;
pVgEpNew->vgId = pVgEp->vgId;
- pVgEpNew->qmsg = taosStrdup(pVgEp->qmsg);
+// pVgEpNew->qmsg = taosStrdup(pVgEp->qmsg);
pVgEpNew->epSet = pVgEp->epSet;
return pVgEpNew;
}
void tDeleteSMqVgEp(SMqVgEp *pVgEp) {
if (pVgEp) {
- taosMemoryFreeClear(pVgEp->qmsg);
+// taosMemoryFreeClear(pVgEp->qmsg);
taosMemoryFree(pVgEp);
}
}
@@ -202,14 +202,18 @@ void tDeleteSMqVgEp(SMqVgEp *pVgEp) {
int32_t tEncodeSMqVgEp(void **buf, const SMqVgEp *pVgEp) {
int32_t tlen = 0;
tlen += taosEncodeFixedI32(buf, pVgEp->vgId);
- tlen += taosEncodeString(buf, pVgEp->qmsg);
+// tlen += taosEncodeString(buf, pVgEp->qmsg);
tlen += taosEncodeSEpSet(buf, &pVgEp->epSet);
return tlen;
}
-void *tDecodeSMqVgEp(const void *buf, SMqVgEp *pVgEp) {
+void *tDecodeSMqVgEp(const void *buf, SMqVgEp *pVgEp, int8_t sver) {
buf = taosDecodeFixedI32(buf, &pVgEp->vgId);
- buf = taosDecodeString(buf, &pVgEp->qmsg);
+ if(sver == 1){
+ uint64_t size = 0;
+ buf = taosDecodeVariantU64(buf, &size);
+ buf = POINTER_SHIFT(buf, size);
+ }
buf = taosDecodeSEpSet(buf, &pVgEp->epSet);
return (void *)buf;
}
@@ -321,10 +325,14 @@ int32_t tEncodeSMqConsumerObj(void **buf, const SMqConsumerObj *pConsumer) {
tlen += taosEncodeFixedI32(buf, 0);
}
+ tlen += taosEncodeFixedI8(buf, pConsumer->withTbName);
+ tlen += taosEncodeFixedI8(buf, pConsumer->autoCommit);
+ tlen += taosEncodeFixedI32(buf, pConsumer->autoCommitInterval);
+ tlen += taosEncodeFixedI32(buf, pConsumer->resetOffsetCfg);
return tlen;
}
-void *tDecodeSMqConsumerObj(const void *buf, SMqConsumerObj *pConsumer) {
+void *tDecodeSMqConsumerObj(const void *buf, SMqConsumerObj *pConsumer, int8_t sver) {
int32_t sz;
buf = taosDecodeFixedI64(buf, &pConsumer->consumerId);
buf = taosDecodeStringTo(buf, pConsumer->clientId);
@@ -375,50 +383,94 @@ void *tDecodeSMqConsumerObj(const void *buf, SMqConsumerObj *pConsumer) {
taosArrayPush(pConsumer->assignedTopics, &topic);
}
+ if(sver > 1){
+ buf = taosDecodeFixedI8(buf, &pConsumer->withTbName);
+ buf = taosDecodeFixedI8(buf, &pConsumer->autoCommit);
+ buf = taosDecodeFixedI32(buf, &pConsumer->autoCommitInterval);
+ buf = taosDecodeFixedI32(buf, &pConsumer->resetOffsetCfg);
+ }
return (void *)buf;
}
-SMqConsumerEp *tCloneSMqConsumerEp(const SMqConsumerEp *pConsumerEpOld) {
- SMqConsumerEp *pConsumerEpNew = taosMemoryMalloc(sizeof(SMqConsumerEp));
- if (pConsumerEpNew == NULL) return NULL;
- pConsumerEpNew->consumerId = pConsumerEpOld->consumerId;
- pConsumerEpNew->vgs = taosArrayDup(pConsumerEpOld->vgs, (__array_item_dup_fn_t)tCloneSMqVgEp);
- return pConsumerEpNew;
-}
-
-void tDeleteSMqConsumerEp(void *data) {
- SMqConsumerEp *pConsumerEp = (SMqConsumerEp *)data;
- taosArrayDestroyP(pConsumerEp->vgs, (FDelete)tDeleteSMqVgEp);
-}
+//SMqConsumerEp *tCloneSMqConsumerEp(const SMqConsumerEp *pConsumerEpOld) {
+// SMqConsumerEp *pConsumerEpNew = taosMemoryMalloc(sizeof(SMqConsumerEp));
+// if (pConsumerEpNew == NULL) return NULL;
+// pConsumerEpNew->consumerId = pConsumerEpOld->consumerId;
+// pConsumerEpNew->vgs = taosArrayDup(pConsumerEpOld->vgs, NULL);
+// return pConsumerEpNew;
+//}
+//
+//void tDeleteSMqConsumerEp(void *data) {
+// SMqConsumerEp *pConsumerEp = (SMqConsumerEp *)data;
+// taosArrayDestroy(pConsumerEp->vgs);
+//}
int32_t tEncodeSMqConsumerEp(void **buf, const SMqConsumerEp *pConsumerEp) {
int32_t tlen = 0;
tlen += taosEncodeFixedI64(buf, pConsumerEp->consumerId);
tlen += taosEncodeArray(buf, pConsumerEp->vgs, (FEncode)tEncodeSMqVgEp);
-#if 0
- int32_t sz = taosArrayGetSize(pConsumerEp->vgs);
- tlen += taosEncodeFixedI32(buf, sz);
- for (int32_t i = 0; i < sz; i++) {
- SMqVgEp *pVgEp = taosArrayGetP(pConsumerEp->vgs, i);
- tlen += tEncodeSMqVgEp(buf, pVgEp);
+ int32_t szVgs = taosArrayGetSize(pConsumerEp->offsetRows);
+ tlen += taosEncodeFixedI32(buf, szVgs);
+ for (int32_t j= 0; j < szVgs; ++j) {
+ OffsetRows *offRows = taosArrayGet(pConsumerEp->offsetRows, j);
+ tlen += taosEncodeFixedI32(buf, offRows->vgId);
+ tlen += taosEncodeFixedI64(buf, offRows->rows);
+ tlen += taosEncodeFixedI8(buf, offRows->offset.type);
+ if (offRows->offset.type == TMQ_OFFSET__SNAPSHOT_DATA || offRows->offset.type == TMQ_OFFSET__SNAPSHOT_META) {
+ tlen += taosEncodeFixedI64(buf, offRows->offset.uid);
+ tlen += taosEncodeFixedI64(buf, offRows->offset.ts);
+ } else if (offRows->offset.type == TMQ_OFFSET__LOG) {
+ tlen += taosEncodeFixedI64(buf, offRows->offset.version);
+ } else {
+ // do nothing
+ }
}
-#endif
+//#if 0
+// int32_t sz = taosArrayGetSize(pConsumerEp->vgs);
+// tlen += taosEncodeFixedI32(buf, sz);
+// for (int32_t i = 0; i < sz; i++) {
+// SMqVgEp *pVgEp = taosArrayGetP(pConsumerEp->vgs, i);
+// tlen += tEncodeSMqVgEp(buf, pVgEp);
+// }
+//#endif
return tlen;
}
-void *tDecodeSMqConsumerEp(const void *buf, SMqConsumerEp *pConsumerEp) {
+void *tDecodeSMqConsumerEp(const void *buf, SMqConsumerEp *pConsumerEp, int8_t sver) {
buf = taosDecodeFixedI64(buf, &pConsumerEp->consumerId);
- buf = taosDecodeArray(buf, &pConsumerEp->vgs, (FDecode)tDecodeSMqVgEp, sizeof(SMqVgEp));
-#if 0
- int32_t sz;
- buf = taosDecodeFixedI32(buf, &sz);
- pConsumerEp->vgs = taosArrayInit(sz, sizeof(void *));
- for (int32_t i = 0; i < sz; i++) {
- SMqVgEp *pVgEp = taosMemoryMalloc(sizeof(SMqVgEp));
- buf = tDecodeSMqVgEp(buf, pVgEp);
- taosArrayPush(pConsumerEp->vgs, &pVgEp);
+ buf = taosDecodeArray(buf, &pConsumerEp->vgs, (FDecode)tDecodeSMqVgEp, sizeof(SMqVgEp), sver);
+ if (sver > 1){
+ int32_t szVgs = 0;
+ buf = taosDecodeFixedI32(buf, &szVgs);
+ if(szVgs > 0){
+ pConsumerEp->offsetRows = taosArrayInit(szVgs, sizeof(OffsetRows));
+ if (NULL == pConsumerEp->offsetRows) return NULL;
+ for (int32_t j= 0; j < szVgs; ++j) {
+ OffsetRows* offRows = taosArrayReserve(pConsumerEp->offsetRows, 1);
+ buf = taosDecodeFixedI32(buf, &offRows->vgId);
+ buf = taosDecodeFixedI64(buf, &offRows->rows);
+ buf = taosDecodeFixedI8(buf, &offRows->offset.type);
+ if (offRows->offset.type == TMQ_OFFSET__SNAPSHOT_DATA || offRows->offset.type == TMQ_OFFSET__SNAPSHOT_META) {
+ buf = taosDecodeFixedI64(buf, &offRows->offset.uid);
+ buf = taosDecodeFixedI64(buf, &offRows->offset.ts);
+ } else if (offRows->offset.type == TMQ_OFFSET__LOG) {
+ buf = taosDecodeFixedI64(buf, &offRows->offset.version);
+ } else {
+ // do nothing
+ }
+ }
+ }
}
-#endif
+//#if 0
+// int32_t sz;
+// buf = taosDecodeFixedI32(buf, &sz);
+// pConsumerEp->vgs = taosArrayInit(sz, sizeof(void *));
+// for (int32_t i = 0; i < sz; i++) {
+// SMqVgEp *pVgEp = taosMemoryMalloc(sizeof(SMqVgEp));
+// buf = tDecodeSMqVgEp(buf, pVgEp);
+// taosArrayPush(pConsumerEp->vgs, &pVgEp);
+// }
+//#endif
return (void *)buf;
}
@@ -468,7 +520,9 @@ SMqSubscribeObj *tCloneSubscribeObj(const SMqSubscribeObj *pSub) {
taosHashPut(pSubNew->consumerHash, &newEp.consumerId, sizeof(int64_t), &newEp, sizeof(SMqConsumerEp));
}
pSubNew->unassignedVgs = taosArrayDup(pSub->unassignedVgs, (__array_item_dup_fn_t)tCloneSMqVgEp);
+ pSubNew->offsetRows = taosArrayDup(pSub->offsetRows, NULL);
memcpy(pSubNew->dbName, pSub->dbName, TSDB_DB_FNAME_LEN);
+ pSubNew->qmsg = taosStrdup(pSub->qmsg);
return pSubNew;
}
@@ -479,9 +533,12 @@ void tDeleteSubscribeObj(SMqSubscribeObj *pSub) {
if (pIter == NULL) break;
SMqConsumerEp *pConsumerEp = (SMqConsumerEp *)pIter;
taosArrayDestroyP(pConsumerEp->vgs, (FDelete)tDeleteSMqVgEp);
+ taosArrayDestroy(pConsumerEp->offsetRows);
}
taosHashCleanup(pSub->consumerHash);
taosArrayDestroyP(pSub->unassignedVgs, (FDelete)tDeleteSMqVgEp);
+ taosMemoryFreeClear(pSub->qmsg);
+ taosArrayDestroy(pSub->offsetRows);
}
int32_t tEncodeSubscribeObj(void **buf, const SMqSubscribeObj *pSub) {
@@ -508,10 +565,28 @@ int32_t tEncodeSubscribeObj(void **buf, const SMqSubscribeObj *pSub) {
if (cnt != sz) return -1;
tlen += taosEncodeArray(buf, pSub->unassignedVgs, (FEncode)tEncodeSMqVgEp);
tlen += taosEncodeString(buf, pSub->dbName);
+
+ int32_t szVgs = taosArrayGetSize(pSub->offsetRows);
+ tlen += taosEncodeFixedI32(buf, szVgs);
+ for (int32_t j= 0; j < szVgs; ++j) {
+ OffsetRows *offRows = taosArrayGet(pSub->offsetRows, j);
+ tlen += taosEncodeFixedI32(buf, offRows->vgId);
+ tlen += taosEncodeFixedI64(buf, offRows->rows);
+ tlen += taosEncodeFixedI8(buf, offRows->offset.type);
+ if (offRows->offset.type == TMQ_OFFSET__SNAPSHOT_DATA || offRows->offset.type == TMQ_OFFSET__SNAPSHOT_META) {
+ tlen += taosEncodeFixedI64(buf, offRows->offset.uid);
+ tlen += taosEncodeFixedI64(buf, offRows->offset.ts);
+ } else if (offRows->offset.type == TMQ_OFFSET__LOG) {
+ tlen += taosEncodeFixedI64(buf, offRows->offset.version);
+ } else {
+ // do nothing
+ }
+ }
+ tlen += taosEncodeString(buf, pSub->qmsg);
return tlen;
}
-void *tDecodeSubscribeObj(const void *buf, SMqSubscribeObj *pSub) {
+void *tDecodeSubscribeObj(const void *buf, SMqSubscribeObj *pSub, int8_t sver) {
//
buf = taosDecodeStringTo(buf, pSub->key);
buf = taosDecodeFixedI64(buf, &pSub->dbUid);
@@ -526,74 +601,98 @@ void *tDecodeSubscribeObj(const void *buf, SMqSubscribeObj *pSub) {
pSub->consumerHash = taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), true, HASH_NO_LOCK);
for (int32_t i = 0; i < sz; i++) {
SMqConsumerEp consumerEp = {0};
- buf = tDecodeSMqConsumerEp(buf, &consumerEp);
+ buf = tDecodeSMqConsumerEp(buf, &consumerEp, sver);
taosHashPut(pSub->consumerHash, &consumerEp.consumerId, sizeof(int64_t), &consumerEp, sizeof(SMqConsumerEp));
}
- buf = taosDecodeArray(buf, &pSub->unassignedVgs, (FDecode)tDecodeSMqVgEp, sizeof(SMqVgEp));
+ buf = taosDecodeArray(buf, &pSub->unassignedVgs, (FDecode)tDecodeSMqVgEp, sizeof(SMqVgEp), sver);
buf = taosDecodeStringTo(buf, pSub->dbName);
+
+ if (sver > 1){
+ int32_t szVgs = 0;
+ buf = taosDecodeFixedI32(buf, &szVgs);
+ if(szVgs > 0){
+ pSub->offsetRows = taosArrayInit(szVgs, sizeof(OffsetRows));
+ if (NULL == pSub->offsetRows) return NULL;
+ for (int32_t j= 0; j < szVgs; ++j) {
+ OffsetRows* offRows = taosArrayReserve(pSub->offsetRows, 1);
+ buf = taosDecodeFixedI32(buf, &offRows->vgId);
+ buf = taosDecodeFixedI64(buf, &offRows->rows);
+ buf = taosDecodeFixedI8(buf, &offRows->offset.type);
+ if (offRows->offset.type == TMQ_OFFSET__SNAPSHOT_DATA || offRows->offset.type == TMQ_OFFSET__SNAPSHOT_META) {
+ buf = taosDecodeFixedI64(buf, &offRows->offset.uid);
+ buf = taosDecodeFixedI64(buf, &offRows->offset.ts);
+ } else if (offRows->offset.type == TMQ_OFFSET__LOG) {
+ buf = taosDecodeFixedI64(buf, &offRows->offset.version);
+ } else {
+ // do nothing
+ }
+ }
+ }
+ buf = taosDecodeString(buf, &pSub->qmsg);
+ }
return (void *)buf;
}
-SMqSubActionLogEntry *tCloneSMqSubActionLogEntry(SMqSubActionLogEntry *pEntry) {
- SMqSubActionLogEntry *pEntryNew = taosMemoryMalloc(sizeof(SMqSubActionLogEntry));
- if (pEntryNew == NULL) return NULL;
- pEntryNew->epoch = pEntry->epoch;
- pEntryNew->consumers = taosArrayDup(pEntry->consumers, (__array_item_dup_fn_t)tCloneSMqConsumerEp);
- return pEntryNew;
-}
+//SMqSubActionLogEntry *tCloneSMqSubActionLogEntry(SMqSubActionLogEntry *pEntry) {
+// SMqSubActionLogEntry *pEntryNew = taosMemoryMalloc(sizeof(SMqSubActionLogEntry));
+// if (pEntryNew == NULL) return NULL;
+// pEntryNew->epoch = pEntry->epoch;
+// pEntryNew->consumers = taosArrayDup(pEntry->consumers, (__array_item_dup_fn_t)tCloneSMqConsumerEp);
+// return pEntryNew;
+//}
+//
+//void tDeleteSMqSubActionLogEntry(SMqSubActionLogEntry *pEntry) {
+// taosArrayDestroyEx(pEntry->consumers, (FDelete)tDeleteSMqConsumerEp);
+//}
-void tDeleteSMqSubActionLogEntry(SMqSubActionLogEntry *pEntry) {
- taosArrayDestroyEx(pEntry->consumers, (FDelete)tDeleteSMqConsumerEp);
-}
+//int32_t tEncodeSMqSubActionLogEntry(void **buf, const SMqSubActionLogEntry *pEntry) {
+// int32_t tlen = 0;
+// tlen += taosEncodeFixedI32(buf, pEntry->epoch);
+// tlen += taosEncodeArray(buf, pEntry->consumers, (FEncode)tEncodeSMqSubActionLogEntry);
+// return tlen;
+//}
+//
+//void *tDecodeSMqSubActionLogEntry(const void *buf, SMqSubActionLogEntry *pEntry) {
+// buf = taosDecodeFixedI32(buf, &pEntry->epoch);
+// buf = taosDecodeArray(buf, &pEntry->consumers, (FDecode)tDecodeSMqSubActionLogEntry, sizeof(SMqSubActionLogEntry));
+// return (void *)buf;
+//}
-int32_t tEncodeSMqSubActionLogEntry(void **buf, const SMqSubActionLogEntry *pEntry) {
- int32_t tlen = 0;
- tlen += taosEncodeFixedI32(buf, pEntry->epoch);
- tlen += taosEncodeArray(buf, pEntry->consumers, (FEncode)tEncodeSMqSubActionLogEntry);
- return tlen;
-}
+//SMqSubActionLogObj *tCloneSMqSubActionLogObj(SMqSubActionLogObj *pLog) {
+// SMqSubActionLogObj *pLogNew = taosMemoryMalloc(sizeof(SMqSubActionLogObj));
+// if (pLogNew == NULL) return pLogNew;
+// memcpy(pLogNew->key, pLog->key, TSDB_SUBSCRIBE_KEY_LEN);
+// pLogNew->logs = taosArrayDup(pLog->logs, (__array_item_dup_fn_t)tCloneSMqConsumerEp);
+// return pLogNew;
+//}
+//
+//void tDeleteSMqSubActionLogObj(SMqSubActionLogObj *pLog) {
+// taosArrayDestroyEx(pLog->logs, (FDelete)tDeleteSMqConsumerEp);
+//}
-void *tDecodeSMqSubActionLogEntry(const void *buf, SMqSubActionLogEntry *pEntry) {
- buf = taosDecodeFixedI32(buf, &pEntry->epoch);
- buf = taosDecodeArray(buf, &pEntry->consumers, (FDecode)tDecodeSMqSubActionLogEntry, sizeof(SMqSubActionLogEntry));
- return (void *)buf;
-}
-
-SMqSubActionLogObj *tCloneSMqSubActionLogObj(SMqSubActionLogObj *pLog) {
- SMqSubActionLogObj *pLogNew = taosMemoryMalloc(sizeof(SMqSubActionLogObj));
- if (pLogNew == NULL) return pLogNew;
- memcpy(pLogNew->key, pLog->key, TSDB_SUBSCRIBE_KEY_LEN);
- pLogNew->logs = taosArrayDup(pLog->logs, (__array_item_dup_fn_t)tCloneSMqConsumerEp);
- return pLogNew;
-}
-
-void tDeleteSMqSubActionLogObj(SMqSubActionLogObj *pLog) {
- taosArrayDestroyEx(pLog->logs, (FDelete)tDeleteSMqConsumerEp);
-}
-
-int32_t tEncodeSMqSubActionLogObj(void **buf, const SMqSubActionLogObj *pLog) {
- int32_t tlen = 0;
- tlen += taosEncodeString(buf, pLog->key);
- tlen += taosEncodeArray(buf, pLog->logs, (FEncode)tEncodeSMqSubActionLogEntry);
- return tlen;
-}
-
-void *tDecodeSMqSubActionLogObj(const void *buf, SMqSubActionLogObj *pLog) {
- buf = taosDecodeStringTo(buf, pLog->key);
- buf = taosDecodeArray(buf, &pLog->logs, (FDecode)tDecodeSMqSubActionLogEntry, sizeof(SMqSubActionLogEntry));
- return (void *)buf;
-}
-
-int32_t tEncodeSMqOffsetObj(void **buf, const SMqOffsetObj *pOffset) {
- int32_t tlen = 0;
- tlen += taosEncodeString(buf, pOffset->key);
- tlen += taosEncodeFixedI64(buf, pOffset->offset);
- return tlen;
-}
-
-void *tDecodeSMqOffsetObj(void *buf, SMqOffsetObj *pOffset) {
- buf = taosDecodeStringTo(buf, pOffset->key);
- buf = taosDecodeFixedI64(buf, &pOffset->offset);
- return buf;
-}
+//int32_t tEncodeSMqSubActionLogObj(void **buf, const SMqSubActionLogObj *pLog) {
+// int32_t tlen = 0;
+// tlen += taosEncodeString(buf, pLog->key);
+// tlen += taosEncodeArray(buf, pLog->logs, (FEncode)tEncodeSMqSubActionLogEntry);
+// return tlen;
+//}
+//
+//void *tDecodeSMqSubActionLogObj(const void *buf, SMqSubActionLogObj *pLog) {
+// buf = taosDecodeStringTo(buf, pLog->key);
+// buf = taosDecodeArray(buf, &pLog->logs, (FDecode)tDecodeSMqSubActionLogEntry, sizeof(SMqSubActionLogEntry));
+// return (void *)buf;
+//}
+//
+//int32_t tEncodeSMqOffsetObj(void **buf, const SMqOffsetObj *pOffset) {
+// int32_t tlen = 0;
+// tlen += taosEncodeString(buf, pOffset->key);
+// tlen += taosEncodeFixedI64(buf, pOffset->offset);
+// return tlen;
+//}
+//
+//void *tDecodeSMqOffsetObj(void *buf, SMqOffsetObj *pOffset) {
+// buf = taosDecodeStringTo(buf, pOffset->key);
+// buf = taosDecodeFixedI64(buf, &pOffset->offset);
+// return buf;
+//}
diff --git a/source/dnode/mnode/impl/src/mndDnode.c b/source/dnode/mnode/impl/src/mndDnode.c
index 73dbb243a1..bb92bfb4c7 100644
--- a/source/dnode/mnode/impl/src/mndDnode.c
+++ b/source/dnode/mnode/impl/src/mndDnode.c
@@ -632,7 +632,7 @@ static int32_t mndCreateDnode(SMnode *pMnode, SRpcMsg *pReq, SCreateDnodeReq *pC
pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_GLOBAL, pReq, "create-dnode");
if (pTrans == NULL) goto _OVER;
mInfo("trans:%d, used to create dnode:%s", pTrans->id, dnodeObj.ep);
- if (mndTrancCheckConflict(pMnode, pTrans) != 0) goto _OVER;
+ if (mndTransCheckConflict(pMnode, pTrans) != 0) goto _OVER;
pRaw = mndDnodeActionEncode(&dnodeObj);
if (pRaw == NULL || mndTransAppendCommitlog(pTrans, pRaw) != 0) goto _OVER;
@@ -889,7 +889,7 @@ static int32_t mndDropDnode(SMnode *pMnode, SRpcMsg *pReq, SDnodeObj *pDnode, SM
if (pTrans == NULL) goto _OVER;
mndTransSetSerial(pTrans);
mInfo("trans:%d, used to drop dnode:%d, force:%d", pTrans->id, pDnode->id, force);
- if (mndTrancCheckConflict(pMnode, pTrans) != 0) goto _OVER;
+ if (mndTransCheckConflict(pMnode, pTrans) != 0) goto _OVER;
pRaw = mndDnodeActionEncode(pDnode);
if (pRaw == NULL) goto _OVER;
diff --git a/source/dnode/mnode/impl/src/mndIndex.c b/source/dnode/mnode/impl/src/mndIndex.c
index 83172acf64..2d2637b8ce 100644
--- a/source/dnode/mnode/impl/src/mndIndex.c
+++ b/source/dnode/mnode/impl/src/mndIndex.c
@@ -645,7 +645,7 @@ int32_t mndAddIndexImpl(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SStbObj *pSt
// mInfo("trans:%d, used to add index to stb:%s", pTrans->id, pStb->name);
mndTransSetDbName(pTrans, pDb->name, pStb->name);
- if (mndTrancCheckConflict(pMnode, pTrans) != 0) goto _OVER;
+ if (mndTransCheckConflict(pMnode, pTrans) != 0) goto _OVER;
mndTransSetSerial(pTrans);
@@ -721,7 +721,7 @@ static int32_t mndDropIdx(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SIdxObj *p
mInfo("trans:%d, used to drop idx:%s", pTrans->id, pIdx->name);
mndTransSetDbName(pTrans, pDb->name, NULL);
- if (mndTrancCheckConflict(pMnode, pTrans) != 0) goto _OVER;
+ if (mndTransCheckConflict(pMnode, pTrans) != 0) goto _OVER;
mndTransSetSerial(pTrans);
if (mndSetDropIdxRedoLogs(pMnode, pTrans, pIdx) != 0) goto _OVER;
@@ -860,4 +860,4 @@ int32_t mndDropIdxsByDb(SMnode *pMnode, STrans *pTrans, SDbObj *pDb) {
}
return 0;
-}
\ No newline at end of file
+}
diff --git a/source/dnode/mnode/impl/src/mndMnode.c b/source/dnode/mnode/impl/src/mndMnode.c
index d0b10a5768..91fe1257d2 100644
--- a/source/dnode/mnode/impl/src/mndMnode.c
+++ b/source/dnode/mnode/impl/src/mndMnode.c
@@ -578,7 +578,7 @@ static int32_t mndCreateMnode(SMnode *pMnode, SRpcMsg *pReq, SDnodeObj *pDnode,
if (pTrans == NULL) goto _OVER;
mndTransSetSerial(pTrans);
mInfo("trans:%d, used to create mnode:%d", pTrans->id, pCreate->dnodeId);
- if (mndTrancCheckConflict(pMnode, pTrans) != 0) goto _OVER;
+ if (mndTransCheckConflict(pMnode, pTrans) != 0) goto _OVER;
SMnodeObj mnodeObj = {0};
mnodeObj.id = pDnode->id;
@@ -732,7 +732,7 @@ static int32_t mndDropMnode(SMnode *pMnode, SRpcMsg *pReq, SMnodeObj *pObj) {
if (pTrans == NULL) goto _OVER;
mndTransSetSerial(pTrans);
mInfo("trans:%d, used to drop mnode:%d", pTrans->id, pObj->id);
- if (mndTrancCheckConflict(pMnode, pTrans) != 0) goto _OVER;
+ if (mndTransCheckConflict(pMnode, pTrans) != 0) goto _OVER;
if (mndSetDropMnodeInfoToTrans(pMnode, pTrans, pObj, false) != 0) goto _OVER;
if (mndTransPrepare(pMnode, pTrans) != 0) goto _OVER;
diff --git a/source/dnode/mnode/impl/src/mndProfile.c b/source/dnode/mnode/impl/src/mndProfile.c
index 01dd223b5f..06bb46772a 100644
--- a/source/dnode/mnode/impl/src/mndProfile.c
+++ b/source/dnode/mnode/impl/src/mndProfile.c
@@ -227,6 +227,7 @@ static int32_t mndProcessConnectReq(SRpcMsg *pReq) {
}
if ((code = taosCheckVersionCompatibleFromStr(connReq.sVer, version, 3)) != 0) {
+ mGError("version not compatible. client version: %s, server version: %s", connReq.sVer, version);
terrno = code;
goto _OVER;
}
@@ -245,7 +246,7 @@ static int32_t mndProcessConnectReq(SRpcMsg *pReq) {
goto _OVER;
}
- if (strncmp(connReq.passwd, pUser->pass, TSDB_PASSWORD_LEN - 1) != 0) {
+ if (strncmp(connReq.passwd, pUser->pass, TSDB_PASSWORD_LEN - 1) != 0 && !tsMndSkipGrant) {
mGError("user:%s, failed to login from %s since invalid pass, input:%s", pReq->info.conn.user, ip, connReq.passwd);
code = TSDB_CODE_MND_AUTH_FAILURE;
goto _OVER;
@@ -834,6 +835,9 @@ static int32_t mndRetrieveQueries(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *p
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
colDataSetVal(pColInfo, numOfRows, (const char *)&pQuery->stableQuery, false);
+ pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
+ colDataSetVal(pColInfo, numOfRows, (const char *)&pQuery->isSubQuery, false);
+
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
colDataSetVal(pColInfo, numOfRows, (const char *)&pQuery->subPlanNum, false);
diff --git a/source/dnode/mnode/impl/src/mndScheduler.c b/source/dnode/mnode/impl/src/mndScheduler.c
index 64082536da..9a611fe46a 100644
--- a/source/dnode/mnode/impl/src/mndScheduler.c
+++ b/source/dnode/mnode/impl/src/mndScheduler.c
@@ -570,25 +570,21 @@ int32_t mndSchedInitSubEp(SMnode* pMnode, const SMqTopicObj* pTopic, SMqSubscrib
mDebug("init subscription %s for topic:%s assign vgId:%d", pSub->key, pTopic->name, pVgEp->vgId);
- if (pSubplan) {
- int32_t msgLen;
-
- pSubplan->execNode.epSet = pVgEp->epSet;
- pSubplan->execNode.nodeId = pVgEp->vgId;
-
- if (qSubPlanToString(pSubplan, &pVgEp->qmsg, &msgLen) < 0) {
- sdbRelease(pSdb, pVgroup);
- qDestroyQueryPlan(pPlan);
- terrno = TSDB_CODE_QRY_INVALID_INPUT;
- return -1;
- }
- } else {
- pVgEp->qmsg = taosStrdup("");
- }
-
sdbRelease(pSdb, pVgroup);
}
+ if (pSubplan) {
+ int32_t msgLen;
+
+ if (qSubPlanToString(pSubplan, &pSub->qmsg, &msgLen) < 0) {
+ qDestroyQueryPlan(pPlan);
+ terrno = TSDB_CODE_QRY_INVALID_INPUT;
+ return -1;
+ }
+ } else {
+ pSub->qmsg = taosStrdup("");
+ }
+
qDestroyQueryPlan(pPlan);
return 0;
}
diff --git a/source/dnode/mnode/impl/src/mndSma.c b/source/dnode/mnode/impl/src/mndSma.c
index 42ad9e24d5..c337d85b68 100644
--- a/source/dnode/mnode/impl/src/mndSma.c
+++ b/source/dnode/mnode/impl/src/mndSma.c
@@ -388,7 +388,7 @@ static int32_t mndSetCreateSmaVgroupRedoLogs(SMnode *pMnode, STrans *pTrans, SVg
SSdbRaw *pVgRaw = mndVgroupActionEncode(pVgroup);
if (pVgRaw == NULL) return -1;
if (mndTransAppendRedolog(pTrans, pVgRaw) != 0) return -1;
- if (sdbSetRawStatus(pVgRaw, SDB_STATUS_CREATING) != 0) return -1;
+ if (sdbSetRawStatus(pVgRaw, SDB_STATUS_UPDATE) != 0) return -1;
return 0;
}
@@ -622,11 +622,11 @@ static int32_t mndCreateSma(SMnode *pMnode, SRpcMsg *pReq, SMCreateSmaReq *pCrea
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_DB, pReq, "create-sma");
if (pTrans == NULL) goto _OVER;
mndTransSetDbName(pTrans, pDb->name, NULL);
- if (mndTrancCheckConflict(pMnode, pTrans) != 0) goto _OVER;
+ if (mndTransCheckConflict(pMnode, pTrans) != 0) goto _OVER;
mndTransSetSerial(pTrans);
mInfo("trans:%d, used to create sma:%s stream:%s", pTrans->id, pCreate->name, streamObj.name);
-
+ if (mndAddPrepareNewVgAction(pMnode, pTrans, &streamObj.fixedSinkVg) != 0) goto _OVER;
if (mndSetCreateSmaRedoLogs(pMnode, pTrans, &smaObj) != 0) goto _OVER;
if (mndSetCreateSmaVgroupRedoLogs(pMnode, pTrans, &streamObj.fixedSinkVg) != 0) goto _OVER;
if (mndSetCreateSmaCommitLogs(pMnode, pTrans, &smaObj) != 0) goto _OVER;
@@ -845,7 +845,7 @@ static int32_t mndDropSma(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SSmaObj *p
mInfo("trans:%d, used to drop sma:%s", pTrans->id, pSma->name);
mndTransSetDbName(pTrans, pDb->name, NULL);
- if (mndTrancCheckConflict(pMnode, pTrans) != 0) goto _OVER;
+ if (mndTransCheckConflict(pMnode, pTrans) != 0) goto _OVER;
mndTransSetSerial(pTrans);
diff --git a/source/dnode/mnode/impl/src/mndStb.c b/source/dnode/mnode/impl/src/mndStb.c
index 9df8f0be83..1ed42a46da 100644
--- a/source/dnode/mnode/impl/src/mndStb.c
+++ b/source/dnode/mnode/impl/src/mndStb.c
@@ -874,7 +874,7 @@ _OVER:
int32_t mndAddStbToTrans(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SStbObj *pStb) {
mndTransSetDbName(pTrans, pDb->name, pStb->name);
- if (mndTrancCheckConflict(pMnode, pTrans) != 0) return -1;
+ if (mndTransCheckConflict(pMnode, pTrans) != 0) return -1;
if (mndSetCreateStbRedoLogs(pMnode, pTrans, pDb, pStb) != 0) return -1;
if (mndSetCreateStbUndoLogs(pMnode, pTrans, pDb, pStb) != 0) return -1;
if (mndSetCreateStbCommitLogs(pMnode, pTrans, pDb, pStb) != 0) return -1;
@@ -1968,7 +1968,7 @@ static int32_t mndAlterStbImp(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SStbOb
mInfo("trans:%d, used to alter stb:%s", pTrans->id, pStb->name);
mndTransSetDbName(pTrans, pDb->name, pStb->name);
- if (mndTrancCheckConflict(pMnode, pTrans) != 0) goto _OVER;
+ if (mndTransCheckConflict(pMnode, pTrans) != 0) goto _OVER;
if (needRsp) {
void *pCont = NULL;
@@ -1998,7 +1998,7 @@ static int32_t mndAlterStbAndUpdateTagIdxImp(SMnode *pMnode, SRpcMsg *pReq, SDbO
mInfo("trans:%d, used to alter stb:%s", pTrans->id, pStb->name);
mndTransSetDbName(pTrans, pDb->name, pStb->name);
- if (mndTrancCheckConflict(pMnode, pTrans) != 0) goto _OVER;
+ if (mndTransCheckConflict(pMnode, pTrans) != 0) goto _OVER;
if (needRsp) {
void *pCont = NULL;
@@ -2242,7 +2242,7 @@ static int32_t mndDropStb(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SStbObj *p
mInfo("trans:%d, used to drop stb:%s", pTrans->id, pStb->name);
mndTransSetDbName(pTrans, pDb->name, pStb->name);
- if (mndTrancCheckConflict(pMnode, pTrans) != 0) goto _OVER;
+ if (mndTransCheckConflict(pMnode, pTrans) != 0) goto _OVER;
if (mndSetDropStbRedoLogs(pMnode, pTrans, pStb) != 0) goto _OVER;
if (mndSetDropStbCommitLogs(pMnode, pTrans, pStb) != 0) goto _OVER;
@@ -3304,7 +3304,7 @@ static int32_t mndCheckIndexReq(SCreateTagIndexReq *pReq) {
mInfo("trans:%d, used to add index to stb:%s", pTrans->id, pStb->name);
mndTransSetDbName(pTrans, pDb->name, pStb->name);
- if (mndTrancCheckConflict(pMnode, pTrans) != 0) goto _OVER;
+ if (mndTransCheckConflict(pMnode, pTrans) != 0) goto _OVER;
if (mndSetAlterStbRedoLogs(pMnode, pTrans, pDb, pStb) != 0) goto _OVER;
if (mndSetAlterStbCommitLogs(pMnode, pTrans, pDb, pStb) != 0) goto _OVER;
diff --git a/source/dnode/mnode/impl/src/mndStream.c b/source/dnode/mnode/impl/src/mndStream.c
index 39a1fa223f..60678f1a34 100644
--- a/source/dnode/mnode/impl/src/mndStream.c
+++ b/source/dnode/mnode/impl/src/mndStream.c
@@ -735,7 +735,7 @@ static int32_t mndProcessCreateStreamReq(SRpcMsg *pReq) {
mInfo("trans:%d, used to create stream:%s", pTrans->id, createStreamReq.name);
mndTransSetDbName(pTrans, createStreamReq.sourceDB, streamObj.targetDb);
- if (mndTrancCheckConflict(pMnode, pTrans) != 0) {
+ if (mndTransCheckConflict(pMnode, pTrans) != 0) {
mndTransDrop(pTrans);
goto _OVER;
}
@@ -890,7 +890,7 @@ static int32_t mndProcessStreamDoCheckpoint(SRpcMsg *pReq) {
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_DB_INSIDE, pReq, "stream-checkpoint");
if (pTrans == NULL) return -1;
mndTransSetDbName(pTrans, pStream->sourceDb, pStream->targetDb);
- if (mndTrancCheckConflict(pMnode, pTrans) != 0) {
+ if (mndTransCheckConflict(pMnode, pTrans) != 0) {
mndReleaseStream(pMnode, pStream);
mndTransDrop(pTrans);
return -1;
@@ -1001,7 +1001,7 @@ static int32_t mndProcessDropStreamReq(SRpcMsg *pReq) {
mInfo("trans:%d, used to drop stream:%s", pTrans->id, dropReq.name);
mndTransSetDbName(pTrans, pStream->sourceDb, pStream->targetDb);
- if (mndTrancCheckConflict(pMnode, pTrans) != 0) {
+ if (mndTransCheckConflict(pMnode, pTrans) != 0) {
sdbRelease(pMnode->pSdb, pStream);
mndTransDrop(pTrans);
return -1;
@@ -1369,7 +1369,7 @@ static int32_t mndProcessPauseStreamReq(SRpcMsg *pReq) {
mInfo("trans:%d, used to pause stream:%s", pTrans->id, pauseReq.name);
mndTransSetDbName(pTrans, pStream->sourceDb, pStream->targetDb);
- if (mndTrancCheckConflict(pMnode, pTrans) != 0) {
+ if (mndTransCheckConflict(pMnode, pTrans) != 0) {
sdbRelease(pMnode->pSdb, pStream);
mndTransDrop(pTrans);
return -1;
@@ -1477,7 +1477,7 @@ static int32_t mndProcessResumeStreamReq(SRpcMsg *pReq) {
mInfo("trans:%d, used to pause stream:%s", pTrans->id, pauseReq.name);
mndTransSetDbName(pTrans, pStream->sourceDb, pStream->targetDb);
- if (mndTrancCheckConflict(pMnode, pTrans) != 0) {
+ if (mndTransCheckConflict(pMnode, pTrans) != 0) {
sdbRelease(pMnode->pSdb, pStream);
mndTransDrop(pTrans);
return -1;
diff --git a/source/dnode/mnode/impl/src/mndSubscribe.c b/source/dnode/mnode/impl/src/mndSubscribe.c
index 74421afa33..61691a30d5 100644
--- a/source/dnode/mnode/impl/src/mndSubscribe.c
+++ b/source/dnode/mnode/impl/src/mndSubscribe.c
@@ -24,7 +24,7 @@
#include "tcompare.h"
#include "tname.h"
-#define MND_SUBSCRIBE_VER_NUMBER 1
+#define MND_SUBSCRIBE_VER_NUMBER 2
#define MND_SUBSCRIBE_RESERVE_SIZE 64
#define MND_SUBSCRIBE_REBALANCE_CNT 3
@@ -99,13 +99,23 @@ static SMqSubscribeObj *mndCreateSubscription(SMnode *pMnode, const SMqTopicObj
return pSub;
}
-static int32_t mndBuildSubChangeReq(void **pBuf, int32_t *pLen, const SMqSubscribeObj *pSub,
- const SMqRebOutputVg *pRebVg) {
+static int32_t mndBuildSubChangeReq(void **pBuf, int32_t *pLen, SMqSubscribeObj *pSub,
+ const SMqRebOutputVg *pRebVg, SSubplan* pPlan) {
SMqRebVgReq req = {0};
req.oldConsumerId = pRebVg->oldConsumerId;
req.newConsumerId = pRebVg->newConsumerId;
req.vgId = pRebVg->pVgEp->vgId;
- req.qmsg = pRebVg->pVgEp->qmsg;
+ if(pPlan){
+ pPlan->execNode.epSet = pRebVg->pVgEp->epSet;
+ pPlan->execNode.nodeId = pRebVg->pVgEp->vgId;
+ int32_t msgLen;
+ if (qSubPlanToString(pPlan, &req.qmsg, &msgLen) < 0) {
+ terrno = TSDB_CODE_QRY_INVALID_INPUT;
+ return -1;
+ }
+ }else{
+ req.qmsg = taosStrdup("");
+ }
req.subType = pSub->subType;
req.withMeta = pSub->withMeta;
req.suid = pSub->stbUid;
@@ -115,6 +125,7 @@ static int32_t mndBuildSubChangeReq(void **pBuf, int32_t *pLen, const SMqSubscri
int32_t ret = 0;
tEncodeSize(tEncodeSMqRebVgReq, &req, tlen, ret);
if (ret < 0) {
+ taosMemoryFree(req.qmsg);
return -1;
}
@@ -122,6 +133,7 @@ static int32_t mndBuildSubChangeReq(void **pBuf, int32_t *pLen, const SMqSubscri
void *buf = taosMemoryMalloc(tlen);
if (buf == NULL) {
terrno = TSDB_CODE_OUT_OF_MEMORY;
+ taosMemoryFree(req.qmsg);
return -1;
}
@@ -135,17 +147,19 @@ static int32_t mndBuildSubChangeReq(void **pBuf, int32_t *pLen, const SMqSubscri
if (tEncodeSMqRebVgReq(&encoder, &req) < 0) {
taosMemoryFreeClear(buf);
tEncoderClear(&encoder);
+ taosMemoryFree(req.qmsg);
return -1;
}
tEncoderClear(&encoder);
*pBuf = buf;
*pLen = tlen;
+ taosMemoryFree(req.qmsg);
return 0;
}
-static int32_t mndPersistSubChangeVgReq(SMnode *pMnode, STrans *pTrans, const SMqSubscribeObj *pSub,
- const SMqRebOutputVg *pRebVg) {
+static int32_t mndPersistSubChangeVgReq(SMnode *pMnode, STrans *pTrans, SMqSubscribeObj *pSub,
+ const SMqRebOutputVg *pRebVg, SSubplan* pPlan) {
// if (pRebVg->oldConsumerId == pRebVg->newConsumerId) {
// terrno = TSDB_CODE_MND_INVALID_SUB_OPTION;
// return -1;
@@ -153,7 +167,7 @@ static int32_t mndPersistSubChangeVgReq(SMnode *pMnode, STrans *pTrans, const SM
void *buf;
int32_t tlen;
- if (mndBuildSubChangeReq(&buf, &tlen, pSub, pRebVg) < 0) {
+ if (mndBuildSubChangeReq(&buf, &tlen, pSub, pRebVg, pPlan) < 0) {
return -1;
}
@@ -255,7 +269,7 @@ static void doAddNewConsumers(SMqRebOutputObj *pOutput, const SMqRebInputObj *pI
for (int32_t i = 0; i < numOfNewConsumers; i++) {
int64_t consumerId = *(int64_t *)taosArrayGet(pInput->pRebInfo->newConsumers, i);
- SMqConsumerEp newConsumerEp;
+ SMqConsumerEp newConsumerEp = {0};
newConsumerEp.consumerId = consumerId;
newConsumerEp.vgs = taosArrayInit(0, sizeof(void *));
@@ -449,8 +463,44 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR
SMqRebOutputVg* pRebOutput = (SMqRebOutputVg *)pRemovedIter;
taosArrayPush(pOutput->rebVgs, pRebOutput);
- if(taosHashGetSize(pOutput->pSub->consumerHash) == 0){ // if all consumer is removed, put all vg into unassigned
- taosArrayPush(pOutput->pSub->unassignedVgs, &pRebOutput->pVgEp);
+ if(taosHashGetSize(pOutput->pSub->consumerHash) == 0){ // if all consumer is removed
+ taosArrayPush(pOutput->pSub->unassignedVgs, &pRebOutput->pVgEp); // put all vg into unassigned
+ }
+ }
+
+ if(taosHashGetSize(pOutput->pSub->consumerHash) == 0) { // if all consumer is removed
+ SMqSubscribeObj *pSub = mndAcquireSubscribeByKey(pMnode, pInput->pRebInfo->key); // put all offset rows
+ if (pSub) {
+ taosRLockLatch(&pSub->lock);
+ bool init = false;
+ if (pOutput->pSub->offsetRows == NULL) {
+ pOutput->pSub->offsetRows = taosArrayInit(4, sizeof(OffsetRows));
+ init = true;
+ }
+ pIter = NULL;
+ while (1) {
+ pIter = taosHashIterate(pSub->consumerHash, pIter);
+ if (pIter == NULL) break;
+ SMqConsumerEp *pConsumerEp = (SMqConsumerEp *)pIter;
+ if (init) {
+ taosArrayAddAll(pOutput->pSub->offsetRows, pConsumerEp->offsetRows);
+// mDebug("pSub->offsetRows is init");
+ } else {
+ for (int j = 0; j < taosArrayGetSize(pConsumerEp->offsetRows); j++) {
+ OffsetRows *d1 = taosArrayGet(pConsumerEp->offsetRows, j);
+ for (int i = 0; i < taosArrayGetSize(pOutput->pSub->offsetRows); i++) {
+ OffsetRows *d2 = taosArrayGet(pOutput->pSub->offsetRows, i);
+ if (d1->vgId == d2->vgId) {
+ d2->rows += d1->rows;
+ d2->offset = d1->offset;
+// mDebug("pSub->offsetRows add vgId:%d, after:%"PRId64", before:%"PRId64, d2->vgId, d2->rows, d1->rows);
+ }
+ }
+ }
+ }
+ }
+ taosRUnLockLatch(&pSub->lock);
+ mndReleaseSubscribe(pMnode, pSub);
}
}
@@ -483,14 +533,25 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR
}
static int32_t mndPersistRebResult(SMnode *pMnode, SRpcMsg *pMsg, const SMqRebOutputObj *pOutput) {
+ struct SSubplan* pPlan = NULL;
+ if(strcmp(pOutput->pSub->qmsg, "") != 0){
+ int32_t code = qStringToSubplan(pOutput->pSub->qmsg, &pPlan);
+ if (code != TSDB_CODE_SUCCESS) {
+ terrno = code;
+ return -1;
+ }
+ }
+
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_DB_INSIDE, pMsg, "tmq-reb");
if (pTrans == NULL) {
+ nodesDestroyNode((SNode*)pPlan);
return -1;
}
mndTransSetDbName(pTrans, pOutput->pSub->dbName, NULL);
- if (mndTrancCheckConflict(pMnode, pTrans) != 0) {
+ if (mndTransCheckConflict(pMnode, pTrans) != 0) {
mndTransDrop(pTrans);
+ nodesDestroyNode((SNode*)pPlan);
return -1;
}
@@ -500,11 +561,13 @@ static int32_t mndPersistRebResult(SMnode *pMnode, SRpcMsg *pMsg, const SMqRebOu
int32_t vgNum = taosArrayGetSize(rebVgs);
for (int32_t i = 0; i < vgNum; i++) {
SMqRebOutputVg *pRebVg = taosArrayGet(rebVgs, i);
- if (mndPersistSubChangeVgReq(pMnode, pTrans, pOutput->pSub, pRebVg) < 0) {
+ if (mndPersistSubChangeVgReq(pMnode, pTrans, pOutput->pSub, pRebVg, pPlan) < 0) {
mndTransDrop(pTrans);
+ nodesDestroyNode((SNode*)pPlan);
return -1;
}
}
+ nodesDestroyNode((SNode*)pPlan);
// 2. redo log: subscribe and vg assignment
// subscribe
@@ -809,7 +872,7 @@ static SSdbRow *mndSubActionDecode(SSdbRaw *pRaw) {
int8_t sver = 0;
if (sdbGetRawSoftVer(pRaw, &sver) != 0) goto SUB_DECODE_OVER;
- if (sver != MND_SUBSCRIBE_VER_NUMBER) {
+ if (sver > MND_SUBSCRIBE_VER_NUMBER || sver < 1) {
terrno = TSDB_CODE_SDB_INVALID_DATA_VER;
goto SUB_DECODE_OVER;
}
@@ -828,7 +891,7 @@ static SSdbRow *mndSubActionDecode(SSdbRaw *pRaw) {
SDB_GET_BINARY(pRaw, dataPos, buf, tlen, SUB_DECODE_OVER);
SDB_GET_RESERVE(pRaw, dataPos, MND_SUBSCRIBE_RESERVE_SIZE, SUB_DECODE_OVER);
- if (tDecodeSubscribeObj(buf, pSub) == NULL) {
+ if (tDecodeSubscribeObj(buf, pSub, sver) == NULL) {
goto SUB_DECODE_OVER;
}
@@ -890,6 +953,10 @@ static int32_t mndSubActionUpdate(SSdb *pSdb, SMqSubscribeObj *pOldSub, SMqSubsc
pOldSub->unassignedVgs = pNewSub->unassignedVgs;
pNewSub->unassignedVgs = tmp1;
+ SArray *tmp2 = pOldSub->offsetRows;
+ pOldSub->offsetRows = pNewSub->offsetRows;
+ pNewSub->offsetRows = tmp2;
+
taosWUnLockLatch(&pOldSub->lock);
return 0;
}
@@ -1028,6 +1095,61 @@ END:
return code;
}
+static int32_t buildResult(SSDataBlock *pBlock, int32_t* numOfRows, int64_t consumerId, const char* topic, const char* cgroup, SArray* vgs, SArray *offsetRows){
+ int32_t sz = taosArrayGetSize(vgs);
+ for (int32_t j = 0; j < sz; j++) {
+ SMqVgEp *pVgEp = taosArrayGetP(vgs, j);
+
+ SColumnInfoData *pColInfo;
+ int32_t cols = 0;
+
+ pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
+ colDataSetVal(pColInfo, *numOfRows, (const char *)topic, false);
+
+ pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
+ colDataSetVal(pColInfo, *numOfRows, (const char *)cgroup, false);
+
+ // vg id
+ pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
+ colDataSetVal(pColInfo, *numOfRows, (const char *)&pVgEp->vgId, false);
+
+ // consumer id
+ pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
+ colDataSetVal(pColInfo, *numOfRows, (const char *)&consumerId, consumerId == -1);
+
+ mDebug("mnd show subscriptions: topic %s, consumer:0x%" PRIx64 " cgroup %s vgid %d", varDataVal(topic),
+ consumerId, varDataVal(cgroup), pVgEp->vgId);
+
+ // offset
+ OffsetRows *data = NULL;
+ for(int i = 0; i < taosArrayGetSize(offsetRows); i++){
+ OffsetRows *tmp = taosArrayGet(offsetRows, i);
+ if(tmp->vgId != pVgEp->vgId){
+ continue;
+ }
+ data = tmp;
+ }
+ if(data){
+ // vg id
+ char buf[TSDB_OFFSET_LEN + VARSTR_HEADER_SIZE] = {0};
+ tFormatOffset(varDataVal(buf), TSDB_OFFSET_LEN, &data->offset);
+ varDataSetLen(buf, strlen(varDataVal(buf)));
+ pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
+ colDataSetVal(pColInfo, *numOfRows, (const char *)buf, false);
+ pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
+ colDataSetVal(pColInfo, *numOfRows, (const char *)&data->rows, false);
+ }else{
+ pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
+ colDataSetNULL(pColInfo, *numOfRows);
+ pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
+ colDataSetNULL(pColInfo, *numOfRows);
+ mError("mnd show subscriptions: do not find vgId:%d in offsetRows", pVgEp->vgId);
+ }
+ (*numOfRows)++;
+ }
+ return 0;
+}
+
int32_t mndRetrieveSubscribe(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rowsCapacity) {
SMnode *pMnode = pReq->info.node;
SSdb *pSdb = pMnode->pSdb;
@@ -1048,6 +1170,13 @@ int32_t mndRetrieveSubscribe(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock
blockDataEnsureCapacity(pBlock, numOfRows + pSub->vgNum);
}
+ // topic and cgroup
+ char topic[TSDB_TOPIC_FNAME_LEN + VARSTR_HEADER_SIZE] = {0};
+ char cgroup[TSDB_CGROUP_LEN + VARSTR_HEADER_SIZE] = {0};
+ mndSplitSubscribeKey(pSub->key, varDataVal(topic), varDataVal(cgroup), false);
+ varDataSetLen(topic, strlen(varDataVal(topic)));
+ varDataSetLen(cgroup, strlen(varDataVal(cgroup)));
+
SMqConsumerEp *pConsumerEp = NULL;
void *pIter = NULL;
while (1) {
@@ -1055,97 +1184,11 @@ int32_t mndRetrieveSubscribe(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock
if (pIter == NULL) break;
pConsumerEp = (SMqConsumerEp *)pIter;
- int32_t sz = taosArrayGetSize(pConsumerEp->vgs);
- for (int32_t j = 0; j < sz; j++) {
- SMqVgEp *pVgEp = taosArrayGetP(pConsumerEp->vgs, j);
-
- SColumnInfoData *pColInfo;
- int32_t cols = 0;
-
- // topic and cgroup
- char topic[TSDB_TOPIC_FNAME_LEN + VARSTR_HEADER_SIZE] = {0};
- char cgroup[TSDB_CGROUP_LEN + VARSTR_HEADER_SIZE] = {0};
- mndSplitSubscribeKey(pSub->key, varDataVal(topic), varDataVal(cgroup), false);
- varDataSetLen(topic, strlen(varDataVal(topic)));
- varDataSetLen(cgroup, strlen(varDataVal(cgroup)));
-
- pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
- colDataSetVal(pColInfo, numOfRows, (const char *)topic, false);
-
- pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
- colDataSetVal(pColInfo, numOfRows, (const char *)cgroup, false);
-
- // vg id
- pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
- colDataSetVal(pColInfo, numOfRows, (const char *)&pVgEp->vgId, false);
-
- // consumer id
- pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
- colDataSetVal(pColInfo, numOfRows, (const char *)&pConsumerEp->consumerId, false);
-
- mDebug("mnd show subscriptions: topic %s, consumer:0x%" PRIx64 " cgroup %s vgid %d", varDataVal(topic),
- pConsumerEp->consumerId, varDataVal(cgroup), pVgEp->vgId);
-
- // offset
-#if 0
- // subscribe time
- pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
- colDataSetVal(pColInfo, numOfRows, (const char *)&pSub->subscribeTime, false);
-
- // rebalance time
- pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
- colDataSetVal(pColInfo, numOfRows, (const char *)&pSub->rebalanceTime, pConsumer->rebalanceTime == 0);
-#endif
-
- numOfRows++;
- }
+ buildResult(pBlock, &numOfRows, pConsumerEp->consumerId, topic, cgroup, pConsumerEp->vgs, pConsumerEp->offsetRows);
}
// do not show for cleared subscription
- int32_t sz = taosArrayGetSize(pSub->unassignedVgs);
- for (int32_t i = 0; i < sz; i++) {
- SMqVgEp *pVgEp = taosArrayGetP(pSub->unassignedVgs, i);
-
- SColumnInfoData *pColInfo;
- int32_t cols = 0;
-
- // topic and cgroup
- char topic[TSDB_TOPIC_FNAME_LEN + VARSTR_HEADER_SIZE] = {0};
- char cgroup[TSDB_CGROUP_LEN + VARSTR_HEADER_SIZE] = {0};
- mndSplitSubscribeKey(pSub->key, varDataVal(topic), varDataVal(cgroup), false);
- varDataSetLen(topic, strlen(varDataVal(topic)));
- varDataSetLen(cgroup, strlen(varDataVal(cgroup)));
-
- pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
- colDataSetVal(pColInfo, numOfRows, (const char *)topic, false);
-
- pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
- colDataSetVal(pColInfo, numOfRows, (const char *)cgroup, false);
-
- // vg id
- pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
- colDataSetVal(pColInfo, numOfRows, (const char *)&pVgEp->vgId, false);
-
- // consumer id
- pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
- colDataSetVal(pColInfo, numOfRows, NULL, true);
-
- mDebug("mnd show subscriptions(unassigned): topic %s, cgroup %s vgid %d", varDataVal(topic), varDataVal(cgroup),
- pVgEp->vgId);
-
- // offset
-#if 0
- // subscribe time
- pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
- colDataSetVal(pColInfo, numOfRows, (const char *)&pSub->subscribeTime, false);
-
- // rebalance time
- pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
- colDataSetVal(pColInfo, numOfRows, (const char *)&pSub->rebalanceTime, pConsumer->rebalanceTime == 0);
-#endif
-
- numOfRows++;
- }
+ buildResult(pBlock, &numOfRows, -1, topic, cgroup, pSub->unassignedVgs, pSub->offsetRows);
pBlock->info.rows = numOfRows;
diff --git a/source/dnode/mnode/impl/src/mndSync.c b/source/dnode/mnode/impl/src/mndSync.c
index 0a6df02f5f..68bfe09b5e 100644
--- a/source/dnode/mnode/impl/src/mndSync.c
+++ b/source/dnode/mnode/impl/src/mndSync.c
@@ -17,6 +17,7 @@
#include "mndSync.h"
#include "mndCluster.h"
#include "mndTrans.h"
+#include "mndVgroup.h"
static int32_t mndSyncEqCtrlMsg(const SMsgCb *msgcb, SRpcMsg *pMsg) {
if (pMsg == NULL || pMsg->pCont == NULL) {
@@ -73,76 +74,200 @@ static int32_t mndSyncSendMsg(const SEpSet *pEpSet, SRpcMsg *pMsg) {
return code;
}
-int32_t mndProcessWriteMsg(const SSyncFSM *pFsm, SRpcMsg *pMsg, const SFsmCbMeta *pMeta) {
- SMnode *pMnode = pFsm->data;
+static int32_t mndTransValidatePrepareAction(SMnode *pMnode, STrans *pTrans, STransAction *pAction) {
+ SSdbRow *pRow = NULL;
+ int32_t code = -1;
+
+ if (pAction->msgType == TDMT_MND_CREATE_VG) {
+ pRow = mndVgroupActionDecode(pAction->pRaw);
+ if (pRow == NULL) goto _OUT;
+
+ SVgObj *pVgroup = sdbGetRowObj(pRow);
+ if (pVgroup == NULL) goto _OUT;
+
+ int32_t maxVgId = sdbGetMaxId(pMnode->pSdb, SDB_VGROUP);
+ if (maxVgId > pVgroup->vgId) {
+ mError("trans:%d, failed to satisfy vgroup id %d of prepare action. maxVgId:%d", pTrans->id, pVgroup->vgId,
+ maxVgId);
+ goto _OUT;
+ }
+ }
+
+ code = 0;
+_OUT:
+ taosMemoryFreeClear(pRow);
+ return code;
+}
+
+static int32_t mndTransValidatePrepareStage(SMnode *pMnode, STrans *pTrans) {
+ int32_t code = -1;
+ int32_t action = 0;
+
+ int32_t numOfActions = taosArrayGetSize(pTrans->prepareActions);
+ if (numOfActions == 0) {
+ code = 0;
+ goto _OUT;
+ }
+
+ mInfo("trans:%d, validate %d prepare actions.", pTrans->id, numOfActions);
+
+ for (action = 0; action < numOfActions; ++action) {
+ STransAction *pAction = taosArrayGet(pTrans->prepareActions, action);
+
+ if (pAction->actionType != TRANS_ACTION_RAW) {
+ mError("trans:%d, prepare action:%d of unexpected type:%d", pTrans->id, action, pAction->actionType);
+ goto _OUT;
+ }
+
+ code = mndTransValidatePrepareAction(pMnode, pTrans, pAction);
+ if (code != 0) {
+ mError("trans:%d, failed to validate prepare action: %d, numOfActions:%d", pTrans->id, action, numOfActions);
+ goto _OUT;
+ }
+ }
+
+ code = 0;
+_OUT:
+ return code;
+}
+
+static int32_t mndTransValidateImp(SMnode *pMnode, STrans *pTrans) {
+ if (pTrans->stage == TRN_STAGE_PREPARE) {
+ if (mndTransCheckConflict(pMnode, pTrans) < 0) {
+ mError("trans:%d, failed to validate trans conflicts.", pTrans->id);
+ return -1;
+ }
+
+ return mndTransValidatePrepareStage(pMnode, pTrans);
+ }
+ return 0;
+}
+
+static int32_t mndTransValidate(SMnode *pMnode, SSdbRaw *pRaw) {
+ STrans *pTrans = NULL;
+ int32_t code = -1;
+
+ SSdbRow *pRow = mndTransDecode(pRaw);
+ if (pRow == NULL) goto _OUT;
+
+ pTrans = sdbGetRowObj(pRow);
+ if (pTrans == NULL) goto _OUT;
+
+ code = mndTransValidateImp(pMnode, pTrans);
+
+_OUT:
+ if (pTrans) mndTransDropData(pTrans);
+ if (pRow) taosMemoryFreeClear(pRow);
+ if (code) terrno = (terrno ? terrno : TSDB_CODE_MND_TRANS_CONFLICT);
+ return code;
+}
+
+int32_t mndProcessWriteMsg(SMnode *pMnode, SRpcMsg *pMsg, SFsmCbMeta *pMeta) {
+ terrno = TSDB_CODE_SUCCESS;
SSyncMgmt *pMgmt = &pMnode->syncMgmt;
SSdbRaw *pRaw = pMsg->pCont;
-
+ STrans *pTrans = NULL;
+ int32_t code = -1;
int32_t transId = sdbGetIdFromRaw(pMnode->pSdb, pRaw);
+
+ if (transId <= 0) {
+ mError("trans:%d, invalid commit msg, cache transId:%d seq:%" PRId64, transId, pMgmt->transId, pMgmt->transSeq);
+ terrno = TSDB_CODE_INVALID_MSG;
+ goto _OUT;
+ }
+
mInfo("trans:%d, is proposed, saved:%d code:0x%x, apply index:%" PRId64 " term:%" PRIu64 " config:%" PRId64
" role:%s raw:%p sec:%d seq:%" PRId64,
transId, pMgmt->transId, pMeta->code, pMeta->index, pMeta->term, pMeta->lastConfigIndex, syncStr(pMeta->state),
pRaw, pMgmt->transSec, pMgmt->transSeq);
- if (pMeta->code == 0) {
- int32_t code = sdbWriteWithoutFree(pMnode->pSdb, pRaw);
- if (code != 0) {
- mError("trans:%d, failed to write to sdb since %s", transId, terrstr());
- return 0;
- }
- sdbSetApplyInfo(pMnode->pSdb, pMeta->index, pMeta->term, pMeta->lastConfigIndex);
+ code = mndTransValidate(pMnode, pRaw);
+ if (code != 0) {
+ mError("trans:%d, failed to validate requested trans since %s", transId, terrstr());
+ code = 0;
+ pMeta->code = terrno;
+ goto _OUT;
}
- taosThreadMutexLock(&pMgmt->lock);
- pMgmt->errCode = pMeta->code;
-
- if (transId <= 0) {
- taosThreadMutexUnlock(&pMgmt->lock);
- mError("trans:%d, invalid commit msg, cache transId:%d seq:%" PRId64, transId, pMgmt->transId, pMgmt->transSeq);
- } else if (transId == pMgmt->transId) {
- if (pMgmt->errCode != 0) {
- mError("trans:%d, failed to propose since %s, post sem", transId, tstrerror(pMgmt->errCode));
- } else {
- mInfo("trans:%d, is proposed and post sem, seq:%" PRId64, transId, pMgmt->transSeq);
- }
- pMgmt->transId = 0;
- pMgmt->transSec = 0;
- pMgmt->transSeq = 0;
- tsem_post(&pMgmt->syncSem);
- taosThreadMutexUnlock(&pMgmt->lock);
- } else {
- taosThreadMutexUnlock(&pMgmt->lock);
- STrans *pTrans = mndAcquireTrans(pMnode, transId);
- if (pTrans != NULL) {
- mInfo("trans:%d, execute in mnode which not leader or sync timeout, createTime:%" PRId64 " saved trans:%d",
- transId, pTrans->createdTime, pMgmt->transId);
- mndTransExecute(pMnode, pTrans, false);
- mndReleaseTrans(pMnode, pTrans);
- } else {
- mError("trans:%d, not found while execute in mnode since %s", transId, terrstr());
- }
+ code = sdbWriteWithoutFree(pMnode->pSdb, pRaw);
+ if (code != 0) {
+ mError("trans:%d, failed to write to sdb since %s", transId, terrstr());
+ code = 0;
+ pMeta->code = terrno;
+ goto _OUT;
}
+ pTrans = mndAcquireTrans(pMnode, transId);
+ if (pTrans == NULL) {
+ mError("trans:%d, not found while execute in mnode since %s", transId, terrstr());
+ goto _OUT;
+ }
+
+ if (pTrans->stage == TRN_STAGE_PREPARE) {
+ bool continueExec = mndTransPerformPrepareStage(pMnode, pTrans);
+ if (!continueExec) goto _OUT;
+ }
+
+ if (pTrans->id != pMgmt->transId) {
+ mInfo("trans:%d, execute in mnode which not leader or sync timeout, createTime:%" PRId64 " saved trans:%d",
+ pTrans->id, pTrans->createdTime, pMgmt->transId);
+ mndTransRefresh(pMnode, pTrans);
+ }
+
+ sdbSetApplyInfo(pMnode->pSdb, pMeta->index, pMeta->term, pMeta->lastConfigIndex);
sdbWriteFile(pMnode->pSdb, tsMndSdbWriteDelta);
+ code = 0;
+
+_OUT:
+ if (pTrans) mndReleaseTrans(pMnode, pTrans);
+ return code;
+}
+
+static int32_t mndPostMgmtCode(SMnode *pMnode, int32_t code) {
+ SSyncMgmt *pMgmt = &pMnode->syncMgmt;
+ taosThreadMutexLock(&pMgmt->lock);
+ if (pMgmt->transId == 0) {
+ goto _OUT;
+ }
+
+ pMgmt->transId = 0;
+ pMgmt->transSec = 0;
+ pMgmt->transSeq = 0;
+ pMgmt->errCode = code;
+ tsem_post(&pMgmt->syncSem);
+
+ if (pMgmt->errCode != 0) {
+ mError("trans:%d, failed to propose since %s, post sem", pMgmt->transId, tstrerror(pMgmt->errCode));
+ } else {
+ mInfo("trans:%d, is proposed and post sem, seq:%" PRId64, pMgmt->transId, pMgmt->transSeq);
+ }
+
+_OUT:
+ taosThreadMutexUnlock(&pMgmt->lock);
return 0;
}
-int32_t mndSyncCommitMsg(const SSyncFSM *pFsm, SRpcMsg *pMsg, const SFsmCbMeta *pMeta) {
- int32_t code = 0;
+int32_t mndSyncCommitMsg(const SSyncFSM *pFsm, SRpcMsg *pMsg, SFsmCbMeta *pMeta) {
+ SMnode *pMnode = pFsm->data;
+ int32_t code = pMsg->code;
+ if (code != 0) {
+ goto _OUT;
+ }
+
pMsg->info.conn.applyIndex = pMeta->index;
pMsg->info.conn.applyTerm = pMeta->term;
+ pMeta->code = 0;
- if (pMsg->code == 0) {
- SMnode *pMnode = pFsm->data;
- atomic_store_64(&pMnode->applied, pMsg->info.conn.applyIndex);
- }
+ atomic_store_64(&pMnode->applied, pMsg->info.conn.applyIndex);
if (!syncUtilUserCommit(pMsg->msgType)) {
- goto _out;
+ goto _OUT;
}
- code = mndProcessWriteMsg(pFsm, pMsg, pMeta);
-_out:
+ code = mndProcessWriteMsg(pMnode, pMsg, pMeta);
+
+_OUT:
+ mndPostMgmtCode(pMnode, code ? code : pMeta->code);
rpcFreeCont(pMsg->pCont);
pMsg->pCont = NULL;
return code;
diff --git a/source/dnode/mnode/impl/src/mndTopic.c b/source/dnode/mnode/impl/src/mndTopic.c
index 4d12f2433f..d3cb19231e 100644
--- a/source/dnode/mnode/impl/src/mndTopic.c
+++ b/source/dnode/mnode/impl/src/mndTopic.c
@@ -753,7 +753,7 @@ static int32_t mndProcessDropTopicReq(SRpcMsg *pReq) {
}
mndTransSetDbName(pTrans, pTopic->db, NULL);
- if (mndTrancCheckConflict(pMnode, pTrans) != 0) {
+ if (mndTransCheckConflict(pMnode, pTrans) != 0) {
mndReleaseTopic(pMnode, pTopic);
mndTransDrop(pTrans);
return -1;
diff --git a/source/dnode/mnode/impl/src/mndTrans.c b/source/dnode/mnode/impl/src/mndTrans.c
index cfb5bef9d0..7ebaf6dda5 100644
--- a/source/dnode/mnode/impl/src/mndTrans.c
+++ b/source/dnode/mnode/impl/src/mndTrans.c
@@ -23,28 +23,25 @@
#include "mndSync.h"
#include "mndUser.h"
-#define TRANS_VER_NUMBER 1
+#define TRANS_VER1_NUMBER 1
+#define TRANS_VER2_NUMBER 2
#define TRANS_ARRAY_SIZE 8
#define TRANS_RESERVE_SIZE 48
-static SSdbRaw *mndTransActionEncode(STrans *pTrans);
-static SSdbRow *mndTransActionDecode(SSdbRaw *pRaw);
static int32_t mndTransActionInsert(SSdb *pSdb, STrans *pTrans);
static int32_t mndTransActionUpdate(SSdb *pSdb, STrans *OldTrans, STrans *pOld);
-static int32_t mndTransActionDelete(SSdb *pSdb, STrans *pTrans, bool callFunc);
+static int32_t mndTransDelete(SSdb *pSdb, STrans *pTrans, bool callFunc);
static int32_t mndTransAppendLog(SArray *pArray, SSdbRaw *pRaw);
static int32_t mndTransAppendAction(SArray *pArray, STransAction *pAction);
static void mndTransDropLogs(SArray *pArray);
static void mndTransDropActions(SArray *pArray);
-static void mndTransDropData(STrans *pTrans);
static int32_t mndTransExecuteActions(SMnode *pMnode, STrans *pTrans, SArray *pArray);
static int32_t mndTransExecuteRedoLogs(SMnode *pMnode, STrans *pTrans);
static int32_t mndTransExecuteUndoLogs(SMnode *pMnode, STrans *pTrans);
static int32_t mndTransExecuteRedoActions(SMnode *pMnode, STrans *pTrans);
static int32_t mndTransExecuteUndoActions(SMnode *pMnode, STrans *pTrans);
static int32_t mndTransExecuteCommitActions(SMnode *pMnode, STrans *pTrans);
-static bool mndTransPerformPrepareStage(SMnode *pMnode, STrans *pTrans);
static bool mndTransPerformRedoLogStage(SMnode *pMnode, STrans *pTrans);
static bool mndTransPerformRedoActionStage(SMnode *pMnode, STrans *pTrans);
static bool mndTransPerformUndoLogStage(SMnode *pMnode, STrans *pTrans);
@@ -52,7 +49,7 @@ static bool mndTransPerformUndoActionStage(SMnode *pMnode, STrans *pTrans);
static bool mndTransPerformCommitActionStage(SMnode *pMnode, STrans *pTrans);
static bool mndTransPerformCommitStage(SMnode *pMnode, STrans *pTrans);
static bool mndTransPerformRollbackStage(SMnode *pMnode, STrans *pTrans);
-static bool mndTransPerfromFinishedStage(SMnode *pMnode, STrans *pTrans);
+static bool mndTransPerformFinishStage(SMnode *pMnode, STrans *pTrans);
static bool mndCannotExecuteTransAction(SMnode *pMnode) { return !pMnode->deploy && !mndIsLeader(pMnode); }
static void mndTransSendRpcRsp(SMnode *pMnode, STrans *pTrans);
@@ -67,11 +64,11 @@ int32_t mndInitTrans(SMnode *pMnode) {
SSdbTable table = {
.sdbType = SDB_TRANS,
.keyType = SDB_KEY_INT32,
- .encodeFp = (SdbEncodeFp)mndTransActionEncode,
- .decodeFp = (SdbDecodeFp)mndTransActionDecode,
+ .encodeFp = (SdbEncodeFp)mndTransEncode,
+ .decodeFp = (SdbDecodeFp)mndTransDecode,
.insertFp = (SdbInsertFp)mndTransActionInsert,
.updateFp = (SdbUpdateFp)mndTransActionUpdate,
- .deleteFp = (SdbDeleteFp)mndTransActionDelete,
+ .deleteFp = (SdbDeleteFp)mndTransDelete,
};
mndSetMsgHandle(pMnode, TDMT_MND_TRANS_TIMER, mndProcessTransTimer);
@@ -103,15 +100,55 @@ static int32_t mndTransGetActionsSize(SArray *pArray) {
return rawDataLen;
}
-static SSdbRaw *mndTransActionEncode(STrans *pTrans) {
- terrno = TSDB_CODE_OUT_OF_MEMORY;
+
+static int32_t mndTransEncodeAction(SSdbRaw *pRaw, int32_t *offset, SArray *pActions, int32_t actionsNum) {
+ int32_t dataPos = *offset;
+ int8_t unused = 0;
+ int32_t ret = -1;
+
+ for (int32_t i = 0; i < actionsNum; ++i) {
+ STransAction *pAction = taosArrayGet(pActions, i);
+ SDB_SET_INT32(pRaw, dataPos, pAction->id, _OVER)
+ SDB_SET_INT32(pRaw, dataPos, pAction->errCode, _OVER)
+ SDB_SET_INT32(pRaw, dataPos, pAction->acceptableCode, _OVER)
+ SDB_SET_INT32(pRaw, dataPos, pAction->retryCode, _OVER)
+ SDB_SET_INT8(pRaw, dataPos, pAction->actionType, _OVER)
+ SDB_SET_INT8(pRaw, dataPos, pAction->stage, _OVER)
+ SDB_SET_INT8(pRaw, dataPos, pAction->reserved, _OVER)
+ if (pAction->actionType == TRANS_ACTION_RAW) {
+ int32_t len = sdbGetRawTotalSize(pAction->pRaw);
+ SDB_SET_INT8(pRaw, dataPos, unused /*pAction->rawWritten*/, _OVER)
+ SDB_SET_INT32(pRaw, dataPos, len, _OVER)
+ SDB_SET_BINARY(pRaw, dataPos, (void *)pAction->pRaw, len, _OVER)
+ } else if (pAction->actionType == TRANS_ACTION_MSG) {
+ SDB_SET_BINARY(pRaw, dataPos, (void *)&pAction->epSet, sizeof(SEpSet), _OVER)
+ SDB_SET_INT16(pRaw, dataPos, pAction->msgType, _OVER)
+ SDB_SET_INT8(pRaw, dataPos, unused /*pAction->msgSent*/, _OVER)
+ SDB_SET_INT8(pRaw, dataPos, unused /*pAction->msgReceived*/, _OVER)
+ SDB_SET_INT32(pRaw, dataPos, pAction->contLen, _OVER)
+ SDB_SET_BINARY(pRaw, dataPos, pAction->pCont, pAction->contLen, _OVER)
+ } else {
+ // nothing
+ }
+ }
+ ret = 0;
+
+_OVER:
+ *offset = dataPos;
+ return ret;
+}
+
+SSdbRaw *mndTransEncode(STrans *pTrans) {
+ terrno = TSDB_CODE_INVALID_MSG;
+ int8_t sver = taosArrayGetSize(pTrans->prepareActions) ? TRANS_VER2_NUMBER : TRANS_VER1_NUMBER;
int32_t rawDataLen = sizeof(STrans) + TRANS_RESERVE_SIZE + pTrans->paramLen;
+ rawDataLen += mndTransGetActionsSize(pTrans->prepareActions);
rawDataLen += mndTransGetActionsSize(pTrans->redoActions);
rawDataLen += mndTransGetActionsSize(pTrans->undoActions);
rawDataLen += mndTransGetActionsSize(pTrans->commitActions);
- SSdbRaw *pRaw = sdbAllocRaw(SDB_TRANS, TRANS_VER_NUMBER, rawDataLen);
+ SSdbRaw *pRaw = sdbAllocRaw(SDB_TRANS, sver, rawDataLen);
if (pRaw == NULL) {
mError("trans:%d, failed to alloc raw since %s", pTrans->id, terrstr());
return NULL;
@@ -131,91 +168,22 @@ static SSdbRaw *mndTransActionEncode(STrans *pTrans) {
SDB_SET_BINARY(pRaw, dataPos, pTrans->stbname, TSDB_TABLE_FNAME_LEN, _OVER)
SDB_SET_INT32(pRaw, dataPos, pTrans->redoActionPos, _OVER)
+ int32_t prepareActionNum = taosArrayGetSize(pTrans->prepareActions);
int32_t redoActionNum = taosArrayGetSize(pTrans->redoActions);
int32_t undoActionNum = taosArrayGetSize(pTrans->undoActions);
int32_t commitActionNum = taosArrayGetSize(pTrans->commitActions);
+
+ if (sver > TRANS_VER1_NUMBER) {
+ SDB_SET_INT32(pRaw, dataPos, prepareActionNum, _OVER)
+ }
SDB_SET_INT32(pRaw, dataPos, redoActionNum, _OVER)
SDB_SET_INT32(pRaw, dataPos, undoActionNum, _OVER)
SDB_SET_INT32(pRaw, dataPos, commitActionNum, _OVER)
- int8_t unused = 0;
- for (int32_t i = 0; i < redoActionNum; ++i) {
- STransAction *pAction = taosArrayGet(pTrans->redoActions, i);
- SDB_SET_INT32(pRaw, dataPos, pAction->id, _OVER)
- SDB_SET_INT32(pRaw, dataPos, pAction->errCode, _OVER)
- SDB_SET_INT32(pRaw, dataPos, pAction->acceptableCode, _OVER)
- SDB_SET_INT32(pRaw, dataPos, pAction->retryCode, _OVER)
- SDB_SET_INT8(pRaw, dataPos, pAction->actionType, _OVER)
- SDB_SET_INT8(pRaw, dataPos, pAction->stage, _OVER)
- SDB_SET_INT8(pRaw, dataPos, pAction->reserved, _OVER)
- if (pAction->actionType == TRANS_ACTION_RAW) {
- int32_t len = sdbGetRawTotalSize(pAction->pRaw);
- SDB_SET_INT8(pRaw, dataPos, unused /*pAction->rawWritten*/, _OVER)
- SDB_SET_INT32(pRaw, dataPos, len, _OVER)
- SDB_SET_BINARY(pRaw, dataPos, (void *)pAction->pRaw, len, _OVER)
- } else if (pAction->actionType == TRANS_ACTION_MSG) {
- SDB_SET_BINARY(pRaw, dataPos, (void *)&pAction->epSet, sizeof(SEpSet), _OVER)
- SDB_SET_INT16(pRaw, dataPos, pAction->msgType, _OVER)
- SDB_SET_INT8(pRaw, dataPos, unused /*pAction->msgSent*/, _OVER)
- SDB_SET_INT8(pRaw, dataPos, unused /*pAction->msgReceived*/, _OVER)
- SDB_SET_INT32(pRaw, dataPos, pAction->contLen, _OVER)
- SDB_SET_BINARY(pRaw, dataPos, pAction->pCont, pAction->contLen, _OVER)
- } else {
- // nothing
- }
- }
-
- for (int32_t i = 0; i < undoActionNum; ++i) {
- STransAction *pAction = taosArrayGet(pTrans->undoActions, i);
- SDB_SET_INT32(pRaw, dataPos, pAction->id, _OVER)
- SDB_SET_INT32(pRaw, dataPos, pAction->errCode, _OVER)
- SDB_SET_INT32(pRaw, dataPos, pAction->acceptableCode, _OVER)
- SDB_SET_INT32(pRaw, dataPos, pAction->retryCode, _OVER)
- SDB_SET_INT8(pRaw, dataPos, pAction->actionType, _OVER)
- SDB_SET_INT8(pRaw, dataPos, pAction->stage, _OVER)
- SDB_SET_INT8(pRaw, dataPos, pAction->reserved, _OVER)
- if (pAction->actionType == TRANS_ACTION_RAW) {
- int32_t len = sdbGetRawTotalSize(pAction->pRaw);
- SDB_SET_INT8(pRaw, dataPos, unused /*pAction->rawWritten*/, _OVER)
- SDB_SET_INT32(pRaw, dataPos, len, _OVER)
- SDB_SET_BINARY(pRaw, dataPos, (void *)pAction->pRaw, len, _OVER)
- } else if (pAction->actionType == TRANS_ACTION_MSG) {
- SDB_SET_BINARY(pRaw, dataPos, (void *)&pAction->epSet, sizeof(SEpSet), _OVER)
- SDB_SET_INT16(pRaw, dataPos, pAction->msgType, _OVER)
- SDB_SET_INT8(pRaw, dataPos, unused /*pAction->msgSent*/, _OVER)
- SDB_SET_INT8(pRaw, dataPos, unused /*pAction->msgReceived*/, _OVER)
- SDB_SET_INT32(pRaw, dataPos, pAction->contLen, _OVER)
- SDB_SET_BINARY(pRaw, dataPos, pAction->pCont, pAction->contLen, _OVER)
- } else {
- // nothing
- }
- }
-
- for (int32_t i = 0; i < commitActionNum; ++i) {
- STransAction *pAction = taosArrayGet(pTrans->commitActions, i);
- SDB_SET_INT32(pRaw, dataPos, pAction->id, _OVER)
- SDB_SET_INT32(pRaw, dataPos, pAction->errCode, _OVER)
- SDB_SET_INT32(pRaw, dataPos, pAction->acceptableCode, _OVER)
- SDB_SET_INT32(pRaw, dataPos, pAction->retryCode, _OVER)
- SDB_SET_INT8(pRaw, dataPos, pAction->actionType, _OVER)
- SDB_SET_INT8(pRaw, dataPos, pAction->stage, _OVER)
- SDB_SET_INT8(pRaw, dataPos, pAction->reserved, _OVER)
- if (pAction->actionType == TRANS_ACTION_RAW) {
- int32_t len = sdbGetRawTotalSize(pAction->pRaw);
- SDB_SET_INT8(pRaw, dataPos, unused /*pAction->rawWritten*/, _OVER)
- SDB_SET_INT32(pRaw, dataPos, len, _OVER)
- SDB_SET_BINARY(pRaw, dataPos, (void *)pAction->pRaw, len, _OVER)
- } else if (pAction->actionType == TRANS_ACTION_MSG) {
- SDB_SET_BINARY(pRaw, dataPos, (void *)&pAction->epSet, sizeof(SEpSet), _OVER)
- SDB_SET_INT16(pRaw, dataPos, pAction->msgType, _OVER)
- SDB_SET_INT8(pRaw, dataPos, unused /*pAction->msgSent*/, _OVER)
- SDB_SET_INT8(pRaw, dataPos, unused /*pAction->msgReceived*/, _OVER)
- SDB_SET_INT32(pRaw, dataPos, pAction->contLen, _OVER)
- SDB_SET_BINARY(pRaw, dataPos, pAction->pCont, pAction->contLen, _OVER)
- } else {
- // nothing
- }
- }
+ if (mndTransEncodeAction(pRaw, &dataPos, pTrans->prepareActions, prepareActionNum) < 0) goto _OVER;
+ if (mndTransEncodeAction(pRaw, &dataPos, pTrans->redoActions, redoActionNum) < 0) goto _OVER;
+ if (mndTransEncodeAction(pRaw, &dataPos, pTrans->undoActions, undoActionNum) < 0) goto _OVER;
+ if (mndTransEncodeAction(pRaw, &dataPos, pTrans->commitActions, commitActionNum) < 0) goto _OVER;
SDB_SET_INT32(pRaw, dataPos, pTrans->startFunc, _OVER)
SDB_SET_INT32(pRaw, dataPos, pTrans->stopFunc, _OVER)
@@ -242,23 +210,76 @@ _OVER:
return pRaw;
}
-static SSdbRow *mndTransActionDecode(SSdbRaw *pRaw) {
- terrno = TSDB_CODE_OUT_OF_MEMORY;
+static int32_t mndTransDecodeAction(SSdbRaw *pRaw, int32_t *offset, SArray *pActions, int32_t actionNum) {
+ STransAction action = {0};
+ int32_t dataPos = *offset;
+ int8_t unused = 0;
+ int8_t stage = 0;
+ int8_t actionType = 0;
+ int32_t dataLen = 0;
+ int32_t ret = -1;
+
+ for (int32_t i = 0; i < actionNum; ++i) {
+ memset(&action, 0, sizeof(action));
+ SDB_GET_INT32(pRaw, dataPos, &action.id, _OVER)
+ SDB_GET_INT32(pRaw, dataPos, &action.errCode, _OVER)
+ SDB_GET_INT32(pRaw, dataPos, &action.acceptableCode, _OVER)
+ SDB_GET_INT32(pRaw, dataPos, &action.retryCode, _OVER)
+ SDB_GET_INT8(pRaw, dataPos, &actionType, _OVER)
+ action.actionType = actionType;
+ SDB_GET_INT8(pRaw, dataPos, &stage, _OVER)
+ action.stage = stage;
+ SDB_GET_INT8(pRaw, dataPos, &action.reserved, _OVER)
+ if (action.actionType == TRANS_ACTION_RAW) {
+ SDB_GET_INT8(pRaw, dataPos, &unused /*&action.rawWritten*/, _OVER)
+ SDB_GET_INT32(pRaw, dataPos, &dataLen, _OVER)
+ action.pRaw = taosMemoryMalloc(dataLen);
+ if (action.pRaw == NULL) goto _OVER;
+ mTrace("raw:%p, is created", action.pRaw);
+ SDB_GET_BINARY(pRaw, dataPos, (void *)action.pRaw, dataLen, _OVER);
+ if (taosArrayPush(pActions, &action) == NULL) goto _OVER;
+ action.pRaw = NULL;
+ } else if (action.actionType == TRANS_ACTION_MSG) {
+ SDB_GET_BINARY(pRaw, dataPos, (void *)&action.epSet, sizeof(SEpSet), _OVER);
+ tmsgUpdateDnodeEpSet(&action.epSet);
+ SDB_GET_INT16(pRaw, dataPos, &action.msgType, _OVER)
+ SDB_GET_INT8(pRaw, dataPos, &unused /*&action.msgSent*/, _OVER)
+ SDB_GET_INT8(pRaw, dataPos, &unused /*&action.msgReceived*/, _OVER)
+ SDB_GET_INT32(pRaw, dataPos, &action.contLen, _OVER)
+ action.pCont = taosMemoryMalloc(action.contLen);
+ if (action.pCont == NULL) goto _OVER;
+ SDB_GET_BINARY(pRaw, dataPos, action.pCont, action.contLen, _OVER);
+ if (taosArrayPush(pActions, &action) == NULL) goto _OVER;
+ action.pCont = NULL;
+ } else {
+ if (taosArrayPush(pActions, &action) == NULL) goto _OVER;
+ }
+ }
+ ret = 0;
+
+_OVER:
+ *offset = dataPos;
+ taosMemoryFreeClear(action.pCont);
+ return ret;
+}
+
+SSdbRow *mndTransDecode(SSdbRaw *pRaw) {
+ terrno = TSDB_CODE_INVALID_MSG;
SSdbRow *pRow = NULL;
STrans *pTrans = NULL;
char *pData = NULL;
int32_t dataLen = 0;
int8_t sver = 0;
+ int32_t prepareActionNum = 0;
int32_t redoActionNum = 0;
int32_t undoActionNum = 0;
int32_t commitActionNum = 0;
int32_t dataPos = 0;
- STransAction action = {0};
if (sdbGetRawSoftVer(pRaw, &sver) != 0) goto _OVER;
- if (sver != TRANS_VER_NUMBER) {
+ if (sver != TRANS_VER1_NUMBER && sver != TRANS_VER2_NUMBER) {
terrno = TSDB_CODE_SDB_INVALID_DATA_VER;
goto _OVER;
}
@@ -294,127 +315,28 @@ static SSdbRow *mndTransActionDecode(SSdbRaw *pRaw) {
SDB_GET_BINARY(pRaw, dataPos, pTrans->dbname, TSDB_TABLE_FNAME_LEN, _OVER)
SDB_GET_BINARY(pRaw, dataPos, pTrans->stbname, TSDB_TABLE_FNAME_LEN, _OVER)
SDB_GET_INT32(pRaw, dataPos, &pTrans->redoActionPos, _OVER)
+
+ if (sver > TRANS_VER1_NUMBER) {
+ SDB_GET_INT32(pRaw, dataPos, &prepareActionNum, _OVER)
+ }
SDB_GET_INT32(pRaw, dataPos, &redoActionNum, _OVER)
SDB_GET_INT32(pRaw, dataPos, &undoActionNum, _OVER)
SDB_GET_INT32(pRaw, dataPos, &commitActionNum, _OVER)
+ pTrans->prepareActions = taosArrayInit(prepareActionNum, sizeof(STransAction));
pTrans->redoActions = taosArrayInit(redoActionNum, sizeof(STransAction));
pTrans->undoActions = taosArrayInit(undoActionNum, sizeof(STransAction));
pTrans->commitActions = taosArrayInit(commitActionNum, sizeof(STransAction));
+ if (pTrans->prepareActions == NULL) goto _OVER;
if (pTrans->redoActions == NULL) goto _OVER;
if (pTrans->undoActions == NULL) goto _OVER;
if (pTrans->commitActions == NULL) goto _OVER;
- int8_t unused = 0;
- for (int32_t i = 0; i < redoActionNum; ++i) {
- memset(&action, 0, sizeof(action));
- SDB_GET_INT32(pRaw, dataPos, &action.id, _OVER)
- SDB_GET_INT32(pRaw, dataPos, &action.errCode, _OVER)
- SDB_GET_INT32(pRaw, dataPos, &action.acceptableCode, _OVER)
- SDB_GET_INT32(pRaw, dataPos, &action.retryCode, _OVER)
- SDB_GET_INT8(pRaw, dataPos, &actionType, _OVER)
- action.actionType = actionType;
- SDB_GET_INT8(pRaw, dataPos, &stage, _OVER)
- action.stage = stage;
- SDB_GET_INT8(pRaw, dataPos, &action.reserved, _OVER)
- if (action.actionType == TRANS_ACTION_RAW) {
- SDB_GET_INT8(pRaw, dataPos, &unused /*&action.rawWritten*/, _OVER)
- SDB_GET_INT32(pRaw, dataPos, &dataLen, _OVER)
- action.pRaw = taosMemoryMalloc(dataLen);
- if (action.pRaw == NULL) goto _OVER;
- mTrace("raw:%p, is created", action.pRaw);
- SDB_GET_BINARY(pRaw, dataPos, (void *)action.pRaw, dataLen, _OVER);
- if (taosArrayPush(pTrans->redoActions, &action) == NULL) goto _OVER;
- action.pRaw = NULL;
- } else if (action.actionType == TRANS_ACTION_MSG) {
- SDB_GET_BINARY(pRaw, dataPos, (void *)&action.epSet, sizeof(SEpSet), _OVER);
- tmsgUpdateDnodeEpSet(&action.epSet);
- SDB_GET_INT16(pRaw, dataPos, &action.msgType, _OVER)
- SDB_GET_INT8(pRaw, dataPos, &unused /*&action.msgSent*/, _OVER)
- SDB_GET_INT8(pRaw, dataPos, &unused /*&action.msgReceived*/, _OVER)
- SDB_GET_INT32(pRaw, dataPos, &action.contLen, _OVER)
- action.pCont = taosMemoryMalloc(action.contLen);
- if (action.pCont == NULL) goto _OVER;
- SDB_GET_BINARY(pRaw, dataPos, action.pCont, action.contLen, _OVER);
- if (taosArrayPush(pTrans->redoActions, &action) == NULL) goto _OVER;
- action.pCont = NULL;
- } else {
- if (taosArrayPush(pTrans->redoActions, &action) == NULL) goto _OVER;
- }
- }
-
- for (int32_t i = 0; i < undoActionNum; ++i) {
- memset(&action, 0, sizeof(action));
- SDB_GET_INT32(pRaw, dataPos, &action.id, _OVER)
- SDB_GET_INT32(pRaw, dataPos, &action.errCode, _OVER)
- SDB_GET_INT32(pRaw, dataPos, &action.acceptableCode, _OVER)
- SDB_GET_INT32(pRaw, dataPos, &action.retryCode, _OVER)
- SDB_GET_INT8(pRaw, dataPos, &actionType, _OVER)
- action.actionType = actionType;
- SDB_GET_INT8(pRaw, dataPos, &stage, _OVER)
- action.stage = stage;
- SDB_GET_INT8(pRaw, dataPos, &action.reserved, _OVER)
- if (action.actionType == TRANS_ACTION_RAW) {
- SDB_GET_INT8(pRaw, dataPos, &unused /*&action.rawWritten*/, _OVER)
- SDB_GET_INT32(pRaw, dataPos, &dataLen, _OVER)
- action.pRaw = taosMemoryMalloc(dataLen);
- if (action.pRaw == NULL) goto _OVER;
- mTrace("raw:%p, is created", action.pRaw);
- SDB_GET_BINARY(pRaw, dataPos, (void *)action.pRaw, dataLen, _OVER);
- if (taosArrayPush(pTrans->undoActions, &action) == NULL) goto _OVER;
- action.pRaw = NULL;
- } else if (action.actionType == TRANS_ACTION_MSG) {
- SDB_GET_BINARY(pRaw, dataPos, (void *)&action.epSet, sizeof(SEpSet), _OVER);
- SDB_GET_INT16(pRaw, dataPos, &action.msgType, _OVER)
- SDB_GET_INT8(pRaw, dataPos, &unused /*&action.msgSent*/, _OVER)
- SDB_GET_INT8(pRaw, dataPos, &unused /*&action.msgReceived*/, _OVER)
- SDB_GET_INT32(pRaw, dataPos, &action.contLen, _OVER)
- action.pCont = taosMemoryMalloc(action.contLen);
- if (action.pCont == NULL) goto _OVER;
- SDB_GET_BINARY(pRaw, dataPos, action.pCont, action.contLen, _OVER);
- if (taosArrayPush(pTrans->undoActions, &action) == NULL) goto _OVER;
- action.pCont = NULL;
- } else {
- if (taosArrayPush(pTrans->undoActions, &action) == NULL) goto _OVER;
- }
- }
-
- for (int32_t i = 0; i < commitActionNum; ++i) {
- memset(&action, 0, sizeof(action));
- SDB_GET_INT32(pRaw, dataPos, &action.id, _OVER)
- SDB_GET_INT32(pRaw, dataPos, &action.errCode, _OVER)
- SDB_GET_INT32(pRaw, dataPos, &action.acceptableCode, _OVER)
- SDB_GET_INT32(pRaw, dataPos, &action.retryCode, _OVER)
- SDB_GET_INT8(pRaw, dataPos, &actionType, _OVER)
- action.actionType = actionType;
- SDB_GET_INT8(pRaw, dataPos, &stage, _OVER)
- action.stage = stage;
- SDB_GET_INT8(pRaw, dataPos, &action.reserved, _OVER)
- if (action.actionType) {
- SDB_GET_INT8(pRaw, dataPos, &unused /*&action.rawWritten*/, _OVER)
- SDB_GET_INT32(pRaw, dataPos, &dataLen, _OVER)
- action.pRaw = taosMemoryMalloc(dataLen);
- if (action.pRaw == NULL) goto _OVER;
- mTrace("raw:%p, is created", action.pRaw);
- SDB_GET_BINARY(pRaw, dataPos, (void *)action.pRaw, dataLen, _OVER);
- if (taosArrayPush(pTrans->commitActions, &action) == NULL) goto _OVER;
- action.pRaw = NULL;
- } else if (action.actionType == TRANS_ACTION_MSG) {
- SDB_GET_BINARY(pRaw, dataPos, (void *)&action.epSet, sizeof(SEpSet), _OVER);
- SDB_GET_INT16(pRaw, dataPos, &action.msgType, _OVER)
- SDB_GET_INT8(pRaw, dataPos, &unused /*&action.msgSent*/, _OVER)
- SDB_GET_INT8(pRaw, dataPos, &unused /*&action.msgReceived*/, _OVER)
- SDB_GET_INT32(pRaw, dataPos, &action.contLen, _OVER)
- action.pCont = taosMemoryMalloc(action.contLen);
- if (action.pCont == NULL) goto _OVER;
- SDB_GET_BINARY(pRaw, dataPos, action.pCont, action.contLen, _OVER);
- if (taosArrayPush(pTrans->commitActions, &action) == NULL) goto _OVER;
- action.pCont = NULL;
- } else {
- if (taosArrayPush(pTrans->redoActions, &action) == NULL) goto _OVER;
- }
- }
+ if (mndTransDecodeAction(pRaw, &dataPos, pTrans->prepareActions, prepareActionNum) < 0) goto _OVER;
+ if (mndTransDecodeAction(pRaw, &dataPos, pTrans->redoActions, redoActionNum) < 0) goto _OVER;
+ if (mndTransDecodeAction(pRaw, &dataPos, pTrans->undoActions, undoActionNum) < 0) goto _OVER;
+ if (mndTransDecodeAction(pRaw, &dataPos, pTrans->commitActions, commitActionNum) < 0) goto _OVER;
SDB_GET_INT32(pRaw, dataPos, &pTrans->startFunc, _OVER)
SDB_GET_INT32(pRaw, dataPos, &pTrans->stopFunc, _OVER)
@@ -434,7 +356,6 @@ _OVER:
mError("trans:%d, failed to parse from raw:%p since %s", pTrans->id, pRaw, terrstr());
mndTransDropData(pTrans);
taosMemoryFreeClear(pRow);
- taosMemoryFreeClear(action.pCont);
return NULL;
}
@@ -458,7 +379,7 @@ static const char *mndTransStr(ETrnStage stage) {
return "commit";
case TRN_STAGE_COMMIT_ACTION:
return "commitAction";
- case TRN_STAGE_FINISHED:
+ case TRN_STAGE_FINISH:
return "finished";
case TRN_STAGE_PRE_FINISH:
return "pre-finish";
@@ -519,7 +440,11 @@ static int32_t mndTransActionInsert(SSdb *pSdb, STrans *pTrans) {
return 0;
}
-static void mndTransDropData(STrans *pTrans) {
+void mndTransDropData(STrans *pTrans) {
+ if (pTrans->prepareActions != NULL) {
+ mndTransDropActions(pTrans->prepareActions);
+ pTrans->prepareActions = NULL;
+ }
if (pTrans->redoActions != NULL) {
mndTransDropActions(pTrans->redoActions);
pTrans->redoActions = NULL;
@@ -549,7 +474,7 @@ static void mndTransDropData(STrans *pTrans) {
(void)taosThreadMutexDestroy(&pTrans->mutex);
}
-static int32_t mndTransActionDelete(SSdb *pSdb, STrans *pTrans, bool callFunc) {
+static int32_t mndTransDelete(SSdb *pSdb, STrans *pTrans, bool callFunc) {
mInfo("trans:%d, perform delete action, row:%p stage:%s callfunc:%d, stopFunc:%d", pTrans->id, pTrans,
mndTransStr(pTrans->stage), callFunc, pTrans->stopFunc);
@@ -586,10 +511,11 @@ static int32_t mndTransActionUpdate(SSdb *pSdb, STrans *pOld, STrans *pNew) {
pOld->id, pOld, mndTransStr(pOld->stage), pOld->createdTime, pNew, mndTransStr(pNew->stage),
pNew->createdTime);
// only occured while sync timeout
- terrno = TSDB_CODE_MND_TRNAS_SYNC_TIMEOUT;
+ terrno = TSDB_CODE_MND_TRANS_SYNC_TIMEOUT;
return -1;
}
+ mndTransUpdateActions(pOld->prepareActions, pNew->prepareActions);
mndTransUpdateActions(pOld->redoActions, pNew->redoActions);
mndTransUpdateActions(pOld->undoActions, pNew->undoActions);
mndTransUpdateActions(pOld->commitActions, pNew->commitActions);
@@ -607,7 +533,7 @@ static int32_t mndTransActionUpdate(SSdb *pSdb, STrans *pOld, STrans *pNew) {
}
if (pOld->stage == TRN_STAGE_PRE_FINISH) {
- pOld->stage = TRN_STAGE_FINISHED;
+ pOld->stage = TRN_STAGE_FINISH;
mTrace("trans:%d, stage from pre-finish to finished since perform update action", pNew->id);
}
@@ -646,6 +572,7 @@ STrans *mndTransCreate(SMnode *pMnode, ETrnPolicy policy, ETrnConflct conflict,
pTrans->conflict = conflict;
pTrans->exec = TRN_EXEC_PARALLEL;
pTrans->createdTime = taosGetTimestampMs();
+ pTrans->prepareActions = taosArrayInit(TRANS_ARRAY_SIZE, sizeof(STransAction));
pTrans->redoActions = taosArrayInit(TRANS_ARRAY_SIZE, sizeof(STransAction));
pTrans->undoActions = taosArrayInit(TRANS_ARRAY_SIZE, sizeof(STransAction));
pTrans->commitActions = taosArrayInit(TRANS_ARRAY_SIZE, sizeof(STransAction));
@@ -728,6 +655,13 @@ int32_t mndTransAppendCommitlog(STrans *pTrans, SSdbRaw *pRaw) {
return mndTransAppendAction(pTrans->commitActions, &action);
}
+int32_t mndTransAppendPrepareAction(STrans *pTrans, STransAction *pAction) {
+ pAction->stage = TRN_STAGE_PREPARE;
+ pAction->actionType = TRANS_ACTION_RAW;
+ pAction->mTraceId = pTrans->mTraceId;
+ return mndTransAppendAction(pTrans->prepareActions, pAction);
+}
+
int32_t mndTransAppendRedoAction(STrans *pTrans, STransAction *pAction) {
pAction->stage = TRN_STAGE_REDO_ACTION;
pAction->actionType = TRANS_ACTION_MSG;
@@ -800,7 +734,7 @@ void mndTransSetParallel(STrans *pTrans) { pTrans->exec = TRN_EXEC_PARALLEL; }
void mndTransSetOper(STrans *pTrans, EOperType oper) { pTrans->oper = oper; }
static int32_t mndTransSync(SMnode *pMnode, STrans *pTrans) {
- SSdbRaw *pRaw = mndTransActionEncode(pTrans);
+ SSdbRaw *pRaw = mndTransEncode(pTrans);
if (pRaw == NULL) {
mError("trans:%d, failed to encode while sync trans since %s", pTrans->id, terrstr());
return -1;
@@ -872,7 +806,7 @@ static bool mndCheckTransConflict(SMnode *pMnode, STrans *pNew) {
return conflict;
}
-int32_t mndTrancCheckConflict(SMnode *pMnode, STrans *pTrans) {
+int32_t mndTransCheckConflict(SMnode *pMnode, STrans *pTrans) {
if (pTrans->conflict == TRN_CONFLICT_DB || pTrans->conflict == TRN_CONFLICT_DB_INSIDE) {
if (strlen(pTrans->dbname) == 0 && strlen(pTrans->stbname) == 0) {
terrno = TSDB_CODE_MND_TRANS_CONFLICT;
@@ -891,7 +825,7 @@ int32_t mndTrancCheckConflict(SMnode *pMnode, STrans *pTrans) {
}
int32_t mndTransPrepare(SMnode *pMnode, STrans *pTrans) {
- if (mndTrancCheckConflict(pMnode, pTrans) != 0) {
+ if (mndTransCheckConflict(pMnode, pTrans) != 0) {
return -1;
}
@@ -922,7 +856,7 @@ int32_t mndTransPrepare(SMnode *pMnode, STrans *pTrans) {
pTrans->rpcRsp = NULL;
pTrans->rpcRspLen = 0;
- mndTransExecute(pMnode, pNew, true);
+ mndTransExecute(pMnode, pNew);
mndReleaseTrans(pMnode, pNew);
return 0;
}
@@ -961,7 +895,7 @@ static void mndTransSendRpcRsp(SMnode *pMnode, STrans *pTrans) {
bool sendRsp = false;
int32_t code = pTrans->code;
- if (pTrans->stage == TRN_STAGE_FINISHED) {
+ if (pTrans->stage == TRN_STAGE_FINISH) {
sendRsp = true;
}
@@ -1003,7 +937,7 @@ static void mndTransSendRpcRsp(SMnode *pMnode, STrans *pTrans) {
code = TSDB_CODE_MND_TRANS_NETWORK_UNAVAILL;
}
if (code == TSDB_CODE_SYN_TIMEOUT) {
- code = TSDB_CODE_MND_TRNAS_SYNC_TIMEOUT;
+ code = TSDB_CODE_MND_TRANS_SYNC_TIMEOUT;
}
if (i != 0 && code == 0) {
@@ -1104,7 +1038,7 @@ int32_t mndTransProcessRsp(SRpcMsg *pRsp) {
mInfo("trans:%d, invalid action, index:%d, code:0x%x", transId, action, pRsp->code);
}
- mndTransExecute(pMnode, pTrans, true);
+ mndTransExecute(pMnode, pTrans);
_OVER:
mndReleaseTrans(pMnode, pTrans);
@@ -1392,8 +1326,25 @@ static int32_t mndTransExecuteRedoActionsSerial(SMnode *pMnode, STrans *pTrans)
return code;
}
-static bool mndTransPerformPrepareStage(SMnode *pMnode, STrans *pTrans) {
+bool mndTransPerformPrepareStage(SMnode *pMnode, STrans *pTrans) {
bool continueExec = true;
+ int32_t code = 0;
+
+ int32_t numOfActions = taosArrayGetSize(pTrans->prepareActions);
+ if (numOfActions == 0) goto _OVER;
+
+ mInfo("trans:%d, execute %d prepare actions.", pTrans->id, numOfActions);
+
+ for (int32_t action = 0; action < numOfActions; ++action) {
+ STransAction *pAction = taosArrayGet(pTrans->prepareActions, action);
+ code = mndTransExecSingleAction(pMnode, pTrans, pAction);
+ if (code != 0) {
+ mError("trans:%d, failed to execute prepare action:%d, numOfActions:%d", pTrans->id, action, numOfActions);
+ return false;
+ }
+ }
+
+_OVER:
pTrans->stage = TRN_STAGE_REDO_ACTION;
mInfo("trans:%d, stage from prepare to redoAction", pTrans->id);
return continueExec;
@@ -1476,7 +1427,7 @@ static bool mndTransPerformCommitActionStage(SMnode *pMnode, STrans *pTrans) {
if (code == 0) {
pTrans->code = 0;
- pTrans->stage = TRN_STAGE_FINISHED; // TRN_STAGE_PRE_FINISH is not necessary
+ pTrans->stage = TRN_STAGE_FINISH; // TRN_STAGE_PRE_FINISH is not necessary
mInfo("trans:%d, stage from commitAction to finished", pTrans->id);
continueExec = true;
} else {
@@ -1528,14 +1479,14 @@ static bool mndTransPerformRollbackStage(SMnode *pMnode, STrans *pTrans) {
return continueExec;
}
-static bool mndTransPerfromPreFinishedStage(SMnode *pMnode, STrans *pTrans) {
+static bool mndTransPerformPreFinishStage(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;
+ pTrans->stage = TRN_STAGE_FINISH;
mInfo("trans:%d, stage from pre-finish to finish", pTrans->id);
continueExec = true;
} else {
@@ -1547,10 +1498,10 @@ static bool mndTransPerfromPreFinishedStage(SMnode *pMnode, STrans *pTrans) {
return continueExec;
}
-static bool mndTransPerfromFinishedStage(SMnode *pMnode, STrans *pTrans) {
+static bool mndTransPerformFinishStage(SMnode *pMnode, STrans *pTrans) {
bool continueExec = false;
- SSdbRaw *pRaw = mndTransActionEncode(pTrans);
+ SSdbRaw *pRaw = mndTransEncode(pTrans);
if (pRaw == NULL) {
mError("trans:%d, failed to encode while finish trans since %s", pTrans->id, terrstr());
return false;
@@ -1567,12 +1518,12 @@ static bool mndTransPerfromFinishedStage(SMnode *pMnode, STrans *pTrans) {
return continueExec;
}
-void mndTransExecute(SMnode *pMnode, STrans *pTrans, bool isLeader) {
+void mndTransExecuteImp(SMnode *pMnode, STrans *pTrans, bool topHalf) {
bool continueExec = true;
while (continueExec) {
- mInfo("trans:%d, continue to execute, stage:%s createTime:%" PRId64 " leader:%d", pTrans->id,
- mndTransStr(pTrans->stage), pTrans->createdTime, isLeader);
+ mInfo("trans:%d, continue to execute, stage:%s createTime:%" PRId64 " topHalf:%d", pTrans->id,
+ mndTransStr(pTrans->stage), pTrans->createdTime, topHalf);
pTrans->lastExecTime = taosGetTimestampMs();
switch (pTrans->stage) {
case TRN_STAGE_PREPARE:
@@ -1582,7 +1533,7 @@ void mndTransExecute(SMnode *pMnode, STrans *pTrans, bool isLeader) {
continueExec = mndTransPerformRedoActionStage(pMnode, pTrans);
break;
case TRN_STAGE_COMMIT:
- if (isLeader) {
+ if (topHalf) {
continueExec = mndTransPerformCommitStage(pMnode, pTrans);
} else {
mInfo("trans:%d, can not commit since not leader", pTrans->id);
@@ -1593,7 +1544,7 @@ void mndTransExecute(SMnode *pMnode, STrans *pTrans, bool isLeader) {
continueExec = mndTransPerformCommitActionStage(pMnode, pTrans);
break;
case TRN_STAGE_ROLLBACK:
- if (isLeader) {
+ if (topHalf) {
continueExec = mndTransPerformRollbackStage(pMnode, pTrans);
} else {
mInfo("trans:%d, can not rollback since not leader", pTrans->id);
@@ -1604,15 +1555,15 @@ void mndTransExecute(SMnode *pMnode, STrans *pTrans, bool isLeader) {
continueExec = mndTransPerformUndoActionStage(pMnode, pTrans);
break;
case TRN_STAGE_PRE_FINISH:
- if (isLeader) {
- continueExec = mndTransPerfromPreFinishedStage(pMnode, pTrans);
+ if (topHalf) {
+ continueExec = mndTransPerformPreFinishStage(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);
+ case TRN_STAGE_FINISH:
+ continueExec = mndTransPerformFinishStage(pMnode, pTrans);
break;
default:
continueExec = false;
@@ -1623,6 +1574,16 @@ void mndTransExecute(SMnode *pMnode, STrans *pTrans, bool isLeader) {
mndTransSendRpcRsp(pMnode, pTrans);
}
+void mndTransExecute(SMnode *pMnode, STrans *pTrans) {
+ bool topHalf = true;
+ return mndTransExecuteImp(pMnode, pTrans, topHalf);
+}
+
+void mndTransRefresh(SMnode *pMnode, STrans *pTrans) {
+ bool topHalf = false;
+ return mndTransExecuteImp(pMnode, pTrans, topHalf);
+}
+
static int32_t mndProcessTransTimer(SRpcMsg *pReq) {
mTrace("start to process trans timer");
mndTransPullup(pReq->info.node);
@@ -1649,7 +1610,7 @@ int32_t mndKillTrans(SMnode *pMnode, STrans *pTrans) {
pAction->errCode = 0;
}
- mndTransExecute(pMnode, pTrans, true);
+ mndTransExecute(pMnode, pTrans);
return 0;
}
@@ -1707,7 +1668,7 @@ void mndTransPullup(SMnode *pMnode) {
int32_t *pTransId = taosArrayGet(pArray, i);
STrans *pTrans = mndAcquireTrans(pMnode, *pTransId);
if (pTrans != NULL) {
- mndTransExecute(pMnode, pTrans, true);
+ mndTransExecute(pMnode, pTrans);
}
mndReleaseTrans(pMnode, pTrans);
}
diff --git a/source/dnode/mnode/impl/src/mndUser.c b/source/dnode/mnode/impl/src/mndUser.c
index 3da594109a..90d16a0a81 100644
--- a/source/dnode/mnode/impl/src/mndUser.c
+++ b/source/dnode/mnode/impl/src/mndUser.c
@@ -488,7 +488,7 @@ SHashObj *mndDupUseDbHash(SHashObj *pOld) {
return pNew;
}
-static int32_t mndUserDupObj(SUserObj *pUser, SUserObj *pNew) {
+int32_t mndUserDupObj(SUserObj *pUser, SUserObj *pNew) {
memcpy(pNew, pUser, sizeof(SUserObj));
pNew->authVersion++;
pNew->updateTime = taosGetTimestampMs();
@@ -508,7 +508,7 @@ static int32_t mndUserDupObj(SUserObj *pUser, SUserObj *pNew) {
return 0;
}
-static void mndUserFreeObj(SUserObj *pUser) {
+void mndUserFreeObj(SUserObj *pUser) {
taosHashCleanup(pUser->readDbs);
taosHashCleanup(pUser->writeDbs);
taosHashCleanup(pUser->topics);
diff --git a/source/dnode/mnode/impl/src/mndVgroup.c b/source/dnode/mnode/impl/src/mndVgroup.c
index b7a6378bd8..36e8755a3e 100644
--- a/source/dnode/mnode/impl/src/mndVgroup.c
+++ b/source/dnode/mnode/impl/src/mndVgroup.c
@@ -28,7 +28,6 @@
#define VGROUP_VER_NUMBER 1
#define VGROUP_RESERVE_SIZE 64
-static SSdbRow *mndVgroupActionDecode(SSdbRaw *pRaw);
static int32_t mndVgroupActionInsert(SSdb *pSdb, SVgObj *pVgroup);
static int32_t mndVgroupActionDelete(SSdb *pSdb, SVgObj *pVgroup);
static int32_t mndVgroupActionUpdate(SSdb *pSdb, SVgObj *pOld, SVgObj *pNew);
@@ -483,15 +482,15 @@ static void *mndBuildDisableVnodeWriteReq(SMnode *pMnode, SDbObj *pDb, int32_t v
return pReq;
}
-static void *mndBuildAlterVnodeHashRangeReq(SMnode *pMnode, SVgObj *pVgroup, int32_t dstVgId, int32_t *pContLen) {
+static void *mndBuildAlterVnodeHashRangeReq(SMnode *pMnode, int32_t srcVgId, SVgObj *pVgroup, int32_t *pContLen) {
SAlterVnodeHashRangeReq alterReq = {
- .srcVgId = pVgroup->vgId,
- .dstVgId = dstVgId,
+ .srcVgId = srcVgId,
+ .dstVgId = pVgroup->vgId,
.hashBegin = pVgroup->hashBegin,
.hashEnd = pVgroup->hashEnd,
};
- mInfo("vgId:%d, build alter vnode hashrange req, dstVgId:%d, hashrange:[%u, %u]", pVgroup->vgId, dstVgId,
+ mInfo("vgId:%d, build alter vnode hashrange req, dstVgId:%d, hashrange:[%u, %u]", srcVgId, pVgroup->vgId,
pVgroup->hashBegin, pVgroup->hashEnd);
int32_t contLen = tSerializeSAlterVnodeHashRangeReq(NULL, 0, &alterReq);
if (contLen < 0) {
@@ -1207,12 +1206,12 @@ int32_t mndAddAlterVnodeConfirmAction(SMnode *pMnode, STrans *pTrans, SDbObj *pD
return 0;
}
-static int32_t mndAddAlterVnodeHashRangeAction(SMnode *pMnode, STrans *pTrans, SVgObj *pVgroup, int32_t dstVgId) {
+static int32_t mndAddAlterVnodeHashRangeAction(SMnode *pMnode, STrans *pTrans, int32_t srcVgId, SVgObj *pVgroup) {
STransAction action = {0};
action.epSet = mndGetVgroupEpset(pMnode, pVgroup);
int32_t contLen = 0;
- void *pReq = mndBuildAlterVnodeHashRangeReq(pMnode, pVgroup, dstVgId, &contLen);
+ void *pReq = mndBuildAlterVnodeHashRangeReq(pMnode, srcVgId, pVgroup, &contLen);
if (pReq == NULL) return -1;
action.pCont = pReq;
@@ -1247,6 +1246,21 @@ int32_t mndAddAlterVnodeConfigAction(SMnode *pMnode, STrans *pTrans, SDbObj *pDb
return 0;
}
+int32_t mndAddPrepareNewVgAction(SMnode *pMnode, STrans *pTrans, SVgObj *pVg) {
+ SSdbRaw *pRaw = mndVgroupActionEncode(pVg);
+ if (pRaw == NULL) goto _err;
+
+ STransAction action = {.pRaw = pRaw, .msgType = TDMT_MND_CREATE_VG};
+ if (mndTransAppendPrepareAction(pTrans, &action) != 0) goto _err;
+ (void)sdbSetRawStatus(pRaw, SDB_STATUS_CREATING);
+ pRaw = NULL;
+ return 0;
+
+_err:
+ sdbFreeRaw(pRaw);
+ return -1;
+}
+
int32_t mndAddAlterVnodeReplicaAction(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SVgObj *pVgroup, int32_t dnodeId) {
SDnodeObj *pDnode = mndAcquireDnode(pMnode, dnodeId);
if (pDnode == NULL) return -1;
@@ -2241,10 +2255,13 @@ static int32_t mndAddAdjustVnodeHashRangeAction(SMnode *pMnode, STrans *pTrans,
return 0;
}
-static int32_t mndTransCommitVgStatus(STrans *pTrans, SVgObj *pVg, ESdbStatus vgStatus) {
+typedef int32_t (*FpTransActionCb)(STrans *pTrans, SSdbRaw *pRaw);
+
+static int32_t mndAddVgStatusAction(STrans *pTrans, SVgObj *pVg, ESdbStatus vgStatus, ETrnStage stage) {
+ FpTransActionCb appendActionCb = (stage == TRN_STAGE_COMMIT_ACTION) ? mndTransAppendCommitlog : mndTransAppendRedolog;
SSdbRaw *pRaw = mndVgroupActionEncode(pVg);
if (pRaw == NULL) goto _err;
- if (mndTransAppendCommitlog(pTrans, pRaw) != 0) goto _err;
+ if (appendActionCb(pTrans, pRaw) != 0) goto _err;
(void)sdbSetRawStatus(pRaw, vgStatus);
pRaw = NULL;
return 0;
@@ -2253,18 +2270,32 @@ _err:
return -1;
}
+static int32_t mndAddDbStatusAction(STrans *pTrans, SDbObj *pDb, ESdbStatus dbStatus, ETrnStage stage) {
+ FpTransActionCb appendActionCb = (stage == TRN_STAGE_COMMIT_ACTION) ? mndTransAppendCommitlog : mndTransAppendRedolog;
+ SSdbRaw *pRaw = mndDbActionEncode(pDb);
+ if (pRaw == NULL) goto _err;
+ if (appendActionCb(pTrans, pRaw) != 0) goto _err;
+ (void)sdbSetRawStatus(pRaw, dbStatus);
+ pRaw = NULL;
+ return 0;
+_err:
+ sdbFreeRaw(pRaw);
+ return -1;
+}
+
int32_t mndSplitVgroup(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SVgObj *pVgroup) {
int32_t code = -1;
STrans *pTrans = NULL;
- SSdbRaw *pRaw = NULL;
SDbObj dbObj = {0};
SArray *pArray = mndBuildDnodesArray(pMnode, 0);
- pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_GLOBAL, pReq, "split-vgroup");
+ pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_DB, pReq, "split-vgroup");
if (pTrans == NULL) goto _OVER;
mndTransSetSerial(pTrans);
mInfo("trans:%d, used to split vgroup, vgId:%d", pTrans->id, pVgroup->vgId);
+ mndTransSetDbName(pTrans, pDb->name, NULL);
+
SVgObj newVg1 = {0};
memcpy(&newVg1, pVgroup, sizeof(SVgObj));
mInfo("vgId:%d, vgroup info before split, replica:%d hashBegin:%u hashEnd:%u", newVg1.vgId, newVg1.replica,
@@ -2316,32 +2347,25 @@ int32_t mndSplitVgroup(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SVgObj *pVgro
// alter vgId and hash range
int32_t maxVgId = sdbGetMaxId(pMnode->pSdb, SDB_VGROUP);
- if (mndAddAlterVnodeHashRangeAction(pMnode, pTrans, &newVg1, maxVgId) != 0) goto _OVER;
+ int32_t srcVgId = newVg1.vgId;
newVg1.vgId = maxVgId;
+ if (mndAddPrepareNewVgAction(pMnode, pTrans, &newVg1) != 0) goto _OVER;
+ if (mndAddAlterVnodeHashRangeAction(pMnode, pTrans, srcVgId, &newVg1) != 0) goto _OVER;
maxVgId++;
- if (mndAddAlterVnodeHashRangeAction(pMnode, pTrans, &newVg2, maxVgId) != 0) goto _OVER;
+ srcVgId = newVg2.vgId;
newVg2.vgId = maxVgId;
+ if (mndAddPrepareNewVgAction(pMnode, pTrans, &newVg2) != 0) goto _OVER;
+ if (mndAddAlterVnodeHashRangeAction(pMnode, pTrans, srcVgId, &newVg2) != 0) goto _OVER;
if (mndAddAlterVnodeConfirmAction(pMnode, pTrans, pDb, &newVg1) != 0) goto _OVER;
-
if (mndAddAlterVnodeConfirmAction(pMnode, pTrans, pDb, &newVg2) != 0) goto _OVER;
- // adjust vgroup replica
- if (pDb->cfg.replications != newVg1.replica) {
- if (mndBuildAlterVgroupAction(pMnode, pTrans, pDb, pDb, &newVg1, pArray) != 0) goto _OVER;
- } else {
- if (mndTransCommitVgStatus(pTrans, &newVg1, SDB_STATUS_READY) < 0) goto _OVER;
- }
-
- if (pDb->cfg.replications != newVg2.replica) {
- if (mndBuildAlterVgroupAction(pMnode, pTrans, pDb, pDb, &newVg2, pArray) != 0) goto _OVER;
- } else {
- if (mndTransCommitVgStatus(pTrans, &newVg2, SDB_STATUS_READY) < 0) goto _OVER;
- }
-
- if (mndTransCommitVgStatus(pTrans, pVgroup, SDB_STATUS_DROPPED) < 0) goto _OVER;
+ if (mndAddVgStatusAction(pTrans, &newVg1, SDB_STATUS_READY, TRN_STAGE_REDO_ACTION) < 0) goto _OVER;
+ if (mndAddVgStatusAction(pTrans, &newVg2, SDB_STATUS_READY, TRN_STAGE_REDO_ACTION) < 0) goto _OVER;
+ if (mndAddVgStatusAction(pTrans, pVgroup, SDB_STATUS_DROPPED, TRN_STAGE_REDO_ACTION) < 0) goto _OVER;
+ // update db status
memcpy(&dbObj, pDb, sizeof(SDbObj));
if (dbObj.cfg.pRetensions != NULL) {
dbObj.cfg.pRetensions = taosArrayDup(pDb->cfg.pRetensions, NULL);
@@ -2350,11 +2374,27 @@ int32_t mndSplitVgroup(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SVgObj *pVgro
dbObj.vgVersion++;
dbObj.updateTime = taosGetTimestampMs();
dbObj.cfg.numOfVgroups++;
- pRaw = mndDbActionEncode(&dbObj);
- if (pRaw == NULL) goto _OVER;
- if (mndTransAppendCommitlog(pTrans, pRaw) != 0) goto _OVER;
- (void)sdbSetRawStatus(pRaw, SDB_STATUS_READY);
- pRaw = NULL;
+ if (mndAddDbStatusAction(pTrans, &dbObj, SDB_STATUS_READY, TRN_STAGE_REDO_ACTION) < 0) goto _OVER;
+
+ // adjust vgroup replica
+ if (pDb->cfg.replications != newVg1.replica) {
+ if (mndBuildAlterVgroupAction(pMnode, pTrans, pDb, pDb, &newVg1, pArray) != 0) goto _OVER;
+ } else {
+ if (mndAddVgStatusAction(pTrans, &newVg1, SDB_STATUS_READY, TRN_STAGE_COMMIT_ACTION) < 0) goto _OVER;
+ }
+
+ if (pDb->cfg.replications != newVg2.replica) {
+ if (mndBuildAlterVgroupAction(pMnode, pTrans, pDb, pDb, &newVg2, pArray) != 0) goto _OVER;
+ } else {
+ if (mndAddVgStatusAction(pTrans, &newVg2, SDB_STATUS_READY, TRN_STAGE_COMMIT_ACTION) < 0) goto _OVER;
+ }
+
+ if (mndAddVgStatusAction(pTrans, pVgroup, SDB_STATUS_DROPPED, TRN_STAGE_COMMIT_ACTION) < 0) goto _OVER;
+
+ // commit db status
+ dbObj.vgVersion++;
+ dbObj.updateTime = taosGetTimestampMs();
+ if (mndAddDbStatusAction(pTrans, &dbObj, SDB_STATUS_READY, TRN_STAGE_COMMIT_ACTION) < 0) goto _OVER;
if (mndTransPrepare(pMnode, pTrans) != 0) goto _OVER;
code = 0;
@@ -2362,7 +2402,6 @@ int32_t mndSplitVgroup(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SVgObj *pVgro
_OVER:
taosArrayDestroy(pArray);
mndTransDrop(pTrans);
- sdbFreeRaw(pRaw);
taosArrayDestroy(dbObj.cfg.pRetensions);
return code;
}
diff --git a/source/dnode/mnode/sdb/inc/sdb.h b/source/dnode/mnode/sdb/inc/sdb.h
index e9a9e425e3..3c96d8a2fd 100644
--- a/source/dnode/mnode/sdb/inc/sdb.h
+++ b/source/dnode/mnode/sdb/inc/sdb.h
@@ -122,6 +122,7 @@ typedef enum {
SDB_STATUS_DROPPING = 2,
SDB_STATUS_DROPPED = 3,
SDB_STATUS_READY = 4,
+ SDB_STATUS_UPDATE = 5,
} ESdbStatus;
typedef enum {
diff --git a/source/dnode/mnode/sdb/src/sdbHash.c b/source/dnode/mnode/sdb/src/sdbHash.c
index f1cee6395b..258b22d8ee 100644
--- a/source/dnode/mnode/sdb/src/sdbHash.c
+++ b/source/dnode/mnode/sdb/src/sdbHash.c
@@ -256,6 +256,7 @@ int32_t sdbWriteWithoutFree(SSdb *pSdb, SSdbRaw *pRaw) {
code = sdbInsertRow(pSdb, hash, pRaw, pRow, keySize);
break;
case SDB_STATUS_READY:
+ case SDB_STATUS_UPDATE:
case SDB_STATUS_DROPPING:
code = sdbUpdateRow(pSdb, hash, pRaw, pRow, keySize);
break;
diff --git a/source/dnode/vnode/src/inc/tq.h b/source/dnode/vnode/src/inc/tq.h
index 4ba8d6d69f..b35dc71ed9 100644
--- a/source/dnode/vnode/src/inc/tq.h
+++ b/source/dnode/vnode/src/inc/tq.h
@@ -139,6 +139,7 @@ static STqMgmt tqMgmt = {0};
int32_t tEncodeSTqHandle(SEncoder* pEncoder, const STqHandle* pHandle);
int32_t tDecodeSTqHandle(SDecoder* pDecoder, STqHandle* pHandle);
+void tqDestroyTqHandle(void* data);
// tqRead
int32_t tqScanTaosx(STQ* pTq, const STqHandle* pHandle, STaosxRsp* pRsp, SMqMetaRsp* pMetaRsp, STqOffsetVal* offset);
@@ -161,6 +162,8 @@ int32_t tqMetaRestoreHandle(STQ* pTq);
int32_t tqMetaSaveCheckInfo(STQ* pTq, const char* key, const void* value, int32_t vLen);
int32_t tqMetaDeleteCheckInfo(STQ* pTq, const char* key);
int32_t tqMetaRestoreCheckInfo(STQ* pTq);
+int32_t tqMetaGetHandle(STQ* pTq, const char* key);
+int32_t tqCreateHandle(STQ* pTq, SMqRebVgReq* req, STqHandle* handle);
STqOffsetStore* tqOffsetOpen(STQ* pTq);
void tqOffsetClose(STqOffsetStore*);
diff --git a/source/dnode/vnode/src/inc/vnodeInt.h b/source/dnode/vnode/src/inc/vnodeInt.h
index ca2282493f..d3998285f4 100644
--- a/source/dnode/vnode/src/inc/vnodeInt.h
+++ b/source/dnode/vnode/src/inc/vnodeInt.h
@@ -107,10 +107,12 @@ struct SQueryNode {
typedef SVCreateTbReq STbCfg;
typedef SVCreateTSmaReq SSmaCfg;
-SMTbCursor *metaOpenTbCursor(void *pVnode);
-void metaCloseTbCursor(SMTbCursor *pTbCur);
-int32_t metaTbCursorNext(SMTbCursor *pTbCur, ETableType jumpTableType);
-int32_t metaTbCursorPrev(SMTbCursor *pTbCur, ETableType jumpTableType);
+SMTbCursor* metaOpenTbCursor(void* pVnode);
+void metaCloseTbCursor(SMTbCursor* pTbCur);
+void metaPauseTbCursor(SMTbCursor* pTbCur);
+void metaResumeTbCursor(SMTbCursor* pTbCur, int8_t first);
+int32_t metaTbCursorNext(SMTbCursor* pTbCur, ETableType jumpTableType);
+int32_t metaTbCursorPrev(SMTbCursor* pTbCur, ETableType jumpTableType);
#endif
@@ -146,6 +148,7 @@ int metaAlterSTable(SMeta* pMeta, int64_t version, SVCreateStbReq* p
int metaDropSTable(SMeta* pMeta, int64_t verison, SVDropStbReq* pReq, SArray* tbUidList);
int metaCreateTable(SMeta* pMeta, int64_t version, SVCreateTbReq* pReq, STableMetaRsp** pMetaRsp);
int metaDropTable(SMeta* pMeta, int64_t version, SVDropTbReq* pReq, SArray* tbUids, int64_t* tbUid);
+int32_t metaTrimTables(SMeta* pMeta);
int metaTtlDropTable(SMeta* pMeta, int64_t ttl, SArray* tbUids);
int metaAlterTable(SMeta* pMeta, int64_t version, SVAlterTbReq* pReq, STableMetaRsp* pMetaRsp);
SSchemaWrapper* metaGetTableSchema(SMeta* pMeta, tb_uid_t uid, int32_t sver, int lock);
@@ -154,8 +157,8 @@ int32_t metaGetTbTSchemaEx(SMeta* pMeta, tb_uid_t suid, tb_uid_t uid, in
int metaGetTableEntryByName(SMetaReader* pReader, const char* name);
int metaAlterCache(SMeta* pMeta, int32_t nPage);
-int32_t metaUidCacheClear(SMeta* pMeta, uint64_t suid);
-int32_t metaTbGroupCacheClear(SMeta *pMeta, uint64_t suid);
+int32_t metaUidCacheClear(SMeta* pMeta, uint64_t suid);
+int32_t metaTbGroupCacheClear(SMeta* pMeta, uint64_t suid);
int metaAddIndexToSTable(SMeta* pMeta, int64_t version, SVCreateStbReq* pReq);
int metaDropIndexFromSTable(SMeta* pMeta, int64_t version, SDropIndexReq* pReq);
@@ -175,7 +178,7 @@ void* metaGetIdx(SMeta* pMeta);
void* metaGetIvtIdx(SMeta* pMeta);
int metaTtlSmaller(SMeta* pMeta, uint64_t time, SArray* uidList);
-void metaReaderInit(SMetaReader *pReader, SMeta *pMeta, int32_t flags);
+void metaReaderInit(SMetaReader* pReader, SMeta* pMeta, int32_t flags);
int32_t metaCreateTSma(SMeta* pMeta, int64_t version, SSmaCfg* pCfg);
int32_t metaDropTSma(SMeta* pMeta, int64_t indexUid);
@@ -492,7 +495,6 @@ struct SCompactInfo {
void initStorageAPI(SStorageAPI* pAPI);
-
#ifdef __cplusplus
}
#endif
diff --git a/source/dnode/vnode/src/meta/metaQuery.c b/source/dnode/vnode/src/meta/metaQuery.c
index fa9eea5e29..29fe89c3f2 100644
--- a/source/dnode/vnode/src/meta/metaQuery.c
+++ b/source/dnode/vnode/src/meta/metaQuery.c
@@ -17,8 +17,8 @@
#include "osMemory.h"
#include "tencode.h"
-void _metaReaderInit(SMetaReader* pReader, void* pVnode, int32_t flags, SStoreMeta* pAPI) {
- SMeta* pMeta = ((SVnode*)pVnode)->pMeta;
+void _metaReaderInit(SMetaReader *pReader, void *pVnode, int32_t flags, SStoreMeta *pAPI) {
+ SMeta *pMeta = ((SVnode *)pVnode)->pMeta;
metaReaderInit(pReader, pMeta, flags);
pReader->pAPI = pAPI;
}
@@ -71,7 +71,7 @@ _err:
}
bool metaIsTableExist(void *pVnode, tb_uid_t uid) {
- SVnode* pVnodeObj = pVnode;
+ SVnode *pVnodeObj = pVnode;
metaRLock(pVnodeObj->pMeta); // query uid.idx
if (tdbTbGet(pVnodeObj->pMeta->pUidIdx, &uid, sizeof(uid), NULL, NULL) < 0) {
@@ -143,7 +143,7 @@ tb_uid_t metaGetTableEntryUidByName(SMeta *pMeta, const char *name) {
int metaGetTableNameByUid(void *pVnode, uint64_t uid, char *tbName) {
int code = 0;
SMetaReader mr = {0};
- metaReaderInit(&mr, ((SVnode*)pVnode)->pMeta, 0);
+ metaReaderInit(&mr, ((SVnode *)pVnode)->pMeta, 0);
code = metaReaderGetTableEntryByUid(&mr, uid);
if (code < 0) {
metaReaderClear(&mr);
@@ -179,7 +179,7 @@ int metaGetTableUidByName(void *pVnode, char *tbName, uint64_t *uid) {
SMetaReader *pReader = &mr;
// query name.idx
- if (tdbTbGet(((SMeta*)pReader->pMeta)->pNameIdx, tbName, strlen(tbName) + 1, &pReader->pBuf, &pReader->szBuf) < 0) {
+ if (tdbTbGet(((SMeta *)pReader->pMeta)->pNameIdx, tbName, strlen(tbName) + 1, &pReader->pBuf, &pReader->szBuf) < 0) {
terrno = TSDB_CODE_PAR_TABLE_NOT_EXIST;
metaReaderClear(&mr);
return -1;
@@ -195,7 +195,7 @@ int metaGetTableUidByName(void *pVnode, char *tbName, uint64_t *uid) {
int metaGetTableTypeByName(void *pVnode, char *tbName, ETableType *tbType) {
int code = 0;
SMetaReader mr = {0};
- metaReaderInit(&mr, ((SVnode*)pVnode)->pMeta, 0);
+ metaReaderInit(&mr, ((SVnode *)pVnode)->pMeta, 0);
code = metaGetTableEntryByName(&mr, tbName);
if (code == 0) *tbType = mr.me.type;
@@ -221,12 +221,13 @@ SMTbCursor *metaOpenTbCursor(void *pVnode) {
return NULL;
}
- SVnode* pVnodeObj = pVnode;
- metaReaderInit(&pTbCur->mr, pVnodeObj->pMeta, 0);
+ SVnode *pVnodeObj = pVnode;
+ // metaReaderInit(&pTbCur->mr, pVnodeObj->pMeta, 0);
- tdbTbcOpen(pVnodeObj->pMeta->pUidIdx, (TBC **)&pTbCur->pDbc, NULL);
-
- tdbTbcMoveToFirst((TBC *)pTbCur->pDbc);
+ // tdbTbcMoveToFirst((TBC *)pTbCur->pDbc);
+ pTbCur->pMeta = pVnodeObj->pMeta;
+ pTbCur->paused = 1;
+ metaResumeTbCursor(pTbCur, 1);
return pTbCur;
}
@@ -234,14 +235,45 @@ void metaCloseTbCursor(SMTbCursor *pTbCur) {
if (pTbCur) {
tdbFree(pTbCur->pKey);
tdbFree(pTbCur->pVal);
- metaReaderClear(&pTbCur->mr);
- if (pTbCur->pDbc) {
- tdbTbcClose((TBC *)pTbCur->pDbc);
+ if (!pTbCur->paused) {
+ metaReaderClear(&pTbCur->mr);
+ if (pTbCur->pDbc) {
+ tdbTbcClose((TBC *)pTbCur->pDbc);
+ }
}
taosMemoryFree(pTbCur);
}
}
+void metaPauseTbCursor(SMTbCursor *pTbCur) {
+ if (!pTbCur->paused) {
+ metaReaderClear(&pTbCur->mr);
+ tdbTbcClose((TBC *)pTbCur->pDbc);
+ pTbCur->paused = 1;
+ }
+}
+void metaResumeTbCursor(SMTbCursor *pTbCur, int8_t first) {
+ if (pTbCur->paused) {
+ metaReaderInit(&pTbCur->mr, pTbCur->pMeta, 0);
+
+ tdbTbcOpen(((SMeta *)pTbCur->pMeta)->pUidIdx, (TBC **)&pTbCur->pDbc, NULL);
+
+ if (first) {
+ tdbTbcMoveToFirst((TBC *)pTbCur->pDbc);
+ } else {
+ int c = 0;
+ tdbTbcMoveTo(pTbCur->pDbc, pTbCur->pKey, pTbCur->kLen, &c);
+ if (c < 0) {
+ tdbTbcMoveToPrev(pTbCur->pDbc);
+ } else {
+ tdbTbcMoveToNext(pTbCur->pDbc);
+ }
+ }
+
+ pTbCur->paused = 0;
+ }
+}
+
int32_t metaTbCursorNext(SMTbCursor *pTbCur, ETableType jumpTableType) {
int ret;
void *pBuf;
@@ -974,7 +1006,7 @@ typedef struct {
} SIdxCursor;
int32_t metaFilterCreateTime(void *pVnode, SMetaFltParam *arg, SArray *pUids) {
- SMeta *pMeta = ((SVnode*)pVnode)->pMeta;
+ SMeta *pMeta = ((SVnode *)pVnode)->pMeta;
SMetaFltParam *param = arg;
int32_t ret = 0;
@@ -1034,7 +1066,7 @@ END:
}
int32_t metaFilterTableName(void *pVnode, SMetaFltParam *arg, SArray *pUids) {
- SMeta *pMeta = ((SVnode*)pVnode)->pMeta;
+ SMeta *pMeta = ((SVnode *)pVnode)->pMeta;
SMetaFltParam *param = arg;
int32_t ret = 0;
char *buf = NULL;
@@ -1101,7 +1133,7 @@ END:
return ret;
}
int32_t metaFilterTtl(void *pVnode, SMetaFltParam *arg, SArray *pUids) {
- SMeta *pMeta = ((SVnode*)pVnode)->pMeta;
+ SMeta *pMeta = ((SVnode *)pVnode)->pMeta;
SMetaFltParam *param = arg;
int32_t ret = 0;
char *buf = NULL;
@@ -1132,7 +1164,7 @@ END:
return 0;
}
int32_t metaFilterTableIds(void *pVnode, SMetaFltParam *arg, SArray *pUids) {
- SMeta *pMeta = ((SVnode*)pVnode)->pMeta;
+ SMeta *pMeta = ((SVnode *)pVnode)->pMeta;
SMetaFltParam *param = arg;
SMetaEntry oStbEntry = {0};
@@ -1318,7 +1350,7 @@ static int32_t metaGetTableTagByUid(SMeta *pMeta, int64_t suid, int64_t uid, voi
}
int32_t metaGetTableTagsByUids(void *pVnode, int64_t suid, SArray *uidList) {
- SMeta* pMeta = ((SVnode*) pVnode)->pMeta;
+ SMeta *pMeta = ((SVnode *)pVnode)->pMeta;
const int32_t LIMIT = 128;
int32_t isLock = false;
@@ -1350,8 +1382,8 @@ int32_t metaGetTableTagsByUids(void *pVnode, int64_t suid, SArray *uidList) {
return 0;
}
-int32_t metaGetTableTags(void* pVnode, uint64_t suid, SArray *pUidTagInfo) {
- SMCtbCursor *pCur = metaOpenCtbCursor(((SVnode*)pVnode)->pMeta, suid, 1);
+int32_t metaGetTableTags(void *pVnode, uint64_t suid, SArray *pUidTagInfo) {
+ SMCtbCursor *pCur = metaOpenCtbCursor(((SVnode *)pVnode)->pMeta, suid, 1);
// If len > 0 means there already have uids, and we only want the
// tags of the specified tables, of which uid in the uid list. Otherwise, all table tags are retrieved and kept
@@ -1456,11 +1488,11 @@ _exit:
return code;
}
-int32_t metaGetStbStats(void *pVnode, int64_t uid, int64_t* numOfTables) {
+int32_t metaGetStbStats(void *pVnode, int64_t uid, int64_t *numOfTables) {
int32_t code = 0;
*numOfTables = 0;
- SVnode* pVnodeObj = pVnode;
+ SVnode *pVnodeObj = pVnode;
metaRLock(pVnodeObj->pMeta);
// fast path: search cache
diff --git a/source/dnode/vnode/src/meta/metaTable.c b/source/dnode/vnode/src/meta/metaTable.c
index df16304e28..0d0716f2f0 100644
--- a/source/dnode/vnode/src/meta/metaTable.c
+++ b/source/dnode/vnode/src/meta/metaTable.c
@@ -838,22 +838,101 @@ int metaDropTable(SMeta *pMeta, int64_t version, SVDropTbReq *pReq, SArray *tbUi
return 0;
}
+static void metaDropTables(SMeta *pMeta, SArray *tbUids) {
+ metaWLock(pMeta);
+ for (int i = 0; i < TARRAY_SIZE(tbUids); ++i) {
+ tb_uid_t uid = *(tb_uid_t *)taosArrayGet(tbUids, i);
+ metaDropTableByUid(pMeta, uid, NULL);
+ metaDebug("batch drop table:%" PRId64, uid);
+ }
+ metaULock(pMeta);
+}
+
+static int32_t metaFilterTableByHash(SMeta *pMeta, SArray *uidList) {
+ int32_t code = 0;
+ // 1, tranverse table's
+ // 2, validate table name using vnodeValidateTableHash
+ // 3, push invalidated table's uid into uidList
+
+ TBC *pCur;
+ code = tdbTbcOpen(pMeta->pTbDb, &pCur, NULL);
+ if (code < 0) {
+ return code;
+ }
+
+ code = tdbTbcMoveToFirst(pCur);
+ if (code) {
+ tdbTbcClose(pCur);
+ return code;
+ }
+
+ void *pData = NULL, *pKey = NULL;
+ int nData = 0, nKey = 0;
+
+ while (1) {
+ int32_t ret = tdbTbcNext(pCur, &pKey, &nKey, &pData, &nData);
+ if (ret < 0) {
+ break;
+ }
+
+ SMetaEntry me = {0};
+ SDecoder dc = {0};
+ tDecoderInit(&dc, pData, nData);
+ metaDecodeEntry(&dc, &me);
+
+ if (me.type != TSDB_SUPER_TABLE) {
+ char tbFName[TSDB_TABLE_FNAME_LEN + 1];
+ snprintf(tbFName, sizeof(tbFName), "%s.%s", pMeta->pVnode->config.dbname, me.name);
+ tbFName[TSDB_TABLE_FNAME_LEN] = '\0';
+ int32_t ret = vnodeValidateTableHash(pMeta->pVnode, tbFName);
+ if (ret < 0 && terrno == TSDB_CODE_VND_HASH_MISMATCH) {
+ taosArrayPush(uidList, &me.uid);
+ }
+ }
+ tDecoderClear(&dc);
+ }
+ tdbFree(pData);
+ tdbFree(pKey);
+ tdbTbcClose(pCur);
+
+ return 0;
+}
+
+int32_t metaTrimTables(SMeta *pMeta) {
+ int32_t code = 0;
+
+ SArray *tbUids = taosArrayInit(8, sizeof(int64_t));
+ if (tbUids == NULL) {
+ return TSDB_CODE_OUT_OF_MEMORY;
+ }
+
+ code = metaFilterTableByHash(pMeta, tbUids);
+ if (code != 0) {
+ goto end;
+ }
+ if (TARRAY_SIZE(tbUids) == 0) {
+ goto end;
+ }
+
+ metaInfo("vgId:%d, trim %ld tables", TD_VID(pMeta->pVnode), taosArrayGetSize(tbUids));
+ metaDropTables(pMeta, tbUids);
+
+end:
+ taosArrayDestroy(tbUids);
+
+ return code;
+}
+
int metaTtlDropTable(SMeta *pMeta, int64_t ttl, SArray *tbUids) {
int ret = metaTtlSmaller(pMeta, ttl, tbUids);
if (ret != 0) {
return ret;
}
- if (taosArrayGetSize(tbUids) == 0) {
+ if (TARRAY_SIZE(tbUids) == 0) {
return 0;
}
- metaWLock(pMeta);
- for (int i = 0; i < taosArrayGetSize(tbUids); ++i) {
- tb_uid_t *uid = (tb_uid_t *)taosArrayGet(tbUids, i);
- metaDropTableByUid(pMeta, *uid, NULL);
- metaDebug("ttl drop table:%" PRId64, *uid);
- }
- metaULock(pMeta);
+ metaDropTables(pMeta, tbUids);
return 0;
}
@@ -999,7 +1078,7 @@ static int metaDropTableByUid(SMeta *pMeta, tb_uid_t uid, int *type) {
metaUpdateStbStats(pMeta, e.ctbEntry.suid, -1);
metaUidCacheClear(pMeta, e.ctbEntry.suid);
- metaTbGroupCacheClear(pMeta, e.ctbEntry.suid);
+ metaTbGroupCacheClear(pMeta, e.ctbEntry.suid);
} else if (e.type == TSDB_NORMAL_TABLE) {
// drop schema.db (todo)
@@ -1011,7 +1090,7 @@ static int metaDropTableByUid(SMeta *pMeta, tb_uid_t uid, int *type) {
metaStatsCacheDrop(pMeta, uid);
metaUidCacheClear(pMeta, uid);
- metaTbGroupCacheClear(pMeta, uid);
+ metaTbGroupCacheClear(pMeta, uid);
--pMeta->pVnode->config.vndStats.numOfSTables;
}
@@ -1432,7 +1511,7 @@ static int metaUpdateTableTagVal(SMeta *pMeta, int64_t version, SVAlterTbReq *pA
((STag *)(ctbEntry.ctbEntry.pTags))->len, pMeta->txn);
metaUidCacheClear(pMeta, ctbEntry.ctbEntry.suid);
- metaTbGroupCacheClear(pMeta, ctbEntry.ctbEntry.suid);
+ metaTbGroupCacheClear(pMeta, ctbEntry.ctbEntry.suid);
metaULock(pMeta);
diff --git a/source/dnode/vnode/src/tq/tq.c b/source/dnode/vnode/src/tq/tq.c
index 731c85e4d0..de750aaa39 100644
--- a/source/dnode/vnode/src/tq/tq.c
+++ b/source/dnode/vnode/src/tq/tq.c
@@ -62,7 +62,7 @@ void tqCleanUp() {
}
}
-static void destroyTqHandle(void* data) {
+void tqDestroyTqHandle(void* data) {
STqHandle* pData = (STqHandle*)data;
qDestroyTask(pData->execHandle.task);
@@ -102,7 +102,7 @@ STQ* tqOpen(const char* path, SVnode* pVnode) {
pTq->walLogLastVer = pVnode->pWal->vers.lastVer;
pTq->pHandle = taosHashInit(64, MurmurHash3_32, true, HASH_ENTRY_LOCK);
- taosHashSetFreeFp(pTq->pHandle, destroyTqHandle);
+ taosHashSetFreeFp(pTq->pHandle, tqDestroyTqHandle);
taosInitRWLatch(&pTq->lock);
pTq->pPushMgr = taosHashInit(64, MurmurHash3_32, false, HASH_NO_LOCK);
@@ -243,8 +243,8 @@ int32_t tqPushDataRsp(STqHandle* pHandle, int32_t vgId) {
tqDoSendDataRsp(&pHandle->msg->info, &dataRsp, pHandle->epoch, pHandle->consumerId, TMQ_MSG_TYPE__POLL_RSP, sver,
ever);
- char buf1[80] = {0};
- char buf2[80] = {0};
+ char buf1[TSDB_OFFSET_LEN] = {0};
+ char buf2[TSDB_OFFSET_LEN] = {0};
tFormatOffset(buf1, tListLen(buf1), &dataRsp.reqOffset);
tFormatOffset(buf2, tListLen(buf2), &dataRsp.rspOffset);
tqDebug("vgId:%d, from consumer:0x%" PRIx64 " (epoch %d) push rsp, block num: %d, req:%s, rsp:%s", vgId,
@@ -259,10 +259,10 @@ int32_t tqSendDataRsp(STqHandle* pHandle, const SRpcMsg* pMsg, const SMqPollReq*
tqDoSendDataRsp(&pMsg->info, pRsp, pReq->epoch, pReq->consumerId, type, sver, ever);
- char buf1[80] = {0};
- char buf2[80] = {0};
- tFormatOffset(buf1, 80, &pRsp->reqOffset);
- tFormatOffset(buf2, 80, &pRsp->rspOffset);
+ char buf1[TSDB_OFFSET_LEN] = {0};
+ char buf2[TSDB_OFFSET_LEN] = {0};
+ tFormatOffset(buf1, TSDB_OFFSET_LEN, &pRsp->reqOffset);
+ tFormatOffset(buf2, TSDB_OFFSET_LEN, &pRsp->rspOffset);
tqDebug("tmq poll vgId:%d consumer:0x%" PRIx64 " (epoch %d) send rsp, block num:%d, req:%s, rsp:%s, reqId:0x%" PRIx64, vgId,
pReq->consumerId, pReq->epoch, pRsp->blockNum, buf1, buf2, pReq->reqId);
@@ -510,8 +510,8 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg) {
pHandle->epoch = reqEpoch;
}
- char buf[80];
- tFormatOffset(buf, 80, &reqOffset);
+ char buf[TSDB_OFFSET_LEN];
+ tFormatOffset(buf, TSDB_OFFSET_LEN, &reqOffset);
tqDebug("tmq poll: consumer:0x%" PRIx64 " (epoch %d), subkey %s, recv poll req vgId:%d, req:%s, reqId:0x%" PRIx64,
consumerId, req.epoch, pHandle->subKey, vgId, buf, req.reqId);
@@ -588,7 +588,7 @@ int32_t tqProcessVgWalInfoReq(STQ* pTq, SRpcMsg* pMsg) {
} else {
dataRsp.rspOffset.version = currentVer; // return current consume offset value
}
- } else if (reqOffset.type == TMQ_OFFSET__RESET_EARLIEAST) {
+ } else if (reqOffset.type == TMQ_OFFSET__RESET_EARLIEST) {
dataRsp.rspOffset.version = sver; // not consume yet, set the earliest position
} else if (reqOffset.type == TMQ_OFFSET__RESET_LATEST) {
dataRsp.rspOffset.version = ever;
@@ -690,13 +690,17 @@ int32_t tqProcessSubscribeReq(STQ* pTq, int64_t sversion, char* msg, int32_t msg
return -1;
}
- SVnode* pVnode = pTq->pVnode;
- int32_t vgId = TD_VID(pVnode);
-
- tqDebug("vgId:%d, tq process sub req:%s, Id:0x%" PRIx64 " -> Id:0x%" PRIx64, pVnode->config.vgId, req.subKey,
+ tqDebug("vgId:%d, tq process sub req:%s, Id:0x%" PRIx64 " -> Id:0x%" PRIx64, pTq->pVnode->config.vgId, req.subKey,
req.oldConsumerId, req.newConsumerId);
- STqHandle* pHandle = taosHashGet(pTq->pHandle, req.subKey, strlen(req.subKey));
+ STqHandle* pHandle = NULL;
+ while(1){
+ pHandle = taosHashGet(pTq->pHandle, req.subKey, strlen(req.subKey));
+ if (pHandle || tqMetaGetHandle(pTq, req.subKey) < 0){
+ break;
+ }
+ }
+
if (pHandle == NULL) {
if (req.oldConsumerId != -1) {
tqError("vgId:%d, build new consumer handle %s for consumer:0x%" PRIx64 ", but old consumerId:0x%" PRIx64,
@@ -707,86 +711,13 @@ int32_t tqProcessSubscribeReq(STQ* pTq, int64_t sversion, char* msg, int32_t msg
tqError("vgId:%d, tq invalid re-balance request, new consumerId %" PRId64 "", req.vgId, req.newConsumerId);
goto end;
}
-
- STqHandle tqHandle = {0};
- pHandle = &tqHandle;
-
- memcpy(pHandle->subKey, req.subKey, TSDB_SUBSCRIBE_KEY_LEN);
- pHandle->consumerId = req.newConsumerId;
- pHandle->epoch = -1;
-
- pHandle->execHandle.subType = req.subType;
- pHandle->fetchMeta = req.withMeta;
-
- // TODO version should be assigned and refed during preprocess
- SWalRef* pRef = walRefCommittedVer(pVnode->pWal);
- if (pRef == NULL) {
- ret = -1;
+ STqHandle handle = {0};
+ ret = tqCreateHandle(pTq, &req, &handle);
+ if(ret < 0){
+ tqDestroyTqHandle(&handle);
goto end;
}
-
- int64_t ver = pRef->refVer;
- pHandle->pRef = pRef;
-
- SReadHandle handle = {.vnode = pVnode, .initTableReader = true, .initTqReader = true, .version = ver};
- initStorageAPI(&handle.api);
-
- pHandle->snapshotVer = ver;
-
- if (pHandle->execHandle.subType == TOPIC_SUB_TYPE__COLUMN) {
- pHandle->execHandle.execCol.qmsg = taosStrdup(req.qmsg);
-
- pHandle->execHandle.task = qCreateQueueExecTaskInfo(pHandle->execHandle.execCol.qmsg, &handle, vgId,
- &pHandle->execHandle.numOfCols, req.newConsumerId);
- void* scanner = NULL;
- qExtractStreamScanner(pHandle->execHandle.task, &scanner);
- pHandle->execHandle.pTqReader = qExtractReaderFromStreamScanner(scanner);
- } else if (pHandle->execHandle.subType == TOPIC_SUB_TYPE__DB) {
- pHandle->pWalReader = walOpenReader(pVnode->pWal, NULL);
- pHandle->execHandle.pTqReader = tqReaderOpen(pVnode);
-
- pHandle->execHandle.execDb.pFilterOutTbUid =
- taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_ENTRY_LOCK);
- buildSnapContext(handle.vnode, handle.version, 0, pHandle->execHandle.subType, pHandle->fetchMeta,
- (SSnapContext**)(&handle.sContext));
-
- pHandle->execHandle.task = qCreateQueueExecTaskInfo(NULL, &handle, vgId, NULL, req.newConsumerId);
- } else if (pHandle->execHandle.subType == TOPIC_SUB_TYPE__TABLE) {
- pHandle->pWalReader = walOpenReader(pVnode->pWal, NULL);
- pHandle->execHandle.execTb.suid = req.suid;
- pHandle->execHandle.execTb.qmsg = taosStrdup(req.qmsg);
-
- if (strcmp(pHandle->execHandle.execTb.qmsg, "") != 0) {
- if (nodesStringToNode(pHandle->execHandle.execTb.qmsg, &pHandle->execHandle.execTb.node) != 0) {
- tqError("nodesStringToNode error in sub stable, since %s, vgId:%d, subkey:%s consumer:0x%" PRIx64, terrstr(),
- pVnode->config.vgId, req.subKey, pHandle->consumerId);
- return -1;
- }
- }
-
- buildSnapContext(handle.vnode, handle.version, req.suid, pHandle->execHandle.subType, pHandle->fetchMeta,
- (SSnapContext**)(&handle.sContext));
- pHandle->execHandle.task = qCreateQueueExecTaskInfo(NULL, &handle, vgId, NULL, req.newConsumerId);
-
- SArray* tbUidList = NULL;
- ret = qGetTableList(req.suid, pVnode, pHandle->execHandle.execTb.node, &tbUidList, pHandle->execHandle.task);
- if (ret != TDB_CODE_SUCCESS) {
- tqError("qGetTableList error:%d vgId:%d, subkey:%s consumer:0x%" PRIx64, ret, pVnode->config.vgId, req.subKey,
- pHandle->consumerId);
- taosArrayDestroy(tbUidList);
- goto end;
- }
- tqDebug("tq try to get ctb for stb subscribe, vgId:%d, subkey:%s consumer:0x%" PRIx64 " suid:%" PRId64,
- pVnode->config.vgId, req.subKey, pHandle->consumerId, req.suid);
- pHandle->execHandle.pTqReader = tqReaderOpen(pVnode);
- tqReaderSetTbUidList(pHandle->execHandle.pTqReader, tbUidList, NULL);
- taosArrayDestroy(tbUidList);
- }
-
- taosHashPut(pTq->pHandle, req.subKey, strlen(req.subKey), pHandle, sizeof(STqHandle));
- tqDebug("try to persist handle %s consumer:0x%" PRIx64, req.subKey, pHandle->consumerId);
- ret = tqMetaSaveHandle(pTq, req.subKey, pHandle);
- goto end;
+ ret = tqMetaSaveHandle(pTq, req.subKey, &handle);
} else {
taosWLockLatch(&pTq->lock);
diff --git a/source/dnode/vnode/src/tq/tqMeta.c b/source/dnode/vnode/src/tq/tqMeta.c
index ba6d7cb501..3b0e6749c2 100644
--- a/source/dnode/vnode/src/tq/tqMeta.c
+++ b/source/dnode/vnode/src/tq/tqMeta.c
@@ -88,9 +88,9 @@ int32_t tqMetaOpen(STQ* pTq) {
return -1;
}
- if (tqMetaRestoreHandle(pTq) < 0) {
- return -1;
- }
+// if (tqMetaRestoreHandle(pTq) < 0) {
+// return -1;
+// }
if (tqMetaRestoreCheckInfo(pTq) < 0) {
return -1;
@@ -274,6 +274,120 @@ int32_t tqMetaDeleteHandle(STQ* pTq, const char* key) {
return 0;
}
+static int buildHandle(STQ* pTq, STqHandle* handle){
+ SVnode* pVnode = pTq->pVnode;
+ int32_t vgId = TD_VID(pVnode);
+
+ handle->pRef = walOpenRef(pVnode->pWal);
+ if (handle->pRef == NULL) {
+ return -1;
+ }
+ walSetRefVer(handle->pRef, handle->snapshotVer);
+
+ SReadHandle reader = {
+ .vnode = pVnode,
+ .initTableReader = true,
+ .initTqReader = true,
+ .version = handle->snapshotVer,
+ };
+
+ initStorageAPI(&reader.api);
+
+ if (handle->execHandle.subType == TOPIC_SUB_TYPE__COLUMN) {
+ handle->execHandle.task =
+ qCreateQueueExecTaskInfo(handle->execHandle.execCol.qmsg, &reader, vgId, &handle->execHandle.numOfCols, handle->consumerId);
+ if (handle->execHandle.task == NULL) {
+ tqError("cannot create exec task for %s", handle->subKey);
+ return -1;
+ }
+ void* scanner = NULL;
+ qExtractStreamScanner(handle->execHandle.task, &scanner);
+ if (scanner == NULL) {
+ tqError("cannot extract stream scanner for %s", handle->subKey);
+ return -1;
+ }
+ handle->execHandle.pTqReader = qExtractReaderFromStreamScanner(scanner);
+ if (handle->execHandle.pTqReader == NULL) {
+ tqError("cannot extract exec reader for %s", handle->subKey);
+ return -1;
+ }
+ } else if (handle->execHandle.subType == TOPIC_SUB_TYPE__DB) {
+ handle->pWalReader = walOpenReader(pVnode->pWal, NULL);
+ handle->execHandle.pTqReader = tqReaderOpen(pVnode);
+
+ buildSnapContext(reader.vnode, reader.version, 0, handle->execHandle.subType, handle->fetchMeta,
+ (SSnapContext**)(&reader.sContext));
+ handle->execHandle.task = qCreateQueueExecTaskInfo(NULL, &reader, vgId, NULL, handle->consumerId);
+ } else if (handle->execHandle.subType == TOPIC_SUB_TYPE__TABLE) {
+ handle->pWalReader = walOpenReader(pVnode->pWal, NULL);
+
+ if(handle->execHandle.execTb.qmsg != NULL && strcmp(handle->execHandle.execTb.qmsg, "") != 0) {
+ if (nodesStringToNode(handle->execHandle.execTb.qmsg, &handle->execHandle.execTb.node) != 0) {
+ tqError("nodesStringToNode error in sub stable, since %s", terrstr());
+ return -1;
+ }
+ }
+ buildSnapContext(reader.vnode, reader.version, handle->execHandle.execTb.suid, handle->execHandle.subType,
+ handle->fetchMeta, (SSnapContext**)(&reader.sContext));
+ handle->execHandle.task = qCreateQueueExecTaskInfo(NULL, &reader, vgId, NULL, handle->consumerId);
+
+ SArray* tbUidList = NULL;
+ int ret = qGetTableList(handle->execHandle.execTb.suid, pVnode, handle->execHandle.execTb.node, &tbUidList, handle->execHandle.task);
+ if(ret != TDB_CODE_SUCCESS) {
+ tqError("qGetTableList error:%d handle %s consumer:0x%" PRIx64, ret, handle->subKey, handle->consumerId);
+ taosArrayDestroy(tbUidList);
+ return -1;
+ }
+ tqDebug("vgId:%d, tq try to get ctb for stb subscribe, suid:%" PRId64, pVnode->config.vgId, handle->execHandle.execTb.suid);
+ handle->execHandle.pTqReader = tqReaderOpen(pVnode);
+ tqReaderSetTbUidList(handle->execHandle.pTqReader, tbUidList, NULL);
+ taosArrayDestroy(tbUidList);
+ }
+ return 0;
+}
+
+static int restoreHandle(STQ* pTq, void* pVal, int vLen, STqHandle* handle){
+ int32_t vgId = TD_VID(pTq->pVnode);
+ SDecoder decoder;
+ tDecoderInit(&decoder, (uint8_t*)pVal, vLen);
+ tDecodeSTqHandle(&decoder, handle);
+ tDecoderClear(&decoder);
+
+ if(buildHandle(pTq, handle) < 0){
+ return -1;
+ }
+ tqDebug("tq restore %s consumer %" PRId64 " vgId:%d", handle->subKey, handle->consumerId, vgId);
+ return taosHashPut(pTq->pHandle, handle->subKey, strlen(handle->subKey), handle, sizeof(STqHandle));
+}
+
+int32_t tqCreateHandle(STQ* pTq, SMqRebVgReq* req, STqHandle* handle){
+ int32_t vgId = TD_VID(pTq->pVnode);
+
+ memcpy(handle->subKey, req->subKey, TSDB_SUBSCRIBE_KEY_LEN);
+ handle->consumerId = req->newConsumerId;
+ handle->epoch = -1;
+
+ handle->execHandle.subType = req->subType;
+ handle->fetchMeta = req->withMeta;
+ if(req->subType == TOPIC_SUB_TYPE__COLUMN){
+ handle->execHandle.execCol.qmsg = taosStrdup(req->qmsg);
+ }else if(req->subType == TOPIC_SUB_TYPE__DB){
+ handle->execHandle.execDb.pFilterOutTbUid =
+ taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_ENTRY_LOCK);
+ }else if(req->subType == TOPIC_SUB_TYPE__TABLE){
+ handle->execHandle.execTb.suid = req->suid;
+ handle->execHandle.execTb.qmsg = taosStrdup(req->qmsg);
+ }
+
+ handle->snapshotVer = walGetLastVer(pTq->pVnode->pWal);
+
+ if(buildHandle(pTq, handle) < 0){
+ return -1;
+ }
+ tqDebug("tq restore %s consumer %" PRId64 " vgId:%d", handle->subKey, handle->consumerId, vgId);
+ return taosHashPut(pTq->pHandle, handle->subKey, strlen(handle->subKey), handle, sizeof(STqHandle));
+}
+
int32_t tqMetaRestoreHandle(STQ* pTq) {
int code = 0;
TBC* pCur = NULL;
@@ -281,97 +395,40 @@ int32_t tqMetaRestoreHandle(STQ* pTq) {
return -1;
}
- int32_t vgId = TD_VID(pTq->pVnode);
void* pKey = NULL;
int kLen = 0;
void* pVal = NULL;
int vLen = 0;
- SDecoder decoder;
tdbTbcMoveToFirst(pCur);
while (tdbTbcNext(pCur, &pKey, &kLen, &pVal, &vLen) == 0) {
STqHandle handle = {0};
- tDecoderInit(&decoder, (uint8_t*)pVal, vLen);
- tDecodeSTqHandle(&decoder, &handle);
- tDecoderClear(&decoder);
-
- handle.pRef = walOpenRef(pTq->pVnode->pWal);
- if (handle.pRef == NULL) {
- code = -1;
- goto end;
+ code = restoreHandle(pTq, pVal, vLen, &handle);
+ if (code < 0){
+ tqDestroyTqHandle(&handle);
+ break;
}
- walSetRefVer(handle.pRef, handle.snapshotVer);
-
- SReadHandle reader = {
- .vnode = pTq->pVnode,
- .initTableReader = true,
- .initTqReader = true,
- .version = handle.snapshotVer
- };
-
- initStorageAPI(&reader.api);
-
- if (handle.execHandle.subType == TOPIC_SUB_TYPE__COLUMN) {
- handle.execHandle.task =
- qCreateQueueExecTaskInfo(handle.execHandle.execCol.qmsg, &reader, vgId, &handle.execHandle.numOfCols, 0);
- if (handle.execHandle.task == NULL) {
- tqError("cannot create exec task for %s", handle.subKey);
- code = -1;
- goto end;
- }
- void* scanner = NULL;
- qExtractStreamScanner(handle.execHandle.task, &scanner);
- if (scanner == NULL) {
- tqError("cannot extract stream scanner for %s", handle.subKey);
- code = -1;
- goto end;
- }
- handle.execHandle.pTqReader = qExtractReaderFromStreamScanner(scanner);
- if (handle.execHandle.pTqReader == NULL) {
- tqError("cannot extract exec reader for %s", handle.subKey);
- code = -1;
- goto end;
- }
- } else if (handle.execHandle.subType == TOPIC_SUB_TYPE__DB) {
- handle.pWalReader = walOpenReader(pTq->pVnode->pWal, NULL);
- handle.execHandle.pTqReader = tqReaderOpen(pTq->pVnode);
-
- buildSnapContext(reader.vnode, reader.version, 0, handle.execHandle.subType, handle.fetchMeta,
- (SSnapContext**)(&reader.sContext));
- handle.execHandle.task = qCreateQueueExecTaskInfo(NULL, &reader, vgId, NULL, 0);
- } else if (handle.execHandle.subType == TOPIC_SUB_TYPE__TABLE) {
- handle.pWalReader = walOpenReader(pTq->pVnode->pWal, NULL);
-
- if(handle.execHandle.execTb.qmsg != NULL && strcmp(handle.execHandle.execTb.qmsg, "") != 0) {
- if (nodesStringToNode(handle.execHandle.execTb.qmsg, &handle.execHandle.execTb.node) != 0) {
- tqError("nodesStringToNode error in sub stable, since %s", terrstr());
- return -1;
- }
- }
- buildSnapContext(reader.vnode, reader.version, handle.execHandle.execTb.suid, handle.execHandle.subType,
- handle.fetchMeta, (SSnapContext**)(&reader.sContext));
- handle.execHandle.task = qCreateQueueExecTaskInfo(NULL, &reader, vgId, NULL, 0);
-
- SArray* tbUidList = NULL;
- int ret = qGetTableList(handle.execHandle.execTb.suid, pTq->pVnode, handle.execHandle.execTb.node, &tbUidList, handle.execHandle.task);
- if(ret != TDB_CODE_SUCCESS) {
- tqError("qGetTableList error:%d handle %s consumer:0x%" PRIx64, ret, handle.subKey, handle.consumerId);
- taosArrayDestroy(tbUidList);
- goto end;
- }
- tqDebug("vgId:%d, tq try to get ctb for stb subscribe, suid:%" PRId64, pTq->pVnode->config.vgId, handle.execHandle.execTb.suid);
- handle.execHandle.pTqReader = tqReaderOpen(pTq->pVnode);
- tqReaderSetTbUidList(handle.execHandle.pTqReader, tbUidList, NULL);
- taosArrayDestroy(tbUidList);
- }
- tqDebug("tq restore %s consumer %" PRId64 " vgId:%d", handle.subKey, handle.consumerId, vgId);
- taosHashPut(pTq->pHandle, pKey, kLen, &handle, sizeof(STqHandle));
}
-end:
tdbFree(pKey);
tdbFree(pVal);
tdbTbcClose(pCur);
return code;
}
+
+int32_t tqMetaGetHandle(STQ* pTq, const char* key) {
+ void* pVal = NULL;
+ int vLen = 0;
+
+ if (tdbTbGet(pTq->pExecStore, key, (int)strlen(key), &pVal, &vLen) < 0) {
+ return -1;
+ }
+ STqHandle handle = {0};
+ int code = restoreHandle(pTq, pVal, vLen, &handle);
+ if (code < 0){
+ tqDestroyTqHandle(&handle);
+ }
+ tdbFree(pVal);
+ return code;
+}
diff --git a/source/dnode/vnode/src/tq/tqSink.c b/source/dnode/vnode/src/tq/tqSink.c
index db1b5ed902..9349c6eb0d 100644
--- a/source/dnode/vnode/src/tq/tqSink.c
+++ b/source/dnode/vnode/src/tq/tqSink.c
@@ -298,10 +298,8 @@ void tqSinkToTablePipeline(SStreamTask* pTask, void* vnode, int64_t ver, void* d
if (res == TSDB_CODE_SUCCESS) {
memcpy(ctbName, pTableSinkInfo->tbName, strlen(pTableSinkInfo->tbName));
} else {
- char* tmp = buildCtbNameByGroupId(stbFullName, pDataBlock->info.id.groupId);
- memcpy(ctbName, tmp, strlen(tmp));
- memcpy(pTableSinkInfo->tbName, tmp, strlen(tmp));
- taosMemoryFree(tmp);
+ buildCtbNameByGroupIdImpl(stbFullName, pDataBlock->info.id.groupId, ctbName);
+ memcpy(pTableSinkInfo->tbName, ctbName, strlen(ctbName));
tqDebug("vgId:%d, gropuId:%" PRIu64 " datablock table name is null", TD_VID(pVnode),
pDataBlock->info.id.groupId);
}
diff --git a/source/dnode/vnode/src/tq/tqUtil.c b/source/dnode/vnode/src/tq/tqUtil.c
index beb915d2a7..b6a1d9840d 100644
--- a/source/dnode/vnode/src/tq/tqUtil.c
+++ b/source/dnode/vnode/src/tq/tqUtil.c
@@ -99,15 +99,15 @@ static int32_t extractResetOffsetVal(STqOffsetVal* pOffsetVal, STQ* pTq, STqHand
if (pOffset != NULL) {
*pOffsetVal = pOffset->val;
- char formatBuf[80];
- tFormatOffset(formatBuf, 80, pOffsetVal);
+ char formatBuf[TSDB_OFFSET_LEN];
+ tFormatOffset(formatBuf, TSDB_OFFSET_LEN, pOffsetVal);
tqDebug("tmq poll: consumer:0x%" PRIx64
", subkey %s, vgId:%d, existed offset found, offset reset to %s and continue. reqId:0x%" PRIx64,
consumerId, pHandle->subKey, vgId, formatBuf, pRequest->reqId);
return 0;
} else {
// no poll occurs in this vnode for this topic, let's seek to the right offset value.
- if (reqOffset.type == TMQ_OFFSET__RESET_EARLIEAST) {
+ if (reqOffset.type == TMQ_OFFSET__RESET_EARLIEST) {
if (pRequest->useSnapshot) {
tqDebug("tmq poll: consumer:0x%" PRIx64 ", subkey:%s, vgId:%d, (earliest) set offset to be snapshot",
consumerId, pHandle->subKey, vgId);
@@ -188,7 +188,12 @@ static int32_t extractDataAndRspForNormalSubscribe(STQ* pTq, STqHandle* pHandle,
code = tqSendDataRsp(pHandle, pMsg, pRequest, (SMqDataRsp*)&dataRsp, TMQ_MSG_TYPE__POLL_RSP, vgId);
-end :
+end : {
+ char buf[TSDB_OFFSET_LEN] = {0};
+ tFormatOffset(buf, TSDB_OFFSET_LEN, &dataRsp.rspOffset);
+ tqDebug("tmq poll: consumer:0x%" PRIx64 ", subkey %s, vgId:%d, rsp block:%d, rsp offset type:%s, reqId:0x%" PRIx64
+ " code:%d",
+ consumerId, pHandle->subKey, vgId, dataRsp.blockNum, buf, pRequest->reqId, code);
tDeleteMqDataRsp(&dataRsp);
return code;
}
diff --git a/source/dnode/vnode/src/vnd/vnodeCfg.c b/source/dnode/vnode/src/vnd/vnodeCfg.c
index faa4d2fc57..efe82e1783 100644
--- a/source/dnode/vnode/src/vnd/vnodeCfg.c
+++ b/source/dnode/vnode/src/vnd/vnodeCfg.c
@@ -325,7 +325,7 @@ int vnodeValidateTableHash(SVnode *pVnode, char *tableFName) {
if (hashValue < pVnode->config.hashBegin || hashValue > pVnode->config.hashEnd) {
terrno = TSDB_CODE_VND_HASH_MISMATCH;
- return TSDB_CODE_VND_HASH_MISMATCH;
+ return -1;
}
return 0;
diff --git a/source/dnode/vnode/src/vnd/vnodeInitApi.c b/source/dnode/vnode/src/vnd/vnodeInitApi.c
index 526b9b4e2d..d2db6368a2 100644
--- a/source/dnode/vnode/src/vnd/vnodeInitApi.c
+++ b/source/dnode/vnode/src/vnd/vnodeInitApi.c
@@ -13,10 +13,10 @@
* along with this program. If not, see .
*/
-#include "storageapi.h"
-#include "vnodeInt.h"
-#include "tstreamUpdate.h"
#include "meta.h"
+#include "storageapi.h"
+#include "tstreamUpdate.h"
+#include "vnodeInt.h"
static void initTsdbReaderAPI(TsdReader* pReader);
static void initMetadataAPI(SStoreMeta* pMeta);
@@ -56,10 +56,10 @@ void initTsdbReaderAPI(TsdReader* pReader) {
pReader->tsdReaderResetStatus = tsdbReaderReset;
pReader->tsdReaderGetDataBlockDistInfo = tsdbGetFileBlocksDistInfo;
- pReader->tsdReaderGetNumOfInMemRows = tsdbGetNumOfRowsInMemTable; // todo this function should be moved away
+ pReader->tsdReaderGetNumOfInMemRows = tsdbGetNumOfRowsInMemTable; // todo this function should be moved away
pReader->tsdSetQueryTableList = tsdbSetTableList;
- pReader->tsdSetReaderTaskId = (void (*)(void *, const char *))tsdbReaderSetId;
+ pReader->tsdSetReaderTaskId = (void (*)(void*, const char*))tsdbReaderSetId;
}
void initMetadataAPI(SStoreMeta* pMeta) {
@@ -67,6 +67,8 @@ void initMetadataAPI(SStoreMeta* pMeta) {
pMeta->openTableMetaCursor = metaOpenTbCursor;
pMeta->closeTableMetaCursor = metaCloseTbCursor;
+ pMeta->pauseTableMetaCursor = metaPauseTbCursor;
+ pMeta->resumeTableMetaCursor = metaResumeTbCursor;
pMeta->cursorNext = metaTbCursorNext;
pMeta->cursorPrev = metaTbCursorPrev;
@@ -78,7 +80,7 @@ void initMetadataAPI(SStoreMeta* pMeta) {
pMeta->storeGetIndexInfo = vnodeGetIdx;
pMeta->getInvertIndex = vnodeGetIvtIdx;
- pMeta->extractTagVal = (const void *(*)(const void *, int16_t, STagVal *))metaGetTableTagVal;
+ pMeta->extractTagVal = (const void* (*)(const void*, int16_t, STagVal*))metaGetTableTagVal;
pMeta->getTableTags = metaGetTableTags;
pMeta->getTableTagsByUid = metaGetTableTagsByUids;
@@ -86,7 +88,7 @@ void initMetadataAPI(SStoreMeta* pMeta) {
pMeta->getTableTypeByName = metaGetTableTypeByName;
pMeta->getTableNameByUid = metaGetTableNameByUid;
- pMeta->getTableSchema = tsdbGetTableSchema; // todo refactor
+ pMeta->getTableSchema = tsdbGetTableSchema; // todo refactor
pMeta->storeGetTableList = vnodeGetTableList;
pMeta->getCachedTableList = metaGetCachedTableUidList;
@@ -106,7 +108,7 @@ void initTqAPI(SStoreTqReader* pTq) {
pTq->tqReaderNextBlockInWal = tqNextBlockInWal;
- pTq->tqNextBlockImpl = tqNextBlockImpl;// todo remove it
+ pTq->tqNextBlockImpl = tqNextBlockImpl; // todo remove it
pTq->tqReaderAddTables = tqReaderAddTbUidList;
pTq->tqReaderSetQueryTableList = tqReaderSetTbUidList;
@@ -116,10 +118,10 @@ void initTqAPI(SStoreTqReader* pTq) {
pTq->tqReaderIsQueriedTable = tqReaderIsQueriedTable;
pTq->tqReaderCurrentBlockConsumed = tqCurrentBlockConsumed;
- pTq->tqReaderGetWalReader = tqGetWalReader; // todo remove it
- pTq->tqReaderRetrieveTaosXBlock = tqRetrieveTaosxBlock; // todo remove it
+ pTq->tqReaderGetWalReader = tqGetWalReader; // todo remove it
+ pTq->tqReaderRetrieveTaosXBlock = tqRetrieveTaosxBlock; // todo remove it
- pTq->tqReaderSetSubmitMsg = tqReaderSetSubmitMsg; // todo remove it
+ pTq->tqReaderSetSubmitMsg = tqReaderSetSubmitMsg; // todo remove it
pTq->tqGetResultBlock = tqGetResultBlock;
pTq->tqReaderNextBlockFilterOut = tqNextDataBlockFilterOut;
@@ -199,7 +201,7 @@ void initStateStoreAPI(SStateStore* pStore) {
pStore->streamStateClose = streamStateClose;
pStore->streamStateBegin = streamStateBegin;
pStore->streamStateCommit = streamStateCommit;
- pStore->streamStateDestroy= streamStateDestroy;
+ pStore->streamStateDestroy = streamStateDestroy;
pStore->streamStateDeleteCheckPoint = streamStateDeleteCheckPoint;
}
@@ -239,4 +241,4 @@ void initSnapshotFn(SStoreSnapshotFn* pSnapshot) {
pSnapshot->destroySnapshot = destroySnapContext;
pSnapshot->getMetaTableInfoFromSnapshot = getMetaTableInfoFromSnapshot;
pSnapshot->getTableInfoFromSnapshot = getTableInfoFromSnapshot;
-}
\ No newline at end of file
+}
diff --git a/source/dnode/vnode/src/vnd/vnodeOpen.c b/source/dnode/vnode/src/vnd/vnodeOpen.c
index b5e7c6875b..0655a46388 100644
--- a/source/dnode/vnode/src/vnd/vnodeOpen.c
+++ b/source/dnode/vnode/src/vnd/vnodeOpen.c
@@ -129,6 +129,12 @@ int32_t vnodeAlterReplica(const char *path, SAlterVnodeReplicaReq *pReq, STfs *p
return 0;
}
+static int32_t vnodeVgroupIdLen(int32_t vgId) {
+ char tmp[TSDB_FILENAME_LEN];
+ sprintf(tmp, "%d", vgId);
+ return strlen(tmp);
+}
+
int32_t vnodeRenameVgroupId(const char *srcPath, const char *dstPath, int32_t srcVgId, int32_t dstVgId, STfs *pTfs) {
int32_t ret = tfsRename(pTfs, srcPath, dstPath);
if (ret != 0) return ret;
@@ -154,8 +160,7 @@ int32_t vnodeRenameVgroupId(const char *srcPath, const char *dstPath, int32_t sr
int32_t tsdbFileVgId = atoi(tsdbFilePrefixPos + 6);
if (tsdbFileVgId == srcVgId) {
- char *tsdbFileSurfixPos = strstr(tsdbFilePrefixPos, "f");
- if (tsdbFileSurfixPos == NULL) continue;
+ char *tsdbFileSurfixPos = tsdbFilePrefixPos + 6 + vnodeVgroupIdLen(srcVgId);
tsdbFilePrefixPos[6] = 0;
snprintf(newRname, TSDB_FILENAME_LEN, "%s%d%s", oldRname, dstVgId, tsdbFileSurfixPos);
diff --git a/source/dnode/vnode/src/vnd/vnodeSvr.c b/source/dnode/vnode/src/vnd/vnodeSvr.c
index 7af78c02a6..c2e577848b 100644
--- a/source/dnode/vnode/src/vnd/vnodeSvr.c
+++ b/source/dnode/vnode/src/vnd/vnodeSvr.c
@@ -1484,6 +1484,7 @@ static int32_t vnodeConsolidateAlterHashRange(SVnode *pVnode, int64_t ver) {
pVnode->config.hashBegin, pVnode->config.hashEnd, ver);
// TODO: trim meta of tables from TDB per hash range [pVnode->config.hashBegin, pVnode->config.hashEnd]
+ code = metaTrimTables(pVnode->pMeta);
return code;
}
diff --git a/source/dnode/vnode/src/vnd/vnodeSync.c b/source/dnode/vnode/src/vnd/vnodeSync.c
index 29f1ddc50f..ff551e6534 100644
--- a/source/dnode/vnode/src/vnd/vnodeSync.c
+++ b/source/dnode/vnode/src/vnd/vnodeSync.c
@@ -431,7 +431,7 @@ static int32_t vnodeSyncApplyMsg(const SSyncFSM *pFsm, SRpcMsg *pMsg, const SFsm
return tmsgPutToQueue(&pVnode->msgCb, APPLY_QUEUE, pMsg);
}
-static int32_t vnodeSyncCommitMsg(const SSyncFSM *pFsm, SRpcMsg *pMsg, const SFsmCbMeta *pMeta) {
+static int32_t vnodeSyncCommitMsg(const SSyncFSM *pFsm, SRpcMsg *pMsg, SFsmCbMeta *pMeta) {
if (pMsg->code == 0) {
return vnodeSyncApplyMsg(pFsm, pMsg, pMeta);
}
@@ -451,7 +451,7 @@ static int32_t vnodeSyncCommitMsg(const SSyncFSM *pFsm, SRpcMsg *pMsg, const SFs
return 0;
}
-static int32_t vnodeSyncPreCommitMsg(const SSyncFSM *pFsm, SRpcMsg *pMsg, const SFsmCbMeta *pMeta) {
+static int32_t vnodeSyncPreCommitMsg(const SSyncFSM *pFsm, SRpcMsg *pMsg, SFsmCbMeta *pMeta) {
if (pMeta->isWeak == 1) {
return vnodeSyncApplyMsg(pFsm, pMsg, pMeta);
}
@@ -463,7 +463,7 @@ static SyncIndex vnodeSyncAppliedIndex(const SSyncFSM *pFSM) {
return atomic_load_64(&pVnode->state.applied);
}
-static void vnodeSyncRollBackMsg(const SSyncFSM *pFsm, SRpcMsg *pMsg, const SFsmCbMeta *pMeta) {
+static void vnodeSyncRollBackMsg(const SSyncFSM *pFsm, SRpcMsg *pMsg, SFsmCbMeta *pMeta) {
SVnode *pVnode = pFsm->data;
vTrace("vgId:%d, rollback-cb is excuted, fsm:%p, index:%" PRId64 ", weak:%d, code:%d, state:%d %s, type:%s",
pVnode->config.vgId, pFsm, pMeta->index, pMeta->isWeak, pMeta->code, pMeta->state, syncStr(pMeta->state),
diff --git a/source/libs/catalog/src/ctgUtil.c b/source/libs/catalog/src/ctgUtil.c
index 89502fa9e4..e7abbc5ead 100644
--- a/source/libs/catalog/src/ctgUtil.c
+++ b/source/libs/catalog/src/ctgUtil.c
@@ -1593,10 +1593,13 @@ int32_t ctgChkSetAuthRes(SCatalog* pCtg, SCtgAuthReq* req, SCtgAuthRsp* res) {
char dbFName[TSDB_DB_FNAME_LEN];
tNameGetFullDbName(&pReq->tbName, dbFName);
+ // since that we add read/write previliges when create db, there is no need to check createdDbs
+#if 0
if (pInfo->createdDbs && taosHashGet(pInfo->createdDbs, dbFName, strlen(dbFName))) {
pRes->pass = true;
return TSDB_CODE_SUCCESS;
}
+#endif
switch (pReq->type) {
case AUTH_TYPE_READ: {
diff --git a/source/libs/executor/src/groupoperator.c b/source/libs/executor/src/groupoperator.c
index a1d3086643..e3292bb063 100644
--- a/source/libs/executor/src/groupoperator.c
+++ b/source/libs/executor/src/groupoperator.c
@@ -647,6 +647,8 @@ uint64_t calcGroupId(char* pData, int32_t len) {
// NOTE: only extract the initial 8 bytes of the final MD5 digest
uint64_t id = 0;
memcpy(&id, context.digest, sizeof(uint64_t));
+ if (0 == id)
+ memcpy(&id, context.digest + 8, sizeof(uint64_t));
return id;
}
diff --git a/source/libs/executor/src/joinoperator.c b/source/libs/executor/src/joinoperator.c
index 442f8162ed..73143fdba7 100644
--- a/source/libs/executor/src/joinoperator.c
+++ b/source/libs/executor/src/joinoperator.c
@@ -319,6 +319,11 @@ void destroyMergeJoinOperator(void* param) {
}
nodesDestroyNode(pJoinOperator->pCondAfterMerge);
+ taosArrayDestroy(pJoinOperator->rowCtx.leftCreatedBlocks);
+ taosArrayDestroy(pJoinOperator->rowCtx.rightCreatedBlocks);
+ taosArrayDestroy(pJoinOperator->rowCtx.leftRowLocations);
+ taosArrayDestroy(pJoinOperator->rowCtx.rightRowLocations);
+
pJoinOperator->pRes = blockDataDestroy(pJoinOperator->pRes);
taosMemoryFreeClear(param);
}
diff --git a/source/libs/executor/src/projectoperator.c b/source/libs/executor/src/projectoperator.c
index dde6f7c0e8..e7de826d4b 100644
--- a/source/libs/executor/src/projectoperator.c
+++ b/source/libs/executor/src/projectoperator.c
@@ -213,6 +213,8 @@ static int32_t doIngroupLimitOffset(SLimitInfo* pLimitInfo, uint64_t groupId, SS
} else {
if (limitReached && (pLimitInfo->slimit.limit >= 0 && pLimitInfo->slimit.limit <= pLimitInfo->numOfOutputGroups)) {
setOperatorCompleted(pOperator);
+ } else if (limitReached && groupId == 0) {
+ setOperatorCompleted(pOperator);
}
}
diff --git a/source/libs/executor/src/sortoperator.c b/source/libs/executor/src/sortoperator.c
index 0357828732..0395b9ec08 100644
--- a/source/libs/executor/src/sortoperator.c
+++ b/source/libs/executor/src/sortoperator.c
@@ -153,6 +153,7 @@ SSDataBlock* getSortedBlockData(SSortHandle* pHandle, SSDataBlock* pDataBlock, i
colDataAssign(pDst, pSrc, p->info.rows, &pDataBlock->info);
}
+ pDataBlock->info.dataLoad = 1;
pDataBlock->info.rows = p->info.rows;
}
diff --git a/source/libs/executor/src/sysscanoperator.c b/source/libs/executor/src/sysscanoperator.c
index fd766e21f8..23a7d2c9e9 100644
--- a/source/libs/executor/src/sysscanoperator.c
+++ b/source/libs/executor/src/sysscanoperator.c
@@ -25,6 +25,7 @@
#include "tdatablock.h"
#include "tmsg.h"
+#include "index.h"
#include "operator.h"
#include "query.h"
#include "querytask.h"
@@ -32,7 +33,6 @@
#include "tcompare.h"
#include "thash.h"
#include "ttypes.h"
-#include "index.h"
typedef int (*__optSysFilter)(void* a, void* b, int16_t dtype);
typedef int32_t (*__sys_filte)(void* pMeta, SNode* cond, SArray* result);
@@ -540,12 +540,12 @@ static SSDataBlock* sysTableScanUserCols(SOperatorInfo* pOperator) {
int32_t restore = pInfo->restore;
pInfo->restore = false;
-
+
while (restore || ((ret = pAPI->metaFn.cursorNext(pInfo->pCur, TSDB_TABLE_MAX)) == 0)) {
if (restore) {
restore = false;
}
-
+
char typeName[TSDB_TABLE_FNAME_LEN + VARSTR_HEADER_SIZE] = {0};
char tableName[TSDB_TABLE_NAME_LEN + VARSTR_HEADER_SIZE] = {0};
@@ -626,8 +626,8 @@ static SSDataBlock* sysTableScanUserCols(SOperatorInfo* pOperator) {
}
static SSDataBlock* sysTableScanUserTags(SOperatorInfo* pOperator) {
- SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
- SStorageAPI* pAPI = &pTaskInfo->storageAPI;
+ SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
+ SStorageAPI* pAPI = &pTaskInfo->storageAPI;
SSysTableScanInfo* pInfo = pOperator->info;
if (pOperator->status == OP_EXEC_DONE) {
@@ -1100,8 +1100,8 @@ int32_t buildSysDbTableInfo(const SSysTableScanInfo* pInfo, int32_t capacity) {
}
static SSDataBlock* sysTableBuildUserTablesByUids(SOperatorInfo* pOperator) {
- SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
- SStorageAPI* pAPI = &pTaskInfo->storageAPI;
+ SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
+ SStorageAPI* pAPI = &pTaskInfo->storageAPI;
SSysTableScanInfo* pInfo = pOperator->info;
@@ -1288,11 +1288,16 @@ static SSDataBlock* sysTableBuildUserTablesByUids(SOperatorInfo* pOperator) {
static SSDataBlock* sysTableBuildUserTables(SOperatorInfo* pOperator) {
SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
- SStorageAPI* pAPI = &pTaskInfo->storageAPI;
+ SStorageAPI* pAPI = &pTaskInfo->storageAPI;
+ int8_t firstMetaCursor = 0;
SSysTableScanInfo* pInfo = pOperator->info;
if (pInfo->pCur == NULL) {
pInfo->pCur = pAPI->metaFn.openTableMetaCursor(pInfo->readHandle.vnode);
+ firstMetaCursor = 1;
+ }
+ if (!firstMetaCursor) {
+ pAPI->metaFn.resumeTableMetaCursor(pInfo->pCur, 0);
}
blockDataCleanup(pInfo->pRes);
@@ -1436,12 +1441,14 @@ static SSDataBlock* sysTableBuildUserTables(SOperatorInfo* pOperator) {
numOfRows = 0;
if (pInfo->pRes->info.rows > 0) {
+ pAPI->metaFn.pauseTableMetaCursor(pInfo->pCur);
break;
}
}
}
if (numOfRows > 0) {
+ pAPI->metaFn.pauseTableMetaCursor(pInfo->pCur);
p->info.rows = numOfRows;
pInfo->pRes->info.rows = numOfRows;
@@ -1485,7 +1492,8 @@ static SSDataBlock* sysTableScanUserTables(SOperatorInfo* pOperator) {
} else {
if (pInfo->showRewrite == false) {
if (pCondition != NULL && pInfo->pIdx == NULL) {
- SSTabFltArg arg = {.pMeta = pInfo->readHandle.vnode, .pVnode = pInfo->readHandle.vnode, .pAPI = &pTaskInfo->storageAPI};
+ SSTabFltArg arg = {
+ .pMeta = pInfo->readHandle.vnode, .pVnode = pInfo->readHandle.vnode, .pAPI = &pTaskInfo->storageAPI};
SSysTableIndex* idx = taosMemoryMalloc(sizeof(SSysTableIndex));
idx->init = 0;
@@ -1827,7 +1835,7 @@ void destroySysScanOperator(void* param) {
pInfo->pIdx = NULL;
}
- if(pInfo->pSchema) {
+ if (pInfo->pSchema) {
taosHashCleanup(pInfo->pSchema);
pInfo->pSchema = NULL;
}
@@ -2144,7 +2152,7 @@ static int32_t optSysTabFilte(void* arg, SNode* cond, SArray* result) {
return -1;
}
-static int32_t doGetTableRowSize(SReadHandle *pHandle, uint64_t uid, int32_t* rowLen, const char* idstr) {
+static int32_t doGetTableRowSize(SReadHandle* pHandle, uint64_t uid, int32_t* rowLen, const char* idstr) {
*rowLen = 0;
SMetaReader mr = {0};
@@ -2194,17 +2202,17 @@ static SSDataBlock* doBlockInfoScan(SOperatorInfo* pOperator) {
SBlockDistInfo* pBlockScanInfo = pOperator->info;
SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
- SStorageAPI* pAPI = &pTaskInfo->storageAPI;
+ SStorageAPI* pAPI = &pTaskInfo->storageAPI;
STableBlockDistInfo blockDistInfo = {.minRows = INT_MAX, .maxRows = INT_MIN};
- int32_t code = doGetTableRowSize(&pBlockScanInfo->readHandle, pBlockScanInfo->uid,
- (int32_t*)&blockDistInfo.rowSize, GET_TASKID(pTaskInfo));
+ int32_t code = doGetTableRowSize(&pBlockScanInfo->readHandle, pBlockScanInfo->uid, (int32_t*)&blockDistInfo.rowSize,
+ GET_TASKID(pTaskInfo));
if (code != TSDB_CODE_SUCCESS) {
T_LONG_JMP(pTaskInfo->env, code);
}
pAPI->tsdReader.tsdReaderGetDataBlockDistInfo(pBlockScanInfo->pHandle, &blockDistInfo);
- blockDistInfo.numOfInmemRows = (int32_t) pAPI->tsdReader.tsdReaderGetNumOfInMemRows(pBlockScanInfo->pHandle);
+ blockDistInfo.numOfInmemRows = (int32_t)pAPI->tsdReader.tsdReaderGetNumOfInMemRows(pBlockScanInfo->pHandle);
SSDataBlock* pBlock = pBlockScanInfo->pResBlock;
@@ -2289,7 +2297,8 @@ SOperatorInfo* createDataBlockInfoScanOperator(SReadHandle* readHandle, SBlockDi
size_t num = tableListGetSize(pTableListInfo);
void* pList = tableListGetInfo(pTableListInfo, 0);
- code = readHandle->api.tsdReader.tsdReaderOpen(readHandle->vnode, &cond, pList, num, pInfo->pResBlock, (void**)&pInfo->pHandle, pTaskInfo->id.str, false, NULL);
+ code = readHandle->api.tsdReader.tsdReaderOpen(readHandle->vnode, &cond, pList, num, pInfo->pResBlock,
+ (void**)&pInfo->pHandle, pTaskInfo->id.str, false, NULL);
cleanupQueryTableDataCond(&cond);
if (code != 0) {
goto _error;
@@ -2316,4 +2325,4 @@ _error:
taosMemoryFreeClear(pInfo);
taosMemoryFreeClear(pOperator);
return NULL;
-}
\ No newline at end of file
+}
diff --git a/source/libs/executor/src/timesliceoperator.c b/source/libs/executor/src/timesliceoperator.c
index 3e4055876d..2421343bd7 100644
--- a/source/libs/executor/src/timesliceoperator.c
+++ b/source/libs/executor/src/timesliceoperator.c
@@ -257,7 +257,8 @@ static bool genInterpolationResult(STimeSliceOperatorInfo* pSliceInfo, SExprSupp
// output the result
- bool hasInterp = true;
+ int32_t fillColIndex = 0;
+ bool hasInterp = true;
for (int32_t j = 0; j < pExprSup->numOfExprs; ++j) {
SExprInfo* pExprInfo = &pExprSup->pExprInfo[j];
@@ -307,7 +308,7 @@ static bool genInterpolationResult(STimeSliceOperatorInfo* pSliceInfo, SExprSupp
case TSDB_FILL_SET_VALUE:
case TSDB_FILL_SET_VALUE_F: {
- SVariant* pVar = &pSliceInfo->pFillColInfo[j].fillVal;
+ SVariant* pVar = &pSliceInfo->pFillColInfo[fillColIndex].fillVal;
if (pDst->info.type == TSDB_DATA_TYPE_FLOAT) {
float v = 0;
@@ -342,6 +343,8 @@ static bool genInterpolationResult(STimeSliceOperatorInfo* pSliceInfo, SExprSupp
}
colDataSetVal(pDst, rows, (char*)&v, false);
}
+
+ ++fillColIndex;
break;
}
diff --git a/source/libs/executor/src/timewindowoperator.c b/source/libs/executor/src/timewindowoperator.c
index d6429fd121..2676e097f9 100644
--- a/source/libs/executor/src/timewindowoperator.c
+++ b/source/libs/executor/src/timewindowoperator.c
@@ -2345,7 +2345,7 @@ static void doStreamIntervalAggImpl(SOperatorInfo* pOperatorInfo, SSDataBlock* p
}
while (1) {
bool isClosed = isCloseWindow(&nextWin, &pInfo->twAggSup);
- if ((pInfo->ignoreExpiredData && isClosed) || !inSlidingWindow(&pInfo->interval, &nextWin, &pSDataBlock->info)) {
+ if ((pInfo->ignoreExpiredData && isClosed && !IS_FINAL_OP(pInfo)) || !inSlidingWindow(&pInfo->interval, &nextWin, &pSDataBlock->info)) {
startPos = getNexWindowPos(&pInfo->interval, &pSDataBlock->info, tsCols, startPos, nextWin.ekey, &nextWin);
if (startPos < 0) {
break;
diff --git a/source/libs/executor/src/tsort.c b/source/libs/executor/src/tsort.c
index 783597df67..3033441aad 100644
--- a/source/libs/executor/src/tsort.c
+++ b/source/libs/executor/src/tsort.c
@@ -101,7 +101,11 @@ static int32_t sortComparCleanup(SMsortComparParam* cmpParam) {
for (int32_t i = 0; i < cmpParam->numOfSources; ++i) {
SSortSource* pSource = cmpParam->pSources[i];
blockDataDestroy(pSource->src.pBlock);
+ if (pSource->pageIdList) {
+ taosArrayDestroy(pSource->pageIdList);
+ }
taosMemoryFreeClear(pSource);
+ cmpParam->pSources[i] = NULL;
}
cmpParam->numOfSources = 0;
@@ -123,9 +127,11 @@ void tsortClearOrderdSource(SArray* pOrderedSource, int64_t *fetchUs, int64_t *f
// release pageIdList
if ((*pSource)->pageIdList) {
taosArrayDestroy((*pSource)->pageIdList);
+ (*pSource)->pageIdList = NULL;
}
if ((*pSource)->param && !(*pSource)->onlyRef) {
taosMemoryFree((*pSource)->param);
+ (*pSource)->param = NULL;
}
if (!(*pSource)->onlyRef && (*pSource)->src.pBlock) {
diff --git a/source/libs/function/src/functionMgt.c b/source/libs/function/src/functionMgt.c
index 18f6e8050b..327bc7da71 100644
--- a/source/libs/function/src/functionMgt.c
+++ b/source/libs/function/src/functionMgt.c
@@ -344,7 +344,7 @@ static int32_t getFuncInfo(SFunctionNode* pFunc) {
return fmGetFuncInfo(pFunc, msg, sizeof(msg));
}
-static SFunctionNode* createFunction(const char* pName, SNodeList* pParameterList) {
+SFunctionNode* createFunction(const char* pName, SNodeList* pParameterList) {
SFunctionNode* pFunc = (SFunctionNode*)nodesMakeNode(QUERY_NODE_FUNCTION);
if (NULL == pFunc) {
return NULL;
diff --git a/source/libs/nodes/src/nodesCloneFuncs.c b/source/libs/nodes/src/nodesCloneFuncs.c
index ce77336510..a8e4f692ab 100644
--- a/source/libs/nodes/src/nodesCloneFuncs.c
+++ b/source/libs/nodes/src/nodesCloneFuncs.c
@@ -669,7 +669,7 @@ static int32_t selectStmtCopy(const SSelectStmt* pSrc, SSelectStmt* pDst) {
COPY_CHAR_ARRAY_FIELD(stmtName);
COPY_SCALAR_FIELD(precision);
COPY_SCALAR_FIELD(isEmptyResult);
- COPY_SCALAR_FIELD(isTimeLineResult);
+ COPY_SCALAR_FIELD(timeLineResMode);
COPY_SCALAR_FIELD(hasAggFuncs);
COPY_SCALAR_FIELD(hasRepeatScanFuncs);
return TSDB_CODE_SUCCESS;
diff --git a/source/libs/nodes/src/nodesMatchFuncs.c b/source/libs/nodes/src/nodesMatchFuncs.c
new file mode 100755
index 0000000000..401c7aad28
--- /dev/null
+++ b/source/libs/nodes/src/nodesMatchFuncs.c
@@ -0,0 +1,180 @@
+/*
+ * 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 "querynodes.h"
+
+#define MATCH_SCALAR_FIELD(fldname) \
+ do { \
+ if (p->fldname != pSub->fldname) return false; \
+ } while (0)
+
+#define MATCH_STRING(a, b) (((a) != NULL && (b) != NULL) ? (strcmp((a), (b)) == 0) : (a) == (b))
+
+#define MATCH_VARDATA(a, b) \
+ (((a) != NULL && (b) != NULL) \
+ ? (varDataLen((a)) == varDataLen((b)) && memcmp(varDataVal((a)), varDataVal((b)), varDataLen((a))) == 0) \
+ : (a) == (b))
+
+#define MATCH_STRING_FIELD(fldname) \
+ do { \
+ if (!MATCH_STRING(p->fldname, pSub->fldname)) return false; \
+ } while (0)
+
+#define MATCH_VARDATA_FIELD(fldname) \
+ do { \
+ if (!MATCH_VARDATA(p->fldname, pSub->fldname)) return false; \
+ } while (0)
+
+#define MATCH_OBJECT_FIELD(fldname, matchFunc) \
+ do { \
+ if (!matchFunc(p->fldname, pSub->fldname)) return false; \
+ } while (0)
+
+#define MATCH_NODE_FIELD(fldname) \
+ do { \
+ if (!nodesMatchNode(pSub->fldname, p->fldname)) return false; \
+ } while (0)
+
+#define MATCH_NODE_LIST_FIELD(fldname) \
+ do { \
+ if (!nodesListMatch(p->fldname, pSub->fldname)) return false; \
+ } while (0)
+
+
+bool nodesListMatchExists(const SNodeList* pList, const SNode* pTarget) {
+ if (NULL == pList || NULL == pTarget) {
+ return false;
+ }
+ SNode* node = NULL;
+ bool exists = false;
+ FOREACH(node, pList) {
+ if (nodesMatchNode(node, pTarget)) {
+ exists = true;
+ break;
+ }
+ }
+
+ return exists;
+}
+
+bool nodesListMatch(const SNodeList* pList, const SNodeList* pSubList) {
+ if (pList == pSubList) {
+ return true;
+ }
+
+ if (NULL == pList || NULL == pSubList) {
+ return false;
+ }
+
+ if (pList->length != pSubList->length) {
+ return false;
+ }
+
+ SNode* node = NULL;
+ bool match = true;
+ FOREACH(node, pList) {
+ if (!nodesListMatchExists(pSubList, node)) {
+ match = false;
+ break;
+ }
+ }
+ return match;
+}
+
+static bool columnNodeMatch(const SColumnNode* pSub, const SColumnNode* p) {
+ if (0 == strcmp(p->colName, pSub->node.aliasName)) {
+ return true;
+ }
+ return false;
+}
+
+static bool valueNodeMatch(const SValueNode* pSub, const SValueNode* p) {
+ return nodesEqualNode((SNode*)pSub, (SNode*)p);
+}
+
+static bool operatorNodeMatch(const SOperatorNode* pSub, const SOperatorNode* p) {
+ MATCH_SCALAR_FIELD(opType);
+ MATCH_NODE_FIELD(pLeft);
+ MATCH_NODE_FIELD(pRight);
+ return true;
+}
+
+static bool logicConditionNodeMatch(const SLogicConditionNode* pSub, const SLogicConditionNode* p) {
+ MATCH_SCALAR_FIELD(condType);
+ MATCH_NODE_LIST_FIELD(pParameterList);
+ return true;
+}
+
+static bool functionNodeMatch(const SFunctionNode* pSub, const SFunctionNode* p) {
+ MATCH_SCALAR_FIELD(funcId);
+ MATCH_STRING_FIELD(functionName);
+ MATCH_NODE_LIST_FIELD(pParameterList);
+ return true;
+}
+
+static bool whenThenNodeMatch(const SWhenThenNode* pSub, const SWhenThenNode* p) {
+ MATCH_NODE_FIELD(pWhen);
+ MATCH_NODE_FIELD(pThen);
+ return true;
+}
+
+static bool caseWhenNodeMatch(const SCaseWhenNode* pSub, const SCaseWhenNode* p) {
+ MATCH_NODE_FIELD(pCase);
+ MATCH_NODE_FIELD(pElse);
+ MATCH_NODE_LIST_FIELD(pWhenThenList);
+ return true;
+}
+
+bool nodesMatchNode(const SNode* pSub, const SNode* p) {
+ if (pSub == p) {
+ return true;
+ }
+
+ if (NULL == pSub || NULL == p) {
+ return false;
+ }
+
+ if (nodeType(pSub) != nodeType(p)) {
+ return false;
+ }
+
+ switch (nodeType(p)) {
+ case QUERY_NODE_COLUMN:
+ return columnNodeMatch((const SColumnNode*)pSub, (const SColumnNode*)p);
+ case QUERY_NODE_VALUE:
+ return valueNodeMatch((const SValueNode*)pSub, (const SValueNode*)p);
+ case QUERY_NODE_OPERATOR:
+ return operatorNodeMatch((const SOperatorNode*)pSub, (const SOperatorNode*)p);
+ case QUERY_NODE_LOGIC_CONDITION:
+ return logicConditionNodeMatch((const SLogicConditionNode*)pSub, (const SLogicConditionNode*)p);
+ case QUERY_NODE_FUNCTION:
+ return functionNodeMatch((const SFunctionNode*)pSub, (const SFunctionNode*)p);
+ case QUERY_NODE_WHEN_THEN:
+ return whenThenNodeMatch((const SWhenThenNode*)pSub, (const SWhenThenNode*)p);
+ case QUERY_NODE_CASE_WHEN:
+ return caseWhenNodeMatch((const SCaseWhenNode*)pSub, (const SCaseWhenNode*)p);
+ case QUERY_NODE_REAL_TABLE:
+ case QUERY_NODE_TEMP_TABLE:
+ case QUERY_NODE_JOIN_TABLE:
+ case QUERY_NODE_GROUPING_SET:
+ case QUERY_NODE_ORDER_BY_EXPR:
+ case QUERY_NODE_LIMIT:
+ return false;
+ default:
+ break;
+ }
+
+ return false;
+}
diff --git a/source/libs/nodes/src/nodesUtilFuncs.c b/source/libs/nodes/src/nodesUtilFuncs.c
index 39e288f694..15232b95b6 100644
--- a/source/libs/nodes/src/nodesUtilFuncs.c
+++ b/source/libs/nodes/src/nodesUtilFuncs.c
@@ -953,6 +953,8 @@ void nodesDestroyNode(SNode* pNode) {
nodesDestroyNode(pStmt->pQuery);
nodesDestroyList(pStmt->pTags);
nodesDestroyNode(pStmt->pSubtable);
+ tFreeSCMCreateStreamReq(pStmt->pReq);
+ taosMemoryFreeClear(pStmt->pReq);
break;
}
case QUERY_NODE_DROP_STREAM_STMT: // no pointer field
@@ -1052,6 +1054,7 @@ void nodesDestroyNode(SNode* pNode) {
case QUERY_NODE_QUERY: {
SQuery* pQuery = (SQuery*)pNode;
nodesDestroyNode(pQuery->pRoot);
+ nodesDestroyNode(pQuery->pPostRoot);
taosMemoryFreeClear(pQuery->pResSchema);
if (NULL != pQuery->pCmdMsg) {
taosMemoryFreeClear(pQuery->pCmdMsg->pMsg);
@@ -1953,9 +1956,9 @@ static uint32_t funcNodeHash(const char* pKey, uint32_t len) {
}
static int32_t funcNodeEqual(const void* pLeft, const void* pRight, size_t len) {
- if (0 != strcmp((*(const SExprNode**)pLeft)->aliasName, (*(const SExprNode**)pRight)->aliasName)) {
- return 1;
- }
+ // if (0 != strcmp((*(const SExprNode**)pLeft)->aliasName, (*(const SExprNode**)pRight)->aliasName)) {
+ // return 1;
+ // }
return nodesEqualNode(*(const SNode**)pLeft, *(const SNode**)pRight) ? 0 : 1;
}
diff --git a/source/libs/parser/inc/parAst.h b/source/libs/parser/inc/parAst.h
index 23fe7c2b19..ff394467f6 100644
--- a/source/libs/parser/inc/parAst.h
+++ b/source/libs/parser/inc/parAst.h
@@ -127,6 +127,7 @@ SNode* createIntervalWindowNode(SAstCreateContext* pCxt, SNode* pInterval, SNode
SNode* createFillNode(SAstCreateContext* pCxt, EFillMode mode, SNode* pValues);
SNode* createGroupingSetNode(SAstCreateContext* pCxt, SNode* pNode);
SNode* createInterpTimeRange(SAstCreateContext* pCxt, SNode* pStart, SNode* pEnd);
+SNode* createInterpTimePoint(SAstCreateContext* pCxt, SNode* pPoint);
SNode* createWhenThenNode(SAstCreateContext* pCxt, SNode* pWhen, SNode* pThen);
SNode* createCaseWhenNode(SAstCreateContext* pCxt, SNode* pCase, SNodeList* pWhenThenList, SNode* pElse);
diff --git a/source/libs/parser/inc/parInt.h b/source/libs/parser/inc/parInt.h
index 66aec272d7..d79aa84bb8 100644
--- a/source/libs/parser/inc/parInt.h
+++ b/source/libs/parser/inc/parInt.h
@@ -34,6 +34,7 @@ int32_t authenticate(SParseContext* pParseCxt, SQuery* pQuery, SParseMetaCache*
int32_t translate(SParseContext* pParseCxt, SQuery* pQuery, SParseMetaCache* pMetaCache);
int32_t extractResultSchema(const SNode* pRoot, int32_t* numOfCols, SSchema** pSchema);
int32_t calculateConstant(SParseContext* pParseCxt, SQuery* pQuery);
+int32_t translatePostCreateStream(SParseContext* pParseCxt, SQuery* pQuery, void** pResRow);
#ifdef __cplusplus
}
diff --git a/source/libs/parser/inc/parUtil.h b/source/libs/parser/inc/parUtil.h
index 9632ccf0fb..1a4ee3e91a 100644
--- a/source/libs/parser/inc/parUtil.h
+++ b/source/libs/parser/inc/parUtil.h
@@ -84,6 +84,7 @@ int32_t getNumOfColumns(const STableMeta* pTableMeta);
int32_t getNumOfTags(const STableMeta* pTableMeta);
STableComInfo getTableInfo(const STableMeta* pTableMeta);
STableMeta* tableMetaDup(const STableMeta* pTableMeta);
+int32_t getTableTypeFromTableNode(SNode *pTable);
int32_t trimString(const char* src, int32_t len, char* dst, int32_t dlen);
int32_t getVnodeSysTableTargetName(int32_t acctId, SNode* pWhere, SName* pName);
diff --git a/source/libs/parser/inc/sql.y b/source/libs/parser/inc/sql.y
index a161f90cf0..518dd95f23 100755
--- a/source/libs/parser/inc/sql.y
+++ b/source/libs/parser/inc/sql.y
@@ -1095,6 +1095,8 @@ having_clause_opt(A) ::= HAVING search_condition(B).
range_opt(A) ::= . { A = NULL; }
range_opt(A) ::=
RANGE NK_LP expr_or_subquery(B) NK_COMMA expr_or_subquery(C) NK_RP. { A = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, B), releaseRawExprNode(pCxt, C)); }
+range_opt(A) ::=
+ RANGE NK_LP expr_or_subquery(B) NK_RP. { A = createInterpTimePoint(pCxt, releaseRawExprNode(pCxt, B)); }
every_opt(A) ::= . { A = NULL; }
every_opt(A) ::= EVERY NK_LP duration_literal(B) NK_RP. { A = releaseRawExprNode(pCxt, B); }
diff --git a/source/libs/parser/src/parAstCreater.c b/source/libs/parser/src/parAstCreater.c
index d79071e5ad..e08153c341 100644
--- a/source/libs/parser/src/parAstCreater.c
+++ b/source/libs/parser/src/parAstCreater.c
@@ -704,6 +704,11 @@ SNode* createInterpTimeRange(SAstCreateContext* pCxt, SNode* pStart, SNode* pEnd
return createBetweenAnd(pCxt, createPrimaryKeyCol(pCxt, NULL), pStart, pEnd);
}
+SNode* createInterpTimePoint(SAstCreateContext* pCxt, SNode* pPoint) {
+ CHECK_PARSER_STATUS(pCxt);
+ return createOperatorNode(pCxt, OP_TYPE_EQUAL, createPrimaryKeyCol(pCxt, NULL), pPoint);
+}
+
SNode* createWhenThenNode(SAstCreateContext* pCxt, SNode* pWhen, SNode* pThen) {
CHECK_PARSER_STATUS(pCxt);
SWhenThenNode* pWhenThen = (SWhenThenNode*)nodesMakeNode(QUERY_NODE_WHEN_THEN);
diff --git a/source/libs/parser/src/parAstParser.c b/source/libs/parser/src/parAstParser.c
index 801d43e2a4..fdec9cba79 100644
--- a/source/libs/parser/src/parAstParser.c
+++ b/source/libs/parser/src/parAstParser.c
@@ -384,6 +384,10 @@ static int32_t collectMetaKeyFromCreateStream(SCollectMetaKeyCxt* pCxt, SCreateS
if (TSDB_CODE_SUCCESS == code) {
code = collectMetaKeyFromQuery(pCxt, pStmt->pQuery);
}
+ if (TSDB_CODE_SUCCESS == code && pStmt->pOptions->fillHistory) {
+ SSelectStmt* pSelect = (SSelectStmt*)pStmt->pQuery;
+ code = reserveDbCfgForLastRow(pCxt, pSelect->pFromTable);
+ }
return code;
}
diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c
index f5454dba23..824c2148b7 100644
--- a/source/libs/parser/src/parTranslater.c
+++ b/source/libs/parser/src/parTranslater.c
@@ -53,6 +53,8 @@ typedef struct STranslateContext {
bool createStream;
bool stableQuery;
bool showRewrite;
+ SNode* pPrevRoot;
+ SNode* pPostRoot;
} STranslateContext;
typedef struct SBuildTopicContext {
@@ -276,6 +278,10 @@ static const SSysTableShowAdapter sysTableShowAdapter[] = {
static int32_t translateSubquery(STranslateContext* pCxt, SNode* pNode);
static int32_t translateQuery(STranslateContext* pCxt, SNode* pNode);
static EDealRes translateValue(STranslateContext* pCxt, SValueNode* pVal);
+static int32_t createSimpleSelectStmtFromProjList(const char* pDb, const char* pTable, SNodeList* pProjectionList, SSelectStmt** pStmt);
+static int32_t createLastTsSelectStmt(char* pDb, char* pTable, STableMeta* pMeta, SNode** pQuery);
+static int32_t setQuery(STranslateContext* pCxt, SQuery* pQuery);
+static int32_t setRefreshMate(STranslateContext* pCxt, SQuery* pQuery);
static bool afterGroupBy(ESqlClause clause) { return clause > SQL_CLAUSE_GROUP_BY; }
@@ -707,6 +713,10 @@ static bool isWindowPseudoColumnFunc(const SNode* pNode) {
return (QUERY_NODE_FUNCTION == nodeType(pNode) && fmIsWindowPseudoColumnFunc(((SFunctionNode*)pNode)->funcId));
}
+static bool isInterpFunc(const SNode* pNode) {
+ return (QUERY_NODE_FUNCTION == nodeType(pNode) && fmIsInterpFunc(((SFunctionNode*)pNode)->funcId));
+}
+
static bool isInterpPseudoColumnFunc(const SNode* pNode) {
return (QUERY_NODE_FUNCTION == nodeType(pNode) && fmIsInterpPseudoColumnFunc(((SFunctionNode*)pNode)->funcId));
}
@@ -758,18 +768,40 @@ static SNodeList* getProjectList(const SNode* pNode) {
static bool isTimeLineQuery(SNode* pStmt) {
if (QUERY_NODE_SELECT_STMT == nodeType(pStmt)) {
- return ((SSelectStmt*)pStmt)->isTimeLineResult;
+ return (TIME_LINE_MULTI == ((SSelectStmt*)pStmt)->timeLineResMode) || (TIME_LINE_GLOBAL == ((SSelectStmt*)pStmt)->timeLineResMode);
+ } else if (QUERY_NODE_SET_OPERATOR == nodeType(pStmt)) {
+ return TIME_LINE_GLOBAL == ((SSetOperator*)pStmt)->timeLineResMode;
} else {
return false;
}
}
static bool isGlobalTimeLineQuery(SNode* pStmt) {
- if (!isTimeLineQuery(pStmt)) {
+ if (QUERY_NODE_SELECT_STMT == nodeType(pStmt)) {
+ return TIME_LINE_GLOBAL == ((SSelectStmt*)pStmt)->timeLineResMode;
+ } else if (QUERY_NODE_SET_OPERATOR == nodeType(pStmt)) {
+ return TIME_LINE_GLOBAL == ((SSetOperator*)pStmt)->timeLineResMode;
+ } else {
return false;
}
- SSelectStmt* pSelect = (SSelectStmt*)pStmt;
- return NULL == pSelect->pPartitionByList || NULL != pSelect->pOrderByList;
+}
+
+static bool isTimeLineAlignedQuery(SNode* pStmt) {
+ SSelectStmt *pSelect = (SSelectStmt *)pStmt;
+ if (isGlobalTimeLineQuery(((STempTableNode*)pSelect->pFromTable)->pSubquery)) {
+ return true;
+ }
+ if (!isTimeLineQuery(((STempTableNode*)pSelect->pFromTable)->pSubquery)) {
+ return false;
+ }
+ if (QUERY_NODE_SELECT_STMT != nodeType(((STempTableNode*)pSelect->pFromTable)->pSubquery)) {
+ return false;
+ }
+ SSelectStmt *pSub = (SSelectStmt *)((STempTableNode*)pSelect->pFromTable)->pSubquery;
+ if (nodesListMatch(pSelect->pPartitionByList, pSub->pPartitionByList)) {
+ return true;
+ }
+ return false;
}
static bool isPrimaryKeyImpl(SNode* pExpr) {
@@ -1595,7 +1627,7 @@ static int32_t translateTimelineFunc(STranslateContext* pCxt, SFunctionNode* pFu
}
SSelectStmt* pSelect = (SSelectStmt*)pCxt->pCurrStmt;
if (NULL != pSelect->pFromTable && QUERY_NODE_TEMP_TABLE == nodeType(pSelect->pFromTable) &&
- !isTimeLineQuery(((STempTableNode*)pSelect->pFromTable)->pSubquery)) {
+ !isGlobalTimeLineQuery(((STempTableNode*)pSelect->pFromTable)->pSubquery) && !isTimeLineAlignedQuery(pCxt->pCurrStmt)) {
return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_NOT_ALLOWED_FUNC,
"%s function requires valid time series input", pFunc->functionName);
}
@@ -2309,7 +2341,7 @@ static int32_t checkAggColCoexist(STranslateContext* pCxt, SSelectStmt* pSelect)
return TSDB_CODE_SUCCESS;
}
if (!pSelect->onlyHasKeepOrderFunc) {
- pSelect->isTimeLineResult = false;
+ pSelect->timeLineResMode = TIME_LINE_NONE;
}
CheckAggColCoexistCxt cxt = {.pTranslateCxt = pCxt, .existCol = false};
nodesRewriteExprs(pSelect->pProjectionList, doCheckAggColCoexist, &cxt);
@@ -2656,9 +2688,9 @@ static int32_t replaceTbName(STranslateContext* pCxt, SSelectStmt* pSelect) {
static int32_t checkJoinTable(STranslateContext* pCxt, SJoinTableNode* pJoinTable) {
if ((QUERY_NODE_TEMP_TABLE == nodeType(pJoinTable->pLeft) &&
- !isTimeLineQuery(((STempTableNode*)pJoinTable->pLeft)->pSubquery)) ||
+ !isGlobalTimeLineQuery(((STempTableNode*)pJoinTable->pLeft)->pSubquery)) ||
(QUERY_NODE_TEMP_TABLE == nodeType(pJoinTable->pRight) &&
- !isTimeLineQuery(((STempTableNode*)pJoinTable->pRight)->pSubquery))) {
+ !isGlobalTimeLineQuery(((STempTableNode*)pJoinTable->pRight)->pSubquery))) {
return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_NOT_SUPPORT_JOIN,
"Join requires valid time series input");
}
@@ -2693,7 +2725,7 @@ static int32_t translateTable(STranslateContext* pCxt, SNode* pTable) {
}
if (TSDB_SYSTEM_TABLE == pRealTable->pMeta->tableType) {
if (isSelectStmt(pCxt->pCurrStmt)) {
- ((SSelectStmt*)pCxt->pCurrStmt)->isTimeLineResult = false;
+ ((SSelectStmt*)pCxt->pCurrStmt)->timeLineResMode = TIME_LINE_NONE;
} else if (isDeleteStmt(pCxt->pCurrStmt)) {
code = TSDB_CODE_TSC_INVALID_OPERATION;
break;
@@ -3028,7 +3060,7 @@ static int32_t translateOrderBy(STranslateContext* pCxt, SSelectStmt* pSelect) {
}
static EDealRes needFillImpl(SNode* pNode, void* pContext) {
- if (isAggFunc(pNode) && FUNCTION_TYPE_GROUP_KEY != ((SFunctionNode*)pNode)->funcType) {
+ if ((isAggFunc(pNode) || isInterpFunc(pNode)) && FUNCTION_TYPE_GROUP_KEY != ((SFunctionNode*)pNode)->funcType) {
*(bool*)pContext = true;
return DEAL_RES_END;
}
@@ -3052,7 +3084,7 @@ static int32_t convertFillValue(STranslateContext* pCxt, SDataType dt, SNodeList
code = scalarCalculateConstants(pCaseFunc, &pCell->pNode);
}
if (TSDB_CODE_SUCCESS == code && QUERY_NODE_VALUE != nodeType(pCell->pNode)) {
- code = generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_WRONG_VALUE_TYPE, "Fill value is just a constant");
+ code = generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_WRONG_VALUE_TYPE, "Fill value can only accept constant");
} else if (TSDB_CODE_SUCCESS != code) {
code = generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_WRONG_VALUE_TYPE, "Filled data type mismatch");
}
@@ -3076,6 +3108,7 @@ static int32_t checkFillValues(STranslateContext* pCxt, SFillNode* pFill, SNodeL
if (TSDB_CODE_SUCCESS != code) {
return code;
}
+
++fillNo;
}
}
@@ -3172,7 +3205,7 @@ static int32_t translateGroupBy(STranslateContext* pCxt, SSelectStmt* pSelect) {
return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_GROUPBY_WINDOW_COEXIST);
}
pCxt->currClause = SQL_CLAUSE_GROUP_BY;
- pSelect->isTimeLineResult = false;
+ pSelect->timeLineResMode = TIME_LINE_NONE;
return translateExprList(pCxt, pSelect->pGroupByList);
}
@@ -3495,6 +3528,22 @@ static int32_t createDefaultFillNode(STranslateContext* pCxt, SNode** pOutput) {
return TSDB_CODE_SUCCESS;
}
+static int32_t createDefaultEveryNode(STranslateContext* pCxt, SNode** pOutput) {
+ SValueNode* pEvery = (SValueNode*)nodesMakeNode(QUERY_NODE_VALUE);
+ if (NULL == pEvery) {
+ return TSDB_CODE_OUT_OF_MEMORY;
+ }
+
+ pEvery->node.resType.type = TSDB_DATA_TYPE_BIGINT;
+ pEvery->node.resType.bytes = tDataTypes[TSDB_DATA_TYPE_BIGINT].bytes;
+ pEvery->isDuration = true;
+ pEvery->literal = taosStrdup("1s");
+
+
+ *pOutput = (SNode*)pEvery;
+ return TSDB_CODE_SUCCESS;
+}
+
static int32_t checkEvery(STranslateContext* pCxt, SValueNode* pInterval) {
int32_t len = strlen(pInterval->literal);
@@ -3510,7 +3559,12 @@ static int32_t checkEvery(STranslateContext* pCxt, SValueNode* pInterval) {
static int32_t translateInterpEvery(STranslateContext* pCxt, SNode** pEvery) {
int32_t code = TSDB_CODE_SUCCESS;
- code = checkEvery(pCxt, (SValueNode*)(*pEvery));
+ if (NULL == *pEvery) {
+ code = createDefaultEveryNode(pCxt, pEvery);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = checkEvery(pCxt, (SValueNode*)(*pEvery));
+ }
if (TSDB_CODE_SUCCESS == code) {
code = translateExpr(pCxt, pEvery);
}
@@ -3539,6 +3593,9 @@ static int32_t translateInterpFill(STranslateContext* pCxt, SSelectStmt* pSelect
if (TSDB_CODE_SUCCESS == code) {
code = checkFill(pCxt, (SFillNode*)pSelect->pFill, (SValueNode*)pSelect->pEvery, true);
}
+ if (TSDB_CODE_SUCCESS == code) {
+ code = checkFillValues(pCxt, (SFillNode*)pSelect->pFill, pSelect->pProjectionList);
+ }
return code;
}
@@ -3556,8 +3613,12 @@ static int32_t translateInterp(STranslateContext* pCxt, SSelectStmt* pSelect) {
}
if (NULL == pSelect->pRange || NULL == pSelect->pEvery || NULL == pSelect->pFill) {
- return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_INTERP_CLAUSE,
- "Missing RANGE clause, EVERY clause or FILL clause");
+ if (pSelect->pRange != NULL && QUERY_NODE_OPERATOR == nodeType(pSelect->pRange) && pSelect->pEvery == NULL) {
+ // single point interp every can be omitted
+ } else {
+ return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_INTERP_CLAUSE,
+ "Missing RANGE clause, EVERY clause or FILL clause");
+ }
}
int32_t code = translateExpr(pCxt, &pSelect->pRange);
@@ -3572,7 +3633,18 @@ static int32_t translateInterp(STranslateContext* pCxt, SSelectStmt* pSelect) {
static int32_t translatePartitionBy(STranslateContext* pCxt, SSelectStmt* pSelect) {
pCxt->currClause = SQL_CLAUSE_PARTITION_BY;
- int32_t code = translateExprList(pCxt, pSelect->pPartitionByList);
+ int32_t code = TSDB_CODE_SUCCESS;
+
+ if (pSelect->pPartitionByList) {
+ int8_t typeType = getTableTypeFromTableNode(pSelect->pFromTable);
+ SNode* pPar = nodesListGetNode(pSelect->pPartitionByList, 0);
+ if (!((TSDB_NORMAL_TABLE == typeType || TSDB_CHILD_TABLE == typeType) &&
+ 1 == pSelect->pPartitionByList->length && (QUERY_NODE_FUNCTION == nodeType(pPar) && FUNCTION_TYPE_TBNAME == ((SFunctionNode*)pPar)->funcType))) {
+ pSelect->timeLineResMode = TIME_LINE_MULTI;
+ }
+
+ code = translateExprList(pCxt, pSelect->pPartitionByList);
+ }
if (TSDB_CODE_SUCCESS == code) {
code = translateExprList(pCxt, pSelect->pTags);
}
@@ -3701,9 +3773,9 @@ static void resetResultTimeline(SSelectStmt* pSelect) {
if ((QUERY_NODE_TEMP_TABLE == nodeType(pSelect->pFromTable) &&
isPrimaryKey((STempTableNode*)pSelect->pFromTable, pOrder)) ||
(QUERY_NODE_TEMP_TABLE != nodeType(pSelect->pFromTable) && isPrimaryKeyImpl(pOrder))) {
- pSelect->isTimeLineResult = true;
+ pSelect->timeLineResMode = TIME_LINE_GLOBAL;
} else {
- pSelect->isTimeLineResult = false;
+ pSelect->timeLineResMode = TIME_LINE_NONE;
}
}
@@ -3773,7 +3845,7 @@ static int32_t translateSelectFrom(STranslateContext* pCxt, SSelectStmt* pSelect
if (TSDB_CODE_SUCCESS == code) {
code = replaceTbName(pCxt, pSelect);
}
-
+
return code;
}
@@ -3833,8 +3905,13 @@ static int32_t translateSetOperProject(STranslateContext* pCxt, SSetOperator* pS
pLeftExpr = pLeftFuncExpr;
}
snprintf(pRightExpr->aliasName, sizeof(pRightExpr->aliasName), "%s", pLeftExpr->aliasName);
- if (TSDB_CODE_SUCCESS != nodesListMakeStrictAppend(&pSetOperator->pProjectionList,
- createSetOperProject(pSetOperator->stmtName, pLeft))) {
+ SNode* pProj = createSetOperProject(pSetOperator->stmtName, pLeft);
+ if (QUERY_NODE_COLUMN == nodeType(pLeft) && QUERY_NODE_COLUMN == nodeType(pRight)
+ && ((SColumnNode*)pLeft)->colId == PRIMARYKEY_TIMESTAMP_COL_ID
+ && ((SColumnNode*)pRight)->colId == PRIMARYKEY_TIMESTAMP_COL_ID) {
+ ((SColumnNode*)pProj)->colId = PRIMARYKEY_TIMESTAMP_COL_ID;
+ }
+ if (TSDB_CODE_SUCCESS != nodesListMakeStrictAppend(&pSetOperator->pProjectionList, pProj)) {
return TSDB_CODE_OUT_OF_MEMORY;
}
}
@@ -3846,6 +3923,10 @@ static uint8_t calcSetOperatorPrecision(SSetOperator* pSetOperator) {
}
static int32_t translateSetOperOrderBy(STranslateContext* pCxt, SSetOperator* pSetOperator) {
+ if (NULL == pSetOperator->pOrderByList || pSetOperator->pOrderByList->length <= 0) {
+ return TSDB_CODE_SUCCESS;
+ }
+
bool other;
int32_t code = translateOrderByPosition(pCxt, pSetOperator->pProjectionList, pSetOperator->pOrderByList, &other);
if (TSDB_CODE_SUCCESS == code) {
@@ -3858,6 +3939,14 @@ static int32_t translateSetOperOrderBy(STranslateContext* pCxt, SSetOperator* pS
if (TSDB_CODE_SUCCESS == code) {
code = replaceOrderByAlias(pCxt, pSetOperator->pProjectionList, pSetOperator->pOrderByList);
}
+ if (TSDB_CODE_SUCCESS == code) {
+ SNode* pOrder = ((SOrderByExprNode*)nodesListGetNode(pSetOperator->pOrderByList, 0))->pExpr;
+ if (isPrimaryKeyImpl(pOrder)) {
+ pSetOperator->timeLineResMode = TIME_LINE_GLOBAL;
+ } else {
+ pSetOperator->timeLineResMode = TIME_LINE_NONE;
+ }
+ }
return code;
}
@@ -4910,6 +4999,7 @@ static int32_t buildTableForSampleAst(SSampleAstInfo* pInfo, SNode** pOutput) {
}
snprintf(pTable->table.dbName, sizeof(pTable->table.dbName), "%s", pInfo->pDbName);
snprintf(pTable->table.tableName, sizeof(pTable->table.tableName), "%s", pInfo->pTableName);
+ snprintf(pTable->table.tableAlias, sizeof(pTable->table.tableAlias), "%s", pInfo->pTableName);
TSWAP(pTable->pMeta, pInfo->pRollupTableMeta);
*pOutput = (SNode*)pTable;
return TSDB_CODE_SUCCESS;
@@ -6344,7 +6434,7 @@ static int32_t subtableExprHasColumnOrPseudoColumn(SNode* pNode) {
static int32_t checkStreamQuery(STranslateContext* pCxt, SCreateStreamStmt* pStmt) {
SSelectStmt* pSelect = (SSelectStmt*)pStmt->pQuery;
if (TSDB_DATA_TYPE_TIMESTAMP != ((SExprNode*)nodesListGetNode(pSelect->pProjectionList, 0))->resType.type ||
- !pSelect->isTimeLineResult || crossTableWithoutAggOper(pSelect) || NULL != pSelect->pOrderByList ||
+ !isTimeLineQuery(pStmt->pQuery) || crossTableWithoutAggOper(pSelect) || NULL != pSelect->pOrderByList ||
crossTableWithUdaf(pSelect) || isEventWindowQuery(pSelect) || hasJsonTypeProjection(pSelect)) {
return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY, "Unsupported stream query");
}
@@ -6700,6 +6790,54 @@ static int32_t translateStreamTargetTable(STranslateContext* pCxt, SCreateStream
return code;
}
+static int32_t createLastTsSelectStmt(char* pDb, char* pTable, STableMeta* pMeta, SNode** pQuery) {
+ SColumnNode* col = (SColumnNode*)nodesMakeNode(QUERY_NODE_COLUMN);
+ if (NULL == col) {
+ return TSDB_CODE_OUT_OF_MEMORY;
+ }
+
+ strcpy(col->tableAlias, pTable);
+ strcpy(col->colName, pMeta->schema[0].name);
+ SNodeList* pParamterList = nodesMakeList();
+ if (NULL == pParamterList) {
+ nodesDestroyNode((SNode *)col);
+ return TSDB_CODE_OUT_OF_MEMORY;
+ }
+
+ int32_t code = nodesListStrictAppend(pParamterList, (SNode *)col);
+ if (code) {
+ nodesDestroyNode((SNode *)col);
+ nodesDestroyList(pParamterList);
+ return code;
+ }
+
+ SNode* pFunc = (SNode*)createFunction("last", pParamterList);
+ if (NULL == pFunc) {
+ nodesDestroyList(pParamterList);
+ return TSDB_CODE_OUT_OF_MEMORY;
+ }
+
+ SNodeList* pProjectionList = nodesMakeList();
+ if (NULL == pProjectionList) {
+ nodesDestroyList(pParamterList);
+ return TSDB_CODE_OUT_OF_MEMORY;
+ }
+ code = nodesListStrictAppend(pProjectionList, pFunc);
+ if (code) {
+ nodesDestroyNode(pFunc);
+ nodesDestroyList(pProjectionList);
+ return code;
+ }
+
+ code = createSimpleSelectStmtFromProjList(pDb, pTable, pProjectionList, (SSelectStmt **)pQuery);
+ if (code) {
+ nodesDestroyList(pProjectionList);
+ return code;
+ }
+
+ return code;
+}
+
static int32_t buildCreateStreamQuery(STranslateContext* pCxt, SCreateStreamStmt* pStmt, SCMCreateStreamReq* pReq) {
pCxt->createStream = true;
STableMeta* pMeta = NULL;
@@ -6726,6 +6864,18 @@ static int32_t buildCreateStreamQuery(STranslateContext* pCxt, SCreateStreamStmt
getSourceDatabase(pStmt->pQuery, pCxt->pParseCxt->acctId, pReq->sourceDB);
code = nodesNodeToString(pStmt->pQuery, false, &pReq->ast, NULL);
}
+ if (TSDB_CODE_SUCCESS == code && pStmt->pOptions->fillHistory) {
+ SRealTableNode* pTable = (SRealTableNode*)(((SSelectStmt*)pStmt->pQuery)->pFromTable);
+ code = createLastTsSelectStmt(pTable->table.dbName, pTable->table.tableName, pTable->pMeta, &pStmt->pPrevQuery);
+/*
+ if (TSDB_CODE_SUCCESS == code) {
+ STranslateContext cxt = {0};
+ int32_t code = initTranslateContext(pCxt->pParseCxt, pCxt->pMetaCache, &cxt);
+ code = translateQuery(&cxt, pStmt->pPrevQuery);
+ destroyTranslateContext(&cxt);
+ }
+*/
+ }
taosMemoryFree(pMeta);
return code;
}
@@ -6792,13 +6942,86 @@ static int32_t translateCreateStream(STranslateContext* pCxt, SCreateStreamStmt*
code = buildCreateStreamReq(pCxt, pStmt, &createReq);
}
if (TSDB_CODE_SUCCESS == code) {
- code = buildCmdMsg(pCxt, TDMT_MND_CREATE_STREAM, (FSerializeFunc)tSerializeSCMCreateStreamReq, &createReq);
+ if (NULL == pStmt->pPrevQuery) {
+ code = buildCmdMsg(pCxt, TDMT_MND_CREATE_STREAM, (FSerializeFunc)tSerializeSCMCreateStreamReq, &createReq);
+ } else {
+ pStmt->pReq = taosMemoryMalloc(sizeof(createReq));
+ if (NULL == pStmt->pReq) {
+ code = TSDB_CODE_OUT_OF_MEMORY;
+ } else {
+ memcpy(pStmt->pReq, &createReq, sizeof(createReq));
+ memset(&createReq, 0, sizeof(createReq));
+ TSWAP(pCxt->pPrevRoot, pStmt->pPrevQuery);
+ }
+ }
}
tFreeSCMCreateStreamReq(&createReq);
return code;
}
+int32_t buildIntervalForCreateStream(SCreateStreamStmt* pStmt, SInterval* pInterval) {
+ int32_t code = TSDB_CODE_SUCCESS;
+ if (QUERY_NODE_SELECT_STMT != nodeType(pStmt->pQuery)) {
+ return code;
+ }
+ SSelectStmt* pSelect = (SSelectStmt*)pStmt->pQuery;
+ if (NULL == pSelect->pWindow || QUERY_NODE_INTERVAL_WINDOW != nodeType(pSelect->pWindow)) {
+ return code;
+ }
+
+ SIntervalWindowNode* pWindow = (SIntervalWindowNode*)pSelect->pWindow;
+ pInterval->interval = ((SValueNode*)pWindow->pInterval)->datum.i;
+ pInterval->intervalUnit = ((SValueNode*)pWindow->pInterval)->unit;
+ pInterval->offset = (NULL != pWindow->pOffset ? ((SValueNode*)pWindow->pOffset)->datum.i : 0);
+ pInterval->sliding = (NULL != pWindow->pSliding ? ((SValueNode*)pWindow->pSliding)->datum.i : pInterval->interval);
+ pInterval->slidingUnit =
+ (NULL != pWindow->pSliding ? ((SValueNode*)pWindow->pSliding)->unit : pInterval->intervalUnit);
+ pInterval->precision = ((SColumnNode*)pWindow->pCol)->node.resType.precision;
+
+ return code;
+}
+
+int32_t translatePostCreateStream(SParseContext* pParseCxt, SQuery* pQuery, void** pResRow) {
+ SCreateStreamStmt* pStmt = (SCreateStreamStmt*)pQuery->pRoot;
+ STranslateContext cxt = {0};
+ SInterval interval = {0};
+ int64_t lastTs = 0;
+
+ int32_t code = initTranslateContext(pParseCxt, NULL, &cxt);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = buildIntervalForCreateStream(pStmt, &interval);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ if (pResRow && pResRow[0]) {
+ lastTs = *(int64_t*)pResRow[0];
+ } else if (interval.interval > 0) {
+ lastTs = convertTimePrecision(taosGetTimestampMs(), TSDB_TIME_PRECISION_MILLI, interval.precision);
+ } else {
+ lastTs = taosGetTimestampMs();
+ }
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ if (interval.interval > 0) {
+ pStmt->pReq->lastTs = taosTimeTruncate(lastTs, &interval);
+ } else {
+ pStmt->pReq->lastTs = lastTs;
+ }
+ code = buildCmdMsg(&cxt, TDMT_MND_CREATE_STREAM, (FSerializeFunc)tSerializeSCMCreateStreamReq, pStmt->pReq);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = setQuery(&cxt, pQuery);
+ }
+ setRefreshMate(&cxt, pQuery);
+ destroyTranslateContext(&cxt);
+
+ tFreeSCMCreateStreamReq(pStmt->pReq);
+ taosMemoryFreeClear(pStmt->pReq);
+
+ return code;
+}
+
+
static int32_t translateDropStream(STranslateContext* pCxt, SDropStreamStmt* pStmt) {
SMDropStreamReq dropReq = {0};
SName name;
@@ -7479,8 +7702,7 @@ static SNodeList* createProjectCols(int32_t ncols, const char* const pCols[]) {
return pProjections;
}
-static int32_t createSimpleSelectStmt(const char* pDb, const char* pTable, int32_t numOfProjs,
- const char* const pProjCol[], SSelectStmt** pStmt) {
+static int32_t createSimpleSelectStmtImpl(const char* pDb, const char* pTable, SNodeList* pProjectionList, SSelectStmt** pStmt) {
SSelectStmt* pSelect = (SSelectStmt*)nodesMakeNode(QUERY_NODE_SELECT_STMT);
if (NULL == pSelect) {
return TSDB_CODE_OUT_OF_MEMORY;
@@ -7496,27 +7718,38 @@ static int32_t createSimpleSelectStmt(const char* pDb, const char* pTable, int32
snprintf(pRealTable->table.tableName, sizeof(pRealTable->table.tableName), "%s", pTable);
snprintf(pRealTable->table.tableAlias, sizeof(pRealTable->table.tableAlias), "%s", pTable);
pSelect->pFromTable = (SNode*)pRealTable;
-
- if (numOfProjs >= 0) {
- pSelect->pProjectionList = createProjectCols(numOfProjs, pProjCol);
- if (NULL == pSelect->pProjectionList) {
- nodesDestroyNode((SNode*)pSelect);
- return TSDB_CODE_OUT_OF_MEMORY;
- }
- }
+ pSelect->pProjectionList = pProjectionList;
*pStmt = pSelect;
return TSDB_CODE_SUCCESS;
}
+
+static int32_t createSimpleSelectStmtFromCols(const char* pDb, const char* pTable, int32_t numOfProjs,
+ const char* const pProjCol[], SSelectStmt** pStmt) {
+ SNodeList* pProjectionList = NULL;
+ if (numOfProjs >= 0) {
+ pProjectionList = createProjectCols(numOfProjs, pProjCol);
+ if (NULL == pProjectionList) {
+ return TSDB_CODE_OUT_OF_MEMORY;
+ }
+ }
+
+ return createSimpleSelectStmtImpl(pDb, pTable, pProjectionList, pStmt);
+}
+
+static int32_t createSimpleSelectStmtFromProjList(const char* pDb, const char* pTable, SNodeList* pProjectionList, SSelectStmt** pStmt) {
+ return createSimpleSelectStmtImpl(pDb, pTable, pProjectionList, pStmt);
+}
+
static int32_t createSelectStmtForShow(ENodeType showType, SSelectStmt** pStmt) {
const SSysTableShowAdapter* pShow = &sysTableShowAdapter[showType - SYSTABLE_SHOW_TYPE_OFFSET];
- return createSimpleSelectStmt(pShow->pDbName, pShow->pTableName, pShow->numOfShowCols, pShow->pShowCols, pStmt);
+ return createSimpleSelectStmtFromCols(pShow->pDbName, pShow->pTableName, pShow->numOfShowCols, pShow->pShowCols, pStmt);
}
static int32_t createSelectStmtForShowTableDist(SShowTableDistributedStmt* pStmt, SSelectStmt** pOutput) {
- return createSimpleSelectStmt(pStmt->dbName, pStmt->tableName, 0, NULL, pOutput);
+ return createSimpleSelectStmtFromCols(pStmt->dbName, pStmt->tableName, 0, NULL, pOutput);
}
static int32_t createOperatorNode(EOperatorType opType, const char* pColName, SNode* pRight, SNode** pOp) {
@@ -7650,7 +7883,7 @@ static int32_t createShowTableTagsProjections(SNodeList** pProjections, SNodeLis
static int32_t rewriteShowStableTags(STranslateContext* pCxt, SQuery* pQuery) {
SShowTableTagsStmt* pShow = (SShowTableTagsStmt*)pQuery->pRoot;
SSelectStmt* pSelect = NULL;
- int32_t code = createSimpleSelectStmt(((SValueNode*)pShow->pDbName)->literal, ((SValueNode*)pShow->pTbName)->literal,
+ int32_t code = createSimpleSelectStmtFromCols(((SValueNode*)pShow->pDbName)->literal, ((SValueNode*)pShow->pTbName)->literal,
-1, NULL, &pSelect);
if (TSDB_CODE_SUCCESS == code) {
code = createShowTableTagsProjections(&pSelect->pProjectionList, &pShow->pTags);
@@ -8975,6 +9208,7 @@ static int32_t setQuery(STranslateContext* pCxt, SQuery* pQuery) {
}
break;
default:
+ pQuery->haveResultSet = false;
pQuery->execMode = QUERY_EXEC_MODE_RPC;
if (NULL != pCxt->pCmdMsg) {
TSWAP(pQuery->pCmdMsg, pCxt->pCmdMsg);
@@ -9009,6 +9243,10 @@ int32_t translate(SParseContext* pParseCxt, SQuery* pQuery, SParseMetaCache* pMe
if (TSDB_CODE_SUCCESS == code) {
code = translateQuery(&cxt, pQuery->pRoot);
}
+ if (TSDB_CODE_SUCCESS == code && (cxt.pPrevRoot || cxt.pPostRoot)) {
+ pQuery->pPrevRoot = cxt.pPrevRoot;
+ pQuery->pPostRoot = cxt.pPostRoot;
+ }
if (TSDB_CODE_SUCCESS == code) {
code = setQuery(&cxt, pQuery);
}
diff --git a/source/libs/parser/src/parUtil.c b/source/libs/parser/src/parUtil.c
index ba8392a48c..1c13f66f96 100644
--- a/source/libs/parser/src/parUtil.c
+++ b/source/libs/parser/src/parUtil.c
@@ -138,7 +138,7 @@ static char* getSyntaxErrFormat(int32_t errCode) {
case TSDB_CODE_PAR_CANNOT_DROP_PRIMARY_KEY:
return "Primary timestamp column cannot be dropped";
case TSDB_CODE_PAR_INVALID_MODIFY_COL:
- return "Only binary/nchar column length could be modified, and the length can only be increased, not decreased";
+ return "Only binary/nchar/geometry column length could be modified, and the length can only be increased, not decreased";
case TSDB_CODE_PAR_INVALID_TBNAME:
return "Invalid tbname pseudo column";
case TSDB_CODE_PAR_INVALID_FUNCTION_NAME:
@@ -249,6 +249,17 @@ int32_t getNumOfTags(const STableMeta* pTableMeta) { return getTableInfo(pTableM
STableComInfo getTableInfo(const STableMeta* pTableMeta) { return pTableMeta->tableInfo; }
+int32_t getTableTypeFromTableNode(SNode *pTable) {
+ if (NULL == pTable) {
+ return -1;
+ }
+ if (QUERY_NODE_REAL_TABLE != nodeType(pTable)) {
+ return -1;
+ }
+ return ((SRealTableNode *)pTable)->pMeta->tableType;
+}
+
+
STableMeta* tableMetaDup(const STableMeta* pTableMeta) {
int32_t numOfFields = TABLE_TOTAL_COL_NUM(pTableMeta);
if (numOfFields > TSDB_MAX_COLUMNS || numOfFields < TSDB_MIN_COLUMNS) {
@@ -684,7 +695,7 @@ SNode* createSelectStmtImpl(bool isDistinct, SNodeList* pProjectionList, SNode*
select->pProjectionList = pProjectionList;
select->pFromTable = pTable;
sprintf(select->stmtName, "%p", select);
- select->isTimeLineResult = true;
+ select->timeLineResMode = select->isDistinct ? TIME_LINE_NONE : TIME_LINE_GLOBAL;
select->onlyHasKeepOrderFunc = true;
select->timeRange = TSWINDOW_INITIALIZER;
return (SNode*)select;
diff --git a/source/libs/parser/src/parser.c b/source/libs/parser/src/parser.c
index 28d116c381..cbddaf8115 100644
--- a/source/libs/parser/src/parser.c
+++ b/source/libs/parser/src/parser.c
@@ -204,7 +204,7 @@ int32_t qAnalyseSqlSemantic(SParseContext* pCxt, const struct SCatalogReq* pCata
const struct SMetaData* pMetaData, SQuery* pQuery) {
SParseMetaCache metaCache = {0};
int32_t code = nodesAcquireAllocator(pCxt->allocatorId);
- if (TSDB_CODE_SUCCESS == code) {
+ if (TSDB_CODE_SUCCESS == code && pCatalogReq) {
code = putMetaDataToCache(pCatalogReq, pMetaData, &metaCache);
}
if (TSDB_CODE_SUCCESS == code) {
@@ -221,6 +221,19 @@ int32_t qContinueParseSql(SParseContext* pCxt, struct SCatalogReq* pCatalogReq,
return parseInsertSql(pCxt, &pQuery, pCatalogReq, pMetaData);
}
+int32_t qContinueParsePostQuery(SParseContext* pCxt, SQuery* pQuery, void** pResRow) {
+ int32_t code = TSDB_CODE_SUCCESS;
+ switch (nodeType(pQuery->pRoot)) {
+ case QUERY_NODE_CREATE_STREAM_STMT:
+ code = translatePostCreateStream(pCxt, pQuery, pResRow);
+ break;
+ default:
+ break;
+ }
+
+ return code;
+}
+
void qDestroyParseContext(SParseContext* pCxt) {
if (NULL == pCxt) {
return;
diff --git a/source/libs/parser/src/sql.c b/source/libs/parser/src/sql.c
index 4b6a665944..3f05e3269a 100644
--- a/source/libs/parser/src/sql.c
+++ b/source/libs/parser/src/sql.c
@@ -1,5 +1,3 @@
-/* This file is automatically generated by Lemon from input grammar
-** source file "sql.y". */
/*
** 2000-05-29
**
@@ -24,8 +22,9 @@
** The following is the concatenation of all %include directives from the
** input grammar file:
*/
+#include
+#include
/************ Begin %include sections from the grammar ************************/
-#line 11 "sql.y"
#include
#include
@@ -42,349 +41,12 @@
#include "parAst.h"
#define YYSTACKDEPTH 0
-#line 46 "sql.c"
/**************** End of %include directives **********************************/
-/* These constants specify the various numeric values for terminal symbols.
-***************** Begin token definitions *************************************/
-#ifndef TK_OR
-#define TK_OR 1
-#define TK_AND 2
-#define TK_UNION 3
-#define TK_ALL 4
-#define TK_MINUS 5
-#define TK_EXCEPT 6
-#define TK_INTERSECT 7
-#define TK_NK_BITAND 8
-#define TK_NK_BITOR 9
-#define TK_NK_LSHIFT 10
-#define TK_NK_RSHIFT 11
-#define TK_NK_PLUS 12
-#define TK_NK_MINUS 13
-#define TK_NK_STAR 14
-#define TK_NK_SLASH 15
-#define TK_NK_REM 16
-#define TK_NK_CONCAT 17
-#define TK_CREATE 18
-#define TK_ACCOUNT 19
-#define TK_NK_ID 20
-#define TK_PASS 21
-#define TK_NK_STRING 22
-#define TK_ALTER 23
-#define TK_PPS 24
-#define TK_TSERIES 25
-#define TK_STORAGE 26
-#define TK_STREAMS 27
-#define TK_QTIME 28
-#define TK_DBS 29
-#define TK_USERS 30
-#define TK_CONNS 31
-#define TK_STATE 32
-#define TK_USER 33
-#define TK_ENABLE 34
-#define TK_NK_INTEGER 35
-#define TK_SYSINFO 36
-#define TK_DROP 37
-#define TK_GRANT 38
-#define TK_ON 39
-#define TK_TO 40
-#define TK_REVOKE 41
-#define TK_FROM 42
-#define TK_SUBSCRIBE 43
-#define TK_NK_COMMA 44
-#define TK_READ 45
-#define TK_WRITE 46
-#define TK_NK_DOT 47
-#define TK_WITH 48
-#define TK_DNODE 49
-#define TK_PORT 50
-#define TK_DNODES 51
-#define TK_RESTORE 52
-#define TK_NK_IPTOKEN 53
-#define TK_FORCE 54
-#define TK_UNSAFE 55
-#define TK_LOCAL 56
-#define TK_QNODE 57
-#define TK_BNODE 58
-#define TK_SNODE 59
-#define TK_MNODE 60
-#define TK_VNODE 61
-#define TK_DATABASE 62
-#define TK_USE 63
-#define TK_FLUSH 64
-#define TK_TRIM 65
-#define TK_COMPACT 66
-#define TK_IF 67
-#define TK_NOT 68
-#define TK_EXISTS 69
-#define TK_BUFFER 70
-#define TK_CACHEMODEL 71
-#define TK_CACHESIZE 72
-#define TK_COMP 73
-#define TK_DURATION 74
-#define TK_NK_VARIABLE 75
-#define TK_MAXROWS 76
-#define TK_MINROWS 77
-#define TK_KEEP 78
-#define TK_PAGES 79
-#define TK_PAGESIZE 80
-#define TK_TSDB_PAGESIZE 81
-#define TK_PRECISION 82
-#define TK_REPLICA 83
-#define TK_VGROUPS 84
-#define TK_SINGLE_STABLE 85
-#define TK_RETENTIONS 86
-#define TK_SCHEMALESS 87
-#define TK_WAL_LEVEL 88
-#define TK_WAL_FSYNC_PERIOD 89
-#define TK_WAL_RETENTION_PERIOD 90
-#define TK_WAL_RETENTION_SIZE 91
-#define TK_WAL_ROLL_PERIOD 92
-#define TK_WAL_SEGMENT_SIZE 93
-#define TK_STT_TRIGGER 94
-#define TK_TABLE_PREFIX 95
-#define TK_TABLE_SUFFIX 96
-#define TK_NK_COLON 97
-#define TK_MAX_SPEED 98
-#define TK_START 99
-#define TK_TIMESTAMP 100
-#define TK_END 101
-#define TK_TABLE 102
-#define TK_NK_LP 103
-#define TK_NK_RP 104
-#define TK_STABLE 105
-#define TK_ADD 106
-#define TK_COLUMN 107
-#define TK_MODIFY 108
-#define TK_RENAME 109
-#define TK_TAG 110
-#define TK_SET 111
-#define TK_NK_EQ 112
-#define TK_USING 113
-#define TK_TAGS 114
-#define TK_BOOL 115
-#define TK_TINYINT 116
-#define TK_SMALLINT 117
-#define TK_INT 118
-#define TK_INTEGER 119
-#define TK_BIGINT 120
-#define TK_FLOAT 121
-#define TK_DOUBLE 122
-#define TK_BINARY 123
-#define TK_NCHAR 124
-#define TK_UNSIGNED 125
-#define TK_JSON 126
-#define TK_VARCHAR 127
-#define TK_MEDIUMBLOB 128
-#define TK_BLOB 129
-#define TK_VARBINARY 130
-#define TK_GEOMETRY 131
-#define TK_DECIMAL 132
-#define TK_COMMENT 133
-#define TK_MAX_DELAY 134
-#define TK_WATERMARK 135
-#define TK_ROLLUP 136
-#define TK_TTL 137
-#define TK_SMA 138
-#define TK_DELETE_MARK 139
-#define TK_FIRST 140
-#define TK_LAST 141
-#define TK_SHOW 142
-#define TK_PRIVILEGES 143
-#define TK_DATABASES 144
-#define TK_TABLES 145
-#define TK_STABLES 146
-#define TK_MNODES 147
-#define TK_QNODES 148
-#define TK_FUNCTIONS 149
-#define TK_INDEXES 150
-#define TK_ACCOUNTS 151
-#define TK_APPS 152
-#define TK_CONNECTIONS 153
-#define TK_LICENCES 154
-#define TK_GRANTS 155
-#define TK_QUERIES 156
-#define TK_SCORES 157
-#define TK_TOPICS 158
-#define TK_VARIABLES 159
-#define TK_CLUSTER 160
-#define TK_BNODES 161
-#define TK_SNODES 162
-#define TK_TRANSACTIONS 163
-#define TK_DISTRIBUTED 164
-#define TK_CONSUMERS 165
-#define TK_SUBSCRIPTIONS 166
-#define TK_VNODES 167
-#define TK_ALIVE 168
-#define TK_LIKE 169
-#define TK_TBNAME 170
-#define TK_QTAGS 171
-#define TK_AS 172
-#define TK_INDEX 173
-#define TK_FUNCTION 174
-#define TK_INTERVAL 175
-#define TK_COUNT 176
-#define TK_LAST_ROW 177
-#define TK_TOPIC 178
-#define TK_META 179
-#define TK_CONSUMER 180
-#define TK_GROUP 181
-#define TK_DESC 182
-#define TK_DESCRIBE 183
-#define TK_RESET 184
-#define TK_QUERY 185
-#define TK_CACHE 186
-#define TK_EXPLAIN 187
-#define TK_ANALYZE 188
-#define TK_VERBOSE 189
-#define TK_NK_BOOL 190
-#define TK_RATIO 191
-#define TK_NK_FLOAT 192
-#define TK_OUTPUTTYPE 193
-#define TK_AGGREGATE 194
-#define TK_BUFSIZE 195
-#define TK_LANGUAGE 196
-#define TK_REPLACE 197
-#define TK_STREAM 198
-#define TK_INTO 199
-#define TK_PAUSE 200
-#define TK_RESUME 201
-#define TK_TRIGGER 202
-#define TK_AT_ONCE 203
-#define TK_WINDOW_CLOSE 204
-#define TK_IGNORE 205
-#define TK_EXPIRED 206
-#define TK_FILL_HISTORY 207
-#define TK_UPDATE 208
-#define TK_SUBTABLE 209
-#define TK_UNTREATED 210
-#define TK_KILL 211
-#define TK_CONNECTION 212
-#define TK_TRANSACTION 213
-#define TK_BALANCE 214
-#define TK_VGROUP 215
-#define TK_LEADER 216
-#define TK_MERGE 217
-#define TK_REDISTRIBUTE 218
-#define TK_SPLIT 219
-#define TK_DELETE 220
-#define TK_INSERT 221
-#define TK_NULL 222
-#define TK_NK_QUESTION 223
-#define TK_NK_ARROW 224
-#define TK_ROWTS 225
-#define TK_QSTART 226
-#define TK_QEND 227
-#define TK_QDURATION 228
-#define TK_WSTART 229
-#define TK_WEND 230
-#define TK_WDURATION 231
-#define TK_IROWTS 232
-#define TK_ISFILLED 233
-#define TK_CAST 234
-#define TK_NOW 235
-#define TK_TODAY 236
-#define TK_TIMEZONE 237
-#define TK_CLIENT_VERSION 238
-#define TK_SERVER_VERSION 239
-#define TK_SERVER_STATUS 240
-#define TK_CURRENT_USER 241
-#define TK_CASE 242
-#define TK_WHEN 243
-#define TK_THEN 244
-#define TK_ELSE 245
-#define TK_BETWEEN 246
-#define TK_IS 247
-#define TK_NK_LT 248
-#define TK_NK_GT 249
-#define TK_NK_LE 250
-#define TK_NK_GE 251
-#define TK_NK_NE 252
-#define TK_MATCH 253
-#define TK_NMATCH 254
-#define TK_CONTAINS 255
-#define TK_IN 256
-#define TK_JOIN 257
-#define TK_INNER 258
-#define TK_SELECT 259
-#define TK_DISTINCT 260
-#define TK_WHERE 261
-#define TK_PARTITION 262
-#define TK_BY 263
-#define TK_SESSION 264
-#define TK_STATE_WINDOW 265
-#define TK_EVENT_WINDOW 266
-#define TK_SLIDING 267
-#define TK_FILL 268
-#define TK_VALUE 269
-#define TK_VALUE_F 270
-#define TK_NONE 271
-#define TK_PREV 272
-#define TK_NULL_F 273
-#define TK_LINEAR 274
-#define TK_NEXT 275
-#define TK_HAVING 276
-#define TK_RANGE 277
-#define TK_EVERY 278
-#define TK_ORDER 279
-#define TK_SLIMIT 280
-#define TK_SOFFSET 281
-#define TK_LIMIT 282
-#define TK_OFFSET 283
-#define TK_ASC 284
-#define TK_NULLS 285
-#define TK_ABORT 286
-#define TK_AFTER 287
-#define TK_ATTACH 288
-#define TK_BEFORE 289
-#define TK_BEGIN 290
-#define TK_BITAND 291
-#define TK_BITNOT 292
-#define TK_BITOR 293
-#define TK_BLOCKS 294
-#define TK_CHANGE 295
-#define TK_COMMA 296
-#define TK_CONCAT 297
-#define TK_CONFLICT 298
-#define TK_COPY 299
-#define TK_DEFERRED 300
-#define TK_DELIMITERS 301
-#define TK_DETACH 302
-#define TK_DIVIDE 303
-#define TK_DOT 304
-#define TK_EACH 305
-#define TK_FAIL 306
-#define TK_FILE 307
-#define TK_FOR 308
-#define TK_GLOB 309
-#define TK_ID 310
-#define TK_IMMEDIATE 311
-#define TK_IMPORT 312
-#define TK_INITIALLY 313
-#define TK_INSTEAD 314
-#define TK_ISNULL 315
-#define TK_KEY 316
-#define TK_MODULES 317
-#define TK_NK_BITNOT 318
-#define TK_NK_SEMI 319
-#define TK_NOTNULL 320
-#define TK_OF 321
-#define TK_PLUS 322
-#define TK_PRIVILEGE 323
-#define TK_RAISE 324
-#define TK_RESTRICT 325
-#define TK_ROW 326
-#define TK_SEMI 327
-#define TK_STAR 328
-#define TK_STATEMENT 329
-#define TK_STRICT 330
-#define TK_STRING 331
-#define TK_TIMES 332
-#define TK_VALUES 333
-#define TK_VARIABLE 334
-#define TK_VIEW 335
-#define TK_WAL 336
-#endif
-/**************** End token definitions ***************************************/
+/* These constants specify the various numeric values for terminal symbols
+** in a format understandable to "makeheaders". This section is blank unless
+** "lemon" is run with the "-m" command-line option.
+***************** Begin makeheaders token definitions *************************/
+/**************** End makeheaders token definitions ***************************/
/* The next sections is a series of control #defines.
** various aspects of the generated parser.
@@ -479,17 +141,17 @@ typedef union {
#define ParseCTX_STORE
#define YYFALLBACK 1
#define YYNSTATE 794
-#define YYNRULE 595
-#define YYNRULE_WITH_ACTION 595
+#define YYNRULE 596
+#define YYNRULE_WITH_ACTION 596
#define YYNTOKEN 337
#define YY_MAX_SHIFT 793
-#define YY_MIN_SHIFTREDUCE 1171
-#define YY_MAX_SHIFTREDUCE 1765
-#define YY_ERROR_ACTION 1766
-#define YY_ACCEPT_ACTION 1767
-#define YY_NO_ACTION 1768
-#define YY_MIN_REDUCE 1769
-#define YY_MAX_REDUCE 2363
+#define YY_MIN_SHIFTREDUCE 1172
+#define YY_MAX_SHIFTREDUCE 1767
+#define YY_ERROR_ACTION 1768
+#define YY_ACCEPT_ACTION 1769
+#define YY_NO_ACTION 1770
+#define YY_MIN_REDUCE 1771
+#define YY_MAX_REDUCE 2366
/************* End control #defines *******************************************/
#define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])))
@@ -558,279 +220,279 @@ typedef union {
*********** Begin parsing tables **********************************************/
#define YY_ACTTAB_COUNT (2730)
static const YYACTIONTYPE yy_action[] = {
- /* 0 */ 2175, 2065, 170, 218, 1781, 670, 447, 531, 665, 1812,
- /* 10 */ 662, 446, 48, 46, 1693, 1935, 2063, 671, 647, 1792,
- /* 20 */ 401, 2334, 1542, 41, 40, 410, 409, 47, 45, 44,
- /* 30 */ 43, 42, 686, 1623, 2235, 1540, 646, 188, 2193, 41,
- /* 40 */ 40, 2335, 648, 47, 45, 44, 43, 42, 1549, 2136,
- /* 50 */ 2143, 1570, 700, 622, 1567, 622, 2334, 543, 2334, 2058,
- /* 60 */ 2175, 181, 1618, 47, 45, 44, 43, 42, 19, 2143,
- /* 70 */ 701, 2340, 188, 2340, 188, 1548, 2335, 648, 2335, 648,
- /* 80 */ 220, 368, 2048, 360, 531, 2174, 1812, 2210, 107, 184,
- /* 90 */ 110, 2176, 704, 2178, 2179, 699, 622, 694, 2193, 2334,
- /* 100 */ 790, 1986, 185, 15, 2263, 143, 87, 641, 397, 2259,
- /* 110 */ 2143, 1791, 700, 1938, 2340, 188, 48, 46, 2065, 2335,
- /* 120 */ 648, 190, 2153, 370, 401, 2339, 1542, 1652, 2334, 2289,
- /* 130 */ 394, 683, 1941, 2062, 671, 2193, 1937, 1623, 205, 1540,
- /* 140 */ 1625, 1626, 453, 1317, 2338, 2174, 2157, 2210, 2335, 2337,
- /* 150 */ 110, 2176, 704, 2178, 2179, 699, 1316, 694, 1568, 404,
- /* 160 */ 145, 2143, 152, 2234, 2263, 181, 1618, 164, 397, 2259,
- /* 170 */ 1598, 1608, 19, 1999, 382, 1948, 1624, 1627, 84, 1548,
- /* 180 */ 381, 83, 1997, 2159, 1653, 1770, 2049, 347, 1997, 640,
- /* 190 */ 1543, 123, 1541, 694, 122, 121, 120, 119, 118, 117,
- /* 200 */ 116, 115, 114, 263, 790, 1552, 123, 15, 2175, 122,
+ /* 0 */ 2177, 2067, 170, 218, 1783, 670, 447, 531, 665, 1814,
+ /* 10 */ 662, 446, 48, 46, 1694, 1937, 2065, 671, 647, 1794,
+ /* 20 */ 401, 2337, 1543, 41, 40, 410, 409, 47, 45, 44,
+ /* 30 */ 43, 42, 686, 1624, 2237, 1541, 646, 188, 2195, 41,
+ /* 40 */ 40, 2338, 648, 47, 45, 44, 43, 42, 1550, 2138,
+ /* 50 */ 2145, 1571, 700, 622, 1568, 622, 2337, 543, 2337, 2060,
+ /* 60 */ 2177, 181, 1619, 47, 45, 44, 43, 42, 19, 2145,
+ /* 70 */ 701, 2343, 188, 2343, 188, 1549, 2338, 648, 2338, 648,
+ /* 80 */ 220, 368, 2050, 360, 531, 2176, 1814, 2212, 107, 184,
+ /* 90 */ 110, 2178, 704, 2180, 2181, 699, 622, 694, 2195, 2337,
+ /* 100 */ 790, 1988, 185, 15, 2265, 143, 87, 641, 397, 2261,
+ /* 110 */ 2145, 1793, 700, 1940, 2343, 188, 48, 46, 2067, 2338,
+ /* 120 */ 648, 190, 2155, 370, 401, 2342, 1543, 1653, 2337, 2291,
+ /* 130 */ 394, 683, 1943, 2064, 671, 2195, 1939, 1624, 205, 1541,
+ /* 140 */ 1626, 1627, 453, 1318, 2341, 2176, 2159, 2212, 2338, 2340,
+ /* 150 */ 110, 2178, 704, 2180, 2181, 699, 1317, 694, 1569, 404,
+ /* 160 */ 145, 2145, 152, 2236, 2265, 181, 1619, 164, 397, 2261,
+ /* 170 */ 1599, 1609, 19, 2001, 382, 1950, 1625, 1628, 84, 1549,
+ /* 180 */ 381, 83, 1999, 2161, 1654, 1772, 2051, 347, 1999, 640,
+ /* 190 */ 1544, 123, 1542, 694, 122, 121, 120, 119, 118, 117,
+ /* 200 */ 116, 115, 114, 263, 790, 1553, 123, 15, 2177, 122,
/* 210 */ 121, 120, 119, 118, 117, 116, 115, 114, 701, 669,
- /* 220 */ 1814, 500, 1546, 1547, 1769, 1597, 1600, 1601, 1602, 1603,
- /* 230 */ 1604, 1605, 1606, 1607, 696, 692, 1616, 1617, 1619, 1620,
- /* 240 */ 1621, 1622, 2, 642, 1625, 1626, 2193, 1790, 132, 131,
- /* 250 */ 130, 129, 128, 127, 126, 125, 124, 670, 2143, 62,
- /* 260 */ 700, 37, 399, 1647, 1648, 1649, 1650, 1651, 1655, 1656,
- /* 270 */ 1657, 1658, 38, 305, 1598, 1608, 1567, 287, 1397, 1398,
- /* 280 */ 1624, 1627, 1204, 683, 41, 40, 684, 1946, 47, 45,
- /* 290 */ 44, 43, 42, 2174, 1543, 2210, 1541, 2143, 110, 2176,
- /* 300 */ 704, 2178, 2179, 699, 528, 694, 133, 529, 1805, 668,
- /* 310 */ 2354, 2058, 2263, 568, 1567, 2175, 397, 2259, 62, 1566,
- /* 320 */ 93, 1206, 533, 1209, 1210, 662, 1546, 1547, 530, 1597,
- /* 330 */ 1600, 1601, 1602, 1603, 1604, 1605, 1606, 1607, 696, 692,
- /* 340 */ 1616, 1617, 1619, 1620, 1621, 1622, 2, 12, 48, 46,
- /* 350 */ 12, 637, 10, 2193, 395, 683, 401, 406, 1542, 1362,
- /* 360 */ 1992, 1994, 167, 373, 545, 2143, 51, 700, 670, 1623,
- /* 370 */ 1948, 1540, 684, 1946, 1353, 729, 728, 727, 1357, 726,
- /* 380 */ 1359, 1360, 725, 722, 739, 1368, 719, 1370, 1371, 716,
- /* 390 */ 713, 710, 133, 2175, 8, 2278, 659, 142, 1618, 573,
- /* 400 */ 2174, 1789, 2210, 698, 19, 110, 2176, 704, 2178, 2179,
- /* 410 */ 699, 1548, 694, 2339, 1229, 191, 1228, 185, 1923, 2263,
- /* 420 */ 679, 2275, 2058, 397, 2259, 250, 1599, 659, 142, 138,
- /* 430 */ 1569, 2193, 374, 1690, 372, 371, 790, 570, 51, 15,
- /* 440 */ 643, 638, 631, 2143, 2290, 700, 1569, 1230, 586, 585,
- /* 450 */ 584, 2143, 48, 46, 1628, 576, 139, 580, 1762, 572,
- /* 460 */ 401, 579, 1542, 571, 1452, 1453, 578, 583, 376, 375,
- /* 470 */ 12, 1721, 577, 1623, 191, 1540, 1625, 1626, 2174, 2278,
- /* 480 */ 2210, 1993, 1994, 341, 2176, 704, 2178, 2179, 699, 697,
- /* 490 */ 694, 685, 2228, 536, 1513, 1514, 529, 1805, 2175, 187,
- /* 500 */ 2271, 2272, 1618, 140, 2276, 2274, 1598, 1608, 701, 1229,
- /* 510 */ 2310, 1228, 1624, 1627, 1755, 1548, 659, 142, 634, 633,
- /* 520 */ 1719, 1720, 1722, 1723, 1724, 491, 1543, 574, 1541, 661,
- /* 530 */ 186, 2271, 2272, 525, 140, 2276, 2193, 14, 13, 1567,
- /* 540 */ 790, 523, 1230, 49, 519, 515, 659, 142, 2143, 1304,
- /* 550 */ 700, 737, 157, 156, 734, 733, 732, 154, 1546, 1547,
- /* 560 */ 1761, 1597, 1600, 1601, 1602, 1603, 1604, 1605, 1606, 1607,
- /* 570 */ 696, 692, 1616, 1617, 1619, 1620, 1621, 1622, 2, 575,
- /* 580 */ 1625, 1626, 285, 2174, 609, 2210, 209, 208, 110, 2176,
- /* 590 */ 704, 2178, 2179, 699, 191, 694, 2164, 1999, 285, 52,
- /* 600 */ 2354, 1302, 2263, 101, 391, 2175, 397, 2259, 2108, 490,
- /* 610 */ 1598, 1608, 1997, 1686, 600, 701, 1624, 1627, 1922, 283,
- /* 620 */ 2271, 658, 62, 134, 657, 66, 2334, 598, 1939, 596,
- /* 630 */ 1543, 435, 1541, 737, 157, 156, 734, 733, 732, 154,
- /* 640 */ 1666, 646, 188, 2193, 684, 1946, 2335, 648, 1767, 189,
- /* 650 */ 2271, 2272, 2166, 140, 2276, 2143, 251, 700, 437, 433,
- /* 660 */ 2029, 2137, 1546, 1547, 193, 1597, 1600, 1601, 1602, 1603,
- /* 670 */ 1604, 1605, 1606, 1607, 696, 692, 1616, 1617, 1619, 1620,
- /* 680 */ 1621, 1622, 2, 48, 46, 739, 169, 1232, 1233, 1689,
- /* 690 */ 2174, 401, 2210, 1542, 1887, 110, 2176, 704, 2178, 2179,
- /* 700 */ 699, 2044, 694, 1999, 1623, 2153, 1540, 2238, 622, 2263,
- /* 710 */ 396, 2334, 234, 397, 2259, 1788, 296, 297, 1997, 2162,
- /* 720 */ 416, 295, 1542, 2044, 62, 415, 2340, 188, 174, 2157,
- /* 730 */ 2175, 2335, 648, 1618, 167, 1540, 562, 558, 554, 550,
- /* 740 */ 701, 233, 1949, 1787, 41, 40, 1548, 201, 47, 45,
- /* 750 */ 44, 43, 42, 41, 40, 191, 1306, 47, 45, 44,
- /* 760 */ 43, 42, 1568, 684, 1946, 2143, 2159, 622, 2193, 203,
- /* 770 */ 2334, 790, 684, 1946, 49, 1548, 694, 1548, 191, 1786,
- /* 780 */ 2143, 88, 700, 57, 231, 2340, 188, 48, 46, 30,
- /* 790 */ 2335, 648, 681, 2143, 2175, 401, 1308, 1542, 684, 1946,
- /* 800 */ 790, 44, 43, 42, 701, 2044, 684, 1946, 1623, 2338,
- /* 810 */ 1540, 1625, 1626, 684, 1946, 2174, 2129, 2210, 451, 471,
- /* 820 */ 111, 2176, 704, 2178, 2179, 699, 452, 694, 470, 2143,
- /* 830 */ 564, 563, 2193, 461, 2263, 684, 1946, 1618, 2262, 2259,
- /* 840 */ 1732, 1598, 1608, 688, 2143, 2235, 700, 1624, 1627, 1321,
- /* 850 */ 1548, 207, 230, 224, 1212, 476, 54, 229, 3, 541,
- /* 860 */ 1566, 1543, 1320, 1541, 249, 423, 41, 40, 248, 87,
- /* 870 */ 47, 45, 44, 43, 42, 790, 74, 222, 15, 2174,
- /* 880 */ 191, 2210, 1469, 1470, 171, 2176, 704, 2178, 2179, 699,
- /* 890 */ 1543, 694, 1541, 1546, 1547, 1942, 1597, 1600, 1601, 1602,
- /* 900 */ 1603, 1604, 1605, 1606, 1607, 696, 692, 1616, 1617, 1619,
- /* 910 */ 1620, 1621, 1622, 2, 144, 1625, 1626, 2234, 1468, 1471,
- /* 920 */ 684, 1946, 1546, 1547, 623, 2300, 82, 502, 90, 566,
- /* 930 */ 565, 355, 106, 404, 380, 351, 602, 1565, 684, 1946,
- /* 940 */ 477, 167, 103, 2175, 484, 1598, 1608, 498, 1999, 1948,
- /* 950 */ 497, 1624, 1627, 701, 731, 629, 454, 1990, 544, 684,
- /* 960 */ 1946, 2339, 1709, 1998, 2334, 1543, 467, 1541, 499, 455,
- /* 970 */ 1785, 684, 1946, 469, 684, 1946, 34, 1209, 1210, 1943,
- /* 980 */ 2338, 2193, 41, 40, 2335, 2336, 47, 45, 44, 43,
- /* 990 */ 42, 252, 2126, 2143, 260, 700, 735, 1546, 1547, 1990,
- /* 1000 */ 1597, 1600, 1601, 1602, 1603, 1604, 1605, 1606, 1607, 696,
- /* 1010 */ 692, 1616, 1617, 1619, 1620, 1621, 1622, 2, 1845, 369,
- /* 1020 */ 2143, 730, 684, 1946, 684, 1946, 684, 1946, 2174, 736,
- /* 1030 */ 2210, 457, 1990, 110, 2176, 704, 2178, 2179, 699, 148,
- /* 1040 */ 694, 135, 286, 36, 667, 2354, 300, 2263, 691, 41,
- /* 1050 */ 40, 397, 2259, 47, 45, 44, 43, 42, 582, 581,
- /* 1060 */ 749, 495, 761, 759, 489, 488, 487, 486, 483, 482,
+ /* 220 */ 1816, 500, 1547, 1548, 1771, 1598, 1601, 1602, 1603, 1604,
+ /* 230 */ 1605, 1606, 1607, 1608, 696, 692, 1617, 1618, 1620, 1621,
+ /* 240 */ 1622, 1623, 2, 642, 1626, 1627, 2195, 1792, 132, 131,
+ /* 250 */ 130, 129, 128, 127, 126, 125, 124, 670, 2145, 62,
+ /* 260 */ 700, 37, 399, 1648, 1649, 1650, 1651, 1652, 1656, 1657,
+ /* 270 */ 1658, 1659, 38, 305, 1599, 1609, 1568, 287, 1398, 1399,
+ /* 280 */ 1625, 1628, 1205, 683, 41, 40, 684, 1948, 47, 45,
+ /* 290 */ 44, 43, 42, 2176, 1544, 2212, 1542, 2145, 110, 2178,
+ /* 300 */ 704, 2180, 2181, 699, 528, 694, 133, 529, 1807, 668,
+ /* 310 */ 2357, 2060, 2265, 568, 1568, 2177, 397, 2261, 62, 1567,
+ /* 320 */ 93, 1207, 533, 1210, 1211, 662, 1547, 1548, 530, 1598,
+ /* 330 */ 1601, 1602, 1603, 1604, 1605, 1606, 1607, 1608, 696, 692,
+ /* 340 */ 1617, 1618, 1620, 1621, 1622, 1623, 2, 12, 48, 46,
+ /* 350 */ 12, 637, 10, 2195, 395, 683, 401, 406, 1543, 1363,
+ /* 360 */ 1994, 1996, 167, 373, 545, 2145, 51, 700, 670, 1624,
+ /* 370 */ 1950, 1541, 684, 1948, 1354, 729, 728, 727, 1358, 726,
+ /* 380 */ 1360, 1361, 725, 722, 2131, 1369, 719, 1371, 1372, 716,
+ /* 390 */ 713, 710, 133, 2177, 8, 2280, 659, 142, 1619, 573,
+ /* 400 */ 2176, 1791, 2212, 698, 19, 110, 2178, 704, 2180, 2181,
+ /* 410 */ 699, 1549, 694, 2342, 1230, 191, 1229, 185, 1925, 2265,
+ /* 420 */ 679, 2277, 2060, 397, 2261, 250, 1600, 659, 142, 138,
+ /* 430 */ 1570, 2195, 374, 423, 372, 371, 790, 570, 51, 15,
+ /* 440 */ 643, 638, 631, 2145, 2292, 700, 1570, 1231, 586, 585,
+ /* 450 */ 584, 2145, 48, 46, 1629, 576, 139, 580, 1764, 572,
+ /* 460 */ 401, 579, 1543, 571, 1453, 1454, 578, 583, 376, 375,
+ /* 470 */ 609, 1722, 577, 1624, 191, 1541, 1626, 1627, 2176, 2280,
+ /* 480 */ 2212, 1995, 1996, 341, 2178, 704, 2180, 2181, 699, 697,
+ /* 490 */ 694, 685, 2230, 536, 1514, 1515, 529, 1807, 2177, 187,
+ /* 500 */ 2273, 2274, 1619, 140, 2278, 2276, 1599, 1609, 701, 1230,
+ /* 510 */ 2312, 1229, 1625, 1628, 1757, 1549, 659, 142, 634, 633,
+ /* 520 */ 1720, 1721, 1723, 1724, 1725, 491, 1544, 739, 1542, 661,
+ /* 530 */ 186, 2273, 2274, 525, 140, 2278, 2195, 14, 13, 1568,
+ /* 540 */ 790, 523, 1231, 49, 519, 515, 659, 142, 2145, 1790,
+ /* 550 */ 700, 737, 157, 156, 734, 733, 732, 154, 1547, 1548,
+ /* 560 */ 1763, 1598, 1601, 1602, 1603, 1604, 1605, 1606, 1607, 1608,
+ /* 570 */ 696, 692, 1617, 1618, 1620, 1621, 1622, 1623, 2, 574,
+ /* 580 */ 1626, 1627, 285, 2176, 2341, 2212, 209, 208, 110, 2178,
+ /* 590 */ 704, 2180, 2181, 699, 191, 694, 12, 2001, 285, 2145,
+ /* 600 */ 2357, 1305, 2265, 101, 391, 2177, 397, 2261, 2110, 490,
+ /* 610 */ 1599, 1609, 1999, 1687, 600, 701, 1625, 1628, 1924, 283,
+ /* 620 */ 2273, 658, 62, 134, 657, 66, 2337, 598, 1941, 596,
+ /* 630 */ 1544, 435, 1542, 737, 157, 156, 734, 733, 732, 154,
+ /* 640 */ 1667, 646, 188, 2195, 684, 1948, 2338, 648, 1769, 189,
+ /* 650 */ 2273, 2274, 1549, 140, 2278, 2145, 251, 700, 437, 433,
+ /* 660 */ 2031, 2139, 1547, 1548, 193, 1598, 1601, 1602, 1603, 1604,
+ /* 670 */ 1605, 1606, 1607, 1608, 696, 692, 1617, 1618, 1620, 1621,
+ /* 680 */ 1622, 1623, 2, 48, 46, 739, 169, 1233, 1234, 52,
+ /* 690 */ 2176, 401, 2212, 1543, 1889, 110, 2178, 704, 2180, 2181,
+ /* 700 */ 699, 575, 694, 2001, 1624, 2155, 1541, 2240, 622, 2265,
+ /* 710 */ 396, 2337, 234, 397, 2261, 44, 43, 42, 1999, 2164,
+ /* 720 */ 416, 1322, 1543, 1303, 62, 415, 2343, 188, 174, 2159,
+ /* 730 */ 2177, 2338, 648, 1619, 1321, 1541, 562, 558, 554, 550,
+ /* 740 */ 701, 233, 688, 1789, 2237, 2155, 1549, 41, 40, 1307,
+ /* 750 */ 34, 47, 45, 44, 43, 42, 41, 40, 1264, 2163,
+ /* 760 */ 47, 45, 44, 43, 42, 1926, 2161, 622, 2195, 2159,
+ /* 770 */ 2337, 790, 684, 1948, 49, 1549, 694, 730, 191, 1788,
+ /* 780 */ 2145, 88, 700, 30, 231, 2343, 188, 48, 46, 1309,
+ /* 790 */ 2338, 648, 681, 2145, 2177, 401, 1571, 1543, 1265, 502,
+ /* 800 */ 790, 1787, 564, 563, 701, 749, 2161, 398, 1624, 150,
+ /* 810 */ 1541, 1626, 1627, 684, 1948, 2176, 694, 2212, 1569, 471,
+ /* 820 */ 111, 2178, 704, 2180, 2181, 699, 1933, 694, 470, 2145,
+ /* 830 */ 566, 565, 2195, 57, 2265, 684, 1948, 1619, 2264, 2261,
+ /* 840 */ 1571, 1599, 1609, 1734, 2145, 191, 700, 1625, 1628, 2046,
+ /* 850 */ 1549, 2145, 230, 224, 572, 451, 1935, 229, 571, 541,
+ /* 860 */ 650, 1544, 144, 1542, 249, 2236, 41, 40, 248, 1786,
+ /* 870 */ 47, 45, 44, 43, 42, 790, 1698, 222, 15, 2176,
+ /* 880 */ 191, 2212, 1568, 2046, 171, 2178, 704, 2180, 2181, 699,
+ /* 890 */ 1544, 694, 1542, 1547, 1548, 201, 1598, 1601, 1602, 1603,
+ /* 900 */ 1604, 1605, 1606, 1607, 1608, 696, 692, 1617, 1618, 1620,
+ /* 910 */ 1621, 1622, 1623, 2, 1931, 1626, 1627, 582, 581, 2145,
+ /* 920 */ 684, 1948, 1547, 1548, 623, 2302, 1952, 2001, 90, 203,
+ /* 930 */ 2280, 355, 2046, 404, 380, 351, 602, 1566, 1470, 1471,
+ /* 940 */ 452, 167, 2000, 2177, 484, 1599, 1609, 498, 202, 1950,
+ /* 950 */ 497, 1625, 1628, 701, 256, 629, 2275, 684, 1948, 684,
+ /* 960 */ 1948, 2342, 1733, 1213, 2337, 1544, 467, 1542, 499, 1567,
+ /* 970 */ 1785, 684, 1948, 469, 1469, 1472, 36, 461, 207, 476,
+ /* 980 */ 2341, 2195, 41, 40, 2338, 2339, 47, 45, 44, 43,
+ /* 990 */ 42, 477, 262, 2145, 695, 700, 731, 1547, 1548, 1992,
+ /* 1000 */ 1598, 1601, 1602, 1603, 1604, 1605, 1606, 1607, 1608, 696,
+ /* 1010 */ 692, 1617, 1618, 1620, 1621, 1622, 1623, 2, 1847, 369,
+ /* 1020 */ 2145, 167, 684, 1948, 684, 1948, 684, 1948, 2176, 1951,
+ /* 1030 */ 2212, 457, 1600, 110, 2178, 704, 2180, 2181, 699, 54,
+ /* 1040 */ 694, 3, 544, 259, 1945, 2357, 252, 2265, 1890, 41,
+ /* 1050 */ 40, 397, 2261, 47, 45, 44, 43, 42, 296, 297,
+ /* 1060 */ 2128, 495, 2305, 295, 489, 488, 487, 486, 483, 482,
/* 1070 */ 481, 480, 479, 475, 474, 473, 472, 350, 464, 463,
- /* 1080 */ 462, 607, 459, 458, 367, 650, 1784, 1697, 767, 766,
- /* 1090 */ 765, 764, 413, 1567, 763, 762, 146, 757, 756, 755,
+ /* 1080 */ 462, 607, 459, 458, 367, 1691, 1782, 1634, 767, 766,
+ /* 1090 */ 765, 764, 413, 1568, 763, 762, 146, 757, 756, 755,
/* 1100 */ 754, 753, 752, 751, 159, 747, 746, 745, 412, 411,
- /* 1110 */ 742, 741, 740, 177, 176, 168, 1848, 2278, 41, 40,
- /* 1120 */ 325, 1633, 47, 45, 44, 43, 42, 1567, 622, 2175,
- /* 1130 */ 1783, 2334, 1931, 1999, 323, 73, 2143, 1570, 72, 701,
- /* 1140 */ 405, 2328, 407, 2273, 684, 1946, 2340, 188, 1997, 348,
- /* 1150 */ 167, 2335, 648, 1654, 684, 1946, 62, 1933, 1948, 1780,
- /* 1160 */ 216, 510, 508, 505, 682, 2175, 1921, 2193, 1779, 155,
- /* 1170 */ 1999, 684, 1946, 319, 306, 701, 1976, 366, 1778, 2143,
- /* 1180 */ 2143, 700, 1777, 1570, 651, 1997, 586, 585, 584, 750,
- /* 1190 */ 1924, 408, 1908, 576, 139, 580, 1776, 572, 654, 579,
- /* 1200 */ 62, 571, 1644, 2193, 578, 583, 376, 375, 430, 2143,
- /* 1210 */ 577, 1775, 1929, 1774, 2174, 2143, 2210, 700, 2143, 110,
- /* 1220 */ 2176, 704, 2178, 2179, 699, 1773, 694, 1832, 2143, 56,
- /* 1230 */ 35, 2354, 2143, 2263, 150, 2175, 1263, 397, 2259, 109,
- /* 1240 */ 1659, 1772, 445, 1599, 444, 701, 2143, 2282, 647, 587,
- /* 1250 */ 2174, 2334, 2210, 2283, 1686, 172, 2176, 704, 2178, 2179,
- /* 1260 */ 699, 2143, 694, 2143, 1764, 1765, 646, 188, 604, 1950,
- /* 1270 */ 603, 2335, 648, 2193, 443, 2143, 1264, 1599, 256, 81,
- /* 1280 */ 80, 450, 166, 695, 200, 2143, 2175, 700, 1823, 202,
- /* 1290 */ 239, 2143, 621, 237, 155, 259, 701, 442, 440, 737,
- /* 1300 */ 157, 156, 734, 733, 732, 154, 649, 2355, 349, 2175,
- /* 1310 */ 589, 431, 191, 1782, 429, 425, 421, 418, 443, 701,
- /* 1320 */ 2174, 2297, 2210, 1888, 2193, 110, 2176, 704, 2178, 2179,
- /* 1330 */ 699, 241, 694, 1551, 240, 262, 2143, 2354, 700, 2263,
- /* 1340 */ 1821, 1550, 2303, 397, 2259, 410, 409, 2193, 243, 245,
- /* 1350 */ 280, 242, 244, 635, 1508, 1556, 191, 14, 13, 2143,
- /* 1360 */ 2175, 700, 592, 155, 261, 50, 1623, 50, 1549, 267,
- /* 1370 */ 701, 2174, 155, 2210, 50, 293, 335, 2176, 704, 2178,
- /* 1380 */ 2179, 699, 71, 694, 137, 41, 40, 743, 153, 47,
- /* 1390 */ 45, 44, 43, 42, 2174, 1618, 2210, 274, 2193, 110,
- /* 1400 */ 2176, 704, 2178, 2179, 699, 155, 694, 91, 1548, 1282,
- /* 1410 */ 2143, 2354, 700, 2263, 2153, 1886, 55, 397, 2259, 644,
- /* 1420 */ 2175, 652, 64, 1511, 50, 1718, 50, 1717, 2161, 269,
- /* 1430 */ 701, 708, 666, 690, 1466, 298, 153, 655, 2157, 744,
- /* 1440 */ 155, 1885, 676, 136, 153, 2174, 2194, 2210, 302, 2175,
- /* 1450 */ 110, 2176, 704, 2178, 2179, 699, 1815, 694, 2193, 701,
- /* 1460 */ 2053, 1280, 2236, 1806, 2263, 1347, 414, 1987, 397, 2259,
- /* 1470 */ 2143, 1811, 700, 660, 2293, 2159, 398, 282, 279, 1,
- /* 1480 */ 9, 417, 1660, 422, 1609, 694, 318, 2193, 1573, 364,
- /* 1490 */ 1554, 1375, 438, 195, 196, 439, 1379, 198, 1553, 2143,
- /* 1500 */ 1386, 700, 441, 1384, 158, 2174, 785, 2210, 1489, 206,
- /* 1510 */ 110, 2176, 704, 2178, 2179, 699, 313, 694, 1570, 456,
- /* 1520 */ 2054, 493, 687, 1557, 2263, 1552, 460, 465, 397, 2259,
- /* 1530 */ 1565, 478, 485, 2046, 2174, 504, 2210, 492, 494, 111,
- /* 1540 */ 2176, 704, 2178, 2179, 699, 503, 694, 591, 501, 210,
- /* 1550 */ 506, 211, 507, 2263, 213, 1560, 1562, 689, 2259, 509,
- /* 1560 */ 511, 1571, 601, 526, 4, 2175, 527, 537, 692, 1616,
- /* 1570 */ 1617, 1619, 1620, 1621, 1622, 701, 247, 534, 535, 1568,
- /* 1580 */ 221, 538, 1572, 1574, 223, 539, 540, 226, 542, 228,
- /* 1590 */ 567, 2175, 594, 569, 85, 546, 86, 232, 354, 588,
- /* 1600 */ 606, 701, 2117, 2193, 112, 246, 1936, 2114, 236, 608,
- /* 1610 */ 89, 1932, 151, 2113, 314, 2143, 253, 700, 238, 612,
- /* 1620 */ 611, 160, 613, 161, 255, 2175, 257, 1934, 619, 2193,
- /* 1630 */ 1930, 162, 163, 1496, 617, 701, 636, 2309, 7, 616,
- /* 1640 */ 674, 2143, 2308, 700, 2285, 70, 645, 273, 69, 626,
- /* 1650 */ 702, 275, 2210, 627, 387, 111, 2176, 704, 2178, 2179,
- /* 1660 */ 699, 2294, 694, 2193, 2304, 632, 386, 618, 265, 2263,
- /* 1670 */ 268, 639, 276, 359, 2259, 2143, 2174, 700, 2210, 175,
- /* 1680 */ 625, 111, 2176, 704, 2178, 2179, 699, 2175, 694, 624,
- /* 1690 */ 278, 656, 2357, 653, 2333, 2263, 1686, 701, 141, 1569,
- /* 1700 */ 2260, 2279, 663, 664, 390, 288, 96, 2059, 1575, 677,
- /* 1710 */ 2174, 2175, 2210, 315, 672, 171, 2176, 704, 2178, 2179,
- /* 1720 */ 699, 701, 694, 316, 277, 2193, 673, 2073, 678, 2072,
- /* 1730 */ 384, 2071, 393, 317, 61, 2175, 1947, 2143, 2244, 700,
- /* 1740 */ 98, 100, 102, 281, 1909, 701, 706, 1991, 786, 2193,
- /* 1750 */ 320, 787, 789, 309, 385, 344, 2301, 356, 53, 322,
- /* 1760 */ 329, 2143, 343, 700, 357, 333, 324, 2135, 2134, 2133,
- /* 1770 */ 78, 2130, 2174, 2193, 2210, 419, 420, 342, 2176, 704,
- /* 1780 */ 2178, 2179, 699, 1533, 694, 2143, 1534, 700, 194, 424,
- /* 1790 */ 2128, 426, 427, 428, 2127, 365, 2174, 2125, 2210, 2175,
- /* 1800 */ 432, 342, 2176, 704, 2178, 2179, 699, 2124, 694, 701,
- /* 1810 */ 434, 2123, 436, 1524, 2104, 197, 2103, 199, 1492, 79,
- /* 1820 */ 2174, 2085, 2210, 1491, 2084, 172, 2176, 704, 2178, 2179,
- /* 1830 */ 699, 2083, 694, 448, 449, 2082, 2081, 2193, 1443, 2037,
- /* 1840 */ 2036, 2034, 392, 147, 2033, 2032, 2035, 2031, 2030, 2143,
- /* 1850 */ 2028, 700, 2027, 2026, 204, 466, 2025, 468, 2039, 2024,
- /* 1860 */ 2023, 2022, 2021, 2175, 149, 2009, 2008, 2007, 2038, 2006,
- /* 1870 */ 2005, 1445, 2004, 698, 2020, 2019, 2018, 2356, 2017, 2016,
- /* 1880 */ 2015, 2014, 2013, 2012, 2174, 2175, 2210, 2011, 2010, 342,
- /* 1890 */ 2176, 704, 2178, 2179, 699, 701, 694, 2003, 2002, 2001,
- /* 1900 */ 2000, 2193, 496, 352, 1851, 353, 1318, 1850, 1322, 2175,
- /* 1910 */ 227, 2079, 1314, 2143, 1849, 700, 212, 1847, 1844, 701,
- /* 1920 */ 1843, 1836, 513, 2193, 512, 214, 516, 1825, 400, 514,
- /* 1930 */ 520, 524, 518, 215, 1801, 2143, 235, 700, 1211, 1800,
- /* 1940 */ 522, 517, 76, 521, 217, 2102, 219, 2193, 2174, 182,
- /* 1950 */ 2210, 2092, 402, 341, 2176, 704, 2178, 2179, 699, 2143,
- /* 1960 */ 694, 700, 2229, 610, 77, 2080, 2163, 225, 2057, 183,
- /* 1970 */ 2174, 1925, 2210, 532, 1846, 342, 2176, 704, 2178, 2179,
- /* 1980 */ 699, 793, 694, 1842, 1256, 547, 549, 548, 1840, 551,
- /* 1990 */ 552, 553, 1838, 555, 2174, 312, 2210, 2175, 556, 342,
- /* 2000 */ 2176, 704, 2178, 2179, 699, 557, 694, 701, 1835, 560,
- /* 2010 */ 559, 180, 561, 1820, 1818, 1819, 2175, 1817, 1797, 783,
- /* 2020 */ 779, 775, 771, 1927, 310, 63, 701, 2175, 1391, 1390,
- /* 2030 */ 1926, 758, 1305, 1303, 1301, 2193, 1300, 701, 1299, 1298,
- /* 2040 */ 1297, 1294, 1292, 1833, 760, 1293, 1291, 2143, 377, 700,
- /* 2050 */ 1824, 378, 1822, 590, 2193, 379, 593, 1796, 1795, 595,
- /* 2060 */ 1794, 599, 597, 1518, 108, 2193, 2143, 303, 700, 113,
- /* 2070 */ 1520, 1517, 2101, 1522, 2091, 29, 1498, 2143, 1500, 700,
- /* 2080 */ 58, 67, 605, 614, 2210, 2339, 258, 337, 2176, 704,
- /* 2090 */ 2178, 2179, 699, 2078, 694, 2175, 2076, 20, 31, 5,
- /* 2100 */ 680, 2174, 165, 2210, 615, 701, 326, 2176, 704, 2178,
- /* 2110 */ 2179, 699, 2174, 694, 2210, 2175, 383, 327, 2176, 704,
- /* 2120 */ 2178, 2179, 699, 1734, 694, 701, 2175, 1502, 6, 65,
- /* 2130 */ 21, 630, 620, 2193, 264, 290, 701, 173, 628, 22,
- /* 2140 */ 289, 271, 266, 33, 1716, 2143, 2175, 700, 270, 32,
- /* 2150 */ 272, 1708, 2164, 2193, 24, 1749, 701, 92, 1748, 1754,
- /* 2160 */ 254, 60, 388, 1755, 2193, 2143, 1753, 700, 1752, 389,
- /* 2170 */ 1683, 1682, 284, 2077, 2075, 178, 2143, 2074, 700, 17,
- /* 2180 */ 2174, 2056, 2210, 95, 2193, 328, 2176, 704, 2178, 2179,
- /* 2190 */ 699, 94, 694, 291, 23, 25, 2143, 294, 700, 59,
- /* 2200 */ 2174, 299, 2210, 18, 2175, 334, 2176, 704, 2178, 2179,
- /* 2210 */ 699, 2174, 694, 2210, 701, 292, 338, 2176, 704, 2178,
- /* 2220 */ 2179, 699, 1714, 694, 68, 2175, 2055, 97, 103, 304,
- /* 2230 */ 26, 2174, 99, 2210, 11, 701, 330, 2176, 704, 2178,
- /* 2240 */ 2179, 699, 2193, 694, 675, 13, 301, 1558, 1635, 1634,
- /* 2250 */ 2175, 179, 2213, 693, 2143, 1613, 700, 1611, 39, 16,
- /* 2260 */ 701, 1610, 27, 2193, 1645, 192, 1582, 1590, 703, 28,
- /* 2270 */ 707, 1376, 705, 403, 709, 2143, 2175, 700, 307, 1373,
- /* 2280 */ 1372, 711, 712, 714, 1369, 717, 701, 715, 2193, 2174,
- /* 2290 */ 720, 2210, 718, 721, 339, 2176, 704, 2178, 2179, 699,
- /* 2300 */ 2143, 694, 700, 1363, 1361, 723, 1385, 1381, 724, 1254,
- /* 2310 */ 2174, 104, 2210, 105, 2193, 331, 2176, 704, 2178, 2179,
- /* 2320 */ 699, 1367, 694, 1366, 75, 738, 2143, 1365, 700, 1286,
- /* 2330 */ 1285, 1364, 1284, 1283, 1281, 2174, 2175, 2210, 1279, 1278,
- /* 2340 */ 340, 2176, 704, 2178, 2179, 699, 701, 694, 1277, 1312,
- /* 2350 */ 748, 308, 2175, 1275, 1274, 1273, 1272, 1271, 1270, 1269,
- /* 2360 */ 1307, 2174, 701, 2210, 1309, 2175, 332, 2176, 704, 2178,
- /* 2370 */ 2179, 699, 1266, 694, 2193, 701, 1265, 1262, 1261, 1260,
- /* 2380 */ 1259, 1841, 768, 770, 769, 1839, 2143, 772, 700, 773,
- /* 2390 */ 2193, 1837, 774, 776, 778, 777, 1834, 780, 781, 782,
- /* 2400 */ 1816, 784, 2143, 2193, 700, 1201, 1793, 792, 311, 788,
- /* 2410 */ 1768, 1544, 321, 791, 1768, 2143, 1768, 700, 1768, 1768,
- /* 2420 */ 1768, 2174, 1768, 2210, 1768, 2175, 345, 2176, 704, 2178,
- /* 2430 */ 2179, 699, 1768, 694, 1768, 701, 1768, 2174, 1768, 2210,
- /* 2440 */ 1768, 2175, 346, 2176, 704, 2178, 2179, 699, 1768, 694,
- /* 2450 */ 2174, 701, 2210, 1768, 2175, 2187, 2176, 704, 2178, 2179,
- /* 2460 */ 699, 1768, 694, 2193, 701, 1768, 1768, 1768, 1768, 1768,
- /* 2470 */ 1768, 1768, 1768, 1768, 1768, 2143, 1768, 700, 1768, 2193,
- /* 2480 */ 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768,
- /* 2490 */ 1768, 2143, 2193, 700, 1768, 1768, 1768, 1768, 1768, 1768,
- /* 2500 */ 1768, 1768, 1768, 1768, 2143, 1768, 700, 1768, 1768, 1768,
- /* 2510 */ 2174, 1768, 2210, 1768, 1768, 2186, 2176, 704, 2178, 2179,
- /* 2520 */ 699, 1768, 694, 1768, 1768, 1768, 2174, 2175, 2210, 1768,
- /* 2530 */ 1768, 2185, 2176, 704, 2178, 2179, 699, 701, 694, 2174,
- /* 2540 */ 1768, 2210, 1768, 2175, 361, 2176, 704, 2178, 2179, 699,
- /* 2550 */ 1768, 694, 1768, 701, 2175, 1768, 1768, 1768, 1768, 1768,
- /* 2560 */ 1768, 1768, 1768, 1768, 701, 2193, 1768, 1768, 1768, 1768,
- /* 2570 */ 1768, 1768, 1768, 1768, 1768, 1768, 1768, 2143, 1768, 700,
- /* 2580 */ 1768, 2193, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768,
- /* 2590 */ 1768, 1768, 2193, 2143, 1768, 700, 1768, 1768, 1768, 1768,
- /* 2600 */ 1768, 1768, 1768, 1768, 2143, 1768, 700, 1768, 1768, 1768,
- /* 2610 */ 1768, 1768, 2174, 1768, 2210, 1768, 2175, 362, 2176, 704,
- /* 2620 */ 2178, 2179, 699, 1768, 694, 1768, 701, 1768, 2174, 1768,
- /* 2630 */ 2210, 1768, 2175, 358, 2176, 704, 2178, 2179, 699, 2174,
- /* 2640 */ 694, 2210, 701, 1768, 363, 2176, 704, 2178, 2179, 699,
- /* 2650 */ 1768, 694, 1768, 1768, 2193, 1768, 1768, 1768, 1768, 1768,
- /* 2660 */ 1768, 1768, 1768, 1768, 1768, 1768, 2143, 1768, 700, 1768,
- /* 2670 */ 2193, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768,
- /* 2680 */ 1768, 1768, 2143, 1768, 700, 1768, 1768, 1768, 1768, 1768,
- /* 2690 */ 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768,
- /* 2700 */ 1768, 702, 1768, 2210, 1768, 1768, 337, 2176, 704, 2178,
- /* 2710 */ 2179, 699, 1768, 694, 1768, 1768, 1768, 2174, 1768, 2210,
- /* 2720 */ 1768, 1768, 336, 2176, 704, 2178, 2179, 699, 1768, 694,
+ /* 1110 */ 742, 741, 740, 177, 176, 168, 1850, 454, 41, 40,
+ /* 1120 */ 326, 1655, 47, 45, 44, 43, 42, 87, 622, 2177,
+ /* 1130 */ 455, 2337, 1784, 2001, 323, 73, 2145, 155, 72, 701,
+ /* 1140 */ 405, 2330, 1781, 761, 759, 1710, 2343, 188, 1999, 348,
+ /* 1150 */ 280, 2338, 648, 1944, 684, 1948, 62, 635, 684, 1948,
+ /* 1160 */ 216, 510, 508, 505, 137, 2177, 1923, 2195, 1780, 691,
+ /* 1170 */ 2001, 684, 1948, 735, 260, 701, 1992, 366, 286, 2145,
+ /* 1180 */ 1888, 700, 684, 1948, 1779, 1999, 586, 585, 584, 684,
+ /* 1190 */ 1948, 667, 2145, 576, 139, 580, 1778, 56, 35, 579,
+ /* 1200 */ 62, 651, 300, 2195, 578, 583, 376, 375, 1660, 682,
+ /* 1210 */ 577, 274, 1210, 1211, 2176, 2145, 2212, 700, 2145, 110,
+ /* 1220 */ 2178, 704, 2180, 2181, 699, 1777, 694, 654, 1776, 684,
+ /* 1230 */ 1948, 2357, 1887, 2265, 2145, 2177, 414, 397, 2261, 109,
+ /* 1240 */ 1775, 1774, 445, 1600, 444, 701, 2145, 2284, 647, 306,
+ /* 1250 */ 2176, 2337, 2212, 2285, 1687, 172, 2178, 704, 2180, 2181,
+ /* 1260 */ 699, 407, 694, 684, 1948, 736, 646, 188, 1992, 167,
+ /* 1270 */ 2196, 2338, 648, 2195, 443, 2145, 430, 1950, 2145, 81,
+ /* 1280 */ 80, 450, 166, 408, 200, 2145, 2177, 700, 261, 319,
+ /* 1290 */ 2145, 2145, 1978, 604, 2055, 603, 701, 442, 440, 737,
+ /* 1300 */ 157, 156, 734, 733, 732, 154, 649, 2358, 349, 2177,
+ /* 1310 */ 750, 431, 191, 1910, 429, 425, 421, 418, 443, 701,
+ /* 1320 */ 2176, 2299, 2212, 1645, 2195, 110, 2178, 704, 2180, 2181,
+ /* 1330 */ 699, 91, 694, 148, 74, 135, 2145, 2357, 700, 2265,
+ /* 1340 */ 1834, 1690, 1825, 397, 2261, 410, 409, 2195, 239, 241,
+ /* 1350 */ 243, 237, 240, 242, 245, 1557, 191, 244, 621, 2145,
+ /* 1360 */ 2177, 700, 587, 155, 589, 1823, 1624, 155, 1550, 50,
+ /* 1370 */ 701, 2176, 50, 2212, 267, 155, 335, 2178, 704, 2180,
+ /* 1380 */ 2181, 699, 50, 694, 82, 41, 40, 592, 293, 47,
+ /* 1390 */ 45, 44, 43, 42, 2176, 1619, 2212, 1552, 2195, 110,
+ /* 1400 */ 2178, 704, 2180, 2181, 699, 71, 694, 153, 1549, 1551,
+ /* 1410 */ 2145, 2357, 700, 2265, 1766, 1767, 155, 397, 2261, 644,
+ /* 1420 */ 2177, 14, 13, 1509, 64, 50, 50, 1512, 708, 1719,
+ /* 1430 */ 701, 153, 1718, 690, 269, 666, 2166, 155, 652, 743,
+ /* 1440 */ 136, 744, 1467, 153, 1817, 2176, 106, 2212, 298, 2177,
+ /* 1450 */ 110, 2178, 704, 2180, 2181, 699, 103, 694, 2195, 701,
+ /* 1460 */ 1808, 1283, 2238, 1281, 2265, 676, 655, 302, 397, 2261,
+ /* 1470 */ 2145, 1813, 700, 1989, 2295, 660, 1348, 282, 279, 1,
+ /* 1480 */ 9, 417, 55, 422, 1661, 1610, 318, 2195, 1376, 364,
+ /* 1490 */ 1574, 1380, 2168, 438, 785, 439, 195, 1387, 196, 2145,
+ /* 1500 */ 1385, 700, 441, 158, 198, 2176, 1490, 2212, 313, 206,
+ /* 1510 */ 110, 2178, 704, 2180, 2181, 699, 456, 694, 1571, 460,
+ /* 1520 */ 2056, 493, 687, 1558, 2265, 1553, 465, 1566, 397, 2261,
+ /* 1530 */ 478, 2048, 485, 492, 2176, 504, 2212, 494, 503, 111,
+ /* 1540 */ 2178, 704, 2180, 2181, 699, 501, 694, 591, 210, 211,
+ /* 1550 */ 506, 507, 213, 2265, 1555, 1561, 1563, 689, 2261, 509,
+ /* 1560 */ 511, 1572, 601, 526, 4, 2177, 1554, 537, 692, 1617,
+ /* 1570 */ 1618, 1620, 1621, 1622, 1623, 701, 247, 527, 534, 535,
+ /* 1580 */ 221, 1569, 538, 1573, 1575, 223, 539, 540, 226, 542,
+ /* 1590 */ 228, 2177, 594, 546, 567, 85, 569, 86, 232, 588,
+ /* 1600 */ 354, 701, 1938, 2195, 112, 246, 236, 1934, 608, 606,
+ /* 1610 */ 151, 89, 238, 2119, 314, 2145, 253, 700, 612, 613,
+ /* 1620 */ 611, 255, 257, 160, 161, 2177, 1936, 1932, 162, 2195,
+ /* 1630 */ 1497, 163, 617, 619, 636, 701, 2311, 674, 2287, 2310,
+ /* 1640 */ 7, 2145, 645, 700, 2116, 70, 2115, 273, 69, 616,
+ /* 1650 */ 702, 175, 2212, 626, 627, 111, 2178, 704, 2180, 2181,
+ /* 1660 */ 699, 632, 694, 2195, 2296, 2306, 386, 265, 639, 2265,
+ /* 1670 */ 275, 618, 268, 359, 2261, 2145, 2176, 700, 2212, 625,
+ /* 1680 */ 276, 111, 2178, 704, 2180, 2181, 699, 2177, 694, 624,
+ /* 1690 */ 278, 387, 2360, 656, 653, 2265, 1687, 701, 141, 1570,
+ /* 1700 */ 2262, 2281, 663, 664, 390, 288, 96, 2061, 1576, 677,
+ /* 1710 */ 2176, 2177, 2212, 315, 672, 171, 2178, 704, 2180, 2181,
+ /* 1720 */ 699, 701, 694, 678, 673, 2195, 2075, 2074, 61, 2073,
+ /* 1730 */ 384, 277, 316, 317, 98, 2177, 281, 2145, 1949, 700,
+ /* 1740 */ 2246, 393, 100, 102, 786, 701, 2336, 1993, 309, 2195,
+ /* 1750 */ 706, 1911, 320, 787, 385, 789, 2303, 329, 53, 324,
+ /* 1760 */ 2137, 2145, 356, 700, 357, 322, 344, 2136, 2135, 343,
+ /* 1770 */ 333, 78, 2176, 2195, 2212, 419, 1534, 342, 2178, 704,
+ /* 1780 */ 2180, 2181, 699, 2132, 694, 2145, 420, 700, 1535, 194,
+ /* 1790 */ 424, 2130, 426, 427, 428, 2129, 2176, 365, 2212, 2177,
+ /* 1800 */ 2127, 342, 2178, 704, 2180, 2181, 699, 432, 694, 701,
+ /* 1810 */ 2126, 434, 2125, 436, 1525, 2106, 197, 2105, 199, 1493,
+ /* 1820 */ 2176, 79, 2212, 1492, 2087, 172, 2178, 704, 2180, 2181,
+ /* 1830 */ 699, 2086, 694, 2085, 448, 449, 2084, 2195, 2083, 1444,
+ /* 1840 */ 2039, 2038, 392, 2036, 147, 2035, 2034, 2037, 2033, 2145,
+ /* 1850 */ 2032, 700, 2030, 2029, 2028, 204, 466, 2027, 468, 2041,
+ /* 1860 */ 2026, 2025, 2024, 2177, 149, 2011, 2010, 2009, 2040, 2008,
+ /* 1870 */ 2007, 1446, 2006, 698, 2023, 2022, 2021, 2359, 2020, 2019,
+ /* 1880 */ 2018, 2017, 2016, 2015, 2176, 2177, 2212, 2014, 2013, 342,
+ /* 1890 */ 2178, 704, 2180, 2181, 699, 701, 694, 2012, 2005, 2004,
+ /* 1900 */ 2003, 2195, 496, 2002, 352, 1853, 1319, 1852, 1323, 2177,
+ /* 1910 */ 63, 353, 1315, 2145, 1851, 700, 1849, 212, 1846, 701,
+ /* 1920 */ 214, 1845, 513, 2195, 512, 1838, 516, 1827, 400, 514,
+ /* 1930 */ 520, 524, 518, 215, 1803, 2145, 1212, 700, 1802, 2104,
+ /* 1940 */ 522, 517, 2094, 521, 217, 76, 2082, 2195, 2176, 219,
+ /* 1950 */ 2212, 2165, 402, 341, 2178, 704, 2180, 2181, 699, 2145,
+ /* 1960 */ 694, 700, 2231, 610, 182, 77, 183, 225, 227, 2081,
+ /* 1970 */ 2176, 532, 2212, 2059, 1927, 342, 2178, 704, 2180, 2181,
+ /* 1980 */ 699, 793, 694, 1848, 1257, 1844, 547, 549, 1842, 548,
+ /* 1990 */ 551, 553, 552, 1840, 2176, 312, 2212, 2177, 555, 342,
+ /* 2000 */ 2178, 704, 2180, 2181, 699, 556, 694, 701, 1837, 557,
+ /* 2010 */ 559, 180, 1392, 560, 1822, 561, 2177, 1820, 1821, 783,
+ /* 2020 */ 779, 775, 771, 1819, 310, 1391, 701, 2177, 1799, 1929,
+ /* 2030 */ 1928, 758, 1306, 235, 1304, 2195, 1302, 701, 760, 1301,
+ /* 2040 */ 1300, 1299, 1298, 1293, 1295, 1294, 1292, 2145, 1835, 700,
+ /* 2050 */ 1826, 590, 1824, 377, 2195, 378, 379, 593, 1798, 595,
+ /* 2060 */ 1797, 597, 1796, 599, 108, 2195, 2145, 303, 700, 113,
+ /* 2070 */ 1519, 1521, 1518, 2103, 1499, 1523, 1501, 2145, 2093, 700,
+ /* 2080 */ 58, 29, 605, 67, 2212, 614, 258, 337, 2178, 704,
+ /* 2090 */ 2180, 2181, 699, 2080, 694, 2177, 2078, 2342, 17, 20,
+ /* 2100 */ 680, 2176, 1736, 2212, 165, 701, 327, 2178, 704, 2180,
+ /* 2110 */ 2181, 699, 2176, 694, 2212, 2177, 615, 325, 2178, 704,
+ /* 2120 */ 2180, 2181, 699, 31, 694, 701, 2177, 1503, 620, 383,
+ /* 2130 */ 264, 5, 6, 2195, 21, 290, 701, 65, 272, 628,
+ /* 2140 */ 289, 630, 22, 271, 266, 2145, 2177, 700, 1717, 173,
+ /* 2150 */ 270, 2166, 33, 2195, 32, 24, 701, 1709, 1751, 92,
+ /* 2160 */ 254, 1756, 1750, 1757, 2195, 2145, 388, 700, 1755, 1684,
+ /* 2170 */ 1754, 389, 1683, 284, 59, 178, 2145, 2079, 700, 2077,
+ /* 2180 */ 2176, 60, 2212, 2076, 2195, 328, 2178, 704, 2180, 2181,
+ /* 2190 */ 699, 2058, 694, 95, 23, 18, 2145, 291, 700, 292,
+ /* 2200 */ 2176, 1715, 2212, 94, 2177, 334, 2178, 704, 2180, 2181,
+ /* 2210 */ 699, 2176, 694, 2212, 701, 25, 338, 2178, 704, 2180,
+ /* 2220 */ 2181, 699, 294, 694, 299, 2177, 2057, 68, 97, 103,
+ /* 2230 */ 26, 2176, 99, 2212, 301, 701, 330, 2178, 704, 2180,
+ /* 2240 */ 2181, 699, 2195, 694, 675, 304, 1636, 1635, 13, 1559,
+ /* 2250 */ 2177, 2215, 179, 1614, 2145, 693, 700, 11, 192, 1612,
+ /* 2260 */ 701, 39, 16, 2195, 1611, 1646, 27, 1591, 1583, 703,
+ /* 2270 */ 28, 705, 1377, 707, 403, 2145, 2177, 700, 709, 711,
+ /* 2280 */ 1374, 712, 714, 717, 1373, 715, 701, 718, 2195, 2176,
+ /* 2290 */ 720, 2212, 1370, 721, 339, 2178, 704, 2180, 2181, 699,
+ /* 2300 */ 2145, 694, 700, 1364, 1362, 723, 1368, 724, 307, 1386,
+ /* 2310 */ 2176, 104, 2212, 105, 2195, 331, 2178, 704, 2180, 2181,
+ /* 2320 */ 699, 1367, 694, 75, 1382, 1255, 2145, 1366, 700, 738,
+ /* 2330 */ 1287, 1365, 1286, 1285, 1284, 2176, 2177, 2212, 1282, 1280,
+ /* 2340 */ 340, 2178, 704, 2180, 2181, 699, 701, 694, 1279, 1278,
+ /* 2350 */ 1313, 748, 2177, 308, 1276, 1275, 1274, 1273, 1272, 1271,
+ /* 2360 */ 1270, 2176, 701, 2212, 1310, 2177, 332, 2178, 704, 2180,
+ /* 2370 */ 2181, 699, 1308, 694, 2195, 701, 1267, 1266, 1263, 1262,
+ /* 2380 */ 1261, 1260, 1843, 768, 770, 769, 2145, 1841, 700, 772,
+ /* 2390 */ 2195, 774, 1839, 1836, 776, 778, 773, 780, 777, 781,
+ /* 2400 */ 782, 1818, 2145, 2195, 700, 784, 1202, 1795, 311, 788,
+ /* 2410 */ 1770, 1545, 321, 1770, 792, 2145, 791, 700, 1770, 1770,
+ /* 2420 */ 1770, 2176, 1770, 2212, 1770, 2177, 345, 2178, 704, 2180,
+ /* 2430 */ 2181, 699, 1770, 694, 1770, 701, 1770, 2176, 1770, 2212,
+ /* 2440 */ 1770, 2177, 346, 2178, 704, 2180, 2181, 699, 1770, 694,
+ /* 2450 */ 2176, 701, 2212, 1770, 2177, 2189, 2178, 704, 2180, 2181,
+ /* 2460 */ 699, 1770, 694, 2195, 701, 1770, 1770, 1770, 1770, 1770,
+ /* 2470 */ 1770, 1770, 1770, 1770, 1770, 2145, 1770, 700, 1770, 2195,
+ /* 2480 */ 1770, 1770, 1770, 1770, 1770, 1770, 1770, 1770, 1770, 1770,
+ /* 2490 */ 1770, 2145, 2195, 700, 1770, 1770, 1770, 1770, 1770, 1770,
+ /* 2500 */ 1770, 1770, 1770, 1770, 2145, 1770, 700, 1770, 1770, 1770,
+ /* 2510 */ 2176, 1770, 2212, 1770, 1770, 2188, 2178, 704, 2180, 2181,
+ /* 2520 */ 699, 1770, 694, 1770, 1770, 1770, 2176, 2177, 2212, 1770,
+ /* 2530 */ 1770, 2187, 2178, 704, 2180, 2181, 699, 701, 694, 2176,
+ /* 2540 */ 1770, 2212, 1770, 2177, 361, 2178, 704, 2180, 2181, 699,
+ /* 2550 */ 1770, 694, 1770, 701, 2177, 1770, 1770, 1770, 1770, 1770,
+ /* 2560 */ 1770, 1770, 1770, 1770, 701, 2195, 1770, 1770, 1770, 1770,
+ /* 2570 */ 1770, 1770, 1770, 1770, 1770, 1770, 1770, 2145, 1770, 700,
+ /* 2580 */ 1770, 2195, 1770, 1770, 1770, 1770, 1770, 1770, 1770, 1770,
+ /* 2590 */ 1770, 1770, 2195, 2145, 1770, 700, 1770, 1770, 1770, 1770,
+ /* 2600 */ 1770, 1770, 1770, 1770, 2145, 1770, 700, 1770, 1770, 1770,
+ /* 2610 */ 1770, 1770, 2176, 1770, 2212, 1770, 2177, 362, 2178, 704,
+ /* 2620 */ 2180, 2181, 699, 1770, 694, 1770, 701, 1770, 2176, 1770,
+ /* 2630 */ 2212, 1770, 2177, 358, 2178, 704, 2180, 2181, 699, 2176,
+ /* 2640 */ 694, 2212, 701, 1770, 363, 2178, 704, 2180, 2181, 699,
+ /* 2650 */ 1770, 694, 1770, 1770, 2195, 1770, 1770, 1770, 1770, 1770,
+ /* 2660 */ 1770, 1770, 1770, 1770, 1770, 1770, 2145, 1770, 700, 1770,
+ /* 2670 */ 2195, 1770, 1770, 1770, 1770, 1770, 1770, 1770, 1770, 1770,
+ /* 2680 */ 1770, 1770, 2145, 1770, 700, 1770, 1770, 1770, 1770, 1770,
+ /* 2690 */ 1770, 1770, 1770, 1770, 1770, 1770, 1770, 1770, 1770, 1770,
+ /* 2700 */ 1770, 702, 1770, 2212, 1770, 1770, 337, 2178, 704, 2180,
+ /* 2710 */ 2181, 699, 1770, 694, 1770, 1770, 1770, 2176, 1770, 2212,
+ /* 2720 */ 1770, 1770, 336, 2178, 704, 2180, 2181, 699, 1770, 694,
};
static const YYCODETYPE yy_lookahead[] = {
/* 0 */ 340, 392, 339, 345, 341, 349, 409, 349, 409, 351,
@@ -871,210 +533,210 @@ static const YYCODETYPE yy_lookahead[] = {
/* 350 */ 243, 175, 245, 378, 370, 20, 20, 388, 22, 100,
/* 360 */ 391, 392, 378, 37, 67, 390, 103, 392, 349, 33,
/* 370 */ 386, 35, 349, 350, 115, 116, 117, 118, 119, 120,
- /* 380 */ 121, 122, 123, 124, 67, 126, 127, 128, 129, 130,
+ /* 380 */ 121, 122, 123, 124, 0, 126, 127, 128, 129, 130,
/* 390 */ 131, 132, 369, 340, 39, 429, 349, 350, 62, 376,
/* 400 */ 425, 340, 427, 350, 68, 430, 431, 432, 433, 434,
/* 410 */ 435, 75, 437, 3, 20, 259, 22, 442, 0, 444,
/* 420 */ 401, 455, 403, 448, 449, 134, 170, 349, 350, 35,
- /* 430 */ 20, 378, 106, 4, 108, 109, 100, 111, 103, 103,
+ /* 430 */ 20, 378, 106, 49, 108, 109, 100, 111, 103, 103,
/* 440 */ 264, 265, 266, 390, 469, 392, 20, 53, 70, 71,
/* 450 */ 72, 390, 12, 13, 14, 77, 78, 79, 182, 133,
/* 460 */ 20, 83, 22, 137, 170, 171, 88, 89, 90, 91,
- /* 470 */ 243, 222, 94, 33, 259, 35, 140, 141, 425, 429,
+ /* 470 */ 114, 222, 94, 33, 259, 35, 140, 141, 425, 429,
/* 480 */ 427, 391, 392, 430, 431, 432, 433, 434, 435, 436,
/* 490 */ 437, 438, 439, 344, 203, 204, 347, 348, 340, 452,
/* 500 */ 453, 454, 62, 456, 457, 455, 170, 171, 350, 20,
/* 510 */ 352, 22, 176, 177, 104, 75, 349, 350, 269, 270,
- /* 520 */ 271, 272, 273, 274, 275, 84, 190, 13, 192, 451,
+ /* 520 */ 271, 272, 273, 274, 275, 84, 190, 67, 192, 451,
/* 530 */ 452, 453, 454, 49, 456, 457, 378, 1, 2, 20,
- /* 540 */ 100, 57, 53, 103, 60, 61, 349, 350, 390, 35,
+ /* 540 */ 100, 57, 53, 103, 60, 61, 349, 350, 390, 340,
/* 550 */ 392, 133, 134, 135, 136, 137, 138, 139, 222, 223,
/* 560 */ 284, 225, 226, 227, 228, 229, 230, 231, 232, 233,
/* 570 */ 234, 235, 236, 237, 238, 239, 240, 241, 242, 13,
- /* 580 */ 140, 141, 172, 425, 114, 427, 145, 146, 430, 431,
- /* 590 */ 432, 433, 434, 435, 259, 437, 47, 378, 172, 103,
+ /* 580 */ 140, 141, 172, 425, 3, 427, 145, 146, 430, 431,
+ /* 590 */ 432, 433, 434, 435, 259, 437, 243, 378, 172, 390,
/* 600 */ 442, 35, 444, 356, 385, 340, 448, 449, 374, 168,
/* 610 */ 170, 171, 393, 258, 21, 350, 176, 177, 0, 452,
/* 620 */ 453, 454, 103, 456, 457, 4, 459, 34, 381, 36,
/* 630 */ 190, 185, 192, 133, 134, 135, 136, 137, 138, 139,
/* 640 */ 104, 474, 475, 378, 349, 350, 479, 480, 337, 452,
- /* 650 */ 453, 454, 103, 456, 457, 390, 422, 392, 212, 213,
+ /* 650 */ 453, 454, 75, 456, 457, 390, 422, 392, 212, 213,
/* 660 */ 0, 409, 222, 223, 369, 225, 226, 227, 228, 229,
/* 670 */ 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
- /* 680 */ 240, 241, 242, 12, 13, 67, 359, 54, 55, 260,
+ /* 680 */ 240, 241, 242, 12, 13, 67, 359, 54, 55, 103,
/* 690 */ 425, 20, 427, 22, 367, 430, 431, 432, 433, 434,
- /* 700 */ 435, 350, 437, 378, 33, 366, 35, 442, 456, 444,
- /* 710 */ 385, 459, 33, 448, 449, 340, 134, 135, 393, 380,
- /* 720 */ 409, 139, 22, 350, 103, 414, 474, 475, 49, 390,
- /* 730 */ 340, 479, 480, 62, 378, 35, 57, 58, 59, 60,
- /* 740 */ 350, 62, 386, 340, 8, 9, 75, 396, 12, 13,
- /* 750 */ 14, 15, 16, 8, 9, 259, 35, 12, 13, 14,
- /* 760 */ 15, 16, 20, 349, 350, 390, 427, 456, 378, 396,
- /* 770 */ 459, 100, 349, 350, 103, 75, 437, 75, 259, 340,
- /* 780 */ 390, 102, 392, 369, 105, 474, 475, 12, 13, 44,
- /* 790 */ 479, 480, 369, 390, 340, 20, 75, 22, 349, 350,
- /* 800 */ 100, 14, 15, 16, 350, 350, 349, 350, 33, 3,
- /* 810 */ 35, 140, 141, 349, 350, 425, 0, 427, 369, 159,
- /* 820 */ 430, 431, 432, 433, 434, 435, 369, 437, 168, 390,
+ /* 700 */ 435, 13, 437, 378, 33, 366, 35, 442, 456, 444,
+ /* 710 */ 385, 459, 33, 448, 449, 14, 15, 16, 393, 380,
+ /* 720 */ 409, 22, 22, 35, 103, 414, 474, 475, 49, 390,
+ /* 730 */ 340, 479, 480, 62, 35, 35, 57, 58, 59, 60,
+ /* 740 */ 350, 62, 441, 340, 443, 366, 75, 8, 9, 35,
+ /* 750 */ 2, 12, 13, 14, 15, 16, 8, 9, 35, 380,
+ /* 760 */ 12, 13, 14, 15, 16, 0, 427, 456, 378, 390,
+ /* 770 */ 459, 100, 349, 350, 103, 75, 437, 114, 259, 340,
+ /* 780 */ 390, 102, 392, 44, 105, 474, 475, 12, 13, 75,
+ /* 790 */ 479, 480, 369, 390, 340, 20, 20, 22, 75, 100,
+ /* 800 */ 100, 340, 354, 355, 350, 75, 427, 428, 33, 44,
+ /* 810 */ 35, 140, 141, 349, 350, 425, 437, 427, 20, 159,
+ /* 820 */ 430, 431, 432, 433, 434, 435, 379, 437, 168, 390,
/* 830 */ 354, 355, 378, 369, 444, 349, 350, 62, 448, 449,
- /* 840 */ 104, 170, 171, 441, 390, 443, 392, 176, 177, 22,
- /* 850 */ 75, 396, 173, 174, 14, 369, 42, 178, 44, 180,
- /* 860 */ 20, 190, 35, 192, 135, 49, 8, 9, 139, 358,
- /* 870 */ 12, 13, 14, 15, 16, 100, 114, 198, 103, 425,
- /* 880 */ 259, 427, 140, 141, 430, 431, 432, 433, 434, 435,
- /* 890 */ 190, 437, 192, 222, 223, 384, 225, 226, 227, 228,
+ /* 840 */ 20, 170, 171, 104, 390, 259, 392, 176, 177, 350,
+ /* 850 */ 75, 390, 173, 174, 133, 369, 379, 178, 137, 180,
+ /* 860 */ 279, 190, 440, 192, 135, 443, 8, 9, 139, 340,
+ /* 870 */ 12, 13, 14, 15, 16, 100, 14, 198, 103, 425,
+ /* 880 */ 259, 427, 20, 350, 430, 431, 432, 433, 434, 435,
+ /* 890 */ 190, 437, 192, 222, 223, 396, 225, 226, 227, 228,
/* 900 */ 229, 230, 231, 232, 233, 234, 235, 236, 237, 238,
- /* 910 */ 239, 240, 241, 242, 440, 140, 141, 443, 176, 177,
- /* 920 */ 349, 350, 222, 223, 470, 471, 164, 100, 199, 354,
- /* 930 */ 355, 202, 103, 370, 205, 18, 207, 20, 349, 350,
- /* 940 */ 369, 378, 113, 340, 27, 170, 171, 30, 378, 386,
- /* 950 */ 33, 176, 177, 350, 387, 352, 22, 390, 369, 349,
- /* 960 */ 350, 456, 104, 393, 459, 190, 49, 192, 51, 35,
- /* 970 */ 340, 349, 350, 56, 349, 350, 2, 45, 46, 369,
+ /* 910 */ 239, 240, 241, 242, 379, 140, 141, 363, 364, 390,
+ /* 920 */ 349, 350, 222, 223, 470, 471, 379, 378, 199, 396,
+ /* 930 */ 429, 202, 350, 370, 205, 18, 207, 20, 140, 141,
+ /* 940 */ 369, 378, 393, 340, 27, 170, 171, 30, 172, 386,
+ /* 950 */ 33, 176, 177, 350, 379, 352, 455, 349, 350, 349,
+ /* 960 */ 350, 456, 104, 14, 459, 190, 49, 192, 51, 20,
+ /* 970 */ 340, 349, 350, 56, 176, 177, 2, 369, 396, 369,
/* 980 */ 475, 378, 8, 9, 479, 480, 12, 13, 14, 15,
- /* 990 */ 16, 369, 0, 390, 369, 392, 387, 222, 223, 390,
+ /* 990 */ 16, 369, 172, 390, 379, 392, 387, 222, 223, 390,
/* 1000 */ 225, 226, 227, 228, 229, 230, 231, 232, 233, 234,
/* 1010 */ 235, 236, 237, 238, 239, 240, 241, 242, 0, 102,
- /* 1020 */ 390, 114, 349, 350, 349, 350, 349, 350, 425, 387,
- /* 1030 */ 427, 114, 390, 430, 431, 432, 433, 434, 435, 42,
- /* 1040 */ 437, 44, 369, 2, 369, 442, 369, 444, 68, 8,
- /* 1050 */ 9, 448, 449, 12, 13, 14, 15, 16, 363, 364,
- /* 1060 */ 75, 144, 363, 364, 147, 148, 149, 150, 151, 152,
+ /* 1020 */ 390, 378, 349, 350, 349, 350, 349, 350, 425, 386,
+ /* 1030 */ 427, 114, 170, 430, 431, 432, 433, 434, 435, 42,
+ /* 1040 */ 437, 44, 369, 415, 369, 442, 369, 444, 367, 8,
+ /* 1050 */ 9, 448, 449, 12, 13, 14, 15, 16, 134, 135,
+ /* 1060 */ 0, 144, 400, 139, 147, 148, 149, 150, 151, 152,
/* 1070 */ 153, 154, 155, 156, 157, 158, 159, 160, 161, 162,
- /* 1080 */ 163, 409, 165, 166, 167, 279, 340, 14, 70, 71,
+ /* 1080 */ 163, 409, 165, 166, 167, 4, 340, 14, 70, 71,
/* 1090 */ 72, 73, 74, 20, 76, 77, 78, 79, 80, 81,
/* 1100 */ 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
- /* 1110 */ 92, 93, 94, 95, 96, 18, 0, 429, 8, 9,
- /* 1120 */ 23, 14, 12, 13, 14, 15, 16, 20, 456, 340,
- /* 1130 */ 340, 459, 379, 378, 37, 38, 390, 20, 41, 350,
- /* 1140 */ 385, 352, 370, 455, 349, 350, 474, 475, 393, 52,
- /* 1150 */ 378, 479, 480, 169, 349, 350, 103, 379, 386, 340,
- /* 1160 */ 63, 64, 65, 66, 369, 340, 0, 378, 340, 44,
- /* 1170 */ 378, 349, 350, 371, 369, 350, 374, 385, 340, 390,
- /* 1180 */ 390, 392, 340, 20, 44, 393, 70, 71, 72, 365,
- /* 1190 */ 0, 369, 368, 77, 78, 79, 340, 133, 44, 83,
- /* 1200 */ 103, 137, 222, 378, 88, 89, 90, 91, 216, 390,
- /* 1210 */ 94, 340, 379, 340, 425, 390, 427, 392, 390, 430,
- /* 1220 */ 431, 432, 433, 434, 435, 340, 437, 0, 390, 104,
- /* 1230 */ 246, 442, 390, 444, 44, 340, 35, 448, 449, 142,
- /* 1240 */ 256, 340, 189, 170, 191, 350, 390, 352, 456, 22,
+ /* 1110 */ 92, 93, 94, 95, 96, 18, 0, 22, 8, 9,
+ /* 1120 */ 23, 169, 12, 13, 14, 15, 16, 358, 456, 340,
+ /* 1130 */ 35, 459, 341, 378, 37, 38, 390, 44, 41, 350,
+ /* 1140 */ 385, 352, 340, 363, 364, 104, 474, 475, 393, 52,
+ /* 1150 */ 483, 479, 480, 384, 349, 350, 103, 472, 349, 350,
+ /* 1160 */ 63, 64, 65, 66, 353, 340, 0, 378, 340, 68,
+ /* 1170 */ 378, 349, 350, 387, 369, 350, 390, 385, 369, 390,
+ /* 1180 */ 366, 392, 349, 350, 340, 393, 70, 71, 72, 349,
+ /* 1190 */ 350, 369, 390, 77, 78, 79, 340, 104, 246, 83,
+ /* 1200 */ 103, 44, 369, 378, 88, 89, 90, 91, 256, 369,
+ /* 1210 */ 94, 466, 45, 46, 425, 390, 427, 392, 390, 430,
+ /* 1220 */ 431, 432, 433, 434, 435, 340, 437, 44, 340, 349,
+ /* 1230 */ 350, 442, 366, 444, 390, 340, 353, 448, 449, 142,
+ /* 1240 */ 340, 340, 189, 170, 191, 350, 390, 352, 456, 369,
/* 1250 */ 425, 459, 427, 257, 258, 430, 431, 432, 433, 434,
- /* 1260 */ 435, 390, 437, 390, 140, 141, 474, 475, 206, 379,
- /* 1270 */ 208, 479, 480, 378, 221, 390, 75, 170, 379, 182,
- /* 1280 */ 183, 184, 172, 379, 187, 390, 340, 392, 0, 172,
- /* 1290 */ 107, 390, 48, 110, 44, 415, 350, 200, 201, 133,
+ /* 1260 */ 435, 370, 437, 349, 350, 387, 474, 475, 390, 378,
+ /* 1270 */ 378, 479, 480, 378, 221, 390, 216, 386, 390, 182,
+ /* 1280 */ 183, 184, 172, 369, 187, 390, 340, 392, 62, 371,
+ /* 1290 */ 390, 390, 374, 206, 400, 208, 350, 200, 201, 133,
/* 1300 */ 134, 135, 136, 137, 138, 139, 481, 482, 211, 340,
- /* 1310 */ 22, 214, 259, 341, 217, 218, 219, 220, 221, 350,
- /* 1320 */ 425, 352, 427, 367, 378, 430, 431, 432, 433, 434,
- /* 1330 */ 435, 107, 437, 35, 110, 172, 390, 442, 392, 444,
- /* 1340 */ 0, 35, 400, 448, 449, 12, 13, 378, 107, 107,
- /* 1350 */ 483, 110, 110, 472, 104, 22, 259, 1, 2, 390,
- /* 1360 */ 340, 392, 22, 44, 62, 44, 33, 44, 35, 44,
+ /* 1310 */ 365, 214, 259, 368, 217, 218, 219, 220, 221, 350,
+ /* 1320 */ 425, 352, 427, 222, 378, 430, 431, 432, 433, 434,
+ /* 1330 */ 435, 105, 437, 42, 114, 44, 390, 442, 392, 444,
+ /* 1340 */ 0, 260, 0, 448, 449, 12, 13, 378, 107, 107,
+ /* 1350 */ 107, 110, 110, 110, 107, 22, 259, 110, 48, 390,
+ /* 1360 */ 340, 392, 22, 44, 22, 0, 33, 44, 35, 44,
/* 1370 */ 350, 425, 44, 427, 44, 44, 430, 431, 432, 433,
- /* 1380 */ 434, 435, 44, 437, 353, 8, 9, 13, 44, 12,
- /* 1390 */ 13, 14, 15, 16, 425, 62, 427, 466, 378, 430,
- /* 1400 */ 431, 432, 433, 434, 435, 44, 437, 105, 75, 35,
- /* 1410 */ 390, 442, 392, 444, 366, 366, 172, 448, 449, 473,
- /* 1420 */ 340, 281, 44, 104, 44, 104, 44, 104, 380, 104,
- /* 1430 */ 350, 44, 104, 100, 104, 104, 44, 283, 390, 13,
- /* 1440 */ 44, 366, 104, 44, 44, 425, 378, 427, 104, 340,
- /* 1450 */ 430, 431, 432, 433, 434, 435, 0, 437, 378, 350,
- /* 1460 */ 400, 35, 442, 348, 444, 104, 353, 389, 448, 449,
- /* 1470 */ 390, 350, 392, 458, 400, 427, 428, 476, 450, 460,
- /* 1480 */ 261, 410, 104, 49, 104, 437, 104, 378, 20, 426,
- /* 1490 */ 192, 104, 205, 424, 358, 419, 104, 358, 192, 390,
- /* 1500 */ 104, 392, 419, 104, 104, 425, 50, 427, 188, 42,
- /* 1510 */ 430, 431, 432, 433, 434, 435, 412, 437, 20, 397,
- /* 1520 */ 400, 169, 442, 190, 444, 192, 397, 395, 448, 449,
- /* 1530 */ 20, 349, 397, 349, 425, 362, 427, 395, 395, 430,
- /* 1540 */ 431, 432, 433, 434, 435, 101, 437, 4, 99, 361,
- /* 1550 */ 98, 349, 360, 444, 349, 222, 223, 448, 449, 349,
- /* 1560 */ 349, 20, 19, 342, 48, 340, 346, 419, 235, 236,
- /* 1570 */ 237, 238, 239, 240, 241, 350, 33, 342, 346, 20,
- /* 1580 */ 358, 392, 20, 20, 358, 351, 411, 358, 351, 358,
- /* 1590 */ 342, 340, 49, 378, 358, 349, 358, 358, 342, 56,
- /* 1600 */ 209, 350, 390, 378, 349, 62, 378, 390, 378, 423,
- /* 1610 */ 103, 378, 421, 390, 419, 390, 356, 392, 378, 196,
- /* 1620 */ 195, 378, 418, 378, 417, 340, 356, 378, 349, 378,
- /* 1630 */ 378, 378, 378, 194, 416, 350, 268, 465, 276, 392,
- /* 1640 */ 267, 390, 465, 392, 468, 102, 181, 467, 105, 390,
- /* 1650 */ 425, 464, 427, 278, 285, 430, 431, 432, 433, 434,
- /* 1660 */ 435, 400, 437, 378, 400, 390, 390, 410, 405, 444,
- /* 1670 */ 405, 390, 463, 448, 449, 390, 425, 392, 427, 465,
- /* 1680 */ 277, 430, 431, 432, 433, 434, 435, 340, 437, 262,
- /* 1690 */ 410, 282, 484, 280, 478, 444, 258, 350, 350, 20,
+ /* 1380 */ 434, 435, 44, 437, 164, 8, 9, 22, 44, 12,
+ /* 1390 */ 13, 14, 15, 16, 425, 62, 427, 35, 378, 430,
+ /* 1400 */ 431, 432, 433, 434, 435, 44, 437, 44, 75, 35,
+ /* 1410 */ 390, 442, 392, 444, 140, 141, 44, 448, 449, 473,
+ /* 1420 */ 340, 1, 2, 104, 44, 44, 44, 104, 44, 104,
+ /* 1430 */ 350, 44, 104, 100, 104, 104, 47, 44, 281, 13,
+ /* 1440 */ 44, 13, 104, 44, 0, 425, 103, 427, 104, 340,
+ /* 1450 */ 430, 431, 432, 433, 434, 435, 113, 437, 378, 350,
+ /* 1460 */ 348, 35, 442, 35, 444, 104, 283, 104, 448, 449,
+ /* 1470 */ 390, 350, 392, 389, 400, 458, 104, 476, 450, 460,
+ /* 1480 */ 261, 410, 172, 49, 104, 104, 104, 378, 104, 426,
+ /* 1490 */ 20, 104, 103, 205, 50, 419, 424, 104, 358, 390,
+ /* 1500 */ 104, 392, 419, 104, 358, 425, 188, 427, 412, 42,
+ /* 1510 */ 430, 431, 432, 433, 434, 435, 397, 437, 20, 397,
+ /* 1520 */ 400, 169, 442, 190, 444, 192, 395, 20, 448, 449,
+ /* 1530 */ 349, 349, 397, 395, 425, 362, 427, 395, 101, 430,
+ /* 1540 */ 431, 432, 433, 434, 435, 99, 437, 4, 361, 349,
+ /* 1550 */ 98, 360, 349, 444, 192, 222, 223, 448, 449, 349,
+ /* 1560 */ 349, 20, 19, 342, 48, 340, 192, 419, 235, 236,
+ /* 1570 */ 237, 238, 239, 240, 241, 350, 33, 346, 342, 346,
+ /* 1580 */ 358, 20, 392, 20, 20, 358, 351, 411, 358, 351,
+ /* 1590 */ 358, 340, 49, 349, 342, 358, 378, 358, 358, 56,
+ /* 1600 */ 342, 350, 378, 378, 349, 62, 378, 378, 423, 209,
+ /* 1610 */ 421, 103, 378, 390, 419, 390, 356, 392, 196, 418,
+ /* 1620 */ 195, 417, 356, 378, 378, 340, 378, 378, 378, 378,
+ /* 1630 */ 194, 378, 416, 349, 268, 350, 465, 267, 468, 465,
+ /* 1640 */ 276, 390, 181, 392, 390, 102, 390, 467, 105, 392,
+ /* 1650 */ 425, 465, 427, 390, 278, 430, 431, 432, 433, 434,
+ /* 1660 */ 435, 390, 437, 378, 400, 400, 390, 405, 390, 444,
+ /* 1670 */ 464, 410, 405, 448, 449, 390, 425, 392, 427, 277,
+ /* 1680 */ 463, 430, 431, 432, 433, 434, 435, 340, 437, 262,
+ /* 1690 */ 410, 285, 484, 282, 280, 444, 258, 350, 350, 20,
/* 1700 */ 449, 429, 410, 349, 351, 356, 356, 403, 20, 174,
/* 1710 */ 425, 340, 427, 405, 390, 430, 431, 432, 433, 434,
- /* 1720 */ 435, 350, 437, 405, 462, 378, 390, 390, 402, 390,
- /* 1730 */ 383, 390, 390, 374, 103, 340, 350, 390, 447, 392,
- /* 1740 */ 356, 356, 103, 477, 368, 350, 382, 390, 36, 378,
- /* 1750 */ 349, 343, 342, 356, 383, 420, 471, 406, 413, 357,
- /* 1760 */ 372, 390, 372, 392, 406, 372, 338, 0, 0, 0,
- /* 1770 */ 42, 0, 425, 378, 427, 35, 215, 430, 431, 432,
- /* 1780 */ 433, 434, 435, 35, 437, 390, 35, 392, 35, 215,
- /* 1790 */ 0, 35, 35, 215, 0, 215, 425, 0, 427, 340,
- /* 1800 */ 35, 430, 431, 432, 433, 434, 435, 0, 437, 350,
- /* 1810 */ 22, 0, 35, 210, 0, 198, 0, 198, 192, 199,
- /* 1820 */ 425, 0, 427, 190, 0, 430, 431, 432, 433, 434,
- /* 1830 */ 435, 0, 437, 186, 185, 0, 0, 378, 47, 0,
- /* 1840 */ 0, 0, 383, 42, 0, 0, 0, 0, 0, 390,
- /* 1850 */ 0, 392, 0, 0, 159, 35, 0, 159, 0, 0,
+ /* 1720 */ 435, 350, 437, 402, 390, 378, 390, 390, 103, 390,
+ /* 1730 */ 383, 462, 405, 374, 356, 340, 477, 390, 350, 392,
+ /* 1740 */ 447, 390, 356, 103, 36, 350, 478, 390, 356, 378,
+ /* 1750 */ 382, 368, 349, 343, 383, 342, 471, 372, 413, 338,
+ /* 1760 */ 0, 390, 406, 392, 406, 357, 420, 0, 0, 372,
+ /* 1770 */ 372, 42, 425, 378, 427, 35, 35, 430, 431, 432,
+ /* 1780 */ 433, 434, 435, 0, 437, 390, 215, 392, 35, 35,
+ /* 1790 */ 215, 0, 35, 35, 215, 0, 425, 215, 427, 340,
+ /* 1800 */ 0, 430, 431, 432, 433, 434, 435, 35, 437, 350,
+ /* 1810 */ 0, 22, 0, 35, 210, 0, 198, 0, 198, 192,
+ /* 1820 */ 425, 199, 427, 190, 0, 430, 431, 432, 433, 434,
+ /* 1830 */ 435, 0, 437, 0, 186, 185, 0, 378, 0, 47,
+ /* 1840 */ 0, 0, 383, 0, 42, 0, 0, 0, 0, 390,
+ /* 1850 */ 0, 392, 0, 0, 0, 159, 35, 0, 159, 0,
/* 1860 */ 0, 0, 0, 340, 42, 0, 0, 0, 0, 0,
/* 1870 */ 0, 22, 0, 350, 0, 0, 0, 482, 0, 0,
/* 1880 */ 0, 0, 0, 0, 425, 340, 427, 0, 0, 430,
/* 1890 */ 431, 432, 433, 434, 435, 350, 437, 0, 0, 0,
- /* 1900 */ 0, 378, 143, 48, 0, 48, 22, 0, 22, 340,
- /* 1910 */ 181, 0, 35, 390, 0, 392, 62, 0, 0, 350,
- /* 1920 */ 0, 0, 49, 378, 35, 62, 35, 0, 383, 39,
- /* 1930 */ 35, 35, 39, 62, 0, 390, 110, 392, 14, 0,
- /* 1940 */ 39, 49, 39, 49, 42, 0, 40, 378, 425, 44,
- /* 1950 */ 427, 0, 383, 430, 431, 432, 433, 434, 435, 390,
- /* 1960 */ 437, 392, 439, 1, 39, 0, 47, 39, 0, 47,
- /* 1970 */ 425, 0, 427, 47, 0, 430, 431, 432, 433, 434,
- /* 1980 */ 435, 19, 437, 0, 69, 35, 39, 49, 0, 35,
- /* 1990 */ 49, 39, 0, 35, 425, 33, 427, 340, 49, 430,
- /* 2000 */ 431, 432, 433, 434, 435, 39, 437, 350, 0, 49,
- /* 2010 */ 35, 49, 39, 0, 0, 0, 340, 0, 0, 57,
- /* 2020 */ 58, 59, 60, 0, 62, 112, 350, 340, 35, 22,
- /* 2030 */ 0, 44, 35, 35, 35, 378, 35, 350, 35, 35,
- /* 2040 */ 35, 35, 22, 0, 44, 35, 35, 390, 22, 392,
- /* 2050 */ 0, 22, 0, 51, 378, 22, 35, 0, 0, 35,
- /* 2060 */ 0, 22, 35, 35, 102, 378, 390, 105, 392, 20,
- /* 2070 */ 35, 35, 0, 104, 0, 103, 35, 390, 22, 392,
- /* 2080 */ 172, 103, 425, 22, 427, 3, 174, 430, 431, 432,
- /* 2090 */ 433, 434, 435, 0, 437, 340, 0, 44, 103, 48,
- /* 2100 */ 138, 425, 193, 427, 172, 350, 430, 431, 432, 433,
+ /* 1900 */ 0, 378, 143, 0, 48, 0, 22, 0, 22, 340,
+ /* 1910 */ 112, 48, 35, 390, 0, 392, 0, 62, 0, 350,
+ /* 1920 */ 62, 0, 49, 378, 35, 0, 35, 0, 383, 39,
+ /* 1930 */ 35, 35, 39, 62, 0, 390, 14, 392, 0, 0,
+ /* 1940 */ 39, 49, 0, 49, 42, 39, 0, 378, 425, 40,
+ /* 1950 */ 427, 47, 383, 430, 431, 432, 433, 434, 435, 390,
+ /* 1960 */ 437, 392, 439, 1, 44, 39, 47, 39, 181, 0,
+ /* 1970 */ 425, 47, 427, 0, 0, 430, 431, 432, 433, 434,
+ /* 1980 */ 435, 19, 437, 0, 69, 0, 35, 39, 0, 49,
+ /* 1990 */ 35, 39, 49, 0, 425, 33, 427, 340, 35, 430,
+ /* 2000 */ 431, 432, 433, 434, 435, 49, 437, 350, 0, 39,
+ /* 2010 */ 35, 49, 35, 49, 0, 39, 340, 0, 0, 57,
+ /* 2020 */ 58, 59, 60, 0, 62, 22, 350, 340, 0, 0,
+ /* 2030 */ 0, 44, 35, 110, 35, 378, 35, 350, 44, 35,
+ /* 2040 */ 35, 35, 35, 22, 35, 35, 35, 390, 0, 392,
+ /* 2050 */ 0, 51, 0, 22, 378, 22, 22, 35, 0, 35,
+ /* 2060 */ 0, 35, 0, 22, 102, 378, 390, 105, 392, 20,
+ /* 2070 */ 35, 35, 35, 0, 35, 104, 22, 390, 0, 392,
+ /* 2080 */ 172, 103, 425, 103, 427, 22, 174, 430, 431, 432,
+ /* 2090 */ 433, 434, 435, 0, 437, 340, 0, 3, 263, 44,
+ /* 2100 */ 138, 425, 104, 427, 193, 350, 430, 431, 432, 433,
/* 2110 */ 434, 435, 425, 437, 427, 340, 172, 430, 431, 432,
- /* 2120 */ 433, 434, 435, 104, 437, 350, 340, 197, 48, 3,
- /* 2130 */ 44, 99, 179, 378, 103, 173, 350, 103, 101, 44,
- /* 2140 */ 178, 44, 104, 44, 104, 390, 340, 392, 103, 103,
- /* 2150 */ 47, 104, 47, 378, 44, 35, 350, 103, 35, 104,
- /* 2160 */ 198, 44, 35, 104, 378, 390, 35, 392, 35, 35,
- /* 2170 */ 104, 104, 47, 0, 0, 47, 390, 0, 392, 263,
- /* 2180 */ 425, 0, 427, 39, 378, 430, 431, 432, 433, 434,
- /* 2190 */ 435, 103, 437, 47, 263, 103, 390, 103, 392, 257,
- /* 2200 */ 425, 103, 427, 263, 340, 430, 431, 432, 433, 434,
- /* 2210 */ 435, 425, 437, 427, 350, 104, 430, 431, 432, 433,
- /* 2220 */ 434, 435, 104, 437, 103, 340, 0, 39, 113, 47,
- /* 2230 */ 44, 425, 103, 427, 244, 350, 430, 431, 432, 433,
- /* 2240 */ 434, 435, 378, 437, 175, 2, 173, 22, 101, 101,
- /* 2250 */ 340, 47, 103, 103, 390, 104, 392, 104, 103, 103,
- /* 2260 */ 350, 104, 103, 378, 222, 47, 104, 22, 224, 103,
- /* 2270 */ 35, 104, 114, 35, 103, 390, 340, 392, 44, 104,
- /* 2280 */ 104, 35, 103, 35, 104, 35, 350, 103, 378, 425,
- /* 2290 */ 35, 427, 103, 103, 430, 431, 432, 433, 434, 435,
- /* 2300 */ 390, 437, 392, 104, 104, 35, 35, 22, 103, 69,
+ /* 2120 */ 433, 434, 435, 103, 437, 350, 340, 197, 179, 172,
+ /* 2130 */ 103, 48, 48, 378, 44, 173, 350, 3, 47, 101,
+ /* 2140 */ 178, 99, 44, 44, 104, 390, 340, 392, 104, 103,
+ /* 2150 */ 103, 47, 44, 378, 103, 44, 350, 104, 35, 103,
+ /* 2160 */ 198, 104, 35, 104, 378, 390, 35, 392, 35, 104,
+ /* 2170 */ 35, 35, 104, 47, 257, 47, 390, 0, 392, 0,
+ /* 2180 */ 425, 44, 427, 0, 378, 430, 431, 432, 433, 434,
+ /* 2190 */ 435, 0, 437, 39, 263, 263, 390, 47, 392, 104,
+ /* 2200 */ 425, 104, 427, 103, 340, 430, 431, 432, 433, 434,
+ /* 2210 */ 435, 425, 437, 427, 350, 103, 430, 431, 432, 433,
+ /* 2220 */ 434, 435, 103, 437, 103, 340, 0, 103, 39, 113,
+ /* 2230 */ 44, 425, 103, 427, 173, 350, 430, 431, 432, 433,
+ /* 2240 */ 434, 435, 378, 437, 175, 47, 101, 101, 2, 22,
+ /* 2250 */ 340, 103, 47, 104, 390, 103, 392, 244, 47, 104,
+ /* 2260 */ 350, 103, 103, 378, 104, 222, 103, 22, 104, 224,
+ /* 2270 */ 103, 114, 104, 35, 35, 390, 340, 392, 103, 35,
+ /* 2280 */ 104, 103, 35, 35, 104, 103, 350, 103, 378, 425,
+ /* 2290 */ 35, 427, 104, 103, 430, 431, 432, 433, 434, 435,
+ /* 2300 */ 390, 437, 392, 104, 104, 35, 125, 103, 44, 35,
/* 2310 */ 425, 103, 427, 103, 378, 430, 431, 432, 433, 434,
- /* 2320 */ 435, 125, 437, 125, 103, 68, 390, 125, 392, 35,
+ /* 2320 */ 435, 125, 437, 103, 22, 69, 390, 125, 392, 68,
/* 2330 */ 35, 125, 35, 35, 35, 425, 340, 427, 35, 35,
- /* 2340 */ 430, 431, 432, 433, 434, 435, 350, 437, 35, 75,
- /* 2350 */ 97, 44, 340, 35, 35, 35, 22, 35, 35, 35,
+ /* 2340 */ 430, 431, 432, 433, 434, 435, 350, 437, 35, 35,
+ /* 2350 */ 75, 97, 340, 44, 35, 35, 35, 22, 35, 35,
/* 2360 */ 35, 425, 350, 427, 75, 340, 430, 431, 432, 433,
- /* 2370 */ 434, 435, 35, 437, 378, 350, 35, 35, 35, 22,
- /* 2380 */ 35, 0, 35, 39, 49, 0, 390, 35, 392, 49,
- /* 2390 */ 378, 0, 39, 35, 39, 49, 0, 35, 49, 39,
- /* 2400 */ 0, 35, 390, 378, 392, 35, 0, 20, 22, 21,
- /* 2410 */ 485, 22, 22, 21, 485, 390, 485, 392, 485, 485,
+ /* 2370 */ 434, 435, 35, 437, 378, 350, 35, 35, 35, 35,
+ /* 2380 */ 22, 35, 0, 35, 39, 49, 390, 0, 392, 35,
+ /* 2390 */ 378, 39, 0, 0, 35, 39, 49, 35, 49, 49,
+ /* 2400 */ 39, 0, 390, 378, 392, 35, 35, 0, 22, 21,
+ /* 2410 */ 485, 22, 22, 485, 20, 390, 21, 392, 485, 485,
/* 2420 */ 485, 425, 485, 427, 485, 340, 430, 431, 432, 433,
/* 2430 */ 434, 435, 485, 437, 485, 350, 485, 425, 485, 427,
/* 2440 */ 485, 340, 430, 431, 432, 433, 434, 435, 485, 437,
@@ -1108,7 +770,7 @@ static const YYCODETYPE yy_lookahead[] = {
/* 2720 */ 485, 485, 430, 431, 432, 433, 434, 435, 485, 437,
/* 2730 */ 485, 485, 485, 485, 485, 485, 485, 485, 485, 485,
/* 2740 */ 485, 485, 485, 485, 485, 485, 485, 485, 485, 485,
- /* 2750 */ 485, 337, 337, 337, 337, 337, 337, 337, 337, 337,
+ /* 2750 */ 485, 485, 485, 485, 337, 337, 337, 337, 337, 337,
/* 2760 */ 337, 337, 337, 337, 337, 337, 337, 337, 337, 337,
/* 2770 */ 337, 337, 337, 337, 337, 337, 337, 337, 337, 337,
/* 2780 */ 337, 337, 337, 337, 337, 337, 337, 337, 337, 337,
@@ -1143,88 +805,88 @@ static const YYCODETYPE yy_lookahead[] = {
};
#define YY_SHIFT_COUNT (793)
#define YY_SHIFT_MIN (0)
-#define YY_SHIFT_MAX (2406)
+#define YY_SHIFT_MAX (2407)
static const unsigned short int yy_shift_ofst[] = {
/* 0 */ 1097, 0, 104, 0, 336, 336, 336, 336, 336, 336,
/* 10 */ 336, 336, 336, 336, 336, 336, 440, 671, 671, 775,
/* 20 */ 671, 671, 671, 671, 671, 671, 671, 671, 671, 671,
/* 30 */ 671, 671, 671, 671, 671, 671, 671, 671, 671, 671,
/* 40 */ 671, 671, 671, 671, 671, 671, 671, 671, 671, 671,
- /* 50 */ 671, 335, 519, 1053, 263, 215, 156, 496, 156, 263,
- /* 60 */ 263, 1333, 156, 1333, 1333, 621, 156, 34, 742, 111,
- /* 70 */ 111, 742, 278, 278, 294, 138, 308, 308, 111, 111,
+ /* 50 */ 671, 335, 519, 1053, 263, 215, 156, 586, 156, 263,
+ /* 60 */ 263, 1333, 156, 1333, 1333, 621, 156, 34, 798, 111,
+ /* 70 */ 111, 798, 278, 278, 294, 138, 308, 308, 111, 111,
/* 80 */ 111, 111, 111, 111, 111, 199, 111, 111, 297, 34,
/* 90 */ 111, 111, 223, 111, 34, 111, 199, 111, 199, 34,
- /* 100 */ 111, 111, 34, 111, 34, 34, 34, 111, 317, 917,
+ /* 100 */ 111, 111, 34, 111, 34, 34, 34, 111, 460, 917,
/* 110 */ 15, 15, 378, 170, 700, 700, 700, 700, 700, 700,
/* 120 */ 700, 700, 700, 700, 700, 700, 700, 700, 700, 700,
- /* 130 */ 700, 700, 700, 326, 410, 294, 138, 633, 633, 721,
- /* 140 */ 426, 426, 426, 618, 107, 107, 721, 299, 299, 299,
- /* 150 */ 297, 470, 227, 34, 702, 34, 702, 702, 907, 985,
+ /* 130 */ 700, 700, 700, 326, 410, 294, 138, 633, 633, 714,
+ /* 140 */ 426, 426, 426, 618, 107, 107, 714, 299, 299, 299,
+ /* 150 */ 297, 356, 353, 34, 577, 34, 577, 577, 663, 730,
/* 160 */ 259, 259, 259, 259, 259, 259, 259, 259, 1962, 1116,
- /* 170 */ 185, 31, 276, 249, 394, 176, 13, 13, 1073, 1107,
- /* 180 */ 489, 1117, 932, 840, 1064, 1163, 996, 355, 806, 996,
- /* 190 */ 814, 429, 256, 1219, 1434, 1468, 1287, 297, 1468, 297,
- /* 200 */ 1320, 1467, 1498, 1467, 1352, 1510, 1510, 1467, 1352, 1352,
- /* 210 */ 1444, 1449, 1510, 1452, 1510, 1510, 1510, 1541, 1516, 1541,
- /* 220 */ 1516, 1468, 297, 1559, 297, 1562, 1563, 297, 1562, 297,
- /* 230 */ 297, 297, 1510, 297, 1541, 34, 34, 34, 34, 34,
- /* 240 */ 34, 34, 34, 34, 34, 34, 1510, 1541, 702, 702,
- /* 250 */ 702, 1391, 1507, 1468, 317, 1423, 1425, 1559, 317, 1439,
- /* 260 */ 1219, 1510, 1498, 1498, 702, 1368, 1373, 702, 1368, 1373,
- /* 270 */ 702, 702, 34, 1362, 1465, 1368, 1375, 1403, 1427, 1219,
- /* 280 */ 1369, 1409, 1413, 1438, 299, 1679, 1219, 1510, 1562, 317,
- /* 290 */ 317, 1688, 1373, 702, 702, 702, 702, 702, 1373, 702,
- /* 300 */ 1535, 317, 907, 317, 299, 1631, 1639, 702, 985, 1510,
- /* 310 */ 317, 1712, 1541, 2730, 2730, 2730, 2730, 2730, 2730, 2730,
- /* 320 */ 2730, 2730, 1018, 679, 224, 1543, 736, 745, 858, 418,
- /* 330 */ 974, 1041, 1110, 1166, 1377, 1377, 1377, 1377, 1377, 1377,
+ /* 170 */ 185, 31, 276, 249, 394, 176, 13, 13, 862, 1073,
+ /* 180 */ 489, 776, 1167, 949, 721, 820, 996, 355, 581, 996,
+ /* 190 */ 997, 1081, 256, 1219, 1434, 1470, 1288, 297, 1470, 297,
+ /* 200 */ 1318, 1467, 1498, 1467, 1352, 1507, 1507, 1467, 1352, 1352,
+ /* 210 */ 1437, 1446, 1507, 1452, 1507, 1507, 1507, 1541, 1516, 1541,
+ /* 220 */ 1516, 1470, 297, 1561, 297, 1563, 1564, 297, 1563, 297,
+ /* 230 */ 297, 297, 1507, 297, 1541, 34, 34, 34, 34, 34,
+ /* 240 */ 34, 34, 34, 34, 34, 34, 1507, 1541, 577, 577,
+ /* 250 */ 577, 1400, 1508, 1470, 460, 1422, 1425, 1561, 460, 1436,
+ /* 260 */ 1219, 1507, 1498, 1498, 577, 1366, 1370, 577, 1366, 1370,
+ /* 270 */ 577, 577, 34, 1364, 1461, 1366, 1376, 1402, 1427, 1219,
+ /* 280 */ 1406, 1411, 1414, 1438, 299, 1679, 1219, 1507, 1563, 460,
+ /* 290 */ 460, 1688, 1370, 577, 577, 577, 577, 577, 1370, 577,
+ /* 300 */ 1535, 460, 663, 460, 299, 1625, 1640, 577, 730, 1507,
+ /* 310 */ 460, 1708, 1541, 2730, 2730, 2730, 2730, 2730, 2730, 2730,
+ /* 320 */ 2730, 2730, 1018, 679, 224, 739, 1543, 858, 1041, 418,
+ /* 330 */ 748, 974, 1110, 1166, 1377, 1377, 1377, 1377, 1377, 1377,
/* 340 */ 1377, 1377, 1377, 500, 729, 51, 51, 441, 484, 446,
- /* 350 */ 660, 76, 121, 827, 593, 291, 582, 582, 787, 536,
- /* 360 */ 984, 787, 787, 787, 816, 992, 1125, 934, 997, 762,
- /* 370 */ 1190, 1183, 1224, 1241, 1242, 514, 566, 1227, 1288, 1340,
- /* 380 */ 1062, 1250, 1319, 1302, 1321, 1323, 1325, 1124, 1140, 1154,
- /* 390 */ 1244, 1328, 1330, 1331, 1338, 1344, 1361, 1356, 1378, 980,
- /* 400 */ 1380, 549, 1382, 1387, 1392, 1396, 1399, 1400, 829, 1298,
- /* 410 */ 1306, 1374, 1426, 1201, 1456, 1767, 1768, 1769, 1728, 1771,
- /* 420 */ 1740, 1561, 1748, 1751, 1753, 1574, 1790, 1756, 1757, 1578,
- /* 430 */ 1794, 1580, 1797, 1765, 1807, 1788, 1811, 1777, 1603, 1814,
- /* 440 */ 1617, 1816, 1619, 1620, 1626, 1633, 1821, 1824, 1831, 1647,
- /* 450 */ 1649, 1835, 1836, 1791, 1839, 1840, 1841, 1801, 1844, 1845,
- /* 460 */ 1846, 1847, 1848, 1850, 1852, 1853, 1695, 1820, 1856, 1698,
- /* 470 */ 1858, 1859, 1860, 1861, 1862, 1874, 1875, 1876, 1878, 1879,
- /* 480 */ 1880, 1881, 1882, 1883, 1887, 1888, 1822, 1865, 1866, 1867,
- /* 490 */ 1868, 1869, 1870, 1849, 1872, 1897, 1898, 1759, 1899, 1900,
- /* 500 */ 1884, 1855, 1886, 1857, 1904, 1854, 1877, 1907, 1863, 1914,
- /* 510 */ 1871, 1917, 1918, 1889, 1873, 1890, 1920, 1891, 1892, 1893,
- /* 520 */ 1921, 1895, 1894, 1901, 1927, 1896, 1934, 1902, 1903, 1905,
- /* 530 */ 1919, 1922, 1924, 1926, 1939, 1906, 1925, 1945, 1951, 1965,
- /* 540 */ 1928, 1729, 1911, 1968, 1971, 1915, 1974, 1983, 1950, 1938,
- /* 550 */ 1947, 1988, 1954, 1941, 1952, 1992, 1958, 1949, 1966, 2008,
- /* 560 */ 1975, 1960, 1973, 2013, 2014, 2015, 2017, 2018, 2023, 1913,
- /* 570 */ 1826, 1993, 2007, 2030, 1997, 1998, 1999, 2001, 2003, 2004,
- /* 580 */ 2005, 1987, 2000, 2006, 2010, 2020, 2011, 2043, 2026, 2050,
- /* 590 */ 2029, 2002, 2052, 2033, 2021, 2057, 2024, 2058, 2027, 2060,
- /* 600 */ 2039, 2049, 2028, 2035, 2036, 1969, 1972, 2072, 1908, 1978,
- /* 610 */ 1930, 2041, 2056, 2074, 1909, 2061, 1932, 1912, 2093, 2096,
- /* 620 */ 1944, 1953, 2082, 2053, 1916, 1995, 2019, 2031, 2051, 2037,
- /* 630 */ 2080, 2032, 2038, 2086, 2095, 2040, 2034, 2045, 2046, 2047,
- /* 640 */ 2097, 2103, 2105, 2054, 2099, 1931, 2055, 2059, 2126, 2110,
- /* 650 */ 1940, 2120, 2123, 2127, 2131, 2133, 2134, 2066, 2067, 2125,
- /* 660 */ 1942, 2117, 2128, 2173, 2174, 2177, 2181, 2088, 2144, 1919,
- /* 670 */ 2146, 2092, 2111, 2118, 2094, 2098, 2069, 2121, 2226, 2188,
- /* 680 */ 2073, 2129, 2115, 1919, 2182, 2186, 2147, 1990, 2148, 2243,
- /* 690 */ 2225, 2042, 2149, 2151, 2150, 2153, 2155, 2157, 2204, 2156,
- /* 700 */ 2159, 2218, 2162, 2245, 2044, 2166, 2158, 2167, 2235, 2238,
- /* 710 */ 2171, 2175, 2246, 2179, 2176, 2248, 2184, 2180, 2250, 2189,
- /* 720 */ 2199, 2255, 2190, 2200, 2270, 2205, 2196, 2198, 2202, 2206,
- /* 730 */ 2208, 2234, 2210, 2271, 2221, 2234, 2234, 2285, 2240, 2257,
- /* 740 */ 2294, 2295, 2297, 2298, 2299, 2303, 2304, 2313, 2274, 2253,
- /* 750 */ 2307, 2318, 2319, 2320, 2334, 2322, 2323, 2324, 2289, 1987,
- /* 760 */ 2325, 2000, 2337, 2341, 2342, 2343, 2357, 2345, 2381, 2347,
- /* 770 */ 2335, 2344, 2385, 2352, 2340, 2353, 2391, 2358, 2346, 2355,
- /* 780 */ 2396, 2362, 2349, 2360, 2400, 2366, 2370, 2406, 2386, 2388,
- /* 790 */ 2389, 2390, 2392, 2387,
+ /* 350 */ 660, 76, 121, 699, 593, 291, 924, 924, 701, 536,
+ /* 360 */ 952, 701, 701, 701, 384, 1060, 1093, 1095, 1291, 1220,
+ /* 370 */ 765, 1241, 1242, 1243, 1247, 566, 688, 1340, 1342, 1365,
+ /* 380 */ 1087, 1319, 1323, 1226, 1325, 1328, 1330, 1274, 1157, 1183,
+ /* 390 */ 1310, 1331, 1338, 1344, 1361, 1363, 1372, 1420, 1380, 1101,
+ /* 400 */ 1381, 1389, 1382, 1384, 1387, 1393, 1396, 1399, 1343, 1362,
+ /* 410 */ 1374, 1426, 1428, 723, 1444, 1760, 1767, 1768, 1729, 1783,
+ /* 420 */ 1740, 1571, 1741, 1753, 1754, 1575, 1791, 1757, 1758, 1579,
+ /* 430 */ 1795, 1582, 1800, 1772, 1810, 1789, 1812, 1778, 1604, 1815,
+ /* 440 */ 1618, 1817, 1620, 1622, 1627, 1633, 1824, 1831, 1833, 1648,
+ /* 450 */ 1650, 1836, 1838, 1792, 1840, 1841, 1843, 1802, 1845, 1846,
+ /* 460 */ 1847, 1848, 1850, 1852, 1853, 1854, 1696, 1821, 1857, 1699,
+ /* 470 */ 1859, 1860, 1861, 1862, 1874, 1875, 1876, 1878, 1879, 1880,
+ /* 480 */ 1881, 1882, 1883, 1887, 1888, 1897, 1822, 1865, 1866, 1867,
+ /* 490 */ 1868, 1869, 1870, 1849, 1872, 1898, 1899, 1759, 1900, 1903,
+ /* 500 */ 1884, 1856, 1886, 1863, 1905, 1855, 1877, 1907, 1858, 1914,
+ /* 510 */ 1871, 1916, 1918, 1889, 1873, 1890, 1921, 1891, 1892, 1893,
+ /* 520 */ 1925, 1895, 1894, 1901, 1927, 1896, 1934, 1902, 1906, 1920,
+ /* 530 */ 1904, 1919, 1922, 1924, 1938, 1909, 1926, 1939, 1942, 1946,
+ /* 540 */ 1928, 1787, 1969, 1973, 1974, 1915, 1983, 1985, 1951, 1940,
+ /* 550 */ 1948, 1988, 1955, 1943, 1952, 1993, 1963, 1956, 1970, 2008,
+ /* 560 */ 1975, 1964, 1976, 2014, 2017, 2018, 2023, 2028, 2029, 1798,
+ /* 570 */ 1923, 1977, 2003, 2030, 1997, 1999, 2001, 2004, 2005, 2006,
+ /* 580 */ 2007, 1987, 1994, 2009, 2010, 2021, 2011, 2048, 2031, 2050,
+ /* 590 */ 2033, 2000, 2052, 2034, 2022, 2058, 2024, 2060, 2026, 2062,
+ /* 600 */ 2041, 2049, 2035, 2036, 2037, 1971, 1978, 2073, 1908, 1980,
+ /* 610 */ 1930, 2039, 2054, 2078, 1911, 2063, 1944, 1912, 2093, 2096,
+ /* 620 */ 1957, 1949, 2094, 2055, 1835, 2020, 1998, 2027, 2083, 2038,
+ /* 630 */ 2084, 2042, 2040, 2090, 2098, 2044, 2046, 2047, 2051, 2053,
+ /* 640 */ 2099, 2091, 2104, 2056, 2108, 1931, 2057, 2059, 2134, 2111,
+ /* 650 */ 1932, 2123, 2127, 2131, 2133, 2135, 2136, 2065, 2068, 2126,
+ /* 660 */ 1917, 2137, 2128, 2177, 2179, 2183, 2191, 2100, 2154, 1904,
+ /* 670 */ 2150, 2112, 2095, 2097, 2119, 2121, 2069, 2124, 2226, 2189,
+ /* 680 */ 2061, 2129, 2116, 1904, 2198, 2186, 2145, 2013, 2146, 2246,
+ /* 690 */ 2227, 2043, 2148, 2149, 2152, 2155, 2158, 2160, 2205, 2159,
+ /* 700 */ 2163, 2211, 2164, 2245, 2045, 2167, 2157, 2168, 2238, 2239,
+ /* 710 */ 2175, 2176, 2244, 2178, 2180, 2247, 2182, 2188, 2248, 2184,
+ /* 720 */ 2199, 2255, 2190, 2200, 2270, 2204, 2181, 2196, 2202, 2206,
+ /* 730 */ 2208, 2264, 2210, 2274, 2220, 2264, 2264, 2302, 2256, 2261,
+ /* 740 */ 2295, 2297, 2298, 2299, 2303, 2304, 2313, 2314, 2275, 2254,
+ /* 750 */ 2309, 2319, 2320, 2321, 2335, 2323, 2324, 2325, 2289, 1987,
+ /* 760 */ 2337, 1994, 2341, 2342, 2343, 2344, 2358, 2346, 2382, 2348,
+ /* 770 */ 2336, 2345, 2387, 2354, 2347, 2352, 2392, 2359, 2349, 2356,
+ /* 780 */ 2393, 2362, 2350, 2361, 2401, 2370, 2371, 2407, 2386, 2388,
+ /* 790 */ 2389, 2390, 2395, 2394,
};
#define YY_REDUCE_COUNT (321)
#define YY_REDUCE_MIN (-438)
@@ -1236,115 +898,115 @@ static const short yy_reduce_ofst[] = {
/* 30 */ 1676, 1687, 1755, 1775, 1786, 1806, 1864, 1885, 1910, 1936,
/* 40 */ 1996, 2012, 2025, 2085, 2101, 2114, 2187, 2203, 2214, 2276,
/* 50 */ 2292, 167, 792, -403, 78, -401, -360, 252, 672, 47,
- /* 60 */ 197, 1048, -438, -244, 339, -331, 505, -211, -274, -63,
- /* 70 */ 23, -391, -40, 149, -317, -31, -342, -265, 295, 414,
- /* 80 */ 449, 457, 464, 486, 571, -344, 589, 610, -252, -205,
- /* 90 */ 622, 625, -243, 673, 219, 675, -92, 677, 19, -16,
- /* 100 */ 423, 795, 325, 805, 563, 755, 772, 822, -268, -207,
- /* 110 */ -173, -173, 327, -337, -321, -229, -93, 61, 375, 403,
- /* 120 */ 439, 630, 746, 790, 819, 828, 838, 842, 856, 871,
- /* 130 */ 873, 885, 901, -288, -34, -213, 90, 476, 575, 695,
- /* 140 */ -34, 50, 688, 247, -409, 402, 699, 351, 373, 455,
- /* 150 */ 511, 234, 474, 356, 567, 570, 609, 642, 802, 824,
- /* 160 */ -364, 753, 778, 833, 890, 899, 904, 890, 880, 956,
- /* 170 */ 972, 942, 867, 881, 1031, 931, 1049, 1075, 1068, 1068,
- /* 180 */ 1113, 1060, 1115, 1121, 1078, 1074, 1015, 1015, 1001, 1015,
- /* 190 */ 1028, 1019, 1068, 1071, 1063, 1076, 1069, 1136, 1083, 1139,
- /* 200 */ 1104, 1122, 1120, 1129, 1132, 1182, 1184, 1135, 1142, 1143,
- /* 210 */ 1173, 1188, 1202, 1192, 1205, 1210, 1211, 1221, 1220, 1235,
- /* 220 */ 1232, 1148, 1222, 1189, 1226, 1234, 1175, 1229, 1237, 1231,
- /* 230 */ 1236, 1238, 1246, 1239, 1248, 1215, 1228, 1230, 1233, 1240,
- /* 240 */ 1243, 1245, 1249, 1252, 1253, 1254, 1255, 1256, 1212, 1217,
- /* 250 */ 1223, 1186, 1191, 1195, 1260, 1204, 1207, 1247, 1270, 1218,
- /* 260 */ 1257, 1279, 1261, 1264, 1259, 1172, 1263, 1275, 1177, 1265,
- /* 270 */ 1276, 1281, 1068, 1176, 1180, 1214, 1187, 1209, 1262, 1280,
- /* 280 */ 1208, 1216, 1266, 1015, 1348, 1272, 1292, 1354, 1353, 1349,
- /* 290 */ 1350, 1304, 1308, 1324, 1336, 1337, 1339, 1341, 1318, 1342,
- /* 300 */ 1326, 1384, 1359, 1385, 1386, 1291, 1364, 1357, 1376, 1401,
- /* 310 */ 1397, 1408, 1410, 1345, 1335, 1351, 1358, 1388, 1390, 1393,
- /* 320 */ 1402, 1428,
+ /* 60 */ 197, 379, -438, -244, 339, -331, 505, -211, -274, -63,
+ /* 70 */ 23, -391, -40, 149, -317, -31, -342, -265, 295, 464,
+ /* 80 */ 486, 571, 608, 610, 622, -344, 673, 675, -252, -205,
+ /* 90 */ 677, 805, -243, 809, 219, 822, -92, 833, 19, -16,
+ /* 100 */ 423, 840, 325, 880, 563, 755, 891, 914, -268, -207,
+ /* 110 */ -173, -173, 327, -337, -321, -229, -93, 61, 209, 403,
+ /* 120 */ 439, 461, 529, 630, 746, 802, 828, 844, 856, 885,
+ /* 130 */ 888, 900, 901, -288, -34, -213, 90, 448, 476, 554,
+ /* 140 */ -34, 50, 501, 247, -409, 301, 780, 499, 533, 582,
+ /* 150 */ 769, 234, 422, 643, 609, 549, 786, 878, 918, 945,
+ /* 160 */ -364, 447, 477, 535, 547, 575, 615, 547, 628, 681,
+ /* 170 */ 791, 662, 667, 685, 811, 745, 814, 866, 892, 892,
+ /* 180 */ 883, 894, 1112, 1121, 1084, 1074, 1017, 1017, 1001, 1017,
+ /* 190 */ 1028, 1019, 892, 1071, 1063, 1076, 1072, 1140, 1083, 1146,
+ /* 200 */ 1096, 1119, 1120, 1122, 1131, 1181, 1182, 1135, 1138, 1142,
+ /* 210 */ 1173, 1187, 1200, 1191, 1203, 1210, 1211, 1221, 1231, 1236,
+ /* 220 */ 1233, 1148, 1222, 1190, 1227, 1235, 1176, 1230, 1238, 1232,
+ /* 230 */ 1237, 1239, 1244, 1240, 1252, 1218, 1224, 1228, 1229, 1234,
+ /* 240 */ 1245, 1246, 1248, 1249, 1250, 1253, 1255, 1258, 1223, 1254,
+ /* 250 */ 1256, 1185, 1189, 1195, 1260, 1201, 1204, 1257, 1266, 1216,
+ /* 260 */ 1261, 1284, 1264, 1265, 1263, 1171, 1262, 1271, 1174, 1267,
+ /* 270 */ 1276, 1278, 892, 1170, 1180, 1186, 1206, 1217, 1269, 1280,
+ /* 280 */ 1208, 1268, 1259, 1017, 1348, 1272, 1292, 1354, 1353, 1349,
+ /* 290 */ 1350, 1304, 1308, 1324, 1334, 1336, 1337, 1339, 1327, 1351,
+ /* 300 */ 1321, 1378, 1359, 1386, 1388, 1293, 1368, 1357, 1383, 1403,
+ /* 310 */ 1392, 1410, 1413, 1345, 1346, 1356, 1358, 1385, 1397, 1398,
+ /* 320 */ 1408, 1421,
};
static const YYACTIONTYPE yy_default[] = {
- /* 0 */ 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766,
- /* 10 */ 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766,
- /* 20 */ 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766,
- /* 30 */ 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766,
- /* 40 */ 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766,
- /* 50 */ 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766,
- /* 60 */ 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766,
- /* 70 */ 1766, 1766, 1766, 1766, 2047, 1766, 1766, 1766, 1766, 1766,
- /* 80 */ 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1855, 1766,
- /* 90 */ 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766,
- /* 100 */ 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1853, 2040,
- /* 110 */ 2265, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766,
- /* 120 */ 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766,
- /* 130 */ 1766, 1766, 1766, 1766, 2277, 1766, 1766, 1829, 1829, 1766,
- /* 140 */ 2277, 2277, 2277, 1853, 2237, 2237, 1766, 1766, 1766, 1766,
- /* 150 */ 1855, 2107, 1766, 1766, 1766, 1766, 1766, 1766, 1975, 1766,
- /* 160 */ 1766, 1766, 1766, 1766, 1999, 1766, 1766, 1766, 2099, 1766,
- /* 170 */ 1766, 2302, 2358, 1766, 1766, 2305, 1766, 1766, 1766, 1766,
- /* 180 */ 1766, 2052, 1766, 1766, 1928, 2292, 2269, 2283, 2342, 2270,
- /* 190 */ 2267, 2286, 1766, 2296, 1766, 1766, 2121, 1855, 1766, 1855,
- /* 200 */ 2086, 2045, 1766, 2045, 2042, 1766, 1766, 2045, 2042, 2042,
- /* 210 */ 1917, 1913, 1766, 1911, 1766, 1766, 1766, 1766, 1813, 1766,
- /* 220 */ 1813, 1766, 1855, 1766, 1855, 1766, 1766, 1855, 1766, 1855,
- /* 230 */ 1855, 1855, 1766, 1855, 1766, 1766, 1766, 1766, 1766, 1766,
- /* 240 */ 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766,
- /* 250 */ 1766, 2119, 2105, 1766, 1853, 2097, 2095, 1766, 1853, 2093,
- /* 260 */ 2296, 1766, 1766, 1766, 1766, 2313, 2311, 1766, 2313, 2311,
- /* 270 */ 1766, 1766, 1766, 2327, 2323, 2313, 2331, 2329, 2298, 2296,
- /* 280 */ 2361, 2348, 2344, 2283, 1766, 1766, 2296, 1766, 1766, 1853,
- /* 290 */ 1853, 1766, 2311, 1766, 1766, 1766, 1766, 1766, 2311, 1766,
- /* 300 */ 1766, 1853, 1766, 1853, 1766, 1766, 1944, 1766, 1766, 1766,
- /* 310 */ 1853, 1798, 1766, 2088, 2110, 2070, 2070, 1978, 1978, 1978,
- /* 320 */ 1856, 1771, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766,
- /* 330 */ 1766, 1766, 1766, 1766, 2326, 2325, 2192, 1766, 2241, 2240,
- /* 340 */ 2239, 2230, 2191, 1940, 1766, 2190, 2189, 1766, 1766, 1766,
- /* 350 */ 1766, 1766, 1766, 1766, 1766, 1766, 2061, 2060, 2183, 1766,
- /* 360 */ 1766, 2184, 2182, 2181, 1766, 1766, 1766, 1766, 1766, 1766,
- /* 370 */ 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766,
- /* 380 */ 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 2345, 2349,
- /* 390 */ 1766, 1766, 1766, 1766, 1766, 1766, 1766, 2266, 1766, 1766,
- /* 400 */ 1766, 2165, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766,
- /* 410 */ 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766,
- /* 420 */ 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766,
- /* 430 */ 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766,
- /* 440 */ 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766,
- /* 450 */ 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766,
- /* 460 */ 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766,
- /* 470 */ 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766,
- /* 480 */ 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766,
- /* 490 */ 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766,
- /* 500 */ 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766,
- /* 510 */ 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766,
- /* 520 */ 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1803,
- /* 530 */ 2170, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766,
- /* 540 */ 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766,
- /* 550 */ 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766,
- /* 560 */ 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766,
- /* 570 */ 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766,
- /* 580 */ 1766, 1894, 1893, 1766, 1766, 1766, 1766, 1766, 1766, 1766,
- /* 590 */ 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766,
- /* 600 */ 1766, 1766, 1766, 1766, 1766, 2174, 1766, 1766, 1766, 1766,
- /* 610 */ 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766,
- /* 620 */ 1766, 1766, 2341, 2299, 1766, 1766, 1766, 1766, 1766, 1766,
- /* 630 */ 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766,
- /* 640 */ 1766, 1766, 2165, 1766, 2324, 1766, 1766, 2339, 1766, 2343,
- /* 650 */ 1766, 1766, 1766, 1766, 1766, 1766, 1766, 2276, 2272, 1766,
- /* 660 */ 1766, 2268, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 2173,
- /* 670 */ 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766,
- /* 680 */ 1766, 1766, 1766, 2164, 1766, 2227, 1766, 1766, 1766, 2261,
- /* 690 */ 1766, 1766, 2212, 1766, 1766, 1766, 1766, 1766, 1766, 1766,
- /* 700 */ 1766, 1766, 2174, 1766, 2177, 1766, 1766, 1766, 1766, 1766,
- /* 710 */ 1972, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766,
- /* 720 */ 1766, 1766, 1766, 1766, 1766, 1766, 1956, 1954, 1953, 1952,
- /* 730 */ 1766, 1985, 1766, 1766, 1766, 1981, 1980, 1766, 1766, 1766,
- /* 740 */ 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766,
- /* 750 */ 1874, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1866,
- /* 760 */ 1766, 1865, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766,
- /* 770 */ 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766,
- /* 780 */ 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766,
- /* 790 */ 1766, 1766, 1766, 1766,
+ /* 0 */ 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768,
+ /* 10 */ 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768,
+ /* 20 */ 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768,
+ /* 30 */ 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768,
+ /* 40 */ 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768,
+ /* 50 */ 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768,
+ /* 60 */ 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768,
+ /* 70 */ 1768, 1768, 1768, 1768, 2049, 1768, 1768, 1768, 1768, 1768,
+ /* 80 */ 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1857, 1768,
+ /* 90 */ 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768,
+ /* 100 */ 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1855, 2042,
+ /* 110 */ 2267, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768,
+ /* 120 */ 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768,
+ /* 130 */ 1768, 1768, 1768, 1768, 2279, 1768, 1768, 1831, 1831, 1768,
+ /* 140 */ 2279, 2279, 2279, 1855, 2239, 2239, 1768, 1768, 1768, 1768,
+ /* 150 */ 1857, 2109, 1768, 1768, 1768, 1768, 1768, 1768, 1977, 1768,
+ /* 160 */ 1768, 1768, 1768, 1768, 2001, 1768, 1768, 1768, 2101, 1768,
+ /* 170 */ 1768, 2304, 2361, 1768, 1768, 2307, 1768, 1768, 1768, 1768,
+ /* 180 */ 1768, 2054, 1768, 1768, 1930, 2294, 2271, 2285, 2345, 2272,
+ /* 190 */ 2269, 2288, 1768, 2298, 1768, 1768, 2123, 1857, 1768, 1857,
+ /* 200 */ 2088, 2047, 1768, 2047, 2044, 1768, 1768, 2047, 2044, 2044,
+ /* 210 */ 1919, 1915, 1768, 1913, 1768, 1768, 1768, 1768, 1815, 1768,
+ /* 220 */ 1815, 1768, 1857, 1768, 1857, 1768, 1768, 1857, 1768, 1857,
+ /* 230 */ 1857, 1857, 1768, 1857, 1768, 1768, 1768, 1768, 1768, 1768,
+ /* 240 */ 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768,
+ /* 250 */ 1768, 2121, 2107, 1768, 1855, 2099, 2097, 1768, 1855, 2095,
+ /* 260 */ 2298, 1768, 1768, 1768, 1768, 2315, 2313, 1768, 2315, 2313,
+ /* 270 */ 1768, 1768, 1768, 2329, 2325, 2315, 2334, 2331, 2300, 2298,
+ /* 280 */ 2364, 2351, 2347, 2285, 1768, 1768, 2298, 1768, 1768, 1855,
+ /* 290 */ 1855, 1768, 2313, 1768, 1768, 1768, 1768, 1768, 2313, 1768,
+ /* 300 */ 1768, 1855, 1768, 1855, 1768, 1768, 1946, 1768, 1768, 1768,
+ /* 310 */ 1855, 1800, 1768, 2090, 2112, 2072, 2072, 1980, 1980, 1980,
+ /* 320 */ 1858, 1773, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768,
+ /* 330 */ 1768, 1768, 1768, 1768, 2328, 2327, 2194, 1768, 2243, 2242,
+ /* 340 */ 2241, 2232, 2193, 1942, 1768, 2192, 2191, 1768, 1768, 1768,
+ /* 350 */ 1768, 1768, 1768, 1768, 1768, 1768, 2063, 2062, 2185, 1768,
+ /* 360 */ 1768, 2186, 2184, 2183, 1768, 1768, 1768, 1768, 1768, 1768,
+ /* 370 */ 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768,
+ /* 380 */ 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 2348, 2352,
+ /* 390 */ 1768, 1768, 1768, 1768, 1768, 1768, 1768, 2268, 1768, 1768,
+ /* 400 */ 1768, 2167, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768,
+ /* 410 */ 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768,
+ /* 420 */ 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768,
+ /* 430 */ 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768,
+ /* 440 */ 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768,
+ /* 450 */ 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768,
+ /* 460 */ 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768,
+ /* 470 */ 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768,
+ /* 480 */ 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768,
+ /* 490 */ 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768,
+ /* 500 */ 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768,
+ /* 510 */ 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768,
+ /* 520 */ 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1805,
+ /* 530 */ 2172, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768,
+ /* 540 */ 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768,
+ /* 550 */ 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768,
+ /* 560 */ 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768,
+ /* 570 */ 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768,
+ /* 580 */ 1768, 1896, 1895, 1768, 1768, 1768, 1768, 1768, 1768, 1768,
+ /* 590 */ 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768,
+ /* 600 */ 1768, 1768, 1768, 1768, 1768, 2176, 1768, 1768, 1768, 1768,
+ /* 610 */ 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768,
+ /* 620 */ 1768, 1768, 2344, 2301, 1768, 1768, 1768, 1768, 1768, 1768,
+ /* 630 */ 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768,
+ /* 640 */ 1768, 1768, 2167, 1768, 2326, 1768, 1768, 2342, 1768, 2346,
+ /* 650 */ 1768, 1768, 1768, 1768, 1768, 1768, 1768, 2278, 2274, 1768,
+ /* 660 */ 1768, 2270, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 2175,
+ /* 670 */ 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768,
+ /* 680 */ 1768, 1768, 1768, 2166, 1768, 2229, 1768, 1768, 1768, 2263,
+ /* 690 */ 1768, 1768, 2214, 1768, 1768, 1768, 1768, 1768, 1768, 1768,
+ /* 700 */ 1768, 1768, 2176, 1768, 2179, 1768, 1768, 1768, 1768, 1768,
+ /* 710 */ 1974, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768,
+ /* 720 */ 1768, 1768, 1768, 1768, 1768, 1768, 1958, 1956, 1955, 1954,
+ /* 730 */ 1768, 1987, 1768, 1768, 1768, 1983, 1982, 1768, 1768, 1768,
+ /* 740 */ 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768,
+ /* 750 */ 1876, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1868,
+ /* 760 */ 1768, 1867, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768,
+ /* 770 */ 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768,
+ /* 780 */ 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768,
+ /* 790 */ 1768, 1768, 1768, 1768,
};
/********** End of lemon-generated parsing tables *****************************/
@@ -1754,7 +1416,6 @@ typedef struct yyParser yyParser;
#ifndef NDEBUG
#include
-#include
static FILE *yyTraceFILE = 0;
static char *yyTracePrompt = 0;
#endif /* NDEBUG */
@@ -2843,39 +2504,40 @@ static const char *const yyRuleName[] = {
/* 559 */ "having_clause_opt ::= HAVING search_condition",
/* 560 */ "range_opt ::=",
/* 561 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP",
- /* 562 */ "every_opt ::=",
- /* 563 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP",
- /* 564 */ "query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt",
- /* 565 */ "query_simple ::= query_specification",
- /* 566 */ "query_simple ::= union_query_expression",
- /* 567 */ "union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery",
- /* 568 */ "union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery",
- /* 569 */ "query_simple_or_subquery ::= query_simple",
- /* 570 */ "query_simple_or_subquery ::= subquery",
- /* 571 */ "query_or_subquery ::= query_expression",
- /* 572 */ "query_or_subquery ::= subquery",
- /* 573 */ "order_by_clause_opt ::=",
- /* 574 */ "order_by_clause_opt ::= ORDER BY sort_specification_list",
- /* 575 */ "slimit_clause_opt ::=",
- /* 576 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER",
- /* 577 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER",
- /* 578 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER",
- /* 579 */ "limit_clause_opt ::=",
- /* 580 */ "limit_clause_opt ::= LIMIT NK_INTEGER",
- /* 581 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER",
- /* 582 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER",
- /* 583 */ "subquery ::= NK_LP query_expression NK_RP",
- /* 584 */ "subquery ::= NK_LP subquery NK_RP",
- /* 585 */ "search_condition ::= common_expression",
- /* 586 */ "sort_specification_list ::= sort_specification",
- /* 587 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification",
- /* 588 */ "sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt",
- /* 589 */ "ordering_specification_opt ::=",
- /* 590 */ "ordering_specification_opt ::= ASC",
- /* 591 */ "ordering_specification_opt ::= DESC",
- /* 592 */ "null_ordering_opt ::=",
- /* 593 */ "null_ordering_opt ::= NULLS FIRST",
- /* 594 */ "null_ordering_opt ::= NULLS LAST",
+ /* 562 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_RP",
+ /* 563 */ "every_opt ::=",
+ /* 564 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP",
+ /* 565 */ "query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt",
+ /* 566 */ "query_simple ::= query_specification",
+ /* 567 */ "query_simple ::= union_query_expression",
+ /* 568 */ "union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery",
+ /* 569 */ "union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery",
+ /* 570 */ "query_simple_or_subquery ::= query_simple",
+ /* 571 */ "query_simple_or_subquery ::= subquery",
+ /* 572 */ "query_or_subquery ::= query_expression",
+ /* 573 */ "query_or_subquery ::= subquery",
+ /* 574 */ "order_by_clause_opt ::=",
+ /* 575 */ "order_by_clause_opt ::= ORDER BY sort_specification_list",
+ /* 576 */ "slimit_clause_opt ::=",
+ /* 577 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER",
+ /* 578 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER",
+ /* 579 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER",
+ /* 580 */ "limit_clause_opt ::=",
+ /* 581 */ "limit_clause_opt ::= LIMIT NK_INTEGER",
+ /* 582 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER",
+ /* 583 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER",
+ /* 584 */ "subquery ::= NK_LP query_expression NK_RP",
+ /* 585 */ "subquery ::= NK_LP subquery NK_RP",
+ /* 586 */ "search_condition ::= common_expression",
+ /* 587 */ "sort_specification_list ::= sort_specification",
+ /* 588 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification",
+ /* 589 */ "sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt",
+ /* 590 */ "ordering_specification_opt ::=",
+ /* 591 */ "ordering_specification_opt ::= ASC",
+ /* 592 */ "ordering_specification_opt ::= DESC",
+ /* 593 */ "null_ordering_opt ::=",
+ /* 594 */ "null_ordering_opt ::= NULLS FIRST",
+ /* 595 */ "null_ordering_opt ::= NULLS LAST",
};
#endif /* NDEBUG */
@@ -3077,9 +2739,7 @@ static void yy_destructor(
case 480: /* query_simple_or_subquery */
case 482: /* sort_specification */
{
-#line 7 "sql.y"
nodesDestroyNode((yypminor->yy242));
-#line 3082 "sql.c"
}
break;
case 338: /* account_options */
@@ -3088,9 +2748,7 @@ static void yy_destructor(
case 360: /* speed_opt */
case 417: /* bufsize_opt */
{
-#line 54 "sql.y"
-#line 3093 "sql.c"
}
break;
case 342: /* user_name */
@@ -3111,32 +2769,24 @@ static void yy_destructor(
case 437: /* noarg_func */
case 455: /* alias_opt */
{
-#line 735 "sql.y"
-#line 3116 "sql.c"
}
break;
case 343: /* sysinfo_opt */
{
-#line 92 "sql.y"
-#line 3123 "sql.c"
}
break;
case 344: /* privileges */
case 347: /* priv_type_list */
case 348: /* priv_type */
{
-#line 101 "sql.y"
-#line 3132 "sql.c"
}
break;
case 345: /* priv_level */
{
-#line 117 "sql.y"
-#line 3139 "sql.c"
}
break;
case 354: /* force_opt */
@@ -3149,9 +2799,7 @@ static void yy_destructor(
case 424: /* ignore_opt */
case 460: /* set_quantifier_opt */
{
-#line 146 "sql.y"
-#line 3154 "sql.c"
}
break;
case 363: /* integer_list */
@@ -3184,60 +2832,44 @@ static void yy_destructor(
case 476: /* order_by_clause_opt */
case 481: /* sort_specification_list */
{
-#line 270 "sql.y"
nodesDestroyList((yypminor->yy174));
-#line 3189 "sql.c"
}
break;
case 367: /* alter_db_option */
case 389: /* alter_table_option */
{
-#line 243 "sql.y"
-#line 3197 "sql.c"
}
break;
case 379: /* type_name */
{
-#line 364 "sql.y"
-#line 3204 "sql.c"
}
break;
case 445: /* compare_op */
case 446: /* in_op */
{
-#line 923 "sql.y"
-#line 3212 "sql.c"
}
break;
case 458: /* join_type */
{
-#line 999 "sql.y"
-#line 3219 "sql.c"
}
break;
case 472: /* fill_mode */
{
-#line 1074 "sql.y"
-#line 3226 "sql.c"
}
break;
case 483: /* ordering_specification_opt */
{
-#line 1157 "sql.y"
-#line 3233 "sql.c"
}
break;
case 484: /* null_ordering_opt */
{
-#line 1163 "sql.y"
-#line 3240 "sql.c"
}
break;
/********* End destructor definitions *****************************************/
@@ -3404,7 +3036,7 @@ static YYACTIONTYPE yy_find_shift_action(
#endif /* YYWILDCARD */
return yy_default[stateno];
}else{
- assert( i>=0 && i<(int)(sizeof(yy_action)/sizeof(yy_action[0])) );
+ assert( i>=0 && iyytos;
+#ifndef NDEBUG
+ if( yyTraceFILE && yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ){
+ yysize = yyRuleInfoNRhs[yyruleno];
+ if( yysize ){
+ fprintf(yyTraceFILE, "%sReduce %d [%s]%s, pop back to state %d.\n",
+ yyTracePrompt,
+ yyruleno, yyRuleName[yyruleno],
+ yyrulenoyytos - yypParser->yystack)>yypParser->yyhwm ){
+ yypParser->yyhwm++;
+ assert( yypParser->yyhwm == (int)(yypParser->yytos - yypParser->yystack));
+ }
+#endif
+#if YYSTACKDEPTH>0
+ if( yypParser->yytos>=yypParser->yystackEnd ){
+ yyStackOverflow(yypParser);
+ /* The call to yyStackOverflow() above pops the stack until it is
+ ** empty, causing the main parser loop to exit. So the return value
+ ** is never used and does not matter. */
+ return 0;
+ }
+#else
+ if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz-1] ){
+ if( yyGrowStack(yypParser) ){
+ yyStackOverflow(yypParser);
+ /* The call to yyStackOverflow() above pops the stack until it is
+ ** empty, causing the main parser loop to exit. So the return value
+ ** is never used and does not matter. */
+ return 0;
+ }
+ yymsp = yypParser->yytos;
+ }
+#endif
+ }
switch( yyruleno ){
/* Beginning here are the reduction cases. A typical example
@@ -4763,21 +4445,15 @@ static YYACTIONTYPE yy_reduce(
/********** Begin reduce actions **********************************************/
YYMINORTYPE yylhsminor;
case 0: /* cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */
-#line 50 "sql.y"
{ pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); }
-#line 4768 "sql.c"
yy_destructor(yypParser,338,&yymsp[0].minor);
break;
case 1: /* cmd ::= ALTER ACCOUNT NK_ID alter_account_options */
-#line 51 "sql.y"
{ pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); }
-#line 4774 "sql.c"
yy_destructor(yypParser,339,&yymsp[0].minor);
break;
case 2: /* account_options ::= */
-#line 55 "sql.y"
{ }
-#line 4780 "sql.c"
break;
case 3: /* account_options ::= account_options PPS literal */
case 4: /* account_options ::= account_options TSERIES literal */ yytestcase(yyruleno==4);
@@ -4789,24 +4465,18 @@ static YYACTIONTYPE yy_reduce(
case 10: /* account_options ::= account_options CONNS literal */ yytestcase(yyruleno==10);
case 11: /* account_options ::= account_options STATE literal */ yytestcase(yyruleno==11);
{ yy_destructor(yypParser,338,&yymsp[-2].minor);
-#line 56 "sql.y"
{ }
-#line 4794 "sql.c"
yy_destructor(yypParser,340,&yymsp[0].minor);
}
break;
case 12: /* alter_account_options ::= alter_account_option */
{ yy_destructor(yypParser,341,&yymsp[0].minor);
-#line 68 "sql.y"
{ }
-#line 4802 "sql.c"
}
break;
case 13: /* alter_account_options ::= alter_account_options alter_account_option */
{ yy_destructor(yypParser,339,&yymsp[-1].minor);
-#line 69 "sql.y"
{ }
-#line 4809 "sql.c"
yy_destructor(yypParser,341,&yymsp[0].minor);
}
break;
@@ -4820,111 +4490,71 @@ static YYACTIONTYPE yy_reduce(
case 21: /* alter_account_option ::= USERS literal */ yytestcase(yyruleno==21);
case 22: /* alter_account_option ::= CONNS literal */ yytestcase(yyruleno==22);
case 23: /* alter_account_option ::= STATE literal */ yytestcase(yyruleno==23);
-#line 73 "sql.y"
{ }
-#line 4825 "sql.c"
yy_destructor(yypParser,340,&yymsp[0].minor);
break;
case 24: /* cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt */
-#line 85 "sql.y"
{ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-3].minor.yy669, &yymsp[-1].minor.yy0, yymsp[0].minor.yy73); }
-#line 4831 "sql.c"
break;
case 25: /* cmd ::= ALTER USER user_name PASS NK_STRING */
-#line 86 "sql.y"
{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy669, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); }
-#line 4836 "sql.c"
break;
case 26: /* cmd ::= ALTER USER user_name ENABLE NK_INTEGER */
-#line 87 "sql.y"
{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy669, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); }
-#line 4841 "sql.c"
break;
case 27: /* cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */
-#line 88 "sql.y"
{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy669, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); }
-#line 4846 "sql.c"
break;
case 28: /* cmd ::= DROP USER user_name */
-#line 89 "sql.y"
{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy669); }
-#line 4851 "sql.c"
break;
case 29: /* sysinfo_opt ::= */
-#line 93 "sql.y"
{ yymsp[1].minor.yy73 = 1; }
-#line 4856 "sql.c"
break;
case 30: /* sysinfo_opt ::= SYSINFO NK_INTEGER */
-#line 94 "sql.y"
{ yymsp[-1].minor.yy73 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); }
-#line 4861 "sql.c"
break;
case 31: /* cmd ::= GRANT privileges ON priv_level with_opt TO user_name */
-#line 97 "sql.y"
{ pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-5].minor.yy349, &yymsp[-3].minor.yy257, &yymsp[0].minor.yy669, yymsp[-2].minor.yy242); }
-#line 4866 "sql.c"
break;
case 32: /* cmd ::= REVOKE privileges ON priv_level with_opt FROM user_name */
-#line 98 "sql.y"
{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-5].minor.yy349, &yymsp[-3].minor.yy257, &yymsp[0].minor.yy669, yymsp[-2].minor.yy242); }
-#line 4871 "sql.c"
break;
case 33: /* privileges ::= ALL */
-#line 102 "sql.y"
{ yymsp[0].minor.yy349 = PRIVILEGE_TYPE_ALL; }
-#line 4876 "sql.c"
break;
case 34: /* privileges ::= priv_type_list */
case 36: /* priv_type_list ::= priv_type */ yytestcase(yyruleno==36);
-#line 103 "sql.y"
{ yylhsminor.yy349 = yymsp[0].minor.yy349; }
-#line 4882 "sql.c"
yymsp[0].minor.yy349 = yylhsminor.yy349;
break;
case 35: /* privileges ::= SUBSCRIBE */
-#line 104 "sql.y"
{ yymsp[0].minor.yy349 = PRIVILEGE_TYPE_SUBSCRIBE; }
-#line 4888 "sql.c"
break;
case 37: /* priv_type_list ::= priv_type_list NK_COMMA priv_type */
-#line 109 "sql.y"
{ yylhsminor.yy349 = yymsp[-2].minor.yy349 | yymsp[0].minor.yy349; }
-#line 4893 "sql.c"
yymsp[-2].minor.yy349 = yylhsminor.yy349;
break;
case 38: /* priv_type ::= READ */
-#line 113 "sql.y"
{ yymsp[0].minor.yy349 = PRIVILEGE_TYPE_READ; }
-#line 4899 "sql.c"
break;
case 39: /* priv_type ::= WRITE */
-#line 114 "sql.y"
{ yymsp[0].minor.yy349 = PRIVILEGE_TYPE_WRITE; }
-#line 4904 "sql.c"
break;
case 40: /* priv_level ::= NK_STAR NK_DOT NK_STAR */
-#line 118 "sql.y"
{ yylhsminor.yy257.first = yymsp[-2].minor.yy0; yylhsminor.yy257.second = yymsp[0].minor.yy0; }
-#line 4909 "sql.c"
yymsp[-2].minor.yy257 = yylhsminor.yy257;
break;
case 41: /* priv_level ::= db_name NK_DOT NK_STAR */
-#line 119 "sql.y"
{ yylhsminor.yy257.first = yymsp[-2].minor.yy669; yylhsminor.yy257.second = yymsp[0].minor.yy0; }
-#line 4915 "sql.c"
yymsp[-2].minor.yy257 = yylhsminor.yy257;
break;
case 42: /* priv_level ::= db_name NK_DOT table_name */
-#line 120 "sql.y"
{ yylhsminor.yy257.first = yymsp[-2].minor.yy669; yylhsminor.yy257.second = yymsp[0].minor.yy669; }
-#line 4921 "sql.c"
yymsp[-2].minor.yy257 = yylhsminor.yy257;
break;
case 43: /* priv_level ::= topic_name */
-#line 121 "sql.y"
{ yylhsminor.yy257.first = yymsp[0].minor.yy669; yylhsminor.yy257.second = nil_token; }
-#line 4927 "sql.c"
yymsp[0].minor.yy257 = yylhsminor.yy257;
break;
case 44: /* with_opt ::= */
@@ -4940,75 +4570,49 @@ static YYACTIONTYPE yy_reduce(
case 544: /* fill_opt ::= */ yytestcase(yyruleno==544);
case 558: /* having_clause_opt ::= */ yytestcase(yyruleno==558);
case 560: /* range_opt ::= */ yytestcase(yyruleno==560);
- case 562: /* every_opt ::= */ yytestcase(yyruleno==562);
- case 575: /* slimit_clause_opt ::= */ yytestcase(yyruleno==575);
- case 579: /* limit_clause_opt ::= */ yytestcase(yyruleno==579);
-#line 123 "sql.y"
+ case 563: /* every_opt ::= */ yytestcase(yyruleno==563);
+ case 576: /* slimit_clause_opt ::= */ yytestcase(yyruleno==576);
+ case 580: /* limit_clause_opt ::= */ yytestcase(yyruleno==580);
{ yymsp[1].minor.yy242 = NULL; }
-#line 4948 "sql.c"
break;
case 45: /* with_opt ::= WITH search_condition */
case 499: /* from_clause_opt ::= FROM table_reference_list */ yytestcase(yyruleno==499);
case 528: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==528);
case 559: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==559);
-#line 124 "sql.y"
{ yymsp[-1].minor.yy242 = yymsp[0].minor.yy242; }
-#line 4956 "sql.c"
break;
case 46: /* cmd ::= CREATE DNODE dnode_endpoint */
-#line 127 "sql.y"
{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy669, NULL); }
-#line 4961 "sql.c"
break;
case 47: /* cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */
-#line 128 "sql.y"
{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy669, &yymsp[0].minor.yy0); }
-#line 4966 "sql.c"
break;
case 48: /* cmd ::= DROP DNODE NK_INTEGER force_opt */
-#line 129 "sql.y"
{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy777, false); }
-#line 4971 "sql.c"
break;
case 49: /* cmd ::= DROP DNODE dnode_endpoint force_opt */
-#line 130 "sql.y"
{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy669, yymsp[0].minor.yy777, false); }
-#line 4976 "sql.c"
break;
case 50: /* cmd ::= DROP DNODE NK_INTEGER unsafe_opt */
-#line 131 "sql.y"
{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, false, yymsp[0].minor.yy777); }
-#line 4981 "sql.c"
break;
case 51: /* cmd ::= DROP DNODE dnode_endpoint unsafe_opt */
-#line 132 "sql.y"
{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy669, false, yymsp[0].minor.yy777); }
-#line 4986 "sql.c"
break;
case 52: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING */
-#line 133 "sql.y"
{ pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, NULL); }
-#line 4991 "sql.c"
break;
case 53: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */
-#line 134 "sql.y"
{ pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-2].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); }
-#line 4996 "sql.c"
break;
case 54: /* cmd ::= ALTER ALL DNODES NK_STRING */
-#line 135 "sql.y"
{ pCxt->pRootNode = createAlterDnodeStmt(pCxt, NULL, &yymsp[0].minor.yy0, NULL); }
-#line 5001 "sql.c"
break;
case 55: /* cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */
-#line 136 "sql.y"
{ pCxt->pRootNode = createAlterDnodeStmt(pCxt, NULL, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); }
-#line 5006 "sql.c"
break;
case 56: /* cmd ::= RESTORE DNODE NK_INTEGER */
-#line 137 "sql.y"
{ pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_DNODE_STMT, &yymsp[0].minor.yy0); }
-#line 5011 "sql.c"
break;
case 57: /* dnode_endpoint ::= NK_STRING */
case 58: /* dnode_endpoint ::= NK_ID */ yytestcase(yyruleno==58);
@@ -5041,9 +4645,7 @@ static YYACTIONTYPE yy_reduce(
case 454: /* star_func ::= FIRST */ yytestcase(yyruleno==454);
case 455: /* star_func ::= LAST */ yytestcase(yyruleno==455);
case 456: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==456);
-#line 141 "sql.y"
{ yylhsminor.yy669 = yymsp[0].minor.yy0; }
-#line 5046 "sql.c"
yymsp[0].minor.yy669 = yylhsminor.yy669;
break;
case 60: /* force_opt ::= */
@@ -5054,428 +4656,282 @@ static YYACTIONTYPE yy_reduce(
case 330: /* or_replace_opt ::= */ yytestcase(yyruleno==330);
case 352: /* ignore_opt ::= */ yytestcase(yyruleno==352);
case 517: /* set_quantifier_opt ::= */ yytestcase(yyruleno==517);
-#line 147 "sql.y"
{ yymsp[1].minor.yy777 = false; }
-#line 5059 "sql.c"
break;
case 61: /* force_opt ::= FORCE */
case 62: /* unsafe_opt ::= UNSAFE */ yytestcase(yyruleno==62);
case 318: /* analyze_opt ::= ANALYZE */ yytestcase(yyruleno==318);
case 325: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==325);
case 518: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==518);
-#line 148 "sql.y"
{ yymsp[0].minor.yy777 = true; }
-#line 5068 "sql.c"
break;
case 63: /* cmd ::= ALTER LOCAL NK_STRING */
-#line 155 "sql.y"
{ pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[0].minor.yy0, NULL); }
-#line 5073 "sql.c"
break;
case 64: /* cmd ::= ALTER LOCAL NK_STRING NK_STRING */
-#line 156 "sql.y"
{ pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); }
-#line 5078 "sql.c"
break;
case 65: /* cmd ::= CREATE QNODE ON DNODE NK_INTEGER */
-#line 159 "sql.y"
{ pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_QNODE_STMT, &yymsp[0].minor.yy0); }
-#line 5083 "sql.c"
break;
case 66: /* cmd ::= DROP QNODE ON DNODE NK_INTEGER */
-#line 160 "sql.y"
{ pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_QNODE_STMT, &yymsp[0].minor.yy0); }
-#line 5088 "sql.c"
break;
case 67: /* cmd ::= RESTORE QNODE ON DNODE NK_INTEGER */
-#line 161 "sql.y"
{ pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_QNODE_STMT, &yymsp[0].minor.yy0); }
-#line 5093 "sql.c"
break;
case 68: /* cmd ::= CREATE BNODE ON DNODE NK_INTEGER */
-#line 164 "sql.y"
{ pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_BNODE_STMT, &yymsp[0].minor.yy0); }
-#line 5098 "sql.c"
break;
case 69: /* cmd ::= DROP BNODE ON DNODE NK_INTEGER */
-#line 165 "sql.y"
{ pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_BNODE_STMT, &yymsp[0].minor.yy0); }
-#line 5103 "sql.c"
break;
case 70: /* cmd ::= CREATE SNODE ON DNODE NK_INTEGER */
-#line 168 "sql.y"
{ pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_SNODE_STMT, &yymsp[0].minor.yy0); }
-#line 5108 "sql.c"
break;
case 71: /* cmd ::= DROP SNODE ON DNODE NK_INTEGER */
-#line 169 "sql.y"
{ pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_SNODE_STMT, &yymsp[0].minor.yy0); }
-#line 5113 "sql.c"
break;
case 72: /* cmd ::= CREATE MNODE ON DNODE NK_INTEGER */
-#line 172 "sql.y"
{ pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_MNODE_STMT, &yymsp[0].minor.yy0); }
-#line 5118 "sql.c"
break;
case 73: /* cmd ::= DROP MNODE ON DNODE NK_INTEGER */
-#line 173 "sql.y"
{ pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_MNODE_STMT, &yymsp[0].minor.yy0); }
-#line 5123 "sql.c"
break;
case 74: /* cmd ::= RESTORE MNODE ON DNODE NK_INTEGER */
-#line 174 "sql.y"
{ pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_MNODE_STMT, &yymsp[0].minor.yy0); }
-#line 5128 "sql.c"
break;
case 75: /* cmd ::= RESTORE VNODE ON DNODE NK_INTEGER */
-#line 177 "sql.y"
{ pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_VNODE_STMT, &yymsp[0].minor.yy0); }
-#line 5133 "sql.c"
break;
case 76: /* cmd ::= CREATE DATABASE not_exists_opt db_name db_options */
-#line 180 "sql.y"
{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy777, &yymsp[-1].minor.yy669, yymsp[0].minor.yy242); }
-#line 5138 "sql.c"
break;
case 77: /* cmd ::= DROP DATABASE exists_opt db_name */
-#line 181 "sql.y"
{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy777, &yymsp[0].minor.yy669); }
-#line 5143 "sql.c"
break;
case 78: /* cmd ::= USE db_name */
-#line 182 "sql.y"
{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy669); }
-#line 5148 "sql.c"
break;
case 79: /* cmd ::= ALTER DATABASE db_name alter_db_options */
-#line 183 "sql.y"
{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy669, yymsp[0].minor.yy242); }
-#line 5153 "sql.c"
break;
case 80: /* cmd ::= FLUSH DATABASE db_name */
-#line 184 "sql.y"
{ pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy669); }
-#line 5158 "sql.c"
break;
case 81: /* cmd ::= TRIM DATABASE db_name speed_opt */
-#line 185 "sql.y"
{ pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[-1].minor.yy669, yymsp[0].minor.yy120); }
-#line 5163 "sql.c"
break;
case 82: /* cmd ::= COMPACT DATABASE db_name start_opt end_opt */
-#line 186 "sql.y"
{ pCxt->pRootNode = createCompactStmt(pCxt, &yymsp[-2].minor.yy669, yymsp[-1].minor.yy242, yymsp[0].minor.yy242); }
-#line 5168 "sql.c"
break;
case 83: /* not_exists_opt ::= IF NOT EXISTS */
-#line 190 "sql.y"
{ yymsp[-2].minor.yy777 = true; }
-#line 5173 "sql.c"
break;
case 85: /* exists_opt ::= IF EXISTS */
case 331: /* or_replace_opt ::= OR REPLACE */ yytestcase(yyruleno==331);
case 353: /* ignore_opt ::= IGNORE UNTREATED */ yytestcase(yyruleno==353);
-#line 195 "sql.y"
{ yymsp[-1].minor.yy777 = true; }
-#line 5180 "sql.c"
break;
case 87: /* db_options ::= */
-#line 198 "sql.y"
{ yymsp[1].minor.yy242 = createDefaultDatabaseOptions(pCxt); }
-#line 5185 "sql.c"
break;
case 88: /* db_options ::= db_options BUFFER NK_INTEGER */
-#line 199 "sql.y"
{ yylhsminor.yy242 = setDatabaseOption(pCxt, yymsp[-2].minor.yy242, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); }
-#line 5190 "sql.c"
yymsp[-2].minor.yy242 = yylhsminor.yy242;
break;
case 89: /* db_options ::= db_options CACHEMODEL NK_STRING */
-#line 200 "sql.y"
{ yylhsminor.yy242 = setDatabaseOption(pCxt, yymsp[-2].minor.yy242, DB_OPTION_CACHEMODEL, &yymsp[0].minor.yy0); }
-#line 5196 "sql.c"
yymsp[-2].minor.yy242 = yylhsminor.yy242;
break;
case 90: /* db_options ::= db_options CACHESIZE NK_INTEGER */
-#line 201 "sql.y"
{ yylhsminor.yy242 = setDatabaseOption(pCxt, yymsp[-2].minor.yy242, DB_OPTION_CACHESIZE, &yymsp[0].minor.yy0); }
-#line 5202 "sql.c"
yymsp[-2].minor.yy242 = yylhsminor.yy242;
break;
case 91: /* db_options ::= db_options COMP NK_INTEGER */
-#line 202 "sql.y"
{ yylhsminor.yy242 = setDatabaseOption(pCxt, yymsp[-2].minor.yy242, DB_OPTION_COMP, &yymsp[0].minor.yy0); }
-#line 5208 "sql.c"
yymsp[-2].minor.yy242 = yylhsminor.yy242;
break;
case 92: /* db_options ::= db_options DURATION NK_INTEGER */
case 93: /* db_options ::= db_options DURATION NK_VARIABLE */ yytestcase(yyruleno==93);
-#line 203 "sql.y"
{ yylhsminor.yy242 = setDatabaseOption(pCxt, yymsp[-2].minor.yy242, DB_OPTION_DAYS, &yymsp[0].minor.yy0); }
-#line 5215 "sql.c"
yymsp[-2].minor.yy242 = yylhsminor.yy242;
break;
case 94: /* db_options ::= db_options MAXROWS NK_INTEGER */
-#line 205 "sql.y"
{ yylhsminor.yy242 = setDatabaseOption(pCxt, yymsp[-2].minor.yy242, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); }
-#line 5221 "sql.c"
yymsp[-2].minor.yy242 = yylhsminor.yy242;
break;
case 95: /* db_options ::= db_options MINROWS NK_INTEGER */
-#line 206 "sql.y"
{ yylhsminor.yy242 = setDatabaseOption(pCxt, yymsp[-2].minor.yy242, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); }
-#line 5227 "sql.c"
yymsp[-2].minor.yy242 = yylhsminor.yy242;
break;
case 96: /* db_options ::= db_options KEEP integer_list */
case 97: /* db_options ::= db_options KEEP variable_list */ yytestcase(yyruleno==97);
-#line 207 "sql.y"
{ yylhsminor.yy242 = setDatabaseOption(pCxt, yymsp[-2].minor.yy242, DB_OPTION_KEEP, yymsp[0].minor.yy174); }
-#line 5234 "sql.c"
yymsp[-2].minor.yy242 = yylhsminor.yy242;
break;
case 98: /* db_options ::= db_options PAGES NK_INTEGER */
-#line 209 "sql.y"
{ yylhsminor.yy242 = setDatabaseOption(pCxt, yymsp[-2].minor.yy242, DB_OPTION_PAGES, &yymsp[0].minor.yy0); }
-#line 5240 "sql.c"
yymsp[-2].minor.yy242 = yylhsminor.yy242;
break;
case 99: /* db_options ::= db_options PAGESIZE NK_INTEGER */
-#line 210 "sql.y"
{ yylhsminor.yy242 = setDatabaseOption(pCxt, yymsp[-2].minor.yy242, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); }
-#line 5246 "sql.c"
yymsp[-2].minor.yy242 = yylhsminor.yy242;
break;
case 100: /* db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */
-#line 211 "sql.y"
{ yylhsminor.yy242 = setDatabaseOption(pCxt, yymsp[-2].minor.yy242, DB_OPTION_TSDB_PAGESIZE, &yymsp[0].minor.yy0); }
-#line 5252 "sql.c"
yymsp[-2].minor.yy242 = yylhsminor.yy242;
break;
case 101: /* db_options ::= db_options PRECISION NK_STRING */
-#line 212 "sql.y"
{ yylhsminor.yy242 = setDatabaseOption(pCxt, yymsp[-2].minor.yy242, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); }
-#line 5258 "sql.c"
yymsp[-2].minor.yy242 = yylhsminor.yy242;
break;
case 102: /* db_options ::= db_options REPLICA NK_INTEGER */
-#line 213 "sql.y"
{ yylhsminor.yy242 = setDatabaseOption(pCxt, yymsp[-2].minor.yy242, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); }
-#line 5264 "sql.c"
yymsp[-2].minor.yy242 = yylhsminor.yy242;
break;
case 103: /* db_options ::= db_options VGROUPS NK_INTEGER */
-#line 215 "sql.y"
{ yylhsminor.yy242 = setDatabaseOption(pCxt, yymsp[-2].minor.yy242, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); }
-#line 5270 "sql.c"
yymsp[-2].minor.yy242 = yylhsminor.yy242;
break;
case 104: /* db_options ::= db_options SINGLE_STABLE NK_INTEGER */
-#line 216 "sql.y"
{ yylhsminor.yy242 = setDatabaseOption(pCxt, yymsp[-2].minor.yy242, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); }
-#line 5276 "sql.c"
yymsp[-2].minor.yy242 = yylhsminor.yy242;
break;
case 105: /* db_options ::= db_options RETENTIONS retention_list */
-#line 217 "sql.y"
{ yylhsminor.yy242 = setDatabaseOption(pCxt, yymsp[-2].minor.yy242, DB_OPTION_RETENTIONS, yymsp[0].minor.yy174); }
-#line 5282 "sql.c"
yymsp[-2].minor.yy242 = yylhsminor.yy242;
break;
case 106: /* db_options ::= db_options SCHEMALESS NK_INTEGER */
-#line 218 "sql.y"
{ yylhsminor.yy242 = setDatabaseOption(pCxt, yymsp[-2].minor.yy242, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); }
-#line 5288 "sql.c"
yymsp[-2].minor.yy242 = yylhsminor.yy242;
break;
case 107: /* db_options ::= db_options WAL_LEVEL NK_INTEGER */
-#line 219 "sql.y"
{ yylhsminor.yy242 = setDatabaseOption(pCxt, yymsp[-2].minor.yy242, DB_OPTION_WAL, &yymsp[0].minor.yy0); }
-#line 5294 "sql.c"
yymsp[-2].minor.yy242 = yylhsminor.yy242;
break;
case 108: /* db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */
-#line 220 "sql.y"
{ yylhsminor.yy242 = setDatabaseOption(pCxt, yymsp[-2].minor.yy242, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); }
-#line 5300 "sql.c"
yymsp[-2].minor.yy242 = yylhsminor.yy242;
break;
case 109: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */
-#line 221 "sql.y"
{ yylhsminor.yy242 = setDatabaseOption(pCxt, yymsp[-2].minor.yy242, DB_OPTION_WAL_RETENTION_PERIOD, &yymsp[0].minor.yy0); }
-#line 5306 "sql.c"
yymsp[-2].minor.yy242 = yylhsminor.yy242;
break;
case 110: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */
-#line 222 "sql.y"
{
SToken t = yymsp[-1].minor.yy0;
t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z;
yylhsminor.yy242 = setDatabaseOption(pCxt, yymsp[-3].minor.yy242, DB_OPTION_WAL_RETENTION_PERIOD, &t);
}
-#line 5316 "sql.c"
yymsp[-3].minor.yy242 = yylhsminor.yy242;
break;
case 111: /* db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */
-#line 227 "sql.y"
{ yylhsminor.yy242 = setDatabaseOption(pCxt, yymsp[-2].minor.yy242, DB_OPTION_WAL_RETENTION_SIZE, &yymsp[0].minor.yy0); }
-#line 5322 "sql.c"
yymsp[-2].minor.yy242 = yylhsminor.yy242;
break;
case 112: /* db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */
-#line 228 "sql.y"
{
SToken t = yymsp[-1].minor.yy0;
t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z;
yylhsminor.yy242 = setDatabaseOption(pCxt, yymsp[-3].minor.yy242, DB_OPTION_WAL_RETENTION_SIZE, &t);
}
-#line 5332 "sql.c"
yymsp[-3].minor.yy242 = yylhsminor.yy242;
break;
case 113: /* db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */
-#line 233 "sql.y"
{ yylhsminor.yy242 = setDatabaseOption(pCxt, yymsp[-2].minor.yy242, DB_OPTION_WAL_ROLL_PERIOD, &yymsp[0].minor.yy0); }
-#line 5338 "sql.c"
yymsp[-2].minor.yy242 = yylhsminor.yy242;
break;
case 114: /* db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */
-#line 234 "sql.y"
{ yylhsminor.yy242 = setDatabaseOption(pCxt, yymsp[-2].minor.yy242, DB_OPTION_WAL_SEGMENT_SIZE, &yymsp[0].minor.yy0); }
-#line 5344 "sql.c"
yymsp[-2].minor.yy242 = yylhsminor.yy242;
break;
case 115: /* db_options ::= db_options STT_TRIGGER NK_INTEGER */
-#line 235 "sql.y"
{ yylhsminor.yy242 = setDatabaseOption(pCxt, yymsp[-2].minor.yy242, DB_OPTION_STT_TRIGGER, &yymsp[0].minor.yy0); }
-#line 5350 "sql.c"
yymsp[-2].minor.yy242 = yylhsminor.yy242;
break;
case 116: /* db_options ::= db_options TABLE_PREFIX signed */
-#line 236 "sql.y"
{ yylhsminor.yy242 = setDatabaseOption(pCxt, yymsp[-2].minor.yy242, DB_OPTION_TABLE_PREFIX, yymsp[0].minor.yy242); }
-#line 5356 "sql.c"
yymsp[-2].minor.yy242 = yylhsminor.yy242;
break;
case 117: /* db_options ::= db_options TABLE_SUFFIX signed */
-#line 237 "sql.y"
{ yylhsminor.yy242 = setDatabaseOption(pCxt, yymsp[-2].minor.yy242, DB_OPTION_TABLE_SUFFIX, yymsp[0].minor.yy242); }
-#line 5362 "sql.c"
yymsp[-2].minor.yy242 = yylhsminor.yy242;
break;
case 118: /* alter_db_options ::= alter_db_option */
-#line 239 "sql.y"
{ yylhsminor.yy242 = createAlterDatabaseOptions(pCxt); yylhsminor.yy242 = setAlterDatabaseOption(pCxt, yylhsminor.yy242, &yymsp[0].minor.yy535); }
-#line 5368 "sql.c"
yymsp[0].minor.yy242 = yylhsminor.yy242;
break;
case 119: /* alter_db_options ::= alter_db_options alter_db_option */
-#line 240 "sql.y"
{ yylhsminor.yy242 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy242, &yymsp[0].minor.yy535); }
-#line 5374 "sql.c"
yymsp[-1].minor.yy242 = yylhsminor.yy242;
break;
case 120: /* alter_db_option ::= BUFFER NK_INTEGER */
-#line 244 "sql.y"
{ yymsp[-1].minor.yy535.type = DB_OPTION_BUFFER; yymsp[-1].minor.yy535.val = yymsp[0].minor.yy0; }
-#line 5380 "sql.c"
break;
case 121: /* alter_db_option ::= CACHEMODEL NK_STRING */
-#line 245 "sql.y"
{ yymsp[-1].minor.yy535.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy535.val = yymsp[0].minor.yy0; }
-#line 5385 "sql.c"
break;
case 122: /* alter_db_option ::= CACHESIZE NK_INTEGER */
-#line 246 "sql.y"
{ yymsp[-1].minor.yy535.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy535.val = yymsp[0].minor.yy0; }
-#line 5390 "sql.c"
break;
case 123: /* alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */
-#line 247 "sql.y"
{ yymsp[-1].minor.yy535.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy535.val = yymsp[0].minor.yy0; }
-#line 5395 "sql.c"
break;
case 124: /* alter_db_option ::= KEEP integer_list */
case 125: /* alter_db_option ::= KEEP variable_list */ yytestcase(yyruleno==125);
-#line 248 "sql.y"
{ yymsp[-1].minor.yy535.type = DB_OPTION_KEEP; yymsp[-1].minor.yy535.pList = yymsp[0].minor.yy174; }
-#line 5401 "sql.c"
break;
case 126: /* alter_db_option ::= PAGES NK_INTEGER */
-#line 250 "sql.y"
{ yymsp[-1].minor.yy535.type = DB_OPTION_PAGES; yymsp[-1].minor.yy535.val = yymsp[0].minor.yy0; }
-#line 5406 "sql.c"
break;
case 127: /* alter_db_option ::= REPLICA NK_INTEGER */
-#line 251 "sql.y"
{ yymsp[-1].minor.yy535.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy535.val = yymsp[0].minor.yy0; }
-#line 5411 "sql.c"
break;
case 128: /* alter_db_option ::= WAL_LEVEL NK_INTEGER */
-#line 253 "sql.y"
{ yymsp[-1].minor.yy535.type = DB_OPTION_WAL; yymsp[-1].minor.yy535.val = yymsp[0].minor.yy0; }
-#line 5416 "sql.c"
break;
case 129: /* alter_db_option ::= STT_TRIGGER NK_INTEGER */
-#line 254 "sql.y"
{ yymsp[-1].minor.yy535.type = DB_OPTION_STT_TRIGGER; yymsp[-1].minor.yy535.val = yymsp[0].minor.yy0; }
-#line 5421 "sql.c"
break;
case 130: /* alter_db_option ::= MINROWS NK_INTEGER */
-#line 255 "sql.y"
{ yymsp[-1].minor.yy535.type = DB_OPTION_MINROWS; yymsp[-1].minor.yy535.val = yymsp[0].minor.yy0; }
-#line 5426 "sql.c"
break;
case 131: /* alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER */
-#line 256 "sql.y"
{ yymsp[-1].minor.yy535.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-1].minor.yy535.val = yymsp[0].minor.yy0; }
-#line 5431 "sql.c"
break;
case 132: /* alter_db_option ::= WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */
-#line 257 "sql.y"
{
SToken t = yymsp[-1].minor.yy0;
t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z;
yymsp[-2].minor.yy535.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-2].minor.yy535.val = t;
}
-#line 5440 "sql.c"
break;
case 133: /* alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER */
-#line 262 "sql.y"
{ yymsp[-1].minor.yy535.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-1].minor.yy535.val = yymsp[0].minor.yy0; }
-#line 5445 "sql.c"
break;
case 134: /* alter_db_option ::= WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */
-#line 263 "sql.y"
{
SToken t = yymsp[-1].minor.yy0;
t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z;
yymsp[-2].minor.yy535.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-2].minor.yy535.val = t;
}
-#line 5454 "sql.c"
break;
case 135: /* integer_list ::= NK_INTEGER */
-#line 271 "sql.y"
{ yylhsminor.yy174 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
-#line 5459 "sql.c"
yymsp[0].minor.yy174 = yylhsminor.yy174;
break;
case 136: /* integer_list ::= integer_list NK_COMMA NK_INTEGER */
case 363: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==363);
-#line 272 "sql.y"
{ yylhsminor.yy174 = addNodeToList(pCxt, yymsp[-2].minor.yy174, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
-#line 5466 "sql.c"
yymsp[-2].minor.yy174 = yylhsminor.yy174;
break;
case 137: /* variable_list ::= NK_VARIABLE */
-#line 276 "sql.y"
{ yylhsminor.yy174 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
-#line 5472 "sql.c"
yymsp[0].minor.yy174 = yylhsminor.yy174;
break;
case 138: /* variable_list ::= variable_list NK_COMMA NK_VARIABLE */
-#line 277 "sql.y"
{ yylhsminor.yy174 = addNodeToList(pCxt, yymsp[-2].minor.yy174, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
-#line 5478 "sql.c"
yymsp[-2].minor.yy174 = yylhsminor.yy174;
break;
case 139: /* retention_list ::= retention */
@@ -5491,10 +4947,8 @@ static YYACTIONTYPE yy_reduce(
case 465: /* when_then_list ::= when_then_expr */ yytestcase(yyruleno==465);
case 520: /* select_list ::= select_item */ yytestcase(yyruleno==520);
case 531: /* partition_list ::= partition_item */ yytestcase(yyruleno==531);
- case 586: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==586);
-#line 281 "sql.y"
+ case 587: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==587);
{ yylhsminor.yy174 = createNodeList(pCxt, yymsp[0].minor.yy242); }
-#line 5497 "sql.c"
yymsp[0].minor.yy174 = yylhsminor.yy174;
break;
case 140: /* retention_list ::= retention_list NK_COMMA retention */
@@ -5508,158 +4962,106 @@ static YYACTIONTYPE yy_reduce(
case 460: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==460);
case 521: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==521);
case 532: /* partition_list ::= partition_list NK_COMMA partition_item */ yytestcase(yyruleno==532);
- case 587: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==587);
-#line 282 "sql.y"
+ case 588: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==588);
{ yylhsminor.yy174 = addNodeToList(pCxt, yymsp[-2].minor.yy174, yymsp[0].minor.yy242); }
-#line 5514 "sql.c"
yymsp[-2].minor.yy174 = yylhsminor.yy174;
break;
case 141: /* retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */
-#line 284 "sql.y"
{ yylhsminor.yy242 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
-#line 5520 "sql.c"
yymsp[-2].minor.yy242 = yylhsminor.yy242;
break;
case 142: /* speed_opt ::= */
case 326: /* bufsize_opt ::= */ yytestcase(yyruleno==326);
-#line 288 "sql.y"
{ yymsp[1].minor.yy120 = 0; }
-#line 5527 "sql.c"
break;
case 143: /* speed_opt ::= MAX_SPEED NK_INTEGER */
case 327: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ yytestcase(yyruleno==327);
-#line 289 "sql.y"
{ yymsp[-1].minor.yy120 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); }
-#line 5533 "sql.c"
break;
case 145: /* start_opt ::= START WITH NK_INTEGER */
case 149: /* end_opt ::= END WITH NK_INTEGER */ yytestcase(yyruleno==149);
-#line 292 "sql.y"
{ yymsp[-2].minor.yy242 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); }
-#line 5539 "sql.c"
break;
case 146: /* start_opt ::= START WITH NK_STRING */
case 150: /* end_opt ::= END WITH NK_STRING */ yytestcase(yyruleno==150);
-#line 293 "sql.y"
{ yymsp[-2].minor.yy242 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); }
-#line 5545 "sql.c"
break;
case 147: /* start_opt ::= START WITH TIMESTAMP NK_STRING */
case 151: /* end_opt ::= END WITH TIMESTAMP NK_STRING */ yytestcase(yyruleno==151);
-#line 294 "sql.y"
{ yymsp[-3].minor.yy242 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); }
-#line 5551 "sql.c"
break;
case 152: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */
case 154: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==154);
-#line 303 "sql.y"
{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy777, yymsp[-5].minor.yy242, yymsp[-3].minor.yy174, yymsp[-1].minor.yy174, yymsp[0].minor.yy242); }
-#line 5557 "sql.c"
break;
case 153: /* cmd ::= CREATE TABLE multi_create_clause */
-#line 304 "sql.y"
{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy174); }
-#line 5562 "sql.c"
break;
case 155: /* cmd ::= DROP TABLE multi_drop_clause */
-#line 307 "sql.y"
{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy174); }
-#line 5567 "sql.c"
break;
case 156: /* cmd ::= DROP STABLE exists_opt full_table_name */
-#line 308 "sql.y"
{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy777, yymsp[0].minor.yy242); }
-#line 5572 "sql.c"
break;
case 157: /* cmd ::= ALTER TABLE alter_table_clause */
case 365: /* cmd ::= query_or_subquery */ yytestcase(yyruleno==365);
case 366: /* cmd ::= insert_query */ yytestcase(yyruleno==366);
-#line 310 "sql.y"
{ pCxt->pRootNode = yymsp[0].minor.yy242; }
-#line 5579 "sql.c"
break;
case 158: /* cmd ::= ALTER STABLE alter_table_clause */
-#line 311 "sql.y"
{ pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy242); }
-#line 5584 "sql.c"
break;
case 159: /* alter_table_clause ::= full_table_name alter_table_options */
-#line 313 "sql.y"
{ yylhsminor.yy242 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy242, yymsp[0].minor.yy242); }
-#line 5589 "sql.c"
yymsp[-1].minor.yy242 = yylhsminor.yy242;
break;
case 160: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */
-#line 315 "sql.y"
{ yylhsminor.yy242 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy242, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy669, yymsp[0].minor.yy794); }
-#line 5595 "sql.c"
yymsp[-4].minor.yy242 = yylhsminor.yy242;
break;
case 161: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */
-#line 316 "sql.y"
{ yylhsminor.yy242 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy242, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy669); }
-#line 5601 "sql.c"
yymsp[-3].minor.yy242 = yylhsminor.yy242;
break;
case 162: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */
-#line 318 "sql.y"
{ yylhsminor.yy242 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy242, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy669, yymsp[0].minor.yy794); }
-#line 5607 "sql.c"
yymsp[-4].minor.yy242 = yylhsminor.yy242;
break;
case 163: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */
-#line 320 "sql.y"
{ yylhsminor.yy242 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy242, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy669, &yymsp[0].minor.yy669); }
-#line 5613 "sql.c"
yymsp[-4].minor.yy242 = yylhsminor.yy242;
break;
case 164: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */
-#line 322 "sql.y"
{ yylhsminor.yy242 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy242, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy669, yymsp[0].minor.yy794); }
-#line 5619 "sql.c"
yymsp[-4].minor.yy242 = yylhsminor.yy242;
break;
case 165: /* alter_table_clause ::= full_table_name DROP TAG column_name */
-#line 323 "sql.y"
{ yylhsminor.yy242 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy242, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy669); }
-#line 5625 "sql.c"
yymsp[-3].minor.yy242 = yylhsminor.yy242;
break;
case 166: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */
-#line 325 "sql.y"
{ yylhsminor.yy242 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy242, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy669, yymsp[0].minor.yy794); }
-#line 5631 "sql.c"
yymsp[-4].minor.yy242 = yylhsminor.yy242;
break;
case 167: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */
-#line 327 "sql.y"
{ yylhsminor.yy242 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy242, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy669, &yymsp[0].minor.yy669); }
-#line 5637 "sql.c"
yymsp[-4].minor.yy242 = yylhsminor.yy242;
break;
case 168: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */
-#line 329 "sql.y"
{ yylhsminor.yy242 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy242, &yymsp[-2].minor.yy669, yymsp[0].minor.yy242); }
-#line 5643 "sql.c"
yymsp[-5].minor.yy242 = yylhsminor.yy242;
break;
case 170: /* multi_create_clause ::= multi_create_clause create_subtable_clause */
case 466: /* when_then_list ::= when_then_list when_then_expr */ yytestcase(yyruleno==466);
-#line 334 "sql.y"
{ yylhsminor.yy174 = addNodeToList(pCxt, yymsp[-1].minor.yy174, yymsp[0].minor.yy242); }
-#line 5650 "sql.c"
yymsp[-1].minor.yy174 = yylhsminor.yy174;
break;
case 171: /* create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP expression_list NK_RP table_options */
-#line 338 "sql.y"
{ yylhsminor.yy242 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy777, yymsp[-8].minor.yy242, yymsp[-6].minor.yy242, yymsp[-5].minor.yy174, yymsp[-2].minor.yy174, yymsp[0].minor.yy242); }
-#line 5656 "sql.c"
yymsp[-9].minor.yy242 = yylhsminor.yy242;
break;
case 174: /* drop_table_clause ::= exists_opt full_table_name */
-#line 345 "sql.y"
{ yylhsminor.yy242 = createDropTableClause(pCxt, yymsp[-1].minor.yy777, yymsp[0].minor.yy242); }
-#line 5662 "sql.c"
yymsp[-1].minor.yy242 = yylhsminor.yy242;
break;
case 175: /* specific_cols_opt ::= */
@@ -5669,828 +5071,524 @@ static YYACTIONTYPE yy_reduce(
case 338: /* tag_def_or_ref_opt ::= */ yytestcase(yyruleno==338);
case 529: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==529);
case 554: /* group_by_clause_opt ::= */ yytestcase(yyruleno==554);
- case 573: /* order_by_clause_opt ::= */ yytestcase(yyruleno==573);
-#line 349 "sql.y"
+ case 574: /* order_by_clause_opt ::= */ yytestcase(yyruleno==574);
{ yymsp[1].minor.yy174 = NULL; }
-#line 5675 "sql.c"
break;
case 176: /* specific_cols_opt ::= NK_LP col_name_list NK_RP */
case 337: /* col_list_opt ::= NK_LP col_name_list NK_RP */ yytestcase(yyruleno==337);
-#line 350 "sql.y"
{ yymsp[-2].minor.yy174 = yymsp[-1].minor.yy174; }
-#line 5681 "sql.c"
break;
case 177: /* full_table_name ::= table_name */
-#line 352 "sql.y"
{ yylhsminor.yy242 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy669, NULL); }
-#line 5686 "sql.c"
yymsp[0].minor.yy242 = yylhsminor.yy242;
break;
case 178: /* full_table_name ::= db_name NK_DOT table_name */
-#line 353 "sql.y"
{ yylhsminor.yy242 = createRealTableNode(pCxt, &yymsp[-2].minor.yy669, &yymsp[0].minor.yy669, NULL); }
-#line 5692 "sql.c"
yymsp[-2].minor.yy242 = yylhsminor.yy242;
break;
case 181: /* column_def ::= column_name type_name */
-#line 360 "sql.y"
{ yylhsminor.yy242 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy669, yymsp[0].minor.yy794, NULL); }
-#line 5698 "sql.c"
yymsp[-1].minor.yy242 = yylhsminor.yy242;
break;
case 182: /* type_name ::= BOOL */
-#line 365 "sql.y"
{ yymsp[0].minor.yy794 = createDataType(TSDB_DATA_TYPE_BOOL); }
-#line 5704 "sql.c"
break;
case 183: /* type_name ::= TINYINT */
-#line 366 "sql.y"
{ yymsp[0].minor.yy794 = createDataType(TSDB_DATA_TYPE_TINYINT); }
-#line 5709 "sql.c"
break;
case 184: /* type_name ::= SMALLINT */
-#line 367 "sql.y"
{ yymsp[0].minor.yy794 = createDataType(TSDB_DATA_TYPE_SMALLINT); }
-#line 5714 "sql.c"
break;
case 185: /* type_name ::= INT */
case 186: /* type_name ::= INTEGER */ yytestcase(yyruleno==186);
-#line 368 "sql.y"
{ yymsp[0].minor.yy794 = createDataType(TSDB_DATA_TYPE_INT); }
-#line 5720 "sql.c"
break;
case 187: /* type_name ::= BIGINT */
-#line 370 "sql.y"
{ yymsp[0].minor.yy794 = createDataType(TSDB_DATA_TYPE_BIGINT); }
-#line 5725 "sql.c"
break;
case 188: /* type_name ::= FLOAT */
-#line 371 "sql.y"
{ yymsp[0].minor.yy794 = createDataType(TSDB_DATA_TYPE_FLOAT); }
-#line 5730 "sql.c"
break;
case 189: /* type_name ::= DOUBLE */
-#line 372 "sql.y"
{ yymsp[0].minor.yy794 = createDataType(TSDB_DATA_TYPE_DOUBLE); }
-#line 5735 "sql.c"
break;
case 190: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */
-#line 373 "sql.y"
{ yymsp[-3].minor.yy794 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); }
-#line 5740 "sql.c"
break;
case 191: /* type_name ::= TIMESTAMP */
-#line 374 "sql.y"
{ yymsp[0].minor.yy794 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); }
-#line 5745 "sql.c"
break;
case 192: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */
-#line 375 "sql.y"
{ yymsp[-3].minor.yy794 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); }
-#line 5750 "sql.c"
break;
case 193: /* type_name ::= TINYINT UNSIGNED */
-#line 376 "sql.y"
{ yymsp[-1].minor.yy794 = createDataType(TSDB_DATA_TYPE_UTINYINT); }
-#line 5755 "sql.c"
break;
case 194: /* type_name ::= SMALLINT UNSIGNED */
-#line 377 "sql.y"
{ yymsp[-1].minor.yy794 = createDataType(TSDB_DATA_TYPE_USMALLINT); }
-#line 5760 "sql.c"
break;
case 195: /* type_name ::= INT UNSIGNED */
-#line 378 "sql.y"
{ yymsp[-1].minor.yy794 = createDataType(TSDB_DATA_TYPE_UINT); }
-#line 5765 "sql.c"
break;
case 196: /* type_name ::= BIGINT UNSIGNED */
-#line 379 "sql.y"
{ yymsp[-1].minor.yy794 = createDataType(TSDB_DATA_TYPE_UBIGINT); }
-#line 5770 "sql.c"
break;
case 197: /* type_name ::= JSON */
-#line 380 "sql.y"
{ yymsp[0].minor.yy794 = createDataType(TSDB_DATA_TYPE_JSON); }
-#line 5775 "sql.c"
break;
case 198: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */
-#line 381 "sql.y"
{ yymsp[-3].minor.yy794 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); }
-#line 5780 "sql.c"
break;
case 199: /* type_name ::= MEDIUMBLOB */
-#line 382 "sql.y"
{ yymsp[0].minor.yy794 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); }
-#line 5785 "sql.c"
break;
case 200: /* type_name ::= BLOB */
-#line 383 "sql.y"
{ yymsp[0].minor.yy794 = createDataType(TSDB_DATA_TYPE_BLOB); }
-#line 5790 "sql.c"
break;
case 201: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */
-#line 384 "sql.y"
{ yymsp[-3].minor.yy794 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); }
-#line 5795 "sql.c"
break;
case 202: /* type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */
-#line 385 "sql.y"
{ yymsp[-3].minor.yy794 = createVarLenDataType(TSDB_DATA_TYPE_GEOMETRY, &yymsp[-1].minor.yy0); }
-#line 5800 "sql.c"
break;
case 203: /* type_name ::= DECIMAL */
-#line 386 "sql.y"
{ yymsp[0].minor.yy794 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
-#line 5805 "sql.c"
break;
case 204: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */
-#line 387 "sql.y"
{ yymsp[-3].minor.yy794 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
-#line 5810 "sql.c"
break;
case 205: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */
-#line 388 "sql.y"
{ yymsp[-5].minor.yy794 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
-#line 5815 "sql.c"
break;
case 207: /* tags_def_opt ::= tags_def */
case 339: /* tag_def_or_ref_opt ::= tags_def */ yytestcase(yyruleno==339);
case 458: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==458);
-#line 393 "sql.y"
{ yylhsminor.yy174 = yymsp[0].minor.yy174; }
-#line 5822 "sql.c"
yymsp[0].minor.yy174 = yylhsminor.yy174;
break;
case 208: /* tags_def ::= TAGS NK_LP column_def_list NK_RP */
case 340: /* tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */ yytestcase(yyruleno==340);
-#line 397 "sql.y"
{ yymsp[-3].minor.yy174 = yymsp[-1].minor.yy174; }
-#line 5829 "sql.c"
break;
case 209: /* table_options ::= */
-#line 399 "sql.y"
{ yymsp[1].minor.yy242 = createDefaultTableOptions(pCxt); }
-#line 5834 "sql.c"
break;
case 210: /* table_options ::= table_options COMMENT NK_STRING */
-#line 400 "sql.y"
{ yylhsminor.yy242 = setTableOption(pCxt, yymsp[-2].minor.yy242, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); }
-#line 5839 "sql.c"
yymsp[-2].minor.yy242 = yylhsminor.yy242;
break;
case 211: /* table_options ::= table_options MAX_DELAY duration_list */
-#line 401 "sql.y"
{ yylhsminor.yy242 = setTableOption(pCxt, yymsp[-2].minor.yy242, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy174); }
-#line 5845 "sql.c"
yymsp[-2].minor.yy242 = yylhsminor.yy242;
break;
case 212: /* table_options ::= table_options WATERMARK duration_list */
-#line 402 "sql.y"
{ yylhsminor.yy242 = setTableOption(pCxt, yymsp[-2].minor.yy242, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy174); }
-#line 5851 "sql.c"
yymsp[-2].minor.yy242 = yylhsminor.yy242;
break;
case 213: /* table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */
-#line 403 "sql.y"
{ yylhsminor.yy242 = setTableOption(pCxt, yymsp[-4].minor.yy242, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy174); }
-#line 5857 "sql.c"
yymsp[-4].minor.yy242 = yylhsminor.yy242;
break;
case 214: /* table_options ::= table_options TTL NK_INTEGER */
-#line 404 "sql.y"
{ yylhsminor.yy242 = setTableOption(pCxt, yymsp[-2].minor.yy242, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); }
-#line 5863 "sql.c"
yymsp[-2].minor.yy242 = yylhsminor.yy242;
break;
case 215: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */
-#line 405 "sql.y"
{ yylhsminor.yy242 = setTableOption(pCxt, yymsp[-4].minor.yy242, TABLE_OPTION_SMA, yymsp[-1].minor.yy174); }
-#line 5869 "sql.c"
yymsp[-4].minor.yy242 = yylhsminor.yy242;
break;
case 216: /* table_options ::= table_options DELETE_MARK duration_list */
-#line 406 "sql.y"
{ yylhsminor.yy242 = setTableOption(pCxt, yymsp[-2].minor.yy242, TABLE_OPTION_DELETE_MARK, yymsp[0].minor.yy174); }
-#line 5875 "sql.c"
yymsp[-2].minor.yy242 = yylhsminor.yy242;
break;
case 217: /* alter_table_options ::= alter_table_option */
-#line 408 "sql.y"
{ yylhsminor.yy242 = createAlterTableOptions(pCxt); yylhsminor.yy242 = setTableOption(pCxt, yylhsminor.yy242, yymsp[0].minor.yy535.type, &yymsp[0].minor.yy535.val); }
-#line 5881 "sql.c"
yymsp[0].minor.yy242 = yylhsminor.yy242;
break;
case 218: /* alter_table_options ::= alter_table_options alter_table_option */
-#line 409 "sql.y"
{ yylhsminor.yy242 = setTableOption(pCxt, yymsp[-1].minor.yy242, yymsp[0].minor.yy535.type, &yymsp[0].minor.yy535.val); }
-#line 5887 "sql.c"
yymsp[-1].minor.yy242 = yylhsminor.yy242;
break;
case 219: /* alter_table_option ::= COMMENT NK_STRING */
-#line 413 "sql.y"
{ yymsp[-1].minor.yy535.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy535.val = yymsp[0].minor.yy0; }
-#line 5893 "sql.c"
break;
case 220: /* alter_table_option ::= TTL NK_INTEGER */
-#line 414 "sql.y"
{ yymsp[-1].minor.yy535.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy535.val = yymsp[0].minor.yy0; }
-#line 5898 "sql.c"
break;
case 221: /* duration_list ::= duration_literal */
case 422: /* expression_list ::= expr_or_subquery */ yytestcase(yyruleno==422);
-#line 418 "sql.y"
{ yylhsminor.yy174 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy242)); }
-#line 5904 "sql.c"
yymsp[0].minor.yy174 = yylhsminor.yy174;
break;
case 222: /* duration_list ::= duration_list NK_COMMA duration_literal */
case 423: /* expression_list ::= expression_list NK_COMMA expr_or_subquery */ yytestcase(yyruleno==423);
-#line 419 "sql.y"
{ yylhsminor.yy174 = addNodeToList(pCxt, yymsp[-2].minor.yy174, releaseRawExprNode(pCxt, yymsp[0].minor.yy242)); }
-#line 5911 "sql.c"
yymsp[-2].minor.yy174 = yylhsminor.yy174;
break;
case 225: /* rollup_func_name ::= function_name */
-#line 426 "sql.y"
{ yylhsminor.yy242 = createFunctionNode(pCxt, &yymsp[0].minor.yy669, NULL); }
-#line 5917 "sql.c"
yymsp[0].minor.yy242 = yylhsminor.yy242;
break;
case 226: /* rollup_func_name ::= FIRST */
case 227: /* rollup_func_name ::= LAST */ yytestcase(yyruleno==227);
case 282: /* tag_item ::= QTAGS */ yytestcase(yyruleno==282);
-#line 427 "sql.y"
{ yylhsminor.yy242 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); }
-#line 5925 "sql.c"
yymsp[0].minor.yy242 = yylhsminor.yy242;
break;
case 230: /* col_name ::= column_name */
case 283: /* tag_item ::= column_name */ yytestcase(yyruleno==283);
-#line 435 "sql.y"
{ yylhsminor.yy242 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy669); }
-#line 5932 "sql.c"
yymsp[0].minor.yy242 = yylhsminor.yy242;
break;
case 231: /* cmd ::= SHOW DNODES */
-#line 438 "sql.y"
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DNODES_STMT); }
-#line 5938 "sql.c"
break;
case 232: /* cmd ::= SHOW USERS */
-#line 439 "sql.y"
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USERS_STMT); }
-#line 5943 "sql.c"
break;
case 233: /* cmd ::= SHOW USER PRIVILEGES */
-#line 440 "sql.y"
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USER_PRIVILEGES_STMT); }
-#line 5948 "sql.c"
break;
case 234: /* cmd ::= SHOW DATABASES */
-#line 441 "sql.y"
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT); }
-#line 5953 "sql.c"
break;
case 235: /* cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */
-#line 442 "sql.y"
{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TABLES_STMT, yymsp[-2].minor.yy242, yymsp[0].minor.yy242, OP_TYPE_LIKE); }
-#line 5958 "sql.c"
break;
case 236: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */
-#line 443 "sql.y"
{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy242, yymsp[0].minor.yy242, OP_TYPE_LIKE); }
-#line 5963 "sql.c"
break;
case 237: /* cmd ::= SHOW db_name_cond_opt VGROUPS */
-#line 444 "sql.y"
{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy242, NULL, OP_TYPE_LIKE); }
-#line 5968 "sql.c"
break;
case 238: /* cmd ::= SHOW MNODES */
-#line 445 "sql.y"
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MNODES_STMT); }
-#line 5973 "sql.c"
break;
case 239: /* cmd ::= SHOW QNODES */
-#line 447 "sql.y"
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QNODES_STMT); }
-#line 5978 "sql.c"
break;
case 240: /* cmd ::= SHOW FUNCTIONS */
-#line 448 "sql.y"
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_FUNCTIONS_STMT); }
-#line 5983 "sql.c"
break;
case 241: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */
-#line 449 "sql.y"
{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy242, yymsp[-1].minor.yy242, OP_TYPE_EQUAL); }
-#line 5988 "sql.c"
break;
case 242: /* cmd ::= SHOW STREAMS */
-#line 450 "sql.y"
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STREAMS_STMT); }
-#line 5993 "sql.c"
break;
case 243: /* cmd ::= SHOW ACCOUNTS */
-#line 451 "sql.y"
{ pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); }
-#line 5998 "sql.c"
break;
case 244: /* cmd ::= SHOW APPS */
-#line 452 "sql.y"
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_APPS_STMT); }
-#line 6003 "sql.c"
break;
case 245: /* cmd ::= SHOW CONNECTIONS */
-#line 453 "sql.y"
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONNECTIONS_STMT); }
-#line 6008 "sql.c"
break;
case 246: /* cmd ::= SHOW LICENCES */
case 247: /* cmd ::= SHOW GRANTS */ yytestcase(yyruleno==247);
-#line 454 "sql.y"
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LICENCES_STMT); }
-#line 6014 "sql.c"
break;
case 248: /* cmd ::= SHOW CREATE DATABASE db_name */
-#line 456 "sql.y"
{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy669); }
-#line 6019 "sql.c"
break;
case 249: /* cmd ::= SHOW CREATE TABLE full_table_name */
-#line 457 "sql.y"
{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy242); }
-#line 6024 "sql.c"
break;
case 250: /* cmd ::= SHOW CREATE STABLE full_table_name */
-#line 458 "sql.y"
{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy242); }
-#line 6029 "sql.c"
break;
case 251: /* cmd ::= SHOW QUERIES */
-#line 459 "sql.y"
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QUERIES_STMT); }
-#line 6034 "sql.c"
break;
case 252: /* cmd ::= SHOW SCORES */
-#line 460 "sql.y"
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SCORES_STMT); }
-#line 6039 "sql.c"
break;
case 253: /* cmd ::= SHOW TOPICS */
-#line 461 "sql.y"
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TOPICS_STMT); }
-#line 6044 "sql.c"
break;
case 254: /* cmd ::= SHOW VARIABLES */
case 255: /* cmd ::= SHOW CLUSTER VARIABLES */ yytestcase(yyruleno==255);
-#line 462 "sql.y"
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VARIABLES_STMT); }
-#line 6050 "sql.c"
break;
case 256: /* cmd ::= SHOW LOCAL VARIABLES */
-#line 464 "sql.y"
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LOCAL_VARIABLES_STMT); }
-#line 6055 "sql.c"
break;
case 257: /* cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */
-#line 465 "sql.y"
{ pCxt->pRootNode = createShowDnodeVariablesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[-2].minor.yy0), yymsp[0].minor.yy242); }
-#line 6060 "sql.c"
break;
case 258: /* cmd ::= SHOW BNODES */
-#line 466 "sql.y"
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_BNODES_STMT); }
-#line 6065 "sql.c"
break;
case 259: /* cmd ::= SHOW SNODES */
-#line 467 "sql.y"
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SNODES_STMT); }
-#line 6070 "sql.c"
break;
case 260: /* cmd ::= SHOW CLUSTER */
-#line 468 "sql.y"
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CLUSTER_STMT); }
-#line 6075 "sql.c"
break;
case 261: /* cmd ::= SHOW TRANSACTIONS */
-#line 469 "sql.y"
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TRANSACTIONS_STMT); }
-#line 6080 "sql.c"
break;
case 262: /* cmd ::= SHOW TABLE DISTRIBUTED full_table_name */
-#line 470 "sql.y"
{ pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy242); }
-#line 6085 "sql.c"
break;
case 263: /* cmd ::= SHOW CONSUMERS */
-#line 471 "sql.y"
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONSUMERS_STMT); }
-#line 6090 "sql.c"
break;
case 264: /* cmd ::= SHOW SUBSCRIPTIONS */
-#line 472 "sql.y"
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SUBSCRIPTIONS_STMT); }
-#line 6095 "sql.c"
break;
case 265: /* cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */
-#line 473 "sql.y"
{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy242, yymsp[-1].minor.yy242, OP_TYPE_EQUAL); }
-#line 6100 "sql.c"
break;
case 266: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */
-#line 474 "sql.y"
{ pCxt->pRootNode = createShowTableTagsStmt(pCxt, yymsp[-1].minor.yy242, yymsp[0].minor.yy242, yymsp[-3].minor.yy174); }
-#line 6105 "sql.c"
break;
case 267: /* cmd ::= SHOW VNODES NK_INTEGER */
-#line 475 "sql.y"
{ pCxt->pRootNode = createShowVnodesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0), NULL); }
-#line 6110 "sql.c"
break;
case 268: /* cmd ::= SHOW VNODES NK_STRING */
-#line 476 "sql.y"
{ pCxt->pRootNode = createShowVnodesStmt(pCxt, NULL, createValueNode(pCxt, TSDB_DATA_TYPE_VARCHAR, &yymsp[0].minor.yy0)); }
-#line 6115 "sql.c"
break;
case 269: /* cmd ::= SHOW db_name_cond_opt ALIVE */
-#line 478 "sql.y"
{ pCxt->pRootNode = createShowAliveStmt(pCxt, yymsp[-1].minor.yy242, QUERY_NODE_SHOW_DB_ALIVE_STMT); }
-#line 6120 "sql.c"
break;
case 270: /* cmd ::= SHOW CLUSTER ALIVE */
-#line 479 "sql.y"
{ pCxt->pRootNode = createShowAliveStmt(pCxt, NULL, QUERY_NODE_SHOW_CLUSTER_ALIVE_STMT); }
-#line 6125 "sql.c"
break;
case 271: /* db_name_cond_opt ::= */
case 276: /* from_db_opt ::= */ yytestcase(yyruleno==276);
-#line 481 "sql.y"
{ yymsp[1].minor.yy242 = createDefaultDatabaseCondValue(pCxt); }
-#line 6131 "sql.c"
break;
case 272: /* db_name_cond_opt ::= db_name NK_DOT */
-#line 482 "sql.y"
{ yylhsminor.yy242 = createIdentifierValueNode(pCxt, &yymsp[-1].minor.yy669); }
-#line 6136 "sql.c"
yymsp[-1].minor.yy242 = yylhsminor.yy242;
break;
case 274: /* like_pattern_opt ::= LIKE NK_STRING */
-#line 485 "sql.y"
{ yymsp[-1].minor.yy242 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); }
-#line 6142 "sql.c"
break;
case 275: /* table_name_cond ::= table_name */
-#line 487 "sql.y"
{ yylhsminor.yy242 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy669); }
-#line 6147 "sql.c"
yymsp[0].minor.yy242 = yylhsminor.yy242;
break;
case 277: /* from_db_opt ::= FROM db_name */
-#line 490 "sql.y"
{ yymsp[-1].minor.yy242 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy669); }
-#line 6153 "sql.c"
break;
case 281: /* tag_item ::= TBNAME */
-#line 498 "sql.y"
{ yylhsminor.yy242 = setProjectionAlias(pCxt, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL), &yymsp[0].minor.yy0); }
-#line 6158 "sql.c"
yymsp[0].minor.yy242 = yylhsminor.yy242;
break;
case 284: /* tag_item ::= column_name column_alias */
-#line 501 "sql.y"
{ yylhsminor.yy242 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy669), &yymsp[0].minor.yy669); }
-#line 6164 "sql.c"
yymsp[-1].minor.yy242 = yylhsminor.yy242;
break;
case 285: /* tag_item ::= column_name AS column_alias */
-#line 502 "sql.y"
{ yylhsminor.yy242 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-2].minor.yy669), &yymsp[0].minor.yy669); }
-#line 6170 "sql.c"
yymsp[-2].minor.yy242 = yylhsminor.yy242;
break;
case 286: /* cmd ::= CREATE SMA INDEX not_exists_opt full_index_name ON full_table_name index_options */
-#line 506 "sql.y"
{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy777, yymsp[-3].minor.yy242, yymsp[-1].minor.yy242, NULL, yymsp[0].minor.yy242); }
-#line 6176 "sql.c"
break;
case 287: /* cmd ::= CREATE INDEX not_exists_opt full_index_name ON full_table_name NK_LP col_name_list NK_RP */
-#line 508 "sql.y"
{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_NORMAL, yymsp[-6].minor.yy777, yymsp[-5].minor.yy242, yymsp[-3].minor.yy242, yymsp[-1].minor.yy174, NULL); }
-#line 6181 "sql.c"
break;
case 288: /* cmd ::= DROP INDEX exists_opt full_index_name */
-#line 509 "sql.y"
{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy777, yymsp[0].minor.yy242); }
-#line 6186 "sql.c"
break;
case 289: /* full_index_name ::= index_name */
-#line 511 "sql.y"
{ yylhsminor.yy242 = createRealTableNodeForIndexName(pCxt, NULL, &yymsp[0].minor.yy669); }
-#line 6191 "sql.c"
yymsp[0].minor.yy242 = yylhsminor.yy242;
break;
case 290: /* full_index_name ::= db_name NK_DOT index_name */
-#line 512 "sql.y"
{ yylhsminor.yy242 = createRealTableNodeForIndexName(pCxt, &yymsp[-2].minor.yy669, &yymsp[0].minor.yy669); }
-#line 6197 "sql.c"
yymsp[-2].minor.yy242 = yylhsminor.yy242;
break;
case 291: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */
-#line 515 "sql.y"
{ yymsp[-9].minor.yy242 = createIndexOption(pCxt, yymsp[-7].minor.yy174, releaseRawExprNode(pCxt, yymsp[-3].minor.yy242), NULL, yymsp[-1].minor.yy242, yymsp[0].minor.yy242); }
-#line 6203 "sql.c"
break;
case 292: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt */
-#line 518 "sql.y"
{ yymsp[-11].minor.yy242 = createIndexOption(pCxt, yymsp[-9].minor.yy174, releaseRawExprNode(pCxt, yymsp[-5].minor.yy242), releaseRawExprNode(pCxt, yymsp[-3].minor.yy242), yymsp[-1].minor.yy242, yymsp[0].minor.yy242); }
-#line 6208 "sql.c"
break;
case 295: /* func ::= sma_func_name NK_LP expression_list NK_RP */
-#line 525 "sql.y"
{ yylhsminor.yy242 = createFunctionNode(pCxt, &yymsp[-3].minor.yy669, yymsp[-1].minor.yy174); }
-#line 6213 "sql.c"
yymsp[-3].minor.yy242 = yylhsminor.yy242;
break;
case 296: /* sma_func_name ::= function_name */
case 509: /* alias_opt ::= table_alias */ yytestcase(yyruleno==509);
-#line 529 "sql.y"
{ yylhsminor.yy669 = yymsp[0].minor.yy669; }
-#line 6220 "sql.c"
yymsp[0].minor.yy669 = yylhsminor.yy669;
break;
case 301: /* sma_stream_opt ::= */
case 341: /* stream_options ::= */ yytestcase(yyruleno==341);
-#line 535 "sql.y"
{ yymsp[1].minor.yy242 = createStreamOptions(pCxt); }
-#line 6227 "sql.c"
break;
case 302: /* sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */
-#line 536 "sql.y"
{ ((SStreamOptions*)yymsp[-2].minor.yy242)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy242); yylhsminor.yy242 = yymsp[-2].minor.yy242; }
-#line 6232 "sql.c"
yymsp[-2].minor.yy242 = yylhsminor.yy242;
break;
case 303: /* sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */
-#line 537 "sql.y"
{ ((SStreamOptions*)yymsp[-2].minor.yy242)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy242); yylhsminor.yy242 = yymsp[-2].minor.yy242; }
-#line 6238 "sql.c"
yymsp[-2].minor.yy242 = yylhsminor.yy242;
break;
case 304: /* sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */
-#line 538 "sql.y"
{ ((SStreamOptions*)yymsp[-2].minor.yy242)->pDeleteMark = releaseRawExprNode(pCxt, yymsp[0].minor.yy242); yylhsminor.yy242 = yymsp[-2].minor.yy242; }
-#line 6244 "sql.c"
yymsp[-2].minor.yy242 = yylhsminor.yy242;
break;
case 305: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */
-#line 541 "sql.y"
{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy777, &yymsp[-2].minor.yy669, yymsp[0].minor.yy242); }
-#line 6250 "sql.c"
break;
case 306: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */
-#line 542 "sql.y"
{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy777, &yymsp[-3].minor.yy669, &yymsp[0].minor.yy669, false); }
-#line 6255 "sql.c"
break;
case 307: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */
-#line 544 "sql.y"
{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-6].minor.yy777, &yymsp[-5].minor.yy669, &yymsp[0].minor.yy669, true); }
-#line 6260 "sql.c"
break;
case 308: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name where_clause_opt */
-#line 546 "sql.y"
{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-5].minor.yy777, &yymsp[-4].minor.yy669, yymsp[-1].minor.yy242, false, yymsp[0].minor.yy242); }
-#line 6265 "sql.c"
break;
case 309: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name where_clause_opt */
-#line 548 "sql.y"
{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-7].minor.yy777, &yymsp[-6].minor.yy669, yymsp[-1].minor.yy242, true, yymsp[0].minor.yy242); }
-#line 6270 "sql.c"
break;
case 310: /* cmd ::= DROP TOPIC exists_opt topic_name */
-#line 549 "sql.y"
{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy777, &yymsp[0].minor.yy669); }
-#line 6275 "sql.c"
break;
case 311: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */
-#line 550 "sql.y"
{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy777, &yymsp[-2].minor.yy669, &yymsp[0].minor.yy669); }
-#line 6280 "sql.c"
break;
case 312: /* cmd ::= DESC full_table_name */
case 313: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==313);
-#line 553 "sql.y"
{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy242); }
-#line 6286 "sql.c"
break;
case 314: /* cmd ::= RESET QUERY CACHE */
-#line 557 "sql.y"
{ pCxt->pRootNode = createResetQueryCacheStmt(pCxt); }
-#line 6291 "sql.c"
break;
case 315: /* cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */
case 316: /* cmd ::= EXPLAIN analyze_opt explain_options insert_query */ yytestcase(yyruleno==316);
-#line 560 "sql.y"
{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy777, yymsp[-1].minor.yy242, yymsp[0].minor.yy242); }
-#line 6297 "sql.c"
break;
case 319: /* explain_options ::= */
-#line 568 "sql.y"
{ yymsp[1].minor.yy242 = createDefaultExplainOptions(pCxt); }
-#line 6302 "sql.c"
break;
case 320: /* explain_options ::= explain_options VERBOSE NK_BOOL */
-#line 569 "sql.y"
{ yylhsminor.yy242 = setExplainVerbose(pCxt, yymsp[-2].minor.yy242, &yymsp[0].minor.yy0); }
-#line 6307 "sql.c"
yymsp[-2].minor.yy242 = yylhsminor.yy242;
break;
case 321: /* explain_options ::= explain_options RATIO NK_FLOAT */
-#line 570 "sql.y"
{ yylhsminor.yy242 = setExplainRatio(pCxt, yymsp[-2].minor.yy242, &yymsp[0].minor.yy0); }
-#line 6313 "sql.c"
yymsp[-2].minor.yy242 = yylhsminor.yy242;
break;
case 322: /* cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */
-#line 575 "sql.y"
{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-7].minor.yy777, yymsp[-9].minor.yy777, &yymsp[-6].minor.yy669, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy794, yymsp[-1].minor.yy120, &yymsp[0].minor.yy669, yymsp[-10].minor.yy777); }
-#line 6319 "sql.c"
break;
case 323: /* cmd ::= DROP FUNCTION exists_opt function_name */
-#line 576 "sql.y"
{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy777, &yymsp[0].minor.yy669); }
-#line 6324 "sql.c"
break;
case 328: /* language_opt ::= */
-#line 590 "sql.y"
{ yymsp[1].minor.yy669 = nil_token; }
-#line 6329 "sql.c"
break;
case 329: /* language_opt ::= LANGUAGE NK_STRING */
-#line 591 "sql.y"
{ yymsp[-1].minor.yy669 = yymsp[0].minor.yy0; }
-#line 6334 "sql.c"
break;
case 332: /* cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */
-#line 601 "sql.y"
{ pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-9].minor.yy777, &yymsp[-8].minor.yy669, yymsp[-5].minor.yy242, yymsp[-7].minor.yy242, yymsp[-3].minor.yy174, yymsp[-2].minor.yy242, yymsp[0].minor.yy242, yymsp[-4].minor.yy174); }
-#line 6339 "sql.c"
break;
case 333: /* cmd ::= DROP STREAM exists_opt stream_name */
-#line 602 "sql.y"
{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy777, &yymsp[0].minor.yy669); }
-#line 6344 "sql.c"
break;
case 334: /* cmd ::= PAUSE STREAM exists_opt stream_name */
-#line 603 "sql.y"
{ pCxt->pRootNode = createPauseStreamStmt(pCxt, yymsp[-1].minor.yy777, &yymsp[0].minor.yy669); }
-#line 6349 "sql.c"
break;
case 335: /* cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */
-#line 604 "sql.y"
{ pCxt->pRootNode = createResumeStreamStmt(pCxt, yymsp[-2].minor.yy777, yymsp[-1].minor.yy777, &yymsp[0].minor.yy669); }
-#line 6354 "sql.c"
break;
case 342: /* stream_options ::= stream_options TRIGGER AT_ONCE */
case 343: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ yytestcase(yyruleno==343);
-#line 618 "sql.y"
{ yylhsminor.yy242 = setStreamOptions(pCxt, yymsp[-2].minor.yy242, SOPT_TRIGGER_TYPE_SET, &yymsp[0].minor.yy0, NULL); }
-#line 6360 "sql.c"
yymsp[-2].minor.yy242 = yylhsminor.yy242;
break;
case 344: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */
-#line 620 "sql.y"
{ yylhsminor.yy242 = setStreamOptions(pCxt, yymsp[-3].minor.yy242, SOPT_TRIGGER_TYPE_SET, &yymsp[-1].minor.yy0, releaseRawExprNode(pCxt, yymsp[0].minor.yy242)); }
-#line 6366 "sql.c"
yymsp[-3].minor.yy242 = yylhsminor.yy242;
break;
case 345: /* stream_options ::= stream_options WATERMARK duration_literal */
-#line 621 "sql.y"
{ yylhsminor.yy242 = setStreamOptions(pCxt, yymsp[-2].minor.yy242, SOPT_WATERMARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy242)); }
-#line 6372 "sql.c"
yymsp[-2].minor.yy242 = yylhsminor.yy242;
break;
case 346: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */
-#line 622 "sql.y"
{ yylhsminor.yy242 = setStreamOptions(pCxt, yymsp[-3].minor.yy242, SOPT_IGNORE_EXPIRED_SET, &yymsp[0].minor.yy0, NULL); }
-#line 6378 "sql.c"
yymsp[-3].minor.yy242 = yylhsminor.yy242;
break;
case 347: /* stream_options ::= stream_options FILL_HISTORY NK_INTEGER */
-#line 623 "sql.y"
{ yylhsminor.yy242 = setStreamOptions(pCxt, yymsp[-2].minor.yy242, SOPT_FILL_HISTORY_SET, &yymsp[0].minor.yy0, NULL); }
-#line 6384 "sql.c"
yymsp[-2].minor.yy242 = yylhsminor.yy242;
break;
case 348: /* stream_options ::= stream_options DELETE_MARK duration_literal */
-#line 624 "sql.y"
{ yylhsminor.yy242 = setStreamOptions(pCxt, yymsp[-2].minor.yy242, SOPT_DELETE_MARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy242)); }
-#line 6390 "sql.c"
yymsp[-2].minor.yy242 = yylhsminor.yy242;
break;
case 349: /* stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */
-#line 625 "sql.y"
{ yylhsminor.yy242 = setStreamOptions(pCxt, yymsp[-3].minor.yy242, SOPT_IGNORE_UPDATE_SET, &yymsp[0].minor.yy0, NULL); }
-#line 6396 "sql.c"
yymsp[-3].minor.yy242 = yylhsminor.yy242;
break;
case 351: /* subtable_opt ::= SUBTABLE NK_LP expression NK_RP */
case 543: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ yytestcase(yyruleno==543);
- case 563: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==563);
-#line 628 "sql.y"
+ case 564: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==564);
{ yymsp[-3].minor.yy242 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy242); }
-#line 6404 "sql.c"
break;
case 354: /* cmd ::= KILL CONNECTION NK_INTEGER */
-#line 636 "sql.y"
{ pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_CONNECTION_STMT, &yymsp[0].minor.yy0); }
-#line 6409 "sql.c"
break;
case 355: /* cmd ::= KILL QUERY NK_STRING */
-#line 637 "sql.y"
{ pCxt->pRootNode = createKillQueryStmt(pCxt, &yymsp[0].minor.yy0); }
-#line 6414 "sql.c"
break;
case 356: /* cmd ::= KILL TRANSACTION NK_INTEGER */
-#line 638 "sql.y"
{ pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_TRANSACTION_STMT, &yymsp[0].minor.yy0); }
-#line 6419 "sql.c"
break;
case 357: /* cmd ::= BALANCE VGROUP */
-#line 641 "sql.y"
{ pCxt->pRootNode = createBalanceVgroupStmt(pCxt); }
-#line 6424 "sql.c"
break;
case 358: /* cmd ::= BALANCE VGROUP LEADER */
-#line 642 "sql.y"
{ pCxt->pRootNode = createBalanceVgroupLeaderStmt(pCxt); }
-#line 6429 "sql.c"
break;
case 359: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */
-#line 643 "sql.y"
{ pCxt->pRootNode = createMergeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); }
-#line 6434 "sql.c"
break;
case 360: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */
-#line 644 "sql.y"
{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy174); }
-#line 6439 "sql.c"
break;
case 361: /* cmd ::= SPLIT VGROUP NK_INTEGER */
-#line 645 "sql.y"
{ pCxt->pRootNode = createSplitVgroupStmt(pCxt, &yymsp[0].minor.yy0); }
-#line 6444 "sql.c"
break;
case 362: /* dnode_list ::= DNODE NK_INTEGER */
-#line 649 "sql.y"
{ yymsp[-1].minor.yy174 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
-#line 6449 "sql.c"
break;
case 364: /* cmd ::= DELETE FROM full_table_name where_clause_opt */
-#line 656 "sql.y"
{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy242, yymsp[0].minor.yy242); }
-#line 6454 "sql.c"
break;
case 367: /* insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */
-#line 665 "sql.y"
{ yymsp[-6].minor.yy242 = createInsertStmt(pCxt, yymsp[-4].minor.yy242, yymsp[-2].minor.yy174, yymsp[0].minor.yy242); }
-#line 6459 "sql.c"
break;
case 368: /* insert_query ::= INSERT INTO full_table_name query_or_subquery */
-#line 666 "sql.y"
{ yymsp[-3].minor.yy242 = createInsertStmt(pCxt, yymsp[-1].minor.yy242, NULL, yymsp[0].minor.yy242); }
-#line 6464 "sql.c"
break;
case 369: /* literal ::= NK_INTEGER */
-#line 669 "sql.y"
{ yylhsminor.yy242 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); }
-#line 6469 "sql.c"
yymsp[0].minor.yy242 = yylhsminor.yy242;
break;
case 370: /* literal ::= NK_FLOAT */
-#line 670 "sql.y"
{ yylhsminor.yy242 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); }
-#line 6475 "sql.c"
yymsp[0].minor.yy242 = yylhsminor.yy242;
break;
case 371: /* literal ::= NK_STRING */
-#line 671 "sql.y"
{ yylhsminor.yy242 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); }
-#line 6481 "sql.c"
yymsp[0].minor.yy242 = yylhsminor.yy242;
break;
case 372: /* literal ::= NK_BOOL */
-#line 672 "sql.y"
{ yylhsminor.yy242 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); }
-#line 6487 "sql.c"
yymsp[0].minor.yy242 = yylhsminor.yy242;
break;
case 373: /* literal ::= TIMESTAMP NK_STRING */
-#line 673 "sql.y"
{ yylhsminor.yy242 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); }
-#line 6493 "sql.c"
yymsp[-1].minor.yy242 = yylhsminor.yy242;
break;
case 374: /* literal ::= duration_literal */
@@ -6510,232 +5608,174 @@ static YYACTIONTYPE yy_reduce(
case 502: /* table_reference ::= table_primary */ yytestcase(yyruleno==502);
case 503: /* table_reference ::= joined_table */ yytestcase(yyruleno==503);
case 507: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==507);
- case 565: /* query_simple ::= query_specification */ yytestcase(yyruleno==565);
- case 566: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==566);
- case 569: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==569);
- case 571: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==571);
-#line 674 "sql.y"
+ case 566: /* query_simple ::= query_specification */ yytestcase(yyruleno==566);
+ case 567: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==567);
+ case 570: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==570);
+ case 572: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==572);
{ yylhsminor.yy242 = yymsp[0].minor.yy242; }
-#line 6519 "sql.c"
yymsp[0].minor.yy242 = yylhsminor.yy242;
break;
case 375: /* literal ::= NULL */
-#line 675 "sql.y"
{ yylhsminor.yy242 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); }
-#line 6525 "sql.c"
yymsp[0].minor.yy242 = yylhsminor.yy242;
break;
case 376: /* literal ::= NK_QUESTION */
-#line 676 "sql.y"
{ yylhsminor.yy242 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); }
-#line 6531 "sql.c"
yymsp[0].minor.yy242 = yylhsminor.yy242;
break;
case 377: /* duration_literal ::= NK_VARIABLE */
-#line 678 "sql.y"
{ yylhsminor.yy242 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
-#line 6537 "sql.c"
yymsp[0].minor.yy242 = yylhsminor.yy242;
break;
case 378: /* signed ::= NK_INTEGER */
-#line 680 "sql.y"
{ yylhsminor.yy242 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); }
-#line 6543 "sql.c"
yymsp[0].minor.yy242 = yylhsminor.yy242;
break;
case 379: /* signed ::= NK_PLUS NK_INTEGER */
-#line 681 "sql.y"
{ yymsp[-1].minor.yy242 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); }
-#line 6549 "sql.c"
break;
case 380: /* signed ::= NK_MINUS NK_INTEGER */
-#line 682 "sql.y"
{
SToken t = yymsp[-1].minor.yy0;
t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z;
yylhsminor.yy242 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t);
}
-#line 6558 "sql.c"
yymsp[-1].minor.yy242 = yylhsminor.yy242;
break;
case 381: /* signed ::= NK_FLOAT */
-#line 687 "sql.y"
{ yylhsminor.yy242 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); }
-#line 6564 "sql.c"
yymsp[0].minor.yy242 = yylhsminor.yy242;
break;
case 382: /* signed ::= NK_PLUS NK_FLOAT */
-#line 688 "sql.y"
{ yymsp[-1].minor.yy242 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); }
-#line 6570 "sql.c"
break;
case 383: /* signed ::= NK_MINUS NK_FLOAT */
-#line 689 "sql.y"
{
SToken t = yymsp[-1].minor.yy0;
t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z;
yylhsminor.yy242 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t);
}
-#line 6579 "sql.c"
yymsp[-1].minor.yy242 = yylhsminor.yy242;
break;
case 385: /* signed_literal ::= NK_STRING */
-#line 696 "sql.y"
{ yylhsminor.yy242 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); }
-#line 6585 "sql.c"
yymsp[0].minor.yy242 = yylhsminor.yy242;
break;
case 386: /* signed_literal ::= NK_BOOL */
-#line 697 "sql.y"
{ yylhsminor.yy242 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); }
-#line 6591 "sql.c"
yymsp[0].minor.yy242 = yylhsminor.yy242;
break;
case 387: /* signed_literal ::= TIMESTAMP NK_STRING */
-#line 698 "sql.y"
{ yymsp[-1].minor.yy242 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); }
-#line 6597 "sql.c"
break;
case 388: /* signed_literal ::= duration_literal */
case 390: /* signed_literal ::= literal_func */ yytestcase(yyruleno==390);
case 461: /* star_func_para ::= expr_or_subquery */ yytestcase(yyruleno==461);
case 523: /* select_item ::= common_expression */ yytestcase(yyruleno==523);
case 533: /* partition_item ::= expr_or_subquery */ yytestcase(yyruleno==533);
- case 570: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==570);
- case 572: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==572);
- case 585: /* search_condition ::= common_expression */ yytestcase(yyruleno==585);
-#line 699 "sql.y"
+ case 571: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==571);
+ case 573: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==573);
+ case 586: /* search_condition ::= common_expression */ yytestcase(yyruleno==586);
{ yylhsminor.yy242 = releaseRawExprNode(pCxt, yymsp[0].minor.yy242); }
-#line 6609 "sql.c"
yymsp[0].minor.yy242 = yylhsminor.yy242;
break;
case 389: /* signed_literal ::= NULL */
-#line 700 "sql.y"
{ yylhsminor.yy242 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); }
-#line 6615 "sql.c"
yymsp[0].minor.yy242 = yylhsminor.yy242;
break;
case 391: /* signed_literal ::= NK_QUESTION */
-#line 702 "sql.y"
{ yylhsminor.yy242 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); }
-#line 6621 "sql.c"
yymsp[0].minor.yy242 = yylhsminor.yy242;
break;
case 411: /* expression ::= NK_LP expression NK_RP */
case 495: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==495);
- case 584: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==584);
-#line 763 "sql.y"
+ case 585: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==585);
{ yylhsminor.yy242 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy242)); }
-#line 6629 "sql.c"
yymsp[-2].minor.yy242 = yylhsminor.yy242;
break;
case 412: /* expression ::= NK_PLUS expr_or_subquery */
-#line 764 "sql.y"
{
SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy242);
yylhsminor.yy242 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy242));
}
-#line 6638 "sql.c"
yymsp[-1].minor.yy242 = yylhsminor.yy242;
break;
case 413: /* expression ::= NK_MINUS expr_or_subquery */
-#line 768 "sql.y"
{
SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy242);
yylhsminor.yy242 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy242), NULL));
}
-#line 6647 "sql.c"
yymsp[-1].minor.yy242 = yylhsminor.yy242;
break;
case 414: /* expression ::= expr_or_subquery NK_PLUS expr_or_subquery */
-#line 772 "sql.y"
{
SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy242);
SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy242);
yylhsminor.yy242 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy242), releaseRawExprNode(pCxt, yymsp[0].minor.yy242)));
}
-#line 6657 "sql.c"
yymsp[-2].minor.yy242 = yylhsminor.yy242;
break;
case 415: /* expression ::= expr_or_subquery NK_MINUS expr_or_subquery */
-#line 777 "sql.y"
{
SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy242);
SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy242);
yylhsminor.yy242 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy242), releaseRawExprNode(pCxt, yymsp[0].minor.yy242)));
}
-#line 6667 "sql.c"
yymsp[-2].minor.yy242 = yylhsminor.yy242;
break;
case 416: /* expression ::= expr_or_subquery NK_STAR expr_or_subquery */
-#line 782 "sql.y"
{
SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy242);
SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy242);
yylhsminor.yy242 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy242), releaseRawExprNode(pCxt, yymsp[0].minor.yy242)));
}
-#line 6677 "sql.c"
yymsp[-2].minor.yy242 = yylhsminor.yy242;
break;
case 417: /* expression ::= expr_or_subquery NK_SLASH expr_or_subquery */
-#line 787 "sql.y"
{
SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy242);
SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy242);
yylhsminor.yy242 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy242), releaseRawExprNode(pCxt, yymsp[0].minor.yy242)));
}
-#line 6687 "sql.c"
yymsp[-2].minor.yy242 = yylhsminor.yy242;
break;
case 418: /* expression ::= expr_or_subquery NK_REM expr_or_subquery */
-#line 792 "sql.y"
{
SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy242);
SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy242);
yylhsminor.yy242 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy242), releaseRawExprNode(pCxt, yymsp[0].minor.yy242)));
}
-#line 6697 "sql.c"
yymsp[-2].minor.yy242 = yylhsminor.yy242;
break;
case 419: /* expression ::= column_reference NK_ARROW NK_STRING */
-#line 797 "sql.y"
{
SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy242);
yylhsminor.yy242 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy242), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)));
}
-#line 6706 "sql.c"
yymsp[-2].minor.yy242 = yylhsminor.yy242;
break;
case 420: /* expression ::= expr_or_subquery NK_BITAND expr_or_subquery */
-#line 801 "sql.y"
{
SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy242);
SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy242);
yylhsminor.yy242 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy242), releaseRawExprNode(pCxt, yymsp[0].minor.yy242)));
}
-#line 6716 "sql.c"
yymsp[-2].minor.yy242 = yylhsminor.yy242;
break;
case 421: /* expression ::= expr_or_subquery NK_BITOR expr_or_subquery */
-#line 806 "sql.y"
{
SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy242);
SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy242);
yylhsminor.yy242 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy242), releaseRawExprNode(pCxt, yymsp[0].minor.yy242)));
}
-#line 6726 "sql.c"
yymsp[-2].minor.yy242 = yylhsminor.yy242;
break;
case 424: /* column_reference ::= column_name */
-#line 817 "sql.y"
{ yylhsminor.yy242 = createRawExprNode(pCxt, &yymsp[0].minor.yy669, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy669)); }
-#line 6732 "sql.c"
yymsp[0].minor.yy242 = yylhsminor.yy242;
break;
case 425: /* column_reference ::= table_name NK_DOT column_name */
-#line 818 "sql.y"
{ yylhsminor.yy242 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy669, &yymsp[0].minor.yy669, createColumnNode(pCxt, &yymsp[-2].minor.yy669, &yymsp[0].minor.yy669)); }
-#line 6738 "sql.c"
yymsp[-2].minor.yy242 = yylhsminor.yy242;
break;
case 426: /* pseudo_column ::= ROWTS */
@@ -6750,278 +5790,191 @@ static YYACTIONTYPE yy_reduce(
case 436: /* pseudo_column ::= ISFILLED */ yytestcase(yyruleno==436);
case 437: /* pseudo_column ::= QTAGS */ yytestcase(yyruleno==437);
case 443: /* literal_func ::= NOW */ yytestcase(yyruleno==443);
-#line 820 "sql.y"
{ yylhsminor.yy242 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); }
-#line 6755 "sql.c"
yymsp[0].minor.yy242 = yylhsminor.yy242;
break;
case 428: /* pseudo_column ::= table_name NK_DOT TBNAME */
-#line 822 "sql.y"
{ yylhsminor.yy242 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy669, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy669)))); }
-#line 6761 "sql.c"
yymsp[-2].minor.yy242 = yylhsminor.yy242;
break;
case 438: /* function_expression ::= function_name NK_LP expression_list NK_RP */
case 439: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==439);
-#line 833 "sql.y"
{ yylhsminor.yy242 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy669, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy669, yymsp[-1].minor.yy174)); }
-#line 6768 "sql.c"
yymsp[-3].minor.yy242 = yylhsminor.yy242;
break;
case 440: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */
-#line 836 "sql.y"
{ yylhsminor.yy242 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy242), yymsp[-1].minor.yy794)); }
-#line 6774 "sql.c"
yymsp[-5].minor.yy242 = yylhsminor.yy242;
break;
case 442: /* literal_func ::= noarg_func NK_LP NK_RP */
-#line 839 "sql.y"
{ yylhsminor.yy242 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy669, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy669, NULL)); }
-#line 6780 "sql.c"
yymsp[-2].minor.yy242 = yylhsminor.yy242;
break;
case 457: /* star_func_para_list ::= NK_STAR */
-#line 863 "sql.y"
{ yylhsminor.yy174 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); }
-#line 6786 "sql.c"
yymsp[0].minor.yy174 = yylhsminor.yy174;
break;
case 462: /* star_func_para ::= table_name NK_DOT NK_STAR */
case 526: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==526);
-#line 872 "sql.y"
{ yylhsminor.yy242 = createColumnNode(pCxt, &yymsp[-2].minor.yy669, &yymsp[0].minor.yy0); }
-#line 6793 "sql.c"
yymsp[-2].minor.yy242 = yylhsminor.yy242;
break;
case 463: /* case_when_expression ::= CASE when_then_list case_when_else_opt END */
-#line 875 "sql.y"
{ yylhsminor.yy242 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, NULL, yymsp[-2].minor.yy174, yymsp[-1].minor.yy242)); }
-#line 6799 "sql.c"
yymsp[-3].minor.yy242 = yylhsminor.yy242;
break;
case 464: /* case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */
-#line 877 "sql.y"
{ yylhsminor.yy242 = createRawExprNodeExt(pCxt, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy242), yymsp[-2].minor.yy174, yymsp[-1].minor.yy242)); }
-#line 6805 "sql.c"
yymsp[-4].minor.yy242 = yylhsminor.yy242;
break;
case 467: /* when_then_expr ::= WHEN common_expression THEN common_expression */
-#line 884 "sql.y"
{ yymsp[-3].minor.yy242 = createWhenThenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy242), releaseRawExprNode(pCxt, yymsp[0].minor.yy242)); }
-#line 6811 "sql.c"
break;
case 469: /* case_when_else_opt ::= ELSE common_expression */
-#line 887 "sql.y"
{ yymsp[-1].minor.yy242 = releaseRawExprNode(pCxt, yymsp[0].minor.yy242); }
-#line 6816 "sql.c"
break;
case 470: /* predicate ::= expr_or_subquery compare_op expr_or_subquery */
case 475: /* predicate ::= expr_or_subquery in_op in_predicate_value */ yytestcase(yyruleno==475);
-#line 890 "sql.y"
{
SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy242);
SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy242);
yylhsminor.yy242 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy70, releaseRawExprNode(pCxt, yymsp[-2].minor.yy242), releaseRawExprNode(pCxt, yymsp[0].minor.yy242)));
}
-#line 6826 "sql.c"
yymsp[-2].minor.yy242 = yylhsminor.yy242;
break;
case 471: /* predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */
-#line 897 "sql.y"
{
SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy242);
SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy242);
yylhsminor.yy242 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy242), releaseRawExprNode(pCxt, yymsp[-2].minor.yy242), releaseRawExprNode(pCxt, yymsp[0].minor.yy242)));
}
-#line 6836 "sql.c"
yymsp[-4].minor.yy242 = yylhsminor.yy242;
break;
case 472: /* predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */
-#line 903 "sql.y"
{
SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy242);
SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy242);
yylhsminor.yy242 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy242), releaseRawExprNode(pCxt, yymsp[-2].minor.yy242), releaseRawExprNode(pCxt, yymsp[0].minor.yy242)));
}
-#line 6846 "sql.c"
yymsp[-5].minor.yy242 = yylhsminor.yy242;
break;
case 473: /* predicate ::= expr_or_subquery IS NULL */
-#line 908 "sql.y"
{
SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy242);
yylhsminor.yy242 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy242), NULL));
}
-#line 6855 "sql.c"
yymsp[-2].minor.yy242 = yylhsminor.yy242;
break;
case 474: /* predicate ::= expr_or_subquery IS NOT NULL */
-#line 912 "sql.y"
{
SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy242);
yylhsminor.yy242 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy242), NULL));
}
-#line 6864 "sql.c"
yymsp[-3].minor.yy242 = yylhsminor.yy242;
break;
case 476: /* compare_op ::= NK_LT */
-#line 924 "sql.y"
{ yymsp[0].minor.yy70 = OP_TYPE_LOWER_THAN; }
-#line 6870 "sql.c"
break;
case 477: /* compare_op ::= NK_GT */
-#line 925 "sql.y"
{ yymsp[0].minor.yy70 = OP_TYPE_GREATER_THAN; }
-#line 6875 "sql.c"
break;
case 478: /* compare_op ::= NK_LE */
-#line 926 "sql.y"
{ yymsp[0].minor.yy70 = OP_TYPE_LOWER_EQUAL; }
-#line 6880 "sql.c"
break;
case 479: /* compare_op ::= NK_GE */
-#line 927 "sql.y"
{ yymsp[0].minor.yy70 = OP_TYPE_GREATER_EQUAL; }
-#line 6885 "sql.c"
break;
case 480: /* compare_op ::= NK_NE */
-#line 928 "sql.y"
{ yymsp[0].minor.yy70 = OP_TYPE_NOT_EQUAL; }
-#line 6890 "sql.c"
break;
case 481: /* compare_op ::= NK_EQ */
-#line 929 "sql.y"
{ yymsp[0].minor.yy70 = OP_TYPE_EQUAL; }
-#line 6895 "sql.c"
break;
case 482: /* compare_op ::= LIKE */
-#line 930 "sql.y"
{ yymsp[0].minor.yy70 = OP_TYPE_LIKE; }
-#line 6900 "sql.c"
break;
case 483: /* compare_op ::= NOT LIKE */
-#line 931 "sql.y"
{ yymsp[-1].minor.yy70 = OP_TYPE_NOT_LIKE; }
-#line 6905 "sql.c"
break;
case 484: /* compare_op ::= MATCH */
-#line 932 "sql.y"
{ yymsp[0].minor.yy70 = OP_TYPE_MATCH; }
-#line 6910 "sql.c"
break;
case 485: /* compare_op ::= NMATCH */
-#line 933 "sql.y"
{ yymsp[0].minor.yy70 = OP_TYPE_NMATCH; }
-#line 6915 "sql.c"
break;
case 486: /* compare_op ::= CONTAINS */
-#line 934 "sql.y"
{ yymsp[0].minor.yy70 = OP_TYPE_JSON_CONTAINS; }
-#line 6920 "sql.c"
break;
case 487: /* in_op ::= IN */
-#line 938 "sql.y"
{ yymsp[0].minor.yy70 = OP_TYPE_IN; }
-#line 6925 "sql.c"
break;
case 488: /* in_op ::= NOT IN */
-#line 939 "sql.y"
{ yymsp[-1].minor.yy70 = OP_TYPE_NOT_IN; }
-#line 6930 "sql.c"
break;
case 489: /* in_predicate_value ::= NK_LP literal_list NK_RP */
-#line 941 "sql.y"
{ yylhsminor.yy242 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy174)); }
-#line 6935 "sql.c"
yymsp[-2].minor.yy242 = yylhsminor.yy242;
break;
case 491: /* boolean_value_expression ::= NOT boolean_primary */
-#line 945 "sql.y"
{
SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy242);
yylhsminor.yy242 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy242), NULL));
}
-#line 6944 "sql.c"
yymsp[-1].minor.yy242 = yylhsminor.yy242;
break;
case 492: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */
-#line 950 "sql.y"
{
SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy242);
SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy242);
yylhsminor.yy242 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy242), releaseRawExprNode(pCxt, yymsp[0].minor.yy242)));
}
-#line 6954 "sql.c"
yymsp[-2].minor.yy242 = yylhsminor.yy242;
break;
case 493: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */
-#line 956 "sql.y"
{
SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy242);
SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy242);
yylhsminor.yy242 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy242), releaseRawExprNode(pCxt, yymsp[0].minor.yy242)));
}
-#line 6964 "sql.c"
yymsp[-2].minor.yy242 = yylhsminor.yy242;
break;
case 501: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */
-#line 974 "sql.y"
{ yylhsminor.yy242 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy242, yymsp[0].minor.yy242, NULL); }
-#line 6970 "sql.c"
yymsp[-2].minor.yy242 = yylhsminor.yy242;
break;
case 504: /* table_primary ::= table_name alias_opt */
-#line 980 "sql.y"
{ yylhsminor.yy242 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy669, &yymsp[0].minor.yy669); }
-#line 6976 "sql.c"
yymsp[-1].minor.yy242 = yylhsminor.yy242;
break;
case 505: /* table_primary ::= db_name NK_DOT table_name alias_opt */
-#line 981 "sql.y"
{ yylhsminor.yy242 = createRealTableNode(pCxt, &yymsp[-3].minor.yy669, &yymsp[-1].minor.yy669, &yymsp[0].minor.yy669); }
-#line 6982 "sql.c"
yymsp[-3].minor.yy242 = yylhsminor.yy242;
break;
case 506: /* table_primary ::= subquery alias_opt */
-#line 982 "sql.y"
{ yylhsminor.yy242 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy242), &yymsp[0].minor.yy669); }
-#line 6988 "sql.c"
yymsp[-1].minor.yy242 = yylhsminor.yy242;
break;
case 508: /* alias_opt ::= */
-#line 987 "sql.y"
{ yymsp[1].minor.yy669 = nil_token; }
-#line 6994 "sql.c"
break;
case 510: /* alias_opt ::= AS table_alias */
-#line 989 "sql.y"
{ yymsp[-1].minor.yy669 = yymsp[0].minor.yy669; }
-#line 6999 "sql.c"
break;
case 511: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */
case 512: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==512);
-#line 991 "sql.y"
{ yymsp[-2].minor.yy242 = yymsp[-1].minor.yy242; }
-#line 7005 "sql.c"
break;
case 513: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */
-#line 996 "sql.y"
{ yylhsminor.yy242 = createJoinTableNode(pCxt, yymsp[-4].minor.yy482, yymsp[-5].minor.yy242, yymsp[-2].minor.yy242, yymsp[0].minor.yy242); }
-#line 7010 "sql.c"
yymsp[-5].minor.yy242 = yylhsminor.yy242;
break;
case 514: /* join_type ::= */
-#line 1000 "sql.y"
{ yymsp[1].minor.yy482 = JOIN_TYPE_INNER; }
-#line 7016 "sql.c"
break;
case 515: /* join_type ::= INNER */
-#line 1001 "sql.y"
{ yymsp[0].minor.yy482 = JOIN_TYPE_INNER; }
-#line 7021 "sql.c"
break;
case 516: /* 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 */
-#line 1007 "sql.y"
{
yymsp[-11].minor.yy242 = createSelectStmt(pCxt, yymsp[-10].minor.yy777, yymsp[-9].minor.yy174, yymsp[-8].minor.yy242);
yymsp[-11].minor.yy242 = addWhereClause(pCxt, yymsp[-11].minor.yy242, yymsp[-7].minor.yy242);
@@ -7033,208 +5986,138 @@ static YYACTIONTYPE yy_reduce(
yymsp[-11].minor.yy242 = addEveryClause(pCxt, yymsp[-11].minor.yy242, yymsp[-4].minor.yy242);
yymsp[-11].minor.yy242 = addFillClause(pCxt, yymsp[-11].minor.yy242, yymsp[-3].minor.yy242);
}
-#line 7036 "sql.c"
break;
case 519: /* set_quantifier_opt ::= ALL */
-#line 1023 "sql.y"
{ yymsp[0].minor.yy777 = false; }
-#line 7041 "sql.c"
break;
case 522: /* select_item ::= NK_STAR */
-#line 1030 "sql.y"
{ yylhsminor.yy242 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); }
-#line 7046 "sql.c"
yymsp[0].minor.yy242 = yylhsminor.yy242;
break;
case 524: /* select_item ::= common_expression column_alias */
case 534: /* partition_item ::= expr_or_subquery column_alias */ yytestcase(yyruleno==534);
-#line 1032 "sql.y"
{ yylhsminor.yy242 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy242), &yymsp[0].minor.yy669); }
-#line 7053 "sql.c"
yymsp[-1].minor.yy242 = yylhsminor.yy242;
break;
case 525: /* select_item ::= common_expression AS column_alias */
case 535: /* partition_item ::= expr_or_subquery AS column_alias */ yytestcase(yyruleno==535);
-#line 1033 "sql.y"
{ yylhsminor.yy242 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy242), &yymsp[0].minor.yy669); }
-#line 7060 "sql.c"
yymsp[-2].minor.yy242 = yylhsminor.yy242;
break;
case 530: /* partition_by_clause_opt ::= PARTITION BY partition_list */
case 555: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==555);
- case 574: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==574);
-#line 1042 "sql.y"
+ case 575: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==575);
{ yymsp[-2].minor.yy174 = yymsp[0].minor.yy174; }
-#line 7068 "sql.c"
break;
case 537: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */
-#line 1055 "sql.y"
{ yymsp[-5].minor.yy242 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy242), releaseRawExprNode(pCxt, yymsp[-1].minor.yy242)); }
-#line 7073 "sql.c"
break;
case 538: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */
-#line 1056 "sql.y"
{ yymsp[-3].minor.yy242 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy242)); }
-#line 7078 "sql.c"
break;
case 539: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */
-#line 1058 "sql.y"
{ yymsp[-5].minor.yy242 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy242), NULL, yymsp[-1].minor.yy242, yymsp[0].minor.yy242); }
-#line 7083 "sql.c"
break;
case 540: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */
-#line 1061 "sql.y"
{ yymsp[-7].minor.yy242 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy242), releaseRawExprNode(pCxt, yymsp[-3].minor.yy242), yymsp[-1].minor.yy242, yymsp[0].minor.yy242); }
-#line 7088 "sql.c"
break;
case 541: /* twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */
-#line 1063 "sql.y"
{ yymsp[-6].minor.yy242 = createEventWindowNode(pCxt, yymsp[-3].minor.yy242, yymsp[0].minor.yy242); }
-#line 7093 "sql.c"
break;
case 545: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */
-#line 1069 "sql.y"
{ yymsp[-3].minor.yy242 = createFillNode(pCxt, yymsp[-1].minor.yy204, NULL); }
-#line 7098 "sql.c"
break;
case 546: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */
-#line 1070 "sql.y"
{ yymsp[-5].minor.yy242 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy174)); }
-#line 7103 "sql.c"
break;
case 547: /* fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */
-#line 1071 "sql.y"
{ yymsp[-5].minor.yy242 = createFillNode(pCxt, FILL_MODE_VALUE_F, createNodeListNode(pCxt, yymsp[-1].minor.yy174)); }
-#line 7108 "sql.c"
break;
case 548: /* fill_mode ::= NONE */
-#line 1075 "sql.y"
{ yymsp[0].minor.yy204 = FILL_MODE_NONE; }
-#line 7113 "sql.c"
break;
case 549: /* fill_mode ::= PREV */
-#line 1076 "sql.y"
{ yymsp[0].minor.yy204 = FILL_MODE_PREV; }
-#line 7118 "sql.c"
break;
case 550: /* fill_mode ::= NULL */
-#line 1077 "sql.y"
{ yymsp[0].minor.yy204 = FILL_MODE_NULL; }
-#line 7123 "sql.c"
break;
case 551: /* fill_mode ::= NULL_F */
-#line 1078 "sql.y"
{ yymsp[0].minor.yy204 = FILL_MODE_NULL_F; }
-#line 7128 "sql.c"
break;
case 552: /* fill_mode ::= LINEAR */
-#line 1079 "sql.y"
{ yymsp[0].minor.yy204 = FILL_MODE_LINEAR; }
-#line 7133 "sql.c"
break;
case 553: /* fill_mode ::= NEXT */
-#line 1080 "sql.y"
{ yymsp[0].minor.yy204 = FILL_MODE_NEXT; }
-#line 7138 "sql.c"
break;
case 556: /* group_by_list ::= expr_or_subquery */
-#line 1089 "sql.y"
{ yylhsminor.yy174 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy242))); }
-#line 7143 "sql.c"
yymsp[0].minor.yy174 = yylhsminor.yy174;
break;
case 557: /* group_by_list ::= group_by_list NK_COMMA expr_or_subquery */
-#line 1090 "sql.y"
{ yylhsminor.yy174 = addNodeToList(pCxt, yymsp[-2].minor.yy174, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy242))); }
-#line 7149 "sql.c"
yymsp[-2].minor.yy174 = yylhsminor.yy174;
break;
case 561: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */
-#line 1097 "sql.y"
{ yymsp[-5].minor.yy242 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy242), releaseRawExprNode(pCxt, yymsp[-1].minor.yy242)); }
-#line 7155 "sql.c"
break;
- case 564: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */
-#line 1104 "sql.y"
+ case 562: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */
+{ yymsp[-3].minor.yy242 = createInterpTimePoint(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy242)); }
+ break;
+ case 565: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */
{
yylhsminor.yy242 = addOrderByClause(pCxt, yymsp[-3].minor.yy242, yymsp[-2].minor.yy174);
yylhsminor.yy242 = addSlimitClause(pCxt, yylhsminor.yy242, yymsp[-1].minor.yy242);
yylhsminor.yy242 = addLimitClause(pCxt, yylhsminor.yy242, yymsp[0].minor.yy242);
}
-#line 7164 "sql.c"
yymsp[-3].minor.yy242 = yylhsminor.yy242;
break;
- case 567: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */
-#line 1114 "sql.y"
+ case 568: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */
{ yylhsminor.yy242 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy242, yymsp[0].minor.yy242); }
-#line 7170 "sql.c"
yymsp[-3].minor.yy242 = yylhsminor.yy242;
break;
- case 568: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */
-#line 1116 "sql.y"
+ case 569: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */
{ yylhsminor.yy242 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy242, yymsp[0].minor.yy242); }
-#line 7176 "sql.c"
yymsp[-2].minor.yy242 = yylhsminor.yy242;
break;
- case 576: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */
- case 580: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==580);
-#line 1130 "sql.y"
+ case 577: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */
+ case 581: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==581);
{ yymsp[-1].minor.yy242 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); }
-#line 7183 "sql.c"
break;
- case 577: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
- case 581: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==581);
-#line 1131 "sql.y"
+ case 578: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
+ case 582: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==582);
{ yymsp[-3].minor.yy242 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); }
-#line 7189 "sql.c"
break;
- case 578: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
- case 582: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==582);
-#line 1132 "sql.y"
+ case 579: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
+ case 583: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==583);
{ yymsp[-3].minor.yy242 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); }
-#line 7195 "sql.c"
break;
- case 583: /* subquery ::= NK_LP query_expression NK_RP */
-#line 1140 "sql.y"
+ case 584: /* subquery ::= NK_LP query_expression NK_RP */
{ yylhsminor.yy242 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy242); }
-#line 7200 "sql.c"
yymsp[-2].minor.yy242 = yylhsminor.yy242;
break;
- case 588: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */
-#line 1154 "sql.y"
+ case 589: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */
{ yylhsminor.yy242 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy242), yymsp[-1].minor.yy48, yymsp[0].minor.yy687); }
-#line 7206 "sql.c"
yymsp[-2].minor.yy242 = yylhsminor.yy242;
break;
- case 589: /* ordering_specification_opt ::= */
-#line 1158 "sql.y"
+ case 590: /* ordering_specification_opt ::= */
{ yymsp[1].minor.yy48 = ORDER_ASC; }
-#line 7212 "sql.c"
break;
- case 590: /* ordering_specification_opt ::= ASC */
-#line 1159 "sql.y"
+ case 591: /* ordering_specification_opt ::= ASC */
{ yymsp[0].minor.yy48 = ORDER_ASC; }
-#line 7217 "sql.c"
break;
- case 591: /* ordering_specification_opt ::= DESC */
-#line 1160 "sql.y"
+ case 592: /* ordering_specification_opt ::= DESC */
{ yymsp[0].minor.yy48 = ORDER_DESC; }
-#line 7222 "sql.c"
break;
- case 592: /* null_ordering_opt ::= */
-#line 1164 "sql.y"
+ case 593: /* null_ordering_opt ::= */
{ yymsp[1].minor.yy687 = NULL_ORDER_DEFAULT; }
-#line 7227 "sql.c"
break;
- case 593: /* null_ordering_opt ::= NULLS FIRST */
-#line 1165 "sql.y"
+ case 594: /* null_ordering_opt ::= NULLS FIRST */
{ yymsp[-1].minor.yy687 = NULL_ORDER_FIRST; }
-#line 7232 "sql.c"
break;
- case 594: /* null_ordering_opt ::= NULLS LAST */
-#line 1166 "sql.y"
+ case 595: /* null_ordering_opt ::= NULLS LAST */
{ yymsp[-1].minor.yy687 = NULL_ORDER_LAST; }
-#line 7237 "sql.c"
break;
default:
break;
@@ -7296,7 +6179,6 @@ static void yy_syntax_error(
ParseCTX_FETCH
#define TOKEN yyminor
/************ Begin %syntax_error code ****************************************/
-#line 29 "sql.y"
if (TSDB_CODE_SUCCESS == pCxt->errCode) {
if(TOKEN.z) {
@@ -7307,7 +6189,6 @@ static void yy_syntax_error(
} else if (TSDB_CODE_PAR_DB_NOT_SPECIFIED == pCxt->errCode && TK_NK_FLOAT == TOKEN.type) {
pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_SYNTAX_ERROR, TOKEN.z);
}
-#line 7310 "sql.c"
/************ End %syntax_error code ******************************************/
ParseARG_STORE /* Suppress warning about unused %extra_argument variable */
ParseCTX_STORE
@@ -7393,56 +6274,12 @@ void Parse(
}
#endif
- while(1){ /* Exit by "break" */
- assert( yypParser->yytos>=yypParser->yystack );
+ do{
assert( yyact==yypParser->yytos->stateno );
yyact = yy_find_shift_action((YYCODETYPE)yymajor,yyact);
if( yyact >= YY_MIN_REDUCE ){
- unsigned int yyruleno = yyact - YY_MIN_REDUCE; /* Reduce by this rule */
- assert( yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) );
-#ifndef NDEBUG
- if( yyTraceFILE ){
- int yysize = yyRuleInfoNRhs[yyruleno];
- if( yysize ){
- fprintf(yyTraceFILE, "%sReduce %d [%s]%s, pop back to state %d.\n",
- yyTracePrompt,
- yyruleno, yyRuleName[yyruleno],
- yyrulenoyytos[yysize].stateno);
- }else{
- fprintf(yyTraceFILE, "%sReduce %d [%s]%s.\n",
- yyTracePrompt, yyruleno, yyRuleName[yyruleno],
- yyrulenoyytos - yypParser->yystack)>yypParser->yyhwm ){
- yypParser->yyhwm++;
- assert( yypParser->yyhwm ==
- (int)(yypParser->yytos - yypParser->yystack));
- }
-#endif
-#if YYSTACKDEPTH>0
- if( yypParser->yytos>=yypParser->yystackEnd ){
- yyStackOverflow(yypParser);
- break;
- }
-#else
- if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz-1] ){
- if( yyGrowStack(yypParser) ){
- yyStackOverflow(yypParser);
- break;
- }
- }
-#endif
- }
- yyact = yy_reduce(yypParser,yyruleno,yymajor,yyminor ParseCTX_PARAM);
+ yyact = yy_reduce(yypParser,yyact-YY_MIN_REDUCE,yymajor,
+ yyminor ParseCTX_PARAM);
}else if( yyact <= YY_MAX_SHIFTREDUCE ){
yy_shift(yypParser,yyact,(YYCODETYPE)yymajor,yyminor);
#ifndef YYNOERRORRECOVERY
@@ -7498,13 +6335,14 @@ void Parse(
yy_destructor(yypParser, (YYCODETYPE)yymajor, &yyminorunion);
yymajor = YYNOCODE;
}else{
- while( yypParser->yytos > yypParser->yystack ){
- yyact = yy_find_reduce_action(yypParser->yytos->stateno,
- YYERRORSYMBOL);
- if( yyact<=YY_MAX_SHIFTREDUCE ) break;
+ while( yypParser->yytos >= yypParser->yystack
+ && (yyact = yy_find_reduce_action(
+ yypParser->yytos->stateno,
+ YYERRORSYMBOL)) > YY_MAX_SHIFTREDUCE
+ ){
yy_pop_parser_stack(yypParser);
}
- if( yypParser->yytos <= yypParser->yystack || yymajor==0 ){
+ if( yypParser->yytos < yypParser->yystack || yymajor==0 ){
yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion);
yy_parse_failed(yypParser);
#ifndef YYNOERRORRECOVERY
@@ -7554,7 +6392,7 @@ void Parse(
break;
#endif
}
- }
+ }while( yypParser->yytos>yypParser->yystack );
#ifndef NDEBUG
if( yyTraceFILE ){
yyStackEntry *i;
diff --git a/source/libs/parser/test/parInitialCTest.cpp b/source/libs/parser/test/parInitialCTest.cpp
index a4e8bdd87a..f6dfa93ab2 100644
--- a/source/libs/parser/test/parInitialCTest.cpp
+++ b/source/libs/parser/test/parInitialCTest.cpp
@@ -885,12 +885,12 @@ TEST_F(ParserInitialCTest, createStream) {
setCreateStreamReq(
"s1", "test",
- "create stream if not exists s1 trigger max_delay 20s watermark 10s ignore expired 0 fill_history 1 ignore "
+ "create stream if not exists s1 trigger max_delay 20s watermark 10s ignore expired 0 fill_history 0 ignore "
"update 1 into st3 as select count(*) from t1 interval(10s)",
"st3", 1);
setStreamOptions(STREAM_CREATE_STABLE_TRUE, STREAM_TRIGGER_MAX_DELAY, 20 * MILLISECOND_PER_SECOND,
- 10 * MILLISECOND_PER_SECOND, 0, 1, 1);
- run("CREATE STREAM IF NOT EXISTS s1 TRIGGER MAX_DELAY 20s WATERMARK 10s IGNORE EXPIRED 0 FILL_HISTORY 1 IGNORE "
+ 10 * MILLISECOND_PER_SECOND, 0, 0, 1);
+ run("CREATE STREAM IF NOT EXISTS s1 TRIGGER MAX_DELAY 20s WATERMARK 10s IGNORE EXPIRED 0 FILL_HISTORY 0 IGNORE "
"UPDATE 1 INTO st3 AS SELECT COUNT(*) FROM t1 INTERVAL(10S)");
clearCreateStreamReq();
diff --git a/source/libs/parser/test/parSelectTest.cpp b/source/libs/parser/test/parSelectTest.cpp
index a770522921..68ded3afdd 100644
--- a/source/libs/parser/test/parSelectTest.cpp
+++ b/source/libs/parser/test/parSelectTest.cpp
@@ -117,6 +117,15 @@ TEST_F(ParserSelectTest, timelineFunc) {
run("SELECT LAST(*), FIRST(*) FROM t1 INTERVAL(10s)");
run("SELECT diff(c1) FROM t1");
+
+ run("select diff(ts) from (select _wstart as ts, count(*) from st1 partition by tbname interval(1d))", TSDB_CODE_PAR_NOT_ALLOWED_FUNC);
+
+ run("select diff(ts) from (select _wstart as ts, count(*) from st1 partition by tbname interval(1d) order by ts)");
+
+ run("select t1.* from st1s1 t1, (select _wstart as ts, count(*) from st1s2 partition by tbname interval(1d)) WHERE t1.ts = t2.ts", TSDB_CODE_PAR_NOT_SUPPORT_JOIN);
+
+ run("select t1.* from st1s1 t1, (select _wstart as ts, count(*) from st1s2 partition by tbname interval(1d) order by ts) t2 WHERE t1.ts = t2.ts");
+
}
TEST_F(ParserSelectTest, selectFunc) {
@@ -325,6 +334,10 @@ TEST_F(ParserSelectTest, subquery) {
run("SELECT SUM(a) FROM (SELECT MAX(c1) a, _wstart FROM st1s1 PARTITION BY TBNAME INTERVAL(1m) ORDER BY _WSTART) "
"INTERVAL(1n)");
+ run("SELECT diff(a) FROM (SELECT _wstart, tag1, tag2, MAX(c1) a FROM st1 PARTITION BY tag1 INTERVAL(1m)) PARTITION BY tag1");
+
+ run("SELECT diff(a) FROM (SELECT _wstart, tag1, tag2, MAX(c1) a FROM st1 PARTITION BY tag1 INTERVAL(1m)) PARTITION BY tag2", TSDB_CODE_PAR_NOT_ALLOWED_FUNC);
+
run("SELECT _C0 FROM (SELECT _ROWTS, ts FROM st1s1)");
run("SELECT ts FROM (SELECT t1.ts FROM st1s1 t1)");
diff --git a/source/libs/planner/src/planner.c b/source/libs/planner/src/planner.c
index 58b8e53478..2fcc8510d4 100644
--- a/source/libs/planner/src/planner.c
+++ b/source/libs/planner/src/planner.c
@@ -97,6 +97,12 @@ static int32_t setSubplanExecutionNode(SPhysiNode* pNode, int32_t groupId, SDown
return TSDB_CODE_SUCCESS;
}
+int32_t qContinuePlanPostQuery(void *pPostPlan) {
+ //TODO
+ return TSDB_CODE_SUCCESS;
+}
+
+
int32_t qSetSubplanExecutionNode(SSubplan* subplan, int32_t groupId, SDownstreamSourceNode* pSource) {
planDebug("QID:0x%" PRIx64 " set subplan execution node, groupId:%d", subplan->id.queryId, groupId);
return setSubplanExecutionNode(subplan->pNode, groupId, pSource);
diff --git a/source/libs/stream/inc/streamBackendRocksdb.h b/source/libs/stream/inc/streamBackendRocksdb.h
index 1cbd7b042c..da4e442f1a 100644
--- a/source/libs/stream/inc/streamBackendRocksdb.h
+++ b/source/libs/stream/inc/streamBackendRocksdb.h
@@ -122,12 +122,17 @@ char* streamDefaultIterKey_rocksdb(void* iter, int32_t* len);
char* streamDefaultIterVal_rocksdb(void* iter, int32_t* len);
// batch func
+int streamStateGetCfIdx(SStreamState* pState, const char* funcName);
void* streamStateCreateBatch();
int32_t streamStateGetBatchSize(void* pBatch);
void streamStateClearBatch(void* pBatch);
void streamStateDestroyBatch(void* pBatch);
int32_t streamStatePutBatch(SStreamState* pState, const char* cfName, rocksdb_writebatch_t* pBatch, void* key,
void* val, int32_t vlen, int64_t ttl);
+
+int32_t streamStatePutBatchOptimize(SStreamState* pState, int32_t cfIdx, rocksdb_writebatch_t* pBatch, void* key,
+ void* val, int32_t vlen, int64_t ttl, void* tmpBuf);
+
int32_t streamStatePutBatch_rocksdb(SStreamState* pState, void* pBatch);
// int32_t streamDefaultIter_rocksdb(SStreamState* pState, const void* start, const void* end, SArray* result);
#endif
\ No newline at end of file
diff --git a/source/libs/stream/src/streamBackendRocksdb.c b/source/libs/stream/src/streamBackendRocksdb.c
index df045eef20..cebe4e8204 100644
--- a/source/libs/stream/src/streamBackendRocksdb.c
+++ b/source/libs/stream/src/streamBackendRocksdb.c
@@ -81,6 +81,8 @@ const char* compareParKeyName(void* name);
const char* comparePartagKeyName(void* name);
void* streamBackendInit(const char* path) {
+ uint32_t dbMemLimit = nextPow2(tsMaxStreamBackendCache) << 20;
+
qDebug("start to init stream backend at %s", path);
SBackendHandle* pHandle = taosMemoryCalloc(1, sizeof(SBackendHandle));
pHandle->list = tdListNew(sizeof(SCfComparator));
@@ -90,19 +92,22 @@ void* streamBackendInit(const char* path) {
rocksdb_env_t* env = rocksdb_create_default_env(); // rocksdb_envoptions_create();
- rocksdb_cache_t* cache = rocksdb_cache_create_lru(64 << 20);
+ int32_t nBGThread = tsNumOfSnodeStreamThreads <= 2 ? 1 : tsNumOfSnodeStreamThreads / 2;
+ rocksdb_env_set_low_priority_background_threads(env, nBGThread);
+ rocksdb_env_set_high_priority_background_threads(env, nBGThread);
+
+ rocksdb_cache_t* cache = rocksdb_cache_create_lru(dbMemLimit / 2);
rocksdb_options_t* opts = rocksdb_options_create();
rocksdb_options_set_env(opts, env);
rocksdb_options_set_create_if_missing(opts, 1);
rocksdb_options_set_create_missing_column_families(opts, 1);
- rocksdb_options_set_write_buffer_size(opts, 48 << 20);
- rocksdb_options_set_max_total_wal_size(opts, 128 << 20);
+ rocksdb_options_set_max_total_wal_size(opts, dbMemLimit);
rocksdb_options_set_recycle_log_file_num(opts, 6);
- rocksdb_options_set_max_write_buffer_number(opts, 2);
+ rocksdb_options_set_max_write_buffer_number(opts, 3);
rocksdb_options_set_info_log_level(opts, 0);
- uint32_t dbLimit = nextPow2(tsMaxStreamBackendCache);
- rocksdb_options_set_db_write_buffer_size(opts, dbLimit << 20);
+ rocksdb_options_set_db_write_buffer_size(opts, dbMemLimit);
+ rocksdb_options_set_write_buffer_size(opts, dbMemLimit / 2);
pHandle->env = env;
pHandle->dbOpt = opts;
@@ -210,7 +215,6 @@ void streamBackendDelCompare(void* backend, void* arg) {
}
void streamStateDestroy_rocksdb(SStreamState* pState, bool remove) { streamStateCloseBackend(pState, remove); }
static bool streamStateIterSeekAndValid(rocksdb_iterator_t* iter, char* buf, size_t len);
-int streamGetInit(SStreamState* pState, const char* funcName);
// |key|-----value------|
// |key|ttl|len|userData|
@@ -557,14 +561,20 @@ typedef struct {
int32_t encodeValueFunc(void* value, int32_t vlen, int64_t ttl, char** dest) {
SStreamValue key = {.unixTimestamp = ttl, .len = vlen, .data = (char*)(value)};
-
- char* p = taosMemoryCalloc(1, sizeof(int64_t) + sizeof(int32_t) + key.len);
- char* buf = p;
- int32_t len = 0;
- len += taosEncodeFixedI64((void**)&buf, key.unixTimestamp);
- len += taosEncodeFixedI32((void**)&buf, key.len);
- len += taosEncodeBinary((void**)&buf, (char*)value, vlen);
- *dest = p;
+ int32_t len = 0;
+ if (*dest == NULL) {
+ char* p = taosMemoryCalloc(1, sizeof(int64_t) + sizeof(int32_t) + key.len);
+ char* buf = p;
+ len += taosEncodeFixedI64((void**)&buf, key.unixTimestamp);
+ len += taosEncodeFixedI32((void**)&buf, key.len);
+ len += taosEncodeBinary((void**)&buf, (char*)value, vlen);
+ *dest = p;
+ } else {
+ char* buf = *dest;
+ len += taosEncodeFixedI64((void**)&buf, key.unixTimestamp);
+ len += taosEncodeFixedI32((void**)&buf, key.len);
+ len += taosEncodeBinary((void**)&buf, (char*)value, vlen);
+ }
return len;
}
/*
@@ -713,7 +723,7 @@ int32_t streamStateOpenBackendCf(void* backend, char* name, char** cfs, int32_t
rocksdb_options_set_block_based_table_factory((rocksdb_options_t*)cfOpts[i], tableOpt);
params[i].tableOpt = tableOpt;
- int idx = streamGetInit(NULL, funcname);
+ int idx = streamStateGetCfIdx(NULL, funcname);
SCfInit* cfPara = &ginitDict[idx];
rocksdb_comparator_t* compare =
@@ -744,7 +754,7 @@ int32_t streamStateOpenBackendCf(void* backend, char* name, char** cfs, int32_t
char idstr[128] = {0};
sprintf(idstr, "0x%" PRIx64 "-%d", streamId, taskId);
- int idx = streamGetInit(NULL, funcname);
+ int idx = streamStateGetCfIdx(NULL, funcname);
RocksdbCfInst* inst = NULL;
RocksdbCfInst** pInst = taosHashGet(handle->cfInst, idstr, strlen(idstr) + 1);
@@ -872,7 +882,7 @@ int streamStateOpenBackend(void* backend, SStreamState* pState) {
taosThreadRwlockInit(&pState->pTdbState->rwLock, NULL);
SCfComparator compare = {.comp = pCompare, .numOfComp = cfLen};
pState->pTdbState->pComparNode = streamBackendAddCompare(handle, &compare);
- // rocksdb_writeoptions_disable_WAL(pState->pTdbState->writeOpts, 1);
+ rocksdb_writeoptions_disable_WAL(pState->pTdbState->writeOpts, 1);
qInfo("succ to open state %p on backend, %p, 0x%" PRIx64 "-%d", pState, handle, pState->streamId, pState->taskId);
return 0;
}
@@ -955,7 +965,7 @@ void streamStateDestroyCompar(void* arg) {
taosMemoryFree(comp->comp);
}
-int streamGetInit(SStreamState* pState, const char* funcName) {
+int streamStateGetCfIdx(SStreamState* pState, const char* funcName) {
int idx = -1;
size_t len = strlen(funcName);
for (int i = 0; i < sizeof(ginitDict) / sizeof(ginitDict[0]); i++) {
@@ -1002,7 +1012,7 @@ bool streamStateIterSeekAndValid(rocksdb_iterator_t* iter, char* buf, size_t len
}
rocksdb_iterator_t* streamStateIterCreate(SStreamState* pState, const char* cfName, rocksdb_snapshot_t** snapshot,
rocksdb_readoptions_t** readOpt) {
- int idx = streamGetInit(pState, cfName);
+ int idx = streamStateGetCfIdx(pState, cfName);
if (snapshot != NULL) {
*snapshot = (rocksdb_snapshot_t*)rocksdb_create_snapshot(pState->pTdbState->rocksdb);
@@ -1022,7 +1032,7 @@ rocksdb_iterator_t* streamStateIterCreate(SStreamState* pState, const char* cfNa
code = 0; \
char buf[128] = {0}; \
char* err = NULL; \
- int i = streamGetInit(pState, funcname); \
+ int i = streamStateGetCfIdx(pState, funcname); \
if (i < 0) { \
qWarn("streamState failed to get cf name: %s", funcname); \
code = -1; \
@@ -1053,7 +1063,7 @@ rocksdb_iterator_t* streamStateIterCreate(SStreamState* pState, const char* cfNa
code = 0; \
char buf[128] = {0}; \
char* err = NULL; \
- int i = streamGetInit(pState, funcname); \
+ int i = streamStateGetCfIdx(pState, funcname); \
if (i < 0) { \
qWarn("streamState failed to get cf name: %s", funcname); \
code = -1; \
@@ -1101,7 +1111,7 @@ rocksdb_iterator_t* streamStateIterCreate(SStreamState* pState, const char* cfNa
code = 0; \
char buf[128] = {0}; \
char* err = NULL; \
- int i = streamGetInit(pState, funcname); \
+ int i = streamStateGetCfIdx(pState, funcname); \
if (i < 0) { \
qWarn("streamState failed to get cf name: %s_%s", pState->pTdbState->idstr, funcname); \
code = -1; \
@@ -2041,7 +2051,7 @@ void streamStateClearBatch(void* pBatch) { rocksdb_writebatch_clear((rocksdb_
void streamStateDestroyBatch(void* pBatch) { rocksdb_writebatch_destroy((rocksdb_writebatch_t*)pBatch); }
int32_t streamStatePutBatch(SStreamState* pState, const char* cfName, rocksdb_writebatch_t* pBatch, void* key,
void* val, int32_t vlen, int64_t ttl) {
- int i = streamGetInit(pState, cfName);
+ int i = streamStateGetCfIdx(pState, cfName);
if (i < 0) {
qError("streamState failed to put to cf name:%s", cfName);
@@ -2057,6 +2067,21 @@ int32_t streamStatePutBatch(SStreamState* pState, const char* cfName, rocksdb_wr
taosMemoryFree(ttlV);
return 0;
}
+int32_t streamStatePutBatchOptimize(SStreamState* pState, int32_t cfIdx, rocksdb_writebatch_t* pBatch, void* key,
+ void* val, int32_t vlen, int64_t ttl, void* tmpBuf) {
+ char buf[128] = {0};
+ int32_t klen = ginitDict[cfIdx].enFunc((void*)key, buf);
+ char* ttlV = tmpBuf;
+ int32_t ttlVLen = ginitDict[cfIdx].enValueFunc(val, vlen, ttl, &ttlV);
+
+ rocksdb_column_family_handle_t* pCf = pState->pTdbState->pHandle[ginitDict[cfIdx].idx];
+ rocksdb_writebatch_put_cf((rocksdb_writebatch_t*)pBatch, pCf, buf, (size_t)klen, ttlV, (size_t)ttlVLen);
+
+ if (tmpBuf == NULL) {
+ taosMemoryFree(ttlV);
+ }
+ return 0;
+}
int32_t streamStatePutBatch_rocksdb(SStreamState* pState, void* pBatch) {
char* err = NULL;
rocksdb_write(pState->pTdbState->rocksdb, pState->pTdbState->writeOpts, (rocksdb_writebatch_t*)pBatch, &err);
diff --git a/source/libs/stream/src/streamDispatch.c b/source/libs/stream/src/streamDispatch.c
index 9cb0a56644..922a1f5345 100644
--- a/source/libs/stream/src/streamDispatch.c
+++ b/source/libs/stream/src/streamDispatch.c
@@ -15,6 +15,13 @@
#include "streamInc.h"
+#define MAX_BLOCK_NAME_NUM 1024
+
+typedef struct SBlockName {
+ uint32_t hashValue;
+ char parTbName[TSDB_TABLE_NAME_LEN];
+} SBlockName;
+
int32_t tEncodeStreamDispatchReq(SEncoder* pEncoder, const SStreamDispatchReq* pReq) {
if (tStartEncode(pEncoder) < 0) return -1;
if (tEncodeI64(pEncoder, pReq->streamId) < 0) return -1;
@@ -331,26 +338,46 @@ FAIL:
int32_t streamSearchAndAddBlock(SStreamTask* pTask, SStreamDispatchReq* pReqs, SSDataBlock* pDataBlock, int32_t vgSz,
int64_t groupId) {
- char* ctbName = taosMemoryCalloc(1, TSDB_TABLE_FNAME_LEN);
- if (ctbName == NULL) {
- return -1;
- }
-
- if (pDataBlock->info.parTbName[0]) {
- snprintf(ctbName, TSDB_TABLE_NAME_LEN, "%s.%s", pTask->shuffleDispatcher.dbInfo.db, pDataBlock->info.parTbName);
- } else {
- char* ctbShortName = buildCtbNameByGroupId(pTask->shuffleDispatcher.stbFullName, groupId);
- snprintf(ctbName, TSDB_TABLE_NAME_LEN, "%s.%s", pTask->shuffleDispatcher.dbInfo.db, ctbShortName);
- taosMemoryFree(ctbShortName);
- }
-
+ uint32_t hashValue = 0;
SArray* vgInfo = pTask->shuffleDispatcher.dbInfo.pVgroupInfos;
+ if (pTask->pNameMap == NULL) {
+ pTask->pNameMap = tSimpleHashInit(1024, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT));
+ }
- /*uint32_t hashValue = MurmurHash3_32(ctbName, strlen(ctbName));*/
- SUseDbRsp* pDbInfo = &pTask->shuffleDispatcher.dbInfo;
- uint32_t hashValue =
- taosGetTbHashVal(ctbName, strlen(ctbName), pDbInfo->hashMethod, pDbInfo->hashPrefix, pDbInfo->hashSuffix);
- taosMemoryFree(ctbName);
+ void* pVal = tSimpleHashGet(pTask->pNameMap, &groupId, sizeof(int64_t));
+ if (pVal) {
+ SBlockName* pBln = (SBlockName*)pVal;
+ hashValue = pBln->hashValue;
+ if (!pDataBlock->info.parTbName[0]) {
+ memcpy(pDataBlock->info.parTbName, pBln->parTbName, strlen(pBln->parTbName));
+ }
+ } else {
+ char* ctbName = taosMemoryCalloc(1, TSDB_TABLE_FNAME_LEN);
+ if (ctbName == NULL) {
+ return -1;
+ }
+
+ if (pDataBlock->info.parTbName[0]) {
+ snprintf(ctbName, TSDB_TABLE_NAME_LEN, "%s.%s", pTask->shuffleDispatcher.dbInfo.db, pDataBlock->info.parTbName);
+ } else {
+ buildCtbNameByGroupIdImpl(pTask->shuffleDispatcher.stbFullName, groupId, pDataBlock->info.parTbName);
+ snprintf(ctbName, TSDB_TABLE_NAME_LEN, "%s.%s", pTask->shuffleDispatcher.dbInfo.db, pDataBlock->info.parTbName);
+ }
+
+ SArray* vgInfo = pTask->shuffleDispatcher.dbInfo.pVgroupInfos;
+
+ /*uint32_t hashValue = MurmurHash3_32(ctbName, strlen(ctbName));*/
+ SUseDbRsp* pDbInfo = &pTask->shuffleDispatcher.dbInfo;
+ hashValue =
+ taosGetTbHashVal(ctbName, strlen(ctbName), pDbInfo->hashMethod, pDbInfo->hashPrefix, pDbInfo->hashSuffix);
+ taosMemoryFree(ctbName);
+ SBlockName bln = {0};
+ bln.hashValue = hashValue;
+ memcpy(bln.parTbName, pDataBlock->info.parTbName, strlen(pDataBlock->info.parTbName));
+ if (tSimpleHashGetSize(pTask->pNameMap) < MAX_BLOCK_NAME_NUM) {
+ tSimpleHashPut(pTask->pNameMap, &groupId, sizeof(int64_t), &bln, sizeof(SBlockName));
+ }
+ }
bool found = false;
// TODO: optimize search
diff --git a/source/libs/stream/src/streamTask.c b/source/libs/stream/src/streamTask.c
index a0caffd41f..284d1ecab6 100644
--- a/source/libs/stream/src/streamTask.c
+++ b/source/libs/stream/src/streamTask.c
@@ -224,5 +224,9 @@ void tFreeStreamTask(SStreamTask* pTask) {
taosMemoryFree((void*)pTask->id.idStr);
}
+ if (pTask->pNameMap) {
+ tSimpleHashCleanup(pTask->pNameMap);
+ }
+
taosMemoryFree(pTask);
}
diff --git a/source/libs/stream/src/tstreamFileState.c b/source/libs/stream/src/tstreamFileState.c
index bfaeca89f6..dc9a1f80bb 100644
--- a/source/libs/stream/src/tstreamFileState.c
+++ b/source/libs/stream/src/tstreamFileState.c
@@ -350,6 +350,11 @@ int32_t flushSnapshot(SStreamFileState* pFileState, SStreamSnapshot* pSnapshot,
const int32_t BATCH_LIMIT = 256;
SListNode* pNode = NULL;
+ int idx = streamStateGetCfIdx(pFileState->pFileStore, "state");
+
+ int32_t len = pFileState->rowSize + sizeof(uint64_t) + sizeof(int32_t) + 1;
+ char* buf = taosMemoryCalloc(1, len);
+
void* batch = streamStateCreateBatch();
while ((pNode = tdListNext(&iter)) != NULL && code == TSDB_CODE_SUCCESS) {
SRowBuffPos* pPos = *(SRowBuffPos**)pNode->data;
@@ -360,9 +365,13 @@ int32_t flushSnapshot(SStreamFileState* pFileState, SStreamSnapshot* pSnapshot,
}
SStateKey sKey = {.key = *((SWinKey*)pPos->pKey), .opNum = ((SStreamState*)pFileState->pFileStore)->number};
- code = streamStatePutBatch(pFileState->pFileStore, "state", batch, &sKey, pPos->pRowBuff, pFileState->rowSize, 0);
+ code = streamStatePutBatchOptimize(pFileState->pFileStore, idx, batch, &sKey, pPos->pRowBuff, pFileState->rowSize,
+ 0, buf);
+ memset(buf, 0, len);
qDebug("===stream===put %" PRId64 " to disc, res %d", sKey.key.ts, code);
}
+ taosMemoryFree(buf);
+
if (streamStateGetBatchSize(batch) > 0) {
code = streamStatePutBatch_rocksdb(pFileState->pFileStore, batch);
}
diff --git a/source/libs/sync/src/syncMain.c b/source/libs/sync/src/syncMain.c
index f64c2a9560..ccf7c3e4a4 100644
--- a/source/libs/sync/src/syncMain.c
+++ b/source/libs/sync/src/syncMain.c
@@ -618,8 +618,7 @@ int32_t syncNodePropose(SSyncNode* pSyncNode, SRpcMsg* pMsg, bool isWeak, int64_
return -1;
}
- // not restored, vnode enable
- if (!pSyncNode->restoreFinish && pSyncNode->vgId != 1) {
+ if (!pSyncNode->restoreFinish) {
terrno = TSDB_CODE_SYN_PROPOSE_NOT_READY;
sNError(pSyncNode, "failed to sync propose since not ready, type:%s, last:%" PRId64 ", cmt:%" PRId64,
TMSG_INFO(pMsg->msgType), syncNodeGetLastIndex(pSyncNode), pSyncNode->commitIndex);
diff --git a/source/libs/wal/src/walRef.c b/source/libs/wal/src/walRef.c
index eb36389f1d..2f1bcfee83 100644
--- a/source/libs/wal/src/walRef.c
+++ b/source/libs/wal/src/walRef.c
@@ -81,26 +81,11 @@ void walRefLastVer(SWal *pWal, SWalRef *pRef) {
wDebug("vgId:%d, wal ref version %" PRId64 " for last", pWal->cfg.vgId, ver);
}
-SWalRef *walRefCommittedVer(SWal *pWal) {
- SWalRef *pRef = walOpenRef(pWal);
- if (pRef == NULL) {
- terrno = TSDB_CODE_OUT_OF_MEMORY;
- return NULL;
- }
+void walRefCommitVer(SWal *pWal, SWalRef *pRef) {
taosThreadMutexLock(&pWal->mutex);
-
int64_t ver = walGetCommittedVer(pWal);
-
- wDebug("vgId:%d, wal ref version %" PRId64 " for committed", pWal->cfg.vgId, ver);
-
pRef->refVer = ver;
- // bsearch in fileSet
- SWalFileInfo tmpInfo;
- tmpInfo.firstVer = ver;
- SWalFileInfo *pRet = taosArraySearch(pWal->fileInfoSet, &tmpInfo, compareWalFileInfo, TD_LE);
- ASSERT(pRet != NULL);
- // pRef->refFile = pRet->firstVer;
taosThreadMutexUnlock(&pWal->mutex);
- return pRef;
+ wDebug("vgId:%d, wal ref version %" PRId64 " for committed", pWal->cfg.vgId, ver);
}
diff --git a/source/util/src/tarray.c b/source/util/src/tarray.c
index 6c7c5ddb0d..8906391a9a 100644
--- a/source/util/src/tarray.c
+++ b/source/util/src/tarray.c
@@ -476,13 +476,13 @@ int32_t taosEncodeArray(void** buf, const SArray* pArray, FEncode encode) {
return tlen;
}
-void* taosDecodeArray(const void* buf, SArray** pArray, FDecode decode, int32_t dataSz) {
+void* taosDecodeArray(const void* buf, SArray** pArray, FDecode decode, int32_t dataSz, int8_t sver) {
int32_t sz;
buf = taosDecodeFixedI32(buf, &sz);
*pArray = taosArrayInit(sz, sizeof(void*));
for (int32_t i = 0; i < sz; i++) {
void* data = taosMemoryCalloc(1, dataSz);
- buf = decode(buf, data);
+ buf = decode(buf, data, sver);
taosArrayPush(*pArray, &data);
}
return (void*)buf;
diff --git a/source/util/src/terror.c b/source/util/src/terror.c
index 9abdeac877..a66af6e732 100644
--- a/source/util/src/terror.c
+++ b/source/util/src/terror.c
@@ -275,7 +275,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_MND_TRANS_CONFLICT, "Conflict transaction
TAOS_DEFINE_ERROR(TSDB_CODE_MND_TRANS_CLOG_IS_NULL, "Transaction commitlog is null")
TAOS_DEFINE_ERROR(TSDB_CODE_MND_TRANS_NETWORK_UNAVAILL, "Unable to establish connection While execute transaction and will continue in the background")
TAOS_DEFINE_ERROR(TSDB_CODE_MND_LAST_TRANS_NOT_FINISHED, "Last Transaction not finished")
-TAOS_DEFINE_ERROR(TSDB_CODE_MND_TRNAS_SYNC_TIMEOUT, "Sync timeout While execute transaction and will continue in the background")
+TAOS_DEFINE_ERROR(TSDB_CODE_MND_TRANS_SYNC_TIMEOUT, "Sync timeout While execute transaction and will continue in the background")
TAOS_DEFINE_ERROR(TSDB_CODE_MND_TRANS_UNKNOW_ERROR, "Unknown transaction error")
// mnode-mq
@@ -542,7 +542,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_TIMELINE_FUNC, "Invalid timeline fu
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_PASSWD, "Invalid password")
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_ALTER_TABLE, "Invalid alter table statement")
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_CANNOT_DROP_PRIMARY_KEY, "Primary timestamp column cannot be dropped")
-TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_MODIFY_COL, "Only binary/nchar column length could be modified, and the length can only be increased, not decreased")
+TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_MODIFY_COL, "Only binary/nchar/geometry column length could be modified, and the length can only be increased, not decreased")
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_TBNAME, "Invalid tbname pseudo column")
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_FUNCTION_NAME, "Invalid function name")
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_COMMENT_TOO_LONG, "Comment too long")
diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task
index 37910d338c..cd47cb2d16 100644
--- a/tests/parallel_test/cases.task
+++ b/tests/parallel_test/cases.task
@@ -617,6 +617,8 @@
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/rowlength64k_4.py -Q 2
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/rowlength64k_4.py -Q 3
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/rowlength64k_4.py -Q 4
+,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/precisionUS.py
+,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/precisionNS.py
,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/show.py
,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/information_schema.py
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/abs.py
diff --git a/tests/script/tsim/sma/tsmaCreateInsertQuery.sim b/tests/script/tsim/sma/tsmaCreateInsertQuery.sim
index 242231e408..60f769d2ae 100644
--- a/tests/script/tsim/sma/tsmaCreateInsertQuery.sim
+++ b/tests/script/tsim/sma/tsmaCreateInsertQuery.sim
@@ -340,6 +340,80 @@ if $data05 != 30.000000000 then
return -1
endi
+print =============== select with _wstart/order by _wstart from stb from file in designated vgroup
+sql select _wstart, _wend, min(c1),max(c2),max(c1) from stb interval(5m,10s) sliding(5m) order by _wstart;
+print $data00 $data01 $data02 $data03 $data04
+if $rows != 1 then
+ print rows $rows != 1
+ return -1
+endi
+
+if $data02 != -13 then
+ print data02 $data02 != -13
+ return -1
+endi
+
+if $data03 != 20.00000 then
+ print data03 $data03 != 20.00000
+ return -1
+endi
+
+if $data04 != 20 then
+ print data04 $data04 != 20
+ return -1
+endi
+
+print =============== select without _wstart/with order by _wstart from stb from file in designated vgroup
+sql select _wend, min(c1),max(c2),max(c1) from stb interval(5m,10s) sliding(5m) order by _wstart;
+print $data00 $data01 $data02 $data03
+if $rows != 1 then
+ print rows $rows != 1
+ return -1
+endi
+
+if $data01 != -13 then
+ print data01 $data01 != -13
+ return -1
+endi
+
+if $data02 != 20.00000 then
+ print data02 $data02 != 20.00000
+ return -1
+endi
+
+if $data03 != 20 then
+ print data03 $data03 != 20
+ return -1
+endi
+
+print =============== select * from stb from file in common vgroups
+sql select _wstart, _wend, min(c1),max(c2),max(c1),max(c3) from stb interval(5m,10s) sliding(5m) order by _wstart;
+print $data00 $data01 $data02 $data03 $data04 $data05
+if $rows != 1 then
+ print rows $rows != 1
+ return -1
+endi
+
+if $data02 != -13 then
+ print data02 $data02 != -13
+ return -1
+endi
+
+if $data03 != 20.00000 then
+ print data03 $data03 != 20.00000
+ return -1
+endi
+
+if $data04 != 20 then
+ print data04 $data04 != 20
+ return -1
+endi
+
+if $data05 != 30.000000000 then
+ print data05 $data05 != 30.000000000
+ return -1
+endi
+
system sh/exec.sh -n dnode1 -s stop -x SIGINT
diff --git a/tests/script/tsim/stream/ignoreExpiredData.sim b/tests/script/tsim/stream/ignoreExpiredData.sim
index 27920dd539..884b7cbb5f 100644
--- a/tests/script/tsim/stream/ignoreExpiredData.sim
+++ b/tests/script/tsim/stream/ignoreExpiredData.sim
@@ -132,12 +132,12 @@ if $loop_count == 10 then
return -1
endi
-if $data01 != 1 then
+if $data01 != 2 then
print =====data01=$data01
goto loop4
endi
-if $data02 != 1 then
+if $data02 != 2 then
print =====data02=$data02
goto loop4
endi
diff --git a/tests/script/tsim/user/privilege_create_db.sim b/tests/script/tsim/user/privilege_create_db.sim
new file mode 100644
index 0000000000..c81bd1b258
--- /dev/null
+++ b/tests/script/tsim/user/privilege_create_db.sim
@@ -0,0 +1,97 @@
+system sh/stop_dnodes.sh
+system sh/deploy.sh -n dnode1 -i 1
+system sh/exec.sh -n dnode1 -s start
+sql connect
+
+print ========================root user create user
+sql create user u1 pass "taosdata"
+sql create user u2 pass "taosdata"
+sql create database test
+sql select * from information_schema.ins_user_privileges where user_name == "root"
+if $rows != 1 then
+ return -1
+endi
+
+print =============connect with u1
+sql connect u1
+sql create database u1_d1
+sql use u1_d1
+sql create table u1_d1.t1(ts timestamp, c2 int)
+sql use information_schema
+sql select * from ins_user_privileges where user_name == "u1" order by privilege
+if $rows != 2 then
+ return -1
+endi
+if $data01 != read then
+ return -1
+endi
+if $data11 != write then
+ return -1
+endi
+if $data02 != u1_d1 then
+ return -1
+endi
+if $data12 != u1_d1 then
+ return -1
+endi
+
+sql_error grant all on *.* to u1
+sql_error grant all on test.* to u1
+
+print =============connect with u2
+sql connect u2
+sql create database u2_d1
+sql use u2_d1
+sql create table u2_d1.t1(ts timestamp, c2 int)
+sql use information_schema
+sql select * from ins_user_privileges where user_name == "u2" order by privilege
+if $rows != 2 then
+ return -1
+endi
+if $data01 != read then
+ return -1
+endi
+if $data11 != write then
+ return -1
+endi
+if $data02 != u2_d1 then
+ return -1
+endi
+if $data12 != u2_d1 then
+ return -1
+endi
+
+sql_error select * from u1_d1.t1
+sql_error revoke read on u2_d1.* from u2
+
+print =============connect with root, revoke read from u1, all from u2
+sql connect
+sql revoke read on u1_d1.* from u1
+sql revoke all on u2_d1.* from u2
+sleep 1000
+
+print =============connect with u1
+sql connect u1
+sql insert into u1_d1.t1 values(now, 1)
+sql_error select * from u1_d1.t1;
+
+print =============connect with u2
+sql connect u2
+sql_error select * from u2_d1.t1;
+sql_error insert into u2_d1.t1 values(now, 1)
+
+print =============connect with root, grant read to u1, all to u2
+sql connect
+sql grant read on u1_d1.* to u1
+sql grant all on u2_d1.* to u2
+
+sleep 1000
+print =============connect with u1
+sql connect u1
+sql select * from u1_d1.t1;
+sql insert into u1_d1.t1 values(now, 2)
+
+print =============connect with u2
+sql connect u2
+sql select * from u2_d1.t1;
+sql insert into u2_d1.t1 values(now, 2)
diff --git a/tests/script/win-test-file b/tests/script/win-test-file
index b7fbbed5c1..adef71cb45 100644
--- a/tests/script/win-test-file
+++ b/tests/script/win-test-file
@@ -4,6 +4,7 @@
./test.sh -f tsim/user/privilege_sysinfo.sim
./test.sh -f tsim/user/privilege_topic.sim
./test.sh -f tsim/user/privilege_table.sim
+./test.sh -f tsim/user/privilege_create_db.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
diff --git a/tests/system-test/1-insert/precisionNS.py b/tests/system-test/1-insert/precisionNS.py
new file mode 100644
index 0000000000..be8f1e21dc
--- /dev/null
+++ b/tests/system-test/1-insert/precisionNS.py
@@ -0,0 +1,293 @@
+###################################################################
+# Copyright (c) 2016 by TAOS Technologies, Inc.
+# All rights reserved.
+#
+# This file is proprietary and confidential to TAOS Technologies.
+# No part of this file may be reproduced, stored, transmitted,
+# disclosed or used in any form or by any means other than as
+# expressly provided by the written permission from Jianhui Tao
+#
+###################################################################
+
+# -*- coding: utf-8 -*-
+
+import sys
+import random
+import time
+
+import taos
+from util.log import *
+from util.cases import *
+from util.sql import *
+
+class TDTestCase:
+
+ # get col value and total max min ...
+ def getColsValue(self, i, j):
+ # c1 value
+ if random.randint(1, 10) == 5:
+ c1 = None
+ else:
+ c1 = 1
+
+ # c2 value
+ if j % 3200 == 0:
+ c2 = 8764231
+ elif random.randint(1, 10) == 5:
+ c2 = None
+ else:
+ c2 = random.randint(-87654297, 98765321)
+
+
+ value = f"({self.ts}, "
+
+ # c1
+ if c1 is None:
+ value += "null,"
+ else:
+ self.c1Cnt += 1
+ value += f"{c1},"
+ # c2
+ if c2 is None:
+ value += "null,"
+ else:
+ value += f"{c2},"
+ # total count
+ self.c2Cnt += 1
+ # max
+ if self.c2Max is None:
+ self.c2Max = c2
+ else:
+ if c2 > self.c2Max:
+ self.c2Max = c2
+ # min
+ if self.c2Min is None:
+ self.c2Min = c2
+ else:
+ if c2 < self.c2Min:
+ self.c2Min = c2
+ # sum
+ if self.c2Sum is None:
+ self.c2Sum = c2
+ else:
+ self.c2Sum += c2
+
+ # c3 same with ts
+ value += f"{self.ts})"
+
+ # move next
+ self.ts += 1
+
+ return value
+
+ # insert data
+ def insertData(self):
+ tdLog.info("insert data ....")
+ sqls = ""
+ for i in range(self.childCnt):
+ # insert child table
+ values = ""
+ pre_insert = f"insert into t{i} values "
+ for j in range(self.childRow):
+ if values == "":
+ values = self.getColsValue(i, j)
+ else:
+ values += "," + self.getColsValue(i, j)
+
+ # batch insert
+ if j % self.batchSize == 0 and values != "":
+ sql = pre_insert + values
+ tdSql.execute(sql)
+ values = ""
+ # append last
+ if values != "":
+ sql = pre_insert + values
+ tdSql.execute(sql)
+ values = ""
+
+ sql = "flush database db;"
+ tdLog.info(sql)
+ tdSql.execute(sql)
+ # insert finished
+ tdLog.info(f"insert data successfully.\n"
+ f" inserted child table = {self.childCnt}\n"
+ f" inserted child rows = {self.childRow}\n"
+ f" total inserted rows = {self.childCnt*self.childRow}\n")
+ return
+
+
+ # prepareEnv
+ def prepareEnv(self):
+ # init
+ self.ts = 1680000000000*1000*1000
+ self.childCnt = 5
+ self.childRow = 10000
+ self.batchSize = 5000
+
+ # total
+ self.c1Cnt = 0
+ self.c2Cnt = 0
+ self.c2Max = None
+ self.c2Min = None
+ self.c2Sum = None
+
+ # create database db
+ sql = f"create database db vgroups 2 precision 'ns' "
+ tdLog.info(sql)
+ tdSql.execute(sql)
+ sql = f"use db"
+ tdSql.execute(sql)
+
+ # create super talbe st
+ sql = f"create table st(ts timestamp, c1 int, c2 bigint, ts1 timestamp) tags(area int)"
+ tdLog.info(sql)
+ tdSql.execute(sql)
+
+ # create child table
+ for i in range(self.childCnt):
+ sql = f"create table t{i} using st tags({i}) "
+ tdSql.execute(sql)
+
+ # create stream
+ sql = "create stream ma into sta as select count(ts) from st interval(100b)"
+ tdLog.info(sql)
+ tdSql.execute(sql)
+
+ # insert data
+ self.insertData()
+
+ # check data correct
+ def checkExpect(self, sql, expectVal):
+ tdSql.query(sql)
+ rowCnt = tdSql.getRows()
+ for i in range(rowCnt):
+ val = tdSql.getData(i,0)
+ if val != expectVal:
+ tdLog.exit(f"Not expect . query={val} expect={expectVal} i={i} sql={sql}")
+ return False
+
+ tdLog.info(f"check expect ok. sql={sql} expect ={expectVal} rowCnt={rowCnt}")
+ return True
+
+
+
+
+ # check time macro
+ def checkTimeMacro(self):
+ # 2 week
+ val = 2
+ nsval = val*7*24*60*60*1000*1000*1000
+ expectVal = self.childCnt * self.childRow
+ sql = f"select count(ts) from st where timediff(ts - {val}w, ts1) = {nsval} "
+ self.checkExpect(sql, expectVal)
+
+ # 20 day
+ val = 20
+ nsval = val*24*60*60*1000*1000*1000
+ uint = "d"
+ sql = f"select count(ts) from st where timediff(ts - {val}{uint}, ts1) = {nsval} "
+ self.checkExpect(sql, expectVal)
+
+ # 30 hour
+ val = 30
+ nsval = val*60*60*1000*1000*1000
+ uint = "h"
+ sql = f"select count(ts) from st where timediff(ts - {val}{uint}, ts1) = {nsval} "
+ self.checkExpect(sql, expectVal)
+
+ # 90 minutes
+ val = 90
+ nsval = val*60*1000*1000*1000
+ uint = "m"
+ sql = f"select count(ts) from st where timediff(ts - {val}{uint}, ts1) = {nsval} "
+ self.checkExpect(sql, expectVal)
+ # 2s
+ val = 2
+ nsval = val*1000*1000*1000
+ uint = "s"
+ sql = f"select count(ts) from st where timediff(ts - {val}{uint}, ts1) = {nsval} "
+ self.checkExpect(sql, expectVal)
+ # 20a
+ val = 5
+ nsval = val*1000*1000
+ uint = "a"
+ sql = f"select count(ts) from st where timediff(ts - {val}{uint}, ts1) = {nsval} "
+ self.checkExpect(sql, expectVal)
+ # 300u
+ val = 300
+ nsval = val*1000
+ uint = "u"
+ sql = f"select count(ts) from st where timediff(ts - {val}{uint}, ts1) = {nsval} "
+ self.checkExpect(sql, expectVal)
+ # 8b
+ val = 8
+ sql = f"select timediff(ts - {val}b, ts1) from st "
+ self.checkExpect(sql, val)
+
+ # init
+ def init(self, conn, logSql, replicaVar=1):
+ seed = time.clock_gettime(time.CLOCK_REALTIME)
+ random.seed(seed)
+ self.replicaVar = int(replicaVar)
+ tdLog.debug(f"start to excute {__file__}")
+ tdSql.init(conn.cursor(), True)
+
+ # where
+ def checkWhere(self):
+ cnt = 300
+ start = self.ts - cnt
+ sql = f"select count(ts) from st where ts >= {start} and ts <= {self.ts}"
+ self.checkExpect(sql, cnt)
+
+ for i in range(50):
+ cnt = random.randint(1,40000)
+ base = 2000
+ start = self.ts - cnt - base
+ end = self.ts - base
+ sql = f"select count(ts) from st where ts >= {start} and ts < {end}"
+ self.checkExpect(sql, cnt)
+
+ # stream
+ def checkStream(self):
+ allRows = self.childCnt * self.childRow
+ # ensure write data is expected
+ sql = "select count(*) from (select diff(ts) as a from (select ts from st order by ts asc)) where a=1;"
+ self.checkExpect(sql, allRows - 1)
+
+ # stream count is ok
+ sql =f"select count(*) from sta"
+ cnt = int(allRows / 100) - 1 # last window is not close, so need reduce one
+ self.checkExpect(sql, cnt)
+
+ # check fields
+ sql =f"select count(*) from sta where `count(ts)` != 100"
+ self.checkExpect(sql, 0)
+
+ # check timestamp
+ sql =f"select count(*) from (select diff(`_wstart`) from sta)"
+ self.checkExpect(sql, cnt - 1)
+ sql =f"select count(*) from (select diff(`_wstart`) as a from sta) where a != 100"
+ self.checkExpect(sql, 0)
+
+ # run
+ def run(self):
+ # prepare env
+ self.prepareEnv()
+
+ # time macro like 1w 1d 1h 1m 1s 1a 1u 1b
+ self.checkTimeMacro()
+
+ # check where
+ self.checkWhere()
+
+ # check stream
+ self.checkStream()
+
+ # stop
+ def stop(self):
+ tdSql.close()
+ tdLog.success(f"{__file__} successfully executed")
+
+
+tdCases.addLinux(__file__, TDTestCase())
+tdCases.addWindows(__file__, TDTestCase())
diff --git a/tests/system-test/1-insert/precisionUS.py b/tests/system-test/1-insert/precisionUS.py
new file mode 100644
index 0000000000..1b41d66010
--- /dev/null
+++ b/tests/system-test/1-insert/precisionUS.py
@@ -0,0 +1,287 @@
+###################################################################
+# Copyright (c) 2016 by TAOS Technologies, Inc.
+# All rights reserved.
+#
+# This file is proprietary and confidential to TAOS Technologies.
+# No part of this file may be reproduced, stored, transmitted,
+# disclosed or used in any form or by any means other than as
+# expressly provided by the written permission from Jianhui Tao
+#
+###################################################################
+
+# -*- coding: utf-8 -*-
+
+import sys
+import random
+import time
+
+import taos
+from util.log import *
+from util.cases import *
+from util.sql import *
+
+class TDTestCase:
+
+ # get col value and total max min ...
+ def getColsValue(self, i, j):
+ # c1 value
+ if random.randint(1, 10) == 5:
+ c1 = None
+ else:
+ c1 = 1
+
+ # c2 value
+ if j % 3200 == 0:
+ c2 = 8764231
+ elif random.randint(1, 10) == 5:
+ c2 = None
+ else:
+ c2 = random.randint(-87654297, 98765321)
+
+
+ value = f"({self.ts}, "
+
+ # c1
+ if c1 is None:
+ value += "null,"
+ else:
+ self.c1Cnt += 1
+ value += f"{c1},"
+ # c2
+ if c2 is None:
+ value += "null,"
+ else:
+ value += f"{c2},"
+ # total count
+ self.c2Cnt += 1
+ # max
+ if self.c2Max is None:
+ self.c2Max = c2
+ else:
+ if c2 > self.c2Max:
+ self.c2Max = c2
+ # min
+ if self.c2Min is None:
+ self.c2Min = c2
+ else:
+ if c2 < self.c2Min:
+ self.c2Min = c2
+ # sum
+ if self.c2Sum is None:
+ self.c2Sum = c2
+ else:
+ self.c2Sum += c2
+
+ # c3 same with ts
+ value += f"{self.ts})"
+
+ # move next
+ self.ts += 1
+
+ return value
+
+ # insert data
+ def insertData(self):
+ tdLog.info("insert data ....")
+ sqls = ""
+ for i in range(self.childCnt):
+ # insert child table
+ values = ""
+ pre_insert = f"insert into t{i} values "
+ for j in range(self.childRow):
+ if values == "":
+ values = self.getColsValue(i, j)
+ else:
+ values += "," + self.getColsValue(i, j)
+
+ # batch insert
+ if j % self.batchSize == 0 and values != "":
+ sql = pre_insert + values
+ tdSql.execute(sql)
+ values = ""
+ # append last
+ if values != "":
+ sql = pre_insert + values
+ tdSql.execute(sql)
+ values = ""
+
+ sql = "flush database db;"
+ tdLog.info(sql)
+ tdSql.execute(sql)
+ # insert finished
+ tdLog.info(f"insert data successfully.\n"
+ f" inserted child table = {self.childCnt}\n"
+ f" inserted child rows = {self.childRow}\n"
+ f" total inserted rows = {self.childCnt*self.childRow}\n")
+ return
+
+
+ # prepareEnv
+ def prepareEnv(self):
+ # init
+ self.ts = 1680000000000*1000
+ self.childCnt = 5
+ self.childRow = 10000
+ self.batchSize = 5000
+
+ # total
+ self.c1Cnt = 0
+ self.c2Cnt = 0
+ self.c2Max = None
+ self.c2Min = None
+ self.c2Sum = None
+
+ # create database db
+ sql = f"create database db vgroups 2 precision 'us' "
+ tdLog.info(sql)
+ tdSql.execute(sql)
+ sql = f"use db"
+ tdSql.execute(sql)
+
+ # create super talbe st
+ sql = f"create table st(ts timestamp, c1 int, c2 bigint, ts1 timestamp) tags(area int)"
+ tdLog.info(sql)
+ tdSql.execute(sql)
+
+ # create child table
+ for i in range(self.childCnt):
+ sql = f"create table t{i} using st tags({i}) "
+ tdSql.execute(sql)
+
+ # create stream
+ sql = "create stream ma into sta as select count(ts) from st interval(100u)"
+ tdLog.info(sql)
+ tdSql.execute(sql)
+
+ # insert data
+ self.insertData()
+
+ # check data correct
+ def checkExpect(self, sql, expectVal):
+ tdSql.query(sql)
+ rowCnt = tdSql.getRows()
+ for i in range(rowCnt):
+ val = tdSql.getData(i,0)
+ if val != expectVal:
+ tdLog.exit(f"Not expect . query={val} expect={expectVal} i={i} sql={sql}")
+ return False
+
+ tdLog.info(f"check expect ok. sql={sql} expect ={expectVal} rowCnt={rowCnt}")
+ return True
+
+
+ # check time macro
+ def checkTimeMacro(self):
+ # 2 week
+ val = 2
+ usval = val*7*24*60*60*1000*1000
+ expectVal = self.childCnt * self.childRow
+ sql = f"select count(ts) from st where timediff(ts - {val}w, ts1) = {usval} "
+ self.checkExpect(sql, expectVal)
+
+ # 20 day
+ val = 20
+ usval = val*24*60*60*1000*1000
+ uint = "d"
+ sql = f"select count(ts) from st where timediff(ts - {val}{uint}, ts1) = {usval} "
+ self.checkExpect(sql, expectVal)
+
+ # 30 hour
+ val = 30
+ usval = val*60*60*1000*1000
+ uint = "h"
+ sql = f"select count(ts) from st where timediff(ts - {val}{uint}, ts1) = {usval} "
+ self.checkExpect(sql, expectVal)
+
+ # 90 minutes
+ val = 90
+ usval = val*60*1000*1000
+ uint = "m"
+ sql = f"select count(ts) from st where timediff(ts - {val}{uint}, ts1) = {usval} "
+ self.checkExpect(sql, expectVal)
+ # 2s
+ val = 2
+ usval = val*1000*1000
+ uint = "s"
+ sql = f"select count(ts) from st where timediff(ts - {val}{uint}, ts1) = {usval} "
+ self.checkExpect(sql, expectVal)
+ # 20a
+ val = 20
+ usval = val*1000
+ uint = "a"
+ sql = f"select count(ts) from st where timediff(ts - {val}{uint}, ts1) = {usval} "
+ self.checkExpect(sql, expectVal)
+ # 300u
+ val = 300
+ usval = val*1
+ uint = "u"
+ sql = f"select count(ts) from st where timediff(ts - {val}{uint}, ts1) = {usval} "
+ self.checkExpect(sql, expectVal)
+
+ # init
+ def init(self, conn, logSql, replicaVar=1):
+ seed = time.clock_gettime(time.CLOCK_REALTIME)
+ random.seed(seed)
+ self.replicaVar = int(replicaVar)
+ tdLog.debug(f"start to excute {__file__}")
+ tdSql.init(conn.cursor(), True)
+
+ # where
+ def checkWhere(self):
+ cnt = 300
+ start = self.ts - cnt
+ sql = f"select count(ts) from st where ts >= {start} and ts <= {self.ts}"
+ self.checkExpect(sql, cnt)
+
+ for i in range(50):
+ cnt = random.randint(1,40000)
+ base = 2000
+ start = self.ts - cnt - base
+ end = self.ts - base
+ sql = f"select count(ts) from st where ts >= {start} and ts < {end}"
+ self.checkExpect(sql, cnt)
+
+ # stream
+ def checkStream(self):
+ allRows = self.childCnt * self.childRow
+ # ensure write data is expected
+ sql = "select count(*) from (select diff(ts) as a from (select ts from st order by ts asc)) where a=1;"
+ self.checkExpect(sql, allRows - 1)
+
+ # stream count is ok
+ sql =f"select count(*) from sta"
+ cnt = int(allRows / 100) - 1 # last window is not close, so need reduce one
+ self.checkExpect(sql, cnt)
+
+ # check fields
+ sql =f"select count(*) from sta where `count(ts)` != 100"
+ self.checkExpect(sql, 0)
+
+ # check timestamp
+ sql =f"select count(*) from (select diff(`_wstart`) from sta)"
+ self.checkExpect(sql, cnt - 1)
+ sql =f"select count(*) from (select diff(`_wstart`) as a from sta) where a != 100"
+ self.checkExpect(sql, 0)
+
+ # run
+ def run(self):
+ # prepare env
+ self.prepareEnv()
+
+ # time macro like 1w 1d 1h 1m 1s 1a 1u
+ self.checkTimeMacro()
+
+ # check where
+ self.checkWhere()
+
+ # check stream
+ self.checkStream()
+
+ # stop
+ def stop(self):
+ tdSql.close()
+ tdLog.success(f"{__file__} successfully executed")
+
+
+tdCases.addLinux(__file__, TDTestCase())
+tdCases.addWindows(__file__, TDTestCase())
diff --git a/tests/system-test/2-query/interp.py b/tests/system-test/2-query/interp.py
index 121d4dcff6..f733a3d008 100644
--- a/tests/system-test/2-query/interp.py
+++ b/tests/system-test/2-query/interp.py
@@ -32,6 +32,12 @@ class TDTestCase:
ctbname3_null = "ctb3_null"
stbname_null = "stb_null"
+ tbname_single = "tb_single"
+ ctbname1_single = "ctb1_single"
+ ctbname2_single = "ctb2_single"
+ ctbname3_single = "ctb3_single"
+ stbname_single = "stb_single"
+
tdSql.prepare()
tdLog.printNoPrefix("==========step1:create table")
@@ -219,6 +225,56 @@ class TDTestCase:
tdSql.checkData(2, 0, 12)
tdSql.checkData(3, 0, 12)
+ ## test fill value with scalar expression
+ tdSql.query(f"select interp(c0) from {dbname}.{tbname} range('2020-02-01 00:00:16', '2020-02-01 00:00:19') every(1s) fill(value, 1 + 2)")
+ tdSql.checkRows(4)
+ tdSql.checkData(0, 0, 3)
+ tdSql.checkData(1, 0, 3)
+ tdSql.checkData(2, 0, 3)
+ tdSql.checkData(3, 0, 3)
+
+ tdSql.query(f"select interp(c0) from {dbname}.{tbname} range('2020-02-01 00:00:16', '2020-02-01 00:00:19') every(1s) fill(value, 1.0 + 2.0)")
+ tdSql.checkRows(4)
+ tdSql.checkData(0, 0, 3)
+ tdSql.checkData(1, 0, 3)
+ tdSql.checkData(2, 0, 3)
+ tdSql.checkData(3, 0, 3)
+
+ tdSql.query(f"select interp(c0) from {dbname}.{tbname} range('2020-02-01 00:00:16', '2020-02-01 00:00:19') every(1s) fill(value, 1 + 2.5)")
+ tdSql.checkRows(4)
+ tdSql.checkData(0, 0, 3)
+ tdSql.checkData(1, 0, 3)
+ tdSql.checkData(2, 0, 3)
+ tdSql.checkData(3, 0, 3)
+
+ tdSql.query(f"select interp(c0) from {dbname}.{tbname} range('2020-02-01 00:00:16', '2020-02-01 00:00:19') every(1s) fill(value, 1 + '2')")
+ tdSql.checkRows(4)
+ tdSql.checkData(0, 0, 3)
+ tdSql.checkData(1, 0, 3)
+ tdSql.checkData(2, 0, 3)
+ tdSql.checkData(3, 0, 3)
+
+ tdSql.query(f"select interp(c0) from {dbname}.{tbname} range('2020-02-01 00:00:16', '2020-02-01 00:00:19') every(1s) fill(value, 1 + '2.0')")
+ tdSql.checkRows(4)
+ tdSql.checkData(0, 0, 3)
+ tdSql.checkData(1, 0, 3)
+ tdSql.checkData(2, 0, 3)
+ tdSql.checkData(3, 0, 3)
+
+ tdSql.query(f"select interp(c0) from {dbname}.{tbname} range('2020-02-01 00:00:16', '2020-02-01 00:00:19') every(1s) fill(value, '3' + 'abc')")
+ tdSql.checkRows(4)
+ tdSql.checkData(0, 0, 3)
+ tdSql.checkData(1, 0, 3)
+ tdSql.checkData(2, 0, 3)
+ tdSql.checkData(3, 0, 3)
+
+ tdSql.query(f"select interp(c0) from {dbname}.{tbname} range('2020-02-01 00:00:16', '2020-02-01 00:00:19') every(1s) fill(value, '2' + '1abc')")
+ tdSql.checkRows(4)
+ tdSql.checkData(0, 0, 3)
+ tdSql.checkData(1, 0, 3)
+ tdSql.checkData(2, 0, 3)
+ tdSql.checkData(3, 0, 3)
+
tdLog.printNoPrefix("==========step5:fill prev")
## {. . .}
@@ -1759,47 +1815,10 @@ class TDTestCase:
tdSql.checkData(60, 1, 60) #
# test fill value
- tdSql.query(f"select interp(c0),interp(c1) from {dbname}.{tbname1} range('2020-02-02 00:00:00', '2020-02-02 00:01:00') every(1s) fill(value, 123)")
+ tdSql.query(f"select _irowts, interp(c0), _irowts, interp(c1), _irowts from {dbname}.{tbname1} range('2020-02-02 00:00:00', '2020-02-02 00:01:00') every(1s) fill(value, 123, 456)")
tdSql.checkRows(61)
- tdSql.checkCols(2)
- tdSql.checkData(0, 0, 0) #
- tdSql.checkData(1, 0, 123)
- tdSql.checkData(4, 0, 123)
- tdSql.checkData(5, 0, None) #
- tdSql.checkData(6, 0, 123)
- tdSql.checkData(9, 0, 123)
- tdSql.checkData(10, 0, 10) #
- tdSql.checkData(11, 0, 123)
- tdSql.checkData(14, 0, 123)
- tdSql.checkData(15, 0, None) #
- tdSql.checkData(16, 0, 123)
- tdSql.checkData(19, 0, 123)
- tdSql.checkData(20, 0, 20) #
- tdSql.checkData(21, 0, 123)
- tdSql.checkData(24, 0, 123)
- tdSql.checkData(25, 0, None) #
- tdSql.checkData(26, 0, 123)
- tdSql.checkData(29, 0, 123)
- tdSql.checkData(30, 0, 30) #
- tdSql.checkData(31, 0, 123)
- tdSql.checkData(34, 0, 123)
- tdSql.checkData(35, 0, 35) #
- tdSql.checkData(36, 0, 123)
- tdSql.checkData(39, 0, 123)
- tdSql.checkData(40, 0, 40) #
- tdSql.checkData(41, 0, 123)
- tdSql.checkData(44, 0, 123)
- tdSql.checkData(45, 0, None) #
- tdSql.checkData(46, 0, 123)
- tdSql.checkData(49, 0, 123)
- tdSql.checkData(50, 0, 50) #
- tdSql.checkData(51, 0, 123)
- tdSql.checkData(54, 0, 123)
- tdSql.checkData(55, 0, None) #
- tdSql.checkData(59, 0, 123)
- tdSql.checkData(60, 0, 55) #
-
- tdSql.checkData(0, 1, None) #
+ tdSql.checkCols(5)
+ tdSql.checkData(0, 1, 0) #
tdSql.checkData(1, 1, 123)
tdSql.checkData(4, 1, 123)
tdSql.checkData(5, 1, None) #
@@ -1811,7 +1830,7 @@ class TDTestCase:
tdSql.checkData(15, 1, None) #
tdSql.checkData(16, 1, 123)
tdSql.checkData(19, 1, 123)
- tdSql.checkData(20, 1, None) #
+ tdSql.checkData(20, 1, 20) #
tdSql.checkData(21, 1, 123)
tdSql.checkData(24, 1, 123)
tdSql.checkData(25, 1, None) #
@@ -1820,22 +1839,137 @@ class TDTestCase:
tdSql.checkData(30, 1, 30) #
tdSql.checkData(31, 1, 123)
tdSql.checkData(34, 1, 123)
- tdSql.checkData(35, 1, None) #
+ tdSql.checkData(35, 1, 35) #
tdSql.checkData(36, 1, 123)
tdSql.checkData(39, 1, 123)
tdSql.checkData(40, 1, 40) #
tdSql.checkData(41, 1, 123)
tdSql.checkData(44, 1, 123)
- tdSql.checkData(45, 1, 45) #
+ tdSql.checkData(45, 1, None) #
tdSql.checkData(46, 1, 123)
tdSql.checkData(49, 1, 123)
- tdSql.checkData(50, 1, None) #
+ tdSql.checkData(50, 1, 50) #
tdSql.checkData(51, 1, 123)
tdSql.checkData(54, 1, 123)
tdSql.checkData(55, 1, None) #
- tdSql.checkData(56, 1, 123)
tdSql.checkData(59, 1, 123)
- tdSql.checkData(60, 1, 60) #
+ tdSql.checkData(60, 1, 55) #
+
+ tdSql.checkData(0, 3, None) #
+ tdSql.checkData(1, 3, 456)
+ tdSql.checkData(4, 3, 456)
+ tdSql.checkData(5, 3, None) #
+ tdSql.checkData(6, 3, 456)
+ tdSql.checkData(9, 3, 456)
+ tdSql.checkData(10, 3, 10) #
+ tdSql.checkData(11, 3, 456)
+ tdSql.checkData(14, 3, 456)
+ tdSql.checkData(15, 3, None) #
+ tdSql.checkData(16, 3, 456)
+ tdSql.checkData(19, 3, 456)
+ tdSql.checkData(20, 3, None) #
+ tdSql.checkData(21, 3, 456)
+ tdSql.checkData(24, 3, 456)
+ tdSql.checkData(25, 3, None) #
+ tdSql.checkData(26, 3, 456)
+ tdSql.checkData(29, 3, 456)
+ tdSql.checkData(30, 3, 30) #
+ tdSql.checkData(31, 3, 456)
+ tdSql.checkData(34, 3, 456)
+ tdSql.checkData(35, 3, None) #
+ tdSql.checkData(36, 3, 456)
+ tdSql.checkData(39, 3, 456)
+ tdSql.checkData(40, 3, 40) #
+ tdSql.checkData(41, 3, 456)
+ tdSql.checkData(44, 3, 456)
+ tdSql.checkData(45, 3, 45) #
+ tdSql.checkData(46, 3, 456)
+ tdSql.checkData(49, 3, 456)
+ tdSql.checkData(50, 3, None) #
+ tdSql.checkData(51, 3, 456)
+ tdSql.checkData(54, 3, 456)
+ tdSql.checkData(55, 3, None) #
+ tdSql.checkData(56, 3, 456)
+ tdSql.checkData(59, 3, 456)
+ tdSql.checkData(60, 3, 60) #
+
+ tdSql.query(f"select _isfilled, interp(c0), _isfilled, interp(c1), _isfilled from {dbname}.{tbname1} range('2020-02-02 00:00:00', '2020-02-02 00:01:00') every(1s) fill(value, 123 + 123, 234 + 234)")
+ tdSql.checkRows(61)
+ tdSql.checkCols(5)
+ tdSql.checkData(0, 1, 0) #
+ tdSql.checkData(1, 1, 246)
+ tdSql.checkData(4, 1, 246)
+ tdSql.checkData(5, 1, None) #
+ tdSql.checkData(6, 1, 246)
+ tdSql.checkData(9, 1, 246)
+ tdSql.checkData(10, 1, 10) #
+ tdSql.checkData(11, 1, 246)
+ tdSql.checkData(14, 1, 246)
+ tdSql.checkData(15, 1, None) #
+ tdSql.checkData(16, 1, 246)
+ tdSql.checkData(19, 1, 246)
+ tdSql.checkData(20, 1, 20) #
+ tdSql.checkData(21, 1, 246)
+ tdSql.checkData(24, 1, 246)
+ tdSql.checkData(25, 1, None) #
+ tdSql.checkData(26, 1, 246)
+ tdSql.checkData(29, 1, 246)
+ tdSql.checkData(30, 1, 30) #
+ tdSql.checkData(31, 1, 246)
+ tdSql.checkData(34, 1, 246)
+ tdSql.checkData(35, 1, 35) #
+ tdSql.checkData(36, 1, 246)
+ tdSql.checkData(39, 1, 246)
+ tdSql.checkData(40, 1, 40) #
+ tdSql.checkData(41, 1, 246)
+ tdSql.checkData(44, 1, 246)
+ tdSql.checkData(45, 1, None) #
+ tdSql.checkData(46, 1, 246)
+ tdSql.checkData(49, 1, 246)
+ tdSql.checkData(50, 1, 50) #
+ tdSql.checkData(51, 1, 246)
+ tdSql.checkData(54, 1, 246)
+ tdSql.checkData(55, 1, None) #
+ tdSql.checkData(59, 1, 246)
+ tdSql.checkData(60, 1, 55) #
+
+ tdSql.checkData(0, 3, None) #
+ tdSql.checkData(1, 3, 468)
+ tdSql.checkData(4, 3, 468)
+ tdSql.checkData(5, 3, None) #
+ tdSql.checkData(6, 3, 468)
+ tdSql.checkData(9, 3, 468)
+ tdSql.checkData(10, 3, 10) #
+ tdSql.checkData(11, 3, 468)
+ tdSql.checkData(14, 3, 468)
+ tdSql.checkData(15, 3, None) #
+ tdSql.checkData(16, 3, 468)
+ tdSql.checkData(19, 3, 468)
+ tdSql.checkData(20, 3, None) #
+ tdSql.checkData(21, 3, 468)
+ tdSql.checkData(24, 3, 468)
+ tdSql.checkData(25, 3, None) #
+ tdSql.checkData(26, 3, 468)
+ tdSql.checkData(29, 3, 468)
+ tdSql.checkData(30, 3, 30) #
+ tdSql.checkData(31, 3, 468)
+ tdSql.checkData(34, 3, 468)
+ tdSql.checkData(35, 3, None) #
+ tdSql.checkData(36, 3, 468)
+ tdSql.checkData(39, 3, 468)
+ tdSql.checkData(40, 3, 40) #
+ tdSql.checkData(41, 3, 468)
+ tdSql.checkData(44, 3, 468)
+ tdSql.checkData(45, 3, 45) #
+ tdSql.checkData(46, 3, 468)
+ tdSql.checkData(49, 3, 468)
+ tdSql.checkData(50, 3, None) #
+ tdSql.checkData(51, 3, 468)
+ tdSql.checkData(54, 3, 468)
+ tdSql.checkData(55, 3, None) #
+ tdSql.checkData(56, 3, 468)
+ tdSql.checkData(59, 3, 468)
+ tdSql.checkData(60, 3, 60) #
# test fill prev
tdSql.query(f"select interp(c0),interp(c1) from {dbname}.{tbname1} range('2020-02-02 00:00:00', '2020-02-02 00:01:00') every(1s) fill(prev)")
@@ -2010,7 +2144,7 @@ class TDTestCase:
tdSql.checkData(3, i, None)
tdSql.checkData(4, i, None)
- tdSql.query(f"select interp(c0),interp(c1),interp(c2),interp(c3) from {dbname}.{tbname} range('2020-02-09 00:00:05', '2020-02-13 00:00:05') every(1d) fill(value, 1)")
+ tdSql.query(f"select interp(c0),interp(c1),interp(c2),interp(c3) from {dbname}.{tbname} range('2020-02-09 00:00:05', '2020-02-13 00:00:05') every(1d) fill(value, 1, 1, 1, 1)")
tdSql.checkRows(5)
tdSql.checkCols(4)
@@ -2436,6 +2570,10 @@ class TDTestCase:
tdSql.error(f"select interp(c0) from {dbname}.{tbname} where _isfilled = true range('2020-02-10 00:00:05', '2020-02-15 00:00:05') every(1d) fill(null)")
tdSql.error(f"select interp(c0) from {dbname}.{tbname} where _irowts > 0 range('2020-02-10 00:00:05', '2020-02-15 00:00:05') every(1d) fill(null)")
+ # fill value number mismatch
+ tdSql.error(f"select interp(c0) from {dbname}.{tbname} range('2020-02-10 00:00:05', '2020-02-15 00:00:05') every(1d) fill(value, 1, 2)")
+ tdSql.error(f"select interp(c0), interp(c1) from {dbname}.{tbname} range('2020-02-10 00:00:05', '2020-02-15 00:00:05') every(1d) fill(value, 1)")
+
@@ -4020,7 +4158,7 @@ class TDTestCase:
tdLog.printNoPrefix("======step 15: test interp pseudo columns")
tdSql.error(f"select _irowts, c6 from {dbname}.{tbname}")
- tdLog.printNoPrefix("======step 15: test interp in nested query")
+ tdLog.printNoPrefix("======step 16: test interp in nested query")
tdSql.query(f"select _irowts, _isfilled, interp(c0) from (select * from {dbname}.{stbname}) range('2020-02-01 00:00:00', '2020-02-01 00:00:14') every(1s) fill(null)")
tdSql.query(f"select _irowts, _isfilled, interp(c0) from (select * from {dbname}.{ctbname1}) range('2020-02-01 00:00:00', '2020-02-01 00:00:14') every(1s) fill(null)")
@@ -4028,16 +4166,1157 @@ class TDTestCase:
tdSql.error(f"select _irowts, _isfilled, interp(c0) from (select * from {dbname}.{ctbname1}) partition by tbname range('2020-02-01 00:00:00', '2020-02-01 00:00:14') every(1s) fill(null)")
tdSql.error(f"select _irowts, _isfilled, interp(c0) from (select * from {dbname}.{ctbname1} union select * from {dbname}.{ctbname2}) range('2020-02-01 00:00:00', '2020-02-01 00:00:14') every(1s) fill(null)")
- tdSql.error(f"select _irowts, _isfilled, interp(c0) from (select * from {dbname}.{ctbname1} union select * from {dbname}.{ctbname2} order by ts) range('2020-02-01 00:00:00', '2020-02-01 00:00:14') every(1s) fill(null)")
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from (select * from {dbname}.{ctbname1} union select * from {dbname}.{ctbname2} order by ts) range('2020-02-01 00:00:00', '2020-02-01 00:00:14') every(1s) fill(null)")
tdSql.error(f"select _irowts, _isfilled, interp(c0) from (select * from {dbname}.{ctbname1} union all select * from {dbname}.{ctbname2}) range('2020-02-01 00:00:00', '2020-02-01 00:00:14') every(1s) fill(null)")
- tdSql.error(f"select _irowts, _isfilled, interp(c0) from (select * from {dbname}.{ctbname1} union all select * from {dbname}.{ctbname2} order by ts) range('2020-02-01 00:00:00', '2020-02-01 00:00:14') every(1s) fill(null)")
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from (select * from {dbname}.{ctbname1} union all select * from {dbname}.{ctbname2} order by ts) range('2020-02-01 00:00:00', '2020-02-01 00:00:14') every(1s) fill(null)")
tdSql.error(f"select _irowts, _isfilled, interp(c0) from (select * from {dbname}.{ctbname1} union all select * from {dbname}.{ctbname2}) range('2020-02-01 00:00:00', '2020-02-01 00:00:14') every(1s) fill(null)")
- tdSql.error(f"select _irowts, _isfilled, interp(c0) from (select * from {dbname}.{ctbname1} union all select * from {dbname}.{ctbname2} order by ts) range('2020-02-01 00:00:00', '2020-02-01 00:00:14') every(1s) fill(null)")
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from (select * from {dbname}.{ctbname1} union all select * from {dbname}.{ctbname2} order by ts) range('2020-02-01 00:00:00', '2020-02-01 00:00:14') every(1s) fill(null)")
tdSql.query(f"select _irowts, _isfilled, interp(c0) from (select {ctbname1}.ts,{ctbname1}.c0 from {dbname}.{ctbname1}, {dbname}.{ctbname2} where {ctbname1}.ts = {ctbname2}.ts) range('2020-02-01 00:00:00', '2020-02-01 00:00:14') every(1s) fill(null)")
+ tdLog.printNoPrefix("======step 17: test interp single point")
+ tdSql.execute(
+ f'''create table if not exists {dbname}.{tbname_single}
+ (ts timestamp, c0 int)
+ '''
+ )
+
+ tdSql.execute(f"insert into {dbname}.{tbname_single} values ('2020-02-01 00:00:01', 1)")
+ tdSql.execute(f"insert into {dbname}.{tbname_single} values ('2020-02-01 00:00:03', 3)")
+ tdSql.execute(f"insert into {dbname}.{tbname_single} values ('2020-02-01 00:00:05', 5)")
+
+ tdSql.execute(
+ f'''create table if not exists {dbname}.{stbname_single}
+ (ts timestamp, c0 int, c1 float, c2 bool) tags (t0 int)
+ '''
+ )
+
+ tdSql.execute(
+ f'''create table if not exists {dbname}.{ctbname1_single} using {dbname}.{stbname_single} tags(1)
+ '''
+ )
+
+ tdSql.execute(
+ f'''create table if not exists {dbname}.{ctbname2_single} using {dbname}.{stbname_single} tags(2)
+ '''
+ )
+
+ tdSql.execute(
+ f'''create table if not exists {dbname}.{ctbname3_single} using {dbname}.{stbname_single} tags(3)
+ '''
+ )
+
+ tdSql.execute(f"insert into {dbname}.{ctbname1_single} values ('2020-02-01 00:00:01', 1, 1.0, true)")
+
+ tdSql.execute(f"insert into {dbname}.{ctbname2_single} values ('2020-02-01 00:00:03', 3, 3.0, false)")
+
+ tdSql.execute(f"insert into {dbname}.{ctbname3_single} values ('2020-02-01 00:00:05', 5, 5.0, true)")
+
+ # normal table
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{tbname_single} range('2020-02-01 00:00:00', '2020-02-01 00:00:00') every(1s) fill(null)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:00.000')
+ tdSql.checkData(0, 1, True)
+ tdSql.checkData(0, 2, None)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{tbname_single} range('2020-02-01 00:00:00') fill(null)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:00.000')
+ tdSql.checkData(0, 1, True)
+ tdSql.checkData(0, 2, None)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{tbname_single} range('2020-02-01 00:00:01', '2020-02-01 00:00:01') every(1s) fill(null)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:01.000')
+ tdSql.checkData(0, 1, False)
+ tdSql.checkData(0, 2, 1)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{tbname_single} range('2020-02-01 00:00:01') fill(null)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:01.000')
+ tdSql.checkData(0, 1, False)
+ tdSql.checkData(0, 2, 1)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{tbname_single} range('2020-02-01 00:00:02', '2020-02-01 00:00:02') every(1s) fill(null)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:02.000')
+ tdSql.checkData(0, 1, True)
+ tdSql.checkData(0, 2, None)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{tbname_single} range('2020-02-01 00:00:02') fill(null)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:02.000')
+ tdSql.checkData(0, 1, True)
+ tdSql.checkData(0, 2, None)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{tbname_single} range('2020-02-01 00:00:03', '2020-02-01 00:00:03') every(1s) fill(null)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:03.000')
+ tdSql.checkData(0, 1, False)
+ tdSql.checkData(0, 2, 3)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{tbname_single} range('2020-02-01 00:00:03') fill(null)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:03.000')
+ tdSql.checkData(0, 1, False)
+ tdSql.checkData(0, 2, 3)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{tbname_single} range('2020-02-01 00:00:04', '2020-02-01 00:00:04') every(1s) fill(null)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:04.000')
+ tdSql.checkData(0, 1, True)
+ tdSql.checkData(0, 2, None)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{tbname_single} range('2020-02-01 00:00:04') fill(null)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:04.000')
+ tdSql.checkData(0, 1, True)
+ tdSql.checkData(0, 2, None)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{tbname_single} range('2020-02-01 00:00:05', '2020-02-01 00:00:05') every(1s) fill(null)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:05.000')
+ tdSql.checkData(0, 1, False)
+ tdSql.checkData(0, 2, 5)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{tbname_single} range('2020-02-01 00:00:05') fill(null)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:05.000')
+ tdSql.checkData(0, 1, False)
+ tdSql.checkData(0, 2, 5)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{tbname_single} range('2020-02-01 00:00:06', '2020-02-01 00:00:06') every(1s) fill(null)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:06.000')
+ tdSql.checkData(0, 1, True)
+ tdSql.checkData(0, 2, None)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{tbname_single} range('2020-02-01 00:00:06') fill(null)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:06.000')
+ tdSql.checkData(0, 1, True)
+ tdSql.checkData(0, 2, None)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{tbname_single} range('2020-02-01 00:00:00', '2020-02-01 00:00:00') every(1s) fill(value, 0)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:00.000')
+ tdSql.checkData(0, 1, True)
+ tdSql.checkData(0, 2, 0)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{tbname_single} range('2020-02-01 00:00:00') fill(value, 0)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:00.000')
+ tdSql.checkData(0, 1, True)
+ tdSql.checkData(0, 2, 0)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{tbname_single} range('2020-02-01 00:00:01', '2020-02-01 00:00:01') every(1s) fill(value, 0)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:01.000')
+ tdSql.checkData(0, 1, False)
+ tdSql.checkData(0, 2, 1)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{tbname_single} range('2020-02-01 00:00:01') fill(value, 0)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:01.000')
+ tdSql.checkData(0, 1, False)
+ tdSql.checkData(0, 2, 1)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{tbname_single} range('2020-02-01 00:00:02', '2020-02-01 00:00:02') every(1s) fill(value, 0)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:02.000')
+ tdSql.checkData(0, 1, True)
+ tdSql.checkData(0, 2, 0)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{tbname_single} range('2020-02-01 00:00:02') fill(value, 0)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:02.000')
+ tdSql.checkData(0, 1, True)
+ tdSql.checkData(0, 2, 0)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{tbname_single} range('2020-02-01 00:00:03', '2020-02-01 00:00:03') every(1s) fill(value, 0)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:03.000')
+ tdSql.checkData(0, 1, False)
+ tdSql.checkData(0, 2, 3)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{tbname_single} range('2020-02-01 00:00:03') fill(value, 0)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:03.000')
+ tdSql.checkData(0, 1, False)
+ tdSql.checkData(0, 2, 3)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{tbname_single} range('2020-02-01 00:00:04', '2020-02-01 00:00:04') every(1s) fill(value, 0)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:04.000')
+ tdSql.checkData(0, 1, True)
+ tdSql.checkData(0, 2, 0)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{tbname_single} range('2020-02-01 00:00:04') fill(value, 0)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:04.000')
+ tdSql.checkData(0, 1, True)
+ tdSql.checkData(0, 2, 0)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{tbname_single} range('2020-02-01 00:00:05', '2020-02-01 00:00:05') every(1s) fill(value, 0)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:05.000')
+ tdSql.checkData(0, 1, False)
+ tdSql.checkData(0, 2, 5)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{tbname_single} range('2020-02-01 00:00:05') fill(value, 0)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:05.000')
+ tdSql.checkData(0, 1, False)
+ tdSql.checkData(0, 2, 5)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{tbname_single} range('2020-02-01 00:00:06', '2020-02-01 00:00:06') every(1s) fill(value, 0)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:06.000')
+ tdSql.checkData(0, 1, True)
+ tdSql.checkData(0, 2, 0)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{tbname_single} range('2020-02-01 00:00:06') fill(value, 0)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:06.000')
+ tdSql.checkData(0, 1, True)
+ tdSql.checkData(0, 2, 0)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{tbname_single} range('2020-02-01 00:00:00', '2020-02-01 00:00:00') every(1s) fill(prev)")
+ tdSql.checkRows(0)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{tbname_single} range('2020-02-01 00:00:00') fill(prev)")
+ tdSql.checkRows(0)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{tbname_single} range('2020-02-01 00:00:01', '2020-02-01 00:00:01') every(1s) fill(prev)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:01.000')
+ tdSql.checkData(0, 1, False)
+ tdSql.checkData(0, 2, 1)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{tbname_single} range('2020-02-01 00:00:01') fill(prev)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:01.000')
+ tdSql.checkData(0, 1, False)
+ tdSql.checkData(0, 2, 1)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{tbname_single} range('2020-02-01 00:00:02', '2020-02-01 00:00:02') every(1s) fill(prev)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:02.000')
+ tdSql.checkData(0, 1, True)
+ tdSql.checkData(0, 2, 1)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{tbname_single} range('2020-02-01 00:00:02') fill(prev)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:02.000')
+ tdSql.checkData(0, 1, True)
+ tdSql.checkData(0, 2, 1)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{tbname_single} range('2020-02-01 00:00:03', '2020-02-01 00:00:03') every(1s) fill(prev)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:03.000')
+ tdSql.checkData(0, 1, False)
+ tdSql.checkData(0, 2, 3)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{tbname_single} range('2020-02-01 00:00:03') fill(prev)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:03.000')
+ tdSql.checkData(0, 1, False)
+ tdSql.checkData(0, 2, 3)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{tbname_single} range('2020-02-01 00:00:04', '2020-02-01 00:00:04') every(1s) fill(prev)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:04.000')
+ tdSql.checkData(0, 1, True)
+ tdSql.checkData(0, 2, 3)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{tbname_single} range('2020-02-01 00:00:04') fill(prev)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:04.000')
+ tdSql.checkData(0, 1, True)
+ tdSql.checkData(0, 2, 3)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{tbname_single} range('2020-02-01 00:00:05', '2020-02-01 00:00:05') every(1s) fill(prev)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:05.000')
+ tdSql.checkData(0, 1, False)
+ tdSql.checkData(0, 2, 5)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{tbname_single} range('2020-02-01 00:00:05') fill(prev)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:05.000')
+ tdSql.checkData(0, 1, False)
+ tdSql.checkData(0, 2, 5)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{tbname_single} range('2020-02-01 00:00:06', '2020-02-01 00:00:06') every(1s) fill(prev)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:06.000')
+ tdSql.checkData(0, 1, True)
+ tdSql.checkData(0, 2, 5)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{tbname_single} range('2020-02-01 00:00:06') fill(prev)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:06.000')
+ tdSql.checkData(0, 1, True)
+ tdSql.checkData(0, 2, 5)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{tbname_single} range('2020-02-01 00:00:00', '2020-02-01 00:00:00') every(1s) fill(next)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:00.000')
+ tdSql.checkData(0, 1, True)
+ tdSql.checkData(0, 2, 1)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{tbname_single} range('2020-02-01 00:00:00') fill(next)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:00.000')
+ tdSql.checkData(0, 1, True)
+ tdSql.checkData(0, 2, 1)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{tbname_single} range('2020-02-01 00:00:01', '2020-02-01 00:00:01') every(1s) fill(next)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:01.000')
+ tdSql.checkData(0, 1, False)
+ tdSql.checkData(0, 2, 1)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{tbname_single} range('2020-02-01 00:00:01') fill(next)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:01.000')
+ tdSql.checkData(0, 1, False)
+ tdSql.checkData(0, 2, 1)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{tbname_single} range('2020-02-01 00:00:02', '2020-02-01 00:00:02') every(1s) fill(next)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:02.000')
+ tdSql.checkData(0, 1, True)
+ tdSql.checkData(0, 2, 3)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{tbname_single} range('2020-02-01 00:00:02') fill(next)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:02.000')
+ tdSql.checkData(0, 1, True)
+ tdSql.checkData(0, 2, 3)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{tbname_single} range('2020-02-01 00:00:03', '2020-02-01 00:00:03') every(1s) fill(next)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:03.000')
+ tdSql.checkData(0, 1, False)
+ tdSql.checkData(0, 2, 3)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{tbname_single} range('2020-02-01 00:00:03') fill(next)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:03.000')
+ tdSql.checkData(0, 1, False)
+ tdSql.checkData(0, 2, 3)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{tbname_single} range('2020-02-01 00:00:04', '2020-02-01 00:00:04') every(1s) fill(next)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:04.000')
+ tdSql.checkData(0, 1, True)
+ tdSql.checkData(0, 2, 5)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{tbname_single} range('2020-02-01 00:00:04') fill(next)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:04.000')
+ tdSql.checkData(0, 1, True)
+ tdSql.checkData(0, 2, 5)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{tbname_single} range('2020-02-01 00:00:05', '2020-02-01 00:00:05') every(1s) fill(next)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:05.000')
+ tdSql.checkData(0, 1, False)
+ tdSql.checkData(0, 2, 5)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{tbname_single} range('2020-02-01 00:00:05') fill(next)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:05.000')
+ tdSql.checkData(0, 1, False)
+ tdSql.checkData(0, 2, 5)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{tbname_single} range('2020-02-01 00:00:06', '2020-02-01 00:00:06') every(1s) fill(next)")
+ tdSql.checkRows(0)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{tbname_single} range('2020-02-01 00:00:06') fill(next)")
+ tdSql.checkRows(0)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{tbname_single} range('2020-02-01 00:00:00', '2020-02-01 00:00:00') every(1s) fill(linear)")
+ tdSql.checkRows(0)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{tbname_single} range('2020-02-01 00:00:00') fill(linear)")
+ tdSql.checkRows(0)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{tbname_single} range('2020-02-01 00:00:01', '2020-02-01 00:00:01') every(1s) fill(linear)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:01.000')
+ tdSql.checkData(0, 1, False)
+ tdSql.checkData(0, 2, 1)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{tbname_single} range('2020-02-01 00:00:01') fill(linear)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:01.000')
+ tdSql.checkData(0, 1, False)
+ tdSql.checkData(0, 2, 1)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{tbname_single} range('2020-02-01 00:00:02', '2020-02-01 00:00:02') every(1s) fill(linear)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:02.000')
+ tdSql.checkData(0, 1, True)
+ tdSql.checkData(0, 2, 2)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{tbname_single} range('2020-02-01 00:00:02') fill(linear)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:02.000')
+ tdSql.checkData(0, 1, True)
+ tdSql.checkData(0, 2, 2)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{tbname_single} range('2020-02-01 00:00:03', '2020-02-01 00:00:03') every(1s) fill(linear)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:03.000')
+ tdSql.checkData(0, 1, False)
+ tdSql.checkData(0, 2, 3)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{tbname_single} range('2020-02-01 00:00:03') fill(linear)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:03.000')
+ tdSql.checkData(0, 1, False)
+ tdSql.checkData(0, 2, 3)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{tbname_single} range('2020-02-01 00:00:04', '2020-02-01 00:00:04') every(1s) fill(linear)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:04.000')
+ tdSql.checkData(0, 1, True)
+ tdSql.checkData(0, 2, 4)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{tbname_single} range('2020-02-01 00:00:04') fill(linear)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:04.000')
+ tdSql.checkData(0, 1, True)
+ tdSql.checkData(0, 2, 4)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{tbname_single} range('2020-02-01 00:00:05', '2020-02-01 00:00:05') every(1s) fill(linear)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:05.000')
+ tdSql.checkData(0, 1, False)
+ tdSql.checkData(0, 2, 5)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{tbname_single} range('2020-02-01 00:00:05') fill(linear)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:05.000')
+ tdSql.checkData(0, 1, False)
+ tdSql.checkData(0, 2, 5)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{tbname_single} range('2020-02-01 00:00:06', '2020-02-01 00:00:06') every(1s) fill(linear)")
+ tdSql.checkRows(0)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{tbname_single} range('2020-02-01 00:00:06') fill(linear)")
+ tdSql.checkRows(0)
+
+ #super table
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} range('2020-02-01 00:00:00', '2020-02-01 00:00:00') every(1s) fill(null)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:00.000')
+ tdSql.checkData(0, 1, True)
+ tdSql.checkData(0, 2, None)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} range('2020-02-01 00:00:00') fill(null)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:00.000')
+ tdSql.checkData(0, 1, True)
+ tdSql.checkData(0, 2, None)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} range('2020-02-01 00:00:01', '2020-02-01 00:00:01') every(1s) fill(null)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:01.000')
+ tdSql.checkData(0, 1, False)
+ tdSql.checkData(0, 2, 1)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} range('2020-02-01 00:00:01') fill(null)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:01.000')
+ tdSql.checkData(0, 1, False)
+ tdSql.checkData(0, 2, 1)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} range('2020-02-01 00:00:02', '2020-02-01 00:00:02') every(1s) fill(null)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:02.000')
+ tdSql.checkData(0, 1, True)
+ tdSql.checkData(0, 2, None)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} range('2020-02-01 00:00:02') fill(null)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:02.000')
+ tdSql.checkData(0, 1, True)
+ tdSql.checkData(0, 2, None)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} range('2020-02-01 00:00:03', '2020-02-01 00:00:03') every(1s) fill(null)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:03.000')
+ tdSql.checkData(0, 1, False)
+ tdSql.checkData(0, 2, 3)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} range('2020-02-01 00:00:03') fill(null)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:03.000')
+ tdSql.checkData(0, 1, False)
+ tdSql.checkData(0, 2, 3)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} range('2020-02-01 00:00:04', '2020-02-01 00:00:04') every(1s) fill(null)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:04.000')
+ tdSql.checkData(0, 1, True)
+ tdSql.checkData(0, 2, None)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} range('2020-02-01 00:00:04') fill(null)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:04.000')
+ tdSql.checkData(0, 1, True)
+ tdSql.checkData(0, 2, None)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} range('2020-02-01 00:00:05', '2020-02-01 00:00:05') every(1s) fill(null)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:05.000')
+ tdSql.checkData(0, 1, False)
+ tdSql.checkData(0, 2, 5)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} range('2020-02-01 00:00:05') fill(null)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:05.000')
+ tdSql.checkData(0, 1, False)
+ tdSql.checkData(0, 2, 5)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} range('2020-02-01 00:00:06', '2020-02-01 00:00:06') every(1s) fill(null)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:06.000')
+ tdSql.checkData(0, 1, True)
+ tdSql.checkData(0, 2, None)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} range('2020-02-01 00:00:06') fill(null)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:06.000')
+ tdSql.checkData(0, 1, True)
+ tdSql.checkData(0, 2, None)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} range('2020-02-01 00:00:00', '2020-02-01 00:00:00') every(1s) fill(value, 0)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:00.000')
+ tdSql.checkData(0, 1, True)
+ tdSql.checkData(0, 2, 0)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} range('2020-02-01 00:00:00') fill(value, 0)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:00.000')
+ tdSql.checkData(0, 1, True)
+ tdSql.checkData(0, 2, 0)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} range('2020-02-01 00:00:01', '2020-02-01 00:00:01') every(1s) fill(value, 0)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:01.000')
+ tdSql.checkData(0, 1, False)
+ tdSql.checkData(0, 2, 1)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} range('2020-02-01 00:00:01') fill(value, 0)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:01.000')
+ tdSql.checkData(0, 1, False)
+ tdSql.checkData(0, 2, 1)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} range('2020-02-01 00:00:02', '2020-02-01 00:00:02') every(1s) fill(value, 0)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:02.000')
+ tdSql.checkData(0, 1, True)
+ tdSql.checkData(0, 2, 0)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} range('2020-02-01 00:00:02') fill(value, 0)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:02.000')
+ tdSql.checkData(0, 1, True)
+ tdSql.checkData(0, 2, 0)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} range('2020-02-01 00:00:03', '2020-02-01 00:00:03') every(1s) fill(value, 0)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:03.000')
+ tdSql.checkData(0, 1, False)
+ tdSql.checkData(0, 2, 3)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} range('2020-02-01 00:00:03') fill(value, 0)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:03.000')
+ tdSql.checkData(0, 1, False)
+ tdSql.checkData(0, 2, 3)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} range('2020-02-01 00:00:04', '2020-02-01 00:00:04') every(1s) fill(value, 0)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:04.000')
+ tdSql.checkData(0, 1, True)
+ tdSql.checkData(0, 2, 0)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} range('2020-02-01 00:00:04') fill(value, 0)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:04.000')
+ tdSql.checkData(0, 1, True)
+ tdSql.checkData(0, 2, 0)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} range('2020-02-01 00:00:05', '2020-02-01 00:00:05') every(1s) fill(value, 0)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:05.000')
+ tdSql.checkData(0, 1, False)
+ tdSql.checkData(0, 2, 5)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} range('2020-02-01 00:00:05') fill(value, 0)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:05.000')
+ tdSql.checkData(0, 1, False)
+ tdSql.checkData(0, 2, 5)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} range('2020-02-01 00:00:06', '2020-02-01 00:00:06') every(1s) fill(value, 0)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:06.000')
+ tdSql.checkData(0, 1, True)
+ tdSql.checkData(0, 2, 0)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} range('2020-02-01 00:00:06') fill(value, 0)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:06.000')
+ tdSql.checkData(0, 1, True)
+ tdSql.checkData(0, 2, 0)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} range('2020-02-01 00:00:00', '2020-02-01 00:00:00') every(1s) fill(prev)")
+ tdSql.checkRows(0)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} range('2020-02-01 00:00:00') fill(prev)")
+ tdSql.checkRows(0)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} range('2020-02-01 00:00:01', '2020-02-01 00:00:01') every(1s) fill(prev)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:01.000')
+ tdSql.checkData(0, 1, False)
+ tdSql.checkData(0, 2, 1)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} range('2020-02-01 00:00:01') fill(prev)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:01.000')
+ tdSql.checkData(0, 1, False)
+ tdSql.checkData(0, 2, 1)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} range('2020-02-01 00:00:02', '2020-02-01 00:00:02') every(1s) fill(prev)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:02.000')
+ tdSql.checkData(0, 1, True)
+ tdSql.checkData(0, 2, 1)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} range('2020-02-01 00:00:02') fill(prev)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:02.000')
+ tdSql.checkData(0, 1, True)
+ tdSql.checkData(0, 2, 1)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} range('2020-02-01 00:00:03', '2020-02-01 00:00:03') every(1s) fill(prev)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:03.000')
+ tdSql.checkData(0, 1, False)
+ tdSql.checkData(0, 2, 3)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} range('2020-02-01 00:00:03') fill(prev)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:03.000')
+ tdSql.checkData(0, 1, False)
+ tdSql.checkData(0, 2, 3)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} range('2020-02-01 00:00:04', '2020-02-01 00:00:04') every(1s) fill(prev)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:04.000')
+ tdSql.checkData(0, 1, True)
+ tdSql.checkData(0, 2, 3)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} range('2020-02-01 00:00:04') fill(prev)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:04.000')
+ tdSql.checkData(0, 1, True)
+ tdSql.checkData(0, 2, 3)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} range('2020-02-01 00:00:05', '2020-02-01 00:00:05') every(1s) fill(prev)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:05.000')
+ tdSql.checkData(0, 1, False)
+ tdSql.checkData(0, 2, 5)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} range('2020-02-01 00:00:05') fill(prev)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:05.000')
+ tdSql.checkData(0, 1, False)
+ tdSql.checkData(0, 2, 5)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} range('2020-02-01 00:00:06', '2020-02-01 00:00:06') every(1s) fill(prev)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:06.000')
+ tdSql.checkData(0, 1, True)
+ tdSql.checkData(0, 2, 5)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} range('2020-02-01 00:00:06') fill(prev)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:06.000')
+ tdSql.checkData(0, 1, True)
+ tdSql.checkData(0, 2, 5)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} range('2020-02-01 00:00:00', '2020-02-01 00:00:00') every(1s) fill(next)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:00.000')
+ tdSql.checkData(0, 1, True)
+ tdSql.checkData(0, 2, 1)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} range('2020-02-01 00:00:00') fill(next)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:00.000')
+ tdSql.checkData(0, 1, True)
+ tdSql.checkData(0, 2, 1)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} range('2020-02-01 00:00:01', '2020-02-01 00:00:01') every(1s) fill(next)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:01.000')
+ tdSql.checkData(0, 1, False)
+ tdSql.checkData(0, 2, 1)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} range('2020-02-01 00:00:01') fill(next)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:01.000')
+ tdSql.checkData(0, 1, False)
+ tdSql.checkData(0, 2, 1)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} range('2020-02-01 00:00:02', '2020-02-01 00:00:02') every(1s) fill(next)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:02.000')
+ tdSql.checkData(0, 1, True)
+ tdSql.checkData(0, 2, 3)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} range('2020-02-01 00:00:02') fill(next)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:02.000')
+ tdSql.checkData(0, 1, True)
+ tdSql.checkData(0, 2, 3)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} range('2020-02-01 00:00:03', '2020-02-01 00:00:03') every(1s) fill(next)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:03.000')
+ tdSql.checkData(0, 1, False)
+ tdSql.checkData(0, 2, 3)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} range('2020-02-01 00:00:03') fill(next)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:03.000')
+ tdSql.checkData(0, 1, False)
+ tdSql.checkData(0, 2, 3)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} range('2020-02-01 00:00:04', '2020-02-01 00:00:04') every(1s) fill(next)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:04.000')
+ tdSql.checkData(0, 1, True)
+ tdSql.checkData(0, 2, 5)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} range('2020-02-01 00:00:04') fill(next)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:04.000')
+ tdSql.checkData(0, 1, True)
+ tdSql.checkData(0, 2, 5)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} range('2020-02-01 00:00:05', '2020-02-01 00:00:05') every(1s) fill(next)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:05.000')
+ tdSql.checkData(0, 1, False)
+ tdSql.checkData(0, 2, 5)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} range('2020-02-01 00:00:05') fill(next)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:05.000')
+ tdSql.checkData(0, 1, False)
+ tdSql.checkData(0, 2, 5)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} range('2020-02-01 00:00:06', '2020-02-01 00:00:06') every(1s) fill(next)")
+ tdSql.checkRows(0)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} range('2020-02-01 00:00:06') fill(next)")
+ tdSql.checkRows(0)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} range('2020-02-01 00:00:00', '2020-02-01 00:00:00') every(1s) fill(linear)")
+ tdSql.checkRows(0)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} range('2020-02-01 00:00:00') fill(linear)")
+ tdSql.checkRows(0)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} range('2020-02-01 00:00:01', '2020-02-01 00:00:01') every(1s) fill(linear)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:01.000')
+ tdSql.checkData(0, 1, False)
+ tdSql.checkData(0, 2, 1)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} range('2020-02-01 00:00:01') fill(linear)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:01.000')
+ tdSql.checkData(0, 1, False)
+ tdSql.checkData(0, 2, 1)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} range('2020-02-01 00:00:02', '2020-02-01 00:00:02') every(1s) fill(linear)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:02.000')
+ tdSql.checkData(0, 1, True)
+ tdSql.checkData(0, 2, 2)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} range('2020-02-01 00:00:02') fill(linear)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:02.000')
+ tdSql.checkData(0, 1, True)
+ tdSql.checkData(0, 2, 2)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} range('2020-02-01 00:00:03', '2020-02-01 00:00:03') every(1s) fill(linear)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:03.000')
+ tdSql.checkData(0, 1, False)
+ tdSql.checkData(0, 2, 3)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} range('2020-02-01 00:00:03') fill(linear)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:03.000')
+ tdSql.checkData(0, 1, False)
+ tdSql.checkData(0, 2, 3)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} range('2020-02-01 00:00:04', '2020-02-01 00:00:04') every(1s) fill(linear)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:04.000')
+ tdSql.checkData(0, 1, True)
+ tdSql.checkData(0, 2, 4)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} range('2020-02-01 00:00:04') fill(linear)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:04.000')
+ tdSql.checkData(0, 1, True)
+ tdSql.checkData(0, 2, 4)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} range('2020-02-01 00:00:05', '2020-02-01 00:00:05') every(1s) fill(linear)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:05.000')
+ tdSql.checkData(0, 1, False)
+ tdSql.checkData(0, 2, 5)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} range('2020-02-01 00:00:05') fill(linear)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:05.000')
+ tdSql.checkData(0, 1, False)
+ tdSql.checkData(0, 2, 5)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} range('2020-02-01 00:00:06', '2020-02-01 00:00:06') every(1s) fill(linear)")
+ tdSql.checkRows(0)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} range('2020-02-01 00:00:06') fill(linear)")
+ tdSql.checkRows(0)
+
+ # partition by tbname
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} partition by tbname range('2020-02-01 00:00:00', '2020-02-01 00:00:00') every(1s) fill(null)")
+ tdSql.checkRows(3)
+ for i in range(3):
+ tdSql.checkData(i, 0, '2020-02-01 00:00:00.000')
+ tdSql.checkData(i, 1, True)
+ tdSql.checkData(i, 2, None)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} partition by tbname range('2020-02-01 00:00:00') fill(null)")
+ tdSql.checkRows(3)
+ for i in range(3):
+ tdSql.checkData(i, 0, '2020-02-01 00:00:00.000')
+ tdSql.checkData(i, 1, True)
+ tdSql.checkData(i, 2, None)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} partition by tbname range('2020-02-01 00:00:01', '2020-02-01 00:00:01') every(1s) fill(null)")
+ tdSql.checkRows(3)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:01.000')
+ tdSql.checkData(0, 1, False)
+ tdSql.checkData(0, 2, 1)
+ for i in range(1, 3):
+ tdSql.checkData(i, 0, '2020-02-01 00:00:01.000')
+ tdSql.checkData(i, 1, True)
+ tdSql.checkData(i, 2, None)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} partition by tbname range('2020-02-01 00:00:01') fill(null)")
+ tdSql.checkRows(3)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:01.000')
+ tdSql.checkData(0, 1, False)
+ tdSql.checkData(0, 2, 1)
+ for i in range(1, 3):
+ tdSql.checkData(i, 0, '2020-02-01 00:00:01.000')
+ tdSql.checkData(i, 1, True)
+ tdSql.checkData(i, 2, None)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} partition by tbname range('2020-02-01 00:00:02', '2020-02-01 00:00:02') every(1s) fill(null)")
+ tdSql.checkRows(3)
+ for i in range(3):
+ tdSql.checkData(i, 0, '2020-02-01 00:00:02.000')
+ tdSql.checkData(i, 1, True)
+ tdSql.checkData(i, 2, None)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} partition by tbname range('2020-02-01 00:00:02') fill(null)")
+ tdSql.checkRows(3)
+ for i in range(3):
+ tdSql.checkData(i, 0, '2020-02-01 00:00:02.000')
+ tdSql.checkData(i, 1, True)
+ tdSql.checkData(i, 2, None)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} partition by tbname range('2020-02-01 00:00:06', '2020-02-01 00:00:06') every(1s) fill(null)")
+ tdSql.checkRows(3)
+ for i in range(3):
+ tdSql.checkData(i, 0, '2020-02-01 00:00:06.000')
+ tdSql.checkData(i, 1, True)
+ tdSql.checkData(i, 2, None)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} partition by tbname range('2020-02-01 00:00:06') fill(null)")
+ tdSql.checkRows(3)
+ for i in range(3):
+ tdSql.checkData(i, 0, '2020-02-01 00:00:06.000')
+ tdSql.checkData(i, 1, True)
+ tdSql.checkData(i, 2, None)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} partition by tbname range('2020-02-01 00:00:00', '2020-02-01 00:00:00') every(1s) fill(value,0)")
+ tdSql.checkRows(3)
+ for i in range(3):
+ tdSql.checkData(i, 0, '2020-02-01 00:00:00.000')
+ tdSql.checkData(i, 1, True)
+ tdSql.checkData(i, 2, 0)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} partition by tbname range('2020-02-01 00:00:00') fill(value,0)")
+ tdSql.checkRows(3)
+ for i in range(3):
+ tdSql.checkData(i, 0, '2020-02-01 00:00:00.000')
+ tdSql.checkData(i, 1, True)
+ tdSql.checkData(i, 2, 0)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} partition by tbname range('2020-02-01 00:00:01', '2020-02-01 00:00:01') every(1s) fill(value,0)")
+ tdSql.checkRows(3)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:01.000')
+ tdSql.checkData(0, 1, False)
+ tdSql.checkData(0, 2, 1)
+ for i in range(1, 3):
+ tdSql.checkData(i, 0, '2020-02-01 00:00:01.000')
+ tdSql.checkData(i, 1, True)
+ tdSql.checkData(i, 2, 0)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} partition by tbname range('2020-02-01 00:00:01') fill(value,0)")
+ tdSql.checkRows(3)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:01.000')
+ tdSql.checkData(0, 1, False)
+ tdSql.checkData(0, 2, 1)
+ for i in range(1, 3):
+ tdSql.checkData(i, 0, '2020-02-01 00:00:01.000')
+ tdSql.checkData(i, 1, True)
+ tdSql.checkData(i, 2, 0)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} partition by tbname range('2020-02-01 00:00:02', '2020-02-01 00:00:02') every(1s) fill(value,0)")
+ tdSql.checkRows(3)
+ for i in range(3):
+ tdSql.checkData(i, 0, '2020-02-01 00:00:02.000')
+ tdSql.checkData(i, 1, True)
+ tdSql.checkData(i, 2, 0)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} partition by tbname range('2020-02-01 00:00:02') fill(value,0)")
+ tdSql.checkRows(3)
+ for i in range(3):
+ tdSql.checkData(i, 0, '2020-02-01 00:00:02.000')
+ tdSql.checkData(i, 1, True)
+ tdSql.checkData(i, 2, 0)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} partition by tbname range('2020-02-01 00:00:06', '2020-02-01 00:00:06') every(1s) fill(value,0)")
+ tdSql.checkRows(3)
+ for i in range(3):
+ tdSql.checkData(i, 0, '2020-02-01 00:00:06.000')
+ tdSql.checkData(i, 1, True)
+ tdSql.checkData(i, 2, 0)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} partition by tbname range('2020-02-01 00:00:06') fill(value,0)")
+ tdSql.checkRows(3)
+ for i in range(3):
+ tdSql.checkData(i, 0, '2020-02-01 00:00:06.000')
+ tdSql.checkData(i, 1, True)
+ tdSql.checkData(i, 2, 0)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} partition by tbname range('2020-02-01 00:00:00', '2020-02-01 00:00:00') every(1s) fill(prev)")
+ tdSql.checkRows(0)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} partition by tbname range('2020-02-01 00:00:00') fill(prev)")
+ tdSql.checkRows(0)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} partition by tbname range('2020-02-01 00:00:01', '2020-02-01 00:00:01') every(1s) fill(prev)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:01.000')
+ tdSql.checkData(0, 1, False)
+ tdSql.checkData(0, 2, 1)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} partition by tbname range('2020-02-01 00:00:01') fill(prev)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:01.000')
+ tdSql.checkData(0, 1, False)
+ tdSql.checkData(0, 2, 1)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} partition by tbname range('2020-02-01 00:00:02', '2020-02-01 00:00:02') every(1s) fill(prev)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:02.000')
+ tdSql.checkData(0, 1, True)
+ tdSql.checkData(0, 2, 1)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} partition by tbname range('2020-02-01 00:00:02') fill(prev)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:02.000')
+ tdSql.checkData(0, 1, True)
+ tdSql.checkData(0, 2, 1)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} partition by tbname range('2020-02-01 00:00:03', '2020-02-01 00:00:03') every(1s) fill(prev)")
+ tdSql.checkRows(2)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:03.000')
+ tdSql.checkData(0, 1, True)
+ tdSql.checkData(0, 2, 1)
+ tdSql.checkData(1, 0, '2020-02-01 00:00:03.000')
+ tdSql.checkData(1, 1, False)
+ tdSql.checkData(1, 2, 3)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} partition by tbname range('2020-02-01 00:00:03') fill(prev)")
+ tdSql.checkData(0, 0, '2020-02-01 00:00:03.000')
+ tdSql.checkData(0, 1, True)
+ tdSql.checkData(0, 2, 1)
+ tdSql.checkData(1, 0, '2020-02-01 00:00:03.000')
+ tdSql.checkData(1, 1, False)
+ tdSql.checkData(1, 2, 3)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} partition by tbname range('2020-02-01 00:00:04', '2020-02-01 00:00:04') every(1s) fill(prev)")
+ tdSql.checkRows(2)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:04.000')
+ tdSql.checkData(0, 1, True)
+ tdSql.checkData(0, 2, 1)
+ tdSql.checkData(1, 0, '2020-02-01 00:00:04.000')
+ tdSql.checkData(1, 1, True)
+ tdSql.checkData(1, 2, 3)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} partition by tbname range('2020-02-01 00:00:04') fill(prev)")
+ tdSql.checkRows(2)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:04.000')
+ tdSql.checkData(0, 1, True)
+ tdSql.checkData(0, 2, 1)
+ tdSql.checkData(1, 0, '2020-02-01 00:00:04.000')
+ tdSql.checkData(1, 1, True)
+ tdSql.checkData(1, 2, 3)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} partition by tbname range('2020-02-01 00:00:05', '2020-02-01 00:00:05') every(1s) fill(prev)")
+ tdSql.checkRows(3)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:05.000')
+ tdSql.checkData(0, 1, True)
+ tdSql.checkData(0, 2, 1)
+ tdSql.checkData(1, 0, '2020-02-01 00:00:05.000')
+ tdSql.checkData(1, 1, True)
+ tdSql.checkData(1, 2, 3)
+ tdSql.checkData(2, 0, '2020-02-01 00:00:05.000')
+ tdSql.checkData(2, 1, False)
+ tdSql.checkData(2, 2, 5)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} partition by tbname range('2020-02-01 00:00:05') fill(prev)")
+ tdSql.checkRows(3)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:05.000')
+ tdSql.checkData(0, 1, True)
+ tdSql.checkData(0, 2, 1)
+ tdSql.checkData(1, 0, '2020-02-01 00:00:05.000')
+ tdSql.checkData(1, 1, True)
+ tdSql.checkData(1, 2, 3)
+ tdSql.checkData(2, 0, '2020-02-01 00:00:05.000')
+ tdSql.checkData(2, 1, False)
+ tdSql.checkData(2, 2, 5)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} partition by tbname range('2020-02-01 00:00:06', '2020-02-01 00:00:06') every(1s) fill(prev)")
+ tdSql.checkRows(3)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:06.000')
+ tdSql.checkData(0, 1, True)
+ tdSql.checkData(0, 2, 1)
+ tdSql.checkData(1, 0, '2020-02-01 00:00:06.000')
+ tdSql.checkData(1, 1, True)
+ tdSql.checkData(1, 2, 3)
+ tdSql.checkData(2, 0, '2020-02-01 00:00:06.000')
+ tdSql.checkData(2, 1, True)
+ tdSql.checkData(2, 2, 5)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} partition by tbname range('2020-02-01 00:00:06') fill(prev)")
+ tdSql.checkRows(3)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:06.000')
+ tdSql.checkData(0, 1, True)
+ tdSql.checkData(0, 2, 1)
+ tdSql.checkData(1, 0, '2020-02-01 00:00:06.000')
+ tdSql.checkData(1, 1, True)
+ tdSql.checkData(1, 2, 3)
+ tdSql.checkData(2, 0, '2020-02-01 00:00:06.000')
+ tdSql.checkData(2, 1, True)
+ tdSql.checkData(2, 2, 5)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} partition by tbname range('2020-02-01 00:00:06', '2020-02-01 00:00:06') every(1s) fill(next)")
+ tdSql.checkRows(0)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} partition by tbname range('2020-02-01 00:00:06') fill(next)")
+ tdSql.checkRows(0)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} partition by tbname range('2020-02-01 00:00:05', '2020-02-01 00:00:05') every(1s) fill(next)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:05.000')
+ tdSql.checkData(0, 1, False)
+ tdSql.checkData(0, 2, 5)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} partition by tbname range('2020-02-01 00:00:05') fill(next)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:05.000')
+ tdSql.checkData(0, 1, False)
+ tdSql.checkData(0, 2, 5)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} partition by tbname range('2020-02-01 00:00:04', '2020-02-01 00:00:04') every(1s) fill(next)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:04.000')
+ tdSql.checkData(0, 1, True)
+ tdSql.checkData(0, 2, 5)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} partition by tbname range('2020-02-01 00:00:04') fill(next)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:04.000')
+ tdSql.checkData(0, 1, True)
+ tdSql.checkData(0, 2, 5)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} partition by tbname range('2020-02-01 00:00:03', '2020-02-01 00:00:03') every(1s) fill(next)")
+ tdSql.checkRows(2)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:03.000')
+ tdSql.checkData(0, 1, False)
+ tdSql.checkData(0, 2, 3)
+ tdSql.checkData(1, 0, '2020-02-01 00:00:03.000')
+ tdSql.checkData(1, 1, True)
+ tdSql.checkData(1, 2, 5)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} partition by tbname range('2020-02-01 00:00:03') fill(next)")
+ tdSql.checkData(0, 0, '2020-02-01 00:00:03.000')
+ tdSql.checkData(0, 1, False)
+ tdSql.checkData(0, 2, 3)
+ tdSql.checkData(1, 0, '2020-02-01 00:00:03.000')
+ tdSql.checkData(1, 1, True)
+ tdSql.checkData(1, 2, 5)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} partition by tbname range('2020-02-01 00:00:02', '2020-02-01 00:00:02') every(1s) fill(next)")
+ tdSql.checkRows(2)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:02.000')
+ tdSql.checkData(0, 1, True)
+ tdSql.checkData(0, 2, 3)
+ tdSql.checkData(1, 0, '2020-02-01 00:00:02.000')
+ tdSql.checkData(1, 1, True)
+ tdSql.checkData(1, 2, 5)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} partition by tbname range('2020-02-01 00:00:02') fill(next)")
+ tdSql.checkRows(2)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:02.000')
+ tdSql.checkData(0, 1, True)
+ tdSql.checkData(0, 2, 3)
+ tdSql.checkData(1, 0, '2020-02-01 00:00:02.000')
+ tdSql.checkData(1, 1, True)
+ tdSql.checkData(1, 2, 5)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} partition by tbname range('2020-02-01 00:00:01', '2020-02-01 00:00:01') every(1s) fill(next)")
+ tdSql.checkRows(3)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:01.000')
+ tdSql.checkData(0, 1, False)
+ tdSql.checkData(0, 2, 1)
+ tdSql.checkData(1, 0, '2020-02-01 00:00:01.000')
+ tdSql.checkData(1, 1, True)
+ tdSql.checkData(1, 2, 3)
+ tdSql.checkData(2, 0, '2020-02-01 00:00:01.000')
+ tdSql.checkData(2, 1, True)
+ tdSql.checkData(2, 2, 5)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} partition by tbname range('2020-02-01 00:00:01') fill(next)")
+ tdSql.checkRows(3)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:01.000')
+ tdSql.checkData(0, 1, False)
+ tdSql.checkData(0, 2, 1)
+ tdSql.checkData(1, 0, '2020-02-01 00:00:01.000')
+ tdSql.checkData(1, 1, True)
+ tdSql.checkData(1, 2, 3)
+ tdSql.checkData(2, 0, '2020-02-01 00:00:01.000')
+ tdSql.checkData(2, 1, True)
+ tdSql.checkData(2, 2, 5)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} partition by tbname range('2020-02-01 00:00:00', '2020-02-01 00:00:00') every(1s) fill(next)")
+ tdSql.checkRows(3)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:00.000')
+ tdSql.checkData(0, 1, True)
+ tdSql.checkData(0, 2, 1)
+ tdSql.checkData(1, 0, '2020-02-01 00:00:00.000')
+ tdSql.checkData(1, 1, True)
+ tdSql.checkData(1, 2, 3)
+ tdSql.checkData(2, 0, '2020-02-01 00:00:00.000')
+ tdSql.checkData(2, 1, True)
+ tdSql.checkData(2, 2, 5)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} partition by tbname range('2020-02-01 00:00:00') fill(next)")
+ tdSql.checkRows(3)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:00.000')
+ tdSql.checkData(0, 1, True)
+ tdSql.checkData(0, 2, 1)
+ tdSql.checkData(1, 0, '2020-02-01 00:00:00.000')
+ tdSql.checkData(1, 1, True)
+ tdSql.checkData(1, 2, 3)
+ tdSql.checkData(2, 0, '2020-02-01 00:00:00.000')
+ tdSql.checkData(2, 1, True)
+ tdSql.checkData(2, 2, 5)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} partition by tbname range('2020-02-01 00:00:00') fill(linear)")
+ tdSql.checkRows(0)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} partition by tbname range('2020-02-01 00:00:01', '2020-02-01 00:00:01') every(1s) fill(linear)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:01.000')
+ tdSql.checkData(0, 1, False)
+ tdSql.checkData(0, 2, 1)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} partition by tbname range('2020-02-01 00:00:01') fill(linear)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:01.000')
+ tdSql.checkData(0, 1, False)
+ tdSql.checkData(0, 2, 1)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} partition by tbname range('2020-02-01 00:00:02', '2020-02-01 00:00:02') every(1s) fill(linear)")
+ tdSql.checkRows(0)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} partition by tbname range('2020-02-01 00:00:02') fill(linear)")
+ tdSql.checkRows(0)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} partition by tbname range('2020-02-01 00:00:03', '2020-02-01 00:00:03') every(1s) fill(linear)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:03.000')
+ tdSql.checkData(0, 1, False)
+ tdSql.checkData(0, 2, 3)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} partition by tbname range('2020-02-01 00:00:03') fill(linear)")
+ tdSql.checkData(0, 0, '2020-02-01 00:00:03.000')
+ tdSql.checkData(0, 1, False)
+ tdSql.checkData(0, 2, 3)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} partition by tbname range('2020-02-01 00:00:04', '2020-02-01 00:00:04') every(1s) fill(linear)")
+ tdSql.checkRows(0)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} partition by tbname range('2020-02-01 00:00:04') fill(linear)")
+ tdSql.checkRows(0)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} partition by tbname range('2020-02-01 00:00:05', '2020-02-01 00:00:05') every(1s) fill(linear)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:05.000')
+ tdSql.checkData(0, 1, False)
+ tdSql.checkData(0, 2, 5)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} partition by tbname range('2020-02-01 00:00:05') fill(linear)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '2020-02-01 00:00:05.000')
+ tdSql.checkData(0, 1, False)
+ tdSql.checkData(0, 2, 5)
+
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} partition by tbname range('2020-02-01 00:00:06', '2020-02-01 00:00:06') every(1s) fill(linear)")
+ tdSql.checkRows(0)
+ tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_single} partition by tbname range('2020-02-01 00:00:06') fill(linear)")
+ tdSql.checkRows(0)
+
def stop(self):
tdSql.close()
tdLog.success(f"{__file__} successfully executed")
diff --git a/tests/system-test/2-query/odbc.py b/tests/system-test/2-query/odbc.py
index 5241406b65..8fbad93995 100644
--- a/tests/system-test/2-query/odbc.py
+++ b/tests/system-test/2-query/odbc.py
@@ -21,9 +21,7 @@ class TDTestCase:
tdSql.execute("create table db.stb (ts timestamp, c1 bool, c2 tinyint, c3 smallint, c4 int, c5 bigint, c6 tinyint unsigned, c7 smallint unsigned, c8 int unsigned, c9 bigint unsigned, c10 float, c11 double, c12 varchar(100), c13 nchar(100)) tags(t int)")
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")
- # enterprise version: 288, community version: 280
- tdSql.checkData(0, 0, 288)
+ tdSql.execute("select count(*) from information_schema.ins_columns")
tdSql.query("select * from information_schema.ins_columns where table_name = 'ntb'")
tdSql.checkRows(14)
diff --git a/tests/system-test/7-tmq/checkOffsetRowParams.py b/tests/system-test/7-tmq/checkOffsetRowParams.py
new file mode 100644
index 0000000000..8a24148064
--- /dev/null
+++ b/tests/system-test/7-tmq/checkOffsetRowParams.py
@@ -0,0 +1,317 @@
+
+import taos
+import sys
+import time
+import socket
+import os
+import threading
+from enum import Enum
+
+from util.log import *
+from util.sql import *
+from util.cases import *
+from util.dnodes import *
+sys.path.append("./7-tmq")
+from tmqCommon import *
+
+class actionType(Enum):
+ CREATE_DATABASE = 0
+ CREATE_STABLE = 1
+ CREATE_CTABLE = 2
+ INSERT_DATA = 3
+
+class TDTestCase:
+ hostname = socket.gethostname()
+ #rpcDebugFlagVal = '143'
+ #clientCfgDict = {'serverPort': '', 'firstEp': '', 'secondEp':'', 'rpcDebugFlag':'135', 'fqdn':''}
+ #clientCfgDict["rpcDebugFlag"] = rpcDebugFlagVal
+ #updatecfgDict = {'clientCfg': {}, 'serverPort': '', 'firstEp': '', 'secondEp':'', 'rpcDebugFlag':'135', 'fqdn':''}
+ #updatecfgDict["rpcDebugFlag"] = rpcDebugFlagVal
+ #print ("===================: ", updatecfgDict)
+
+ def init(self, conn, logSql, replicaVar=1):
+ self.replicaVar = int(replicaVar)
+ tdLog.debug(f"start to excute {__file__}")
+ tdSql.init(conn.cursor())
+ #tdSql.init(conn.cursor(), logSql) # output sql.txt file
+
+ def getBuildPath(self):
+ selfPath = os.path.dirname(os.path.realpath(__file__))
+
+ if ("community" in selfPath):
+ projPath = selfPath[:selfPath.find("community")]
+ else:
+ projPath = selfPath[:selfPath.find("tests")]
+
+ for root, dirs, files in os.walk(projPath):
+ if ("taosd" in files or "taosd.exe" in files):
+ rootRealPath = os.path.dirname(os.path.realpath(root))
+ if ("packaging" not in rootRealPath):
+ buildPath = root[:len(root) - len("/build/bin")]
+ break
+ return buildPath
+
+ def newcur(self,cfg,host,port):
+ user = "root"
+ password = "taosdata"
+ con=taos.connect(host=host, user=user, password=password, config=cfg ,port=port)
+ cur=con.cursor()
+ print(cur)
+ return cur
+
+ def initConsumerTable(self,cdbName='cdb'):
+ tdLog.info("create consume database, and consume info table, and consume result table")
+ tdSql.query("create database if not exists %s vgroups 1 wal_retention_period 3600"%(cdbName))
+ tdSql.query("drop table if exists %s.consumeinfo "%(cdbName))
+ tdSql.query("drop table if exists %s.consumeresult "%(cdbName))
+
+ tdSql.query("create table %s.consumeinfo (ts timestamp, consumerid int, topiclist binary(1024), keylist binary(1024), expectmsgcnt bigint, ifcheckdata int, ifmanualcommit int)"%cdbName)
+ tdSql.query("create table %s.consumeresult (ts timestamp, consumerid int, consummsgcnt bigint, consumrowcnt bigint, checkresult int)"%cdbName)
+
+ def initConsumerInfoTable(self,cdbName='cdb'):
+ tdLog.info("drop consumeinfo table")
+ tdSql.query("drop table if exists %s.consumeinfo "%(cdbName))
+ tdSql.query("create table %s.consumeinfo (ts timestamp, consumerid int, topiclist binary(1024), keylist binary(1024), expectmsgcnt bigint, ifcheckdata int, ifmanualcommit int)"%cdbName)
+
+ def insertConsumerInfo(self,consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifmanualcommit,cdbName='cdb'):
+ sql = "insert into %s.consumeinfo values "%cdbName
+ sql += "(now, %d, '%s', '%s', %d, %d, %d)"%(consumerId, topicList, keyList, expectrowcnt, ifcheckdata, ifmanualcommit)
+ tdLog.info("consume info sql: %s"%sql)
+ tdSql.query(sql)
+
+ def selectConsumeResult(self,expectRows,cdbName='cdb'):
+ resultList=[]
+ while 1:
+ tdSql.query("select * from %s.consumeresult"%cdbName)
+ #tdLog.info("row: %d, %l64d, %l64d"%(tdSql.getData(0, 1),tdSql.getData(0, 2),tdSql.getData(0, 3))
+ if tdSql.getRows() == expectRows:
+ break
+ else:
+ time.sleep(5)
+
+ for i in range(expectRows):
+ tdLog.info ("consume id: %d, consume msgs: %d, consume rows: %d"%(tdSql.getData(i , 1), tdSql.getData(i , 2), tdSql.getData(i , 3)))
+ resultList.append(tdSql.getData(i , 3))
+
+ return resultList
+
+ def startTmqSimProcess(self,buildPath,cfgPath,pollDelay,dbName,showMsg=1,showRow=1,cdbName='cdb',valgrind=0):
+ if valgrind == 1:
+ logFile = cfgPath + '/../log/valgrind-tmq.log'
+ shellCmd = 'nohup valgrind --log-file=' + logFile
+ shellCmd += '--tool=memcheck --leak-check=full --show-reachable=no --track-origins=yes --show-leak-kinds=all --num-callers=20 -v --workaround-gcc296-bugs=yes '
+
+ if (platform.system().lower() == 'windows'):
+ shellCmd = 'mintty -h never -w hide ' + buildPath + '\\build\\bin\\tmq_sim.exe -c ' + cfgPath
+ shellCmd += " -y %d -d %s -g %d -r %d -w %s "%(pollDelay, dbName, showMsg, showRow, cdbName)
+ shellCmd += "> nul 2>&1 &"
+ else:
+ shellCmd = 'nohup ' + buildPath + '/build/bin/tmq_sim -c ' + cfgPath
+ shellCmd += " -y %d -d %s -g %d -r %d -w %s "%(pollDelay, dbName, showMsg, showRow, cdbName)
+ shellCmd += "> /dev/null 2>&1 &"
+ tdLog.info(shellCmd)
+ os.system(shellCmd)
+
+ def create_database(self,tsql, dbName,dropFlag=1,vgroups=4,replica=1):
+ if dropFlag == 1:
+ tsql.execute("drop database if exists %s"%(dbName))
+
+ tsql.execute("create database if not exists %s vgroups %d replica %d wal_retention_period 3600"%(dbName, vgroups, replica))
+ tdLog.debug("complete to create database %s"%(dbName))
+ return
+
+ def create_stable(self,tsql, dbName,stbName):
+ tsql.execute("create table if not exists %s.%s (ts timestamp, c1 bigint, c2 binary(16)) tags(t1 int)"%(dbName, stbName))
+ tdLog.debug("complete to create %s.%s" %(dbName, stbName))
+ return
+
+ def create_ctables(self,tsql, dbName,stbName,ctbNum):
+ tsql.execute("use %s" %dbName)
+ pre_create = "create table"
+ sql = pre_create
+ #tdLog.debug("doing create one stable %s and %d child table in %s ..." %(stbname, count ,dbname))
+ for i in range(ctbNum):
+ sql += " %s_%d using %s tags(%d)"%(stbName,i,stbName,i+1)
+ if (i > 0) and (i%100 == 0):
+ tsql.execute(sql)
+ sql = pre_create
+ if sql != pre_create:
+ tsql.execute(sql)
+
+ tdLog.debug("complete to create %d child tables in %s.%s" %(ctbNum, dbName, stbName))
+ return
+
+ def insert_data(self,tsql,dbName,stbName,ctbNum,rowsPerTbl,batchNum,startTs=0):
+ tdLog.debug("start to insert data ............")
+ tsql.execute("use %s" %dbName)
+ pre_insert = "insert into "
+ sql = pre_insert
+
+ if startTs == 0:
+ t = time.time()
+ startTs = int(round(t * 1000))
+
+ #tdLog.debug("doing insert data into stable:%s rows:%d ..."%(stbName, allRows))
+ rowsOfSql = 0
+ for i in range(ctbNum):
+ sql += " %s_%d values "%(stbName,i)
+ for j in range(rowsPerTbl):
+ sql += "(%d, %d, 'tmqrow_%d') "%(startTs + j, j, j)
+ rowsOfSql += 1
+ if (j > 0) and ((rowsOfSql == batchNum) or (j == rowsPerTbl - 1)):
+ tsql.execute(sql)
+ rowsOfSql = 0
+ if j < rowsPerTbl - 1:
+ sql = "insert into %s_%d values " %(stbName,i)
+ else:
+ sql = "insert into "
+ #end sql
+ if sql != pre_insert:
+ #print("insert sql:%s"%sql)
+ tsql.execute(sql)
+ tdLog.debug("insert data ............ [OK]")
+ return
+
+ def prepareEnv(self, **parameterDict):
+ # create new connector for my thread
+ tsql=self.newcur(parameterDict['cfg'], 'localhost', 6030)
+
+ if parameterDict["actionType"] == actionType.CREATE_DATABASE:
+ self.create_database(tsql, parameterDict["dbName"])
+ elif parameterDict["actionType"] == actionType.CREATE_STABLE:
+ self.create_stable(tsql, parameterDict["dbName"], parameterDict["stbName"])
+ elif parameterDict["actionType"] == actionType.CREATE_CTABLE:
+ self.create_ctables(tsql, parameterDict["dbName"], parameterDict["stbName"], parameterDict["ctbNum"])
+ elif parameterDict["actionType"] == actionType.INSERT_DATA:
+ self.insert_data(tsql, parameterDict["dbName"], parameterDict["stbName"], parameterDict["ctbNum"], \
+ parameterDict["rowsPerTbl"],parameterDict["batchNum"])
+ else:
+ tdLog.exit("not support's action: ", parameterDict["actionType"])
+
+ return
+
+ def tmqCase1(self, cfgPath, buildPath):
+ tdLog.printNoPrefix("======== test case 1: ")
+
+ self.initConsumerTable()
+
+ # create and start thread
+ parameterDict = {'cfg': '', \
+ 'actionType': 0, \
+ 'dbName': 'db1', \
+ 'dropFlag': 1, \
+ 'vgroups': 4, \
+ 'replica': 1, \
+ 'stbName': 'stb1', \
+ 'ctbNum': 10, \
+ 'rowsPerTbl': 10000, \
+ 'batchNum': 100, \
+ 'startTs': 1640966400000} # 2022-01-01 00:00:00.000
+
+ self.create_database(tdSql, parameterDict["dbName"])
+ self.create_stable(tdSql, parameterDict["dbName"], parameterDict["stbName"])
+
+ tdLog.info("create topics from stb1")
+ topicFromStb1 = 'topic_stb1'
+
+ tdSql.execute("create topic %s as select ts, c1, c2 from %s.%s" %(topicFromStb1, parameterDict['dbName'], parameterDict['stbName']))
+ consumerId = 0
+ expectrowcnt = parameterDict["rowsPerTbl"] * parameterDict["ctbNum"]
+ topicList = topicFromStb1
+ ifcheckdata = 0
+ ifManualCommit = 0
+ keyList = 'group.id:cgrp1,\
+ enable.auto.commit:true,\
+ auto.commit.interval.ms:2000,\
+ auto.offset.reset:earliest'
+ self.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit)
+
+ tdLog.info("start consume processor")
+ pollDelay = 20
+ showMsg = 1
+ showRow = 1
+ self.startTmqSimProcess(buildPath,cfgPath,pollDelay,parameterDict["dbName"],showMsg, showRow)
+
+ tdLog.info("start show subscriptions 1")
+ while(1):
+ tdSql.query("show subscriptions")
+ if (tdSql.getRows() == 0):
+ tdLog.info("sleep")
+ time.sleep(1)
+ elif (tdSql.queryResult[0][4] != None):
+ # tdSql.checkData(0, 4, "earliest")
+ tdSql.checkData(0, 5, 0)
+ break
+
+ tdSql.query("show consumers")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 8, "tbname:1,commit:1,interval:2000,reset:earliest")
+
+ time.sleep(2)
+ tdLog.info("start insert data")
+ self.create_ctables(tdSql, parameterDict["dbName"], parameterDict["stbName"], parameterDict["ctbNum"])
+ self.insert_data(tdSql,\
+ parameterDict["dbName"],\
+ parameterDict["stbName"],\
+ parameterDict["ctbNum"],\
+ parameterDict["rowsPerTbl"],\
+ parameterDict["batchNum"])
+
+ time.sleep(2)
+ tdLog.info("start show subscriptions 2")
+ tdSql.query("show subscriptions")
+ tdSql.checkRows(4)
+ print(tdSql.queryResult)
+ # tdSql.checkData(0, 4, 'offset(log) ver:103')
+ tdSql.checkData(0, 5, 10000)
+ # tdSql.checkData(1, 4, 'offset(log) ver:103')
+ tdSql.checkData(1, 5, 10000)
+ # tdSql.checkData(2, 4, 'offset(log) ver:303')
+ tdSql.checkData(2, 5, 50000)
+ # tdSql.checkData(3, 4, 'offset(log) ver:239')
+ tdSql.checkData(3, 5, 30000)
+
+ tdLog.info("insert process end, and start to check consume result")
+ expectRows = 1
+ resultList = self.selectConsumeResult(expectRows)
+
+ time.sleep(2)
+ tdLog.info("start show subscriptions 3")
+ tdSql.query("show subscriptions")
+ tdSql.checkRows(4)
+ print(tdSql.queryResult)
+ tdSql.checkData(0, 3, None)
+ # tdSql.checkData(0, 4, 'offset(log) ver:103')
+ tdSql.checkData(0, 5, 10000)
+ # tdSql.checkData(1, 4, 'offset(log) ver:103')
+ tdSql.checkData(1, 5, 10000)
+ # tdSql.checkData(2, 4, 'offset(log) ver:303')
+ tdSql.checkData(2, 5, 50000)
+ # tdSql.checkData(3, 4, 'offset(log) ver:239')
+ tdSql.checkData(3, 5, 30000)
+
+ tdSql.query("drop topic %s"%topicFromStb1)
+
+ tdLog.printNoPrefix("======== test case 1 end ...... ")
+
+ def run(self):
+ tdSql.prepare()
+ buildPath = self.getBuildPath()
+ if (buildPath == ""):
+ tdLog.exit("taosd not found!")
+ else:
+ tdLog.info("taosd found in %s" % buildPath)
+ cfgPath = buildPath + "/../sim/psim/cfg"
+ tdLog.info("cfgPath: %s" % cfgPath)
+
+ self.tmqCase1(cfgPath, buildPath)
+ # self.tmqCase2(cfgPath, buildPath)
+
+ def stop(self):
+ tdSql.close()
+ tdLog.success(f"{__file__} successfully executed")
+
+event = threading.Event()
+
+tdCases.addLinux(__file__, TDTestCase())
+tdCases.addWindows(__file__, TDTestCase())
diff --git a/tools/shell/src/shellAuto.c b/tools/shell/src/shellAuto.c
index 19a888fe82..41cdb0f928 100644
--- a/tools/shell/src/shellAuto.c
+++ b/tools/shell/src/shellAuto.c
@@ -91,9 +91,14 @@ SWords shellCommands[] = {
{"create stream into as select", 0, 0, NULL}, // 26 append sub sql
{"create topic as select", 0, 0, NULL}, // 27 append sub sql
{"create function as outputtype language ", 0, 0, NULL},
+ {"create or replace as outputtype language ", 0, 0, NULL},
{"create aggregate function as outputtype bufsize language ", 0, 0, NULL},
+ {"create or replace aggregate function as outputtype bufsize language ", 0, 0, NULL},
{"create user pass sysinfo 0;", 0, 0, NULL},
{"create user pass sysinfo 1;", 0, 0, NULL},
+#ifdef TD_ENTERPRISE
+ {"compact database ", 0, 0, NULL},
+#endif
{"describe ", 0, 0, NULL},
{"delete from where ", 0, 0, NULL},
{"drop database ", 0, 0, NULL},
@@ -117,7 +122,11 @@ SWords shellCommands[] = {
{"kill connection ;", 0, 0, NULL},
{"kill query ", 0, 0, NULL},
{"kill transaction ", 0, 0, NULL},
+#ifdef TD_ENTERPRISE
{"merge vgroup ", 0, 0, NULL},
+#endif
+ {"pause stream ;", 0, 0, NULL},
+ {"resume stream ;", 0, 0, NULL},
{"reset query cache;", 0, 0, NULL},
{"restore dnode ;", 0, 0, NULL},
{"restore vnode on dnode ;", 0, 0, NULL},
@@ -173,7 +182,9 @@ SWords shellCommands[] = {
{"show vgroups;", 0, 0, NULL},
{"show consumers;", 0, 0, NULL},
{"show grants;", 0, 0, NULL},
+#ifdef TD_ENTERPRISE
{"split vgroup ", 0, 0, NULL},
+#endif
{"insert into values(", 0, 0, NULL},
{"insert into using tags(", 0, 0, NULL},
{"insert into using values(", 0, 0, NULL},
@@ -432,9 +443,10 @@ void showHelp() {
kill connection ; \n\
kill query ; \n\
kill transaction ;\n\
- ----- M ----- \n\
- merge vgroup ...\n\
+ ----- P ----- \n\
+ pause stream ;\n\
----- R ----- \n\
+ resume stream ;\n\
reset query cache;\n\
restore dnode ;\n\
restore vnode on dnode ;\n\
@@ -489,14 +501,20 @@ void showHelp() {
show vgroups;\n\
show consumers;\n\
show grants;\n\
- split vgroup ...\n\
----- T ----- \n\
trim database ;\n\
----- U ----- \n\
use ;");
- printf("\n\n");
+#ifdef TD_ENTERPRISE
+ printf(
+ "\n\n\
+ ----- special commands on enterpise version ----- \n\
+ compact database ; \n\
+ split vgroup ;");
+#endif
+ printf("\n\n");
// define in getDuration() function
printf(
"\